@voltro/cli 0.11.0 → 0.11.2

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 (60) hide show
  1. package/CHANGELOG.md +90 -0
  2. package/THIRD-PARTY-NOTICES.md +1047 -22
  3. package/bin/voltro.mjs +16 -7
  4. package/dist/{apiBuild-BUbgGz73.js → apiBuild-BVIiATXr.js} +15 -11
  5. package/dist/apiBuild-C_KY5oY_.js +2 -0
  6. package/dist/bin.js +2 -2
  7. package/dist/bootTiming-BdyP9nYw.js +38 -0
  8. package/dist/{commands-C1qBfIBI.js → commands-C0ytPFfl.js} +2185 -2039
  9. package/dist/dev-DH13Ysgs.js +2 -0
  10. package/dist/{dev-ITlO-epO.js → dev-zJGsTTNb.js} +2202 -2189
  11. package/dist/index.js +1 -1
  12. package/dist/{inspectMetrics-BeMjgt8x.js → inspectMetrics-BuBwg1yW.js} +1169 -1137
  13. package/dist/{serveCommand-mpsE3vLY.js → serveCommand-Dd3oLzbo.js} +312 -340
  14. package/dist/serveEntry.js +3 -3
  15. package/dist/{start-C_M4fGS2.js → start-ChN6PO-c.js} +338 -323
  16. package/dist/startEntry.js +2 -2
  17. package/package.json +23 -17
  18. package/templates/agent-docs/data.md +72 -1
  19. package/templates/agent-docs/database/columntypes.md +7 -0
  20. package/templates/agent-docs/deployment.md +51 -0
  21. package/templates/agent-docs/internationalization.md +71 -0
  22. package/templates/agent-docs/multi-tenancy.md +33 -0
  23. package/templates/agent-docs/testing.md +26 -0
  24. package/templates/apps/api-ai/package.json +7 -7
  25. package/templates/apps/api-auth/package.json +8 -8
  26. package/templates/apps/api-backend/package.json +7 -7
  27. package/templates/apps/api-backend-deactivation/package.json +7 -7
  28. package/templates/apps/api-backend-mail/package.json +8 -8
  29. package/templates/apps/api-backend-mariadb/package.json +9 -9
  30. package/templates/apps/api-backend-storage/package.json +8 -8
  31. package/templates/apps/api-data-advanced/package.json +8 -8
  32. package/templates/apps/api-durable/package.json +8 -8
  33. package/templates/apps/api-feature-flags/package.json +9 -9
  34. package/templates/apps/api-governance/package.json +8 -8
  35. package/templates/apps/api-kv/package.json +8 -8
  36. package/templates/apps/api-moderation/package.json +8 -8
  37. package/templates/apps/api-observability/package.json +8 -8
  38. package/templates/apps/api-ratelimit/package.json +8 -8
  39. package/templates/apps/api-rbac/package.json +8 -8
  40. package/templates/apps/api-rest/package.json +7 -7
  41. package/templates/apps/api-saas/package.json +11 -11
  42. package/templates/apps/api-search/package.json +8 -8
  43. package/templates/apps/api-versioning/package.json +8 -8
  44. package/templates/apps/api-webhooks/package.json +8 -8
  45. package/templates/apps/changelog/package.json +6 -6
  46. package/templates/apps/edge-functions/package.json +2 -2
  47. package/templates/apps/frontend-admin/package.json +8 -8
  48. package/templates/apps/frontend-app/package.json +8 -8
  49. package/templates/apps/frontend-blank/package.json +7 -7
  50. package/templates/apps/frontend-contact/package.json +7 -7
  51. package/templates/apps/frontend-dashboard/package.json +7 -7
  52. package/templates/apps/frontend-docs/package.json +7 -7
  53. package/templates/apps/frontend-i18n/package.json +6 -6
  54. package/templates/apps/frontend-landing/package.json +7 -7
  55. package/templates/apps/frontend-spa/package.json +7 -7
  56. package/templates/apps/frontend-ssr/package.json +7 -7
  57. package/templates/apps/frontend-ssr-api/package.json +8 -8
  58. package/templates/apps/frontend-static-blog/package.json +6 -6
  59. package/dist/apiBuild-BCv3bekE.js +0 -2
  60. package/dist/dev-DKASElZP.js +0 -2
package/bin/voltro.mjs CHANGED
@@ -48,13 +48,22 @@ if (argv[0] === 'start') {
48
48
  const serverDir = join(startRoot, '.framework', 'dist', 'server')
49
49
  const ssrEntry = join(serverDir, 'ssrEntry.js')
50
50
  const appConfig = join(serverDir, 'appConfig.js')
51
- // The NARROW start entry, not the CLI bin: importing `dist/bin.js` pulls the
52
- // whole command graph, and the build commands statically reach for the build
53
- // toolchain so on a `--prod --no-optional` image (no esbuild/vite/tsx) the
54
- // import dies with `Cannot find package 'esbuild'` before any start code runs.
55
- // Verified by building and running the real image. `dist/startEntry.js`
56
- // re-exports only `runStartCommand` + `loadDotEnv`, mirroring `serveEntry`.
57
- const startEntry = resolve(here, '..', 'dist', 'startEntry.js')
51
+ // Prefer the app's PRECOMPILED START BUNDLE when `voltro build` produced one:
52
+ // `.framework/dist-web/startBundle/startEntry.js` inlines the whole start runtime
53
+ // (effect + @voltro) into ONE file, so boot loads a single artefact instead of
54
+ // resolving the per-module CLI graph the module-graph load that dominates a
55
+ // scale-from-zero web cold start. Same export shape (runStartCommand + loadDotEnv),
56
+ // so the import path below is identical.
57
+ //
58
+ // Fallback: the NARROW CLI start entry (`dist/startEntry.js`) — NOT the CLI bin:
59
+ // importing `dist/bin.js` pulls the whole command graph, and the build commands
60
+ // statically reach for the build toolchain, so on a `--prod --no-optional` image
61
+ // (no esbuild/vite/tsx) that import dies with `Cannot find package 'esbuild'`
62
+ // before any start code runs. Both re-export only runStartCommand + loadDotEnv.
63
+ const appStartBundle = join(startRoot, '.framework', 'dist-web', 'startBundle', 'startEntry.js')
64
+ const startEntry = existsSync(appStartBundle)
65
+ ? appStartBundle
66
+ : resolve(here, '..', 'dist', 'startEntry.js')
58
67
  if (existsSync(startEntry) && existsSync(ssrEntry) && existsSync(appConfig)) {
59
68
  try {
60
69
  const mod = await import(pathToFileURL(startEntry).href)
@@ -1,16 +1,16 @@
1
- import { Mt as e } from "./inspectMetrics-BeMjgt8x.js";
2
- import { ct as t, d as n } from "./dev-ITlO-epO.js";
1
+ import { Mt as e } from "./inspectMetrics-BuBwg1yW.js";
2
+ import { d as t, lt as n } from "./dev-zJGsTTNb.js";
3
3
  import { isAbsolute as r, join as i, relative as a, resolve as o } from "node:path";
4
4
  import { createLogger as s } from "@voltro/logger";
5
5
  import { existsSync as c, promises as l } from "node:fs";
6
6
  import { createRequire as u } from "node:module";
7
7
  //#region src/apiBuild.ts
8
8
  var d = s({ scope: "voltro:build" }), f = async (e) => {
9
- let n = i(e, "package.json");
10
- if (!c(n)) return [];
9
+ let t = i(e, "package.json");
10
+ if (!c(t)) return [];
11
11
  let r = {};
12
12
  try {
13
- let e = JSON.parse(await l.readFile(n, "utf8"));
13
+ let e = JSON.parse(await l.readFile(t, "utf8"));
14
14
  r = {
15
15
  ...e.dependencies,
16
16
  ...e.devDependencies,
@@ -19,8 +19,8 @@ var d = s({ scope: "voltro:build" }), f = async (e) => {
19
19
  } catch {
20
20
  return [];
21
21
  }
22
- let a = u(n);
23
- return t.filter((e) => {
22
+ let a = u(t);
23
+ return n.filter((e) => {
24
24
  if (r[e] === void 0) return !1;
25
25
  try {
26
26
  return a.resolve(e), !0;
@@ -28,7 +28,7 @@ var d = s({ scope: "voltro:build" }), f = async (e) => {
28
28
  return !1;
29
29
  }
30
30
  });
31
- }, p = /(?:\.(?:query|mutation|action|stream)(?:\.server)?\.ts|\.workflow(?:\.server)?\.tsx|\.(?:subscribe|reaction|aggregate|agent|tool|webhook|cron|trigger)(?:\.server)?\.tsx?|\.(?:startup|seed)\.tsx?|\.(?:entity|schema|relations)\.ts|(?:^|\/)schema\.ts)$/, m = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), h = async (e) => (await n(e)).filter((t) => p.test(t) && m(t) && !t.includes(`${e}/.framework/`)), g = {
31
+ }, p = /(?:\.(?:query|mutation|action|stream)(?:\.server)?\.ts|\.workflow(?:\.server)?\.tsx|\.(?:subscribe|reaction|aggregate|agent|tool|webhook|cron|trigger)(?:\.server)?\.tsx?|\.(?:startup|seed)\.tsx?|\.(?:entity|schema|relations)\.ts|(?:^|\/)schema\.ts)$/, m = (e) => /\.(ts|tsx)$/.test(e) && !/\.(test|spec)\.[tj]sx?$/.test(e), h = async (e) => (await t(e)).filter((t) => p.test(t) && m(t) && !t.includes(`${e}/.framework/`)), g = {
32
32
  name: "externalize-bare",
33
33
  setup(e) {
34
34
  e.onResolve({ filter: /.*/ }, (e) => {
@@ -106,7 +106,7 @@ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try
106
106
  setup(a) {
107
107
  a.onResolve({ filter: /.*/ }, (e) => {
108
108
  let a = e.path;
109
- if (!(a.startsWith(".") || r(a) || a.startsWith("node:"))) {
109
+ if (!(a.startsWith(".") || r(a) || a.startsWith("node:")) && !(/^effect$/.test(a) || a.startsWith("@effect/") || a.startsWith("@voltro/"))) {
110
110
  if (x(a, y)) return {
111
111
  path: a,
112
112
  namespace: "native-leaf"
@@ -153,15 +153,19 @@ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try
153
153
  ...c(_) ? { tsconfig: _ } : {}
154
154
  }), y = Object.keys(v.metafile.inputs).map((e) => o(t, e)).filter((e) => e.startsWith(`${t}/`) && !e.includes("/node_modules/") && !e.includes("/.framework/") && m(e)), b = await f(t), x = /* @__PURE__ */ new Set(), S = [
155
155
  "// GENERATED BY `voltro build` — do not edit; overwritten on next build.",
156
- "import { join as __join } from 'node:path'",
156
+ "import { join as __join, dirname as __dirname, resolve as __resolve } from 'node:path'",
157
+ "import { pathToFileURL as __pathToFileURL, fileURLToPath as __fileURLToPath } from 'node:url'",
157
158
  "import { runServe as __runServe, registerAppModules, registerDriver, loadDotEnv } from '@voltro/cli/serveEntry'",
158
159
  ...b.map((e, t) => `import * as __drv${t} from ${JSON.stringify(e)}`),
160
+ "const __isMain = Boolean(process.argv[1]) && import.meta.url === __pathToFileURL(process.argv[1]).href",
161
+ "if (__isMain) process.chdir(__resolve(__dirname(__fileURLToPath(import.meta.url)), '..', '..', '..'))",
159
162
  "const __root = process.cwd()",
160
163
  "registerAppModules({",
161
164
  ...y.map((e) => ` [__join(__root, ${JSON.stringify(a(t, e))})]: () => import(${JSON.stringify(e)}),`),
162
165
  "})",
163
166
  ...b.map((e, t) => `registerDriver(${JSON.stringify(e)}, __drv${t})`),
164
167
  "export const runServe = (args = []) => { loadDotEnv([]); return __runServe(args) }",
168
+ "if (__isMain) runServe(process.argv.slice(2)).then((c) => process.exit(typeof c === 'number' ? c : 0))",
165
169
  ""
166
170
  ], w = i(r, "serveEntry.ts");
167
171
  return await l.writeFile(w, S.join("\n"), "utf8"), await n.build({
@@ -188,4 +192,4 @@ const drivers = ${JSON.stringify(t)}\nlet mod\nfor (const d of drivers) {\n try
188
192
  }), i(s, "serveEntry.js");
189
193
  };
190
194
  //#endregion
191
- export { w as a, T as i, h as n, _ as r, v as t };
195
+ export { _ as a, C as i, v as n, T as o, h as r, w as s, y as t };
@@ -0,0 +1,2 @@
1
+ import { a as e, o as t } from "./apiBuild-BVIiATXr.js";
2
+ export { e as runApiBuild, t as runServeBundleBuild };
package/dist/bin.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- import { N as e } from "./inspectMetrics-BeMjgt8x.js";
3
- import { n as t } from "./commands-C1qBfIBI.js";
2
+ import { bt as e } from "./inspectMetrics-BuBwg1yW.js";
3
+ import { n as t } from "./commands-C0ytPFfl.js";
4
4
  import { createLogger as n } from "@voltro/logger";
5
5
  //#region src/bin.ts
6
6
  var r = n({ scope: "voltro:cli" }), i = process.argv.slice(2);
@@ -0,0 +1,38 @@
1
+ //#region src/bootTiming.ts
2
+ var e = () => {
3
+ let e = process.env.VOLTRO_BOOT_TIMING;
4
+ return e === "1" || e === "true";
5
+ }, t = () => {
6
+ let t = [{
7
+ name: "modules",
8
+ at: performance.now()
9
+ }], n = () => Math.round(t[t.length - 1].at), r = () => {
10
+ if (!e()) return null;
11
+ let n = {}, r = 0;
12
+ for (let e of t) n[e.name] = Math.round(e.at - r), r = e.at;
13
+ return n;
14
+ };
15
+ return {
16
+ mark: (e) => {
17
+ t.push({
18
+ name: e,
19
+ at: performance.now()
20
+ });
21
+ },
22
+ total: n,
23
+ phaseBreakdown: r,
24
+ finish: (e) => {
25
+ let t = n(), i = r();
26
+ if (!i) {
27
+ e.info(`serve: ready in ${t}ms`);
28
+ return;
29
+ }
30
+ e.info(`serve: ready in ${t}ms`, {
31
+ bootMs: t,
32
+ phases: i
33
+ });
34
+ }
35
+ };
36
+ };
37
+ //#endregion
38
+ export { t };