@platformos/platformos-graph 0.0.19 → 0.0.20

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 (53) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/bin/platformos-graph +21 -81
  3. package/dist/cli.d.ts +46 -0
  4. package/dist/cli.js +126 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/graph/augment.js +0 -1
  7. package/dist/graph/augment.js.map +1 -1
  8. package/dist/graph/module.d.ts +16 -1
  9. package/dist/graph/module.js +39 -0
  10. package/dist/graph/module.js.map +1 -1
  11. package/dist/graph/test-helpers.d.ts +2 -3
  12. package/dist/graph/test-helpers.js +2 -6
  13. package/dist/graph/test-helpers.js.map +1 -1
  14. package/dist/graph/traverse.d.ts +31 -3
  15. package/dist/graph/traverse.js +146 -41
  16. package/dist/graph/traverse.js.map +1 -1
  17. package/dist/index.d.ts +1 -1
  18. package/dist/index.js +3 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/tsconfig.tsbuildinfo +1 -1
  21. package/dist/types.d.ts +14 -19
  22. package/dist/types.js.map +1 -1
  23. package/fixtures/background-edges/app/views/pages/broken.liquid +3 -0
  24. package/fixtures/background-edges/app/views/pages/index.liquid +3 -0
  25. package/fixtures/background-edges/app/views/partials/jobs/notify.liquid +3 -0
  26. package/fixtures/function-edges/app/lib/queries/list.liquid +3 -0
  27. package/fixtures/function-edges/app/views/pages/broken.liquid +3 -0
  28. package/fixtures/function-edges/app/views/pages/index.liquid +3 -0
  29. package/fixtures/graphql-edges/app/graphql/blog_posts/find.graphql +10 -0
  30. package/fixtures/graphql-edges/app/views/pages/broken.liquid +3 -0
  31. package/fixtures/graphql-edges/app/views/pages/index.liquid +3 -0
  32. package/fixtures/include-edges/app/views/pages/index.liquid +1 -0
  33. package/fixtures/include-edges/app/views/partials/shared/header.liquid +1 -0
  34. package/fixtures/module-edges/app/views/pages/index.liquid +4 -0
  35. package/fixtures/module-edges/modules/my_module/public/lib/queries/get.liquid +3 -0
  36. package/fixtures/module-edges/modules/my_module/public/views/partials/card.liquid +1 -0
  37. package/fixtures/skeleton/app/views/partials/child.liquid +2 -4
  38. package/fixtures/skeleton/app/views/partials/parent.liquid +2 -4
  39. package/fixtures/skeleton/assets/app.js +1 -7
  40. package/package.json +5 -5
  41. package/src/cli.spec.ts +265 -0
  42. package/src/cli.ts +151 -0
  43. package/src/graph/augment.ts +0 -2
  44. package/src/graph/build.spec.ts +19 -5
  45. package/src/graph/extract.spec.ts +155 -0
  46. package/src/graph/module.ts +40 -0
  47. package/src/graph/test-helpers.ts +2 -9
  48. package/src/graph/traverse-edges.spec.ts +278 -0
  49. package/src/graph/traverse.ts +177 -49
  50. package/src/index.ts +1 -1
  51. package/src/types.ts +16 -18
  52. package/bin/jsconfig.json +0 -18
  53. package/src/getWebComponentMap.ts +0 -81
@@ -1,9 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.traverseModule = traverseModule;
4
+ exports.extractFileReferences = extractFileReferences;
4
5
  exports.bind = bind;
5
6
  const liquid_html_parser_1 = require("@platformos/liquid-html-parser");
6
7
  const platformos_check_common_1 = require("@platformos/platformos-check-common");
8
+ const platformos_common_1 = require("@platformos/platformos-common");
9
+ const vscode_uri_1 = require("vscode-uri");
7
10
  const utils_1 = require("../utils");
8
11
  const module_1 = require("./module");
9
12
  async function traverseModule(module, appGraph, deps) {
@@ -27,6 +30,9 @@ async function traverseModule(module, appGraph, deps) {
27
30
  case "Asset" /* ModuleType.Asset */: {
28
31
  return; // Nothing to traverse in assets
29
32
  }
33
+ case "GraphQL" /* ModuleType.GraphQL */: {
34
+ return; // Leaf node — GraphQL documents have no platformOS dependencies
35
+ }
30
36
  default: {
31
37
  return (0, utils_1.assertNever)(module);
32
38
  }
@@ -34,8 +40,37 @@ async function traverseModule(module, appGraph, deps) {
34
40
  }
35
41
  async function traverseLiquidModule(module, appGraph, deps) {
36
42
  const sourceCode = await deps.getSourceCode(module.uri);
43
+ const references = await resolveLiquidReferences(appGraph, sourceCode, deps);
44
+ for (const reference of references) {
45
+ bind(module, reference.target, {
46
+ sourceRange: reference.sourceRange,
47
+ kind: reference.kind,
48
+ });
49
+ }
50
+ const modules = (0, utils_1.unique)(references.map((ref) => ref.target));
51
+ const promises = modules.map((mod) => traverseModule(mod, appGraph, deps));
52
+ return Promise.all(promises);
53
+ }
54
+ /**
55
+ * Resolve a single parsed Liquid file's outgoing references — the one place that
56
+ * knows how each Liquid construct (`render`/`include`, `function`, `background`,
57
+ * `graphql`, asset filters) maps to a target module + {@link ReferenceKind}.
58
+ *
59
+ * Both the full-project traversal ({@link traverseLiquidModule}) and the
60
+ * standalone per-file primitive ({@link extractFileReferences}) go through this,
61
+ * so resolution can never drift between "graph build" and "validate one buffer".
62
+ *
63
+ * Targets are produced via the module factories (which normalize URIs), so keys
64
+ * match the rest of the graph on every platform. Unparseable input yields no
65
+ * references rather than throwing.
66
+ */
67
+ async function resolveLiquidReferences(appGraph, sourceCode, deps) {
37
68
  if (sourceCode.ast instanceof Error)
38
- return; // can't visit what you can't parse
69
+ 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);
73
+ const rootUri = vscode_uri_1.URI.parse(appGraph.rootUri);
39
74
  const visitor = {
40
75
  // {{ 'app.js' | asset_url }}
41
76
  // {{ 'image.png' | asset_img_url }}
@@ -56,57 +91,125 @@ async function traverseLiquidModule(module, appGraph, deps) {
56
91
  return {
57
92
  target: assetModule,
58
93
  sourceRange: [parentNode.position.start, parentNode.position.end],
94
+ kind: 'asset',
59
95
  };
60
96
  }
61
97
  },
62
- // <custom-element></custom-element>
63
- HtmlElement: async (node) => {
64
- if (node.name.length !== 1)
65
- return;
66
- if (node.name[0].type !== liquid_html_parser_1.NodeTypes.TextNode)
98
+ // {% render 'partial' %} / {% include 'partial' %}
99
+ // Both resolve through DocumentsLocator (like function/graphql), so module
100
+ // prefixes (`modules/<m>/...`), the lib search path, and `.liquid` /
101
+ // `.html.liquid` extensions are handled uniformly — not hard-coded to
102
+ // `app/views/partials`.
103
+ RenderMarkup: async (node, ancestors) => {
104
+ const partial = node.partial;
105
+ const tag = ancestors.at(-1);
106
+ if (!isStringLiteral(partial))
107
+ return; // dynamic target — skip
108
+ const isInclude = tag.type === liquid_html_parser_1.NodeTypes.LiquidTag && tag.name === liquid_html_parser_1.NamedTags.include;
109
+ const uri = await documentsLocator.locateOrDefault(rootUri, isInclude ? 'include' : 'render', partial.value);
110
+ if (!uri)
67
111
  return;
68
- const nodeNameNode = node.name[0];
69
- const nodeName = nodeNameNode.value;
70
- if (!nodeName.includes('-'))
71
- return; // skip non-custom-elements
72
- const result = deps.getWebComponentDefinitionReference(nodeName);
73
- if (!result)
112
+ return {
113
+ target: (0, module_1.getPartialModuleByUri)(appGraph, uri),
114
+ sourceRange: [tag.position.start, tag.position.end],
115
+ kind: isInclude ? 'include' : 'render',
116
+ };
117
+ },
118
+ // {% function result = 'queries/...' %} / {% function res = 'commands/...' %}
119
+ FunctionMarkup: async (node, ancestors) => {
120
+ const target = node.partial;
121
+ const tag = ancestors.at(-1);
122
+ if (!isStringLiteral(target))
123
+ return; // dynamic target — skip
124
+ const uri = await documentsLocator.locateOrDefault(rootUri, 'function', target.value);
125
+ if (!uri)
74
126
  return;
75
- const { assetName, range } = result;
76
- const assetModule = (0, module_1.getAssetModule)(appGraph, assetName);
77
- if (!assetModule)
127
+ return {
128
+ target: (0, module_1.getPartialModuleByUri)(appGraph, uri),
129
+ sourceRange: [tag.position.start, tag.position.end],
130
+ kind: 'function',
131
+ };
132
+ },
133
+ // {% background job_id = 'partial', ... %} (file-based form)
134
+ // Runs a partial asynchronously; `node.partial` is the partial reference,
135
+ // resolved against the same search paths as {% function %}. The inline form
136
+ // ({% background %}...{% endbackground %}) parses to BackgroundInlineMarkup,
137
+ // has no file target, and is intentionally not matched here.
138
+ BackgroundMarkup: async (node, ancestors) => {
139
+ const target = node.partial;
140
+ const tag = ancestors.at(-1);
141
+ if (!isStringLiteral(target))
142
+ return; // dynamic target — skip
143
+ const uri = await documentsLocator.locateOrDefault(rootUri, 'function', target.value);
144
+ if (!uri)
78
145
  return;
79
146
  return {
80
- target: assetModule,
81
- sourceRange: [node.blockStartPosition.start, nodeNameNode.position.end],
82
- targetRange: range,
147
+ target: (0, module_1.getPartialModuleByUri)(appGraph, uri),
148
+ sourceRange: [tag.position.start, tag.position.end],
149
+ kind: 'background',
83
150
  };
84
151
  },
85
- // {% render 'partial' %}
86
- RenderMarkup: async (node, ancestors) => {
87
- const partial = node.partial;
152
+ // {% graphql result = 'path/to/operation' %}
153
+ // `node.name` is the RESULT variable; the operation-file path is `node.graphql`.
154
+ GraphQLMarkup: async (node, ancestors) => {
155
+ const op = node.graphql;
88
156
  const tag = ancestors.at(-1);
89
- if (!(0, utils_1.isString)(partial) && partial.type === liquid_html_parser_1.NodeTypes.String) {
90
- return {
91
- target: (0, module_1.getPartialModule)(appGraph, partial.value),
92
- sourceRange: [tag.position.start, tag.position.end],
93
- };
94
- }
157
+ if (!isStringLiteral(op))
158
+ return; // dynamic/inline — no static file
159
+ const uri = await documentsLocator.locateOrDefault(rootUri, 'graphql', op.value);
160
+ if (!uri)
161
+ return;
162
+ return {
163
+ target: (0, module_1.getGraphQLModuleByUri)(appGraph, uri),
164
+ sourceRange: [tag.position.start, tag.position.end],
165
+ kind: 'graphql',
166
+ };
95
167
  },
96
168
  };
97
- const references = await (0, platformos_check_common_1.visit)(sourceCode.ast, visitor);
98
- for (const reference of references) {
99
- bind(module, reference.target, {
100
- sourceRange: reference.sourceRange,
101
- targetRange: reference.targetRange,
102
- });
103
- }
104
- const modules = unique(references.map((ref) => ref.target));
105
- const promises = modules.map((mod) => traverseModule(mod, appGraph, deps));
106
- return Promise.all(promises);
169
+ return (0, platformos_check_common_1.visit)(sourceCode.ast, visitor);
107
170
  }
108
- function unique(arr) {
109
- return [...new Set(arr)];
171
+ /**
172
+ * Extract one Liquid file's outgoing dependency references, resolved against the
173
+ * project at `rootUri`, WITHOUT building the whole app graph.
174
+ *
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.
182
+ *
183
+ * 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.
188
+ * - Only statically resolvable references are returned; dynamic targets
189
+ * (`{% 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.
192
+ */
193
+ async function extractFileReferences(rootUri, sourceUri, sourceCode, deps) {
194
+ // A throwaway graph so the URI-normalizing module factories can be reused; it
195
+ // is never traversed and is discarded with this call.
196
+ const scratchGraph = { rootUri, entryPoints: [], modules: {} };
197
+ const references = await resolveLiquidReferences(scratchGraph, sourceCode, deps);
198
+ return references.map((reference) => ({
199
+ source: { uri: sourceUri, range: reference.sourceRange },
200
+ target: { uri: reference.target.uri },
201
+ type: 'direct',
202
+ kind: reference.kind,
203
+ }));
204
+ }
205
+ /**
206
+ * A render/function/graphql target that is a static string literal (e.g.
207
+ * `{% render 'partial' %}`), narrowed to its `NodeTypes.String` member so the
208
+ * `.value` is accessible. Dynamic targets (`{% render var %}`) return false and
209
+ * are skipped — the graph only records statically resolvable edges.
210
+ */
211
+ function isStringLiteral(node) {
212
+ return !(0, utils_1.isString)(node) && node.type === liquid_html_parser_1.NodeTypes.String;
110
213
  }
111
214
  /**
112
215
  * The bind method is the method that links two modules together.
@@ -115,12 +218,14 @@ function unique(arr) {
115
218
  *
116
219
  * This function mutates the source and target modules.
117
220
  */
118
- function bind(source, target, { sourceRange, targetRange, type = 'direct', // the type of dependency, can be 'direct' or 'indirect'
221
+ function bind(source, target, { sourceRange, type = 'direct', // the type of dependency, can be 'direct' or 'indirect'
222
+ kind, // the semantic Liquid construct that created the edge
119
223
  } = {}) {
120
224
  const dependency = {
121
225
  source: { uri: source.uri, range: sourceRange },
122
- target: { uri: target.uri, range: targetRange },
226
+ target: { uri: target.uri },
123
227
  type: type,
228
+ kind: kind,
124
229
  };
125
230
  source.dependencies.push(dependency);
126
231
  target.references.push(dependency);
@@ -1 +1 @@
1
- {"version":3,"file":"traverse.js","sourceRoot":"","sources":["../../src/graph/traverse.ts"],"names":[],"mappings":";;AAeA,wCAmCC;AA8FD,oBAqBC;AArKD,uEAA2D;AAC3D,iFAAqF;AAWrF,oCAAyD;AACzD,qCAA6E;AAEtE,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,oBA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;GAMG;AACH,SAAgB,IAAI,CAClB,MAAiB,EACjB,MAAiB,EACjB,EACE,WAAW,EACX,IAAI,GAAG,QAAQ,EAAE,wDAAwD;AACzE,IAAI,EAAE,sDAAsD;KAK1D,EAAE;IAEN,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;KACX,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,5 @@
1
1
  export { buildAppGraph } from './graph/build';
2
+ export { extractFileReferences } from './graph/traverse';
2
3
  export { serializeAppGraph } from './graph/serialize';
3
- export { getWebComponentMap, findWebComponentReferences } from './getWebComponentMap';
4
4
  export { parseJs, toSourceCode } from './toSourceCode';
5
5
  export * from './types';
package/dist/index.js CHANGED
@@ -14,14 +14,13 @@ 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.findWebComponentReferences = exports.getWebComponentMap = exports.serializeAppGraph = exports.buildAppGraph = void 0;
17
+ exports.toSourceCode = exports.parseJs = exports.serializeAppGraph = exports.extractFileReferences = 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 traverse_1 = require("./graph/traverse");
21
+ Object.defineProperty(exports, "extractFileReferences", { enumerable: true, get: function () { return traverse_1.extractFileReferences; } });
20
22
  var serialize_1 = require("./graph/serialize");
21
23
  Object.defineProperty(exports, "serializeAppGraph", { enumerable: true, get: function () { return serialize_1.serializeAppGraph; } });
22
- var getWebComponentMap_1 = require("./getWebComponentMap");
23
- Object.defineProperty(exports, "getWebComponentMap", { enumerable: true, get: function () { return getWebComponentMap_1.getWebComponentMap; } });
24
- Object.defineProperty(exports, "findWebComponentReferences", { enumerable: true, get: function () { return getWebComponentMap_1.findWebComponentReferences; } });
25
24
  var toSourceCode_1 = require("./toSourceCode");
26
25
  Object.defineProperty(exports, "parseJs", { enumerable: true, get: function () { return toSourceCode_1.parseJs; } });
27
26
  Object.defineProperty(exports, "toSourceCode", { enumerable: true, get: function () { return toSourceCode_1.toSourceCode; } });
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,+CAAsD;AAA7C,8GAAA,iBAAiB,OAAA;AAC1B,2DAAsF;AAA7E,wHAAA,kBAAkB,OAAA;AAAE,gIAAA,0BAA0B,OAAA;AACvD,+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,6CAAyD;AAAhD,iHAAA,qBAAqB,OAAA;AAC9B,+CAAsD;AAA7C,8GAAA,iBAAiB,OAAA;AAC1B,+CAAuD;AAA9C,uGAAA,OAAO,OAAA;AAAE,4GAAA,YAAY,OAAA;AAC9B,0CAAwB"}