Skip to content

Commit

Permalink
debug 4
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Feb 18, 2022
1 parent 6a8fcac commit a7748b2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 0 additions & 6 deletions packages/babel-cli/src/babel/dir.ts
Expand Up @@ -228,12 +228,6 @@ export default async function ({
processing++;
if (startTime === null) startTime = process.hrtime();

if (
filenames.some(filename => filename.endsWith("/module1/src/index.js"))
) {
console.log("./module1/src/index.js is changed");
}

try {
const written = await Promise.all(
filenames.map(filename => handleFile(filename, getBase(filename))),
Expand Down
Expand Up @@ -4,9 +4,11 @@ const assert = require("assert");
// For Node.js <= 10
if (!assert.match) assert.match = (val, re) => assert(re.test(val));

const run = (function* () {
const run = (async function* () {
assert.match(yield, /Successfully compiled 4 files with Babel \(\d+ms\)\./);

// wait 200ms for watcher setup
await new Promise(resolve => setTimeout(resolve, 200));
// update ./module1/src/index.js
fs.writeFileSync(
"./module1/src/index.js",
Expand All @@ -18,13 +20,13 @@ const run = (function* () {

run.next();

process.stdin.on("data", function listener(chunk) {
process.stdin.on("data", async function listener(chunk) {
const str = String(chunk).trim();
if (!str) return;

console.log(str);

if (run.next(str).done) {
if ((await run.next(str)).done) {
process.exit(0);
}
});
Expand Down

0 comments on commit a7748b2

Please sign in to comment.