Skip to content

Commit 4982803

Browse files
committed
Merge branch 'master' into sourceMapGenerator
2 parents bca3b68 + ca840ee commit 4982803

File tree

2,423 files changed

+115298
-73984
lines changed

Some content is hidden

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

2,423 files changed

+115298
-73984
lines changed

.github/ISSUE_TEMPLATE/Bug_report.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Please fill in the *entire* template below.
1616
-->
1717

1818
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
19-
**TypeScript Version:** 3.1.0-dev.201xxxxx
19+
**TypeScript Version:** 3.2.0-dev.201xxxxx
2020

2121
<!-- Search terms you tried before logging this (so others can find this issue more easily) -->
2222
**Search Terms:**

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ branches:
2020
- release-2.8
2121
- release-2.9
2222
- release-3.0
23+
- release-3.1
2324

2425
install:
2526
- npm uninstall typescript --no-save

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ Your pull request should:
7272
* Requests need not be a single commit, but should be a linear sequence of commits (i.e. no merge commits in your PR)
7373
* It is desirable, but not necessary, for the tests to pass at each commit
7474
* Have clear commit messages
75-
* e.g. "Refactor feature", "Fix issue", "Add tests for issue"
75+
* e.g. "Minor refactor in goToTypeDefinition", "Fix iterated type in for-await-of", "Add test for preserveWatchOutput on command line"
7676
* Include adequate tests
7777
* At least one test should fail in the absence of your non-test code changes. If your PR does not match this criteria, please specify why
7878
* Tests should include reasonable permutations of the target fix/change
@@ -104,7 +104,7 @@ To run all tests, invoke the `runtests-parallel` target using jake:
104104
jake runtests-parallel
105105
```
106106

107-
This run will all tests; to run only a specific subset of tests, use:
107+
This will run all tests; to run only a specific subset of tests, use:
108108

109109
```Shell
110110
jake runtests tests=<regex>

Gulpfile.js

Lines changed: 57 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ const baselineAccept = require("./scripts/build/baselineAccept");
2424
const cmdLineOptions = require("./scripts/build/options");
2525
const exec = require("./scripts/build/exec");
2626
const browserify = require("./scripts/build/browserify");
27-
const debounce = require("./scripts/build/debounce");
2827
const prepend = require("./scripts/build/prepend");
2928
const { removeSourceMaps } = require("./scripts/build/sourcemaps");
30-
const { CancelSource, CancelError } = require("./scripts/build/cancellation");
29+
const { CancellationTokenSource, CancelError, delay, Semaphore } = require("prex");
3130
const { libraryTargets, generateLibs } = require("./scripts/build/lib");
3231
const { runConsoleTests, cleanTestDirs, writeTestConfigFile, refBaseline, localBaseline, refRwcBaseline, localRwcBaseline } = require("./scripts/build/tests");
3332

@@ -534,57 +533,80 @@ gulp.task(
534533
["watch-diagnostics", "watch-lib"].concat(useCompilerDeps),
535534
() => project.watch(tsserverProject, { typescript: useCompiler }));
536535

537-
gulp.task(
538-
"watch-local",
539-
/*help*/ false,
540-
["watch-lib", "watch-tsc", "watch-services", "watch-server"]);
541-
542536
gulp.task(
543537
"watch-runner",
544538
/*help*/ false,
545539
useCompilerDeps,
546540
() => project.watch(testRunnerProject, { typescript: useCompiler }));
547541

548-
const watchPatterns = [
549-
runJs,
550-
typescriptDts,
551-
tsserverlibraryDts
552-
];
542+
gulp.task(
543+
"watch-local",
544+
"Watches for changes to projects in src/ (but does not execute tests).",
545+
["watch-lib", "watch-tsc", "watch-services", "watch-server", "watch-runner", "watch-lssl"]);
553546

554547
gulp.task(
555548
"watch",
556-
"Watches for changes to the build inputs for built/local/run.js, then executes runtests-parallel.",
549+
"Watches for changes to the build inputs for built/local/run.js, then runs tests.",
557550
["build-rules", "watch-runner", "watch-services", "watch-lssl"],
558551
() => {
559-
/** @type {CancelSource | undefined} */
560-
let runTestsSource;
552+
const sem = new Semaphore(1);
561553

562-
const fn = debounce(() => {
563-
runTests().catch(error => {
564-
if (error instanceof CancelError) {
565-
log.warn("Operation was canceled");
566-
}
567-
else {
568-
log.error(error);
569-
}
570-
});
571-
}, /*timeout*/ 100, { max: 500 });
572-
573-
gulp.watch(watchPatterns, () => project.wait().then(fn));
554+
gulp.watch([runJs, typescriptDts, tsserverlibraryDts], () => {
555+
runTests();
556+
});
574557

575558
// NOTE: gulp.watch is far too slow when watching tests/cases/**/* as it first enumerates *every* file
576559
const testFilePattern = /(\.ts|[\\/]tsconfig\.json)$/;
577560
fs.watch("tests/cases", { recursive: true }, (_, file) => {
578-
if (testFilePattern.test(file)) project.wait().then(fn);
561+
if (testFilePattern.test(file)) runTests();
579562
});
580563

581-
function runTests() {
582-
if (runTestsSource) runTestsSource.cancel();
583-
runTestsSource = new CancelSource();
584-
return cmdLineOptions.tests || cmdLineOptions.failed
585-
? runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true, runTestsSource.token)
586-
: runConsoleTests(runJs, "min", /*runInParallel*/ true, /*watchMode*/ true, runTestsSource.token);
587-
}
564+
async function runTests() {
565+
try {
566+
// Ensure only one instance of the test runner is running at any given time.
567+
if (sem.count > 0) {
568+
await sem.wait();
569+
try {
570+
// Wait for any concurrent recompilations to complete...
571+
try {
572+
await delay(100);
573+
while (project.hasRemainingWork()) {
574+
await project.waitForWorkToComplete();
575+
await delay(500);
576+
}
577+
}
578+
catch (e) {
579+
if (e instanceof CancelError) return;
580+
throw e;
581+
}
582+
583+
// cancel any pending or active test run if a new recompilation is triggered
584+
const source = new CancellationTokenSource();
585+
project.waitForWorkToStart().then(() => {
586+
source.cancel();
587+
});
588+
589+
if (cmdLineOptions.tests || cmdLineOptions.failed) {
590+
await runConsoleTests(runJs, "mocha-fivemat-progress-reporter", /*runInParallel*/ false, /*watchMode*/ true, source.token);
591+
}
592+
else {
593+
await runConsoleTests(runJs, "min", /*runInParallel*/ true, /*watchMode*/ true, source.token);
594+
}
595+
}
596+
finally {
597+
sem.release();
598+
}
599+
}
600+
}
601+
catch (e) {
602+
if (e instanceof CancelError) {
603+
log.warn("Operation was canceled");
604+
}
605+
else {
606+
log.error(e);
607+
}
608+
}
609+
};
588610
});
589611

590612
gulp.task("clean-built", /*help*/ false, [`clean:${diagnosticInformationMapTs}`], () => del(["built"]));

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Change to the TypeScript directory:
6161
cd TypeScript
6262
```
6363

64-
Install Jake tools and dev dependencies:
64+
Install [Jake](http://jakejs.com/) tools and dev dependencies:
6565

6666
```bash
6767
npm install -g jake

doc/spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ function f(s) {
286286
}
287287
```
288288

289-
In the JavaScript output, all type annotations have been erased. In general, TypeScript erases all type information before emiting JavaScript.
289+
In the JavaScript output, all type annotations have been erased. In general, TypeScript erases all type information before emitting JavaScript.
290290

291291
## <a name="1.1"/>1.1 Ambient Declarations
292292

lib/tsc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63675,7 +63675,7 @@ var ts;
6367563675
emitCallback(node);
6367663676
}
6367763677
if (extendedDiagnostics) {
63678-
ts.performance.mark("beginEmitBodyWithDetachedCommetns");
63678+
ts.performance.mark("beginEmitBodyWithDetachedComments");
6367963679
}
6368063680
if (!skipTrailingComments) {
6368163681
emitLeadingComments(detachedRange.end, true);
@@ -63684,7 +63684,7 @@ var ts;
6368463684
}
6368563685
}
6368663686
if (extendedDiagnostics) {
63687-
ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns");
63687+
ts.performance.measure("commentTime", "beginEmitBodyWithDetachedComments");
6368863688
}
6368963689
}
6369063690
function emitLeadingComments(pos, isEmittedNode) {

lib/tsserver.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78883,7 +78883,7 @@ var ts;
7888378883
emitCallback(node);
7888478884
}
7888578885
if (extendedDiagnostics) {
78886-
ts.performance.mark("beginEmitBodyWithDetachedCommetns");
78886+
ts.performance.mark("beginEmitBodyWithDetachedComments");
7888778887
}
7888878888
if (!skipTrailingComments) {
7888978889
emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true);
@@ -78892,7 +78892,7 @@ var ts;
7889278892
}
7889378893
}
7889478894
if (extendedDiagnostics) {
78895-
ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns");
78895+
ts.performance.measure("commentTime", "beginEmitBodyWithDetachedComments");
7889678896
}
7889778897
}
7889878898
function emitLeadingComments(pos, isEmittedNode) {

lib/tsserverlibrary.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78870,7 +78870,7 @@ var ts;
7887078870
emitCallback(node);
7887178871
}
7887278872
if (extendedDiagnostics) {
78873-
ts.performance.mark("beginEmitBodyWithDetachedCommetns");
78873+
ts.performance.mark("beginEmitBodyWithDetachedComments");
7887478874
}
7887578875
if (!skipTrailingComments) {
7887678876
emitLeadingComments(detachedRange.end, /*isEmittedNode*/ true);
@@ -78879,7 +78879,7 @@ var ts;
7887978879
}
7888078880
}
7888178881
if (extendedDiagnostics) {
78882-
ts.performance.measure("commentTime", "beginEmitBodyWithDetachedCommetns");
78882+
ts.performance.measure("commentTime", "beginEmitBodyWithDetachedComments");
7888378883
}
7888478884
}
7888578885
function emitLeadingComments(pos, isEmittedNode) {

0 commit comments

Comments
 (0)