Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace find references with custom logic #50

Merged
merged 123 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
8946533
feat: init module
kazushisan Nov 4, 2024
afbd1d0
feat: add minimal implementation for collectUsage
kazushisan Nov 4, 2024
b22ba63
test: add test case for multiple named imports
kazushisan Nov 4, 2024
3561876
feat: add support for aliased imports
kazushisan Nov 4, 2024
2602ecc
feat: add support for default imports
kazushisan Nov 4, 2024
010b5d5
feat: add support for mixed imports
kazushisan Nov 4, 2024
b73fc90
test: add test case for default specifier
kazushisan Nov 4, 2024
195ac96
test: add test case for imports to multiple files
kazushisan Nov 4, 2024
2ffeba5
chore: exclude benchmark from tsconfig
kazushisan Nov 4, 2024
10ca3f6
perf: replace ts.LanguageService.findReferences with collectUsage
kazushisan Nov 4, 2024
2ae12b0
test: add test for multiple import declarations referencing the same …
kazushisan Nov 4, 2024
482dcb2
chore: add comment
kazushisan Nov 5, 2024
bb29fed
test: add test case for namespace imports
kazushisan Nov 5, 2024
5e77a9e
feat: support namespace imports
kazushisan Nov 5, 2024
ac8cf85
feat: handle namespace imports with collectUsage
kazushisan Nov 5, 2024
6a9f2a0
feat: add support for exports
kazushisan Nov 5, 2024
41b329a
feat: add support for dynamic imports
kazushisan Nov 5, 2024
2e74f9c
fix: correctly get specifier for variable statement
kazushisan Nov 5, 2024
a757ebc
feat: make pool optional for easier testing
kazushisan Nov 5, 2024
c8f11fb
fix: correctly obtain export name for function declaration
kazushisan Nov 5, 2024
5d05ffd
fix: fix descrpition for class test cases
kazushisan Nov 5, 2024
48ea62d
fix: correctly obtain specifier for class declaration
kazushisan Nov 5, 2024
569e849
fix: correctly obtain specifier for interface declaration
kazushisan Nov 5, 2024
1cf3b53
fix: correctly obtain specifier for type alias declaration
kazushisan Nov 5, 2024
2390d40
fix: correctly obtain specifier for default export
kazushisan Nov 5, 2024
5b765bc
fix: return specifier name from node for named exports
kazushisan Nov 5, 2024
506af3b
chore: remove unnecessary console.log
kazushisan Nov 5, 2024
68fa179
fix: supply parent
kazushisan Nov 5, 2024
7529ae1
refactor: don't manually supply sourceFile
kazushisan Nov 5, 2024
769d11e
feat: collect whole reexports
kazushisan Nov 5, 2024
0031238
feat: distinguish whole reexports
kazushisan Nov 6, 2024
b9d65d8
feat: create an import graph for files that are not reachable from th…
kazushisan Nov 6, 2024
1aadad5
fix: generate subgraph with dependency info to correctly check usage …
kazushisan Nov 6, 2024
d7a8d31
feat: remove logic that became unnecesssary by implementing collectUsage
kazushisan Nov 6, 2024
c6b806b
fix: dont include files unreachable to initialFiles
kazushisan Nov 6, 2024
beb716c
refactor: dont traverse files when whole reexport is used in entrypoi…
kazushisan Nov 6, 2024
4787982
fix: fix flaky test caused by paralell process
kazushisan Nov 6, 2024
09871e8
chore: update comment in test
kazushisan Nov 6, 2024
28217cf
perf: only create language service when necessary
kazushisan Nov 6, 2024
a9e8b76
polish: delay recording whole reexport specifiers for safety
kazushisan Nov 6, 2024
0987a0c
perf: cache result of collectUsage
kazushisan Nov 6, 2024
e2e2251
test: add test case for whole reexport with another export
kazushisan Nov 7, 2024
a52d51d
test: add test for whole reexport in entrypoint
kazushisan Nov 7, 2024
2d7991b
test: add test case to delete whole reexport
kazushisan Nov 7, 2024
0dcabc8
test: add todo test case for whole reexport
kazushisan Nov 7, 2024
8db4801
feat: implement eject fn
kazushisan Nov 7, 2024
e85c5ca
perf: dont calculate subgraph
kazushisan Nov 7, 2024
786f849
refactor: extract collectUsageRecursively
kazushisan Nov 8, 2024
04bd00c
refactor: rename fn
kazushisan Nov 8, 2024
2f1af84
refactor: extract createProgram
kazushisan Nov 8, 2024
7bea8c1
test: add basic test case for findFileUsage
kazushisan Nov 8, 2024
3e2c67f
feat: return set from findFileUsage
kazushisan Nov 8, 2024
d36319d
test: add test case
kazushisan Nov 8, 2024
5cc1e3f
refactor: extract memoized fn
kazushisan Nov 8, 2024
389014c
test: add simple case of whole reexport
kazushisan Nov 8, 2024
7dc1601
test: add test case to assert result doesn't include wrong items
kazushisan Nov 8, 2024
86c8a79
refactor: rename collectUsage to getFileInfo
kazushisan Nov 8, 2024
120475f
feat: return imports object from getFileInfo
kazushisan Nov 8, 2024
11aabcb
refactor: rename to parseFile
kazushisan Nov 9, 2024
f6f1766
feat: implement memoize util
kazushisan Nov 9, 2024
d5fef18
refactor: export memoized version of parseFile
kazushisan Nov 9, 2024
2626e9b
test: add test for collecting variable declaration export
kazushisan Nov 10, 2024
f3782ba
refactor: use setParentNodes
kazushisan Nov 10, 2024
83f9c49
refactor: dont pass sourceFile to util functions
kazushisan Nov 10, 2024
12caa52
refactor: extract findFirstNodeOfKind util
kazushisan Nov 10, 2024
f66abb1
feat: collect variable statements
kazushisan Nov 10, 2024
3a80c69
test: add test case for variable statement with multiple variables
kazushisan Nov 10, 2024
8d1b1b0
feat: add support for function declaration
kazushisan Nov 10, 2024
6a41fee
feat: add support for default export function
kazushisan Nov 10, 2024
d937b56
test: add test case for unnamed default export function declaration
kazushisan Nov 10, 2024
da1b5ab
feat: add support for interface declaration
kazushisan Nov 10, 2024
3764dd9
feat: add support for type alias declaration
kazushisan Nov 10, 2024
2fd20d0
feat: add support default assignment
kazushisan Nov 10, 2024
ff51300
feat: add support for collecting export declaration
kazushisan Nov 10, 2024
89f380a
feat: add support for collecting class declaration
kazushisan Nov 10, 2024
caf0aa7
feat: use array for result of parseFile
kazushisan Nov 10, 2024
1ac7e54
refactor: rename
kazushisan Nov 10, 2024
bd250e1
refactor: rewrite findFileUsage with stack
kazushisan Nov 10, 2024
7c34dce
feat: add support for named reexport
kazushisan Nov 10, 2024
0cd98b2
refactor: organize condition for export declaration
kazushisan Nov 10, 2024
0d5b284
feat: add support for whole reexport
kazushisan Nov 10, 2024
a47d214
feat: include file in result for whole reexport
kazushisan Nov 10, 2024
ed88f19
fix: filter usage to only include exports from the given file
kazushisan Nov 10, 2024
810d009
fix: handle files outside of project
kazushisan Nov 10, 2024
8a07e9b
feat: collect export keyword position
kazushisan Nov 11, 2024
21bdd4c
feat: colllect delete range for class, functions and interfaces
kazushisan Nov 11, 2024
fd482b9
feat: add support for type alias
kazushisan Nov 11, 2024
eb411e0
refactor: rename to deleteSpan
kazushisan Nov 11, 2024
4f854d8
refactor: rename fn
kazushisan Nov 11, 2024
498a94b
refactor: use nested structure
kazushisan Nov 11, 2024
253b0ba
feat: collect change span for export declaration
kazushisan Nov 11, 2024
27bcb6a
feat: collect span for export assignment
kazushisan Nov 11, 2024
689c7ce
feat: include code in result if named export declaration
kazushisan Nov 11, 2024
eb0dc94
feat: add support for skip comment to export declaration
kazushisan Nov 11, 2024
ee2b400
feat: add support for skip comment
kazushisan Nov 11, 2024
e801b91
feat: include start pos for logging
kazushisan Nov 11, 2024
f121d15
feat: return skip field for export assignment
kazushisan Nov 11, 2024
a6dc35c
feat: include code field for all kinds
kazushisan Nov 11, 2024
1f3f63c
feat: add isUnnamedDefaultExport field
kazushisan Nov 11, 2024
e79fad2
feat: use parseFile in processFile
kazushisan Nov 12, 2024
1062d4a
test: change test case to support new behavior
kazushisan Nov 12, 2024
8565930
chore: update test description
kazushisan Nov 12, 2024
59836f7
fix: log correct position for export specifier
kazushisan Nov 12, 2024
d011ae3
test: update test case to support simpler log format
kazushisan Nov 12, 2024
d696cb5
chore: remove comment that wont be addressed
kazushisan Nov 12, 2024
618b14a
fix: fix format break when editing export declaration
kazushisan Nov 12, 2024
05016d6
feat: include change field for namespace export
kazushisan Nov 12, 2024
6439f25
fix: correctly remove namespace exports
kazushisan Nov 12, 2024
ac60ccb
test: organize tests for whole export declaration
kazushisan Nov 12, 2024
93a17a7
test: organize test for named export declaration with module spcicifier
kazushisan Nov 12, 2024
7e99bd5
feat: include change field for whole export declaration
kazushisan Nov 12, 2024
717da90
feat: add spcifier field
kazushisan Nov 12, 2024
b470eb7
fix: support removing whole reexport
kazushisan Nov 12, 2024
607d7a6
refactor: remove unnecessary logic resulted by migrating to processFile
kazushisan Nov 12, 2024
3f4346f
fix: copy when ejecting
kazushisan Nov 12, 2024
6c2fe3f
refactor: dont collect whole rexports when collecting dependency graph
kazushisan Nov 12, 2024
270b291
refactor: rename collectImports
kazushisan Nov 12, 2024
d9475fc
chore: remove only
kazushisan Nov 12, 2024
f0083a7
chore: remove console.log in test
kazushisan Nov 12, 2024
761c946
test: add test case for applyCodeFix
kazushisan Nov 12, 2024
0dabf60
refactor: move getFileFromModuleSpecifierText to createDependencyGrap…
kazushisan Nov 12, 2024
0c671cb
test: add test case to check if apply code fix works for multiple unu…
kazushisan Nov 12, 2024
82af751
Merge branch 'release/0.7.0' into feat/collect-usage
kazushisan Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 13 additions & 23 deletions lib/util/DependencyGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,28 @@ import { Graph } from './Graph.js';

export class DependencyGraph extends Graph<{
depth: number;
hasReexport: boolean;
fromDynamic: Set<string>;
wholeReexportSpecifier: Map<string, string>;
}> {
constructor() {
super(() => ({
depth: 0,
hasReexport: false,
fromDynamic: new Set<string>(),
// will not be updated when we delete a file,
// but it's fine since we only use it to find the used specifier from a given file path.
wholeReexportSpecifier: new Map<string, string>(),
}));
}

deleteVertex(vertex: string) {
const selected = this.vertexes.get(vertex);
eject() {
const map: typeof this.vertexes = new Map();

if (!selected) {
return;
for (const [k, v] of this.vertexes.entries()) {
map.set(k, {
from: new Set(v.from),
to: new Set(v.to),
data: {
depth: v.data.depth,
},
});
}

for (const v of selected.to) {
const target = this.vertexes.get(v);

if (!target) {
continue;
}

target.data.fromDynamic.delete(vertex);
}

super.deleteVertex(vertex);
return map;
}
}

export type Vertexes = ReturnType<DependencyGraph['eject']>;
1 change: 1 addition & 0 deletions lib/util/FileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export interface FileService {
getVersion(name: string): string;
getFileNames(): string[];
exists(name: string): boolean;
eject(): Map<string, string>;
}
10 changes: 10 additions & 0 deletions lib/util/MemoryFileService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,14 @@ export class MemoryFileService implements FileService {
exists(name: string) {
return this.#files.has(name);
}

eject() {
const res = new Map<string, string>();

for (const [name, { content }] of this.#files) {
res.set(name, content);
}

return res;
}
}
1 change: 0 additions & 1 deletion lib/util/WorkerPool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ export class WorkerPool<T extends (arg: any) => any> {

worker.on('exit', (code) => {
if (code === 0) {
console.log('here');
return;
}

Expand Down
43 changes: 43 additions & 0 deletions lib/util/applyCodeFix.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,49 @@ const b = 'b';`,
assert.equal(result, `export const a = 'a';\n`);
});

it('should clean up multiple unused identifiers', () => {
const { languageService, fileService } = setup();

fileService.set(
'/app/a.ts',
`export const a = 'a';
const b = 'b';
const c = 'c';`,
);

const result = applyCodeFix({
fixId: fixIdDelete,
languageService,
fileName: '/app/a.ts',
});

assert.equal(result, `export const a = 'a';\n`);
});

it('should only clean up unused identifiers once', () => {
const { languageService, fileService } = setup();

fileService.set(
'/app/a.ts',
`export const a = 'a';
const b = () => a();
const c = () => b();
const d = () => c();`,
);

const result = applyCodeFix({
fixId: fixIdDelete,
languageService,
fileName: '/app/a.ts',
});
assert.equal(
result,
`export const a = 'a';
const b = () => a();
const c = () => b();\n`,
);
});

it('should clean up unused imports', () => {
const { languageService, fileService } = setup();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, it } from 'node:test';
import { setup } from '../../test/helpers/setup.js';
import { collectImports } from './collectImports.js';
import { createDependencyGraph } from './createDependencyGraph.js';
import ts from 'typescript';
import assert from 'node:assert/strict';

Expand All @@ -14,7 +14,7 @@ const getProgram = (languageService: ts.LanguageService) => {
return program;
};

describe('collectImports', () => {
describe('createDependencyGraph', () => {
it('should return a graph of imports', () => {
const { languageService, fileService } = setup();
fileService.set('/app/main.ts', `import { a } from './a.js';`);
Expand All @@ -29,7 +29,7 @@ export const a = () => ({ b, c });`,

const program = getProgram(languageService);

const graph = collectImports({
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
Expand Down Expand Up @@ -61,10 +61,6 @@ export const a = () => ({ b, c });`,
assert.equal(graph.vertexes.get('/app/a.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/c.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/c.ts')?.data.hasReexport, false);
});

it('should return a graph of imports when re-exports are used', () => {
Expand All @@ -79,7 +75,7 @@ export const a = () => b;`,
fileService.set('/app/b2.ts', `export const b = 'b';`);

const program = getProgram(languageService);
const graph = collectImports({
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
Expand Down Expand Up @@ -111,10 +107,6 @@ export const a = () => b;`,
assert.equal(graph.vertexes.get('/app/a.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/b2.ts')?.data.depth, 3);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.hasReexport, true);
assert.equal(graph.vertexes.get('/app/b2.ts')?.data.hasReexport, false);
});

it('should return a graph of imports when whole re-exports are used', () => {
Expand All @@ -129,7 +121,7 @@ export const a = () => b;`,
fileService.set('/app/b2.ts', `export const b = 'b';`);

const program = getProgram(languageService);
const graph = collectImports({
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
Expand Down Expand Up @@ -161,10 +153,6 @@ export const a = () => b;`,
assert.equal(graph.vertexes.get('/app/a.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/b2.ts')?.data.depth, 3);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.hasReexport, true);
assert.equal(graph.vertexes.get('/app/b2.ts')?.data.hasReexport, false);
});

it('should return a graph of imports when dynamic imports are used', () => {
Expand All @@ -174,7 +162,7 @@ export const a = () => b;`,
fileService.set('/app/b.ts', `export const b = 'b';`);

const program = getProgram(languageService);
const graph = collectImports({
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
Expand All @@ -200,23 +188,9 @@ export const a = () => b;`,
assert.equal(graph.vertexes.get('/app/main.ts')?.data.depth, 0);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.fromDynamic.size, 0);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.fromDynamic.size, 1);
assert.equal(
graph.vertexes.get('/app/a.ts')?.data.fromDynamic.has('/app/main.ts'),
true,
);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.fromDynamic.size, 1);
assert.equal(
graph.vertexes.get('/app/b.ts')?.data.fromDynamic.has('/app/a.ts'),
true,
);
});

it('should not include files that are unreachable from the entry point', () => {
it('should handle files that are unreachable from the entry point', () => {
const { languageService, fileService } = setup();
fileService.set('/app/main.ts', `import { a } from './a.js';`);
fileService.set(
Expand All @@ -234,13 +208,13 @@ export const c = () => d;`,

const program = getProgram(languageService);

const graph = collectImports({
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
});

assert.equal(graph.vertexes.size, 3);
assert.equal(graph.vertexes.size, 5);
assert.equal(graph.vertexes.has('/app/main.ts'), true);
assert.equal(graph.vertexes.has('/app/a.ts'), true);
assert.equal(graph.vertexes.has('/app/b.ts'), true);
Expand All @@ -257,14 +231,49 @@ export const c = () => d;`,
assert.equal(graph.vertexes.get('/app/b.ts')?.to.size, 0);
assert.equal(graph.vertexes.get('/app/b.ts')?.from.size, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.from.has('/app/a.ts'), true);
assert.equal(graph.vertexes.has('/app/c.ts'), false);
assert.equal(graph.vertexes.has('/app/d.ts'), false);
assert.equal(graph.vertexes.has('/app/c.ts'), true);
assert.equal(graph.vertexes.has('/app/d.ts'), true);
assert.equal(graph.vertexes.get('/app/c.ts')?.to.size, 1);
assert.equal(graph.vertexes.get('/app/c.ts')?.to.has('/app/d.ts'), true);
assert.equal(graph.vertexes.get('/app/c.ts')?.from.size, 0);
assert.equal(graph.vertexes.get('/app/d.ts')?.to.size, 0);
assert.equal(graph.vertexes.get('/app/d.ts')?.from.size, 1);
assert.equal(graph.vertexes.get('/app/d.ts')?.from.has('/app/c.ts'), true);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.depth, 0);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/c.ts')?.data.depth, Infinity);
assert.equal(graph.vertexes.get('/app/d.ts')?.data.depth, Infinity);
});

it('should not create a vertex if there are no imports', () => {
const { languageService, fileService } = setup();
fileService.set('/app/main.ts', 'console.log("hello world");');
const program = getProgram(languageService);
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
});
assert.equal(graph.vertexes.size, 0);
});

it('should not create a vertex for a file that is unreachable from the entry point if there are no imports from/exports to the file', () => {
const { languageService, fileService } = setup();
fileService.set('/app/main.ts', `import { a } from './a.js';`);
fileService.set('/app/a.ts', `export const a = () => 'a';`);
fileService.set('/app/b.ts', `export const b = 'b';`);

const program = getProgram(languageService);
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
});
assert.equal(graph.vertexes.size, 2);
assert.equal(graph.vertexes.has('/app/main.ts'), true);
assert.equal(graph.vertexes.has('/app/a.ts'), true);
assert.equal(graph.vertexes.has('/app/b.ts'), false);
});

it('should correctly collect circular dependencies', () => {
Expand Down Expand Up @@ -294,7 +303,7 @@ export const c = () => a2;`,

const program = getProgram(languageService);

const graph = collectImports({
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts'],
Expand Down Expand Up @@ -328,10 +337,6 @@ export const c = () => a2;`,
assert.equal(graph.vertexes.get('/app/a.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/c.ts')?.data.depth, 3);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/c.ts')?.data.hasReexport, false);
});

it('should work when there are multiple entrypoints', () => {
Expand Down Expand Up @@ -361,7 +366,7 @@ export const b = () => c;`,

const program = getProgram(languageService);

const graph = collectImports({
const graph = createDependencyGraph({
fileService,
program,
entrypoints: ['/app/main.ts', '/app/main2.ts'],
Expand Down Expand Up @@ -405,9 +410,5 @@ export const b = () => c;`,
assert.equal(graph.vertexes.get('/app/a.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.depth, 1);
assert.equal(graph.vertexes.get('/app/c.ts')?.data.depth, 2);
assert.equal(graph.vertexes.get('/app/main.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/main2.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/a.ts')?.data.hasReexport, false);
assert.equal(graph.vertexes.get('/app/b.ts')?.data.hasReexport, false);
});
});
Loading
Loading