veryfront 0.1.324 → 0.1.327
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/esm/cli/commands/extension/init-command.js +2 -2
- package/esm/cli/commands/extension/validate-command.js +1 -1
- package/esm/deno.d.ts +7 -0
- package/esm/deno.js +8 -1
- package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts +2 -0
- package/esm/deps/esm.sh/react-dom@19.2.4/client.d.ts.map +1 -0
- package/esm/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
- package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts +2 -0
- package/esm/deps/esm.sh/scheduler@^0.27.0.d.ts.map +1 -0
- package/esm/deps/esm.sh/scheduler@^0.27.0.js +3 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/almost_equals.js +47 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/array_includes.js +65 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts +17 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assert.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/assertion_error.js +30 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equal.js +194 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts +37 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/equals.js +61 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/exists.js +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/fail.js +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/false.js +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/instance_of.js +52 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts +25 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/is_error.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts +19 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less.js +28 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/less_or_equal.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/mod.js +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts +27 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_equals.js +39 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_instance_of.js +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_match.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts +23 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.js +32 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts +29 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/object_match.js +177 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts +42 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/rejects.js +53 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts +24 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/strict_equals.js +58 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts +18 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/string_includes.js +26 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts +45 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/throws.js +44 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unimplemented.js +20 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts +15 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/assert/1.0.19/unreachable.js +20 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts +150 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/assertion_state.js +224 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts +80 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/build_message.js +116 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts +140 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff.js +276 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts +99 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/diff_str.js +182 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts +29 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/format.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/format.js +70 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts +159 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/styles.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/styles.js +207 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts +25 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/internal/1.0.13/types.js +3 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts +80 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/_test_suite.js +348 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts +738 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/testing/1.0.18/bdd.js +656 -0
- package/esm/src/agent/fork-runtime-stream.d.ts +143 -0
- package/esm/src/agent/fork-runtime-stream.d.ts.map +1 -0
- package/esm/src/agent/fork-runtime-stream.js +505 -0
- package/esm/src/agent/hosted-child-fork-stream-execution.d.ts +130 -0
- package/esm/src/agent/hosted-child-fork-stream-execution.d.ts.map +1 -0
- package/esm/src/agent/hosted-child-fork-stream-execution.js +391 -0
- package/esm/src/agent/index.d.ts +2 -0
- package/esm/src/agent/index.d.ts.map +1 -1
- package/esm/src/agent/index.js +2 -0
- package/esm/src/chat/conversation.d.ts +5 -5
- package/esm/src/chat/final-step-fallback.js +2 -2
- package/esm/src/modules/index.d.ts +12 -0
- package/esm/src/modules/index.d.ts.map +1 -0
- package/esm/src/modules/index.js +10 -0
- package/esm/src/modules/module-resolver.d.ts +28 -0
- package/esm/src/modules/module-resolver.d.ts.map +1 -0
- package/esm/src/modules/module-resolver.js +106 -0
- package/esm/src/rendering/cleanup.d.ts +7 -0
- package/esm/src/rendering/cleanup.d.ts.map +1 -0
- package/esm/src/rendering/cleanup.js +22 -0
- package/esm/src/rendering/ssr/index.d.ts +10 -0
- package/esm/src/rendering/ssr/index.d.ts.map +1 -0
- package/esm/src/rendering/ssr/index.js +8 -0
- package/esm/src/rendering/ssr/mdx-module-loader.d.ts +5 -0
- package/esm/src/rendering/ssr/mdx-module-loader.d.ts.map +1 -0
- package/esm/src/rendering/ssr/mdx-module-loader.js +150 -0
- package/esm/src/rendering/ssr/mdx-renderer.d.ts +4 -0
- package/esm/src/rendering/ssr/mdx-renderer.d.ts.map +1 -0
- package/esm/src/rendering/ssr/mdx-renderer.js +44 -0
- package/esm/src/rendering/ssr/types.d.ts +13 -0
- package/esm/src/rendering/ssr/types.d.ts.map +1 -0
- package/esm/src/rendering/ssr/types.js +1 -0
- package/esm/src/sandbox/index.d.ts +1 -0
- package/esm/src/sandbox/index.d.ts.map +1 -1
- package/esm/src/sandbox/index.js +1 -0
- package/esm/src/sandbox/shell-tools.d.ts +39 -0
- package/esm/src/sandbox/shell-tools.d.ts.map +1 -0
- package/esm/src/sandbox/shell-tools.js +177 -0
- package/esm/src/server/shared/index.d.ts +7 -0
- package/esm/src/server/shared/index.d.ts.map +1 -0
- package/esm/src/server/shared/index.js +6 -0
- package/esm/src/testing/assert.d.ts +22 -0
- package/esm/src/testing/assert.d.ts.map +1 -0
- package/esm/src/testing/assert.js +217 -0
- package/esm/src/testing/bdd.d.ts +67 -0
- package/esm/src/testing/bdd.d.ts.map +1 -0
- package/esm/src/testing/bdd.js +401 -0
- package/esm/src/testing/deno-compat.d.ts +26 -0
- package/esm/src/testing/deno-compat.d.ts.map +1 -0
- package/esm/src/testing/deno-compat.js +146 -0
- package/esm/src/testing/index.d.ts +28 -0
- package/esm/src/testing/index.d.ts.map +1 -0
- package/esm/src/testing/index.js +27 -0
- package/esm/src/testing/init.d.ts +2 -0
- package/esm/src/testing/init.d.ts.map +1 -0
- package/esm/src/testing/init.js +18 -0
- package/esm/src/testing/isolation.d.ts +30 -0
- package/esm/src/testing/isolation.d.ts.map +1 -0
- package/esm/src/testing/isolation.js +151 -0
- package/esm/src/testing/timing.d.ts +4 -0
- package/esm/src/testing/timing.d.ts.map +1 -0
- package/esm/src/testing/timing.js +22 -0
- package/esm/src/testing/utils.d.ts +6 -0
- package/esm/src/testing/utils.d.ts.map +1 -0
- package/esm/src/testing/utils.js +49 -0
- package/esm/src/types/global-guards.d.ts +11 -0
- package/esm/src/types/global-guards.d.ts.map +1 -0
- package/esm/src/types/global-guards.js +12 -0
- package/esm/src/utils/cache/keys/namespace.d.ts +3 -0
- package/esm/src/utils/cache/keys/namespace.d.ts.map +1 -0
- package/esm/src/utils/cache/keys/namespace.js +19 -0
- package/esm/src/utils/clsx.d.ts +3 -3
- package/esm/src/utils/clsx.d.ts.map +1 -1
- package/esm/src/utils/clsx.js +2 -3
- package/esm/src/utils/mime-types.d.ts +0 -6
- package/esm/src/utils/mime-types.d.ts.map +1 -1
- package/esm/src/utils/mime-types.js +0 -1
- package/esm/src/utils/version-constant.d.ts +1 -1
- package/esm/src/utils/version-constant.js +1 -1
- package/package.json +14 -1
- package/src/cli/commands/extension/init-command.ts +2 -2
- package/src/cli/commands/extension/validate-command.ts +1 -1
- package/src/deno.js +8 -1
- package/src/deps/esm.sh/@types/react-dom@19.2.3/client.d.ts +105 -0
- package/src/deps/esm.sh/@types/react@19.2.14/global.d.ts +166 -0
- package/src/deps/esm.sh/@types/react@19.2.14/index.d.ts +4370 -0
- package/src/deps/esm.sh/@types/scheduler@0.26.0/index.d.ts +30 -0
- package/src/deps/esm.sh/csstype@3.2.3/index.d.ts +22569 -0
- package/src/deps/esm.sh/react-dom@19.2.4/client.d.ts +105 -0
- package/src/deps/esm.sh/react-dom@19.2.4/client.js +5 -0
- package/src/deps/esm.sh/scheduler@^0.27.0.d.ts +30 -0
- package/src/deps/esm.sh/scheduler@^0.27.0.js +3 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/almost_equals.ts +56 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/array_includes.ts +76 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/assert.ts +24 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/assertion_error.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/equal.ts +226 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/equals.ts +68 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/exists.ts +31 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/fail.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/false.ts +27 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/greater.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/greater_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/instance_of.ts +64 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/is_error.ts +65 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/less.ts +29 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/less_or_equal.ts +36 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/mod.ts +47 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_equals.ts +43 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_instance_of.ts +33 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_match.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/not_strict_equals.ts +42 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/object_match.ts +224 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/rejects.ts +123 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/strict_equals.ts +68 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/string_includes.ts +30 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/throws.ts +111 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/unimplemented.ts +21 -0
- package/src/deps/jsr.io/@std/assert/1.0.19/unreachable.ts +21 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/assertion_state.ts +248 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/build_message.ts +147 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/diff.ts +317 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/diff_str.ts +208 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/format.ts +89 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/styles.ts +233 -0
- package/src/deps/jsr.io/@std/internal/1.0.13/types.ts +30 -0
- package/src/deps/jsr.io/@std/testing/1.0.18/_test_suite.ts +461 -0
- package/src/deps/jsr.io/@std/testing/1.0.18/bdd.ts +1294 -0
- package/src/src/agent/fork-runtime-stream.ts +780 -0
- package/src/src/agent/hosted-child-fork-stream-execution.ts +579 -0
- package/src/src/agent/index.ts +26 -0
- package/src/src/chat/final-step-fallback.ts +2 -2
- package/src/src/modules/index.ts +43 -0
- package/src/src/modules/module-resolver.ts +145 -0
- package/src/src/rendering/cleanup.ts +27 -0
- package/src/src/rendering/ssr/index.ts +10 -0
- package/src/src/rendering/ssr/mdx-module-loader.ts +185 -0
- package/src/src/rendering/ssr/mdx-renderer.ts +66 -0
- package/src/src/rendering/ssr/types.ts +14 -0
- package/src/src/sandbox/index.ts +9 -0
- package/src/src/sandbox/shell-tools.ts +242 -0
- package/src/src/server/shared/index.ts +12 -0
- package/src/src/testing/assert.ts +352 -0
- package/src/src/testing/bdd.ts +618 -0
- package/src/src/testing/deno-compat.ts +206 -0
- package/src/src/testing/index.ts +92 -0
- package/src/src/testing/init.ts +21 -0
- package/src/src/testing/isolation.ts +177 -0
- package/src/src/testing/timing.ts +27 -0
- package/src/src/testing/utils.ts +44 -0
- package/src/src/types/global-guards.ts +21 -0
- package/src/src/utils/cache/keys/namespace.ts +25 -0
- package/src/src/utils/clsx.ts +2 -4
- package/src/src/utils/mime-types.ts +0 -2
- package/src/src/utils/version-constant.ts +1 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WARNING: This entrypoint is only available starting with `react-dom@18.0.0-rc.1`
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
// See https://github.com/facebook/react/blob/main/packages/react-dom/client.js to see how the exports are declared,
|
|
6
|
+
|
|
7
|
+
import React = require("https://esm.sh/@types/react@19.2.14/index.d.ts");
|
|
8
|
+
|
|
9
|
+
export {};
|
|
10
|
+
|
|
11
|
+
declare const REACT_FORM_STATE_SIGIL: unique symbol;
|
|
12
|
+
export interface ReactFormState {
|
|
13
|
+
[REACT_FORM_STATE_SIGIL]: never;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface HydrationOptions {
|
|
17
|
+
formState?: ReactFormState | null;
|
|
18
|
+
/**
|
|
19
|
+
* Prefix for `useId`.
|
|
20
|
+
*/
|
|
21
|
+
identifierPrefix?: string;
|
|
22
|
+
onUncaughtError?:
|
|
23
|
+
| ((error: unknown, errorInfo: { componentStack?: string | undefined }) => void)
|
|
24
|
+
| undefined;
|
|
25
|
+
onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void;
|
|
26
|
+
onCaughtError?:
|
|
27
|
+
| ((
|
|
28
|
+
error: unknown,
|
|
29
|
+
errorInfo: {
|
|
30
|
+
componentStack?: string | undefined;
|
|
31
|
+
errorBoundary?: React.Component<unknown> | undefined;
|
|
32
|
+
},
|
|
33
|
+
) => void)
|
|
34
|
+
| undefined;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface RootOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Prefix for `useId`.
|
|
40
|
+
*/
|
|
41
|
+
identifierPrefix?: string;
|
|
42
|
+
onUncaughtError?:
|
|
43
|
+
| ((error: unknown, errorInfo: { componentStack?: string | undefined }) => void)
|
|
44
|
+
| undefined;
|
|
45
|
+
onRecoverableError?: (error: unknown, errorInfo: ErrorInfo) => void;
|
|
46
|
+
onCaughtError?:
|
|
47
|
+
| ((
|
|
48
|
+
error: unknown,
|
|
49
|
+
errorInfo: {
|
|
50
|
+
componentStack?: string | undefined;
|
|
51
|
+
errorBoundary?: React.Component<unknown> | undefined;
|
|
52
|
+
},
|
|
53
|
+
) => void)
|
|
54
|
+
| undefined;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export interface ErrorInfo {
|
|
58
|
+
componentStack?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface Root {
|
|
62
|
+
render(children: React.ReactNode): void;
|
|
63
|
+
unmount(): void;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Different release channels declare additional types of ReactNode this particular release channel accepts.
|
|
68
|
+
* App or library types should never augment this interface.
|
|
69
|
+
*/
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
71
|
+
export interface DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS {}
|
|
72
|
+
|
|
73
|
+
export type Container =
|
|
74
|
+
| Element
|
|
75
|
+
| DocumentFragment
|
|
76
|
+
| Document
|
|
77
|
+
| DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS[
|
|
78
|
+
keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_EXPERIMENTAL_CREATE_ROOT_CONTAINERS
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* createRoot lets you create a root to display React components inside a browser DOM node.
|
|
83
|
+
*
|
|
84
|
+
* @see {@link https://react.dev/reference/react-dom/client/createRoot API Reference for `createRoot`}
|
|
85
|
+
*/
|
|
86
|
+
export function createRoot(container: Container, options?: RootOptions): Root;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Same as `createRoot()`, but is used to hydrate a container whose HTML contents were rendered by ReactDOMServer.
|
|
90
|
+
*
|
|
91
|
+
* React will attempt to attach event listeners to the existing markup.
|
|
92
|
+
*
|
|
93
|
+
* **Example Usage**
|
|
94
|
+
*
|
|
95
|
+
* ```jsx
|
|
96
|
+
* hydrateRoot(document.querySelector('#root'), <App />)
|
|
97
|
+
* ```
|
|
98
|
+
*
|
|
99
|
+
* @see https://react.dev/reference/react-dom/client/hydrateRoot
|
|
100
|
+
*/
|
|
101
|
+
export function hydrateRoot(
|
|
102
|
+
container: Element | Document,
|
|
103
|
+
initialChildren: React.ReactNode,
|
|
104
|
+
options?: HydrationOptions,
|
|
105
|
+
): Root;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* esm.sh - react-dom@19.2.4/client */
|
|
2
|
+
import "react-dom/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/es2022/react-dom.mjs";
|
|
3
|
+
import "../scheduler@^0.27.0.js";
|
|
4
|
+
export * from "react-dom/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/es2022/client.mjs";
|
|
5
|
+
export { default } from "react-dom/X-ZGNzc3R5cGVAMy4yLjMKZXJlYWN0/es2022/client.mjs";
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// eslint-disable-next-line @typescript-eslint/no-invalid-void-type
|
|
2
|
+
export type FrameCallbackType = (didTimeout: boolean) => FrameCallbackType | void;
|
|
3
|
+
export interface CallbackNode {
|
|
4
|
+
callback: FrameCallbackType;
|
|
5
|
+
priorityLevel: number;
|
|
6
|
+
expirationTime: number;
|
|
7
|
+
next: CallbackNode | null;
|
|
8
|
+
prev: CallbackNode | null;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const unstable_ImmediatePriority = 1;
|
|
12
|
+
export const unstable_UserBlockingPriority = 2;
|
|
13
|
+
export const unstable_NormalPriority = 3;
|
|
14
|
+
export const unstable_IdlePriority = 5;
|
|
15
|
+
export const unstable_LowPriority = 4;
|
|
16
|
+
export function unstable_runWithPriority<T>(priorityLevel: number, eventHandler: () => T): T;
|
|
17
|
+
export function unstable_scheduleCallback(
|
|
18
|
+
priorityLevel: number,
|
|
19
|
+
callback: FrameCallbackType,
|
|
20
|
+
options?: { delay?: number | undefined; timeout?: number | undefined },
|
|
21
|
+
): CallbackNode;
|
|
22
|
+
export function unstable_next<T>(eventHandler: () => T): T;
|
|
23
|
+
export function unstable_cancelCallback(callbackNode: CallbackNode): void;
|
|
24
|
+
export function unstable_wrapCallback(callback: FrameCallbackType): () => FrameCallbackType;
|
|
25
|
+
export function unstable_getCurrentPriorityLevel(): number;
|
|
26
|
+
export function unstable_shouldYield(): boolean;
|
|
27
|
+
export function unstable_continueExecution(): void;
|
|
28
|
+
export function unstable_pauseExecution(): void;
|
|
29
|
+
export function unstable_getFirstCallbackNode(): CallbackNode | null;
|
|
30
|
+
export function unstable_now(): number;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { AssertionError } from "./assertion_error.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Make an assertion that `actual` and `expected` are almost equal numbers
|
|
7
|
+
* through a given tolerance. It can be used to take into account IEEE-754
|
|
8
|
+
* double-precision floating-point representation limitations. If the values
|
|
9
|
+
* are not almost equal then throw.
|
|
10
|
+
*
|
|
11
|
+
* The default tolerance is one hundred thousandth of a percent of the
|
|
12
|
+
* expected value.
|
|
13
|
+
*
|
|
14
|
+
* @example Usage
|
|
15
|
+
* ```ts ignore
|
|
16
|
+
* import { assertAlmostEquals } from "@std/assert";
|
|
17
|
+
*
|
|
18
|
+
* assertAlmostEquals(0.01, 0.02); // Throws
|
|
19
|
+
* assertAlmostEquals(1e-8, 1e-9); // Throws
|
|
20
|
+
* assertAlmostEquals(1.000000001e-8, 1.000000002e-8); // Doesn't throw
|
|
21
|
+
* assertAlmostEquals(0.01, 0.02, 0.1); // Doesn't throw
|
|
22
|
+
* assertAlmostEquals(0.1 + 0.2, 0.3, 1e-16); // Doesn't throw
|
|
23
|
+
* assertAlmostEquals(0.1 + 0.2, 0.3, 1e-17); // Throws
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @param actual The actual value to compare.
|
|
27
|
+
* @param expected The expected value to compare.
|
|
28
|
+
* @param tolerance The tolerance to consider the values almost equal. The
|
|
29
|
+
* default is one hundred thousandth of a percent of the expected value.
|
|
30
|
+
* @param msg The optional message to include in the error.
|
|
31
|
+
* @throws {AssertionError} If the values are not almost equal.
|
|
32
|
+
*/
|
|
33
|
+
export function assertAlmostEquals(
|
|
34
|
+
actual: number,
|
|
35
|
+
expected: number,
|
|
36
|
+
tolerance?: number,
|
|
37
|
+
msg?: string,
|
|
38
|
+
) {
|
|
39
|
+
if (Object.is(actual, expected)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const delta = Math.abs(expected - actual);
|
|
43
|
+
if (tolerance === undefined) {
|
|
44
|
+
tolerance = isFinite(expected) ? Math.abs(expected * 1e-7) : 1e-7;
|
|
45
|
+
}
|
|
46
|
+
if (delta <= tolerance) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
51
|
+
const f = (n: number) => Number.isInteger(n) ? n : n.toExponential();
|
|
52
|
+
throw new AssertionError(
|
|
53
|
+
`Expected actual: "${f(actual)}" to be close to "${f(expected)}": \
|
|
54
|
+
delta "${f(delta)}" is greater than "${f(tolerance)}"${msgSuffix}`,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { equal } from "./equal.js";
|
|
4
|
+
import { format } from "../../internal/1.0.13/format.js";
|
|
5
|
+
import { AssertionError } from "./assertion_error.js";
|
|
6
|
+
|
|
7
|
+
/** An array-like object (`Array`, `Uint8Array`, `NodeList`, etc.) that is not a string */
|
|
8
|
+
export type ArrayLikeArg<T> = ArrayLike<T> & object;
|
|
9
|
+
|
|
10
|
+
function isPrimitive(value: unknown): boolean {
|
|
11
|
+
return value === null ||
|
|
12
|
+
typeof value !== "object" && typeof value !== "function";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Asserts that `actual` contains all values in `expected`, using deep equality
|
|
17
|
+
* for non-primitive values.
|
|
18
|
+
*
|
|
19
|
+
* @example Usage with primitives
|
|
20
|
+
* ```ts ignore
|
|
21
|
+
* import { assertArrayIncludes } from "@std/assert";
|
|
22
|
+
*
|
|
23
|
+
* assertArrayIncludes([1, 2, 3], [2, 3]); // Passes
|
|
24
|
+
* assertArrayIncludes([1, 2, 3], [4]); // Throws
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @example Usage with objects (deep equality)
|
|
28
|
+
* ```ts ignore
|
|
29
|
+
* import { assertArrayIncludes } from "@std/assert";
|
|
30
|
+
*
|
|
31
|
+
* assertArrayIncludes([{ a: 1 }, { b: 2 }], [{ a: 1 }]); // Passes
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @typeParam T The element type of the arrays.
|
|
35
|
+
* @param actual The array-like object to search within.
|
|
36
|
+
* @param expected The values that must be present in `actual`.
|
|
37
|
+
* @param msg Optional message to display on failure.
|
|
38
|
+
* @throws {AssertionError} If any value in `expected` is not found in `actual`.
|
|
39
|
+
*/
|
|
40
|
+
export function assertArrayIncludes<T>(
|
|
41
|
+
actual: ArrayLikeArg<T>,
|
|
42
|
+
expected: ArrayLikeArg<T>,
|
|
43
|
+
msg?: string,
|
|
44
|
+
): void {
|
|
45
|
+
const missing: unknown[] = [];
|
|
46
|
+
const expectedLen = expected.length;
|
|
47
|
+
const actualLen = actual.length;
|
|
48
|
+
for (let i = 0; i < expectedLen; i++) {
|
|
49
|
+
const item = expected[i];
|
|
50
|
+
let found: boolean;
|
|
51
|
+
if (isPrimitive(item)) {
|
|
52
|
+
// Fast path
|
|
53
|
+
found = Array.prototype.includes.call(actual, item);
|
|
54
|
+
} else {
|
|
55
|
+
found = false;
|
|
56
|
+
for (let j = 0; j < actualLen; j++) {
|
|
57
|
+
if (equal(item, actual[j])) {
|
|
58
|
+
found = true;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (!found) {
|
|
64
|
+
missing.push(item);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (missing.length === 0) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
72
|
+
msg = `Expected actual: "${format(actual)}" to include: "${
|
|
73
|
+
format(expected)
|
|
74
|
+
}"${msgSuffix}\nmissing: ${format(missing)}`;
|
|
75
|
+
throw new AssertionError(msg);
|
|
76
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { AssertionError } from "./assertion_error.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Make an assertion, an error will be thrown if `expr` does not have a truthy value.
|
|
7
|
+
*
|
|
8
|
+
* @example Usage
|
|
9
|
+
* ```ts ignore
|
|
10
|
+
* import { assert } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* assert("hello".includes("ello")); // Doesn't throw
|
|
13
|
+
* assert("hello".includes("world")); // Throws
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @param expr The expression to test.
|
|
17
|
+
* @param msg The optional message to display if the assertion fails.
|
|
18
|
+
* @throws {AssertionError} If `expr` is falsy.
|
|
19
|
+
*/
|
|
20
|
+
export function assert(expr: unknown, msg = ""): asserts expr {
|
|
21
|
+
if (!expr) {
|
|
22
|
+
throw new AssertionError(msg);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Error thrown when an assertion fails.
|
|
6
|
+
*
|
|
7
|
+
* @example Usage
|
|
8
|
+
* ```ts ignore
|
|
9
|
+
* import { AssertionError } from "@std/assert";
|
|
10
|
+
*
|
|
11
|
+
* try {
|
|
12
|
+
* throw new AssertionError("foo", { cause: "bar" });
|
|
13
|
+
* } catch (error) {
|
|
14
|
+
* if (error instanceof AssertionError) {
|
|
15
|
+
* error.message === "foo"; // true
|
|
16
|
+
* error.cause === "bar"; // true
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export class AssertionError extends Error {
|
|
22
|
+
/** Constructs a new instance.
|
|
23
|
+
*
|
|
24
|
+
* @param message The error message.
|
|
25
|
+
* @param options Additional options. This argument is still unstable. It may change in the future release.
|
|
26
|
+
*/
|
|
27
|
+
constructor(message: string, options?: ErrorOptions) {
|
|
28
|
+
super(message, options);
|
|
29
|
+
this.name = "AssertionError";
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import * as dntShim from "../../../../../_dnt.shims.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
type KeyedCollection = Set<unknown> | Map<unknown, unknown>;
|
|
7
|
+
function isKeyedCollection(x: unknown): x is KeyedCollection {
|
|
8
|
+
return x instanceof Set || x instanceof Map;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function prototypesEqual(a: object, b: object) {
|
|
12
|
+
const pa = Object.getPrototypeOf(a);
|
|
13
|
+
const pb = Object.getPrototypeOf(b);
|
|
14
|
+
return pa === pb ||
|
|
15
|
+
pa === Object.prototype && pb === null ||
|
|
16
|
+
pa === null && pb === Object.prototype;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function isBasicObjectOrArray(obj: object) {
|
|
20
|
+
const proto = Object.getPrototypeOf(obj);
|
|
21
|
+
return proto === null || proto === Object.prototype ||
|
|
22
|
+
proto === Array.prototype;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Slightly faster than Reflect.ownKeys in V8 as of 12.9.202.13-rusty (2024-10-28)
|
|
26
|
+
function ownKeys(obj: object) {
|
|
27
|
+
return [
|
|
28
|
+
...Object.getOwnPropertyNames(obj),
|
|
29
|
+
...Object.getOwnPropertySymbols(obj),
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function getKeysDeep(obj: object) {
|
|
34
|
+
const keys = new Set<string | symbol>();
|
|
35
|
+
|
|
36
|
+
while (obj !== Object.prototype && obj !== Array.prototype && obj != null) {
|
|
37
|
+
for (const key of ownKeys(obj)) {
|
|
38
|
+
keys.add(key);
|
|
39
|
+
}
|
|
40
|
+
obj = Object.getPrototypeOf(obj);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return keys;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// deno-lint-ignore no-explicit-any
|
|
47
|
+
const Temporal = (dntShim.dntGlobalThis as any).Temporal ?? Object.create(null);
|
|
48
|
+
|
|
49
|
+
/** A non-exhaustive list of prototypes that can be accurately fast-path compared with `String(instance)` */
|
|
50
|
+
const stringComparablePrototypes = new Set<unknown>(
|
|
51
|
+
[
|
|
52
|
+
Intl.Locale,
|
|
53
|
+
RegExp,
|
|
54
|
+
Temporal.Duration,
|
|
55
|
+
Temporal.Instant,
|
|
56
|
+
Temporal.PlainDate,
|
|
57
|
+
Temporal.PlainDateTime,
|
|
58
|
+
Temporal.PlainTime,
|
|
59
|
+
Temporal.PlainYearMonth,
|
|
60
|
+
Temporal.PlainMonthDay,
|
|
61
|
+
Temporal.ZonedDateTime,
|
|
62
|
+
URL,
|
|
63
|
+
URLSearchParams,
|
|
64
|
+
].filter((x) => x != null).map((x) => x.prototype),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
function isPrimitive(x: unknown) {
|
|
68
|
+
return typeof x === "string" ||
|
|
69
|
+
typeof x === "number" ||
|
|
70
|
+
typeof x === "boolean" ||
|
|
71
|
+
typeof x === "bigint" ||
|
|
72
|
+
typeof x === "symbol" ||
|
|
73
|
+
x == null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type TypedArray = Pick<Uint8Array | BigUint64Array, "length" | number>;
|
|
77
|
+
const TypedArray = Object.getPrototypeOf(Uint8Array);
|
|
78
|
+
function compareTypedArrays(a: TypedArray, b: TypedArray) {
|
|
79
|
+
if (a.length !== b.length) return false;
|
|
80
|
+
for (let i = 0; i < b.length; i++) {
|
|
81
|
+
if (!sameValueZero(a[i], b[i])) return false;
|
|
82
|
+
}
|
|
83
|
+
return true;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Check both strict equality (`0 == -0`) and `Object.is` (`NaN == NaN`) */
|
|
87
|
+
function sameValueZero(a: unknown, b: unknown) {
|
|
88
|
+
return a === b || Object.is(a, b);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Deep equality comparison used in assertions.
|
|
93
|
+
*
|
|
94
|
+
* This function is based on value equality, but for some cases (such as data
|
|
95
|
+
* that can only be read asynchronously or function properties) value equality
|
|
96
|
+
* is not possible to determine. In such cases, reference equality is used
|
|
97
|
+
* instead, which may cause false negatives for objects such as `Blob`s or
|
|
98
|
+
* `Request`s.
|
|
99
|
+
*
|
|
100
|
+
* @param a The actual value
|
|
101
|
+
* @param b The expected value
|
|
102
|
+
* @returns `true` if the values are deeply equal, `false` otherwise
|
|
103
|
+
*
|
|
104
|
+
* @throws {TypeError} If either value is a `WeakMap` or `WeakSet`.
|
|
105
|
+
*
|
|
106
|
+
* @example Usage
|
|
107
|
+
* ```ts
|
|
108
|
+
* import { equal } from "@std/assert/equal";
|
|
109
|
+
*
|
|
110
|
+
* equal({ foo: "bar" }, { foo: "bar" }); // Returns `true`
|
|
111
|
+
* equal({ foo: "bar" }, { foo: "baz" }); // Returns `false`
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
export function equal(a: unknown, b: unknown): boolean {
|
|
115
|
+
const seen = new Map<unknown, unknown>();
|
|
116
|
+
return (function compare(a: unknown, b: unknown): boolean {
|
|
117
|
+
if (sameValueZero(a, b)) return true;
|
|
118
|
+
if (isPrimitive(a) || isPrimitive(b)) return false;
|
|
119
|
+
|
|
120
|
+
if (a instanceof Date && b instanceof Date) {
|
|
121
|
+
return Object.is(a.getTime(), b.getTime());
|
|
122
|
+
}
|
|
123
|
+
if (a && typeof a === "object" && b && typeof b === "object") {
|
|
124
|
+
if (!prototypesEqual(a, b)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
if (a instanceof TypedArray) {
|
|
128
|
+
return compareTypedArrays(a as TypedArray, b as TypedArray);
|
|
129
|
+
}
|
|
130
|
+
if (
|
|
131
|
+
a instanceof ArrayBuffer ||
|
|
132
|
+
(globalThis.SharedArrayBuffer && a instanceof SharedArrayBuffer)
|
|
133
|
+
) {
|
|
134
|
+
return compareTypedArrays(
|
|
135
|
+
new Uint8Array(a),
|
|
136
|
+
new Uint8Array(b as ArrayBuffer | SharedArrayBuffer),
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
if (a instanceof WeakMap) {
|
|
140
|
+
throw new TypeError("Cannot compare WeakMap instances");
|
|
141
|
+
}
|
|
142
|
+
if (a instanceof WeakSet) {
|
|
143
|
+
throw new TypeError("Cannot compare WeakSet instances");
|
|
144
|
+
}
|
|
145
|
+
if (a instanceof WeakRef) {
|
|
146
|
+
return compare(a.deref(), (b as WeakRef<WeakKey>).deref());
|
|
147
|
+
}
|
|
148
|
+
if (seen.get(a) === b) {
|
|
149
|
+
return true;
|
|
150
|
+
}
|
|
151
|
+
if (Object.keys(a).length !== Object.keys(b).length) {
|
|
152
|
+
return false;
|
|
153
|
+
}
|
|
154
|
+
seen.set(a, b);
|
|
155
|
+
if (isKeyedCollection(a) && isKeyedCollection(b)) {
|
|
156
|
+
if (a.size !== b.size) {
|
|
157
|
+
return false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const aKeys = [...a.keys()];
|
|
161
|
+
const primitiveKeysFastPath = aKeys.every(isPrimitive);
|
|
162
|
+
if (primitiveKeysFastPath) {
|
|
163
|
+
if (a instanceof Set) {
|
|
164
|
+
return a.symmetricDifference(b).size === 0;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
for (const key of aKeys) {
|
|
168
|
+
if (
|
|
169
|
+
!b.has(key) ||
|
|
170
|
+
!compare(a.get(key), (b as Map<unknown, unknown>).get(key))
|
|
171
|
+
) {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return true;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
let unmatchedEntries = a.size;
|
|
179
|
+
|
|
180
|
+
for (const [aKey, aValue] of a.entries()) {
|
|
181
|
+
for (const [bKey, bValue] of b.entries()) {
|
|
182
|
+
/* Given that Map keys can be references, we need
|
|
183
|
+
* to ensure that they are also deeply equal */
|
|
184
|
+
|
|
185
|
+
if (!compare(aKey, bKey)) continue;
|
|
186
|
+
|
|
187
|
+
if (
|
|
188
|
+
(aKey === aValue && bKey === bValue) ||
|
|
189
|
+
(compare(aValue, bValue))
|
|
190
|
+
) {
|
|
191
|
+
unmatchedEntries--;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
return unmatchedEntries === 0;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
let keys: Iterable<string | symbol>;
|
|
201
|
+
|
|
202
|
+
if (isBasicObjectOrArray(a)) {
|
|
203
|
+
// fast path
|
|
204
|
+
keys = ownKeys({ ...a, ...b });
|
|
205
|
+
} else if (stringComparablePrototypes.has(Object.getPrototypeOf(a))) {
|
|
206
|
+
// medium path
|
|
207
|
+
return String(a) === String(b);
|
|
208
|
+
} else {
|
|
209
|
+
// slow path
|
|
210
|
+
keys = getKeysDeep(a).union(getKeysDeep(b));
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
for (const key of keys) {
|
|
214
|
+
type Key = keyof typeof a;
|
|
215
|
+
if (!compare(a[key as Key], b[key as Key])) {
|
|
216
|
+
return false;
|
|
217
|
+
}
|
|
218
|
+
if (((key in a) && (!(key in b))) || ((key in b) && (!(key in a)))) {
|
|
219
|
+
return false;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
return true;
|
|
223
|
+
}
|
|
224
|
+
return false;
|
|
225
|
+
})(a, b);
|
|
226
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { equal } from "./equal.js";
|
|
4
|
+
import { buildMessage } from "../../internal/1.0.13/build_message.js";
|
|
5
|
+
import { diff } from "../../internal/1.0.13/diff.js";
|
|
6
|
+
import { diffStr } from "../../internal/1.0.13/diff_str.js";
|
|
7
|
+
import { format } from "../../internal/1.0.13/format.js";
|
|
8
|
+
|
|
9
|
+
import { AssertionError } from "./assertion_error.js";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Make an assertion that `actual` and `expected` are equal, deeply. If not
|
|
13
|
+
* deeply equal, then throw.
|
|
14
|
+
*
|
|
15
|
+
* Type parameter can be specified to ensure values under comparison have the
|
|
16
|
+
* same type.
|
|
17
|
+
*
|
|
18
|
+
* Note: This function is based on value equality, but for some cases (such as
|
|
19
|
+
* data that can only be read asynchronously or function properties) value
|
|
20
|
+
* equality is not possible to determine. In such cases, reference equality is
|
|
21
|
+
* used instead, which may cause false negatives for objects such as `Blob`s or
|
|
22
|
+
* `Request`s.
|
|
23
|
+
*
|
|
24
|
+
* @example Usage
|
|
25
|
+
* ```ts ignore
|
|
26
|
+
* import { assertEquals } from "@std/assert";
|
|
27
|
+
*
|
|
28
|
+
* assertEquals("world", "world"); // Doesn't throw
|
|
29
|
+
* assertEquals("hello", "world"); // Throws
|
|
30
|
+
* ```
|
|
31
|
+
* @example Compare `Blob` objects
|
|
32
|
+
* ```ts ignore
|
|
33
|
+
* import { assertEquals } from "@std/assert";
|
|
34
|
+
*
|
|
35
|
+
* const bytes1 = await new Blob(["foo"]).bytes();
|
|
36
|
+
* const bytes2 = await new Blob(["foo"]).bytes();
|
|
37
|
+
*
|
|
38
|
+
* assertEquals(bytes1, bytes2);
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @typeParam T The type of the values to compare. This is usually inferred.
|
|
42
|
+
* @param actual The actual value to compare.
|
|
43
|
+
* @param expected The expected value to compare.
|
|
44
|
+
* @param msg The optional message to display if the assertion fails.
|
|
45
|
+
*/
|
|
46
|
+
export function assertEquals<T>(
|
|
47
|
+
actual: T,
|
|
48
|
+
expected: T,
|
|
49
|
+
msg?: string,
|
|
50
|
+
) {
|
|
51
|
+
if (equal(actual, expected)) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
55
|
+
let message = `Values are not equal${msgSuffix}`;
|
|
56
|
+
|
|
57
|
+
const actualString = format(actual);
|
|
58
|
+
const expectedString = format(expected);
|
|
59
|
+
const stringDiff = (typeof actual === "string") &&
|
|
60
|
+
(typeof expected === "string");
|
|
61
|
+
const diffResult = stringDiff
|
|
62
|
+
? diffStr(actual as string, expected as string)
|
|
63
|
+
: diff(actualString.split("\n"), expectedString.split("\n"));
|
|
64
|
+
const diffMsg = buildMessage(diffResult, { stringDiff }, arguments[3])
|
|
65
|
+
.join("\n");
|
|
66
|
+
message = `${message}\n${diffMsg}`;
|
|
67
|
+
throw new AssertionError(message);
|
|
68
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { AssertionError } from "./assertion_error.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Make an assertion that actual is not null or undefined.
|
|
7
|
+
* If not then throw.
|
|
8
|
+
*
|
|
9
|
+
* @example Usage
|
|
10
|
+
* ```ts ignore
|
|
11
|
+
* import { assertExists } from "@std/assert";
|
|
12
|
+
*
|
|
13
|
+
* assertExists("something"); // Doesn't throw
|
|
14
|
+
* assertExists(undefined); // Throws
|
|
15
|
+
* ```
|
|
16
|
+
*
|
|
17
|
+
* @typeParam T The type of the actual value.
|
|
18
|
+
* @param actual The actual value to check.
|
|
19
|
+
* @param msg The optional message to include in the error if the assertion fails.
|
|
20
|
+
*/
|
|
21
|
+
export function assertExists<T>(
|
|
22
|
+
actual: T,
|
|
23
|
+
msg?: string,
|
|
24
|
+
): asserts actual is NonNullable<T> {
|
|
25
|
+
if (actual === undefined || actual === null) {
|
|
26
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
27
|
+
msg =
|
|
28
|
+
`Expected actual: "${actual}" to not be null or undefined${msgSuffix}`;
|
|
29
|
+
throw new AssertionError(msg);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright 2018-2026 the Deno authors. MIT license.
|
|
2
|
+
// This module is browser compatible.
|
|
3
|
+
import { AssertionError } from "./assertion_error.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Forcefully throws a failed assertion.
|
|
7
|
+
*
|
|
8
|
+
* @example Usage
|
|
9
|
+
* ```ts ignore
|
|
10
|
+
* import { fail } from "@std/assert";
|
|
11
|
+
*
|
|
12
|
+
* fail("Deliberately failed!"); // Throws
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @param msg Optional message to include in the error.
|
|
16
|
+
* @returns Never returns, always throws.
|
|
17
|
+
*/
|
|
18
|
+
export function fail(msg?: string): never {
|
|
19
|
+
const msgSuffix = msg ? `: ${msg}` : ".";
|
|
20
|
+
throw new AssertionError(`Failed assertion${msgSuffix}`);
|
|
21
|
+
}
|