@scriptc/compiler 0.2.4 → 0.2.6
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 +972 -245
- package/ambient/scriptc-overrides.d.ts +5 -1
- package/ambient/scriptc.d.ts +22 -2
- package/dist/backend/build-cache.d.ts +4 -0
- package/dist/backend/build-cache.js +16 -2
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/cycle-analysis.js +17 -5
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-analysis.test.js +50 -11
- package/dist/backend/cycle-analysis.test.js.map +1 -1
- package/dist/backend/debug-symbols.js.map +1 -1
- package/dist/backend/executable-features.js +3 -1
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/external-c.d.ts +13 -6
- package/dist/backend/external-c.js +15 -3
- package/dist/backend/external-c.js.map +1 -1
- package/dist/backend/ffi-callbacks.js +6 -9
- package/dist/backend/ffi-callbacks.js.map +1 -1
- package/dist/backend/library-identity-markers.js.map +1 -1
- package/dist/backend/library-pack.d.ts +1 -1
- package/dist/backend/library-pack.js +81 -24
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/link-plan-core.d.ts +2 -0
- package/dist/backend/link-plan-core.js +10 -2
- package/dist/backend/link-plan-core.js.map +1 -1
- package/dist/backend/link-plan.d.ts +2 -1
- package/dist/backend/link-plan.js +7 -5
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/linker.d.ts +1 -1
- package/dist/backend/linker.js +42 -23
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/literals.js +5 -4
- package/dist/backend/literals.js.map +1 -1
- package/dist/backend/literals.test.js +30 -5
- package/dist/backend/literals.test.js.map +1 -1
- package/dist/backend/llvm/blocks.test.js +5 -2
- package/dist/backend/llvm/blocks.test.js.map +1 -1
- package/dist/backend/llvm/borrowed-inputs.js.map +1 -1
- package/dist/backend/llvm/borrowed-receivers.js +43 -19
- package/dist/backend/llvm/borrowed-receivers.js.map +1 -1
- package/dist/backend/llvm/byte-numbers.js +38 -5
- package/dist/backend/llvm/byte-numbers.js.map +1 -1
- package/dist/backend/llvm/byte-windows.d.ts +31 -0
- package/dist/backend/llvm/byte-windows.js +334 -0
- package/dist/backend/llvm/byte-windows.js.map +1 -0
- package/dist/backend/llvm/byte-windows.test.d.ts +1 -0
- package/dist/backend/llvm/byte-windows.test.js +244 -0
- package/dist/backend/llvm/byte-windows.test.js.map +1 -0
- package/dist/backend/llvm/bytes-bounds.js +73 -22
- package/dist/backend/llvm/bytes-bounds.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +5 -2
- package/dist/backend/llvm/call-lifetimes.js +72 -19
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +159 -28
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/checked-value-lifetimes.d.ts +4 -0
- package/dist/backend/llvm/checked-value-lifetimes.js +14 -4
- package/dist/backend/llvm/checked-value-lifetimes.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +14 -1
- package/dist/backend/llvm/classes.js +94 -19
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.d.ts +1 -0
- package/dist/backend/llvm/classes.test.js +99 -0
- package/dist/backend/llvm/classes.test.js.map +1 -0
- package/dist/backend/llvm/common.js +4 -1
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.d.ts +11 -0
- package/dist/backend/llvm/constant-callbacks.js +213 -0
- package/dist/backend/llvm/constant-callbacks.js.map +1 -0
- package/dist/backend/llvm/constant-callbacks.test.d.ts +1 -0
- package/dist/backend/llvm/constant-callbacks.test.js +124 -0
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -0
- package/dist/backend/llvm/counted-loops.js +10 -3
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/debug-info.js +33 -13
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/debug-info.test.js +28 -6
- package/dist/backend/llvm/debug-info.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +1 -1
- package/dist/backend/llvm/dyn.js +75 -56
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +28 -3
- package/dist/backend/llvm/emitter.js +506 -145
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +247 -50
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +25 -6
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +24 -4
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +10 -4
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +110 -31
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +2 -0
- package/dist/backend/llvm/expr-containers.js +112 -41
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +1 -3
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.js +3 -1
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +55 -7
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-island.js +26 -6
- package/dist/backend/llvm/expr-island.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +95 -19
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +44 -2
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +10 -9
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +44 -26
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +51 -14
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +34 -14
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/integer-remainder.d.ts +7 -0
- package/dist/backend/llvm/integer-remainder.js +26 -0
- package/dist/backend/llvm/integer-remainder.js.map +1 -0
- package/dist/backend/llvm/integer-values.js +15 -4
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/integer-views.js +23 -7
- package/dist/backend/llvm/integer-views.js.map +1 -1
- package/dist/backend/llvm/integer-views.test.js +42 -7
- package/dist/backend/llvm/integer-views.test.js.map +1 -1
- package/dist/backend/llvm/layouts.js +1 -1
- package/dist/backend/llvm/layouts.js.map +1 -1
- package/dist/backend/llvm/lib-abi.js +20 -4
- package/dist/backend/llvm/lib-abi.js.map +1 -1
- package/dist/backend/llvm/lib-connect.js +7 -1
- package/dist/backend/llvm/lib-connect.js.map +1 -1
- package/dist/backend/llvm/lib-datagram.js +35 -10
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +42 -38
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +33 -18
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +60 -15
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-lookup.js +12 -5
- package/dist/backend/llvm/lib-lookup.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +97 -31
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +57 -14
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +122 -31
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +33 -14
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +21 -7
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +69 -20
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.d.ts +9 -2
- package/dist/backend/llvm/local-array-reads.js +176 -89
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +394 -62
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.d.ts +25 -0
- package/dist/backend/llvm/local-union-storage.js +109 -0
- package/dist/backend/llvm/local-union-storage.js.map +1 -0
- package/dist/backend/llvm/local-union-storage.test.d.ts +1 -0
- package/dist/backend/llvm/local-union-storage.test.js +210 -0
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -0
- package/dist/backend/llvm/loop-array-borrows.d.ts +11 -0
- package/dist/backend/llvm/loop-array-borrows.js +70 -0
- package/dist/backend/llvm/loop-array-borrows.js.map +1 -0
- package/dist/backend/llvm/loop-array-borrows.test.d.ts +1 -0
- package/dist/backend/llvm/loop-array-borrows.test.js +145 -0
- package/dist/backend/llvm/loop-array-borrows.test.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.d.ts +11 -2
- package/dist/backend/llvm/map-read-lifetimes.js +64 -19
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +89 -17
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/reference-effects.d.ts +5 -3
- package/dist/backend/llvm/reference-effects.js +74 -36
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-effects.test.js +92 -9
- package/dist/backend/llvm/reference-effects.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +4 -1
- package/dist/backend/llvm/shapes.js +82 -24
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +3 -1
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/split-loops.d.ts +48 -0
- package/dist/backend/llvm/split-loops.js +183 -0
- package/dist/backend/llvm/split-loops.js.map +1 -0
- package/dist/backend/llvm/split.js +4 -11
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +80 -8
- package/dist/backend/llvm/split.test.js.map +1 -1
- package/dist/backend/llvm/stack-callbacks.d.ts +14 -0
- package/dist/backend/llvm/stack-callbacks.js +73 -0
- package/dist/backend/llvm/stack-callbacks.js.map +1 -0
- package/dist/backend/llvm/stack-captures.d.ts +25 -0
- package/dist/backend/llvm/stack-captures.js +150 -0
- package/dist/backend/llvm/stack-captures.js.map +1 -0
- package/dist/backend/llvm/stack-unions.js +14 -5
- package/dist/backend/llvm/stack-unions.js.map +1 -1
- package/dist/backend/llvm/stack-unions.test.js +151 -32
- package/dist/backend/llvm/stack-unions.test.js.map +1 -1
- package/dist/backend/llvm/string-construction.js.map +1 -1
- package/dist/backend/llvm/string-construction.test.js +32 -7
- package/dist/backend/llvm/string-construction.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.js +14 -8
- package/dist/backend/llvm/string-lifetimes.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +119 -29
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-slices.d.ts +20 -0
- package/dist/backend/llvm/string-slices.js +87 -0
- package/dist/backend/llvm/string-slices.js.map +1 -0
- package/dist/backend/llvm/string-slices.test.d.ts +1 -0
- package/dist/backend/llvm/string-slices.test.js +98 -0
- package/dist/backend/llvm/string-slices.test.js.map +1 -0
- package/dist/backend/llvm/switch-dispatch.d.ts +9 -0
- package/dist/backend/llvm/switch-dispatch.js +114 -0
- package/dist/backend/llvm/switch-dispatch.js.map +1 -0
- package/dist/backend/llvm/switch-dispatch.test.d.ts +1 -0
- package/dist/backend/llvm/switch-dispatch.test.js +83 -0
- package/dist/backend/llvm/switch-dispatch.test.js.map +1 -0
- package/dist/backend/llvm/unsupported.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +4 -14
- package/dist/backend/llvm/walkers.js +58 -313
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/mangle.js +9 -3
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/may-throw.js +18 -8
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +119 -23
- package/dist/backend/may-throw.test.js.map +1 -1
- package/dist/backend/native/artifact-stamps.d.ts +39 -0
- package/dist/backend/native/artifact-stamps.js +371 -0
- package/dist/backend/native/artifact-stamps.js.map +1 -0
- package/dist/backend/native/cache-warm.d.ts +24 -0
- package/dist/backend/native/cache-warm.js +80 -0
- package/dist/backend/native/cache-warm.js.map +1 -0
- package/dist/backend/native/compiler-fingerprint.d.ts +19 -0
- package/dist/backend/native/compiler-fingerprint.js +357 -0
- package/dist/backend/native/compiler-fingerprint.js.map +1 -0
- package/dist/backend/native/contracts.d.ts +316 -0
- package/dist/backend/native/contracts.js +2 -0
- package/dist/backend/native/contracts.js.map +1 -0
- package/dist/backend/native/dependency-files.d.ts +5 -0
- package/dist/backend/native/dependency-files.js +83 -0
- package/dist/backend/native/dependency-files.js.map +1 -0
- package/dist/backend/native/driver.d.ts +50 -0
- package/dist/backend/native/driver.js +294 -0
- package/dist/backend/native/driver.js.map +1 -0
- package/dist/backend/native/executable.d.ts +18 -0
- package/dist/backend/native/executable.js +1275 -0
- package/dist/backend/native/executable.js.map +1 -0
- package/dist/backend/native/library.d.ts +2 -0
- package/dist/backend/native/library.js +614 -0
- package/dist/backend/native/library.js.map +1 -0
- package/dist/backend/native/linker-fingerprint.d.ts +8 -0
- package/dist/backend/native/linker-fingerprint.js +174 -0
- package/dist/backend/native/linker-fingerprint.js.map +1 -0
- package/dist/backend/native/object-merge.d.ts +2 -0
- package/dist/backend/native/object-merge.js +154 -0
- package/dist/backend/native/object-merge.js.map +1 -0
- package/dist/backend/native/process.d.ts +17 -0
- package/dist/backend/native/process.js +42 -0
- package/dist/backend/native/process.js.map +1 -0
- package/dist/backend/native/program-shards.d.ts +21 -0
- package/dist/backend/native/program-shards.js +99 -0
- package/dist/backend/native/program-shards.js.map +1 -0
- package/dist/backend/native/runtime-inputs.d.ts +12 -0
- package/dist/backend/native/runtime-inputs.js +165 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -0
- package/dist/backend/native/runtime-inputs.test.d.ts +1 -0
- package/dist/backend/native/runtime-inputs.test.js +64 -0
- package/dist/backend/native/runtime-inputs.test.js.map +1 -0
- package/dist/backend/native/runtime-objects.d.ts +16 -0
- package/dist/backend/native/runtime-objects.js +122 -0
- package/dist/backend/native/runtime-objects.js.map +1 -0
- package/dist/backend/native/session.d.ts +12 -0
- package/dist/backend/native/session.js +31 -0
- package/dist/backend/native/session.js.map +1 -0
- package/dist/backend/native/tool-identity.d.ts +37 -0
- package/dist/backend/native/tool-identity.js +310 -0
- package/dist/backend/native/tool-identity.js.map +1 -0
- package/dist/backend/native/trace-paths.d.ts +12 -0
- package/dist/backend/native/trace-paths.js +73 -0
- package/dist/backend/native/trace-paths.js.map +1 -0
- package/dist/backend/native/vendor.d.ts +1 -0
- package/dist/backend/native/vendor.js +12 -0
- package/dist/backend/native/vendor.js.map +1 -0
- package/dist/backend/native-codegen-core.d.ts +6 -0
- package/dist/backend/native-codegen-core.js +23 -1
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +5 -1
- package/dist/backend/native-codegen.js +52 -25
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +59 -11
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +1 -0
- package/dist/backend/native-link-info-core.js +9 -5
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-link-info.js +14 -5
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-link-info.test.js +58 -13
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +17 -450
- package/dist/backend/native-toolchain.js +17 -3971
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +103 -72
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/native-tools.d.ts +3 -1
- package/dist/backend/native-tools.js +30 -9
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/object-localize.js +17 -14
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +59 -12
- 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 +1 -0
- package/dist/backend/runtime-pack-core.js +104 -50
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-native.js +5 -3
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +126 -17
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.d.ts +1 -1
- package/dist/backend/runtime-pack.js +11 -12
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +51 -25
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/source-locations.js.map +1 -1
- package/dist/backend/source-locations.test.js +7 -2
- package/dist/backend/source-locations.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +44 -14
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +93 -20
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/targets.js +230 -86
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +32 -18
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/toolchain-environment.js +5 -1
- package/dist/backend/toolchain-environment.js.map +1 -1
- package/dist/backend/vendor-archives.d.ts +2 -2
- package/dist/backend/vendor-archives.js +84 -35
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.js +13 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.d.ts +1 -1
- package/dist/backend/warm-cache.js +33 -9
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +39 -9
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/output-options.js +14 -4
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/paths.js.map +1 -1
- package/dist/cli/wasi-runner.js.map +1 -1
- package/dist/compat/fetch-profile.js +36 -35
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/coverage/report.js +16 -17
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +112 -26
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +55 -16
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +2 -1
- package/dist/executable/executable-cache.js +79 -48
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +90 -26
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +2 -2
- package/dist/executable/prepare.js.map +1 -1
- package/dist/ffi/ffi-manifest.js +78 -20
- package/dist/ffi/ffi-manifest.js.map +1 -1
- package/dist/ffi/ffi-manifest.test.js +96 -16
- package/dist/ffi/ffi-manifest.test.js.map +1 -1
- package/dist/format-integer.js.map +1 -1
- package/dist/frontend/analysis.js +12 -2
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/arguments-usage.js.map +1 -1
- package/dist/frontend/binding-source.js +9 -3
- package/dist/frontend/binding-source.js.map +1 -1
- package/dist/frontend/builtin-modules.js +46 -2
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/cjs-resolve.js +40 -17
- package/dist/frontend/cjs-resolve.js.map +1 -1
- package/dist/frontend/cjs-syntax.js +31 -10
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/comptime-node.test.js +10 -11
- package/dist/frontend/comptime-node.test.js.map +1 -1
- package/dist/frontend/dts-paths.js +7 -3
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/fork-target.d.ts +5 -0
- package/dist/frontend/fork-target.js +55 -18
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.d.ts +1 -0
- package/dist/frontend/fork-target.test.js +59 -0
- package/dist/frontend/fork-target.test.js.map +1 -0
- package/dist/frontend/function-completion.js +11 -6
- package/dist/frontend/function-completion.js.map +1 -1
- package/dist/frontend/helper-tokens.js +53 -6
- package/dist/frontend/helper-tokens.js.map +1 -1
- package/dist/frontend/helper-tokens.test.js +18 -2
- package/dist/frontend/helper-tokens.test.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.js +32 -12
- package/dist/frontend/inferred-js-diagnostics.js.map +1 -1
- package/dist/frontend/inferred-js-diagnostics.test.js +11 -15
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -1
- package/dist/frontend/input-tracker.js +11 -11
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +4 -1
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lib-contract.js +38 -9
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/literal-values.js.map +1 -1
- package/dist/frontend/literal-values.test.js +28 -8
- package/dist/frontend/literal-values.test.js.map +1 -1
- package/dist/frontend/lowering/abstract-equality.js +53 -10
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.d.ts +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.js +108 -106
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +37 -14
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.d.ts +50 -0
- package/dist/frontend/lowering/binding-analysis.js +376 -0
- package/dist/frontend/lowering/binding-analysis.js.map +1 -0
- package/dist/frontend/lowering/builtin-calls.d.ts +9 -0
- package/dist/frontend/lowering/builtin-calls.js +60 -0
- package/dist/frontend/lowering/builtin-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/arguments.d.ts +43 -0
- package/dist/frontend/lowering/builtins/arguments.js +247 -0
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -0
- package/dist/frontend/lowering/builtins/async-context.d.ts +52 -0
- package/dist/frontend/lowering/builtins/async-context.js +436 -0
- package/dist/frontend/lowering/builtins/async-context.js.map +1 -0
- package/dist/frontend/lowering/builtins/atomics.d.ts +6 -0
- package/dist/frontend/lowering/builtins/atomics.js +82 -0
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -0
- package/dist/frontend/lowering/builtins/callable-aliases.d.ts +13 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js +87 -0
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-async.d.ts +18 -0
- package/dist/frontend/lowering/builtins/child-process-async.js +245 -0
- package/dist/frontend/lowering/builtins/child-process-async.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-methods.d.ts +21 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js +362 -0
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-sync.d.ts +4 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js +639 -0
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process.d.ts +55 -0
- package/dist/frontend/lowering/builtins/child-process.js +669 -0
- package/dist/frontend/lowering/builtins/child-process.js.map +1 -0
- package/dist/frontend/lowering/builtins/compression.d.ts +7 -0
- package/dist/frontend/lowering/builtins/compression.js +115 -0
- package/dist/frontend/lowering/builtins/compression.js.map +1 -0
- package/dist/frontend/lowering/builtins/console.d.ts +10 -0
- package/dist/frontend/lowering/builtins/console.js +38 -0
- package/dist/frontend/lowering/builtins/console.js.map +1 -0
- package/dist/frontend/lowering/builtins/constants.d.ts +24 -0
- package/dist/frontend/lowering/builtins/constants.js +141 -0
- package/dist/frontend/lowering/builtins/constants.js.map +1 -0
- package/dist/frontend/lowering/builtins/crypto.d.ts +22 -0
- package/dist/frontend/lowering/builtins/crypto.js +517 -0
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -0
- package/dist/frontend/lowering/builtins/dates.d.ts +7 -0
- package/dist/frontend/lowering/builtins/dates.js +101 -0
- package/dist/frontend/lowering/builtins/dates.js.map +1 -0
- package/dist/frontend/lowering/builtins/environment.d.ts +34 -0
- package/dist/frontend/lowering/builtins/environment.js +95 -0
- package/dist/frontend/lowering/builtins/environment.js.map +1 -0
- package/dist/frontend/lowering/builtins/errors.d.ts +14 -0
- package/dist/frontend/lowering/builtins/errors.js +83 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +35 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +725 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/filesystem.d.ts +108 -0
- package/dist/frontend/lowering/builtins/filesystem.js +1061 -0
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -0
- package/dist/frontend/lowering/builtins/ipc.d.ts +8 -0
- package/dist/frontend/lowering/builtins/ipc.js +76 -0
- package/dist/frontend/lowering/builtins/ipc.js.map +1 -0
- package/dist/frontend/lowering/builtins/json.d.ts +12 -0
- package/dist/frontend/lowering/builtins/json.js +387 -0
- package/dist/frontend/lowering/builtins/json.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +85 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +346 -0
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-calls.d.ts +8 -0
- package/dist/frontend/lowering/builtins/module-calls.js +308 -0
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +38 -0
- package/dist/frontend/lowering/builtins/module-resolution.js +344 -0
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -0
- package/dist/frontend/lowering/builtins/numbers.d.ts +15 -0
- package/dist/frontend/lowering/builtins/numbers.js +124 -0
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -0
- package/dist/frontend/lowering/builtins/operating-system.d.ts +13 -0
- package/dist/frontend/lowering/builtins/operating-system.js +148 -0
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -0
- package/dist/frontend/lowering/builtins/performance.d.ts +13 -0
- package/dist/frontend/lowering/builtins/performance.js +100 -0
- package/dist/frontend/lowering/builtins/performance.js.map +1 -0
- package/dist/frontend/lowering/builtins/process.d.ts +50 -0
- package/dist/frontend/lowering/builtins/process.js +1138 -0
- package/dist/frontend/lowering/builtins/process.js.map +1 -0
- package/dist/frontend/lowering/builtins/promises.d.ts +14 -0
- package/dist/frontend/lowering/builtins/promises.js +356 -0
- package/dist/frontend/lowering/builtins/promises.js.map +1 -0
- package/dist/frontend/lowering/builtins/properties.d.ts +11 -0
- package/dist/frontend/lowering/builtins/properties.js +186 -0
- package/dist/frontend/lowering/builtins/properties.js.map +1 -0
- package/dist/frontend/lowering/builtins/querystring.d.ts +19 -0
- package/dist/frontend/lowering/builtins/querystring.js +150 -0
- package/dist/frontend/lowering/builtins/querystring.js.map +1 -0
- package/dist/frontend/lowering/builtins/readline.d.ts +13 -0
- package/dist/frontend/lowering/builtins/readline.js +138 -0
- package/dist/frontend/lowering/builtins/readline.js.map +1 -0
- package/dist/frontend/lowering/builtins/receiver-types.d.ts +5 -0
- package/dist/frontend/lowering/builtins/receiver-types.js +15 -0
- package/dist/frontend/lowering/builtins/receiver-types.js.map +1 -0
- package/dist/frontend/lowering/builtins/reflection.d.ts +13 -0
- package/dist/frontend/lowering/builtins/reflection.js +95 -0
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -0
- package/dist/frontend/lowering/builtins/strings.d.ts +14 -0
- package/dist/frontend/lowering/builtins/strings.js +121 -0
- package/dist/frontend/lowering/builtins/strings.js.map +1 -0
- package/dist/frontend/lowering/builtins/text-codecs.d.ts +29 -0
- package/dist/frontend/lowering/builtins/text-codecs.js +590 -0
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -0
- package/dist/frontend/lowering/builtins/timers.d.ts +22 -0
- package/dist/frontend/lowering/builtins/timers.js +180 -0
- package/dist/frontend/lowering/builtins/timers.js.map +1 -0
- package/dist/frontend/lowering/builtins/url.d.ts +37 -0
- package/dist/frontend/lowering/builtins/url.js +596 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -0
- package/dist/frontend/lowering/builtins/util-types.d.ts +7 -0
- package/dist/frontend/lowering/builtins/util-types.js +31 -0
- package/dist/frontend/lowering/builtins/util-types.js.map +1 -0
- package/dist/frontend/lowering/builtins/workers.d.ts +5 -0
- package/dist/frontend/lowering/builtins/workers.js +65 -0
- package/dist/frontend/lowering/builtins/workers.js.map +1 -0
- package/dist/frontend/lowering/call-arguments.d.ts +72 -0
- package/dist/frontend/lowering/call-arguments.js +618 -0
- package/dist/frontend/lowering/call-arguments.js.map +1 -0
- package/dist/frontend/lowering/call-signatures.d.ts +115 -0
- package/dist/frontend/lowering/call-signatures.js +719 -0
- package/dist/frontend/lowering/call-signatures.js.map +1 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -1
- package/dist/frontend/lowering/checked-iterable-spread.js +53 -10
- package/dist/frontend/lowering/checked-iterable-spread.js.map +1 -1
- package/dist/frontend/lowering/checked-promise-all.js +41 -9
- package/dist/frontend/lowering/checked-promise-all.js.map +1 -1
- package/dist/frontend/lowering/class-assertions.d.ts +7 -0
- package/dist/frontend/lowering/class-assertions.js +96 -0
- package/dist/frontend/lowering/class-assertions.js.map +1 -0
- package/dist/frontend/lowering/class-callbacks.d.ts +1 -1
- package/dist/frontend/lowering/class-callbacks.js +130 -27
- package/dist/frontend/lowering/class-callbacks.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +1 -1
- package/dist/frontend/lowering/class-construction.js +247 -50
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-descriptors.js +109 -29
- package/dist/frontend/lowering/class-descriptors.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +6 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.js +2471 -465
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +284 -44
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-instance-constructor.js +17 -5
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +199 -51
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +17 -0
- package/dist/frontend/lowering/class-protocols.js +126 -0
- package/dist/frontend/lowering/class-protocols.js.map +1 -0
- package/dist/frontend/lowering/class-prototypes.js +345 -86
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-runtime-statics.d.ts +1 -1
- package/dist/frontend/lowering/class-runtime-statics.js +80 -17
- package/dist/frontend/lowering/class-runtime-statics.js.map +1 -1
- package/dist/frontend/lowering/class-static-data.js +76 -16
- package/dist/frontend/lowering/class-static-data.js.map +1 -1
- package/dist/frontend/lowering/coercions/builders.d.ts +13 -0
- package/dist/frontend/lowering/coercions/builders.js +77 -0
- package/dist/frontend/lowering/coercions/builders.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.d.ts +58 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +430 -0
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -0
- package/dist/frontend/lowering/coercions/island.d.ts +37 -0
- package/dist/frontend/lowering/coercions/island.js +350 -0
- package/dist/frontend/lowering/coercions/island.js.map +1 -0
- package/dist/frontend/lowering/coercions/state.d.ts +14 -0
- package/dist/frontend/lowering/coercions/state.js +16 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural-plans.d.ts +40 -0
- package/dist/frontend/lowering/coercions/structural-plans.js +447 -0
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural.d.ts +63 -0
- package/dist/frontend/lowering/coercions/structural.js +616 -0
- package/dist/frontend/lowering/coercions/structural.js.map +1 -0
- package/dist/frontend/lowering/coercions/unions.d.ts +65 -0
- package/dist/frontend/lowering/coercions/unions.js +318 -0
- package/dist/frontend/lowering/coercions/unions.js.map +1 -0
- package/dist/frontend/lowering/collection-ingestion.js +355 -72
- package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +88 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +1611 -0
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -0
- package/dist/frontend/lowering/containers/array-construction.d.ts +42 -0
- package/dist/frontend/lowering/containers/array-construction.js +1044 -0
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -0
- package/dist/frontend/lowering/containers/array-iteration.d.ts +16 -0
- package/dist/frontend/lowering/containers/array-iteration.js +95 -0
- package/dist/frontend/lowering/containers/array-iteration.js.map +1 -0
- package/dist/frontend/lowering/containers/array-methods.d.ts +27 -0
- package/dist/frontend/lowering/containers/array-methods.js +1854 -0
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/bytes.d.ts +17 -17
- package/dist/frontend/lowering/containers/bytes.js +430 -138
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.d.ts +26 -0
- package/dist/frontend/lowering/containers/callback-arguments.js +179 -0
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -0
- package/dist/frontend/lowering/containers/collection-grouping.d.ts +19 -0
- package/dist/frontend/lowering/containers/collection-grouping.js +297 -0
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -0
- package/dist/frontend/lowering/containers/collection-methods.d.ts +57 -0
- package/dist/frontend/lowering/containers/collection-methods.js +1314 -0
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.d.ts +18 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.js +114 -0
- package/dist/frontend/lowering/containers/dynamic-receivers.js.map +1 -0
- package/dist/frontend/lowering/containers/for-of.d.ts +60 -0
- package/dist/frontend/lowering/containers/for-of.js +643 -0
- package/dist/frontend/lowering/containers/for-of.js.map +1 -0
- package/dist/frontend/lowering/containers/indexed-objects.d.ts +132 -0
- package/dist/frontend/lowering/containers/indexed-objects.js +1743 -0
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -0
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +20 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js +809 -0
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +601 -160
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +213 -63
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.js +263 -64
- package/dist/frontend/lowering/crypto-tables.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +172 -68
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.test.js +41 -8
- package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
- package/dist/frontend/lowering/error-methods.js +339 -65
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/evaluation-safety.js +3 -2
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/global-symbols.js +2 -1
- package/dist/frontend/lowering/expressions/global-symbols.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +11 -5
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +67 -13
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +588 -165
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +68 -17
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-field-write.js +45 -18
- package/dist/frontend/lowering/expressions/union-field-write.js.map +1 -1
- package/dist/frontend/lowering/function-context.js +5 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.d.ts +67 -0
- package/dist/frontend/lowering/function-returns.js +392 -0
- package/dist/frontend/lowering/function-returns.js.map +1 -0
- package/dist/frontend/lowering/generator-delegation.d.ts +1 -1
- package/dist/frontend/lowering/generator-delegation.js +171 -39
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +176 -36
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +271 -0
- package/dist/frontend/lowering/generic-functions.js +1730 -0
- package/dist/frontend/lowering/generic-functions.js.map +1 -0
- package/dist/frontend/lowering/import-meta.d.ts +1 -1
- package/dist/frontend/lowering/import-meta.js +37 -14
- package/dist/frontend/lowering/import-meta.js.map +1 -1
- package/dist/frontend/lowering/indexed-comparison.js +6 -2
- package/dist/frontend/lowering/indexed-comparison.js.map +1 -1
- package/dist/frontend/lowering/instantiation-path.d.ts +8 -0
- package/dist/frontend/lowering/instantiation-path.js +10 -0
- package/dist/frontend/lowering/instantiation-path.js.map +1 -0
- package/dist/frontend/lowering/instantiation-path.test.d.ts +1 -0
- package/dist/frontend/lowering/instantiation-path.test.js +23 -0
- package/dist/frontend/lowering/instantiation-path.test.js.map +1 -0
- package/dist/frontend/lowering/iterator-consumption.d.ts +9 -0
- package/dist/frontend/lowering/iterator-consumption.js +91 -0
- package/dist/frontend/lowering/iterator-consumption.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.js +40 -17
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.test.js +49 -11
- package/dist/frontend/lowering/lib-boundary.test.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.d.ts +0 -19
- package/dist/frontend/lowering/lower-array-sort.js +331 -566
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +248 -43
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +71 -16
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +430 -77
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +39 -558
- package/dist/frontend/lowering/lower-calls.js +2628 -5669
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +248 -242
- package/dist/frontend/lowering/lower-classes.js +1820 -775
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +35 -35
- package/dist/frontend/lowering/lower-comptime.js +39 -37
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +59 -31
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.js +5 -2
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +323 -86
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +19 -7
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +194 -194
- package/dist/frontend/lowering/lower-exprs.js +3473 -1160
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.d.ts +23 -0
- package/dist/frontend/lowering/lower-functions.js +449 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -0
- package/dist/frontend/lowering/lower-generators.js +121 -32
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.js +15 -4
- package/dist/frontend/lowering/lower-global-value.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +479 -89
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +79 -79
- package/dist/frontend/lowering/lower-island.js +366 -274
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-island.test.js +7 -2
- package/dist/frontend/lowering/lower-island.test.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +17 -8
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +95 -94
- package/dist/frontend/lowering/lower-modules.js +655 -329
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +91 -20
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.js +25 -8
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.js +115 -34
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +1210 -290
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +148 -148
- package/dist/frontend/lowering/lower-stmts.js +2324 -994
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +13 -5
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +363 -91
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-system-errors.js +30 -8
- package/dist/frontend/lowering/lower-system-errors.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +40 -13
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.d.ts +31 -0
- package/dist/frontend/lowering/lower-timers.js +336 -0
- package/dist/frontend/lowering/lower-timers.js.map +1 -0
- package/dist/frontend/lowering/lower-url.d.ts +1 -1
- package/dist/frontend/lowering/lower-url.js +46 -13
- package/dist/frontend/lowering/lower-url.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +34 -352
- package/dist/frontend/lowering/lowerer.js +1074 -2712
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +85 -17
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.js +43 -8
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.d.ts +21 -1
- package/dist/frontend/lowering/native-ffi.js +487 -18
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/object-enumeration-receiver.js +55 -10
- package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -1
- package/dist/frontend/lowering/object-factory-new.d.ts +1 -1
- package/dist/frontend/lowering/object-factory-new.js +36 -11
- package/dist/frontend/lowering/object-factory-new.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.js +49 -20
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.js +66 -14
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-locals.js +3 -1
- package/dist/frontend/lowering/runtime-optional-locals.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-locals.test.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.js +4 -1
- package/dist/frontend/lowering/sanitize-class-types.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +86 -18
- package/dist/frontend/lowering/sanitize-class-types.test.js.map +1 -1
- package/dist/frontend/lowering/split-consumers.d.ts +7 -0
- package/dist/frontend/lowering/split-consumers.js +64 -0
- package/dist/frontend/lowering/split-consumers.js.map +1 -0
- package/dist/frontend/lowering/static-this.js +13 -6
- package/dist/frontend/lowering/static-this.js.map +1 -1
- package/dist/frontend/lowering/string-index.js +32 -10
- package/dist/frontend/lowering/string-index.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +45 -46
- package/dist/frontend/lowering/surfaces.js +1129 -256
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.js +40 -15
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/symbol-methods.js.map +1 -1
- package/dist/frontend/lowering/text-decoder-encoding.js +236 -24
- package/dist/frontend/lowering/text-decoder-encoding.js.map +1 -1
- package/dist/frontend/lowering/text-decoder-encoding.test.js +84 -12
- package/dist/frontend/lowering/text-decoder-encoding.test.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.js +59 -16
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.test.js +24 -7
- package/dist/frontend/lowering/union-narrow.test.js.map +1 -1
- package/dist/frontend/lowering/union-retag.js +155 -40
- package/dist/frontend/lowering/union-retag.js.map +1 -1
- package/dist/frontend/lowering/union-retag.test.js +131 -33
- package/dist/frontend/lowering/union-retag.test.js.map +1 -1
- package/dist/frontend/lowering/unregistered-class-types.js.map +1 -1
- package/dist/frontend/lowering/unregistered-class-types.test.js +34 -8
- package/dist/frontend/lowering/unregistered-class-types.test.js.map +1 -1
- package/dist/frontend/module-source-candidates.d.ts +10 -0
- package/dist/frontend/module-source-candidates.js +40 -0
- package/dist/frontend/module-source-candidates.js.map +1 -0
- package/dist/frontend/module-source-candidates.test.d.ts +1 -0
- package/dist/frontend/module-source-candidates.test.js +53 -0
- package/dist/frontend/module-source-candidates.test.js.map +1 -0
- package/dist/frontend/module-syntax.js +21 -8
- package/dist/frontend/module-syntax.js.map +1 -1
- package/dist/frontend/module-syntax.test.js +37 -13
- package/dist/frontend/module-syntax.test.js.map +1 -1
- package/dist/frontend/npm-fetch-analysis.js +13 -4
- package/dist/frontend/npm-fetch-analysis.js.map +1 -1
- package/dist/frontend/npm-fetch-analysis.test.js +33 -10
- package/dist/frontend/npm-fetch-analysis.test.js.map +1 -1
- package/dist/frontend/npm-fetch-node.js.map +1 -1
- package/dist/frontend/npm-fetch-syntax.js +4 -9
- package/dist/frontend/npm-fetch-syntax.js.map +1 -1
- package/dist/frontend/npm-node.js +3 -1
- package/dist/frontend/npm-node.js.map +1 -1
- package/dist/frontend/npm-static-bundled-cjs.js +88 -29
- package/dist/frontend/npm-static-bundled-cjs.js.map +1 -1
- package/dist/frontend/npm-static-bundled-cjs.test.js +29 -10
- package/dist/frontend/npm-static-bundled-cjs.test.js.map +1 -1
- package/dist/frontend/npm-static-declaration-syntax.js +148 -56
- package/dist/frontend/npm-static-declaration-syntax.js.map +1 -1
- package/dist/frontend/npm-static-declarations.d.ts +1 -1
- package/dist/frontend/npm-static-declarations.js.map +1 -1
- package/dist/frontend/npm-static-declarations.test.js +33 -7
- package/dist/frontend/npm-static-declarations.test.js.map +1 -1
- package/dist/frontend/npm-static-prune.js +26 -12
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +17 -3
- package/dist/frontend/npm-static-prune.test.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-host.js +2 -3
- package/dist/frontend/npm-static-rewrite-host.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +64 -21
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.js +9 -4
- package/dist/frontend/npm-static-subtyping.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.test.js +30 -6
- package/dist/frontend/npm-static-subtyping.test.js.map +1 -1
- package/dist/frontend/npm-static.js +15 -4
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.js +122 -36
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +30 -10
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.js +25 -8
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +21 -7
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +2 -0
- package/dist/frontend/program-analysis.js +2 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program-node.js +5 -3
- package/dist/frontend/program-node.js.map +1 -1
- package/dist/frontend/program.d.ts +2 -2
- package/dist/frontend/program.js +248 -127
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +27 -27
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/provenance-core.js +8 -4
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/provenance-registry.js +1 -4
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/resolve.js +32 -20
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/resolve.test.js +1 -1
- package/dist/frontend/resolve.test.js.map +1 -1
- package/dist/frontend/runtime-resolve.js +13 -4
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.test.js +25 -9
- package/dist/frontend/runtime-resolve.test.js.map +1 -1
- package/dist/frontend/services-node.js +6 -2
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services-node.test.js +18 -6
- package/dist/frontend/services-node.test.js.map +1 -1
- package/dist/frontend/services.js +8 -4
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +6 -2
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/ts7/api.js +12 -4
- package/dist/frontend/ts7/api.js.map +1 -1
- package/dist/frontend/ts7/ast-bytes.js +10 -3
- package/dist/frontend/ts7/ast-bytes.js.map +1 -1
- package/dist/frontend/ts7/ast-bytes.test.js +23 -4
- package/dist/frontend/ts7/ast-bytes.test.js.map +1 -1
- package/dist/frontend/ts7/ast-guards.test.js +14 -5
- package/dist/frontend/ts7/ast-guards.test.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +6 -1
- package/dist/frontend/ts7/ast-node.js +490 -172
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +150 -36
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-text.js +13 -3
- package/dist/frontend/ts7/ast-text.js.map +1 -1
- package/dist/frontend/ts7/ast-text.test.js.map +1 -1
- package/dist/frontend/ts7/ast-types.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +5 -1
- package/dist/frontend/ts7/ast-wire.js +83 -20
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.test.js +53 -8
- package/dist/frontend/ts7/ast-wire.test.js.map +1 -1
- package/dist/frontend/ts7/ast.d.ts +2 -1
- package/dist/frontend/ts7/ast.js +53 -30
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/census-check.js +1 -1
- package/dist/frontend/ts7/census-check.js.map +1 -1
- package/dist/frontend/ts7/checker-cache.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +8 -2
- package/dist/frontend/ts7/checker.js +46 -8
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +96 -17
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/enums.test.js +9 -4
- package/dist/frontend/ts7/enums.test.js.map +1 -1
- package/dist/frontend/ts7/native-api.js.map +1 -1
- package/dist/frontend/ts7/native-host.js.map +1 -1
- package/dist/frontend/ts7/native-process.js +9 -3
- package/dist/frontend/ts7/native-process.js.map +1 -1
- package/dist/frontend/ts7/program-adapter.js +1 -1
- package/dist/frontend/ts7/program-adapter.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +7 -0
- package/dist/frontend/ts7/program-host.js +33 -6
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/program-host.test.js +72 -11
- package/dist/frontend/ts7/program-host.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-api.js +3 -1
- package/dist/frontend/ts7/rpc-api.js.map +1 -1
- package/dist/frontend/ts7/rpc-client.js +15 -5
- package/dist/frontend/ts7/rpc-client.js.map +1 -1
- package/dist/frontend/ts7/rpc-client.test.js +26 -8
- package/dist/frontend/ts7/rpc-client.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.js.map +1 -1
- package/dist/frontend/ts7/rpc-filesystem.test.js +43 -10
- package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.js +16 -6
- package/dist/frontend/ts7/rpc-process.js.map +1 -1
- package/dist/frontend/ts7/rpc-process.test.js.map +1 -1
- package/dist/frontend/ts7/rpc-wire.d.ts +1 -0
- package/dist/frontend/ts7/rpc-wire.js +41 -14
- package/dist/frontend/ts7/rpc-wire.js.map +1 -1
- package/dist/frontend/ts7/rpc-wire.test.js +36 -6
- package/dist/frontend/ts7/rpc-wire.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.js +209 -68
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.test.js +29 -14
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.js +7 -1
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.test.js +17 -3
- package/dist/frontend/ts7/semantic-json.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.js +147 -51
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +72 -19
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-types.d.ts +2 -2
- package/dist/frontend/ts7/session-cache.js +10 -3
- package/dist/frontend/ts7/session-cache.js.map +1 -1
- package/dist/frontend/ts7/session-cache.test.js +13 -4
- package/dist/frontend/ts7/session-cache.test.js.map +1 -1
- package/dist/frontend/ts7/session-path.js +25 -10
- package/dist/frontend/ts7/session-path.js.map +1 -1
- package/dist/frontend/ts7/session-path.test.js +47 -4
- package/dist/frontend/ts7/session-path.test.js.map +1 -1
- package/dist/frontend/ts7/session-timing.js +22 -3
- package/dist/frontend/ts7/session-timing.js.map +1 -1
- package/dist/frontend/ts7/session-timing.test.js +12 -3
- package/dist/frontend/ts7/session-timing.test.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +1 -0
- package/dist/frontend/ts7/session.js +109 -35
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/ts7/session.test.js +69 -15
- package/dist/frontend/ts7/session.test.js.map +1 -1
- package/dist/frontend/ts7/source-parser.js +17 -6
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/ts7/source-parser.test.js +32 -9
- package/dist/frontend/ts7/source-parser.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +56 -11
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/tsc-codes.test.d.ts +1 -0
- package/dist/frontend/tsc-codes.test.js +16 -0
- package/dist/frontend/tsc-codes.test.js.map +1 -0
- package/dist/frontend/type-mapper.d.ts +3 -0
- package/dist/frontend/type-mapper.js +589 -206
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +108 -33
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend/union-discriminants.js +8 -2
- package/dist/frontend/union-discriminants.js.map +1 -1
- package/dist/frontend/union-discriminants.test.js +77 -20
- package/dist/frontend/union-discriminants.test.js.map +1 -1
- package/dist/frontend/worker-target.d.ts +6 -0
- package/dist/frontend/worker-target.js +108 -0
- package/dist/frontend/worker-target.js.map +1 -0
- package/dist/frontend/worker-target.test.d.ts +1 -0
- package/dist/frontend/worker-target.test.js +71 -0
- package/dist/frontend/worker-target.test.js.map +1 -0
- package/dist/index.d.ts +9 -8
- package/dist/index.js +174 -88
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.js +95 -38
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +91 -15
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/api.d.ts +4 -0
- package/dist/ir/api.js +6 -0
- package/dist/ir/api.js.map +1 -0
- package/dist/ir/build.d.ts +7 -0
- package/dist/ir/build.js +27 -1
- package/dist/ir/build.js.map +1 -1
- package/dist/ir/builtin-effects.d.ts +9 -0
- package/dist/ir/builtin-effects.js +643 -0
- package/dist/ir/builtin-effects.js.map +1 -0
- package/dist/ir/builtin-signatures.d.ts +15 -0
- package/dist/ir/builtin-signatures.js +3397 -0
- package/dist/ir/builtin-signatures.js.map +1 -0
- package/dist/ir/byte-numbers.js +67 -16
- package/dist/ir/byte-numbers.js.map +1 -1
- package/dist/ir/byte-numbers.test.js +17 -4
- package/dist/ir/byte-numbers.test.js.map +1 -1
- package/dist/ir/constant-tables.js +13 -5
- package/dist/ir/constant-tables.js.map +1 -1
- package/dist/ir/constant-tables.test.js +47 -7
- package/dist/ir/constant-tables.test.js.map +1 -1
- package/dist/ir/control-flow.js +2 -1
- package/dist/ir/control-flow.js.map +1 -1
- package/dist/ir/control-flow.test.js +35 -11
- package/dist/ir/control-flow.test.js.map +1 -1
- package/dist/ir/initializer-bindings.d.ts +9 -0
- package/dist/ir/initializer-bindings.js +115 -0
- package/dist/ir/initializer-bindings.js.map +1 -0
- package/dist/ir/initializer-bindings.test.d.ts +1 -0
- package/dist/ir/initializer-bindings.test.js +118 -0
- package/dist/ir/initializer-bindings.test.js.map +1 -0
- package/dist/ir/integer-loop-facts.d.ts +12 -0
- package/dist/ir/integer-loop-facts.js +137 -0
- package/dist/ir/integer-loop-facts.js.map +1 -0
- package/dist/ir/integer-loops.js +85 -30
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +76 -13
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.js +93 -21
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +199 -21
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/intrinsic-signatures.d.ts +20 -0
- package/dist/ir/intrinsic-signatures.js +57 -0
- package/dist/ir/intrinsic-signatures.js.map +1 -0
- package/dist/ir/ir.d.ts +15 -2160
- package/dist/ir/ir.js +160 -1396
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +98 -77
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/numeric-call-specialization.d.ts +8 -0
- package/dist/ir/numeric-call-specialization.js +198 -0
- package/dist/ir/numeric-call-specialization.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +221 -0
- package/dist/ir/runtime-features.js +552 -0
- package/dist/ir/runtime-features.js.map +1 -0
- package/dist/ir/runtime-features.test.d.ts +1 -0
- package/dist/ir/runtime-features.test.js +98 -0
- package/dist/ir/runtime-features.test.js.map +1 -0
- package/dist/ir/scalar-records.js +130 -40
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/scalar-records.test.js +146 -27
- package/dist/ir/scalar-records.test.js.map +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +7 -5
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.js +44 -9
- package/dist/ir/serialize.test.js.map +1 -1
- package/dist/ir/traverse.js +156 -43
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/traverse.test.js +99 -24
- package/dist/ir/traverse.test.js.map +1 -1
- package/dist/ir/validate.d.ts +1 -31
- package/dist/ir/validate.js +869 -1910
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +697 -114
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/cache-primitives.js +9 -10
- package/dist/library/cache-primitives.js.map +1 -1
- package/dist/library/cache-reset.test.js +2 -1
- package/dist/library/cache-reset.test.js.map +1 -1
- package/dist/library/compiler-self-identity.js +11 -5
- package/dist/library/compiler-self-identity.js.map +1 -1
- package/dist/library/compiler-self-identity.test.js +10 -3
- package/dist/library/compiler-self-identity.test.js.map +1 -1
- package/dist/library/fence-eval.js +24 -7
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/fence-eval.test.js +31 -7
- package/dist/library/fence-eval.test.js.map +1 -1
- package/dist/library/int-infer.js +199 -59
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +137 -61
- package/dist/library/int-infer.test.js.map +1 -1
- package/dist/library/ir-policy.d.ts +27 -0
- package/dist/library/ir-policy.js +234 -0
- package/dist/library/ir-policy.js.map +1 -0
- package/dist/library/library-cache.js +40 -17
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +29 -18
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/library/library-profile.js +68 -13
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.js +48 -20
- package/dist/library/prepare.js.map +1 -1
- package/dist/library/semantic-source.js +16 -14
- package/dist/library/semantic-source.js.map +1 -1
- package/dist/library/semantic-source.test.js +9 -14
- package/dist/library/semantic-source.test.js.map +1 -1
- package/dist/library/sidecar-validate.js +53 -12
- package/dist/library/sidecar-validate.js.map +1 -1
- package/dist/library/sidecar.js +85 -24
- package/dist/library/sidecar.js.map +1 -1
- package/dist/library/trap-teaching.js +11 -2
- package/dist/library/trap-teaching.js.map +1 -1
- package/dist/native/cache.js +10 -4
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +34 -9
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +191 -54
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +134 -33
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/comptime.js +23 -7
- package/dist/native/comptime.js.map +1 -1
- package/dist/native/comptime.test.js +26 -6
- package/dist/native/comptime.test.js.map +1 -1
- package/dist/native/executable-cache.js +77 -27
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/executable-cache.test.js +41 -6
- package/dist/native/executable-cache.test.js.map +1 -1
- package/dist/native/file-identity.js +9 -2
- package/dist/native/file-identity.js.map +1 -1
- package/dist/native/file-identity.test.js.map +1 -1
- package/dist/native/library.js +50 -12
- package/dist/native/library.js.map +1 -1
- package/dist/native/prepare.js +121 -34
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +22 -6
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/runtime-typescript.js +24 -11
- package/dist/native/runtime-typescript.js.map +1 -1
- package/dist/native/runtime-typescript.test.js.map +1 -1
- package/dist/native/sanitizer.js +71 -18
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +78 -20
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/native/task.js.map +1 -1
- package/dist/native/task.test.js +7 -2
- package/dist/native/task.test.js.map +1 -1
- package/dist/native/toolchain.js +68 -26
- package/dist/native/toolchain.js.map +1 -1
- package/dist/native/toolchain.test.js +59 -20
- package/dist/native/toolchain.test.js.map +1 -1
- package/dist/startup-cache.d.ts +1 -1
- package/dist/startup-cache.js +1 -1
- package/dist/startup-cache.js.map +1 -1
- package/dist/timing.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +30 -2
- package/dist/frontend/lowering/lower-builtins.d.ts +0 -601
- package/dist/frontend/lowering/lower-builtins.js +0 -8986
- package/dist/frontend/lowering/lower-builtins.js.map +0 -1
- package/dist/frontend/lowering/lower-containers.d.ts +0 -382
- package/dist/frontend/lowering/lower-containers.js +0 -7344
- package/dist/frontend/lowering/lower-containers.js.map +0 -1
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
import { toolchainEnvironmentCachePolicy, toolchainEnvironmentFingerprint, } from "../toolchain-environment.js";
|
|
2
|
+
import { isMobileTarget } from "../target-platform.js";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { chmod, mkdtemp, readFile, rename, rm, writeFile } from "node:fs/promises";
|
|
5
|
+
import { availableParallelism, tmpdir } from "node:os";
|
|
6
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
7
|
+
import { executableOptimizationLinkerArgs, executableStripLinkerArgs, windowsSubsystemLinkerArgs, } from "../targets.js";
|
|
8
|
+
import { createDarwinDebugSymbols, installDarwinDebugSymbols, needsDarwinDebugSymbols, readDarwinDebugSymbols, } from "../debug-symbols.js";
|
|
9
|
+
import { cacheRootDir, copyValidCachedFile, ensurePrivateCacheRoot, fileDigest, installArtifact, privateSiblingPath, protectCachedArtifact, pruneCache, publishCachedFile, } from "../build-cache.js";
|
|
10
|
+
import {} from "./contracts.js";
|
|
11
|
+
import { runtimeSrcDir, EXECUTABLE_RUNTIME_SOURCES, runtimeFingerprint, runtimeFingerprintInputPaths, } from "./runtime-inputs.js";
|
|
12
|
+
import { resolveCc, targetPlatform, executableSectionEliminationFlags, cacheTargetIdentity, isZigDriver, isMuslTarget, } from "./driver.js";
|
|
13
|
+
import { resolveProgramShardMergeIdentity, selectProgramShards, updateProgramShardCacheIdentity, } from "./program-shards.js";
|
|
14
|
+
import { compilerDriverSupportsPersistentCache, resolvedTool, directCompilerSelections, compilerDriverProbeKey, ccVersion, } from "./tool-identity.js";
|
|
15
|
+
import { localArtifactIdentity, localArtifactStampPath, localArtifactHit, nativeMetadataKey, readNativeMetadataStamp, publishNativeMetadataStamp, snapshotLocalArtifactDependencies, nativeArtifactDependenciesStillMatch, publishLocalArtifactStamp, } from "./artifact-stamps.js";
|
|
16
|
+
import { implicitToolchainFingerprints, effectiveCompilerInvocationFingerprint, translationUnitDependencyFingerprint, implicitToolchainFingerprint, } from "./compiler-fingerprint.js";
|
|
17
|
+
import { fingerprintDependencyPaths, fingerprintDependenciesStillMatch, } from "./dependency-files.js";
|
|
18
|
+
import { currentVendorCacheBuildIdentity, vendorBuildCacheRoot, engineArchivePath, tlsArchivePath, lreObjectPaths, zlibObjectPaths, curlStubDirPath, ensureEngineArchive, stageVendorInputs, ensureTlsArchive, ensureLreObjects, ensureZlibObjects, ensureCurlStub, vendorEngineDir, vendorZlibDir, vendorTlsDir, vendorCurlDir, } from "./vendor.js";
|
|
19
|
+
import { execFileAsync, subprocessFailureDetail, CcCompileError } from "./process.js";
|
|
20
|
+
import { implicitLinkerFingerprint } from "./linker-fingerprint.js";
|
|
21
|
+
import { CacheInputsChangedError } from "./session.js";
|
|
22
|
+
import { ensureRuntimeObjects, stageRuntimeObjects, clearCcCaches } from "./runtime-objects.js";
|
|
23
|
+
import { localizeLibraryObjects } from "./object-merge.js";
|
|
24
|
+
/** Compiles one C program together with the runtime sources.
|
|
25
|
+
* With caching disabled, the runtime (a dozen small files) is recompiled on
|
|
26
|
+
* every build — no cached-archive staleness bugs. Sanitized dev builds compile
|
|
27
|
+
* the program separately so its O0 setting does not slow the O1 runtime.
|
|
28
|
+
* Other builds use one clang invocation. --dynamic additionally compiles
|
|
29
|
+
* scr_island.c under SCR_DYNAMIC and links the cached engine archive (built
|
|
30
|
+
* lazily, see above); regex-using programs additionally compile scr_regex.c
|
|
31
|
+
* and link libregexp (the cached objects, or the archive's own copy under
|
|
32
|
+
* --dynamic). Executable links use the target's section-elimination recipe
|
|
33
|
+
* independently of those feature gates.
|
|
34
|
+
*
|
|
35
|
+
* With a caller-supplied dependency identity and an enabled cache root,
|
|
36
|
+
* unchanged programs skip payload code generation/linking via the binary
|
|
37
|
+
* cache after lightweight metadata probes, and misses link the program's own
|
|
38
|
+
* TU against cached per-flavor runtime objects. */
|
|
39
|
+
export async function compileCInternal(opts, cacheWarmOnly, cacheWarmPaths) {
|
|
40
|
+
const rtDir = runtimeSrcDir();
|
|
41
|
+
const sanitize = opts.sanitize ?? false;
|
|
42
|
+
const optimization = opts.optimization ?? "release";
|
|
43
|
+
const dynamic = opts.dynamic ?? false;
|
|
44
|
+
if (opts.workers && (dynamic || targetPlatform(resolveCc()) === "wasi"))
|
|
45
|
+
throw new Error("worker threads require a native static executable");
|
|
46
|
+
const regex = opts.regex ?? false;
|
|
47
|
+
// fetch's implementation switch: the default is the NATIVE bridge
|
|
48
|
+
// (scr_fetch.c over scr_net + scr_tls + scr_http's client parser +
|
|
49
|
+
// zlib — no libcurl anywhere), which implies the socket units into the
|
|
50
|
+
// link. SCRIPTC_FETCH_CURL=1 keeps the retired curl reference
|
|
51
|
+
// (scr_fetch_curl.c + system libcurl / the linux soname stub)
|
|
52
|
+
// compilable for one release as the flip's reference.
|
|
53
|
+
const fetchOn = opts.fetch ?? false;
|
|
54
|
+
// The retired curl bridge has only a SCR_DYNAMIC implementation.
|
|
55
|
+
// Static fetch always keeps the native runtime even when a developer
|
|
56
|
+
// has the comparison switch exported in their shell.
|
|
57
|
+
const curlFetch = dynamic && fetchOn && process.env["SCRIPTC_FETCH_CURL"] === "1";
|
|
58
|
+
const nativeFetch = fetchOn && !curlFetch;
|
|
59
|
+
// The island's node:http/https client bridge: embedded graphs that
|
|
60
|
+
// import those builtins get working clients over the same socket units
|
|
61
|
+
// (native-fetch builds always carry it — scr_fetch_install registers it).
|
|
62
|
+
const netIsland = dynamic && ((opts.netIsland ?? false) || nativeFetch);
|
|
63
|
+
const net = (opts.net ?? false) || nativeFetch || netIsland;
|
|
64
|
+
const http = (opts.http ?? false) || nativeFetch || netIsland;
|
|
65
|
+
const tls = (opts.tls ?? false) || nativeFetch || netIsland;
|
|
66
|
+
const tlsCa = (opts.tlsCa ?? false) || tls;
|
|
67
|
+
const driver = resolveCc();
|
|
68
|
+
const darwinDebugSymbols = needsDarwinDebugSymbols(targetPlatform(driver), optimization, opts.strip);
|
|
69
|
+
if (opts.frameworks?.length && targetPlatform(driver) !== "darwin")
|
|
70
|
+
throw new Error("FFI frameworks require a Darwin target");
|
|
71
|
+
if (opts.frameworks?.some((name) => !/^[A-Za-z][A-Za-z0-9_]*$/.test(name)))
|
|
72
|
+
throw new Error("Invalid FFI framework name");
|
|
73
|
+
const debugFlags = optimization === "dev" && !opts.strip
|
|
74
|
+
? ["-gline-tables-only", ...(opts.cPath.endsWith(".ll") ? [] : ["-gno-column-info"])]
|
|
75
|
+
: [];
|
|
76
|
+
const { programShards, programPublicSymbols, programShardMergeIdentity } = await selectProgramShards(driver, opts, optimization === "dev" && !sanitize);
|
|
77
|
+
// Mobile triples produce library archives, never standalone executables:
|
|
78
|
+
// the executable-lane runtime (event loop, sockets, child processes) is
|
|
79
|
+
// not verified on those device classes. compile() reports the SC3002
|
|
80
|
+
// diagnostic first; this is the backstop for direct compileC callers.
|
|
81
|
+
if (isMobileTarget(driver.target)) {
|
|
82
|
+
throw new Error(`SCRIPTC_TARGET=${driver.target} builds library-mode static archives only — ` +
|
|
83
|
+
`compile with a library profile (SCRIPTC_CC=zigcc scriptc build --lib --profile <profile.json>) and link the archive from the app project.`);
|
|
84
|
+
}
|
|
85
|
+
const runtimeSources = targetPlatform(driver) === "wasi"
|
|
86
|
+
? EXECUTABLE_RUNTIME_SOURCES.filter((source) => source !== "scr_child.c")
|
|
87
|
+
: EXECUTABLE_RUNTIME_SOURCES;
|
|
88
|
+
const executableSectionFlags = executableSectionEliminationFlags(targetPlatform(driver));
|
|
89
|
+
const windowsSubsystemArgs = windowsSubsystemLinkerArgs(targetPlatform(driver), opts.windowsSubsystem);
|
|
90
|
+
const executableLinkFlags = [
|
|
91
|
+
...executableSectionFlags.link,
|
|
92
|
+
...executableOptimizationLinkerArgs(targetPlatform(driver), optimization),
|
|
93
|
+
...executableStripLinkerArgs(targetPlatform(driver), opts.strip ?? false),
|
|
94
|
+
...windowsSubsystemArgs,
|
|
95
|
+
];
|
|
96
|
+
// scr_async.c submits callback-style filesystem work to a native worker.
|
|
97
|
+
// POSIX drivers need the thread compile/link mode; win32 uses CreateThread.
|
|
98
|
+
const threadArgs = targetPlatform(driver) === "win32" || targetPlatform(driver) === "wasi" ? [] : ["-pthread"];
|
|
99
|
+
if (driver.target !== null) {
|
|
100
|
+
// See the resolveCc block: these inputs are built on and for the HOST
|
|
101
|
+
// (vendored archives, system libs). Regex, zlib, and the engine archive
|
|
102
|
+
// are NOT here: their vendored sources are plain C that ensureLreObjects
|
|
103
|
+
// / ensureZlibObjects / buildEngineArchiveDirect compile per target with
|
|
104
|
+
// the driver itself — win32 included (the Windows lane runs the
|
|
105
|
+
// @dynamic corpus and the zlib program against the box's Node). The
|
|
106
|
+
// NATIVE fetch rides the socket units and cross-compiles with them —
|
|
107
|
+
// no gate; only the retired curl REFERENCE (SCRIPTC_FETCH_CURL=1)
|
|
108
|
+
// keeps a linux-only arm (the vendored curl headers + the generated
|
|
109
|
+
// soname stub, ensureCurlStub — win32 has no system libcurl contract
|
|
110
|
+
// to bind at load time). The event-loop units, tls, and dgram cross-compile to Linux
|
|
111
|
+
// AND Windows (scr_platform.h poller + per-target mbedTLS; the
|
|
112
|
+
// loop's win32 arm is WSAPoll, scr_loop_wsapoll.c, and the socket
|
|
113
|
+
// units' win32 arms respell winsock behind POSIX-errno wrappers —
|
|
114
|
+
// scr_net.c/scr_dgram.c/scr_tls.c). The events unit cross-compiles
|
|
115
|
+
// everywhere: its win32 arm is CRT signal() +
|
|
116
|
+
// PeekNamedPipe/WaitForSingleObject probes (scr_events.c), served by
|
|
117
|
+
// the loop's capped win32 idle sleep (scr_async.c).
|
|
118
|
+
const unsupported = [
|
|
119
|
+
// The NATIVE fetch cross-compiles wherever the socket units do
|
|
120
|
+
// (linux and win32 both); only the retired curl reference keeps
|
|
121
|
+
// its linux-only soname-stub arm.
|
|
122
|
+
["fetch (SCRIPTC_FETCH_CURL)", curlFetch && targetPlatform(driver) !== "linux"],
|
|
123
|
+
]
|
|
124
|
+
.filter(([, on]) => on)
|
|
125
|
+
.map(([name]) => name);
|
|
126
|
+
if (unsupported.length > 0) {
|
|
127
|
+
throw new Error(`SCRIPTC_TARGET=${driver.target}: ${unsupported.join(", ")} not supported under a cross target yet ` +
|
|
128
|
+
`(host-built vendor archives / system libs — see docs/linux-port.md).`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const cachePolicy = toolchainEnvironmentCachePolicy();
|
|
132
|
+
const configuredCacheRoot = cacheRootDir();
|
|
133
|
+
const toolchainEnv = toolchainEnvironmentFingerprint();
|
|
134
|
+
const persistentDriverCache = cachePolicy.runtimeObjects &&
|
|
135
|
+
configuredCacheRoot !== null &&
|
|
136
|
+
(await compilerDriverSupportsPersistentCache(driver, toolchainEnv));
|
|
137
|
+
// Only compiler-generated TUs opt in. Arbitrary `compileC` inputs
|
|
138
|
+
// inputs may include caller-owned headers whose contents are not otherwise
|
|
139
|
+
// represented in this key, so they retain the fully uncached historical
|
|
140
|
+
// path unless the caller supplies its own complete dependency identity.
|
|
141
|
+
const cacheIdentity = opts.cacheIdentity;
|
|
142
|
+
let persistentCache = cacheIdentity === undefined || configuredCacheRoot === null || !persistentDriverCache
|
|
143
|
+
? null
|
|
144
|
+
: { root: configuredCacheRoot, identity: cacheIdentity };
|
|
145
|
+
if (cacheWarmOnly && persistentCache === null) {
|
|
146
|
+
throw new Error("native cache warming requires a persistently cacheable compiler environment");
|
|
147
|
+
}
|
|
148
|
+
if (persistentCache !== null) {
|
|
149
|
+
try {
|
|
150
|
+
await ensurePrivateCacheRoot(persistentCache.root, process.env["SCRIPTC_CACHE_DIR"] === undefined);
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
if (cacheWarmOnly) {
|
|
154
|
+
throw new Error("native cache warming could not prepare the persistent cache root", {
|
|
155
|
+
cause: error,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
persistentCache = null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
let localArtifact = null;
|
|
162
|
+
// Generated executable TUs are closed over scriptc's own runtime tree. A
|
|
163
|
+
// same-output rebuild can therefore check those bytes directly before the
|
|
164
|
+
// broader cross-output CAS performs its compiler/SDK/linker rediscovery.
|
|
165
|
+
// FFI/native-input builds and the public arbitrary-C cache API stay on the
|
|
166
|
+
// strict path because their dependency graphs are caller-owned.
|
|
167
|
+
if (!cacheWarmOnly &&
|
|
168
|
+
persistentCache !== null &&
|
|
169
|
+
cachePolicy.completeArtifacts &&
|
|
170
|
+
persistentCache.identity === "scriptc-generated-v1" &&
|
|
171
|
+
(opts.linkInputs?.length ?? 0) === 0 &&
|
|
172
|
+
(opts.frameworks?.length ?? 0) === 0 &&
|
|
173
|
+
(opts.systemLibraries?.length ?? 0) === 0 &&
|
|
174
|
+
process.env["SCRIPTC_TEST_TRUST_COMPILER_WRAPPER"] !== "1") {
|
|
175
|
+
try {
|
|
176
|
+
const [compiler, runtimeHash, programBytes] = await Promise.all([
|
|
177
|
+
resolvedTool(driver.argv[0] ?? "clang"),
|
|
178
|
+
runtimeFingerprint(rtDir),
|
|
179
|
+
readFile(opts.cPath),
|
|
180
|
+
]);
|
|
181
|
+
if (compiler !== null) {
|
|
182
|
+
const effectiveCompiler = directCompilerSelections.get(compilerDriverProbeKey(driver, toolchainEnv)) ?? compiler;
|
|
183
|
+
const key = localArtifactIdentity(opts, driver, toolchainEnv, `${compiler.cacheIdentity}\0${effectiveCompiler.cacheIdentity}`, runtimeHash, programBytes, programShardMergeIdentity);
|
|
184
|
+
const stampPath = localArtifactStampPath(persistentCache.root, opts.outPath);
|
|
185
|
+
localArtifact = {
|
|
186
|
+
stampPath,
|
|
187
|
+
key,
|
|
188
|
+
runtimeHash,
|
|
189
|
+
programBytes,
|
|
190
|
+
compilerPath: effectiveCompiler.canonicalPath,
|
|
191
|
+
};
|
|
192
|
+
const hit = await localArtifactHit(stampPath, opts.outPath, key, darwinDebugSymbols);
|
|
193
|
+
if (hit !== null) {
|
|
194
|
+
await opts.onArtifactReady?.({ dependencies: hit.dependencies }).catch(() => undefined);
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// The output-local tier is only an optimization; the fully validated
|
|
201
|
+
// CAS below remains the source of truth on any metadata trouble.
|
|
202
|
+
localArtifact = null;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
let implicitToolchain = null;
|
|
206
|
+
let implicitCompileToolchain = null;
|
|
207
|
+
let toolchainMetadataStamp = null;
|
|
208
|
+
const metadataCompiler = persistentCache === null ? null : await resolvedTool(driver.argv[0] ?? "clang");
|
|
209
|
+
const metadataEffectiveCompiler = directCompilerSelections.get(compilerDriverProbeKey(driver, toolchainEnv)) ?? metadataCompiler;
|
|
210
|
+
const toolchainMetadataKey = persistentCache === null ||
|
|
211
|
+
metadataCompiler === null ||
|
|
212
|
+
metadataEffectiveCompiler === null ||
|
|
213
|
+
process.env["SCRIPTC_TEST_TRUST_COMPILER_WRAPPER"] === "1"
|
|
214
|
+
? null
|
|
215
|
+
: nativeMetadataKey("toolchain", [
|
|
216
|
+
cacheTargetIdentity(driver),
|
|
217
|
+
toolchainEnv,
|
|
218
|
+
driver.argv,
|
|
219
|
+
driver.targetArgs,
|
|
220
|
+
metadataCompiler.cacheIdentity,
|
|
221
|
+
metadataEffectiveCompiler.cacheIdentity,
|
|
222
|
+
rtDir,
|
|
223
|
+
]);
|
|
224
|
+
if (persistentDriverCache) {
|
|
225
|
+
try {
|
|
226
|
+
toolchainMetadataStamp =
|
|
227
|
+
persistentCache === null || toolchainMetadataKey === null
|
|
228
|
+
? null
|
|
229
|
+
: await readNativeMetadataStamp(persistentCache.root, toolchainMetadataKey);
|
|
230
|
+
implicitToolchain = toolchainMetadataStamp?.values["implicitToolchain"] ?? null;
|
|
231
|
+
implicitCompileToolchain = toolchainMetadataStamp?.values["implicitCompileToolchain"] ?? null;
|
|
232
|
+
if (implicitToolchain === null ||
|
|
233
|
+
(programShards !== null && implicitCompileToolchain === null)) {
|
|
234
|
+
const fingerprints = await implicitToolchainFingerprints(driver, toolchainEnv);
|
|
235
|
+
implicitToolchain = fingerprints.complete;
|
|
236
|
+
implicitCompileToolchain = fingerprints.compile;
|
|
237
|
+
toolchainMetadataStamp = null;
|
|
238
|
+
}
|
|
239
|
+
let compilerVersion = toolchainMetadataStamp?.values["compilerVersion"];
|
|
240
|
+
if (compilerVersion === undefined) {
|
|
241
|
+
compilerVersion = await ccVersion(driver.argv, toolchainEnv, true);
|
|
242
|
+
}
|
|
243
|
+
if (toolchainMetadataStamp === null &&
|
|
244
|
+
persistentCache !== null &&
|
|
245
|
+
toolchainMetadataKey !== null) {
|
|
246
|
+
if (metadataCompiler !== null && metadataEffectiveCompiler !== null) {
|
|
247
|
+
toolchainMetadataStamp = await publishNativeMetadataStamp(persistentCache.root, toolchainMetadataKey, {
|
|
248
|
+
implicitToolchain,
|
|
249
|
+
...(implicitCompileToolchain === null ? {} : { implicitCompileToolchain }),
|
|
250
|
+
compilerVersion,
|
|
251
|
+
}, [
|
|
252
|
+
metadataCompiler.canonicalPath,
|
|
253
|
+
metadataEffectiveCompiler.canonicalPath,
|
|
254
|
+
...fingerprintDependencyPaths(implicitToolchain),
|
|
255
|
+
...(implicitCompileToolchain === null
|
|
256
|
+
? []
|
|
257
|
+
: fingerprintDependencyPaths(implicitCompileToolchain)),
|
|
258
|
+
], [
|
|
259
|
+
implicitToolchain,
|
|
260
|
+
...(implicitCompileToolchain === null ? [] : [implicitCompileToolchain]),
|
|
261
|
+
]);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
catch (error) {
|
|
266
|
+
// Cache discovery is best-effort. In particular, a compiler wrapper can
|
|
267
|
+
// compile successfully without implementing the metadata probes.
|
|
268
|
+
if (cacheWarmOnly) {
|
|
269
|
+
throw new Error("native cache warming could not validate the compiler toolchain", {
|
|
270
|
+
cause: error,
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
persistentCache = null;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
const vendorBuildIdentity = await currentVendorCacheBuildIdentity(driver, `${toolchainEnv}\0${implicitToolchain ?? "<uncached>"}`);
|
|
277
|
+
// Mutable include/SDK/config inputs can change behind a stable environment
|
|
278
|
+
// spelling. The complete/runtime cache is disabled below; vendor objects
|
|
279
|
+
// must follow the same rule instead of silently surviving in the user cache.
|
|
280
|
+
// A private root gives this invocation the usual vendor build recipe
|
|
281
|
+
// without publishing or reusing those prerequisites.
|
|
282
|
+
const transientVendorRoot = persistentCache !== null && implicitToolchain !== null
|
|
283
|
+
? null
|
|
284
|
+
: join(tmpdir(), `scriptc-vendor-${process.pid}-${Math.random().toString(36).slice(2)}`);
|
|
285
|
+
const vendorCacheRoot = transientVendorRoot ?? vendorBuildCacheRoot(persistentCache?.root);
|
|
286
|
+
// Every vendor output path is deterministic from pins, flags, driver, and
|
|
287
|
+
// target. Build the command/key from those paths now, but do not materialize
|
|
288
|
+
// them until a complete-binary lookup has missed.
|
|
289
|
+
let engineArchive = dynamic
|
|
290
|
+
? engineArchivePath(sanitize, driver, vendorBuildIdentity, vendorCacheRoot)
|
|
291
|
+
: null;
|
|
292
|
+
let tlsArchive = tls
|
|
293
|
+
? tlsArchivePath(sanitize, driver, vendorBuildIdentity, vendorCacheRoot)
|
|
294
|
+
: null;
|
|
295
|
+
// --dynamic + regex shares the archive's libregexp (its host hooks and
|
|
296
|
+
// ours would collide; see scr_regex.c) — the standalone objects are for
|
|
297
|
+
// static builds only.
|
|
298
|
+
let lreObjects = regex && !dynamic ? lreObjectPaths(sanitize, driver, vendorBuildIdentity, vendorCacheRoot) : [];
|
|
299
|
+
// Vendored zlib is the Zig story — default host-clang builds keep the exact
|
|
300
|
+
// historical `-lz` system link (see CcOptions.zlib). The native fetch's
|
|
301
|
+
// gzip decoder rides the same objects/link.
|
|
302
|
+
let zlibObjects = ((opts.zlib ?? false) || nativeFetch) && isZigDriver(driver)
|
|
303
|
+
? zlibObjectPaths(sanitize, driver, vendorBuildIdentity, vendorCacheRoot)
|
|
304
|
+
: [];
|
|
305
|
+
// The libcurl import stub is likewise CROSS-only — host builds keep the
|
|
306
|
+
// exact historical system `-lcurl` link (see CcOptions.fetch). Curl
|
|
307
|
+
// reference builds only.
|
|
308
|
+
let curlStubDir = curlFetch && driver.target !== null
|
|
309
|
+
? curlStubDirPath(driver, vendorBuildIdentity, vendorCacheRoot)
|
|
310
|
+
: null;
|
|
311
|
+
const materializeVendorPrerequisites = async (stageRoot, materializeCacheRoot = vendorCacheRoot) => {
|
|
312
|
+
// Preserve source order to avoid multiplying first-build resource
|
|
313
|
+
// pressure when several large vendor sets are cold simultaneously.
|
|
314
|
+
if (dynamic) {
|
|
315
|
+
const cachedArchive = engineArchivePath(sanitize, driver, vendorBuildIdentity, materializeCacheRoot);
|
|
316
|
+
protectCachedArtifact(cacheWarmPaths, cachedArchive);
|
|
317
|
+
const materialize = async () => [
|
|
318
|
+
await ensureEngineArchive(sanitize, driver, vendorBuildIdentity, materializeCacheRoot),
|
|
319
|
+
];
|
|
320
|
+
const paths = stageRoot === undefined
|
|
321
|
+
? await materialize()
|
|
322
|
+
: await stageVendorInputs(materialize, join(stageRoot, "engine"));
|
|
323
|
+
engineArchive = paths[0];
|
|
324
|
+
}
|
|
325
|
+
if (tls) {
|
|
326
|
+
const cachedArchive = tlsArchivePath(sanitize, driver, vendorBuildIdentity, materializeCacheRoot);
|
|
327
|
+
protectCachedArtifact(cacheWarmPaths, cachedArchive);
|
|
328
|
+
const materialize = async () => [
|
|
329
|
+
await ensureTlsArchive(sanitize, driver, vendorBuildIdentity, materializeCacheRoot),
|
|
330
|
+
];
|
|
331
|
+
const paths = stageRoot === undefined
|
|
332
|
+
? await materialize()
|
|
333
|
+
: await stageVendorInputs(materialize, join(stageRoot, "tls"));
|
|
334
|
+
tlsArchive = paths[0];
|
|
335
|
+
}
|
|
336
|
+
if (regex && !dynamic) {
|
|
337
|
+
for (const object of lreObjectPaths(sanitize, driver, vendorBuildIdentity, materializeCacheRoot))
|
|
338
|
+
protectCachedArtifact(cacheWarmPaths, object);
|
|
339
|
+
const materialize = async () => await ensureLreObjects(sanitize, driver, vendorBuildIdentity, materializeCacheRoot);
|
|
340
|
+
lreObjects =
|
|
341
|
+
stageRoot === undefined
|
|
342
|
+
? await materialize()
|
|
343
|
+
: await stageVendorInputs(materialize, join(stageRoot, "lre"));
|
|
344
|
+
}
|
|
345
|
+
if (zlibObjects.length > 0) {
|
|
346
|
+
for (const object of zlibObjectPaths(sanitize, driver, vendorBuildIdentity, materializeCacheRoot))
|
|
347
|
+
protectCachedArtifact(cacheWarmPaths, object);
|
|
348
|
+
const materialize = async () => await ensureZlibObjects(sanitize, driver, vendorBuildIdentity, materializeCacheRoot);
|
|
349
|
+
zlibObjects =
|
|
350
|
+
stageRoot === undefined
|
|
351
|
+
? await materialize()
|
|
352
|
+
: await stageVendorInputs(materialize, join(stageRoot, "zlib"));
|
|
353
|
+
}
|
|
354
|
+
if (curlStubDir !== null) {
|
|
355
|
+
protectCachedArtifact(cacheWarmPaths, join(curlStubDirPath(driver, vendorBuildIdentity, materializeCacheRoot), "libcurl.so"));
|
|
356
|
+
const materialize = async () => [
|
|
357
|
+
join(await ensureCurlStub(driver, vendorBuildIdentity, materializeCacheRoot), "libcurl.so"),
|
|
358
|
+
];
|
|
359
|
+
const paths = stageRoot === undefined
|
|
360
|
+
? await materialize()
|
|
361
|
+
: await stageVendorInputs(materialize, join(stageRoot, "curl"));
|
|
362
|
+
curlStubDir = dirname(paths[0]);
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
// rt() maps each runtime source's path on the command line: identity for
|
|
366
|
+
// the historical single invocation, cached-.o substitution on cache misses.
|
|
367
|
+
const buildArgs = (rt, build = {}) => [
|
|
368
|
+
"-std=c11",
|
|
369
|
+
...debugFlags,
|
|
370
|
+
...driver.targetArgs,
|
|
371
|
+
...threadArgs,
|
|
372
|
+
...(opts.workers ? ["-DSCR_WORKERS"] : []),
|
|
373
|
+
...(sanitize
|
|
374
|
+
? ["-O1", "-fsanitize=address", "-DSCR_RC_AUDIT"]
|
|
375
|
+
: [optimization === "dev" ? "-O0" : "-O2"]),
|
|
376
|
+
...executableSectionFlags.compile,
|
|
377
|
+
...(opts.textDecoderLegacy ? ["-DSCR_TEXT_DECODER_LEGACY"] : []),
|
|
378
|
+
"-fno-math-errno",
|
|
379
|
+
// The runtime object model uses type-punned C: a hierarchy
|
|
380
|
+
// upcast is a raw pointer cast, so one object's header (rc, vt) and
|
|
381
|
+
// fields are read and written through BOTH the base and derived struct
|
|
382
|
+
// types (sc_retain_Derived vs sc_release_Base on the same object).
|
|
383
|
+
// C's effective-type rule calls that UB, and clang's TBAA at -O2
|
|
384
|
+
// reorders/elides the rc updates once everything inlines — an upcast
|
|
385
|
+
// identity compare frees the object while a global still owns it.
|
|
386
|
+
// The LLVM backend emits no TBAA metadata; this flag preserves
|
|
387
|
+
// matching memory semantics in the runtime. Mirrored in the
|
|
388
|
+
// cache-miss cflags below and compileLibArchive — the three option
|
|
389
|
+
// sets must stay in lockstep.
|
|
390
|
+
"-fno-strict-aliasing",
|
|
391
|
+
"-Wno-deprecated-declarations", // ucontext fibers (scr_async.c)
|
|
392
|
+
"-I",
|
|
393
|
+
rtDir,
|
|
394
|
+
...runtimeSources.map((f) => rt(join(rtDir, f))),
|
|
395
|
+
...(opts.workers
|
|
396
|
+
? ["scr_worker.c", "scr_worker_events.c", "scr_mailbox.c", "scr_message.c"].map((f) => rt(join(rtDir, f)))
|
|
397
|
+
: []),
|
|
398
|
+
...(opts.copying ? [rt(join(rtDir, "scr_copying.c"))] : []),
|
|
399
|
+
...(opts.fileHandle ? [rt(join(rtDir, "scr_file_handle.c"))] : []),
|
|
400
|
+
// win32 targets compile the libc-shim TU (stpcpy, arc4random_buf,
|
|
401
|
+
// gmtime_r, strcasestr — the _WIN32 block in scr_runtime.h declares
|
|
402
|
+
// them) and link advapi32 (the CSPRNG RtlGenRandom/SystemFunction036,
|
|
403
|
+
// GetUserNameA), iphlpapi (GetAdaptersAddresses behind
|
|
404
|
+
// os.networkInterfaces), and ws2_32 (inet_ntop there; the socket
|
|
405
|
+
// units ride the same import). Never present on the default path, so
|
|
406
|
+
// the historical line cannot change.
|
|
407
|
+
...(targetPlatform(driver) === "win32"
|
|
408
|
+
? [rt(join(rtDir, "scr_win.c")), "-ladvapi32", "-liphlpapi", "-lws2_32"]
|
|
409
|
+
: []),
|
|
410
|
+
// musl deliberately has no libc-identification predefine; resolveCc's
|
|
411
|
+
// SCR_MUSL flag and this target-selected TU travel together.
|
|
412
|
+
...(isMuslTarget(driver) ? [rt(join(rtDir, "scr_musl.c"))] : []),
|
|
413
|
+
...(regex ? ["-I", vendorEngineDir(), rt(join(rtDir, "scr_regex.c")), ...lreObjects] : []),
|
|
414
|
+
...(opts.assert || regex || opts.symbol ? [rt(join(rtDir, "scr_assert.c"))] : []),
|
|
415
|
+
...(opts.inspect
|
|
416
|
+
? [rt(join(rtDir, "scr_inspect.c")), rt(join(rtDir, "scr_console_native.c"))]
|
|
417
|
+
: []),
|
|
418
|
+
...(opts.dynInvoke || opts.workers || nativeFetch ? [rt(join(rtDir, "scr_dyn_invoke.c"))] : []),
|
|
419
|
+
...(opts.dc ? [rt(join(rtDir, "scr_dc.c"))] : []),
|
|
420
|
+
...(opts.dynAsync || opts.dynInvoke || opts.workers || opts.dc || opts.fileHandle || nativeFetch
|
|
421
|
+
? [rt(join(rtDir, "scr_async_dyn.c"))]
|
|
422
|
+
: []),
|
|
423
|
+
// The zlib UNIT (scr_zlib.c) gates on zlib.* IR use; the LINK (system
|
|
424
|
+
// libz on the default host-clang build, vendored objects on Zig builds)
|
|
425
|
+
// also serves the native fetch's gzip decoder — spread exactly once.
|
|
426
|
+
...(opts.zlib
|
|
427
|
+
? isZigDriver(driver)
|
|
428
|
+
? ["-I", vendorZlibDir(), rt(join(rtDir, "scr_zlib.c")), ...zlibObjects]
|
|
429
|
+
: [rt(join(rtDir, "scr_zlib.c"))]
|
|
430
|
+
: nativeFetch
|
|
431
|
+
? isZigDriver(driver)
|
|
432
|
+
? ["-I", vendorZlibDir(), ...zlibObjects]
|
|
433
|
+
: []
|
|
434
|
+
: []),
|
|
435
|
+
// The zlib ↔ island bridge: only when BOTH halves are in the build
|
|
436
|
+
// (the scr_inspect_island.c pattern) — the emitted main calls its
|
|
437
|
+
// installer exactly then.
|
|
438
|
+
...(opts.zlib && opts.dynamic ? [rt(join(rtDir, "scr_zlib_island.c"))] : []),
|
|
439
|
+
...(opts.events ? [rt(join(rtDir, "scr_events.c")), rt(join(rtDir, "scr_readline.c"))] : []),
|
|
440
|
+
...(opts.emitter || opts.workers ? [rt(join(rtDir, "scr_events_emitter.c"))] : []),
|
|
441
|
+
// The checked-dynamic HANDLE support unit (listener gate + runtime
|
|
442
|
+
// adapter closures): every referencing unit is one of the emitter or
|
|
443
|
+
// net families (http implies net), so handle-free binaries keep
|
|
444
|
+
// their exact size class.
|
|
445
|
+
...(opts.emitter || opts.workers || net ? [rt(join(rtDir, "scr_dyn_handle.c"))] : []),
|
|
446
|
+
...(opts.symbol ? [rt(join(rtDir, "scr_symbol.c"))] : []),
|
|
447
|
+
...(opts.assert && opts.bigint ? [rt(join(rtDir, "scr_bigint_assert.c"))] : []),
|
|
448
|
+
...(opts.qs ? [rt(join(rtDir, "scr_qs.c"))] : []),
|
|
449
|
+
...(opts.parseArgs ? [rt(join(rtDir, "scr_util.c"))] : []),
|
|
450
|
+
...(opts.parseArgs && opts.symbol ? [rt(join(rtDir, "scr_util_compare.c"))] : []),
|
|
451
|
+
...(opts.parseArgs && opts.inspect && opts.dynAsync
|
|
452
|
+
? [rt(join(rtDir, "scr_util_style.c"))]
|
|
453
|
+
: []),
|
|
454
|
+
...(opts.stream ? [rt(join(rtDir, "scr_stream.c"))] : []),
|
|
455
|
+
// The readiness-poller backends (scr_platform.h): kqueue on macOS/BSD,
|
|
456
|
+
// epoll on Linux, WSAPoll on Windows — each TU is empty off its
|
|
457
|
+
// platform, so all three link whenever a poller-using unit does and
|
|
458
|
+
// the others cost nothing (ws2_32 rides the unconditional win32 libs
|
|
459
|
+
// above).
|
|
460
|
+
...(net || opts.dgram
|
|
461
|
+
? [
|
|
462
|
+
rt(join(rtDir, "scr_loop_kqueue.c")),
|
|
463
|
+
rt(join(rtDir, "scr_loop_epoll.c")),
|
|
464
|
+
rt(join(rtDir, "scr_loop_wsapoll.c")),
|
|
465
|
+
]
|
|
466
|
+
: []),
|
|
467
|
+
...(net ? [rt(join(rtDir, "scr_net.c"))] : []),
|
|
468
|
+
...(http ? [rt(join(rtDir, "scr_http.c"))] : []),
|
|
469
|
+
...((opts.http2 ?? false) ? [rt(join(rtDir, "scr_http2.c"))] : []),
|
|
470
|
+
...(opts.dgram ? [rt(join(rtDir, "scr_dgram.c"))] : []),
|
|
471
|
+
...(opts.watch ? [rt(join(rtDir, "scr_watch.c"))] : []),
|
|
472
|
+
...(opts.foreignFfi ? [rt(join(rtDir, "scr_ffi_queue.c"))] : []),
|
|
473
|
+
...(opts.nodeTest ? [rt(join(rtDir, "scr_test.c"))] : []),
|
|
474
|
+
// The CA-store unit rides its own gate OR the tls one: scr_tls.c
|
|
475
|
+
// references its default-set override unconditionally.
|
|
476
|
+
...(tlsCa ? [rt(join(rtDir, "scr_tls_ca.c"))] : []),
|
|
477
|
+
...(tlsArchive
|
|
478
|
+
? [
|
|
479
|
+
"-I",
|
|
480
|
+
join(vendorTlsDir(), "include"),
|
|
481
|
+
rt(join(rtDir, "scr_tls.c")),
|
|
482
|
+
tlsArchive,
|
|
483
|
+
// mbedTLS's win32 entropy poll is BCryptGenRandom (bcrypt.h).
|
|
484
|
+
// The unconditional win32 libs above do not carry it.
|
|
485
|
+
// Never present on the default path, so the historical TLS
|
|
486
|
+
// link line cannot change.
|
|
487
|
+
...(targetPlatform(driver) === "win32" ? ["-lbcrypt"] : []),
|
|
488
|
+
]
|
|
489
|
+
: []),
|
|
490
|
+
// scr_tls_ca.c enumerates and PEM-encodes Windows system-store entries.
|
|
491
|
+
// This is independent of the mbedTLS archive: getCACertificates-only
|
|
492
|
+
// programs need crypt32 too, while TLS programs imply the CA unit.
|
|
493
|
+
...(tlsCa && targetPlatform(driver) === "win32" ? ["-lcrypt32"] : []),
|
|
494
|
+
// Static fetch is the engine-free half of scr_fetch.c. Dynamic builds
|
|
495
|
+
// compile the same source beside scr_island.c below, where its
|
|
496
|
+
// SCR_DYNAMIC half installs the full web surface.
|
|
497
|
+
...(nativeFetch && !dynamic ? [rt(join(rtDir, "scr_fetch.c"))] : []),
|
|
498
|
+
...(engineArchive
|
|
499
|
+
? [
|
|
500
|
+
"-DSCR_DYNAMIC",
|
|
501
|
+
"-I",
|
|
502
|
+
vendorEngineDir(),
|
|
503
|
+
rt(join(rtDir, "scr_island.c")),
|
|
504
|
+
rt(join(rtDir, "scr_web.c")),
|
|
505
|
+
// The one unit referencing BOTH the island and the inspect
|
|
506
|
+
// engine (insp.jsval): linked exactly when both halves are.
|
|
507
|
+
...(opts.inspect ? [rt(join(rtDir, "scr_inspect_island.c"))] : []),
|
|
508
|
+
// fetch: the NATIVE bridge by default (its socket/tls/zlib
|
|
509
|
+
// dependencies joined the link above); the curl REFERENCE
|
|
510
|
+
// (SCRIPTC_FETCH_CURL=1) keeps the historical system -lcurl /
|
|
511
|
+
// linux soname-stub arms for one release.
|
|
512
|
+
...(nativeFetch ? [rt(join(rtDir, "scr_fetch.c"))] : []),
|
|
513
|
+
// The island's node:http/https CLIENT bridge (scr_net_island.c):
|
|
514
|
+
// the one TU referencing both the socket units and the engine —
|
|
515
|
+
// compiled beside the native fetch (scr_fetch_install registers
|
|
516
|
+
// it) and whenever the embedded graph imports node:http/https
|
|
517
|
+
// (the emitted main calls scr_net_island_install exactly then).
|
|
518
|
+
...(netIsland ? [rt(join(rtDir, "scr_net_island.c"))] : []),
|
|
519
|
+
...(curlFetch
|
|
520
|
+
? curlStubDir !== null
|
|
521
|
+
? [
|
|
522
|
+
"-I",
|
|
523
|
+
join(vendorCurlDir(), "include"),
|
|
524
|
+
rt(join(rtDir, "scr_fetch_curl.c")),
|
|
525
|
+
`-L${curlStubDir}`,
|
|
526
|
+
"-lcurl",
|
|
527
|
+
]
|
|
528
|
+
: [rt(join(rtDir, "scr_fetch_curl.c")), "-lcurl"]
|
|
529
|
+
: []),
|
|
530
|
+
engineArchive,
|
|
531
|
+
// Linux's libm is appended after every input below for GNU ld's
|
|
532
|
+
// left-to-right archive resolution. Other dynamic targets keep
|
|
533
|
+
// the historical engine-adjacent spelling.
|
|
534
|
+
...(driver.linkArgs.includes("-lm") ? [] : ["-lm"]),
|
|
535
|
+
// The PE stack reserve, pinned to the 8MB POSIX main-stack
|
|
536
|
+
// geometry ISL_MAIN_STACK_BUDGET is sized against (4MB engine
|
|
537
|
+
// budget + 4MB excursion margin) — quickjs-ng's own CMake makes
|
|
538
|
+
// the same 8MB choice on Windows. Not left to the driver:
|
|
539
|
+
// classic mingw ld defaults to 2MB (which the budget would blow
|
|
540
|
+
// straight past); zig's lld happens to default to 16MB today,
|
|
541
|
+
// but that is nobody's contract.
|
|
542
|
+
...(targetPlatform(driver) === "win32" ? ["-Wl,--stack,8388608"] : []),
|
|
543
|
+
]
|
|
544
|
+
: []),
|
|
545
|
+
// A .ll program TU (the LLVM backend) deliberately carries no target
|
|
546
|
+
// triple (byte-stable output; clang supplies the host/SCRIPTC_TARGET
|
|
547
|
+
// triple exactly as it does for .c) — silence the -Woverride-module
|
|
548
|
+
// note about that. Never present for .c inputs, so the historical C
|
|
549
|
+
// command line cannot change by a byte.
|
|
550
|
+
...(opts.cPath.endsWith(".ll") ? ["-Wno-override-module"] : []),
|
|
551
|
+
...(build.compilerVisibleSource !== undefined && build.programPath !== undefined
|
|
552
|
+
? [
|
|
553
|
+
`-ffile-prefix-map=${build.programPath}=${build.compilerVisibleSource}`,
|
|
554
|
+
"-iquote",
|
|
555
|
+
dirname(resolve(build.compilerVisibleSource)),
|
|
556
|
+
]
|
|
557
|
+
: []),
|
|
558
|
+
build.programPath ?? opts.cPath,
|
|
559
|
+
...(opts.linkInputs ?? []),
|
|
560
|
+
...(opts.systemLibraries ?? []).map((name) => `-l${name}`),
|
|
561
|
+
...(opts.frameworks ?? []).flatMap((name) => ["-framework", name]),
|
|
562
|
+
// GNU ld resolves libraries from left to right and commonly enables
|
|
563
|
+
// --as-needed: host-clang libz must follow scr_zlib.c/scr_fetch.c and every
|
|
564
|
+
// generated/native input that references inflate symbols. Cross
|
|
565
|
+
// and targetless Zig builds use vendored zlib objects in the input section above.
|
|
566
|
+
...(((opts.zlib ?? false) || nativeFetch) && !isZigDriver(driver) ? ["-lz"] : []),
|
|
567
|
+
// glibc keeps libm separate from libc. This must trail the generated
|
|
568
|
+
// program and every native FFI input because GNU ld resolves archives
|
|
569
|
+
// from left to right.
|
|
570
|
+
...driver.linkArgs,
|
|
571
|
+
...executableLinkFlags,
|
|
572
|
+
"-o",
|
|
573
|
+
build.outPath ?? opts.outPath,
|
|
574
|
+
];
|
|
575
|
+
// Runtime-object flags. Program compilation and dependency discovery add
|
|
576
|
+
// the dev sanitizer override below so both cache identities match reality.
|
|
577
|
+
const cflags = [
|
|
578
|
+
"-std=c11",
|
|
579
|
+
...debugFlags,
|
|
580
|
+
...driver.targetArgs,
|
|
581
|
+
...threadArgs,
|
|
582
|
+
...(opts.workers ? ["-DSCR_WORKERS"] : []),
|
|
583
|
+
...(sanitize
|
|
584
|
+
? ["-O1", "-fsanitize=address", "-DSCR_RC_AUDIT"]
|
|
585
|
+
: [optimization === "dev" ? "-O0" : "-O2"]),
|
|
586
|
+
...executableSectionFlags.compile,
|
|
587
|
+
...(opts.textDecoderLegacy ? ["-DSCR_TEXT_DECODER_LEGACY"] : []),
|
|
588
|
+
"-fno-math-errno",
|
|
589
|
+
"-fno-strict-aliasing", // the emitted object model type-puns — see buildArgs
|
|
590
|
+
"-Wno-deprecated-declarations",
|
|
591
|
+
"-I",
|
|
592
|
+
rtDir,
|
|
593
|
+
...(regex || dynamic ? ["-I", vendorEngineDir()] : []),
|
|
594
|
+
...(zlibObjects.length > 0 ? ["-I", vendorZlibDir()] : []),
|
|
595
|
+
...(curlStubDir !== null ? ["-I", join(vendorCurlDir(), "include")] : []),
|
|
596
|
+
...(tlsArchive !== null ? ["-I", join(vendorTlsDir(), "include")] : []),
|
|
597
|
+
...(dynamic ? ["-DSCR_DYNAMIC"] : []),
|
|
598
|
+
];
|
|
599
|
+
// Keep sanitizer runtime objects optimized in both postures. Large dev
|
|
600
|
+
// programs still compile at O0, avoiding an expensive LLVM optimization
|
|
601
|
+
// pass while retaining ASan and reference-count checks in every runtime unit.
|
|
602
|
+
const separateSanitizedProgram = sanitize && optimization === "dev";
|
|
603
|
+
const programCompilerArgs = [
|
|
604
|
+
...cflags,
|
|
605
|
+
...(separateSanitizedProgram ? ["-O0"] : []),
|
|
606
|
+
...(opts.cPath.endsWith(".ll") ? ["-Wno-override-module"] : []),
|
|
607
|
+
];
|
|
608
|
+
const programSourceExtension = opts.cPath.endsWith(".ll") ? ".ll" : ".c";
|
|
609
|
+
const ccName = driver.argv.join(" ");
|
|
610
|
+
const runClang = async (args) => {
|
|
611
|
+
try {
|
|
612
|
+
await execFileAsync(driver.argv[0] ?? "clang", [...driver.argv.slice(1), ...args]);
|
|
613
|
+
}
|
|
614
|
+
catch (err) {
|
|
615
|
+
const stderr = subprocessFailureDetail(err);
|
|
616
|
+
const guidance = (opts.linkInputs?.length ?? 0) > 0 ||
|
|
617
|
+
(opts.frameworks?.length ?? 0) > 0 ||
|
|
618
|
+
(opts.systemLibraries?.length ?? 0) > 0
|
|
619
|
+
? "This build includes native FFI link inputs. Check that every symbol and system library exists, " +
|
|
620
|
+
"that archive/object ordering is correct, and that each input matches the selected target."
|
|
621
|
+
: `Check the supplied native source and the selected ${ccName} toolchain.`;
|
|
622
|
+
throw new CcCompileError(ccName, stderr, `${ccName} failed compiling ${opts.cPath}.\n` + `${guidance}\n\n${stderr}`);
|
|
623
|
+
}
|
|
624
|
+
};
|
|
625
|
+
const buildExecutable = async (runtimeInput, build = {}) => {
|
|
626
|
+
if (!separateSanitizedProgram) {
|
|
627
|
+
await runClang(buildArgs(runtimeInput, build));
|
|
628
|
+
return;
|
|
629
|
+
}
|
|
630
|
+
const stage = await mkdtemp(join(tmpdir(), "scriptc-sanitized-program-"));
|
|
631
|
+
try {
|
|
632
|
+
const object = join(stage, "program.o");
|
|
633
|
+
await runClang([
|
|
634
|
+
...programCompilerArgs,
|
|
635
|
+
...(build.compilerVisibleSource === undefined
|
|
636
|
+
? []
|
|
637
|
+
: [
|
|
638
|
+
`-ffile-prefix-map=${build.programPath}=${build.compilerVisibleSource}`,
|
|
639
|
+
"-iquote",
|
|
640
|
+
dirname(resolve(build.compilerVisibleSource)),
|
|
641
|
+
]),
|
|
642
|
+
"-c",
|
|
643
|
+
build.programPath ?? opts.cPath,
|
|
644
|
+
"-o",
|
|
645
|
+
object,
|
|
646
|
+
]);
|
|
647
|
+
await runClang(buildArgs(runtimeInput, { programPath: object, outPath: build.outPath ?? opts.outPath }));
|
|
648
|
+
if (darwinDebugSymbols)
|
|
649
|
+
await createDarwinDebugSymbols(build.outPath ?? opts.outPath);
|
|
650
|
+
}
|
|
651
|
+
finally {
|
|
652
|
+
await rm(stage, { recursive: true, force: true });
|
|
653
|
+
}
|
|
654
|
+
};
|
|
655
|
+
const runUncachedBuild = async () => {
|
|
656
|
+
const privateVendorRoot = transientVendorRoot ??
|
|
657
|
+
join(tmpdir(), `scriptc-vendor-fallback-${process.pid}-${Math.random().toString(36).slice(2)}`);
|
|
658
|
+
try {
|
|
659
|
+
await materializeVendorPrerequisites(undefined, privateVendorRoot);
|
|
660
|
+
await buildExecutable((p) => p);
|
|
661
|
+
}
|
|
662
|
+
finally {
|
|
663
|
+
await rm(privateVendorRoot, { recursive: true, force: true }).catch(() => undefined);
|
|
664
|
+
}
|
|
665
|
+
};
|
|
666
|
+
let runtimeCompilerInvocation = null;
|
|
667
|
+
let programCompilerInvocation = null;
|
|
668
|
+
let payloadMetadata = null;
|
|
669
|
+
let compileMetadataStamp = null;
|
|
670
|
+
const compileMetadataKey = persistentCache === null || process.env["SCRIPTC_TEST_TRUST_COMPILER_WRAPPER"] === "1"
|
|
671
|
+
? null
|
|
672
|
+
: nativeMetadataKey("compile", [
|
|
673
|
+
cacheTargetIdentity(driver),
|
|
674
|
+
toolchainEnv,
|
|
675
|
+
implicitToolchain ?? "<uncached>",
|
|
676
|
+
driver.argv,
|
|
677
|
+
cflags,
|
|
678
|
+
programCompilerArgs,
|
|
679
|
+
programSourceExtension,
|
|
680
|
+
]);
|
|
681
|
+
if (persistentCache !== null) {
|
|
682
|
+
try {
|
|
683
|
+
// These probes inspect disjoint inputs. Start the payload reads here as
|
|
684
|
+
// well so runtime hashing and clang's dry-run traces overlap instead of
|
|
685
|
+
// forming a serial prelude before every cache lookup.
|
|
686
|
+
payloadMetadata = Promise.all([
|
|
687
|
+
Promise.resolve(toolchainMetadataStamp?.values["compilerVersion"] ??
|
|
688
|
+
ccVersion(driver.argv, toolchainEnv, true)),
|
|
689
|
+
localArtifact === null
|
|
690
|
+
? runtimeFingerprint(rtDir)
|
|
691
|
+
: Promise.resolve(localArtifact.runtimeHash),
|
|
692
|
+
localArtifact === null ? readFile(opts.cPath) : Promise.resolve(localArtifact.programBytes),
|
|
693
|
+
]);
|
|
694
|
+
compileMetadataStamp =
|
|
695
|
+
compileMetadataKey === null
|
|
696
|
+
? null
|
|
697
|
+
: await readNativeMetadataStamp(persistentCache.root, compileMetadataKey);
|
|
698
|
+
if (compileMetadataStamp !== null) {
|
|
699
|
+
runtimeCompilerInvocation = compileMetadataStamp.values["runtimeInvocation"] ?? null;
|
|
700
|
+
programCompilerInvocation = compileMetadataStamp.values["programInvocation"] ?? null;
|
|
701
|
+
if (runtimeCompilerInvocation === null || programCompilerInvocation === null) {
|
|
702
|
+
compileMetadataStamp = null;
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
if (compileMetadataStamp === null) {
|
|
706
|
+
const [runtimeInvocation, programInvocation] = await Promise.all([
|
|
707
|
+
effectiveCompilerInvocationFingerprint(driver, toolchainEnv, cflags),
|
|
708
|
+
programSourceExtension === ".ll" || separateSanitizedProgram
|
|
709
|
+
? effectiveCompilerInvocationFingerprint(driver, toolchainEnv, programCompilerArgs, programSourceExtension)
|
|
710
|
+
: Promise.resolve(null),
|
|
711
|
+
]);
|
|
712
|
+
runtimeCompilerInvocation = runtimeInvocation;
|
|
713
|
+
programCompilerInvocation = programInvocation ?? runtimeInvocation;
|
|
714
|
+
if (compileMetadataKey !== null) {
|
|
715
|
+
compileMetadataStamp = await publishNativeMetadataStamp(persistentCache.root, compileMetadataKey, {
|
|
716
|
+
runtimeInvocation: runtimeCompilerInvocation,
|
|
717
|
+
programInvocation: programCompilerInvocation,
|
|
718
|
+
}, [
|
|
719
|
+
...fingerprintDependencyPaths(runtimeCompilerInvocation),
|
|
720
|
+
...fingerprintDependencyPaths(programCompilerInvocation),
|
|
721
|
+
], [runtimeCompilerInvocation, programCompilerInvocation]);
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
catch (error) {
|
|
726
|
+
// Preserve the uncached build for wrappers that compile successfully but
|
|
727
|
+
// cannot provide a dry-run trace for the real build flavor.
|
|
728
|
+
if (cacheWarmOnly) {
|
|
729
|
+
throw new Error("native cache warming could not validate the compiler invocation", {
|
|
730
|
+
cause: error,
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
persistentCache = null;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
if (persistentCache === null) {
|
|
737
|
+
// The direct uncached command is the source-of-truth executable recipe.
|
|
738
|
+
await runUncachedBuild();
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
let cv;
|
|
742
|
+
let fingerprint;
|
|
743
|
+
let cBytes;
|
|
744
|
+
try {
|
|
745
|
+
[cv, fingerprint, cBytes] = await (payloadMetadata ??
|
|
746
|
+
Promise.all([
|
|
747
|
+
ccVersion(driver.argv, toolchainEnv, true),
|
|
748
|
+
runtimeFingerprint(rtDir),
|
|
749
|
+
readFile(opts.cPath),
|
|
750
|
+
]));
|
|
751
|
+
}
|
|
752
|
+
catch (error) {
|
|
753
|
+
// A version/fingerprint probe is an optimization boundary. If the compiler
|
|
754
|
+
// itself can still compile, preserve the pre-cache behavior instead of
|
|
755
|
+
// surfacing a metadata command's failure as the build result.
|
|
756
|
+
if (cacheWarmOnly) {
|
|
757
|
+
throw new Error("native cache warming could not validate cache inputs", {
|
|
758
|
+
cause: error,
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
await runUncachedBuild();
|
|
762
|
+
return;
|
|
763
|
+
}
|
|
764
|
+
// Caller-supplied native inputs can all hide mutable dependencies: `-l`
|
|
765
|
+
// resolves through ambient search paths, while a thin archive or linker
|
|
766
|
+
// script can retain identical top-level bytes as its referenced files are
|
|
767
|
+
// rebuilt. Keep the safe runtime-object cache, but force a fresh final link
|
|
768
|
+
// whenever the caller supplies either form.
|
|
769
|
+
let cacheCompleteArtifact = !cacheWarmOnly &&
|
|
770
|
+
cachePolicy.completeArtifacts &&
|
|
771
|
+
(opts.linkInputs?.length ?? 0) === 0 &&
|
|
772
|
+
(opts.frameworks?.length ?? 0) === 0 &&
|
|
773
|
+
(opts.systemLibraries?.length ?? 0) === 0;
|
|
774
|
+
let programDependencies = null;
|
|
775
|
+
const linkProbeArgs = [
|
|
776
|
+
...(sanitize ? ["-fsanitize=address"] : []),
|
|
777
|
+
...threadArgs,
|
|
778
|
+
...(opts.workers ? ["-DSCR_WORKERS"] : []),
|
|
779
|
+
...(targetPlatform(driver) === "win32" ? ["-ladvapi32", "-liphlpapi", "-lws2_32"] : []),
|
|
780
|
+
...(tls && targetPlatform(driver) === "win32" ? ["-lbcrypt"] : []),
|
|
781
|
+
...(tlsCa && targetPlatform(driver) === "win32" ? ["-lcrypt32"] : []),
|
|
782
|
+
...(curlFetch && driver.target === null ? ["-lcurl"] : []),
|
|
783
|
+
...(dynamic && !driver.linkArgs.includes("-lm") ? ["-lm"] : []),
|
|
784
|
+
...(((opts.zlib ?? false) || nativeFetch) && !isZigDriver(driver) ? ["-lz"] : []),
|
|
785
|
+
...driver.linkArgs,
|
|
786
|
+
...executableLinkFlags,
|
|
787
|
+
];
|
|
788
|
+
// Both the wrapper dry run and dependency trace need the real build's
|
|
789
|
+
// compile/link flag shape: wrappers commonly inject flags or native inputs
|
|
790
|
+
// conditionally on optimization, sanitizer, dynamic, or platform switches.
|
|
791
|
+
const effectiveLinkInvocationArgs = [
|
|
792
|
+
...(separateSanitizedProgram ? cflags : programCompilerArgs),
|
|
793
|
+
...(targetPlatform(driver) === "win32" ? ["-ladvapi32", "-liphlpapi", "-lws2_32"] : []),
|
|
794
|
+
...(tls && targetPlatform(driver) === "win32" ? ["-lbcrypt"] : []),
|
|
795
|
+
...(tlsCa && targetPlatform(driver) === "win32" ? ["-lcrypt32"] : []),
|
|
796
|
+
...(curlStubDir !== null ? [`-L${curlStubDir}`] : []),
|
|
797
|
+
...(curlFetch && driver.target === null ? ["-lcurl"] : []),
|
|
798
|
+
...(dynamic && !driver.linkArgs.includes("-lm") ? ["-lm"] : []),
|
|
799
|
+
...(dynamic && targetPlatform(driver) === "win32" ? ["-Wl,--stack,8388608"] : []),
|
|
800
|
+
...(((opts.zlib ?? false) || nativeFetch) && !isZigDriver(driver) ? ["-lz"] : []),
|
|
801
|
+
...driver.linkArgs,
|
|
802
|
+
...executableLinkFlags,
|
|
803
|
+
];
|
|
804
|
+
// A complete hit is checked before cross-target curl's generated import stub
|
|
805
|
+
// is materialized. Its -L spelling still joins the dry-run identity, while
|
|
806
|
+
// the real trace omits only that not-yet-existing scriptc-owned directory.
|
|
807
|
+
const linkTraceInvocationArgs = curlStubDir === null
|
|
808
|
+
? effectiveLinkInvocationArgs
|
|
809
|
+
: effectiveLinkInvocationArgs.filter((arg) => arg !== `-L${curlStubDir}`);
|
|
810
|
+
let implicitLinker = null;
|
|
811
|
+
let preBuildDependencies = null;
|
|
812
|
+
let localArtifactDependencyPaths = null;
|
|
813
|
+
let linkMetadataStamp = null;
|
|
814
|
+
const linkMetadataKey = process.env["SCRIPTC_TEST_TRUST_COMPILER_WRAPPER"] === "1"
|
|
815
|
+
? null
|
|
816
|
+
: nativeMetadataKey("link", [
|
|
817
|
+
cacheTargetIdentity(driver),
|
|
818
|
+
toolchainEnv,
|
|
819
|
+
implicitToolchain ?? "<uncached>",
|
|
820
|
+
runtimeCompilerInvocation ?? "<uncached>",
|
|
821
|
+
programCompilerInvocation ?? "<uncached>",
|
|
822
|
+
driver.argv,
|
|
823
|
+
linkProbeArgs,
|
|
824
|
+
effectiveLinkInvocationArgs,
|
|
825
|
+
linkTraceInvocationArgs,
|
|
826
|
+
...(programShardMergeIdentity === null ? [] : [programShardMergeIdentity]),
|
|
827
|
+
]);
|
|
828
|
+
if (cacheCompleteArtifact) {
|
|
829
|
+
try {
|
|
830
|
+
// Header discovery and linker tracing are independent subprocess trees.
|
|
831
|
+
// Running them together removes one complete probe round-trip from both
|
|
832
|
+
// cache hits and ordinary edit/build misses without changing either key.
|
|
833
|
+
linkMetadataStamp =
|
|
834
|
+
linkMetadataKey === null
|
|
835
|
+
? null
|
|
836
|
+
: await readNativeMetadataStamp(persistentCache.root, linkMetadataKey);
|
|
837
|
+
if (linkMetadataStamp !== null) {
|
|
838
|
+
implicitLinker = linkMetadataStamp.values["implicitLinker"] ?? null;
|
|
839
|
+
if (implicitLinker === null)
|
|
840
|
+
linkMetadataStamp = null;
|
|
841
|
+
}
|
|
842
|
+
[programDependencies, implicitLinker] = await Promise.all([
|
|
843
|
+
translationUnitDependencyFingerprint(driver, programCompilerArgs, opts.cPath, cBytes, toolchainEnv),
|
|
844
|
+
linkMetadataStamp === null
|
|
845
|
+
? implicitLinkerFingerprint(driver, toolchainEnv, linkProbeArgs, effectiveLinkInvocationArgs, linkTraceInvocationArgs)
|
|
846
|
+
: Promise.resolve(implicitLinker),
|
|
847
|
+
]);
|
|
848
|
+
if (linkMetadataStamp === null && linkMetadataKey !== null) {
|
|
849
|
+
linkMetadataStamp = await publishNativeMetadataStamp(persistentCache.root, linkMetadataKey, { implicitLinker }, fingerprintDependencyPaths(implicitLinker), [implicitLinker]);
|
|
850
|
+
}
|
|
851
|
+
preBuildDependencies = await snapshotLocalArtifactDependencies([
|
|
852
|
+
...(await runtimeFingerprintInputPaths(rtDir)),
|
|
853
|
+
...(toolchainMetadataStamp?.dependencies.map((dependency) => dependency.path) ??
|
|
854
|
+
fingerprintDependencyPaths(implicitToolchain)),
|
|
855
|
+
...(compileMetadataStamp?.dependencies.map((dependency) => dependency.path) ?? []),
|
|
856
|
+
...(linkMetadataStamp?.dependencies.map((dependency) => dependency.path) ??
|
|
857
|
+
fingerprintDependencyPaths(implicitLinker)),
|
|
858
|
+
...fingerprintDependencyPaths(programDependencies),
|
|
859
|
+
...(programShardMergeIdentity === null
|
|
860
|
+
? []
|
|
861
|
+
: fingerprintDependencyPaths(programShardMergeIdentity)),
|
|
862
|
+
]);
|
|
863
|
+
// Every content-bearing fingerprint was computed before this metadata
|
|
864
|
+
// snapshot. Re-read those exact files now so the snapshot cannot certify
|
|
865
|
+
// bytes that changed after hashing but before the final compile starts.
|
|
866
|
+
if (!(await fingerprintDependenciesStillMatch([
|
|
867
|
+
implicitToolchain,
|
|
868
|
+
runtimeCompilerInvocation,
|
|
869
|
+
programCompilerInvocation,
|
|
870
|
+
implicitLinker,
|
|
871
|
+
programDependencies,
|
|
872
|
+
...(programShardMergeIdentity === null ? [] : [programShardMergeIdentity]),
|
|
873
|
+
])) ||
|
|
874
|
+
(await runtimeFingerprint(rtDir).catch(() => null)) !== fingerprint ||
|
|
875
|
+
!(await Promise.all([toolchainMetadataStamp, compileMetadataStamp, linkMetadataStamp]
|
|
876
|
+
.filter((stamp) => stamp !== null)
|
|
877
|
+
.map((stamp) => nativeArtifactDependenciesStillMatch(stamp.dependencies)))).every(Boolean)) {
|
|
878
|
+
throw new CacheInputsChangedError();
|
|
879
|
+
}
|
|
880
|
+
if (localArtifact !== null) {
|
|
881
|
+
// Native metadata stamps persist their dependency paths across CLI
|
|
882
|
+
// processes; fingerprintDependencyPaths deliberately does not. Build
|
|
883
|
+
// the output-local stamp from this complete validated snapshot so a
|
|
884
|
+
// source edit in a fresh process cannot replace it with only the two
|
|
885
|
+
// process-local fallback paths.
|
|
886
|
+
localArtifactDependencyPaths = [
|
|
887
|
+
localArtifact.compilerPath,
|
|
888
|
+
dirname(resolve(opts.cPath)),
|
|
889
|
+
...preBuildDependencies.map((dependency) => dependency.path),
|
|
890
|
+
];
|
|
891
|
+
}
|
|
892
|
+
}
|
|
893
|
+
catch {
|
|
894
|
+
// Program-header discovery and linker tracing are both required for a
|
|
895
|
+
// complete hit. Runtime objects remain safely cacheable if either probe
|
|
896
|
+
// is unavailable.
|
|
897
|
+
cacheCompleteArtifact = false;
|
|
898
|
+
preBuildDependencies = null;
|
|
899
|
+
localArtifactDependencyPaths = null;
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
// Warm-only builds deliberately do not need linker/header identity for a
|
|
903
|
+
// complete executable, but they still need a stable runtime-object key.
|
|
904
|
+
// The ordinary complete-artifact path computes these values above.
|
|
905
|
+
if (cacheWarmOnly && preBuildDependencies === null) {
|
|
906
|
+
try {
|
|
907
|
+
const [dependencies, invocation] = await Promise.all([
|
|
908
|
+
translationUnitDependencyFingerprint(driver, programCompilerArgs, opts.cPath, cBytes, toolchainEnv),
|
|
909
|
+
effectiveCompilerInvocationFingerprint(driver, toolchainEnv, cflags),
|
|
910
|
+
]);
|
|
911
|
+
programDependencies = dependencies;
|
|
912
|
+
if (runtimeCompilerInvocation === null)
|
|
913
|
+
runtimeCompilerInvocation = invocation;
|
|
914
|
+
}
|
|
915
|
+
catch (error) {
|
|
916
|
+
throw new Error("native cache warming could not validate runtime-object inputs", {
|
|
917
|
+
cause: error,
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
const binDir = join(persistentCache.root, "bin");
|
|
922
|
+
let keyHex = null;
|
|
923
|
+
let cachedBin = null;
|
|
924
|
+
if (cacheCompleteArtifact) {
|
|
925
|
+
// The key sees the full command line with the two program-specific paths
|
|
926
|
+
// normalized out. The C bytes are hashed separately; Darwin additionally
|
|
927
|
+
// keys the output basename because ld embeds it in the ad-hoc signature.
|
|
928
|
+
// Runtime and vendor paths stay verbatim — their contents are covered by
|
|
929
|
+
// the fingerprint and the pin.
|
|
930
|
+
const identityArgs = buildArgs((p) => p).map((a) => a === opts.cPath ? "<program.c>" : a === opts.outPath ? "<out>" : a);
|
|
931
|
+
const key = createHash("sha256")
|
|
932
|
+
// Sharded dev builds need the v10 identity below. Canonical single-TU
|
|
933
|
+
// builds retain v9 so adding the opt-in mode does not evict release
|
|
934
|
+
// binaries compiled by an earlier scriptc.
|
|
935
|
+
.update(programShards === null ? "bin-v9\0" : "bin-v10\0")
|
|
936
|
+
.update(cacheTargetIdentity(driver))
|
|
937
|
+
.update("\0")
|
|
938
|
+
.update(toolchainEnv)
|
|
939
|
+
.update("\0")
|
|
940
|
+
.update(implicitToolchain)
|
|
941
|
+
.update("\0")
|
|
942
|
+
.update(runtimeCompilerInvocation)
|
|
943
|
+
.update("\0")
|
|
944
|
+
.update(programCompilerInvocation)
|
|
945
|
+
.update("\0")
|
|
946
|
+
.update(implicitLinker)
|
|
947
|
+
.update("\0")
|
|
948
|
+
.update(programDependencies)
|
|
949
|
+
.update("\0")
|
|
950
|
+
.update(persistentCache.identity)
|
|
951
|
+
.update("\0")
|
|
952
|
+
// Preserve both the spelling clang sees (__FILE__) and the location used
|
|
953
|
+
// to resolve relative includes. The top-level bytes are not sufficient.
|
|
954
|
+
.update(opts.cPath)
|
|
955
|
+
.update("\0")
|
|
956
|
+
.update(resolve(opts.cPath))
|
|
957
|
+
.update("\0")
|
|
958
|
+
.update(targetPlatform(driver) === "darwin" ? basename(opts.outPath) : "<out>")
|
|
959
|
+
.update("\0")
|
|
960
|
+
// The driver spelling joins the version string: `zig cc --version`
|
|
961
|
+
// reports the clang underneath and could otherwise collide with a
|
|
962
|
+
// same-version host clang.
|
|
963
|
+
.update(ccName)
|
|
964
|
+
.update("\0")
|
|
965
|
+
.update(cv)
|
|
966
|
+
.update("\0")
|
|
967
|
+
.update(fingerprint)
|
|
968
|
+
.update("\0")
|
|
969
|
+
.update(identityArgs.join("\x1f"))
|
|
970
|
+
.update("\0")
|
|
971
|
+
.update(cBytes);
|
|
972
|
+
if (programShards !== null) {
|
|
973
|
+
updateProgramShardCacheIdentity(key, programShards, programPublicSymbols, programShardMergeIdentity ?? undefined);
|
|
974
|
+
}
|
|
975
|
+
keyHex = key.digest("hex");
|
|
976
|
+
cachedBin = join(binDir, keyHex);
|
|
977
|
+
const tmpOut = privateSiblingPath(opts.outPath, "bin-hit");
|
|
978
|
+
try {
|
|
979
|
+
// NEVER copy over outPath in place: overwriting an already-executed
|
|
980
|
+
// signed binary invalidates the kernel's per-vnode code-signature cache
|
|
981
|
+
// on macOS and the next exec dies with SIGKILL. Copy to a fresh inode
|
|
982
|
+
// and rename it into place instead.
|
|
983
|
+
if (!(await copyValidCachedFile(cachedBin, tmpOut))) {
|
|
984
|
+
throw new Error("invalid cached executable");
|
|
985
|
+
}
|
|
986
|
+
if (darwinDebugSymbols) {
|
|
987
|
+
const cachedSymbols = `${cachedBin}.dsym`;
|
|
988
|
+
const symbolsCopy = privateSiblingPath(opts.outPath, "dsym-hit");
|
|
989
|
+
try {
|
|
990
|
+
if (!(await copyValidCachedFile(cachedSymbols, symbolsCopy)))
|
|
991
|
+
throw new Error("invalid cached dSYM");
|
|
992
|
+
const bytes = await readFile(symbolsCopy);
|
|
993
|
+
// A concurrent publisher may replace either payload. The sidecar
|
|
994
|
+
// also names its binary digest so a mixed pair always misses.
|
|
995
|
+
if (bytes.subarray(0, 32).toString("hex") !== (await fileDigest(tmpOut)))
|
|
996
|
+
throw new Error("mismatched cached dSYM");
|
|
997
|
+
await installDarwinDebugSymbols(bytes.subarray(32), opts.outPath);
|
|
998
|
+
}
|
|
999
|
+
finally {
|
|
1000
|
+
await rm(symbolsCopy, { force: true });
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
// Match a fresh linker output under the caller's current umask. Reusing a
|
|
1004
|
+
// cache entry populated by a less restrictive shell must not widen access.
|
|
1005
|
+
await chmod(tmpOut, 0o777 & ~process.umask());
|
|
1006
|
+
await rename(tmpOut, opts.outPath);
|
|
1007
|
+
if (localArtifact !== null && localArtifactDependencyPaths !== null) {
|
|
1008
|
+
const stamp = await publishLocalArtifactStamp(localArtifact.stampPath, opts.outPath, localArtifact.key, localArtifactDependencyPaths, [dirname(resolve(opts.cPath))], [persistentCache.root], darwinDebugSymbols).catch(() => null);
|
|
1009
|
+
if (stamp !== null) {
|
|
1010
|
+
await opts.onArtifactReady?.({ dependencies: stamp.dependencies }).catch(() => undefined);
|
|
1011
|
+
}
|
|
1012
|
+
}
|
|
1013
|
+
return; // hit: the program/runtime payload compile and link were skipped
|
|
1014
|
+
}
|
|
1015
|
+
catch {
|
|
1016
|
+
await rm(tmpOut, { force: true }).catch(() => undefined);
|
|
1017
|
+
/* miss — build below, then publish */
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
// Miss: link the program's own TU against cached per-flavor runtime objects.
|
|
1021
|
+
// Collect the runtime sources this build actually compiles (the same
|
|
1022
|
+
// conditionals as the command line, by construction).
|
|
1023
|
+
const rtInputs = [];
|
|
1024
|
+
buildArgs((p) => {
|
|
1025
|
+
rtInputs.push(p);
|
|
1026
|
+
return p;
|
|
1027
|
+
});
|
|
1028
|
+
const buildDir = await mkdtemp(join(tmpdir(), "scriptc-cache-build-"));
|
|
1029
|
+
try {
|
|
1030
|
+
await materializeVendorPrerequisites(join(buildDir, "vendor-inputs"));
|
|
1031
|
+
// Freeze the exact bytes used for the key. Generated TUs live at stable
|
|
1032
|
+
// paths under .scriptc/, so two builds can otherwise overwrite that path
|
|
1033
|
+
// between hashing and clang and publish one invocation's code under the
|
|
1034
|
+
// other's key. The prefix map preserves the original __FILE__/debug-file
|
|
1035
|
+
// spelling while clang reads this invocation-private snapshot.
|
|
1036
|
+
const programPath = join(buildDir, `program${programSourceExtension}`);
|
|
1037
|
+
// Preserve the caller-visible basename while keeping Darwin builds on a
|
|
1038
|
+
// private inode: ld uses this spelling as the embedded ad-hoc signing
|
|
1039
|
+
// identifier. Other targets retain the basename-independent cache key.
|
|
1040
|
+
const privateOut = join(buildDir, targetPlatform(driver) === "darwin"
|
|
1041
|
+
? basename(opts.outPath)
|
|
1042
|
+
: process.platform === "win32"
|
|
1043
|
+
? "artifact.exe"
|
|
1044
|
+
: "artifact");
|
|
1045
|
+
await writeFile(programPath, cBytes);
|
|
1046
|
+
let objects = null;
|
|
1047
|
+
let cacheInputsStable = true;
|
|
1048
|
+
let strictObjectVerification = null;
|
|
1049
|
+
const objectImplicitToolchainStillMatches = () => {
|
|
1050
|
+
if (preBuildDependencies !== null) {
|
|
1051
|
+
return nativeArtifactDependenciesStillMatch(preBuildDependencies);
|
|
1052
|
+
}
|
|
1053
|
+
// Complete-artifact caching can be disabled by caller-owned native
|
|
1054
|
+
// inputs while the safe runtime-object tier remains active. Preserve its
|
|
1055
|
+
// strict discovery fallback in that posture.
|
|
1056
|
+
strictObjectVerification ??= Promise.all([
|
|
1057
|
+
runtimeFingerprint(rtDir),
|
|
1058
|
+
implicitToolchainFingerprint(driver, toolchainEnv),
|
|
1059
|
+
effectiveCompilerInvocationFingerprint(driver, toolchainEnv, cflags),
|
|
1060
|
+
]).then(([currentRuntime, currentImplicit, currentInvocation]) => currentRuntime === fingerprint &&
|
|
1061
|
+
currentImplicit === implicitToolchain &&
|
|
1062
|
+
currentInvocation === runtimeCompilerInvocation, () => false);
|
|
1063
|
+
return strictObjectVerification;
|
|
1064
|
+
};
|
|
1065
|
+
try {
|
|
1066
|
+
const cached = await ensureRuntimeObjects(persistentCache.root, driver.argv, cflags, rtInputs, `obj-v5\0${cacheTargetIdentity(driver)}\0${toolchainEnv}\0${implicitToolchain}\0${runtimeCompilerInvocation}\0${ccName}\0${cv}\0${fingerprint}\0`, async () => await objectImplicitToolchainStillMatches(), cacheWarmPaths);
|
|
1067
|
+
objects = await stageRuntimeObjects(cached, join(buildDir, "runtime-objects"));
|
|
1068
|
+
}
|
|
1069
|
+
catch (err) {
|
|
1070
|
+
if (err instanceof CacheInputsChangedError)
|
|
1071
|
+
cacheInputsStable = false;
|
|
1072
|
+
if (cacheWarmOnly) {
|
|
1073
|
+
throw new Error("native cache warming could not persist runtime objects", {
|
|
1074
|
+
cause: err,
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
objects = null; // cache trouble is never a build failure
|
|
1078
|
+
}
|
|
1079
|
+
const compileShardedProgram = async () => {
|
|
1080
|
+
if (programShards === null ||
|
|
1081
|
+
programPublicSymbols === undefined ||
|
|
1082
|
+
programCompilerInvocation === null ||
|
|
1083
|
+
implicitCompileToolchain === null)
|
|
1084
|
+
return null;
|
|
1085
|
+
try {
|
|
1086
|
+
const programDependencyHash = programDependencies ??
|
|
1087
|
+
(await translationUnitDependencyFingerprint(driver, programCompilerArgs, opts.cPath, cBytes, toolchainEnv));
|
|
1088
|
+
const stem = basename(opts.cPath, ".ll");
|
|
1089
|
+
const entries = programShards.map((shard, index) => {
|
|
1090
|
+
const sourcePath = join(buildDir, shard.name);
|
|
1091
|
+
const staged = join(buildDir, `${stem}.program-${index.toString().padStart(3, "0")}.o`);
|
|
1092
|
+
const key = createHash("sha256")
|
|
1093
|
+
.update("exe-program-shard-v1\0")
|
|
1094
|
+
.update(cacheTargetIdentity(driver))
|
|
1095
|
+
.update("\0")
|
|
1096
|
+
.update(toolchainEnv)
|
|
1097
|
+
.update("\0")
|
|
1098
|
+
.update(implicitCompileToolchain)
|
|
1099
|
+
.update("\0")
|
|
1100
|
+
.update(programCompilerInvocation)
|
|
1101
|
+
.update("\0")
|
|
1102
|
+
.update(persistentCache.identity)
|
|
1103
|
+
.update("\0")
|
|
1104
|
+
.update(driver.argv.join("\x1f"))
|
|
1105
|
+
.update("\0")
|
|
1106
|
+
.update(cv)
|
|
1107
|
+
.update("\0")
|
|
1108
|
+
.update(fingerprint)
|
|
1109
|
+
.update("\0")
|
|
1110
|
+
.update(programDependencyHash)
|
|
1111
|
+
.update("\0")
|
|
1112
|
+
.update(programCompilerArgs.join("\x1f"))
|
|
1113
|
+
.update("\0")
|
|
1114
|
+
.update(opts.cPath)
|
|
1115
|
+
.update("\0")
|
|
1116
|
+
.update(resolve(opts.cPath))
|
|
1117
|
+
.update("\0")
|
|
1118
|
+
.update(shard.name)
|
|
1119
|
+
.update("\0")
|
|
1120
|
+
.update(shard.source)
|
|
1121
|
+
.digest("hex");
|
|
1122
|
+
return {
|
|
1123
|
+
...shard,
|
|
1124
|
+
sourcePath,
|
|
1125
|
+
staged,
|
|
1126
|
+
cachePath: join(persistentCache.root, "program-shard", key),
|
|
1127
|
+
missed: false,
|
|
1128
|
+
};
|
|
1129
|
+
});
|
|
1130
|
+
const shardWidth = Math.min(8, availableParallelism());
|
|
1131
|
+
for (let i = 0; i < entries.length; i += shardWidth) {
|
|
1132
|
+
await Promise.all(entries.slice(i, i + shardWidth).map(async (entry) => {
|
|
1133
|
+
await writeFile(entry.sourcePath, entry.source);
|
|
1134
|
+
if (await copyValidCachedFile(entry.cachePath, entry.staged))
|
|
1135
|
+
return;
|
|
1136
|
+
entry.missed = true;
|
|
1137
|
+
await runClang([
|
|
1138
|
+
...programCompilerArgs,
|
|
1139
|
+
`-ffile-prefix-map=${entry.sourcePath}=${opts.cPath}`,
|
|
1140
|
+
"-c",
|
|
1141
|
+
entry.sourcePath,
|
|
1142
|
+
"-o",
|
|
1143
|
+
entry.staged,
|
|
1144
|
+
]);
|
|
1145
|
+
}));
|
|
1146
|
+
}
|
|
1147
|
+
const arArgv = isZigDriver(driver) ? [driver.argv[0], "ar"] : ["ar"];
|
|
1148
|
+
const merged = await localizeLibraryObjects(driver, arArgv, buildDir, entries.map((entry) => entry.staged), [], programPublicSymbols, `${stem}.program`);
|
|
1149
|
+
const publishable = entries.filter((entry) => entry.missed);
|
|
1150
|
+
if (publishable.length > 0) {
|
|
1151
|
+
try {
|
|
1152
|
+
const [currentRuntime, currentFingerprints, currentInvocation, currentDependencies, currentCompiler, currentMerge,] = await Promise.all([
|
|
1153
|
+
runtimeFingerprint(rtDir),
|
|
1154
|
+
implicitToolchainFingerprints(driver, toolchainEnv),
|
|
1155
|
+
effectiveCompilerInvocationFingerprint(driver, toolchainEnv, programCompilerArgs, ".ll"),
|
|
1156
|
+
translationUnitDependencyFingerprint(driver, programCompilerArgs, opts.cPath, cBytes, toolchainEnv),
|
|
1157
|
+
ccVersion(driver.argv, toolchainEnv, true),
|
|
1158
|
+
resolveProgramShardMergeIdentity(driver),
|
|
1159
|
+
]);
|
|
1160
|
+
if (currentRuntime === fingerprint &&
|
|
1161
|
+
currentFingerprints.compile === implicitCompileToolchain &&
|
|
1162
|
+
currentInvocation === programCompilerInvocation &&
|
|
1163
|
+
currentDependencies === programDependencyHash &&
|
|
1164
|
+
currentCompiler === cv &&
|
|
1165
|
+
currentMerge === programShardMergeIdentity) {
|
|
1166
|
+
await Promise.all(publishable.map((entry) => publishCachedFile(entry.staged, entry.cachePath)));
|
|
1167
|
+
}
|
|
1168
|
+
}
|
|
1169
|
+
catch {
|
|
1170
|
+
// The merged object is valid for this invocation; publication is
|
|
1171
|
+
// only an optimization for later edits.
|
|
1172
|
+
}
|
|
1173
|
+
}
|
|
1174
|
+
return merged;
|
|
1175
|
+
}
|
|
1176
|
+
catch {
|
|
1177
|
+
// Sharding is an optimization. Compile/link the canonical TU below if
|
|
1178
|
+
// a target tool, one shard, or relocatable merge is unavailable.
|
|
1179
|
+
return null;
|
|
1180
|
+
}
|
|
1181
|
+
};
|
|
1182
|
+
const shardedProgramObject = await compileShardedProgram();
|
|
1183
|
+
if (programShards !== null && shardedProgramObject === null) {
|
|
1184
|
+
// The canonical TU fallback is valid output, but it must not populate a
|
|
1185
|
+
// cache key describing a successful shard projection/merge.
|
|
1186
|
+
cacheInputsStable = false;
|
|
1187
|
+
}
|
|
1188
|
+
await buildExecutable((p) => objects?.get(p) ?? p, shardedProgramObject === null
|
|
1189
|
+
? { programPath, outPath: privateOut, compilerVisibleSource: opts.cPath }
|
|
1190
|
+
: { programPath: shardedProgramObject, outPath: privateOut });
|
|
1191
|
+
if (darwinDebugSymbols) {
|
|
1192
|
+
// clang invokes dsymutil when compiling a source TU while linking.
|
|
1193
|
+
// A sharded program is already an object, so run it explicitly while
|
|
1194
|
+
// the merged object and staged runtime inputs still exist.
|
|
1195
|
+
if (shardedProgramObject !== null)
|
|
1196
|
+
await createDarwinDebugSymbols(privateOut);
|
|
1197
|
+
await installDarwinDebugSymbols(await readDarwinDebugSymbols(privateOut), opts.outPath);
|
|
1198
|
+
}
|
|
1199
|
+
await installArtifact(privateOut, opts.outPath);
|
|
1200
|
+
if (cachedBin !== null && keyHex !== null) {
|
|
1201
|
+
// Metadata comparison catches ordinary changes cheaply, but cannot by
|
|
1202
|
+
// itself prove the snapshot was taken from the same bytes hashed into
|
|
1203
|
+
// the key. Recompute every content-bearing identity after the final link
|
|
1204
|
+
// so a header/SDK/compiler change in either pre-build gap cannot publish
|
|
1205
|
+
// new output under an old key.
|
|
1206
|
+
const [currentRuntime, currentImplicit, currentRuntimeInvocation, currentProgramInvocation, currentProgramDependencies, currentLinker, currentCompiler, currentProgramShardMerge,] = await Promise.all([
|
|
1207
|
+
runtimeFingerprint(rtDir).catch(() => null),
|
|
1208
|
+
implicitToolchainFingerprint(driver, toolchainEnv).catch(() => null),
|
|
1209
|
+
effectiveCompilerInvocationFingerprint(driver, toolchainEnv, cflags).catch(() => null),
|
|
1210
|
+
effectiveCompilerInvocationFingerprint(driver, toolchainEnv, programCompilerArgs, programSourceExtension).catch(() => null),
|
|
1211
|
+
translationUnitDependencyFingerprint(driver, programCompilerArgs, opts.cPath, cBytes, toolchainEnv).catch(() => null),
|
|
1212
|
+
implicitLinkerFingerprint(driver, toolchainEnv, linkProbeArgs, effectiveLinkInvocationArgs, linkTraceInvocationArgs).catch(() => null),
|
|
1213
|
+
ccVersion(driver.argv, toolchainEnv, true).catch(() => null),
|
|
1214
|
+
programShards === null
|
|
1215
|
+
? Promise.resolve(null)
|
|
1216
|
+
: resolveProgramShardMergeIdentity(driver).catch(() => null),
|
|
1217
|
+
]);
|
|
1218
|
+
cacheInputsStable =
|
|
1219
|
+
cacheInputsStable &&
|
|
1220
|
+
preBuildDependencies !== null &&
|
|
1221
|
+
(await nativeArtifactDependenciesStillMatch(preBuildDependencies)) &&
|
|
1222
|
+
currentRuntime === fingerprint &&
|
|
1223
|
+
currentImplicit === implicitToolchain &&
|
|
1224
|
+
currentRuntimeInvocation === runtimeCompilerInvocation &&
|
|
1225
|
+
currentProgramInvocation === programCompilerInvocation &&
|
|
1226
|
+
currentProgramDependencies === programDependencies &&
|
|
1227
|
+
currentLinker === implicitLinker &&
|
|
1228
|
+
currentCompiler === cv &&
|
|
1229
|
+
currentProgramShardMerge === programShardMergeIdentity;
|
|
1230
|
+
}
|
|
1231
|
+
if (cachedBin !== null && keyHex !== null && cacheInputsStable) {
|
|
1232
|
+
try {
|
|
1233
|
+
// Cache artifacts are data, never execution targets. Publication keeps
|
|
1234
|
+
// generated code and embedded literals private; the hit path reapplies
|
|
1235
|
+
// the caller's current executable mode to its destination copy.
|
|
1236
|
+
await publishCachedFile(privateOut, cachedBin);
|
|
1237
|
+
if (darwinDebugSymbols) {
|
|
1238
|
+
const symbols = privateSiblingPath(privateOut, "debug-symbols");
|
|
1239
|
+
await writeFile(symbols, Buffer.concat([
|
|
1240
|
+
Buffer.from(await fileDigest(privateOut), "hex"),
|
|
1241
|
+
await readDarwinDebugSymbols(privateOut),
|
|
1242
|
+
]));
|
|
1243
|
+
await publishCachedFile(symbols, `${cachedBin}.dsym`);
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
catch {
|
|
1247
|
+
/* publishing is best-effort */
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
if (localArtifact !== null &&
|
|
1251
|
+
localArtifactDependencyPaths !== null &&
|
|
1252
|
+
cacheCompleteArtifact &&
|
|
1253
|
+
cacheInputsStable) {
|
|
1254
|
+
const stamp = await publishLocalArtifactStamp(localArtifact.stampPath, opts.outPath, localArtifact.key, localArtifactDependencyPaths, [dirname(resolve(opts.cPath))], [persistentCache.root], darwinDebugSymbols).catch(() => null);
|
|
1255
|
+
if (stamp !== null) {
|
|
1256
|
+
await opts.onArtifactReady?.({ dependencies: stamp.dependencies }).catch(() => undefined);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
}
|
|
1260
|
+
finally {
|
|
1261
|
+
await rm(buildDir, { recursive: true, force: true }).catch(() => undefined);
|
|
1262
|
+
}
|
|
1263
|
+
// Runtime-object population is itself a cache write, including on builds
|
|
1264
|
+
// whose native link inputs disable complete-artifact publication.
|
|
1265
|
+
await pruneCache(persistentCache.root, cacheWarmPaths).catch(() => undefined);
|
|
1266
|
+
}
|
|
1267
|
+
export async function compileC(opts) {
|
|
1268
|
+
clearCcCaches();
|
|
1269
|
+
await compileCInternal(opts, false);
|
|
1270
|
+
if (targetPlatform(resolveCc()) === "darwin" &&
|
|
1271
|
+
!needsDarwinDebugSymbols("darwin", opts.optimization, opts.strip)) {
|
|
1272
|
+
await rm(`${opts.outPath}.dSYM`, { recursive: true, force: true });
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
//# sourceMappingURL=executable.js.map
|