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,333 @@
|
|
|
1
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
2
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
// Adapted from Deno and Node.js:
|
|
6
|
+
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
|
7
|
+
//
|
|
8
|
+
// Adapted from Node.js. Copyright Joyent, Inc. and other Node contributors.
|
|
9
|
+
//
|
|
10
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
11
|
+
// copy of this software and associated documentation files (the
|
|
12
|
+
// "Software"), to deal in the Software without restriction, including
|
|
13
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
14
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
15
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
16
|
+
// following conditions:
|
|
17
|
+
//
|
|
18
|
+
// The above copyright notice and this permission notice shall be included
|
|
19
|
+
// in all copies or substantial portions of the Software.
|
|
20
|
+
//
|
|
21
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
22
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
23
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
24
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
25
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
26
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
27
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
28
|
+
import { NodeError, NodeRangeError, NodeTypeError } from "./error-base.js";
|
|
29
|
+
export { NodeErrorAbstraction, NodeError, NodeRangeError, NodeTypeError, } from "./error-base.js";
|
|
30
|
+
import { inspect } from "node:util";
|
|
31
|
+
const classRegExp = /^([A-Z][a-z0-9]*)+$/;
|
|
32
|
+
const kTypes = [
|
|
33
|
+
"string",
|
|
34
|
+
"function",
|
|
35
|
+
"number",
|
|
36
|
+
"object",
|
|
37
|
+
"Function",
|
|
38
|
+
"Object",
|
|
39
|
+
"boolean",
|
|
40
|
+
"bigint",
|
|
41
|
+
"symbol",
|
|
42
|
+
];
|
|
43
|
+
function createInvalidArgType(name, expected) {
|
|
44
|
+
// https://github.com/nodejs/node/blob/f3eb224/lib/internal/errors.js#L1037-L1087
|
|
45
|
+
expected = Array.isArray(expected) ? expected : [expected];
|
|
46
|
+
let msg = "The ";
|
|
47
|
+
if (name.endsWith(" argument")) {
|
|
48
|
+
// For cases like 'first argument'
|
|
49
|
+
msg += `${name} `;
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
53
|
+
msg += `"${name}" ${type} `;
|
|
54
|
+
}
|
|
55
|
+
msg += "must be ";
|
|
56
|
+
const types = [];
|
|
57
|
+
const instances = [];
|
|
58
|
+
const other = [];
|
|
59
|
+
for (const value of expected) {
|
|
60
|
+
if (kTypes.includes(value)) {
|
|
61
|
+
types.push(value.toLocaleLowerCase());
|
|
62
|
+
}
|
|
63
|
+
else if (classRegExp.test(value)) {
|
|
64
|
+
instances.push(value);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
other.push(value);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
// Special handle `object` in case other instances are allowed to outline
|
|
71
|
+
// the differences between each other.
|
|
72
|
+
if (instances.length > 0) {
|
|
73
|
+
const pos = types.indexOf("object");
|
|
74
|
+
if (pos !== -1) {
|
|
75
|
+
types.splice(pos, 1);
|
|
76
|
+
instances.push("Object");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
if (types.length > 0) {
|
|
80
|
+
if (types.length > 2) {
|
|
81
|
+
const last = types.pop();
|
|
82
|
+
msg += `one of type ${types.join(", ")}, or ${last}`;
|
|
83
|
+
}
|
|
84
|
+
else if (types.length === 2) {
|
|
85
|
+
msg += `one of type ${types[0]} or ${types[1]}`;
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
msg += `of type ${types[0]}`;
|
|
89
|
+
}
|
|
90
|
+
if (instances.length > 0 || other.length > 0) {
|
|
91
|
+
msg += " or ";
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (instances.length > 0) {
|
|
95
|
+
if (instances.length > 2) {
|
|
96
|
+
const last = instances.pop();
|
|
97
|
+
msg += `an instance of ${instances.join(", ")}, or ${last}`;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
msg += `an instance of ${instances[0]}`;
|
|
101
|
+
if (instances.length === 2) {
|
|
102
|
+
msg += ` or ${instances[1]}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (other.length > 0) {
|
|
106
|
+
msg += " or ";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (other.length > 0) {
|
|
110
|
+
if (other.length > 2) {
|
|
111
|
+
const last = other.pop();
|
|
112
|
+
msg += `one of ${other.join(", ")}, or ${last}`;
|
|
113
|
+
}
|
|
114
|
+
else if (other.length === 2) {
|
|
115
|
+
msg += `one of ${other[0]} or ${other[1]}`;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
if (other[0]?.toLowerCase() !== other[0]) {
|
|
119
|
+
msg += "an ";
|
|
120
|
+
}
|
|
121
|
+
msg += `${other[0]}`;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return msg;
|
|
125
|
+
}
|
|
126
|
+
function invalidArgTypeHelper(input) {
|
|
127
|
+
if (input == null) {
|
|
128
|
+
return ` Received ${input}`;
|
|
129
|
+
}
|
|
130
|
+
if (typeof input === "function" && input.name) {
|
|
131
|
+
return ` Received function ${input.name}`;
|
|
132
|
+
}
|
|
133
|
+
if (typeof input === "object") {
|
|
134
|
+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
|
135
|
+
if (input.constructor?.name) {
|
|
136
|
+
return ` Received an instance of ${input.constructor.name}`;
|
|
137
|
+
}
|
|
138
|
+
return ` Received ${inspect(input, { depth: -1 })}`;
|
|
139
|
+
}
|
|
140
|
+
let inspected = inspect(input, { colors: false });
|
|
141
|
+
if (inspected.length > 25) {
|
|
142
|
+
inspected = `${inspected.slice(0, 25)}...`;
|
|
143
|
+
}
|
|
144
|
+
return ` Received type ${typeof input} (${inspected})`;
|
|
145
|
+
}
|
|
146
|
+
function addNumericalSeparator(val) {
|
|
147
|
+
let res = "";
|
|
148
|
+
let i = val.length;
|
|
149
|
+
const start = val[0] === "-" ? 1 : 0;
|
|
150
|
+
for (; i >= start + 4; i -= 3) {
|
|
151
|
+
res = `_${val.slice(i - 3, i)}${res}`;
|
|
152
|
+
}
|
|
153
|
+
return `${val.slice(0, i)}${res}`;
|
|
154
|
+
}
|
|
155
|
+
export class ERR_INVALID_ARG_TYPE_RANGE extends NodeRangeError {
|
|
156
|
+
constructor(name, expected, actual) {
|
|
157
|
+
const msg = createInvalidArgType(name, expected);
|
|
158
|
+
super("ERR_INVALID_ARG_TYPE", `${msg}.${invalidArgTypeHelper(actual)}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
export class ERR_INVALID_ARG_TYPE extends NodeTypeError {
|
|
162
|
+
constructor(name, expected, actual) {
|
|
163
|
+
const msg = createInvalidArgType(name, expected);
|
|
164
|
+
super("ERR_INVALID_ARG_TYPE", `${msg}.${invalidArgTypeHelper(actual)}`);
|
|
165
|
+
}
|
|
166
|
+
static RangeError = ERR_INVALID_ARG_TYPE_RANGE;
|
|
167
|
+
}
|
|
168
|
+
export class ERR_INVALID_ARG_VALUE_RANGE extends NodeRangeError {
|
|
169
|
+
constructor(name, value, reason = "is invalid") {
|
|
170
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
171
|
+
const inspected = inspect(value);
|
|
172
|
+
super("ERR_INVALID_ARG_VALUE", `The ${type} '${name}' ${reason}. Received ${inspected}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export class ERR_INVALID_ARG_VALUE extends NodeTypeError {
|
|
176
|
+
constructor(name, value, reason = "is invalid") {
|
|
177
|
+
const type = name.includes(".") ? "property" : "argument";
|
|
178
|
+
const inspected = inspect(value);
|
|
179
|
+
super("ERR_INVALID_ARG_VALUE", `The ${type} '${name}' ${reason}. Received ${inspected}`);
|
|
180
|
+
}
|
|
181
|
+
static RangeError = ERR_INVALID_ARG_VALUE_RANGE;
|
|
182
|
+
}
|
|
183
|
+
export class ERR_OUT_OF_RANGE extends RangeError {
|
|
184
|
+
code = "ERR_OUT_OF_RANGE";
|
|
185
|
+
constructor(str, range, input, replaceDefaultBoolean = false) {
|
|
186
|
+
// TODO(later): Implement internal assert?
|
|
187
|
+
// assert(range, 'Missing "range" argument');
|
|
188
|
+
let msg = replaceDefaultBoolean
|
|
189
|
+
? str
|
|
190
|
+
: `The value of "${str}" is out of range.`;
|
|
191
|
+
let received;
|
|
192
|
+
if (Number.isInteger(input) && Math.abs(input) > 2 ** 32) {
|
|
193
|
+
received = addNumericalSeparator(String(input));
|
|
194
|
+
}
|
|
195
|
+
else if (typeof input === "bigint") {
|
|
196
|
+
received = String(input);
|
|
197
|
+
if (input > 2n ** 32n || input < -(2n ** 32n)) {
|
|
198
|
+
received = addNumericalSeparator(received);
|
|
199
|
+
}
|
|
200
|
+
received += "n";
|
|
201
|
+
}
|
|
202
|
+
else {
|
|
203
|
+
received = inspect(input);
|
|
204
|
+
}
|
|
205
|
+
msg += ` It must be ${range}. Received ${received}`;
|
|
206
|
+
super(msg);
|
|
207
|
+
const { name } = this;
|
|
208
|
+
// Add the error code to the name to include it in the stack trace.
|
|
209
|
+
this.name = `${name} [${this.code}]`;
|
|
210
|
+
// Access the stack to generate the error message including the error code from the name.
|
|
211
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
212
|
+
this.stack;
|
|
213
|
+
// Reset the name to the actual name.
|
|
214
|
+
this.name = name;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
export class AbortError extends Error {
|
|
218
|
+
code;
|
|
219
|
+
constructor(message = "The operation was aborted", options) {
|
|
220
|
+
if (options !== undefined && typeof options !== "object") {
|
|
221
|
+
throw new ERR_INVALID_ARG_TYPE("options", "Object", options);
|
|
222
|
+
}
|
|
223
|
+
super(message, options);
|
|
224
|
+
this.code = "ABORT_ERR";
|
|
225
|
+
this.name = "AbortError";
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
export class ERR_MISSING_ARGS extends NodeTypeError {
|
|
229
|
+
constructor(...args) {
|
|
230
|
+
let msg = "The ";
|
|
231
|
+
const len = args.length;
|
|
232
|
+
const wrap = (a) => `"${a}"`;
|
|
233
|
+
args = args.map((a) => Array.isArray(a) ? a.map(wrap).join(" or ") : wrap(a));
|
|
234
|
+
switch (len) {
|
|
235
|
+
case 1:
|
|
236
|
+
msg += `${args[0]} argument`;
|
|
237
|
+
break;
|
|
238
|
+
case 2:
|
|
239
|
+
msg += `${args[0]} and ${args[1]} arguments`;
|
|
240
|
+
break;
|
|
241
|
+
default:
|
|
242
|
+
msg += args.slice(0, len - 1).join(", ");
|
|
243
|
+
msg += `, and ${args[len - 1]} arguments`;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
super("ERR_MISSING_ARGS", `${msg} must be specified`);
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
export class ERR_OPTION_NOT_IMPLEMENTED extends NodeError {
|
|
250
|
+
constructor(name) {
|
|
251
|
+
if (typeof name === "symbol") {
|
|
252
|
+
name = name.description;
|
|
253
|
+
}
|
|
254
|
+
super("ERR_OPTION_NOT_IMPLEMENTED", `The ${name} option is not implemented`);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
export class ERR_SOCKET_BAD_PORT extends NodeError {
|
|
258
|
+
constructor(name, port, allowZero) {
|
|
259
|
+
const operator = allowZero ? ">=" : ">";
|
|
260
|
+
super("ERR_SOCKET_BAD_PORT", `${name} should be ${operator} 0 and < 65536. Received ${typeof port}.`);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
export class EADDRINUSE extends NodeError {
|
|
264
|
+
syscall = "bind";
|
|
265
|
+
address;
|
|
266
|
+
port;
|
|
267
|
+
constructor(address, port) {
|
|
268
|
+
super("EADDRINUSE", `bind EADDRINUSE ${address}:${port}`);
|
|
269
|
+
this.address = address;
|
|
270
|
+
this.port = port;
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
export class EADDRNOTAVAIL extends NodeError {
|
|
274
|
+
syscall = "bind";
|
|
275
|
+
address;
|
|
276
|
+
port;
|
|
277
|
+
constructor(address, port) {
|
|
278
|
+
super("EADDRNOTAVAIL", `bind EADDRNOTAVAIL ${address}:${port}`);
|
|
279
|
+
this.address = address;
|
|
280
|
+
this.port = port;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
export class EPIPE extends NodeError {
|
|
284
|
+
constructor() {
|
|
285
|
+
super("EPIPE", "This socket has been ended by the other party");
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
export class ENOBUFS extends NodeError {
|
|
289
|
+
syscall = "read";
|
|
290
|
+
constructor() {
|
|
291
|
+
super("ENOBUFS", "read ENOBUFS");
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
export class ERR_SOCKET_CLOSED_BEFORE_CONNECTION extends NodeError {
|
|
295
|
+
constructor() {
|
|
296
|
+
super("ERR_SOCKET_CLOSED_BEFORE_CONNECTION", "Socket closed before connection established");
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
export class ERR_SOCKET_CLOSED extends NodeError {
|
|
300
|
+
constructor() {
|
|
301
|
+
super("ERR_SOCKET_CLOSED", "Socket is closed");
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
export class ERR_SOCKET_CONNECTING extends NodeError {
|
|
305
|
+
constructor() {
|
|
306
|
+
super("ERR_SOCKET_CONNECTING", "Socket is already connecting");
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
export class ERR_SOCKET_HANDLE_ADOPTED extends NodeError {
|
|
310
|
+
constructor() {
|
|
311
|
+
super("ERR_SOCKET_HANDLE_ADOPTED", "The bound socket has already been adopted by a server or socket");
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
export class ERR_INVALID_IP_ADDRESS extends NodeTypeError {
|
|
315
|
+
constructor(ipAddress) {
|
|
316
|
+
super("ERR_INVALID_IP_ADDRESS", `Invalid IP address: ${ipAddress}`);
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
export class ERR_INVALID_ADDRESS extends NodeTypeError {
|
|
320
|
+
constructor() {
|
|
321
|
+
super("ERR_INVALID_ADDRESS", "Invalid socket address");
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
export class ERR_SERVER_ALREADY_LISTEN extends NodeError {
|
|
325
|
+
constructor() {
|
|
326
|
+
super("ERR_SERVER_ALREADY_LISTEN", "Listen method has been called more than once without closing.");
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
export class ERR_SERVER_NOT_RUNNING extends NodeError {
|
|
330
|
+
constructor() {
|
|
331
|
+
super("ERR_SERVER_NOT_RUNNING", "Server is not running.");
|
|
332
|
+
}
|
|
333
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BlockList, BoundSocket, SocketAddress, Server, Socket, connect, createConnection, createServer, getDefaultAutoSelectFamily, setDefaultAutoSelectFamily, getDefaultAutoSelectFamilyAttemptTimeout, setDefaultAutoSelectFamilyAttemptTimeout, isIP, isIPv4, isIPv6, _normalizeArgs } from "./internal-net.js";
|
|
2
|
+
export declare const Stream: typeof Socket;
|
|
3
|
+
export { BlockList, BoundSocket, SocketAddress, Server, Socket, connect, createConnection, createServer, getDefaultAutoSelectFamily, setDefaultAutoSelectFamily, getDefaultAutoSelectFamilyAttemptTimeout, setDefaultAutoSelectFamilyAttemptTimeout, isIP, isIPv4, isIPv6, _normalizeArgs, };
|
|
4
|
+
declare const _default: {
|
|
5
|
+
BlockList: typeof BlockList;
|
|
6
|
+
BoundSocket: typeof BoundSocket;
|
|
7
|
+
SocketAddress: typeof SocketAddress;
|
|
8
|
+
Stream: typeof Socket;
|
|
9
|
+
Server: typeof Server;
|
|
10
|
+
Socket: typeof Socket;
|
|
11
|
+
connect: typeof connect;
|
|
12
|
+
createConnection: typeof connect;
|
|
13
|
+
createServer: typeof createServer;
|
|
14
|
+
getDefaultAutoSelectFamily: typeof getDefaultAutoSelectFamily;
|
|
15
|
+
setDefaultAutoSelectFamily: typeof setDefaultAutoSelectFamily;
|
|
16
|
+
getDefaultAutoSelectFamilyAttemptTimeout: typeof getDefaultAutoSelectFamilyAttemptTimeout;
|
|
17
|
+
setDefaultAutoSelectFamilyAttemptTimeout: typeof setDefaultAutoSelectFamilyAttemptTimeout;
|
|
18
|
+
isIP: typeof isIP;
|
|
19
|
+
isIPv4: typeof isIPv4;
|
|
20
|
+
isIPv6: typeof isIPv6;
|
|
21
|
+
_normalizeArgs: typeof _normalizeArgs;
|
|
22
|
+
};
|
|
23
|
+
export default _default;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
2
|
+
// Licensed under the Apache 2.0 license found in the LICENSE file or at:
|
|
3
|
+
// https://opensource.org/licenses/Apache-2.0
|
|
4
|
+
//
|
|
5
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
6
|
+
//
|
|
7
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
8
|
+
// copy of this software and associated documentation files (the
|
|
9
|
+
// "Software"), to deal in the Software without restriction, including
|
|
10
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
12
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
13
|
+
// following conditions:
|
|
14
|
+
//
|
|
15
|
+
// The above copyright notice and this permission notice shall be included
|
|
16
|
+
// in all copies or substantial portions of the Software.
|
|
17
|
+
//
|
|
18
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
19
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
21
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
22
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
23
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
24
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
25
|
+
import { BlockList, BoundSocket, SocketAddress, Server, Socket, connect, createConnection, createServer, getDefaultAutoSelectFamily, setDefaultAutoSelectFamily, getDefaultAutoSelectFamilyAttemptTimeout, setDefaultAutoSelectFamilyAttemptTimeout, isIP, isIPv4, isIPv6, _normalizeArgs, } from "./internal-net.js";
|
|
26
|
+
export const Stream = Socket;
|
|
27
|
+
export { BlockList, BoundSocket, SocketAddress, Server, Socket, connect, createConnection, createServer, getDefaultAutoSelectFamily, setDefaultAutoSelectFamily, getDefaultAutoSelectFamilyAttemptTimeout, setDefaultAutoSelectFamilyAttemptTimeout, isIP, isIPv4, isIPv6, _normalizeArgs, };
|
|
28
|
+
export default {
|
|
29
|
+
BlockList,
|
|
30
|
+
BoundSocket,
|
|
31
|
+
SocketAddress,
|
|
32
|
+
Stream: Socket,
|
|
33
|
+
Server,
|
|
34
|
+
Socket,
|
|
35
|
+
connect,
|
|
36
|
+
createConnection,
|
|
37
|
+
createServer,
|
|
38
|
+
getDefaultAutoSelectFamily,
|
|
39
|
+
setDefaultAutoSelectFamily,
|
|
40
|
+
getDefaultAutoSelectFamilyAttemptTimeout,
|
|
41
|
+
setDefaultAutoSelectFamilyAttemptTimeout,
|
|
42
|
+
isIP,
|
|
43
|
+
isIPv4,
|
|
44
|
+
isIPv6,
|
|
45
|
+
_normalizeArgs,
|
|
46
|
+
};
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { socketReader } from "./reader.js";
|
|
2
|
+
import inner from "./sockets.js";
|
|
3
|
+
import { EventEmitter } from "node:events";
|
|
4
|
+
declare const kDestroyed: unique symbol;
|
|
5
|
+
declare const kIsReadable: unique symbol;
|
|
6
|
+
declare const kIsWritable: unique symbol;
|
|
7
|
+
import type { AddressInfo, Socket as _Socket, SocketAddress as _SocketAddress, SocketAddressInitOptions, IPVersion, OnReadOpts } from "node:net";
|
|
8
|
+
import type { InspectOptions } from "node:util";
|
|
9
|
+
import type { Writable } from "node:stream";
|
|
10
|
+
type JSStreamSocket = Socket;
|
|
11
|
+
import { asyncDispose, dispose } from "../../shared/globals/symbols.js";
|
|
12
|
+
declare const kInspect: symbol;
|
|
13
|
+
declare const kLastWriteQueueSize: unique symbol;
|
|
14
|
+
declare const kTimeout: unique symbol;
|
|
15
|
+
declare const kBuffer: unique symbol;
|
|
16
|
+
declare const kBufferCb: unique symbol;
|
|
17
|
+
declare const kBufferGen: unique symbol;
|
|
18
|
+
declare const kBufferContinuations: unique symbol;
|
|
19
|
+
declare const kBytesRead: unique symbol;
|
|
20
|
+
declare const kBytesWritten: unique symbol;
|
|
21
|
+
export declare const normalizedArgsSymbol: unique symbol;
|
|
22
|
+
export declare const kReinitializeHandle: unique symbol;
|
|
23
|
+
declare const kSocketInfo: unique symbol;
|
|
24
|
+
declare const kBoundSource: unique symbol;
|
|
25
|
+
declare const kBoundReserved: unique symbol;
|
|
26
|
+
declare const kBoundSocketConsume: unique symbol;
|
|
27
|
+
export declare function bindPort(address: string, port: number, reusePort?: boolean): number;
|
|
28
|
+
export type SocketOptions = {
|
|
29
|
+
timeout?: number;
|
|
30
|
+
writable?: boolean;
|
|
31
|
+
readable?: boolean;
|
|
32
|
+
decodeStrings?: boolean;
|
|
33
|
+
autoDestroy?: boolean;
|
|
34
|
+
objectMode?: boolean;
|
|
35
|
+
readableObjectMode?: boolean;
|
|
36
|
+
writableObjectMode?: boolean;
|
|
37
|
+
keepAliveInitialDelay?: number;
|
|
38
|
+
fd?: number;
|
|
39
|
+
handle?: Socket["_handle"] | BoundSocket;
|
|
40
|
+
noDelay?: boolean;
|
|
41
|
+
keepAlive?: boolean;
|
|
42
|
+
allowHalfOpen?: boolean;
|
|
43
|
+
emitClose?: boolean;
|
|
44
|
+
signal?: AbortSignal;
|
|
45
|
+
onread?: OnReadOpts | null;
|
|
46
|
+
};
|
|
47
|
+
export type BoundSocketOptions = {
|
|
48
|
+
host?: string | null;
|
|
49
|
+
port?: number | string;
|
|
50
|
+
path?: string;
|
|
51
|
+
ipv6Only?: boolean;
|
|
52
|
+
reusePort?: boolean;
|
|
53
|
+
};
|
|
54
|
+
export declare class BoundSocket {
|
|
55
|
+
#private;
|
|
56
|
+
static isBoundSocket(value: unknown): value is BoundSocket;
|
|
57
|
+
constructor(options?: BoundSocketOptions);
|
|
58
|
+
address(): AddressInfo;
|
|
59
|
+
fd(): number;
|
|
60
|
+
close(): void;
|
|
61
|
+
[dispose](): void;
|
|
62
|
+
[kBoundSocketConsume](): {
|
|
63
|
+
address: AddressInfo;
|
|
64
|
+
ephemeral: boolean;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export type LocalAddressInfo = Omit<AddressInfo, "family"> & {
|
|
68
|
+
family?: string;
|
|
69
|
+
};
|
|
70
|
+
export type ServerOptions = {
|
|
71
|
+
allowHalfOpen?: boolean;
|
|
72
|
+
pauseOnConnect?: boolean;
|
|
73
|
+
noDelay?: boolean;
|
|
74
|
+
keepAlive?: boolean;
|
|
75
|
+
keepAliveInitialDelay?: number;
|
|
76
|
+
highWaterMark?: number;
|
|
77
|
+
};
|
|
78
|
+
export declare class Server extends EventEmitter {
|
|
79
|
+
#private;
|
|
80
|
+
allowHalfOpen: boolean;
|
|
81
|
+
pauseOnConnect: boolean;
|
|
82
|
+
noDelay: boolean;
|
|
83
|
+
keepAlive: boolean;
|
|
84
|
+
keepAliveInitialDelay: number;
|
|
85
|
+
highWaterMark: number | undefined;
|
|
86
|
+
maxConnections: number | undefined;
|
|
87
|
+
constructor(options?: ServerOptions | ((socket: Socket) => void), connectionListener?: (socket: Socket) => void);
|
|
88
|
+
listen(...args: unknown[]): this;
|
|
89
|
+
address(): LocalAddressInfo | null;
|
|
90
|
+
get listening(): boolean;
|
|
91
|
+
close(cb?: (err?: Error) => void): this;
|
|
92
|
+
getConnections(cb: (err: Error | null, count: number) => void): this;
|
|
93
|
+
ref(): this;
|
|
94
|
+
unref(): this;
|
|
95
|
+
[asyncDispose](): Promise<void>;
|
|
96
|
+
}
|
|
97
|
+
export type SocketWriteData = Array<{
|
|
98
|
+
chunk: any;
|
|
99
|
+
encoding: BufferEncoding;
|
|
100
|
+
}>;
|
|
101
|
+
export declare class Socket extends _Socket {
|
|
102
|
+
timeout: number;
|
|
103
|
+
connecting: boolean;
|
|
104
|
+
_aborted: boolean;
|
|
105
|
+
_hadError: boolean;
|
|
106
|
+
_parent: null | Socket["_handle"];
|
|
107
|
+
_parentWrap: null | Socket | JSStreamSocket;
|
|
108
|
+
_host: null | string;
|
|
109
|
+
_peername: null | string;
|
|
110
|
+
_getsockname(): {
|
|
111
|
+
address?: string;
|
|
112
|
+
port?: number;
|
|
113
|
+
family?: string;
|
|
114
|
+
};
|
|
115
|
+
[kLastWriteQueueSize]: number | null | undefined;
|
|
116
|
+
[kTimeout]: Socket | null | undefined;
|
|
117
|
+
[kBuffer]: null | boolean;
|
|
118
|
+
[kBufferCb]: null | undefined | ((len: number, buf: Uint8Array) => boolean | Uint8Array);
|
|
119
|
+
[kBufferGen]: null | (() => undefined | Uint8Array);
|
|
120
|
+
[kBufferContinuations]: null | WeakMap<Uint8Array, Uint8Array>;
|
|
121
|
+
[kSocketInfo]: null | {
|
|
122
|
+
address?: string;
|
|
123
|
+
port?: number;
|
|
124
|
+
family?: number | string;
|
|
125
|
+
remoteAddress?: Record<string, unknown>;
|
|
126
|
+
};
|
|
127
|
+
[kBytesRead]: number;
|
|
128
|
+
[kBytesWritten]: number;
|
|
129
|
+
[kBoundSource]: LocalAddressInfo | null;
|
|
130
|
+
[kBoundReserved]: boolean;
|
|
131
|
+
server: Server | null;
|
|
132
|
+
_server: Server | null;
|
|
133
|
+
[kReinitializeHandle](handle: Socket["_handle"]): void;
|
|
134
|
+
_closeAfterHandlingError: boolean;
|
|
135
|
+
_handle: null | {
|
|
136
|
+
writeQueueSize?: number;
|
|
137
|
+
lastWriteQueueSize?: number;
|
|
138
|
+
reading: boolean | undefined;
|
|
139
|
+
readLoopActive?: boolean;
|
|
140
|
+
handedOver?: boolean;
|
|
141
|
+
bytesRead: number;
|
|
142
|
+
bytesWritten: number;
|
|
143
|
+
socket: ReturnType<typeof inner.connect>;
|
|
144
|
+
reader: ReturnType<typeof socketReader>;
|
|
145
|
+
writer: WritableStreamDefaultWriter<unknown>;
|
|
146
|
+
options: {
|
|
147
|
+
host: string;
|
|
148
|
+
port: number;
|
|
149
|
+
addressType: number;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
_onTimeout(): void;
|
|
153
|
+
_unrefTimer(): void;
|
|
154
|
+
_writeGeneric(writev: boolean, data: SocketWriteData, encoding: string, cb: (err?: Error) => void): void;
|
|
155
|
+
_final(cb: (err?: Error) => void): void;
|
|
156
|
+
_read(n: number): void;
|
|
157
|
+
_reset(): void;
|
|
158
|
+
_getpeername(): Record<string, unknown>;
|
|
159
|
+
_readableState: undefined;
|
|
160
|
+
_closed: boolean;
|
|
161
|
+
writableErrored: boolean;
|
|
162
|
+
readableErrored: boolean;
|
|
163
|
+
[kIsReadable]: boolean;
|
|
164
|
+
[kIsWritable]: boolean;
|
|
165
|
+
[kDestroyed]: boolean;
|
|
166
|
+
_writableState: undefined;
|
|
167
|
+
_bytesDispatched: number;
|
|
168
|
+
_pendingData: SocketWriteData | null;
|
|
169
|
+
_pendingEncoding: string;
|
|
170
|
+
_undestroy(): void;
|
|
171
|
+
writableBuffer?: Writable & {
|
|
172
|
+
allBuffers: boolean;
|
|
173
|
+
length: number;
|
|
174
|
+
};
|
|
175
|
+
encrypted?: boolean;
|
|
176
|
+
_finishInit(): void;
|
|
177
|
+
constructor(options?: SocketOptions);
|
|
178
|
+
prototype: Socket;
|
|
179
|
+
resetAndClosing?: boolean;
|
|
180
|
+
}
|
|
181
|
+
export declare function Socket(this: Socket, options?: SocketOptions): Socket;
|
|
182
|
+
export declare function onConnectionOpened(this: Socket): void;
|
|
183
|
+
export declare function onConnectionClosed(this: Socket): void;
|
|
184
|
+
export declare function tryReadStart(socket: Socket): void;
|
|
185
|
+
export declare function getTimerDuration(msecs: unknown, name: string): number;
|
|
186
|
+
export declare function toNumber(x: unknown): number | false;
|
|
187
|
+
export declare function isPipeName(s: unknown): boolean;
|
|
188
|
+
export type NormalizedArgs = [
|
|
189
|
+
{
|
|
190
|
+
path?: string;
|
|
191
|
+
port?: number;
|
|
192
|
+
host?: string;
|
|
193
|
+
},
|
|
194
|
+
((...args: unknown[]) => void) | null
|
|
195
|
+
];
|
|
196
|
+
export declare function _normalizeArgs(args: unknown[]): NormalizedArgs;
|
|
197
|
+
export declare function connect(...args: unknown[]): Socket;
|
|
198
|
+
export declare const createConnection: typeof connect;
|
|
199
|
+
export declare function createServer(options?: ServerOptions | ((socket: Socket) => void), connectionListener?: (socket: Socket) => void): Server;
|
|
200
|
+
export declare function getDefaultAutoSelectFamily(): boolean;
|
|
201
|
+
export declare function setDefaultAutoSelectFamily(val: unknown): void;
|
|
202
|
+
export declare function getDefaultAutoSelectFamilyAttemptTimeout(): number;
|
|
203
|
+
export declare function setDefaultAutoSelectFamilyAttemptTimeout(val: unknown): void;
|
|
204
|
+
export declare function isIP(input: unknown): number;
|
|
205
|
+
export declare function isIPv4(input: unknown): boolean;
|
|
206
|
+
export declare function isIPv6(input: unknown): boolean;
|
|
207
|
+
export declare class SocketAddress implements _SocketAddress {
|
|
208
|
+
#private;
|
|
209
|
+
[kInspect]: (depth: number, options: InspectOptions) => string | this;
|
|
210
|
+
static isSocketAddress(value: unknown): value is SocketAddress;
|
|
211
|
+
constructor(options?: SocketAddressInitOptions);
|
|
212
|
+
get address(): string;
|
|
213
|
+
get port(): number;
|
|
214
|
+
get family(): IPVersion;
|
|
215
|
+
get flowlabel(): number;
|
|
216
|
+
toJSON(): {
|
|
217
|
+
address: string;
|
|
218
|
+
port: number;
|
|
219
|
+
family: IPVersion;
|
|
220
|
+
flowlabel: number;
|
|
221
|
+
};
|
|
222
|
+
static parse(input: string): SocketAddress | undefined;
|
|
223
|
+
}
|
|
224
|
+
export declare class BlockList {
|
|
225
|
+
#private;
|
|
226
|
+
[kInspect]: (depth: number, options: InspectOptions) => string;
|
|
227
|
+
static isBlockList(value: unknown): value is BlockList;
|
|
228
|
+
addAddress(address: string | SocketAddress, family?: "ipv4" | "ipv6"): void;
|
|
229
|
+
addRange(start: string | SocketAddress, end: string | SocketAddress, family?: "ipv4" | "ipv6"): void;
|
|
230
|
+
addSubnet(network: string | SocketAddress, prefix: number, family?: "ipv4" | "ipv6"): void;
|
|
231
|
+
check(address: string | SocketAddress, family?: "ipv4" | "ipv6"): boolean;
|
|
232
|
+
get rules(): string[];
|
|
233
|
+
toJSON(): string[];
|
|
234
|
+
fromJSON(data: string | string[]): void;
|
|
235
|
+
}
|
|
236
|
+
export {};
|