@holo-js/cli 0.1.9 → 0.2.1

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 +179 -81
  2. package/dist/broadcast-III5MB3R.mjs +203 -0
  3. package/dist/broadcast-ZIFYFOUQ.mjs +203 -0
  4. package/dist/{cache-ETOIQ5IG.mjs → cache-634WUR3T.mjs} +6 -6
  5. package/dist/cache-7J7DIOP6.mjs +66 -0
  6. package/dist/{cache-migrations-2GGI4TJK.mjs → cache-migrations-2NBEUF2T.mjs} +50 -30
  7. package/dist/cache-migrations-S2LJMDOQ.mjs +173 -0
  8. package/dist/{chunk-WRZFATUT.mjs → chunk-4OHJC3GL.mjs} +232 -143
  9. package/dist/{chunk-ASTSSSL2.mjs → chunk-5TEH2QPK.mjs} +99 -122
  10. package/dist/{chunk-F4MT6GBK.mjs → chunk-FGQ2I2YH.mjs} +1 -1
  11. package/dist/chunk-I7QBCEV7.mjs +33 -0
  12. package/dist/{chunk-R6BWRY3E.mjs → chunk-ILU426CF.mjs} +3 -1
  13. package/dist/{chunk-IMOGEKB4.mjs → chunk-J76GH2DR.mjs} +229 -119
  14. package/dist/{chunk-HB4Q7VYK.mjs → chunk-KS5TWO75.mjs} +30 -273
  15. package/dist/{chunk-57SJ566R.mjs → chunk-LBJAJLKU.mjs} +1 -1
  16. package/dist/{chunk-BAFQ2GOA.mjs → chunk-LXGQCG56.mjs} +1 -1
  17. package/dist/chunk-MCVRN7KX.mjs +3308 -0
  18. package/dist/chunk-SFRAGRHY.mjs +472 -0
  19. package/dist/{chunk-7JR73TOH.mjs → chunk-VP2E62DF.mjs} +36 -25
  20. package/dist/{chunk-5EU32E7X.mjs → chunk-VRGB6DIS.mjs} +116 -12
  21. package/dist/{chunk-SRPGIWCF.mjs → chunk-YEFJBN56.mjs} +2 -2
  22. package/dist/{config-ARLE6PKR.mjs → config-MD27U4FM.mjs} +3 -3
  23. package/dist/{dev-6RG5SSZ7.mjs → dev-M2GGURAX.mjs} +9 -7
  24. package/dist/dev-PBNFQK6Y.mjs +44 -0
  25. package/dist/{discovery-FCVGQQVD.mjs → discovery-GWTBF5RZ.mjs} +3 -3
  26. package/dist/{generators-UI2LJK3O.mjs → generators-BZJ53PUU.mjs} +13 -36
  27. package/dist/generators-DEPLONDJ.mjs +520 -0
  28. package/dist/index.mjs +181 -83
  29. package/dist/{media-migrations-JQSDCC7S.mjs → media-migrations-5EISZBSD.mjs} +9 -20
  30. package/dist/media-migrations-NMUWBEKE.mjs +106 -0
  31. package/dist/{queue-BY3PLH4I.mjs → queue-FRAVPNFJ.mjs} +12 -12
  32. package/dist/queue-GY7BWGTX.mjs +625 -0
  33. package/dist/{queue-migrations-YZUKEZK7.mjs → queue-migrations-J7YPIKRB.mjs} +13 -12
  34. package/dist/queue-migrations-O24ERNFF.mjs +167 -0
  35. package/dist/{runtime-BI343WHS.mjs → runtime-2AA7ZLJ6.mjs} +9 -9
  36. package/dist/{runtime-ZKD6URAV.mjs → runtime-GSXF4NB3.mjs} +1 -1
  37. package/dist/runtime-HGK2MWSC.mjs +57 -0
  38. package/dist/runtime-worker.d.ts +2 -0
  39. package/dist/runtime-worker.mjs +276 -0
  40. package/dist/{scaffold-UBOS2NZR.mjs → scaffold-DEOTRALR.mjs} +9 -5
  41. package/dist/scaffold-Y232IGYS.mjs +139 -0
  42. package/dist/{security-TYPVOYGF.mjs → security-MZW2CJKS.mjs} +6 -6
  43. package/dist/security-XVG673UR.mjs +71 -0
  44. package/package.json +9 -7
  45. package/dist/broadcast-VR46UZEL.mjs +0 -84
  46. package/dist/chunk-ZXDU7RHU.mjs +0 -9
@@ -1,13 +1,84 @@
1
1
  // src/parsing.ts
2
2
  import { createInterface } from "readline/promises";
3
+ import {
4
+ cancel as cancelPrompt,
5
+ isCancel,
6
+ multiselect,
7
+ select,
8
+ text
9
+ } from "@clack/prompts";
3
10
  var SUPPORTED_NEW_FRAMEWORKS = ["nuxt", "next", "sveltekit"];
4
11
  var SUPPORTED_NEW_DATABASE_DRIVERS = ["sqlite", "mysql", "postgres"];
5
12
  var SUPPORTED_NEW_PACKAGE_MANAGERS = ["npm", "pnpm", "yarn", "bun"];
6
13
  var SUPPORTED_NEW_STORAGE_DISKS = ["local", "public"];
7
- var SUPPORTED_NEW_OPTIONAL_PACKAGES = ["storage", "events", "queue", "validation", "forms", "auth", "authorization", "notifications", "mail", "broadcast", "security", "cache"];
8
- var SUPPORTED_INSTALL_TARGETS = ["queue", "events", "auth", "authorization", "notifications", "mail", "broadcast", "security", "cache", "media"];
14
+ var SUPPORTED_NEW_OPTIONAL_PACKAGES = ["storage", "events", "queue", "validation", "forms", "auth", "authorization", "notifications", "mail", "broadcast", "realtime", "security", "cache"];
15
+ var SUPPORTED_INSTALL_TARGETS = ["queue", "events", "auth", "authorization", "notifications", "mail", "broadcast", "realtime", "security", "cache", "media"];
9
16
  var SUPPORTED_QUEUE_INSTALL_DRIVERS = ["sync", "redis", "database"];
10
17
  var SUPPORTED_CACHE_INSTALL_DRIVERS = ["file", "redis", "database"];
18
+ var promptLabels = {
19
+ auth: "Auth",
20
+ authorization: "Authorization",
21
+ broadcast: "Broadcast",
22
+ bun: "Bun",
23
+ cache: "Cache",
24
+ database: "Database",
25
+ discord: "Discord",
26
+ events: "Events",
27
+ facebook: "Facebook",
28
+ file: "File",
29
+ forms: "Forms",
30
+ github: "GitHub",
31
+ google: "Google",
32
+ linkedin: "LinkedIn",
33
+ local: "Local",
34
+ mail: "Mail",
35
+ media: "Media",
36
+ mysql: "MySQL",
37
+ next: "Next.js",
38
+ notifications: "Notifications",
39
+ npm: "npm",
40
+ nuxt: "Nuxt",
41
+ postgres: "Postgres",
42
+ public: "Public",
43
+ queue: "Queue",
44
+ realtime: "Realtime",
45
+ redis: "Redis",
46
+ security: "Security",
47
+ sqlite: "SQLite",
48
+ sveltekit: "SvelteKit",
49
+ sync: "Sync",
50
+ validation: "Validation",
51
+ yarn: "Yarn"
52
+ };
53
+ function isClackInteractive(io) {
54
+ return io.stdin.isTTY === true && io.stdout.isTTY === true && typeof io.stdin.setRawMode === "function";
55
+ }
56
+ function clackCommonOptions(io) {
57
+ return {
58
+ input: io.stdin,
59
+ output: io.stdout
60
+ };
61
+ }
62
+ function optionLabel(value, labels) {
63
+ return labels?.[value] ?? promptLabels[value] ?? value;
64
+ }
65
+ function promptOptions(allowed, options = {}) {
66
+ return allowed.map((value) => {
67
+ const hint = options.hints?.[value];
68
+ const option = {
69
+ value,
70
+ label: optionLabel(value, options.labels)
71
+ };
72
+ return hint ? { ...option, hint } : option;
73
+ });
74
+ }
75
+ function resolvePromptValue(value) {
76
+ if (isCancel(value)) {
77
+ cancelPrompt("Command cancelled.");
78
+ throw new Error("Command cancelled.");
79
+ }
80
+ return value;
81
+ }
11
82
  function parseTokens(tokens) {
12
83
  const args = [];
13
84
  const flags = {};
@@ -75,6 +146,15 @@ function isInteractive(io, flags) {
75
146
  return io.stdin.isTTY === true && io.stdout.isTTY === true && !disabled;
76
147
  }
77
148
  async function prompt(io, label) {
149
+ if (isClackInteractive(io)) {
150
+ const value = await text({
151
+ message: label.replace(/:\s*$/, ""),
152
+ placeholder: "Type a value",
153
+ validate: (current) => current?.trim() ? void 0 : "This value is required.",
154
+ ...clackCommonOptions(io)
155
+ });
156
+ return resolvePromptValue(value).trim();
157
+ }
78
158
  const rl = createInterface({
79
159
  input: io.stdin,
80
160
  output: io.stdout
@@ -85,14 +165,6 @@ async function prompt(io, label) {
85
165
  rl.close();
86
166
  }
87
167
  }
88
- async function confirm(io, label, defaultValue = false) {
89
- const suffix = defaultValue ? " [Y/n] " : " [y/N] ";
90
- const answer = (await prompt(io, `${label}${suffix}`)).toLowerCase();
91
- if (!answer) {
92
- return defaultValue;
93
- }
94
- return answer === "y" || answer === "yes";
95
- }
96
168
  function normalizeChoice(value, allowed, label) {
97
169
  const normalized = value?.trim().toLowerCase();
98
170
  if (normalized && allowed.includes(normalized)) {
@@ -100,13 +172,36 @@ function normalizeChoice(value, allowed, label) {
100
172
  }
101
173
  throw new Error(`Unsupported ${label}: ${value ?? "(empty)"}. Expected one of ${allowed.join(", ")}.`);
102
174
  }
103
- async function promptChoice(io, label, allowed, defaultValue) {
175
+ async function promptChoice(io, label, allowed, defaultValue, options = {}) {
176
+ if (isClackInteractive(io)) {
177
+ const value = await select({
178
+ message: label,
179
+ options: promptOptions(allowed, options),
180
+ initialValue: options.defaultValue ?? defaultValue,
181
+ ...clackCommonOptions(io)
182
+ });
183
+ return normalizeChoice(resolvePromptValue(value), allowed, label);
184
+ }
104
185
  const answer = (await prompt(io, `${label} (${allowed.join("/")}) [${defaultValue}]: `)).trim().toLowerCase();
105
186
  if (!answer) {
106
187
  return defaultValue;
107
188
  }
108
189
  return normalizeChoice(answer, allowed, label);
109
190
  }
191
+ async function promptMultiChoice(io, label, allowed, options = {}) {
192
+ if (isClackInteractive(io)) {
193
+ const values = await multiselect({
194
+ message: label,
195
+ options: promptOptions(allowed, options),
196
+ initialValues: [...options.initialValues ?? []],
197
+ required: options.required ?? false,
198
+ ...clackCommonOptions(io)
199
+ });
200
+ return resolvePromptValue(values).map((value) => normalizeChoice(value, allowed, label));
201
+ }
202
+ const answer = await prompt(io, `${label} (${allowed.join("/")}): `);
203
+ return (splitCsv(answer) ?? []).map((value) => normalizeChoice(value, allowed, label));
204
+ }
110
205
  function normalizeOptionalPackageName(value) {
111
206
  const current = value.trim().toLowerCase();
112
207
  if (current === "validate") {
@@ -141,6 +236,14 @@ function normalizeOptionalPackages(value) {
141
236
  return [...normalized].sort((left, right) => left.localeCompare(right));
142
237
  }
143
238
  async function promptOptionalPackages(io) {
239
+ if (isClackInteractive(io)) {
240
+ const selected = await promptMultiChoice(io, "Optional packages", SUPPORTED_NEW_OPTIONAL_PACKAGES, {
241
+ hints: {
242
+ forms: "also enables validation"
243
+ }
244
+ });
245
+ return normalizeOptionalPackages(selected);
246
+ }
144
247
  const answer = await prompt(io, `Optional packages (${[...SUPPORTED_NEW_OPTIONAL_PACKAGES, "none"].join("/")}): `);
145
248
  return normalizeOptionalPackages(splitCsv(answer) ?? (answer ? [answer] : []));
146
249
  }
@@ -257,8 +360,9 @@ export {
257
360
  SUPPORTED_CACHE_INSTALL_DRIVERS,
258
361
  parseTokens,
259
362
  isInteractive,
260
- confirm,
261
363
  normalizeChoice,
364
+ promptChoice,
365
+ promptMultiChoice,
262
366
  normalizeOptionalPackages,
263
367
  resolveNewProjectInput,
264
368
  ensureRequiredArg,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadGeneratedProjectRegistry
3
- } from "./chunk-IMOGEKB4.mjs";
3
+ } from "./chunk-J76GH2DR.mjs";
4
4
  import {
5
5
  APP_CONFIG_FILE_NAMES,
6
6
  DATABASE_CONFIG_FILE_NAMES,
@@ -8,7 +8,7 @@ import {
8
8
  isModulePackage,
9
9
  pathExists,
10
10
  resolveFirstExistingPath
11
- } from "./chunk-R6BWRY3E.mjs";
11
+ } from "./chunk-ILU426CF.mjs";
12
12
 
13
13
  // src/project/config.ts
14
14
  import { createHash } from "crypto";
@@ -7,11 +7,11 @@ import {
7
7
  serializeDatabaseConfig,
8
8
  serializeProjectConfig,
9
9
  writeProjectConfig
10
- } from "./chunk-SRPGIWCF.mjs";
11
- import "./chunk-IMOGEKB4.mjs";
10
+ } from "./chunk-YEFJBN56.mjs";
11
+ import "./chunk-J76GH2DR.mjs";
12
12
  import {
13
13
  readTextFile
14
- } from "./chunk-R6BWRY3E.mjs";
14
+ } from "./chunk-ILU426CF.mjs";
15
15
  export {
16
16
  defaultProjectConfig,
17
17
  ensureGeneratedSchemaPlaceholder,
@@ -12,17 +12,18 @@ import {
12
12
  runProjectDevServer,
13
13
  runProjectLifecycleScript,
14
14
  runProjectPrepare,
15
+ runProjectStartServer,
15
16
  toPosixSlashes
16
- } from "./chunk-ASTSSSL2.mjs";
17
+ } from "./chunk-5TEH2QPK.mjs";
17
18
  import {
18
19
  hasProjectDependency
19
- } from "./chunk-F4MT6GBK.mjs";
20
+ } from "./chunk-FGQ2I2YH.mjs";
20
21
  import "./chunk-D7O4SU6N.mjs";
21
- import "./chunk-7JR73TOH.mjs";
22
- import "./chunk-WRZFATUT.mjs";
23
- import "./chunk-SRPGIWCF.mjs";
24
- import "./chunk-IMOGEKB4.mjs";
25
- import "./chunk-R6BWRY3E.mjs";
22
+ import "./chunk-VP2E62DF.mjs";
23
+ import "./chunk-4OHJC3GL.mjs";
24
+ import "./chunk-YEFJBN56.mjs";
25
+ import "./chunk-J76GH2DR.mjs";
26
+ import "./chunk-ILU426CF.mjs";
26
27
  export {
27
28
  collectDirectoryTree,
28
29
  collectDiscoveryWatchRoots,
@@ -38,5 +39,6 @@ export {
38
39
  runProjectDevServer,
39
40
  runProjectLifecycleScript,
40
41
  runProjectPrepare,
42
+ runProjectStartServer,
41
43
  toPosixSlashes
42
44
  };
@@ -0,0 +1,44 @@
1
+ import {
2
+ collectDirectoryTree,
3
+ collectDiscoveryWatchRoots,
4
+ isDiscoveryRelevantPath,
5
+ isIgnorableWatchError,
6
+ isRecursiveWatchUnsupported,
7
+ normalizeWatchedFilePath,
8
+ resolvePackageManagerCommand,
9
+ resolvePackageManagerInstallInvocation,
10
+ resolveProjectPackageManager,
11
+ runProjectDependencyInstall,
12
+ runProjectDevServer,
13
+ runProjectLifecycleScript,
14
+ runProjectPrepare,
15
+ runProjectStartServer,
16
+ toPosixSlashes
17
+ } from "./chunk-SFRAGRHY.mjs";
18
+ import {
19
+ hasProjectDependency
20
+ } from "./chunk-FGQ2I2YH.mjs";
21
+ import "./chunk-D7O4SU6N.mjs";
22
+ import "./chunk-VP2E62DF.mjs";
23
+ import "./chunk-MCVRN7KX.mjs";
24
+ import "./chunk-YEFJBN56.mjs";
25
+ import "./chunk-J76GH2DR.mjs";
26
+ import "./chunk-ILU426CF.mjs";
27
+ export {
28
+ collectDirectoryTree,
29
+ collectDiscoveryWatchRoots,
30
+ hasProjectDependency,
31
+ isDiscoveryRelevantPath,
32
+ isIgnorableWatchError,
33
+ isRecursiveWatchUnsupported,
34
+ normalizeWatchedFilePath,
35
+ resolvePackageManagerCommand,
36
+ resolvePackageManagerInstallInvocation,
37
+ resolveProjectPackageManager,
38
+ runProjectDependencyInstall,
39
+ runProjectDevServer,
40
+ runProjectLifecycleScript,
41
+ runProjectPrepare,
42
+ runProjectStartServer,
43
+ toPosixSlashes
44
+ };
@@ -10,9 +10,9 @@ import {
10
10
  resolveListenerEventNamesFromSource,
11
11
  resolveNamedExport,
12
12
  resolveNamedExportEntry
13
- } from "./chunk-7JR73TOH.mjs";
14
- import "./chunk-IMOGEKB4.mjs";
15
- import "./chunk-R6BWRY3E.mjs";
13
+ } from "./chunk-VP2E62DF.mjs";
14
+ import "./chunk-J76GH2DR.mjs";
15
+ import "./chunk-ILU426CF.mjs";
16
16
  export {
17
17
  collectImportedBindingsBySource,
18
18
  discoverAppCommands,
@@ -1,32 +1,32 @@
1
1
  import {
2
2
  resolveStringFlag
3
- } from "./chunk-5EU32E7X.mjs";
3
+ } from "./chunk-VRGB6DIS.mjs";
4
4
  import {
5
5
  runProjectPrepare
6
- } from "./chunk-ASTSSSL2.mjs";
7
- import "./chunk-F4MT6GBK.mjs";
6
+ } from "./chunk-SFRAGRHY.mjs";
7
+ import "./chunk-FGQ2I2YH.mjs";
8
8
  import {
9
9
  hasRegisteredCreateTableMigration,
10
10
  hasRegisteredMigrationSlug,
11
11
  nextMigrationTemplate
12
- } from "./chunk-BAFQ2GOA.mjs";
13
- import {
14
- writeLine
15
- } from "./chunk-ZXDU7RHU.mjs";
12
+ } from "./chunk-LXGQCG56.mjs";
16
13
  import {
17
14
  ensureAbsent,
18
15
  fileExists
19
- } from "./chunk-57SJ566R.mjs";
16
+ } from "./chunk-LBJAJLKU.mjs";
17
+ import {
18
+ writeLine
19
+ } from "./chunk-I7QBCEV7.mjs";
20
20
  import "./chunk-D7O4SU6N.mjs";
21
21
  import {
22
22
  collectFiles,
23
23
  prepareProjectDiscovery
24
- } from "./chunk-7JR73TOH.mjs";
25
- import "./chunk-WRZFATUT.mjs";
24
+ } from "./chunk-VP2E62DF.mjs";
25
+ import "./chunk-MCVRN7KX.mjs";
26
26
  import {
27
27
  ensureGeneratedSchemaPlaceholder,
28
28
  ensureProjectConfig
29
- } from "./chunk-SRPGIWCF.mjs";
29
+ } from "./chunk-YEFJBN56.mjs";
30
30
  import {
31
31
  ensureSuffix,
32
32
  loadGeneratedProjectRegistry,
@@ -48,12 +48,12 @@ import {
48
48
  toKebabCase,
49
49
  toPascalCase,
50
50
  toSnakeCase
51
- } from "./chunk-IMOGEKB4.mjs";
51
+ } from "./chunk-J76GH2DR.mjs";
52
52
  import {
53
53
  makeProjectRelativePath,
54
54
  resolveDefaultArtifactPath,
55
55
  writeTextFile
56
- } from "./chunk-R6BWRY3E.mjs";
56
+ } from "./chunk-ILU426CF.mjs";
57
57
 
58
58
  // src/generators.ts
59
59
  import { createHash } from "crypto";
@@ -210,28 +210,6 @@ function resolveConfiguredChannelsPath(project) {
210
210
  const configuredPaths = project.config.paths;
211
211
  return configuredPaths.channels ?? "server/channels";
212
212
  }
213
- async function resolveProjectMailViewFramework(projectRoot) {
214
- try {
215
- const packageJson = await readFile(resolve(projectRoot, "package.json"), "utf8");
216
- const parsed = JSON.parse(packageJson);
217
- const dependencies = {
218
- ...parsed.dependencies ?? {},
219
- ...parsed.devDependencies ?? {}
220
- };
221
- if (typeof dependencies.nuxt === "string") {
222
- return "nuxt";
223
- }
224
- if (typeof dependencies.next === "string") {
225
- return "next";
226
- }
227
- if (typeof dependencies["@sveltejs/kit"] === "string") {
228
- return "sveltekit";
229
- }
230
- } catch {
231
- return "generic";
232
- }
233
- return "generic";
234
- }
235
213
  async function runMakeModel(io, projectRoot, input) {
236
214
  const project = await ensureProjectConfig(projectRoot);
237
215
  const generatedSchemaFilePath = await ensureGeneratedSchemaPlaceholder(projectRoot, project.config);
@@ -520,7 +498,6 @@ async function runMakeMail(io, projectRoot, input) {
520
498
  writeLine(io.stdout, `Created mail: ${makeProjectRelativePath(projectRoot, mailFilePath)}`);
521
499
  }
522
500
  var generatorInternals = {
523
- resolveProjectMailViewFramework,
524
501
  toChannelTemplateFileStem
525
502
  };
526
503
  export {