recon-generate 0.0.32 → 0.0.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/utils.d.ts
CHANGED
|
@@ -91,9 +91,13 @@ export interface SymbolsInfo {
|
|
|
91
91
|
* - definedIn: symbol name → file path where it's actually defined (top-level definitions)
|
|
92
92
|
*/
|
|
93
93
|
export declare function buildExportedSymbolsMap(buildOutput: any): SymbolsInfo;
|
|
94
|
+
export interface ExtraImport {
|
|
95
|
+
name: string;
|
|
96
|
+
path: string;
|
|
97
|
+
}
|
|
94
98
|
/**
|
|
95
99
|
* Given imported file paths, function definitions, and symbol maps, returns a list of
|
|
96
|
-
*
|
|
100
|
+
* named imports needed for types referenced in function parameters but not available
|
|
97
101
|
* through already-imported files.
|
|
98
102
|
*/
|
|
99
|
-
export declare function resolveExtraImports(importedPaths: string[], functions: FunctionDefinitionParams[], symbolsInfo: SymbolsInfo):
|
|
103
|
+
export declare function resolveExtraImports(importedPaths: string[], functions: FunctionDefinitionParams[], symbolsInfo: SymbolsInfo): ExtraImport[];
|
package/dist/utils.js
CHANGED
|
@@ -647,7 +647,7 @@ function buildExportedSymbolsMap(buildOutput) {
|
|
|
647
647
|
}
|
|
648
648
|
/**
|
|
649
649
|
* Given imported file paths, function definitions, and symbol maps, returns a list of
|
|
650
|
-
*
|
|
650
|
+
* named imports needed for types referenced in function parameters but not available
|
|
651
651
|
* through already-imported files.
|
|
652
652
|
*/
|
|
653
653
|
function resolveExtraImports(importedPaths, functions, symbolsInfo) {
|
|
@@ -673,14 +673,16 @@ function resolveExtraImports(importedPaths, functions, symbolsInfo) {
|
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
675
|
// For each referenced type not available, find its definition file
|
|
676
|
-
const
|
|
677
|
-
|
|
676
|
+
const results = [];
|
|
677
|
+
const seen = new Set();
|
|
678
|
+
for (const typeName of Array.from(referenced).sort()) {
|
|
678
679
|
if (available.has(typeName))
|
|
679
680
|
continue;
|
|
680
681
|
const defFile = symbolsInfo.definedIn.get(typeName);
|
|
681
|
-
if (defFile) {
|
|
682
|
-
|
|
682
|
+
if (defFile && !seen.has(typeName)) {
|
|
683
|
+
seen.add(typeName);
|
|
684
|
+
results.push({ name: typeName, path: defFile });
|
|
683
685
|
}
|
|
684
686
|
}
|
|
685
|
-
return
|
|
687
|
+
return results;
|
|
686
688
|
}
|