Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a9c78b1
Generate compiler option definitions from shared metadata
jakebailey Sep 25, 2026
9451945
Generate inapplicable transpile option clearing
jakebailey Sep 25, 2026
65bb599
Generate TypeScript enums from authoritative metadata
jakebailey Sep 25, 2026
9e961a3
Include configuration schemas in the TypeScript package
jakebailey Sep 25, 2026
57a988b
Type-check diagnostic references in compiler option metadata
jakebailey Sep 25, 2026
21d37ab
Preserve schema annotations around draft-07 references
jakebailey Sep 25, 2026
bda2ff8
Restore BuildOptions parsing documentation
jakebailey Sep 25, 2026
05d6c83
Merge remote-tracking branch 'upstream/main' into generate-compiler-o…
jakebailey Sep 26, 2026
5806089
Generate compiler option comparisons and build-info traversal
jakebailey Sep 26, 2026
1413abf
Generate compiler option merging from shared metadata
jakebailey Sep 26, 2026
e868f72
Generate config directory substitution from option metadata
jakebailey Sep 26, 2026
4d863cf
Generate showConfig serialization from option metadata
jakebailey Sep 26, 2026
75b8fdf
Generate compiler option equality from shared metadata
jakebailey Sep 26, 2026
ee99dde
Use explicit parsed option equality in watch mode
jakebailey Sep 26, 2026
bd02625
Guard parsed option equality coverage against new fields
jakebailey Sep 26, 2026
09c244c
Consolidate generated option code and related tests
jakebailey Sep 26, 2026
f631e93
Retain deprecated historical options in configuration schemas
jakebailey Sep 26, 2026
0f79014
Merge upstream main into generate-compiler-options
jakebailey Sep 28, 2026
fea4240
Merge remote-tracking branch 'upstream/main' into generate-compiler-o…
jakebailey Sep 30, 2026
4508e5f
Remove unused watch options
jakebailey Sep 30, 2026
9c49725
Generate API compiler options directly from metadata
jakebailey Sep 30, 2026
2a89280
Generate compiler option enum display names
jakebailey Sep 30, 2026
7e1923c
Generate complete transpilation option overrides
jakebailey Sep 30, 2026
44bcf68
Generate all showConfig serialization exclusions
jakebailey Sep 30, 2026
c988466
Exclude file listings consistently from showConfig
jakebailey Sep 30, 2026
6bb738d
Generate config schemas in the TypeScript package
jakebailey Sep 30, 2026
d8f9f0d
Defer Go-dependent generators until Go sources are generated
jakebailey Sep 30, 2026
74e4925
Trim redundant compiler option generation tests
jakebailey Sep 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 51 additions & 12 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { task } from "hereby";
import assert from "node:assert";
import crypto from "node:crypto";
import fs from "node:fs";
import { createRequire } from "node:module";
import os from "node:os";
import path from "node:path";
import url from "node:url";
Expand Down Expand Up @@ -347,6 +348,9 @@ async function runGenerateGo() {
for (const generate of goGenerateActions) {
await generate();
}
// These generators load Go packages, so all generated Go sources must be current.
await runGenerateEnums();
await runGenerateAPI();
}

export const generateGo = task({
Expand Down Expand Up @@ -472,10 +476,27 @@ export const generateChecker = goGenerateTask("generate:checker", [
stringerGenerator("tsc/internal/checker/types.go", "SignatureKind", "stringer_generated.go"),
]);

export const generateCompilerOptions = goGenerateTask("generate:compileroptions", [
stringerGenerator("tsc/internal/core/compileroptions.go", "ModuleKind", "modulekind_stringer_generated.go", "ModuleKind"),
stringerGenerator("tsc/internal/core/compileroptions.go", "ScriptTarget", "scripttarget_stringer_generated.go", "ScriptTarget"),
]);
async function runGenerateOptionDefinitions() {
const { default: generate } = await import("./tools/scripts/tsc/generate-options.ts");
await generate(!!options.force);
}

async function runGenerateCompilerOptions() {
await runGenerateOptionDefinitions();
await runGoGenerator("generate:compileroptions", stringerGenerator("tsc/internal/core/options_generated.go", "ModuleKind", "modulekind_stringer_generated.go", "ModuleKind"));
await runGoGenerator("generate:compileroptions", stringerGenerator("tsc/internal/core/options_generated.go", "ScriptTarget", "scripttarget_stringer_generated.go", "ScriptTarget"));
}

goGenerateActions.push(runGenerateCompilerOptions);
export const generateCompilerOptions = task({
name: "generate:compileroptions",
description: "Generates compiler options and their dependent API files. Pass --force to regenerate unchanged files.",
run: async () => {
await runGenerateCompilerOptions();
await runGenerateEnums();
await runGenerateAPI();
},
});

export const generateLanguageVariant = goGenerateTask("generate:languagevariant", [
stringerGenerator("tsc/internal/core/languagevariant.go", "LanguageVariant", "languagevariant_stringer_generated.go"),
Expand Down Expand Up @@ -628,7 +649,7 @@ async function runGenerateEnums() {

export const generateEnums = task({
name: "generate:enums",
description: "Generates TypeScript enum files from Go source. Pass --force to regenerate unchanged files.",
description: "Generates TypeScript enums from metadata and Go source. Pass --force to regenerate unchanged files.",
run: runGenerateEnums,
});

Expand Down Expand Up @@ -668,7 +689,7 @@ async function runGenerateAPI() {
"tsc/internal/tspath/path.go",
"tools/gen-proto/*.go",
],
exclude: ["**/*_test.go", "**/*_generated.go"],
exclude: ["**/*_test.go"],
envInputs: [],
outputs: ["packages/typescript/src/api/proto.generated.ts"],
commands: [
Expand All @@ -678,7 +699,11 @@ async function runGenerateAPI() {
});
}

export const generateAPI = goGenerateTask("generate:api", runGenerateAPI);
export const generateAPI = task({
name: "generate:api",
description: "Generates API files. Pass --force to regenerate unchanged files.",
run: runGenerateAPI,
});

const vendorJsonrpcDir = "packages/typescript/vendor/vscode-jsonrpc";
const vendorJsonrpcSrc = "node_modules/vscode-jsonrpc";
Expand Down Expand Up @@ -718,10 +743,7 @@ const generateCompiler = task({
name: "generate:compiler",
hiddenFromTaskList: true,
dependencies: [generateAST, generateLSP],
run: async () => {
await runGenerateGo();
await runGenerateEnums();
},
run: runGenerateGo,
});

export const generate = task({
Expand Down Expand Up @@ -964,7 +986,7 @@ export const testCodegen = task({
description: "Runs incremental codegen tests.",
run: async () => {
await run("go", ["-C", "tsc", "mod", "download"]);
await run("node", ["--test", "--test-concurrency=1", "./tools/scripts/gen/*.test.mts"]);
await run("node", ["--test", "--test-concurrency=1", "./tools/scripts/gen/*.test.mts", "./tools/scripts/tsc/*.test.ts"]);
},
});

Expand Down Expand Up @@ -1170,6 +1192,9 @@ export const validate = task({
}
if (options.all) {
await runValidation("test:tools", runTestTools);
await runValidation("test:options", async () => {
await run("node", ["--test", "./tools/scripts/tsc/options.test.ts"]);
});
await runValidation("test:smoke", runSmokeTest); // in CI this is run with `--race`
}
await runValidation("lint", runLint);
Expand Down Expand Up @@ -2354,6 +2379,20 @@ async function testNativePreviewPackage(platforms) {
await cpRecursive(hostPlatform.npmDir, platformPackageDir);
await fs.promises.writeFile(sourceFile, 'export const value: string = "value";\n');

const require = createRequire(sourceFile);
const { stdout } = await runOutput("npm", ["pack", "--dry-run", "--json", mainPackageDir]);
/** @type {{ files: { path: string }[] }[]} */
const packed = JSON.parse(stdout);
for (const name of ["tsconfig", "jsconfig"]) {
const schemaPath = `schemas/${name}.schema.json`;
assert(packed[0].files.some(file => file.path === schemaPath), `Package is missing ${schemaPath}`);
assert.deepEqual(
await fs.promises.readFile(path.join(mainPackageDir, schemaPath)),
await fs.promises.readFile(path.join("packages/typescript", schemaPath)),
);
assert.equal(require.resolve(`${mainNativePreviewPackage.npmPackageName}/${schemaPath}`), path.join(mainPackageDir, schemaPath));
}

const binName = publishAsTypescript ? "tsc" : "tsgo";
const binPath = path.join(mainPackageDir, "bin", binName);
const { stdout: versionOutput } = await runOutput(process.execPath, [binPath, "--version"]);
Expand Down
3 changes: 3 additions & 0 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"files": [
"bin",
"lib",
"schemas",
"dist",
"vendor"
],
Expand All @@ -37,6 +38,8 @@
},
"exports": {
"./package.json": "./package.json",
"./schemas/tsconfig.schema.json": "./schemas/tsconfig.schema.json",
"./schemas/jsconfig.schema.json": "./schemas/jsconfig.schema.json",
Comment thread
jakebailey marked this conversation as resolved.
".": "./lib/version.cjs",
"./unstable/sync": {
"@typescript/source": "./src/api/sync/api.ts",
Expand Down
Loading
Loading