@lowdefy/errors 0.0.0-experimental-20260715115209 → 0.0.0-experimental-20260715122336

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.
@@ -34,15 +34,34 @@
34
34
  * // source: '/Users/dev/myapp/pages/home.yaml:5',
35
35
  * // config: 'root.pages[0:home].blocks[0:header]',
36
36
  * // }
37
- */ function resolveConfigLocation({ configKey, keyMap, refMap, configDirectory }) {
37
+ */ // Not every ref is a file — a module invocation's ref has no path of its own
38
+ // (its content came from the invoking file's vars, and ~l line numbers point
39
+ // into that file). Walk the refMap parent chain to the nearest ref that is a
40
+ // real file; the root ref with no parent is lowdefy.yaml itself.
41
+ function resolveRefPath({ refId, refMap }) {
42
+ let currentId = refId;
43
+ const seen = new Set();
44
+ while(currentId && refMap?.[currentId] && !seen.has(currentId)){
45
+ seen.add(currentId);
46
+ const refEntry = refMap[currentId];
47
+ if (refEntry.path) {
48
+ return refEntry.path;
49
+ }
50
+ currentId = refEntry.parent;
51
+ }
52
+ return 'lowdefy.yaml';
53
+ }
54
+ function resolveConfigLocation({ configKey, keyMap, refMap, configDirectory }) {
38
55
  if (!configKey || !keyMap || !keyMap[configKey]) {
39
56
  return null;
40
57
  }
41
58
  const keyEntry = keyMap[configKey];
42
59
  const refId = keyEntry['~r'];
43
60
  const lineNumber = keyEntry['~l'];
44
- const refEntry = refMap?.[refId];
45
- const filePath = refEntry?.path || 'lowdefy.yaml';
61
+ const filePath = resolveRefPath({
62
+ refId,
63
+ refMap
64
+ });
46
65
  // config: the config path (e.g., "root.pages[0:home].blocks[0:header]")
47
66
  const config = keyEntry.key;
48
67
  // Use absolute path when configDirectory is available for clickable terminal links
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lowdefy/errors",
3
- "version": "0.0.0-experimental-20260715115209",
3
+ "version": "0.0.0-experimental-20260715122336",
4
4
  "license": "Apache-2.0",
5
5
  "description": "Lowdefy error classes for consistent error handling across build, server, and client",
6
6
  "homepage": "https://lowdefy.com",