cf-workers-native 0.0.0-stage → 0.1.2-beta.local.sha2f5e4e6956f4
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 +21 -0
- package/Package.swift +25 -0
- package/README.md +92 -2
- package/dist/android.d.ts +2 -0
- package/dist/android.js +1 -0
- package/dist/browser/abort/index.d.ts +13 -0
- package/dist/browser/abort/index.js +66 -0
- package/dist/browser/body/index.d.ts +24 -0
- package/dist/browser/body/index.js +116 -0
- package/dist/browser/body/stream-body.d.ts +13 -0
- package/dist/browser/body/stream-body.js +84 -0
- package/dist/browser/documents/body.d.ts +3 -0
- package/dist/browser/documents/body.js +48 -0
- package/dist/browser/documents/form-body.d.ts +1 -0
- package/dist/browser/documents/form-body.js +54 -0
- package/dist/browser/documents/host.d.ts +11 -0
- package/dist/browser/documents/host.js +256 -0
- package/dist/browser/documents/links-source.d.ts +1 -0
- package/dist/browser/documents/links-source.js +1 -0
- package/dist/browser/documents/links.d.ts +1 -0
- package/dist/browser/documents/links.js +33 -0
- package/dist/browser/documents/page-config.d.ts +5 -0
- package/dist/browser/documents/page-config.js +5 -0
- package/dist/browser/documents/page-source.d.ts +1 -0
- package/dist/browser/documents/page-source.js +1 -0
- package/dist/browser/documents/page.d.ts +2 -0
- package/dist/browser/documents/page.js +153 -0
- package/dist/browser/documents/registration.d.ts +5 -0
- package/dist/browser/documents/registration.js +75 -0
- package/dist/browser/documents/runtime.d.ts +7 -0
- package/dist/browser/documents/runtime.js +161 -0
- package/dist/browser/documents/service-worker.js +285 -0
- package/dist/browser/encoding/index.d.ts +7 -0
- package/dist/browser/encoding/index.js +3 -0
- package/dist/browser/fetch/LICENSE-3RD-PARTY.md +9 -0
- package/dist/browser/fetch/LICENSE-APACHE +177 -0
- package/dist/browser/fetch/host-call.d.ts +3 -0
- package/dist/browser/fetch/host-call.js +67 -0
- package/dist/browser/fetch/index.d.ts +5 -0
- package/dist/browser/fetch/index.js +96 -0
- package/dist/browser/fetch/interop.d.ts +6 -0
- package/dist/browser/fetch/interop.js +48 -0
- package/dist/browser/fetch/native-network.d.ts +20 -0
- package/dist/browser/fetch/native-network.js +233 -0
- package/dist/browser/fetch/outbound.d.ts +2 -0
- package/dist/browser/fetch/outbound.js +11 -0
- package/dist/browser/fetch/relay.d.ts +7 -0
- package/dist/browser/fetch/relay.js +100 -0
- package/dist/browser/fetch/scope.d.ts +8 -0
- package/dist/browser/fetch/scope.js +108 -0
- package/dist/browser/fetch/transport.d.ts +39 -0
- package/dist/browser/fetch/transport.js +136 -0
- package/dist/browser/headers/LICENSE-3RD-PARTY.md +9 -0
- package/dist/browser/headers/LICENSE-APACHE +177 -0
- package/dist/browser/headers/index.d.ts +20 -0
- package/dist/browser/headers/index.js +194 -0
- package/dist/browser/isolated/bridge.d.ts +8 -0
- package/dist/browser/isolated/bridge.js +267 -0
- package/dist/browser/isolated/protocol.d.ts +40 -0
- package/dist/browser/isolated/protocol.js +1 -0
- package/dist/browser/isolated/transport.d.ts +2 -0
- package/dist/browser/isolated/transport.js +157 -0
- package/dist/browser/request/LICENSE-3RD-PARTY.md +10 -0
- package/dist/browser/request/LICENSE-APACHE +177 -0
- package/dist/browser/request/index.d.ts +48 -0
- package/dist/browser/request/index.js +182 -0
- package/dist/browser/response/LICENSE-3RD-PARTY.md +10 -0
- package/dist/browser/response/LICENSE-APACHE +177 -0
- package/dist/browser/response/index.d.ts +43 -0
- package/dist/browser/response/index.js +192 -0
- package/dist/browser/response/status.d.ts +1 -0
- package/dist/browser/response/status.js +75 -0
- package/dist/browser/structured-clone/index.d.ts +1 -0
- package/dist/browser/structured-clone/index.js +479 -0
- package/dist/cloudflare/apis/cloudflare-node/index.d.ts +18 -0
- package/dist/cloudflare/apis/cloudflare-node/index.js +150 -0
- package/dist/cloudflare/apis/cloudflare-workers/index.d.ts +8 -0
- package/dist/cloudflare/apis/cloudflare-workers/index.js +37 -0
- package/dist/cloudflare/apis/types.d.ts +7 -0
- package/dist/cloudflare/apis/types.js +1 -0
- package/dist/cloudflare/bindings/config.d.ts +42 -0
- package/dist/cloudflare/bindings/config.js +280 -0
- package/dist/cloudflare/bindings/kv/contract.d.ts +6 -0
- package/dist/cloudflare/bindings/kv/contract.js +181 -0
- package/dist/cloudflare/bindings/kv/index.d.ts +18 -0
- package/dist/cloudflare/bindings/kv/index.js +61 -0
- package/dist/cloudflare/bindings/kv/storage.d.ts +25 -0
- package/dist/cloudflare/bindings/kv/storage.js +320 -0
- package/dist/cloudflare/bindings/kv/types.d.ts +50 -0
- package/dist/cloudflare/bindings/kv/types.js +1 -0
- package/dist/cloudflare/bindings/remote.d.ts +8 -0
- package/dist/cloudflare/bindings/remote.js +261 -0
- package/dist/cloudflare/workers/contract.d.ts +8 -0
- package/dist/cloudflare/workers/contract.js +65 -0
- package/dist/cloudflare/workers/feature.d.ts +10 -0
- package/dist/cloudflare/workers/feature.js +28 -0
- package/dist/cloudflare/workers/runtime.d.ts +23 -0
- package/dist/cloudflare/workers/runtime.js +121 -0
- package/dist/cloudflare/workers/types.d.ts +49 -0
- package/dist/cloudflare/workers/types.js +1 -0
- package/dist/cloudflare/workers/worker-runtime.d.ts +44 -0
- package/dist/cloudflare/workers/worker-runtime.js +267 -0
- package/dist/compat/assert/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/assert/LICENSE-APACHE +177 -0
- package/dist/compat/assert/assertion-error.d.ts +26 -0
- package/dist/compat/assert/assertion-error.js +468 -0
- package/dist/compat/assert/diff.d.ts +26 -0
- package/dist/compat/assert/diff.js +329 -0
- package/dist/compat/assert/errors.d.ts +11 -0
- package/dist/compat/assert/errors.js +55 -0
- package/dist/compat/assert/index.cjs +24 -0
- package/dist/compat/assert/index.d.cts +43 -0
- package/dist/compat/assert/index.d.ts +50 -0
- package/dist/compat/assert/index.js +858 -0
- package/dist/compat/async-hooks/LICENSE-APACHE +177 -0
- package/dist/compat/async-hooks/NOTICE.md +8 -0
- package/dist/compat/async-hooks/callbacks.d.ts +7 -0
- package/dist/compat/async-hooks/callbacks.js +18 -0
- package/dist/compat/async-hooks/hooks.d.ts +10 -0
- package/dist/compat/async-hooks/hooks.js +111 -0
- package/dist/compat/async-hooks/index.d.ts +41 -0
- package/dist/compat/async-hooks/index.js +298 -0
- package/dist/compat/buffer/LICENSE-3RD-PARTY.md +15 -0
- package/dist/compat/buffer/LICENSE-APACHE +177 -0
- package/dist/compat/buffer/blob.d.ts +22 -0
- package/dist/compat/buffer/blob.js +210 -0
- package/dist/compat/buffer/bytes.d.ts +34 -0
- package/dist/compat/buffer/bytes.js +228 -0
- package/dist/compat/buffer/errors.d.ts +41 -0
- package/dist/compat/buffer/errors.js +265 -0
- package/dist/compat/buffer/index.d.ts +25 -0
- package/dist/compat/buffer/index.js +24 -0
- package/dist/compat/buffer/internal-buffer.d.ts +148 -0
- package/dist/compat/buffer/internal-buffer.js +1809 -0
- package/dist/compat/buffer/support.d.ts +13 -0
- package/dist/compat/buffer/support.js +65 -0
- package/dist/compat/child-process/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/child-process/LICENSE-APACHE +177 -0
- package/dist/compat/child-process/errors.d.ts +4 -0
- package/dist/compat/child-process/errors.js +6 -0
- package/dist/compat/child-process/index.d.ts +49 -0
- package/dist/compat/child-process/index.js +96 -0
- package/dist/compat/cluster/LICENSE-3RD-PARTY.md +40 -0
- package/dist/compat/cluster/LICENSE-APACHE +177 -0
- package/dist/compat/cluster/errors.d.ts +4 -0
- package/dist/compat/cluster/errors.js +6 -0
- package/dist/compat/cluster/index.d.ts +47 -0
- package/dist/compat/cluster/index.js +88 -0
- package/dist/compat/constants/LICENSE-3RD-PARTY.md +6 -0
- package/dist/compat/constants/LICENSE-APACHE +177 -0
- package/dist/compat/constants/index.d.ts +481 -0
- package/dist/compat/constants/index.js +488 -0
- package/dist/compat/dgram/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/dgram/LICENSE-APACHE +177 -0
- package/dist/compat/dgram/index.d.ts +10 -0
- package/dist/compat/dgram/index.js +132 -0
- package/dist/compat/diagnostics-channel/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/diagnostics-channel/LICENSE-APACHE +177 -0
- package/dist/compat/diagnostics-channel/index.d.ts +73 -0
- package/dist/compat/diagnostics-channel/index.js +261 -0
- package/dist/compat/diagnostics-channel/native.d.ts +26 -0
- package/dist/compat/diagnostics-channel/native.js +154 -0
- package/dist/compat/dns/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/dns/LICENSE-APACHE +177 -0
- package/dist/compat/dns/client.d.ts +72 -0
- package/dist/compat/dns/client.js +161 -0
- package/dist/compat/dns/constants.d.ts +27 -0
- package/dist/compat/dns/constants.js +31 -0
- package/dist/compat/dns/errors.d.ts +8 -0
- package/dist/compat/dns/errors.js +12 -0
- package/dist/compat/dns/index.d.ts +97 -0
- package/dist/compat/dns/index.js +127 -0
- package/dist/compat/dns/parser.d.ts +18 -0
- package/dist/compat/dns/parser.js +144 -0
- package/dist/compat/dns/promise-resolver.d.ts +82 -0
- package/dist/compat/dns/promise-resolver.js +113 -0
- package/dist/compat/dns/promises.d.ts +50 -0
- package/dist/compat/dns/promises.js +53 -0
- package/dist/compat/dns/resolver.d.ts +34 -0
- package/dist/compat/dns/resolver.js +415 -0
- package/dist/compat/domain/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/domain/LICENSE-APACHE +177 -0
- package/dist/compat/domain/index.d.ts +22 -0
- package/dist/compat/domain/index.js +79 -0
- package/dist/compat/fs/index.d.ts +85 -0
- package/dist/compat/fs/index.js +255 -0
- package/dist/compat/fs/promises/index.d.ts +3 -0
- package/dist/compat/fs/promises/index.js +3 -0
- package/dist/compat/http/index.d.ts +322 -0
- package/dist/compat/http/index.js +1356 -0
- package/dist/compat/http/registry.d.ts +19 -0
- package/dist/compat/http/registry.js +13 -0
- package/dist/compat/http-agent/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/http-agent/LICENSE-APACHE +177 -0
- package/dist/compat/http-agent/index.d.ts +7 -0
- package/dist/compat/http-agent/index.js +10 -0
- package/dist/compat/http-client/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/http-client/LICENSE-APACHE +177 -0
- package/dist/compat/http-client/index.d.ts +6 -0
- package/dist/compat/http-client/index.js +7 -0
- package/dist/compat/http-incoming/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/http-incoming/LICENSE-APACHE +177 -0
- package/dist/compat/http-incoming/index.d.ts +6 -0
- package/dist/compat/http-incoming/index.js +9 -0
- package/dist/compat/http2/LICENSE-3RD-PARTY.md +29 -0
- package/dist/compat/http2/LICENSE-APACHE +177 -0
- package/dist/compat/http2/constants.d.ts +255 -0
- package/dist/compat/http2/constants.js +515 -0
- package/dist/compat/http2/errors.d.ts +4 -0
- package/dist/compat/http2/errors.js +6 -0
- package/dist/compat/http2/index.d.ts +283 -0
- package/dist/compat/http2/index.js +68 -0
- package/dist/compat/https/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/https/LICENSE-APACHE +177 -0
- package/dist/compat/https/agent.d.ts +10 -0
- package/dist/compat/https/agent.js +99 -0
- package/dist/compat/https/errors.d.ts +4 -0
- package/dist/compat/https/errors.js +6 -0
- package/dist/compat/https/index.d.ts +20 -0
- package/dist/compat/https/index.js +50 -0
- package/dist/compat/https/server.d.ts +8 -0
- package/dist/compat/https/server.js +27 -0
- package/dist/compat/immediate/index.d.ts +11 -0
- package/dist/compat/immediate/index.js +58 -0
- package/dist/compat/inspector/LICENSE-3RD-PARTY.md +34 -0
- package/dist/compat/inspector/LICENSE-APACHE +177 -0
- package/dist/compat/inspector/errors.d.ts +4 -0
- package/dist/compat/inspector/errors.js +6 -0
- package/dist/compat/inspector/index.d.ts +18 -0
- package/dist/compat/inspector/index.js +117 -0
- package/dist/compat/inspector/promises.d.ts +18 -0
- package/dist/compat/inspector/promises.js +114 -0
- package/dist/compat/module/index.cjs +2 -0
- package/dist/compat/module/index.d.cts +2 -0
- package/dist/compat/module/index.d.ts +11 -0
- package/dist/compat/module/index.js +44 -0
- package/dist/compat/module/resolve-unavailable.d.ts +1 -0
- package/dist/compat/module/resolve-unavailable.js +3 -0
- package/dist/compat/net/LICENSE-3RD-PARTY.md +15 -0
- package/dist/compat/net/LICENSE-APACHE +177 -0
- package/dist/compat/net/error-base.d.ts +14 -0
- package/dist/compat/net/error-base.js +62 -0
- package/dist/compat/net/errors.d.ts +76 -0
- package/dist/compat/net/errors.js +333 -0
- package/dist/compat/net/index.d.ts +23 -0
- package/dist/compat/net/index.js +46 -0
- package/dist/compat/net/internal-net.d.ts +236 -0
- package/dist/compat/net/internal-net.js +2292 -0
- package/dist/compat/net/ports.d.ts +32 -0
- package/dist/compat/net/ports.js +149 -0
- package/dist/compat/net/reader.d.ts +8 -0
- package/dist/compat/net/reader.js +36 -0
- package/dist/compat/net/sockets.d.ts +20 -0
- package/dist/compat/net/sockets.js +195 -0
- package/dist/compat/net/validators.d.ts +18 -0
- package/dist/compat/net/validators.js +154 -0
- package/dist/compat/os/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/os/LICENSE-APACHE +177 -0
- package/dist/compat/os/index.d.ts +329 -0
- package/dist/compat/os/index.js +278 -0
- package/dist/compat/path/LICENSE-3RD-PARTY.md +35 -0
- package/dist/compat/path/LICENSE-APACHE +177 -0
- package/dist/compat/path/index.d.ts +4 -0
- package/dist/compat/path/index.js +11 -0
- package/dist/compat/path/internal-path.d.ts +95 -0
- package/dist/compat/path/internal-path.js +1542 -0
- package/dist/compat/path/posix/index.d.ts +4 -0
- package/dist/compat/path/posix/index.js +5 -0
- package/dist/compat/path/win32/index.d.ts +4 -0
- package/dist/compat/path/win32/index.js +5 -0
- package/dist/compat/perf-hooks/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/perf-hooks/LICENSE-APACHE +177 -0
- package/dist/compat/perf-hooks/index.d.ts +85 -0
- package/dist/compat/perf-hooks/index.js +79 -0
- package/dist/compat/perf-hooks/performance.d.ts +96 -0
- package/dist/compat/perf-hooks/performance.js +445 -0
- package/dist/compat/punycode/LICENSE-3RD-PARTY.md +7 -0
- package/dist/compat/punycode/LICENSE-APACHE +177 -0
- package/dist/compat/punycode/index.d.ts +93 -0
- package/dist/compat/punycode/index.js +410 -0
- package/dist/compat/querystring/LICENSE-3RD-PARTY.md +35 -0
- package/dist/compat/querystring/LICENSE-APACHE +177 -0
- package/dist/compat/querystring/index.d.ts +14 -0
- package/dist/compat/querystring/index.js +18 -0
- package/dist/compat/querystring/internal-querystring.d.ts +22 -0
- package/dist/compat/querystring/internal-querystring.js +498 -0
- package/dist/compat/readline/LICENSE-3RD-PARTY.md +37 -0
- package/dist/compat/readline/LICENSE-APACHE +177 -0
- package/dist/compat/readline/index.d.ts +21 -0
- package/dist/compat/readline/index.js +56 -0
- package/dist/compat/readline/interface.d.ts +22 -0
- package/dist/compat/readline/interface.js +85 -0
- package/dist/compat/readline/internal-promises.d.ts +32 -0
- package/dist/compat/readline/internal-promises.js +104 -0
- package/dist/compat/readline/promises.d.ts +8 -0
- package/dist/compat/readline/promises.js +32 -0
- package/dist/compat/repl/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/repl/LICENSE-APACHE +177 -0
- package/dist/compat/repl/builtin-modules.d.ts +1 -0
- package/dist/compat/repl/builtin-modules.js +101 -0
- package/dist/compat/repl/errors.d.ts +4 -0
- package/dist/compat/repl/errors.js +6 -0
- package/dist/compat/repl/index.d.ts +53 -0
- package/dist/compat/repl/index.js +106 -0
- package/dist/compat/sqlite/LICENSE-3RD-PARTY.md +6 -0
- package/dist/compat/sqlite/LICENSE-APACHE +177 -0
- package/dist/compat/sqlite/index.d.ts +12 -0
- package/dist/compat/sqlite/index.js +101 -0
- package/dist/compat/sqlite/native.d.ts +16 -0
- package/dist/compat/sqlite/native.js +33 -0
- package/dist/compat/stream/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream/LICENSE-APACHE +177 -0
- package/dist/compat/stream/add-abort-signal.d.ts +4 -0
- package/dist/compat/stream/add-abort-signal.js +73 -0
- package/dist/compat/stream/compose.d.ts +1 -0
- package/dist/compat/stream/compose.js +313 -0
- package/dist/compat/stream/destroy.d.ts +5 -0
- package/dist/compat/stream/destroy.js +315 -0
- package/dist/compat/stream/duplex.d.ts +48 -0
- package/dist/compat/stream/duplex.js +789 -0
- package/dist/compat/stream/end-of-stream.d.ts +16 -0
- package/dist/compat/stream/end-of-stream.js +269 -0
- package/dist/compat/stream/errors.d.ts +40 -0
- package/dist/compat/stream/errors.js +86 -0
- package/dist/compat/stream/events.d.ts +6 -0
- package/dist/compat/stream/events.js +28 -0
- package/dist/compat/stream/index.cjs +27 -0
- package/dist/compat/stream/index.d.cts +25 -0
- package/dist/compat/stream/index.d.ts +20 -0
- package/dist/compat/stream/index.js +55 -0
- package/dist/compat/stream/legacy.d.ts +8 -0
- package/dist/compat/stream/legacy.js +105 -0
- package/dist/compat/stream/once.d.ts +7 -0
- package/dist/compat/stream/once.js +13 -0
- package/dist/compat/stream/pipeline.d.ts +5 -0
- package/dist/compat/stream/pipeline.js +567 -0
- package/dist/compat/stream/process.d.ts +1 -0
- package/dist/compat/stream/process.js +4 -0
- package/dist/compat/stream/promises.d.ts +7 -0
- package/dist/compat/stream/promises.js +60 -0
- package/dist/compat/stream/readable.d.ts +29 -0
- package/dist/compat/stream/readable.js +2267 -0
- package/dist/compat/stream/state.d.ts +8 -0
- package/dist/compat/stream/state.js +63 -0
- package/dist/compat/stream/transform.d.ts +2 -0
- package/dist/compat/stream/transform.js +202 -0
- package/dist/compat/stream/util.d.ts +55 -0
- package/dist/compat/stream/util.js +345 -0
- package/dist/compat/stream/validators.d.ts +2 -0
- package/dist/compat/stream/validators.js +14 -0
- package/dist/compat/stream/writable.d.ts +21 -0
- package/dist/compat/stream/writable.js +1325 -0
- package/dist/compat/stream-consumers/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/stream-consumers/LICENSE-APACHE +177 -0
- package/dist/compat/stream-consumers/index.d.ts +14 -0
- package/dist/compat/stream-consumers/index.js +62 -0
- package/dist/compat/stream-consumers/iterable.d.ts +1 -0
- package/dist/compat/stream-consumers/iterable.js +34 -0
- package/dist/compat/stream-duplex/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-duplex/LICENSE-APACHE +177 -0
- package/dist/compat/stream-duplex/index.cjs +3 -0
- package/dist/compat/stream-duplex/index.d.cts +2 -0
- package/dist/compat/stream-duplex/index.d.ts +3 -0
- package/dist/compat/stream-duplex/index.js +8 -0
- package/dist/compat/stream-passthrough/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-passthrough/LICENSE-APACHE +177 -0
- package/dist/compat/stream-passthrough/index.cjs +3 -0
- package/dist/compat/stream-passthrough/index.d.cts +2 -0
- package/dist/compat/stream-passthrough/index.d.ts +3 -0
- package/dist/compat/stream-passthrough/index.js +8 -0
- package/dist/compat/stream-promises/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-promises/LICENSE-APACHE +177 -0
- package/dist/compat/stream-promises/index.d.ts +1 -0
- package/dist/compat/stream-promises/index.js +1 -0
- package/dist/compat/stream-readable/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-readable/LICENSE-APACHE +177 -0
- package/dist/compat/stream-readable/index.cjs +3 -0
- package/dist/compat/stream-readable/index.d.cts +2 -0
- package/dist/compat/stream-readable/index.d.ts +3 -0
- package/dist/compat/stream-readable/index.js +8 -0
- package/dist/compat/stream-transform/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-transform/LICENSE-APACHE +177 -0
- package/dist/compat/stream-transform/index.cjs +3 -0
- package/dist/compat/stream-transform/index.d.cts +2 -0
- package/dist/compat/stream-transform/index.d.ts +3 -0
- package/dist/compat/stream-transform/index.js +8 -0
- package/dist/compat/stream-web/LICENSE-MIT +22 -0
- package/dist/compat/stream-web/NOTICE.md +3 -0
- package/dist/compat/stream-web/context.d.ts +2 -0
- package/dist/compat/stream-web/context.js +35 -0
- package/dist/compat/stream-web/index.d.ts +80 -0
- package/dist/compat/stream-web/index.js +129 -0
- package/dist/compat/stream-web/interop.d.ts +6 -0
- package/dist/compat/stream-web/interop.js +72 -0
- package/dist/compat/stream-web/ponyfill.d.ts +1 -0
- package/dist/compat/stream-web/ponyfill.js +2093 -0
- package/dist/compat/stream-web/runtime.d.ts +16 -0
- package/dist/compat/stream-web/runtime.js +51 -0
- package/dist/compat/stream-writable/LICENSE-3RD-PARTY.md +13 -0
- package/dist/compat/stream-writable/LICENSE-APACHE +177 -0
- package/dist/compat/stream-writable/index.cjs +3 -0
- package/dist/compat/stream-writable/index.d.cts +2 -0
- package/dist/compat/stream-writable/index.d.ts +3 -0
- package/dist/compat/stream-writable/index.js +8 -0
- package/dist/compat/string-decoder/LICENSE-3RD-PARTY.md +38 -0
- package/dist/compat/string-decoder/LICENSE-APACHE +177 -0
- package/dist/compat/string-decoder/index.d.ts +33 -0
- package/dist/compat/string-decoder/index.js +518 -0
- package/dist/compat/test/LICENSE-3RD-PARTY.md +37 -0
- package/dist/compat/test/LICENSE-APACHE +177 -0
- package/dist/compat/test/index.d.ts +9 -0
- package/dist/compat/test/index.js +11 -0
- package/dist/compat/test/mock.d.ts +103 -0
- package/dist/compat/test/mock.js +397 -0
- package/dist/compat/test/validators.d.ts +2 -0
- package/dist/compat/test/validators.js +14 -0
- package/dist/compat/timers/LICENSE-3RD-PARTY.md +7 -0
- package/dist/compat/timers/LICENSE-APACHE +177 -0
- package/dist/compat/timers/errors.d.ts +28 -0
- package/dist/compat/timers/errors.js +206 -0
- package/dist/compat/timers/host.d.ts +11 -0
- package/dist/compat/timers/host.js +60 -0
- package/dist/compat/timers/index.cjs +3 -0
- package/dist/compat/timers/index.d.cts +23 -0
- package/dist/compat/timers/index.d.ts +36 -0
- package/dist/compat/timers/index.js +20 -0
- package/dist/compat/timers/installation.d.ts +4 -0
- package/dist/compat/timers/installation.js +61 -0
- package/dist/compat/timers/internal-promises.d.ts +19 -0
- package/dist/compat/timers/internal-promises.js +173 -0
- package/dist/compat/timers/promises.cjs +2 -0
- package/dist/compat/timers/promises.d.cts +12 -0
- package/dist/compat/timers/promises.d.ts +14 -0
- package/dist/compat/timers/promises.js +3 -0
- package/dist/compat/timers/timers.d.ts +32 -0
- package/dist/compat/timers/timers.js +147 -0
- package/dist/compat/timers/validation.d.ts +5 -0
- package/dist/compat/timers/validation.js +22 -0
- package/dist/compat/timers/wait.d.ts +4 -0
- package/dist/compat/timers/wait.js +91 -0
- package/dist/compat/tls-common/LICENSE-3RD-PARTY.md +11 -0
- package/dist/compat/tls-common/LICENSE-APACHE +177 -0
- package/dist/compat/tls-common/index.d.ts +14 -0
- package/dist/compat/tls-common/index.js +88 -0
- package/dist/compat/trace-events/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/trace-events/LICENSE-APACHE +177 -0
- package/dist/compat/trace-events/index.d.ts +18 -0
- package/dist/compat/trace-events/index.js +88 -0
- package/dist/compat/tty/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/tty/LICENSE-APACHE +177 -0
- package/dist/compat/tty/index.d.ts +17 -0
- package/dist/compat/tty/index.js +101 -0
- package/dist/compat/url/LICENSE-3RD-PARTY.md +63 -0
- package/dist/compat/url/LICENSE-ADA +18 -0
- package/dist/compat/url/LICENSE-APACHE +177 -0
- package/dist/compat/url/LICENSE-UNICODE +39 -0
- package/dist/compat/url/LICENSE-WHATWG-URL +21 -0
- package/dist/compat/url/brand.d.ts +4 -0
- package/dist/compat/url/brand.js +10 -0
- package/dist/compat/url/constants.d.ts +27 -0
- package/dist/compat/url/constants.js +28 -0
- package/dist/compat/url/errors.d.ts +44 -0
- package/dist/compat/url/errors.js +248 -0
- package/dist/compat/url/idna-data.d.ts +3958 -0
- package/dist/compat/url/idna-data.js +22 -0
- package/dist/compat/url/idna.d.ts +9 -0
- package/dist/compat/url/idna.js +47 -0
- package/dist/compat/url/index.d.ts +48 -0
- package/dist/compat/url/index.js +39 -0
- package/dist/compat/url/installation.d.ts +4 -0
- package/dist/compat/url/installation.js +61 -0
- package/dist/compat/url/internal-url.d.ts +34 -0
- package/dist/compat/url/internal-url.js +264 -0
- package/dist/compat/url/legacy-url.d.ts +28 -0
- package/dist/compat/url/legacy-url.js +870 -0
- package/dist/compat/url/parser-platform.d.ts +3 -0
- package/dist/compat/url/parser-platform.js +26 -0
- package/dist/compat/url/standard-url.d.ts +2 -0
- package/dist/compat/url/standard-url.js +3189 -0
- package/dist/compat/url/unicode.d.ts +2 -0
- package/dist/compat/url/unicode.js +119 -0
- package/dist/compat/url/validation.d.ts +2 -0
- package/dist/compat/url/validation.js +9 -0
- package/dist/compat/url/web-url.d.ts +27 -0
- package/dist/compat/url/web-url.js +119 -0
- package/dist/compat/util/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/util/LICENSE-APACHE +177 -0
- package/dist/compat/util/additional.d.ts +11 -0
- package/dist/compat/util/additional.js +121 -0
- package/dist/compat/util/comparison-types.d.ts +16 -0
- package/dist/compat/util/comparison-types.js +50 -0
- package/dist/compat/util/comparisons.d.ts +1 -0
- package/dist/compat/util/comparisons.js +527 -0
- package/dist/compat/util/core.d.ts +18 -0
- package/dist/compat/util/core.js +265 -0
- package/dist/compat/util/debuglog.d.ts +1 -0
- package/dist/compat/util/debuglog.js +78 -0
- package/dist/compat/util/index.d.ts +35 -0
- package/dist/compat/util/index.js +77 -0
- package/dist/compat/util/inspect-binding.d.ts +13 -0
- package/dist/compat/util/inspect-binding.js +39 -0
- package/dist/compat/util/inspect-types.d.ts +13 -0
- package/dist/compat/util/inspect-types.js +30 -0
- package/dist/compat/util/inspect.d.ts +152 -0
- package/dist/compat/util/inspect.js +2503 -0
- package/dist/compat/util/mime.d.ts +24 -0
- package/dist/compat/util/mime.js +284 -0
- package/dist/compat/util/properties.d.ts +9 -0
- package/dist/compat/util/properties.js +76 -0
- package/dist/compat/v8/LICENSE-3RD-PARTY.md +6 -0
- package/dist/compat/v8/LICENSE-APACHE +177 -0
- package/dist/compat/v8/errors.d.ts +5 -0
- package/dist/compat/v8/errors.js +7 -0
- package/dist/compat/v8/index.d.ts +106 -0
- package/dist/compat/v8/index.js +280 -0
- package/dist/compat/vm/LICENSE-3RD-PARTY.md +39 -0
- package/dist/compat/vm/LICENSE-APACHE +177 -0
- package/dist/compat/vm/errors.d.ts +5 -0
- package/dist/compat/vm/errors.js +7 -0
- package/dist/compat/vm/index.d.ts +47 -0
- package/dist/compat/vm/index.js +231 -0
- package/dist/compat/vm/validation.d.ts +3 -0
- package/dist/compat/vm/validation.js +14 -0
- package/dist/compat/wasi/LICENSE-3RD-PARTY.md +8 -0
- package/dist/compat/wasi/LICENSE-APACHE +177 -0
- package/dist/compat/wasi/errors.d.ts +4 -0
- package/dist/compat/wasi/errors.js +6 -0
- package/dist/compat/wasi/index.d.ts +15 -0
- package/dist/compat/wasi/index.js +44 -0
- package/dist/compat/worker-threads/LICENSE-3RD-PARTY.md +5 -0
- package/dist/compat/worker-threads/LICENSE-APACHE +177 -0
- package/dist/compat/worker-threads/errors.d.ts +4 -0
- package/dist/compat/worker-threads/errors.js +6 -0
- package/dist/compat/worker-threads/index.d.ts +71 -0
- package/dist/compat/worker-threads/index.js +138 -0
- package/dist/compat/worker-threads/message-channel.d.ts +18 -0
- package/dist/compat/worker-threads/message-channel.js +157 -0
- package/dist/configured.d.ts +3 -0
- package/dist/configured.js +4 -0
- package/dist/environment.d.ts +4 -0
- package/dist/environment.js +18 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +107 -0
- package/dist/ios.d.ts +2 -0
- package/dist/ios.js +1 -0
- package/dist/native-entry.d.ts +8 -0
- package/dist/native-entry.js +67 -0
- package/dist/shared/brotli/LICENSE-APACHE +201 -0
- package/dist/shared/brotli/LICENSE-MIT +9 -0
- package/dist/shared/brotli/NOTICE +3 -0
- package/dist/shared/brotli/index.d.ts +2 -0
- package/dist/shared/brotli/index.js +288 -0
- package/dist/shared/contracts/index.d.ts +42 -0
- package/dist/shared/contracts/index.js +88 -0
- package/dist/shared/contracts/testing.d.ts +22 -0
- package/dist/shared/contracts/testing.js +57 -0
- package/dist/shared/globals/index.d.ts +3 -0
- package/dist/shared/globals/index.js +87 -0
- package/dist/shared/globals/inject.d.ts +2 -0
- package/dist/shared/globals/inject.js +3 -0
- package/dist/shared/globals/install.d.ts +1 -0
- package/dist/shared/globals/install.js +15 -0
- package/dist/shared/globals/node-install.d.ts +1 -0
- package/dist/shared/globals/node-install.js +4 -0
- package/dist/shared/globals/platform.d.ts +104 -0
- package/dist/shared/globals/platform.js +37 -0
- package/dist/shared/globals/runtime.d.ts +6 -0
- package/dist/shared/globals/runtime.js +8 -0
- package/dist/shared/globals/symbols.d.ts +4 -0
- package/dist/shared/globals/symbols.js +35 -0
- package/dist/shared/globals/web.d.ts +4 -0
- package/dist/shared/globals/web.js +108 -0
- package/dist/shared/http-wire/LICENSE.llhttp +22 -0
- package/dist/shared/http-wire/LICENSE.undici +21 -0
- package/dist/shared/http-wire/NOTICE.md +14 -0
- package/dist/shared/http-wire/index.d.ts +27 -0
- package/dist/shared/http-wire/index.js +132 -0
- package/dist/shared/http-wire/wasm.d.ts +2 -0
- package/dist/shared/http-wire/wasm.js +2 -0
- package/dist/tooling/async.d.ts +7 -0
- package/dist/tooling/async.js +99 -0
- package/dist/tooling/build-isolation.d.ts +4 -0
- package/dist/tooling/build-isolation.js +34 -0
- package/dist/tooling/documents.d.ts +7 -0
- package/dist/tooling/documents.js +26 -0
- package/dist/tooling/esbuild.d.ts +15 -0
- package/dist/tooling/esbuild.js +193 -0
- package/dist/tooling/files.d.ts +2 -0
- package/dist/tooling/files.js +18 -0
- package/dist/tooling/opennext/build.d.ts +1 -0
- package/dist/tooling/opennext/build.js +121 -0
- package/dist/tooling/opennext/index.d.ts +3 -0
- package/dist/tooling/opennext/index.js +213 -0
- package/dist/tooling/opennext/plan.d.ts +9 -0
- package/dist/tooling/opennext/plan.js +36 -0
- package/dist/tooling/opennext/safety.d.ts +4 -0
- package/dist/tooling/opennext/safety.js +36 -0
- package/dist/tooling/route-permissions.d.ts +3 -0
- package/dist/tooling/route-permissions.js +15 -0
- package/dist/tooling/server-modules.d.ts +30 -0
- package/dist/tooling/server-modules.js +98 -0
- package/dist/tooling/server-only-html.d.ts +1 -0
- package/dist/tooling/server-only-html.js +66 -0
- package/dist/tooling/server-only.d.ts +6 -0
- package/dist/tooling/server-only.js +53 -0
- package/dist/tooling/server.d.ts +25 -0
- package/dist/tooling/server.js +981 -0
- package/dist/tooling/shared.d.ts +13 -0
- package/dist/tooling/shared.js +130 -0
- package/dist/tooling/vite.d.ts +18 -0
- package/dist/tooling/vite.js +448 -0
- package/dist/tooling/void/index.d.ts +3 -0
- package/dist/tooling/void/index.js +205 -0
- package/dist/tooling/void/plan.d.ts +17 -0
- package/dist/tooling/void/plan.js +288 -0
- package/native/android/build.gradle +68 -0
- package/native/android/consumer-rules.pro +2 -0
- package/native/android/src/main/AndroidManifest.xml +6 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkerSockets.java +202 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersCapacitorPlugin.java +256 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersNative.java +22 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersNativeActivity.java +178 -0
- package/native/android/src/main/java/jp/rdlabo/workerscapacitor/WorkersNativeBridge.java +45 -0
- package/native/ios/DocumentBridge.swift +330 -0
- package/native/ios/NetworkBridge.swift +51 -0
- package/native/ios/SocketBridge.swift +180 -0
- package/native/ios/WorkersCapacitorPlugin.swift +152 -0
- package/native/ios-host/WorkersView.swift +194 -0
- package/package.json +154 -4
|
@@ -0,0 +1,397 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
3
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5
|
+
//
|
|
6
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
7
|
+
//
|
|
8
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
9
|
+
// copy of this software and associated documentation files (the
|
|
10
|
+
// "Software"), to deal in the Software without restriction, including
|
|
11
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
13
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
14
|
+
// following conditions:
|
|
15
|
+
//
|
|
16
|
+
// The above copyright notice and this permission notice shall be included
|
|
17
|
+
// in all copies or substantial portions of the Software.
|
|
18
|
+
//
|
|
19
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
20
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
22
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
23
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT ORs
|
|
24
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
25
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
import { ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_VALUE } from "../net/errors.js";
|
|
27
|
+
import { validateBoolean, validateFunction, validateInteger, validateObject, } from "./validators.js";
|
|
28
|
+
const kEmptyObject = Object.create(null);
|
|
29
|
+
function kDefaultFunction() { }
|
|
30
|
+
// TODO(soon): MockTimers are currently still fairly experimental in Node.js.
|
|
31
|
+
// The intention is to implement them but for now, I'm skipping it.
|
|
32
|
+
//const { MockTimers } = require('internal/test_runner/mock/mock_timers');
|
|
33
|
+
export class MockFunctionContext {
|
|
34
|
+
#calls;
|
|
35
|
+
#mocks;
|
|
36
|
+
#implementation;
|
|
37
|
+
#restore;
|
|
38
|
+
#times;
|
|
39
|
+
constructor(implementation, restore, times) {
|
|
40
|
+
this.#calls = [];
|
|
41
|
+
this.#mocks = new Map();
|
|
42
|
+
this.#implementation = implementation;
|
|
43
|
+
this.#restore = restore;
|
|
44
|
+
this.#times = times;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Gets an array of recorded calls made to the mock function.
|
|
48
|
+
* @returns {Array} An array of recorded calls.
|
|
49
|
+
*/
|
|
50
|
+
get calls() {
|
|
51
|
+
return this.#calls.slice(0);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Retrieves the number of times the mock function has been called.
|
|
55
|
+
* @returns {number} The call count.
|
|
56
|
+
*/
|
|
57
|
+
callCount() {
|
|
58
|
+
return this.#calls.length;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Sets a new implementation for the mock function.
|
|
62
|
+
* @param {Function} implementation - The new implementation for the mock function.
|
|
63
|
+
*/
|
|
64
|
+
mockImplementation(implementation) {
|
|
65
|
+
validateFunction(implementation, "implementation");
|
|
66
|
+
this.#implementation = implementation;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Replaces the implementation of the function only once.
|
|
70
|
+
* @param {Function} implementation - The substitute function.
|
|
71
|
+
* @param {number} [onCall] - The call index to be replaced.
|
|
72
|
+
*/
|
|
73
|
+
mockImplementationOnce(implementation, onCall) {
|
|
74
|
+
validateFunction(implementation, "implementation");
|
|
75
|
+
const nextCall = this.#calls.length;
|
|
76
|
+
const call = onCall ?? nextCall;
|
|
77
|
+
validateInteger(call, "onCall", nextCall);
|
|
78
|
+
this.#mocks.set(call, implementation);
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Restores the original function that was mocked.
|
|
82
|
+
*/
|
|
83
|
+
restore() {
|
|
84
|
+
const { descriptor, object, original, methodName } = this.#restore;
|
|
85
|
+
if (typeof methodName === "string") {
|
|
86
|
+
// This is an object method spy.
|
|
87
|
+
Object.defineProperty(object, methodName, descriptor);
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
// This is a bare function spy. There isn't much to do here but make
|
|
91
|
+
// the mock call the original function.
|
|
92
|
+
this.#implementation = original;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Resets the recorded calls to the mock function
|
|
97
|
+
*/
|
|
98
|
+
resetCalls() {
|
|
99
|
+
this.#calls = [];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Tracks a call made to the mock function.
|
|
103
|
+
* @param {object} call - The call details.
|
|
104
|
+
*/
|
|
105
|
+
trackCall(call) {
|
|
106
|
+
this.#calls.push(call);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Gets the next implementation to use for the mock function.
|
|
110
|
+
* @returns {Function} The next implementation.
|
|
111
|
+
*/
|
|
112
|
+
nextImpl() {
|
|
113
|
+
const nextCall = this.#calls.length;
|
|
114
|
+
const mock = this.#mocks.get(nextCall);
|
|
115
|
+
const impl = mock ?? this.#implementation;
|
|
116
|
+
if (nextCall + 1 === this.#times) {
|
|
117
|
+
this.restore();
|
|
118
|
+
}
|
|
119
|
+
this.#mocks.delete(nextCall);
|
|
120
|
+
return impl;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const { nextImpl, restore, trackCall } = MockFunctionContext.prototype;
|
|
124
|
+
delete MockFunctionContext.prototype.trackCall;
|
|
125
|
+
delete MockFunctionContext.prototype.nextImpl;
|
|
126
|
+
export class MockTracker {
|
|
127
|
+
#mocks = [];
|
|
128
|
+
// TODO(soon): MockTimers are currently still fairly experimental in Node.js.
|
|
129
|
+
// The intention is to implement them but for now, I'm skipping it.
|
|
130
|
+
// #timers;
|
|
131
|
+
// /**
|
|
132
|
+
// * Returns the mock timers of this MockTracker instance.
|
|
133
|
+
// * @returns {MockTimers} The mock timers instance.
|
|
134
|
+
// */
|
|
135
|
+
// get timers() {
|
|
136
|
+
// this.#timers ??= new MockTimers();
|
|
137
|
+
// return this.#timers;
|
|
138
|
+
// }
|
|
139
|
+
/**
|
|
140
|
+
* Creates a mock function tracker.
|
|
141
|
+
* @param {Function} [original] - The original function to be tracked.
|
|
142
|
+
* @param {Function} [implementation] - An optional replacement function for the original one.
|
|
143
|
+
* @param {object} [options] - Additional tracking options.
|
|
144
|
+
* @param {number} [options.times=Infinity] - The maximum number of times the mock function can be called.
|
|
145
|
+
* @returns {ProxyConstructor} The mock function tracker.
|
|
146
|
+
*/
|
|
147
|
+
fn(original = function () { }, implementation = original, options = kEmptyObject) {
|
|
148
|
+
if (original !== null && typeof original === "object") {
|
|
149
|
+
options = original;
|
|
150
|
+
original = function () { };
|
|
151
|
+
implementation = original;
|
|
152
|
+
}
|
|
153
|
+
else if (implementation !== null && typeof implementation === "object") {
|
|
154
|
+
options = implementation;
|
|
155
|
+
implementation = original;
|
|
156
|
+
}
|
|
157
|
+
validateFunction(original, "original");
|
|
158
|
+
validateFunction(implementation, "implementation");
|
|
159
|
+
validateObject(options, "options");
|
|
160
|
+
const { times = Infinity } = options;
|
|
161
|
+
validateTimes(times, "options.times");
|
|
162
|
+
const ctx = new MockFunctionContext(implementation, { __proto__: null, original }, times);
|
|
163
|
+
return this.#setupMock(ctx, original);
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Creates a method tracker for a specified object or function.
|
|
167
|
+
* @param {(object | Function)} objectOrFunction - The object or function containing the method to be tracked.
|
|
168
|
+
* @param {string} methodName - The name of the method to be tracked.
|
|
169
|
+
* @param {Function} [implementation] - An optional replacement function for the original method.
|
|
170
|
+
* @param {object} [options] - Additional tracking options.
|
|
171
|
+
* @param {boolean} [options.getter=false] - Indicates whether this is a getter method.
|
|
172
|
+
* @param {boolean} [options.setter=false] - Indicates whether this is a setter method.
|
|
173
|
+
* @param {number} [options.times=Infinity] - The maximum number of times the mock method can be called.
|
|
174
|
+
* @returns {ProxyConstructor} The mock method tracker.
|
|
175
|
+
*/
|
|
176
|
+
method(objectOrFunction, methodName, implementation = kDefaultFunction, options = kEmptyObject) {
|
|
177
|
+
validateStringOrSymbol(methodName, "methodName");
|
|
178
|
+
if (typeof objectOrFunction !== "function") {
|
|
179
|
+
validateObject(objectOrFunction, "object");
|
|
180
|
+
}
|
|
181
|
+
if (implementation !== null && typeof implementation === "object") {
|
|
182
|
+
options = implementation;
|
|
183
|
+
implementation = kDefaultFunction;
|
|
184
|
+
}
|
|
185
|
+
validateFunction(implementation, "implementation");
|
|
186
|
+
validateObject(options, "options");
|
|
187
|
+
const { getter = false, setter = false, times = Infinity } = options;
|
|
188
|
+
validateBoolean(getter, "options.getter");
|
|
189
|
+
validateBoolean(setter, "options.setter");
|
|
190
|
+
validateTimes(times, "options.times");
|
|
191
|
+
if (setter && getter) {
|
|
192
|
+
throw new ERR_INVALID_ARG_VALUE("options.setter", setter, "cannot be used with 'options.getter'");
|
|
193
|
+
}
|
|
194
|
+
const descriptor = findMethodOnPrototypeChain(objectOrFunction, methodName);
|
|
195
|
+
let original;
|
|
196
|
+
if (getter) {
|
|
197
|
+
original = descriptor?.get;
|
|
198
|
+
}
|
|
199
|
+
else if (setter) {
|
|
200
|
+
original = descriptor?.set;
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
original = descriptor?.value;
|
|
204
|
+
}
|
|
205
|
+
if (typeof original !== "function") {
|
|
206
|
+
throw new ERR_INVALID_ARG_VALUE("methodName", original, "must be a method");
|
|
207
|
+
}
|
|
208
|
+
const restore = {
|
|
209
|
+
__proto__: null,
|
|
210
|
+
descriptor,
|
|
211
|
+
object: objectOrFunction,
|
|
212
|
+
methodName,
|
|
213
|
+
};
|
|
214
|
+
const impl = implementation === kDefaultFunction ? original : implementation;
|
|
215
|
+
const ctx = new MockFunctionContext(impl, restore, times);
|
|
216
|
+
const mock = this.#setupMock(ctx, original);
|
|
217
|
+
const mockDescriptor = {
|
|
218
|
+
__proto__: null,
|
|
219
|
+
configurable: descriptor.configurable,
|
|
220
|
+
enumerable: descriptor.enumerable,
|
|
221
|
+
};
|
|
222
|
+
if (getter) {
|
|
223
|
+
mockDescriptor.get = mock;
|
|
224
|
+
mockDescriptor.set = descriptor.set;
|
|
225
|
+
}
|
|
226
|
+
else if (setter) {
|
|
227
|
+
mockDescriptor.get = descriptor.get;
|
|
228
|
+
mockDescriptor.set = mock;
|
|
229
|
+
}
|
|
230
|
+
else {
|
|
231
|
+
mockDescriptor.writable = descriptor.writable;
|
|
232
|
+
mockDescriptor.value = mock;
|
|
233
|
+
}
|
|
234
|
+
Object.defineProperty(objectOrFunction, methodName, mockDescriptor);
|
|
235
|
+
return mock;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Mocks a getter method of an object.
|
|
239
|
+
* This is a syntax sugar for the MockTracker.method with options.getter set to true
|
|
240
|
+
* @param {object} object - The target object.
|
|
241
|
+
* @param {string} methodName - The name of the getter method to be mocked.
|
|
242
|
+
* @param {Function} [implementation] - An optional replacement function for the targeted method.
|
|
243
|
+
* @param {object} [options] - Additional tracking options.
|
|
244
|
+
* @param {boolean} [options.getter=true] - Indicates whether this is a getter method.
|
|
245
|
+
* @param {boolean} [options.setter=false] - Indicates whether this is a setter method.
|
|
246
|
+
* @param {number} [options.times=Infinity] - The maximum number of times the mock method can be called.
|
|
247
|
+
* @returns {ProxyConstructor} The mock method tracker.
|
|
248
|
+
*/
|
|
249
|
+
getter(object, methodName, implementation = kDefaultFunction, options = kEmptyObject) {
|
|
250
|
+
if (implementation !== null && typeof implementation === "object") {
|
|
251
|
+
options = implementation;
|
|
252
|
+
implementation = kDefaultFunction;
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
validateObject(options, "options");
|
|
256
|
+
}
|
|
257
|
+
const { getter = true } = options;
|
|
258
|
+
if (getter === false) {
|
|
259
|
+
throw new ERR_INVALID_ARG_VALUE("options.getter", getter, "cannot be false");
|
|
260
|
+
}
|
|
261
|
+
return this.method(object, methodName, implementation, {
|
|
262
|
+
__proto__: null,
|
|
263
|
+
...options,
|
|
264
|
+
getter,
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Mocks a setter method of an object.
|
|
269
|
+
* This function is a syntax sugar for MockTracker.method with options.setter set to true.
|
|
270
|
+
* @param {object} object - The target object.
|
|
271
|
+
* @param {string} methodName - The setter method to be mocked.
|
|
272
|
+
* @param {Function} [implementation] - An optional replacement function for the targeted method.
|
|
273
|
+
* @param {object} [options] - Additional tracking options.
|
|
274
|
+
* @param {boolean} [options.getter=false] - Indicates whether this is a getter method.
|
|
275
|
+
* @param {boolean} [options.setter=true] - Indicates whether this is a setter method.
|
|
276
|
+
* @param {number} [options.times=Infinity] - The maximum number of times the mock method can be called.
|
|
277
|
+
* @returns {ProxyConstructor} The mock method tracker.
|
|
278
|
+
*/
|
|
279
|
+
setter(object, methodName, implementation = kDefaultFunction, options = kEmptyObject) {
|
|
280
|
+
if (implementation !== null && typeof implementation === "object") {
|
|
281
|
+
options = implementation;
|
|
282
|
+
implementation = kDefaultFunction;
|
|
283
|
+
}
|
|
284
|
+
else {
|
|
285
|
+
validateObject(options, "options");
|
|
286
|
+
}
|
|
287
|
+
const { setter = true } = options;
|
|
288
|
+
if (setter === false) {
|
|
289
|
+
throw new ERR_INVALID_ARG_VALUE("options.setter", setter, "cannot be false");
|
|
290
|
+
}
|
|
291
|
+
return this.method(object, methodName, implementation, {
|
|
292
|
+
__proto__: null,
|
|
293
|
+
...options,
|
|
294
|
+
setter,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Resets the mock tracker, restoring all mocks and clearing timers.
|
|
299
|
+
*/
|
|
300
|
+
reset() {
|
|
301
|
+
this.restoreAll();
|
|
302
|
+
// this.#timers?.reset();
|
|
303
|
+
this.#mocks = [];
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Restore all mocks created by this MockTracker instance.
|
|
307
|
+
*/
|
|
308
|
+
restoreAll() {
|
|
309
|
+
for (let i = 0; i < this.#mocks.length; i++) {
|
|
310
|
+
restore.call(this.#mocks[i]);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
#setupMock(ctx, fnToMatch) {
|
|
314
|
+
const mock = new Proxy(fnToMatch, {
|
|
315
|
+
__proto__: null,
|
|
316
|
+
apply(_fn, thisArg, argList) {
|
|
317
|
+
const fn = nextImpl.call(ctx);
|
|
318
|
+
let result;
|
|
319
|
+
let error;
|
|
320
|
+
try {
|
|
321
|
+
result = Reflect.apply(fn, thisArg, argList);
|
|
322
|
+
}
|
|
323
|
+
catch (err) {
|
|
324
|
+
error = err;
|
|
325
|
+
throw err;
|
|
326
|
+
}
|
|
327
|
+
finally {
|
|
328
|
+
trackCall.call(ctx, {
|
|
329
|
+
__proto__: null,
|
|
330
|
+
arguments: argList,
|
|
331
|
+
error,
|
|
332
|
+
result,
|
|
333
|
+
stack: new Error(),
|
|
334
|
+
target: undefined,
|
|
335
|
+
this: thisArg,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
return result;
|
|
339
|
+
},
|
|
340
|
+
construct(target, argList, newTarget) {
|
|
341
|
+
const realTarget = nextImpl.call(ctx);
|
|
342
|
+
let result;
|
|
343
|
+
let error;
|
|
344
|
+
try {
|
|
345
|
+
result = Reflect.construct(realTarget, argList, newTarget);
|
|
346
|
+
}
|
|
347
|
+
catch (err) {
|
|
348
|
+
error = err;
|
|
349
|
+
throw err;
|
|
350
|
+
}
|
|
351
|
+
finally {
|
|
352
|
+
trackCall.call(ctx, {
|
|
353
|
+
__proto__: null,
|
|
354
|
+
arguments: argList,
|
|
355
|
+
error,
|
|
356
|
+
result,
|
|
357
|
+
stack: new Error(),
|
|
358
|
+
target,
|
|
359
|
+
this: result,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return result;
|
|
363
|
+
},
|
|
364
|
+
get(target, property, receiver) {
|
|
365
|
+
if (property === "mock") {
|
|
366
|
+
return ctx;
|
|
367
|
+
}
|
|
368
|
+
return Reflect.get(target, property, receiver);
|
|
369
|
+
},
|
|
370
|
+
});
|
|
371
|
+
this.#mocks.push(ctx);
|
|
372
|
+
return mock;
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
function validateStringOrSymbol(value, name) {
|
|
376
|
+
if (typeof value !== "string" && typeof value !== "symbol") {
|
|
377
|
+
throw new ERR_INVALID_ARG_TYPE(name, ["string", "symbol"], value);
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function validateTimes(value, name) {
|
|
381
|
+
if (value === Infinity) {
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
validateInteger(value, name, 1);
|
|
385
|
+
}
|
|
386
|
+
function findMethodOnPrototypeChain(instance, methodName) {
|
|
387
|
+
let host = instance;
|
|
388
|
+
let descriptor;
|
|
389
|
+
while (host !== null) {
|
|
390
|
+
descriptor = Object.getOwnPropertyDescriptor(host, methodName);
|
|
391
|
+
if (descriptor) {
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
host = Object.getPrototypeOf(host);
|
|
395
|
+
}
|
|
396
|
+
return descriptor;
|
|
397
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Adapted from pinned workerd internal/validators.ts; see LICENSE-3RD-PARTY.md.
|
|
2
|
+
export { validateBoolean, validateFunction, validateObject, } from "../net/validators.js";
|
|
3
|
+
import { ERR_INVALID_ARG_TYPE, ERR_OUT_OF_RANGE } from "../net/errors.js";
|
|
4
|
+
export function validateInteger(value, name, min = Number.MIN_SAFE_INTEGER, max = Number.MAX_SAFE_INTEGER) {
|
|
5
|
+
if (typeof value !== "number") {
|
|
6
|
+
throw new ERR_INVALID_ARG_TYPE(name, "number", value);
|
|
7
|
+
}
|
|
8
|
+
if (!Number.isInteger(value)) {
|
|
9
|
+
throw new ERR_OUT_OF_RANGE(name, "an integer", value);
|
|
10
|
+
}
|
|
11
|
+
if (value < min || value > max) {
|
|
12
|
+
throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Upstream notices
|
|
2
|
+
|
|
3
|
+
Adapted from Cloudflare workerd `v1.20261012.1`:
|
|
4
|
+
`src/node/timers.ts`, `src/node/internal/internal_timers.ts`,
|
|
5
|
+
`src/node/internal/internal_timers_promises.ts`, and the required error and
|
|
6
|
+
validator declarations. Cloudflare Apache 2.0 and Node/Joyent MIT notices are
|
|
7
|
+
retained in the corresponding sources. Host scheduling uses Web APIs.
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export declare class NodeErrorAbstraction extends Error {
|
|
2
|
+
code: string;
|
|
3
|
+
constructor(name: string, code: string, message: string);
|
|
4
|
+
toString(): string;
|
|
5
|
+
}
|
|
6
|
+
export declare class NodeError extends NodeErrorAbstraction {
|
|
7
|
+
constructor(code: string, message: string);
|
|
8
|
+
}
|
|
9
|
+
export declare class NodeRangeError extends NodeErrorAbstraction {
|
|
10
|
+
constructor(code: string, message: string);
|
|
11
|
+
}
|
|
12
|
+
export declare class NodeTypeError extends NodeErrorAbstraction implements TypeError {
|
|
13
|
+
constructor(code: string, message: string);
|
|
14
|
+
}
|
|
15
|
+
export declare class ERR_INVALID_ARG_TYPE_RANGE extends NodeRangeError {
|
|
16
|
+
constructor(name: string, expected: string | string[], actual: unknown);
|
|
17
|
+
}
|
|
18
|
+
export declare class ERR_INVALID_ARG_TYPE extends NodeTypeError {
|
|
19
|
+
constructor(name: string, expected: string | string[], actual: unknown);
|
|
20
|
+
static RangeError: typeof ERR_INVALID_ARG_TYPE_RANGE;
|
|
21
|
+
}
|
|
22
|
+
export declare class ERR_INVALID_THIS extends NodeTypeError {
|
|
23
|
+
constructor(x: string);
|
|
24
|
+
}
|
|
25
|
+
export declare class AbortError extends Error {
|
|
26
|
+
code: string;
|
|
27
|
+
constructor(message?: string, options?: ErrorOptions);
|
|
28
|
+
}
|