@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.
Files changed (120) hide show
  1. package/CHANGELOG.md +511 -8
  2. package/dist/cache-probes.spec.d.ts +1 -0
  3. package/dist/cache-probes.spec.js +62 -0
  4. package/dist/cache-probes.spec.js.map +1 -0
  5. package/dist/cli.js +18 -13
  6. package/dist/cli.js.map +1 -1
  7. package/dist/cli.spec.d.ts +1 -0
  8. package/dist/cli.spec.js +235 -0
  9. package/dist/cli.spec.js.map +1 -0
  10. package/dist/graph/app-index-resolution.spec.d.ts +1 -0
  11. package/dist/graph/app-index-resolution.spec.js +167 -0
  12. package/dist/graph/app-index-resolution.spec.js.map +1 -0
  13. package/dist/graph/asset-resolution.spec.d.ts +1 -0
  14. package/dist/graph/asset-resolution.spec.js +64 -0
  15. package/dist/graph/asset-resolution.spec.js.map +1 -0
  16. package/dist/graph/augment.js +3 -0
  17. package/dist/graph/augment.js.map +1 -1
  18. package/dist/graph/build.d.ts +15 -2
  19. package/dist/graph/build.js +54 -12
  20. package/dist/graph/build.js.map +1 -1
  21. package/dist/graph/build.spec.d.ts +1 -0
  22. package/dist/graph/build.spec.js +138 -0
  23. package/dist/graph/build.spec.js.map +1 -0
  24. package/dist/graph/edge-sources.d.ts +28 -0
  25. package/dist/graph/edge-sources.js +43 -0
  26. package/dist/graph/edge-sources.js.map +1 -0
  27. package/dist/graph/edge-sources.spec.d.ts +1 -0
  28. package/dist/graph/edge-sources.spec.js +125 -0
  29. package/dist/graph/edge-sources.spec.js.map +1 -0
  30. package/dist/graph/extract.spec.d.ts +1 -0
  31. package/dist/graph/extract.spec.js +163 -0
  32. package/dist/graph/extract.spec.js.map +1 -0
  33. package/dist/graph/module.d.ts +60 -7
  34. package/dist/graph/module.js +137 -41
  35. package/dist/graph/module.js.map +1 -1
  36. package/dist/graph/module.spec.d.ts +1 -0
  37. package/dist/graph/module.spec.js +74 -0
  38. package/dist/graph/module.spec.js.map +1 -0
  39. package/dist/graph/query.d.ts +72 -0
  40. package/dist/graph/query.js +140 -0
  41. package/dist/graph/query.js.map +1 -0
  42. package/dist/graph/query.spec.d.ts +1 -0
  43. package/dist/graph/query.spec.js +209 -0
  44. package/dist/graph/query.spec.js.map +1 -0
  45. package/dist/graph/serialize.spec.d.ts +1 -0
  46. package/dist/graph/serialize.spec.js +50 -0
  47. package/dist/graph/serialize.spec.js.map +1 -0
  48. package/dist/graph/structural.spec.d.ts +1 -0
  49. package/dist/graph/structural.spec.js +146 -0
  50. package/dist/graph/structural.spec.js.map +1 -0
  51. package/dist/graph/test-helpers.js +3 -3
  52. package/dist/graph/test-helpers.js.map +1 -1
  53. package/dist/graph/traverse-edges.spec.d.ts +1 -0
  54. package/dist/graph/traverse-edges.spec.js +337 -0
  55. package/dist/graph/traverse-edges.spec.js.map +1 -0
  56. package/dist/graph/traverse.d.ts +51 -20
  57. package/dist/graph/traverse.js +239 -29
  58. package/dist/graph/traverse.js.map +1 -1
  59. package/dist/index.d.ts +5 -1
  60. package/dist/index.js +19 -1
  61. package/dist/index.js.map +1 -1
  62. package/dist/parsers.d.ts +35 -0
  63. package/dist/parsers.js +72 -0
  64. package/dist/parsers.js.map +1 -0
  65. package/dist/parsers.spec.d.ts +1 -0
  66. package/dist/parsers.spec.js +70 -0
  67. package/dist/parsers.spec.js.map +1 -0
  68. package/dist/toSourceCode.d.ts +14 -2
  69. package/dist/toSourceCode.js +23 -19
  70. package/dist/toSourceCode.js.map +1 -1
  71. package/dist/tsconfig.tsbuildinfo +1 -1
  72. package/dist/types.d.ts +102 -3
  73. package/dist/types.js.map +1 -1
  74. package/dist/utils/index.d.ts +1 -1
  75. package/fixtures/asset-edges/app/assets/logo.css +1 -0
  76. package/fixtures/asset-edges/app/assets/site/app.js +1 -0
  77. package/fixtures/asset-edges/app/views/pages/index.liquid +3 -0
  78. package/fixtures/graphql-table/app/graphql/with_table.graphql +5 -0
  79. package/fixtures/graphql-table/app/graphql/without_table.graphql +3 -0
  80. package/fixtures/graphql-table/app/views/pages/index.liquid +4 -0
  81. package/fixtures/layout-edges/app/views/layouts/theme.liquid +4 -0
  82. package/fixtures/layout-edges/app/views/pages/broken.liquid +5 -0
  83. package/fixtures/layout-edges/app/views/pages/index.liquid +5 -0
  84. package/fixtures/schema-nodes/app/schema/blog_post.yml +6 -0
  85. package/fixtures/schema-nodes/app/schema/no_name.yml +3 -0
  86. package/fixtures/schema-nodes/app/views/pages/index.liquid +1 -0
  87. package/fixtures/structural/app/views/pages/about.liquid +1 -0
  88. package/fixtures/structural/app/views/pages/blog/show.liquid +4 -0
  89. package/fixtures/structural/app/views/pages/index.liquid +6 -0
  90. package/fixtures/structural/app/views/pages/rich.liquid +8 -0
  91. package/fixtures/structural/app/views/partials/card.liquid +1 -0
  92. package/fixtures/structural/app/views/partials/documented.liquid +5 -0
  93. package/package.json +7 -5
  94. package/src/cli.spec.ts +37 -31
  95. package/src/cli.ts +31 -15
  96. package/src/graph/augment.ts +4 -0
  97. package/src/graph/build.spec.ts +871 -6
  98. package/src/graph/build.ts +68 -17
  99. package/src/graph/edge-sources.spec.ts +125 -0
  100. package/src/graph/edge-sources.ts +49 -0
  101. package/src/graph/module.spec.ts +168 -0
  102. package/src/graph/module.ts +139 -45
  103. package/src/graph/query.spec.ts +260 -0
  104. package/src/graph/query.ts +154 -0
  105. package/src/graph/serialize.spec.ts +4 -4
  106. package/src/graph/test-helpers.ts +3 -3
  107. package/src/graph/{extract.spec.ts → traverse.spec.ts} +125 -2
  108. package/src/graph/traverse.ts +278 -37
  109. package/src/index.ts +16 -1
  110. package/src/parsers.spec.ts +85 -0
  111. package/src/parsers.ts +75 -0
  112. package/src/toSourceCode.ts +26 -26
  113. package/src/types.ts +106 -7
  114. package/src/utils/index.ts +1 -1
  115. package/dist/getWebComponentMap.d.ts +0 -10
  116. package/dist/getWebComponentMap.js +0 -66
  117. package/dist/getWebComponentMap.js.map +0 -1
  118. package/src/graph/traverse-edges.spec.ts +0 -278
  119. /package/fixtures/skeleton/{assets → app/assets}/app.css +0 -0
  120. /package/fixtures/skeleton/{assets → app/assets}/app.js +0 -0
@@ -1,31 +1,60 @@
1
1
  import { UriString } from '@platformos/platformos-check-common';
2
- import { AugmentedDependencies, AppGraph, AppModule, FileSourceCode, Range, Reference, ReferenceKind, Void } from '../types';
3
- /** The dependency surface the reference resolver needs: just a filesystem (for DocumentsLocator). */
4
- type ResolverDependencies = Pick<AugmentedDependencies, 'fs'>;
5
- export declare function traverseModule(module: AppModule, appGraph: AppGraph, deps: AugmentedDependencies): Promise<Void>;
2
+ import { AugmentedDependencies, AppGraph, AppModule, FileSourceCode, GraphBuildOptions, ModuleStructural, Range, Reference, ReferenceKind, Void } from '../types';
3
+ /** A resolved outgoing reference: the target graph node + its call-site range + kind (+ named-arg names). */
4
+ export interface ResolvedReference {
5
+ target: AppModule;
6
+ sourceRange: Range;
7
+ kind: ReferenceKind;
8
+ /** Names of the named arguments at the call site, in source order; omitted when none. */
9
+ args?: string[];
10
+ }
11
+ /** The dependency surface the reference resolver needs: what `DocumentsLocator` takes. */
12
+ type ResolverDependencies = Pick<AugmentedDependencies, 'fs' | 'app'>;
13
+ export declare function traverseModule(module: AppModule, appGraph: AppGraph, deps: AugmentedDependencies, options?: GraphBuildOptions): Promise<Void>;
6
14
  /**
7
- * Extract one Liquid file's outgoing dependency references, resolved against the
8
- * project at `rootUri`, WITHOUT building the whole app graph.
15
+ * Resolve a single parsed Liquid file's outgoing references — the one place that
16
+ * knows how each Liquid construct (`render`/`include`, `function`, `background`,
17
+ * `graphql`, asset filters) maps to a target module + {@link ReferenceKind}.
9
18
  *
10
- * This is the per-file primitive for consumers that hold a single (possibly
11
- * in-flight, not-yet-on-disk) buffer — e.g. a `validate_code`-style tool that
12
- * parses the buffer with {@link toSourceCode} and wants the file's resolved
13
- * `render`/`include`/`function`/`background`/`graphql`/asset edges with their
14
- * canonical target URIs and {@link ReferenceKind}. Resolution uses the same
15
- * `DocumentsLocator`-backed logic as the full graph build, so a target's URI is
16
- * identical to the key it would have as a graph node.
19
+ * Both the full-project traversal ({@link traverseLiquidModule}) and the
20
+ * standalone per-file primitive ({@link extractFileReferences}) go through this,
21
+ * so resolution can never drift between "graph build" and "validate one buffer".
22
+ *
23
+ * Targets are produced via the module factories (which normalize URIs), so keys
24
+ * match the rest of the graph on every platform. Unparseable input yields no
25
+ * references rather than throwing.
26
+ */
27
+ export declare function resolveLiquidReferences(appGraph: AppGraph, sourceCode: FileSourceCode, deps: ResolverDependencies): Promise<ResolvedReference[]>;
28
+ /**
29
+ * Extract one Liquid file's outgoing dependency references, resolved against the project at
30
+ * `rootUri`, WITHOUT building the whole app graph.
31
+ *
32
+ * The per-file primitive for consumers holding a single (possibly in-flight, not-yet-on-disk)
33
+ * buffer. Resolution uses the same `DocumentsLocator`-backed logic as the full graph build, so
34
+ * a target's URI is identical to the key it would have as a graph node.
17
35
  *
18
36
  * Notes for consumers:
19
- * - Targets are returned whether or not they exist on disk (resolution is
20
- * path-based). To distinguish missing targets, `stat` `target.uri` via the
21
- * same `fs`; unresolved/missing partials are also surfaced by the linter's
22
- * `MissingPartial` check, so prefer that for diagnostics.
37
+ * - Targets are returned whether or not they exist on disk (resolution is path-based). To
38
+ * distinguish missing targets, `stat` `target.uri` via the same `fs`.
23
39
  * - Only statically resolvable references are returned; dynamic targets
24
40
  * (`{% render some_var %}`) and inline forms are skipped.
25
- * - `sourceCode` is parsed by the caller (from the buffer, not disk); only `fs`
26
- * is touched here, for target resolution.
41
+ * - `sourceCode` is parsed by the caller; nothing but target resolution happens here.
27
42
  */
28
43
  export declare function extractFileReferences(rootUri: UriString, sourceUri: UriString, sourceCode: FileSourceCode, deps: ResolverDependencies): Promise<Reference[]>;
44
+ /**
45
+ * Extract a Liquid file's own structural declarations from an already-parsed source — the
46
+ * per-file primitive, sibling to {@link extractFileReferences}. Reuses the shared `js-yaml`
47
+ * frontmatter parse, platformos-common's slug helpers, and check-common's liquid-doc and
48
+ * translation detection — never a second parser.
49
+ *
50
+ * Usage facts come from one walk of the parsed AST and are always present (sorted,
51
+ * de-duplicated); `doc_params` is in source order. Routing facts come from frontmatter: `slug`
52
+ * is the frontmatter override else the path-derived slug, for page files only, and
53
+ * `layout`/`method` when declared.
54
+ *
55
+ * Returns `undefined` for a non-Liquid source or one that could not be parsed.
56
+ */
57
+ export declare function extractStructural(sourceCode: FileSourceCode, uri: UriString): Promise<ModuleStructural | undefined>;
29
58
  /**
30
59
  * The bind method is the method that links two modules together.
31
60
  *
@@ -34,9 +63,11 @@ export declare function extractFileReferences(rootUri: UriString, sourceUri: Uri
34
63
  * This function mutates the source and target modules.
35
64
  */
36
65
  export declare function bind(source: AppModule, target: AppModule, { sourceRange, type, // the type of dependency, can be 'direct' or 'indirect'
37
- kind, }?: {
66
+ kind, // the semantic Liquid construct that created the edge
67
+ args, }?: {
38
68
  sourceRange?: Range;
39
69
  type?: Reference['type'];
40
70
  kind?: ReferenceKind;
71
+ args?: string[];
41
72
  }): void;
42
73
  export {};
@@ -1,15 +1,21 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.traverseModule = traverseModule;
7
+ exports.resolveLiquidReferences = resolveLiquidReferences;
4
8
  exports.extractFileReferences = extractFileReferences;
9
+ exports.extractStructural = extractStructural;
5
10
  exports.bind = bind;
11
+ const js_yaml_1 = __importDefault(require("js-yaml"));
6
12
  const liquid_html_parser_1 = require("@platformos/liquid-html-parser");
7
13
  const platformos_check_common_1 = require("@platformos/platformos-check-common");
8
14
  const platformos_common_1 = require("@platformos/platformos-common");
9
15
  const vscode_uri_1 = require("vscode-uri");
10
16
  const utils_1 = require("../utils");
11
17
  const module_1 = require("./module");
12
- async function traverseModule(module, appGraph, deps) {
18
+ async function traverseModule(module, appGraph, deps, options = {}) {
13
19
  // If the module is already traversed, skip it
14
20
  if (appGraph.modules[module.uri]) {
15
21
  return;
@@ -25,30 +31,50 @@ async function traverseModule(module, appGraph, deps) {
25
31
  }
26
32
  switch (module.type) {
27
33
  case "Liquid" /* ModuleType.Liquid */: {
28
- return traverseLiquidModule(module, appGraph, deps);
34
+ return traverseLiquidModule(module, appGraph, deps, options);
29
35
  }
30
36
  case "Asset" /* ModuleType.Asset */: {
31
37
  return; // Nothing to traverse in assets
32
38
  }
33
39
  case "GraphQL" /* ModuleType.GraphQL */: {
34
- return; // Leaf node — GraphQL documents have no platformOS dependencies
40
+ // Leaf node — GraphQL documents have no platformOS dependencies. We do read the
41
+ // file once to record the model tables it targets (a neutral platform fact),
42
+ // from the parse the source code already carries: when the graph reads through
43
+ // an `App` that is the SAME parse the lint used, not a second one.
44
+ const sourceCode = await deps.getSourceCode(module.uri);
45
+ module.tables = (0, platformos_common_1.isGraphqlDocument)(sourceCode.ast) ? (0, platformos_common_1.extractGraphqlTables)(sourceCode.ast) : [];
46
+ return;
47
+ }
48
+ case "Schema" /* ModuleType.Schema */: {
49
+ // Leaf node — a custom model type / schema file. Read the source once to
50
+ // record its model table name (the YAML `name:`), a neutral platform fact.
51
+ const sourceCode = await deps.getSourceCode(module.uri);
52
+ module.table = (0, platformos_common_1.extractSchemaTable)(sourceCode.source);
53
+ return;
35
54
  }
36
55
  default: {
37
56
  return (0, utils_1.assertNever)(module);
38
57
  }
39
58
  }
40
59
  }
41
- async function traverseLiquidModule(module, appGraph, deps) {
60
+ async function traverseLiquidModule(module, appGraph, deps, options) {
42
61
  const sourceCode = await deps.getSourceCode(module.uri);
62
+ // Surface the file's own structural declarations as a by-product of the parse
63
+ // — only when the caller opted in (see GraphBuildOptions). Absent
64
+ // otherwise, and when the file could not be parsed.
65
+ if (options.includeStructural) {
66
+ module.structural = await extractStructural(sourceCode, module.uri);
67
+ }
43
68
  const references = await resolveLiquidReferences(appGraph, sourceCode, deps);
44
69
  for (const reference of references) {
45
70
  bind(module, reference.target, {
46
71
  sourceRange: reference.sourceRange,
47
72
  kind: reference.kind,
73
+ args: reference.args,
48
74
  });
49
75
  }
50
76
  const modules = (0, utils_1.unique)(references.map((ref) => ref.target));
51
- const promises = modules.map((mod) => traverseModule(mod, appGraph, deps));
77
+ const promises = modules.map((mod) => traverseModule(mod, appGraph, deps, options));
52
78
  return Promise.all(promises);
53
79
  }
54
80
  /**
@@ -67,16 +93,26 @@ async function traverseLiquidModule(module, appGraph, deps) {
67
93
  async function resolveLiquidReferences(appGraph, sourceCode, deps) {
68
94
  if (sourceCode.ast instanceof Error)
69
95
  return []; // can't visit what you can't parse
70
- // Canonical target resolution (lib paths, module prefixes, extensions) is
71
- // owned by check-common's DocumentsLocator — never re-derived here.
72
- const documentsLocator = new platformos_common_1.DocumentsLocator(deps.fs);
96
+ // Canonical target resolution (lib paths, module prefixes, extensions) is owned by
97
+ // platformos-common's DocumentsLocator — never re-derived here.
98
+ //
99
+ // `deps.app` is the caller's App, so a name is answered by the index it already holds
100
+ // (O(1), no I/O) and only an index MISS walks candidate directories. Without one the
101
+ // locator builds a walk-only stand-in and every reference lists a directory per
102
+ // candidate path — same answers, thousands of extra listings on a project the language
103
+ // server had already indexed. See `IDependencies.app`.
104
+ const documentsLocator = new platformos_common_1.DocumentsLocator(deps.fs, deps.app);
73
105
  const rootUri = vscode_uri_1.URI.parse(appGraph.rootUri);
74
106
  const visitor = {
75
107
  // {{ 'app.js' | asset_url }}
76
- // {{ 'image.png' | asset_img_url }}
77
- // {{ 'icon.svg' | inline_asset_content }}
108
+ //
109
+ // `asset_url` is the ONLY filter that names an asset. `asset_img_url` and
110
+ // `inline_asset_content` stood beside it here and are Shopify's, inherited with the fork:
111
+ // neither is in `filters.json`, so no platformOS template can call one, and the four sample
112
+ // projects contain zero uses against 1142 of `asset_url`. A dead name in an edge rule is not
113
+ // harmless — it is a claim about the platform that the next reader has no reason to doubt.
78
114
  LiquidFilter: async (node, ancestors) => {
79
- if (['asset_url', 'asset_img_url', 'inline_asset_content'].includes(node.name)) {
115
+ if (node.name === 'asset_url') {
80
116
  const parentNode = ancestors[ancestors.length - 1];
81
117
  if (parentNode.type !== liquid_html_parser_1.NodeTypes.LiquidVariable)
82
118
  return;
@@ -85,11 +121,23 @@ async function resolveLiquidReferences(appGraph, sourceCode, deps) {
85
121
  if (parentNode.filters[0] !== node)
86
122
  return;
87
123
  const asset = parentNode.expression.value;
88
- const assetModule = (0, module_1.getAssetModule)(appGraph, asset);
89
- if (!assetModule)
124
+ // Skip a non-asset value before paying for the filesystem probe below.
125
+ // Not the only gate: `getAssetModuleByUri` applies the same predicate, so
126
+ // neither layer relies on the other remembering.
127
+ if (!(0, module_1.isSupportedAsset)(asset))
128
+ return;
129
+ // Resolve through DocumentsLocator (`'asset'`: app/assets, module
130
+ // public/assets) — not a hard-coded base — so the target matches the
131
+ // real on-disk location, with the canonical `app/assets/<name>` as the
132
+ // fallback for an unresolved asset.
133
+ const uri = await documentsLocator.locateOrDefault(rootUri, 'asset', asset);
134
+ if (!uri)
90
135
  return;
136
+ const target = (0, module_1.getAssetModuleByUri)(appGraph, uri);
137
+ if (!target)
138
+ return; // resolution changed the extension — no asset node
91
139
  return {
92
- target: assetModule,
140
+ target,
93
141
  sourceRange: [parentNode.position.start, parentNode.position.end],
94
142
  kind: 'asset',
95
143
  };
@@ -113,6 +161,7 @@ async function resolveLiquidReferences(appGraph, sourceCode, deps) {
113
161
  target: (0, module_1.getPartialModuleByUri)(appGraph, uri),
114
162
  sourceRange: [tag.position.start, tag.position.end],
115
163
  kind: isInclude ? 'include' : 'render',
164
+ args: argNames(node.args),
116
165
  };
117
166
  },
118
167
  // {% function result = 'queries/...' %} / {% function res = 'commands/...' %}
@@ -128,6 +177,7 @@ async function resolveLiquidReferences(appGraph, sourceCode, deps) {
128
177
  target: (0, module_1.getPartialModuleByUri)(appGraph, uri),
129
178
  sourceRange: [tag.position.start, tag.position.end],
130
179
  kind: 'function',
180
+ args: argNames(node.args),
131
181
  };
132
182
  },
133
183
  // {% background job_id = 'partial', ... %} (file-based form)
@@ -147,6 +197,7 @@ async function resolveLiquidReferences(appGraph, sourceCode, deps) {
147
197
  target: (0, module_1.getPartialModuleByUri)(appGraph, uri),
148
198
  sourceRange: [tag.position.start, tag.position.end],
149
199
  kind: 'background',
200
+ args: argNames(node.args),
150
201
  };
151
202
  },
152
203
  // {% graphql result = 'path/to/operation' %}
@@ -163,32 +214,52 @@ async function resolveLiquidReferences(appGraph, sourceCode, deps) {
163
214
  target: (0, module_1.getGraphQLModuleByUri)(appGraph, uri),
164
215
  sourceRange: [tag.position.start, tag.position.end],
165
216
  kind: 'graphql',
217
+ args: argNames(node.args),
218
+ };
219
+ },
220
+ // Frontmatter `layout: name` → page/email → its wrapper layout.
221
+ // Resolved through DocumentsLocator (`'layout'`: app/views/layouts, module
222
+ // prefixes, `.html.liquid`/`.liquid`). Only an EXPLICIT, static, non-empty
223
+ // string layout produces an edge:
224
+ // - `layout: ''` → explicitly no layout (no edge)
225
+ // - layout omitted → no edge (we never synthesize the implicit default)
226
+ // - dynamic `{{ ... }}` → no edge (not statically resolvable)
227
+ // - non-string value → no edge
228
+ // The source range is the whole frontmatter block (tag-level granularity,
229
+ // like the other edges).
230
+ YAMLFrontmatter: async (node) => {
231
+ const data = loadFrontmatter(node.body);
232
+ if (!data)
233
+ return; // malformed/empty frontmatter — nothing to resolve
234
+ const layout = data.layout;
235
+ if (typeof layout !== 'string' || layout === '' || (0, platformos_common_1.containsLiquid)(layout))
236
+ return;
237
+ const uri = await documentsLocator.locateOrDefault(rootUri, 'layout', layout);
238
+ if (!uri)
239
+ return;
240
+ return {
241
+ target: (0, module_1.getLayoutModuleByUri)(appGraph, uri),
242
+ sourceRange: [node.position.start, node.position.end],
243
+ kind: 'layout',
166
244
  };
167
245
  },
168
246
  };
169
247
  return (0, platformos_check_common_1.visit)(sourceCode.ast, visitor);
170
248
  }
171
249
  /**
172
- * Extract one Liquid file's outgoing dependency references, resolved against the
173
- * project at `rootUri`, WITHOUT building the whole app graph.
250
+ * Extract one Liquid file's outgoing dependency references, resolved against the project at
251
+ * `rootUri`, WITHOUT building the whole app graph.
174
252
  *
175
- * This is the per-file primitive for consumers that hold a single (possibly
176
- * in-flight, not-yet-on-disk) buffer — e.g. a `validate_code`-style tool that
177
- * parses the buffer with {@link toSourceCode} and wants the file's resolved
178
- * `render`/`include`/`function`/`background`/`graphql`/asset edges with their
179
- * canonical target URIs and {@link ReferenceKind}. Resolution uses the same
180
- * `DocumentsLocator`-backed logic as the full graph build, so a target's URI is
181
- * identical to the key it would have as a graph node.
253
+ * The per-file primitive for consumers holding a single (possibly in-flight, not-yet-on-disk)
254
+ * buffer. Resolution uses the same `DocumentsLocator`-backed logic as the full graph build, so
255
+ * a target's URI is identical to the key it would have as a graph node.
182
256
  *
183
257
  * Notes for consumers:
184
- * - Targets are returned whether or not they exist on disk (resolution is
185
- * path-based). To distinguish missing targets, `stat` `target.uri` via the
186
- * same `fs`; unresolved/missing partials are also surfaced by the linter's
187
- * `MissingPartial` check, so prefer that for diagnostics.
258
+ * - Targets are returned whether or not they exist on disk (resolution is path-based). To
259
+ * distinguish missing targets, `stat` `target.uri` via the same `fs`.
188
260
  * - Only statically resolvable references are returned; dynamic targets
189
261
  * (`{% render some_var %}`) and inline forms are skipped.
190
- * - `sourceCode` is parsed by the caller (from the buffer, not disk); only `fs`
191
- * is touched here, for target resolution.
262
+ * - `sourceCode` is parsed by the caller; nothing but target resolution happens here.
192
263
  */
193
264
  async function extractFileReferences(rootUri, sourceUri, sourceCode, deps) {
194
265
  // A throwaway graph so the URI-normalizing module factories can be reused; it
@@ -200,6 +271,7 @@ async function extractFileReferences(rootUri, sourceUri, sourceCode, deps) {
200
271
  target: { uri: reference.target.uri },
201
272
  type: 'direct',
202
273
  kind: reference.kind,
274
+ ...argsField(reference.args),
203
275
  }));
204
276
  }
205
277
  /**
@@ -211,6 +283,142 @@ async function extractFileReferences(rootUri, sourceUri, sourceCode, deps) {
211
283
  function isStringLiteral(node) {
212
284
  return !(0, utils_1.isString)(node) && node.type === liquid_html_parser_1.NodeTypes.String;
213
285
  }
286
+ /**
287
+ * Parse a YAML block (frontmatter body or a schema file) into an object, or
288
+ * `undefined` for unparseable / non-object YAML. The single `js-yaml` entry
289
+ * point shared by the layout-edge resolver, schema-table extraction, and
290
+ * self-structural extraction — so there is one frontmatter/YAML parse path.
291
+ */
292
+ function loadFrontmatter(body) {
293
+ let data;
294
+ try {
295
+ // A duplicated key must not cost this file its edges — see
296
+ // PLATFORM_YAML_LOAD_OPTIONS. js-yaml's default throws, and the `catch` below
297
+ // then reports the file as having no frontmatter and no schema at all, which is
298
+ // how one repeated key silently removes a layout or partial from the graph.
299
+ data = js_yaml_1.default.load(body, platformos_common_1.PLATFORM_YAML_LOAD_OPTIONS);
300
+ }
301
+ catch {
302
+ return undefined;
303
+ }
304
+ return typeof data === 'object' && data !== null ? data : undefined;
305
+ }
306
+ /**
307
+ * Extract a Liquid file's own structural declarations from an already-parsed source — the
308
+ * per-file primitive, sibling to {@link extractFileReferences}. Reuses the shared `js-yaml`
309
+ * frontmatter parse, platformos-common's slug helpers, and check-common's liquid-doc and
310
+ * translation detection — never a second parser.
311
+ *
312
+ * Usage facts come from one walk of the parsed AST and are always present (sorted,
313
+ * de-duplicated); `doc_params` is in source order. Routing facts come from frontmatter: `slug`
314
+ * is the frontmatter override else the path-derived slug, for page files only, and
315
+ * `layout`/`method` when declared.
316
+ *
317
+ * Returns `undefined` for a non-Liquid source or one that could not be parsed.
318
+ */
319
+ async function extractStructural(sourceCode, uri) {
320
+ // Only a parsed Liquid AST has the structure this analyzes; a `.graphql`/`.yml`
321
+ // buffer (or an unparseable one) yields no structural facts.
322
+ if (sourceCode.type !== platformos_check_common_1.SourceCodeType.LiquidHtml || sourceCode.ast instanceof Error) {
323
+ return undefined;
324
+ }
325
+ const renders = new Set();
326
+ const graphqlQueries = new Set();
327
+ const filters = new Set();
328
+ const tags = new Set();
329
+ const translationKeys = new Set();
330
+ // `{% doc %}` @param names, in source (signature) order — not sorted/de-duped.
331
+ const docParams = [];
332
+ // A single walk of the already-parsed AST collects every usage fact — no
333
+ // second traversal (the doc `@param` names are read from the parser-produced
334
+ // `LiquidDocParamNode`s in this same pass, as `extractDocDefinition` would).
335
+ await (0, platformos_check_common_1.visit)(sourceCode.ast, {
336
+ RenderMarkup: async (node) => {
337
+ if (isStringLiteral(node.partial))
338
+ renders.add(node.partial.value);
339
+ },
340
+ GraphQLMarkup: async (node) => {
341
+ if (isStringLiteral(node.graphql))
342
+ graphqlQueries.add(node.graphql.value);
343
+ },
344
+ LiquidFilter: async (node) => {
345
+ filters.add(node.name);
346
+ },
347
+ LiquidTag: async (node) => {
348
+ if (typeof node.name === 'string')
349
+ tags.add(node.name);
350
+ },
351
+ // A translation-key usage is a string literal piped through `t`/`translate`,
352
+ // e.g. `{{ 'greeting.hello' | t }}` — detected via check-common's shared
353
+ // `isTranslationKeyUsage` so it cannot drift from the translation check.
354
+ LiquidVariable: async (node) => {
355
+ if ((0, platformos_check_common_1.isTranslationKeyUsage)(node))
356
+ translationKeys.add(node.expression.value);
357
+ },
358
+ LiquidDocParamNode: async (node) => {
359
+ docParams.push(node.paramName.value);
360
+ },
361
+ });
362
+ const frontmatter = loadFrontmatterOf(sourceCode);
363
+ const layout = typeof frontmatter?.layout === 'string' ? frontmatter.layout : undefined;
364
+ const method = typeof frontmatter?.method === 'string' ? frontmatter.method : undefined;
365
+ const slug = effectiveSlug(uri, frontmatter);
366
+ const sorted = (set) => [...set].sort((a, b) => a.localeCompare(b));
367
+ return {
368
+ renders_used: sorted(renders),
369
+ graphql_queries_used: sorted(graphqlQueries),
370
+ filters_used: sorted(filters),
371
+ tags_used: sorted(tags),
372
+ translation_keys: sorted(translationKeys),
373
+ doc_params: docParams,
374
+ ...(slug !== undefined ? { slug } : {}),
375
+ ...(layout !== undefined ? { layout } : {}),
376
+ ...(method !== undefined ? { method } : {}),
377
+ };
378
+ }
379
+ /** The parsed frontmatter object of a Liquid file, if it has parseable frontmatter. */
380
+ function loadFrontmatterOf(sourceCode) {
381
+ if (sourceCode.type !== platformos_check_common_1.SourceCodeType.LiquidHtml)
382
+ return undefined;
383
+ const ast = sourceCode.ast;
384
+ if (ast instanceof Error || ast.type !== liquid_html_parser_1.NodeTypes.Document)
385
+ return undefined;
386
+ const node = ast.children.find((child) => child.type === liquid_html_parser_1.NodeTypes.YAMLFrontmatter);
387
+ return node?.type === liquid_html_parser_1.NodeTypes.YAMLFrontmatter ? loadFrontmatter(node.body) : undefined;
388
+ }
389
+ /**
390
+ * The effective URL slug for `uri`, delegating to `effectivePageSlug` — the
391
+ * single slug-derivation shared with `RouteTable`, so the graph's routing fact
392
+ * can never drift from the platform's actual routing (override-wins, coerced to
393
+ * a string; else path-derived using the effective format). Returns `undefined`
394
+ * for a non-page file unless it declares an explicit `slug` override.
395
+ */
396
+ function effectiveSlug(uri, frontmatter) {
397
+ const relativePath = (0, platformos_common_1.extractRelativePagePath)(uri);
398
+ if (relativePath !== null)
399
+ return (0, platformos_common_1.effectivePageSlug)(relativePath, frontmatter);
400
+ // Non-page file: only an explicit `slug` override is meaningful.
401
+ const slug = frontmatter?.slug;
402
+ return slug !== undefined && slug !== null ? String(slug) : undefined;
403
+ }
404
+ /**
405
+ * The names of a call site's named arguments, in source order, or `undefined`
406
+ * when there are none (so an argument-less edge carries no `args` field). Values
407
+ * are intentionally not captured — names are what cross-checking against a
408
+ * partial's `@param` signature needs. Every `LiquidNamedArgument` has a string
409
+ * `name` by construction, so no per-element guard is required.
410
+ */
411
+ function argNames(args) {
412
+ return args.length > 0 ? args.map((arg) => arg.name) : undefined;
413
+ }
414
+ /**
415
+ * The spreadable `args` field for an edge: present only for a non-empty
416
+ * argument-name list, absent otherwise. The single place the "omit when none"
417
+ * rule lives, so {@link bind} and {@link extractFileReferences} cannot diverge.
418
+ */
419
+ function argsField(args) {
420
+ return args && args.length > 0 ? { args } : {};
421
+ }
214
422
  /**
215
423
  * The bind method is the method that links two modules together.
216
424
  *
@@ -220,12 +428,14 @@ function isStringLiteral(node) {
220
428
  */
221
429
  function bind(source, target, { sourceRange, type = 'direct', // the type of dependency, can be 'direct' or 'indirect'
222
430
  kind, // the semantic Liquid construct that created the edge
431
+ args, // names of the named arguments at the call site (omitted when none)
223
432
  } = {}) {
224
433
  const dependency = {
225
434
  source: { uri: source.uri, range: sourceRange },
226
435
  target: { uri: target.uri },
227
436
  type: type,
228
437
  kind: kind,
438
+ ...argsField(args),
229
439
  };
230
440
  source.dependencies.push(dependency);
231
441
  target.references.push(dependency);
@@ -1 +1 @@
1
- {"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/graph/traverse.ts"],"names":[],"mappings":";;AA6BA,wCAuCC;AAqKD,sDAiBC;AAqBD,oBAsBC;AArSD,uEAAsE;AACtE,iFAAgG;AAChG,qEAAiE;AACjE,2CAAiC;AAajC,oCAAiE;AACjE,qCAAwF;AAYjF,KAAK,UAAU,cAAc,CAClC,MAAiB,EACjB,QAAkB,EAClB,IAA2B;IAE3B,8CAA8C;IAC9C,IAAI,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;QACjC,OAAO;IACT,CAAC;IAED,uDAAuD;IACvD,yDAAyD;IACzD,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAEtC,qCAAqC;IACrC,MAAM,CAAC,MAAM,GAAG,MAAM,IAAA,cAAM,EAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAElD,oDAAoD;IACpD,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO;IACT,CAAC;IAED,QAAQ,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,qCAAsB,CAAC,CAAC,CAAC;YACvB,OAAO,oBAAoB,CAAC,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QACtD,CAAC;QAED,mCAAqB,CAAC,CAAC,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EN,MAAM,UAAU,GAAc;QAC5B,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE;QAC/C,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,GAAG,EAAE;QAC3B,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,IAAI;QACV,GAAG,SAAS,CAAC,IAAI,CAAC;KACnB,CAAC;IAEF,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AACrC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export { buildAppGraph } from './graph/build';
2
- export { extractFileReferences } from './graph/traverse';
2
+ export { enumerateEdgeSources, isEdgeSource } from './graph/edge-sources';
3
+ export { extractFileReferences, extractStructural } from './graph/traverse';
4
+ export { dependenciesOf, dependentsOf, exists, isEntryPoint, isOrphan, orphans, reachableFrom, missingDependencies, missingTargets, nearestModules, } from './graph/query';
5
+ export type { NearestModulesOptions } from './graph/query';
3
6
  export { serializeAppGraph } from './graph/serialize';
4
7
  export { parseJs, toSourceCode } from './toSourceCode';
8
+ export { appBackedGetSourceCode, graphParsers } from './parsers';
5
9
  export * from './types';
package/dist/index.js CHANGED
@@ -14,15 +14,33 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.toSourceCode = exports.parseJs = exports.serializeAppGraph = exports.extractFileReferences = exports.buildAppGraph = void 0;
17
+ exports.graphParsers = exports.appBackedGetSourceCode = exports.toSourceCode = exports.parseJs = exports.serializeAppGraph = exports.nearestModules = exports.missingTargets = exports.missingDependencies = exports.reachableFrom = exports.orphans = exports.isOrphan = exports.isEntryPoint = exports.exists = exports.dependentsOf = exports.dependenciesOf = exports.extractStructural = exports.extractFileReferences = exports.isEdgeSource = exports.enumerateEdgeSources = exports.buildAppGraph = void 0;
18
18
  var build_1 = require("./graph/build");
19
19
  Object.defineProperty(exports, "buildAppGraph", { enumerable: true, get: function () { return build_1.buildAppGraph; } });
20
+ var edge_sources_1 = require("./graph/edge-sources");
21
+ Object.defineProperty(exports, "enumerateEdgeSources", { enumerable: true, get: function () { return edge_sources_1.enumerateEdgeSources; } });
22
+ Object.defineProperty(exports, "isEdgeSource", { enumerable: true, get: function () { return edge_sources_1.isEdgeSource; } });
20
23
  var traverse_1 = require("./graph/traverse");
21
24
  Object.defineProperty(exports, "extractFileReferences", { enumerable: true, get: function () { return traverse_1.extractFileReferences; } });
25
+ Object.defineProperty(exports, "extractStructural", { enumerable: true, get: function () { return traverse_1.extractStructural; } });
26
+ var query_1 = require("./graph/query");
27
+ Object.defineProperty(exports, "dependenciesOf", { enumerable: true, get: function () { return query_1.dependenciesOf; } });
28
+ Object.defineProperty(exports, "dependentsOf", { enumerable: true, get: function () { return query_1.dependentsOf; } });
29
+ Object.defineProperty(exports, "exists", { enumerable: true, get: function () { return query_1.exists; } });
30
+ Object.defineProperty(exports, "isEntryPoint", { enumerable: true, get: function () { return query_1.isEntryPoint; } });
31
+ Object.defineProperty(exports, "isOrphan", { enumerable: true, get: function () { return query_1.isOrphan; } });
32
+ Object.defineProperty(exports, "orphans", { enumerable: true, get: function () { return query_1.orphans; } });
33
+ Object.defineProperty(exports, "reachableFrom", { enumerable: true, get: function () { return query_1.reachableFrom; } });
34
+ Object.defineProperty(exports, "missingDependencies", { enumerable: true, get: function () { return query_1.missingDependencies; } });
35
+ Object.defineProperty(exports, "missingTargets", { enumerable: true, get: function () { return query_1.missingTargets; } });
36
+ Object.defineProperty(exports, "nearestModules", { enumerable: true, get: function () { return query_1.nearestModules; } });
22
37
  var serialize_1 = require("./graph/serialize");
23
38
  Object.defineProperty(exports, "serializeAppGraph", { enumerable: true, get: function () { return serialize_1.serializeAppGraph; } });
24
39
  var toSourceCode_1 = require("./toSourceCode");
25
40
  Object.defineProperty(exports, "parseJs", { enumerable: true, get: function () { return toSourceCode_1.parseJs; } });
26
41
  Object.defineProperty(exports, "toSourceCode", { enumerable: true, get: function () { return toSourceCode_1.toSourceCode; } });
42
+ var parsers_1 = require("./parsers");
43
+ Object.defineProperty(exports, "appBackedGetSourceCode", { enumerable: true, get: function () { return parsers_1.appBackedGetSourceCode; } });
44
+ Object.defineProperty(exports, "graphParsers", { enumerable: true, get: function () { return parsers_1.graphParsers; } });
27
45
  __exportStar(require("./types"), exports);
28
46
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAA8C;AAArC,sGAAA,aAAa,OAAA;AACtB,6CAAyD;AAAhD,iHAAA,qBAAqB,OAAA;AAC9B,+CAAsD;AAA7C,8GAAA,iBAAiB,OAAA;AAC1B,+CAAuD;AAA9C,uGAAA,OAAO,OAAA;AAAE,4GAAA,YAAY,OAAA;AAC9B,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,uCAA8C;AAArC,sGAAA,aAAa,OAAA;AACtB,qDAA0E;AAAjE,oHAAA,oBAAoB,OAAA;AAAE,4GAAA,YAAY,OAAA;AAC3C,6CAA4E;AAAnE,iHAAA,qBAAqB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AACjD,uCAWuB;AAVrB,uGAAA,cAAc,OAAA;AACd,qGAAA,YAAY,OAAA;AACZ,+FAAA,MAAM,OAAA;AACN,qGAAA,YAAY,OAAA;AACZ,iGAAA,QAAQ,OAAA;AACR,gGAAA,OAAO,OAAA;AACP,sGAAA,aAAa,OAAA;AACb,4GAAA,mBAAmB,OAAA;AACnB,uGAAA,cAAc,OAAA;AACd,uGAAA,cAAc,OAAA;AAGhB,+CAAsD;AAA7C,8GAAA,iBAAiB,OAAA;AAC1B,+CAAuD;AAA9C,uGAAA,OAAO,OAAA;AAAE,4GAAA,YAAY,OAAA;AAC9B,qCAAiE;AAAxD,iHAAA,sBAAsB,OAAA;AAAE,uGAAA,YAAY,OAAA;AAC7C,0CAAwB"}
@@ -0,0 +1,35 @@
1
+ import { App, Parsers, UriString } from '@platformos/platformos-common';
2
+ import { Program } from 'acorn';
3
+ import { FileSourceCode } from './types';
4
+ /** Parse a JavaScript asset, capturing a syntax error as a value rather than throwing. */
5
+ export declare function parseJs(source: string): Program | Error;
6
+ /**
7
+ * The file types the GRAPH holds and the linter does not: `.js` assets and images.
8
+ *
9
+ * They exist for {@link toSourceCode}'s contract — every URI it is handed comes back as a
10
+ * `FileSourceCode` — and so an `App` an asset URI is put into can answer `ast` at all. NOT
11
+ * because a graph build reads them: `traverseModule` returns immediately for an Asset node, and
12
+ * the only question the graph asks about an asset is whether it EXISTS.
13
+ *
14
+ * Registering them on an {@link App} — rather than building a second set of file objects — is
15
+ * what lets a graph build and a lint run over the same project hold the SAME `AppFile`
16
+ * instances, so each file is read and parsed at most once for both. The language server does
17
+ * that; check-node builds no graph, so merging into `nodeParsers` would do nothing.
18
+ *
19
+ * THE MCP SUPERVISOR DELIBERATELY DOES NOT SHARE, and this is not a pending to-do: it builds no
20
+ * graph, parsing per request only the handful of files that could reference the edited one.
21
+ * Routing those through check-node's shared `App` would win nothing — `lintBuffers` parses the
22
+ * content it was HANDED and drops the app's entry on the way out — and would risk something,
23
+ * because that `App` carries UNSAVED buffers while the blast radius runs CONCURRENTLY with the
24
+ * lint.
25
+ */
26
+ export declare const graphParsers: Parsers;
27
+ /**
28
+ * A `getSourceCode` for the graph backed by an {@link App}.
29
+ *
30
+ * Pass it as `IDependencies.getSourceCode` and the graph stops parsing anything the
31
+ * lint has already parsed, and vice versa — they read the same file objects. Files
32
+ * the app does not contain fall through to `fallback`, which is how a URI outside
33
+ * the project (or an unclassified file) still gets a source code.
34
+ */
35
+ export declare function appBackedGetSourceCode(app: App, fallback: (uri: UriString) => Promise<FileSourceCode>): (uri: UriString) => Promise<FileSourceCode>;