@mmapp/react-compiler 0.1.0-alpha.12 → 0.1.0-alpha.14

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/cli/index.js CHANGED
@@ -14454,36 +14454,24 @@ async function verifyBinary(binaryPath) {
14454
14454
  if (!(0, import_fs6.existsSync)(binaryPath)) {
14455
14455
  return { ok: false, error: `Binary not found at ${binaryPath}` };
14456
14456
  }
14457
- return new Promise((resolve7) => {
14458
- try {
14459
- const proc = (0, import_child_process2.spawn)(binaryPath, ["--version"], {
14460
- stdio: ["ignore", "pipe", "pipe"],
14461
- timeout: 1e4
14462
- });
14463
- let stdout = "";
14464
- let stderr = "";
14465
- proc.stdout?.on("data", (d) => {
14466
- stdout += d.toString();
14467
- });
14468
- proc.stderr?.on("data", (d) => {
14469
- stderr += d.toString();
14470
- });
14471
- proc.on("error", (err) => {
14472
- resolve7({ ok: false, error: `Failed to execute: ${err.message}` });
14473
- });
14474
- proc.on("close", (code) => {
14475
- if (code === 0) {
14476
- const output = stdout.trim() || stderr.trim();
14477
- const version = output.replace(/^mm[-_](?:server|api)\s*/i, "").trim() || "unknown";
14478
- resolve7({ ok: true, version });
14479
- } else {
14480
- resolve7({ ok: false, error: `Exited with code ${code}. ${stderr.trim()}` });
14481
- }
14482
- });
14483
- } catch (e) {
14484
- resolve7({ ok: false, error: `Spawn failed: ${e instanceof Error ? e.message : String(e)}` });
14457
+ try {
14458
+ const { statSync: statSync3 } = require("fs");
14459
+ const stat = statSync3(binaryPath);
14460
+ if (stat.size < 1e6) {
14461
+ return { ok: false, error: `Binary too small (${stat.size} bytes) \u2014 likely corrupt` };
14485
14462
  }
14486
- });
14463
+ if (process.platform !== "win32") {
14464
+ const { accessSync, constants } = require("fs");
14465
+ try {
14466
+ accessSync(binaryPath, constants.X_OK);
14467
+ } catch {
14468
+ return { ok: false, error: "Binary is not executable" };
14469
+ }
14470
+ }
14471
+ return { ok: true, version: "unknown" };
14472
+ } catch (e) {
14473
+ return { ok: false, error: e.message };
14474
+ }
14487
14475
  }
14488
14476
  async function healthCheck(url, timeoutMs = 5e3) {
14489
14477
  try {
@@ -14691,11 +14679,46 @@ async function buildFromSource(options) {
14691
14679
  return null;
14692
14680
  }
14693
14681
  }
14694
- console.error("[mmrc] Building mm-api from source (this may take a few minutes)...");
14682
+ console.error("[mmrc] Building mm-api from source (this may take several minutes)...");
14683
+ let engineDir = null;
14684
+ const searchPaths = [
14685
+ (0, import_path5.join)(cwd, "mm-core"),
14686
+ (0, import_path5.join)(cwd, "engine"),
14687
+ (0, import_path5.join)(cwd, "..", "mm-core"),
14688
+ (0, import_path5.join)(cwd, "..", "..", "mm-core"),
14689
+ (0, import_path5.join)(cwd, "..", "..", "mm-app", "mm-core"),
14690
+ (0, import_path5.join)((0, import_os2.homedir)(), ".mmrc", "engine-src")
14691
+ ];
14692
+ for (const p of searchPaths) {
14693
+ if ((0, import_fs6.existsSync)((0, import_path5.join)(p, "Cargo.toml"))) {
14694
+ engineDir = p;
14695
+ console.error(`[mmrc] Found engine source at ${p}`);
14696
+ break;
14697
+ }
14698
+ }
14699
+ if (!engineDir) {
14700
+ const cloneDir = (0, import_path5.join)((0, import_os2.homedir)(), ".mmrc", "engine-src");
14701
+ console.error("[mmrc] Engine source not found locally \u2014 cloning from GitHub...");
14702
+ try {
14703
+ if ((0, import_fs6.existsSync)(cloneDir)) {
14704
+ (0, import_child_process2.execSync)("git pull", { cwd: cloneDir, stdio: "pipe", timeout: 6e4 });
14705
+ } else {
14706
+ (0, import_fs6.mkdirSync)((0, import_path5.join)((0, import_os2.homedir)(), ".mmrc"), { recursive: true });
14707
+ (0, import_child_process2.execSync)(`git clone --depth 1 https://github.com/dev-nested/mm-app.git ${cloneDir}`, {
14708
+ stdio: "inherit",
14709
+ timeout: 12e4
14710
+ });
14711
+ }
14712
+ engineDir = (0, import_path5.join)(cloneDir, "mm-core");
14713
+ } catch (err) {
14714
+ console.error("[mmrc] Failed to clone engine source:", err instanceof Error ? err.message : err);
14715
+ return null;
14716
+ }
14717
+ }
14695
14718
  try {
14696
14719
  (0, import_child_process2.execSync)("cargo build --release -p mm-api", {
14697
14720
  stdio: "inherit",
14698
- cwd,
14721
+ cwd: engineDir,
14699
14722
  timeout: 6e5
14700
14723
  });
14701
14724
  } catch (err) {
@@ -14703,6 +14726,8 @@ async function buildFromSource(options) {
14703
14726
  return null;
14704
14727
  }
14705
14728
  const candidates = [
14729
+ (0, import_path5.join)(engineDir, "target", "release", "mm-server"),
14730
+ (0, import_path5.join)(engineDir, "..", "target", "release", "mm-server"),
14706
14731
  (0, import_path5.join)(cwd, "mm-core", "target", "release", "mm-server"),
14707
14732
  (0, import_path5.join)(cwd, "target", "release", "mm-server")
14708
14733
  ];
@@ -15761,10 +15786,10 @@ async function createDevServer(options = {}) {
15761
15786
  }
15762
15787
  const {
15763
15788
  port = 5199,
15764
- src = "src/workflows",
15789
+ src = ".",
15765
15790
  mode = "infer",
15766
- include = ["**/*.workflow.tsx"],
15767
- outDir = "dist/workflows",
15791
+ include = ["models/**/*.ts", "app/**/*.tsx", "**/*.workflow.tsx"],
15792
+ outDir = "dist",
15768
15793
  seed = false,
15769
15794
  apiUrl: rawApiUrl = "auto",
15770
15795
  authToken: explicitToken,
@@ -16576,6 +16601,20 @@ async function init(options) {
16576
16601
  console.error(`[mmrc] Error: Directory already exists: ${blueprintDir}`);
16577
16602
  process.exit(1);
16578
16603
  }
16604
+ try {
16605
+ const pkgPath = require.resolve("@mmapp/react-compiler/package.json");
16606
+ const { version } = require(pkgPath);
16607
+ console.log(`[mmrc] v${version}`);
16608
+ } catch {
16609
+ try {
16610
+ const { readFileSync: readFileSync11 } = require("fs");
16611
+ const { resolve: resolve7, dirname: dirname4 } = require("path");
16612
+ const pkg = JSON.parse(readFileSync11(resolve7(__dirname, "../../package.json"), "utf-8"));
16613
+ console.log(`[mmrc] v${pkg.version}`);
16614
+ } catch {
16615
+ console.log(`[mmrc]`);
16616
+ }
16617
+ }
16579
16618
  console.log(`[mmrc] Creating blueprint: ${name}
16580
16619
  `);
16581
16620
  (0, import_fs10.mkdirSync)((0, import_path8.join)(blueprintDir, "models"), { recursive: true });
@@ -19270,63 +19309,67 @@ async function main() {
19270
19309
  force: true,
19271
19310
  version: getFlag("--engine-version") ?? "latest"
19272
19311
  });
19273
- if (!installed.path) {
19274
- console.error("[mmrc] Could not obtain a working engine binary.");
19275
- process.exit(1);
19312
+ if (installed.path) {
19313
+ resolution = installed;
19276
19314
  }
19277
- resolution = installed;
19278
19315
  }
19279
- console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
19280
- const { spawn: spawnProcess } = require("child_process");
19281
- engineProcess = spawnProcess(resolution.path, [], {
19282
- stdio: ["ignore", "pipe", "pipe"],
19283
- env: {
19284
- ...process.env,
19285
- DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
19286
- JWT_SECRET: "dev-secret-mmrc-local",
19287
- PORT: String(apiPort),
19288
- RUST_LOG: "mm_api=info,mm_storage=info"
19289
- }
19290
- });
19291
- if (engineProcess.stdout) {
19292
- engineProcess.stdout.on("data", (data) => {
19293
- for (const line of data.toString().split("\n").filter(Boolean)) {
19294
- console.log(` [engine] ${line}`);
19316
+ if (!resolution.path) {
19317
+ console.log("[mmrc] No local engine binary available.");
19318
+ console.log("[mmrc] Dev server will connect to a remote API or start in-memory mode.");
19319
+ console.log("[mmrc] (For full local mode: `mmrc engine install` or `mmrc engine build`)\n");
19320
+ } else {
19321
+ console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
19322
+ const { spawn: spawnProcess } = require("child_process");
19323
+ engineProcess = spawnProcess(resolution.path, [], {
19324
+ stdio: ["ignore", "pipe", "pipe"],
19325
+ env: {
19326
+ ...process.env,
19327
+ DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
19328
+ JWT_SECRET: "dev-secret-mmrc-local",
19329
+ PORT: String(apiPort),
19330
+ RUST_LOG: "mm_api=info,mm_storage=info"
19295
19331
  }
19296
19332
  });
19297
- }
19298
- if (engineProcess.stderr) {
19299
- engineProcess.stderr.on("data", (data) => {
19300
- for (const line of data.toString().split("\n").filter(Boolean)) {
19301
- console.error(` [engine] ${line}`);
19302
- }
19333
+ if (engineProcess.stdout) {
19334
+ engineProcess.stdout.on("data", (data) => {
19335
+ for (const line of data.toString().split("\n").filter(Boolean)) {
19336
+ console.log(` [engine] ${line}`);
19337
+ }
19338
+ });
19339
+ }
19340
+ if (engineProcess.stderr) {
19341
+ engineProcess.stderr.on("data", (data) => {
19342
+ for (const line of data.toString().split("\n").filter(Boolean)) {
19343
+ console.error(` [engine] ${line}`);
19344
+ }
19345
+ });
19346
+ }
19347
+ engineProcess.on("error", (err) => {
19348
+ console.error(`[mmrc] Engine failed to start: ${err.message}`);
19349
+ process.exit(1);
19303
19350
  });
19304
- }
19305
- engineProcess.on("error", (err) => {
19306
- console.error(`[mmrc] Engine failed to start: ${err.message}`);
19307
- process.exit(1);
19308
- });
19309
- const healthUrl = `http://localhost:${apiPort}/health`;
19310
- let healthy = false;
19311
- for (let i = 0; i < 30; i++) {
19312
- try {
19313
- const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
19314
- if (res.ok) {
19315
- healthy = true;
19316
- break;
19351
+ const healthUrl = `http://localhost:${apiPort}/health`;
19352
+ let healthy = false;
19353
+ for (let i = 0; i < 30; i++) {
19354
+ try {
19355
+ const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
19356
+ if (res.ok) {
19357
+ healthy = true;
19358
+ break;
19359
+ }
19360
+ } catch {
19317
19361
  }
19318
- } catch {
19362
+ await new Promise((r) => setTimeout(r, 500));
19319
19363
  }
19320
- await new Promise((r) => setTimeout(r, 500));
19321
- }
19322
- if (!healthy) {
19323
- console.error("[mmrc] Engine failed to become healthy within 15s.");
19324
- engineProcess.kill();
19325
- process.exit(1);
19364
+ if (!healthy) {
19365
+ console.error("[mmrc] Engine failed to become healthy within 15s.");
19366
+ engineProcess.kill();
19367
+ process.exit(1);
19368
+ }
19369
+ console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
19326
19370
  }
19327
- console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
19328
19371
  }
19329
- const apiUrl = isLocal ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl;
19372
+ const apiUrl = engineProcess ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl || "auto";
19330
19373
  const { createDevServer: createDevServer2 } = await Promise.resolve().then(() => (init_dev_server(), dev_server_exports));
19331
19374
  const server = await createDevServer2({
19332
19375
  port,
@@ -348,7 +348,7 @@ async function main() {
348
348
  const apiPort = getFlag("--api-port") ? parseInt(getFlag("--api-port"), 10) : 4200;
349
349
  let engineProcess = null;
350
350
  if (isLocal) {
351
- const { findEngineBinary, installEngine, verifyBinary } = await import("../engine-binary-QQUDACBJ.mjs");
351
+ const { findEngineBinary, installEngine, verifyBinary } = await import("../engine-binary-FKTZAR56.mjs");
352
352
  let resolution = findEngineBinary(getFlag("--binary"));
353
353
  if (resolution.path) {
354
354
  const verify = await verifyBinary(resolution.path);
@@ -363,63 +363,67 @@ async function main() {
363
363
  force: true,
364
364
  version: getFlag("--engine-version") ?? "latest"
365
365
  });
366
- if (!installed.path) {
367
- console.error("[mmrc] Could not obtain a working engine binary.");
368
- process.exit(1);
366
+ if (installed.path) {
367
+ resolution = installed;
369
368
  }
370
- resolution = installed;
371
369
  }
372
- console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
373
- const { spawn: spawnProcess } = __require("child_process");
374
- engineProcess = spawnProcess(resolution.path, [], {
375
- stdio: ["ignore", "pipe", "pipe"],
376
- env: {
377
- ...process.env,
378
- DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
379
- JWT_SECRET: "dev-secret-mmrc-local",
380
- PORT: String(apiPort),
381
- RUST_LOG: "mm_api=info,mm_storage=info"
382
- }
383
- });
384
- if (engineProcess.stdout) {
385
- engineProcess.stdout.on("data", (data) => {
386
- for (const line of data.toString().split("\n").filter(Boolean)) {
387
- console.log(` [engine] ${line}`);
370
+ if (!resolution.path) {
371
+ console.log("[mmrc] No local engine binary available.");
372
+ console.log("[mmrc] Dev server will connect to a remote API or start in-memory mode.");
373
+ console.log("[mmrc] (For full local mode: `mmrc engine install` or `mmrc engine build`)\n");
374
+ } else {
375
+ console.log(`[mmrc] Starting local engine: ${resolution.path} (${resolution.source})`);
376
+ const { spawn: spawnProcess } = __require("child_process");
377
+ engineProcess = spawnProcess(resolution.path, [], {
378
+ stdio: ["ignore", "pipe", "pipe"],
379
+ env: {
380
+ ...process.env,
381
+ DATABASE_URL: `sqlite://${process.cwd()}/dev.db`,
382
+ JWT_SECRET: "dev-secret-mmrc-local",
383
+ PORT: String(apiPort),
384
+ RUST_LOG: "mm_api=info,mm_storage=info"
388
385
  }
389
386
  });
390
- }
391
- if (engineProcess.stderr) {
392
- engineProcess.stderr.on("data", (data) => {
393
- for (const line of data.toString().split("\n").filter(Boolean)) {
394
- console.error(` [engine] ${line}`);
395
- }
387
+ if (engineProcess.stdout) {
388
+ engineProcess.stdout.on("data", (data) => {
389
+ for (const line of data.toString().split("\n").filter(Boolean)) {
390
+ console.log(` [engine] ${line}`);
391
+ }
392
+ });
393
+ }
394
+ if (engineProcess.stderr) {
395
+ engineProcess.stderr.on("data", (data) => {
396
+ for (const line of data.toString().split("\n").filter(Boolean)) {
397
+ console.error(` [engine] ${line}`);
398
+ }
399
+ });
400
+ }
401
+ engineProcess.on("error", (err) => {
402
+ console.error(`[mmrc] Engine failed to start: ${err.message}`);
403
+ process.exit(1);
396
404
  });
397
- }
398
- engineProcess.on("error", (err) => {
399
- console.error(`[mmrc] Engine failed to start: ${err.message}`);
400
- process.exit(1);
401
- });
402
- const healthUrl = `http://localhost:${apiPort}/health`;
403
- let healthy = false;
404
- for (let i = 0; i < 30; i++) {
405
- try {
406
- const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
407
- if (res.ok) {
408
- healthy = true;
409
- break;
405
+ const healthUrl = `http://localhost:${apiPort}/health`;
406
+ let healthy = false;
407
+ for (let i = 0; i < 30; i++) {
408
+ try {
409
+ const res = await fetch(healthUrl, { signal: AbortSignal.timeout(500) });
410
+ if (res.ok) {
411
+ healthy = true;
412
+ break;
413
+ }
414
+ } catch {
410
415
  }
411
- } catch {
416
+ await new Promise((r) => setTimeout(r, 500));
412
417
  }
413
- await new Promise((r) => setTimeout(r, 500));
414
- }
415
- if (!healthy) {
416
- console.error("[mmrc] Engine failed to become healthy within 15s.");
417
- engineProcess.kill();
418
- process.exit(1);
418
+ if (!healthy) {
419
+ console.error("[mmrc] Engine failed to become healthy within 15s.");
420
+ engineProcess.kill();
421
+ process.exit(1);
422
+ }
423
+ console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
419
424
  }
420
- console.log(`[mmrc] Engine healthy at http://localhost:${apiPort}`);
421
425
  }
422
- const apiUrl = isLocal ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl;
426
+ const apiUrl = engineProcess ? `http://localhost:${apiPort}/api/v1` : explicitApiUrl || "auto";
423
427
  const { createDevServer } = await import("../dev-server.mjs");
424
428
  const server = await createDevServer({
425
429
  port,
@@ -560,7 +564,7 @@ async function main() {
560
564
  console.error('[mmrc] Error: name is required\n Usage: mmrc init <name> [--description "..."] [--icon "..."] [--author "..."]');
561
565
  process.exit(1);
562
566
  }
563
- const { init } = await import("../init-2CRSUGV5.mjs");
567
+ const { init } = await import("../init-DY6SJDRX.mjs");
564
568
  await init({
565
569
  name,
566
570
  description: getFlag("--description"),
@@ -701,7 +705,7 @@ async function main() {
701
705
  healthCheck,
702
706
  readMetadata,
703
707
  MANAGED_BINARY_PATH: _MANAGED_BINARY_PATH
704
- } = await import("../engine-binary-QQUDACBJ.mjs");
708
+ } = await import("../engine-binary-FKTZAR56.mjs");
705
709
  if (subcommand === "status") {
706
710
  const status = await getEngineStatus(getFlag("--binary"));
707
711
  const plat = detectPlatform();
@@ -12289,10 +12289,10 @@ async function createDevServer(options = {}) {
12289
12289
  }
12290
12290
  const {
12291
12291
  port = 5199,
12292
- src = "src/workflows",
12292
+ src = ".",
12293
12293
  mode = "infer",
12294
- include = ["**/*.workflow.tsx"],
12295
- outDir = "dist/workflows",
12294
+ include = ["models/**/*.ts", "app/**/*.tsx", "**/*.workflow.tsx"],
12295
+ outDir = "dist",
12296
12296
  seed = false,
12297
12297
  apiUrl: rawApiUrl = "auto",
12298
12298
  authToken: explicitToken,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createDevServer
3
- } from "./chunk-UBDNXVL2.mjs";
3
+ } from "./chunk-NUPJYPFU.mjs";
4
4
  import "./chunk-BZEXUPDH.mjs";
5
5
  import "./chunk-DNWDIPH2.mjs";
6
6
  import "./chunk-5M7DKKBC.mjs";