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,313 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
3
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5
|
+
//
|
|
6
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
7
|
+
//
|
|
8
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
9
|
+
// copy of this software and associated documentation files (the
|
|
10
|
+
// "Software"), to deal in the Software without restriction, including
|
|
11
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
13
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
14
|
+
// following conditions:
|
|
15
|
+
//
|
|
16
|
+
// The above copyright notice and this permission notice shall be included
|
|
17
|
+
// in all copies or substantial portions of the Software.
|
|
18
|
+
//
|
|
19
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
20
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
22
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
23
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
24
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
25
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
import { pipelineImpl } from "./pipeline.js";
|
|
27
|
+
import { Duplex } from "./duplex.js";
|
|
28
|
+
import { Readable as ReadableConstructor } from "./readable.js";
|
|
29
|
+
import { isNodeStream, isReadable, isWritable, isWebStream, isTransformStream, isWritableStream, isReadableStream, kIsClosedPromise, } from "./util.js";
|
|
30
|
+
import { destroyer } from "./destroy.js";
|
|
31
|
+
import { eos } from "./end-of-stream.js";
|
|
32
|
+
import { once } from "./once.js";
|
|
33
|
+
import { AbortError, ERR_INVALID_ARG_VALUE, ERR_MISSING_ARGS, ERR_WEB_STREAM_INTEROP_UNSUPPORTED, } from "./errors.js";
|
|
34
|
+
export function compose(...streams) {
|
|
35
|
+
if (streams.length === 0) {
|
|
36
|
+
throw new ERR_MISSING_ARGS("streams");
|
|
37
|
+
}
|
|
38
|
+
if (streams.length === 1) {
|
|
39
|
+
return Duplex.from(streams[0]);
|
|
40
|
+
}
|
|
41
|
+
const orgStreams = [...streams];
|
|
42
|
+
if (typeof streams[0] === "function") {
|
|
43
|
+
streams[0] = Duplex.from(streams[0]);
|
|
44
|
+
}
|
|
45
|
+
if (typeof streams[streams.length - 1] === "function") {
|
|
46
|
+
const idx = streams.length - 1;
|
|
47
|
+
streams[idx] = Duplex.from(streams[idx]);
|
|
48
|
+
}
|
|
49
|
+
for (let n = 0; n < streams.length; ++n) {
|
|
50
|
+
if (!isNodeStream(streams[n]) && !isWebStream(streams[n])) {
|
|
51
|
+
// TODO(ronag): Add checks for non streams.
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
if (n < streams.length - 1 &&
|
|
55
|
+
!(isReadable(streams[n]) ||
|
|
56
|
+
isReadableStream(streams[n]) ||
|
|
57
|
+
isTransformStream(streams[n]))) {
|
|
58
|
+
throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be readable");
|
|
59
|
+
}
|
|
60
|
+
if (n > 0 &&
|
|
61
|
+
!(isWritable(streams[n]) ||
|
|
62
|
+
isWritableStream(streams[n]) ||
|
|
63
|
+
isTransformStream(streams[n]))) {
|
|
64
|
+
throw new ERR_INVALID_ARG_VALUE(`streams[${n}]`, orgStreams[n], "must be writable");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
let ondrain;
|
|
68
|
+
let onfinish;
|
|
69
|
+
let onclose;
|
|
70
|
+
let tailReader;
|
|
71
|
+
let teardownPipeline;
|
|
72
|
+
let tailFinished = false;
|
|
73
|
+
let pipelineDone = false;
|
|
74
|
+
let d;
|
|
75
|
+
function onfinished(err) {
|
|
76
|
+
const cb = onclose;
|
|
77
|
+
onclose = null;
|
|
78
|
+
pipelineDone = true;
|
|
79
|
+
if (cb) {
|
|
80
|
+
cb(err);
|
|
81
|
+
}
|
|
82
|
+
else if (err) {
|
|
83
|
+
d.destroy(err);
|
|
84
|
+
}
|
|
85
|
+
else if (!readable && !writable) {
|
|
86
|
+
d.destroy();
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
finishWritable();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
// Completes _final once the tail has finished — and, for a web tail, once
|
|
93
|
+
// the pipeline has completed too. A web tail is observed through its
|
|
94
|
+
// readable side (eos over the interop hook), which can close before the
|
|
95
|
+
// pipeline's last write into it has settled (a close() that closes the
|
|
96
|
+
// readable at once but resolves later); a node tail's eos() covers both of
|
|
97
|
+
// its sides.
|
|
98
|
+
function finishWritable() {
|
|
99
|
+
if (!onfinish || !tailFinished) {
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
if (!pipelineDone && !isNodeStream(tail)) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const cb = onfinish;
|
|
106
|
+
onfinish = null;
|
|
107
|
+
cb();
|
|
108
|
+
}
|
|
109
|
+
const head = streams[0];
|
|
110
|
+
const last = streams[streams.length - 1];
|
|
111
|
+
const writable = !!(isWritable(head) ||
|
|
112
|
+
isWritableStream(head) ||
|
|
113
|
+
isTransformStream(head));
|
|
114
|
+
// A composed stream with a writable side must learn when its tail
|
|
115
|
+
// finishes; for a web tail that takes the Node.js interop hook (see
|
|
116
|
+
// streams_end_of_stream.ts). Refused before the pipeline starts and before
|
|
117
|
+
// any lock is taken, so the caller's streams are left as they were.
|
|
118
|
+
if (writable && isWebStream(last)) {
|
|
119
|
+
const toRead = isTransformStream(last) ? last.readable : last;
|
|
120
|
+
if (toRead[kIsClosedPromise] === undefined) {
|
|
121
|
+
throw new ERR_WEB_STREAM_INTEROP_UNSUPPORTED("compose()");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
// Destroying the composed stream while the pipeline runs must tear the
|
|
125
|
+
// pipeline down. A node tail is destroyed as a stage and the pipeline
|
|
126
|
+
// follows; a web tail cannot be, so the pipeline is failed directly with
|
|
127
|
+
// the destroy error instead (see streams_pipeline.js), which destroys
|
|
128
|
+
// every stage the same way.
|
|
129
|
+
const tail = pipelineImpl(streams, once(onfinished), {
|
|
130
|
+
onTeardown: (teardown) => {
|
|
131
|
+
teardownPipeline = teardown;
|
|
132
|
+
},
|
|
133
|
+
});
|
|
134
|
+
const readable = !!(isReadable(tail) ||
|
|
135
|
+
isReadableStream(tail) ||
|
|
136
|
+
isTransformStream(tail));
|
|
137
|
+
// TODO(ronag): Avoid double buffering.
|
|
138
|
+
// Implement Writable/Readable/Duplex traits.
|
|
139
|
+
// See, https://github.com/nodejs/node/pull/33515.
|
|
140
|
+
d = new Duplex({
|
|
141
|
+
// TODO (ronag): highWaterMark?
|
|
142
|
+
// TODO: A web stream has no writableObjectMode/readableObjectMode, so a
|
|
143
|
+
// composition is byte-mode on the side a web head or tail supplies: a
|
|
144
|
+
// TransformStream head that would take objects has the composed stream's
|
|
145
|
+
// write() refuse them with ERR_INVALID_ARG_TYPE. Upstream has the same
|
|
146
|
+
// gap.
|
|
147
|
+
writableObjectMode: !!head?.writableObjectMode,
|
|
148
|
+
readableObjectMode: !!tail?.readableObjectMode,
|
|
149
|
+
writable,
|
|
150
|
+
readable,
|
|
151
|
+
});
|
|
152
|
+
if (writable) {
|
|
153
|
+
if (isNodeStream(head)) {
|
|
154
|
+
d._write = function (chunk, encoding, callback) {
|
|
155
|
+
if (head.write(chunk, encoding)) {
|
|
156
|
+
callback();
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
ondrain = callback;
|
|
160
|
+
}
|
|
161
|
+
};
|
|
162
|
+
d._final = function (callback) {
|
|
163
|
+
head.end();
|
|
164
|
+
onfinish = callback;
|
|
165
|
+
};
|
|
166
|
+
head.on("drain", function () {
|
|
167
|
+
if (ondrain) {
|
|
168
|
+
const cb = ondrain;
|
|
169
|
+
ondrain = null;
|
|
170
|
+
cb();
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
else if (isWebStream(head)) {
|
|
175
|
+
const writable = isTransformStream(head) ? head.writable : head;
|
|
176
|
+
const writer = writable.getWriter();
|
|
177
|
+
d._write = async function (chunk, encoding, callback) {
|
|
178
|
+
try {
|
|
179
|
+
await writer.ready;
|
|
180
|
+
writer.write(chunk).catch(() => { });
|
|
181
|
+
callback();
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
callback(err);
|
|
185
|
+
}
|
|
186
|
+
};
|
|
187
|
+
d._final = async function (callback) {
|
|
188
|
+
try {
|
|
189
|
+
await writer.ready;
|
|
190
|
+
writer.close().catch(() => { });
|
|
191
|
+
onfinish = callback;
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
callback(err);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
const toRead = isTransformStream(tail) ? tail.readable : tail;
|
|
199
|
+
// The tail is finished once both its sides are: for a Duplex or a web
|
|
200
|
+
// transform tail that includes its readable side, which the bridge below
|
|
201
|
+
// drains into the composed stream's buffer on its own, so the writable
|
|
202
|
+
// side's completion does not wait for a consumer.
|
|
203
|
+
eos(toRead, () => {
|
|
204
|
+
tailFinished = true;
|
|
205
|
+
finishWritable();
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
if (readable) {
|
|
209
|
+
if (isNodeStream(tail)) {
|
|
210
|
+
d._read = function () {
|
|
211
|
+
tail.resume();
|
|
212
|
+
};
|
|
213
|
+
tail.on("data", function (chunk) {
|
|
214
|
+
if (!d.push(chunk)) {
|
|
215
|
+
tail.pause();
|
|
216
|
+
}
|
|
217
|
+
});
|
|
218
|
+
tail.on("end", function () {
|
|
219
|
+
d.push(null);
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
else if (isWebStream(tail)) {
|
|
223
|
+
const readable = isTransformStream(tail) ? tail.readable : tail;
|
|
224
|
+
const reader = readable.getReader();
|
|
225
|
+
tailReader = reader;
|
|
226
|
+
let tailReading = false;
|
|
227
|
+
// Drains the tail into the composed stream's buffer as it is produced,
|
|
228
|
+
// as the node bridge above does through 'data': one read loop at a
|
|
229
|
+
// time, parked when push() reports backpressure and restarted from
|
|
230
|
+
// _read(). The latch matters because push() clears the composed
|
|
231
|
+
// stream's reading flag, which has _read() called again while this
|
|
232
|
+
// loop's read is still pending; a second loop would hold a second
|
|
233
|
+
// pending read, and so on with every chunk. Started at once rather
|
|
234
|
+
// than from the first _read(): a web transform's readable side pulls
|
|
235
|
+
// only when read, and its writable side takes the pipeline's writes
|
|
236
|
+
// only when the readable side has pulled, so a composition nobody is
|
|
237
|
+
// reading yet could not otherwise complete its end().
|
|
238
|
+
const readTail = async function () {
|
|
239
|
+
if (tailReading) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
tailReading = true;
|
|
243
|
+
try {
|
|
244
|
+
while (true) {
|
|
245
|
+
let result;
|
|
246
|
+
try {
|
|
247
|
+
result = await reader.read();
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
// The tail failed; the pipeline reports it.
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
253
|
+
const { value, done } = result;
|
|
254
|
+
if (done) {
|
|
255
|
+
d.push(null);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
// A chunk the composed stream cannot take (a view over a detached
|
|
259
|
+
// ArrayBuffer) fails the composition; left to the promise, the
|
|
260
|
+
// throw would be lost and _read never called again.
|
|
261
|
+
try {
|
|
262
|
+
if (!d.push(value)) {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
catch (err) {
|
|
267
|
+
d.destroy(err);
|
|
268
|
+
return;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
finally {
|
|
273
|
+
tailReading = false;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
d._read = readTail;
|
|
277
|
+
readTail();
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
d._destroy = function (err, callback) {
|
|
281
|
+
if (!err && onclose !== null) {
|
|
282
|
+
err = new AbortError();
|
|
283
|
+
}
|
|
284
|
+
ondrain = null;
|
|
285
|
+
onfinish = null;
|
|
286
|
+
if (isNodeStream(tail)) {
|
|
287
|
+
destroyer(tail, err);
|
|
288
|
+
}
|
|
289
|
+
else if (!d.readableEnded || !d.writableFinished) {
|
|
290
|
+
// A running composition is torn down. One whose sides have both
|
|
291
|
+
// completed (the automatic destroy that follows) is not: its pipeline
|
|
292
|
+
// is completing on its own — a web tail's readable side can close
|
|
293
|
+
// before the pipeline's last write into it settles — and the composed
|
|
294
|
+
// stream reports the pipeline's outcome, as with a node tail. The
|
|
295
|
+
// tail's reader is cancelled as well: a pipeline that had already
|
|
296
|
+
// completed still holds the tail's unread output.
|
|
297
|
+
teardownPipeline(err);
|
|
298
|
+
tailReader?.cancel(err).catch(() => { });
|
|
299
|
+
}
|
|
300
|
+
// Either way the pipeline reports `err` (or its own earlier error), and
|
|
301
|
+
// the composed stream reports what the pipeline does.
|
|
302
|
+
if (onclose === null) {
|
|
303
|
+
callback(err);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
onclose = callback;
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
return d;
|
|
310
|
+
}
|
|
311
|
+
ReadableConstructor.prototype.compose = function (...streams) {
|
|
312
|
+
return compose(this, ...streams);
|
|
313
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function destroy(this: Readable | Writable, err?: Error, cb?: VoidFunction): this;
|
|
2
|
+
export declare function undestroy(this: Readable | Writable): void;
|
|
3
|
+
export declare function errorOrDestroy(stream: Readable | Writable, err?: Error, sync?: boolean): this | undefined;
|
|
4
|
+
export declare function construct(stream: Readable | Writable, cb: VoidFunction): void;
|
|
5
|
+
export declare function destroyer(stream: Readable | Writable | null | undefined, err?: Error): void;
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
3
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
4
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
5
|
+
//
|
|
6
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
7
|
+
//
|
|
8
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
9
|
+
// copy of this software and associated documentation files (the
|
|
10
|
+
// "Software"), to deal in the Software without restriction, including
|
|
11
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
12
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
13
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
14
|
+
// following conditions:
|
|
15
|
+
//
|
|
16
|
+
// The above copyright notice and this permission notice shall be included
|
|
17
|
+
// in all copies or substantial portions of the Software.
|
|
18
|
+
//
|
|
19
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
20
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
21
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
22
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
23
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
24
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
25
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
|
+
/* eslint-disable @typescript-eslint/no-redundant-type-constituents, @typescript-eslint/no-unsafe-call */
|
|
27
|
+
import { nextTick } from "./process.js";
|
|
28
|
+
import { AbortError, aggregateTwoErrors, ERR_MULTIPLE_CALLBACK, } from "./errors.js";
|
|
29
|
+
import { kIsDestroyed, isDestroyed, isFinished, isServerRequest, kState, kErrorEmitted, kEmitClose, kClosed, kCloseEmitted, kConstructed, kDestroyed, kAutoDestroy, kErrored, } from "./util.js";
|
|
30
|
+
const kConstruct = Symbol("kConstruct");
|
|
31
|
+
const kDestroy = Symbol("kDestroy");
|
|
32
|
+
function checkError(err, w, r) {
|
|
33
|
+
if (err) {
|
|
34
|
+
// Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364
|
|
35
|
+
err.stack; // eslint-disable-line @typescript-eslint/no-unused-expressions
|
|
36
|
+
if (w && !w.errored) {
|
|
37
|
+
w.errored = err;
|
|
38
|
+
}
|
|
39
|
+
if (r && !r.errored) {
|
|
40
|
+
r.errored = err;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
// Backwards compat. cb() is undocumented and unused in core but
|
|
45
|
+
// unfortunately might be used by modules.
|
|
46
|
+
export function destroy(err, cb) {
|
|
47
|
+
const r = this._readableState;
|
|
48
|
+
const w = this._writableState;
|
|
49
|
+
// With duplex streams we use the writable side for state.
|
|
50
|
+
const s = w || r;
|
|
51
|
+
if ((w && (w[kState] & kDestroyed) !== 0) ||
|
|
52
|
+
(r && (r[kState] & kDestroyed) !== 0)) {
|
|
53
|
+
if (typeof cb === "function") {
|
|
54
|
+
cb();
|
|
55
|
+
}
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
// We set destroyed to true before firing error callbacks in order
|
|
59
|
+
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
60
|
+
checkError(err, w, r);
|
|
61
|
+
if (w) {
|
|
62
|
+
w[kState] |= kDestroyed;
|
|
63
|
+
}
|
|
64
|
+
if (r) {
|
|
65
|
+
r[kState] |= kDestroyed;
|
|
66
|
+
}
|
|
67
|
+
// If still constructing then defer calling _destroy.
|
|
68
|
+
// @ts-expect-error TS18048 `s` will always be defined here.
|
|
69
|
+
if ((s[kState] & kConstructed) === 0) {
|
|
70
|
+
this.once(kDestroy, function (er) {
|
|
71
|
+
_destroy(this, aggregateTwoErrors(er, err), cb);
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
_destroy(this, err, cb);
|
|
76
|
+
}
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
function _destroy(self, err, cb) {
|
|
80
|
+
let called = false;
|
|
81
|
+
function onDestroy(err) {
|
|
82
|
+
if (called) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
called = true;
|
|
86
|
+
const r = self._readableState;
|
|
87
|
+
const w = self._writableState;
|
|
88
|
+
checkError(err, w, r);
|
|
89
|
+
if (w) {
|
|
90
|
+
w[kState] |= kClosed;
|
|
91
|
+
}
|
|
92
|
+
if (r) {
|
|
93
|
+
r[kState] |= kClosed;
|
|
94
|
+
}
|
|
95
|
+
if (typeof cb === "function") {
|
|
96
|
+
cb(err);
|
|
97
|
+
}
|
|
98
|
+
if (err) {
|
|
99
|
+
nextTick(emitErrorCloseNT, self, err);
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
nextTick(emitCloseNT, self);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
self._destroy(err || null, onDestroy);
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
onDestroy(err);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
function emitErrorCloseNT(self, err) {
|
|
113
|
+
emitErrorNT(self, err);
|
|
114
|
+
emitCloseNT(self);
|
|
115
|
+
}
|
|
116
|
+
function emitCloseNT(self) {
|
|
117
|
+
const r = self._readableState;
|
|
118
|
+
const w = self._writableState;
|
|
119
|
+
if (w) {
|
|
120
|
+
w[kState] |= kCloseEmitted;
|
|
121
|
+
}
|
|
122
|
+
if (r) {
|
|
123
|
+
r[kState] |= kCloseEmitted;
|
|
124
|
+
}
|
|
125
|
+
if ((w && (w[kState] & kEmitClose) !== 0) ||
|
|
126
|
+
(r && (r[kState] & kEmitClose) !== 0)) {
|
|
127
|
+
self.emit("close");
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function emitErrorNT(self, err) {
|
|
131
|
+
const r = self._readableState;
|
|
132
|
+
const w = self._writableState;
|
|
133
|
+
if ((w && (w[kState] & kErrorEmitted) !== 0) ||
|
|
134
|
+
(r && (r[kState] & kErrorEmitted) !== 0)) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (w) {
|
|
138
|
+
w[kState] |= kErrorEmitted;
|
|
139
|
+
}
|
|
140
|
+
if (r) {
|
|
141
|
+
r[kState] |= kErrorEmitted;
|
|
142
|
+
}
|
|
143
|
+
self.emit("error", err);
|
|
144
|
+
}
|
|
145
|
+
export function undestroy() {
|
|
146
|
+
const r = this._readableState;
|
|
147
|
+
const w = this._writableState;
|
|
148
|
+
if (r) {
|
|
149
|
+
r.constructed = true;
|
|
150
|
+
r.closed = false;
|
|
151
|
+
r.closeEmitted = false;
|
|
152
|
+
r.destroyed = false;
|
|
153
|
+
r.errored = null;
|
|
154
|
+
r.errorEmitted = false;
|
|
155
|
+
r.reading = false;
|
|
156
|
+
r.ended = r.readable === false;
|
|
157
|
+
r.endEmitted = r.readable === false;
|
|
158
|
+
}
|
|
159
|
+
if (w) {
|
|
160
|
+
w.constructed = true;
|
|
161
|
+
w.destroyed = false;
|
|
162
|
+
w.closed = false;
|
|
163
|
+
w.closeEmitted = false;
|
|
164
|
+
w.errored = null;
|
|
165
|
+
w.errorEmitted = false;
|
|
166
|
+
w.finalCalled = false;
|
|
167
|
+
w.prefinished = false;
|
|
168
|
+
w.ended = w.writable === false;
|
|
169
|
+
w.ending = w.writable === false;
|
|
170
|
+
w.finished = w.writable === false;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
export function errorOrDestroy(stream, err, sync = false) {
|
|
174
|
+
// We have tests that rely on errors being emitted
|
|
175
|
+
// in the same tick, so changing this is semver major.
|
|
176
|
+
// For now when you opt-in to autoDestroy we allow
|
|
177
|
+
// the error to be emitted nextTick. In a future
|
|
178
|
+
// semver major update we should change the default to this.
|
|
179
|
+
const r = stream._readableState;
|
|
180
|
+
const w = stream._writableState;
|
|
181
|
+
if ((w && (w[kState] ? (w[kState] & kDestroyed) !== 0 : w.destroyed)) ||
|
|
182
|
+
(r && (r[kState] ? (r[kState] & kDestroyed) !== 0 : r.destroyed))) {
|
|
183
|
+
// @ts-expect-error TS2683 This should be somehow type-defined.
|
|
184
|
+
return this;
|
|
185
|
+
}
|
|
186
|
+
if ((r && (r[kState] & kAutoDestroy) !== 0) ||
|
|
187
|
+
(w && (w[kState] & kAutoDestroy) !== 0)) {
|
|
188
|
+
stream.destroy(err);
|
|
189
|
+
}
|
|
190
|
+
else if (err) {
|
|
191
|
+
// Avoid V8 leak, https://github.com/nodejs/node/pull/34103#issuecomment-652002364
|
|
192
|
+
err.stack; // eslint-disable-line @typescript-eslint/no-unused-expressions
|
|
193
|
+
if (w && (w[kState] & kErrored) === 0) {
|
|
194
|
+
w.errored = err;
|
|
195
|
+
}
|
|
196
|
+
if (r && (r[kState] & kErrored) === 0) {
|
|
197
|
+
r.errored = err;
|
|
198
|
+
}
|
|
199
|
+
if (sync) {
|
|
200
|
+
nextTick(emitErrorNT, stream, err);
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
emitErrorNT(stream, err);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return undefined;
|
|
207
|
+
}
|
|
208
|
+
export function construct(stream, cb) {
|
|
209
|
+
if (typeof stream._construct !== "function") {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const r = stream._readableState;
|
|
213
|
+
const w = stream._writableState;
|
|
214
|
+
if (r) {
|
|
215
|
+
r[kState] &= ~kConstructed;
|
|
216
|
+
}
|
|
217
|
+
if (w) {
|
|
218
|
+
w[kState] &= ~kConstructed;
|
|
219
|
+
}
|
|
220
|
+
stream.once(kConstruct, cb);
|
|
221
|
+
if (stream.listenerCount(kConstruct) > 1) {
|
|
222
|
+
// Duplex
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
nextTick(constructNT, stream);
|
|
226
|
+
}
|
|
227
|
+
function constructNT(stream) {
|
|
228
|
+
let called = false;
|
|
229
|
+
function onConstruct(err) {
|
|
230
|
+
if (called) {
|
|
231
|
+
errorOrDestroy(stream, err ?? new ERR_MULTIPLE_CALLBACK());
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
called = true;
|
|
235
|
+
const r = stream._readableState;
|
|
236
|
+
const w = stream._writableState;
|
|
237
|
+
const s = w || r;
|
|
238
|
+
if (r) {
|
|
239
|
+
r[kState] |= kConstructed;
|
|
240
|
+
}
|
|
241
|
+
if (w) {
|
|
242
|
+
w[kState] |= kConstructed;
|
|
243
|
+
}
|
|
244
|
+
if (s?.destroyed) {
|
|
245
|
+
stream.emit(kDestroy, err);
|
|
246
|
+
}
|
|
247
|
+
else if (err) {
|
|
248
|
+
errorOrDestroy(stream, err, true);
|
|
249
|
+
}
|
|
250
|
+
else {
|
|
251
|
+
stream.emit(kConstruct);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
try {
|
|
255
|
+
stream._construct?.((err) => {
|
|
256
|
+
nextTick(onConstruct, err);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
catch (err) {
|
|
260
|
+
nextTick(onConstruct, err);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
function isRequest(stream) {
|
|
264
|
+
return (stream != null &&
|
|
265
|
+
typeof stream === "object" &&
|
|
266
|
+
"setHeader" in stream &&
|
|
267
|
+
"abort" in stream &&
|
|
268
|
+
typeof stream.abort === "function");
|
|
269
|
+
}
|
|
270
|
+
function emitCloseLegacy(stream) {
|
|
271
|
+
stream.emit("close");
|
|
272
|
+
}
|
|
273
|
+
function emitErrorCloseLegacy(stream, err) {
|
|
274
|
+
stream.emit("error", err);
|
|
275
|
+
nextTick(emitCloseLegacy, stream);
|
|
276
|
+
}
|
|
277
|
+
// Normalize destroy for legacy.
|
|
278
|
+
export function destroyer(stream, err) {
|
|
279
|
+
if (!stream || isDestroyed(stream)) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (!err && !isFinished(stream)) {
|
|
283
|
+
err = new AbortError();
|
|
284
|
+
}
|
|
285
|
+
// TODO: Remove isRequest branches.
|
|
286
|
+
if (isServerRequest(stream)) {
|
|
287
|
+
// @ts-expect-error TS2540 - socket is read-only but we need to set it to null for cleanup
|
|
288
|
+
stream.socket = null;
|
|
289
|
+
stream.destroy(err);
|
|
290
|
+
}
|
|
291
|
+
else if (isRequest(stream)) {
|
|
292
|
+
// @ts-expect-error TS2339 - abort exists on OutgoingMessage but not in types
|
|
293
|
+
stream.abort();
|
|
294
|
+
}
|
|
295
|
+
else if (isRequest(stream.req)) {
|
|
296
|
+
// @ts-expect-error TS2339 - abort exists on req but not in all types
|
|
297
|
+
stream.req.abort();
|
|
298
|
+
}
|
|
299
|
+
else if (typeof stream.destroy === "function") {
|
|
300
|
+
stream.destroy(err);
|
|
301
|
+
}
|
|
302
|
+
else if ("close" in stream && typeof stream.close === "function") {
|
|
303
|
+
// TODO: Don't lose err?
|
|
304
|
+
stream.close();
|
|
305
|
+
}
|
|
306
|
+
else if (err) {
|
|
307
|
+
nextTick(emitErrorCloseLegacy, stream, err);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
nextTick(emitCloseLegacy, stream);
|
|
311
|
+
}
|
|
312
|
+
if (!stream.destroyed) {
|
|
313
|
+
stream[kIsDestroyed] = true;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare function Duplex(options: any): any;
|
|
2
|
+
export declare namespace Duplex {
|
|
3
|
+
export { fromWeb };
|
|
4
|
+
export { toWeb };
|
|
5
|
+
export { from };
|
|
6
|
+
}
|
|
7
|
+
export declare function fromWeb(pair: any, options: any): any;
|
|
8
|
+
export declare function toWeb(duplex: any): {
|
|
9
|
+
readable: ReadableStream<any>;
|
|
10
|
+
writable: WritableStream<any>;
|
|
11
|
+
};
|
|
12
|
+
export declare function toBYOBWeb(duplex: any): {
|
|
13
|
+
readable: ReadableStream<any>;
|
|
14
|
+
writable: WritableStream<any>;
|
|
15
|
+
};
|
|
16
|
+
export declare function from(body: any): any;
|
|
17
|
+
declare const kInitOtherSide: unique symbol;
|
|
18
|
+
declare class DuplexSide extends Duplex {
|
|
19
|
+
#private;
|
|
20
|
+
constructor(options: any);
|
|
21
|
+
[kInitOtherSide](otherSide: any): void;
|
|
22
|
+
_read(): void;
|
|
23
|
+
_write(chunk: any, encoding: any, callback: any): void;
|
|
24
|
+
_final(callback: any): void;
|
|
25
|
+
}
|
|
26
|
+
export declare function duplexPair(options: any): DuplexSide[];
|
|
27
|
+
/**
|
|
28
|
+
* @param {Duplex} duplex
|
|
29
|
+
* @returns {ReadableWritablePair}
|
|
30
|
+
*/
|
|
31
|
+
export declare function newReadableWritablePairFromDuplex(duplex: any, createTypeBytes?: boolean): {
|
|
32
|
+
readable: ReadableStream<any>;
|
|
33
|
+
writable: WritableStream<any>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* @param {ReadableWritablePair} pair
|
|
37
|
+
* @param {{
|
|
38
|
+
* allowHalfOpen? : boolean,
|
|
39
|
+
* decodeStrings? : boolean,
|
|
40
|
+
* encoding? : string,
|
|
41
|
+
* highWaterMark? : number,
|
|
42
|
+
* objectMode? : boolean,
|
|
43
|
+
* signal? : AbortSignal,
|
|
44
|
+
* }} [options]
|
|
45
|
+
* @returns {Duplex}
|
|
46
|
+
*/
|
|
47
|
+
export declare function newStreamDuplexFromReadableWritablePair(pair?: {}, options?: {}): any;
|
|
48
|
+
export {};
|