@holo-js/cli 0.1.9 → 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.
- package/dist/bin/holo.mjs +165 -81
- package/dist/broadcast-WI6PJS5P.mjs +203 -0
- package/dist/broadcast-YWS4N5QU.mjs +203 -0
- package/dist/{cache-ETOIQ5IG.mjs → cache-KWNQECAA.mjs} +6 -6
- package/dist/cache-QARFSW4F.mjs +66 -0
- package/dist/{cache-migrations-2GGI4TJK.mjs → cache-migrations-3OXR4FN5.mjs} +50 -30
- package/dist/cache-migrations-MDFMDVTK.mjs +173 -0
- package/dist/{chunk-IMOGEKB4.mjs → chunk-2DKQKZML.mjs} +188 -106
- package/dist/{chunk-7JR73TOH.mjs → chunk-2RGJTPYF.mjs} +36 -25
- package/dist/{chunk-ASTSSSL2.mjs → chunk-EWYXSN2C.mjs} +75 -122
- package/dist/{chunk-F4MT6GBK.mjs → chunk-FGQ2I2YH.mjs} +1 -1
- package/dist/chunk-I7QBCEV7.mjs +33 -0
- package/dist/{chunk-R6BWRY3E.mjs → chunk-ILU426CF.mjs} +3 -1
- package/dist/{chunk-HB4Q7VYK.mjs → chunk-IUDD5FYL.mjs} +28 -273
- package/dist/{chunk-WRZFATUT.mjs → chunk-KWRIBHC3.mjs} +229 -142
- package/dist/{chunk-57SJ566R.mjs → chunk-LBJAJLKU.mjs} +1 -1
- package/dist/{chunk-BAFQ2GOA.mjs → chunk-LXGQCG56.mjs} +1 -1
- package/dist/{chunk-SRPGIWCF.mjs → chunk-ONKESAQA.mjs} +2 -2
- package/dist/chunk-QA7TP5EO.mjs +448 -0
- package/dist/chunk-UPZH6KCF.mjs +3306 -0
- package/dist/{chunk-5EU32E7X.mjs → chunk-VRGB6DIS.mjs} +116 -12
- package/dist/{config-ARLE6PKR.mjs → config-TWEO2R4N.mjs} +3 -3
- package/dist/{dev-6RG5SSZ7.mjs → dev-2OULECTU.mjs} +7 -7
- package/dist/dev-PJMEGTAC.mjs +42 -0
- package/dist/{discovery-FCVGQQVD.mjs → discovery-7FXND7Y6.mjs} +3 -3
- package/dist/{generators-UI2LJK3O.mjs → generators-4BP7B47W.mjs} +11 -34
- package/dist/generators-Z4XLSMC7.mjs +520 -0
- package/dist/index.mjs +167 -83
- package/dist/{media-migrations-JQSDCC7S.mjs → media-migrations-BFEL7NFG.mjs} +9 -20
- package/dist/media-migrations-VR7DLLR6.mjs +106 -0
- package/dist/{queue-BY3PLH4I.mjs → queue-SVOJPTRO.mjs} +10 -10
- package/dist/queue-YCBQTCYI.mjs +625 -0
- package/dist/{queue-migrations-YZUKEZK7.mjs → queue-migrations-HPXOO3NA.mjs} +13 -12
- package/dist/queue-migrations-X4P7FZKJ.mjs +167 -0
- package/dist/{runtime-BI343WHS.mjs → runtime-CPKR663Y.mjs} +9 -9
- package/dist/runtime-GIE56H47.mjs +57 -0
- package/dist/{runtime-ZKD6URAV.mjs → runtime-GSXF4NB3.mjs} +1 -1
- package/dist/runtime-worker.d.ts +2 -0
- package/dist/runtime-worker.mjs +242 -0
- package/dist/{scaffold-UBOS2NZR.mjs → scaffold-3QPGYQEQ.mjs} +9 -5
- package/dist/scaffold-RGAAHC6I.mjs +139 -0
- package/dist/{security-TYPVOYGF.mjs → security-7H5TNHZY.mjs} +6 -6
- package/dist/security-BZGD6ONY.mjs +71 -0
- package/package.json +9 -7
- package/dist/broadcast-VR46UZEL.mjs +0 -84
- package/dist/chunk-ZXDU7RHU.mjs +0 -9
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadGeneratedProjectRegistry,
|
|
3
3
|
writeGeneratedProjectRegistry
|
|
4
|
-
} from "./chunk-
|
|
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-
|
|
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
|
|
59
|
-
const relativePath = toPosixPath(relative(
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 =
|
|
578
|
+
const exportedBroadcast = resolveBroadcastExportEntry(
|
|
569
579
|
await importProjectModule(projectRoot, filePath),
|
|
570
|
-
|
|
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-
|
|
3
|
+
} from "./chunk-2RGJTPYF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
syncManagedDriverDependencies
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UPZH6KCF.mjs";
|
|
7
7
|
import {
|
|
8
8
|
ensureGeneratedSchemaPlaceholder,
|
|
9
9
|
ensureProjectConfig
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-ONKESAQA.mjs";
|
|
11
11
|
import {
|
|
12
12
|
renderFrameworkRunner
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-2DKQKZML.mjs";
|
|
14
14
|
import {
|
|
15
15
|
readTextFile,
|
|
16
16
|
writeTextFile
|
|
17
|
-
} from "./chunk-
|
|
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
|
-
|
|
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
|
-
|
|
114
|
-
|
|
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
|
-
|
|
121
|
-
|
|
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,91 +167,23 @@ async function refreshFrameworkRunner(projectRoot) {
|
|
|
137
167
|
}
|
|
138
168
|
await writeTextFile(frameworkRunnerPath, renderFrameworkRunner({ framework }));
|
|
139
169
|
}
|
|
140
|
-
async function
|
|
141
|
-
const frameworkProjectPath = resolve(projectRoot, ".holo-js/framework/project.json");
|
|
142
|
-
try {
|
|
143
|
-
const content = await readFile(frameworkProjectPath, "utf8");
|
|
144
|
-
const manifest = JSON.parse(content);
|
|
145
|
-
if (manifest.framework !== "nuxt") {
|
|
146
|
-
return;
|
|
147
|
-
}
|
|
148
|
-
} catch {
|
|
149
|
-
return;
|
|
150
|
-
}
|
|
151
|
-
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");
|
|
174
|
-
await new Promise((resolve2, reject) => {
|
|
175
|
-
const child = spawn2(command, args, {
|
|
176
|
-
cwd: projectRoot,
|
|
177
|
-
stdio: "inherit"
|
|
178
|
-
});
|
|
179
|
-
child.on("close", (code) => {
|
|
180
|
-
if (code === 0) {
|
|
181
|
-
resolve2(void 0);
|
|
182
|
-
} else {
|
|
183
|
-
reject(new Error(`nuxt prepare exited with ${code}`));
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
child.on("error", reject);
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
async function runSvelteKitSync(projectRoot) {
|
|
170
|
+
async function runFrameworkSync(projectRoot, definition) {
|
|
190
171
|
const frameworkProjectPath = resolve(projectRoot, ".holo-js/framework/project.json");
|
|
191
172
|
try {
|
|
192
173
|
const content = await readFile(frameworkProjectPath, "utf8");
|
|
193
174
|
const manifest = JSON.parse(content);
|
|
194
|
-
if (manifest.framework !==
|
|
175
|
+
if (manifest.framework !== definition.framework) {
|
|
195
176
|
return;
|
|
196
177
|
}
|
|
197
178
|
} catch {
|
|
198
179
|
return;
|
|
199
180
|
}
|
|
200
181
|
const manager = await resolveProjectPackageManager(projectRoot);
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
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");
|
|
182
|
+
const invocation = definition.commands[manager];
|
|
183
|
+
const command = invocation[0];
|
|
184
|
+
const args = invocation.slice(1);
|
|
223
185
|
await new Promise((resolve2, reject) => {
|
|
224
|
-
const child =
|
|
186
|
+
const child = spawn(command, args, {
|
|
225
187
|
cwd: projectRoot,
|
|
226
188
|
stdio: "inherit"
|
|
227
189
|
});
|
|
@@ -229,7 +191,7 @@ async function runSvelteKitSync(projectRoot) {
|
|
|
229
191
|
if (code === 0) {
|
|
230
192
|
resolve2(void 0);
|
|
231
193
|
} else {
|
|
232
|
-
reject(new Error(
|
|
194
|
+
reject(new Error(`${definition.errorLabel} exited with ${code}`));
|
|
233
195
|
}
|
|
234
196
|
});
|
|
235
197
|
child.on("error", reject);
|
|
@@ -253,23 +215,14 @@ function resolveConfiguredChannelsPath(project) {
|
|
|
253
215
|
const configuredPaths = project.config.paths;
|
|
254
216
|
return configuredPaths.channels ?? "server/channels";
|
|
255
217
|
}
|
|
256
|
-
function
|
|
257
|
-
const
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
const generatedSchemaPath = toPosixSlashes(project.config.paths.generatedSchema ?? ".holo-js/generated/schema.generated.ts");
|
|
262
|
-
if (normalized === generatedSchemaPath) {
|
|
263
|
-
return true;
|
|
264
|
-
}
|
|
265
|
-
if (normalized === ".holo-js/generated" || normalized.startsWith(".holo-js/generated/")) {
|
|
266
|
-
return false;
|
|
267
|
-
}
|
|
218
|
+
function resolveConfiguredRealtimePath(project) {
|
|
219
|
+
const configuredPaths = project.config.paths;
|
|
220
|
+
return configuredPaths.realtime ?? "server/realtime";
|
|
221
|
+
}
|
|
222
|
+
function resolveConfiguredDiscoveryRoots(project) {
|
|
268
223
|
const authorizationPoliciesPath = project.config.paths.authorizationPolicies || "server/policies";
|
|
269
224
|
const authorizationAbilitiesPath = project.config.paths.authorizationAbilities || "server/abilities";
|
|
270
|
-
|
|
271
|
-
const channelsPath = resolveConfiguredChannelsPath(project);
|
|
272
|
-
const roots = [
|
|
225
|
+
return [
|
|
273
226
|
project.config.paths.models,
|
|
274
227
|
project.config.paths.migrations,
|
|
275
228
|
project.config.paths.seeders,
|
|
@@ -279,14 +232,28 @@ function isDiscoveryRelevantPath(filePath, project) {
|
|
|
279
232
|
project.config.paths.listeners,
|
|
280
233
|
authorizationPoliciesPath,
|
|
281
234
|
authorizationAbilitiesPath,
|
|
282
|
-
|
|
283
|
-
|
|
235
|
+
resolveConfiguredBroadcastPath(project),
|
|
236
|
+
resolveConfiguredChannelsPath(project),
|
|
237
|
+
resolveConfiguredRealtimePath(project),
|
|
284
238
|
"config"
|
|
285
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
|
+
}
|
|
286
253
|
if (normalized === ".env" || normalized.startsWith(".env.")) {
|
|
287
254
|
return true;
|
|
288
255
|
}
|
|
289
|
-
return
|
|
256
|
+
return resolveConfiguredDiscoveryRoots(project).some((root) => normalized === root || normalized.startsWith(`${toPosixSlashes(root)}/`));
|
|
290
257
|
}
|
|
291
258
|
function isRecursiveWatchUnsupported(error) {
|
|
292
259
|
return error instanceof Error && (error.message.includes("recursive") || "code" in error && error.code === "ERR_FEATURE_UNAVAILABLE_ON_PLATFORM");
|
|
@@ -310,24 +277,9 @@ async function collectDirectoryTree(rootPath, directories) {
|
|
|
310
277
|
}
|
|
311
278
|
async function collectDiscoveryWatchRoots(projectRoot, project) {
|
|
312
279
|
const directories = /* @__PURE__ */ new Set();
|
|
313
|
-
const authorizationPoliciesPath = project.config.paths.authorizationPolicies || "server/policies";
|
|
314
|
-
const authorizationAbilitiesPath = project.config.paths.authorizationAbilities || "server/abilities";
|
|
315
|
-
const broadcastPath = resolveConfiguredBroadcastPath(project);
|
|
316
|
-
const channelsPath = resolveConfiguredChannelsPath(project);
|
|
317
280
|
const roots = [
|
|
318
281
|
projectRoot,
|
|
319
|
-
resolve(projectRoot,
|
|
320
|
-
resolve(projectRoot, project.config.paths.models),
|
|
321
|
-
resolve(projectRoot, project.config.paths.migrations),
|
|
322
|
-
resolve(projectRoot, project.config.paths.seeders),
|
|
323
|
-
resolve(projectRoot, project.config.paths.commands),
|
|
324
|
-
resolve(projectRoot, project.config.paths.jobs),
|
|
325
|
-
resolve(projectRoot, project.config.paths.events),
|
|
326
|
-
resolve(projectRoot, project.config.paths.listeners),
|
|
327
|
-
resolve(projectRoot, authorizationPoliciesPath),
|
|
328
|
-
resolve(projectRoot, authorizationAbilitiesPath),
|
|
329
|
-
resolve(projectRoot, broadcastPath),
|
|
330
|
-
resolve(projectRoot, channelsPath),
|
|
282
|
+
...resolveConfiguredDiscoveryRoots(project).map((root) => resolve(projectRoot, root)),
|
|
331
283
|
resolve(projectRoot, dirname(project.config.paths.generatedSchema ?? ".holo-js/generated/schema.generated.ts"))
|
|
332
284
|
];
|
|
333
285
|
for (const rootPath of roots) {
|
|
@@ -342,12 +294,13 @@ async function runProjectDevServer(io, projectRoot, spawnProcess = spawn, create
|
|
|
342
294
|
let project = await ensureProjectConfig(projectRoot);
|
|
343
295
|
let refreshNonRecursiveWatchers;
|
|
344
296
|
let requestChildRestart;
|
|
345
|
-
const
|
|
346
|
-
|
|
297
|
+
const hotPrepare = prepare === runProjectPrepare ? runProjectHotPrepare : prepare;
|
|
298
|
+
const prepareDiscovery = async (syncFramework = false) => {
|
|
299
|
+
await (syncFramework ? prepare : hotPrepare)(projectRoot, io);
|
|
347
300
|
project = await ensureProjectConfig(projectRoot);
|
|
348
301
|
await refreshNonRecursiveWatchers?.();
|
|
349
302
|
};
|
|
350
|
-
await prepareDiscovery();
|
|
303
|
+
await prepareDiscovery(true);
|
|
351
304
|
let pendingPrepare;
|
|
352
305
|
let queued = false;
|
|
353
306
|
let shuttingDown = false;
|
|
@@ -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,
|