diff options
author | 2023-04-01 21:13:27 -0700 | |
---|---|---|
committer | 2023-04-01 21:13:27 -0700 | |
commit | fcd8b828644cc3cf2bd46bbfc0f6b90789d5dba2 (patch) | |
tree | 075ad9fc3375a56b71da4ce6625419e5dd10cdba /src/bun.js/repl.exports.js | |
parent | 63d138b0466765e012aaa216ab684b2d39888e64 (diff) | |
download | bun-fcd8b828644cc3cf2bd46bbfc0f6b90789d5dba2.tar.gz bun-fcd8b828644cc3cf2bd46bbfc0f6b90789d5dba2.tar.zst bun-fcd8b828644cc3cf2bd46bbfc0f6b90789d5dba2.zip |
Add stubs for missing node builtins (#2534)
* Stub `node:v8`
* Stub `node:trace_events`
* Stub `node:repl`
* Stub `node:inspector`
* Stub `node:http2`
* Stub `node:diagnostics_channel`
* Stub `node:dgram`
* Stub `node:cluster`
* Link stubs
* cleanup
* Clean up the test
* Implement `node:vm` stub
* Cleanup `v8` module stub
* Add missing `promises` export to node:stream
* Implement `node:stream/promise`
* Implement `node:assert/strict`
* cleanup
* better errors
* Increaase timeout
* Update inspector.exports.js
* Make the version consistent
* Implement `process.binding("constants")`
* Update runner.node.mjs
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/bun.js/repl.exports.js')
-rw-r--r-- | src/bun.js/repl.exports.js | 86 |
1 files changed, 86 insertions, 0 deletions
diff --git a/src/bun.js/repl.exports.js b/src/bun.js/repl.exports.js new file mode 100644 index 000000000..196891fc6 --- /dev/null +++ b/src/bun.js/repl.exports.js @@ -0,0 +1,86 @@ +// This is a stub! None of this is actually implemented yet. +// It only exists to make some packages which import this module work. + +class NotImplementedYet extends Error { + constructor(message = "node:repl is not implemented yet in Bun") { + super(message); + this.name = "NotImplementedYet"; + } +} + +function REPLServer() { + throw new NotImplementedYet("REPLServer is not implemented yet in Bun"); +} + +function Recoverable() { + throw new NotImplementedYet("Recoverable is not implemented yet in Bun"); +} + +var REPL_MODE_SLOPPY = 0, + REPL_MODE_STRICT = 1; + +function start() { + throw new NotImplementedYet(); +} + +var repl = { + [Symbol.for("CommonJS")]: 0, + lines: [], + context: globalThis, + historyIndex: -1, + cursor: 0, + historySize: 1000, + removeHistoryDuplicates: false, + crlfDelay: 100, + completer: () => { + throw new NotImplementedYet(); + }, + history: [], + _initialPrompt: "> ", + terminal: true, + cursor: 0, + input: new Proxy( + {}, + { + get() { + throw new NotImplementedYet(); + }, + has: () => false, + ownKeys: () => [], + getOwnPropertyDescriptor: () => undefined, + set() { + throw new NotImplementedYet(); + }, + }, + ), + line: "", + eval: () => { + throw new NotImplementedYet(); + }, + isCompletionEnabled: true, + escapeCodeTimeout: 500, + tabSize: 8, + breakEvalOnSigint: true, + useGlobal: true, + underscoreAssigned: false, + last: undefined, + _domain: undefined, + allowBlockingCompletions: false, + useColors: true, + output: new Proxy( + {}, + { + get() { + throw new NotImplementedYet(); + }, + has: () => false, + ownKeys: () => [], + getOwnPropertyDescriptor: () => undefined, + set() { + throw new NotImplementedYet(); + }, + }, + ), +}; + +export { repl as default, repl, REPLServer, Recoverable, REPL_MODE_SLOPPY, REPL_MODE_STRICT, start }; |