Skip to content

Commit d178ea4

Browse files
committed
Merge branch 'main' into fix21732
# Conflicts: # src/compiler/checker.ts
2 parents 335d7c8 + 3c3820b commit d178ea4

File tree

451 files changed

+15662
-14699
lines changed

Some content is hidden

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

451 files changed

+15662
-14699
lines changed

.eslintignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,20 @@
33
/tests/**
44
/lib/**
55
/src/lib/*.generated.d.ts
6+
# Ignore all compiled script outputs
67
/scripts/*.js
8+
# But, not the ones that are hand-written.
9+
# TODO: remove once scripts are pure JS
10+
!/scripts/browserIntegrationTest.js
11+
!/scripts/createPlaygroundBuild.js
12+
!/scripts/failed-tests.js
13+
!/scripts/find-unused-diagnostic-messages.js
14+
!/scripts/lint-hooks.js
15+
!/scripts/perf-result-post.js
16+
!/scripts/post-vsts-artifact-comment.js
17+
!/scripts/regenerate-unicode-identifier-parts.js
18+
!/scripts/run-sequence.js
19+
!/scripts/update-experimental-branches.js
720
/scripts/eslint/built/**
821
/internal/**
922
/coverage/**

.eslintrc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
//
2323
// ESLint in VS Code will lint any opened file (so long as it's not eslintignore'd), so
2424
// that will work regardless of the below.
25-
{ "files": ["*.ts"] }
25+
{ "files": ["*.ts", "*.mts", "*.cts", "*.mjs", "*.cjs"] }
2626
],
2727
"rules": {
2828
"@typescript-eslint/adjacent-overload-signatures": "error",

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
- run: npm ci
4747

4848
- name: Linter
49-
run: npm run lint:ci
49+
run: npm run lint
5050

5151
browser-integration:
5252
runs-on: ubuntu-latest

Gulpfile.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,6 @@ const lint = eslint(".");
372372
lint.displayName = "lint";
373373
task("lint", lint);
374374
task("lint").description = "Runs eslint on the compiler and scripts sources.";
375-
task("lint").flags = {
376-
" --ci": "Runs eslint additional rules",
377-
};
378375

379376
const buildCancellationToken = () => buildProject("src/cancellationToken");
380377
const cleanCancellationToken = () => cleanProject("src/cancellationToken");

package-lock.json

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

package.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
"mocha-fivemat-progress-reporter": "latest",
9191
"ms": "^2.1.3",
9292
"node-fetch": "^2.6.7",
93-
"prex": "^0.4.7",
9493
"source-map-support": "latest",
9594
"typescript": "^4.8.2",
9695
"vinyl": "latest",
@@ -110,7 +109,6 @@
110109
"clean": "gulp clean",
111110
"gulp": "gulp",
112111
"lint": "gulp lint",
113-
"lint:ci": "gulp lint --ci",
114112
"setup-hooks": "node scripts/link-hooks.js"
115113
},
116114
"browser": {

scripts/build/options.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22
const minimist = require("minimist");
33
const os = require("os");
44

5+
const ci = ["1", "true"].includes(process.env.CI);
6+
57
/** @type {CommandLineOptions} */
68
module.exports = minimist(process.argv.slice(2), {
7-
boolean: ["dirty", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built"],
9+
boolean: ["dirty", "light", "colors", "lint", "lkg", "soft", "fix", "failed", "keepFailed", "force", "built", "ci"],
810
string: ["browser", "tests", "break", "host", "reporter", "stackTraceLimit", "timeout", "shards", "shardId"],
911
alias: {
1012
/* eslint-disable quote-props */
@@ -33,12 +35,13 @@ module.exports = minimist(process.argv.slice(2), {
3335
reporter: process.env.reporter || process.env.r,
3436
lint: process.env.lint || true,
3537
fix: process.env.fix || process.env.f,
36-
workers: process.env.workerCount || ((os.cpus().length - (process.env.CI ? 0 : 1)) || 1),
38+
workers: process.env.workerCount || ((os.cpus().length - (ci ? 0 : 1)) || 1),
3739
failed: false,
3840
keepFailed: false,
3941
lkg: true,
4042
dirty: false,
41-
built: false
43+
built: false,
44+
ci,
4245
}
4346
});
4447

@@ -67,6 +70,7 @@ if (module.exports.built) {
6770
* @property {string|number} timeout
6871
* @property {boolean} failed
6972
* @property {boolean} keepFailed
73+
* @property {boolean} ci
7074
*
7175
* @typedef {import("minimist").ParsedArgs & TypedOptions} CommandLineOptions
7276
*/

scripts/build/tests.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ const path = require("path");
66
const mkdirP = require("mkdirp");
77
const log = require("fancy-log");
88
const cmdLineOptions = require("./options");
9-
const { CancellationToken } = require("prex");
109
const { exec } = require("./utils");
1110
const { findUpFile } = require("./findUpDir");
1211

@@ -22,9 +21,8 @@ exports.localTest262Baseline = "internal/baselines/test262/local";
2221
* @param {string} defaultReporter
2322
* @param {boolean} runInParallel
2423
* @param {boolean} watchMode
25-
* @param {import("prex").CancellationToken} [cancelToken]
2624
*/
27-
async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode, cancelToken = CancellationToken.none) {
25+
async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode) {
2826
let testTimeout = cmdLineOptions.timeout;
2927
const tests = cmdLineOptions.tests;
3028
const inspect = cmdLineOptions.break || cmdLineOptions.inspect;
@@ -38,7 +36,6 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
3836
const shardId = +cmdLineOptions.shardId || undefined;
3937
if (!cmdLineOptions.dirty) {
4038
await cleanTestDirs();
41-
cancelToken.throwIfCancellationRequested();
4239
}
4340

4441
if (fs.existsSync(testConfigFile)) {
@@ -121,19 +118,17 @@ async function runConsoleTests(runJs, defaultReporter, runInParallel, watchMode,
121118

122119
try {
123120
setNodeEnvToDevelopment();
124-
const { exitCode } = await exec(process.execPath, args, {
125-
cancelToken,
126-
});
121+
const { exitCode } = await exec(process.execPath, args);
127122
if (exitCode !== 0) {
128123
errorStatus = exitCode;
129124
error = new Error(`Process exited with status code ${errorStatus}.`);
130125
}
131-
else if (process.env.CI === "true") {
126+
else if (cmdLineOptions.ci) {
132127
// finally, do a sanity check and build the compiler with the built version of itself
133128
log.info("Starting sanity check build...");
134129
// Cleanup everything except lint rules (we'll need those later and would rather not waste time rebuilding them)
135-
await exec("gulp", ["clean-tsc", "clean-services", "clean-tsserver", "clean-lssl", "clean-tests"], { cancelToken });
136-
const { exitCode } = await exec("gulp", ["local", "--lkg=false"], { cancelToken });
130+
await exec("gulp", ["clean-tsc", "clean-services", "clean-tsserver", "clean-lssl", "clean-tests"]);
131+
const { exitCode } = await exec("gulp", ["local", "--lkg=false"]);
137132
if (exitCode !== 0) {
138133
errorStatus = exitCode;
139134
error = new Error(`Sanity check build process exited with status code ${errorStatus}.`);

scripts/build/utils.js

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const ts = require("../../lib/typescript");
1414
const chalk = require("chalk");
1515
const which = require("which");
1616
const { spawn } = require("child_process");
17-
const { CancellationToken, CancelError, Deferred } = require("prex");
1817
const { Readable, Duplex } = require("stream");
1918

2019
/**
@@ -25,26 +24,17 @@ const { Readable, Duplex } = require("stream");
2524
*
2625
* @typedef ExecOptions
2726
* @property {boolean} [ignoreExitCode]
28-
* @property {import("prex").CancellationToken} [cancelToken]
2927
* @property {boolean} [hidePrompt]
3028
* @property {boolean} [waitForExit=true]
3129
*/
3230
async function exec(cmd, args, options = {}) {
3331
return /**@type {Promise<{exitCode: number}>}*/(new Promise((resolve, reject) => {
34-
const { ignoreExitCode, cancelToken = CancellationToken.none, waitForExit = true } = options;
35-
cancelToken.throwIfCancellationRequested();
32+
const { ignoreExitCode, waitForExit = true } = options;
3633

3734
if (!options.hidePrompt) log(`> ${chalk.green(cmd)} ${args.join(" ")}`);
3835
const proc = spawn(which.sync(cmd), args, { stdio: waitForExit ? "inherit" : "ignore" });
39-
const registration = cancelToken.register(() => {
40-
log(`${chalk.red("killing")} '${chalk.green(cmd)} ${args.join(" ")}'...`);
41-
proc.kill("SIGINT");
42-
proc.kill("SIGTERM");
43-
reject(new CancelError());
44-
});
4536
if (waitForExit) {
4637
proc.on("exit", exitCode => {
47-
registration.unregister();
4838
if (exitCode === 0 || ignoreExitCode) {
4939
resolve({ exitCode });
5040
}
@@ -53,7 +43,6 @@ async function exec(cmd, args, options = {}) {
5343
}
5444
});
5545
proc.on("error", error => {
56-
registration.unregister();
5746
reject(error);
5847
});
5948
}
@@ -395,6 +384,15 @@ function rm(dest, opts) {
395384
}
396385
exports.rm = rm;
397386

387+
class Deferred {
388+
constructor() {
389+
this.promise = new Promise((resolve, reject) => {
390+
this.resolve = resolve;
391+
this.reject = reject;
392+
});
393+
}
394+
}
395+
398396
class Debouncer {
399397
/**
400398
* @param {number} timeout

scripts/failed-tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class FailedTestsReporter extends Mocha.reporters.Base {
4545
}
4646
}
4747

48-
const newOptions = Object.assign({}, options, { reporterOptions: reporterOptions.reporterOptions || {} });
48+
const newOptions = { ...options, reporterOptions: reporterOptions.reporterOptions || {} };
4949
if (reporterOptions.reporter === "xunit") {
5050
newOptions.reporterOptions.output = "TEST-results.xml";
5151
}
@@ -142,4 +142,4 @@ class FailedTestsReporter extends Mocha.reporters.Base {
142142
}
143143
}
144144

145-
module.exports = FailedTestsReporter;
145+
module.exports = FailedTestsReporter;

0 commit comments

Comments
 (0)