Skip to content

Commit 01969f8

Browse files
committed
Merge branch 'main' into fewer-files
2 parents 754c6c2 + ae9c671 commit 01969f8

File tree

1,199 files changed

+709778
-983274
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,199 files changed

+709778
-983274
lines changed

.eslintrc.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@
2525
"/coverage/**"
2626
],
2727
"rules": {
28+
"sort-imports": ["error", {
29+
"ignoreCase": true,
30+
"ignoreDeclarationSort": true,
31+
"allowSeparatedGroups": true
32+
}],
33+
2834
"@typescript-eslint/adjacent-overload-signatures": "error",
2935
"@typescript-eslint/array-type": "error",
3036
"@typescript-eslint/no-array-constructor": "error",

.github/workflows/ci.yml

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,14 @@ jobs:
109109
npm init --yes
110110
npm install $PACKAGE tslib
111111
112+
echo "Testing tsc..."
112113
npx tsc --version
114+
115+
echo "Testing tsserver..."
113116
echo '{"seq": 1, "command": "status"}' | npx tsserver
114117
115-
cat > smoke.js << EOF
118+
cat > smoke.js << 'EOF'
119+
console.log(`Testing ${process.argv[2]}...`);
116120
const { __importDefault, __importStar } = require("tslib");
117121
const ts = require(process.argv[2]);
118122
@@ -132,16 +136,16 @@ jobs:
132136
success = !!fn();
133137
}
134138
catch {}
135-
if (success !== shouldSucceed) {
136-
if (success) {
137-
console.error(`${fn.toString()} unexpectedly succeeded.`);
138-
}
139-
else {
140-
console.error(`${fn.toString()} did not succeed.`);
141-
}
139+
const status = success ? "succeeded" : "failed";
140+
if (success === shouldSucceed) {
141+
console.log(`${fn.toString()} ${status} as expected.`);
142+
}
143+
else {
144+
console.log(`${fn.toString()} unexpectedly ${status}.`);
142145
process.exitCode = 1;
143146
}
144147
}
148+
console.log("ok");
145149
EOF
146150
147151
node ./smoke.js typescript

.vscode/tasks.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// https://github.com/microsoft/vscode/issues/93001
1515
"label": "gulp: tests",
1616
"type": "npm",
17-
"script": "build:tests",
17+
"script": "build:tests -- --no-typecheck",
1818
"group": "build",
1919
"hide": true,
2020
"problemMatcher": [
@@ -44,7 +44,7 @@
4444
{
4545
"label": "npm: build:tests",
4646
"type": "npm",
47-
"script": "build:tests",
47+
"script": "build:tests -- --no-typecheck",
4848
"group": "build",
4949
"problemMatcher": [
5050
"$tsc"

Herebyfile.mjs

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import { task } from "hereby";
66
import _glob from "glob";
77
import util from "util";
88
import chalk from "chalk";
9-
import { exec, readJson, getDiffTool, getDirSize, memoize, needsUpdate, Debouncer, Deferred } from "./scripts/build/utils.mjs";
10-
import { runConsoleTests, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline, cleanTestDirs } from "./scripts/build/tests.mjs";
11-
import { buildProject as realBuildProject, cleanProject, watchProject } from "./scripts/build/projects.mjs";
9+
import { Debouncer, Deferred, exec, getDiffTool, getDirSize, memoize, needsUpdate, readJson } from "./scripts/build/utils.mjs";
10+
import { cleanTestDirs, localBaseline, localRwcBaseline, refBaseline, refRwcBaseline, runConsoleTests } from "./scripts/build/tests.mjs";
11+
import { cleanProject, buildProject as realBuildProject, watchProject } from "./scripts/build/projects.mjs";
1212
import { localizationDirectories } from "./scripts/build/localization.mjs";
1313
import cmdLineOptions from "./scripts/build/options.mjs";
1414
import esbuild from "esbuild";
@@ -328,10 +328,21 @@ function entrypointBuildTask(options) {
328328
},
329329
});
330330

331+
const mainDeps = options.mainDeps?.slice(0) ?? [];
332+
if (cmdLineOptions.bundle) {
333+
mainDeps.push(bundle);
334+
if (cmdLineOptions.typecheck) {
335+
mainDeps.push(build);
336+
}
337+
}
338+
else {
339+
mainDeps.push(build, shim);
340+
}
341+
331342
const main = task({
332343
name: options.name,
333344
description: options.description,
334-
dependencies: (options.mainDeps ?? []).concat(cmdLineOptions.bundle ? [bundle] : [build, shim]),
345+
dependencies: mainDeps,
335346
});
336347

337348
const watch = task({
@@ -358,7 +369,7 @@ function entrypointBuildTask(options) {
358369
}
359370

360371

361-
const { main: tsc, build: buildTsc, watch: watchTsc } = entrypointBuildTask({
372+
const { main: tsc, watch: watchTsc } = entrypointBuildTask({
362373
name: "tsc",
363374
description: "Builds the command-line compiler",
364375
buildDeps: [generateDiagnostics],
@@ -396,7 +407,7 @@ export const dtsServices = task({
396407
});
397408

398409

399-
const { main: tsserver, build: buildTsserver, watch: watchTsserver } = entrypointBuildTask({
410+
const { main: tsserver, watch: watchTsserver } = entrypointBuildTask({
400411
name: "tsserver",
401412
description: "Builds the language server",
402413
buildDeps: [generateDiagnostics],
@@ -405,24 +416,14 @@ const { main: tsserver, build: buildTsserver, watch: watchTsserver } = entrypoin
405416
builtEntrypoint: "./built/local/tsserver/server.js",
406417
output: "./built/local/tsserver.js",
407418
mainDeps: [generateLibs],
408-
// Even though this seems like an exectuable, so could be the default CJS,
409-
// this is used in the browser too. Do the same thing that we do for our
410-
// libraries and generate an IIFE with name `ts`, as to not pollute the global
411-
// scope.
412-
bundlerOptions: { exportIsTsObject: true },
413419
});
414420
export { tsserver, watchTsserver };
415421

416422

417-
const buildMin = task({
418-
name: "build-min",
419-
dependencies: [buildTsc, buildTsserver],
420-
});
421-
422423
export const min = task({
423424
name: "min",
424425
description: "Builds only tsc and tsserver",
425-
dependencies: [tsc, tsserver].concat(cmdLineOptions.typecheck ? [buildMin] : []),
426+
dependencies: [tsc, tsserver],
426427
});
427428

428429
export const watchMin = task({
@@ -591,15 +592,10 @@ export const watchOtherOutputs = task({
591592
dependencies: [watchCancellationToken, watchTypingsInstaller, watchWatchGuard, generateTypesMap, copyBuiltLocalDiagnosticMessages],
592593
});
593594

594-
const buildLocal = task({
595-
name: "build-local",
596-
dependencies: [buildTsc, buildTsserver, buildServices, buildLssl]
597-
});
598-
599595
export const local = task({
600596
name: "local",
601597
description: "Builds the full compiler and services",
602-
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts].concat(cmdLineOptions.typecheck ? [buildLocal] : []),
598+
dependencies: [localize, tsc, tsserver, services, lssl, otherOutputs, dts],
603599
});
604600
export default local;
605601

@@ -610,7 +606,7 @@ export const watchLocal = task({
610606
dependencies: [localize, watchTsc, watchTsserver, watchServices, watchLssl, watchOtherOutputs, dts, watchSrc],
611607
});
612608

613-
const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts, buildSrc] : []);
609+
const runtestsDeps = [tests, generateLibs].concat(cmdLineOptions.typecheck ? [dts] : []);
614610

615611
export const runTests = task({
616612
name: "runtests",
@@ -804,7 +800,7 @@ function baselineAcceptTask(localBaseline, refBaseline) {
804800
}
805801
const toDelete = await glob(`${localBaseline}/**/*.delete`, { nodir: true });
806802
for (const p of toDelete) {
807-
const out = localPathToRefPath(p);
803+
const out = localPathToRefPath(p).replace(/\.delete$/, "");
808804
await fs.promises.rm(out);
809805
}
810806
};

lib/cancellationToken.js

Lines changed: 61 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)