Files
scriptc/tests/diagnostics/declaration-only-module
Malte Ubl cc417cdc74 Keep declaration files out of the module order
A specifier that resolves ONLY to a declaration file has no runtime module
to link: Node throws ERR_MODULE_NOT_FOUND at it. Preflight already refused
the import form (SC1010), but the re-export arm and both require arms took
the declaration file as a module-order edge. Once a declaration file is a
program module, its own imports are lowered as code — which is how a
package's own `.d.mts` files emit SC2013 for every specifier inside them
(the pi/typebox shape: 133 errors, all at import statements inside
`node_modules/typebox/build/**/*.d.mts`).

Refuse the re-export form with the same SC1010 the import form uses, and
skip declaration files as edges in both require arms. `splitFiles` gains
the matching invariant: a declaration file is never lowered as a runtime
module even if one reaches the order by another path.

Test: tests/diagnostics/declaration-only-module (SC1010 snapshot) and the
recorded preflight/order baselines.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 534ec68eb13f15812376aa5126f013da693a48d6)
2026-10-29 17:57:17 -07:00
..