@scriptc/compiler 0.1.7 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ambient/scriptc-node-fallback.d.ts +73 -24
- package/ambient/scriptc-overrides.d.ts +10 -6
- package/ambient/scriptc.d.ts +15 -0
- package/dist/backend/build-cache.d.ts +1 -3
- package/dist/backend/build-cache.js +3 -22
- package/dist/backend/build-cache.js.map +1 -1
- package/dist/backend/cache-root.d.ts +3 -0
- package/dist/backend/cache-root.js +23 -0
- package/dist/backend/cache-root.js.map +1 -0
- package/dist/backend/cycle-analysis.d.ts +15 -0
- package/dist/backend/cycle-analysis.js +107 -0
- package/dist/backend/cycle-analysis.js.map +1 -0
- package/dist/backend/cycle-analysis.test.js +124 -0
- package/dist/backend/cycle-analysis.test.js.map +1 -0
- package/dist/backend/executable-features.d.ts +4 -0
- package/dist/backend/executable-features.js +42 -0
- package/dist/backend/executable-features.js.map +1 -0
- package/dist/backend/external-c.d.ts +5 -27
- package/dist/backend/external-c.js +5 -40
- package/dist/backend/external-c.js.map +1 -1
- package/dist/backend/ffi-callbacks.d.ts +2 -3
- package/dist/backend/ffi-callbacks.js +2 -3
- package/dist/backend/ffi-callbacks.js.map +1 -1
- package/dist/backend/library-identity-markers.d.ts +4 -9
- package/dist/backend/library-identity-markers.js +11 -49
- package/dist/backend/library-identity-markers.js.map +1 -1
- package/dist/backend/library-pack.d.ts +5 -0
- package/dist/backend/library-pack.js +123 -0
- package/dist/backend/library-pack.js.map +1 -0
- package/dist/backend/link-plan-core.d.ts +20 -0
- package/dist/backend/link-plan-core.js +18 -0
- package/dist/backend/link-plan-core.js.map +1 -0
- package/dist/backend/link-plan.d.ts +1 -1
- package/dist/backend/link-plan.js +16 -17
- package/dist/backend/link-plan.js.map +1 -1
- package/dist/backend/link-trace.d.ts +2 -0
- package/dist/backend/link-trace.js +24 -0
- package/dist/backend/link-trace.js.map +1 -0
- package/dist/backend/linker.js +1 -1
- package/dist/backend/linker.js.map +1 -1
- package/dist/backend/literals.d.ts +9 -0
- package/dist/backend/literals.js +35 -0
- package/dist/backend/literals.js.map +1 -0
- package/dist/backend/literals.test.d.ts +1 -0
- package/dist/backend/literals.test.js +53 -0
- package/dist/backend/literals.test.js.map +1 -0
- package/dist/backend/llvm/blocks.d.ts +2 -0
- package/dist/backend/llvm/blocks.js +9 -4
- package/dist/backend/llvm/blocks.js.map +1 -1
- package/dist/backend/llvm/blocks.test.d.ts +1 -0
- package/dist/backend/llvm/blocks.test.js +91 -0
- package/dist/backend/llvm/blocks.test.js.map +1 -0
- package/dist/backend/llvm/classes.d.ts +14 -8
- package/dist/backend/llvm/classes.js +70 -28
- package/dist/backend/llvm/classes.js.map +1 -1
- package/dist/backend/llvm/common.d.ts +5 -1
- package/dist/backend/llvm/common.js +45 -4
- package/dist/backend/llvm/common.js.map +1 -1
- package/dist/backend/llvm/debug-info.js +2 -7
- package/dist/backend/llvm/debug-info.js.map +1 -1
- package/dist/backend/llvm/debug-info.test.d.ts +1 -0
- package/dist/backend/llvm/debug-info.test.js +110 -0
- package/dist/backend/llvm/debug-info.test.js.map +1 -0
- package/dist/backend/llvm/dyn.d.ts +16 -2
- package/dist/backend/llvm/dyn.js +494 -165
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +596 -1
- package/dist/backend/llvm/emitter.js +695 -410
- package/dist/backend/llvm/emitter.js.map +1 -1
- package/dist/backend/llvm/emitter.test.d.ts +1 -0
- package/dist/backend/llvm/emitter.test.js +179 -0
- package/dist/backend/llvm/emitter.test.js.map +1 -0
- package/dist/backend/llvm/expr-async.js +23 -14
- package/dist/backend/llvm/expr-async.js.map +1 -1
- package/dist/backend/llvm/expr-bytes.d.ts +1 -1
- package/dist/backend/llvm/expr-bytes.js +32 -14
- package/dist/backend/llvm/expr-bytes.js.map +1 -1
- package/dist/backend/llvm/expr-callbacks.d.ts +1 -1
- package/dist/backend/llvm/expr-callbacks.js +25 -22
- package/dist/backend/llvm/expr-callbacks.js.map +1 -1
- package/dist/backend/llvm/expr-calls.js +136 -35
- package/dist/backend/llvm/expr-calls.js.map +1 -1
- package/dist/backend/llvm/expr-containers.d.ts +1 -1
- package/dist/backend/llvm/expr-containers.js +43 -14
- package/dist/backend/llvm/expr-containers.js.map +1 -1
- package/dist/backend/llvm/expr-context.d.ts +5 -260
- package/dist/backend/llvm/expr-control.js +9 -5
- package/dist/backend/llvm/expr-control.js.map +1 -1
- package/dist/backend/llvm/expr-dispatch.d.ts +1 -1
- package/dist/backend/llvm/expr-dispatch.js +2 -0
- package/dist/backend/llvm/expr-dispatch.js.map +1 -1
- package/dist/backend/llvm/expr-dynamic.js +62 -74
- package/dist/backend/llvm/expr-dynamic.js.map +1 -1
- package/dist/backend/llvm/expr-island.d.ts +1 -1
- package/dist/backend/llvm/expr-island.js +11 -7
- package/dist/backend/llvm/expr-island.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.d.ts +1 -1
- package/dist/backend/llvm/expr-primitives.js +51 -30
- package/dist/backend/llvm/expr-primitives.js.map +1 -1
- package/dist/backend/llvm/expr-primitives.test.js +1 -1
- package/dist/backend/llvm/expr-records.d.ts +5 -1
- package/dist/backend/llvm/expr-records.js +43 -4
- package/dist/backend/llvm/expr-records.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.d.ts +4 -4
- package/dist/backend/llvm/expr-stream-bridges.js +102 -121
- package/dist/backend/llvm/expr-stream-bridges.js.map +1 -1
- package/dist/backend/llvm/expr-stream-bridges.test.d.ts +1 -0
- package/dist/backend/llvm/expr-stream-bridges.test.js +55 -0
- package/dist/backend/llvm/expr-stream-bridges.test.js.map +1 -0
- package/dist/backend/llvm/expr-stream-callbacks.d.ts +1 -1
- package/dist/backend/llvm/expr-stream-callbacks.js +12 -12
- package/dist/backend/llvm/expr-stream-callbacks.js.map +1 -1
- package/dist/backend/llvm/layouts.d.ts +19 -0
- package/dist/backend/llvm/layouts.js +12 -0
- package/dist/backend/llvm/layouts.js.map +1 -0
- package/dist/backend/llvm/lib-abi.d.ts +19 -0
- package/dist/backend/llvm/lib-abi.js +82 -0
- package/dist/backend/llvm/lib-abi.js.map +1 -0
- package/dist/backend/llvm/lib-connect.d.ts +2 -0
- package/dist/backend/llvm/lib-connect.js +51 -0
- package/dist/backend/llvm/lib-connect.js.map +1 -0
- package/dist/backend/llvm/lib-datagram.d.ts +2 -0
- package/dist/backend/llvm/lib-datagram.js +135 -0
- package/dist/backend/llvm/lib-datagram.js.map +1 -0
- package/dist/backend/llvm/lib-dispatch.js +50 -6
- package/dist/backend/llvm/lib-dispatch.js.map +1 -1
- package/dist/backend/llvm/lib-filesystem.js +30 -18
- package/dist/backend/llvm/lib-filesystem.js.map +1 -1
- package/dist/backend/llvm/lib-http2.d.ts +2 -0
- package/dist/backend/llvm/lib-http2.js +215 -0
- package/dist/backend/llvm/lib-http2.js.map +1 -0
- package/dist/backend/llvm/lib-lookup.d.ts +2 -0
- package/dist/backend/llvm/lib-lookup.js +39 -0
- package/dist/backend/llvm/lib-lookup.js.map +1 -0
- package/dist/backend/llvm/lib-network.js +25 -2
- package/dist/backend/llvm/lib-network.js.map +1 -1
- package/dist/backend/llvm/lib-process.js +21 -16
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +117 -1
- package/dist/backend/llvm/lib-shared.js.map +1 -1
- package/dist/backend/llvm/lib-stream.js +3 -2
- package/dist/backend/llvm/lib-stream.js.map +1 -1
- package/dist/backend/llvm/lib-test.d.ts +2 -0
- package/dist/backend/llvm/lib-test.js +34 -0
- package/dist/backend/llvm/lib-test.js.map +1 -0
- package/dist/backend/llvm/lib-tls.d.ts +2 -0
- package/dist/backend/llvm/lib-tls.js +82 -0
- package/dist/backend/llvm/lib-tls.js.map +1 -0
- package/dist/backend/llvm/shapes.d.ts +10 -9
- package/dist/backend/llvm/shapes.js +35 -130
- package/dist/backend/llvm/shapes.js.map +1 -1
- package/dist/backend/llvm/unsupported.d.ts +1 -0
- package/dist/backend/llvm/unsupported.js +1 -2
- package/dist/backend/llvm/unsupported.js.map +1 -1
- package/dist/backend/llvm/walkers.js +1 -7
- package/dist/backend/llvm/walkers.js.map +1 -1
- package/dist/backend/mangle.d.ts +2 -2
- package/dist/backend/mangle.js +16 -5
- package/dist/backend/mangle.js.map +1 -1
- package/dist/backend/{c/may-throw.d.ts → may-throw.d.ts} +1 -1
- package/dist/backend/{c/may-throw.js → may-throw.js} +51 -46
- package/dist/backend/may-throw.js.map +1 -0
- package/dist/backend/may-throw.test.d.ts +1 -0
- package/dist/backend/may-throw.test.js +58 -0
- package/dist/backend/may-throw.test.js.map +1 -0
- package/dist/backend/native-codegen-core.d.ts +22 -0
- package/dist/backend/native-codegen-core.js +44 -0
- package/dist/backend/native-codegen-core.js.map +1 -0
- package/dist/backend/native-codegen.d.ts +3 -19
- package/dist/backend/native-codegen.js +5 -44
- package/dist/backend/native-codegen.js.map +1 -1
- package/dist/backend/native-codegen.test.js +2 -2
- package/dist/backend/native-codegen.test.js.map +1 -1
- package/dist/backend/native-link-info-core.d.ts +94 -0
- package/dist/backend/native-link-info-core.js +62 -0
- package/dist/backend/native-link-info-core.js.map +1 -0
- package/dist/backend/native-link-info.d.ts +3 -88
- package/dist/backend/native-link-info.js +12 -243
- package/dist/backend/native-link-info.js.map +1 -1
- package/dist/backend/native-link-info.test.js +41 -146
- package/dist/backend/native-link-info.test.js.map +1 -1
- package/dist/backend/native-toolchain.d.ts +10 -25
- package/dist/backend/native-toolchain.js +31 -211
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +5 -5
- package/dist/backend/native-toolchain.test.js.map +1 -1
- package/dist/backend/native-tools.d.ts +24 -0
- package/dist/backend/native-tools.js +33 -0
- package/dist/backend/native-tools.js.map +1 -0
- package/dist/backend/object-localize.js +19 -8
- package/dist/backend/object-localize.js.map +1 -1
- package/dist/backend/object-localize.test.js +22 -0
- package/dist/backend/object-localize.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 +101 -0
- package/dist/backend/runtime-pack-core.js +172 -0
- package/dist/backend/runtime-pack-core.js.map +1 -0
- package/dist/backend/runtime-pack-native.d.ts +21 -0
- package/dist/backend/runtime-pack-native.js +70 -0
- package/dist/backend/runtime-pack-native.js.map +1 -0
- package/dist/backend/runtime-pack-targets.test.js +1 -1
- package/dist/backend/runtime-pack.d.ts +3 -83
- package/dist/backend/runtime-pack.js +8 -151
- package/dist/backend/runtime-pack.js.map +1 -1
- package/dist/backend/runtime-pack.test.js +24 -1
- package/dist/backend/runtime-pack.test.js.map +1 -1
- package/dist/backend/target-diagnostics.d.ts +22 -0
- package/dist/backend/target-diagnostics.js +108 -0
- package/dist/backend/target-diagnostics.js.map +1 -0
- package/dist/backend/target-platform.d.ts +15 -0
- package/dist/backend/target-platform.js +72 -0
- package/dist/backend/target-platform.js.map +1 -0
- package/dist/backend/targets.d.ts +13 -4
- package/dist/backend/targets.js +95 -30
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +65 -4
- package/dist/backend/targets.test.js.map +1 -1
- package/dist/backend/toolchain-environment.d.ts +6 -0
- package/dist/backend/toolchain-environment.js +99 -0
- package/dist/backend/toolchain-environment.js.map +1 -0
- package/dist/backend/vendor-archives.d.ts +1 -9
- package/dist/backend/vendor-archives.js +2 -9
- package/dist/backend/vendor-archives.js.map +1 -1
- package/dist/backend/vendor-inputs.d.ts +9 -0
- package/dist/backend/vendor-inputs.js +10 -0
- package/dist/backend/vendor-inputs.js.map +1 -0
- package/dist/backend/warm-cache.d.ts +3 -0
- package/dist/backend/warm-cache.js +41 -0
- package/dist/backend/warm-cache.js.map +1 -0
- package/dist/cli/command.d.ts +3 -0
- package/dist/cli/command.js +328 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/host.d.ts +24 -0
- package/dist/cli/host.js +2 -0
- package/dist/cli/host.js.map +1 -0
- package/dist/cli/output-options.d.ts +26 -0
- package/dist/cli/output-options.js +60 -0
- package/dist/cli/output-options.js.map +1 -0
- package/dist/cli/paths.d.ts +12 -0
- package/dist/cli/paths.js +42 -0
- package/dist/cli/paths.js.map +1 -0
- package/dist/cli/usage.d.ts +74 -0
- package/dist/cli/usage.js +86 -0
- package/dist/cli/usage.js.map +1 -0
- package/dist/cli/wasi-paths.d.ts +8 -0
- package/dist/cli/wasi-paths.js +41 -0
- package/dist/cli/wasi-paths.js.map +1 -0
- package/dist/cli/wasi-runner.d.ts +2 -0
- package/dist/cli/wasi-runner.js +28 -0
- package/dist/cli/wasi-runner.js.map +1 -0
- package/dist/compat/fetch-profile.js +3 -3
- package/dist/compat/fetch-profile.js.map +1 -1
- package/dist/compile-types.d.ts +162 -0
- package/dist/compile-types.js +2 -0
- package/dist/compile-types.js.map +1 -0
- package/dist/coverage/report.js +11 -5
- package/dist/coverage/report.js.map +1 -1
- package/dist/coverage/surface-manifest.js +5 -2
- package/dist/coverage/surface-manifest.js.map +1 -1
- package/dist/diagnostics/diagnostic.js +3 -3
- package/dist/diagnostics/diagnostic.js.map +1 -1
- package/dist/executable/executable-cache.d.ts +3 -4
- package/dist/executable/executable-cache.js +5 -6
- package/dist/executable/executable-cache.js.map +1 -1
- package/dist/executable/executable-cache.test.js +16 -17
- package/dist/executable/executable-cache.test.js.map +1 -1
- package/dist/executable/prepare.d.ts +14 -0
- package/dist/executable/prepare.js +66 -0
- package/dist/executable/prepare.js.map +1 -0
- package/dist/ffi/ffi-manifest.d.ts +11 -4
- package/dist/ffi/ffi-manifest.js +170 -58
- package/dist/ffi/ffi-manifest.js.map +1 -1
- package/dist/ffi/ffi-manifest.test.d.ts +1 -0
- package/dist/ffi/ffi-manifest.test.js +111 -0
- package/dist/ffi/ffi-manifest.test.js.map +1 -0
- package/dist/format-integer.d.ts +3 -0
- package/dist/format-integer.js +14 -0
- package/dist/format-integer.js.map +1 -0
- package/dist/frontend/analysis.d.ts +5 -0
- package/dist/frontend/analysis.js +88 -0
- package/dist/frontend/analysis.js.map +1 -0
- package/dist/frontend/arguments-usage.d.ts +1 -3
- package/dist/frontend/arguments-usage.js.map +1 -1
- package/dist/frontend/builtin-modules.d.ts +1 -1
- package/dist/frontend/builtin-modules.js +1 -1
- package/dist/frontend/builtin-modules.js.map +1 -1
- package/dist/frontend/cjs-lexer.d.ts +4 -25
- package/dist/frontend/cjs-lexer.js +6 -806
- package/dist/frontend/cjs-lexer.js.map +1 -1
- package/dist/frontend/cjs-resolve.d.ts +5 -0
- package/dist/frontend/cjs-resolve.js +429 -0
- package/dist/frontend/cjs-resolve.js.map +1 -0
- package/dist/frontend/cjs-syntax.d.ts +26 -0
- package/dist/frontend/cjs-syntax.js +806 -0
- package/dist/frontend/cjs-syntax.js.map +1 -0
- package/dist/frontend/comptime-node.d.ts +4 -0
- package/dist/frontend/comptime-node.js +16 -0
- package/dist/frontend/comptime-node.js.map +1 -0
- package/dist/frontend/comptime-node.test.d.ts +1 -0
- package/dist/frontend/comptime-node.test.js +37 -0
- package/dist/frontend/comptime-node.test.js.map +1 -0
- package/dist/frontend/dts-paths.d.ts +3 -4
- package/dist/frontend/dts-paths.js +15 -8
- package/dist/frontend/dts-paths.js.map +1 -1
- package/dist/frontend/fork-target.js +2 -2
- package/dist/frontend/fork-target.js.map +1 -1
- package/dist/frontend/helper-tokens.d.ts +1 -0
- package/dist/frontend/helper-tokens.js +147 -0
- package/dist/frontend/helper-tokens.js.map +1 -0
- package/dist/frontend/helper-tokens.test.d.ts +1 -0
- package/dist/frontend/helper-tokens.test.js +35 -0
- package/dist/frontend/helper-tokens.test.js.map +1 -0
- package/dist/frontend/inferred-js-diagnostics.d.ts +5 -0
- package/dist/frontend/inferred-js-diagnostics.js +69 -0
- package/dist/frontend/inferred-js-diagnostics.js.map +1 -0
- package/dist/frontend/inferred-js-diagnostics.test.d.ts +1 -0
- package/dist/frontend/inferred-js-diagnostics.test.js +58 -0
- package/dist/frontend/inferred-js-diagnostics.test.js.map +1 -0
- package/dist/frontend/input-tracker.d.ts +5 -2
- package/dist/frontend/input-tracker.js +24 -3
- package/dist/frontend/input-tracker.js.map +1 -1
- package/dist/frontend/input-tracker.test.js +23 -0
- package/dist/frontend/input-tracker.test.js.map +1 -1
- package/dist/frontend/lib-contract.js +32 -24
- package/dist/frontend/lib-contract.js.map +1 -1
- package/dist/frontend/literal-values.d.ts +4 -0
- package/dist/frontend/literal-values.js +21 -0
- package/dist/frontend/literal-values.js.map +1 -0
- package/dist/frontend/literal-values.test.d.ts +1 -0
- package/dist/frontend/literal-values.test.js +91 -0
- package/dist/frontend/literal-values.test.js.map +1 -0
- package/dist/frontend/lowering/abstract-equality.d.ts +1 -1
- package/dist/frontend/lowering/abstract-equality.js +3 -0
- package/dist/frontend/lowering/abstract-equality.js.map +1 -1
- package/dist/frontend/lowering/array-indexed-mutation.js +11 -6
- package/dist/frontend/lowering/array-indexed-mutation.js.map +1 -1
- package/dist/frontend/lowering/array-values.d.ts +4 -1
- package/dist/frontend/lowering/array-values.js +43 -1
- package/dist/frontend/lowering/array-values.js.map +1 -1
- package/dist/frontend/lowering/callback-arg.js +1 -0
- package/dist/frontend/lowering/callback-arg.js.map +1 -1
- package/dist/frontend/lowering/class-callbacks.d.ts +12 -0
- package/dist/frontend/lowering/class-callbacks.js +63 -0
- package/dist/frontend/lowering/class-callbacks.js.map +1 -0
- package/dist/frontend/lowering/class-descriptors.d.ts +9 -0
- package/dist/frontend/lowering/class-descriptors.js +73 -0
- package/dist/frontend/lowering/class-descriptors.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +41 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +803 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.d.ts +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js +92 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.test.js.map +1 -0
- package/dist/frontend/lowering/class-instance-constructor.d.ts +7 -0
- package/dist/frontend/lowering/class-instance-constructor.js +64 -0
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -0
- package/dist/frontend/lowering/class-method-values.d.ts +10 -0
- package/dist/frontend/lowering/class-method-values.js +170 -0
- package/dist/frontend/lowering/class-method-values.js.map +1 -0
- package/dist/frontend/lowering/class-prototypes.d.ts +16 -0
- package/dist/frontend/lowering/class-prototypes.js +134 -0
- package/dist/frontend/lowering/class-prototypes.js.map +1 -0
- package/dist/frontend/lowering/class-static-data.d.ts +6 -0
- package/dist/frontend/lowering/class-static-data.js +56 -0
- package/dist/frontend/lowering/class-static-data.js.map +1 -0
- package/dist/frontend/lowering/containers/buffer-numeric-methods.d.ts +4 -0
- package/dist/frontend/lowering/containers/buffer-numeric-methods.js +26 -0
- package/dist/frontend/lowering/containers/buffer-numeric-methods.js.map +1 -0
- package/dist/frontend/lowering/containers/bytes.d.ts +11 -7
- package/dist/frontend/lowering/containers/bytes.js +164 -155
- package/dist/frontend/lowering/containers/bytes.js.map +1 -1
- package/dist/frontend/lowering/containers/string-and-regexp.d.ts +2 -2
- package/dist/frontend/lowering/containers/string-and-regexp.js +39 -16
- package/dist/frontend/lowering/containers/string-and-regexp.js.map +1 -1
- package/dist/frontend/lowering/containers/string-replacement.d.ts +7 -0
- package/dist/frontend/lowering/containers/string-replacement.js +217 -0
- package/dist/frontend/lowering/containers/string-replacement.js.map +1 -0
- package/dist/frontend/lowering/error-methods.d.ts +11 -0
- package/dist/frontend/lowering/error-methods.js +78 -0
- package/dist/frontend/lowering/error-methods.js.map +1 -0
- package/dist/frontend/lowering/expressions/global-symbols.d.ts +6 -0
- package/dist/frontend/lowering/expressions/global-symbols.js +11 -0
- package/dist/frontend/lowering/expressions/global-symbols.js.map +1 -0
- package/dist/frontend/lowering/expressions/native-proxy.d.ts +7 -0
- package/dist/frontend/lowering/expressions/native-proxy.js +49 -0
- package/dist/frontend/lowering/expressions/native-proxy.js.map +1 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.d.ts +6 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js +124 -0
- package/dist/frontend/lowering/expressions/nullish-assignment.js.map +1 -0
- package/dist/frontend/lowering/expressions/object-literals.d.ts +8 -8
- package/dist/frontend/lowering/expressions/object-literals.js +473 -178
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.js +20 -8
- package/dist/frontend/lowering/expressions/optional-chains.js.map +1 -1
- package/dist/frontend/lowering/expressions/try-lower-expression.js +1 -0
- package/dist/frontend/lowering/expressions/try-lower-expression.js.map +1 -1
- package/dist/frontend/lowering/expressions/union-field-write.d.ts +8 -0
- package/dist/frontend/lowering/expressions/union-field-write.js +71 -0
- package/dist/frontend/lowering/expressions/union-field-write.js.map +1 -0
- package/dist/frontend/lowering/function-context.d.ts +93 -0
- package/dist/frontend/lowering/function-context.js +103 -0
- package/dist/frontend/lowering/function-context.js.map +1 -0
- package/dist/frontend/lowering/generator-delegation.d.ts +7 -0
- package/dist/frontend/lowering/generator-delegation.js +85 -0
- package/dist/frontend/lowering/generator-delegation.js.map +1 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.d.ts +10 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +105 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +2 -1
- package/dist/frontend/lowering/lib-boundary.js +59 -20
- package/dist/frontend/lowering/lib-boundary.js.map +1 -1
- package/dist/frontend/lowering/lib-boundary.test.d.ts +1 -0
- package/dist/frontend/lowering/lib-boundary.test.js +45 -0
- package/dist/frontend/lowering/lib-boundary.test.js.map +1 -0
- package/dist/frontend/lowering/lower-array-sort.d.ts +1 -1
- package/dist/frontend/lowering/lower-assert.d.ts +1 -1
- package/dist/frontend/lowering/lower-assert.js.map +1 -1
- package/dist/frontend/lowering/lower-async-iteration.d.ts +1 -1
- package/dist/frontend/lowering/lower-async-iteration.js.map +1 -1
- package/dist/frontend/lowering/lower-builtin-values.d.ts +12 -0
- package/dist/frontend/lowering/lower-builtin-values.js +139 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +27 -41
- package/dist/frontend/lowering/lower-builtins.js +539 -343
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +20 -17
- package/dist/frontend/lowering/lower-calls.js +1236 -353
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +83 -45
- package/dist/frontend/lowering/lower-classes.js +952 -339
- package/dist/frontend/lowering/lower-classes.js.map +1 -1
- package/dist/frontend/lowering/lower-comptime.d.ts +1 -1
- package/dist/frontend/lowering/lower-comptime.js +23 -32
- package/dist/frontend/lowering/lower-comptime.js.map +1 -1
- package/dist/frontend/lowering/lower-containers.d.ts +27 -32
- package/dist/frontend/lowering/lower-containers.js +796 -151
- package/dist/frontend/lowering/lower-containers.js.map +1 -1
- package/dist/frontend/lowering/lower-dgram.d.ts +1 -1
- package/dist/frontend/lowering/lower-dgram.js.map +1 -1
- package/dist/frontend/lowering/lower-enums.d.ts +1 -1
- package/dist/frontend/lowering/lower-enums.js.map +1 -1
- package/dist/frontend/lowering/lower-event-emitter.d.ts +30 -1
- package/dist/frontend/lowering/lower-event-emitter.js +58 -26
- package/dist/frontend/lowering/lower-event-emitter.js.map +1 -1
- package/dist/frontend/lowering/lower-expando.d.ts +7 -1
- package/dist/frontend/lowering/lower-expando.js +14 -6
- package/dist/frontend/lowering/lower-expando.js.map +1 -1
- package/dist/frontend/lowering/lower-exprs.d.ts +35 -11
- package/dist/frontend/lowering/lower-exprs.js +1674 -779
- package/dist/frontend/lowering/lower-exprs.js.map +1 -1
- package/dist/frontend/lowering/lower-generators.d.ts +2 -5
- package/dist/frontend/lowering/lower-generators.js +77 -46
- package/dist/frontend/lowering/lower-generators.js.map +1 -1
- package/dist/frontend/lowering/lower-global-value.d.ts +7 -0
- package/dist/frontend/lowering/lower-global-value.js +17 -0
- package/dist/frontend/lowering/lower-global-value.js.map +1 -0
- package/dist/frontend/lowering/lower-inspect.d.ts +1 -1
- package/dist/frontend/lowering/lower-inspect.js +17 -8
- package/dist/frontend/lowering/lower-inspect.js.map +1 -1
- package/dist/frontend/lowering/lower-island.d.ts +5 -8
- package/dist/frontend/lowering/lower-island.js +34 -23
- package/dist/frontend/lowering/lower-island.js.map +1 -1
- package/dist/frontend/lowering/lower-mixins.d.ts +2 -2
- package/dist/frontend/lowering/lower-mixins.js +5 -3
- package/dist/frontend/lowering/lower-mixins.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.d.ts +1 -1
- package/dist/frontend/lowering/lower-modules.js +233 -30
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-namespaces.d.ts +1 -1
- package/dist/frontend/lowering/lower-namespaces.js.map +1 -1
- package/dist/frontend/lowering/lower-node-module.d.ts +1 -1
- package/dist/frontend/lowering/lower-node-module.js +13 -10
- package/dist/frontend/lowering/lower-node-module.js.map +1 -1
- package/dist/frontend/lowering/lower-server.d.ts +1 -1
- package/dist/frontend/lowering/lower-server.js +6 -10
- package/dist/frontend/lowering/lower-server.js.map +1 -1
- package/dist/frontend/lowering/lower-stmts.d.ts +10 -14
- package/dist/frontend/lowering/lower-stmts.js +728 -496
- package/dist/frontend/lowering/lower-stmts.js.map +1 -1
- package/dist/frontend/lowering/lower-stream.d.ts +1 -1
- package/dist/frontend/lowering/lower-stream.js +19 -10
- package/dist/frontend/lowering/lower-stream.js.map +1 -1
- package/dist/frontend/lowering/lower-test.d.ts +1 -1
- package/dist/frontend/lowering/lower-test.js.map +1 -1
- package/dist/frontend/lowering/lower-url.d.ts +6 -0
- package/dist/frontend/lowering/lower-url.js +77 -0
- package/dist/frontend/lowering/lower-url.js.map +1 -0
- package/dist/frontend/lowering/lowerer.d.ts +113 -189
- package/dist/frontend/lowering/lowerer.js +1031 -672
- package/dist/frontend/lowering/lowerer.js.map +1 -1
- package/dist/frontend/lowering/lowerer.test.d.ts +1 -0
- package/dist/frontend/lowering/lowerer.test.js +26 -0
- package/dist/frontend/lowering/lowerer.test.js.map +1 -0
- package/dist/frontend/lowering/native-ffi.d.ts +5 -0
- package/dist/frontend/lowering/native-ffi.js +40 -0
- package/dist/frontend/lowering/native-ffi.js.map +1 -0
- package/dist/frontend/lowering/object-enumeration-receiver.d.ts +7 -0
- package/dist/frontend/lowering/object-enumeration-receiver.js +33 -0
- package/dist/frontend/lowering/object-enumeration-receiver.js.map +1 -0
- package/dist/frontend/lowering/object-factory-new.d.ts +8 -0
- package/dist/frontend/lowering/object-factory-new.js +68 -0
- package/dist/frontend/lowering/object-factory-new.js.map +1 -0
- package/dist/frontend/lowering/optional-arguments.js +6 -1
- package/dist/frontend/lowering/optional-arguments.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/runtime-optional-locals.d.ts +14 -0
- package/dist/frontend/lowering/runtime-optional-locals.js +41 -0
- package/dist/frontend/lowering/runtime-optional-locals.js.map +1 -0
- package/dist/frontend/lowering/runtime-optional-locals.test.d.ts +1 -0
- package/dist/frontend/lowering/runtime-optional-locals.test.js +85 -0
- package/dist/frontend/lowering/runtime-optional-locals.test.js.map +1 -0
- package/dist/frontend/lowering/sanitize-class-types.d.ts +8 -0
- package/dist/frontend/lowering/sanitize-class-types.js +79 -0
- package/dist/frontend/lowering/sanitize-class-types.js.map +1 -0
- package/dist/frontend/lowering/sanitize-class-types.test.d.ts +1 -0
- package/dist/frontend/lowering/sanitize-class-types.test.js +60 -0
- package/dist/frontend/lowering/sanitize-class-types.test.js.map +1 -0
- package/dist/frontend/lowering/static-this.d.ts +5 -1
- package/dist/frontend/lowering/static-this.js +28 -2
- package/dist/frontend/lowering/static-this.js.map +1 -1
- package/dist/frontend/lowering/string-index.d.ts +7 -0
- package/dist/frontend/lowering/string-index.js +39 -0
- package/dist/frontend/lowering/string-index.js.map +1 -0
- package/dist/frontend/lowering/surfaces.d.ts +8 -3
- package/dist/frontend/lowering/surfaces.js +61 -29
- package/dist/frontend/lowering/surfaces.js.map +1 -1
- package/dist/frontend/lowering/symbol-fields.d.ts +22 -0
- package/dist/frontend/lowering/symbol-fields.js +183 -0
- package/dist/frontend/lowering/symbol-fields.js.map +1 -0
- package/dist/frontend/lowering/symbol-methods.d.ts +7 -0
- package/dist/frontend/lowering/symbol-methods.js +30 -0
- package/dist/frontend/lowering/symbol-methods.js.map +1 -0
- package/dist/frontend/lowering/text-decoder-encoding.d.ts +10 -0
- package/dist/frontend/lowering/text-decoder-encoding.js +77 -0
- package/dist/frontend/lowering/text-decoder-encoding.js.map +1 -0
- package/dist/frontend/lowering/text-decoder-encoding.test.d.ts +1 -0
- package/dist/frontend/lowering/text-decoder-encoding.test.js +38 -0
- package/dist/frontend/lowering/text-decoder-encoding.test.js.map +1 -0
- package/dist/frontend/lowering/union-narrow.d.ts +9 -0
- package/dist/frontend/lowering/union-narrow.js +59 -0
- package/dist/frontend/lowering/union-narrow.js.map +1 -0
- package/dist/frontend/lowering/union-narrow.test.d.ts +1 -0
- package/dist/frontend/lowering/union-narrow.test.js +72 -0
- package/dist/frontend/lowering/union-narrow.test.js.map +1 -0
- package/dist/frontend/lowering/union-retag.d.ts +43 -0
- package/dist/frontend/lowering/union-retag.js +259 -0
- package/dist/frontend/lowering/union-retag.js.map +1 -0
- package/dist/frontend/lowering/union-retag.test.d.ts +1 -0
- package/dist/frontend/lowering/union-retag.test.js +405 -0
- package/dist/frontend/lowering/union-retag.test.js.map +1 -0
- package/dist/frontend/lowering/unregistered-class-types.d.ts +14 -0
- package/dist/frontend/lowering/unregistered-class-types.js +94 -0
- package/dist/frontend/lowering/unregistered-class-types.js.map +1 -0
- package/dist/frontend/lowering/unregistered-class-types.test.d.ts +1 -0
- package/dist/frontend/lowering/unregistered-class-types.test.js +65 -0
- package/dist/frontend/lowering/unregistered-class-types.test.js.map +1 -0
- package/dist/frontend/lowering/width-lift.d.ts +40 -0
- package/dist/frontend/lowering/width-lift.js +2 -0
- package/dist/frontend/lowering/width-lift.js.map +1 -0
- package/dist/frontend/module-syntax.d.ts +58 -0
- package/dist/frontend/module-syntax.js +123 -0
- package/dist/frontend/module-syntax.js.map +1 -0
- package/dist/frontend/module-syntax.test.d.ts +1 -0
- package/dist/frontend/module-syntax.test.js +78 -0
- package/dist/frontend/module-syntax.test.js.map +1 -0
- package/dist/frontend/npm-fetch-analysis.d.ts +17 -0
- package/dist/frontend/npm-fetch-analysis.js +100 -0
- package/dist/frontend/npm-fetch-analysis.js.map +1 -0
- package/dist/frontend/npm-fetch-analysis.test.d.ts +1 -0
- package/dist/frontend/npm-fetch-analysis.test.js +107 -0
- package/dist/frontend/npm-fetch-analysis.test.js.map +1 -0
- package/dist/frontend/npm-fetch-node.d.ts +2 -0
- package/dist/frontend/npm-fetch-node.js +12 -0
- package/dist/frontend/npm-fetch-node.js.map +1 -0
- package/dist/frontend/npm-fetch-syntax.d.ts +6 -0
- package/dist/frontend/npm-fetch-syntax.js +207 -0
- package/dist/frontend/npm-fetch-syntax.js.map +1 -0
- package/dist/frontend/npm-node.d.ts +10 -0
- package/dist/frontend/npm-node.js +14 -0
- package/dist/frontend/npm-node.js.map +1 -0
- package/dist/frontend/npm-static-bundled-cjs.d.ts +8 -0
- package/dist/frontend/npm-static-bundled-cjs.js +236 -0
- package/dist/frontend/npm-static-bundled-cjs.js.map +1 -0
- package/dist/frontend/npm-static-bundled-cjs.test.d.ts +1 -0
- package/dist/frontend/npm-static-bundled-cjs.test.js +69 -0
- package/dist/frontend/npm-static-bundled-cjs.test.js.map +1 -0
- package/dist/frontend/npm-static-declaration-syntax.d.ts +57 -0
- package/dist/frontend/npm-static-declaration-syntax.js +944 -0
- package/dist/frontend/npm-static-declaration-syntax.js.map +1 -0
- package/dist/frontend/npm-static-declarations.d.ts +11 -39
- package/dist/frontend/npm-static-declarations.js +22 -561
- package/dist/frontend/npm-static-declarations.js.map +1 -1
- package/dist/frontend/npm-static-declarations.test.js +245 -6
- package/dist/frontend/npm-static-declarations.test.js.map +1 -1
- package/dist/frontend/npm-static-prune.d.ts +1 -1
- package/dist/frontend/npm-static-prune.js +5 -4
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +1 -1
- package/dist/frontend/npm-static-prune.test.js.map +1 -1
- package/dist/frontend/npm-static-rewrite-host.d.ts +4 -0
- package/dist/frontend/npm-static-rewrite-host.js +179 -0
- package/dist/frontend/npm-static-rewrite-host.js.map +1 -0
- package/dist/frontend/npm-static-rewrite-syntax.d.ts +16 -0
- package/dist/frontend/npm-static-rewrite-syntax.js +905 -0
- package/dist/frontend/npm-static-rewrite-syntax.js.map +1 -0
- package/dist/frontend/npm-static-rewrite.d.ts +0 -5
- package/dist/frontend/npm-static-rewrite.js +2 -1079
- package/dist/frontend/npm-static-rewrite.js.map +1 -1
- package/dist/frontend/npm-static-subtyping.d.ts +5 -0
- package/dist/frontend/npm-static-subtyping.js +55 -0
- package/dist/frontend/npm-static-subtyping.js.map +1 -0
- package/dist/frontend/npm-static-subtyping.test.d.ts +1 -0
- package/dist/frontend/npm-static-subtyping.test.js +58 -0
- package/dist/frontend/npm-static-subtyping.test.js.map +1 -0
- package/dist/frontend/npm-static.d.ts +7 -15
- package/dist/frontend/npm-static.js +19 -28
- package/dist/frontend/npm-static.js.map +1 -1
- package/dist/frontend/npm.d.ts +8 -69
- package/dist/frontend/npm.js +21 -361
- package/dist/frontend/npm.js.map +1 -1
- package/dist/frontend/npm.test.js +2 -2
- package/dist/frontend/npm.test.js.map +1 -1
- package/dist/frontend/pipeline-native.d.ts +6 -0
- package/dist/frontend/pipeline-native.js +32 -0
- package/dist/frontend/pipeline-native.js.map +1 -0
- package/dist/frontend/pipeline.d.ts +54 -0
- package/dist/frontend/pipeline.js +382 -0
- package/dist/frontend/pipeline.js.map +1 -0
- package/dist/frontend/pipeline.test.d.ts +1 -0
- package/dist/frontend/pipeline.test.js +77 -0
- package/dist/frontend/pipeline.test.js.map +1 -0
- package/dist/frontend/program-analysis.d.ts +10 -0
- package/dist/frontend/program-analysis.js +14 -0
- package/dist/frontend/program-analysis.js.map +1 -0
- package/dist/frontend/program-node.d.ts +9 -0
- package/dist/frontend/program-node.js +48 -0
- package/dist/frontend/program-node.js.map +1 -0
- package/dist/frontend/program.d.ts +38 -19
- package/dist/frontend/program.js +344 -169
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +87 -2
- package/dist/frontend/program.test.js.map +1 -1
- package/dist/frontend/provenance-core.d.ts +9 -0
- package/dist/frontend/provenance-core.js +435 -0
- package/dist/frontend/provenance-core.js.map +1 -0
- package/dist/frontend/provenance.d.ts +0 -4
- package/dist/frontend/provenance.js +4 -459
- package/dist/frontend/provenance.js.map +1 -1
- package/dist/frontend/resolve.d.ts +3 -1
- package/dist/frontend/resolve.js +6 -3
- package/dist/frontend/resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.d.ts +4 -3
- package/dist/frontend/runtime-resolve.js +22 -18
- package/dist/frontend/runtime-resolve.js.map +1 -1
- package/dist/frontend/runtime-resolve.test.js +53 -0
- package/dist/frontend/runtime-resolve.test.js.map +1 -1
- package/dist/frontend/services-node.d.ts +5 -0
- package/dist/frontend/services-node.js +19 -0
- package/dist/frontend/services-node.js.map +1 -0
- package/dist/frontend/services-node.test.d.ts +1 -0
- package/dist/frontend/services-node.test.js +70 -0
- package/dist/frontend/services-node.test.js.map +1 -0
- package/dist/frontend/services.d.ts +44 -0
- package/dist/frontend/services.js +90 -0
- package/dist/frontend/services.js.map +1 -0
- package/dist/frontend/services.test.d.ts +1 -0
- package/dist/frontend/services.test.js +174 -0
- package/dist/frontend/services.test.js.map +1 -0
- package/dist/frontend/ts7/adapter.d.ts +3 -3
- package/dist/frontend/ts7/adapter.js +14 -31
- package/dist/frontend/ts7/adapter.js.map +1 -1
- package/dist/frontend/ts7/api.d.ts +16 -0
- package/dist/frontend/ts7/api.js +24 -0
- package/dist/frontend/ts7/api.js.map +1 -0
- package/dist/frontend/ts7/ast-bytes.d.ts +31 -0
- package/dist/frontend/ts7/ast-bytes.js +137 -0
- package/dist/frontend/ts7/ast-bytes.js.map +1 -0
- package/dist/frontend/ts7/ast-bytes.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-bytes.test.js +73 -0
- package/dist/frontend/ts7/ast-bytes.test.js.map +1 -0
- package/dist/frontend/ts7/ast-guards.generated.d.ts +353 -0
- package/dist/frontend/ts7/ast-guards.generated.js +1951 -0
- package/dist/frontend/ts7/ast-guards.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-guards.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-guards.test.js +43 -0
- package/dist/frontend/ts7/ast-guards.test.js.map +1 -0
- package/dist/frontend/ts7/ast-node.d.ts +194 -0
- package/dist/frontend/ts7/ast-node.js +448 -0
- package/dist/frontend/ts7/ast-node.js.map +1 -0
- package/dist/frontend/ts7/ast-node.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-node.test.js +266 -0
- package/dist/frontend/ts7/ast-node.test.js.map +1 -0
- package/dist/frontend/ts7/ast-schema.generated.d.ts +503 -0
- package/dist/frontend/ts7/ast-schema.generated.js +1446 -0
- package/dist/frontend/ts7/ast-schema.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-text.d.ts +6 -0
- package/dist/frontend/ts7/ast-text.js +124 -0
- package/dist/frontend/ts7/ast-text.js.map +1 -0
- package/dist/frontend/ts7/ast-text.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-text.test.js +38 -0
- package/dist/frontend/ts7/ast-text.test.js.map +1 -0
- package/dist/frontend/ts7/ast-tokens.generated.d.ts +2 -0
- package/dist/frontend/ts7/ast-tokens.generated.js +155 -0
- package/dist/frontend/ts7/ast-tokens.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-types.d.ts +42 -0
- package/dist/frontend/ts7/ast-types.generated.d.ts +1615 -0
- package/dist/frontend/ts7/ast-types.generated.js +5 -0
- package/dist/frontend/ts7/ast-types.generated.js.map +1 -0
- package/dist/frontend/ts7/ast-types.js +3 -0
- package/dist/frontend/ts7/ast-types.js.map +1 -0
- package/dist/frontend/ts7/ast-wire.d.ts +58 -0
- package/dist/frontend/ts7/ast-wire.js +267 -0
- package/dist/frontend/ts7/ast-wire.js.map +1 -0
- package/dist/frontend/ts7/ast-wire.test.d.ts +1 -0
- package/dist/frontend/ts7/ast-wire.test.js +151 -0
- package/dist/frontend/ts7/ast-wire.test.js.map +1 -0
- package/dist/frontend/ts7/ast.d.ts +14 -14
- package/dist/frontend/ts7/ast.js +21 -15
- package/dist/frontend/ts7/ast.js.map +1 -1
- package/dist/frontend/ts7/census-check.js +1 -0
- package/dist/frontend/ts7/census-check.js.map +1 -1
- package/dist/frontend/ts7/checker-cache.d.ts +48 -0
- package/dist/frontend/ts7/checker-cache.js +92 -0
- package/dist/frontend/ts7/checker-cache.js.map +1 -0
- package/dist/frontend/ts7/checker.d.ts +19 -46
- package/dist/frontend/ts7/checker.js +231 -161
- package/dist/frontend/ts7/checker.js.map +1 -1
- package/dist/frontend/ts7/checker.test.d.ts +1 -0
- package/dist/frontend/ts7/checker.test.js +335 -0
- package/dist/frontend/ts7/checker.test.js.map +1 -0
- package/dist/frontend/ts7/enums.d.ts +4 -27
- package/dist/frontend/ts7/enums.generated.d.ts +878 -0
- package/dist/frontend/ts7/enums.generated.js +1313 -0
- package/dist/frontend/ts7/enums.generated.js.map +1 -0
- package/dist/frontend/ts7/enums.js +4 -45
- package/dist/frontend/ts7/enums.js.map +1 -1
- package/dist/frontend/ts7/enums.test.d.ts +1 -0
- package/dist/frontend/ts7/enums.test.js +48 -0
- package/dist/frontend/ts7/enums.test.js.map +1 -0
- package/dist/frontend/ts7/native-api.d.ts +10 -0
- package/dist/frontend/ts7/native-api.js +10 -0
- package/dist/frontend/ts7/native-api.js.map +1 -0
- package/dist/frontend/ts7/native-host.d.ts +2 -0
- package/dist/frontend/ts7/native-host.js +11 -0
- package/dist/frontend/ts7/native-host.js.map +1 -0
- package/dist/frontend/ts7/native-process.d.ts +14 -0
- package/dist/frontend/ts7/native-process.js +62 -0
- package/dist/frontend/ts7/native-process.js.map +1 -0
- package/dist/frontend/ts7/program-adapter.d.ts +10 -98
- package/dist/frontend/ts7/program-adapter.js +16 -310
- package/dist/frontend/ts7/program-adapter.js.map +1 -1
- package/dist/frontend/ts7/program-host.d.ts +115 -0
- package/dist/frontend/ts7/program-host.js +347 -0
- package/dist/frontend/ts7/program-host.js.map +1 -0
- package/dist/frontend/ts7/program-host.test.d.ts +1 -0
- package/dist/frontend/ts7/program-host.test.js +207 -0
- package/dist/frontend/ts7/program-host.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-api.d.ts +12 -0
- package/dist/frontend/ts7/rpc-api.js +23 -0
- package/dist/frontend/ts7/rpc-api.js.map +1 -0
- package/dist/frontend/ts7/rpc-client.d.ts +27 -0
- package/dist/frontend/ts7/rpc-client.js +102 -0
- package/dist/frontend/ts7/rpc-client.js.map +1 -0
- package/dist/frontend/ts7/rpc-client.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-client.test.js +133 -0
- package/dist/frontend/ts7/rpc-client.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-filesystem.d.ts +16 -0
- package/dist/frontend/ts7/rpc-filesystem.js +42 -0
- package/dist/frontend/ts7/rpc-filesystem.js.map +1 -0
- package/dist/frontend/ts7/rpc-filesystem.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-filesystem.test.js +89 -0
- package/dist/frontend/ts7/rpc-filesystem.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-process.d.ts +2 -0
- package/dist/frontend/ts7/rpc-process.js +148 -0
- package/dist/frontend/ts7/rpc-process.js.map +1 -0
- package/dist/frontend/ts7/rpc-process.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-process.test.js +29 -0
- package/dist/frontend/ts7/rpc-process.test.js.map +1 -0
- package/dist/frontend/ts7/rpc-wire.d.ts +46 -0
- package/dist/frontend/ts7/rpc-wire.js +195 -0
- package/dist/frontend/ts7/rpc-wire.js.map +1 -0
- package/dist/frontend/ts7/rpc-wire.test.d.ts +1 -0
- package/dist/frontend/ts7/rpc-wire.test.js +168 -0
- package/dist/frontend/ts7/rpc-wire.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-checker.d.ts +137 -0
- package/dist/frontend/ts7/semantic-checker.js +221 -0
- package/dist/frontend/ts7/semantic-checker.js.map +1 -0
- package/dist/frontend/ts7/semantic-checker.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-checker.test.js +119 -0
- package/dist/frontend/ts7/semantic-checker.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-json.d.ts +5 -0
- package/dist/frontend/ts7/semantic-json.js +52 -0
- package/dist/frontend/ts7/semantic-json.js.map +1 -0
- package/dist/frontend/ts7/semantic-json.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-json.test.js +42 -0
- package/dist/frontend/ts7/semantic-json.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-model.d.ts +222 -0
- package/dist/frontend/ts7/semantic-model.js +423 -0
- package/dist/frontend/ts7/semantic-model.js.map +1 -0
- package/dist/frontend/ts7/semantic-model.test.d.ts +1 -0
- package/dist/frontend/ts7/semantic-model.test.js +322 -0
- package/dist/frontend/ts7/semantic-model.test.js.map +1 -0
- package/dist/frontend/ts7/semantic-schema.generated.d.ts +283 -0
- package/dist/frontend/ts7/semantic-schema.generated.js +222 -0
- package/dist/frontend/ts7/semantic-schema.generated.js.map +1 -0
- package/dist/frontend/ts7/semantic-types.d.ts +5 -0
- package/dist/frontend/ts7/semantic-types.js +2 -0
- package/dist/frontend/ts7/semantic-types.js.map +1 -0
- package/dist/frontend/ts7/session-cache.d.ts +17 -0
- package/dist/frontend/ts7/session-cache.js +97 -0
- package/dist/frontend/ts7/session-cache.js.map +1 -0
- package/dist/frontend/ts7/session-cache.test.d.ts +1 -0
- package/dist/frontend/ts7/session-cache.test.js +87 -0
- package/dist/frontend/ts7/session-cache.test.js.map +1 -0
- package/dist/frontend/ts7/session-path.d.ts +18 -0
- package/dist/frontend/ts7/session-path.js +203 -0
- package/dist/frontend/ts7/session-path.js.map +1 -0
- package/dist/frontend/ts7/session-path.test.d.ts +1 -0
- package/dist/frontend/ts7/session-path.test.js +34 -0
- package/dist/frontend/ts7/session-path.test.js.map +1 -0
- package/dist/frontend/ts7/session-schema.generated.d.ts +167 -0
- package/dist/frontend/ts7/session-schema.generated.js +5 -0
- package/dist/frontend/ts7/session-schema.generated.js.map +1 -0
- package/dist/frontend/ts7/session-timing.d.ts +50 -0
- package/dist/frontend/ts7/session-timing.js +61 -0
- package/dist/frontend/ts7/session-timing.js.map +1 -0
- package/dist/frontend/ts7/session-timing.test.d.ts +1 -0
- package/dist/frontend/ts7/session-timing.test.js +52 -0
- package/dist/frontend/ts7/session-timing.test.js.map +1 -0
- package/dist/frontend/ts7/session.d.ts +105 -0
- package/dist/frontend/ts7/session.js +233 -0
- package/dist/frontend/ts7/session.js.map +1 -0
- package/dist/frontend/ts7/session.test.d.ts +1 -0
- package/dist/frontend/ts7/session.test.js +215 -0
- package/dist/frontend/ts7/session.test.js.map +1 -0
- package/dist/frontend/ts7/source-parser-node.d.ts +6 -0
- package/dist/frontend/ts7/source-parser-node.js +15 -0
- package/dist/frontend/ts7/source-parser-node.js.map +1 -0
- package/dist/frontend/ts7/source-parser.d.ts +25 -0
- package/dist/frontend/ts7/source-parser.js +96 -0
- package/dist/frontend/ts7/source-parser.js.map +1 -0
- package/dist/frontend/ts7/source-parser.test.d.ts +1 -0
- package/dist/frontend/ts7/source-parser.test.js +151 -0
- package/dist/frontend/ts7/source-parser.test.js.map +1 -0
- package/dist/frontend/ts7/syntax.d.ts +3 -0
- package/dist/frontend/ts7/syntax.js +4 -0
- package/dist/frontend/ts7/syntax.js.map +1 -0
- package/dist/frontend/tsc-codes.js +3 -0
- package/dist/frontend/tsc-codes.js.map +1 -1
- package/dist/frontend/type-mapper.d.ts +25 -17
- package/dist/frontend/type-mapper.js +465 -121
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +123 -2
- package/dist/frontend/type-mapper.test.js.map +1 -1
- package/dist/frontend/union-discriminants.d.ts +16 -0
- package/dist/frontend/union-discriminants.js +98 -0
- package/dist/frontend/union-discriminants.js.map +1 -0
- package/dist/frontend/union-discriminants.test.d.ts +1 -0
- package/dist/frontend/union-discriminants.test.js +182 -0
- package/dist/frontend/union-discriminants.test.js.map +1 -0
- package/dist/index.d.ts +7 -198
- package/dist/index.js +369 -1572
- package/dist/index.js.map +1 -1
- package/dist/ir/analysis.d.ts +16 -4
- package/dist/ir/analysis.js +21 -4
- package/dist/ir/analysis.js.map +1 -1
- package/dist/ir/analysis.test.js +15 -2
- package/dist/ir/analysis.test.js.map +1 -1
- package/dist/ir/constant-tables.js +67 -49
- package/dist/ir/constant-tables.js.map +1 -1
- package/dist/ir/constant-tables.test.js +1 -1
- package/dist/ir/control-flow.d.ts +6 -0
- package/dist/ir/control-flow.js +142 -0
- package/dist/ir/control-flow.js.map +1 -0
- package/dist/ir/control-flow.test.d.ts +1 -0
- package/dist/ir/control-flow.test.js +113 -0
- package/dist/ir/control-flow.test.js.map +1 -0
- package/dist/ir/integer-loops.js +7 -18
- package/dist/ir/integer-loops.js.map +1 -1
- package/dist/ir/integer-ranges.js +53 -27
- package/dist/ir/integer-ranges.js.map +1 -1
- package/dist/ir/ir.d.ts +291 -152
- package/dist/ir/ir.js +588 -881
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +127 -1
- package/dist/ir/ir.test.js.map +1 -1
- package/dist/ir/scalar-records.js +165 -134
- package/dist/ir/scalar-records.js.map +1 -1
- package/dist/ir/scalar-records.test.js +1 -1
- package/dist/ir/serialize.d.ts +4 -2
- package/dist/ir/serialize.js +19 -12
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.d.ts +1 -0
- package/dist/ir/serialize.test.js +53 -0
- package/dist/ir/serialize.test.js.map +1 -0
- package/dist/ir/traverse.d.ts +41 -0
- package/dist/ir/traverse.js +660 -0
- package/dist/ir/traverse.js.map +1 -0
- package/dist/ir/traverse.test.d.ts +1 -0
- package/dist/ir/traverse.test.js +242 -0
- package/dist/ir/traverse.test.js.map +1 -0
- package/dist/ir/validate.js +1942 -1491
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +476 -2
- package/dist/ir/validate.test.js.map +1 -1
- package/dist/library/cache-primitives.d.ts +2 -3
- package/dist/library/cache-primitives.js +4 -6
- package/dist/library/cache-primitives.js.map +1 -1
- package/dist/library/fence-eval.js +2 -2
- package/dist/library/fence-eval.js.map +1 -1
- package/dist/library/int-infer.js +7 -6
- package/dist/library/int-infer.js.map +1 -1
- package/dist/library/int-infer.test.js +4 -4
- package/dist/library/library-cache.d.ts +3 -2
- package/dist/library/library-cache.js +5 -17
- package/dist/library/library-cache.js.map +1 -1
- package/dist/library/library-cache.test.js +54 -41
- package/dist/library/library-cache.test.js.map +1 -1
- package/dist/library/library-profile.d.ts +3 -1
- package/dist/library/library-profile.js +15 -6
- package/dist/library/library-profile.js.map +1 -1
- package/dist/library/prepare.d.ts +15 -0
- package/dist/library/prepare.js +584 -0
- package/dist/library/prepare.js.map +1 -0
- package/dist/library/semantic-source.d.ts +1 -1
- package/dist/library/semantic-source.js +8 -6
- package/dist/library/semantic-source.js.map +1 -1
- package/dist/library/sidecar-validate.js +4 -4
- package/dist/library/sidecar-validate.js.map +1 -1
- package/dist/library/sidecar.d.ts +2 -0
- package/dist/library/sidecar.js +10 -3
- package/dist/library/sidecar.js.map +1 -1
- package/dist/native/cache.d.ts +11 -0
- package/dist/native/cache.js +113 -0
- package/dist/native/cache.js.map +1 -0
- package/dist/native/cache.test.d.ts +1 -0
- package/dist/native/cache.test.js +66 -0
- package/dist/native/cache.test.js.map +1 -0
- package/dist/native/cli.d.ts +1 -0
- package/dist/native/cli.js +112 -0
- package/dist/native/cli.js.map +1 -0
- package/dist/native/compiler.d.ts +15 -0
- package/dist/native/compiler.js +336 -0
- package/dist/native/compiler.js.map +1 -0
- package/dist/native/compiler.test.d.ts +1 -0
- package/dist/native/compiler.test.js +174 -0
- package/dist/native/compiler.test.js.map +1 -0
- package/dist/native/comptime.d.ts +5 -0
- package/dist/native/comptime.js +73 -0
- package/dist/native/comptime.js.map +1 -0
- package/dist/native/comptime.test.d.ts +1 -0
- package/dist/native/comptime.test.js +65 -0
- package/dist/native/comptime.test.js.map +1 -0
- package/dist/native/executable-cache.d.ts +26 -0
- package/dist/native/executable-cache.js +228 -0
- package/dist/native/executable-cache.js.map +1 -0
- package/dist/native/executable-cache.test.d.ts +1 -0
- package/dist/native/executable-cache.test.js +151 -0
- package/dist/native/executable-cache.test.js.map +1 -0
- package/dist/native/file-identity.d.ts +4 -0
- package/dist/native/file-identity.js +14 -0
- package/dist/native/file-identity.js.map +1 -0
- package/dist/native/file-identity.test.d.ts +1 -0
- package/dist/native/file-identity.test.js +43 -0
- package/dist/native/file-identity.test.js.map +1 -0
- package/dist/native/library.d.ts +22 -0
- package/dist/native/library.js +83 -0
- package/dist/native/library.js.map +1 -0
- package/dist/native/prepare.d.ts +21 -0
- package/dist/native/prepare.js +174 -0
- package/dist/native/prepare.js.map +1 -0
- package/dist/native/prepare.test.d.ts +1 -0
- package/dist/native/prepare.test.js +70 -0
- package/dist/native/prepare.test.js.map +1 -0
- package/dist/native/sanitizer.d.ts +11 -0
- package/dist/native/sanitizer.js +135 -0
- package/dist/native/sanitizer.js.map +1 -0
- package/dist/native/sanitizer.test.d.ts +1 -0
- package/dist/native/sanitizer.test.js +58 -0
- package/dist/native/sanitizer.test.js.map +1 -0
- package/dist/native/task.d.ts +4 -0
- package/dist/native/task.js +16 -0
- package/dist/native/task.js.map +1 -0
- package/dist/native/task.test.d.ts +1 -0
- package/dist/native/task.test.js +17 -0
- package/dist/native/task.test.js.map +1 -0
- package/dist/native/toolchain.d.ts +45 -0
- package/dist/native/toolchain.js +74 -0
- package/dist/native/toolchain.js.map +1 -0
- package/dist/native/toolchain.test.d.ts +1 -0
- package/dist/native/toolchain.test.js +33 -0
- package/dist/native/toolchain.test.js.map +1 -0
- package/dist/startup-cache.d.ts +1 -1
- package/dist/startup-cache.js +2 -5
- package/dist/startup-cache.js.map +1 -1
- package/dist/timing.d.ts +4 -0
- package/dist/timing.js +19 -0
- package/dist/timing.js.map +1 -0
- package/dist/wasi-paths.js +10 -7
- package/dist/wasi-paths.js.map +1 -1
- package/package.json +28 -19
- package/surface-manifest.json +52 -18
- package/dist/backend/c/async.d.ts +0 -171
- package/dist/backend/c/async.js +0 -1317
- package/dist/backend/c/async.js.map +0 -1
- package/dist/backend/c/c-emitter.d.ts +0 -536
- package/dist/backend/c/c-emitter.js +0 -1932
- package/dist/backend/c/c-emitter.js.map +0 -1
- package/dist/backend/c/exprs.d.ts +0 -15
- package/dist/backend/c/exprs.js +0 -8847
- package/dist/backend/c/exprs.js.map +0 -1
- package/dist/backend/c/island.d.ts +0 -45
- package/dist/backend/c/island.js +0 -281
- package/dist/backend/c/island.js.map +0 -1
- package/dist/backend/c/may-throw.js.map +0 -1
- package/dist/backend/c/shapes.d.ts +0 -142
- package/dist/backend/c/shapes.js +0 -603
- package/dist/backend/c/shapes.js.map +0 -1
- package/dist/backend/c/stmts.d.ts +0 -76
- package/dist/backend/c/stmts.js +0 -1108
- package/dist/backend/c/stmts.js.map +0 -1
- package/dist/backend/c/types.d.ts +0 -71
- package/dist/backend/c/types.js +0 -459
- package/dist/backend/c/types.js.map +0 -1
- package/dist/backend/c/types.test.js +0 -32
- package/dist/backend/c/types.test.js.map +0 -1
- package/dist/backend/c/walkers.d.ts +0 -134
- package/dist/backend/c/walkers.js +0 -1772
- package/dist/backend/c/walkers.js.map +0 -1
- /package/dist/backend/{c/types.test.d.ts → cycle-analysis.test.d.ts} +0 -0
package/dist/frontend/program.js
CHANGED
|
@@ -46,15 +46,17 @@ import { isNodeModulesPath, nearestInvalidPackageJsonPath, nearestPackageType, n
|
|
|
46
46
|
import { probeNodeImportRefusal, probeNodeRequireRefusal } from "./npm.js";
|
|
47
47
|
import { isNpmStaticPackage, npmStaticActive, npmStaticFsShadow, npmStaticPackageOfPath, reportNpmStaticOffender, setNpmStaticDeclarationOverloads, setNpmStaticPackages } from "./npm-static.js";
|
|
48
48
|
import { isPrunedNpmReexport, planNpmStaticReexports } from "./npm-static-prune.js";
|
|
49
|
-
import {
|
|
49
|
+
import { isNpmStaticSubclassArgument } from "./npm-static-subtyping.js";
|
|
50
|
+
import { npmStaticDeclarationReexports, npmStaticRuntimeClassTargets, parseNpmStaticDeclarationOverloads, parseNpmStaticDeclarationProperties } from "./npm-static-declaration-syntax.js";
|
|
50
51
|
import { provenanceEntryFor, provenancePaths } from "./provenance-registry.js";
|
|
51
|
-
import {
|
|
52
|
+
import { cjsLexedExportsOfFile, cjsVisibleNames } from "./cjs-syntax.js";
|
|
52
53
|
import { ambientDtsPath, fallbackDtsPath, isNodeTypesPath, overridesDtsPath, tsgoPath, } from "./dts-paths.js";
|
|
53
54
|
import { builtinDefaultImportModule, canonicalBuiltinModule, SUPPORTED_NODE_MODULES, unsupportedModuleFeatureOf, } from "./builtin-modules.js";
|
|
54
55
|
import { clearWorkspacePackages, isRelativeSpecifier, isWorkspacePackageName, npmPackageNameOf, registerWorkspacePackage, workspacePackageOfPath, } from "./workspace-registry.js";
|
|
55
56
|
import { ADOPTED_OPTIONS, isJsSourceFileName, JS_ANY_OPERATOR_CODES, JS_RELAXED_TSC_CODES, } from "./tsc-codes.js";
|
|
56
57
|
import { trackedFileExists, trackedReadFile, trackedRealpath } from "./input-tracker.js";
|
|
57
58
|
import { forkTargetPaths } from "./fork-target.js";
|
|
59
|
+
import { inferredJsDiagnosticSuppressed } from "./inferred-js-diagnostics.js";
|
|
58
60
|
const BASE_OPTIONS = {
|
|
59
61
|
strict: true,
|
|
60
62
|
};
|
|
@@ -242,7 +244,7 @@ function runtimeReexportTarget(fromFile, specifier) {
|
|
|
242
244
|
/** Visits an opted package's own declaration entry and relative barrel
|
|
243
245
|
* closure. This is intentionally narrower than TypeScript module
|
|
244
246
|
* resolution: bare edges name other packages and never inherit trust. */
|
|
245
|
-
function visitNpmStaticDeclarationClosure(entryPath, onSource) {
|
|
247
|
+
function visitNpmStaticDeclarationClosure(services, entryPath, onSource) {
|
|
246
248
|
const seen = new Set();
|
|
247
249
|
const packageJson = nearestPkgJsonPath(entryPath);
|
|
248
250
|
const packageRoot = (packageJson === null ? dirname(entryPath) : dirname(packageJson)).split("\\").join("/");
|
|
@@ -258,7 +260,7 @@ function visitNpmStaticDeclarationClosure(entryPath, onSource) {
|
|
|
258
260
|
if (source === null)
|
|
259
261
|
return;
|
|
260
262
|
onSource(path, source);
|
|
261
|
-
for (const specifier of npmStaticDeclarationReexports(path, source)) {
|
|
263
|
+
for (const specifier of npmStaticDeclarationReexports(services.parse(path, source, "ts"))) {
|
|
262
264
|
const target = declarationReexportTarget(path, specifier);
|
|
263
265
|
if (target !== null)
|
|
264
266
|
visit(target);
|
|
@@ -266,10 +268,10 @@ function visitNpmStaticDeclarationClosure(entryPath, onSource) {
|
|
|
266
268
|
};
|
|
267
269
|
visit(entryPath);
|
|
268
270
|
}
|
|
269
|
-
function npmStaticDeclarationOverloadsOf(entryPath) {
|
|
271
|
+
function npmStaticDeclarationOverloadsOf(services, entryPath) {
|
|
270
272
|
const classes = new Map();
|
|
271
|
-
visitNpmStaticDeclarationClosure(entryPath, (path, source) => {
|
|
272
|
-
for (const [className, methods] of parseNpmStaticDeclarationOverloads(path, source)) {
|
|
273
|
+
visitNpmStaticDeclarationClosure(services, entryPath, (path, source) => {
|
|
274
|
+
for (const [className, methods] of parseNpmStaticDeclarationOverloads(services.parse(path, source, "ts"))) {
|
|
273
275
|
const target = classes.get(className) ?? new Map();
|
|
274
276
|
classes.set(className, target);
|
|
275
277
|
for (const [methodName, signatures] of methods) {
|
|
@@ -280,10 +282,10 @@ function npmStaticDeclarationOverloadsOf(entryPath) {
|
|
|
280
282
|
});
|
|
281
283
|
return classes;
|
|
282
284
|
}
|
|
283
|
-
function npmStaticDeclarationPropertiesOf(entryPath) {
|
|
285
|
+
function npmStaticDeclarationPropertiesOf(services, entryPath) {
|
|
284
286
|
const classes = new Map();
|
|
285
|
-
visitNpmStaticDeclarationClosure(entryPath, (path, source) => {
|
|
286
|
-
for (const [className, properties] of parseNpmStaticDeclarationProperties(path, source)) {
|
|
287
|
+
visitNpmStaticDeclarationClosure(services, entryPath, (path, source) => {
|
|
288
|
+
for (const [className, properties] of parseNpmStaticDeclarationProperties(services.parse(path, source, "ts"))) {
|
|
287
289
|
const target = classes.get(className) ?? new Map();
|
|
288
290
|
classes.set(className, target);
|
|
289
291
|
for (const [propertyName, type] of properties) {
|
|
@@ -391,7 +393,7 @@ function createRequireProgramRoots7(program) {
|
|
|
391
393
|
return "skip";
|
|
392
394
|
let target = resolveProjectModule(sf.fileName, spec);
|
|
393
395
|
if (target === null && !spec.startsWith("#")) {
|
|
394
|
-
const npm = resolveNpmImport7(sf.fileName, spec);
|
|
396
|
+
const npm = resolveNpmImport7(sf.fileName, spec, "require");
|
|
395
397
|
if (npm !== null && isNpmStaticPackage(npm.packageName) && isJsSourceFileName(npm.typesFile)) {
|
|
396
398
|
target = npm.typesFile;
|
|
397
399
|
}
|
|
@@ -482,52 +484,54 @@ function loadProgram7(host, entryPath, externalTypes = new Map()) {
|
|
|
482
484
|
}
|
|
483
485
|
const coreRoots = [entryPath, ambientDtsPath(), nodeTypes ?? fallbackDtsPath()];
|
|
484
486
|
const programRoots = [...coreRoots];
|
|
485
|
-
let program =
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
programRoots.push(...extraRoots);
|
|
497
|
-
program = ts.createProgram([...programRoots, overridesDtsPath()], options, host);
|
|
498
|
-
if (pass === 31)
|
|
499
|
-
throw new Error("static program-root discovery did not converge");
|
|
500
|
-
}
|
|
501
|
-
const entry = program.getSourceFile(entryPath);
|
|
502
|
-
if (!entry)
|
|
503
|
-
throw new Error(`could not load ${entryPath}`);
|
|
504
|
-
const externalTypeSpecifiersByFile = externalTypeFileClosure7(program, externalTypes);
|
|
505
|
-
let projectWorld = null;
|
|
506
|
-
return {
|
|
507
|
-
program,
|
|
508
|
-
entry,
|
|
509
|
-
moduleOrder: [],
|
|
510
|
-
configDiags: config.diags,
|
|
511
|
-
externalTypes,
|
|
512
|
-
externalTypeSpecifiersByFile,
|
|
513
|
-
projectWorld: () => (projectWorld ??= ts.createProgram(programRoots, options, host)),
|
|
514
|
-
disposeAll: () => {
|
|
515
|
-
projectWorld?.dispose();
|
|
487
|
+
let program = host.createProgram([...programRoots, overridesDtsPath()], options);
|
|
488
|
+
try {
|
|
489
|
+
for (let pass = 0; pass < 32; pass++) {
|
|
490
|
+
const candidates = [
|
|
491
|
+
...entryPackageProgramRoots7(program, entryPath),
|
|
492
|
+
...createRequireProgramRoots7(program),
|
|
493
|
+
...forkTargetPaths(program, program.getSourceFiles()),
|
|
494
|
+
];
|
|
495
|
+
const extraRoots = candidates.filter((root, index) => !programRoots.includes(root) && candidates.indexOf(root) === index);
|
|
496
|
+
if (extraRoots.length === 0)
|
|
497
|
+
break;
|
|
516
498
|
program.dispose();
|
|
517
|
-
|
|
518
|
-
|
|
499
|
+
programRoots.push(...extraRoots);
|
|
500
|
+
program = host.createProgram([...programRoots, overridesDtsPath()], options);
|
|
501
|
+
if (pass === 31)
|
|
502
|
+
throw new Error("static program-root discovery did not converge");
|
|
503
|
+
}
|
|
504
|
+
const entry = program.getSourceFile(entryPath);
|
|
505
|
+
if (!entry)
|
|
506
|
+
throw new Error(`could not load ${entryPath}`);
|
|
507
|
+
const externalTypeSpecifiersByFile = externalTypeFileClosure7(program, externalTypes);
|
|
508
|
+
let projectWorld = null;
|
|
509
|
+
return {
|
|
510
|
+
program,
|
|
511
|
+
entry,
|
|
512
|
+
moduleOrder: [],
|
|
513
|
+
configDiags: config.diags,
|
|
514
|
+
externalTypes,
|
|
515
|
+
externalTypeSpecifiersByFile,
|
|
516
|
+
projectWorld: () => (projectWorld ??= host.createProgram(programRoots, options)),
|
|
517
|
+
disposeAll: () => {
|
|
518
|
+
try {
|
|
519
|
+
projectWorld?.dispose();
|
|
520
|
+
}
|
|
521
|
+
finally {
|
|
522
|
+
program.dispose();
|
|
523
|
+
}
|
|
524
|
+
},
|
|
525
|
+
};
|
|
526
|
+
}
|
|
527
|
+
catch (error) {
|
|
528
|
+
program.dispose();
|
|
529
|
+
throw error;
|
|
530
|
+
}
|
|
519
531
|
}
|
|
520
|
-
|
|
521
|
-
* lowering. The caller runs checkPreflight, hands program/entry/
|
|
522
|
-
* moduleOrder straight to lowerToIr, and MUST dispose() when done — the
|
|
523
|
-
* spawned tsgo server must not outlive the compile. */
|
|
524
|
-
export function loadProgram(entryPath, opts) {
|
|
525
|
-
// Absolute from the start: tsgo's world is absolute-path-keyed (the CLI
|
|
526
|
-
// resolves before calling; this covers direct API callers too).
|
|
532
|
+
export function loadProgram(entryPath, services, opts) {
|
|
527
533
|
entryPath = resolve(entryPath);
|
|
528
|
-
const externalTypeEntries = opts?.externalTypes
|
|
529
|
-
? [...opts.externalTypes]
|
|
530
|
-
: Object.entries(opts?.externalTypes ?? {});
|
|
534
|
+
const externalTypeEntries = opts?.externalTypes ?? [];
|
|
531
535
|
const externalTypes = new Map();
|
|
532
536
|
for (const [specifier, file] of externalTypeEntries) {
|
|
533
537
|
if (!isExactExternalTypeSpecifier(specifier)) {
|
|
@@ -549,6 +553,7 @@ export function loadProgram(entryPath, opts) {
|
|
|
549
553
|
// or executable module edges.
|
|
550
554
|
const declarationOverloads = new Map();
|
|
551
555
|
const declarationProperties = new Map();
|
|
556
|
+
const projectionOwners = new Map();
|
|
552
557
|
for (const pkg of npmStaticPackages) {
|
|
553
558
|
const resolved = resolveBareModule(entryPath, pkg, "types-only");
|
|
554
559
|
if (resolved === null ||
|
|
@@ -556,8 +561,8 @@ export function loadProgram(entryPath, opts) {
|
|
|
556
561
|
!/\.d\.(?:ts|mts|cts)$/.test(resolved.typesFile)) {
|
|
557
562
|
continue;
|
|
558
563
|
}
|
|
559
|
-
const overloads = npmStaticDeclarationOverloadsOf(resolved.typesFile);
|
|
560
|
-
const properties = npmStaticDeclarationPropertiesOf(resolved.typesFile);
|
|
564
|
+
const overloads = npmStaticDeclarationOverloadsOf(services, resolved.typesFile);
|
|
565
|
+
const properties = npmStaticDeclarationPropertiesOf(services, resolved.typesFile);
|
|
561
566
|
const classNames = new Set([...overloads.keys(), ...properties.keys()]);
|
|
562
567
|
if (classNames.size === 0)
|
|
563
568
|
continue;
|
|
@@ -567,8 +572,8 @@ export function loadProgram(entryPath, opts) {
|
|
|
567
572
|
const runtimeSource = trackedReadFile(runtime.typesFile);
|
|
568
573
|
if (runtimeSource === null)
|
|
569
574
|
continue;
|
|
570
|
-
const targets = npmStaticRuntimeClassTargets(runtime.typesFile, runtimeSource, classNames);
|
|
571
|
-
for (const [className, specifier] of targets) {
|
|
575
|
+
const targets = npmStaticRuntimeClassTargets(services.parse(runtime.typesFile, runtimeSource, "js"), runtimeSource, classNames);
|
|
576
|
+
for (const [className, { specifier, localName }] of targets) {
|
|
572
577
|
const methods = overloads.get(className);
|
|
573
578
|
const fields = properties.get(className);
|
|
574
579
|
if (methods === undefined && fields === undefined)
|
|
@@ -582,14 +587,39 @@ export function loadProgram(entryPath, opts) {
|
|
|
582
587
|
targetNorm.startsWith(runtime.workspaceDir.split("\\").join("/") + "/");
|
|
583
588
|
if (targetPackage !== pkg && !insideWorkspace)
|
|
584
589
|
continue;
|
|
590
|
+
const projectionKey = JSON.stringify([targetNorm, localName]);
|
|
591
|
+
const previousOwner = projectionOwners.get(projectionKey);
|
|
592
|
+
if (previousOwner !== undefined && previousOwner !== className) {
|
|
593
|
+
// Two public class declarations naming one runtime class are
|
|
594
|
+
// ambiguous. Keep inference instead of choosing one alias's ABI.
|
|
595
|
+
projectionOwners.set(projectionKey, null);
|
|
596
|
+
const priorMethods = new Map(declarationOverloads.get(targetNorm) ?? []);
|
|
597
|
+
priorMethods.delete(localName);
|
|
598
|
+
declarationOverloads.set(targetNorm, priorMethods);
|
|
599
|
+
const priorFields = new Map(declarationProperties.get(targetNorm) ?? []);
|
|
600
|
+
priorFields.delete(localName);
|
|
601
|
+
declarationProperties.set(targetNorm, priorFields);
|
|
602
|
+
continue;
|
|
603
|
+
}
|
|
604
|
+
projectionOwners.set(projectionKey, className);
|
|
605
|
+
// The safe declaration grammar can name only its own class. Bind
|
|
606
|
+
// that type to the actual runtime class after a named ESM alias.
|
|
607
|
+
const renameSelf = (type) => type.split(/([\s[\]<>()|,]+)/).map((name) => name === className ? localName : name).join("");
|
|
585
608
|
if (methods !== undefined) {
|
|
586
609
|
const byClass = new Map(declarationOverloads.get(targetNorm) ?? []);
|
|
587
|
-
byClass.set(
|
|
610
|
+
byClass.set(localName, new Map([...methods].map(([name, signatures]) => [name, signatures.map((signature) => ({
|
|
611
|
+
parameters: signature.parameters.map((parameter) => ({
|
|
612
|
+
name: parameter.name,
|
|
613
|
+
type: renameSelf(parameter.type),
|
|
614
|
+
optional: parameter.optional,
|
|
615
|
+
})),
|
|
616
|
+
returnType: renameSelf(signature.returnType),
|
|
617
|
+
}))])));
|
|
588
618
|
declarationOverloads.set(targetNorm, byClass);
|
|
589
619
|
}
|
|
590
620
|
if (fields !== undefined) {
|
|
591
621
|
const byClass = new Map(declarationProperties.get(targetNorm) ?? []);
|
|
592
|
-
byClass.set(
|
|
622
|
+
byClass.set(localName, new Map([...fields].map(([name, type]) => [name, renameSelf(type)])));
|
|
593
623
|
declarationProperties.set(targetNorm, byClass);
|
|
594
624
|
}
|
|
595
625
|
}
|
|
@@ -619,25 +649,37 @@ export function loadProgram(entryPath, opts) {
|
|
|
619
649
|
// outside node_modules — the classic typed-JS-library entry — must not exist for
|
|
620
650
|
// the checker, so its resolution lands on the JS Node actually loads;
|
|
621
651
|
// resolve.ts answers the same sibling for scriptc's own edges).
|
|
622
|
-
const npmShadow = npmStaticFsShadow();
|
|
652
|
+
const npmShadow = npmStaticFsShadow(services);
|
|
623
653
|
const fsShadow = {
|
|
624
654
|
readFile: (path) => npmShadow?.readFile(path),
|
|
625
655
|
hideFile: (path) => (npmShadow?.hideFile(path) ?? false) || projectDtsRuntimeSibling(path) !== null,
|
|
626
656
|
};
|
|
627
|
-
const host =
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
657
|
+
const host = services.createProgramHost({ cwd: dirname(entryPath), fsShadow });
|
|
658
|
+
try {
|
|
659
|
+
const load = loadProgram7(host, entryPath, externalTypes);
|
|
660
|
+
return {
|
|
661
|
+
...load,
|
|
662
|
+
services,
|
|
663
|
+
dispose: () => {
|
|
664
|
+
try {
|
|
665
|
+
load.disposeAll();
|
|
666
|
+
}
|
|
667
|
+
finally {
|
|
668
|
+
host.close();
|
|
669
|
+
}
|
|
670
|
+
},
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
catch (error) {
|
|
674
|
+
host.close();
|
|
675
|
+
throw error;
|
|
676
|
+
}
|
|
636
677
|
}
|
|
637
678
|
/** tsc diagnostics (syntax + types), the supported-import fence, and the
|
|
638
679
|
* module evaluation order: fills load.moduleOrder (the SourceFiles
|
|
639
680
|
* themselves — the lowering consumes them directly) and returns the
|
|
640
|
-
* preflight diagnostics.
|
|
681
|
+
* preflight diagnostics. Preserve the caller's complete load shape when
|
|
682
|
+
* mutating it, including its owned services and disposal callback. */
|
|
641
683
|
export function checkPreflight(load) {
|
|
642
684
|
const { diags, moduleOrder, startupCrash } = preflight7(load);
|
|
643
685
|
load.moduleOrder = moduleOrder;
|
|
@@ -837,7 +879,7 @@ function purePrefixStmt7(program, s) {
|
|
|
837
879
|
return true; // directive
|
|
838
880
|
if (isRequireStatement7(s))
|
|
839
881
|
return true;
|
|
840
|
-
if (isCjsJsFile7(s.getSourceFile())) {
|
|
882
|
+
if (isCjsJsFile7(s.getSourceFile(), program)) {
|
|
841
883
|
if (ts.isExpressionStatement(s) && isEsModuleStamp(s.expression)) {
|
|
842
884
|
const call = s.expression;
|
|
843
885
|
const object = call.expression.expression;
|
|
@@ -855,11 +897,10 @@ function purePrefixStmt7(program, s) {
|
|
|
855
897
|
}
|
|
856
898
|
return false;
|
|
857
899
|
}
|
|
858
|
-
/** Can code that runs BEFORE the
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
*
|
|
862
|
-
* early read would silently diverge. Conservative reachability: earlier
|
|
900
|
+
/** Can code that runs BEFORE the declaration at index `k` reach one of
|
|
901
|
+
* its bindings? Static require aliases and symbol field keys bypass
|
|
902
|
+
* storage reads, so an early use could erase a TDZ error or a var's
|
|
903
|
+
* initial undefined value. Conservative reachability: earlier
|
|
863
904
|
* statements' whole subtrees (arrows and function expressions included)
|
|
864
905
|
* read the binding directly, or reference a hoisted function/class whose
|
|
865
906
|
* body (transitively through other hoisted declarations) reads it — a
|
|
@@ -870,7 +911,7 @@ function purePrefixStmt7(program, s) {
|
|
|
870
911
|
* (The CheckerFacade memoizes symbol queries, and 7's client dedupes
|
|
871
912
|
* symbol identity by server handle, so the Map-keyed-by-Symbol discipline
|
|
872
913
|
* carries over from the 5.9.3 original unchanged.) */
|
|
873
|
-
function
|
|
914
|
+
export function bindingEarlyUse7(program, sf, k, decl, precedingDecls) {
|
|
874
915
|
const checker = program.getTypeChecker();
|
|
875
916
|
const bound = [];
|
|
876
917
|
if (ts.isIdentifier(decl.name))
|
|
@@ -906,7 +947,9 @@ function requireTdzRisk7(program, sf, k, decl, precedingDecls) {
|
|
|
906
947
|
// this scan must survive it so the nesting fence can answer later.
|
|
907
948
|
ts.walkPreorder(root, (n) => {
|
|
908
949
|
if (ts.isIdentifier(n)) {
|
|
909
|
-
const sym =
|
|
950
|
+
const sym = ts.isShorthandPropertyAssignment(n.parent)
|
|
951
|
+
? checker.getShorthandAssignmentValueSymbol(n.parent)
|
|
952
|
+
: checker.getSymbolAtLocation(n);
|
|
910
953
|
if (sym) {
|
|
911
954
|
const name = bindings.get(sym);
|
|
912
955
|
if (name !== undefined) {
|
|
@@ -982,7 +1025,7 @@ function isCreateRequireImport7(program, ident) {
|
|
|
982
1025
|
const decl = symbol ? checker.declarationsOf(symbol)[0] : undefined;
|
|
983
1026
|
if (decl === undefined || !ts.isImportSpecifier(decl))
|
|
984
1027
|
return false;
|
|
985
|
-
const importDecl = decl.parent
|
|
1028
|
+
const importDecl = decl.parent?.parent?.parent;
|
|
986
1029
|
if (ts.isImportDeclaration(importDecl) && ts.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
987
1030
|
const module = canonicalBuiltinModule(importDecl.moduleSpecifier.text);
|
|
988
1031
|
const member = decl.propertyName?.text ?? decl.name.text;
|
|
@@ -1002,11 +1045,10 @@ function isCreateRequireImport7(program, ident) {
|
|
|
1002
1045
|
}
|
|
1003
1046
|
return false;
|
|
1004
1047
|
}
|
|
1005
|
-
/** True only for
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
1008
|
-
|
|
1009
|
-
function isCreateRequireBinding7(program, callee) {
|
|
1048
|
+
/** True only for createRequire bindings the lowering can erase. Mutable
|
|
1049
|
+
* declaration syntax needs a whole-file proof: no writes or escapes, and
|
|
1050
|
+
* no code before initialization can reach the binding. */
|
|
1051
|
+
export function isCreateRequireBinding7(program, callee) {
|
|
1010
1052
|
const checker = program.getTypeChecker();
|
|
1011
1053
|
const symbol = checker.getSymbolAtLocation(callee);
|
|
1012
1054
|
const decl = symbol
|
|
@@ -1014,11 +1056,70 @@ function isCreateRequireBinding7(program, callee) {
|
|
|
1014
1056
|
: undefined;
|
|
1015
1057
|
if (decl === undefined ||
|
|
1016
1058
|
decl.initializer === undefined ||
|
|
1017
|
-
!ts.isVariableDeclarationList(decl.parent)
|
|
1018
|
-
(decl.parent.flags & ts.NodeFlags.Const) === 0) {
|
|
1059
|
+
!ts.isVariableDeclarationList(decl.parent)) {
|
|
1019
1060
|
return false;
|
|
1020
1061
|
}
|
|
1021
|
-
|
|
1062
|
+
return isCreateRequireBaseCall7(program, decl.initializer) && ((decl.parent.flags & ts.NodeFlags.Const) !== 0 ||
|
|
1063
|
+
stableCreateRequireBindingReason7(program, decl) === null);
|
|
1064
|
+
}
|
|
1065
|
+
/** Only literal calls and literal resolution queries can erase the loader
|
|
1066
|
+
* value. In particular, assignments, exported aliases, shorthand properties,
|
|
1067
|
+
* optional calls, and passing the loader to user code cannot pass this test. */
|
|
1068
|
+
function staticCreateRequireUse7(expr) {
|
|
1069
|
+
let use = expr;
|
|
1070
|
+
while (ts.isParenthesizedExpression(use.parent))
|
|
1071
|
+
use = use.parent;
|
|
1072
|
+
if (ts.isPropertyAccessExpression(use.parent) && use.parent.expression === use && use.parent.name.text === "resolve" && !use.parent.questionDotToken) {
|
|
1073
|
+
use = use.parent;
|
|
1074
|
+
if (ts.isPropertyAccessExpression(use.parent) && use.parent.expression === use && use.parent.name.text === "paths" && !use.parent.questionDotToken)
|
|
1075
|
+
use = use.parent;
|
|
1076
|
+
}
|
|
1077
|
+
const call = use.parent;
|
|
1078
|
+
return ts.isCallExpression(call) && call.expression === use && !call.questionDotToken &&
|
|
1079
|
+
call.arguments.length === 1 && ts.isStringLiteralLike(call.arguments[0]);
|
|
1080
|
+
}
|
|
1081
|
+
function stableCreateRequireBindingReason7(program, decl) {
|
|
1082
|
+
const cache = program.analysis.createRequireReasons;
|
|
1083
|
+
if (cache.has(decl))
|
|
1084
|
+
return cache.get(decl);
|
|
1085
|
+
const check = () => {
|
|
1086
|
+
const stmt = decl.parent?.parent;
|
|
1087
|
+
if (!ts.isIdentifier(decl.name) || !ts.isVariableStatement(stmt) || !ts.isSourceFile(stmt.parent)) {
|
|
1088
|
+
return "its mutable createRequire binding is outside the module's top level";
|
|
1089
|
+
}
|
|
1090
|
+
const checker = program.getTypeChecker();
|
|
1091
|
+
const symbol = checker.getSymbolAtLocation(decl.name);
|
|
1092
|
+
if (!symbol || checker.declarationsOf(symbol).length !== 1)
|
|
1093
|
+
return "its createRequire binding is redeclared";
|
|
1094
|
+
if ((ts.getCombinedModifierFlags(decl) & ts.ModifierFlags.Export) !== 0)
|
|
1095
|
+
return "its createRequire result escapes through an exported binding";
|
|
1096
|
+
const sf = decl.getSourceFile();
|
|
1097
|
+
const refs = identifierOccurrences7(sf, decl.name.text);
|
|
1098
|
+
checker.prefetchSymbolNodesExact(refs);
|
|
1099
|
+
for (const ref of refs) {
|
|
1100
|
+
if (ref === decl.name || inTypePosition7(ref))
|
|
1101
|
+
continue;
|
|
1102
|
+
let target = ts.isShorthandPropertyAssignment(ref.parent)
|
|
1103
|
+
? checker.getShorthandAssignmentValueSymbol(ref.parent)
|
|
1104
|
+
: checker.getSymbolAtLocation(ref);
|
|
1105
|
+
if (target && (target.flags & ts.SymbolFlags.Alias) !== 0)
|
|
1106
|
+
target = checker.getAliasedSymbol(target);
|
|
1107
|
+
if (target === symbol && !staticCreateRequireUse7(ref)) {
|
|
1108
|
+
return "its createRequire binding is reassigned, escapes, or uses a computed specifier";
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
const preceding = stmt.declarationList.declarations.slice(0, stmt.declarationList.declarations.indexOf(decl));
|
|
1112
|
+
if (bindingEarlyUse7(program, sf, sf.statements.indexOf(stmt), decl, preceding) !== null) {
|
|
1113
|
+
return "its createRequire binding can be used before initialization";
|
|
1114
|
+
}
|
|
1115
|
+
return null;
|
|
1116
|
+
};
|
|
1117
|
+
const reason = check();
|
|
1118
|
+
cache.set(decl, reason);
|
|
1119
|
+
return reason;
|
|
1120
|
+
}
|
|
1121
|
+
function isCreateRequireBaseCall7(program, expr) {
|
|
1122
|
+
const init = stripRequireCasts7(expr);
|
|
1022
1123
|
if (!ts.isCallExpression(init) ||
|
|
1023
1124
|
init.questionDotToken !== undefined ||
|
|
1024
1125
|
!ts.isIdentifier(init.expression) ||
|
|
@@ -1028,13 +1129,77 @@ function isCreateRequireBinding7(program, callee) {
|
|
|
1028
1129
|
}
|
|
1029
1130
|
const base = stripRequireCasts7(init.arguments[0]);
|
|
1030
1131
|
if (ts.isIdentifier(base) && base.text === "__filename")
|
|
1031
|
-
return
|
|
1132
|
+
return !sourceBinding7(program, base);
|
|
1032
1133
|
return (ts.isPropertyAccessExpression(base) &&
|
|
1033
1134
|
base.questionDotToken === undefined &&
|
|
1034
1135
|
ts.isMetaProperty(base.expression) &&
|
|
1035
1136
|
base.expression.keywordToken === ts.SyntaxKind.ImportKeyword &&
|
|
1036
1137
|
(base.name.text === "url" || base.name.text === "filename"));
|
|
1037
1138
|
}
|
|
1139
|
+
/** A node:module import alone does not require an engine. Retain npm
|
|
1140
|
+
* fallback for require indirection the lowering cannot erase, while
|
|
1141
|
+
* admitting literal calls through the same stable/inline shapes as program
|
|
1142
|
+
* code. Inspect symbols, not names: nested shadows are unrelated bindings. */
|
|
1143
|
+
function npmStaticModuleImportReason7(program, stmt) {
|
|
1144
|
+
const clause = stmt.importClause;
|
|
1145
|
+
if (!clause)
|
|
1146
|
+
return null;
|
|
1147
|
+
const bindings = clause.namedBindings;
|
|
1148
|
+
if (clause.name || (bindings && !ts.isNamedImports(bindings))) {
|
|
1149
|
+
return "its node:module namespace or default import has no static createRequire usage proof";
|
|
1150
|
+
}
|
|
1151
|
+
if (!bindings || !ts.isNamedImports(bindings))
|
|
1152
|
+
return null;
|
|
1153
|
+
const checker = program.getTypeChecker();
|
|
1154
|
+
const sf = stmt.getSourceFile();
|
|
1155
|
+
for (const specifier of bindings.elements) {
|
|
1156
|
+
if ((specifier.propertyName?.text ?? specifier.name.text) !== "createRequire")
|
|
1157
|
+
continue;
|
|
1158
|
+
const imported = checker.getSymbolAtLocation(specifier.name);
|
|
1159
|
+
if (!imported)
|
|
1160
|
+
return "its createRequire import could not be resolved";
|
|
1161
|
+
checker.prefetchSymbolNodesExact(identifierOccurrences7(sf, specifier.name.text));
|
|
1162
|
+
let reason = null;
|
|
1163
|
+
const checkUse = (expr) => {
|
|
1164
|
+
if (!staticCreateRequireUse7(expr)) {
|
|
1165
|
+
reason = "its createRequire result escapes or is used with a computed specifier (static requires need literal specifiers)";
|
|
1166
|
+
}
|
|
1167
|
+
};
|
|
1168
|
+
ts.walkPreorder(sf, (node) => {
|
|
1169
|
+
if (reason || !ts.isIdentifier(node) || node.text !== specifier.name.text || node === specifier.name || checker.getSymbolAtLocation(node) !== imported)
|
|
1170
|
+
return;
|
|
1171
|
+
const call = node.parent;
|
|
1172
|
+
if (!ts.isCallExpression(call) || call.expression !== node || !isCreateRequireBaseCall7(program, call)) {
|
|
1173
|
+
reason = "its createRequire import is used outside a supported call based on the current file";
|
|
1174
|
+
return;
|
|
1175
|
+
}
|
|
1176
|
+
const decl = call.parent;
|
|
1177
|
+
if (ts.isVariableDeclaration(decl) && decl.initializer === call && ts.isIdentifier(decl.name)) {
|
|
1178
|
+
if ((ts.getCombinedModifierFlags(decl) & ts.ModifierFlags.Export) !== 0) {
|
|
1179
|
+
reason = "its createRequire result escapes through an exported binding";
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
if (!isCreateRequireBinding7(program, decl.name)) {
|
|
1183
|
+
reason = stableCreateRequireBindingReason7(program, decl);
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
const sym = checker.getSymbolAtLocation(decl.name);
|
|
1187
|
+
const name = decl.name.text;
|
|
1188
|
+
checker.prefetchSymbolNodesExact(identifierOccurrences7(sf, name));
|
|
1189
|
+
ts.walkPreorder(sf, (ref) => {
|
|
1190
|
+
if (ts.isIdentifier(ref) && ref.text === name && ref !== decl.name && checker.getSymbolAtLocation(ref) === sym)
|
|
1191
|
+
checkUse(ref);
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
checkUse(call);
|
|
1196
|
+
}
|
|
1197
|
+
});
|
|
1198
|
+
if (reason)
|
|
1199
|
+
return reason;
|
|
1200
|
+
}
|
|
1201
|
+
return null;
|
|
1202
|
+
}
|
|
1038
1203
|
/** Classifies a require-shaped call as Node's ambient CommonJS global, the
|
|
1039
1204
|
* one supported createRequire source binding, or another source binding.
|
|
1040
1205
|
* The scanners still collect createRequire calls because they carry static
|
|
@@ -1119,9 +1284,11 @@ function nodeEsmSyntaxMarker7(sf) {
|
|
|
1119
1284
|
found = node;
|
|
1120
1285
|
return "stop";
|
|
1121
1286
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1287
|
+
// Only await syntax needs an ancestor walk. Doing this for every node
|
|
1288
|
+
// makes a deeply nested expression take quadratic time to classify.
|
|
1289
|
+
if ((ts.isAwaitExpression(node) ||
|
|
1290
|
+
(ts.isForOfStatement(node) && node.awaitModifier !== undefined)) &&
|
|
1291
|
+
!insideFunctionLike7(node)) {
|
|
1125
1292
|
found = node;
|
|
1126
1293
|
return "stop";
|
|
1127
1294
|
}
|
|
@@ -1129,14 +1296,13 @@ function nodeEsmSyntaxMarker7(sf) {
|
|
|
1129
1296
|
});
|
|
1130
1297
|
return found;
|
|
1131
1298
|
}
|
|
1132
|
-
const nodeEsmFileCache7 = new WeakMap();
|
|
1133
1299
|
/** True when Node would treat this file as an ES MODULE (never defining
|
|
1134
1300
|
* require/__dirname there): fixed extensions first, then an explicit
|
|
1135
1301
|
* nearest-package type, then Node's syntax markers for ambiguous .js/.ts
|
|
1136
1302
|
* files. TypeScript's external-module bit is forced for checker scoping and
|
|
1137
1303
|
* therefore intentionally plays no part in this runtime decision. */
|
|
1138
|
-
function isNodeEsmFile7(sf) {
|
|
1139
|
-
const cached =
|
|
1304
|
+
function isNodeEsmFile7(sf, program) {
|
|
1305
|
+
const cached = program?.analysis.nodeEsmFiles.get(sf);
|
|
1140
1306
|
if (cached !== undefined)
|
|
1141
1307
|
return cached;
|
|
1142
1308
|
let result;
|
|
@@ -1154,21 +1320,21 @@ function isNodeEsmFile7(sf) {
|
|
|
1154
1320
|
? false
|
|
1155
1321
|
: nodeEsmSyntaxMarker7(sf) !== null;
|
|
1156
1322
|
}
|
|
1157
|
-
|
|
1323
|
+
program?.analysis.nodeEsmFiles.set(sf, result);
|
|
1158
1324
|
return result;
|
|
1159
1325
|
}
|
|
1160
1326
|
/** A JavaScript source file Node treats as CommonJS (not an ES module):
|
|
1161
1327
|
* ESM namespace/default machinery must not claim it — its export surface
|
|
1162
1328
|
* is module.exports, read through the CJS interop paths and their own
|
|
1163
1329
|
* fences. */
|
|
1164
|
-
function isCjsJsFile7(sf) {
|
|
1165
|
-
return isJsSourceFileName(sf.fileName) && !isNodeEsmFile7(sf);
|
|
1330
|
+
function isCjsJsFile7(sf, program) {
|
|
1331
|
+
return isJsSourceFileName(sf.fileName) && !isNodeEsmFile7(sf, program);
|
|
1166
1332
|
}
|
|
1167
1333
|
/** The exported spelling of isCjsJsFile7 (the lowering's gate for
|
|
1168
1334
|
* module.exports surfaces — `ts.isExternalModule` is NOT the CJS test:
|
|
1169
1335
|
* tsgo marks CJS files with export assignments as external modules). */
|
|
1170
|
-
export function isCjsJsFile(sf) {
|
|
1171
|
-
return isCjsJsFile7(sf);
|
|
1336
|
+
export function isCjsJsFile(sf, program) {
|
|
1337
|
+
return isCjsJsFile7(sf, program);
|
|
1172
1338
|
}
|
|
1173
1339
|
/** The self-import TDZ fences: for `import { x } from "<self>"` (default
|
|
1174
1340
|
* and namespace forms included), any TOP-LEVEL reference lexically above
|
|
@@ -1578,7 +1744,7 @@ function identifierOccurrences7(root, text) {
|
|
|
1578
1744
|
* Re-export statements bind nothing locally — always null: the alias is
|
|
1579
1745
|
* link-time plumbing, never an evaluation-time read. Export specifiers
|
|
1580
1746
|
* of an imported binding are the same alias story, not reads. */
|
|
1581
|
-
function backEdgeUseOffence7(program,
|
|
1747
|
+
function backEdgeUseOffence7(program, stmt, occurrences) {
|
|
1582
1748
|
if (!ts.isImportDeclaration(stmt) || stmt.importClause === undefined)
|
|
1583
1749
|
return null;
|
|
1584
1750
|
const checker = program.getTypeChecker();
|
|
@@ -1598,25 +1764,16 @@ function backEdgeUseOffence7(program, sf, stmt) {
|
|
|
1598
1764
|
const sym = checker.getSymbolAtLocation(bindingName);
|
|
1599
1765
|
if (sym === undefined)
|
|
1600
1766
|
continue;
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
const
|
|
1604
|
-
if (
|
|
1605
|
-
return;
|
|
1606
|
-
if (ts.isIdentifier(node) &&
|
|
1607
|
-
node.text === bindingName.text &&
|
|
1608
|
-
!(node.parent !== undefined && ts.isExportSpecifier(node.parent)) &&
|
|
1767
|
+
const references = occurrences.get(bindingName.text) ?? [];
|
|
1768
|
+
checker.prefetchSymbolNodesExact(references);
|
|
1769
|
+
for (const node of references) {
|
|
1770
|
+
if (!(node.parent !== undefined && ts.isExportSpecifier(node.parent)) &&
|
|
1609
1771
|
checker.getSymbolAtLocation(node) === sym &&
|
|
1610
1772
|
!inTypePosition7(node) &&
|
|
1611
1773
|
!inDeferredPosition7(node)) {
|
|
1612
|
-
|
|
1613
|
-
return;
|
|
1774
|
+
return { name: bindingName.text, node };
|
|
1614
1775
|
}
|
|
1615
|
-
|
|
1616
|
-
};
|
|
1617
|
-
visit(sf);
|
|
1618
|
-
if (offence !== null)
|
|
1619
|
-
return offence;
|
|
1776
|
+
}
|
|
1620
1777
|
}
|
|
1621
1778
|
return null;
|
|
1622
1779
|
}
|
|
@@ -1687,6 +1844,30 @@ export function makeCycleAdmission(program, edgesOf) {
|
|
|
1687
1844
|
// reason the cluster's cycles stay fenced, or null when its every
|
|
1688
1845
|
// member passes the inert-top-level bar.
|
|
1689
1846
|
const sccVerdict = new Map();
|
|
1847
|
+
// A module can close many cycle edges, each importing many bindings.
|
|
1848
|
+
// Index its identifiers once for this admission pass. ASTs are immutable;
|
|
1849
|
+
// the pass owns the index so it cannot retain a disposed program.
|
|
1850
|
+
const bindingUses = new Map();
|
|
1851
|
+
const usesOf = (sf) => {
|
|
1852
|
+
const cached = bindingUses.get(sf);
|
|
1853
|
+
if (cached !== undefined)
|
|
1854
|
+
return cached;
|
|
1855
|
+
const uses = new Map();
|
|
1856
|
+
ts.walkPreorder(sf, (node) => {
|
|
1857
|
+
if (ts.isImportDeclaration(node))
|
|
1858
|
+
return "skip";
|
|
1859
|
+
if (ts.isIdentifier(node)) {
|
|
1860
|
+
const references = uses.get(node.text);
|
|
1861
|
+
if (references !== undefined)
|
|
1862
|
+
references.push(node);
|
|
1863
|
+
else
|
|
1864
|
+
uses.set(node.text, [node]);
|
|
1865
|
+
}
|
|
1866
|
+
return undefined;
|
|
1867
|
+
});
|
|
1868
|
+
bindingUses.set(sf, uses);
|
|
1869
|
+
return uses;
|
|
1870
|
+
};
|
|
1690
1871
|
return (importer, e) => {
|
|
1691
1872
|
if (e.stmt === undefined)
|
|
1692
1873
|
return "the cycle closes through a require() edge";
|
|
@@ -1710,7 +1891,7 @@ export function makeCycleAdmission(program, edgesOf) {
|
|
|
1710
1891
|
if (!sccVerdict.has(comp)) {
|
|
1711
1892
|
let reason = null;
|
|
1712
1893
|
for (const m of comp) {
|
|
1713
|
-
if (isCjsJsFile7(m)) {
|
|
1894
|
+
if (isCjsJsFile7(m, program)) {
|
|
1714
1895
|
reason = `${m.fileName} is a CommonJS module — admission covers ES-module cycles only`;
|
|
1715
1896
|
break;
|
|
1716
1897
|
}
|
|
@@ -1723,9 +1904,11 @@ export function makeCycleAdmission(program, edgesOf) {
|
|
|
1723
1904
|
sccVerdict.set(comp, reason);
|
|
1724
1905
|
}
|
|
1725
1906
|
const clusterReason = sccVerdict.get(comp);
|
|
1907
|
+
if (clusterReason === undefined)
|
|
1908
|
+
throw new Error("missing module-cycle verdict");
|
|
1726
1909
|
if (clusterReason !== null)
|
|
1727
1910
|
return clusterReason;
|
|
1728
|
-
const use = backEdgeUseOffence7(program,
|
|
1911
|
+
const use = backEdgeUseOffence7(program, e.stmt, usesOf(importer));
|
|
1729
1912
|
if (use !== null) {
|
|
1730
1913
|
return `the cycle-crossing binding '${use.name}' is read at ${lineOf(use.node)}, outside any function body — a read during the init window observes the partially-initialized module (Node's TDZ ReferenceError / stale var), which is not modeled`;
|
|
1731
1914
|
}
|
|
@@ -1747,7 +1930,7 @@ function resolveImport7(program, from, specifier) {
|
|
|
1747
1930
|
* island under --dynamic. Resolution rides the own resolver (resolve.ts).
|
|
1748
1931
|
* Null for relative and node: specifiers, and for anything that doesn't
|
|
1749
1932
|
* resolve into node_modules. */
|
|
1750
|
-
function resolveNpmImport7(fromFileName, specifier) {
|
|
1933
|
+
function resolveNpmImport7(fromFileName, specifier, resolutionKind = "import") {
|
|
1751
1934
|
if (isRelativeSpecifier(specifier) || specifier.startsWith("node:")) {
|
|
1752
1935
|
return null;
|
|
1753
1936
|
}
|
|
@@ -1756,7 +1939,7 @@ function resolveNpmImport7(fromFileName, specifier) {
|
|
|
1756
1939
|
// answers the entry), so no island embed and no .d.ts type surface.
|
|
1757
1940
|
if (provenanceEntryFor(specifier) !== null)
|
|
1758
1941
|
return null;
|
|
1759
|
-
const resolved = resolveBareModule(fromFileName, specifier);
|
|
1942
|
+
const resolved = resolveBareModule(fromFileName, specifier, undefined, resolutionKind);
|
|
1760
1943
|
if (!resolved)
|
|
1761
1944
|
return null;
|
|
1762
1945
|
if (!isNodeModulesPath(resolved.typesFile)) {
|
|
@@ -1831,24 +2014,16 @@ function processModuleAliasImport7(spec, stmt) {
|
|
|
1831
2014
|
return clause !== undefined && clause.name !== undefined && clause.namedBindings === undefined;
|
|
1832
2015
|
}
|
|
1833
2016
|
/** The whole TS7-lane lifecycle for one entry: spawn (or share) a tsgo
|
|
1834
|
-
* host, build the lowering-world program, run
|
|
1835
|
-
*
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
const host = sharedHost ?? new ts.Ts7Host({ cwd: dirname(entryPath) });
|
|
2017
|
+
* host, build the lowering-world program, run preflight, and release its
|
|
2018
|
+
* snapshot. The caller owns the supplied host and can reuse or close it. */
|
|
2019
|
+
export function checkPreflightTs7(entryPath, host) {
|
|
2020
|
+
const load = loadProgram7(host, resolve(entryPath));
|
|
1839
2021
|
try {
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
const { diags, moduleOrder } = preflight7(load);
|
|
1843
|
-
return { diags, moduleOrder: moduleOrder.map((sf) => sf.fileName) };
|
|
1844
|
-
}
|
|
1845
|
-
finally {
|
|
1846
|
-
load.disposeAll();
|
|
1847
|
-
}
|
|
2022
|
+
const { diags, moduleOrder } = preflight7(load);
|
|
2023
|
+
return { diags, moduleOrder: moduleOrder.map((sf) => sf.fileName) };
|
|
1848
2024
|
}
|
|
1849
2025
|
finally {
|
|
1850
|
-
|
|
1851
|
-
host.close();
|
|
2026
|
+
load.disposeAll();
|
|
1852
2027
|
}
|
|
1853
2028
|
}
|
|
1854
2029
|
function preflight7(load) {
|
|
@@ -2062,6 +2237,8 @@ function preflight7(load) {
|
|
|
2062
2237
|
!npmStaticFileSuppressed(d) &&
|
|
2063
2238
|
!nodeModulesJsSuppressed(d) &&
|
|
2064
2239
|
!namespaceCalleeSuppressed(p, d) &&
|
|
2240
|
+
!inferredJsDiagnosticSuppressed(p, d) &&
|
|
2241
|
+
!isNpmStaticSubclassArgument(p, d) &&
|
|
2065
2242
|
!workspaceImplicitAnySuppressed(p, d) &&
|
|
2066
2243
|
!jsdocTypeSuppressed(p, d, commentDup));
|
|
2067
2244
|
};
|
|
@@ -2097,7 +2274,7 @@ function preflight7(load) {
|
|
|
2097
2274
|
(!isNodeModulesPath(sf.fileName) || entryPackageFile(sf.fileName) || npmStaticPackageOfPath(sf.fileName) !== null) &&
|
|
2098
2275
|
!islandJsFile(sf.fileName));
|
|
2099
2276
|
const userFiles = npmStaticActive()
|
|
2100
|
-
? planNpmStaticReexports(program, entry, programFiles, [...createRequireProgramRoots7(program), ...forkTargetPaths(program, program.getSourceFiles())], (sf, spec) => resolveImport7(program, sf, spec) ?? npmStaticDepSf7(program, sf, spec))
|
|
2277
|
+
? planNpmStaticReexports(program, entry, programFiles, [...createRequireProgramRoots7(program), ...forkTargetPaths(program, program.getSourceFiles())], (sf, spec, resolutionKind) => resolveImport7(program, sf, spec) ?? npmStaticDepSf7(program, sf, spec, resolutionKind))
|
|
2101
2278
|
: programFiles;
|
|
2102
2279
|
program.getTypeChecker().prefetchSourceFileStructures(userFiles);
|
|
2103
2280
|
// node_modules JS that no --npm-static opt-in claims is NOT program
|
|
@@ -2121,7 +2298,7 @@ function preflight7(load) {
|
|
|
2121
2298
|
}
|
|
2122
2299
|
continue;
|
|
2123
2300
|
}
|
|
2124
|
-
if (!isNodeEsmFile7(sf)) {
|
|
2301
|
+
if (!isNodeEsmFile7(sf, program)) {
|
|
2125
2302
|
const marker = nodeEsmSyntaxMarker7(sf);
|
|
2126
2303
|
if (marker !== null)
|
|
2127
2304
|
diags.push(commonJsModuleSyntaxDiag(locOf7(marker)));
|
|
@@ -2259,7 +2436,7 @@ function preflight7(load) {
|
|
|
2259
2436
|
// RESOLVED user module lowers; everything else keeps the fence —
|
|
2260
2437
|
// there is no namespace object to materialize.
|
|
2261
2438
|
if (stmt.exportClause && ts.isNamespaceExport(stmt.exportClause)) {
|
|
2262
|
-
if (reDep === null || reDep.fileName.endsWith(".json") || isCjsJsFile7(reDep)) {
|
|
2439
|
+
if (reDep === null || reDep.fileName.endsWith(".json") || isCjsJsFile7(reDep, program)) {
|
|
2263
2440
|
diags.push(unsupportedDiag("SC1013", locOf7(stmt), "namespace re-exports (export * as ns) of this module form"));
|
|
2264
2441
|
continue;
|
|
2265
2442
|
}
|
|
@@ -2290,17 +2467,15 @@ function preflight7(load) {
|
|
|
2290
2467
|
}
|
|
2291
2468
|
const isRelative = isRelativeSpecifier(spec);
|
|
2292
2469
|
const isBare = !isRelative && !ambientModules.has(spec);
|
|
2293
|
-
//
|
|
2294
|
-
//
|
|
2295
|
-
//
|
|
2296
|
-
// only literal-specifier requires, and bundler banners (esbuild's
|
|
2297
|
-
// __createRequire(import.meta.url) prologue) feed the returned
|
|
2298
|
-
// require COMPUTED specifiers at module INIT, so a static compile
|
|
2299
|
-
// would fence at load where the island runs the package as shipped.
|
|
2470
|
+
// Npm packages can use the same static createRequire forms as program
|
|
2471
|
+
// code. Preserve fallback for bundler banners that pass the require
|
|
2472
|
+
// value around or feed it computed specifiers during initialization.
|
|
2300
2473
|
if (canonicalBuiltinModule(spec) === "module") {
|
|
2301
2474
|
const pkg = npmStaticPackageOfPath(sf.fileName);
|
|
2302
2475
|
if (pkg !== null) {
|
|
2303
|
-
|
|
2476
|
+
const reason = npmStaticModuleImportReason7(program, stmt);
|
|
2477
|
+
if (reason !== null)
|
|
2478
|
+
reportNpmStaticOffender(pkg, reason);
|
|
2304
2479
|
}
|
|
2305
2480
|
}
|
|
2306
2481
|
// An import edge Node's own resolution refuses BEFORE any module
|
|
@@ -2452,7 +2627,7 @@ function preflight7(load) {
|
|
|
2452
2627
|
if (isJson) {
|
|
2453
2628
|
diags.push(unsupportedDiag("SC1013", locOf7(clause.namedBindings), "namespace imports of JSON modules"));
|
|
2454
2629
|
}
|
|
2455
|
-
else if (dep !== null && isCjsJsFile7(dep)) {
|
|
2630
|
+
else if (dep !== null && isCjsJsFile7(dep, program)) {
|
|
2456
2631
|
// A CJS namespace binding whose every use is a bare expression
|
|
2457
2632
|
// statement (`cjs;` — the corpus's "the import linked"
|
|
2458
2633
|
// assertion) carries no surface question: the statement lowers
|
|
@@ -2494,7 +2669,7 @@ function preflight7(load) {
|
|
|
2494
2669
|
// files keep the full CommonJS scan.
|
|
2495
2670
|
if (!jsRequireFile && bindingKind !== "createRequire")
|
|
2496
2671
|
continue;
|
|
2497
|
-
if (isNodeEsmFile7(sf)) {
|
|
2672
|
+
if (isNodeEsmFile7(sf, program)) {
|
|
2498
2673
|
if (bindingKind !== "createRequire") {
|
|
2499
2674
|
diags.push(unsupportedDiag("SC1013", loc, esmRequireFeature7(bindingKind)));
|
|
2500
2675
|
continue;
|
|
@@ -2522,7 +2697,7 @@ function preflight7(load) {
|
|
|
2522
2697
|
// form above (bundle dists require their workspace siblings —
|
|
2523
2698
|
// the same resolution, the same offender discipline on a
|
|
2524
2699
|
// miss).
|
|
2525
|
-
const npmReq = !req.spec.startsWith("#") ? resolveNpmImport7(sf.fileName, req.spec) : null;
|
|
2700
|
+
const npmReq = !req.spec.startsWith("#") ? resolveNpmImport7(sf.fileName, req.spec, "require") : null;
|
|
2526
2701
|
if (npmReq !== null && isNpmStaticPackage(npmReq.packageName)) {
|
|
2527
2702
|
dep = npmStaticProgramDep(program, npmReq.packageName, npmReq.typesFile);
|
|
2528
2703
|
if (dep === null)
|
|
@@ -2566,7 +2741,7 @@ function preflight7(load) {
|
|
|
2566
2741
|
const prefixCanRun = (firstRunnable >= 0 && firstRunnable < k) ||
|
|
2567
2742
|
precedingDecls.some((decl) => !purePrefixDecl7(decl));
|
|
2568
2743
|
const tdzName = prefixCanRun && req.decl
|
|
2569
|
-
?
|
|
2744
|
+
? bindingEarlyUse7(program, sf, k, req.decl, precedingDecls)
|
|
2570
2745
|
: null;
|
|
2571
2746
|
if (tdzName !== null) {
|
|
2572
2747
|
diags.push(unsupportedDiag("SC1013", loc, `require() below code that can reach its binding '${tdzName}' (Node initializes the binding AT the require and throws ReferenceError on any earlier access, which is not modeled — move the require above the code that can run first)`));
|
|
@@ -2584,7 +2759,7 @@ function preflight7(load) {
|
|
|
2584
2759
|
const bindingKind = requireCallBindingKind7(program, call);
|
|
2585
2760
|
if (!jsRequireFile && bindingKind !== "createRequire")
|
|
2586
2761
|
continue;
|
|
2587
|
-
if (isNodeEsmFile7(sf)) {
|
|
2762
|
+
if (isNodeEsmFile7(sf, program)) {
|
|
2588
2763
|
if (bindingKind !== "createRequire") {
|
|
2589
2764
|
diags.push(unsupportedDiag("SC1013", loc, esmRequireFeature7(bindingKind)));
|
|
2590
2765
|
continue;
|
|
@@ -2607,7 +2782,7 @@ function preflight7(load) {
|
|
|
2607
2782
|
if (!isRelativeSpecifier(spec)) {
|
|
2608
2783
|
// --npm-static: opted-in packages ride the program-module edge
|
|
2609
2784
|
// (the statement-level require branch above).
|
|
2610
|
-
const npmReq = !spec.startsWith("#") ? resolveNpmImport7(sf.fileName, spec) : null;
|
|
2785
|
+
const npmReq = !spec.startsWith("#") ? resolveNpmImport7(sf.fileName, spec, "require") : null;
|
|
2611
2786
|
if (npmReq !== null && isNpmStaticPackage(npmReq.packageName)) {
|
|
2612
2787
|
const nDep = npmStaticProgramDep(program, npmReq.packageName, npmReq.typesFile);
|
|
2613
2788
|
if (nDep !== null)
|
|
@@ -2756,19 +2931,19 @@ function cjsNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
2756
2931
|
// Reexport targets union in only when they resolve to CommonJS program
|
|
2757
2932
|
// files (Node's cjsPreparseModuleExports rule).
|
|
2758
2933
|
const resolveCjsDep = (from, spec) => {
|
|
2759
|
-
const dep =
|
|
2760
|
-
return dep !== null && isCjsJsFile7(dep) ? dep : null;
|
|
2934
|
+
const dep = resolveImport7(program, from, spec) ?? npmStaticDepSf7(program, from, spec, "require");
|
|
2935
|
+
return dep !== null && isCjsJsFile7(dep, program) ? dep : null;
|
|
2761
2936
|
};
|
|
2762
2937
|
const visible = (dep, name) =>
|
|
2763
2938
|
// `default` is the module.exports binding itself — always provided.
|
|
2764
|
-
//
|
|
2765
|
-
//
|
|
2766
|
-
name === "default" ||
|
|
2939
|
+
// The program already owns native source ASTs; reuse them without
|
|
2940
|
+
// starting another syntax session or reparsing their source text.
|
|
2941
|
+
name === "default" || cjsVisibleNames(dep, cjsLexedExportsOfFile, resolveCjsDep, lexMemo).has(name);
|
|
2767
2942
|
/** The statement's resolved LOCAL CommonJS dependency, when it is an
|
|
2768
2943
|
* import/re-export from one. */
|
|
2769
2944
|
const cjsDepOf = (sf, spec) => {
|
|
2770
2945
|
const dep = resolveEdge(sf, spec);
|
|
2771
|
-
return dep !== null && isCjsJsFile7(dep) ? dep : null;
|
|
2946
|
+
return dep !== null && isCjsJsFile7(dep, program) ? dep : null;
|
|
2772
2947
|
};
|
|
2773
2948
|
/** The first lexer-invisible CJS name request of ONE module, in V8's
|
|
2774
2949
|
* check order: all regular named imports sorted by local binding name,
|
|
@@ -2841,7 +3016,7 @@ function cjsNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
2841
3016
|
continue;
|
|
2842
3017
|
const spec = specNode.text;
|
|
2843
3018
|
const dep = resolveEdge(sf, spec);
|
|
2844
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3019
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
2845
3020
|
continue;
|
|
2846
3021
|
const bad = dfs(dep);
|
|
2847
3022
|
if (bad !== null)
|
|
@@ -2849,12 +3024,12 @@ function cjsNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
2849
3024
|
}
|
|
2850
3025
|
return firstInvisibleOf(sf);
|
|
2851
3026
|
};
|
|
2852
|
-
const bad = isNodeEsmFile7(entry) ? dfs(entry) : null;
|
|
3027
|
+
const bad = isNodeEsmFile7(entry, program) ? dfs(entry) : null;
|
|
2853
3028
|
// ESM modules only require() reaches: same invisibility, but Node's
|
|
2854
3029
|
// SyntaxError fires mid-evaluation at the require — a pointed fence
|
|
2855
3030
|
// instead of a mismodeled crash position.
|
|
2856
3031
|
for (const sf of moduleOrder) {
|
|
2857
|
-
if (!isNodeEsmFile7(sf) || visited.has(sf))
|
|
3032
|
+
if (!isNodeEsmFile7(sf, program) || visited.has(sf))
|
|
2858
3033
|
continue;
|
|
2859
3034
|
const b = firstInvisibleOf(sf);
|
|
2860
3035
|
if (b !== null) {
|
|
@@ -2970,7 +3145,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
2970
3145
|
if (stmt.moduleSpecifier === undefined || !ts.isStringLiteral(stmt.moduleSpecifier))
|
|
2971
3146
|
continue;
|
|
2972
3147
|
const target = resolveEdge(dep, stmt.moduleSpecifier.text);
|
|
2973
|
-
if (target === null || target.fileName.endsWith(".json") || !isNodeEsmFile7(target))
|
|
3148
|
+
if (target === null || target.fileName.endsWith(".json") || !isNodeEsmFile7(target, program))
|
|
2974
3149
|
continue;
|
|
2975
3150
|
const candidate = runtimeExport(target, name, nextSeen);
|
|
2976
3151
|
if (candidate === undefined)
|
|
@@ -2991,7 +3166,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
2991
3166
|
continue;
|
|
2992
3167
|
const spec = stmt.moduleSpecifier.text;
|
|
2993
3168
|
const dep = resolveEdge(sf, spec);
|
|
2994
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3169
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
2995
3170
|
continue;
|
|
2996
3171
|
if (clause.name !== undefined) {
|
|
2997
3172
|
imports.push({ local: clause.name.text, exportName: "default", spec, nameNode: clause.name, dep });
|
|
@@ -3036,7 +3211,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
3036
3211
|
continue;
|
|
3037
3212
|
const spec = moduleSpecifier.text;
|
|
3038
3213
|
const dep = resolveEdge(sf, spec);
|
|
3039
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3214
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
3040
3215
|
continue;
|
|
3041
3216
|
for (const element of exportClause.elements) {
|
|
3042
3217
|
if (element.isTypeOnly)
|
|
@@ -3068,7 +3243,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
3068
3243
|
if (moduleSpecifier === undefined || !ts.isStringLiteral(moduleSpecifier))
|
|
3069
3244
|
continue;
|
|
3070
3245
|
const dep = resolveEdge(sf, moduleSpecifier.text);
|
|
3071
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3246
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
3072
3247
|
continue;
|
|
3073
3248
|
const bad = dfs(dep);
|
|
3074
3249
|
if (bad !== null)
|
|
@@ -3079,7 +3254,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
3079
3254
|
// Native ESM linking itself starts only from an ESM entry. The caller
|
|
3080
3255
|
// supplies dynamic-only roots here too; each such root gets its own
|
|
3081
3256
|
// promise rejection rather than a startup crash.
|
|
3082
|
-
const bad = isNodeEsmFile7(entry) ? dfs(entry) : null;
|
|
3257
|
+
const bad = isNodeEsmFile7(entry, program) ? dfs(entry) : null;
|
|
3083
3258
|
if (bad !== null) {
|
|
3084
3259
|
return {
|
|
3085
3260
|
crash: {
|
|
@@ -3106,7 +3281,7 @@ function esmNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
3106
3281
|
// before earlier output). Keep the compile-time fence used by the CJS link
|
|
3107
3282
|
// checker for the analogous mid-evaluation failure instead.
|
|
3108
3283
|
for (const sf of moduleOrder) {
|
|
3109
|
-
if (!isNodeEsmFile7(sf) || analysis.visited.has(sf))
|
|
3284
|
+
if (!isNodeEsmFile7(sf, program) || analysis.visited.has(sf))
|
|
3110
3285
|
continue;
|
|
3111
3286
|
const childFailure = analysis.firstMissingOf(sf);
|
|
3112
3287
|
if (childFailure !== null) {
|
|
@@ -3274,12 +3449,12 @@ export function orderedImportsOf(program, sf) {
|
|
|
3274
3449
|
* as a module edge), else null. No offender reporting here — preflight
|
|
3275
3450
|
* already classified the import; this is the lookup the module-order and
|
|
3276
3451
|
* lowering paths share. */
|
|
3277
|
-
export function npmStaticDepSf7(program, sf, spec) {
|
|
3452
|
+
export function npmStaticDepSf7(program, sf, spec, resolutionKind = "import") {
|
|
3278
3453
|
if (!npmStaticActive() || isRelativeSpecifier(spec))
|
|
3279
3454
|
return null;
|
|
3280
3455
|
if (spec.startsWith("node:") || spec.startsWith("#"))
|
|
3281
3456
|
return null;
|
|
3282
|
-
const npm = resolveNpmImport7(sf.fileName, spec);
|
|
3457
|
+
const npm = resolveNpmImport7(sf.fileName, spec, resolutionKind);
|
|
3283
3458
|
if (npm === null || !isNpmStaticPackage(npm.packageName))
|
|
3284
3459
|
return null;
|
|
3285
3460
|
if (!isJsSourceFileName(npm.typesFile))
|