Skip to content

Commit d1c2d86

Browse files
committed
Merge branch 'master' into vue-plugin-WIP
2 parents cda045c + 89f43d1 commit d1c2d86

File tree

867 files changed

+26925
-6970
lines changed

Some content is hidden

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

867 files changed

+26925
-6970
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

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ branches:
1717
only:
1818
- master
1919
- release-2.1
20+
- release-2.2
2021

2122
install:
2223
- npm uninstall typescript

Gulpfile.ts

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ declare module "gulp-typescript" {
2121
import * as insert from "gulp-insert";
2222
import * as sourcemaps from "gulp-sourcemaps";
2323
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-
}
2824
import del = require("del");
2925
import mkdirP = require("mkdirp");
3026
import minimist = require("minimist");
@@ -41,7 +37,7 @@ const {runTestsInParallel} = mochaParallel;
4137
Error.stackTraceLimit = 1000;
4238

4339
const cmdLineOptions = minimist(process.argv.slice(2), {
44-
boolean: ["debug", "light", "colors", "lint", "soft"],
40+
boolean: ["debug", "inspect", "light", "colors", "lint", "soft"],
4541
string: ["browser", "tests", "host", "reporter", "stackTraceLimit"],
4642
alias: {
4743
d: "debug",
@@ -57,6 +53,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
5753
soft: false,
5854
colors: process.env.colors || process.env.color || true,
5955
debug: process.env.debug || process.env.d,
56+
inspect: process.env.inspect,
6057
host: process.env.TYPESCRIPT_HOST || process.env.host || "node",
6158
browser: process.env.browser || process.env.b || "IE",
6259
tests: process.env.test || process.env.tests || process.env.t,
@@ -138,6 +135,14 @@ const es2017LibrarySourceMap = es2017LibrarySource.map(function(source) {
138135
return { target: "lib." + source, sources: ["header.d.ts", source] };
139136
});
140137

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

143148
const librarySourceMap = [
@@ -152,11 +157,12 @@ const librarySourceMap = [
152157
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
153158
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
154159
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
160+
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },
155161

156162
// JavaScript + all host library
157163
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
158164
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
159-
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
165+
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
160166

161167
const libraryTargets = librarySourceMap.map(function(f) {
162168
return path.join(builtLocalDirectory, f.target);
@@ -384,7 +390,7 @@ gulp.task(builtLocalCompiler, false, [servicesFile], () => {
384390
.pipe(localCompilerProject())
385391
.pipe(prependCopyright())
386392
.pipe(sourcemaps.write("."))
387-
.pipe(gulp.dest("."));
393+
.pipe(gulp.dest("src/compiler"));
388394
});
389395

390396
gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
@@ -416,7 +422,7 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
416422
file.path = nodeStandaloneDefinitionsFile;
417423
return content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
418424
}))
419-
]).pipe(gulp.dest("."));
425+
]).pipe(gulp.dest("src/services"));
420426
});
421427

422428
// cancellationToken.js
@@ -442,7 +448,7 @@ gulp.task(typingsInstallerJs, false, [servicesFile], () => {
442448
.pipe(cancellationTokenProject())
443449
.pipe(prependCopyright())
444450
.pipe(sourcemaps.write("."))
445-
.pipe(gulp.dest("."));
451+
.pipe(gulp.dest("src/server/typingsInstaller"));
446452
});
447453

448454
const serverFile = path.join(builtLocalDirectory, "tsserver.js");
@@ -455,7 +461,7 @@ gulp.task(serverFile, false, [servicesFile, typingsInstallerJs, cancellationToke
455461
.pipe(serverProject())
456462
.pipe(prependCopyright())
457463
.pipe(sourcemaps.write("."))
458-
.pipe(gulp.dest("."));
464+
.pipe(gulp.dest("src/server"));
459465
});
460466

461467
const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
@@ -550,7 +556,7 @@ gulp.task(run, false, [servicesFile], () => {
550556
.pipe(sourcemaps.init())
551557
.pipe(testProject())
552558
.pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" }))
553-
.pipe(gulp.dest("."));
559+
.pipe(gulp.dest("src/harness"));
554560
});
555561

556562
const internalTests = "internal/";
@@ -588,6 +594,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
588594
cleanTestDirs((err) => {
589595
if (err) { console.error(err); failWithStatus(err, 1); }
590596
const debug = cmdLineOptions["debug"];
597+
const inspect = cmdLineOptions["inspect"];
591598
const tests = cmdLineOptions["tests"];
592599
const light = cmdLineOptions["light"];
593600
const stackTraceLimit = cmdLineOptions["stackTraceLimit"];
@@ -624,7 +631,10 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
624631
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
625632
if (!runInParallel) {
626633
const args = [];
627-
if (debug) {
634+
if (inspect) {
635+
args.push("--inspect");
636+
}
637+
if (inspect || debug) {
628638
args.push("--debug-brk");
629639
}
630640
args.push("-R", reporter);
@@ -768,7 +778,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
768778
});
769779
}))
770780
.pipe(sourcemaps.write(".", { includeContent: false }))
771-
.pipe(gulp.dest("."));
781+
.pipe(gulp.dest("src/harness"));
772782
});
773783

774784

Jakefile.js

Lines changed: 58 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ var servicesDirectory = "src/services/";
1515
var serverDirectory = "src/server/";
1616
var typingsInstallerDirectory = "src/server/typingsInstaller";
1717
var cancellationTokenDirectory = "src/server/cancellationToken";
18+
var watchGuardDirectory = "src/server/watchGuard";
1819
var harnessDirectory = "src/harness/";
1920
var libraryDirectory = "src/lib/";
2021
var scriptsDirectory = "scripts/";
@@ -80,6 +81,7 @@ var compilerSources = filesFromConfig("./src/compiler/tsconfig.json");
8081
var servicesSources = filesFromConfig("./src/services/tsconfig.json");
8182
var cancellationTokenSources = filesFromConfig(path.join(serverDirectory, "cancellationToken/tsconfig.json"));
8283
var typingsInstallerSources = filesFromConfig(path.join(serverDirectory, "typingsInstaller/tsconfig.json"));
84+
var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/tsconfig.json"));
8385
var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json"))
8486
var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json"));
8587

@@ -129,6 +131,8 @@ var harnessSources = harnessCoreSources.concat([
129131
"matchFiles.ts",
130132
"initializeTSConfig.ts",
131133
"printer.ts",
134+
"transform.ts",
135+
"customTransforms.ts",
132136
].map(function (f) {
133137
return path.join(unittestsDirectory, f);
134138
})).concat([
@@ -170,13 +174,21 @@ var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
170174
var es2017LibrarySource = [
171175
"es2017.object.d.ts",
172176
"es2017.sharedmemory.d.ts",
173-
"es2017.string.d.ts",
177+
"es2017.string.d.ts"
174178
];
175179

176180
var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
177181
return { target: "lib." + source, sources: ["header.d.ts", source] };
178182
});
179183

184+
var esnextLibrarySource = [
185+
"esnext.asynciterable.d.ts"
186+
];
187+
188+
var esnextLibrarySourceMap = esnextLibrarySource.map(function (source) {
189+
return { target: "lib." + source, sources: ["header.d.ts", source] };
190+
});
191+
180192
var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
181193

182194
var librarySourceMap = [
@@ -191,11 +203,12 @@ var librarySourceMap = [
191203
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
192204
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
193205
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
206+
{ target: "lib.esnext.d.ts", sources: ["header.d.ts", "esnext.d.ts"] },
194207

195208
// JavaScript + all host library
196209
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
197210
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
198-
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
211+
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
199212

200213
var libraryTargets = librarySourceMap.map(function (f) {
201214
return path.join(builtLocalDirectory, f.target);
@@ -315,8 +328,14 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
315328
if (opts.stripInternal) {
316329
options += " --stripInternal";
317330
}
318-
319-
options += " --target es5 --lib es5,scripthost --noUnusedLocals --noUnusedParameters";
331+
options += " --target es5";
332+
if (opts.lib) {
333+
options += " --lib " + opts.lib
334+
}
335+
else {
336+
options += " --lib es5,scripthost"
337+
}
338+
options += " --noUnusedLocals --noUnusedParameters";
320339

321340
var cmd = host + " " + compilerPath + " " + options + " ";
322341
cmd = cmd + sources.join(" ");
@@ -570,8 +589,11 @@ compileFile(cancellationTokenFile, cancellationTokenSources, [builtLocalDirector
570589
var typingsInstallerFile = path.join(builtLocalDirectory, "typingsInstaller.js");
571590
compileFile(typingsInstallerFile, typingsInstallerSources, [builtLocalDirectory].concat(typingsInstallerSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false });
572591

592+
var watchGuardFile = path.join(builtLocalDirectory, "watchGuard.js");
593+
compileFile(watchGuardFile, watchGuardSources, [builtLocalDirectory].concat(watchGuardSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { outDir: builtLocalDirectory, noOutFile: false });
594+
573595
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
574-
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true });
596+
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true });
575597
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
576598
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
577599
compileFile(
@@ -665,7 +687,7 @@ task("generate-spec", [specMd]);
665687
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
666688
desc("Makes a new LKG out of the built js files");
667689
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function () {
668-
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, cancellationTokenFile, typingsInstallerFile, buildProtocolDts].concat(libraryTargets);
690+
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, cancellationTokenFile, typingsInstallerFile, buildProtocolDts, watchGuardFile].concat(libraryTargets);
669691
var missingFiles = expectedFiles.filter(function (f) {
670692
return !fs.existsSync(f);
671693
});
@@ -778,6 +800,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
778800
}
779801

780802
var debug = process.env.debug || process.env.d;
803+
var inspect = process.env.inspect;
781804
tests = process.env.test || process.env.tests || process.env.t;
782805
var light = process.env.light || false;
783806
var stackTraceLimit = process.env.stackTraceLimit;
@@ -807,18 +830,39 @@ function runConsoleTests(defaultReporter, runInParallel) {
807830
testTimeout = 800000;
808831
}
809832

810-
colors = process.env.colors || process.env.color;
811-
colors = colors ? ' --no-colors ' : ' --colors ';
812-
reporter = process.env.reporter || process.env.r || defaultReporter;
813-
var bail = (process.env.bail || process.env.b) ? "--bail" : "";
833+
var colors = process.env.colors || process.env.color || true;
834+
var reporter = process.env.reporter || process.env.r || defaultReporter;
835+
var bail = process.env.bail || process.env.b;
814836
var lintFlag = process.env.lint !== 'false';
815837

816838
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
817839
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
818840
if (!runInParallel) {
819841
var startTime = mark();
820-
tests = tests ? ' -g "' + tests + '"' : '';
821-
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + bail + ' -t ' + testTimeout + ' ' + run;
842+
var args = [];
843+
if (inspect) {
844+
args.push("--inspect");
845+
}
846+
if (inspect || debug) {
847+
args.push("--debug-brk");
848+
}
849+
args.push("-R", reporter);
850+
if (tests) {
851+
args.push("-g", `"${tests}"`);
852+
}
853+
if (colors) {
854+
args.push("--colors");
855+
}
856+
else {
857+
args.push("--no-colors");
858+
}
859+
if (bail) {
860+
args.push("--bail");
861+
}
862+
args.push("-t", testTimeout);
863+
args.push(run);
864+
865+
var cmd = "mocha " + args.join(" ");
822866
console.log(cmd);
823867

824868
var savedNodeEnv = process.env.NODE_ENV;
@@ -839,7 +883,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
839883
var savedNodeEnv = process.env.NODE_ENV;
840884
process.env.NODE_ENV = "development";
841885
var startTime = mark();
842-
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: colors === " --no-colors " }, function (err) {
886+
runTestsInParallel(taskConfigsFolder, run, { testTimeout: testTimeout, noColors: !colors }, function (err) {
843887
process.env.NODE_ENV = savedNodeEnv;
844888
measure(startTime);
845889
// last worker clean everything and runs linter in case if there were no errors
@@ -1072,7 +1116,7 @@ desc("Compiles tslint rules to js");
10721116
task("build-rules", ["build-rules-start"].concat(tslintRulesOutFiles).concat(["build-rules-end"]));
10731117
tslintRulesFiles.forEach(function (ruleFile, i) {
10741118
compileFile(tslintRulesOutFiles[i], [ruleFile], [ruleFile], [], /*useBuiltCompiler*/ false,
1075-
{ noOutFile: true, generateDeclarations: false, outDir: path.join(builtLocalDirectory, "tslint") });
1119+
{ noOutFile: true, generateDeclarations: false, outDir: path.join(builtLocalDirectory, "tslint"), lib: "es6" });
10761120
});
10771121

10781122
desc("Emit the start of the build-rules fold");

lib/protocol.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,7 @@ declare namespace ts.server.protocol {
17421742
insertSpaceAfterFunctionKeywordForAnonymousFunctions?: boolean;
17431743
insertSpaceAfterOpeningAndBeforeClosingNonemptyParenthesis?: boolean;
17441744
insertSpaceAfterOpeningAndBeforeClosingNonemptyBrackets?: boolean;
1745+
insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces?: boolean;
17451746
insertSpaceAfterOpeningAndBeforeClosingTemplateStringBraces?: boolean;
17461747
insertSpaceAfterOpeningAndBeforeClosingJsxExpressionBraces?: boolean;
17471748
insertSpaceBeforeFunctionParenthesis?: boolean;

scripts/parallel-lint.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var tslint = require("tslint");
22
var fs = require("fs");
3+
var path = require("path");
34

45
function getLinterOptions() {
56
return {
@@ -9,7 +10,7 @@ function getLinterOptions() {
910
};
1011
}
1112
function getLinterConfiguration() {
12-
return require("../tslint.json");
13+
return tslint.Configuration.loadConfigurationFromPath(path.join(__dirname, "../tslint.json"));
1314
}
1415

1516
function lintFileContents(options, configuration, path, contents) {

0 commit comments

Comments
 (0)