@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { InternalCompilerError } from "../errors.js";
|
|
2
2
|
import * as ts from "./ts7/adapter.js";
|
|
3
3
|
import { bodyReadsArguments } from "./arguments-usage.js";
|
|
4
|
-
import { BYTES_ELEMENT_NAME, arrayOf, BOOL, bytesOf, canConvertToDyn, CHILD_T, CRYPTOHASH_T, CRYPTOHMAC_T, DATE_T, DYN, F64, funcOf, isSupportedArrayElem, isSupportedIndexValue, isSupportedMapKey, isSupportedMapValue, isSupportedSetElem, isUnitType, JSVAL, mapOf, NULL_T, PROCSTREAM_T, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, setOf, STRING, SYMBOL_T, typeEquals, typeKey, unionContainerArmsOk, UNDEFINED_T, VOID } from "../ir/ir.js";
|
|
4
|
+
import { BYTES_ELEMENT_NAME, arrayOf, BOOL, bytesOf, canConvertToDyn, CHILD_T, CRYPTOHASH_T, CRYPTOHMAC_T, DATE_T, DYN, F64, funcOf, isSupportedArrayElem, isSupportedIndexValue, isSupportedMapKey, isSupportedMapValue, isSupportedSetElem, isUnitType, JSVAL, mapOf, NULL_T, PROCSTREAM_T, RUNTIME_EMITTER_CLASS, RUNTIME_ERROR_CLASSES, RUNTIME_STREAM_CLASSES, setOf, STRING, SYMBOL_T, typeEquals, typeKey, unionContainerArmsOk, UNDEFINED_T, VOID, } from "../ir/ir.js";
|
|
5
5
|
import { BIGINT_T } from "../ir/ir.js";
|
|
6
6
|
import { literalValues } from "./literal-values.js";
|
|
7
7
|
import { remapUnionDiscriminant } from "./union-discriminants.js";
|
|
@@ -19,18 +19,28 @@ export function jsOpenObjectType(decl, type, shapes, unions) {
|
|
|
19
19
|
return type;
|
|
20
20
|
const arms = type.kind === "union" ? unions.get(type.unionId)?.arms : [type];
|
|
21
21
|
const present = arms?.filter((arm) => arm.kind !== "undefinedT");
|
|
22
|
-
const parameter = ts.isParameter(decl)
|
|
22
|
+
const parameter = ts.isParameter(decl)
|
|
23
|
+
? decl
|
|
24
|
+
: decl.parent && ts.isParameter(decl.parent)
|
|
25
|
+
? decl.parent
|
|
26
|
+
: null;
|
|
23
27
|
// Array parameters in JavaScript also accept typed arrays. Keep
|
|
24
28
|
// their runtime storage at the boundary, including default [] parameters.
|
|
25
|
-
if (parameter &&
|
|
29
|
+
if (parameter &&
|
|
30
|
+
!parameter.dotDotDotToken &&
|
|
31
|
+
present?.length === 1 &&
|
|
26
32
|
present[0].kind === "array")
|
|
27
33
|
return DYN;
|
|
28
|
-
if (parameter &&
|
|
34
|
+
if (parameter &&
|
|
35
|
+
!parameter.dotDotDotToken &&
|
|
36
|
+
present?.length === 1 &&
|
|
37
|
+
present[0].kind === "bytes")
|
|
29
38
|
return DYN;
|
|
30
39
|
// An unannotated JavaScript parameter's object default is a fallback,
|
|
31
40
|
// not a closed class contract. Published code routinely passes another
|
|
32
41
|
// implementation of the same protocol through a boxed callable.
|
|
33
|
-
if (parameter?.initializer &&
|
|
42
|
+
if (parameter?.initializer &&
|
|
43
|
+
!parameter.type &&
|
|
34
44
|
present?.some((arm) => arm.kind === "object") &&
|
|
35
45
|
arms?.every((arm) => canConvertToDyn(arm, (id) => shapes.get(id), (id) => unions.get(id))))
|
|
36
46
|
return DYN;
|
|
@@ -41,10 +51,15 @@ export function jsOpenObjectType(decl, type, shapes, unions) {
|
|
|
41
51
|
// A typed index slot cannot represent either of those reads faithfully.
|
|
42
52
|
if (shape?.indexValue && !shape.tuple)
|
|
43
53
|
return DYN;
|
|
44
|
-
const unitOnly = (field) => isUnitType(field) ||
|
|
45
|
-
field.kind === "
|
|
46
|
-
|
|
47
|
-
|
|
54
|
+
const unitOnly = (field) => isUnitType(field) ||
|
|
55
|
+
field.kind === "void" ||
|
|
56
|
+
(field.kind === "union" && unions.get(field.unionId)?.arms.every(isUnitType) === true);
|
|
57
|
+
return shape &&
|
|
58
|
+
!shape.tuple &&
|
|
59
|
+
!shape.indexValue &&
|
|
60
|
+
(shape.fields.length === 0 || shape.fields.some((field) => unitOnly(field.type)))
|
|
61
|
+
? DYN
|
|
62
|
+
: type;
|
|
48
63
|
}
|
|
49
64
|
/** The ambient TYPE names of the fetch slice. Under --dynamic their
|
|
50
65
|
* values live in the embedded engine and map to island handles (jsval).
|
|
@@ -75,9 +90,12 @@ function isAmbientAbortHandleType(type, ctx) {
|
|
|
75
90
|
if (type.isUnionType())
|
|
76
91
|
return ts.constituentTypes(type).some((part) => isAmbientAbortHandleType(part, ctx));
|
|
77
92
|
const symbol = type.getSymbol();
|
|
78
|
-
return !!symbol &&
|
|
93
|
+
return (!!symbol &&
|
|
79
94
|
(symbol.name === "AbortSignal" || symbol.name === "AbortController") &&
|
|
80
|
-
ctx.checker
|
|
95
|
+
ctx.checker
|
|
96
|
+
.declarationsOf(symbol)
|
|
97
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
98
|
+
ctx.isStdlibFile(d.getSourceFile())));
|
|
81
99
|
}
|
|
82
100
|
/** node:util.parseArgs's public and @types/node helper type names. Values
|
|
83
101
|
* behind this surface use the checked-dynamic tree; see mapTypeInner. */
|
|
@@ -195,7 +213,8 @@ export class ShapeRegistry {
|
|
|
195
213
|
else
|
|
196
214
|
this.declaredOrderCandidates.set(shape.id, [candidate]);
|
|
197
215
|
const previous = this.declaredOrderPriority.get(shape.id);
|
|
198
|
-
if (previous !== undefined &&
|
|
216
|
+
if (previous !== undefined &&
|
|
217
|
+
comparePriority(previous, this.currentDeclaredOrderPriority) <= 0) {
|
|
199
218
|
return;
|
|
200
219
|
}
|
|
201
220
|
shape.declaredOrder = declaredOrder;
|
|
@@ -798,12 +817,16 @@ function genChannels(yieldTs, retTs, nextTs, ctx) {
|
|
|
798
817
|
return null;
|
|
799
818
|
const retT = retTs === undefined || retTs.flags & UNITISH
|
|
800
819
|
? VOID
|
|
801
|
-
: retTs.flags & ANYISH
|
|
820
|
+
: retTs.flags & ANYISH
|
|
821
|
+
? DYN
|
|
822
|
+
: mapType(retTs, ctx);
|
|
802
823
|
if (!retT || (retT.kind !== "void" && isUnitType(retT)))
|
|
803
824
|
return null;
|
|
804
825
|
const nextT = nextTs === undefined || nextTs.flags & UNITISH
|
|
805
826
|
? UNDEFINED_T
|
|
806
|
-
: nextTs.flags & ANYISH
|
|
827
|
+
: nextTs.flags & ANYISH
|
|
828
|
+
? DYN
|
|
829
|
+
: mapType(nextTs, ctx);
|
|
807
830
|
if (!nextT || nextT.kind === "void" || nextT.kind === "nullT")
|
|
808
831
|
return null;
|
|
809
832
|
const dynMix = (yieldT.kind === "dyn" && retT.kind !== "dyn" && retT.kind !== "void") ||
|
|
@@ -835,6 +858,18 @@ let contextResolutions = 0;
|
|
|
835
858
|
export function mapType(type, ctx) {
|
|
836
859
|
if (mapTypeDepth >= MAP_TYPE_MAX_DEPTH)
|
|
837
860
|
return null;
|
|
861
|
+
// These intrinsic domains cannot depend on generic bindings, declaration
|
|
862
|
+
// provenance, or recursive shape state. Enum literals retain the ordinary
|
|
863
|
+
// widening path, including mixed numeric/string enum representations.
|
|
864
|
+
const flags = type.flags;
|
|
865
|
+
if ((flags & ts.TypeFlags.EnumLike) === 0) {
|
|
866
|
+
if (flags & (ts.TypeFlags.Number | ts.TypeFlags.NumberLiteral))
|
|
867
|
+
return F64;
|
|
868
|
+
if (flags & (ts.TypeFlags.String | ts.TypeFlags.StringLiteral | ts.TypeFlags.TemplateLiteral))
|
|
869
|
+
return STRING;
|
|
870
|
+
if (flags & (ts.TypeFlags.Boolean | ts.TypeFlags.BooleanLiteral))
|
|
871
|
+
return BOOL;
|
|
872
|
+
}
|
|
838
873
|
const topLevel = mapTypeDepth === 0;
|
|
839
874
|
const typeId = type.id;
|
|
840
875
|
const memoizable = typeId !== undefined && (ctx.canMemoizeType?.() ?? true);
|
|
@@ -875,7 +910,9 @@ function mapTypeInner(type, ctx) {
|
|
|
875
910
|
// TypeScript's intrinsic globalThis symbol has no declaration. A stored
|
|
876
911
|
// reference needs native object identity, including var's undefined state.
|
|
877
912
|
const intrinsic = type.getSymbol();
|
|
878
|
-
if (!ctx.dynamic &&
|
|
913
|
+
if (!ctx.dynamic &&
|
|
914
|
+
intrinsic?.name === "globalThis" &&
|
|
915
|
+
checker.declarationsOf(intrinsic).length === 0)
|
|
879
916
|
return DYN;
|
|
880
917
|
if (!ctx.dynamic) {
|
|
881
918
|
const moduleId = ctx.moduleNamespaceId?.(type) ?? null;
|
|
@@ -971,14 +1008,16 @@ function mapTypeInner(type, ctx) {
|
|
|
971
1008
|
}
|
|
972
1009
|
return false;
|
|
973
1010
|
};
|
|
974
|
-
if (parseArgsSym &&
|
|
1011
|
+
if (parseArgsSym &&
|
|
1012
|
+
PARSE_ARGS_DYN_TYPES.has(parseArgsSym.name) &&
|
|
975
1013
|
checker.declarationsOf(parseArgsSym).some(belongs))
|
|
976
1014
|
return DYN;
|
|
977
1015
|
// ReturnType and instantiated conditional types can erase the alias.
|
|
978
1016
|
// Require every member to retain the util declaration provenance so
|
|
979
1017
|
// unrelated records with similar property names keep their own layout.
|
|
980
1018
|
const members = checker.getPropertiesOfType(widened);
|
|
981
|
-
if (members.length > 0 &&
|
|
1019
|
+
if (members.length > 0 &&
|
|
1020
|
+
members.every((member) => checker.declarationsOf(member).some(belongs)))
|
|
982
1021
|
return DYN;
|
|
983
1022
|
}
|
|
984
1023
|
// The lib's BOXED wrapper interfaces used as TYPES (`const n: Number =
|
|
@@ -1012,7 +1051,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1012
1051
|
ctorSym.name === "NumberConstructor" ||
|
|
1013
1052
|
ctorSym.name === "BooleanConstructor") &&
|
|
1014
1053
|
checker.declarationsOf(ctorSym).some((d) => ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1015
|
-
return funcOf([STRING], ctorSym.name === "StringConstructor"
|
|
1054
|
+
return funcOf([STRING], ctorSym.name === "StringConstructor"
|
|
1055
|
+
? STRING
|
|
1056
|
+
: ctorSym.name === "NumberConstructor"
|
|
1057
|
+
? F64
|
|
1058
|
+
: BOOL);
|
|
1016
1059
|
}
|
|
1017
1060
|
}
|
|
1018
1061
|
// `symbol` and `unique symbol` (the type of `const k = Symbol(...)` —
|
|
@@ -1034,17 +1077,19 @@ function mapTypeInner(type, ctx) {
|
|
|
1034
1077
|
// Generic visitors can instantiate `T | undefined` as `void | undefined`.
|
|
1035
1078
|
// It has the same return convention as standalone void; value positions
|
|
1036
1079
|
// still substitute the unit-only slot through isUnitOnlyTsType below.
|
|
1037
|
-
if (widened.isUnionType() &&
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1080
|
+
if (widened.isUnionType() &&
|
|
1081
|
+
ts.constituentTypes(widened).every((part) => {
|
|
1082
|
+
if ((part.flags & (ts.TypeFlags.Void | ts.TypeFlags.Undefined)) !== 0)
|
|
1083
|
+
return true;
|
|
1084
|
+
// A forwarding generic call keeps its caller's symbolic T in the
|
|
1085
|
+
// resolved signature. Its current instantiation can still be void.
|
|
1086
|
+
if ((part.flags & ts.TypeFlags.TypeParameter) !== 0 &&
|
|
1087
|
+
resolveTypeParam?.(part)?.kind === "void") {
|
|
1088
|
+
contextResolutions++;
|
|
1089
|
+
return true;
|
|
1090
|
+
}
|
|
1091
|
+
return false;
|
|
1092
|
+
}))
|
|
1048
1093
|
return VOID;
|
|
1049
1094
|
// Standalone `null` (a `const x = null` binding, a `{ value: null }`
|
|
1050
1095
|
// field, a `(): null` return): the unit-only union — the value is always
|
|
@@ -1295,7 +1340,13 @@ function mapTypeInner(type, ctx) {
|
|
|
1295
1340
|
// no class identity of its own.
|
|
1296
1341
|
if (widened.isIntersectionType()) {
|
|
1297
1342
|
const HANDLE_KINDS = new Set([
|
|
1298
|
-
"netServer",
|
|
1343
|
+
"netServer",
|
|
1344
|
+
"netSocket",
|
|
1345
|
+
"httpReq",
|
|
1346
|
+
"httpRes",
|
|
1347
|
+
"httpClientReq",
|
|
1348
|
+
"dgramSocket",
|
|
1349
|
+
"childWriter",
|
|
1299
1350
|
// process.stdout's own type IS the refined intersection
|
|
1300
1351
|
// `WriteStream & { fd: 1 }` — the scalar stream kind rides the same
|
|
1301
1352
|
// refinement rule.
|
|
@@ -1376,7 +1427,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1376
1427
|
// INSTANTIATION's class (`Box%0`), registered on demand — the Lowerer
|
|
1377
1428
|
// hook owns the instance table (monomorphization by flow).
|
|
1378
1429
|
if (classDecl.typeParameters) {
|
|
1379
|
-
const instance = ctx.genericClassInstance?.(classDecl, widened, (argument) => mapType(argument, ctx)) ??
|
|
1430
|
+
const instance = ctx.genericClassInstance?.(classDecl, widened, (argument) => mapType(argument, ctx)) ??
|
|
1431
|
+
null;
|
|
1380
1432
|
// Before the generic declaration's collection turn, the hook can only
|
|
1381
1433
|
// return its family shell; after collection the same checker type names
|
|
1382
1434
|
// a concrete registered instance. Never memoize either phase's answer.
|
|
@@ -1455,7 +1507,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1455
1507
|
// naming the offending half, as does the `new Map` lowering per site.
|
|
1456
1508
|
const psym = widened.getSymbol();
|
|
1457
1509
|
const isStdlibInterface = (name) => psym?.name === name &&
|
|
1458
|
-
checker
|
|
1510
|
+
checker
|
|
1511
|
+
.declarationsOf(psym)
|
|
1512
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()));
|
|
1459
1513
|
// The builtin Error classes: references to the lib's Error interfaces map to the runtime-provided class
|
|
1460
1514
|
// hierarchy (provenance, not the name — a user's own `class Error`
|
|
1461
1515
|
// resolved through the class-instance branch above, and a user
|
|
@@ -1481,7 +1535,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1481
1535
|
// representation. The node:module class's merged instance interface is
|
|
1482
1536
|
// included, while unrelated user interfaces named Module stay structural.
|
|
1483
1537
|
if ((psym?.name === "ScriptcModule" || psym?.name === "Module") &&
|
|
1484
|
-
checker
|
|
1538
|
+
checker
|
|
1539
|
+
.declarationsOf(psym)
|
|
1540
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1485
1541
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1486
1542
|
(psym.name === "ScriptcModule" ||
|
|
1487
1543
|
isDeclaredInAmbientNamespace(d, "NodeJS") ||
|
|
@@ -1496,7 +1552,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1496
1552
|
// NodeJS.EventEmitter interface (the structural surface net.Socket
|
|
1497
1553
|
// et al. extend) is the same runtime value. Provenance-checked.
|
|
1498
1554
|
if (psym?.name === "EventEmitter" &&
|
|
1499
|
-
checker
|
|
1555
|
+
checker
|
|
1556
|
+
.declarationsOf(psym)
|
|
1557
|
+
.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
|
|
1500
1558
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1501
1559
|
(isDeclaredInAmbientModule(d, "events") || isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1502
1560
|
return { kind: "object", className: RUNTIME_EMITTER_CLASS };
|
|
@@ -1507,7 +1565,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1507
1565
|
// net.Server (@types/node also declares Interface in
|
|
1508
1566
|
// readline/promises — that one stays unmapped and fences).
|
|
1509
1567
|
if (psym?.name === "Interface" &&
|
|
1510
|
-
checker
|
|
1568
|
+
checker
|
|
1569
|
+
.declarationsOf(psym)
|
|
1570
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1511
1571
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1512
1572
|
isDeclaredInAmbientModule(d, "readline"))) {
|
|
1513
1573
|
return F64;
|
|
@@ -1519,7 +1579,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1519
1579
|
// plus the ambient module suffices for both the fallback declarations
|
|
1520
1580
|
// and @types/node's class Channel<StoreType, ContextType>.
|
|
1521
1581
|
if (psym?.name === "Channel" &&
|
|
1522
|
-
checker
|
|
1582
|
+
checker
|
|
1583
|
+
.declarationsOf(psym)
|
|
1584
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1523
1585
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1524
1586
|
isDeclaredInAmbientModule(d, "diagnostics_channel"))) {
|
|
1525
1587
|
return F64;
|
|
@@ -1528,7 +1590,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1528
1590
|
// the runtime's store id space (the Channel story — stores are
|
|
1529
1591
|
// process-lived; contexts ride the fiber machinery).
|
|
1530
1592
|
if (psym?.name === "AsyncLocalStorage" &&
|
|
1531
|
-
checker
|
|
1593
|
+
checker
|
|
1594
|
+
.declarationsOf(psym)
|
|
1595
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1532
1596
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1533
1597
|
isDeclaredInAmbientModule(d, "async_hooks"))) {
|
|
1534
1598
|
return F64;
|
|
@@ -1536,31 +1600,57 @@ function mapTypeInner(type, ctx) {
|
|
|
1536
1600
|
// diagnostics_channel.TracingChannel: the same f64-handle story over the
|
|
1537
1601
|
// runtime's tracing registry (five event channels per entry).
|
|
1538
1602
|
if (psym?.name === "TracingChannel" &&
|
|
1539
|
-
checker
|
|
1603
|
+
checker
|
|
1604
|
+
.declarationsOf(psym)
|
|
1605
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1540
1606
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1541
1607
|
isDeclaredInAmbientModule(d, "diagnostics_channel"))) {
|
|
1542
1608
|
return F64;
|
|
1543
1609
|
}
|
|
1544
1610
|
// Node names this result; the ambient WHATWG declaration uses a type literal.
|
|
1545
|
-
const encodeResult = psym &&
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1611
|
+
const encodeResult = psym &&
|
|
1612
|
+
checker.declarationsOf(psym).some((decl) => {
|
|
1613
|
+
if (!ctx.isStdlibFile(decl.getSourceFile()))
|
|
1614
|
+
return false;
|
|
1615
|
+
if (ts.isInterfaceDeclaration(decl) && decl.name.text === "EncodeIntoResult")
|
|
1616
|
+
return true;
|
|
1617
|
+
const parent = decl.parent;
|
|
1618
|
+
return (ts.isTypeLiteralNode(decl) &&
|
|
1619
|
+
parent?.kind === ts.SyntaxKind.MethodSignature &&
|
|
1620
|
+
parent.name &&
|
|
1621
|
+
ts.isIdentifier(parent.name) &&
|
|
1622
|
+
parent.name.text === "encodeInto" &&
|
|
1623
|
+
parent.parent &&
|
|
1624
|
+
ts.isInterfaceDeclaration(parent.parent) &&
|
|
1625
|
+
parent.parent.name.text === "TextEncoder");
|
|
1626
|
+
});
|
|
1555
1627
|
if (encodeResult)
|
|
1556
|
-
return {
|
|
1628
|
+
return {
|
|
1629
|
+
kind: "record",
|
|
1630
|
+
shapeId: ctx.shapes.intern([
|
|
1631
|
+
{ name: "read", type: F64 },
|
|
1632
|
+
{ name: "written", type: F64 },
|
|
1633
|
+
]),
|
|
1634
|
+
};
|
|
1557
1635
|
// WHATWG codec instances have ordinary reference identity and ownership.
|
|
1558
1636
|
// Their private encoding slot is omitted from enumeration and JSON.
|
|
1559
1637
|
if ((psym?.name === "TextEncoder" || psym?.name === "TextDecoder") &&
|
|
1560
|
-
checker
|
|
1638
|
+
checker
|
|
1639
|
+
.declarationsOf(psym)
|
|
1640
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1641
|
+
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1561
1642
|
return {
|
|
1562
1643
|
kind: "record",
|
|
1563
|
-
shapeId: ctx.shapes.intern([
|
|
1644
|
+
shapeId: ctx.shapes.intern([
|
|
1645
|
+
{ name: `%${psym.name}`, type: F64 },
|
|
1646
|
+
...(psym.name === "TextDecoder"
|
|
1647
|
+
? [
|
|
1648
|
+
{ name: "%fatal", type: BOOL },
|
|
1649
|
+
{ name: "%ignoreBOM", type: BOOL },
|
|
1650
|
+
{ name: "%state", type: DYN },
|
|
1651
|
+
]
|
|
1652
|
+
: []),
|
|
1653
|
+
], false, undefined, []),
|
|
1564
1654
|
};
|
|
1565
1655
|
}
|
|
1566
1656
|
// string_decoder.StringDecoder: the decoder value is a two-field record
|
|
@@ -1571,7 +1661,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1571
1661
|
// special-cased in lowerNew / lowerStringDecoderMethodCall, so the
|
|
1572
1662
|
// record shape never surfaces.
|
|
1573
1663
|
if (psym?.name === "StringDecoder" &&
|
|
1574
|
-
checker
|
|
1664
|
+
checker
|
|
1665
|
+
.declarationsOf(psym)
|
|
1666
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1575
1667
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1576
1668
|
return {
|
|
1577
1669
|
kind: "record",
|
|
@@ -1608,7 +1700,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1608
1700
|
{ name: "promise", type: promT },
|
|
1609
1701
|
{
|
|
1610
1702
|
name: "reject",
|
|
1611
|
-
type: {
|
|
1703
|
+
type: {
|
|
1704
|
+
kind: "func",
|
|
1705
|
+
params: [{ kind: "object", className: "%Error" }],
|
|
1706
|
+
ret: VOID,
|
|
1707
|
+
},
|
|
1612
1708
|
},
|
|
1613
1709
|
{
|
|
1614
1710
|
name: "resolve",
|
|
@@ -1646,14 +1742,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1646
1742
|
const alias = widened.getAliasSymbol();
|
|
1647
1743
|
if (!ctx.dynamic &&
|
|
1648
1744
|
alias?.name === "ReadableStreamReadResult" &&
|
|
1649
|
-
checker
|
|
1650
|
-
|
|
1745
|
+
checker
|
|
1746
|
+
.declarationsOf(alias)
|
|
1747
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1651
1748
|
const elemTs = widened.getAliasTypeArguments()?.[0];
|
|
1652
|
-
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any
|
|
1653
|
-
? DYN
|
|
1654
|
-
: elemTs
|
|
1655
|
-
? mapType(elemTs, ctx)
|
|
1656
|
-
: null;
|
|
1749
|
+
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any ? DYN : elemTs ? mapType(elemTs, ctx) : null;
|
|
1657
1750
|
if (!elem)
|
|
1658
1751
|
return null;
|
|
1659
1752
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
@@ -1663,14 +1756,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1663
1756
|
psym &&
|
|
1664
1757
|
(psym.name === "ReadableStreamReadValueResult" ||
|
|
1665
1758
|
psym.name === "ReadableStreamReadDoneResult") &&
|
|
1666
|
-
checker
|
|
1667
|
-
|
|
1759
|
+
checker
|
|
1760
|
+
.declarationsOf(psym)
|
|
1761
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1668
1762
|
const elemTs = checker.getTypeArguments(widened)[0];
|
|
1669
|
-
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any
|
|
1670
|
-
? DYN
|
|
1671
|
-
: elemTs
|
|
1672
|
-
? mapType(elemTs, ctx)
|
|
1673
|
-
: null;
|
|
1763
|
+
const elem = elemTs && elemTs.flags & ts.TypeFlags.Any ? DYN : elemTs ? mapType(elemTs, ctx) : null;
|
|
1674
1764
|
if (!elem)
|
|
1675
1765
|
return null;
|
|
1676
1766
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
@@ -1678,8 +1768,12 @@ function mapTypeInner(type, ctx) {
|
|
|
1678
1768
|
if (psym &&
|
|
1679
1769
|
ISLAND_AMBIENT_TYPES.includes(psym.name) &&
|
|
1680
1770
|
!(psym.name === "ReadableStream" &&
|
|
1681
|
-
checker
|
|
1682
|
-
|
|
1771
|
+
checker
|
|
1772
|
+
.declarationsOf(psym)
|
|
1773
|
+
.some((d) => ts.isInterfaceDeclaration(d) && isDeclaredInAmbientNamespace(d, "NodeJS"))) &&
|
|
1774
|
+
checker
|
|
1775
|
+
.declarationsOf(psym)
|
|
1776
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1683
1777
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1684
1778
|
return ctx.dynamic ? JSVAL : DYN;
|
|
1685
1779
|
}
|
|
@@ -1692,7 +1786,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1692
1786
|
if (args.length !== 2)
|
|
1693
1787
|
return null;
|
|
1694
1788
|
const key = !ctx.dynamic && (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1695
|
-
if (!key ||
|
|
1789
|
+
if (!key ||
|
|
1790
|
+
!isSupportedMapKey(key, key.kind === "union" ? ctx.unions.get(key.unionId)?.arms : undefined))
|
|
1696
1791
|
return null;
|
|
1697
1792
|
const value = !ctx.dynamic && (args[1].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[1], ctx);
|
|
1698
1793
|
if (!value || !isSupportedMapValue(value))
|
|
@@ -1711,7 +1806,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1711
1806
|
if (args.length !== 1)
|
|
1712
1807
|
return null;
|
|
1713
1808
|
const elem = !ctx.dynamic && (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1714
|
-
if (!elem ||
|
|
1809
|
+
if (!elem ||
|
|
1810
|
+
!isSupportedSetElem(elem, elem.kind === "union" ? ctx.unions.get(elem.unionId)?.arms : undefined))
|
|
1715
1811
|
return null;
|
|
1716
1812
|
return setOf(elem);
|
|
1717
1813
|
}
|
|
@@ -1731,7 +1827,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1731
1827
|
if (isStdlibInterface("RegExp")) {
|
|
1732
1828
|
return { kind: "regex" };
|
|
1733
1829
|
}
|
|
1734
|
-
if (isStdlibInterface("Segmenter") ||
|
|
1830
|
+
if (isStdlibInterface("Segmenter") ||
|
|
1831
|
+
isStdlibInterface("Segments") ||
|
|
1832
|
+
isStdlibInterface("SegmentData"))
|
|
1735
1833
|
return DYN;
|
|
1736
1834
|
// Typed arrays: references to the lib's Uint8Array/Uint32Array/
|
|
1737
1835
|
// Float32Array/Float64Array interfaces (provenance, not names). The es2022+ lib
|
|
@@ -1771,7 +1869,10 @@ function mapTypeInner(type, ctx) {
|
|
|
1771
1869
|
// space, so clearTimeout of an Immediate no-ops like Node.
|
|
1772
1870
|
if (isStdlibInterface("Immediate"))
|
|
1773
1871
|
return F64;
|
|
1774
|
-
if (isStdlibInterface("ArrayBuffer") ||
|
|
1872
|
+
if (isStdlibInterface("ArrayBuffer") ||
|
|
1873
|
+
isStdlibInterface("SharedArrayBuffer") ||
|
|
1874
|
+
isStdlibInterface("PropertyDescriptor") ||
|
|
1875
|
+
isStdlibInterface("ProcessVersions"))
|
|
1775
1876
|
return DYN;
|
|
1776
1877
|
if (Object.values(BYTES_ELEMENT_NAME).some((name) => isStdlibInterface(`${name}Constructor`)))
|
|
1777
1878
|
return DYN;
|
|
@@ -1808,7 +1909,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1808
1909
|
// fallback and by @types/node (whose NonSharedBuffer alias resolves to
|
|
1809
1910
|
// the same symbol); provenance-checked like URL.
|
|
1810
1911
|
if (psym?.name === "Buffer" &&
|
|
1811
|
-
checker
|
|
1912
|
+
checker
|
|
1913
|
+
.declarationsOf(psym)
|
|
1914
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1812
1915
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1813
1916
|
return bytesOf("u8");
|
|
1814
1917
|
}
|
|
@@ -1818,7 +1921,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1818
1921
|
// instance type). Provenance, not the name: a user's own URL maps as a
|
|
1819
1922
|
// record/class like any other.
|
|
1820
1923
|
if (psym?.name === "URL" &&
|
|
1821
|
-
checker
|
|
1924
|
+
checker
|
|
1925
|
+
.declarationsOf(psym)
|
|
1926
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1822
1927
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1823
1928
|
return { kind: "url" };
|
|
1824
1929
|
}
|
|
@@ -1826,28 +1931,46 @@ function mapTypeInner(type, ctx) {
|
|
|
1826
1931
|
// interface by the shipped fallback and by @types/node (plus `class
|
|
1827
1932
|
// URLSearchParams` in the "url" module). Provenance-checked like URL.
|
|
1828
1933
|
if (psym?.name === "URLSearchParams" &&
|
|
1829
|
-
checker
|
|
1934
|
+
checker
|
|
1935
|
+
.declarationsOf(psym)
|
|
1936
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1830
1937
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1831
1938
|
return { kind: "searchParams" };
|
|
1832
1939
|
}
|
|
1833
1940
|
// fs.Stats: @types/node's `class Stats` (module "fs") or the fallback
|
|
1834
1941
|
// declarations' interface. Provenance-checked like URL.
|
|
1835
1942
|
if (psym?.name === "Stats" &&
|
|
1836
|
-
checker
|
|
1943
|
+
checker
|
|
1944
|
+
.declarationsOf(psym)
|
|
1945
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1837
1946
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1838
1947
|
return { kind: "stats" };
|
|
1839
1948
|
}
|
|
1840
1949
|
// Capacity snapshots and options keep their live object representation
|
|
1841
1950
|
// across numeric/BigInt overloads, runtime options, and callbacks.
|
|
1842
|
-
if ((psym?.name === "StatsFs" ||
|
|
1843
|
-
|
|
1844
|
-
|
|
1951
|
+
if ((psym?.name === "StatsFs" ||
|
|
1952
|
+
psym?.name === "BigIntStatsFs" ||
|
|
1953
|
+
psym?.name === "StatFsOptions") &&
|
|
1954
|
+
checker
|
|
1955
|
+
.declarationsOf(psym)
|
|
1956
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1957
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1958
|
+
isDeclaredInAmbientModule(d, "fs")))
|
|
1959
|
+
return DYN;
|
|
1960
|
+
if ((psym?.name === "Worker" || psym?.name === "MessagePort") &&
|
|
1961
|
+
checker
|
|
1962
|
+
.declarationsOf(psym)
|
|
1963
|
+
.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
|
|
1964
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1965
|
+
isDeclaredInAmbientModule(d, "worker_threads")))
|
|
1845
1966
|
return DYN;
|
|
1846
1967
|
// fs/promises.FileHandle: an owned descriptor object. Module provenance
|
|
1847
1968
|
// distinguishes it from user interfaces with the same name; both the
|
|
1848
1969
|
// fallback and @types/node declare it in "fs/promises".
|
|
1849
1970
|
if (psym?.name === "FileHandle" &&
|
|
1850
|
-
checker
|
|
1971
|
+
checker
|
|
1972
|
+
.declarationsOf(psym)
|
|
1973
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1851
1974
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1852
1975
|
isDeclaredInAmbientModule(d, "fs/promises"))) {
|
|
1853
1976
|
return { kind: "fileHandle" };
|
|
@@ -1857,7 +1980,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1857
1980
|
// reads work either way) or the fallback declarations' plain interface.
|
|
1858
1981
|
// Provenance-checked like Stats.
|
|
1859
1982
|
if (psym?.name === "SpawnSyncReturns" &&
|
|
1860
|
-
checker
|
|
1983
|
+
checker
|
|
1984
|
+
.declarationsOf(psym)
|
|
1985
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1861
1986
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1862
1987
|
return { kind: "spawnRes" };
|
|
1863
1988
|
}
|
|
@@ -1868,7 +1993,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1868
1993
|
(psym.name === "ChildProcess" ||
|
|
1869
1994
|
psym.name === "ChildProcessWithoutNullStreams" ||
|
|
1870
1995
|
psym.name === "ChildProcessByStdio") &&
|
|
1871
|
-
checker
|
|
1996
|
+
checker
|
|
1997
|
+
.declarationsOf(psym)
|
|
1998
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1872
1999
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1873
2000
|
isDeclaredInAmbientModule(d, "child_process"))) {
|
|
1874
2001
|
return { kind: "child" };
|
|
@@ -1902,20 +2029,29 @@ function mapTypeInner(type, ctx) {
|
|
|
1902
2029
|
// @types/node declares `interface SecureContext` inside `declare module
|
|
1903
2030
|
// "tls"`, and the shipped fallback mirrors it.
|
|
1904
2031
|
if (psym?.name === "SecureContext" &&
|
|
1905
|
-
checker
|
|
2032
|
+
checker
|
|
2033
|
+
.declarationsOf(psym)
|
|
2034
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1906
2035
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1907
2036
|
isDeclaredInAmbientModule(d, "tls"))) {
|
|
1908
2037
|
return { kind: "secureCtx" };
|
|
1909
2038
|
}
|
|
1910
2039
|
// Scrypt's runtime options retain property accessors and aliases. Use
|
|
1911
2040
|
// checked values so presence probes and repeated getter reads match Node.
|
|
1912
|
-
if (psym?.name === "ScryptOptions" &&
|
|
2041
|
+
if (psym?.name === "ScryptOptions" &&
|
|
2042
|
+
checker
|
|
2043
|
+
.declarationsOf(psym)
|
|
2044
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2045
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2046
|
+
isDeclaredInAmbientModule(d, "crypto")))
|
|
1913
2047
|
return DYN;
|
|
1914
2048
|
// crypto.Hash / crypto.Hmac: native incremental digest handles. Keep
|
|
1915
2049
|
// provenance module-qualified so user classes with these common names
|
|
1916
2050
|
// retain their ordinary structural/class representation.
|
|
1917
2051
|
if ((psym?.name === "Hash" || psym?.name === "Hmac") &&
|
|
1918
|
-
checker
|
|
2052
|
+
checker
|
|
2053
|
+
.declarationsOf(psym)
|
|
2054
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1919
2055
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1920
2056
|
isDeclaredInAmbientModule(d, "crypto"))) {
|
|
1921
2057
|
return psym.name === "Hash" ? CRYPTOHASH_T : CRYPTOHMAC_T;
|
|
@@ -1925,7 +2061,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1925
2061
|
// EventEmitter` inside `declare module "fs"`, and the shipped fallback
|
|
1926
2062
|
// mirrors it.
|
|
1927
2063
|
if (psym?.name === "FSWatcher" &&
|
|
1928
|
-
checker
|
|
2064
|
+
checker
|
|
2065
|
+
.declarationsOf(psym)
|
|
2066
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1929
2067
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1930
2068
|
isDeclaredInAmbientModule(d, "fs"))) {
|
|
1931
2069
|
return { kind: "fsWatcher" };
|
|
@@ -1948,11 +2086,15 @@ function mapTypeInner(type, ctx) {
|
|
|
1948
2086
|
// prefixStream's `output` param). The representation is the raw fd
|
|
1949
2087
|
// scalar; the lowered surface is write(string).
|
|
1950
2088
|
if ((psym?.name === "WriteStream" &&
|
|
1951
|
-
checker
|
|
2089
|
+
checker
|
|
2090
|
+
.declarationsOf(psym)
|
|
2091
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1952
2092
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1953
2093
|
isDeclaredInAmbientModule(d, "tty"))) ||
|
|
1954
2094
|
(psym?.name === "WritableStream" &&
|
|
1955
|
-
checker
|
|
2095
|
+
checker
|
|
2096
|
+
.declarationsOf(psym)
|
|
2097
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1956
2098
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1957
2099
|
isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1958
2100
|
return PROCSTREAM_T;
|
|
@@ -1962,11 +2104,15 @@ function mapTypeInner(type, ctx) {
|
|
|
1962
2104
|
// stream.Writable. As with stream.Readable below, unsupported producers
|
|
1963
2105
|
// of the broad @types class fence where they are constructed.
|
|
1964
2106
|
if ((psym?.name === "ChildStdin" &&
|
|
1965
|
-
checker
|
|
2107
|
+
checker
|
|
2108
|
+
.declarationsOf(psym)
|
|
2109
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1966
2110
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1967
2111
|
isDeclaredInAmbientModule(d, "child_process"))) ||
|
|
1968
2112
|
(psym?.name === "Writable" &&
|
|
1969
|
-
checker
|
|
2113
|
+
checker
|
|
2114
|
+
.declarationsOf(psym)
|
|
2115
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1970
2116
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1971
2117
|
isNodeTypesPath(d.getSourceFile().fileName) &&
|
|
1972
2118
|
isDeclaredInAmbientModule(d, "stream")))) {
|
|
@@ -1981,7 +2127,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1981
2127
|
// branch below), so the two never collide.
|
|
1982
2128
|
for (const [irName, rec] of RUNTIME_STREAM_CLASSES) {
|
|
1983
2129
|
if (psym?.name === rec.lib &&
|
|
1984
|
-
checker
|
|
2130
|
+
checker
|
|
2131
|
+
.declarationsOf(psym)
|
|
2132
|
+
.some((d) => ts.isClassDeclaration(d) &&
|
|
1985
2133
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1986
2134
|
!isNodeTypesPath(d.getSourceFile().fileName) &&
|
|
1987
2135
|
isDeclaredInAmbientModule(d, "stream"))) {
|
|
@@ -1989,11 +2137,15 @@ function mapTypeInner(type, ctx) {
|
|
|
1989
2137
|
}
|
|
1990
2138
|
}
|
|
1991
2139
|
if ((psym?.name === "Readable" &&
|
|
1992
|
-
checker
|
|
2140
|
+
checker
|
|
2141
|
+
.declarationsOf(psym)
|
|
2142
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1993
2143
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1994
2144
|
isDeclaredInAmbientModule(d, "stream"))) ||
|
|
1995
2145
|
(psym?.name === "ReadableStream" &&
|
|
1996
|
-
checker
|
|
2146
|
+
checker
|
|
2147
|
+
.declarationsOf(psym)
|
|
2148
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
1997
2149
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1998
2150
|
isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1999
2151
|
return { kind: "childStream" };
|
|
@@ -2003,7 +2155,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2003
2155
|
// EventEmitter` and the fallback declarations' interface both live
|
|
2004
2156
|
// inside `declare module "dgram"`.
|
|
2005
2157
|
if (psym?.name === "Socket" &&
|
|
2006
|
-
checker
|
|
2158
|
+
checker
|
|
2159
|
+
.declarationsOf(psym)
|
|
2160
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2007
2161
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2008
2162
|
isDeclaredInAmbientModule(d, "dgram"))) {
|
|
2009
2163
|
return { kind: "dgramSocket" };
|
|
@@ -2013,7 +2167,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2013
2167
|
// declarations' interface both live inside `declare module "node:test"`
|
|
2014
2168
|
// (isDeclaredInAmbientModule answers for both spellings).
|
|
2015
2169
|
if (psym?.name === "TestContext" &&
|
|
2016
|
-
checker
|
|
2170
|
+
checker
|
|
2171
|
+
.declarationsOf(psym)
|
|
2172
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2017
2173
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2018
2174
|
isDeclaredInAmbientModule(d, "test"))) {
|
|
2019
2175
|
return { kind: "testCtx" };
|
|
@@ -2024,7 +2180,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2024
2180
|
// above; the optional errno/code/path/syscall extras fence per member
|
|
2025
2181
|
// (the .stack stance). Provenance-checked like the rest.
|
|
2026
2182
|
if (psym?.name === "ErrnoException" &&
|
|
2027
|
-
checker
|
|
2183
|
+
checker
|
|
2184
|
+
.declarationsOf(psym)
|
|
2185
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2028
2186
|
return { kind: "object", className: "%Error" };
|
|
2029
2187
|
}
|
|
2030
2188
|
// http.Agent / https.Agent — the Agent VALUE is a checked-dynamic
|
|
@@ -2034,7 +2192,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2034
2192
|
// of fencing at the declaration. Module-checked like the rest (https'
|
|
2035
2193
|
// Agent extends http's; both live in their ambient modules).
|
|
2036
2194
|
if (psym?.name === "Agent" &&
|
|
2037
|
-
checker
|
|
2195
|
+
checker
|
|
2196
|
+
.declarationsOf(psym)
|
|
2197
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2038
2198
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2039
2199
|
(isDeclaredInAmbientModule(d, "http") || isDeclaredInAmbientModule(d, "https")))) {
|
|
2040
2200
|
return { kind: "dyn" };
|
|
@@ -2043,7 +2203,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2043
2203
|
// net.Server (the names repeat nowhere today, but provenance stays the
|
|
2044
2204
|
// rule).
|
|
2045
2205
|
if ((psym?.name === "IncomingMessage" || psym?.name === "ServerResponse") &&
|
|
2046
|
-
checker
|
|
2206
|
+
checker
|
|
2207
|
+
.declarationsOf(psym)
|
|
2208
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2047
2209
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2048
2210
|
isDeclaredInAmbientModule(d, "http"))) {
|
|
2049
2211
|
return psym.name === "IncomingMessage" ? { kind: "httpReq" } : { kind: "httpRes" };
|
|
@@ -2059,7 +2221,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2059
2221
|
if ((psym?.name === "Http2SecureServer" ||
|
|
2060
2222
|
psym?.name === "Http2ServerRequest" ||
|
|
2061
2223
|
psym?.name === "Http2ServerResponse") &&
|
|
2062
|
-
checker
|
|
2224
|
+
checker
|
|
2225
|
+
.declarationsOf(psym)
|
|
2226
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2063
2227
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2064
2228
|
isDeclaredInAmbientModule(d, "http2"))) {
|
|
2065
2229
|
return psym.name === "Http2SecureServer"
|
|
@@ -2072,10 +2236,15 @@ function mapTypeInner(type, ctx) {
|
|
|
2072
2236
|
// like the secure one; sessions and streams are first-class handle
|
|
2073
2237
|
// kinds (client and server flavors share a kind — the runtime handle
|
|
2074
2238
|
// carries the role). Module-checked like the rest.
|
|
2075
|
-
if ((psym?.name === "Http2Server" ||
|
|
2076
|
-
psym?.name === "
|
|
2077
|
-
psym?.name === "
|
|
2078
|
-
|
|
2239
|
+
if ((psym?.name === "Http2Server" ||
|
|
2240
|
+
psym?.name === "Http2Session" ||
|
|
2241
|
+
psym?.name === "ClientHttp2Session" ||
|
|
2242
|
+
psym?.name === "ServerHttp2Session" ||
|
|
2243
|
+
psym?.name === "ClientHttp2Stream" ||
|
|
2244
|
+
psym?.name === "ServerHttp2Stream") &&
|
|
2245
|
+
checker
|
|
2246
|
+
.declarationsOf(psym)
|
|
2247
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2079
2248
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2080
2249
|
isDeclaredInAmbientModule(d, "http2"))) {
|
|
2081
2250
|
return psym.name === "Http2Server"
|
|
@@ -2087,7 +2256,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2087
2256
|
// http.ClientRequest (http.request/http.get results) — module-checked
|
|
2088
2257
|
// like IncomingMessage.
|
|
2089
2258
|
if (psym?.name === "ClientRequest" &&
|
|
2090
|
-
checker
|
|
2259
|
+
checker
|
|
2260
|
+
.declarationsOf(psym)
|
|
2261
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2091
2262
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2092
2263
|
isDeclaredInAmbientModule(d, "http"))) {
|
|
2093
2264
|
return { kind: "httpClientReq" };
|
|
@@ -2101,7 +2272,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2101
2272
|
// declarations' anonymous env type takes the pureIndexShape path below
|
|
2102
2273
|
// and interns the SAME shape.
|
|
2103
2274
|
if (psym?.name === "ProcessEnv" &&
|
|
2104
|
-
checker
|
|
2275
|
+
checker
|
|
2276
|
+
.declarationsOf(psym)
|
|
2277
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2105
2278
|
const value = withUndefinedArm(STRING, ctx.unions);
|
|
2106
2279
|
if (!value)
|
|
2107
2280
|
return null;
|
|
@@ -2154,7 +2327,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2154
2327
|
// argument — fenced at the call).
|
|
2155
2328
|
// Mixed dyn/concrete value channels share checked storage, so either
|
|
2156
2329
|
// branch of the result record has the same representation.
|
|
2157
|
-
if (isStdlibInterface("Generator") ||
|
|
2330
|
+
if (isStdlibInterface("Generator") ||
|
|
2331
|
+
isStdlibInterface("AsyncGenerator") ||
|
|
2332
|
+
isStdlibInterface("IterableIterator")) {
|
|
2158
2333
|
const args = checker.getTypeArguments(widened);
|
|
2159
2334
|
const channels = genChannels(args[0], args[1], args[2], ctx);
|
|
2160
2335
|
if (!channels)
|
|
@@ -2176,7 +2351,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2176
2351
|
{
|
|
2177
2352
|
const alias = widened.getAliasSymbol();
|
|
2178
2353
|
if (alias?.name === "IteratorResult" &&
|
|
2179
|
-
checker
|
|
2354
|
+
checker
|
|
2355
|
+
.declarationsOf(alias)
|
|
2356
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2180
2357
|
const targs = widened.getAliasTypeArguments() ?? [];
|
|
2181
2358
|
const channels = genChannels(targs[0], targs[1], undefined, ctx);
|
|
2182
2359
|
if (!channels)
|
|
@@ -2216,7 +2393,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2216
2393
|
const optStr = withUndefinedArm(STRING, ctx.unions);
|
|
2217
2394
|
const optNum = withUndefinedArm(F64, ctx.unions);
|
|
2218
2395
|
const optBool = withUndefinedArm(BOOL, ctx.unions);
|
|
2219
|
-
const stdioArms = [arrayOf(STRING), STRING, UNDEFINED_T].sort((a, b) =>
|
|
2396
|
+
const stdioArms = [arrayOf(STRING), STRING, UNDEFINED_T].sort((a, b) => typeKey(a) < typeKey(b) ? -1 : 1);
|
|
2220
2397
|
const stdio = { kind: "union", unionId: ctx.unions.intern(stdioArms) };
|
|
2221
2398
|
if (!optStr || !optNum || !optBool)
|
|
2222
2399
|
return null;
|
|
@@ -2245,8 +2422,14 @@ function mapTypeInner(type, ctx) {
|
|
|
2245
2422
|
}
|
|
2246
2423
|
// Filesystem options are data records. Keep their declared optional fields
|
|
2247
2424
|
// instead of allowing arbitrary standard-library interfaces into records.
|
|
2248
|
-
if ((psym?.name === "FileReadOptions" ||
|
|
2249
|
-
|
|
2425
|
+
if ((psym?.name === "FileReadOptions" ||
|
|
2426
|
+
psym?.name === "ReadOptions" ||
|
|
2427
|
+
psym?.name === "ReadOptionsWithBuffer" ||
|
|
2428
|
+
psym?.name === "WriteOptions") &&
|
|
2429
|
+
checker
|
|
2430
|
+
.declarationsOf(psym)
|
|
2431
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2432
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2250
2433
|
(isDeclaredInAmbientModule(d, "fs/promises") || isDeclaredInAmbientModule(d, "fs")))) {
|
|
2251
2434
|
const fields = [];
|
|
2252
2435
|
for (const property of checker.getPropertiesOfType(widened)) {
|
|
@@ -2258,31 +2441,48 @@ function mapTypeInner(type, ctx) {
|
|
|
2258
2441
|
fields.push({ name: property.name, type });
|
|
2259
2442
|
}
|
|
2260
2443
|
const order = fields.map((field) => field.name);
|
|
2261
|
-
fields.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
2444
|
+
fields.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
2262
2445
|
return { kind: "record", shapeId: ctx.shapes.intern(fields, false, undefined, order) };
|
|
2263
2446
|
}
|
|
2264
2447
|
// fs/promises FileReadResult<T> / FileWriteResult<T>: the two-field
|
|
2265
2448
|
// null-prototype objects returned by FileHandle.read/write. The native
|
|
2266
2449
|
// record does not model the prototype (unobservable through the lowered
|
|
2267
2450
|
// surface); it preserves the caller buffer/string by reference.
|
|
2268
|
-
if ((psym?.name === "FileReadResult" ||
|
|
2269
|
-
|
|
2451
|
+
if ((psym?.name === "FileReadResult" ||
|
|
2452
|
+
psym?.name === "FileWriteResult" ||
|
|
2453
|
+
psym?.name === "FileReadvResult" ||
|
|
2454
|
+
psym?.name === "FileWritevResult" ||
|
|
2455
|
+
psym?.name === "ReadVResult" ||
|
|
2456
|
+
psym?.name === "WriteVResult") &&
|
|
2457
|
+
checker
|
|
2458
|
+
.declarationsOf(psym)
|
|
2459
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2270
2460
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2271
2461
|
(isDeclaredInAmbientModule(d, "fs/promises") ||
|
|
2272
|
-
((psym.name === "ReadVResult" || psym.name === "WriteVResult") &&
|
|
2462
|
+
((psym.name === "ReadVResult" || psym.name === "WriteVResult") &&
|
|
2463
|
+
isDeclaredInAmbientModule(d, "fs"))))) {
|
|
2273
2464
|
const args = checker.getTypeArguments(widened);
|
|
2274
2465
|
if (args.length !== 1)
|
|
2275
2466
|
return null;
|
|
2276
|
-
const vector = psym.name === "FileReadvResult" ||
|
|
2277
|
-
|
|
2467
|
+
const vector = psym.name === "FileReadvResult" ||
|
|
2468
|
+
psym.name === "FileWritevResult" ||
|
|
2469
|
+
psym.name === "ReadVResult" ||
|
|
2470
|
+
psym.name === "WriteVResult";
|
|
2471
|
+
const emptyVector = vector &&
|
|
2472
|
+
checker.isArrayType(args[0]) &&
|
|
2278
2473
|
(checker.getTypeArguments(args[0])[0].flags & ts.TypeFlags.Never) !== 0;
|
|
2279
2474
|
const payload = emptyVector ? arrayOf(bytesOf("u8")) : mapType(args[0], ctx);
|
|
2280
|
-
if (!payload ||
|
|
2281
|
-
|
|
2282
|
-
|
|
2475
|
+
if (!payload ||
|
|
2476
|
+
(vector
|
|
2477
|
+
? !(payload.kind === "array" && payload.elem.kind === "bytes" && payload.elem.elem === "u8")
|
|
2478
|
+
: !(payload.kind === "string" || (payload.kind === "bytes" && payload.elem === "u8")))) {
|
|
2283
2479
|
return null;
|
|
2284
2480
|
}
|
|
2285
|
-
const count = psym.name === "FileReadResult" ||
|
|
2481
|
+
const count = psym.name === "FileReadResult" ||
|
|
2482
|
+
psym.name === "FileReadvResult" ||
|
|
2483
|
+
psym.name === "ReadVResult"
|
|
2484
|
+
? "bytesRead"
|
|
2485
|
+
: "bytesWritten";
|
|
2286
2486
|
const payloadName = vector ? "buffers" : "buffer";
|
|
2287
2487
|
return {
|
|
2288
2488
|
kind: "record",
|
|
@@ -2306,7 +2506,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2306
2506
|
// declares it concrete (an interface; @types/node uses a class — both
|
|
2307
2507
|
// provenance-checked, the Buffer/URL pattern).
|
|
2308
2508
|
if (psym?.name === "Dirent" &&
|
|
2309
|
-
checker
|
|
2509
|
+
checker
|
|
2510
|
+
.declarationsOf(psym)
|
|
2511
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2310
2512
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2311
2513
|
const args = checker.getTypeArguments(widened);
|
|
2312
2514
|
if (args.length > 1)
|
|
@@ -2364,7 +2566,9 @@ function mapTypeInner(type, ctx) {
|
|
|
2364
2566
|
// JSON.stringify of one shows the three fields where Node's
|
|
2365
2567
|
// internal-slot object shows {} — the Dirent %dtype edge's cousin.
|
|
2366
2568
|
if (psym?.name === "X509Certificate" &&
|
|
2367
|
-
checker
|
|
2569
|
+
checker
|
|
2570
|
+
.declarationsOf(psym)
|
|
2571
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2368
2572
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2369
2573
|
isDeclaredInAmbientModule(d, "crypto"))) {
|
|
2370
2574
|
return {
|
|
@@ -2391,10 +2595,21 @@ function mapTypeInner(type, ctx) {
|
|
|
2391
2595
|
}
|
|
2392
2596
|
if (isStdlibInterface("ResourceUsage")) {
|
|
2393
2597
|
const names = [
|
|
2394
|
-
"userCPUTime",
|
|
2395
|
-
"
|
|
2396
|
-
"
|
|
2397
|
-
"
|
|
2598
|
+
"userCPUTime",
|
|
2599
|
+
"systemCPUTime",
|
|
2600
|
+
"maxRSS",
|
|
2601
|
+
"sharedMemorySize",
|
|
2602
|
+
"unsharedDataSize",
|
|
2603
|
+
"unsharedStackSize",
|
|
2604
|
+
"minorPageFault",
|
|
2605
|
+
"majorPageFault",
|
|
2606
|
+
"swappedOut",
|
|
2607
|
+
"fsRead",
|
|
2608
|
+
"fsWrite",
|
|
2609
|
+
"ipcSent",
|
|
2610
|
+
"ipcReceived",
|
|
2611
|
+
"signalsCount",
|
|
2612
|
+
"voluntaryContextSwitches",
|
|
2398
2613
|
"involuntaryContextSwitches",
|
|
2399
2614
|
];
|
|
2400
2615
|
return {
|
|
@@ -2421,7 +2636,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2421
2636
|
// plain number. Declared order is Node's runtime insertion order
|
|
2422
2637
|
// (lib/os.js builds address..cidr then appends scopeid), so Object.keys
|
|
2423
2638
|
// over a row answers exactly Node.
|
|
2424
|
-
if (isStdlibInterface("NetworkInterfaceInfoIPv4") ||
|
|
2639
|
+
if (isStdlibInterface("NetworkInterfaceInfoIPv4") ||
|
|
2640
|
+
isStdlibInterface("NetworkInterfaceInfoIPv6")) {
|
|
2425
2641
|
const v6 = psym.name === "NetworkInterfaceInfoIPv6";
|
|
2426
2642
|
const cidrArms = [NULL_T, STRING].sort((a, b) => (typeKey(a) < typeKey(b) ? -1 : 1));
|
|
2427
2643
|
const cidr = { kind: "union", unionId: ctx.unions.intern(cidrArms) };
|
|
@@ -2440,12 +2656,17 @@ function mapTypeInner(type, ctx) {
|
|
|
2440
2656
|
return {
|
|
2441
2657
|
kind: "record",
|
|
2442
2658
|
shapeId: ctx.shapes.intern(fields, false, undefined, [
|
|
2443
|
-
"address",
|
|
2659
|
+
"address",
|
|
2660
|
+
"netmask",
|
|
2661
|
+
"family",
|
|
2662
|
+
"mac",
|
|
2663
|
+
"internal",
|
|
2664
|
+
"cidr",
|
|
2665
|
+
"scopeid",
|
|
2444
2666
|
]),
|
|
2445
2667
|
};
|
|
2446
2668
|
}
|
|
2447
|
-
if (isStdlibInterface("PromiseFulfilledResult") ||
|
|
2448
|
-
isStdlibInterface("PromiseRejectedResult")) {
|
|
2669
|
+
if (isStdlibInterface("PromiseFulfilledResult") || isStdlibInterface("PromiseRejectedResult")) {
|
|
2449
2670
|
return {
|
|
2450
2671
|
kind: "record",
|
|
2451
2672
|
shapeId: ctx.shapes.intern([{ name: "status", type: STRING }], false, undefined, ["status"]),
|
|
@@ -2480,7 +2701,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2480
2701
|
return hybrid;
|
|
2481
2702
|
// Recursive and Symbol-keyed callable objects need their complete live
|
|
2482
2703
|
// property table; dropping those members into a plain closure loses data.
|
|
2483
|
-
if (!ctx.dynamic &&
|
|
2704
|
+
if (!ctx.dynamic &&
|
|
2705
|
+
checker.getCallSignatures(widened).length > 0 &&
|
|
2484
2706
|
checker.getPropertiesOfType(widened).length > 0)
|
|
2485
2707
|
return DYN;
|
|
2486
2708
|
}
|
|
@@ -2523,20 +2745,36 @@ function mapTypeInner(type, ctx) {
|
|
|
2523
2745
|
ts.isParameter(decl) &&
|
|
2524
2746
|
(decl.questionToken !== undefined || decl.initializer !== undefined);
|
|
2525
2747
|
let pt = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
2526
|
-
if (decl &&
|
|
2748
|
+
if (decl &&
|
|
2749
|
+
ts.isParameter(decl) &&
|
|
2750
|
+
ts.isSetAccessorDeclaration(decl.parent) &&
|
|
2751
|
+
isJsSourceFile(decl.getSourceFile()))
|
|
2527
2752
|
pt = DYN;
|
|
2528
2753
|
// An inferred JavaScript binding pattern consumes an iterable; it
|
|
2529
2754
|
// does not require the caller's array to have exactly this length.
|
|
2530
2755
|
const executor = decl && ts.isParameter(decl) ? decl.parent : null;
|
|
2531
2756
|
const construction = executor?.parent;
|
|
2532
2757
|
const constructorSymbol = construction && ts.isNewExpression(construction)
|
|
2533
|
-
? checker.getSymbolAtLocation(construction.expression)
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
ts.
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2758
|
+
? checker.getSymbolAtLocation(construction.expression)
|
|
2759
|
+
: undefined;
|
|
2760
|
+
const nativeExecutor = executor &&
|
|
2761
|
+
(ts.isArrowFunction(executor) || ts.isFunctionExpression(executor)) &&
|
|
2762
|
+
construction &&
|
|
2763
|
+
ts.isNewExpression(construction) &&
|
|
2764
|
+
construction.arguments?.[0] === executor &&
|
|
2765
|
+
ts.isIdentifier(construction.expression) &&
|
|
2766
|
+
construction.expression.text === "Promise" &&
|
|
2767
|
+
constructorSymbol &&
|
|
2768
|
+
checker
|
|
2769
|
+
.declarationsOf(constructorSymbol)
|
|
2770
|
+
.some((site) => ctx.isStdlibFile(site.getSourceFile()));
|
|
2771
|
+
if (!nativeExecutor &&
|
|
2772
|
+
decl &&
|
|
2773
|
+
ts.isParameter(decl) &&
|
|
2774
|
+
!decl.dotDotDotToken &&
|
|
2775
|
+
!ts.isSetAccessorDeclaration(decl.parent) &&
|
|
2776
|
+
isJsSourceFile(decl.getSourceFile()) &&
|
|
2777
|
+
!decl.type &&
|
|
2540
2778
|
!/@(?:param|type)\b/.test(decl.getSourceFile().text.slice(decl.parent?.pos ?? decl.pos, decl.getStart())))
|
|
2541
2779
|
pt = DYN;
|
|
2542
2780
|
if (pt)
|
|
@@ -2570,22 +2808,38 @@ function mapTypeInner(type, ctx) {
|
|
|
2570
2808
|
// returns can read mutable fields, so callable values use the same
|
|
2571
2809
|
// checked-native return ABI as their implementations.
|
|
2572
2810
|
const sigDecl = checker.signatureDeclaration(sig);
|
|
2573
|
-
const jsUnitReturn = sigDecl !== undefined &&
|
|
2811
|
+
const jsUnitReturn = sigDecl !== undefined &&
|
|
2812
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2574
2813
|
(retT.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) !== 0;
|
|
2575
2814
|
let ret = jsUnitReturn || (!ctx.dynamic && (retT.flags & ts.TypeFlags.Any) !== 0)
|
|
2576
|
-
? DYN
|
|
2815
|
+
? DYN
|
|
2816
|
+
: retT.flags & ts.TypeFlags.Never
|
|
2817
|
+
? VOID
|
|
2818
|
+
: mapType(retT, ctx);
|
|
2577
2819
|
if (sigDecl && ts.isGetAccessorDeclaration(sigDecl) && isJsSourceFile(sigDecl.getSourceFile()))
|
|
2578
2820
|
ret = DYN;
|
|
2579
2821
|
if (sigDecl && isJsSourceFile(sigDecl.getSourceFile()) && ret?.kind === "array")
|
|
2580
2822
|
ret = DYN;
|
|
2581
|
-
if (sigDecl &&
|
|
2582
|
-
|
|
2823
|
+
if (sigDecl &&
|
|
2824
|
+
ts.isFunctionLike(sigDecl) &&
|
|
2825
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2826
|
+
!sigDecl.type &&
|
|
2827
|
+
!/@returns?\b/.test(sigDecl.getSourceFile().text.slice(sigDecl.pos, sigDecl.getStart())) &&
|
|
2828
|
+
ret?.kind === "record")
|
|
2583
2829
|
ret = DYN;
|
|
2584
|
-
if (sigDecl &&
|
|
2830
|
+
if (sigDecl &&
|
|
2831
|
+
ts.isFunctionLike(sigDecl) &&
|
|
2832
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2833
|
+
!sigDecl.type &&
|
|
2585
2834
|
!/@returns?\b/.test(sigDecl.getSourceFile().text.slice(sigDecl.pos, sigDecl.getStart())) &&
|
|
2586
|
-
(ret?.kind === "date" ||
|
|
2835
|
+
(ret?.kind === "date" ||
|
|
2836
|
+
(ret?.kind === "union" &&
|
|
2837
|
+
ctx.unions.get(ret.unionId)?.arms.some((arm) => arm.kind === "func"))))
|
|
2587
2838
|
ret = DYN;
|
|
2588
|
-
if (ret &&
|
|
2839
|
+
if (ret &&
|
|
2840
|
+
sigDecl &&
|
|
2841
|
+
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2842
|
+
functionCanReturnUndefined(sigDecl))
|
|
2589
2843
|
ret = withUndefinedArm(ret, ctx.unions) ?? ret;
|
|
2590
2844
|
if (!ret)
|
|
2591
2845
|
return null;
|
|
@@ -2630,29 +2884,66 @@ function mapTypeInner(type, ctx) {
|
|
|
2630
2884
|
callSigs.length === 0 &&
|
|
2631
2885
|
psym !== undefined &&
|
|
2632
2886
|
checker.declarationsOf(psym).length > 0 &&
|
|
2633
|
-
checker
|
|
2887
|
+
checker
|
|
2888
|
+
.declarationsOf(psym)
|
|
2889
|
+
.every((d) => ts.isInterfaceDeclaration(d) && !ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2634
2890
|
const CHILD_SURFACE = new Set([
|
|
2635
|
-
"pid",
|
|
2636
|
-
"
|
|
2637
|
-
"
|
|
2891
|
+
"pid",
|
|
2892
|
+
"exitCode",
|
|
2893
|
+
"killed",
|
|
2894
|
+
"kill",
|
|
2895
|
+
"on",
|
|
2896
|
+
"once",
|
|
2897
|
+
"off",
|
|
2898
|
+
"removeListener",
|
|
2899
|
+
"unref",
|
|
2900
|
+
"ref",
|
|
2901
|
+
"stdin",
|
|
2902
|
+
"stdout",
|
|
2903
|
+
"stderr",
|
|
2904
|
+
"send",
|
|
2905
|
+
"connected",
|
|
2906
|
+
"disconnect",
|
|
2907
|
+
]);
|
|
2908
|
+
const CHILD_CORE = new Set([
|
|
2909
|
+
"kill",
|
|
2910
|
+
"on",
|
|
2911
|
+
"stdin",
|
|
2912
|
+
"stdout",
|
|
2913
|
+
"stderr",
|
|
2914
|
+
"unref",
|
|
2915
|
+
"exitCode",
|
|
2916
|
+
"send",
|
|
2917
|
+
"connected",
|
|
2638
2918
|
]);
|
|
2639
|
-
const CHILD_CORE = new Set(["kill", "on", "stdin", "stdout", "stderr", "unref", "exitCode", "send", "connected"]);
|
|
2640
2919
|
const props = checker.getPropertiesOfType(widened);
|
|
2641
2920
|
let core = 0;
|
|
2642
2921
|
const childMemberType = (p) => {
|
|
2643
2922
|
if (["kill", "on", "once", "off", "removeListener", "unref", "ref"].includes(p.name)) {
|
|
2644
2923
|
return checker.getCallSignatures(checker.getTypeOfSymbol(p)).length > 0;
|
|
2645
2924
|
}
|
|
2646
|
-
const expected = p.name === "stdout" || p.name === "stderr"
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2925
|
+
const expected = p.name === "stdout" || p.name === "stderr"
|
|
2926
|
+
? "childStream"
|
|
2927
|
+
: p.name === "stdin"
|
|
2928
|
+
? "childWriter"
|
|
2929
|
+
: p.name === "killed"
|
|
2930
|
+
? "bool"
|
|
2931
|
+
: "f64";
|
|
2932
|
+
const unit = p.name === "pid"
|
|
2933
|
+
? "undefinedT"
|
|
2934
|
+
: p.name === "exitCode" ||
|
|
2935
|
+
p.name === "stdin" ||
|
|
2936
|
+
p.name === "stdout" ||
|
|
2937
|
+
p.name === "stderr"
|
|
2938
|
+
? "nullT"
|
|
2939
|
+
: null;
|
|
2650
2940
|
const mapped = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
2651
2941
|
if (!mapped)
|
|
2652
2942
|
return false;
|
|
2653
2943
|
const arms = mapped.kind === "union" ? ctx.unions.get(mapped.unionId)?.arms : [mapped];
|
|
2654
|
-
return arms !== undefined &&
|
|
2655
|
-
arms.
|
|
2944
|
+
return (arms !== undefined &&
|
|
2945
|
+
arms.some((arm) => arm.kind === expected) &&
|
|
2946
|
+
arms.every((arm) => arm.kind === expected || arm.kind === unit));
|
|
2656
2947
|
};
|
|
2657
2948
|
const childShaped = props.length > 0 &&
|
|
2658
2949
|
props.every((p) => {
|
|
@@ -2702,6 +2993,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2702
2993
|
try {
|
|
2703
2994
|
const byKey = new Map();
|
|
2704
2995
|
const recordParts = [];
|
|
2996
|
+
const substitutedUnions = [];
|
|
2705
2997
|
for (const part of ts.constituentTypes(widened)) {
|
|
2706
2998
|
// TypeScript's client can retain impossible intersections in a
|
|
2707
2999
|
// distributed union. They have no inhabitants and no runtime tag.
|
|
@@ -2745,6 +3037,19 @@ function mapTypeInner(type, ctx) {
|
|
|
2745
3037
|
byKey.set(typeKey(UNDEFINED_T), UNDEFINED_T);
|
|
2746
3038
|
continue;
|
|
2747
3039
|
}
|
|
3040
|
+
// A generic parameter can substitute a complete union into one
|
|
3041
|
+
// checker constituent: `(T | undefined)` with nullable T still
|
|
3042
|
+
// has one flat storage contract. An unfinished recursive union
|
|
3043
|
+
// cannot supply its arms yet, so retain that existing boundary.
|
|
3044
|
+
if (mapped.kind === "union") {
|
|
3045
|
+
const substituted = unions.get(mapped.unionId);
|
|
3046
|
+
if (!substituted?.arms.length || substituted.arms.some((arm) => arm.kind === "union"))
|
|
3047
|
+
return null;
|
|
3048
|
+
substitutedUnions.push(substituted);
|
|
3049
|
+
for (const arm of substituted.arms)
|
|
3050
|
+
byKey.set(typeKey(arm), arm);
|
|
3051
|
+
continue;
|
|
3052
|
+
}
|
|
2748
3053
|
byKey.set(typeKey(mapped), mapped);
|
|
2749
3054
|
if (mapped.kind === "record")
|
|
2750
3055
|
recordParts.push({ source: part, mapped });
|
|
@@ -2790,13 +3095,19 @@ function mapTypeInner(type, ctx) {
|
|
|
2790
3095
|
!unions.recursivePending(widened)) {
|
|
2791
3096
|
return DYN;
|
|
2792
3097
|
}
|
|
2793
|
-
if (arms.some((a) => a.kind === "void" ||
|
|
2794
|
-
a.kind === "
|
|
2795
|
-
a.kind === "
|
|
3098
|
+
if (arms.some((a) => a.kind === "void" ||
|
|
3099
|
+
a.kind === "union" ||
|
|
3100
|
+
a.kind === "date" ||
|
|
3101
|
+
a.kind === "dyn" ||
|
|
3102
|
+
a.kind === "generator") ||
|
|
3103
|
+
!unionContainerArmsOk(arms)) {
|
|
2796
3104
|
return null;
|
|
2797
3105
|
}
|
|
2798
3106
|
arms.sort((a, b) => (typeKey(a) < typeKey(b) ? -1 : 1));
|
|
2799
|
-
const discriminant = unionDiscriminant(recordParts, arms, ctx)
|
|
3107
|
+
const discriminant = unionDiscriminant(recordParts, arms, ctx) ??
|
|
3108
|
+
(substitutedUnions.length === 1
|
|
3109
|
+
? remapUnionDiscriminant(substitutedUnions[0], arms)
|
|
3110
|
+
: undefined);
|
|
2800
3111
|
if (unions.recursivePending(widened)) {
|
|
2801
3112
|
// The knot closed through this union. A frame that resolved
|
|
2802
3113
|
// through context-sensitive hooks (generic type parameters, mixin
|
|
@@ -2837,7 +3148,9 @@ function unionDiscriminant(parts, arms, ctx) {
|
|
|
2837
3148
|
let complete = true;
|
|
2838
3149
|
for (const part of parts) {
|
|
2839
3150
|
const prop = checker.getPropertyOfType(part.source, candidate.name);
|
|
2840
|
-
if (!prop ||
|
|
3151
|
+
if (!prop ||
|
|
3152
|
+
prop.flags &
|
|
3153
|
+
(ts.SymbolFlags.Optional | ts.SymbolFlags.GetAccessor | ts.SymbolFlags.SetAccessor)) {
|
|
2841
3154
|
complete = false;
|
|
2842
3155
|
break;
|
|
2843
3156
|
}
|
|
@@ -2866,8 +3179,15 @@ function unionDiscriminant(parts, arms, ctx) {
|
|
|
2866
3179
|
if (complete) {
|
|
2867
3180
|
return {
|
|
2868
3181
|
field: candidate.name,
|
|
2869
|
-
cases: [...byTag]
|
|
2870
|
-
|
|
3182
|
+
cases: [...byTag]
|
|
3183
|
+
.sort(([a], [b]) => a - b)
|
|
3184
|
+
.map(([tag, values]) => ({
|
|
3185
|
+
tag,
|
|
3186
|
+
values: values.sort((a, b) => JSON.stringify(a) < JSON.stringify(b)
|
|
3187
|
+
? -1
|
|
3188
|
+
: JSON.stringify(a) > JSON.stringify(b)
|
|
3189
|
+
? 1
|
|
3190
|
+
: 0),
|
|
2871
3191
|
})),
|
|
2872
3192
|
};
|
|
2873
3193
|
}
|
|
@@ -2892,7 +3212,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2892
3212
|
else {
|
|
2893
3213
|
const symbol = type.getSymbol();
|
|
2894
3214
|
const declarations = symbol ? checker.declarationsOf(symbol) : [];
|
|
2895
|
-
if (declarations.length === 0 ||
|
|
3215
|
+
if (declarations.length === 0 ||
|
|
3216
|
+
!declarations.every((decl) => ts.isInterfaceDeclaration(decl) && !ctx.isStdlibFile(decl.getSourceFile())))
|
|
2896
3217
|
return undefined;
|
|
2897
3218
|
const target = type.isTypeReference() ? type.getTarget() : type;
|
|
2898
3219
|
if (target === undefined || !target.isClassOrInterface())
|
|
@@ -2907,12 +3228,14 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2907
3228
|
resolveTypeParam: (param) => {
|
|
2908
3229
|
const index = params.indexOf(param);
|
|
2909
3230
|
const arg = index >= 0 ? args[index] : undefined;
|
|
2910
|
-
return arg && arg !== param ? mapType(arg, ctx) : ctx.resolveTypeParam?.(param) ?? null;
|
|
3231
|
+
return arg && arg !== param ? mapType(arg, ctx) : (ctx.resolveTypeParam?.(param) ?? null);
|
|
2911
3232
|
},
|
|
2912
3233
|
resolveTypeParamTs: (param) => {
|
|
2913
3234
|
const index = params.indexOf(param);
|
|
2914
3235
|
const arg = index >= 0 ? args[index] : undefined;
|
|
2915
|
-
return arg && arg !== param
|
|
3236
|
+
return arg && arg !== param
|
|
3237
|
+
? (ctx.resolveTypeParamTs?.(arg) ?? arg)
|
|
3238
|
+
: (ctx.resolveTypeParamTs?.(param) ?? null);
|
|
2916
3239
|
},
|
|
2917
3240
|
};
|
|
2918
3241
|
}
|
|
@@ -2924,7 +3247,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2924
3247
|
for (const base of bases) {
|
|
2925
3248
|
const symbol = base.getSymbol();
|
|
2926
3249
|
const declaration = symbol ? checker.valueDeclarationOf(symbol) : undefined;
|
|
2927
|
-
const classBase = declaration &&
|
|
3250
|
+
const classBase = declaration &&
|
|
3251
|
+
(ts.isClassDeclaration(declaration) || ts.isClassExpression(declaration)) &&
|
|
2928
3252
|
!declaration.getSourceFile().isDeclarationFile;
|
|
2929
3253
|
const mapped = classBase ? mapType(base, viewCtx) : mapClassView(base, viewCtx, seen);
|
|
2930
3254
|
if (mapped === null)
|
|
@@ -2938,7 +3262,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2938
3262
|
}
|
|
2939
3263
|
if (!representation || !baseType)
|
|
2940
3264
|
return undefined;
|
|
2941
|
-
if (checker.getCallSignatures(type).length ||
|
|
3265
|
+
if (checker.getCallSignatures(type).length ||
|
|
3266
|
+
checker.getConstructSignatures(type).length ||
|
|
2942
3267
|
checker.getIndexInfosOfType(type).length)
|
|
2943
3268
|
return null;
|
|
2944
3269
|
for (const property of checker.getPropertiesOfType(type)) {
|
|
@@ -2951,7 +3276,8 @@ function mapClassView(type, ctx, seen = new Set()) {
|
|
|
2951
3276
|
const declarations = checker.declarationsOf(property);
|
|
2952
3277
|
// Instantiating an inherited member can create a new symbol without
|
|
2953
3278
|
// changing its declaration or ABI. Only refinements need validation.
|
|
2954
|
-
if (declarations.length > 0 &&
|
|
3279
|
+
if (declarations.length > 0 &&
|
|
3280
|
+
declarations.length === originalDeclarations.length &&
|
|
2955
3281
|
declarations.every((declaration, index) => declaration === originalDeclarations[index]))
|
|
2956
3282
|
continue;
|
|
2957
3283
|
const before = checker.getTypeOfSymbol(original);
|
|
@@ -2983,15 +3309,20 @@ function mapCollectionView(type, ctx, seen = new Set()) {
|
|
|
2983
3309
|
const { checker } = ctx;
|
|
2984
3310
|
const symbol = type.getSymbol();
|
|
2985
3311
|
const declarations = symbol ? checker.declarationsOf(symbol) : [];
|
|
2986
|
-
if (declarations.length === 0 ||
|
|
3312
|
+
if (declarations.length === 0 ||
|
|
3313
|
+
!declarations.every((decl) => ts.isInterfaceDeclaration(decl) && !ctx.isStdlibFile(decl.getSourceFile())))
|
|
2987
3314
|
return null;
|
|
2988
3315
|
const target = type.getTarget();
|
|
2989
|
-
if (target === undefined ||
|
|
3316
|
+
if (target === undefined ||
|
|
3317
|
+
!target.isClassOrInterface() ||
|
|
3318
|
+
seen.has(target) ||
|
|
3319
|
+
seen.size >= MAP_TYPE_MAX_DEPTH)
|
|
2990
3320
|
return null;
|
|
2991
3321
|
const bases = checker.getBaseTypes(target);
|
|
2992
3322
|
if (bases.length !== 1)
|
|
2993
3323
|
return null;
|
|
2994
|
-
if (checker.getCallSignatures(type).length ||
|
|
3324
|
+
if (checker.getCallSignatures(type).length ||
|
|
3325
|
+
checker.getConstructSignatures(type).length ||
|
|
2995
3326
|
checker.getIndexInfosOfType(type).length)
|
|
2996
3327
|
return null;
|
|
2997
3328
|
// Base declarations contain the interface's parameters, even when this
|
|
@@ -3005,29 +3336,37 @@ function mapCollectionView(type, ctx, seen = new Set()) {
|
|
|
3005
3336
|
resolveTypeParam: (param) => {
|
|
3006
3337
|
const index = params.indexOf(param);
|
|
3007
3338
|
const arg = index >= 0 ? args[index] : undefined;
|
|
3008
|
-
return arg && arg !== param ? mapType(arg, ctx) : ctx.resolveTypeParam?.(param) ?? null;
|
|
3339
|
+
return arg && arg !== param ? mapType(arg, ctx) : (ctx.resolveTypeParam?.(param) ?? null);
|
|
3009
3340
|
},
|
|
3010
3341
|
resolveTypeParamTs: (param) => {
|
|
3011
3342
|
const index = params.indexOf(param);
|
|
3012
3343
|
const arg = index >= 0 ? args[index] : undefined;
|
|
3013
|
-
return arg && arg !== param
|
|
3344
|
+
return arg && arg !== param
|
|
3345
|
+
? (ctx.resolveTypeParamTs?.(arg) ?? arg)
|
|
3346
|
+
: (ctx.resolveTypeParamTs?.(param) ?? null);
|
|
3014
3347
|
},
|
|
3015
3348
|
};
|
|
3016
3349
|
seen.add(target);
|
|
3017
3350
|
try {
|
|
3018
3351
|
const base = bases[0];
|
|
3019
3352
|
const baseSymbol = base.getSymbol();
|
|
3020
|
-
const native = baseSymbol &&
|
|
3021
|
-
|
|
3353
|
+
const native = baseSymbol &&
|
|
3354
|
+
["Map", "ReadonlyMap", "Set", "ReadonlySet"].includes(baseSymbol.name) &&
|
|
3355
|
+
checker
|
|
3356
|
+
.declarationsOf(baseSymbol)
|
|
3357
|
+
.some((decl) => ts.isInterfaceDeclaration(decl) && ctx.isStdlibFile(decl.getSourceFile()));
|
|
3022
3358
|
const mapped = native ? mapType(base, baseCtx) : mapCollectionView(base, baseCtx, seen);
|
|
3023
3359
|
if (mapped?.kind !== "map" && mapped?.kind !== "set")
|
|
3024
3360
|
return null;
|
|
3025
3361
|
const hasType = funcOf([mapped.kind === "map" ? mapped.key : mapped.elem], BOOL);
|
|
3026
3362
|
for (const property of checker.getPropertiesOfType(type)) {
|
|
3027
|
-
const own = checker
|
|
3363
|
+
const own = checker
|
|
3364
|
+
.declarationsOf(property)
|
|
3365
|
+
.filter((decl) => !ctx.isStdlibFile(decl.getSourceFile()));
|
|
3028
3366
|
if (own.length === 0)
|
|
3029
3367
|
continue;
|
|
3030
|
-
if (property.name !== "has" ||
|
|
3368
|
+
if (property.name !== "has" ||
|
|
3369
|
+
property.flags & ts.SymbolFlags.Optional ||
|
|
3031
3370
|
!own.every((decl) => decl.kind === ts.SyntaxKind.MethodSignature))
|
|
3032
3371
|
return null;
|
|
3033
3372
|
const method = mapType(checker.getTypeOfSymbol(property), ctx);
|
|
@@ -3207,7 +3546,9 @@ function mapGenericAwaitedAlias(type, ctx) {
|
|
|
3207
3546
|
if (!(arg.flags & ts.TypeFlags.TypeParameter))
|
|
3208
3547
|
return null;
|
|
3209
3548
|
// Provenance: the STANDARD LIBRARY's alias, not a user's shadowing one.
|
|
3210
|
-
const isLibAlias = ctx.checker
|
|
3549
|
+
const isLibAlias = ctx.checker
|
|
3550
|
+
.declarationsOf(alias)
|
|
3551
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()));
|
|
3211
3552
|
if (!isLibAlias)
|
|
3212
3553
|
return null;
|
|
3213
3554
|
const bound = resolveTypeParam(arg);
|
|
@@ -3253,7 +3594,8 @@ function mapGenericIndexedAccess(type, ctx) {
|
|
|
3253
3594
|
covered = f ? [f.type] : shape.indexValue ? [shape.indexValue] : null;
|
|
3254
3595
|
}
|
|
3255
3596
|
else {
|
|
3256
|
-
const allKeys = ((idx.flags & ts.TypeFlags.TypeParameter) !== 0 &&
|
|
3597
|
+
const allKeys = ((idx.flags & ts.TypeFlags.TypeParameter) !== 0 &&
|
|
3598
|
+
resolveTypeParam(idx)?.kind === "string") ||
|
|
3257
3599
|
(idx.isIndexType() && idx.getTarget() === obj);
|
|
3258
3600
|
if (allKeys) {
|
|
3259
3601
|
covered = shape.fields.map((f) => f.type);
|
|
@@ -3280,7 +3622,9 @@ function mapGenericUtilityAlias(widened, ctx) {
|
|
|
3280
3622
|
if (!(arg.flags & ts.TypeFlags.TypeParameter))
|
|
3281
3623
|
return null;
|
|
3282
3624
|
// Provenance: the STANDARD LIBRARY's alias, not a user's shadowing one.
|
|
3283
|
-
const isLibAlias = ctx.checker
|
|
3625
|
+
const isLibAlias = ctx.checker
|
|
3626
|
+
.declarationsOf(alias)
|
|
3627
|
+
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()));
|
|
3284
3628
|
if (!isLibAlias)
|
|
3285
3629
|
return null;
|
|
3286
3630
|
const bound = resolveTypeParam(arg);
|
|
@@ -3352,8 +3696,7 @@ export function genResultRecord(yieldT, retT, shapes, unions) {
|
|
|
3352
3696
|
byKey.set(typeKey(a), a);
|
|
3353
3697
|
return true;
|
|
3354
3698
|
}
|
|
3355
|
-
if (t.kind === "regex" || t.kind === "date" ||
|
|
3356
|
-
t.kind === "jsval" || t.kind === "generator") {
|
|
3699
|
+
if (t.kind === "regex" || t.kind === "date" || t.kind === "jsval" || t.kind === "generator") {
|
|
3357
3700
|
return false; // no legal union arm exists for these kinds
|
|
3358
3701
|
}
|
|
3359
3702
|
byKey.set(typeKey(t), t);
|
|
@@ -3365,7 +3708,8 @@ export function genResultRecord(yieldT, retT, shapes, unions) {
|
|
|
3365
3708
|
const arms = [...byKey.values()];
|
|
3366
3709
|
// Containers keep the shared nullable-only rule. Generator function
|
|
3367
3710
|
// payloads retain their existing unit-only boundary too.
|
|
3368
|
-
if (!unionContainerArmsOk(arms) ||
|
|
3711
|
+
if (!unionContainerArmsOk(arms) ||
|
|
3712
|
+
arms.some((a) => a.kind === "func" && !arms.every((b) => b === a || isUnitType(b)))) {
|
|
3369
3713
|
return null;
|
|
3370
3714
|
}
|
|
3371
3715
|
if (arms.every(isUnitType) && arms.length < 2) {
|
|
@@ -3424,7 +3768,9 @@ export function withUnitArm(t, kind, unions) {
|
|
|
3424
3768
|
arms.sort((a, b) => (typeKey(a) < typeKey(b) ? -1 : 1));
|
|
3425
3769
|
return { kind: "union", unionId: unions.transform(def, arms) };
|
|
3426
3770
|
}
|
|
3427
|
-
if (t.kind === "void" ||
|
|
3771
|
+
if (t.kind === "void" ||
|
|
3772
|
+
t.kind === "date" ||
|
|
3773
|
+
t.kind === "dyn" ||
|
|
3428
3774
|
// A bare unit field type cannot occur (units live only inside unions),
|
|
3429
3775
|
// but guard against constructing a single-arm union from one.
|
|
3430
3776
|
isUnitType(t)) {
|
|
@@ -3517,7 +3863,12 @@ function mapBrandedPrimitiveIntersection(widened, ctx) {
|
|
|
3517
3863
|
return BIGINT_T;
|
|
3518
3864
|
if (base.flags & ts.TypeFlags.TypeParameter) {
|
|
3519
3865
|
const bound = resolveTypeParam?.(base) ?? null;
|
|
3520
|
-
if (bound &&
|
|
3866
|
+
if (bound &&
|
|
3867
|
+
(bound.kind === "f64" ||
|
|
3868
|
+
bound.kind === "bigint" ||
|
|
3869
|
+
bound.kind === "string" ||
|
|
3870
|
+
bound.kind === "bool" ||
|
|
3871
|
+
bound.kind === "symbol")) {
|
|
3521
3872
|
contextResolutions++;
|
|
3522
3873
|
return bound;
|
|
3523
3874
|
}
|
|
@@ -3597,11 +3948,11 @@ function recordProvenanceOk(t, ctx) {
|
|
|
3597
3948
|
if (t.isIntersectionType()) {
|
|
3598
3949
|
return ts.constituentTypes(t).every((part) => {
|
|
3599
3950
|
const partSym = part.getSymbol();
|
|
3600
|
-
return (part.flags & ts.TypeFlags.Object) !== 0 &&
|
|
3951
|
+
return ((part.flags & ts.TypeFlags.Object) !== 0 &&
|
|
3601
3952
|
!(partSym && partSym.flags & ts.SymbolFlags.Class) &&
|
|
3602
3953
|
checker.getCallSignatures(part).length === 0 &&
|
|
3603
3954
|
checker.getConstructSignatures(part).length === 0 &&
|
|
3604
|
-
recordProvenanceOk(part, ctx);
|
|
3955
|
+
recordProvenanceOk(part, ctx));
|
|
3605
3956
|
});
|
|
3606
3957
|
}
|
|
3607
3958
|
if (isMappedShape(t))
|
|
@@ -3611,7 +3962,12 @@ function recordProvenanceOk(t, ctx) {
|
|
|
3611
3962
|
if (!decls || decls.length === 0) {
|
|
3612
3963
|
// Inferred destructuring parameters can have a synthesized anonymous
|
|
3613
3964
|
// shape with no declaration or member symbols to trace to a source.
|
|
3614
|
-
return checker
|
|
3965
|
+
return checker
|
|
3966
|
+
.getPropertiesOfType(t)
|
|
3967
|
+
.every((property) => checker
|
|
3968
|
+
.declarationsOf(property)
|
|
3969
|
+
.every((decl) => !decl.getSourceFile().isDeclarationFile ||
|
|
3970
|
+
ctx.isExternalTypeFile(decl.getSourceFile())));
|
|
3615
3971
|
}
|
|
3616
3972
|
return !decls.some((d) => {
|
|
3617
3973
|
const sf = d.getSourceFile();
|
|
@@ -3690,7 +4046,10 @@ function mapRecordType(widened, ctx) {
|
|
|
3690
4046
|
inner.fields.every((field) => field.type.kind === "dyn") &&
|
|
3691
4047
|
(inner.indexValue === undefined || inner.indexValue.kind === "dyn"))
|
|
3692
4048
|
return DYN;
|
|
3693
|
-
return {
|
|
4049
|
+
return {
|
|
4050
|
+
kind: "record",
|
|
4051
|
+
shapeId: shapes.intern(inner.fields, false, inner.indexValue, inner.declaredOrder),
|
|
4052
|
+
};
|
|
3694
4053
|
}
|
|
3695
4054
|
finally {
|
|
3696
4055
|
shapes.inProgress.delete(widened);
|
|
@@ -3734,7 +4093,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3734
4093
|
if (indexInfos.length > 0) {
|
|
3735
4094
|
const stringKey = (k) => (k.flags & ts.TypeFlags.String) !== 0 ||
|
|
3736
4095
|
(k.isIntersectionType() &&
|
|
3737
|
-
ts
|
|
4096
|
+
ts
|
|
4097
|
+
.constituentTypes(k)
|
|
4098
|
+
.every((p) => (p.flags & ts.TypeFlags.String) !== 0 ||
|
|
3738
4099
|
((p.flags & ts.TypeFlags.Object) !== 0 &&
|
|
3739
4100
|
checker.getPropertiesOfType(p).length === 0 &&
|
|
3740
4101
|
checker.getCallSignatures(p).length === 0 &&
|
|
@@ -3777,7 +4138,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3777
4138
|
// merge machinery cannot do.
|
|
3778
4139
|
if (indexValue?.kind === "union") {
|
|
3779
4140
|
const slotDef = ctx.unions.get(indexValue.unionId);
|
|
3780
|
-
const armOk = (a) => a.kind === "f64" ||
|
|
4141
|
+
const armOk = (a) => a.kind === "f64" ||
|
|
4142
|
+
a.kind === "string" ||
|
|
4143
|
+
a.kind === "undefinedT" ||
|
|
3781
4144
|
(a.kind === "array" && a.elem.kind === "string");
|
|
3782
4145
|
// A pure Dict<string[]> is the distinct-header shape, not a general
|
|
3783
4146
|
// outgoing-header slot: retain its precise string[] | undefined value
|
|
@@ -3788,7 +4151,8 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3788
4151
|
slotDef.arms.length === 2 &&
|
|
3789
4152
|
slotDef.arms.some((a) => a.kind === "array" && a.elem.kind === "string") &&
|
|
3790
4153
|
slotDef.arms.some((a) => a.kind === "undefinedT");
|
|
3791
|
-
if (slotDef !== undefined &&
|
|
4154
|
+
if (slotDef !== undefined &&
|
|
4155
|
+
!distinctOnly &&
|
|
3792
4156
|
slotDef.arms.some((a) => a.kind === "array" && a.elem.kind === "string") &&
|
|
3793
4157
|
slotDef.arms.every(armOk)) {
|
|
3794
4158
|
const armsRaw = [F64, STRING, arrayOf(STRING), UNDEFINED_T];
|
|
@@ -3803,7 +4167,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3803
4167
|
}
|
|
3804
4168
|
return armOk(t);
|
|
3805
4169
|
};
|
|
3806
|
-
if (checker
|
|
4170
|
+
if (checker
|
|
4171
|
+
.getPropertiesOfType(widened)
|
|
4172
|
+
.every((p) => fits(mapType(checker.getTypeOfSymbol(p), ctx)))) {
|
|
3807
4173
|
return { kind: "record", shapeId: shapes.intern([], false, canonical, []) };
|
|
3808
4174
|
}
|
|
3809
4175
|
}
|
|
@@ -3833,6 +4199,8 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3833
4199
|
const computed = widened.isIntersectionType() || isMappedShape(widened);
|
|
3834
4200
|
{
|
|
3835
4201
|
const props = checker.getPropertiesOfType(widened);
|
|
4202
|
+
if (ctx.classImplementedProtocol?.(widened))
|
|
4203
|
+
return DYN;
|
|
3836
4204
|
// Symbol-keyed records use the checked object's descriptor table. A
|
|
3837
4205
|
// checker-internal __@ name is not a string field in a native struct.
|
|
3838
4206
|
if (props.some((property) => property.name.startsWith("__@")))
|
|
@@ -3862,11 +4230,15 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3862
4230
|
indexValue === undefined &&
|
|
3863
4231
|
checker.getCallSignatures(widened).length === 0 &&
|
|
3864
4232
|
checker.getConstructSignatures(widened).length === 0 &&
|
|
3865
|
-
!(anonSym !== undefined &&
|
|
4233
|
+
!(anonSym !== undefined &&
|
|
4234
|
+
checker.declarationsOf(anonSym).some((d) => ts.isObjectLiteralExpression(d)))) {
|
|
3866
4235
|
return DYN;
|
|
3867
4236
|
}
|
|
3868
4237
|
const fields = [];
|
|
3869
|
-
for (
|
|
4238
|
+
for (let propertyIndex = 0; propertyIndex < props.length; propertyIndex++) {
|
|
4239
|
+
if (propertyIndex % 32 === 0)
|
|
4240
|
+
checker.prefetchMemberTypes(props, propertyIndex);
|
|
4241
|
+
const p = props[propertyIndex];
|
|
3870
4242
|
if (p.flags & (ts.SymbolFlags.GetAccessor | ts.SymbolFlags.SetAccessor)) {
|
|
3871
4243
|
// OBJECT-LITERAL get/set accessors (TS sources): the property has
|
|
3872
4244
|
// no data slot — the shape carries reserved closure fields instead
|
|
@@ -3917,7 +4289,10 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3917
4289
|
// A void/unit-typed write slot has no value form; DIVERGENT
|
|
3918
4290
|
// getter/setter types stay out too (one property, one type —
|
|
3919
4291
|
// the class-accessor stance).
|
|
3920
|
-
if (writeT === null ||
|
|
4292
|
+
if (writeT === null ||
|
|
4293
|
+
writeT.kind === "void" ||
|
|
4294
|
+
writeT.kind === "jsval" ||
|
|
4295
|
+
isUnitType(writeT))
|
|
3921
4296
|
return null;
|
|
3922
4297
|
if (readT !== null && typeKey(readT) !== typeKey(writeT))
|
|
3923
4298
|
return null;
|
|
@@ -3954,7 +4329,9 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
3954
4329
|
// initializer is an EMPTY array literal inside a const assertion IS
|
|
3955
4330
|
// the empty tuple — map it exactly as the tuple branch does (the
|
|
3956
4331
|
// unit-element array; see the `[] as const` rule there).
|
|
3957
|
-
if ((pt === null || pt.kind === "jsval") &&
|
|
4332
|
+
if ((pt === null || pt.kind === "jsval") &&
|
|
4333
|
+
(fieldTs.flags & ts.TypeFlags.Any) !== 0 &&
|
|
4334
|
+
constAssertedEmptyArrayProp(p, ctx)) {
|
|
3958
4335
|
pt = arrayOf(unitOnlyUnion(ctx.unions));
|
|
3959
4336
|
}
|
|
3960
4337
|
if (pt === null && !ctx.dynamic && (fieldTs.flags & ts.TypeFlags.Any) !== 0)
|
|
@@ -4081,7 +4458,9 @@ export function describeComponentBlocker(widened, ctx) {
|
|
|
4081
4458
|
const psym = widened.getSymbol();
|
|
4082
4459
|
const container = psym !== undefined &&
|
|
4083
4460
|
Object.prototype.hasOwnProperty.call(STDLIB_CONTAINERS, psym.name) &&
|
|
4084
|
-
checker
|
|
4461
|
+
checker
|
|
4462
|
+
.declarationsOf(psym)
|
|
4463
|
+
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))
|
|
4085
4464
|
? psym.name
|
|
4086
4465
|
: undefined;
|
|
4087
4466
|
if (container !== undefined) {
|
|
@@ -4094,13 +4473,18 @@ export function describeComponentBlocker(widened, ctx) {
|
|
|
4094
4473
|
if (!mapped) {
|
|
4095
4474
|
return `the ${container} shape is supported, but its ${role} type '${text(arg)}' does not compile`;
|
|
4096
4475
|
}
|
|
4097
|
-
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4476
|
+
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4477
|
+
i === 0 &&
|
|
4478
|
+
!isSupportedMapKey(mapped, mapped.kind === "union" ? ctx.unions.get(mapped.unionId)?.arms : undefined)) {
|
|
4098
4479
|
return `the ${container} shape is supported, but '${text(arg)}' is outside its supported key domain (numbers, strings, booleans, bigints, identity references, or supported unions)`;
|
|
4099
4480
|
}
|
|
4100
|
-
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4481
|
+
if ((container === "Map" || container === "ReadonlyMap") &&
|
|
4482
|
+
i === 1 &&
|
|
4483
|
+
!isSupportedMapValue(mapped)) {
|
|
4101
4484
|
return `the ${container} shape is supported, but '${text(arg)}' values have no Map slot yet`;
|
|
4102
4485
|
}
|
|
4103
|
-
if ((container === "Set" || container === "ReadonlySet") &&
|
|
4486
|
+
if ((container === "Set" || container === "ReadonlySet") &&
|
|
4487
|
+
!isSupportedSetElem(mapped, mapped.kind === "union" ? ctx.unions.get(mapped.unionId)?.arms : undefined)) {
|
|
4104
4488
|
return `the ${container} shape is supported, but '${text(arg)}' is outside its supported element domain (numbers, strings, booleans, bigints, identity references, or supported unions)`;
|
|
4105
4489
|
}
|
|
4106
4490
|
}
|
|
@@ -4181,8 +4565,7 @@ export function describeComponentBlocker(widened, ctx) {
|
|
|
4181
4565
|
const sigDecl = checker.signatureDeclaration(sig);
|
|
4182
4566
|
if (sigDecl !== undefined &&
|
|
4183
4567
|
ts.isFunctionLike(sigDecl) &&
|
|
4184
|
-
(sigDecl.parameters.length !== sig.getParameters().length ||
|
|
4185
|
-
bodyReadsArguments(sigDecl))) {
|
|
4568
|
+
(sigDecl.parameters.length !== sig.getParameters().length || bodyReadsArguments(sigDecl))) {
|
|
4186
4569
|
return `the function shape is supported, but its signature is variadic ('arguments'-reading), and a compiled signature is fixed-arity`;
|
|
4187
4570
|
}
|
|
4188
4571
|
for (const p of sig.getParameters()) {
|