build(broccoli): add support for DiffResult#addedPaths
Some plugins want to explicitly know of new paths, so we need to distinguish them from changed paths.
This commit is contained in:
@ -23,16 +23,17 @@ class TSToDartTranspiler implements DiffingBroccoliPlugin {
|
||||
rebuild(treeDiff: DiffResult) {
|
||||
let toEmit = [];
|
||||
let getDartFilePath = (path: string) => path.replace(/((\.js)|(\.ts))$/i, '.dart');
|
||||
treeDiff.changedPaths.forEach((changedPath) => {
|
||||
let inputFilePath = path.resolve(this.inputPath, changedPath);
|
||||
treeDiff.addedPaths.concat(treeDiff.changedPaths)
|
||||
.forEach((changedPath) => {
|
||||
let inputFilePath = path.resolve(this.inputPath, changedPath);
|
||||
|
||||
// Ignore files which don't need to be transpiled to Dart
|
||||
let dartInputFilePath = getDartFilePath(inputFilePath);
|
||||
if (fs.existsSync(dartInputFilePath)) return;
|
||||
// Ignore files which don't need to be transpiled to Dart
|
||||
let dartInputFilePath = getDartFilePath(inputFilePath);
|
||||
if (fs.existsSync(dartInputFilePath)) return;
|
||||
|
||||
// Prepare to rebuild
|
||||
toEmit.push(path.resolve(this.inputPath, changedPath));
|
||||
});
|
||||
// Prepare to rebuild
|
||||
toEmit.push(path.resolve(this.inputPath, changedPath));
|
||||
});
|
||||
|
||||
treeDiff.removedPaths.forEach((removedPath) => {
|
||||
let absolutePath = path.resolve(this.inputPath, removedPath);
|
||||
|
Reference in New Issue
Block a user