@scriptc/compiler 0.4.0 → 0.4.2
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 +617 -83
- package/dist/backend/cycle-analysis.d.ts +2 -1
- package/dist/backend/cycle-analysis.js +4 -4
- package/dist/backend/cycle-analysis.js.map +1 -1
- package/dist/backend/cycle-mutability.d.ts +2 -1
- package/dist/backend/cycle-mutability.js +2 -2
- package/dist/backend/cycle-mutability.js.map +1 -1
- package/dist/backend/executable-features.js +10 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/immutability.d.ts +2 -1
- package/dist/backend/immutability.js +2 -2
- package/dist/backend/immutability.js.map +1 -1
- package/dist/backend/library-pack.js +7 -0
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/link-plan-core.d.ts +2 -0
- package/dist/backend/link-plan-core.js +2 -0
- package/dist/backend/link-plan-core.js.map +1 -1
- package/dist/backend/link-plan.d.ts +1 -0
- package/dist/backend/link-plan.js +1 -0
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/llvm/alloc.d.ts +7 -3
- package/dist/backend/llvm/alloc.js +7 -4
- package/dist/backend/llvm/alloc.js.map +1 -1
- package/dist/backend/llvm/array-search.js +4 -1
- package/dist/backend/llvm/array-search.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +23 -2
- package/dist/backend/llvm/bytes-loop-versions.js +115 -19
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +131 -0
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +99 -2
- package/dist/backend/llvm/classes.js +436 -57
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/classes.test.js +235 -16
- package/dist/backend/llvm/classes.test.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +21 -5
- package/dist/backend/llvm/common.js +50 -5
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.js +8 -4
- package/dist/backend/llvm/constant-callbacks.js.map +1 -1
- package/dist/backend/llvm/constant-callbacks.test.js +4 -4
- package/dist/backend/llvm/constant-callbacks.test.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +4 -1
- package/dist/backend/llvm/counted-loops.js +62 -23
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.d.ts +3 -1
- package/dist/backend/llvm/dense-array-access.js +61 -38
- package/dist/backend/llvm/dense-array-access.js.map +1 -1
- package/dist/backend/llvm/dense-array-access.test.js +4 -0
- package/dist/backend/llvm/dense-array-access.test.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.d.ts +19 -16
- package/dist/backend/llvm/dense-array-loops.js +49 -13
- package/dist/backend/llvm/dense-array-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.test.js +50 -14
- package/dist/backend/llvm/dense-array-loops.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +34 -1
- package/dist/backend/llvm/dyn.js +393 -14
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +27 -8
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-module.js +67 -39
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.d.ts +3 -25
- package/dist/backend/llvm/emit-statements.js +414 -37
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +159 -22
- package/dist/backend/llvm/emitter.js +573 -89
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +19 -0
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +5 -2
- package/dist/backend/llvm/expr-bytes.js +110 -40
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-calls.d.ts +1 -1
- package/dist/backend/llvm/expr-calls.js +51 -26
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.js +27 -14
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-control.js +2 -3
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +95 -5
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +29 -11
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +55 -0
- package/dist/backend/llvm/expr-primitives.test.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +48 -20
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +131 -35
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/integer-clones.js +3 -3
- package/dist/backend/llvm/integer-clones.js.map +1 -1
- package/dist/backend/llvm/js-ic.d.ts +18 -0
- package/dist/backend/llvm/js-ic.js +712 -0
- package/dist/backend/llvm/js-ic.js.map +1 -0
- package/dist/backend/llvm/jsval.js +139 -11
- package/dist/backend/llvm/jsval.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +10 -0
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +61 -0
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.d.ts +4 -0
- package/dist/backend/llvm/lib-http2.js +20 -17
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +69 -17
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +75 -1
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +65 -28
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +23 -0
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.js +91 -61
- package/dist/backend/llvm/local-array-reads.js.map +1 -1
- package/dist/backend/llvm/local-array-reads.test.js +14 -0
- package/dist/backend/llvm/local-array-reads.test.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +20 -4
- package/dist/backend/llvm/map-number-lookup.js +43 -7
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/narrow-guards.js +64 -0
- package/dist/backend/llvm/narrow-guards.js.map +1 -1
- package/dist/backend/llvm/publish.d.ts +11 -1
- package/dist/backend/llvm/publish.js +80 -22
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/publish.test.js +3 -0
- package/dist/backend/llvm/publish.test.js.map +1 -1
- package/dist/backend/llvm/receivers.js +1 -1
- package/dist/backend/llvm/receivers.js.map +1 -1
- package/dist/backend/llvm/reference-writes.js +2 -0
- package/dist/backend/llvm/reference-writes.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.js +161 -14
- package/dist/backend/llvm/regex-matchers.js.map +1 -1
- package/dist/backend/llvm/regex-matchers.test.js +18 -0
- package/dist/backend/llvm/regex-matchers.test.js.map +1 -1
- package/dist/backend/llvm/regions.js +2 -2
- package/dist/backend/llvm/regions.js.map +1 -1
- package/dist/backend/llvm/regions.test.js +7 -1
- package/dist/backend/llvm/regions.test.js.map +1 -1
- package/dist/backend/llvm/shapes.d.ts +17 -9
- package/dist/backend/llvm/shapes.js +21 -17
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +20 -1
- package/dist/backend/llvm/speculative-integers.js +94 -6
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.test.js +55 -1
- package/dist/backend/llvm/speculative-integers.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +2 -1
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +4 -1
- package/dist/backend/llvm/string-reads.js +88 -4
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/thread-slots.test.js +5 -4
- package/dist/backend/llvm/thread-slots.test.js.map +1 -1
- package/dist/backend/llvm/wasm-modules.d.ts +6 -5
- package/dist/backend/llvm/wasm-modules.js +32 -9
- package/dist/backend/llvm/wasm-modules.js.map +1 -1
- package/dist/backend/mangle.d.ts +8 -0
- package/dist/backend/mangle.js +12 -0
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +40 -2
- package/dist/backend/native/executable.js +40 -7
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +3 -1
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +17 -6
- package/dist/backend/native-codegen.js +55 -9
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +18 -14
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +30 -2
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-profile.d.ts +32 -0
- package/dist/backend/native-profile.js +39 -0
- package/dist/backend/native-profile.js.map +1 -0
- package/dist/backend/native-profile.test.d.ts +1 -0
- package/dist/backend/native-profile.test.js +58 -0
- package/dist/backend/native-profile.test.js.map +1 -0
- package/dist/backend/native-tools.d.ts +14 -0
- package/dist/backend/native-tools.js +13 -0
- package/dist/backend/native-tools.js.map +1 -1
- package/dist/backend/optimization.d.ts +2 -2
- 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 +4 -0
- package/dist/backend/runtime-pack-core.js +4 -0
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-targets.test.js +7 -1
- package/dist/backend/runtime-pack-targets.test.js.map +1 -1
- package/dist/backend/runtime-pack.d.ts +0 -21
- package/dist/backend/runtime-pack.js +0 -29
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +12 -69
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.js +38 -1
- package/dist/backend/target-diagnostics.js.map +1 -1
- package/dist/backend/warm-cache.js +6 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +89 -7
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/host.d.ts +3 -0
- package/dist/cli/output-options.d.ts +2 -0
- package/dist/cli/output-options.js +9 -0
- package/dist/cli/output-options.js.map +1 -1
- package/dist/cli/usage.d.ts +15 -1
- package/dist/cli/usage.js +30 -2
- package/dist/cli/usage.js.map +1 -1
- package/dist/compile-types.d.ts +9 -0
- package/dist/contracts/check.js +2 -3
- package/dist/contracts/check.js.map +1 -1
- package/dist/coverage/report.d.ts +7 -2
- package/dist/coverage/report.js +18 -0
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +1 -0
- package/dist/coverage/verdict-cache.js +4 -0
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/coverage/verdict-semantic.js +4 -0
- package/dist/coverage/verdict-semantic.js.map +1 -1
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/dynamic-tier.d.ts +40 -0
- package/dist/diagnostics/dynamic-tier.js +57 -0
- package/dist/diagnostics/dynamic-tier.js.map +1 -0
- package/dist/diagnostics/envelope.d.ts +2 -1
- package/dist/diagnostics/envelope.js +5 -2
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +32 -0
- package/dist/executable/executable-cache.js +65 -7
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +50 -3
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +3 -1
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +1 -0
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/arguments-usage.d.ts +8 -0
- package/dist/frontend/arguments-usage.js +98 -0
- package/dist/frontend/arguments-usage.js.map +1 -1
- package/dist/frontend/arguments-usage.test.d.ts +1 -0
- package/dist/frontend/arguments-usage.test.js +32 -0
- package/dist/frontend/arguments-usage.test.js.map +1 -0
- package/dist/frontend/builtin-package-aliases.d.ts +24 -0
- package/dist/frontend/builtin-package-aliases.js +133 -0
- package/dist/frontend/builtin-package-aliases.js.map +1 -0
- package/dist/frontend/builtin-package-aliases.test.d.ts +1 -0
- package/dist/frontend/builtin-package-aliases.test.js +48 -0
- package/dist/frontend/builtin-package-aliases.test.js.map +1 -0
- package/dist/frontend/dispose-hook.d.ts +2 -0
- package/dist/frontend/dispose-hook.js +14 -0
- package/dist/frontend/dispose-hook.js.map +1 -0
- package/dist/frontend/dts-paths.d.ts +4 -0
- package/dist/frontend/dts-paths.js +9 -1
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/jsx-entities.d.ts +4 -0
- package/dist/frontend/jsx-entities.js +259 -0
- package/dist/frontend/jsx-entities.js.map +1 -0
- package/dist/frontend/jsx-source.d.ts +71 -0
- package/dist/frontend/jsx-source.js +781 -0
- package/dist/frontend/jsx-source.js.map +1 -0
- package/dist/frontend/jsx-source.test.d.ts +1 -0
- package/dist/frontend/jsx-source.test.js +200 -0
- package/dist/frontend/jsx-source.test.js.map +1 -0
- package/dist/frontend/literal-values.test.js +8 -9
- package/dist/frontend/literal-values.test.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.js +2 -1
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
- package/dist/frontend/lowering/array-values.js +3 -2
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.d.ts +1 -1
- package/dist/frontend/lowering/binding-analysis.js +2 -2
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/builtins/arguments.d.ts +3 -0
- package/dist/frontend/lowering/builtins/arguments.js +30 -15
- package/dist/frontend/lowering/builtins/arguments.js.map +1 -1
- package/dist/frontend/lowering/builtins/atomics.js +10 -6
- package/dist/frontend/lowering/builtins/atomics.js.map +1 -1
- package/dist/frontend/lowering/builtins/builtin-class-dyn.d.ts +8 -0
- package/dist/frontend/lowering/builtins/builtin-class-dyn.js +50 -1
- package/dist/frontend/lowering/builtins/builtin-class-dyn.js.map +1 -1
- package/dist/frontend/lowering/builtins/callable-aliases.js +3 -2
- package/dist/frontend/lowering/builtins/callable-aliases.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-async.js +2 -1
- package/dist/frontend/lowering/builtins/child-process-async.js.map +1 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js +2 -1
- package/dist/frontend/lowering/builtins/child-process-sync.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.d.ts +7 -2
- package/dist/frontend/lowering/builtins/crypto.js +63 -4
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/date-classes.d.ts +46 -0
- package/dist/frontend/lowering/builtins/date-classes.js +477 -0
- package/dist/frontend/lowering/builtins/date-classes.js.map +1 -0
- package/dist/frontend/lowering/builtins/dates.d.ts +11 -1
- package/dist/frontend/lowering/builtins/dates.js +55 -26
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/dh.d.ts +15 -0
- package/dist/frontend/lowering/builtins/dh.js +151 -0
- package/dist/frontend/lowering/builtins/dh.js.map +1 -0
- package/dist/frontend/lowering/builtins/disposable-stack.js +2 -1
- package/dist/frontend/lowering/builtins/disposable-stack.js.map +1 -1
- package/dist/frontend/lowering/builtins/ecdh.d.ts +21 -0
- package/dist/frontend/lowering/builtins/ecdh.js +208 -0
- package/dist/frontend/lowering/builtins/ecdh.js.map +1 -0
- package/dist/frontend/lowering/builtins/errors.d.ts +15 -0
- package/dist/frontend/lowering/builtins/errors.js +110 -0
- package/dist/frontend/lowering/builtins/errors.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.d.ts +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +23 -17
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem.js +6 -4
- package/dist/frontend/lowering/builtins/filesystem.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-paths.d.ts +15 -0
- package/dist/frontend/lowering/builtins/fs-paths.js +209 -0
- package/dist/frontend/lowering/builtins/fs-paths.js.map +1 -0
- package/dist/frontend/lowering/builtins/hash-stream.d.ts +16 -4
- package/dist/frontend/lowering/builtins/hash-stream.js +86 -23
- package/dist/frontend/lowering/builtins/hash-stream.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.js +54 -1
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/key-object.d.ts +2 -1
- package/dist/frontend/lowering/builtins/key-object.js +20 -7
- package/dist/frontend/lowering/builtins/key-object.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +11 -4
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/numbers.js +9 -5
- package/dist/frontend/lowering/builtins/numbers.js.map +1 -1
- package/dist/frontend/lowering/builtins/operating-system.js +4 -3
- package/dist/frontend/lowering/builtins/operating-system.js.map +1 -1
- package/dist/frontend/lowering/builtins/performance.js +3 -2
- package/dist/frontend/lowering/builtins/performance.js.map +1 -1
- package/dist/frontend/lowering/builtins/process.d.ts +9 -0
- package/dist/frontend/lowering/builtins/process.js +47 -2
- package/dist/frontend/lowering/builtins/process.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.js +3 -2
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/promisify-callback.d.ts +3 -0
- package/dist/frontend/lowering/builtins/promisify-callback.js +23 -4
- package/dist/frontend/lowering/builtins/promisify-callback.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +2 -1
- package/dist/frontend/lowering/builtins/readline.js +23 -6
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/reflection.js +26 -0
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
- package/dist/frontend/lowering/builtins/strings.js +13 -5
- package/dist/frontend/lowering/builtins/strings.js.map +1 -1
- package/dist/frontend/lowering/builtins/text-codecs.js +2 -1
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
- package/dist/frontend/lowering/builtins/timers.js +6 -2
- package/dist/frontend/lowering/builtins/timers.js.map +1 -1
- package/dist/frontend/lowering/builtins/typed-array-members.d.ts +7 -0
- package/dist/frontend/lowering/builtins/typed-array-members.js +160 -0
- package/dist/frontend/lowering/builtins/typed-array-members.js.map +1 -0
- package/dist/frontend/lowering/builtins/url.js +4 -3
- package/dist/frontend/lowering/builtins/url.js.map +1 -1
- package/dist/frontend/lowering/builtins/v8.js +2 -1
- package/dist/frontend/lowering/builtins/v8.js.map +1 -1
- package/dist/frontend/lowering/builtins/webcrypto.js +39 -20
- package/dist/frontend/lowering/builtins/webcrypto.js.map +1 -1
- package/dist/frontend/lowering/call-arguments.js +2 -1
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.d.ts +4 -0
- package/dist/frontend/lowering/call-signatures.js +137 -13
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/caught-value-dispatch.d.ts +18 -1
- package/dist/frontend/lowering/caught-value-dispatch.js +201 -32
- package/dist/frontend/lowering/caught-value-dispatch.js.map +1 -1
- package/dist/frontend/lowering/cjs-exports-object.js +34 -1
- package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
- package/dist/frontend/lowering/class-assertions.js +3 -2
- package/dist/frontend/lowering/class-assertions.js.map +1 -1
- package/dist/frontend/lowering/class-construction.d.ts +2 -1
- package/dist/frontend/lowering/class-construction.js +8 -13
- package/dist/frontend/lowering/class-construction.js.map +1 -1
- package/dist/frontend/lowering/class-descriptors.js +1 -1
- package/dist/frontend/lowering/class-descriptors.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +34 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +577 -152
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +77 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +3 -0
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +1 -1
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +17 -0
- package/dist/frontend/lowering/class-protocols.js +117 -7
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.d.ts +5 -0
- package/dist/frontend/lowering/class-prototypes.js +42 -4
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-to-primitive.d.ts +2 -2
- package/dist/frontend/lowering/class-to-primitive.js +31 -8
- package/dist/frontend/lowering/class-to-primitive.js.map +1 -1
- package/dist/frontend/lowering/class-unions.js +2 -1
- package/dist/frontend/lowering/class-unions.js.map +1 -1
- package/dist/frontend/lowering/coercions/fresh-spread.d.ts +13 -0
- package/dist/frontend/lowering/coercions/fresh-spread.js +95 -0
- package/dist/frontend/lowering/coercions/fresh-spread.js.map +1 -0
- package/dist/frontend/lowering/coercions/function-adapters.js +105 -75
- package/dist/frontend/lowering/coercions/function-adapters.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +8 -7
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.js +8 -7
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/collection-ingestion.js +2 -1
- package/dist/frontend/lowering/collection-ingestion.js.map +1 -1
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +15 -0
- package/dist/frontend/lowering/containers/array-callbacks.js +36 -32
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-concat.js +2 -1
- package/dist/frontend/lowering/containers/array-concat.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.js +32 -4
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +11 -5
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +2 -1
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +10 -1
- package/dist/frontend/lowering/containers/bytes.js +601 -24
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +52 -2
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-grouping.js +3 -2
- package/dist/frontend/lowering/containers/collection-grouping.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +80 -10
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +8 -7
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +32 -1
- package/dist/frontend/lowering/containers/iterator-helpers.js +6 -5
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js +85 -22
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +2 -1
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.d.ts +26 -10
- package/dist/frontend/lowering/cycle-initialization.js +177 -39
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.d.ts +18 -1
- package/dist/frontend/lowering/deferred-module-initializers.js +226 -115
- 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/dispatch-sites.d.ts +59 -0
- package/dist/frontend/lowering/dispatch-sites.js +204 -0
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -0
- package/dist/frontend/lowering/dispatch-sites.test.d.ts +1 -0
- package/dist/frontend/lowering/dispatch-sites.test.js +59 -0
- package/dist/frontend/lowering/dispatch-sites.test.js.map +1 -0
- package/dist/frontend/lowering/dyn-streams.d.ts +3 -0
- package/dist/frontend/lowering/dyn-streams.js +1 -1
- package/dist/frontend/lowering/dyn-streams.js.map +1 -1
- package/dist/frontend/lowering/dynamic-tier.d.ts +25 -0
- package/dist/frontend/lowering/dynamic-tier.js +327 -0
- package/dist/frontend/lowering/dynamic-tier.js.map +1 -0
- package/dist/frontend/lowering/error-methods.js +4 -0
- package/dist/frontend/lowering/error-methods.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.js +48 -13
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +124 -8
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +30 -7
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +46 -7
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/keyed-field-targets.d.ts +14 -2
- package/dist/frontend/lowering/expressions/keyed-field-targets.js +91 -10
- package/dist/frontend/lowering/expressions/keyed-field-targets.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.js +52 -7
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.d.ts +0 -3
- package/dist/frontend/lowering/expressions/object-literals.js +75 -7
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +17 -8
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.d.ts +5 -4
- package/dist/frontend/lowering/expressions/property-access.js +351 -16
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +112 -9
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +13 -0
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +64 -10
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/generator-delegation.d.ts +8 -0
- package/dist/frontend/lowering/generator-delegation.js +191 -1
- package/dist/frontend/lowering/generator-delegation.js.map +1 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +6 -1
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +20 -30
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.d.ts +46 -1
- package/dist/frontend/lowering/generic-functions.js +660 -73
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/handle-properties.d.ts +24 -0
- package/dist/frontend/lowering/handle-properties.js +281 -0
- package/dist/frontend/lowering/handle-properties.js.map +1 -0
- package/dist/frontend/lowering/intern-tables.js +2 -1
- package/dist/frontend/lowering/intern-tables.js.map +1 -1
- package/dist/frontend/lowering/iterable-spelling.d.ts +7 -0
- package/dist/frontend/lowering/iterable-spelling.js +38 -0
- package/dist/frontend/lowering/iterable-spelling.js.map +1 -0
- package/dist/frontend/lowering/iterator-adapters.js +9 -8
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/js-dynamic-objects.js +3 -2
- package/dist/frontend/lowering/js-dynamic-objects.js.map +1 -1
- package/dist/frontend/lowering/json-require.js +2 -1
- package/dist/frontend/lowering/json-require.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.d.ts +7 -2
- package/dist/frontend/lowering/key-order-witness.js +21 -4
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +38 -2
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- package/dist/frontend/lowering/lifetime-regions.js +2 -1
- package/dist/frontend/lowering/lifetime-regions.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.d.ts +33 -15
- package/dist/frontend/lowering/lower-array-sort.js +117 -21
- package/dist/frontend/lowering/lower-array-sort.js.map +1 -1
- package/dist/frontend/lowering/lower-array-sort.test.js +93 -14
- package/dist/frontend/lowering/lower-array-sort.test.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.js +6 -5
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js +3 -1
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +1 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +4 -0
- package/dist/frontend/lowering/lower-calls.js +504 -97
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +22 -0
- package/dist/frontend/lowering/lower-classes.js +339 -32
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.js +65 -15
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +14 -0
- package/dist/frontend/lowering/lower-event-emitter.js +267 -20
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +19 -2
- package/dist/frontend/lowering/lower-exprs.js +148 -12
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +308 -72
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +10 -4
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.js +578 -16
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.js +2 -1
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-mock.js +2 -1
- package/dist/frontend/lowering/lower-mock.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +11 -3
- package/dist/frontend/lowering/lower-modules.js +227 -72
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.js +2 -2
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +2 -1
- package/dist/frontend/lowering/lower-namespaces.js +24 -3
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +10 -0
- package/dist/frontend/lowering/lower-server.js +263 -60
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.js +39 -18
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +7 -10
- package/dist/frontend/lowering/lower-stmts.js +584 -69
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js +1 -1
- package/dist/frontend/lowering/lower-stmts.test.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +575 -165
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-timers.js +21 -4
- package/dist/frontend/lowering/lower-timers.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +151 -30
- package/dist/frontend/lowering/lowerer.js +725 -84
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +21 -9
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/narrowing-stability.js +5 -0
- package/dist/frontend/lowering/narrowing-stability.js.map +1 -1
- package/dist/frontend/lowering/native-ffi.js +1 -1
- package/dist/frontend/lowering/native-ffi.js.map +1 -1
- package/dist/frontend/lowering/object-enumeration-receiver.js +2 -1
- package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -1
- package/dist/frontend/lowering/pairs-snapshot.js +2 -1
- package/dist/frontend/lowering/pairs-snapshot.js.map +1 -1
- package/dist/frontend/lowering/private-brands.d.ts +9 -0
- package/dist/frontend/lowering/private-brands.js +66 -15
- package/dist/frontend/lowering/private-brands.js.map +1 -1
- package/dist/frontend/lowering/promise-executor-adapter.js +2 -1
- package/dist/frontend/lowering/promise-executor-adapter.js.map +1 -1
- package/dist/frontend/lowering/rebindable-functions.d.ts +8 -0
- package/dist/frontend/lowering/rebindable-functions.js +54 -0
- package/dist/frontend/lowering/rebindable-functions.js.map +1 -0
- package/dist/frontend/lowering/require-initialization.js +2 -1
- package/dist/frontend/lowering/require-initialization.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-elements.d.ts +5 -0
- package/dist/frontend/lowering/runtime-optional-elements.js +17 -1
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-records.d.ts +2 -0
- package/dist/frontend/lowering/runtime-optional-records.js +18 -5
- package/dist/frontend/lowering/runtime-optional-records.js.map +1 -1
- package/dist/frontend/lowering/site-dependencies.d.ts +35 -0
- package/dist/frontend/lowering/site-dependencies.js +84 -0
- package/dist/frontend/lowering/site-dependencies.js.map +1 -0
- package/dist/frontend/lowering/site-dependencies.test.d.ts +1 -0
- package/dist/frontend/lowering/site-dependencies.test.js +53 -0
- package/dist/frontend/lowering/site-dependencies.test.js.map +1 -0
- package/dist/frontend/lowering/stable-names.d.ts +11 -0
- package/dist/frontend/lowering/stable-names.js +35 -0
- package/dist/frontend/lowering/stable-names.js.map +1 -0
- package/dist/frontend/lowering/static-typeof.d.ts +26 -0
- package/dist/frontend/lowering/static-typeof.js +172 -0
- package/dist/frontend/lowering/static-typeof.js.map +1 -0
- package/dist/frontend/lowering/strict-equality.js +2 -1
- package/dist/frontend/lowering/strict-equality.js.map +1 -1
- package/dist/frontend/lowering/string-index-bounds.js +3 -2
- package/dist/frontend/lowering/string-index-bounds.js.map +1 -1
- package/dist/frontend/lowering/structural-positions.d.ts +32 -0
- package/dist/frontend/lowering/structural-positions.js +108 -0
- package/dist/frontend/lowering/structural-positions.js.map +1 -0
- package/dist/frontend/lowering/surfaces.js +72 -30
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/thenables.d.ts +16 -0
- package/dist/frontend/lowering/thenables.js +124 -0
- package/dist/frontend/lowering/thenables.js.map +1 -0
- package/dist/frontend/lowering/var-hoisting.js +37 -3
- package/dist/frontend/lowering/var-hoisting.js.map +1 -1
- package/dist/frontend/npm-static-builtin-aliases.d.ts +8 -0
- package/dist/frontend/npm-static-builtin-aliases.js +65 -0
- package/dist/frontend/npm-static-builtin-aliases.js.map +1 -0
- package/dist/frontend/npm-static-bundled-chunks.d.ts +8 -1
- package/dist/frontend/npm-static-bundled-chunks.js +173 -2
- package/dist/frontend/npm-static-bundled-chunks.js.map +1 -1
- package/dist/frontend/npm-static-bundled-chunks.test.js +112 -0
- package/dist/frontend/npm-static-bundled-chunks.test.js.map +1 -1
- package/dist/frontend/npm-static-bundled-esm.js +224 -4
- package/dist/frontend/npm-static-bundled-esm.js.map +1 -1
- package/dist/frontend/npm-static-bundled-esm.test.js +129 -0
- package/dist/frontend/npm-static-bundled-esm.test.js.map +1 -1
- package/dist/frontend/npm-static-enum-iife.d.ts +6 -0
- package/dist/frontend/npm-static-enum-iife.js +280 -0
- package/dist/frontend/npm-static-enum-iife.js.map +1 -0
- package/dist/frontend/npm-static-enum-iife.test.d.ts +1 -0
- package/dist/frontend/npm-static-enum-iife.test.js +116 -0
- package/dist/frontend/npm-static-enum-iife.test.js.map +1 -0
- package/dist/frontend/npm-static-tsc-helpers.d.ts +5 -0
- package/dist/frontend/npm-static-tsc-helpers.js +106 -0
- package/dist/frontend/npm-static-tsc-helpers.js.map +1 -0
- package/dist/frontend/npm-static-tsc-helpers.test.d.ts +1 -0
- package/dist/frontend/npm-static-tsc-helpers.test.js +58 -0
- package/dist/frontend/npm-static-tsc-helpers.test.js.map +1 -0
- package/dist/frontend/npm-static-type-exports-host.d.ts +8 -0
- package/dist/frontend/npm-static-type-exports-host.js +214 -0
- package/dist/frontend/npm-static-type-exports-host.js.map +1 -0
- package/dist/frontend/npm-static-type-exports-host.test.d.ts +1 -0
- package/dist/frontend/npm-static-type-exports-host.test.js +53 -0
- package/dist/frontend/npm-static-type-exports-host.test.js.map +1 -0
- package/dist/frontend/npm-static-type-exports.d.ts +52 -0
- package/dist/frontend/npm-static-type-exports.js +261 -0
- package/dist/frontend/npm-static-type-exports.js.map +1 -0
- package/dist/frontend/npm-static-type-exports.test.d.ts +1 -0
- package/dist/frontend/npm-static-type-exports.test.js +103 -0
- package/dist/frontend/npm-static-type-exports.test.js.map +1 -0
- package/dist/frontend/npm-static-umd.d.ts +6 -0
- package/dist/frontend/npm-static-umd.js +203 -0
- package/dist/frontend/npm-static-umd.js.map +1 -0
- package/dist/frontend/npm-static-umd.test.d.ts +1 -0
- package/dist/frontend/npm-static-umd.test.js +105 -0
- package/dist/frontend/npm-static-umd.test.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +16 -0
- package/dist/frontend/npm-static.js +93 -3
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.js +13 -0
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +47 -0
- package/dist/frontend/package-shims.js +300 -0
- package/dist/frontend/package-shims.js.map +1 -0
- package/dist/frontend/pipeline.js +67 -1
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program.d.ts +21 -0
- package/dist/frontend/program.js +174 -14
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +1 -1
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/resolve.js +13 -0
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/services.d.ts +12 -0
- package/dist/frontend/services.js +37 -0
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/ts7/ast-node.d.ts +21 -7
- package/dist/frontend/ts7/ast-node.js +131 -29
- package/dist/frontend/ts7/ast-node.js.map +1 -1
- package/dist/frontend/ts7/ast-node.test.js +60 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -1
- package/dist/frontend/ts7/ast-wire.d.ts +27 -2
- package/dist/frontend/ts7/ast-wire.js +124 -21
- package/dist/frontend/ts7/ast-wire.js.map +1 -1
- package/dist/frontend/ts7/ast.d.ts +23 -2
- package/dist/frontend/ts7/ast.js +143 -2
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/checker.d.ts +13 -1
- package/dist/frontend/ts7/checker.js +75 -1
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.js +9 -6
- package/dist/frontend/ts7/checker.test.js.map +1 -1
- package/dist/frontend/ts7/enums.d.ts +3 -3
- package/dist/frontend/ts7/enums.generated.d.ts +10 -0
- package/dist/frontend/ts7/enums.generated.js +21 -0
- package/dist/frontend/ts7/enums.generated.js.map +1 -1
- package/dist/frontend/ts7/enums.js +19 -0
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +6 -5
- package/dist/frontend/ts7/program-host.js +12 -2
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/semantic-checker.d.ts +10 -0
- package/dist/frontend/ts7/semantic-checker.js +25 -20
- package/dist/frontend/ts7/semantic-checker.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +13 -0
- package/dist/frontend/ts7/semantic-json.js +146 -0
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.test.js +57 -1
- package/dist/frontend/ts7/semantic-json.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.d.ts +18 -0
- package/dist/frontend/ts7/semantic-model.js +90 -16
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +3 -2
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/session.d.ts +19 -4
- package/dist/frontend/ts7/session.js +1 -1
- package/dist/frontend/ts7/session.js.map +1 -1
- package/dist/frontend/tsc-codes.d.ts +1 -1
- package/dist/frontend/tsc-codes.js +7 -0
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +38 -6
- package/dist/frontend/type-mapper.js +466 -47
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +1 -1
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend-process-args.d.ts +4 -0
- package/dist/frontend-process-args.js +52 -0
- package/dist/frontend-process-args.js.map +1 -0
- package/dist/frontend-process-args.test.d.ts +1 -0
- package/dist/frontend-process-args.test.js +47 -0
- package/dist/frontend-process-args.test.js.map +1 -0
- package/dist/frontend-process.d.ts +1 -0
- package/dist/frontend-process.js +23 -0
- package/dist/frontend-process.js.map +1 -0
- package/dist/heap-collection.d.ts +16 -0
- package/dist/heap-collection.js +42 -0
- package/dist/heap-collection.js.map +1 -0
- package/dist/heap-collection.test.d.ts +1 -0
- package/dist/heap-collection.test.js +59 -0
- package/dist/heap-collection.test.js.map +1 -0
- package/dist/heap-pressure.d.ts +2 -0
- package/dist/heap-pressure.js +12 -0
- package/dist/heap-pressure.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +453 -85
- package/dist/index.js.map +1 -1
- package/dist/ir/array-length-stability.d.ts +3 -2
- package/dist/ir/array-length-stability.js +22 -2
- package/dist/ir/array-length-stability.js.map +1 -1
- package/dist/ir/array-length-stability.test.js +47 -1
- package/dist/ir/array-length-stability.test.js.map +1 -1
- package/dist/ir/builtin-effects.js +41 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +5 -1
- package/dist/ir/builtin-signatures.js +187 -16
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/final-fields.d.ts +2 -1
- package/dist/ir/final-fields.js +2 -2
- package/dist/ir/final-fields.js.map +1 -1
- package/dist/ir/function-references.test.js +2 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/int32-slots.d.ts +13 -5
- package/dist/ir/int32-slots.js +112 -115
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +3 -1
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-loop-facts.d.ts +14 -4
- package/dist/ir/integer-loop-facts.js +172 -32
- package/dist/ir/integer-loop-facts.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +49 -0
- package/dist/ir/integer-loops.js +193 -39
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +201 -1
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.d.ts +10 -1
- package/dist/ir/integer-ranges.js +122 -25
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +255 -1
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +17 -2
- package/dist/ir/ir.js +11 -1
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/js-ic.d.ts +52 -0
- package/dist/ir/js-ic.js +199 -0
- package/dist/ir/js-ic.js.map +1 -0
- package/dist/ir/js-ic.test.d.ts +1 -0
- package/dist/ir/js-ic.test.js +148 -0
- package/dist/ir/js-ic.test.js.map +1 -0
- package/dist/ir/jsval.js +38 -4
- package/dist/ir/jsval.js.map +1 -1
- package/dist/ir/runtime-features.d.ts +64 -5
- package/dist/ir/runtime-features.js +358 -101
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/tiers.js +1 -0
- package/dist/ir/tiers.js.map +1 -1
- package/dist/ir/traverse.d.ts +2 -0
- package/dist/ir/traverse.js +124 -70
- package/dist/ir/traverse.js.map +1 -1
- package/dist/ir/validate.js +77 -24
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +15 -2
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/ir-policy.js +11 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-cache.d.ts +2 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/prepare.js +2 -0
- package/dist/library/prepare.js.map +1 -1
- package/dist/native/cli.js +22 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.js +33 -4
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/executable-cache.js +3 -0
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/prepare.js +8 -1
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/sanitizer.test.js +10 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/startup-cache.d.ts +1 -0
- package/dist/startup-cache.js +1 -0
- package/dist/startup-cache.js.map +1 -1
- package/dist/text-parts.d.ts +7 -0
- package/dist/text-parts.js +44 -0
- package/dist/text-parts.js.map +1 -1
- package/dist/text-parts.test.d.ts +1 -0
- package/dist/text-parts.test.js +46 -0
- package/dist/text-parts.test.js.map +1 -0
- package/dist/timing.d.ts +9 -2
- package/dist/timing.js +7 -4
- package/dist/timing.js.map +1 -1
- package/dist/wasm/translate.d.ts +4 -0
- package/dist/wasm/translate.js +2 -2
- package/dist/wasm/translate.js.map +1 -1
- package/package.json +22 -21
- package/shims/fs-extra/core/api.ts +1192 -0
- package/shims/fs-extra/index.ts +9 -0
- package/shims/undici/core/agent.ts +163 -0
- package/shims/undici/core/api.ts +93 -0
- package/shims/undici/core/client.ts +1304 -0
- package/shims/undici/core/connector.ts +157 -0
- package/shims/undici/core/diagnostics-types.ts +68 -0
- package/shims/undici/core/diagnostics.ts +16 -0
- package/shims/undici/core/dispatcher.ts +574 -0
- package/shims/undici/core/errors-v5.ts +22 -0
- package/shims/undici/core/errors-v7.ts +25 -0
- package/shims/undici/core/errors.ts +255 -0
- package/shims/undici/core/fetch.ts +635 -0
- package/shims/undici/core/pool.ts +280 -0
- package/shims/undici/core/readable.ts +268 -0
- package/shims/undici/core/request.ts +313 -0
- package/shims/undici/core/timers.ts +80 -0
- package/shims/undici/core/types.ts +167 -0
- package/shims/undici/core/util.ts +67 -0
- package/shims/undici/v5.ts +119 -0
- package/shims/undici/v7.ts +119 -0
- package/surface-manifest.json +20 -52
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { InternalCompilerError } from "../errors.js";
|
|
2
|
+
import { keyedHelperName } from "./lowering/stable-names.js";
|
|
2
3
|
import { mockCallRecordType, mockContextType } from "./mock-shapes.js";
|
|
3
4
|
import * as ts from "./ts7/adapter.js";
|
|
4
5
|
import { bodyReadsArguments } from "./arguments-usage.js";
|
|
@@ -7,6 +8,7 @@ import { BIGINT_T } from "../ir/ir.js";
|
|
|
7
8
|
import { literalValues } from "./literal-values.js";
|
|
8
9
|
import { remapUnionDiscriminant } from "./union-discriminants.js";
|
|
9
10
|
import { isJsSourceFile, isNodeTypesPath } from "./program.js";
|
|
11
|
+
import { isProvenanceSourceFile } from "./provenance-registry.js";
|
|
10
12
|
import { functionCanReturnUndefined } from "./function-completion.js";
|
|
11
13
|
import { accessorSlotProp, recordTextCodecClass } from "../ir/ir.js";
|
|
12
14
|
// typeKey moved to ir/ir.ts (the backend needs it too, for per-type
|
|
@@ -85,6 +87,46 @@ export const WEBCRYPTO_DYN_TYPES = new Set([
|
|
|
85
87
|
"KeyAlgorithm",
|
|
86
88
|
"HmacImportParams",
|
|
87
89
|
"HmacKeyAlgorithm",
|
|
90
|
+
"CryptoKeyPair",
|
|
91
|
+
"EcKeyAlgorithm",
|
|
92
|
+
"RsaHashedKeyAlgorithm",
|
|
93
|
+
"EcKeyGenParams",
|
|
94
|
+
"EcKeyImportParams",
|
|
95
|
+
"EcdsaParams",
|
|
96
|
+
"RsaHashedKeyGenParams",
|
|
97
|
+
"RsaHashedImportParams",
|
|
98
|
+
"RsaPssParams",
|
|
99
|
+
"HmacKeyGenParams",
|
|
100
|
+
"AesKeyGenParams",
|
|
101
|
+
"AesKeyAlgorithm",
|
|
102
|
+
"JsonWebKey",
|
|
103
|
+
"AesGcmParams",
|
|
104
|
+
"AesCbcParams",
|
|
105
|
+
"AesCtrParams",
|
|
106
|
+
"Pbkdf2Params",
|
|
107
|
+
"HkdfParams",
|
|
108
|
+
"AesDerivedKeyParams",
|
|
109
|
+
]);
|
|
110
|
+
/** node:crypto's key and signature option interfaces: the key functions,
|
|
111
|
+
* KeyObject.export and sign/verify take them as checked-dynamic arguments
|
|
112
|
+
* (scr_lib.c, scr_pki.c). */
|
|
113
|
+
export const CRYPTO_KEY_OPTION_DYN_TYPES = new Set([
|
|
114
|
+
"AsymmetricKeyExportOptions",
|
|
115
|
+
"ECKeyPairKeyObjectOptions",
|
|
116
|
+
"ECKeyPairOptions",
|
|
117
|
+
"ED25519KeyPairOptions",
|
|
118
|
+
"JsonWebKeyInput",
|
|
119
|
+
"JwkKeyExportOptions",
|
|
120
|
+
"KeyExportOptions",
|
|
121
|
+
"PrivateKeyInput",
|
|
122
|
+
"PublicKeyInput",
|
|
123
|
+
"RSAKeyPairKeyObjectOptions",
|
|
124
|
+
"RSAKeyPairOptions",
|
|
125
|
+
"SignKeyObjectInput",
|
|
126
|
+
"SignPrivateKeyInput",
|
|
127
|
+
"SigningOptions",
|
|
128
|
+
"VerifyKeyObjectInput",
|
|
129
|
+
"VerifyPublicKeyInput",
|
|
88
130
|
]);
|
|
89
131
|
export const FETCH_AMBIENT_TYPES = [
|
|
90
132
|
"Response",
|
|
@@ -179,6 +221,8 @@ function comparePriority(left, right) {
|
|
|
179
221
|
export class ShapeRegistry {
|
|
180
222
|
/** Existing layouts change only when a recursive placeholder closes. */
|
|
181
223
|
revision = 0;
|
|
224
|
+
/** Each shape id with a second hash of its key (keyedHelperName). */
|
|
225
|
+
keyedNameKeys = new Map();
|
|
182
226
|
byKey = new Map();
|
|
183
227
|
byId = new Map();
|
|
184
228
|
/** Historical emit-order rank of the declaration-order metadata each
|
|
@@ -194,7 +238,7 @@ export class ShapeRegistry {
|
|
|
194
238
|
* writer after all priority candidates have closed. */
|
|
195
239
|
derivedDeclaredOrderFinalizers = [];
|
|
196
240
|
currentDeclaredOrderPriority = [0, 0];
|
|
197
|
-
/** All interned shapes in first-seen
|
|
241
|
+
/** All interned shapes in first-seen order. */
|
|
198
242
|
shapes = [];
|
|
199
243
|
/** ts.Types currently being mapped — a BACK-REFERENCE to one of these is
|
|
200
244
|
* the recursive knot (`interface TreeNode { children: TreeNode[] }`):
|
|
@@ -299,11 +343,12 @@ export class ShapeRegistry {
|
|
|
299
343
|
}
|
|
300
344
|
/** The shape id a back-reference to an in-progress type resolves to:
|
|
301
345
|
* reuses the type's persistent recursive id or mints a PLACEHOLDER
|
|
302
|
-
* entry (empty fields) the outer frame finalizes.
|
|
303
|
-
|
|
346
|
+
* entry (empty fields) the outer frame finalizes. `describe` names a new
|
|
347
|
+
* placeholder (checkerTypeDescription). */
|
|
348
|
+
recursiveRef(t, describe) {
|
|
304
349
|
let id = this.recIds.get(t);
|
|
305
350
|
if (id === undefined) {
|
|
306
|
-
id =
|
|
351
|
+
id = recursivePlaceholderName(this, "r", describe(), (name) => this.byId.has(name));
|
|
307
352
|
const shape = { id, fields: [] };
|
|
308
353
|
this.byId.set(id, shape);
|
|
309
354
|
this.shapes.push(shape);
|
|
@@ -358,7 +403,7 @@ export class ShapeRegistry {
|
|
|
358
403
|
const key = this.keyOf(fields, tuple, indexValue);
|
|
359
404
|
let id = this.byKey.get(key);
|
|
360
405
|
if (id === undefined) {
|
|
361
|
-
id =
|
|
406
|
+
id = keyedHelperName(this, "r", key, "");
|
|
362
407
|
const shape = {
|
|
363
408
|
id,
|
|
364
409
|
fields,
|
|
@@ -434,6 +479,44 @@ export class ShapeRegistry {
|
|
|
434
479
|
this.byKey.set(key, shapeId);
|
|
435
480
|
}
|
|
436
481
|
}
|
|
482
|
+
/** The id of a recursive placeholder described by `description`. Two
|
|
483
|
+
* different types can still share a description (checkerTypeDescription stops
|
|
484
|
+
* after a few levels of type arguments); the later one takes the first free
|
|
485
|
+
* name with a numbered suffix. */
|
|
486
|
+
function recursivePlaceholderName(owner, prefix, description, taken) {
|
|
487
|
+
let name = keyedHelperName(owner, prefix, `recursive:${description}`, "");
|
|
488
|
+
for (let n = 1; taken(name); n++)
|
|
489
|
+
name = keyedHelperName(owner, prefix, `recursive:${description}#${n}`, "");
|
|
490
|
+
return name;
|
|
491
|
+
}
|
|
492
|
+
/** How many levels of type arguments checkerTypeDescription describes. */
|
|
493
|
+
const RECURSIVE_NAME_DEPTH = 3;
|
|
494
|
+
/** A checker type's description for names that must not depend on checker
|
|
495
|
+
* type ids (a recursive placeholder, a generic class instance keyed by a
|
|
496
|
+
* literal): its printed form, the structural position of its first
|
|
497
|
+
* declaration, and the same for its type arguments (two instantiations
|
|
498
|
+
* print the same when their type arguments are type parameters or classes
|
|
499
|
+
* of the same name from different declarations). */
|
|
500
|
+
export function checkerTypeDescription(t, ctx, depth = 0) {
|
|
501
|
+
const symbol = t.getAliasSymbol() ?? t.getSymbol();
|
|
502
|
+
const declaration = symbol?.declarations[0];
|
|
503
|
+
const where = declaration
|
|
504
|
+
? (ctx.positionOf?.(declaration) ??
|
|
505
|
+
`${ts.getSourceFileOfNode(declaration).fileName}:${declaration.pos}`)
|
|
506
|
+
: "";
|
|
507
|
+
let description = `${ctx.checker.typeToString(t)}@${where}`;
|
|
508
|
+
if (depth < RECURSIVE_NAME_DEPTH) {
|
|
509
|
+
const aliasArguments = t.getAliasSymbol() !== undefined ? (t.getAliasTypeArguments() ?? []) : [];
|
|
510
|
+
const typeArguments = aliasArguments.length > 0
|
|
511
|
+
? aliasArguments
|
|
512
|
+
: t.isTypeReference()
|
|
513
|
+
? ctx.checker.getTypeArguments(t)
|
|
514
|
+
: [];
|
|
515
|
+
if (typeArguments.length > 0)
|
|
516
|
+
description += `<${typeArguments.map((arg) => checkerTypeDescription(arg, ctx, depth + 1)).join(",")}>`;
|
|
517
|
+
}
|
|
518
|
+
return description;
|
|
519
|
+
}
|
|
437
520
|
/** The frontend's union interner — mirrors ShapeRegistry. A union's
|
|
438
521
|
* canonical identity includes its typeKey-sorted arms and literal
|
|
439
522
|
* discriminator contract. An arm's index in that list IS its runtime tag.
|
|
@@ -441,10 +524,12 @@ export class ShapeRegistry {
|
|
|
441
524
|
export class UnionRegistry {
|
|
442
525
|
/** Existing arm/discriminator contracts change when a placeholder closes. */
|
|
443
526
|
revision = 0;
|
|
527
|
+
/** Each union id with a second hash of its key (keyedHelperName). */
|
|
528
|
+
keyedNameKeys = new Map();
|
|
444
529
|
byKey = new Map();
|
|
445
530
|
byId = new Map();
|
|
446
531
|
armTags = new Map();
|
|
447
|
-
/** All interned unions in first-seen
|
|
532
|
+
/** All interned unions in first-seen order. */
|
|
448
533
|
unions = [];
|
|
449
534
|
/** ts.Types currently being mapped — a back-reference to one is the
|
|
450
535
|
* recursive knot passing through a union (`type Tree = Leaf | Branch`
|
|
@@ -459,11 +544,12 @@ export class UnionRegistry {
|
|
|
459
544
|
pendingRec = new Set();
|
|
460
545
|
/** The union id a back-reference to an in-progress union resolves to:
|
|
461
546
|
* reuses the type's persistent recursive id or mints a PLACEHOLDER
|
|
462
|
-
* entry (empty arms) the outer frame finalizes.
|
|
463
|
-
|
|
547
|
+
* entry (empty arms) the outer frame finalizes. `describe` names a new
|
|
548
|
+
* placeholder (checkerTypeDescription). */
|
|
549
|
+
recursiveRef(t, describe) {
|
|
464
550
|
let id = this.recIds.get(t);
|
|
465
551
|
if (id === undefined) {
|
|
466
|
-
id =
|
|
552
|
+
id = recursivePlaceholderName(this, "u", describe(), (name) => this.byId.has(name));
|
|
467
553
|
const def = { id, arms: [] };
|
|
468
554
|
this.byId.set(id, def);
|
|
469
555
|
this.unions.push(def);
|
|
@@ -509,7 +595,7 @@ export class UnionRegistry {
|
|
|
509
595
|
const key = JSON.stringify([arms.map(typeKey), discriminant]);
|
|
510
596
|
let id = this.byKey.get(key);
|
|
511
597
|
if (id === undefined) {
|
|
512
|
-
id =
|
|
598
|
+
id = keyedHelperName(this, "u", key, "");
|
|
513
599
|
const def = { id, arms, ...(discriminant ? { discriminant } : {}) };
|
|
514
600
|
this.byKey.set(key, id);
|
|
515
601
|
this.byId.set(id, def);
|
|
@@ -1325,10 +1411,18 @@ export function mapType(type, ctx) {
|
|
|
1325
1411
|
if (flags & (ts.TypeFlags.Boolean | ts.TypeFlags.BooleanLiteral))
|
|
1326
1412
|
return BOOL;
|
|
1327
1413
|
}
|
|
1414
|
+
const localValue = ctx.localClassValue?.(type);
|
|
1415
|
+
if (localValue) {
|
|
1416
|
+
contextResolutions++;
|
|
1417
|
+
return localValue;
|
|
1418
|
+
}
|
|
1328
1419
|
const topLevel = mapTypeDepth === 0;
|
|
1329
1420
|
const typeId = type.id;
|
|
1330
1421
|
const memoizable = typeId !== undefined && (ctx.canMemoizeType?.() ?? true);
|
|
1331
|
-
|
|
1422
|
+
// An empty literal's type maps to the empty record as an unreduced union's
|
|
1423
|
+
// arm (emptyLiteralArm) and to the checked-dynamic value elsewhere: the two
|
|
1424
|
+
// answers keep separate memo entries.
|
|
1425
|
+
const memoKey = memoizable ? `${ctx.emptyLiteralArm ? 1 : 0}:${typeId}` : null;
|
|
1332
1426
|
if (memoKey !== null) {
|
|
1333
1427
|
const memo = ctx.typeMemo?.get(memoKey);
|
|
1334
1428
|
if (memo !== undefined)
|
|
@@ -1801,7 +1895,9 @@ function mapTypeInner(type, ctx) {
|
|
|
1801
1895
|
(ts.isInterfaceDeclaration(d) ||
|
|
1802
1896
|
ts.isTypeAliasDeclaration(d) ||
|
|
1803
1897
|
ts.isTypeLiteralNode(d) ||
|
|
1804
|
-
ts.isMappedTypeNode(d)
|
|
1898
|
+
ts.isMappedTypeNode(d) ||
|
|
1899
|
+
isDeclaredDataClass(d) ||
|
|
1900
|
+
(decls.some(isDeclaredDataClass) && isTypeOnlyNamespace(d))));
|
|
1805
1901
|
const aliasDecls = packageOnly(widened.getAliasSymbol());
|
|
1806
1902
|
const ownDecls = packageOnly(widened.getSymbol());
|
|
1807
1903
|
if ((aliasDecls !== null || (widened.getAliasSymbol() === undefined && ownDecls !== null)) &&
|
|
@@ -2117,6 +2213,25 @@ function mapTypeInner(type, ctx) {
|
|
|
2117
2213
|
return { kind: "classval", className: inst.className };
|
|
2118
2214
|
}
|
|
2119
2215
|
}
|
|
2216
|
+
// A constructable declared in the program whose instances are not one
|
|
2217
|
+
// program class's (`new () => unknown`, `abstract new () => S` over a
|
|
2218
|
+
// record, a type that also names static members such as `{ readonly
|
|
2219
|
+
// schema: unknown; new (): unknown }`, construct overloads): the class
|
|
2220
|
+
// value rides the checked-dynamic tree, as an `unknown` slot already
|
|
2221
|
+
// holds one. `new` through it and static reads dispatch at run time,
|
|
2222
|
+
// and the constructed value checks into the signature's instance type.
|
|
2223
|
+
// Lib and package constructables keep their fences, and so do those of
|
|
2224
|
+
// fetched provenance sources (third-party code under its own policies:
|
|
2225
|
+
// an unused `@__PURE__` const typed `{ new (): any }` elides there).
|
|
2226
|
+
if (ctorSigs.length > 0 &&
|
|
2227
|
+
checker.getCallSignatures(widened).length === 0 &&
|
|
2228
|
+
(widened.getSymbol()?.declarations.length ?? 0) > 0 &&
|
|
2229
|
+
widened.getSymbol().declarations.every((d) => {
|
|
2230
|
+
const sf = ts.getSourceFileOfNode(d);
|
|
2231
|
+
return ctx.isProgramFile(sf) && !isProvenanceSourceFile(sf.fileName);
|
|
2232
|
+
})) {
|
|
2233
|
+
return DYN;
|
|
2234
|
+
}
|
|
2120
2235
|
}
|
|
2121
2236
|
// Map<K, V>: a reference to the standard library's Map interface —
|
|
2122
2237
|
// provenance, not the name (a user's own `interface Map` maps as a record
|
|
@@ -2128,6 +2243,12 @@ function mapTypeInner(type, ctx) {
|
|
|
2128
2243
|
const isStdlibInterface = (name) => psym !== undefined &&
|
|
2129
2244
|
ts.symbolName(psym) === name &&
|
|
2130
2245
|
psym.declarations.some((d) => ts.isInterfaceDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)));
|
|
2246
|
+
// The timer handles: an interface in the fallback and in @types/node 22+,
|
|
2247
|
+
// a class (`class Timeout implements Timer`) in @types/node 20 and older.
|
|
2248
|
+
const isStdlibTimerHandle = (name) => psym !== undefined &&
|
|
2249
|
+
ts.symbolName(psym) === name &&
|
|
2250
|
+
psym.declarations.some((d) => (ts.isInterfaceDeclaration(d) || ts.isClassDeclaration(d)) &&
|
|
2251
|
+
ctx.isStdlibFile(ts.getSourceFileOfNode(d)));
|
|
2131
2252
|
// The builtin Error classes: references to the lib's Error interfaces map to the runtime-provided class
|
|
2132
2253
|
// hierarchy (provenance, not the name — a user's own `class Error`
|
|
2133
2254
|
// resolved through the class-instance branch above, and a user
|
|
@@ -2433,15 +2554,35 @@ function mapTypeInner(type, ctx) {
|
|
|
2433
2554
|
ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
|
|
2434
2555
|
return DYN;
|
|
2435
2556
|
}
|
|
2436
|
-
// node:crypto's KeyObject: secret keys
|
|
2437
|
-
//
|
|
2438
|
-
// that export() returns is a
|
|
2557
|
+
// node:crypto's KeyObject: secret keys (scr_lib.c) and private and
|
|
2558
|
+
// public keys (scr_pki.c) are native handles whose getters and methods
|
|
2559
|
+
// dispatch through the handle. The JsonWebKey that export() returns is a
|
|
2560
|
+
// plain checked-dynamic object.
|
|
2439
2561
|
if (((psym !== undefined && ts.symbolName(psym) === "KeyObject") ||
|
|
2440
2562
|
(psym !== undefined && ts.symbolName(psym) === "JsonWebKey")) &&
|
|
2441
2563
|
psym.declarations.some((d) => (ts.isClassDeclaration(d) || ts.isInterfaceDeclaration(d)) &&
|
|
2442
2564
|
ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
|
|
2443
2565
|
return DYN;
|
|
2444
2566
|
}
|
|
2567
|
+
// node:crypto's key and signature options are plain checked-dynamic
|
|
2568
|
+
// objects, so a value asserted to one (`opts as
|
|
2569
|
+
// crypto.AsymmetricKeyExportOptions<"pem">`) reaches the call unchanged.
|
|
2570
|
+
if (psym !== undefined &&
|
|
2571
|
+
CRYPTO_KEY_OPTION_DYN_TYPES.has(ts.symbolName(psym)) &&
|
|
2572
|
+
psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
2573
|
+
ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
|
|
2574
|
+
isDeclaredInAmbientModule(d, "crypto"))) {
|
|
2575
|
+
return DYN;
|
|
2576
|
+
}
|
|
2577
|
+
// node:crypto's Sign and Verify (createSign/createVerify): native
|
|
2578
|
+
// handles over the digest state (scr_pki.c).
|
|
2579
|
+
if (psym !== undefined &&
|
|
2580
|
+
(ts.symbolName(psym) === "Sign" || ts.symbolName(psym) === "Verify") &&
|
|
2581
|
+
psym.declarations.some((d) => ts.isClassDeclaration(d) &&
|
|
2582
|
+
ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
|
|
2583
|
+
isDeclaredInAmbientModule(d, "crypto"))) {
|
|
2584
|
+
return DYN;
|
|
2585
|
+
}
|
|
2445
2586
|
if (psym &&
|
|
2446
2587
|
FETCH_AMBIENT_TYPES.includes(ts.symbolName(psym)) &&
|
|
2447
2588
|
!(ts.symbolName(psym) === "ReadableStream" &&
|
|
@@ -2472,6 +2613,25 @@ function mapTypeInner(type, ctx) {
|
|
|
2472
2613
|
psym.declarations.some((d) => ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
|
|
2473
2614
|
return DYN;
|
|
2474
2615
|
}
|
|
2616
|
+
// node:crypto ECDH values are native handles carried by the
|
|
2617
|
+
// checked-dynamic representation; lowerEcdhCall dispatches their methods.
|
|
2618
|
+
if (psym !== undefined &&
|
|
2619
|
+
ts.symbolName(psym) === "ECDH" &&
|
|
2620
|
+
psym.declarations.some((d) => ts.isClassDeclaration(d) && ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
|
|
2621
|
+
return DYN;
|
|
2622
|
+
}
|
|
2623
|
+
// node:crypto DiffieHellman values, and @types/node's DiffieHellmanGroup
|
|
2624
|
+
// alias over them, are native handles carried by the checked-dynamic
|
|
2625
|
+
// representation; lowerDiffieHellmanCall dispatches their methods.
|
|
2626
|
+
{
|
|
2627
|
+
const dhSym = widened.getAliasSymbol() ?? psym;
|
|
2628
|
+
if (dhSym !== undefined &&
|
|
2629
|
+
(ts.symbolName(dhSym) === "DiffieHellman" || ts.symbolName(dhSym) === "DiffieHellmanGroup") &&
|
|
2630
|
+
dhSym.declarations.some((d) => (ts.isClassDeclaration(d) || ts.isTypeAliasDeclaration(d)) &&
|
|
2631
|
+
ctx.isStdlibFile(ts.getSourceFileOfNode(d)))) {
|
|
2632
|
+
return DYN;
|
|
2633
|
+
}
|
|
2634
|
+
}
|
|
2475
2635
|
// ReadonlyMap/ReadonlySet are the SAME runtime values as Map/Set — the
|
|
2476
2636
|
// readonly-ness is a checker-only view (no mutating members on the
|
|
2477
2637
|
// interface), so both map to the identical IR kinds and the read-side
|
|
@@ -2557,12 +2717,12 @@ function mapTypeInner(type, ctx) {
|
|
|
2557
2717
|
// methods lower over that handle (loop-liveness bookkeeping); `Timeout |
|
|
2558
2718
|
// null` becomes `number | null`, and clearTimeout/clearInterval take the
|
|
2559
2719
|
// handle. Provenance-checked like the other named interfaces.
|
|
2560
|
-
if (
|
|
2720
|
+
if (isStdlibTimerHandle("Timeout"))
|
|
2561
2721
|
return F64;
|
|
2562
2722
|
// NodeJS.Immediate / the fallback `Immediate` (setImmediate's return):
|
|
2563
2723
|
// the same numeric-handle story over the check-phase queue — its own id
|
|
2564
2724
|
// space, so clearTimeout of an Immediate no-ops like Node.
|
|
2565
|
-
if (
|
|
2725
|
+
if (isStdlibTimerHandle("Immediate"))
|
|
2566
2726
|
return F64;
|
|
2567
2727
|
if (isStdlibInterface("ArrayBuffer") ||
|
|
2568
2728
|
isStdlibInterface("SharedArrayBuffer") ||
|
|
@@ -3451,6 +3611,32 @@ function mapTypeInner(type, ctx) {
|
|
|
3451
3611
|
};
|
|
3452
3612
|
}
|
|
3453
3613
|
}
|
|
3614
|
+
// crypto.generateKeyPairSync's results: KeyPairKeyObjectResult and
|
|
3615
|
+
// KeyPairSyncResult<T1, T2> as { publicKey, privateKey } records over the
|
|
3616
|
+
// mapped property types (KeyObjects, PEM strings or DER Buffers), in
|
|
3617
|
+
// Node's key order.
|
|
3618
|
+
if (psym !== undefined &&
|
|
3619
|
+
(ts.symbolName(psym) === "KeyPairKeyObjectResult" ||
|
|
3620
|
+
ts.symbolName(psym) === "KeyPairSyncResult") &&
|
|
3621
|
+
psym.declarations.some((d) => ts.isInterfaceDeclaration(d) &&
|
|
3622
|
+
ctx.isStdlibFile(ts.getSourceFileOfNode(d)) &&
|
|
3623
|
+
isDeclaredInAmbientModule(d, "crypto"))) {
|
|
3624
|
+
const field = (name) => {
|
|
3625
|
+
const prop = ctx.checker.getPropertyOfType(type, name);
|
|
3626
|
+
return prop ? mapType(ctx.checker.getTypeOfSymbol(prop), ctx) : null;
|
|
3627
|
+
};
|
|
3628
|
+
const publicKey = field("publicKey");
|
|
3629
|
+
const privateKey = field("privateKey");
|
|
3630
|
+
if (!publicKey || !privateKey)
|
|
3631
|
+
return null;
|
|
3632
|
+
return {
|
|
3633
|
+
kind: "record",
|
|
3634
|
+
shapeId: ctx.shapes.intern([
|
|
3635
|
+
{ name: "privateKey", type: privateKey },
|
|
3636
|
+
{ name: "publicKey", type: publicKey },
|
|
3637
|
+
], false, undefined, ["publicKey", "privateKey"]),
|
|
3638
|
+
};
|
|
3639
|
+
}
|
|
3454
3640
|
// crypto.X509Certificate — the Dirent-style data record: THREE visible
|
|
3455
3641
|
// fields (fingerprint and the validFrom/validTo validity window, all
|
|
3456
3642
|
// computed at construction by the new-expression lowering). Module-
|
|
@@ -3857,7 +4043,10 @@ function mapTypeInner(type, ctx) {
|
|
|
3857
4043
|
if (knownRecursive !== undefined)
|
|
3858
4044
|
return { kind: "union", unionId: knownRecursive };
|
|
3859
4045
|
if (unions.inProgress.has(widened)) {
|
|
3860
|
-
return {
|
|
4046
|
+
return {
|
|
4047
|
+
kind: "union",
|
|
4048
|
+
unionId: unions.recursiveRef(widened, () => checkerTypeDescription(widened, ctx)),
|
|
4049
|
+
};
|
|
3861
4050
|
}
|
|
3862
4051
|
unions.inProgress.add(widened);
|
|
3863
4052
|
const sensitivityAtEntry = contextResolutions;
|
|
@@ -3871,7 +4060,24 @@ function mapTypeInner(type, ctx) {
|
|
|
3871
4060
|
const parts = ts.constituentTypes(widened);
|
|
3872
4061
|
const emptyTuple = (part) => checker.isTupleType(part) &&
|
|
3873
4062
|
checker.getTypeArguments(part).length === 0;
|
|
3874
|
-
|
|
4063
|
+
// The match-result fallback `s.match(re) || []` (and `?? []`) widens
|
|
4064
|
+
// to `RegExpMatchArray | []`: the empty tuple is one of the match
|
|
4065
|
+
// array's own values too.
|
|
4066
|
+
const matchArray = (part) => {
|
|
4067
|
+
// The names have no leading `__`, so the escaped name is the name.
|
|
4068
|
+
const name = part.getSymbol()?.escapedName;
|
|
4069
|
+
return ((name === "RegExpMatchArray" || name === "RegExpExecArray") &&
|
|
4070
|
+
(part.getSymbol()?.declarations.some((d) => ctx.isStdlibFile(d.getSourceFile())) ?? false));
|
|
4071
|
+
};
|
|
4072
|
+
const hasArrayPart = parts.some((part) => checker.isArrayType(part) || matchArray(part));
|
|
4073
|
+
// Subtype reduction removes every arm assignable to `{}`, so a union
|
|
4074
|
+
// that keeps another non-nullish arm beside an empty literal's `{}`
|
|
4075
|
+
// was not reduced: that `{}` arm holds only the literal's objects.
|
|
4076
|
+
const nullish = ts.TypeFlags.Null | ts.TypeFlags.Undefined | ts.TypeFlags.Void;
|
|
4077
|
+
const literalEmptyArms = parts.some((part) => isEmptyObjectLiteralType(part, ctx)) &&
|
|
4078
|
+
parts.some((part) => (part.flags & nullish) === 0 &&
|
|
4079
|
+
!checker.isNeverType(part) &&
|
|
4080
|
+
!isEmptyObjectLiteralType(part, ctx));
|
|
3875
4081
|
for (const part of parts) {
|
|
3876
4082
|
if (hasArrayPart && emptyTuple(part))
|
|
3877
4083
|
continue;
|
|
@@ -3892,7 +4098,19 @@ function mapTypeInner(type, ctx) {
|
|
|
3892
4098
|
byKey.set(typeKey(NULL_T), NULL_T);
|
|
3893
4099
|
continue;
|
|
3894
4100
|
}
|
|
3895
|
-
|
|
4101
|
+
let mapped;
|
|
4102
|
+
if (literalEmptyArms && isEmptyObjectLiteralType(part, ctx)) {
|
|
4103
|
+
ctx.emptyLiteralArm = true;
|
|
4104
|
+
try {
|
|
4105
|
+
mapped = mapType(part, ctx);
|
|
4106
|
+
}
|
|
4107
|
+
finally {
|
|
4108
|
+
ctx.emptyLiteralArm = false;
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
else {
|
|
4112
|
+
mapped = mapType(part, ctx);
|
|
4113
|
+
}
|
|
3896
4114
|
if (!mapped) {
|
|
3897
4115
|
return null;
|
|
3898
4116
|
}
|
|
@@ -3948,7 +4166,9 @@ function mapTypeInner(type, ctx) {
|
|
|
3948
4166
|
// semantics would DEGRADE under the collapse — class instances,
|
|
3949
4167
|
// Maps/Sets, functions (closure identity, `x === String`
|
|
3950
4168
|
// narrowing), promises, regexes, generators, handles — keep their
|
|
3951
|
-
// existing union homes and fences below.
|
|
4169
|
+
// existing union homes and fences below. URL is the
|
|
4170
|
+
// exception: its handle boxes by reference and keeps every member,
|
|
4171
|
+
// so it collapses too (dynSubsumableUnionArm). A pending recursive
|
|
3952
4172
|
// placeholder cannot collapse (back-references already hold the
|
|
3953
4173
|
// union id); the degenerate recursive spelling keeps its fence.
|
|
3954
4174
|
if (arms.some((a) => a.kind === "dyn") &&
|
|
@@ -5024,7 +5244,8 @@ function evalMappedTemplate(type, keys, aliases, ctx) {
|
|
|
5024
5244
|
const checked = evalMappedTemplate(checkType, keys, scope, ctx);
|
|
5025
5245
|
if (!checked)
|
|
5026
5246
|
return null;
|
|
5027
|
-
const inferred =
|
|
5247
|
+
const inferred = primitiveExtendsCheck(checked, extendsType, ctx) ??
|
|
5248
|
+
matchInferReference(checked, extendsType, ctx);
|
|
5028
5249
|
if (inferred === undefined)
|
|
5029
5250
|
return null;
|
|
5030
5251
|
const branch = inferred ? type.getTrueType() : type.getFalseType();
|
|
@@ -5033,6 +5254,24 @@ function evalMappedTemplate(type, keys, aliases, ctx) {
|
|
|
5033
5254
|
}
|
|
5034
5255
|
return mentionsMappedParams(type, keys, aliases) ? null : type;
|
|
5035
5256
|
}
|
|
5257
|
+
/** `checked extends X` where X is a primitive or literal type, or a union of
|
|
5258
|
+
* them (`K extends "required" ? ...`), and `checked` is one such type:
|
|
5259
|
+
* X has no infer positions, so assignability decides the branch (an empty
|
|
5260
|
+
* binding map for the true branch). A union `checked` distributes and stays
|
|
5261
|
+
* undecided here (undefined), as do other shapes. */
|
|
5262
|
+
function primitiveExtendsCheck(checked, extendsType, ctx) {
|
|
5263
|
+
const primitive = ts.TypeFlags.StringLike |
|
|
5264
|
+
ts.TypeFlags.NumberLike |
|
|
5265
|
+
ts.TypeFlags.BooleanLike |
|
|
5266
|
+
ts.TypeFlags.BigIntLike |
|
|
5267
|
+
ts.TypeFlags.Null |
|
|
5268
|
+
ts.TypeFlags.Undefined;
|
|
5269
|
+
const isPrimitive = (t) => !t.isUnionType() && (t.flags & primitive) !== 0 && (t.flags & ts.TypeFlags.TypeParameter) === 0;
|
|
5270
|
+
const extendsParts = extendsType.isUnionType() ? ts.constituentTypes(extendsType) : [extendsType];
|
|
5271
|
+
if (!isPrimitive(checked) || !extendsParts.every(isPrimitive))
|
|
5272
|
+
return undefined;
|
|
5273
|
+
return ctx.checker.isTypeAssignableTo(checked, extendsType) ? new Map() : false;
|
|
5274
|
+
}
|
|
5036
5275
|
/** `checked extends G<..., infer T, ...>`: the infer bindings when
|
|
5037
5276
|
* `checked` is a reference to the same generic `G` (its arguments bind the
|
|
5038
5277
|
* infer positions; other positions must be the same types), false when it
|
|
@@ -5718,6 +5957,44 @@ function isMappedShape(t) {
|
|
|
5718
5957
|
* of a package the program does not compile. Its pure type shapes —
|
|
5719
5958
|
* interfaces, aliases, type literals — describe data a program can build
|
|
5720
5959
|
* itself (`import type` from a types-only package such as type-fest). */
|
|
5960
|
+
/** A class an SDK declares only to describe data (aws-sdk's
|
|
5961
|
+
* `declare class PresignedPost { url: string; fields: Fields }`, which
|
|
5962
|
+
* arrives as JSON and is never constructed): public instance fields and
|
|
5963
|
+
* nothing else — no constructor, methods, accessors, index signatures,
|
|
5964
|
+
* static, private or protected members, base classes, implemented
|
|
5965
|
+
* interfaces or type parameters. Its instances are exactly the records
|
|
5966
|
+
* of those fields, so the type maps structurally like an interface. */
|
|
5967
|
+
function isDeclaredDataClass(d) {
|
|
5968
|
+
if (!ts.isClassDeclaration(d) || !d.getSourceFile().isDeclarationFile)
|
|
5969
|
+
return false;
|
|
5970
|
+
if (d.heritageClauses !== undefined && d.heritageClauses.nodes.length > 0)
|
|
5971
|
+
return false;
|
|
5972
|
+
if (d.typeParameters !== undefined && d.typeParameters.nodes.length > 0)
|
|
5973
|
+
return false;
|
|
5974
|
+
return d.members.nodes.every((member) => ts.isPropertyDeclaration(member) &&
|
|
5975
|
+
!ts.isPrivateIdentifier(member.name) &&
|
|
5976
|
+
!(member.modifiers?.nodes ?? []).some((modifier) => modifier.kind === ts.SyntaxKind.StaticKeyword ||
|
|
5977
|
+
modifier.kind === ts.SyntaxKind.PrivateKeyword ||
|
|
5978
|
+
modifier.kind === ts.SyntaxKind.ProtectedKeyword ||
|
|
5979
|
+
modifier.kind === ts.SyntaxKind.AbstractKeyword));
|
|
5980
|
+
}
|
|
5981
|
+
/** A namespace merged into a declared data class that holds only types
|
|
5982
|
+
* (`namespace PresignedPost { interface Fields { … } }`): it adds no value
|
|
5983
|
+
* the program could reach. */
|
|
5984
|
+
function isTypeOnlyNamespace(d) {
|
|
5985
|
+
if (!ts.isModuleDeclaration(d))
|
|
5986
|
+
return false;
|
|
5987
|
+
const body = d.body;
|
|
5988
|
+
if (body === undefined)
|
|
5989
|
+
return true;
|
|
5990
|
+
if (ts.isModuleDeclaration(body))
|
|
5991
|
+
return isTypeOnlyNamespace(body);
|
|
5992
|
+
if (!ts.isModuleBlock(body))
|
|
5993
|
+
return false;
|
|
5994
|
+
return body.statements.nodes.every((statement) => ts.isInterfaceDeclaration(statement) ||
|
|
5995
|
+
ts.isTypeAliasDeclaration(statement) ||
|
|
5996
|
+
isTypeOnlyNamespace(statement));
|
|
5997
|
+
}
|
|
5721
5998
|
function packageTypeFile(sf, ctx) {
|
|
5722
5999
|
return (sf.isDeclarationFile && /[\\/]node_modules[\\/]/.test(sf.fileName) && !ctx.isStdlibFile(sf));
|
|
5723
6000
|
}
|
|
@@ -6003,7 +6280,10 @@ function mapRecordType(widened, ctx) {
|
|
|
6003
6280
|
// frame completes (finalizeRecursive below). Backends represent records
|
|
6004
6281
|
// as heap references, so the self-reference is an ordinary pointer.
|
|
6005
6282
|
if (shapes.inProgress.has(widened)) {
|
|
6006
|
-
return {
|
|
6283
|
+
return {
|
|
6284
|
+
kind: "record",
|
|
6285
|
+
shapeId: shapes.recursiveRef(widened, () => checkerTypeDescription(widened, ctx)),
|
|
6286
|
+
};
|
|
6007
6287
|
}
|
|
6008
6288
|
shapes.inProgress.add(widened);
|
|
6009
6289
|
const sensitivityAtEntry = contextResolutions;
|
|
@@ -6439,8 +6719,11 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
6439
6719
|
for (const info of indexInfos) {
|
|
6440
6720
|
if (!stringKey(info.keyType) && !(info.keyType.flags & ts.TypeFlags.Number))
|
|
6441
6721
|
return null;
|
|
6442
|
-
|
|
6443
|
-
//
|
|
6722
|
+
// An `any`-valued signature (`{ [key: string]: any }`, an SDK's
|
|
6723
|
+
// `Dictionary<any>`) holds whatever the program stores: its
|
|
6724
|
+
// overflow values are checked-dynamic, exactly `Record<string,
|
|
6725
|
+
// unknown>`'s.
|
|
6726
|
+
const iv = info.type.flags & ts.TypeFlags.Any ? DYN : mapType(info.type, ctx);
|
|
6444
6727
|
if (!iv || !isSupportedIndexValue(iv))
|
|
6445
6728
|
return null;
|
|
6446
6729
|
if (v !== null && !typeEquals(v, iv))
|
|
@@ -6540,24 +6823,28 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
6540
6823
|
// has zero declared members — the signature is the shape.
|
|
6541
6824
|
if (computed && props.length === 0 && !indexValue)
|
|
6542
6825
|
return null;
|
|
6543
|
-
//
|
|
6544
|
-
// intrinsic
|
|
6545
|
-
//
|
|
6546
|
-
//
|
|
6547
|
-
//
|
|
6548
|
-
//
|
|
6549
|
-
//
|
|
6550
|
-
//
|
|
6551
|
-
//
|
|
6552
|
-
//
|
|
6553
|
-
//
|
|
6554
|
-
//
|
|
6555
|
-
//
|
|
6826
|
+
// An empty object type — `{}` (spelled, the checker's shared
|
|
6827
|
+
// intrinsic, or inferred from an empty object literal), `interface
|
|
6828
|
+
// Empty {}` — is tsc's TOP type over non-nullish values: every number,
|
|
6829
|
+
// string, record, array, function, or class instance is assignable
|
|
6830
|
+
// into the slot, so the exact-record stance cannot hold it. It lowers
|
|
6831
|
+
// like `unknown` (the dyn), the same rule as `object` and the lib's
|
|
6832
|
+
// `Object`: assignments convert at the site (sources outside the
|
|
6833
|
+
// checked-dynamic tree fence there, exactly as unknown does), reads
|
|
6834
|
+
// narrow back out through the same checked casts. A literal's inferred
|
|
6835
|
+
// `{}` is no exception: union subtype reduction folds primitives into
|
|
6836
|
+
// it (`["12", {}]` is `{}[]`, `flag ? "x" : {}` is `{}`), and `let o =
|
|
6837
|
+
// {}` admits `o = "x"`. As an arm beside another non-nullish arm (the
|
|
6838
|
+
// union was not reduced, `string | {} | DataView`) it holds only the
|
|
6839
|
+
// literal's objects and stays the empty record (emptyLiteralArm).
|
|
6840
|
+
// Computed empties (`Partial<T>` in a generic body) returned null
|
|
6841
|
+
// above. Empty shapes WITH an index signature (`Record<string, T>`) are
|
|
6842
|
+
// not empty: the signature is the shape.
|
|
6556
6843
|
if (props.length === 0 &&
|
|
6557
6844
|
indexValue === undefined &&
|
|
6558
6845
|
checker.getCallSignatures(widened).length === 0 &&
|
|
6559
6846
|
checker.getConstructSignatures(widened).length === 0 &&
|
|
6560
|
-
!(
|
|
6847
|
+
!(ctx.emptyLiteralArm && isEmptyObjectLiteralType(widened, ctx))) {
|
|
6561
6848
|
return DYN;
|
|
6562
6849
|
}
|
|
6563
6850
|
const fields = [];
|
|
@@ -6666,6 +6953,17 @@ function mapRecordTypeInner(widened, ctx) {
|
|
|
6666
6953
|
}
|
|
6667
6954
|
if (pt === null && (fieldTs.flags & ts.TypeFlags.Any) !== 0)
|
|
6668
6955
|
pt = DYN;
|
|
6956
|
+
// An `any[]` field (`list: any[]` in an SDK's message type, also
|
|
6957
|
+
// optional or nullable) is the checked-dynamic array, exactly as
|
|
6958
|
+
// `unknown[]` maps; the checked-dynamic value holds the units too.
|
|
6959
|
+
// Declared members only: an object literal's inferred `any[]` member
|
|
6960
|
+
// keeps its existing story.
|
|
6961
|
+
if (pt === null &&
|
|
6962
|
+
declaredMember(p) &&
|
|
6963
|
+
(fieldTs.isUnionType() ? ts.constituentTypes(fieldTs) : [fieldTs]).every((part) => isAnyArrayType(part, checker) ||
|
|
6964
|
+
(part.flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Null)) !== 0) &&
|
|
6965
|
+
!isUnitOnlyTsType(fieldTs, ctx.resolveTypeParam))
|
|
6966
|
+
pt = DYN;
|
|
6669
6967
|
// Unit-only FIELDS (`{ msg?: undefined }` — the discriminated-union
|
|
6670
6968
|
// absent-field idiom — and `{ p: undefined }` spellings): the
|
|
6671
6969
|
// unit-only union. The runtime value is the interned unit, JSON
|
|
@@ -6755,8 +7053,19 @@ function dynSubsumableUnionArm(arm, ctx) {
|
|
|
6755
7053
|
case "undefinedT":
|
|
6756
7054
|
case "nullT":
|
|
6757
7055
|
return true;
|
|
7056
|
+
// URL boxes BY REFERENCE (its checked-dynamic handle keeps identity,
|
|
7057
|
+
// reads and writes its members through the native accessors, answers
|
|
7058
|
+
// `instanceof URL`, and checks back out to the typed value), so it
|
|
7059
|
+
// rides the collapse beside fetch's Request/Response handles:
|
|
7060
|
+
// `string | URL | Request`, fetch's own input type under @types/node.
|
|
7061
|
+
case "url":
|
|
7062
|
+
return true;
|
|
6758
7063
|
case "record":
|
|
6759
7064
|
case "array":
|
|
7065
|
+
// `T | Promise<T>` with T bound to `unknown`: the checked-dynamic value
|
|
7066
|
+
// holds a promise by reference, so `unknown` absorbs the promise arm
|
|
7067
|
+
// exactly as the checker's own union reduction does.
|
|
7068
|
+
case "promise":
|
|
6760
7069
|
return canConvertToDyn(arm, (id) => ctx.shapes.get(id), (id) => ctx.unions.get(id));
|
|
6761
7070
|
default:
|
|
6762
7071
|
return false;
|
|
@@ -7026,17 +7335,127 @@ export function describeRecordMemberBlocker(widened, ctx) {
|
|
|
7026
7335
|
continue;
|
|
7027
7336
|
return `the record shape is supported, but its member '${ts.symbolName(p)}' ${describeOverloadSetBlocker(fieldTs, ctx)}`;
|
|
7028
7337
|
}
|
|
7029
|
-
|
|
7030
|
-
? erasedGenericMemberType(fieldTs, ctx)
|
|
7031
|
-
: mapType(fieldTs, ctx);
|
|
7032
|
-
if (pt === undefined)
|
|
7338
|
+
if (memberMaps(fieldTs, ctx, p))
|
|
7033
7339
|
continue;
|
|
7034
|
-
|
|
7035
|
-
|
|
7036
|
-
|
|
7037
|
-
|
|
7340
|
+
// Name the deepest member the failure comes from (`order.deployment.
|
|
7341
|
+
// builds[].config`): a large message type otherwise points only at
|
|
7342
|
+
// its outermost member.
|
|
7343
|
+
const inner = innerBlockedMember(fieldTs, ctx, new Set());
|
|
7344
|
+
if (inner !== null && inner.path !== "") {
|
|
7345
|
+
return `the record shape is supported, but its member '${ts.symbolName(p)}${inner.path}' has type '${checker.typeToString(inner.type)}', which does not compile`;
|
|
7038
7346
|
}
|
|
7347
|
+
return `the record shape is supported, but its member '${ts.symbolName(p)}' has type '${checker.typeToString(fieldTs)}', which does not compile`;
|
|
7039
7348
|
}
|
|
7040
7349
|
return null;
|
|
7041
7350
|
}
|
|
7351
|
+
/** A member an interface, type literal or class declares (not one an
|
|
7352
|
+
* object literal's inferred type carries). */
|
|
7353
|
+
function declaredMember(member) {
|
|
7354
|
+
return (member.declarations.length > 0 &&
|
|
7355
|
+
member.declarations.every((d) => ts.isPropertySignature(d) || ts.isPropertyDeclaration(d)));
|
|
7356
|
+
}
|
|
7357
|
+
/** Whether a record member of type `fieldTs` maps, by the member rules of
|
|
7358
|
+
* mapRecordTypeInner (generic members erase; `any` and `any[]` members
|
|
7359
|
+
* are checked-dynamic; unit-only members are the unit union). Overloaded
|
|
7360
|
+
* members answer true: describeOverloadSetBlocker tells their story. */
|
|
7361
|
+
function memberMaps(fieldTs, ctx, member) {
|
|
7362
|
+
const { checker } = ctx;
|
|
7363
|
+
if (isOverloadedCallableMemberType(fieldTs, checker))
|
|
7364
|
+
return true;
|
|
7365
|
+
const pt = isGenericCallableMemberType(fieldTs, checker)
|
|
7366
|
+
? erasedGenericMemberType(fieldTs, ctx)
|
|
7367
|
+
: mapType(fieldTs, ctx);
|
|
7368
|
+
if (pt === undefined)
|
|
7369
|
+
return true;
|
|
7370
|
+
if (pt === null && (fieldTs.flags & ts.TypeFlags.Any) !== 0)
|
|
7371
|
+
return true;
|
|
7372
|
+
if (pt === null &&
|
|
7373
|
+
(member === undefined || declaredMember(member)) &&
|
|
7374
|
+
(fieldTs.isUnionType() ? ts.constituentTypes(fieldTs) : [fieldTs]).every((part) => isAnyArrayType(part, checker) ||
|
|
7375
|
+
(part.flags & (ts.TypeFlags.Undefined | ts.TypeFlags.Null)) !== 0) &&
|
|
7376
|
+
!isUnitOnlyTsType(fieldTs, ctx.resolveTypeParam))
|
|
7377
|
+
return true;
|
|
7378
|
+
if (pt?.kind === "void" && isUnitOnlyTsType(fieldTs, ctx.resolveTypeParam))
|
|
7379
|
+
return true;
|
|
7380
|
+
return pt !== null && pt.kind !== "void";
|
|
7381
|
+
}
|
|
7382
|
+
/** The member path inside the unmapped type `t` that its failure comes
|
|
7383
|
+
* from, and that member's type: `.name` steps into record members, `[]`
|
|
7384
|
+
* into array elements, `()` into a function's return; union arms and
|
|
7385
|
+
* promise payloads are transparent. The empty path means `t` itself is
|
|
7386
|
+
* the blocker; null means `t` maps (or is `any`). */
|
|
7387
|
+
function innerBlockedMember(t, ctx, seen) {
|
|
7388
|
+
const { checker } = ctx;
|
|
7389
|
+
// `any` is no component to name: the member holding it is the blocker.
|
|
7390
|
+
if ((t.flags & ts.TypeFlags.Any) !== 0 || mapType(t, ctx) !== null)
|
|
7391
|
+
return null;
|
|
7392
|
+
const here = { path: "", type: t };
|
|
7393
|
+
if (seen.has(t) || seen.size >= 16)
|
|
7394
|
+
return here;
|
|
7395
|
+
seen.add(t);
|
|
7396
|
+
const step = (prefix, inner) => {
|
|
7397
|
+
const found = innerBlockedMember(inner, ctx, seen);
|
|
7398
|
+
return found === null ? here : { path: prefix + found.path, type: found.type };
|
|
7399
|
+
};
|
|
7400
|
+
if (t.isUnionType()) {
|
|
7401
|
+
const UNIT = ts.TypeFlags.Undefined | ts.TypeFlags.Void | ts.TypeFlags.Null;
|
|
7402
|
+
for (const part of ts.constituentTypes(t)) {
|
|
7403
|
+
if ((part.flags & UNIT) !== 0 || mapType(part, ctx) !== null)
|
|
7404
|
+
continue;
|
|
7405
|
+
return step("", part);
|
|
7406
|
+
}
|
|
7407
|
+
return here;
|
|
7408
|
+
}
|
|
7409
|
+
if ((t.flags & ts.TypeFlags.Object) === 0)
|
|
7410
|
+
return here;
|
|
7411
|
+
if (checker.isArrayType(t)) {
|
|
7412
|
+
const elem = checker.getTypeArguments(t)[0];
|
|
7413
|
+
return elem === undefined ? here : step("[]", elem);
|
|
7414
|
+
}
|
|
7415
|
+
const symbol = t.getSymbol();
|
|
7416
|
+
if (symbol !== undefined &&
|
|
7417
|
+
ts.symbolName(symbol) === "Promise" &&
|
|
7418
|
+
symbol.declarations.some((d) => ctx.isStdlibFile(d.getSourceFile()))) {
|
|
7419
|
+
const payload = checker.getTypeArguments(t)[0];
|
|
7420
|
+
return payload === undefined ? here : step("", payload);
|
|
7421
|
+
}
|
|
7422
|
+
const calls = checker.getCallSignatures(t);
|
|
7423
|
+
if (calls.length === 1) {
|
|
7424
|
+
const sig = calls[0];
|
|
7425
|
+
if (sig.getTypeParameters().length > 0)
|
|
7426
|
+
return here;
|
|
7427
|
+
if (sig.getParameters().some((p) => mapType(checker.getTypeOfSymbol(p), ctx) === null))
|
|
7428
|
+
return here;
|
|
7429
|
+
return step("()", checker.getReturnTypeOfSignature(sig));
|
|
7430
|
+
}
|
|
7431
|
+
if (calls.length > 0 ||
|
|
7432
|
+
checker.getConstructSignatures(t).length > 0 ||
|
|
7433
|
+
checker.isTupleType(t) ||
|
|
7434
|
+
checker.getIndexInfosOfType(t).length > 0)
|
|
7435
|
+
return here;
|
|
7436
|
+
for (const p of checker.getPropertiesOfType(t)) {
|
|
7437
|
+
if ((p.flags & (ts.SymbolFlags.GetAccessor | ts.SymbolFlags.SetAccessor)) !== 0)
|
|
7438
|
+
continue;
|
|
7439
|
+
if (ts.symbolName(p).startsWith("__@"))
|
|
7440
|
+
continue;
|
|
7441
|
+
const fieldTs = checker.getTypeOfSymbol(p);
|
|
7442
|
+
if (memberMaps(fieldTs, ctx, p))
|
|
7443
|
+
continue;
|
|
7444
|
+
return step(`.${ts.symbolName(p)}`, fieldTs);
|
|
7445
|
+
}
|
|
7446
|
+
return here;
|
|
7447
|
+
}
|
|
7448
|
+
/** The type tsc infers from an empty object literal (`{}` written as a
|
|
7449
|
+
* value): no members, index signatures or signatures, declared by an object
|
|
7450
|
+
* literal expression. */
|
|
7451
|
+
function isEmptyObjectLiteralType(type, ctx) {
|
|
7452
|
+
const { checker } = ctx;
|
|
7453
|
+
const symbol = type.getSymbol();
|
|
7454
|
+
return (symbol !== undefined &&
|
|
7455
|
+
symbol.declarations.some((d) => ts.isObjectLiteralExpression(d)) &&
|
|
7456
|
+
checker.getPropertiesOfType(type).length === 0 &&
|
|
7457
|
+
checker.getIndexInfosOfType(type).length === 0 &&
|
|
7458
|
+
checker.getCallSignatures(type).length === 0 &&
|
|
7459
|
+
checker.getConstructSignatures(type).length === 0);
|
|
7460
|
+
}
|
|
7042
7461
|
//# sourceMappingURL=type-mapper.js.map
|