@volter/tabnode 0.2.14-volter.88
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +22 -0
- package/README.md +78 -0
- package/THIRD-PARTY-NOTICES.md +12 -0
- package/dist/__sw__.js +526 -0
- package/dist/assets/runtime-worker-4MKaHFVb.js +75221 -0
- package/dist/assets/runtime-worker-4MKaHFVb.js.map +1 -0
- package/dist/code-transforms.d.ts +21 -0
- package/dist/code-transforms.d.ts.map +1 -0
- package/dist/config/cdn.d.ts +12 -0
- package/dist/config/cdn.d.ts.map +1 -0
- package/dist/create-runtime.d.ts +22 -0
- package/dist/create-runtime.d.ts.map +1 -0
- package/dist/host-globals.d.ts +62 -0
- package/dist/host-globals.d.ts.map +1 -0
- package/dist/index.cjs +36021 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +127 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +36020 -0
- package/dist/index.mjs.map +1 -0
- package/dist/node-internals.d.ts +68 -0
- package/dist/node-internals.d.ts.map +1 -0
- package/dist/node-lib/binding/blob.d.ts +12 -0
- package/dist/node-lib/binding/blob.d.ts.map +1 -0
- package/dist/node-lib/binding/buffer.d.ts +144 -0
- package/dist/node-lib/binding/buffer.d.ts.map +1 -0
- package/dist/node-lib/binding/cares_wrap.d.ts +14 -0
- package/dist/node-lib/binding/cares_wrap.d.ts.map +1 -0
- package/dist/node-lib/binding/fds.d.ts +30 -0
- package/dist/node-lib/binding/fds.d.ts.map +1 -0
- package/dist/node-lib/binding/fs.d.ts +157 -0
- package/dist/node-lib/binding/fs.d.ts.map +1 -0
- package/dist/node-lib/binding/handles.d.ts +81 -0
- package/dist/node-lib/binding/handles.d.ts.map +1 -0
- package/dist/node-lib/binding/http_parser.d.ts +122 -0
- package/dist/node-lib/binding/http_parser.d.ts.map +1 -0
- package/dist/node-lib/binding/index.d.ts +3 -0
- package/dist/node-lib/binding/index.d.ts.map +1 -0
- package/dist/node-lib/binding/llhttp-wasm.d.ts +22 -0
- package/dist/node-lib/binding/llhttp-wasm.d.ts.map +1 -0
- package/dist/node-lib/binding/misc.d.ts +123 -0
- package/dist/node-lib/binding/misc.d.ts.map +1 -0
- package/dist/node-lib/binding/pipe_wrap.d.ts +84 -0
- package/dist/node-lib/binding/pipe_wrap.d.ts.map +1 -0
- package/dist/node-lib/binding/process_wrap.d.ts +173 -0
- package/dist/node-lib/binding/process_wrap.d.ts.map +1 -0
- package/dist/node-lib/binding/spawn_sync.d.ts +30 -0
- package/dist/node-lib/binding/spawn_sync.d.ts.map +1 -0
- package/dist/node-lib/binding/stream_wrap.d.ts +191 -0
- package/dist/node-lib/binding/stream_wrap.d.ts.map +1 -0
- package/dist/node-lib/binding/stubs.d.ts +23 -0
- package/dist/node-lib/binding/stubs.d.ts.map +1 -0
- package/dist/node-lib/binding/tcp_wrap.d.ts +98 -0
- package/dist/node-lib/binding/tcp_wrap.d.ts.map +1 -0
- package/dist/node-lib/binding/tty_wrap.d.ts +36 -0
- package/dist/node-lib/binding/tty_wrap.d.ts.map +1 -0
- package/dist/node-lib/binding/util.d.ts +126 -0
- package/dist/node-lib/binding/util.d.ts.map +1 -0
- package/dist/node-lib/binding/uv.d.ts +32 -0
- package/dist/node-lib/binding/uv.d.ts.map +1 -0
- package/dist/node-lib/binding/zlib-pako.d.ts +22 -0
- package/dist/node-lib/binding/zlib-pako.d.ts.map +1 -0
- package/dist/node-lib/binding/zlib.d.ts +38 -0
- package/dist/node-lib/binding/zlib.d.ts.map +1 -0
- package/dist/node-lib/buffer-module.d.ts +51 -0
- package/dist/node-lib/buffer-module.d.ts.map +1 -0
- package/dist/node-lib/child-process-module.d.ts +26 -0
- package/dist/node-lib/child-process-module.d.ts.map +1 -0
- package/dist/node-lib/events-module.d.ts +58 -0
- package/dist/node-lib/events-module.d.ts.map +1 -0
- package/dist/node-lib/fs-module.d.ts +5 -0
- package/dist/node-lib/fs-module.d.ts.map +1 -0
- package/dist/node-lib/http-bridge.d.ts +43 -0
- package/dist/node-lib/http-bridge.d.ts.map +1 -0
- package/dist/node-lib/http-module.d.ts +35 -0
- package/dist/node-lib/http-module.d.ts.map +1 -0
- package/dist/node-lib/internals/addresses.d.ts +40 -0
- package/dist/node-lib/internals/addresses.d.ts.map +1 -0
- package/dist/node-lib/internals/buffer-and-streams.d.ts +96 -0
- package/dist/node-lib/internals/buffer-and-streams.d.ts.map +1 -0
- package/dist/node-lib/internals/child-process.d.ts +27 -0
- package/dist/node-lib/internals/child-process.d.ts.map +1 -0
- package/dist/node-lib/internals/events-util.d.ts +83 -0
- package/dist/node-lib/internals/events-util.d.ts.map +1 -0
- package/dist/node-lib/internals/index.d.ts +2 -0
- package/dist/node-lib/internals/index.d.ts.map +1 -0
- package/dist/node-lib/internals/modules.d.ts +67 -0
- package/dist/node-lib/internals/modules.d.ts.map +1 -0
- package/dist/node-lib/internals/readline-access.d.ts +2 -0
- package/dist/node-lib/internals/readline-access.d.ts.map +1 -0
- package/dist/node-lib/internals/runtime.d.ts +150 -0
- package/dist/node-lib/internals/runtime.d.ts.map +1 -0
- package/dist/node-lib/internals/util.d.ts +33 -0
- package/dist/node-lib/internals/util.d.ts.map +1 -0
- package/dist/node-lib/lazy.d.ts +31 -0
- package/dist/node-lib/lazy.d.ts.map +1 -0
- package/dist/node-lib/load.d.ts +27 -0
- package/dist/node-lib/load.d.ts.map +1 -0
- package/dist/node-lib/module-hooks.d.ts +89 -0
- package/dist/node-lib/module-hooks.d.ts.map +1 -0
- package/dist/node-lib/net-module.d.ts +181 -0
- package/dist/node-lib/net-module.d.ts.map +1 -0
- package/dist/node-lib/node-versions.d.ts +27 -0
- package/dist/node-lib/node-versions.d.ts.map +1 -0
- package/dist/node-lib/public-modules.d.ts +2 -0
- package/dist/node-lib/public-modules.d.ts.map +1 -0
- package/dist/node-lib/require-hook.d.ts +15 -0
- package/dist/node-lib/require-hook.d.ts.map +1 -0
- package/dist/node-lib/small-modules.d.ts +16 -0
- package/dist/node-lib/small-modules.d.ts.map +1 -0
- package/dist/node-lib/sources.d.ts +4 -0
- package/dist/node-lib/sources.d.ts.map +1 -0
- package/dist/node-lib/stream-module.d.ts +77 -0
- package/dist/node-lib/stream-module.d.ts.map +1 -0
- package/dist/node-lib/timers.d.ts +19 -0
- package/dist/node-lib/timers.d.ts.map +1 -0
- package/dist/node-lib/util-module.d.ts +76 -0
- package/dist/node-lib/util-module.d.ts.map +1 -0
- package/dist/node-resolution.d.ts +50 -0
- package/dist/node-resolution.d.ts.map +1 -0
- package/dist/node-resolver.d.ts +7 -0
- package/dist/node-resolver.d.ts.map +1 -0
- package/dist/npm/index.d.ts +73 -0
- package/dist/npm/index.d.ts.map +1 -0
- package/dist/npm/registry.d.ts +111 -0
- package/dist/npm/registry.d.ts.map +1 -0
- package/dist/npm/resolver.d.ts +79 -0
- package/dist/npm/resolver.d.ts.map +1 -0
- package/dist/npm/tarball.d.ts +28 -0
- package/dist/npm/tarball.d.ts.map +1 -0
- package/dist/process-tokens.d.ts +77 -0
- package/dist/process-tokens.d.ts.map +1 -0
- package/dist/punycode-source.d.ts +3 -0
- package/dist/punycode-source.d.ts.map +1 -0
- package/dist/runtime-interface.d.ts +74 -0
- package/dist/runtime-interface.d.ts.map +1 -0
- package/dist/runtime.d.ts +144 -0
- package/dist/runtime.d.ts.map +1 -0
- package/dist/server-bridge.d.ts +147 -0
- package/dist/server-bridge.d.ts.map +1 -0
- package/dist/shims/async_hooks.d.ts +50 -0
- package/dist/shims/async_hooks.d.ts.map +1 -0
- package/dist/shims/child_process.d.ts +104 -0
- package/dist/shims/child_process.d.ts.map +1 -0
- package/dist/shims/cluster.d.ts +52 -0
- package/dist/shims/cluster.d.ts.map +1 -0
- package/dist/shims/command-line.d.ts +43 -0
- package/dist/shims/command-line.d.ts.map +1 -0
- package/dist/shims/constants.d.ts +222 -0
- package/dist/shims/constants.d.ts.map +1 -0
- package/dist/shims/crypto-constants.d.ts +12 -0
- package/dist/shims/crypto-constants.d.ts.map +1 -0
- package/dist/shims/crypto.d.ts +144 -0
- package/dist/shims/crypto.d.ts.map +1 -0
- package/dist/shims/dgram.d.ts +34 -0
- package/dist/shims/dgram.d.ts.map +1 -0
- package/dist/shims/dns.d.ts +91 -0
- package/dist/shims/dns.d.ts.map +1 -0
- package/dist/shims/domain.d.ts +25 -0
- package/dist/shims/domain.d.ts.map +1 -0
- package/dist/shims/esbuild.d.ts +205 -0
- package/dist/shims/esbuild.d.ts.map +1 -0
- package/dist/shims/fs.d.ts +25 -0
- package/dist/shims/fs.d.ts.map +1 -0
- package/dist/shims/http2.d.ts +81 -0
- package/dist/shims/http2.d.ts.map +1 -0
- package/dist/shims/inspector.d.ts +25 -0
- package/dist/shims/inspector.d.ts.map +1 -0
- package/dist/shims/module.d.ts +22 -0
- package/dist/shims/module.d.ts.map +1 -0
- package/dist/shims/os.d.ts +159 -0
- package/dist/shims/os.d.ts.map +1 -0
- package/dist/shims/path.d.ts +52 -0
- package/dist/shims/path.d.ts.map +1 -0
- package/dist/shims/perf_hooks.d.ts +50 -0
- package/dist/shims/perf_hooks.d.ts.map +1 -0
- package/dist/shims/process.d.ts +226 -0
- package/dist/shims/process.d.ts.map +1 -0
- package/dist/shims/rollup.d.ts +71 -0
- package/dist/shims/rollup.d.ts.map +1 -0
- package/dist/shims/string_decoder.d.ts +41 -0
- package/dist/shims/string_decoder.d.ts.map +1 -0
- package/dist/shims/sync-child.d.ts +64 -0
- package/dist/shims/sync-child.d.ts.map +1 -0
- package/dist/shims/tls.d.ts +53 -0
- package/dist/shims/tls.d.ts.map +1 -0
- package/dist/shims/url.d.ts +84 -0
- package/dist/shims/url.d.ts.map +1 -0
- package/dist/shims/v8.d.ts +73 -0
- package/dist/shims/v8.d.ts.map +1 -0
- package/dist/shims/vfs-adapter.d.ts +126 -0
- package/dist/shims/vfs-adapter.d.ts.map +1 -0
- package/dist/shims/vm.d.ts +52 -0
- package/dist/shims/vm.d.ts.map +1 -0
- package/dist/shims/wasi.d.ts +78 -0
- package/dist/shims/wasi.d.ts.map +1 -0
- package/dist/shims/worker_threads.d.ts +66 -0
- package/dist/shims/worker_threads.d.ts.map +1 -0
- package/dist/shims/zlib-constants.d.ts +66 -0
- package/dist/shims/zlib-constants.d.ts.map +1 -0
- package/dist/shims/zlib.d.ts +102 -0
- package/dist/shims/zlib.d.ts.map +1 -0
- package/dist/transform.d.ts +24 -0
- package/dist/transform.d.ts.map +1 -0
- package/dist/types/package-json.d.ts +18 -0
- package/dist/types/package-json.d.ts.map +1 -0
- package/dist/utils/binary-encoding.d.ts +13 -0
- package/dist/utils/binary-encoding.d.ts.map +1 -0
- package/dist/utils/glob.d.ts +19 -0
- package/dist/utils/glob.d.ts.map +1 -0
- package/dist/utils/hash.d.ts +6 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/virtual-fs.d.ts +259 -0
- package/dist/virtual-fs.d.ts.map +1 -0
- package/dist/vite-plugin.cjs +50 -0
- package/dist/vite-plugin.cjs.map +1 -0
- package/dist/vite-plugin.d.ts +36 -0
- package/dist/vite-plugin.d.ts.map +1 -0
- package/dist/vite-plugin.mjs +31 -0
- package/dist/vite-plugin.mjs.map +1 -0
- package/dist/worker/runtime-worker.d.ts +8 -0
- package/dist/worker/runtime-worker.d.ts.map +1 -0
- package/dist/worker-runtime.d.ts +50 -0
- package/dist/worker-runtime.d.ts.map +1 -0
- package/package.json +88 -0
- package/src/code-transforms.ts +560 -0
- package/src/config/cdn.ts +13 -0
- package/src/create-runtime.ts +89 -0
- package/src/host-globals.ts +121 -0
- package/src/index.ts +235 -0
- package/src/node-internals.ts +283 -0
- package/src/node-lib/LICENSE +47 -0
- package/src/node-lib/_http_agent.js +547 -0
- package/src/node-lib/_http_client.js +996 -0
- package/src/node-lib/_http_common.js +269 -0
- package/src/node-lib/_http_incoming.js +453 -0
- package/src/node-lib/_http_outgoing.js +1262 -0
- package/src/node-lib/_http_server.js +1230 -0
- package/src/node-lib/assert/strict.js +3 -0
- package/src/node-lib/assert.js +844 -0
- package/src/node-lib/binding/blob.ts +35 -0
- package/src/node-lib/binding/buffer.ts +465 -0
- package/src/node-lib/binding/cares_wrap.ts +57 -0
- package/src/node-lib/binding/fds.ts +80 -0
- package/src/node-lib/binding/fs.ts +857 -0
- package/src/node-lib/binding/handles.ts +187 -0
- package/src/node-lib/binding/http_parser.ts +536 -0
- package/src/node-lib/binding/index.ts +77 -0
- package/src/node-lib/binding/llhttp-wasm.ts +670 -0
- package/src/node-lib/binding/misc.ts +252 -0
- package/src/node-lib/binding/pipe_wrap.ts +166 -0
- package/src/node-lib/binding/process_wrap.ts +371 -0
- package/src/node-lib/binding/spawn_sync.ts +141 -0
- package/src/node-lib/binding/stream_wrap.ts +413 -0
- package/src/node-lib/binding/stubs.ts +19 -0
- package/src/node-lib/binding/tcp_wrap.ts +254 -0
- package/src/node-lib/binding/tty_wrap.ts +56 -0
- package/src/node-lib/binding/util.ts +274 -0
- package/src/node-lib/binding/uv.ts +102 -0
- package/src/node-lib/binding/zlib-pako.ts +50 -0
- package/src/node-lib/binding/zlib.ts +259 -0
- package/src/node-lib/buffer-module.ts +70 -0
- package/src/node-lib/buffer.js +1373 -0
- package/src/node-lib/child-process-module.ts +58 -0
- package/src/node-lib/child_process.js +1046 -0
- package/src/node-lib/constants.js +41 -0
- package/src/node-lib/diagnostics_channel.js +438 -0
- package/src/node-lib/events-module.ts +80 -0
- package/src/node-lib/events.js +1223 -0
- package/src/node-lib/fs-module.ts +43 -0
- package/src/node-lib/fs.js +3377 -0
- package/src/node-lib/http-bridge.ts +299 -0
- package/src/node-lib/http-module.ts +53 -0
- package/src/node-lib/http.js +198 -0
- package/src/node-lib/https.js +429 -0
- package/src/node-lib/internal/assert/assertion_error.js +417 -0
- package/src/node-lib/internal/assert/calltracker.js +153 -0
- package/src/node-lib/internal/assert/myers_diff.js +177 -0
- package/src/node-lib/internal/assert/utils.js +278 -0
- package/src/node-lib/internal/buffer.js +1120 -0
- package/src/node-lib/internal/child_process/serialization.js +169 -0
- package/src/node-lib/internal/child_process.js +1135 -0
- package/src/node-lib/internal/constants.js +56 -0
- package/src/node-lib/internal/deps/minimatch/index.js +1628 -0
- package/src/node-lib/internal/errors.js +1912 -0
- package/src/node-lib/internal/events/abort_listener.js +54 -0
- package/src/node-lib/internal/events/symbols.js +11 -0
- package/src/node-lib/internal/fixed_queue.js +119 -0
- package/src/node-lib/internal/freelist.js +30 -0
- package/src/node-lib/internal/fs/cp/cp-sync.js +242 -0
- package/src/node-lib/internal/fs/cp/cp.js +382 -0
- package/src/node-lib/internal/fs/dir.js +369 -0
- package/src/node-lib/internal/fs/glob.js +763 -0
- package/src/node-lib/internal/fs/promises.js +1312 -0
- package/src/node-lib/internal/fs/read/context.js +129 -0
- package/src/node-lib/internal/fs/recursive_watch.js +275 -0
- package/src/node-lib/internal/fs/rimraf.js +311 -0
- package/src/node-lib/internal/fs/streams.js +571 -0
- package/src/node-lib/internal/fs/sync_write_stream.js +49 -0
- package/src/node-lib/internal/fs/utils.js +987 -0
- package/src/node-lib/internal/fs/watchers.js +418 -0
- package/src/node-lib/internal/http.js +62 -0
- package/src/node-lib/internal/mime.js +389 -0
- package/src/node-lib/internal/modules/customization_hooks.js +406 -0
- package/src/node-lib/internal/net.js +95 -0
- package/src/node-lib/internal/querystring.js +119 -0
- package/src/node-lib/internal/readline/callbacks.js +132 -0
- package/src/node-lib/internal/readline/emitKeypressEvents.js +99 -0
- package/src/node-lib/internal/readline/interface.js +1418 -0
- package/src/node-lib/internal/readline/promises.js +144 -0
- package/src/node-lib/internal/readline/utils.js +405 -0
- package/src/node-lib/internal/socket_list.js +108 -0
- package/src/node-lib/internal/stream_base_commons.js +280 -0
- package/src/node-lib/internal/streams/add-abort-signal.js +60 -0
- package/src/node-lib/internal/streams/compose.js +257 -0
- package/src/node-lib/internal/streams/destroy.js +361 -0
- package/src/node-lib/internal/streams/duplex.js +203 -0
- package/src/node-lib/internal/streams/duplexify.js +379 -0
- package/src/node-lib/internal/streams/duplexpair.js +62 -0
- package/src/node-lib/internal/streams/end-of-stream.js +331 -0
- package/src/node-lib/internal/streams/from.js +208 -0
- package/src/node-lib/internal/streams/lazy_transform.js +57 -0
- package/src/node-lib/internal/streams/legacy.js +125 -0
- package/src/node-lib/internal/streams/operators.js +436 -0
- package/src/node-lib/internal/streams/passthrough.js +47 -0
- package/src/node-lib/internal/streams/pipeline.js +465 -0
- package/src/node-lib/internal/streams/readable.js +1762 -0
- package/src/node-lib/internal/streams/state.js +51 -0
- package/src/node-lib/internal/streams/transform.js +204 -0
- package/src/node-lib/internal/streams/utils.js +363 -0
- package/src/node-lib/internal/streams/writable.js +1163 -0
- package/src/node-lib/internal/tty.js +260 -0
- package/src/node-lib/internal/util/colors.js +40 -0
- package/src/node-lib/internal/util/comparisons.js +1028 -0
- package/src/node-lib/internal/util/debuglog.js +524 -0
- package/src/node-lib/internal/util/inspect.js +2535 -0
- package/src/node-lib/internal/util/parse_args/parse_args.js +412 -0
- package/src/node-lib/internal/util/parse_args/utils.js +197 -0
- package/src/node-lib/internal/util.js +1003 -0
- package/src/node-lib/internal/validators.js +654 -0
- package/src/node-lib/internals/addresses.ts +159 -0
- package/src/node-lib/internals/buffer-and-streams.ts +224 -0
- package/src/node-lib/internals/child-process.ts +64 -0
- package/src/node-lib/internals/events-util.ts +105 -0
- package/src/node-lib/internals/index.ts +66 -0
- package/src/node-lib/internals/modules.ts +117 -0
- package/src/node-lib/internals/readline-access.ts +16 -0
- package/src/node-lib/internals/runtime.ts +277 -0
- package/src/node-lib/internals/util.ts +98 -0
- package/src/node-lib/lazy.ts +158 -0
- package/src/node-lib/load.ts +390 -0
- package/src/node-lib/module-hooks.ts +281 -0
- package/src/node-lib/net-module.ts +248 -0
- package/src/node-lib/net.js +2540 -0
- package/src/node-lib/node-versions.ts +34 -0
- package/src/node-lib/os.js +356 -0
- package/src/node-lib/path.js +1694 -0
- package/src/node-lib/primordials.js +743 -0
- package/src/node-lib/public-modules.ts +109 -0
- package/src/node-lib/punycode.js +455 -0
- package/src/node-lib/querystring.js +484 -0
- package/src/node-lib/readline/promises.js +73 -0
- package/src/node-lib/readline.js +523 -0
- package/src/node-lib/require-hook.ts +27 -0
- package/src/node-lib/small-modules.ts +35 -0
- package/src/node-lib/sources.ts +200 -0
- package/src/node-lib/stream/promises.js +44 -0
- package/src/node-lib/stream-module.ts +101 -0
- package/src/node-lib/stream.js +152 -0
- package/src/node-lib/timers.ts +33 -0
- package/src/node-lib/tty.js +168 -0
- package/src/node-lib/util-module.ts +104 -0
- package/src/node-lib/util.js +689 -0
- package/src/node-lib/wasi.js +179 -0
- package/src/node-lib/zlib.js +1036 -0
- package/src/node-resolution.ts +241 -0
- package/src/node-resolver.ts +33 -0
- package/src/npm/index.ts +425 -0
- package/src/npm/registry.ts +235 -0
- package/src/npm/resolver.ts +589 -0
- package/src/npm/tarball.ts +246 -0
- package/src/process-tokens.ts +156 -0
- package/src/punycode-source.ts +6 -0
- package/src/runtime-interface.ts +85 -0
- package/src/runtime.ts +3073 -0
- package/src/server-bridge.ts +971 -0
- package/src/shims/async_hooks.ts +181 -0
- package/src/shims/child_process.ts +1591 -0
- package/src/shims/cluster.ts +79 -0
- package/src/shims/command-line.ts +79 -0
- package/src/shims/constants.ts +68 -0
- package/src/shims/crypto-constants.ts +11 -0
- package/src/shims/crypto.ts +1061 -0
- package/src/shims/dgram.ts +47 -0
- package/src/shims/dns.ts +185 -0
- package/src/shims/domain.ts +58 -0
- package/src/shims/esbuild.ts +1638 -0
- package/src/shims/fs.ts +82 -0
- package/src/shims/http2.ts +96 -0
- package/src/shims/inspector.ts +30 -0
- package/src/shims/module.ts +86 -0
- package/src/shims/os.ts +195 -0
- package/src/shims/path.ts +246 -0
- package/src/shims/perf_hooks.ts +92 -0
- package/src/shims/process.ts +804 -0
- package/src/shims/rollup.ts +149 -0
- package/src/shims/string_decoder.ts +396 -0
- package/src/shims/sync-child.ts +469 -0
- package/src/shims/tls.ts +94 -0
- package/src/shims/url.ts +217 -0
- package/src/shims/v8.ts +113 -0
- package/src/shims/vfs-adapter.ts +408 -0
- package/src/shims/vm.ts +132 -0
- package/src/shims/wasi.ts +1440 -0
- package/src/shims/worker_threads.ts +114 -0
- package/src/shims/zlib-constants.ts +65 -0
- package/src/shims/zlib.ts +228 -0
- package/src/transform.ts +324 -0
- package/src/types/external.d.ts +55 -0
- package/src/types/package-json.ts +17 -0
- package/src/types/pako-zlib.d.ts +30 -0
- package/src/types/sha.js.d.ts +14 -0
- package/src/utils/binary-encoding.ts +43 -0
- package/src/utils/glob.ts +54 -0
- package/src/utils/hash.ts +12 -0
- package/src/virtual-fs.ts +1048 -0
- package/src/vite-plugin.ts +76 -0
- package/src/worker/runtime-worker.ts +128 -0
- package/src/worker-runtime.ts +145 -0
|
@@ -0,0 +1,804 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node.js process shim
|
|
3
|
+
* Provides minimal process object for browser environment
|
|
4
|
+
* Process is an EventEmitter in Node.js
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { EventEmitter } from '../node-lib/events-module';
|
|
8
|
+
import type { EventListener } from '../node-lib/events-module';
|
|
9
|
+
import { Readable } from '../node-lib/stream-module';
|
|
10
|
+
import { constantsBinding } from './constants';
|
|
11
|
+
import { mintPid, pidIsLive } from '../process-tokens';
|
|
12
|
+
import { NODE_LTS_VERSION, nodeVersions } from '../node-lib/node-versions';
|
|
13
|
+
import { freemem as osFreemem } from './os';
|
|
14
|
+
|
|
15
|
+
export interface ProcessEnv {
|
|
16
|
+
[key: string]: string | undefined;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
// Stream-like interface with EventEmitter methods
|
|
20
|
+
interface ProcessStream {
|
|
21
|
+
isTTY: boolean;
|
|
22
|
+
on: (event: string, listener: EventListener) => ProcessStream;
|
|
23
|
+
once: (event: string, listener: EventListener) => ProcessStream;
|
|
24
|
+
off: (event: string, listener: EventListener) => ProcessStream;
|
|
25
|
+
emit: (event: string, ...args: unknown[]) => boolean;
|
|
26
|
+
addListener: (event: string, listener: EventListener) => ProcessStream;
|
|
27
|
+
removeListener: (event: string, listener: EventListener) => ProcessStream;
|
|
28
|
+
removeAllListeners: (event?: string) => ProcessStream;
|
|
29
|
+
setMaxListeners: (n: number) => ProcessStream;
|
|
30
|
+
getMaxListeners: () => number;
|
|
31
|
+
listenerCount: (event: string) => number;
|
|
32
|
+
listeners: (event: string) => EventListener[];
|
|
33
|
+
rawListeners: (event: string) => EventListener[];
|
|
34
|
+
prependListener: (event: string, listener: EventListener) => ProcessStream;
|
|
35
|
+
prependOnceListener: (event: string, listener: EventListener) => ProcessStream;
|
|
36
|
+
eventNames: () => (string | symbol)[];
|
|
37
|
+
pause?: () => ProcessStream;
|
|
38
|
+
resume?: () => ProcessStream;
|
|
39
|
+
// nodemon pipes the parent's stdin into its fork and unpipes it on exit; a
|
|
40
|
+
// stream without these was no stream at all. A pipe hands the destination
|
|
41
|
+
// back, as Node's does, and carries nothing.
|
|
42
|
+
pipe: (destination: unknown) => unknown;
|
|
43
|
+
unpipe: () => ProcessStream;
|
|
44
|
+
isPaused: () => boolean;
|
|
45
|
+
unshift: () => void;
|
|
46
|
+
setEncoding?: (encoding: string) => ProcessStream;
|
|
47
|
+
// The cursor calls a terminal-minded logger makes, answered the way a
|
|
48
|
+
// non-TTY stream answers them on Node: Vite's build clears its progress line
|
|
49
|
+
// without asking, and a stream without these died in every `vite build`.
|
|
50
|
+
columns: number;
|
|
51
|
+
rows: number;
|
|
52
|
+
clearLine: (direction: number | (() => void), callback?: () => void) => boolean;
|
|
53
|
+
cursorTo: (x: number, y?: number | (() => void), callback?: () => void) => boolean;
|
|
54
|
+
moveCursor: (dx: number, dy: number, callback?: () => void) => boolean;
|
|
55
|
+
getWindowSize: () => [number, number];
|
|
56
|
+
hasColors: () => boolean;
|
|
57
|
+
getColorDepth: () => number;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
interface ProcessWritableStream extends ProcessStream {
|
|
61
|
+
write: (data: string | Buffer, encoding?: string, callback?: () => void) => boolean;
|
|
62
|
+
end?: (data?: string, callback?: () => void) => void;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* `process.stdin` is a readable stream on Node -- a `net.Socket` when fd 0 is
|
|
67
|
+
* a pipe, an `fs.ReadStream` when it is a file, a `tty.ReadStream` when it is
|
|
68
|
+
* a terminal -- and the engine's was a plain object carrying `on` and `pipe`.
|
|
69
|
+
* A program that treats it as one refused it: byline, which Prisma's own code
|
|
70
|
+
* generator reads its JSON-RPC requests through, checks `instanceof
|
|
71
|
+
* stream.Readable` and throws; so does anything that pipes it, iterates it,
|
|
72
|
+
* asks it to `read()`, or waits on 'readable' or 'end'.
|
|
73
|
+
*
|
|
74
|
+
* A tab has no terminal, so the case this models is Node's pipe: the guest's
|
|
75
|
+
* standard input is whatever the shell put on fd 0 -- the text left of a pipe,
|
|
76
|
+
* or `container.run(..., { stdin })` -- and it is complete when the guest
|
|
77
|
+
* starts, so the stream carries those bytes and then ends, exactly as
|
|
78
|
+
* `node script.js < file` does. Where a runner can still feed the guest
|
|
79
|
+
* (a held run the host writes to with `sendStdin`), it leaves the stream open
|
|
80
|
+
* instead, which is Node's pipe whose writer has not closed. A terminal is
|
|
81
|
+
* not invented: `isTTY` stays false unless a runner says otherwise, and there
|
|
82
|
+
* is no `setRawMode` that does anything, because there is no raw mode to set.
|
|
83
|
+
*/
|
|
84
|
+
/**
|
|
85
|
+
* The guest's fd 0: a `Readable` the engine pushes into.
|
|
86
|
+
*
|
|
87
|
+
* Built the first time a process is made, not when this module is evaluated:
|
|
88
|
+
* `Readable` is Node's own class out of a vendored file, and `extends` reads
|
|
89
|
+
* the superclass at class-definition time, which is before the loader that
|
|
90
|
+
* builds it exists. See `node-lib/lazy.ts`.
|
|
91
|
+
*/
|
|
92
|
+
export interface ProcessStdin extends Readable {
|
|
93
|
+
readonly fd: number;
|
|
94
|
+
isTTY: boolean;
|
|
95
|
+
setRawMode(mode: boolean): ProcessStdin;
|
|
96
|
+
__substrateStdinWrite(data: string | Uint8Array): void;
|
|
97
|
+
__substrateStdinEnd(): void;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// eslint-disable-next-line no-var, vars-on-top
|
|
101
|
+
var StdinClass: (new () => ProcessStdin) | undefined;
|
|
102
|
+
function processStdinClass(): new () => ProcessStdin {
|
|
103
|
+
return StdinClass ??= class ProcessStdin extends (Readable as unknown as new () => Readable) {
|
|
104
|
+
/** Node's fd for standard input. */
|
|
105
|
+
readonly fd = 0;
|
|
106
|
+
|
|
107
|
+
/** Node's `Readable` asks for this; the engine pushes, so there is nothing to pull. */
|
|
108
|
+
_read(): void {}
|
|
109
|
+
/** False: there is no terminal in a tab. A runner that drives an interactive program sets it. */
|
|
110
|
+
isTTY = false;
|
|
111
|
+
|
|
112
|
+
/** Node's `tty.ReadStream.setRawMode`, which a tab has no terminal to put in raw mode. */
|
|
113
|
+
setRawMode(_mode: boolean): this {
|
|
114
|
+
return this;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/** Bytes arrived on the guest's fd 0. */
|
|
118
|
+
__substrateStdinWrite(data: string | Uint8Array): void {
|
|
119
|
+
if (data === undefined || data === null || (typeof data === 'string' && data.length === 0)) return;
|
|
120
|
+
this.push(data);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/** Whatever was writing to the guest's fd 0 closed: the stream ends. */
|
|
124
|
+
__substrateStdinEnd(): void {
|
|
125
|
+
this.push(null);
|
|
126
|
+
}
|
|
127
|
+
} as unknown as new () => ProcessStdin;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
type ProcessReadableStream = ProcessStdin;
|
|
131
|
+
|
|
132
|
+
export interface Process {
|
|
133
|
+
env: ProcessEnv;
|
|
134
|
+
cwd: () => string;
|
|
135
|
+
chdir: (directory: string) => void;
|
|
136
|
+
platform: string;
|
|
137
|
+
version: string;
|
|
138
|
+
versions: { node: string; v8: string; uv: string; webcontainer?: string; openssl?: string };
|
|
139
|
+
arch?: string;
|
|
140
|
+
argv: string[];
|
|
141
|
+
argv0: string;
|
|
142
|
+
execPath: string;
|
|
143
|
+
execArgv: string[];
|
|
144
|
+
/** Node's `process.config`: how the binary was built. */
|
|
145
|
+
config: { target_defaults: Record<string, unknown>; variables: Record<string, unknown> };
|
|
146
|
+
/** Node's `process.features`: what the binary was built with. */
|
|
147
|
+
features: Record<string, boolean | string | undefined>;
|
|
148
|
+
/**
|
|
149
|
+
* Node's `process.moduleLoadList`: every builtin this process has loaded,
|
|
150
|
+
* in the order it first loaded each, as `NativeModule <id>`. A program reads
|
|
151
|
+
* it to tell whether a module is already in memory before it does something
|
|
152
|
+
* that would pull it in; Node's own tests read it that way.
|
|
153
|
+
*/
|
|
154
|
+
moduleLoadList: string[];
|
|
155
|
+
/**
|
|
156
|
+
* Node's uncaught-exception capture pair. A program that sets a callback
|
|
157
|
+
* takes every uncaught exception instead of the `uncaughtException` event,
|
|
158
|
+
* and `domain` asks whether one is set before it installs its own handling.
|
|
159
|
+
*/
|
|
160
|
+
setUncaughtExceptionCaptureCallback: (callback: ((error: unknown) => void) | null) => void;
|
|
161
|
+
hasUncaughtExceptionCaptureCallback: () => boolean;
|
|
162
|
+
/** Node's `process.umask()`: the file-mode mask this process creates with. */
|
|
163
|
+
umask: (mask?: number | string) => number;
|
|
164
|
+
pid: number;
|
|
165
|
+
ppid: number;
|
|
166
|
+
exit: (code?: number) => never;
|
|
167
|
+
/** What a script that returned without calling `exit` exits with. */
|
|
168
|
+
exitCode?: number;
|
|
169
|
+
/** Node's `process.kill`, raising a signal on the guest's own process. */
|
|
170
|
+
kill: (pid: number, signal?: string | number) => boolean;
|
|
171
|
+
nextTick: (callback: (...args: unknown[]) => void, ...args: unknown[]) => void;
|
|
172
|
+
/** Node's deprecated `process.binding`, which bundles still feature-detect through. */
|
|
173
|
+
binding: (name: string) => unknown;
|
|
174
|
+
/** Node's deprecated `process.assert`: assert.ok. */
|
|
175
|
+
assert: (value: unknown, message?: string) => void;
|
|
176
|
+
/** Node's `process.emitWarning`, which fs-extra calls on its way into every
|
|
177
|
+
* React Router build; a warning goes to stderr the way Node prints one. */
|
|
178
|
+
emitWarning: (warning: string | Error, ...rest: unknown[]) => void;
|
|
179
|
+
stdout: ProcessWritableStream;
|
|
180
|
+
stderr: ProcessWritableStream;
|
|
181
|
+
stdin: ProcessReadableStream;
|
|
182
|
+
hrtime: {
|
|
183
|
+
(time?: [number, number]): [number, number];
|
|
184
|
+
bigint: () => bigint;
|
|
185
|
+
};
|
|
186
|
+
memoryUsage: () => { rss: number; heapTotal: number; heapUsed: number; external: number; arrayBuffers: number };
|
|
187
|
+
/** Node's `process.constrainedMemory`: a cgroup's limit, 0 when there is none. */
|
|
188
|
+
constrainedMemory: () => number;
|
|
189
|
+
/** Node's `process.availableMemory`: the memory still free, from the same place `os.freemem` reads. */
|
|
190
|
+
availableMemory: () => number;
|
|
191
|
+
uptime: () => number;
|
|
192
|
+
cpuUsage: () => { user: number; system: number };
|
|
193
|
+
// EventEmitter methods
|
|
194
|
+
on: (event: string, listener: EventListener) => Process;
|
|
195
|
+
once: (event: string, listener: EventListener) => Process;
|
|
196
|
+
off: (event: string, listener: EventListener) => Process;
|
|
197
|
+
emit: (event: string, ...args: unknown[]) => boolean;
|
|
198
|
+
addListener: (event: string, listener: EventListener) => Process;
|
|
199
|
+
removeListener: (event: string, listener: EventListener) => Process;
|
|
200
|
+
removeAllListeners: (event?: string) => Process;
|
|
201
|
+
listeners: (event: string) => EventListener[];
|
|
202
|
+
listenerCount: (event: string) => number;
|
|
203
|
+
prependListener: (event: string, listener: EventListener) => Process;
|
|
204
|
+
prependOnceListener: (event: string, listener: EventListener) => Process;
|
|
205
|
+
eventNames: () => (string | symbol)[];
|
|
206
|
+
setMaxListeners: (n: number) => Process;
|
|
207
|
+
getMaxListeners: () => number;
|
|
208
|
+
// IPC support (used by child_process.fork)
|
|
209
|
+
send?: (message: unknown, callback?: (error: Error | null) => void) => boolean;
|
|
210
|
+
connected?: boolean;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Helper to create a stream-like object with EventEmitter methods.
|
|
214
|
+
// `process.stdout` and `process.stderr` only: `process.stdin` is a real
|
|
215
|
+
// readable stream, as Node's is, and is built by `ProcessStdin` above.
|
|
216
|
+
function createProcessStream(
|
|
217
|
+
isWritable: boolean,
|
|
218
|
+
writeImpl?: (data: string) => boolean
|
|
219
|
+
): ProcessWritableStream {
|
|
220
|
+
const emitter = new EventEmitter();
|
|
221
|
+
|
|
222
|
+
const stream: ProcessWritableStream = {
|
|
223
|
+
isTTY: false,
|
|
224
|
+
columns: 80,
|
|
225
|
+
rows: 24,
|
|
226
|
+
clearLine(direction, callback) { if (typeof direction === 'function') direction(); else if (typeof callback === 'function') callback(); return true; },
|
|
227
|
+
cursorTo(x, y, callback) { if (typeof y === 'function') y(); else if (typeof callback === 'function') callback(); return true; },
|
|
228
|
+
moveCursor(dx, dy, callback) { if (typeof callback === 'function') callback(); return true; },
|
|
229
|
+
getWindowSize() { return [80, 24]; },
|
|
230
|
+
hasColors() { return false; },
|
|
231
|
+
getColorDepth() { return 1; },
|
|
232
|
+
|
|
233
|
+
on(event: string, listener: EventListener) {
|
|
234
|
+
emitter.on(event, listener);
|
|
235
|
+
return stream;
|
|
236
|
+
},
|
|
237
|
+
once(event: string, listener: EventListener) {
|
|
238
|
+
emitter.once(event, listener);
|
|
239
|
+
return stream;
|
|
240
|
+
},
|
|
241
|
+
off(event: string, listener: EventListener) {
|
|
242
|
+
emitter.off(event, listener);
|
|
243
|
+
return stream;
|
|
244
|
+
},
|
|
245
|
+
emit(event: string, ...args: unknown[]) {
|
|
246
|
+
return emitter.emit(event, ...args);
|
|
247
|
+
},
|
|
248
|
+
addListener(event: string, listener: EventListener) {
|
|
249
|
+
emitter.addListener(event, listener);
|
|
250
|
+
return stream;
|
|
251
|
+
},
|
|
252
|
+
removeListener(event: string, listener: EventListener) {
|
|
253
|
+
emitter.removeListener(event, listener);
|
|
254
|
+
return stream;
|
|
255
|
+
},
|
|
256
|
+
removeAllListeners(event?: string) {
|
|
257
|
+
emitter.removeAllListeners(event);
|
|
258
|
+
return stream;
|
|
259
|
+
},
|
|
260
|
+
setMaxListeners(n: number) {
|
|
261
|
+
emitter.setMaxListeners(n);
|
|
262
|
+
return stream;
|
|
263
|
+
},
|
|
264
|
+
getMaxListeners() {
|
|
265
|
+
return emitter.getMaxListeners();
|
|
266
|
+
},
|
|
267
|
+
listenerCount(event: string) {
|
|
268
|
+
return emitter.listenerCount(event);
|
|
269
|
+
},
|
|
270
|
+
listeners(event: string) {
|
|
271
|
+
return emitter.listeners(event);
|
|
272
|
+
},
|
|
273
|
+
rawListeners(event: string) {
|
|
274
|
+
return emitter.rawListeners(event);
|
|
275
|
+
},
|
|
276
|
+
prependListener(event: string, listener: EventListener) {
|
|
277
|
+
emitter.prependListener(event, listener);
|
|
278
|
+
return stream;
|
|
279
|
+
},
|
|
280
|
+
prependOnceListener(event: string, listener: EventListener) {
|
|
281
|
+
emitter.prependOnceListener(event, listener);
|
|
282
|
+
return stream;
|
|
283
|
+
},
|
|
284
|
+
eventNames() {
|
|
285
|
+
return emitter.eventNames();
|
|
286
|
+
},
|
|
287
|
+
pause() {
|
|
288
|
+
return stream;
|
|
289
|
+
},
|
|
290
|
+
resume() {
|
|
291
|
+
return stream;
|
|
292
|
+
},
|
|
293
|
+
setEncoding(_encoding: string) {
|
|
294
|
+
return stream;
|
|
295
|
+
},
|
|
296
|
+
// Default write implementation (no-op for readable streams)
|
|
297
|
+
write(_data: string | Buffer, _encoding?: string, callback?: () => void) {
|
|
298
|
+
if (callback) queueMicrotask(callback);
|
|
299
|
+
return true;
|
|
300
|
+
},
|
|
301
|
+
end(_data?: string, callback?: () => void) {
|
|
302
|
+
if (callback) queueMicrotask(callback);
|
|
303
|
+
},
|
|
304
|
+
pipe(destination: unknown) {
|
|
305
|
+
return destination;
|
|
306
|
+
},
|
|
307
|
+
unpipe() {
|
|
308
|
+
return stream;
|
|
309
|
+
},
|
|
310
|
+
isPaused() {
|
|
311
|
+
return false;
|
|
312
|
+
},
|
|
313
|
+
unshift() {
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
// Override write for actual writable streams
|
|
318
|
+
if (isWritable && writeImpl) {
|
|
319
|
+
stream.write = (data: string | Buffer, _encoding?: string, callback?: () => void) => {
|
|
320
|
+
const result = writeImpl(typeof data === 'string' ? data : data.toString());
|
|
321
|
+
if (callback) queueMicrotask(callback);
|
|
322
|
+
return result;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
return stream;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** The signal numbers a guest sees, and the signals a tab must ignore. */
|
|
330
|
+
const __substrateSignals: Record<string, number> = { SIGHUP: 1, SIGINT: 2, SIGQUIT: 3, SIGILL: 4, SIGTRAP: 5, SIGABRT: 6, SIGBUS: 7, SIGFPE: 8, SIGKILL: 9, SIGUSR1: 10, SIGSEGV: 11, SIGUSR2: 12, SIGPIPE: 13, SIGALRM: 14, SIGTERM: 15, SIGCHLD: 17, SIGCONT: 18, SIGSTOP: 19, SIGTSTP: 20, SIGTTIN: 21, SIGTTOU: 22, SIGURG: 23, SIGWINCH: 28 };
|
|
331
|
+
const __substrateSignalNames: Record<number, string> = Object.fromEntries(Object.entries(__substrateSignals).map(([name, number]) => [number, name]));
|
|
332
|
+
// Node prints the `process.binding` deprecation once per process; the engine
|
|
333
|
+
// runs many guests in one realm, so the record is per guest, not per load.
|
|
334
|
+
const __substrateBindingWarned = new WeakSet<object>();
|
|
335
|
+
const __substrateIgnoredSignals = new Set(["SIGCHLD", "SIGCONT", "SIGURG", "SIGWINCH"]);
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* The guest's children are processes it can see. `process.kill(pid, 0)`
|
|
339
|
+
* answered ESRCH for every pid but the guest's own, so a program that keeps its
|
|
340
|
+
* children's pids and asks whether they still run judged every live child dead.
|
|
341
|
+
* src/shims/child_process.ts fills this table as it spawns.
|
|
342
|
+
*/
|
|
343
|
+
export const __substrateChildren = new Map<number, { exitCode: number | null; signalCode: string | null; kill(signal?: string): boolean }>();
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* A guest's `process.version` is the version its image names. The engine said
|
|
347
|
+
* v20.0.0 to every guest, and Astro refused to build under it, asking for
|
|
348
|
+
* 22.12; the `node` image sets `NODE_VERSION` in its environment and the guest
|
|
349
|
+
* reports that version, or the current LTS where nothing named one. What the
|
|
350
|
+
* rest of `versions` says is `src/node-lib/node-versions.ts`.
|
|
351
|
+
*/
|
|
352
|
+
function __browserRuntimeNodeVersion(env: { NODE_VERSION?: string }): string {
|
|
353
|
+
const named = env && typeof env.NODE_VERSION === "string" ? env.NODE_VERSION.replace(/^v/, "") : "";
|
|
354
|
+
return /^\d+\.\d+\.\d+$/.test(named) ? named : NODE_LTS_VERSION;
|
|
355
|
+
}
|
|
356
|
+
/** The file-mode mask a guest has set, Node's own default until it sets one. */
|
|
357
|
+
let __substrateUmask = 0o022;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Where an exception nobody caught goes: the process it happened in.
|
|
361
|
+
*
|
|
362
|
+
* Node hands an exception no `try` caught to that process — its
|
|
363
|
+
* `uncaughtException` listeners, else the stack on its stderr and that
|
|
364
|
+
* process exiting 1 — and no other process hears it. The engine ran a guest's
|
|
365
|
+
* callbacks on the realm's own loop, so a `throw` from a guest's timer left
|
|
366
|
+
* the guest's frames entirely and reached the realm's global `error` event; in
|
|
367
|
+
* the tab that realm is a worker, and the substrate's container reads a worker
|
|
368
|
+
* error as a dead host and disposes it. openvscode-server's extension host,
|
|
369
|
+
* and every other program in the tab, died of one guest's uncaught throw.
|
|
370
|
+
*
|
|
371
|
+
* The `node` command records a run's report here, because only it holds that
|
|
372
|
+
* run's stderr and its guarded exit; the callers are the places a guest's
|
|
373
|
+
* callback is entered from the loop.
|
|
374
|
+
*/
|
|
375
|
+
const __substrateUncaughtReports = new WeakMap<object, (error: unknown) => void>();
|
|
376
|
+
|
|
377
|
+
/** Record how a running program reports an exception nobody caught; answers a release. */
|
|
378
|
+
export function __onUncaughtException(process: object, report: (error: unknown) => void): () => void {
|
|
379
|
+
__substrateUncaughtReports.set(process, report);
|
|
380
|
+
return () => { if (__substrateUncaughtReports.get(process) === report) __substrateUncaughtReports.delete(process); };
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Report an exception as the named process's own. False when no program owns
|
|
385
|
+
* it — the engine imported as a library into a Node host, where the host's own
|
|
386
|
+
* failure reporting is the right one and the caller rethrows.
|
|
387
|
+
*/
|
|
388
|
+
export function __reportUncaughtException(process: object | null | undefined, error: unknown): boolean {
|
|
389
|
+
const report = process ? __substrateUncaughtReports.get(process) : undefined;
|
|
390
|
+
if (!report) return false;
|
|
391
|
+
report(error);
|
|
392
|
+
return true;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
/**
|
|
396
|
+
* An exit code as Node takes one. `process.exit(process.argv[2])` is how a
|
|
397
|
+
* script takes its code from its command line, and argv is strings: Node
|
|
398
|
+
* coerces, so `process.exit("23")` exits 23. The engine passed the string
|
|
399
|
+
* through and a parent watching for `code === 23` was handed `"23"`.
|
|
400
|
+
* Undefined and null mean 0, and a value no number can be made of is 0 too.
|
|
401
|
+
*/
|
|
402
|
+
/**
|
|
403
|
+
* The callback a program set to take every uncaught exception, which is what
|
|
404
|
+
* `process.setUncaughtExceptionCaptureCallback` installs. The engine's
|
|
405
|
+
* uncaught door asks for it before it looks for listeners, as Node does.
|
|
406
|
+
*/
|
|
407
|
+
// eslint-disable-next-line no-var, vars-on-top
|
|
408
|
+
var __substrateCaptureCallback: ((error: unknown) => void) | null = null;
|
|
409
|
+
export function __substrateUncaughtCapture(): ((error: unknown) => void) | null {
|
|
410
|
+
return __substrateCaptureCallback;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
export function __substrateExitCode(code: unknown): number {
|
|
414
|
+
if (code === undefined || code === null) return 0;
|
|
415
|
+
const asNumber = Number(code);
|
|
416
|
+
return Number.isNaN(asNumber) ? 0 : asNumber;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
export function createProcess(options?: {
|
|
420
|
+
cwd?: string;
|
|
421
|
+
env?: ProcessEnv;
|
|
422
|
+
/** This process's own number and its parent's, as Node gives every process. */
|
|
423
|
+
pid?: number;
|
|
424
|
+
ppid?: number;
|
|
425
|
+
onExit?: (code: number) => void;
|
|
426
|
+
onStdout?: (data: string) => void;
|
|
427
|
+
onStderr?: (data: string) => void;
|
|
428
|
+
/** What the runner put on the guest's fd 0, as a shell puts the left of a pipe there. */
|
|
429
|
+
stdin?: string;
|
|
430
|
+
/**
|
|
431
|
+
* The runner can still write to the guest's fd 0 (a held run fed with
|
|
432
|
+
* `sendStdin`), so standard input does not end when the guest starts. Node's
|
|
433
|
+
* pipe whose writer has not closed: the stream stays open and empty.
|
|
434
|
+
*/
|
|
435
|
+
stdinHeld?: boolean;
|
|
436
|
+
/**
|
|
437
|
+
* The run was given a TTY. A pipe (a spawned child, a cell that is not
|
|
438
|
+
* held) is not one: Node does not inherit FORCE_COLOR onto a pipe, and
|
|
439
|
+
* `util.inspect` of an Error would colorize a stack and then ask
|
|
440
|
+
* `BuiltinModule.exists` of every `node:` frame.
|
|
441
|
+
*/
|
|
442
|
+
tty?: boolean;
|
|
443
|
+
}): Process {
|
|
444
|
+
let currentDir = options?.cwd || '/';
|
|
445
|
+
// Node sets no NODE_ENV and neither does the `node` image, so an app that
|
|
446
|
+
// reads it to choose its shape took its development path under a Dockerfile
|
|
447
|
+
// that never asked for it. A guest sees NODE_ENV only where the image, the
|
|
448
|
+
// Dockerfile, or the command set it.
|
|
449
|
+
const env: ProcessEnv = {
|
|
450
|
+
// The engine's shell reads a project's own binaries from
|
|
451
|
+
// `/node_modules/.bin`, and a child a guest spawns is started with the
|
|
452
|
+
// guest's environment, not the shell's: a PATH that left the directory out
|
|
453
|
+
// meant `spawn('vite')` found nothing that `npm run dev` finds.
|
|
454
|
+
PATH: '/usr/local/bin:/usr/bin:/bin:/node_modules/.bin',
|
|
455
|
+
HOME: '/',
|
|
456
|
+
...options?.env,
|
|
457
|
+
};
|
|
458
|
+
// A run that was not given a TTY is a pipe. The host's FORCE_COLOR would
|
|
459
|
+
// make `util.inspect` colorize `console.log(6)` on that pipe; Node does
|
|
460
|
+
// not, and a cell that printed a number would wrap it in CSI 33m. stdin
|
|
461
|
+
// being held open is a pipe whose writer has not closed, not a TTY --
|
|
462
|
+
// child_process tests hand pipes to children that way.
|
|
463
|
+
if (!options?.tty) {
|
|
464
|
+
delete env.FORCE_COLOR;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
// Create an EventEmitter for process events
|
|
468
|
+
const emitter = new EventEmitter();
|
|
469
|
+
const startTime = Date.now();
|
|
470
|
+
// The guest's fd 0: the bytes the runner put there, then the end of them.
|
|
471
|
+
// Nothing more can arrive unless the runner says it holds the input open.
|
|
472
|
+
const stdinStream = new (processStdinClass())();
|
|
473
|
+
if (typeof options?.stdin === 'string') stdinStream.__substrateStdinWrite(options.stdin);
|
|
474
|
+
if (!options?.stdinHeld) stdinStream.__substrateStdinEnd();
|
|
475
|
+
|
|
476
|
+
const proc: Process = {
|
|
477
|
+
env,
|
|
478
|
+
|
|
479
|
+
cwd() {
|
|
480
|
+
return currentDir;
|
|
481
|
+
},
|
|
482
|
+
|
|
483
|
+
chdir(directory: string) {
|
|
484
|
+
console.log('[process] chdir called:', directory, 'from:', currentDir);
|
|
485
|
+
if (!directory.startsWith('/')) {
|
|
486
|
+
directory = currentDir + '/' + directory;
|
|
487
|
+
}
|
|
488
|
+
currentDir = directory;
|
|
489
|
+
console.log('[process] chdir result:', currentDir);
|
|
490
|
+
},
|
|
491
|
+
|
|
492
|
+
platform: 'linux', // Pretend to be linux for better compatibility
|
|
493
|
+
version: 'v' + __browserRuntimeNodeVersion(env),
|
|
494
|
+
versions: nodeVersions(__browserRuntimeNodeVersion(env)),
|
|
495
|
+
arch: 'x64',
|
|
496
|
+
|
|
497
|
+
argv: ['node', '/index.js'],
|
|
498
|
+
argv0: 'node',
|
|
499
|
+
execPath: '/usr/local/bin/node',
|
|
500
|
+
execArgv: [],
|
|
501
|
+
|
|
502
|
+
// How the binary was built and what it was built with. Node's own test
|
|
503
|
+
// helper reads `process.config.variables` in its first ten lines and every
|
|
504
|
+
// program behind it died on `undefined`; `features` and `umask` are read
|
|
505
|
+
// next to it. A runtime that is not a build of Node still answers, as one
|
|
506
|
+
// built with nothing optional does.
|
|
507
|
+
config: { target_defaults: {}, variables: { node_shared: false, node_use_openssl: false, v8_enable_i18n_support: 0 } },
|
|
508
|
+
moduleLoadList: [],
|
|
509
|
+
setUncaughtExceptionCaptureCallback(callback: ((error: unknown) => void) | null) {
|
|
510
|
+
if (callback === null) { __substrateCaptureCallback = null; return; }
|
|
511
|
+
if (typeof callback !== 'function') {
|
|
512
|
+
throw Object.assign(new TypeError('The "fn" argument must be of type function or null.'), { code: 'ERR_INVALID_ARG_TYPE' });
|
|
513
|
+
}
|
|
514
|
+
if (__substrateCaptureCallback !== null) {
|
|
515
|
+
throw Object.assign(new Error('`process.setUncaughtExceptionCaptureCallback()` was called while a capture callback was already active'), { code: 'ERR_UNCAUGHT_EXCEPTION_CAPTURE_ALREADY_SET' });
|
|
516
|
+
}
|
|
517
|
+
__substrateCaptureCallback = callback;
|
|
518
|
+
},
|
|
519
|
+
hasUncaughtExceptionCaptureCallback() { return __substrateCaptureCallback !== null; },
|
|
520
|
+
features: { debug: false, inspector: false, tls: false, cached_builtins: true, ipv6: true, require_module: true, tls_alpn: false, tls_ocsp: false, tls_sni: false, typescript: false, uvwasi: true },
|
|
521
|
+
// The tab's tree carries no mode mask; Node's own default is what a
|
|
522
|
+
// process that has not set one reports, and setting one answers the mask
|
|
523
|
+
// it replaced, as Node's does.
|
|
524
|
+
umask(mask?: number | string) {
|
|
525
|
+
const previous = __substrateUmask;
|
|
526
|
+
if (mask !== undefined) __substrateUmask = typeof mask === 'string' ? parseInt(mask, 8) : mask;
|
|
527
|
+
return previous;
|
|
528
|
+
},
|
|
529
|
+
|
|
530
|
+
// Every process has its own number, and `ppid` names the one that
|
|
531
|
+
// started it: `src/process-tokens.ts` says what reads them and what it
|
|
532
|
+
// cost when they were 1 and 0 for everyone.
|
|
533
|
+
pid: options?.pid ?? mintPid(),
|
|
534
|
+
ppid: options?.ppid ?? 0,
|
|
535
|
+
|
|
536
|
+
exit(code: number | string | null | undefined = 0) {
|
|
537
|
+
code = __substrateExitCode(code);
|
|
538
|
+
emitter.emit('exit', code);
|
|
539
|
+
if (options?.onExit) {
|
|
540
|
+
options.onExit(code);
|
|
541
|
+
}
|
|
542
|
+
throw new Error(`Process exited with code ${code}`);
|
|
543
|
+
},
|
|
544
|
+
|
|
545
|
+
kill(pid: number, signal: string | number = "SIGTERM") {
|
|
546
|
+
const name = (typeof signal === "number" && signal !== 0 ? __substrateSignalNames[signal] : signal) as string;
|
|
547
|
+
if (signal !== 0 && (typeof name !== "string" || __substrateSignals[name] === void 0)) {
|
|
548
|
+
throw Object.assign(new TypeError("Unknown signal: " + signal), { code: "ERR_UNKNOWN_SIGNAL" });
|
|
549
|
+
}
|
|
550
|
+
// The guest is the only process on this side of the kernel: a signal to
|
|
551
|
+
// its own pid is raised on its own process object the way Node raises
|
|
552
|
+
// one, and every other pid is ESRCH rather than a silent success.
|
|
553
|
+
if (pid !== proc.pid) {
|
|
554
|
+
const child = __substrateChildren.get(Math.abs(pid));
|
|
555
|
+
if (child === void 0 || child.exitCode !== null || child.signalCode !== null) {
|
|
556
|
+
// Signal 0 is the question "is that process there?", and a program
|
|
557
|
+
// asks it about processes that are not its own children: a pid out
|
|
558
|
+
// of a lock file, a parent's. A live run answers yes and carries no
|
|
559
|
+
// signal; anything else is `ESRCH`, as it is on a machine.
|
|
560
|
+
if (signal === 0 && pidIsLive(Math.abs(pid))) return true;
|
|
561
|
+
throw Object.assign(new Error("kill ESRCH"), { code: "ESRCH", errno: -3, syscall: "kill" });
|
|
562
|
+
}
|
|
563
|
+
if (signal === 0) return true;
|
|
564
|
+
child.kill(name);
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
if (signal === 0) return true;
|
|
568
|
+
if (name !== "SIGKILL" && name !== "SIGSTOP" && emitter.listenerCount(name) > 0) {
|
|
569
|
+
emitter.emit(name, name);
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
if (__substrateIgnoredSignals.has(name)) return true;
|
|
573
|
+
proc.exit(128 + __substrateSignals[name]);
|
|
574
|
+
return true;
|
|
575
|
+
},
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* `process.binding(name)` is a function on Node, deprecated since v10.9
|
|
579
|
+
* and still there, and a bundle that feature-detects through it reads it
|
|
580
|
+
* before it reads anything public: the Prisma CLI asks for `constants`,
|
|
581
|
+
* `buffer` and `tty_wrap` on its way in. The engine had no such function,
|
|
582
|
+
* so the call was `undefined is not a function` -- a TypeError where Node
|
|
583
|
+
* answers. `constants` is the one binding a tab can serve honestly, and it
|
|
584
|
+
* is the engine's own table, the same numbers `require("constants")` hands
|
|
585
|
+
* out; every other name gets the error Node raises for a module it does
|
|
586
|
+
* not have, because a binding a tab cannot back is a surface that answers
|
|
587
|
+
* and then cannot act. Node prints the DEP0111 warning only under
|
|
588
|
+
* `--pending-deprecation`, and only once, so this does the same.
|
|
589
|
+
*/
|
|
590
|
+
binding(name: string): unknown {
|
|
591
|
+
if (!__substrateBindingWarned.has(proc) && (proc.execArgv || []).includes("--pending-deprecation")) {
|
|
592
|
+
__substrateBindingWarned.add(proc);
|
|
593
|
+
proc.emitWarning("process.binding() is deprecated. Please use public APIs instead.", "DeprecationWarning", "DEP0111");
|
|
594
|
+
}
|
|
595
|
+
if (name === "constants") return constantsBinding();
|
|
596
|
+
throw new Error("No such module: " + name);
|
|
597
|
+
},
|
|
598
|
+
|
|
599
|
+
nextTick(callback, ...args) {
|
|
600
|
+
const run = typeof globalThis.__substrateCarried === "function" ? globalThis.__substrateCarried(callback) : callback;
|
|
601
|
+
// A throw from a tick callback is this process's uncaught exception in
|
|
602
|
+
// Node. Out of a microtask it would be the realm's instead, and in the
|
|
603
|
+
// tab the worker's, which the substrate takes for a dead host.
|
|
604
|
+
queueMicrotask(() => {
|
|
605
|
+
try { run(...args); }
|
|
606
|
+
catch (error) { if (!__reportUncaughtException(proc, error)) throw error; }
|
|
607
|
+
});
|
|
608
|
+
},
|
|
609
|
+
|
|
610
|
+
// Node's `process.assert`, deprecated (DEP0100) and still exported: assert.ok.
|
|
611
|
+
assert(value: unknown, message?: string) {
|
|
612
|
+
if (value) return;
|
|
613
|
+
const error = new Error(message === undefined ? 'assertion error' : String(message));
|
|
614
|
+
error.name = 'AssertionError';
|
|
615
|
+
(error as Error & { code?: string }).code = 'ERR_ASSERTION';
|
|
616
|
+
throw error;
|
|
617
|
+
},
|
|
618
|
+
|
|
619
|
+
emitWarning(warning, ...rest) {
|
|
620
|
+
const text = warning instanceof Error ? warning.message : String(warning);
|
|
621
|
+
const options = rest[0] && typeof rest[0] === 'object' ? (rest[0] as { type?: string; code?: string }) : undefined;
|
|
622
|
+
const type = typeof rest[0] === 'string' ? rest[0] : options?.type ? options.type : 'Warning';
|
|
623
|
+
const printedCode = typeof rest[1] === 'string' ? rest[1] : options?.code;
|
|
624
|
+
// Node prints an Error warning under its own `name`, and names the code
|
|
625
|
+
// in brackets before it: `(node:123) [MYCODE] MyWarning: a message`. The
|
|
626
|
+
// engine printed the computed type and dropped the code, so a warning
|
|
627
|
+
// that carried either lost it.
|
|
628
|
+
const printedType = warning instanceof Error ? warning.name : type;
|
|
629
|
+
const line = '(node) ' + (printedCode === undefined ? '' : '[' + printedCode + '] ') + printedType + ': ' + text + '\n';
|
|
630
|
+
if (this && this.stderr && typeof this.stderr.write === 'function') this.stderr.write(line);
|
|
631
|
+
else console.warn(line);
|
|
632
|
+
// Node raises the warning as an Error on the process's 'warning' event on
|
|
633
|
+
// the next tick, which is how a program (and Node's own test helper,
|
|
634
|
+
// `common.expectWarning`) observes it; the engine only printed it.
|
|
635
|
+
const code = printedCode;
|
|
636
|
+
const raised = warning instanceof Error ? warning : Object.assign(new Error(text), { name: type as string }, code === undefined ? {} : { code });
|
|
637
|
+
queueMicrotask(() => { emitter.emit('warning', raised); });
|
|
638
|
+
},
|
|
639
|
+
|
|
640
|
+
stdout: createProcessStream(true, (data: string) => {
|
|
641
|
+
if (options?.onStdout) {
|
|
642
|
+
options.onStdout(data);
|
|
643
|
+
} else {
|
|
644
|
+
console.log(data);
|
|
645
|
+
}
|
|
646
|
+
return true;
|
|
647
|
+
}) as ProcessWritableStream,
|
|
648
|
+
|
|
649
|
+
stderr: createProcessStream(true, (data: string) => {
|
|
650
|
+
if (options?.onStderr) {
|
|
651
|
+
options.onStderr(data);
|
|
652
|
+
} else {
|
|
653
|
+
console.error(data);
|
|
654
|
+
}
|
|
655
|
+
return true;
|
|
656
|
+
}) as ProcessWritableStream,
|
|
657
|
+
|
|
658
|
+
stdin: stdinStream,
|
|
659
|
+
|
|
660
|
+
hrtime: Object.assign(
|
|
661
|
+
function hrtime(time?: [number, number]): [number, number] {
|
|
662
|
+
const now = performance.now();
|
|
663
|
+
const seconds = Math.floor(now / 1000);
|
|
664
|
+
const nanoseconds = Math.floor((now % 1000) * 1e6);
|
|
665
|
+
if (time) {
|
|
666
|
+
const diffSeconds = seconds - time[0];
|
|
667
|
+
const diffNanos = nanoseconds - time[1];
|
|
668
|
+
return [diffSeconds, diffNanos];
|
|
669
|
+
}
|
|
670
|
+
return [seconds, nanoseconds];
|
|
671
|
+
},
|
|
672
|
+
{
|
|
673
|
+
bigint: (): bigint => BigInt(Math.floor(performance.now() * 1e6)),
|
|
674
|
+
}
|
|
675
|
+
),
|
|
676
|
+
|
|
677
|
+
memoryUsage() {
|
|
678
|
+
// Return mock values since we can't access real memory in browser
|
|
679
|
+
return {
|
|
680
|
+
rss: 50 * 1024 * 1024,
|
|
681
|
+
heapTotal: 30 * 1024 * 1024,
|
|
682
|
+
heapUsed: 20 * 1024 * 1024,
|
|
683
|
+
external: 1 * 1024 * 1024,
|
|
684
|
+
arrayBuffers: 0,
|
|
685
|
+
};
|
|
686
|
+
},
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
|
+
* Node's `process.constrainedMemory`, which reports a cgroup's limit on
|
|
690
|
+
* the process and returns 0 when there is none. A tab is not in a cgroup,
|
|
691
|
+
* so 0 is both Node's own answer for an unconstrained process and the
|
|
692
|
+
* truthful one here. A library that sizes a pool from it already has to
|
|
693
|
+
* handle 0, because that is what it reads on any ordinary machine.
|
|
694
|
+
*/
|
|
695
|
+
constrainedMemory(): number {
|
|
696
|
+
return 0;
|
|
697
|
+
},
|
|
698
|
+
|
|
699
|
+
/**
|
|
700
|
+
* Node's `process.availableMemory`, the memory still free to the process.
|
|
701
|
+
* It answers from `os.freemem` so the engine has one answer about memory
|
|
702
|
+
* rather than two that can drift: a guest that asks the operating system
|
|
703
|
+
* and a guest that asks its own process must not be told different things.
|
|
704
|
+
*/
|
|
705
|
+
availableMemory(): number {
|
|
706
|
+
return osFreemem();
|
|
707
|
+
},
|
|
708
|
+
|
|
709
|
+
uptime() {
|
|
710
|
+
return (Date.now() - startTime) / 1000;
|
|
711
|
+
},
|
|
712
|
+
|
|
713
|
+
cpuUsage() {
|
|
714
|
+
return { user: 0, system: 0 };
|
|
715
|
+
},
|
|
716
|
+
|
|
717
|
+
// EventEmitter methods - delegate to emitter but return proc for chaining
|
|
718
|
+
on(event: string, listener: EventListener): Process {
|
|
719
|
+
emitter.on(event, listener);
|
|
720
|
+
return proc;
|
|
721
|
+
},
|
|
722
|
+
|
|
723
|
+
once(event: string, listener: EventListener): Process {
|
|
724
|
+
emitter.once(event, listener);
|
|
725
|
+
return proc;
|
|
726
|
+
},
|
|
727
|
+
|
|
728
|
+
off(event: string, listener: EventListener): Process {
|
|
729
|
+
emitter.off(event, listener);
|
|
730
|
+
return proc;
|
|
731
|
+
},
|
|
732
|
+
|
|
733
|
+
/**
|
|
734
|
+
* A listener on this process is called with THIS process as `this`, as
|
|
735
|
+
* Node's is: `process` IS the emitter there, where here it holds one.
|
|
736
|
+
* Node's own `setupChannel` keeps a child's IPC channel on a symbol of the
|
|
737
|
+
* process object and reads it back off `this` inside an `internalMessage`
|
|
738
|
+
* listener; called with the held emitter instead, it found no channel and
|
|
739
|
+
* a socket sent to the child arrived at nothing.
|
|
740
|
+
*/
|
|
741
|
+
emit(event: string, ...args: unknown[]): boolean {
|
|
742
|
+
const listeners = emitter.listeners(event);
|
|
743
|
+
if (listeners.length === 0) return emitter.emit(event, ...args);
|
|
744
|
+
for (const listener of listeners) {
|
|
745
|
+
try { listener.apply(proc, args); }
|
|
746
|
+
catch (error) { console.error('Error in event listener:', error); }
|
|
747
|
+
}
|
|
748
|
+
return true;
|
|
749
|
+
},
|
|
750
|
+
|
|
751
|
+
addListener(event: string, listener: EventListener): Process {
|
|
752
|
+
emitter.addListener(event, listener);
|
|
753
|
+
return proc;
|
|
754
|
+
},
|
|
755
|
+
|
|
756
|
+
removeListener(event: string, listener: EventListener): Process {
|
|
757
|
+
emitter.removeListener(event, listener);
|
|
758
|
+
return proc;
|
|
759
|
+
},
|
|
760
|
+
|
|
761
|
+
removeAllListeners(event?: string): Process {
|
|
762
|
+
emitter.removeAllListeners(event);
|
|
763
|
+
return proc;
|
|
764
|
+
},
|
|
765
|
+
|
|
766
|
+
listeners(event: string): EventListener[] {
|
|
767
|
+
return emitter.listeners(event);
|
|
768
|
+
},
|
|
769
|
+
|
|
770
|
+
listenerCount(event: string): number {
|
|
771
|
+
return emitter.listenerCount(event);
|
|
772
|
+
},
|
|
773
|
+
|
|
774
|
+
prependListener(event: string, listener: EventListener): Process {
|
|
775
|
+
emitter.prependListener(event, listener);
|
|
776
|
+
return proc;
|
|
777
|
+
},
|
|
778
|
+
|
|
779
|
+
prependOnceListener(event: string, listener: EventListener): Process {
|
|
780
|
+
emitter.prependOnceListener(event, listener);
|
|
781
|
+
return proc;
|
|
782
|
+
},
|
|
783
|
+
|
|
784
|
+
eventNames(): (string | symbol)[] {
|
|
785
|
+
return emitter.eventNames();
|
|
786
|
+
},
|
|
787
|
+
|
|
788
|
+
setMaxListeners(n: number): Process {
|
|
789
|
+
emitter.setMaxListeners(n);
|
|
790
|
+
return proc;
|
|
791
|
+
},
|
|
792
|
+
|
|
793
|
+
getMaxListeners(): number {
|
|
794
|
+
return emitter.getMaxListeners();
|
|
795
|
+
},
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
return proc;
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
// There is no default process: a process is made for a run, by the `node`
|
|
802
|
+
// command, and making one when this module is evaluated built the guest's
|
|
803
|
+
// `stdin` -- a `Readable` out of a vendored Node file -- before the loader
|
|
804
|
+
// that builds Node's streams existed. Nothing read it.
|