@scriptc/compiler 0.4.3 → 0.4.5
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 +270 -72
- package/ambient/scriptc-overrides.d.ts +21 -0
- package/dist/backend/executable-features.js +3 -0
- package/dist/backend/executable-features.js.map +1 -1
- package/dist/backend/library-pack.js +2 -1
- package/dist/backend/library-pack.js.map +1 -1
- package/dist/backend/linker.js +11 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/lld.d.ts +9 -0
- package/dist/backend/lld.js +48 -0
- package/dist/backend/lld.js.map +1 -0
- package/dist/backend/lld.test.d.ts +1 -0
- package/dist/backend/lld.test.js +53 -0
- package/dist/backend/lld.test.js.map +1 -0
- package/dist/backend/llvm/appended-array-literals.d.ts +11 -1
- package/dist/backend/llvm/appended-array-literals.js +29 -0
- package/dist/backend/llvm/appended-array-literals.js.map +1 -1
- package/dist/backend/llvm/blocks.js +10 -1
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/bytes-alias.d.ts +13 -4
- package/dist/backend/llvm/bytes-alias.js +16 -5
- package/dist/backend/llvm/bytes-alias.js.map +1 -1
- package/dist/backend/llvm/bytes-bounds.d.ts +5 -1
- package/dist/backend/llvm/bytes-bounds.js +199 -2
- package/dist/backend/llvm/bytes-bounds.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.d.ts +45 -3
- package/dist/backend/llvm/bytes-loop-versions.js +244 -20
- package/dist/backend/llvm/bytes-loop-versions.js.map +1 -1
- package/dist/backend/llvm/bytes-loop-versions.test.js +18 -6
- package/dist/backend/llvm/bytes-loop-versions.test.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.d.ts +8 -2
- package/dist/backend/llvm/call-lifetimes.js +87 -18
- package/dist/backend/llvm/call-lifetimes.js.map +1 -1
- package/dist/backend/llvm/call-lifetimes.test.js +132 -0
- package/dist/backend/llvm/call-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/classes.d.ts +3 -2
- package/dist/backend/llvm/classes.js +4 -4
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/counted-loops.d.ts +14 -2
- package/dist/backend/llvm/counted-loops.js +54 -5
- package/dist/backend/llvm/counted-loops.js.map +1 -1
- package/dist/backend/llvm/debug-info.d.ts +42 -1
- package/dist/backend/llvm/debug-info.js +72 -6
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.js +2 -2
- package/dist/backend/llvm/dense-array-loops.js.map +1 -1
- package/dist/backend/llvm/dense-array-loops.test.js +1 -0
- package/dist/backend/llvm/dense-array-loops.test.js.map +1 -1
- package/dist/backend/llvm/dyn.d.ts +69 -8
- package/dist/backend/llvm/dyn.js +396 -49
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emit-function.js +30 -16
- package/dist/backend/llvm/emit-function.js.map +1 -1
- package/dist/backend/llvm/emit-journal.d.ts +8 -4
- package/dist/backend/llvm/emit-journal.js +75 -5
- package/dist/backend/llvm/emit-journal.js.map +1 -1
- package/dist/backend/llvm/emit-module.d.ts +4 -0
- package/dist/backend/llvm/emit-module.js +74 -29
- package/dist/backend/llvm/emit-module.js.map +1 -1
- package/dist/backend/llvm/emit-statements.js +297 -28
- package/dist/backend/llvm/emit-statements.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +144 -13
- package/dist/backend/llvm/emitter.js +523 -92
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.js +11 -2
- package/dist/backend/llvm/emitter.test.js.map +1 -1
- package/dist/backend/llvm/expr-async.js +11 -13
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +6 -4
- package/dist/backend/llvm/expr-bytes.js +45 -16
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +13 -11
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +11 -0
- package/dist/backend/llvm/expr-containers.js +101 -9
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +3 -0
- package/dist/backend/llvm/expr-control.js +83 -0
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.d.ts +1 -1
- package/dist/backend/llvm/expr-dynamic.js +22 -4
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.js +121 -14
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.js +111 -26
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/forked-analysis.d.ts +8 -0
- package/dist/backend/llvm/forked-analysis.js +43 -0
- package/dist/backend/llvm/forked-analysis.js.map +1 -0
- package/dist/backend/llvm/integer-values.d.ts +12 -0
- package/dist/backend/llvm/integer-values.js +69 -5
- package/dist/backend/llvm/integer-values.js.map +1 -1
- package/dist/backend/llvm/integer-views.d.ts +2 -1
- package/dist/backend/llvm/integer-views.js +12 -1
- package/dist/backend/llvm/integer-views.js.map +1 -1
- package/dist/backend/llvm/js-ic.d.ts +4 -0
- package/dist/backend/llvm/js-ic.js +133 -15
- package/dist/backend/llvm/js-ic.js.map +1 -1
- package/dist/backend/llvm/layouts.d.ts +1 -0
- package/dist/backend/llvm/layouts.js.map +1 -1
- package/dist/backend/llvm/lazy-captures.d.ts +6 -1
- package/dist/backend/llvm/lazy-captures.js +10 -5
- package/dist/backend/llvm/lazy-captures.js.map +1 -1
- package/dist/backend/llvm/lib-abi.d.ts +5 -0
- package/dist/backend/llvm/lib-abi.js +19 -0
- package/dist/backend/llvm/lib-abi.js.map +1 -1
- package/dist/backend/llvm/lib-dispatch.js +249 -33
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.d.ts +10 -0
- package/dist/backend/llvm/lib-filesystem.js +32 -0
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.js +2 -2
- package/dist/backend/llvm/lib-http2.js.map +1 -1
- package/dist/backend/llvm/lib-network.js +2 -0
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +48 -1
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +64 -0
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-tls.js +28 -3
- package/dist/backend/llvm/lib-tls.js.map +1 -1
- package/dist/backend/llvm/local-union-storage.test.js +2 -1
- package/dist/backend/llvm/local-union-storage.test.js.map +1 -1
- package/dist/backend/llvm/loop-array-borrows.d.ts +4 -1
- package/dist/backend/llvm/loop-array-borrows.js +11 -5
- package/dist/backend/llvm/loop-array-borrows.js.map +1 -1
- package/dist/backend/llvm/map-entry-fusion.d.ts +5 -3
- package/dist/backend/llvm/map-entry-fusion.js +20 -11
- package/dist/backend/llvm/map-entry-fusion.js.map +1 -1
- package/dist/backend/llvm/map-entry-fusion.test.js +14 -6
- package/dist/backend/llvm/map-entry-fusion.test.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.d.ts +16 -6
- package/dist/backend/llvm/map-number-lookup.js +41 -9
- package/dist/backend/llvm/map-number-lookup.js.map +1 -1
- package/dist/backend/llvm/map-number-lookup.test.js +70 -2
- package/dist/backend/llvm/map-number-lookup.test.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.d.ts +25 -2
- package/dist/backend/llvm/map-read-lifetimes.js +136 -6
- package/dist/backend/llvm/map-read-lifetimes.js.map +1 -1
- package/dist/backend/llvm/map-read-lifetimes.test.js +8 -3
- package/dist/backend/llvm/map-read-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.d.ts +5 -0
- package/dist/backend/llvm/nullable-unions.js +29 -2
- package/dist/backend/llvm/nullable-unions.js.map +1 -1
- package/dist/backend/llvm/nullable-unions.test.js +25 -1
- package/dist/backend/llvm/nullable-unions.test.js.map +1 -1
- package/dist/backend/llvm/publish.js +3 -3
- package/dist/backend/llvm/publish.js.map +1 -1
- package/dist/backend/llvm/record-union-keys.test.d.ts +1 -0
- package/dist/backend/llvm/record-union-keys.test.js +161 -0
- package/dist/backend/llvm/record-union-keys.test.js.map +1 -0
- package/dist/backend/llvm/reference-effects.js +3 -0
- package/dist/backend/llvm/reference-effects.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 +4 -5
- package/dist/backend/llvm/shapes.js +106 -58
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/shapes.test.js +14 -2
- package/dist/backend/llvm/shapes.test.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.d.ts +50 -3
- package/dist/backend/llvm/speculative-integers.js +411 -24
- package/dist/backend/llvm/speculative-integers.js.map +1 -1
- package/dist/backend/llvm/speculative-integers.test.js +103 -1
- package/dist/backend/llvm/speculative-integers.test.js.map +1 -1
- package/dist/backend/llvm/split.d.ts +10 -1
- package/dist/backend/llvm/split.js +243 -59
- package/dist/backend/llvm/split.js.map +1 -1
- package/dist/backend/llvm/split.test.js +92 -13
- package/dist/backend/llvm/split.test.js.map +1 -1
- package/dist/backend/llvm/stack-captures.js +1 -5
- package/dist/backend/llvm/stack-captures.js.map +1 -1
- package/dist/backend/llvm/stack-objects.test.js +3 -2
- package/dist/backend/llvm/stack-objects.test.js.map +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js +1 -1
- package/dist/backend/llvm/string-lifetimes.test.js.map +1 -1
- package/dist/backend/llvm/string-reads.d.ts +13 -0
- package/dist/backend/llvm/string-reads.js +22 -0
- package/dist/backend/llvm/string-reads.js.map +1 -1
- package/dist/backend/llvm/string-slices.d.ts +36 -2
- package/dist/backend/llvm/string-slices.js +308 -12
- package/dist/backend/llvm/string-slices.js.map +1 -1
- package/dist/backend/llvm/string-slices.test.js +182 -3
- package/dist/backend/llvm/string-slices.test.js.map +1 -1
- package/dist/backend/llvm/string-unit-versions.d.ts +11 -0
- package/dist/backend/llvm/string-unit-versions.js +191 -0
- package/dist/backend/llvm/string-unit-versions.js.map +1 -0
- package/dist/backend/llvm/string-unit-versions.test.d.ts +1 -0
- package/dist/backend/llvm/string-unit-versions.test.js +117 -0
- package/dist/backend/llvm/string-unit-versions.test.js.map +1 -0
- package/dist/backend/llvm/test-boxed-unions.d.ts +5 -2
- package/dist/backend/llvm/test-boxed-unions.js +24 -8
- package/dist/backend/llvm/test-boxed-unions.js.map +1 -1
- package/dist/backend/llvm/union-repr.d.ts +4 -3
- package/dist/backend/llvm/union-repr.js +6 -5
- package/dist/backend/llvm/union-repr.js.map +1 -1
- package/dist/backend/llvm/unwind-abi.d.ts +52 -0
- package/dist/backend/llvm/unwind-abi.js +498 -0
- package/dist/backend/llvm/unwind-abi.js.map +1 -0
- package/dist/backend/llvm/unwind-abi.test.d.ts +1 -0
- package/dist/backend/llvm/unwind-abi.test.js +255 -0
- package/dist/backend/llvm/unwind-abi.test.js.map +1 -0
- package/dist/backend/llvm/walkers.js +13 -0
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/llvm/wrapping-sums.d.ts +14 -10
- package/dist/backend/llvm/wrapping-sums.js +31 -14
- package/dist/backend/llvm/wrapping-sums.js.map +1 -1
- package/dist/backend/loop-polls.d.ts +6 -0
- package/dist/backend/loop-polls.js +24 -0
- package/dist/backend/loop-polls.js.map +1 -1
- package/dist/backend/may-throw.js +8 -8
- package/dist/backend/may-throw.js.map +1 -1
- package/dist/backend/native/contracts.d.ts +12 -2
- package/dist/backend/native/executable.js +48 -6
- package/dist/backend/native/executable.js.map +1 -1
- package/dist/backend/native/library.js +4 -3
- package/dist/backend/native/library.js.map +1 -1
- package/dist/backend/native/program-shards.d.ts +2 -2
- package/dist/backend/native/program-shards.js +2 -2
- package/dist/backend/native/program-shards.js.map +1 -1
- package/dist/backend/native/runtime-inputs.d.ts +1 -1
- package/dist/backend/native/runtime-inputs.js +4 -1
- package/dist/backend/native/runtime-inputs.js.map +1 -1
- package/dist/backend/native/vendor.d.ts +1 -1
- package/dist/backend/native/vendor.js +1 -1
- package/dist/backend/native/vendor.js.map +1 -1
- package/dist/backend/native-codegen-core.d.ts +5 -3
- package/dist/backend/native-codegen-core.js +13 -6
- package/dist/backend/native-codegen-core.js.map +1 -1
- package/dist/backend/native-codegen.d.ts +3 -1
- package/dist/backend/native-codegen.js +4 -3
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +6 -4
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +8 -0
- package/dist/backend/native-link-info-core.js.map +1 -1
- package/dist/backend/native-profile.d.ts +14 -0
- package/dist/backend/native-profile.js +28 -0
- package/dist/backend/native-profile.js.map +1 -1
- package/dist/backend/native-profile.test.js +8 -1
- package/dist/backend/native-profile.test.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +11 -11
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/runtime-abi.d.ts +2 -2
- package/dist/backend/runtime-abi.js +2 -2
- package/dist/backend/runtime-pack-core.d.ts +3 -1
- package/dist/backend/runtime-pack-core.js +2 -0
- package/dist/backend/runtime-pack-core.js.map +1 -1
- package/dist/backend/runtime-pack-native.d.ts +17 -5
- package/dist/backend/runtime-pack-native.js +186 -14
- package/dist/backend/runtime-pack-native.js.map +1 -1
- package/dist/backend/runtime-pack-native.test.js +160 -3
- package/dist/backend/runtime-pack-native.test.js.map +1 -1
- 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-cpu.d.ts +26 -0
- package/dist/backend/target-cpu.js +98 -0
- package/dist/backend/target-cpu.js.map +1 -0
- package/dist/backend/target-cpu.test.d.ts +1 -0
- package/dist/backend/target-cpu.test.js +38 -0
- package/dist/backend/target-cpu.test.js.map +1 -0
- package/dist/backend/vendor-archives.d.ts +4 -1
- package/dist/backend/vendor-archives.js +78 -4
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +3 -1
- package/dist/backend/vendor-inputs.js +3 -1
- package/dist/backend/vendor-inputs.js.map +1 -1
- package/dist/backend/warm-cache.js +1 -0
- package/dist/backend/warm-cache.js.map +1 -1
- package/dist/cli/command.js +98 -12
- package/dist/cli/command.js.map +1 -1
- package/dist/cli/usage.d.ts +25 -1
- package/dist/cli/usage.js +40 -3
- package/dist/cli/usage.js.map +1 -1
- package/dist/compat/fetch-profile.d.ts +15 -6
- package/dist/compat/fetch-profile.js +519 -498
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +14 -0
- package/dist/contracts/int32-elements.js +2 -1
- package/dist/contracts/int32-elements.js.map +1 -1
- package/dist/coverage/report.d.ts +14 -3
- package/dist/coverage/report.js +216 -0
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +25 -25
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/coverage/verdict-cache.d.ts +2 -0
- package/dist/coverage/verdict-cache.js +10 -1
- package/dist/coverage/verdict-cache.js.map +1 -1
- package/dist/diagnostics/diagnostic.d.ts +19 -0
- package/dist/diagnostics/diagnostic.js +53 -2
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/diagnostics/envelope.d.ts +54 -0
- package/dist/diagnostics/envelope.js +7 -1
- package/dist/diagnostics/envelope.js.map +1 -1
- package/dist/diagnostics/render.d.ts +7 -0
- package/dist/diagnostics/render.js +15 -4
- package/dist/diagnostics/render.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +6 -0
- package/dist/executable/executable-cache.js +5 -0
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +3 -0
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.js +5 -1
- package/dist/executable/prepare.js.map +1 -1
- package/dist/frontend/analysis.js +26 -2
- package/dist/frontend/analysis.js.map +1 -1
- package/dist/frontend/decl-projection.js +105 -10
- package/dist/frontend/decl-projection.js.map +1 -1
- package/dist/frontend/fork-target.js +67 -1
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/fork-target.test.js +43 -0
- package/dist/frontend/fork-target.test.js.map +1 -1
- package/dist/frontend/input-tracker.d.ts +4 -1
- package/dist/frontend/input-tracker.js +42 -4
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +45 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lowering/abstract-equality.js +38 -1
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/argument-counts.d.ts +36 -0
- package/dist/frontend/lowering/argument-counts.js +201 -0
- package/dist/frontend/lowering/argument-counts.js.map +1 -0
- package/dist/frontend/lowering/array-values.d.ts +27 -0
- package/dist/frontend/lowering/array-values.js +112 -0
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/binding-analysis.d.ts +3 -0
- package/dist/frontend/lowering/binding-analysis.js +9 -3
- package/dist/frontend/lowering/binding-analysis.js.map +1 -1
- package/dist/frontend/lowering/builtin-namespaces.d.ts +13 -0
- package/dist/frontend/lowering/builtin-namespaces.js +238 -0
- package/dist/frontend/lowering/builtin-namespaces.js.map +1 -0
- package/dist/frontend/lowering/builtins/async-context.d.ts +8 -2
- package/dist/frontend/lowering/builtins/async-context.js +62 -3
- package/dist/frontend/lowering/builtins/async-context.js.map +1 -1
- package/dist/frontend/lowering/builtins/compression.d.ts +4 -3
- package/dist/frontend/lowering/builtins/compression.js +86 -5
- package/dist/frontend/lowering/builtins/compression.js.map +1 -1
- package/dist/frontend/lowering/builtins/crypto.js +3 -1
- package/dist/frontend/lowering/builtins/crypto.js.map +1 -1
- package/dist/frontend/lowering/builtins/date-classes.js +17 -1
- package/dist/frontend/lowering/builtins/date-classes.js.map +1 -1
- package/dist/frontend/lowering/builtins/dates.d.ts +19 -5
- package/dist/frontend/lowering/builtins/dates.js +163 -9
- package/dist/frontend/lowering/builtins/dates.js.map +1 -1
- package/dist/frontend/lowering/builtins/filesystem-calls.js +29 -4
- package/dist/frontend/lowering/builtins/filesystem-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-glob.js +6 -3
- package/dist/frontend/lowering/builtins/fs-glob.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-paths.d.ts +43 -5
- package/dist/frontend/lowering/builtins/fs-paths.js +245 -93
- package/dist/frontend/lowering/builtins/fs-paths.js.map +1 -1
- package/dist/frontend/lowering/builtins/fs-streams.d.ts +4 -0
- package/dist/frontend/lowering/builtins/fs-streams.js +24 -1
- package/dist/frontend/lowering/builtins/fs-streams.js.map +1 -1
- package/dist/frontend/lowering/builtins/json.d.ts +4 -1
- package/dist/frontend/lowering/builtins/json.js +9 -3
- package/dist/frontend/lowering/builtins/json.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-bindings.d.ts +6 -0
- package/dist/frontend/lowering/builtins/module-bindings.js +23 -1
- package/dist/frontend/lowering/builtins/module-bindings.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-calls.js +6 -3
- package/dist/frontend/lowering/builtins/module-calls.js.map +1 -1
- package/dist/frontend/lowering/builtins/module-resolution.d.ts +5 -0
- package/dist/frontend/lowering/builtins/module-resolution.js +95 -4
- package/dist/frontend/lowering/builtins/module-resolution.js.map +1 -1
- package/dist/frontend/lowering/builtins/promises.d.ts +1 -1
- package/dist/frontend/lowering/builtins/promises.js +293 -139
- package/dist/frontend/lowering/builtins/promises.js.map +1 -1
- package/dist/frontend/lowering/builtins/readline.d.ts +5 -1
- package/dist/frontend/lowering/builtins/readline.js +22 -11
- package/dist/frontend/lowering/builtins/readline.js.map +1 -1
- package/dist/frontend/lowering/builtins/reflection.d.ts +4 -1
- package/dist/frontend/lowering/builtins/reflection.js +41 -1
- package/dist/frontend/lowering/builtins/reflection.js.map +1 -1
- package/dist/frontend/lowering/builtins/text-codecs.js +31 -2
- package/dist/frontend/lowering/builtins/text-codecs.js.map +1 -1
- package/dist/frontend/lowering/builtins/webassembly.js +4 -1
- package/dist/frontend/lowering/builtins/webassembly.js.map +1 -1
- package/dist/frontend/lowering/builtins/x509.d.ts +33 -0
- package/dist/frontend/lowering/builtins/x509.js +431 -0
- package/dist/frontend/lowering/builtins/x509.js.map +1 -0
- package/dist/frontend/lowering/call-arguments.js +44 -0
- package/dist/frontend/lowering/call-arguments.js.map +1 -1
- package/dist/frontend/lowering/call-signatures.js +1 -2
- package/dist/frontend/lowering/call-signatures.js.map +1 -1
- package/dist/frontend/lowering/cjs-exports-object.js +1 -1
- package/dist/frontend/lowering/cjs-exports-object.js.map +1 -1
- package/dist/frontend/lowering/cjs-inline-require.d.ts +32 -0
- package/dist/frontend/lowering/cjs-inline-require.js +308 -5
- package/dist/frontend/lowering/cjs-inline-require.js.map +1 -1
- package/dist/frontend/lowering/class-attributes.d.ts +7 -0
- package/dist/frontend/lowering/class-attributes.js +52 -10
- package/dist/frontend/lowering/class-attributes.js.map +1 -1
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +23 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +288 -9
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -1
- package/dist/frontend/lowering/class-method-mutations.js +97 -26
- package/dist/frontend/lowering/class-method-mutations.js.map +1 -1
- package/dist/frontend/lowering/class-method-values.js +71 -1
- package/dist/frontend/lowering/class-method-values.js.map +1 -1
- package/dist/frontend/lowering/class-protocols.d.ts +25 -0
- package/dist/frontend/lowering/class-protocols.js +183 -1
- package/dist/frontend/lowering/class-protocols.js.map +1 -1
- package/dist/frontend/lowering/class-prototypes.d.ts +8 -0
- package/dist/frontend/lowering/class-prototypes.js +83 -2
- package/dist/frontend/lowering/class-prototypes.js.map +1 -1
- package/dist/frontend/lowering/class-to-primitive.d.ts +5 -0
- package/dist/frontend/lowering/class-to-primitive.js +79 -7
- package/dist/frontend/lowering/class-to-primitive.js.map +1 -1
- package/dist/frontend/lowering/coercions/state.d.ts +1 -0
- package/dist/frontend/lowering/coercions/state.js.map +1 -1
- package/dist/frontend/lowering/coercions/structural.js +89 -10
- package/dist/frontend/lowering/coercions/structural.js.map +1 -1
- package/dist/frontend/lowering/coercions/unions.d.ts +4 -2
- package/dist/frontend/lowering/coercions/unions.js +13 -6
- package/dist/frontend/lowering/coercions/unions.js.map +1 -1
- package/dist/frontend/lowering/completion-callbacks.d.ts +4 -0
- package/dist/frontend/lowering/completion-callbacks.js +146 -0
- package/dist/frontend/lowering/completion-callbacks.js.map +1 -0
- package/dist/frontend/lowering/containers/array-callbacks.d.ts +5 -4
- package/dist/frontend/lowering/containers/array-callbacks.js +58 -21
- package/dist/frontend/lowering/containers/array-callbacks.js.map +1 -1
- package/dist/frontend/lowering/containers/array-construction.d.ts +4 -1
- package/dist/frontend/lowering/containers/array-construction.js +107 -9
- package/dist/frontend/lowering/containers/array-construction.js.map +1 -1
- package/dist/frontend/lowering/containers/array-methods.js +96 -8
- package/dist/frontend/lowering/containers/array-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/array-pipelines.js +346 -77
- package/dist/frontend/lowering/containers/array-pipelines.js.map +1 -1
- package/dist/frontend/lowering/containers/bytes.d.ts +25 -17
- package/dist/frontend/lowering/containers/bytes.js +453 -45
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/callback-arguments.js +11 -1
- package/dist/frontend/lowering/containers/callback-arguments.js.map +1 -1
- package/dist/frontend/lowering/containers/collection-methods.js +12 -0
- package/dist/frontend/lowering/containers/collection-methods.js.map +1 -1
- package/dist/frontend/lowering/containers/indexed-objects.js +73 -25
- package/dist/frontend/lowering/containers/indexed-objects.js.map +1 -1
- package/dist/frontend/lowering/containers/iterator-helpers.d.ts +4 -4
- package/dist/frontend/lowering/containers/iterator-helpers.js +8 -2
- package/dist/frontend/lowering/containers/iterator-helpers.js.map +1 -1
- package/dist/frontend/lowering/containers/replacer-params.d.ts +37 -0
- package/dist/frontend/lowering/containers/replacer-params.js +294 -0
- package/dist/frontend/lowering/containers/replacer-params.js.map +1 -0
- package/dist/frontend/lowering/containers/replacer-params.test.d.ts +1 -0
- package/dist/frontend/lowering/containers/replacer-params.test.js +61 -0
- package/dist/frontend/lowering/containers/replacer-params.test.js.map +1 -0
- package/dist/frontend/lowering/containers/string-and-regexp.js +2 -1
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.js +7 -3
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -1
- package/dist/frontend/lowering/cycle-initialization.d.ts +4 -2
- package/dist/frontend/lowering/cycle-initialization.js +4 -1
- package/dist/frontend/lowering/cycle-initialization.js.map +1 -1
- package/dist/frontend/lowering/date-values.d.ts +14 -0
- package/dist/frontend/lowering/date-values.js +254 -0
- package/dist/frontend/lowering/date-values.js.map +1 -0
- package/dist/frontend/lowering/deferred-module-initializers.js +16 -8
- package/dist/frontend/lowering/deferred-module-initializers.js.map +1 -1
- package/dist/frontend/lowering/deferred-module-initializers.test.js +22 -6
- package/dist/frontend/lowering/deferred-module-initializers.test.js.map +1 -1
- package/dist/frontend/lowering/dispatch-sites.js +1 -0
- package/dist/frontend/lowering/dispatch-sites.js.map +1 -1
- package/dist/frontend/lowering/expressions/array-literals.d.ts +0 -8
- package/dist/frontend/lowering/expressions/array-literals.js +125 -26
- package/dist/frontend/lowering/expressions/array-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/binary.js +102 -26
- package/dist/frontend/lowering/expressions/binary.js.map +1 -1
- package/dist/frontend/lowering/expressions/element-access.js +129 -6
- package/dist/frontend/lowering/expressions/element-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/identifiers.js +66 -4
- package/dist/frontend/lowering/expressions/identifiers.js.map +1 -1
- package/dist/frontend/lowering/expressions/narrowing.d.ts +2 -1
- package/dist/frontend/lowering/expressions/narrowing.js +8 -1
- package/dist/frontend/lowering/expressions/narrowing.js.map +1 -1
- package/dist/frontend/lowering/expressions/object-literals.js +8 -2
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/property-access.js +121 -34
- package/dist/frontend/lowering/expressions/property-access.js.map +1 -1
- package/dist/frontend/lowering/expressions/relational.js +76 -11
- package/dist/frontend/lowering/expressions/relational.js.map +1 -1
- package/dist/frontend/lowering/expressions/typeof.js +12 -1
- package/dist/frontend/lowering/expressions/typeof.js.map +1 -1
- package/dist/frontend/lowering/expressions/updates.js +37 -11
- package/dist/frontend/lowering/expressions/updates.js.map +1 -1
- package/dist/frontend/lowering/f64-handles.d.ts +8 -0
- package/dist/frontend/lowering/f64-handles.js +16 -0
- package/dist/frontend/lowering/f64-handles.js.map +1 -0
- package/dist/frontend/lowering/frozen-records.d.ts +5 -0
- package/dist/frontend/lowering/frozen-records.js +12 -4
- package/dist/frontend/lowering/frozen-records.js.map +1 -1
- package/dist/frontend/lowering/function-context.d.ts +3 -0
- package/dist/frontend/lowering/function-context.js.map +1 -1
- package/dist/frontend/lowering/function-returns.js +30 -0
- package/dist/frontend/lowering/function-returns.js.map +1 -1
- package/dist/frontend/lowering/generic-functions.js +17 -6
- package/dist/frontend/lowering/generic-functions.js.map +1 -1
- package/dist/frontend/lowering/indexed-unions.d.ts +54 -0
- package/dist/frontend/lowering/indexed-unions.js +401 -0
- package/dist/frontend/lowering/indexed-unions.js.map +1 -0
- package/dist/frontend/lowering/instantiation-path.d.ts +3 -2
- package/dist/frontend/lowering/instantiation-path.js.map +1 -1
- package/dist/frontend/lowering/instantiation-path.test.js +6 -4
- package/dist/frontend/lowering/instantiation-path.test.js.map +1 -1
- package/dist/frontend/lowering/iterator-adapters.d.ts +4 -2
- package/dist/frontend/lowering/iterator-adapters.js +26 -33
- package/dist/frontend/lowering/iterator-adapters.js.map +1 -1
- package/dist/frontend/lowering/js-collection-types.d.ts +11 -0
- package/dist/frontend/lowering/js-collection-types.js +490 -0
- package/dist/frontend/lowering/js-collection-types.js.map +1 -0
- package/dist/frontend/lowering/key-order-witness.js +210 -32
- package/dist/frontend/lowering/key-order-witness.js.map +1 -1
- package/dist/frontend/lowering/key-order-witness.test.js +104 -4
- package/dist/frontend/lowering/key-order-witness.test.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.js +2 -2
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lower-assert.d.ts +14 -0
- package/dist/frontend/lowering/lower-assert.js +298 -29
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.js +3 -3
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.js +116 -10
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +59 -7
- package/dist/frontend/lowering/lower-classes.js +668 -222
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-console.js +2 -1
- package/dist/frontend/lowering/lower-console.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +5 -0
- package/dist/frontend/lowering/lower-exprs.js +254 -3
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-functions.js +7 -0
- package/dist/frontend/lowering/lower-functions.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.js +5 -4
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-inspect.d.ts +1 -1
- package/dist/frontend/lowering/lower-inspect.js +299 -57
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.js +49 -22
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +3 -0
- package/dist/frontend/lowering/lower-namespaces.js +44 -1
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.js +1 -1
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.js +126 -32
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stdlib.d.ts +4 -1
- package/dist/frontend/lowering/lower-stdlib.js +51 -37
- package/dist/frontend/lowering/lower-stdlib.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.js +393 -79
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.js +515 -121
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lowerer.d.ts +82 -12
- package/dist/frontend/lowering/lowerer.js +317 -44
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.js +1 -1
- package/dist/frontend/lowering/lowerer.test.js.map +1 -1
- package/dist/frontend/lowering/module-namespace-elements.d.ts +13 -0
- package/dist/frontend/lowering/module-namespace-elements.js +118 -1
- package/dist/frontend/lowering/module-namespace-elements.js.map +1 -1
- package/dist/frontend/lowering/object-factory-new.d.ts +5 -0
- package/dist/frontend/lowering/object-factory-new.js +20 -6
- package/dist/frontend/lowering/object-factory-new.js.map +1 -1
- package/dist/frontend/lowering/overload-choice.d.ts +33 -0
- package/dist/frontend/lowering/overload-choice.js +190 -0
- package/dist/frontend/lowering/overload-choice.js.map +1 -0
- package/dist/frontend/lowering/private-brands.d.ts +5 -0
- package/dist/frontend/lowering/private-brands.js +39 -0
- package/dist/frontend/lowering/private-brands.js.map +1 -1
- package/dist/frontend/lowering/runtime-optional-elements.d.ts +6 -0
- package/dist/frontend/lowering/runtime-optional-elements.js +14 -3
- package/dist/frontend/lowering/runtime-optional-elements.js.map +1 -1
- package/dist/frontend/lowering/sanitize-class-types.js +2 -0
- package/dist/frontend/lowering/sanitize-class-types.js.map +1 -1
- package/dist/frontend/lowering/site-dependencies.d.ts +7 -2
- package/dist/frontend/lowering/site-dependencies.js +0 -15
- package/dist/frontend/lowering/site-dependencies.js.map +1 -1
- package/dist/frontend/lowering/site-dependencies.test.js +7 -5
- package/dist/frontend/lowering/site-dependencies.test.js.map +1 -1
- package/dist/frontend/lowering/string-index-bounds.d.ts +7 -4
- package/dist/frontend/lowering/string-index-bounds.js +21 -7
- package/dist/frontend/lowering/string-index-bounds.js.map +1 -1
- package/dist/frontend/lowering/surfaces.d.ts +12 -3
- package/dist/frontend/lowering/surfaces.js +1630 -1540
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.d.ts +7 -0
- package/dist/frontend/lowering/symbol-fields.js +45 -2
- package/dist/frontend/lowering/symbol-fields.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.d.ts +5 -2
- package/dist/frontend/lowering/union-narrow.js +6 -3
- package/dist/frontend/lowering/union-narrow.js.map +1 -1
- package/dist/frontend/lowering/union-narrow.test.js +10 -0
- package/dist/frontend/lowering/union-narrow.test.js.map +1 -1
- package/dist/frontend/npm-static-namespace-defaults.d.ts +6 -0
- package/dist/frontend/npm-static-namespace-defaults.js +163 -0
- package/dist/frontend/npm-static-namespace-defaults.js.map +1 -0
- package/dist/frontend/npm-static-namespace-defaults.test.d.ts +1 -0
- package/dist/frontend/npm-static-namespace-defaults.test.js +72 -0
- package/dist/frontend/npm-static-namespace-defaults.test.js.map +1 -0
- package/dist/frontend/npm-static-prune.js +152 -111
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static.js +35 -32
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/package-shims.d.ts +7 -4
- package/dist/frontend/package-shims.js +39 -40
- package/dist/frontend/package-shims.js.map +1 -1
- package/dist/frontend/pipeline-native.d.ts +2 -2
- package/dist/frontend/pipeline-native.js +2 -2
- package/dist/frontend/pipeline-native.js.map +1 -1
- package/dist/frontend/pipeline.d.ts +19 -2
- package/dist/frontend/pipeline.js +103 -12
- package/dist/frontend/pipeline.js.map +1 -1
- package/dist/frontend/program-analysis.d.ts +7 -1
- package/dist/frontend/program-analysis.js +8 -0
- package/dist/frontend/program-analysis.js.map +1 -1
- package/dist/frontend/program.d.ts +28 -5
- package/dist/frontend/program.js +422 -76
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/resolve.d.ts +2 -0
- package/dist/frontend/resolve.js +5 -0
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/services.d.ts +3 -0
- package/dist/frontend/services.js +31 -4
- package/dist/frontend/services.js.map +1 -1
- package/dist/frontend/shape-inference/analyze.d.ts +93 -0
- package/dist/frontend/shape-inference/analyze.js +3138 -0
- package/dist/frontend/shape-inference/analyze.js.map +1 -0
- package/dist/frontend/shape-inference/constant-graphs.d.ts +54 -0
- package/dist/frontend/shape-inference/constant-graphs.js +357 -0
- package/dist/frontend/shape-inference/constant-graphs.js.map +1 -0
- package/dist/frontend/shape-inference/domain.d.ts +32 -0
- package/dist/frontend/shape-inference/domain.js +104 -0
- package/dist/frontend/shape-inference/domain.js.map +1 -0
- package/dist/frontend/shape-inference/index.d.ts +7 -0
- package/dist/frontend/shape-inference/index.js +19 -0
- package/dist/frontend/shape-inference/index.js.map +1 -0
- package/dist/frontend/shape-inference/report.d.ts +21 -0
- package/dist/frontend/shape-inference/report.js +348 -0
- package/dist/frontend/shape-inference/report.js.map +1 -0
- package/dist/frontend/token-equivalence.d.ts +6 -0
- package/dist/frontend/token-equivalence.js +66 -9
- package/dist/frontend/token-equivalence.js.map +1 -1
- package/dist/frontend/token-equivalence.test.js +33 -1
- package/dist/frontend/token-equivalence.test.js.map +1 -1
- package/dist/frontend/ts7/checker-features.d.ts +15 -0
- package/dist/frontend/ts7/checker-features.js +45 -0
- package/dist/frontend/ts7/checker-features.js.map +1 -0
- package/dist/frontend/ts7/checker-features.test.d.ts +1 -0
- package/dist/frontend/ts7/checker-features.test.js +40 -0
- package/dist/frontend/ts7/checker-features.test.js.map +1 -0
- package/dist/frontend/ts7/checker-server.d.ts +19 -0
- package/dist/frontend/ts7/checker-server.js +46 -0
- package/dist/frontend/ts7/checker-server.js.map +1 -0
- package/dist/frontend/ts7/checker-server.test.d.ts +1 -0
- package/dist/frontend/ts7/checker-server.test.js +38 -0
- package/dist/frontend/ts7/checker-server.test.js.map +1 -0
- package/dist/frontend/ts7/lib-diagnostics.js +39 -13
- package/dist/frontend/ts7/lib-diagnostics.js.map +1 -1
- package/dist/frontend/ts7/lib-diagnostics.test.js +40 -0
- package/dist/frontend/ts7/lib-diagnostics.test.js.map +1 -1
- package/dist/frontend/ts7/native-api.d.ts +1 -0
- package/dist/frontend/ts7/native-api.js +25 -2
- package/dist/frontend/ts7/native-api.js.map +1 -1
- package/dist/frontend/ts7/native-process.d.ts +9 -2
- package/dist/frontend/ts7/native-process.js +22 -4
- package/dist/frontend/ts7/native-process.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +11 -0
- package/dist/frontend/ts7/program-host.js +36 -22
- package/dist/frontend/ts7/program-host.js.map +1 -1
- package/dist/frontend/ts7/semantic-json.d.ts +9 -0
- package/dist/frontend/ts7/semantic-json.js +25 -5
- package/dist/frontend/ts7/semantic-json.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.d.ts +3 -0
- package/dist/frontend/ts7/semantic-model.js +8 -1
- package/dist/frontend/ts7/semantic-model.js.map +1 -1
- package/dist/frontend/ts7/semantic-model.test.js +6 -1
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -1
- package/dist/frontend/ts7/semantic-types.d.ts +1 -1
- package/dist/frontend/ts7/semantic-types.js +1 -1
- package/dist/frontend/ts7/semantic-types.js.map +1 -1
- package/dist/frontend/ts7/source-parser.js +3 -1
- package/dist/frontend/ts7/source-parser.js.map +1 -1
- package/dist/frontend/tsc-codes.js +10 -0
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +18 -6
- package/dist/frontend/type-mapper.js +205 -44
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/index.d.ts +44 -3
- package/dist/index.js +39 -8
- package/dist/index.js.map +1 -1
- package/dist/ir/builtin-effects.js +37 -0
- package/dist/ir/builtin-effects.js.map +1 -1
- package/dist/ir/builtin-signatures.d.ts +7 -2
- package/dist/ir/builtin-signatures.js +5104 -4894
- package/dist/ir/builtin-signatures.js.map +1 -1
- package/dist/ir/callback-specialization.d.ts +4 -2
- package/dist/ir/callback-specialization.js +24 -9
- package/dist/ir/callback-specialization.js.map +1 -1
- package/dist/ir/capture-values.js +4 -2
- package/dist/ir/capture-values.js.map +1 -1
- package/dist/ir/char-unit-locals.d.ts +12 -2
- package/dist/ir/char-unit-locals.js +400 -58
- package/dist/ir/char-unit-locals.js.map +1 -1
- package/dist/ir/char-unit-locals.test.js +111 -0
- package/dist/ir/char-unit-locals.test.js.map +1 -1
- package/dist/ir/constant-globals.js +18 -4
- package/dist/ir/constant-globals.js.map +1 -1
- package/dist/ir/expression-inlining.d.ts +15 -0
- package/dist/ir/expression-inlining.js +166 -0
- package/dist/ir/expression-inlining.js.map +1 -0
- package/dist/ir/expression-inlining.test.d.ts +1 -0
- package/dist/ir/expression-inlining.test.js +123 -0
- package/dist/ir/expression-inlining.test.js.map +1 -0
- package/dist/ir/function-references.js +2 -0
- package/dist/ir/function-references.js.map +1 -1
- package/dist/ir/function-references.test.js +6 -0
- package/dist/ir/function-references.test.js.map +1 -1
- package/dist/ir/int32-arrays.d.ts +27 -6
- package/dist/ir/int32-arrays.js +106 -18
- package/dist/ir/int32-arrays.js.map +1 -1
- package/dist/ir/int32-slots.d.ts +26 -1
- package/dist/ir/int32-slots.js +291 -5
- package/dist/ir/int32-slots.js.map +1 -1
- package/dist/ir/int32-slots.test.js +38 -0
- package/dist/ir/int32-slots.test.js.map +1 -1
- package/dist/ir/integer-loop-facts.d.ts +5 -0
- package/dist/ir/integer-loop-facts.js +90 -1
- package/dist/ir/integer-loop-facts.js.map +1 -1
- package/dist/ir/integer-loops.d.ts +14 -1
- package/dist/ir/integer-loops.js +107 -11
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-loops.test.js +70 -0
- package/dist/ir/integer-loops.test.js.map +1 -1
- package/dist/ir/integer-ranges.js +18 -2
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/integer-ranges.test.js +64 -4
- package/dist/ir/integer-ranges.test.js.map +1 -1
- package/dist/ir/ir.d.ts +63 -11
- package/dist/ir/ir.js +47 -7
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +2 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/js-ic.d.ts +10 -3
- package/dist/ir/js-ic.js +14 -2
- package/dist/ir/js-ic.js.map +1 -1
- package/dist/ir/js-ic.test.js +11 -0
- package/dist/ir/js-ic.test.js.map +1 -1
- package/dist/ir/node-index.d.ts +7 -0
- package/dist/ir/node-index.js +32 -0
- package/dist/ir/node-index.js.map +1 -1
- package/dist/ir/receiver-readers.d.ts +6 -1
- package/dist/ir/receiver-readers.js +53 -28
- package/dist/ir/receiver-readers.js.map +1 -1
- package/dist/ir/row-pairs.d.ts +15 -0
- package/dist/ir/row-pairs.js +373 -0
- package/dist/ir/row-pairs.js.map +1 -0
- package/dist/ir/row-pairs.test.d.ts +1 -0
- package/dist/ir/row-pairs.test.js +129 -0
- package/dist/ir/row-pairs.test.js.map +1 -0
- package/dist/ir/runtime-features.d.ts +17 -4
- package/dist/ir/runtime-features.js +94 -13
- package/dist/ir/runtime-features.js.map +1 -1
- package/dist/ir/scalar-records.d.ts +15 -0
- package/dist/ir/scalar-records.js +301 -1
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/scalar-records.test.js +181 -1
- package/dist/ir/scalar-records.test.js.map +1 -1
- package/dist/ir/self-captures.js +8 -0
- package/dist/ir/self-captures.js.map +1 -1
- package/dist/ir/validate.js +78 -28
- package/dist/ir/validate.js.map +1 -1
- package/dist/library/fence-eval.js +4 -4
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/ir-policy.js +5 -0
- package/dist/library/ir-policy.js.map +1 -1
- package/dist/library/library-cache.d.ts +1 -0
- package/dist/library/library-cache.js +1 -0
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +13 -0
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/native/cache.d.ts +5 -1
- package/dist/native/cache.js +15 -3
- package/dist/native/cache.js.map +1 -1
- package/dist/native/cli.js +6 -0
- package/dist/native/cli.js.map +1 -1
- package/dist/native/compiler.d.ts +3 -0
- package/dist/native/compiler.js +72 -26
- package/dist/native/compiler.js.map +1 -1
- package/dist/native/compiler.test.js +87 -2
- package/dist/native/compiler.test.js.map +1 -1
- package/dist/native/executable-cache-open.test.d.ts +1 -0
- package/dist/native/executable-cache-open.test.js +80 -0
- package/dist/native/executable-cache-open.test.js.map +1 -0
- package/dist/native/executable-cache.d.ts +43 -3
- package/dist/native/executable-cache.js +177 -36
- package/dist/native/executable-cache.js.map +1 -1
- package/dist/native/executable-cache.test.js +103 -0
- package/dist/native/executable-cache.test.js.map +1 -1
- package/dist/native/prepare.d.ts +1 -1
- package/dist/native/prepare.js +49 -17
- package/dist/native/prepare.js.map +1 -1
- package/dist/native/prepare.test.js +69 -3
- package/dist/native/prepare.test.js.map +1 -1
- package/dist/native/sanitizer.d.ts +1 -1
- package/dist/native/sanitizer.js +17 -3
- package/dist/native/sanitizer.js.map +1 -1
- package/dist/native/sanitizer.test.js +4 -0
- package/dist/native/sanitizer.test.js.map +1 -1
- package/dist/node-islands/classify.d.ts +14 -0
- package/dist/node-islands/classify.js +114 -0
- package/dist/node-islands/classify.js.map +1 -0
- package/dist/node-islands/detect.d.ts +13 -0
- package/dist/node-islands/detect.js +805 -0
- package/dist/node-islands/detect.js.map +1 -0
- package/dist/node-islands/detect.test.d.ts +1 -0
- package/dist/node-islands/detect.test.js +136 -0
- package/dist/node-islands/detect.test.js.map +1 -0
- package/dist/node-islands/origin.d.ts +21 -0
- package/dist/node-islands/origin.js +60 -0
- package/dist/node-islands/origin.js.map +1 -0
- package/dist/node-islands/policy.d.ts +49 -0
- package/dist/node-islands/policy.js +130 -0
- package/dist/node-islands/policy.js.map +1 -0
- package/dist/node-islands/report.d.ts +22 -0
- package/dist/node-islands/report.js +326 -0
- package/dist/node-islands/report.js.map +1 -0
- package/dist/node-islands/report.test.d.ts +1 -0
- package/dist/node-islands/report.test.js +228 -0
- package/dist/node-islands/report.test.js.map +1 -0
- package/dist/node-islands/rules.d.ts +20 -0
- package/dist/node-islands/rules.js +91 -0
- package/dist/node-islands/rules.js.map +1 -0
- package/dist/node-islands/scan.d.ts +53 -0
- package/dist/node-islands/scan.js +104 -0
- package/dist/node-islands/scan.js.map +1 -0
- package/dist/node-islands/summary.d.ts +78 -0
- package/dist/node-islands/summary.js +26 -0
- package/dist/node-islands/summary.js.map +1 -0
- package/dist/project-config.d.ts +50 -0
- package/dist/project-config.js +372 -0
- package/dist/project-config.js.map +1 -0
- package/dist/project-config.test.d.ts +1 -0
- package/dist/project-config.test.js +154 -0
- package/dist/project-config.test.js.map +1 -0
- package/dist/wasm/discover.js +6 -31
- package/dist/wasm/discover.js.map +1 -1
- package/package.json +20 -20
- package/surface-manifest.json +21 -38
package/dist/frontend/program.js
CHANGED
|
@@ -49,7 +49,7 @@ import { isPrunedNpmReexport, planNpmStaticReexports } from "./npm-static-prune.
|
|
|
49
49
|
import { npmStaticTypeExportPlan } from "./npm-static-type-exports-host.js";
|
|
50
50
|
import { isNpmStaticSubclassArgument } from "./npm-static-subtyping.js";
|
|
51
51
|
import { npmStaticDeclarationReexports, npmStaticRuntimeClassTargets, parseNpmStaticDeclarationOverloads, parseNpmStaticDeclarationProperties, } from "./npm-static-declaration-syntax.js";
|
|
52
|
-
import { configurePackageShims, isPackageShimFile,
|
|
52
|
+
import { configurePackageShims, isPackageShimFile, isShimmedImport, npmStaticOmitsPackage, } from "./package-shims.js";
|
|
53
53
|
import { provenanceEntryFor, provenancePaths } from "./provenance-registry.js";
|
|
54
54
|
import { cjsLexedExportsOfFile, cjsVisibleNames } from "./cjs-syntax.js";
|
|
55
55
|
import { ambientDtsPath, fallbackDtsPath, isNodeTypesPath, overridesDtsPath, tsgoPath, } from "./dts-paths.js";
|
|
@@ -62,6 +62,7 @@ import { workerTargetPaths } from "./worker-target.js";
|
|
|
62
62
|
import { erasedTypeOnlyImport, typeOnlyNamedImport, typeOnlyReachedFiles, } from "./type-only-imports.js";
|
|
63
63
|
import { moduleSourceCandidates } from "./module-source-candidates.js";
|
|
64
64
|
import { planDeclProjection } from "./decl-projection.js";
|
|
65
|
+
import { reportShapes } from "./shape-inference/index.js";
|
|
65
66
|
import { inferredJsDiagnosticSuppressed } from "./inferred-js-diagnostics.js";
|
|
66
67
|
import { containsJsx, firstJsx, jsxEmitName, jsxEmitPlan, jsxPragmas, lowerJsx, } from "./jsx-source.js";
|
|
67
68
|
const BASE_OPTIONS = {
|
|
@@ -303,33 +304,31 @@ function visitNpmStaticDeclarationClosure(services, entryPath, onSource) {
|
|
|
303
304
|
};
|
|
304
305
|
visit(entryPath);
|
|
305
306
|
}
|
|
306
|
-
|
|
307
|
-
|
|
307
|
+
/** The overloads and properties of the classes a package's declaration
|
|
308
|
+
* closure declares, read from one parse of each declaration file. */
|
|
309
|
+
function npmStaticDeclarationMetadataOf(services, entryPath) {
|
|
310
|
+
const overloads = new Map();
|
|
311
|
+
const properties = new Map();
|
|
308
312
|
visitNpmStaticDeclarationClosure(services, entryPath, (path, source) => {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
313
|
+
const sourceFile = services.parse(path, source, "ts");
|
|
314
|
+
for (const [className, methods] of parseNpmStaticDeclarationOverloads(sourceFile)) {
|
|
315
|
+
const target = overloads.get(className) ?? new Map();
|
|
316
|
+
overloads.set(className, target);
|
|
312
317
|
for (const [methodName, signatures] of methods) {
|
|
313
318
|
if (!target.has(methodName))
|
|
314
319
|
target.set(methodName, signatures);
|
|
315
320
|
}
|
|
316
321
|
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
const classes = new Map();
|
|
322
|
-
visitNpmStaticDeclarationClosure(services, entryPath, (path, source) => {
|
|
323
|
-
for (const [className, properties] of parseNpmStaticDeclarationProperties(services.parse(path, source, "ts"))) {
|
|
324
|
-
const target = classes.get(className) ?? new Map();
|
|
325
|
-
classes.set(className, target);
|
|
326
|
-
for (const [propertyName, type] of properties) {
|
|
322
|
+
for (const [className, fields] of parseNpmStaticDeclarationProperties(sourceFile)) {
|
|
323
|
+
const target = properties.get(className) ?? new Map();
|
|
324
|
+
properties.set(className, target);
|
|
325
|
+
for (const [propertyName, type] of fields) {
|
|
327
326
|
if (!target.has(propertyName))
|
|
328
327
|
target.set(propertyName, type);
|
|
329
328
|
}
|
|
330
329
|
}
|
|
331
330
|
});
|
|
332
|
-
return
|
|
331
|
+
return { overloads, properties };
|
|
333
332
|
}
|
|
334
333
|
/** True when a coverage mapping names one exact bare host module. TypeScript
|
|
335
334
|
* gives `paths` keys containing `*` pattern semantics, so accepting one here
|
|
@@ -808,11 +807,12 @@ export function loadProgram(entryPath, services, opts) {
|
|
|
808
807
|
}
|
|
809
808
|
externalTypes.set(specifier, declarationPath);
|
|
810
809
|
}
|
|
811
|
-
// Packages scriptc implements itself
|
|
812
|
-
// (package-shims.ts) never compile their published
|
|
813
|
-
// named.
|
|
810
|
+
// Packages scriptc implements itself, and packages the project marks
|
|
811
|
+
// never loaded (package-shims.ts), never compile their published
|
|
812
|
+
// JavaScript, even when named. A registry entry's `sourceVersions`
|
|
813
|
+
// (chalk 6) compile from their own source.
|
|
814
814
|
configurePackageShims(entryPath);
|
|
815
|
-
const npmStaticPackages = [...new Set(opts?.npmStatic ?? [])].filter((name) => !
|
|
815
|
+
const npmStaticPackages = [...new Set(opts?.npmStatic ?? [])].filter((name) => !npmStaticOmitsPackage(entryPath, name));
|
|
816
816
|
// Resolve authored declaration entries before enabling the JS-only
|
|
817
817
|
// package resolver. Safe overload metadata binds through the runtime
|
|
818
818
|
// entry to one exact implementation file; it never contributes values
|
|
@@ -827,8 +827,7 @@ export function loadProgram(entryPath, services, opts) {
|
|
|
827
827
|
!/\.d\.(?:ts|mts|cts)$/.test(resolved.typesFile)) {
|
|
828
828
|
continue;
|
|
829
829
|
}
|
|
830
|
-
const overloads =
|
|
831
|
-
const properties = npmStaticDeclarationPropertiesOf(services, resolved.typesFile);
|
|
830
|
+
const { overloads, properties } = npmStaticDeclarationMetadataOf(services, resolved.typesFile);
|
|
832
831
|
const classNames = new Set([...overloads.keys(), ...properties.keys()]);
|
|
833
832
|
if (classNames.size === 0)
|
|
834
833
|
continue;
|
|
@@ -976,6 +975,10 @@ export function loadProgram(entryPath, services, opts) {
|
|
|
976
975
|
};
|
|
977
976
|
try {
|
|
978
977
|
const load = loadProgram7(host, entryPath, externalTypes, npmStaticPackages.length > 0, projector);
|
|
978
|
+
// Shape inference, stage S1: a report only (SCRIPTC_DEBUG_SHAPES).
|
|
979
|
+
const shapes = process.env["SCRIPTC_DEBUG_SHAPES"];
|
|
980
|
+
if (shapes !== undefined && shapes !== "" && shapes !== "0" && npmStaticPackages.length > 0)
|
|
981
|
+
reportShapes(load.program, shapes);
|
|
979
982
|
return {
|
|
980
983
|
...load,
|
|
981
984
|
services,
|
|
@@ -1013,9 +1016,9 @@ export function loadProgram(entryPath, services, opts) {
|
|
|
1013
1016
|
* packages whose declarations the boundary projects from. */
|
|
1014
1017
|
function declBoundaryUserFiles(program, packages) {
|
|
1015
1018
|
const out = [];
|
|
1016
|
-
for (const sf of program.
|
|
1019
|
+
for (const sf of program.getImplementationSourceFiles()) {
|
|
1017
1020
|
const name = sf.fileName.split("\\").join("/");
|
|
1018
|
-
if (
|
|
1021
|
+
if (name.includes("/node_modules/") || !/\.[mc]?tsx?$/.test(name))
|
|
1019
1022
|
continue;
|
|
1020
1023
|
if (name.endsWith(".tsx"))
|
|
1021
1024
|
continue; // JSX files: not projected yet
|
|
@@ -1087,6 +1090,16 @@ function suppressedJsStrictness7(d) {
|
|
|
1087
1090
|
if (JS_ANY_OPERATOR_CODES.has(d.code)) {
|
|
1088
1091
|
return ts.flattenDiagnosticMessageText(d, "\n").includes("'any'");
|
|
1089
1092
|
}
|
|
1093
|
+
// The deprecated Buffer(...) call without `new`, which Node's Buffer
|
|
1094
|
+
// function accepts (containers/bytes.ts lowers it), and fs.ReadStream(...)
|
|
1095
|
+
// and fs.WriteStream(...), which construct their stream
|
|
1096
|
+
// (builtins/fs-streams.ts).
|
|
1097
|
+
if (d.code === 2348) {
|
|
1098
|
+
const text = ts.flattenDiagnosticMessageText(d, "\n");
|
|
1099
|
+
return (text.includes("'BufferConstructor'") ||
|
|
1100
|
+
text.includes("'typeof ReadStream'") ||
|
|
1101
|
+
text.includes("'typeof WriteStream'"));
|
|
1102
|
+
}
|
|
1090
1103
|
return false;
|
|
1091
1104
|
}
|
|
1092
1105
|
/** The specifier of a `require("...")` call: the callee is the bare
|
|
@@ -1126,9 +1139,15 @@ function isRequireStatement7(stmt) {
|
|
|
1126
1139
|
decls.every((d) => d.initializer !== undefined && requireSpecOf7(d.initializer) !== null));
|
|
1127
1140
|
}
|
|
1128
1141
|
/** The require() occurrences of one top-level statement: the declaration
|
|
1129
|
-
* forms
|
|
1130
|
-
|
|
1142
|
+
* forms, the bare side-effect call, and the assignment of a split require
|
|
1143
|
+
* binding. Empty for everything else. */
|
|
1144
|
+
function requiresOf7(stmt, program) {
|
|
1131
1145
|
if (ts.isExpressionStatement(stmt)) {
|
|
1146
|
+
const split = splitRequireOfStatement7(program, stmt);
|
|
1147
|
+
if (split !== null)
|
|
1148
|
+
return [
|
|
1149
|
+
{ spec: requireSpecOf7(split.call), node: split.call, decl: split.decl, split: true },
|
|
1150
|
+
];
|
|
1132
1151
|
const spec = requireSpecOf7(stmt.expression);
|
|
1133
1152
|
return spec !== null ? [{ spec, node: stmt.expression, decl: null }] : [];
|
|
1134
1153
|
}
|
|
@@ -1142,6 +1161,158 @@ function requiresOf7(stmt) {
|
|
|
1142
1161
|
}
|
|
1143
1162
|
return out;
|
|
1144
1163
|
}
|
|
1164
|
+
/** CommonJS require bindings split into a declaration and one later
|
|
1165
|
+
* assignment (`var m; m = require("./x")`): a top-level `var` or `let`
|
|
1166
|
+
* declaration without initializer in a CommonJS file, assigned by exactly one
|
|
1167
|
+
* top-level `m = require("<literal>")` statement of the require global over
|
|
1168
|
+
* a compiled program module, and written nowhere else. The binding holds the
|
|
1169
|
+
* module's exports from the assignment on, as `const m = require("./x")`
|
|
1170
|
+
* does, so preflight treats the assignment as that require: its module edge,
|
|
1171
|
+
* its cycle admission and its early-read fence. The lowering's recognizer
|
|
1172
|
+
* (splitRequireBindingOf in cjs-inline-require.ts) accepts only these
|
|
1173
|
+
* bindings. Keyed by declaration, with the assignment's require call. */
|
|
1174
|
+
function splitRequireBindings7(program, sf) {
|
|
1175
|
+
const memo = program.analysis.splitRequireBindings;
|
|
1176
|
+
const cached = memo.get(sf);
|
|
1177
|
+
if (cached !== undefined)
|
|
1178
|
+
return cached;
|
|
1179
|
+
const out = new Map();
|
|
1180
|
+
memo.set(sf, out);
|
|
1181
|
+
if (sf.isDeclarationFile || !isCjsJsFile7(sf, program) || !sf.text.includes("require"))
|
|
1182
|
+
return out;
|
|
1183
|
+
const checker = program.getTypeChecker();
|
|
1184
|
+
const stmts = sf.statements.nodes;
|
|
1185
|
+
const candidates = new Map();
|
|
1186
|
+
for (const stmt of stmts) {
|
|
1187
|
+
if (!ts.isVariableStatement(stmt))
|
|
1188
|
+
continue;
|
|
1189
|
+
if ((stmt.declarationList.flags & (ts.NodeFlags.Const | ts.NodeFlags.Using)) !== 0)
|
|
1190
|
+
continue;
|
|
1191
|
+
for (const decl of stmt.declarationList.declarations.nodes) {
|
|
1192
|
+
if (!ts.isIdentifier(decl.name) || decl.initializer !== undefined)
|
|
1193
|
+
continue;
|
|
1194
|
+
const symbol = checker.getSymbolAtLocation(decl.name);
|
|
1195
|
+
if (symbol === undefined || symbol.declarations.length !== 1)
|
|
1196
|
+
continue;
|
|
1197
|
+
candidates.set(symbol, { decl, call: null, assigns: 0 });
|
|
1198
|
+
}
|
|
1199
|
+
}
|
|
1200
|
+
if (candidates.size === 0)
|
|
1201
|
+
return out;
|
|
1202
|
+
// The one top-level `m = ...` statement, whose right side is the require.
|
|
1203
|
+
for (const stmt of stmts) {
|
|
1204
|
+
if (!ts.isExpressionStatement(stmt) || !ts.isBinaryExpression(stmt.expression))
|
|
1205
|
+
continue;
|
|
1206
|
+
const assign = stmt.expression;
|
|
1207
|
+
if (assign.operatorToken.kind !== ts.SyntaxKind.EqualsToken || !ts.isIdentifier(assign.left))
|
|
1208
|
+
continue;
|
|
1209
|
+
const symbol = checker.getSymbolAtLocation(assign.left);
|
|
1210
|
+
const candidate = symbol !== undefined ? candidates.get(symbol) : undefined;
|
|
1211
|
+
if (candidate === undefined)
|
|
1212
|
+
continue;
|
|
1213
|
+
candidate.assigns++;
|
|
1214
|
+
let right = assign.right;
|
|
1215
|
+
while (ts.isParenthesizedExpression(right))
|
|
1216
|
+
right = right.expression;
|
|
1217
|
+
if (ts.isCallExpression(right) && splitRequireTarget7(program, sf, right))
|
|
1218
|
+
candidate.call = right;
|
|
1219
|
+
}
|
|
1220
|
+
const names = new Set();
|
|
1221
|
+
for (const candidate of candidates.values()) {
|
|
1222
|
+
if (candidate.assigns === 1 && candidate.call !== null)
|
|
1223
|
+
names.add(candidate.decl.name.text);
|
|
1224
|
+
}
|
|
1225
|
+
if (names.size === 0)
|
|
1226
|
+
return out;
|
|
1227
|
+
// Exactly one write in the whole file: the assignment itself.
|
|
1228
|
+
const writes = new Map();
|
|
1229
|
+
ts.walkPreorder(sf, (node) => {
|
|
1230
|
+
if (!ts.isIdentifier(node) || !names.has(node.text))
|
|
1231
|
+
return undefined;
|
|
1232
|
+
const parent = node.parent;
|
|
1233
|
+
const symbol = parent !== undefined && ts.isShorthandPropertyAssignment(parent) && parent.name === node
|
|
1234
|
+
? (checker.getShorthandAssignmentValueSymbol(parent) ?? checker.getSymbolAtLocation(node))
|
|
1235
|
+
: checker.getSymbolAtLocation(node);
|
|
1236
|
+
if (symbol === undefined || !candidates.has(symbol) || !isWriteReference7(node))
|
|
1237
|
+
return undefined;
|
|
1238
|
+
writes.set(symbol, (writes.get(symbol) ?? 0) + 1);
|
|
1239
|
+
return undefined;
|
|
1240
|
+
});
|
|
1241
|
+
for (const [symbol, candidate] of candidates) {
|
|
1242
|
+
if (candidate.assigns === 1 && candidate.call !== null && writes.get(symbol) === 1)
|
|
1243
|
+
out.set(candidate.decl, candidate.call);
|
|
1244
|
+
}
|
|
1245
|
+
return out;
|
|
1246
|
+
}
|
|
1247
|
+
/** True when `call` is a require of the CommonJS global over a compiled
|
|
1248
|
+
* program module: not a builtin, a JSON document or a declaration file. */
|
|
1249
|
+
function splitRequireTarget7(program, sf, call) {
|
|
1250
|
+
const spec = requireSpecOf7(call);
|
|
1251
|
+
if (spec === null || canonicalBuiltinModule(spec) !== null)
|
|
1252
|
+
return false;
|
|
1253
|
+
if (requireCallBindingKind7(program, call) !== "ambient")
|
|
1254
|
+
return false;
|
|
1255
|
+
const dep = resolveImport7(program, sf, spec, "require") ?? npmStaticDepSf7(program, sf, spec, "require");
|
|
1256
|
+
return dep !== null && !dep.isDeclarationFile && !dep.fileName.endsWith(".json");
|
|
1257
|
+
}
|
|
1258
|
+
/** The split require binding a top-level statement assigns, or null. */
|
|
1259
|
+
function splitRequireOfStatement7(program, stmt) {
|
|
1260
|
+
if (!ts.isExpressionStatement(stmt) ||
|
|
1261
|
+
!ts.isBinaryExpression(stmt.expression) ||
|
|
1262
|
+
!ts.isSourceFile(stmt.parent))
|
|
1263
|
+
return null;
|
|
1264
|
+
let right = stmt.expression.right;
|
|
1265
|
+
while (ts.isParenthesizedExpression(right))
|
|
1266
|
+
right = right.expression;
|
|
1267
|
+
for (const [decl, call] of splitRequireBindings7(program, stmt.parent))
|
|
1268
|
+
if (call === right)
|
|
1269
|
+
return { decl, call };
|
|
1270
|
+
return null;
|
|
1271
|
+
}
|
|
1272
|
+
/** The top-level statement of a split require binding's assignment, from
|
|
1273
|
+
* its require call (`m = require("./x")` or `m = (require("./x"))`). */
|
|
1274
|
+
function splitRequireStatementOf7(call) {
|
|
1275
|
+
let node = call;
|
|
1276
|
+
while (node.parent !== undefined && ts.isParenthesizedExpression(node.parent))
|
|
1277
|
+
node = node.parent;
|
|
1278
|
+
return node.parent?.parent;
|
|
1279
|
+
}
|
|
1280
|
+
/** The require call of a split require binding's declaration, or null. */
|
|
1281
|
+
function splitRequireCallOf7(program, decl) {
|
|
1282
|
+
return splitRequireBindings7(program, ts.getSourceFileOfNode(decl)).get(decl) ?? null;
|
|
1283
|
+
}
|
|
1284
|
+
/** True when `id` is written: an assignment target (compound and
|
|
1285
|
+
* destructuring included), an update operand, or a for-in/of target. */
|
|
1286
|
+
function isWriteReference7(id) {
|
|
1287
|
+
let n = id;
|
|
1288
|
+
for (;;) {
|
|
1289
|
+
const p = n.parent;
|
|
1290
|
+
if (p === undefined)
|
|
1291
|
+
return false;
|
|
1292
|
+
if (ts.isBinaryExpression(p)) {
|
|
1293
|
+
const k = p.operatorToken.kind;
|
|
1294
|
+
return (p.left === n && k >= ts.SyntaxKind.FirstAssignment && k <= ts.SyntaxKind.LastAssignment);
|
|
1295
|
+
}
|
|
1296
|
+
if (ts.isPostfixUnaryExpression(p) || ts.isPrefixUnaryExpression(p)) {
|
|
1297
|
+
return ((p.operator === ts.SyntaxKind.PlusPlusToken ||
|
|
1298
|
+
p.operator === ts.SyntaxKind.MinusMinusToken) &&
|
|
1299
|
+
p.operand === n);
|
|
1300
|
+
}
|
|
1301
|
+
if (ts.isForOfStatement(p) || ts.isForInStatement(p))
|
|
1302
|
+
return p.initializer === n;
|
|
1303
|
+
if (ts.isParenthesizedExpression(p) ||
|
|
1304
|
+
ts.isArrayLiteralExpression(p) ||
|
|
1305
|
+
ts.isSpreadElement(p) ||
|
|
1306
|
+
ts.isSpreadAssignment(p) ||
|
|
1307
|
+
ts.isShorthandPropertyAssignment(p) ||
|
|
1308
|
+
ts.isObjectLiteralExpression(p) ||
|
|
1309
|
+
(ts.isPropertyAssignment(p) && p.initializer === n)) {
|
|
1310
|
+
n = p;
|
|
1311
|
+
continue;
|
|
1312
|
+
}
|
|
1313
|
+
return false;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1145
1316
|
/** `true`, or `!0`, its minified spelling. */
|
|
1146
1317
|
function isTrueLiteral(expr) {
|
|
1147
1318
|
return (expr.kind === ts.SyntaxKind.TrueKeyword ||
|
|
@@ -1269,7 +1440,7 @@ function purePrefixStmt7(program, s) {
|
|
|
1269
1440
|
return true;
|
|
1270
1441
|
if (ts.isExpressionStatement(s) && ts.isStringLiteral(s.expression))
|
|
1271
1442
|
return true; // directive
|
|
1272
|
-
if (isRequireStatement7(s))
|
|
1443
|
+
if (isRequireStatement7(s) || splitRequireOfStatement7(program, s) !== null)
|
|
1273
1444
|
return true;
|
|
1274
1445
|
if (isCjsJsFile7(ts.getSourceFileOfNode(s), program)) {
|
|
1275
1446
|
if (ts.isExpressionStatement(s) && isEsModuleStamp(s.expression)) {
|
|
@@ -1393,12 +1564,18 @@ function requireEarlyReference7(program, decl) {
|
|
|
1393
1564
|
if (cached !== undefined)
|
|
1394
1565
|
return cached;
|
|
1395
1566
|
let found = null;
|
|
1396
|
-
const stmt = decl.parent?.parent;
|
|
1397
1567
|
const sf = ts.getSourceFileOfNode(decl);
|
|
1398
|
-
|
|
1568
|
+
// A split require binding is bound at its assignment statement.
|
|
1569
|
+
const splitCall = splitRequireCallOf7(program, decl);
|
|
1570
|
+
const stmt = splitCall !== null ? splitRequireStatementOf7(splitCall) : decl.parent?.parent;
|
|
1571
|
+
if (stmt !== undefined &&
|
|
1572
|
+
(ts.isVariableStatement(stmt) || splitCall !== null) &&
|
|
1573
|
+
ts.isSourceFile(stmt.parent)) {
|
|
1399
1574
|
const stmts = sf.statements.nodes;
|
|
1400
1575
|
const k = stmts.indexOf(stmt);
|
|
1401
|
-
const declarations = stmt
|
|
1576
|
+
const declarations = ts.isVariableStatement(stmt)
|
|
1577
|
+
? stmt.declarationList.declarations.nodes
|
|
1578
|
+
: [];
|
|
1402
1579
|
// Earlier declarators run too: `const x = read(), dep = require('./dep')`.
|
|
1403
1580
|
const precedingDecls = declarations.slice(0, declarations.indexOf(decl));
|
|
1404
1581
|
let firstRunnable = program.analysis.requireFirstRunnable.get(sf);
|
|
@@ -1446,6 +1623,12 @@ exactEarlyRead) {
|
|
|
1446
1623
|
}
|
|
1447
1624
|
if (bindings.size === 0)
|
|
1448
1625
|
return null;
|
|
1626
|
+
// A split require binding's assignment writes the binding; it reads nothing.
|
|
1627
|
+
let splitWrite = splitRequireCallOf7(program, decl);
|
|
1628
|
+
while (splitWrite !== null && ts.isParenthesizedExpression(splitWrite.parent))
|
|
1629
|
+
splitWrite = splitWrite.parent;
|
|
1630
|
+
splitWrite =
|
|
1631
|
+
splitWrite !== null && ts.isBinaryExpression(splitWrite.parent) ? splitWrite.parent.left : null;
|
|
1449
1632
|
const stmts = sf.statements.nodes;
|
|
1450
1633
|
const cjs = isCjsJsFile7(sf, program);
|
|
1451
1634
|
const symbolOf = (id) => {
|
|
@@ -1690,7 +1873,7 @@ exactEarlyRead) {
|
|
|
1690
1873
|
if (sym === undefined)
|
|
1691
1874
|
return undefined;
|
|
1692
1875
|
if (bindings.has(sym)) {
|
|
1693
|
-
if (exactEarlyRead?.(n) === true)
|
|
1876
|
+
if (n === splitWrite || exactEarlyRead?.(n) === true)
|
|
1694
1877
|
return undefined;
|
|
1695
1878
|
hit = n;
|
|
1696
1879
|
return "stop";
|
|
@@ -2023,18 +2206,30 @@ export function isCreateRequireBinding7(program, callee) {
|
|
|
2023
2206
|
((decl.parent.flags & ts.NodeFlags.Const) !== 0 ||
|
|
2024
2207
|
stableCreateRequireBindingReason7(program, decl) === null));
|
|
2025
2208
|
}
|
|
2026
|
-
/**
|
|
2027
|
-
*
|
|
2028
|
-
*
|
|
2029
|
-
|
|
2209
|
+
/** How a use of a createRequire loader lowers:
|
|
2210
|
+
* - "static": a literal call or a literal resolution query, which erases
|
|
2211
|
+
* the loader value.
|
|
2212
|
+
* - "deferred": a call with a computed specifier or another argument shape,
|
|
2213
|
+
* or `resolve` / `resolve.paths` read as a value, inside the try block
|
|
2214
|
+
* of a try statement in the same function. The call throws a runtime
|
|
2215
|
+
* fence, and the resolve value is a function that throws one when called
|
|
2216
|
+
* (module-resolution.ts), so the statement's catch clause handles them
|
|
2217
|
+
* (packages that look for optional native addons).
|
|
2218
|
+
* - "computed": the same shapes outside a try block.
|
|
2219
|
+
* - "escaping": the loader itself as a value, writes, optional calls, and
|
|
2220
|
+
* other members. */
|
|
2221
|
+
const COMPUTED_CREATE_REQUIRE_REASON = "its createRequire result is used with a computed specifier, or its resolve as a value, outside a try block (static requires need literal specifiers)";
|
|
2222
|
+
function createRequireUse7(expr) {
|
|
2030
2223
|
let use = expr;
|
|
2031
2224
|
while (ts.isParenthesizedExpression(use.parent))
|
|
2032
2225
|
use = use.parent;
|
|
2226
|
+
let member = false;
|
|
2033
2227
|
if (ts.isPropertyAccessExpression(use.parent) &&
|
|
2034
2228
|
use.parent.expression === use &&
|
|
2035
2229
|
use.parent.name.text === "resolve" &&
|
|
2036
2230
|
!use.parent.questionDotToken) {
|
|
2037
2231
|
use = use.parent;
|
|
2232
|
+
member = true;
|
|
2038
2233
|
if (ts.isPropertyAccessExpression(use.parent) &&
|
|
2039
2234
|
use.parent.expression === use &&
|
|
2040
2235
|
use.parent.name.text === "paths" &&
|
|
@@ -2042,11 +2237,37 @@ function staticCreateRequireUse7(expr) {
|
|
|
2042
2237
|
use = use.parent;
|
|
2043
2238
|
}
|
|
2044
2239
|
const call = use.parent;
|
|
2045
|
-
|
|
2046
|
-
call.
|
|
2047
|
-
|
|
2048
|
-
call.arguments.nodes.length === 1 &&
|
|
2049
|
-
|
|
2240
|
+
if (ts.isCallExpression(call) && call.expression === use) {
|
|
2241
|
+
if (call.questionDotToken)
|
|
2242
|
+
return "escaping";
|
|
2243
|
+
if (call.arguments.nodes.length === 1 && ts.isStringLiteralLike(call.arguments.nodes[0]))
|
|
2244
|
+
return "static";
|
|
2245
|
+
}
|
|
2246
|
+
else if (!member || isAssignmentTarget7(use)) {
|
|
2247
|
+
return "escaping";
|
|
2248
|
+
}
|
|
2249
|
+
return insideTryBlock7(use) ? "deferred" : "computed";
|
|
2250
|
+
}
|
|
2251
|
+
function isAssignmentTarget7(node) {
|
|
2252
|
+
const parent = node.parent;
|
|
2253
|
+
return (ts.isBinaryExpression(parent) &&
|
|
2254
|
+
parent.left === node &&
|
|
2255
|
+
parent.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
2256
|
+
parent.operatorToken.kind <= ts.SyntaxKind.LastAssignment);
|
|
2257
|
+
}
|
|
2258
|
+
/** True when `node` is inside the try block of a try statement in the same
|
|
2259
|
+
* function (a catch clause or finally block does not count). A class field
|
|
2260
|
+
* initializer runs when the class is instantiated, so it is a boundary too. */
|
|
2261
|
+
function insideTryBlock7(node) {
|
|
2262
|
+
for (let child = node, parent = node.parent; parent; child = parent, parent = parent.parent) {
|
|
2263
|
+
if (ts.isTryStatement(parent) && parent.tryBlock === child)
|
|
2264
|
+
return true;
|
|
2265
|
+
if (ts.isFunctionLike(parent) ||
|
|
2266
|
+
ts.isClassStaticBlockDeclaration(parent) ||
|
|
2267
|
+
ts.isPropertyDeclaration(parent))
|
|
2268
|
+
return false;
|
|
2269
|
+
}
|
|
2270
|
+
return false;
|
|
2050
2271
|
}
|
|
2051
2272
|
function stableCreateRequireBindingReason7(program, decl) {
|
|
2052
2273
|
const cache = program.analysis.createRequireReasons;
|
|
@@ -2077,9 +2298,13 @@ function stableCreateRequireBindingReason7(program, decl) {
|
|
|
2077
2298
|
: checker.getSymbolAtLocation(ref);
|
|
2078
2299
|
if (target && (target.flags & ts.SymbolFlags.Alias) !== 0)
|
|
2079
2300
|
target = checker.getAliasedSymbol(target);
|
|
2080
|
-
if (target
|
|
2081
|
-
|
|
2082
|
-
|
|
2301
|
+
if (target !== symbol)
|
|
2302
|
+
continue;
|
|
2303
|
+
const use = createRequireUse7(ref);
|
|
2304
|
+
if (use === "computed")
|
|
2305
|
+
return COMPUTED_CREATE_REQUIRE_REASON;
|
|
2306
|
+
if (use === "escaping")
|
|
2307
|
+
return "its createRequire binding is reassigned or escapes";
|
|
2083
2308
|
}
|
|
2084
2309
|
const preceding = stmt.declarationList.declarations.nodes.slice(0, stmt.declarationList.declarations.nodes.indexOf(decl));
|
|
2085
2310
|
if (bindingEarlyUse7(program, sf, sf.statements.nodes.indexOf(stmt), decl, preceding) !== null) {
|
|
@@ -2133,10 +2358,11 @@ function npmStaticModuleImportReason7(program, stmt) {
|
|
|
2133
2358
|
checker.prefetchSymbolNodesExact(identifierOccurrences7(sf, specifier.name.text));
|
|
2134
2359
|
let reason = null;
|
|
2135
2360
|
const checkUse = (expr) => {
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2361
|
+
const use = createRequireUse7(expr);
|
|
2362
|
+
if (use === "computed")
|
|
2363
|
+
reason = COMPUTED_CREATE_REQUIRE_REASON;
|
|
2364
|
+
else if (use === "escaping")
|
|
2365
|
+
reason = "its createRequire result escapes (static requires need literal specifiers)";
|
|
2140
2366
|
};
|
|
2141
2367
|
ts.walkPreorder(sf, (node) => {
|
|
2142
2368
|
if (reason ||
|
|
@@ -3091,7 +3317,7 @@ function cjsCycleRefusal7(program, comp, lineOf) {
|
|
|
3091
3317
|
}
|
|
3092
3318
|
// Bindings of other members must stay unreachable from top-level code.
|
|
3093
3319
|
for (const st of stmts) {
|
|
3094
|
-
for (const req of requiresOf7(st)) {
|
|
3320
|
+
for (const req of requiresOf7(st, program)) {
|
|
3095
3321
|
if (req.decl === null)
|
|
3096
3322
|
continue;
|
|
3097
3323
|
const dep = resolveImport7(program, m, req.spec, "require");
|
|
@@ -3314,9 +3540,13 @@ function exactCycleRefusal7(program, comp, lineOf) {
|
|
|
3314
3540
|
if (ts.isExportAssignment(stmt) && !stmt.isExportEquals) {
|
|
3315
3541
|
return `the default export expression at ${lineOf(stmt)} has no initialization state inside the cycle`;
|
|
3316
3542
|
}
|
|
3543
|
+
// `export * from` binds each name to the declaring member's own
|
|
3544
|
+
// binding, like a named re-export, so only `export * as ns` (a
|
|
3545
|
+
// namespace object of a member) has state of its own.
|
|
3317
3546
|
if (ts.isExportDeclaration(stmt) &&
|
|
3318
3547
|
!stmt.isTypeOnly &&
|
|
3319
|
-
|
|
3548
|
+
stmt.exportClause !== undefined &&
|
|
3549
|
+
ts.isNamespaceExport(stmt.exportClause)) {
|
|
3320
3550
|
const dep = targetOf(stmt);
|
|
3321
3551
|
if (dep !== null && members.has(dep)) {
|
|
3322
3552
|
return `the namespace re-export at ${lineOf(stmt)} names a module of the cycle`;
|
|
@@ -4701,6 +4931,15 @@ function preflight7(load) {
|
|
|
4701
4931
|
return false;
|
|
4702
4932
|
return new RegExp(`\\btypeof\\s*\\(?\\s*${name.replace(/\$/g, "\\$")}(?![\\w$])`).test(sf.text);
|
|
4703
4933
|
};
|
|
4934
|
+
// A `return` at the top level of a CommonJS module (TS1108): Node runs
|
|
4935
|
+
// the module as a function body, so the return ends the module's
|
|
4936
|
+
// evaluation. ES modules and TypeScript keep the error.
|
|
4937
|
+
const cjsTopLevelReturnSuppressed = (p, d) => {
|
|
4938
|
+
if (d.code !== 1108 || d.fileName === undefined || !isJsSourceFileName(d.fileName))
|
|
4939
|
+
return false;
|
|
4940
|
+
const sf = p.getSourceFile(d.fileName);
|
|
4941
|
+
return sf !== undefined && isCjsJsFile7(sf, p);
|
|
4942
|
+
};
|
|
4704
4943
|
const workspaceImplicitAnySuppressed = (p, d) => {
|
|
4705
4944
|
if (d.code !== 7016 || d.fileName === undefined || d.pos === undefined || d.end === undefined)
|
|
4706
4945
|
return false;
|
|
@@ -4748,6 +4987,7 @@ function preflight7(load) {
|
|
|
4748
4987
|
!isNpmStaticSubclassArgument(p, d) &&
|
|
4749
4988
|
!workspaceImplicitAnySuppressed(p, d) &&
|
|
4750
4989
|
!typeofTestedNameSuppressed(p, d) &&
|
|
4990
|
+
!cjsTopLevelReturnSuppressed(p, d) &&
|
|
4751
4991
|
!jsdocTypeSuppressed(p, d, commentDup));
|
|
4752
4992
|
};
|
|
4753
4993
|
// The tsc gate, with a second chance: the LOWERING world's checker
|
|
@@ -5191,9 +5431,13 @@ function preflight7(load) {
|
|
|
5191
5431
|
// to Node's no-op, the module still evaluates through its
|
|
5192
5432
|
// ordinary init edge, and no member is ever read through the
|
|
5193
5433
|
// lexer facade (self-imports of a CJS module included — the
|
|
5194
|
-
// partially-built exports are never observed).
|
|
5195
|
-
//
|
|
5196
|
-
|
|
5434
|
+
// partially-built exports are never observed). In JavaScript
|
|
5435
|
+
// sources every use passes here: member reads lower through the
|
|
5436
|
+
// names Node's lexer detects, and the other reads refuse at
|
|
5437
|
+
// their site (lower-namespaces.ts, cjsNamespaceImportDep). Any
|
|
5438
|
+
// OTHER use in TypeScript keeps the fence.
|
|
5439
|
+
if (!isJsSourceFileName(sf.fileName) &&
|
|
5440
|
+
!nsBindingUsesAreBareStatements7(program, sf, clause.namedBindings.name)) {
|
|
5197
5441
|
diags.push(unsupportedDiag("SC1013", locOf7(clause.namedBindings), "namespace imports of CommonJS modules"));
|
|
5198
5442
|
}
|
|
5199
5443
|
}
|
|
@@ -5221,17 +5465,20 @@ function preflight7(load) {
|
|
|
5221
5465
|
const early = req.decl !== null ? requireEarlyReference7(program, req.decl) : null;
|
|
5222
5466
|
if (early === null ||
|
|
5223
5467
|
(bindingKind !== "createRequire" &&
|
|
5468
|
+
req.split === undefined &&
|
|
5224
5469
|
((req.decl.parent?.flags ?? 0) & (ts.NodeFlags.Const | ts.NodeFlags.Let)) !== 0)) {
|
|
5225
5470
|
return false;
|
|
5226
5471
|
}
|
|
5227
5472
|
diags.push(unsupportedDiag("SC1013", loc, bindingKind === "createRequire"
|
|
5228
5473
|
? `createRequire() binding '${early.text}' below code that can reach it (Node throws ReferenceError on any earlier access, which is not modeled — move the require above the code that can run first)`
|
|
5229
|
-
:
|
|
5474
|
+
: req.split !== undefined
|
|
5475
|
+
? `require() binding '${early.text}' assigned below code that can reach it (Node reads undefined before the assignment runs, which is not modeled — move the assignment above the code that can run first)`
|
|
5476
|
+
: `var require() binding '${early.text}' below code that can reach it (Node reads undefined before the require runs, which is not modeled — declare it with const or let, or move the require above the code that can run first)`));
|
|
5230
5477
|
return true;
|
|
5231
5478
|
};
|
|
5232
5479
|
for (let k = 0; k < stmts.length; k++) {
|
|
5233
5480
|
const stmt = stmts[k];
|
|
5234
|
-
for (const req of requiresOf7(stmt)) {
|
|
5481
|
+
for (const req of requiresOf7(stmt, program)) {
|
|
5235
5482
|
const loc = {
|
|
5236
5483
|
file: sf.fileName,
|
|
5237
5484
|
start: ts.tokenStartOfNode(req.node),
|
|
@@ -5260,8 +5507,8 @@ function preflight7(load) {
|
|
|
5260
5507
|
if (jsonDep !== null && jsonDep.fileName.endsWith(".json")) {
|
|
5261
5508
|
if (bindingKind === "createRequire")
|
|
5262
5509
|
continue;
|
|
5263
|
-
if (ts.isVariableStatement(stmt) && requiresOf7(stmt).length > 1) {
|
|
5264
|
-
const others = requiresOf7(stmt).some((r) => {
|
|
5510
|
+
if (ts.isVariableStatement(stmt) && requiresOf7(stmt, program).length > 1) {
|
|
5511
|
+
const others = requiresOf7(stmt, program).some((r) => {
|
|
5265
5512
|
const d = resolveImport7(program, sf, r.spec, "require");
|
|
5266
5513
|
return d === null || !d.fileName.endsWith(".json");
|
|
5267
5514
|
});
|
|
@@ -5423,9 +5670,14 @@ function preflight7(load) {
|
|
|
5423
5670
|
// counts, and targets outside the compiled graph add nothing here:
|
|
5424
5671
|
// their use sites keep their existing lowering fences.
|
|
5425
5672
|
if (jsRequireFile && !isNodeEsmFile7(sf, program)) {
|
|
5673
|
+
// A split require binding's assignment is a statement-level require
|
|
5674
|
+
// edge (requiresOf7 above), parenthesized or not.
|
|
5675
|
+
const splitCalls = new Set(splitRequireBindings7(program, sf).values());
|
|
5426
5676
|
for (const call of inlineRequiresOf7(sf)) {
|
|
5427
5677
|
if (requireCallBindingKind7(program, call) !== "ambient")
|
|
5428
5678
|
continue;
|
|
5679
|
+
if (splitCalls.has(call))
|
|
5680
|
+
continue;
|
|
5429
5681
|
const spec = requireSpecOf7(call);
|
|
5430
5682
|
if (load.externalTypes.has(spec) || canonicalBuiltinModule(spec) !== null)
|
|
5431
5683
|
continue;
|
|
@@ -5576,6 +5828,111 @@ function preflight7(load) {
|
|
|
5576
5828
|
moduleEdges: edges,
|
|
5577
5829
|
};
|
|
5578
5830
|
}
|
|
5831
|
+
/* ── the CJS named-import link check ─────────────────────────────────────
|
|
5832
|
+
* Node builds a CommonJS module's ESM facade from its LEXER (cjs-lexer.ts
|
|
5833
|
+
* mirrors it), never from execution — so a named import the checker binds
|
|
5834
|
+
* happily can still fail Node's instantiate phase with a SyntaxError,
|
|
5835
|
+
* thrown before ANY module in the graph evaluates. The checker's word is
|
|
5836
|
+
* NOT Node's word exactly here, and shipping the checker's answer would
|
|
5837
|
+
* diverge from Node without a diagnostic (`module.exports = { a: 7 }` served `a` where
|
|
5838
|
+
* Node refuses the program). This walk asks Node's question at compile
|
|
5839
|
+
* time, in Node's exact ORDER, and answers with Node's exact message. */
|
|
5840
|
+
/** The CommonJS program file a re-export (`module.exports = require(spec)`)
|
|
5841
|
+
* of `from` resolves to, or null: reexport targets union in only when they
|
|
5842
|
+
* resolve to CommonJS program files (Node's cjsPreparseModuleExports rule). */
|
|
5843
|
+
function cjsReexportDep7(program) {
|
|
5844
|
+
return (from, spec) => {
|
|
5845
|
+
const dep = resolveImport7(program, from, spec, "require") ??
|
|
5846
|
+
npmStaticDepSf7(program, from, spec, "require");
|
|
5847
|
+
return dep !== null && isCjsJsFile7(dep, program) ? dep : null;
|
|
5848
|
+
};
|
|
5849
|
+
}
|
|
5850
|
+
/** Node's lexer analysis of a CommonJS file. A bundler rewrite spells some
|
|
5851
|
+
* lexer-visible names as accessors. */
|
|
5852
|
+
function lexWithAccessorNames(sf) {
|
|
5853
|
+
const lexed = cjsLexedExportsOfFile(sf);
|
|
5854
|
+
for (const name of npmStaticLexerVisibleNames(sf.fileName))
|
|
5855
|
+
lexed.exports.add(name);
|
|
5856
|
+
return lexed;
|
|
5857
|
+
}
|
|
5858
|
+
/** The property names of Node's namespace object for the CommonJS module
|
|
5859
|
+
* `dep`: the names its lexer detects, CommonJS re-exports included (the
|
|
5860
|
+
* rule of the named-import link check), plus `default` and
|
|
5861
|
+
* `module.exports`. */
|
|
5862
|
+
/** `dep` and every CommonJS module it re-exports, transitively (the modules
|
|
5863
|
+
* whose exports its namespace object shows). */
|
|
5864
|
+
export function cjsReexportedModules(program, dep) {
|
|
5865
|
+
const resolveDep = cjsReexportDep7(program);
|
|
5866
|
+
const seen = new Set([dep]);
|
|
5867
|
+
const order = [dep];
|
|
5868
|
+
for (let i = 0; i < order.length; i++) {
|
|
5869
|
+
const mod = order[i];
|
|
5870
|
+
for (const spec of lexWithAccessorNames(mod).reexports) {
|
|
5871
|
+
const next = resolveDep(mod, spec);
|
|
5872
|
+
if (next !== null && !seen.has(next)) {
|
|
5873
|
+
seen.add(next);
|
|
5874
|
+
order.push(next);
|
|
5875
|
+
}
|
|
5876
|
+
}
|
|
5877
|
+
}
|
|
5878
|
+
return order;
|
|
5879
|
+
}
|
|
5880
|
+
export function cjsNamespaceExportNames(program, dep) {
|
|
5881
|
+
const names = cjsVisibleNames(dep, lexWithAccessorNames, cjsReexportDep7(program), new Map());
|
|
5882
|
+
return new Set([...names, "default", "module.exports"]);
|
|
5883
|
+
}
|
|
5884
|
+
/** The export names a CommonJS module assigns inside functions
|
|
5885
|
+
* (`exports.current = value` in a function body), or "all" when such code
|
|
5886
|
+
* writes a computed name, replaces module.exports or redefines exports
|
|
5887
|
+
* through Object.defineProperty. Node's namespace object of the module
|
|
5888
|
+
* holds the values the exports had when the module finished evaluating,
|
|
5889
|
+
* so it does not see those writes. */
|
|
5890
|
+
export function cjsExportsAssignedInFunctions(sf) {
|
|
5891
|
+
const names = new Set();
|
|
5892
|
+
let all = false;
|
|
5893
|
+
const exportsObject = (e) => (ts.isIdentifier(e) && e.text === "exports") || isModuleExportsAccess(e);
|
|
5894
|
+
const target = (e) => {
|
|
5895
|
+
while (ts.isParenthesizedExpression(e))
|
|
5896
|
+
e = e.expression;
|
|
5897
|
+
if (isModuleExportsAccess(e))
|
|
5898
|
+
all = true;
|
|
5899
|
+
else if (ts.isPropertyAccessExpression(e) && exportsObject(e.expression))
|
|
5900
|
+
names.add(e.name.text);
|
|
5901
|
+
else if (ts.isElementAccessExpression(e) && exportsObject(e.expression)) {
|
|
5902
|
+
if (ts.isStringLiteralLike(e.argumentExpression))
|
|
5903
|
+
names.add(e.argumentExpression.text);
|
|
5904
|
+
else
|
|
5905
|
+
all = true;
|
|
5906
|
+
}
|
|
5907
|
+
};
|
|
5908
|
+
const visit = (node, inFunction) => {
|
|
5909
|
+
if (all)
|
|
5910
|
+
return;
|
|
5911
|
+
const nested = inFunction || ts.isFunctionLike(node);
|
|
5912
|
+
if (nested) {
|
|
5913
|
+
if (ts.isBinaryExpression(node) &&
|
|
5914
|
+
node.operatorToken.kind >= ts.SyntaxKind.FirstAssignment &&
|
|
5915
|
+
node.operatorToken.kind <= ts.SyntaxKind.LastAssignment)
|
|
5916
|
+
target(node.left);
|
|
5917
|
+
else if ((ts.isPrefixUnaryExpression(node) || ts.isPostfixUnaryExpression(node)) &&
|
|
5918
|
+
(node.operator === ts.SyntaxKind.PlusPlusToken ||
|
|
5919
|
+
node.operator === ts.SyntaxKind.MinusMinusToken))
|
|
5920
|
+
target(node.operand);
|
|
5921
|
+
else if (ts.isDeleteExpression(node))
|
|
5922
|
+
target(node.expression);
|
|
5923
|
+
else if (ts.isCallExpression(node) &&
|
|
5924
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
|
5925
|
+
ts.isIdentifier(node.expression.expression) &&
|
|
5926
|
+
node.expression.expression.text === "Object" &&
|
|
5927
|
+
node.arguments.nodes[0] !== undefined &&
|
|
5928
|
+
exportsObject(node.arguments.nodes[0]))
|
|
5929
|
+
all = true;
|
|
5930
|
+
}
|
|
5931
|
+
ts.forEachChild(node, (child) => visit(child, nested));
|
|
5932
|
+
};
|
|
5933
|
+
visit(sf, false);
|
|
5934
|
+
return all ? "all" : names;
|
|
5935
|
+
}
|
|
5579
5936
|
/** Walks the entry's ESM instantiate graph exactly as V8 does — children
|
|
5580
5937
|
* in request order, each module's own imports checked AFTER its children
|
|
5581
5938
|
* (postorder), regular imports sorted by LOCAL name (code units), then
|
|
@@ -5601,25 +5958,14 @@ function cjsNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
5601
5958
|
const npmStatic = npmStaticDepSf7(program, from, spec);
|
|
5602
5959
|
return npmStatic;
|
|
5603
5960
|
};
|
|
5604
|
-
|
|
5605
|
-
// files (Node's cjsPreparseModuleExports rule).
|
|
5606
|
-
const resolveCjsDep = (from, spec) => {
|
|
5607
|
-
const dep = resolveImport7(program, from, spec, "require") ??
|
|
5608
|
-
npmStaticDepSf7(program, from, spec, "require");
|
|
5609
|
-
return dep !== null && isCjsJsFile7(dep, program) ? dep : null;
|
|
5610
|
-
};
|
|
5611
|
-
// A bundler rewrite spells some lexer-visible names as accessors.
|
|
5612
|
-
const lexWithAccessorNames = (sf) => {
|
|
5613
|
-
const lexed = cjsLexedExportsOfFile(sf);
|
|
5614
|
-
for (const name of npmStaticLexerVisibleNames(sf.fileName))
|
|
5615
|
-
lexed.exports.add(name);
|
|
5616
|
-
return lexed;
|
|
5617
|
-
};
|
|
5961
|
+
const resolveCjsDep = cjsReexportDep7(program);
|
|
5618
5962
|
const visible = (dep, name) =>
|
|
5619
|
-
// `default`
|
|
5620
|
-
// The program already owns native source ASTs;
|
|
5621
|
-
// starting another syntax session or reparsing
|
|
5963
|
+
// `default` and `module.exports` are the module.exports binding itself
|
|
5964
|
+
// — always provided. The program already owns native source ASTs;
|
|
5965
|
+
// reuse them without starting another syntax session or reparsing
|
|
5966
|
+
// their source text.
|
|
5622
5967
|
name === "default" ||
|
|
5968
|
+
name === "module.exports" ||
|
|
5623
5969
|
cjsVisibleNames(dep, lexWithAccessorNames, resolveCjsDep, lexMemo).has(name);
|
|
5624
5970
|
/** The statement's resolved LOCAL CommonJS dependency, when it is an
|
|
5625
5971
|
* import/re-export from one. */
|
|
@@ -5798,7 +6144,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
5798
6144
|
const nextSeen = new Set(seenModules);
|
|
5799
6145
|
nextSeen.add(dep);
|
|
5800
6146
|
const module = checker.getSymbolAtLocation(dep);
|
|
5801
|
-
const exported = module?.getExports().get(name);
|
|
6147
|
+
const exported = module?.getExports().get(ts.escapedSymbolName(name));
|
|
5802
6148
|
if (exported !== undefined) {
|
|
5803
6149
|
let resolved = exported;
|
|
5804
6150
|
const seenSymbols = new Set();
|
|
@@ -6076,7 +6422,7 @@ const nodeBuiltinNames = new Set(builtinModules);
|
|
|
6076
6422
|
export { ambientDtsPath, fallbackDtsPath, isNodeTypesPath, overridesDtsPath } from "./dts-paths.js";
|
|
6077
6423
|
export { builtinDefaultImportModule, canonicalBuiltinModule, npmBuiltinAliasOf, SUPPORTED_BUILTIN_MODULES, } from "./builtin-modules.js";
|
|
6078
6424
|
export { npmPackageNameOf, workspacePackageOfPath } from "./workspace-registry.js";
|
|
6079
|
-
export { requireSpecOf7 as requireSpecOf, isRequireStatement7 as isRequireStatement, requiresOf7 as requiresOf, isNodeEsmFile7 as isNodeEsmFile, resolveImport7 as resolveImport, resolveNpmImport7 as resolveNpmImport, locOf7 as locOf, requireEarlyReference7 as requireEarlyReference, inDeferredPosition7 as inDeferredPosition, };
|
|
6425
|
+
export { requireSpecOf7 as requireSpecOf, isRequireStatement7 as isRequireStatement, requiresOf7 as requiresOf, splitRequireCallOf7 as splitRequireCallOf, isNodeEsmFile7 as isNodeEsmFile, resolveImport7 as resolveImport, resolveNpmImport7 as resolveNpmImport, locOf7 as locOf, requireEarlyReference7 as requireEarlyReference, inDeferredPosition7 as inDeferredPosition, };
|
|
6080
6426
|
/** True for JavaScript source files (.js/.mjs/.cjs) — the files whose
|
|
6081
6427
|
* types come entirely from inference (checkJs + JSDoc) and whose classes
|
|
6082
6428
|
* declare fields by constructor assignment. */
|