Skip to content

Commit 9971d47

Browse files
committed
Add comments to module graph types
1 parent e848615 commit 9971d47

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/knip/src/types/module-graph.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,21 @@ export interface Position {
1919
export type IdToFileMap = Map<Identifier, Set<FilePath>>;
2020
export type IdToNsToFileMap = Map<Identifier, Map<NamespaceOrAlias, Set<FilePath>>>;
2121

22-
/** Aggregated imports from other files (who imports this file's exports) */
2322
export type ImportMaps = {
24-
/** Usage references to imported identifiers ("default", "named", "NS.export", "enum.member", etc.) */
23+
/** Usage references cq. property-access patterns on imports ("default", "named", "NS.member", "alias.sub", "enum.member", etc.); NOT mere import usage */
2524
refs: References;
26-
/** Directly imported identifiers */
25+
/** Identifiers imported from this file */
2726
imported: IdToFileMap;
27+
/** Identifiers imported with alias (id → alias → files) */
2828
importedAs: IdToNsToFileMap;
29+
/** Namespace imports of this file */
2930
importedNs: IdToFileMap;
3031
/** Identifiers re-exported (not directly imported) */
3132
reExported: IdToFileMap;
32-
reExportedAs: IdToNsToFileMap;
33+
/** Namespace re-exports */
3334
reExportedNs: IdToFileMap;
35+
/** Irregular re-exports: id → namespace/alias → source files */
36+
reExportedAs: IdToNsToFileMap;
3437
};
3538

3639
export type ImportMap = Map<FilePath, ImportMaps>;
@@ -84,6 +87,7 @@ export type FileNode = {
8487
exports: ExportMap;
8588
duplicates: Iterable<Array<IssueSymbol>>;
8689
scripts: Set<string>;
90+
/** Aggregation of other files importing this file's exports */
8791
imported: undefined | ImportMaps;
8892
internalImportCache: undefined | ImportMap;
8993
};

0 commit comments

Comments
 (0)