mirror of
https://github.com/morluto/rea
synced 2026-10-27 14:42:18 -04:00
fix(browser): omit erased type-only import-equals from source-map dependencies (#4165)
Source-map original-source parsing reported `import type X = require("m")`
as a require dependency, although TypeScript erases the declaration. The
fetcher re-derived import-equals targets instead of using the existing
value-only rule. That rule now lives with the other type-only module
declaration predicates in javascriptModuleDeclaration, and the fetcher,
static analysis, and semantic analysis all use it.
Fixes #3932
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@ import {
|
||||
isTypeOnlyExportSpecifier,
|
||||
isTypeOnlyImportDeclaration,
|
||||
isTypeOnlyImportSpecifier,
|
||||
semanticImportEqualsSpecifier,
|
||||
} from "./javascriptModuleDeclaration.js";
|
||||
import {
|
||||
commonJsExportName,
|
||||
@@ -149,16 +150,6 @@ const collectImportEquals = (
|
||||
);
|
||||
};
|
||||
|
||||
/** Runtime external-module target for a value import-equals declaration. */
|
||||
export const semanticImportEqualsSpecifier = (
|
||||
node: t.TSImportEqualsDeclaration,
|
||||
): string | null =>
|
||||
node.importKind !== "type" &&
|
||||
t.isTSExternalModuleReference(node.moduleReference) &&
|
||||
t.isStringLiteral(node.moduleReference.expression)
|
||||
? node.moduleReference.expression.value
|
||||
: null;
|
||||
|
||||
/** Collect lexical references after definitions exist, optionally for one name. */
|
||||
export const collectSemanticReferences = (
|
||||
program: t.Program,
|
||||
|
||||
Reference in New Issue
Block a user