@archie/devtools 0.0.13 → 0.0.15

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.
@@ -5783,7 +5783,7 @@ function applyInsertCommand(command, direction, resolveNodeElement) {
5783
5783
  var DEFAULT_LIMIT = 300;
5784
5784
  var DndCommandHistory = class {
5785
5785
  constructor(limit = DEFAULT_LIMIT) {
5786
- this.limit = limit;
5786
+ __publicField(this, "limit", limit);
5787
5787
  __publicField(this, "undoStack", []);
5788
5788
  __publicField(this, "redoStack", []);
5789
5789
  }
@@ -5749,7 +5749,7 @@ function applyInsertCommand(command, direction, resolveNodeElement) {
5749
5749
  var DEFAULT_LIMIT = 300;
5750
5750
  var DndCommandHistory = class {
5751
5751
  constructor(limit = DEFAULT_LIMIT) {
5752
- this.limit = limit;
5752
+ __publicField(this, "limit", limit);
5753
5753
  __publicField(this, "undoStack", []);
5754
5754
  __publicField(this, "redoStack", []);
5755
5755
  }
package/dist/index.d.mts CHANGED
@@ -15,12 +15,12 @@ interface ArchieDevToolsOptions {
15
15
  interface ArchieDevToolsPlugin {
16
16
  name: string;
17
17
  enforce?: 'pre' | 'post';
18
- config?: () => {
19
- resolve: {
20
- dedupe: string[];
21
- };
22
- };
18
+ config?: () => object;
23
19
  configResolved?: (config: ResolvedConfig) => void;
20
+ transform?: (code: string, id: string) => Promise<{
21
+ code: string;
22
+ map?: object | null;
23
+ } | null | undefined>;
24
24
  resolveId?: (id: string) => string | null;
25
25
  load?: (id: string) => string | null;
26
26
  api?: {
package/dist/index.d.ts CHANGED
@@ -15,12 +15,12 @@ interface ArchieDevToolsOptions {
15
15
  interface ArchieDevToolsPlugin {
16
16
  name: string;
17
17
  enforce?: 'pre' | 'post';
18
- config?: () => {
19
- resolve: {
20
- dedupe: string[];
21
- };
22
- };
18
+ config?: () => object;
23
19
  configResolved?: (config: ResolvedConfig) => void;
20
+ transform?: (code: string, id: string) => Promise<{
21
+ code: string;
22
+ map?: object | null;
23
+ } | null | undefined>;
24
24
  resolveId?: (id: string) => string | null;
25
25
  load?: (id: string) => string | null;
26
26
  api?: {
package/dist/index.js CHANGED
@@ -491,7 +491,9 @@ function archieDevTools(options = {}) {
491
491
  const log = (...args) => {
492
492
  if (debug) console.log("[Archie DevTools]", ...args);
493
493
  };
494
+ let babelCore = null;
494
495
  let includeHostSourceRef = false;
496
+ const transformedByHook = /* @__PURE__ */ new Set();
495
497
  const plugin = {
496
498
  name: "vite-plugin-archie-devtools",
497
499
  enforce: "pre",
@@ -499,12 +501,42 @@ function archieDevTools(options = {}) {
499
501
  return {
500
502
  resolve: {
501
503
  dedupe: ["react", "react-dom"]
504
+ },
505
+ optimizeDeps: {
506
+ exclude: ["@archie/devtools/client"]
502
507
  }
503
508
  };
504
509
  },
505
510
  configResolved(config) {
506
511
  includeHostSourceRef = !config.isProduction;
507
512
  },
513
+ async transform(code, id) {
514
+ if (!/\.[jt]sx$/.test(id) || /node_modules/.test(id)) return null;
515
+ try {
516
+ const babel = babelCore ?? (babelCore = await import("@babel/core"));
517
+ const isTS = /\.tsx$/.test(id);
518
+ const result = await babel.transformAsync(code, {
519
+ filename: id,
520
+ plugins: [
521
+ (b) => babelPluginEditorMeta(b, { includeHostSourceRef }),
522
+ ...dndPages.test(id) ? [(b) => babelPluginDndAuto(b, { importSource: INTERNAL_DND_SCOPE_IMPORT_SOURCE })] : []
523
+ ],
524
+ parserOpts: {
525
+ plugins: isTS ? ["jsx", "typescript"] : ["jsx"],
526
+ sourceType: "module"
527
+ },
528
+ sourceMaps: true,
529
+ configFile: false,
530
+ babelrc: false
531
+ });
532
+ if (!result?.code) return null;
533
+ transformedByHook.add(id);
534
+ return { code: result.code, map: result.map };
535
+ } catch (err) {
536
+ log("Babel transform failed for:", id, err);
537
+ return null;
538
+ }
539
+ },
508
540
  resolveId(id) {
509
541
  if (id === INTERNAL_DND_SCOPE_IMPORT_SOURCE) {
510
542
  return RESOLVED_DND_SCOPE_MODULE_ID;
@@ -519,14 +551,14 @@ function archieDevTools(options = {}) {
519
551
  },
520
552
  api: {
521
553
  reactBabel(babelOptions, context) {
522
- if (!/node_modules/.test(context.id)) {
554
+ if (!/node_modules/.test(context.id) && !transformedByHook.has(context.id)) {
523
555
  babelOptions.plugins.push(
524
556
  (babel) => babelPluginEditorMeta(babel, {
525
557
  includeHostSourceRef
526
558
  })
527
559
  );
528
560
  }
529
- if (dndPages.test(context.id)) {
561
+ if (dndPages.test(context.id) && !transformedByHook.has(context.id)) {
530
562
  log("Applying DnD transform to:", context.id);
531
563
  babelOptions.plugins.push(
532
564
  (babel) => babelPluginDndAuto(babel, {
package/dist/index.mjs CHANGED
@@ -457,7 +457,9 @@ function archieDevTools(options = {}) {
457
457
  const log = (...args) => {
458
458
  if (debug) console.log("[Archie DevTools]", ...args);
459
459
  };
460
+ let babelCore = null;
460
461
  let includeHostSourceRef = false;
462
+ const transformedByHook = /* @__PURE__ */ new Set();
461
463
  const plugin = {
462
464
  name: "vite-plugin-archie-devtools",
463
465
  enforce: "pre",
@@ -465,12 +467,42 @@ function archieDevTools(options = {}) {
465
467
  return {
466
468
  resolve: {
467
469
  dedupe: ["react", "react-dom"]
470
+ },
471
+ optimizeDeps: {
472
+ exclude: ["@archie/devtools/client"]
468
473
  }
469
474
  };
470
475
  },
471
476
  configResolved(config) {
472
477
  includeHostSourceRef = !config.isProduction;
473
478
  },
479
+ async transform(code, id) {
480
+ if (!/\.[jt]sx$/.test(id) || /node_modules/.test(id)) return null;
481
+ try {
482
+ const babel = babelCore ?? (babelCore = await import("@babel/core"));
483
+ const isTS = /\.tsx$/.test(id);
484
+ const result = await babel.transformAsync(code, {
485
+ filename: id,
486
+ plugins: [
487
+ (b) => babelPluginEditorMeta(b, { includeHostSourceRef }),
488
+ ...dndPages.test(id) ? [(b) => babelPluginDndAuto(b, { importSource: INTERNAL_DND_SCOPE_IMPORT_SOURCE })] : []
489
+ ],
490
+ parserOpts: {
491
+ plugins: isTS ? ["jsx", "typescript"] : ["jsx"],
492
+ sourceType: "module"
493
+ },
494
+ sourceMaps: true,
495
+ configFile: false,
496
+ babelrc: false
497
+ });
498
+ if (!result?.code) return null;
499
+ transformedByHook.add(id);
500
+ return { code: result.code, map: result.map };
501
+ } catch (err) {
502
+ log("Babel transform failed for:", id, err);
503
+ return null;
504
+ }
505
+ },
474
506
  resolveId(id) {
475
507
  if (id === INTERNAL_DND_SCOPE_IMPORT_SOURCE) {
476
508
  return RESOLVED_DND_SCOPE_MODULE_ID;
@@ -485,14 +517,14 @@ function archieDevTools(options = {}) {
485
517
  },
486
518
  api: {
487
519
  reactBabel(babelOptions, context) {
488
- if (!/node_modules/.test(context.id)) {
520
+ if (!/node_modules/.test(context.id) && !transformedByHook.has(context.id)) {
489
521
  babelOptions.plugins.push(
490
522
  (babel) => babelPluginEditorMeta(babel, {
491
523
  includeHostSourceRef
492
524
  })
493
525
  );
494
526
  }
495
- if (dndPages.test(context.id)) {
527
+ if (dndPages.test(context.id) && !transformedByHook.has(context.id)) {
496
528
  log("Applying DnD transform to:", context.id);
497
529
  babelOptions.plugins.push(
498
530
  (babel) => babelPluginDndAuto(babel, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archie/devtools",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "DevTools for Archie generated applications - Route synchronization and editor communication",
5
5
  "repository": {
6
6
  "type": "git",
@@ -47,29 +47,29 @@
47
47
  "author": "8base",
48
48
  "license": "UNLICENSED",
49
49
  "devDependencies": {
50
- "@babel/core": "^7.29.0",
51
- "@babel/types": "^7.29.0",
52
- "@dnd-kit/core": "^6.3.1",
53
- "@dnd-kit/sortable": "^10.0.0",
54
- "@dnd-kit/utilities": "^3.2.2",
55
- "@remix-run/router": "^1.0.0",
56
- "@types/babel__core": "^7.20.5",
57
- "@types/react": "^19.0.0",
58
- "@types/react-dom": "^19.0.0",
59
- "happy-dom": "^20.5.0",
60
- "lucide-react": "^0.577.0",
61
- "react": "^19.0.0",
62
- "react-dom": "^19.0.0",
63
- "react-router-dom": "^7.0.0",
64
- "tsup": "^8.0.0",
65
- "typescript": "^5.0.0",
66
- "vite": "^5.0.0 || ^6.0.0 || ^7.0.0",
67
- "vitest": "^2.1.9",
68
- "zustand": "^5.0.11"
50
+ "@babel/core": "7.29.0",
51
+ "@babel/types": "7.29.0",
52
+ "@dnd-kit/core": "6.3.1",
53
+ "@dnd-kit/sortable": "10.0.0",
54
+ "@dnd-kit/utilities": "3.2.2",
55
+ "@remix-run/router": "1.23.2",
56
+ "@types/babel__core": "7.20.5",
57
+ "@types/react": "19.2.14",
58
+ "@types/react-dom": "19.2.3",
59
+ "happy-dom": "20.8.9",
60
+ "lucide-react": "0.577.0",
61
+ "react": "19.2.4",
62
+ "react-dom": "19.2.4",
63
+ "react-router-dom": "7.14.0",
64
+ "tsup": "8.5.1",
65
+ "typescript": "5.9.3",
66
+ "vite": "7.3.2",
67
+ "vitest": "4.1.3",
68
+ "zustand": "5.0.12"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "react": ">=18.0.0",
72
72
  "react-dom": ">=18.0.0",
73
73
  "react-router-dom": ">=6.4.0"
74
74
  }
75
- }
75
+ }