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,498 @@
|
|
|
1
|
+
// Vendored from cloudflare/workerd v1.20261012.1
|
|
2
|
+
// (src/node/internal/internal_querystring.ts), adapted from Node.js
|
|
3
|
+
// lib/querystring.js.
|
|
4
|
+
//
|
|
5
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
6
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
7
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
8
|
+
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
|
9
|
+
//
|
|
10
|
+
// The MIT license text is reproduced in this directory's LICENSE-3RD-PARTY.md
|
|
11
|
+
// as required for redistribution.
|
|
12
|
+
import { Buffer } from "node:buffer";
|
|
13
|
+
// Node's ERR_INVALID_URI: an Error reported with the URIError name and the
|
|
14
|
+
// ERR_INVALID_URI code.
|
|
15
|
+
class ERR_INVALID_URI extends Error {
|
|
16
|
+
code = "ERR_INVALID_URI";
|
|
17
|
+
constructor() {
|
|
18
|
+
super("URI malformed");
|
|
19
|
+
this.name = "URIError";
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export const hexTable = Array.from({ length: 256 }, (_, i) => {
|
|
23
|
+
return "%" + ((i < 16 ? "0" : "") + i.toString(16)).toUpperCase();
|
|
24
|
+
});
|
|
25
|
+
// prettier-ignore
|
|
26
|
+
const isHexTable = new Int8Array([
|
|
27
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
|
|
28
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31
|
|
29
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 32 - 47
|
|
30
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63
|
|
31
|
+
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 64 - 79
|
|
32
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 80 - 95
|
|
33
|
+
0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 96 - 111
|
|
34
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 112 - 127
|
|
35
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 128 ...
|
|
36
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
37
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
38
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
39
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
40
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
|
41
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // ... 256
|
|
42
|
+
]);
|
|
43
|
+
/* eslint-disable */
|
|
44
|
+
export function encodeStr(str, noEscapeTable, hexTable) {
|
|
45
|
+
const len = str.length;
|
|
46
|
+
if (len === 0)
|
|
47
|
+
return "";
|
|
48
|
+
let out = "";
|
|
49
|
+
let lastPos = 0;
|
|
50
|
+
let i = 0;
|
|
51
|
+
outer: for (; i < len; i++) {
|
|
52
|
+
let c = str.charCodeAt(i);
|
|
53
|
+
// ASCII
|
|
54
|
+
while (c < 0x80) {
|
|
55
|
+
if (noEscapeTable[c] !== 1) {
|
|
56
|
+
if (lastPos < i)
|
|
57
|
+
out += str.slice(lastPos, i);
|
|
58
|
+
lastPos = i + 1;
|
|
59
|
+
out += hexTable[c];
|
|
60
|
+
}
|
|
61
|
+
if (++i === len)
|
|
62
|
+
break outer;
|
|
63
|
+
c = str.charCodeAt(i);
|
|
64
|
+
}
|
|
65
|
+
if (lastPos < i)
|
|
66
|
+
out += str.slice(lastPos, i);
|
|
67
|
+
// Multi-byte characters ...
|
|
68
|
+
if (c < 0x800) {
|
|
69
|
+
lastPos = i + 1;
|
|
70
|
+
out += hexTable[0xc0 | (c >> 6)] + hexTable[0x80 | (c & 0x3f)];
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
if (c < 0xd800 || c >= 0xe000) {
|
|
74
|
+
lastPos = i + 1;
|
|
75
|
+
out +=
|
|
76
|
+
hexTable[0xe0 | (c >> 12)] +
|
|
77
|
+
hexTable[0x80 | ((c >> 6) & 0x3f)] +
|
|
78
|
+
hexTable[0x80 | (c & 0x3f)];
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// Surrogate pair
|
|
82
|
+
++i;
|
|
83
|
+
// This branch should never happen because all URLSearchParams entries
|
|
84
|
+
// should already be converted to USVString. But, included for
|
|
85
|
+
// completion's sake anyway.
|
|
86
|
+
if (i >= len)
|
|
87
|
+
throw new ERR_INVALID_URI();
|
|
88
|
+
const c2 = str.charCodeAt(i) & 0x3ff;
|
|
89
|
+
lastPos = i + 1;
|
|
90
|
+
c = 0x10000 + (((c & 0x3ff) << 10) | c2);
|
|
91
|
+
out +=
|
|
92
|
+
hexTable[0xf0 | (c >> 18)] +
|
|
93
|
+
hexTable[0x80 | ((c >> 12) & 0x3f)] +
|
|
94
|
+
hexTable[0x80 | ((c >> 6) & 0x3f)] +
|
|
95
|
+
hexTable[0x80 | (c & 0x3f)];
|
|
96
|
+
}
|
|
97
|
+
if (lastPos === 0)
|
|
98
|
+
return str;
|
|
99
|
+
if (lastPos < len)
|
|
100
|
+
return out + str.slice(lastPos);
|
|
101
|
+
return out;
|
|
102
|
+
}
|
|
103
|
+
/* eslint-enable */
|
|
104
|
+
/* eslint-disable @typescript-eslint/no-unnecessary-type-conversion */
|
|
105
|
+
// prettier-ignore
|
|
106
|
+
const unhexTable = new Int8Array([
|
|
107
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 - 15
|
|
108
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 16 - 31
|
|
109
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 32 - 47
|
|
110
|
+
+0, +1, +2, +3, +4, +5, +6, +7, +8, +9, -1, -1, -1, -1, -1, -1, // 48 - 63
|
|
111
|
+
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 64 - 79
|
|
112
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 80 - 95
|
|
113
|
+
-1, 10, 11, 12, 13, 14, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 96 - 111
|
|
114
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 112 - 127
|
|
115
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 128 ...
|
|
116
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
117
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
118
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
119
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
120
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
|
|
121
|
+
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // ... 255
|
|
122
|
+
]);
|
|
123
|
+
export function unescapeBuffer(s, decodeSpaces) {
|
|
124
|
+
const out = Buffer.allocUnsafe(s.length);
|
|
125
|
+
let index = 0;
|
|
126
|
+
let outIndex = 0;
|
|
127
|
+
let currentChar;
|
|
128
|
+
let nextChar;
|
|
129
|
+
let hexHigh;
|
|
130
|
+
let hexLow;
|
|
131
|
+
const maxLength = s.length - 2;
|
|
132
|
+
// Flag to know if some hex chars have been decoded
|
|
133
|
+
let hasHex = false;
|
|
134
|
+
while (index < s.length) {
|
|
135
|
+
currentChar = s.charCodeAt(index);
|
|
136
|
+
if (currentChar === 43 /* '+' */ && decodeSpaces) {
|
|
137
|
+
out[outIndex++] = 32; // ' '
|
|
138
|
+
index++;
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
if (currentChar === 37 /* '%' */ && index < maxLength) {
|
|
142
|
+
currentChar = s.charCodeAt(++index);
|
|
143
|
+
hexHigh = unhexTable[currentChar];
|
|
144
|
+
if (!(hexHigh >= 0)) {
|
|
145
|
+
out[outIndex++] = 37; // '%'
|
|
146
|
+
continue;
|
|
147
|
+
}
|
|
148
|
+
else {
|
|
149
|
+
nextChar = s.charCodeAt(++index);
|
|
150
|
+
hexLow = unhexTable[nextChar];
|
|
151
|
+
if (!(hexLow >= 0)) {
|
|
152
|
+
out[outIndex++] = 37; // '%'
|
|
153
|
+
index--;
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
hasHex = true;
|
|
157
|
+
currentChar = hexHigh * 16 + hexLow;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
out[outIndex++] = currentChar;
|
|
162
|
+
index++;
|
|
163
|
+
}
|
|
164
|
+
return hasHex ? out.slice(0, outIndex) : out;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* @param {string} s
|
|
168
|
+
* @param {boolean} decodeSpaces
|
|
169
|
+
* @returns {string}
|
|
170
|
+
*/
|
|
171
|
+
const utf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
|
|
172
|
+
export function unescape(s, decodeSpaces) {
|
|
173
|
+
try {
|
|
174
|
+
return decodeURIComponent(s);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
// Buffer#toString('utf8') semantics differ between workerd and the
|
|
178
|
+
// browser polyfill for truncated multibyte tails; TextDecoder matches
|
|
179
|
+
// the Workers decode byte-for-byte.
|
|
180
|
+
return utf8Decoder.decode(unescapeBuffer(s, decodeSpaces));
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
// These characters do not need escaping when generating query strings:
|
|
184
|
+
// ! - . _ ~
|
|
185
|
+
// ' ( ) *
|
|
186
|
+
// digits
|
|
187
|
+
// alpha (uppercase)
|
|
188
|
+
// alpha (lowercase)
|
|
189
|
+
// prettier-ignore
|
|
190
|
+
const noEscape = new Int8Array([
|
|
191
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0 - 15
|
|
192
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16 - 31
|
|
193
|
+
0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 1, 1, 0, // 32 - 47
|
|
194
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, // 48 - 63
|
|
195
|
+
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 64 - 79
|
|
196
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, // 80 - 95
|
|
197
|
+
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 96 - 111
|
|
198
|
+
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, // 112 - 127
|
|
199
|
+
]);
|
|
200
|
+
/**
|
|
201
|
+
* QueryString.escape() replaces encodeURIComponent()
|
|
202
|
+
* @see https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4
|
|
203
|
+
* @param {any} input
|
|
204
|
+
* @returns {string}
|
|
205
|
+
*/
|
|
206
|
+
export function escape(input) {
|
|
207
|
+
let str;
|
|
208
|
+
if (typeof input !== "string") {
|
|
209
|
+
// eslint-disable-next-line @typescript-eslint/no-base-to-string
|
|
210
|
+
if (typeof input === "object")
|
|
211
|
+
str = String(input);
|
|
212
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands,@typescript-eslint/no-base-to-string
|
|
213
|
+
else
|
|
214
|
+
str = input + "";
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
str = input;
|
|
218
|
+
}
|
|
219
|
+
return encodeStr(str, noEscape, hexTable);
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* @param {string | number | bigint | boolean | symbol | undefined | null} v
|
|
223
|
+
* @returns {string}
|
|
224
|
+
*/
|
|
225
|
+
function stringifyPrimitive(v) {
|
|
226
|
+
if (typeof v === "string")
|
|
227
|
+
return v;
|
|
228
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
229
|
+
if (typeof v === "number" && Number.isFinite(v))
|
|
230
|
+
return "" + v;
|
|
231
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
232
|
+
if (typeof v === "bigint")
|
|
233
|
+
return "" + v;
|
|
234
|
+
if (typeof v === "boolean")
|
|
235
|
+
return v ? "true" : "false";
|
|
236
|
+
return "";
|
|
237
|
+
}
|
|
238
|
+
function encodeStringified(v, encode) {
|
|
239
|
+
if (typeof v === "string")
|
|
240
|
+
return v.length ? encode(v) : "";
|
|
241
|
+
if (typeof v === "number" && Number.isFinite(v)) {
|
|
242
|
+
// Values >= 1e21 automatically switch to scientific notation which requires
|
|
243
|
+
// escaping due to the inclusion of a '+' in the output
|
|
244
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
245
|
+
return Math.abs(v) < 1e21 ? "" + v : encode("" + v);
|
|
246
|
+
}
|
|
247
|
+
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
|
248
|
+
if (typeof v === "bigint")
|
|
249
|
+
return "" + v;
|
|
250
|
+
if (typeof v === "boolean")
|
|
251
|
+
return v ? "true" : "false";
|
|
252
|
+
return "";
|
|
253
|
+
}
|
|
254
|
+
function encodeStringifiedCustom(v, encode) {
|
|
255
|
+
return encode(stringifyPrimitive(v));
|
|
256
|
+
}
|
|
257
|
+
export function stringify(obj, sep, eq, options) {
|
|
258
|
+
sep ||= "&";
|
|
259
|
+
eq ||= "=";
|
|
260
|
+
let encode = escape;
|
|
261
|
+
if (options && typeof options.encodeURIComponent === "function") {
|
|
262
|
+
encode = options.encodeURIComponent;
|
|
263
|
+
}
|
|
264
|
+
const convert = encode === escape ? encodeStringified : encodeStringifiedCustom;
|
|
265
|
+
if (obj !== null && typeof obj === "object") {
|
|
266
|
+
const keys = Object.keys(obj);
|
|
267
|
+
const len = keys.length;
|
|
268
|
+
let fields = "";
|
|
269
|
+
for (let i = 0; i < len; ++i) {
|
|
270
|
+
const k = keys[i];
|
|
271
|
+
const v = obj[k];
|
|
272
|
+
let ks = convert(k, encode);
|
|
273
|
+
ks += eq;
|
|
274
|
+
if (Array.isArray(v)) {
|
|
275
|
+
const vlen = v.length;
|
|
276
|
+
if (vlen === 0)
|
|
277
|
+
continue;
|
|
278
|
+
if (fields)
|
|
279
|
+
fields += sep;
|
|
280
|
+
for (let j = 0; j < vlen; ++j) {
|
|
281
|
+
if (j)
|
|
282
|
+
fields += sep;
|
|
283
|
+
fields += ks;
|
|
284
|
+
fields += convert(v[j], encode);
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
else {
|
|
288
|
+
if (fields)
|
|
289
|
+
fields += sep;
|
|
290
|
+
fields += ks;
|
|
291
|
+
fields += convert(v, encode);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return fields;
|
|
295
|
+
}
|
|
296
|
+
return "";
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* @param {string} str
|
|
300
|
+
* @returns {number[]}
|
|
301
|
+
*/
|
|
302
|
+
function charCodes(str) {
|
|
303
|
+
if (str.length === 0)
|
|
304
|
+
return [];
|
|
305
|
+
if (str.length === 1)
|
|
306
|
+
return [str.charCodeAt(0)];
|
|
307
|
+
return Array.from({ length: str.length }, (_, i) => str.charCodeAt(i));
|
|
308
|
+
}
|
|
309
|
+
const defSepCodes = [38]; // &
|
|
310
|
+
const defEqCodes = [61]; // =
|
|
311
|
+
function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) {
|
|
312
|
+
if (key.length > 0 && keyEncoded)
|
|
313
|
+
key = decodeStr(key, decode);
|
|
314
|
+
if (value.length > 0 && valEncoded)
|
|
315
|
+
value = decodeStr(value, decode);
|
|
316
|
+
if (obj[key] === undefined) {
|
|
317
|
+
obj[key] = value;
|
|
318
|
+
}
|
|
319
|
+
else {
|
|
320
|
+
const curValue = obj[key];
|
|
321
|
+
// A simple Array-specific property check is enough here to
|
|
322
|
+
// distinguish from a string value and is faster and still safe
|
|
323
|
+
// since we are generating all of the values being assigned.
|
|
324
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
325
|
+
// @ts-expect-error TS18046
|
|
326
|
+
if (curValue.pop) {
|
|
327
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
328
|
+
// @ts-expect-error TS18046
|
|
329
|
+
curValue[curValue.length] = value; // eslint-disable-line @typescript-eslint/no-unsafe-member-access
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
obj[key] = [curValue, value];
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
export function parse(qs, sep, eq, options) {
|
|
337
|
+
const obj = { __proto__: null };
|
|
338
|
+
if (typeof qs !== "string" || qs.length === 0) {
|
|
339
|
+
return obj;
|
|
340
|
+
}
|
|
341
|
+
const sepCodes = !sep ? defSepCodes : charCodes(String(sep));
|
|
342
|
+
const eqCodes = !eq ? defEqCodes : charCodes(String(eq));
|
|
343
|
+
const sepLen = sepCodes.length;
|
|
344
|
+
const eqLen = eqCodes.length;
|
|
345
|
+
let pairs = 1000;
|
|
346
|
+
if (options && typeof options.maxKeys === "number") {
|
|
347
|
+
// -1 is used in place of a value like Infinity for meaning
|
|
348
|
+
// "unlimited pairs" because of additional checks V8 (at least as of v5.4)
|
|
349
|
+
// has to do when using variables that contain values like Infinity. Since
|
|
350
|
+
// `pairs` is always decremented and checked explicitly for 0, -1 works
|
|
351
|
+
// effectively the same as Infinity, while providing a significant
|
|
352
|
+
// performance boost.
|
|
353
|
+
pairs = options.maxKeys > 0 ? options.maxKeys : -1;
|
|
354
|
+
}
|
|
355
|
+
let decode = unescape;
|
|
356
|
+
if (options && typeof options.decodeURIComponent === "function") {
|
|
357
|
+
decode = options.decodeURIComponent;
|
|
358
|
+
}
|
|
359
|
+
const customDecode = decode !== unescape;
|
|
360
|
+
let lastPos = 0;
|
|
361
|
+
let sepIdx = 0;
|
|
362
|
+
let eqIdx = 0;
|
|
363
|
+
let key = "";
|
|
364
|
+
let value = "";
|
|
365
|
+
let keyEncoded = customDecode;
|
|
366
|
+
let valEncoded = customDecode;
|
|
367
|
+
const plusChar = customDecode ? "%20" : " ";
|
|
368
|
+
let encodeCheck = 0;
|
|
369
|
+
for (let i = 0; i < qs.length; ++i) {
|
|
370
|
+
const code = qs.charCodeAt(i);
|
|
371
|
+
// Try matching key/value pair separator (e.g. '&')
|
|
372
|
+
if (code === sepCodes[sepIdx]) {
|
|
373
|
+
if (++sepIdx === sepLen) {
|
|
374
|
+
// Key/value pair separator match!
|
|
375
|
+
const end = i - sepIdx + 1;
|
|
376
|
+
if (eqIdx < eqLen) {
|
|
377
|
+
// We didn't find the (entire) key/value separator
|
|
378
|
+
if (lastPos < end) {
|
|
379
|
+
// Treat the substring as part of the key instead of the value
|
|
380
|
+
key += qs.slice(lastPos, end);
|
|
381
|
+
}
|
|
382
|
+
else if (key.length === 0) {
|
|
383
|
+
// We saw an empty substring between separators
|
|
384
|
+
if (--pairs === 0)
|
|
385
|
+
return obj;
|
|
386
|
+
lastPos = i + 1;
|
|
387
|
+
sepIdx = eqIdx = 0;
|
|
388
|
+
continue;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
else if (lastPos < end) {
|
|
392
|
+
value += qs.slice(lastPos, end);
|
|
393
|
+
}
|
|
394
|
+
addKeyVal(obj, key, value, keyEncoded, valEncoded, decode);
|
|
395
|
+
if (--pairs === 0)
|
|
396
|
+
return obj;
|
|
397
|
+
keyEncoded = valEncoded = customDecode;
|
|
398
|
+
key = value = "";
|
|
399
|
+
encodeCheck = 0;
|
|
400
|
+
lastPos = i + 1;
|
|
401
|
+
sepIdx = eqIdx = 0;
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
sepIdx = 0;
|
|
406
|
+
// Try matching key/value separator (e.g. '=') if we haven't already
|
|
407
|
+
if (eqIdx < eqLen) {
|
|
408
|
+
if (code === eqCodes[eqIdx]) {
|
|
409
|
+
if (++eqIdx === eqLen) {
|
|
410
|
+
// Key/value separator match!
|
|
411
|
+
const end = i - eqIdx + 1;
|
|
412
|
+
if (lastPos < end)
|
|
413
|
+
key += qs.slice(lastPos, end);
|
|
414
|
+
encodeCheck = 0;
|
|
415
|
+
lastPos = i + 1;
|
|
416
|
+
}
|
|
417
|
+
continue;
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
eqIdx = 0;
|
|
421
|
+
if (!keyEncoded) {
|
|
422
|
+
// Try to match an (valid) encoded byte once to minimize unnecessary
|
|
423
|
+
// calls to string decoding functions
|
|
424
|
+
if (code === 37 /* % */) {
|
|
425
|
+
encodeCheck = 1;
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
else if (encodeCheck > 0) {
|
|
429
|
+
if (isHexTable[code] === 1) {
|
|
430
|
+
if (++encodeCheck === 3)
|
|
431
|
+
keyEncoded = true;
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
encodeCheck = 0;
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
if (code === 43 /* + */) {
|
|
441
|
+
if (lastPos < i)
|
|
442
|
+
key += qs.slice(lastPos, i);
|
|
443
|
+
key += plusChar;
|
|
444
|
+
lastPos = i + 1;
|
|
445
|
+
continue;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
if (code === 43 /* + */) {
|
|
449
|
+
if (lastPos < i)
|
|
450
|
+
value += qs.slice(lastPos, i);
|
|
451
|
+
value += plusChar;
|
|
452
|
+
lastPos = i + 1;
|
|
453
|
+
}
|
|
454
|
+
else if (!valEncoded) {
|
|
455
|
+
// Try to match an (valid) encoded byte (once) to minimize unnecessary
|
|
456
|
+
// calls to string decoding functions
|
|
457
|
+
if (code === 37 /* % */) {
|
|
458
|
+
encodeCheck = 1;
|
|
459
|
+
}
|
|
460
|
+
else if (encodeCheck > 0) {
|
|
461
|
+
if (isHexTable[code] === 1) {
|
|
462
|
+
if (++encodeCheck === 3)
|
|
463
|
+
valEncoded = true;
|
|
464
|
+
}
|
|
465
|
+
else {
|
|
466
|
+
encodeCheck = 0;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
// Deal with any leftover key or value data
|
|
473
|
+
if (lastPos < qs.length) {
|
|
474
|
+
if (eqIdx < eqLen)
|
|
475
|
+
key += qs.slice(lastPos);
|
|
476
|
+
else if (sepIdx < sepLen)
|
|
477
|
+
value += qs.slice(lastPos);
|
|
478
|
+
}
|
|
479
|
+
else if (eqIdx === 0 && key.length === 0) {
|
|
480
|
+
// We ended on an empty substring
|
|
481
|
+
return obj;
|
|
482
|
+
}
|
|
483
|
+
addKeyVal(obj, key, value, keyEncoded, valEncoded, decode);
|
|
484
|
+
return obj;
|
|
485
|
+
}
|
|
486
|
+
/**
|
|
487
|
+
* V8 does not optimize functions with try-catch blocks, so we isolate them here
|
|
488
|
+
* to minimize the damage (Note: no longer true as of V8 5.4 -- but still will
|
|
489
|
+
* not be inlined).
|
|
490
|
+
*/
|
|
491
|
+
function decodeStr(s, decoder) {
|
|
492
|
+
try {
|
|
493
|
+
return decoder(s);
|
|
494
|
+
}
|
|
495
|
+
catch {
|
|
496
|
+
return unescape(s, true);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Upstream notices
|
|
2
|
+
|
|
3
|
+
Adapted from Cloudflare workerd ['readline.ts', 'readline/promises.ts', 'internal/internal_readline.ts', 'internal/internal_readline_promises.ts'] at
|
|
4
|
+
5358e3d337336eaf696a48bc1563d808b10feba5 (v1.20261012.1).
|
|
5
|
+
Apache 2.0 (LICENSE-APACHE); Node MIT notices retained in source.
|
|
6
|
+
|
|
7
|
+
The upstream readline stubs are based on unenv (MIT).
|
|
8
|
+
|
|
9
|
+
# Upstream notices
|
|
10
|
+
|
|
11
|
+
Adapted from Cloudflare workerd `src/node/http2.ts` and
|
|
12
|
+
`src/node/internal/internal_http2_constants.ts` at
|
|
13
|
+
`5358e3d337336eaf696a48bc1563d808b10feba5` (`v1.20261012.1`).
|
|
14
|
+
Cloudflare Apache 2.0 notices remain in source files (see LICENSE-APACHE).
|
|
15
|
+
|
|
16
|
+
## Node.js and unenv MIT notice
|
|
17
|
+
|
|
18
|
+
Copyright Joyent and Node contributors. All rights reserved.
|
|
19
|
+
Copyright (c) Pooya Parsa <pooya@pi0.io>.
|
|
20
|
+
|
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
22
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
23
|
+
in the Software without restriction, including without limitation the rights
|
|
24
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
25
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
26
|
+
furnished to do so, subject to the following conditions:
|
|
27
|
+
|
|
28
|
+
The above copyright notice and this permission notice shall be included in
|
|
29
|
+
all copies or substantial portions of the Software.
|
|
30
|
+
|
|
31
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
33
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
34
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
35
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
36
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
37
|
+
THE SOFTWARE.
|