@platformos/platformos-graph 0.0.20 → 0.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 +511 -8
- package/dist/cache-probes.spec.d.ts +1 -0
- package/dist/cache-probes.spec.js +62 -0
- package/dist/cache-probes.spec.js.map +1 -0
- package/dist/cli.js +18 -13
- package/dist/cli.js.map +1 -1
- package/dist/cli.spec.d.ts +1 -0
- package/dist/cli.spec.js +235 -0
- package/dist/cli.spec.js.map +1 -0
- package/dist/graph/app-index-resolution.spec.d.ts +1 -0
- package/dist/graph/app-index-resolution.spec.js +167 -0
- package/dist/graph/app-index-resolution.spec.js.map +1 -0
- package/dist/graph/asset-resolution.spec.d.ts +1 -0
- package/dist/graph/asset-resolution.spec.js +64 -0
- package/dist/graph/asset-resolution.spec.js.map +1 -0
- package/dist/graph/augment.js +3 -0
- package/dist/graph/augment.js.map +1 -1
- package/dist/graph/build.d.ts +15 -2
- package/dist/graph/build.js +54 -12
- package/dist/graph/build.js.map +1 -1
- package/dist/graph/build.spec.d.ts +1 -0
- package/dist/graph/build.spec.js +138 -0
- package/dist/graph/build.spec.js.map +1 -0
- package/dist/graph/edge-sources.d.ts +28 -0
- package/dist/graph/edge-sources.js +43 -0
- package/dist/graph/edge-sources.js.map +1 -0
- package/dist/graph/edge-sources.spec.d.ts +1 -0
- package/dist/graph/edge-sources.spec.js +125 -0
- package/dist/graph/edge-sources.spec.js.map +1 -0
- package/dist/graph/extract.spec.d.ts +1 -0
- package/dist/graph/extract.spec.js +163 -0
- package/dist/graph/extract.spec.js.map +1 -0
- package/dist/graph/module.d.ts +60 -7
- package/dist/graph/module.js +137 -41
- package/dist/graph/module.js.map +1 -1
- package/dist/graph/module.spec.d.ts +1 -0
- package/dist/graph/module.spec.js +74 -0
- package/dist/graph/module.spec.js.map +1 -0
- package/dist/graph/query.d.ts +72 -0
- package/dist/graph/query.js +140 -0
- package/dist/graph/query.js.map +1 -0
- package/dist/graph/query.spec.d.ts +1 -0
- package/dist/graph/query.spec.js +209 -0
- package/dist/graph/query.spec.js.map +1 -0
- package/dist/graph/serialize.spec.d.ts +1 -0
- package/dist/graph/serialize.spec.js +50 -0
- package/dist/graph/serialize.spec.js.map +1 -0
- package/dist/graph/structural.spec.d.ts +1 -0
- package/dist/graph/structural.spec.js +146 -0
- package/dist/graph/structural.spec.js.map +1 -0
- package/dist/graph/test-helpers.js +3 -3
- package/dist/graph/test-helpers.js.map +1 -1
- package/dist/graph/traverse-edges.spec.d.ts +1 -0
- package/dist/graph/traverse-edges.spec.js +337 -0
- package/dist/graph/traverse-edges.spec.js.map +1 -0
- package/dist/graph/traverse.d.ts +51 -20
- package/dist/graph/traverse.js +239 -29
- package/dist/graph/traverse.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/parsers.d.ts +35 -0
- package/dist/parsers.js +72 -0
- package/dist/parsers.js.map +1 -0
- package/dist/parsers.spec.d.ts +1 -0
- package/dist/parsers.spec.js +70 -0
- package/dist/parsers.spec.js.map +1 -0
- package/dist/toSourceCode.d.ts +14 -2
- package/dist/toSourceCode.js +23 -19
- package/dist/toSourceCode.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types.d.ts +102 -3
- package/dist/types.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/fixtures/asset-edges/app/assets/logo.css +1 -0
- package/fixtures/asset-edges/app/assets/site/app.js +1 -0
- package/fixtures/asset-edges/app/views/pages/index.liquid +3 -0
- package/fixtures/graphql-table/app/graphql/with_table.graphql +5 -0
- package/fixtures/graphql-table/app/graphql/without_table.graphql +3 -0
- package/fixtures/graphql-table/app/views/pages/index.liquid +4 -0
- package/fixtures/layout-edges/app/views/layouts/theme.liquid +4 -0
- package/fixtures/layout-edges/app/views/pages/broken.liquid +5 -0
- package/fixtures/layout-edges/app/views/pages/index.liquid +5 -0
- package/fixtures/schema-nodes/app/schema/blog_post.yml +6 -0
- package/fixtures/schema-nodes/app/schema/no_name.yml +3 -0
- package/fixtures/schema-nodes/app/views/pages/index.liquid +1 -0
- package/fixtures/structural/app/views/pages/about.liquid +1 -0
- package/fixtures/structural/app/views/pages/blog/show.liquid +4 -0
- package/fixtures/structural/app/views/pages/index.liquid +6 -0
- package/fixtures/structural/app/views/pages/rich.liquid +8 -0
- package/fixtures/structural/app/views/partials/card.liquid +1 -0
- package/fixtures/structural/app/views/partials/documented.liquid +5 -0
- package/package.json +7 -5
- package/src/cli.spec.ts +37 -31
- package/src/cli.ts +31 -15
- package/src/graph/augment.ts +4 -0
- package/src/graph/build.spec.ts +871 -6
- package/src/graph/build.ts +68 -17
- package/src/graph/edge-sources.spec.ts +125 -0
- package/src/graph/edge-sources.ts +49 -0
- package/src/graph/module.spec.ts +168 -0
- package/src/graph/module.ts +139 -45
- package/src/graph/query.spec.ts +260 -0
- package/src/graph/query.ts +154 -0
- package/src/graph/serialize.spec.ts +4 -4
- package/src/graph/test-helpers.ts +3 -3
- package/src/graph/{extract.spec.ts → traverse.spec.ts} +125 -2
- package/src/graph/traverse.ts +278 -37
- package/src/index.ts +16 -1
- package/src/parsers.spec.ts +85 -0
- package/src/parsers.ts +75 -0
- package/src/toSourceCode.ts +26 -26
- package/src/types.ts +106 -7
- package/src/utils/index.ts +1 -1
- package/dist/getWebComponentMap.d.ts +0 -10
- package/dist/getWebComponentMap.js +0 -66
- package/dist/getWebComponentMap.js.map +0 -1
- package/src/graph/traverse-edges.spec.ts +0 -278
- /package/fixtures/skeleton/{assets → app/assets}/app.css +0 -0
- /package/fixtures/skeleton/{assets → app/assets}/app.js +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { UriString } from '@platformos/platformos-check-common';
|
|
2
|
+
import { AppGraph, AppModule, Reference } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Project-structure queries over a BUILT {@link AppGraph}.
|
|
5
|
+
*
|
|
6
|
+
* Every function here is PURE and synchronous: it only reads the in-memory
|
|
7
|
+
* graph produced by `buildAppGraph`. All I/O (disk traversal, parsing,
|
|
8
|
+
* resolution) stays in `buildAppGraph`; this layer never touches the filesystem.
|
|
9
|
+
*
|
|
10
|
+
* These resurrect the old in-supervisor `ProjectFactGraph` / `ProjectMap`
|
|
11
|
+
* capabilities as the graph package's own API, so consumers (the MCP supervisor,
|
|
12
|
+
* the LSP) read project facts without re-deriving any graph logic.
|
|
13
|
+
*
|
|
14
|
+
* Note on graph scope: `buildAppGraph` only materializes modules reachable from
|
|
15
|
+
* its entry points. Whole-project queries like {@link orphans} are therefore
|
|
16
|
+
* only as complete as the graph they are given — to detect unreferenced files,
|
|
17
|
+
* build the graph with every file as an entry point.
|
|
18
|
+
*/
|
|
19
|
+
/** The outgoing dependency edges of `uri` (what it renders/includes/runs/queries/wraps). */
|
|
20
|
+
export declare function dependenciesOf(graph: AppGraph, uri: UriString): Reference[];
|
|
21
|
+
/** The incoming reference edges to `uri` (who renders/includes/runs/queries/wraps it). */
|
|
22
|
+
export declare function dependentsOf(graph: AppGraph, uri: UriString): Reference[];
|
|
23
|
+
/**
|
|
24
|
+
* Whether `uri` is a module in the graph that resolves to a file on disk.
|
|
25
|
+
* Returns `false` for a URI absent from the graph or a known-missing target.
|
|
26
|
+
*/
|
|
27
|
+
export declare function exists(graph: AppGraph, uri: UriString): boolean;
|
|
28
|
+
/** Whether `uri` is one of the graph's entry points (a page or layout root). */
|
|
29
|
+
export declare function isEntryPoint(graph: AppGraph, uri: UriString): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Whether `uri` is an orphan: an existing, non-entry-point module that nothing
|
|
32
|
+
* references. Entry points (pages, layouts) are roots reachable independently of
|
|
33
|
+
* render edges, so they are never orphans; known-missing targets are "missing"
|
|
34
|
+
* (see {@link missingDependencies}), not orphans.
|
|
35
|
+
*/
|
|
36
|
+
export declare function isOrphan(graph: AppGraph, uri: UriString): boolean;
|
|
37
|
+
/** Every orphan module in the graph (see {@link isOrphan}), sorted by URI. */
|
|
38
|
+
export declare function orphans(graph: AppGraph): AppModule[];
|
|
39
|
+
/**
|
|
40
|
+
* Every module URI transitively reachable from `uri` by following outgoing
|
|
41
|
+
* dependency edges, sorted. Excludes `uri` itself unless a cycle leads back to
|
|
42
|
+
* it. Modules absent from the graph contribute nothing.
|
|
43
|
+
*/
|
|
44
|
+
export declare function reachableFrom(graph: AppGraph, uri: UriString): UriString[];
|
|
45
|
+
/** The outgoing edges of `uri` whose target does not exist on disk. */
|
|
46
|
+
export declare function missingDependencies(graph: AppGraph, uri: UriString): Reference[];
|
|
47
|
+
/**
|
|
48
|
+
* Every edge in the graph that points at a non-existent target — the project's
|
|
49
|
+
* unresolved references. Sorted by (source URI, target URI) for stable output.
|
|
50
|
+
*/
|
|
51
|
+
export declare function missingTargets(graph: AppGraph): Reference[];
|
|
52
|
+
export interface NearestModulesOptions {
|
|
53
|
+
/** Maximum number of candidates to return, closest first. Default 3. */
|
|
54
|
+
limit?: number;
|
|
55
|
+
/** Maximum edit distance to include. Default: no cap (consumer decides relevance). */
|
|
56
|
+
maxDistance?: number;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* The existing modules whose names are closest to `uri` — the "did you mean?"
|
|
60
|
+
* candidate set for a typo'd or missing reference.
|
|
61
|
+
*
|
|
62
|
+
* Candidates are restricted to the SAME category as `uri` (same module `type`,
|
|
63
|
+
* and for Liquid the same `kind`), so a missing `{% render %}` only suggests
|
|
64
|
+
* partials, a missing `{% graphql %}` only graphql operations, etc. Ranked by
|
|
65
|
+
* Levenshtein distance over the project-relative path (reusing check-common's
|
|
66
|
+
* `levenshtein` + `path.relative` — never re-implemented), closest first, ties
|
|
67
|
+
* broken by URI. `uri` itself and known-missing modules are excluded.
|
|
68
|
+
*
|
|
69
|
+
* Pure over the graph: candidates come only from modules present in it, so build
|
|
70
|
+
* with every file as an entry point for a complete candidate pool (see header).
|
|
71
|
+
*/
|
|
72
|
+
export declare function nearestModules(graph: AppGraph, uri: UriString, options?: NearestModulesOptions): AppModule[];
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dependenciesOf = dependenciesOf;
|
|
4
|
+
exports.dependentsOf = dependentsOf;
|
|
5
|
+
exports.exists = exists;
|
|
6
|
+
exports.isEntryPoint = isEntryPoint;
|
|
7
|
+
exports.isOrphan = isOrphan;
|
|
8
|
+
exports.orphans = orphans;
|
|
9
|
+
exports.reachableFrom = reachableFrom;
|
|
10
|
+
exports.missingDependencies = missingDependencies;
|
|
11
|
+
exports.missingTargets = missingTargets;
|
|
12
|
+
exports.nearestModules = nearestModules;
|
|
13
|
+
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
14
|
+
/**
|
|
15
|
+
* Project-structure queries over a BUILT {@link AppGraph}.
|
|
16
|
+
*
|
|
17
|
+
* Every function here is PURE and synchronous: it only reads the in-memory
|
|
18
|
+
* graph produced by `buildAppGraph`. All I/O (disk traversal, parsing,
|
|
19
|
+
* resolution) stays in `buildAppGraph`; this layer never touches the filesystem.
|
|
20
|
+
*
|
|
21
|
+
* These resurrect the old in-supervisor `ProjectFactGraph` / `ProjectMap`
|
|
22
|
+
* capabilities as the graph package's own API, so consumers (the MCP supervisor,
|
|
23
|
+
* the LSP) read project facts without re-deriving any graph logic.
|
|
24
|
+
*
|
|
25
|
+
* Note on graph scope: `buildAppGraph` only materializes modules reachable from
|
|
26
|
+
* its entry points. Whole-project queries like {@link orphans} are therefore
|
|
27
|
+
* only as complete as the graph they are given — to detect unreferenced files,
|
|
28
|
+
* build the graph with every file as an entry point.
|
|
29
|
+
*/
|
|
30
|
+
/** The outgoing dependency edges of `uri` (what it renders/includes/runs/queries/wraps). */
|
|
31
|
+
function dependenciesOf(graph, uri) {
|
|
32
|
+
return graph.modules[uri]?.dependencies ?? [];
|
|
33
|
+
}
|
|
34
|
+
/** The incoming reference edges to `uri` (who renders/includes/runs/queries/wraps it). */
|
|
35
|
+
function dependentsOf(graph, uri) {
|
|
36
|
+
return graph.modules[uri]?.references ?? [];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Whether `uri` is a module in the graph that resolves to a file on disk.
|
|
40
|
+
* Returns `false` for a URI absent from the graph or a known-missing target.
|
|
41
|
+
*/
|
|
42
|
+
function exists(graph, uri) {
|
|
43
|
+
return graph.modules[uri]?.exists ?? false;
|
|
44
|
+
}
|
|
45
|
+
/** Whether `uri` is one of the graph's entry points (a page or layout root). */
|
|
46
|
+
function isEntryPoint(graph, uri) {
|
|
47
|
+
return graph.entryPoints.some((entry) => entry.uri === uri);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Whether `uri` is an orphan: an existing, non-entry-point module that nothing
|
|
51
|
+
* references. Entry points (pages, layouts) are roots reachable independently of
|
|
52
|
+
* render edges, so they are never orphans; known-missing targets are "missing"
|
|
53
|
+
* (see {@link missingDependencies}), not orphans.
|
|
54
|
+
*/
|
|
55
|
+
function isOrphan(graph, uri) {
|
|
56
|
+
const module = graph.modules[uri];
|
|
57
|
+
if (!module || module.exists === false)
|
|
58
|
+
return false;
|
|
59
|
+
if (isEntryPoint(graph, uri))
|
|
60
|
+
return false;
|
|
61
|
+
// Schema nodes are referenced by model table name (from graphql/commands), not
|
|
62
|
+
// by file edges, so they are NEVER edge-referenced — "no incoming references"
|
|
63
|
+
// is meaningless for them. Excluding them keeps orphan = render dead-code.
|
|
64
|
+
if (module.type === "Schema" /* ModuleType.Schema */)
|
|
65
|
+
return false;
|
|
66
|
+
return module.references.length === 0;
|
|
67
|
+
}
|
|
68
|
+
/** Every orphan module in the graph (see {@link isOrphan}), sorted by URI. */
|
|
69
|
+
function orphans(graph) {
|
|
70
|
+
return Object.values(graph.modules)
|
|
71
|
+
.filter((module) => isOrphan(graph, module.uri))
|
|
72
|
+
.sort((a, b) => a.uri.localeCompare(b.uri));
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Every module URI transitively reachable from `uri` by following outgoing
|
|
76
|
+
* dependency edges, sorted. Excludes `uri` itself unless a cycle leads back to
|
|
77
|
+
* it. Modules absent from the graph contribute nothing.
|
|
78
|
+
*/
|
|
79
|
+
function reachableFrom(graph, uri) {
|
|
80
|
+
const seen = new Set();
|
|
81
|
+
const queue = dependenciesOf(graph, uri).map((dep) => dep.target.uri);
|
|
82
|
+
while (queue.length > 0) {
|
|
83
|
+
const next = queue.shift();
|
|
84
|
+
if (seen.has(next))
|
|
85
|
+
continue;
|
|
86
|
+
seen.add(next);
|
|
87
|
+
for (const dep of dependenciesOf(graph, next))
|
|
88
|
+
queue.push(dep.target.uri);
|
|
89
|
+
}
|
|
90
|
+
return [...seen].sort((a, b) => a.localeCompare(b));
|
|
91
|
+
}
|
|
92
|
+
/** The outgoing edges of `uri` whose target does not exist on disk. */
|
|
93
|
+
function missingDependencies(graph, uri) {
|
|
94
|
+
return dependenciesOf(graph, uri).filter((ref) => !exists(graph, ref.target.uri));
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Every edge in the graph that points at a non-existent target — the project's
|
|
98
|
+
* unresolved references. Sorted by (source URI, target URI) for stable output.
|
|
99
|
+
*/
|
|
100
|
+
function missingTargets(graph) {
|
|
101
|
+
return Object.values(graph.modules)
|
|
102
|
+
.flatMap((module) => module.dependencies)
|
|
103
|
+
.filter((ref) => !exists(graph, ref.target.uri))
|
|
104
|
+
.sort((a, b) => a.source.uri.localeCompare(b.source.uri) || a.target.uri.localeCompare(b.target.uri));
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The existing modules whose names are closest to `uri` — the "did you mean?"
|
|
108
|
+
* candidate set for a typo'd or missing reference.
|
|
109
|
+
*
|
|
110
|
+
* Candidates are restricted to the SAME category as `uri` (same module `type`,
|
|
111
|
+
* and for Liquid the same `kind`), so a missing `{% render %}` only suggests
|
|
112
|
+
* partials, a missing `{% graphql %}` only graphql operations, etc. Ranked by
|
|
113
|
+
* Levenshtein distance over the project-relative path (reusing check-common's
|
|
114
|
+
* `levenshtein` + `path.relative` — never re-implemented), closest first, ties
|
|
115
|
+
* broken by URI. `uri` itself and known-missing modules are excluded.
|
|
116
|
+
*
|
|
117
|
+
* Pure over the graph: candidates come only from modules present in it, so build
|
|
118
|
+
* with every file as an entry point for a complete candidate pool (see header).
|
|
119
|
+
*/
|
|
120
|
+
function nearestModules(graph, uri, options = {}) {
|
|
121
|
+
const { limit = 3, maxDistance = Infinity } = options;
|
|
122
|
+
const target = graph.modules[uri];
|
|
123
|
+
if (!target)
|
|
124
|
+
return [];
|
|
125
|
+
const targetPath = platformos_check_common_1.path.relative(uri, graph.rootUri);
|
|
126
|
+
return Object.values(graph.modules)
|
|
127
|
+
.filter((module) => module.uri !== uri &&
|
|
128
|
+
module.exists !== false &&
|
|
129
|
+
module.type === target.type &&
|
|
130
|
+
module.kind === target.kind)
|
|
131
|
+
.map((module) => ({
|
|
132
|
+
module,
|
|
133
|
+
distance: (0, platformos_check_common_1.levenshtein)(platformos_check_common_1.path.relative(module.uri, graph.rootUri), targetPath),
|
|
134
|
+
}))
|
|
135
|
+
.filter((candidate) => candidate.distance <= maxDistance)
|
|
136
|
+
.sort((a, b) => a.distance - b.distance || a.module.uri.localeCompare(b.module.uri))
|
|
137
|
+
.slice(0, limit)
|
|
138
|
+
.map((candidate) => candidate.module);
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","sourceRoot":"","sources":["../../src/graph/query.ts"],"names":[],"mappings":";;AAqBA,wCAEC;AAGD,oCAEC;AAMD,wBAEC;AAGD,oCAEC;AAQD,4BASC;AAGD,0BAIC;AAOD,sCAYC;AAGD,kDAEC;AAMD,wCAQC;AAuBD,wCA2BC;AAzJD,iFAAmF;AAGnF;;;;;;;;;;;;;;;GAeG;AAEH,4FAA4F;AAC5F,SAAgB,cAAc,CAAC,KAAe,EAAE,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;QAChB,MAAM;QACN,QAAQ,EAAE,IAAA,qCAAW,EAAC,8BAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,UAAU,CAAC;KAC5E,CAAC,CAAC;SACF,MAAM,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,QAAQ,IAAI,WAAW,CAAC;SACxD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SACnF,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC;SACf,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const index_1 = require("../index");
|
|
6
|
+
const query_1 = require("./query");
|
|
7
|
+
const module_1 = require("./module");
|
|
8
|
+
const traverse_1 = require("./traverse");
|
|
9
|
+
const test_helpers_1 = require("./test-helpers");
|
|
10
|
+
const targets = (refs) => refs.map((r) => r.target.uri).sort((a, b) => a.localeCompare(b));
|
|
11
|
+
const sources = (refs) => refs.map((r) => r.source.uri).sort((a, b) => a.localeCompare(b));
|
|
12
|
+
(0, vitest_1.describe)('Graph queries: over the built skeleton app graph', () => {
|
|
13
|
+
const p = (part) => platformos_check_common_1.path.join(test_helpers_1.skeleton, ...part.split('/'));
|
|
14
|
+
let graph;
|
|
15
|
+
(0, vitest_1.beforeAll)(async () => {
|
|
16
|
+
graph = await (0, index_1.buildAppGraph)(test_helpers_1.skeleton, (0, test_helpers_1.getDependencies)());
|
|
17
|
+
}, 15000);
|
|
18
|
+
(0, vitest_1.it)('dependenciesOf returns a file’s outgoing targets', () => {
|
|
19
|
+
(0, vitest_1.expect)(targets((0, query_1.dependenciesOf)(graph, p('app/views/pages/index.liquid')))).toEqual([
|
|
20
|
+
p('app/views/layouts/application.liquid'),
|
|
21
|
+
p('app/views/partials/parent.liquid'),
|
|
22
|
+
]);
|
|
23
|
+
});
|
|
24
|
+
(0, vitest_1.it)('dependency edges are call sites carrying kind + named-argument names', () => {
|
|
25
|
+
// index.liquid: `layout: application` (no args) + `{% render "parent", children: "hello" %}`.
|
|
26
|
+
const edges = (0, query_1.dependenciesOf)(graph, p('app/views/pages/index.liquid'))
|
|
27
|
+
.map((ref) => ({ kind: ref.kind, target: ref.target.uri, args: ref.args }))
|
|
28
|
+
.sort((a, b) => a.target.localeCompare(b.target));
|
|
29
|
+
(0, vitest_1.expect)(edges).toEqual([
|
|
30
|
+
{ kind: 'layout', target: p('app/views/layouts/application.liquid'), args: undefined },
|
|
31
|
+
{ kind: 'render', target: p('app/views/partials/parent.liquid'), args: ['children'] },
|
|
32
|
+
]);
|
|
33
|
+
});
|
|
34
|
+
(0, vitest_1.it)('dependentsOf returns every caller of a file', () => {
|
|
35
|
+
(0, vitest_1.expect)(sources((0, query_1.dependentsOf)(graph, p('app/views/partials/child.liquid')))).toEqual([
|
|
36
|
+
p('app/views/partials/header.liquid'),
|
|
37
|
+
p('app/views/partials/parent.liquid'),
|
|
38
|
+
]);
|
|
39
|
+
(0, vitest_1.expect)(sources((0, query_1.dependentsOf)(graph, p('app/views/layouts/application.liquid')))).toEqual([
|
|
40
|
+
p('app/views/pages/index.liquid'),
|
|
41
|
+
]);
|
|
42
|
+
});
|
|
43
|
+
(0, vitest_1.it)('dependenciesOf / dependentsOf return [] for a URI absent from the graph', () => {
|
|
44
|
+
(0, vitest_1.expect)((0, query_1.dependenciesOf)(graph, p('app/views/partials/nope.liquid'))).toEqual([]);
|
|
45
|
+
(0, vitest_1.expect)((0, query_1.dependentsOf)(graph, p('app/views/partials/nope.liquid'))).toEqual([]);
|
|
46
|
+
});
|
|
47
|
+
(0, vitest_1.it)('reachableFrom returns the transitive outgoing closure', () => {
|
|
48
|
+
// Sorted by URI — `app/assets/*` sorts ahead of `app/views/*`.
|
|
49
|
+
(0, vitest_1.expect)((0, query_1.reachableFrom)(graph, p('app/views/pages/index.liquid'))).toEqual([
|
|
50
|
+
p('app/assets/app.css'),
|
|
51
|
+
p('app/assets/app.js'),
|
|
52
|
+
p('app/views/layouts/application.liquid'),
|
|
53
|
+
p('app/views/partials/child.liquid'),
|
|
54
|
+
p('app/views/partials/header.liquid'),
|
|
55
|
+
p('app/views/partials/parent.liquid'),
|
|
56
|
+
]);
|
|
57
|
+
});
|
|
58
|
+
(0, vitest_1.it)('exists reflects on-disk presence', () => {
|
|
59
|
+
(0, vitest_1.expect)((0, query_1.exists)(graph, p('app/views/partials/child.liquid'))).toBe(true);
|
|
60
|
+
(0, vitest_1.expect)((0, query_1.exists)(graph, p('app/views/partials/nope.liquid'))).toBe(false);
|
|
61
|
+
});
|
|
62
|
+
(0, vitest_1.it)('isEntryPoint distinguishes pages/layouts from partials', () => {
|
|
63
|
+
(0, vitest_1.expect)((0, query_1.isEntryPoint)(graph, p('app/views/pages/index.liquid'))).toBe(true);
|
|
64
|
+
(0, vitest_1.expect)((0, query_1.isEntryPoint)(graph, p('app/views/layouts/application.liquid'))).toBe(true);
|
|
65
|
+
(0, vitest_1.expect)((0, query_1.isEntryPoint)(graph, p('app/views/partials/child.liquid'))).toBe(false);
|
|
66
|
+
});
|
|
67
|
+
(0, vitest_1.it)('a fully-wired skeleton has no orphans and no missing targets', () => {
|
|
68
|
+
(0, vitest_1.expect)((0, query_1.orphans)(graph)).toEqual([]);
|
|
69
|
+
(0, vitest_1.expect)((0, query_1.missingTargets)(graph)).toEqual([]);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
(0, vitest_1.describe)('Graph queries: orphan and missing-target detection (hermetic graph)', () => {
|
|
73
|
+
const rootUri = 'file:///app';
|
|
74
|
+
const p = (part) => platformos_check_common_1.path.join(rootUri, ...part.split('/'));
|
|
75
|
+
// page (entry) ─render→ used (exists)
|
|
76
|
+
// └─render→ missing (exists:false)
|
|
77
|
+
// orphan (exists, referenced by nothing, not an entry point)
|
|
78
|
+
// schema (exists, referenced by nothing, not an entry point — but NOT an orphan)
|
|
79
|
+
let graph;
|
|
80
|
+
let pageUri;
|
|
81
|
+
let usedUri;
|
|
82
|
+
let orphanUri;
|
|
83
|
+
let missingUri;
|
|
84
|
+
let schemaUri;
|
|
85
|
+
(0, vitest_1.beforeAll)(() => {
|
|
86
|
+
graph = { rootUri, entryPoints: [], modules: {} };
|
|
87
|
+
const page = (0, module_1.getPageModule)(graph, p('app/views/pages/index.liquid'));
|
|
88
|
+
const used = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/used.liquid'));
|
|
89
|
+
const orphan = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/orphan.liquid'));
|
|
90
|
+
const missing = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/missing.liquid'));
|
|
91
|
+
const schema = (0, module_1.getSchemaModule)(graph, p('app/schema/blog_post.yml'));
|
|
92
|
+
page.exists = true;
|
|
93
|
+
used.exists = true;
|
|
94
|
+
orphan.exists = true;
|
|
95
|
+
missing.exists = false;
|
|
96
|
+
schema.exists = true;
|
|
97
|
+
(0, traverse_1.bind)(page, used, { sourceRange: [0, 10], kind: 'render' });
|
|
98
|
+
(0, traverse_1.bind)(page, missing, { sourceRange: [11, 21], kind: 'render' });
|
|
99
|
+
graph.entryPoints = [page];
|
|
100
|
+
for (const module of [page, used, orphan, missing, schema])
|
|
101
|
+
graph.modules[module.uri] = module;
|
|
102
|
+
pageUri = page.uri;
|
|
103
|
+
usedUri = used.uri;
|
|
104
|
+
orphanUri = orphan.uri;
|
|
105
|
+
missingUri = missing.uri;
|
|
106
|
+
schemaUri = schema.uri;
|
|
107
|
+
});
|
|
108
|
+
(0, vitest_1.it)('flags an unreferenced, non-entry-point file as an orphan', () => {
|
|
109
|
+
(0, vitest_1.expect)((0, query_1.isOrphan)(graph, orphanUri)).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
(0, vitest_1.it)('does not flag referenced files, entry points, or missing targets as orphans', () => {
|
|
112
|
+
(0, vitest_1.expect)((0, query_1.isOrphan)(graph, usedUri)).toBe(false); // referenced by the page
|
|
113
|
+
(0, vitest_1.expect)((0, query_1.isOrphan)(graph, pageUri)).toBe(false); // entry point
|
|
114
|
+
(0, vitest_1.expect)((0, query_1.isOrphan)(graph, missingUri)).toBe(false); // missing, not orphan
|
|
115
|
+
});
|
|
116
|
+
(0, vitest_1.it)('never flags a schema node as an orphan (referenced by table name, not edges)', () => {
|
|
117
|
+
// Without the guard this would be a false positive: schema exists, is not an
|
|
118
|
+
// entry point, and has zero incoming edges.
|
|
119
|
+
(0, vitest_1.expect)((0, query_1.isOrphan)(graph, schemaUri)).toBe(false);
|
|
120
|
+
});
|
|
121
|
+
(0, vitest_1.it)('orphans() lists exactly the orphan modules (excludes the schema)', () => {
|
|
122
|
+
(0, vitest_1.expect)((0, query_1.orphans)(graph).map((m) => m.uri)).toEqual([orphanUri]);
|
|
123
|
+
});
|
|
124
|
+
(0, vitest_1.it)('missingDependencies returns a file’s edges to non-existent targets', () => {
|
|
125
|
+
(0, vitest_1.expect)((0, query_1.missingDependencies)(graph, pageUri)).toEqual([
|
|
126
|
+
{
|
|
127
|
+
source: { uri: pageUri, range: [11, 21] },
|
|
128
|
+
target: { uri: missingUri },
|
|
129
|
+
type: 'direct',
|
|
130
|
+
kind: 'render',
|
|
131
|
+
},
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
(0, vitest_1.it)('missingTargets lists every unresolved edge in the graph', () => {
|
|
135
|
+
(0, vitest_1.expect)((0, query_1.missingTargets)(graph)).toEqual([
|
|
136
|
+
{
|
|
137
|
+
source: { uri: pageUri, range: [11, 21] },
|
|
138
|
+
target: { uri: missingUri },
|
|
139
|
+
type: 'direct',
|
|
140
|
+
kind: 'render',
|
|
141
|
+
},
|
|
142
|
+
]);
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
(0, vitest_1.describe)('Graph queries: nearest-name candidates (did-you-mean)', () => {
|
|
146
|
+
const rootUri = 'file:///app';
|
|
147
|
+
const p = (part) => platformos_check_common_1.path.join(rootUri, ...part.split('/'));
|
|
148
|
+
// Partials: header, footer, sidebar (exist). A layout ALSO named "header"
|
|
149
|
+
// (exists) — same name, different category. A graphql op blog/find (exists).
|
|
150
|
+
// Typo targets: partial "headr" and graphql "blog/fnd" (both exists:false).
|
|
151
|
+
let graph;
|
|
152
|
+
let headerUri;
|
|
153
|
+
let footerUri;
|
|
154
|
+
let sidebarUri;
|
|
155
|
+
let headrUri;
|
|
156
|
+
let graphqlFindUri;
|
|
157
|
+
let graphqlTypoUri;
|
|
158
|
+
(0, vitest_1.beforeAll)(() => {
|
|
159
|
+
graph = { rootUri, entryPoints: [], modules: {} };
|
|
160
|
+
const page = (0, module_1.getPageModule)(graph, p('app/views/pages/index.liquid'));
|
|
161
|
+
const header = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/header.liquid'));
|
|
162
|
+
const footer = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/footer.liquid'));
|
|
163
|
+
const sidebar = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/sidebar.liquid'));
|
|
164
|
+
const headerLayout = (0, module_1.getLayoutModule)(graph, p('app/views/layouts/header.liquid'));
|
|
165
|
+
const find = (0, module_1.getGraphQLModuleByUri)(graph, p('app/graphql/blog/find.graphql'));
|
|
166
|
+
const headr = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/headr.liquid'));
|
|
167
|
+
const graphqlTypo = (0, module_1.getGraphQLModuleByUri)(graph, p('app/graphql/blog/fnd.graphql'));
|
|
168
|
+
for (const m of [page, header, footer, sidebar, headerLayout, find])
|
|
169
|
+
m.exists = true;
|
|
170
|
+
headr.exists = false;
|
|
171
|
+
graphqlTypo.exists = false;
|
|
172
|
+
graph.entryPoints = [page];
|
|
173
|
+
for (const m of [page, header, footer, sidebar, headerLayout, find, headr, graphqlTypo]) {
|
|
174
|
+
graph.modules[m.uri] = m;
|
|
175
|
+
}
|
|
176
|
+
headerUri = header.uri;
|
|
177
|
+
footerUri = footer.uri;
|
|
178
|
+
sidebarUri = sidebar.uri;
|
|
179
|
+
headrUri = headr.uri;
|
|
180
|
+
graphqlFindUri = find.uri;
|
|
181
|
+
graphqlTypoUri = graphqlTypo.uri;
|
|
182
|
+
});
|
|
183
|
+
(0, vitest_1.it)('ranks the closest same-category name first', () => {
|
|
184
|
+
(0, vitest_1.expect)((0, query_1.nearestModules)(graph, headrUri, { limit: 1 }).map((m) => m.uri)).toEqual([headerUri]);
|
|
185
|
+
});
|
|
186
|
+
(0, vitest_1.it)('only considers existing modules of the same category (excludes self, layouts, graphql, missing)', () => {
|
|
187
|
+
// The layout "header" shares the name but is a different kind; the graphql
|
|
188
|
+
// op, the page, the typo itself, and missing modules are all out.
|
|
189
|
+
const uris = (0, query_1.nearestModules)(graph, headrUri, { limit: 10 })
|
|
190
|
+
.map((m) => m.uri)
|
|
191
|
+
.sort((a, b) => a.localeCompare(b));
|
|
192
|
+
(0, vitest_1.expect)(uris).toEqual([footerUri, headerUri, sidebarUri]);
|
|
193
|
+
});
|
|
194
|
+
(0, vitest_1.it)('honours maxDistance', () => {
|
|
195
|
+
// Only "header" is within edit distance 1 of "headr".
|
|
196
|
+
(0, vitest_1.expect)((0, query_1.nearestModules)(graph, headrUri, { maxDistance: 1 }).map((m) => m.uri)).toEqual([
|
|
197
|
+
headerUri,
|
|
198
|
+
]);
|
|
199
|
+
});
|
|
200
|
+
(0, vitest_1.it)('suggests graphql operations for a missing graphql target', () => {
|
|
201
|
+
(0, vitest_1.expect)((0, query_1.nearestModules)(graph, graphqlTypoUri, { limit: 1 }).map((m) => m.uri)).toEqual([
|
|
202
|
+
graphqlFindUri,
|
|
203
|
+
]);
|
|
204
|
+
});
|
|
205
|
+
(0, vitest_1.it)('returns [] for a URI absent from the graph', () => {
|
|
206
|
+
(0, vitest_1.expect)((0, query_1.nearestModules)(graph, p('app/views/partials/unknown.liquid'))).toEqual([]);
|
|
207
|
+
});
|
|
208
|
+
});
|
|
209
|
+
//# sourceMappingURL=query.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.spec.js","sourceRoot":"","sources":["../../src/graph/query.spec.ts"],"names":[],"mappings":";;AAAA,iFAAwE;AACxE,mCAAyD;AACzD,oCAAyC;AAEzC,mCAWiB;AACjB,qCAMkB;AAClB,yCAAkC;AAClC,iDAA2D;AAE3D,MAAM,OAAO,GAAG,CAAC,IAAmC,EAAE,EAAE,CACtD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AACnE,MAAM,OAAO,GAAG,CAAC,IAAmC,EAAE,EAAE,CACtD,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;AAEnE,IAAA,iBAAQ,EAAC,kDAAkD,EAAE,GAAG,EAAE;IAChE,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,8BAAS,CAAC,IAAI,CAAC,uBAAQ,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,C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AAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,IAAA,eAAM,EAAC,IAAA,sBAAc,EAAC,KAAK,EAAE,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IACpF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const platformos_check_common_1 = require("@platformos/platformos-check-common");
|
|
4
|
+
const vitest_1 = require("vitest");
|
|
5
|
+
const module_1 = require("./module");
|
|
6
|
+
const serialize_1 = require("./serialize");
|
|
7
|
+
const traverse_1 = require("./traverse");
|
|
8
|
+
(0, vitest_1.describe)('Unit: serializeAppGraph', () => {
|
|
9
|
+
(0, vitest_1.it)('serialize the graph', () => {
|
|
10
|
+
const rootUri = 'file:///app';
|
|
11
|
+
const p = (part) => platformos_check_common_1.path.join(rootUri, part);
|
|
12
|
+
const graph = {
|
|
13
|
+
entryPoints: [],
|
|
14
|
+
modules: {},
|
|
15
|
+
rootUri,
|
|
16
|
+
};
|
|
17
|
+
const layout = (0, module_1.getLayoutModule)(graph, p('app/views/layouts/application.liquid'));
|
|
18
|
+
const headerPartial = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/header.liquid'));
|
|
19
|
+
const parentPartial = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/parent.liquid'));
|
|
20
|
+
const childPartial = (0, module_1.getPartialModuleByUri)(graph, p('app/views/partials/child.liquid'));
|
|
21
|
+
(0, traverse_1.bind)(layout, headerPartial, { sourceRange: [0, 5] });
|
|
22
|
+
(0, traverse_1.bind)(layout, parentPartial, { sourceRange: [10, 15] });
|
|
23
|
+
(0, traverse_1.bind)(parentPartial, childPartial, { sourceRange: [20, 25] });
|
|
24
|
+
graph.entryPoints = [layout];
|
|
25
|
+
[layout, headerPartial, parentPartial, childPartial].forEach((module) => {
|
|
26
|
+
graph.modules[module.uri] = module;
|
|
27
|
+
});
|
|
28
|
+
const { nodes, edges } = (0, serialize_1.serializeAppGraph)(graph);
|
|
29
|
+
(0, vitest_1.expect)(nodes).toHaveLength(4);
|
|
30
|
+
(0, vitest_1.expect)(edges).toHaveLength(3);
|
|
31
|
+
(0, vitest_1.expect)(edges).toEqual(vitest_1.expect.arrayContaining([
|
|
32
|
+
{
|
|
33
|
+
source: { uri: p('app/views/layouts/application.liquid'), range: [0, 5] },
|
|
34
|
+
target: { uri: p('app/views/partials/header.liquid') },
|
|
35
|
+
type: 'direct',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
source: { uri: p('app/views/layouts/application.liquid'), range: [10, 15] },
|
|
39
|
+
target: { uri: p('app/views/partials/parent.liquid') },
|
|
40
|
+
type: 'direct',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
source: { uri: p('app/views/partials/parent.liquid'), range: [20, 25] },
|
|
44
|
+
target: { uri: p('app/views/partials/child.liquid') },
|
|
45
|
+
type: 'direct',
|
|
46
|
+
},
|
|
47
|
+
]));
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=serialize.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serialize.spec.js","sourceRoot":"","sources":["../../src/graph/serialize.spec.ts"],"names":[],"mappings":";;AAAA,iFAAwE;AACxE,mCAA8C;AAE9C,qCAAkE;AAClE,2CAAgD;AAChD,yCAAkC;AAElC,IAAA,iBAAQ,EAAC,yBAAyB,EAAE,GAAG,EAAE;IACvC,IAAA,WAAE,EAAC,qBAAqB,EAAE,GAAG,EAAE;QAC7B,MAAM,OAAO,GAAG,aAAa,CAAC;QAC9B,MAAM,CAAC,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,8BAAS,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QA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