Skip to content

Commit ee39c4e

Browse files
committed
Merge branch 'master' into transforms-merge
2 parents 4db1448 + 1abc2a7 commit ee39c4e

968 files changed

Lines changed: 116281 additions & 32442 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ tests/cases/perf/*
66
!tests/cases/webharness/compilerToString.js
77
test-args.txt
88
~*.docx
9+
\#*\#
10+
.\#*
911
tests/baselines/local/*
1012
tests/baselines/local.old/*
1113
tests/services/baselines/local/*
@@ -46,5 +48,6 @@ coverage/
4648
internal/
4749
**/.DS_Store
4850
.settings
49-
.vscode/*
50-
!.vscode/tasks.json
51+
**/.vs
52+
**/.vscode
53+
!**/.vscode/tasks.json

.npmignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
built
22
doc
3+
internal
4+
issue_template.md
35
lib/README.md
6+
pull_request_template.md
47
scripts
58
src
69
tests
7-
internal
810
tslint.json
911
Jakefile.js
1012
.editorconfig

Jakefile.js

Lines changed: 73 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ var librarySourceMap = [
202202
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es6.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] },
203203
{ target: "lib.core.es7.d.ts", sources: ["header.d.ts", "core.d.ts", "es6.d.ts", "es7.d.ts"] },
204204
{ target: "lib.es7.d.ts", sources: ["header.d.ts", "es6.d.ts", "es7.d.ts", "core.d.ts", "intl.d.ts", "dom.generated.d.ts", "dom.es6.d.ts", "webworker.importscripts.d.ts", "scriptHost.d.ts"] }
205-
];
205+
];
206206
var es2015LibrarySources = [
207207
"es2015.core.d.ts",
208208
"es2015.collection.d.ts",
@@ -212,7 +212,7 @@ var es2015LibrarySources = [
212212
"es2015.proxy.d.ts",
213213
"es2015.reflect.d.ts",
214214
"es2015.symbol.d.ts",
215-
"es2015.symbol.wellknown.d.ts",
215+
"es2015.symbol.wellknown.d.ts"
216216
];
217217

218218
var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
@@ -221,28 +221,35 @@ var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
221221

222222
var es2016LibrarySource = [ "es2016.array.include.d.ts" ];
223223

224-
var es2016LibrarySourceMap = es2016LibrarySource.map(function(source) {
224+
var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
225+
return { target: "lib." + source, sources: ["header.d.ts", source] };
226+
});
227+
228+
var es2017LibrarySource = ["es2017.object.d.ts"];
229+
230+
var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
225231
return { target: "lib." + source, sources: ["header.d.ts", source] };
226-
})
232+
});
227233

228-
var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"]
234+
var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
229235

230236
var librarySourceMap = [
231237
// Host library
232-
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"], },
233-
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"], },
234-
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"], },
235-
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"], },
236-
238+
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"] },
239+
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"] },
240+
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"] },
241+
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"] },
242+
237243
// JavaScript library
238244
{ target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] },
239245
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
240246
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
247+
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
241248

242249
// JavaScript + all host library
243-
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources), },
244-
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources), },
245-
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap);
250+
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
251+
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
252+
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
246253

247254
var libraryTargets = librarySourceMap.map(function (f) {
248255
return path.join(builtLocalDirectory, f.target);
@@ -282,7 +289,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
282289
}
283290

284291
var useDebugMode = true;
285-
var host = (process.env.TYPESCRIPT_HOST || process.env.host || "node");
292+
var host = process.env.TYPESCRIPT_HOST || process.env.host || "node";
286293
var compilerFilename = "tsc.js";
287294
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
288295
var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
@@ -560,9 +567,10 @@ compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, cop
560567
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
561568
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
562569

563-
var lsslFile = path.join(builtLocalDirectory, "tslssl.js");
570+
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
571+
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
564572
compileFile(
565-
lsslFile,
573+
tsserverLibraryFile,
566574
languageServiceLibrarySources,
567575
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
568576
/*prefixes*/ [copyright],
@@ -571,7 +579,7 @@ compileFile(
571579

572580
// Local target to build the language service server library
573581
desc("Builds language service server library");
574-
task("lssl", [lsslFile]);
582+
task("lssl", [tsserverLibraryFile, tsserverLibraryDefinitionFile]);
575583

576584
// Local target to build the compiler and services
577585
desc("Builds the full compiler and services");
@@ -630,8 +638,8 @@ task("generate-spec", [specMd]);
630638

631639
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
632640
desc("Makes a new LKG out of the built js files");
633-
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
634-
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets);
641+
task("LKG", ["clean", "release", "local", "lssl"].concat(libraryTargets), function() {
642+
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
635643
var missingFiles = expectedFiles.filter(function (f) {
636644
return !fs.existsSync(f);
637645
});
@@ -891,6 +899,7 @@ function runConsoleTests(defaultReporter, defaultSubsets, dirty) {
891899
colors = process.env.colors || process.env.color;
892900
colors = colors ? ' --no-colors ' : ' --colors ';
893901
reporter = process.env.reporter || process.env.r || defaultReporter;
902+
var lintFlag = process.env.lint !== 'false';
894903

895904
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
896905
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
@@ -903,22 +912,41 @@ function runConsoleTests(defaultReporter, defaultSubsets, dirty) {
903912
subsetRegexes = subsets.map(function (sub) { return "^" + sub + ".*$"; });
904913
subsetRegexes.push("^(?!" + subsets.join("|") + ").*$");
905914
}
915+
var counter = subsetRegexes.length;
916+
var errorStatus;
906917
subsetRegexes.forEach(function (subsetRegex, i) {
907918
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
908919
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
909920
console.log(cmd);
910-
exec(cmd, function () {
921+
function finish(status) {
922+
counter--;
923+
// save first error status
924+
if (status !== undefined && errorStatus === undefined) {
925+
errorStatus = status;
926+
}
927+
911928
deleteTemporaryProjectOutput();
912-
if (i === 0 && !dirty) {
913-
var lint = jake.Task['lint'];
914-
lint.addListener('complete', function () {
929+
if (counter !== 0 || errorStatus === undefined) {
930+
// run linter when last worker is finished
931+
if (lintFlag && counter === 0 && !dirty) {
932+
var lint = jake.Task['lint'];
933+
lint.addListener('complete', function () {
934+
complete();
935+
});
936+
lint.invoke();
937+
}
938+
else {
915939
complete();
916-
});
917-
lint.invoke();
940+
}
918941
}
919942
else {
920-
complete();
943+
fail("Process exited with code " + status);
921944
}
945+
}
946+
exec(cmd, function () {
947+
finish();
948+
}, function(e, status) {
949+
finish(status);
922950
});
923951
});
924952
}
@@ -929,7 +957,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
929957
runConsoleTests('min', ['compiler', 'conformance', 'Projects', 'fourslash']);
930958
}, {async: true});
931959

932-
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false.");
960+
desc("Runs the tests using the built run.js file. Optional arguments are: t[ests]=regex r[eporter]=[list|spec|json|<more>] d[ebug]=true color[s]=false lint=true.");
933961
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
934962
runConsoleTests('mocha-fivemat-progress-reporter', []);
935963
}, {async: true});
@@ -949,8 +977,8 @@ task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
949977
}, { async: true });
950978

951979
// Browser tests
952-
var nodeServerOutFile = 'tests/webTestServer.js';
953-
var nodeServerInFile = 'tests/webTestServer.ts';
980+
var nodeServerOutFile = "tests/webTestServer.js";
981+
var nodeServerInFile = "tests/webTestServer.ts";
954982
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true });
955983

956984
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
@@ -1145,31 +1173,30 @@ function lintFileAsync(options, path, cb) {
11451173
});
11461174
}
11471175

1148-
var servicesLintTargets = [
1149-
"navigateTo.ts",
1150-
"outliningElementsCollector.ts",
1151-
"patternMatcher.ts",
1152-
"services.ts",
1153-
"shims.ts",
1154-
"jsTyping.ts"
1155-
].map(function (s) {
1156-
return path.join(servicesDirectory, s);
1157-
});
11581176
var lintTargets = compilerSources
1159-
.concat(harnessCoreSources)
1177+
.concat(harnessSources)
1178+
// Other harness sources
1179+
.concat(["instrumenter.ts"].map(function(f) { return path.join(harnessDirectory, f) }))
11601180
.concat(serverCoreSources)
11611181
.concat(tslintRulesFiles)
1162-
.concat(servicesLintTargets);
1182+
.concat(servicesSources);
11631183

1164-
desc("Runs tslint on the compiler sources");
1184+
1185+
desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex");
11651186
task("lint", ["build-rules"], function() {
11661187
var lintOptions = getLinterOptions();
11671188
var failed = 0;
1189+
var fileMatcher = RegExp(process.env.f || process.env.file || process.env.files || "");
1190+
var done = {};
11681191
for (var i in lintTargets) {
1169-
var result = lintFile(lintOptions, lintTargets[i]);
1170-
if (result.failureCount > 0) {
1171-
console.log(result.output);
1172-
failed += result.failureCount;
1192+
var target = lintTargets[i];
1193+
if (!done[target] && fileMatcher.test(target)) {
1194+
var result = lintFile(lintOptions, target);
1195+
if (result.failureCount > 0) {
1196+
console.log(result.output);
1197+
failed += result.failureCount;
1198+
}
1199+
done[target] = true;
11731200
}
11741201
}
11751202
if (failed > 0) {

0 commit comments

Comments
 (0)