@scriptc/compiler 0.1.7 → 0.2.1
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/ambient/scriptc-node-fallback.d.ts +98 -39
- package/ambient/scriptc-overrides.d.ts +10 -6
- package/ambient/scriptc.d.ts +15 -0
- package/dist/backend/build-cache.d.ts +1 -3
- package/dist/backend/build-cache.js +3 -22
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/cache-root.d.ts +3 -0
- package/dist/backend/cache-root.js +23 -0
- package/dist/backend/cache-root.js.map +1 -0
- package/dist/backend/cycle-analysis.d.ts +15 -0
- package/dist/backend/cycle-analysis.js +108 -0
- package/dist/backend/cycle-analysis.js.map +1 -0
- package/dist/backend/cycle-analysis.test.js +124 -0
- package/dist/backend/cycle-analysis.test.js.map +1 -0
- package/dist/backend/executable-features.d.ts +4 -0
- package/dist/backend/executable-features.js +42 -0
- package/dist/backend/executable-features.js.map +1 -0
- package/dist/backend/external-c.d.ts +5 -27
- package/dist/backend/external-c.js +5 -40
- package/dist/backend/external-c.js.map +1 -1
- package/dist/backend/ffi-callbacks.d.ts +2 -3
- package/dist/backend/ffi-callbacks.js +2 -3
- package/dist/backend/ffi-callbacks.js.map +1 -1
- package/dist/backend/library-identity-markers.d.ts +4 -9
- package/dist/backend/library-identity-markers.js +11 -49
- package/dist/backend/library-identity-markers.js.map +1 -1
- package/dist/backend/library-pack.d.ts +5 -0
- package/dist/backend/library-pack.js +123 -0
- package/dist/backend/library-pack.js.map +1 -0
- package/dist/backend/link-plan-core.d.ts +20 -0
- package/dist/backend/link-plan-core.js +18 -0
- package/dist/backend/link-plan-core.js.map +1 -0
- package/dist/backend/link-plan.d.ts +1 -1
- package/dist/backend/link-plan.js +16 -17
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/link-trace.d.ts +2 -0
- package/dist/backend/link-trace.js +24 -0
- package/dist/backend/link-trace.js.map +1 -0
- package/dist/backend/linker.js +1 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/literals.d.ts +9 -0
- package/dist/backend/literals.js +35 -0
- package/dist/backend/literals.js.map +1 -0
- package/dist/backend/literals.test.d.ts +1 -0
- package/dist/backend/literals.test.js +53 -0
- package/dist/backend/literals.test.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +2 -0
- package/dist/backend/llvm/blocks.js +9 -4
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/blocks.test.d.ts +1 -0
- package/dist/backend/llvm/blocks.test.js +91 -0
- package/dist/backend/llvm/blocks.test.js.map +1 -0
- package/dist/backend/llvm/classes.d.ts +14 -8
- package/dist/backend/llvm/classes.js +88 -30
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +5 -1
- package/dist/backend/llvm/common.js +45 -4
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/debug-info.js +2 -7
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/debug-info.test.d.ts +1 -0
- package/dist/backend/llvm/debug-info.test.js +110 -0
- package/dist/backend/llvm/debug-info.test.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +21 -2
- package/dist/backend/llvm/dyn.js +647 -251
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +596 -1
- package/dist/backend/llvm/emitter.js +769 -425
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.d.ts +1 -0
- package/dist/backend/llvm/emitter.test.js +179 -0
- package/dist/backend/llvm/emitter.test.js.map +1 -0
- package/dist/backend/llvm/expr-async.js +23 -14
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +2 -2
- package/dist/backend/llvm/expr-bytes.js +60 -31
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.d.ts +1 -1
- package/dist/backend/llvm/expr-callbacks.js +25 -22
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +136 -35
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +1 -1
- package/dist/backend/llvm/expr-containers.js +43 -14
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +5 -260
- package/dist/backend/llvm/expr-control.js +10 -6
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.d.ts +1 -1
- package/dist/backend/llvm/expr-dispatch.js +2 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +78 -81
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-island.d.ts +1 -1
- package/dist/backend/llvm/expr-island.js +11 -7
- package/dist/backend/llvm/expr-island.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +1 -1
- package/dist/backend/llvm/expr-primitives.js +62 -31
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +1 -1
- package/dist/backend/llvm/expr-records.d.ts +5 -1
- package/dist/backend/llvm/expr-records.js +54 -7
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +4 -4
- package/dist/backend/llvm/expr-stream-bridges.js +220 -131
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.d.ts +1 -0
- package/dist/backend/llvm/expr-stream-bridges.test.js +55 -0
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -0
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +12 -12
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/layouts.d.ts +19 -0
- package/dist/backend/llvm/layouts.js +12 -0
- package/dist/backend/llvm/layouts.js.map +1 -0
- package/dist/backend/llvm/lib-abi.d.ts +19 -0
- package/dist/backend/llvm/lib-abi.js +82 -0
- package/dist/backend/llvm/lib-abi.js.map +1 -0
- package/dist/backend/llvm/lib-connect.d.ts +2 -0
- package/dist/backend/llvm/lib-connect.js +51 -0
- package/dist/backend/llvm/lib-connect.js.map +1 -0
- package/dist/backend/llvm/lib-datagram.d.ts +2 -0
- package/dist/backend/llvm/lib-datagram.js +135 -0
- package/dist/backend/llvm/lib-datagram.js.map +1 -0
- package/dist/backend/llvm/lib-dispatch.js +50 -6
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +30 -18
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.d.ts +2 -0
- package/dist/backend/llvm/lib-http2.js +215 -0
- package/dist/backend/llvm/lib-http2.js.map +1 -0
- package/dist/backend/llvm/lib-lookup.d.ts +2 -0
- package/dist/backend/llvm/lib-lookup.js +39 -0
- package/dist/backend/llvm/lib-lookup.js.map +1 -0
- package/dist/backend/llvm/lib-network.js +25 -2
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +44 -19
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +162 -3
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +3 -2
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.d.ts +2 -0
- package/dist/backend/llvm/lib-test.js +34 -0
- package/dist/backend/llvm/lib-test.js.map +1 -0
- package/dist/backend/llvm/lib-tls.d.ts +2 -0
- package/dist/backend/llvm/lib-tls.js +82 -0
- package/dist/backend/llvm/lib-tls.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +10 -9
- package/dist/backend/llvm/shapes.js +42 -131
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/unsupported.d.ts +1 -0
- package/dist/backend/llvm/unsupported.js +1 -2
- package/dist/backend/llvm/unsupported.js.map +1 -1
- package/dist/backend/llvm/walkers.js +1 -7
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/mangle.d.ts +2 -2
- package/dist/backend/mangle.js +16 -5
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/{c/may-throw.d.ts → may-throw.d.ts} +1 -1
- package/dist/backend/{c/may-throw.js → may-throw.js} +51 -46
- package/dist/backend/may-throw.js.map +1 -0
- package/dist/backend/may-throw.test.d.ts +1 -0
- package/dist/backend/may-throw.test.js +58 -0
- package/dist/backend/may-throw.test.js.map +1 -0
- package/dist/backend/native-codegen-core.d.ts +22 -0
- package/dist/backend/native-codegen-core.js +44 -0
- package/dist/backend/native-codegen-core.js.map +1 -0
- package/dist/backend/native-codegen.d.ts +3 -19
- package/dist/backend/native-codegen.js +5 -44
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +2 -2
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +94 -0
- package/dist/backend/native-link-info-core.js +62 -0
- package/dist/backend/native-link-info-core.js.map +1 -0
- package/dist/backend/native-link-info.d.ts +3 -88
- package/dist/backend/native-link-info.js +12 -243
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-link-info.test.js +41 -146
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +12 -30
- package/dist/backend/native-toolchain.js +83 -233
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +77 -5
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/native-tools.d.ts +24 -0
- package/dist/backend/native-tools.js +33 -0
- package/dist/backend/native-tools.js.map +1 -0
- package/dist/backend/object-localize.js +19 -8
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +22 -0
- package/dist/backend/object-localize.test.js.map +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +101 -0
- package/dist/backend/runtime-pack-core.js +172 -0
- package/dist/backend/runtime-pack-core.js.map +1 -0
- package/dist/backend/runtime-pack-native.d.ts +21 -0
- package/dist/backend/runtime-pack-native.js +73 -0
- package/dist/backend/runtime-pack-native.js.map +1 -0
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack.d.ts +3 -83
- package/dist/backend/runtime-pack.js +8 -151
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +24 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.d.ts +22 -0
- package/dist/backend/target-diagnostics.js +108 -0
- package/dist/backend/target-diagnostics.js.map +1 -0
- package/dist/backend/target-platform.d.ts +15 -0
- package/dist/backend/target-platform.js +72 -0
- package/dist/backend/target-platform.js.map +1 -0
- package/dist/backend/targets.d.ts +13 -4
- package/dist/backend/targets.js +103 -34
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +72 -4
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/toolchain-environment.d.ts +6 -0
- package/dist/backend/toolchain-environment.js +99 -0
- package/dist/backend/toolchain-environment.js.map +1 -0
- package/dist/backend/vendor-archives.d.ts +1 -9
- package/dist/backend/vendor-archives.js +2 -9
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +9 -0
- package/dist/backend/vendor-inputs.js +10 -0
- package/dist/backend/vendor-inputs.js.map +1 -0
- package/dist/backend/warm-cache.d.ts +3 -0
- package/dist/backend/warm-cache.js +41 -0
- package/dist/backend/warm-cache.js.map +1 -0
- package/dist/cli/command.d.ts +3 -0
- package/dist/cli/command.js +328 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/host.d.ts +24 -0
- package/dist/cli/host.js +2 -0
- package/dist/cli/host.js.map +1 -0
- package/dist/cli/output-options.d.ts +26 -0
- package/dist/cli/output-options.js +60 -0
- package/dist/cli/output-options.js.map +1 -0
- package/dist/cli/paths.d.ts +12 -0
- package/dist/cli/paths.js +42 -0
- package/dist/cli/paths.js.map +1 -0
- package/dist/cli/usage.d.ts +74 -0
- package/dist/cli/usage.js +86 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/cli/wasi-paths.d.ts +8 -0
- package/dist/cli/wasi-paths.js +41 -0
- package/dist/cli/wasi-paths.js.map +1 -0
- package/dist/cli/wasi-runner.d.ts +2 -0
- package/dist/cli/wasi-runner.js +28 -0
- package/dist/cli/wasi-runner.js.map +1 -0
- package/dist/compat/fetch-profile.js +37 -7
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +162 -0
- package/dist/compile-types.js +2 -0
- package/dist/compile-types.js.map +1 -0
- package/dist/coverage/report.js +11 -5
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +5 -2
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +5 -10
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +3 -4
- package/dist/executable/executable-cache.js +5 -6
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +16 -17
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.d.ts +14 -0
- package/dist/executable/prepare.js +66 -0
- package/dist/executable/prepare.js.map +1 -0
- package/dist/ffi/ffi-manifest.d.ts +11 -4
- package/dist/ffi/ffi-manifest.js +170 -58
- package/dist/ffi/ffi-manifest.js.map +1 -1
- package/dist/ffi/ffi-manifest.test.d.ts +1 -0
- package/dist/ffi/ffi-manifest.test.js +111 -0
- package/dist/ffi/ffi-manifest.test.js.map +1 -0
- package/dist/format-integer.d.ts +3 -0
- package/dist/format-integer.js +14 -0
- package/dist/format-integer.js.map +1 -0
- package/dist/frontend/analysis.d.ts +5 -0
- package/dist/frontend/analysis.js +88 -0
- package/dist/frontend/analysis.js.map +1 -0
- package/dist/frontend/arguments-usage.d.ts +1 -3
- package/dist/frontend/arguments-usage.js.map +1 -1
- package/dist/frontend/builtin-modules.d.ts +1 -1
- package/dist/frontend/builtin-modules.js +1 -1
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/cjs-lexer.d.ts +4 -25
- package/dist/frontend/cjs-lexer.js +6 -806
- package/dist/frontend/cjs-lexer.js.map +1 -1
- package/dist/frontend/cjs-resolve.d.ts +5 -0
- package/dist/frontend/cjs-resolve.js +429 -0
- package/dist/frontend/cjs-resolve.js.map +1 -0
- package/dist/frontend/cjs-syntax.d.ts +26 -0
- package/dist/frontend/cjs-syntax.js +806 -0
- package/dist/frontend/cjs-syntax.js.map +1 -0
- package/dist/frontend/comptime-node.d.ts +4 -0
- package/dist/frontend/comptime-node.js +16 -0
- package/dist/frontend/comptime-node.js.map +1 -0
- package/dist/frontend/comptime-node.test.d.ts +1 -0
- package/dist/frontend/comptime-node.test.js +37 -0
- package/dist/frontend/comptime-node.test.js.map +1 -0
- package/dist/frontend/dts-paths.d.ts +3 -4
- package/dist/frontend/dts-paths.js +15 -8
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/fork-target.js +2 -2
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/helper-tokens.d.ts +1 -0
- package/dist/frontend/helper-tokens.js +147 -0
- package/dist/frontend/helper-tokens.js.map +1 -0
- package/dist/frontend/helper-tokens.test.d.ts +1 -0
- package/dist/frontend/helper-tokens.test.js +35 -0
- package/dist/frontend/helper-tokens.test.js.map +1 -0
- package/dist/frontend/inferred-js-diagnostics.d.ts +5 -0
- package/dist/frontend/inferred-js-diagnostics.js +69 -0
- package/dist/frontend/inferred-js-diagnostics.js.map +1 -0
- package/dist/frontend/inferred-js-diagnostics.test.d.ts +1 -0
- package/dist/frontend/inferred-js-diagnostics.test.js +58 -0
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -0
- package/dist/frontend/input-tracker.d.ts +5 -2
- package/dist/frontend/input-tracker.js +24 -3
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +23 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lib-contract.js +32 -24
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/literal-values.d.ts +4 -0
- package/dist/frontend/literal-values.js +21 -0
- package/dist/frontend/literal-values.js.map +1 -0
- package/dist/frontend/literal-values.test.d.ts +1 -0
- package/dist/frontend/literal-values.test.js +91 -0
- package/dist/frontend/literal-values.test.js.map +1 -0
- package/dist/frontend/lowering/abstract-equality.d.ts +1 -1
- package/dist/frontend/lowering/abstract-equality.js +3 -0
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.js +11 -6
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
- package/dist/frontend/lowering/array-values.d.ts +4 -1
- package/dist/frontend/lowering/array-values.js +43 -1
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/callback-arg.js +1 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -1
- package/dist/frontend/lowering/class-callbacks.d.ts +12 -0
- package/dist/frontend/lowering/class-callbacks.js +74 -0
- package/dist/frontend/lowering/class-callbacks.js.map +1 -0
- package/dist/frontend/lowering/class-construction.d.ts +12 -0
- package/dist/frontend/lowering/class-construction.js +156 -0
- package/dist/frontend/lowering/class-construction.js.map +1 -0
- package/dist/frontend/lowering/class-descriptors.d.ts +10 -0
- package/dist/frontend/lowering/class-descriptors.js +114 -0
- package/dist/frontend/lowering/class-descriptors.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +51 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +1158 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.d.ts +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +93 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -0
- package/dist/frontend/lowering/class-instance-constructor.d.ts +7 -0
- package/dist/frontend/lowering/class-instance-constructor.js +67 -0
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -0
- package/dist/frontend/lowering/class-method-values.d.ts +13 -0
- package/dist/frontend/lowering/class-method-values.js +235 -0
- package/dist/frontend/lowering/class-method-values.js.map +1 -0
- package/dist/frontend/lowering/class-prototypes.d.ts +19 -0
- package/dist/frontend/lowering/class-prototypes.js +242 -0
- package/dist/frontend/lowering/class-prototypes.js.map +1 -0
- package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
- package/dist/frontend/lowering/class-runtime-statics.js +66 -0
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -0
- package/dist/frontend/lowering/class-static-data.d.ts +6 -0
- package/dist/frontend/lowering/class-static-data.js +56 -0
- package/dist/frontend/lowering/class-static-data.js.map +1 -0
- package/dist/frontend/lowering/containers/buffer-numeric-methods.d.ts +4 -0
- package/dist/frontend/lowering/containers/buffer-numeric-methods.js +26 -0
- package/dist/frontend/lowering/containers/buffer-numeric-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/bytes.d.ts +11 -7
- package/dist/frontend/lowering/containers/bytes.js +208 -163
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +2 -2
- package/dist/frontend/lowering/containers/string-and-regexp.js +58 -63
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.d.ts +7 -0
- package/dist/frontend/lowering/containers/string-replacement.js +217 -0
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -0
- package/dist/frontend/lowering/error-methods.d.ts +14 -0
- package/dist/frontend/lowering/error-methods.js +177 -0
- package/dist/frontend/lowering/error-methods.js.map +1 -0
- package/dist/frontend/lowering/expressions/global-symbols.d.ts +6 -0
- package/dist/frontend/lowering/expressions/global-symbols.js +11 -0
- package/dist/frontend/lowering/expressions/global-symbols.js.map +1 -0
- package/dist/frontend/lowering/expressions/native-proxy.d.ts +7 -0
- package/dist/frontend/lowering/expressions/native-proxy.js +51 -0
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.d.ts +6 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js +132 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -0
- package/dist/frontend/lowering/expressions/object-literals.d.ts +8 -8
- package/dist/frontend/lowering/expressions/object-literals.js +509 -183
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +3 -4
- package/dist/frontend/lowering/expressions/optional-chains.js +88 -24
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/try-lower-expression.js +1 -0
- package/dist/frontend/lowering/expressions/try-lower-expression.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-field-write.d.ts +8 -0
- package/dist/frontend/lowering/expressions/union-field-write.js +71 -0
- package/dist/frontend/lowering/expressions/union-field-write.js.map +1 -0
- package/dist/frontend/lowering/function-context.d.ts +101 -0
- package/dist/frontend/lowering/function-context.js +109 -0
- package/dist/frontend/lowering/function-context.js.map +1 -0
- package/dist/frontend/lowering/generator-delegation.d.ts +7 -0
- package/dist/frontend/lowering/generator-delegation.js +85 -0
- package/dist/frontend/lowering/generator-delegation.js.map +1 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +11 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +143 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +4 -1
- package/dist/frontend/lowering/lib-boundary.js +112 -20
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.test.d.ts +1 -0
- package/dist/frontend/lowering/lib-boundary.test.js +45 -0
- package/dist/frontend/lowering/lib-boundary.test.js.map +1 -0
- package/dist/frontend/lowering/lower-array-sort.d.ts +1 -1
- package/dist/frontend/lowering/lower-assert.d.ts +1 -1
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +18 -0
- package/dist/frontend/lowering/lower-builtin-values.js +249 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +33 -46
- package/dist/frontend/lowering/lower-builtins.js +676 -365
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +28 -22
- package/dist/frontend/lowering/lower-calls.js +1660 -412
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +95 -57
- package/dist/frontend/lowering/lower-classes.js +1491 -404
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +1 -1
- package/dist/frontend/lowering/lower-comptime.js +23 -32
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +36 -32
- package/dist/frontend/lowering/lower-containers.js +925 -181
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.d.ts +1 -1
- package/dist/frontend/lowering/lower-dgram.js +3 -2
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.d.ts +1 -1
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +30 -1
- package/dist/frontend/lowering/lower-event-emitter.js +58 -26
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.d.ts +7 -1
- package/dist/frontend/lowering/lower-expando.js +14 -6
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +37 -13
- package/dist/frontend/lowering/lower-exprs.js +2163 -863
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +2 -5
- package/dist/frontend/lowering/lower-generators.js +88 -46
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.d.ts +7 -0
- package/dist/frontend/lowering/lower-global-value.js +17 -0
- package/dist/frontend/lowering/lower-global-value.js.map +1 -0
- package/dist/frontend/lowering/lower-inspect.d.ts +1 -1
- package/dist/frontend/lowering/lower-inspect.js +17 -8
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +7 -8
- package/dist/frontend/lowering/lower-island.js +66 -33
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.d.ts +2 -2
- package/dist/frontend/lowering/lower-mixins.js +5 -3
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +1 -1
- package/dist/frontend/lowering/lower-modules.js +445 -39
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.d.ts +1 -0
- package/dist/frontend/lowering/lower-modules.test.js +39 -0
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -0
- package/dist/frontend/lowering/lower-namespaces.d.ts +1 -1
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.d.ts +1 -1
- package/dist/frontend/lowering/lower-node-module.js +13 -10
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +1 -1
- package/dist/frontend/lowering/lower-server.js +6 -10
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +17 -17
- package/dist/frontend/lowering/lower-stmts.js +855 -514
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +1 -1
- package/dist/frontend/lowering/lower-stream.js +20 -11
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.d.ts +1 -1
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-url.d.ts +6 -0
- package/dist/frontend/lowering/lower-url.js +77 -0
- package/dist/frontend/lowering/lower-url.js.map +1 -0
- package/dist/frontend/lowering/lowerer.d.ts +140 -190
- package/dist/frontend/lowering/lowerer.js +1193 -712
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.d.ts +1 -0
- package/dist/frontend/lowering/lowerer.test.js +172 -0
- package/dist/frontend/lowering/lowerer.test.js.map +1 -0
- package/dist/frontend/lowering/native-ffi.d.ts +5 -0
- package/dist/frontend/lowering/native-ffi.js +40 -0
- package/dist/frontend/lowering/native-ffi.js.map +1 -0
- package/dist/frontend/lowering/object-enumeration-receiver.d.ts +7 -0
- package/dist/frontend/lowering/object-enumeration-receiver.js +33 -0
- package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -0
- package/dist/frontend/lowering/object-factory-new.d.ts +8 -0
- package/dist/frontend/lowering/object-factory-new.js +68 -0
- package/dist/frontend/lowering/object-factory-new.js.map +1 -0
- package/dist/frontend/lowering/optional-arguments.js +6 -1
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.js +2 -1
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-locals.d.ts +14 -0
- package/dist/frontend/lowering/runtime-optional-locals.js +41 -0
- package/dist/frontend/lowering/runtime-optional-locals.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-locals.test.d.ts +1 -0
- package/dist/frontend/lowering/runtime-optional-locals.test.js +85 -0
- package/dist/frontend/lowering/runtime-optional-locals.test.js.map +1 -0
- package/dist/frontend/lowering/sanitize-class-types.d.ts +8 -0
- package/dist/frontend/lowering/sanitize-class-types.js +79 -0
- package/dist/frontend/lowering/sanitize-class-types.js.map +1 -0
- package/dist/frontend/lowering/sanitize-class-types.test.d.ts +1 -0
- package/dist/frontend/lowering/sanitize-class-types.test.js +60 -0
- package/dist/frontend/lowering/sanitize-class-types.test.js.map +1 -0
- package/dist/frontend/lowering/static-this.d.ts +5 -1
- package/dist/frontend/lowering/static-this.js +28 -2
- package/dist/frontend/lowering/static-this.js.map +1 -1
- package/dist/frontend/lowering/string-index.d.ts +7 -0
- package/dist/frontend/lowering/string-index.js +39 -0
- package/dist/frontend/lowering/string-index.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +10 -3
- package/dist/frontend/lowering/surfaces.js +86 -37
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.d.ts +22 -0
- package/dist/frontend/lowering/symbol-fields.js +183 -0
- package/dist/frontend/lowering/symbol-fields.js.map +1 -0
- package/dist/frontend/lowering/symbol-methods.d.ts +7 -0
- package/dist/frontend/lowering/symbol-methods.js +30 -0
- package/dist/frontend/lowering/symbol-methods.js.map +1 -0
- package/dist/frontend/lowering/text-decoder-encoding.d.ts +12 -0
- package/dist/frontend/lowering/text-decoder-encoding.js +82 -0
- package/dist/frontend/lowering/text-decoder-encoding.js.map +1 -0
- package/dist/frontend/lowering/text-decoder-encoding.test.d.ts +1 -0
- package/dist/frontend/lowering/text-decoder-encoding.test.js +38 -0
- package/dist/frontend/lowering/text-decoder-encoding.test.js.map +1 -0
- package/dist/frontend/lowering/union-narrow.d.ts +9 -0
- package/dist/frontend/lowering/union-narrow.js +59 -0
- package/dist/frontend/lowering/union-narrow.js.map +1 -0
- package/dist/frontend/lowering/union-narrow.test.d.ts +1 -0
- package/dist/frontend/lowering/union-narrow.test.js +72 -0
- package/dist/frontend/lowering/union-narrow.test.js.map +1 -0
- package/dist/frontend/lowering/union-retag.d.ts +43 -0
- package/dist/frontend/lowering/union-retag.js +259 -0
- package/dist/frontend/lowering/union-retag.js.map +1 -0
- package/dist/frontend/lowering/union-retag.test.d.ts +1 -0
- package/dist/frontend/lowering/union-retag.test.js +405 -0
- package/dist/frontend/lowering/union-retag.test.js.map +1 -0
- package/dist/frontend/lowering/unregistered-class-types.d.ts +14 -0
- package/dist/frontend/lowering/unregistered-class-types.js +94 -0
- package/dist/frontend/lowering/unregistered-class-types.js.map +1 -0
- package/dist/frontend/lowering/unregistered-class-types.test.d.ts +1 -0
- package/dist/frontend/lowering/unregistered-class-types.test.js +65 -0
- package/dist/frontend/lowering/unregistered-class-types.test.js.map +1 -0
- package/dist/frontend/lowering/width-lift.d.ts +40 -0
- package/dist/frontend/lowering/width-lift.js +2 -0
- package/dist/frontend/lowering/width-lift.js.map +1 -0
- package/dist/frontend/module-syntax.d.ts +58 -0
- package/dist/frontend/module-syntax.js +123 -0
- package/dist/frontend/module-syntax.js.map +1 -0
- package/dist/frontend/module-syntax.test.d.ts +1 -0
- package/dist/frontend/module-syntax.test.js +78 -0
- package/dist/frontend/module-syntax.test.js.map +1 -0
- package/dist/frontend/npm-fetch-analysis.d.ts +17 -0
- package/dist/frontend/npm-fetch-analysis.js +100 -0
- package/dist/frontend/npm-fetch-analysis.js.map +1 -0
- package/dist/frontend/npm-fetch-analysis.test.d.ts +1 -0
- package/dist/frontend/npm-fetch-analysis.test.js +107 -0
- package/dist/frontend/npm-fetch-analysis.test.js.map +1 -0
- package/dist/frontend/npm-fetch-node.d.ts +2 -0
- package/dist/frontend/npm-fetch-node.js +12 -0
- package/dist/frontend/npm-fetch-node.js.map +1 -0
- package/dist/frontend/npm-fetch-syntax.d.ts +6 -0
- package/dist/frontend/npm-fetch-syntax.js +207 -0
- package/dist/frontend/npm-fetch-syntax.js.map +1 -0
- package/dist/frontend/npm-node.d.ts +10 -0
- package/dist/frontend/npm-node.js +14 -0
- package/dist/frontend/npm-node.js.map +1 -0
- package/dist/frontend/npm-static-bundled-cjs.d.ts +8 -0
- package/dist/frontend/npm-static-bundled-cjs.js +236 -0
- package/dist/frontend/npm-static-bundled-cjs.js.map +1 -0
- package/dist/frontend/npm-static-bundled-cjs.test.d.ts +1 -0
- package/dist/frontend/npm-static-bundled-cjs.test.js +69 -0
- package/dist/frontend/npm-static-bundled-cjs.test.js.map +1 -0
- package/dist/frontend/npm-static-declaration-syntax.d.ts +57 -0
- package/dist/frontend/npm-static-declaration-syntax.js +944 -0
- package/dist/frontend/npm-static-declaration-syntax.js.map +1 -0
- package/dist/frontend/npm-static-declarations.d.ts +11 -39
- package/dist/frontend/npm-static-declarations.js +22 -561
- package/dist/frontend/npm-static-declarations.js.map +1 -1
- package/dist/frontend/npm-static-declarations.test.js +245 -6
- package/dist/frontend/npm-static-declarations.test.js.map +1 -1
- package/dist/frontend/npm-static-prune.d.ts +1 -1
- package/dist/frontend/npm-static-prune.js +121 -38
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +9 -1
- package/dist/frontend/npm-static-prune.test.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-host.d.ts +4 -0
- package/dist/frontend/npm-static-rewrite-host.js +179 -0
- package/dist/frontend/npm-static-rewrite-host.js.map +1 -0
- package/dist/frontend/npm-static-rewrite-syntax.d.ts +16 -0
- package/dist/frontend/npm-static-rewrite-syntax.js +905 -0
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -0
- package/dist/frontend/npm-static-rewrite.d.ts +0 -5
- package/dist/frontend/npm-static-rewrite.js +2 -1079
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.d.ts +5 -0
- package/dist/frontend/npm-static-subtyping.js +55 -0
- package/dist/frontend/npm-static-subtyping.js.map +1 -0
- package/dist/frontend/npm-static-subtyping.test.d.ts +1 -0
- package/dist/frontend/npm-static-subtyping.test.js +58 -0
- package/dist/frontend/npm-static-subtyping.test.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +7 -15
- package/dist/frontend/npm-static.js +19 -28
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +8 -69
- package/dist/frontend/npm.js +21 -361
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +2 -2
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.d.ts +6 -0
- package/dist/frontend/pipeline-native.js +32 -0
- package/dist/frontend/pipeline-native.js.map +1 -0
- package/dist/frontend/pipeline.d.ts +54 -0
- package/dist/frontend/pipeline.js +382 -0
- package/dist/frontend/pipeline.js.map +1 -0
- package/dist/frontend/pipeline.test.d.ts +1 -0
- package/dist/frontend/pipeline.test.js +77 -0
- package/dist/frontend/pipeline.test.js.map +1 -0
- package/dist/frontend/program-analysis.d.ts +10 -0
- package/dist/frontend/program-analysis.js +14 -0
- package/dist/frontend/program-analysis.js.map +1 -0
- package/dist/frontend/program-node.d.ts +9 -0
- package/dist/frontend/program-node.js +48 -0
- package/dist/frontend/program-node.js.map +1 -0
- package/dist/frontend/program.d.ts +39 -20
- package/dist/frontend/program.js +393 -189
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +105 -2
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/provenance-core.d.ts +9 -0
- package/dist/frontend/provenance-core.js +435 -0
- package/dist/frontend/provenance-core.js.map +1 -0
- package/dist/frontend/provenance.d.ts +0 -4
- package/dist/frontend/provenance.js +4 -459
- package/dist/frontend/provenance.js.map +1 -1
- package/dist/frontend/resolve.d.ts +3 -1
- package/dist/frontend/resolve.js +6 -3
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.d.ts +4 -3
- package/dist/frontend/runtime-resolve.js +22 -18
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.test.js +53 -0
- package/dist/frontend/runtime-resolve.test.js.map +1 -1
- package/dist/frontend/services-node.d.ts +5 -0
- package/dist/frontend/services-node.js +19 -0
- package/dist/frontend/services-node.js.map +1 -0
- package/dist/frontend/services-node.test.d.ts +1 -0
- package/dist/frontend/services-node.test.js +70 -0
- package/dist/frontend/services-node.test.js.map +1 -0
- package/dist/frontend/services.d.ts +44 -0
- package/dist/frontend/services.js +90 -0
- package/dist/frontend/services.js.map +1 -0
- package/dist/frontend/services.test.d.ts +1 -0
- package/dist/frontend/services.test.js +174 -0
- package/dist/frontend/services.test.js.map +1 -0
- package/dist/frontend/ts7/adapter.d.ts +3 -3
- package/dist/frontend/ts7/adapter.js +14 -31
- package/dist/frontend/ts7/adapter.js.map +1 -1
- package/dist/frontend/ts7/api.d.ts +16 -0
- package/dist/frontend/ts7/api.js +24 -0
- package/dist/frontend/ts7/api.js.map +1 -0
- package/dist/frontend/ts7/ast-bytes.d.ts +31 -0
- package/dist/frontend/ts7/ast-bytes.js +137 -0
- package/dist/frontend/ts7/ast-bytes.js.map +1 -0
- package/dist/frontend/ts7/ast-bytes.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-bytes.test.js +73 -0
- package/dist/frontend/ts7/ast-bytes.test.js.map +1 -0
- package/dist/frontend/ts7/ast-guards.generated.d.ts +353 -0
- package/dist/frontend/ts7/ast-guards.generated.js +1951 -0
- package/dist/frontend/ts7/ast-guards.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-guards.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-guards.test.js +43 -0
- package/dist/frontend/ts7/ast-guards.test.js.map +1 -0
- package/dist/frontend/ts7/ast-node.d.ts +194 -0
- package/dist/frontend/ts7/ast-node.js +448 -0
- package/dist/frontend/ts7/ast-node.js.map +1 -0
- package/dist/frontend/ts7/ast-node.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-node.test.js +266 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -0
- package/dist/frontend/ts7/ast-schema.generated.d.ts +503 -0
- package/dist/frontend/ts7/ast-schema.generated.js +1446 -0
- package/dist/frontend/ts7/ast-schema.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-text.d.ts +6 -0
- package/dist/frontend/ts7/ast-text.js +124 -0
- package/dist/frontend/ts7/ast-text.js.map +1 -0
- package/dist/frontend/ts7/ast-text.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-text.test.js +38 -0
- package/dist/frontend/ts7/ast-text.test.js.map +1 -0
- package/dist/frontend/ts7/ast-tokens.generated.d.ts +2 -0
- package/dist/frontend/ts7/ast-tokens.generated.js +155 -0
- package/dist/frontend/ts7/ast-tokens.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-types.d.ts +42 -0
- package/dist/frontend/ts7/ast-types.generated.d.ts +1615 -0
- package/dist/frontend/ts7/ast-types.generated.js +5 -0
- package/dist/frontend/ts7/ast-types.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-types.js +3 -0
- package/dist/frontend/ts7/ast-types.js.map +1 -0
- package/dist/frontend/ts7/ast-wire.d.ts +58 -0
- package/dist/frontend/ts7/ast-wire.js +267 -0
- package/dist/frontend/ts7/ast-wire.js.map +1 -0
- package/dist/frontend/ts7/ast-wire.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-wire.test.js +151 -0
- package/dist/frontend/ts7/ast-wire.test.js.map +1 -0
- package/dist/frontend/ts7/ast.d.ts +14 -14
- package/dist/frontend/ts7/ast.js +25 -18
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/census-check.js +1 -0
- package/dist/frontend/ts7/census-check.js.map +1 -1
- package/dist/frontend/ts7/checker-cache.d.ts +48 -0
- package/dist/frontend/ts7/checker-cache.js +92 -0
- package/dist/frontend/ts7/checker-cache.js.map +1 -0
- package/dist/frontend/ts7/checker.d.ts +19 -46
- package/dist/frontend/ts7/checker.js +231 -161
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.d.ts +1 -0
- package/dist/frontend/ts7/checker.test.js +335 -0
- package/dist/frontend/ts7/checker.test.js.map +1 -0
- package/dist/frontend/ts7/enums.d.ts +4 -27
- package/dist/frontend/ts7/enums.generated.d.ts +878 -0
- package/dist/frontend/ts7/enums.generated.js +1313 -0
- package/dist/frontend/ts7/enums.generated.js.map +1 -0
- package/dist/frontend/ts7/enums.js +4 -45
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/enums.test.d.ts +1 -0
- package/dist/frontend/ts7/enums.test.js +48 -0
- package/dist/frontend/ts7/enums.test.js.map +1 -0
- package/dist/frontend/ts7/native-api.d.ts +10 -0
- package/dist/frontend/ts7/native-api.js +10 -0
- package/dist/frontend/ts7/native-api.js.map +1 -0
- package/dist/frontend/ts7/native-host.d.ts +2 -0
- package/dist/frontend/ts7/native-host.js +11 -0
- package/dist/frontend/ts7/native-host.js.map +1 -0
- package/dist/frontend/ts7/native-process.d.ts +14 -0
- package/dist/frontend/ts7/native-process.js +62 -0
- package/dist/frontend/ts7/native-process.js.map +1 -0
- package/dist/frontend/ts7/program-adapter.d.ts +10 -98
- package/dist/frontend/ts7/program-adapter.js +16 -310
- package/dist/frontend/ts7/program-adapter.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +115 -0
- package/dist/frontend/ts7/program-host.js +347 -0
- package/dist/frontend/ts7/program-host.js.map +1 -0
- package/dist/frontend/ts7/program-host.test.d.ts +1 -0
- package/dist/frontend/ts7/program-host.test.js +207 -0
- package/dist/frontend/ts7/program-host.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-api.d.ts +12 -0
- package/dist/frontend/ts7/rpc-api.js +23 -0
- package/dist/frontend/ts7/rpc-api.js.map +1 -0
- package/dist/frontend/ts7/rpc-client.d.ts +27 -0
- package/dist/frontend/ts7/rpc-client.js +102 -0
- package/dist/frontend/ts7/rpc-client.js.map +1 -0
- package/dist/frontend/ts7/rpc-client.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-client.test.js +133 -0
- package/dist/frontend/ts7/rpc-client.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-filesystem.d.ts +16 -0
- package/dist/frontend/ts7/rpc-filesystem.js +42 -0
- package/dist/frontend/ts7/rpc-filesystem.js.map +1 -0
- package/dist/frontend/ts7/rpc-filesystem.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-filesystem.test.js +89 -0
- package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-process.d.ts +2 -0
- package/dist/frontend/ts7/rpc-process.js +148 -0
- package/dist/frontend/ts7/rpc-process.js.map +1 -0
- package/dist/frontend/ts7/rpc-process.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-process.test.js +29 -0
- package/dist/frontend/ts7/rpc-process.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-wire.d.ts +46 -0
- package/dist/frontend/ts7/rpc-wire.js +195 -0
- package/dist/frontend/ts7/rpc-wire.js.map +1 -0
- package/dist/frontend/ts7/rpc-wire.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-wire.test.js +168 -0
- package/dist/frontend/ts7/rpc-wire.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-checker.d.ts +137 -0
- package/dist/frontend/ts7/semantic-checker.js +221 -0
- package/dist/frontend/ts7/semantic-checker.js.map +1 -0
- package/dist/frontend/ts7/semantic-checker.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-checker.test.js +119 -0
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-json.d.ts +5 -0
- package/dist/frontend/ts7/semantic-json.js +47 -0
- package/dist/frontend/ts7/semantic-json.js.map +1 -0
- package/dist/frontend/ts7/semantic-json.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-json.test.js +42 -0
- package/dist/frontend/ts7/semantic-json.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-model.d.ts +222 -0
- package/dist/frontend/ts7/semantic-model.js +423 -0
- package/dist/frontend/ts7/semantic-model.js.map +1 -0
- package/dist/frontend/ts7/semantic-model.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-model.test.js +322 -0
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-schema.generated.d.ts +283 -0
- package/dist/frontend/ts7/semantic-schema.generated.js +222 -0
- package/dist/frontend/ts7/semantic-schema.generated.js.map +1 -0
- package/dist/frontend/ts7/semantic-types.d.ts +5 -0
- package/dist/frontend/ts7/semantic-types.js +2 -0
- package/dist/frontend/ts7/semantic-types.js.map +1 -0
- package/dist/frontend/ts7/session-cache.d.ts +17 -0
- package/dist/frontend/ts7/session-cache.js +97 -0
- package/dist/frontend/ts7/session-cache.js.map +1 -0
- package/dist/frontend/ts7/session-cache.test.d.ts +1 -0
- package/dist/frontend/ts7/session-cache.test.js +87 -0
- package/dist/frontend/ts7/session-cache.test.js.map +1 -0
- package/dist/frontend/ts7/session-path.d.ts +18 -0
- package/dist/frontend/ts7/session-path.js +203 -0
- package/dist/frontend/ts7/session-path.js.map +1 -0
- package/dist/frontend/ts7/session-path.test.d.ts +1 -0
- package/dist/frontend/ts7/session-path.test.js +34 -0
- package/dist/frontend/ts7/session-path.test.js.map +1 -0
- package/dist/frontend/ts7/session-schema.generated.d.ts +167 -0
- package/dist/frontend/ts7/session-schema.generated.js +5 -0
- package/dist/frontend/ts7/session-schema.generated.js.map +1 -0
- package/dist/frontend/ts7/session-timing.d.ts +50 -0
- package/dist/frontend/ts7/session-timing.js +61 -0
- package/dist/frontend/ts7/session-timing.js.map +1 -0
- package/dist/frontend/ts7/session-timing.test.d.ts +1 -0
- package/dist/frontend/ts7/session-timing.test.js +52 -0
- package/dist/frontend/ts7/session-timing.test.js.map +1 -0
- package/dist/frontend/ts7/session.d.ts +105 -0
- package/dist/frontend/ts7/session.js +233 -0
- package/dist/frontend/ts7/session.js.map +1 -0
- package/dist/frontend/ts7/session.test.d.ts +1 -0
- package/dist/frontend/ts7/session.test.js +215 -0
- package/dist/frontend/ts7/session.test.js.map +1 -0
- package/dist/frontend/ts7/source-parser-node.d.ts +6 -0
- package/dist/frontend/ts7/source-parser-node.js +15 -0
- package/dist/frontend/ts7/source-parser-node.js.map +1 -0
- package/dist/frontend/ts7/source-parser.d.ts +25 -0
- package/dist/frontend/ts7/source-parser.js +96 -0
- package/dist/frontend/ts7/source-parser.js.map +1 -0
- package/dist/frontend/ts7/source-parser.test.d.ts +1 -0
- package/dist/frontend/ts7/source-parser.test.js +151 -0
- package/dist/frontend/ts7/source-parser.test.js.map +1 -0
- package/dist/frontend/ts7/syntax.d.ts +3 -0
- package/dist/frontend/ts7/syntax.js +4 -0
- package/dist/frontend/ts7/syntax.js.map +1 -0
- package/dist/frontend/tsc-codes.js +3 -0
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +34 -18
- package/dist/frontend/type-mapper.js +552 -131
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +146 -2
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend/union-discriminants.d.ts +16 -0
- package/dist/frontend/union-discriminants.js +98 -0
- package/dist/frontend/union-discriminants.js.map +1 -0
- package/dist/frontend/union-discriminants.test.d.ts +1 -0
- package/dist/frontend/union-discriminants.test.js +182 -0
- package/dist/frontend/union-discriminants.test.js.map +1 -0
- package/dist/index.d.ts +7 -198
- package/dist/index.js +369 -1572
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +16 -4
- package/dist/ir/analysis.js +23 -4
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +15 -2
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/constant-tables.js +67 -49
- package/dist/ir/constant-tables.js.map +1 -1
- package/dist/ir/constant-tables.test.js +1 -1
- package/dist/ir/control-flow.d.ts +6 -0
- package/dist/ir/control-flow.js +142 -0
- package/dist/ir/control-flow.js.map +1 -0
- package/dist/ir/control-flow.test.d.ts +1 -0
- package/dist/ir/control-flow.test.js +113 -0
- package/dist/ir/control-flow.test.js.map +1 -0
- package/dist/ir/integer-loops.js +7 -18
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-ranges.js +53 -27
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/ir.d.ts +334 -176
- package/dist/ir/ir.js +710 -903
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +162 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/scalar-records.js +165 -134
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/scalar-records.test.js +1 -1
- package/dist/ir/serialize.d.ts +4 -2
- package/dist/ir/serialize.js +33 -14
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.d.ts +1 -0
- package/dist/ir/serialize.test.js +57 -0
- package/dist/ir/serialize.test.js.map +1 -0
- package/dist/ir/traverse.d.ts +41 -0
- package/dist/ir/traverse.js +660 -0
- package/dist/ir/traverse.js.map +1 -0
- package/dist/ir/traverse.test.d.ts +1 -0
- package/dist/ir/traverse.test.js +242 -0
- package/dist/ir/traverse.test.js.map +1 -0
- package/dist/ir/validate.js +2018 -1498
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +536 -2
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/cache-primitives.d.ts +2 -3
- package/dist/library/cache-primitives.js +4 -6
- package/dist/library/cache-primitives.js.map +1 -1
- package/dist/library/fence-eval.js +2 -2
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/int-infer.js +7 -6
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/library-cache.d.ts +3 -2
- package/dist/library/library-cache.js +5 -17
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +54 -41
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/library/library-profile.d.ts +3 -1
- package/dist/library/library-profile.js +15 -6
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.d.ts +15 -0
- package/dist/library/prepare.js +584 -0
- package/dist/library/prepare.js.map +1 -0
- package/dist/library/semantic-source.d.ts +1 -1
- package/dist/library/semantic-source.js +8 -6
- package/dist/library/semantic-source.js.map +1 -1
- package/dist/library/sidecar-validate.js +4 -4
- package/dist/library/sidecar-validate.js.map +1 -1
- package/dist/library/sidecar.d.ts +2 -0
- package/dist/library/sidecar.js +10 -3
- package/dist/library/sidecar.js.map +1 -1
- package/dist/native/cache.d.ts +11 -0
- package/dist/native/cache.js +113 -0
- package/dist/native/cache.js.map +1 -0
- package/dist/native/cache.test.d.ts +1 -0
- package/dist/native/cache.test.js +66 -0
- package/dist/native/cache.test.js.map +1 -0
- package/dist/native/cli.d.ts +1 -0
- package/dist/native/cli.js +112 -0
- package/dist/native/cli.js.map +1 -0
- package/dist/native/compiler.d.ts +15 -0
- package/dist/native/compiler.js +336 -0
- package/dist/native/compiler.js.map +1 -0
- package/dist/native/compiler.test.d.ts +1 -0
- package/dist/native/compiler.test.js +174 -0
- package/dist/native/compiler.test.js.map +1 -0
- package/dist/native/comptime.d.ts +5 -0
- package/dist/native/comptime.js +73 -0
- package/dist/native/comptime.js.map +1 -0
- package/dist/native/comptime.test.d.ts +1 -0
- package/dist/native/comptime.test.js +65 -0
- package/dist/native/comptime.test.js.map +1 -0
- package/dist/native/executable-cache.d.ts +26 -0
- package/dist/native/executable-cache.js +228 -0
- package/dist/native/executable-cache.js.map +1 -0
- package/dist/native/executable-cache.test.d.ts +1 -0
- package/dist/native/executable-cache.test.js +151 -0
- package/dist/native/executable-cache.test.js.map +1 -0
- package/dist/native/file-identity.d.ts +4 -0
- package/dist/native/file-identity.js +14 -0
- package/dist/native/file-identity.js.map +1 -0
- package/dist/native/file-identity.test.d.ts +1 -0
- package/dist/native/file-identity.test.js +43 -0
- package/dist/native/file-identity.test.js.map +1 -0
- package/dist/native/library.d.ts +22 -0
- package/dist/native/library.js +83 -0
- package/dist/native/library.js.map +1 -0
- package/dist/native/prepare.d.ts +21 -0
- package/dist/native/prepare.js +174 -0
- package/dist/native/prepare.js.map +1 -0
- package/dist/native/prepare.test.d.ts +1 -0
- package/dist/native/prepare.test.js +70 -0
- package/dist/native/prepare.test.js.map +1 -0
- package/dist/native/sanitizer.d.ts +11 -0
- package/dist/native/sanitizer.js +137 -0
- package/dist/native/sanitizer.js.map +1 -0
- package/dist/native/sanitizer.test.d.ts +1 -0
- package/dist/native/sanitizer.test.js +58 -0
- package/dist/native/sanitizer.test.js.map +1 -0
- package/dist/native/task.d.ts +4 -0
- package/dist/native/task.js +16 -0
- package/dist/native/task.js.map +1 -0
- package/dist/native/task.test.d.ts +1 -0
- package/dist/native/task.test.js +17 -0
- package/dist/native/task.test.js.map +1 -0
- package/dist/native/toolchain.d.ts +45 -0
- package/dist/native/toolchain.js +94 -0
- package/dist/native/toolchain.js.map +1 -0
- package/dist/native/toolchain.test.d.ts +1 -0
- package/dist/native/toolchain.test.js +85 -0
- package/dist/native/toolchain.test.js.map +1 -0
- package/dist/startup-cache.d.ts +1 -1
- package/dist/startup-cache.js +2 -5
- package/dist/startup-cache.js.map +1 -1
- package/dist/timing.d.ts +4 -0
- package/dist/timing.js +19 -0
- package/dist/timing.js.map +1 -0
- package/dist/wasi-paths.js +10 -7
- package/dist/wasi-paths.js.map +1 -1
- package/package.json +28 -19
- package/surface-manifest.json +107 -98
- package/dist/backend/c/async.d.ts +0 -171
- package/dist/backend/c/async.js +0 -1317
- package/dist/backend/c/async.js.map +0 -1
- package/dist/backend/c/c-emitter.d.ts +0 -536
- package/dist/backend/c/c-emitter.js +0 -1932
- package/dist/backend/c/c-emitter.js.map +0 -1
- package/dist/backend/c/exprs.d.ts +0 -15
- package/dist/backend/c/exprs.js +0 -8847
- package/dist/backend/c/exprs.js.map +0 -1
- package/dist/backend/c/island.d.ts +0 -45
- package/dist/backend/c/island.js +0 -281
- package/dist/backend/c/island.js.map +0 -1
- package/dist/backend/c/may-throw.js.map +0 -1
- package/dist/backend/c/shapes.d.ts +0 -142
- package/dist/backend/c/shapes.js +0 -603
- package/dist/backend/c/shapes.js.map +0 -1
- package/dist/backend/c/stmts.d.ts +0 -76
- package/dist/backend/c/stmts.js +0 -1108
- package/dist/backend/c/stmts.js.map +0 -1
- package/dist/backend/c/types.d.ts +0 -71
- package/dist/backend/c/types.js +0 -459
- package/dist/backend/c/types.js.map +0 -1
- package/dist/backend/c/types.test.js +0 -32
- package/dist/backend/c/types.test.js.map +0 -1
- package/dist/backend/c/walkers.d.ts +0 -134
- package/dist/backend/c/walkers.js +0 -1772
- package/dist/backend/c/walkers.js.map +0 -1
- /package/dist/backend/{c/types.test.d.ts → cycle-analysis.test.d.ts} +0 -0
package/dist/ir/ir.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import { InternalCompilerError } from "../errors.js";
|
|
2
|
+
import { everyModuleNode, everyExprChild, everyStmtChild } from "./traverse.js";
|
|
3
|
+
export const BYTES_ELEMENT_SIZE = {
|
|
4
|
+
u8: 1, u8c: 1, i8: 1, u16: 2, i16: 2, u32: 4, i32: 4, f32: 4, f64: 8,
|
|
5
|
+
};
|
|
6
|
+
export const BYTES_ELEMENT_NAME = {
|
|
7
|
+
u8: "Uint8Array", u8c: "Uint8ClampedArray", i8: "Int8Array", u16: "Uint16Array", i16: "Int16Array",
|
|
8
|
+
u32: "Uint32Array", i32: "Int32Array", f32: "Float32Array", f64: "Float64Array",
|
|
9
|
+
};
|
|
2
10
|
const POINTER_HANDLE_KINDS = [
|
|
3
11
|
"stats",
|
|
4
12
|
"fileHandle",
|
|
@@ -30,7 +38,7 @@ const HANDLE_KIND_LIST = [
|
|
|
30
38
|
"procStream",
|
|
31
39
|
];
|
|
32
40
|
export const HANDLE_KINDS = irKindSet(HANDLE_KIND_LIST);
|
|
33
|
-
/** The IR kinds represented as pointers in
|
|
41
|
+
/** The IR kinds represented as pointers in native code. */
|
|
34
42
|
const POINTER_KIND_LIST = [
|
|
35
43
|
"string",
|
|
36
44
|
"bigint",
|
|
@@ -185,18 +193,23 @@ export const NULL_T = { kind: "nullT" };
|
|
|
185
193
|
export function isUnitType(t) {
|
|
186
194
|
return t.kind === "undefinedT" || t.kind === "nullT";
|
|
187
195
|
}
|
|
188
|
-
/** Element kinds with a real ScrArr storage/RC representation
|
|
189
|
-
*
|
|
196
|
+
/** Element kinds with a real ScrArr storage/RC representation.
|
|
197
|
+
* Array-producing lowerings can learn their result element from
|
|
190
198
|
* a callback rather than through mapType's ordinary T[] gate, so they must
|
|
191
199
|
* share this predicate instead of reconstructing an array around an
|
|
192
|
-
* otherwise-valid standalone type (
|
|
200
|
+
* otherwise-valid standalone type (Date, opaque handles, ...). */
|
|
193
201
|
export function isSupportedArrayElem(t) {
|
|
194
202
|
switch (t.kind) {
|
|
203
|
+
// Native collection seeds and drains retain checked values in a
|
|
204
|
+
// temporary vector. User-facing unknown[] still maps to a dyn array.
|
|
205
|
+
case "dyn":
|
|
195
206
|
case "f64":
|
|
196
207
|
case "bigint":
|
|
197
208
|
case "bool":
|
|
198
209
|
case "string":
|
|
199
210
|
case "array":
|
|
211
|
+
case "map":
|
|
212
|
+
case "set":
|
|
200
213
|
case "bytes":
|
|
201
214
|
case "record":
|
|
202
215
|
case "object":
|
|
@@ -227,35 +240,32 @@ export function mapOf(key, value) {
|
|
|
227
240
|
export function setOf(elem) {
|
|
228
241
|
return { kind: "set", elem };
|
|
229
242
|
}
|
|
230
|
-
/**
|
|
231
|
-
*
|
|
232
|
-
*
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
return isSupportedMapKey(t) || t.kind === "netServer" || t.kind === "symbol";
|
|
251
|
-
}
|
|
252
|
-
/** The Map VALUE fence: scalars plus every refcounted kind EXCEPT
|
|
253
|
-
* func/promise/dyn/jsval (and map itself — no maps of maps).
|
|
243
|
+
/** Values whose native reference represents JavaScript identity. Records,
|
|
244
|
+
* classes and arrays can point back at their collection, so constructors
|
|
245
|
+
* must carry key tracing as well as retain/release adapters. */
|
|
246
|
+
export function isIdentityCollectionKey(t) {
|
|
247
|
+
return t.kind === "record" || t.kind === "object" || t.kind === "array" ||
|
|
248
|
+
t.kind === "netServer" || t.kind === "symbol";
|
|
249
|
+
}
|
|
250
|
+
/** Numbers use SameValueZero, strings use content, and reference keys use
|
|
251
|
+
* identity. A union of identity arms hashes its payload, never its temporary
|
|
252
|
+
* wrapper. Mixed scalar/reference unions remain outside this contract. */
|
|
253
|
+
export function isSupportedMapKey(t, unionArms) {
|
|
254
|
+
return t.kind === "f64" || t.kind === "string" || t.kind === "dyn" || isIdentityCollectionKey(t) ||
|
|
255
|
+
(t.kind === "union" && unionArms !== undefined && unionArms.length > 0 && unionArms.every(isIdentityCollectionKey));
|
|
256
|
+
}
|
|
257
|
+
/** Set elements and Map keys share storage, equality and ownership rules. */
|
|
258
|
+
export function isSupportedSetElem(t, unionArms) {
|
|
259
|
+
return isSupportedMapKey(t, unionArms);
|
|
260
|
+
}
|
|
261
|
+
/** The Map VALUE fence: scalars, supported native references and checked
|
|
262
|
+
* values. Functions require checked-value boxing; jsval has no native slot.
|
|
254
263
|
* Record/object/union values can point back at the map holding them, which
|
|
255
264
|
* is exactly why ref-valued maps are cycle-capable (see the backend's
|
|
256
265
|
* cycle analysis and docs/memory.md). Shared frontend/validator. */
|
|
257
266
|
export function isSupportedMapValue(t) {
|
|
258
267
|
switch (t.kind) {
|
|
268
|
+
case "dyn":
|
|
259
269
|
case "f64":
|
|
260
270
|
case "bigint":
|
|
261
271
|
case "string":
|
|
@@ -264,6 +274,10 @@ export function isSupportedMapValue(t) {
|
|
|
264
274
|
case "object":
|
|
265
275
|
case "union":
|
|
266
276
|
case "array":
|
|
277
|
+
// Nested collections use the existing ref slot and scr_map adapters.
|
|
278
|
+
// Their key/value tracing participates in the cycle-analysis fixpoint.
|
|
279
|
+
case "map":
|
|
280
|
+
case "set":
|
|
267
281
|
return true;
|
|
268
282
|
// A spawned child handle (Map<string, ChildProcess> — the mdns
|
|
269
283
|
// publisher registry): an ordinary refcounted pointer value (the
|
|
@@ -305,37 +319,26 @@ export function isSupportedMapValue(t) {
|
|
|
305
319
|
/** The INDEX-SIGNATURE value fence (`{ [k: string]: V }` shapes): the map
|
|
306
320
|
* VALUE kinds — the overflow portion IS a string-keyed map — plus dyn
|
|
307
321
|
* (`unknown`, an unknown-valued pricing-table shape: overflow reads surface ordinary
|
|
308
|
-
* dyn values validated by the usual checked casts) and
|
|
309
|
-
* overflow store carries that user Maps don't admit yet:
|
|
322
|
+
* dyn values validated by the usual checked casts) and callable values:
|
|
310
323
|
* func — `Record<string, () => void>`, the command-registry pattern
|
|
311
324
|
* (scr_closure adapters; closures are cycle-headered and traced,
|
|
312
325
|
* so a handler capturing its own registry collects)
|
|
313
|
-
* map/set — `Record<string, Map<K, V>>`/`Record<string, Set<T>>`
|
|
314
|
-
* nested-container tables (scr_map adapters; a map value's own
|
|
315
|
-
* cycle capability propagates through the trace fixpoint)
|
|
316
326
|
* Nested index-signature RECORDS ride the record kind like any other.
|
|
317
327
|
* Shared frontend (mapType) / validator. */
|
|
318
328
|
export function isSupportedIndexValue(t) {
|
|
319
329
|
return (t.kind === "dyn" ||
|
|
320
330
|
t.kind === "func" ||
|
|
321
|
-
t.kind === "map" ||
|
|
322
|
-
t.kind === "set" ||
|
|
323
331
|
isSupportedMapValue(t));
|
|
324
332
|
}
|
|
325
333
|
export function funcOf(params, ret) {
|
|
326
334
|
return { kind: "func", params, ret };
|
|
327
335
|
}
|
|
328
|
-
/**
|
|
329
|
-
*
|
|
330
|
-
*
|
|
331
|
-
*
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
* NumberConstructor` field, and LinkOptions' `false | ((s: string) =>
|
|
335
|
-
* string)`). A SET arm keeps the unit-only rule (no narrowing test
|
|
336
|
-
* against data arms). */
|
|
337
|
-
export function unionFuncSetArmsOk(arms) {
|
|
338
|
-
return arms.every((a, i) => a.kind !== "set" || arms.every((b, j) => j === i || isUnitType(b)));
|
|
336
|
+
/** Maps, sets and promises may share a union with null/undefined only.
|
|
337
|
+
* Unit tag tests can narrow nullable containers without losing identity;
|
|
338
|
+
* arbitrary data siblings require a separate runtime narrowing operation.
|
|
339
|
+
* Share this rule across checker mapping, synthesized unions and validation. */
|
|
340
|
+
export function unionContainerArmsOk(arms) {
|
|
341
|
+
return arms.every((a, i) => (a.kind !== "map" && a.kind !== "set" && a.kind !== "promise") || arms.every((b, j) => j === i || isUnitType(b)));
|
|
339
342
|
}
|
|
340
343
|
/** Canonical, injective text form of an IrType — the building block of
|
|
341
344
|
* shape/union identity keys, generic-function instantiation keys, and the
|
|
@@ -397,47 +400,36 @@ export function typeKey(t) {
|
|
|
397
400
|
}
|
|
398
401
|
}
|
|
399
402
|
export function typeEquals(a, b) {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
return b.kind === "
|
|
404
|
-
|
|
405
|
-
return b.kind === "map" && typeEquals(a.key, b.key) && typeEquals(a.value, b.value);
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
return b.kind === "
|
|
420
|
-
|
|
421
|
-
return b.kind === "
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
if (a.kind === "union")
|
|
430
|
-
return b.kind === "union" && a.unionId === b.unionId;
|
|
431
|
-
if (a.kind === "promise")
|
|
432
|
-
return b.kind === "promise" && typeEquals(a.inner, b.inner);
|
|
433
|
-
if (a.kind === "generator") {
|
|
434
|
-
return (b.kind === "generator" &&
|
|
435
|
-
(a.async === true) === (b.async === true) &&
|
|
436
|
-
typeEquals(a.yieldT, b.yieldT) &&
|
|
437
|
-
typeEquals(a.retT, b.retT) &&
|
|
438
|
-
typeEquals(a.nextT, b.nextT));
|
|
403
|
+
// Dispatch once: a chain of negative narrowing checks repeatedly retags
|
|
404
|
+
// the remaining variants when this comparator runs in the native compiler.
|
|
405
|
+
switch (a.kind) {
|
|
406
|
+
case "array": return b.kind === "array" && typeEquals(a.elem, b.elem);
|
|
407
|
+
case "bytes": return b.kind === "bytes" && a.elem === b.elem;
|
|
408
|
+
case "map": return b.kind === "map" && typeEquals(a.key, b.key) && typeEquals(a.value, b.value);
|
|
409
|
+
case "set": return b.kind === "set" && typeEquals(a.elem, b.elem);
|
|
410
|
+
case "func":
|
|
411
|
+
return (b.kind === "func" &&
|
|
412
|
+
a.params.length === b.params.length &&
|
|
413
|
+
(a.rest === true) === (b.rest === true) &&
|
|
414
|
+
a.restAbi === b.restAbi &&
|
|
415
|
+
a.argumentsAll === b.argumentsAll &&
|
|
416
|
+
a.params.every((p, i) => typeEquals(p, b.params[i])) &&
|
|
417
|
+
typeEquals(a.ret, b.ret));
|
|
418
|
+
case "object": return b.kind === "object" && a.className === b.className;
|
|
419
|
+
case "classval": return b.kind === "classval" && a.className === b.className;
|
|
420
|
+
case "moduleNs": return b.kind === "moduleNs" && a.moduleId === b.moduleId;
|
|
421
|
+
// Shapes and unions are interned, so their ids determine equality.
|
|
422
|
+
case "record": return b.kind === "record" && a.shapeId === b.shapeId;
|
|
423
|
+
case "union": return b.kind === "union" && a.unionId === b.unionId;
|
|
424
|
+
case "promise": return b.kind === "promise" && typeEquals(a.inner, b.inner);
|
|
425
|
+
case "generator":
|
|
426
|
+
return (b.kind === "generator" &&
|
|
427
|
+
(a.async === true) === (b.async === true) &&
|
|
428
|
+
typeEquals(a.yieldT, b.yieldT) &&
|
|
429
|
+
typeEquals(a.retT, b.retT) &&
|
|
430
|
+
typeEquals(a.nextT, b.nextT));
|
|
431
|
+
default: return a.kind === b.kind;
|
|
439
432
|
}
|
|
440
|
-
return a.kind === b.kind;
|
|
441
433
|
}
|
|
442
434
|
/** True for types whose values are heap-allocated and reference-counted.
|
|
443
435
|
* The single dispatch point for the backend's RC machinery: retains,
|
|
@@ -459,12 +451,17 @@ export function isFfiContextParam(param) {
|
|
|
459
451
|
/** Script-side type represented by one scalar/span FFI class. */
|
|
460
452
|
export function ffiClassType(cls) {
|
|
461
453
|
switch (cls) {
|
|
454
|
+
case "i64":
|
|
455
|
+
case "u64":
|
|
456
|
+
case "pointer":
|
|
457
|
+
return BIGINT_T;
|
|
462
458
|
case "bool":
|
|
463
459
|
return BOOL;
|
|
464
460
|
case "cstring":
|
|
465
461
|
case "string":
|
|
466
462
|
return STRING;
|
|
467
463
|
case "bytes":
|
|
464
|
+
case "mutable-bytes":
|
|
468
465
|
return BYTES_U8;
|
|
469
466
|
case "void":
|
|
470
467
|
return VOID;
|
|
@@ -474,11 +471,14 @@ export function ffiClassType(cls) {
|
|
|
474
471
|
}
|
|
475
472
|
/** The ordinary TypeScript function type a native callback descriptor consumes. */
|
|
476
473
|
export function ffiCallbackType(callback) {
|
|
474
|
+
const params = [];
|
|
475
|
+
for (const param of callback.params) {
|
|
476
|
+
if (!isFfiContextParam(param))
|
|
477
|
+
params.push(ffiClassType(param));
|
|
478
|
+
}
|
|
477
479
|
return {
|
|
478
480
|
kind: "func",
|
|
479
|
-
params
|
|
480
|
-
.filter((param) => !isFfiContextParam(param))
|
|
481
|
-
.map(ffiClassType),
|
|
481
|
+
params,
|
|
482
482
|
ret: ffiClassType(callback.returns),
|
|
483
483
|
};
|
|
484
484
|
}
|
|
@@ -499,7 +499,7 @@ export function ffiSourceParamTypes(params) {
|
|
|
499
499
|
* `class Error` can never collide). `lib` is the standard-library name the
|
|
500
500
|
* frontend recognizes; `kind` is the runtime's SCR_ERR_* index (backends
|
|
501
501
|
* stamp scr_error_vts[kind] and pick constructor kinds by it). Every
|
|
502
|
-
* emitted module carries
|
|
502
|
+
* emitted module carries the builtin class defs (flagged `runtime`) so the
|
|
503
503
|
* program's preorder numbering always covers them — the runtime's own
|
|
504
504
|
* throws (JSON/dynCheck/regex) mint instances of these classes whether or
|
|
505
505
|
* not user code mentions Error. */
|
|
@@ -513,8 +513,11 @@ export const RUNTIME_ERROR_CLASSES = new Map([
|
|
|
513
513
|
// cause) lives in runtime-side slots BEYOND the ScrError prefix the IR
|
|
514
514
|
// fields describe, reached only through the error.dom* libCalls — so
|
|
515
515
|
// user `extends DOMException` is fenced (the subclass layout would
|
|
516
|
-
// overlap the hidden slots),
|
|
516
|
+
// overlap the hidden slots), while the standard Error classes extend freely.
|
|
517
517
|
["%DOMException", { lib: "DOMException", kind: 4, base: "%Error" }],
|
|
518
|
+
["%ReferenceError", { lib: "ReferenceError", kind: 5, base: "%Error" }],
|
|
519
|
+
["%EvalError", { lib: "EvalError", kind: 6, base: "%Error" }],
|
|
520
|
+
["%URIError", { lib: "URIError", kind: 7, base: "%Error" }],
|
|
518
521
|
]);
|
|
519
522
|
/** The runtime-provided node:events EventEmitter class (ScrEmitter /
|
|
520
523
|
* scr_emitter_*, scr_events_emitter.c — link-gated by moduleUsesEmitter,
|
|
@@ -548,6 +551,15 @@ export const RUNTIME_STREAM_CLASSES = new Map([
|
|
|
548
551
|
["%Transform", { lib: "Transform", base: "%Duplex", sides: "rw" }],
|
|
549
552
|
["%PassThrough", { lib: "PassThrough", base: "%Transform", sides: "rw" }],
|
|
550
553
|
]);
|
|
554
|
+
/** Codec records have private native state, not a structurally checkable
|
|
555
|
+
* data surface. Reserve the same '%' namespace as other internal slots. */
|
|
556
|
+
export function recordTextCodecClass(shape) {
|
|
557
|
+
if (shape.fields.some((f) => f.name === "%TextEncoder"))
|
|
558
|
+
return "TextEncoder";
|
|
559
|
+
if (shape.fields.some((f) => f.name === "%TextDecoder"))
|
|
560
|
+
return "TextDecoder";
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
551
563
|
/** Object-literal ACCESSOR properties (`{ get x() {...}, set x(v) {...} }`)
|
|
552
564
|
* live on the shape as reserved '%'-fields holding closures: `%get:x` a
|
|
553
565
|
* `() => T` invoked once per property READ (side effects and all — JS's
|
|
@@ -583,6 +595,7 @@ export const MAY_THROW_BYTES_METHODS = new Set([
|
|
|
583
595
|
"toStringVar",
|
|
584
596
|
"with",
|
|
585
597
|
"setFrom",
|
|
598
|
+
"setFromDyn",
|
|
586
599
|
"readNum",
|
|
587
600
|
"writeNum",
|
|
588
601
|
"readNumVar",
|
|
@@ -704,38 +717,53 @@ export function isJsonSafeType(t, getRecord, getUnion) {
|
|
|
704
717
|
export function isJsonStringifySafeType(t, getRecord, getUnion) {
|
|
705
718
|
return isJsonSafeAt(t, getRecord, getUnion, true, false, new Set());
|
|
706
719
|
}
|
|
720
|
+
/** A JSON-shaped container with unknown payloads needs the runtime JSON
|
|
721
|
+
* traversal. Its declared structure can be boxed, but payloads may carry
|
|
722
|
+
* omitted values, toJSON methods, or cycles. This predicate does not widen
|
|
723
|
+
* the type-directed serializer, checked-island boundary, or root-undefined
|
|
724
|
+
* contract; callers must select the checked runtime traversal explicitly. */
|
|
725
|
+
export function isJsonStringifyDynamicType(t, getRecord, getUnion) {
|
|
726
|
+
return (t.kind === "record" || t.kind === "array" || t.kind === "union") &&
|
|
727
|
+
isJsonSafeAt(t, getRecord, getUnion, true, false, new Set(), true) &&
|
|
728
|
+
!isJsonStringifySafeType(t, getRecord, getUnion);
|
|
729
|
+
}
|
|
707
730
|
/** The recursion shared by checked JSON conversion and stringification.
|
|
708
731
|
* Ordinary record fields always admit undefined by dropping the key. Array
|
|
709
|
-
* and tuple slots admit it only for stringification, which writes null.
|
|
710
|
-
|
|
732
|
+
* and tuple slots admit it only for stringification, which writes null.
|
|
733
|
+
* Direct loops avoid allocating captured callbacks at each recursive edge. */
|
|
734
|
+
function isJsonSafeAt(t, getRecord, getUnion, stringify, undefinedAllowed, visiting, nativeFields = false) {
|
|
711
735
|
if (HANDLE_KINDS.has(t.kind))
|
|
712
736
|
return false;
|
|
713
737
|
switch (t.kind) {
|
|
738
|
+
case "dyn":
|
|
739
|
+
return nativeFields;
|
|
714
740
|
case "f64":
|
|
715
741
|
case "string":
|
|
716
742
|
case "bool":
|
|
717
743
|
return true;
|
|
718
744
|
case "array":
|
|
719
|
-
return isJsonSafeAt(t.elem, getRecord, getUnion, stringify, stringify, visiting);
|
|
745
|
+
return isJsonSafeAt(t.elem, getRecord, getUnion, stringify, stringify, visiting, nativeFields);
|
|
720
746
|
case "record": {
|
|
721
747
|
const shape = getRecord(t.shapeId);
|
|
722
748
|
if (!shape)
|
|
723
749
|
return false;
|
|
750
|
+
if (recordTextCodecClass(shape) !== null)
|
|
751
|
+
return false;
|
|
724
752
|
// The recursive knot: answer true and let the rest of the graph
|
|
725
|
-
// decide (any unsafe constituent
|
|
726
|
-
// short-circuits every `every` up the walk).
|
|
753
|
+
// decide (any unsafe constituent ends the traversal immediately).
|
|
727
754
|
if (visiting.has(t.shapeId))
|
|
728
755
|
return true;
|
|
729
756
|
visiting.add(t.shapeId);
|
|
730
|
-
|
|
731
|
-
|
|
757
|
+
for (const field of shape.fields) {
|
|
758
|
+
if (!isJsonSafeAt(field.type, getRecord, getUnion, stringify, !shape.tuple || stringify, visiting, nativeFields))
|
|
759
|
+
return false;
|
|
732
760
|
}
|
|
733
761
|
// Overflow values sit in record-key position too: dyn is JSON-safe
|
|
734
762
|
// HERE (the checked-dynamic tree serializes itself; undefined-valued entries drop
|
|
735
763
|
// like any undefined-valued key), everything else follows the
|
|
736
764
|
// record-field rule.
|
|
737
765
|
if (shape.indexValue && shape.indexValue.kind !== "dyn") {
|
|
738
|
-
return isJsonSafeAt(shape.indexValue, getRecord, getUnion, stringify, true, visiting);
|
|
766
|
+
return isJsonSafeAt(shape.indexValue, getRecord, getUnion, stringify, true, visiting, nativeFields);
|
|
739
767
|
}
|
|
740
768
|
return true;
|
|
741
769
|
}
|
|
@@ -747,8 +775,20 @@ function isJsonSafeAt(t, getRecord, getUnion, stringify, undefinedAllowed, visit
|
|
|
747
775
|
if (visiting.has(key))
|
|
748
776
|
return true; // the recursive knot, union-flavored
|
|
749
777
|
visiting.add(key);
|
|
750
|
-
|
|
778
|
+
for (const arm of def.arms) {
|
|
779
|
+
if (!(arm.kind === "undefinedT" ? undefinedAllowed : isJsonSafeAt(arm, getRecord, getUnion, stringify, undefinedAllowed, visiting, nativeFields)))
|
|
780
|
+
return false;
|
|
781
|
+
}
|
|
782
|
+
return true;
|
|
751
783
|
}
|
|
784
|
+
case "set":
|
|
785
|
+
return nativeFields && !stringify && t.elem.kind === "dyn";
|
|
786
|
+
case "bigint":
|
|
787
|
+
case "regex":
|
|
788
|
+
case "url":
|
|
789
|
+
return nativeFields && !stringify;
|
|
790
|
+
case "bytes":
|
|
791
|
+
return nativeFields;
|
|
752
792
|
case "func":
|
|
753
793
|
case "object":
|
|
754
794
|
// Class values stringify as "{}" husks in Node (own enumerable statics
|
|
@@ -757,27 +797,13 @@ function isJsonSafeAt(t, getRecord, getUnion, stringify, undefinedAllowed, visit
|
|
|
757
797
|
// Maps are not JSON (JSON.stringify(new Map()) is "{}" in Node — an
|
|
758
798
|
// empty-object husk nobody wants; stringify/dynCheck reject instead).
|
|
759
799
|
case "map":
|
|
760
|
-
// Sets stringify as the same "{}" husk — rejected like Maps.
|
|
761
|
-
case "set":
|
|
762
|
-
// Regexes are not JSON (JSON.stringify(/a/) is "{}" in Node — the same
|
|
763
|
-
// empty-object husk as Maps; stringify/dynCheck reject instead).
|
|
764
|
-
case "regex":
|
|
765
800
|
case "date":
|
|
766
|
-
// URLs stringify as "{}" husks in Node too (data properties live on
|
|
767
|
-
// internal slots) — rejected the same way; use url.href instead.
|
|
768
|
-
case "url":
|
|
769
801
|
// URLSearchParams stringifies as the same "{}" husk — rejected; use
|
|
770
802
|
// sp.toString() instead.
|
|
771
803
|
case "searchParams":
|
|
772
804
|
// Symbols are DROPPED by Node's stringify (undefined at the top level,
|
|
773
805
|
// omitted as object values) — silent divergence banned; rejected.
|
|
774
806
|
case "symbol":
|
|
775
|
-
case "bigint":
|
|
776
|
-
// Typed arrays stringify as index-keyed objects ({"0":1,...}) and
|
|
777
|
-
// Buffers as {type:"Buffer",data:[...]} in Node — neither shape is
|
|
778
|
-
// representable type-directedly; rejected like Maps.
|
|
779
|
-
case "bytes":
|
|
780
|
-
case "dyn":
|
|
781
807
|
case "jsval":
|
|
782
808
|
case "caught":
|
|
783
809
|
case "promise":
|
|
@@ -830,7 +856,8 @@ export function canMarshalFuncIntoIsland(t) {
|
|
|
830
856
|
}
|
|
831
857
|
/** Parameter types a TYPED closure may declare when it crosses INTO the
|
|
832
858
|
* island as a host function: jsval params take the engine argument as a
|
|
833
|
-
* handle (the all-'any' shape above);
|
|
859
|
+
* handle (the all-'any' shape above); dyn params normalize scalars or retain
|
|
860
|
+
* engine objects by reference. Every other admitted type converts
|
|
834
861
|
* AT CALL TIME through the validated-exit machinery — strict primitives,
|
|
835
862
|
* JSON round-trip composites (the dynCheck walker: width-tolerant records,
|
|
836
863
|
* path-annotated failures). On top of the jsExit set, a bare `T | undefined`
|
|
@@ -839,7 +866,7 @@ export function canMarshalFuncIntoIsland(t) {
|
|
|
839
866
|
* commander case: `.action((text: string | undefined, opts) => ...)` sees
|
|
840
867
|
* undefined when the command argument is omitted). */
|
|
841
868
|
export function isIslandCallbackParamType(t, getRecord, getUnion) {
|
|
842
|
-
if (t.kind === "jsval")
|
|
869
|
+
if (t.kind === "jsval" || t.kind === "dyn")
|
|
843
870
|
return true;
|
|
844
871
|
if (isJsonSafeType(t, getRecord, getUnion))
|
|
845
872
|
return true;
|
|
@@ -884,8 +911,8 @@ export function islandCallbackRet(t, getRecord, getUnion) {
|
|
|
884
911
|
* closures whose params are per-argument-convertible at call time
|
|
885
912
|
* (isIslandCallbackParamType) and whose return classifies
|
|
886
913
|
* (islandCallbackRet). Same arity cap — the runtime's host-call argument
|
|
887
|
-
* buffer.
|
|
888
|
-
*
|
|
914
|
+
* buffer. Statically typed closure parameters stay fenced; unknown values
|
|
915
|
+
* enter as checked-dynamic values and are validated at each typed use. */
|
|
889
916
|
export function canMarshalTypedFuncIntoIsland(t, getRecord, getUnion) {
|
|
890
917
|
if (t.kind !== "func")
|
|
891
918
|
return false;
|
|
@@ -932,7 +959,7 @@ export function canMarshalTypedFuncIntoIsland(t, getRecord, getUnion) {
|
|
|
932
959
|
* through a dyn value), properties ON function values, and params/results
|
|
933
960
|
* outside the conversion domains (Maps, class instances, ...). Promises
|
|
934
961
|
* CONVERT in (canConvertToDyn's promise arm — an async dyn-boxed closure's
|
|
935
|
-
* return)
|
|
962
|
+
* return); checking OUT preserves the boxed Promise<unknown> payload ABI.
|
|
936
963
|
*/
|
|
937
964
|
/** The runtime HANDLE kinds that cross the checked-dynamic boundary as
|
|
938
965
|
* the checked-dynamic tree's HANDLE kind (SCR_DYN_HANDLE): boxed by REFERENCE (identity —
|
|
@@ -946,6 +973,7 @@ export function canMarshalTypedFuncIntoIsland(t, getRecord, getUnion) {
|
|
|
946
973
|
* (dynCheck's "expected IncomingMessage ..." texts). */
|
|
947
974
|
export const DYN_HANDLE_KINDS = new Map([
|
|
948
975
|
["child", { tag: "SCR_DYNH_CHILD", cls: "ChildProcess" }],
|
|
976
|
+
["fileHandle", { tag: "SCR_DYNH_FILE_HANDLE", cls: "FileHandle" }],
|
|
949
977
|
["httpReq", { tag: "SCR_DYNH_HTTP_REQ", cls: "IncomingMessage" }],
|
|
950
978
|
["httpRes", { tag: "SCR_DYNH_HTTP_RES", cls: "ServerResponse" }],
|
|
951
979
|
["netSocket", { tag: "SCR_DYNH_NET_SOCKET", cls: "Socket" }],
|
|
@@ -968,31 +996,51 @@ export function isDynTypedRefType(t) {
|
|
|
968
996
|
export function isClassOwnEnumerableFieldName(name) {
|
|
969
997
|
return !name.startsWith("#") && !name.startsWith("%");
|
|
970
998
|
}
|
|
999
|
+
/** Compiler-owned storage for properties added through untyped references. */
|
|
1000
|
+
export const DYN_CLASS_PROPERTIES = "%dynProperties";
|
|
1001
|
+
/** A class capsule can always preserve its exact native identity. Its
|
|
1002
|
+
* optional property view additionally needs converters in both directions;
|
|
1003
|
+
* fields such as Maps may remain opaque without preventing the round trip. */
|
|
1004
|
+
export function classDynViewSupported(fields, getRecord, getUnion) {
|
|
1005
|
+
const checkable = (type) => {
|
|
1006
|
+
if (isDynTypedRefType(type) || isUnitType(type))
|
|
1007
|
+
return true;
|
|
1008
|
+
if (type.kind === "union")
|
|
1009
|
+
return getUnion(type.unionId)?.arms.every(checkable) ?? false;
|
|
1010
|
+
return canDynCheckTo(type, getRecord, getUnion);
|
|
1011
|
+
};
|
|
1012
|
+
return fields.every((field) => !isClassOwnEnumerableFieldName(field.name) ||
|
|
1013
|
+
(canConvertToDyn(field.type, getRecord, getUnion) && checkable(field.type)));
|
|
1014
|
+
}
|
|
971
1015
|
/** A static type that CONVERTS into a dyn value — the dynFrom domain:
|
|
972
|
-
* JSON-safe data,
|
|
1016
|
+
* JSON-safe data, numeric typed arrays (retained views), identity-preserving class
|
|
973
1017
|
* references, undefined-armed unions of those arms, boxable function types,
|
|
974
1018
|
* and the runtime HANDLE kinds (boxed by reference — DYN_HANDLE_KINDS). */
|
|
975
|
-
export function canConvertToDyn(t, getRecord, getUnion) {
|
|
1019
|
+
export function canConvertToDyn(t, getRecord, getUnion, visiting = new Set()) {
|
|
976
1020
|
if (isJsonSafeType(t, getRecord, getUnion))
|
|
977
1021
|
return true;
|
|
978
|
-
//
|
|
979
|
-
// ANYWHERE (bytes
|
|
1022
|
+
// numeric typed arrays and boxable functions are dyn kinds the walker boxes
|
|
1023
|
+
// ANYWHERE (bytes and functions held by identity), including nested
|
|
980
1024
|
// in records/arrays/unions. isJsonSafeType rejects them, but dynFrom
|
|
981
1025
|
// needs only that the walker can build the dyn value, so this composite
|
|
982
1026
|
// fold extends the JSON-safe core.
|
|
983
|
-
if (canBoxDynComposite(t, getRecord, getUnion))
|
|
1027
|
+
if (canBoxDynComposite(t, getRecord, getUnion, visiting))
|
|
984
1028
|
return true;
|
|
985
|
-
if (t.kind === "bytes"
|
|
1029
|
+
if (t.kind === "bytes")
|
|
986
1030
|
return true;
|
|
987
|
-
//
|
|
1031
|
+
// Built-in errors convert as the checked-dynamic tree's error encoding ({%error, name, message,
|
|
988
1032
|
// code?} — the caughtToDyn shape, scr_dyn_from_error): the dyn 'error'
|
|
989
1033
|
// listener boundary (a mustCall-wrapped handler receiving the payload).
|
|
990
|
-
if (t.kind === "object" && t.className
|
|
1034
|
+
if (t.kind === "object" && RUNTIME_ERROR_CLASSES.has(t.className))
|
|
991
1035
|
return true;
|
|
992
1036
|
if (isDynTypedRefType(t))
|
|
993
1037
|
return true;
|
|
1038
|
+
if (t.kind === "generator")
|
|
1039
|
+
return true;
|
|
1040
|
+
if (t.kind === "classval")
|
|
1041
|
+
return true;
|
|
994
1042
|
if (t.kind === "func")
|
|
995
|
-
return canBoxFuncIntoDyn(t, getRecord, getUnion);
|
|
1043
|
+
return canBoxFuncIntoDyn(t, getRecord, getUnion, visiting);
|
|
996
1044
|
if (DYN_HANDLE_KINDS.has(t.kind))
|
|
997
1045
|
return true;
|
|
998
1046
|
// Promises box by REFERENCE (SCR_DYN_PROMISE): promise<dyn> carries its
|
|
@@ -1004,7 +1052,7 @@ export function canConvertToDyn(t, getRecord, getUnion) {
|
|
|
1004
1052
|
if (t.kind === "promise") {
|
|
1005
1053
|
return (t.inner.kind === "dyn" ||
|
|
1006
1054
|
t.inner.kind === "void" ||
|
|
1007
|
-
canConvertToDyn(t.inner, getRecord, getUnion));
|
|
1055
|
+
canConvertToDyn(t.inner, getRecord, getUnion, visiting));
|
|
1008
1056
|
}
|
|
1009
1057
|
if (t.kind === "union") {
|
|
1010
1058
|
const def = getUnion(t.unionId);
|
|
@@ -1013,44 +1061,77 @@ export function canConvertToDyn(t, getRecord, getUnion) {
|
|
|
1013
1061
|
// union's func arm crosses through the checked-dynamic function
|
|
1014
1062
|
// boundary exactly like a bare func dynFrom).
|
|
1015
1063
|
return !!def && def.arms.every((a) => a.kind === "undefinedT" || isJsonSafeType(a, getRecord, getUnion) ||
|
|
1016
|
-
isDynTypedRefType(a) || DYN_HANDLE_KINDS.has(a.kind) ||
|
|
1017
|
-
(a.kind === "func" && canBoxFuncIntoDyn(a, getRecord, getUnion)) ||
|
|
1018
|
-
(a.kind === "promise" && canConvertToDyn(a, getRecord, getUnion)));
|
|
1064
|
+
isDynTypedRefType(a) || a.kind === "classval" || DYN_HANDLE_KINDS.has(a.kind) ||
|
|
1065
|
+
(a.kind === "func" && canBoxFuncIntoDyn(a, getRecord, getUnion, visiting)) ||
|
|
1066
|
+
(a.kind === "promise" && canConvertToDyn(a, getRecord, getUnion, visiting)));
|
|
1019
1067
|
}
|
|
1020
1068
|
return false;
|
|
1021
1069
|
}
|
|
1022
1070
|
/** The composite extension of the dynFrom domain: JSON-safe scalars plus
|
|
1023
|
-
*
|
|
1071
|
+
* numeric typed arrays and boxable functions anywhere, recursing through records
|
|
1024
1072
|
* (fields + index value), arrays, and unit-armed unions — exactly the
|
|
1025
|
-
* sc_td_* walker's capability.
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1073
|
+
* sc_td_* walker's capability. Map and Set payloads must also support
|
|
1074
|
+
* checked extraction back into native storage. Other unsupported nested
|
|
1075
|
+
* kinds retain their conversion fence. */
|
|
1028
1076
|
function canBoxDynComposite(t, getRecord, getUnion, visiting = new Set()) {
|
|
1077
|
+
const key = `boxed:${typeKey(t)}`;
|
|
1078
|
+
if (visiting.has(key))
|
|
1079
|
+
return true;
|
|
1080
|
+
const result = canBoxDynCompositeAt(t, getRecord, getUnion, visiting);
|
|
1081
|
+
if (result)
|
|
1082
|
+
visiting.add(key);
|
|
1083
|
+
else
|
|
1084
|
+
clearDynConversionResults(visiting);
|
|
1085
|
+
return result;
|
|
1086
|
+
}
|
|
1087
|
+
function canBoxDynCompositeAt(t, getRecord, getUnion, visiting) {
|
|
1029
1088
|
switch (t.kind) {
|
|
1030
1089
|
case "f64":
|
|
1090
|
+
case "bigint":
|
|
1091
|
+
case "symbol":
|
|
1031
1092
|
case "string":
|
|
1032
1093
|
case "bool":
|
|
1033
1094
|
case "dyn":
|
|
1034
1095
|
case "undefinedT":
|
|
1035
1096
|
case "nullT":
|
|
1097
|
+
case "classval":
|
|
1036
1098
|
return true;
|
|
1037
1099
|
case "bytes":
|
|
1038
|
-
|
|
1100
|
+
case "regex":
|
|
1101
|
+
case "url":
|
|
1102
|
+
case "searchParams":
|
|
1103
|
+
return true;
|
|
1039
1104
|
case "func":
|
|
1040
|
-
return canBoxFuncIntoDyn(t, getRecord, getUnion);
|
|
1105
|
+
return canBoxFuncIntoDyn(t, getRecord, getUnion, visiting);
|
|
1106
|
+
case "set":
|
|
1107
|
+
return canConvertToDyn(t.elem, getRecord, getUnion, visiting) && canDynCheckTo(t.elem, getRecord, getUnion, visiting);
|
|
1108
|
+
case "map":
|
|
1109
|
+
return canConvertToDyn(t.key, getRecord, getUnion, visiting) && canDynCheckTo(t.key, getRecord, getUnion, visiting) &&
|
|
1110
|
+
canConvertToDyn(t.value, getRecord, getUnion, visiting) && canDynCheckTo(t.value, getRecord, getUnion, visiting);
|
|
1111
|
+
case "object":
|
|
1112
|
+
return RUNTIME_ERROR_CLASSES.has(t.className) || isDynTypedRefType(t);
|
|
1041
1113
|
case "array":
|
|
1042
1114
|
return canBoxDynComposite(t.elem, getRecord, getUnion, visiting);
|
|
1043
1115
|
case "record": {
|
|
1044
1116
|
const shape = getRecord(t.shapeId);
|
|
1045
1117
|
if (!shape)
|
|
1046
1118
|
return false;
|
|
1119
|
+
if (recordTextCodecClass(shape) !== null)
|
|
1120
|
+
return false;
|
|
1047
1121
|
// Recursive shapes answer coinductively, like isJsonSafeType.
|
|
1048
1122
|
if (visiting.has(t.shapeId))
|
|
1049
1123
|
return true;
|
|
1050
1124
|
visiting.add(t.shapeId);
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1125
|
+
try {
|
|
1126
|
+
for (const field of shape.fields) {
|
|
1127
|
+
if (!canBoxDynComposite(field.type, getRecord, getUnion, visiting))
|
|
1128
|
+
return false;
|
|
1129
|
+
}
|
|
1130
|
+
return !shape.indexValue || canBoxDynComposite(shape.indexValue, getRecord, getUnion, visiting);
|
|
1131
|
+
}
|
|
1132
|
+
finally {
|
|
1133
|
+
visiting.delete(t.shapeId);
|
|
1134
|
+
}
|
|
1054
1135
|
}
|
|
1055
1136
|
case "union": {
|
|
1056
1137
|
const def = getUnion(t.unionId);
|
|
@@ -1059,31 +1140,104 @@ function canBoxDynComposite(t, getRecord, getUnion, visiting = new Set()) {
|
|
|
1059
1140
|
if (visiting.has(t.unionId))
|
|
1060
1141
|
return true;
|
|
1061
1142
|
visiting.add(t.unionId);
|
|
1062
|
-
|
|
1143
|
+
try {
|
|
1144
|
+
for (const arm of def.arms) {
|
|
1145
|
+
if (!canBoxDynComposite(arm, getRecord, getUnion, visiting))
|
|
1146
|
+
return false;
|
|
1147
|
+
}
|
|
1148
|
+
return true;
|
|
1149
|
+
}
|
|
1150
|
+
finally {
|
|
1151
|
+
visiting.delete(t.unionId);
|
|
1152
|
+
}
|
|
1063
1153
|
}
|
|
1064
1154
|
default:
|
|
1065
1155
|
return false;
|
|
1066
1156
|
}
|
|
1067
1157
|
}
|
|
1068
1158
|
/** A type a dyn value can be VALIDATED into — the dynCheck domain:
|
|
1069
|
-
* JSON-safe data,
|
|
1159
|
+
* JSON-safe data, numeric typed arrays (retained views), the %Error extraction,
|
|
1070
1160
|
* undefined-armed unions of JSON-safe arms, adaptable function types,
|
|
1071
1161
|
* and the runtime HANDLE kinds (a tag-checked reference unwrap —
|
|
1072
1162
|
* DYN_HANDLE_KINDS). */
|
|
1073
|
-
export function canDynCheckTo(t, getRecord, getUnion) {
|
|
1074
|
-
|
|
1163
|
+
export function canDynCheckTo(t, getRecord, getUnion, visiting = new Set()) {
|
|
1164
|
+
const key = `checked:${typeKey(t)}`;
|
|
1165
|
+
if (visiting.has(key))
|
|
1075
1166
|
return true;
|
|
1076
|
-
|
|
1167
|
+
const result = canDynCheckToAt(t, getRecord, getUnion, visiting);
|
|
1168
|
+
if (result)
|
|
1169
|
+
visiting.add(key);
|
|
1170
|
+
else
|
|
1171
|
+
clearDynConversionResults(visiting);
|
|
1172
|
+
return result;
|
|
1173
|
+
}
|
|
1174
|
+
/** Reuse completed subgraphs within one conversion query. A failed branch
|
|
1175
|
+
* invalidates successes that may depend on a coinductive back-edge to it;
|
|
1176
|
+
* active recursion keys remain until their owning calls unwind. */
|
|
1177
|
+
function clearDynConversionResults(visiting) {
|
|
1178
|
+
for (const key of visiting) {
|
|
1179
|
+
if (key.startsWith("boxed:") || key.startsWith("checked:"))
|
|
1180
|
+
visiting.delete(key);
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
function canDynCheckToAt(t, getRecord, getUnion, visiting) {
|
|
1184
|
+
// Unknown fields keep an owned dyn subtree; checking the surrounding
|
|
1185
|
+
// record/array still validates its layout. This is broader than the
|
|
1186
|
+
// stringify/island JSON domain, which cannot assume opaque slots are
|
|
1187
|
+
// serializable. Backends already retain dyn fields and fill missing
|
|
1188
|
+
// unknown record fields with the undefined value.
|
|
1189
|
+
if (isJsonSafeAt(t, getRecord, getUnion, false, false, new Set(), true))
|
|
1190
|
+
return true;
|
|
1191
|
+
if (t.kind === "bigint" || t.kind === "symbol" || t.kind === "date" || t.kind === "searchParams")
|
|
1192
|
+
return true;
|
|
1193
|
+
if (t.kind === "map" || t.kind === "set")
|
|
1194
|
+
return canBoxDynComposite(t, getRecord, getUnion, visiting);
|
|
1195
|
+
if (t.kind === "bytes")
|
|
1196
|
+
return true;
|
|
1197
|
+
if (t.kind === "classval")
|
|
1198
|
+
return true;
|
|
1199
|
+
if (t.kind === "generator")
|
|
1077
1200
|
return true;
|
|
1201
|
+
if (t.kind === "promise")
|
|
1202
|
+
return t.inner.kind === "dyn" || t.inner.kind === "void" || canDynCheckToAt(t.inner, getRecord, getUnion, visiting);
|
|
1078
1203
|
if (t.kind === "object" && t.className === "%Error")
|
|
1079
1204
|
return true;
|
|
1205
|
+
// Native class capsules already support checked extraction at ordinary
|
|
1206
|
+
// boundaries. Callable adapters use the same identity/brand check.
|
|
1207
|
+
if (isDynTypedRefType(t))
|
|
1208
|
+
return true;
|
|
1209
|
+
if (t.kind === "array") {
|
|
1210
|
+
const key = typeKey(t);
|
|
1211
|
+
if (visiting.has(key))
|
|
1212
|
+
return false;
|
|
1213
|
+
visiting.add(key);
|
|
1214
|
+
const result = canDynCheckTo(t.elem, getRecord, getUnion, visiting);
|
|
1215
|
+
visiting.delete(key);
|
|
1216
|
+
return result;
|
|
1217
|
+
}
|
|
1218
|
+
if (t.kind === "record") {
|
|
1219
|
+
const key = typeKey(t);
|
|
1220
|
+
if (visiting.has(key))
|
|
1221
|
+
return false;
|
|
1222
|
+
const shape = getRecord(t.shapeId);
|
|
1223
|
+
if (!shape || shapeHasAccessorSlots(shape))
|
|
1224
|
+
return false;
|
|
1225
|
+
visiting.add(key);
|
|
1226
|
+
const result = shape.fields.every((field) => canDynCheckTo(field.type, getRecord, getUnion, visiting)) &&
|
|
1227
|
+
(!shape.indexValue || canDynCheckTo(shape.indexValue, getRecord, getUnion, visiting));
|
|
1228
|
+
visiting.delete(key);
|
|
1229
|
+
return result;
|
|
1230
|
+
}
|
|
1080
1231
|
if (t.kind === "func")
|
|
1081
|
-
return canAdaptDynFuncTo(t, getRecord, getUnion);
|
|
1232
|
+
return canAdaptDynFuncTo(t, getRecord, getUnion, visiting);
|
|
1082
1233
|
if (DYN_HANDLE_KINDS.has(t.kind))
|
|
1083
1234
|
return true;
|
|
1084
1235
|
if (t.kind === "union") {
|
|
1085
1236
|
const def = getUnion(t.unionId);
|
|
1086
|
-
|
|
1237
|
+
// Optional native callbacks and handles retain the same checked
|
|
1238
|
+
// conversion as their bare value. The union matcher selects the arm
|
|
1239
|
+
// before its adapter/extractor runs.
|
|
1240
|
+
return !!def && def.arms.every((a) => isUnitType(a) || (a.kind !== "union" && canDynCheckTo(a, getRecord, getUnion, visiting)));
|
|
1087
1241
|
}
|
|
1088
1242
|
return false;
|
|
1089
1243
|
}
|
|
@@ -1091,34 +1245,34 @@ export function canDynCheckTo(t, getRecord, getUnion) {
|
|
|
1091
1245
|
* every param dyn or dynCheckable (the thunk validates dyn arguments into
|
|
1092
1246
|
* them), return void, dyn, or dyn-convertible (the thunk converts it
|
|
1093
1247
|
* back). */
|
|
1094
|
-
export function canBoxFuncIntoDyn(t, getRecord, getUnion) {
|
|
1248
|
+
export function canBoxFuncIntoDyn(t, getRecord, getUnion, visiting = new Set()) {
|
|
1095
1249
|
return (t.kind === "func" &&
|
|
1096
|
-
//
|
|
1097
|
-
//
|
|
1098
|
-
//
|
|
1099
|
-
(t.rest !== true || t.restAbi === undefined
|
|
1250
|
+
// Typed rest occupies the final native array parameter; its thunk
|
|
1251
|
+
// checks a fresh array containing all remaining call arguments.
|
|
1252
|
+
// Island rest keeps its separate engine host-callback adapter.
|
|
1253
|
+
(t.rest !== true || t.restAbi === undefined ||
|
|
1254
|
+
(t.restAbi === "typed" && t.params.at(-1)?.kind === "array")) &&
|
|
1100
1255
|
// A jsval (island) param converts through scr_jsval_from_dyn in the
|
|
1101
1256
|
// thunk (wrapped cells unwrap by reference, dyn data deep-copies) —
|
|
1102
1257
|
// the checker-'any' callback params of the routed-dispatch lane
|
|
1103
1258
|
// (`bag.list.map((x) => ...)` with x typed any).
|
|
1104
|
-
t.params.every((p) => p.kind === "dyn" || p.kind === "jsval" || canDynCheckTo(p, getRecord, getUnion)) &&
|
|
1259
|
+
t.params.every((p) => p.kind === "dyn" || p.kind === "jsval" || canDynCheckTo(p, getRecord, getUnion, visiting)) &&
|
|
1105
1260
|
// A jsval return converts through the by-reference wrap
|
|
1106
1261
|
// (dynFromJsval — the thunk's result conversion), so engine-returning
|
|
1107
1262
|
// callbacks box too: the routed-dispatch lane's flatMap shape.
|
|
1108
|
-
(t.ret.kind === "void" || t.ret.kind === "dyn" || t.ret.kind === "jsval" || canConvertToDyn(t.ret, getRecord, getUnion)));
|
|
1263
|
+
(t.ret.kind === "void" || t.ret.kind === "dyn" || t.ret.kind === "jsval" || canConvertToDyn(t.ret, getRecord, getUnion, visiting)));
|
|
1109
1264
|
}
|
|
1110
1265
|
/** A closure type a dyn function value can ADAPT to (dynCheck): every
|
|
1111
1266
|
* param dyn or dyn-convertible (the adapter converts typed arguments into
|
|
1112
1267
|
* dyn), return void, dyn, or dynCheckable (the adapter validates the dyn
|
|
1113
1268
|
* result). */
|
|
1114
|
-
export function canAdaptDynFuncTo(t, getRecord, getUnion) {
|
|
1269
|
+
export function canAdaptDynFuncTo(t, getRecord, getUnion, visiting = new Set()) {
|
|
1115
1270
|
return (t.kind === "func" &&
|
|
1116
|
-
//
|
|
1117
|
-
//
|
|
1118
|
-
|
|
1119
|
-
t.
|
|
1120
|
-
t.
|
|
1121
|
-
(t.ret.kind === "void" || t.ret.kind === "dyn" || canDynCheckTo(t.ret, getRecord, getUnion)));
|
|
1271
|
+
// Checked rest and arguments packs retain all actual arguments. Typed
|
|
1272
|
+
// and island rest ABIs still require their own conversion plan.
|
|
1273
|
+
(t.rest !== true || t.restAbi === undefined) &&
|
|
1274
|
+
t.params.every((p) => p.kind === "dyn" || canConvertToDyn(p, getRecord, getUnion, visiting)) &&
|
|
1275
|
+
(t.ret.kind === "void" || t.ret.kind === "dyn" || canDynCheckTo(t.ret, getRecord, getUnion, visiting)));
|
|
1122
1276
|
}
|
|
1123
1277
|
/** The MARSHAL-direction boundary (jsMarshal): everything that can cross
|
|
1124
1278
|
* out and back (canCrossIslandBoundary) plus qualifying closures — those
|
|
@@ -1177,130 +1331,227 @@ export function canExitIslandToType(t, getRecord, getUnion) {
|
|
|
1177
1331
|
}
|
|
1178
1332
|
return false;
|
|
1179
1333
|
}
|
|
1334
|
+
const DYN_ASYNC_LIB_FNS = new Set([
|
|
1335
|
+
"fs.callbackValue", "fs.callbackCall",
|
|
1336
|
+
"async.awaitDyn", "timers.immediatePromise", "crypto.native",
|
|
1337
|
+
"process.onUncaughtException", "process.offUncaughtException",
|
|
1338
|
+
"process.onUnhandledRejection", "process.offUnhandledRejection",
|
|
1339
|
+
"process.onRejectionHandled", "process.offRejectionHandled",
|
|
1340
|
+
"process.onWarning", "process.offWarning", "process.emitWarning",
|
|
1341
|
+
"als.new", "als.get", "als.run", "als.exitRun", "als.enterWith", "als.disable",
|
|
1342
|
+
"dc.chanBindStore", "dc.chanUnbindStore", "dc.chanRunStores",
|
|
1343
|
+
]);
|
|
1344
|
+
/** Inspect types and expressions together in one traversal. This is a fresh
|
|
1345
|
+
* snapshot: callers may mutate an IR module between compilation passes. */
|
|
1346
|
+
export function moduleRuntimeFeatures(mod) {
|
|
1347
|
+
return scanRuntimeFeatures(mod);
|
|
1348
|
+
}
|
|
1349
|
+
function scanRuntimeFeatures(mod, stopAt) {
|
|
1350
|
+
const features = {
|
|
1351
|
+
regex: false, copying: false, legacyTextDecoder: false, fileHandle: false,
|
|
1352
|
+
fetch: mod.embedded?.modules.some((m) => m.usesFetch === true) ?? false,
|
|
1353
|
+
processEvents: false, emitter: (mod.classes ?? []).some((c) => c.name === RUNTIME_EMITTER_CLASS),
|
|
1354
|
+
stream: (mod.classes ?? []).some((c) => RUNTIME_STREAM_CLASSES.has(c.name)),
|
|
1355
|
+
zlib: mod.embedded?.edges.some((e) => e.to === "node:zlib") ?? false,
|
|
1356
|
+
dc: false, assert: false, dynInvoke: false,
|
|
1357
|
+
dynAsync: mod.functions.some((fn) => fn.async === true && fn.generator === undefined && fn.returnType.kind === "dyn"),
|
|
1358
|
+
inspect: false,
|
|
1359
|
+
childProcess: false, net: false, symbol: false, bigint: false, searchParams: false,
|
|
1360
|
+
qs: false, parseArgs: false, fsWatch: false, nodeTest: false, dgram: false,
|
|
1361
|
+
http: false, http2: false, tls: false, tlsCa: false,
|
|
1362
|
+
};
|
|
1363
|
+
const keepGoing = () => stopAt === undefined || !features[stopAt];
|
|
1364
|
+
const expr = (node) => {
|
|
1365
|
+
if (node.kind === "libCall") {
|
|
1366
|
+
const fn = node.fn;
|
|
1367
|
+
if (fn === "regexp.escape" || fn === "dyn.nativeRegexIs")
|
|
1368
|
+
features.regex = true;
|
|
1369
|
+
if (fn === "text.decodeLegacy" || fn === "text.decodeLegacyOptions" || fn === "text.decodeStream")
|
|
1370
|
+
features.legacyTextDecoder = true;
|
|
1371
|
+
if (fn.startsWith("fetch."))
|
|
1372
|
+
features.fetch = true;
|
|
1373
|
+
if (PROCESS_EVENT_LIB_FNS.has(fn))
|
|
1374
|
+
features.processEvents = true;
|
|
1375
|
+
if (fn.startsWith("emitter."))
|
|
1376
|
+
features.emitter = true;
|
|
1377
|
+
if (fn.startsWith("readable.") || fn.startsWith("writable.") || fn.startsWith("duplex.") ||
|
|
1378
|
+
fn.startsWith("transform.") || fn.startsWith("passthrough.") || fn.startsWith("sc.") ||
|
|
1379
|
+
fn.startsWith("stream.set") || fn === "stream.destroy" || fn === "stream.destroyErr" ||
|
|
1380
|
+
fn === "stream.prop" || fn === "stream.errored" || fn === "sp.finished" || fn === "sp.pipeline")
|
|
1381
|
+
features.stream = true;
|
|
1382
|
+
if (fn.startsWith("zlib."))
|
|
1383
|
+
features.zlib = true;
|
|
1384
|
+
if (fn.startsWith("dc."))
|
|
1385
|
+
features.dc = true;
|
|
1386
|
+
if (fn.startsWith("assert."))
|
|
1387
|
+
features.assert = true;
|
|
1388
|
+
if (fn === "dyn.defineProps" || fn === "dyn.defineProperty" || fn === "dyn.objCreateWithProperties" || fn === "dyn.arrayProtoCall" || fn === "dyn.arrayPrototype" || fn === "dyn.functionApply" || fn === "dyn.builtinMethod")
|
|
1389
|
+
features.dynInvoke = true;
|
|
1390
|
+
if (DYN_ASYNC_LIB_FNS.has(fn))
|
|
1391
|
+
features.dynAsync = true;
|
|
1392
|
+
if (fn.startsWith("insp.") || fn === "console.native" || fn === "global.native")
|
|
1393
|
+
features.inspect = true;
|
|
1394
|
+
if (fn.startsWith("cp.") || fn.startsWith("child.") || fn.startsWith("writer.") || fn.startsWith("spawnRes.") ||
|
|
1395
|
+
fn === "process.forkTarget" || fn === "process.connected" || fn === "process.send" || fn === "process.sendCb" ||
|
|
1396
|
+
fn === "process.disconnect" || fn === "process.onMessage" || fn === "process.onDisconnect")
|
|
1397
|
+
features.childProcess = true;
|
|
1398
|
+
if (fn.startsWith("net."))
|
|
1399
|
+
features.net = true;
|
|
1400
|
+
if (fn.startsWith("http.")) {
|
|
1401
|
+
features.net = true;
|
|
1402
|
+
features.http = true;
|
|
1403
|
+
}
|
|
1404
|
+
if (fn.startsWith("tls.") || fn.startsWith("https.") || fn.startsWith("http2.")) {
|
|
1405
|
+
features.net = true;
|
|
1406
|
+
features.http = true;
|
|
1407
|
+
features.tls = true;
|
|
1408
|
+
}
|
|
1409
|
+
if (fn.startsWith("http2.") && !HTTP2_LEGACY_FNS.has(fn))
|
|
1410
|
+
features.http2 = true;
|
|
1411
|
+
if (fn.startsWith("sym."))
|
|
1412
|
+
features.symbol = true;
|
|
1413
|
+
if (fn === "process.hrtimeValue")
|
|
1414
|
+
features.bigint = true;
|
|
1415
|
+
if (fn.startsWith("bigint."))
|
|
1416
|
+
features.bigint = true;
|
|
1417
|
+
if (fn.startsWith("sp.") || fn === "url.searchParams")
|
|
1418
|
+
features.searchParams = true;
|
|
1419
|
+
if (fn === "qs.parse" || fn === "qs.stringify" || fn === "qs.unescape")
|
|
1420
|
+
features.qs = true;
|
|
1421
|
+
if (fn === "util.parseArgs")
|
|
1422
|
+
features.parseArgs = true;
|
|
1423
|
+
if (fn.startsWith("fs.watch") || fn.startsWith("watcher."))
|
|
1424
|
+
features.fsWatch = true;
|
|
1425
|
+
if (fn.startsWith("test."))
|
|
1426
|
+
features.nodeTest = true;
|
|
1427
|
+
if (fn.startsWith("dgram.") || fn.startsWith("dns."))
|
|
1428
|
+
features.dgram = true;
|
|
1429
|
+
if (fn.startsWith("tlsca."))
|
|
1430
|
+
features.tlsCa = true;
|
|
1431
|
+
}
|
|
1432
|
+
else {
|
|
1433
|
+
switch (node.kind) {
|
|
1434
|
+
case "regexLit":
|
|
1435
|
+
case "regexIntrinsic":
|
|
1436
|
+
features.regex = true;
|
|
1437
|
+
break;
|
|
1438
|
+
case "strIntrinsic":
|
|
1439
|
+
if (node.method === "toLowerCase" || node.method === "toUpperCase")
|
|
1440
|
+
features.regex = true;
|
|
1441
|
+
break;
|
|
1442
|
+
case "arrIntrinsic":
|
|
1443
|
+
if (node.method === "toReversed" || node.method === "toSpliced" || node.method === "with" || node.method === "withUndefined")
|
|
1444
|
+
features.copying = true;
|
|
1445
|
+
break;
|
|
1446
|
+
case "bytesIntrinsic":
|
|
1447
|
+
if (node.method === "toReversed" || node.method === "with" || node.method === "join" || node.method === "toArray")
|
|
1448
|
+
features.copying = true;
|
|
1449
|
+
break;
|
|
1450
|
+
case "jsOp":
|
|
1451
|
+
if (node.op === "globalGet" && node.name === "fetch")
|
|
1452
|
+
features.fetch = true;
|
|
1453
|
+
break;
|
|
1454
|
+
case "dynInvoke":
|
|
1455
|
+
features.dynInvoke = true;
|
|
1456
|
+
break;
|
|
1457
|
+
case "awaitExpr":
|
|
1458
|
+
if (node.type.kind === "dyn")
|
|
1459
|
+
features.dynAsync = true;
|
|
1460
|
+
break;
|
|
1461
|
+
case "dynFrom": {
|
|
1462
|
+
const boxed = node.value.type;
|
|
1463
|
+
if (boxed.kind === "promise" || (boxed.kind === "func" && boxed.ret.kind === "promise"))
|
|
1464
|
+
features.dynAsync = true;
|
|
1465
|
+
break;
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
return keepGoing();
|
|
1470
|
+
};
|
|
1471
|
+
const type = (node) => {
|
|
1472
|
+
switch (node.kind) {
|
|
1473
|
+
case "regex":
|
|
1474
|
+
features.regex = true;
|
|
1475
|
+
break;
|
|
1476
|
+
case "fileHandle":
|
|
1477
|
+
features.fileHandle = true;
|
|
1478
|
+
break;
|
|
1479
|
+
case "child":
|
|
1480
|
+
case "childStream":
|
|
1481
|
+
case "childWriter":
|
|
1482
|
+
case "spawnRes":
|
|
1483
|
+
features.childProcess = true;
|
|
1484
|
+
break;
|
|
1485
|
+
case "netServer":
|
|
1486
|
+
case "netSocket":
|
|
1487
|
+
features.net = true;
|
|
1488
|
+
break;
|
|
1489
|
+
case "http2Session":
|
|
1490
|
+
case "http2Stream":
|
|
1491
|
+
features.net = true;
|
|
1492
|
+
features.http2 = true;
|
|
1493
|
+
break;
|
|
1494
|
+
case "httpReq":
|
|
1495
|
+
case "httpRes":
|
|
1496
|
+
case "httpClientReq":
|
|
1497
|
+
features.net = true;
|
|
1498
|
+
features.http = true;
|
|
1499
|
+
break;
|
|
1500
|
+
case "secureCtx":
|
|
1501
|
+
features.net = true;
|
|
1502
|
+
features.http = true;
|
|
1503
|
+
features.tls = true;
|
|
1504
|
+
break;
|
|
1505
|
+
case "symbol":
|
|
1506
|
+
features.symbol = true;
|
|
1507
|
+
break;
|
|
1508
|
+
case "bigint":
|
|
1509
|
+
features.bigint = true;
|
|
1510
|
+
break;
|
|
1511
|
+
case "searchParams":
|
|
1512
|
+
features.searchParams = true;
|
|
1513
|
+
break;
|
|
1514
|
+
case "fsWatcher":
|
|
1515
|
+
features.fsWatch = true;
|
|
1516
|
+
break;
|
|
1517
|
+
case "testCtx":
|
|
1518
|
+
features.nodeTest = true;
|
|
1519
|
+
break;
|
|
1520
|
+
case "dgramSocket":
|
|
1521
|
+
features.dgram = true;
|
|
1522
|
+
break;
|
|
1523
|
+
}
|
|
1524
|
+
return keepGoing();
|
|
1525
|
+
};
|
|
1526
|
+
if (keepGoing())
|
|
1527
|
+
everyModuleNode(mod, { expr, stmt: keepGoing, type });
|
|
1528
|
+
return features;
|
|
1529
|
+
}
|
|
1180
1530
|
/** True when the module contains any regex construct — a regexLit /
|
|
1181
1531
|
* regexIntrinsic node or a regex-typed slot anywhere. This is the link
|
|
1182
1532
|
* switch that pulls scr_regex.c + the vendored libregexp into the binary
|
|
1183
|
-
* (native-toolchain.ts); regex-free programs keep the historical command line.
|
|
1184
|
-
*
|
|
1185
|
-
* VALUES can never false-positive. */
|
|
1533
|
+
* (native-toolchain.ts); regex-free programs keep the historical command line. The
|
|
1534
|
+
* typed traversal visits type slots as well as executable nodes. */
|
|
1186
1535
|
export function moduleUsesRegex(mod) {
|
|
1187
|
-
|
|
1188
|
-
const visit = (v) => {
|
|
1189
|
-
if (found || v === null || typeof v !== "object")
|
|
1190
|
-
return;
|
|
1191
|
-
if (Array.isArray(v)) {
|
|
1192
|
-
for (const item of v)
|
|
1193
|
-
visit(item);
|
|
1194
|
-
return;
|
|
1195
|
-
}
|
|
1196
|
-
const kind = v.kind;
|
|
1197
|
-
if (kind === "regex" || kind === "regexLit" || kind === "regexIntrinsic") {
|
|
1198
|
-
found = true;
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
// The lre-backed case conversions live in scr_regex.c (libunicode's
|
|
1202
|
-
// case tables): they ride the same link switch as regex nodes.
|
|
1203
|
-
if (kind === "strIntrinsic") {
|
|
1204
|
-
const method = v.method;
|
|
1205
|
-
if (method === "toLowerCase" || method === "toUpperCase") {
|
|
1206
|
-
found = true;
|
|
1207
|
-
return;
|
|
1208
|
-
}
|
|
1209
|
-
}
|
|
1210
|
-
// RegExp.escape lives in scr_regex.c too (needing no engine — it
|
|
1211
|
-
// keeps the always-linked string TU out of hello-world's size class).
|
|
1212
|
-
if (kind === "libCall" && v.fn === "regexp.escape") {
|
|
1213
|
-
found = true;
|
|
1214
|
-
return;
|
|
1215
|
-
}
|
|
1216
|
-
for (const key of Object.keys(v))
|
|
1217
|
-
visit(v[key]);
|
|
1218
|
-
};
|
|
1219
|
-
visit(mod);
|
|
1220
|
-
return found;
|
|
1536
|
+
return scanRuntimeFeatures(mod, "regex").regex;
|
|
1221
1537
|
}
|
|
1222
1538
|
/** True when the module contains an intrinsic whose implementation lives
|
|
1223
1539
|
* in scr_copying.c. This is the link switch that keeps the optional
|
|
1224
1540
|
* Array-copying and typed-array bridge TU out of unrelated binaries. */
|
|
1225
1541
|
export function moduleUsesCopying(mod) {
|
|
1226
|
-
|
|
1227
|
-
const visit = (v) => {
|
|
1228
|
-
if (found || v === null || typeof v !== "object")
|
|
1229
|
-
return;
|
|
1230
|
-
if (Array.isArray(v)) {
|
|
1231
|
-
for (const item of v)
|
|
1232
|
-
visit(item);
|
|
1233
|
-
return;
|
|
1234
|
-
}
|
|
1235
|
-
const node = v;
|
|
1236
|
-
if (node.kind === "arrIntrinsic" &&
|
|
1237
|
-
(node.method === "toReversed" ||
|
|
1238
|
-
node.method === "toSpliced" ||
|
|
1239
|
-
node.method === "with" ||
|
|
1240
|
-
node.method === "withUndefined")) {
|
|
1241
|
-
found = true;
|
|
1242
|
-
return;
|
|
1243
|
-
}
|
|
1244
|
-
if (node.kind === "bytesIntrinsic" &&
|
|
1245
|
-
(node.method === "toReversed" ||
|
|
1246
|
-
node.method === "with" ||
|
|
1247
|
-
node.method === "join" ||
|
|
1248
|
-
node.method === "toArray")) {
|
|
1249
|
-
found = true;
|
|
1250
|
-
return;
|
|
1251
|
-
}
|
|
1252
|
-
for (const key of Object.keys(v))
|
|
1253
|
-
visit(v[key]);
|
|
1254
|
-
};
|
|
1255
|
-
visit(mod);
|
|
1256
|
-
return found;
|
|
1542
|
+
return scanRuntimeFeatures(mod, "copying").copying;
|
|
1257
1543
|
}
|
|
1258
1544
|
/** True when a non-UTF-8 TextDecoder call survives lowering. This gates the
|
|
1259
1545
|
* generated legacy mapping tables inside scr_bytes.c; the default UTF-8
|
|
1260
1546
|
* decoder and unrelated Buffer users keep their prior runtime object. */
|
|
1261
1547
|
export function moduleUsesLegacyTextDecoder(mod) {
|
|
1262
|
-
|
|
1263
|
-
const visit = (value) => {
|
|
1264
|
-
if (found || value === null || typeof value !== "object")
|
|
1265
|
-
return;
|
|
1266
|
-
if (Array.isArray(value)) {
|
|
1267
|
-
for (const item of value)
|
|
1268
|
-
visit(item);
|
|
1269
|
-
return;
|
|
1270
|
-
}
|
|
1271
|
-
const node = value;
|
|
1272
|
-
if (node.kind === "libCall" && node.fn === "text.decodeLegacy") {
|
|
1273
|
-
found = true;
|
|
1274
|
-
return;
|
|
1275
|
-
}
|
|
1276
|
-
for (const key of Object.keys(value))
|
|
1277
|
-
visit(value[key]);
|
|
1278
|
-
};
|
|
1279
|
-
visit(mod);
|
|
1280
|
-
return found;
|
|
1548
|
+
return scanRuntimeFeatures(mod, "legacyTextDecoder").legacyTextDecoder;
|
|
1281
1549
|
}
|
|
1282
1550
|
/** True when a FileHandle type survives in the module. This is the link
|
|
1283
1551
|
* switch for scr_file_handle.c; fs/promises.open carries the type inside its
|
|
1284
1552
|
* promise result even when no handle method is called. */
|
|
1285
1553
|
export function moduleUsesFileHandle(mod) {
|
|
1286
|
-
|
|
1287
|
-
const visit = (v) => {
|
|
1288
|
-
if (found || v === null || typeof v !== "object")
|
|
1289
|
-
return;
|
|
1290
|
-
if (Array.isArray(v)) {
|
|
1291
|
-
for (const item of v)
|
|
1292
|
-
visit(item);
|
|
1293
|
-
return;
|
|
1294
|
-
}
|
|
1295
|
-
if (v.kind === "fileHandle") {
|
|
1296
|
-
found = true;
|
|
1297
|
-
return;
|
|
1298
|
-
}
|
|
1299
|
-
for (const key of Object.keys(v))
|
|
1300
|
-
visit(v[key]);
|
|
1301
|
-
};
|
|
1302
|
-
visit(mod);
|
|
1303
|
-
return found;
|
|
1554
|
+
return scanRuntimeFeatures(mod, "fileHandle").fileHandle;
|
|
1304
1555
|
}
|
|
1305
1556
|
/** True when user code lowers static fetch or the embedded npm graph
|
|
1306
1557
|
* reaches the engine's global fetch — the link switch that pulls scr_fetch.c +
|
|
@@ -1310,35 +1561,12 @@ export function moduleUsesFileHandle(mod) {
|
|
|
1310
1561
|
* and local `fetch` bindings do not change the link or target capability.
|
|
1311
1562
|
* Fetch-free graphs keep their exact historical link lines. */
|
|
1312
1563
|
export function moduleUsesFetch(mod) {
|
|
1313
|
-
|
|
1314
|
-
if (embedded && embedded.modules.some((m) => m.usesFetch === true))
|
|
1315
|
-
return true;
|
|
1316
|
-
// User-code fetch is either the engine global or the static libCall pair.
|
|
1317
|
-
let found = false;
|
|
1318
|
-
const visit = (v) => {
|
|
1319
|
-
if (found || v === null || typeof v !== "object")
|
|
1320
|
-
return;
|
|
1321
|
-
if (Array.isArray(v)) {
|
|
1322
|
-
for (const item of v)
|
|
1323
|
-
visit(item);
|
|
1324
|
-
return;
|
|
1325
|
-
}
|
|
1326
|
-
const node = v;
|
|
1327
|
-
if ((node.kind === "jsOp" && node.op === "globalGet" && node.name === "fetch") ||
|
|
1328
|
-
(node.kind === "libCall" &&
|
|
1329
|
-
typeof node.fn === "string" && node.fn.startsWith("fetch."))) {
|
|
1330
|
-
found = true;
|
|
1331
|
-
return;
|
|
1332
|
-
}
|
|
1333
|
-
for (const key of Object.keys(v))
|
|
1334
|
-
visit(v[key]);
|
|
1335
|
-
};
|
|
1336
|
-
visit(mod);
|
|
1337
|
-
return found;
|
|
1564
|
+
return scanRuntimeFeatures(mod, "fetch").fetch;
|
|
1338
1565
|
}
|
|
1339
1566
|
/** The libCall fns served by the OPTIONAL events unit (scr_events.c):
|
|
1340
1567
|
* process signal/exit listeners and the piped-stdin surface. */
|
|
1341
1568
|
const PROCESS_EVENT_LIB_FNS = new Set([
|
|
1569
|
+
"process.stdio",
|
|
1342
1570
|
"process.onSignal",
|
|
1343
1571
|
"process.offSignal",
|
|
1344
1572
|
"process.onExit",
|
|
@@ -1360,25 +1588,7 @@ const PROCESS_EVENT_LIB_FNS = new Set([
|
|
|
1360
1588
|
* gating precedent). Event-free programs pay zero bytes and keep their
|
|
1361
1589
|
* exact link line. Same generic-walk shape as moduleUsesRegex. */
|
|
1362
1590
|
export function moduleUsesProcessEvents(mod) {
|
|
1363
|
-
|
|
1364
|
-
const visit = (v) => {
|
|
1365
|
-
if (found || v === null || typeof v !== "object")
|
|
1366
|
-
return;
|
|
1367
|
-
if (Array.isArray(v)) {
|
|
1368
|
-
for (const item of v)
|
|
1369
|
-
visit(item);
|
|
1370
|
-
return;
|
|
1371
|
-
}
|
|
1372
|
-
const node = v;
|
|
1373
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && PROCESS_EVENT_LIB_FNS.has(node.fn)) {
|
|
1374
|
-
found = true;
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
for (const key of Object.keys(v))
|
|
1378
|
-
visit(v[key]);
|
|
1379
|
-
};
|
|
1380
|
-
visit(mod);
|
|
1381
|
-
return found;
|
|
1591
|
+
return scanRuntimeFeatures(mod, "processEvents").processEvents;
|
|
1382
1592
|
}
|
|
1383
1593
|
/** True when the module uses the node:events EventEmitter surface — the
|
|
1384
1594
|
* link switch that pulls scr_events_emitter.c into the binary (native-toolchain.ts; the
|
|
@@ -1390,27 +1600,7 @@ export function moduleUsesProcessEvents(mod) {
|
|
|
1390
1600
|
* no emitter-typed value). Emitter-free programs pay zero bytes and keep
|
|
1391
1601
|
* their exact link line. */
|
|
1392
1602
|
export function moduleUsesEmitter(mod) {
|
|
1393
|
-
|
|
1394
|
-
return true;
|
|
1395
|
-
let found = false;
|
|
1396
|
-
const visit = (v) => {
|
|
1397
|
-
if (found || v === null || typeof v !== "object")
|
|
1398
|
-
return;
|
|
1399
|
-
if (Array.isArray(v)) {
|
|
1400
|
-
for (const item of v)
|
|
1401
|
-
visit(item);
|
|
1402
|
-
return;
|
|
1403
|
-
}
|
|
1404
|
-
const node = v;
|
|
1405
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("emitter.")) {
|
|
1406
|
-
found = true;
|
|
1407
|
-
return;
|
|
1408
|
-
}
|
|
1409
|
-
for (const key of Object.keys(v))
|
|
1410
|
-
visit(v[key]);
|
|
1411
|
-
};
|
|
1412
|
-
visit(mod);
|
|
1413
|
-
return found;
|
|
1603
|
+
return scanRuntimeFeatures(mod, "emitter").emitter;
|
|
1414
1604
|
}
|
|
1415
1605
|
/** True when the program touches the node:stream surface (scr_stream.c —
|
|
1416
1606
|
* the moduleUsesEmitter story: the class defs ride the module whenever a
|
|
@@ -1420,36 +1610,7 @@ export function moduleUsesEmitter(mod) {
|
|
|
1420
1610
|
* moduleUsesEmitter answers true whenever this does. Stream-free
|
|
1421
1611
|
* programs pay zero bytes and keep their exact link line. */
|
|
1422
1612
|
export function moduleUsesStream(mod) {
|
|
1423
|
-
|
|
1424
|
-
return true;
|
|
1425
|
-
let found = false;
|
|
1426
|
-
const visit = (v) => {
|
|
1427
|
-
if (found || v === null || typeof v !== "object")
|
|
1428
|
-
return;
|
|
1429
|
-
if (Array.isArray(v)) {
|
|
1430
|
-
for (const item of v)
|
|
1431
|
-
visit(item);
|
|
1432
|
-
return;
|
|
1433
|
-
}
|
|
1434
|
-
const node = v;
|
|
1435
|
-
if (node.kind === "libCall" &&
|
|
1436
|
-
typeof node.fn === "string" &&
|
|
1437
|
-
(node.fn.startsWith("readable.") || node.fn.startsWith("writable.") ||
|
|
1438
|
-
node.fn.startsWith("duplex.") || node.fn.startsWith("transform.") ||
|
|
1439
|
-
node.fn.startsWith("passthrough.") ||
|
|
1440
|
-
node.fn === "stream.destroy" || node.fn === "stream.destroyErr" ||
|
|
1441
|
-
node.fn === "stream.prop" || node.fn === "stream.errored" ||
|
|
1442
|
-
node.fn === "sp.finished" || node.fn === "sp.pipeline" ||
|
|
1443
|
-
node.fn.startsWith("sc.") ||
|
|
1444
|
-
node.fn.startsWith("stream.set"))) {
|
|
1445
|
-
found = true;
|
|
1446
|
-
return;
|
|
1447
|
-
}
|
|
1448
|
-
for (const key of Object.keys(v))
|
|
1449
|
-
visit(v[key]);
|
|
1450
|
-
};
|
|
1451
|
-
visit(mod);
|
|
1452
|
-
return found;
|
|
1613
|
+
return scanRuntimeFeatures(mod, "stream").stream;
|
|
1453
1614
|
}
|
|
1454
1615
|
/** True when the embedded npm graph has an edge into `builtin` — the
|
|
1455
1616
|
* island shim needs the corresponding native bridge linked (zlib's is
|
|
@@ -1458,7 +1619,7 @@ export function moduleEmbedsBuiltin(mod, builtin) {
|
|
|
1458
1619
|
return mod.embedded !== undefined && mod.embedded.edges.some((e) => e.to === builtin);
|
|
1459
1620
|
}
|
|
1460
1621
|
/** Embedded module texts at least this long are DEFLATE-compressed into
|
|
1461
|
-
* the emitted
|
|
1622
|
+
* the emitted LLVM (island.ts; each stays plain when deflate does not
|
|
1462
1623
|
* shrink it) and inflated lazily by the island's module loader at first
|
|
1463
1624
|
* load. Below it the zlib round trip cannot pay for itself. */
|
|
1464
1625
|
export const NPM_COMPRESS_MIN = 1024;
|
|
@@ -1478,52 +1639,14 @@ export function moduleEmbedsCompressedNpm(mod) {
|
|
|
1478
1639
|
* generic-walk shape as moduleUsesRegex: `kind`/`fn` discriminants live
|
|
1479
1640
|
* only on IR objects. */
|
|
1480
1641
|
export function moduleUsesZlib(mod) {
|
|
1481
|
-
|
|
1482
|
-
return true;
|
|
1483
|
-
let found = false;
|
|
1484
|
-
const visit = (v) => {
|
|
1485
|
-
if (found || v === null || typeof v !== "object")
|
|
1486
|
-
return;
|
|
1487
|
-
if (Array.isArray(v)) {
|
|
1488
|
-
for (const item of v)
|
|
1489
|
-
visit(item);
|
|
1490
|
-
return;
|
|
1491
|
-
}
|
|
1492
|
-
const node = v;
|
|
1493
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("zlib.")) {
|
|
1494
|
-
found = true;
|
|
1495
|
-
return;
|
|
1496
|
-
}
|
|
1497
|
-
for (const key of Object.keys(v))
|
|
1498
|
-
visit(v[key]);
|
|
1499
|
-
};
|
|
1500
|
-
visit(mod);
|
|
1501
|
-
return found;
|
|
1642
|
+
return scanRuntimeFeatures(mod, "zlib").zlib;
|
|
1502
1643
|
}
|
|
1503
1644
|
/** True when the module contains any dc.* libCall — the link switch that
|
|
1504
1645
|
* pulls scr_dc.c (the diagnostics_channel registry and pub/sub) into the
|
|
1505
1646
|
* binary (native-toolchain.ts). Channel-free binaries keep their exact size class.
|
|
1506
1647
|
* Same walk shape as moduleUsesZlib. */
|
|
1507
1648
|
export function moduleUsesDc(mod) {
|
|
1508
|
-
|
|
1509
|
-
const visit = (v) => {
|
|
1510
|
-
if (found || v === null || typeof v !== "object")
|
|
1511
|
-
return;
|
|
1512
|
-
if (Array.isArray(v)) {
|
|
1513
|
-
for (const item of v)
|
|
1514
|
-
visit(item);
|
|
1515
|
-
return;
|
|
1516
|
-
}
|
|
1517
|
-
const node = v;
|
|
1518
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("dc.")) {
|
|
1519
|
-
found = true;
|
|
1520
|
-
return;
|
|
1521
|
-
}
|
|
1522
|
-
for (const key of Object.keys(v))
|
|
1523
|
-
visit(v[key]);
|
|
1524
|
-
};
|
|
1525
|
-
visit(mod);
|
|
1526
|
-
return found;
|
|
1649
|
+
return scanRuntimeFeatures(mod, "dc").dc;
|
|
1527
1650
|
}
|
|
1528
1651
|
/** True when the module contains any assert libCall — the link switch
|
|
1529
1652
|
* that pulls scr_assert.c into the binary (native-toolchain.ts). scr_regex.c calls the
|
|
@@ -1532,25 +1655,7 @@ export function moduleUsesDc(mod) {
|
|
|
1532
1655
|
* the historical command line and size. Same walk shape as
|
|
1533
1656
|
* moduleUsesZlib. */
|
|
1534
1657
|
export function moduleUsesAssert(mod) {
|
|
1535
|
-
|
|
1536
|
-
const visit = (v) => {
|
|
1537
|
-
if (found || v === null || typeof v !== "object")
|
|
1538
|
-
return;
|
|
1539
|
-
if (Array.isArray(v)) {
|
|
1540
|
-
for (const item of v)
|
|
1541
|
-
visit(item);
|
|
1542
|
-
return;
|
|
1543
|
-
}
|
|
1544
|
-
const node = v;
|
|
1545
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("assert.")) {
|
|
1546
|
-
found = true;
|
|
1547
|
-
return;
|
|
1548
|
-
}
|
|
1549
|
-
for (const key of Object.keys(v))
|
|
1550
|
-
visit(v[key]);
|
|
1551
|
-
};
|
|
1552
|
-
visit(mod);
|
|
1553
|
-
return found;
|
|
1658
|
+
return scanRuntimeFeatures(mod, "assert").assert;
|
|
1554
1659
|
}
|
|
1555
1660
|
/** True when the module contains any dynInvoke node or dyn.defineProps
|
|
1556
1661
|
* libCall — the link switch that pulls scr_dyn_invoke.c (the prototype-
|
|
@@ -1559,25 +1664,7 @@ export function moduleUsesAssert(mod) {
|
|
|
1559
1664
|
* precedent — dispatch-free binaries keep their exact size class). Same
|
|
1560
1665
|
* walk shape as moduleUsesZlib. */
|
|
1561
1666
|
export function moduleUsesDynInvoke(mod) {
|
|
1562
|
-
|
|
1563
|
-
const visit = (v) => {
|
|
1564
|
-
if (found || v === null || typeof v !== "object")
|
|
1565
|
-
return;
|
|
1566
|
-
if (Array.isArray(v)) {
|
|
1567
|
-
for (const item of v)
|
|
1568
|
-
visit(item);
|
|
1569
|
-
return;
|
|
1570
|
-
}
|
|
1571
|
-
const node = v;
|
|
1572
|
-
if (node.kind === "dynInvoke" || (node.kind === "libCall" && node.fn === "dyn.defineProps")) {
|
|
1573
|
-
found = true;
|
|
1574
|
-
return;
|
|
1575
|
-
}
|
|
1576
|
-
for (const key of Object.keys(v))
|
|
1577
|
-
visit(v[key]);
|
|
1578
|
-
};
|
|
1579
|
-
visit(mod);
|
|
1580
|
-
return found;
|
|
1667
|
+
return scanRuntimeFeatures(mod, "dynInvoke").dynInvoke;
|
|
1581
1668
|
}
|
|
1582
1669
|
/** True when the module contains any insp libCall — the link switch that
|
|
1583
1670
|
* pulls scr_inspect.c into the binary (native-toolchain.ts; the assert gating
|
|
@@ -1590,96 +1677,16 @@ export function moduleUsesDynInvoke(mod) {
|
|
|
1590
1677
|
* dynInvoke and dc gates (their TUs call into this one) — native-toolchain.ts. Same
|
|
1591
1678
|
* walk shape as moduleUsesZlib. */
|
|
1592
1679
|
export function moduleUsesDynAsync(mod) {
|
|
1593
|
-
|
|
1594
|
-
"async.awaitDyn", "timers.immediatePromise",
|
|
1595
|
-
"process.onUnhandledRejection", "process.offUnhandledRejection",
|
|
1596
|
-
"process.onRejectionHandled", "process.offRejectionHandled",
|
|
1597
|
-
"process.onWarning", "process.offWarning", "process.emitWarning",
|
|
1598
|
-
"als.new", "als.get", "als.run", "als.exitRun", "als.enterWith", "als.disable",
|
|
1599
|
-
"dc.chanBindStore", "dc.chanUnbindStore", "dc.chanRunStores",
|
|
1600
|
-
]);
|
|
1601
|
-
let found = false;
|
|
1602
|
-
const visit = (v) => {
|
|
1603
|
-
if (found || v === null || typeof v !== "object")
|
|
1604
|
-
return;
|
|
1605
|
-
if (Array.isArray(v)) {
|
|
1606
|
-
for (const item of v)
|
|
1607
|
-
visit(item);
|
|
1608
|
-
return;
|
|
1609
|
-
}
|
|
1610
|
-
const node = v;
|
|
1611
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && fns.has(node.fn)) {
|
|
1612
|
-
found = true;
|
|
1613
|
-
return;
|
|
1614
|
-
}
|
|
1615
|
-
// A DYN-typed await reads through scr_await_dyn (the checked-dynamic tree-crossing
|
|
1616
|
-
// await lives in the gated TU) — promise<dyn> receivers' awaits and
|
|
1617
|
-
// the lifted then/catch helpers alike.
|
|
1618
|
-
const boxed = node.value?.type;
|
|
1619
|
-
if ((node.kind === "awaitExpr" && node.type?.kind === "dyn") ||
|
|
1620
|
-
(node.kind === "dynFrom" && (boxed?.kind === "promise" || (boxed?.kind === "func" && boxed.ret?.kind === "promise")))) {
|
|
1621
|
-
found = true;
|
|
1622
|
-
return;
|
|
1623
|
-
}
|
|
1624
|
-
for (const key of Object.keys(v))
|
|
1625
|
-
visit(v[key]);
|
|
1626
|
-
};
|
|
1627
|
-
visit(mod);
|
|
1628
|
-
return found;
|
|
1680
|
+
return scanRuntimeFeatures(mod, "dynAsync").dynAsync;
|
|
1629
1681
|
}
|
|
1630
1682
|
export function moduleUsesInspect(mod) {
|
|
1631
|
-
|
|
1632
|
-
const visit = (v) => {
|
|
1633
|
-
if (found || v === null || typeof v !== "object")
|
|
1634
|
-
return;
|
|
1635
|
-
if (Array.isArray(v)) {
|
|
1636
|
-
for (const item of v)
|
|
1637
|
-
visit(item);
|
|
1638
|
-
return;
|
|
1639
|
-
}
|
|
1640
|
-
const node = v;
|
|
1641
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("insp.")) {
|
|
1642
|
-
found = true;
|
|
1643
|
-
return;
|
|
1644
|
-
}
|
|
1645
|
-
for (const key of Object.keys(v))
|
|
1646
|
-
visit(v[key]);
|
|
1647
|
-
};
|
|
1648
|
-
visit(mod);
|
|
1649
|
-
return found;
|
|
1683
|
+
return scanRuntimeFeatures(mod, "inspect").inspect;
|
|
1650
1684
|
}
|
|
1651
1685
|
/** True when the module reaches child_process or carries one of its runtime
|
|
1652
1686
|
* handle/result types. Besides the existing link consequence, this gates the
|
|
1653
1687
|
* checked-dynamic ChildProcess handle table installed from scr_child.c. */
|
|
1654
1688
|
export function moduleUsesChildProcess(mod) {
|
|
1655
|
-
|
|
1656
|
-
const visit = (v) => {
|
|
1657
|
-
if (found || v === null || typeof v !== "object")
|
|
1658
|
-
return;
|
|
1659
|
-
if (Array.isArray(v)) {
|
|
1660
|
-
for (const item of v)
|
|
1661
|
-
visit(item);
|
|
1662
|
-
return;
|
|
1663
|
-
}
|
|
1664
|
-
const node = v;
|
|
1665
|
-
if (node.kind === "libCall" &&
|
|
1666
|
-
typeof node.fn === "string" &&
|
|
1667
|
-
(node.fn.startsWith("cp.") || node.fn.startsWith("child.") || node.fn.startsWith("writer.") || node.fn.startsWith("spawnRes.") ||
|
|
1668
|
-
node.fn === "process.forkTarget" || node.fn === "process.connected" || node.fn === "process.send" ||
|
|
1669
|
-
node.fn === "process.sendCb" || node.fn === "process.disconnect" || node.fn === "process.onMessage" ||
|
|
1670
|
-
node.fn === "process.onDisconnect")) {
|
|
1671
|
-
found = true;
|
|
1672
|
-
return;
|
|
1673
|
-
}
|
|
1674
|
-
if (node.kind === "child" || node.kind === "childStream" || node.kind === "childWriter" || node.kind === "spawnRes") {
|
|
1675
|
-
found = true;
|
|
1676
|
-
return;
|
|
1677
|
-
}
|
|
1678
|
-
for (const key of Object.keys(v))
|
|
1679
|
-
visit(v[key]);
|
|
1680
|
-
};
|
|
1681
|
-
visit(mod);
|
|
1682
|
-
return found;
|
|
1689
|
+
return scanRuntimeFeatures(mod, "childProcess").childProcess;
|
|
1683
1690
|
}
|
|
1684
1691
|
/** True when the module contains any net libCall — the link switch that
|
|
1685
1692
|
* pulls scr_net.c into the binary and has the emitted main call
|
|
@@ -1687,42 +1694,7 @@ export function moduleUsesChildProcess(mod) {
|
|
|
1687
1694
|
* Net-free programs pay zero bytes and keep their exact link line. Same
|
|
1688
1695
|
* generic-walk shape as moduleUsesZlib. */
|
|
1689
1696
|
export function moduleUsesNet(mod) {
|
|
1690
|
-
|
|
1691
|
-
const visit = (v) => {
|
|
1692
|
-
if (found || v === null || typeof v !== "object")
|
|
1693
|
-
return;
|
|
1694
|
-
if (Array.isArray(v)) {
|
|
1695
|
-
for (const item of v)
|
|
1696
|
-
visit(item);
|
|
1697
|
-
return;
|
|
1698
|
-
}
|
|
1699
|
-
const node = v;
|
|
1700
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1701
|
-
(node.fn.startsWith("net.") || node.fn.startsWith("http.") ||
|
|
1702
|
-
node.fn.startsWith("tls.") || node.fn.startsWith("https.") ||
|
|
1703
|
-
node.fn.startsWith("http2."))) {
|
|
1704
|
-
// http/tls/https/http2 all ride ON net: their libCalls need scr_net.c
|
|
1705
|
-
// linked and installed too, so the net switch answers for every
|
|
1706
|
-
// server-family prefix.
|
|
1707
|
-
found = true;
|
|
1708
|
-
return;
|
|
1709
|
-
}
|
|
1710
|
-
// A net-family HANDLE TYPE anywhere in the IR (a global or local whose
|
|
1711
|
-
// initializing statement compiled to a runtime fence still carries the
|
|
1712
|
-
// type): its emitted release call needs the unit linked even when no
|
|
1713
|
-
// libCall survived the fencing.
|
|
1714
|
-
if (node.kind === "netServer" || node.kind === "netSocket" ||
|
|
1715
|
-
node.kind === "http2Session" || node.kind === "http2Stream" ||
|
|
1716
|
-
node.kind === "httpReq" || node.kind === "httpRes" ||
|
|
1717
|
-
node.kind === "httpClientReq" || node.kind === "secureCtx") {
|
|
1718
|
-
found = true;
|
|
1719
|
-
return;
|
|
1720
|
-
}
|
|
1721
|
-
for (const key of Object.keys(v))
|
|
1722
|
-
visit(v[key]);
|
|
1723
|
-
};
|
|
1724
|
-
visit(mod);
|
|
1725
|
-
return found;
|
|
1697
|
+
return scanRuntimeFeatures(mod, "net").net;
|
|
1726
1698
|
}
|
|
1727
1699
|
/** True when the module contains any sym.* libCall or a symbol-kind type
|
|
1728
1700
|
* anywhere in the IR — the link switch that pulls scr_symbol.c into the
|
|
@@ -1732,54 +1704,13 @@ export function moduleUsesNet(mod) {
|
|
|
1732
1704
|
* fence still emits release calls that need the unit linked. Symbol-free
|
|
1733
1705
|
* programs pay zero bytes and keep their exact link line. */
|
|
1734
1706
|
export function moduleUsesSymbol(mod) {
|
|
1735
|
-
|
|
1736
|
-
const visit = (v) => {
|
|
1737
|
-
if (found || v === null || typeof v !== "object")
|
|
1738
|
-
return;
|
|
1739
|
-
if (Array.isArray(v)) {
|
|
1740
|
-
for (const item of v)
|
|
1741
|
-
visit(item);
|
|
1742
|
-
return;
|
|
1743
|
-
}
|
|
1744
|
-
const node = v;
|
|
1745
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("sym.")) {
|
|
1746
|
-
found = true;
|
|
1747
|
-
return;
|
|
1748
|
-
}
|
|
1749
|
-
if (node.kind === "symbol") {
|
|
1750
|
-
found = true;
|
|
1751
|
-
return;
|
|
1752
|
-
}
|
|
1753
|
-
for (const key of Object.keys(v))
|
|
1754
|
-
visit(v[key]);
|
|
1755
|
-
};
|
|
1756
|
-
visit(mod);
|
|
1757
|
-
return found;
|
|
1707
|
+
return scanRuntimeFeatures(mod, "symbol").symbol;
|
|
1758
1708
|
}
|
|
1759
1709
|
/** True when bigint runtime operations or bigint-typed storage appears in
|
|
1760
1710
|
* the IR. The type check keeps retain/release references link-safe even
|
|
1761
1711
|
* when a producing statement was replaced by a runtime fence. */
|
|
1762
1712
|
export function moduleUsesBigInt(mod) {
|
|
1763
|
-
|
|
1764
|
-
const visit = (v) => {
|
|
1765
|
-
if (found || v === null || typeof v !== "object")
|
|
1766
|
-
return;
|
|
1767
|
-
if (Array.isArray(v)) {
|
|
1768
|
-
for (const item of v)
|
|
1769
|
-
visit(item);
|
|
1770
|
-
return;
|
|
1771
|
-
}
|
|
1772
|
-
const node = v;
|
|
1773
|
-
if (node.kind === "bigint" ||
|
|
1774
|
-
(node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("bigint."))) {
|
|
1775
|
-
found = true;
|
|
1776
|
-
return;
|
|
1777
|
-
}
|
|
1778
|
-
for (const key of Object.keys(v))
|
|
1779
|
-
visit(v[key]);
|
|
1780
|
-
};
|
|
1781
|
-
visit(mod);
|
|
1782
|
-
return found;
|
|
1713
|
+
return scanRuntimeFeatures(mod, "bigint").bigint;
|
|
1783
1714
|
}
|
|
1784
1715
|
/** True when the module uses the URLSearchParams surface — sp.* libCalls,
|
|
1785
1716
|
* the url.searchParams getter, or a searchParams-kind type anywhere on
|
|
@@ -1790,30 +1721,7 @@ export function moduleUsesBigInt(mod) {
|
|
|
1790
1721
|
* programs keep their exact link line; scr_url.c itself stays
|
|
1791
1722
|
* always-linked and never references the unit. */
|
|
1792
1723
|
export function moduleUsesSearchParams(mod) {
|
|
1793
|
-
|
|
1794
|
-
const visit = (v) => {
|
|
1795
|
-
if (found || v === null || typeof v !== "object")
|
|
1796
|
-
return;
|
|
1797
|
-
if (Array.isArray(v)) {
|
|
1798
|
-
for (const item of v)
|
|
1799
|
-
visit(item);
|
|
1800
|
-
return;
|
|
1801
|
-
}
|
|
1802
|
-
const node = v;
|
|
1803
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1804
|
-
(node.fn.startsWith("sp.") || node.fn === "url.searchParams")) {
|
|
1805
|
-
found = true;
|
|
1806
|
-
return;
|
|
1807
|
-
}
|
|
1808
|
-
if (node.kind === "searchParams") {
|
|
1809
|
-
found = true;
|
|
1810
|
-
return;
|
|
1811
|
-
}
|
|
1812
|
-
for (const key of Object.keys(v))
|
|
1813
|
-
visit(v[key]);
|
|
1814
|
-
};
|
|
1815
|
-
visit(mod);
|
|
1816
|
-
return found;
|
|
1724
|
+
return scanRuntimeFeatures(mod, "searchParams").searchParams;
|
|
1817
1725
|
}
|
|
1818
1726
|
/** True when the module uses the node:querystring surface — the qs.*
|
|
1819
1727
|
* libCalls that live in scr_qs.c (parse/stringify/unescape; qs.escape
|
|
@@ -1823,50 +1731,13 @@ export function moduleUsesSearchParams(mod) {
|
|
|
1823
1731
|
* loop hooks, cross-compiles everywhere). qs-free programs keep their
|
|
1824
1732
|
* exact link line. Same generic-walk shape as moduleUsesZlib. */
|
|
1825
1733
|
export function moduleUsesQs(mod) {
|
|
1826
|
-
|
|
1827
|
-
const visit = (v) => {
|
|
1828
|
-
if (found || v === null || typeof v !== "object")
|
|
1829
|
-
return;
|
|
1830
|
-
if (Array.isArray(v)) {
|
|
1831
|
-
for (const item of v)
|
|
1832
|
-
visit(item);
|
|
1833
|
-
return;
|
|
1834
|
-
}
|
|
1835
|
-
const node = v;
|
|
1836
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1837
|
-
(node.fn === "qs.parse" || node.fn === "qs.stringify" || node.fn === "qs.unescape")) {
|
|
1838
|
-
found = true;
|
|
1839
|
-
return;
|
|
1840
|
-
}
|
|
1841
|
-
for (const key of Object.keys(v))
|
|
1842
|
-
visit(v[key]);
|
|
1843
|
-
};
|
|
1844
|
-
visit(mod);
|
|
1845
|
-
return found;
|
|
1734
|
+
return scanRuntimeFeatures(mod, "qs").qs;
|
|
1846
1735
|
}
|
|
1847
1736
|
/** True when the module uses native util.parseArgs — the link switch for
|
|
1848
1737
|
* scr_util.c. The implementation is a pure checked-dynamic data transform,
|
|
1849
1738
|
* cross-platform and independent of the island's node:util shim. */
|
|
1850
1739
|
export function moduleUsesParseArgs(mod) {
|
|
1851
|
-
|
|
1852
|
-
const visit = (v) => {
|
|
1853
|
-
if (found || v === null || typeof v !== "object")
|
|
1854
|
-
return;
|
|
1855
|
-
if (Array.isArray(v)) {
|
|
1856
|
-
for (const item of v)
|
|
1857
|
-
visit(item);
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
const node = v;
|
|
1861
|
-
if (node.kind === "libCall" && node.fn === "util.parseArgs") {
|
|
1862
|
-
found = true;
|
|
1863
|
-
return;
|
|
1864
|
-
}
|
|
1865
|
-
for (const key of Object.keys(v))
|
|
1866
|
-
visit(v[key]);
|
|
1867
|
-
};
|
|
1868
|
-
visit(mod);
|
|
1869
|
-
return found;
|
|
1740
|
+
return scanRuntimeFeatures(mod, "parseArgs").parseArgs;
|
|
1870
1741
|
}
|
|
1871
1742
|
/** True when the module contains any fs.watch/watcher.* libCall — the
|
|
1872
1743
|
* link switch that pulls scr_watch.c into the binary and has the emitted
|
|
@@ -1874,32 +1745,7 @@ export function moduleUsesParseArgs(mod) {
|
|
|
1874
1745
|
* precedent). Watch-free programs pay zero bytes and keep their exact
|
|
1875
1746
|
* link line. Same generic-walk shape as moduleUsesZlib. */
|
|
1876
1747
|
export function moduleUsesFsWatch(mod) {
|
|
1877
|
-
|
|
1878
|
-
const visit = (v) => {
|
|
1879
|
-
if (found || v === null || typeof v !== "object")
|
|
1880
|
-
return;
|
|
1881
|
-
if (Array.isArray(v)) {
|
|
1882
|
-
for (const item of v)
|
|
1883
|
-
visit(item);
|
|
1884
|
-
return;
|
|
1885
|
-
}
|
|
1886
|
-
const node = v;
|
|
1887
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1888
|
-
(node.fn.startsWith("fs.watch") || node.fn.startsWith("watcher."))) {
|
|
1889
|
-
found = true;
|
|
1890
|
-
return;
|
|
1891
|
-
}
|
|
1892
|
-
// A watcher HANDLE TYPE left behind by a fenced statement still emits
|
|
1893
|
-
// scr_watcher_release — the unit must link.
|
|
1894
|
-
if (node.kind === "fsWatcher") {
|
|
1895
|
-
found = true;
|
|
1896
|
-
return;
|
|
1897
|
-
}
|
|
1898
|
-
for (const key of Object.keys(v))
|
|
1899
|
-
visit(v[key]);
|
|
1900
|
-
};
|
|
1901
|
-
visit(mod);
|
|
1902
|
-
return found;
|
|
1748
|
+
return scanRuntimeFeatures(mod, "fsWatch").fsWatch;
|
|
1903
1749
|
}
|
|
1904
1750
|
/** True when the module contains any test.* libCall or a testCtx handle
|
|
1905
1751
|
* type — the link switch that pulls scr_test.c into the binary and has
|
|
@@ -1907,31 +1753,7 @@ export function moduleUsesFsWatch(mod) {
|
|
|
1907
1753
|
* (native-toolchain.ts + emitter; the moduleUsesDgram shape). Test-free programs pay
|
|
1908
1754
|
* zero bytes and keep their exact link line. */
|
|
1909
1755
|
export function moduleUsesNodeTest(mod) {
|
|
1910
|
-
|
|
1911
|
-
const visit = (v) => {
|
|
1912
|
-
if (found || v === null || typeof v !== "object")
|
|
1913
|
-
return;
|
|
1914
|
-
if (Array.isArray(v)) {
|
|
1915
|
-
for (const item of v)
|
|
1916
|
-
visit(item);
|
|
1917
|
-
return;
|
|
1918
|
-
}
|
|
1919
|
-
const node = v;
|
|
1920
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("test.")) {
|
|
1921
|
-
found = true;
|
|
1922
|
-
return;
|
|
1923
|
-
}
|
|
1924
|
-
// A TestContext HANDLE TYPE left behind by a fenced statement still
|
|
1925
|
-
// emits a release call — the unit must link (the dgram type story).
|
|
1926
|
-
if (node.kind === "testCtx") {
|
|
1927
|
-
found = true;
|
|
1928
|
-
return;
|
|
1929
|
-
}
|
|
1930
|
-
for (const key of Object.keys(v))
|
|
1931
|
-
visit(v[key]);
|
|
1932
|
-
};
|
|
1933
|
-
visit(mod);
|
|
1934
|
-
return found;
|
|
1756
|
+
return scanRuntimeFeatures(mod, "nodeTest").nodeTest;
|
|
1935
1757
|
}
|
|
1936
1758
|
/** True when the module contains any dgram.* or dns.* libCall — the
|
|
1937
1759
|
* link switch that pulls scr_dgram.c into the binary and has the emitted
|
|
@@ -1940,69 +1762,13 @@ export function moduleUsesNodeTest(mod) {
|
|
|
1940
1762
|
* answers). Dgram-free programs pay zero bytes and keep their exact link
|
|
1941
1763
|
* line. Same generic-walk shape as moduleUsesZlib. */
|
|
1942
1764
|
export function moduleUsesDgram(mod) {
|
|
1943
|
-
|
|
1944
|
-
const visit = (v) => {
|
|
1945
|
-
if (found || v === null || typeof v !== "object")
|
|
1946
|
-
return;
|
|
1947
|
-
if (Array.isArray(v)) {
|
|
1948
|
-
for (const item of v)
|
|
1949
|
-
visit(item);
|
|
1950
|
-
return;
|
|
1951
|
-
}
|
|
1952
|
-
const node = v;
|
|
1953
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1954
|
-
(node.fn.startsWith("dgram.") || node.fn.startsWith("dns."))) {
|
|
1955
|
-
found = true;
|
|
1956
|
-
return;
|
|
1957
|
-
}
|
|
1958
|
-
// A dgram HANDLE TYPE left behind by a fenced statement still emits a
|
|
1959
|
-
// release call — the unit must link (the moduleUsesNet type story).
|
|
1960
|
-
if (node.kind === "dgramSocket") {
|
|
1961
|
-
found = true;
|
|
1962
|
-
return;
|
|
1963
|
-
}
|
|
1964
|
-
for (const key of Object.keys(v))
|
|
1965
|
-
visit(v[key]);
|
|
1966
|
-
};
|
|
1967
|
-
visit(mod);
|
|
1968
|
-
return found;
|
|
1765
|
+
return scanRuntimeFeatures(mod, "dgram").dgram;
|
|
1969
1766
|
}
|
|
1970
1767
|
/** True when the module contains any http.* libCall — the link switch
|
|
1971
1768
|
* that pulls scr_http.c into the binary (native-toolchain.ts; moduleUsesNet already
|
|
1972
1769
|
* answers true for these, so scr_net.c comes along). */
|
|
1973
1770
|
export function moduleUsesHttpServer(mod) {
|
|
1974
|
-
|
|
1975
|
-
const visit = (v) => {
|
|
1976
|
-
if (found || v === null || typeof v !== "object")
|
|
1977
|
-
return;
|
|
1978
|
-
if (Array.isArray(v)) {
|
|
1979
|
-
for (const item of v)
|
|
1980
|
-
visit(item);
|
|
1981
|
-
return;
|
|
1982
|
-
}
|
|
1983
|
-
const node = v;
|
|
1984
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1985
|
-
(node.fn.startsWith("http.") || node.fn.startsWith("tls.") || node.fn.startsWith("https.") ||
|
|
1986
|
-
node.fn.startsWith("http2."))) {
|
|
1987
|
-
// scr_tls.c calls into scr_http.c unconditionally (the https server
|
|
1988
|
-
// and client are the http ones over a transport), so any tls/https
|
|
1989
|
-
// use pulls the http unit too.
|
|
1990
|
-
found = true;
|
|
1991
|
-
return;
|
|
1992
|
-
}
|
|
1993
|
-
// An http-family HANDLE TYPE left behind by a fenced statement still
|
|
1994
|
-
// emits its release call — the unit must link (the moduleUsesNet type
|
|
1995
|
-
// story; secureCtx rides here because scr_tls.c calls into scr_http.c).
|
|
1996
|
-
if (node.kind === "httpReq" || node.kind === "httpRes" ||
|
|
1997
|
-
node.kind === "httpClientReq" || node.kind === "secureCtx") {
|
|
1998
|
-
found = true;
|
|
1999
|
-
return;
|
|
2000
|
-
}
|
|
2001
|
-
for (const key of Object.keys(v))
|
|
2002
|
-
visit(v[key]);
|
|
2003
|
-
};
|
|
2004
|
-
visit(mod);
|
|
2005
|
-
return found;
|
|
1771
|
+
return scanRuntimeFeatures(mod, "http").http;
|
|
2006
1772
|
}
|
|
2007
1773
|
/** The legacy http2.* libCalls implemented by scr_http.c/scr_tls.c (the
|
|
2008
1774
|
* allowHTTP1 compatibility slice) — they must NOT pull scr_http2.c, so
|
|
@@ -2014,30 +1780,7 @@ const HTTP2_LEGACY_FNS = new Set([
|
|
|
2014
1780
|
* http2.* libCall, or an h2 handle type left behind by a fenced statement
|
|
2015
1781
|
* (its emitted release call needs the unit — the moduleUsesNet story). */
|
|
2016
1782
|
export function moduleUsesHttp2(mod) {
|
|
2017
|
-
|
|
2018
|
-
const visit = (v) => {
|
|
2019
|
-
if (found || v === null || typeof v !== "object")
|
|
2020
|
-
return;
|
|
2021
|
-
if (Array.isArray(v)) {
|
|
2022
|
-
for (const item of v)
|
|
2023
|
-
visit(item);
|
|
2024
|
-
return;
|
|
2025
|
-
}
|
|
2026
|
-
const node = v;
|
|
2027
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
2028
|
-
node.fn.startsWith("http2.") && !HTTP2_LEGACY_FNS.has(node.fn)) {
|
|
2029
|
-
found = true;
|
|
2030
|
-
return;
|
|
2031
|
-
}
|
|
2032
|
-
if (node.kind === "http2Session" || node.kind === "http2Stream") {
|
|
2033
|
-
found = true;
|
|
2034
|
-
return;
|
|
2035
|
-
}
|
|
2036
|
-
for (const key of Object.keys(v))
|
|
2037
|
-
visit(v[key]);
|
|
2038
|
-
};
|
|
2039
|
-
visit(mod);
|
|
2040
|
-
return found;
|
|
1783
|
+
return scanRuntimeFeatures(mod, "http2").http2;
|
|
2041
1784
|
}
|
|
2042
1785
|
/** True when the module contains any tls.* or https.* libCall — the link
|
|
2043
1786
|
* switch that pulls scr_tls.c and the vendored mbedTLS archive into the
|
|
@@ -2045,33 +1788,7 @@ export function moduleUsesHttp2(mod) {
|
|
|
2045
1788
|
* true for these, so scr_net.c and scr_http.c come along). TLS-free
|
|
2046
1789
|
* programs keep their exact link line and never build mbedTLS. */
|
|
2047
1790
|
export function moduleUsesTls(mod) {
|
|
2048
|
-
|
|
2049
|
-
const visit = (v) => {
|
|
2050
|
-
if (found || v === null || typeof v !== "object")
|
|
2051
|
-
return;
|
|
2052
|
-
if (Array.isArray(v)) {
|
|
2053
|
-
for (const item of v)
|
|
2054
|
-
visit(item);
|
|
2055
|
-
return;
|
|
2056
|
-
}
|
|
2057
|
-
const node = v;
|
|
2058
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
2059
|
-
(node.fn.startsWith("tls.") || node.fn.startsWith("https.") ||
|
|
2060
|
-
node.fn.startsWith("http2."))) {
|
|
2061
|
-
found = true;
|
|
2062
|
-
return;
|
|
2063
|
-
}
|
|
2064
|
-
// A secureCtx HANDLE TYPE left behind by a fenced statement still
|
|
2065
|
-
// emits scr_secure_ctx_release — the unit must link.
|
|
2066
|
-
if (node.kind === "secureCtx") {
|
|
2067
|
-
found = true;
|
|
2068
|
-
return;
|
|
2069
|
-
}
|
|
2070
|
-
for (const key of Object.keys(v))
|
|
2071
|
-
visit(v[key]);
|
|
2072
|
-
};
|
|
2073
|
-
visit(mod);
|
|
2074
|
-
return found;
|
|
1791
|
+
return scanRuntimeFeatures(mod, "tls").tls;
|
|
2075
1792
|
}
|
|
2076
1793
|
/** True when the module contains any tlsca.* libCall — the link switch
|
|
2077
1794
|
* for scr_tls_ca.c, the CA-store introspection unit (getCACertificates /
|
|
@@ -2081,25 +1798,7 @@ export function moduleUsesTls(mod) {
|
|
|
2081
1798
|
* also compiles the unit whenever TLS itself links — scr_tls.c consults
|
|
2082
1799
|
* the unit's default-set override for its trust anchors. */
|
|
2083
1800
|
export function moduleUsesTlsCa(mod) {
|
|
2084
|
-
|
|
2085
|
-
const visit = (v) => {
|
|
2086
|
-
if (found || v === null || typeof v !== "object")
|
|
2087
|
-
return;
|
|
2088
|
-
if (Array.isArray(v)) {
|
|
2089
|
-
for (const item of v)
|
|
2090
|
-
visit(item);
|
|
2091
|
-
return;
|
|
2092
|
-
}
|
|
2093
|
-
const node = v;
|
|
2094
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("tlsca.")) {
|
|
2095
|
-
found = true;
|
|
2096
|
-
return;
|
|
2097
|
-
}
|
|
2098
|
-
for (const key of Object.keys(v))
|
|
2099
|
-
visit(v[key]);
|
|
2100
|
-
};
|
|
2101
|
-
visit(mod);
|
|
2102
|
-
return found;
|
|
1801
|
+
return scanRuntimeFeatures(mod, "tlsCa").tlsCa;
|
|
2103
1802
|
}
|
|
2104
1803
|
/* ── library mode's async_free gate ──────────────────────────────────────
|
|
2105
1804
|
* v1 library mode REQUIRES an async_free module graph (ratified): no async
|
|
@@ -2118,6 +1817,7 @@ const LIB_MODE_REFUSED_PREFIXES = [
|
|
|
2118
1817
|
// exclude — refuse the surface like the rest of the event-loop family.
|
|
2119
1818
|
["fs.existsChk", "the async fs callback surface (fs.exists)"],
|
|
2120
1819
|
["fs.renameCb", "the async fs callback surface (fs.rename)"],
|
|
1820
|
+
["fs.callback", "the async filesystem callback surface"],
|
|
2121
1821
|
["zlib.deflateCb", "the async node:zlib callback surface"],
|
|
2122
1822
|
["zlib.inflateCb", "the async node:zlib callback surface"],
|
|
2123
1823
|
["zlib.deflateRawCb", "the async node:zlib callback surface"],
|
|
@@ -2156,10 +1856,6 @@ const LIB_MODE_REFUSED_PREFIXES = [
|
|
|
2156
1856
|
["als.", "AsyncLocalStorage"],
|
|
2157
1857
|
["urj.", "unhandled-rejection tracking"],
|
|
2158
1858
|
["dc.", "the diagnostics_channel surface"],
|
|
2159
|
-
// NOT the whole "dyn." family: the checked-dynamic tree (ScrDyn) is
|
|
2160
|
-
// static-tier surface hosted by always-linked units; only defineProps
|
|
2161
|
-
// drags the prototype-dispatch unit (scr_dyn_invoke.c → scr_async_dyn.c).
|
|
2162
|
-
["dyn.defineProps", "checked-dynamic prototype dispatch"],
|
|
2163
1859
|
];
|
|
2164
1860
|
/** Value/type kinds whose mere presence means an excluded unit's code (or
|
|
2165
1861
|
* a fiber) would have to link. */
|
|
@@ -2184,12 +1880,11 @@ const LIB_MODE_REFUSED_KINDS = new Map([
|
|
|
2184
1880
|
["httpRes", "the node:http surface"],
|
|
2185
1881
|
["httpClientReq", "the node:http surface"],
|
|
2186
1882
|
["secureCtx", "the node:tls surface"],
|
|
2187
|
-
["dynInvoke", "checked-dynamic prototype dispatch"],
|
|
2188
1883
|
]);
|
|
2189
1884
|
/** First async/event-loop/ambient-process surface the module graph
|
|
2190
1885
|
* reaches, or null when the graph is async_free (the v1 library requirement).
|
|
2191
|
-
*
|
|
2192
|
-
*
|
|
1886
|
+
* Typed slots use their declaration location and executable nodes use their
|
|
1887
|
+
* own location, so the refusal anchors at the reaching construct; the
|
|
2193
1888
|
* coarse moduleUses* predicates are the safety net behind the fine-grained
|
|
2194
1889
|
* table (a surface reached only through a spelling the table misses still
|
|
2195
1890
|
* refuses, anchored at the entry). */
|
|
@@ -2203,54 +1898,49 @@ export function moduleLibAsyncSurface(mod) {
|
|
|
2203
1898
|
}
|
|
2204
1899
|
const entryLoc = { file: mod.sourceFile, start: 0, end: 0 };
|
|
2205
1900
|
let found = null;
|
|
2206
|
-
const
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2219
|
-
|
|
2220
|
-
return;
|
|
2221
|
-
}
|
|
2222
|
-
if (node.kind === "libCall" && typeof node.fn === "string") {
|
|
1901
|
+
const checkKind = (kind, loc) => {
|
|
1902
|
+
const surface = LIB_MODE_REFUSED_KINDS.get(kind);
|
|
1903
|
+
if (surface === undefined)
|
|
1904
|
+
return true;
|
|
1905
|
+
found = { surface, loc };
|
|
1906
|
+
return false;
|
|
1907
|
+
};
|
|
1908
|
+
everyModuleNode(mod, {
|
|
1909
|
+
type: (node, loc) => checkKind(node.kind, loc),
|
|
1910
|
+
stmt: () => true,
|
|
1911
|
+
expr: (node) => {
|
|
1912
|
+
if (!checkKind(node.kind, node.loc))
|
|
1913
|
+
return false;
|
|
1914
|
+
if (node.kind === "libCall") {
|
|
2223
1915
|
for (const [prefix, surface] of LIB_MODE_REFUSED_PREFIXES) {
|
|
2224
1916
|
if (node.fn.startsWith(prefix)) {
|
|
2225
|
-
found = { surface, loc:
|
|
2226
|
-
return;
|
|
1917
|
+
found = { surface, loc: node.loc };
|
|
1918
|
+
return false;
|
|
2227
1919
|
}
|
|
2228
1920
|
}
|
|
2229
1921
|
}
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
};
|
|
2234
|
-
visit(mod, entryLoc);
|
|
1922
|
+
return true;
|
|
1923
|
+
},
|
|
1924
|
+
});
|
|
2235
1925
|
if (found !== null)
|
|
2236
1926
|
return found;
|
|
2237
1927
|
// Safety net: the coarse unit predicates, entry-anchored. Every one of
|
|
2238
1928
|
// these units is excluded from library links, so a true answer that the
|
|
2239
1929
|
// fine-grained table missed must still refuse.
|
|
1930
|
+
const features = moduleRuntimeFeatures(mod);
|
|
2240
1931
|
const coarse = [
|
|
2241
|
-
[
|
|
2242
|
-
[
|
|
2243
|
-
[
|
|
2244
|
-
[
|
|
2245
|
-
[
|
|
2246
|
-
[
|
|
2247
|
-
[
|
|
2248
|
-
[
|
|
2249
|
-
[
|
|
2250
|
-
[
|
|
2251
|
-
[
|
|
2252
|
-
[
|
|
2253
|
-
[moduleUsesDynInvoke(mod), "checked-dynamic prototype dispatch"],
|
|
1932
|
+
[features.processEvents, "process signal/exit listeners or the stdin event surface"],
|
|
1933
|
+
[features.net, "the node:net surface"],
|
|
1934
|
+
[features.http, "the node:http surface"],
|
|
1935
|
+
[features.http2, "the node:http2 surface"],
|
|
1936
|
+
[features.dgram, "the node:dgram surface"],
|
|
1937
|
+
[features.fsWatch, "fs.watch"],
|
|
1938
|
+
[features.stream, "the node:stream surface"],
|
|
1939
|
+
[features.tls, "the node:tls surface"],
|
|
1940
|
+
[features.fetch, "fetch"],
|
|
1941
|
+
[features.nodeTest, "the node:test surface"],
|
|
1942
|
+
[features.dynAsync, "the checked-dynamic async surface"],
|
|
1943
|
+
[features.dc, "the diagnostics_channel surface"],
|
|
2254
1944
|
];
|
|
2255
1945
|
for (const [on, surface] of coarse) {
|
|
2256
1946
|
if (on)
|
|
@@ -2321,27 +2011,22 @@ export const LIB_NONDETERMINISTIC_PREFIXES = [
|
|
|
2321
2011
|
* attests `deterministic: true`). */
|
|
2322
2012
|
export function moduleLibNondeterministicSurface(mod) {
|
|
2323
2013
|
let found = null;
|
|
2324
|
-
const
|
|
2325
|
-
if (
|
|
2326
|
-
return;
|
|
2327
|
-
if (Array.isArray(v)) {
|
|
2328
|
-
for (const item of v)
|
|
2329
|
-
visit(item);
|
|
2330
|
-
return;
|
|
2331
|
-
}
|
|
2332
|
-
const node = v;
|
|
2333
|
-
if (node.kind === "libCall" && typeof node.fn === "string") {
|
|
2014
|
+
const expr = (node) => {
|
|
2015
|
+
if (node.kind === "libCall") {
|
|
2334
2016
|
for (const [prefix, surface] of LIB_NONDETERMINISTIC_PREFIXES) {
|
|
2335
2017
|
if (node.fn.startsWith(prefix)) {
|
|
2336
2018
|
found = surface;
|
|
2337
|
-
return;
|
|
2019
|
+
return false;
|
|
2338
2020
|
}
|
|
2339
2021
|
}
|
|
2340
2022
|
}
|
|
2341
|
-
|
|
2342
|
-
visit(v[key]);
|
|
2023
|
+
return everyExprChild(node, expr, stmt);
|
|
2343
2024
|
};
|
|
2344
|
-
|
|
2025
|
+
const stmt = (node) => everyStmtChild(node, expr, stmt);
|
|
2026
|
+
for (const fn of mod.functions) {
|
|
2027
|
+
if (!fn.body.every(stmt))
|
|
2028
|
+
break;
|
|
2029
|
+
}
|
|
2345
2030
|
return found;
|
|
2346
2031
|
}
|
|
2347
2032
|
/** The may-throw seed: libCall members that can raise. Every fs.* member
|
|
@@ -2352,6 +2037,43 @@ export function moduleLibNondeterministicSurface(mod) {
|
|
|
2352
2037
|
* seed on `dynCheck` and `awaitExpr` nodes, which throw on validation
|
|
2353
2038
|
* failure / promise rejection). */
|
|
2354
2039
|
export const MAY_THROW_LIB_FNS = new Set([
|
|
2040
|
+
"cp.spawnDynamic",
|
|
2041
|
+
"child.onDyn",
|
|
2042
|
+
"text.decoderEncoding",
|
|
2043
|
+
"dyn.construct",
|
|
2044
|
+
"dyn.reflectApply",
|
|
2045
|
+
"text.decodeOptions",
|
|
2046
|
+
"text.decodeStream",
|
|
2047
|
+
"text.decodeLegacyOptions",
|
|
2048
|
+
"dyn.nativeSetNew",
|
|
2049
|
+
"ffi.argument",
|
|
2050
|
+
"ffi.memoryModule",
|
|
2051
|
+
"process.stdoutWrite",
|
|
2052
|
+
"process.stderrWrite",
|
|
2053
|
+
"process.stdoutWriteBytes",
|
|
2054
|
+
"process.stderrWriteBytes",
|
|
2055
|
+
"procStream.write",
|
|
2056
|
+
"weakMap.new",
|
|
2057
|
+
"weakSet.new",
|
|
2058
|
+
"dyn.fromEntries",
|
|
2059
|
+
"bytes.constructor",
|
|
2060
|
+
"bytes.instanceOf",
|
|
2061
|
+
"buffer.byteLenDyn",
|
|
2062
|
+
"bytes.construct",
|
|
2063
|
+
"arrayBuffer.new",
|
|
2064
|
+
"arrayBuffer.byteLengthGetter",
|
|
2065
|
+
"arrayBuffer.viewU8C",
|
|
2066
|
+
"arrayBuffer.viewI8",
|
|
2067
|
+
"arrayBuffer.viewU16",
|
|
2068
|
+
"arrayBuffer.viewI16",
|
|
2069
|
+
"arrayBuffer.viewU8",
|
|
2070
|
+
"arrayBuffer.viewU32",
|
|
2071
|
+
"arrayBuffer.viewI32",
|
|
2072
|
+
"arrayBuffer.viewF32",
|
|
2073
|
+
"arrayBuffer.viewF64",
|
|
2074
|
+
"arrayBuffer.viewDV",
|
|
2075
|
+
"bytes.bufferSource",
|
|
2076
|
+
"text.decodeBufferSource",
|
|
2355
2077
|
"bigint.parse",
|
|
2356
2078
|
"bigint.fromF64",
|
|
2357
2079
|
"bigint.div",
|
|
@@ -2366,12 +2088,15 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2366
2088
|
"bigint.bufferWrite",
|
|
2367
2089
|
"bigint.dataViewGet",
|
|
2368
2090
|
"bigint.dataViewSet",
|
|
2091
|
+
"fetch.requestNew",
|
|
2092
|
+
"fetch.headersNew",
|
|
2369
2093
|
"fetch.responseNew",
|
|
2370
2094
|
"fetch.abortTimeout",
|
|
2371
2095
|
"fetch.abortAny",
|
|
2372
2096
|
"fetch.streamNew",
|
|
2373
2097
|
"fetch.streamFrom",
|
|
2374
2098
|
"num.toFixed",
|
|
2099
|
+
"num.toStringRadix",
|
|
2375
2100
|
"insp.jsonDyn",
|
|
2376
2101
|
// diagnostics_channel: publish runs subscribers synchronously (a throw
|
|
2377
2102
|
// propagates — the documented divergence from triggerUncaughtException);
|
|
@@ -2387,6 +2112,10 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2387
2112
|
"dc.tcTraceSync",
|
|
2388
2113
|
"dc.tcTraceCallback",
|
|
2389
2114
|
"dc.tcTracePromise",
|
|
2115
|
+
"process.onUncaughtException",
|
|
2116
|
+
"process.offUncaughtException",
|
|
2117
|
+
"process.onSignal",
|
|
2118
|
+
"process.offSignal",
|
|
2390
2119
|
"process.onUnhandledRejection",
|
|
2391
2120
|
"process.onRejectionHandled",
|
|
2392
2121
|
"async.awaitDyn",
|
|
@@ -2527,6 +2256,8 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2527
2256
|
"readable.unshift",
|
|
2528
2257
|
"readable.unshiftStr",
|
|
2529
2258
|
"readable.read",
|
|
2259
|
+
"readable.readDyn",
|
|
2260
|
+
"stream.onDyn",
|
|
2530
2261
|
"readable.resume",
|
|
2531
2262
|
"readable.pipe",
|
|
2532
2263
|
"readable.unpipe",
|
|
@@ -2567,9 +2298,32 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2567
2298
|
"error.nodeThrow",
|
|
2568
2299
|
// USVString coercion runs user toString/valueOf — throws propagate.
|
|
2569
2300
|
"dyn.toStringCoerce",
|
|
2301
|
+
"dyn.stringConstructor",
|
|
2302
|
+
"dyn.propertyKey",
|
|
2303
|
+
"dyn.toNumeric",
|
|
2304
|
+
"dyn.increment",
|
|
2305
|
+
// Error messages use the same coercion protocol before installing cause.
|
|
2306
|
+
"error.newOptions",
|
|
2307
|
+
"error.ctorOptions",
|
|
2308
|
+
"error.toString",
|
|
2309
|
+
"error.stack",
|
|
2310
|
+
"error.cause",
|
|
2311
|
+
"error.setCause",
|
|
2312
|
+
"error.deleteCause",
|
|
2570
2313
|
"dyn.objectTag",
|
|
2571
2314
|
// Numeric coercion runs user valueOf/toString — throws propagate.
|
|
2315
|
+
"dyn.numberConstructor",
|
|
2316
|
+
"dyn.bigintConstructor",
|
|
2572
2317
|
"dyn.toNumberCoerce",
|
|
2318
|
+
"dyn.add",
|
|
2319
|
+
"dyn.arithmetic",
|
|
2320
|
+
"dyn.compare",
|
|
2321
|
+
"dyn.bitwise",
|
|
2322
|
+
"dyn.proxyNew",
|
|
2323
|
+
"dyn.classBasePrototype",
|
|
2324
|
+
"dyn.classInherit",
|
|
2325
|
+
"dyn.classSuper",
|
|
2326
|
+
"dyn.hasKey",
|
|
2573
2327
|
"child.kill",
|
|
2574
2328
|
// The caller's lookup runs synchronously inside the connect call — a
|
|
2575
2329
|
// throw there propagates like Node's.
|
|
@@ -2604,10 +2358,16 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2604
2358
|
"island.import",
|
|
2605
2359
|
"island.castFail",
|
|
2606
2360
|
"json.parse",
|
|
2361
|
+
"json.parseReviver",
|
|
2362
|
+
"json.stringifyReplacer",
|
|
2363
|
+
"json.stringifyValue",
|
|
2364
|
+
"date.nativeNew",
|
|
2365
|
+
"date.checkedValue",
|
|
2607
2366
|
"util.parseArgs",
|
|
2608
2367
|
// decodeURIComponent throws the spec's URIError on bad hex/invalid
|
|
2609
2368
|
// UTF-8 octets (encodeURIComponent never throws — see the IrLibFn doc).
|
|
2610
2369
|
"str.decodeUriComponent",
|
|
2370
|
+
"str.decodeUri",
|
|
2611
2371
|
// The base64 globals: atob/btoa throw the catchable DOMException
|
|
2612
2372
|
// InvalidCharacterError on malformed input; the zero-argument form
|
|
2613
2373
|
// always throws Node's TypeError [ERR_MISSING_ARGS].
|
|
@@ -2627,26 +2387,67 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2627
2387
|
"dyn.cloneTransferFail",
|
|
2628
2388
|
// the dyn Object walks throw on null/undefined receivers
|
|
2629
2389
|
"dyn.objKeys",
|
|
2390
|
+
"dyn.forInKeys",
|
|
2630
2391
|
"dyn.hasOwn",
|
|
2392
|
+
"dyn.propertyIsEnumerable",
|
|
2631
2393
|
"dyn.assign",
|
|
2394
|
+
"dyn.copyDataProperties",
|
|
2395
|
+
"dyn.objectRest",
|
|
2632
2396
|
// variadic Object.assign: spread flattening throws V8's spread-call
|
|
2633
2397
|
// TypeErrors; the final copy throws ToObject on a nullish target
|
|
2634
2398
|
"dyn.packPushSpread",
|
|
2635
2399
|
"dyn.packPushSpreadIter",
|
|
2636
2400
|
"dyn.assignAll",
|
|
2401
|
+
"dyn.objCreate",
|
|
2402
|
+
"dyn.objCreateWithProperties",
|
|
2403
|
+
"dyn.getPrototype",
|
|
2404
|
+
"dyn.setPrototype",
|
|
2405
|
+
"dyn.getOwnPropertyNames",
|
|
2406
|
+
"dyn.ownKeys",
|
|
2407
|
+
"dyn.getOwnPropertySymbols",
|
|
2408
|
+
"dyn.getOwnPropertyDescriptors",
|
|
2409
|
+
"dyn.preventExtensions",
|
|
2410
|
+
"dyn.isExtensible",
|
|
2411
|
+
"dyn.seal",
|
|
2412
|
+
"dyn.isSealed",
|
|
2637
2413
|
"dyn.objValues",
|
|
2638
2414
|
"dyn.objEntries",
|
|
2639
2415
|
"error.domClone",
|
|
2640
2416
|
// new RegExp compiles the pattern eagerly: an invalid pattern or flag
|
|
2641
2417
|
// throws Node's catchable SyntaxError at construction.
|
|
2642
2418
|
"regex.new",
|
|
2419
|
+
"regex.resetLastIndex",
|
|
2420
|
+
"regex.newChecked",
|
|
2643
2421
|
"dyn.keySet",
|
|
2422
|
+
"dyn.keySetComputed",
|
|
2423
|
+
"process.builtinId",
|
|
2424
|
+
"process.builtinModule",
|
|
2425
|
+
"process.builtinUnsupported",
|
|
2426
|
+
"fs.callbackValue",
|
|
2427
|
+
"fs.callbackCall",
|
|
2428
|
+
"dyn.keyDelete",
|
|
2429
|
+
"dyn.keyDeleteComputed",
|
|
2430
|
+
"dyn.hasKeyComputed",
|
|
2431
|
+
"dyn.hasOwnComputed",
|
|
2432
|
+
"dyn.propertyIsEnumerableComputed",
|
|
2644
2433
|
// the destructuring pack throws V8's TypeError on non-iterable dyn kinds
|
|
2645
2434
|
"dyn.iterPack",
|
|
2435
|
+
"dyn.arrayFromIterator",
|
|
2436
|
+
"dyn.iterator",
|
|
2437
|
+
"dyn.iteratorResult",
|
|
2438
|
+
"dyn.mapSeedEntries",
|
|
2439
|
+
"dyn.mapSeedEntry",
|
|
2440
|
+
"dyn.freeze",
|
|
2441
|
+
"dyn.isFrozen",
|
|
2646
2442
|
"dyn.toString",
|
|
2443
|
+
"string.fromCodePoint",
|
|
2647
2444
|
"dyn.defineProps",
|
|
2445
|
+
"dyn.defineProperty",
|
|
2446
|
+
"dyn.getOwnPropertyDescriptor",
|
|
2447
|
+
"dyn.arrayProtoCall",
|
|
2648
2448
|
"process.chdir",
|
|
2649
2449
|
"fs.realpathSync",
|
|
2450
|
+
"fs.realpathNativeSync",
|
|
2650
2451
|
"fs.readFileSync",
|
|
2651
2452
|
"fs.writeFileSync",
|
|
2652
2453
|
"fs.appendFileSync",
|
|
@@ -2656,17 +2457,21 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2656
2457
|
"fs.readdirSync",
|
|
2657
2458
|
"fs.readdirTypesSync",
|
|
2658
2459
|
"url.new",
|
|
2460
|
+
"url.newBase",
|
|
2659
2461
|
"url.fileURLToPathUrl",
|
|
2462
|
+
"url.fileURLToPathChecked",
|
|
2660
2463
|
"url.fileURLToPathStr",
|
|
2661
2464
|
// The win32-target flavor of pathToFileURL (same runtime entry point —
|
|
2662
2465
|
// the bridge dispatches by the binary's platform): Node's win32 arm
|
|
2663
2466
|
// raises ERR_INVALID_ARG_VALUE TypeErrors for malformed UNC inputs, so
|
|
2664
2467
|
// only THIS flavor seeds may-throw — posix emission stays untouched.
|
|
2665
2468
|
"url.pathToFileURLWin32",
|
|
2469
|
+
"url.pathToFileURLPlatform",
|
|
2666
2470
|
// URLSearchParams from a string[][]: Node's ERR_INVALID_TUPLE TypeError
|
|
2667
2471
|
// on a row that is not a [name, value] pair. The rest of the sp family
|
|
2668
2472
|
// never throws.
|
|
2669
2473
|
"sp.fromPairs",
|
|
2474
|
+
"sp.newChecked",
|
|
2670
2475
|
"fs.statSync",
|
|
2671
2476
|
"crypto.randomBytesToString",
|
|
2672
2477
|
"crypto.randomBytes",
|
|
@@ -2693,6 +2498,7 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2693
2498
|
"crypto.pbkdf2Cb",
|
|
2694
2499
|
"buffer.concat",
|
|
2695
2500
|
"buffer.concatLen",
|
|
2501
|
+
"buffer.fromDyn",
|
|
2696
2502
|
// The checked-dynamic compare/equals validators: Node's argument
|
|
2697
2503
|
// ladders throw ERR_INVALID_ARG_TYPE / ERR_OUT_OF_RANGE catchably.
|
|
2698
2504
|
"buffer.compareChk",
|
|
@@ -2720,6 +2526,7 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2720
2526
|
"emitter.setDefaultMaxChk",
|
|
2721
2527
|
"fs.readFileSyncBytes",
|
|
2722
2528
|
"fs.writeFileSyncBytes",
|
|
2529
|
+
"fs.appendFileSyncBytes",
|
|
2723
2530
|
"zlib.inflateSync",
|
|
2724
2531
|
"zlib.inflateRawSync",
|
|
2725
2532
|
"zlib.gunzipSync",
|