Skip to content

Commit 3ebb2e8

Browse files
Merge branch 'master' into jsxFragment
2 parents a83ec41 + 239a039 commit 3ebb2e8

File tree

354 files changed

+10420
-2870
lines changed

Some content is hidden

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

354 files changed

+10420
-2870
lines changed

Gulpfile.ts

Lines changed: 42 additions & 27 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/";
@@ -171,15 +171,32 @@ const librarySourceMap = [
171171
// JavaScript + all host library
172172
{ target: "lib.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(hostsLibrarySources) },
173173
{ target: "lib.es6.d.ts", sources: ["header.d.ts", "es5.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
174-
{ target: "lib.es2016.full.d.ts", sources: ["header.d.ts", "es2016.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
175-
{ target: "lib.es2017.full.d.ts", sources: ["header.d.ts", "es2017.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
176-
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(es2015LibrarySources, hostsLibrarySources, "dom.iterable.d.ts") },
174+
{ target: "lib.es2016.full.d.ts", sources: ["header.d.ts", "es2016.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
175+
{ target: "lib.es2017.full.d.ts", sources: ["header.d.ts", "es2017.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
176+
{ target: "lib.esnext.full.d.ts", sources: ["header.d.ts", "esnext.d.ts"].concat(hostsLibrarySources, "dom.iterable.d.ts") },
177177
].concat(es2015LibrarySourceMap, es2016LibrarySourceMap, es2017LibrarySourceMap, esnextLibrarySourceMap);
178178

179179
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<!-- SUGGESTIONS: See https://github.com/Microsoft/TypeScript-wiki/blob/master/Writing-Good-Design-Proposals.md -->
44

55
<!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->
6-
**TypeScript Version:** 2.6.0-dev.201xxxxx
6+
**TypeScript Version:** 2.7.0-dev.201xxxxx
77

88
**Code**
99

0 commit comments

Comments
 (0)