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,119 @@
|
|
|
1
|
+
// Ada 4.0.0 IDNA processing, matching workerd 1.20261012.1.
|
|
2
|
+
// Keep its mapping, ContextJ and Bidi semantics together with its pinned tables.
|
|
3
|
+
// @ts-expect-error punycode ships JavaScript without declarations.
|
|
4
|
+
import { decode, encode } from "punycode/";
|
|
5
|
+
import * as data from "./idna-data.js";
|
|
6
|
+
const ascii = /^[\x00-\x7f]*$/;
|
|
7
|
+
const encoder = new TextEncoder();
|
|
8
|
+
function lookup(ranges, code, fallback) {
|
|
9
|
+
let lo = 0, hi = ranges.length;
|
|
10
|
+
while (lo < hi) {
|
|
11
|
+
const mid = (lo + hi) >>> 1;
|
|
12
|
+
if (ranges[mid][1] < code)
|
|
13
|
+
lo = mid + 1;
|
|
14
|
+
else
|
|
15
|
+
hi = mid;
|
|
16
|
+
}
|
|
17
|
+
const range = ranges[lo];
|
|
18
|
+
return range && range[0] <= code ? (range[2] ?? 1) : fallback;
|
|
19
|
+
}
|
|
20
|
+
function mapped(input) {
|
|
21
|
+
let output = "";
|
|
22
|
+
for (const c of input) {
|
|
23
|
+
const status = lookup(data.mapping, c.codePointAt(0), data.disallowed);
|
|
24
|
+
if (status === data.disallowed)
|
|
25
|
+
return null;
|
|
26
|
+
output +=
|
|
27
|
+
status === data.valid
|
|
28
|
+
? c
|
|
29
|
+
: data.strings[status];
|
|
30
|
+
}
|
|
31
|
+
return output;
|
|
32
|
+
}
|
|
33
|
+
function validLabel(label) {
|
|
34
|
+
const points = Array.from(label, (c) => c.codePointAt(0));
|
|
35
|
+
if (!points.length)
|
|
36
|
+
return true;
|
|
37
|
+
if (lookup(data.combining, points[0], 0))
|
|
38
|
+
return false;
|
|
39
|
+
for (let i = 0; i < points.length; i++) {
|
|
40
|
+
const c = points[i];
|
|
41
|
+
if (c !== 0x200c && c !== 0x200d)
|
|
42
|
+
continue;
|
|
43
|
+
// The pinned engine returns on its first joiner, including successful
|
|
44
|
+
// virama validation; do not substitute newer Unicode ContextJ behavior.
|
|
45
|
+
if (i > 0 && data.virama.includes(points[i - 1]))
|
|
46
|
+
return true;
|
|
47
|
+
if (c === 0x200d || i === 0 || i + 1 === points.length)
|
|
48
|
+
return false;
|
|
49
|
+
return (points
|
|
50
|
+
.slice(0, i)
|
|
51
|
+
.some((p) => data.L.includes(p) || data.D.includes(p)) &&
|
|
52
|
+
points.slice(i + 1).some((p) => data.R.includes(p) || data.D.includes(p)));
|
|
53
|
+
}
|
|
54
|
+
const directions = points.map((p) => lookup(data.directions, p, 0));
|
|
55
|
+
while (directions.at(-1) === 8)
|
|
56
|
+
directions.pop();
|
|
57
|
+
if (!directions.length)
|
|
58
|
+
return false;
|
|
59
|
+
if (!directions.some((d) => d === 7 || d === 9 || d === 10))
|
|
60
|
+
return true;
|
|
61
|
+
const last = directions.at(-1);
|
|
62
|
+
if (directions[0] === 6)
|
|
63
|
+
return (directions.every((d) => [6, 5, 3, 2, 11, 4, 1, 8].includes(d)) &&
|
|
64
|
+
[6, 5].includes(last));
|
|
65
|
+
return ([7, 9].includes(directions[0]) &&
|
|
66
|
+
directions.every((d) => [7, 9, 10, 5, 3, 2, 11, 4, 1, 8].includes(d)) &&
|
|
67
|
+
!(directions.includes(5) && directions.includes(10)) &&
|
|
68
|
+
[7, 9, 10, 5].includes(last));
|
|
69
|
+
}
|
|
70
|
+
function decodedLabel(label) {
|
|
71
|
+
try {
|
|
72
|
+
const decoded = decode(label.slice(4));
|
|
73
|
+
if (ascii.test(decoded) ||
|
|
74
|
+
mapped(decoded) !== decoded ||
|
|
75
|
+
decoded.normalize("NFC") !== decoded ||
|
|
76
|
+
!validLabel(decoded))
|
|
77
|
+
return null;
|
|
78
|
+
return decoded;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
export function toASCII(input) {
|
|
85
|
+
if (encoder.encode(input).length > 16384)
|
|
86
|
+
return "";
|
|
87
|
+
if (ascii.test(input))
|
|
88
|
+
return input.toLowerCase();
|
|
89
|
+
const value = mapped(input);
|
|
90
|
+
if (value === null)
|
|
91
|
+
return "";
|
|
92
|
+
const labels = value.normalize("NFC").split(".");
|
|
93
|
+
for (let i = 0; i < labels.length; i++) {
|
|
94
|
+
const label = labels[i];
|
|
95
|
+
if (label.startsWith("xn--")) {
|
|
96
|
+
if (!ascii.test(label) || decodedLabel(label) === null)
|
|
97
|
+
return "";
|
|
98
|
+
}
|
|
99
|
+
else if (!ascii.test(label)) {
|
|
100
|
+
if (!validLabel(label))
|
|
101
|
+
return "";
|
|
102
|
+
try {
|
|
103
|
+
labels[i] = "xn--" + encode(label);
|
|
104
|
+
}
|
|
105
|
+
catch {
|
|
106
|
+
return "";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return labels.join(".");
|
|
111
|
+
}
|
|
112
|
+
export function toUnicode(input) {
|
|
113
|
+
if (encoder.encode(input).length > 16384)
|
|
114
|
+
return input;
|
|
115
|
+
return input
|
|
116
|
+
.split(".")
|
|
117
|
+
.map((label) => label.startsWith("xn--") ? (decodedLabel(label) ?? label) : label)
|
|
118
|
+
.join(".");
|
|
119
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ERR_INVALID_ARG_TYPE } from "./errors.js";
|
|
2
|
+
export function validateString(value, name) {
|
|
3
|
+
if (typeof value !== "string")
|
|
4
|
+
throw new ERR_INVALID_ARG_TYPE(name, "string", value);
|
|
5
|
+
}
|
|
6
|
+
export function validateObject(value, name) {
|
|
7
|
+
if (value === null || typeof value !== "object" || Array.isArray(value))
|
|
8
|
+
throw new ERR_INVALID_ARG_TYPE(name, "Object", value);
|
|
9
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export { isURLInstance } from "./brand.js";
|
|
2
|
+
declare const URL_base: {
|
|
3
|
+
new (url: string | globalThis.URL, base?: string | globalThis.URL): globalThis.URL;
|
|
4
|
+
prototype: globalThis.URL;
|
|
5
|
+
canParse(url: string | globalThis.URL, base?: string | globalThis.URL): boolean;
|
|
6
|
+
createObjectURL(obj: Blob | MediaSource): string;
|
|
7
|
+
parse(url: string | globalThis.URL, base?: string | globalThis.URL): globalThis.URL | null;
|
|
8
|
+
revokeObjectURL(url: string): void;
|
|
9
|
+
};
|
|
10
|
+
/** JS URL Standard parser with the fixed Workers IDNA profile. */
|
|
11
|
+
export declare class URL extends URL_base {
|
|
12
|
+
get searchParams(): URLSearchParams;
|
|
13
|
+
get href(): string;
|
|
14
|
+
set href(value: string);
|
|
15
|
+
get search(): string;
|
|
16
|
+
set search(value: string);
|
|
17
|
+
toString(): string;
|
|
18
|
+
toJSON(): string;
|
|
19
|
+
static canParse(input: string | globalThis.URL, base?: string | globalThis.URL): boolean;
|
|
20
|
+
static parse(input: string | globalThis.URL, base?: string | globalThis.URL): URL | null;
|
|
21
|
+
static createObjectURL(_object: Blob): string;
|
|
22
|
+
static revokeObjectURL(_url: string): void;
|
|
23
|
+
}
|
|
24
|
+
export declare const URLSearchParams: {
|
|
25
|
+
new (init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
|
|
26
|
+
prototype: URLSearchParams;
|
|
27
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { NativeURL, hostKey, instanceKey } from "./brand.js";
|
|
2
|
+
export { isURLInstance } from "./brand.js";
|
|
3
|
+
import { URL as StandardURL } from "./standard-url.js";
|
|
4
|
+
import { platform } from "../../shared/globals/platform.js";
|
|
5
|
+
const coerceString = String.prototype.concat;
|
|
6
|
+
const nativeBlobSize = Object.getOwnPropertyDescriptor(platform.Blob.prototype, "size").get;
|
|
7
|
+
const NativeParams = globalThis.URLSearchParams;
|
|
8
|
+
// A native URL owns each exposed query list. This preserves BodyInit branding
|
|
9
|
+
// and live updates even when applications borrow URLSearchParams.prototype methods.
|
|
10
|
+
const queries = new WeakMap();
|
|
11
|
+
const hrefDescriptor = Object.getOwnPropertyDescriptor(StandardURL.prototype, "href");
|
|
12
|
+
const searchDescriptor = Object.getOwnPropertyDescriptor(StandardURL.prototype, "search");
|
|
13
|
+
function queryOf(href) {
|
|
14
|
+
const beforeHash = href.split("#", 1)[0];
|
|
15
|
+
const at = beforeHash.indexOf("?");
|
|
16
|
+
return at < 0 ? "" : beforeHash.slice(at);
|
|
17
|
+
}
|
|
18
|
+
function refreshQuery(url) {
|
|
19
|
+
const query = queries.get(url);
|
|
20
|
+
if (query)
|
|
21
|
+
query.search = queryOf(hrefDescriptor.get.call(url));
|
|
22
|
+
}
|
|
23
|
+
function serialized(url) {
|
|
24
|
+
// Also performs the standard parser's receiver brand check.
|
|
25
|
+
hrefDescriptor.get.call(url);
|
|
26
|
+
const query = queries.get(url);
|
|
27
|
+
if (query)
|
|
28
|
+
searchDescriptor.set.call(url, queryOf(query.href));
|
|
29
|
+
return hrefDescriptor.get.call(url);
|
|
30
|
+
}
|
|
31
|
+
/** JS URL Standard parser with the fixed Workers IDNA profile. */
|
|
32
|
+
export class URL extends StandardURL {
|
|
33
|
+
get searchParams() {
|
|
34
|
+
hrefDescriptor.get.call(this);
|
|
35
|
+
let query = queries.get(this);
|
|
36
|
+
if (!query) {
|
|
37
|
+
query = new NativeURL("query://url-compat.invalid/");
|
|
38
|
+
queries.set(this, query);
|
|
39
|
+
refreshQuery(this);
|
|
40
|
+
}
|
|
41
|
+
return query.searchParams;
|
|
42
|
+
}
|
|
43
|
+
get href() {
|
|
44
|
+
return serialized(this);
|
|
45
|
+
}
|
|
46
|
+
set href(value) {
|
|
47
|
+
hrefDescriptor.set.call(this, value);
|
|
48
|
+
refreshQuery(this);
|
|
49
|
+
}
|
|
50
|
+
get search() {
|
|
51
|
+
serialized(this);
|
|
52
|
+
return searchDescriptor.get.call(this);
|
|
53
|
+
}
|
|
54
|
+
set search(value) {
|
|
55
|
+
searchDescriptor.set.call(this, value);
|
|
56
|
+
refreshQuery(this);
|
|
57
|
+
}
|
|
58
|
+
toString() {
|
|
59
|
+
return serialized(this);
|
|
60
|
+
}
|
|
61
|
+
toJSON() {
|
|
62
|
+
return serialized(this);
|
|
63
|
+
}
|
|
64
|
+
static canParse(input, base) {
|
|
65
|
+
if (!arguments.length)
|
|
66
|
+
throw new TypeError("Failed to execute 'canParse' on 'URL': parameter 1 is not of type 'USVString'.");
|
|
67
|
+
// Coercion exceptions escape, just as they do in Workers.
|
|
68
|
+
const value = `${input}`, baseValue = base === undefined ? undefined : `${base}`;
|
|
69
|
+
try {
|
|
70
|
+
new URL(value, baseValue);
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
static parse(input, base) {
|
|
78
|
+
if (!arguments.length)
|
|
79
|
+
throw new TypeError("Failed to execute 'parse' on 'URL': parameter 1 is not of type 'USVString'.");
|
|
80
|
+
const value = `${input}`, baseValue = base === undefined ? undefined : `${base}`;
|
|
81
|
+
try {
|
|
82
|
+
return new URL(value, baseValue);
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
static createObjectURL(_object) {
|
|
89
|
+
try {
|
|
90
|
+
nativeBlobSize.call(_object);
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
throw new TypeError("Failed to execute 'createObjectURL' on 'URL': parameter 1 is not of type 'File or Blob'.");
|
|
94
|
+
}
|
|
95
|
+
throw new Error("URL.createObjectURL() is not implemented");
|
|
96
|
+
}
|
|
97
|
+
static revokeObjectURL(_url) {
|
|
98
|
+
if (!arguments.length)
|
|
99
|
+
throw new TypeError("Failed to execute 'revokeObjectURL' on 'URL': parameter 1 is not of type 'USVString'.");
|
|
100
|
+
// Keep observable ToString even in minified builds; a discarded template
|
|
101
|
+
// literal can be removed by the bundler despite a Symbol/hostile coercion.
|
|
102
|
+
coerceString.call("", _url);
|
|
103
|
+
throw new Error("URL.revokeObjectURL() is not implemented");
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
for (const key of Reflect.ownKeys(StandardURL.prototype)) {
|
|
107
|
+
if (key !== "constructor" && !Object.hasOwn(URL.prototype, key))
|
|
108
|
+
Object.defineProperty(URL.prototype, key, Object.getOwnPropertyDescriptor(StandardURL.prototype, key));
|
|
109
|
+
}
|
|
110
|
+
Object.defineProperty(URL.prototype, instanceKey, {
|
|
111
|
+
get() {
|
|
112
|
+
Object.getOwnPropertyDescriptor(StandardURL.prototype, "href").get.call(this);
|
|
113
|
+
return true;
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
for (const fn of [URL, URL.canParse, URL.parse])
|
|
117
|
+
Object.defineProperty(fn, "length", { value: 1 });
|
|
118
|
+
Object.defineProperty(URL, hostKey, { value: NativeURL });
|
|
119
|
+
export const URLSearchParams = NativeParams;
|
|
@@ -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,11 @@
|
|
|
1
|
+
export declare function isDeepStrictEqual(a: unknown, b: unknown): boolean;
|
|
2
|
+
export declare function toUSVString(input: string): string;
|
|
3
|
+
export declare function aborted(signal: unknown, resource: unknown): Promise<Event | void>;
|
|
4
|
+
interface StyleTextOptions {
|
|
5
|
+
validateStream?: boolean;
|
|
6
|
+
stream?: ReadableStream | WritableStream;
|
|
7
|
+
}
|
|
8
|
+
export declare function styleText(format: string | string[], text: unknown, { validateStream, stream }?: StyleTextOptions): string;
|
|
9
|
+
export declare function _errnoException(): void;
|
|
10
|
+
export declare function _exceptionWithHostPort(): void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
2
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4
|
+
import { validateAbortSignal, validateObject, validateString, validateBoolean, validateOneOf, kValidateObjectAllowArray, kValidateObjectAllowFunction, } from "../net/validators.js";
|
|
5
|
+
import { ERR_INVALID_ARG_TYPE } from "../net/errors.js";
|
|
6
|
+
import { NodeError } from "../net/error-base.js";
|
|
7
|
+
import { inspect } from "./inspect.js";
|
|
8
|
+
import { isDeepStrictEqual as compare } from "./comparisons.js";
|
|
9
|
+
class ERR_METHOD_NOT_IMPLEMENTED extends NodeError {
|
|
10
|
+
constructor(name) {
|
|
11
|
+
super("ERR_METHOD_NOT_IMPLEMENTED", `The ${name} method is not implemented`);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export function isDeepStrictEqual(a, b) {
|
|
15
|
+
return compare(a, b);
|
|
16
|
+
}
|
|
17
|
+
export function toUSVString(input) {
|
|
18
|
+
return input.toWellFormed();
|
|
19
|
+
}
|
|
20
|
+
export async function aborted(signal, resource) {
|
|
21
|
+
if (signal === undefined) {
|
|
22
|
+
throw new ERR_INVALID_ARG_TYPE("signal", "AbortSignal", signal);
|
|
23
|
+
}
|
|
24
|
+
// Node.js defines that the resource is held weakly such that if it is GC'ed, we
|
|
25
|
+
// will drop the event handler on the signal and the promise will remain pending
|
|
26
|
+
// forever. We don't want GC to be observable in the same way so we won't support
|
|
27
|
+
// this additional option. Unfortunately Node.js does not make this argument optional.
|
|
28
|
+
// We'll just ignore it.
|
|
29
|
+
validateAbortSignal(signal, "signal");
|
|
30
|
+
validateObject(resource, "resource", kValidateObjectAllowArray | kValidateObjectAllowFunction);
|
|
31
|
+
if (signal.aborted)
|
|
32
|
+
return Promise.resolve();
|
|
33
|
+
const { promise, resolve } = (() => {
|
|
34
|
+
let resolve;
|
|
35
|
+
const promise = new Promise((done) => {
|
|
36
|
+
resolve = done;
|
|
37
|
+
});
|
|
38
|
+
return { promise, resolve };
|
|
39
|
+
})();
|
|
40
|
+
const opts = { __proto__: null, once: true };
|
|
41
|
+
signal.addEventListener("abort", resolve, opts);
|
|
42
|
+
return promise;
|
|
43
|
+
}
|
|
44
|
+
function isNodeStream(obj) {
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
46
|
+
return (obj &&
|
|
47
|
+
(obj._readableState != null ||
|
|
48
|
+
obj._writableState != null ||
|
|
49
|
+
(typeof obj.write === "function" && typeof obj.on === "function") ||
|
|
50
|
+
(typeof obj.pipe === "function" && typeof obj.on === "function")));
|
|
51
|
+
}
|
|
52
|
+
function isReadableStream(obj) {
|
|
53
|
+
return !!(obj &&
|
|
54
|
+
!isNodeStream(obj) &&
|
|
55
|
+
typeof obj.pipeThrough === "function" &&
|
|
56
|
+
typeof obj.getReader === "function" &&
|
|
57
|
+
typeof obj.cancel === "function");
|
|
58
|
+
}
|
|
59
|
+
function isWritableStream(obj) {
|
|
60
|
+
return !!(obj &&
|
|
61
|
+
!isNodeStream(obj) &&
|
|
62
|
+
typeof obj.getWriter === "function" &&
|
|
63
|
+
typeof obj.abort === "function");
|
|
64
|
+
}
|
|
65
|
+
function escapeStyleCode(code) {
|
|
66
|
+
if (code === undefined)
|
|
67
|
+
return "";
|
|
68
|
+
return `\u001b[${code}m`;
|
|
69
|
+
}
|
|
70
|
+
function isTTYStream(stream) {
|
|
71
|
+
return (stream != null &&
|
|
72
|
+
typeof stream === "object" &&
|
|
73
|
+
"isTTY" in stream &&
|
|
74
|
+
!!stream.isTTY &&
|
|
75
|
+
typeof stream.getColorDepth === "function");
|
|
76
|
+
}
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
78
|
+
const stdoutPlaceholder = Object.create(null);
|
|
79
|
+
export function styleText(format, text, { validateStream = true, stream = stdoutPlaceholder } = {}) {
|
|
80
|
+
validateString(text, "text");
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-boolean-literal-compare
|
|
82
|
+
if (validateStream !== true)
|
|
83
|
+
validateBoolean(validateStream, "options.validateStream");
|
|
84
|
+
let skipColorize = false;
|
|
85
|
+
if (validateStream) {
|
|
86
|
+
if (!isReadableStream(stream) &&
|
|
87
|
+
!isWritableStream(stream) &&
|
|
88
|
+
!isNodeStream(stream) &&
|
|
89
|
+
stream !== stdoutPlaceholder) {
|
|
90
|
+
throw new ERR_INVALID_ARG_TYPE("stream", ["ReadableStream", "WritableStream", "Stream"], stream);
|
|
91
|
+
}
|
|
92
|
+
// If the stream is falsy or should not be colorized, set skipColorize to true
|
|
93
|
+
skipColorize = isTTYStream(stream) ? stream.getColorDepth() > 2 : true;
|
|
94
|
+
}
|
|
95
|
+
// If the format is not an array, convert it to an array
|
|
96
|
+
const formatArray = Array.isArray(format) ? format : [format];
|
|
97
|
+
let left = "";
|
|
98
|
+
let right = "";
|
|
99
|
+
for (const key of formatArray) {
|
|
100
|
+
if (key === "none")
|
|
101
|
+
continue;
|
|
102
|
+
const formatCodes = typeof key === "string" ? inspect.colors[key] : undefined;
|
|
103
|
+
// If the format is not a valid style, throw an error
|
|
104
|
+
if (formatCodes == null) {
|
|
105
|
+
validateOneOf(key, "format", Object.keys(inspect.colors));
|
|
106
|
+
}
|
|
107
|
+
if (skipColorize)
|
|
108
|
+
continue;
|
|
109
|
+
left += escapeStyleCode(formatCodes ? formatCodes[0] : undefined);
|
|
110
|
+
right = `${escapeStyleCode(formatCodes ? formatCodes[1] : undefined)}${right}`;
|
|
111
|
+
}
|
|
112
|
+
return skipColorize ? text : `${left}${text}${right}`;
|
|
113
|
+
}
|
|
114
|
+
export function _errnoException() {
|
|
115
|
+
// TODO(soon): We might support this in the future.
|
|
116
|
+
throw new ERR_METHOD_NOT_IMPLEMENTED("_errnoException");
|
|
117
|
+
}
|
|
118
|
+
export function _exceptionWithHostPort() {
|
|
119
|
+
// TODO(soon): We might support this in the future.
|
|
120
|
+
throw new ERR_METHOD_NOT_IMPLEMENTED("_exceptionWithHostPort");
|
|
121
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const isAnyArrayBuffer: (value: unknown) => boolean;
|
|
2
|
+
export declare const isArrayBufferView: (arg: any) => arg is ArrayBufferView;
|
|
3
|
+
export declare const isDate: (value: unknown) => boolean;
|
|
4
|
+
export declare const isMap: (value: unknown) => boolean;
|
|
5
|
+
export declare const isSet: (value: unknown) => boolean;
|
|
6
|
+
export declare const isRegExp: (value: unknown) => boolean;
|
|
7
|
+
export declare const isNativeError: (value: unknown) => boolean;
|
|
8
|
+
export declare const isNumberObject: (value: unknown) => boolean;
|
|
9
|
+
export declare const isStringObject: (value: unknown) => boolean;
|
|
10
|
+
export declare const isBooleanObject: (value: unknown) => boolean;
|
|
11
|
+
export declare const isBigIntObject: (value: unknown) => boolean;
|
|
12
|
+
export declare const isSymbolObject: (value: unknown) => boolean;
|
|
13
|
+
export declare const isBoxedPrimitive: (value: unknown) => boolean;
|
|
14
|
+
export declare const isFloat16Array: (value: unknown) => boolean;
|
|
15
|
+
export declare const isFloat32Array: (value: unknown) => boolean;
|
|
16
|
+
export declare const isFloat64Array: (value: unknown) => boolean;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Brand checks needed by Workers deep comparisons. Calling intrinsic methods
|
|
2
|
+
// reads internal slots without invoking user-defined toStringTag getters.
|
|
3
|
+
function accepts(method, value) {
|
|
4
|
+
try {
|
|
5
|
+
Reflect.apply(method, value, []);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch {
|
|
9
|
+
return false;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
const getter = (prototype, name) => Object.getOwnPropertyDescriptor(prototype, name).get;
|
|
13
|
+
const arrayBufferLength = getter(ArrayBuffer.prototype, "byteLength");
|
|
14
|
+
const sharedArrayBufferLength = typeof SharedArrayBuffer === "undefined"
|
|
15
|
+
? undefined
|
|
16
|
+
: getter(SharedArrayBuffer.prototype, "byteLength");
|
|
17
|
+
const mapSize = getter(Map.prototype, "size");
|
|
18
|
+
const setSize = getter(Set.prototype, "size");
|
|
19
|
+
const regexpGlobal = getter(RegExp.prototype, "global");
|
|
20
|
+
const nativeErrorCheck = Error.isError;
|
|
21
|
+
const dateValue = Date.prototype.getTime;
|
|
22
|
+
const numberValue = Number.prototype.valueOf;
|
|
23
|
+
const stringValue = String.prototype.valueOf;
|
|
24
|
+
const booleanValue = Boolean.prototype.valueOf;
|
|
25
|
+
const bigIntValue = BigInt.prototype.valueOf;
|
|
26
|
+
const symbolValue = Symbol.prototype.valueOf;
|
|
27
|
+
const typedArrayName = getter(Object.getPrototypeOf(Uint8Array.prototype), Symbol.toStringTag);
|
|
28
|
+
export const isAnyArrayBuffer = (value) => accepts(arrayBufferLength, value) ||
|
|
29
|
+
(sharedArrayBufferLength !== undefined &&
|
|
30
|
+
accepts(sharedArrayBufferLength, value));
|
|
31
|
+
export const isArrayBufferView = ArrayBuffer.isView;
|
|
32
|
+
export const isDate = (value) => accepts(dateValue, value);
|
|
33
|
+
export const isMap = (value) => accepts(mapSize, value);
|
|
34
|
+
export const isSet = (value) => accepts(setSize, value);
|
|
35
|
+
export const isRegExp = (value) => accepts(regexpGlobal, value) &&
|
|
36
|
+
typeof Reflect.apply(regexpGlobal, value, []) === "boolean";
|
|
37
|
+
export const isNativeError = (value) => nativeErrorCheck(value);
|
|
38
|
+
export const isNumberObject = (value) => typeof value === "object" && value !== null && accepts(numberValue, value);
|
|
39
|
+
export const isStringObject = (value) => typeof value === "object" && value !== null && accepts(stringValue, value);
|
|
40
|
+
export const isBooleanObject = (value) => typeof value === "object" && value !== null && accepts(booleanValue, value);
|
|
41
|
+
export const isBigIntObject = (value) => typeof value === "object" && value !== null && accepts(bigIntValue, value);
|
|
42
|
+
export const isSymbolObject = (value) => typeof value === "object" && value !== null && accepts(symbolValue, value);
|
|
43
|
+
export const isBoxedPrimitive = (value) => isNumberObject(value) ||
|
|
44
|
+
isStringObject(value) ||
|
|
45
|
+
isBooleanObject(value) ||
|
|
46
|
+
isBigIntObject(value) ||
|
|
47
|
+
isSymbolObject(value);
|
|
48
|
+
export const isFloat16Array = (value) => Reflect.apply(typedArrayName, value, []) === "Float16Array";
|
|
49
|
+
export const isFloat32Array = (value) => Reflect.apply(typedArrayName, value, []) === "Float32Array";
|
|
50
|
+
export const isFloat64Array = (value) => Reflect.apply(typedArrayName, value, []) === "Float64Array";
|