mirror of
https://github.com/morluto/rea.git
synced 2026-12-06 23:13:34 +08:00
fix(javascript): unify runtime module declarations
This commit is contained in:
@@ -30,6 +30,17 @@ export const isTypeOnlyExportDeclaration = (
|
||||
node.declaration != null &&
|
||||
isErasedJavaScriptDeclaration(node.declaration));
|
||||
|
||||
/** Runtime static module source, shared by source and captured-script consumers. */
|
||||
export const semanticStaticModuleSource = (
|
||||
node: t.Node,
|
||||
): t.StringLiteral | null => {
|
||||
if (t.isImportDeclaration(node))
|
||||
return isTypeOnlyImportDeclaration(node) ? null : node.source;
|
||||
if (t.isExportAllDeclaration(node) || t.isExportNamedDeclaration(node))
|
||||
return isTypeOnlyExportDeclaration(node) ? null : (node.source ?? null);
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Runtime external-module target for a value import-equals declaration;
|
||||
* `import type X = require("m")` is erased and declares no dependency.
|
||||
|
||||
Reference in New Issue
Block a user