Skip to content

Commit 5f9fa69

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into typedefForJsdoc
# Conflicts: # src/services/services.ts # tests/cases/unittests/jsDocParsing.ts
2 parents 9ff02b1 + 7173fa8 commit 5f9fa69

File tree

627 files changed

+102594
-26460
lines changed

Some content is hidden

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

627 files changed

+102594
-26460
lines changed

.npmignore

+3-1
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

+69-49
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ var harnessSources = harnessCoreSources.concat([
160160
"protocol.d.ts",
161161
"session.ts",
162162
"client.ts",
163-
"editorServices.ts",
163+
"editorServices.ts"
164164
].map(function (f) {
165165
return path.join(serverDirectory, f);
166166
}));
@@ -174,7 +174,7 @@ var es2015LibrarySources = [
174174
"es2015.proxy.d.ts",
175175
"es2015.reflect.d.ts",
176176
"es2015.symbol.d.ts",
177-
"es2015.symbol.wellknown.d.ts",
177+
"es2015.symbol.wellknown.d.ts"
178178
];
179179

180180
var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
@@ -183,28 +183,35 @@ var es2015LibrarySourceMap = es2015LibrarySources.map(function(source) {
183183

184184
var es2016LibrarySource = [ "es2016.array.include.d.ts" ];
185185

186-
var es2016LibrarySourceMap = es2016LibrarySource.map(function(source) {
186+
var es2016LibrarySourceMap = es2016LibrarySource.map(function (source) {
187+
return { target: "lib." + source, sources: ["header.d.ts", source] };
188+
});
189+
190+
var es2017LibrarySource = ["es2017.object.d.ts"];
191+
192+
var es2017LibrarySourceMap = es2017LibrarySource.map(function (source) {
187193
return { target: "lib." + source, sources: ["header.d.ts", source] };
188-
})
194+
});
189195

190-
var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"]
196+
var hostsLibrarySources = ["dom.generated.d.ts", "webworker.importscripts.d.ts", "scripthost.d.ts"];
191197

192198
var librarySourceMap = [
193199
// Host library
194-
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"], },
195-
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"], },
196-
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"], },
197-
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"], },
198-
200+
{ target: "lib.dom.d.ts", sources: ["header.d.ts", "dom.generated.d.ts"] },
201+
{ target: "lib.dom.iterable.d.ts", sources: ["header.d.ts", "dom.iterable.d.ts"] },
202+
{ target: "lib.webworker.d.ts", sources: ["header.d.ts", "webworker.generated.d.ts"] },
203+
{ target: "lib.scripthost.d.ts", sources: ["header.d.ts", "scripthost.d.ts"] },
204+
199205
// JavaScript library
200206
{ target: "lib.es5.d.ts", sources: ["header.d.ts", "es5.d.ts"] },
201207
{ target: "lib.es2015.d.ts", sources: ["header.d.ts", "es2015.d.ts"] },
202208
{ target: "lib.es2016.d.ts", sources: ["header.d.ts", "es2016.d.ts"] },
209+
{ target: "lib.es2017.d.ts", sources: ["header.d.ts", "es2017.d.ts"] },
203210

204211
// JavaScript + all host library
205-
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources), },
206-
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts"), },
207-
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap);
212+
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
213+
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") }
214+
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap);
208215

209216
var libraryTargets = librarySourceMap.map(function (f) {
210217
return path.join(builtLocalDirectory, f.target);
@@ -244,7 +251,7 @@ function concatenateFiles(destinationFile, sourceFiles) {
244251
}
245252

246253
var useDebugMode = true;
247-
var host = (process.env.TYPESCRIPT_HOST || process.env.host || "node");
254+
var host = process.env.TYPESCRIPT_HOST || process.env.host || "node";
248255
var compilerFilename = "tsc.js";
249256
var LKGCompiler = path.join(LKGDirectory, compilerFilename);
250257
var builtLocalCompiler = path.join(builtLocalDirectory, compilerFilename);
@@ -293,7 +300,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
293300
options += " --out " + outFile;
294301
}
295302
else {
296-
options += " --module commonjs"
303+
options += " --module commonjs";
297304
}
298305

299306
if(opts.noResolve) {
@@ -308,7 +315,7 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, opts
308315
}
309316

310317
if (opts.stripInternal) {
311-
options += " --stripInternal"
318+
options += " --stripInternal";
312319
}
313320

314321
var cmd = host + " " + compilerPath + " " + options + " ";
@@ -446,9 +453,9 @@ file(scriptsTsdJson);
446453

447454
task("tsd-scripts", [scriptsTsdJson], function () {
448455
var cmd = "tsd --config " + scriptsTsdJson + " install";
449-
console.log(cmd)
456+
console.log(cmd);
450457
exec(cmd);
451-
}, { async: true })
458+
}, { async: true });
452459

453460
var importDefinitelyTypedTestsDirectory = path.join(scriptsDirectory, "importDefinitelyTypedTests");
454461
var importDefinitelyTypedTestsJs = path.join(importDefinitelyTypedTestsDirectory, "importDefinitelyTypedTests.js");
@@ -518,9 +525,10 @@ compileFile(servicesFileInBrowserTest, servicesSources,[builtLocalDirectory, cop
518525
var serverFile = path.join(builtLocalDirectory, "tsserver.js");
519526
compileFile(serverFile, serverSources,[builtLocalDirectory, copyright].concat(serverSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true);
520527

521-
var lsslFile = path.join(builtLocalDirectory, "tslssl.js");
528+
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
529+
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
522530
compileFile(
523-
lsslFile,
531+
tsserverLibraryFile,
524532
languageServiceLibrarySources,
525533
[builtLocalDirectory, copyright].concat(languageServiceLibrarySources),
526534
/*prefixes*/ [copyright],
@@ -529,7 +537,7 @@ compileFile(
529537

530538
// Local target to build the language service server library
531539
desc("Builds language service server library");
532-
task("lssl", [lsslFile]);
540+
task("lssl", [tsserverLibraryFile, tsserverLibraryDefinitionFile]);
533541

534542
// Local target to build the compiler and services
535543
desc("Builds the full compiler and services");
@@ -588,8 +596,8 @@ task("generate-spec", [specMd]);
588596

589597
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
590598
desc("Makes a new LKG out of the built js files");
591-
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
592-
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets);
599+
task("LKG", ["clean", "release", "local", "lssl"].concat(libraryTargets), function() {
600+
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
593601
var missingFiles = expectedFiles.filter(function (f) {
594602
return !fs.existsSync(f);
595603
});
@@ -615,7 +623,7 @@ directory(builtLocalDirectory);
615623
var run = path.join(builtLocalDirectory, "run.js");
616624
compileFile(run, harnessSources, [builtLocalDirectory, tscFile].concat(libraryTargets).concat(harnessSources), [], /*useBuiltCompiler:*/ true);
617625

618-
var internalTests = "internal/"
626+
var internalTests = "internal/";
619627

620628
var localBaseline = "tests/baselines/local/";
621629
var refBaseline = "tests/baselines/reference/";
@@ -702,15 +710,16 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
702710
testTimeout = 100000;
703711
}
704712

705-
colors = process.env.colors || process.env.color
713+
colors = process.env.colors || process.env.color;
706714
colors = colors ? ' --no-colors ' : ' --colors ';
707715
reporter = process.env.reporter || process.env.r || defaultReporter;
716+
var lintFlag = process.env.lint !== 'false';
708717

709718
// timeout normally isn't necessary but Travis-CI has been timing out on compiler baselines occasionally
710719
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
711720
var subsetRegexes;
712721
if(defaultSubsets.length === 0) {
713-
subsetRegexes = [tests]
722+
subsetRegexes = [tests];
714723
}
715724
else {
716725
var subsets = tests ? tests.split("|") : defaultSubsets;
@@ -721,19 +730,20 @@ function runConsoleTests(defaultReporter, defaultSubsets) {
721730
tests = subsetRegex ? ' -g "' + subsetRegex + '"' : '';
722731
var cmd = "mocha" + (debug ? " --debug-brk" : "") + " -R " + reporter + tests + colors + ' -t ' + testTimeout + ' ' + run;
723732
console.log(cmd);
724-
exec(cmd, function () {
733+
function finish() {
725734
deleteTemporaryProjectOutput();
726-
if (i === 0) {
735+
complete();
736+
}
737+
exec(cmd, function () {
738+
if (lintFlag && i === 0) {
727739
var lint = jake.Task['lint'];
728740
lint.addListener('complete', function () {
729741
complete();
730742
});
731743
lint.invoke();
732744
}
733-
else {
734-
complete();
735-
}
736-
});
745+
finish();
746+
}, finish);
737747
});
738748
}
739749

@@ -743,7 +753,7 @@ task("runtests-parallel", ["build-rules", "tests", builtLocalDirectory], functio
743753
runConsoleTests('min', ['compiler', 'conformance', 'Projects', 'fourslash']);
744754
}, {async: true});
745755

746-
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.");
756+
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.");
747757
task("runtests", ["build-rules", "tests", builtLocalDirectory], function() {
748758
runConsoleTests('mocha-fivemat-progress-reporter', []);
749759
}, {async: true});
@@ -756,8 +766,8 @@ task("generate-code-coverage", ["tests", builtLocalDirectory], function () {
756766
}, { async: true });
757767

758768
// Browser tests
759-
var nodeServerOutFile = 'tests/webTestServer.js'
760-
var nodeServerInFile = 'tests/webTestServer.ts'
769+
var nodeServerOutFile = "tests/webTestServer.js";
770+
var nodeServerInFile = "tests/webTestServer.ts";
761771
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true });
762772

763773
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
@@ -769,7 +779,7 @@ task("browserify", ["tests", builtLocalDirectory, nodeServerOutFile], function()
769779
desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], port=, browser=[chrome|IE]");
770780
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function() {
771781
cleanTestDirs();
772-
host = "node"
782+
host = "node";
773783
port = process.env.port || process.env.p || '8888';
774784
browser = process.env.browser || process.env.b || "IE";
775785
tests = process.env.test || process.env.tests || process.env.t;
@@ -783,13 +793,13 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFi
783793
}
784794

785795
tests = tests ? tests : '';
786-
var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests
796+
var cmd = host + " tests/webTestServer.js " + port + " " + browser + " " + tests;
787797
console.log(cmd);
788798
exec(cmd);
789799
}, {async: true});
790800

791801
function getDiffTool() {
792-
var program = process.env['DIFF']
802+
var program = process.env['DIFF'];
793803
if (!program) {
794804
fail("Add the 'DIFF' environment variable to the path of the program you want to use.");
795805
}
@@ -818,11 +828,11 @@ task("tests-debug", ["setDebugMode", "tests"]);
818828
// Makes the test results the new baseline
819829
desc("Makes the most recent test results the new baseline, overwriting the old baseline");
820830
task("baseline-accept", function(hardOrSoft) {
821-
if (!hardOrSoft || hardOrSoft == "hard") {
831+
if (!hardOrSoft || hardOrSoft === "hard") {
822832
jake.rmRf(refBaseline);
823833
fs.renameSync(localBaseline, refBaseline);
824834
}
825-
else if (hardOrSoft == "soft") {
835+
else if (hardOrSoft === "soft") {
826836
var files = jake.readdirR(localBaseline);
827837
for (var i in files) {
828838
jake.cpR(files[i], refBaseline);
@@ -901,14 +911,14 @@ task("update-sublime", ["local", serverFile], function() {
901911
});
902912

903913
var tslintRuleDir = "scripts/tslint";
904-
var tslintRules = ([
914+
var tslintRules = [
905915
"nextLineRule",
906916
"preferConstRule",
907917
"booleanTriviaRule",
908918
"typeOperatorSpacingRule",
909919
"noInOperatorRule",
910920
"noIncrementDecrementRule"
911-
]);
921+
];
912922
var tslintRulesFiles = tslintRules.map(function(p) {
913923
return path.join(tslintRuleDir, p + ".ts");
914924
});
@@ -933,7 +943,7 @@ function getLinterOptions() {
933943

934944
function lintFileContents(options, path, contents) {
935945
var ll = new Linter(path, contents, options);
936-
console.log("Linting '" + path + "'.")
946+
console.log("Linting '" + path + "'.");
937947
return ll.lint();
938948
}
939949

@@ -954,6 +964,7 @@ function lintFileAsync(options, path, cb) {
954964

955965
var servicesLintTargets = [
956966
"navigateTo.ts",
967+
"navigationBar.ts",
957968
"outliningElementsCollector.ts",
958969
"patternMatcher.ts",
959970
"services.ts",
@@ -963,20 +974,29 @@ var servicesLintTargets = [
963974
return path.join(servicesDirectory, s);
964975
});
965976
var lintTargets = compilerSources
966-
.concat(harnessCoreSources)
977+
.concat(harnessSources)
978+
// Other harness sources
979+
.concat(["instrumenter.ts"].map(function(f) { return path.join(harnessDirectory, f) }))
967980
.concat(serverCoreSources)
968981
.concat(tslintRulesFiles)
969982
.concat(servicesLintTargets);
970983

971-
desc("Runs tslint on the compiler sources");
984+
985+
desc("Runs tslint on the compiler sources. Optional arguments are: f[iles]=regex");
972986
task("lint", ["build-rules"], function() {
973987
var lintOptions = getLinterOptions();
974988
var failed = 0;
989+
var fileMatcher = RegExp(process.env.f || process.env.file || process.env.files || "");
990+
var done = {};
975991
for (var i in lintTargets) {
976-
var result = lintFile(lintOptions, lintTargets[i]);
977-
if (result.failureCount > 0) {
978-
console.log(result.output);
979-
failed += result.failureCount;
992+
var target = lintTargets[i];
993+
if (!done[target] && fileMatcher.test(target)) {
994+
var result = lintFile(lintOptions, target);
995+
if (result.failureCount > 0) {
996+
console.log(result.output);
997+
failed += result.failureCount;
998+
}
999+
done[target] = true;
9801000
}
9811001
}
9821002
if (failed > 0) {

0 commit comments

Comments
 (0)