@travetto/compiler
Advanced tools
Comparing version 0.0.25 to 0.0.26
@@ -22,3 +22,3 @@ { | ||
"scripts": {}, | ||
"version": "0.0.25" | ||
"version": "0.0.26" | ||
} |
@@ -16,2 +16,3 @@ import { Watcher, Entry, AppEnv, Handler, findAppFilesByExt } from '@travetto/base'; | ||
files = new Map<string, { version: number }>(); | ||
seen = new Set(); | ||
@@ -35,3 +36,3 @@ constructor(private cwd: string, private listener: Listener, private excludeFiles: RegExp[], private watch: boolean = AppEnv.watch) { | ||
if (this.watch) { | ||
this.buildWatcher(`${this.cwd}/src`, [{ testFile: x => this.validFile(x) && /.*[.]ts$/.test(x) }]); | ||
this.buildWatcher(`${this.cwd}/src`, [{ testFile: x => this.validFile(x) && x.endsWith('.ts') }]); | ||
} | ||
@@ -54,10 +55,16 @@ } | ||
addNewFile(name: string) { | ||
if (this.seen.has(name)) { | ||
return; | ||
} | ||
this.seen.add(name); | ||
console.log('Adding New File', name); | ||
if (this.watch) { | ||
const topLevel = name.split(`${this.cwd}/`)[1].split('/')[0]; | ||
const topLevel = path.dirname(name); | ||
if (this.fileWatchers[topLevel]) { | ||
this.fileWatchers[topLevel].add([name]); | ||
} else { | ||
this.buildWatcher(`${this.cwd}/src`, [{ testFile: x => this.validFile(x) && x.endsWith('.ts') }]); | ||
if (!this.fileWatchers[topLevel]) { | ||
this.fileWatchers[topLevel] = this.buildWatcher(topLevel, []); | ||
} | ||
this.fileWatchers[topLevel].add([name.replace(`${topLevel}/`, '')]); | ||
} | ||
@@ -111,3 +118,3 @@ this.files.set(name, { version: 0 }); | ||
} | ||
this.seen.clear(); | ||
this.files.clear(); | ||
@@ -114,0 +121,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26669
730