@scriptc/compiler 0.3.2 → 0.3.4
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 +1202 -64
- package/dist/backend/cycle-analysis.js +6 -1
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +5 -0
- package/dist/backend/cycle-mutability.js +62 -3
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +1 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/library-pack.js +1 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/llvm/alloc.js +24 -10
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/alloc.test.js +47 -1
- package/dist/backend/llvm/alloc.test.js.map +1 -1
- 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 +12 -1
- package/dist/backend/llvm/call-lifetimes.js +41 -11
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +85 -1
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/classes.js +87 -36
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +6 -1
- package/dist/backend/llvm/common.js +8 -1
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +5 -0
- package/dist/backend/llvm/dense-array-access.js +3 -3
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +44 -1
- package/dist/backend/llvm/dyn.js +251 -36
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +77 -14
- package/dist/backend/llvm/emitter.js +461 -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 +52 -1
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +9 -0
- package/dist/backend/llvm/expr-bytes.js +169 -63
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.js +16 -2
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +3 -1
- package/dist/backend/llvm/expr-calls.js +57 -2
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +57 -19
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +19 -8
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +28 -30
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-records.js +8 -4
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +35 -32
- package/dist/backend/llvm/expr-stream-bridges.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/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/intern-tables.test.d.ts +1 -0
- package/dist/backend/llvm/intern-tables.test.js +77 -0
- package/dist/backend/llvm/intern-tables.test.js.map +1 -0
- package/dist/backend/llvm/lib-datagram.js +10 -0
- package/dist/backend/llvm/lib-datagram.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +255 -29
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +176 -7
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +25 -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.d.ts +5 -0
- package/dist/backend/llvm/lib-shared.js +212 -1
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +184 -0
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.js +9 -0
- package/dist/backend/llvm/lib-test.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +7 -3
- 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 +2 -0
- package/dist/backend/llvm/local-union-storage.js +5 -0
- package/dist/backend/llvm/local-union-storage.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +1 -0
- 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 +24 -0
- package/dist/backend/llvm/map-number-lookup.js +88 -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 +158 -0
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -0
- package/dist/backend/llvm/map-read-lifetimes.d.ts +9 -0
- package/dist/backend/llvm/map-read-lifetimes.js +90 -1
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +129 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +9 -0
- package/dist/backend/llvm/publish.js +25 -4
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/record-results.d.ts +8 -5
- package/dist/backend/llvm/record-results.js +20 -12
- package/dist/backend/llvm/record-results.js.map +1 -1
- package/dist/backend/llvm/reference-effects.js +13 -0
- package/dist/backend/llvm/reference-effects.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +19 -2
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regions.d.ts +5 -1
- package/dist/backend/llvm/regions.js +24 -10
- package/dist/backend/llvm/regions.js.map +1 -1
- 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 +56 -10
- package/dist/backend/llvm/shapes.js +178 -39
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +61 -3
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/stack-objects.js +16 -4
- package/dist/backend/llvm/stack-objects.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +3 -0
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.js +2 -2
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/string-slices.js +2 -2
- package/dist/backend/llvm/string-slices.js.map +1 -1
- package/dist/backend/llvm/walkers.d.ts +11 -0
- package/dist/backend/llvm/walkers.js +106 -10
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/may-throw.js +13 -4
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +5 -2
- package/dist/backend/native/executable.js +27 -8
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +2 -0
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +4 -4
- package/dist/backend/native-codegen-core.js +4 -6
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.test.js +7 -8
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +3 -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/publication.js +3 -1
- package/dist/backend/publication.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-targets.test.js +2 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +2 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +11 -1
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/target-diagnostics.test.js +4 -1
- package/dist/backend/target-diagnostics.test.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -0
- package/dist/backend/warm-cache.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 +1 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +1 -0
- package/dist/executable/executable-cache.test.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 +5 -1
- package/dist/frontend/experimental-import.js +28 -3
- package/dist/frontend/experimental-import.js.map +1 -1
- package/dist/frontend/lowering/assert-instances.d.ts +38 -0
- package/dist/frontend/lowering/assert-instances.js +269 -0
- package/dist/frontend/lowering/assert-instances.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/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.d.ts +18 -0
- package/dist/frontend/lowering/builtins/compression.js +178 -4
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/constants.js +7 -2
- package/dist/frontend/lowering/builtins/constants.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +6 -0
- package/dist/frontend/lowering/builtins/crypto.js +526 -121
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/errors.js +23 -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/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 +44 -11
- package/dist/frontend/lowering/builtins/module-calls.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 +107 -14
- package/dist/frontend/lowering/builtins/process.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/timers.d.ts +3 -0
- package/dist/frontend/lowering/builtins/timers.js +109 -23
- package/dist/frontend/lowering/builtins/timers.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 +26 -2
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +2 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +171 -13
- 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 +4 -7
- package/dist/frontend/lowering/containers/array-callbacks.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/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/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/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 +16 -12
- package/dist/frontend/lowering/expressions/object-literals.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/intern-tables.d.ts +13 -0
- package/dist/frontend/lowering/intern-tables.js +536 -0
- package/dist/frontend/lowering/intern-tables.js.map +1 -0
- package/dist/frontend/lowering/lower-array-sort.d.ts +12 -1
- package/dist/frontend/lowering/lower-array-sort.js +561 -191
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +4 -2
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +702 -63
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +6 -3
- package/dist/frontend/lowering/lower-async-iteration.js +259 -4
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +118 -12
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +11 -2
- package/dist/frontend/lowering/lower-classes.js +76 -9
- 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-dgram.js +77 -52
- package/dist/frontend/lowering/lower-dgram.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 +124 -22
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +6 -0
- package/dist/frontend/lowering/lower-inspect.js +240 -49
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +1 -1
- package/dist/frontend/lowering/lower-mock.d.ts +11 -0
- package/dist/frontend/lowering/lower-mock.js +504 -0
- package/dist/frontend/lowering/lower-mock.js.map +1 -0
- package/dist/frontend/lowering/lower-modules.d.ts +1 -1
- package/dist/frontend/lowering/lower-modules.js +14 -3
- 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.d.ts +3 -0
- package/dist/frontend/lowering/lower-server.js +419 -44
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +7 -1
- package/dist/frontend/lowering/lower-stdlib.js +10 -3
- 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 +69 -14
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +10 -6
- package/dist/frontend/lowering/lower-stream.js +1020 -49
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.js +86 -8
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +45 -5
- package/dist/frontend/lowering/lowerer.js +317 -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/pairs-snapshot.d.ts +6 -0
- package/dist/frontend/lowering/pairs-snapshot.js +49 -0
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- 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 +11 -3
- package/dist/frontend/lowering/surfaces.js +334 -37
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/zlib-constants.d.ts +1 -0
- package/dist/frontend/lowering/zlib-constants.js +181 -0
- package/dist/frontend/lowering/zlib-constants.js.map +1 -0
- package/dist/frontend/mock-shapes.d.ts +10 -0
- package/dist/frontend/mock-shapes.js +76 -0
- package/dist/frontend/mock-shapes.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 +3 -3
- package/dist/frontend/program.js +25 -18
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +4 -0
- package/dist/frontend/resolve.js +15 -1
- package/dist/frontend/resolve.js.map +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 +3 -2
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +21 -1
- package/dist/frontend/type-mapper.js +245 -27
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.js +7 -5
- 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 +115 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +1 -1
- package/dist/ir/builtin-signatures.js +438 -46
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/int32-slots.js +1 -0
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/ir.d.ts +84 -17
- package/dist/ir/ir.js +54 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +1 -0
- package/dist/ir/runtime-features.js +111 -7
- package/dist/ir/runtime-features.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 +295 -14
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +60 -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/cli.js +1 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +1 -3
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/prepare.js +4 -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 +1279 -221
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { InternalCompilerError } from "../errors.js";
|
|
2
|
+
import { mockCallRecordType, mockContextType } from "./mock-shapes.js";
|
|
2
3
|
import * as ts from "./ts7/adapter.js";
|
|
3
4
|
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, 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
|
+
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, ZLIB_STREAM_MODES, setOf, STRING, SYMBOL_T, typeEquals, typeKey, unionContainerArmsOk, UNDEFINED_T, VOID, } from "../ir/ir.js";
|
|
5
6
|
import { BIGINT_T } from "../ir/ir.js";
|
|
6
7
|
import { literalValues } from "./literal-values.js";
|
|
7
8
|
import { remapUnionDiscriminant } from "./union-discriminants.js";
|
|
@@ -87,7 +88,26 @@ export const FETCH_AMBIENT_TYPES = [
|
|
|
87
88
|
"ReadableStreamReadResult",
|
|
88
89
|
"ReadableStreamReadValueResult",
|
|
89
90
|
"ReadableStreamReadDoneResult",
|
|
91
|
+
"Blob",
|
|
92
|
+
"File",
|
|
93
|
+
"BlobPropertyBag",
|
|
94
|
+
"FilePropertyBag",
|
|
95
|
+
"BlobOptions",
|
|
96
|
+
"FileOptions",
|
|
90
97
|
];
|
|
98
|
+
/** node:crypto's Cipheriv and Decipheriv names in @types/node. */
|
|
99
|
+
export const CIPHER_TYPE_NAMES = new Set([
|
|
100
|
+
"Cipheriv",
|
|
101
|
+
"Decipheriv",
|
|
102
|
+
"CipherCCM",
|
|
103
|
+
"CipherGCM",
|
|
104
|
+
"CipherOCB",
|
|
105
|
+
"CipherChaCha20Poly1305",
|
|
106
|
+
"DecipherCCM",
|
|
107
|
+
"DecipherGCM",
|
|
108
|
+
"DecipherOCB",
|
|
109
|
+
"DecipherChaCha20Poly1305",
|
|
110
|
+
]);
|
|
91
111
|
/** node:util.parseArgs's public and @types/node helper type names, plus
|
|
92
112
|
* util.debuglog's DebugLogger (a native function value with an `enabled`
|
|
93
113
|
* accessor) and the DebugLoggerFunction its callback receives. Values
|
|
@@ -646,6 +666,8 @@ export function formatIrType(t, shapes, unions, seen = new Set()) {
|
|
|
646
666
|
return append("Stats");
|
|
647
667
|
case "fileHandle":
|
|
648
668
|
return append("FileHandle");
|
|
669
|
+
case "dir":
|
|
670
|
+
return append("Dir");
|
|
649
671
|
case "spawnRes":
|
|
650
672
|
return append("SpawnSyncReturns");
|
|
651
673
|
case "child":
|
|
@@ -721,6 +743,34 @@ function esOwnKeyOrder(names) {
|
|
|
721
743
|
const indices = names.filter(isArrayIndex).sort((a, b) => Number(a) - Number(b));
|
|
722
744
|
return indices.length === 0 ? names : [...indices, ...names.filter((n) => !isArrayIndex(n))];
|
|
723
745
|
}
|
|
746
|
+
/** The hidden field that marks the perf_hooks entry record shape. */
|
|
747
|
+
export const PERF_ENTRY_MARKER = "%perfEntry";
|
|
748
|
+
/** PerformanceEntry's toJSON fields, in toJSON's order. */
|
|
749
|
+
export const PERF_ENTRY_FIELDS = ["name", "entryType", "startTime", "duration", "detail"];
|
|
750
|
+
/** The record shape behind PerformanceEntry, PerformanceMark and
|
|
751
|
+
* PerformanceMeasure values (see mapType). The marker is an always-absent
|
|
752
|
+
* optional, so dyn conversions and key walks never see it. */
|
|
753
|
+
export function perfEntryShape(shapes, unions) {
|
|
754
|
+
return shapes.intern([
|
|
755
|
+
{ name: PERF_ENTRY_MARKER, type: withUndefinedArm(F64, unions) },
|
|
756
|
+
{ name: "detail", type: DYN },
|
|
757
|
+
{ name: "duration", type: F64 },
|
|
758
|
+
{ name: "entryType", type: STRING },
|
|
759
|
+
{ name: "name", type: STRING },
|
|
760
|
+
{ name: "startTime", type: F64 },
|
|
761
|
+
], false, undefined, PERF_ENTRY_FIELDS);
|
|
762
|
+
}
|
|
763
|
+
/** toJSON()'s plain object over an entry: the same fields without the
|
|
764
|
+
* marker. */
|
|
765
|
+
export function perfEntryJsonShape(shapes) {
|
|
766
|
+
return shapes.intern([
|
|
767
|
+
{ name: "detail", type: DYN },
|
|
768
|
+
{ name: "duration", type: F64 },
|
|
769
|
+
{ name: "entryType", type: STRING },
|
|
770
|
+
{ name: "name", type: STRING },
|
|
771
|
+
{ name: "startTime", type: F64 },
|
|
772
|
+
], false, undefined, PERF_ENTRY_FIELDS);
|
|
773
|
+
}
|
|
724
774
|
function isDeclaredInAmbientModule(d, name) {
|
|
725
775
|
let node = d.parent;
|
|
726
776
|
while (node) {
|
|
@@ -849,6 +899,43 @@ let mapTypeDepth = 0;
|
|
|
849
899
|
* a bump between entry and exit stays fenced (recursive generic-open types
|
|
850
900
|
* stay fenced instead of interning a per-context-wrong shape). */
|
|
851
901
|
let contextResolutions = 0;
|
|
902
|
+
/** node:url's legacy record interfaces: url.parse()'s Url instance (and
|
|
903
|
+
* its two query-typed refinements), url.format()'s UrlObject input, and the
|
|
904
|
+
* URL form's URLFormatOptions. The values are checked-dynamic objects —
|
|
905
|
+
* Node's Url instance carries its class name and null fields, and format()
|
|
906
|
+
* reads any object's fields with JS truthiness. */
|
|
907
|
+
const LEGACY_URL_TYPES = new Set([
|
|
908
|
+
"Url",
|
|
909
|
+
"UrlObject",
|
|
910
|
+
"UrlWithParsedQuery",
|
|
911
|
+
"UrlWithStringQuery",
|
|
912
|
+
"URLFormatOptions",
|
|
913
|
+
]);
|
|
914
|
+
export function isLegacyUrlType(type, ctx) {
|
|
915
|
+
const symbol = type.getAliasSymbol() ?? type.getSymbol();
|
|
916
|
+
return isLegacyUrlSymbol(symbol, ctx);
|
|
917
|
+
}
|
|
918
|
+
/** A symbol declared as one of node:url's legacy record interfaces, or as
|
|
919
|
+
* a member of one. */
|
|
920
|
+
export function isLegacyUrlSymbol(symbol, ctx) {
|
|
921
|
+
if (!symbol)
|
|
922
|
+
return false;
|
|
923
|
+
for (const d of ctx.checker.declarationsOf(symbol)) {
|
|
924
|
+
if (!ctx.isStdlibFile(d.getSourceFile()))
|
|
925
|
+
continue;
|
|
926
|
+
let family = false;
|
|
927
|
+
for (let n = d; n; n = n.parent) {
|
|
928
|
+
if (ts.isInterfaceDeclaration(n) && LEGACY_URL_TYPES.has(n.name.text))
|
|
929
|
+
family = true;
|
|
930
|
+
if (ts.isModuleDeclaration(n) && ts.isStringLiteral(n.name)) {
|
|
931
|
+
if (family && (n.name.text === "url" || n.name.text === "node:url"))
|
|
932
|
+
return true;
|
|
933
|
+
break;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
}
|
|
937
|
+
return false;
|
|
938
|
+
}
|
|
852
939
|
/** os.constants and its groups — @types/node's `namespace constants`
|
|
853
940
|
* (errno, dlopen, priority) and SignalConstants, and the fallback's twins:
|
|
854
941
|
* the runtime's checked-dynamic constants object, whose members vary by
|
|
@@ -984,7 +1071,7 @@ function mapTypeInner(type, ctx) {
|
|
|
984
1071
|
checker.declarationsOf(directAlias).some((decl) => ctx.isStdlibFile(decl.getSourceFile()))) {
|
|
985
1072
|
return { kind: "object", className: "%Error" };
|
|
986
1073
|
}
|
|
987
|
-
if (isOsConstantsType(type, ctx))
|
|
1074
|
+
if (isOsConstantsType(type, ctx) || isLegacyUrlType(type, ctx))
|
|
988
1075
|
return DYN;
|
|
989
1076
|
// Immutable<T> (@scriptc/types) is a deep-readonly view: the value is
|
|
990
1077
|
// still the T it maps.
|
|
@@ -1220,17 +1307,18 @@ function mapTypeInner(type, ctx) {
|
|
|
1220
1307
|
return hasStr ? STRING : F64;
|
|
1221
1308
|
}
|
|
1222
1309
|
}
|
|
1223
|
-
// @scriptc/experimental's LifetimeRegion:
|
|
1224
|
-
// provenance-checked by the package's declaration file.
|
|
1310
|
+
// @scriptc/experimental's LifetimeRegion and InternTable: synthetic
|
|
1311
|
+
// program classes, provenance-checked by the package's declaration file.
|
|
1225
1312
|
{
|
|
1226
|
-
const
|
|
1227
|
-
|
|
1228
|
-
|
|
1313
|
+
const classSym = widened.getSymbol();
|
|
1314
|
+
const name = classSym?.name;
|
|
1315
|
+
if (name === "LifetimeRegion" || name === "InternTable") {
|
|
1316
|
+
for (const d of checker.declarationsOf(classSym)) {
|
|
1229
1317
|
if (!ts.isClassDeclaration(d))
|
|
1230
1318
|
continue;
|
|
1231
|
-
const
|
|
1232
|
-
if (
|
|
1233
|
-
return
|
|
1319
|
+
const synthetic = name === "LifetimeRegion" ? ctx.lifetimeRegionClass?.(d) : ctx.internTableClass?.(d);
|
|
1320
|
+
if (synthetic)
|
|
1321
|
+
return synthetic;
|
|
1234
1322
|
}
|
|
1235
1323
|
}
|
|
1236
1324
|
}
|
|
@@ -1287,8 +1375,12 @@ function mapTypeInner(type, ctx) {
|
|
|
1287
1375
|
// changing this public representation. This is dynFallbackType's JS stance promoted into
|
|
1288
1376
|
// the mapping itself; construction sites build dynArrLit (the checked-dynamic tree
|
|
1289
1377
|
// array literal) and typed sources convert per element at the slot.
|
|
1378
|
+
// Arrays of class-backed protocol values are the exception: each
|
|
1379
|
+
// element is one checked-dynamic value (a class capsule or an object),
|
|
1380
|
+
// so a native array of them keeps every element's identity and passes
|
|
1381
|
+
// method calls a receiver they can dispatch.
|
|
1290
1382
|
if (elem.kind === "dyn")
|
|
1291
|
-
return DYN;
|
|
1383
|
+
return ctx.classImplementedProtocol?.(elemTs) ? arrayOf(DYN) : DYN;
|
|
1292
1384
|
// The shared predicate is the runtime/backend storage contract. In
|
|
1293
1385
|
// particular, valid standalone values such as Date and opaque
|
|
1294
1386
|
// handles do not automatically have an array element representation.
|
|
@@ -1562,12 +1654,19 @@ function mapTypeInner(type, ctx) {
|
|
|
1562
1654
|
if (isStdlibInterface(rec.lib))
|
|
1563
1655
|
return { kind: "object", className: irName };
|
|
1564
1656
|
}
|
|
1657
|
+
// node:assert's AssertionError is declared as a class (in the shipped
|
|
1658
|
+
// fallback and in @types/node), not as a lib interface.
|
|
1659
|
+
if (psym?.name === "AssertionError" &&
|
|
1660
|
+
checker
|
|
1661
|
+
.declarationsOf(psym)
|
|
1662
|
+
.some((d) => ts.isClassDeclaration(d) && ctx.isStdlibFile(d.getSourceFile())))
|
|
1663
|
+
return { kind: "object", className: "%AssertionError" };
|
|
1565
1664
|
// The lib's `Object` interface is a TOP type: tsc admits every
|
|
1566
1665
|
// non-nullish value into an `Object` slot (`const x: Object = "s"`), so
|
|
1567
1666
|
// it lowers like `unknown` (the dyn) — the same rule as `object` and
|
|
1568
1667
|
// the empty object type, provenance-checked so a user's own `interface
|
|
1569
1668
|
// Object` still maps as a record. Its Object.prototype member surface
|
|
1570
|
-
// (`x.toString()`) fences at each use site
|
|
1669
|
+
// (`x.toString()`) fences at each use site with an explicit error.
|
|
1571
1670
|
if (isStdlibInterface("Object"))
|
|
1572
1671
|
return DYN;
|
|
1573
1672
|
// NodeJS.Module / the shipped fallback's ScriptcModule: a process-lifetime
|
|
@@ -1601,17 +1700,17 @@ function mapTypeInner(type, ctx) {
|
|
|
1601
1700
|
(isDeclaredInAmbientModule(d, "events") || isDeclaredInAmbientNamespace(d, "NodeJS")))) {
|
|
1602
1701
|
return { kind: "object", className: RUNTIME_EMITTER_CLASS };
|
|
1603
1702
|
}
|
|
1604
|
-
// readline.Interface: the interface
|
|
1605
|
-
// runtime's registry (the Timeout-id
|
|
1606
|
-
// so the provenance check adds the
|
|
1607
|
-
//
|
|
1608
|
-
// readline/promises — that one stays unmapped and fences).
|
|
1703
|
+
// readline.Interface and readline/promises.Interface: the interface
|
|
1704
|
+
// value is an f64 handle into the runtime's registry (the Timeout-id
|
|
1705
|
+
// precedent). The NAME is generic, so the provenance check adds the
|
|
1706
|
+
// enclosing ambient module, like net.Server.
|
|
1609
1707
|
if (psym?.name === "Interface" &&
|
|
1610
1708
|
checker
|
|
1611
1709
|
.declarationsOf(psym)
|
|
1612
1710
|
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
1613
1711
|
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
1614
|
-
isDeclaredInAmbientModule(d, "readline")
|
|
1712
|
+
(isDeclaredInAmbientModule(d, "readline") ||
|
|
1713
|
+
isDeclaredInAmbientModule(d, "readline/promises")))) {
|
|
1615
1714
|
return F64;
|
|
1616
1715
|
}
|
|
1617
1716
|
// diagnostics_channel.Channel: the channel value is an f64 handle into
|
|
@@ -1804,6 +1903,16 @@ function mapTypeInner(type, ctx) {
|
|
|
1804
1903
|
return null;
|
|
1805
1904
|
return genResultRecord(elem, VOID, ctx.shapes, ctx.unions);
|
|
1806
1905
|
}
|
|
1906
|
+
// node:crypto's KeyObject: secret keys are native handles (scr_lib.c)
|
|
1907
|
+
// whose getters and methods dispatch through the handle. The JsonWebKey
|
|
1908
|
+
// that export() returns is a plain checked-dynamic object.
|
|
1909
|
+
if ((psym?.name === "KeyObject" || psym?.name === "JsonWebKey") &&
|
|
1910
|
+
checker
|
|
1911
|
+
.declarationsOf(psym)
|
|
1912
|
+
.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
|
|
1913
|
+
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1914
|
+
return DYN;
|
|
1915
|
+
}
|
|
1807
1916
|
if (psym &&
|
|
1808
1917
|
FETCH_AMBIENT_TYPES.includes(psym.name) &&
|
|
1809
1918
|
!(psym.name === "ReadableStream" &&
|
|
@@ -1827,6 +1936,14 @@ function mapTypeInner(type, ctx) {
|
|
|
1827
1936
|
.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1828
1937
|
return DYN;
|
|
1829
1938
|
}
|
|
1939
|
+
// node:crypto Cipheriv/Decipheriv values (and @types/node's per-mode
|
|
1940
|
+
// interfaces over them) are native handles carried by the checked-dynamic
|
|
1941
|
+
// representation; lowerCipherMethodCall dispatches their methods.
|
|
1942
|
+
if (psym !== undefined &&
|
|
1943
|
+
CIPHER_TYPE_NAMES.has(psym.name) &&
|
|
1944
|
+
checker.declarationsOf(psym).some((d) => ctx.isStdlibFile(d.getSourceFile()))) {
|
|
1945
|
+
return DYN;
|
|
1946
|
+
}
|
|
1830
1947
|
// ReadonlyMap/ReadonlySet are the SAME runtime values as Map/Set — the
|
|
1831
1948
|
// readonly-ness is a checker-only view (no mutating members on the
|
|
1832
1949
|
// interface), so both map to the identical IR kinds and the read-side
|
|
@@ -1922,7 +2039,8 @@ function mapTypeInner(type, ctx) {
|
|
|
1922
2039
|
if (isStdlibInterface("ArrayBuffer") ||
|
|
1923
2040
|
isStdlibInterface("SharedArrayBuffer") ||
|
|
1924
2041
|
isStdlibInterface("PropertyDescriptor") ||
|
|
1925
|
-
isStdlibInterface("ProcessVersions")
|
|
2042
|
+
isStdlibInterface("ProcessVersions") ||
|
|
2043
|
+
isStdlibInterface("ProcessRelease"))
|
|
1926
2044
|
return DYN;
|
|
1927
2045
|
if (Object.values(BYTES_ELEMENT_NAME).some((name) => isStdlibInterface(`${name}Constructor`)))
|
|
1928
2046
|
return DYN;
|
|
@@ -2020,6 +2138,16 @@ function mapTypeInner(type, ctx) {
|
|
|
2020
2138
|
isDeclaredInAmbientModule(d, "fs/promises"))) {
|
|
2021
2139
|
return { kind: "fileHandle" };
|
|
2022
2140
|
}
|
|
2141
|
+
// fs.Dir: an open directory stream, declared in "fs" by both the
|
|
2142
|
+
// fallback and @types/node.
|
|
2143
|
+
if (psym?.name === "Dir" &&
|
|
2144
|
+
checker
|
|
2145
|
+
.declarationsOf(psym)
|
|
2146
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2147
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2148
|
+
isDeclaredInAmbientModule(d, "fs"))) {
|
|
2149
|
+
return { kind: "dir" };
|
|
2150
|
+
}
|
|
2023
2151
|
// child_process.SpawnSyncReturns: @types/node's generic interface (the
|
|
2024
2152
|
// Buffer/string split is re-checked at the stdout/stderr READ — status
|
|
2025
2153
|
// reads work either way) or the fallback declarations' plain interface.
|
|
@@ -2183,6 +2311,18 @@ function mapTypeInner(type, ctx) {
|
|
|
2183
2311
|
return { kind: "object", className: irName };
|
|
2184
2312
|
}
|
|
2185
2313
|
}
|
|
2314
|
+
// node:zlib's stream classes (the shipped fallback declarations): their
|
|
2315
|
+
// instances are runtime Transform streams.
|
|
2316
|
+
if (psym !== undefined &&
|
|
2317
|
+
ZLIB_STREAM_MODES.has(psym.name) &&
|
|
2318
|
+
checker
|
|
2319
|
+
.declarationsOf(psym)
|
|
2320
|
+
.some((d) => ts.isClassDeclaration(d) &&
|
|
2321
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2322
|
+
!isNodeTypesPath(d.getSourceFile().fileName) &&
|
|
2323
|
+
isDeclaredInAmbientModule(d, "zlib"))) {
|
|
2324
|
+
return { kind: "object", className: "%Transform" };
|
|
2325
|
+
}
|
|
2186
2326
|
if ((psym?.name === "Readable" &&
|
|
2187
2327
|
checker
|
|
2188
2328
|
.declarationsOf(psym)
|
|
@@ -2221,6 +2361,23 @@ function mapTypeInner(type, ctx) {
|
|
|
2221
2361
|
isDeclaredInAmbientModule(d, "test"))) {
|
|
2222
2362
|
return { kind: "testCtx" };
|
|
2223
2363
|
}
|
|
2364
|
+
// node:test's MockFunctionContext<F> and MockFunctionCall<F>: compiler
|
|
2365
|
+
// records built from F (mock-shapes.ts). Mock<F> then maps as the hybrid
|
|
2366
|
+
// { %call: F, mock } record through mapHybridCallableIntersection.
|
|
2367
|
+
if ((psym?.name === "MockFunctionContext" || psym?.name === "MockFunctionCall") &&
|
|
2368
|
+
checker
|
|
2369
|
+
.declarationsOf(psym)
|
|
2370
|
+
.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2371
|
+
ctx.isStdlibFile(d.getSourceFile()) &&
|
|
2372
|
+
isDeclaredInAmbientModule(d, "test"))) {
|
|
2373
|
+
const fnTs = checker.getTypeArguments(widened)[0];
|
|
2374
|
+
const fn = fnTs ? mapType(fnTs, ctx) : null;
|
|
2375
|
+
if (!fn || fn.kind !== "func")
|
|
2376
|
+
return null;
|
|
2377
|
+
return psym.name === "MockFunctionContext"
|
|
2378
|
+
? mockContextType(fn, ctx)
|
|
2379
|
+
: mockCallRecordType(fn, ctx);
|
|
2380
|
+
}
|
|
2224
2381
|
// NodeJS.ErrnoException: @types/node's `interface ErrnoException extends
|
|
2225
2382
|
// Error` (dns/fs callback error types). It IS an Error at runtime — map
|
|
2226
2383
|
// it to the runtime %Error hierarchy like the lib Error interfaces
|
|
@@ -2435,6 +2592,16 @@ function mapTypeInner(type, ctx) {
|
|
|
2435
2592
|
// PromiseFulfilledResult precedent). RemoteInfo's 'IPv4' | 'IPv6'
|
|
2436
2593
|
// family widens to string here; the runtime only ever answers "IPv4"
|
|
2437
2594
|
// (udp4 is the one lowered socket type).
|
|
2595
|
+
// dns.lookup's all: true entries: { address, family }.
|
|
2596
|
+
if (isStdlibInterface("LookupAddress")) {
|
|
2597
|
+
return {
|
|
2598
|
+
kind: "record",
|
|
2599
|
+
shapeId: ctx.shapes.intern([
|
|
2600
|
+
{ name: "address", type: STRING },
|
|
2601
|
+
{ name: "family", type: F64 },
|
|
2602
|
+
], false, undefined, ["address", "family"]),
|
|
2603
|
+
};
|
|
2604
|
+
}
|
|
2438
2605
|
// child_process.ExecFileSyncOptionsWithStringEncoding: the exec-options
|
|
2439
2606
|
// interface interned explicitly on the AddressInfo pattern, so a TYPED
|
|
2440
2607
|
// options value (`const commandOptions: ExecFileSyncOptions... = {...}`,
|
|
@@ -2446,7 +2613,8 @@ function mapTypeInner(type, ctx) {
|
|
|
2446
2613
|
// is string[]; unsupported runtime modes throw at the call), and the
|
|
2447
2614
|
// accepted-but-inert maxBuffer/windowsHide. Members outside this set
|
|
2448
2615
|
// (env, killSignal, shell, uid, ...) keep the shape unmatched — their
|
|
2449
|
-
// literals fence at the shape check instead of
|
|
2616
|
+
// literals fence at the shape check instead of being dropped without a
|
|
2617
|
+
// diagnostic.
|
|
2450
2618
|
if (isStdlibInterface("ExecFileSyncOptionsWithStringEncoding")) {
|
|
2451
2619
|
const optStr = withUndefinedArm(STRING, ctx.unions);
|
|
2452
2620
|
const optNum = withUndefinedArm(F64, ctx.unions);
|
|
@@ -2478,6 +2646,30 @@ function mapTypeInner(type, ctx) {
|
|
|
2478
2646
|
], false, undefined, ["address", "family", "port"]),
|
|
2479
2647
|
};
|
|
2480
2648
|
}
|
|
2649
|
+
// net's 'drop' payload: the record the runtime's address object checks
|
|
2650
|
+
// into, each optional field with its declared type.
|
|
2651
|
+
if (isStdlibInterface("DropArgument")) {
|
|
2652
|
+
const known = [
|
|
2653
|
+
"localAddress",
|
|
2654
|
+
"localPort",
|
|
2655
|
+
"localFamily",
|
|
2656
|
+
"remoteAddress",
|
|
2657
|
+
"remotePort",
|
|
2658
|
+
"remoteFamily",
|
|
2659
|
+
];
|
|
2660
|
+
const fields = [];
|
|
2661
|
+
for (const property of checker.getPropertiesOfType(widened)) {
|
|
2662
|
+
if (!known.includes(property.name))
|
|
2663
|
+
return null;
|
|
2664
|
+
const type = mapType(checker.getTypeOfSymbol(property), ctx);
|
|
2665
|
+
if (!type)
|
|
2666
|
+
return null;
|
|
2667
|
+
fields.push({ name: property.name, type });
|
|
2668
|
+
}
|
|
2669
|
+
const order = fields.map((field) => field.name);
|
|
2670
|
+
fields.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
2671
|
+
return { kind: "record", shapeId: ctx.shapes.intern(fields, false, undefined, order) };
|
|
2672
|
+
}
|
|
2481
2673
|
// Filesystem options are data records. Keep their declared optional fields
|
|
2482
2674
|
// instead of allowing arbitrary standard-library interfaces into records.
|
|
2483
2675
|
if ((psym?.name === "FileReadOptions" ||
|
|
@@ -2556,10 +2748,11 @@ function mapTypeInner(type, ctx) {
|
|
|
2556
2748
|
// hidden %dtype field carries the entry kind (libuv's UV_DIRENT
|
|
2557
2749
|
// encoding) that the isFile/isDirectory/isSymbolicLink call lowerings
|
|
2558
2750
|
// read (lowerDirentMethodCall — the StringDecoder pattern, so the
|
|
2559
|
-
// %-field never surfaces through the lowered Dirent surface itself
|
|
2560
|
-
//
|
|
2561
|
-
//
|
|
2562
|
-
//
|
|
2751
|
+
// %-field never surfaces through the lowered Dirent surface itself).
|
|
2752
|
+
// A row converted to dyn takes Node's Dirent prototype and Symbol(type)
|
|
2753
|
+
// key, with %dtype non-enumerable (scr_dyn_dirent_finish), and inspect
|
|
2754
|
+
// renders rows through that view. @types/node declares Dirent<Name>
|
|
2755
|
+
// generic over the name's encoding — only the string instantiation maps (the
|
|
2563
2756
|
// encoding:'buffer' readdir form has no lowering); the shipped fallback
|
|
2564
2757
|
// declares it concrete (an interface; @types/node uses a class — both
|
|
2565
2758
|
// provenance-checked, the Buffer/URL pattern).
|
|
@@ -2679,6 +2872,31 @@ function mapTypeInner(type, ctx) {
|
|
|
2679
2872
|
], false, undefined, ["fingerprint", "validFrom", "validTo"]),
|
|
2680
2873
|
};
|
|
2681
2874
|
}
|
|
2875
|
+
// perf_hooks' PerformanceEntry, PerformanceMark and PerformanceMeasure
|
|
2876
|
+
// (performance.mark/measure and the getEntries family): ONE record shape
|
|
2877
|
+
// for the three classes, so marks and measures share PerformanceEntry[]
|
|
2878
|
+
// arrays. The visible fields are toJSON's, in its order; the hidden
|
|
2879
|
+
// marker field keeps the shape distinct from a structurally equal user
|
|
2880
|
+
// record (util.inspect names the class from entryType, like Node).
|
|
2881
|
+
// @types/node declares the classes in perf_hooks and global interfaces
|
|
2882
|
+
// over them; the shipped fallback declares the classes.
|
|
2883
|
+
if ((psym?.name === "PerformanceEntry" ||
|
|
2884
|
+
psym?.name === "PerformanceMark" ||
|
|
2885
|
+
psym?.name === "PerformanceMeasure") &&
|
|
2886
|
+
checker
|
|
2887
|
+
.declarationsOf(psym)
|
|
2888
|
+
.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2889
|
+
ctx.isStdlibFile(d.getSourceFile()))) {
|
|
2890
|
+
return { kind: "record", shapeId: perfEntryShape(ctx.shapes, ctx.unions) };
|
|
2891
|
+
}
|
|
2892
|
+
// process.memoryUsage()'s record, in Node's key order.
|
|
2893
|
+
if (isStdlibInterface("MemoryUsage")) {
|
|
2894
|
+
const names = ["rss", "heapTotal", "heapUsed", "external", "arrayBuffers"];
|
|
2895
|
+
return {
|
|
2896
|
+
kind: "record",
|
|
2897
|
+
shapeId: ctx.shapes.intern([...names].sort().map((name) => ({ name, type: F64 })), false, undefined, names),
|
|
2898
|
+
};
|
|
2899
|
+
}
|
|
2682
2900
|
// process.cpuUsage()/threadCpuUsage()'s {user, system} microsecond
|
|
2683
2901
|
// record and resourceUsage()'s getrusage record — stdlib data
|
|
2684
2902
|
// interfaces interned explicitly (the RemoteInfo pattern; declared
|
|
@@ -4436,7 +4654,7 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4436
4654
|
return DYN;
|
|
4437
4655
|
// A computed shape with NO members is not a real empty record: inside a
|
|
4438
4656
|
// generic body `Partial<T>` resolves to no members at all (keyof T is
|
|
4439
|
-
// still unknown there) — interning `{}` would
|
|
4657
|
+
// still unknown there) — interning `{}` would give a wrong type. The
|
|
4440
4658
|
// degenerate empties (`Partial<{}>`, `Omit<C, keyof C>`) go with it.
|
|
4441
4659
|
// An INDEX-SIGNATURE shape is exempt: `Record<string, T>` legitimately
|
|
4442
4660
|
// has zero declared members — the signature is the shape.
|
|
@@ -4476,8 +4694,8 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
4476
4694
|
// accessor MEMBERS map the same way so accessor records cross
|
|
4477
4695
|
// annotated boundaries (`function f(p: { get x(): number })`) —
|
|
4478
4696
|
// tsc lets a plain DATA property satisfy such a member, but the
|
|
4479
|
-
// exact-shape stance turns that into a
|
|
4480
|
-
// at the literal
|
|
4697
|
+
// exact-shape stance turns that into a shape-mismatch diagnostic
|
|
4698
|
+
// at the literal instead of an undiagnosed split. JS-file literals keep
|
|
4481
4699
|
// their existing paths (the CJS export-table narrowing and the
|
|
4482
4700
|
// checked-dynamic fallback), and .d.ts declarations stay out with
|
|
4483
4701
|
// the rest of the lib's type worlds.
|