create-mercato-app 0.6.3-develop.3881.1.0b590ac4eb → 0.6.3-develop.3901.1.ddad60693a

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mercato-app",
3
- "version": "0.6.3-develop.3881.1.0b590ac4eb",
3
+ "version": "0.6.3-develop.3901.1.ddad60693a",
4
4
  "type": "module",
5
5
  "description": "Create a new Open Mercato application",
6
6
  "main": "./dist/index.js",
@@ -1434,6 +1434,28 @@ function classifyWatchLine(line) {
1434
1434
  progressLabel: 'Watching structural module files',
1435
1435
  }
1436
1436
  }
1437
+ if (line.startsWith('[generate:watch] Regenerating')) {
1438
+ return {
1439
+ type: 'status',
1440
+ message: '♻️ Structural change detected; regenerating generated files',
1441
+ splashPhase: startupSplashPhase,
1442
+ splashDetail: 'Regenerating generated files',
1443
+ activity: 'Regenerating generated files',
1444
+ progressCurrent: 2,
1445
+ progressLabel: 'Watching structural module files',
1446
+ }
1447
+ }
1448
+ if (line === '[generate:watch] Generators completed.') {
1449
+ return {
1450
+ type: 'status',
1451
+ message: '♻️ Generated files refreshed',
1452
+ splashPhase: startupSplashPhase,
1453
+ splashDetail: 'Generated files refreshed',
1454
+ activity: 'Generated files refreshed',
1455
+ progressCurrent: 2,
1456
+ progressLabel: 'Watching structural module files',
1457
+ }
1458
+ }
1437
1459
  if (line.startsWith('[generate:watch]')) {
1438
1460
  return {
1439
1461
  type: 'status',
@@ -1473,6 +1495,9 @@ function classifyWatchLine(line) {
1473
1495
  }
1474
1496
 
1475
1497
  function classifyServerLine(line) {
1498
+ if (line.startsWith('[generate:watch]')) {
1499
+ return classifyWatchLine(line)
1500
+ }
1476
1501
  if (line.startsWith('🚀 Running server:dev')) {
1477
1502
  return {
1478
1503
  type: 'status',
@@ -1672,6 +1697,18 @@ function startFilteredChild(args, label, classifyLine) {
1672
1697
  return child
1673
1698
  }
1674
1699
 
1700
+ function resolveGenerateWatchMode(env) {
1701
+ const raw = env.OM_DEV_GENERATE_WATCH_MODE
1702
+ if (typeof raw !== 'string') return 'in-process'
1703
+ const normalized = raw.trim().toLowerCase()
1704
+ if (normalized === 'legacy' || normalized === 'sidecar' || normalized === 'out-of-process') {
1705
+ return 'legacy'
1706
+ }
1707
+ return 'in-process'
1708
+ }
1709
+
1710
+ const generateWatchMode = resolveGenerateWatchMode(process.env)
1711
+
1675
1712
  async function runClassicRuntime() {
1676
1713
  const initialGenerate = spawnMercato(['generate'])
1677
1714
  const initialGenerateResult = await waitForExit(initialGenerate)
@@ -1684,12 +1721,19 @@ async function runClassicRuntime() {
1684
1721
  shutdown(initialGenerateExitCode)
1685
1722
  }
1686
1723
 
1687
- const watch = spawnMercato(['generate', 'watch', '--skip-initial'])
1724
+ // Default ('in-process'): `mercato server dev` runs the structural
1725
+ // regeneration watcher in-process. Set OM_DEV_GENERATE_WATCH_MODE=legacy
1726
+ // to fall back to spawning the dedicated sidecar Node process.
1727
+ const watchers = []
1728
+ if (generateWatchMode === 'legacy') {
1729
+ watchers.push(['Generator watch (legacy sidecar)', spawnMercato(['generate', 'watch', '--skip-initial'])])
1730
+ }
1688
1731
  const server = spawnMercato(['server', 'dev'])
1689
- const result = await Promise.race([
1690
- waitForExit(watch, 'Generator watch'),
1732
+ const waiters = [
1691
1733
  waitForExit(server, 'App runtime'),
1692
- ])
1734
+ ...watchers.map(([label, child]) => waitForExit(child, label)),
1735
+ ]
1736
+ const result = await Promise.race(waiters)
1693
1737
  if (isGracefulShutdownResult(result)) {
1694
1738
  return
1695
1739
  }
@@ -1707,13 +1751,16 @@ installLogToggle()
1707
1751
  initializeRuntimeSummary()
1708
1752
  printRuntimePackagesSummary()
1709
1753
 
1710
- const watch = startFilteredChild(['generate', 'watch', '--skip-initial'], 'Generator watch', classifyWatchLine)
1754
+ const sidecarWatch = generateWatchMode === 'legacy'
1755
+ ? startFilteredChild(['generate', 'watch', '--skip-initial'], 'Generator watch (legacy sidecar)', classifyWatchLine)
1756
+ : null
1711
1757
  const server = startFilteredChild(['server', 'dev'], 'App runtime', classifyServerLine)
1712
1758
 
1713
- const result = await Promise.race([
1714
- waitForExit(watch, 'Generator watch'),
1715
- waitForExit(server, 'App runtime'),
1716
- ])
1759
+ const waiters = [waitForExit(server, 'App runtime')]
1760
+ if (sidecarWatch) {
1761
+ waiters.push(waitForExit(sidecarWatch, 'Generator watch (legacy sidecar)'))
1762
+ }
1763
+ const result = await Promise.race(waiters)
1717
1764
  if (!isGracefulShutdownResult(result)) {
1718
1765
  reportUnexpectedChildExit(result)
1719
1766
  shutdown(resolveUnexpectedExitCode(result))