@loopdive/js2 0.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (233) hide show
  1. package/CHANGELOG.md +1425 -0
  2. package/LICENSE +189 -0
  3. package/README.md +451 -0
  4. package/dist/checker/index.d.ts +117 -0
  5. package/dist/checker/language-service.d.ts +39 -0
  6. package/dist/checker/node-capability-map.d.ts +63 -0
  7. package/dist/checker/type-mapper.d.ts +84 -0
  8. package/dist/cjs-rewrite.d.ts +19 -0
  9. package/dist/cli.d.ts +2 -0
  10. package/dist/cli.js +363 -0
  11. package/dist/codegen/accessor-driver.d.ts +97 -0
  12. package/dist/codegen/any-helpers.d.ts +72 -0
  13. package/dist/codegen/array-element-typing.d.ts +46 -0
  14. package/dist/codegen/array-holes.d.ts +69 -0
  15. package/dist/codegen/array-methods.d.ts +68 -0
  16. package/dist/codegen/array-object-proto.d.ts +64 -0
  17. package/dist/codegen/array-reduce-fusion.d.ts +31 -0
  18. package/dist/codegen/array-to-primitive.d.ts +28 -0
  19. package/dist/codegen/async-cps.d.ts +239 -0
  20. package/dist/codegen/async-scheduler.d.ts +349 -0
  21. package/dist/codegen/binary-ops.d.ts +78 -0
  22. package/dist/codegen/binding-info.d.ts +31 -0
  23. package/dist/codegen/builtin-scaffold.d.ts +98 -0
  24. package/dist/codegen/builtin-static-globals.d.ts +8 -0
  25. package/dist/codegen/builtin-tags.d.ts +189 -0
  26. package/dist/codegen/case-convert-native.d.ts +12 -0
  27. package/dist/codegen/case-tables.d.ts +4 -0
  28. package/dist/codegen/class-bodies.d.ts +41 -0
  29. package/dist/codegen/class-member-keys.d.ts +33 -0
  30. package/dist/codegen/class-to-primitive.d.ts +39 -0
  31. package/dist/codegen/closed-method-dispatch.d.ts +42 -0
  32. package/dist/codegen/closures.d.ts +285 -0
  33. package/dist/codegen/coercion-engine.d.ts +154 -0
  34. package/dist/codegen/coercion-plan.d.ts +29 -0
  35. package/dist/codegen/context/bodies.d.ts +4 -0
  36. package/dist/codegen/context/create-context.d.ts +4 -0
  37. package/dist/codegen/context/errors.d.ts +39 -0
  38. package/dist/codegen/context/locals.d.ts +69 -0
  39. package/dist/codegen/context/source-pos.d.ts +5 -0
  40. package/dist/codegen/context/speculative.d.ts +95 -0
  41. package/dist/codegen/context/types.d.ts +1936 -0
  42. package/dist/codegen/custom-iterable.d.ts +34 -0
  43. package/dist/codegen/dataview-native.d.ts +51 -0
  44. package/dist/codegen/date-parse-native.d.ts +13 -0
  45. package/dist/codegen/dead-elimination.d.ts +26 -0
  46. package/dist/codegen/declarations.d.ts +147 -0
  47. package/dist/codegen/deno-api.d.ts +11 -0
  48. package/dist/codegen/destructuring-params.d.ts +102 -0
  49. package/dist/codegen/dyn-read.d.ts +26 -0
  50. package/dist/codegen/eval-tiering.d.ts +19 -0
  51. package/dist/codegen/expressions/assignment.d.ts +61 -0
  52. package/dist/codegen/expressions/builtins.d.ts +26 -0
  53. package/dist/codegen/expressions/calls-closures.d.ts +54 -0
  54. package/dist/codegen/expressions/calls-guards.d.ts +49 -0
  55. package/dist/codegen/expressions/calls-optional.d.ts +4 -0
  56. package/dist/codegen/expressions/calls.d.ts +83 -0
  57. package/dist/codegen/expressions/eval-inline.d.ts +24 -0
  58. package/dist/codegen/expressions/extern.d.ts +67 -0
  59. package/dist/codegen/expressions/fnctor-prototype.d.ts +52 -0
  60. package/dist/codegen/expressions/helpers.d.ts +212 -0
  61. package/dist/codegen/expressions/identifiers.d.ts +57 -0
  62. package/dist/codegen/expressions/late-imports.d.ts +81 -0
  63. package/dist/codegen/expressions/logical-ops.d.ts +18 -0
  64. package/dist/codegen/expressions/misc.d.ts +27 -0
  65. package/dist/codegen/expressions/new-super.d.ts +25 -0
  66. package/dist/codegen/expressions/promise-subclass.d.ts +38 -0
  67. package/dist/codegen/expressions/proto-override.d.ts +63 -0
  68. package/dist/codegen/expressions/unary-updates.d.ts +21 -0
  69. package/dist/codegen/expressions/unary.d.ts +6 -0
  70. package/dist/codegen/expressions.d.ts +31 -0
  71. package/dist/codegen/fallback-telemetry.d.ts +53 -0
  72. package/dist/codegen/fixups.d.ts +80 -0
  73. package/dist/codegen/fmod.d.ts +10 -0
  74. package/dist/codegen/fnctor-escape-gate.d.ts +92 -0
  75. package/dist/codegen/function-body.d.ts +52 -0
  76. package/dist/codegen/generators-native.d.ts +92 -0
  77. package/dist/codegen/helpers/body-references-own-this.d.ts +22 -0
  78. package/dist/codegen/helpers/body-uses-arguments.d.ts +12 -0
  79. package/dist/codegen/helpers/is-strict-function.d.ts +52 -0
  80. package/dist/codegen/host-import-allowlist.d.ts +140 -0
  81. package/dist/codegen/index.d.ts +500 -0
  82. package/dist/codegen/ir-tail-call.d.ts +8 -0
  83. package/dist/codegen/iterator-native.d.ts +44 -0
  84. package/dist/codegen/json-codec-native.d.ts +78 -0
  85. package/dist/codegen/json-runtime.d.ts +35 -0
  86. package/dist/codegen/json-standalone.d.ts +25 -0
  87. package/dist/codegen/linear-uint8-analysis.d.ts +46 -0
  88. package/dist/codegen/linear-uint8-arena.d.ts +7 -0
  89. package/dist/codegen/linear-uint8-codegen.d.ts +103 -0
  90. package/dist/codegen/linear-uint8-signatures.d.ts +26 -0
  91. package/dist/codegen/literals.d.ts +115 -0
  92. package/dist/codegen/map-runtime.d.ts +142 -0
  93. package/dist/codegen/math-helpers.d.ts +7 -0
  94. package/dist/codegen/member-get-dispatch.d.ts +42 -0
  95. package/dist/codegen/member-set-dispatch.d.ts +28 -0
  96. package/dist/codegen/native-proto.d.ts +98 -0
  97. package/dist/codegen/native-regex.d.ts +158 -0
  98. package/dist/codegen/native-strings.d.ts +146 -0
  99. package/dist/codegen/new-target.d.ts +30 -0
  100. package/dist/codegen/node-fs-api.d.ts +47 -0
  101. package/dist/codegen/number-format-native.d.ts +9 -0
  102. package/dist/codegen/number-ryu.d.ts +27 -0
  103. package/dist/codegen/object-ops.d.ts +94 -0
  104. package/dist/codegen/object-runtime.d.ts +171 -0
  105. package/dist/codegen/parse-number-native.d.ts +10 -0
  106. package/dist/codegen/peephole.d.ts +6 -0
  107. package/dist/codegen/property-access.d.ts +294 -0
  108. package/dist/codegen/raw-wasi-api.d.ts +13 -0
  109. package/dist/codegen/regex/bytecode.d.ts +140 -0
  110. package/dist/codegen/regex/casefold.d.ts +41 -0
  111. package/dist/codegen/regex/compile.d.ts +51 -0
  112. package/dist/codegen/regex/parse.d.ts +76 -0
  113. package/dist/codegen/regex/unicode.d.ts +42 -0
  114. package/dist/codegen/regex/vm.d.ts +24 -0
  115. package/dist/codegen/regexp-standalone.d.ts +350 -0
  116. package/dist/codegen/registry/error-types.d.ts +38 -0
  117. package/dist/codegen/registry/imports.d.ts +46 -0
  118. package/dist/codegen/registry/types.d.ts +59 -0
  119. package/dist/codegen/set-algebra.d.ts +17 -0
  120. package/dist/codegen/set-runtime.d.ts +74 -0
  121. package/dist/codegen/shared.d.ts +111 -0
  122. package/dist/codegen/stack-balance.d.ts +43 -0
  123. package/dist/codegen/statements/control-flow.d.ts +25 -0
  124. package/dist/codegen/statements/destructuring.d.ts +177 -0
  125. package/dist/codegen/statements/exceptions.d.ts +11 -0
  126. package/dist/codegen/statements/functions.d.ts +1 -0
  127. package/dist/codegen/statements/index.d.ts +1 -0
  128. package/dist/codegen/statements/loops.d.ts +7 -0
  129. package/dist/codegen/statements/nested-declarations.d.ts +78 -0
  130. package/dist/codegen/statements/shared.d.ts +38 -0
  131. package/dist/codegen/statements/tdz.d.ts +43 -0
  132. package/dist/codegen/statements/variables.d.ts +3 -0
  133. package/dist/codegen/statements.d.ts +9 -0
  134. package/dist/codegen/string-builder.d.ts +131 -0
  135. package/dist/codegen/string-ops.d.ts +87 -0
  136. package/dist/codegen/struct-accessor-closure.d.ts +36 -0
  137. package/dist/codegen/symbol-native.d.ts +55 -0
  138. package/dist/codegen/temporal-native.d.ts +8 -0
  139. package/dist/codegen/timsort.d.ts +2 -0
  140. package/dist/codegen/type-coercion.d.ts +123 -0
  141. package/dist/codegen/typeof-delete.d.ts +38 -0
  142. package/dist/codegen/uri-encoding-native.d.ts +33 -0
  143. package/dist/codegen/value-tags.d.ts +74 -0
  144. package/dist/codegen/walk-instructions.d.ts +20 -0
  145. package/dist/codegen/weak-collections-runtime.d.ts +16 -0
  146. package/dist/codegen/with-scope.d.ts +106 -0
  147. package/dist/codegen-linear/c-abi.d.ts +74 -0
  148. package/dist/codegen-linear/context.d.ts +86 -0
  149. package/dist/codegen-linear/index.d.ts +28 -0
  150. package/dist/codegen-linear/layout.d.ts +39 -0
  151. package/dist/codegen-linear/runtime.d.ts +161 -0
  152. package/dist/codegen-linear/simd.d.ts +7 -0
  153. package/dist/compiler/define-substitution.d.ts +27 -0
  154. package/dist/compiler/early-errors/assignment.d.ts +26 -0
  155. package/dist/compiler/early-errors/context.d.ts +17 -0
  156. package/dist/compiler/early-errors/duplicates.d.ts +20 -0
  157. package/dist/compiler/early-errors/index.d.ts +11 -0
  158. package/dist/compiler/early-errors/labels.d.ts +13 -0
  159. package/dist/compiler/early-errors/module-rules.d.ts +36 -0
  160. package/dist/compiler/early-errors/node-checks.d.ts +7 -0
  161. package/dist/compiler/early-errors/predicates.d.ts +140 -0
  162. package/dist/compiler/early-errors/tdz.d.ts +17 -0
  163. package/dist/compiler/import-manifest.d.ts +18 -0
  164. package/dist/compiler/output.d.ts +46 -0
  165. package/dist/compiler/validation.d.ts +45 -0
  166. package/dist/compiler.d.ts +48 -0
  167. package/dist/define-substitution-BcUeKC2A.js +109 -0
  168. package/dist/emit/binary.d.ts +50 -0
  169. package/dist/emit/c-header.d.ts +23 -0
  170. package/dist/emit/canonical-recgroup.d.ts +86 -0
  171. package/dist/emit/encoder.d.ts +28 -0
  172. package/dist/emit/object.d.ts +14 -0
  173. package/dist/emit/opcodes.d.ts +464 -0
  174. package/dist/emit/sourcemap.d.ts +33 -0
  175. package/dist/emit/wat.d.ts +6 -0
  176. package/dist/env.d.ts +46 -0
  177. package/dist/import-resolver.d.ts +68 -0
  178. package/dist/index.d.ts +486 -0
  179. package/dist/index.js +755 -0
  180. package/dist/ir/alloc-registry.d.ts +75 -0
  181. package/dist/ir/analysis/encoding.d.ts +38 -0
  182. package/dist/ir/analysis/escape.d.ts +32 -0
  183. package/dist/ir/analysis/lattice.d.ts +72 -0
  184. package/dist/ir/analysis/ownership.d.ts +31 -0
  185. package/dist/ir/analysis/stack-alloc.d.ts +20 -0
  186. package/dist/ir/backend/bytecode-emitter.d.ts +237 -0
  187. package/dist/ir/backend/bytecode-vm.d.ts +74 -0
  188. package/dist/ir/backend/emitter.d.ts +121 -0
  189. package/dist/ir/backend/handles.d.ts +133 -0
  190. package/dist/ir/backend/legality.d.ts +9 -0
  191. package/dist/ir/backend/linear-emitter.d.ts +41 -0
  192. package/dist/ir/backend/wasmgc-emitter.d.ts +43 -0
  193. package/dist/ir/builder.d.ts +401 -0
  194. package/dist/ir/from-ast.d.ts +192 -0
  195. package/dist/ir/index.d.ts +16 -0
  196. package/dist/ir/integration.d.ts +27 -0
  197. package/dist/ir/lower.d.ts +203 -0
  198. package/dist/ir/nodes.d.ts +1452 -0
  199. package/dist/ir/passes/alloc-discipline.d.ts +19 -0
  200. package/dist/ir/passes/constant-fold.d.ts +7 -0
  201. package/dist/ir/passes/dead-code.d.ts +18 -0
  202. package/dist/ir/passes/inline-small.d.ts +7 -0
  203. package/dist/ir/passes/monomorphize.d.ts +21 -0
  204. package/dist/ir/passes/simplify-cfg.d.ts +19 -0
  205. package/dist/ir/passes/tagged-union-types.d.ts +45 -0
  206. package/dist/ir/passes/tagged-unions.d.ts +22 -0
  207. package/dist/ir/propagate.d.ts +135 -0
  208. package/dist/ir/select.d.ts +81 -0
  209. package/dist/ir/types.d.ts +832 -0
  210. package/dist/ir/verify-alloc.d.ts +18 -0
  211. package/dist/ir/verify.d.ts +7 -0
  212. package/dist/link/index.d.ts +11 -0
  213. package/dist/link/isolation.d.ts +24 -0
  214. package/dist/link/linker.d.ts +37 -0
  215. package/dist/link/reader.d.ts +158 -0
  216. package/dist/link/resolver.d.ts +19 -0
  217. package/dist/optimize.d.ts +54 -0
  218. package/dist/optimize.js +262 -0
  219. package/dist/position-map.d.ts +64 -0
  220. package/dist/process-stdin-prelude.d.ts +16 -0
  221. package/dist/resolve.d.ts +82 -0
  222. package/dist/runtime/builtins.d.ts +1 -0
  223. package/dist/runtime-C-4q_KwU.js +164438 -0
  224. package/dist/runtime-containment.d.ts +6 -0
  225. package/dist/runtime-eval.d.ts +132 -0
  226. package/dist/runtime-instantiate.d.ts +16 -0
  227. package/dist/runtime.d.ts +128 -0
  228. package/dist/runtime.js +12 -0
  229. package/dist/shape-inference.d.ts +20 -0
  230. package/dist/treeshake.d.ts +17 -0
  231. package/dist/ts-api.d.ts +30 -0
  232. package/dist/wit-generator.d.ts +18 -0
  233. package/package.json +187 -0
@@ -0,0 +1,52 @@
1
+ import { ts } from '../../ts-api.js';
2
+ /**
3
+ * Decide whether `fn`'s body is strict-mode code (ECMA-262 §11.2.2).
4
+ *
5
+ * Strict applies when any of these hold:
6
+ * - the function body itself opens with a `"use strict"` directive,
7
+ * - an enclosing function body or the SourceFile opens with `"use strict"`,
8
+ * - the function is a class element or lives anywhere inside a class
9
+ * (ClassDeclaration / ClassExpression bodies are always strict).
10
+ *
11
+ * ES-module strictness (§11.2.2: Module code is always strict) IS inferred when
12
+ * `inferModuleStrict` is true (the default) — from the **genuine** module signal
13
+ * `externalModuleIndicator` (set by TypeScript when the source has a top-level
14
+ * `import`/`export`), or an ESM `impliedNodeFormat`. Real module input (TS/ES
15
+ * modules — the product's actual input) thus gets an unmapped `arguments`
16
+ * object (#2119).
17
+ *
18
+ * CAVEAT — the synthetic test wrapper. The test262 harness's `wrapTest` injects
19
+ * a top-level `export function test()` entry point, which makes TypeScript flag
20
+ * *every* wrapped source as a module (`externalModuleIndicator` is set even for
21
+ * a sloppy `noStrict` script). Inferring module-strictness from that synthetic
22
+ * export would wrongly unmap `arguments` for the 14 `language/arguments-object/
23
+ * mapped/*` (and async/yield `noStrict`) tests that assert *mapped* behaviour.
24
+ * So the harness passes `inferModuleStrict=false` for non-module-goal (script)
25
+ * tests, and leaves it true for genuine module tests. With the flag false this
26
+ * function ignores the module signal and the source's true sloppy strictness is
27
+ * honoured. `"use strict"` prologues and class context still force strict.
28
+ *
29
+ * This drives the mapped-vs-unmapped `arguments` split: strict functions get
30
+ * an *unmapped* arguments object, so writes to `arguments[i]` must not flow
31
+ * back into the named parameter (#779e).
32
+ */
33
+ export declare function isStrictFunction(fn: ts.FunctionLikeDeclaration, inferModuleStrict?: boolean): boolean;
34
+ /**
35
+ * (#2743) IsSimpleParameterList (ECMA-262 §15.1.3). A FormalParameters list is
36
+ * "simple" iff every element is a plain `BindingIdentifier` with no default
37
+ * initializer — i.e. it contains NO rest element, NO defaulted parameter, and
38
+ * NO destructuring (binding-pattern) parameter.
39
+ *
40
+ * This drives the mapped-vs-unmapped `arguments` split in
41
+ * FunctionDeclarationInstantiation (§10.2.11 step 22.a): the arguments object is
42
+ * *unmapped* when the function is strict OR its parameter list is non-simple.
43
+ * A non-simple list must therefore NOT install `mappedArgsInfo`, so a write to
44
+ * `arguments[i]` does not flow back into the named parameter (and the mapped
45
+ * write-back's `local.set` — which the rest/default param local shapes can't
46
+ * satisfy — is never emitted).
47
+ *
48
+ * A TypeScript `this` parameter (`function f(this: T, ...)`) is a plain
49
+ * identifier with no initializer/rest, so it does not make the list non-simple;
50
+ * it is erased before lowering and the call sites skip it via `paramOffset`.
51
+ */
52
+ export declare function isSimpleParameterList(params: readonly ts.ParameterDeclaration[]): boolean;
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Allowlist of host imports tolerated under `--no-host-imports` / strict WASI
3
+ * mode (#1524).
4
+ *
5
+ * Strict mode is the gate that enforces the **dual-mode** architectural
6
+ * principle documented in `CLAUDE.md`: every user-facing feature should have
7
+ * a Wasm-native path that does NOT depend on a JS runtime. JS-host imports
8
+ * are an opt-in fast path when a host is available, not the default.
9
+ *
10
+ * Each entry on the allowlist is a host import that codegen still emits
11
+ * during the dual-mode migration. The entry MUST name the tracking issue
12
+ * that owns the Wasm-native replacement — once that work lands, the entry is
13
+ * removed and strict-mode builds reject the import entirely.
14
+ *
15
+ * The CI gate forbids adding entries to this list without explicit sign-off:
16
+ * a marker in the PR description (`[allowlist-grow]`) or a CODEOWNERS review
17
+ * on this file is required. The accompanying budget test
18
+ * (`tests/host-import-allowlist-budget.test.ts`) fails if the list grows
19
+ * beyond `HOST_IMPORT_ALLOWLIST_BASELINE_SIZE`.
20
+ *
21
+ * Modules besides `env`:
22
+ * - `wasi_snapshot_preview1` — always allowed; this is the canonical
23
+ * WASI ABI, not a JS-host import.
24
+ * - `wasm:js-string` — host string builtins from the proposed `wasm:js-string`
25
+ * import-namespace standard. Permitted only when the runtime is known to
26
+ * provide them (i.e. NOT in WASI / nativeStrings mode — strict mode flips
27
+ * nativeStrings ON automatically, so these should never be requested).
28
+ * - `string_constants` — `wasm:js-string` constant pool; same constraint.
29
+ *
30
+ * Anything in the `env` module is, by definition, a JS-host import. The
31
+ * allowlist below enumerates which ones we still tolerate during the
32
+ * transition. Use `kind === "prefix"` for parameterised import names (e.g.
33
+ * `Math_sin`, `console_log_number`, extern-class methods).
34
+ */
35
+ /** Modules other than `env` whose imports are not JS-host bindings and are always allowed. */
36
+ export declare const ALWAYS_ALLOWED_IMPORT_MODULES: ReadonlySet<string>;
37
+ export interface HostImportAllowlistEntry {
38
+ /** Match kind. `exact` matches the import name literally; `prefix` matches a name beginning with the pattern. */
39
+ kind: "exact" | "prefix";
40
+ /** Import name (exact) or prefix (when kind === "prefix"). */
41
+ name: string;
42
+ /** Wasm signature description for documentation (e.g. "(externref) -> i32"). Optional. */
43
+ signature?: string;
44
+ /** Tracking issue that owns the Wasm-native replacement. 0 = no specific issue yet. */
45
+ trackingIssue: number;
46
+ /** One-line rationale for keeping this host import during the transition. */
47
+ reason: string;
48
+ }
49
+ /**
50
+ * Baseline host-import allowlist for `env` module imports under strict mode.
51
+ *
52
+ * Grouped by the tracking issue that will retire them. Order is informational
53
+ * — `HOST_IMPORT_ALLOWLIST_BASELINE_SIZE` below is the budget the CI gate
54
+ * compares against.
55
+ */
56
+ export declare const HOST_IMPORT_ALLOWLIST: readonly HostImportAllowlistEntry[];
57
+ /**
58
+ * Baseline size — the number of entries above. The CI budget gate fails if
59
+ * `HOST_IMPORT_ALLOWLIST.length` grows beyond this without explicit sign-off
60
+ * (PR description marker `[allowlist-grow]` or CODEOWNERS review on this file).
61
+ *
62
+ * Update this number ONLY in commits that intentionally widen the allowlist;
63
+ * removal of entries is encouraged and does NOT require updating this number
64
+ * (the budget gate is a one-way ratchet on growth).
65
+ */
66
+ export declare const HOST_IMPORT_ALLOWLIST_BASELINE_SIZE: number;
67
+ /**
68
+ * Returns the matching allowlist entry for `name` in the `env` module, or
69
+ * `undefined` if no entry matches. Used by `addImport` (#1524) to decide
70
+ * whether a host import is tolerated under strict mode.
71
+ */
72
+ export declare function lookupAllowlistEntry(name: string): HostImportAllowlistEntry | undefined;
73
+ /**
74
+ * Decide whether an import to `module.name` is allowed under strict
75
+ * `--no-host-imports` mode.
76
+ *
77
+ * Non-`env` modules are subject to the always-allowed list; only
78
+ * `wasi_snapshot_preview1` is currently on it. (`wasm:js-string` and
79
+ * `string_constants` are JS-host imports too, but they are gated by
80
+ * `nativeStrings` mode which strict mode auto-enables; they should not
81
+ * appear when strict mode is on.)
82
+ */
83
+ export declare function isHostImportAllowed(module: string, name: string): {
84
+ allowed: true;
85
+ } | {
86
+ allowed: false;
87
+ reason: "non-env-host-module";
88
+ } | {
89
+ allowed: false;
90
+ reason: "env-not-on-allowlist";
91
+ };
92
+ /**
93
+ * Build the user-facing error message thrown when strict mode rejects a host
94
+ * import. Includes the tracking issue when one is known.
95
+ */
96
+ export declare function buildStrictHostImportError(module: string, name: string): string;
97
+ /**
98
+ * (#2094) A single leaked host import found by the emit-time scan: a
99
+ * `module.name` pair that survived into the finished binary's import section
100
+ * but is not on the dual-mode allowlist.
101
+ */
102
+ export interface LeakedHostImport {
103
+ module: string;
104
+ name: string;
105
+ reason: "non-env-host-module" | "env-not-on-allowlist";
106
+ }
107
+ /**
108
+ * (#2094) Emit-time import-section scan: the backstop for the `addImport`
109
+ * gate.
110
+ *
111
+ * The per-call `addImport` gate (`src/codegen/registry/imports.ts`) is
112
+ * bypassable — it only fires under `strictNoHostImports`, and even then can be
113
+ * defeated by call sites that push onto `ctx.mod.imports` directly or that
114
+ * record a stale `funcMap` index. The result was host imports leaking past the
115
+ * gate into standalone binaries and surfacing as *instantiation* failures
116
+ * (#2073/#2075) rather than structured compile errors.
117
+ *
118
+ * This scan inspects the FINISHED module's import list (after dead-import
119
+ * elimination, so only live imports remain) and returns every `env` import not
120
+ * on the dual-mode allowlist plus any non-`env`/non-WASI host-namespace import.
121
+ * The caller (`generateModule` finalize) turns each leak into a structured
122
+ * compile error via {@link buildLeakedHostImportError}, so `result.success` is
123
+ * `false` and the bad binary is never handed to a consumer.
124
+ *
125
+ * `imports` is the module's import descriptor list (`mod.imports`); only the
126
+ * `module` / `name` fields are read, so the caller may pass any shape carrying
127
+ * those two strings. Duplicate `module.name` pairs are de-duplicated.
128
+ */
129
+ export declare function scanForLeakedHostImports(imports: ReadonlyArray<{
130
+ module: string;
131
+ name: string;
132
+ }>): LeakedHostImport[];
133
+ /**
134
+ * (#2094) Build the structured compile error for a host import that leaked
135
+ * into a finished standalone/strict binary. Distinct from
136
+ * {@link buildStrictHostImportError} (which fires at `addImport` time): this
137
+ * message names the emit-time scan as the source so the diagnostic points at
138
+ * the post-link invariant, not the registration gate.
139
+ */
140
+ export declare function buildLeakedHostImportError(leak: LeakedHostImport): string;