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,7 @@
|
|
|
1
|
+
import { type DocumentRuntime } from "./host.js";
|
|
2
|
+
export declare function clearPreviousRendering(): Promise<void> | undefined;
|
|
3
|
+
export declare function validateRendering(render: string, baseURL: string): void;
|
|
4
|
+
export declare function startRendering(runtime: DocumentRuntime, render: string, baseURL: string, nativeFetch: typeof fetch): {
|
|
5
|
+
ready: Promise<void>;
|
|
6
|
+
dispose(): Promise<void>;
|
|
7
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { enableDocumentWorker, isDocumentWorker, registerDocumentWorker, stopDocumentWorker, } from "./registration.js";
|
|
2
|
+
import { installDocumentHost } from "./host.js";
|
|
3
|
+
function bridge() {
|
|
4
|
+
const host = globalThis.WorkersCapacitorHost;
|
|
5
|
+
if (host &&
|
|
6
|
+
new URL(location.href).searchParams.has("__workers_capacitor_host"))
|
|
7
|
+
return {
|
|
8
|
+
getPlatform: () => "android",
|
|
9
|
+
isPluginAvailable: (name) => name === "WorkersCapacitor",
|
|
10
|
+
nativePromise: async (_name, method) => {
|
|
11
|
+
if (method === "hostReady")
|
|
12
|
+
host.ready();
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
return globalThis
|
|
16
|
+
.Capacitor;
|
|
17
|
+
}
|
|
18
|
+
export function clearPreviousRendering() {
|
|
19
|
+
if (bridge()?.getPlatform() === "android")
|
|
20
|
+
return stopDocumentWorker();
|
|
21
|
+
}
|
|
22
|
+
export function validateRendering(render, baseURL) {
|
|
23
|
+
const base = new URL(baseURL);
|
|
24
|
+
if (!["http:", "https:"].includes(base.protocol) ||
|
|
25
|
+
base.pathname !== "/" ||
|
|
26
|
+
base.search ||
|
|
27
|
+
base.hash ||
|
|
28
|
+
base.username ||
|
|
29
|
+
base.password)
|
|
30
|
+
throw new TypeError("Document rendering requires an HTTP(S) origin as baseURL");
|
|
31
|
+
if (typeof render !== "string" ||
|
|
32
|
+
!render.startsWith("/") ||
|
|
33
|
+
render.startsWith("//") ||
|
|
34
|
+
render.includes("\\") ||
|
|
35
|
+
new URL(render, "https://local.invalid").origin !== "https://local.invalid")
|
|
36
|
+
throw new TypeError("render must be a local absolute path");
|
|
37
|
+
if (!bridge() || !["ios", "android"].includes(bridge().getPlatform()))
|
|
38
|
+
throw new Error("Document rendering currently requires native Capacitor");
|
|
39
|
+
if (!bridge().isPluginAvailable("WorkersCapacitor"))
|
|
40
|
+
throw new Error("WorkersCapacitor native integration is not installed");
|
|
41
|
+
}
|
|
42
|
+
export function startRendering(runtime, render, baseURL, nativeFetch) {
|
|
43
|
+
const native = bridge();
|
|
44
|
+
const uninstall = installDocumentHost(runtime, baseURL);
|
|
45
|
+
let closed = false;
|
|
46
|
+
const startup = new AbortController();
|
|
47
|
+
let started = false;
|
|
48
|
+
const call = (method, options = {}) => native.nativePromise("WorkersCapacitor", method, options);
|
|
49
|
+
const ready = (async () => {
|
|
50
|
+
await runtime.ready;
|
|
51
|
+
if (closed)
|
|
52
|
+
throw new Error("Document rendering disposed");
|
|
53
|
+
if (native.getPlatform() === "android" &&
|
|
54
|
+
new URL(location.href).searchParams.has("__workers_capacitor_host")) {
|
|
55
|
+
await call("hostReady");
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const response = await nativeFetch("/workers-capacitor-assets.json", {
|
|
59
|
+
signal: startup.signal,
|
|
60
|
+
});
|
|
61
|
+
if (!response.ok)
|
|
62
|
+
throw new Error("Document assets are missing; build with workersCapacitorPlugin before Capacitor copy/sync");
|
|
63
|
+
const assets = await response.json();
|
|
64
|
+
if (!Array.isArray(assets) ||
|
|
65
|
+
assets.some((path) => typeof path !== "string" || !path.startsWith("/")))
|
|
66
|
+
throw new Error("Invalid document assets manifest");
|
|
67
|
+
if (assets.includes(new URL(render, "https://local.invalid").pathname))
|
|
68
|
+
throw new TypeError("render must target a Worker route, not a bundled asset");
|
|
69
|
+
if (closed)
|
|
70
|
+
throw new Error("Document rendering disposed");
|
|
71
|
+
const pageScript = native.getPlatform() === "ios"
|
|
72
|
+
? (await import("./page-source.js")).pageScript
|
|
73
|
+
: "";
|
|
74
|
+
if (closed)
|
|
75
|
+
throw new Error("Document rendering disposed");
|
|
76
|
+
const linksScript = native.getPlatform() === "android"
|
|
77
|
+
? (await import("./links-source.js")).linksScript
|
|
78
|
+
: "";
|
|
79
|
+
if (closed)
|
|
80
|
+
throw new Error("Document rendering disposed");
|
|
81
|
+
started = true;
|
|
82
|
+
await call("start", {
|
|
83
|
+
baseURL: new URL(baseURL).origin,
|
|
84
|
+
entry: render,
|
|
85
|
+
pageScript,
|
|
86
|
+
linksScript,
|
|
87
|
+
assets,
|
|
88
|
+
bootstrapURL: new URL("/index.html?__workers_capacitor_host=1", location.href).href,
|
|
89
|
+
});
|
|
90
|
+
if (closed)
|
|
91
|
+
throw new Error("Document rendering disposed");
|
|
92
|
+
if (native.getPlatform() === "android") {
|
|
93
|
+
const registration = await registerDocumentWorker(new URL(baseURL).origin);
|
|
94
|
+
await new Promise((resolve, reject) => {
|
|
95
|
+
const workers = navigator.serviceWorker;
|
|
96
|
+
const finish = (error) => {
|
|
97
|
+
clearTimeout(timer);
|
|
98
|
+
workers.removeEventListener("controllerchange", controlled);
|
|
99
|
+
startup.signal.removeEventListener("abort", aborted);
|
|
100
|
+
error ? reject(error) : resolve();
|
|
101
|
+
};
|
|
102
|
+
const controlled = () => {
|
|
103
|
+
if (!registration.installing &&
|
|
104
|
+
!registration.waiting &&
|
|
105
|
+
workers.controller === registration.active &&
|
|
106
|
+
isDocumentWorker(workers.controller))
|
|
107
|
+
finish();
|
|
108
|
+
};
|
|
109
|
+
const aborted = () => finish(new Error("Document rendering disposed"));
|
|
110
|
+
const timer = setTimeout(() => finish(new Error("Document Service Worker startup timed out")), 15000);
|
|
111
|
+
workers.addEventListener("controllerchange", controlled);
|
|
112
|
+
startup.signal.addEventListener("abort", aborted, { once: true });
|
|
113
|
+
if (startup.signal.aborted)
|
|
114
|
+
aborted();
|
|
115
|
+
else
|
|
116
|
+
workers.ready.then(controlled, (error) => finish(error));
|
|
117
|
+
});
|
|
118
|
+
if (closed)
|
|
119
|
+
throw new Error("Document rendering disposed");
|
|
120
|
+
await enableDocumentWorker();
|
|
121
|
+
if (closed)
|
|
122
|
+
throw new Error("Document rendering disposed");
|
|
123
|
+
location.replace(render);
|
|
124
|
+
}
|
|
125
|
+
})();
|
|
126
|
+
// A failed start must also release native resources. The installer restores fetch.
|
|
127
|
+
const settled = ready.catch(async (error) => {
|
|
128
|
+
uninstall();
|
|
129
|
+
try {
|
|
130
|
+
if (native.getPlatform() === "android")
|
|
131
|
+
await stopDocumentWorker();
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
if (started) {
|
|
135
|
+
started = false;
|
|
136
|
+
await call("stop").catch(() => { });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
throw error;
|
|
140
|
+
});
|
|
141
|
+
return {
|
|
142
|
+
ready: settled,
|
|
143
|
+
async dispose() {
|
|
144
|
+
closed = true;
|
|
145
|
+
startup.abort();
|
|
146
|
+
uninstall();
|
|
147
|
+
// Native stop also rejects Android's pending host-start call.
|
|
148
|
+
try {
|
|
149
|
+
if (started) {
|
|
150
|
+
started = false;
|
|
151
|
+
await call("stop");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
finally {
|
|
155
|
+
await settled.catch(() => { });
|
|
156
|
+
if (native.getPlatform() === "android")
|
|
157
|
+
await stopDocumentWorker();
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
// Native Android document transport. Bundled assets bypass the Worker router.
|
|
2
|
+
// Persist shutdown across SW idle termination while an old page is still controlled.
|
|
3
|
+
const lifecycleCache = "workers-capacitor-document-lifecycle";
|
|
4
|
+
const disabledKey = new URL("/workers-capacitor-disabled", self.location.href)
|
|
5
|
+
.href;
|
|
6
|
+
let disabled = false;
|
|
7
|
+
self.addEventListener("message", (event) => {
|
|
8
|
+
if (
|
|
9
|
+
![
|
|
10
|
+
"workers-capacitor:disable-documents",
|
|
11
|
+
"workers-capacitor:enable-documents",
|
|
12
|
+
].includes(event.data)
|
|
13
|
+
)
|
|
14
|
+
return;
|
|
15
|
+
disabled = event.data === "workers-capacitor:disable-documents";
|
|
16
|
+
const stopping = disabled;
|
|
17
|
+
event.waitUntil(
|
|
18
|
+
(async () => {
|
|
19
|
+
const cache = await caches.open(lifecycleCache);
|
|
20
|
+
if (stopping) await cache.put(disabledKey, new Response("disabled"));
|
|
21
|
+
else await cache.delete(disabledKey);
|
|
22
|
+
event.ports[0]?.postMessage("done");
|
|
23
|
+
})(),
|
|
24
|
+
);
|
|
25
|
+
});
|
|
26
|
+
const baseURL = new URL(self.location.href).searchParams.get("baseURL");
|
|
27
|
+
// Read the current manifest: a previously installed SW can outlive an app update.
|
|
28
|
+
function assets() {
|
|
29
|
+
return fetch("/workers-capacitor-assets.json", { cache: "no-store" }).then(
|
|
30
|
+
(response) => {
|
|
31
|
+
if (!response.ok) throw new Error("Missing document assets manifest");
|
|
32
|
+
return response.json();
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
// Bound simultaneous header RPCs to avoid flooding the Android bridge.
|
|
37
|
+
// Body reads and cancellation must remain independent of these slots.
|
|
38
|
+
let opening = 0;
|
|
39
|
+
const waiting = [];
|
|
40
|
+
function acquire(signal) {
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
const abort = () => {
|
|
43
|
+
const index = waiting.indexOf(start);
|
|
44
|
+
if (index !== -1) waiting.splice(index, 1);
|
|
45
|
+
reject(signal.reason);
|
|
46
|
+
};
|
|
47
|
+
const start = () => {
|
|
48
|
+
signal.removeEventListener("abort", abort);
|
|
49
|
+
opening++;
|
|
50
|
+
resolve(() => {
|
|
51
|
+
opening--;
|
|
52
|
+
waiting.shift()?.();
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
if (signal.aborted) return reject(signal.reason);
|
|
56
|
+
if (opening < 6) start();
|
|
57
|
+
else {
|
|
58
|
+
waiting.push(start);
|
|
59
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// Android's native interceptor cannot expose request bodies or return redirects.
|
|
64
|
+
// Keep those semantics in the browser's standard FetchEvent pipeline.
|
|
65
|
+
self.addEventListener("install", (event) =>
|
|
66
|
+
event.waitUntil(self.skipWaiting()),
|
|
67
|
+
);
|
|
68
|
+
self.addEventListener("activate", (event) =>
|
|
69
|
+
event.waitUntil(self.clients.claim()),
|
|
70
|
+
);
|
|
71
|
+
self.addEventListener("fetch", (event) => {
|
|
72
|
+
if (disabled) return;
|
|
73
|
+
const url = new URL(event.request.url);
|
|
74
|
+
if (url.origin !== self.location.origin) return;
|
|
75
|
+
event.respondWith(
|
|
76
|
+
(async () => {
|
|
77
|
+
if (await (await caches.open(lifecycleCache)).match(disabledKey))
|
|
78
|
+
return fetch(event.request);
|
|
79
|
+
const paths = await assets();
|
|
80
|
+
if (disabled) return fetch(event.request);
|
|
81
|
+
if (
|
|
82
|
+
paths.includes(url.pathname) ||
|
|
83
|
+
url.pathname.startsWith("/_capacitor_")
|
|
84
|
+
)
|
|
85
|
+
return fetch(event.request);
|
|
86
|
+
return dispatch(event.request);
|
|
87
|
+
})(),
|
|
88
|
+
);
|
|
89
|
+
});
|
|
90
|
+
// A destroyed Android WebView can remain in clients.matchAll briefly. Probe
|
|
91
|
+
// before sending a navigation request; never replay an application request.
|
|
92
|
+
function hostReady(host, signal) {
|
|
93
|
+
return new Promise((resolve, reject) => {
|
|
94
|
+
const channel = new MessageChannel();
|
|
95
|
+
const finish = (ready, error) => {
|
|
96
|
+
clearTimeout(timer);
|
|
97
|
+
signal.removeEventListener("abort", abort);
|
|
98
|
+
channel.port1.close();
|
|
99
|
+
channel.port2.close();
|
|
100
|
+
error ? reject(error) : resolve(ready);
|
|
101
|
+
};
|
|
102
|
+
const abort = () => finish(false, signal.reason);
|
|
103
|
+
const timer = setTimeout(() => finish(false), 2000);
|
|
104
|
+
channel.port1.onmessage = (event) =>
|
|
105
|
+
finish(event.data === "workers-capacitor:host-ready");
|
|
106
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
107
|
+
if (signal.aborted) return abort();
|
|
108
|
+
try {
|
|
109
|
+
host.postMessage("workers-capacitor:host-ready", [channel.port2]);
|
|
110
|
+
} catch {
|
|
111
|
+
finish(false);
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async function dispatch(request) {
|
|
116
|
+
const deadline = Date.now() + 10000;
|
|
117
|
+
let host = (
|
|
118
|
+
await self.clients.matchAll({ type: "window", includeUncontrolled: true })
|
|
119
|
+
).find((client) =>
|
|
120
|
+
new URL(client.url).searchParams.has("__workers_capacitor_host"),
|
|
121
|
+
);
|
|
122
|
+
// An installed SW survives process restarts. Let the bundled entry restart the
|
|
123
|
+
// native host before intercepting its first document, without a network server.
|
|
124
|
+
if (request.mode === "navigate" && request.method === "GET") {
|
|
125
|
+
request.signal.throwIfAborted();
|
|
126
|
+
if (!host || !(await hostReady(host, request.signal)))
|
|
127
|
+
return fetch(new URL("/index.html", self.location.origin).href, {
|
|
128
|
+
cache: "no-store",
|
|
129
|
+
signal: request.signal,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
while (!host) {
|
|
133
|
+
host = (
|
|
134
|
+
await self.clients.matchAll({ type: "window", includeUncontrolled: true })
|
|
135
|
+
).find((client) =>
|
|
136
|
+
new URL(client.url).searchParams.has("__workers_capacitor_host"),
|
|
137
|
+
);
|
|
138
|
+
if (Date.now() > deadline) throw new Error("Worker host unavailable");
|
|
139
|
+
if (!host) await new Promise((resolve) => setTimeout(resolve, 50));
|
|
140
|
+
}
|
|
141
|
+
const body =
|
|
142
|
+
request.method === "GET" || request.method === "HEAD"
|
|
143
|
+
? undefined
|
|
144
|
+
: await readUpload(request);
|
|
145
|
+
request.signal.throwIfAborted();
|
|
146
|
+
const message = {
|
|
147
|
+
id: crypto.randomUUID(),
|
|
148
|
+
url: request.url,
|
|
149
|
+
method: request.method,
|
|
150
|
+
headers: Object.fromEntries(request.headers),
|
|
151
|
+
body,
|
|
152
|
+
stream: true,
|
|
153
|
+
};
|
|
154
|
+
const rpc = (message, signal) =>
|
|
155
|
+
new Promise((resolve, reject) => {
|
|
156
|
+
const channel = new MessageChannel();
|
|
157
|
+
const cleanup = () => {
|
|
158
|
+
clearTimeout(timer);
|
|
159
|
+
signal?.removeEventListener("abort", abort);
|
|
160
|
+
channel.port1.close();
|
|
161
|
+
};
|
|
162
|
+
const abort = () => {
|
|
163
|
+
cleanup();
|
|
164
|
+
reject(signal.reason);
|
|
165
|
+
};
|
|
166
|
+
const timer = setTimeout(() => {
|
|
167
|
+
cleanup();
|
|
168
|
+
reject(new Error("Worker response timeout"));
|
|
169
|
+
}, 30000);
|
|
170
|
+
channel.port1.onmessage = (event) => {
|
|
171
|
+
cleanup();
|
|
172
|
+
resolve(event.data);
|
|
173
|
+
};
|
|
174
|
+
host.postMessage(message, [channel.port2]);
|
|
175
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
176
|
+
if (signal?.aborted) abort();
|
|
177
|
+
});
|
|
178
|
+
let result;
|
|
179
|
+
const release = await acquire(request.signal);
|
|
180
|
+
try {
|
|
181
|
+
result = await rpc(message, request.signal);
|
|
182
|
+
} catch (error) {
|
|
183
|
+
// The host may still be opening a connection or have produced a late stream.
|
|
184
|
+
void rpc({ action: "cancel", streamId: message.id }).catch(() => {});
|
|
185
|
+
throw error;
|
|
186
|
+
} finally {
|
|
187
|
+
release();
|
|
188
|
+
}
|
|
189
|
+
const cancel = () => rpc({ action: "cancel", streamId: result.streamId });
|
|
190
|
+
if (result.error) throw new Error(result.error);
|
|
191
|
+
const headers = new Headers(result.headers);
|
|
192
|
+
if (
|
|
193
|
+
[301, 302, 303, 307, 308].includes(result.status) &&
|
|
194
|
+
headers.has("location")
|
|
195
|
+
) {
|
|
196
|
+
const target = new URL(headers.get("location"), result.url);
|
|
197
|
+
if (target.origin !== baseURL) {
|
|
198
|
+
if (result.streamId) await cancel();
|
|
199
|
+
throw new Error("External redirects are not supported");
|
|
200
|
+
}
|
|
201
|
+
headers.set(
|
|
202
|
+
"location",
|
|
203
|
+
self.location.origin + target.pathname + target.search + target.hash,
|
|
204
|
+
);
|
|
205
|
+
}
|
|
206
|
+
let controller;
|
|
207
|
+
const abort = () => {
|
|
208
|
+
controller?.error(request.signal.reason);
|
|
209
|
+
void cancel().catch(() => {});
|
|
210
|
+
};
|
|
211
|
+
const responseBody = result.streamId
|
|
212
|
+
? new ReadableStream(
|
|
213
|
+
{
|
|
214
|
+
start(value) {
|
|
215
|
+
controller = value;
|
|
216
|
+
request.signal.addEventListener("abort", abort, { once: true });
|
|
217
|
+
},
|
|
218
|
+
async pull(value) {
|
|
219
|
+
try {
|
|
220
|
+
const next = await rpc({
|
|
221
|
+
action: "pull",
|
|
222
|
+
streamId: result.streamId,
|
|
223
|
+
});
|
|
224
|
+
if (request.signal.aborted) return;
|
|
225
|
+
if (next.error) throw new Error(next.error);
|
|
226
|
+
if (next.done) {
|
|
227
|
+
request.signal.removeEventListener("abort", abort);
|
|
228
|
+
value.close();
|
|
229
|
+
} else
|
|
230
|
+
value.enqueue(
|
|
231
|
+
Uint8Array.from(atob(next.body), (c) => c.charCodeAt(0)),
|
|
232
|
+
);
|
|
233
|
+
} catch (error) {
|
|
234
|
+
request.signal.removeEventListener("abort", abort);
|
|
235
|
+
value.error(error);
|
|
236
|
+
void cancel().catch(() => {});
|
|
237
|
+
}
|
|
238
|
+
},
|
|
239
|
+
async cancel() {
|
|
240
|
+
request.signal.removeEventListener("abort", abort);
|
|
241
|
+
await cancel();
|
|
242
|
+
},
|
|
243
|
+
},
|
|
244
|
+
{ highWaterMark: 0 },
|
|
245
|
+
)
|
|
246
|
+
: result.body;
|
|
247
|
+
if (result.streamId && request.signal.aborted) {
|
|
248
|
+
await cancel();
|
|
249
|
+
request.signal.throwIfAborted();
|
|
250
|
+
}
|
|
251
|
+
return new Response(
|
|
252
|
+
[101, 204, 205, 304].includes(result.status) ? null : responseBody,
|
|
253
|
+
{ status: result.status, headers },
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
async function readUpload(request) {
|
|
258
|
+
const reader = request.body?.getReader();
|
|
259
|
+
if (!reader) return new ArrayBuffer(0);
|
|
260
|
+
const chunks = [];
|
|
261
|
+
let size = 0;
|
|
262
|
+
try {
|
|
263
|
+
for (;;) {
|
|
264
|
+
request.signal.throwIfAborted();
|
|
265
|
+
const next = await reader.read();
|
|
266
|
+
if (next.done) break;
|
|
267
|
+
size += next.value.length;
|
|
268
|
+
if (size > 8 * 1024 * 1024)
|
|
269
|
+
throw new RangeError("Document upload exceeds 8 MiB");
|
|
270
|
+
chunks.push(next.value);
|
|
271
|
+
}
|
|
272
|
+
const bytes = new Uint8Array(size);
|
|
273
|
+
let offset = 0;
|
|
274
|
+
for (const chunk of chunks) {
|
|
275
|
+
bytes.set(chunk, offset);
|
|
276
|
+
offset += chunk.length;
|
|
277
|
+
}
|
|
278
|
+
return bytes.buffer;
|
|
279
|
+
} catch (error) {
|
|
280
|
+
void reader.cancel(error).catch(() => {});
|
|
281
|
+
throw error;
|
|
282
|
+
} finally {
|
|
283
|
+
reader.releaseLock();
|
|
284
|
+
}
|
|
285
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The Workers-specific Fetch redirect policy is adapted from Cloudflare workerd
|
|
4
|
+
v1.20261012.1, `src/workerd/api/http.c++`.
|
|
5
|
+
|
|
6
|
+
Copyright (c) 2017-2022 Cloudflare, Inc.
|
|
7
|
+
Licensed under the Apache License, Version 2.0; see LICENSE-APACHE.
|
|
8
|
+
|
|
9
|
+
Source: https://github.com/cloudflare/workerd/blob/v1.20261012.1/src/workerd/api/http.c%2B%2B
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|