@capsule-run/sdk 0.8.3 → 0.8.5
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/dist/polyfills/unenv-runtime/_internal/types.d.mts +5 -0
- package/dist/polyfills/unenv-runtime/_internal/types.mjs +1 -0
- package/dist/polyfills/unenv-runtime/_internal/utils.d.mts +14 -0
- package/dist/polyfills/unenv-runtime/_internal/utils.mjs +49 -0
- package/dist/polyfills/unenv-runtime/mock/empty.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/mock/empty.mjs +1 -0
- package/dist/polyfills/unenv-runtime/mock/noop.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/mock/noop.mjs +1 -0
- package/dist/polyfills/unenv-runtime/mock/proxy.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/mock/proxy.mjs +43 -0
- package/dist/polyfills/unenv-runtime/node/assert/strict.d.mts +4 -0
- package/dist/polyfills/unenv-runtime/node/assert/strict.mjs +25 -0
- package/dist/polyfills/unenv-runtime/node/assert.d.mts +165 -0
- package/dist/polyfills/unenv-runtime/node/assert.mjs +737 -0
- package/dist/polyfills/unenv-runtime/node/async_hooks.d.mts +5 -0
- package/dist/polyfills/unenv-runtime/node/async_hooks.mjs +15 -0
- package/dist/polyfills/unenv-runtime/node/buffer.d.mts +19 -0
- package/dist/polyfills/unenv-runtime/node/buffer.mjs +35 -0
- package/dist/polyfills/unenv-runtime/node/child_process.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/node/child_process.mjs +21 -0
- package/dist/polyfills/unenv-runtime/node/cluster.d.mts +33 -0
- package/dist/polyfills/unenv-runtime/node/cluster.mjs +71 -0
- package/dist/polyfills/unenv-runtime/node/console.d.mts +38 -0
- package/dist/polyfills/unenv-runtime/node/console.mjs +74 -0
- package/dist/polyfills/unenv-runtime/node/constants.d.mts +13 -0
- package/dist/polyfills/unenv-runtime/node/constants.mjs +254 -0
- package/dist/polyfills/unenv-runtime/node/crypto.d.mts +6 -0
- package/dist/polyfills/unenv-runtime/node/crypto.mjs +138 -0
- package/dist/polyfills/unenv-runtime/node/dgram.d.mts +6 -0
- package/dist/polyfills/unenv-runtime/node/dgram.mjs +12 -0
- package/dist/polyfills/unenv-runtime/node/diagnostics_channel.d.mts +11 -0
- package/dist/polyfills/unenv-runtime/node/diagnostics_channel.mjs +34 -0
- package/dist/polyfills/unenv-runtime/node/dns/promises.d.mts +27 -0
- package/dist/polyfills/unenv-runtime/node/dns/promises.mjs +75 -0
- package/dist/polyfills/unenv-runtime/node/dns.d.mts +29 -0
- package/dist/polyfills/unenv-runtime/node/dns.mjs +81 -0
- package/dist/polyfills/unenv-runtime/node/domain.d.mts +8 -0
- package/dist/polyfills/unenv-runtime/node/domain.mjs +16 -0
- package/dist/polyfills/unenv-runtime/node/events.d.mts +13 -0
- package/dist/polyfills/unenv-runtime/node/events.mjs +12 -0
- package/dist/polyfills/unenv-runtime/node/fs/promises.d.mts +7 -0
- package/dist/polyfills/unenv-runtime/node/fs/promises.mjs +38 -0
- package/dist/polyfills/unenv-runtime/node/fs.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/fs.mjs +117 -0
- package/dist/polyfills/unenv-runtime/node/http.d.mts +23 -0
- package/dist/polyfills/unenv-runtime/node/http.mjs +45 -0
- package/dist/polyfills/unenv-runtime/node/http2.d.mts +15 -0
- package/dist/polyfills/unenv-runtime/node/http2.mjs +284 -0
- package/dist/polyfills/unenv-runtime/node/https.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/https.mjs +16 -0
- package/dist/polyfills/unenv-runtime/node/inspector/promises.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/inspector/promises.mjs +40 -0
- package/dist/polyfills/unenv-runtime/node/inspector.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/node/inspector.mjs +53 -0
- package/dist/polyfills/unenv-runtime/node/internal/async_hooks/async-hook.d.mts +7 -0
- package/dist/polyfills/unenv-runtime/node/internal/async_hooks/async-hook.mjs +115 -0
- package/dist/polyfills/unenv-runtime/node/internal/async_hooks/async-local-storage.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/async_hooks/async-local-storage.mjs +36 -0
- package/dist/polyfills/unenv-runtime/node/internal/async_hooks/async-resource.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/async_hooks/async-resource.mjs +37 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/base64.d.mts +4 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/base64.mjs +97 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/buffer.d.mts +13 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/buffer.mjs +1846 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/file.d.mts +14 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/file.mjs +26 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/ieee754.d.mts +4 -0
- package/dist/polyfills/unenv-runtime/node/internal/buffer/ieee754.mjs +89 -0
- package/dist/polyfills/unenv-runtime/node/internal/crypto/constants.d.mts +58 -0
- package/dist/polyfills/unenv-runtime/node/internal/crypto/constants.mjs +58 -0
- package/dist/polyfills/unenv-runtime/node/internal/crypto/node.d.mts +78 -0
- package/dist/polyfills/unenv-runtime/node/internal/crypto/node.mjs +110 -0
- package/dist/polyfills/unenv-runtime/node/internal/crypto/web.d.mts +5 -0
- package/dist/polyfills/unenv-runtime/node/internal/crypto/web.mjs +9 -0
- package/dist/polyfills/unenv-runtime/node/internal/dgram/socket.d.mts +31 -0
- package/dist/polyfills/unenv-runtime/node/internal/dgram/socket.mjs +61 -0
- package/dist/polyfills/unenv-runtime/node/internal/diagnostics_channel/channel.d.mts +18 -0
- package/dist/polyfills/unenv-runtime/node/internal/diagnostics_channel/channel.mjs +40 -0
- package/dist/polyfills/unenv-runtime/node/internal/diagnostics_channel/tracing-channel.d.mts +19 -0
- package/dist/polyfills/unenv-runtime/node/internal/diagnostics_channel/tracing-channel.mjs +48 -0
- package/dist/polyfills/unenv-runtime/node/internal/dns/constants.d.mts +28 -0
- package/dist/polyfills/unenv-runtime/node/internal/dns/constants.mjs +28 -0
- package/dist/polyfills/unenv-runtime/node/internal/domain/domain.d.mts +13 -0
- package/dist/polyfills/unenv-runtime/node/internal/domain/domain.mjs +19 -0
- package/dist/polyfills/unenv-runtime/node/internal/events/events.d.mts +207 -0
- package/dist/polyfills/unenv-runtime/node/internal/events/events.mjs +1097 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/classes.d.mts +8 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/classes.mjs +8 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/constants.d.mts +59 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/constants.mjs +59 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/fs.d.mts +96 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/fs.mjs +106 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/promises.d.mts +32 -0
- package/dist/polyfills/unenv-runtime/node/internal/fs/promises.mjs +32 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/agent.d.mts +14 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/agent.mjs +16 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/constants.d.mts +67 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/constants.mjs +103 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/request.d.mts +31 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/request.mjs +53 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/response.d.mts +42 -0
- package/dist/polyfills/unenv-runtime/node/internal/http/response.mjs +101 -0
- package/dist/polyfills/unenv-runtime/node/internal/http2/constants.d.mts +241 -0
- package/dist/polyfills/unenv-runtime/node/internal/http2/constants.mjs +241 -0
- package/dist/polyfills/unenv-runtime/node/internal/net/server.d.mts +17 -0
- package/dist/polyfills/unenv-runtime/node/internal/net/server.mjs +33 -0
- package/dist/polyfills/unenv-runtime/node/internal/net/socket.d.mts +45 -0
- package/dist/polyfills/unenv-runtime/node/internal/net/socket.mjs +83 -0
- package/dist/polyfills/unenv-runtime/node/internal/os/constants.d.mts +133 -0
- package/dist/polyfills/unenv-runtime/node/internal/os/constants.mjs +133 -0
- package/dist/polyfills/unenv-runtime/node/internal/perf_hooks/constants.d.mts +25 -0
- package/dist/polyfills/unenv-runtime/node/internal/perf_hooks/constants.mjs +25 -0
- package/dist/polyfills/unenv-runtime/node/internal/perf_hooks/histogram.d.mts +28 -0
- package/dist/polyfills/unenv-runtime/node/internal/perf_hooks/histogram.mjs +43 -0
- package/dist/polyfills/unenv-runtime/node/internal/perf_hooks/performance.d.mts +103 -0
- package/dist/polyfills/unenv-runtime/node/internal/perf_hooks/performance.mjs +232 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/env.d.mts +1 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/env.mjs +40 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/hrtime.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/hrtime.mjs +21 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/nexttick.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/nexttick.mjs +55 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/node-version.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/node-version.mjs +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/process.d.mts +113 -0
- package/dist/polyfills/unenv-runtime/node/internal/process/process.mjs +238 -0
- package/dist/polyfills/unenv-runtime/node/internal/punycode/punycode.d.mts +59 -0
- package/dist/polyfills/unenv-runtime/node/internal/punycode/punycode.mjs +410 -0
- package/dist/polyfills/unenv-runtime/node/internal/querystring/querystring.d.mts +11 -0
- package/dist/polyfills/unenv-runtime/node/internal/querystring/querystring.mjs +320 -0
- package/dist/polyfills/unenv-runtime/node/internal/readline/interface.d.mts +20 -0
- package/dist/polyfills/unenv-runtime/node/internal/readline/interface.mjs +31 -0
- package/dist/polyfills/unenv-runtime/node/internal/readline/promises/interface.d.mts +7 -0
- package/dist/polyfills/unenv-runtime/node/internal/readline/promises/interface.mjs +6 -0
- package/dist/polyfills/unenv-runtime/node/internal/readline/promises/readline.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/internal/readline/promises/readline.mjs +20 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/duplex.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/duplex.mjs +19 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/readable.d.mts +67 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/readable.mjs +112 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/transform.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/transform.mjs +9 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/writable.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/stream/writable.mjs +87 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/immediate.d.mts +9 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/immediate.mjs +28 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/scheduler.d.mts +6 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/scheduler.mjs +10 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/set-immediate.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/set-immediate.mjs +13 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/set-interval.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/set-interval.mjs +8 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/set-timeout.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/set-timeout.mjs +11 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/timeout.d.mts +11 -0
- package/dist/polyfills/unenv-runtime/node/internal/timers/timeout.mjs +30 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/constants.d.mts +7 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/constants.mjs +7 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/secure-context.d.mts +4 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/secure-context.mjs +3 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/server.d.mts +9 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/server.mjs +15 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/tls-socket.d.mts +31 -0
- package/dist/polyfills/unenv-runtime/node/internal/tls/tls-socket.mjs +48 -0
- package/dist/polyfills/unenv-runtime/node/internal/trace_events/tracing.d.mts +7 -0
- package/dist/polyfills/unenv-runtime/node/internal/trace_events/tracing.mjs +10 -0
- package/dist/polyfills/unenv-runtime/node/internal/tty/read-stream.d.mts +8 -0
- package/dist/polyfills/unenv-runtime/node/internal/tty/read-stream.mjs +12 -0
- package/dist/polyfills/unenv-runtime/node/internal/tty/write-stream.d.mts +20 -0
- package/dist/polyfills/unenv-runtime/node/internal/tty/write-stream.mjs +44 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/constants.d.mts +44 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/constants.mjs +44 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/errors.d.mts +26 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/errors.mjs +54 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/url.d.mts +22 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/url.mjs +181 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/util.d.mts +4 -0
- package/dist/polyfills/unenv-runtime/node/internal/url/util.mjs +7 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/inherits.d.mts +1 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/inherits.mjs +12 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/legacy-types.d.mts +19 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/legacy-types.mjs +25 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/log.d.mts +8 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/log.mjs +55 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/mime.d.mts +19 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/mime.mjs +35 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/promisify.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/promisify.mjs +23 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/types.d.mts +45 -0
- package/dist/polyfills/unenv-runtime/node/internal/util/types.mjs +45 -0
- package/dist/polyfills/unenv-runtime/node/internal/v8/deserializer.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/node/internal/v8/deserializer.mjs +23 -0
- package/dist/polyfills/unenv-runtime/node/internal/v8/profiler.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/internal/v8/profiler.mjs +11 -0
- package/dist/polyfills/unenv-runtime/node/internal/v8/serializer.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/node/internal/v8/serializer.mjs +15 -0
- package/dist/polyfills/unenv-runtime/node/internal/vm/constants.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/vm/constants.mjs +2 -0
- package/dist/polyfills/unenv-runtime/node/internal/vm/script.d.mts +7 -0
- package/dist/polyfills/unenv-runtime/node/internal/vm/script.mjs +15 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/broadcast-channel.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/broadcast-channel.mjs +13 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/message-channel.d.mts +5 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/message-channel.mjs +5 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/message-port.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/message-port.mjs +17 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/worker.d.mts +21 -0
- package/dist/polyfills/unenv-runtime/node/internal/worker_threads/worker.mjs +25 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/codes.d.mts +21 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/codes.mjs +21 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/constants.d.mts +108 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/constants.mjs +108 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/_shared.d.mts +22 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/_shared.mjs +40 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/brotli.d.mts +16 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/brotli.mjs +16 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/deflate.d.mts +29 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/deflate.mjs +36 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/gzip.d.mts +16 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/gzip.mjs +16 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/zip.d.mts +9 -0
- package/dist/polyfills/unenv-runtime/node/internal/zlib/formats/zip.mjs +9 -0
- package/dist/polyfills/unenv-runtime/node/module.d.mts +54 -0
- package/dist/polyfills/unenv-runtime/node/module.mjs +191 -0
- package/dist/polyfills/unenv-runtime/node/net.d.mts +22 -0
- package/dist/polyfills/unenv-runtime/node/net.mjs +52 -0
- package/dist/polyfills/unenv-runtime/node/os.d.mts +26 -0
- package/dist/polyfills/unenv-runtime/node/os.mjs +118 -0
- package/dist/polyfills/unenv-runtime/node/path/posix.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/path/posix.mjs +2 -0
- package/dist/polyfills/unenv-runtime/node/path/win32.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/path/win32.mjs +2 -0
- package/dist/polyfills/unenv-runtime/node/path.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/node/path.mjs +31 -0
- package/dist/polyfills/unenv-runtime/node/perf_hooks.d.mts +8 -0
- package/dist/polyfills/unenv-runtime/node/perf_hooks.mjs +51 -0
- package/dist/polyfills/unenv-runtime/node/process.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/process.mjs +12 -0
- package/dist/polyfills/unenv-runtime/node/punycode.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/punycode.mjs +3 -0
- package/dist/polyfills/unenv-runtime/node/querystring.d.mts +49 -0
- package/dist/polyfills/unenv-runtime/node/querystring.mjs +766 -0
- package/dist/polyfills/unenv-runtime/node/readline/promises.d.mts +6 -0
- package/dist/polyfills/unenv-runtime/node/readline/promises.mjs +10 -0
- package/dist/polyfills/unenv-runtime/node/readline.d.mts +13 -0
- package/dist/polyfills/unenv-runtime/node/readline.mjs +21 -0
- package/dist/polyfills/unenv-runtime/node/repl.d.mts +10 -0
- package/dist/polyfills/unenv-runtime/node/repl.mjs +20 -0
- package/dist/polyfills/unenv-runtime/node/sqlite.d.mts +6 -0
- package/dist/polyfills/unenv-runtime/node/sqlite.mjs +9 -0
- package/dist/polyfills/unenv-runtime/node/stream/consumers.d.mts +7 -0
- package/dist/polyfills/unenv-runtime/node/stream/consumers.mjs +13 -0
- package/dist/polyfills/unenv-runtime/node/stream/promises.d.mts +4 -0
- package/dist/polyfills/unenv-runtime/node/stream/promises.mjs +7 -0
- package/dist/polyfills/unenv-runtime/node/stream/web.d.mts +24 -0
- package/dist/polyfills/unenv-runtime/node/stream/web.mjs +41 -0
- package/dist/polyfills/unenv-runtime/node/stream.d.mts +42 -0
- package/dist/polyfills/unenv-runtime/node/stream.mjs +54 -0
- package/dist/polyfills/unenv-runtime/node/string_decoder.d.mts +5 -0
- package/dist/polyfills/unenv-runtime/node/string_decoder.mjs +3 -0
- package/dist/polyfills/unenv-runtime/node/sys.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/node/sys.mjs +2 -0
- package/dist/polyfills/unenv-runtime/node/timers/promises.d.mts +6 -0
- package/dist/polyfills/unenv-runtime/node/timers/promises.mjs +14 -0
- package/dist/polyfills/unenv-runtime/node/timers.d.mts +15 -0
- package/dist/polyfills/unenv-runtime/node/timers.mjs +32 -0
- package/dist/polyfills/unenv-runtime/node/tls.d.mts +15 -0
- package/dist/polyfills/unenv-runtime/node/tls.mjs +41 -0
- package/dist/polyfills/unenv-runtime/node/trace_events.d.mts +5 -0
- package/dist/polyfills/unenv-runtime/node/trace_events.mjs +9 -0
- package/dist/polyfills/unenv-runtime/node/tty.d.mts +9 -0
- package/dist/polyfills/unenv-runtime/node/tty.mjs +12 -0
- package/dist/polyfills/unenv-runtime/node/url.d.mts +61 -0
- package/dist/polyfills/unenv-runtime/node/url.mjs +1044 -0
- package/dist/polyfills/unenv-runtime/node/util/types.d.mts +3 -0
- package/dist/polyfills/unenv-runtime/node/util/types.mjs +3 -0
- package/dist/polyfills/unenv-runtime/node/util.d.mts +32 -0
- package/dist/polyfills/unenv-runtime/node/util.mjs +84 -0
- package/dist/polyfills/unenv-runtime/node/v8.d.mts +29 -0
- package/dist/polyfills/unenv-runtime/node/v8.mjs +108 -0
- package/dist/polyfills/unenv-runtime/node/vm.d.mts +15 -0
- package/dist/polyfills/unenv-runtime/node/vm.mjs +41 -0
- package/dist/polyfills/unenv-runtime/node/wasi.d.mts +4 -0
- package/dist/polyfills/unenv-runtime/node/wasi.mjs +3 -0
- package/dist/polyfills/unenv-runtime/node/worker_threads.d.mts +23 -0
- package/dist/polyfills/unenv-runtime/node/worker_threads.mjs +55 -0
- package/dist/polyfills/unenv-runtime/node/zlib.d.mts +16 -0
- package/dist/polyfills/unenv-runtime/node/zlib.mjs +212 -0
- package/dist/polyfills/unenv-runtime/npm/cross-fetch.d.mts +6 -0
- package/dist/polyfills/unenv-runtime/npm/cross-fetch.mjs +6 -0
- package/dist/polyfills/unenv-runtime/npm/debug.d.mts +15 -0
- package/dist/polyfills/unenv-runtime/npm/debug.mjs +43 -0
- package/dist/polyfills/unenv-runtime/npm/fsevents.d.mts +16 -0
- package/dist/polyfills/unenv-runtime/npm/fsevents.mjs +20 -0
- package/dist/polyfills/unenv-runtime/npm/inherits.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/npm/inherits.mjs +2 -0
- package/dist/polyfills/unenv-runtime/npm/node-fetch.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/npm/node-fetch.mjs +23 -0
- package/dist/polyfills/unenv-runtime/npm/whatwg-url/index.d.mts +13 -0
- package/dist/polyfills/unenv-runtime/npm/whatwg-url/index.mjs +15 -0
- package/dist/polyfills/unenv-runtime/npm/whatwg-url/webidl2js-wrapper.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/npm/whatwg-url/webidl2js-wrapper.mjs +2 -0
- package/dist/polyfills/unenv-runtime/polyfill/buffer.d.mts +1 -0
- package/dist/polyfills/unenv-runtime/polyfill/buffer.mjs +4 -0
- package/dist/polyfills/unenv-runtime/polyfill/globalthis-global.d.mts +1 -0
- package/dist/polyfills/unenv-runtime/polyfill/globalthis-global.mjs +5 -0
- package/dist/polyfills/unenv-runtime/polyfill/globalthis.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/polyfill/globalthis.mjs +2 -0
- package/dist/polyfills/unenv-runtime/polyfill/package.json +3 -0
- package/dist/polyfills/unenv-runtime/polyfill/performance.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/polyfill/performance.mjs +10 -0
- package/dist/polyfills/unenv-runtime/polyfill/process.d.mts +2 -0
- package/dist/polyfills/unenv-runtime/polyfill/process.mjs +10 -0
- package/dist/polyfills/unenv-runtime/polyfill/source-maps.mjs +15 -0
- package/dist/polyfills/unenv-runtime/polyfill/timers.d.mts +1 -0
- package/dist/polyfills/unenv-runtime/polyfill/timers.mjs +7 -0
- package/dist/polyfills/unenv-runtime/web/performance/_polyfills.d.mts +100 -0
- package/dist/polyfills/unenv-runtime/web/performance/_polyfills.mjs +184 -0
- package/dist/polyfills/unenv-runtime/web/performance/index.d.mts +12 -0
- package/dist/polyfills/unenv-runtime/web/performance/index.mjs +14 -0
- package/package.json +2 -2
|
@@ -0,0 +1,766 @@
|
|
|
1
|
+
// Source: https://github.com/nodejs/node/blob/v22.7.0/lib/querystring.js
|
|
2
|
+
// Copyright Joyent, Inc. and other Node contributors.
|
|
3
|
+
//
|
|
4
|
+
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
5
|
+
// copy of this software and associated documentation files (the
|
|
6
|
+
// "Software"), to deal in the Software without restriction, including
|
|
7
|
+
// without limitation the rights to use, copy, modify, merge, publish,
|
|
8
|
+
// distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
9
|
+
// persons to whom the Software is furnished to do so, subject to the
|
|
10
|
+
// following conditions:
|
|
11
|
+
//
|
|
12
|
+
// The above copyright notice and this permission notice shall be included
|
|
13
|
+
// in all copies or substantial portions of the Software.
|
|
14
|
+
//
|
|
15
|
+
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
16
|
+
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
17
|
+
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
18
|
+
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
19
|
+
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
20
|
+
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
21
|
+
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
22
|
+
import { encodeStr, hexTable, isHexTable } from "./internal/querystring/querystring.mjs";
|
|
23
|
+
// prettier-ignore
|
|
24
|
+
const unhexTable = new Int8Array([
|
|
25
|
+
-1,
|
|
26
|
+
-1,
|
|
27
|
+
-1,
|
|
28
|
+
-1,
|
|
29
|
+
-1,
|
|
30
|
+
-1,
|
|
31
|
+
-1,
|
|
32
|
+
-1,
|
|
33
|
+
-1,
|
|
34
|
+
-1,
|
|
35
|
+
-1,
|
|
36
|
+
-1,
|
|
37
|
+
-1,
|
|
38
|
+
-1,
|
|
39
|
+
-1,
|
|
40
|
+
-1,
|
|
41
|
+
-1,
|
|
42
|
+
-1,
|
|
43
|
+
-1,
|
|
44
|
+
-1,
|
|
45
|
+
-1,
|
|
46
|
+
-1,
|
|
47
|
+
-1,
|
|
48
|
+
-1,
|
|
49
|
+
-1,
|
|
50
|
+
-1,
|
|
51
|
+
-1,
|
|
52
|
+
-1,
|
|
53
|
+
-1,
|
|
54
|
+
-1,
|
|
55
|
+
-1,
|
|
56
|
+
-1,
|
|
57
|
+
-1,
|
|
58
|
+
-1,
|
|
59
|
+
-1,
|
|
60
|
+
-1,
|
|
61
|
+
-1,
|
|
62
|
+
-1,
|
|
63
|
+
-1,
|
|
64
|
+
-1,
|
|
65
|
+
-1,
|
|
66
|
+
-1,
|
|
67
|
+
-1,
|
|
68
|
+
-1,
|
|
69
|
+
-1,
|
|
70
|
+
-1,
|
|
71
|
+
-1,
|
|
72
|
+
-1,
|
|
73
|
+
+0,
|
|
74
|
+
+1,
|
|
75
|
+
+2,
|
|
76
|
+
+3,
|
|
77
|
+
+4,
|
|
78
|
+
+5,
|
|
79
|
+
+6,
|
|
80
|
+
+7,
|
|
81
|
+
+8,
|
|
82
|
+
+9,
|
|
83
|
+
-1,
|
|
84
|
+
-1,
|
|
85
|
+
-1,
|
|
86
|
+
-1,
|
|
87
|
+
-1,
|
|
88
|
+
-1,
|
|
89
|
+
-1,
|
|
90
|
+
10,
|
|
91
|
+
11,
|
|
92
|
+
12,
|
|
93
|
+
13,
|
|
94
|
+
14,
|
|
95
|
+
15,
|
|
96
|
+
-1,
|
|
97
|
+
-1,
|
|
98
|
+
-1,
|
|
99
|
+
-1,
|
|
100
|
+
-1,
|
|
101
|
+
-1,
|
|
102
|
+
-1,
|
|
103
|
+
-1,
|
|
104
|
+
-1,
|
|
105
|
+
-1,
|
|
106
|
+
-1,
|
|
107
|
+
-1,
|
|
108
|
+
-1,
|
|
109
|
+
-1,
|
|
110
|
+
-1,
|
|
111
|
+
-1,
|
|
112
|
+
-1,
|
|
113
|
+
-1,
|
|
114
|
+
-1,
|
|
115
|
+
-1,
|
|
116
|
+
-1,
|
|
117
|
+
-1,
|
|
118
|
+
-1,
|
|
119
|
+
-1,
|
|
120
|
+
-1,
|
|
121
|
+
-1,
|
|
122
|
+
10,
|
|
123
|
+
11,
|
|
124
|
+
12,
|
|
125
|
+
13,
|
|
126
|
+
14,
|
|
127
|
+
15,
|
|
128
|
+
-1,
|
|
129
|
+
-1,
|
|
130
|
+
-1,
|
|
131
|
+
-1,
|
|
132
|
+
-1,
|
|
133
|
+
-1,
|
|
134
|
+
-1,
|
|
135
|
+
-1,
|
|
136
|
+
-1,
|
|
137
|
+
-1,
|
|
138
|
+
-1,
|
|
139
|
+
-1,
|
|
140
|
+
-1,
|
|
141
|
+
-1,
|
|
142
|
+
-1,
|
|
143
|
+
-1,
|
|
144
|
+
-1,
|
|
145
|
+
-1,
|
|
146
|
+
-1,
|
|
147
|
+
-1,
|
|
148
|
+
-1,
|
|
149
|
+
-1,
|
|
150
|
+
-1,
|
|
151
|
+
-1,
|
|
152
|
+
-1,
|
|
153
|
+
-1,
|
|
154
|
+
-1,
|
|
155
|
+
-1,
|
|
156
|
+
-1,
|
|
157
|
+
-1,
|
|
158
|
+
-1,
|
|
159
|
+
-1,
|
|
160
|
+
-1,
|
|
161
|
+
-1,
|
|
162
|
+
-1,
|
|
163
|
+
-1,
|
|
164
|
+
-1,
|
|
165
|
+
-1,
|
|
166
|
+
-1,
|
|
167
|
+
-1,
|
|
168
|
+
-1,
|
|
169
|
+
-1,
|
|
170
|
+
-1,
|
|
171
|
+
-1,
|
|
172
|
+
-1,
|
|
173
|
+
-1,
|
|
174
|
+
-1,
|
|
175
|
+
-1,
|
|
176
|
+
-1,
|
|
177
|
+
-1,
|
|
178
|
+
-1,
|
|
179
|
+
-1,
|
|
180
|
+
-1,
|
|
181
|
+
-1,
|
|
182
|
+
-1,
|
|
183
|
+
-1,
|
|
184
|
+
-1,
|
|
185
|
+
-1,
|
|
186
|
+
-1,
|
|
187
|
+
-1,
|
|
188
|
+
-1,
|
|
189
|
+
-1,
|
|
190
|
+
-1,
|
|
191
|
+
-1,
|
|
192
|
+
-1,
|
|
193
|
+
-1,
|
|
194
|
+
-1,
|
|
195
|
+
-1,
|
|
196
|
+
-1,
|
|
197
|
+
-1,
|
|
198
|
+
-1,
|
|
199
|
+
-1,
|
|
200
|
+
-1,
|
|
201
|
+
-1,
|
|
202
|
+
-1,
|
|
203
|
+
-1,
|
|
204
|
+
-1,
|
|
205
|
+
-1,
|
|
206
|
+
-1,
|
|
207
|
+
-1,
|
|
208
|
+
-1,
|
|
209
|
+
-1,
|
|
210
|
+
-1,
|
|
211
|
+
-1,
|
|
212
|
+
-1,
|
|
213
|
+
-1,
|
|
214
|
+
-1,
|
|
215
|
+
-1,
|
|
216
|
+
-1,
|
|
217
|
+
-1,
|
|
218
|
+
-1,
|
|
219
|
+
-1,
|
|
220
|
+
-1,
|
|
221
|
+
-1,
|
|
222
|
+
-1,
|
|
223
|
+
-1,
|
|
224
|
+
-1,
|
|
225
|
+
-1,
|
|
226
|
+
-1,
|
|
227
|
+
-1,
|
|
228
|
+
-1,
|
|
229
|
+
-1,
|
|
230
|
+
-1,
|
|
231
|
+
-1,
|
|
232
|
+
-1,
|
|
233
|
+
-1,
|
|
234
|
+
-1,
|
|
235
|
+
-1,
|
|
236
|
+
-1,
|
|
237
|
+
-1,
|
|
238
|
+
-1,
|
|
239
|
+
-1,
|
|
240
|
+
-1,
|
|
241
|
+
-1,
|
|
242
|
+
-1,
|
|
243
|
+
-1,
|
|
244
|
+
-1,
|
|
245
|
+
-1,
|
|
246
|
+
-1,
|
|
247
|
+
-1,
|
|
248
|
+
-1,
|
|
249
|
+
-1,
|
|
250
|
+
-1,
|
|
251
|
+
-1,
|
|
252
|
+
-1,
|
|
253
|
+
-1,
|
|
254
|
+
-1,
|
|
255
|
+
-1,
|
|
256
|
+
-1,
|
|
257
|
+
-1,
|
|
258
|
+
-1,
|
|
259
|
+
-1,
|
|
260
|
+
-1,
|
|
261
|
+
-1,
|
|
262
|
+
-1,
|
|
263
|
+
-1,
|
|
264
|
+
-1,
|
|
265
|
+
-1,
|
|
266
|
+
-1,
|
|
267
|
+
-1,
|
|
268
|
+
-1,
|
|
269
|
+
-1,
|
|
270
|
+
-1,
|
|
271
|
+
-1,
|
|
272
|
+
-1,
|
|
273
|
+
-1,
|
|
274
|
+
-1,
|
|
275
|
+
-1,
|
|
276
|
+
-1,
|
|
277
|
+
-1,
|
|
278
|
+
-1,
|
|
279
|
+
-1,
|
|
280
|
+
-1
|
|
281
|
+
]);
|
|
282
|
+
/**
|
|
283
|
+
* A safe fast alternative to decodeURIComponent
|
|
284
|
+
* @param {string} s
|
|
285
|
+
* @param {boolean} decodeSpaces
|
|
286
|
+
* @returns {string}
|
|
287
|
+
*/
|
|
288
|
+
function unescapeBuffer(s, decodeSpaces) {
|
|
289
|
+
// TODO: Use TextEncoder/TextDecoder + Uint8Array to avoid Buffer
|
|
290
|
+
const out = globalThis.Buffer.allocUnsafe(s.length);
|
|
291
|
+
let index = 0;
|
|
292
|
+
let outIndex = 0;
|
|
293
|
+
let currentChar;
|
|
294
|
+
let nextChar;
|
|
295
|
+
let hexHigh;
|
|
296
|
+
let hexLow;
|
|
297
|
+
const maxLength = s.length - 2;
|
|
298
|
+
// Flag to know if some hex chars have been decoded
|
|
299
|
+
let hasHex = false;
|
|
300
|
+
while (index < s.length) {
|
|
301
|
+
currentChar = String.prototype.charCodeAt.call(s, index);
|
|
302
|
+
if (currentChar === 43 && decodeSpaces) {
|
|
303
|
+
out[outIndex++] = 32;
|
|
304
|
+
index++;
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (currentChar === 37 && index < maxLength) {
|
|
308
|
+
currentChar = String.prototype.charCodeAt.call(s, ++index);
|
|
309
|
+
hexHigh = unhexTable[currentChar];
|
|
310
|
+
if (hexHigh >= 0) {
|
|
311
|
+
nextChar = String.prototype.charCodeAt.call(s, ++index);
|
|
312
|
+
hexLow = unhexTable[nextChar];
|
|
313
|
+
if (hexLow >= 0) {
|
|
314
|
+
hasHex = true;
|
|
315
|
+
currentChar = hexHigh * 16 + hexLow;
|
|
316
|
+
} else {
|
|
317
|
+
out[outIndex++] = 37;
|
|
318
|
+
index--;
|
|
319
|
+
}
|
|
320
|
+
} else {
|
|
321
|
+
out[outIndex++] = 37;
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
out[outIndex++] = currentChar;
|
|
326
|
+
index++;
|
|
327
|
+
}
|
|
328
|
+
return hasHex ? out.slice(0, outIndex) : out;
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* @param {string} s
|
|
332
|
+
* @param {boolean} decodeSpaces
|
|
333
|
+
* @returns {string}
|
|
334
|
+
*/
|
|
335
|
+
function qsUnescape(s, decodeSpaces) {
|
|
336
|
+
try {
|
|
337
|
+
return decodeURIComponent(s);
|
|
338
|
+
} catch {
|
|
339
|
+
return unescapeBuffer(s, decodeSpaces).toString();
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
// These characters do not need escaping when generating query strings:
|
|
343
|
+
// ! - . _ ~
|
|
344
|
+
// ' ( ) *
|
|
345
|
+
// digits
|
|
346
|
+
// alpha (uppercase)
|
|
347
|
+
// alpha (lowercase)
|
|
348
|
+
// prettier-ignore
|
|
349
|
+
const noEscape = new Int8Array([
|
|
350
|
+
0,
|
|
351
|
+
0,
|
|
352
|
+
0,
|
|
353
|
+
0,
|
|
354
|
+
0,
|
|
355
|
+
0,
|
|
356
|
+
0,
|
|
357
|
+
0,
|
|
358
|
+
0,
|
|
359
|
+
0,
|
|
360
|
+
0,
|
|
361
|
+
0,
|
|
362
|
+
0,
|
|
363
|
+
0,
|
|
364
|
+
0,
|
|
365
|
+
0,
|
|
366
|
+
0,
|
|
367
|
+
0,
|
|
368
|
+
0,
|
|
369
|
+
0,
|
|
370
|
+
0,
|
|
371
|
+
0,
|
|
372
|
+
0,
|
|
373
|
+
0,
|
|
374
|
+
0,
|
|
375
|
+
0,
|
|
376
|
+
0,
|
|
377
|
+
0,
|
|
378
|
+
0,
|
|
379
|
+
0,
|
|
380
|
+
0,
|
|
381
|
+
0,
|
|
382
|
+
0,
|
|
383
|
+
1,
|
|
384
|
+
0,
|
|
385
|
+
0,
|
|
386
|
+
0,
|
|
387
|
+
0,
|
|
388
|
+
0,
|
|
389
|
+
1,
|
|
390
|
+
1,
|
|
391
|
+
1,
|
|
392
|
+
1,
|
|
393
|
+
0,
|
|
394
|
+
0,
|
|
395
|
+
1,
|
|
396
|
+
1,
|
|
397
|
+
0,
|
|
398
|
+
1,
|
|
399
|
+
1,
|
|
400
|
+
1,
|
|
401
|
+
1,
|
|
402
|
+
1,
|
|
403
|
+
1,
|
|
404
|
+
1,
|
|
405
|
+
1,
|
|
406
|
+
1,
|
|
407
|
+
1,
|
|
408
|
+
0,
|
|
409
|
+
0,
|
|
410
|
+
0,
|
|
411
|
+
0,
|
|
412
|
+
0,
|
|
413
|
+
0,
|
|
414
|
+
0,
|
|
415
|
+
1,
|
|
416
|
+
1,
|
|
417
|
+
1,
|
|
418
|
+
1,
|
|
419
|
+
1,
|
|
420
|
+
1,
|
|
421
|
+
1,
|
|
422
|
+
1,
|
|
423
|
+
1,
|
|
424
|
+
1,
|
|
425
|
+
1,
|
|
426
|
+
1,
|
|
427
|
+
1,
|
|
428
|
+
1,
|
|
429
|
+
1,
|
|
430
|
+
1,
|
|
431
|
+
1,
|
|
432
|
+
1,
|
|
433
|
+
1,
|
|
434
|
+
1,
|
|
435
|
+
1,
|
|
436
|
+
1,
|
|
437
|
+
1,
|
|
438
|
+
1,
|
|
439
|
+
1,
|
|
440
|
+
1,
|
|
441
|
+
0,
|
|
442
|
+
0,
|
|
443
|
+
0,
|
|
444
|
+
0,
|
|
445
|
+
1,
|
|
446
|
+
0,
|
|
447
|
+
1,
|
|
448
|
+
1,
|
|
449
|
+
1,
|
|
450
|
+
1,
|
|
451
|
+
1,
|
|
452
|
+
1,
|
|
453
|
+
1,
|
|
454
|
+
1,
|
|
455
|
+
1,
|
|
456
|
+
1,
|
|
457
|
+
1,
|
|
458
|
+
1,
|
|
459
|
+
1,
|
|
460
|
+
1,
|
|
461
|
+
1,
|
|
462
|
+
1,
|
|
463
|
+
1,
|
|
464
|
+
1,
|
|
465
|
+
1,
|
|
466
|
+
1,
|
|
467
|
+
1,
|
|
468
|
+
1,
|
|
469
|
+
1,
|
|
470
|
+
1,
|
|
471
|
+
1,
|
|
472
|
+
1,
|
|
473
|
+
0,
|
|
474
|
+
0,
|
|
475
|
+
0,
|
|
476
|
+
1,
|
|
477
|
+
0
|
|
478
|
+
]);
|
|
479
|
+
/**
|
|
480
|
+
* QueryString.escape() replaces encodeURIComponent()
|
|
481
|
+
* @see https://www.ecma-international.org/ecma-262/5.1/#sec-15.1.3.4
|
|
482
|
+
* @param {any} str
|
|
483
|
+
* @returns {string}
|
|
484
|
+
*/
|
|
485
|
+
function qsEscape(str) {
|
|
486
|
+
if (typeof str !== "string") {
|
|
487
|
+
if (typeof str === "object") str = String(str);
|
|
488
|
+
else {
|
|
489
|
+
str += "";
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
return encodeStr(str, noEscape, hexTable);
|
|
493
|
+
}
|
|
494
|
+
/**
|
|
495
|
+
* @param {string | number | bigint | boolean | symbol | undefined | null} v
|
|
496
|
+
* @returns {string}
|
|
497
|
+
*/
|
|
498
|
+
function stringifyPrimitive(v) {
|
|
499
|
+
if (typeof v === "string") return v;
|
|
500
|
+
if (typeof v === "number" && Number.isFinite(v)) return "" + v;
|
|
501
|
+
if (typeof v === "bigint") return "" + v;
|
|
502
|
+
if (typeof v === "boolean") return v ? "true" : "false";
|
|
503
|
+
return "";
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* @param {string | number | bigint | boolean} v
|
|
507
|
+
* @param {(v: string) => string} encode
|
|
508
|
+
* @returns {string}
|
|
509
|
+
*/
|
|
510
|
+
function encodeStringified(v, encode) {
|
|
511
|
+
if (typeof v === "string") return v.length > 0 ? encode(v) : "";
|
|
512
|
+
if (typeof v === "number" && Number.isFinite(v)) {
|
|
513
|
+
// Values >= 1e21 automatically switch to scientific notation which requires
|
|
514
|
+
// escaping due to the inclusion of a '+' in the output
|
|
515
|
+
return Math.abs(v) < 1e21 ? "" + v : encode("" + v);
|
|
516
|
+
}
|
|
517
|
+
if (typeof v === "bigint") return "" + v;
|
|
518
|
+
if (typeof v === "boolean") return v ? "true" : "false";
|
|
519
|
+
return "";
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* @param {string | number | boolean | null} v
|
|
523
|
+
* @param {(v: string) => string} encode
|
|
524
|
+
* @returns {string}
|
|
525
|
+
*/
|
|
526
|
+
function encodeStringifiedCustom(v, encode) {
|
|
527
|
+
return encode(stringifyPrimitive(v));
|
|
528
|
+
}
|
|
529
|
+
/**
|
|
530
|
+
* @param {Record<string, string | number | boolean
|
|
531
|
+
* | ReadonlyArray<string | number | boolean> | null>} obj
|
|
532
|
+
* @param {string} [sep]
|
|
533
|
+
* @param {string} [eq]
|
|
534
|
+
* @param {{ encodeURIComponent?: (v: string) => string }} [options]
|
|
535
|
+
* @returns {string}
|
|
536
|
+
*/
|
|
537
|
+
function stringify(obj, sep, eq, options) {
|
|
538
|
+
sep = sep || "&";
|
|
539
|
+
eq = eq || "=";
|
|
540
|
+
let encode = qsEscape;
|
|
541
|
+
if (options && typeof options.encodeURIComponent === "function") {
|
|
542
|
+
encode = options.encodeURIComponent;
|
|
543
|
+
}
|
|
544
|
+
const convert = encode === qsEscape ? encodeStringified : encodeStringifiedCustom;
|
|
545
|
+
if (obj !== null && typeof obj === "object") {
|
|
546
|
+
const keys = Object.keys(obj);
|
|
547
|
+
const len = keys.length;
|
|
548
|
+
let fields = "";
|
|
549
|
+
for (let i = 0; i < len; ++i) {
|
|
550
|
+
const k = keys[i];
|
|
551
|
+
const v = obj[k];
|
|
552
|
+
let ks = convert(k, encode);
|
|
553
|
+
ks += eq;
|
|
554
|
+
if (Array.isArray(v)) {
|
|
555
|
+
const vlen = v.length;
|
|
556
|
+
if (vlen === 0) continue;
|
|
557
|
+
if (fields) fields += sep;
|
|
558
|
+
for (let j = 0; j < vlen; ++j) {
|
|
559
|
+
if (j) fields += sep;
|
|
560
|
+
fields += ks;
|
|
561
|
+
fields += convert(v[j], encode);
|
|
562
|
+
}
|
|
563
|
+
} else {
|
|
564
|
+
if (fields) fields += sep;
|
|
565
|
+
fields += ks;
|
|
566
|
+
fields += convert(v, encode);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
return fields;
|
|
570
|
+
}
|
|
571
|
+
return "";
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* @param {string} str
|
|
575
|
+
* @returns {number[]}
|
|
576
|
+
*/
|
|
577
|
+
function charCodes(str) {
|
|
578
|
+
if (str.length === 0) return [];
|
|
579
|
+
if (str.length === 1) return [String.prototype.charCodeAt.call(str, 0)];
|
|
580
|
+
const ret = Array.from({ length: str.length });
|
|
581
|
+
for (let i = 0; i < str.length; ++i) ret[i] = String.prototype.charCodeAt.call(str, i);
|
|
582
|
+
return ret;
|
|
583
|
+
}
|
|
584
|
+
const defSepCodes = [38];
|
|
585
|
+
const defEqCodes = [61];
|
|
586
|
+
function addKeyVal(obj, key, value, keyEncoded, valEncoded, decode) {
|
|
587
|
+
if (key.length > 0 && keyEncoded) key = decodeStr(key, decode);
|
|
588
|
+
if (value.length > 0 && valEncoded) value = decodeStr(value, decode);
|
|
589
|
+
if (obj[key] === undefined) {
|
|
590
|
+
obj[key] = value;
|
|
591
|
+
} else {
|
|
592
|
+
const curValue = obj[key];
|
|
593
|
+
// A simple Array-specific property check is enough here to
|
|
594
|
+
// distinguish from a string value and is faster and still safe
|
|
595
|
+
// since we are generating all of the values being assigned.
|
|
596
|
+
if (curValue.pop) curValue[curValue.length] = value;
|
|
597
|
+
else obj[key] = [curValue, value];
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Parse a key/val string.
|
|
602
|
+
* @param {string} qs
|
|
603
|
+
* @param {string} sep
|
|
604
|
+
* @param {string} eq
|
|
605
|
+
* @param {{
|
|
606
|
+
* maxKeys?: number;
|
|
607
|
+
* decodeURIComponent?(v: string): string;
|
|
608
|
+
* }} [options]
|
|
609
|
+
* @returns {Record<string, string | string[]>}
|
|
610
|
+
*/
|
|
611
|
+
function parse(qs, sep, eq, options) {
|
|
612
|
+
const obj = { __proto__: null };
|
|
613
|
+
if (typeof qs !== "string" || qs.length === 0) {
|
|
614
|
+
return obj;
|
|
615
|
+
}
|
|
616
|
+
const sepCodes = sep ? charCodes(String(sep)) : defSepCodes;
|
|
617
|
+
const eqCodes = eq ? charCodes(String(eq)) : defEqCodes;
|
|
618
|
+
const sepLen = sepCodes.length;
|
|
619
|
+
const eqLen = eqCodes.length;
|
|
620
|
+
let pairs = 1e3;
|
|
621
|
+
if (options && typeof options.maxKeys === "number") {
|
|
622
|
+
// -1 is used in place of a value like Infinity for meaning
|
|
623
|
+
// "unlimited pairs" because of additional checks V8 (at least as of v5.4)
|
|
624
|
+
// has to do when using variables that contain values like Infinity. Since
|
|
625
|
+
// `pairs` is always decremented and checked explicitly for 0, -1 works
|
|
626
|
+
// effectively the same as Infinity, while providing a significant
|
|
627
|
+
// performance boost.
|
|
628
|
+
pairs = options.maxKeys > 0 ? options.maxKeys : -1;
|
|
629
|
+
}
|
|
630
|
+
let decode = qsUnescape;
|
|
631
|
+
if (options && typeof options.decodeURIComponent === "function") {
|
|
632
|
+
decode = options.decodeURIComponent;
|
|
633
|
+
}
|
|
634
|
+
const customDecode = decode !== qsUnescape;
|
|
635
|
+
let lastPos = 0;
|
|
636
|
+
let sepIdx = 0;
|
|
637
|
+
let eqIdx = 0;
|
|
638
|
+
let key = "";
|
|
639
|
+
let value = "";
|
|
640
|
+
let keyEncoded = customDecode;
|
|
641
|
+
let valEncoded = customDecode;
|
|
642
|
+
const plusChar = customDecode ? "%20" : " ";
|
|
643
|
+
let encodeCheck = 0;
|
|
644
|
+
for (let i = 0; i < qs.length; ++i) {
|
|
645
|
+
const code = String.prototype.charCodeAt.call(qs, i);
|
|
646
|
+
// Try matching key/value pair separator (e.g. '&')
|
|
647
|
+
if (code === sepCodes[sepIdx]) {
|
|
648
|
+
if (++sepIdx === sepLen) {
|
|
649
|
+
// Key/value pair separator match!
|
|
650
|
+
const end = i - sepIdx + 1;
|
|
651
|
+
if (eqIdx < eqLen) {
|
|
652
|
+
// We didn't find the (entire) key/value separator
|
|
653
|
+
if (lastPos < end) {
|
|
654
|
+
// Treat the substring as part of the key instead of the value
|
|
655
|
+
key += String.prototype.slice.call(qs, lastPos, end);
|
|
656
|
+
} else if (key.length === 0) {
|
|
657
|
+
// We saw an empty substring between separators
|
|
658
|
+
if (--pairs === 0) return obj;
|
|
659
|
+
lastPos = i + 1;
|
|
660
|
+
sepIdx = eqIdx = 0;
|
|
661
|
+
continue;
|
|
662
|
+
}
|
|
663
|
+
} else if (lastPos < end) {
|
|
664
|
+
value += String.prototype.slice.call(qs, lastPos, end);
|
|
665
|
+
}
|
|
666
|
+
addKeyVal(obj, key, value, keyEncoded, valEncoded, decode);
|
|
667
|
+
if (--pairs === 0) return obj;
|
|
668
|
+
keyEncoded = valEncoded = customDecode;
|
|
669
|
+
key = value = "";
|
|
670
|
+
encodeCheck = 0;
|
|
671
|
+
lastPos = i + 1;
|
|
672
|
+
sepIdx = eqIdx = 0;
|
|
673
|
+
}
|
|
674
|
+
} else {
|
|
675
|
+
sepIdx = 0;
|
|
676
|
+
// Try matching key/value separator (e.g. '=') if we haven't already
|
|
677
|
+
if (eqIdx < eqLen) {
|
|
678
|
+
if (code === eqCodes[eqIdx]) {
|
|
679
|
+
if (++eqIdx === eqLen) {
|
|
680
|
+
// Key/value separator match!
|
|
681
|
+
const end = i - eqIdx + 1;
|
|
682
|
+
if (lastPos < end) key += String.prototype.slice.call(qs, lastPos, end);
|
|
683
|
+
encodeCheck = 0;
|
|
684
|
+
lastPos = i + 1;
|
|
685
|
+
}
|
|
686
|
+
continue;
|
|
687
|
+
} else {
|
|
688
|
+
eqIdx = 0;
|
|
689
|
+
if (!keyEncoded) {
|
|
690
|
+
// Try to match an (valid) encoded byte once to minimize unnecessary
|
|
691
|
+
// calls to string decoding functions
|
|
692
|
+
if (code === 37) {
|
|
693
|
+
encodeCheck = 1;
|
|
694
|
+
continue;
|
|
695
|
+
} else if (encodeCheck > 0) {
|
|
696
|
+
if (isHexTable[code] === 1) {
|
|
697
|
+
if (++encodeCheck === 3) keyEncoded = true;
|
|
698
|
+
continue;
|
|
699
|
+
} else {
|
|
700
|
+
encodeCheck = 0;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (code === 43) {
|
|
706
|
+
if (lastPos < i) key += String.prototype.slice.call(qs, lastPos, i);
|
|
707
|
+
key += plusChar;
|
|
708
|
+
lastPos = i + 1;
|
|
709
|
+
continue;
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (code === 43) {
|
|
713
|
+
if (lastPos < i) value += String.prototype.slice.call(qs, lastPos, i);
|
|
714
|
+
value += plusChar;
|
|
715
|
+
lastPos = i + 1;
|
|
716
|
+
} else if (!valEncoded) {
|
|
717
|
+
// Try to match an (valid) encoded byte (once) to minimize unnecessary
|
|
718
|
+
// calls to string decoding functions
|
|
719
|
+
if (code === 37) {
|
|
720
|
+
encodeCheck = 1;
|
|
721
|
+
} else if (encodeCheck > 0) {
|
|
722
|
+
if (isHexTable[code] === 1) {
|
|
723
|
+
if (++encodeCheck === 3) valEncoded = true;
|
|
724
|
+
} else {
|
|
725
|
+
encodeCheck = 0;
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
// Deal with any leftover key or value data
|
|
732
|
+
if (lastPos < qs.length) {
|
|
733
|
+
if (eqIdx < eqLen) key += String.prototype.slice.call(qs, lastPos);
|
|
734
|
+
else if (sepIdx < sepLen) value += String.prototype.slice.call(qs, lastPos);
|
|
735
|
+
} else if (eqIdx === 0 && key.length === 0) {
|
|
736
|
+
// We ended on an empty substring
|
|
737
|
+
return obj;
|
|
738
|
+
}
|
|
739
|
+
addKeyVal(obj, key, value, keyEncoded, valEncoded, decode);
|
|
740
|
+
return obj;
|
|
741
|
+
}
|
|
742
|
+
/**
|
|
743
|
+
* V8 does not optimize functions with try-catch blocks, so we isolate them here
|
|
744
|
+
* to minimize the damage (Note: no longer true as of V8 5.4 -- but still will
|
|
745
|
+
* not be inlined).
|
|
746
|
+
* @param {string} s
|
|
747
|
+
* @param {(v: string) => string} decoder
|
|
748
|
+
* @returns {string}
|
|
749
|
+
*/
|
|
750
|
+
function decodeStr(s, decoder) {
|
|
751
|
+
try {
|
|
752
|
+
return decoder(s);
|
|
753
|
+
} catch {
|
|
754
|
+
return qsUnescape(s, true);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
export { unescapeBuffer, qsUnescape as unescape, qsEscape as escape, stringify, stringify as encode, parse, parse as decode };
|
|
758
|
+
export default {
|
|
759
|
+
unescapeBuffer,
|
|
760
|
+
unescape: qsUnescape,
|
|
761
|
+
escape: qsEscape,
|
|
762
|
+
stringify,
|
|
763
|
+
encode: stringify,
|
|
764
|
+
parse,
|
|
765
|
+
decode: parse
|
|
766
|
+
};
|