|
|
|
|
@@ -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";
|
|
|
|
|
|
|
|
|
|
|