@ankhorage/dependency-graph 0.7.2 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +12 -3
- package/dist/dependencyGraph.d.ts +14 -9
- package/dist/dependencyGraph.d.ts.map +1 -1
- package/dist/dependencyGraph.js +12 -8
- package/dist/dependencyGraph.js.map +1 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppDependencies.d.ts +2 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppDependencies.d.ts.map +1 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppDependencies.js.map +1 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.d.ts +4 -0
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.d.ts.map +1 -0
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.js +201 -0
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaSourceFacts.js.map +1 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.d.ts +4 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.d.ts.map +1 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.js +159 -0
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptSourceFacts.js.map +1 -0
- package/dist/features/dependency-analysis/application/assertDependencyGraphInspections.d.ts +4 -0
- package/dist/features/dependency-analysis/application/assertDependencyGraphInspections.d.ts.map +1 -0
- package/dist/features/dependency-analysis/application/assertDependencyGraphInspections.js +13 -0
- package/dist/features/dependency-analysis/application/assertDependencyGraphInspections.js.map +1 -0
- package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.d.ts +5 -0
- package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.d.ts.map +1 -0
- package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.js +43 -0
- package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.js.map +1 -0
- package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphAsync.d.ts.map +1 -1
- package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphAsync.js +1 -2
- package/dist/features/dependency-analysis/composition/createDependencyGraphAsync.js.map +1 -0
- package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphFromInspectionsAsync.d.ts +1 -3
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.d.ts.map +1 -0
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js +13 -0
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractCppPackageFromInclude.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractCppPackageFromInclude.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractDelphiPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractDelphiPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractJavaPackageFromImport.d.ts +3 -0
- package/dist/features/dependency-analysis/domain/extractJavaPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/{adapters/outbound/java → domain}/extractJavaPackageFromImport.js +1 -1
- package/dist/features/dependency-analysis/domain/extractJavaPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractKotlinPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractKotlinPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/extractPythonPackageFromImport.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/extractPythonPackageFromImport.js.map +1 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.d.ts +5 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.d.ts.map +1 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.js +144 -0
- package/dist/features/dependency-analysis/domain/projectDependencyGraphFromSourceGraph.js.map +1 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.d.ts +4 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.d.ts.map +1 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.js +36 -0
- package/dist/features/source-graph/adapters/outbound/extractOtherLanguageFacts.js.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.d.ts +4 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.d.ts.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.js +16 -0
- package/dist/features/source-graph/composition/createSourceGraphAsync.js.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.d.ts +4 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.d.ts.map +1 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.js +118 -0
- package/dist/features/source-graph/composition/createSourceGraphFromInspectionsAsync.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraph.d.ts +4 -0
- package/dist/features/source-graph/domain/createSourceGraph.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraph.js +73 -0
- package/dist/features/source-graph/domain/createSourceGraph.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.d.ts +4 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.js +57 -0
- package/dist/features/source-graph/domain/createSourceGraphIndex.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.d.ts +4 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.js +119 -0
- package/dist/features/source-graph/domain/createSourceRelationDraft.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.d.ts +8 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.js +27 -0
- package/dist/features/source-graph/domain/createSourceRollupIndex.js.map +1 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.d.ts +11 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.d.ts.map +1 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.js +238 -0
- package/dist/features/source-graph/domain/createSourceStructureDraft.js.map +1 -0
- package/dist/features/source-graph/domain/querySourceGraph.d.ts +15 -0
- package/dist/features/source-graph/domain/querySourceGraph.d.ts.map +1 -0
- package/dist/features/source-graph/domain/querySourceGraph.js +40 -0
- package/dist/features/source-graph/domain/querySourceGraph.js.map +1 -0
- package/dist/features/source-graph/domain/resolveSourceImport.d.ts +9 -0
- package/dist/features/source-graph/domain/resolveSourceImport.d.ts.map +1 -0
- package/dist/features/source-graph/domain/resolveSourceImport.js +146 -0
- package/dist/features/source-graph/domain/resolveSourceImport.js.map +1 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.d.ts +4 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.d.ts.map +1 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.js +46 -0
- package/dist/features/source-graph/domain/rollupSourceRelations.js.map +1 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.d.ts +6 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.d.ts.map +1 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.js +64 -0
- package/dist/features/source-graph/domain/serializeSourceGraph.js.map +1 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.d.ts +3 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.d.ts.map +1 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.js +5 -0
- package/dist/features/source-graph/domain/sourceSemanticPath.js.map +1 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.d.ts +4 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.d.ts.map +1 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.js +66 -0
- package/dist/features/source-graph/domain/summarizeSourceNode.js.map +1 -0
- package/dist/types/dependencyGraph.d.ts +2 -23
- package/dist/types/dependencyGraph.d.ts.map +1 -1
- package/dist/types/dependencyGraph.js.map +1 -1
- package/dist/types/sourceGraph.d.ts +173 -0
- package/dist/types/sourceGraph.d.ts.map +1 -0
- package/dist/types/sourceGraph.js +2 -0
- package/dist/types/sourceGraph.js.map +1 -0
- package/package.json +6 -4
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/cpp/analyzeCppProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppPackageFromInclude.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/cpp/extractCppPackageFromInclude.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.js +0 -105
- package/dist/features/dependency-analysis/adapters/outbound/delphi/analyzeDelphiProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/extractDelphiPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/delphi/extractDelphiPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/java/analyzeJavaProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.d.ts +0 -7
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.js +0 -7
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaDependencies.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaPackageFromImport.d.ts +0 -3
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/extractJavaPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/analyzeKotlinProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/extractKotlinPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/extractKotlinPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.js +0 -103
- package/dist/features/dependency-analysis/adapters/outbound/python/analyzePythonProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/extractPythonPackageFromImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/extractPythonPackageFromImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.js +0 -92
- package/dist/features/dependency-analysis/adapters/outbound/typescript/analyzeTypeScriptProjectAsync.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.d.ts +0 -5
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.js +0 -29
- package/dist/features/dependency-analysis/adapters/outbound/typescript/createTypeScriptModuleNodes.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.d.ts +0 -3
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.js +0 -9
- package/dist/features/dependency-analysis/adapters/outbound/typescript/extractTypeScriptImports.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.d.ts +0 -3
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/typescript/modulePathForFile.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.d.ts +0 -11
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.js +0 -85
- package/dist/features/dependency-analysis/adapters/outbound/typescript/resolveTypeScriptImport.js.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.d.ts +0 -4
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.d.ts.map +0 -1
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js +0 -8
- package/dist/features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js.map +0 -1
- package/dist/features/dependency-analysis/application/createDependencyGraphAsync.js.map +0 -1
- package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.d.ts.map +0 -1
- package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js +0 -111
- package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js.map +0 -1
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.d.ts +0 -4
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.d.ts.map +0 -1
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.js +0 -36
- package/dist/features/dependency-analysis/utils/collectInspectedSourceFiles.js.map +0 -1
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.d.ts +0 -3
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.d.ts.map +0 -1
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.js +0 -8
- package/dist/features/dependency-analysis/utils/findIntrinsicPackageForReference.js.map +0 -1
- /package/dist/features/dependency-analysis/{application → composition}/createDependencyGraphAsync.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/cpp → domain}/extractCppPackageFromInclude.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/cpp → domain}/extractCppPackageFromInclude.js +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/delphi → domain}/extractDelphiPackageFromImport.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/delphi → domain}/extractDelphiPackageFromImport.js +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/kotlin → domain}/extractKotlinPackageFromImport.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/kotlin → domain}/extractKotlinPackageFromImport.js +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/python → domain}/extractPythonPackageFromImport.d.ts +0 -0
- /package/dist/features/dependency-analysis/{adapters/outbound/python → domain}/extractPythonPackageFromImport.js +0 -0
package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { createGraph } from '@ankhorage/graph';
|
|
3
|
-
import { cppDependencyGraphAnalyzer } from '../adapters/outbound/cpp/cppDependencyGraphAnalyzer.js';
|
|
4
|
-
import { delphiDependencyGraphAnalyzer } from '../adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js';
|
|
5
|
-
import { javaDependencyGraphAnalyzer } from '../adapters/outbound/java/javaDependencyGraphAnalyzer.js';
|
|
6
|
-
import { kotlinDependencyGraphAnalyzer } from '../adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js';
|
|
7
|
-
import { pythonDependencyGraphAnalyzer } from '../adapters/outbound/python/pythonDependencyGraphAnalyzer.js';
|
|
8
|
-
import { typescriptDependencyGraphAnalyzer } from '../adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js';
|
|
9
|
-
import { createFocusPackageNode } from '../domain/createFocusPackageNode.js';
|
|
10
|
-
import { readDependencyDeclarationsAsync } from '../domain/readDependencyDeclarationsAsync.js';
|
|
11
|
-
import { assertDependencyGraphProjectIds } from './assertDependencyGraphProjectIds.js';
|
|
12
|
-
/***
|
|
13
|
-
* Build one canonical dependency graph from already-inspected projects without rescanning them.
|
|
14
|
-
*/
|
|
15
|
-
export async function createDependencyGraphFromInspectionsAsync(input) {
|
|
16
|
-
assertDependencyGraphProjectIds(input.projects);
|
|
17
|
-
const analyzers = input.analyzers ?? [
|
|
18
|
-
typescriptDependencyGraphAnalyzer,
|
|
19
|
-
cppDependencyGraphAnalyzer,
|
|
20
|
-
delphiDependencyGraphAnalyzer,
|
|
21
|
-
javaDependencyGraphAnalyzer,
|
|
22
|
-
kotlinDependencyGraphAnalyzer,
|
|
23
|
-
pythonDependencyGraphAnalyzer,
|
|
24
|
-
];
|
|
25
|
-
const inspected = await Promise.all(input.projects.map(createInspectedInputAsync));
|
|
26
|
-
const packages = inspected.flatMap(({ packages: projectPackages }) => projectPackages);
|
|
27
|
-
const focusPackages = createFocusPackageMap(packages);
|
|
28
|
-
const fragments = await analyzePackagesAsync(inspected, analyzers, focusPackages, input.signal);
|
|
29
|
-
const nodes = new Map(packages.map((packageContext) => {
|
|
30
|
-
const node = createFocusPackageNode(packageContext);
|
|
31
|
-
return [node.id, node];
|
|
32
|
-
}));
|
|
33
|
-
for (const node of fragments.flatMap(({ nodes: fragmentNodes }) => fragmentNodes)) {
|
|
34
|
-
if (!nodes.has(node.id))
|
|
35
|
-
nodes.set(node.id, node);
|
|
36
|
-
}
|
|
37
|
-
const edges = fragments.flatMap(({ edges: fragmentEdges }) => fragmentEdges);
|
|
38
|
-
return createGraph({ nodes: [...nodes.values()], edges });
|
|
39
|
-
}
|
|
40
|
-
/*** Normalize one supplied inspection into dependency-analysis package contexts. */
|
|
41
|
-
async function createInspectedInputAsync(project) {
|
|
42
|
-
const { inspection } = project;
|
|
43
|
-
if (!inspection.complete) {
|
|
44
|
-
throw new Error(`Dependency graph inspection is incomplete for "${project.id}": ${inspection.diagnostics
|
|
45
|
-
.map(({ message }) => message)
|
|
46
|
-
.join('; ')}`);
|
|
47
|
-
}
|
|
48
|
-
const detectedPackages = selectFocusPackages(inspection);
|
|
49
|
-
const packageRoots = inspection.packages.map(({ rootPath }) => path.resolve(inspection.rootPath, rootPath));
|
|
50
|
-
const packages = await Promise.all(detectedPackages.map(async (detected) => {
|
|
51
|
-
const relativeRoot = detected.rootPath;
|
|
52
|
-
const id = `${project.id}:${relativeRoot}`;
|
|
53
|
-
const manifestPath = detected.manifestPath === ''
|
|
54
|
-
? undefined
|
|
55
|
-
: path.join(inspection.rootPath, detected.manifestPath);
|
|
56
|
-
return {
|
|
57
|
-
id,
|
|
58
|
-
nodeId: `package:${id}`,
|
|
59
|
-
projectId: project.id,
|
|
60
|
-
rootPath: path.resolve(inspection.rootPath, relativeRoot),
|
|
61
|
-
relativeRoot,
|
|
62
|
-
...(detected.name === undefined ? {} : { name: detected.name }),
|
|
63
|
-
detection: detected.detection,
|
|
64
|
-
declarations: await readDependencyDeclarationsAsync(manifestPath),
|
|
65
|
-
};
|
|
66
|
-
}));
|
|
67
|
-
return { inspection, packageRoots, packages };
|
|
68
|
-
}
|
|
69
|
-
/*** Select the repository root plus packages declared by root workspace metadata as graph focus. */
|
|
70
|
-
function selectFocusPackages(inspection) {
|
|
71
|
-
const rootPackage = inspection.packages.find(({ rootPath }) => rootPath === '.');
|
|
72
|
-
const workspaceRoots = new Set(inspection.workspaces
|
|
73
|
-
.filter(({ rootPath }) => rootPath === '.')
|
|
74
|
-
.flatMap(({ packagePaths }) => packagePaths));
|
|
75
|
-
const workspacePackages = inspection.packages.filter(({ rootPath }) => rootPath !== '.' && workspaceRoots.has(rootPath));
|
|
76
|
-
const root = rootPackage ?? { rootPath: '.', detection: inspection.detection, manifestPath: '' };
|
|
77
|
-
return [root, ...workspacePackages];
|
|
78
|
-
}
|
|
79
|
-
/*** Analyze each package with the first compatible analyzer while preserving mixed-language inputs. */
|
|
80
|
-
async function analyzePackagesAsync(inspected, analyzers, focusPackages, signal) {
|
|
81
|
-
const tasks = inspected.flatMap(({ inspection, packageRoots, packages }) => packages.flatMap((packageContext) => {
|
|
82
|
-
const analyzer = analyzers.find(({ supports }) => supports(packageContext.detection));
|
|
83
|
-
if (analyzer === undefined)
|
|
84
|
-
return [];
|
|
85
|
-
const excludedRoots = packageRoots.filter((rootPath) => rootPath !== packageContext.rootPath &&
|
|
86
|
-
rootPath.startsWith(`${packageContext.rootPath}${path.sep}`));
|
|
87
|
-
return [
|
|
88
|
-
analyzer.analyzeAsync({
|
|
89
|
-
package: packageContext,
|
|
90
|
-
inspection,
|
|
91
|
-
focusPackages,
|
|
92
|
-
excludedRoots,
|
|
93
|
-
...(signal === undefined ? {} : { signal }),
|
|
94
|
-
}),
|
|
95
|
-
];
|
|
96
|
-
}));
|
|
97
|
-
if (tasks.length === 0) {
|
|
98
|
-
throw new Error('No dependency graph analyzer supports the supplied projects.');
|
|
99
|
-
}
|
|
100
|
-
return Promise.all(tasks);
|
|
101
|
-
}
|
|
102
|
-
/*** Build a unique package-name map for focus routing across repositories and workspaces. */
|
|
103
|
-
function createFocusPackageMap(packages) {
|
|
104
|
-
const named = packages.filter((packageContext) => packageContext.name !== undefined);
|
|
105
|
-
const duplicates = named.filter((item, index) => named.findIndex(({ name }) => name === item.name) !== index);
|
|
106
|
-
if (duplicates.length > 0) {
|
|
107
|
-
throw new Error(`Duplicate focus package name: ${duplicates[0]?.name ?? 'unknown'}.`);
|
|
108
|
-
}
|
|
109
|
-
return new Map(named.map(({ name, nodeId }) => [name, nodeId]));
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=createDependencyGraphFromInspectionsAsync.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyGraphFromInspectionsAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAW/C,OAAO,EAAE,0BAA0B,EAAE,MAAM,wDAAwD,CAAC;AACpG,OAAO,EAAE,6BAA6B,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,EAAE,2BAA2B,EAAE,MAAM,0DAA0D,CAAC;AACvG,OAAO,EAAE,6BAA6B,EAAE,MAAM,8DAA8D,CAAC;AAC7G,OAAO,EAAE,6BAA6B,EAAE,MAAM,8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ACH,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;IAEF,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,8DAA8D,CAAC,CAAC;IAClF,CAAC;IACD,OAAO,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED,6FAA6F;AAC7F,SAAS,qBAAqB,CAC5B,QAA2C;IAE3C,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAC3B,CAAC,cAAc,EAAwE,EAAE,CACvF,cAAc,CAAC,IAAI,KAAK,SAAS,CACpC,CAAC;IACF,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAC7B,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,CAC7E,CAAC;IACF,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,iCAAiC,UAAU,CAAC,CAAC,CAAC,EAAE,IAAI,IAAI,SAAS,GAAG,CAAC,CAAC;IACxF,CAAC;IACD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC","sourcesContent":["import path from 'node:path';\n\nimport { createGraph } from '@ankhorage/graph';\nimport type { InspectedPackage, ProjectInspection } from '@ankhorage/project-detector/types';\n\nimport type {\n CreateDependencyGraphFromInspectionsInput,\n DependencyGraph,\n DependencyGraphAnalyzer,\n DependencyGraphFragment,\n DependencyGraphInspectionProjectInput,\n DependencyGraphPackage,\n} from '../../../types/dependencyGraph.js';\nimport { cppDependencyGraphAnalyzer } from '../adapters/outbound/cpp/cppDependencyGraphAnalyzer.js';\nimport { delphiDependencyGraphAnalyzer } from '../adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js';\nimport { javaDependencyGraphAnalyzer } from '../adapters/outbound/java/javaDependencyGraphAnalyzer.js';\nimport { kotlinDependencyGraphAnalyzer } from '../adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js';\nimport { pythonDependencyGraphAnalyzer } from '../adapters/outbound/python/pythonDependencyGraphAnalyzer.js';\nimport { typescriptDependencyGraphAnalyzer } from '../adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js';\nimport { createFocusPackageNode } from '../domain/createFocusPackageNode.js';\nimport { readDependencyDeclarationsAsync } from '../domain/readDependencyDeclarationsAsync.js';\nimport { assertDependencyGraphProjectIds } from './assertDependencyGraphProjectIds.js';\n\n/***\n * Build one canonical dependency graph from already-inspected projects without rescanning them.\n */\nexport async function createDependencyGraphFromInspectionsAsync(\n input: CreateDependencyGraphFromInspectionsInput,\n): Promise<DependencyGraph> {\n assertDependencyGraphProjectIds(input.projects);\n const analyzers = input.analyzers ?? [\n typescriptDependencyGraphAnalyzer,\n cppDependencyGraphAnalyzer,\n delphiDependencyGraphAnalyzer,\n javaDependencyGraphAnalyzer,\n kotlinDependencyGraphAnalyzer,\n pythonDependencyGraphAnalyzer,\n ];\n const inspected = await Promise.all(input.projects.map(createInspectedInputAsync));\n const packages = inspected.flatMap(({ packages: projectPackages }) => projectPackages);\n const focusPackages = createFocusPackageMap(packages);\n const fragments = await analyzePackagesAsync(inspected, analyzers, focusPackages, input.signal);\n const nodes = new Map(\n packages.map((packageContext) => {\n const node = createFocusPackageNode(packageContext);\n return [node.id, node] as const;\n }),\n );\n\n for (const node of fragments.flatMap(({ nodes: fragmentNodes }) => fragmentNodes)) {\n if (!nodes.has(node.id)) nodes.set(node.id, node);\n }\n\n const edges = fragments.flatMap(({ edges: fragmentEdges }) => fragmentEdges);\n return createGraph({ nodes: [...nodes.values()], edges });\n}\n\ninterface InspectedInput {\n readonly inspection: ProjectInspection;\n readonly packageRoots: readonly string[];\n readonly packages: readonly DependencyGraphPackage[];\n}\n\n/*** Normalize one supplied inspection into dependency-analysis package contexts. */\nasync function createInspectedInputAsync(\n project: DependencyGraphInspectionProjectInput,\n): Promise<InspectedInput> {\n const { inspection } = project;\n if (!inspection.complete) {\n throw new Error(\n `Dependency graph inspection is incomplete for \"${project.id}\": ${inspection.diagnostics\n .map(({ message }) => message)\n .join('; ')}`,\n );\n }\n\n const detectedPackages = selectFocusPackages(inspection);\n const packageRoots = inspection.packages.map(({ rootPath }) =>\n path.resolve(inspection.rootPath, rootPath),\n );\n\n const packages = await Promise.all(\n detectedPackages.map(async (detected) => {\n const relativeRoot = detected.rootPath;\n const id = `${project.id}:${relativeRoot}`;\n const manifestPath =\n detected.manifestPath === ''\n ? undefined\n : path.join(inspection.rootPath, detected.manifestPath);\n\n return {\n id,\n nodeId: `package:${id}`,\n projectId: project.id,\n rootPath: path.resolve(inspection.rootPath, relativeRoot),\n relativeRoot,\n ...(detected.name === undefined ? {} : { name: detected.name }),\n detection: detected.detection,\n declarations: await readDependencyDeclarationsAsync(manifestPath),\n } satisfies DependencyGraphPackage;\n }),\n );\n\n return { inspection, packageRoots, packages };\n}\n\n/*** Select the repository root plus packages declared by root workspace metadata as graph focus. */\nfunction selectFocusPackages(inspection: ProjectInspection): readonly InspectedPackage[] {\n const rootPackage = inspection.packages.find(({ rootPath }) => rootPath === '.');\n const workspaceRoots = new Set(\n inspection.workspaces\n .filter(({ rootPath }) => rootPath === '.')\n .flatMap(({ packagePaths }) => packagePaths),\n );\n const workspacePackages = inspection.packages.filter(\n ({ rootPath }) => rootPath !== '.' && workspaceRoots.has(rootPath),\n );\n const root = rootPackage ?? { rootPath: '.', detection: inspection.detection, manifestPath: '' };\n return [root, ...workspacePackages];\n}\n\n/*** Analyze each package with the first compatible analyzer while preserving mixed-language inputs. */\nasync function analyzePackagesAsync(\n inspected: readonly InspectedInput[],\n analyzers: readonly DependencyGraphAnalyzer[],\n focusPackages: ReadonlyMap<string, string>,\n signal: AbortSignal | undefined,\n): Promise<readonly DependencyGraphFragment[]> {\n const tasks = inspected.flatMap(({ inspection, packageRoots, packages }) =>\n packages.flatMap((packageContext) => {\n const analyzer = analyzers.find(({ supports }) => supports(packageContext.detection));\n if (analyzer === undefined) return [];\n\n const excludedRoots = packageRoots.filter(\n (rootPath) =>\n rootPath !== packageContext.rootPath &&\n rootPath.startsWith(`${packageContext.rootPath}${path.sep}`),\n );\n\n return [\n analyzer.analyzeAsync({\n package: packageContext,\n inspection,\n focusPackages,\n excludedRoots,\n ...(signal === undefined ? {} : { signal }),\n }),\n ];\n }),\n );\n\n if (tasks.length === 0) {\n throw new Error('No dependency graph analyzer supports the supplied projects.');\n }\n return Promise.all(tasks);\n}\n\n/*** Build a unique package-name map for focus routing across repositories and workspaces. */\nfunction createFocusPackageMap(\n packages: readonly DependencyGraphPackage[],\n): ReadonlyMap<string, string> {\n const named = packages.filter(\n (packageContext): packageContext is DependencyGraphPackage & { readonly name: string } =>\n packageContext.name !== undefined,\n );\n const duplicates = named.filter(\n (item, index) => named.findIndex(({ name }) => name === item.name) !== index,\n );\n if (duplicates.length > 0) {\n throw new Error(`Duplicate focus package name: ${duplicates[0]?.name ?? 'unknown'}.`);\n }\n return new Map(named.map(({ name, nodeId }) => [name, nodeId]));\n}\n"]}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { DependencyGraphAnalyzerContext } from '../../../types/dependencyGraph.js';
|
|
2
|
-
/*** Select source files from Project Detector's pruned scan without traversing the filesystem again. */
|
|
3
|
-
export declare function collectInspectedSourceFiles(context: DependencyGraphAnalyzerContext, sourceRoots: readonly string[], isSourceFile: (file: string) => boolean, ignoredDirectoryNames: readonly string[]): readonly string[];
|
|
4
|
-
//# sourceMappingURL=collectInspectedSourceFiles.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collectInspectedSourceFiles.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/utils/collectInspectedSourceFiles.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AAExF,wGAAwG;AACxG,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,8BAA8B,EACvC,WAAW,EAAE,SAAS,MAAM,EAAE,EAC9B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,EACvC,qBAAqB,EAAE,SAAS,MAAM,EAAE,GACvC,SAAS,MAAM,EAAE,CAmBnB"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { toPortablePath } from '@ankhorage/utility/node/path';
|
|
3
|
-
/*** Select source files from Project Detector's pruned scan without traversing the filesystem again. */
|
|
4
|
-
export function collectInspectedSourceFiles(context, sourceRoots, isSourceFile, ignoredDirectoryNames) {
|
|
5
|
-
const ignored = new Set(ignoredDirectoryNames);
|
|
6
|
-
return context.inspection.files
|
|
7
|
-
.flatMap((file) => {
|
|
8
|
-
context.signal?.throwIfAborted();
|
|
9
|
-
const absolute = path.resolve(context.inspection.rootPath, ...file.split('/'));
|
|
10
|
-
const relative = path.relative(context.package.rootPath, absolute);
|
|
11
|
-
if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {
|
|
12
|
-
return [];
|
|
13
|
-
}
|
|
14
|
-
const portable = toPortablePath(relative);
|
|
15
|
-
if (!isSourceFile(portable))
|
|
16
|
-
return [];
|
|
17
|
-
if (context.excludedRoots.some((root) => absolute.startsWith(`${root}${path.sep}`))) {
|
|
18
|
-
return [];
|
|
19
|
-
}
|
|
20
|
-
if (!sourceRoots.some((root) => isWithinSourceRoot(portable, root, ignored)))
|
|
21
|
-
return [];
|
|
22
|
-
return [absolute];
|
|
23
|
-
})
|
|
24
|
-
.sort();
|
|
25
|
-
}
|
|
26
|
-
/*** Apply an analyzer's source-root and ignored-directory rules to one inspected file. */
|
|
27
|
-
function isWithinSourceRoot(relative, sourceRoot, ignored) {
|
|
28
|
-
if (sourceRoot !== '.' && !relative.startsWith(`${sourceRoot}/`))
|
|
29
|
-
return false;
|
|
30
|
-
const withinRoot = sourceRoot === '.' ? relative : relative.slice(sourceRoot.length + 1);
|
|
31
|
-
return !withinRoot
|
|
32
|
-
.split('/')
|
|
33
|
-
.slice(0, -1)
|
|
34
|
-
.some((directory) => ignored.has(directory));
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=collectInspectedSourceFiles.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collectInspectedSourceFiles.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/utils/collectInspectedSourceFiles.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAI9D,wGAAwG;AACxG,MAAM,UAAU,2BAA2B,CACzC,OAAuC,EACvC,WAA8B,EAC9B,YAAuC,EACvC,qBAAwC;IAExC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,qBAAqB,CAAC,CAAC;IAC/C,OAAO,OAAO,CAAC,UAAU,CAAC,KAAK;SAC5B,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QAChB,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/E,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACnE,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,C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node/path';\n\nimport type { DependencyGraphAnalyzerContext } from '../../../types/dependencyGraph.js';\n\n/*** Select source files from Project Detector's pruned scan without traversing the filesystem again. */\nexport function collectInspectedSourceFiles(\n context: DependencyGraphAnalyzerContext,\n sourceRoots: readonly string[],\n isSourceFile: (file: string) => boolean,\n ignoredDirectoryNames: readonly string[],\n): readonly string[] {\n const ignored = new Set(ignoredDirectoryNames);\n return context.inspection.files\n .flatMap((file) => {\n context.signal?.throwIfAborted();\n const absolute = path.resolve(context.inspection.rootPath, ...file.split('/'));\n const relative = path.relative(context.package.rootPath, absolute);\n if (relative === '..' || relative.startsWith(`..${path.sep}`) || path.isAbsolute(relative)) {\n return [];\n }\n const portable = toPortablePath(relative);\n if (!isSourceFile(portable)) return [];\n if (context.excludedRoots.some((root) => absolute.startsWith(`${root}${path.sep}`))) {\n return [];\n }\n if (!sourceRoots.some((root) => isWithinSourceRoot(portable, root, ignored))) return [];\n return [absolute];\n })\n .sort();\n}\n\n/*** Apply an analyzer's source-root and ignored-directory rules to one inspected file. */\nfunction isWithinSourceRoot(\n relative: string,\n sourceRoot: string,\n ignored: ReadonlySet<string>,\n): boolean {\n if (sourceRoot !== '.' && !relative.startsWith(`${sourceRoot}/`)) return false;\n const withinRoot = sourceRoot === '.' ? relative : relative.slice(sourceRoot.length + 1);\n return !withinRoot\n .split('/')\n .slice(0, -1)\n .some((directory) => ignored.has(directory));\n}\n"]}
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
/*** Resolve the longest source-declared package that contains one dotted import reference. */
|
|
2
|
-
export declare function findIntrinsicPackageForReference(reference: string, intrinsicPackages: ReadonlySet<string>): string | undefined;
|
|
3
|
-
//# sourceMappingURL=findIntrinsicPackageForReference.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findIntrinsicPackageForReference.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/utils/findIntrinsicPackageForReference.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,GACrC,MAAM,GAAG,SAAS,CAKpB"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
/*** Resolve the longest source-declared package that contains one dotted import reference. */
|
|
2
|
-
export function findIntrinsicPackageForReference(reference, intrinsicPackages) {
|
|
3
|
-
return [...intrinsicPackages]
|
|
4
|
-
.filter((packageName) => reference === packageName || reference.startsWith(`${packageName}.`))
|
|
5
|
-
.sort((left, right) => right.length - left.length)
|
|
6
|
-
.at(0);
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=findIntrinsicPackageForReference.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"findIntrinsicPackageForReference.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/utils/findIntrinsicPackageForReference.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,MAAM,UAAU,gCAAgC,CAC9C,SAAiB,EACjB,iBAAsC;IAEtC,OAAO,CAAC,GAAG,iBAAiB,CAAC;SAC1B,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,SAAS,KAAK,WAAW,IAAI,SAAS,CAAC,UAAU,CAAC,GAAG,WAAW,GAAG,CAAC,CAAC;SAC7F,IAAI,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;SACjD,EAAE,CAAC,CAAC,CAAC,CAAC;AACX,CAAC","sourcesContent":["/*** Resolve the longest source-declared package that contains one dotted import reference. */\nexport function findIntrinsicPackageForReference(\n reference: string,\n intrinsicPackages: ReadonlySet<string>,\n): string | undefined {\n return [...intrinsicPackages]\n .filter((packageName) => reference === packageName || reference.startsWith(`${packageName}.`))\n .sort((left, right) => right.length - left.length)\n .at(0);\n}\n"]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|