You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This library tracks module-scope identifiers so CJS↔ESM lowering can avoid collisions and emit correct exports/imports. We model only hoisting behaviors that affect module-scope resolution and skip cases that either error at runtime or are handled by the module loader.
6
+
7
+
## What we treat as hoisted
8
+
9
+
-`function` declarations at module scope: reads before the declaration are counted.
10
+
-`var` declarations at module scope: reads before the declaration are counted (value is `undefined`).
11
+
12
+
## What we do not hoist
13
+
14
+
-`let` / `const` / `class`: reads in the temporal dead zone are ignored for hoist accounting (they are runtime errors). See fixtures/tests under `test/fixtures/identifiers/hoisting/tdz.js`.
15
+
-`import` bindings: import hoisting is handled by the module system; we exclude imports from module-scope hoist tracking. See `test/fixtures/identifiers/hoisting/importHoist.js`.
16
+
- Function declarations inside blocks (strict mode): they stay block-scoped and are not treated as module-scope hoists. See `test/fixtures/identifiers/hoisting/functionInBlock.js`.
17
+
18
+
## Why this scope
19
+
20
+
- Our goal is collision-free lowering, not simulating all JS runtime hoisting/TDZ behavior.
21
+
- Excluding TDZ and import hoists keeps the identifier table focused on cases that meaningfully affect CJS↔ESM transforms.
0 commit comments