@archie/devtools 0.0.37 → 0.0.39

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.
@@ -82,6 +82,26 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
82
82
  const propertyName = name.property.name;
83
83
  return propertyName[0] === propertyName[0].toLowerCase();
84
84
  }
85
+ function isStaticNamespaceDestructure(binding) {
86
+ const bp = binding.path;
87
+ if (!bp.isVariableDeclarator()) return false;
88
+ if (!t.isObjectPattern(bp.node.id)) return false;
89
+ if (!binding.constant) return false;
90
+ const decl = bp.parentPath;
91
+ if (decl?.isVariableDeclaration() && decl.node.kind !== "const") return false;
92
+ let init = bp.node.init;
93
+ while (init && (t.isTSAsExpression(init) || t.isTSNonNullExpression(init) || t.isTypeCastExpression(init))) {
94
+ init = init.expression;
95
+ }
96
+ while (init && t.isMemberExpression(init) && !init.computed) {
97
+ init = init.object;
98
+ }
99
+ if (!init || !t.isIdentifier(init)) return false;
100
+ const rootBinding = bp.scope.getBinding(init.name);
101
+ if (!rootBinding) return true;
102
+ if (!rootBinding.constant) return false;
103
+ return rootBinding.scope === rootBinding.scope.getProgramParent();
104
+ }
85
105
  function computeNodeId(file, line, col, componentName) {
86
106
  return `${file}:${line}:${col}:${componentName}`;
87
107
  }
@@ -509,7 +529,8 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
509
529
  }
510
530
  }
511
531
  const programScope = path2.scope.getProgramParent();
512
- if (binding.scope !== programScope) return;
532
+ if (binding.scope !== programScope && !isStaticNamespaceDestructure(binding))
533
+ return;
513
534
  }
514
535
  }
515
536
  const nodeId = computeNodeId(file, line, col, componentName);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  meaningfulChildren
3
- } from "./chunk-CO6SWEYJ.mjs";
3
+ } from "./chunk-B7TNA5GJ.mjs";
4
4
 
5
5
  // src/babel-plugin-collection-binding.ts
6
6
  import { VISITOR_KEYS } from "@babel/types";
package/dist/index.js CHANGED
@@ -281,6 +281,26 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
281
281
  const propertyName = name.property.name;
282
282
  return propertyName[0] === propertyName[0].toLowerCase();
283
283
  }
284
+ function isStaticNamespaceDestructure(binding) {
285
+ const bp = binding.path;
286
+ if (!bp.isVariableDeclarator()) return false;
287
+ if (!t.isObjectPattern(bp.node.id)) return false;
288
+ if (!binding.constant) return false;
289
+ const decl = bp.parentPath;
290
+ if (decl?.isVariableDeclaration() && decl.node.kind !== "const") return false;
291
+ let init = bp.node.init;
292
+ while (init && (t.isTSAsExpression(init) || t.isTSNonNullExpression(init) || t.isTypeCastExpression(init))) {
293
+ init = init.expression;
294
+ }
295
+ while (init && t.isMemberExpression(init) && !init.computed) {
296
+ init = init.object;
297
+ }
298
+ if (!init || !t.isIdentifier(init)) return false;
299
+ const rootBinding = bp.scope.getBinding(init.name);
300
+ if (!rootBinding) return true;
301
+ if (!rootBinding.constant) return false;
302
+ return rootBinding.scope === rootBinding.scope.getProgramParent();
303
+ }
284
304
  function computeNodeId(file, line, col, componentName) {
285
305
  return `${file}:${line}:${col}:${componentName}`;
286
306
  }
@@ -708,7 +728,8 @@ function babelPluginEditorMeta({ types: t }, opts = {}) {
708
728
  }
709
729
  }
710
730
  const programScope = path.scope.getProgramParent();
711
- if (binding.scope !== programScope) return;
731
+ if (binding.scope !== programScope && !isStaticNamespaceDestructure(binding))
732
+ return;
712
733
  }
713
734
  }
714
735
  const nodeId = computeNodeId(file, line, col, componentName);
@@ -852,7 +873,11 @@ function archieDevTools(options = {}) {
852
873
  transformedByHook.add(id);
853
874
  return { code: result.code, map: result.map };
854
875
  } catch (err) {
855
- log("Babel transform failed for:", id, err);
876
+ console.error(
877
+ "[Archie DevTools] Babel transform FAILED \u2014 __editorMeta will be missing for:",
878
+ id,
879
+ err
880
+ );
856
881
  return null;
857
882
  }
858
883
  },
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  __dirname,
3
3
  babelPluginEditorMeta
4
- } from "./chunk-CO6SWEYJ.mjs";
4
+ } from "./chunk-B7TNA5GJ.mjs";
5
5
 
6
6
  // src/index.ts
7
7
  import { readFileSync } from "fs";
@@ -252,7 +252,11 @@ function archieDevTools(options = {}) {
252
252
  transformedByHook.add(id);
253
253
  return { code: result.code, map: result.map };
254
254
  } catch (err) {
255
- log("Babel transform failed for:", id, err);
255
+ console.error(
256
+ "[Archie DevTools] Babel transform FAILED \u2014 __editorMeta will be missing for:",
257
+ id,
258
+ err
259
+ );
256
260
  return null;
257
261
  }
258
262
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archie/devtools",
3
- "version": "0.0.37",
3
+ "version": "0.0.39",
4
4
  "description": "DevTools for Archie generated applications - Route synchronization and editor communication",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,8 +52,6 @@
52
52
  "author": "8base",
53
53
  "license": "UNLICENSED",
54
54
  "devDependencies": {
55
- "@babel/core": "7.29.0",
56
- "@babel/types": "7.29.0",
57
55
  "@dnd-kit/core": "6.3.1",
58
56
  "@dnd-kit/sortable": "10.0.0",
59
57
  "@dnd-kit/utilities": "3.2.2",
@@ -74,7 +72,10 @@
74
72
  },
75
73
  "peerDependencies": {
76
74
  "react": ">=18.0.0",
77
- "react-dom": ">=18.0.0",
78
- "react-router-dom": ">=6.4.0"
75
+ "react-dom": ">=18.0.0"
76
+ },
77
+ "dependencies": {
78
+ "@babel/core": "7.29.0",
79
+ "@babel/types": "7.29.0"
79
80
  }
80
81
  }