@ankhorage/dependency-graph 1.2.0 → 1.3.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/features/dependency-analysis/adapters/inbound/api/dependencyGraphApi.js +41 -4
- package/dist/features/dependency-analysis/adapters/inbound/api/dependencyGraphApi.js.map +1 -1
- package/dist/features/dependency-analysis/composition/createDependencyGraphAsync.d.ts.map +1 -1
- package/dist/features/dependency-analysis/composition/createDependencyGraphAsync.js +5 -3
- package/dist/features/dependency-analysis/composition/createDependencyGraphAsync.js.map +1 -1
- package/dist/types/dependencyGraph.d.ts +5 -1
- package/dist/types/dependencyGraph.d.ts.map +1 -1
- package/dist/types/dependencyGraph.js.map +1 -1
- package/dist/types/dependencyGraphApi.d.ts +2 -2
- package/dist/types/dependencyGraphApi.d.ts.map +1 -1
- package/dist/types/dependencyGraphApi.js.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @ankhorage/dependency-graph
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 3815bdd: Allow the dependency-graph API action to consume a bounded project inspection so applications can share one inspection across graph and other project views.
|
|
8
|
+
|
|
3
9
|
## 1.2.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -57,13 +57,50 @@ function readDependencyGraphApiInput(input) {
|
|
|
57
57
|
}
|
|
58
58
|
/*** Validate one project identity/root pair accepted by dependency graph analysis. */
|
|
59
59
|
function isDependencyGraphProjectInput(value) {
|
|
60
|
+
if (typeof value !== 'object' ||
|
|
61
|
+
value === null ||
|
|
62
|
+
!('id' in value) ||
|
|
63
|
+
typeof value.id !== 'string' ||
|
|
64
|
+
value.id.length === 0)
|
|
65
|
+
return false;
|
|
66
|
+
if ('inspection' in value)
|
|
67
|
+
return isProjectInspection(value.inspection);
|
|
68
|
+
return 'rootPath' in value && typeof value.rootPath === 'string' && value.rootPath.length > 0;
|
|
69
|
+
}
|
|
70
|
+
/*** Validate the inspection fields read by canonical graph analysis. */
|
|
71
|
+
function isProjectInspection(value) {
|
|
72
|
+
return isInspectionScope(value) && isInspectionMetadata(value);
|
|
73
|
+
}
|
|
74
|
+
/*** Validate the bounded filesystem scope used by source readers. */
|
|
75
|
+
function isInspectionScope(value) {
|
|
60
76
|
return (typeof value === 'object' &&
|
|
61
77
|
value !== null &&
|
|
62
|
-
'id' in value &&
|
|
63
|
-
typeof value.id === 'string' &&
|
|
64
|
-
value.id.length > 0 &&
|
|
65
78
|
'rootPath' in value &&
|
|
66
79
|
typeof value.rootPath === 'string' &&
|
|
67
|
-
value.rootPath.length > 0
|
|
80
|
+
value.rootPath.length > 0 &&
|
|
81
|
+
'complete' in value &&
|
|
82
|
+
typeof value.complete === 'boolean' &&
|
|
83
|
+
'directories' in value &&
|
|
84
|
+
Array.isArray(value.directories) &&
|
|
85
|
+
value.directories.every((entry) => typeof entry === 'string') &&
|
|
86
|
+
'files' in value &&
|
|
87
|
+
Array.isArray(value.files) &&
|
|
88
|
+
value.files.every((entry) => typeof entry === 'string'));
|
|
89
|
+
}
|
|
90
|
+
/*** Validate metadata collections required for graph projection. */
|
|
91
|
+
function isInspectionMetadata(value) {
|
|
92
|
+
return (typeof value === 'object' &&
|
|
93
|
+
value !== null &&
|
|
94
|
+
'detection' in value &&
|
|
95
|
+
typeof value.detection === 'object' &&
|
|
96
|
+
value.detection !== null &&
|
|
97
|
+
'packages' in value &&
|
|
98
|
+
Array.isArray(value.packages) &&
|
|
99
|
+
'workspaces' in value &&
|
|
100
|
+
Array.isArray(value.workspaces) &&
|
|
101
|
+
'manifests' in value &&
|
|
102
|
+
Array.isArray(value.manifests) &&
|
|
103
|
+
'diagnostics' in value &&
|
|
104
|
+
Array.isArray(value.diagnostics));
|
|
68
105
|
}
|
|
69
106
|
//# sourceMappingURL=dependencyGraphApi.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyGraphApi.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/inbound/api/dependencyGraphApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oDAAoD,CAAC;AAEhG,sGAAsG;AACtG,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;IACjD,UAAU,EAAE;QACV,EAAE,EAAE,kBAAkB;QACtB,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE;YACT,OAAO,EAAE;gBACP,EAAE,EAAE,SAAS;gBACb,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE;oBACV,kBAAkB,EAAE;wBAClB,EAAE,EAAE,kBAAkB;wBACtB,UAAU,EAAE,SAAS;wBACrB,QAAQ,EAAE,MAAM;wBAChB,MAAM,EAAE,QAAQ;wBAChB,MAAM,EAAE,MAAM;wBACd,IAAI,EAAE,mBAAmB;qBAC1B;iBACF;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,kBAAkB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;YACpC,MAAM,KAAK,GAAG,2BAA2B,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACxD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,OAAO;oBACL,MAAM,EAAE,GAAG;oBACX,IAAI,EAAE;wBACJ,KAAK,EAAE;4BACL,IAAI,EAAE,gCAAgC;4BACtC,WAAW,EAAE,kBAAkB;yBAChC;qBACF;iBACF,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,MAAM,0BAA0B,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;aACrE,CAAC;QACJ,CAAC;KACF;CACF,CAAC,CAAC;AAEH,mGAAmG;AACnG,SAAS,2BAA2B,CAAC,KAAc;IACjD,IACE,OAAO,KAAK,KAAK,QAAQ;QACzB,KAAK,KAAK,IAAI;QACd,CAAC,CAAC,UAAU,IAAI,KAAK,CAAC;QACtB,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC;QAC9B,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,6BAA6B,CAAC,EACpD,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC;AACtC,CAAC;AAED,sFAAsF;AACtF,SAAS,6BAA6B,CACpC,KAAc;IAEd,
|
|
1
|
+
{"version":3,"file":"dependencyGraphApi.js","sourceRoot":"","sources":["../../../../../../src/features/dependency-analysis/adapters/inbound/api/dependencyGraphApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGlD,OAAO,EAAE,0BAA0B,EAAE,MAAM,oDAAoD,CAAC;AAEhG,sGAAsG;AACtG,MAAM,CAAC,MAAM,kBAAkB,GAAG,gBAAgB,CAAC;IACjD,UAAU,EAAE;QACV,EAAE,EAAE,kBAAkB;QACtB,MAAM,EAAE,UAAU;QAClB,QAAQ,EAAE,MAAM;QAChB,QAAQ,EAAE,MAAM;QAChB,SAAS,EAAE;YACT,OAAO,EAAE;gBACP,EAAE,EAAE,SAAS;gBACb,IAAI,EAAE,MAAM;gBACZ,UAAU,EAAE;oBACV,kBAAkB,EAAE;wBAClB,EAAE,EAAE,kBAAkB;wBACtB,UAAU,EAAE,SAAS;wBACrB,QAAQ,EAAE,MAAM;wBAChB,MAAM,EAAE,QAAQ;wBAChB,MAAM,EAAE,MAAM;wBACd,IAAI,EAAE,mBAAmB;qBAC1B;iBACF;aACF;SACF;KACF;IACD,QAAQ,EAAE;QACR,kBAAkB,EAAE,KAAK,EAAE,OAA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rB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;QAC/B,WAAW,IAAI,KAAK;QACpB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC;QAC9B,aAAa,IAAI,KAAK;QACtB,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,CACjC,CAAC;AACJ,CAAC","sourcesContent":["import { createApiRuntime } from '@ankhorage/api';\n\nimport type { DependencyGraphApiInput } from '../../../../../types/dependencyGraphApi.js';\nimport { createDependencyGraphAsync } from '../../../composition/createDependencyGraphAsync.js';\n\n/*** Expose dependency graph creation through the canonical framework-neutral Ankhorage API action. */\nexport const dependencyGraphApi = createApiRuntime({\n definition: {\n id: 'dependency-graph',\n origin: 'internal',\n protocol: 'rest',\n basePath: '/api',\n endpoints: {\n actions: {\n id: 'actions',\n kind: 'http',\n operations: {\n 'dependency-graph': {\n id: 'dependency-graph',\n endpointId: 'actions',\n protocol: 'http',\n intent: 'action',\n method: 'POST',\n path: '/dependency-graph',\n },\n },\n },\n },\n },\n handlers: {\n 'dependency-graph': async (request) => {\n const input = readDependencyGraphApiInput(request.body);\n if (input === undefined) {\n return {\n status: 400,\n body: {\n error: {\n code: 'invalid_dependency_graph_input',\n operationId: 'dependency-graph',\n },\n },\n };\n }\n\n return {\n body: await createDependencyGraphAsync({ projects: input.projects }),\n };\n },\n },\n});\n\n/*** Validate the transport-neutral input before invoking filesystem-backed dependency analysis. */\nfunction readDependencyGraphApiInput(input: unknown): DependencyGraphApiInput | undefined {\n if (\n typeof input !== 'object' ||\n input === null ||\n !('projects' in input) ||\n !Array.isArray(input.projects) ||\n !input.projects.every(isDependencyGraphProjectInput)\n ) {\n return undefined;\n }\n\n return { projects: input.projects };\n}\n\n/*** Validate one project identity/root pair accepted by dependency graph analysis. */\nfunction isDependencyGraphProjectInput(\n value: unknown,\n): value is DependencyGraphApiInput['projects'][number] {\n if (\n typeof value !== 'object' ||\n value === null ||\n !('id' in value) ||\n typeof value.id !== 'string' ||\n value.id.length === 0\n )\n return false;\n if ('inspection' in value) return isProjectInspection(value.inspection);\n return 'rootPath' in value && typeof value.rootPath === 'string' && value.rootPath.length > 0;\n}\n\n/*** Validate the inspection fields read by canonical graph analysis. */\nfunction isProjectInspection(value: unknown): boolean {\n return isInspectionScope(value) && isInspectionMetadata(value);\n}\n\n/*** Validate the bounded filesystem scope used by source readers. */\nfunction isInspectionScope(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'rootPath' in value &&\n typeof value.rootPath === 'string' &&\n value.rootPath.length > 0 &&\n 'complete' in value &&\n typeof value.complete === 'boolean' &&\n 'directories' in value &&\n Array.isArray(value.directories) &&\n value.directories.every((entry: unknown) => typeof entry === 'string') &&\n 'files' in value &&\n Array.isArray(value.files) &&\n value.files.every((entry: unknown) => typeof entry === 'string')\n );\n}\n\n/*** Validate metadata collections required for graph projection. */\nfunction isInspectionMetadata(value: unknown): boolean {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'detection' in value &&\n typeof value.detection === 'object' &&\n value.detection !== null &&\n 'packages' in value &&\n Array.isArray(value.packages) &&\n 'workspaces' in value &&\n Array.isArray(value.workspaces) &&\n 'manifests' in value &&\n Array.isArray(value.manifests) &&\n 'diagnostics' in value &&\n Array.isArray(value.diagnostics)\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyGraphAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/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,
|
|
1
|
+
{"version":3,"file":"createDependencyGraphAsync.d.ts","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/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,CAkB1B"}
|
|
@@ -6,9 +6,11 @@ export async function createDependencyGraphAsync(input) {
|
|
|
6
6
|
assertDependencyGraphProjectIds(input.projects);
|
|
7
7
|
const projects = await Promise.all(input.projects.map(async (project) => ({
|
|
8
8
|
id: project.id,
|
|
9
|
-
inspection:
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
inspection: 'inspection' in project
|
|
10
|
+
? project.inspection
|
|
11
|
+
: await inspectProjectAsync(project.rootPath, {
|
|
12
|
+
...(input.signal === undefined ? {} : { signal: input.signal }),
|
|
13
|
+
}),
|
|
12
14
|
})));
|
|
13
15
|
return createDependencyGraphFromInspectionsAsync({
|
|
14
16
|
projects,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDependencyGraphAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/createDependencyGraphAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAMvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AACpG,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,
|
|
1
|
+
{"version":3,"file":"createDependencyGraphAsync.js","sourceRoot":"","sources":["../../../../src/features/dependency-analysis/composition/createDependencyGraphAsync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAMvE,OAAO,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AACpG,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,EACR,YAAY,IAAI,OAAO;YACrB,CAAC,CAAC,OAAO,CAAC,UAAU;YACpB,CAAC,CAAC,MAAM,mBAAmB,CAAC,OAAO,CAAC,QAAQ,EAAE;gBAC1C,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;aAChE,CAAC;KACT,CAAC,CAAC,CACJ,CAAC;IAEF,OAAO,yCAAyC,CAAC;QAC/C,QAAQ;QACR,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 '../application/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:\n 'inspection' in project\n ? project.inspection\n : await inspectProjectAsync(project.rootPath, {\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n }),\n })),\n );\n\n return createDependencyGraphFromInspectionsAsync({\n projects,\n ...(input.signal === undefined ? {} : { signal: input.signal }),\n });\n}\n"]}
|
|
@@ -35,6 +35,10 @@ export interface DependencyGraphProjectInput {
|
|
|
35
35
|
readonly id: string;
|
|
36
36
|
readonly rootPath: string;
|
|
37
37
|
}
|
|
38
|
+
export interface DependencyGraphInspectedProjectInput {
|
|
39
|
+
readonly id: string;
|
|
40
|
+
readonly inspection: ProjectInspection;
|
|
41
|
+
}
|
|
38
42
|
export interface DependencyGraphInspectionProjectInput {
|
|
39
43
|
readonly id: string;
|
|
40
44
|
readonly inspection: ProjectInspection;
|
|
@@ -47,7 +51,7 @@ export interface DependencyGraphPackage {
|
|
|
47
51
|
readonly name?: string;
|
|
48
52
|
}
|
|
49
53
|
export interface CreateDependencyGraphInput {
|
|
50
|
-
readonly projects: readonly DependencyGraphProjectInput[];
|
|
54
|
+
readonly projects: readonly (DependencyGraphProjectInput | DependencyGraphInspectedProjectInput)[];
|
|
51
55
|
readonly signal?: AbortSignal;
|
|
52
56
|
}
|
|
53
57
|
export interface CreateDependencyGraphFromInspectionsInput {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyGraph.d.ts","sourceRoot":"","sources":["../../src/types/dependencyGraph.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AA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AAED,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC;CACxC;AAED,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAC1B,2BAA2B,GAAG,oCAAoC,CACnE,EAAE,CAAC;IACJ,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED,MAAM,WAAW,yCAAyC;IACxD,QAAQ,CAAC,QAAQ,EAAE,SAAS,qCAAqC,EAAE,CAAC;IACpE,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../../src/types/dependencyGraph.ts"],"names":[],"mappings":"","sourcesContent":["import type { Graph } from '@ankhorage/graph';\nimport type { 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 relativeRoot: string;\n readonly name?: string;\n}\n\nexport interface CreateDependencyGraphInput {\n readonly projects: readonly DependencyGraphProjectInput[];\n readonly signal?: AbortSignal;\n}\n\nexport interface CreateDependencyGraphFromInspectionsInput {\n readonly projects: readonly DependencyGraphInspectionProjectInput[];\n readonly signal?: AbortSignal;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"dependencyGraph.js","sourceRoot":"","sources":["../../src/types/dependencyGraph.ts"],"names":[],"mappings":"","sourcesContent":["import type { Graph } from '@ankhorage/graph';\nimport type { 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 DependencyGraphInspectedProjectInput {\n readonly id: string;\n readonly inspection: ProjectInspection;\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 relativeRoot: string;\n readonly name?: string;\n}\n\nexport interface CreateDependencyGraphInput {\n readonly projects: readonly (\n DependencyGraphProjectInput | DependencyGraphInspectedProjectInput\n )[];\n readonly signal?: AbortSignal;\n}\n\nexport interface CreateDependencyGraphFromInspectionsInput {\n readonly projects: readonly DependencyGraphInspectionProjectInput[];\n readonly signal?: AbortSignal;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { DependencyGraphProjectInput } from './dependencyGraph.js';
|
|
1
|
+
import type { DependencyGraphInspectedProjectInput, DependencyGraphProjectInput } from './dependencyGraph.js';
|
|
2
2
|
export interface DependencyGraphApiInput {
|
|
3
|
-
readonly projects: readonly DependencyGraphProjectInput[];
|
|
3
|
+
readonly projects: readonly (DependencyGraphProjectInput | DependencyGraphInspectedProjectInput)[];
|
|
4
4
|
}
|
|
5
5
|
//# sourceMappingURL=dependencyGraphApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyGraphApi.d.ts","sourceRoot":"","sources":["../../src/types/dependencyGraphApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"dependencyGraphApi.d.ts","sourceRoot":"","sources":["../../src/types/dependencyGraphApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oCAAoC,EACpC,2BAA2B,EAC5B,MAAM,sBAAsB,CAAC;AAE9B,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAC1B,2BAA2B,GAAG,oCAAoC,CACnE,EAAE,CAAC;CACL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencyGraphApi.js","sourceRoot":"","sources":["../../src/types/dependencyGraphApi.ts"],"names":[],"mappings":"","sourcesContent":["import type {
|
|
1
|
+
{"version":3,"file":"dependencyGraphApi.js","sourceRoot":"","sources":["../../src/types/dependencyGraphApi.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n DependencyGraphInspectedProjectInput,\n DependencyGraphProjectInput,\n} from './dependencyGraph.js';\n\nexport interface DependencyGraphApiInput {\n readonly projects: readonly (\n DependencyGraphProjectInput | DependencyGraphInspectedProjectInput\n )[];\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ankhorage/dependency-graph",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Project-aware dependency analysis that produces canonical Ankhorage graphs.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"dependencies": {
|
|
64
64
|
"@ankhorage/api": "^0.2.0",
|
|
65
65
|
"@ankhorage/graph": "^0.3.0",
|
|
66
|
-
"@ankhorage/project-detector": "^0.3.
|
|
66
|
+
"@ankhorage/project-detector": "^0.3.3",
|
|
67
67
|
"@ankhorage/utility": "^0.8.0",
|
|
68
68
|
"java-parser": "^3.0.1",
|
|
69
69
|
"typescript": "~6.0.3"
|