-
-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and improve dep graph naming/typing
- Loading branch information
Showing
13 changed files
with
223 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import type ts from 'typescript'; | ||
import type { Fix, Fixes } from './exports.js'; | ||
import type { IssueSymbol, SymbolType } from './issues.js'; | ||
|
||
type Identifier = string; | ||
type FilePath = string; | ||
type NamespaceOrAlias = string; | ||
|
||
type Reference = string; | ||
type References = Set<Reference>; | ||
|
||
type Tags = Set<string>; | ||
|
||
export type IdToFileMap = Map<Identifier, Set<FilePath>>; | ||
export type IdToNsToFileMap = Map<Identifier, Map<NamespaceOrAlias, Set<FilePath>>>; | ||
|
||
export type ImportDetails = { | ||
refs: References; | ||
imported: IdToFileMap; | ||
importedAs: IdToNsToFileMap; | ||
importedNs: IdToFileMap; | ||
reExported: IdToFileMap; | ||
reExportedAs: IdToNsToFileMap; | ||
reExportedNs: IdToFileMap; | ||
}; | ||
|
||
export type ImportMap = Map<FilePath, ImportDetails>; | ||
|
||
export type UnresolvedImport = { specifier: string; pos?: number; line?: number; col?: number }; | ||
|
||
export interface Export { | ||
identifier: Identifier; | ||
pos: number; | ||
line: number; | ||
col: number; | ||
type: SymbolType; | ||
members: ExportMember[]; | ||
jsDocTags: Tags; | ||
refs: number; | ||
fixes: Fixes; | ||
symbol?: ts.Symbol; | ||
} | ||
|
||
export type ExportMember = { | ||
identifier: Identifier; | ||
pos: number; | ||
line: number; | ||
col: number; | ||
type: SymbolType; | ||
refs: number; | ||
fix: Fix; | ||
symbol?: ts.Symbol; | ||
jsDocTags: Tags; | ||
}; | ||
|
||
export type ExportMap = Map<Identifier, Export>; | ||
|
||
export type FileNode = { | ||
imports: { | ||
internal: ImportMap; | ||
external: Set<string>; | ||
unresolved: Set<UnresolvedImport>; | ||
}; | ||
exports: { | ||
exported: ExportMap; | ||
duplicate: Iterable<Array<IssueSymbol>>; | ||
}; | ||
scripts: Set<string>; | ||
imported?: ImportDetails; | ||
internalImportCache?: ImportMap; | ||
traceRefs: References; | ||
}; | ||
|
||
export type DependencyGraph = Map<FilePath, FileNode>; |
Oops, something went wrong.