@babel/cli
Advanced tools
Comparing version 7.18.6 to 7.18.9
@@ -267,2 +267,3 @@ "use strict"; | ||
}); | ||
watcher.startWatcher(); | ||
watcher.onFilesChange(_asyncToGenerator(function* (filenames) { | ||
@@ -269,0 +270,0 @@ processing++; |
@@ -248,2 +248,3 @@ "use strict"; | ||
filenames.forEach(watcher.watch); | ||
watcher.startWatcher(); | ||
watcher.onFilesChange((changes, event, cause) => { | ||
@@ -250,0 +251,0 @@ const actionableChange = changes.some(filename => util.isCompilableExtension(filename, cliOptions.extensions) || filenames.includes(filename)); |
@@ -126,3 +126,3 @@ "use strict"; | ||
_commander().version("7.18.6" + " (@babel/core " + _core().version + ")"); | ||
_commander().version("7.18.9" + " (@babel/core " + _core().version + ")"); | ||
@@ -129,0 +129,0 @@ _commander().usage("[options] <files ...>"); |
@@ -8,2 +8,3 @@ "use strict"; | ||
exports.onFilesChange = onFilesChange; | ||
exports.startWatcher = startWatcher; | ||
exports.updateExternalDependencies = updateExternalDependencies; | ||
@@ -36,2 +37,4 @@ exports.watch = watch; | ||
let watcher; | ||
const watchQueue = new Set(); | ||
let hasStarted = false; | ||
@@ -57,2 +60,15 @@ function enable({ | ||
function startWatcher() { | ||
hasStarted = true; | ||
for (const dep of watchQueue) { | ||
watcher.add(dep); | ||
} | ||
watchQueue.clear(); | ||
watcher.on("ready", () => { | ||
console.log("The watcher is ready."); | ||
}); | ||
} | ||
function watch(filename) { | ||
@@ -63,3 +79,7 @@ if (!isWatchMode) { | ||
watcher.add(_path().resolve(filename)); | ||
if (!hasStarted) { | ||
watchQueue.add(_path().resolve(filename)); | ||
} else { | ||
watcher.add(_path().resolve(filename)); | ||
} | ||
} | ||
@@ -101,3 +121,8 @@ | ||
depToFiles.set(dep, new Set()); | ||
watcher.add(dep); | ||
if (!hasStarted) { | ||
watchQueue.add(dep); | ||
} else { | ||
watcher.add(dep); | ||
} | ||
} | ||
@@ -116,3 +141,8 @@ | ||
depToFiles.delete(dep); | ||
watcher.unwatch(dep); | ||
if (!hasStarted) { | ||
watchQueue.delete(dep); | ||
} else { | ||
watcher.unwatch(dep); | ||
} | ||
} | ||
@@ -119,0 +149,0 @@ } |
{ | ||
"name": "@babel/cli", | ||
"version": "7.18.6", | ||
"version": "7.18.9", | ||
"description": "Babel command line.", | ||
@@ -43,3 +43,3 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"devDependencies": { | ||
"@babel/core": "^7.18.6", | ||
"@babel/core": "^7.18.9", | ||
"@babel/helper-fixtures": "^7.18.6", | ||
@@ -46,0 +46,0 @@ "rimraf": "^3.0.0" |
37054
963