@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,241 @@
|
|
|
1
|
+
// Node's module resolution, once, for every place the engine resolves a
|
|
2
|
+
// name: the runtime's require, the simple loader's, and the bundler's
|
|
3
|
+
// plugin. Each hand-rolled a subset and disagreed with the others and with
|
|
4
|
+
// Node; this is the algorithm Node documents (LOAD_AS_FILE, LOAD_AS_DIRECTORY,
|
|
5
|
+
// LOAD_NODE_MODULES, package exports and imports, self-reference), over a
|
|
6
|
+
// filesystem interface, with the lane's own choices as options: which
|
|
7
|
+
// conditions, which extensions, which main fields, and the workspace rule
|
|
8
|
+
// that a member's unbuilt entry is answered by its source.
|
|
9
|
+
//
|
|
10
|
+
// This file has no imports and the resolver is one self-contained function:
|
|
11
|
+
// the source adapter injects its own source text into the engine bundle and
|
|
12
|
+
// hands it the engine's `resolve.exports` functions, in the page as on Node.
|
|
13
|
+
|
|
14
|
+
export interface ResolutionFs {
|
|
15
|
+
existsSync(path: string): boolean;
|
|
16
|
+
statSync(path: string): { isFile(): boolean; isDirectory(): boolean };
|
|
17
|
+
readFileSync(path: string, encoding: "utf8"): string | Uint8Array;
|
|
18
|
+
realpathSync?(path: string): string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ExportsResolver {
|
|
22
|
+
/** `resolve.exports`'s `resolve(pkg, entry, options)`: package exports or imports, by conditions. */
|
|
23
|
+
resolve(pkg: unknown, entry: string, options?: { conditions?: readonly string[]; unsafe?: boolean; require?: boolean; browser?: boolean }): string[] | string | void;
|
|
24
|
+
imports(pkg: unknown, entry: string, options?: { conditions?: readonly string[]; unsafe?: boolean; require?: boolean; browser?: boolean }): string[] | string | void;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface NodeResolverOptions {
|
|
28
|
+
fs: ResolutionFs;
|
|
29
|
+
exports: ExportsResolver;
|
|
30
|
+
/** Condition sets tried in order for a package `exports`/`imports` map; the first that names an existing file wins. */
|
|
31
|
+
conditionSets: readonly (readonly string[])[];
|
|
32
|
+
/** Condition sets for one package by name, where a package is resolved for a side its default sets do not name. */
|
|
33
|
+
conditionSetsFor?: (packageName: string) => readonly (readonly string[])[] | undefined;
|
|
34
|
+
/** File extensions tried after the exact path, in order. Node's are `.js`, `.json`, `.node`. */
|
|
35
|
+
extensions: readonly string[];
|
|
36
|
+
/** Package fields naming the entry of a package without `exports`, in order. Node's is `main` alone. */
|
|
37
|
+
mainFields: readonly string[];
|
|
38
|
+
/** Directories searched after the walk-up, Node's global folders; the engine's `/node_modules`. */
|
|
39
|
+
globalRoots?: readonly string[];
|
|
40
|
+
/** Directories that are workspace members: an entry their build would write is answered by its source. */
|
|
41
|
+
workspaceMembers?: () => ReadonlySet<string> | undefined;
|
|
42
|
+
/** Extensions a member's source may have, when the lane can run them. */
|
|
43
|
+
sourceExtensions?: readonly string[];
|
|
44
|
+
/** A `.cjs` entry whose whole content is a `throw` is a stub for consumers that should import; skip it for the next condition set. */
|
|
45
|
+
skipThrowingCjs?: boolean;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export interface NodeResolver {
|
|
49
|
+
/** The file a specifier names from a directory, or null when the tree does not answer it. Builtins are the caller's. */
|
|
50
|
+
resolve(specifier: string, fromDir: string): string | null;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function createNodeResolver(options: NodeResolverOptions): NodeResolver {
|
|
54
|
+
const { fs } = options;
|
|
55
|
+
const normalize = (path: string): string => {
|
|
56
|
+
const parts: string[] = [];
|
|
57
|
+
for (const part of path.split("/")) {
|
|
58
|
+
if (part === "" || part === ".") continue;
|
|
59
|
+
if (part === "..") { parts.pop(); continue; }
|
|
60
|
+
parts.push(part);
|
|
61
|
+
}
|
|
62
|
+
return `/${parts.join("/")}`;
|
|
63
|
+
};
|
|
64
|
+
const manifests = new Map<string, Record<string, unknown> | null>();
|
|
65
|
+
const isFile = (path: string): boolean => { try { return fs.existsSync(path) && fs.statSync(path).isFile(); } catch { return false; } };
|
|
66
|
+
const isDirectory = (path: string): boolean => { try { return fs.existsSync(path) && fs.statSync(path).isDirectory(); } catch { return false; } };
|
|
67
|
+
const manifest = (directory: string): Record<string, unknown> | null => {
|
|
68
|
+
const path = `${directory === "/" ? "" : directory}/package.json`;
|
|
69
|
+
if (manifests.has(path)) return manifests.get(path)!;
|
|
70
|
+
let parsed: Record<string, unknown> | null = null;
|
|
71
|
+
try { const text = fs.readFileSync(path, "utf8"); parsed = JSON.parse(typeof text === "string" ? text : new TextDecoder().decode(text)) as Record<string, unknown>; } catch { parsed = null; }
|
|
72
|
+
manifests.set(path, parsed);
|
|
73
|
+
return parsed;
|
|
74
|
+
};
|
|
75
|
+
const join = (base: string, relative: string): string => normalize(relative.startsWith("/") ? relative : `${base}/${relative}`);
|
|
76
|
+
const parent = (path: string): string => { const index = path.lastIndexOf("/"); return index <= 0 ? "/" : path.slice(0, index); };
|
|
77
|
+
|
|
78
|
+
// LOAD_AS_FILE(X): X, then X with each extension. A `.js` name whose
|
|
79
|
+
// file is absent but whose TypeScript source is beside it is that source:
|
|
80
|
+
// TypeScript's own module convention, which a project written for a
|
|
81
|
+
// loader such as tsx relies on, and which resolving `.ts` at all implies.
|
|
82
|
+
const typescriptSibling: Record<string, string> = { ".js": ".ts", ".mjs": ".mts", ".cjs": ".cts", ".jsx": ".tsx" };
|
|
83
|
+
const loadAsFile = (path: string): string | null => {
|
|
84
|
+
if (isFile(path)) return path;
|
|
85
|
+
for (const extension of options.extensions) if (isFile(path + extension)) return path + extension;
|
|
86
|
+
const dot = path.lastIndexOf(".");
|
|
87
|
+
const sibling = dot > path.lastIndexOf("/") ? typescriptSibling[path.slice(dot)] : undefined;
|
|
88
|
+
if (sibling && options.extensions.includes(sibling) && isFile(path.slice(0, dot) + sibling)) return path.slice(0, dot) + sibling;
|
|
89
|
+
return null;
|
|
90
|
+
};
|
|
91
|
+
// LOAD_INDEX(X): X/index with each extension.
|
|
92
|
+
const loadIndex = (path: string): string | null => {
|
|
93
|
+
for (const extension of options.extensions) if (isFile(`${path}/index${extension}`)) return `${path}/index${extension}`;
|
|
94
|
+
return null;
|
|
95
|
+
};
|
|
96
|
+
// LOAD_AS_DIRECTORY(X): the manifest's main field as a file or a directory, else the index.
|
|
97
|
+
const loadAsDirectory = (path: string): string | null => {
|
|
98
|
+
if (!isDirectory(path)) return null;
|
|
99
|
+
const pkg = manifest(path);
|
|
100
|
+
if (pkg) {
|
|
101
|
+
for (const field of options.mainFields) {
|
|
102
|
+
const value = pkg[field];
|
|
103
|
+
if (typeof value !== "string" || value.length === 0) continue;
|
|
104
|
+
const target = join(path, value);
|
|
105
|
+
const found = loadAsFile(target) ?? loadIndex(target);
|
|
106
|
+
if (found) return found;
|
|
107
|
+
const source = workspaceSource(path, value);
|
|
108
|
+
if (source) return source;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return loadIndex(path);
|
|
112
|
+
};
|
|
113
|
+
// A workspace member whose declared entry is not there: the source the
|
|
114
|
+
// entry was built from, `src/index.ts` for `./dist/index.mjs`.
|
|
115
|
+
const workspaceSource = (packageRoot: string, declared: string): string | null => {
|
|
116
|
+
const members = options.workspaceMembers?.();
|
|
117
|
+
if (!members || members.size === 0) return null;
|
|
118
|
+
const root = packageRoot.replace(/\/+$/u, "") || "/";
|
|
119
|
+
let real = root;
|
|
120
|
+
try { if (fs.realpathSync) real = fs.realpathSync(root); } catch { /* the alias is the path */ }
|
|
121
|
+
if (!members.has(root) && !members.has(real)) return null;
|
|
122
|
+
const parts = declared.replace(/^\.\//u, "").replace(/^\//u, "").split("/").filter((part) => part.length > 0);
|
|
123
|
+
const inner = parts.length > 1 ? parts.slice(1).join("/") : parts[0] ?? "index";
|
|
124
|
+
const stem = inner.replace(/\.(?:m|c)?[jt]sx?$/u, "");
|
|
125
|
+
const extensions = options.sourceExtensions ?? options.extensions;
|
|
126
|
+
for (const base of real === root ? [root] : [root, real]) {
|
|
127
|
+
for (const directory of ["src", ""]) {
|
|
128
|
+
const prefix = directory ? `${base}/${directory}/` : `${base}/`;
|
|
129
|
+
for (const extension of extensions) {
|
|
130
|
+
if (isFile(`${prefix}${stem}${extension}`)) return `${prefix}${stem}${extension}`;
|
|
131
|
+
if (isFile(`${prefix}${stem}/index${extension}`)) return `${prefix}${stem}/index${extension}`;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return null;
|
|
136
|
+
};
|
|
137
|
+
const targetsOf = (value: string[] | string | void): string[] => Array.isArray(value) ? value : typeof value === "string" ? [value] : [];
|
|
138
|
+
// LOAD_PACKAGE_EXPORTS: the map's answer for each condition set, the first that is a file.
|
|
139
|
+
const loadPackageExports = (packageRoot: string, pkg: Record<string, unknown>, specifier: string, packageName: string): string | null => {
|
|
140
|
+
const subpath = specifier === packageName ? "." : `.${specifier.slice(packageName.length)}`;
|
|
141
|
+
for (const conditions of options.conditionSetsFor?.(packageName) ?? options.conditionSets) {
|
|
142
|
+
let targets: string[];
|
|
143
|
+
try { targets = targetsOf(options.exports.resolve(pkg, subpath, { conditions, unsafe: true })); } catch { continue; }
|
|
144
|
+
for (const target of targets) {
|
|
145
|
+
const path = join(packageRoot, target);
|
|
146
|
+
const found = loadAsFile(path) ?? workspaceSource(packageRoot, target);
|
|
147
|
+
if (!found) continue;
|
|
148
|
+
if (options.skipThrowingCjs && found.endsWith(".cjs")) {
|
|
149
|
+
try { const text = fs.readFileSync(found, "utf8"); if (String(text).trimStart().startsWith("throw ")) continue; } catch { /* unreadable: taken as is */ }
|
|
150
|
+
}
|
|
151
|
+
return found;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return null;
|
|
155
|
+
};
|
|
156
|
+
const packageNameOf = (specifier: string): string => {
|
|
157
|
+
const parts = specifier.split("/");
|
|
158
|
+
return parts[0]!.startsWith("@") && parts.length > 1 ? `${parts[0]}/${parts[1]}` : parts[0]!;
|
|
159
|
+
};
|
|
160
|
+
// LOAD_NODE_MODULES from one directory: exports, else the package's own entry or a file under it.
|
|
161
|
+
const loadFromNodeModules = (nodeModules: string, specifier: string): string | null => {
|
|
162
|
+
const packageName = packageNameOf(specifier);
|
|
163
|
+
const packageRoot = `${nodeModules}/${packageName}`;
|
|
164
|
+
const pkg = isDirectory(packageRoot) ? manifest(packageRoot) : null;
|
|
165
|
+
if (pkg && pkg.exports !== undefined && pkg.exports !== null) {
|
|
166
|
+
const found = loadPackageExports(packageRoot, pkg, specifier, packageName);
|
|
167
|
+
if (found) return found;
|
|
168
|
+
}
|
|
169
|
+
const path = `${nodeModules}/${specifier}`;
|
|
170
|
+
return loadAsFile(path) ?? loadAsDirectory(path);
|
|
171
|
+
};
|
|
172
|
+
// LOAD_PACKAGE_SELF: a package importing itself by name through its exports.
|
|
173
|
+
const loadPackageSelf = (specifier: string, fromDir: string): string | null => {
|
|
174
|
+
const packageName = packageNameOf(specifier);
|
|
175
|
+
let directory = fromDir;
|
|
176
|
+
for (;;) {
|
|
177
|
+
const pkg = manifest(directory);
|
|
178
|
+
if (pkg && pkg.name === packageName && pkg.exports !== undefined && pkg.exports !== null) return loadPackageExports(directory, pkg, specifier, packageName);
|
|
179
|
+
if (directory === "/") return null;
|
|
180
|
+
directory = parent(directory);
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
// `#name`: the nearest manifest's imports map.
|
|
184
|
+
const loadPackageImports = (specifier: string, fromDir: string): string | null => {
|
|
185
|
+
let directory = fromDir;
|
|
186
|
+
for (;;) {
|
|
187
|
+
const pkg = manifest(directory);
|
|
188
|
+
if (pkg && pkg.imports) {
|
|
189
|
+
for (const conditions of options.conditionSets) {
|
|
190
|
+
let targets: string[];
|
|
191
|
+
try { targets = targetsOf(options.exports.imports(pkg, specifier, { conditions, unsafe: true })); } catch { continue; }
|
|
192
|
+
for (const target of targets) {
|
|
193
|
+
if (!target.startsWith(".") && !target.startsWith("/")) { const found = resolveCached(target, directory); if (found) return found; continue; }
|
|
194
|
+
const found = loadAsFile(join(directory, target));
|
|
195
|
+
if (found) return found;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
if (directory === "/") return null;
|
|
201
|
+
directory = parent(directory);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
const resolve = (specifier: string, fromDir: string): string | null => {
|
|
206
|
+
// Manifests are read once per resolution, never kept across: the tree
|
|
207
|
+
// changes under a long-lived resolver, an install links a package in.
|
|
208
|
+
manifests.clear();
|
|
209
|
+
const found = resolveCached(specifier, fromDir);
|
|
210
|
+
// Node answers the real path of what it found: a package reached through
|
|
211
|
+
// a link (pnpm lays every dependency under `.pnpm` and links it in) is
|
|
212
|
+
// then walked up from where it really is, so its own dependencies beside
|
|
213
|
+
// it are found. A filesystem without links answers the path itself.
|
|
214
|
+
if (found && fs.realpathSync) { try { return fs.realpathSync(found); } catch { return found; } }
|
|
215
|
+
return found;
|
|
216
|
+
};
|
|
217
|
+
const resolveCached = (specifier: string, fromDir: string): string | null => {
|
|
218
|
+
if (specifier.startsWith("#")) return loadPackageImports(specifier, fromDir);
|
|
219
|
+
if (specifier.startsWith("./") || specifier.startsWith("../") || specifier.startsWith("/") || specifier === "." || specifier === "..") {
|
|
220
|
+
const path = join(fromDir, specifier);
|
|
221
|
+
return loadAsFile(path) ?? loadAsDirectory(path);
|
|
222
|
+
}
|
|
223
|
+
const self = loadPackageSelf(specifier, fromDir);
|
|
224
|
+
if (self) return self;
|
|
225
|
+
let directory = fromDir;
|
|
226
|
+
for (;;) {
|
|
227
|
+
if (!directory.endsWith("/node_modules")) {
|
|
228
|
+
const found = loadFromNodeModules(`${directory === "/" ? "" : directory}/node_modules`, specifier);
|
|
229
|
+
if (found) return found;
|
|
230
|
+
}
|
|
231
|
+
if (directory === "/") break;
|
|
232
|
+
directory = parent(directory);
|
|
233
|
+
}
|
|
234
|
+
for (const root of options.globalRoots ?? []) {
|
|
235
|
+
const found = loadFromNodeModules(root, specifier);
|
|
236
|
+
if (found) return found;
|
|
237
|
+
}
|
|
238
|
+
return null;
|
|
239
|
+
};
|
|
240
|
+
return { resolve };
|
|
241
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// One resolver for every name the engine resolves: the runtime's require, the
|
|
2
|
+
// simple loader's, and the bundler's plugin. Each had a hand-rolled subset of
|
|
3
|
+
// Node's algorithm; they disagreed with each other and with Node, and every app
|
|
4
|
+
// found a new gap. `node-resolution.ts` is that algorithm; this is where the
|
|
5
|
+
// lanes take it from, one resolver per filesystem, profile and extension set.
|
|
6
|
+
//
|
|
7
|
+
// The source adapter injected both into the bundle beside the `resolve.exports`
|
|
8
|
+
// import; in the fork they are real modules, so every lane can import them.
|
|
9
|
+
import { imports, resolve as resolveExports } from 'resolve.exports';
|
|
10
|
+
import { createNodeResolver, type NodeResolver, type ResolutionFs } from './node-resolution';
|
|
11
|
+
|
|
12
|
+
const __nodeResolvers = new WeakMap<ResolutionFs, Map<string, NodeResolver>>();
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The runtime resolves as Node's require does; the bundler as a browser bundler
|
|
16
|
+
* does, module and import entries first and TypeScript sources.
|
|
17
|
+
*/
|
|
18
|
+
export function __nodeResolverFor(fs: ResolutionFs, profile: 'runtime' | 'bundler', extensions?: readonly string[]): NodeResolver {
|
|
19
|
+
let byProfile = __nodeResolvers.get(fs);
|
|
20
|
+
if (!byProfile) { byProfile = new Map(); __nodeResolvers.set(fs, byProfile); }
|
|
21
|
+
const key = profile + ':' + (extensions || []).join(',');
|
|
22
|
+
let resolver = byProfile.get(key);
|
|
23
|
+
if (resolver) return resolver;
|
|
24
|
+
const members = () => (globalThis as Record<string, unknown>).__browserRuntimeWorkspaceMembers as ReadonlySet<string> | undefined;
|
|
25
|
+
const exportsResolver = { resolve: resolveExports, imports };
|
|
26
|
+
resolver = profile === 'bundler'
|
|
27
|
+
? createNodeResolver({ fs, exports: exportsResolver, conditionSets: [['browser', 'module', 'import', 'default'], ['require', 'default']], extensions: (extensions || ['.js', '.json']).filter((extension) => extension !== ''), mainFields: ['module', 'main'], globalRoots: ['/node_modules', '/project/node_modules'], workspaceMembers: members })
|
|
28
|
+
: createNodeResolver({ fs, exports: exportsResolver, conditionSets: [['require', 'node', 'default'], ['import', 'node', 'default']],
|
|
29
|
+
// Node's require probes `.ts`, `.mts` and `.cts` too once it strips types (22.18), and the loader here does.
|
|
30
|
+
extensions: ['.js', '.json', '.node', '.cjs', '.mjs', '.ts', '.mts', '.cts'], mainFields: ['main', 'module'], globalRoots: ['/node_modules'], workspaceMembers: members, sourceExtensions: ['.js', '.mjs', '.cjs'], skipThrowingCjs: true });
|
|
31
|
+
byProfile.set(key, resolver);
|
|
32
|
+
return resolver;
|
|
33
|
+
}
|