提交 d71299fe 编写于 作者: A Alex Dima

Upgrade to gulp4

上级 929177ff
......@@ -80,6 +80,7 @@ const tasks = compilations.map(function (tsconfigFile) {
.pipe(tsFilter)
.pipe(util.loadSourcemaps())
.pipe(compilation())
.pipe(util.toLatestVinylFile())
.pipe(build ? nlsDev.rewriteLocalizeCalls() : es.through())
.pipe(build ? util.stripSourceMappingURL() : es.through())
.pipe(sourcemaps.write('.', {
......
......@@ -58,6 +58,7 @@ function createCompile(src, build, emitError) {
.pipe(tsFilter)
.pipe(util.loadSourcemaps())
.pipe(ts(token))
.pipe(util.toLatestVinylFile())
.pipe(noDeclarationsFilter)
.pipe(build ? nls() : es.through())
.pipe(noDeclarationsFilter.restore)
......
......@@ -66,6 +66,7 @@ function createCompile(src: string, build: boolean, emitError?: boolean): (token
.pipe(tsFilter)
.pipe(util.loadSourcemaps())
.pipe(ts(token))
.pipe(util.toLatestVinylFile())
.pipe(noDeclarationsFilter)
.pipe(build ? nls() : es.through())
.pipe(noDeclarationsFilter.restore)
......
......@@ -11,6 +11,9 @@ declare module "vinyl" {
* A virtual file format.
*/
class File {
public static isVinyl(t: any): t is File;
constructor(options?: {
/**
* Default: process.cwd()
......
......@@ -98,6 +98,18 @@ function skipDirectories() {
});
}
exports.skipDirectories = skipDirectories;
/**
* gulp does not like anything except the latest VinylFile (it checks for VinylFile.isVinyl)
*/
function toLatestVinylFile() {
return es.mapSync(f => {
if (VinylFile.isVinyl(f)) {
return f;
}
return new VinylFile(f);
});
}
exports.toLatestVinylFile = toLatestVinylFile;
function cleanNodeModule(name, excludes, includes) {
const toGlob = (path) => '**/node_modules/' + name + (path ? '/' + path : '');
const negate = (str) => '!' + str;
......
......@@ -129,6 +129,18 @@ export function skipDirectories(): NodeJS.ReadWriteStream {
});
}
/**
* gulp does not like anything except the latest VinylFile (it checks for VinylFile.isVinyl)
*/
export function toLatestVinylFile(): NodeJS.ReadWriteStream {
return es.mapSync<VinylFile, VinylFile>(f => {
if (VinylFile.isVinyl(f)) {
return f;
}
return new VinylFile(f);
});
}
export function cleanNodeModule(name: string, excludes: string[], includes?: string[]): NodeJS.ReadWriteStream {
const toGlob = (path: string) => '**/node_modules/' + name + (path ? '/' + path : '');
const negate = (str: string) => '!' + str;
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册