@@ -69,9 +69,9 @@ const getImportsAndExports = (
69
69
options : GetImportsAndExportsOptions
70
70
) => {
71
71
const { skipTypeOnly, tags, ignoreExportsUsedInFile } = options ;
72
- const internalImports : ImportMap = new Map ( ) ;
73
- const externalImports = new Set < string > ( ) ;
74
- const unresolvedImports = new Set < UnresolvedImport > ( ) ;
72
+ const internal : ImportMap = new Map ( ) ;
73
+ const external = new Set < string > ( ) ;
74
+ const unresolved = new Set < UnresolvedImport > ( ) ;
75
75
const resolved = new Set < string > ( ) ;
76
76
const specifiers = new Set < [ string , string ] > ( ) ;
77
77
const exports : ExportMap = new Map ( ) ;
@@ -122,11 +122,11 @@ const getImportsAndExports = (
122
122
123
123
specifiers . add ( [ specifier , filePath ] ) ;
124
124
125
- const file = internalImports . get ( filePath ) ;
125
+ const file = internal . get ( filePath ) ;
126
126
127
127
const imports = file ?? createImports ( ) ;
128
128
129
- if ( ! file ) internalImports . set ( filePath , imports ) ;
129
+ if ( ! file ) internal . set ( filePath , imports ) ;
130
130
131
131
const nsOrAlias = symbol ? String ( symbol . escapedName ) : alias ;
132
132
@@ -191,7 +191,7 @@ const getImportsAndExports = (
191
191
192
192
// Module resolver may return DTS references or unaliased npm package names,
193
193
// but in the rest of the program we want the package name based on the original specifier.
194
- externalImports . add ( sanitizedSpecifier ) ;
194
+ external . add ( sanitizedSpecifier ) ;
195
195
}
196
196
}
197
197
} else {
@@ -201,9 +201,9 @@ const getImportsAndExports = (
201
201
202
202
if ( typeof pos === 'number' ) {
203
203
const { line, character } = sourceFile . getLineAndCharacterOfPosition ( pos ) ;
204
- unresolvedImports . add ( { specifier, pos, line : line + 1 , col : character + 1 } ) ;
204
+ unresolved . add ( { specifier, pos, line : line + 1 , col : character + 1 } ) ;
205
205
} else {
206
- unresolvedImports . add ( { specifier } ) ;
206
+ unresolved . add ( { specifier } ) ;
207
207
}
208
208
}
209
209
} ;
@@ -215,7 +215,7 @@ const getImportsAndExports = (
215
215
const importedSymbolFilePath = importedInternalSymbols . get ( symbol ) ;
216
216
if ( importedSymbolFilePath ) {
217
217
const importId = String ( symbol . escapedName ) ;
218
- const internalImport = internalImports . get ( importedSymbolFilePath ) ;
218
+ const internalImport = internal . get ( importedSymbolFilePath ) ;
219
219
if ( internalImport ) {
220
220
if ( importId !== identifier ) {
221
221
// Pattern: import { id as alias } from 'specifier'; export = id; export default id;
@@ -316,7 +316,7 @@ const getImportsAndExports = (
316
316
if ( symbol ) {
317
317
if ( filePath ) {
318
318
if ( ! isImportSpecifier ( node ) ) {
319
- const imports = internalImports . get ( filePath ) ;
319
+ const imports = internal . get ( filePath ) ;
320
320
if ( imports ) {
321
321
traceRefs . add ( id ) ;
322
322
if ( isAccessExpression ( node . parent ) ) {
@@ -378,7 +378,7 @@ const getImportsAndExports = (
378
378
const namespace = left . text ;
379
379
const { filePath } = getImport ( namespace , node ) ;
380
380
if ( filePath ) {
381
- const internalImport = internalImports . get ( filePath ) ;
381
+ const internalImport = internal . get ( filePath ) ;
382
382
if ( internalImport ) addNsMemberRefs ( internalImport , namespace , right . text ) ;
383
383
}
384
384
}
@@ -421,17 +421,9 @@ const getImportsAndExports = (
421
421
}
422
422
423
423
return {
424
- imports : {
425
- internal : internalImports ,
426
- external : externalImports ,
427
- resolved,
428
- specifiers,
429
- unresolved : unresolvedImports ,
430
- } ,
431
- exports : {
432
- exported : exports ,
433
- duplicate : [ ...aliasedExports . values ( ) ] ,
434
- } ,
424
+ imports : { internal, external, resolved, specifiers, unresolved } ,
425
+ exports,
426
+ duplicates : [ ...aliasedExports . values ( ) ] ,
435
427
scripts,
436
428
traceRefs,
437
429
} ;
0 commit comments