Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .custom-gcl.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# yaml-language-server: $schema=https://golangci-lint.run/jsonschema/custom-gcl.jsonschema.json

version: v2.13.2
version: v2.14.0

destination: ./tools

Expand Down
2 changes: 1 addition & 1 deletion .dprint.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"useTabs": false,
"typescript": {
"newLineKind": "lf",
"semiColons": "always",
"semicolons": "always",
"quoteStyle": "preferDouble",
"quoteProps": "consistent",
"useBraces": "whenNotSingleLine",
Expand Down
21 changes: 10 additions & 11 deletions Herebyfile.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,9 @@ export const generateTristate = goGenerateTask("generate:tristate", [
stringerGenerator("tsc/internal/core/tristate.go", "Tristate", "tristate_stringer_generated.go"),
]);

export const generateDiagnostics = goGenerateTask("generate:diagnostics", [
{
export const generateDiagnostics = goGenerateTask(
"generate:diagnostics",
[{
file: "tsc/internal/diagnostics/diagnostics.go",
inputs: ["generate.go", "diagnosticMessages.json", "../../../tools/LocProject.json", "../{collections,json}/*.go", "loc/*.generated.json"],
exclude: ["**/*_test.go"],
Expand All @@ -534,9 +535,9 @@ export const generateDiagnostics = goGenerateTask("generate:diagnostics", [
],
["dprint", "fmt", "diagnostics_generated.go", "loc_generated.go"],
],
},
stringerGenerator("tsc/internal/diagnostics/diagnostics.go", "Category", "stringer_generated.go"),
], ["tsc/internal/diagnostics/loc"]);
}, stringerGenerator("tsc/internal/diagnostics/diagnostics.go", "Category", "stringer_generated.go")],
["tsc/internal/diagnostics/loc"],
);

export const generateAutoImport = goGenerateTask("generate:autoimport", [
stringerGenerator("tsc/internal/ls/autoimport/export.go", "ExportSyntax", "export_stringer_generated.go"),
Expand Down Expand Up @@ -2119,15 +2120,13 @@ async function sign(filelist, unchangedOutputOkay = false) {
const tmp = await getSignTempDir();
const propsPath = path.resolve(tmp, `signing-items-${signCount++}.props`);
const signingItems = signingFilelist.SignFileRecordList.flatMap(record => record.SignFileList.map(file => ({ path: file.SrcPath, cert: record.Certs, macAppName: record.MacAppName })));
const items = signingItems.map(({ path: filePath, cert, macAppName }) =>
` <FilesToSign Include="${assertMsbuildXmlValue(filePath)}">
const items = signingItems.map(({ path: filePath, cert, macAppName }) => ` <FilesToSign Include="${assertMsbuildXmlValue(filePath)}">
<Authenticode>${assertMsbuildXmlValue(cert)}</Authenticode>
<StrongName>None</StrongName>${
macAppName ? `
macAppName ? `
<MacAppName>${assertMsbuildXmlValue(macAppName)}</MacAppName>` : ""
}
</FilesToSign>`
).join("\n");
}
</FilesToSign>`).join("\n");
await fs.promises.writeFile(
propsPath,
`<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
Expand Down
218 changes: 109 additions & 109 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
"setup-hooks": "node tools/scripts/link-hooks.mjs"
},
"devDependencies": {
"@dprint/json": "^0.25.2",
"@dprint/typescript": "^0.96.1",
"@dprint/json": "^0.26.0",
"@dprint/typescript": "^0.101.0",
"@jakebailey/dprint-plugin-gofumpt": "^0.0.20",
"@types/node": "^22.20.5",
"@unicode/unicode-15.1.0": "^2.1.0",
Expand All @@ -35,7 +35,7 @@
"dprint": "^0.64.3",
"dprint-plugin-yaml": "^0.6.0",
"hereby": "^1.15.2",
"tar": "^7.5.22",
"tar": "^7.5.23",
"tinyexec": "^1.3.1",
"typescript": "^6.0.3"
},
Expand All @@ -52,6 +52,6 @@
"allowScripts": {
"dprint@0.64.3": true,
"esbuild@0.28.2": true,
"@vscode/vsce-sign@2.1.0": true
"@vscode/vsce-sign@2.1.1": true
}
}
4 changes: 2 additions & 2 deletions packages/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@
},
"devDependencies": {
"@types/node": "^22.20.5",
"playwright": "^1.64.1",
"tinybench": "^6.2.2",
"playwright": "^1.65.1",
"tinybench": "^6.2.3",
"vscode-jsonrpc": "^10.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/typescript/src/ast/scanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ function scanJSDocCommentForTags(text: string, tokenFlags: TokenFlags): TokenFla
}
if (
(tokenFlags & (TokenFlags.PrecedingJSDocWithDeprecated | TokenFlags.PrecedingJSDocWithSeeOrLink)) ===
(TokenFlags.PrecedingJSDocWithDeprecated | TokenFlags.PrecedingJSDocWithSeeOrLink)
(TokenFlags.PrecedingJSDocWithDeprecated | TokenFlags.PrecedingJSDocWithSeeOrLink)
) {
return tokenFlags;
}
Expand Down
51 changes: 14 additions & 37 deletions packages/typescript/test/async/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -742,9 +742,7 @@ describe("API", { concurrency }, () => {
});
assert.equal(isolatedDeclarationModuleOutput.diagnostics?.length ?? 0, 0);

const moduleFileOutput = await api.transpileModuleFromFile({ uri: "file:///input.ts" }, {
compilerOptions: { module: ModuleKind.CommonJS },
});
const moduleFileOutput = await api.transpileModuleFromFile({ uri: "file:///input.ts" }, { compilerOptions: { module: ModuleKind.CommonJS } });
assert.match(moduleFileOutput.outputText, /exports\.x = 1/);

const declarationOutput = await api.transpileDeclaration("export const x: number = 1;");
Expand Down Expand Up @@ -3026,11 +3024,14 @@ describe("SourceFile", { concurrency }, () => {
});

test("Program statistics reflect checker work without forcing diagnostics", async () => {
await using api = spawnAPI({
"/src/main.ts": `type Box<T> = { value: T };
await using api = spawnAPI(
{
"/src/main.ts": `type Box<T> = { value: T };
export const box: Box<string> = { value: "hello" };
export const other: { value: string } = box;`,
}, { collectTiming: true });
},
{ collectTiming: true },
);
const snapshot = await api.createSnapshot({
createPrograms: [{ rootFiles: ["/src/main.ts"], compilerOptions: { noLib: true } }],
});
Expand Down Expand Up @@ -3096,9 +3097,7 @@ export const other: { value: string } = box;`,
const references = await program.getProjectReferences();
assert.equal(references?.length, 4);

await using synthetic = await api.createProgram([], { noLib: true }, {
projectReferences: [{ path: "/a/tsconfig.json" }, { path: "/missing/tsconfig.json" }],
});
await using synthetic = await api.createProgram([], { noLib: true }, { projectReferences: [{ path: "/a/tsconfig.json" }, { path: "/missing/tsconfig.json" }] });
assert.equal((await synthetic.getProjectReferences())!.length, 2);
});

Expand Down Expand Up @@ -4645,10 +4644,7 @@ export const value = 1;

test("snapshot-owned symbols resolve cached file-owned parents", async () => {
const source = `interface Box<T> { value: T; }\ndeclare const box: Box<string>;\nbox;`;
await using api = spawnAPI({
"/tsconfig.json": JSON.stringify({ compilerOptions: { strict: true }, files: ["/src/box.ts"] }),
"/src/box.ts": source,
}, { collectTiming: true });
await using api = spawnAPI({ "/tsconfig.json": JSON.stringify({ compilerOptions: { strict: true }, files: ["/src/box.ts"] }), "/src/box.ts": source }, { collectTiming: true });
const snapshot = await api.createSnapshot({ openProjects: ["/tsconfig.json"] });
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const box = await project.checker.getSymbolAtPosition("/src/box.ts", source.indexOf("Box"));
Expand Down Expand Up @@ -9703,12 +9699,7 @@ describe("Program - selected file emit", { concurrency }, () => {
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const result = await project.program.getJavaScriptEmit(["/src/a.ts", "/src/b.ts"]);
assert.equal(result.emitSkipped, false);
assert.deepEqual([...result.outputFiles.keys()], [
"/src/a.js",
"/src/a.js.map",
"/src/b.js",
"/src/b.js.map",
]);
assert.deepEqual([...result.outputFiles.keys()], ["/src/a.js", "/src/a.js.map", "/src/b.js", "/src/b.js.map"]);
const outputFileName = toRootedFilePath("/src/a.js", undefined);
assert.equal(result.outputFiles.get(outputFileName)?.sourceFileName, "/src/a.ts");
assert.match(result.outputFiles.get(outputFileName)!.text, /export const a = 1/);
Expand All @@ -9723,12 +9714,7 @@ describe("Program - selected file emit", { concurrency }, () => {
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const result = await project.program.getDeclarationEmit(["/src/a.ts", "/src/b.ts"]);
assert.equal(result.emitSkipped, false);
assert.deepEqual([...result.outputFiles.keys()], [
"/src/a.d.ts",
"/src/a.d.ts.map",
"/src/b.d.ts",
"/src/b.d.ts.map",
]);
assert.deepEqual([...result.outputFiles.keys()], ["/src/a.d.ts", "/src/a.d.ts.map", "/src/b.d.ts", "/src/b.d.ts.map"]);
assert.equal(result.outputFiles.get(toRootedFilePath("/src/a.d.ts", undefined))?.sourceFileName, "/src/a.ts");
assert.equal(fs.readFile(toRootedFilePath("/src/a.d.ts", undefined)), serverFS.useOS);
});
Expand Down Expand Up @@ -10733,10 +10719,7 @@ describe("Program - emit", { concurrency }, () => {
const snapshot = await api.createSnapshot({ openProjects: ["/tsconfig.json"] });
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const result = await project.program.emitToString(EmitOnly.OnlyDts);
assert.deepEqual([...result.outputFiles.keys()], [
"/dist/src/index.d.ts",
"/dist/src/testing.d.ts",
]);
assert.deepEqual([...result.outputFiles.keys()], ["/dist/src/index.d.ts", "/dist/src/testing.d.ts"]);
assert.equal(fs.readFile(toRootedFilePath("/dist/src/index.js", undefined)), serverFS.useOS);
});

Expand Down Expand Up @@ -10771,16 +10754,10 @@ describe("Program - emit", { concurrency }, () => {
assert.ok(fs.fileExists?.(toRootedFilePath("/dist/src/index.d.ts.map", undefined)));

const js = await project.program.emitToString(EmitOnly.OnlyJs);
assert.deepEqual([...js.outputFiles.keys()], [
"/dist/src/index.js",
"/dist/src/index.js.map",
]);
assert.deepEqual([...js.outputFiles.keys()], ["/dist/src/index.js", "/dist/src/index.js.map"]);

const dts = await project.program.emitToString(EmitOnly.OnlyDts);
assert.deepEqual([...dts.outputFiles.keys()], [
"/dist/src/index.d.ts",
"/dist/src/index.d.ts.map",
]);
assert.deepEqual([...dts.outputFiles.keys()], ["/dist/src/index.d.ts", "/dist/src/index.d.ts.map"]);
});

test("noEmitOnError reports diagnostics without writing output", async () => {
Expand Down
8 changes: 4 additions & 4 deletions packages/typescript/test/async/astnav.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { API } from "@typescript/typescript/async"; // @sync-skip
// @sync-only-start
// import { API } from "@typescript/typescript/sync";
// @sync-only-end
import type {
Node,
SourceFile,
} from "@typescript/typescript/ast";
import {
findNextToken,
findPrecedingToken,
formatSyntaxKind,
getTokenAtPosition,
getTouchingPropertyName,
} from "@typescript/typescript/ast";
import type {
Node,
SourceFile,
} from "@typescript/typescript/ast";
import assert from "node:assert";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
Expand Down
4 changes: 1 addition & 3 deletions packages/typescript/test/path.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,9 +321,7 @@ test("createVirtualFileSystem supports object prototype path components", () =>
});

test("createVirtualFileSystem respects case sensitivity", () => {
const fs = createVirtualFileSystem({
"/Workspace/Foo.ts": "content",
}, { caseSensitivity: CaseSensitivity.Insensitive });
const fs = createVirtualFileSystem({ "/Workspace/Foo.ts": "content" }, { caseSensitivity: CaseSensitivity.Insensitive });
assert.strictEqual(fs.readFile(toRootedFilePath("/workspace/foo.ts", undefined)), "content");
assert.deepStrictEqual(fs.getAccessibleEntries(toRootedDirectoryPath("/workspace", undefined)), {
files: ["Foo.ts"],
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/test/proto.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import type {
SymbolOwner as ProtocolSymbolOwner,
SymbolResponse as ProtocolSymbolResponse,
} from "../src/api/proto.generated.ts";
import type { ProjectId } from "../src/api/proto.ts";
import {
validateSymbolOwner,
validateSymbolResponse,
} from "../src/api/proto.ts";
import type { ProjectId } from "../src/api/proto.ts";
import { SourceFileCache } from "../src/api/sourceFileCache.ts";
import type {
PathKey,
Expand Down
51 changes: 14 additions & 37 deletions packages/typescript/test/sync/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,7 @@ describe("API", { concurrency }, () => {
});
assert.equal(isolatedDeclarationModuleOutput.diagnostics?.length ?? 0, 0);

const moduleFileOutput = api.transpileModuleFromFile({ uri: "file:///input.ts" }, {
compilerOptions: { module: ModuleKind.CommonJS },
});
const moduleFileOutput = api.transpileModuleFromFile({ uri: "file:///input.ts" }, { compilerOptions: { module: ModuleKind.CommonJS } });
assert.match(moduleFileOutput.outputText, /exports\.x = 1/);

const declarationOutput = api.transpileDeclaration("export const x: number = 1;");
Expand Down Expand Up @@ -2842,11 +2840,14 @@ describe("SourceFile", { concurrency }, () => {
});

test("Program statistics reflect checker work without forcing diagnostics", () => {
using api = spawnAPI({
"/src/main.ts": `type Box<T> = { value: T };
using api = spawnAPI(
{
"/src/main.ts": `type Box<T> = { value: T };
export const box: Box<string> = { value: "hello" };
export const other: { value: string } = box;`,
}, { collectTiming: true });
},
{ collectTiming: true },
);
const snapshot = api.createSnapshot({
createPrograms: [{ rootFiles: ["/src/main.ts"], compilerOptions: { noLib: true } }],
});
Expand Down Expand Up @@ -2912,9 +2913,7 @@ export const other: { value: string } = box;`,
const references = program.getProjectReferences();
assert.equal(references?.length, 4);

using synthetic = api.createProgram([], { noLib: true }, {
projectReferences: [{ path: "/a/tsconfig.json" }, { path: "/missing/tsconfig.json" }],
});
using synthetic = api.createProgram([], { noLib: true }, { projectReferences: [{ path: "/a/tsconfig.json" }, { path: "/missing/tsconfig.json" }] });
assert.equal((synthetic.getProjectReferences())!.length, 2);
});

Expand Down Expand Up @@ -4428,10 +4427,7 @@ export const value = 1;

test("snapshot-owned symbols resolve cached file-owned parents", () => {
const source = `interface Box<T> { value: T; }\ndeclare const box: Box<string>;\nbox;`;
using api = spawnAPI({
"/tsconfig.json": JSON.stringify({ compilerOptions: { strict: true }, files: ["/src/box.ts"] }),
"/src/box.ts": source,
}, { collectTiming: true });
using api = spawnAPI({ "/tsconfig.json": JSON.stringify({ compilerOptions: { strict: true }, files: ["/src/box.ts"] }), "/src/box.ts": source }, { collectTiming: true });
const snapshot = api.createSnapshot({ openProjects: ["/tsconfig.json"] });
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const box = project.checker.getSymbolAtPosition("/src/box.ts", source.indexOf("Box"));
Expand Down Expand Up @@ -9461,12 +9457,7 @@ describe("Program - selected file emit", { concurrency }, () => {
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const result = project.program.getJavaScriptEmit(["/src/a.ts", "/src/b.ts"]);
assert.equal(result.emitSkipped, false);
assert.deepEqual([...result.outputFiles.keys()], [
"/src/a.js",
"/src/a.js.map",
"/src/b.js",
"/src/b.js.map",
]);
assert.deepEqual([...result.outputFiles.keys()], ["/src/a.js", "/src/a.js.map", "/src/b.js", "/src/b.js.map"]);
const outputFileName = toRootedFilePath("/src/a.js", undefined);
assert.equal(result.outputFiles.get(outputFileName)?.sourceFileName, "/src/a.ts");
assert.match(result.outputFiles.get(outputFileName)!.text, /export const a = 1/);
Expand All @@ -9481,12 +9472,7 @@ describe("Program - selected file emit", { concurrency }, () => {
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const result = project.program.getDeclarationEmit(["/src/a.ts", "/src/b.ts"]);
assert.equal(result.emitSkipped, false);
assert.deepEqual([...result.outputFiles.keys()], [
"/src/a.d.ts",
"/src/a.d.ts.map",
"/src/b.d.ts",
"/src/b.d.ts.map",
]);
assert.deepEqual([...result.outputFiles.keys()], ["/src/a.d.ts", "/src/a.d.ts.map", "/src/b.d.ts", "/src/b.d.ts.map"]);
assert.equal(result.outputFiles.get(toRootedFilePath("/src/a.d.ts", undefined))?.sourceFileName, "/src/a.ts");
assert.equal(fs.readFile(toRootedFilePath("/src/a.d.ts", undefined)), serverFS.useOS);
});
Expand Down Expand Up @@ -10491,10 +10477,7 @@ describe("Program - emit", { concurrency }, () => {
const snapshot = api.createSnapshot({ openProjects: ["/tsconfig.json"] });
const project = snapshot.getConfiguredProject("/tsconfig.json")!;
const result = project.program.emitToString(EmitOnly.OnlyDts);
assert.deepEqual([...result.outputFiles.keys()], [
"/dist/src/index.d.ts",
"/dist/src/testing.d.ts",
]);
assert.deepEqual([...result.outputFiles.keys()], ["/dist/src/index.d.ts", "/dist/src/testing.d.ts"]);
assert.equal(fs.readFile(toRootedFilePath("/dist/src/index.js", undefined)), serverFS.useOS);
});

Expand Down Expand Up @@ -10529,16 +10512,10 @@ describe("Program - emit", { concurrency }, () => {
assert.ok(fs.fileExists?.(toRootedFilePath("/dist/src/index.d.ts.map", undefined)));

const js = project.program.emitToString(EmitOnly.OnlyJs);
assert.deepEqual([...js.outputFiles.keys()], [
"/dist/src/index.js",
"/dist/src/index.js.map",
]);
assert.deepEqual([...js.outputFiles.keys()], ["/dist/src/index.js", "/dist/src/index.js.map"]);

const dts = project.program.emitToString(EmitOnly.OnlyDts);
assert.deepEqual([...dts.outputFiles.keys()], [
"/dist/src/index.d.ts",
"/dist/src/index.d.ts.map",
]);
assert.deepEqual([...dts.outputFiles.keys()], ["/dist/src/index.d.ts", "/dist/src/index.d.ts.map"]);
});

test("noEmitOnError reports diagnostics without writing output", () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/typescript/test/sync/ast.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import {
getSynthesizedDeepClone,
getSynthesizedDeepClones,
} from "@typescript/typescript/ast/clone";
import * as factory from "@typescript/typescript/ast/factory";
import {
cloneNode,
createBinaryExpression,
Expand All @@ -62,7 +63,6 @@ import {
createStringLiteral,
createToken,
} from "@typescript/typescript/ast/factory";
import * as factory from "@typescript/typescript/ast/factory";
import {
visitEachChild,
visitNode,
Expand Down
Loading