@powerhousedao/ph-cli 6.2.3-dev.45 → 6.2.3-dev.47

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/cli.mjs CHANGED
@@ -17,7 +17,7 @@ import { createInterface } from "node:readline/promises";
17
17
  import { bold, yellow } from "colorette";
18
18
  //#region src/get-version.ts
19
19
  function getVersion() {
20
- return "6.2.3-dev.45";
20
+ return "6.2.3-dev.47";
21
21
  }
22
22
  //#endregion
23
23
  //#region src/utils/constants.ts
@@ -171,7 +171,7 @@ Build has no read mode; passing only <key> without <value> errors out (use \`ph
171
171
  args: connectBuildArgs,
172
172
  handler: async (args) => {
173
173
  if (args.debug) console.log(args);
174
- const { runConnectBuild } = await import("./connect-build-2dTdDm81.mjs");
174
+ const { runConnectBuild } = await import("./connect-build-CJhbzYPL.mjs");
175
175
  await runConnectBuild(args);
176
176
  process.exit(0);
177
177
  }
@@ -1,11 +1,11 @@
1
1
 
2
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="656ef93c-42ae-5378-86a3-1192dbe75b7c")}catch(e){}}();
2
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="909a20cf-eee6-5777-a387-38d1f4372b4d")}catch(e){}}();
3
3
  import { n as runBuild } from "./build-Di0SwHGs.mjs";
4
4
  import { t as buildCliConnectOverride } from "./cli-connect-override-b4kKqgOZ.mjs";
5
5
  import { existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
6
6
  import { join, resolve } from "node:path";
7
7
  import { SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, normalizeBasePath } from "@powerhousedao/shared/connect";
8
- import { DEFAULT_VENDOR_INCLUDE, DYNAMIC_BASE_PLACEHOLDER, getConnectBaseViteConfig, missingVendorEntries, prebuildConnectVendor } from "@powerhousedao/builder-tools";
8
+ import { DEFAULT_VENDOR_INCLUDE, DYNAMIC_BASE_PLACEHOLDER, getConnectBaseViteConfig, missingVendorEntries, ownProjectPackage, prebuildConnectVendor, prebuildReactorWorker, prebuildWorkerPackages, resolveReactorWorkerSource } from "@powerhousedao/builder-tools";
9
9
  import { getConfig } from "@powerhousedao/shared/clis";
10
10
  import { build, mergeConfig } from "vite";
11
11
  //#region src/services/connect-build.ts
@@ -25,8 +25,8 @@ async function runConnectBuild(args) {
25
25
  const outDirAbs = resolve(dirname, outDir);
26
26
  let vendor = null;
27
27
  let appBase = "/";
28
+ mkdirSync(outDirAbs, { recursive: true });
28
29
  if (isVendorEnabled()) {
29
- mkdirSync(outDirAbs, { recursive: true });
30
30
  const errorRef = {};
31
31
  const phConfig = getConfig(join(dirname, "powerhouse.config.json"));
32
32
  const connectBasePath = connectOverride?.app?.basePath ?? phConfig.connect?.app?.basePath;
@@ -43,8 +43,11 @@ async function runConnectBuild(args) {
43
43
  console.error(`ph connect build: the shared-dependency vendor failed to build${errorRef.message ? `:\n${errorRef.message}` : ""}`);
44
44
  throw new Error("shared-dependency vendor prebuild failed");
45
45
  }
46
- cleanDistExcept(outDirAbs, ["__vendor__"]);
47
46
  }
47
+ const reactorWorker = await prebuildReactorWorkerBundle(dirname, outDirAbs, vendor, connectOverride);
48
+ if (reactorWorker) await prebuildLocalWorkerPackages(dirname, outDirAbs, vendor, reactorWorker.vendorImports);
49
+ const keepDirs = [...vendor ? ["__vendor__"] : [], ...reactorWorker ? ["__reactor_worker__"] : []];
50
+ if (keepDirs.length > 0) cleanDistExcept(outDirAbs, keepDirs);
48
51
  const baseConfig = getConnectBaseViteConfig({
49
52
  mode,
50
53
  dirname,
@@ -59,7 +62,7 @@ async function runConnectBuild(args) {
59
62
  });
60
63
  const buildConfig = { build: {
61
64
  outDir,
62
- ...vendor ? { emptyOutDir: false } : {}
65
+ ...keepDirs.length > 0 ? { emptyOutDir: false } : {}
63
66
  } };
64
67
  const config = mergeConfig(baseConfig, buildConfig);
65
68
  await build(config);
@@ -120,6 +123,68 @@ function isVendorEnabled(env = process.env) {
120
123
  return raw !== "0" && raw !== "false";
121
124
  }
122
125
  /**
126
+ * The reactor worker bundle prebuild runs on every `ph connect build` unless
127
+ * disabled with PH_CONNECT_REACTOR_WORKER=0 or false. It is built even when
128
+ * `connect.instance.reactorWorker` is off, because the `?reactorWorker=true`
129
+ * runtime override can enable the feature on a flag-off deployment.
130
+ */
131
+ function isReactorWorkerBundleEnabled(env = process.env) {
132
+ const raw = env.PH_CONNECT_REACTOR_WORKER ?? "1";
133
+ return raw !== "0" && raw !== "false";
134
+ }
135
+ /**
136
+ * Prebuild the reactor SharedWorker bundle into `<dist>/__reactor_worker__`.
137
+ * Returns null when the prebuild is disabled, the installed Connect ships no
138
+ * worker entry, or the build fails. A failure only fails `ph connect build`
139
+ * when the project explicitly enables `connect.instance.reactorWorker` —
140
+ * otherwise the feature degrades to unavailable and the build goes on.
141
+ */
142
+ async function prebuildReactorWorkerBundle(dirname, outDirAbs, vendor, connectOverride) {
143
+ if (!isReactorWorkerBundleEnabled()) return null;
144
+ if (!resolveReactorWorkerSource(dirname)) return null;
145
+ const errorRef = {};
146
+ const bundle = await prebuildReactorWorker({
147
+ dirname,
148
+ outDir: join(outDirAbs, "__reactor_worker__"),
149
+ vendor: vendor ? {
150
+ imports: vendor.imports,
151
+ dir: join(outDirAbs, "__vendor__")
152
+ } : void 0,
153
+ nodeEnv: "production",
154
+ errorRef
155
+ });
156
+ if (bundle) return bundle;
157
+ const message = `ph connect build: the reactor worker bundle failed to build${errorRef.message ? `:\n${errorRef.message}` : ""}`;
158
+ const phConfig = getConfig(join(dirname, "powerhouse.config.json"));
159
+ if (connectOverride?.instance?.reactorWorker ?? phConfig.connect?.instance?.reactorWorker ?? false) throw new Error(message);
160
+ console.warn(`${message}\nThe reactorWorker feature will be unavailable in this build.`);
161
+ return null;
162
+ }
163
+ /**
164
+ * Build the project's `provider: "local"` packages into worker-loadable model
165
+ * bundles beside the worker. A failure is a warning, not a build failure: the
166
+ * worker still runs, and documents of registry types still work - only the
167
+ * project's own types would be unavailable in worker mode.
168
+ */
169
+ async function prebuildLocalWorkerPackages(dirname, outDirAbs, vendor, safeVendorImports) {
170
+ const configured = (getConfig(join(dirname, "powerhouse.config.json")).packages ?? []).filter((p) => p.provider === "local").map((p) => p.packageName);
171
+ const own = ownProjectPackage(dirname);
172
+ const localPackages = [.../* @__PURE__ */ new Set([...configured, ...own ? [own] : []])];
173
+ const errorRef = {};
174
+ if (!await prebuildWorkerPackages({
175
+ dirname,
176
+ packages: localPackages,
177
+ outDir: join(outDirAbs, "__reactor_worker__", "packages"),
178
+ vendor: vendor ? {
179
+ imports: vendor.imports,
180
+ dir: join(outDirAbs, "__vendor__")
181
+ } : void 0,
182
+ safeVendorImports,
183
+ nodeEnv: "production",
184
+ errorRef
185
+ })) console.warn(`ph connect build: the reactor worker's local package bundles failed to build${errorRef.message ? `:\n${errorRef.message}` : ""}\nDocuments of this project's own types will not load in worker mode.`);
186
+ }
187
+ /**
123
188
  * Remove every top-level entry of `dist` except the kept names. Used between
124
189
  * the vendor prebuild and the app build so stale app output goes but the
125
190
  * just-built vendor stays (the build then runs with emptyOutDir: false).
@@ -149,5 +214,5 @@ function assertLocalPackagesInstalled(projectPath) {
149
214
  //#endregion
150
215
  export { runConnectBuild };
151
216
 
152
- //# sourceMappingURL=connect-build-2dTdDm81.mjs.map
153
- //# debugId=656ef93c-42ae-5378-86a3-1192dbe75b7c
217
+ //# sourceMappingURL=connect-build-CJhbzYPL.mjs.map
218
+ //# debugId=909a20cf-eee6-5777-a387-38d1f4372b4d
@@ -0,0 +1 @@
1
+ {"version":3,"file":"connect-build-CJhbzYPL.mjs","sources":["../src/services/connect-build.ts"],"sourcesContent":["import {\n DEFAULT_VENDOR_INCLUDE,\n DYNAMIC_BASE_PLACEHOLDER,\n getConnectBaseViteConfig,\n missingVendorEntries,\n prebuildConnectVendor,\n ownProjectPackage,\n prebuildReactorWorker,\n prebuildWorkerPackages,\n resolveReactorWorkerSource,\n type PrebuiltReactorWorker,\n type PrebuiltVendor,\n} from \"@powerhousedao/builder-tools\";\nimport { getConfig } from \"@powerhousedao/shared/clis\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n normalizeBasePath,\n SHARED_DEP_SPECIFIERS,\n SHARED_SUBPATHS,\n} from \"@powerhousedao/shared/connect\";\nimport { existsSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { InlineConfig } from \"vite\";\nimport { build, mergeConfig } from \"vite\";\nimport type { ConnectBuildArgs } from \"../types.js\";\nimport { buildCliConnectOverride } from \"../utils/cli-connect-override.js\";\nimport { runBuild } from \"./build.js\";\n\nexport async function runConnectBuild(args: ConnectBuildArgs) {\n const { outDir, debug, dynamicBase, favicon } = args;\n\n const mode = \"production\";\n const dirname = process.cwd();\n\n // Build has no read mode; a bare positional `<key>` is a user error. The\n // 2-positional `<key> <value>` form is handled inside buildCliConnectOverride\n // so it layers on top of --json + flags like any other override input.\n if (args.keyPositional !== undefined && args.valuePositional === undefined) {\n throw new Error(\n \"ph connect build: positional override requires both <key> and <value> (e.g. `ph connect build connect.renown.url https://renown.staging`). To read a value, use `ph connect config <key>`.\",\n );\n }\n\n // Fail fast if any package marked as provider: \"local\" is missing from\n // node_modules — the Vite plugin that bundles them needs them on disk.\n assertLocalPackagesInstalled(dirname);\n\n // Build the CLI override layers (--json + individual flags + positional)\n // once here so a bad payload fails before we waste a build.\n // `--packages-registry` lands at the top-level `packageRegistryUrl`\n // (mirrors source-config shape); every other flag feeds the connect-block\n // precedence ladder.\n const { connectOverride, packageRegistryUrl } = buildCliConnectOverride(args);\n\n await runBuild({\n outDir: \"dist\",\n debug,\n // Local packages built for Connect share deps with the app vendor, same\n // as a plain `ph build`.\n noSharedDeps: false,\n ignoreTypeErrors: false,\n });\n\n // Production shared-dependency vendor: prebuilt into <outDir>/__vendor__\n // before the app build. On by default; PH_CONNECT_VENDOR=0|false disables\n // it. A failed prebuild fails the build — production must not ship import\n // map entries pointing at a vendor that was never built (the dev server\n // keeps its own soft fallback in the dev plugin).\n const outDirAbs = resolve(dirname, outDir);\n let vendor: PrebuiltVendor | null = null;\n // The deploy base the vendor's import-map addresses are written against.\n // Only meaningful when the vendor is built; \"/\" is the inert default.\n let appBase = \"/\";\n // The prebuild out dirs' parent must exist before the prebuilds: their\n // build locks are siblings of the out dirs, and the package build\n // (runBuild) writes to a different out dir, so nothing else creates it yet.\n mkdirSync(outDirAbs, { recursive: true });\n if (isVendorEnabled()) {\n const errorRef: { message?: string } = {};\n // The same base string the app build uses below: the dynamic-base\n // placeholder, or the normalized deploy base (CLI override wins over the\n // source config). The vendor worker appends its own segment.\n const phConfig = getConfig(join(dirname, \"powerhouse.config.json\"));\n const connectBasePath =\n connectOverride?.app?.basePath ?? phConfig.connect?.app?.basePath;\n appBase = dynamicBase\n ? DYNAMIC_BASE_PLACEHOLDER\n : connectBasePath\n ? normalizeBasePath(connectBasePath)\n : \"/\";\n vendor = await prebuildConnectVendor({\n dirname,\n include: productionVendorInclude(),\n vendorDir: join(outDirAbs, \"__vendor__\"),\n base: appBase,\n nodeEnv: \"production\",\n errorRef,\n });\n if (!vendor) {\n console.error(\n `ph connect build: the shared-dependency vendor failed to build${\n errorRef.message ? `:\\n${errorRef.message}` : \"\"\n }`,\n );\n throw new Error(\"shared-dependency vendor prebuild failed\");\n }\n }\n\n // Reactor SharedWorker bundle: the dist worker is a library artifact whose\n // bare imports no worker can resolve (import maps do not apply to workers),\n // so the deployable form is prebuilt here. With a vendor, its shared deps\n // are externalized onto ../__vendor__/ so page and worker share one cache\n // entry per dep; without one it is fully self-contained.\n const reactorWorker = await prebuildReactorWorkerBundle(\n dirname,\n outDirAbs,\n vendor,\n connectOverride,\n );\n\n // Local project models the worker cannot get from the registry, built into\n // the worker bundle's own directory so they share its vendor.\n if (reactorWorker) {\n await prebuildLocalWorkerPackages(\n dirname,\n outDirAbs,\n vendor,\n reactorWorker.vendorImports,\n );\n }\n\n const keepDirs = [\n ...(vendor ? [\"__vendor__\"] : []),\n ...(reactorWorker ? [\"__reactor_worker__\"] : []),\n ];\n // Stale top-level output goes, the prebuilt dirs stay: the app build below\n // runs with emptyOutDir: false and must not wipe them.\n if (keepDirs.length > 0) {\n cleanDistExcept(outDirAbs, keepDirs);\n }\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n cliConnectOverride: connectOverride,\n cliPackageRegistryUrl: packageRegistryUrl,\n dynamicBase,\n favicon,\n // Vendor import-map entries are relative (leading slash stripped) so\n // they resolve against the page URL under any deploy base — root or\n // subpath, dynamic or concrete.\n vendor: vendor\n ? {\n imports: vendorImportMapEntries(vendor.imports, appBase),\n versions: vendor.versions,\n }\n : undefined,\n });\n\n const buildConfig: InlineConfig = {\n build: {\n outDir,\n // The vendor / worker dirs were prebuilt into the out dir above; the\n // build must not empty them.\n ...(keepDirs.length > 0 ? { emptyOutDir: false } : {}),\n },\n };\n\n const config = mergeConfig(baseConfig, buildConfig);\n\n await build(config);\n\n // Last word on the shipped artifact: every specifier the page's import map\n // publishes must have a file next to it. The prebuild verifies its own\n // output, but it can return a cache hit it never rebuilt, and both the\n // stale-output clean and the app build run afterwards. An entry with no\n // file behind it ships as a URL that 404s, and a SPA answers that with\n // index.html — so the browser reports only an opaque MIME-type error with\n // no filename. Fail here instead, naming the entries.\n if (vendor) {\n const unbacked = missingVendorEntries(\n join(outDirAbs, \"__vendor__\"),\n vendor.imports,\n );\n if (unbacked.length > 0) {\n throw new Error(\n `ph connect build: the shared-dependency vendor is missing ` +\n `${unbacked.length} of the ${Object.keys(vendor.imports).length} ` +\n `entries its import map publishes:\\n` +\n unbacked.map((e) => ` ${e.spec} -> ${e.url}`).join(\"\\n\"),\n );\n }\n }\n}\n\n/**\n * The specifier set the production vendor bundles: the dev-proven heavy set\n * ∪ the package-shared set — everything the app and loaded packages\n * externalize onto the vendor.\n *\n * Two specifiers are deliberately dropped:\n *\n * - `@powerhousedao/connect`. It is in DEFAULT_VENDOR_INCLUDE because the dev\n * server vendors the app to keep rebuilds cheap, but in a production build\n * the app *is* Connect: `SHARED_DEP_SPECIFIERS` omits it, so the app build\n * never externalizes it and nothing would ever resolve its import-map\n * entry. Vendoring it is not merely dead weight — bundling Connect's dist\n * for the browser pulls in its node-only `@powerhousedao/config/node`\n * import, and so `read-pkg` -> `unicorn-magic`, whose browser entry has no\n * `toPath`. That fails the vendor build, and a failed prebuild fails\n * `ph connect build`.\n * - the bare `@powerhousedao/shared` root, whose barrel likewise reaches\n * node-only modules. Its browser-safe subpaths (SHARED_SUBPATHS) are\n * listed instead; a package importing the bare root bundles its own copy.\n */\nexport function productionVendorInclude(): string[] {\n return [\n ...new Set([\n ...DEFAULT_VENDOR_INCLUDE.filter((s) => s !== \"@powerhousedao/connect\"),\n ...SHARED_DEP_SPECIFIERS.filter((s) => s !== \"@powerhousedao/shared\"),\n ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`),\n ]),\n ];\n}\n\n/**\n * Turn the vendor's base-less URLs (`/__vendor__/x.js`) into the addresses\n * the page's import map ships, by prefixing the deploy base.\n *\n * An import map *address* must be a URL or begin with `/`, `./` or `../`;\n * anything else is a bare specifier, which the browser rejects — it drops the\n * entry, resolves the specifier to null, and every shared import then fails\n * with \"blocked by a null value\". So the base is applied rather than the\n * leading slash stripped: a root-relative address is both valid and correct\n * under a subpath deploy, and a dynamic-base build keeps its placeholder for\n * the serving proxy to substitute (the dynamic-base plugin leaves HTML\n * tokens alone by design).\n */\nexport function vendorImportMapEntries(\n imports: Record<string, string>,\n appBase: string,\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(imports).map(([spec, url]) => [\n spec,\n `${appBase}/${url}`.replace(/\\/{2,}/g, \"/\"),\n ]),\n );\n}\n\n/**\n * The production vendor prebuild runs on every `ph connect build` unless\n * disabled with PH_CONNECT_VENDOR=0 or false.\n */\nexport function isVendorEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n const raw = env.PH_CONNECT_VENDOR ?? \"1\";\n return raw !== \"0\" && raw !== \"false\";\n}\n\n/**\n * The reactor worker bundle prebuild runs on every `ph connect build` unless\n * disabled with PH_CONNECT_REACTOR_WORKER=0 or false. It is built even when\n * `connect.instance.reactorWorker` is off, because the `?reactorWorker=true`\n * runtime override can enable the feature on a flag-off deployment.\n */\nexport function isReactorWorkerBundleEnabled(\n env: NodeJS.ProcessEnv = process.env,\n): boolean {\n const raw = env.PH_CONNECT_REACTOR_WORKER ?? \"1\";\n return raw !== \"0\" && raw !== \"false\";\n}\n\n/**\n * Prebuild the reactor SharedWorker bundle into `<dist>/__reactor_worker__`.\n * Returns null when the prebuild is disabled, the installed Connect ships no\n * worker entry, or the build fails. A failure only fails `ph connect build`\n * when the project explicitly enables `connect.instance.reactorWorker` —\n * otherwise the feature degrades to unavailable and the build goes on.\n */\nasync function prebuildReactorWorkerBundle(\n dirname: string,\n outDirAbs: string,\n vendor: PrebuiltVendor | null,\n connectOverride: PHConnectRuntimeConfig | undefined,\n): Promise<PrebuiltReactorWorker | null> {\n if (!isReactorWorkerBundleEnabled()) return null;\n if (!resolveReactorWorkerSource(dirname)) return null;\n\n const errorRef: { message?: string } = {};\n const bundle = await prebuildReactorWorker({\n dirname,\n outDir: join(outDirAbs, \"__reactor_worker__\"),\n vendor: vendor\n ? { imports: vendor.imports, dir: join(outDirAbs, \"__vendor__\") }\n : undefined,\n nodeEnv: \"production\",\n errorRef,\n });\n if (bundle) return bundle;\n\n const message = `ph connect build: the reactor worker bundle failed to build${\n errorRef.message ? `:\\n${errorRef.message}` : \"\"\n }`;\n const phConfig = getConfig(join(dirname, \"powerhouse.config.json\"));\n const required =\n connectOverride?.instance?.reactorWorker ??\n phConfig.connect?.instance?.reactorWorker ??\n false;\n if (required) {\n throw new Error(message);\n }\n console.warn(\n `${message}\\nThe reactorWorker feature will be unavailable in this build.`,\n );\n return null;\n}\n\n/**\n * Build the project's `provider: \"local\"` packages into worker-loadable model\n * bundles beside the worker. A failure is a warning, not a build failure: the\n * worker still runs, and documents of registry types still work - only the\n * project's own types would be unavailable in worker mode.\n */\nasync function prebuildLocalWorkerPackages(\n dirname: string,\n outDirAbs: string,\n vendor: PrebuiltVendor | null,\n safeVendorImports: Record<string, string>,\n): Promise<void> {\n const config = getConfig(join(dirname, \"powerhouse.config.json\"));\n const configured = (config.packages ?? [])\n .filter((p) => p.provider === \"local\")\n .map((p) => p.packageName);\n // The project itself is a local package in all but name: a vetra project\n // declares no entry for itself, and its models are the ones the worker\n // cannot otherwise get.\n const own = ownProjectPackage(dirname);\n const localPackages = [...new Set([...configured, ...(own ? [own] : [])])];\n\n const errorRef: { message?: string } = {};\n const built = await prebuildWorkerPackages({\n dirname,\n packages: localPackages,\n outDir: join(outDirAbs, \"__reactor_worker__\", \"packages\"),\n vendor: vendor\n ? { imports: vendor.imports, dir: join(outDirAbs, \"__vendor__\") }\n : undefined,\n safeVendorImports,\n nodeEnv: \"production\",\n errorRef,\n });\n if (!built) {\n console.warn(\n `ph connect build: the reactor worker's local package bundles failed to build${\n errorRef.message ? `:\\n${errorRef.message}` : \"\"\n }\\nDocuments of this project's own types will not load in worker mode.`,\n );\n }\n}\n\n/**\n * Remove every top-level entry of `dist` except the kept names. Used between\n * the vendor prebuild and the app build so stale app output goes but the\n * just-built vendor stays (the build then runs with emptyOutDir: false).\n * Returns the number of entries removed.\n */\nexport function cleanDistExcept(dist: string, keep: string[] = []): number {\n if (!existsSync(dist)) return 0;\n let removed = 0;\n for (const entry of readdirSync(dist)) {\n if (keep.includes(entry)) continue;\n rmSync(join(dist, entry), { recursive: true, force: true });\n removed += 1;\n }\n return removed;\n}\n\nfunction assertLocalPackagesInstalled(projectPath: string) {\n const config = getConfig(join(projectPath, \"powerhouse.config.json\"));\n const localPackages = (config.packages ?? []).filter(\n (p) => p.provider === \"local\",\n );\n if (localPackages.length === 0) return;\n\n const missing = localPackages.filter(\n (p) =>\n !existsSync(\n join(projectPath, \"node_modules\", p.packageName, \"package.json\"),\n ),\n );\n if (missing.length === 0) return;\n\n const names = missing.map((p) => p.packageName);\n throw new Error(\n `ph connect build requires these packages to be installed in node_modules (they are declared with provider: \"local\" in powerhouse.config.json):\\n` +\n names.map((n) => ` - ${n}`).join(\"\\n\") +\n `\\n\\nInstall them with:\\n ph install --local ${names.join(\" \")}`,\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AA4BA,eAAsB,gBAAgB,MAAwB;CAC5D,MAAM,EAAE,QAAQ,OAAO,aAAa,YAAY;CAEhD,MAAM,OAAO;CACb,MAAM,UAAU,QAAQ,IAAI;CAK5B,IAAI,KAAK,kBAAkB,KAAA,KAAa,KAAK,oBAAoB,KAAA,GAC/D,MAAM,IAAI,MACR,4LACF;CAKF,6BAA6B,OAAO;CAOpC,MAAM,EAAE,iBAAiB,uBAAuB,wBAAwB,IAAI;CAE5E,MAAM,SAAS;EACb,QAAQ;EACR;EAGA,cAAc;EACd,kBAAkB;CACpB,CAAC;CAOD,MAAM,YAAY,QAAQ,SAAS,MAAM;CACzC,IAAI,SAAgC;CAGpC,IAAI,UAAU;CAId,UAAU,WAAW,EAAE,WAAW,KAAK,CAAC;CACxC,IAAI,gBAAgB,GAAG;EACrB,MAAM,WAAiC,CAAC;EAIxC,MAAM,WAAW,UAAU,KAAK,SAAS,wBAAwB,CAAC;EAClE,MAAM,kBACJ,iBAAiB,KAAK,YAAY,SAAS,SAAS,KAAK;EAC3D,UAAU,cACN,2BACA,kBACE,kBAAkB,eAAe,IACjC;EACN,SAAS,MAAM,sBAAsB;GACnC;GACA,SAAS,wBAAwB;GACjC,WAAW,KAAK,WAAW,YAAY;GACvC,MAAM;GACN,SAAS;GACT;EACF,CAAC;EACD,IAAI,CAAC,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MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,IAAI,IACtC,gDAAgD,MAAM,KAAK,GAAG,GAClE;AACF","debug_id":"909a20cf-eee6-5777-a387-38d1f4372b4d"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/ph-cli",
3
- "version": "6.2.3-dev.45",
3
+ "version": "6.2.3-dev.47",
4
4
  "description": "",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
@@ -23,15 +23,15 @@
23
23
  "keywords": [],
24
24
  "author": "",
25
25
  "dependencies": {
26
- "@powerhousedao/builder-tools": "6.2.3-dev.45",
27
- "@powerhousedao/codegen": "6.2.3-dev.45",
28
- "@powerhousedao/common": "6.2.3-dev.45",
29
- "@powerhousedao/config": "6.2.3-dev.45",
30
- "@powerhousedao/reactor": "6.2.3-dev.45",
31
- "@powerhousedao/shared": "6.2.3-dev.45",
32
- "@powerhousedao/switchboard": "6.2.3-dev.45",
33
- "@powerhousedao/vetra": "6.2.3-dev.45",
34
- "@renown/sdk": "6.2.3-dev.45",
26
+ "@powerhousedao/builder-tools": "6.2.3-dev.47",
27
+ "@powerhousedao/codegen": "6.2.3-dev.47",
28
+ "@powerhousedao/common": "6.2.3-dev.47",
29
+ "@powerhousedao/config": "6.2.3-dev.47",
30
+ "@powerhousedao/reactor": "6.2.3-dev.47",
31
+ "@powerhousedao/shared": "6.2.3-dev.47",
32
+ "@powerhousedao/switchboard": "6.2.3-dev.47",
33
+ "@powerhousedao/vetra": "6.2.3-dev.47",
34
+ "@renown/sdk": "6.2.3-dev.47",
35
35
  "@sentry/node-core": "^10.52.0",
36
36
  "@tsdown/css": "0.23.0",
37
37
  "ajv": "^8.18.0",
@@ -39,7 +39,7 @@
39
39
  "change-case": "5.4.4",
40
40
  "cmd-ts": "0.15.0",
41
41
  "colorette": "2.0.20",
42
- "document-model": "6.2.3-dev.45",
42
+ "document-model": "6.2.3-dev.47",
43
43
  "enquirer": "2.4.1",
44
44
  "kysely": "0.28.16",
45
45
  "package-manager-detector": "1.6.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"connect-build-2dTdDm81.mjs","sources":["../src/services/connect-build.ts"],"sourcesContent":["import {\n DEFAULT_VENDOR_INCLUDE,\n DYNAMIC_BASE_PLACEHOLDER,\n getConnectBaseViteConfig,\n missingVendorEntries,\n prebuildConnectVendor,\n type PrebuiltVendor,\n} from \"@powerhousedao/builder-tools\";\nimport { getConfig } from \"@powerhousedao/shared/clis\";\nimport {\n normalizeBasePath,\n SHARED_DEP_SPECIFIERS,\n SHARED_SUBPATHS,\n} from \"@powerhousedao/shared/connect\";\nimport { existsSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { InlineConfig } from \"vite\";\nimport { build, mergeConfig } from \"vite\";\nimport type { ConnectBuildArgs } from \"../types.js\";\nimport { buildCliConnectOverride } from \"../utils/cli-connect-override.js\";\nimport { runBuild } from \"./build.js\";\n\nexport async function runConnectBuild(args: ConnectBuildArgs) {\n const { outDir, debug, dynamicBase, favicon } = args;\n\n const mode = \"production\";\n const dirname = process.cwd();\n\n // Build has no read mode; a bare positional `<key>` is a user error. The\n // 2-positional `<key> <value>` form is handled inside buildCliConnectOverride\n // so it layers on top of --json + flags like any other override input.\n if (args.keyPositional !== undefined && args.valuePositional === undefined) {\n throw new Error(\n \"ph connect build: positional override requires both <key> and <value> (e.g. `ph connect build connect.renown.url https://renown.staging`). To read a value, use `ph connect config <key>`.\",\n );\n }\n\n // Fail fast if any package marked as provider: \"local\" is missing from\n // node_modules — the Vite plugin that bundles them needs them on disk.\n assertLocalPackagesInstalled(dirname);\n\n // Build the CLI override layers (--json + individual flags + positional)\n // once here so a bad payload fails before we waste a build.\n // `--packages-registry` lands at the top-level `packageRegistryUrl`\n // (mirrors source-config shape); every other flag feeds the connect-block\n // precedence ladder.\n const { connectOverride, packageRegistryUrl } = buildCliConnectOverride(args);\n\n await runBuild({\n outDir: \"dist\",\n debug,\n // Local packages built for Connect share deps with the app vendor, same\n // as a plain `ph build`.\n noSharedDeps: false,\n ignoreTypeErrors: false,\n });\n\n // Production shared-dependency vendor: prebuilt into <outDir>/__vendor__\n // before the app build. On by default; PH_CONNECT_VENDOR=0|false disables\n // it. A failed prebuild fails the build — production must not ship import\n // map entries pointing at a vendor that was never built (the dev server\n // keeps its own soft fallback in the dev plugin).\n const outDirAbs = resolve(dirname, outDir);\n let vendor: PrebuiltVendor | null = null;\n // The deploy base the vendor's import-map addresses are written against.\n // Only meaningful when the vendor is built; \"/\" is the inert default.\n let appBase = \"/\";\n if (isVendorEnabled()) {\n // The vendor dir's parent must exist before the prebuild: its build\n // lock is a sibling of the vendor dir, and the package build (runBuild)\n // writes to a different out dir, so nothing else creates it yet.\n mkdirSync(outDirAbs, { recursive: true });\n const errorRef: { message?: string } = {};\n // The same base string the app build uses below: the dynamic-base\n // placeholder, or the normalized deploy base (CLI override wins over the\n // source config). The vendor worker appends its own segment.\n const phConfig = getConfig(join(dirname, \"powerhouse.config.json\"));\n const connectBasePath =\n connectOverride?.app?.basePath ?? phConfig.connect?.app?.basePath;\n appBase = dynamicBase\n ? DYNAMIC_BASE_PLACEHOLDER\n : connectBasePath\n ? normalizeBasePath(connectBasePath)\n : \"/\";\n vendor = await prebuildConnectVendor({\n dirname,\n include: productionVendorInclude(),\n vendorDir: join(outDirAbs, \"__vendor__\"),\n base: appBase,\n nodeEnv: \"production\",\n errorRef,\n });\n if (!vendor) {\n console.error(\n `ph connect build: the shared-dependency vendor failed to build${\n errorRef.message ? `:\\n${errorRef.message}` : \"\"\n }`,\n );\n throw new Error(\"shared-dependency vendor prebuild failed\");\n }\n // Stale top-level output goes, the vendor stays: the app build below\n // runs with emptyOutDir: false and must not wipe it.\n cleanDistExcept(outDirAbs, [\"__vendor__\"]);\n }\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n cliConnectOverride: connectOverride,\n cliPackageRegistryUrl: packageRegistryUrl,\n dynamicBase,\n favicon,\n // Vendor import-map entries are relative (leading slash stripped) so\n // they resolve against the page URL under any deploy base — root or\n // subpath, dynamic or concrete.\n vendor: vendor\n ? {\n imports: vendorImportMapEntries(vendor.imports, appBase),\n versions: vendor.versions,\n }\n : undefined,\n });\n\n const buildConfig: InlineConfig = {\n build: {\n outDir,\n // The vendor dir was prebuilt into the out dir above; the build must\n // not empty it.\n ...(vendor ? { emptyOutDir: false } : {}),\n },\n };\n\n const config = mergeConfig(baseConfig, buildConfig);\n\n await build(config);\n\n // Last word on the shipped artifact: every specifier the page's import map\n // publishes must have a file next to it. The prebuild verifies its own\n // output, but it can return a cache hit it never rebuilt, and both the\n // stale-output clean and the app build run afterwards. An entry with no\n // file behind it ships as a URL that 404s, and a SPA answers that with\n // index.html — so the browser reports only an opaque MIME-type error with\n // no filename. Fail here instead, naming the entries.\n if (vendor) {\n const unbacked = missingVendorEntries(\n join(outDirAbs, \"__vendor__\"),\n vendor.imports,\n );\n if (unbacked.length > 0) {\n throw new Error(\n `ph connect build: the shared-dependency vendor is missing ` +\n `${unbacked.length} of the ${Object.keys(vendor.imports).length} ` +\n `entries its import map publishes:\\n` +\n unbacked.map((e) => ` ${e.spec} -> ${e.url}`).join(\"\\n\"),\n );\n }\n }\n}\n\n/**\n * The specifier set the production vendor bundles: the dev-proven heavy set\n * ∪ the package-shared set — everything the app and loaded packages\n * externalize onto the vendor.\n *\n * Two specifiers are deliberately dropped:\n *\n * - `@powerhousedao/connect`. It is in DEFAULT_VENDOR_INCLUDE because the dev\n * server vendors the app to keep rebuilds cheap, but in a production build\n * the app *is* Connect: `SHARED_DEP_SPECIFIERS` omits it, so the app build\n * never externalizes it and nothing would ever resolve its import-map\n * entry. Vendoring it is not merely dead weight — bundling Connect's dist\n * for the browser pulls in its node-only `@powerhousedao/config/node`\n * import, and so `read-pkg` -> `unicorn-magic`, whose browser entry has no\n * `toPath`. That fails the vendor build, and a failed prebuild fails\n * `ph connect build`.\n * - the bare `@powerhousedao/shared` root, whose barrel likewise reaches\n * node-only modules. Its browser-safe subpaths (SHARED_SUBPATHS) are\n * listed instead; a package importing the bare root bundles its own copy.\n */\nexport function productionVendorInclude(): string[] {\n return [\n ...new Set([\n ...DEFAULT_VENDOR_INCLUDE.filter((s) => s !== \"@powerhousedao/connect\"),\n ...SHARED_DEP_SPECIFIERS.filter((s) => s !== \"@powerhousedao/shared\"),\n ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`),\n ]),\n ];\n}\n\n/**\n * Turn the vendor's base-less URLs (`/__vendor__/x.js`) into the addresses\n * the page's import map ships, by prefixing the deploy base.\n *\n * An import map *address* must be a URL or begin with `/`, `./` or `../`;\n * anything else is a bare specifier, which the browser rejects — it drops the\n * entry, resolves the specifier to null, and every shared import then fails\n * with \"blocked by a null value\". So the base is applied rather than the\n * leading slash stripped: a root-relative address is both valid and correct\n * under a subpath deploy, and a dynamic-base build keeps its placeholder for\n * the serving proxy to substitute (the dynamic-base plugin leaves HTML\n * tokens alone by design).\n */\nexport function vendorImportMapEntries(\n imports: Record<string, string>,\n appBase: string,\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(imports).map(([spec, url]) => [\n spec,\n `${appBase}/${url}`.replace(/\\/{2,}/g, \"/\"),\n ]),\n );\n}\n\n/**\n * The production vendor prebuild runs on every `ph connect build` unless\n * disabled with PH_CONNECT_VENDOR=0 or false.\n */\nexport function isVendorEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n const raw = env.PH_CONNECT_VENDOR ?? \"1\";\n return raw !== \"0\" && raw !== \"false\";\n}\n\n/**\n * Remove every top-level entry of `dist` except the kept names. Used between\n * the vendor prebuild and the app build so stale app output goes but the\n * just-built vendor stays (the build then runs with emptyOutDir: false).\n * Returns the number of entries removed.\n */\nexport function cleanDistExcept(dist: string, keep: string[] = []): number {\n if (!existsSync(dist)) return 0;\n let removed = 0;\n for (const entry of readdirSync(dist)) {\n if (keep.includes(entry)) continue;\n rmSync(join(dist, entry), { recursive: true, force: true });\n removed += 1;\n }\n return removed;\n}\n\nfunction assertLocalPackagesInstalled(projectPath: string) {\n const config = getConfig(join(projectPath, \"powerhouse.config.json\"));\n const localPackages = (config.packages ?? []).filter(\n (p) => p.provider === \"local\",\n );\n if (localPackages.length === 0) return;\n\n const missing = localPackages.filter(\n (p) =>\n !existsSync(\n join(projectPath, \"node_modules\", p.packageName, \"package.json\"),\n ),\n );\n if (missing.length === 0) return;\n\n const names = missing.map((p) => p.packageName);\n throw new Error(\n `ph connect build requires these packages to be installed in node_modules (they are declared with provider: \"local\" in powerhouse.config.json):\\n` +\n names.map((n) => ` - ${n}`).join(\"\\n\") +\n `\\n\\nInstall them with:\\n ph install --local ${names.join(\" \")}`,\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAsBA,eAAsB,gBAAgB,MAAwB;CAC5D,MAAM,EAAE,QAAQ,OAAO,aAAa,YAAY;CAEhD,MAAM,OAAO;CACb,MAAM,UAAU,QAAQ,IAAI;CAK5B,IAAI,KAAK,kBAAkB,KAAA,KAAa,KAAK,oBAAoB,KAAA,GAC/D,MAAM,IAAI,MACR,4LACF;CAKF,6BAA6B,OAAO;CAOpC,MAAM,EAAE,iBAAiB,uBAAuB,wBAAwB,IAAI;CAE5E,MAAM,SAAS;EACb,QAAQ;EACR;EAGA,cAAc;EACd,kBAAkB;CACpB,CAAC;CAOD,MAAM,YAAY,QAAQ,SAAS,MAAM;CACzC,IAAI,SAAgC;CAGpC,IAAI,UAAU;CACd,IAAI,gBAAgB,GAAG;EAIrB,UAAU,WAAW,EAAE,WAAW,KAAK,CAAC;EACxC,MAAM,WAAiC,CAAC;EAIxC,MAAM,WAAW,UAAU,KAAK,SAAS,wBAAwB,CAAC;EAClE,MAAM,kBACJ,iBAAiB,KAAK,YAAY,SAAS,SAAS,KAAK;EAC3D,UAAU,cACN,2BACA,kBACE,kBAAkB,eAAe,IACjC;EACN,SAAS,MAAM,sBAAsB;GACnC;GACA,SAAS,wBAAwB;GACjC,WAAW,KAAK,WAA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