@mmapp/react-compiler 0.1.0-alpha.18 → 0.1.0-alpha.20
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/babel/index.d.mts +1 -1
- package/dist/babel/index.d.ts +1 -1
- package/dist/babel/index.js +9 -6
- package/dist/babel/index.mjs +1 -1
- package/dist/chunk-26U577GB.mjs +3465 -0
- package/dist/chunk-2FBDFAX6.mjs +2362 -0
- package/dist/chunk-2REDFOER.mjs +931 -0
- package/dist/{chunk-FPAMQXKB.mjs → chunk-2UTXM2QX.mjs} +10 -20
- package/dist/chunk-2YDQTFAL.mjs +879 -0
- package/dist/chunk-2ZRKQE74.mjs +175 -0
- package/dist/chunk-3QHG2JWV.mjs +154 -0
- package/dist/chunk-466OWSTT.mjs +186 -0
- package/dist/chunk-467SFYOD.mjs +3127 -0
- package/dist/chunk-4AIJO7DZ.mjs +214 -0
- package/dist/chunk-4D43TZYL.mjs +7495 -0
- package/dist/chunk-4FP5DXY4.mjs +3456 -0
- package/dist/chunk-4HX4PI4R.mjs +734 -0
- package/dist/chunk-4VU56NTZ.mjs +544 -0
- package/dist/chunk-4XHK6FWL.mjs +2058 -0
- package/dist/chunk-52C2JKH2.mjs +186 -0
- package/dist/chunk-52XHYD2V.mjs +214 -0
- package/dist/chunk-5GUFFFGL.mjs +148 -0
- package/dist/chunk-5N2FDDS6.mjs +214 -0
- package/dist/chunk-5ZSJXWZT.mjs +1646 -0
- package/dist/chunk-6CQOAAMV.mjs +1803 -0
- package/dist/chunk-6SEVAAVT.mjs +3516 -0
- package/dist/chunk-6YLR5ZDA.mjs +2829 -0
- package/dist/chunk-77UJB356.mjs +244 -0
- package/dist/chunk-7QOAJPQF.mjs +774 -0
- package/dist/chunk-A5RCMIBP.mjs +1795 -0
- package/dist/chunk-A63R3GKH.mjs +1803 -0
- package/dist/chunk-ABNTZXF5.mjs +951 -0
- package/dist/chunk-ADHWW56I.mjs +214 -0
- package/dist/chunk-AOGY2GK6.mjs +3292 -0
- package/dist/chunk-AXXUXRNA.mjs +1434 -0
- package/dist/chunk-BZLU5YK5.mjs +1025 -0
- package/dist/chunk-C7XCDDBH.mjs +1802 -0
- package/dist/chunk-CHLVKMQW.mjs +175 -0
- package/dist/chunk-CKGOZAB7.mjs +939 -0
- package/dist/chunk-CSXYDIVC.mjs +214 -0
- package/dist/chunk-CXTV4VGG.mjs +148 -0
- package/dist/chunk-D34RAZUX.mjs +2223 -0
- package/dist/chunk-DDIC7WM6.mjs +3127 -0
- package/dist/chunk-DPUQOBU6.mjs +4810 -0
- package/dist/chunk-E6MDVTGT.mjs +148 -0
- package/dist/chunk-EGKMUEM6.mjs +544 -0
- package/dist/chunk-EO6SYNCG.mjs +175 -0
- package/dist/chunk-EQGA6A6D.mjs +121 -0
- package/dist/chunk-EY2CSXYA.mjs +822 -0
- package/dist/chunk-EYLOSECJ.mjs +544 -0
- package/dist/chunk-FF5BQVII.mjs +148 -0
- package/dist/chunk-FIQ65CDR.mjs +925 -0
- package/dist/chunk-FOZXJFAR.mjs +186 -0
- package/dist/chunk-G2IAZ5Q6.mjs +148 -0
- package/dist/chunk-G7SMOWOL.mjs +828 -0
- package/dist/chunk-GK7NU6DO.mjs +214 -0
- package/dist/chunk-HDSCPEHY.mjs +4061 -0
- package/dist/chunk-HJELFNEA.mjs +186 -0
- package/dist/chunk-HOIUP6IF.mjs +690 -0
- package/dist/chunk-HRJGDPNE.mjs +148 -0
- package/dist/chunk-I3AU7GRD.mjs +120 -0
- package/dist/chunk-I3VQQJZ6.mjs +2843 -0
- package/dist/chunk-I6SSPILI.mjs +550 -0
- package/dist/chunk-IPTX5MJU.mjs +3223 -0
- package/dist/chunk-ITGUSH2Z.mjs +2783 -0
- package/dist/chunk-IXHBCAMF.mjs +3306 -0
- package/dist/chunk-J7JUAHS4.mjs +186 -0
- package/dist/chunk-J7TWJ3TM.mjs +2784 -0
- package/dist/chunk-JDPLDGVF.mjs +4810 -0
- package/dist/chunk-JK72MQ4N.mjs +877 -0
- package/dist/chunk-K2HHCAS2.mjs +148 -0
- package/dist/chunk-K5HX2SVL.mjs +1902 -0
- package/dist/chunk-KAUEQ2F3.mjs +148 -0
- package/dist/chunk-KFVVOS5N.mjs +925 -0
- package/dist/chunk-KIH4AN3Y.mjs +154 -0
- package/dist/chunk-KPDMN5IX.mjs +175 -0
- package/dist/chunk-LZL2IRCH.mjs +186 -0
- package/dist/chunk-MIZV3TAN.mjs +3293 -0
- package/dist/chunk-MRH4J7IX.mjs +2846 -0
- package/dist/chunk-NKBL5GUC.mjs +186 -0
- package/dist/chunk-NQCNSCF6.mjs +148 -0
- package/dist/chunk-NRP5J3BR.mjs +4811 -0
- package/dist/chunk-NTB7OEX2.mjs +2918 -0
- package/dist/chunk-NUPJYPFU.mjs +801 -0
- package/dist/chunk-NVQUTSQX.mjs +3128 -0
- package/dist/chunk-OGMG64EY.mjs +148 -0
- package/dist/chunk-OL5B2HTH.mjs +175 -0
- package/dist/chunk-OPJKP747.mjs +7506 -0
- package/dist/chunk-OQLGGBNE.mjs +2918 -0
- package/dist/chunk-OW4AQUDL.mjs +544 -0
- package/dist/chunk-OWI6XWCD.mjs +3375 -0
- package/dist/chunk-OZT2EAF2.mjs +2776 -0
- package/dist/chunk-PBRBRKIQ.mjs +175 -0
- package/dist/chunk-PRUMNNDI.mjs +3192 -0
- package/dist/chunk-QPNHDTSM.mjs +4839 -0
- package/dist/chunk-RNEIAJDR.mjs +897 -0
- package/dist/chunk-RY7POBNT.mjs +3127 -0
- package/dist/chunk-S6FJ4DXL.mjs +1813 -0
- package/dist/chunk-SU4E6E7B.mjs +3153 -0
- package/dist/chunk-SYUUKW5A.mjs +3379 -0
- package/dist/chunk-THB5SX2S.mjs +113 -0
- package/dist/chunk-THFYE5ZX.mjs +244 -0
- package/dist/chunk-TK3QMXIP.mjs +2921 -0
- package/dist/chunk-TRR2NPAV.mjs +248 -0
- package/dist/chunk-TTTTOT7P.mjs +1803 -0
- package/dist/chunk-TXONBY6A.mjs +7509 -0
- package/dist/chunk-U2PX3JSY.mjs +1933 -0
- package/dist/chunk-U6F7CTHK.mjs +550 -0
- package/dist/chunk-UASOWKDI.mjs +186 -0
- package/dist/chunk-UDDTWG5J.mjs +734 -0
- package/dist/chunk-UIWLAQCL.mjs +175 -0
- package/dist/chunk-UL2XZEMA.mjs +3128 -0
- package/dist/chunk-US3AVDAI.mjs +3456 -0
- package/dist/chunk-V5DIDOTT.mjs +148 -0
- package/dist/chunk-VLTKQDJ3.mjs +244 -0
- package/dist/chunk-VVC42PTS.mjs +175 -0
- package/dist/chunk-VX3T3NIR.mjs +897 -0
- package/dist/chunk-WBYMW4NQ.mjs +3450 -0
- package/dist/chunk-XMWUHQVV.mjs +939 -0
- package/dist/chunk-XUQ5R6F3.mjs +213 -0
- package/dist/chunk-Y6FXYEAI.mjs +10 -0
- package/dist/chunk-YCWC2SCO.mjs +148 -0
- package/dist/chunk-YFS6JMYO.mjs +3342 -0
- package/dist/chunk-ZE67HOSN.mjs +148 -0
- package/dist/chunk-ZSK5TPIV.mjs +148 -0
- package/dist/cli/index.js +329 -653
- package/dist/cli/index.mjs +9 -9
- package/dist/config-PL24KEWL.mjs +219 -0
- package/dist/deploy-VAHWALWB.mjs +9 -0
- package/dist/dev-server-Bs_sz2DG.d.mts +111 -0
- package/dist/dev-server-Bs_sz2DG.d.ts +111 -0
- package/dist/dev-server-RmGHIntF.d.mts +113 -0
- package/dist/dev-server-RmGHIntF.d.ts +113 -0
- package/dist/dev-server.js +205 -522
- package/dist/dev-server.mjs +4 -4
- package/dist/engine-binary-KQB23JDR.mjs +97 -0
- package/dist/envelope-DD7v0v6E.d.mts +265 -0
- package/dist/envelope-DD7v0v6E.d.ts +265 -0
- package/dist/envelope.js +9 -6
- package/dist/envelope.mjs +2 -2
- package/dist/index-B5gSgvnd.d.mts +44 -0
- package/dist/index-B5gSgvnd.d.ts +44 -0
- package/dist/index-Bs0MnR54.d.mts +103 -0
- package/dist/index-Bs0MnR54.d.ts +103 -0
- package/dist/index-DR0nNc_f.d.mts +101 -0
- package/dist/index-DR0nNc_f.d.ts +101 -0
- package/dist/index-revho_gS.d.mts +104 -0
- package/dist/index-revho_gS.d.ts +104 -0
- package/dist/index-vQjwYekL.d.mts +104 -0
- package/dist/index-vQjwYekL.d.ts +104 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +210 -525
- package/dist/index.mjs +10 -9
- package/dist/init-2XLTUF7O.mjs +407 -0
- package/dist/init-7FJENUDK.mjs +407 -0
- package/dist/init-AVZJHZYY.mjs +538 -0
- package/dist/init-DQDX3QK6.mjs +369 -0
- package/dist/init-K3GVM4JS.mjs +538 -0
- package/dist/init-NXS5BJN3.mjs +454 -0
- package/dist/init-UC3FWPIW.mjs +367 -0
- package/dist/init-UNV5XIDE.mjs +367 -0
- package/dist/project-compiler-2HOPO7GC.mjs +10 -0
- package/dist/project-compiler-D245L5QR.mjs +10 -0
- package/dist/project-compiler-FUQRMB4X.mjs +10 -0
- package/dist/project-compiler-LA5OBI5P.mjs +10 -0
- package/dist/project-compiler-OP2VVGJQ.mjs +10 -0
- package/dist/project-compiler-PZNFE6AH.mjs +10 -0
- package/dist/project-compiler-QBVF6MFI.mjs +10 -0
- package/dist/project-compiler-VFR6CSDX.mjs +10 -0
- package/dist/project-compiler-WMJZA4UH.mjs +10 -0
- package/dist/project-compiler-XXS27TZT.mjs +10 -0
- package/dist/project-compiler-YYGDSHY5.mjs +10 -0
- package/dist/project-decompiler-5GY2KSG4.mjs +7 -0
- package/dist/project-decompiler-7I2OMUVY.mjs +7 -0
- package/dist/project-decompiler-QCZYY4TW.mjs +7 -0
- package/dist/project-decompiler-US7GAVIC.mjs +7 -0
- package/dist/pull-2Q53HF3H.mjs +107 -0
- package/dist/pull-5AFHD3QG.mjs +109 -0
- package/dist/pull-5WJ4LW4U.mjs +109 -0
- package/dist/pull-65GUSX6F.mjs +109 -0
- package/dist/pull-6LVI4LMM.mjs +109 -0
- package/dist/pull-A2QUHW4K.mjs +109 -0
- package/dist/pull-B6T5BUKV.mjs +109 -0
- package/dist/pull-CKHWZT33.mjs +109 -0
- package/dist/pull-GM74ERRT.mjs +109 -0
- package/dist/pull-JBEQWVPE.mjs +109 -0
- package/dist/pull-P44LDRWB.mjs +109 -0
- package/dist/pull-W2US3T3E.mjs +109 -0
- package/dist/testing/index.js +9 -6
- package/dist/testing/index.mjs +1 -1
- package/dist/verify-3PPS4XAM.mjs +1833 -0
- package/dist/verify-GKEH5FZQ.mjs +1833 -0
- package/dist/verify-HDKUNHZ4.mjs +1833 -0
- package/dist/verify-SEIXUGN4.mjs +1833 -0
- package/dist/vite/index.js +10 -7
- package/dist/vite/index.mjs +2 -2
- package/mm-dev.db +0 -0
- package/package.json +2 -2
package/dist/cli/index.mjs
CHANGED
|
@@ -7,12 +7,12 @@ import {
|
|
|
7
7
|
} from "../chunk-J3M4GUS7.mjs";
|
|
8
8
|
import {
|
|
9
9
|
deploy
|
|
10
|
-
} from "../chunk-
|
|
10
|
+
} from "../chunk-XUQ5R6F3.mjs";
|
|
11
11
|
import {
|
|
12
12
|
build
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-TRR2NPAV.mjs";
|
|
14
14
|
import "../chunk-5M7DKKBC.mjs";
|
|
15
|
-
import "../chunk-
|
|
15
|
+
import "../chunk-TXONBY6A.mjs";
|
|
16
16
|
import {
|
|
17
17
|
__require
|
|
18
18
|
} from "../chunk-CIESM3BP.mjs";
|
|
@@ -45,8 +45,8 @@ async function test(options = {}) {
|
|
|
45
45
|
const rel = f.startsWith(srcDir + "/") ? f.slice(srcDir.length + 1) : f;
|
|
46
46
|
fileMap[rel] = readFileSync(f, "utf-8");
|
|
47
47
|
}
|
|
48
|
-
const { compileProject } = await import("../project-compiler-
|
|
49
|
-
const { decompileProjectEnhanced } = await import("../project-decompiler-
|
|
48
|
+
const { compileProject } = await import("../project-compiler-D245L5QR.mjs");
|
|
49
|
+
const { decompileProjectEnhanced } = await import("../project-decompiler-QCZYY4TW.mjs");
|
|
50
50
|
process.stdout.write(` Compiling project...`);
|
|
51
51
|
const t0 = performance.now();
|
|
52
52
|
let ir1;
|
|
@@ -548,7 +548,7 @@ async function main() {
|
|
|
548
548
|
const { glob: glob2 } = await import("glob");
|
|
549
549
|
const configPath = resolve2(srcDir, "mm.config.ts");
|
|
550
550
|
if (existsSync2(configPath)) {
|
|
551
|
-
const { compileProject } = await import("../project-compiler-
|
|
551
|
+
const { compileProject } = await import("../project-compiler-D245L5QR.mjs");
|
|
552
552
|
const allFiles = await glob2(`${srcDir}/**/*.{ts,tsx}`, {
|
|
553
553
|
ignore: ["**/node_modules/**", "**/dist/**", "**/__tests__/**", "**/*.test.*"]
|
|
554
554
|
});
|
|
@@ -611,7 +611,7 @@ async function main() {
|
|
|
611
611
|
console.error('[mmrc] Error: name is required\n Usage: mmrc init <name> [--description "..."] [--icon "..."] [--author "..."]');
|
|
612
612
|
process.exit(1);
|
|
613
613
|
}
|
|
614
|
-
const { init } = await import("../init-
|
|
614
|
+
const { init } = await import("../init-AVZJHZYY.mjs");
|
|
615
615
|
await init({
|
|
616
616
|
name,
|
|
617
617
|
description: getFlag("--description"),
|
|
@@ -624,7 +624,7 @@ async function main() {
|
|
|
624
624
|
console.error("[mmrc] Error: target path is required\n Usage: mmrc verify <file-or-dir> [options]");
|
|
625
625
|
process.exit(1);
|
|
626
626
|
}
|
|
627
|
-
const { verifyCommand } = await import("../verify-
|
|
627
|
+
const { verifyCommand } = await import("../verify-HDKUNHZ4.mjs");
|
|
628
628
|
const result = await verifyCommand({
|
|
629
629
|
target,
|
|
630
630
|
static: hasFlag("--static"),
|
|
@@ -651,7 +651,7 @@ async function main() {
|
|
|
651
651
|
console.error(" 3. Set MMRC_TOKEN environment variable");
|
|
652
652
|
process.exit(1);
|
|
653
653
|
}
|
|
654
|
-
const { pull } = await import("../pull-
|
|
654
|
+
const { pull } = await import("../pull-5WJ4LW4U.mjs");
|
|
655
655
|
await pull({ slug, apiUrl, token, outDir });
|
|
656
656
|
} else if (command === "seed") {
|
|
657
657
|
const apiUrl = getFlag("--api-url") ?? "http://localhost:4200/api/v1";
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import "./chunk-CIESM3BP.mjs";
|
|
2
|
+
|
|
3
|
+
// src/cli/config.ts
|
|
4
|
+
import { existsSync, readFileSync, writeFileSync } from "fs";
|
|
5
|
+
import { resolve, join } from "path";
|
|
6
|
+
var DEFAULT_CONFIG = {
|
|
7
|
+
dev: {
|
|
8
|
+
port: 5199,
|
|
9
|
+
apiPort: 4200,
|
|
10
|
+
db: "sqlite://mm-dev.db",
|
|
11
|
+
redis: "",
|
|
12
|
+
api: "http://localhost:4200/api/v1",
|
|
13
|
+
seed: false,
|
|
14
|
+
open: false
|
|
15
|
+
},
|
|
16
|
+
build: {
|
|
17
|
+
mode: "infer",
|
|
18
|
+
outDir: "dist/workflows",
|
|
19
|
+
skipTypeCheck: false
|
|
20
|
+
},
|
|
21
|
+
test: {
|
|
22
|
+
minCoverage: 80,
|
|
23
|
+
minMutationScore: 60,
|
|
24
|
+
integration: false
|
|
25
|
+
},
|
|
26
|
+
environments: {
|
|
27
|
+
local: { apiUrl: "http://localhost:4200/api/v1" },
|
|
28
|
+
dev: { apiUrl: "https://dev.mindmatrix.club/api/v1" }
|
|
29
|
+
},
|
|
30
|
+
defaultTarget: "dev"
|
|
31
|
+
};
|
|
32
|
+
function isPlainObject(val) {
|
|
33
|
+
return typeof val === "object" && val !== null && !Array.isArray(val);
|
|
34
|
+
}
|
|
35
|
+
function deepMerge(target, source) {
|
|
36
|
+
const result = { ...target };
|
|
37
|
+
for (const key of Object.keys(source)) {
|
|
38
|
+
const srcVal = source[key];
|
|
39
|
+
const tgtVal = target[key];
|
|
40
|
+
if (isPlainObject(srcVal) && isPlainObject(tgtVal)) {
|
|
41
|
+
result[key] = deepMerge(tgtVal, srcVal);
|
|
42
|
+
} else if (srcVal !== void 0) {
|
|
43
|
+
result[key] = srcVal;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return result;
|
|
47
|
+
}
|
|
48
|
+
function findConfigPath(startDir) {
|
|
49
|
+
let dir = startDir ?? process.cwd();
|
|
50
|
+
const root = resolve("/");
|
|
51
|
+
while (true) {
|
|
52
|
+
for (const name of ["mmrc.config.ts", "mmrc.config.json"]) {
|
|
53
|
+
const candidate = join(dir, name);
|
|
54
|
+
if (existsSync(candidate)) return candidate;
|
|
55
|
+
}
|
|
56
|
+
const parent = resolve(dir, "..");
|
|
57
|
+
if (parent === dir || parent === root) break;
|
|
58
|
+
dir = parent;
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function loadConfigFromFile(configPath) {
|
|
63
|
+
const content = readFileSync(configPath, "utf-8");
|
|
64
|
+
if (configPath.endsWith(".json")) {
|
|
65
|
+
try {
|
|
66
|
+
return JSON.parse(content);
|
|
67
|
+
} catch {
|
|
68
|
+
return {};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
let js = content.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(?<![:'"])\/\/.*$/gm, "").replace(/^import\s+.*$/gm, "").replace(/^export\s+default\s+/m, "module.exports = ").replace(/^export\s+/gm, "").replace(/:\s*MmrcConfig/g, "").replace(/as\s+const/g, "").replace(/satisfies\s+\w+/g, "");
|
|
72
|
+
js = `function defineMmrc(c) { return c; }
|
|
73
|
+
${js}`;
|
|
74
|
+
try {
|
|
75
|
+
const m = {};
|
|
76
|
+
const fn = new Function("module", "exports", "require", js);
|
|
77
|
+
fn(m, m, () => ({}));
|
|
78
|
+
const exported = m.exports ?? m;
|
|
79
|
+
return isPlainObject(exported) ? exported : {};
|
|
80
|
+
} catch {
|
|
81
|
+
return {};
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function getConfig(startDir) {
|
|
85
|
+
const configPath = findConfigPath(startDir);
|
|
86
|
+
if (!configPath) return { ...DEFAULT_CONFIG };
|
|
87
|
+
const userConfig = loadConfigFromFile(configPath);
|
|
88
|
+
return deepMerge(DEFAULT_CONFIG, userConfig);
|
|
89
|
+
}
|
|
90
|
+
function getConfigValue(config, key) {
|
|
91
|
+
const parts = key.split(".");
|
|
92
|
+
let current = config;
|
|
93
|
+
for (const part of parts) {
|
|
94
|
+
if (!isPlainObject(current)) return void 0;
|
|
95
|
+
current = current[part];
|
|
96
|
+
}
|
|
97
|
+
return current;
|
|
98
|
+
}
|
|
99
|
+
function setConfigValue(config, key, value) {
|
|
100
|
+
const parts = key.split(".");
|
|
101
|
+
let current = config;
|
|
102
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
103
|
+
const part = parts[i];
|
|
104
|
+
if (!isPlainObject(current[part])) {
|
|
105
|
+
current[part] = {};
|
|
106
|
+
}
|
|
107
|
+
current = current[part];
|
|
108
|
+
}
|
|
109
|
+
const last = parts[parts.length - 1];
|
|
110
|
+
if (value === "true") current[last] = true;
|
|
111
|
+
else if (value === "false") current[last] = false;
|
|
112
|
+
else if (/^\d+$/.test(value)) current[last] = parseInt(value, 10);
|
|
113
|
+
else current[last] = value;
|
|
114
|
+
}
|
|
115
|
+
function flattenConfig(obj, prefix = "") {
|
|
116
|
+
const entries = [];
|
|
117
|
+
if (!isPlainObject(obj)) {
|
|
118
|
+
entries.push([prefix, String(obj)]);
|
|
119
|
+
return entries;
|
|
120
|
+
}
|
|
121
|
+
for (const [key, val] of Object.entries(obj)) {
|
|
122
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
123
|
+
if (isPlainObject(val)) {
|
|
124
|
+
entries.push(...flattenConfig(val, fullKey));
|
|
125
|
+
} else {
|
|
126
|
+
entries.push([fullKey, String(val)]);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return entries;
|
|
130
|
+
}
|
|
131
|
+
function writeConfigFile(configPath, config) {
|
|
132
|
+
const json = JSON.stringify(config, null, 2);
|
|
133
|
+
const content = `/**
|
|
134
|
+
* mmrc.config.ts \u2014 MindMatrix React Compiler configuration.
|
|
135
|
+
*
|
|
136
|
+
* Configures the mmrc CLI for local dev, builds, tests, and deploy targets.
|
|
137
|
+
* Edit directly or run \`mmrc config set <key> <value>\`.
|
|
138
|
+
*/
|
|
139
|
+
|
|
140
|
+
const config = ${json};
|
|
141
|
+
|
|
142
|
+
export default config;
|
|
143
|
+
`;
|
|
144
|
+
writeFileSync(configPath, content, "utf-8");
|
|
145
|
+
}
|
|
146
|
+
function resolveTarget(targetName, config, fallbackApiUrl) {
|
|
147
|
+
if (!config || !config.environments) {
|
|
148
|
+
return { name: targetName ?? "default", apiUrl: fallbackApiUrl, token: null };
|
|
149
|
+
}
|
|
150
|
+
const name = targetName ?? config.defaultTarget ?? "local";
|
|
151
|
+
const env = config.environments[name];
|
|
152
|
+
if (!env) {
|
|
153
|
+
const available = Object.keys(config.environments).join(", ");
|
|
154
|
+
throw new Error(`Unknown target "${name}". Available environments: ${available}`);
|
|
155
|
+
}
|
|
156
|
+
return { name, apiUrl: env.apiUrl, token: env.token ?? null };
|
|
157
|
+
}
|
|
158
|
+
function generateMmrcConfig() {
|
|
159
|
+
return `/**
|
|
160
|
+
* mmrc.config.ts \u2014 MindMatrix React Compiler configuration.
|
|
161
|
+
*
|
|
162
|
+
* Configures the mmrc CLI for local dev, builds, tests, and deploy targets.
|
|
163
|
+
* Edit directly or run \`mmrc config set <key> <value>\`.
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
const config = {
|
|
167
|
+
dev: {
|
|
168
|
+
port: 5199,
|
|
169
|
+
apiPort: 4200,
|
|
170
|
+
db: 'sqlite://mm-dev.db',
|
|
171
|
+
redis: '',
|
|
172
|
+
api: 'https://dev.mindmatrix.club/api/v1',
|
|
173
|
+
seed: false,
|
|
174
|
+
open: false,
|
|
175
|
+
},
|
|
176
|
+
|
|
177
|
+
build: {
|
|
178
|
+
mode: 'infer',
|
|
179
|
+
outDir: 'dist/workflows',
|
|
180
|
+
skipTypeCheck: false,
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
test: {
|
|
184
|
+
minCoverage: 80,
|
|
185
|
+
minMutationScore: 60,
|
|
186
|
+
integration: false,
|
|
187
|
+
},
|
|
188
|
+
|
|
189
|
+
environments: {
|
|
190
|
+
local: { apiUrl: 'http://localhost:4200/api/v1' },
|
|
191
|
+
dev: { apiUrl: 'https://dev.mindmatrix.club/api/v1' },
|
|
192
|
+
},
|
|
193
|
+
|
|
194
|
+
defaultTarget: 'dev',
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
export default config;
|
|
198
|
+
`;
|
|
199
|
+
}
|
|
200
|
+
function loadMmrcConfig(dir) {
|
|
201
|
+
const path = findConfigPath(dir);
|
|
202
|
+
if (!path) return null;
|
|
203
|
+
const partial = loadConfigFromFile(path);
|
|
204
|
+
return deepMerge(DEFAULT_CONFIG, partial);
|
|
205
|
+
}
|
|
206
|
+
export {
|
|
207
|
+
DEFAULT_CONFIG,
|
|
208
|
+
deepMerge,
|
|
209
|
+
findConfigPath,
|
|
210
|
+
flattenConfig,
|
|
211
|
+
generateMmrcConfig,
|
|
212
|
+
getConfig,
|
|
213
|
+
getConfigValue,
|
|
214
|
+
loadConfigFromFile,
|
|
215
|
+
loadMmrcConfig,
|
|
216
|
+
resolveTarget,
|
|
217
|
+
setConfigValue,
|
|
218
|
+
writeConfigFile
|
|
219
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { IRWorkflowDefinition } from '@mindmatrix/player-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CLI Build Command — compiles workflow files to Pure Form JSON.
|
|
6
|
+
*
|
|
7
|
+
* Supports three file types:
|
|
8
|
+
* - *.workflow.tsx — React workflow components
|
|
9
|
+
* - models/*.ts — TypeScript model files
|
|
10
|
+
* - *.server.ts — Server action files
|
|
11
|
+
*
|
|
12
|
+
* Produces:
|
|
13
|
+
* - *.workflow.json — IR (Pure Form)
|
|
14
|
+
* - *.json — Engine-compatible definition
|
|
15
|
+
* - envelope.json — Source envelope with file manifest
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface BuildOptions {
|
|
19
|
+
src?: string;
|
|
20
|
+
outDir?: string;
|
|
21
|
+
mode?: 'strict' | 'infer';
|
|
22
|
+
/** Generate source envelope. */
|
|
23
|
+
envelope?: boolean;
|
|
24
|
+
/** Blueprint slug for envelope. */
|
|
25
|
+
slug?: string;
|
|
26
|
+
/** Blueprint version for envelope. */
|
|
27
|
+
version?: string;
|
|
28
|
+
/** Skip TypeScript type checking (not recommended). */
|
|
29
|
+
skipTypeCheck?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface BuildResult {
|
|
32
|
+
compiled: number;
|
|
33
|
+
errors: number;
|
|
34
|
+
warnings: number;
|
|
35
|
+
definitions: IRWorkflowDefinition[];
|
|
36
|
+
errorDetails: {
|
|
37
|
+
file: string;
|
|
38
|
+
message: string;
|
|
39
|
+
line?: number;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
declare function build(options?: BuildOptions): Promise<BuildResult>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Dev Server — Vite-based development server for MindMatrix React workflows.
|
|
46
|
+
*
|
|
47
|
+
* Uses the Vite plugin to watch .workflow.tsx files. On file change:
|
|
48
|
+
* 1. Compile through Babel plugin → extract IR
|
|
49
|
+
* 2. Diff IR against last known state
|
|
50
|
+
* 3. Notify connected frontends via WebSocket
|
|
51
|
+
* 4. Optionally seed definitions to the dev API
|
|
52
|
+
*
|
|
53
|
+
* Usage (programmatic):
|
|
54
|
+
* import { createDevServer } from '@mindmatrix/react-compiler';
|
|
55
|
+
* const server = await createDevServer({ port: 5199 });
|
|
56
|
+
* // ... server.close() to stop
|
|
57
|
+
*
|
|
58
|
+
* Usage (CLI):
|
|
59
|
+
* mmrc dev --port 5199 --src src/workflows --seed
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/** Minimal WebSocket interface — avoids requiring @types/ws at compile time */
|
|
63
|
+
interface WsClient {
|
|
64
|
+
readyState: number;
|
|
65
|
+
send(data: string): void;
|
|
66
|
+
close(): void;
|
|
67
|
+
on(event: string, listener: (...args: unknown[]) => void): void;
|
|
68
|
+
}
|
|
69
|
+
interface DevServerOptions {
|
|
70
|
+
/** Port for the dev server. Default: 5199 */
|
|
71
|
+
port?: number;
|
|
72
|
+
/** Source directory to watch. Default: 'src/workflows' */
|
|
73
|
+
src?: string;
|
|
74
|
+
/** Compilation mode. Default: 'infer' */
|
|
75
|
+
mode?: 'strict' | 'infer';
|
|
76
|
+
/** Glob patterns for workflow files. Default: ['**\/*.workflow.tsx'] */
|
|
77
|
+
include?: string[];
|
|
78
|
+
/** Output directory for .workflow.json sidecar files. Default: 'dist/workflows' */
|
|
79
|
+
outDir?: string;
|
|
80
|
+
/** Seed compiled definitions to the dev API on change. Default: false */
|
|
81
|
+
seed?: boolean;
|
|
82
|
+
/** Dev API base URL. Default: 'http://localhost:4200/api/v1' */
|
|
83
|
+
apiUrl?: string;
|
|
84
|
+
/** Auth token for dev API. Default: reads from MINDMATRIX_TOKEN env */
|
|
85
|
+
authToken?: string;
|
|
86
|
+
/** Enable WebSocket notification channel. Default: true */
|
|
87
|
+
ws?: boolean;
|
|
88
|
+
/** Open browser on start. Default: false */
|
|
89
|
+
open?: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface DevServerInstance {
|
|
92
|
+
/** The underlying Vite dev server */
|
|
93
|
+
vite: ViteDevServer;
|
|
94
|
+
/** Port the server is running on */
|
|
95
|
+
port: number;
|
|
96
|
+
/** Connected WebSocket clients */
|
|
97
|
+
clients: Set<WsClient>;
|
|
98
|
+
/** Trigger a full rebuild of all workflow files */
|
|
99
|
+
rebuild: () => Promise<BuildResult>;
|
|
100
|
+
/** Stop the dev server */
|
|
101
|
+
close: () => Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create and start a MindMatrix dev server.
|
|
105
|
+
*
|
|
106
|
+
* This is a thin Vite server configured with the mindmatrixReact plugin,
|
|
107
|
+
* plus a WebSocket channel that pushes compile events to connected editors.
|
|
108
|
+
*/
|
|
109
|
+
declare function createDevServer(options?: DevServerOptions): Promise<DevServerInstance>;
|
|
110
|
+
|
|
111
|
+
export { type BuildOptions as B, type DevServerOptions as D, type DevServerInstance as a, build as b, createDevServer as c, type BuildResult as d };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { IRWorkflowDefinition } from '@mindmatrix/player-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CLI Build Command — compiles workflow files to Pure Form JSON.
|
|
6
|
+
*
|
|
7
|
+
* Supports three file types:
|
|
8
|
+
* - *.workflow.tsx — React workflow components
|
|
9
|
+
* - models/*.ts — TypeScript model files
|
|
10
|
+
* - *.server.ts — Server action files
|
|
11
|
+
*
|
|
12
|
+
* Produces:
|
|
13
|
+
* - *.workflow.json — IR (Pure Form)
|
|
14
|
+
* - *.json — Engine-compatible definition
|
|
15
|
+
* - envelope.json — Source envelope with file manifest
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface BuildOptions {
|
|
19
|
+
src?: string;
|
|
20
|
+
outDir?: string;
|
|
21
|
+
mode?: 'strict' | 'infer';
|
|
22
|
+
/** Generate source envelope. */
|
|
23
|
+
envelope?: boolean;
|
|
24
|
+
/** Blueprint slug for envelope. */
|
|
25
|
+
slug?: string;
|
|
26
|
+
/** Blueprint version for envelope. */
|
|
27
|
+
version?: string;
|
|
28
|
+
/** Skip TypeScript type checking (not recommended). */
|
|
29
|
+
skipTypeCheck?: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface BuildResult {
|
|
32
|
+
compiled: number;
|
|
33
|
+
errors: number;
|
|
34
|
+
warnings: number;
|
|
35
|
+
definitions: IRWorkflowDefinition[];
|
|
36
|
+
errorDetails: {
|
|
37
|
+
file: string;
|
|
38
|
+
message: string;
|
|
39
|
+
line?: number;
|
|
40
|
+
}[];
|
|
41
|
+
}
|
|
42
|
+
declare function build(options?: BuildOptions): Promise<BuildResult>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Dev Server — Vite-based development server for MindMatrix React workflows.
|
|
46
|
+
*
|
|
47
|
+
* Uses the Vite plugin to watch .workflow.tsx files. On file change:
|
|
48
|
+
* 1. Compile through Babel plugin → extract IR
|
|
49
|
+
* 2. Diff IR against last known state
|
|
50
|
+
* 3. Notify connected frontends via WebSocket
|
|
51
|
+
* 4. Optionally seed definitions to the dev API
|
|
52
|
+
*
|
|
53
|
+
* Usage (programmatic):
|
|
54
|
+
* import { createDevServer } from '@mindmatrix/react-compiler';
|
|
55
|
+
* const server = await createDevServer({ port: 5199 });
|
|
56
|
+
* // ... server.close() to stop
|
|
57
|
+
*
|
|
58
|
+
* Usage (CLI):
|
|
59
|
+
* mmrc dev --port 5199 --src src/workflows --seed
|
|
60
|
+
*/
|
|
61
|
+
|
|
62
|
+
/** Minimal WebSocket interface — avoids requiring @types/ws at compile time */
|
|
63
|
+
interface WsClient {
|
|
64
|
+
readyState: number;
|
|
65
|
+
send(data: string): void;
|
|
66
|
+
close(): void;
|
|
67
|
+
on(event: string, listener: (...args: unknown[]) => void): void;
|
|
68
|
+
}
|
|
69
|
+
interface DevServerOptions {
|
|
70
|
+
/** Port for the dev server. Default: 5199 */
|
|
71
|
+
port?: number;
|
|
72
|
+
/** Source directory to watch. Default: 'src/workflows' */
|
|
73
|
+
src?: string;
|
|
74
|
+
/** Compilation mode. Default: 'infer' */
|
|
75
|
+
mode?: 'strict' | 'infer';
|
|
76
|
+
/** Glob patterns for workflow files. Default: ['**\/*.workflow.tsx'] */
|
|
77
|
+
include?: string[];
|
|
78
|
+
/** Output directory for .workflow.json sidecar files. Default: 'dist/workflows' */
|
|
79
|
+
outDir?: string;
|
|
80
|
+
/** Seed compiled definitions to the dev API on change. Default: false */
|
|
81
|
+
seed?: boolean;
|
|
82
|
+
/** Dev API base URL. Default: 'http://localhost:4200/api/v1' */
|
|
83
|
+
apiUrl?: string;
|
|
84
|
+
/** Auth token for dev API. Default: reads from MINDMATRIX_TOKEN env */
|
|
85
|
+
authToken?: string;
|
|
86
|
+
/** Enable WebSocket notification channel. Default: true */
|
|
87
|
+
ws?: boolean;
|
|
88
|
+
/** Open browser on start. Default: false */
|
|
89
|
+
open?: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface DevServerInstance {
|
|
92
|
+
/** The underlying Vite dev server */
|
|
93
|
+
vite: ViteDevServer;
|
|
94
|
+
/** Port the server is running on */
|
|
95
|
+
port: number;
|
|
96
|
+
/** Connected WebSocket clients */
|
|
97
|
+
clients: Set<WsClient>;
|
|
98
|
+
/** Trigger a full rebuild of all workflow files */
|
|
99
|
+
rebuild: () => Promise<BuildResult>;
|
|
100
|
+
/** Stop the dev server */
|
|
101
|
+
close: () => Promise<void>;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Create and start a MindMatrix dev server.
|
|
105
|
+
*
|
|
106
|
+
* This is a thin Vite server configured with the mindmatrixReact plugin,
|
|
107
|
+
* plus a WebSocket channel that pushes compile events to connected editors.
|
|
108
|
+
*/
|
|
109
|
+
declare function createDevServer(options?: DevServerOptions): Promise<DevServerInstance>;
|
|
110
|
+
|
|
111
|
+
export { type BuildOptions as B, type DevServerOptions as D, type DevServerInstance as a, build as b, createDevServer as c, type BuildResult as d };
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { ViteDevServer } from 'vite';
|
|
2
|
+
import { IRWorkflowDefinition } from '@mindmatrix/player-core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CLI Build Command — compiles workflow files to Pure Form JSON.
|
|
6
|
+
*
|
|
7
|
+
* Supports three file types:
|
|
8
|
+
* - *.workflow.tsx — React workflow components
|
|
9
|
+
* - models/*.ts — TypeScript model files
|
|
10
|
+
* - *.server.ts — Server action files
|
|
11
|
+
*
|
|
12
|
+
* Produces:
|
|
13
|
+
* - *.workflow.json — IR (Pure Form)
|
|
14
|
+
* - *.json — Engine-compatible definition
|
|
15
|
+
* - envelope.json — Source envelope with file manifest
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface BuildOptions {
|
|
19
|
+
src?: string;
|
|
20
|
+
outDir?: string;
|
|
21
|
+
mode?: 'strict' | 'infer';
|
|
22
|
+
/** Generate source envelope. */
|
|
23
|
+
envelope?: boolean;
|
|
24
|
+
/** Blueprint slug for envelope. */
|
|
25
|
+
slug?: string;
|
|
26
|
+
/** Blueprint version for envelope. */
|
|
27
|
+
version?: string;
|
|
28
|
+
/** Skip TypeScript type checking (not recommended). */
|
|
29
|
+
skipTypeCheck?: boolean;
|
|
30
|
+
/** Watch mode: auto-recompile on file changes. */
|
|
31
|
+
watch?: boolean;
|
|
32
|
+
}
|
|
33
|
+
interface BuildResult {
|
|
34
|
+
compiled: number;
|
|
35
|
+
errors: number;
|
|
36
|
+
warnings: number;
|
|
37
|
+
definitions: IRWorkflowDefinition[];
|
|
38
|
+
errorDetails: {
|
|
39
|
+
file: string;
|
|
40
|
+
message: string;
|
|
41
|
+
line?: number;
|
|
42
|
+
}[];
|
|
43
|
+
}
|
|
44
|
+
declare function build(options?: BuildOptions): Promise<BuildResult>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Dev Server — Vite-based development server for MindMatrix React workflows.
|
|
48
|
+
*
|
|
49
|
+
* Uses the Vite plugin to watch .workflow.tsx files. On file change:
|
|
50
|
+
* 1. Compile through Babel plugin → extract IR
|
|
51
|
+
* 2. Diff IR against last known state
|
|
52
|
+
* 3. Notify connected frontends via WebSocket
|
|
53
|
+
* 4. Optionally seed definitions to the dev API
|
|
54
|
+
*
|
|
55
|
+
* Usage (programmatic):
|
|
56
|
+
* import { createDevServer } from '@mindmatrix/react-compiler';
|
|
57
|
+
* const server = await createDevServer({ port: 5199 });
|
|
58
|
+
* // ... server.close() to stop
|
|
59
|
+
*
|
|
60
|
+
* Usage (CLI):
|
|
61
|
+
* mmrc dev --port 5199 --src src/workflows --seed
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/** Minimal WebSocket interface — avoids requiring @types/ws at compile time */
|
|
65
|
+
interface WsClient {
|
|
66
|
+
readyState: number;
|
|
67
|
+
send(data: string): void;
|
|
68
|
+
close(): void;
|
|
69
|
+
on(event: string, listener: (...args: unknown[]) => void): void;
|
|
70
|
+
}
|
|
71
|
+
interface DevServerOptions {
|
|
72
|
+
/** Port for the dev server. Default: 5199 */
|
|
73
|
+
port?: number;
|
|
74
|
+
/** Source directory to watch. Default: 'src/workflows' */
|
|
75
|
+
src?: string;
|
|
76
|
+
/** Compilation mode. Default: 'infer' */
|
|
77
|
+
mode?: 'strict' | 'infer';
|
|
78
|
+
/** Glob patterns for workflow files. Default: ['**\/*.workflow.tsx'] */
|
|
79
|
+
include?: string[];
|
|
80
|
+
/** Output directory for .workflow.json sidecar files. Default: 'dist/workflows' */
|
|
81
|
+
outDir?: string;
|
|
82
|
+
/** Seed compiled definitions to the dev API on change. Default: false */
|
|
83
|
+
seed?: boolean;
|
|
84
|
+
/** Dev API base URL. Default: 'http://localhost:4200/api/v1' */
|
|
85
|
+
apiUrl?: string;
|
|
86
|
+
/** Auth token for dev API. Default: reads from MINDMATRIX_TOKEN env */
|
|
87
|
+
authToken?: string;
|
|
88
|
+
/** Enable WebSocket notification channel. Default: true */
|
|
89
|
+
ws?: boolean;
|
|
90
|
+
/** Open browser on start. Default: false */
|
|
91
|
+
open?: boolean;
|
|
92
|
+
}
|
|
93
|
+
interface DevServerInstance {
|
|
94
|
+
/** The underlying Vite dev server */
|
|
95
|
+
vite: ViteDevServer;
|
|
96
|
+
/** Port the server is running on */
|
|
97
|
+
port: number;
|
|
98
|
+
/** Connected WebSocket clients */
|
|
99
|
+
clients: Set<WsClient>;
|
|
100
|
+
/** Trigger a full rebuild of all workflow files */
|
|
101
|
+
rebuild: () => Promise<BuildResult>;
|
|
102
|
+
/** Stop the dev server */
|
|
103
|
+
close: () => Promise<void>;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Create and start a MindMatrix dev server.
|
|
107
|
+
*
|
|
108
|
+
* This is a thin Vite server configured with the mindmatrixReact plugin,
|
|
109
|
+
* plus a WebSocket channel that pushes compile events to connected editors.
|
|
110
|
+
*/
|
|
111
|
+
declare function createDevServer(options?: DevServerOptions): Promise<DevServerInstance>;
|
|
112
|
+
|
|
113
|
+
export { type BuildOptions as B, type DevServerOptions as D, type DevServerInstance as a, build as b, createDevServer as c, type BuildResult as d };
|