@scriptc/compiler 0.3.1 → 0.3.3
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 +832 -55
- package/dist/backend/cycle-analysis.js +6 -1
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/executable-features.js +1 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/literals.d.ts +7 -0
- package/dist/backend/literals.js +32 -0
- package/dist/backend/literals.js.map +1 -1
- package/dist/backend/literals.test.js +17 -1
- package/dist/backend/literals.test.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +15 -4
- package/dist/backend/llvm/alloc.js +63 -25
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +62 -2
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- package/dist/backend/llvm/appended-array-literals.d.ts +2 -0
- package/dist/backend/llvm/appended-array-literals.js +109 -0
- package/dist/backend/llvm/appended-array-literals.js.map +1 -0
- package/dist/backend/llvm/appended-array-literals.test.d.ts +1 -0
- package/dist/backend/llvm/appended-array-literals.test.js +90 -0
- package/dist/backend/llvm/appended-array-literals.test.js.map +1 -0
- package/dist/backend/llvm/array-search.d.ts +8 -0
- package/dist/backend/llvm/array-search.js +52 -0
- package/dist/backend/llvm/array-search.js.map +1 -0
- package/dist/backend/llvm/array-search.test.d.ts +1 -0
- package/dist/backend/llvm/array-search.test.js +72 -0
- package/dist/backend/llvm/array-search.test.js.map +1 -0
- package/dist/backend/llvm/call-lifetimes.d.ts +11 -1
- package/dist/backend/llvm/call-lifetimes.js +74 -4
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +54 -0
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/classes.js +97 -38
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +2 -2
- package/dist/backend/llvm/common.d.ts +1 -1
- package/dist/backend/llvm/common.js +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +5 -0
- package/dist/backend/llvm/dense-array-access.js +18 -13
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +15 -2
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +6 -0
- package/dist/backend/llvm/dyn.js +84 -11
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +108 -16
- package/dist/backend/llvm/emitter.js +598 -108
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +26 -3
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +174 -7
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.js +11 -0
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.d.ts +8 -0
- package/dist/backend/llvm/expr-callbacks.js +96 -2
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +12 -1
- package/dist/backend/llvm/expr-calls.js +133 -54
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +7 -0
- package/dist/backend/llvm/expr-containers.js +80 -22
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +2 -0
- package/dist/backend/llvm/expr-control.d.ts +8 -0
- package/dist/backend/llvm/expr-control.js +103 -69
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +21 -10
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +7 -0
- package/dist/backend/llvm/expr-primitives.js +53 -51
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +19 -5
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +8 -0
- package/dist/backend/llvm/expr-stream-bridges.js +111 -39
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js +49 -1
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +13 -2
- package/dist/backend/llvm/expr-stream-callbacks.js +80 -5
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/inline-unions.d.ts +48 -0
- package/dist/backend/llvm/inline-unions.js +134 -0
- package/dist/backend/llvm/inline-unions.js.map +1 -0
- package/dist/backend/llvm/inline-unions.test.d.ts +1 -0
- package/dist/backend/llvm/inline-unions.test.js +124 -0
- package/dist/backend/llvm/inline-unions.test.js.map +1 -0
- package/dist/backend/llvm/int32-abi.d.ts +18 -2
- package/dist/backend/llvm/int32-abi.js +23 -2
- package/dist/backend/llvm/int32-abi.js.map +1 -1
- package/dist/backend/llvm/int32-abi.test.js +75 -1
- package/dist/backend/llvm/int32-abi.test.js.map +1 -1
- package/dist/backend/llvm/integer-remainder.d.ts +28 -5
- package/dist/backend/llvm/integer-remainder.js +80 -9
- package/dist/backend/llvm/integer-remainder.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +170 -28
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +181 -5
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +9 -6
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +2 -2
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +208 -9
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +97 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +12 -6
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +6 -3
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.d.ts +26 -2
- package/dist/backend/llvm/local-union-storage.js +132 -12
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +107 -1
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-array-borrows.d.ts +8 -2
- package/dist/backend/llvm/loop-array-borrows.js +93 -13
- package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +20 -0
- package/dist/backend/llvm/map-number-lookup.js +66 -0
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.d.ts +1 -0
- package/dist/backend/llvm/map-number-lookup.test.js +102 -0
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.js +1 -0
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +4 -0
- package/dist/backend/llvm/publish.js +3 -1
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/record-results.d.ts +29 -0
- package/dist/backend/llvm/record-results.js +260 -0
- package/dist/backend/llvm/record-results.js.map +1 -0
- package/dist/backend/llvm/reference-effects.js +15 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +29 -9
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regions.d.ts +68 -0
- package/dist/backend/llvm/regions.js +314 -0
- package/dist/backend/llvm/regions.js.map +1 -0
- package/dist/backend/llvm/regions.test.d.ts +1 -0
- package/dist/backend/llvm/regions.test.js +173 -0
- package/dist/backend/llvm/regions.test.js.map +1 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js +2 -0
- package/dist/backend/llvm/serialized-ir-emission.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +86 -13
- package/dist/backend/llvm/shapes.js +208 -54
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +68 -9
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/split-loops.js +1 -1
- package/dist/backend/llvm/split-loops.js.map +1 -1
- package/dist/backend/llvm/stack-objects.d.ts +29 -0
- package/dist/backend/llvm/stack-objects.js +142 -0
- package/dist/backend/llvm/stack-objects.js.map +1 -0
- package/dist/backend/llvm/stack-objects.test.d.ts +1 -0
- package/dist/backend/llvm/stack-objects.test.js +255 -0
- package/dist/backend/llvm/stack-objects.test.js.map +1 -0
- package/dist/backend/llvm/string-reads.d.ts +4 -1
- package/dist/backend/llvm/string-reads.js +89 -9
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/switch-dispatch.js +5 -4
- package/dist/backend/llvm/switch-dispatch.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +13 -0
- package/dist/backend/llvm/walkers.js +108 -10
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/may-throw.js +10 -4
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +7 -2
- package/dist/backend/native/executable.js +28 -2
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +1 -1
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +3 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +1 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +1 -1
- package/dist/backend/native-toolchain.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 +1 -0
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack.test.js +1 -1
- package/dist/backend/target-diagnostics.js +17 -0
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +16 -0
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/compat/fetch-profile.js +4 -4
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/contracts/check.js +2 -0
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.js +1 -1
- package/dist/coverage/report.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +6 -5
- package/dist/diagnostics/diagnostic.js +7 -6
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +1 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/frontend/builtin-modules.d.ts +1 -1
- package/dist/frontend/builtin-modules.js +1 -0
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/comptime-node.js +2 -2
- package/dist/frontend/comptime-node.js.map +1 -1
- package/dist/frontend/experimental-import.d.ts +12 -0
- package/dist/frontend/experimental-import.js +63 -0
- package/dist/frontend/experimental-import.js.map +1 -0
- package/dist/frontend/lowering/binding-analysis.d.ts +1 -1
- package/dist/frontend/lowering/binding-analysis.js +1 -1
- package/dist/frontend/lowering/builtin-calls.d.ts +6 -1
- package/dist/frontend/lowering/builtin-calls.js +36 -0
- package/dist/frontend/lowering/builtin-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/arguments.d.ts +4 -0
- package/dist/frontend/lowering/builtins/arguments.js +8 -4
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/blob.d.ts +20 -0
- package/dist/frontend/lowering/builtins/blob.js +167 -0
- package/dist/frontend/lowering/builtins/blob.js.map +1 -0
- package/dist/frontend/lowering/builtins/child-process-async.d.ts +2 -2
- package/dist/frontend/lowering/builtins/child-process-async.js +2 -2
- package/dist/frontend/lowering/builtins/child-process-methods.js +1 -1
- package/dist/frontend/lowering/builtins/child-process-methods.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.js +3 -2
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/console.d.ts +16 -6
- package/dist/frontend/lowering/builtins/console.js +33 -9
- package/dist/frontend/lowering/builtins/console.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.js +415 -120
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.js +20 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +10 -0
- package/dist/frontend/lowering/builtins/filesystem-calls.js +89 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.d.ts +16 -7
- package/dist/frontend/lowering/builtins/filesystem.js +97 -15
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-glob.d.ts +23 -0
- package/dist/frontend/lowering/builtins/fs-glob.js +224 -0
- package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -0
- package/dist/frontend/lowering/builtins/json.d.ts +2 -2
- package/dist/frontend/lowering/builtins/json.js +13 -4
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/key-object.d.ts +13 -0
- package/dist/frontend/lowering/builtins/key-object.js +56 -0
- package/dist/frontend/lowering/builtins/key-object.js.map +1 -0
- package/dist/frontend/lowering/builtins/module-calls.js +60 -12
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.d.ts +1 -0
- package/dist/frontend/lowering/builtins/numbers.js +17 -0
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/operating-system.d.ts +18 -0
- package/dist/frontend/lowering/builtins/operating-system.js +361 -1
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.d.ts +25 -3
- package/dist/frontend/lowering/builtins/performance.js +340 -5
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +2 -2
- package/dist/frontend/lowering/builtins/process.js +122 -17
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +109 -2
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/properties.d.ts +0 -7
- package/dist/frontend/lowering/builtins/properties.js +39 -11
- package/dist/frontend/lowering/builtins/properties.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +23 -8
- package/dist/frontend/lowering/builtins/readline.js +266 -90
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/text-codecs.d.ts +3 -4
- package/dist/frontend/lowering/builtins/text-codecs.js +3 -4
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
- package/dist/frontend/lowering/builtins/url.d.ts +8 -0
- package/dist/frontend/lowering/builtins/url.js +36 -0
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +1 -1
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +20 -2
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/checked-promise-all.d.ts +10 -3
- package/dist/frontend/lowering/checked-promise-all.js +52 -6
- package/dist/frontend/lowering/checked-promise-all.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +8 -3
- package/dist/frontend/lowering/class-dynamic-dispatch.js +159 -32
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-protocol-dispatch.d.ts +45 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js +516 -0
- package/dist/frontend/lowering/class-protocol-dispatch.js.map +1 -0
- package/dist/frontend/lowering/coercions/structural-plans.js +2 -1
- package/dist/frontend/lowering/coercions/structural-plans.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +3 -3
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/collation-repertoire.js +6 -5
- package/dist/frontend/lowering/collation-repertoire.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.js +33 -6
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +8 -4
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.d.ts +0 -7
- package/dist/frontend/lowering/containers/array-methods.js +43 -2
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.js +38 -26
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/for-of.d.ts +1 -1
- package/dist/frontend/lowering/containers/for-of.js +5 -1
- package/dist/frontend/lowering/containers/for-of.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js +91 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/crypto-tables.d.ts +3 -3
- package/dist/frontend/lowering/crypto-tables.js +77 -12
- package/dist/frontend/lowering/crypto-tables.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.d.ts +18 -2
- package/dist/frontend/lowering/cycle-initialization.js +166 -12
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +7 -2
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.test.js +28 -0
- package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
- package/dist/frontend/lowering/expressions/nullish-assignment.js +10 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +21 -68
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/generator-delegation.d.ts +8 -0
- package/dist/frontend/lowering/generator-delegation.js +231 -10
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +2 -2
- package/dist/frontend/lowering/generic-functions.js +2 -2
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/http2-constants.js +1 -1
- package/dist/frontend/lowering/lifetime-regions.d.ts +11 -0
- package/dist/frontend/lowering/lifetime-regions.js +216 -0
- package/dist/frontend/lowering/lifetime-regions.js.map +1 -0
- package/dist/frontend/lowering/lower-array-sort.d.ts +40 -3
- package/dist/frontend/lowering/lower-array-sort.js +661 -194
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +103 -4
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +2 -2
- package/dist/frontend/lowering/lower-async-iteration.d.ts +6 -3
- package/dist/frontend/lowering/lower-async-iteration.js +248 -2
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +173 -111
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +12 -5
- package/dist/frontend/lowering/lower-classes.js +156 -11
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +1 -1
- package/dist/frontend/lowering/lower-comptime.js +4 -4
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-console.d.ts +13 -0
- package/dist/frontend/lowering/lower-console.js +460 -4
- package/dist/frontend/lowering/lower-console.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +6 -0
- package/dist/frontend/lowering/lower-event-emitter.js +124 -38
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-event-target.d.ts +63 -0
- package/dist/frontend/lowering/lower-event-target.js +362 -0
- package/dist/frontend/lowering/lower-event-target.js.map +1 -0
- package/dist/frontend/lowering/lower-expando.js +2 -2
- package/dist/frontend/lowering/lower-exprs.js +247 -42
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +15 -7
- package/dist/frontend/lowering/lower-generators.js +183 -99
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +8 -1
- package/dist/frontend/lowering/lower-inspect.js +247 -28
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +1 -1
- package/dist/frontend/lowering/lower-modules.js +27 -17
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +2 -2
- package/dist/frontend/lowering/lower-namespaces.js +2 -2
- package/dist/frontend/lowering/lower-server.js +39 -14
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +11 -1
- package/dist/frontend/lowering/lower-stdlib.js +45 -4
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +2 -2
- package/dist/frontend/lowering/lower-stmts.js +112 -23
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +234 -22
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +45 -6
- package/dist/frontend/lowering/lowerer.js +360 -48
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.js +2 -2
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/regex-span-reads.d.ts +12 -0
- package/dist/frontend/lowering/regex-span-reads.js +164 -0
- package/dist/frontend/lowering/regex-span-reads.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-records.d.ts +115 -0
- package/dist/frontend/lowering/runtime-optional-records.js +715 -0
- package/dist/frontend/lowering/runtime-optional-records.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-records.test.d.ts +1 -0
- package/dist/frontend/lowering/runtime-optional-records.test.js +175 -0
- package/dist/frontend/lowering/runtime-optional-records.test.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +7 -3
- package/dist/frontend/lowering/surfaces.js +385 -32
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/var-hoisting.d.ts +3 -0
- package/dist/frontend/lowering/var-hoisting.js +261 -0
- package/dist/frontend/lowering/var-hoisting.js.map +1 -0
- package/dist/frontend/module-syntax.d.ts +1 -1
- package/dist/frontend/module-syntax.js +1 -1
- package/dist/frontend/npm-static-prune.js +1 -1
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-syntax.js +4 -3
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -1
- package/dist/frontend/pipeline.js +6 -4
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program.d.ts +6 -5
- package/dist/frontend/program.js +42 -22
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +13 -0
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/resolve.js +1 -1
- package/dist/frontend/ts7/adapter.js +1 -1
- package/dist/frontend/ts7/ast-bytes.d.ts +1 -1
- package/dist/frontend/ts7/ast-bytes.js +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +1 -1
- package/dist/frontend/ts7/semantic-json.js +1 -1
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/world-check.js +1 -1
- package/dist/frontend/tsc-codes.js +2 -2
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +28 -1
- package/dist/frontend/type-mapper.js +288 -30
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +12 -6
- package/dist/ir/analysis.js +26 -10
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +15 -3
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/builtin-effects.js +108 -2
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +436 -53
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/function-references.test.js +1 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/int32-slots.js +2 -0
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/intrinsic-signatures.js +2 -0
- package/dist/ir/intrinsic-signatures.js.map +1 -1
- package/dist/ir/ir.d.ts +129 -36
- package/dist/ir/ir.js +42 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +1 -0
- package/dist/ir/runtime-features.js +116 -5
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.js +1 -2
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/serialize.js +1 -1
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/traverse.js +1 -0
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +250 -34
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +125 -0
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/fence-eval.d.ts +1 -1
- package/dist/library/fence-eval.js +5 -4
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/ir-policy.js +11 -4
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-profile.js +13 -13
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.js +1 -1
- package/dist/library/prepare.js.map +1 -1
- package/dist/library/sidecar.js +3 -3
- package/dist/library/sidecar.js.map +1 -1
- package/dist/native/prepare.js +3 -2
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +1 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +537 -142
|
@@ -72,7 +72,12 @@ export const FETCH_AMBIENT_TYPES = [
|
|
|
72
72
|
"ResponseInit",
|
|
73
73
|
"RequestInit",
|
|
74
74
|
"Event",
|
|
75
|
+
"CustomEvent",
|
|
75
76
|
"EventTarget",
|
|
77
|
+
"AddEventListenerOptions",
|
|
78
|
+
"EventListenerOptions",
|
|
79
|
+
"EventInit",
|
|
80
|
+
"CustomEventInit",
|
|
76
81
|
"AbortController",
|
|
77
82
|
"AbortSignal",
|
|
78
83
|
"Headers",
|
|
@@ -82,10 +87,20 @@ export const FETCH_AMBIENT_TYPES = [
|
|
|
82
87
|
"ReadableStreamReadResult",
|
|
83
88
|
"ReadableStreamReadValueResult",
|
|
84
89
|
"ReadableStreamReadDoneResult",
|
|
90
|
+
"Blob",
|
|
91
|
+
"File",
|
|
92
|
+
"BlobPropertyBag",
|
|
93
|
+
"FilePropertyBag",
|
|
94
|
+
"BlobOptions",
|
|
95
|
+
"FileOptions",
|
|
85
96
|
];
|
|
86
|
-
/** node:util.parseArgs's public and @types/node helper type names
|
|
97
|
+
/** node:util.parseArgs's public and @types/node helper type names, plus
|
|
98
|
+
* util.debuglog's DebugLogger (a native function value with an `enabled`
|
|
99
|
+
* accessor) and the DebugLoggerFunction its callback receives. Values
|
|
87
100
|
* behind this surface use the checked-dynamic tree; see mapTypeInner. */
|
|
88
101
|
const PARSE_ARGS_DYN_TYPES = new Set([
|
|
102
|
+
"DebugLogger",
|
|
103
|
+
"DebugLoggerFunction",
|
|
89
104
|
"ParseArgsConfig",
|
|
90
105
|
"ParseArgsOptionDescriptor",
|
|
91
106
|
"ParseArgsOptionsConfig",
|
|
@@ -637,6 +652,8 @@ export function formatIrType(t, shapes, unions, seen = new Set()) {
|
|
|
637
652
|
return append("Stats");
|
|
638
653
|
case "fileHandle":
|
|
639
654
|
return append("FileHandle");
|
|
655
|
+
case "dir":
|
|
656
|
+
return append("Dir");
|
|
640
657
|
case "spawnRes":
|
|
641
658
|
return append("SpawnSyncReturns");
|
|
642
659
|
case "child":
|
|
@@ -712,6 +729,34 @@ function esOwnKeyOrder(names) {
|
|
|
712
729
|
const indices = names.filter(isArrayIndex).sort((a, b) => Number(a) - Number(b));
|
|
713
730
|
return indices.length === 0 ? names : [...indices, ...names.filter((n) => !isArrayIndex(n))];
|
|
714
731
|
}
|
|
732
|
+
/** The hidden field that marks the perf_hooks entry record shape. */
|
|
733
|
+
export const PERF_ENTRY_MARKER = "%perfEntry";
|
|
734
|
+
/** PerformanceEntry's toJSON fields, in toJSON's order. */
|
|
735
|
+
export const PERF_ENTRY_FIELDS = ["name", "entryType", "startTime", "duration", "detail"];
|
|
736
|
+
/** The record shape behind PerformanceEntry, PerformanceMark and
|
|
737
|
+
* PerformanceMeasure values (see mapType). The marker is an always-absent
|
|
738
|
+
* optional, so dyn conversions and key walks never see it. */
|
|
739
|
+
export function perfEntryShape(shapes, unions) {
|
|
740
|
+
return shapes.intern([
|
|
741
|
+
{ name: PERF_ENTRY_MARKER, type: withUndefinedArm(F64, unions) },
|
|
742
|
+
{ name: "detail", type: DYN },
|
|
743
|
+
{ name: "duration", type: F64 },
|
|
744
|
+
{ name: "entryType", type: STRING },
|
|
745
|
+
{ name: "name", type: STRING },
|
|
746
|
+
{ name: "startTime", type: F64 },
|
|
747
|
+
], false, undefined, PERF_ENTRY_FIELDS);
|
|
748
|
+
}
|
|
749
|
+
/** toJSON()'s plain object over an entry: the same fields without the
|
|
750
|
+
* marker. */
|
|
751
|
+
export function perfEntryJsonShape(shapes) {
|
|
752
|
+
return shapes.intern([
|
|
753
|
+
{ name: "detail", type: DYN },
|
|
754
|
+
{ name: "duration", type: F64 },
|
|
755
|
+
{ name: "entryType", type: STRING },
|
|
756
|
+
{ name: "name", type: STRING },
|
|
757
|
+
{ name: "startTime", type: F64 },
|
|
758
|
+
], false, undefined, PERF_ENTRY_FIELDS);
|
|
759
|
+
}
|
|
715
760
|
function isDeclaredInAmbientModule(d, name) {
|
|
716
761
|
let node = d.parent;
|
|
717
762
|
while (node) {
|
|
@@ -840,6 +885,77 @@ let mapTypeDepth = 0;
|
|
|
840
885
|
* a bump between entry and exit stays fenced (recursive generic-open types
|
|
841
886
|
* stay fenced instead of interning a per-context-wrong shape). */
|
|
842
887
|
let contextResolutions = 0;
|
|
888
|
+
/** node:url's legacy record interfaces: url.parse()'s Url instance (and
|
|
889
|
+
* its two query-typed refinements), url.format()'s UrlObject input, and the
|
|
890
|
+
* URL form's URLFormatOptions. The values are checked-dynamic objects —
|
|
891
|
+
* Node's Url instance carries its class name and null fields, and format()
|
|
892
|
+
* reads any object's fields with JS truthiness. */
|
|
893
|
+
const LEGACY_URL_TYPES = new Set([
|
|
894
|
+
"Url",
|
|
895
|
+
"UrlObject",
|
|
896
|
+
"UrlWithParsedQuery",
|
|
897
|
+
"UrlWithStringQuery",
|
|
898
|
+
"URLFormatOptions",
|
|
899
|
+
]);
|
|
900
|
+
export function isLegacyUrlType(type, ctx) {
|
|
901
|
+
const symbol = type.getAliasSymbol() ?? type.getSymbol();
|
|
902
|
+
return isLegacyUrlSymbol(symbol, ctx);
|
|
903
|
+
}
|
|
904
|
+
/** A symbol declared as one of node:url's legacy record interfaces, or as
|
|
905
|
+
* a member of one. */
|
|
906
|
+
export function isLegacyUrlSymbol(symbol, ctx) {
|
|
907
|
+
if (!symbol)
|
|
908
|
+
return false;
|
|
909
|
+
for (const d of ctx.checker.declarationsOf(symbol)) {
|
|
910
|
+
if (!ctx.isStdlibFile(d.getSourceFile()))
|
|
911
|
+
continue;
|
|
912
|
+
let family = false;
|
|
913
|
+
for (let n = d; n; n = n.parent) {
|
|
914
|
+
if (ts.isInterfaceDeclaration(n) && LEGACY_URL_TYPES.has(n.name.text))
|
|
915
|
+
family = true;
|
|
916
|
+
if (ts.isModuleDeclaration(n) && ts.isStringLiteral(n.name)) {
|
|
917
|
+
if (family && (n.name.text === "url" || n.name.text === "node:url"))
|
|
918
|
+
return true;
|
|
919
|
+
break;
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
return false;
|
|
924
|
+
}
|
|
925
|
+
/** os.constants and its groups — @types/node's `namespace constants`
|
|
926
|
+
* (errno, dlopen, priority) and SignalConstants, and the fallback's twins:
|
|
927
|
+
* the runtime's checked-dynamic constants object, whose members vary by
|
|
928
|
+
* platform. */
|
|
929
|
+
export function isOsConstantsType(type, ctx) {
|
|
930
|
+
return (isOsConstantsSymbol(type.getAliasSymbol(), ctx, true) ||
|
|
931
|
+
isOsConstantsSymbol(type.getSymbol(), ctx, true));
|
|
932
|
+
}
|
|
933
|
+
/** A symbol declared as os.constants or one of its groups (a namespace, or
|
|
934
|
+
* with `types`, the SignalConstants alias; without it, the `signals`
|
|
935
|
+
* constant). The binding-symbol form needs no type query. */
|
|
936
|
+
export function isOsConstantsSymbol(symbol, ctx, types = false) {
|
|
937
|
+
if (!symbol)
|
|
938
|
+
return false;
|
|
939
|
+
for (const d of ctx.checker.declarationsOf(symbol)) {
|
|
940
|
+
const alias = types && ts.isTypeAliasDeclaration(d) && d.name.text === "SignalConstants";
|
|
941
|
+
const signals = !types && ts.isVariableDeclaration(d) && ts.isIdentifier(d.name) && d.name.text === "signals";
|
|
942
|
+
if (!(alias || signals || ts.isModuleDeclaration(d)) || !ctx.isStdlibFile(d.getSourceFile()))
|
|
943
|
+
continue;
|
|
944
|
+
let inConstants = ts.isModuleDeclaration(d) && d.name.text === "constants";
|
|
945
|
+
for (let n = d.parent; n; n = n.parent) {
|
|
946
|
+
if (!ts.isModuleDeclaration(n))
|
|
947
|
+
continue;
|
|
948
|
+
if (ts.isStringLiteral(n.name)) {
|
|
949
|
+
if ((n.name.text === "os" || n.name.text === "node:os") && (alias || inConstants))
|
|
950
|
+
return true;
|
|
951
|
+
break;
|
|
952
|
+
}
|
|
953
|
+
if (n.name.text === "constants")
|
|
954
|
+
inConstants = true;
|
|
955
|
+
}
|
|
956
|
+
}
|
|
957
|
+
return false;
|
|
958
|
+
}
|
|
843
959
|
/** worker_threads' Worker and MessagePort: owned runtime handles that keep
|
|
844
960
|
* their live object representation (DYN) wherever they are stored. */
|
|
845
961
|
function isWorkerHandleSymbol(symbol, ctx) {
|
|
@@ -941,6 +1057,8 @@ function mapTypeInner(type, ctx) {
|
|
|
941
1057
|
checker.declarationsOf(directAlias).some((decl) => ctx.isStdlibFile(decl.getSourceFile()))) {
|
|
942
1058
|
return { kind: "object", className: "%Error" };
|
|
943
1059
|
}
|
|
1060
|
+
if (isOsConstantsType(type, ctx) || isLegacyUrlType(type, ctx))
|
|
1061
|
+
return DYN;
|
|
944
1062
|
// Immutable<T> (@scriptc/types) is a deep-readonly view: the value is
|
|
945
1063
|
// still the T it maps.
|
|
946
1064
|
const immutableSource = immutableSourceType(type, ctx);
|
|
@@ -1175,6 +1293,20 @@ function mapTypeInner(type, ctx) {
|
|
|
1175
1293
|
return hasStr ? STRING : F64;
|
|
1176
1294
|
}
|
|
1177
1295
|
}
|
|
1296
|
+
// @scriptc/experimental's LifetimeRegion: a synthetic program class,
|
|
1297
|
+
// provenance-checked by the package's declaration file.
|
|
1298
|
+
{
|
|
1299
|
+
const regionSym = widened.getSymbol();
|
|
1300
|
+
if (regionSym?.name === "LifetimeRegion") {
|
|
1301
|
+
for (const d of checker.declarationsOf(regionSym)) {
|
|
1302
|
+
if (!ts.isClassDeclaration(d))
|
|
1303
|
+
continue;
|
|
1304
|
+
const region = ctx.lifetimeRegionClass?.(d);
|
|
1305
|
+
if (region)
|
|
1306
|
+
return region;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1178
1310
|
// Declaration-only package types have no compiled implementation.
|
|
1179
1311
|
// Primitive and container types retain their structural mappings; types
|
|
1180
1312
|
// owned by the standard library or explicit host mappings are handled
|
|
@@ -1228,8 +1360,12 @@ function mapTypeInner(type, ctx) {
|
|
|
1228
1360
|
// changing this public representation. This is dynFallbackType's JS stance promoted into
|
|
1229
1361
|
// the mapping itself; construction sites build dynArrLit (the checked-dynamic tree
|
|
1230
1362
|
// array literal) and typed sources convert per element at the slot.
|
|
1363
|
+
// Arrays of class-backed protocol values are the exception: each
|
|
1364
|
+
// element is one checked-dynamic value (a class capsule or an object),
|
|
1365
|
+
// so a native array of them keeps every element's identity and passes
|
|
1366
|
+
// method calls a receiver they can dispatch.
|
|
1231
1367
|
if (elem.kind === "dyn")
|
|
1232
|
-
return DYN;
|
|
1368
|
+
return ctx.classImplementedProtocol?.(elemTs) ? arrayOf(DYN) : DYN;
|
|
1233
1369
|
// The shared predicate is the runtime/backend storage contract. In
|
|
1234
1370
|
// particular, valid standalone values such as Date and opaque
|
|
1235
1371
|
// handles do not automatically have an array element representation.
|
|
@@ -1508,7 +1644,7 @@ function mapTypeInner(type, ctx) {
|
|
|
1508
1644
|
// it lowers like `unknown` (the dyn) — the same rule as `object` and
|
|
1509
1645
|
// the empty object type, provenance-checked so a user's own `interface
|
|
1510
1646
|
// Object` still maps as a record. Its Object.prototype member surface
|
|
1511
|
-
// (`x.toString()`) fences at each use site
|
|
1647
|
+
// (`x.toString()`) fences at each use site with an explicit error.
|
|
1512
1648
|
if (isStdlibInterface("Object"))
|
|
1513
1649
|
return DYN;
|
|
1514
1650
|
// NodeJS.Module / the shipped fallback's ScriptcModule: a process-lifetime
|
|
@@ -1542,17 +1678,17 @@ function mapTypeInner(type, ctx) {
|
|
|
1542
1678
|
(isDeclaredInAmbientModule(d, "events") || isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1543
1679
|
return { kind: "object", className: RUNTIME_EMITTER_CLASS };
|
|
1544
1680
|
}
|
|
1545
|
-
// readline.Interface: the interface
|
|
1546
|
-
// runtime's registry (the Timeout-id
|
|
1547
|
-
// so the provenance check adds the
|
|
1548
|
-
//
|
|
1549
|
-
// readline/promises — that one stays unmapped and fences).
|
|
1681
|
+
// readline.Interface and readline/promises.Interface: the interface
|
|
1682
|
+
// value is an f64 handle into the runtime's registry (the Timeout-id
|
|
1683
|
+
// precedent). The NAME is generic, so the provenance check adds the
|
|
1684
|
+
// enclosing ambient module, like net.Server.
|
|
1550
1685
|
if (psym?.name === "Interface" &&
|
|
1551
1686
|
checker
|
|
1552
1687
|
.declarationsOf(psym)
|
|
1553
1688
|
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1554
1689
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1555
|
-
isDeclaredInAmbientModule(d, "readline")
|
|
1690
|
+
(isDeclaredInAmbientModule(d, "readline") ||
|
|
1691
|
+
isDeclaredInAmbientModule(d, "readline/promises")))) {
|
|
1556
1692
|
return F64;
|
|
1557
1693
|
}
|
|
1558
1694
|
// diagnostics_channel.Channel: the channel value is an f64 handle into
|
|
@@ -1745,6 +1881,16 @@ function mapTypeInner(type, ctx) {
|
|
|
1745
1881
|
return null;
|
|
1746
1882
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
1747
1883
|
}
|
|
1884
|
+
// node:crypto's KeyObject: secret keys are native handles (scr_lib.c)
|
|
1885
|
+
// whose getters and methods dispatch through the handle. The JsonWebKey
|
|
1886
|
+
// that export() returns is a plain checked-dynamic object.
|
|
1887
|
+
if ((psym?.name === "KeyObject" || psym?.name === "JsonWebKey") &&
|
|
1888
|
+
checker
|
|
1889
|
+
.declarationsOf(psym)
|
|
1890
|
+
.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
|
|
1891
|
+
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1892
|
+
return DYN;
|
|
1893
|
+
}
|
|
1748
1894
|
if (psym &&
|
|
1749
1895
|
FETCH_AMBIENT_TYPES.includes(psym.name) &&
|
|
1750
1896
|
!(psym.name === "ReadableStream" &&
|
|
@@ -1759,8 +1905,10 @@ function mapTypeInner(type, ctx) {
|
|
|
1759
1905
|
}
|
|
1760
1906
|
// The stdlib Console interface (the global console and node:console
|
|
1761
1907
|
// Console instances) is a native handle carried by the checked-dynamic
|
|
1762
|
-
// representation and consumed by the console method lowerings.
|
|
1763
|
-
|
|
1908
|
+
// representation and consumed by the console method lowerings. The
|
|
1909
|
+
// stdlib Disposable (events.addAbortListener's result) is a checked
|
|
1910
|
+
// object carrying its Symbol.dispose method.
|
|
1911
|
+
if ((psym?.name === "Console" || psym?.name === "Disposable") &&
|
|
1764
1912
|
checker
|
|
1765
1913
|
.declarationsOf(psym)
|
|
1766
1914
|
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
@@ -1861,7 +2009,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1861
2009
|
if (isStdlibInterface("ArrayBuffer") ||
|
|
1862
2010
|
isStdlibInterface("SharedArrayBuffer") ||
|
|
1863
2011
|
isStdlibInterface("PropertyDescriptor") ||
|
|
1864
|
-
isStdlibInterface("ProcessVersions")
|
|
2012
|
+
isStdlibInterface("ProcessVersions") ||
|
|
2013
|
+
isStdlibInterface("ProcessRelease"))
|
|
1865
2014
|
return DYN;
|
|
1866
2015
|
if (Object.values(BYTES_ELEMENT_NAME).some((name) => isStdlibInterface(`${name}Constructor`)))
|
|
1867
2016
|
return DYN;
|
|
@@ -1959,6 +2108,16 @@ function mapTypeInner(type, ctx) {
|
|
|
1959
2108
|
isDeclaredInAmbientModule(d, "fs/promises"))) {
|
|
1960
2109
|
return { kind: "fileHandle" };
|
|
1961
2110
|
}
|
|
2111
|
+
// fs.Dir: an open directory stream, declared in "fs" by both the
|
|
2112
|
+
// fallback and @types/node.
|
|
2113
|
+
if (psym?.name === "Dir" &&
|
|
2114
|
+
checker
|
|
2115
|
+
.declarationsOf(psym)
|
|
2116
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2117
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2118
|
+
isDeclaredInAmbientModule(d, "fs"))) {
|
|
2119
|
+
return { kind: "dir" };
|
|
2120
|
+
}
|
|
1962
2121
|
// child_process.SpawnSyncReturns: @types/node's generic interface (the
|
|
1963
2122
|
// Buffer/string split is re-checked at the stdout/stderr READ — status
|
|
1964
2123
|
// reads work either way) or the fallback declarations' plain interface.
|
|
@@ -2363,13 +2522,11 @@ function mapTypeInner(type, ctx) {
|
|
|
2363
2522
|
}
|
|
2364
2523
|
}
|
|
2365
2524
|
// PromiseSettledResult<T>'s parts: the lib's PromiseFulfilledResult<T> /
|
|
2366
|
-
// PromiseRejectedResult interfaces map to the
|
|
2367
|
-
//
|
|
2368
|
-
//
|
|
2369
|
-
//
|
|
2370
|
-
//
|
|
2371
|
-
// the SAME shape, so the settled union collapses to one record arm and
|
|
2372
|
-
// status keeps its string reads/comparisons. SEMANTICS.md 46.
|
|
2525
|
+
// PromiseRejectedResult interfaces map to the records { status, value }
|
|
2526
|
+
// and { status, reason } (the reason is `any`, a dyn slot), interned
|
|
2527
|
+
// explicitly. The settled union is a two-record union discriminated by
|
|
2528
|
+
// the `status` literals, so `r.status === "fulfilled"` narrows to the
|
|
2529
|
+
// arm that reads `value`.
|
|
2373
2530
|
// net/dgram AddressInfo and dgram RemoteInfo: stdlib interfaces over
|
|
2374
2531
|
// data properties, interned EXPLICITLY (the record path's provenance
|
|
2375
2532
|
// fence keeps .d.ts shapes out of the structural walk — the
|
|
@@ -2387,7 +2544,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2387
2544
|
// is string[]; unsupported runtime modes throw at the call), and the
|
|
2388
2545
|
// accepted-but-inert maxBuffer/windowsHide. Members outside this set
|
|
2389
2546
|
// (env, killSignal, shell, uid, ...) keep the shape unmatched — their
|
|
2390
|
-
// literals fence at the shape check instead of
|
|
2547
|
+
// literals fence at the shape check instead of being dropped without a
|
|
2548
|
+
// diagnostic.
|
|
2391
2549
|
if (isStdlibInterface("ExecFileSyncOptionsWithStringEncoding")) {
|
|
2392
2550
|
const optStr = withUndefinedArm(STRING, ctx.unions);
|
|
2393
2551
|
const optNum = withUndefinedArm(F64, ctx.unions);
|
|
@@ -2497,10 +2655,11 @@ function mapTypeInner(type, ctx) {
|
|
|
2497
2655
|
// hidden %dtype field carries the entry kind (libuv's UV_DIRENT
|
|
2498
2656
|
// encoding) that the isFile/isDirectory/isSymbolicLink call lowerings
|
|
2499
2657
|
// read (lowerDirentMethodCall — the StringDecoder pattern, so the
|
|
2500
|
-
// %-field never surfaces through the lowered Dirent surface itself
|
|
2501
|
-
//
|
|
2502
|
-
//
|
|
2503
|
-
//
|
|
2658
|
+
// %-field never surfaces through the lowered Dirent surface itself).
|
|
2659
|
+
// A row converted to dyn takes Node's Dirent prototype and Symbol(type)
|
|
2660
|
+
// key, with %dtype non-enumerable (scr_dyn_dirent_finish), and inspect
|
|
2661
|
+
// renders rows through that view. @types/node declares Dirent<Name>
|
|
2662
|
+
// generic over the name's encoding — only the string instantiation maps (the
|
|
2504
2663
|
// encoding:'buffer' readdir form has no lowering); the shipped fallback
|
|
2505
2664
|
// declares it concrete (an interface; @types/node uses a class — both
|
|
2506
2665
|
// provenance-checked, the Buffer/URL pattern).
|
|
@@ -2535,6 +2694,47 @@ function mapTypeInner(type, ctx) {
|
|
|
2535
2694
|
// string arm. Key order is Node's runtime insertion order (node_os.cc
|
|
2536
2695
|
// builds uid, gid, username, homedir, shell), so Object.keys over the
|
|
2537
2696
|
// record answers exactly Node.
|
|
2697
|
+
// os.CpuInfo (os.cpus()'s element), path.ParsedPath (path.parse()'s
|
|
2698
|
+
// result) and path.FormatInputPathObject (path.format()'s argument):
|
|
2699
|
+
// stdlib data interfaces interned explicitly, the AddressInfo pattern.
|
|
2700
|
+
// Key order is Node's own (lib/os.js builds { model, speed, times:
|
|
2701
|
+
// { user, nice, sys, idle, irq } }; path.parse builds { root, dir, base,
|
|
2702
|
+
// ext, name }).
|
|
2703
|
+
const cpuTimes = () => ({
|
|
2704
|
+
kind: "record",
|
|
2705
|
+
shapeId: ctx.shapes.intern(["idle", "irq", "nice", "sys", "user"].map((name) => ({ name, type: F64 })), false, undefined, ["user", "nice", "sys", "idle", "irq"]),
|
|
2706
|
+
});
|
|
2707
|
+
if (psym &&
|
|
2708
|
+
checker
|
|
2709
|
+
.declarationsOf(psym)
|
|
2710
|
+
.some((d) => ts.isTypeLiteralNode(d) &&
|
|
2711
|
+
ts.isPropertySignature(d.parent) &&
|
|
2712
|
+
ts.isIdentifier(d.parent.name) &&
|
|
2713
|
+
d.parent.name.text === "times" &&
|
|
2714
|
+
ts.isInterfaceDeclaration(d.parent.parent) &&
|
|
2715
|
+
d.parent.parent.name.text === "CpuInfo" &&
|
|
2716
|
+
ctx.isStdlibFile(d.getSourceFile())))
|
|
2717
|
+
return cpuTimes();
|
|
2718
|
+
if (isStdlibInterface("CpuInfo")) {
|
|
2719
|
+
const times = cpuTimes();
|
|
2720
|
+
return {
|
|
2721
|
+
kind: "record",
|
|
2722
|
+
shapeId: ctx.shapes.intern([
|
|
2723
|
+
{ name: "model", type: STRING },
|
|
2724
|
+
{ name: "speed", type: F64 },
|
|
2725
|
+
{ name: "times", type: times },
|
|
2726
|
+
], false, undefined, ["model", "speed", "times"]),
|
|
2727
|
+
};
|
|
2728
|
+
}
|
|
2729
|
+
if (isStdlibInterface("ParsedPath") || isStdlibInterface("FormatInputPathObject")) {
|
|
2730
|
+
const field = psym.name === "ParsedPath" ? STRING : withUndefinedArm(STRING, ctx.unions);
|
|
2731
|
+
if (!field)
|
|
2732
|
+
return null;
|
|
2733
|
+
return {
|
|
2734
|
+
kind: "record",
|
|
2735
|
+
shapeId: ctx.shapes.intern(["base", "dir", "ext", "name", "root"].map((name) => ({ name, type: field })), false, undefined, ["root", "dir", "base", "ext", "name"]),
|
|
2736
|
+
};
|
|
2737
|
+
}
|
|
2538
2738
|
if (isStdlibInterface("UserInfo")) {
|
|
2539
2739
|
const args = checker.getTypeArguments(widened);
|
|
2540
2740
|
if (args.length > 1)
|
|
@@ -2579,6 +2779,31 @@ function mapTypeInner(type, ctx) {
|
|
|
2579
2779
|
], false, undefined, ["fingerprint", "validFrom", "validTo"]),
|
|
2580
2780
|
};
|
|
2581
2781
|
}
|
|
2782
|
+
// perf_hooks' PerformanceEntry, PerformanceMark and PerformanceMeasure
|
|
2783
|
+
// (performance.mark/measure and the getEntries family): ONE record shape
|
|
2784
|
+
// for the three classes, so marks and measures share PerformanceEntry[]
|
|
2785
|
+
// arrays. The visible fields are toJSON's, in its order; the hidden
|
|
2786
|
+
// marker field keeps the shape distinct from a structurally equal user
|
|
2787
|
+
// record (util.inspect names the class from entryType, like Node).
|
|
2788
|
+
// @types/node declares the classes in perf_hooks and global interfaces
|
|
2789
|
+
// over them; the shipped fallback declares the classes.
|
|
2790
|
+
if ((psym?.name === "PerformanceEntry" ||
|
|
2791
|
+
psym?.name === "PerformanceMark" ||
|
|
2792
|
+
psym?.name === "PerformanceMeasure") &&
|
|
2793
|
+
checker
|
|
2794
|
+
.declarationsOf(psym)
|
|
2795
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2796
|
+
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2797
|
+
return { kind: "record", shapeId: perfEntryShape(ctx.shapes, ctx.unions) };
|
|
2798
|
+
}
|
|
2799
|
+
// process.memoryUsage()'s record, in Node's key order.
|
|
2800
|
+
if (isStdlibInterface("MemoryUsage")) {
|
|
2801
|
+
const names = ["rss", "heapTotal", "heapUsed", "external", "arrayBuffers"];
|
|
2802
|
+
return {
|
|
2803
|
+
kind: "record",
|
|
2804
|
+
shapeId: ctx.shapes.intern([...names].sort().map((name) => ({ name, type: F64 })), false, undefined, names),
|
|
2805
|
+
};
|
|
2806
|
+
}
|
|
2582
2807
|
// process.cpuUsage()/threadCpuUsage()'s {user, system} microsecond
|
|
2583
2808
|
// record and resourceUsage()'s getrusage record — stdlib data
|
|
2584
2809
|
// interfaces interned explicitly (the RemoteInfo pattern; declared
|
|
@@ -2665,10 +2890,34 @@ function mapTypeInner(type, ctx) {
|
|
|
2665
2890
|
]),
|
|
2666
2891
|
};
|
|
2667
2892
|
}
|
|
2668
|
-
if (isStdlibInterface("PromiseFulfilledResult")
|
|
2893
|
+
if (isStdlibInterface("PromiseFulfilledResult")) {
|
|
2894
|
+
const arg = checker.getTypeArguments(widened)[0];
|
|
2895
|
+
if (!arg)
|
|
2896
|
+
return null;
|
|
2897
|
+
// A valueless fulfillment (Promise<void>) still has its `value`
|
|
2898
|
+
// property, always undefined: a dyn slot holds it, as it holds any.
|
|
2899
|
+
const mapped = arg.flags &
|
|
2900
|
+
(ts.TypeFlags.Void | ts.TypeFlags.Undefined | ts.TypeFlags.Never | ts.TypeFlags.Any)
|
|
2901
|
+
? DYN
|
|
2902
|
+
: mapType(arg, ctx);
|
|
2903
|
+
if (!mapped)
|
|
2904
|
+
return null;
|
|
2905
|
+
const valueT = mapped.kind === "void" || isUnitType(mapped) ? DYN : mapped;
|
|
2669
2906
|
return {
|
|
2670
2907
|
kind: "record",
|
|
2671
|
-
shapeId: ctx.shapes.intern([
|
|
2908
|
+
shapeId: ctx.shapes.intern([
|
|
2909
|
+
{ name: "status", type: STRING },
|
|
2910
|
+
{ name: "value", type: valueT },
|
|
2911
|
+
], false, undefined, ["status", "value"]),
|
|
2912
|
+
};
|
|
2913
|
+
}
|
|
2914
|
+
if (isStdlibInterface("PromiseRejectedResult")) {
|
|
2915
|
+
return {
|
|
2916
|
+
kind: "record",
|
|
2917
|
+
shapeId: ctx.shapes.intern([
|
|
2918
|
+
{ name: "reason", type: DYN },
|
|
2919
|
+
{ name: "status", type: STRING },
|
|
2920
|
+
], false, undefined, ["status", "reason"]),
|
|
2672
2921
|
};
|
|
2673
2922
|
}
|
|
2674
2923
|
// Function types: exactly one call signature, no generics, and every
|
|
@@ -2992,7 +3241,16 @@ function mapTypeInner(type, ctx) {
|
|
|
2992
3241
|
const byKey = new Map();
|
|
2993
3242
|
const recordParts = [];
|
|
2994
3243
|
const substitutedUnions = [];
|
|
2995
|
-
|
|
3244
|
+
// The lib's `T extends readonly unknown[] | []` idiom (Promise.all,
|
|
3245
|
+
// allSettled) maps an array input to `X[] | []`: the empty tuple is
|
|
3246
|
+
// one of the array's own values.
|
|
3247
|
+
const parts = ts.constituentTypes(widened);
|
|
3248
|
+
const emptyTuple = (part) => checker.isTupleType(part) &&
|
|
3249
|
+
checker.getTypeArguments(part).length === 0;
|
|
3250
|
+
const hasArrayPart = parts.some((part) => checker.isArrayType(part));
|
|
3251
|
+
for (const part of parts) {
|
|
3252
|
+
if (hasArrayPart && emptyTuple(part))
|
|
3253
|
+
continue;
|
|
2996
3254
|
// TypeScript's client can retain impossible intersections in a
|
|
2997
3255
|
// distributed union. They have no inhabitants and no runtime tag.
|
|
2998
3256
|
if (checker.isNeverType(part))
|
|
@@ -4303,7 +4561,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4303
4561
|
return DYN;
|
|
4304
4562
|
// A computed shape with NO members is not a real empty record: inside a
|
|
4305
4563
|
// generic body `Partial<T>` resolves to no members at all (keyof T is
|
|
4306
|
-
// still unknown there) — interning `{}` would
|
|
4564
|
+
// still unknown there) — interning `{}` would give a wrong type. The
|
|
4307
4565
|
// degenerate empties (`Partial<{}>`, `Omit<C, keyof C>`) go with it.
|
|
4308
4566
|
// An INDEX-SIGNATURE shape is exempt: `Record<string, T>` legitimately
|
|
4309
4567
|
// has zero declared members — the signature is the shape.
|
|
@@ -4343,8 +4601,8 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4343
4601
|
// accessor MEMBERS map the same way so accessor records cross
|
|
4344
4602
|
// annotated boundaries (`function f(p: { get x(): number })`) —
|
|
4345
4603
|
// tsc lets a plain DATA property satisfy such a member, but the
|
|
4346
|
-
// exact-shape stance turns that into a
|
|
4347
|
-
// at the literal
|
|
4604
|
+
// exact-shape stance turns that into a shape-mismatch diagnostic
|
|
4605
|
+
// at the literal instead of an undiagnosed split. JS-file literals keep
|
|
4348
4606
|
// their existing paths (the CJS export-table narrowing and the
|
|
4349
4607
|
// checked-dynamic fallback), and .d.ts declarations stay out with
|
|
4350
4608
|
// the rest of the lib's type worlds.
|