@powerhousedao/ph-cli 6.2.3-dev.50 → 6.2.3-dev.52

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.
@@ -0,0 +1,4 @@
1
+ import { i as runBuild } from "./build-skPHsKkL.mjs";
2
+ export { runBuild };
3
+ !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]="b26c880f-731d-5933-9a8c-b980b7d2ea0d")}catch(e){}}();
4
+ //# debugId=b26c880f-731d-5933-9a8c-b980b7d2ea0d
@@ -1,15 +1,31 @@
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]="624706a1-e5cd-5084-9837-3d41b2eb84cb")}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]="40c6d7c6-0af8-5a6a-86c5-b951fdb783fb")}catch(e){}}();
3
3
  import { existsSync, readFileSync, readdirSync } from "node:fs";
4
- import { join } from "node:path";
4
+ import { join, resolve } from "node:path";
5
5
  import { execSync } from "node:child_process";
6
6
  import { detect, resolveCommand } from "package-manager-detector";
7
7
  import { browserEntry, buildBrowserBuildConfig, buildNodeBuildConfig, findBundledSharedDeps } from "@powerhousedao/shared/build-config";
8
- import { assertPiecesOutDir, buildPieces, expandEntryGlobs, pieceListPath, planPieces, syncDistManifest } from "@powerhousedao/shared/build-pieces";
8
+ import { assertPiecesOutDir, buildPieces, createDetectionCache, expandEntryGlobs, externalDependencyVersions, externalDepsPlugin, pieceListPath, planPieces, projectPath, syncDistManifest, undeclaredExternalDependencies } from "@powerhousedao/shared/build-pieces";
9
9
  import { EXTERNALIZABLE_SHARED_SPECIFIERS, findSharedImports } from "@powerhousedao/shared/connect";
10
+ import { nodeFileTrace } from "@vercel/nft";
10
11
  import { readPackage } from "read-pkg";
11
12
  import { build } from "tsdown";
12
13
  //#region src/services/build.ts
14
+ function createTraceFiles() {
15
+ const cache = {};
16
+ return (file) => traceFile(file, cache);
17
+ }
18
+ async function traceFile(file, cache) {
19
+ const { fileList, reasons } = await nodeFileTrace([file], {
20
+ base: "/",
21
+ cache
22
+ });
23
+ const absolute = (p) => resolve("/", p);
24
+ return {
25
+ fileList: new Set([...fileList].map(absolute)),
26
+ reasons: new Map([...reasons].map(([p, reason]) => [absolute(p), { parents: new Set([...reason.parents].map(absolute)) }]))
27
+ };
28
+ }
13
29
  /**
14
30
  * A Powerhouse package's `powerhouse.manifest.json` "name" must match its
15
31
  * `package.json` "name" — Connect and the registry resolve installed versions
@@ -43,8 +59,17 @@ async function runBuild(args) {
43
59
  const agent = (await detect())?.agent ?? "npm";
44
60
  const typesOk = emitTypes(agent, outDir);
45
61
  if (!typesOk && !args.ignoreTypeErrors) await confirmBuildDespiteTypeErrors();
62
+ const detection = createDetectionCache();
63
+ const trace = createTraceFiles();
46
64
  await build({
47
- ...buildBrowserBuildConfig({ sharedDeps }),
65
+ ...buildBrowserBuildConfig({
66
+ sharedDeps,
67
+ plugins: [externalDepsPlugin(trace, /* @__PURE__ */ new Map(), {
68
+ root: projectRoot,
69
+ browser: true,
70
+ cache: detection
71
+ })]
72
+ }),
48
73
  outDir: join(outDir, "browser")
49
74
  });
50
75
  if (sharedDeps) {
@@ -52,20 +77,32 @@ async function runBuild(args) {
52
77
  const bundled = findBundledSharedDeps(imported, readDistBrowserFiles(join(outDir, "browser")));
53
78
  if (bundled.length > 0) console.warn(`⚠ shared deps bundled instead of externalized: ${bundled.join(", ")} — check your neverBundle config`);
54
79
  }
80
+ const external = /* @__PURE__ */ new Map();
55
81
  await build({
56
- ...buildNodeBuildConfig({ sharedDeps }),
82
+ ...buildNodeBuildConfig({
83
+ sharedDeps,
84
+ plugins: [externalDepsPlugin(trace, external, {
85
+ root: projectRoot,
86
+ ignoreDirs: ["editors"],
87
+ forbidDirs: ["document-models"],
88
+ cache: detection
89
+ })]
90
+ }),
57
91
  outDir: join(outDir, "node")
58
92
  });
93
+ const pkg = await readPackage({ cwd: projectRoot });
94
+ assertExternalDependenciesDeclared(projectRoot, [...external.values()], pkg);
59
95
  let built = [];
60
- if (existsSync(pieceListPath(target))) {
61
- const pkg = await readPackage({ cwd: projectRoot });
62
- built = await buildPieces(target, {
63
- name: pkg.name,
64
- version: pkg.version,
65
- license: typeof pkg.license === "string" ? pkg.license : void 0
66
- }, { bundle: build });
67
- }
68
- syncDistManifest(target, built);
96
+ if (existsSync(pieceListPath(target))) built = await buildPieces(target, {
97
+ name: pkg.name,
98
+ version: pkg.version,
99
+ license: typeof pkg.license === "string" ? pkg.license : void 0
100
+ }, {
101
+ bundle: build,
102
+ trace,
103
+ cache: detection
104
+ });
105
+ syncDistManifest(target, built, externalDependencyVersions(external.values()));
69
106
  const executeLocalCommand = resolveCommand(agent, "execute-local", [
70
107
  "tailwindcss",
71
108
  "-i",
@@ -80,6 +117,13 @@ async function runBuild(args) {
80
117
  execSync(`${executeLocalCommand.command} ${executeLocalCommand.args.join(" ")}`);
81
118
  if (!typesOk) console.warn(`\n${UNSAFE_BUILD_WARNING}`);
82
119
  }
120
+ function assertExternalDependenciesDeclared(projectRoot, found, pkg) {
121
+ for (const dep of found) console.log(`${dep.name}@${dep.version} stays external, it needs ${projectPath(projectRoot, dep.file)}`);
122
+ const undeclared = undeclaredExternalDependencies(found, pkg);
123
+ if (undeclared.length === 0) return;
124
+ const lines = undeclared.map((dep) => ` ${dep.name}${dep.importer ? ` (imported by ${projectPath(projectRoot, dep.importer)})` : ""}`);
125
+ throw new Error(`Packages with native addons or WebAssembly modules must be listed in package.json "dependencies", "optionalDependencies" or "peerDependencies":\n${lines.join("\n")}\n\nThey stay external to the build, and installs of this package skip devDependencies.`);
126
+ }
83
127
  function emitTypes(agent, outDir) {
84
128
  const tscCommand = resolveCommand(agent, "execute-local", ["tsc", "--build"]);
85
129
  if (tscCommand === null) {
@@ -160,7 +204,7 @@ function readDistBrowserFiles(dir) {
160
204
  return out;
161
205
  }
162
206
  //#endregion
163
- export { runBuild as n, assertManifestNameMatchesPackage as t };
207
+ export { runBuild as i, assertManifestNameMatchesPackage as n, createTraceFiles as r, assertExternalDependenciesDeclared as t };
164
208
 
165
- //# sourceMappingURL=build-Di0SwHGs.mjs.map
166
- //# debugId=624706a1-e5cd-5084-9837-3d41b2eb84cb
209
+ //# sourceMappingURL=build-skPHsKkL.mjs.map
210
+ //# debugId=40c6d7c6-0af8-5a6a-86c5-b951fdb783fb
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-skPHsKkL.mjs","sources":["../src/services/build.ts"],"sourcesContent":["import {\n browserEntry,\n buildBrowserBuildConfig,\n buildNodeBuildConfig,\n findBundledSharedDeps,\n} from \"@powerhousedao/shared/build-config\";\nimport type {\n BuiltPiece,\n ExternalDependency,\n TraceFiles,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n assertPiecesOutDir,\n buildPieces,\n expandEntryGlobs,\n createDetectionCache,\n externalDependencyVersions,\n projectPath,\n externalDepsPlugin,\n pieceListPath,\n planPieces,\n syncDistManifest,\n undeclaredExternalDependencies,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n findSharedImports,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n} from \"@powerhousedao/shared/connect\";\nimport { execSync } from \"node:child_process\";\nimport { existsSync, readdirSync, readFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { nodeFileTrace } from \"@vercel/nft\";\nimport { detect, resolveCommand, type Agent } from \"package-manager-detector\";\nimport { readPackage } from \"read-pkg\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\n\n// nft reports paths relative to its base; from \"/\" that is every path minus its root.\n// One cache per build: the traces of a project's packages share most files.\nexport function createTraceFiles(): TraceFiles {\n const cache = {};\n return (file) => traceFile(file, cache);\n}\n\nexport const traceFiles: TraceFiles = createTraceFiles();\n\nasync function traceFile(file: string, cache: object) {\n const { fileList, reasons } = await nodeFileTrace([file], {\n base: \"/\",\n cache,\n });\n const absolute = (p: string) => resolve(\"/\", p);\n return {\n fileList: new Set([...fileList].map(absolute)),\n reasons: new Map(\n [...reasons].map(([p, reason]) => [\n absolute(p),\n { parents: new Set([...reason.parents].map(absolute)) },\n ]),\n ),\n };\n}\n\n/**\n * A Powerhouse package's `powerhouse.manifest.json` \"name\" must match its\n * `package.json` \"name\" — Connect and the registry resolve installed versions\n * by treating the manifest name as the npm package name, so a mismatch silently\n * breaks resolution. Fail the build early if they diverge. No-op when the\n * project has no manifest (nothing to compare).\n */\nexport async function assertManifestNameMatchesPackage(projectPath: string) {\n const manifestPath = join(projectPath, \"powerhouse.manifest.json\");\n if (!existsSync(manifestPath)) return;\n\n const { name: packageName } = await readPackage({ cwd: projectPath });\n\n let manifestName: unknown;\n try {\n manifestName = (\n JSON.parse(readFileSync(manifestPath, \"utf-8\")) as { name?: unknown }\n ).name;\n } catch {\n throw new Error(\n `Failed to parse \"powerhouse.manifest.json\" at ${manifestPath}. Make sure it is valid JSON.`,\n );\n }\n\n if (manifestName !== packageName) {\n throw new Error(\n `Package name mismatch — \"package.json\" and \"powerhouse.manifest.json\" must have the same \"name\":\\n` +\n ` package.json \"name\": ${JSON.stringify(packageName)}\\n` +\n ` powerhouse.manifest.json \"name\": ${JSON.stringify(manifestName)}\\n\\n` +\n `Update one so they match, then run the build again.`,\n );\n }\n}\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n const projectRoot = process.cwd();\n\n // Fail fast if the manifest name and package.json name have drifted apart.\n await assertManifestNameMatchesPackage(projectRoot);\n\n const target = {\n projectRoot,\n outDir,\n pieces: planPieces(projectRoot, outDir),\n };\n // Before any bundler runs: an out-dir a host will never read from is worth\n // nothing built, and the failure names what the contract is.\n assertPiecesOutDir(target);\n const sharedDeps = !args.noSharedDeps;\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Before any bundler runs, so declining leaves nothing half built.\n const typesOk = emitTypes(agent, outDir);\n if (!typesOk && !args.ignoreTypeErrors) {\n await confirmBuildDespiteTypeErrors();\n }\n\n // Shared by the browser, node and piece builds: nothing is traced twice.\n const detection = createDetectionCache();\n const trace = createTraceFiles();\n // Everything in the browser build is code Connect can load: native fails it.\n await tsdownBuild({\n ...buildBrowserBuildConfig({\n sharedDeps,\n plugins: [\n externalDepsPlugin(trace, new Map(), {\n root: projectRoot,\n browser: true,\n cache: detection,\n }),\n ],\n }),\n outDir: join(outDir, \"browser\"),\n });\n\n // Advisory: a shared dep the source imports but the output no longer\n // references as a bare import was inlined despite the external set.\n if (sharedDeps) {\n const imported = findSharedImportsInSources(projectRoot, browserEntry);\n const bundled = findBundledSharedDeps(\n imported,\n readDistBrowserFiles(join(outDir, \"browser\")),\n );\n if (bundled.length > 0) {\n console.warn(\n `⚠ shared deps bundled instead of externalized: ${bundled.join(\", \")} — check your neverBundle config`,\n );\n }\n }\n\n const external = new Map<string, ExternalDependency>();\n await tsdownBuild({\n ...buildNodeBuildConfig({\n sharedDeps,\n plugins: [\n // Editors never run on a host; document models run in Connect too.\n externalDepsPlugin(trace, external, {\n root: projectRoot,\n ignoreDirs: [\"editors\"],\n forbidDirs: [\"document-models\"],\n cache: detection,\n }),\n ],\n }),\n outDir: join(outDir, \"node\"),\n });\n const pkg = await readPackage({ cwd: projectRoot });\n assertExternalDependenciesDeclared(projectRoot, [...external.values()], pkg);\n\n // After the node build: it cleans <outDir>/node, where the pieces land. The\n // built list is the gate, so a `bundle:` entry is validated with no piece dir.\n let built: BuiltPiece[] = [];\n if (existsSync(pieceListPath(target))) {\n built = await buildPieces(\n target,\n {\n name: pkg.name,\n version: pkg.version,\n license: typeof pkg.license === \"string\" ? pkg.license : undefined,\n },\n { bundle: tsdownBuild, trace, cache: detection },\n );\n }\n syncDistManifest(\n target,\n built,\n externalDependencyVersions(external.values()),\n );\n\n const executeLocalCommand = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"-i\",\n \"./style.css\",\n \"-o\",\n \"./dist/style.css\",\n ]);\n if (executeLocalCommand === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n execSync(\n `${executeLocalCommand.command} ${executeLocalCommand.args.join(\" \")}`,\n );\n\n // Last, so it is the line a finished build leaves on screen.\n if (!typesOk) console.warn(`\\n${UNSAFE_BUILD_WARNING}`);\n}\n\n// A package with a native addon or WebAssembly module stays external, so the\n// package's consumers must install it: devDependencies are skipped by every install.\nexport function assertExternalDependenciesDeclared(\n projectRoot: string,\n found: ExternalDependency[],\n pkg: Parameters<typeof undeclaredExternalDependencies>[1],\n) {\n for (const dep of found) {\n console.log(\n `${dep.name}@${dep.version} stays external, it needs ${projectPath(projectRoot, dep.file)}`,\n );\n }\n const undeclared = undeclaredExternalDependencies(found, pkg);\n if (undeclared.length === 0) return;\n const lines = undeclared.map(\n (dep) =>\n ` ${dep.name}${dep.importer ? ` (imported by ${projectPath(projectRoot, dep.importer)})` : \"\"}`,\n );\n throw new Error(\n `Packages with native addons or WebAssembly modules must be listed in package.json \"dependencies\", \"optionalDependencies\" or \"peerDependencies\":\\n` +\n `${lines.join(\"\\n\")}\\n\\n` +\n `They stay external to the build, and installs of this package skip devDependencies.`,\n );\n}\n\n// Runs tsc, which checks the project and writes its declarations either way.\n// Returns whether it reported no type errors.\nfunction emitTypes(agent: Agent, outDir: string): boolean {\n const tscCommand = resolveCommand(agent, \"execute-local\", [\"tsc\", \"--build\"]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Type-checking and emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nconst TYPE_ERROR_RISK =\n \"A package built with type errors can load and still fail at runtime.\";\n\nconst UNSAFE_BUILD_WARNING =\n \"⚠ Built despite type errors. \" +\n TYPE_ERROR_RISK +\n \" Fix them before you publish or deploy it.\";\n\nasync function confirmBuildDespiteTypeErrors(): Promise<void> {\n const hint =\n \"Fix them and build again. --ignore-type-errors skips this check, at the risk of shipping that failure.\";\n if (!isInteractive()) {\n console.error(\n `\\n✘ tsc reported the type errors above. ${TYPE_ERROR_RISK}\\n${hint}`,\n );\n process.exit(1);\n }\n const enquirer = await import(\"enquirer\");\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `tsc reported the type errors above. ${TYPE_ERROR_RISK} Build anyway?`,\n initial: false,\n });\n confirmed = answer.confirmed;\n } catch {\n // Ctrl-C at the prompt is a decline.\n confirmed = false;\n }\n if (!confirmed) {\n console.error(`Build cancelled. ${hint}`);\n process.exit(1);\n }\n}\n\n/**\n * Every shared specifier imported from the entry sources; the post-build\n * scan compares these against the built output.\n *\n * Scoped to the specifiers the build actually externalizes: a specifier the\n * vendor does not publish (the bare `@powerhousedao/shared` root, an\n * unvendored subpath) is deliberately bundled, so reporting it as \"bundled\n * instead of externalized\" would be a false alarm.\n */\nfunction findSharedImportsInSources(root: string, globs: string[]): string[] {\n const found = new Set<string>();\n for (const file of expandEntryGlobs(root, globs)) {\n const src = readFileSync(file, \"utf8\");\n for (const spec of findSharedImports(\n src,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n )) {\n found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * The built JS outputs of a browser build (entry files and chunks).\n */\nfunction readDistBrowserFiles(\n dir: string,\n): { path: string; content: string }[] {\n const out: { path: string; content: string }[] = [];\n if (!existsSync(dir)) return out;\n const walk = (d: string) => {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n const p = join(d, e.name);\n if (e.isDirectory()) walk(p);\n else if (e.isFile() && e.name.endsWith(\".js\")) {\n out.push({ path: p, content: readFileSync(p, \"utf8\") });\n }\n }\n };\n walk(dir);\n return out;\n}\n"],"names":["tsdownBuild"],"mappings":";;;;;;;;;;;;;AAuCA,SAAgB,mBAA+B;CAC7C,MAAM,QAAQ,CAAC;CACf,QAAQ,SAAS,UAAU,MAAM,KAAK;AACxC;AAIA,eAAe,UAAU,MAAc,OAAe;CACpD,MAAM,EAAE,UAAU,YAAY,MAAM,cAAc,CAAC,IAAI,GAAG;EACxD,MAAM;EACN;CACF,CAAC;CACD,MAAM,YAAY,MAAc,QAAQ,KAAK,CAAC;CAC9C,OAAO;EACL,UAAU,IAAI,IAAI,CAAC,GAAG,QAAQ,CAAC,CAAC,IAAI,QAAQ,CAAC;EAC7C,SAAS,IAAI,IACX,CAAC,GAAG,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,YAAY,CAChC,SAAS,CAAC,GACV,EAAE,SAAS,IAAI,IAAI,CAAC,GAAG,OAAO,OAAO,CAAC,CAAC,IAAI,QAAQ,CAAC,EAAE,CACxD,CAAC,CACH;CACF;AACF;;;;;;;;AASA,eAAsB,iCAAiC,aAAqB;CAC1E,MAAM,eAAe,KAAK,aAAa,0BAA0B;CACjE,IAAI,CAAC,WAAW,YAAY,GAAG;CAE/B,MAAM,EAAE,MAAM,gBAAgB,MAAM,YAAY,EAAE,KAAK,YAAY,CAAC;CAEpE,IAAI;CACJ,IAAI;EACF,eACE,KAAK,MAAM,aAAa,cAAc,OAAO,CAAC,CAAC,CAC/C;CACJ,QAAQ;EACN,MAAM,IAAI,MACR,iDAAiD,aAAa,8BAChE;CACF;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AM,QAAQ,MAAc;EAC1B,KAAK,MAAM,KAAK,YAAY,GAAG,EAAE,eAAe,KAAK,CAAC,GAAG;GACvD,MAAM,IAAI,KAAK,GAAG,EAAE,IAAI;GACxB,IAAI,EAAE,YAAY,GAAG,KAAK,CAAC;QACtB,IAAI,EAAE,OAAO,KAAK,EAAE,KAAK,SAAS,KAAK,GAC1C,IAAI,KAAK;IAAE,MAAM;IAAG,SAAS,aAAa,GAAG,MAAM;GAAE,CAAC;EAE1D;CACF;CACA,KAAK,GAAG;CACR,OAAO;AACT","debug_id":"40c6d7c6-0af8-5a6a-86c5-b951fdb783fb"}
package/dist/cli.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- !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]="658f151e-b897-505c-bd5b-5a4d9dd1d324")}catch(e){}}();
3
+ !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]="0ec21c09-2ac5-5793-8141-041509a77217")}catch(e){}}();
4
4
  import { n as skipInstallArgs } from "./install-added-dependencies-DVSbzler.mjs";
5
5
  import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
6
6
  import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
@@ -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.50";
20
+ return "6.2.3-dev.52";
21
21
  }
22
22
  //#endregion
23
23
  //#region src/utils/constants.ts
@@ -124,7 +124,7 @@ can load and still fail at runtime, so don't publish it.`,
124
124
  handler: async (args) => {
125
125
  if (args.debug) console.log(args);
126
126
  try {
127
- const { runBuild } = await import("./build-Dk9HoX9_.mjs");
127
+ const { runBuild } = await import("./build-DmqwT-PR.mjs");
128
128
  await runBuild(args);
129
129
  } catch (error) {
130
130
  console.error(error);
@@ -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-CJhbzYPL.mjs");
174
+ const { runConnectBuild } = await import("./connect-build-BLxeFrSb.mjs");
175
175
  await runConnectBuild(args);
176
176
  process.exit(0);
177
177
  }
@@ -745,6 +745,27 @@ This command:
745
745
  });
746
746
  //#endregion
747
747
  //#region src/commands/install.ts
748
+ const MANIFEST_TIMEOUT_MS = 1e4;
749
+ async function fetchExternalDependencies(registryUrl, dependency) {
750
+ const base = registryUrl.endsWith("/") ? registryUrl : `${registryUrl}/`;
751
+ const spec = dependency.version ? `${dependency.name}@${dependency.version}` : dependency.name;
752
+ try {
753
+ const response = await fetch(`${base}-/cdn/${spec}/powerhouse.manifest.json`, { signal: AbortSignal.timeout(MANIFEST_TIMEOUT_MS) });
754
+ if (!response.ok) return [];
755
+ const external = (await response.json()).externalDependencies;
756
+ return typeof external === "object" && external !== null ? Object.keys(external).sort() : [];
757
+ } catch {
758
+ return [];
759
+ }
760
+ }
761
+ async function warnAboutExternalDependencies(registryUrl, dependencies) {
762
+ const found = await Promise.all(dependencies.map((dependency) => fetchExternalDependencies(registryUrl, dependency)));
763
+ for (const [i, dependency] of dependencies.entries()) {
764
+ const external = found[i];
765
+ if (external.length === 0) continue;
766
+ console.warn(`⚠ ${dependency.name}: its subgraphs and processors need packages with native addons or WebAssembly modules (${external.join(", ")}) and only run when the package is installed locally: ph install --local ${dependency.name}\n Its pieces work either way.`);
767
+ }
768
+ }
748
769
  const install = command({
749
770
  name: "install",
750
771
  aliases: ["add", "i"],
@@ -826,6 +847,7 @@ Resolution order for the registry URL:
826
847
  console.error("❌ Failed to update config file");
827
848
  throw error;
828
849
  }
850
+ if (!args.local) await warnAboutExternalDependencies(registryUrl, dependenciesWithVersions);
829
851
  if (args.local) try {
830
852
  console.log("⚙️ Updating styles.css file...");
831
853
  updateStylesFile(dependenciesWithVersions, projectPath);
@@ -1184,7 +1206,7 @@ This command:
1184
1206
  });
1185
1207
  process.exit(0);
1186
1208
  }
1187
- const { startSwitchboard } = await import("./switchboard-yDRjakQT.mjs");
1209
+ const { startSwitchboard } = await import("./switchboard-BUMqobK4.mjs");
1188
1210
  const { defaultDriveUrl, renown } = await startSwitchboard(args);
1189
1211
  console.log(" ➜ Switchboard:", defaultDriveUrl);
1190
1212
  if (renown) console.log(" ➜ Identity:", renown.did);
@@ -1371,7 +1393,7 @@ it never replaces the Vetra drive.
1371
1393
  args: vetraArgs,
1372
1394
  handler: async (args) => {
1373
1395
  if (args.debug) console.log(args);
1374
- const { startVetra } = await import("./vetra-CPGUTtaF.mjs");
1396
+ const { startVetra } = await import("./vetra-B1V1iWGR.mjs");
1375
1397
  await startVetra(args);
1376
1398
  }
1377
1399
  }),
@@ -1499,4 +1521,4 @@ await main().catch(async (error) => {
1499
1521
  export {};
1500
1522
 
1501
1523
  //# sourceMappingURL=cli.mjs.map
1502
- //# debugId=658f151e-b897-505c-bd5b-5a4d9dd1d324
1524
+ //# debugId=0ec21c09-2ac5-5793-8141-041509a77217