@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,737 @@
|
|
|
1
|
+
import { notImplemented, notImplementedClass } from "../_internal/utils.mjs";
|
|
2
|
+
// TODO: Implement Error classes
|
|
3
|
+
const ERR_AMBIGUOUS_ARGUMENT = Error;
|
|
4
|
+
const ERR_INVALID_ARG_TYPE = Error;
|
|
5
|
+
const ERR_INVALID_ARG_VALUE = Error;
|
|
6
|
+
const ERR_INVALID_RETURN_VALUE = Error;
|
|
7
|
+
const ERR_MISSING_ARGS = Error;
|
|
8
|
+
export class AssertionError extends Error {
|
|
9
|
+
actual;
|
|
10
|
+
expected;
|
|
11
|
+
operator;
|
|
12
|
+
generatedMessage;
|
|
13
|
+
code = "ERR_ASSERTION";
|
|
14
|
+
constructor(options) {
|
|
15
|
+
super();
|
|
16
|
+
this.actual = options.actual;
|
|
17
|
+
this.expected = options.expected;
|
|
18
|
+
this.operator = options.operator || "";
|
|
19
|
+
this.generatedMessage = options.message === undefined;
|
|
20
|
+
const stackStartFn = options.stackStartFn || fail;
|
|
21
|
+
Error.captureStackTrace?.(this, stackStartFn);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const inspect = (val, opts) => val;
|
|
25
|
+
const isEqual = (a, b) => a === b || JSON.stringify(a) === JSON.stringify(b);
|
|
26
|
+
const isDeepEqual = isEqual;
|
|
27
|
+
const isDeepStrictEqual = isEqual;
|
|
28
|
+
let warned = false;
|
|
29
|
+
// The assert module provides functions that throw
|
|
30
|
+
// AssertionError's when particular conditions are not met. The
|
|
31
|
+
// assert module must conform to the following interface.
|
|
32
|
+
const NO_EXCEPTION_SENTINEL = {};
|
|
33
|
+
// All of the following functions must throw an AssertionError
|
|
34
|
+
// when a corresponding condition is not met, with a message that
|
|
35
|
+
// may be undefined if not provided. All assertion methods provide
|
|
36
|
+
// both the actual and expected values to the assertion error for
|
|
37
|
+
// display purposes.
|
|
38
|
+
// ----------------------------------------------------------------------------
|
|
39
|
+
// Assertions
|
|
40
|
+
// ----------------------------------------------------------------------------
|
|
41
|
+
/**
|
|
42
|
+
* Pure assertion tests whether a value is truthy, as determined
|
|
43
|
+
* by !!value.
|
|
44
|
+
* @param {...any} args
|
|
45
|
+
* @returns {void}
|
|
46
|
+
*/
|
|
47
|
+
export function ok(...args) {
|
|
48
|
+
// @ts-expect-error
|
|
49
|
+
innerOk(ok, args.length, ...args);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* The equality assertion tests shallow, coercive equality with ==.
|
|
53
|
+
* @param {any} actual
|
|
54
|
+
* @param {any} expected
|
|
55
|
+
* @param {string | Error} [message]
|
|
56
|
+
* @returns {void}
|
|
57
|
+
*/
|
|
58
|
+
export function equal(actual, expected, message) {
|
|
59
|
+
if (arguments.length < 2) {
|
|
60
|
+
// @ts-expect-error
|
|
61
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
62
|
+
}
|
|
63
|
+
if (actual != expected && (!Number.isNaN(actual) || !Number.isNaN(expected))) {
|
|
64
|
+
innerFail({
|
|
65
|
+
actual,
|
|
66
|
+
expected,
|
|
67
|
+
message,
|
|
68
|
+
operator: "==",
|
|
69
|
+
stackStartFn: equal
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* The non-equality assertion tests for whether two objects are not
|
|
75
|
+
* equal with !=.
|
|
76
|
+
* @param {any} actual
|
|
77
|
+
* @param {any} expected
|
|
78
|
+
* @param {string | Error} [message]
|
|
79
|
+
* @returns {void}
|
|
80
|
+
*/
|
|
81
|
+
export function notEqual(actual, expected, message) {
|
|
82
|
+
if (arguments.length < 2) {
|
|
83
|
+
// @ts-expect-error
|
|
84
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
85
|
+
}
|
|
86
|
+
if (actual == expected || Number.isNaN(actual) && Number.isNaN(expected)) {
|
|
87
|
+
innerFail({
|
|
88
|
+
actual,
|
|
89
|
+
expected,
|
|
90
|
+
message,
|
|
91
|
+
operator: "!=",
|
|
92
|
+
stackStartFn: notEqual
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* The deep equivalence assertion tests a deep equality relation.
|
|
98
|
+
* @param {any} actual
|
|
99
|
+
* @param {any} expected
|
|
100
|
+
* @param {string | Error} [message]
|
|
101
|
+
* @returns {void}
|
|
102
|
+
*/
|
|
103
|
+
export function deepEqual(actual, expected, message) {
|
|
104
|
+
if (arguments.length < 2) {
|
|
105
|
+
// @ts-expect-error
|
|
106
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
107
|
+
}
|
|
108
|
+
if (!isDeepEqual(actual, expected)) {
|
|
109
|
+
innerFail({
|
|
110
|
+
actual,
|
|
111
|
+
expected,
|
|
112
|
+
message,
|
|
113
|
+
operator: "deepEqual",
|
|
114
|
+
stackStartFn: deepEqual
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The deep non-equivalence assertion tests for any deep inequality.
|
|
120
|
+
* @param {any} actual
|
|
121
|
+
* @param {any} expected
|
|
122
|
+
* @param {string | Error} [message]
|
|
123
|
+
* @returns {void}
|
|
124
|
+
*/
|
|
125
|
+
export function notDeepEqual(actual, expected, message) {
|
|
126
|
+
if (arguments.length < 2) {
|
|
127
|
+
// @ts-expect-error
|
|
128
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
129
|
+
}
|
|
130
|
+
if (isDeepEqual(actual, expected)) {
|
|
131
|
+
innerFail({
|
|
132
|
+
actual,
|
|
133
|
+
expected,
|
|
134
|
+
message,
|
|
135
|
+
operator: "notDeepEqual",
|
|
136
|
+
stackStartFn: notDeepEqual
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The deep strict equivalence assertion tests a deep strict equality
|
|
142
|
+
* relation.
|
|
143
|
+
* @param {any} actual
|
|
144
|
+
* @param {any} expected
|
|
145
|
+
* @param {string | Error} [message]
|
|
146
|
+
* @returns {void}
|
|
147
|
+
*/
|
|
148
|
+
export function deepStrictEqual(actual, expected, message) {
|
|
149
|
+
if (arguments.length < 2) {
|
|
150
|
+
// @ts-expect-error
|
|
151
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
152
|
+
}
|
|
153
|
+
if (!isDeepStrictEqual(actual, expected)) {
|
|
154
|
+
innerFail({
|
|
155
|
+
actual,
|
|
156
|
+
expected,
|
|
157
|
+
message,
|
|
158
|
+
operator: "deepStrictEqual",
|
|
159
|
+
stackStartFn: deepStrictEqual
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* The deep strict non-equivalence assertion tests for any deep strict
|
|
165
|
+
* inequality.
|
|
166
|
+
* @param {any} actual
|
|
167
|
+
* @param {any} expected
|
|
168
|
+
* @param {string | Error} [message]
|
|
169
|
+
* @returns {void}
|
|
170
|
+
*/
|
|
171
|
+
export function notDeepStrictEqual(actual, expected, message) {
|
|
172
|
+
if (arguments.length < 2) {
|
|
173
|
+
// @ts-expect-error
|
|
174
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
175
|
+
}
|
|
176
|
+
if (isDeepStrictEqual(actual, expected)) {
|
|
177
|
+
innerFail({
|
|
178
|
+
actual,
|
|
179
|
+
expected,
|
|
180
|
+
message,
|
|
181
|
+
operator: "notDeepStrictEqual",
|
|
182
|
+
stackStartFn: notDeepStrictEqual
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The strict equivalence assertion tests a strict equality relation.
|
|
188
|
+
* @param {any} actual
|
|
189
|
+
* @param {any} expected
|
|
190
|
+
* @param {string | Error} [message]
|
|
191
|
+
* @returns {void}
|
|
192
|
+
*/
|
|
193
|
+
export function strictEqual(actual, expected, message) {
|
|
194
|
+
if (arguments.length < 2) {
|
|
195
|
+
// @ts-expect-error
|
|
196
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
197
|
+
}
|
|
198
|
+
if (!Object.is(actual, expected)) {
|
|
199
|
+
innerFail({
|
|
200
|
+
actual,
|
|
201
|
+
expected,
|
|
202
|
+
message,
|
|
203
|
+
operator: "strictEqual",
|
|
204
|
+
stackStartFn: strictEqual
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* The strict non-equivalence assertion tests for any strict inequality.
|
|
210
|
+
* @param {any} actual
|
|
211
|
+
* @param {any} expected
|
|
212
|
+
* @param {string | Error} [message]
|
|
213
|
+
* @returns {void}
|
|
214
|
+
*/
|
|
215
|
+
export function notStrictEqual(actual, expected, message) {
|
|
216
|
+
if (arguments.length < 2) {
|
|
217
|
+
// @ts-expect-error
|
|
218
|
+
throw new ERR_MISSING_ARGS("actual", "expected");
|
|
219
|
+
}
|
|
220
|
+
if (Object.is(actual, expected)) {
|
|
221
|
+
innerFail({
|
|
222
|
+
actual,
|
|
223
|
+
expected,
|
|
224
|
+
message,
|
|
225
|
+
operator: "notStrictEqual",
|
|
226
|
+
stackStartFn: notStrictEqual
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Expects the function `promiseFn` to throw an error.
|
|
232
|
+
*/
|
|
233
|
+
export function throws(promiseFn, ...args) {
|
|
234
|
+
// @ts-expect-error
|
|
235
|
+
expectsError(throws, getActual(promiseFn), ...args);
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Expects `promiseFn` function or its value to reject.
|
|
239
|
+
*/
|
|
240
|
+
export async function rejects(promiseFn, ...args) {
|
|
241
|
+
// @ts-expect-error
|
|
242
|
+
expectsError(rejects, await waitForActual(promiseFn), ...args);
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* Asserts that the function `fn` does not throw an error.
|
|
246
|
+
*/
|
|
247
|
+
export function doesNotThrow(fn, ...args) {
|
|
248
|
+
// @ts-expect-error
|
|
249
|
+
expectsNoError(doesNotThrow, getActual(fn), ...args);
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* Expects `fn` or its value to not reject.
|
|
253
|
+
*/
|
|
254
|
+
export async function doesNotReject(fn, ...args) {
|
|
255
|
+
// @ts-expect-error
|
|
256
|
+
expectsNoError(doesNotReject, await waitForActual(fn), ...args);
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Throws `value` if the value is not `null` or `undefined`.
|
|
260
|
+
* @param {any} err
|
|
261
|
+
* @returns {void}
|
|
262
|
+
*/
|
|
263
|
+
export function ifError(err) {
|
|
264
|
+
if (err !== null && err !== undefined) {
|
|
265
|
+
let message = "ifError got unwanted exception: ";
|
|
266
|
+
if (typeof err === "object" && typeof err.message === "string") {
|
|
267
|
+
if (err.message.length === 0 && err.constructor) {
|
|
268
|
+
message += err.constructor.name;
|
|
269
|
+
} else {
|
|
270
|
+
message += err.message;
|
|
271
|
+
}
|
|
272
|
+
} else {
|
|
273
|
+
message += inspect(err);
|
|
274
|
+
}
|
|
275
|
+
const newErr = new AssertionError({
|
|
276
|
+
actual: err,
|
|
277
|
+
expected: null,
|
|
278
|
+
operator: "ifError",
|
|
279
|
+
message,
|
|
280
|
+
stackStartFn: ifError
|
|
281
|
+
});
|
|
282
|
+
// Make sure we actually have a stack trace!
|
|
283
|
+
const origStack = err?.stack;
|
|
284
|
+
if (typeof origStack === "string") {
|
|
285
|
+
// This will remove any duplicated frames from the error frames taken
|
|
286
|
+
// from within `ifError` and add the original error frames to the newly
|
|
287
|
+
// created ones.
|
|
288
|
+
const origStackStart = origStack.indexOf("\n at");
|
|
289
|
+
if (origStackStart !== -1) {
|
|
290
|
+
const originalFrames = origStack.slice(origStackStart + 1).split("\n");
|
|
291
|
+
// Filter all frames existing in err.stack.
|
|
292
|
+
let newFrames = (newErr.stack || "").split("\n");
|
|
293
|
+
for (const errFrame of originalFrames) {
|
|
294
|
+
// Find the first occurrence of the frame.
|
|
295
|
+
const pos = newFrames.indexOf(errFrame);
|
|
296
|
+
if (pos !== -1) {
|
|
297
|
+
// Only keep new frames.
|
|
298
|
+
newFrames = newFrames.slice(0, pos);
|
|
299
|
+
break;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const stackStart = newFrames.join("\n");
|
|
303
|
+
const stackEnd = originalFrames.join("\n");
|
|
304
|
+
newErr.stack = `${stackStart}\n${stackEnd}`;
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
throw newErr;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Expects the `string` input to match the regular expression.
|
|
312
|
+
* @param {string} string
|
|
313
|
+
* @param {RegExp} regexp
|
|
314
|
+
* @param {string | Error} [message]
|
|
315
|
+
* @returns {void}
|
|
316
|
+
*/
|
|
317
|
+
export function match(string, regexp, message) {
|
|
318
|
+
internalMatch(string, regexp, message, match);
|
|
319
|
+
}
|
|
320
|
+
/**
|
|
321
|
+
* Expects the `string` input not to match the regular expression.
|
|
322
|
+
* @param {string} string
|
|
323
|
+
* @param {RegExp} regexp
|
|
324
|
+
* @param {string | Error} [message]
|
|
325
|
+
* @returns {void}
|
|
326
|
+
*/
|
|
327
|
+
export function doesNotMatch(string, regexp, message) {
|
|
328
|
+
internalMatch(string, regexp, message, doesNotMatch);
|
|
329
|
+
}
|
|
330
|
+
export function fail(actual, expected, message, operator, stackStartFn) {
|
|
331
|
+
const argsLen = arguments.length;
|
|
332
|
+
let internalMessage = false;
|
|
333
|
+
if (actual == null && argsLen <= 1) {
|
|
334
|
+
internalMessage = true;
|
|
335
|
+
message = "Failed";
|
|
336
|
+
} else if (argsLen === 1) {
|
|
337
|
+
message = actual;
|
|
338
|
+
actual = undefined;
|
|
339
|
+
} else {
|
|
340
|
+
if (warned === false) {
|
|
341
|
+
warned = true;
|
|
342
|
+
process.emitWarning("assert.fail() with more than one argument is deprecated. " + "Please use assert.strictEqual() instead or only pass a message.", "DeprecationWarning", "DEP0094");
|
|
343
|
+
}
|
|
344
|
+
if (argsLen === 2) operator = "!=";
|
|
345
|
+
}
|
|
346
|
+
if (message instanceof Error) throw message;
|
|
347
|
+
const errArgs = {
|
|
348
|
+
actual,
|
|
349
|
+
expected,
|
|
350
|
+
operator: operator === undefined ? "fail" : operator,
|
|
351
|
+
stackStartFn: stackStartFn || fail,
|
|
352
|
+
message
|
|
353
|
+
};
|
|
354
|
+
const err = new AssertionError(errArgs);
|
|
355
|
+
if (internalMessage) {
|
|
356
|
+
err.generatedMessage = true;
|
|
357
|
+
}
|
|
358
|
+
throw err;
|
|
359
|
+
}
|
|
360
|
+
// ----------------------------------------------------------------------------
|
|
361
|
+
// Internal utils
|
|
362
|
+
// ----------------------------------------------------------------------------
|
|
363
|
+
function innerFail(obj) {
|
|
364
|
+
if (obj.message instanceof Error) throw obj.message;
|
|
365
|
+
throw new AssertionError(obj);
|
|
366
|
+
}
|
|
367
|
+
function innerOk(fn, argLen, value, message) {
|
|
368
|
+
if (!value) {
|
|
369
|
+
let generatedMessage = false;
|
|
370
|
+
if (argLen === 0) {
|
|
371
|
+
generatedMessage = true;
|
|
372
|
+
message = "No value argument passed to `assert.ok()`";
|
|
373
|
+
} else if (message == null) {
|
|
374
|
+
generatedMessage = true;
|
|
375
|
+
message = "<null>";
|
|
376
|
+
} else if (message instanceof Error) {
|
|
377
|
+
throw message;
|
|
378
|
+
}
|
|
379
|
+
const err = new AssertionError({
|
|
380
|
+
actual: value,
|
|
381
|
+
expected: true,
|
|
382
|
+
message,
|
|
383
|
+
operator: "==",
|
|
384
|
+
stackStartFn: fn
|
|
385
|
+
});
|
|
386
|
+
err.generatedMessage = generatedMessage;
|
|
387
|
+
throw err;
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
class Comparison {
|
|
391
|
+
constructor(obj, keys, actual) {
|
|
392
|
+
for (const key of keys) {
|
|
393
|
+
if (key in obj) {
|
|
394
|
+
if (actual !== undefined && typeof actual[key] === "string" && obj[key] instanceof RegExp && obj[key].exec(actual[key]) !== null) {
|
|
395
|
+
// @ts-expect-error
|
|
396
|
+
this[key] = actual[key];
|
|
397
|
+
} else {
|
|
398
|
+
// @ts-expect-error
|
|
399
|
+
this[key] = obj[key];
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
function compareExceptionKey(actual, expected, key, message, keys, fn) {
|
|
406
|
+
if (!(key in actual) || !isDeepStrictEqual(actual[key], expected[key])) {
|
|
407
|
+
if (!message) {
|
|
408
|
+
// Create placeholder objects to create a nice output.
|
|
409
|
+
const a = new Comparison(actual, keys);
|
|
410
|
+
const b = new Comparison(expected, keys, actual);
|
|
411
|
+
const err = new AssertionError({
|
|
412
|
+
actual: a,
|
|
413
|
+
expected: b,
|
|
414
|
+
operator: "deepStrictEqual",
|
|
415
|
+
stackStartFn: fn
|
|
416
|
+
});
|
|
417
|
+
err.actual = actual;
|
|
418
|
+
err.expected = expected;
|
|
419
|
+
err.operator = fn.name;
|
|
420
|
+
throw err;
|
|
421
|
+
}
|
|
422
|
+
innerFail({
|
|
423
|
+
actual,
|
|
424
|
+
expected,
|
|
425
|
+
message,
|
|
426
|
+
operator: fn.name,
|
|
427
|
+
stackStartFn: fn
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
function expectedException(actual, expected, message, fn) {
|
|
432
|
+
let generatedMessage = false;
|
|
433
|
+
let throwError = false;
|
|
434
|
+
if (typeof expected !== "function") {
|
|
435
|
+
// Handle regular expressions.
|
|
436
|
+
if (expected instanceof RegExp) {
|
|
437
|
+
const str = String(actual);
|
|
438
|
+
if (RegExp.prototype.exec.call(expected, str) !== null) return;
|
|
439
|
+
if (!message) {
|
|
440
|
+
generatedMessage = true;
|
|
441
|
+
message = "The input did not match the regular expression " + `${inspect(expected)}. Input:\n\n${inspect(str)}\n`;
|
|
442
|
+
}
|
|
443
|
+
throwError = true;
|
|
444
|
+
} else if (typeof actual !== "object" || actual === null) {
|
|
445
|
+
const err = new AssertionError({
|
|
446
|
+
actual,
|
|
447
|
+
expected,
|
|
448
|
+
message,
|
|
449
|
+
operator: "deepStrictEqual",
|
|
450
|
+
stackStartFn: fn
|
|
451
|
+
});
|
|
452
|
+
err.operator = fn.name;
|
|
453
|
+
throw err;
|
|
454
|
+
} else {
|
|
455
|
+
// Handle validation objects.
|
|
456
|
+
const keys = Object.keys(expected);
|
|
457
|
+
// Special handle errors to make sure the name and the message are
|
|
458
|
+
// compared as well.
|
|
459
|
+
if (expected instanceof Error) {
|
|
460
|
+
keys.push("name", "message");
|
|
461
|
+
} else if (keys.length === 0) {
|
|
462
|
+
throw new ERR_INVALID_ARG_VALUE(
|
|
463
|
+
"error",
|
|
464
|
+
expected,
|
|
465
|
+
// @ts-expect-error
|
|
466
|
+
"may not be an empty object"
|
|
467
|
+
);
|
|
468
|
+
}
|
|
469
|
+
for (const key of keys) {
|
|
470
|
+
if (typeof actual[key] === "string" && expected[key] instanceof RegExp && expected[key].exec(actual[key]) !== null) {
|
|
471
|
+
continue;
|
|
472
|
+
}
|
|
473
|
+
compareExceptionKey(actual, expected, key, message, keys, fn);
|
|
474
|
+
}
|
|
475
|
+
return;
|
|
476
|
+
}
|
|
477
|
+
} else if (expected.prototype !== undefined && actual instanceof expected) {
|
|
478
|
+
return;
|
|
479
|
+
} else if (expected instanceof Error) {
|
|
480
|
+
if (!message) {
|
|
481
|
+
generatedMessage = true;
|
|
482
|
+
message = "The error is expected to be an instance of " + `"${expected.name}". Received `;
|
|
483
|
+
if (actual instanceof Error) {
|
|
484
|
+
const name = actual.constructor && actual.constructor.name || actual.name;
|
|
485
|
+
if (expected.name === name) {
|
|
486
|
+
message += "an error with identical name but a different prototype.";
|
|
487
|
+
} else {
|
|
488
|
+
message += `"${name}"`;
|
|
489
|
+
}
|
|
490
|
+
if (actual.message) {
|
|
491
|
+
message += `\n\nError message:\n\n${actual.message}`;
|
|
492
|
+
}
|
|
493
|
+
} else {
|
|
494
|
+
message += `"${inspect(actual, { depth: -1 })}"`;
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
throwError = true;
|
|
498
|
+
} else {
|
|
499
|
+
// Check validation functions return value.
|
|
500
|
+
const res = Reflect.apply(expected, {}, [actual]);
|
|
501
|
+
if (res !== true) {
|
|
502
|
+
if (!message) {
|
|
503
|
+
generatedMessage = true;
|
|
504
|
+
const name = expected.name ? `"${expected.name}" ` : "";
|
|
505
|
+
message = `The ${name}validation function is expected to return` + ` "true". Received ${inspect(res)}`;
|
|
506
|
+
if (actual instanceof Error) {
|
|
507
|
+
message += `\n\nCaught error:\n\n${actual}`;
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
throwError = true;
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
if (throwError) {
|
|
514
|
+
const err = new AssertionError({
|
|
515
|
+
actual,
|
|
516
|
+
expected,
|
|
517
|
+
message,
|
|
518
|
+
operator: fn.name,
|
|
519
|
+
stackStartFn: fn
|
|
520
|
+
});
|
|
521
|
+
err.generatedMessage = generatedMessage;
|
|
522
|
+
throw err;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
function getActual(fn) {
|
|
526
|
+
// validateFunction(fn, "fn");
|
|
527
|
+
try {
|
|
528
|
+
fn();
|
|
529
|
+
} catch (error_) {
|
|
530
|
+
return error_;
|
|
531
|
+
}
|
|
532
|
+
return NO_EXCEPTION_SENTINEL;
|
|
533
|
+
}
|
|
534
|
+
function checkIsPromise(obj) {
|
|
535
|
+
// Accept native ES6 promises and promises that are implemented in a similar
|
|
536
|
+
// way. Do not accept thenables that use a function as `obj` and that have no
|
|
537
|
+
// `catch` handler.
|
|
538
|
+
return obj instanceof Promise || obj !== null && typeof obj === "object" && typeof obj.then === "function" && typeof obj.catch === "function";
|
|
539
|
+
}
|
|
540
|
+
function internalMatch(string, regexp, message, fn) {
|
|
541
|
+
if (!(regexp instanceof RegExp)) {
|
|
542
|
+
// @ts-expect-error
|
|
543
|
+
throw new ERR_INVALID_ARG_TYPE("regexp", "RegExp", regexp);
|
|
544
|
+
}
|
|
545
|
+
const match = fn === assert.match;
|
|
546
|
+
if (typeof string !== "string" || regexp.exec(string) !== null !== match) {
|
|
547
|
+
if (message instanceof Error) {
|
|
548
|
+
throw message;
|
|
549
|
+
}
|
|
550
|
+
const generatedMessage = !message;
|
|
551
|
+
// 'The input was expected to not match the regular expression ' +
|
|
552
|
+
message = message || (typeof string === "string" ? (match ? "The input did not match the regular expression " : "The input was expected to not match the regular expression ") + `${inspect(regexp)}. Input:\n\n${inspect(string)}\n` : "The \"string\" argument must be of type string. Received type " + `${typeof string} (${inspect(string)})`);
|
|
553
|
+
const err = new AssertionError({
|
|
554
|
+
actual: string,
|
|
555
|
+
expected: regexp,
|
|
556
|
+
message,
|
|
557
|
+
operator: fn?.name,
|
|
558
|
+
stackStartFn: fn
|
|
559
|
+
});
|
|
560
|
+
err.generatedMessage = generatedMessage;
|
|
561
|
+
throw err;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
async function waitForActual(promiseFn) {
|
|
565
|
+
let resultPromise;
|
|
566
|
+
if (typeof promiseFn === "function") {
|
|
567
|
+
// Return a rejected promise if `promiseFn` throws synchronously.
|
|
568
|
+
resultPromise = promiseFn();
|
|
569
|
+
// Fail in case no promise is returned.
|
|
570
|
+
if (!checkIsPromise(resultPromise)) {
|
|
571
|
+
throw new ERR_INVALID_RETURN_VALUE(
|
|
572
|
+
"instance of Promise",
|
|
573
|
+
"promiseFn",
|
|
574
|
+
// @ts-expect-error
|
|
575
|
+
resultPromise
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
} else if (checkIsPromise(promiseFn)) {
|
|
579
|
+
resultPromise = promiseFn;
|
|
580
|
+
} else {
|
|
581
|
+
throw new ERR_INVALID_ARG_TYPE(
|
|
582
|
+
"promiseFn",
|
|
583
|
+
["Function", "Promise"],
|
|
584
|
+
// @ts-expect-error
|
|
585
|
+
promiseFn
|
|
586
|
+
);
|
|
587
|
+
}
|
|
588
|
+
try {
|
|
589
|
+
await resultPromise;
|
|
590
|
+
} catch (error_) {
|
|
591
|
+
return error_;
|
|
592
|
+
}
|
|
593
|
+
return NO_EXCEPTION_SENTINEL;
|
|
594
|
+
}
|
|
595
|
+
function expectsError(stackStartFn, actual, error, message) {
|
|
596
|
+
if (typeof error === "string") {
|
|
597
|
+
if (arguments.length === 4) {
|
|
598
|
+
throw new ERR_INVALID_ARG_TYPE(
|
|
599
|
+
"error",
|
|
600
|
+
[
|
|
601
|
+
"Object",
|
|
602
|
+
"Error",
|
|
603
|
+
"Function",
|
|
604
|
+
"RegExp"
|
|
605
|
+
],
|
|
606
|
+
// @ts-expect-error
|
|
607
|
+
error
|
|
608
|
+
);
|
|
609
|
+
}
|
|
610
|
+
if (typeof actual === "object" && actual !== null) {
|
|
611
|
+
if (actual?.message === error) {
|
|
612
|
+
throw new ERR_AMBIGUOUS_ARGUMENT(
|
|
613
|
+
"error/message",
|
|
614
|
+
// @ts-expect-error
|
|
615
|
+
`The error message "${actual.message}" is identical to the message.`
|
|
616
|
+
);
|
|
617
|
+
}
|
|
618
|
+
} else if (actual === error) {
|
|
619
|
+
throw new ERR_AMBIGUOUS_ARGUMENT(
|
|
620
|
+
"error/message",
|
|
621
|
+
// @ts-expect-error
|
|
622
|
+
`The error "${actual}" is identical to the message.`
|
|
623
|
+
);
|
|
624
|
+
}
|
|
625
|
+
message = error;
|
|
626
|
+
error = undefined;
|
|
627
|
+
} else if (error != null && typeof error !== "object" && typeof error !== "function") {
|
|
628
|
+
throw new ERR_INVALID_ARG_TYPE(
|
|
629
|
+
"error",
|
|
630
|
+
[
|
|
631
|
+
"Object",
|
|
632
|
+
"Error",
|
|
633
|
+
"Function",
|
|
634
|
+
"RegExp"
|
|
635
|
+
],
|
|
636
|
+
// @ts-expect-error
|
|
637
|
+
error
|
|
638
|
+
);
|
|
639
|
+
}
|
|
640
|
+
if (actual === NO_EXCEPTION_SENTINEL) {
|
|
641
|
+
let details = "";
|
|
642
|
+
if (error && error.name) {
|
|
643
|
+
details += ` (${error.name})`;
|
|
644
|
+
}
|
|
645
|
+
details += message ? `: ${message}` : ".";
|
|
646
|
+
const fnType = stackStartFn === assert.rejects ? "rejection" : "exception";
|
|
647
|
+
innerFail({
|
|
648
|
+
actual: undefined,
|
|
649
|
+
expected: error,
|
|
650
|
+
operator: stackStartFn.name,
|
|
651
|
+
message: `Missing expected ${fnType}${details}`,
|
|
652
|
+
stackStartFn
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
if (!error) return;
|
|
656
|
+
expectedException(actual, error, message, stackStartFn);
|
|
657
|
+
}
|
|
658
|
+
function hasMatchingError(actual, expected) {
|
|
659
|
+
if (typeof expected !== "function") {
|
|
660
|
+
if (expected instanceof RegExp) {
|
|
661
|
+
const str = String(actual);
|
|
662
|
+
return RegExp.prototype.exec.call(expected, str) !== null;
|
|
663
|
+
}
|
|
664
|
+
throw new ERR_INVALID_ARG_TYPE(
|
|
665
|
+
"expected",
|
|
666
|
+
["Function", "RegExp"],
|
|
667
|
+
// @ts-expect-error
|
|
668
|
+
expected
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
// Guard instanceof against arrow functions as they don't have a prototype.
|
|
672
|
+
if (expected.prototype !== undefined && actual instanceof expected) {
|
|
673
|
+
return true;
|
|
674
|
+
}
|
|
675
|
+
if (expected instanceof Error) {
|
|
676
|
+
return false;
|
|
677
|
+
}
|
|
678
|
+
return Reflect.apply(expected, {}, [actual]) === true;
|
|
679
|
+
}
|
|
680
|
+
function expectsNoError(stackStartFn, actual, error, message) {
|
|
681
|
+
if (actual === NO_EXCEPTION_SENTINEL) return;
|
|
682
|
+
if (typeof error === "string") {
|
|
683
|
+
message = error;
|
|
684
|
+
error = undefined;
|
|
685
|
+
}
|
|
686
|
+
if (!error || hasMatchingError(actual, error)) {
|
|
687
|
+
const details = message ? `: ${message}` : ".";
|
|
688
|
+
const fnType = stackStartFn === assert.doesNotReject ? "rejection" : "exception";
|
|
689
|
+
innerFail({
|
|
690
|
+
actual,
|
|
691
|
+
expected: error,
|
|
692
|
+
operator: stackStartFn?.name,
|
|
693
|
+
message: `Got unwanted ${fnType}${details}\n` + `Actual message: "${actual && actual.message}"`,
|
|
694
|
+
stackStartFn
|
|
695
|
+
});
|
|
696
|
+
}
|
|
697
|
+
throw actual;
|
|
698
|
+
}
|
|
699
|
+
// ----------------------------------------------------------------------------
|
|
700
|
+
// Exports
|
|
701
|
+
// ----------------------------------------------------------------------------
|
|
702
|
+
const assert = Object.assign(ok, {});
|
|
703
|
+
// deprecated
|
|
704
|
+
export const CallTracker = /* @__PURE__ */ notImplementedClass("asset.CallTracker");
|
|
705
|
+
export const partialDeepStrictEqual = /* @__PURE__ */ notImplemented("assert.partialDeepStrictEqual");
|
|
706
|
+
assert.fail = fail;
|
|
707
|
+
assert.ok = ok;
|
|
708
|
+
assert.equal = equal;
|
|
709
|
+
assert.notEqual = notEqual;
|
|
710
|
+
assert.deepEqual = deepEqual;
|
|
711
|
+
assert.notDeepEqual = notDeepEqual;
|
|
712
|
+
assert.deepStrictEqual = deepStrictEqual;
|
|
713
|
+
assert.notDeepStrictEqual = notDeepStrictEqual;
|
|
714
|
+
assert.strictEqual = strictEqual;
|
|
715
|
+
assert.notStrictEqual = notStrictEqual;
|
|
716
|
+
assert.throws = throws;
|
|
717
|
+
assert.rejects = rejects;
|
|
718
|
+
assert.doesNotThrow = doesNotThrow;
|
|
719
|
+
assert.doesNotReject = doesNotReject;
|
|
720
|
+
assert.ifError = ifError;
|
|
721
|
+
assert.match = match;
|
|
722
|
+
assert.doesNotMatch = doesNotMatch;
|
|
723
|
+
assert.partialDeepStrictEqual = partialDeepStrictEqual;
|
|
724
|
+
assert.AssertionError = AssertionError;
|
|
725
|
+
assert.CallTracker = CallTracker;
|
|
726
|
+
export const strict = Object.assign(function _strict(...args) {
|
|
727
|
+
// @ts-expect-error
|
|
728
|
+
innerOk(strict, args.length, ...args);
|
|
729
|
+
}, assert, {
|
|
730
|
+
equal: assert.strictEqual,
|
|
731
|
+
deepEqual: assert.deepStrictEqual,
|
|
732
|
+
notEqual: assert.notStrictEqual,
|
|
733
|
+
notDeepEqual: assert.notDeepStrictEqual
|
|
734
|
+
});
|
|
735
|
+
assert.strict = strict;
|
|
736
|
+
assert.strict.strict = assert.strict;
|
|
737
|
+
export default assert;
|