@holo-js/cli 0.1.8 → 0.2.0

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 (46) hide show
  1. package/dist/bin/holo.mjs +167 -81
  2. package/dist/broadcast-WI6PJS5P.mjs +203 -0
  3. package/dist/broadcast-YWS4N5QU.mjs +203 -0
  4. package/dist/{cache-JGGCYQQG.mjs → cache-KWNQECAA.mjs} +6 -6
  5. package/dist/cache-QARFSW4F.mjs +66 -0
  6. package/dist/{cache-migrations-3V7LI4CC.mjs → cache-migrations-3OXR4FN5.mjs} +50 -30
  7. package/dist/cache-migrations-MDFMDVTK.mjs +173 -0
  8. package/dist/{chunk-O6AXHL7Z.mjs → chunk-2DKQKZML.mjs} +230 -126
  9. package/dist/{chunk-D4NXGVV4.mjs → chunk-2RGJTPYF.mjs} +36 -25
  10. package/dist/{chunk-2NUEWM2P.mjs → chunk-EWYXSN2C.mjs} +82 -119
  11. package/dist/{chunk-F4MT6GBK.mjs → chunk-FGQ2I2YH.mjs} +1 -1
  12. package/dist/chunk-I7QBCEV7.mjs +33 -0
  13. package/dist/{chunk-R6BWRY3E.mjs → chunk-ILU426CF.mjs} +3 -1
  14. package/dist/{chunk-QIOHKKXP.mjs → chunk-IUDD5FYL.mjs} +28 -273
  15. package/dist/{chunk-SABHUOON.mjs → chunk-KWRIBHC3.mjs} +229 -142
  16. package/dist/{chunk-57SJ566R.mjs → chunk-LBJAJLKU.mjs} +1 -1
  17. package/dist/{chunk-BAFQ2GOA.mjs → chunk-LXGQCG56.mjs} +1 -1
  18. package/dist/{chunk-DFKX4YT4.mjs → chunk-ONKESAQA.mjs} +2 -2
  19. package/dist/chunk-QA7TP5EO.mjs +448 -0
  20. package/dist/chunk-UPZH6KCF.mjs +3306 -0
  21. package/dist/{chunk-5EU32E7X.mjs → chunk-VRGB6DIS.mjs} +116 -12
  22. package/dist/{config-K7SBKT2C.mjs → config-TWEO2R4N.mjs} +3 -3
  23. package/dist/{dev-RZLZX75U.mjs → dev-2OULECTU.mjs} +7 -7
  24. package/dist/dev-PJMEGTAC.mjs +42 -0
  25. package/dist/{discovery-SFRDA4VX.mjs → discovery-7FXND7Y6.mjs} +3 -3
  26. package/dist/{generators-UJA6WP7J.mjs → generators-4BP7B47W.mjs} +11 -34
  27. package/dist/generators-Z4XLSMC7.mjs +520 -0
  28. package/dist/index.mjs +169 -83
  29. package/dist/{media-migrations-76KFHA2U.mjs → media-migrations-BFEL7NFG.mjs} +9 -20
  30. package/dist/media-migrations-VR7DLLR6.mjs +106 -0
  31. package/dist/{queue-JGVKSPUM.mjs → queue-SVOJPTRO.mjs} +10 -10
  32. package/dist/queue-YCBQTCYI.mjs +625 -0
  33. package/dist/{queue-migrations-3TYOTL45.mjs → queue-migrations-HPXOO3NA.mjs} +13 -12
  34. package/dist/queue-migrations-X4P7FZKJ.mjs +167 -0
  35. package/dist/{runtime-4AAMJI34.mjs → runtime-CPKR663Y.mjs} +9 -9
  36. package/dist/runtime-GIE56H47.mjs +57 -0
  37. package/dist/{runtime-ZKD6URAV.mjs → runtime-GSXF4NB3.mjs} +1 -1
  38. package/dist/runtime-worker.d.ts +2 -0
  39. package/dist/runtime-worker.mjs +242 -0
  40. package/dist/{scaffold-TMP7PWOA.mjs → scaffold-3QPGYQEQ.mjs} +9 -5
  41. package/dist/scaffold-RGAAHC6I.mjs +139 -0
  42. package/dist/{security-ILU74RIZ.mjs → security-7H5TNHZY.mjs} +6 -6
  43. package/dist/security-BZGD6ONY.mjs +71 -0
  44. package/package.json +9 -7
  45. package/dist/broadcast-3VPGBNCR.mjs +0 -84
  46. package/dist/chunk-ZXDU7RHU.mjs +0 -9
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  loadGeneratedProjectRegistry,
3
3
  writeGeneratedProjectRegistry
4
- } from "./chunk-O6AXHL7Z.mjs";
4
+ } from "./chunk-2DKQKZML.mjs";
5
5
  import {
6
6
  COMMAND_FILE_PATTERN,
7
7
  MIGRATION_NAME_PATTERN,
@@ -17,7 +17,7 @@ import {
17
17
  pathExists,
18
18
  readTextFile,
19
19
  toPosixPath
20
- } from "./chunk-R6BWRY3E.mjs";
20
+ } from "./chunk-ILU426CF.mjs";
21
21
 
22
22
  // src/project/discovery.ts
23
23
  import { resolve as resolve2 } from "path";
@@ -55,37 +55,25 @@ function deriveJobNameFromPath(jobsRoot, sourcePath) {
55
55
  const relativePath = toPosixPath(relative(jobsRoot, sourcePath));
56
56
  return relativePath.replace(COMMAND_FILE_PATTERN, "").split("/").filter(Boolean).join(".");
57
57
  }
58
- function deriveEventNameFromPath(eventsRoot, sourcePath) {
59
- const relativePath = toPosixPath(relative(eventsRoot, sourcePath)).replace(COMMAND_FILE_PATTERN, "");
58
+ function deriveDottedNameFromPath(root, sourcePath, emptyMessage) {
59
+ const relativePath = toPosixPath(relative(root, sourcePath)).replace(COMMAND_FILE_PATTERN, "");
60
60
  const derived = relativePath.split("/").map((part) => part.trim()).filter(Boolean).join(".");
61
61
  if (!derived) {
62
- throw new Error("[Holo Events] Derived event names require a non-empty source path.");
62
+ throw new Error(emptyMessage);
63
63
  }
64
64
  return derived;
65
65
  }
66
+ function deriveEventNameFromPath(eventsRoot, sourcePath) {
67
+ return deriveDottedNameFromPath(eventsRoot, sourcePath, "[Holo Events] Derived event names require a non-empty source path.");
68
+ }
66
69
  function deriveListenerIdFromPath(listenersRoot, sourcePath) {
67
- const relativePath = toPosixPath(relative(listenersRoot, sourcePath));
68
- const derived = relativePath.replace(COMMAND_FILE_PATTERN, "").split("/").map((part) => part.trim()).filter(Boolean).join(".");
69
- if (!derived) {
70
- throw new Error("[Holo Events] Derived listener identifiers require a non-empty source path.");
71
- }
72
- return derived;
70
+ return deriveDottedNameFromPath(listenersRoot, sourcePath, "[Holo Events] Derived listener identifiers require a non-empty source path.");
73
71
  }
74
72
  function deriveBroadcastNameFromPath(root, sourcePath) {
75
- const relativePath = toPosixPath(relative(root, sourcePath)).replace(COMMAND_FILE_PATTERN, "");
76
- const derived = relativePath.split("/").map((part) => part.trim()).filter(Boolean).join(".");
77
- if (!derived) {
78
- throw new Error("[Holo Broadcast] Derived broadcast names require a non-empty source path.");
79
- }
80
- return derived;
73
+ return deriveDottedNameFromPath(root, sourcePath, "[Holo Broadcast] Derived broadcast names require a non-empty source path.");
81
74
  }
82
75
  function deriveChannelPatternFromPath(root, sourcePath) {
83
- const relativePath = toPosixPath(relative(root, sourcePath)).replace(COMMAND_FILE_PATTERN, "");
84
- const derived = relativePath.split("/").map((part) => part.trim()).filter(Boolean).join(".");
85
- if (!derived) {
86
- throw new Error("[Holo Broadcast] Derived channel patterns require a non-empty source path.");
87
- }
88
- return derived;
76
+ return deriveDottedNameFromPath(root, sourcePath, "[Holo Broadcast] Derived channel patterns require a non-empty source path.");
89
77
  }
90
78
  function resolveDiscoveredJobMetadata(job, sourcePath, derivedName, queueConfig) {
91
79
  const connection = job.connection ?? queueConfig.default;
@@ -356,6 +344,28 @@ function validateMigrationName(name, message) {
356
344
  }
357
345
 
358
346
  // src/project/discovery.ts
347
+ function resolveBroadcastExportEntry(moduleValue, discovery) {
348
+ if (!moduleValue || typeof moduleValue !== "object") {
349
+ return void 0;
350
+ }
351
+ const entries = Object.entries(moduleValue);
352
+ const orderedEntries = "default" in moduleValue ? [
353
+ ["default", moduleValue.default],
354
+ ...entries.filter(([exportName]) => exportName !== "default")
355
+ ] : entries;
356
+ for (const [exportName, value] of orderedEntries) {
357
+ if (discovery.isBroadcastDefinition(value)) {
358
+ return { exportName, value };
359
+ }
360
+ if (typeof value === "function") {
361
+ const resolved = value(...Array.from({ length: value.length }, () => "__holo_discovery__"));
362
+ if (discovery.isBroadcastDefinition(resolved)) {
363
+ return { exportName, value: resolved };
364
+ }
365
+ }
366
+ }
367
+ return void 0;
368
+ }
359
369
  async function prepareProjectDiscovery(projectRoot, config = normalizeHoloProjectConfig()) {
360
370
  const loadedConfig = await loadConfigDirectory(projectRoot, {
361
371
  processEnv: process.env
@@ -565,9 +575,9 @@ async function prepareProjectDiscovery(projectRoot, config = normalizeHoloProjec
565
575
  const broadcast = [];
566
576
  for (const filePath of broadcastFiles) {
567
577
  const relativePath = makeProjectRelativePath(projectRoot, filePath);
568
- const exportedBroadcast = resolveNamedExportEntry(
578
+ const exportedBroadcast = resolveBroadcastExportEntry(
569
579
  await importProjectModule(projectRoot, filePath),
570
- (value) => broadcastDiscovery.isBroadcastDefinition(value)
580
+ broadcastDiscovery
571
581
  );
572
582
  if (!exportedBroadcast) {
573
583
  throw new Error(`Discovered broadcast "${relativePath}" does not export a Holo broadcast definition.`);
@@ -601,6 +611,7 @@ async function prepareProjectDiscovery(projectRoot, config = normalizeHoloProjec
601
611
  sourcePath: relativePath,
602
612
  pattern,
603
613
  exportName: exportedChannel.exportName,
614
+ ...typeof normalizedChannel.guard === "string" ? { guard: normalizedChannel.guard } : {},
604
615
  type: normalizedChannel.type,
605
616
  params: broadcastDiscovery.broadcastInternals.extractChannelPatternParamNames(pattern),
606
617
  whispers: Object.freeze(Object.keys(normalizedChannel.whispers))
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  prepareProjectDiscovery
3
- } from "./chunk-D4NXGVV4.mjs";
3
+ } from "./chunk-2RGJTPYF.mjs";
4
4
  import {
5
5
  syncManagedDriverDependencies
6
- } from "./chunk-SABHUOON.mjs";
6
+ } from "./chunk-UPZH6KCF.mjs";
7
7
  import {
8
8
  ensureGeneratedSchemaPlaceholder,
9
9
  ensureProjectConfig
10
- } from "./chunk-DFKX4YT4.mjs";
10
+ } from "./chunk-ONKESAQA.mjs";
11
11
  import {
12
12
  renderFrameworkRunner
13
- } from "./chunk-O6AXHL7Z.mjs";
13
+ } from "./chunk-2DKQKZML.mjs";
14
14
  import {
15
15
  readTextFile,
16
16
  writeTextFile
17
- } from "./chunk-R6BWRY3E.mjs";
17
+ } from "./chunk-ILU426CF.mjs";
18
18
 
19
19
  // src/dev.ts
20
20
  import { spawnSync, spawn } from "child_process";
@@ -105,22 +105,52 @@ async function runProjectDependencyInstall(io, projectRoot, spawn2 = spawnSync)
105
105
  throw new Error(result.stderr?.trim() || result.stdout?.trim() || "Project dependency installation failed.");
106
106
  }
107
107
  }
108
- async function runProjectPrepare(projectRoot, io) {
108
+ var FRAMEWORK_SYNC_DEFINITIONS = [
109
+ {
110
+ framework: "nuxt",
111
+ commands: {
112
+ bun: ["bun", "x", "nuxt", "prepare"],
113
+ npm: ["npm", "exec", "--", "nuxt", "prepare"],
114
+ pnpm: ["pnpm", "exec", "nuxt", "prepare"],
115
+ yarn: ["yarn", "run", "nuxt", "prepare"]
116
+ },
117
+ errorLabel: "nuxt prepare"
118
+ },
119
+ {
120
+ framework: "sveltekit",
121
+ commands: {
122
+ bun: ["bun", "x", "svelte-kit", "sync"],
123
+ npm: ["npm", "exec", "--", "svelte-kit", "sync"],
124
+ pnpm: ["pnpm", "exec", "svelte-kit", "sync"],
125
+ yarn: ["yarn", "run", "svelte-kit", "sync"]
126
+ },
127
+ errorLabel: "svelte-kit sync"
128
+ }
129
+ ];
130
+ async function runProjectPrepare(projectRoot, io, options = {}) {
109
131
  const project = await ensureProjectConfig(projectRoot);
110
132
  await ensureGeneratedSchemaPlaceholder(projectRoot, project.config);
111
133
  await prepareProjectDiscovery(projectRoot, project.config);
112
134
  await refreshFrameworkRunner(projectRoot);
113
- await runNuxtPrepare(projectRoot);
114
- await runSvelteKitSync(projectRoot);
135
+ const syncFramework = options.syncFramework ?? true;
136
+ if (syncFramework) {
137
+ await runFrameworkSync(projectRoot, FRAMEWORK_SYNC_DEFINITIONS[0]);
138
+ await runFrameworkSync(projectRoot, FRAMEWORK_SYNC_DEFINITIONS[1]);
139
+ }
115
140
  const updatedDependencies = await syncManagedDriverDependencies(projectRoot);
116
141
  if (updatedDependencies && io) {
117
142
  await runProjectDependencyInstall(io, projectRoot);
118
143
  await prepareProjectDiscovery(projectRoot, project.config);
119
144
  await refreshFrameworkRunner(projectRoot);
120
- await runNuxtPrepare(projectRoot);
121
- await runSvelteKitSync(projectRoot);
145
+ if (syncFramework) {
146
+ await runFrameworkSync(projectRoot, FRAMEWORK_SYNC_DEFINITIONS[0]);
147
+ await runFrameworkSync(projectRoot, FRAMEWORK_SYNC_DEFINITIONS[1]);
148
+ }
122
149
  }
123
150
  }
151
+ async function runProjectHotPrepare(projectRoot, io) {
152
+ await runProjectPrepare(projectRoot, io, { syncFramework: false });
153
+ }
124
154
  async function refreshFrameworkRunner(projectRoot) {
125
155
  const frameworkProjectPath = resolve(projectRoot, ".holo-js/framework/project.json");
126
156
  const frameworkRunnerPath = resolve(projectRoot, ".holo-js/framework/run.mjs");
@@ -137,42 +167,23 @@ async function refreshFrameworkRunner(projectRoot) {
137
167
  }
138
168
  await writeTextFile(frameworkRunnerPath, renderFrameworkRunner({ framework }));
139
169
  }
140
- async function runNuxtPrepare(projectRoot) {
170
+ async function runFrameworkSync(projectRoot, definition) {
141
171
  const frameworkProjectPath = resolve(projectRoot, ".holo-js/framework/project.json");
142
172
  try {
143
173
  const content = await readFile(frameworkProjectPath, "utf8");
144
174
  const manifest = JSON.parse(content);
145
- if (manifest.framework !== "nuxt") {
175
+ if (manifest.framework !== definition.framework) {
146
176
  return;
147
177
  }
148
178
  } catch {
149
179
  return;
150
180
  }
151
181
  const manager = await resolveProjectPackageManager(projectRoot);
152
- let command;
153
- let args;
154
- switch (manager) {
155
- case "npm":
156
- command = "npm";
157
- args = ["exec", "--", "nuxt", "prepare"];
158
- break;
159
- case "pnpm":
160
- command = "pnpm";
161
- args = ["exec", "nuxt", "prepare"];
162
- break;
163
- case "yarn":
164
- command = "yarn";
165
- args = ["run", "nuxt", "prepare"];
166
- break;
167
- case "bun":
168
- default:
169
- command = "bun";
170
- args = ["x", "nuxt", "prepare"];
171
- break;
172
- }
173
- const { spawn: spawn2 } = await import("child_process");
182
+ const invocation = definition.commands[manager];
183
+ const command = invocation[0];
184
+ const args = invocation.slice(1);
174
185
  await new Promise((resolve2, reject) => {
175
- const child = spawn2(command, args, {
186
+ const child = spawn(command, args, {
176
187
  cwd: projectRoot,
177
188
  stdio: "inherit"
178
189
  });
@@ -180,56 +191,7 @@ async function runNuxtPrepare(projectRoot) {
180
191
  if (code === 0) {
181
192
  resolve2(void 0);
182
193
  } else {
183
- reject(new Error(`nuxt prepare exited with ${code}`));
184
- }
185
- });
186
- child.on("error", reject);
187
- });
188
- }
189
- async function runSvelteKitSync(projectRoot) {
190
- const frameworkProjectPath = resolve(projectRoot, ".holo-js/framework/project.json");
191
- try {
192
- const content = await readFile(frameworkProjectPath, "utf8");
193
- const manifest = JSON.parse(content);
194
- if (manifest.framework !== "sveltekit") {
195
- return;
196
- }
197
- } catch {
198
- return;
199
- }
200
- const manager = await resolveProjectPackageManager(projectRoot);
201
- let command;
202
- let args;
203
- switch (manager) {
204
- case "npm":
205
- command = "npm";
206
- args = ["exec", "--", "svelte-kit", "sync"];
207
- break;
208
- case "pnpm":
209
- command = "pnpm";
210
- args = ["exec", "svelte-kit", "sync"];
211
- break;
212
- case "yarn":
213
- command = "yarn";
214
- args = ["run", "svelte-kit", "sync"];
215
- break;
216
- case "bun":
217
- default:
218
- command = "bun";
219
- args = ["x", "svelte-kit", "sync"];
220
- break;
221
- }
222
- const { spawn: spawn2 } = await import("child_process");
223
- await new Promise((resolve2, reject) => {
224
- const child = spawn2(command, args, {
225
- cwd: projectRoot,
226
- stdio: "inherit"
227
- });
228
- child.on("close", (code) => {
229
- if (code === 0) {
230
- resolve2(void 0);
231
- } else {
232
- reject(new Error(`svelte-kit sync exited with ${code}`));
194
+ reject(new Error(`${definition.errorLabel} exited with ${code}`));
233
195
  }
234
196
  });
235
197
  child.on("error", reject);
@@ -238,6 +200,13 @@ async function runSvelteKitSync(projectRoot) {
238
200
  function toPosixSlashes(value) {
239
201
  return value.replaceAll("\\", "/");
240
202
  }
203
+ var PACKAGE_MANIFEST_DISCOVERY_PATHS = /* @__PURE__ */ new Set([
204
+ "package.json",
205
+ "bun.lock",
206
+ "package-lock.json",
207
+ "pnpm-lock.yaml",
208
+ "yarn.lock"
209
+ ]);
241
210
  function resolveConfiguredBroadcastPath(project) {
242
211
  const configuredPaths = project.config.paths;
243
212
  return configuredPaths.broadcast ?? "server/broadcast";
@@ -246,20 +215,14 @@ function resolveConfiguredChannelsPath(project) {
246
215
  const configuredPaths = project.config.paths;
247
216
  return configuredPaths.channels ?? "server/channels";
248
217
  }
249
- function isDiscoveryRelevantPath(filePath, project) {
250
- const normalized = toPosixSlashes(filePath);
251
- const generatedSchemaPath = toPosixSlashes(project.config.paths.generatedSchema ?? ".holo-js/generated/schema.generated.ts");
252
- if (normalized === generatedSchemaPath) {
253
- return true;
254
- }
255
- if (normalized === ".holo-js/generated" || normalized.startsWith(".holo-js/generated/")) {
256
- return false;
257
- }
218
+ function resolveConfiguredRealtimePath(project) {
219
+ const configuredPaths = project.config.paths;
220
+ return configuredPaths.realtime ?? "server/realtime";
221
+ }
222
+ function resolveConfiguredDiscoveryRoots(project) {
258
223
  const authorizationPoliciesPath = project.config.paths.authorizationPolicies || "server/policies";
259
224
  const authorizationAbilitiesPath = project.config.paths.authorizationAbilities || "server/abilities";
260
- const broadcastPath = resolveConfiguredBroadcastPath(project);
261
- const channelsPath = resolveConfiguredChannelsPath(project);
262
- const roots = [
225
+ return [
263
226
  project.config.paths.models,
264
227
  project.config.paths.migrations,
265
228
  project.config.paths.seeders,
@@ -269,14 +232,28 @@ function isDiscoveryRelevantPath(filePath, project) {
269
232
  project.config.paths.listeners,
270
233
  authorizationPoliciesPath,
271
234
  authorizationAbilitiesPath,
272
- broadcastPath,
273
- channelsPath,
235
+ resolveConfiguredBroadcastPath(project),
236
+ resolveConfiguredChannelsPath(project),
237
+ resolveConfiguredRealtimePath(project),
274
238
  "config"
275
239
  ];
240
+ }
241
+ function isDiscoveryRelevantPath(filePath, project) {
242
+ const normalized = toPosixSlashes(filePath);
243
+ if (PACKAGE_MANIFEST_DISCOVERY_PATHS.has(normalized)) {
244
+ return true;
245
+ }
246
+ const generatedSchemaPath = toPosixSlashes(project.config.paths.generatedSchema ?? ".holo-js/generated/schema.generated.ts");
247
+ if (normalized === generatedSchemaPath) {
248
+ return true;
249
+ }
250
+ if (normalized === ".holo-js/generated" || normalized.startsWith(".holo-js/generated/")) {
251
+ return false;
252
+ }
276
253
  if (normalized === ".env" || normalized.startsWith(".env.")) {
277
254
  return true;
278
255
  }
279
- return roots.some((root) => normalized === root || normalized.startsWith(`${toPosixSlashes(root)}/`));
256
+ return resolveConfiguredDiscoveryRoots(project).some((root) => normalized === root || normalized.startsWith(`${toPosixSlashes(root)}/`));
280
257
  }
281
258
  function isRecursiveWatchUnsupported(error) {
282
259
  return error instanceof Error && (error.message.includes("recursive") || "code" in error && error.code === "ERR_FEATURE_UNAVAILABLE_ON_PLATFORM");
@@ -300,24 +277,9 @@ async function collectDirectoryTree(rootPath, directories) {
300
277
  }
301
278
  async function collectDiscoveryWatchRoots(projectRoot, project) {
302
279
  const directories = /* @__PURE__ */ new Set();
303
- const authorizationPoliciesPath = project.config.paths.authorizationPolicies || "server/policies";
304
- const authorizationAbilitiesPath = project.config.paths.authorizationAbilities || "server/abilities";
305
- const broadcastPath = resolveConfiguredBroadcastPath(project);
306
- const channelsPath = resolveConfiguredChannelsPath(project);
307
280
  const roots = [
308
281
  projectRoot,
309
- resolve(projectRoot, "config"),
310
- resolve(projectRoot, project.config.paths.models),
311
- resolve(projectRoot, project.config.paths.migrations),
312
- resolve(projectRoot, project.config.paths.seeders),
313
- resolve(projectRoot, project.config.paths.commands),
314
- resolve(projectRoot, project.config.paths.jobs),
315
- resolve(projectRoot, project.config.paths.events),
316
- resolve(projectRoot, project.config.paths.listeners),
317
- resolve(projectRoot, authorizationPoliciesPath),
318
- resolve(projectRoot, authorizationAbilitiesPath),
319
- resolve(projectRoot, broadcastPath),
320
- resolve(projectRoot, channelsPath),
282
+ ...resolveConfiguredDiscoveryRoots(project).map((root) => resolve(projectRoot, root)),
321
283
  resolve(projectRoot, dirname(project.config.paths.generatedSchema ?? ".holo-js/generated/schema.generated.ts"))
322
284
  ];
323
285
  for (const rootPath of roots) {
@@ -332,12 +294,13 @@ async function runProjectDevServer(io, projectRoot, spawnProcess = spawn, create
332
294
  let project = await ensureProjectConfig(projectRoot);
333
295
  let refreshNonRecursiveWatchers;
334
296
  let requestChildRestart;
335
- const prepareDiscovery = async () => {
336
- await prepare(projectRoot, io);
297
+ const hotPrepare = prepare === runProjectPrepare ? runProjectHotPrepare : prepare;
298
+ const prepareDiscovery = async (syncFramework = false) => {
299
+ await (syncFramework ? prepare : hotPrepare)(projectRoot, io);
337
300
  project = await ensureProjectConfig(projectRoot);
338
301
  await refreshNonRecursiveWatchers?.();
339
302
  };
340
- await prepareDiscovery();
303
+ await prepareDiscovery(true);
341
304
  let pendingPrepare;
342
305
  let queued = false;
343
306
  let shuttingDown = false;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  readTextFile
3
- } from "./chunk-R6BWRY3E.mjs";
3
+ } from "./chunk-ILU426CF.mjs";
4
4
 
5
5
  // src/package-json.ts
6
6
  import { join } from "path";
@@ -0,0 +1,33 @@
1
+ // src/io.ts
2
+ import { spinner } from "@clack/prompts";
3
+ function writeLine(stream, message = "") {
4
+ stream.write(`${message}
5
+ `);
6
+ }
7
+ async function runWithSpinner(io, message, task, successMessage = message) {
8
+ if (!supportsSpinner(io)) {
9
+ return task();
10
+ }
11
+ const loading = spinner({
12
+ input: io.stdin,
13
+ output: io.stdout
14
+ });
15
+ loading.start(message);
16
+ try {
17
+ const result = await task();
18
+ loading.stop(successMessage);
19
+ return result;
20
+ } catch (error) {
21
+ loading.error("Command failed.");
22
+ throw error;
23
+ }
24
+ }
25
+ function supportsSpinner(io) {
26
+ return io.stdin.isTTY === true && io.stdout.isTTY === true && typeof io.stdin.setRawMode === "function";
27
+ }
28
+
29
+ export {
30
+ writeLine,
31
+ runWithSpinner,
32
+ supportsSpinner
33
+ };
@@ -145,6 +145,7 @@ var GENERATED_EVENTS_PATH = join(GENERATED_ROOT, "events.ts");
145
145
  var GENERATED_LISTENERS_PATH = join(GENERATED_ROOT, "listeners.ts");
146
146
  var GENERATED_BROADCAST_PATH = join(GENERATED_ROOT, "broadcast.ts");
147
147
  var GENERATED_CHANNELS_PATH = join(GENERATED_ROOT, "channels.ts");
148
+ var GENERATED_CHANNEL_IMPORTER_PATH = join(GENERATED_ROOT, "channel-importer.ts");
148
149
  var GENERATED_BROADCAST_MANIFEST_PATH = join(GENERATED_ROOT, "broadcast-manifest.ts");
149
150
  var GENERATED_AUTHORIZATION_ROOT = join(GENERATED_ROOT, "authorization");
150
151
  var GENERATED_AUTHORIZATION_REGISTRY_PATH = join(GENERATED_AUTHORIZATION_ROOT, "registry.ts");
@@ -162,7 +163,7 @@ var GENERATED_SVELTE_HOOKS_PATH = join(GENERATED_ROOT, "hooks.ts");
162
163
  var GENERATED_SVELTE_SERVER_HOOKS_PATH = join(GENERATED_ROOT, "hooks.server.ts");
163
164
  var CONFIG_EXTENSION_PRIORITY = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"];
164
165
  var SUPPORTED_CONFIG_EXTENSIONS = new Set(CONFIG_EXTENSION_PRIORITY);
165
- var SUPPORTED_SCAFFOLD_OPTIONAL_PACKAGES = ["storage", "events", "queue", "validation", "forms", "auth", "authorization", "notifications", "mail", "broadcast", "security", "cache"];
166
+ var SUPPORTED_SCAFFOLD_OPTIONAL_PACKAGES = ["storage", "events", "queue", "validation", "forms", "auth", "authorization", "notifications", "mail", "broadcast", "realtime", "security", "cache"];
166
167
  var SUPPORTED_QUEUE_INSTALLER_DRIVERS = ["sync", "redis", "database"];
167
168
  var SUPPORTED_CACHE_INSTALLER_DRIVERS = ["file", "redis", "database"];
168
169
  var HOLO_EVENT_DEFINITION_MARKER = /* @__PURE__ */ Symbol.for("holo-js.events.definition");
@@ -447,6 +448,7 @@ export {
447
448
  GENERATED_LISTENERS_PATH,
448
449
  GENERATED_BROADCAST_PATH,
449
450
  GENERATED_CHANNELS_PATH,
451
+ GENERATED_CHANNEL_IMPORTER_PATH,
450
452
  GENERATED_BROADCAST_MANIFEST_PATH,
451
453
  GENERATED_AUTHORIZATION_REGISTRY_PATH,
452
454
  GENERATED_AUTHORIZATION_TYPES_PATH,