Skip to content

Commit

Permalink
fix: follow export declarations
Browse files Browse the repository at this point in the history
  • Loading branch information
coderbyheart committed Nov 14, 2024
1 parent ff799a1 commit 24f5386
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
7 changes: 7 additions & 0 deletions src/findDependencies.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ void describe('findDependencies()', () => {
true,
'Should include the index.ts file',
)
assert.equal(
dependencies.includes(
path.join(__dirname, 'test-data', 'resolve-paths', 'foo', '1.ts'),
),
true,
'Should include the module referenced in the index.ts file',
)
assert.equal(
dependencies.includes(
path.join(__dirname, 'test-data', 'resolve-paths', 'foo', '2.ts'),
Expand Down
6 changes: 5 additions & 1 deletion src/findDependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ export const findDependencies = (args: {
)

const parseChild = (node: ts.Node) => {
if (node.kind !== ts.SyntaxKind.ImportDeclaration) return
if (
node.kind !== ts.SyntaxKind.ImportDeclaration &&
node.kind !== ts.SyntaxKind.ExportDeclaration
)
return
const moduleSpecifier = (
(node as ImportDeclaration).moduleSpecifier as StringLiteral
).text
Expand Down

0 comments on commit 24f5386

Please sign in to comment.