@scriptc/compiler 0.1.7 → 0.2.1
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 +98 -39
- 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 +108 -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 +88 -30
- 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 +21 -2
- package/dist/backend/llvm/dyn.js +647 -251
- package/dist/backend/llvm/dyn.js.map +1 -1
- package/dist/backend/llvm/emitter.d.ts +596 -1
- package/dist/backend/llvm/emitter.js +769 -425
- 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 +2 -2
- package/dist/backend/llvm/expr-bytes.js +60 -31
- 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 +10 -6
- 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 +78 -81
- 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 +62 -31
- 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 +54 -7
- 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 +220 -131
- 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 +44 -19
- package/dist/backend/llvm/lib-process.js.map +1 -1
- package/dist/backend/llvm/lib-shared.js +162 -3
- 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 +42 -131
- 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 +12 -30
- package/dist/backend/native-toolchain.js +83 -233
- package/dist/backend/native-toolchain.js.map +1 -1
- package/dist/backend/native-toolchain.test.js +77 -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 +73 -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 +103 -34
- package/dist/backend/targets.js.map +1 -1
- package/dist/backend/targets.test.js +72 -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 +37 -7
- 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 +5 -10
- 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 +74 -0
- package/dist/frontend/lowering/class-callbacks.js.map +1 -0
- package/dist/frontend/lowering/class-construction.d.ts +12 -0
- package/dist/frontend/lowering/class-construction.js +156 -0
- package/dist/frontend/lowering/class-construction.js.map +1 -0
- package/dist/frontend/lowering/class-descriptors.d.ts +10 -0
- package/dist/frontend/lowering/class-descriptors.js +114 -0
- package/dist/frontend/lowering/class-descriptors.js.map +1 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.d.ts +51 -0
- package/dist/frontend/lowering/class-dynamic-dispatch.js +1158 -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 +93 -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 +67 -0
- package/dist/frontend/lowering/class-instance-constructor.js.map +1 -0
- package/dist/frontend/lowering/class-method-values.d.ts +13 -0
- package/dist/frontend/lowering/class-method-values.js +235 -0
- package/dist/frontend/lowering/class-method-values.js.map +1 -0
- package/dist/frontend/lowering/class-prototypes.d.ts +19 -0
- package/dist/frontend/lowering/class-prototypes.js +242 -0
- package/dist/frontend/lowering/class-prototypes.js.map +1 -0
- package/dist/frontend/lowering/class-runtime-statics.d.ts +8 -0
- package/dist/frontend/lowering/class-runtime-statics.js +66 -0
- package/dist/frontend/lowering/class-runtime-statics.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 +208 -163
- 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 +58 -63
- 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 +14 -0
- package/dist/frontend/lowering/error-methods.js +177 -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 +51 -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 +132 -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 +509 -183
- package/dist/frontend/lowering/expressions/object-literals.js.map +1 -1
- package/dist/frontend/lowering/expressions/optional-chains.d.ts +3 -4
- package/dist/frontend/lowering/expressions/optional-chains.js +88 -24
- 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 +101 -0
- package/dist/frontend/lowering/function-context.js +109 -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 +11 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js +143 -0
- package/dist/frontend/lowering/generator-dynamic-dispatch.js.map +1 -0
- package/dist/frontend/lowering/lib-boundary.d.ts +4 -1
- package/dist/frontend/lowering/lib-boundary.js +112 -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 +18 -0
- package/dist/frontend/lowering/lower-builtin-values.js +249 -0
- package/dist/frontend/lowering/lower-builtin-values.js.map +1 -0
- package/dist/frontend/lowering/lower-builtins.d.ts +33 -46
- package/dist/frontend/lowering/lower-builtins.js +676 -365
- package/dist/frontend/lowering/lower-builtins.js.map +1 -1
- package/dist/frontend/lowering/lower-calls.d.ts +28 -22
- package/dist/frontend/lowering/lower-calls.js +1660 -412
- package/dist/frontend/lowering/lower-calls.js.map +1 -1
- package/dist/frontend/lowering/lower-classes.d.ts +95 -57
- package/dist/frontend/lowering/lower-classes.js +1491 -404
- 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 +36 -32
- package/dist/frontend/lowering/lower-containers.js +925 -181
- 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 +3 -2
- 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 +37 -13
- package/dist/frontend/lowering/lower-exprs.js +2163 -863
- 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 +88 -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 +7 -8
- package/dist/frontend/lowering/lower-island.js +66 -33
- 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 +445 -39
- package/dist/frontend/lowering/lower-modules.js.map +1 -1
- package/dist/frontend/lowering/lower-modules.test.d.ts +1 -0
- package/dist/frontend/lowering/lower-modules.test.js +39 -0
- package/dist/frontend/lowering/lower-modules.test.js.map +1 -0
- 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 +17 -17
- package/dist/frontend/lowering/lower-stmts.js +855 -514
- 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 +20 -11
- 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 +140 -190
- package/dist/frontend/lowering/lowerer.js +1193 -712
- 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 +172 -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 +10 -3
- package/dist/frontend/lowering/surfaces.js +86 -37
- 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 +12 -0
- package/dist/frontend/lowering/text-decoder-encoding.js +82 -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 +121 -38
- package/dist/frontend/npm-static-prune.js.map +1 -1
- package/dist/frontend/npm-static-prune.test.js +9 -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 +39 -20
- package/dist/frontend/program.js +393 -189
- package/dist/frontend/program.js.map +1 -1
- package/dist/frontend/program.test.js +105 -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 +25 -18
- 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 +47 -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 +34 -18
- package/dist/frontend/type-mapper.js +552 -131
- package/dist/frontend/type-mapper.js.map +1 -1
- package/dist/frontend/type-mapper.test.js +146 -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 +23 -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 +334 -176
- package/dist/ir/ir.js +710 -903
- package/dist/ir/ir.js.map +1 -1
- package/dist/ir/ir.test.js +162 -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 +33 -14
- package/dist/ir/serialize.js.map +1 -1
- package/dist/ir/serialize.test.d.ts +1 -0
- package/dist/ir/serialize.test.js +57 -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 +2018 -1498
- package/dist/ir/validate.js.map +1 -1
- package/dist/ir/validate.test.js +536 -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 +137 -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 +94 -0
- package/dist/native/toolchain.js.map +1 -0
- package/dist/native/toolchain.test.d.ts +1 -0
- package/dist/native/toolchain.test.js +85 -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 +107 -98
- 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) {
|
|
@@ -380,18 +382,27 @@ function createRequireProgramRoots7(program) {
|
|
|
380
382
|
for (const sf of program.getSourceFiles()) {
|
|
381
383
|
if (sf.isDeclarationFile || sf.fileName.endsWith(".json"))
|
|
382
384
|
continue;
|
|
385
|
+
const calls = [];
|
|
383
386
|
ts.walkPreorder(sf, (node) => {
|
|
384
387
|
if (!ts.isCallExpression(node) || node.questionDotToken !== undefined ||
|
|
385
388
|
node.arguments.length !== 1 || !ts.isStringLiteralLike(node.arguments[0]) ||
|
|
386
|
-
!ts.isIdentifier(node.expression)
|
|
389
|
+
!ts.isIdentifier(node.expression)) {
|
|
387
390
|
return undefined;
|
|
388
391
|
}
|
|
389
|
-
|
|
392
|
+
calls.push({ callee: node.expression, spec: node.arguments[0].text });
|
|
393
|
+
});
|
|
394
|
+
// Root discovery only needs the callee's binding. A first-miss lookup
|
|
395
|
+
// otherwise fetches symbols and types for every identifier in the file,
|
|
396
|
+
// including all unreachable bodies in large published packages.
|
|
397
|
+
program.getTypeChecker().prefetchSymbolNodesExact(calls.map((call) => call.callee));
|
|
398
|
+
for (const { callee, spec } of calls) {
|
|
399
|
+
if (!isCreateRequireBinding7(program, callee))
|
|
400
|
+
continue;
|
|
390
401
|
if (canonicalBuiltinModule(spec) !== null)
|
|
391
|
-
|
|
402
|
+
continue;
|
|
392
403
|
let target = resolveProjectModule(sf.fileName, spec);
|
|
393
404
|
if (target === null && !spec.startsWith("#")) {
|
|
394
|
-
const npm = resolveNpmImport7(sf.fileName, spec);
|
|
405
|
+
const npm = resolveNpmImport7(sf.fileName, spec, "require");
|
|
395
406
|
if (npm !== null && isNpmStaticPackage(npm.packageName) && isJsSourceFileName(npm.typesFile)) {
|
|
396
407
|
target = npm.typesFile;
|
|
397
408
|
}
|
|
@@ -400,12 +411,11 @@ function createRequireProgramRoots7(program) {
|
|
|
400
411
|
// out of TypeScript's source roots so the require call can report
|
|
401
412
|
// the native-addon boundary instead of an unsupported-file error.
|
|
402
413
|
if (target === null || target.endsWith(".json") || target.endsWith(".node"))
|
|
403
|
-
|
|
414
|
+
continue;
|
|
404
415
|
const normalized = tsgoPath(resolve(target));
|
|
405
416
|
if (!known.has(normalized))
|
|
406
417
|
roots.add(normalized);
|
|
407
|
-
|
|
408
|
-
});
|
|
418
|
+
}
|
|
409
419
|
}
|
|
410
420
|
return [...roots].sort();
|
|
411
421
|
}
|
|
@@ -422,22 +432,20 @@ export function entryPackageFilePredicate(entryPath) {
|
|
|
422
432
|
!normalized.slice(prefix.length).split("/").includes("node_modules"));
|
|
423
433
|
};
|
|
424
434
|
}
|
|
425
|
-
/** maxNodeModuleJsDepth
|
|
426
|
-
*
|
|
427
|
-
*
|
|
435
|
+
/** maxNodeModuleJsDepth can omit relative imports within an admitted
|
|
436
|
+
* package. Discover its runtime sources to a fixpoint so the checker and
|
|
437
|
+
* module resolver see the same graph regardless of import traversal order. */
|
|
428
438
|
function entryPackageProgramRoots7(program, entryPath) {
|
|
429
|
-
if (!isNodeModulesPath(entryPath))
|
|
430
|
-
return [];
|
|
431
439
|
const belongsToEntry = entryPackageFilePredicate(entryPath);
|
|
432
440
|
const roots = new Set();
|
|
433
441
|
for (const sf of program.getSourceFiles()) {
|
|
434
|
-
if (sf.isDeclarationFile || !belongsToEntry(sf.fileName))
|
|
442
|
+
if (sf.isDeclarationFile || (!belongsToEntry(sf.fileName) && npmStaticPackageOfPath(sf.fileName) === null))
|
|
435
443
|
continue;
|
|
436
444
|
for (const specifier of sf.imports) {
|
|
437
445
|
if (!ts.isStringLiteralLike(specifier))
|
|
438
446
|
continue;
|
|
439
447
|
const target = resolveProjectModule(sf.fileName, specifier.text);
|
|
440
|
-
if (target !== null && belongsToEntry(target) && isJsSourceFileName(target) &&
|
|
448
|
+
if (target !== null && (belongsToEntry(target) || npmStaticPackageOfPath(target) !== null) && isJsSourceFileName(target) &&
|
|
441
449
|
program.getSourceFile(target) === undefined)
|
|
442
450
|
roots.add(target);
|
|
443
451
|
}
|
|
@@ -482,52 +490,54 @@ function loadProgram7(host, entryPath, externalTypes = new Map()) {
|
|
|
482
490
|
}
|
|
483
491
|
const coreRoots = [entryPath, ambientDtsPath(), nodeTypes ?? fallbackDtsPath()];
|
|
484
492
|
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();
|
|
493
|
+
let program = host.createProgram([...programRoots, overridesDtsPath()], options);
|
|
494
|
+
try {
|
|
495
|
+
for (let pass = 0; pass < 32; pass++) {
|
|
496
|
+
const candidates = [
|
|
497
|
+
...entryPackageProgramRoots7(program, entryPath),
|
|
498
|
+
...createRequireProgramRoots7(program),
|
|
499
|
+
...forkTargetPaths(program, program.getSourceFiles()),
|
|
500
|
+
];
|
|
501
|
+
const extraRoots = candidates.filter((root, index) => !programRoots.includes(root) && candidates.indexOf(root) === index);
|
|
502
|
+
if (extraRoots.length === 0)
|
|
503
|
+
break;
|
|
516
504
|
program.dispose();
|
|
517
|
-
|
|
518
|
-
|
|
505
|
+
programRoots.push(...extraRoots);
|
|
506
|
+
program = host.createProgram([...programRoots, overridesDtsPath()], options);
|
|
507
|
+
if (pass === 31)
|
|
508
|
+
throw new Error("static program-root discovery did not converge");
|
|
509
|
+
}
|
|
510
|
+
const entry = program.getSourceFile(entryPath);
|
|
511
|
+
if (!entry)
|
|
512
|
+
throw new Error(`could not load ${entryPath}`);
|
|
513
|
+
const externalTypeSpecifiersByFile = externalTypeFileClosure7(program, externalTypes);
|
|
514
|
+
let projectWorld = null;
|
|
515
|
+
return {
|
|
516
|
+
program,
|
|
517
|
+
entry,
|
|
518
|
+
moduleOrder: [],
|
|
519
|
+
configDiags: config.diags,
|
|
520
|
+
externalTypes,
|
|
521
|
+
externalTypeSpecifiersByFile,
|
|
522
|
+
projectWorld: () => (projectWorld ??= host.createProgram(programRoots, options)),
|
|
523
|
+
disposeAll: () => {
|
|
524
|
+
try {
|
|
525
|
+
projectWorld?.dispose();
|
|
526
|
+
}
|
|
527
|
+
finally {
|
|
528
|
+
program.dispose();
|
|
529
|
+
}
|
|
530
|
+
},
|
|
531
|
+
};
|
|
532
|
+
}
|
|
533
|
+
catch (error) {
|
|
534
|
+
program.dispose();
|
|
535
|
+
throw error;
|
|
536
|
+
}
|
|
519
537
|
}
|
|
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).
|
|
538
|
+
export function loadProgram(entryPath, services, opts) {
|
|
527
539
|
entryPath = resolve(entryPath);
|
|
528
|
-
const externalTypeEntries = opts?.externalTypes
|
|
529
|
-
? [...opts.externalTypes]
|
|
530
|
-
: Object.entries(opts?.externalTypes ?? {});
|
|
540
|
+
const externalTypeEntries = opts?.externalTypes ?? [];
|
|
531
541
|
const externalTypes = new Map();
|
|
532
542
|
for (const [specifier, file] of externalTypeEntries) {
|
|
533
543
|
if (!isExactExternalTypeSpecifier(specifier)) {
|
|
@@ -549,6 +559,7 @@ export function loadProgram(entryPath, opts) {
|
|
|
549
559
|
// or executable module edges.
|
|
550
560
|
const declarationOverloads = new Map();
|
|
551
561
|
const declarationProperties = new Map();
|
|
562
|
+
const projectionOwners = new Map();
|
|
552
563
|
for (const pkg of npmStaticPackages) {
|
|
553
564
|
const resolved = resolveBareModule(entryPath, pkg, "types-only");
|
|
554
565
|
if (resolved === null ||
|
|
@@ -556,8 +567,8 @@ export function loadProgram(entryPath, opts) {
|
|
|
556
567
|
!/\.d\.(?:ts|mts|cts)$/.test(resolved.typesFile)) {
|
|
557
568
|
continue;
|
|
558
569
|
}
|
|
559
|
-
const overloads = npmStaticDeclarationOverloadsOf(resolved.typesFile);
|
|
560
|
-
const properties = npmStaticDeclarationPropertiesOf(resolved.typesFile);
|
|
570
|
+
const overloads = npmStaticDeclarationOverloadsOf(services, resolved.typesFile);
|
|
571
|
+
const properties = npmStaticDeclarationPropertiesOf(services, resolved.typesFile);
|
|
561
572
|
const classNames = new Set([...overloads.keys(), ...properties.keys()]);
|
|
562
573
|
if (classNames.size === 0)
|
|
563
574
|
continue;
|
|
@@ -567,8 +578,8 @@ export function loadProgram(entryPath, opts) {
|
|
|
567
578
|
const runtimeSource = trackedReadFile(runtime.typesFile);
|
|
568
579
|
if (runtimeSource === null)
|
|
569
580
|
continue;
|
|
570
|
-
const targets = npmStaticRuntimeClassTargets(runtime.typesFile, runtimeSource, classNames);
|
|
571
|
-
for (const [className, specifier] of targets) {
|
|
581
|
+
const targets = npmStaticRuntimeClassTargets(services.parse(runtime.typesFile, runtimeSource, "js"), runtimeSource, classNames);
|
|
582
|
+
for (const [className, { specifier, localName }] of targets) {
|
|
572
583
|
const methods = overloads.get(className);
|
|
573
584
|
const fields = properties.get(className);
|
|
574
585
|
if (methods === undefined && fields === undefined)
|
|
@@ -582,14 +593,39 @@ export function loadProgram(entryPath, opts) {
|
|
|
582
593
|
targetNorm.startsWith(runtime.workspaceDir.split("\\").join("/") + "/");
|
|
583
594
|
if (targetPackage !== pkg && !insideWorkspace)
|
|
584
595
|
continue;
|
|
596
|
+
const projectionKey = JSON.stringify([targetNorm, localName]);
|
|
597
|
+
const previousOwner = projectionOwners.get(projectionKey);
|
|
598
|
+
if (previousOwner !== undefined && previousOwner !== className) {
|
|
599
|
+
// Two public class declarations naming one runtime class are
|
|
600
|
+
// ambiguous. Keep inference instead of choosing one alias's ABI.
|
|
601
|
+
projectionOwners.set(projectionKey, null);
|
|
602
|
+
const priorMethods = new Map(declarationOverloads.get(targetNorm) ?? []);
|
|
603
|
+
priorMethods.delete(localName);
|
|
604
|
+
declarationOverloads.set(targetNorm, priorMethods);
|
|
605
|
+
const priorFields = new Map(declarationProperties.get(targetNorm) ?? []);
|
|
606
|
+
priorFields.delete(localName);
|
|
607
|
+
declarationProperties.set(targetNorm, priorFields);
|
|
608
|
+
continue;
|
|
609
|
+
}
|
|
610
|
+
projectionOwners.set(projectionKey, className);
|
|
611
|
+
// The safe declaration grammar can name only its own class. Bind
|
|
612
|
+
// that type to the actual runtime class after a named ESM alias.
|
|
613
|
+
const renameSelf = (type) => type.split(/([\s[\]<>()|,]+)/).map((name) => name === className ? localName : name).join("");
|
|
585
614
|
if (methods !== undefined) {
|
|
586
615
|
const byClass = new Map(declarationOverloads.get(targetNorm) ?? []);
|
|
587
|
-
byClass.set(
|
|
616
|
+
byClass.set(localName, new Map([...methods].map(([name, signatures]) => [name, signatures.map((signature) => ({
|
|
617
|
+
parameters: signature.parameters.map((parameter) => ({
|
|
618
|
+
name: parameter.name,
|
|
619
|
+
type: renameSelf(parameter.type),
|
|
620
|
+
optional: parameter.optional,
|
|
621
|
+
})),
|
|
622
|
+
returnType: renameSelf(signature.returnType),
|
|
623
|
+
}))])));
|
|
588
624
|
declarationOverloads.set(targetNorm, byClass);
|
|
589
625
|
}
|
|
590
626
|
if (fields !== undefined) {
|
|
591
627
|
const byClass = new Map(declarationProperties.get(targetNorm) ?? []);
|
|
592
|
-
byClass.set(
|
|
628
|
+
byClass.set(localName, new Map([...fields].map(([name, type]) => [name, renameSelf(type)])));
|
|
593
629
|
declarationProperties.set(targetNorm, byClass);
|
|
594
630
|
}
|
|
595
631
|
}
|
|
@@ -619,25 +655,55 @@ export function loadProgram(entryPath, opts) {
|
|
|
619
655
|
// outside node_modules — the classic typed-JS-library entry — must not exist for
|
|
620
656
|
// the checker, so its resolution lands on the JS Node actually loads;
|
|
621
657
|
// resolve.ts answers the same sibling for scriptc's own edges).
|
|
622
|
-
const npmShadow = npmStaticFsShadow();
|
|
658
|
+
const npmShadow = npmStaticFsShadow(services);
|
|
623
659
|
const fsShadow = {
|
|
624
660
|
readFile: (path) => npmShadow?.readFile(path),
|
|
625
661
|
hideFile: (path) => (npmShadow?.hideFile(path) ?? false) || projectDtsRuntimeSibling(path) !== null,
|
|
626
662
|
};
|
|
627
|
-
const host =
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
663
|
+
const host = services.createProgramHost({ cwd: dirname(entryPath), fsShadow });
|
|
664
|
+
try {
|
|
665
|
+
const load = loadProgram7(host, entryPath, externalTypes);
|
|
666
|
+
let authoredHost = null;
|
|
667
|
+
let authoredLoad = null;
|
|
668
|
+
return {
|
|
669
|
+
...load,
|
|
670
|
+
services,
|
|
671
|
+
projectWorld: npmStaticPackages.length === 0 ? load.projectWorld : () => {
|
|
672
|
+
// Check authored code against the package's published declarations.
|
|
673
|
+
// Runtime bodies still lower from JavaScript in the original world;
|
|
674
|
+
// inference there must not manufacture errors in valid user code.
|
|
675
|
+
if (!authoredLoad) {
|
|
676
|
+
authoredHost = services.createProgramHost({ cwd: dirname(entryPath) });
|
|
677
|
+
authoredLoad = loadProgram7(authoredHost, entryPath, externalTypes);
|
|
678
|
+
}
|
|
679
|
+
return authoredLoad.projectWorld();
|
|
680
|
+
},
|
|
681
|
+
dispose: () => {
|
|
682
|
+
try {
|
|
683
|
+
authoredLoad?.disposeAll();
|
|
684
|
+
}
|
|
685
|
+
finally {
|
|
686
|
+
authoredHost?.close();
|
|
687
|
+
try {
|
|
688
|
+
load.disposeAll();
|
|
689
|
+
}
|
|
690
|
+
finally {
|
|
691
|
+
host.close();
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
};
|
|
696
|
+
}
|
|
697
|
+
catch (error) {
|
|
698
|
+
host.close();
|
|
699
|
+
throw error;
|
|
700
|
+
}
|
|
636
701
|
}
|
|
637
702
|
/** tsc diagnostics (syntax + types), the supported-import fence, and the
|
|
638
703
|
* module evaluation order: fills load.moduleOrder (the SourceFiles
|
|
639
704
|
* themselves — the lowering consumes them directly) and returns the
|
|
640
|
-
* preflight diagnostics.
|
|
705
|
+
* preflight diagnostics. Preserve the caller's complete load shape when
|
|
706
|
+
* mutating it, including its owned services and disposal callback. */
|
|
641
707
|
export function checkPreflight(load) {
|
|
642
708
|
const { diags, moduleOrder, startupCrash } = preflight7(load);
|
|
643
709
|
load.moduleOrder = moduleOrder;
|
|
@@ -657,7 +723,10 @@ export function checkPreflight(load) {
|
|
|
657
723
|
* assignments in CJS classes (`this[kSym] = v` under `module.exports =
|
|
658
724
|
* Class`) — 5.9.3 synthesized expando symbols, tsgo trips its
|
|
659
725
|
* redeclaration check instead (the corpus's countdown fixture). */
|
|
660
|
-
|
|
726
|
+
// Ordinary JavaScript functions are constructable even when the checker
|
|
727
|
+
// retains only their call signature after a factory return. Heritage
|
|
728
|
+
// lowering separately verifies the actual constructor implementation.
|
|
729
|
+
const TS7_JS_RELAXED_EXTRA = new Set([2309, 2323, 2507]);
|
|
661
730
|
function suppressedJsStrictness7(d) {
|
|
662
731
|
const file = d.fileName;
|
|
663
732
|
if (!file || !isJsSourceFileName(file))
|
|
@@ -837,7 +906,7 @@ function purePrefixStmt7(program, s) {
|
|
|
837
906
|
return true; // directive
|
|
838
907
|
if (isRequireStatement7(s))
|
|
839
908
|
return true;
|
|
840
|
-
if (isCjsJsFile7(s.getSourceFile())) {
|
|
909
|
+
if (isCjsJsFile7(s.getSourceFile(), program)) {
|
|
841
910
|
if (ts.isExpressionStatement(s) && isEsModuleStamp(s.expression)) {
|
|
842
911
|
const call = s.expression;
|
|
843
912
|
const object = call.expression.expression;
|
|
@@ -855,11 +924,10 @@ function purePrefixStmt7(program, s) {
|
|
|
855
924
|
}
|
|
856
925
|
return false;
|
|
857
926
|
}
|
|
858
|
-
/** Can code that runs BEFORE the
|
|
859
|
-
*
|
|
860
|
-
*
|
|
861
|
-
*
|
|
862
|
-
* early read would silently diverge. Conservative reachability: earlier
|
|
927
|
+
/** Can code that runs BEFORE the declaration at index `k` reach one of
|
|
928
|
+
* its bindings? Static require aliases and symbol field keys bypass
|
|
929
|
+
* storage reads, so an early use could erase a TDZ error or a var's
|
|
930
|
+
* initial undefined value. Conservative reachability: earlier
|
|
863
931
|
* statements' whole subtrees (arrows and function expressions included)
|
|
864
932
|
* read the binding directly, or reference a hoisted function/class whose
|
|
865
933
|
* body (transitively through other hoisted declarations) reads it — a
|
|
@@ -870,7 +938,7 @@ function purePrefixStmt7(program, s) {
|
|
|
870
938
|
* (The CheckerFacade memoizes symbol queries, and 7's client dedupes
|
|
871
939
|
* symbol identity by server handle, so the Map-keyed-by-Symbol discipline
|
|
872
940
|
* carries over from the 5.9.3 original unchanged.) */
|
|
873
|
-
function
|
|
941
|
+
export function bindingEarlyUse7(program, sf, k, decl, precedingDecls) {
|
|
874
942
|
const checker = program.getTypeChecker();
|
|
875
943
|
const bound = [];
|
|
876
944
|
if (ts.isIdentifier(decl.name))
|
|
@@ -906,7 +974,9 @@ function requireTdzRisk7(program, sf, k, decl, precedingDecls) {
|
|
|
906
974
|
// this scan must survive it so the nesting fence can answer later.
|
|
907
975
|
ts.walkPreorder(root, (n) => {
|
|
908
976
|
if (ts.isIdentifier(n)) {
|
|
909
|
-
const sym =
|
|
977
|
+
const sym = ts.isShorthandPropertyAssignment(n.parent)
|
|
978
|
+
? checker.getShorthandAssignmentValueSymbol(n.parent)
|
|
979
|
+
: checker.getSymbolAtLocation(n);
|
|
910
980
|
if (sym) {
|
|
911
981
|
const name = bindings.get(sym);
|
|
912
982
|
if (name !== undefined) {
|
|
@@ -982,7 +1052,7 @@ function isCreateRequireImport7(program, ident) {
|
|
|
982
1052
|
const decl = symbol ? checker.declarationsOf(symbol)[0] : undefined;
|
|
983
1053
|
if (decl === undefined || !ts.isImportSpecifier(decl))
|
|
984
1054
|
return false;
|
|
985
|
-
const importDecl = decl.parent
|
|
1055
|
+
const importDecl = decl.parent?.parent?.parent;
|
|
986
1056
|
if (ts.isImportDeclaration(importDecl) && ts.isStringLiteral(importDecl.moduleSpecifier)) {
|
|
987
1057
|
const module = canonicalBuiltinModule(importDecl.moduleSpecifier.text);
|
|
988
1058
|
const member = decl.propertyName?.text ?? decl.name.text;
|
|
@@ -1002,11 +1072,10 @@ function isCreateRequireImport7(program, ident) {
|
|
|
1002
1072
|
}
|
|
1003
1073
|
return false;
|
|
1004
1074
|
}
|
|
1005
|
-
/** True only for
|
|
1006
|
-
*
|
|
1007
|
-
*
|
|
1008
|
-
|
|
1009
|
-
function isCreateRequireBinding7(program, callee) {
|
|
1075
|
+
/** True only for createRequire bindings the lowering can erase. Mutable
|
|
1076
|
+
* declaration syntax needs a whole-file proof: no writes or escapes, and
|
|
1077
|
+
* no code before initialization can reach the binding. */
|
|
1078
|
+
export function isCreateRequireBinding7(program, callee) {
|
|
1010
1079
|
const checker = program.getTypeChecker();
|
|
1011
1080
|
const symbol = checker.getSymbolAtLocation(callee);
|
|
1012
1081
|
const decl = symbol
|
|
@@ -1014,11 +1083,70 @@ function isCreateRequireBinding7(program, callee) {
|
|
|
1014
1083
|
: undefined;
|
|
1015
1084
|
if (decl === undefined ||
|
|
1016
1085
|
decl.initializer === undefined ||
|
|
1017
|
-
!ts.isVariableDeclarationList(decl.parent)
|
|
1018
|
-
(decl.parent.flags & ts.NodeFlags.Const) === 0) {
|
|
1086
|
+
!ts.isVariableDeclarationList(decl.parent)) {
|
|
1019
1087
|
return false;
|
|
1020
1088
|
}
|
|
1021
|
-
|
|
1089
|
+
return isCreateRequireBaseCall7(program, decl.initializer) && ((decl.parent.flags & ts.NodeFlags.Const) !== 0 ||
|
|
1090
|
+
stableCreateRequireBindingReason7(program, decl) === null);
|
|
1091
|
+
}
|
|
1092
|
+
/** Only literal calls and literal resolution queries can erase the loader
|
|
1093
|
+
* value. In particular, assignments, exported aliases, shorthand properties,
|
|
1094
|
+
* optional calls, and passing the loader to user code cannot pass this test. */
|
|
1095
|
+
function staticCreateRequireUse7(expr) {
|
|
1096
|
+
let use = expr;
|
|
1097
|
+
while (ts.isParenthesizedExpression(use.parent))
|
|
1098
|
+
use = use.parent;
|
|
1099
|
+
if (ts.isPropertyAccessExpression(use.parent) && use.parent.expression === use && use.parent.name.text === "resolve" && !use.parent.questionDotToken) {
|
|
1100
|
+
use = use.parent;
|
|
1101
|
+
if (ts.isPropertyAccessExpression(use.parent) && use.parent.expression === use && use.parent.name.text === "paths" && !use.parent.questionDotToken)
|
|
1102
|
+
use = use.parent;
|
|
1103
|
+
}
|
|
1104
|
+
const call = use.parent;
|
|
1105
|
+
return ts.isCallExpression(call) && call.expression === use && !call.questionDotToken &&
|
|
1106
|
+
call.arguments.length === 1 && ts.isStringLiteralLike(call.arguments[0]);
|
|
1107
|
+
}
|
|
1108
|
+
function stableCreateRequireBindingReason7(program, decl) {
|
|
1109
|
+
const cache = program.analysis.createRequireReasons;
|
|
1110
|
+
if (cache.has(decl))
|
|
1111
|
+
return cache.get(decl);
|
|
1112
|
+
const check = () => {
|
|
1113
|
+
const stmt = decl.parent?.parent;
|
|
1114
|
+
if (!ts.isIdentifier(decl.name) || !ts.isVariableStatement(stmt) || !ts.isSourceFile(stmt.parent)) {
|
|
1115
|
+
return "its mutable createRequire binding is outside the module's top level";
|
|
1116
|
+
}
|
|
1117
|
+
const checker = program.getTypeChecker();
|
|
1118
|
+
const symbol = checker.getSymbolAtLocation(decl.name);
|
|
1119
|
+
if (!symbol || checker.declarationsOf(symbol).length !== 1)
|
|
1120
|
+
return "its createRequire binding is redeclared";
|
|
1121
|
+
if ((ts.getCombinedModifierFlags(decl) & ts.ModifierFlags.Export) !== 0)
|
|
1122
|
+
return "its createRequire result escapes through an exported binding";
|
|
1123
|
+
const sf = decl.getSourceFile();
|
|
1124
|
+
const refs = identifierOccurrences7(sf, decl.name.text);
|
|
1125
|
+
checker.prefetchSymbolNodesExact(refs);
|
|
1126
|
+
for (const ref of refs) {
|
|
1127
|
+
if (ref === decl.name || inTypePosition7(ref))
|
|
1128
|
+
continue;
|
|
1129
|
+
let target = ts.isShorthandPropertyAssignment(ref.parent)
|
|
1130
|
+
? checker.getShorthandAssignmentValueSymbol(ref.parent)
|
|
1131
|
+
: checker.getSymbolAtLocation(ref);
|
|
1132
|
+
if (target && (target.flags & ts.SymbolFlags.Alias) !== 0)
|
|
1133
|
+
target = checker.getAliasedSymbol(target);
|
|
1134
|
+
if (target === symbol && !staticCreateRequireUse7(ref)) {
|
|
1135
|
+
return "its createRequire binding is reassigned, escapes, or uses a computed specifier";
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
const preceding = stmt.declarationList.declarations.slice(0, stmt.declarationList.declarations.indexOf(decl));
|
|
1139
|
+
if (bindingEarlyUse7(program, sf, sf.statements.indexOf(stmt), decl, preceding) !== null) {
|
|
1140
|
+
return "its createRequire binding can be used before initialization";
|
|
1141
|
+
}
|
|
1142
|
+
return null;
|
|
1143
|
+
};
|
|
1144
|
+
const reason = check();
|
|
1145
|
+
cache.set(decl, reason);
|
|
1146
|
+
return reason;
|
|
1147
|
+
}
|
|
1148
|
+
function isCreateRequireBaseCall7(program, expr) {
|
|
1149
|
+
const init = stripRequireCasts7(expr);
|
|
1022
1150
|
if (!ts.isCallExpression(init) ||
|
|
1023
1151
|
init.questionDotToken !== undefined ||
|
|
1024
1152
|
!ts.isIdentifier(init.expression) ||
|
|
@@ -1028,13 +1156,77 @@ function isCreateRequireBinding7(program, callee) {
|
|
|
1028
1156
|
}
|
|
1029
1157
|
const base = stripRequireCasts7(init.arguments[0]);
|
|
1030
1158
|
if (ts.isIdentifier(base) && base.text === "__filename")
|
|
1031
|
-
return
|
|
1159
|
+
return !sourceBinding7(program, base);
|
|
1032
1160
|
return (ts.isPropertyAccessExpression(base) &&
|
|
1033
1161
|
base.questionDotToken === undefined &&
|
|
1034
1162
|
ts.isMetaProperty(base.expression) &&
|
|
1035
1163
|
base.expression.keywordToken === ts.SyntaxKind.ImportKeyword &&
|
|
1036
1164
|
(base.name.text === "url" || base.name.text === "filename"));
|
|
1037
1165
|
}
|
|
1166
|
+
/** A node:module import alone does not require an engine. Retain npm
|
|
1167
|
+
* fallback for require indirection the lowering cannot erase, while
|
|
1168
|
+
* admitting literal calls through the same stable/inline shapes as program
|
|
1169
|
+
* code. Inspect symbols, not names: nested shadows are unrelated bindings. */
|
|
1170
|
+
function npmStaticModuleImportReason7(program, stmt) {
|
|
1171
|
+
const clause = stmt.importClause;
|
|
1172
|
+
if (!clause)
|
|
1173
|
+
return null;
|
|
1174
|
+
const bindings = clause.namedBindings;
|
|
1175
|
+
if (clause.name || (bindings && !ts.isNamedImports(bindings))) {
|
|
1176
|
+
return "its node:module namespace or default import has no static createRequire usage proof";
|
|
1177
|
+
}
|
|
1178
|
+
if (!bindings || !ts.isNamedImports(bindings))
|
|
1179
|
+
return null;
|
|
1180
|
+
const checker = program.getTypeChecker();
|
|
1181
|
+
const sf = stmt.getSourceFile();
|
|
1182
|
+
for (const specifier of bindings.elements) {
|
|
1183
|
+
if ((specifier.propertyName?.text ?? specifier.name.text) !== "createRequire")
|
|
1184
|
+
continue;
|
|
1185
|
+
const imported = checker.getSymbolAtLocation(specifier.name);
|
|
1186
|
+
if (!imported)
|
|
1187
|
+
return "its createRequire import could not be resolved";
|
|
1188
|
+
checker.prefetchSymbolNodesExact(identifierOccurrences7(sf, specifier.name.text));
|
|
1189
|
+
let reason = null;
|
|
1190
|
+
const checkUse = (expr) => {
|
|
1191
|
+
if (!staticCreateRequireUse7(expr)) {
|
|
1192
|
+
reason = "its createRequire result escapes or is used with a computed specifier (static requires need literal specifiers)";
|
|
1193
|
+
}
|
|
1194
|
+
};
|
|
1195
|
+
ts.walkPreorder(sf, (node) => {
|
|
1196
|
+
if (reason || !ts.isIdentifier(node) || node.text !== specifier.name.text || node === specifier.name || checker.getSymbolAtLocation(node) !== imported)
|
|
1197
|
+
return;
|
|
1198
|
+
const call = node.parent;
|
|
1199
|
+
if (!ts.isCallExpression(call) || call.expression !== node || !isCreateRequireBaseCall7(program, call)) {
|
|
1200
|
+
reason = "its createRequire import is used outside a supported call based on the current file";
|
|
1201
|
+
return;
|
|
1202
|
+
}
|
|
1203
|
+
const decl = call.parent;
|
|
1204
|
+
if (ts.isVariableDeclaration(decl) && decl.initializer === call && ts.isIdentifier(decl.name)) {
|
|
1205
|
+
if ((ts.getCombinedModifierFlags(decl) & ts.ModifierFlags.Export) !== 0) {
|
|
1206
|
+
reason = "its createRequire result escapes through an exported binding";
|
|
1207
|
+
return;
|
|
1208
|
+
}
|
|
1209
|
+
if (!isCreateRequireBinding7(program, decl.name)) {
|
|
1210
|
+
reason = stableCreateRequireBindingReason7(program, decl);
|
|
1211
|
+
return;
|
|
1212
|
+
}
|
|
1213
|
+
const sym = checker.getSymbolAtLocation(decl.name);
|
|
1214
|
+
const name = decl.name.text;
|
|
1215
|
+
checker.prefetchSymbolNodesExact(identifierOccurrences7(sf, name));
|
|
1216
|
+
ts.walkPreorder(sf, (ref) => {
|
|
1217
|
+
if (ts.isIdentifier(ref) && ref.text === name && ref !== decl.name && checker.getSymbolAtLocation(ref) === sym)
|
|
1218
|
+
checkUse(ref);
|
|
1219
|
+
});
|
|
1220
|
+
}
|
|
1221
|
+
else {
|
|
1222
|
+
checkUse(call);
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
if (reason)
|
|
1226
|
+
return reason;
|
|
1227
|
+
}
|
|
1228
|
+
return null;
|
|
1229
|
+
}
|
|
1038
1230
|
/** Classifies a require-shaped call as Node's ambient CommonJS global, the
|
|
1039
1231
|
* one supported createRequire source binding, or another source binding.
|
|
1040
1232
|
* The scanners still collect createRequire calls because they carry static
|
|
@@ -1119,9 +1311,11 @@ function nodeEsmSyntaxMarker7(sf) {
|
|
|
1119
1311
|
found = node;
|
|
1120
1312
|
return "stop";
|
|
1121
1313
|
}
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1314
|
+
// Only await syntax needs an ancestor walk. Doing this for every node
|
|
1315
|
+
// makes a deeply nested expression take quadratic time to classify.
|
|
1316
|
+
if ((ts.isAwaitExpression(node) ||
|
|
1317
|
+
(ts.isForOfStatement(node) && node.awaitModifier !== undefined)) &&
|
|
1318
|
+
!insideFunctionLike7(node)) {
|
|
1125
1319
|
found = node;
|
|
1126
1320
|
return "stop";
|
|
1127
1321
|
}
|
|
@@ -1129,14 +1323,13 @@ function nodeEsmSyntaxMarker7(sf) {
|
|
|
1129
1323
|
});
|
|
1130
1324
|
return found;
|
|
1131
1325
|
}
|
|
1132
|
-
const nodeEsmFileCache7 = new WeakMap();
|
|
1133
1326
|
/** True when Node would treat this file as an ES MODULE (never defining
|
|
1134
1327
|
* require/__dirname there): fixed extensions first, then an explicit
|
|
1135
1328
|
* nearest-package type, then Node's syntax markers for ambiguous .js/.ts
|
|
1136
1329
|
* files. TypeScript's external-module bit is forced for checker scoping and
|
|
1137
1330
|
* therefore intentionally plays no part in this runtime decision. */
|
|
1138
|
-
function isNodeEsmFile7(sf) {
|
|
1139
|
-
const cached =
|
|
1331
|
+
function isNodeEsmFile7(sf, program) {
|
|
1332
|
+
const cached = program?.analysis.nodeEsmFiles.get(sf);
|
|
1140
1333
|
if (cached !== undefined)
|
|
1141
1334
|
return cached;
|
|
1142
1335
|
let result;
|
|
@@ -1154,21 +1347,21 @@ function isNodeEsmFile7(sf) {
|
|
|
1154
1347
|
? false
|
|
1155
1348
|
: nodeEsmSyntaxMarker7(sf) !== null;
|
|
1156
1349
|
}
|
|
1157
|
-
|
|
1350
|
+
program?.analysis.nodeEsmFiles.set(sf, result);
|
|
1158
1351
|
return result;
|
|
1159
1352
|
}
|
|
1160
1353
|
/** A JavaScript source file Node treats as CommonJS (not an ES module):
|
|
1161
1354
|
* ESM namespace/default machinery must not claim it — its export surface
|
|
1162
1355
|
* is module.exports, read through the CJS interop paths and their own
|
|
1163
1356
|
* fences. */
|
|
1164
|
-
function isCjsJsFile7(sf) {
|
|
1165
|
-
return isJsSourceFileName(sf.fileName) && !isNodeEsmFile7(sf);
|
|
1357
|
+
function isCjsJsFile7(sf, program) {
|
|
1358
|
+
return isJsSourceFileName(sf.fileName) && !isNodeEsmFile7(sf, program);
|
|
1166
1359
|
}
|
|
1167
1360
|
/** The exported spelling of isCjsJsFile7 (the lowering's gate for
|
|
1168
1361
|
* module.exports surfaces — `ts.isExternalModule` is NOT the CJS test:
|
|
1169
1362
|
* tsgo marks CJS files with export assignments as external modules). */
|
|
1170
|
-
export function isCjsJsFile(sf) {
|
|
1171
|
-
return isCjsJsFile7(sf);
|
|
1363
|
+
export function isCjsJsFile(sf, program) {
|
|
1364
|
+
return isCjsJsFile7(sf, program);
|
|
1172
1365
|
}
|
|
1173
1366
|
/** The self-import TDZ fences: for `import { x } from "<self>"` (default
|
|
1174
1367
|
* and namespace forms included), any TOP-LEVEL reference lexically above
|
|
@@ -1578,7 +1771,7 @@ function identifierOccurrences7(root, text) {
|
|
|
1578
1771
|
* Re-export statements bind nothing locally — always null: the alias is
|
|
1579
1772
|
* link-time plumbing, never an evaluation-time read. Export specifiers
|
|
1580
1773
|
* of an imported binding are the same alias story, not reads. */
|
|
1581
|
-
function backEdgeUseOffence7(program,
|
|
1774
|
+
function backEdgeUseOffence7(program, stmt, occurrences) {
|
|
1582
1775
|
if (!ts.isImportDeclaration(stmt) || stmt.importClause === undefined)
|
|
1583
1776
|
return null;
|
|
1584
1777
|
const checker = program.getTypeChecker();
|
|
@@ -1598,25 +1791,16 @@ function backEdgeUseOffence7(program, sf, stmt) {
|
|
|
1598
1791
|
const sym = checker.getSymbolAtLocation(bindingName);
|
|
1599
1792
|
if (sym === undefined)
|
|
1600
1793
|
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)) &&
|
|
1794
|
+
const references = occurrences.get(bindingName.text) ?? [];
|
|
1795
|
+
checker.prefetchSymbolNodesExact(references);
|
|
1796
|
+
for (const node of references) {
|
|
1797
|
+
if (!(node.parent !== undefined && ts.isExportSpecifier(node.parent)) &&
|
|
1609
1798
|
checker.getSymbolAtLocation(node) === sym &&
|
|
1610
1799
|
!inTypePosition7(node) &&
|
|
1611
1800
|
!inDeferredPosition7(node)) {
|
|
1612
|
-
|
|
1613
|
-
return;
|
|
1801
|
+
return { name: bindingName.text, node };
|
|
1614
1802
|
}
|
|
1615
|
-
|
|
1616
|
-
};
|
|
1617
|
-
visit(sf);
|
|
1618
|
-
if (offence !== null)
|
|
1619
|
-
return offence;
|
|
1803
|
+
}
|
|
1620
1804
|
}
|
|
1621
1805
|
return null;
|
|
1622
1806
|
}
|
|
@@ -1687,6 +1871,30 @@ export function makeCycleAdmission(program, edgesOf) {
|
|
|
1687
1871
|
// reason the cluster's cycles stay fenced, or null when its every
|
|
1688
1872
|
// member passes the inert-top-level bar.
|
|
1689
1873
|
const sccVerdict = new Map();
|
|
1874
|
+
// A module can close many cycle edges, each importing many bindings.
|
|
1875
|
+
// Index its identifiers once for this admission pass. ASTs are immutable;
|
|
1876
|
+
// the pass owns the index so it cannot retain a disposed program.
|
|
1877
|
+
const bindingUses = new Map();
|
|
1878
|
+
const usesOf = (sf) => {
|
|
1879
|
+
const cached = bindingUses.get(sf);
|
|
1880
|
+
if (cached !== undefined)
|
|
1881
|
+
return cached;
|
|
1882
|
+
const uses = new Map();
|
|
1883
|
+
ts.walkPreorder(sf, (node) => {
|
|
1884
|
+
if (ts.isImportDeclaration(node))
|
|
1885
|
+
return "skip";
|
|
1886
|
+
if (ts.isIdentifier(node)) {
|
|
1887
|
+
const references = uses.get(node.text);
|
|
1888
|
+
if (references !== undefined)
|
|
1889
|
+
references.push(node);
|
|
1890
|
+
else
|
|
1891
|
+
uses.set(node.text, [node]);
|
|
1892
|
+
}
|
|
1893
|
+
return undefined;
|
|
1894
|
+
});
|
|
1895
|
+
bindingUses.set(sf, uses);
|
|
1896
|
+
return uses;
|
|
1897
|
+
};
|
|
1690
1898
|
return (importer, e) => {
|
|
1691
1899
|
if (e.stmt === undefined)
|
|
1692
1900
|
return "the cycle closes through a require() edge";
|
|
@@ -1710,7 +1918,7 @@ export function makeCycleAdmission(program, edgesOf) {
|
|
|
1710
1918
|
if (!sccVerdict.has(comp)) {
|
|
1711
1919
|
let reason = null;
|
|
1712
1920
|
for (const m of comp) {
|
|
1713
|
-
if (isCjsJsFile7(m)) {
|
|
1921
|
+
if (isCjsJsFile7(m, program)) {
|
|
1714
1922
|
reason = `${m.fileName} is a CommonJS module — admission covers ES-module cycles only`;
|
|
1715
1923
|
break;
|
|
1716
1924
|
}
|
|
@@ -1723,9 +1931,11 @@ export function makeCycleAdmission(program, edgesOf) {
|
|
|
1723
1931
|
sccVerdict.set(comp, reason);
|
|
1724
1932
|
}
|
|
1725
1933
|
const clusterReason = sccVerdict.get(comp);
|
|
1934
|
+
if (clusterReason === undefined)
|
|
1935
|
+
throw new Error("missing module-cycle verdict");
|
|
1726
1936
|
if (clusterReason !== null)
|
|
1727
1937
|
return clusterReason;
|
|
1728
|
-
const use = backEdgeUseOffence7(program,
|
|
1938
|
+
const use = backEdgeUseOffence7(program, e.stmt, usesOf(importer));
|
|
1729
1939
|
if (use !== null) {
|
|
1730
1940
|
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
1941
|
}
|
|
@@ -1736,18 +1946,20 @@ export function makeCycleAdmission(program, edgesOf) {
|
|
|
1736
1946
|
* program, or null (unresolvable / outside the program). Exported (as
|
|
1737
1947
|
* resolveImport) for the lowering: CommonJS require statements lower to
|
|
1738
1948
|
* guarded %init calls of exactly the module preflight resolved here. */
|
|
1739
|
-
function resolveImport7(program, from, specifier) {
|
|
1949
|
+
function resolveImport7(program, from, specifier, resolutionKind = "import") {
|
|
1740
1950
|
const resolved = resolveProjectModule(from.fileName, specifier);
|
|
1741
|
-
if (resolved
|
|
1742
|
-
return null;
|
|
1743
|
-
|
|
1951
|
+
if (resolved !== null)
|
|
1952
|
+
return program.getSourceFile(resolved) ?? null;
|
|
1953
|
+
const npm = resolveNpmImport7(from.fileName, specifier, resolutionKind);
|
|
1954
|
+
return npm && isNpmStaticPackage(npm.packageName)
|
|
1955
|
+
? npmStaticProgramDep(program, npm.packageName, npm.typesFile) : null;
|
|
1744
1956
|
}
|
|
1745
1957
|
/** An import that resolves into node_modules: the package's shipped .d.ts
|
|
1746
1958
|
* is the type surface, and the package's shipped JS runs in the dynamic
|
|
1747
1959
|
* island under --dynamic. Resolution rides the own resolver (resolve.ts).
|
|
1748
1960
|
* Null for relative and node: specifiers, and for anything that doesn't
|
|
1749
1961
|
* resolve into node_modules. */
|
|
1750
|
-
function resolveNpmImport7(fromFileName, specifier) {
|
|
1962
|
+
function resolveNpmImport7(fromFileName, specifier, resolutionKind = "import") {
|
|
1751
1963
|
if (isRelativeSpecifier(specifier) || specifier.startsWith("node:")) {
|
|
1752
1964
|
return null;
|
|
1753
1965
|
}
|
|
@@ -1756,7 +1968,7 @@ function resolveNpmImport7(fromFileName, specifier) {
|
|
|
1756
1968
|
// answers the entry), so no island embed and no .d.ts type surface.
|
|
1757
1969
|
if (provenanceEntryFor(specifier) !== null)
|
|
1758
1970
|
return null;
|
|
1759
|
-
const resolved = resolveBareModule(fromFileName, specifier);
|
|
1971
|
+
const resolved = resolveBareModule(fromFileName, specifier, undefined, resolutionKind);
|
|
1760
1972
|
if (!resolved)
|
|
1761
1973
|
return null;
|
|
1762
1974
|
if (!isNodeModulesPath(resolved.typesFile)) {
|
|
@@ -1831,24 +2043,16 @@ function processModuleAliasImport7(spec, stmt) {
|
|
|
1831
2043
|
return clause !== undefined && clause.name !== undefined && clause.namedBindings === undefined;
|
|
1832
2044
|
}
|
|
1833
2045
|
/** 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) });
|
|
2046
|
+
* host, build the lowering-world program, run preflight, and release its
|
|
2047
|
+
* snapshot. The caller owns the supplied host and can reuse or close it. */
|
|
2048
|
+
export function checkPreflightTs7(entryPath, host) {
|
|
2049
|
+
const load = loadProgram7(host, resolve(entryPath));
|
|
1839
2050
|
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
|
-
}
|
|
2051
|
+
const { diags, moduleOrder } = preflight7(load);
|
|
2052
|
+
return { diags, moduleOrder: moduleOrder.map((sf) => sf.fileName) };
|
|
1848
2053
|
}
|
|
1849
2054
|
finally {
|
|
1850
|
-
|
|
1851
|
-
host.close();
|
|
2055
|
+
load.disposeAll();
|
|
1852
2056
|
}
|
|
1853
2057
|
}
|
|
1854
2058
|
function preflight7(load) {
|
|
@@ -2062,6 +2266,8 @@ function preflight7(load) {
|
|
|
2062
2266
|
!npmStaticFileSuppressed(d) &&
|
|
2063
2267
|
!nodeModulesJsSuppressed(d) &&
|
|
2064
2268
|
!namespaceCalleeSuppressed(p, d) &&
|
|
2269
|
+
!inferredJsDiagnosticSuppressed(p, d) &&
|
|
2270
|
+
!isNpmStaticSubclassArgument(p, d) &&
|
|
2065
2271
|
!workspaceImplicitAnySuppressed(p, d) &&
|
|
2066
2272
|
!jsdocTypeSuppressed(p, d, commentDup));
|
|
2067
2273
|
};
|
|
@@ -2097,7 +2303,7 @@ function preflight7(load) {
|
|
|
2097
2303
|
(!isNodeModulesPath(sf.fileName) || entryPackageFile(sf.fileName) || npmStaticPackageOfPath(sf.fileName) !== null) &&
|
|
2098
2304
|
!islandJsFile(sf.fileName));
|
|
2099
2305
|
const userFiles = npmStaticActive()
|
|
2100
|
-
? planNpmStaticReexports(program, entry, programFiles, [...createRequireProgramRoots7(program), ...forkTargetPaths(program, program.getSourceFiles())], (sf, spec) => resolveImport7(program, sf, spec) ?? npmStaticDepSf7(program, sf, spec))
|
|
2306
|
+
? planNpmStaticReexports(program, entry, programFiles, [...createRequireProgramRoots7(program), ...forkTargetPaths(program, program.getSourceFiles())], (sf, spec, resolutionKind) => resolveImport7(program, sf, spec, resolutionKind) ?? npmStaticDepSf7(program, sf, spec, resolutionKind))
|
|
2101
2307
|
: programFiles;
|
|
2102
2308
|
program.getTypeChecker().prefetchSourceFileStructures(userFiles);
|
|
2103
2309
|
// node_modules JS that no --npm-static opt-in claims is NOT program
|
|
@@ -2121,7 +2327,7 @@ function preflight7(load) {
|
|
|
2121
2327
|
}
|
|
2122
2328
|
continue;
|
|
2123
2329
|
}
|
|
2124
|
-
if (!isNodeEsmFile7(sf)) {
|
|
2330
|
+
if (!isNodeEsmFile7(sf, program)) {
|
|
2125
2331
|
const marker = nodeEsmSyntaxMarker7(sf);
|
|
2126
2332
|
if (marker !== null)
|
|
2127
2333
|
diags.push(commonJsModuleSyntaxDiag(locOf7(marker)));
|
|
@@ -2259,7 +2465,7 @@ function preflight7(load) {
|
|
|
2259
2465
|
// RESOLVED user module lowers; everything else keeps the fence —
|
|
2260
2466
|
// there is no namespace object to materialize.
|
|
2261
2467
|
if (stmt.exportClause && ts.isNamespaceExport(stmt.exportClause)) {
|
|
2262
|
-
if (reDep === null || reDep.fileName.endsWith(".json") || isCjsJsFile7(reDep)) {
|
|
2468
|
+
if (reDep === null || reDep.fileName.endsWith(".json") || isCjsJsFile7(reDep, program)) {
|
|
2263
2469
|
diags.push(unsupportedDiag("SC1013", locOf7(stmt), "namespace re-exports (export * as ns) of this module form"));
|
|
2264
2470
|
continue;
|
|
2265
2471
|
}
|
|
@@ -2290,17 +2496,15 @@ function preflight7(load) {
|
|
|
2290
2496
|
}
|
|
2291
2497
|
const isRelative = isRelativeSpecifier(spec);
|
|
2292
2498
|
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.
|
|
2499
|
+
// Npm packages can use the same static createRequire forms as program
|
|
2500
|
+
// code. Preserve fallback for bundler banners that pass the require
|
|
2501
|
+
// value around or feed it computed specifiers during initialization.
|
|
2300
2502
|
if (canonicalBuiltinModule(spec) === "module") {
|
|
2301
2503
|
const pkg = npmStaticPackageOfPath(sf.fileName);
|
|
2302
2504
|
if (pkg !== null) {
|
|
2303
|
-
|
|
2505
|
+
const reason = npmStaticModuleImportReason7(program, stmt);
|
|
2506
|
+
if (reason !== null)
|
|
2507
|
+
reportNpmStaticOffender(pkg, reason);
|
|
2304
2508
|
}
|
|
2305
2509
|
}
|
|
2306
2510
|
// An import edge Node's own resolution refuses BEFORE any module
|
|
@@ -2452,7 +2656,7 @@ function preflight7(load) {
|
|
|
2452
2656
|
if (isJson) {
|
|
2453
2657
|
diags.push(unsupportedDiag("SC1013", locOf7(clause.namedBindings), "namespace imports of JSON modules"));
|
|
2454
2658
|
}
|
|
2455
|
-
else if (dep !== null && isCjsJsFile7(dep)) {
|
|
2659
|
+
else if (dep !== null && isCjsJsFile7(dep, program)) {
|
|
2456
2660
|
// A CJS namespace binding whose every use is a bare expression
|
|
2457
2661
|
// statement (`cjs;` — the corpus's "the import linked"
|
|
2458
2662
|
// assertion) carries no surface question: the statement lowers
|
|
@@ -2494,7 +2698,7 @@ function preflight7(load) {
|
|
|
2494
2698
|
// files keep the full CommonJS scan.
|
|
2495
2699
|
if (!jsRequireFile && bindingKind !== "createRequire")
|
|
2496
2700
|
continue;
|
|
2497
|
-
if (isNodeEsmFile7(sf)) {
|
|
2701
|
+
if (isNodeEsmFile7(sf, program)) {
|
|
2498
2702
|
if (bindingKind !== "createRequire") {
|
|
2499
2703
|
diags.push(unsupportedDiag("SC1013", loc, esmRequireFeature7(bindingKind)));
|
|
2500
2704
|
continue;
|
|
@@ -2515,14 +2719,14 @@ function preflight7(load) {
|
|
|
2515
2719
|
}
|
|
2516
2720
|
}
|
|
2517
2721
|
const isRelative = isRelativeSpecifier(req.spec);
|
|
2518
|
-
let dep = resolveImport7(program, sf, req.spec);
|
|
2722
|
+
let dep = resolveImport7(program, sf, req.spec, "require");
|
|
2519
2723
|
if (dep === null && !isRelative) {
|
|
2520
2724
|
// --npm-static: a require() of an OPTED-IN package is a
|
|
2521
2725
|
// program-module edge exactly like the import-declaration
|
|
2522
2726
|
// form above (bundle dists require their workspace siblings —
|
|
2523
2727
|
// the same resolution, the same offender discipline on a
|
|
2524
2728
|
// miss).
|
|
2525
|
-
const npmReq = !req.spec.startsWith("#") ? resolveNpmImport7(sf.fileName, req.spec) : null;
|
|
2729
|
+
const npmReq = !req.spec.startsWith("#") ? resolveNpmImport7(sf.fileName, req.spec, "require") : null;
|
|
2526
2730
|
if (npmReq !== null && isNpmStaticPackage(npmReq.packageName)) {
|
|
2527
2731
|
dep = npmStaticProgramDep(program, npmReq.packageName, npmReq.typesFile);
|
|
2528
2732
|
if (dep === null)
|
|
@@ -2566,7 +2770,7 @@ function preflight7(load) {
|
|
|
2566
2770
|
const prefixCanRun = (firstRunnable >= 0 && firstRunnable < k) ||
|
|
2567
2771
|
precedingDecls.some((decl) => !purePrefixDecl7(decl));
|
|
2568
2772
|
const tdzName = prefixCanRun && req.decl
|
|
2569
|
-
?
|
|
2773
|
+
? bindingEarlyUse7(program, sf, k, req.decl, precedingDecls)
|
|
2570
2774
|
: null;
|
|
2571
2775
|
if (tdzName !== null) {
|
|
2572
2776
|
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 +2788,7 @@ function preflight7(load) {
|
|
|
2584
2788
|
const bindingKind = requireCallBindingKind7(program, call);
|
|
2585
2789
|
if (!jsRequireFile && bindingKind !== "createRequire")
|
|
2586
2790
|
continue;
|
|
2587
|
-
if (isNodeEsmFile7(sf)) {
|
|
2791
|
+
if (isNodeEsmFile7(sf, program)) {
|
|
2588
2792
|
if (bindingKind !== "createRequire") {
|
|
2589
2793
|
diags.push(unsupportedDiag("SC1013", loc, esmRequireFeature7(bindingKind)));
|
|
2590
2794
|
continue;
|
|
@@ -2593,7 +2797,7 @@ function preflight7(load) {
|
|
|
2593
2797
|
if (load.externalTypes.has(spec)) {
|
|
2594
2798
|
continue;
|
|
2595
2799
|
}
|
|
2596
|
-
const projectDep = resolveImport7(program, sf, spec);
|
|
2800
|
+
const projectDep = resolveImport7(program, sf, spec, "require");
|
|
2597
2801
|
if (projectDep !== null) {
|
|
2598
2802
|
if (projectDep.fileName.endsWith(".json")) {
|
|
2599
2803
|
if (bindingKind === "createRequire")
|
|
@@ -2607,7 +2811,7 @@ function preflight7(load) {
|
|
|
2607
2811
|
if (!isRelativeSpecifier(spec)) {
|
|
2608
2812
|
// --npm-static: opted-in packages ride the program-module edge
|
|
2609
2813
|
// (the statement-level require branch above).
|
|
2610
|
-
const npmReq = !spec.startsWith("#") ? resolveNpmImport7(sf.fileName, spec) : null;
|
|
2814
|
+
const npmReq = !spec.startsWith("#") ? resolveNpmImport7(sf.fileName, spec, "require") : null;
|
|
2611
2815
|
if (npmReq !== null && isNpmStaticPackage(npmReq.packageName)) {
|
|
2612
2816
|
const nDep = npmStaticProgramDep(program, npmReq.packageName, npmReq.typesFile);
|
|
2613
2817
|
if (nDep !== null)
|
|
@@ -2756,19 +2960,19 @@ function cjsNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
2756
2960
|
// Reexport targets union in only when they resolve to CommonJS program
|
|
2757
2961
|
// files (Node's cjsPreparseModuleExports rule).
|
|
2758
2962
|
const resolveCjsDep = (from, spec) => {
|
|
2759
|
-
const dep =
|
|
2760
|
-
return dep !== null && isCjsJsFile7(dep) ? dep : null;
|
|
2963
|
+
const dep = resolveImport7(program, from, spec, "require") ?? npmStaticDepSf7(program, from, spec, "require");
|
|
2964
|
+
return dep !== null && isCjsJsFile7(dep, program) ? dep : null;
|
|
2761
2965
|
};
|
|
2762
2966
|
const visible = (dep, name) =>
|
|
2763
2967
|
// `default` is the module.exports binding itself — always provided.
|
|
2764
|
-
//
|
|
2765
|
-
//
|
|
2766
|
-
name === "default" ||
|
|
2968
|
+
// The program already owns native source ASTs; reuse them without
|
|
2969
|
+
// starting another syntax session or reparsing their source text.
|
|
2970
|
+
name === "default" || cjsVisibleNames(dep, cjsLexedExportsOfFile, resolveCjsDep, lexMemo).has(name);
|
|
2767
2971
|
/** The statement's resolved LOCAL CommonJS dependency, when it is an
|
|
2768
2972
|
* import/re-export from one. */
|
|
2769
2973
|
const cjsDepOf = (sf, spec) => {
|
|
2770
2974
|
const dep = resolveEdge(sf, spec);
|
|
2771
|
-
return dep !== null && isCjsJsFile7(dep) ? dep : null;
|
|
2975
|
+
return dep !== null && isCjsJsFile7(dep, program) ? dep : null;
|
|
2772
2976
|
};
|
|
2773
2977
|
/** The first lexer-invisible CJS name request of ONE module, in V8's
|
|
2774
2978
|
* check order: all regular named imports sorted by local binding name,
|
|
@@ -2841,7 +3045,7 @@ function cjsNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
2841
3045
|
continue;
|
|
2842
3046
|
const spec = specNode.text;
|
|
2843
3047
|
const dep = resolveEdge(sf, spec);
|
|
2844
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3048
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
2845
3049
|
continue;
|
|
2846
3050
|
const bad = dfs(dep);
|
|
2847
3051
|
if (bad !== null)
|
|
@@ -2849,12 +3053,12 @@ function cjsNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
2849
3053
|
}
|
|
2850
3054
|
return firstInvisibleOf(sf);
|
|
2851
3055
|
};
|
|
2852
|
-
const bad = isNodeEsmFile7(entry) ? dfs(entry) : null;
|
|
3056
|
+
const bad = isNodeEsmFile7(entry, program) ? dfs(entry) : null;
|
|
2853
3057
|
// ESM modules only require() reaches: same invisibility, but Node's
|
|
2854
3058
|
// SyntaxError fires mid-evaluation at the require — a pointed fence
|
|
2855
3059
|
// instead of a mismodeled crash position.
|
|
2856
3060
|
for (const sf of moduleOrder) {
|
|
2857
|
-
if (!isNodeEsmFile7(sf) || visited.has(sf))
|
|
3061
|
+
if (!isNodeEsmFile7(sf, program) || visited.has(sf))
|
|
2858
3062
|
continue;
|
|
2859
3063
|
const b = firstInvisibleOf(sf);
|
|
2860
3064
|
if (b !== null) {
|
|
@@ -2970,7 +3174,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
2970
3174
|
if (stmt.moduleSpecifier === undefined || !ts.isStringLiteral(stmt.moduleSpecifier))
|
|
2971
3175
|
continue;
|
|
2972
3176
|
const target = resolveEdge(dep, stmt.moduleSpecifier.text);
|
|
2973
|
-
if (target === null || target.fileName.endsWith(".json") || !isNodeEsmFile7(target))
|
|
3177
|
+
if (target === null || target.fileName.endsWith(".json") || !isNodeEsmFile7(target, program))
|
|
2974
3178
|
continue;
|
|
2975
3179
|
const candidate = runtimeExport(target, name, nextSeen);
|
|
2976
3180
|
if (candidate === undefined)
|
|
@@ -2991,7 +3195,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
2991
3195
|
continue;
|
|
2992
3196
|
const spec = stmt.moduleSpecifier.text;
|
|
2993
3197
|
const dep = resolveEdge(sf, spec);
|
|
2994
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3198
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
2995
3199
|
continue;
|
|
2996
3200
|
if (clause.name !== undefined) {
|
|
2997
3201
|
imports.push({ local: clause.name.text, exportName: "default", spec, nameNode: clause.name, dep });
|
|
@@ -3036,7 +3240,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
3036
3240
|
continue;
|
|
3037
3241
|
const spec = moduleSpecifier.text;
|
|
3038
3242
|
const dep = resolveEdge(sf, spec);
|
|
3039
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3243
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
3040
3244
|
continue;
|
|
3041
3245
|
for (const element of exportClause.elements) {
|
|
3042
3246
|
if (element.isTypeOnly)
|
|
@@ -3068,7 +3272,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
3068
3272
|
if (moduleSpecifier === undefined || !ts.isStringLiteral(moduleSpecifier))
|
|
3069
3273
|
continue;
|
|
3070
3274
|
const dep = resolveEdge(sf, moduleSpecifier.text);
|
|
3071
|
-
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep))
|
|
3275
|
+
if (dep === null || dep.fileName.endsWith(".json") || !isNodeEsmFile7(dep, program))
|
|
3072
3276
|
continue;
|
|
3073
3277
|
const bad = dfs(dep);
|
|
3074
3278
|
if (bad !== null)
|
|
@@ -3079,7 +3283,7 @@ function analyzeEsmNamedImportLinks(program, entry) {
|
|
|
3079
3283
|
// Native ESM linking itself starts only from an ESM entry. The caller
|
|
3080
3284
|
// supplies dynamic-only roots here too; each such root gets its own
|
|
3081
3285
|
// promise rejection rather than a startup crash.
|
|
3082
|
-
const bad = isNodeEsmFile7(entry) ? dfs(entry) : null;
|
|
3286
|
+
const bad = isNodeEsmFile7(entry, program) ? dfs(entry) : null;
|
|
3083
3287
|
if (bad !== null) {
|
|
3084
3288
|
return {
|
|
3085
3289
|
crash: {
|
|
@@ -3106,7 +3310,7 @@ function esmNamedImportLinkCheck(program, entry, moduleOrder, diags) {
|
|
|
3106
3310
|
// before earlier output). Keep the compile-time fence used by the CJS link
|
|
3107
3311
|
// checker for the analogous mid-evaluation failure instead.
|
|
3108
3312
|
for (const sf of moduleOrder) {
|
|
3109
|
-
if (!isNodeEsmFile7(sf) || analysis.visited.has(sf))
|
|
3313
|
+
if (!isNodeEsmFile7(sf, program) || analysis.visited.has(sf))
|
|
3110
3314
|
continue;
|
|
3111
3315
|
const childFailure = analysis.firstMissingOf(sf);
|
|
3112
3316
|
if (childFailure !== null) {
|
|
@@ -3274,12 +3478,12 @@ export function orderedImportsOf(program, sf) {
|
|
|
3274
3478
|
* as a module edge), else null. No offender reporting here — preflight
|
|
3275
3479
|
* already classified the import; this is the lookup the module-order and
|
|
3276
3480
|
* lowering paths share. */
|
|
3277
|
-
export function npmStaticDepSf7(program, sf, spec) {
|
|
3481
|
+
export function npmStaticDepSf7(program, sf, spec, resolutionKind = "import") {
|
|
3278
3482
|
if (!npmStaticActive() || isRelativeSpecifier(spec))
|
|
3279
3483
|
return null;
|
|
3280
3484
|
if (spec.startsWith("node:") || spec.startsWith("#"))
|
|
3281
3485
|
return null;
|
|
3282
|
-
const npm = resolveNpmImport7(sf.fileName, spec);
|
|
3486
|
+
const npm = resolveNpmImport7(sf.fileName, spec, resolutionKind);
|
|
3283
3487
|
if (npm === null || !isNpmStaticPackage(npm.packageName))
|
|
3284
3488
|
return null;
|
|
3285
3489
|
if (!isJsSourceFileName(npm.typesFile))
|