@scriptc/compiler 0.1.6 → 0.2.0
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 +73 -25
- package/ambient/scriptc-overrides.d.ts +10 -6
- package/ambient/scriptc.d.ts +28 -5
- 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 +107 -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/debug-symbols.d.ts +8 -0
- package/dist/backend/debug-symbols.js +52 -0
- package/dist/backend/debug-symbols.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 +2 -1
- package/dist/backend/link-plan.js +18 -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 +9 -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 +4 -0
- package/dist/backend/llvm/blocks.js +25 -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 +70 -28
- 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.d.ts +32 -0
- package/dist/backend/llvm/debug-info.js +198 -0
- package/dist/backend/llvm/debug-info.js.map +1 -0
- 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 +16 -2
- package/dist/backend/llvm/dyn.js +498 -175
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +598 -1
- package/dist/backend/llvm/emitter.js +739 -409
- 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 +1 -1
- package/dist/backend/llvm/expr-bytes.js +32 -14
- 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 +9 -5
- 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 +72 -74
- 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 +51 -30
- 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 +43 -4
- 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 +102 -121
- 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 +59 -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 +21 -16
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +125 -1
- 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 +35 -130
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/split.js +4 -1
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +26 -1
- package/dist/backend/llvm/split.test.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 +10 -25
- package/dist/backend/native-toolchain.js +89 -219
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +15 -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 +70 -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/source-locations.d.ts +12 -0
- package/dist/backend/source-locations.js +32 -0
- package/dist/backend/source-locations.js.map +1 -0
- package/dist/backend/source-locations.test.d.ts +1 -0
- package/dist/backend/source-locations.test.js +16 -0
- package/dist/backend/source-locations.test.js.map +1 -0
- 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 +95 -30
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +65 -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 +3 -3
- 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.d.ts +4 -0
- package/dist/diagnostics/diagnostic.js +15 -3
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +3 -4
- package/dist/executable/executable-cache.js +33 -10
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +38 -16
- 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 +4 -0
- package/dist/frontend/arguments-usage.js +40 -0
- package/dist/frontend/arguments-usage.js.map +1 -0
- package/dist/frontend/binding-source.d.ts +4 -0
- package/dist/frontend/binding-source.js +18 -0
- package/dist/frontend/binding-source.js.map +1 -0
- 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 +63 -0
- package/dist/frontend/lowering/class-callbacks.js.map +1 -0
- package/dist/frontend/lowering/class-descriptors.d.ts +9 -0
- package/dist/frontend/lowering/class-descriptors.js +73 -0
- package/dist/frontend/lowering/class-descriptors.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +41 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +803 -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 +92 -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 +64 -0
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -0
- package/dist/frontend/lowering/class-method-values.d.ts +10 -0
- package/dist/frontend/lowering/class-method-values.js +170 -0
- package/dist/frontend/lowering/class-method-values.js.map +1 -0
- package/dist/frontend/lowering/class-prototypes.d.ts +16 -0
- package/dist/frontend/lowering/class-prototypes.js +134 -0
- package/dist/frontend/lowering/class-prototypes.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 +164 -155
- 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 +39 -16
- 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 +11 -0
- package/dist/frontend/lowering/error-methods.js +78 -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 +49 -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 +124 -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 +485 -185
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +5 -6
- package/dist/frontend/lowering/expressions/optional-chains.js +27 -14
- 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 +93 -0
- package/dist/frontend/lowering/function-context.js +103 -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 +10 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +105 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +2 -1
- package/dist/frontend/lowering/lib-boundary.js +59 -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 +12 -0
- package/dist/frontend/lowering/lower-builtin-values.js +139 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +27 -41
- package/dist/frontend/lowering/lower-builtins.js +553 -346
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +22 -26
- package/dist/frontend/lowering/lower-calls.js +1373 -380
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +83 -45
- package/dist/frontend/lowering/lower-classes.js +952 -339
- 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 +27 -32
- package/dist/frontend/lowering/lower-containers.js +796 -151
- 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.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 +35 -11
- package/dist/frontend/lowering/lower-exprs.js +1785 -790
- 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 +77 -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 +5 -8
- package/dist/frontend/lowering/lower-island.js +34 -23
- 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 +252 -38
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- 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 +10 -14
- package/dist/frontend/lowering/lower-stmts.js +731 -532
- 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 +19 -10
- 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 +113 -189
- package/dist/frontend/lowering/lowerer.js +1033 -663
- 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 +26 -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 +9 -4
- package/dist/frontend/lowering/surfaces.js +98 -35
- 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 +10 -0
- package/dist/frontend/lowering/text-decoder-encoding.js +77 -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 +5 -4
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +1 -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 +43 -19
- package/dist/frontend/program.js +556 -197
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.d.ts +1 -0
- package/dist/frontend/program.test.js +202 -0
- package/dist/frontend/program.test.js.map +1 -0
- 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 +21 -15
- 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 +52 -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 +29 -19
- package/dist/frontend/type-mapper.js +713 -306
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.d.ts +1 -0
- package/dist/frontend/type-mapper.test.js +207 -0
- package/dist/frontend/type-mapper.test.js.map +1 -0
- 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 -197
- package/dist/index.js +369 -1567
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +16 -4
- package/dist/ir/analysis.js +25 -6
- 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 +309 -164
- package/dist/ir/ir.js +588 -879
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +127 -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 +19 -12
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.d.ts +1 -0
- package/dist/ir/serialize.test.js +53 -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 +1956 -1496
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +476 -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/compiler-self-identity.d.ts +1 -1
- package/dist/library/compiler-self-identity.js +31 -15
- package/dist/library/compiler-self-identity.js.map +1 -1
- package/dist/library/compiler-self-identity.test.d.ts +1 -0
- package/dist/library/compiler-self-identity.test.js +93 -0
- package/dist/library/compiler-self-identity.test.js.map +1 -0
- 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 +135 -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 +74 -0
- package/dist/native/toolchain.js.map +1 -0
- package/dist/native/toolchain.test.d.ts +1 -0
- package/dist/native/toolchain.test.js +33 -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 +171 -18
- 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 -531
- package/dist/backend/c/c-emitter.js +0 -1917
- 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 -8803
- 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 -1084
- 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 -1773
- 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;
|
|
@@ -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,21 +996,37 @@ 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
1019
|
export function canConvertToDyn(t, getRecord, getUnion) {
|
|
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
1027
|
if (canBoxDynComposite(t, getRecord, getUnion))
|
|
984
1028
|
return true;
|
|
985
|
-
if (t.kind === "bytes"
|
|
1029
|
+
if (t.kind === "bytes")
|
|
986
1030
|
return true;
|
|
987
1031
|
// %Error converts as the checked-dynamic tree's error encoding ({%error, name, message,
|
|
988
1032
|
// code?} — the caughtToDyn shape, scr_dyn_from_error): the dyn 'error'
|
|
@@ -991,6 +1035,10 @@ export function canConvertToDyn(t, getRecord, getUnion) {
|
|
|
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
1043
|
return canBoxFuncIntoDyn(t, getRecord, getUnion);
|
|
996
1044
|
if (DYN_HANDLE_KINDS.has(t.kind))
|
|
@@ -1013,14 +1061,14 @@ 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) ||
|
|
1064
|
+
isDynTypedRefType(a) || a.kind === "classval" || DYN_HANDLE_KINDS.has(a.kind) ||
|
|
1017
1065
|
(a.kind === "func" && canBoxFuncIntoDyn(a, getRecord, getUnion)) ||
|
|
1018
1066
|
(a.kind === "promise" && canConvertToDyn(a, getRecord, getUnion)));
|
|
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
1073
|
* sc_td_* walker's capability. Returns false for a composite carrying a
|
|
1026
1074
|
* kind the walker cannot box (Maps or handles nested in a record); those
|
|
@@ -1028,28 +1076,43 @@ export function canConvertToDyn(t, getRecord, getUnion) {
|
|
|
1028
1076
|
function canBoxDynComposite(t, getRecord, getUnion, visiting = new Set()) {
|
|
1029
1077
|
switch (t.kind) {
|
|
1030
1078
|
case "f64":
|
|
1079
|
+
case "bigint":
|
|
1080
|
+
case "symbol":
|
|
1031
1081
|
case "string":
|
|
1032
1082
|
case "bool":
|
|
1033
1083
|
case "dyn":
|
|
1034
1084
|
case "undefinedT":
|
|
1035
1085
|
case "nullT":
|
|
1086
|
+
case "classval":
|
|
1036
1087
|
return true;
|
|
1037
1088
|
case "bytes":
|
|
1038
|
-
|
|
1089
|
+
case "regex":
|
|
1090
|
+
case "url":
|
|
1091
|
+
return true;
|
|
1039
1092
|
case "func":
|
|
1040
1093
|
return canBoxFuncIntoDyn(t, getRecord, getUnion);
|
|
1094
|
+
case "set":
|
|
1095
|
+
return t.elem.kind === "dyn";
|
|
1096
|
+
case "map":
|
|
1097
|
+
return t.key.kind === "dyn" && t.value.kind === "dyn";
|
|
1098
|
+
case "object":
|
|
1099
|
+
return t.className === "%Error" || isDynTypedRefType(t);
|
|
1041
1100
|
case "array":
|
|
1042
1101
|
return canBoxDynComposite(t.elem, getRecord, getUnion, visiting);
|
|
1043
1102
|
case "record": {
|
|
1044
1103
|
const shape = getRecord(t.shapeId);
|
|
1045
1104
|
if (!shape)
|
|
1046
1105
|
return false;
|
|
1106
|
+
if (recordTextCodecClass(shape) !== null)
|
|
1107
|
+
return false;
|
|
1047
1108
|
// Recursive shapes answer coinductively, like isJsonSafeType.
|
|
1048
1109
|
if (visiting.has(t.shapeId))
|
|
1049
1110
|
return true;
|
|
1050
1111
|
visiting.add(t.shapeId);
|
|
1051
|
-
|
|
1052
|
-
|
|
1112
|
+
for (const field of shape.fields) {
|
|
1113
|
+
if (!canBoxDynComposite(field.type, getRecord, getUnion, visiting))
|
|
1114
|
+
return false;
|
|
1115
|
+
}
|
|
1053
1116
|
return !shape.indexValue || canBoxDynComposite(shape.indexValue, getRecord, getUnion, visiting);
|
|
1054
1117
|
}
|
|
1055
1118
|
case "union": {
|
|
@@ -1059,31 +1122,57 @@ function canBoxDynComposite(t, getRecord, getUnion, visiting = new Set()) {
|
|
|
1059
1122
|
if (visiting.has(t.unionId))
|
|
1060
1123
|
return true;
|
|
1061
1124
|
visiting.add(t.unionId);
|
|
1062
|
-
|
|
1125
|
+
for (const arm of def.arms) {
|
|
1126
|
+
if (!canBoxDynComposite(arm, getRecord, getUnion, visiting))
|
|
1127
|
+
return false;
|
|
1128
|
+
}
|
|
1129
|
+
return true;
|
|
1063
1130
|
}
|
|
1064
1131
|
default:
|
|
1065
1132
|
return false;
|
|
1066
1133
|
}
|
|
1067
1134
|
}
|
|
1068
1135
|
/** A type a dyn value can be VALIDATED into — the dynCheck domain:
|
|
1069
|
-
* JSON-safe data,
|
|
1136
|
+
* JSON-safe data, numeric typed arrays (retained views), the %Error extraction,
|
|
1070
1137
|
* undefined-armed unions of JSON-safe arms, adaptable function types,
|
|
1071
1138
|
* and the runtime HANDLE kinds (a tag-checked reference unwrap —
|
|
1072
1139
|
* DYN_HANDLE_KINDS). */
|
|
1073
1140
|
export function canDynCheckTo(t, getRecord, getUnion) {
|
|
1074
|
-
|
|
1141
|
+
// Unknown fields keep an owned dyn subtree; checking the surrounding
|
|
1142
|
+
// record/array still validates its layout. This is broader than the
|
|
1143
|
+
// stringify/island JSON domain, which cannot assume opaque slots are
|
|
1144
|
+
// serializable. Backends already retain dyn fields and fill missing
|
|
1145
|
+
// unknown record fields with the undefined value.
|
|
1146
|
+
if (isJsonSafeAt(t, getRecord, getUnion, false, false, new Set(), true))
|
|
1075
1147
|
return true;
|
|
1076
|
-
if (t.kind === "
|
|
1148
|
+
if (t.kind === "bigint" || t.kind === "symbol" || t.kind === "set" && t.elem.kind === "dyn")
|
|
1149
|
+
return true;
|
|
1150
|
+
if (t.kind === "map" && t.key.kind === "dyn" && t.value.kind === "dyn")
|
|
1151
|
+
return true;
|
|
1152
|
+
if (t.kind === "bytes")
|
|
1153
|
+
return true;
|
|
1154
|
+
if (t.kind === "classval")
|
|
1155
|
+
return true;
|
|
1156
|
+
if (t.kind === "generator")
|
|
1077
1157
|
return true;
|
|
1078
1158
|
if (t.kind === "object" && t.className === "%Error")
|
|
1079
1159
|
return true;
|
|
1160
|
+
// Native class capsules already support checked extraction at ordinary
|
|
1161
|
+
// boundaries. Callable adapters use the same identity/brand check.
|
|
1162
|
+
if (isDynTypedRefType(t))
|
|
1163
|
+
return true;
|
|
1164
|
+
if (t.kind === "array" && isDynTypedRefType(t.elem))
|
|
1165
|
+
return true;
|
|
1080
1166
|
if (t.kind === "func")
|
|
1081
1167
|
return canAdaptDynFuncTo(t, getRecord, getUnion);
|
|
1082
1168
|
if (DYN_HANDLE_KINDS.has(t.kind))
|
|
1083
1169
|
return true;
|
|
1084
1170
|
if (t.kind === "union") {
|
|
1085
1171
|
const def = getUnion(t.unionId);
|
|
1086
|
-
|
|
1172
|
+
// Optional native callbacks and handles retain the same checked
|
|
1173
|
+
// conversion as their bare value. The union matcher selects the arm
|
|
1174
|
+
// before its adapter/extractor runs.
|
|
1175
|
+
return !!def && def.arms.every((a) => isUnitType(a) || (a.kind !== "union" && canDynCheckTo(a, getRecord, getUnion)));
|
|
1087
1176
|
}
|
|
1088
1177
|
return false;
|
|
1089
1178
|
}
|
|
@@ -1093,10 +1182,11 @@ export function canDynCheckTo(t, getRecord, getUnion) {
|
|
|
1093
1182
|
* back). */
|
|
1094
1183
|
export function canBoxFuncIntoDyn(t, getRecord, getUnion) {
|
|
1095
1184
|
return (t.kind === "func" &&
|
|
1096
|
-
//
|
|
1097
|
-
//
|
|
1098
|
-
//
|
|
1099
|
-
(t.rest !== true || t.restAbi === undefined
|
|
1185
|
+
// Typed rest occupies the final native array parameter; its thunk
|
|
1186
|
+
// checks a fresh array containing all remaining call arguments.
|
|
1187
|
+
// Island rest keeps its separate engine host-callback adapter.
|
|
1188
|
+
(t.rest !== true || t.restAbi === undefined ||
|
|
1189
|
+
(t.restAbi === "typed" && t.params.at(-1)?.kind === "array")) &&
|
|
1100
1190
|
// A jsval (island) param converts through scr_jsval_from_dyn in the
|
|
1101
1191
|
// thunk (wrapped cells unwrap by reference, dyn data deep-copies) —
|
|
1102
1192
|
// the checker-'any' callback params of the routed-dispatch lane
|
|
@@ -1113,10 +1203,9 @@ export function canBoxFuncIntoDyn(t, getRecord, getUnion) {
|
|
|
1113
1203
|
* result). */
|
|
1114
1204
|
export function canAdaptDynFuncTo(t, getRecord, getUnion) {
|
|
1115
1205
|
return (t.kind === "func" &&
|
|
1116
|
-
//
|
|
1117
|
-
//
|
|
1118
|
-
|
|
1119
|
-
t.rest !== true &&
|
|
1206
|
+
// Checked rest and arguments packs retain all actual arguments. Typed
|
|
1207
|
+
// and island rest ABIs still require their own conversion plan.
|
|
1208
|
+
(t.rest !== true || t.restAbi === undefined) &&
|
|
1120
1209
|
t.params.every((p) => p.kind === "dyn" || canConvertToDyn(p, getRecord, getUnion)) &&
|
|
1121
1210
|
(t.ret.kind === "void" || t.ret.kind === "dyn" || canDynCheckTo(t.ret, getRecord, getUnion)));
|
|
1122
1211
|
}
|
|
@@ -1177,130 +1266,224 @@ export function canExitIslandToType(t, getRecord, getUnion) {
|
|
|
1177
1266
|
}
|
|
1178
1267
|
return false;
|
|
1179
1268
|
}
|
|
1269
|
+
const DYN_ASYNC_LIB_FNS = new Set([
|
|
1270
|
+
"async.awaitDyn", "timers.immediatePromise",
|
|
1271
|
+
"process.onUncaughtException", "process.offUncaughtException",
|
|
1272
|
+
"process.onUnhandledRejection", "process.offUnhandledRejection",
|
|
1273
|
+
"process.onRejectionHandled", "process.offRejectionHandled",
|
|
1274
|
+
"process.onWarning", "process.offWarning", "process.emitWarning",
|
|
1275
|
+
"als.new", "als.get", "als.run", "als.exitRun", "als.enterWith", "als.disable",
|
|
1276
|
+
"dc.chanBindStore", "dc.chanUnbindStore", "dc.chanRunStores",
|
|
1277
|
+
]);
|
|
1278
|
+
/** Inspect types and expressions together in one traversal. This is a fresh
|
|
1279
|
+
* snapshot: callers may mutate an IR module between compilation passes. */
|
|
1280
|
+
export function moduleRuntimeFeatures(mod) {
|
|
1281
|
+
return scanRuntimeFeatures(mod);
|
|
1282
|
+
}
|
|
1283
|
+
function scanRuntimeFeatures(mod, stopAt) {
|
|
1284
|
+
const features = {
|
|
1285
|
+
regex: false, copying: false, legacyTextDecoder: false, fileHandle: false,
|
|
1286
|
+
fetch: mod.embedded?.modules.some((m) => m.usesFetch === true) ?? false,
|
|
1287
|
+
processEvents: false, emitter: (mod.classes ?? []).some((c) => c.name === RUNTIME_EMITTER_CLASS),
|
|
1288
|
+
stream: (mod.classes ?? []).some((c) => RUNTIME_STREAM_CLASSES.has(c.name)),
|
|
1289
|
+
zlib: mod.embedded?.edges.some((e) => e.to === "node:zlib") ?? false,
|
|
1290
|
+
dc: false, assert: false, dynInvoke: false, dynAsync: false, inspect: false,
|
|
1291
|
+
childProcess: false, net: false, symbol: false, bigint: false, searchParams: false,
|
|
1292
|
+
qs: false, parseArgs: false, fsWatch: false, nodeTest: false, dgram: false,
|
|
1293
|
+
http: false, http2: false, tls: false, tlsCa: false,
|
|
1294
|
+
};
|
|
1295
|
+
const keepGoing = () => stopAt === undefined || !features[stopAt];
|
|
1296
|
+
const expr = (node) => {
|
|
1297
|
+
if (node.kind === "libCall") {
|
|
1298
|
+
const fn = node.fn;
|
|
1299
|
+
if (fn === "regexp.escape" || fn === "dyn.nativeRegexIs")
|
|
1300
|
+
features.regex = true;
|
|
1301
|
+
if (fn === "text.decodeLegacy")
|
|
1302
|
+
features.legacyTextDecoder = true;
|
|
1303
|
+
if (fn.startsWith("fetch."))
|
|
1304
|
+
features.fetch = true;
|
|
1305
|
+
if (PROCESS_EVENT_LIB_FNS.has(fn))
|
|
1306
|
+
features.processEvents = true;
|
|
1307
|
+
if (fn.startsWith("emitter."))
|
|
1308
|
+
features.emitter = true;
|
|
1309
|
+
if (fn.startsWith("readable.") || fn.startsWith("writable.") || fn.startsWith("duplex.") ||
|
|
1310
|
+
fn.startsWith("transform.") || fn.startsWith("passthrough.") || fn.startsWith("sc.") ||
|
|
1311
|
+
fn.startsWith("stream.set") || fn === "stream.destroy" || fn === "stream.destroyErr" ||
|
|
1312
|
+
fn === "stream.prop" || fn === "stream.errored" || fn === "sp.finished" || fn === "sp.pipeline")
|
|
1313
|
+
features.stream = true;
|
|
1314
|
+
if (fn.startsWith("zlib."))
|
|
1315
|
+
features.zlib = true;
|
|
1316
|
+
if (fn.startsWith("dc."))
|
|
1317
|
+
features.dc = true;
|
|
1318
|
+
if (fn.startsWith("assert."))
|
|
1319
|
+
features.assert = true;
|
|
1320
|
+
if (fn === "dyn.defineProps" || fn === "dyn.defineProperty" || fn === "dyn.objCreateWithProperties" || fn === "dyn.arrayProtoCall" || fn === "dyn.arrayPrototype")
|
|
1321
|
+
features.dynInvoke = true;
|
|
1322
|
+
if (DYN_ASYNC_LIB_FNS.has(fn))
|
|
1323
|
+
features.dynAsync = true;
|
|
1324
|
+
if (fn.startsWith("insp.") || fn === "console.native" || fn === "global.native")
|
|
1325
|
+
features.inspect = true;
|
|
1326
|
+
if (fn.startsWith("cp.") || fn.startsWith("child.") || fn.startsWith("writer.") || fn.startsWith("spawnRes.") ||
|
|
1327
|
+
fn === "process.forkTarget" || fn === "process.connected" || fn === "process.send" || fn === "process.sendCb" ||
|
|
1328
|
+
fn === "process.disconnect" || fn === "process.onMessage" || fn === "process.onDisconnect")
|
|
1329
|
+
features.childProcess = true;
|
|
1330
|
+
if (fn.startsWith("net."))
|
|
1331
|
+
features.net = true;
|
|
1332
|
+
if (fn.startsWith("http.")) {
|
|
1333
|
+
features.net = true;
|
|
1334
|
+
features.http = true;
|
|
1335
|
+
}
|
|
1336
|
+
if (fn.startsWith("tls.") || fn.startsWith("https.") || fn.startsWith("http2.")) {
|
|
1337
|
+
features.net = true;
|
|
1338
|
+
features.http = true;
|
|
1339
|
+
features.tls = true;
|
|
1340
|
+
}
|
|
1341
|
+
if (fn.startsWith("http2.") && !HTTP2_LEGACY_FNS.has(fn))
|
|
1342
|
+
features.http2 = true;
|
|
1343
|
+
if (fn.startsWith("sym."))
|
|
1344
|
+
features.symbol = true;
|
|
1345
|
+
if (fn === "process.hrtimeValue")
|
|
1346
|
+
features.bigint = true;
|
|
1347
|
+
if (fn.startsWith("bigint."))
|
|
1348
|
+
features.bigint = true;
|
|
1349
|
+
if (fn.startsWith("sp.") || fn === "url.searchParams")
|
|
1350
|
+
features.searchParams = true;
|
|
1351
|
+
if (fn === "qs.parse" || fn === "qs.stringify" || fn === "qs.unescape")
|
|
1352
|
+
features.qs = true;
|
|
1353
|
+
if (fn === "util.parseArgs")
|
|
1354
|
+
features.parseArgs = true;
|
|
1355
|
+
if (fn.startsWith("fs.watch") || fn.startsWith("watcher."))
|
|
1356
|
+
features.fsWatch = true;
|
|
1357
|
+
if (fn.startsWith("test."))
|
|
1358
|
+
features.nodeTest = true;
|
|
1359
|
+
if (fn.startsWith("dgram.") || fn.startsWith("dns."))
|
|
1360
|
+
features.dgram = true;
|
|
1361
|
+
if (fn.startsWith("tlsca."))
|
|
1362
|
+
features.tlsCa = true;
|
|
1363
|
+
}
|
|
1364
|
+
else {
|
|
1365
|
+
switch (node.kind) {
|
|
1366
|
+
case "regexLit":
|
|
1367
|
+
case "regexIntrinsic":
|
|
1368
|
+
features.regex = true;
|
|
1369
|
+
break;
|
|
1370
|
+
case "strIntrinsic":
|
|
1371
|
+
if (node.method === "toLowerCase" || node.method === "toUpperCase")
|
|
1372
|
+
features.regex = true;
|
|
1373
|
+
break;
|
|
1374
|
+
case "arrIntrinsic":
|
|
1375
|
+
if (node.method === "toReversed" || node.method === "toSpliced" || node.method === "with" || node.method === "withUndefined")
|
|
1376
|
+
features.copying = true;
|
|
1377
|
+
break;
|
|
1378
|
+
case "bytesIntrinsic":
|
|
1379
|
+
if (node.method === "toReversed" || node.method === "with" || node.method === "join" || node.method === "toArray")
|
|
1380
|
+
features.copying = true;
|
|
1381
|
+
break;
|
|
1382
|
+
case "jsOp":
|
|
1383
|
+
if (node.op === "globalGet" && node.name === "fetch")
|
|
1384
|
+
features.fetch = true;
|
|
1385
|
+
break;
|
|
1386
|
+
case "dynInvoke":
|
|
1387
|
+
features.dynInvoke = true;
|
|
1388
|
+
break;
|
|
1389
|
+
case "awaitExpr":
|
|
1390
|
+
if (node.type.kind === "dyn")
|
|
1391
|
+
features.dynAsync = true;
|
|
1392
|
+
break;
|
|
1393
|
+
case "dynFrom": {
|
|
1394
|
+
const boxed = node.value.type;
|
|
1395
|
+
if (boxed.kind === "promise" || (boxed.kind === "func" && boxed.ret.kind === "promise"))
|
|
1396
|
+
features.dynAsync = true;
|
|
1397
|
+
break;
|
|
1398
|
+
}
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
return keepGoing();
|
|
1402
|
+
};
|
|
1403
|
+
const type = (node) => {
|
|
1404
|
+
switch (node.kind) {
|
|
1405
|
+
case "regex":
|
|
1406
|
+
features.regex = true;
|
|
1407
|
+
break;
|
|
1408
|
+
case "fileHandle":
|
|
1409
|
+
features.fileHandle = true;
|
|
1410
|
+
break;
|
|
1411
|
+
case "child":
|
|
1412
|
+
case "childStream":
|
|
1413
|
+
case "childWriter":
|
|
1414
|
+
case "spawnRes":
|
|
1415
|
+
features.childProcess = true;
|
|
1416
|
+
break;
|
|
1417
|
+
case "netServer":
|
|
1418
|
+
case "netSocket":
|
|
1419
|
+
features.net = true;
|
|
1420
|
+
break;
|
|
1421
|
+
case "http2Session":
|
|
1422
|
+
case "http2Stream":
|
|
1423
|
+
features.net = true;
|
|
1424
|
+
features.http2 = true;
|
|
1425
|
+
break;
|
|
1426
|
+
case "httpReq":
|
|
1427
|
+
case "httpRes":
|
|
1428
|
+
case "httpClientReq":
|
|
1429
|
+
features.net = true;
|
|
1430
|
+
features.http = true;
|
|
1431
|
+
break;
|
|
1432
|
+
case "secureCtx":
|
|
1433
|
+
features.net = true;
|
|
1434
|
+
features.http = true;
|
|
1435
|
+
features.tls = true;
|
|
1436
|
+
break;
|
|
1437
|
+
case "symbol":
|
|
1438
|
+
features.symbol = true;
|
|
1439
|
+
break;
|
|
1440
|
+
case "bigint":
|
|
1441
|
+
features.bigint = true;
|
|
1442
|
+
break;
|
|
1443
|
+
case "searchParams":
|
|
1444
|
+
features.searchParams = true;
|
|
1445
|
+
break;
|
|
1446
|
+
case "fsWatcher":
|
|
1447
|
+
features.fsWatch = true;
|
|
1448
|
+
break;
|
|
1449
|
+
case "testCtx":
|
|
1450
|
+
features.nodeTest = true;
|
|
1451
|
+
break;
|
|
1452
|
+
case "dgramSocket":
|
|
1453
|
+
features.dgram = true;
|
|
1454
|
+
break;
|
|
1455
|
+
}
|
|
1456
|
+
return keepGoing();
|
|
1457
|
+
};
|
|
1458
|
+
if (keepGoing())
|
|
1459
|
+
everyModuleNode(mod, { expr, stmt: keepGoing, type });
|
|
1460
|
+
return features;
|
|
1461
|
+
}
|
|
1180
1462
|
/** True when the module contains any regex construct — a regexLit /
|
|
1181
1463
|
* regexIntrinsic node or a regex-typed slot anywhere. This is the link
|
|
1182
1464
|
* 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. */
|
|
1465
|
+
* (native-toolchain.ts); regex-free programs keep the historical command line. The
|
|
1466
|
+
* typed traversal visits type slots as well as executable nodes. */
|
|
1186
1467
|
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;
|
|
1468
|
+
return scanRuntimeFeatures(mod, "regex").regex;
|
|
1221
1469
|
}
|
|
1222
1470
|
/** True when the module contains an intrinsic whose implementation lives
|
|
1223
1471
|
* in scr_copying.c. This is the link switch that keeps the optional
|
|
1224
1472
|
* Array-copying and typed-array bridge TU out of unrelated binaries. */
|
|
1225
1473
|
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;
|
|
1474
|
+
return scanRuntimeFeatures(mod, "copying").copying;
|
|
1257
1475
|
}
|
|
1258
1476
|
/** True when a non-UTF-8 TextDecoder call survives lowering. This gates the
|
|
1259
1477
|
* generated legacy mapping tables inside scr_bytes.c; the default UTF-8
|
|
1260
1478
|
* decoder and unrelated Buffer users keep their prior runtime object. */
|
|
1261
1479
|
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;
|
|
1480
|
+
return scanRuntimeFeatures(mod, "legacyTextDecoder").legacyTextDecoder;
|
|
1281
1481
|
}
|
|
1282
1482
|
/** True when a FileHandle type survives in the module. This is the link
|
|
1283
1483
|
* switch for scr_file_handle.c; fs/promises.open carries the type inside its
|
|
1284
1484
|
* promise result even when no handle method is called. */
|
|
1285
1485
|
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;
|
|
1486
|
+
return scanRuntimeFeatures(mod, "fileHandle").fileHandle;
|
|
1304
1487
|
}
|
|
1305
1488
|
/** True when user code lowers static fetch or the embedded npm graph
|
|
1306
1489
|
* reaches the engine's global fetch — the link switch that pulls scr_fetch.c +
|
|
@@ -1310,35 +1493,12 @@ export function moduleUsesFileHandle(mod) {
|
|
|
1310
1493
|
* and local `fetch` bindings do not change the link or target capability.
|
|
1311
1494
|
* Fetch-free graphs keep their exact historical link lines. */
|
|
1312
1495
|
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;
|
|
1496
|
+
return scanRuntimeFeatures(mod, "fetch").fetch;
|
|
1338
1497
|
}
|
|
1339
1498
|
/** The libCall fns served by the OPTIONAL events unit (scr_events.c):
|
|
1340
1499
|
* process signal/exit listeners and the piped-stdin surface. */
|
|
1341
1500
|
const PROCESS_EVENT_LIB_FNS = new Set([
|
|
1501
|
+
"process.stdio",
|
|
1342
1502
|
"process.onSignal",
|
|
1343
1503
|
"process.offSignal",
|
|
1344
1504
|
"process.onExit",
|
|
@@ -1360,25 +1520,7 @@ const PROCESS_EVENT_LIB_FNS = new Set([
|
|
|
1360
1520
|
* gating precedent). Event-free programs pay zero bytes and keep their
|
|
1361
1521
|
* exact link line. Same generic-walk shape as moduleUsesRegex. */
|
|
1362
1522
|
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;
|
|
1523
|
+
return scanRuntimeFeatures(mod, "processEvents").processEvents;
|
|
1382
1524
|
}
|
|
1383
1525
|
/** True when the module uses the node:events EventEmitter surface — the
|
|
1384
1526
|
* link switch that pulls scr_events_emitter.c into the binary (native-toolchain.ts; the
|
|
@@ -1390,27 +1532,7 @@ export function moduleUsesProcessEvents(mod) {
|
|
|
1390
1532
|
* no emitter-typed value). Emitter-free programs pay zero bytes and keep
|
|
1391
1533
|
* their exact link line. */
|
|
1392
1534
|
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;
|
|
1535
|
+
return scanRuntimeFeatures(mod, "emitter").emitter;
|
|
1414
1536
|
}
|
|
1415
1537
|
/** True when the program touches the node:stream surface (scr_stream.c —
|
|
1416
1538
|
* the moduleUsesEmitter story: the class defs ride the module whenever a
|
|
@@ -1420,36 +1542,7 @@ export function moduleUsesEmitter(mod) {
|
|
|
1420
1542
|
* moduleUsesEmitter answers true whenever this does. Stream-free
|
|
1421
1543
|
* programs pay zero bytes and keep their exact link line. */
|
|
1422
1544
|
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;
|
|
1545
|
+
return scanRuntimeFeatures(mod, "stream").stream;
|
|
1453
1546
|
}
|
|
1454
1547
|
/** True when the embedded npm graph has an edge into `builtin` — the
|
|
1455
1548
|
* island shim needs the corresponding native bridge linked (zlib's is
|
|
@@ -1458,7 +1551,7 @@ export function moduleEmbedsBuiltin(mod, builtin) {
|
|
|
1458
1551
|
return mod.embedded !== undefined && mod.embedded.edges.some((e) => e.to === builtin);
|
|
1459
1552
|
}
|
|
1460
1553
|
/** Embedded module texts at least this long are DEFLATE-compressed into
|
|
1461
|
-
* the emitted
|
|
1554
|
+
* the emitted LLVM (island.ts; each stays plain when deflate does not
|
|
1462
1555
|
* shrink it) and inflated lazily by the island's module loader at first
|
|
1463
1556
|
* load. Below it the zlib round trip cannot pay for itself. */
|
|
1464
1557
|
export const NPM_COMPRESS_MIN = 1024;
|
|
@@ -1478,52 +1571,14 @@ export function moduleEmbedsCompressedNpm(mod) {
|
|
|
1478
1571
|
* generic-walk shape as moduleUsesRegex: `kind`/`fn` discriminants live
|
|
1479
1572
|
* only on IR objects. */
|
|
1480
1573
|
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;
|
|
1574
|
+
return scanRuntimeFeatures(mod, "zlib").zlib;
|
|
1502
1575
|
}
|
|
1503
1576
|
/** True when the module contains any dc.* libCall — the link switch that
|
|
1504
1577
|
* pulls scr_dc.c (the diagnostics_channel registry and pub/sub) into the
|
|
1505
1578
|
* binary (native-toolchain.ts). Channel-free binaries keep their exact size class.
|
|
1506
1579
|
* Same walk shape as moduleUsesZlib. */
|
|
1507
1580
|
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;
|
|
1581
|
+
return scanRuntimeFeatures(mod, "dc").dc;
|
|
1527
1582
|
}
|
|
1528
1583
|
/** True when the module contains any assert libCall — the link switch
|
|
1529
1584
|
* that pulls scr_assert.c into the binary (native-toolchain.ts). scr_regex.c calls the
|
|
@@ -1532,25 +1587,7 @@ export function moduleUsesDc(mod) {
|
|
|
1532
1587
|
* the historical command line and size. Same walk shape as
|
|
1533
1588
|
* moduleUsesZlib. */
|
|
1534
1589
|
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;
|
|
1590
|
+
return scanRuntimeFeatures(mod, "assert").assert;
|
|
1554
1591
|
}
|
|
1555
1592
|
/** True when the module contains any dynInvoke node or dyn.defineProps
|
|
1556
1593
|
* libCall — the link switch that pulls scr_dyn_invoke.c (the prototype-
|
|
@@ -1559,25 +1596,7 @@ export function moduleUsesAssert(mod) {
|
|
|
1559
1596
|
* precedent — dispatch-free binaries keep their exact size class). Same
|
|
1560
1597
|
* walk shape as moduleUsesZlib. */
|
|
1561
1598
|
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;
|
|
1599
|
+
return scanRuntimeFeatures(mod, "dynInvoke").dynInvoke;
|
|
1581
1600
|
}
|
|
1582
1601
|
/** True when the module contains any insp libCall — the link switch that
|
|
1583
1602
|
* pulls scr_inspect.c into the binary (native-toolchain.ts; the assert gating
|
|
@@ -1590,94 +1609,16 @@ export function moduleUsesDynInvoke(mod) {
|
|
|
1590
1609
|
* dynInvoke and dc gates (their TUs call into this one) — native-toolchain.ts. Same
|
|
1591
1610
|
* walk shape as moduleUsesZlib. */
|
|
1592
1611
|
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
|
-
if (node.kind === "awaitExpr" && node.type !== undefined && node.type.kind === "dyn") {
|
|
1619
|
-
found = true;
|
|
1620
|
-
return;
|
|
1621
|
-
}
|
|
1622
|
-
for (const key of Object.keys(v))
|
|
1623
|
-
visit(v[key]);
|
|
1624
|
-
};
|
|
1625
|
-
visit(mod);
|
|
1626
|
-
return found;
|
|
1612
|
+
return scanRuntimeFeatures(mod, "dynAsync").dynAsync;
|
|
1627
1613
|
}
|
|
1628
1614
|
export function moduleUsesInspect(mod) {
|
|
1629
|
-
|
|
1630
|
-
const visit = (v) => {
|
|
1631
|
-
if (found || v === null || typeof v !== "object")
|
|
1632
|
-
return;
|
|
1633
|
-
if (Array.isArray(v)) {
|
|
1634
|
-
for (const item of v)
|
|
1635
|
-
visit(item);
|
|
1636
|
-
return;
|
|
1637
|
-
}
|
|
1638
|
-
const node = v;
|
|
1639
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("insp.")) {
|
|
1640
|
-
found = true;
|
|
1641
|
-
return;
|
|
1642
|
-
}
|
|
1643
|
-
for (const key of Object.keys(v))
|
|
1644
|
-
visit(v[key]);
|
|
1645
|
-
};
|
|
1646
|
-
visit(mod);
|
|
1647
|
-
return found;
|
|
1615
|
+
return scanRuntimeFeatures(mod, "inspect").inspect;
|
|
1648
1616
|
}
|
|
1649
1617
|
/** True when the module reaches child_process or carries one of its runtime
|
|
1650
1618
|
* handle/result types. Besides the existing link consequence, this gates the
|
|
1651
1619
|
* checked-dynamic ChildProcess handle table installed from scr_child.c. */
|
|
1652
1620
|
export function moduleUsesChildProcess(mod) {
|
|
1653
|
-
|
|
1654
|
-
const visit = (v) => {
|
|
1655
|
-
if (found || v === null || typeof v !== "object")
|
|
1656
|
-
return;
|
|
1657
|
-
if (Array.isArray(v)) {
|
|
1658
|
-
for (const item of v)
|
|
1659
|
-
visit(item);
|
|
1660
|
-
return;
|
|
1661
|
-
}
|
|
1662
|
-
const node = v;
|
|
1663
|
-
if (node.kind === "libCall" &&
|
|
1664
|
-
typeof node.fn === "string" &&
|
|
1665
|
-
(node.fn.startsWith("cp.") || node.fn.startsWith("child.") || node.fn.startsWith("writer.") || node.fn.startsWith("spawnRes.") ||
|
|
1666
|
-
node.fn === "process.forkTarget" || node.fn === "process.connected" || node.fn === "process.send" ||
|
|
1667
|
-
node.fn === "process.sendCb" || node.fn === "process.disconnect" || node.fn === "process.onMessage" ||
|
|
1668
|
-
node.fn === "process.onDisconnect")) {
|
|
1669
|
-
found = true;
|
|
1670
|
-
return;
|
|
1671
|
-
}
|
|
1672
|
-
if (node.kind === "child" || node.kind === "childStream" || node.kind === "childWriter" || node.kind === "spawnRes") {
|
|
1673
|
-
found = true;
|
|
1674
|
-
return;
|
|
1675
|
-
}
|
|
1676
|
-
for (const key of Object.keys(v))
|
|
1677
|
-
visit(v[key]);
|
|
1678
|
-
};
|
|
1679
|
-
visit(mod);
|
|
1680
|
-
return found;
|
|
1621
|
+
return scanRuntimeFeatures(mod, "childProcess").childProcess;
|
|
1681
1622
|
}
|
|
1682
1623
|
/** True when the module contains any net libCall — the link switch that
|
|
1683
1624
|
* pulls scr_net.c into the binary and has the emitted main call
|
|
@@ -1685,42 +1626,7 @@ export function moduleUsesChildProcess(mod) {
|
|
|
1685
1626
|
* Net-free programs pay zero bytes and keep their exact link line. Same
|
|
1686
1627
|
* generic-walk shape as moduleUsesZlib. */
|
|
1687
1628
|
export function moduleUsesNet(mod) {
|
|
1688
|
-
|
|
1689
|
-
const visit = (v) => {
|
|
1690
|
-
if (found || v === null || typeof v !== "object")
|
|
1691
|
-
return;
|
|
1692
|
-
if (Array.isArray(v)) {
|
|
1693
|
-
for (const item of v)
|
|
1694
|
-
visit(item);
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
|
-
const node = v;
|
|
1698
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1699
|
-
(node.fn.startsWith("net.") || node.fn.startsWith("http.") ||
|
|
1700
|
-
node.fn.startsWith("tls.") || node.fn.startsWith("https.") ||
|
|
1701
|
-
node.fn.startsWith("http2."))) {
|
|
1702
|
-
// http/tls/https/http2 all ride ON net: their libCalls need scr_net.c
|
|
1703
|
-
// linked and installed too, so the net switch answers for every
|
|
1704
|
-
// server-family prefix.
|
|
1705
|
-
found = true;
|
|
1706
|
-
return;
|
|
1707
|
-
}
|
|
1708
|
-
// A net-family HANDLE TYPE anywhere in the IR (a global or local whose
|
|
1709
|
-
// initializing statement compiled to a runtime fence still carries the
|
|
1710
|
-
// type): its emitted release call needs the unit linked even when no
|
|
1711
|
-
// libCall survived the fencing.
|
|
1712
|
-
if (node.kind === "netServer" || node.kind === "netSocket" ||
|
|
1713
|
-
node.kind === "http2Session" || node.kind === "http2Stream" ||
|
|
1714
|
-
node.kind === "httpReq" || node.kind === "httpRes" ||
|
|
1715
|
-
node.kind === "httpClientReq" || node.kind === "secureCtx") {
|
|
1716
|
-
found = true;
|
|
1717
|
-
return;
|
|
1718
|
-
}
|
|
1719
|
-
for (const key of Object.keys(v))
|
|
1720
|
-
visit(v[key]);
|
|
1721
|
-
};
|
|
1722
|
-
visit(mod);
|
|
1723
|
-
return found;
|
|
1629
|
+
return scanRuntimeFeatures(mod, "net").net;
|
|
1724
1630
|
}
|
|
1725
1631
|
/** True when the module contains any sym.* libCall or a symbol-kind type
|
|
1726
1632
|
* anywhere in the IR — the link switch that pulls scr_symbol.c into the
|
|
@@ -1730,54 +1636,13 @@ export function moduleUsesNet(mod) {
|
|
|
1730
1636
|
* fence still emits release calls that need the unit linked. Symbol-free
|
|
1731
1637
|
* programs pay zero bytes and keep their exact link line. */
|
|
1732
1638
|
export function moduleUsesSymbol(mod) {
|
|
1733
|
-
|
|
1734
|
-
const visit = (v) => {
|
|
1735
|
-
if (found || v === null || typeof v !== "object")
|
|
1736
|
-
return;
|
|
1737
|
-
if (Array.isArray(v)) {
|
|
1738
|
-
for (const item of v)
|
|
1739
|
-
visit(item);
|
|
1740
|
-
return;
|
|
1741
|
-
}
|
|
1742
|
-
const node = v;
|
|
1743
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("sym.")) {
|
|
1744
|
-
found = true;
|
|
1745
|
-
return;
|
|
1746
|
-
}
|
|
1747
|
-
if (node.kind === "symbol") {
|
|
1748
|
-
found = true;
|
|
1749
|
-
return;
|
|
1750
|
-
}
|
|
1751
|
-
for (const key of Object.keys(v))
|
|
1752
|
-
visit(v[key]);
|
|
1753
|
-
};
|
|
1754
|
-
visit(mod);
|
|
1755
|
-
return found;
|
|
1639
|
+
return scanRuntimeFeatures(mod, "symbol").symbol;
|
|
1756
1640
|
}
|
|
1757
1641
|
/** True when bigint runtime operations or bigint-typed storage appears in
|
|
1758
1642
|
* the IR. The type check keeps retain/release references link-safe even
|
|
1759
1643
|
* when a producing statement was replaced by a runtime fence. */
|
|
1760
1644
|
export function moduleUsesBigInt(mod) {
|
|
1761
|
-
|
|
1762
|
-
const visit = (v) => {
|
|
1763
|
-
if (found || v === null || typeof v !== "object")
|
|
1764
|
-
return;
|
|
1765
|
-
if (Array.isArray(v)) {
|
|
1766
|
-
for (const item of v)
|
|
1767
|
-
visit(item);
|
|
1768
|
-
return;
|
|
1769
|
-
}
|
|
1770
|
-
const node = v;
|
|
1771
|
-
if (node.kind === "bigint" ||
|
|
1772
|
-
(node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("bigint."))) {
|
|
1773
|
-
found = true;
|
|
1774
|
-
return;
|
|
1775
|
-
}
|
|
1776
|
-
for (const key of Object.keys(v))
|
|
1777
|
-
visit(v[key]);
|
|
1778
|
-
};
|
|
1779
|
-
visit(mod);
|
|
1780
|
-
return found;
|
|
1645
|
+
return scanRuntimeFeatures(mod, "bigint").bigint;
|
|
1781
1646
|
}
|
|
1782
1647
|
/** True when the module uses the URLSearchParams surface — sp.* libCalls,
|
|
1783
1648
|
* the url.searchParams getter, or a searchParams-kind type anywhere on
|
|
@@ -1788,30 +1653,7 @@ export function moduleUsesBigInt(mod) {
|
|
|
1788
1653
|
* programs keep their exact link line; scr_url.c itself stays
|
|
1789
1654
|
* always-linked and never references the unit. */
|
|
1790
1655
|
export function moduleUsesSearchParams(mod) {
|
|
1791
|
-
|
|
1792
|
-
const visit = (v) => {
|
|
1793
|
-
if (found || v === null || typeof v !== "object")
|
|
1794
|
-
return;
|
|
1795
|
-
if (Array.isArray(v)) {
|
|
1796
|
-
for (const item of v)
|
|
1797
|
-
visit(item);
|
|
1798
|
-
return;
|
|
1799
|
-
}
|
|
1800
|
-
const node = v;
|
|
1801
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1802
|
-
(node.fn.startsWith("sp.") || node.fn === "url.searchParams")) {
|
|
1803
|
-
found = true;
|
|
1804
|
-
return;
|
|
1805
|
-
}
|
|
1806
|
-
if (node.kind === "searchParams") {
|
|
1807
|
-
found = true;
|
|
1808
|
-
return;
|
|
1809
|
-
}
|
|
1810
|
-
for (const key of Object.keys(v))
|
|
1811
|
-
visit(v[key]);
|
|
1812
|
-
};
|
|
1813
|
-
visit(mod);
|
|
1814
|
-
return found;
|
|
1656
|
+
return scanRuntimeFeatures(mod, "searchParams").searchParams;
|
|
1815
1657
|
}
|
|
1816
1658
|
/** True when the module uses the node:querystring surface — the qs.*
|
|
1817
1659
|
* libCalls that live in scr_qs.c (parse/stringify/unescape; qs.escape
|
|
@@ -1821,50 +1663,13 @@ export function moduleUsesSearchParams(mod) {
|
|
|
1821
1663
|
* loop hooks, cross-compiles everywhere). qs-free programs keep their
|
|
1822
1664
|
* exact link line. Same generic-walk shape as moduleUsesZlib. */
|
|
1823
1665
|
export function moduleUsesQs(mod) {
|
|
1824
|
-
|
|
1825
|
-
const visit = (v) => {
|
|
1826
|
-
if (found || v === null || typeof v !== "object")
|
|
1827
|
-
return;
|
|
1828
|
-
if (Array.isArray(v)) {
|
|
1829
|
-
for (const item of v)
|
|
1830
|
-
visit(item);
|
|
1831
|
-
return;
|
|
1832
|
-
}
|
|
1833
|
-
const node = v;
|
|
1834
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1835
|
-
(node.fn === "qs.parse" || node.fn === "qs.stringify" || node.fn === "qs.unescape")) {
|
|
1836
|
-
found = true;
|
|
1837
|
-
return;
|
|
1838
|
-
}
|
|
1839
|
-
for (const key of Object.keys(v))
|
|
1840
|
-
visit(v[key]);
|
|
1841
|
-
};
|
|
1842
|
-
visit(mod);
|
|
1843
|
-
return found;
|
|
1666
|
+
return scanRuntimeFeatures(mod, "qs").qs;
|
|
1844
1667
|
}
|
|
1845
1668
|
/** True when the module uses native util.parseArgs — the link switch for
|
|
1846
1669
|
* scr_util.c. The implementation is a pure checked-dynamic data transform,
|
|
1847
1670
|
* cross-platform and independent of the island's node:util shim. */
|
|
1848
1671
|
export function moduleUsesParseArgs(mod) {
|
|
1849
|
-
|
|
1850
|
-
const visit = (v) => {
|
|
1851
|
-
if (found || v === null || typeof v !== "object")
|
|
1852
|
-
return;
|
|
1853
|
-
if (Array.isArray(v)) {
|
|
1854
|
-
for (const item of v)
|
|
1855
|
-
visit(item);
|
|
1856
|
-
return;
|
|
1857
|
-
}
|
|
1858
|
-
const node = v;
|
|
1859
|
-
if (node.kind === "libCall" && node.fn === "util.parseArgs") {
|
|
1860
|
-
found = true;
|
|
1861
|
-
return;
|
|
1862
|
-
}
|
|
1863
|
-
for (const key of Object.keys(v))
|
|
1864
|
-
visit(v[key]);
|
|
1865
|
-
};
|
|
1866
|
-
visit(mod);
|
|
1867
|
-
return found;
|
|
1672
|
+
return scanRuntimeFeatures(mod, "parseArgs").parseArgs;
|
|
1868
1673
|
}
|
|
1869
1674
|
/** True when the module contains any fs.watch/watcher.* libCall — the
|
|
1870
1675
|
* link switch that pulls scr_watch.c into the binary and has the emitted
|
|
@@ -1872,32 +1677,7 @@ export function moduleUsesParseArgs(mod) {
|
|
|
1872
1677
|
* precedent). Watch-free programs pay zero bytes and keep their exact
|
|
1873
1678
|
* link line. Same generic-walk shape as moduleUsesZlib. */
|
|
1874
1679
|
export function moduleUsesFsWatch(mod) {
|
|
1875
|
-
|
|
1876
|
-
const visit = (v) => {
|
|
1877
|
-
if (found || v === null || typeof v !== "object")
|
|
1878
|
-
return;
|
|
1879
|
-
if (Array.isArray(v)) {
|
|
1880
|
-
for (const item of v)
|
|
1881
|
-
visit(item);
|
|
1882
|
-
return;
|
|
1883
|
-
}
|
|
1884
|
-
const node = v;
|
|
1885
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1886
|
-
(node.fn.startsWith("fs.watch") || node.fn.startsWith("watcher."))) {
|
|
1887
|
-
found = true;
|
|
1888
|
-
return;
|
|
1889
|
-
}
|
|
1890
|
-
// A watcher HANDLE TYPE left behind by a fenced statement still emits
|
|
1891
|
-
// scr_watcher_release — the unit must link.
|
|
1892
|
-
if (node.kind === "fsWatcher") {
|
|
1893
|
-
found = true;
|
|
1894
|
-
return;
|
|
1895
|
-
}
|
|
1896
|
-
for (const key of Object.keys(v))
|
|
1897
|
-
visit(v[key]);
|
|
1898
|
-
};
|
|
1899
|
-
visit(mod);
|
|
1900
|
-
return found;
|
|
1680
|
+
return scanRuntimeFeatures(mod, "fsWatch").fsWatch;
|
|
1901
1681
|
}
|
|
1902
1682
|
/** True when the module contains any test.* libCall or a testCtx handle
|
|
1903
1683
|
* type — the link switch that pulls scr_test.c into the binary and has
|
|
@@ -1905,31 +1685,7 @@ export function moduleUsesFsWatch(mod) {
|
|
|
1905
1685
|
* (native-toolchain.ts + emitter; the moduleUsesDgram shape). Test-free programs pay
|
|
1906
1686
|
* zero bytes and keep their exact link line. */
|
|
1907
1687
|
export function moduleUsesNodeTest(mod) {
|
|
1908
|
-
|
|
1909
|
-
const visit = (v) => {
|
|
1910
|
-
if (found || v === null || typeof v !== "object")
|
|
1911
|
-
return;
|
|
1912
|
-
if (Array.isArray(v)) {
|
|
1913
|
-
for (const item of v)
|
|
1914
|
-
visit(item);
|
|
1915
|
-
return;
|
|
1916
|
-
}
|
|
1917
|
-
const node = v;
|
|
1918
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("test.")) {
|
|
1919
|
-
found = true;
|
|
1920
|
-
return;
|
|
1921
|
-
}
|
|
1922
|
-
// A TestContext HANDLE TYPE left behind by a fenced statement still
|
|
1923
|
-
// emits a release call — the unit must link (the dgram type story).
|
|
1924
|
-
if (node.kind === "testCtx") {
|
|
1925
|
-
found = true;
|
|
1926
|
-
return;
|
|
1927
|
-
}
|
|
1928
|
-
for (const key of Object.keys(v))
|
|
1929
|
-
visit(v[key]);
|
|
1930
|
-
};
|
|
1931
|
-
visit(mod);
|
|
1932
|
-
return found;
|
|
1688
|
+
return scanRuntimeFeatures(mod, "nodeTest").nodeTest;
|
|
1933
1689
|
}
|
|
1934
1690
|
/** True when the module contains any dgram.* or dns.* libCall — the
|
|
1935
1691
|
* link switch that pulls scr_dgram.c into the binary and has the emitted
|
|
@@ -1938,69 +1694,13 @@ export function moduleUsesNodeTest(mod) {
|
|
|
1938
1694
|
* answers). Dgram-free programs pay zero bytes and keep their exact link
|
|
1939
1695
|
* line. Same generic-walk shape as moduleUsesZlib. */
|
|
1940
1696
|
export function moduleUsesDgram(mod) {
|
|
1941
|
-
|
|
1942
|
-
const visit = (v) => {
|
|
1943
|
-
if (found || v === null || typeof v !== "object")
|
|
1944
|
-
return;
|
|
1945
|
-
if (Array.isArray(v)) {
|
|
1946
|
-
for (const item of v)
|
|
1947
|
-
visit(item);
|
|
1948
|
-
return;
|
|
1949
|
-
}
|
|
1950
|
-
const node = v;
|
|
1951
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1952
|
-
(node.fn.startsWith("dgram.") || node.fn.startsWith("dns."))) {
|
|
1953
|
-
found = true;
|
|
1954
|
-
return;
|
|
1955
|
-
}
|
|
1956
|
-
// A dgram HANDLE TYPE left behind by a fenced statement still emits a
|
|
1957
|
-
// release call — the unit must link (the moduleUsesNet type story).
|
|
1958
|
-
if (node.kind === "dgramSocket") {
|
|
1959
|
-
found = true;
|
|
1960
|
-
return;
|
|
1961
|
-
}
|
|
1962
|
-
for (const key of Object.keys(v))
|
|
1963
|
-
visit(v[key]);
|
|
1964
|
-
};
|
|
1965
|
-
visit(mod);
|
|
1966
|
-
return found;
|
|
1697
|
+
return scanRuntimeFeatures(mod, "dgram").dgram;
|
|
1967
1698
|
}
|
|
1968
1699
|
/** True when the module contains any http.* libCall — the link switch
|
|
1969
1700
|
* that pulls scr_http.c into the binary (native-toolchain.ts; moduleUsesNet already
|
|
1970
1701
|
* answers true for these, so scr_net.c comes along). */
|
|
1971
1702
|
export function moduleUsesHttpServer(mod) {
|
|
1972
|
-
|
|
1973
|
-
const visit = (v) => {
|
|
1974
|
-
if (found || v === null || typeof v !== "object")
|
|
1975
|
-
return;
|
|
1976
|
-
if (Array.isArray(v)) {
|
|
1977
|
-
for (const item of v)
|
|
1978
|
-
visit(item);
|
|
1979
|
-
return;
|
|
1980
|
-
}
|
|
1981
|
-
const node = v;
|
|
1982
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
1983
|
-
(node.fn.startsWith("http.") || node.fn.startsWith("tls.") || node.fn.startsWith("https.") ||
|
|
1984
|
-
node.fn.startsWith("http2."))) {
|
|
1985
|
-
// scr_tls.c calls into scr_http.c unconditionally (the https server
|
|
1986
|
-
// and client are the http ones over a transport), so any tls/https
|
|
1987
|
-
// use pulls the http unit too.
|
|
1988
|
-
found = true;
|
|
1989
|
-
return;
|
|
1990
|
-
}
|
|
1991
|
-
// An http-family HANDLE TYPE left behind by a fenced statement still
|
|
1992
|
-
// emits its release call — the unit must link (the moduleUsesNet type
|
|
1993
|
-
// story; secureCtx rides here because scr_tls.c calls into scr_http.c).
|
|
1994
|
-
if (node.kind === "httpReq" || node.kind === "httpRes" ||
|
|
1995
|
-
node.kind === "httpClientReq" || node.kind === "secureCtx") {
|
|
1996
|
-
found = true;
|
|
1997
|
-
return;
|
|
1998
|
-
}
|
|
1999
|
-
for (const key of Object.keys(v))
|
|
2000
|
-
visit(v[key]);
|
|
2001
|
-
};
|
|
2002
|
-
visit(mod);
|
|
2003
|
-
return found;
|
|
1703
|
+
return scanRuntimeFeatures(mod, "http").http;
|
|
2004
1704
|
}
|
|
2005
1705
|
/** The legacy http2.* libCalls implemented by scr_http.c/scr_tls.c (the
|
|
2006
1706
|
* allowHTTP1 compatibility slice) — they must NOT pull scr_http2.c, so
|
|
@@ -2012,30 +1712,7 @@ const HTTP2_LEGACY_FNS = new Set([
|
|
|
2012
1712
|
* http2.* libCall, or an h2 handle type left behind by a fenced statement
|
|
2013
1713
|
* (its emitted release call needs the unit — the moduleUsesNet story). */
|
|
2014
1714
|
export function moduleUsesHttp2(mod) {
|
|
2015
|
-
|
|
2016
|
-
const visit = (v) => {
|
|
2017
|
-
if (found || v === null || typeof v !== "object")
|
|
2018
|
-
return;
|
|
2019
|
-
if (Array.isArray(v)) {
|
|
2020
|
-
for (const item of v)
|
|
2021
|
-
visit(item);
|
|
2022
|
-
return;
|
|
2023
|
-
}
|
|
2024
|
-
const node = v;
|
|
2025
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
2026
|
-
node.fn.startsWith("http2.") && !HTTP2_LEGACY_FNS.has(node.fn)) {
|
|
2027
|
-
found = true;
|
|
2028
|
-
return;
|
|
2029
|
-
}
|
|
2030
|
-
if (node.kind === "http2Session" || node.kind === "http2Stream") {
|
|
2031
|
-
found = true;
|
|
2032
|
-
return;
|
|
2033
|
-
}
|
|
2034
|
-
for (const key of Object.keys(v))
|
|
2035
|
-
visit(v[key]);
|
|
2036
|
-
};
|
|
2037
|
-
visit(mod);
|
|
2038
|
-
return found;
|
|
1715
|
+
return scanRuntimeFeatures(mod, "http2").http2;
|
|
2039
1716
|
}
|
|
2040
1717
|
/** True when the module contains any tls.* or https.* libCall — the link
|
|
2041
1718
|
* switch that pulls scr_tls.c and the vendored mbedTLS archive into the
|
|
@@ -2043,33 +1720,7 @@ export function moduleUsesHttp2(mod) {
|
|
|
2043
1720
|
* true for these, so scr_net.c and scr_http.c come along). TLS-free
|
|
2044
1721
|
* programs keep their exact link line and never build mbedTLS. */
|
|
2045
1722
|
export function moduleUsesTls(mod) {
|
|
2046
|
-
|
|
2047
|
-
const visit = (v) => {
|
|
2048
|
-
if (found || v === null || typeof v !== "object")
|
|
2049
|
-
return;
|
|
2050
|
-
if (Array.isArray(v)) {
|
|
2051
|
-
for (const item of v)
|
|
2052
|
-
visit(item);
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
const node = v;
|
|
2056
|
-
if (node.kind === "libCall" && typeof node.fn === "string" &&
|
|
2057
|
-
(node.fn.startsWith("tls.") || node.fn.startsWith("https.") ||
|
|
2058
|
-
node.fn.startsWith("http2."))) {
|
|
2059
|
-
found = true;
|
|
2060
|
-
return;
|
|
2061
|
-
}
|
|
2062
|
-
// A secureCtx HANDLE TYPE left behind by a fenced statement still
|
|
2063
|
-
// emits scr_secure_ctx_release — the unit must link.
|
|
2064
|
-
if (node.kind === "secureCtx") {
|
|
2065
|
-
found = true;
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
for (const key of Object.keys(v))
|
|
2069
|
-
visit(v[key]);
|
|
2070
|
-
};
|
|
2071
|
-
visit(mod);
|
|
2072
|
-
return found;
|
|
1723
|
+
return scanRuntimeFeatures(mod, "tls").tls;
|
|
2073
1724
|
}
|
|
2074
1725
|
/** True when the module contains any tlsca.* libCall — the link switch
|
|
2075
1726
|
* for scr_tls_ca.c, the CA-store introspection unit (getCACertificates /
|
|
@@ -2079,25 +1730,7 @@ export function moduleUsesTls(mod) {
|
|
|
2079
1730
|
* also compiles the unit whenever TLS itself links — scr_tls.c consults
|
|
2080
1731
|
* the unit's default-set override for its trust anchors. */
|
|
2081
1732
|
export function moduleUsesTlsCa(mod) {
|
|
2082
|
-
|
|
2083
|
-
const visit = (v) => {
|
|
2084
|
-
if (found || v === null || typeof v !== "object")
|
|
2085
|
-
return;
|
|
2086
|
-
if (Array.isArray(v)) {
|
|
2087
|
-
for (const item of v)
|
|
2088
|
-
visit(item);
|
|
2089
|
-
return;
|
|
2090
|
-
}
|
|
2091
|
-
const node = v;
|
|
2092
|
-
if (node.kind === "libCall" && typeof node.fn === "string" && node.fn.startsWith("tlsca.")) {
|
|
2093
|
-
found = true;
|
|
2094
|
-
return;
|
|
2095
|
-
}
|
|
2096
|
-
for (const key of Object.keys(v))
|
|
2097
|
-
visit(v[key]);
|
|
2098
|
-
};
|
|
2099
|
-
visit(mod);
|
|
2100
|
-
return found;
|
|
1733
|
+
return scanRuntimeFeatures(mod, "tlsCa").tlsCa;
|
|
2101
1734
|
}
|
|
2102
1735
|
/* ── library mode's async_free gate ──────────────────────────────────────
|
|
2103
1736
|
* v1 library mode REQUIRES an async_free module graph (ratified): no async
|
|
@@ -2154,10 +1787,6 @@ const LIB_MODE_REFUSED_PREFIXES = [
|
|
|
2154
1787
|
["als.", "AsyncLocalStorage"],
|
|
2155
1788
|
["urj.", "unhandled-rejection tracking"],
|
|
2156
1789
|
["dc.", "the diagnostics_channel surface"],
|
|
2157
|
-
// NOT the whole "dyn." family: the checked-dynamic tree (ScrDyn) is
|
|
2158
|
-
// static-tier surface hosted by always-linked units; only defineProps
|
|
2159
|
-
// drags the prototype-dispatch unit (scr_dyn_invoke.c → scr_async_dyn.c).
|
|
2160
|
-
["dyn.defineProps", "checked-dynamic prototype dispatch"],
|
|
2161
1790
|
];
|
|
2162
1791
|
/** Value/type kinds whose mere presence means an excluded unit's code (or
|
|
2163
1792
|
* a fiber) would have to link. */
|
|
@@ -2182,12 +1811,11 @@ const LIB_MODE_REFUSED_KINDS = new Map([
|
|
|
2182
1811
|
["httpRes", "the node:http surface"],
|
|
2183
1812
|
["httpClientReq", "the node:http surface"],
|
|
2184
1813
|
["secureCtx", "the node:tls surface"],
|
|
2185
|
-
["dynInvoke", "checked-dynamic prototype dispatch"],
|
|
2186
1814
|
]);
|
|
2187
1815
|
/** First async/event-loop/ambient-process surface the module graph
|
|
2188
1816
|
* reaches, or null when the graph is async_free (the v1 library requirement).
|
|
2189
|
-
*
|
|
2190
|
-
*
|
|
1817
|
+
* Typed slots use their declaration location and executable nodes use their
|
|
1818
|
+
* own location, so the refusal anchors at the reaching construct; the
|
|
2191
1819
|
* coarse moduleUses* predicates are the safety net behind the fine-grained
|
|
2192
1820
|
* table (a surface reached only through a spelling the table misses still
|
|
2193
1821
|
* refuses, anchored at the entry). */
|
|
@@ -2201,54 +1829,49 @@ export function moduleLibAsyncSurface(mod) {
|
|
|
2201
1829
|
}
|
|
2202
1830
|
const entryLoc = { file: mod.sourceFile, start: 0, end: 0 };
|
|
2203
1831
|
let found = null;
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
return;
|
|
2219
|
-
}
|
|
2220
|
-
if (node.kind === "libCall" && typeof node.fn === "string") {
|
|
1832
|
+
const checkKind = (kind, loc) => {
|
|
1833
|
+
const surface = LIB_MODE_REFUSED_KINDS.get(kind);
|
|
1834
|
+
if (surface === undefined)
|
|
1835
|
+
return true;
|
|
1836
|
+
found = { surface, loc };
|
|
1837
|
+
return false;
|
|
1838
|
+
};
|
|
1839
|
+
everyModuleNode(mod, {
|
|
1840
|
+
type: (node, loc) => checkKind(node.kind, loc),
|
|
1841
|
+
stmt: () => true,
|
|
1842
|
+
expr: (node) => {
|
|
1843
|
+
if (!checkKind(node.kind, node.loc))
|
|
1844
|
+
return false;
|
|
1845
|
+
if (node.kind === "libCall") {
|
|
2221
1846
|
for (const [prefix, surface] of LIB_MODE_REFUSED_PREFIXES) {
|
|
2222
1847
|
if (node.fn.startsWith(prefix)) {
|
|
2223
|
-
found = { surface, loc:
|
|
2224
|
-
return;
|
|
1848
|
+
found = { surface, loc: node.loc };
|
|
1849
|
+
return false;
|
|
2225
1850
|
}
|
|
2226
1851
|
}
|
|
2227
1852
|
}
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
};
|
|
2232
|
-
visit(mod, entryLoc);
|
|
1853
|
+
return true;
|
|
1854
|
+
},
|
|
1855
|
+
});
|
|
2233
1856
|
if (found !== null)
|
|
2234
1857
|
return found;
|
|
2235
1858
|
// Safety net: the coarse unit predicates, entry-anchored. Every one of
|
|
2236
1859
|
// these units is excluded from library links, so a true answer that the
|
|
2237
1860
|
// fine-grained table missed must still refuse.
|
|
1861
|
+
const features = moduleRuntimeFeatures(mod);
|
|
2238
1862
|
const coarse = [
|
|
2239
|
-
[
|
|
2240
|
-
[
|
|
2241
|
-
[
|
|
2242
|
-
[
|
|
2243
|
-
[
|
|
2244
|
-
[
|
|
2245
|
-
[
|
|
2246
|
-
[
|
|
2247
|
-
[
|
|
2248
|
-
[
|
|
2249
|
-
[
|
|
2250
|
-
[
|
|
2251
|
-
[moduleUsesDynInvoke(mod), "checked-dynamic prototype dispatch"],
|
|
1863
|
+
[features.processEvents, "process signal/exit listeners or the stdin event surface"],
|
|
1864
|
+
[features.net, "the node:net surface"],
|
|
1865
|
+
[features.http, "the node:http surface"],
|
|
1866
|
+
[features.http2, "the node:http2 surface"],
|
|
1867
|
+
[features.dgram, "the node:dgram surface"],
|
|
1868
|
+
[features.fsWatch, "fs.watch"],
|
|
1869
|
+
[features.stream, "the node:stream surface"],
|
|
1870
|
+
[features.tls, "the node:tls surface"],
|
|
1871
|
+
[features.fetch, "fetch"],
|
|
1872
|
+
[features.nodeTest, "the node:test surface"],
|
|
1873
|
+
[features.dynAsync, "the checked-dynamic async surface"],
|
|
1874
|
+
[features.dc, "the diagnostics_channel surface"],
|
|
2252
1875
|
];
|
|
2253
1876
|
for (const [on, surface] of coarse) {
|
|
2254
1877
|
if (on)
|
|
@@ -2319,27 +1942,22 @@ export const LIB_NONDETERMINISTIC_PREFIXES = [
|
|
|
2319
1942
|
* attests `deterministic: true`). */
|
|
2320
1943
|
export function moduleLibNondeterministicSurface(mod) {
|
|
2321
1944
|
let found = null;
|
|
2322
|
-
const
|
|
2323
|
-
if (
|
|
2324
|
-
return;
|
|
2325
|
-
if (Array.isArray(v)) {
|
|
2326
|
-
for (const item of v)
|
|
2327
|
-
visit(item);
|
|
2328
|
-
return;
|
|
2329
|
-
}
|
|
2330
|
-
const node = v;
|
|
2331
|
-
if (node.kind === "libCall" && typeof node.fn === "string") {
|
|
1945
|
+
const expr = (node) => {
|
|
1946
|
+
if (node.kind === "libCall") {
|
|
2332
1947
|
for (const [prefix, surface] of LIB_NONDETERMINISTIC_PREFIXES) {
|
|
2333
1948
|
if (node.fn.startsWith(prefix)) {
|
|
2334
1949
|
found = surface;
|
|
2335
|
-
return;
|
|
1950
|
+
return false;
|
|
2336
1951
|
}
|
|
2337
1952
|
}
|
|
2338
1953
|
}
|
|
2339
|
-
|
|
2340
|
-
visit(v[key]);
|
|
1954
|
+
return everyExprChild(node, expr, stmt);
|
|
2341
1955
|
};
|
|
2342
|
-
|
|
1956
|
+
const stmt = (node) => everyStmtChild(node, expr, stmt);
|
|
1957
|
+
for (const fn of mod.functions) {
|
|
1958
|
+
if (!fn.body.every(stmt))
|
|
1959
|
+
break;
|
|
1960
|
+
}
|
|
2343
1961
|
return found;
|
|
2344
1962
|
}
|
|
2345
1963
|
/** The may-throw seed: libCall members that can raise. Every fs.* member
|
|
@@ -2350,6 +1968,29 @@ export function moduleLibNondeterministicSurface(mod) {
|
|
|
2350
1968
|
* seed on `dynCheck` and `awaitExpr` nodes, which throw on validation
|
|
2351
1969
|
* failure / promise rejection). */
|
|
2352
1970
|
export const MAY_THROW_LIB_FNS = new Set([
|
|
1971
|
+
"dyn.nativeSetNew",
|
|
1972
|
+
"ffi.argument",
|
|
1973
|
+
"ffi.memoryModule",
|
|
1974
|
+
"process.stdoutWrite",
|
|
1975
|
+
"process.stderrWrite",
|
|
1976
|
+
"process.stdoutWriteBytes",
|
|
1977
|
+
"process.stderrWriteBytes",
|
|
1978
|
+
"procStream.write",
|
|
1979
|
+
"weakMap.new",
|
|
1980
|
+
"weakSet.new",
|
|
1981
|
+
"dyn.fromEntries",
|
|
1982
|
+
"arrayBuffer.new",
|
|
1983
|
+
"arrayBuffer.byteLengthGetter",
|
|
1984
|
+
"arrayBuffer.viewU8C",
|
|
1985
|
+
"arrayBuffer.viewI8",
|
|
1986
|
+
"arrayBuffer.viewU16",
|
|
1987
|
+
"arrayBuffer.viewI16",
|
|
1988
|
+
"arrayBuffer.viewU8",
|
|
1989
|
+
"arrayBuffer.viewU32",
|
|
1990
|
+
"arrayBuffer.viewI32",
|
|
1991
|
+
"arrayBuffer.viewF32",
|
|
1992
|
+
"arrayBuffer.viewF64",
|
|
1993
|
+
"arrayBuffer.viewDV",
|
|
2353
1994
|
"bigint.parse",
|
|
2354
1995
|
"bigint.fromF64",
|
|
2355
1996
|
"bigint.div",
|
|
@@ -2385,6 +2026,10 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2385
2026
|
"dc.tcTraceSync",
|
|
2386
2027
|
"dc.tcTraceCallback",
|
|
2387
2028
|
"dc.tcTracePromise",
|
|
2029
|
+
"process.onUncaughtException",
|
|
2030
|
+
"process.offUncaughtException",
|
|
2031
|
+
"process.onSignal",
|
|
2032
|
+
"process.offSignal",
|
|
2388
2033
|
"process.onUnhandledRejection",
|
|
2389
2034
|
"process.onRejectionHandled",
|
|
2390
2035
|
"async.awaitDyn",
|
|
@@ -2565,9 +2210,27 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2565
2210
|
"error.nodeThrow",
|
|
2566
2211
|
// USVString coercion runs user toString/valueOf — throws propagate.
|
|
2567
2212
|
"dyn.toStringCoerce",
|
|
2213
|
+
"dyn.stringConstructor",
|
|
2214
|
+
"dyn.propertyKey",
|
|
2215
|
+
"dyn.toNumeric",
|
|
2216
|
+
"dyn.increment",
|
|
2217
|
+
// Error messages use the same coercion protocol before installing cause.
|
|
2218
|
+
"error.newOptions",
|
|
2219
|
+
"error.ctorOptions",
|
|
2220
|
+
"error.cause",
|
|
2221
|
+
"error.setCause",
|
|
2222
|
+
"error.deleteCause",
|
|
2568
2223
|
"dyn.objectTag",
|
|
2569
2224
|
// Numeric coercion runs user valueOf/toString — throws propagate.
|
|
2225
|
+
"dyn.numberConstructor",
|
|
2570
2226
|
"dyn.toNumberCoerce",
|
|
2227
|
+
"dyn.add",
|
|
2228
|
+
"dyn.arithmetic",
|
|
2229
|
+
"dyn.bitwise",
|
|
2230
|
+
"dyn.proxyNew",
|
|
2231
|
+
"dyn.classBasePrototype",
|
|
2232
|
+
"dyn.classSuper",
|
|
2233
|
+
"dyn.hasKey",
|
|
2571
2234
|
"child.kill",
|
|
2572
2235
|
// The caller's lookup runs synchronously inside the connect call — a
|
|
2573
2236
|
// throw there propagates like Node's.
|
|
@@ -2602,6 +2265,11 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2602
2265
|
"island.import",
|
|
2603
2266
|
"island.castFail",
|
|
2604
2267
|
"json.parse",
|
|
2268
|
+
"json.parseReviver",
|
|
2269
|
+
"json.stringifyReplacer",
|
|
2270
|
+
"json.stringifyValue",
|
|
2271
|
+
"date.nativeNew",
|
|
2272
|
+
"date.checkedValue",
|
|
2605
2273
|
"util.parseArgs",
|
|
2606
2274
|
// decodeURIComponent throws the spec's URIError on bad hex/invalid
|
|
2607
2275
|
// UTF-8 octets (encodeURIComponent never throws — see the IrLibFn doc).
|
|
@@ -2625,26 +2293,62 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2625
2293
|
"dyn.cloneTransferFail",
|
|
2626
2294
|
// the dyn Object walks throw on null/undefined receivers
|
|
2627
2295
|
"dyn.objKeys",
|
|
2296
|
+
"dyn.forInKeys",
|
|
2628
2297
|
"dyn.hasOwn",
|
|
2298
|
+
"dyn.propertyIsEnumerable",
|
|
2629
2299
|
"dyn.assign",
|
|
2300
|
+
"dyn.copyDataProperties",
|
|
2630
2301
|
// variadic Object.assign: spread flattening throws V8's spread-call
|
|
2631
2302
|
// TypeErrors; the final copy throws ToObject on a nullish target
|
|
2632
2303
|
"dyn.packPushSpread",
|
|
2633
2304
|
"dyn.packPushSpreadIter",
|
|
2634
2305
|
"dyn.assignAll",
|
|
2306
|
+
"dyn.objCreate",
|
|
2307
|
+
"dyn.objCreateWithProperties",
|
|
2308
|
+
"dyn.getPrototype",
|
|
2309
|
+
"dyn.setPrototype",
|
|
2310
|
+
"dyn.getOwnPropertyNames",
|
|
2311
|
+
"dyn.getOwnPropertySymbols",
|
|
2312
|
+
"dyn.getOwnPropertyDescriptors",
|
|
2313
|
+
"dyn.preventExtensions",
|
|
2314
|
+
"dyn.isExtensible",
|
|
2315
|
+
"dyn.seal",
|
|
2316
|
+
"dyn.isSealed",
|
|
2635
2317
|
"dyn.objValues",
|
|
2636
2318
|
"dyn.objEntries",
|
|
2637
2319
|
"error.domClone",
|
|
2638
2320
|
// new RegExp compiles the pattern eagerly: an invalid pattern or flag
|
|
2639
2321
|
// throws Node's catchable SyntaxError at construction.
|
|
2640
2322
|
"regex.new",
|
|
2323
|
+
"regex.newChecked",
|
|
2641
2324
|
"dyn.keySet",
|
|
2325
|
+
"dyn.keySetComputed",
|
|
2326
|
+
"process.builtinId",
|
|
2327
|
+
"process.builtinModule",
|
|
2328
|
+
"process.builtinUnsupported",
|
|
2329
|
+
"dyn.keyDelete",
|
|
2330
|
+
"dyn.keyDeleteComputed",
|
|
2331
|
+
"dyn.hasKeyComputed",
|
|
2332
|
+
"dyn.hasOwnComputed",
|
|
2333
|
+
"dyn.propertyIsEnumerableComputed",
|
|
2642
2334
|
// the destructuring pack throws V8's TypeError on non-iterable dyn kinds
|
|
2643
2335
|
"dyn.iterPack",
|
|
2336
|
+
"dyn.arrayFromIterator",
|
|
2337
|
+
"dyn.iterator",
|
|
2338
|
+
"dyn.iteratorResult",
|
|
2339
|
+
"dyn.mapSeedEntries",
|
|
2340
|
+
"dyn.mapSeedEntry",
|
|
2341
|
+
"dyn.freeze",
|
|
2342
|
+
"dyn.isFrozen",
|
|
2644
2343
|
"dyn.toString",
|
|
2344
|
+
"string.fromCodePoint",
|
|
2645
2345
|
"dyn.defineProps",
|
|
2346
|
+
"dyn.defineProperty",
|
|
2347
|
+
"dyn.getOwnPropertyDescriptor",
|
|
2348
|
+
"dyn.arrayProtoCall",
|
|
2646
2349
|
"process.chdir",
|
|
2647
2350
|
"fs.realpathSync",
|
|
2351
|
+
"fs.realpathNativeSync",
|
|
2648
2352
|
"fs.readFileSync",
|
|
2649
2353
|
"fs.writeFileSync",
|
|
2650
2354
|
"fs.appendFileSync",
|
|
@@ -2654,13 +2358,16 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2654
2358
|
"fs.readdirSync",
|
|
2655
2359
|
"fs.readdirTypesSync",
|
|
2656
2360
|
"url.new",
|
|
2361
|
+
"url.newBase",
|
|
2657
2362
|
"url.fileURLToPathUrl",
|
|
2363
|
+
"url.fileURLToPathChecked",
|
|
2658
2364
|
"url.fileURLToPathStr",
|
|
2659
2365
|
// The win32-target flavor of pathToFileURL (same runtime entry point —
|
|
2660
2366
|
// the bridge dispatches by the binary's platform): Node's win32 arm
|
|
2661
2367
|
// raises ERR_INVALID_ARG_VALUE TypeErrors for malformed UNC inputs, so
|
|
2662
2368
|
// only THIS flavor seeds may-throw — posix emission stays untouched.
|
|
2663
2369
|
"url.pathToFileURLWin32",
|
|
2370
|
+
"url.pathToFileURLPlatform",
|
|
2664
2371
|
// URLSearchParams from a string[][]: Node's ERR_INVALID_TUPLE TypeError
|
|
2665
2372
|
// on a row that is not a [name, value] pair. The rest of the sp family
|
|
2666
2373
|
// never throws.
|
|
@@ -2691,6 +2398,7 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2691
2398
|
"crypto.pbkdf2Cb",
|
|
2692
2399
|
"buffer.concat",
|
|
2693
2400
|
"buffer.concatLen",
|
|
2401
|
+
"buffer.fromDyn",
|
|
2694
2402
|
// The checked-dynamic compare/equals validators: Node's argument
|
|
2695
2403
|
// ladders throw ERR_INVALID_ARG_TYPE / ERR_OUT_OF_RANGE catchably.
|
|
2696
2404
|
"buffer.compareChk",
|
|
@@ -2718,6 +2426,7 @@ export const MAY_THROW_LIB_FNS = new Set([
|
|
|
2718
2426
|
"emitter.setDefaultMaxChk",
|
|
2719
2427
|
"fs.readFileSyncBytes",
|
|
2720
2428
|
"fs.writeFileSyncBytes",
|
|
2429
|
+
"fs.appendFileSyncBytes",
|
|
2721
2430
|
"zlib.inflateSync",
|
|
2722
2431
|
"zlib.inflateRawSync",
|
|
2723
2432
|
"zlib.gunzipSync",
|