Skip to content

Commit 3416e91

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into update-types3
2 parents 9935bc0 + ceba507 commit 3416e91

707 files changed

Lines changed: 132877 additions & 113750 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: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,4 @@ internal/
5858
!tests/baselines/reference/project/nodeModules*/**/*
5959
.idea
6060
yarn.lock
61-
package-lock.json
6261
.parallelperf.*

.mailmap

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,4 +276,15 @@ Francois Wouts <f@codonut.com>
276276
Jan Melcher <jan.melcher@aeb.com> Jan Melcher <mail@jan-melcher.de>
277277
Matt Mitchell <mmitche@microsoft.com>
278278
Maxwell Paul Brickner <mbrickn@users.noreply.github.com>
279-
Tycho Grouwstra <tychogrouwstra@gmail.com>
279+
Tycho Grouwstra <tychogrouwstra@gmail.com>
280+
Adrian Leonhard <adrianleonhard@gmail.com>
281+
Alex Chugaev <achugaev93@gmail.com>
282+
Henry Mercer <henry.mercer@me.com>
283+
Ivan Enderlin <ivan.enderlin@hoa-project.net>
284+
Joe Calzaretta <jcalz@mit.edu>
285+
Magnus Kulke <mkulke@gmail.com>
286+
Stas Vilchik <stas.vilchik@sonarsource.com>
287+
Taras Mankovski <tarasm@gmail.com>
288+
Thomas den Hollander <ThomasdenH@users.noreply.github.com>
289+
Vakhurin Sergey <igelbox@gmail.com>
290+
Zeeshan Ahmed <ziishaned@gmail.com>

.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.5
20+
- release-2.6
2021

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

AUTHORS.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ TypeScript is authored by:
33
* Abubaker Bashir
44
* Adam Freidin
55
* Adi Dahiya
6+
* Adrian Leonhard
67
* Ahmad Farid
78
* Akshar Patel
9+
* Alex Chugaev
810
* Alex Eagle
911
* Alexander Kuvaev
1012
* Alexander Rusakov
@@ -105,13 +107,15 @@ TypeScript is authored by:
105107
* Halasi Tamás
106108
* Harald Niesche
107109
* Hendrik Liebau
110+
* Henry Mercer
108111
* Herrington Darkholme
109112
* Homa Wong
110113
* Iain Monro
111114
* Igor Novozhilov
112115
* Ika
113116
* Ingvar Stepanyan
114117
* Isiah Meadows
118+
* Ivan Enderlin
115119
* Ivo Gabe de Wolff
116120
* Iwata Hidetaka
117121
* Jakub Młokosiewicz
@@ -127,6 +131,7 @@ TypeScript is authored by:
127131
* Jeffrey Morlan
128132
* Jesse Schalken
129133
* Jiri Tobisek
134+
* Joe Calzaretta
130135
* Joe Chung
131136
* Joel Day
132137
* Joey Wilson
@@ -161,6 +166,7 @@ TypeScript is authored by:
161166
* Lucien Greathouse
162167
* Lukas Elmer
163168
* Magnus Hiie
169+
* Magnus Kulke
164170
* Manish Giri
165171
* Marin Marinov
166172
* Marius Schulz
@@ -232,13 +238,16 @@ TypeScript is authored by:
232238
* Soo Jae Hwang
233239
* Stan Thomas
234240
* Stanislav Sysoev
241+
* Stas Vilchik
235242
* Steve Lucco
236243
* Sudheesh Singanamalla
237244
* Sébastien Arod
238245
* @T18970237136
239246
* @t_
247+
* Taras Mankovski
240248
* Tarik Ozket
241249
* Tetsuharu Ohzeki
250+
* Thomas den Hollander
242251
* Thomas Loubiou
243252
* Tien Hoanhtien
244253
* Tim Lancina
@@ -253,6 +262,7 @@ TypeScript is authored by:
253262
* TruongSinh Tran-Nguyen
254263
* Tycho Grouwstra
255264
* Vadi Taslim
265+
* Vakhurin Sergey
256266
* Vidar Tonaas Fauske
257267
* Viktor Zozulyak
258268
* Vilic Vane
@@ -263,5 +273,6 @@ TypeScript is authored by:
263273
* York Yao
264274
* @yortus
265275
* Yuichi Nukiyama
276+
* Zeeshan Ahmed
266277
* Zev Spitz
267278
* Zhengbo Li

Gulpfile.ts

Lines changed: 39 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const cmdLineOptions = minimist(process.argv.slice(2), {
6464
browser: process.env.browser || process.env.b || "IE",
6565
timeout: process.env.timeout || 40000,
6666
tests: process.env.test || process.env.tests || process.env.t,
67-
light: process.env.light || false,
67+
light: process.env.light === undefined || process.env.light !== "false",
6868
reporter: process.env.reporter || process.env.r,
6969
lint: process.env.lint || true,
7070
files: process.env.f || process.env.file || process.env.files || "",
@@ -87,7 +87,7 @@ function possiblyQuote(cmd: string) {
8787
}
8888

8989
let useDebugMode = true;
90-
let host = cmdLineOptions["host"];
90+
let host = cmdLineOptions.host;
9191

9292
// Constants
9393
const compilerDirectory = "src/compiler/";
@@ -180,6 +180,23 @@ const libraryTargets = librarySourceMap.map(function(f) {
180180
return path.join(builtLocalDirectory, f.target);
181181
});
182182

183+
/**
184+
* .lcg file is what localization team uses to know what messages to localize.
185+
* The file is always generated in 'enu\diagnosticMessages.generated.json.lcg'
186+
*/
187+
const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");
188+
189+
/**
190+
* The localization target produces the two following transformations:
191+
* 1. 'src\loc\lcl\<locale>\diagnosticMessages.generated.json.lcl' => 'built\local\<locale>\diagnosticMessages.generated.json'
192+
* convert localized resources into a .json file the compiler can understand
193+
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
194+
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
195+
*/
196+
const localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) {
197+
return path.join(builtLocalDirectory, f, "diagnosticMessages.generated.json");
198+
}).concat(generatedLCGFile);
199+
183200
for (const i in libraryTargets) {
184201
const entry = librarySourceMap[i];
185202
const target = libraryTargets[i];
@@ -398,7 +415,6 @@ gulp.task(generateLocalizedDiagnosticMessagesJs, /*help*/ false, [], () => {
398415
});
399416

400417
// Localize diagnostics
401-
const generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");
402418
gulp.task(generatedLCGFile, [generateLocalizedDiagnosticMessagesJs, diagnosticInfoMapTs], (done) => {
403419
if (fs.existsSync(builtLocalDirectory) && needsUpdate(generatedDiagnosticMessagesJSON, generatedLCGFile)) {
404420
exec(host, [generateLocalizedDiagnosticMessagesJs, lclDirectory, builtLocalDirectory, generatedDiagnosticMessagesJSON], done, done);
@@ -576,8 +592,7 @@ gulp.task("dontUseDebugMode", /*help*/ false, [], (done) => { useDebugMode = fal
576592
gulp.task("VerifyLKG", /*help*/ false, [], () => {
577593
const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, typingsInstallerJs, cancellationTokenJs].concat(libraryTargets);
578594
const missingFiles = expectedFiles.
579-
concat(fs.readdirSync(lclDirectory).map(function (d) { return path.join(builtLocalDirectory, d, "diagnosticMessages.generated.json"); })).
580-
concat(generatedLCGFile).
595+
concat(localizationTargets).
581596
filter(f => !fs.existsSync(f));
582597
if (missingFiles.length > 0) {
583598
throw new Error("Cannot replace the LKG unless all built targets are present in directory " + builtLocalDirectory +
@@ -636,15 +651,15 @@ function restoreSavedNodeEnv() {
636651
}
637652

638653
function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) {
639-
const lintFlag = cmdLineOptions["lint"];
654+
const lintFlag = cmdLineOptions.lint;
640655
cleanTestDirs((err) => {
641656
if (err) { console.error(err); failWithStatus(err, 1); }
642-
let testTimeout = cmdLineOptions["timeout"];
643-
const debug = cmdLineOptions["debug"];
644-
const inspect = cmdLineOptions["inspect"];
645-
const tests = cmdLineOptions["tests"];
646-
const light = cmdLineOptions["light"];
647-
const stackTraceLimit = cmdLineOptions["stackTraceLimit"];
657+
let testTimeout = cmdLineOptions.timeout;
658+
const debug = cmdLineOptions.debug;
659+
const inspect = cmdLineOptions.inspect;
660+
const tests = cmdLineOptions.tests;
661+
const light = cmdLineOptions.light;
662+
const stackTraceLimit = cmdLineOptions.stackTraceLimit;
648663
const testConfigFile = "test.config";
649664
if (fs.existsSync(testConfigFile)) {
650665
fs.unlinkSync(testConfigFile);
@@ -660,7 +675,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
660675
} while (fs.existsSync(taskConfigsFolder));
661676
fs.mkdirSync(taskConfigsFolder);
662677

663-
workerCount = cmdLineOptions["workers"];
678+
workerCount = cmdLineOptions.workers;
664679
}
665680

666681
if (tests || light || taskConfigsFolder) {
@@ -671,8 +686,8 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
671686
testTimeout = 400000;
672687
}
673688

674-
const colors = cmdLineOptions["colors"];
675-
const reporter = cmdLineOptions["reporter"] || defaultReporter;
689+
const colors = cmdLineOptions.colors;
690+
const reporter = cmdLineOptions.reporter || defaultReporter;
676691

677692
// timeout normally isn"t necessary but Travis-CI has been timing out on compiler baselines occasionally
678693
// default timeout is 2sec which really should be enough, but maybe we just need a small amount longer
@@ -860,7 +875,7 @@ function cleanTestDirs(done: (e?: any) => void) {
860875

861876
// used to pass data from jake command line directly to run.js
862877
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
863-
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions["colors"] });
878+
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder, noColor: !cmdLineOptions.colors });
864879
console.log("Running tests with config: " + testConfigContents);
865880
fs.writeFileSync("test.config", testConfigContents);
866881
}
@@ -870,8 +885,8 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
870885
cleanTestDirs((err) => {
871886
if (err) { console.error(err); done(err); process.exit(1); }
872887
host = "node";
873-
const tests = cmdLineOptions["tests"];
874-
const light = cmdLineOptions["light"];
888+
const tests = cmdLineOptions.tests;
889+
const light = cmdLineOptions.light;
875890
const testConfigFile = "test.config";
876891
if (fs.existsSync(testConfigFile)) {
877892
fs.unlinkSync(testConfigFile);
@@ -881,8 +896,8 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
881896
}
882897

883898
const args = [nodeServerOutFile];
884-
if (cmdLineOptions["browser"]) {
885-
args.push(cmdLineOptions["browser"]);
899+
if (cmdLineOptions.browser) {
900+
args.push(cmdLineOptions.browser);
886901
}
887902
if (tests) {
888903
args.push(JSON.stringify(tests));
@@ -892,13 +907,13 @@ gulp.task("runtests-browser", "Runs the tests using the built run.js file like '
892907
});
893908

894909
gulp.task("generate-code-coverage", "Generates code coverage data via istanbul", ["tests"], (done) => {
895-
const testTimeout = cmdLineOptions["timeout"];
910+
const testTimeout = cmdLineOptions.timeout;
896911
exec("istanbul", ["cover", "node_modules/mocha/bin/_mocha", "--", "-R", "min", "-t", testTimeout.toString(), run], done, done);
897912
});
898913

899914

900915
function getDiffTool() {
901-
const program = process.env["DIFF"];
916+
const program = process.env.DIFF;
902917
if (!program) {
903918
console.error("Add the 'DIFF' environment variable to the path of the program you want to use.");
904919
process.exit(1);
@@ -1019,7 +1034,7 @@ gulp.task(instrumenterJsPath, /*help*/ false, [servicesFile], () => {
10191034
});
10201035

10211036
gulp.task("tsc-instrumented", "Builds an instrumented tsc.js - run with --test=[testname]", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {
1022-
const test = cmdLineOptions["tests"] || "iocapture";
1037+
const test = cmdLineOptions.tests || "iocapture";
10231038
exec(host, [instrumenterJsPath, "record", test, builtLocalCompiler], done, done);
10241039
});
10251040

@@ -1088,7 +1103,7 @@ function spawnLintWorker(files: {path: string}[], callback: (failures: number) =
10881103

10891104
gulp.task("lint", "Runs tslint on the compiler sources. Optional arguments are: --f[iles]=regex", ["build-rules"], () => {
10901105
if (fold.isTravis()) console.log(fold.start("lint"));
1091-
const fileMatcher = cmdLineOptions["files"];
1106+
const fileMatcher = cmdLineOptions.files;
10921107
const files = fileMatcher
10931108
? `src/**/${fileMatcher}`
10941109
: "Gulpfile.ts 'scripts/generateLocalizedDiagnosticMessages.ts' 'scripts/tslint/**/*.ts' 'src/**/*.ts' --exclude src/lib/es5.d.ts --exclude 'src/lib/*.generated.d.ts'";

Jakefile.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ var harnessSources = harnessCoreSources.concat([
154154
"symbolWalker.ts",
155155
"languageService.ts",
156156
"publicApi.ts",
157+
"hostNewLineSupport.ts",
157158
].map(function (f) {
158159
return path.join(unittestsDirectory, f);
159160
})).concat([
@@ -238,6 +239,23 @@ var libraryTargets = librarySourceMap.map(function (f) {
238239
return path.join(builtLocalDirectory, f.target);
239240
});
240241

242+
/**
243+
* .lcg file is what localization team uses to know what messages to localize.
244+
* The file is always generated in 'enu\diagnosticMessages.generated.json.lcg'
245+
*/
246+
var generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");
247+
248+
/**
249+
* The localization target produces the two following transformations:
250+
* 1. 'src\loc\lcl\<locale>\diagnosticMessages.generated.json.lcl' => 'built\local\<locale>\diagnosticMessages.generated.json'
251+
* convert localized resources into a .json file the compiler can understand
252+
* 2. 'src\compiler\diagnosticMessages.generated.json' => 'built\local\ENU\diagnosticMessages.generated.json.lcg'
253+
* generate the lcg file (source of messages to localize) from the diagnosticMessages.generated.json
254+
*/
255+
var localizationTargets = ["cs", "de", "es", "fr", "it", "ja", "ko", "pl", "pt-BR", "ru", "tr", "zh-CN", "zh-TW"].map(function (f) {
256+
return path.join(builtLocalDirectory, f);
257+
}).concat(path.dirname(generatedLCGFile));
258+
241259
// Prepends the contents of prefixFile to destinationFile
242260
function prependFile(prefixFile, destinationFile) {
243261
if (!fs.existsSync(prefixFile)) {
@@ -443,7 +461,6 @@ compileFile(generateLocalizedDiagnosticMessagesJs,
443461
/*useBuiltCompiler*/ false, { noOutFile: true, types: ["node", "xml2js"] });
444462

445463
// Localize diagnostics
446-
var generatedLCGFile = path.join(builtLocalDirectory, "enu", "diagnosticMessages.generated.json.lcg");
447464
file(generatedLCGFile, [generateLocalizedDiagnosticMessagesJs, diagnosticInfoMapTs, generatedDiagnosticMessagesJSON], function () {
448465
var cmd = host + " " + generateLocalizedDiagnosticMessagesJs + " " + lclDirectory + " " + builtLocalDirectory + " " + generatedDiagnosticMessagesJSON;
449466
console.log(cmd);
@@ -735,8 +752,7 @@ desc("Makes a new LKG out of the built js files");
735752
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function () {
736753
var expectedFiles = [tscFile, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, cancellationTokenFile, typingsInstallerFile, buildProtocolDts, watchGuardFile].
737754
concat(libraryTargets).
738-
concat(fs.readdirSync(lclDirectory).map(function (d) { return path.join(builtLocalDirectory, d) })).
739-
concat(path.dirname(generatedLCGFile));
755+
concat(localizationTargets);
740756
var missingFiles = expectedFiles.filter(function (f) {
741757
return !fs.existsSync(f);
742758
});
@@ -855,7 +871,7 @@ function runConsoleTests(defaultReporter, runInParallel) {
855871
var inspect = process.env.inspect || process.env["inspect-brk"] || process.env.i;
856872
var testTimeout = process.env.timeout || defaultTestTimeout;
857873
var tests = process.env.test || process.env.tests || process.env.t;
858-
var light = process.env.light || false;
874+
var light = process.env.light === undefined || process.env.light !== "false";
859875
var stackTraceLimit = process.env.stackTraceLimit;
860876
var testConfigFile = 'test.config';
861877
if (fs.existsSync(testConfigFile)) {

issue_template.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
<!-- QUESTIONS: This is not a general support forum! Ask Qs at http://stackoverflow.com/questions/tagged/typescript -->
33
<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->
44

5-
**TypeScript Version:** 2.4.0 / nightly (2.5.0-dev.201xxxxx)
5+
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
6+
**TypeScript Version:** 2.6.0-dev.201xxxxx
67

78
**Code**
89

0 commit comments

Comments
 (0)