@ankhorage/dependency-graph 0.6.2 → 0.7.1

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.
Files changed (22) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +16 -2
  3. package/dist/dependencyGraph.d.ts +2 -1
  4. package/dist/dependencyGraph.d.ts.map +1 -1
  5. package/dist/dependencyGraph.js +1 -0
  6. package/dist/dependencyGraph.js.map +1 -1
  7. package/dist/features/dependency-analysis/application/assertDependencyGraphProjectIds.d.ts +5 -0
  8. package/dist/features/dependency-analysis/application/assertDependencyGraphProjectIds.d.ts.map +1 -0
  9. package/dist/features/dependency-analysis/application/assertDependencyGraphProjectIds.js +14 -0
  10. package/dist/features/dependency-analysis/application/assertDependencyGraphProjectIds.js.map +1 -0
  11. package/dist/features/dependency-analysis/application/createDependencyGraphAsync.d.ts +1 -1
  12. package/dist/features/dependency-analysis/application/createDependencyGraphAsync.d.ts.map +1 -1
  13. package/dist/features/dependency-analysis/application/createDependencyGraphAsync.js +14 -112
  14. package/dist/features/dependency-analysis/application/createDependencyGraphAsync.js.map +1 -1
  15. package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.d.ts +6 -0
  16. package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.d.ts.map +1 -0
  17. package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js +111 -0
  18. package/dist/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js.map +1 -0
  19. package/dist/types/dependencyGraph.d.ts +9 -0
  20. package/dist/types/dependencyGraph.d.ts.map +1 -1
  21. package/dist/types/dependencyGraph.js.map +1 -1
  22. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @ankhorage/dependency-graph
2
2
 
3
+ ## 0.7.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 6d555e3: Scope dependency-analysis focus packages to the selected root and root-declared workspaces while retaining unrelated nested package roots as analysis boundaries.
8
+
9
+ ## 0.7.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 3587a10: Allow dependency analysis to consume existing Project Detector inspections without rescanning project roots, while keeping the path-based API as a convenience wrapper.
14
+
3
15
  ## 0.6.2
4
16
 
5
17
  ### Patch Changes
package/README.md CHANGED
@@ -1,5 +1,19 @@
1
+ <!-- markdownlint-disable MD013 MD033 -->
2
+ <!-- This file is generated by Paradox. Do not edit manually. -->
3
+
1
4
  # @ankhorage/dependency-graph
2
5
 
3
- Project-aware dependency analysis that produces canonical `@ankhorage/graph` data.
6
+ ![license: MIT](././paradox/badges/license.svg) ![npm: v0.7.0](././paradox/badges/npm.svg) ![runtime: bun](././paradox/badges/runtime.svg) ![typescript: strict](././paradox/badges/typescript.svg) ![eslint: checked](././paradox/badges/eslint.svg) ![prettier: checked](././paradox/badges/prettier.svg) ![build: checked](././paradox/badges/build.svg) ![tests: checked](././paradox/badges/tests.svg) ![docs: paradox](././paradox/badges/docs.svg)
7
+
8
+ Project-aware dependency analysis that produces canonical Ankhorage graphs.
9
+
10
+ ## Generated documentation
4
11
 
5
- The first analyzer covers TypeScript static imports. Project detection is delegated to `@ankhorage/project-detector`. Cytoscape, UI, update execution, and GitHub transport are intentionally outside this package.
12
+ - [Interactive documentation app](././paradox/index.html)
13
+ - [Public API reference](././paradox/exports.md)
14
+ - [Component registry](././paradox/components.md)
15
+ - [Architecture overview](././paradox/diagrams/architecture-overview.mmd)
16
+ - [Module relationships](././paradox/diagrams/module-relationships.mmd)
17
+ - [Export graph](././paradox/diagrams/export-graph.mmd)
18
+ - [createDependencyGraphAsync sequence](././paradox/diagrams/sequences/create-dependency-graph-async.mmd)
19
+ - [createDependencyGraphFromInspectionsAsync sequence](././paradox/diagrams/sequences/create-dependency-graph-from-inspections-async.mmd)
@@ -5,5 +5,6 @@ export { kotlinDependencyGraphAnalyzer } from './features/dependency-analysis/ad
5
5
  export { pythonDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js';
6
6
  export { typescriptDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js';
7
7
  export { createDependencyGraphAsync } from './features/dependency-analysis/application/createDependencyGraphAsync.js';
8
- export type { CreateDependencyGraphInput, DependencyDeclaration, DependencyDeclarationKind, DependencyGraph, DependencyGraphAnalyzer, DependencyGraphAnalyzerContext, DependencyGraphEdgeData, DependencyGraphFragment, DependencyGraphNodeData, DependencyGraphPackage, DependencyGraphProjectInput, DependencyImportEvidence, DependencyNodeClassification, DependencyNodeKind, DependencyReferenceClassification, } from './types/dependencyGraph.js';
8
+ export { createDependencyGraphFromInspectionsAsync } from './features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js';
9
+ export type { CreateDependencyGraphFromInspectionsInput, CreateDependencyGraphInput, DependencyDeclaration, DependencyDeclarationKind, DependencyGraph, DependencyGraphAnalyzer, DependencyGraphAnalyzerContext, DependencyGraphEdgeData, DependencyGraphFragment, DependencyGraphInspectionProjectInput, DependencyGraphNodeData, DependencyGraphPackage, DependencyGraphProjectInput, DependencyImportEvidence, DependencyNodeClassification, DependencyNodeKind, DependencyReferenceClassification, } from './types/dependencyGraph.js';
9
10
  //# sourceMappingURL=dependencyGraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyGraph.d.ts","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oFAAoF,CAAC;AAChI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,2BAA2B,EAAE,MAAM,sFAAsF,CAAC;AACnI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,iCAAiC,EAAE,MAAM,kGAAkG,CAAC;AACrJ,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,YAAY,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,iCAAiC,GAClC,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"dependencyGraph.d.ts","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oFAAoF,CAAC;AAChI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,2BAA2B,EAAE,MAAM,sFAAsF,CAAC;AACnI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,iCAAiC,EAAE,MAAM,kGAAkG,CAAC;AACrJ,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,OAAO,EAAE,yCAAyC,EAAE,MAAM,yFAAyF,CAAC;AACpJ,YAAY,EACV,yCAAyC,EACzC,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,uBAAuB,EACvB,8BAA8B,EAC9B,uBAAuB,EACvB,uBAAuB,EACvB,qCAAqC,EACrC,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,iCAAiC,GAClC,MAAM,4BAA4B,CAAC"}
@@ -5,4 +5,5 @@ export { kotlinDependencyGraphAnalyzer } from './features/dependency-analysis/ad
5
5
  export { pythonDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js';
6
6
  export { typescriptDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js';
7
7
  export { createDependencyGraphAsync } from './features/dependency-analysis/application/createDependencyGraphAsync.js';
8
+ export { createDependencyGraphFromInspectionsAsync } from './features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js';
8
9
  //# sourceMappingURL=dependencyGraph.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oFAAoF,CAAC;AAChI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,2BAA2B,EAAE,MAAM,sFAAsF,CAAC;AACnI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,iCAAiC,EAAE,MAAM,kGAAkG,CAAC;AACrJ,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC","sourcesContent":["export { cppDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.js';\nexport { delphiDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js';\nexport { javaDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.js';\nexport { kotlinDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js';\nexport { pythonDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js';\nexport { typescriptDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js';\nexport { createDependencyGraphAsync } from './features/dependency-analysis/application/createDependencyGraphAsync.js';\nexport type {\n CreateDependencyGraphInput,\n DependencyDeclaration,\n DependencyDeclarationKind,\n DependencyGraph,\n DependencyGraphAnalyzer,\n DependencyGraphAnalyzerContext,\n DependencyGraphEdgeData,\n DependencyGraphFragment,\n DependencyGraphNodeData,\n DependencyGraphPackage,\n DependencyGraphProjectInput,\n DependencyImportEvidence,\n DependencyNodeClassification,\n DependencyNodeKind,\n DependencyReferenceClassification,\n} from './types/dependencyGraph.js';\n"]}
1
+ {"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oFAAoF,CAAC;AAChI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,2BAA2B,EAAE,MAAM,sFAAsF,CAAC;AACnI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,6BAA6B,EAAE,MAAM,0FAA0F,CAAC;AACzI,OAAO,EAAE,iCAAiC,EAAE,MAAM,kGAAkG,CAAC;AACrJ,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,OAAO,EAAE,yCAAyC,EAAE,MAAM,yFAAyF,CAAC","sourcesContent":["export { cppDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/cpp/cppDependencyGraphAnalyzer.js';\nexport { delphiDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js';\nexport { javaDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/java/javaDependencyGraphAnalyzer.js';\nexport { kotlinDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js';\nexport { pythonDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/python/pythonDependencyGraphAnalyzer.js';\nexport { typescriptDependencyGraphAnalyzer } from './features/dependency-analysis/adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js';\nexport { createDependencyGraphAsync } from './features/dependency-analysis/application/createDependencyGraphAsync.js';\nexport { createDependencyGraphFromInspectionsAsync } from './features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.js';\nexport type {\n CreateDependencyGraphFromInspectionsInput,\n CreateDependencyGraphInput,\n DependencyDeclaration,\n DependencyDeclarationKind,\n DependencyGraph,\n DependencyGraphAnalyzer,\n DependencyGraphAnalyzerContext,\n DependencyGraphEdgeData,\n DependencyGraphFragment,\n DependencyGraphInspectionProjectInput,\n DependencyGraphNodeData,\n DependencyGraphPackage,\n DependencyGraphProjectInput,\n DependencyImportEvidence,\n DependencyNodeClassification,\n DependencyNodeKind,\n DependencyReferenceClassification,\n} from './types/dependencyGraph.js';\n"]}
@@ -0,0 +1,5 @@
1
+ /*** Reject empty or duplicate dependency-graph project IDs before analysis. */
2
+ export declare function assertDependencyGraphProjectIds(projects: readonly {
3
+ readonly id: string;
4
+ }[]): void;
5
+ //# sourceMappingURL=assertDependencyGraphProjectIds.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertDependencyGraphProjectIds.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/assertDependencyGraphProjectIds.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE,SAAS;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,EAAE,GAC3C,IAAI,CAYN"}
@@ -0,0 +1,14 @@
1
+ /*** Reject empty or duplicate dependency-graph project IDs before analysis. */
2
+ export function assertDependencyGraphProjectIds(projects) {
3
+ if (projects.length === 0) {
4
+ throw new Error('At least one dependency graph project is required.');
5
+ }
6
+ const ids = projects.map(({ id }) => id);
7
+ if (ids.some((id) => id.trim() === '')) {
8
+ throw new Error('Dependency graph project IDs must be non-empty.');
9
+ }
10
+ if (new Set(ids).size !== ids.length) {
11
+ throw new Error('Dependency graph project IDs must be unique.');
12
+ }
13
+ }
14
+ //# sourceMappingURL=assertDependencyGraphProjectIds.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assertDependencyGraphProjectIds.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/assertDependencyGraphProjectIds.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,UAAU,+BAA+B,CAC7C,QAA4C;IAE5C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACzC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;AACH,CAAC","sourcesContent":["/*** Reject empty or duplicate dependency-graph project IDs before analysis. */\nexport function assertDependencyGraphProjectIds(\n projects: readonly { readonly id: string }[],\n): void {\n if (projects.length === 0) {\n throw new Error('At least one dependency graph project is required.');\n }\n\n const ids = projects.map(({ id }) => id);\n if (ids.some((id) => id.trim() === '')) {\n throw new Error('Dependency graph project IDs must be non-empty.');\n }\n if (new Set(ids).size !== ids.length) {\n throw new Error('Dependency graph project IDs must be unique.');\n }\n}\n"]}
@@ -1,4 +1,4 @@
1
1
  import type { CreateDependencyGraphInput, DependencyGraph } from '../../../types/dependencyGraph.js';
2
- /*** Inspect projects, run supported analyzers and combine their evidence into one canonical graph. */
2
+ /*** Inspect project roots, then delegate dependency topology construction to the inspection API. */
3
3
  export declare function createDependencyGraphAsync(input: CreateDependencyGraphInput): Promise<DependencyGraph>;
4
4
  //# sourceMappingURL=createDependencyGraphAsync.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createDependencyGraphAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphAsync.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,0BAA0B,EAC1B,eAAe,EAKhB,MAAM,mCAAmC,CAAC;AAU3C,sGAAsG;AACtG,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,eAAe,CAAC,CA6B1B"}
1
+ {"version":3,"file":"createDependencyGraphAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphAsync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,0BAA0B,EAC1B,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAI3C,oGAAoG;AACpG,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,0BAA0B,GAChC,OAAO,CAAC,eAAe,CAAC,CAgB1B"}
@@ -1,117 +1,19 @@
1
- import path from 'node:path';
2
- import { createGraph } from '@ankhorage/graph';
3
1
  import { inspectProjectAsync } from '@ankhorage/project-detector/node';
4
- import { cppDependencyGraphAnalyzer } from '../adapters/outbound/cpp/cppDependencyGraphAnalyzer.js';
5
- import { delphiDependencyGraphAnalyzer } from '../adapters/outbound/delphi/delphiDependencyGraphAnalyzer.js';
6
- import { javaDependencyGraphAnalyzer } from '../adapters/outbound/java/javaDependencyGraphAnalyzer.js';
7
- import { kotlinDependencyGraphAnalyzer } from '../adapters/outbound/kotlin/kotlinDependencyGraphAnalyzer.js';
8
- import { pythonDependencyGraphAnalyzer } from '../adapters/outbound/python/pythonDependencyGraphAnalyzer.js';
9
- import { typescriptDependencyGraphAnalyzer } from '../adapters/outbound/typescript/typescriptDependencyGraphAnalyzer.js';
10
- import { createFocusPackageNode } from '../domain/createFocusPackageNode.js';
11
- import { readDependencyDeclarationsAsync } from '../domain/readDependencyDeclarationsAsync.js';
12
- /*** Inspect projects, run supported analyzers and combine their evidence into one canonical graph. */
2
+ import { assertDependencyGraphProjectIds } from './assertDependencyGraphProjectIds.js';
3
+ import { createDependencyGraphFromInspectionsAsync } from './createDependencyGraphFromInspectionsAsync.js';
4
+ /*** Inspect project roots, then delegate dependency topology construction to the inspection API. */
13
5
  export async function createDependencyGraphAsync(input) {
14
- assertProjectInputs(input.projects);
15
- const analyzers = input.analyzers ?? [
16
- typescriptDependencyGraphAnalyzer,
17
- cppDependencyGraphAnalyzer,
18
- delphiDependencyGraphAnalyzer,
19
- javaDependencyGraphAnalyzer,
20
- kotlinDependencyGraphAnalyzer,
21
- pythonDependencyGraphAnalyzer,
22
- ];
23
- const inspected = await Promise.all(input.projects.map((project) => inspectProjectInputAsync(project, input.signal)));
24
- const packages = inspected.flatMap(({ packages }) => packages);
25
- const focusPackages = createFocusPackageMap(packages);
26
- const fragments = await analyzePackagesAsync(inspected, analyzers, focusPackages, input.signal);
27
- const nodes = new Map(packages.map((packageContext) => {
28
- const node = createFocusPackageNode(packageContext);
29
- return [node.id, node];
30
- }));
31
- for (const node of fragments.flatMap(({ nodes: fragmentNodes }) => fragmentNodes)) {
32
- if (!nodes.has(node.id))
33
- nodes.set(node.id, node);
34
- }
35
- const edges = fragments.flatMap(({ edges: fragmentEdges }) => fragmentEdges);
36
- return createGraph({ nodes: [...nodes.values()], edges });
37
- }
38
- /*** Inspect one input and normalize its package/workspace contexts. */
39
- async function inspectProjectInputAsync(project, signal) {
40
- const inspection = await inspectProjectAsync(project.rootPath, {
41
- ...(signal === undefined ? {} : { signal }),
6
+ assertDependencyGraphProjectIds(input.projects);
7
+ const projects = await Promise.all(input.projects.map(async (project) => ({
8
+ id: project.id,
9
+ inspection: await inspectProjectAsync(project.rootPath, {
10
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
11
+ }),
12
+ })));
13
+ return createDependencyGraphFromInspectionsAsync({
14
+ projects,
15
+ ...(input.analyzers === undefined ? {} : { analyzers: input.analyzers }),
16
+ ...(input.signal === undefined ? {} : { signal: input.signal }),
42
17
  });
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 = inspection.packages.length > 0
49
- ? inspection.packages
50
- : [{ rootPath: '.', detection: inspection.detection, manifestPath: '' }];
51
- const packages = await Promise.all(detectedPackages.map(async (detected) => {
52
- const relativeRoot = detected.rootPath;
53
- const id = `${project.id}:${relativeRoot}`;
54
- const manifestPath = detected.manifestPath === ''
55
- ? undefined
56
- : path.join(inspection.rootPath, detected.manifestPath);
57
- return {
58
- id,
59
- nodeId: `package:${id}`,
60
- projectId: project.id,
61
- rootPath: path.resolve(inspection.rootPath, relativeRoot),
62
- relativeRoot,
63
- ...(detected.name === undefined ? {} : { name: detected.name }),
64
- detection: detected.detection,
65
- declarations: await readDependencyDeclarationsAsync(manifestPath),
66
- };
67
- }));
68
- return { inspection, packages };
69
- }
70
- /*** Analyze each package with the first compatible analyzer and retain mixed-language packages safely. */
71
- async function analyzePackagesAsync(inspected, analyzers, focusPackages, signal) {
72
- const tasks = inspected.flatMap(({ inspection, packages }) => packages.flatMap((packageContext) => {
73
- const analyzer = analyzers.find(({ supports }) => supports(packageContext.detection));
74
- if (analyzer === undefined)
75
- return [];
76
- const excludedRoots = packages
77
- .filter((candidate) => candidate.id !== packageContext.id &&
78
- candidate.rootPath.startsWith(`${packageContext.rootPath}${path.sep}`))
79
- .map(({ rootPath }) => rootPath);
80
- return [
81
- analyzer.analyzeAsync({
82
- package: packageContext,
83
- inspection,
84
- focusPackages,
85
- excludedRoots,
86
- ...(signal === undefined ? {} : { signal }),
87
- }),
88
- ];
89
- }));
90
- if (tasks.length === 0) {
91
- throw new Error('No dependency graph analyzer supports the supplied projects.');
92
- }
93
- return Promise.all(tasks);
94
- }
95
- /*** Build a unique package-name map for focus routing across repositories and workspaces. */
96
- function createFocusPackageMap(packages) {
97
- const named = packages.filter((packageContext) => packageContext.name !== undefined);
98
- const duplicates = named.filter((item, index) => named.findIndex(({ name }) => name === item.name) !== index);
99
- if (duplicates.length > 0) {
100
- throw new Error(`Duplicate focus package name: ${duplicates[0]?.name ?? 'unknown'}.`);
101
- }
102
- return new Map(named.map(({ name, nodeId }) => [name, nodeId]));
103
- }
104
- /*** Reject ambiguous project IDs before filesystem inspection. */
105
- function assertProjectInputs(projects) {
106
- if (projects.length === 0) {
107
- throw new Error('At least one dependency graph project is required.');
108
- }
109
- const ids = projects.map(({ id }) => id);
110
- if (ids.some((id) => id.trim() === '')) {
111
- throw new Error('Dependency graph project IDs must be non-empty.');
112
- }
113
- if (new Set(ids).size !== ids.length) {
114
- throw new Error('Dependency graph project IDs must be unique.');
115
- }
116
18
  }
117
19
  //# sourceMappingURL=createDependencyGraphAsync.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createDependencyGraphAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphAsync.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAWvE,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,8DAA8D,CAAC;AAC7G,OAAO,EAAE,iCAAiC,EAAE,MAAM,sEAAsE,CAAC;AACzH,OAAO,EAAE,sBAAsB,EAAE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AC;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;AAED,kEAAkE;AAClE,SAAS,mBAAmB,CAAC,QAAgD;IAC3E,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;IACxE,CAAC;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;IACzC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;IACrE,CAAC;IACD,IAAI,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC;QACrC,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IAClE,CAAC;AACH,CAAC","sourcesContent":["import path from 'node:path';\n\nimport { createGraph } from '@ankhorage/graph';\nimport { inspectProjectAsync } from '@ankhorage/project-detector/node';\nimport type { InspectedPackage, ProjectInspection } from '@ankhorage/project-detector/types';\n\nimport type {\n CreateDependencyGraphInput,\n DependencyGraph,\n DependencyGraphAnalyzer,\n DependencyGraphFragment,\n DependencyGraphPackage,\n DependencyGraphProjectInput,\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';\n\n/*** Inspect projects, run supported analyzers and combine their evidence into one canonical graph. */\nexport async function createDependencyGraphAsync(\n input: CreateDependencyGraphInput,\n): Promise<DependencyGraph> {\n assertProjectInputs(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(\n input.projects.map((project) => inspectProjectInputAsync(project, input.signal)),\n );\n const packages = inspected.flatMap(({ packages }) => packages);\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 packages: readonly DependencyGraphPackage[];\n}\n\n/*** Inspect one input and normalize its package/workspace contexts. */\nasync function inspectProjectInputAsync(\n project: DependencyGraphProjectInput,\n signal: AbortSignal | undefined,\n): Promise<InspectedInput> {\n const inspection = await inspectProjectAsync(project.rootPath, {\n ...(signal === undefined ? {} : { signal }),\n });\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: readonly InspectedPackage[] =\n inspection.packages.length > 0\n ? inspection.packages\n : [{ rootPath: '.', detection: inspection.detection, manifestPath: '' }];\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 return { inspection, packages };\n}\n\n/*** Analyze each package with the first compatible analyzer and retain mixed-language packages safely. */\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, packages }) =>\n packages.flatMap((packageContext) => {\n const analyzer = analyzers.find(({ supports }) => supports(packageContext.detection));\n if (analyzer === undefined) return [];\n\n const excludedRoots = packages\n .filter(\n (candidate) =>\n candidate.id !== packageContext.id &&\n candidate.rootPath.startsWith(`${packageContext.rootPath}${path.sep}`),\n )\n .map(({ rootPath }) => rootPath);\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\n/*** Reject ambiguous project IDs before filesystem inspection. */\nfunction assertProjectInputs(projects: readonly DependencyGraphProjectInput[]): void {\n if (projects.length === 0) {\n throw new Error('At least one dependency graph project is required.');\n }\n\n const ids = projects.map(({ id }) => id);\n if (ids.some((id) => id.trim() === '')) {\n throw new Error('Dependency graph project IDs must be non-empty.');\n }\n if (new Set(ids).size !== ids.length) {\n throw new Error('Dependency graph project IDs must be unique.');\n }\n}\n"]}
1
+ {"version":3,"file":"createDependencyGraphAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAMvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AACvF,OAAO,EAAE,yCAAyC,EAAE,MAAM,gDAAgD,CAAC;AAE3G,oGAAoG;AACpG,MAAM,CAAC,KAAK,UAAU,0BAA0B,CAC9C,KAAiC;IAEjC,+BAA+B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,CAChC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;QACrC,EAAE,EAAE,OAAO,CAAC,EAAE;QACd,UAAU,EAAE,MAAM,mBAAmB,CAAC,OAAO,CAAC,QAAQ,EAAE;YACtD,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;SAChE,CAAC;KACH,CAAC,CAAC,CACJ,CAAC;IAEF,OAAO,yCAAyC,CAAC;QAC/C,QAAQ;QACR,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;QACxE,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;KAChE,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { inspectProjectAsync } from '@ankhorage/project-detector/node';\n\nimport type {\n CreateDependencyGraphInput,\n DependencyGraph,\n} from '../../../types/dependencyGraph.js';\nimport { assertDependencyGraphProjectIds } from './assertDependencyGraphProjectIds.js';\nimport { createDependencyGraphFromInspectionsAsync } from './createDependencyGraphFromInspectionsAsync.js';\n\n/*** Inspect project roots, then delegate dependency topology construction to the inspection API. */\nexport async function createDependencyGraphAsync(\n input: CreateDependencyGraphInput,\n): Promise<DependencyGraph> {\n assertDependencyGraphProjectIds(input.projects);\n const projects = await Promise.all(\n input.projects.map(async (project) => ({\n id: project.id,\n inspection: await inspectProjectAsync(project.rootPath, {\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n }),\n })),\n );\n\n return createDependencyGraphFromInspectionsAsync({\n projects,\n ...(input.analyzers === undefined ? {} : { analyzers: input.analyzers }),\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n}\n"]}
@@ -0,0 +1,6 @@
1
+ import type { CreateDependencyGraphFromInspectionsInput, DependencyGraph } from '../../../types/dependencyGraph.js';
2
+ /***
3
+ * Build one canonical dependency graph from already-inspected projects without rescanning them.
4
+ */
5
+ export declare function createDependencyGraphFromInspectionsAsync(input: CreateDependencyGraphFromInspectionsInput): Promise<DependencyGraph>;
6
+ //# sourceMappingURL=createDependencyGraphFromInspectionsAsync.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDependencyGraphFromInspectionsAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/createDependencyGraphFromInspectionsAsync.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,yCAAyC,EACzC,eAAe,EAKhB,MAAM,mCAAmC,CAAC;AAW3C;;GAEG;AACH,wBAAsB,yCAAyC,CAC7D,KAAK,EAAE,yCAAyC,GAC/C,OAAO,CAAC,eAAe,CAAC,CA2B1B"}
@@ -0,0 +1,111 @@
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
@@ -0,0 +1 @@
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,8DAA8D,CAAC;AAC7G,OAAO,EAAE,iCAAiC,EAAE,MAAM,sEAAsE,CAAC;AACzH,OAAO,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,8CAA8C,CAAC;AAC/F,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAC7D,KAAgD;IAEhD,+BAA+B,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI;QACnC,iCAAiC;QACjC,0BAA0B;QAC1B,6BAA6B;QAC7B,2BAA2B;QAC3B,6BAA6B;QAC7B,6BAA6B;KAC9B,CAAC;IACF,MAAM,SAAS,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,KAAK,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AAK,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"]}
@@ -35,6 +35,10 @@ export interface DependencyGraphProjectInput {
35
35
  readonly id: string;
36
36
  readonly rootPath: string;
37
37
  }
38
+ export interface DependencyGraphInspectionProjectInput {
39
+ readonly id: string;
40
+ readonly inspection: ProjectInspection;
41
+ }
38
42
  export interface DependencyGraphPackage {
39
43
  readonly id: string;
40
44
  readonly nodeId: string;
@@ -66,4 +70,9 @@ export interface CreateDependencyGraphInput {
66
70
  readonly analyzers?: readonly DependencyGraphAnalyzer[];
67
71
  readonly signal?: AbortSignal;
68
72
  }
73
+ export interface CreateDependencyGraphFromInspectionsInput {
74
+ readonly projects: readonly DependencyGraphInspectionProjectInput[];
75
+ readonly analyzers?: readonly DependencyGraphAnalyzer[];
76
+ readonly signal?: AbortSignal;
77
+ }
69
78
  //# sourceMappingURL=dependencyGraph.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dependencyGraph.d.ts","sourceRoot":"","sources":["../../src/types/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAE7F,MAAM,MAAM,4BAA4B,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAC9E,MAAM,MAAM,iCAAiC,GAAG,4BAA4B,GAAG,OAAO,CAAC;AACvF,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,SAAS,CAAC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.ts"],"names":[],"mappings":"","sourcesContent":["import type { Graph, GraphEdge, GraphNode } from '@ankhorage/graph';\nimport type { ProjectDetection, ProjectInspection } from '@ankhorage/project-detector/types';\n\nexport type DependencyNodeClassification = 'intrinsic' | 'unknown' | 'vendor';\nexport type DependencyReferenceClassification = DependencyNodeClassification | 'focus';\nexport type DependencyNodeKind = 'module' | 'package';\nexport type DependencyDeclarationKind =\n 'dependency' | 'devDependency' | 'optionalDependency' | 'peerDependency';\n\nexport interface DependencyDeclaration {\n readonly kind: DependencyDeclarationKind;\n readonly range: string;\n}\n\nexport interface DependencyImportEvidence {\n readonly sourceFile: string;\n readonly specifier: string;\n readonly classification: DependencyReferenceClassification;\n readonly declarations: readonly DependencyDeclaration[];\n}\n\nexport interface DependencyGraphNodeData {\n readonly kind: DependencyNodeKind;\n readonly classification: DependencyNodeClassification;\n readonly focus: boolean;\n readonly label: string;\n readonly projectId?: string;\n readonly packageName?: string;\n readonly path?: string;\n readonly parentPath?: string;\n}\n\nexport interface DependencyGraphEdgeData {\n readonly kind: 'import';\n readonly analyzerId: string;\n readonly weight: number;\n readonly evidence: readonly DependencyImportEvidence[];\n}\n\nexport type DependencyGraph = Graph<DependencyGraphNodeData, DependencyGraphEdgeData>;\n\nexport interface DependencyGraphProjectInput {\n readonly id: string;\n readonly rootPath: string;\n}\n\nexport interface DependencyGraphPackage {\n readonly id: string;\n readonly nodeId: string;\n readonly projectId: string;\n readonly rootPath: string;\n readonly relativeRoot: string;\n readonly name?: string;\n readonly detection: ProjectDetection;\n readonly declarations: Readonly<Record<string, readonly DependencyDeclaration[]>>;\n}\n\nexport interface DependencyGraphFragment {\n readonly nodes: readonly GraphNode<DependencyGraphNodeData>[];\n readonly edges: readonly GraphEdge<DependencyGraphEdgeData>[];\n}\n\nexport interface DependencyGraphAnalyzerContext {\n readonly package: DependencyGraphPackage;\n readonly inspection: ProjectInspection;\n readonly focusPackages: ReadonlyMap<string, string>;\n readonly excludedRoots: readonly string[];\n readonly signal?: AbortSignal;\n}\n\nexport interface DependencyGraphAnalyzer {\n readonly id: string;\n readonly supports: (detection: ProjectDetection) => boolean;\n readonly analyzeAsync: (\n context: DependencyGraphAnalyzerContext,\n ) => Promise<DependencyGraphFragment>;\n}\n\nexport interface CreateDependencyGraphInput {\n readonly projects: readonly DependencyGraphProjectInput[];\n readonly analyzers?: readonly DependencyGraphAnalyzer[];\n readonly signal?: AbortSignal;\n}\n"]}
1
+ {"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../../src/types/dependencyGraph.ts"],"names":[],"mappings":"","sourcesContent":["import type { Graph, GraphEdge, GraphNode } from '@ankhorage/graph';\nimport type { ProjectDetection, ProjectInspection } from '@ankhorage/project-detector/types';\n\nexport type DependencyNodeClassification = 'intrinsic' | 'unknown' | 'vendor';\nexport type DependencyReferenceClassification = DependencyNodeClassification | 'focus';\nexport type DependencyNodeKind = 'module' | 'package';\nexport type DependencyDeclarationKind =\n 'dependency' | 'devDependency' | 'optionalDependency' | 'peerDependency';\n\nexport interface DependencyDeclaration {\n readonly kind: DependencyDeclarationKind;\n readonly range: string;\n}\n\nexport interface DependencyImportEvidence {\n readonly sourceFile: string;\n readonly specifier: string;\n readonly classification: DependencyReferenceClassification;\n readonly declarations: readonly DependencyDeclaration[];\n}\n\nexport interface DependencyGraphNodeData {\n readonly kind: DependencyNodeKind;\n readonly classification: DependencyNodeClassification;\n readonly focus: boolean;\n readonly label: string;\n readonly projectId?: string;\n readonly packageName?: string;\n readonly path?: string;\n readonly parentPath?: string;\n}\n\nexport interface DependencyGraphEdgeData {\n readonly kind: 'import';\n readonly analyzerId: string;\n readonly weight: number;\n readonly evidence: readonly DependencyImportEvidence[];\n}\n\nexport type DependencyGraph = Graph<DependencyGraphNodeData, DependencyGraphEdgeData>;\n\nexport interface DependencyGraphProjectInput {\n readonly id: string;\n readonly rootPath: string;\n}\n\nexport interface DependencyGraphInspectionProjectInput {\n readonly id: string;\n readonly inspection: ProjectInspection;\n}\n\nexport interface DependencyGraphPackage {\n readonly id: string;\n readonly nodeId: string;\n readonly projectId: string;\n readonly rootPath: string;\n readonly relativeRoot: string;\n readonly name?: string;\n readonly detection: ProjectDetection;\n readonly declarations: Readonly<Record<string, readonly DependencyDeclaration[]>>;\n}\n\nexport interface DependencyGraphFragment {\n readonly nodes: readonly GraphNode<DependencyGraphNodeData>[];\n readonly edges: readonly GraphEdge<DependencyGraphEdgeData>[];\n}\n\nexport interface DependencyGraphAnalyzerContext {\n readonly package: DependencyGraphPackage;\n readonly inspection: ProjectInspection;\n readonly focusPackages: ReadonlyMap<string, string>;\n readonly excludedRoots: readonly string[];\n readonly signal?: AbortSignal;\n}\n\nexport interface DependencyGraphAnalyzer {\n readonly id: string;\n readonly supports: (detection: ProjectDetection) => boolean;\n readonly analyzeAsync: (\n context: DependencyGraphAnalyzerContext,\n ) => Promise<DependencyGraphFragment>;\n}\n\nexport interface CreateDependencyGraphInput {\n readonly projects: readonly DependencyGraphProjectInput[];\n readonly analyzers?: readonly DependencyGraphAnalyzer[];\n readonly signal?: AbortSignal;\n}\n\nexport interface CreateDependencyGraphFromInspectionsInput {\n readonly projects: readonly DependencyGraphInspectionProjectInput[];\n readonly analyzers?: readonly DependencyGraphAnalyzer[];\n readonly signal?: AbortSignal;\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ankhorage/dependency-graph",
3
- "version": "0.6.2",
3
+ "version": "0.7.1",
4
4
  "type": "module",
5
5
  "description": "Project-aware dependency analysis that produces canonical Ankhorage graphs.",
6
6
  "license": "MIT",
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "dependencies": {
59
59
  "@ankhorage/graph": "^0.1.0",
60
- "@ankhorage/project-detector": "^0.2.0",
60
+ "@ankhorage/project-detector": "^0.3.0",
61
61
  "@ankhorage/utility": "^0.8.0"
62
62
  },
63
63
  "peerDependencies": {