Skip to content

Commit d20cebf

Browse files
committed
Merge branch 'master' into CancellationChecksForLowPriorityTasks
2 parents 21ef907 + c949116 commit d20cebf

File tree

1,470 files changed

+43045
-13669
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,470 files changed

+43045
-13669
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ internal/
5757
!tests/cases/projects/NodeModulesSearch/**/*
5858
!tests/baselines/reference/project/nodeModules*/**/*
5959
.idea
60+
yarn.lock

Gulpfile.ts

Lines changed: 36 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import * as cp from "child_process";
33
import * as path from "path";
44
import * as fs from "fs";
5+
import child_process = require("child_process");
56
import originalGulp = require("gulp");
67
import helpMaker = require("gulp-help");
78
import runSequence = require("run-sequence");
@@ -21,10 +22,6 @@ declare module "gulp-typescript" {
2122
import * as insert from "gulp-insert";
2223
import * as sourcemaps from "gulp-sourcemaps";
2324
import Q = require("q");
24-
declare global {
25-
// `del` further depends on `Promise` (and is also not included), so we just, patch the global scope's Promise to Q's (which we already include in our deps because gulp depends on it)
26-
type Promise<T> = Q.Promise<T>;
27-
}
2825
import del = require("del");
2926
import mkdirP = require("mkdirp");
3027
import minimist = require("minimist");
@@ -41,7 +38,7 @@ const {runTestsInParallel} = mochaParallel;
4138
Error.stackTraceLimit = 1000;
4239

4340
const cmdLineOptions = minimist(process.argv.slice(2), {
44-
boolean: ["debug", "light", "colors", "lint", "soft"],
41+
boolean: ["debug", "inspect", "light", "colors", "lint", "soft"],
4542
string: ["browser", "tests", "host", "reporter", "stackTraceLimit"],
4643
alias: {
4744
d: "debug",
@@ -57,6 +54,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
5754
soft: false,
5855
colors: process.env.colors || process.env.color || true,
5956
debug: process.env.debug || process.env.d,
57+
inspect: process.env.inspect,
6058
host: process.env.TYPESCRIPT_HOST || process.env.host || "node",
6159
browser: process.env.browser || process.env.b || "IE",
6260
tests: process.env.test || process.env.tests || process.env.t,
@@ -138,6 +136,14 @@ const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
138136
return { target: "lib." + source, sources: ["header.d.ts", source] };
139137
});
140138

139+
const esnextLibrarySource = [
140+
"esnext.asynciterable.d.ts"
141+
];
142+
143+
const esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
144+
return { target: "lib." + source, sources: ["header.d.ts", source] };
145+
});
146+
141147
const hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
142148

143149
const librarySourceMap = [
@@ -152,11 +158,12 @@ const librarySourceMap = [
152158
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
153159
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
154160
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
161+
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },
155162

156163
// JavaScript + all host library
157164
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
158165
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
159-
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
166+
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
160167

161168
const libraryTargets = librarySourceMap.map(function(f) {
162169
return path.join(builtLocalDirectory, f.target);
@@ -384,7 +391,7 @@ gulp.task(builtLocalCompiler, false, [servicesFile], () => {
384391
.pipe(localCompilerProject())
385392
.pipe(prependCopyright())
386393
.pipe(sourcemaps.write("."))
387-
.pipe(gulp.dest("."));
394+
.pipe(gulp.dest("src/compiler"));
388395
});
389396

390397
gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
@@ -410,13 +417,13 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
410417
file.path = nodeDefinitionsFile;
411418
return content + "\r\nexport = ts;";
412419
}))
413-
.pipe(gulp.dest(".")),
420+
.pipe(gulp.dest("src/services")),
414421
completedDts.pipe(clone())
415422
.pipe(insert.transform((content, file) => {
416423
file.path = nodeStandaloneDefinitionsFile;
417424
return content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
418425
}))
419-
]).pipe(gulp.dest("."));
426+
]).pipe(gulp.dest("src/services"));
420427
});
421428

422429
// cancellationToken.js
@@ -442,7 +449,7 @@ gulp.task(typingsInstallerJs, false, [servicesFile], () => {
442449
.pipe(cancellationTokenProject())
443450
.pipe(prependCopyright())
444451
.pipe(sourcemaps.write("."))
445-
.pipe(gulp.dest("."));
452+
.pipe(gulp.dest("src/server/typingsInstaller"));
446453
});
447454

448455
const serverFile = path.join(builtLocalDirectory, "tsserver.js");
@@ -455,7 +462,7 @@ gulp.task(serverFile, false, [servicesFile, typingsInstallerJs, cancellationToke
455462
.pipe(serverProject())
456463
.pipe(prependCopyright())
457464
.pipe(sourcemaps.write("."))
458-
.pipe(gulp.dest("."));
465+
.pipe(gulp.dest("src/server"));
459466
});
460467

461468
const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
@@ -471,12 +478,12 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
471478
return merge2([
472479
js.pipe(prependCopyright())
473480
.pipe(sourcemaps.write("."))
474-
.pipe(gulp.dest(".")),
481+
.pipe(gulp.dest("src/server")),
475482
dts.pipe(prependCopyright(/*outputCopyright*/true))
476483
.pipe(insert.transform((content) => {
477484
return content + "\r\nexport = ts;\r\nexport as namespace ts;";
478485
}))
479-
.pipe(gulp.dest("."))
486+
.pipe(gulp.dest("src/server"))
480487
]);
481488
});
482489

@@ -550,7 +557,7 @@ gulp.task(run, false, [servicesFile], () => {
550557
.pipe(sourcemaps.init())
551558
.pipe(testProject())
552559
.pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" }))
553-
.pipe(gulp.dest("."));
560+
.pipe(gulp.dest("src/harness"));
554561
});
555562

556563
const internalTests = "internal/";
@@ -588,6 +595,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
588595
cleanTestDirs((err) => {
589596
if (err) { console.error(err); failWithStatus(err, 1); }
590597
const debug = cmdLineOptions["debug"];
598+
const inspect = cmdLineOptions["inspect"];
591599
const tests = cmdLineOptions["tests"];
592600
const light = cmdLineOptions["light"];
593601
const stackTraceLimit = cmdLineOptions["stackTraceLimit"];
@@ -624,7 +632,10 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
624632
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
625633
if (!runInParallel) {
626634
const args = [];
627-
if (debug) {
635+
if (inspect) {
636+
args.push("--inspect");
637+
}
638+
if (inspect || debug) {
628639
args.push("--debug-brk");
629640
}
630641
args.push("-R", reporter);
@@ -739,7 +750,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
739750
const originalMap = file.sourceMap;
740751
const prebundledContent = file.contents.toString();
741752
// Make paths absolute to help sorcery deal with all the terrible paths being thrown around
742-
originalMap.sources = originalMap.sources.map(s => path.resolve(s));
753+
originalMap.sources = originalMap.sources.map(s => path.resolve(path.join("src/harness", s)));
743754
// intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap
744755
originalMap.file = "built/local/_stream_0.js";
745756

@@ -768,7 +779,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
768779
});
769780
}))
770781
.pipe(sourcemaps.write(".", { includeContent: false }))
771-
.pipe(gulp.dest("."));
782+
.pipe(gulp.dest("src/harness"));
772783
});
773784

774785

@@ -950,7 +961,7 @@ gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", s
950961
});
951962

952963
gulp.task("build-rules", "Compiles tslint rules to js", () => {
953-
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs" }, /*useBuiltCompiler*/ false);
964+
const settings: tsc.Settings = getCompilerSettings({ module: "commonjs", "lib": ["es6"] }, /*useBuiltCompiler*/ false);
954965
const dest = path.join(builtLocalDirectory, "tslint");
955966
return gulp.src("scripts/tslint/**/*.ts")
956967
.pipe(newer({
@@ -1009,40 +1020,16 @@ function spawnLintWorker(files: {path: string}[], callback: (failures: number) =
10091020
}
10101021

10111022
gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
1012-
const fileMatcher = RegExp(cmdLineOptions["files"]);
10131023
if (fold.isTravis()) console.log(fold.start("lint"));
1014-
1015-
let files: {stat: fs.Stats, path: string}[] = [];
1016-
return gulp.src(lintTargets, { read: false })
1017-
.pipe(through2.obj((chunk, enc, cb) => {
1018-
files.push(chunk);
1019-
cb();
1020-
}, (cb) => {
1021-
files = files.filter(file => fileMatcher.test(file.path)).sort((filea, fileb) => filea.stat.size - fileb.stat.size);
1022-
const workerCount = cmdLineOptions["workers"];
1023-
for (let i = 0; i < workerCount; i++) {
1024-
spawnLintWorker(files, finished);
1025-
}
1026-
1027-
let completed = 0;
1028-
let failures = 0;
1029-
function finished(fails) {
1030-
completed++;
1031-
failures += fails;
1032-
if (completed === workerCount) {
1033-
if (fold.isTravis()) console.log(fold.end("lint"));
1034-
if (failures > 0) {
1035-
throw new Error(`Linter errors: ${failures}`);
1036-
}
1037-
else {
1038-
cb();
1039-
}
1040-
}
1041-
}
1042-
}));
1024+
const fileMatcher = cmdLineOptions["files"];
1025+
const files = fileMatcher
1026+
? `src/**/${fileMatcher}`
1027+
: "Gulpfile.ts 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";
1028+
const cmd = `node node_modules/tslint/bin/tslint ${files} --format stylish`;
1029+
console.log("Linting: " + cmd);
1030+
child_process.execSync(cmd, { stdio: [0, 1, 2] });
10431031
});
10441032

1045-
10461033
gulp.task("default", "Runs 'local'", ["local"]);
10471034

10481035
gulp.task("watch", "Watches the src/ directory for changes and executes runtests-parallel.", [], () => {

0 commit comments

Comments
 (0)