@scriptc/compiler 0.2.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +2 -36
- package/ambient/scriptc-overrides.d.ts +1 -25
- package/ambient/scriptc.d.ts +1 -9
- package/dist/backend/cycle-analysis.test.js +1 -1
- package/dist/backend/cycle-mutability.d.ts +1 -1
- package/dist/backend/cycle-mutability.js +1 -18
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.d.ts +1 -1
- package/dist/backend/executable-features.js +3 -8
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +1 -1
- package/dist/backend/immutability.js +1 -1
- package/dist/backend/immutability.test.js +1 -1
- package/dist/backend/library-pack.js +0 -2
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/linker.js +1 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/llvm/checked-narrows.test.js +1 -1
- package/dist/backend/llvm/classes.js +3 -9
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +7 -7
- package/dist/backend/llvm/constant-callbacks.d.ts +1 -1
- package/dist/backend/llvm/constant-callbacks.js +3 -3
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +1 -1
- package/dist/backend/llvm/dyn.d.ts +0 -1
- package/dist/backend/llvm/dyn.js +0 -73
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +3 -17
- package/dist/backend/llvm/emitter.js +53 -181
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +3 -3
- package/dist/backend/llvm/expr-async.test.js +1 -1
- package/dist/backend/llvm/expr-containers.js +12 -8
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +4 -107
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.d.ts +1 -2
- package/dist/backend/llvm/expr-dispatch.js +0 -41
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
- package/dist/backend/llvm/expr-dynamic.js +13 -27
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +2 -2
- package/dist/backend/llvm/expr-stream-bridges.test.js +1 -1
- package/dist/backend/llvm/lib-dispatch.js +0 -1
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +0 -13
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +0 -8
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +7 -0
- package/dist/backend/llvm/map-number-lookup.js +16 -2
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.js +7 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +24 -7
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/shapes.js +1 -2
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +3 -3
- package/dist/backend/llvm/stack-unions.test.js +1 -1
- package/dist/backend/llvm/string-construction.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +1 -1
- package/dist/backend/llvm/switch-dispatch.test.js +1 -1
- package/dist/backend/may-throw.js +0 -9
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/may-throw.test.js +1 -1
- package/dist/backend/native/artifact-stamps.js +0 -2
- package/dist/backend/native/artifact-stamps.js.map +1 -1
- package/dist/backend/native/cache-warm.d.ts +1 -1
- package/dist/backend/native/cache-warm.js +2 -3
- package/dist/backend/native/cache-warm.js.map +1 -1
- package/dist/backend/native/compiler-fingerprint.d.ts +1 -1
- package/dist/backend/native/compiler-fingerprint.js +4 -7
- package/dist/backend/native/compiler-fingerprint.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +3 -28
- package/dist/backend/native/driver.js +1 -3
- package/dist/backend/native/driver.js.map +1 -1
- package/dist/backend/native/executable.d.ts +0 -15
- package/dist/backend/native/executable.js +17 -172
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/tool-identity.js +0 -1
- package/dist/backend/native/tool-identity.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +0 -2
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +23 -33
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/publication.test.js +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 -2
- package/dist/backend/runtime-pack-core.js +5 -14
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +3 -8
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +22 -19
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.d.ts +0 -5
- package/dist/backend/target-diagnostics.js +1 -11
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +1 -1
- package/dist/backend/vendor-archives.d.ts +1 -7
- package/dist/backend/vendor-archives.js +9 -189
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +0 -1
- package/dist/backend/vendor-inputs.js +0 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.js +3 -5
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +4 -8
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +1 -1
- package/dist/cli/usage.d.ts +1 -5
- package/dist/cli/usage.js +4 -9
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +2 -2
- package/dist/compat/fetch-profile.js +16 -25
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +2 -17
- package/dist/contracts/check.js +2 -6
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.d.ts +5 -22
- package/dist/coverage/report.js +12 -76
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.d.ts +3 -3
- package/dist/coverage/surface-manifest.js +22 -27
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +1 -3
- package/dist/coverage/verdict-cache.js +2 -7
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +11 -60
- package/dist/diagnostics/diagnostic.js +39 -118
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +3 -4
- package/dist/diagnostics/envelope.js +0 -9
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/envelope.test.js +1 -1
- package/dist/diagnostics/envelope.test.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +0 -3
- package/dist/executable/executable-cache.js +2 -4
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +0 -4
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +5 -2
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +10 -10
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/cjs-syntax.js +0 -88
- package/dist/frontend/cjs-syntax.js.map +1 -1
- package/dist/frontend/dts-paths.d.ts +1 -1
- package/dist/frontend/dts-paths.js +1 -1
- package/dist/frontend/lowering/abstract-equality.js +1 -4
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +4 -11
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/builtins/arguments.js +0 -13
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +0 -4
- package/dist/frontend/lowering/builtins/crypto.js +0 -4
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +1 -39
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +0 -15
- package/dist/frontend/lowering/builtins/module-resolution.js +5 -44
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.d.ts +0 -6
- package/dist/frontend/lowering/builtins/numbers.js +6 -57
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +4 -67
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/workers.js +1 -1
- package/dist/frontend/lowering/builtins/workers.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.d.ts +1 -37
- package/dist/frontend/lowering/call-arguments.js +11 -94
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +1 -6
- package/dist/frontend/lowering/call-signatures.js +16 -68
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +19 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.js +168 -98
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +44 -4
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +0 -2
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.js +1 -1
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/coercions/function-adapters.js +5 -35
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +0 -1
- package/dist/frontend/lowering/coercions/state.js +0 -1
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural-plans.js +2 -4
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +2 -12
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.js +0 -1
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +9 -28
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +2 -3
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +10 -54
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +0 -1
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +2 -10
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +1 -6
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +0 -2
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +0 -6
- package/dist/frontend/lowering/containers/string-and-regexp.js +2 -10
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/expressions/evaluation-safety.js +0 -3
- package/dist/frontend/lowering/expressions/evaluation-safety.js.map +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js +1 -1
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +0 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -8
- package/dist/frontend/lowering/expressions/object-literals.js +8 -35
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +0 -4
- package/dist/frontend/lowering/expressions/optional-chains.js +3 -66
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/function-context.js +0 -1
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +0 -1
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +10 -77
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.js +1 -10
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +2 -2
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +2 -3
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +2 -27
- package/dist/frontend/lowering/lower-calls.js +47 -463
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.js +11 -49
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.js +2 -3
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.js +5 -8
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.js +3 -4
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.js +3 -5
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +0 -8
- package/dist/frontend/lowering/lower-exprs.js +50 -907
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +2 -5
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +1 -50
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +0 -43
- package/dist/frontend/lowering/lower-modules.js +25 -329
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +5 -5
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +0 -30
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +98 -0
- package/dist/frontend/lowering/{lower-island.js → lower-stdlib.js} +97 -1160
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -0
- package/dist/frontend/lowering/lower-stmts.d.ts +0 -16
- package/dist/frontend/lowering/lower-stmts.js +58 -1016
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +1 -3
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +17 -151
- package/dist/frontend/lowering/lowerer.js +73 -770
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +4 -51
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.js +1 -1
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/optional-arguments.js +0 -2
- package/dist/frontend/lowering/optional-arguments.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.test.js +2 -2
- package/dist/frontend/lowering/strict-equality.js +1 -1
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +6 -45
- package/dist/frontend/lowering/surfaces.js +5 -65
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/module-syntax.d.ts +0 -3
- package/dist/frontend/module-syntax.js.map +1 -1
- package/dist/frontend/npm-node.d.ts +0 -7
- package/dist/frontend/npm-node.js +0 -7
- package/dist/frontend/npm-node.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.d.ts +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +6 -82
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/npm-static.d.ts +1 -1
- package/dist/frontend/npm-static.js +6 -71
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +3 -319
- package/dist/frontend/npm.js +6 -1007
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +2 -197
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.js +1 -2
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +3 -11
- package/dist/frontend/pipeline.js +37 -56
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/pipeline.test.js +12 -6
- package/dist/frontend/pipeline.test.js.map +1 -1
- package/dist/frontend/program.d.ts +0 -34
- package/dist/frontend/program.js +12 -97
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/provenance-core.d.ts +0 -4
- package/dist/frontend/provenance-core.js +4 -37
- package/dist/frontend/provenance-core.js.map +1 -1
- package/dist/frontend/provenance-registry.d.ts +0 -4
- package/dist/frontend/provenance-registry.js +0 -20
- package/dist/frontend/provenance-registry.js.map +1 -1
- package/dist/frontend/resolve.d.ts +0 -12
- package/dist/frontend/resolve.js +0 -34
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.js +2 -2
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/services-node.js +2 -3
- package/dist/frontend/services-node.js.map +1 -1
- package/dist/frontend/services.d.ts +1 -8
- package/dist/frontend/services.js +2 -22
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/services.test.js +0 -38
- package/dist/frontend/services.test.js.map +1 -1
- package/dist/frontend/tsc-codes.js +0 -11
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +2 -27
- package/dist/frontend/type-mapper.js +42 -153
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -10
- package/dist/index.js.map +1 -1
- package/dist/ir/api.d.ts +1 -1
- package/dist/ir/api.js +1 -1
- package/dist/ir/api.js.map +1 -1
- package/dist/ir/builtin-effects.js +0 -5
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +1 -55
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/constant-globals.test.js +1 -1
- package/dist/ir/constant-tables.test.js +1 -1
- package/dist/ir/final-fields.test.js +1 -1
- package/dist/ir/initializer-bindings.test.js +1 -1
- package/dist/ir/int32-slots.d.ts +3 -3
- package/dist/ir/int32-slots.js +5 -19
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +1 -1
- package/dist/ir/ir.d.ts +12 -284
- package/dist/ir/ir.js +10 -259
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +2 -7
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +3 -30
- package/dist/ir/runtime-features.js +5 -41
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.test.js +1 -1
- package/dist/ir/serialize.d.ts +1 -1
- package/dist/ir/serialize.js +3 -3
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +0 -21
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/unshare.test.js +1 -1
- package/dist/ir/validate.js +9 -207
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +6 -6
- package/dist/library/fence-eval.test.js +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/library-cache.test.js +5 -5
- package/dist/library/prepare.js +5 -20
- package/dist/library/prepare.js.map +1 -1
- package/dist/native/cli.js +0 -2
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.test.js +2 -4
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/prepare.js +2 -4
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.js +2 -16
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +0 -3
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/startup-cache.js +0 -2
- package/dist/startup-cache.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +80 -88
- package/dist/backend/llvm/expr-island.d.ts +0 -15
- package/dist/backend/llvm/expr-island.js +0 -709
- package/dist/backend/llvm/expr-island.js.map +0 -1
- package/dist/frontend/lowering/coercions/island.d.ts +0 -37
- package/dist/frontend/lowering/coercions/island.js +0 -350
- package/dist/frontend/lowering/coercions/island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.d.ts +0 -229
- package/dist/frontend/lowering/lower-island.js.map +0 -1
- package/dist/frontend/lowering/lower-island.test.d.ts +0 -1
- package/dist/frontend/lowering/lower-island.test.js +0 -56
- package/dist/frontend/lowering/lower-island.test.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.d.ts +0 -17
- package/dist/frontend/npm-fetch-analysis.js +0 -109
- package/dist/frontend/npm-fetch-analysis.js.map +0 -1
- package/dist/frontend/npm-fetch-analysis.test.d.ts +0 -1
- package/dist/frontend/npm-fetch-analysis.test.js +0 -130
- package/dist/frontend/npm-fetch-analysis.test.js.map +0 -1
- package/dist/frontend/npm-fetch-node.d.ts +0 -2
- package/dist/frontend/npm-fetch-node.js +0 -12
- package/dist/frontend/npm-fetch-node.js.map +0 -1
- package/dist/frontend/npm-fetch-syntax.d.ts +0 -6
- package/dist/frontend/npm-fetch-syntax.js +0 -202
- package/dist/frontend/npm-fetch-syntax.js.map +0 -1
- package/dist/native/runtime-typescript.d.ts +0 -4
- package/dist/native/runtime-typescript.js +0 -74
- package/dist/native/runtime-typescript.js.map +0 -1
- package/dist/native/runtime-typescript.test.d.ts +0 -1
- package/dist/native/runtime-typescript.test.js +0 -41
- package/dist/native/runtime-typescript.test.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,
|
|
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, 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";
|
|
@@ -66,15 +66,7 @@ export function jsOpenObjectType(decl, type, shapes, unions) {
|
|
|
66
66
|
? DYN
|
|
67
67
|
: type;
|
|
68
68
|
}
|
|
69
|
-
|
|
70
|
-
* values live in the embedded engine and map to island handles (jsval).
|
|
71
|
-
* Static fetch gives Response, RequestInit, AbortController/AbortSignal, response
|
|
72
|
-
* Headers, and the readable Web Streams slice native checked-dynamic
|
|
73
|
-
* handle representations. The Headers constructor itself remains
|
|
74
|
-
* dynamic-only even though response.headers is native.
|
|
75
|
-
* Declaration provenance is checked in mapType so user types with the
|
|
76
|
-
* same names keep their ordinary structural representation. */
|
|
77
|
-
export const ISLAND_AMBIENT_TYPES = [
|
|
69
|
+
export const FETCH_AMBIENT_TYPES = [
|
|
78
70
|
"Response",
|
|
79
71
|
"Request",
|
|
80
72
|
"ResponseInit",
|
|
@@ -91,17 +83,6 @@ export const ISLAND_AMBIENT_TYPES = [
|
|
|
91
83
|
"ReadableStreamReadValueResult",
|
|
92
84
|
"ReadableStreamReadDoneResult",
|
|
93
85
|
];
|
|
94
|
-
function isAmbientAbortHandleType(type, ctx) {
|
|
95
|
-
if (type.isUnionType())
|
|
96
|
-
return ts.constituentTypes(type).some((part) => isAmbientAbortHandleType(part, ctx));
|
|
97
|
-
const symbol = type.getSymbol();
|
|
98
|
-
return (!!symbol &&
|
|
99
|
-
(symbol.name === "AbortSignal" || symbol.name === "AbortController") &&
|
|
100
|
-
ctx.checker
|
|
101
|
-
.declarationsOf(symbol)
|
|
102
|
-
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
103
|
-
ctx.isStdlibFile(d.getSourceFile())));
|
|
104
|
-
}
|
|
105
86
|
/** node:util.parseArgs's public and @types/node helper type names. Values
|
|
106
87
|
* behind this surface use the checked-dynamic tree; see mapTypeInner. */
|
|
107
88
|
const PARSE_ARGS_DYN_TYPES = new Set([
|
|
@@ -640,8 +621,6 @@ export function formatIrType(t, shapes, unions, seen = new Set()) {
|
|
|
640
621
|
seen.delete(t.unionId);
|
|
641
622
|
}
|
|
642
623
|
}
|
|
643
|
-
case "jsval":
|
|
644
|
-
return append("any");
|
|
645
624
|
case "regex":
|
|
646
625
|
return append("RegExp");
|
|
647
626
|
case "date":
|
|
@@ -908,7 +887,7 @@ export function mapType(type, ctx) {
|
|
|
908
887
|
const topLevel = mapTypeDepth === 0;
|
|
909
888
|
const typeId = type.id;
|
|
910
889
|
const memoizable = typeId !== undefined && (ctx.canMemoizeType?.() ?? true);
|
|
911
|
-
const memoKey = memoizable ? `${
|
|
890
|
+
const memoKey = memoizable ? `${0}:${typeId}` : null;
|
|
912
891
|
if (memoKey !== null) {
|
|
913
892
|
const memo = ctx.typeMemo?.get(memoKey);
|
|
914
893
|
if (memo !== undefined)
|
|
@@ -945,11 +924,9 @@ function mapTypeInner(type, ctx) {
|
|
|
945
924
|
// TypeScript's intrinsic globalThis symbol has no declaration. A stored
|
|
946
925
|
// reference needs native object identity, including var's undefined state.
|
|
947
926
|
const intrinsic = type.getSymbol();
|
|
948
|
-
if (
|
|
949
|
-
intrinsic?.name === "globalThis" &&
|
|
950
|
-
checker.declarationsOf(intrinsic).length === 0)
|
|
927
|
+
if (intrinsic?.name === "globalThis" && checker.declarationsOf(intrinsic).length === 0)
|
|
951
928
|
return DYN;
|
|
952
|
-
|
|
929
|
+
{
|
|
953
930
|
const moduleId = ctx.moduleNamespaceId?.(type) ?? null;
|
|
954
931
|
if (moduleId !== null)
|
|
955
932
|
return { kind: "moduleNs", moduleId };
|
|
@@ -1159,12 +1136,10 @@ function mapTypeInner(type, ctx) {
|
|
|
1159
1136
|
// (the Object.prototype surface) fence at their use sites.
|
|
1160
1137
|
if (flags & ts.TypeFlags.NonPrimitive)
|
|
1161
1138
|
return DYN;
|
|
1162
|
-
// `any`
|
|
1163
|
-
//
|
|
1164
|
-
// per-site diagnostic tells the user about --dynamic and the static
|
|
1165
|
-
// alternative (`unknown` + a checked cast).
|
|
1139
|
+
// Context-free `any` has no concrete storage shape. The lowering site
|
|
1140
|
+
// chooses checked-value storage when its operations support that boundary.
|
|
1166
1141
|
if (flags & ts.TypeFlags.Any)
|
|
1167
|
-
return
|
|
1142
|
+
return null;
|
|
1168
1143
|
// Enum types and enum member literal types: an enum VALUE at runtime IS
|
|
1169
1144
|
// its underlying primitive (tsc's own emit stores plain numbers/strings
|
|
1170
1145
|
// on the enum object; const enums inline them), so the enum type maps to
|
|
@@ -1199,23 +1174,10 @@ function mapTypeInner(type, ctx) {
|
|
|
1199
1174
|
return hasStr ? STRING : F64;
|
|
1200
1175
|
}
|
|
1201
1176
|
}
|
|
1202
|
-
//
|
|
1203
|
-
//
|
|
1204
|
-
//
|
|
1205
|
-
//
|
|
1206
|
-
// --dynamic they are island handles (jsval), and every operation on them
|
|
1207
|
-
// rides the engine ops with validated exits at typed boundaries.
|
|
1208
|
-
// Primitives/arrays/etc. REACHED THROUGH such types keep their
|
|
1209
|
-
// structural mapping (they were handled above or recurse normally); this
|
|
1210
|
-
// rule fires only when the type's own identity is declaration-file-
|
|
1211
|
-
// declared — interfaces, classes, type literals, and aliases from the
|
|
1212
|
-
// .d.ts. The standard library's declaration files are carved out (their
|
|
1213
|
-
// surfaces have static lowerings), as are declarations explicitly mapped
|
|
1214
|
-
// by --external-types: those describe project-owned structural data while
|
|
1215
|
-
// the Lowerer fences their imported runtime bindings. The program's own
|
|
1216
|
-
// compiled modules are never declaration files. Without --dynamic this
|
|
1217
|
-
// stays unmapped; badType reports the per-package requires-dynamic
|
|
1218
|
-
// diagnostic for node_modules types and the generic story otherwise.
|
|
1177
|
+
// Declaration-only package types have no compiled implementation.
|
|
1178
|
+
// Primitive and container types retain their structural mappings; types
|
|
1179
|
+
// owned by the standard library or explicit host mappings are handled
|
|
1180
|
+
// by their dedicated native rules.
|
|
1219
1181
|
const npmSym = widened.getAliasSymbol() ?? widened.getSymbol();
|
|
1220
1182
|
const npmDecls = npmSym ? checker.declarationsOf(npmSym) : undefined;
|
|
1221
1183
|
if (npmDecls &&
|
|
@@ -1224,22 +1186,17 @@ function mapTypeInner(type, ctx) {
|
|
|
1224
1186
|
const sf = d.getSourceFile();
|
|
1225
1187
|
return sf.isDeclarationFile && !ctx.isStdlibFile(sf) && !ctx.isExternalTypeFile(sf);
|
|
1226
1188
|
})) {
|
|
1227
|
-
return
|
|
1189
|
+
return null;
|
|
1228
1190
|
}
|
|
1229
|
-
// Module
|
|
1230
|
-
//
|
|
1231
|
-
// or supported builtin in a static build. Declaration-only package
|
|
1232
|
-
// namespaces retain the npm rule above; dynamic builds retain their
|
|
1233
|
-
// jsval import-handle path.
|
|
1191
|
+
// Module namespaces were claimed above when they name compiled source
|
|
1192
|
+
// modules or supported builtins. Declaration-only namespaces remain refused.
|
|
1234
1193
|
// T[]: monomorphic arrays, recursively (number[][] works). An element type
|
|
1235
1194
|
// that doesn't map (never from a context-free `[]`) makes the whole array
|
|
1236
1195
|
// unsupported — null propagates. Record/object/union elements ride the
|
|
1237
1196
|
// runtime's REF element kind (per-array RC entry points, the map-value
|
|
1238
1197
|
// technique), and PROMISE elements ride it too (Promise<T>[] is
|
|
1239
1198
|
// Promise.all's food: promises are refcounted, cycle-headered values
|
|
1240
|
-
// with `_v` adapters like any other ref element
|
|
1241
|
-
// JSON-serialize or cross the island boundary, which the safety
|
|
1242
|
-
// predicates already refuse). FUNCTION elements ride REF too (closure
|
|
1199
|
+
// with `_v` adapters like any other ref element). FUNCTION elements ride REF too (closure
|
|
1243
1200
|
// `_v` adapters + scr_closure_trace_v — closures are cycle-headered):
|
|
1244
1201
|
// `f === f` identity through indexOf/includes is sound because a
|
|
1245
1202
|
// function VALUE is one ScrClosure for its whole life — top-level
|
|
@@ -1260,17 +1217,6 @@ function mapTypeInner(type, ctx) {
|
|
|
1260
1217
|
// VOID mapping is a return-position artifact, not a value.
|
|
1261
1218
|
if (elem?.kind === "void" && isUnitOnlyTsType(elemTs, ctx.resolveTypeParam))
|
|
1262
1219
|
elem = unitOnlyUnion(unions);
|
|
1263
|
-
// A jsval element ABSORBS the array — with one carve-out. An array
|
|
1264
|
-
// type entangled with package-declared ('npm-jsval') elements
|
|
1265
|
-
// (`GeneratedFile[]`, `ModelMessage[]`) describes ISLAND values: the
|
|
1266
|
-
// handles those APIs produce are engine arrays, never the static
|
|
1267
|
-
// ScrArr this mapping would otherwise claim, so the whole array is
|
|
1268
|
-
// one handle and every operation on it is an engine op. The carve-out
|
|
1269
|
-
// is literal `any[]`: an EXPLICIT static array of dynamic values —
|
|
1270
|
-
// the messages-building pattern (`const content: any[] = []`) — which
|
|
1271
|
-
// keeps its static array-of-handles representation.
|
|
1272
|
-
if (elem?.kind === "jsval" && !(elemTs.flags & ts.TypeFlags.Any))
|
|
1273
|
-
return JSVAL;
|
|
1274
1220
|
if (!elem)
|
|
1275
1221
|
return null;
|
|
1276
1222
|
// A dyn ELEMENT makes the WHOLE array the checked-dynamic value:
|
|
@@ -1328,17 +1274,13 @@ function mapTypeInner(type, ctx) {
|
|
|
1328
1274
|
return arrayOf(unitOnlyUnion(unions));
|
|
1329
1275
|
if (tupleShape?.elementFlags === undefined)
|
|
1330
1276
|
return null;
|
|
1331
|
-
// Optional/rest elements
|
|
1332
|
-
// have no fixed shape — the ARITY is a runtime fact. Under --dynamic
|
|
1333
|
-
// the value lives in the engine, a real JS array carrying its true
|
|
1334
|
-
// length (reads, destructuring, JSON, .length all exact); static
|
|
1335
|
-
// builds stay unmapped and badType tells the dynamic-tier story.
|
|
1277
|
+
// Optional/rest elements have no fixed native tuple layout.
|
|
1336
1278
|
if (tupleShape.elementFlags.some((f) => !(f & ts.ElementFlags.Required))) {
|
|
1337
|
-
return
|
|
1279
|
+
return null;
|
|
1338
1280
|
}
|
|
1339
1281
|
const fields = [];
|
|
1340
1282
|
for (let i = 0; i < args.length; i++) {
|
|
1341
|
-
let et =
|
|
1283
|
+
let et = (args[i].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[i], ctx);
|
|
1342
1284
|
// A unit-only element (`[number, undefined]`) rides the unit-only
|
|
1343
1285
|
// union, the record-field rule.
|
|
1344
1286
|
if (et?.kind === "void" && isUnitOnlyTsType(args[i], ctx.resolveTypeParam))
|
|
@@ -1349,10 +1291,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1349
1291
|
// plumbing, values arrive dyn or convert via dynFrom.
|
|
1350
1292
|
if (!et || et.kind === "void")
|
|
1351
1293
|
return null;
|
|
1352
|
-
// A jsval member keeps this tuple in the island as a real JS array.
|
|
1353
1294
|
// Object records may instead keep ambient abort handles in slots.
|
|
1354
|
-
if (et.kind === "jsval")
|
|
1355
|
-
return JSVAL;
|
|
1356
1295
|
fields.push({ name: String(i), type: et });
|
|
1357
1296
|
}
|
|
1358
1297
|
fields.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
@@ -1770,7 +1709,6 @@ function mapTypeInner(type, ctx) {
|
|
|
1770
1709
|
// stdio and env values. Keep it checked-dynamic for native normalization.
|
|
1771
1710
|
if (isStdlibInterface("SpawnOptions"))
|
|
1772
1711
|
return DYN;
|
|
1773
|
-
// The fetch ambient slice: under --dynamic these are island handles
|
|
1774
1712
|
// exactly like npm-declared types. Static fetch has one deliberately
|
|
1775
1713
|
// narrower native representation: Response is an opaque checked-
|
|
1776
1714
|
// dynamic capsule consumed only by the Response method lowerings, and
|
|
@@ -1783,8 +1721,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1783
1721
|
// interfaces; @types/node's undici-types declares Response as a class).
|
|
1784
1722
|
{
|
|
1785
1723
|
const alias = widened.getAliasSymbol();
|
|
1786
|
-
if (
|
|
1787
|
-
alias?.name === "ReadableStreamReadResult" &&
|
|
1724
|
+
if (alias?.name === "ReadableStreamReadResult" &&
|
|
1788
1725
|
checker
|
|
1789
1726
|
.declarationsOf(alias)
|
|
1790
1727
|
.some((d) => ts.isTypeAliasDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
@@ -1795,8 +1732,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1795
1732
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
1796
1733
|
}
|
|
1797
1734
|
}
|
|
1798
|
-
if (
|
|
1799
|
-
psym &&
|
|
1735
|
+
if (psym &&
|
|
1800
1736
|
(psym.name === "ReadableStreamReadValueResult" ||
|
|
1801
1737
|
psym.name === "ReadableStreamReadDoneResult") &&
|
|
1802
1738
|
checker
|
|
@@ -1809,7 +1745,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1809
1745
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
1810
1746
|
}
|
|
1811
1747
|
if (psym &&
|
|
1812
|
-
|
|
1748
|
+
FETCH_AMBIENT_TYPES.includes(psym.name) &&
|
|
1813
1749
|
!(psym.name === "ReadableStream" &&
|
|
1814
1750
|
checker
|
|
1815
1751
|
.declarationsOf(psym)
|
|
@@ -1818,7 +1754,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1818
1754
|
.declarationsOf(psym)
|
|
1819
1755
|
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1820
1756
|
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1821
|
-
return
|
|
1757
|
+
return DYN;
|
|
1822
1758
|
}
|
|
1823
1759
|
// ReadonlyMap/ReadonlySet are the SAME runtime values as Map/Set — the
|
|
1824
1760
|
// readonly-ness is a checker-only view (no mutating members on the
|
|
@@ -1828,11 +1764,11 @@ function mapTypeInner(type, ctx) {
|
|
|
1828
1764
|
const args = checker.getTypeArguments(widened);
|
|
1829
1765
|
if (args.length !== 2)
|
|
1830
1766
|
return null;
|
|
1831
|
-
const key =
|
|
1767
|
+
const key = (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1832
1768
|
if (!key ||
|
|
1833
1769
|
!isSupportedMapKey(key, key.kind === "union" ? ctx.unions.get(key.unionId)?.arms : undefined))
|
|
1834
1770
|
return null;
|
|
1835
|
-
const value =
|
|
1771
|
+
const value = (args[1].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[1], ctx);
|
|
1836
1772
|
if (!value || !isSupportedMapValue(value))
|
|
1837
1773
|
return null;
|
|
1838
1774
|
return mapOf(key, value);
|
|
@@ -1840,7 +1776,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1840
1776
|
// Native WeakMap keeps reference identities in checked-dynamic storage.
|
|
1841
1777
|
// The runtime rejects reference kinds without a weak lifetime contract.
|
|
1842
1778
|
if (isStdlibInterface("WeakMap") || isStdlibInterface("WeakSet"))
|
|
1843
|
-
return
|
|
1779
|
+
return DYN;
|
|
1844
1780
|
// Set<T>: Map's sibling — same provenance rule and key domain.
|
|
1845
1781
|
// Anything else stays unmapped;
|
|
1846
1782
|
// the `new Set` lowering names the offending element type specifically.
|
|
@@ -1848,7 +1784,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1848
1784
|
const args = checker.getTypeArguments(widened);
|
|
1849
1785
|
if (args.length !== 1)
|
|
1850
1786
|
return null;
|
|
1851
|
-
const elem =
|
|
1787
|
+
const elem = (args[0].flags & ts.TypeFlags.Any) !== 0 ? DYN : mapType(args[0], ctx);
|
|
1852
1788
|
if (!elem ||
|
|
1853
1789
|
!isSupportedSetElem(elem, elem.kind === "union" ? ctx.unions.get(elem.unionId)?.arms : undefined))
|
|
1854
1790
|
return null;
|
|
@@ -2336,10 +2272,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2336
2272
|
// Promise<any> in a STATIC build (untyped JS entries: `new
|
|
2337
2273
|
// Promise((resolve) => ...)` infers any): the settled value rides the
|
|
2338
2274
|
// dyn arm exactly like Promise<unknown> — every use of the awaited
|
|
2339
|
-
// value is checked-dynamic, the same
|
|
2340
|
-
|
|
2341
|
-
// handle).
|
|
2342
|
-
if (arg.flags & ts.TypeFlags.Any && !ctx.dynamic)
|
|
2275
|
+
// value is checked-dynamic, the same checks `unknown` gets.
|
|
2276
|
+
if (arg.flags & ts.TypeFlags.Any)
|
|
2343
2277
|
return { kind: "promise", inner: DYN };
|
|
2344
2278
|
const inner = mapType(arg, ctx);
|
|
2345
2279
|
if (!inner)
|
|
@@ -2417,9 +2351,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2417
2351
|
}
|
|
2418
2352
|
// PromiseSettledResult<T>'s parts: the lib's PromiseFulfilledResult<T> /
|
|
2419
2353
|
// PromiseRejectedResult interfaces map to the documented HONEST SUBSET
|
|
2420
|
-
// record { status: string }
|
|
2421
|
-
// record-field representation here (void fields don't exist; a jsval
|
|
2422
|
-
// field would absorb the record), and the manual-allSettled pattern this
|
|
2354
|
+
// record { status: string }. The manual-allSettled pattern this
|
|
2423
2355
|
// mapping exists for (pMap) discards them. Construction literals still
|
|
2424
2356
|
// EVALUATE a dropped initializer for its effects — the awaited mapper —
|
|
2425
2357
|
// via the object-literal lowering's drop path. Both interfaces intern
|
|
@@ -2755,8 +2687,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2755
2687
|
return hybrid;
|
|
2756
2688
|
// Recursive and Symbol-keyed callable objects need their complete live
|
|
2757
2689
|
// property table; dropping those members into a plain closure loses data.
|
|
2758
|
-
if (
|
|
2759
|
-
checker.getCallSignatures(widened).length > 0 &&
|
|
2690
|
+
if (checker.getCallSignatures(widened).length > 0 &&
|
|
2760
2691
|
checker.getPropertiesOfType(widened).length > 0)
|
|
2761
2692
|
return DYN;
|
|
2762
2693
|
}
|
|
@@ -2790,7 +2721,6 @@ function mapTypeInner(type, ctx) {
|
|
|
2790
2721
|
for (const p of sig.getParameters()) {
|
|
2791
2722
|
const decl = checker.valueDeclarationOf(p);
|
|
2792
2723
|
const rest = decl !== undefined && ts.isParameter(decl) && decl.dotDotDotToken !== undefined;
|
|
2793
|
-
// JavaScript rest values retain the checked-dynamic/island runtime-
|
|
2794
2724
|
// arity ABI selected by lambdaSignature. Treating an inferred any[]
|
|
2795
2725
|
// declaration as a typed packed-array closure would bypass its boxed
|
|
2796
2726
|
// spread/error semantics and change coverage classification.
|
|
@@ -2837,7 +2767,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2837
2767
|
// Belt and braces for non-strict type worlds: an optional param's
|
|
2838
2768
|
// ABI slot is always the undefined-armed union (strictNullChecks
|
|
2839
2769
|
// already spells it that way; arm it here if the world didn't).
|
|
2840
|
-
if (optional && pt && pt.kind !== "void" && pt.kind !== "
|
|
2770
|
+
if (optional && pt && pt.kind !== "void" && pt.kind !== "dyn") {
|
|
2841
2771
|
const armed = withUndefinedArm(pt, ctx.unions);
|
|
2842
2772
|
if (!armed)
|
|
2843
2773
|
return null;
|
|
@@ -2866,7 +2796,7 @@ function mapTypeInner(type, ctx) {
|
|
|
2866
2796
|
const jsUnitReturn = sigDecl !== undefined &&
|
|
2867
2797
|
isJsSourceFile(sigDecl.getSourceFile()) &&
|
|
2868
2798
|
(retT.flags & (ts.TypeFlags.Null | ts.TypeFlags.Undefined)) !== 0;
|
|
2869
|
-
let ret = jsUnitReturn || (
|
|
2799
|
+
let ret = jsUnitReturn || (retT.flags & ts.TypeFlags.Any) !== 0
|
|
2870
2800
|
? DYN
|
|
2871
2801
|
: retT.flags & ts.TypeFlags.Never
|
|
2872
2802
|
? VOID
|
|
@@ -3068,24 +2998,7 @@ function mapTypeInner(type, ctx) {
|
|
|
3068
2998
|
continue;
|
|
3069
2999
|
}
|
|
3070
3000
|
const mapped = mapType(part, ctx);
|
|
3071
|
-
// A jsval PART absorbs the union: `GeneratedFile | undefined` (a
|
|
3072
|
-
// package-declared arm) is one island handle — the engine's
|
|
3073
|
-
// undefined/null ARE handle values, and any data sibling is
|
|
3074
|
-
// representable in the engine too, so the handle is the one
|
|
3075
|
-
// runtime representation. Exactly tsc's own collapse for `any | T`
|
|
3076
|
-
// (which never even reaches here as a union). Sibling arms that
|
|
3077
|
-
// already mapped don't matter — and ones that would NOT map on
|
|
3078
|
-
// their own don't block the absorb either: a STATIC value of such
|
|
3079
|
-
// an arm flowing in still fences per-site at the marshal
|
|
3080
|
-
// (jsvalIn's boundary message).
|
|
3081
|
-
if (mapped?.kind === "jsval")
|
|
3082
|
-
return JSVAL;
|
|
3083
3001
|
if (!mapped) {
|
|
3084
|
-
// Before failing the whole union, let a LATER jsval part absorb.
|
|
3085
|
-
for (const rest of ts.constituentTypes(widened)) {
|
|
3086
|
-
if (mapType(rest, ctx)?.kind === "jsval")
|
|
3087
|
-
return JSVAL;
|
|
3088
|
-
}
|
|
3089
3002
|
return null;
|
|
3090
3003
|
}
|
|
3091
3004
|
if (mapped.kind === "void") {
|
|
@@ -3131,10 +3044,8 @@ function mapTypeInner(type, ctx) {
|
|
|
3131
3044
|
// DYN WHOLESALE — the checked-dynamic tree's scalar kinds ARE the scalar arms (===,
|
|
3132
3045
|
// typeof, switch dispatch all exact), typeof/Array.isArray/unit
|
|
3133
3046
|
// narrowing on dyn already dispatches natively (dynTest +
|
|
3134
|
-
// maybeNarrow's validated scalar extraction),
|
|
3135
|
-
//
|
|
3136
|
-
// tag is ever needed and the component fence retires at these
|
|
3137
|
-
// sites. The domain is dynSubsumableUnionArm's: scalars, units, dyn
|
|
3047
|
+
// maybeNarrow's validated scalar extraction), so no union tag is
|
|
3048
|
+
// needed. The domain is dynSubsumableUnionArm's: scalars, units, dyn
|
|
3138
3049
|
// itself, and records/arrays inside the dynFrom conversion domain
|
|
3139
3050
|
// (those enter as dyn data — the deep-copy stance, so identity and
|
|
3140
3051
|
// mutation coupling with the source value end at the slot;
|
|
@@ -3543,11 +3454,6 @@ function mapBoundIndexedAccess(type, ctx) {
|
|
|
3543
3454
|
* (`{a?: string}` and `{a: string | undefined}` are ONE shape) — those stay
|
|
3544
3455
|
* unmapped inside generic bodies; their concrete uses resolve structurally
|
|
3545
3456
|
* through mapRecordType. */
|
|
3546
|
-
/** `Awaited<T>` where T is a STILL-GENERIC type parameter, resolved against
|
|
3547
|
-
* the lowerer's binding: promise kinds unwrap recursively (the alias's own
|
|
3548
|
-
* recursion), everything else is already its awaited self — including
|
|
3549
|
-
* jsval (the engine's await handles thenables natively). Null off the
|
|
3550
|
-
* shape (not the lib's Awaited over a bound parameter). */
|
|
3551
3457
|
/** True for a TypeNode spelling the `const` assertion (`e as const`). */
|
|
3552
3458
|
export function isConstAssertionTypeNode(t) {
|
|
3553
3459
|
return (t.kind === ts.SyntaxKind.TypeReference &&
|
|
@@ -3751,7 +3657,7 @@ export function genResultRecord(yieldT, retT, shapes, unions) {
|
|
|
3751
3657
|
byKey.set(typeKey(a), a);
|
|
3752
3658
|
return true;
|
|
3753
3659
|
}
|
|
3754
|
-
if (t.kind === "regex" || t.kind === "date" || t.kind === "
|
|
3660
|
+
if (t.kind === "regex" || t.kind === "date" || t.kind === "generator") {
|
|
3755
3661
|
return false; // no legal union arm exists for these kinds
|
|
3756
3662
|
}
|
|
3757
3663
|
byKey.set(typeKey(t), t);
|
|
@@ -3809,8 +3715,6 @@ export function withUndefinedArm(t, unions) {
|
|
|
3809
3715
|
/** Preserve a nullish runtime value that JavaScript inference omitted. */
|
|
3810
3716
|
export function withUnitArm(t, kind, unions) {
|
|
3811
3717
|
const unit = { kind };
|
|
3812
|
-
if (t.kind === "jsval")
|
|
3813
|
-
return t;
|
|
3814
3718
|
if (t.kind === "union") {
|
|
3815
3719
|
const def = unions.get(t.unionId);
|
|
3816
3720
|
if (!def)
|
|
@@ -3878,8 +3782,7 @@ function mapHybridCallableIntersection(widened, ctx) {
|
|
|
3878
3782
|
if (p.flags & (ts.SymbolFlags.GetAccessor | ts.SymbolFlags.SetAccessor))
|
|
3879
3783
|
return null;
|
|
3880
3784
|
const pt = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
3881
|
-
|
|
3882
|
-
if (!pt || pt.kind === "void" || pt.kind === "jsval")
|
|
3785
|
+
if (!pt || pt.kind === "void")
|
|
3883
3786
|
return null;
|
|
3884
3787
|
fields.push({ name: p.name, type: pt });
|
|
3885
3788
|
declaredOrder.push(p.name);
|
|
@@ -4163,11 +4066,10 @@ function mapRecordType(widened, ctx) {
|
|
|
4163
4066
|
if (inner === null)
|
|
4164
4067
|
return null; // a pending placeholder, if minted, stays unfinalized (prunes as unreachable)
|
|
4165
4068
|
if (!("fields" in inner)) {
|
|
4166
|
-
// A whole-type answer (the jsval/dyn absorbs, the header-family
|
|
4167
4069
|
// canonical shape). If a back-reference minted a placeholder for
|
|
4168
4070
|
// this very type meanwhile, the two answers disagree — fence rather
|
|
4169
4071
|
// than leave references to a shape that is not this type's mapping.
|
|
4170
|
-
if (shapes.recursivePending(widened) && inner.kind !== "
|
|
4072
|
+
if (shapes.recursivePending(widened) && inner.kind !== "dyn")
|
|
4171
4073
|
return null;
|
|
4172
4074
|
return inner;
|
|
4173
4075
|
}
|
|
@@ -4294,12 +4196,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4294
4196
|
if (!stringKey(info.keyType) && !(info.keyType.flags & ts.TypeFlags.Number))
|
|
4295
4197
|
return null;
|
|
4296
4198
|
const iv = mapType(info.valueType, ctx);
|
|
4297
|
-
// A jsval-valued signature absorbs the shape: `Record<string,
|
|
4298
4199
|
// JSONValue>` (a package's own JSON alias) and `Record<string, any>`
|
|
4299
|
-
// are one island object — the overflow map has no handle slot, and
|
|
4300
|
-
// island objects hold arbitrary engine values natively.
|
|
4301
|
-
if (iv?.kind === "jsval")
|
|
4302
|
-
return JSVAL;
|
|
4303
4200
|
if (!iv || !isSupportedIndexValue(iv))
|
|
4304
4201
|
return null;
|
|
4305
4202
|
if (v !== null && !typeEquals(v, iv))
|
|
@@ -4463,7 +4360,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4463
4360
|
let readT = null;
|
|
4464
4361
|
if (getDecl) {
|
|
4465
4362
|
readT = mapType(checker.getTypeOfSymbol(p), ctx);
|
|
4466
|
-
if (readT === null
|
|
4363
|
+
if (readT === null)
|
|
4467
4364
|
return null;
|
|
4468
4365
|
}
|
|
4469
4366
|
let writeT = null;
|
|
@@ -4475,10 +4372,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4475
4372
|
// A void/unit-typed write slot has no value form; DIVERGENT
|
|
4476
4373
|
// getter/setter types stay out too (one property, one type —
|
|
4477
4374
|
// the class-accessor stance).
|
|
4478
|
-
if (writeT === null ||
|
|
4479
|
-
writeT.kind === "void" ||
|
|
4480
|
-
writeT.kind === "jsval" ||
|
|
4481
|
-
isUnitType(writeT))
|
|
4375
|
+
if (writeT === null || writeT.kind === "void" || isUnitType(writeT))
|
|
4482
4376
|
return null;
|
|
4483
4377
|
if (readT !== null && typeKey(readT) !== typeKey(writeT))
|
|
4484
4378
|
return null;
|
|
@@ -4515,12 +4409,12 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4515
4409
|
// initializer is an EMPTY array literal inside a const assertion IS
|
|
4516
4410
|
// the empty tuple — map it exactly as the tuple branch does (the
|
|
4517
4411
|
// unit-element array; see the `[] as const` rule there).
|
|
4518
|
-
if (
|
|
4412
|
+
if (pt === null &&
|
|
4519
4413
|
(fieldTs.flags & ts.TypeFlags.Any) !== 0 &&
|
|
4520
4414
|
constAssertedEmptyArrayProp(p, ctx)) {
|
|
4521
4415
|
pt = arrayOf(unitOnlyUnion(ctx.unions));
|
|
4522
4416
|
}
|
|
4523
|
-
if (pt === null &&
|
|
4417
|
+
if (pt === null && (fieldTs.flags & ts.TypeFlags.Any) !== 0)
|
|
4524
4418
|
pt = DYN;
|
|
4525
4419
|
// Unit-only FIELDS (`{ msg?: undefined }` — the discriminated-union
|
|
4526
4420
|
// absent-field idiom — and `{ p: undefined }` spellings): the
|
|
@@ -4540,12 +4434,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4540
4434
|
// accessor dispatch, so the shape stays unmapped.
|
|
4541
4435
|
if (accessorSlotProp(p.name) !== null)
|
|
4542
4436
|
return null;
|
|
4543
|
-
// Keep ambient abort handles in a native record slot under --dynamic:
|
|
4544
4437
|
// an options record with `signal?: AbortSignal` must not turn its
|
|
4545
|
-
// unrelated static fields into island properties. Other bare jsval
|
|
4546
|
-
// fields still absorb the record into one island object.
|
|
4547
|
-
if (pt.kind === "jsval" && !(ctx.dynamic && isAmbientAbortHandleType(fieldTs, ctx)))
|
|
4548
|
-
return JSVAL;
|
|
4549
4438
|
fields.push({ name: p.name, type: pt });
|
|
4550
4439
|
}
|
|
4551
4440
|
// getPropertiesOfType yields DECLARATION order (interface/alias/literal
|