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/trace_events.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/trace_events.exports.js')
-rw-r--r-- | src/bun.js/trace_events.exports.js | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/bun.js/trace_events.exports.js b/src/bun.js/trace_events.exports.js new file mode 100644 index 000000000..44ee28203 --- /dev/null +++ b/src/bun.js/trace_events.exports.js @@ -0,0 +1,33 @@ +// This is a stub! This is not actually implemented yet. + +class Tracing { + enabled = false; + categories = ""; +} + +function ERR_INVALID_ARG_TYPE(name, type, value) { + const err = new TypeError(`The "${name}" argument must be of type ${type}. Received ${value}`); + err.code = "ERR_INVALID_ARG_TYPE"; + return err; +} + +function createTracing(opts) { + if (typeof opts !== "object" || opts == null) { + throw new ERR_INVALID_ARG_TYPE("options", "Object", opts); + } + + // TODO: validate categories + return new Tracing(opts); +} + +function getEnabledCategories() { + return ""; +} + +var defaultObject = { + createTracing, + getEnabledCategories, + [Symbol.for("CommonJS")]: 0, +}; + +export { defaultObject as default, createTracing, getEnabledCategories }; |