From 2f2117c0eee8bcbb9ac076f89f6207e647e89f3f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Wed, 12 Oct 2016 08:38:26 -0700 Subject: [PATCH] Port #11290 and #11358 to release-2.0.5 --- Gulpfile.ts | 37 +++++++++++----------- src/server/cancellationToken/tsconfig.json | 1 - src/server/tsconfig.json | 2 +- src/server/tsconfig.library.json | 2 +- src/server/typingsInstaller/tsconfig.json | 2 +- 5 files changed, 21 insertions(+), 23 deletions(-) diff --git a/Gulpfile.ts b/Gulpfile.ts index 28a465c47d4..82d38f3c7d5 100644 --- a/Gulpfile.ts +++ b/Gulpfile.ts @@ -17,7 +17,6 @@ declare module "gulp-typescript" { stripInternal?: boolean; types?: string[]; } - interface CompileStream extends NodeJS.ReadWriteStream { } // Either gulp or gulp-typescript has some odd typings which don't reflect reality, making this required } import * as insert from "gulp-insert"; import * as sourcemaps from "gulp-sourcemaps"; @@ -378,10 +377,10 @@ gulp.task(builtLocalCompiler, false, [servicesFile], () => { return localCompilerProject.src() .pipe(newer(builtLocalCompiler)) .pipe(sourcemaps.init()) - .pipe(tsc(localCompilerProject)) + .pipe(localCompilerProject()) .pipe(prependCopyright()) .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(builtLocalDirectory)); + .pipe(gulp.dest(".")); }); gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => { @@ -389,7 +388,7 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => { const {js, dts} = servicesProject.src() .pipe(newer(servicesFile)) .pipe(sourcemaps.init()) - .pipe(tsc(servicesProject)); + .pipe(servicesProject()); const completedJs = js.pipe(prependCopyright()) .pipe(sourcemaps.write(".")); const completedDts = dts.pipe(prependCopyright(/*outputCopyright*/true)) @@ -407,13 +406,13 @@ gulp.task(servicesFile, false, ["lib", "generate-diagnostics"], () => { file.path = nodeDefinitionsFile; return content + "\r\nexport = ts;"; })) - .pipe(gulp.dest(builtLocalDirectory)), + .pipe(gulp.dest(".")), completedDts.pipe(clone()) .pipe(insert.transform((content, file) => { file.path = nodeStandaloneDefinitionsFile; return content.replace(/declare (namespace|module) ts/g, 'declare module "typescript"'); })) - ]).pipe(gulp.dest(builtLocalDirectory)); + ]).pipe(gulp.dest(".")); }); // cancellationToken.js @@ -423,7 +422,7 @@ gulp.task(cancellationTokenJs, false, [servicesFile], () => { return cancellationTokenProject.src() .pipe(newer(cancellationTokenJs)) .pipe(sourcemaps.init()) - .pipe(tsc(cancellationTokenProject)) + .pipe(cancellationTokenProject()) .pipe(prependCopyright()) .pipe(sourcemaps.write(".")) .pipe(gulp.dest(builtLocalDirectory)); @@ -436,10 +435,10 @@ gulp.task(typingsInstallerJs, false, [servicesFile], () => { return cancellationTokenProject.src() .pipe(newer(typingsInstallerJs)) .pipe(sourcemaps.init()) - .pipe(tsc(cancellationTokenProject)) + .pipe(cancellationTokenProject()) .pipe(prependCopyright()) .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(builtLocalDirectory)); + .pipe(gulp.dest(".")); }); const serverFile = path.join(builtLocalDirectory, "tsserver.js"); @@ -449,10 +448,10 @@ gulp.task(serverFile, false, [servicesFile, typingsInstallerJs, cancellationToke return serverProject.src() .pipe(newer(serverFile)) .pipe(sourcemaps.init()) - .pipe(tsc(serverProject)) + .pipe(serverProject()) .pipe(prependCopyright()) .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(builtLocalDirectory)); + .pipe(gulp.dest(".")); }); const tsserverLibraryFile = path.join(builtLocalDirectory, "tsserverlibrary.js"); @@ -463,14 +462,14 @@ gulp.task(tsserverLibraryFile, false, [servicesFile], (done) => { const {js, dts}: { js: NodeJS.ReadableStream, dts: NodeJS.ReadableStream } = serverLibraryProject.src() .pipe(sourcemaps.init()) .pipe(newer(tsserverLibraryFile)) - .pipe(tsc(serverLibraryProject)); + .pipe(serverLibraryProject()); return merge2([ js.pipe(prependCopyright()) .pipe(sourcemaps.write(".")) - .pipe(gulp.dest(builtLocalDirectory)), + .pipe(gulp.dest(".")), dts.pipe(prependCopyright()) - .pipe(gulp.dest(builtLocalDirectory)) + .pipe(gulp.dest(".")) ]); }); @@ -542,9 +541,9 @@ gulp.task(run, false, [servicesFile], () => { return testProject.src() .pipe(newer(run)) .pipe(sourcemaps.init()) - .pipe(tsc(testProject)) + .pipe(testProject()) .pipe(sourcemaps.write(".", { includeContent: false, sourceRoot: "../../" })) - .pipe(gulp.dest(builtLocalDirectory)); + .pipe(gulp.dest(".")); }); const internalTests = "internal/"; @@ -723,16 +722,16 @@ declare module "convert-source-map" { } gulp.task("browserify", "Runs browserify on run.js to produce a file suitable for running tests in the browser", [servicesFile], (done) => { - const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "built/local/bundle.js" }, /*useBuiltCompiler*/ true)); + const testProject = tsc.createProject("src/harness/tsconfig.json", getCompilerSettings({ outFile: "../../built/local/bundle.js" }, /*useBuiltCompiler*/ true)); return testProject.src() .pipe(newer("built/local/bundle.js")) .pipe(sourcemaps.init()) - .pipe(tsc(testProject)) + .pipe(testProject()) .pipe(through2.obj((file, enc, next) => { const originalMap = file.sourceMap; const prebundledContent = file.contents.toString(); // Make paths absolute to help sorcery deal with all the terrible paths being thrown around - originalMap.sources = originalMap.sources.map(s => path.resolve("src", s)); + originalMap.sources = originalMap.sources.map(s => path.resolve(s)); // intoStream (below) makes browserify think the input file is named this, so this is what it puts in the sourcemap originalMap.file = "built/local/_stream_0.js"; diff --git a/src/server/cancellationToken/tsconfig.json b/src/server/cancellationToken/tsconfig.json index 94c81aa644f..1245fc34fd5 100644 --- a/src/server/cancellationToken/tsconfig.json +++ b/src/server/cancellationToken/tsconfig.json @@ -5,7 +5,6 @@ "removeComments": true, "preserveConstEnums": true, "pretty": true, - "outDir": "../../../built/local", "module": "commonjs", "sourceMap": true, "stripInternal": true, diff --git a/src/server/tsconfig.json b/src/server/tsconfig.json index bd9bb14ba41..9e65eb2b8bc 100644 --- a/src/server/tsconfig.json +++ b/src/server/tsconfig.json @@ -5,7 +5,7 @@ "removeComments": true, "preserveConstEnums": true, "pretty": true, - "out": "../../built/local/tsserver.js", + "outFile": "../../built/local/tsserver.js", "sourceMap": true, "stripInternal": true, "types": [ diff --git a/src/server/tsconfig.library.json b/src/server/tsconfig.library.json index 5d4656a318b..a450b591a7e 100644 --- a/src/server/tsconfig.library.json +++ b/src/server/tsconfig.library.json @@ -3,7 +3,7 @@ "noImplicitAny": true, "removeComments": true, "preserveConstEnums": true, - "out": "../../built/local/tsserverlibrary.js", + "outFile": "../../built/local/tsserverlibrary.js", "sourceMap": true, "stripInternal": true, "declaration": true, diff --git a/src/server/typingsInstaller/tsconfig.json b/src/server/typingsInstaller/tsconfig.json index 20b3f5e266c..fc4b896f267 100644 --- a/src/server/typingsInstaller/tsconfig.json +++ b/src/server/typingsInstaller/tsconfig.json @@ -5,7 +5,7 @@ "removeComments": true, "preserveConstEnums": true, "pretty": true, - "out": "../../built/local/typingsInstaller.js", + "outFile": "../../../built/local/typingsInstaller.js", "sourceMap": true, "stripInternal": true, "types": [