@ankhorage/dependency-graph 1.0.0 → 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 +6 -0
- package/dist/dependencyGraph.d.ts +1 -0
- package/dist/dependencyGraph.d.ts.map +1 -1
- package/dist/dependencyGraph.js +1 -0
- package/dist/dependencyGraph.js.map +1 -1
- 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/composition/createDependencyGraphFromInspectionsAsync.d.ts +1 -3
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.d.ts.map +1 -1
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js +5 -50
- package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { projectDependencyGraphFromInspections } from './features/dependency-analysis/application/projectDependencyGraphFromInspections.js';
|
|
1
2
|
export { createDependencyGraphAsync } from './features/dependency-analysis/composition/createDependencyGraphAsync.js';
|
|
2
3
|
export { createDependencyGraphFromInspectionsAsync } from './features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js';
|
|
3
4
|
export { createSourceGraphAsync } from './features/source-graph/composition/createSourceGraphAsync.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyGraph.d.ts","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,OAAO,EAAE,yCAAyC,EAAE,MAAM,yFAAyF,CAAC;AACpJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAE,qCAAqC,EAAE,MAAM,8EAA8E,CAAC;AACrI,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2DAA2D,CAAC;AACnE,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,YAAY,EACV,yCAAyC,EACzC,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,uBAAuB,EACvB,qCAAqC,EACrC,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,iCAAiC,GAClC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,qCAAqC,EACrC,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"dependencyGraph.d.ts","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,qFAAqF,CAAC;AAC5I,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,OAAO,EAAE,yCAAyC,EAAE,MAAM,yFAAyF,CAAC;AACpJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAE,qCAAqC,EAAE,MAAM,8EAA8E,CAAC;AACrI,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2DAA2D,CAAC;AACnE,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC;AAC5F,YAAY,EACV,yCAAyC,EACzC,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,EACzB,eAAe,EACf,uBAAuB,EACvB,qCAAqC,EACrC,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,EAC3B,wBAAwB,EACxB,4BAA4B,EAC5B,kBAAkB,EAClB,iCAAiC,GAClC,MAAM,4BAA4B,CAAC;AACpC,YAAY,EACV,qCAAqC,EACrC,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,sBAAsB,EACtB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,4BAA4B,EAC5B,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,iBAAiB,EACjB,sBAAsB,EACtB,kBAAkB,EAClB,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC"}
|
package/dist/dependencyGraph.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { projectDependencyGraphFromInspections } from './features/dependency-analysis/application/projectDependencyGraphFromInspections.js';
|
|
1
2
|
export { createDependencyGraphAsync } from './features/dependency-analysis/composition/createDependencyGraphAsync.js';
|
|
2
3
|
export { createDependencyGraphFromInspectionsAsync } from './features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js';
|
|
3
4
|
export { createSourceGraphAsync } from './features/source-graph/composition/createSourceGraphAsync.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,OAAO,EAAE,yCAAyC,EAAE,MAAM,yFAAyF,CAAC;AACpJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAE,qCAAqC,EAAE,MAAM,8EAA8E,CAAC;AACrI,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2DAA2D,CAAC;AACnE,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC","sourcesContent":["export { createDependencyGraphAsync } from './features/dependency-analysis/composition/createDependencyGraphAsync.js';\nexport { createDependencyGraphFromInspectionsAsync } from './features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js';\nexport { createSourceGraphAsync } from './features/source-graph/composition/createSourceGraphAsync.js';\nexport { createSourceGraphFromInspectionsAsync } from './features/source-graph/composition/createSourceGraphFromInspectionsAsync.js';\nexport { createSourceGraph } from './features/source-graph/domain/createSourceGraph.js';\nexport { createSourceGraphIndex } from './features/source-graph/domain/createSourceGraphIndex.js';\nexport {\n createSourceRollupIndex,\n findRolledUpDependency,\n outgoingRolledUpDependencies,\n} from './features/source-graph/domain/createSourceRollupIndex.js';\nexport {\n findSourceFile,\n findSourceNode,\n findSourceRelationsBetween,\n findSourceSymbols,\n incomingSourceRelations,\n outgoingSourceRelations,\n} from './features/source-graph/domain/querySourceGraph.js';\nexport { rollupSourceRelations } from './features/source-graph/domain/rollupSourceRelations.js';\nexport {\n deserializeSourceGraph,\n serializeSourceGraph,\n} from './features/source-graph/domain/serializeSourceGraph.js';\nexport { summarizeSourceNode } from './features/source-graph/domain/summarizeSourceNode.js';\nexport type {\n CreateDependencyGraphFromInspectionsInput,\n CreateDependencyGraphInput,\n DependencyDeclaration,\n DependencyDeclarationKind,\n DependencyGraph,\n DependencyGraphEdgeData,\n DependencyGraphInspectionProjectInput,\n DependencyGraphNodeData,\n DependencyGraphPackage,\n DependencyGraphProjectInput,\n DependencyImportEvidence,\n DependencyNodeClassification,\n DependencyNodeKind,\n DependencyReferenceClassification,\n} from './types/dependencyGraph.js';\nexport type {\n CreateSourceGraphFromInspectionsInput,\n CreateSourceGraphInput,\n SourceAnalyzedFile,\n SourceCapability,\n SourceCapabilityReport,\n SourceDeclarationFact,\n SourceDocumentation,\n SourceEdgeData,\n SourceEdgeDraft,\n SourceFileFacts,\n SourceGraph,\n SourceGraphDraft,\n SourceGraphIndex,\n SourceImportFact,\n SourceInspectionProjectInput,\n SourceLocation,\n SourceNodeData,\n SourceNodeDraft,\n SourceNodeKind,\n SourceNodeSummary,\n SourceRelationEvidence,\n SourceRelationKind,\n SourceRelationView,\n SourceRollupEdge,\n SourceRollupIndex,\n SourceVisibility,\n} from './types/sourceGraph.js';\n"]}
|
|
1
|
+
{"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../src/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qCAAqC,EAAE,MAAM,qFAAqF,CAAC;AAC5I,OAAO,EAAE,0BAA0B,EAAE,MAAM,0EAA0E,CAAC;AACtH,OAAO,EAAE,yCAAyC,EAAE,MAAM,yFAAyF,CAAC;AACpJ,OAAO,EAAE,sBAAsB,EAAE,MAAM,+DAA+D,CAAC;AACvG,OAAO,EAAE,qCAAqC,EAAE,MAAM,8EAA8E,CAAC;AACrI,OAAO,EAAE,iBAAiB,EAAE,MAAM,qDAAqD,CAAC;AACxF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0DAA0D,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,sBAAsB,EACtB,4BAA4B,GAC7B,MAAM,2DAA2D,CAAC;AACnE,OAAO,EACL,cAAc,EACd,cAAc,EACd,0BAA0B,EAC1B,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,GACxB,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,yDAAyD,CAAC;AAChG,OAAO,EACL,sBAAsB,EACtB,oBAAoB,GACrB,MAAM,wDAAwD,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uDAAuD,CAAC","sourcesContent":["export { projectDependencyGraphFromInspections } from './features/dependency-analysis/application/projectDependencyGraphFromInspections.js';\nexport { createDependencyGraphAsync } from './features/dependency-analysis/composition/createDependencyGraphAsync.js';\nexport { createDependencyGraphFromInspectionsAsync } from './features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js';\nexport { createSourceGraphAsync } from './features/source-graph/composition/createSourceGraphAsync.js';\nexport { createSourceGraphFromInspectionsAsync } from './features/source-graph/composition/createSourceGraphFromInspectionsAsync.js';\nexport { createSourceGraph } from './features/source-graph/domain/createSourceGraph.js';\nexport { createSourceGraphIndex } from './features/source-graph/domain/createSourceGraphIndex.js';\nexport {\n createSourceRollupIndex,\n findRolledUpDependency,\n outgoingRolledUpDependencies,\n} from './features/source-graph/domain/createSourceRollupIndex.js';\nexport {\n findSourceFile,\n findSourceNode,\n findSourceRelationsBetween,\n findSourceSymbols,\n incomingSourceRelations,\n outgoingSourceRelations,\n} from './features/source-graph/domain/querySourceGraph.js';\nexport { rollupSourceRelations } from './features/source-graph/domain/rollupSourceRelations.js';\nexport {\n deserializeSourceGraph,\n serializeSourceGraph,\n} from './features/source-graph/domain/serializeSourceGraph.js';\nexport { summarizeSourceNode } from './features/source-graph/domain/summarizeSourceNode.js';\nexport type {\n CreateDependencyGraphFromInspectionsInput,\n CreateDependencyGraphInput,\n DependencyDeclaration,\n DependencyDeclarationKind,\n DependencyGraph,\n DependencyGraphEdgeData,\n DependencyGraphInspectionProjectInput,\n DependencyGraphNodeData,\n DependencyGraphPackage,\n DependencyGraphProjectInput,\n DependencyImportEvidence,\n DependencyNodeClassification,\n DependencyNodeKind,\n DependencyReferenceClassification,\n} from './types/dependencyGraph.js';\nexport type {\n CreateSourceGraphFromInspectionsInput,\n CreateSourceGraphInput,\n SourceAnalyzedFile,\n SourceCapability,\n SourceCapabilityReport,\n SourceDeclarationFact,\n SourceDocumentation,\n SourceEdgeData,\n SourceEdgeDraft,\n SourceFileFacts,\n SourceGraph,\n SourceGraphDraft,\n SourceGraphIndex,\n SourceImportFact,\n SourceInspectionProjectInput,\n SourceLocation,\n SourceNodeData,\n SourceNodeDraft,\n SourceNodeKind,\n SourceNodeSummary,\n SourceRelationEvidence,\n SourceRelationKind,\n SourceRelationView,\n SourceRollupEdge,\n SourceRollupIndex,\n SourceVisibility,\n} from './types/sourceGraph.js';\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DependencyGraphInspectionProjectInput } from '../../../types/dependencyGraph.js';
|
|
2
|
+
/*** Preserve dependency projection preconditions before reading source files. */
|
|
3
|
+
export declare function assertDependencyGraphInspections(projects: readonly DependencyGraphInspectionProjectInput[]): void;
|
|
4
|
+
//# sourceMappingURL=assertDependencyGraphInspections.d.ts.map
|
package/dist/features/dependency-analysis/application/assertDependencyGraphInspections.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertDependencyGraphInspections.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/assertDependencyGraphInspections.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qCAAqC,EAAE,MAAM,mCAAmC,CAAC;AAG/F,iFAAiF;AACjF,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE,SAAS,qCAAqC,EAAE,GACzD,IAAI,CAUN"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { assertDependencyGraphProjectIds } from './assertDependencyGraphProjectIds.js';
|
|
2
|
+
/*** Preserve dependency projection preconditions before reading source files. */
|
|
3
|
+
export function assertDependencyGraphInspections(projects) {
|
|
4
|
+
assertDependencyGraphProjectIds(projects);
|
|
5
|
+
for (const { id, inspection } of projects) {
|
|
6
|
+
if (inspection.complete)
|
|
7
|
+
continue;
|
|
8
|
+
throw new Error(`Dependency graph inspection is incomplete for "${id}": ${inspection.diagnostics
|
|
9
|
+
.map(({ message }) => message)
|
|
10
|
+
.join('; ')}`);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=assertDependencyGraphInspections.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertDependencyGraphInspections.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/assertDependencyGraphInspections.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,iFAAiF;AACjF,MAAM,UAAU,gCAAgC,CAC9C,QAA0D;IAE1D,+BAA+B,CAAC,QAAQ,CAAC,CAAC;IAC1C,KAAK,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,QAAQ,EAAE,CAAC;QAC1C,IAAI,UAAU,CAAC,QAAQ;YAAE,SAAS;QAClC,MAAM,IAAI,KAAK,CACb,kDAAkD,EAAE,MAAM,UAAU,CAAC,WAAW;aAC7E,GAAG,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO,CAAC;aAC7B,IAAI,CAAC,IAAI,CAAC,EAAE,CAChB,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import type { DependencyGraphInspectionProjectInput } from '../../../types/dependencyGraph.js';\nimport { assertDependencyGraphProjectIds } from './assertDependencyGraphProjectIds.js';\n\n/*** Preserve dependency projection preconditions before reading source files. */\nexport function assertDependencyGraphInspections(\n projects: readonly DependencyGraphInspectionProjectInput[],\n): void {\n assertDependencyGraphProjectIds(projects);\n for (const { id, inspection } of projects) {\n if (inspection.complete) continue;\n throw new Error(\n `Dependency graph inspection is incomplete for \"${id}\": ${inspection.diagnostics\n .map(({ message }) => message)\n .join('; ')}`,\n );\n }\n}\n"]}
|
package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DependencyGraph, DependencyGraphInspectionProjectInput } from '../../../types/dependencyGraph.js';
|
|
2
|
+
import type { SourceGraph } from '../../../types/sourceGraph.js';
|
|
3
|
+
/*** Project a previously analyzed source graph into the established package/module view. */
|
|
4
|
+
export declare function projectDependencyGraphFromInspections(sourceGraph: SourceGraph, projects: readonly DependencyGraphInspectionProjectInput[]): DependencyGraph;
|
|
5
|
+
//# sourceMappingURL=projectDependencyGraphFromInspections.d.ts.map
|
package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectDependencyGraphFromInspections.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/projectDependencyGraphFromInspections.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,eAAe,EACf,qCAAqC,EAEtC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAIjE,4FAA4F;AAC5F,wBAAgB,qCAAqC,CACnD,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,SAAS,qCAAqC,EAAE,GACzD,eAAe,CAKjB"}
|
package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { projectDependencyGraphFromSourceGraph } from '../domain/projectDependencyGraphFromSourceGraph.js';
|
|
2
|
+
import { assertDependencyGraphInspections } from './assertDependencyGraphInspections.js';
|
|
3
|
+
/*** Project a previously analyzed source graph into the established package/module view. */
|
|
4
|
+
export function projectDependencyGraphFromInspections(sourceGraph, projects) {
|
|
5
|
+
assertDependencyGraphInspections(projects);
|
|
6
|
+
const packages = projects.flatMap(createInspectedPackages);
|
|
7
|
+
assertUniqueFocusNames(packages);
|
|
8
|
+
return projectDependencyGraphFromSourceGraph(sourceGraph, packages, projects);
|
|
9
|
+
}
|
|
10
|
+
/*** Normalize one supplied inspection into dependency-analysis package contexts. */
|
|
11
|
+
function createInspectedPackages(project) {
|
|
12
|
+
const { inspection } = project;
|
|
13
|
+
return selectFocusPackages(inspection).map((detected) => {
|
|
14
|
+
const relativeRoot = detected.rootPath;
|
|
15
|
+
const id = `${project.id}:${relativeRoot}`;
|
|
16
|
+
return {
|
|
17
|
+
id,
|
|
18
|
+
nodeId: `package:${id}`,
|
|
19
|
+
projectId: project.id,
|
|
20
|
+
relativeRoot,
|
|
21
|
+
...(detected.name === undefined ? {} : { name: detected.name }),
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/*** Select the root plus packages declared by root workspace metadata as graph focus. */
|
|
26
|
+
function selectFocusPackages(inspection) {
|
|
27
|
+
const rootPackage = inspection.packages.find(({ rootPath }) => rootPath === '.');
|
|
28
|
+
const workspaceRoots = new Set(inspection.workspaces
|
|
29
|
+
.filter(({ rootPath }) => rootPath === '.')
|
|
30
|
+
.flatMap(({ packagePaths }) => packagePaths));
|
|
31
|
+
const workspacePackages = inspection.packages.filter(({ rootPath }) => rootPath !== '.' && workspaceRoots.has(rootPath));
|
|
32
|
+
const root = rootPackage ?? { rootPath: '.', detection: inspection.detection, manifestPath: '' };
|
|
33
|
+
return [root, ...workspacePackages];
|
|
34
|
+
}
|
|
35
|
+
/*** Reject ambiguous package names before resolving cross-project source imports. */
|
|
36
|
+
function assertUniqueFocusNames(packages) {
|
|
37
|
+
const named = packages.filter((packageContext) => packageContext.name !== undefined);
|
|
38
|
+
const duplicates = named.filter((item, index) => named.findIndex(({ name }) => name === item.name) !== index);
|
|
39
|
+
if (duplicates.length > 0) {
|
|
40
|
+
throw new Error(`Duplicate focus package name: ${duplicates[0]?.name ?? 'unknown'}.`);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=projectDependencyGraphFromInspections.js.map
|
package/dist/features/dependency-analysis/application/projectDependencyGraphFromInspections.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"projectDependencyGraphFromInspections.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/application/projectDependencyGraphFromInspections.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,qCAAqC,EAAE,MAAM,oDAAoD,CAAC;AAC3G,OAAO,EAAE,gCAAgC,EAAE,MAAM,uCAAuC,CAAC;AAEzF,4FAA4F;AAC5F,MAAM,UAAU,qCAAqC,CACnD,WAAwB,EACxB,QAA0D;IAE1D,gCAAgC,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IAC3D,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACjC,OAAO,qCAAqC,CAAC,WAAW,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAChF,CAAC;AAED,oFAAoF;AACpF,SAAS,uBAAuB,CAC9B,OAA8C;IAE9C,MAAM,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC;IAC/B,OAAO,mBAAmB,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;QACtD,MAAM,YAAY,GAAG,QAAQ,CAAC,QAAQ,CAAC;QACvC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,EAAE,IAAI,YAAY,EAAE,CAAC;QAC3C,OAAO;YACL,EAAE;YACF,MAAM,EAAE,WAAW,EAAE,EAAE;YACvB,SAAS,EAAE,OAAO,CAAC,EAAE;YACrB,YAAY;YACZ,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;SAC/B,CAAC;IACrC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,yFAAyF;AACzF,SAAS,mBAAmB,CAAC,UAA6B;IACxD,MAAM,WAAW,GAAG,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,GAAG,CAAC,CAAC;IACjF,MAAM,cAAc,GAAG,IAAI,GAAG,CAC5B,UAAU,CAAC,UAAU;SAClB,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,GAAG,CAAC;SAC1C,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,YAAY,CAAC,CAC/C,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,CAAC,QAAQ,CAAC,MAAM,CAClD,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,KAAK,GAAG,IAAI,cAAc,CAAC,GAAG,CAAC,QAAQ,CAAC,CACnE,CAAC;IACF,MAAM,IAAI,GAAG,WAAW,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IACjG,OAAO,CAAC,IAAI,EAAE,GAAG,iBAAiB,CAAC,CAAC;AACtC,CAAC;AAED,qFAAqF;AACrF,SAAS,sBAAsB,CAAC,QAA2C;IACzE,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;AACH,CAAC","sourcesContent":["import type { InspectedPackage, ProjectInspection } from '@ankhorage/project-detector/types';\n\nimport type {\n DependencyGraph,\n DependencyGraphInspectionProjectInput,\n DependencyGraphPackage,\n} from '../../../types/dependencyGraph.js';\nimport type { SourceGraph } from '../../../types/sourceGraph.js';\nimport { projectDependencyGraphFromSourceGraph } from '../domain/projectDependencyGraphFromSourceGraph.js';\nimport { assertDependencyGraphInspections } from './assertDependencyGraphInspections.js';\n\n/*** Project a previously analyzed source graph into the established package/module view. */\nexport function projectDependencyGraphFromInspections(\n sourceGraph: SourceGraph,\n projects: readonly DependencyGraphInspectionProjectInput[],\n): DependencyGraph {\n assertDependencyGraphInspections(projects);\n const packages = projects.flatMap(createInspectedPackages);\n assertUniqueFocusNames(packages);\n return projectDependencyGraphFromSourceGraph(sourceGraph, packages, projects);\n}\n\n/*** Normalize one supplied inspection into dependency-analysis package contexts. */\nfunction createInspectedPackages(\n project: DependencyGraphInspectionProjectInput,\n): readonly DependencyGraphPackage[] {\n const { inspection } = project;\n return selectFocusPackages(inspection).map((detected) => {\n const relativeRoot = detected.rootPath;\n const id = `${project.id}:${relativeRoot}`;\n return {\n id,\n nodeId: `package:${id}`,\n projectId: project.id,\n relativeRoot,\n ...(detected.name === undefined ? {} : { name: detected.name }),\n } satisfies DependencyGraphPackage;\n });\n}\n\n/*** Select the 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/*** Reject ambiguous package names before resolving cross-project source imports. */\nfunction assertUniqueFocusNames(packages: readonly DependencyGraphPackage[]): void {\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}\n"]}
|
package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { CreateDependencyGraphFromInspectionsInput, DependencyGraph } from '../../../types/dependencyGraph.js';
|
|
2
|
-
/***
|
|
3
|
-
* Build one canonical dependency graph from already-inspected projects without rescanning them.
|
|
4
|
-
*/
|
|
2
|
+
/*** Build the established dependency view from one canonical source analysis. */
|
|
5
3
|
export declare function createDependencyGraphFromInspectionsAsync(input: CreateDependencyGraphFromInspectionsInput): Promise<DependencyGraph>;
|
|
6
4
|
//# sourceMappingURL=createDependencyGraphFromInspectionsAsync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyGraphFromInspectionsAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDependencyGraphFromInspectionsAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yCAAyC,EACzC,eAAe,EAChB,MAAM,mCAAmC,CAAC;AAK3C,iFAAiF;AACjF,wBAAsB,yCAAyC,CAC7D,KAAK,EAAE,yCAAyC,GAC/C,OAAO,CAAC,eAAe,CAAC,CAO1B"}
|
package/dist/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.js
CHANGED
|
@@ -1,58 +1,13 @@
|
|
|
1
1
|
import { createSourceGraphFromInspectionsAsync } from '../../source-graph/composition/createSourceGraphFromInspectionsAsync.js';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
/***
|
|
5
|
-
* Build one canonical dependency graph from already-inspected projects without rescanning them.
|
|
6
|
-
*/
|
|
2
|
+
import { assertDependencyGraphInspections } from '../application/assertDependencyGraphInspections.js';
|
|
3
|
+
import { projectDependencyGraphFromInspections } from '../application/projectDependencyGraphFromInspections.js';
|
|
4
|
+
/*** Build the established dependency view from one canonical source analysis. */
|
|
7
5
|
export async function createDependencyGraphFromInspectionsAsync(input) {
|
|
8
|
-
|
|
9
|
-
const inspected = input.projects.map(createInspectedInput);
|
|
10
|
-
const packages = inspected.flatMap(({ packages: projectPackages }) => projectPackages);
|
|
11
|
-
assertUniqueFocusNames(packages);
|
|
6
|
+
assertDependencyGraphInspections(input.projects);
|
|
12
7
|
const sourceGraph = await createSourceGraphFromInspectionsAsync({
|
|
13
8
|
projects: input.projects,
|
|
14
9
|
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
15
10
|
});
|
|
16
|
-
return
|
|
17
|
-
}
|
|
18
|
-
/*** Normalize one supplied inspection into dependency-analysis package contexts. */
|
|
19
|
-
function createInspectedInput(project) {
|
|
20
|
-
const { inspection } = project;
|
|
21
|
-
if (!inspection.complete) {
|
|
22
|
-
throw new Error(`Dependency graph inspection is incomplete for "${project.id}": ${inspection.diagnostics
|
|
23
|
-
.map(({ message }) => message)
|
|
24
|
-
.join('; ')}`);
|
|
25
|
-
}
|
|
26
|
-
const detectedPackages = selectFocusPackages(inspection);
|
|
27
|
-
const packages = detectedPackages.map((detected) => {
|
|
28
|
-
const relativeRoot = detected.rootPath;
|
|
29
|
-
const id = `${project.id}:${relativeRoot}`;
|
|
30
|
-
return {
|
|
31
|
-
id,
|
|
32
|
-
nodeId: `package:${id}`,
|
|
33
|
-
projectId: project.id,
|
|
34
|
-
relativeRoot,
|
|
35
|
-
...(detected.name === undefined ? {} : { name: detected.name }),
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
return { packages };
|
|
39
|
-
}
|
|
40
|
-
/*** Select the repository root plus packages declared by root workspace metadata as graph focus. */
|
|
41
|
-
function selectFocusPackages(inspection) {
|
|
42
|
-
const rootPackage = inspection.packages.find(({ rootPath }) => rootPath === '.');
|
|
43
|
-
const workspaceRoots = new Set(inspection.workspaces
|
|
44
|
-
.filter(({ rootPath }) => rootPath === '.')
|
|
45
|
-
.flatMap(({ packagePaths }) => packagePaths));
|
|
46
|
-
const workspacePackages = inspection.packages.filter(({ rootPath }) => rootPath !== '.' && workspaceRoots.has(rootPath));
|
|
47
|
-
const root = rootPackage ?? { rootPath: '.', detection: inspection.detection, manifestPath: '' };
|
|
48
|
-
return [root, ...workspacePackages];
|
|
49
|
-
}
|
|
50
|
-
/*** Reject ambiguous package names before resolving cross-project source imports. */
|
|
51
|
-
function assertUniqueFocusNames(packages) {
|
|
52
|
-
const named = packages.filter((packageContext) => packageContext.name !== undefined);
|
|
53
|
-
const duplicates = named.filter((item, index) => named.findIndex(({ name }) => name === item.name) !== index);
|
|
54
|
-
if (duplicates.length > 0) {
|
|
55
|
-
throw new Error(`Duplicate focus package name: ${duplicates[0]?.name ?? 'unknown'}.`);
|
|
56
|
-
}
|
|
11
|
+
return projectDependencyGraphFromInspections(sourceGraph, input.projects);
|
|
57
12
|
}
|
|
58
13
|
//# sourceMappingURL=createDependencyGraphFromInspectionsAsync.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyGraphFromInspectionsAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createDependencyGraphFromInspectionsAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/createDependencyGraphFromInspectionsAsync.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qCAAqC,EAAE,MAAM,yEAAyE,CAAC;AAChI,OAAO,EAAE,gCAAgC,EAAE,MAAM,oDAAoD,CAAC;AACtG,OAAO,EAAE,qCAAqC,EAAE,MAAM,yDAAyD,CAAC;AAEhH,iFAAiF;AACjF,MAAM,CAAC,KAAK,UAAU,yCAAyC,CAC7D,KAAgD;IAEhD,gCAAgC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACjD,MAAM,WAAW,GAAG,MAAM,qCAAqC,CAAC;QAC9D,QAAQ,EAAE,KAAK,CAAC,QAAQ;QACxB,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;IACH,OAAO,qCAAqC,CAAC,WAAW,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import type {\n CreateDependencyGraphFromInspectionsInput,\n DependencyGraph,\n} from '../../../types/dependencyGraph.js';\nimport { createSourceGraphFromInspectionsAsync } from '../../source-graph/composition/createSourceGraphFromInspectionsAsync.js';\nimport { assertDependencyGraphInspections } from '../application/assertDependencyGraphInspections.js';\nimport { projectDependencyGraphFromInspections } from '../application/projectDependencyGraphFromInspections.js';\n\n/*** Build the established dependency view from one canonical source analysis. */\nexport async function createDependencyGraphFromInspectionsAsync(\n input: CreateDependencyGraphFromInspectionsInput,\n): Promise<DependencyGraph> {\n assertDependencyGraphInspections(input.projects);\n const sourceGraph = await createSourceGraphFromInspectionsAsync({\n projects: input.projects,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n return projectDependencyGraphFromInspections(sourceGraph, input.projects);\n}\n"]}
|