@mmapp/react-compiler 0.1.0-alpha.16 → 0.1.0-alpha.18

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 (186) hide show
  1. package/dist/{chunk-UBDNXVL2.mjs → chunk-6LAII7OP.mjs} +82 -4
  2. package/dist/{chunk-GVCJJX7E.mjs → chunk-FPAMQXKB.mjs} +14 -18
  3. package/dist/{chunk-NUPJYPFU.mjs → chunk-GMW45YVD.mjs} +68 -1
  4. package/dist/cli/index.js +201 -72
  5. package/dist/cli/index.mjs +55 -8
  6. package/dist/dev-server.js +42 -65
  7. package/dist/dev-server.mjs +1 -1
  8. package/dist/index.js +42 -65
  9. package/dist/index.mjs +1 -1
  10. package/dist/{init-2CRSUGV5.mjs → init-CJCDWI33.mjs} +119 -0
  11. package/package.json +2 -2
  12. package/dist/chunk-26U577GB.mjs +0 -3465
  13. package/dist/chunk-2FBDFAX6.mjs +0 -2362
  14. package/dist/chunk-2L4QSMXG.mjs +0 -175
  15. package/dist/chunk-2REDFOER.mjs +0 -931
  16. package/dist/chunk-3USIFFE4.mjs +0 -2190
  17. package/dist/chunk-45YMGEVT.mjs +0 -186
  18. package/dist/chunk-46YKSHQR.mjs +0 -175
  19. package/dist/chunk-4FN2AISW.mjs +0 -148
  20. package/dist/chunk-4OPI5L7G.mjs +0 -2593
  21. package/dist/chunk-4RYTKOOJ.mjs +0 -186
  22. package/dist/chunk-4XHK6FWL.mjs +0 -2058
  23. package/dist/chunk-52XHYD2V.mjs +0 -214
  24. package/dist/chunk-5FTDWKHH.mjs +0 -244
  25. package/dist/chunk-5GUFFFGL.mjs +0 -148
  26. package/dist/chunk-5RKTOVR5.mjs +0 -244
  27. package/dist/chunk-5VNJ7C6N.mjs +0 -154
  28. package/dist/chunk-5YDMOO4X.mjs +0 -214
  29. package/dist/chunk-64ZWEMLJ.mjs +0 -148
  30. package/dist/chunk-6CQOAAMV.mjs +0 -1803
  31. package/dist/chunk-6SEVAAVT.mjs +0 -3516
  32. package/dist/chunk-6XP4KSWQ.mjs +0 -2190
  33. package/dist/chunk-6YLR5ZDA.mjs +0 -2829
  34. package/dist/chunk-72QWL54I.mjs +0 -175
  35. package/dist/chunk-7B4TRI7C.mjs +0 -4835
  36. package/dist/chunk-7JRAEFRB.mjs +0 -7510
  37. package/dist/chunk-7ZKGHTNB.mjs +0 -4952
  38. package/dist/chunk-AOGY2GK6.mjs +0 -3292
  39. package/dist/chunk-AXXUXRNA.mjs +0 -1434
  40. package/dist/chunk-CHLVKMQW.mjs +0 -175
  41. package/dist/chunk-CKGOZAB7.mjs +0 -939
  42. package/dist/chunk-D34RAZUX.mjs +0 -2223
  43. package/dist/chunk-DE3ZGQAC.mjs +0 -148
  44. package/dist/chunk-DMCY3BBG.mjs +0 -1933
  45. package/dist/chunk-DPIK3PJS.mjs +0 -244
  46. package/dist/chunk-E5IVH4RE.mjs +0 -186
  47. package/dist/chunk-E6FZNUR5.mjs +0 -4953
  48. package/dist/chunk-EJRBDQDP.mjs +0 -2607
  49. package/dist/chunk-ELO4TXJL.mjs +0 -186
  50. package/dist/chunk-EO6SYNCG.mjs +0 -175
  51. package/dist/chunk-EQGA6A6D.mjs +0 -121
  52. package/dist/chunk-EY2CSXYA.mjs +0 -822
  53. package/dist/chunk-FIQ65CDR.mjs +0 -925
  54. package/dist/chunk-FKRO52XH.mjs +0 -3446
  55. package/dist/chunk-FL4YAKU6.mjs +0 -4941
  56. package/dist/chunk-FOZXJFAR.mjs +0 -186
  57. package/dist/chunk-FX6URXWN.mjs +0 -186
  58. package/dist/chunk-FYT47UBU.mjs +0 -5076
  59. package/dist/chunk-G7SMOWOL.mjs +0 -828
  60. package/dist/chunk-GCLGPOJZ.mjs +0 -148
  61. package/dist/chunk-GGB4G5YY.mjs +0 -175
  62. package/dist/chunk-GXB4JOP7.mjs +0 -5072
  63. package/dist/chunk-HFXOUMTD.mjs +0 -175
  64. package/dist/chunk-HLRGCCIL.mjs +0 -4839
  65. package/dist/chunk-HOIUP6IF.mjs +0 -690
  66. package/dist/chunk-HRYR54PT.mjs +0 -175
  67. package/dist/chunk-HWIZ47US.mjs +0 -214
  68. package/dist/chunk-I3AU7GRD.mjs +0 -120
  69. package/dist/chunk-IB7MNPQL.mjs +0 -4953
  70. package/dist/chunk-ICSIHQCG.mjs +0 -148
  71. package/dist/chunk-ILFGMUVD.mjs +0 -1933
  72. package/dist/chunk-IPTX5MJU.mjs +0 -3223
  73. package/dist/chunk-ITGUSH2Z.mjs +0 -2783
  74. package/dist/chunk-IXHBCAMF.mjs +0 -3306
  75. package/dist/chunk-J7JUAHS4.mjs +0 -186
  76. package/dist/chunk-J7TWJ3TM.mjs +0 -2784
  77. package/dist/chunk-JDPLDGVF.mjs +0 -4810
  78. package/dist/chunk-JLA5VNQ3.mjs +0 -186
  79. package/dist/chunk-JQLWFCTM.mjs +0 -214
  80. package/dist/chunk-K53XP2DL.mjs +0 -148
  81. package/dist/chunk-K5HX2SVL.mjs +0 -1902
  82. package/dist/chunk-KFGYOOVS.mjs +0 -214
  83. package/dist/chunk-KFJJCQAL.mjs +0 -148
  84. package/dist/chunk-KFVVOS5N.mjs +0 -925
  85. package/dist/chunk-KJUIIEQE.mjs +0 -186
  86. package/dist/chunk-KNWTHRVQ.mjs +0 -175
  87. package/dist/chunk-KSG4XSZF.mjs +0 -175
  88. package/dist/chunk-L2OZ4CDV.mjs +0 -113
  89. package/dist/chunk-LF5N6DOU.mjs +0 -175
  90. package/dist/chunk-LJQCM2IM.mjs +0 -214
  91. package/dist/chunk-MIZV3TAN.mjs +0 -3293
  92. package/dist/chunk-NKKLQE5V.mjs +0 -148
  93. package/dist/chunk-NOW23XFZ.mjs +0 -186
  94. package/dist/chunk-NRXQKQ74.mjs +0 -148
  95. package/dist/chunk-NTB7OEX2.mjs +0 -2918
  96. package/dist/chunk-NW6555WJ.mjs +0 -186
  97. package/dist/chunk-O4AUS7EU.mjs +0 -148
  98. package/dist/chunk-OMZE6VLQ.mjs +0 -214
  99. package/dist/chunk-OPJKP747.mjs +0 -7506
  100. package/dist/chunk-OWI6XWCD.mjs +0 -3375
  101. package/dist/chunk-P4BR7WVO.mjs +0 -2190
  102. package/dist/chunk-PRUMNNDI.mjs +0 -3192
  103. package/dist/chunk-QQHVYH2X.mjs +0 -244
  104. package/dist/chunk-QTBD5B3F.mjs +0 -148
  105. package/dist/chunk-R57T26RR.mjs +0 -734
  106. package/dist/chunk-S5QLWLLT.mjs +0 -186
  107. package/dist/chunk-SCWGT2FY.mjs +0 -2190
  108. package/dist/chunk-SKSDPPNT.mjs +0 -3788
  109. package/dist/chunk-SMKJUSB3.mjs +0 -2190
  110. package/dist/chunk-SP2YUS33.mjs +0 -186
  111. package/dist/chunk-SU4E6E7B.mjs +0 -3153
  112. package/dist/chunk-SYUUKW5A.mjs +0 -3379
  113. package/dist/chunk-THFYE5ZX.mjs +0 -244
  114. package/dist/chunk-UDDTWG5J.mjs +0 -734
  115. package/dist/chunk-UL2XZEMA.mjs +0 -3128
  116. package/dist/chunk-VCAY2KGM.mjs +0 -175
  117. package/dist/chunk-VLTKQDJ3.mjs +0 -244
  118. package/dist/chunk-WBYMW4NQ.mjs +0 -3450
  119. package/dist/chunk-WECAV6QB.mjs +0 -148
  120. package/dist/chunk-WMKBXUCE.mjs +0 -3228
  121. package/dist/chunk-XAJ5BKKL.mjs +0 -4947
  122. package/dist/chunk-XG2X7AEA.mjs +0 -175
  123. package/dist/chunk-XG7Z23NQ.mjs +0 -148
  124. package/dist/chunk-XMWUHQVV.mjs +0 -939
  125. package/dist/chunk-XWZAOCQ7.mjs +0 -2607
  126. package/dist/chunk-XZNEDRGN.mjs +0 -3876
  127. package/dist/chunk-Y6FXYEAI.mjs +0 -10
  128. package/dist/chunk-Y6MA7ULW.mjs +0 -148
  129. package/dist/chunk-YFS6JMYO.mjs +0 -3342
  130. package/dist/chunk-YMS7Q7LG.mjs +0 -214
  131. package/dist/chunk-Z2G5RZ4H.mjs +0 -186
  132. package/dist/chunk-Z6AIQ4KL.mjs +0 -113
  133. package/dist/chunk-ZA37XTGA.mjs +0 -175
  134. package/dist/chunk-ZE3KCHBM.mjs +0 -2918
  135. package/dist/config-PL24KEWL.mjs +0 -219
  136. package/dist/dev-server-Bs_sz2DG.d.mts +0 -111
  137. package/dist/dev-server-Bs_sz2DG.d.ts +0 -111
  138. package/dist/dev-server-CjoufJ-u.d.mts +0 -109
  139. package/dist/dev-server-CjoufJ-u.d.ts +0 -109
  140. package/dist/dev-server-RmGHIntF.d.mts +0 -113
  141. package/dist/dev-server-RmGHIntF.d.ts +0 -113
  142. package/dist/engine-binary-QQUDACBJ.mjs +0 -455
  143. package/dist/envelope-DD7v0v6E.d.mts +0 -265
  144. package/dist/envelope-DD7v0v6E.d.ts +0 -265
  145. package/dist/envelope-vCVjrHlo.d.mts +0 -265
  146. package/dist/envelope-vCVjrHlo.d.ts +0 -265
  147. package/dist/index-B5gSgvnd.d.mts +0 -44
  148. package/dist/index-B5gSgvnd.d.ts +0 -44
  149. package/dist/index-Bs0MnR54.d.mts +0 -103
  150. package/dist/index-Bs0MnR54.d.ts +0 -103
  151. package/dist/index-DR0nNc_f.d.mts +0 -101
  152. package/dist/index-DR0nNc_f.d.ts +0 -101
  153. package/dist/index-revho_gS.d.mts +0 -104
  154. package/dist/index-revho_gS.d.ts +0 -104
  155. package/dist/init-7FJENUDK.mjs +0 -407
  156. package/dist/init-7JQMAAXS.mjs +0 -363
  157. package/dist/init-DQDX3QK6.mjs +0 -369
  158. package/dist/init-EHO4VQ22.mjs +0 -369
  159. package/dist/init-IXEE2RCF.mjs +0 -340
  160. package/dist/init-UC3FWPIW.mjs +0 -367
  161. package/dist/init-UNSMVKIK.mjs +0 -366
  162. package/dist/init-UNV5XIDE.mjs +0 -367
  163. package/dist/project-compiler-2P4N4DR7.mjs +0 -10
  164. package/dist/project-compiler-D2LCC27O.mjs +0 -10
  165. package/dist/project-compiler-EGJUTAJU.mjs +0 -10
  166. package/dist/project-compiler-EJ3GANJE.mjs +0 -10
  167. package/dist/project-compiler-LOQKVRZJ.mjs +0 -10
  168. package/dist/project-compiler-NNK32MPG.mjs +0 -10
  169. package/dist/project-compiler-OP2VVGJQ.mjs +0 -10
  170. package/dist/project-compiler-RQ6OQKRM.mjs +0 -10
  171. package/dist/project-compiler-VFR6CSDX.mjs +0 -10
  172. package/dist/project-compiler-VWNNCHGO.mjs +0 -10
  173. package/dist/project-compiler-XVAAU4C5.mjs +0 -10
  174. package/dist/project-compiler-YES5FGMD.mjs +0 -10
  175. package/dist/project-compiler-ZKMQDLGU.mjs +0 -10
  176. package/dist/project-decompiler-5GY2KSG4.mjs +0 -7
  177. package/dist/project-decompiler-FLXCEJHS.mjs +0 -7
  178. package/dist/project-decompiler-US7GAVIC.mjs +0 -7
  179. package/dist/project-decompiler-VLPR22QF.mjs +0 -7
  180. package/dist/pull-A2QUHW4K.mjs +0 -109
  181. package/dist/pull-FUS5QYZS.mjs +0 -109
  182. package/dist/pull-JBEQWVPE.mjs +0 -109
  183. package/dist/pull-LD5ENLGY.mjs +0 -109
  184. package/dist/pull-P44LDRWB.mjs +0 -109
  185. package/dist/verify-BYHUKARQ.mjs +0 -1833
  186. package/dist/verify-SEIXUGN4.mjs +0 -1833
@@ -347,7 +347,7 @@ async function main() {
347
347
  const open = hasFlag("--open") || devCfg.open === true;
348
348
  const apiPort = getFlag("--api-port") ? parseInt(getFlag("--api-port"), 10) : 4200;
349
349
  let engineProcess = null;
350
- if (isLocal) {
350
+ if (isLocal && hasFlag("--local")) {
351
351
  const { findEngineBinary, installEngine, verifyBinary } = await import("../engine-binary-FKTZAR56.mjs");
352
352
  let resolution = findEngineBinary(getFlag("--binary"));
353
353
  if (resolution.path) {
@@ -372,15 +372,62 @@ async function main() {
372
372
  console.log("[mmrc] Dev server will connect to a remote API or start in-memory mode.");
373
373
  console.log("[mmrc] (For full local mode: `mmrc engine install` or `mmrc engine build`)\n");
374
374
  } else {
375
+ try {
376
+ const { execSync: ex } = __require("child_process");
377
+ const pid = ex(`lsof -ti :${apiPort} 2>/dev/null`, { encoding: "utf-8" }).trim();
378
+ if (pid) {
379
+ console.log(`[mmrc] Killing stale process on port ${apiPort} (PID ${pid})`);
380
+ ex(`kill -9 ${pid}`, { stdio: "ignore" });
381
+ const wait = (ms) => new Promise((r) => setTimeout(r, ms));
382
+ await wait(1e3);
383
+ }
384
+ } catch {
385
+ }
386
+ console.log(`[mmrc] Starting local PostgreSQL via Docker...`);
387
+ try {
388
+ const { execSync: execS } = __require("child_process");
389
+ const running = execS("docker ps -q -f name=mm-dev-pg", { encoding: "utf-8" }).trim();
390
+ if (!running) {
391
+ execS("docker run -d --name mm-dev-pg -p 5433:5432 -e POSTGRES_DB=mm_dev -e POSTGRES_USER=mm -e POSTGRES_PASSWORD=mm -e POSTGRES_HOST_AUTH_METHOD=trust postgres:16-alpine 2>/dev/null || docker start mm-dev-pg 2>/dev/null", { stdio: "pipe" });
392
+ console.log("[mmrc] PostgreSQL starting (port 5433)...");
393
+ for (let i = 0; i < 20; i++) {
394
+ try {
395
+ execS("docker exec mm-dev-pg pg_isready -U mm 2>/dev/null", { stdio: "pipe" });
396
+ break;
397
+ } catch {
398
+ await new Promise((r) => setTimeout(r, 500));
399
+ }
400
+ }
401
+ }
402
+ console.log("[mmrc] PostgreSQL ready");
403
+ } catch (e) {
404
+ console.log("[mmrc] Docker not available \u2014 using SQLite (some features may be limited)");
405
+ }
375
406
  console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
376
407
  const { spawn: spawnProcess } = __require("child_process");
377
- engineProcess = spawnProcess(resolution.path, ["--dev"], {
408
+ let dbUrl;
409
+ try {
410
+ const { execSync: execS2 } = __require("child_process");
411
+ const pgRunning = execS2("docker ps -q -f name=mm-dev-pg", { encoding: "utf-8" }).trim();
412
+ if (pgRunning) {
413
+ dbUrl = "postgres://mm:mm@localhost:5433/mm_dev";
414
+ }
415
+ } catch {
416
+ }
417
+ const engineArgs = dbUrl ? [] : ["--dev"];
418
+ const engineEnv = {
419
+ ...process.env,
420
+ PORT: String(apiPort),
421
+ RUST_LOG: "mm_api=info,mm_storage=info",
422
+ JWT_SECRET: "dev-secret-do-not-use-in-production",
423
+ MM_DEV_MODE: "1"
424
+ };
425
+ if (dbUrl) {
426
+ engineEnv.DATABASE_URL = dbUrl;
427
+ }
428
+ engineProcess = spawnProcess(resolution.path, engineArgs, {
378
429
  stdio: ["ignore", "pipe", "pipe"],
379
- env: {
380
- ...process.env,
381
- PORT: String(apiPort),
382
- RUST_LOG: "mm_api=info,mm_storage=info"
383
- },
430
+ env: engineEnv,
384
431
  cwd: process.cwd()
385
432
  });
386
433
  if (engineProcess.stdout) {
@@ -564,7 +611,7 @@ async function main() {
564
611
  console.error('[mmrc] Error: name is required\n Usage: mmrc init <name> [--description "..."] [--icon "..."] [--author "..."]');
565
612
  process.exit(1);
566
613
  }
567
- const { init } = await import("../init-DY6SJDRX.mjs");
614
+ const { init } = await import("../init-CJCDWI33.mjs");
568
615
  await init({
569
616
  name,
570
617
  description: getFlag("--description"),
@@ -12409,70 +12409,41 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
12409
12409
  <p>Loading...</p>
12410
12410
  </div>
12411
12411
  </div>
12412
- <script type="module">
12413
- import React from 'react';
12414
- import { createRoot } from 'react-dom/client';
12415
-
12416
- function App() {
12417
- const [data, setData] = React.useState({ definitions: [], instances: [] });
12418
- const [error, setError] = React.useState(null);
12419
-
12420
- React.useEffect(() => {
12421
- fetch('/api/v1/workflow/definitions')
12422
- .then(r => r.ok ? r.json() : Promise.reject('API ' + r.status))
12423
- .then(defs => setData(d => ({ ...d, definitions: Array.isArray(defs) ? defs : defs.data || [] })))
12424
- .catch(e => setError(String(e)));
12425
- }, []);
12426
-
12427
- if (error) return React.createElement('div', { style: { padding: 40 } },
12428
- React.createElement('h1', null, 'MindMatrix Dev'),
12429
- React.createElement('p', { style: { color: '#c00', marginTop: 8 } }, 'API Error: ' + error),
12430
- React.createElement('p', { style: { color: '#888', marginTop: 8 } }, 'The engine is running but the API returned an error. This may be an auth issue in SQLite mode.')
12431
- );
12432
-
12433
- return React.createElement('div', { style: { padding: 40, maxWidth: 800 } },
12434
- React.createElement('h1', { style: { marginBottom: 16 } }, 'MindMatrix Dev'),
12435
- React.createElement('p', { style: { color: '#666', marginBottom: 24 } },
12436
- data.definitions.length + ' definition(s) deployed'),
12437
- data.definitions.map((def, i) =>
12438
- React.createElement('div', { key: i, style: { border: '1px solid #ddd', borderRadius: 8, padding: 16, marginBottom: 12, background: '#fff' } },
12439
- React.createElement('h3', { style: { marginBottom: 4 } }, def.name || def.slug || 'Unnamed'),
12440
- React.createElement('p', { style: { color: '#888', fontSize: 13 } },
12441
- 'slug: ' + (def.slug || '?') + ' | states: ' + (def.states?.length || 0) + ' | fields: ' + (def.fields?.length || 0))
12442
- )
12443
- ),
12444
- data.definitions.length === 0 && React.createElement('p', { style: { color: '#888' } },
12445
- 'No definitions deployed yet. Edit your model files and save \u2014 mmrc dev will auto-compile and deploy.')
12446
- );
12412
+ <script>
12413
+ async function render() {
12414
+ const root = document.getElementById('root');
12415
+ try {
12416
+ const res = await fetch('/api/v1/workflow/definitions');
12417
+ const json = await res.json();
12418
+ const items = json.items || json.data || [];
12419
+ let html = '<div style="padding:40px;max-width:960px;margin:0 auto;font-family:-apple-system,BlinkMacSystemFont,sans-serif">';
12420
+ html += '<h1 style="margin-bottom:8px">MindMatrix Dev</h1>';
12421
+ html += '<p style="color:#666;margin-bottom:24px">' + items.length + ' definition(s) deployed</p>';
12422
+ if (items.length === 0) {
12423
+ html += '<div style="text-align:center;padding:60px 20px;color:#888"><p>No definitions yet.</p><p style="margin-top:8px;font-size:13px">Edit your model files and save.</p></div>';
12424
+ }
12425
+ for (const def of items) {
12426
+ html += '<div style="border:1px solid #e0e0e0;border-radius:8px;padding:16px;margin-bottom:12px;background:#fff">';
12427
+ html += '<h3 style="margin-bottom:4px">' + (def.name || def.slug || 'Unnamed') + '</h3>';
12428
+ html += '<p style="color:#888;font-size:13px">slug: ' + (def.slug || '?') + ' | states: ' + (def.states?.length || 0) + ' | fields: ' + (def.fields?.length || 0) + '</p>';
12429
+ html += '</div>';
12430
+ }
12431
+ html += '</div>';
12432
+ root.innerHTML = html;
12433
+ } catch (e) {
12434
+ root.innerHTML = '<div style="padding:40px"><h1>MindMatrix Dev</h1><p style="color:#c00;margin-top:8px">API Error: ' + e.message + '</p></div>';
12435
+ }
12447
12436
  }
12448
-
12449
- createRoot(document.getElementById('root')).render(React.createElement(App));
12437
+ render();
12438
+ setInterval(render, 3000);
12450
12439
  </script>
12451
12440
  </body>
12452
12441
  </html>`;
12453
- const htmlPlugin = {
12454
- name: "mindmatrix-dev-html",
12455
- // Return a function from configureServer → runs as POST-middleware,
12456
- // after Vite's built-in static file serving and SPA fallback.
12457
- configureServer(server) {
12458
- return () => {
12459
- server.middlewares.use(async (req, res, next) => {
12460
- const url = req.url ?? "";
12461
- if (url !== "/" && url !== "/index.html" && !url.startsWith("/?")) return next();
12462
- const accept = req.headers?.accept ?? "";
12463
- if (!accept.includes("text/html")) return next();
12464
- try {
12465
- const transformed = await server.transformIndexHtml(url, devHtml);
12466
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
12467
- res.end(transformed);
12468
- } catch (e) {
12469
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
12470
- res.end(devHtml);
12471
- }
12472
- });
12473
- };
12474
- }
12475
- };
12442
+ const { mkdtempSync, writeFileSync: writeFileSync5 } = await import("fs");
12443
+ const { join: join4 } = await import("path");
12444
+ const { tmpdir } = await import("os");
12445
+ const devRoot = mkdtempSync(join4(tmpdir(), "mm-dev-"));
12446
+ writeFileSync5(join4(devRoot, "index.html"), devHtml, "utf-8");
12476
12447
  let deployInFlight = false;
12477
12448
  const compileDeployPlugin = {
12478
12449
  name: "mindmatrix-dev-compile-deploy",
@@ -12503,14 +12474,16 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
12503
12474
  }
12504
12475
  };
12505
12476
  const viteConfig = {
12506
- root: process.cwd(),
12507
- // 'custom' suppresses "Could not auto-determine entry point" warning
12508
- // since we serve a virtual index.html via the htmlPlugin.
12509
- appType: "custom",
12477
+ // Physical index.html lives in a temp dir so Vite serves it natively.
12478
+ root: devRoot,
12479
+ // Pre-bundle React so Vite doesn't warn about missing entry point.
12480
+ optimizeDeps: { include: ["react", "react-dom/client"] },
12510
12481
  server: {
12511
12482
  port,
12512
12483
  open,
12513
12484
  host: true,
12485
+ // Allow serving files from the real project directory (fs.allow).
12486
+ fs: { allow: [devRoot, process.cwd(), ".."] },
12514
12487
  proxy: {
12515
12488
  "/api": { target: proxyTarget, changeOrigin: true, secure: true, ws: true },
12516
12489
  "/health": { target: proxyTarget, changeOrigin: true, secure: true },
@@ -12518,7 +12491,6 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
12518
12491
  }
12519
12492
  },
12520
12493
  plugins: [
12521
- htmlPlugin,
12522
12494
  mindmatrixReact(pluginOpts),
12523
12495
  compileDeployPlugin,
12524
12496
  devPlayerPlugin,
@@ -12582,6 +12554,11 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
12582
12554
  if (localServer) {
12583
12555
  await localServer.close();
12584
12556
  }
12557
+ try {
12558
+ const { rmSync } = await import("fs");
12559
+ rmSync(devRoot, { recursive: true, force: true });
12560
+ } catch {
12561
+ }
12585
12562
  }
12586
12563
  };
12587
12564
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createDevServer
3
- } from "./chunk-GVCJJX7E.mjs";
3
+ } from "./chunk-GMW45YVD.mjs";
4
4
  import "./chunk-BZEXUPDH.mjs";
5
5
  import "./chunk-DNWDIPH2.mjs";
6
6
  import "./chunk-5M7DKKBC.mjs";
package/dist/index.js CHANGED
@@ -14623,70 +14623,41 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
14623
14623
  <p>Loading...</p>
14624
14624
  </div>
14625
14625
  </div>
14626
- <script type="module">
14627
- import React from 'react';
14628
- import { createRoot } from 'react-dom/client';
14629
-
14630
- function App() {
14631
- const [data, setData] = React.useState({ definitions: [], instances: [] });
14632
- const [error, setError] = React.useState(null);
14633
-
14634
- React.useEffect(() => {
14635
- fetch('/api/v1/workflow/definitions')
14636
- .then(r => r.ok ? r.json() : Promise.reject('API ' + r.status))
14637
- .then(defs => setData(d => ({ ...d, definitions: Array.isArray(defs) ? defs : defs.data || [] })))
14638
- .catch(e => setError(String(e)));
14639
- }, []);
14640
-
14641
- if (error) return React.createElement('div', { style: { padding: 40 } },
14642
- React.createElement('h1', null, 'MindMatrix Dev'),
14643
- React.createElement('p', { style: { color: '#c00', marginTop: 8 } }, 'API Error: ' + error),
14644
- React.createElement('p', { style: { color: '#888', marginTop: 8 } }, 'The engine is running but the API returned an error. This may be an auth issue in SQLite mode.')
14645
- );
14646
-
14647
- return React.createElement('div', { style: { padding: 40, maxWidth: 800 } },
14648
- React.createElement('h1', { style: { marginBottom: 16 } }, 'MindMatrix Dev'),
14649
- React.createElement('p', { style: { color: '#666', marginBottom: 24 } },
14650
- data.definitions.length + ' definition(s) deployed'),
14651
- data.definitions.map((def, i) =>
14652
- React.createElement('div', { key: i, style: { border: '1px solid #ddd', borderRadius: 8, padding: 16, marginBottom: 12, background: '#fff' } },
14653
- React.createElement('h3', { style: { marginBottom: 4 } }, def.name || def.slug || 'Unnamed'),
14654
- React.createElement('p', { style: { color: '#888', fontSize: 13 } },
14655
- 'slug: ' + (def.slug || '?') + ' | states: ' + (def.states?.length || 0) + ' | fields: ' + (def.fields?.length || 0))
14656
- )
14657
- ),
14658
- data.definitions.length === 0 && React.createElement('p', { style: { color: '#888' } },
14659
- 'No definitions deployed yet. Edit your model files and save \u2014 mmrc dev will auto-compile and deploy.')
14660
- );
14626
+ <script>
14627
+ async function render() {
14628
+ const root = document.getElementById('root');
14629
+ try {
14630
+ const res = await fetch('/api/v1/workflow/definitions');
14631
+ const json = await res.json();
14632
+ const items = json.items || json.data || [];
14633
+ let html = '<div style="padding:40px;max-width:960px;margin:0 auto;font-family:-apple-system,BlinkMacSystemFont,sans-serif">';
14634
+ html += '<h1 style="margin-bottom:8px">MindMatrix Dev</h1>';
14635
+ html += '<p style="color:#666;margin-bottom:24px">' + items.length + ' definition(s) deployed</p>';
14636
+ if (items.length === 0) {
14637
+ html += '<div style="text-align:center;padding:60px 20px;color:#888"><p>No definitions yet.</p><p style="margin-top:8px;font-size:13px">Edit your model files and save.</p></div>';
14638
+ }
14639
+ for (const def of items) {
14640
+ html += '<div style="border:1px solid #e0e0e0;border-radius:8px;padding:16px;margin-bottom:12px;background:#fff">';
14641
+ html += '<h3 style="margin-bottom:4px">' + (def.name || def.slug || 'Unnamed') + '</h3>';
14642
+ html += '<p style="color:#888;font-size:13px">slug: ' + (def.slug || '?') + ' | states: ' + (def.states?.length || 0) + ' | fields: ' + (def.fields?.length || 0) + '</p>';
14643
+ html += '</div>';
14644
+ }
14645
+ html += '</div>';
14646
+ root.innerHTML = html;
14647
+ } catch (e) {
14648
+ root.innerHTML = '<div style="padding:40px"><h1>MindMatrix Dev</h1><p style="color:#c00;margin-top:8px">API Error: ' + e.message + '</p></div>';
14649
+ }
14661
14650
  }
14662
-
14663
- createRoot(document.getElementById('root')).render(React.createElement(App));
14651
+ render();
14652
+ setInterval(render, 3000);
14664
14653
  </script>
14665
14654
  </body>
14666
14655
  </html>`;
14667
- const htmlPlugin = {
14668
- name: "mindmatrix-dev-html",
14669
- // Return a function from configureServer → runs as POST-middleware,
14670
- // after Vite's built-in static file serving and SPA fallback.
14671
- configureServer(server) {
14672
- return () => {
14673
- server.middlewares.use(async (req, res, next) => {
14674
- const url = req.url ?? "";
14675
- if (url !== "/" && url !== "/index.html" && !url.startsWith("/?")) return next();
14676
- const accept = req.headers?.accept ?? "";
14677
- if (!accept.includes("text/html")) return next();
14678
- try {
14679
- const transformed = await server.transformIndexHtml(url, devHtml);
14680
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
14681
- res.end(transformed);
14682
- } catch (e) {
14683
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
14684
- res.end(devHtml);
14685
- }
14686
- });
14687
- };
14688
- }
14689
- };
14656
+ const { mkdtempSync, writeFileSync: writeFileSync5 } = await import("fs");
14657
+ const { join: join4 } = await import("path");
14658
+ const { tmpdir } = await import("os");
14659
+ const devRoot = mkdtempSync(join4(tmpdir(), "mm-dev-"));
14660
+ writeFileSync5(join4(devRoot, "index.html"), devHtml, "utf-8");
14690
14661
  let deployInFlight = false;
14691
14662
  const compileDeployPlugin = {
14692
14663
  name: "mindmatrix-dev-compile-deploy",
@@ -14717,14 +14688,16 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
14717
14688
  }
14718
14689
  };
14719
14690
  const viteConfig = {
14720
- root: process.cwd(),
14721
- // 'custom' suppresses "Could not auto-determine entry point" warning
14722
- // since we serve a virtual index.html via the htmlPlugin.
14723
- appType: "custom",
14691
+ // Physical index.html lives in a temp dir so Vite serves it natively.
14692
+ root: devRoot,
14693
+ // Pre-bundle React so Vite doesn't warn about missing entry point.
14694
+ optimizeDeps: { include: ["react", "react-dom/client"] },
14724
14695
  server: {
14725
14696
  port,
14726
14697
  open,
14727
14698
  host: true,
14699
+ // Allow serving files from the real project directory (fs.allow).
14700
+ fs: { allow: [devRoot, process.cwd(), ".."] },
14728
14701
  proxy: {
14729
14702
  "/api": { target: proxyTarget, changeOrigin: true, secure: true, ws: true },
14730
14703
  "/health": { target: proxyTarget, changeOrigin: true, secure: true },
@@ -14732,7 +14705,6 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
14732
14705
  }
14733
14706
  },
14734
14707
  plugins: [
14735
- htmlPlugin,
14736
14708
  mindmatrixReact(pluginOpts),
14737
14709
  compileDeployPlugin,
14738
14710
  devPlayerPlugin,
@@ -14796,6 +14768,11 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
14796
14768
  if (localServer) {
14797
14769
  await localServer.close();
14798
14770
  }
14771
+ try {
14772
+ const { rmSync } = await import("fs");
14773
+ rmSync(devRoot, { recursive: true, force: true });
14774
+ } catch {
14775
+ }
14799
14776
  }
14800
14777
  };
14801
14778
  }
package/dist/index.mjs CHANGED
@@ -21,7 +21,7 @@ import {
21
21
  } from "./chunk-XDVM4YHX.mjs";
22
22
  import {
23
23
  createDevServer
24
- } from "./chunk-GVCJJX7E.mjs";
24
+ } from "./chunk-GMW45YVD.mjs";
25
25
  import "./chunk-BZEXUPDH.mjs";
26
26
  import {
27
27
  buildEnvelope
@@ -70,6 +70,110 @@ export default defineBlueprint({
70
70
  });
71
71
  `;
72
72
  }
73
+ function generateIndexHtml(name) {
74
+ const title = toTitleCase(name);
75
+ return `<!DOCTYPE html>
76
+ <html lang="en">
77
+ <head>
78
+ <meta charset="UTF-8">
79
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
80
+ <title>${title} \u2014 MindMatrix Dev</title>
81
+ <style>
82
+ * { margin: 0; padding: 0; box-sizing: border-box; }
83
+ body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #fafafa; color: #111; }
84
+ #root { min-height: 100vh; padding: 40px; max-width: 960px; margin: 0 auto; }
85
+ h1 { font-size: 24px; margin-bottom: 8px; }
86
+ .subtitle { color: #666; margin-bottom: 24px; }
87
+ .card { border: 1px solid #e0e0e0; border-radius: 8px; padding: 16px; margin-bottom: 12px; background: #fff; }
88
+ .card h3 { font-size: 16px; margin-bottom: 4px; }
89
+ .card .meta { color: #888; font-size: 13px; }
90
+ .badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
91
+ .badge-state { background: #e3f2fd; color: #1565c0; }
92
+ .empty { text-align: center; padding: 60px 20px; color: #888; }
93
+ .error { color: #c62828; background: #ffebee; padding: 16px; border-radius: 8px; margin-bottom: 16px; }
94
+ .actions { display: flex; gap: 8px; margin-top: 8px; }
95
+ .btn { padding: 6px 12px; border-radius: 4px; border: 1px solid #ddd; background: #fff; cursor: pointer; font-size: 13px; }
96
+ .btn:hover { background: #f5f5f5; }
97
+ .btn-primary { background: #1976d2; color: #fff; border-color: #1976d2; }
98
+ .btn-primary:hover { background: #1565c0; }
99
+ </style>
100
+ </head>
101
+ <body>
102
+ <div id="root">
103
+ <h1>${title}</h1>
104
+ <p class="subtitle">Loading...</p>
105
+ </div>
106
+ <script type="module">
107
+ const API = '/api/v1';
108
+
109
+ async function api(path, opts) {
110
+ const res = await fetch(API + path, {
111
+ headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer dev-local' },
112
+ ...opts,
113
+ });
114
+ return res.json();
115
+ }
116
+
117
+ async function render() {
118
+ const root = document.getElementById('root');
119
+ try {
120
+ const defs = await api('/workflow/definitions');
121
+ const items = defs.items || defs.data || [];
122
+
123
+ let html = '<h1>${title}</h1>';
124
+ html += '<p class="subtitle">' + items.length + ' definition(s) deployed</p>';
125
+
126
+ if (items.length === 0) {
127
+ html += '<div class="empty"><p>No definitions deployed yet.</p><p style="margin-top:8px;font-size:13px">Edit your model files and save \u2014 mmrc dev will auto-compile and deploy.</p></div>';
128
+ }
129
+
130
+ for (const def of items) {
131
+ const states = def.states || [];
132
+ const fields = def.fields || [];
133
+ const transitions = def.transitions || [];
134
+ html += '<div class="card">';
135
+ html += '<h3>' + (def.name || def.slug || 'Unnamed') + '</h3>';
136
+ html += '<p class="meta">' + states.length + ' states \xB7 ' + fields.length + ' fields \xB7 ' + transitions.length + ' transitions</p>';
137
+ html += '<div class="actions">';
138
+ html += '<button class="btn btn-primary" onclick="createInstance(\\'' + def.slug + '\\')">+ Create Instance</button>';
139
+ html += '</div>';
140
+ html += '</div>';
141
+ }
142
+
143
+ // Show instances
144
+ const instances = await api('/workflow/instances');
145
+ const instItems = instances.items || instances.data || [];
146
+ if (instItems.length > 0) {
147
+ html += '<h2 style="margin-top:32px;margin-bottom:12px">Instances (' + instItems.length + ')</h2>';
148
+ for (const inst of instItems) {
149
+ html += '<div class="card">';
150
+ html += '<h3>' + (inst.definition_slug || '?') + ' <span class="badge badge-state">' + (inst.current_state || inst.state || '?') + '</span></h3>';
151
+ html += '<p class="meta">ID: ' + inst.id + '</p>';
152
+ html += '</div>';
153
+ }
154
+ }
155
+
156
+ root.innerHTML = html;
157
+ } catch (e) {
158
+ root.innerHTML = '<h1>${title}</h1><div class="error">API Error: ' + e.message + '</div>';
159
+ }
160
+ }
161
+
162
+ window.createInstance = async function(slug) {
163
+ await api('/workflow/instances', {
164
+ method: 'POST',
165
+ body: JSON.stringify({ definition_slug: slug, state_data: { title: 'New Item', priority: 'medium' } }),
166
+ });
167
+ render();
168
+ };
169
+
170
+ render();
171
+ // Auto-refresh every 3 seconds
172
+ setInterval(render, 3000);
173
+ </script>
174
+ </body>
175
+ </html>`;
176
+ }
73
177
  function generateModel(name) {
74
178
  const modelSlug = `${name}-item`;
75
179
  const pascal = toPascalCase(name);
@@ -372,6 +476,20 @@ async function init(options) {
372
476
  console.error(`[mmrc] Error: Directory already exists: ${blueprintDir}`);
373
477
  process.exit(1);
374
478
  }
479
+ try {
480
+ const pkgPath = __require.resolve("@mmapp/react-compiler/package.json");
481
+ const { version } = __require(pkgPath);
482
+ console.log(`[mmrc] v${version}`);
483
+ } catch {
484
+ try {
485
+ const { readFileSync } = __require("fs");
486
+ const { resolve, dirname } = __require("path");
487
+ const pkg = JSON.parse(readFileSync(resolve(__dirname, "../../package.json"), "utf-8"));
488
+ console.log(`[mmrc] v${pkg.version}`);
489
+ } catch {
490
+ console.log(`[mmrc]`);
491
+ }
492
+ }
375
493
  console.log(`[mmrc] Creating blueprint: ${name}
376
494
  `);
377
495
  mkdirSync(join(blueprintDir, "models"), { recursive: true });
@@ -383,6 +501,7 @@ async function init(options) {
383
501
  ["mm.config.ts", generateMmConfig(name, options)],
384
502
  ["mmrc.config.ts", generateMmrcConfig()],
385
503
  [".gitignore", generateGitignore()],
504
+ ["index.html", generateIndexHtml(name)],
386
505
  ["models/item.ts", generateModel(name)],
387
506
  ["app/layout.tsx", generateLayout(name)],
388
507
  ["app/page.tsx", generatePage(name)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mmapp/react-compiler",
3
- "version": "0.1.0-alpha.16",
3
+ "version": "0.1.0-alpha.18",
4
4
  "description": "Babel plugin + Vite integration for compiling React workflows to Pure Form IR",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -66,7 +66,7 @@
66
66
  "@babel/plugin-syntax-typescript": "^7.24.0",
67
67
  "@babel/traverse": "^7.24.0",
68
68
  "@babel/types": "^7.24.0",
69
- "@mmapp/player-core": "^0.1.0-alpha.16",
69
+ "@mmapp/player-core": "^0.1.0-alpha.18",
70
70
  "glob": "^10.3.10"
71
71
  },
72
72
  "peerDependencies": {