@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,689 @@
|
|
|
1
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
2
|
+
//
|
|
3
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
4
|
+
// copy of this software and associated documentation files (the
|
|
5
|
+
// "Software"), to deal in the Software without restriction, including
|
|
6
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
8
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
9
|
+
// following conditions:
|
|
10
|
+
//
|
|
11
|
+
// The above copyright notice and this permission notice shall be included
|
|
12
|
+
// in all copies or substantial portions of the Software.
|
|
13
|
+
//
|
|
14
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
15
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
17
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
18
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
19
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
20
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
21
|
+
|
|
22
|
+
'use strict';
|
|
23
|
+
|
|
24
|
+
const {
|
|
25
|
+
ArrayIsArray,
|
|
26
|
+
ArrayPrototypeJoin,
|
|
27
|
+
ArrayPrototypePop,
|
|
28
|
+
ArrayPrototypePush,
|
|
29
|
+
Date,
|
|
30
|
+
DatePrototypeGetDate,
|
|
31
|
+
DatePrototypeGetHours,
|
|
32
|
+
DatePrototypeGetMinutes,
|
|
33
|
+
DatePrototypeGetMonth,
|
|
34
|
+
DatePrototypeGetSeconds,
|
|
35
|
+
Error,
|
|
36
|
+
ErrorCaptureStackTrace,
|
|
37
|
+
FunctionPrototypeBind,
|
|
38
|
+
NumberIsSafeInteger,
|
|
39
|
+
ObjectDefineProperties,
|
|
40
|
+
ObjectDefineProperty,
|
|
41
|
+
ObjectGetOwnPropertyDescriptors,
|
|
42
|
+
ObjectKeys,
|
|
43
|
+
ObjectPrototypeToString,
|
|
44
|
+
ObjectSetPrototypeOf,
|
|
45
|
+
ObjectValues,
|
|
46
|
+
ReflectApply,
|
|
47
|
+
StringPrototypePadStart,
|
|
48
|
+
StringPrototypeToWellFormed,
|
|
49
|
+
} = primordials;
|
|
50
|
+
|
|
51
|
+
const {
|
|
52
|
+
ErrnoException,
|
|
53
|
+
ExceptionWithHostPort,
|
|
54
|
+
codes: {
|
|
55
|
+
ERR_FALSY_VALUE_REJECTION,
|
|
56
|
+
ERR_INVALID_ARG_TYPE,
|
|
57
|
+
ERR_OUT_OF_RANGE,
|
|
58
|
+
},
|
|
59
|
+
isErrorStackTraceLimitWritable,
|
|
60
|
+
} = require('internal/errors');
|
|
61
|
+
const {
|
|
62
|
+
format,
|
|
63
|
+
formatWithOptions,
|
|
64
|
+
inspect,
|
|
65
|
+
stripVTControlCharacters,
|
|
66
|
+
} = require('internal/util/inspect');
|
|
67
|
+
const { debuglog } = require('internal/util/debuglog');
|
|
68
|
+
const {
|
|
69
|
+
validateBoolean,
|
|
70
|
+
validateFunction,
|
|
71
|
+
validateNumber,
|
|
72
|
+
validateString,
|
|
73
|
+
validateOneOf,
|
|
74
|
+
validateObject,
|
|
75
|
+
} = require('internal/validators');
|
|
76
|
+
const { isBuffer } = require('buffer').Buffer;
|
|
77
|
+
const {
|
|
78
|
+
isReadableStream,
|
|
79
|
+
isWritableStream,
|
|
80
|
+
isNodeStream,
|
|
81
|
+
} = require('internal/streams/utils');
|
|
82
|
+
const types = require('internal/util/types');
|
|
83
|
+
|
|
84
|
+
let utilColors;
|
|
85
|
+
function lazyUtilColors() {
|
|
86
|
+
utilColors ??= require('internal/util/colors');
|
|
87
|
+
return utilColors;
|
|
88
|
+
}
|
|
89
|
+
const { getOptionValue } = require('internal/options');
|
|
90
|
+
|
|
91
|
+
const binding = internalBinding('util');
|
|
92
|
+
|
|
93
|
+
const {
|
|
94
|
+
deprecate,
|
|
95
|
+
getLazy,
|
|
96
|
+
getSystemErrorMap,
|
|
97
|
+
getSystemErrorName: internalErrorName,
|
|
98
|
+
getSystemErrorMessage: internalErrorMessage,
|
|
99
|
+
promisify,
|
|
100
|
+
defineLazyProperties,
|
|
101
|
+
} = require('internal/util');
|
|
102
|
+
|
|
103
|
+
let abortController;
|
|
104
|
+
|
|
105
|
+
function lazyAbortController() {
|
|
106
|
+
abortController ??= require('internal/abort_controller');
|
|
107
|
+
return abortController;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
let internalDeepEqual;
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* @deprecated since v4.0.0
|
|
114
|
+
* @param {any} arg
|
|
115
|
+
* @returns {arg is boolean}
|
|
116
|
+
*/
|
|
117
|
+
function isBoolean(arg) {
|
|
118
|
+
return typeof arg === 'boolean';
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* @deprecated since v4.0.0
|
|
123
|
+
* @param {any} arg
|
|
124
|
+
* @returns {arg is null}
|
|
125
|
+
*/
|
|
126
|
+
function isNull(arg) {
|
|
127
|
+
return arg === null;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* @deprecated since v4.0.0
|
|
132
|
+
* @param {any} arg
|
|
133
|
+
* @returns {arg is (null | undefined)}
|
|
134
|
+
*/
|
|
135
|
+
function isNullOrUndefined(arg) {
|
|
136
|
+
return arg === null || arg === undefined;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* @deprecated since v4.0.0
|
|
141
|
+
* @param {any} arg
|
|
142
|
+
* @returns {arg is number}
|
|
143
|
+
*/
|
|
144
|
+
function isNumber(arg) {
|
|
145
|
+
return typeof arg === 'number';
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @param {any} arg
|
|
150
|
+
* @returns {arg is string}
|
|
151
|
+
*/
|
|
152
|
+
function isString(arg) {
|
|
153
|
+
return typeof arg === 'string';
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* @deprecated since v4.0.0
|
|
158
|
+
* @param {any} arg
|
|
159
|
+
* @returns {arg is symbol}
|
|
160
|
+
*/
|
|
161
|
+
function isSymbol(arg) {
|
|
162
|
+
return typeof arg === 'symbol';
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* @deprecated since v4.0.0
|
|
167
|
+
* @param {any} arg
|
|
168
|
+
* @returns {arg is undefined}
|
|
169
|
+
*/
|
|
170
|
+
function isUndefined(arg) {
|
|
171
|
+
return arg === undefined;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @deprecated since v4.0.0
|
|
176
|
+
* @param {any} arg
|
|
177
|
+
* @returns {a is NonNullable<object>}
|
|
178
|
+
*/
|
|
179
|
+
function isObject(arg) {
|
|
180
|
+
return arg !== null && typeof arg === 'object';
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* @deprecated since v4.0.0
|
|
185
|
+
* @param {any} e
|
|
186
|
+
* @returns {arg is Error}
|
|
187
|
+
*/
|
|
188
|
+
function isError(e) {
|
|
189
|
+
return ObjectPrototypeToString(e) === '[object Error]' || e instanceof Error;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* @deprecated since v4.0.0
|
|
194
|
+
* @param {any} arg
|
|
195
|
+
* @returns {arg is Function}
|
|
196
|
+
*/
|
|
197
|
+
function isFunction(arg) {
|
|
198
|
+
return typeof arg === 'function';
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @deprecated since v4.0.0
|
|
203
|
+
* @param {any} arg
|
|
204
|
+
* @returns {arg is (boolean | null | number | string | symbol | undefined)}
|
|
205
|
+
*/
|
|
206
|
+
function isPrimitive(arg) {
|
|
207
|
+
return arg === null ||
|
|
208
|
+
(typeof arg !== 'object' && typeof arg !== 'function');
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @param {number} n
|
|
213
|
+
* @returns {string}
|
|
214
|
+
*/
|
|
215
|
+
function pad(n) {
|
|
216
|
+
return StringPrototypePadStart(n.toString(), 2, '0');
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* @param {string} [code]
|
|
221
|
+
* @returns {string}
|
|
222
|
+
*/
|
|
223
|
+
function escapeStyleCode(code) {
|
|
224
|
+
if (code === undefined) return '';
|
|
225
|
+
return `\u001b[${code}m`;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* @param {string | string[]} format
|
|
230
|
+
* @param {string} text
|
|
231
|
+
* @param {object} [options={}]
|
|
232
|
+
* @param {boolean} [options.validateStream=true] - Whether to validate the stream.
|
|
233
|
+
* @param {Stream} [options.stream=process.stdout] - The stream used for validation.
|
|
234
|
+
* @returns {string}
|
|
235
|
+
*/
|
|
236
|
+
function styleText(format, text, { validateStream = true, stream = process.stdout } = {}) {
|
|
237
|
+
validateString(text, 'text');
|
|
238
|
+
validateBoolean(validateStream, 'options.validateStream');
|
|
239
|
+
|
|
240
|
+
let skipColorize;
|
|
241
|
+
if (validateStream) {
|
|
242
|
+
if (
|
|
243
|
+
!isReadableStream(stream) &&
|
|
244
|
+
!isWritableStream(stream) &&
|
|
245
|
+
!isNodeStream(stream)
|
|
246
|
+
) {
|
|
247
|
+
throw new ERR_INVALID_ARG_TYPE('stream', ['ReadableStream', 'WritableStream', 'Stream'], stream);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// If the stream is falsy or should not be colorized, set skipColorize to true
|
|
251
|
+
skipColorize = !lazyUtilColors().shouldColorize(stream);
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// If the format is not an array, convert it to an array
|
|
255
|
+
const formatArray = ArrayIsArray(format) ? format : [format];
|
|
256
|
+
|
|
257
|
+
let left = '';
|
|
258
|
+
let right = '';
|
|
259
|
+
for (const key of formatArray) {
|
|
260
|
+
if (key === 'none') continue;
|
|
261
|
+
const formatCodes = inspect.colors[key];
|
|
262
|
+
// If the format is not a valid style, throw an error
|
|
263
|
+
if (formatCodes == null) {
|
|
264
|
+
validateOneOf(key, 'format', ObjectKeys(inspect.colors));
|
|
265
|
+
}
|
|
266
|
+
if (skipColorize) continue;
|
|
267
|
+
left += escapeStyleCode(formatCodes[0]);
|
|
268
|
+
right = `${escapeStyleCode(formatCodes[1])}${right}`;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
return skipColorize ? text : `${left}${text}${right}`;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep',
|
|
275
|
+
'Oct', 'Nov', 'Dec'];
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @returns {string} 26 Feb 16:19:34
|
|
279
|
+
*/
|
|
280
|
+
function timestamp() {
|
|
281
|
+
const d = new Date();
|
|
282
|
+
const t = ArrayPrototypeJoin([
|
|
283
|
+
pad(DatePrototypeGetHours(d)),
|
|
284
|
+
pad(DatePrototypeGetMinutes(d)),
|
|
285
|
+
pad(DatePrototypeGetSeconds(d)),
|
|
286
|
+
], ':');
|
|
287
|
+
return `${DatePrototypeGetDate(d)} ${months[DatePrototypeGetMonth(d)]} ${t}`;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
let console;
|
|
291
|
+
/**
|
|
292
|
+
* Log is just a thin wrapper to console.log that prepends a timestamp
|
|
293
|
+
* @deprecated since v6.0.0
|
|
294
|
+
* @type {(...args: any[]) => void}
|
|
295
|
+
*/
|
|
296
|
+
function log(...args) {
|
|
297
|
+
console ??= require('internal/console/global');
|
|
298
|
+
console.log('%s - %s', timestamp(), format(...args));
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Inherit the prototype methods from one constructor into another.
|
|
303
|
+
*
|
|
304
|
+
* The Function.prototype.inherits from lang.js rewritten as a standalone
|
|
305
|
+
* function (not on Function.prototype). NOTE: If this file is to be loaded
|
|
306
|
+
* during bootstrapping this function needs to be rewritten using some native
|
|
307
|
+
* functions as prototype setup using normal JavaScript does not work as
|
|
308
|
+
* expected during bootstrapping (see mirror.js in r114903).
|
|
309
|
+
* @param {Function} ctor Constructor function which needs to inherit the
|
|
310
|
+
* prototype.
|
|
311
|
+
* @param {Function} superCtor Constructor function to inherit prototype from.
|
|
312
|
+
* @throws {TypeError} Will error if either constructor is null, or if
|
|
313
|
+
* the super constructor lacks a prototype.
|
|
314
|
+
*/
|
|
315
|
+
function inherits(ctor, superCtor) {
|
|
316
|
+
|
|
317
|
+
if (ctor === undefined || ctor === null)
|
|
318
|
+
throw new ERR_INVALID_ARG_TYPE('ctor', 'Function', ctor);
|
|
319
|
+
|
|
320
|
+
if (superCtor === undefined || superCtor === null)
|
|
321
|
+
throw new ERR_INVALID_ARG_TYPE('superCtor', 'Function', superCtor);
|
|
322
|
+
|
|
323
|
+
if (superCtor.prototype === undefined) {
|
|
324
|
+
throw new ERR_INVALID_ARG_TYPE('superCtor.prototype',
|
|
325
|
+
'Object', superCtor.prototype);
|
|
326
|
+
}
|
|
327
|
+
ObjectDefineProperty(ctor, 'super_', {
|
|
328
|
+
__proto__: null,
|
|
329
|
+
value: superCtor,
|
|
330
|
+
writable: true,
|
|
331
|
+
configurable: true,
|
|
332
|
+
});
|
|
333
|
+
ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* @deprecated since v6.0.0
|
|
338
|
+
* @template T
|
|
339
|
+
* @template S
|
|
340
|
+
* @param {T} target
|
|
341
|
+
* @param {S} source
|
|
342
|
+
* @returns {S extends null ? T : (T & S)}
|
|
343
|
+
*/
|
|
344
|
+
function _extend(target, source) {
|
|
345
|
+
// Don't do anything if source isn't an object
|
|
346
|
+
if (source === null || typeof source !== 'object') return target;
|
|
347
|
+
|
|
348
|
+
const keys = ObjectKeys(source);
|
|
349
|
+
let i = keys.length;
|
|
350
|
+
while (i--) {
|
|
351
|
+
target[keys[i]] = source[keys[i]];
|
|
352
|
+
}
|
|
353
|
+
return target;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
const callbackifyOnRejected = (reason, cb) => {
|
|
357
|
+
// `!reason` guard inspired by bluebird (Ref: https://goo.gl/t5IS6M).
|
|
358
|
+
// Because `null` is a special error value in callbacks which means "no error
|
|
359
|
+
// occurred", we error-wrap so the callback consumer can distinguish between
|
|
360
|
+
// "the promise rejected with null" or "the promise fulfilled with undefined".
|
|
361
|
+
if (!reason) {
|
|
362
|
+
reason = new ERR_FALSY_VALUE_REJECTION.HideStackFramesError(reason);
|
|
363
|
+
ErrorCaptureStackTrace(reason, callbackifyOnRejected);
|
|
364
|
+
}
|
|
365
|
+
return cb(reason);
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* @template {(...args: any[]) => Promise<any>} T
|
|
370
|
+
* @param {T} original
|
|
371
|
+
* @returns {T extends (...args: infer TArgs) => Promise<infer TReturn> ?
|
|
372
|
+
* ((...params: [...TArgs, ((err: Error, ret: TReturn) => any)]) => void) :
|
|
373
|
+
* never
|
|
374
|
+
* }
|
|
375
|
+
*/
|
|
376
|
+
function callbackify(original) {
|
|
377
|
+
validateFunction(original, 'original');
|
|
378
|
+
|
|
379
|
+
// We DO NOT return the promise as it gives the user a false sense that
|
|
380
|
+
// the promise is actually somehow related to the callback's execution
|
|
381
|
+
// and that the callback throwing will reject the promise.
|
|
382
|
+
function callbackified(...args) {
|
|
383
|
+
const maybeCb = ArrayPrototypePop(args);
|
|
384
|
+
validateFunction(maybeCb, 'last argument');
|
|
385
|
+
const cb = FunctionPrototypeBind(maybeCb, this);
|
|
386
|
+
// In true node style we process the callback on `nextTick` with all the
|
|
387
|
+
// implications (stack, `uncaughtException`, `async_hooks`)
|
|
388
|
+
ReflectApply(original, this, args)
|
|
389
|
+
.then((ret) => process.nextTick(cb, null, ret),
|
|
390
|
+
(rej) => process.nextTick(callbackifyOnRejected, rej, cb));
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
const descriptors = ObjectGetOwnPropertyDescriptors(original);
|
|
394
|
+
// It is possible to manipulate a functions `length` or `name` property. This
|
|
395
|
+
// guards against the manipulation.
|
|
396
|
+
if (typeof descriptors.length.value === 'number') {
|
|
397
|
+
descriptors.length.value++;
|
|
398
|
+
}
|
|
399
|
+
if (typeof descriptors.name.value === 'string') {
|
|
400
|
+
descriptors.name.value += 'Callbackified';
|
|
401
|
+
}
|
|
402
|
+
const propertiesValues = ObjectValues(descriptors);
|
|
403
|
+
for (let i = 0; i < propertiesValues.length; i++) {
|
|
404
|
+
// We want to use null-prototype objects to not rely on globally mutable
|
|
405
|
+
// %Object.prototype%.
|
|
406
|
+
ObjectSetPrototypeOf(propertiesValues[i], null);
|
|
407
|
+
}
|
|
408
|
+
ObjectDefineProperties(callbackified, descriptors);
|
|
409
|
+
return callbackified;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* @param {number} err
|
|
414
|
+
* @returns {string}
|
|
415
|
+
*/
|
|
416
|
+
function getSystemErrorMessage(err) {
|
|
417
|
+
validateNumber(err, 'err');
|
|
418
|
+
if (err >= 0 || !NumberIsSafeInteger(err)) {
|
|
419
|
+
throw new ERR_OUT_OF_RANGE('err', 'a negative integer', err);
|
|
420
|
+
}
|
|
421
|
+
return internalErrorMessage(err);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* @param {number} err
|
|
426
|
+
* @returns {string}
|
|
427
|
+
*/
|
|
428
|
+
function getSystemErrorName(err) {
|
|
429
|
+
validateNumber(err, 'err');
|
|
430
|
+
if (err >= 0 || !NumberIsSafeInteger(err)) {
|
|
431
|
+
throw new ERR_OUT_OF_RANGE('err', 'a negative integer', err);
|
|
432
|
+
}
|
|
433
|
+
return internalErrorName(err);
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
function _errnoException(...args) {
|
|
437
|
+
if (isErrorStackTraceLimitWritable()) {
|
|
438
|
+
const limit = Error.stackTraceLimit;
|
|
439
|
+
Error.stackTraceLimit = 0;
|
|
440
|
+
const e = new ErrnoException(...args);
|
|
441
|
+
Error.stackTraceLimit = limit;
|
|
442
|
+
ErrorCaptureStackTrace(e, _exceptionWithHostPort);
|
|
443
|
+
return e;
|
|
444
|
+
}
|
|
445
|
+
return new ErrnoException(...args);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
function _exceptionWithHostPort(...args) {
|
|
449
|
+
if (isErrorStackTraceLimitWritable()) {
|
|
450
|
+
const limit = Error.stackTraceLimit;
|
|
451
|
+
Error.stackTraceLimit = 0;
|
|
452
|
+
const e = new ExceptionWithHostPort(...args);
|
|
453
|
+
Error.stackTraceLimit = limit;
|
|
454
|
+
ErrorCaptureStackTrace(e, _exceptionWithHostPort);
|
|
455
|
+
return e;
|
|
456
|
+
}
|
|
457
|
+
return new ExceptionWithHostPort(...args);
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
/**
|
|
461
|
+
* Parses the content of a `.env` file.
|
|
462
|
+
* @param {string} content
|
|
463
|
+
* @returns {Record<string, string>}
|
|
464
|
+
*/
|
|
465
|
+
function parseEnv(content) {
|
|
466
|
+
validateString(content, 'content');
|
|
467
|
+
return binding.parseEnv(content);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
const lazySourceMap = getLazy(() => require('internal/source_map/source_map_cache'));
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* @typedef {object} CallSite // The call site
|
|
474
|
+
* @property {string} scriptName // The name of the resource that contains the
|
|
475
|
+
* script for the function for this StackFrame
|
|
476
|
+
* @property {string} functionName // The name of the function associated with this stack frame
|
|
477
|
+
* @property {number} lineNumber // The number, 1-based, of the line for the associate function call
|
|
478
|
+
* @property {number} columnNumber // The 1-based column offset on the line for the associated function call
|
|
479
|
+
*/
|
|
480
|
+
|
|
481
|
+
/**
|
|
482
|
+
* @param {CallSite} callSite // The call site object to reconstruct from source map
|
|
483
|
+
* @returns {CallSite | undefined} // The reconstructed call site object
|
|
484
|
+
*/
|
|
485
|
+
function reconstructCallSite(callSite) {
|
|
486
|
+
const { scriptName, lineNumber, columnNumber } = callSite;
|
|
487
|
+
const sourceMap = lazySourceMap().findSourceMap(scriptName);
|
|
488
|
+
if (!sourceMap) return;
|
|
489
|
+
const entry = sourceMap.findEntry(lineNumber - 1, columnNumber - 1);
|
|
490
|
+
if (!entry?.originalSource) return;
|
|
491
|
+
return {
|
|
492
|
+
__proto__: null,
|
|
493
|
+
// If the name is not found, it is an empty string to match the behavior of `util.getCallSite()`
|
|
494
|
+
functionName: entry.name ?? '',
|
|
495
|
+
scriptName: entry.originalSource,
|
|
496
|
+
lineNumber: entry.originalLine + 1,
|
|
497
|
+
column: entry.originalColumn + 1,
|
|
498
|
+
columnNumber: entry.originalColumn + 1,
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
*
|
|
504
|
+
* The call site array to map
|
|
505
|
+
* @param {CallSite[]} callSites
|
|
506
|
+
* Array of objects with the reconstructed call site
|
|
507
|
+
* @returns {CallSite[]}
|
|
508
|
+
*/
|
|
509
|
+
function mapCallSite(callSites) {
|
|
510
|
+
const result = [];
|
|
511
|
+
for (let i = 0; i < callSites.length; ++i) {
|
|
512
|
+
const callSite = callSites[i];
|
|
513
|
+
const found = reconstructCallSite(callSite);
|
|
514
|
+
ArrayPrototypePush(result, found ?? callSite);
|
|
515
|
+
}
|
|
516
|
+
return result;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* @typedef {object} CallSiteOptions // The call site options
|
|
521
|
+
* @property {boolean} sourceMap // Enable source map support
|
|
522
|
+
*/
|
|
523
|
+
|
|
524
|
+
/**
|
|
525
|
+
* Returns the callSite
|
|
526
|
+
* @param {number} frameCount
|
|
527
|
+
* @param {CallSiteOptions} options
|
|
528
|
+
* @returns {CallSite[]}
|
|
529
|
+
*/
|
|
530
|
+
function getCallSites(frameCount = 10, options) {
|
|
531
|
+
// If options is not provided check if frameCount is an object
|
|
532
|
+
if (options === undefined) {
|
|
533
|
+
if (typeof frameCount === 'object') {
|
|
534
|
+
// If frameCount is an object, it is the options object
|
|
535
|
+
options = frameCount;
|
|
536
|
+
validateObject(options, 'options');
|
|
537
|
+
if (options.sourceMap !== undefined) {
|
|
538
|
+
validateBoolean(options.sourceMap, 'options.sourceMap');
|
|
539
|
+
}
|
|
540
|
+
frameCount = 10;
|
|
541
|
+
} else {
|
|
542
|
+
// If options is not provided, set it to an empty object
|
|
543
|
+
options = {};
|
|
544
|
+
};
|
|
545
|
+
} else {
|
|
546
|
+
// If options is provided, validate it
|
|
547
|
+
validateObject(options, 'options');
|
|
548
|
+
if (options.sourceMap !== undefined) {
|
|
549
|
+
validateBoolean(options.sourceMap, 'options.sourceMap');
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
// Using kDefaultMaxCallStackSizeToCapture as reference
|
|
554
|
+
validateNumber(frameCount, 'frameCount', 1, 200);
|
|
555
|
+
// If options.sourceMaps is true or if sourceMaps are enabled but the option.sourceMaps is not set explictly to false
|
|
556
|
+
if (options.sourceMap === true || (getOptionValue('--enable-source-maps') && options.sourceMap !== false)) {
|
|
557
|
+
return mapCallSite(binding.getCallSites(frameCount));
|
|
558
|
+
}
|
|
559
|
+
return binding.getCallSites(frameCount);
|
|
560
|
+
};
|
|
561
|
+
|
|
562
|
+
// Keep the `exports =` so that various functions can still be monkeypatched
|
|
563
|
+
module.exports = {
|
|
564
|
+
_errnoException,
|
|
565
|
+
_exceptionWithHostPort,
|
|
566
|
+
_extend: deprecate(_extend,
|
|
567
|
+
'The `util._extend` API is deprecated. Please use Object.assign() instead.',
|
|
568
|
+
'DEP0060'),
|
|
569
|
+
callbackify,
|
|
570
|
+
debug: debuglog,
|
|
571
|
+
debuglog,
|
|
572
|
+
deprecate,
|
|
573
|
+
format,
|
|
574
|
+
styleText,
|
|
575
|
+
formatWithOptions,
|
|
576
|
+
// Deprecated getCallSite.
|
|
577
|
+
// This API can be removed in next semver-minor release.
|
|
578
|
+
getCallSite: deprecate(getCallSites,
|
|
579
|
+
'The `util.getCallSite` API has been renamed to `util.getCallSites()`.',
|
|
580
|
+
'ExperimentalWarning'),
|
|
581
|
+
getCallSites,
|
|
582
|
+
getSystemErrorMap,
|
|
583
|
+
getSystemErrorName,
|
|
584
|
+
getSystemErrorMessage,
|
|
585
|
+
inherits,
|
|
586
|
+
inspect,
|
|
587
|
+
isArray: deprecate(ArrayIsArray,
|
|
588
|
+
'The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.',
|
|
589
|
+
'DEP0044'),
|
|
590
|
+
isBoolean: deprecate(isBoolean,
|
|
591
|
+
'The `util.isBoolean` API is deprecated. Please use `typeof arg === "boolean"` instead.',
|
|
592
|
+
'DEP0045'),
|
|
593
|
+
isBuffer: deprecate(isBuffer,
|
|
594
|
+
'The `util.isBuffer` API is deprecated. Please use `Buffer.isBuffer()` instead.',
|
|
595
|
+
'DEP0046'),
|
|
596
|
+
isDeepStrictEqual(a, b) {
|
|
597
|
+
if (internalDeepEqual === undefined) {
|
|
598
|
+
internalDeepEqual = require('internal/util/comparisons')
|
|
599
|
+
.isDeepStrictEqual;
|
|
600
|
+
}
|
|
601
|
+
return internalDeepEqual(a, b);
|
|
602
|
+
},
|
|
603
|
+
isNull: deprecate(isNull,
|
|
604
|
+
'The `util.isNull` API is deprecated. Please use `arg === null` instead.',
|
|
605
|
+
'DEP0050'),
|
|
606
|
+
isNullOrUndefined: deprecate(isNullOrUndefined,
|
|
607
|
+
'The `util.isNullOrUndefined` API is deprecated. ' +
|
|
608
|
+
'Please use `arg === null || arg === undefined` instead.',
|
|
609
|
+
'DEP0051'),
|
|
610
|
+
isNumber: deprecate(isNumber,
|
|
611
|
+
'The `util.isNumber` API is deprecated. Please use `typeof arg === "number"` instead.',
|
|
612
|
+
'DEP0052'),
|
|
613
|
+
isString: deprecate(isString,
|
|
614
|
+
'The `util.isString` API is deprecated. Please use `typeof arg === "string"` instead.',
|
|
615
|
+
'DEP0056'),
|
|
616
|
+
isSymbol: deprecate(isSymbol,
|
|
617
|
+
'The `util.isSymbol` API is deprecated. Please use `arg === "symbol"` instead.',
|
|
618
|
+
'DEP0057'),
|
|
619
|
+
isUndefined: deprecate(isUndefined,
|
|
620
|
+
'The `util.isUndefined` API is deprecated. Please use `arg === undefined` instead.',
|
|
621
|
+
'DEP0058'),
|
|
622
|
+
isRegExp: deprecate(types.isRegExp,
|
|
623
|
+
'The `util.isRegExp` API is deprecated. Please use `arg instanceof RegExp` instead.',
|
|
624
|
+
'DEP0055'),
|
|
625
|
+
isObject: deprecate(isObject,
|
|
626
|
+
'The `util.isObject` API is deprecated. ' +
|
|
627
|
+
'Please use `arg !== null && typeof arg === "object"` instead.',
|
|
628
|
+
'DEP0053'),
|
|
629
|
+
isDate: deprecate(types.isDate,
|
|
630
|
+
'The `util.isDate` API is deprecated. Please use `arg instanceof Date` instead.',
|
|
631
|
+
'DEP0047'),
|
|
632
|
+
isError: deprecate(isError,
|
|
633
|
+
'The `util.isError` API is deprecated. ' +
|
|
634
|
+
'Please use `ObjectPrototypeToString(e) === "[object Error]" ' +
|
|
635
|
+
'|| e instanceof Error` instead.',
|
|
636
|
+
'DEP0048'),
|
|
637
|
+
isFunction: deprecate(isFunction,
|
|
638
|
+
'The `util.isFunction` API is deprecated. Please use `typeof arg === "function"` instead.',
|
|
639
|
+
'DEP0049'),
|
|
640
|
+
isPrimitive: deprecate(isPrimitive,
|
|
641
|
+
'The `util.isPrimitive` API is deprecated. ' +
|
|
642
|
+
'Please use `arg === null || ' +
|
|
643
|
+
'(typeof arg !== "object" && typeof arg !== "function")` instead.',
|
|
644
|
+
'DEP0054'),
|
|
645
|
+
log: deprecate(log,
|
|
646
|
+
'The `util.log API is deprecated. ' +
|
|
647
|
+
'Please use console.log() with a custom formatter or a third-party logger instead.',
|
|
648
|
+
'DEP0059'),
|
|
649
|
+
promisify,
|
|
650
|
+
stripVTControlCharacters,
|
|
651
|
+
toUSVString(input) {
|
|
652
|
+
return StringPrototypeToWellFormed(`${input}`);
|
|
653
|
+
},
|
|
654
|
+
get transferableAbortSignal() {
|
|
655
|
+
return lazyAbortController().transferableAbortSignal;
|
|
656
|
+
},
|
|
657
|
+
get transferableAbortController() {
|
|
658
|
+
return lazyAbortController().transferableAbortController;
|
|
659
|
+
},
|
|
660
|
+
get aborted() {
|
|
661
|
+
return lazyAbortController().aborted;
|
|
662
|
+
},
|
|
663
|
+
types,
|
|
664
|
+
parseEnv,
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
defineLazyProperties(
|
|
668
|
+
module.exports,
|
|
669
|
+
'internal/util/parse_args/parse_args',
|
|
670
|
+
['parseArgs'],
|
|
671
|
+
);
|
|
672
|
+
|
|
673
|
+
defineLazyProperties(
|
|
674
|
+
module.exports,
|
|
675
|
+
'internal/encoding',
|
|
676
|
+
['TextDecoder', 'TextEncoder'],
|
|
677
|
+
);
|
|
678
|
+
|
|
679
|
+
defineLazyProperties(
|
|
680
|
+
module.exports,
|
|
681
|
+
'internal/mime',
|
|
682
|
+
['MIMEType', 'MIMEParams'],
|
|
683
|
+
);
|
|
684
|
+
|
|
685
|
+
defineLazyProperties(
|
|
686
|
+
module.exports,
|
|
687
|
+
'internal/util/diff',
|
|
688
|
+
['diff'],
|
|
689
|
+
);
|