fix(javascript): preserve TypeScript loader and dependency semantics

Share loader selection across static findings and module relationships: CTS static imports and re-exports use CommonJS lookup while dynamic imports retain ESM lookup. Retain runtime import-equals dependencies, bindings, and exported names; do not resolve require file-URL strings as local artifacts. Restore import-map descriptions in CLI help.

Validated resolver and semantic tests, application reconstruction boundaries, and CLI help. Installed TypeScript NodeNext emission and Node require behavior were checked independently. Refs #2056, #2057, #2058, #2053.
This commit is contained in:
morluto committed 2026-10-12 14:12:19 +08:00
1 parent 966f7cc84b
commit e4532b5376
8 files changed
+242 -13

No files matched your search

@@ -576,6 +576,27 @@ describe("contextual JavaScript artifact path resolution", () => {
});
});
describe("CommonJS file URL resolution", () => {
it("keeps file URL resolution specific to the import loader", () => {
const files = fileMap([file("entry.cjs", "root"), file("dep.cjs", "root")]);
const input = {
declaredPath: "file:///dep.cjs",
sourcePath: "entry.cjs",
context: "module-specifier" as const,
files,
};
expect(resolve({ ...input, moduleKind: "require" })).toMatchObject({
resolution_status: "external",
resolved_path: null,
});
expect(resolve({ ...input, moduleKind: "import" })).toMatchObject({
resolution_status: "resolved",
resolved_path: "dep.cjs",
});
});
});
describe("contextual JavaScript package path resolution", () => {
it("follows package entrypoints beyond the former recursion ceiling", () => {
const files = fileMap([