Skip to content

Commit 9122f62

Browse files
committed
Merge remote-tracking branch 'upstream/master'
2 parents 8a37a16 + 65b1cf6 commit 9122f62

File tree

6,502 files changed

+498401
-272165
lines changed

Some content is hidden

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

6,502 files changed

+498401
-272165
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ test-args.txt
99
\#*\#
1010
.\#*
1111
tests/baselines/local/*
12+
tests/baselines/local.old/*
1213
tests/services/baselines/local/*
1314
tests/baselines/prototyping/local/*
1415
tests/baselines/rwc/*
1516
tests/baselines/test262/*
1617
tests/baselines/reference/projectOutput/*
1718
tests/baselines/local/projectOutput/*
19+
tests/baselines/reference/testresults.tap
1820
tests/services/baselines/prototyping/local/*
1921
tests/services/browser/typescriptServices.js
2022
scripts/authors.js
@@ -39,7 +41,9 @@ tests/cases/**/*.js.map
3941
scripts/debug.bat
4042
scripts/run.bat
4143
scripts/word2md.js
44+
scripts/buildProtocol.js
4245
scripts/ior.js
46+
scripts/buildProtocol.js
4347
scripts/*.js.map
4448
scripts/typings/
4549
coverage/
@@ -52,3 +56,4 @@ internal/
5256
!tests/cases/projects/projectOption/**/node_modules
5357
!tests/cases/projects/NodeModulesSearch/**/*
5458
!tests/baselines/reference/project/nodeModules*/**/*
59+
.idea

.travis.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ language: node_js
33
node_js:
44
- 'stable'
55
- '4'
6-
- '0.10'
76

87
sudo: false
98

@@ -12,18 +11,11 @@ env:
1211

1312
matrix:
1413
fast_finish: true
15-
include:
16-
- os: osx
17-
node_js: stable
18-
osx_image: xcode7.3
19-
env: workerCount=2
20-
allow_failures:
21-
- os: osx
2214

2315
branches:
2416
only:
2517
- master
26-
- transforms
18+
- release-2.0
2719

2820
install:
2921
- npm uninstall typescript

CONTRIBUTING.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ In general, things we find useful when reviewing suggestions are:
4040

4141
# Instructions for Contributing Code
4242

43-
## Code of Conduct
44-
45-
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
46-
4743
## Contributing bug fixes
4844

4945
TypeScript is currently accepting contributions in the form of bug fixes. A bug must have an issue tracking it in the issue tracker that has been approved ("Milestone == Community") by the TypeScript team. Your pull request should include a link to the bug that you are fixing. If you've submitted a PR for a bug, please post a comment in the bug to avoid duplication of effort.

Gulpfile.ts

Lines changed: 56 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ declare module "gulp-typescript" {
1717
stripInternal?: boolean;
1818
types?: string[];
1919
}
20-
interface CompileStream extends NodeJS.ReadWriteStream { } // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required
2120
}
2221
import * as insert from "gulp-insert";
2322
import * as sourcemaps from "gulp-sourcemaps";
@@ -39,9 +38,11 @@ const gulp = helpMaker(originalGulp);
3938
const mochaParallel = require("./scripts/mocha-parallel.js");
4039
const {runTestsInParallel} = mochaParallel;
4140

41+
Error.stackTraceLimit = 1000;
42+
4243
const cmdLineOptions = minimist(process.argv.slice(2), {
4344
boolean: ["debug", "light", "colors", "lint", "soft"],
44-
string: ["browser", "tests", "host", "reporter"],
45+
string: ["browser", "tests", "host", "reporter", "stackTraceLimit"],
4546
alias: {
4647
d: "debug",
4748
t: "tests",
@@ -167,7 +168,7 @@ for (const i in libraryTargets) {
167168
gulp.task(target, false, [], function() {
168169
return gulp.src(sources)
169170
.pipe(newer(target))
170-
.pipe(concat(target, { newLine: "" }))
171+
.pipe(concat(target, { newLine: "\n\n" }))
171172
.pipe(gulp.dest("."));
172173
});
173174
}
@@ -378,18 +379,18 @@ gulp.task(builtLocalCompiler, false, [servicesFile], () => {
378379
return localCompilerProject.src()
379380
.pipe(newer(builtLocalCompiler))
380381
.pipe(sourcemaps.init())
381-
.pipe(tsc(localCompilerProject))
382+
.pipe(localCompilerProject())
382383
.pipe(prependCopyright())
383384
.pipe(sourcemaps.write("."))
384-
.pipe(gulp.dest(builtLocalDirectory));
385+
.pipe(gulp.dest("."));
385386
});
386387

387388
gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
388389
const servicesProject = tsc.createProject("src/services/tsconfig.json", getCompilerSettings({ removeComments: false }, /*useBuiltCompiler*/false));
389390
const {js, dts} = servicesProject.src()
390391
.pipe(newer(servicesFile))
391392
.pipe(sourcemaps.init())
392-
.pipe(tsc(servicesProject));
393+
.pipe(servicesProject());
393394
const completedJs = js.pipe(prependCopyright())
394395
.pipe(sourcemaps.write("."));
395396
const completedDts = dts.pipe(prependCopyright(/*outputCopyright*/true))
@@ -407,26 +408,52 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => {
407408
file.path = nodeDefinitionsFile;
408409
return content + "\r\nexport = ts;";
409410
}))
410-
.pipe(gulp.dest(builtLocalDirectory)),
411+
.pipe(gulp.dest(".")),
411412
completedDts.pipe(clone())
412413
.pipe(insert.transform((content, file) => {
413414
file.path = nodeStandaloneDefinitionsFile;
414415
return content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"');
415416
}))
416-
]).pipe(gulp.dest(builtLocalDirectory));
417+
]).pipe(gulp.dest("."));
418+
});
419+
420+
// cancellationToken.js
421+
const cancellationTokenJs = path.join(builtLocalDirectory, "cancellationToken.js");
422+
gulp.task(cancellationTokenJs, false, [servicesFile], () => {
423+
const cancellationTokenProject = tsc.createProject("src/server/cancellationToken/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
424+
return cancellationTokenProject.src()
425+
.pipe(newer(cancellationTokenJs))
426+
.pipe(sourcemaps.init())
427+
.pipe(cancellationTokenProject())
428+
.pipe(prependCopyright())
429+
.pipe(sourcemaps.write("."))
430+
.pipe(gulp.dest(builtLocalDirectory));
431+
});
432+
433+
// typingsInstallerFile.js
434+
const typingsInstallerJs = path.join(builtLocalDirectory, "typingsInstaller.js");
435+
gulp.task(typingsInstallerJs, false, [servicesFile], () => {
436+
const cancellationTokenProject = tsc.createProject("src/server/typingsInstaller/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
437+
return cancellationTokenProject.src()
438+
.pipe(newer(typingsInstallerJs))
439+
.pipe(sourcemaps.init())
440+
.pipe(cancellationTokenProject())
441+
.pipe(prependCopyright())
442+
.pipe(sourcemaps.write("."))
443+
.pipe(gulp.dest("."));
417444
});
418445

419446
const serverFile = path.join(builtLocalDirectory, "tsserver.js");
420447

421-
gulp.task(serverFile, false, [servicesFile], () => {
448+
gulp.task(serverFile, false, [servicesFile, typingsInstallerJs, cancellationTokenJs], () => {
422449
const serverProject = tsc.createProject("src/server/tsconfig.json", getCompilerSettings({}, /*useBuiltCompiler*/true));
423450
return serverProject.src()
424451
.pipe(newer(serverFile))
425452
.pipe(sourcemaps.init())
426-
.pipe(tsc(serverProject))
453+
.pipe(serverProject())
427454
.pipe(prependCopyright())
428455
.pipe(sourcemaps.write("."))
429-
.pipe(gulp.dest(builtLocalDirectory));
456+
.pipe(gulp.dest("."));
430457
});
431458

432459
const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js");
@@ -437,22 +464,21 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => {
437464
const {js, dts}: { js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream } = serverLibraryProject.src()
438465
.pipe(sourcemaps.init())
439466
.pipe(newer(tsserverLibraryFile))
440-
.pipe(tsc(serverLibraryProject));
467+
.pipe(serverLibraryProject());
441468

442469
return merge2([
443470
js.pipe(prependCopyright())
444471
.pipe(sourcemaps.write("."))
445-
.pipe(gulp.dest(builtLocalDirectory)),
472+
.pipe(gulp.dest(".")),
446473
dts.pipe(prependCopyright())
447-
.pipe(gulp.dest(builtLocalDirectory))
474+
.pipe(gulp.dest("."))
448475
]);
449476
});
450477

451478
gulp.task("lssl", "Builds language service server library", [tsserverLibraryFile]);
452479
gulp.task("local", "Builds the full compiler and services", [builtLocalCompiler, servicesFile, serverFile, builtGeneratedDiagnosticMessagesJSON, tsserverLibraryFile]);
453480
gulp.task("tsc", "Builds only the compiler", [builtLocalCompiler]);
454481

455-
456482
// Generate Markdown spec
457483
const word2mdJs = path.join(scriptsDirectory, "word2md.js");
458484
const word2mdTs = path.join(scriptsDirectory, "word2md.ts");
@@ -491,7 +517,7 @@ gulp.task("useDebugMode", false, [], (done) => { useDebugMode = true; done(); })
491517
gulp.task("dontUseDebugMode", false, [], (done) => { useDebugMode = false; done(); });
492518

493519
gulp.task("VerifyLKG", false, [], () => {
494-
const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile].concat(libraryTargets);
520+
const expectedFiles = [builtLocalCompiler, servicesFile, serverFile, nodePackageFile, nodeDefinitionsFile, standaloneDefinitionsFile, tsserverLibraryFile, tsserverLibraryDefinitionFile, typingsInstallerJs, cancellationTokenJs].concat(libraryTargets);
495521
const missingFiles = expectedFiles.filter(function(f) {
496522
return !fs.existsSync(f);
497523
});
@@ -517,9 +543,9 @@ gulp.task(run, false, [servicesFile], () => {
517543
return testProject.src()
518544
.pipe(newer(run))
519545
.pipe(sourcemaps.init())
520-
.pipe(tsc(testProject))
546+
.pipe(testProject())
521547
.pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" }))
522-
.pipe(gulp.dest(builtLocalDirectory));
548+
.pipe(gulp.dest("."));
523549
});
524550

525551
const internalTests = "internal/";
@@ -551,14 +577,15 @@ function restoreSavedNodeEnv() {
551577
process.env.NODE_ENV = savedNodeEnv;
552578
}
553579

554-
let testTimeout = 20000;
580+
let testTimeout = 40000;
555581
function runConsoleTests(defaultReporter: string, runInParallel: boolean, done: (e?: any) => void) {
556582
const lintFlag = cmdLineOptions["lint"];
557583
cleanTestDirs((err) => {
558584
if (err) { console.error(err); failWithStatus(err, 1); }
559585
const debug = cmdLineOptions["debug"];
560586
const tests = cmdLineOptions["tests"];
561587
const light = cmdLineOptions["light"];
588+
const stackTraceLimit = cmdLineOptions["stackTraceLimit"];
562589
const testConfigFile = "test.config";
563590
if (fs.existsSync(testConfigFile)) {
564591
fs.unlinkSync(testConfigFile);
@@ -578,7 +605,7 @@ function runConsoleTests(defaultReporter: string, runInParallel: boolean, done:
578605
}
579606

580607
if (tests || light || taskConfigsFolder) {
581-
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount);
608+
writeTestConfigFile(tests, light, taskConfigsFolder, workerCount, stackTraceLimit);
582609
}
583610

584611
if (tests && tests.toLocaleLowerCase() === "rwc") {
@@ -698,16 +725,16 @@ declare module "convert-source-map" {
698725
}
699726

700727
gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => {
701-
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "built/local/bundle.js" }, /*useBuiltCompiler*/ true));
728+
const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "../../built/local/bundle.js" }, /*useBuiltCompiler*/ true));
702729
return testProject.src()
703730
.pipe(newer("built/local/bundle.js"))
704731
.pipe(sourcemaps.init())
705-
.pipe(tsc(testProject))
732+
.pipe(testProject())
706733
.pipe(through2.obj((file, enc, next) => {
707734
const originalMap = file.sourceMap;
708735
const prebundledContent = file.contents.toString();
709736
// Make paths absolute to help sorcery deal with all the terrible paths being thrown around
710-
originalMap.sources = originalMap.sources.map(s => path.resolve("src", s));
737+
originalMap.sources = originalMap.sources.map(s => path.resolve(s));
711738
// intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap
712739
originalMap.file = "built/local/_stream_0.js";
713740

@@ -727,6 +754,7 @@ gulp.task("browserify", "Runs browserify on run.js to produce a file suitable fo
727754
sourcemaps: {
728755
"built/local/_stream_0.js": originalMap,
729756
"built/local/bundle.js": maps,
757+
"node_modules/source-map-support/source-map-support.js": undefined,
730758
}
731759
});
732760
const finalMap = chain.apply();
@@ -756,8 +784,8 @@ function cleanTestDirs(done: (e?: any) => void) {
756784
}
757785

758786
// used to pass data from jake command line directly to run.js
759-
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number) {
760-
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light: light, workerCount: workerCount, taskConfigsFolder: taskConfigsFolder });
787+
function writeTestConfigFile(tests: string, light: boolean, taskConfigsFolder?: string, workerCount?: number, stackTraceLimit?: string) {
788+
const testConfigContents = JSON.stringify({ test: tests ? [tests] : undefined, light, workerCount, stackTraceLimit, taskConfigsFolder });
761789
console.log("Running tests with config: " + testConfigContents);
762790
fs.writeFileSync("test.config", testConfigContents);
763791
}
@@ -887,7 +915,7 @@ gulp.task(loggedIOJsPath, false, [], (done) => {
887915
const temp = path.join(builtLocalDirectory, "temp");
888916
mkdirP(temp, (err) => {
889917
if (err) { console.error(err); done(err); process.exit(1); };
890-
exec(host, [LKGCompiler, "--outdir", temp, loggedIOpath], () => {
918+
exec(host, [LKGCompiler, "--types --outdir", temp, loggedIOpath], () => {
891919
fs.renameSync(path.join(temp, "/harness/loggedIO.js"), loggedIOJsPath);
892920
del(temp).then(() => done(), done);
893921
}, done);
@@ -908,8 +936,8 @@ gulp.task(instrumenterJsPath, false, [servicesFile], () => {
908936
.pipe(gulp.dest("."));
909937
});
910938

911-
gulp.task("tsc-instrumented", "Builds an instrumented tsc.js", [loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {
912-
exec(host, [instrumenterJsPath, "record", "iocapture", builtLocalDirectory, compilerFilename], done, done);
939+
gulp.task("tsc-instrumented", "Builds an instrumented tsc.js", ["local", loggedIOJsPath, instrumenterJsPath, servicesFile], (done) => {
940+
exec(host, [instrumenterJsPath, "record", "iocapture", builtLocalCompiler], done, done);
913941
});
914942

915943
gulp.task("update-sublime", "Updates the sublime plugin's tsserver", ["local", serverFile], () => {

0 commit comments

Comments
 (0)