@mmapp/react-compiler 0.1.0-alpha.15 → 0.1.0-alpha.17
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.
- package/dist/{chunk-NUPJYPFU.mjs → chunk-6LAII7OP.mjs} +79 -1
- package/dist/{chunk-UBDNXVL2.mjs → chunk-FPAMQXKB.mjs} +89 -3
- package/dist/cli/index.js +240 -9
- package/dist/cli/index.mjs +57 -9
- package/dist/dev-server.js +79 -1
- package/dist/dev-server.mjs +1 -1
- package/dist/index.js +79 -1
- package/dist/index.mjs +1 -1
- package/dist/{init-2CRSUGV5.mjs → init-CJCDWI33.mjs} +119 -0
- package/package.json +2 -2
- package/dist/chunk-26U577GB.mjs +0 -3465
- package/dist/chunk-2FBDFAX6.mjs +0 -2362
- package/dist/chunk-2L4QSMXG.mjs +0 -175
- package/dist/chunk-2REDFOER.mjs +0 -931
- package/dist/chunk-3USIFFE4.mjs +0 -2190
- package/dist/chunk-45YMGEVT.mjs +0 -186
- package/dist/chunk-46YKSHQR.mjs +0 -175
- package/dist/chunk-4FN2AISW.mjs +0 -148
- package/dist/chunk-4OPI5L7G.mjs +0 -2593
- package/dist/chunk-4RYTKOOJ.mjs +0 -186
- package/dist/chunk-4XHK6FWL.mjs +0 -2058
- package/dist/chunk-52XHYD2V.mjs +0 -214
- package/dist/chunk-5FTDWKHH.mjs +0 -244
- package/dist/chunk-5GUFFFGL.mjs +0 -148
- package/dist/chunk-5RKTOVR5.mjs +0 -244
- package/dist/chunk-5VNJ7C6N.mjs +0 -154
- package/dist/chunk-5YDMOO4X.mjs +0 -214
- package/dist/chunk-64ZWEMLJ.mjs +0 -148
- package/dist/chunk-6CQOAAMV.mjs +0 -1803
- package/dist/chunk-6SEVAAVT.mjs +0 -3516
- package/dist/chunk-6XP4KSWQ.mjs +0 -2190
- package/dist/chunk-6YLR5ZDA.mjs +0 -2829
- package/dist/chunk-72QWL54I.mjs +0 -175
- package/dist/chunk-7B4TRI7C.mjs +0 -4835
- package/dist/chunk-7JRAEFRB.mjs +0 -7510
- package/dist/chunk-7ZKGHTNB.mjs +0 -4952
- package/dist/chunk-AOGY2GK6.mjs +0 -3292
- package/dist/chunk-AXXUXRNA.mjs +0 -1434
- package/dist/chunk-CHLVKMQW.mjs +0 -175
- package/dist/chunk-CKGOZAB7.mjs +0 -939
- package/dist/chunk-D34RAZUX.mjs +0 -2223
- package/dist/chunk-DE3ZGQAC.mjs +0 -148
- package/dist/chunk-DMCY3BBG.mjs +0 -1933
- package/dist/chunk-DPIK3PJS.mjs +0 -244
- package/dist/chunk-E5IVH4RE.mjs +0 -186
- package/dist/chunk-E6FZNUR5.mjs +0 -4953
- package/dist/chunk-EJRBDQDP.mjs +0 -2607
- package/dist/chunk-ELO4TXJL.mjs +0 -186
- package/dist/chunk-EO6SYNCG.mjs +0 -175
- package/dist/chunk-EQGA6A6D.mjs +0 -121
- package/dist/chunk-EY2CSXYA.mjs +0 -822
- package/dist/chunk-FIQ65CDR.mjs +0 -925
- package/dist/chunk-FKRO52XH.mjs +0 -3446
- package/dist/chunk-FL4YAKU6.mjs +0 -4941
- package/dist/chunk-FOZXJFAR.mjs +0 -186
- package/dist/chunk-FX6URXWN.mjs +0 -186
- package/dist/chunk-FYT47UBU.mjs +0 -5076
- package/dist/chunk-G7SMOWOL.mjs +0 -828
- package/dist/chunk-GCLGPOJZ.mjs +0 -148
- package/dist/chunk-GGB4G5YY.mjs +0 -175
- package/dist/chunk-GXB4JOP7.mjs +0 -5072
- package/dist/chunk-HFXOUMTD.mjs +0 -175
- package/dist/chunk-HLRGCCIL.mjs +0 -4839
- package/dist/chunk-HOIUP6IF.mjs +0 -690
- package/dist/chunk-HRYR54PT.mjs +0 -175
- package/dist/chunk-HWIZ47US.mjs +0 -214
- package/dist/chunk-I3AU7GRD.mjs +0 -120
- package/dist/chunk-IB7MNPQL.mjs +0 -4953
- package/dist/chunk-ICSIHQCG.mjs +0 -148
- package/dist/chunk-ILFGMUVD.mjs +0 -1933
- package/dist/chunk-IPTX5MJU.mjs +0 -3223
- package/dist/chunk-ITGUSH2Z.mjs +0 -2783
- package/dist/chunk-IXHBCAMF.mjs +0 -3306
- package/dist/chunk-J7JUAHS4.mjs +0 -186
- package/dist/chunk-J7TWJ3TM.mjs +0 -2784
- package/dist/chunk-JDPLDGVF.mjs +0 -4810
- package/dist/chunk-JLA5VNQ3.mjs +0 -186
- package/dist/chunk-JQLWFCTM.mjs +0 -214
- package/dist/chunk-K53XP2DL.mjs +0 -148
- package/dist/chunk-K5HX2SVL.mjs +0 -1902
- package/dist/chunk-KFGYOOVS.mjs +0 -214
- package/dist/chunk-KFJJCQAL.mjs +0 -148
- package/dist/chunk-KFVVOS5N.mjs +0 -925
- package/dist/chunk-KJUIIEQE.mjs +0 -186
- package/dist/chunk-KNWTHRVQ.mjs +0 -175
- package/dist/chunk-KSG4XSZF.mjs +0 -175
- package/dist/chunk-L2OZ4CDV.mjs +0 -113
- package/dist/chunk-LF5N6DOU.mjs +0 -175
- package/dist/chunk-LJQCM2IM.mjs +0 -214
- package/dist/chunk-MIZV3TAN.mjs +0 -3293
- package/dist/chunk-NKKLQE5V.mjs +0 -148
- package/dist/chunk-NOW23XFZ.mjs +0 -186
- package/dist/chunk-NRXQKQ74.mjs +0 -148
- package/dist/chunk-NTB7OEX2.mjs +0 -2918
- package/dist/chunk-NW6555WJ.mjs +0 -186
- package/dist/chunk-O4AUS7EU.mjs +0 -148
- package/dist/chunk-OMZE6VLQ.mjs +0 -214
- package/dist/chunk-OPJKP747.mjs +0 -7506
- package/dist/chunk-OWI6XWCD.mjs +0 -3375
- package/dist/chunk-P4BR7WVO.mjs +0 -2190
- package/dist/chunk-PRUMNNDI.mjs +0 -3192
- package/dist/chunk-QQHVYH2X.mjs +0 -244
- package/dist/chunk-QTBD5B3F.mjs +0 -148
- package/dist/chunk-R57T26RR.mjs +0 -734
- package/dist/chunk-S5QLWLLT.mjs +0 -186
- package/dist/chunk-SCWGT2FY.mjs +0 -2190
- package/dist/chunk-SKSDPPNT.mjs +0 -3788
- package/dist/chunk-SMKJUSB3.mjs +0 -2190
- package/dist/chunk-SP2YUS33.mjs +0 -186
- package/dist/chunk-SU4E6E7B.mjs +0 -3153
- package/dist/chunk-SYUUKW5A.mjs +0 -3379
- package/dist/chunk-THFYE5ZX.mjs +0 -244
- package/dist/chunk-UDDTWG5J.mjs +0 -734
- package/dist/chunk-UL2XZEMA.mjs +0 -3128
- package/dist/chunk-VCAY2KGM.mjs +0 -175
- package/dist/chunk-VLTKQDJ3.mjs +0 -244
- package/dist/chunk-WBYMW4NQ.mjs +0 -3450
- package/dist/chunk-WECAV6QB.mjs +0 -148
- package/dist/chunk-WMKBXUCE.mjs +0 -3228
- package/dist/chunk-XAJ5BKKL.mjs +0 -4947
- package/dist/chunk-XG2X7AEA.mjs +0 -175
- package/dist/chunk-XG7Z23NQ.mjs +0 -148
- package/dist/chunk-XMWUHQVV.mjs +0 -939
- package/dist/chunk-XWZAOCQ7.mjs +0 -2607
- package/dist/chunk-XZNEDRGN.mjs +0 -3876
- package/dist/chunk-Y6FXYEAI.mjs +0 -10
- package/dist/chunk-Y6MA7ULW.mjs +0 -148
- package/dist/chunk-YFS6JMYO.mjs +0 -3342
- package/dist/chunk-YMS7Q7LG.mjs +0 -214
- package/dist/chunk-Z2G5RZ4H.mjs +0 -186
- package/dist/chunk-Z6AIQ4KL.mjs +0 -113
- package/dist/chunk-ZA37XTGA.mjs +0 -175
- package/dist/chunk-ZE3KCHBM.mjs +0 -2918
- package/dist/config-PL24KEWL.mjs +0 -219
- package/dist/dev-server-Bs_sz2DG.d.mts +0 -111
- package/dist/dev-server-Bs_sz2DG.d.ts +0 -111
- package/dist/dev-server-CjoufJ-u.d.mts +0 -109
- package/dist/dev-server-CjoufJ-u.d.ts +0 -109
- package/dist/dev-server-RmGHIntF.d.mts +0 -113
- package/dist/dev-server-RmGHIntF.d.ts +0 -113
- package/dist/engine-binary-QQUDACBJ.mjs +0 -455
- package/dist/envelope-DD7v0v6E.d.mts +0 -265
- package/dist/envelope-DD7v0v6E.d.ts +0 -265
- package/dist/envelope-vCVjrHlo.d.mts +0 -265
- package/dist/envelope-vCVjrHlo.d.ts +0 -265
- package/dist/index-B5gSgvnd.d.mts +0 -44
- package/dist/index-B5gSgvnd.d.ts +0 -44
- package/dist/index-Bs0MnR54.d.mts +0 -103
- package/dist/index-Bs0MnR54.d.ts +0 -103
- package/dist/index-DR0nNc_f.d.mts +0 -101
- package/dist/index-DR0nNc_f.d.ts +0 -101
- package/dist/index-revho_gS.d.mts +0 -104
- package/dist/index-revho_gS.d.ts +0 -104
- package/dist/init-7FJENUDK.mjs +0 -407
- package/dist/init-7JQMAAXS.mjs +0 -363
- package/dist/init-DQDX3QK6.mjs +0 -369
- package/dist/init-EHO4VQ22.mjs +0 -369
- package/dist/init-IXEE2RCF.mjs +0 -340
- package/dist/init-UC3FWPIW.mjs +0 -367
- package/dist/init-UNSMVKIK.mjs +0 -366
- package/dist/init-UNV5XIDE.mjs +0 -367
- package/dist/project-compiler-2P4N4DR7.mjs +0 -10
- package/dist/project-compiler-D2LCC27O.mjs +0 -10
- package/dist/project-compiler-EGJUTAJU.mjs +0 -10
- package/dist/project-compiler-EJ3GANJE.mjs +0 -10
- package/dist/project-compiler-LOQKVRZJ.mjs +0 -10
- package/dist/project-compiler-NNK32MPG.mjs +0 -10
- package/dist/project-compiler-OP2VVGJQ.mjs +0 -10
- package/dist/project-compiler-RQ6OQKRM.mjs +0 -10
- package/dist/project-compiler-VFR6CSDX.mjs +0 -10
- package/dist/project-compiler-VWNNCHGO.mjs +0 -10
- package/dist/project-compiler-XVAAU4C5.mjs +0 -10
- package/dist/project-compiler-YES5FGMD.mjs +0 -10
- package/dist/project-compiler-ZKMQDLGU.mjs +0 -10
- package/dist/project-decompiler-5GY2KSG4.mjs +0 -7
- package/dist/project-decompiler-FLXCEJHS.mjs +0 -7
- package/dist/project-decompiler-US7GAVIC.mjs +0 -7
- package/dist/project-decompiler-VLPR22QF.mjs +0 -7
- package/dist/pull-A2QUHW4K.mjs +0 -109
- package/dist/pull-FUS5QYZS.mjs +0 -109
- package/dist/pull-JBEQWVPE.mjs +0 -109
- package/dist/pull-LD5ENLGY.mjs +0 -109
- package/dist/pull-P44LDRWB.mjs +0 -109
- package/dist/verify-BYHUKARQ.mjs +0 -1833
- package/dist/verify-SEIXUGN4.mjs +0 -1833
package/dist/dev-server.js
CHANGED
|
@@ -12387,6 +12387,74 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
|
12387
12387
|
`;
|
|
12388
12388
|
}
|
|
12389
12389
|
};
|
|
12390
|
+
const devHtml = `<!DOCTYPE html>
|
|
12391
|
+
<html lang="en">
|
|
12392
|
+
<head>
|
|
12393
|
+
<meta charset="UTF-8">
|
|
12394
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
12395
|
+
<title>MindMatrix Dev</title>
|
|
12396
|
+
<style>
|
|
12397
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
12398
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #fafafa; color: #111; }
|
|
12399
|
+
#root { min-height: 100vh; }
|
|
12400
|
+
.mm-loading { display: flex; align-items: center; justify-content: center; min-height: 100vh; flex-direction: column; gap: 12px; }
|
|
12401
|
+
.mm-loading h1 { font-size: 20px; font-weight: 600; color: #333; }
|
|
12402
|
+
.mm-loading p { color: #888; font-size: 14px; }
|
|
12403
|
+
</style>
|
|
12404
|
+
</head>
|
|
12405
|
+
<body>
|
|
12406
|
+
<div id="root">
|
|
12407
|
+
<div class="mm-loading">
|
|
12408
|
+
<h1>MindMatrix Dev</h1>
|
|
12409
|
+
<p>Loading...</p>
|
|
12410
|
+
</div>
|
|
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
|
+
);
|
|
12447
|
+
}
|
|
12448
|
+
|
|
12449
|
+
createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
12450
|
+
</script>
|
|
12451
|
+
</body>
|
|
12452
|
+
</html>`;
|
|
12453
|
+
const { mkdtempSync, writeFileSync: writeFileSync5 } = await import("fs");
|
|
12454
|
+
const { join: join4 } = await import("path");
|
|
12455
|
+
const { tmpdir } = await import("os");
|
|
12456
|
+
const devRoot = mkdtempSync(join4(tmpdir(), "mm-dev-"));
|
|
12457
|
+
writeFileSync5(join4(devRoot, "index.html"), devHtml, "utf-8");
|
|
12390
12458
|
let deployInFlight = false;
|
|
12391
12459
|
const compileDeployPlugin = {
|
|
12392
12460
|
name: "mindmatrix-dev-compile-deploy",
|
|
@@ -12417,11 +12485,16 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
|
12417
12485
|
}
|
|
12418
12486
|
};
|
|
12419
12487
|
const viteConfig = {
|
|
12420
|
-
|
|
12488
|
+
// Physical index.html lives in a temp dir so Vite serves it natively.
|
|
12489
|
+
root: devRoot,
|
|
12490
|
+
// Pre-bundle React so Vite doesn't warn about missing entry point.
|
|
12491
|
+
optimizeDeps: { include: ["react", "react-dom/client"] },
|
|
12421
12492
|
server: {
|
|
12422
12493
|
port,
|
|
12423
12494
|
open,
|
|
12424
12495
|
host: true,
|
|
12496
|
+
// Allow serving files from the real project directory (fs.allow).
|
|
12497
|
+
fs: { allow: [devRoot, process.cwd(), ".."] },
|
|
12425
12498
|
proxy: {
|
|
12426
12499
|
"/api": { target: proxyTarget, changeOrigin: true, secure: true, ws: true },
|
|
12427
12500
|
"/health": { target: proxyTarget, changeOrigin: true, secure: true },
|
|
@@ -12492,6 +12565,11 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
|
12492
12565
|
if (localServer) {
|
|
12493
12566
|
await localServer.close();
|
|
12494
12567
|
}
|
|
12568
|
+
try {
|
|
12569
|
+
const { rmSync } = await import("fs");
|
|
12570
|
+
rmSync(devRoot, { recursive: true, force: true });
|
|
12571
|
+
} catch {
|
|
12572
|
+
}
|
|
12495
12573
|
}
|
|
12496
12574
|
};
|
|
12497
12575
|
}
|
package/dist/dev-server.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -14601,6 +14601,74 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
|
14601
14601
|
`;
|
|
14602
14602
|
}
|
|
14603
14603
|
};
|
|
14604
|
+
const devHtml = `<!DOCTYPE html>
|
|
14605
|
+
<html lang="en">
|
|
14606
|
+
<head>
|
|
14607
|
+
<meta charset="UTF-8">
|
|
14608
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
14609
|
+
<title>MindMatrix Dev</title>
|
|
14610
|
+
<style>
|
|
14611
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
14612
|
+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #fafafa; color: #111; }
|
|
14613
|
+
#root { min-height: 100vh; }
|
|
14614
|
+
.mm-loading { display: flex; align-items: center; justify-content: center; min-height: 100vh; flex-direction: column; gap: 12px; }
|
|
14615
|
+
.mm-loading h1 { font-size: 20px; font-weight: 600; color: #333; }
|
|
14616
|
+
.mm-loading p { color: #888; font-size: 14px; }
|
|
14617
|
+
</style>
|
|
14618
|
+
</head>
|
|
14619
|
+
<body>
|
|
14620
|
+
<div id="root">
|
|
14621
|
+
<div class="mm-loading">
|
|
14622
|
+
<h1>MindMatrix Dev</h1>
|
|
14623
|
+
<p>Loading...</p>
|
|
14624
|
+
</div>
|
|
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
|
+
);
|
|
14661
|
+
}
|
|
14662
|
+
|
|
14663
|
+
createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
14664
|
+
</script>
|
|
14665
|
+
</body>
|
|
14666
|
+
</html>`;
|
|
14667
|
+
const { mkdtempSync, writeFileSync: writeFileSync5 } = await import("fs");
|
|
14668
|
+
const { join: join4 } = await import("path");
|
|
14669
|
+
const { tmpdir } = await import("os");
|
|
14670
|
+
const devRoot = mkdtempSync(join4(tmpdir(), "mm-dev-"));
|
|
14671
|
+
writeFileSync5(join4(devRoot, "index.html"), devHtml, "utf-8");
|
|
14604
14672
|
let deployInFlight = false;
|
|
14605
14673
|
const compileDeployPlugin = {
|
|
14606
14674
|
name: "mindmatrix-dev-compile-deploy",
|
|
@@ -14631,11 +14699,16 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
|
14631
14699
|
}
|
|
14632
14700
|
};
|
|
14633
14701
|
const viteConfig = {
|
|
14634
|
-
|
|
14702
|
+
// Physical index.html lives in a temp dir so Vite serves it natively.
|
|
14703
|
+
root: devRoot,
|
|
14704
|
+
// Pre-bundle React so Vite doesn't warn about missing entry point.
|
|
14705
|
+
optimizeDeps: { include: ["react", "react-dom/client"] },
|
|
14635
14706
|
server: {
|
|
14636
14707
|
port,
|
|
14637
14708
|
open,
|
|
14638
14709
|
host: true,
|
|
14710
|
+
// Allow serving files from the real project directory (fs.allow).
|
|
14711
|
+
fs: { allow: [devRoot, process.cwd(), ".."] },
|
|
14639
14712
|
proxy: {
|
|
14640
14713
|
"/api": { target: proxyTarget, changeOrigin: true, secure: true, ws: true },
|
|
14641
14714
|
"/health": { target: proxyTarget, changeOrigin: true, secure: true },
|
|
@@ -14706,6 +14779,11 @@ createRoot(document.getElementById('root')).render(React.createElement(App));
|
|
|
14706
14779
|
if (localServer) {
|
|
14707
14780
|
await localServer.close();
|
|
14708
14781
|
}
|
|
14782
|
+
try {
|
|
14783
|
+
const { rmSync } = await import("fs");
|
|
14784
|
+
rmSync(devRoot, { recursive: true, force: true });
|
|
14785
|
+
} catch {
|
|
14786
|
+
}
|
|
14709
14787
|
}
|
|
14710
14788
|
};
|
|
14711
14789
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.1.0-alpha.17",
|
|
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.
|
|
69
|
+
"@mmapp/player-core": "^0.1.0-alpha.17",
|
|
70
70
|
"glob": "^10.3.10"
|
|
71
71
|
},
|
|
72
72
|
"peerDependencies": {
|