@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,523 @@
|
|
|
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
|
+
DateNow,
|
|
26
|
+
FunctionPrototypeBind,
|
|
27
|
+
FunctionPrototypeCall,
|
|
28
|
+
ObjectDefineProperties,
|
|
29
|
+
ObjectSetPrototypeOf,
|
|
30
|
+
Promise,
|
|
31
|
+
PromiseReject,
|
|
32
|
+
StringPrototypeSlice,
|
|
33
|
+
} = primordials;
|
|
34
|
+
|
|
35
|
+
const {
|
|
36
|
+
clearLine,
|
|
37
|
+
clearScreenDown,
|
|
38
|
+
cursorTo,
|
|
39
|
+
moveCursor,
|
|
40
|
+
} = require('internal/readline/callbacks');
|
|
41
|
+
const emitKeypressEvents = require('internal/readline/emitKeypressEvents');
|
|
42
|
+
const promises = require('readline/promises');
|
|
43
|
+
|
|
44
|
+
const {
|
|
45
|
+
AbortError,
|
|
46
|
+
} = require('internal/errors');
|
|
47
|
+
const {
|
|
48
|
+
inspect,
|
|
49
|
+
} = require('internal/util/inspect');
|
|
50
|
+
const {
|
|
51
|
+
kEmptyObject,
|
|
52
|
+
promisify,
|
|
53
|
+
SymbolDispose,
|
|
54
|
+
} = require('internal/util');
|
|
55
|
+
const { validateAbortSignal } = require('internal/validators');
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @typedef {import('./stream.js').Readable} Readable
|
|
59
|
+
* @typedef {import('./stream.js').Writable} Writable
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
const {
|
|
63
|
+
Interface: _Interface,
|
|
64
|
+
InterfaceConstructor,
|
|
65
|
+
kAddHistory,
|
|
66
|
+
kDecoder,
|
|
67
|
+
kDeleteLeft,
|
|
68
|
+
kDeleteLineLeft,
|
|
69
|
+
kDeleteLineRight,
|
|
70
|
+
kDeleteRight,
|
|
71
|
+
kDeleteWordLeft,
|
|
72
|
+
kDeleteWordRight,
|
|
73
|
+
kGetDisplayPos,
|
|
74
|
+
kHistoryNext,
|
|
75
|
+
kHistoryPrev,
|
|
76
|
+
kInsertString,
|
|
77
|
+
kLine,
|
|
78
|
+
kLine_buffer,
|
|
79
|
+
kMoveCursor,
|
|
80
|
+
kNormalWrite,
|
|
81
|
+
kOldPrompt,
|
|
82
|
+
kOnLine,
|
|
83
|
+
kPreviousKey,
|
|
84
|
+
kPrompt,
|
|
85
|
+
kQuestion,
|
|
86
|
+
kQuestionCallback,
|
|
87
|
+
kQuestionCancel,
|
|
88
|
+
kRefreshLine,
|
|
89
|
+
kSawKeyPress,
|
|
90
|
+
kSawReturnAt,
|
|
91
|
+
kSetRawMode,
|
|
92
|
+
kTabComplete,
|
|
93
|
+
kTabCompleter,
|
|
94
|
+
kTtyWrite,
|
|
95
|
+
kWordLeft,
|
|
96
|
+
kWordRight,
|
|
97
|
+
kWriteToOutput,
|
|
98
|
+
} = require('internal/readline/interface');
|
|
99
|
+
let addAbortListener;
|
|
100
|
+
|
|
101
|
+
function Interface(input, output, completer, terminal) {
|
|
102
|
+
if (!(this instanceof Interface)) {
|
|
103
|
+
return new Interface(input, output, completer, terminal);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (input?.input &&
|
|
107
|
+
typeof input.completer === 'function' && input.completer.length !== 2) {
|
|
108
|
+
const { completer } = input;
|
|
109
|
+
input.completer = (v, cb) => cb(null, completer(v));
|
|
110
|
+
} else if (typeof completer === 'function' && completer.length !== 2) {
|
|
111
|
+
const realCompleter = completer;
|
|
112
|
+
completer = (v, cb) => cb(null, realCompleter(v));
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
FunctionPrototypeCall(InterfaceConstructor, this,
|
|
116
|
+
input, output, completer, terminal);
|
|
117
|
+
|
|
118
|
+
if (process.env.TERM === 'dumb') {
|
|
119
|
+
this._ttyWrite = FunctionPrototypeBind(_ttyWriteDumb, this);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
ObjectSetPrototypeOf(Interface.prototype, _Interface.prototype);
|
|
124
|
+
ObjectSetPrototypeOf(Interface, _Interface);
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Displays `query` by writing it to the `output`.
|
|
128
|
+
* @param {string} query
|
|
129
|
+
* @param {{ signal?: AbortSignal; }} [options]
|
|
130
|
+
* @param {Function} cb
|
|
131
|
+
* @returns {void}
|
|
132
|
+
*/
|
|
133
|
+
Interface.prototype.question = function question(query, options, cb) {
|
|
134
|
+
cb = typeof options === 'function' ? options : cb;
|
|
135
|
+
if (options === null || typeof options !== 'object') {
|
|
136
|
+
options = kEmptyObject;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (options.signal) {
|
|
140
|
+
validateAbortSignal(options.signal, 'options.signal');
|
|
141
|
+
if (options.signal.aborted) {
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
const onAbort = () => {
|
|
146
|
+
this[kQuestionCancel]();
|
|
147
|
+
};
|
|
148
|
+
addAbortListener ??= require('internal/events/abort_listener').addAbortListener;
|
|
149
|
+
const disposable = addAbortListener(options.signal, onAbort);
|
|
150
|
+
const originalCb = cb;
|
|
151
|
+
cb = typeof cb === 'function' ? (answer) => {
|
|
152
|
+
disposable[SymbolDispose]();
|
|
153
|
+
return originalCb(answer);
|
|
154
|
+
} : disposable[SymbolDispose];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (typeof cb === 'function') {
|
|
158
|
+
this[kQuestion](query, cb);
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
Interface.prototype.question[promisify.custom] = function question(query, options) {
|
|
162
|
+
if (options === null || typeof options !== 'object') {
|
|
163
|
+
options = kEmptyObject;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
if (options.signal?.aborted) {
|
|
167
|
+
return PromiseReject(
|
|
168
|
+
new AbortError(undefined, { cause: options.signal.reason }));
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return new Promise((resolve, reject) => {
|
|
172
|
+
let cb = resolve;
|
|
173
|
+
|
|
174
|
+
if (options.signal) {
|
|
175
|
+
const onAbort = () => {
|
|
176
|
+
reject(new AbortError(undefined, { cause: options.signal.reason }));
|
|
177
|
+
};
|
|
178
|
+
addAbortListener ??= require('internal/events/abort_listener').addAbortListener;
|
|
179
|
+
const disposable = addAbortListener(options.signal, onAbort);
|
|
180
|
+
cb = (answer) => {
|
|
181
|
+
disposable[SymbolDispose]();
|
|
182
|
+
resolve(answer);
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
this.question(query, options, cb);
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Creates a new `readline.Interface` instance.
|
|
192
|
+
* @param {Readable | {
|
|
193
|
+
* input: Readable;
|
|
194
|
+
* output: Writable;
|
|
195
|
+
* completer?: Function;
|
|
196
|
+
* terminal?: boolean;
|
|
197
|
+
* history?: string[];
|
|
198
|
+
* historySize?: number;
|
|
199
|
+
* removeHistoryDuplicates?: boolean;
|
|
200
|
+
* prompt?: string;
|
|
201
|
+
* crlfDelay?: number;
|
|
202
|
+
* escapeCodeTimeout?: number;
|
|
203
|
+
* tabSize?: number;
|
|
204
|
+
* signal?: AbortSignal;
|
|
205
|
+
* }} input
|
|
206
|
+
* @param {Writable} [output]
|
|
207
|
+
* @param {Function} [completer]
|
|
208
|
+
* @param {boolean} [terminal]
|
|
209
|
+
* @returns {Interface}
|
|
210
|
+
*/
|
|
211
|
+
function createInterface(input, output, completer, terminal) {
|
|
212
|
+
return new Interface(input, output, completer, terminal);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
ObjectDefineProperties(Interface.prototype, {
|
|
216
|
+
// Redirect internal prototype methods to the underscore notation for backward
|
|
217
|
+
// compatibility.
|
|
218
|
+
[kSetRawMode]: {
|
|
219
|
+
__proto__: null,
|
|
220
|
+
get() {
|
|
221
|
+
return this._setRawMode;
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
[kOnLine]: {
|
|
225
|
+
__proto__: null,
|
|
226
|
+
get() {
|
|
227
|
+
return this._onLine;
|
|
228
|
+
},
|
|
229
|
+
},
|
|
230
|
+
[kWriteToOutput]: {
|
|
231
|
+
__proto__: null,
|
|
232
|
+
get() {
|
|
233
|
+
return this._writeToOutput;
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
[kAddHistory]: {
|
|
237
|
+
__proto__: null,
|
|
238
|
+
get() {
|
|
239
|
+
return this._addHistory;
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
[kRefreshLine]: {
|
|
243
|
+
__proto__: null,
|
|
244
|
+
get() {
|
|
245
|
+
return this._refreshLine;
|
|
246
|
+
},
|
|
247
|
+
},
|
|
248
|
+
[kNormalWrite]: {
|
|
249
|
+
__proto__: null,
|
|
250
|
+
get() {
|
|
251
|
+
return this._normalWrite;
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
[kInsertString]: {
|
|
255
|
+
__proto__: null,
|
|
256
|
+
get() {
|
|
257
|
+
return this._insertString;
|
|
258
|
+
},
|
|
259
|
+
},
|
|
260
|
+
[kTabComplete]: {
|
|
261
|
+
__proto__: null,
|
|
262
|
+
get() {
|
|
263
|
+
return this._tabComplete;
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
[kWordLeft]: {
|
|
267
|
+
__proto__: null,
|
|
268
|
+
get() {
|
|
269
|
+
return this._wordLeft;
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
[kWordRight]: {
|
|
273
|
+
__proto__: null,
|
|
274
|
+
get() {
|
|
275
|
+
return this._wordRight;
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
[kDeleteLeft]: {
|
|
279
|
+
__proto__: null,
|
|
280
|
+
get() {
|
|
281
|
+
return this._deleteLeft;
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
[kDeleteRight]: {
|
|
285
|
+
__proto__: null,
|
|
286
|
+
get() {
|
|
287
|
+
return this._deleteRight;
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
[kDeleteWordLeft]: {
|
|
291
|
+
__proto__: null,
|
|
292
|
+
get() {
|
|
293
|
+
return this._deleteWordLeft;
|
|
294
|
+
},
|
|
295
|
+
},
|
|
296
|
+
[kDeleteWordRight]: {
|
|
297
|
+
__proto__: null,
|
|
298
|
+
get() {
|
|
299
|
+
return this._deleteWordRight;
|
|
300
|
+
},
|
|
301
|
+
},
|
|
302
|
+
[kDeleteLineLeft]: {
|
|
303
|
+
__proto__: null,
|
|
304
|
+
get() {
|
|
305
|
+
return this._deleteLineLeft;
|
|
306
|
+
},
|
|
307
|
+
},
|
|
308
|
+
[kDeleteLineRight]: {
|
|
309
|
+
__proto__: null,
|
|
310
|
+
get() {
|
|
311
|
+
return this._deleteLineRight;
|
|
312
|
+
},
|
|
313
|
+
},
|
|
314
|
+
[kLine]: {
|
|
315
|
+
__proto__: null,
|
|
316
|
+
get() {
|
|
317
|
+
return this._line;
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
[kHistoryNext]: {
|
|
321
|
+
__proto__: null,
|
|
322
|
+
get() {
|
|
323
|
+
return this._historyNext;
|
|
324
|
+
},
|
|
325
|
+
},
|
|
326
|
+
[kHistoryPrev]: {
|
|
327
|
+
__proto__: null,
|
|
328
|
+
get() {
|
|
329
|
+
return this._historyPrev;
|
|
330
|
+
},
|
|
331
|
+
},
|
|
332
|
+
[kGetDisplayPos]: {
|
|
333
|
+
__proto__: null,
|
|
334
|
+
get() {
|
|
335
|
+
return this._getDisplayPos;
|
|
336
|
+
},
|
|
337
|
+
},
|
|
338
|
+
[kMoveCursor]: {
|
|
339
|
+
__proto__: null,
|
|
340
|
+
get() {
|
|
341
|
+
return this._moveCursor;
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
[kTtyWrite]: {
|
|
345
|
+
__proto__: null,
|
|
346
|
+
get() {
|
|
347
|
+
return this._ttyWrite;
|
|
348
|
+
},
|
|
349
|
+
},
|
|
350
|
+
|
|
351
|
+
// Defining proxies for the internal instance properties for backward
|
|
352
|
+
// compatibility.
|
|
353
|
+
_decoder: {
|
|
354
|
+
__proto__: null,
|
|
355
|
+
get() {
|
|
356
|
+
return this[kDecoder];
|
|
357
|
+
},
|
|
358
|
+
set(value) {
|
|
359
|
+
this[kDecoder] = value;
|
|
360
|
+
},
|
|
361
|
+
},
|
|
362
|
+
_line_buffer: {
|
|
363
|
+
__proto__: null,
|
|
364
|
+
get() {
|
|
365
|
+
return this[kLine_buffer];
|
|
366
|
+
},
|
|
367
|
+
set(value) {
|
|
368
|
+
this[kLine_buffer] = value;
|
|
369
|
+
},
|
|
370
|
+
},
|
|
371
|
+
_oldPrompt: {
|
|
372
|
+
__proto__: null,
|
|
373
|
+
get() {
|
|
374
|
+
return this[kOldPrompt];
|
|
375
|
+
},
|
|
376
|
+
set(value) {
|
|
377
|
+
this[kOldPrompt] = value;
|
|
378
|
+
},
|
|
379
|
+
},
|
|
380
|
+
_previousKey: {
|
|
381
|
+
__proto__: null,
|
|
382
|
+
get() {
|
|
383
|
+
return this[kPreviousKey];
|
|
384
|
+
},
|
|
385
|
+
set(value) {
|
|
386
|
+
this[kPreviousKey] = value;
|
|
387
|
+
},
|
|
388
|
+
},
|
|
389
|
+
_prompt: {
|
|
390
|
+
__proto__: null,
|
|
391
|
+
get() {
|
|
392
|
+
return this[kPrompt];
|
|
393
|
+
},
|
|
394
|
+
set(value) {
|
|
395
|
+
this[kPrompt] = value;
|
|
396
|
+
},
|
|
397
|
+
},
|
|
398
|
+
_questionCallback: {
|
|
399
|
+
__proto__: null,
|
|
400
|
+
get() {
|
|
401
|
+
return this[kQuestionCallback];
|
|
402
|
+
},
|
|
403
|
+
set(value) {
|
|
404
|
+
this[kQuestionCallback] = value;
|
|
405
|
+
},
|
|
406
|
+
},
|
|
407
|
+
_sawKeyPress: {
|
|
408
|
+
__proto__: null,
|
|
409
|
+
get() {
|
|
410
|
+
return this[kSawKeyPress];
|
|
411
|
+
},
|
|
412
|
+
set(value) {
|
|
413
|
+
this[kSawKeyPress] = value;
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
_sawReturnAt: {
|
|
417
|
+
__proto__: null,
|
|
418
|
+
get() {
|
|
419
|
+
return this[kSawReturnAt];
|
|
420
|
+
},
|
|
421
|
+
set(value) {
|
|
422
|
+
this[kSawReturnAt] = value;
|
|
423
|
+
},
|
|
424
|
+
},
|
|
425
|
+
});
|
|
426
|
+
|
|
427
|
+
// Make internal methods public for backward compatibility.
|
|
428
|
+
Interface.prototype._setRawMode = _Interface.prototype[kSetRawMode];
|
|
429
|
+
Interface.prototype._onLine = _Interface.prototype[kOnLine];
|
|
430
|
+
Interface.prototype._writeToOutput = _Interface.prototype[kWriteToOutput];
|
|
431
|
+
Interface.prototype._addHistory = _Interface.prototype[kAddHistory];
|
|
432
|
+
Interface.prototype._refreshLine = _Interface.prototype[kRefreshLine];
|
|
433
|
+
Interface.prototype._normalWrite = _Interface.prototype[kNormalWrite];
|
|
434
|
+
Interface.prototype._insertString = _Interface.prototype[kInsertString];
|
|
435
|
+
Interface.prototype._tabComplete = function(lastKeypressWasTab) {
|
|
436
|
+
// Overriding parent method because `this.completer` in the legacy
|
|
437
|
+
// implementation takes a callback instead of being an async function.
|
|
438
|
+
this.pause();
|
|
439
|
+
const string = StringPrototypeSlice(this.line, 0, this.cursor);
|
|
440
|
+
this.completer(string, (err, value) => {
|
|
441
|
+
this.resume();
|
|
442
|
+
|
|
443
|
+
if (err) {
|
|
444
|
+
this._writeToOutput(`Tab completion error: ${inspect(err)}`);
|
|
445
|
+
return;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
this[kTabCompleter](lastKeypressWasTab, value);
|
|
449
|
+
});
|
|
450
|
+
};
|
|
451
|
+
Interface.prototype._wordLeft = _Interface.prototype[kWordLeft];
|
|
452
|
+
Interface.prototype._wordRight = _Interface.prototype[kWordRight];
|
|
453
|
+
Interface.prototype._deleteLeft = _Interface.prototype[kDeleteLeft];
|
|
454
|
+
Interface.prototype._deleteRight = _Interface.prototype[kDeleteRight];
|
|
455
|
+
Interface.prototype._deleteWordLeft = _Interface.prototype[kDeleteWordLeft];
|
|
456
|
+
Interface.prototype._deleteWordRight = _Interface.prototype[kDeleteWordRight];
|
|
457
|
+
Interface.prototype._deleteLineLeft = _Interface.prototype[kDeleteLineLeft];
|
|
458
|
+
Interface.prototype._deleteLineRight = _Interface.prototype[kDeleteLineRight];
|
|
459
|
+
Interface.prototype._line = _Interface.prototype[kLine];
|
|
460
|
+
Interface.prototype._historyNext = _Interface.prototype[kHistoryNext];
|
|
461
|
+
Interface.prototype._historyPrev = _Interface.prototype[kHistoryPrev];
|
|
462
|
+
Interface.prototype._getDisplayPos = _Interface.prototype[kGetDisplayPos];
|
|
463
|
+
Interface.prototype._getCursorPos = _Interface.prototype.getCursorPos;
|
|
464
|
+
Interface.prototype._moveCursor = _Interface.prototype[kMoveCursor];
|
|
465
|
+
Interface.prototype._ttyWrite = _Interface.prototype[kTtyWrite];
|
|
466
|
+
|
|
467
|
+
function _ttyWriteDumb(s, key) {
|
|
468
|
+
key ||= kEmptyObject;
|
|
469
|
+
if (key.name === 'escape') return;
|
|
470
|
+
|
|
471
|
+
if (this[kSawReturnAt] && key.name !== 'enter')
|
|
472
|
+
this[kSawReturnAt] = 0;
|
|
473
|
+
|
|
474
|
+
if (key.ctrl) {
|
|
475
|
+
if (key.name === 'c') {
|
|
476
|
+
if (this.listenerCount('SIGINT') > 0) {
|
|
477
|
+
this.emit('SIGINT');
|
|
478
|
+
} else {
|
|
479
|
+
// This readline instance is finished
|
|
480
|
+
this.close();
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
return;
|
|
484
|
+
} else if (key.name === 'd') {
|
|
485
|
+
this.close();
|
|
486
|
+
return;
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
switch (key.name) {
|
|
491
|
+
case 'return': // Carriage return, i.e. \r
|
|
492
|
+
this[kSawReturnAt] = DateNow();
|
|
493
|
+
this._line();
|
|
494
|
+
break;
|
|
495
|
+
|
|
496
|
+
case 'enter':
|
|
497
|
+
// When key interval > crlfDelay
|
|
498
|
+
if (this[kSawReturnAt] === 0 ||
|
|
499
|
+
DateNow() - this[kSawReturnAt] > this.crlfDelay) {
|
|
500
|
+
this._line();
|
|
501
|
+
}
|
|
502
|
+
this[kSawReturnAt] = 0;
|
|
503
|
+
break;
|
|
504
|
+
|
|
505
|
+
default:
|
|
506
|
+
if (typeof s === 'string' && s) {
|
|
507
|
+
this.line += s;
|
|
508
|
+
this.cursor += s.length;
|
|
509
|
+
this._writeToOutput(s);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
module.exports = {
|
|
515
|
+
Interface,
|
|
516
|
+
clearLine,
|
|
517
|
+
clearScreenDown,
|
|
518
|
+
createInterface,
|
|
519
|
+
cursorTo,
|
|
520
|
+
emitKeypressEvents,
|
|
521
|
+
moveCursor,
|
|
522
|
+
promises,
|
|
523
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one way a binding or a hand-bound internal reaches a vendored file.
|
|
3
|
+
*
|
|
4
|
+
* It exists as a file of its own, importing nothing, because the loader
|
|
5
|
+
* imports the binding and the internals to build its tables: a binding that
|
|
6
|
+
* imported the loader back put the two in a cycle, and which of them a bundler
|
|
7
|
+
* evaluates first is then its own decision. The loader installs itself here
|
|
8
|
+
* when it loads; everything below it asks through this and is a leaf.
|
|
9
|
+
*/
|
|
10
|
+
export type LibRequire = (specifier: string) => unknown;
|
|
11
|
+
|
|
12
|
+
// `var`, not `let`: hoisted and already `undefined` whatever the order.
|
|
13
|
+
// eslint-disable-next-line no-var, vars-on-top
|
|
14
|
+
var installed: LibRequire | undefined;
|
|
15
|
+
|
|
16
|
+
/** The loader takes this door once, at the bottom of its own body. */
|
|
17
|
+
export function setLibRequire(lib: LibRequire): void {
|
|
18
|
+
installed = lib;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** A vendored Node file, by the name Node's own `require` calls it. */
|
|
22
|
+
export function libRequire(specifier: string): unknown {
|
|
23
|
+
if (installed === undefined) {
|
|
24
|
+
throw new Error(`node-lib: '${specifier}' was asked for before the loader was installed`);
|
|
25
|
+
}
|
|
26
|
+
return installed(specifier);
|
|
27
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The small modules that are Node's own file and a binding of the realm's.
|
|
3
|
+
*
|
|
4
|
+
* Each one here was a hand-written imitation in `src/shims/`, and each is now
|
|
5
|
+
* `nodejs/node` v22.18.0's own file: `assert` with its `AssertionError`,
|
|
6
|
+
* `CallTracker` and the whole of `deepStrictEqual`; `querystring`, whose
|
|
7
|
+
* escaping and parsing are its own; `punycode`, which is one pure algorithm;
|
|
8
|
+
* `constants`; and `diagnostics_channel`, whose subscription and
|
|
9
|
+
* `TracingChannel` semantics every observability library reads.
|
|
10
|
+
*
|
|
11
|
+
* `domain` is not here, and its own entry in the module table says why.
|
|
12
|
+
*
|
|
13
|
+
* The rule for this file: it binds, it does not implement.
|
|
14
|
+
*/
|
|
15
|
+
import { lazyModule, lazyExport } from './lazy';
|
|
16
|
+
|
|
17
|
+
/** `assert` is a callable module -- `assert(value)` is `assert.ok(value)`. */
|
|
18
|
+
export const assertModule = lazyExport<Record<string, unknown>>('assert', 'ok') as unknown as Record<string, unknown>;
|
|
19
|
+
export const querystringModule = lazyModule<Record<string, unknown>>('querystring');
|
|
20
|
+
export const punycodeModule = lazyModule<Record<string, unknown>>('punycode');
|
|
21
|
+
export const constantsModule = lazyModule<Record<string, unknown>>('constants');
|
|
22
|
+
export const diagnosticsChannelModule = lazyModule<Record<string, unknown>>('diagnostics_channel');
|
|
23
|
+
|
|
24
|
+
/** `os`, on a binding of the engine's own host answers. */
|
|
25
|
+
export const osModule = lazyModule<Record<string, unknown>>('os');
|
|
26
|
+
|
|
27
|
+
/** `tty`, on the `tty_wrap` binding `child_process` already brought. */
|
|
28
|
+
export const ttyModule = lazyModule<Record<string, unknown>>('tty');
|
|
29
|
+
|
|
30
|
+
/** `readline`, with Node's own `Interface`, its key handling and its promises. */
|
|
31
|
+
export const readlineModule = lazyModule<Record<string, unknown>>('readline');
|
|
32
|
+
export const readlinePromisesModule = lazyModule<Record<string, unknown>>('readline/promises');
|
|
33
|
+
|
|
34
|
+
/** `zlib`, on zlib's own inflate and deflate. */
|
|
35
|
+
export const zlibModule = lazyModule<Record<string, unknown>>('zlib');
|