mirror of
https://github.com/morluto/rea.git
synced 2026-10-28 02:15:44 +00:00
fix(javascript): centralize module syntax and separate erased type dependencies
This commit is contained in:
1 parent
e1cd292aa6
commit
1b953021ea
18 files changed
+513
-134
No files matched your search
@@ -53,6 +53,11 @@ import {
|
||||
|
||||
import { createJavaScriptRpcScan } from "./javascriptRpcEndpoints.js";
|
||||
import { semanticImportEqualsSpecifier } from "./javascriptSemanticProjection.js";
|
||||
import {
|
||||
hasUncertainTypeOnlyModuleSideEffect,
|
||||
isTypeOnlyExportDeclaration,
|
||||
isTypeOnlyImportDeclaration,
|
||||
} from "./javascriptModuleDeclaration.js";
|
||||
|
||||
/** Parse one JavaScript artifact and recover static structure only. */
|
||||
export const analyzeJavaScriptStaticSource = (
|
||||
@@ -154,6 +159,11 @@ const finalizeStaticAnalysis = (
|
||||
: [
|
||||
"One or more static keys, expressions, or Electron boundary values were dynamic and remain unknown.",
|
||||
]),
|
||||
...(hasUncertainTypeOnlyModuleSideEffect(file.program)
|
||||
? [
|
||||
"Compiler options are unavailable; inline type-only imports or re-exports may preserve a module side-effect dependency.",
|
||||
]
|
||||
: []),
|
||||
...(accumulator.references.some(
|
||||
({ value }) =>
|
||||
value.specifier !== null && ELECTRON_MODULE.test(value.specifier),
|
||||
@@ -246,14 +256,20 @@ const inspectNode = (
|
||||
addReference(findings, { node, kind: "require", specifier });
|
||||
} else if (
|
||||
(t.isImportDeclaration(node) || t.isExportAllDeclaration(node)) &&
|
||||
node.source !== undefined
|
||||
node.source !== undefined &&
|
||||
!(t.isImportDeclaration(node) && isTypeOnlyImportDeclaration(node)) &&
|
||||
!(t.isExportAllDeclaration(node) && isTypeOnlyExportDeclaration(node))
|
||||
)
|
||||
addReference(findings, {
|
||||
node,
|
||||
kind: "static-import",
|
||||
specifier: node.source.value,
|
||||
});
|
||||
else if (t.isExportNamedDeclaration(node) && node.source != null)
|
||||
else if (
|
||||
t.isExportNamedDeclaration(node) &&
|
||||
node.source != null &&
|
||||
!isTypeOnlyExportDeclaration(node)
|
||||
)
|
||||
addReference(findings, {
|
||||
node,
|
||||
kind: "static-import",
|
||||
|
||||
Reference in new issue
Block a user