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,206 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deno API compatibility shims for cross-runtime testing.
|
|
3
|
+
*
|
|
4
|
+
* Provides portable implementations of common Deno testing APIs:
|
|
5
|
+
* - Deno.makeTempDir() → makeTempDir()
|
|
6
|
+
* - Deno.makeTempFile() → makeTempFile()
|
|
7
|
+
* - Deno.writeTextFile() → writeTextFile()
|
|
8
|
+
* - Deno.readTextFile() → readTextFile()
|
|
9
|
+
* - Deno.remove() → remove()
|
|
10
|
+
* - Deno.mkdir() → mkdir()
|
|
11
|
+
* - Deno.stat() → stat()
|
|
12
|
+
* - Deno.env.get/set/delete → getEnv/setEnv/deleteEnv
|
|
13
|
+
*
|
|
14
|
+
* @module
|
|
15
|
+
*/
|
|
16
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
import { isDeno } from "../platform/compat/runtime.js";
|
|
20
|
+
import { scaleMs } from "./timing.js";
|
|
21
|
+
import { TIMEOUT_ERROR } from "../errors/index.js";
|
|
22
|
+
|
|
23
|
+
export {
|
|
24
|
+
chmod,
|
|
25
|
+
createFileSystem,
|
|
26
|
+
exists,
|
|
27
|
+
isAlreadyExistsError,
|
|
28
|
+
isNotFoundError,
|
|
29
|
+
makeTempDir,
|
|
30
|
+
mkdir,
|
|
31
|
+
readDir,
|
|
32
|
+
readFile,
|
|
33
|
+
readTextFile,
|
|
34
|
+
remove,
|
|
35
|
+
stat,
|
|
36
|
+
writeFile,
|
|
37
|
+
writeTextFile,
|
|
38
|
+
} from "../platform/compat/fs.js";
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
cwd,
|
|
42
|
+
deleteEnv,
|
|
43
|
+
env,
|
|
44
|
+
getArgs,
|
|
45
|
+
getEnv,
|
|
46
|
+
setEnv,
|
|
47
|
+
} from "../platform/compat/process.js";
|
|
48
|
+
|
|
49
|
+
export async function makeTempFile(
|
|
50
|
+
options?: { prefix?: string; suffix?: string },
|
|
51
|
+
): Promise<string> {
|
|
52
|
+
if (isDeno) {
|
|
53
|
+
// @ts-ignore - Deno global
|
|
54
|
+
return await dntShim.Deno.makeTempFile(options);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const [{ default: os }, { default: fs }, { default: path }] = await Promise.all([
|
|
58
|
+
import("node:os"),
|
|
59
|
+
import("node:fs/promises"),
|
|
60
|
+
import("node:path"),
|
|
61
|
+
]);
|
|
62
|
+
|
|
63
|
+
const prefix = options?.prefix ?? "tmp-";
|
|
64
|
+
const suffix = options?.suffix ?? "";
|
|
65
|
+
const randomPart = Math.random().toString(36).substring(2, 10);
|
|
66
|
+
const filename = `${prefix}${randomPart}${suffix}`;
|
|
67
|
+
const tempPath = path.join(os.tmpdir(), filename);
|
|
68
|
+
|
|
69
|
+
await fs.writeFile(tempPath, "");
|
|
70
|
+
return tempPath;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export async function makeTempDirWithOptions(options?: {
|
|
74
|
+
prefix?: string;
|
|
75
|
+
dir?: string;
|
|
76
|
+
}): Promise<string> {
|
|
77
|
+
if (isDeno) {
|
|
78
|
+
// @ts-ignore - Deno global
|
|
79
|
+
return await dntShim.Deno.makeTempDir(options);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const [{ default: os }, { default: fs }, { default: path }] = await Promise.all([
|
|
83
|
+
import("node:os"),
|
|
84
|
+
import("node:fs/promises"),
|
|
85
|
+
import("node:path"),
|
|
86
|
+
]);
|
|
87
|
+
|
|
88
|
+
const baseDir = options?.dir ?? os.tmpdir();
|
|
89
|
+
const prefix = options?.prefix ?? "tmp-";
|
|
90
|
+
const randomPart = Math.random().toString(36).substring(2, 10);
|
|
91
|
+
const dirname = `${prefix}${randomPart}`;
|
|
92
|
+
const tempPath = path.join(baseDir, dirname);
|
|
93
|
+
|
|
94
|
+
await fs.mkdir(tempPath, { recursive: true });
|
|
95
|
+
return tempPath;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export async function waitFor(
|
|
99
|
+
condition: () => boolean | Promise<boolean>,
|
|
100
|
+
options?: {
|
|
101
|
+
timeout?: number;
|
|
102
|
+
interval?: number;
|
|
103
|
+
message?: string;
|
|
104
|
+
},
|
|
105
|
+
): Promise<void> {
|
|
106
|
+
const timeout = scaleMs(options?.timeout ?? 5000, 10);
|
|
107
|
+
const interval = scaleMs(options?.interval ?? 100, 5);
|
|
108
|
+
const message = options?.message ?? "Condition not met within timeout";
|
|
109
|
+
const start = Date.now();
|
|
110
|
+
|
|
111
|
+
while (Date.now() - start < timeout) {
|
|
112
|
+
if (await condition()) return;
|
|
113
|
+
// no cleanup needed: one-shot
|
|
114
|
+
await new Promise<void>((resolve) => dntShim.setTimeout(resolve, interval));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
throw TIMEOUT_ERROR.create({ detail: `${message} (timeout: ${timeout}ms)` });
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// no cleanup needed: one-shot
|
|
121
|
+
export function delay(ms: number): Promise<void> {
|
|
122
|
+
return new Promise((resolve) => dntShim.setTimeout(resolve, scaleMs(ms)));
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function exit(code: number): never {
|
|
126
|
+
if (isDeno) {
|
|
127
|
+
// @ts-ignore - Deno global
|
|
128
|
+
dntShim.Deno.exit(code);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
process.exit(code);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export async function withTempDir<T>(
|
|
135
|
+
fn: (tempDir: string) => Promise<T>,
|
|
136
|
+
options?: { prefix?: string },
|
|
137
|
+
): Promise<T> {
|
|
138
|
+
const tempDir = await makeTempDirWithOptions({ prefix: options?.prefix ?? "test-" });
|
|
139
|
+
|
|
140
|
+
try {
|
|
141
|
+
return await fn(tempDir);
|
|
142
|
+
} finally {
|
|
143
|
+
try {
|
|
144
|
+
if (isDeno) {
|
|
145
|
+
// @ts-ignore - Deno global
|
|
146
|
+
await dntShim.Deno.remove(tempDir, { recursive: true });
|
|
147
|
+
} else {
|
|
148
|
+
const { default: fs } = await import("node:fs/promises");
|
|
149
|
+
await fs.rm(tempDir, { recursive: true, force: true });
|
|
150
|
+
}
|
|
151
|
+
} catch (_) {
|
|
152
|
+
/* expected: temp dir may already be removed or inaccessible */
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export async function withTempFile<T>(
|
|
158
|
+
fn: (tempFile: string) => Promise<T>,
|
|
159
|
+
options?: { prefix?: string; suffix?: string },
|
|
160
|
+
): Promise<T> {
|
|
161
|
+
const tempFile = await makeTempFile({ prefix: options?.prefix, suffix: options?.suffix });
|
|
162
|
+
|
|
163
|
+
try {
|
|
164
|
+
return await fn(tempFile);
|
|
165
|
+
} finally {
|
|
166
|
+
try {
|
|
167
|
+
if (isDeno) {
|
|
168
|
+
// @ts-ignore - Deno global
|
|
169
|
+
await dntShim.Deno.remove(tempFile);
|
|
170
|
+
} else {
|
|
171
|
+
const { default: fs } = await import("node:fs/promises");
|
|
172
|
+
await fs.rm(tempFile, { force: true });
|
|
173
|
+
}
|
|
174
|
+
} catch (_) {
|
|
175
|
+
/* expected: temp file may already be removed or inaccessible */
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
export async function withEnv<T>(
|
|
181
|
+
vars: Record<string, string>,
|
|
182
|
+
fn: () => Promise<T>,
|
|
183
|
+
): Promise<T> {
|
|
184
|
+
const { getEnv, setEnv, deleteEnv } = await import("../platform/compat/process.js");
|
|
185
|
+
|
|
186
|
+
const original: Record<string, string | undefined> = {};
|
|
187
|
+
for (const key of Object.keys(vars)) {
|
|
188
|
+
original[key] = getEnv(key);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
for (const [key, value] of Object.entries(vars)) {
|
|
192
|
+
setEnv(key, value);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
try {
|
|
196
|
+
return await fn();
|
|
197
|
+
} finally {
|
|
198
|
+
for (const [key, value] of Object.entries(original)) {
|
|
199
|
+
if (value === undefined) {
|
|
200
|
+
deleteEnv(key);
|
|
201
|
+
} else {
|
|
202
|
+
setEnv(key, value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cross-runtime test utilities — BDD framework (describe/it), assertions,
|
|
3
|
+
* test isolation, filesystem/env helpers, and timing utilities for Deno, Node, and Bun.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { assertEquals, describe, it } from "veryfront/testing";
|
|
8
|
+
*
|
|
9
|
+
* describe("math", () => {
|
|
10
|
+
* it("adds numbers", () => {
|
|
11
|
+
* assertEquals(1 + 1, 2);
|
|
12
|
+
* });
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* @module testing
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
// Initialize test environment before any other imports
|
|
20
|
+
import "../../_dnt.polyfills.js";
|
|
21
|
+
|
|
22
|
+
import "./init.js";
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
assert,
|
|
26
|
+
assertEquals,
|
|
27
|
+
assertExists,
|
|
28
|
+
assertGreater,
|
|
29
|
+
assertGreaterOrEqual,
|
|
30
|
+
assertInstanceOf,
|
|
31
|
+
assertLess,
|
|
32
|
+
assertLessOrEqual,
|
|
33
|
+
assertMatch,
|
|
34
|
+
assertNotEquals,
|
|
35
|
+
assertNotStrictEquals,
|
|
36
|
+
assertObjectMatch,
|
|
37
|
+
assertRejects,
|
|
38
|
+
assertStrictEquals,
|
|
39
|
+
assertStringIncludes,
|
|
40
|
+
assertThrows,
|
|
41
|
+
fail,
|
|
42
|
+
} from "./assert.js";
|
|
43
|
+
|
|
44
|
+
export { deepEquals, safeStringify } from "./utils.js";
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
afterAll,
|
|
48
|
+
afterEach,
|
|
49
|
+
beforeAll,
|
|
50
|
+
beforeEach,
|
|
51
|
+
describe,
|
|
52
|
+
it,
|
|
53
|
+
test,
|
|
54
|
+
} from "./bdd.js";
|
|
55
|
+
export type { BddTestContext, TestOptions } from "./bdd.js";
|
|
56
|
+
|
|
57
|
+
export { registerTestCleanup, resetAllTestState } from "./isolation.js";
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
chmod,
|
|
61
|
+
createFileSystem,
|
|
62
|
+
cwd,
|
|
63
|
+
delay,
|
|
64
|
+
deleteEnv,
|
|
65
|
+
env,
|
|
66
|
+
exists,
|
|
67
|
+
exit,
|
|
68
|
+
getArgs,
|
|
69
|
+
getEnv,
|
|
70
|
+
isAlreadyExistsError,
|
|
71
|
+
isNotFoundError,
|
|
72
|
+
makeTempDir,
|
|
73
|
+
makeTempDirWithOptions,
|
|
74
|
+
makeTempFile,
|
|
75
|
+
mkdir,
|
|
76
|
+
readDir,
|
|
77
|
+
readFile,
|
|
78
|
+
readTextFile,
|
|
79
|
+
remove,
|
|
80
|
+
setEnv,
|
|
81
|
+
stat,
|
|
82
|
+
waitFor,
|
|
83
|
+
withEnv,
|
|
84
|
+
withTempDir,
|
|
85
|
+
withTempFile,
|
|
86
|
+
writeFile,
|
|
87
|
+
writeTextFile,
|
|
88
|
+
} from "./deno-compat.js";
|
|
89
|
+
|
|
90
|
+
export { getTestTimeScale, scaleMs, testDelay } from "./timing.js";
|
|
91
|
+
|
|
92
|
+
export { isBun, isDeno, isNode } from "../platform/compat/runtime.js";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test environment initialization.
|
|
3
|
+
*
|
|
4
|
+
* This module sets up the testing environment by disabling features
|
|
5
|
+
* that can cause resource leaks in tests, like LRU cache cleanup intervals.
|
|
6
|
+
*
|
|
7
|
+
* IMPORTANT: Import this module before any other veryfront imports in test files
|
|
8
|
+
* to ensure the flags are set before module-level caches are initialized.
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
const g = dntShim.dntGlobalThis as Record<string, unknown>;
|
|
16
|
+
|
|
17
|
+
g.__vfDisableLruInterval = true;
|
|
18
|
+
g.__vfTestEnv = true;
|
|
19
|
+
g.__vfTestEnvMask = {
|
|
20
|
+
prefixes: ["VERYFRONT_", "OTEL_", "OAUTH_", "GITHUB_", "OPENAI_", "ANTHROPIC_", "GOOGLE_"],
|
|
21
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Test isolation utilities for cross-runtime execution.
|
|
3
|
+
*
|
|
4
|
+
* Provides default cleanup hooks to reduce cross-test leakage,
|
|
5
|
+
* especially in Bun where module caching and shared globals
|
|
6
|
+
* can cause flakiness.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { isBun } from "../platform/compat/runtime.js";
|
|
12
|
+
|
|
13
|
+
type CleanupTask = () => void | Promise<void>;
|
|
14
|
+
type LabeledCleanupTask = {
|
|
15
|
+
label: string;
|
|
16
|
+
task: CleanupTask;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const cleanupTasks = new Set<CleanupTask>();
|
|
20
|
+
|
|
21
|
+
export function registerTestCleanup(task: CleanupTask): void {
|
|
22
|
+
cleanupTasks.add(task);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
async function runBestEffortCleanups(cleanups: Iterable<LabeledCleanupTask>): Promise<void> {
|
|
26
|
+
for (const { label, task } of cleanups) {
|
|
27
|
+
try {
|
|
28
|
+
await task();
|
|
29
|
+
} catch (error) {
|
|
30
|
+
console.debug(`resetAllTestState ${label} failed`, error);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function runRegisteredCleanups(): Promise<void> {
|
|
36
|
+
const tasks = Array.from(cleanupTasks);
|
|
37
|
+
cleanupTasks.clear();
|
|
38
|
+
|
|
39
|
+
await runBestEffortCleanups(
|
|
40
|
+
tasks.map((task) => ({
|
|
41
|
+
label: "registered cleanup",
|
|
42
|
+
task,
|
|
43
|
+
})),
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Comprehensive reset of ALL test state across the application.
|
|
49
|
+
*
|
|
50
|
+
* This function clears all known caches and singletons that can cause
|
|
51
|
+
* test isolation issues when running tests in parallel. It should be
|
|
52
|
+
* called at the start and end of each test to ensure clean state.
|
|
53
|
+
*
|
|
54
|
+
* Includes:
|
|
55
|
+
* - Config state (_environmentConfig, runtimeConfig, configCache)
|
|
56
|
+
* - Layout discovery cache
|
|
57
|
+
* - SSR module caches
|
|
58
|
+
* - React cache and compat hooks
|
|
59
|
+
* - Snippet cache
|
|
60
|
+
* - API handler state
|
|
61
|
+
* - Reload notifier
|
|
62
|
+
*/
|
|
63
|
+
export async function resetAllTestState(): Promise<void> {
|
|
64
|
+
await runRegisteredCleanups();
|
|
65
|
+
|
|
66
|
+
const cleanupSteps: LabeledCleanupTask[] = [
|
|
67
|
+
// Config state - CRITICAL for test isolation
|
|
68
|
+
{
|
|
69
|
+
label: "config cache cleanup",
|
|
70
|
+
task: async () => {
|
|
71
|
+
const { clearConfigCache } = await import("../config/loader.js");
|
|
72
|
+
clearConfigCache();
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
label: "environment config cleanup",
|
|
77
|
+
task: async () => {
|
|
78
|
+
const { _resetEnvironmentConfig } = await import("../config/environment-config.js");
|
|
79
|
+
_resetEnvironmentConfig();
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
label: "runtime config cleanup",
|
|
84
|
+
task: async () => {
|
|
85
|
+
const { _resetRuntimeConfig } = await import("../config/runtime-config.js");
|
|
86
|
+
_resetRuntimeConfig();
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
|
|
90
|
+
// Layout discovery cache - prevents stale layouts across tests
|
|
91
|
+
{
|
|
92
|
+
label: "layout discovery cleanup",
|
|
93
|
+
task: async () => {
|
|
94
|
+
const { clearLayoutDiscoveryCache } = await import(
|
|
95
|
+
"../rendering/layouts/utils/discovery.js"
|
|
96
|
+
);
|
|
97
|
+
clearLayoutDiscoveryCache();
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
|
|
101
|
+
// SSR module caches
|
|
102
|
+
{
|
|
103
|
+
label: "SSR module cache cleanup",
|
|
104
|
+
task: async () => {
|
|
105
|
+
const { clearSSRModuleCache } = await import("../modules/index.js");
|
|
106
|
+
clearSSRModuleCache();
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
|
|
110
|
+
// React cache and compat hooks
|
|
111
|
+
{
|
|
112
|
+
label: "React cache cleanup",
|
|
113
|
+
task: async () => {
|
|
114
|
+
const { resetReactCache } = await import("../react/compat/ssr-adapter/server-loader.js");
|
|
115
|
+
resetReactCache();
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
label: "compat hooks cleanup",
|
|
120
|
+
task: async () => {
|
|
121
|
+
const { resetCompatHooksContext } = await import("../react/compat/hooks-adapter.js");
|
|
122
|
+
resetCompatHooksContext();
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
|
|
126
|
+
// Snippet cache
|
|
127
|
+
{
|
|
128
|
+
label: "snippet cache cleanup",
|
|
129
|
+
task: async () => {
|
|
130
|
+
const { clearSnippetCache } = await import("../rendering/snippet-renderer.js");
|
|
131
|
+
clearSnippetCache();
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
|
|
135
|
+
// API handler state
|
|
136
|
+
{
|
|
137
|
+
label: "API handler cleanup",
|
|
138
|
+
task: async () => {
|
|
139
|
+
const { resetApiHandler } = await import("../server/handlers/request/api/index.js");
|
|
140
|
+
await resetApiHandler();
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
|
|
144
|
+
// Reload notifier
|
|
145
|
+
{
|
|
146
|
+
label: "reload notifier cleanup",
|
|
147
|
+
task: async () => {
|
|
148
|
+
const { ReloadNotifier } = await import("../server/reload-notifier.js");
|
|
149
|
+
ReloadNotifier.reset();
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
|
|
153
|
+
// HTTP module in-flight fetches - prevents test interference from shared promises
|
|
154
|
+
{
|
|
155
|
+
label: "HTTP in-flight fetch cleanup",
|
|
156
|
+
task: async () => {
|
|
157
|
+
const { __clearInFlightHttpFetches } = await import("../transforms/esm/http-cache.js");
|
|
158
|
+
__clearInFlightHttpFetches();
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
];
|
|
162
|
+
|
|
163
|
+
await runBestEffortCleanups(cleanupSteps);
|
|
164
|
+
|
|
165
|
+
// Bun-specific cleanup
|
|
166
|
+
if (isBun) {
|
|
167
|
+
await runBestEffortCleanups([
|
|
168
|
+
{
|
|
169
|
+
label: "bundler cleanup",
|
|
170
|
+
task: async () => {
|
|
171
|
+
const { cleanupBundler } = await import("../rendering/cleanup.js");
|
|
172
|
+
await cleanupBundler();
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
]);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as dntShim from "../../_dnt.shims.js";
|
|
2
|
+
import { getEnv } from "../platform/compat/process.js";
|
|
3
|
+
|
|
4
|
+
const DEFAULT_SCALE = 1;
|
|
5
|
+
|
|
6
|
+
function readScale(): number {
|
|
7
|
+
const raw = getEnv("VF_TEST_TIME_SCALE");
|
|
8
|
+
if (!raw) return DEFAULT_SCALE;
|
|
9
|
+
|
|
10
|
+
const parsed = Number(raw);
|
|
11
|
+
if (!Number.isFinite(parsed) || parsed <= 0) return DEFAULT_SCALE;
|
|
12
|
+
|
|
13
|
+
return parsed;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function getTestTimeScale(): number {
|
|
17
|
+
return readScale();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function scaleMs(ms: number, minMs = 1): number {
|
|
21
|
+
return Math.max(minMs, Math.round(ms * readScale()));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// no cleanup needed: one-shot
|
|
25
|
+
export function testDelay(ms: number): Promise<void> {
|
|
26
|
+
return new Promise((resolve) => dntShim.setTimeout(resolve, scaleMs(ms)));
|
|
27
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/***********************
|
|
2
|
+
* Shared utility functions for cross-runtime testing.
|
|
3
|
+
***********************/
|
|
4
|
+
|
|
5
|
+
export function deepEquals(a: unknown, b: unknown, seen: WeakSet<object> = new WeakSet()): boolean {
|
|
6
|
+
if (a === b) return true;
|
|
7
|
+
if (a === null || b === null) return a === b;
|
|
8
|
+
if (typeof a !== typeof b) return false;
|
|
9
|
+
if (typeof a !== "object") return a === b;
|
|
10
|
+
|
|
11
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
12
|
+
if (!Array.isArray(a) || !Array.isArray(b)) return false;
|
|
13
|
+
if (a.length !== b.length) return false;
|
|
14
|
+
return a.every((val, i) => deepEquals(val, b[i], seen));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const aObj = a as object;
|
|
18
|
+
const bObj = b as object;
|
|
19
|
+
|
|
20
|
+
if (seen.has(aObj)) return true;
|
|
21
|
+
seen.add(aObj);
|
|
22
|
+
|
|
23
|
+
const aKeys = Object.keys(aObj);
|
|
24
|
+
const bKeys = Object.keys(bObj);
|
|
25
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
26
|
+
|
|
27
|
+
const aRec = a as Record<string, unknown>;
|
|
28
|
+
const bRec = b as Record<string, unknown>;
|
|
29
|
+
|
|
30
|
+
return aKeys.every((key) => deepEquals(aRec[key], bRec[key], seen));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function safeStringify(value: unknown): string {
|
|
34
|
+
try {
|
|
35
|
+
return JSON.stringify(value);
|
|
36
|
+
} catch (_) {
|
|
37
|
+
/* expected: value may contain circular references or non-serializable types */
|
|
38
|
+
if (value === null) return "null";
|
|
39
|
+
if (value === undefined) return "undefined";
|
|
40
|
+
if (typeof value === "function") return "[Function]";
|
|
41
|
+
if (typeof value === "object") return `[${(value as object).constructor?.name ?? "Object"}]`;
|
|
42
|
+
return String(value);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type { GlobalWithBun, GlobalWithDeno, GlobalWithProcess } from "../utils/index.js";
|
|
2
|
+
export { hasBunRuntime, hasDenoRuntime, hasNodeProcess } from "../utils/index.js";
|
|
3
|
+
|
|
4
|
+
export interface GlobalWithReactDOM {
|
|
5
|
+
ReactDOM?: typeof import("../../deps/esm.sh/react-dom@19.2.4/client.js");
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface GlobalWithVeryFrontCache {
|
|
9
|
+
__VF_CACHE_NAMESPACE__?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function hasReactDOM(global: unknown): global is GlobalWithReactDOM {
|
|
13
|
+
if (typeof global !== "object" || global === null) return false;
|
|
14
|
+
return "ReactDOM" in global &&
|
|
15
|
+
typeof (global as Record<string, unknown>)["ReactDOM"] !== "undefined";
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function hasVeryFrontCache(global: unknown): global is GlobalWithVeryFrontCache {
|
|
19
|
+
if (typeof global !== "object" || global === null) return false;
|
|
20
|
+
return "__VF_CACHE_NAMESPACE__" in global;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as dntShim from "../../../../_dnt.shims.js";
|
|
2
|
+
import { getEnv } from "../../../platform/compat/process.js";
|
|
3
|
+
import { serverLogger } from "../../logger/logger.js";
|
|
4
|
+
import type { GlobalWithVeryFrontCache } from "../../../types/global-guards.js";
|
|
5
|
+
|
|
6
|
+
const logger = serverLogger.component("cache");
|
|
7
|
+
|
|
8
|
+
const globalCache = dntShim.dntGlobalThis as GlobalWithVeryFrontCache;
|
|
9
|
+
|
|
10
|
+
let cacheNamespace: string | undefined = globalCache.__VF_CACHE_NAMESPACE__ ??
|
|
11
|
+
getEnv("VF_CACHE_NAMESPACE");
|
|
12
|
+
|
|
13
|
+
export function setCacheNamespace(namespace?: string): void {
|
|
14
|
+
cacheNamespace = namespace ?? undefined;
|
|
15
|
+
|
|
16
|
+
try {
|
|
17
|
+
globalCache.__VF_CACHE_NAMESPACE__ = cacheNamespace;
|
|
18
|
+
} catch (e) {
|
|
19
|
+
logger.debug("setCacheNamespace failed", e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getCacheNamespace(): string | undefined {
|
|
24
|
+
return cacheNamespace;
|
|
25
|
+
}
|
package/src/src/utils/clsx.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Inline implementation of the `clsx` class-name joining utility.
|
|
3
3
|
*
|
|
4
4
|
* API-compatible with the MIT-licensed `clsx` npm package — this is a
|
|
5
|
-
* clean-room rewrite against the public API
|
|
6
|
-
*
|
|
5
|
+
* clean-room rewrite against the public API surface veryfront uses (named
|
|
6
|
+
* `clsx` export and `ClassValue` type); no source was copied.
|
|
7
7
|
*
|
|
8
8
|
* Replaces the `clsx` npm dep per spec §8.3 (inline micro-utilities in core).
|
|
9
9
|
*/
|
|
@@ -36,5 +36,3 @@ export function clsx(...args: Value[]): string {
|
|
|
36
36
|
}
|
|
37
37
|
return out.join(" ");
|
|
38
38
|
}
|
|
39
|
-
|
|
40
|
-
export default clsx;
|