-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
55 changed files
with
304 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env node | ||
|
||
import dev from '../lib/index.js'; | ||
import cli from '../lib/cli.js'; | ||
|
||
const { script, scriptArgs, nodeArgs, opts } = cli(process.argv); | ||
|
||
dev(script, scriptArgs, nodeArgs, opts); |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
const control = '\u001bc'; | ||
const clearFactory = clear => (clear ? () => process.stdout.write(control) : () => {}); | ||
|
||
module.exports = { clearFactory, control }; | ||
export const control = '\u001bc'; | ||
export const clearFactory = clear => (clear ? () => process.stdout.write(control) : () => {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "commonjs" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const childProcess = require('child_process'); | ||
const { relay } = require('../ipc.cjs'); | ||
|
||
// Overwrite child_process.fork() so that we can hook into forked processes | ||
// too. We also need to relay messages about required files to the parent. | ||
const { fork } = childProcess; | ||
childProcess.fork = (modulePath, args, options) => { | ||
const child = fork(modulePath, args, options); | ||
relay(child); | ||
return child; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const vm = require('vm'); | ||
const { send } = require('../ipc.cjs'); | ||
|
||
patch(vm, 'createScript', 1); | ||
patch(vm, 'runInThisContext', 1); | ||
patch(vm, 'runInNewContext', 2); | ||
patch(vm, 'runInContext', 2); | ||
|
||
/** | ||
* Patch the specified method to watch the file at the given argument | ||
* index. | ||
*/ | ||
function patch(obj, method, optionsArgIndex) { | ||
const orig = obj[method]; | ||
if (!orig) return; | ||
obj[method] = function () { | ||
const opts = arguments[optionsArgIndex]; | ||
let file = null; | ||
if (opts) { | ||
file = typeof opts === 'string' ? opts : opts.filename; | ||
} | ||
if (file) send({ required: file }); | ||
return orig.apply(this, arguments); | ||
}; | ||
} |
Oops, something went wrong.