@@ -10,7 +10,8 @@ import type { IssueSymbol } from '../types/issues.js';
10
10
import { timerify } from '../util/Performance.js' ;
11
11
import { addNsValue , addValue , createImports } from '../util/dependency-graph.js' ;
12
12
import { getPackageNameFromFilePath , isStartsLikePackageName , sanitizeSpecifier } from '../util/modules.js' ;
13
- import { extname , isInNodeModules } from '../util/path.js' ;
13
+ import { dirname , extname , isInNodeModules } from '../util/path.js' ;
14
+ import { _resolveSyncFollowSymlinks } from '../util/resolve.js' ;
14
15
import { shouldIgnore } from '../util/tag.js' ;
15
16
import type { BoundSourceFile } from './SourceFile.js' ;
16
17
import {
@@ -64,6 +65,7 @@ export type GetImportsAndExportsOptions = {
64
65
isReportClassMembers : boolean ;
65
66
ignoreExportsUsedInFile : IgnoreExportsUsedInFile ;
66
67
tags : Tags ;
68
+ workspacePkgNames : Set < string > ;
67
69
} ;
68
70
69
71
interface AddInternalImportOptions extends ImportNode {
@@ -79,7 +81,7 @@ const getImportsAndExports = (
79
81
typeChecker : ts . TypeChecker ,
80
82
options : GetImportsAndExportsOptions
81
83
) => {
82
- const { skipTypeOnly, tags, ignoreExportsUsedInFile } = options ;
84
+ const { skipTypeOnly, tags, ignoreExportsUsedInFile, workspacePkgNames } = options ;
83
85
const internalImports : ImportMap = new Map ( ) ;
84
86
const externalImports = new Set < string > ( ) ;
85
87
const unresolvedImports = new Set < UnresolvedImport > ( ) ;
@@ -188,6 +190,9 @@ const getImportsAndExports = (
188
190
189
191
if ( ! module . isExternalLibraryImport || ! isInNodeModules ( filePath ) ) {
190
192
addInternalImport ( { ...options , identifier, filePath, isReExport } ) ;
193
+ } else if ( workspacePkgNames . has ( getPackageNameFromFilePath ( filePath ) ) ) {
194
+ const fp = _resolveSyncFollowSymlinks ( filePath , dirname ( filePath ) ) ;
195
+ if ( fp ) addInternalImport ( { ...options , identifier, filePath : fp , isReExport } ) ;
191
196
}
192
197
193
198
if ( module . isExternalLibraryImport ) {
0 commit comments