Skip to content

Commit b10b0bf

Browse files
committed
Merge branch 'master' into promised
2 parents 64a225a + fe1242c commit b10b0bf

File tree

4,181 files changed

+44885
-18180
lines changed

Some content is hidden

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

4,181 files changed

+44885
-18180
lines changed

.npmignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@ Jakefile.js
1616
.gitattributes
1717
.settings/
1818
.travis.yml
19-
.vscode/
19+
.vscode/
20+
test.config

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ matrix:
1616
branches:
1717
only:
1818
- master
19+
- release-2.5
1920

2021
install:
2122
- npm uninstall typescript --no-save

.vscode/tasks.json

+7
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
"problemMatcher": [
1919
"$tsc"
2020
]
21+
},
22+
{
23+
"taskName": "tests",
24+
"showOutput": "silent",
25+
"problemMatcher": [
26+
"$tsc"
27+
]
2128
}
2229
]
2330
}

Gulpfile.ts

+14-4
Original file line numberDiff line numberDiff line change
@@ -463,10 +463,11 @@ gulp.task(serverFile, /*help*/ false, [servicesFile, typingsInstallerJs, cancell
463463
.pipe(gulp.dest("src/server"));
464464
});
465465

466+
const typesMapJson = path.join(builtLocalDirectory, "typesMap.json");
466467
const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
467468
const tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
468469

469-
gulp.task(tsserverLibraryFile, /*help*/ false, [servicesFile], (done) => {
470+
gulp.task(tsserverLibraryFile, /*help*/ false, [servicesFile, typesMapJson], (done) => {
470471
const serverLibraryProject = tsc.createProject("src/server/tsconfig.library.json", getCompilerSettings({}, /*useBuiltCompiler*/ true));
471472
const {js, dts}: { js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream } = serverLibraryProject.src()
472473
.pipe(sourcemaps.init())
@@ -485,6 +486,15 @@ gulp.task(tsserverLibraryFile, /*help*/ false, [servicesFile], (done) => {
485486
]);
486487
});
487488

489+
gulp.task(typesMapJson, /*help*/ false, [], () => {
490+
return gulp.src("src/server/typesMap.json")
491+
.pipe(insert.transform((contents, file) => {
492+
JSON.parse(contents);
493+
return contents;
494+
}))
495+
.pipe(gulp.dest(builtLocalDirectory));
496+
});
497+
488498
gulp.task("lssl", "Builds language service server library", [tsserverLibraryFile]);
489499
gulp.task("local", "Builds the full compiler and services", [builtLocalCompiler, servicesFile, serverFile, builtGeneratedDiagnosticMessagesJSON, tsserverLibraryFile]);
490500
gulp.task("tsc", "Builds only the compiler", [builtLocalCompiler]);
@@ -968,7 +978,7 @@ const instrumenterPath = path.join(harnessDirectory, "instrumenter.ts");
968978
const instrumenterJsPath = path.join(builtLocalDirectory, "instrumenter.js");
969979
gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
970980
const settings: tsc.Settings = getCompilerSettings({
971-
outFile: instrumenterJsPath,
981+
module: "commonjs",
972982
target: "es5",
973983
lib: [
974984
"es6",
@@ -980,8 +990,8 @@ gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
980990
.pipe(newer(instrumenterJsPath))
981991
.pipe(sourcemaps.init())
982992
.pipe(tsc(settings))
983-
.pipe(sourcemaps.write("."))
984-
.pipe(gulp.dest("."));
993+
.pipe(sourcemaps.write(builtLocalDirectory))
994+
.pipe(gulp.dest(builtLocalDirectory));
985995
});
986996

987997
gulp.task("tsc-instrumented", "Builds an instrumented tsc.js", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {

Jakefile.js

+28-29
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ var watchGuardSources = filesFromConfig(path.join(serverDirectory, "watchGuard/t
8888
var serverSources = filesFromConfig(path.join(serverDirectory, "tsconfig.json"))
8989
var languageServiceLibrarySources = filesFromConfig(path.join(serverDirectory, "tsconfig.library.json"));
9090

91+
var typesMapOutputPath = path.join(builtLocalDirectory, 'typesMap.json');
92+
9193
var harnessCoreSources = [
9294
"harness.ts",
9395
"virtualFileSystem.ts",
@@ -133,12 +135,14 @@ var harnessSources = harnessCoreSources.concat([
133135
"projectErrors.ts",
134136
"matchFiles.ts",
135137
"initializeTSConfig.ts",
138+
"extractMethods.ts",
136139
"printer.ts",
137140
"textChanges.ts",
138141
"telemetry.ts",
139142
"transform.ts",
140143
"customTransforms.ts",
141144
"programMissingFiles.ts",
145+
"symbolWalker.ts",
142146
].map(function (f) {
143147
return path.join(unittestsDirectory, f);
144148
})).concat([
@@ -422,6 +426,7 @@ var buildProtocolTs = path.join(scriptsDirectory, "buildProtocol.ts");
422426
var buildProtocolJs = path.join(scriptsDirectory, "buildProtocol.js");
423427
var buildProtocolDts = path.join(builtLocalDirectory, "protocol.d.ts");
424428
var typescriptServicesDts = path.join(builtLocalDirectory, "typescriptServices.d.ts");
429+
var typesMapJson = path.join(builtLocalDirectory, "typesMap.json");
425430

426431
file(buildProtocolTs);
427432

@@ -533,7 +538,6 @@ var tscFile = path.join(builtLocalDirectory, compilerFilename);
533538
compileFile(tscFile, compilerSources, [builtLocalDirectory, copyright].concat(compilerSources), [copyright], /*useBuiltCompiler:*/ false);
534539

535540
var servicesFile = path.join(builtLocalDirectory, "typescriptServices.js");
536-
var servicesFileInBrowserTest = path.join(builtLocalDirectory, "typescriptServicesInBrowserTest.js");
537541
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
538542
var nodePackageFile = path.join(builtLocalDirectory, "typescript.js");
539543
var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
@@ -572,22 +576,6 @@ compileFile(servicesFile, servicesSources, [builtLocalDirectory, copyright].conc
572576
fs.writeFileSync(nodeStandaloneDefinitionsFile, nodeStandaloneDefinitionsFileContents);
573577
});
574578

575-
compileFile(
576-
servicesFileInBrowserTest,
577-
servicesSources,
578-
[builtLocalDirectory, copyright].concat(servicesSources),
579-
/*prefixes*/[copyright],
580-
/*useBuiltCompiler*/ true,
581-
{
582-
noOutFile: false,
583-
generateDeclarations: true,
584-
preserveConstEnums: true,
585-
keepComments: true,
586-
noResolve: false,
587-
stripInternal: true,
588-
inlineSourceMap: true
589-
});
590-
591579
file(typescriptServicesDts, [servicesFile]);
592580

593581
var cancellationTokenFile = path.join(builtLocalDirectory, "cancellationToken.js");
@@ -603,6 +591,16 @@ var serverFile = path.join(builtLocalDirectory, "tsserver.js");
603591
compileFile(serverFile, serverSources, [builtLocalDirectory, copyright, cancellationTokenFile, typingsInstallerFile, watchGuardFile].concat(serverSources).concat(servicesSources), /*prefixes*/ [copyright], /*useBuiltCompiler*/ true, { types: ["node"], preserveConstEnums: true, lib: "es6" });
604592
var tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
605593
var tsserverLibraryDefinitionFile = path.join(builtLocalDirectory, "tsserverlibrary.d.ts");
594+
file(typesMapOutputPath, function() {
595+
var content = fs.readFileSync(path.join(serverDirectory, 'typesMap.json'));
596+
// Validate that it's valid JSON
597+
try {
598+
JSON.parse(content);
599+
} catch (e) {
600+
console.log("Parse error in typesMap.json: " + e);
601+
}
602+
fs.writeFileSync(typesMapOutputPath, content);
603+
});
606604
compileFile(
607605
tsserverLibraryFile,
608606
languageServiceLibrarySources,
@@ -625,7 +623,7 @@ compileFile(
625623

626624
// Local target to build the language service server library
627625
desc("Builds language service server library");
628-
task("lssl", [tsserverLibraryFile, tsserverLibraryDefinitionFile]);
626+
task("lssl", [tsserverLibraryFile, tsserverLibraryDefinitionFile, typesMapOutputPath]);
629627

630628
desc("Emit the start of the build fold");
631629
task("build-fold-start", [], function () {
@@ -654,7 +652,6 @@ task("release", function () {
654652
// Set the default task to "local"
655653
task("default", ["local"]);
656654

657-
658655
// Cleans the built directory
659656
desc("Cleans the compiler output, declare files, and tests");
660657
task("clean", function () {
@@ -725,7 +722,7 @@ compileFile(
725722
/*prereqs*/[builtLocalDirectory, tscFile].concat(libraryTargets).concat(servicesSources).concat(harnessSources),
726723
/*prefixes*/[],
727724
/*useBuiltCompiler:*/ true,
728-
/*opts*/ { inlineSourceMap: true, types: ["node", "mocha", "chai"], lib: "es6" });
725+
/*opts*/ { types: ["node", "mocha", "chai"], lib: "es6" });
729726

730727
var internalTests = "internal/";
731728

@@ -961,13 +958,14 @@ var nodeServerInFile = "tests/webTestServer.ts";
961958
compileFile(nodeServerOutFile, [nodeServerInFile], [builtLocalDirectory, tscFile], [], /*useBuiltCompiler:*/ true, { noOutFile: true, lib: "es6" });
962959

963960
desc("Runs browserify on run.js to produce a file suitable for running tests in the browser");
964-
task("browserify", ["tests", run, builtLocalDirectory, nodeServerOutFile], function() {
965-
var cmd = 'browserify built/local/run.js -t ./scripts/browserify-optional -d -o built/local/bundle.js';
961+
task("browserify", [], function() {
962+
// Shell out to `gulp`, since we do the work to handle sourcemaps correctly w/o inline maps there
963+
var cmd = 'gulp browserify --silent';
966964
exec(cmd);
967965
}, { async: true });
968966

969967
desc("Runs the tests using the built run.js file like 'jake runtests'. Syntax is jake runtests-browser. Additional optional parameters tests=[regex], browser=[chrome|IE]");
970-
task("runtests-browser", ["tests", "browserify", builtLocalDirectory, servicesFileInBrowserTest], function () {
968+
task("runtests-browser", ["browserify", nodeServerOutFile], function () {
971969
cleanTestDirs();
972970
host = "node";
973971
browser = process.env.browser || process.env.b || (os.platform() === "linux" ? "chrome" : "IE");
@@ -1101,7 +1099,7 @@ file(loggedIOJsPath, [builtLocalDirectory, loggedIOpath], function () {
11011099

11021100
var instrumenterPath = harnessDirectory + 'instrumenter.ts';
11031101
var instrumenterJsPath = builtLocalDirectory + 'instrumenter.js';
1104-
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath].concat(libraryTargets), [], /*useBuiltCompiler*/ true, { lib: "es6", types: ["node"] });
1102+
compileFile(instrumenterJsPath, [instrumenterPath], [tscFile, instrumenterPath].concat(libraryTargets), [], /*useBuiltCompiler*/ true, { lib: "es6", types: ["node"], noOutFile: true, outDir: builtLocalDirectory });
11051103

11061104
desc("Builds an instrumented tsc.js");
11071105
task('tsc-instrumented', [loggedIOJsPath, instrumenterJsPath, tscFile], function () {
@@ -1122,14 +1120,15 @@ task("update-sublime", ["local", serverFile], function () {
11221120

11231121
var tslintRuleDir = "scripts/tslint";
11241122
var tslintRules = [
1125-
"nextLineRule",
11261123
"booleanTriviaRule",
1127-
"typeOperatorSpacingRule",
1128-
"noInOperatorRule",
1124+
"debugAssertRule",
1125+
"nextLineRule",
1126+
"noBomRule",
11291127
"noIncrementDecrementRule",
1130-
"objectLiteralSurroundingSpaceRule",
1128+
"noInOperatorRule",
11311129
"noTypeAssertionWhitespaceRule",
1132-
"noBomRule"
1130+
"objectLiteralSurroundingSpaceRule",
1131+
"typeOperatorSpacingRule",
11331132
];
11341133
var tslintRulesFiles = tslintRules.map(function (p) {
11351134
return path.join(tslintRuleDir, p + ".ts");

lib/cancellationToken.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/lib.d.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ interface ObjectConstructor {
236236
* Returns the names of the enumerable properties and methods of an object.
237237
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
238238
*/
239-
keys(o: any): string[];
239+
keys(o: {}): string[];
240240
}
241241

242242
/**
@@ -1000,12 +1000,12 @@ interface ReadonlyArray<T> {
10001000
* Combines two or more arrays.
10011001
* @param items Additional items to add to the end of array1.
10021002
*/
1003-
concat(...items: T[][]): T[];
1003+
concat(...items: ReadonlyArray<T>[]): T[];
10041004
/**
10051005
* Combines two or more arrays.
10061006
* @param items Additional items to add to the end of array1.
10071007
*/
1008-
concat(...items: (T | T[])[]): T[];
1008+
concat(...items: (T | ReadonlyArray<T>)[]): T[];
10091009
/**
10101010
* Adds all the elements of an array separated by the specified separator string.
10111011
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
@@ -1119,12 +1119,12 @@ interface Array<T> {
11191119
* Combines two or more arrays.
11201120
* @param items Additional items to add to the end of array1.
11211121
*/
1122-
concat(...items: T[][]): T[];
1122+
concat(...items: ReadonlyArray<T>[]): T[];
11231123
/**
11241124
* Combines two or more arrays.
11251125
* @param items Additional items to add to the end of array1.
11261126
*/
1127-
concat(...items: (T | T[])[]): T[];
1127+
concat(...items: (T | ReadonlyArray<T>)[]): T[];
11281128
/**
11291129
* Adds all the elements of an array separated by the specified separator string.
11301130
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

lib/lib.es2015.symbol.wellknown.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ interface Map<K, V> {
130130
readonly [Symbol.toStringTag]: "Map";
131131
}
132132

133-
interface WeakMap<K extends object, V>{
133+
interface WeakMap<K extends object, V> {
134134
readonly [Symbol.toStringTag]: "WeakMap";
135135
}
136136

0 commit comments

Comments
 (0)