@powerhousedao/shared 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.
- package/dist/clis/args/common-BXabdhiO.mjs.map +1 -1
- package/dist/clis/{build-config-CR5lvv_A.mjs → build-config-HbYUSZS1.mjs} +26 -5
- package/dist/clis/build-config-HbYUSZS1.mjs.map +1 -0
- package/dist/clis/build-config.d.mts +6 -0
- package/dist/clis/build-config.d.mts.map +1 -1
- package/dist/clis/build-config.mjs +1 -1
- package/dist/clis/build-pieces.d.mts +62 -2
- package/dist/clis/build-pieces.d.mts.map +1 -1
- package/dist/clis/build-pieces.mjs +189 -11
- package/dist/clis/build-pieces.mjs.map +1 -1
- package/dist/clis/constants.d.mts +2 -2
- package/dist/clis/constants.mjs +13 -2
- package/dist/clis/constants.mjs.map +1 -1
- package/dist/clis/index.d.mts +20 -1
- package/dist/clis/index.d.mts.map +1 -1
- package/dist/clis/index.mjs +355 -288
- package/dist/clis/index.mjs.map +1 -1
- package/dist/clis/{types-Cc_rB0Yx.d.mts → types-BZBiwi6I.d.mts} +17 -3
- package/dist/clis/types-BZBiwi6I.d.mts.map +1 -0
- package/dist/{config-loader-CXhzL512.js → config-loader-DpeoExZO.js} +3 -2
- package/dist/config-loader-DpeoExZO.js.map +1 -0
- package/dist/connect/config-loader.d.ts +1 -1
- package/dist/connect/config-loader.js +1 -1
- package/dist/connect/index.d.ts +6 -1
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +6 -1
- package/dist/connect/index.js.map +1 -1
- package/dist/{constants-C2K-m7pp.d.ts → constants-C6ket9Bn.d.ts} +2 -2
- package/dist/constants-C6ket9Bn.d.ts.map +1 -0
- package/dist/constants.d.ts +1 -1
- package/dist/constants.js +1 -0
- package/dist/constants.js.map +1 -1
- package/dist/document-drive/index.d.ts +3 -3
- package/dist/document-model/errors.d.ts +1 -1
- package/dist/document-model/index.d.ts +1 -1
- package/dist/document-model/index.js +1 -0
- package/dist/document-model/index.js.map +1 -1
- package/dist/{index-BhqNGLu9.d.ts → index-C3fD6cad.d.ts} +2 -2
- package/dist/{index-BhqNGLu9.d.ts.map → index-C3fD6cad.d.ts.map} +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/processors/index.d.ts +1 -1
- package/dist/registry/index.d.ts +2 -2
- package/dist/registry/index.js.map +1 -1
- package/dist/registry/manifest-slim.d.ts +2 -2
- package/dist/{types-BTfv_ZzS.d.ts → types-CywupGpk.d.ts} +2 -2
- package/dist/{types-BTfv_ZzS.d.ts.map → types-CywupGpk.d.ts.map} +1 -1
- package/dist/{types-BRJfX8ck.d.ts → types-DDH6v2BE.d.ts} +8 -1
- package/dist/{types-BRJfX8ck.d.ts.map → types-DDH6v2BE.d.ts.map} +1 -1
- package/package.json +1 -1
- package/dist/clis/build-config-CR5lvv_A.mjs.map +0 -1
- package/dist/clis/types-Cc_rB0Yx.d.mts.map +0 -1
- package/dist/config-loader-CXhzL512.js.map +0 -1
- package/dist/constants-C2K-m7pp.d.ts.map +0 -1
|
@@ -1,8 +1,166 @@
|
|
|
1
|
-
import { o as buildPieceBuildConfig, t as PIECE_ENTRY_GLOB } from "./build-config-
|
|
1
|
+
import { o as buildPieceBuildConfig, t as PIECE_ENTRY_GLOB } from "./build-config-HbYUSZS1.mjs";
|
|
2
|
+
import { isBuiltin } from "node:module";
|
|
2
3
|
import { tmpdir } from "node:os";
|
|
3
4
|
import { basename, dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
4
|
-
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
5
6
|
import { execFileSync } from "node:child_process";
|
|
7
|
+
//#region clis/external-deps.mts
|
|
8
|
+
const createDetectionCache = () => ({
|
|
9
|
+
files: /* @__PURE__ */ new Map(),
|
|
10
|
+
wasm: /* @__PURE__ */ new Map()
|
|
11
|
+
});
|
|
12
|
+
const NODE_MODULES = `${sep}node_modules${sep}`;
|
|
13
|
+
/** `file` relative to `root`, with forward slashes on every platform. */
|
|
14
|
+
function projectPath(root, file) {
|
|
15
|
+
return relative(root, file).split(sep).join("/");
|
|
16
|
+
}
|
|
17
|
+
const samePath = (file) => process.platform === "win32" ? file.toLowerCase() : file;
|
|
18
|
+
function packageNameOf(specifier) {
|
|
19
|
+
if (specifier.startsWith(".") || isAbsolute(specifier)) return void 0;
|
|
20
|
+
const parts = specifier.split("/");
|
|
21
|
+
return (specifier.startsWith("@") ? parts.slice(0, 2).join("/") : parts[0]) || void 0;
|
|
22
|
+
}
|
|
23
|
+
function packageRootOf(file) {
|
|
24
|
+
const at = file.lastIndexOf(NODE_MODULES);
|
|
25
|
+
if (at < 0) return void 0;
|
|
26
|
+
const rest = file.slice(at + NODE_MODULES.length).split(sep);
|
|
27
|
+
const depth = rest[0]?.startsWith("@") ? 2 : 1;
|
|
28
|
+
if (rest.length <= depth) return void 0;
|
|
29
|
+
return join(file.slice(0, at + NODE_MODULES.length), ...rest.slice(0, depth));
|
|
30
|
+
}
|
|
31
|
+
function readPackageJson(root) {
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
34
|
+
} catch {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function requires(importerRoot, importedRoot) {
|
|
39
|
+
const importer = readPackageJson(importerRoot);
|
|
40
|
+
const name = readPackageJson(importedRoot)?.name;
|
|
41
|
+
if (!importer || !name) return false;
|
|
42
|
+
return importer.dependencies?.[name] !== void 0 || importer.optionalDependencies?.[name] !== void 0;
|
|
43
|
+
}
|
|
44
|
+
function wasmIn(root, cache) {
|
|
45
|
+
if (cache?.wasm.has(root)) return cache.wasm.get(root);
|
|
46
|
+
const found = scanForWasm(root);
|
|
47
|
+
cache?.wasm.set(root, found);
|
|
48
|
+
return found;
|
|
49
|
+
}
|
|
50
|
+
function scanForWasm(root) {
|
|
51
|
+
try {
|
|
52
|
+
const found = readdirSync(root, {
|
|
53
|
+
recursive: true,
|
|
54
|
+
encoding: "utf8"
|
|
55
|
+
}).find((file) => file.endsWith(".wasm") && !file.split(sep).includes("node_modules"));
|
|
56
|
+
return found && join(root, found);
|
|
57
|
+
} catch {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** The first file `entry` cannot load without that a bundle cannot carry. */
|
|
62
|
+
async function findRequiredFile(entry, trace, cache) {
|
|
63
|
+
const { fileList, reasons } = await trace(entry);
|
|
64
|
+
const start = samePath(realpathSync(entry));
|
|
65
|
+
const candidates = [...fileList].filter((file) => file.endsWith(".node")).map((file) => ({
|
|
66
|
+
file,
|
|
67
|
+
kind: "native",
|
|
68
|
+
from: file
|
|
69
|
+
}));
|
|
70
|
+
{
|
|
71
|
+
const traced = /* @__PURE__ */ new Map();
|
|
72
|
+
for (const file of fileList) {
|
|
73
|
+
const root = packageRootOf(file);
|
|
74
|
+
if (root && !traced.has(root) && /\.[cm]?js$/.test(file)) traced.set(root, file);
|
|
75
|
+
}
|
|
76
|
+
const tracedWasm = [...fileList].filter((file) => file.endsWith(".wasm"));
|
|
77
|
+
for (const [root, from] of traced) {
|
|
78
|
+
const file = tracedWasm.find((wasm) => packageRootOf(wasm) === root) ?? wasmIn(root, cache);
|
|
79
|
+
if (file) candidates.push({
|
|
80
|
+
file,
|
|
81
|
+
kind: "wasm",
|
|
82
|
+
from
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
for (const { from, ...required } of candidates) {
|
|
87
|
+
const seen = /* @__PURE__ */ new Set([from]);
|
|
88
|
+
const queue = [from];
|
|
89
|
+
while (queue.length > 0) {
|
|
90
|
+
const file = queue.shift();
|
|
91
|
+
if (samePath(file) === start) return required;
|
|
92
|
+
for (const parent of reasons.get(file)?.parents ?? []) {
|
|
93
|
+
if (seen.has(parent)) continue;
|
|
94
|
+
const fromRoot = packageRootOf(parent);
|
|
95
|
+
const toRoot = packageRootOf(file);
|
|
96
|
+
if (fromRoot !== toRoot && (!fromRoot || !toRoot || !requires(fromRoot, toRoot))) continue;
|
|
97
|
+
seen.add(parent);
|
|
98
|
+
queue.push(parent);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** Keeps each package the code imports that needs such a file out of the bundle. */
|
|
104
|
+
function externalDepsPlugin(trace, found, options = {}) {
|
|
105
|
+
const cache = options.cache ?? createDetectionCache();
|
|
106
|
+
const root = options.root ?? process.cwd();
|
|
107
|
+
const show = (file) => projectPath(root, file);
|
|
108
|
+
const inDir = (id, dirs = []) => dirs.some((dir) => show(id).startsWith(`${dir}/`));
|
|
109
|
+
const detect = (id) => {
|
|
110
|
+
let verdict = cache.files.get(id);
|
|
111
|
+
if (!verdict) {
|
|
112
|
+
verdict = findRequiredFile(id, trace, cache);
|
|
113
|
+
cache.files.set(id, verdict);
|
|
114
|
+
}
|
|
115
|
+
return verdict;
|
|
116
|
+
};
|
|
117
|
+
return {
|
|
118
|
+
name: "powerhouse:external-deps",
|
|
119
|
+
async resolveId(source, importer, extra) {
|
|
120
|
+
if (!importer || importer.includes(NODE_MODULES)) return null;
|
|
121
|
+
if (isBuiltin(source) || inDir(importer, options.ignoreDirs)) return null;
|
|
122
|
+
const name = packageNameOf(source);
|
|
123
|
+
if (!name) return null;
|
|
124
|
+
const resolved = await this.resolve(source, importer, {
|
|
125
|
+
...extra,
|
|
126
|
+
skipSelf: true
|
|
127
|
+
});
|
|
128
|
+
if (!resolved || resolved.external) return null;
|
|
129
|
+
const required = await detect(resolved.id);
|
|
130
|
+
const pkgRoot = packageRootOf(resolved.id);
|
|
131
|
+
const version = pkgRoot ? readPackageJson(pkgRoot)?.version : void 0;
|
|
132
|
+
if (!required || !version) return null;
|
|
133
|
+
const what = required.kind === "native" ? `the native addon ${show(required.file)}` : `the WebAssembly module ${show(required.file)}`;
|
|
134
|
+
if (options.browser) {
|
|
135
|
+
if (required.kind === "wasm") return null;
|
|
136
|
+
throw new Error(`${show(importer)} imports ${name}, which needs ${what}. Native code cannot run in the browser: import it only from subgraphs, switchboard processors or pieces.`);
|
|
137
|
+
}
|
|
138
|
+
if (inDir(importer, options.forbidDirs)) throw new Error(`${show(importer)} imports ${name}, which needs ${what}. Document models run in Connect and on every host: use it from a subgraph, processor or piece instead.`);
|
|
139
|
+
if (!found.has(name)) found.set(name, {
|
|
140
|
+
name,
|
|
141
|
+
version,
|
|
142
|
+
...required,
|
|
143
|
+
importer
|
|
144
|
+
});
|
|
145
|
+
return {
|
|
146
|
+
id: source,
|
|
147
|
+
external: true
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* The detected packages `pkg` does not install for its consumers: anything
|
|
154
|
+
* outside dependencies, optionalDependencies and peerDependencies.
|
|
155
|
+
*/
|
|
156
|
+
function undeclaredExternalDependencies(found, pkg) {
|
|
157
|
+
return [...found].filter((dep) => pkg.dependencies?.[dep.name] === void 0 && pkg.optionalDependencies?.[dep.name] === void 0 && pkg.peerDependencies?.[dep.name] === void 0);
|
|
158
|
+
}
|
|
159
|
+
/** name -> version, sorted by name. */
|
|
160
|
+
function externalDependencyVersions(found) {
|
|
161
|
+
return Object.fromEntries([...found].sort((a, b) => a.name.localeCompare(b.name)).map((dep) => [dep.name, dep.version]));
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
6
164
|
//#region clis/build-pieces.mts
|
|
7
165
|
const toPosix = (p) => p.split(sep).join("/");
|
|
8
166
|
function statSafe(p) {
|
|
@@ -250,7 +408,7 @@ function piecePackageJson(options) {
|
|
|
250
408
|
type: "module",
|
|
251
409
|
main: options.main,
|
|
252
410
|
...options.license ? { license: options.license } : {},
|
|
253
|
-
dependencies: {}
|
|
411
|
+
dependencies: options.dependencies ?? {}
|
|
254
412
|
};
|
|
255
413
|
}
|
|
256
414
|
function bundlePackageJson(dir, version) {
|
|
@@ -301,12 +459,21 @@ const count = (record) => typeof record === "object" && record !== null ? Object
|
|
|
301
459
|
async function buildPieces(target, pkg, options) {
|
|
302
460
|
const { projectRoot, outDir } = target;
|
|
303
461
|
assertPiecesOutDir(target);
|
|
462
|
+
const externalByDir = /* @__PURE__ */ new Map();
|
|
304
463
|
for (const piece of target.pieces) {
|
|
305
464
|
console.log(`\n▶ Building piece ${piece.dir}...`);
|
|
465
|
+
const outDir = resolve(projectRoot, piece.outDir);
|
|
466
|
+
const external = /* @__PURE__ */ new Map();
|
|
306
467
|
await options.bundle(buildPieceBuildConfig({
|
|
307
468
|
entry: resolve(projectRoot, piece.entry),
|
|
308
|
-
outDir
|
|
469
|
+
outDir,
|
|
470
|
+
...options.trace ? { plugins: [externalDepsPlugin(options.trace, external, {
|
|
471
|
+
root: projectRoot,
|
|
472
|
+
...options.cache ? { cache: options.cache } : {}
|
|
473
|
+
})] } : {}
|
|
309
474
|
}));
|
|
475
|
+
for (const dep of external.values()) console.log(`piece ${piece.dir}: ${dep.name}@${dep.version} stays external, it needs ${projectPath(projectRoot, dep.file)}`);
|
|
476
|
+
externalByDir.set(outDir, external);
|
|
310
477
|
}
|
|
311
478
|
const listPath = pieceListPath(target);
|
|
312
479
|
if (!existsSync(listPath)) throw new Error(`pieces: ${toPosix(relative(projectRoot, listPath))} was not built; pieces/index.ts must export the list of pieces this package ships`);
|
|
@@ -329,7 +496,8 @@ async function buildPieces(target, pkg, options) {
|
|
|
329
496
|
version: pkg.version,
|
|
330
497
|
description: metadata.description,
|
|
331
498
|
main: relative(location.dir, location.entryFile),
|
|
332
|
-
license: pkg.license
|
|
499
|
+
license: pkg.license,
|
|
500
|
+
dependencies: externalDependencyVersions(externalByDir.get(resolve(location.dir))?.values() ?? [])
|
|
333
501
|
}) : bundlePackageJson(location.dir, pkg.version);
|
|
334
502
|
writeFileSync(join(location.dir, "package.json"), JSON.stringify(piecePackage, null, 2) + "\n");
|
|
335
503
|
console.log(`piece: ${piece.name}@${pkg.version} -> ${relDir} (${count(metadata.actions)} actions, ${count(metadata.triggers)} triggers)`);
|
|
@@ -348,24 +516,34 @@ async function buildPieces(target, pkg, options) {
|
|
|
348
516
|
function warnUnlistedPieces(planned, listedDirs) {
|
|
349
517
|
for (const piece of planned) if (!listedDirs.has(toPosix(piece.outDir))) console.warn(`⚠ pieces: pieces/${piece.dir} was built but pieces/index.ts does not list it; a host will not find it`);
|
|
350
518
|
}
|
|
351
|
-
function syncDistManifest(target, built) {
|
|
519
|
+
function syncDistManifest(target, built, externalDependencies = {}) {
|
|
352
520
|
const { projectRoot, outDir } = target;
|
|
353
521
|
const source = join(projectRoot, "powerhouse.manifest.json");
|
|
354
522
|
const copy = resolve(projectRoot, outDir, "powerhouse.manifest.json");
|
|
355
523
|
const shipsPieces = existsSync(pieceListPath(target));
|
|
524
|
+
const shipsExternal = Object.keys(externalDependencies).length > 0;
|
|
356
525
|
if (!existsSync(source)) {
|
|
357
526
|
if (shipsPieces) console.warn("⚠ no powerhouse.manifest.json; pieces will not be listed");
|
|
527
|
+
if (shipsExternal) console.warn("⚠ no powerhouse.manifest.json; external dependencies will not be listed");
|
|
358
528
|
return;
|
|
359
529
|
}
|
|
360
530
|
mkdirSync(dirname(copy), { recursive: true });
|
|
361
531
|
copyFileSync(source, copy);
|
|
362
|
-
if (!shipsPieces) return copy;
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
532
|
+
if (!shipsPieces && !shipsExternal) return copy;
|
|
533
|
+
let manifest = JSON.parse(readFileSync(copy, "utf8"));
|
|
534
|
+
if (shipsPieces) {
|
|
535
|
+
const enriched = enrichManifestPieces(manifest, built);
|
|
536
|
+
for (const id of enriched.unbuilt) console.warn(`⚠ manifest lists piece "${id}" but nothing built it`);
|
|
537
|
+
manifest = enriched.manifest;
|
|
538
|
+
}
|
|
539
|
+
if (shipsExternal) manifest = {
|
|
540
|
+
...manifest,
|
|
541
|
+
externalDependencies
|
|
542
|
+
};
|
|
543
|
+
writeFileSync(copy, JSON.stringify(manifest, null, 2) + "\n");
|
|
366
544
|
return copy;
|
|
367
545
|
}
|
|
368
546
|
//#endregion
|
|
369
|
-
export { DESCRIBE_HELPERS, DESCRIBE_SCRIPT, assertPieceVersion, assertPiecesOutDir, buildPieces, bundlePackageJson, createJsonReplacer, describePieces, enrichManifestPieces, expandEntryGlobs, pieceDescriptor, pieceListPath, piecePackageJson, planPieces, resolvePieceLocation, statSafe, syncDistManifest };
|
|
547
|
+
export { DESCRIBE_HELPERS, DESCRIBE_SCRIPT, assertPieceVersion, assertPiecesOutDir, buildPieces, bundlePackageJson, createDetectionCache, createJsonReplacer, describePieces, enrichManifestPieces, expandEntryGlobs, externalDependencyVersions, externalDepsPlugin, findRequiredFile, pieceDescriptor, pieceListPath, piecePackageJson, planPieces, projectPath, resolvePieceLocation, statSafe, syncDistManifest, undeclaredExternalDependencies };
|
|
370
548
|
|
|
371
549
|
//# sourceMappingURL=build-pieces.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-pieces.mjs","names":[],"sources":["../../clis/build-pieces.mts"],"sourcesContent":["// The pieces half of a package build: find and bundle each piece whole, load\n// it once in a child process to learn what it is, and write what a host reads.\nimport { execFileSync } from \"node:child_process\";\nimport {\n copyFileSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport type { InlineConfig } from \"tsdown\";\nimport type { Manifest, PieceModule } from \"../document-model/types.js\";\nimport { buildPieceBuildConfig, PIECE_ENTRY_GLOB } from \"./build-config.mjs\";\n\nexport type PiecePlan = {\n /** The directory under pieces/, and so under <outDir>/node/pieces. */\n dir: string;\n /** Source entry, relative to the project root: pieces/<dir>/index.ts. */\n entry: string;\n /** Where the piece lands, relative to the project root. */\n outDir: string;\n};\n\n// What buildPieces needs to know about the package it works in: where it is,\n// where it builds to, and which pieces the plan found.\nexport type PieceBuildTarget = {\n projectRoot: string;\n outDir: string;\n pieces: PiecePlan[];\n};\n\n// One entry of pieces/index.ts, as @powerhousedao/pieces-framework declares it.\n// Declared here so the build needs no dependency on a package meant for pieces.\nexport type PackagePiece = {\n name: string;\n entry?: string;\n bundle?: string;\n};\n\n// What a piece says about itself, in the framework's PieceMetadata shape.\n// Read from the built piece, so nothing in the build has to know the framework.\nexport type PieceMetadata = Record<string, unknown> & {\n displayName?: string;\n description?: string;\n actions?: Record<string, unknown>;\n triggers?: Record<string, unknown>;\n};\n\nexport type DescribedPiece = {\n name: string;\n metadata: PieceMetadata;\n};\n\nexport type DescribeResult = {\n list: PackagePiece[];\n pieces: DescribedPiece[];\n errors: { name: string; message: string }[];\n};\n\nexport type BuiltPiece = {\n name: string;\n version: string;\n displayName?: string;\n description?: string;\n /** Piece directory, relative to the project root, `/` separated. */\n bundle: string;\n /** The descriptor inside it, relative to the project root, `/` separated. */\n descriptor: string;\n};\n\nexport type PackageIdentity = {\n name: string;\n version: string;\n license?: string;\n};\n\nexport type PieceBuildOptions = {\n /** The bundler: tsdown's `build`, handed in so this module never loads it. */\n bundle: (config: InlineConfig) => Promise<unknown>;\n};\n\nconst toPosix = (p: string) => p.split(sep).join(\"/\");\n\nexport function statSafe(p: string) {\n try {\n return statSync(p);\n } catch {\n return null;\n }\n}\n\n// Expand entry globs (single-`*` segments only — the shape `browserEntry`\n// uses) against files on disk, resolving against `root`.\nexport function expandEntryGlobs(root: string, globs: string[]): string[] {\n const files = new Set<string>();\n for (const pattern of globs) {\n const segments = pattern.split(\"/\").filter(Boolean);\n let dirs = [root];\n for (const seg of segments) {\n const next: string[] = [];\n for (const d of dirs) {\n if (!statSafe(d)?.isDirectory()) continue;\n if (seg === \"*\") {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n next.push(join(d, e.name));\n }\n } else {\n next.push(join(d, seg));\n }\n }\n dirs = next;\n }\n for (const f of dirs) {\n if (statSafe(f)?.isFile()) files.add(f);\n }\n }\n return [...files];\n}\n\n// The pieces a project holds, one per pieces/<dir>/index.ts, sorted by dir so\n// a build log and a manifest read the same from one run to the next.\nexport function planPieces(projectRoot: string, outDir: string): PiecePlan[] {\n return expandEntryGlobs(projectRoot, [PIECE_ENTRY_GLOB])\n .map((file) => {\n const dir = basename(dirname(file));\n return {\n dir,\n entry: relative(projectRoot, file),\n outDir: join(outDir, \"node\", \"pieces\", dir),\n };\n })\n .sort((a, b) => (a.dir < b.dir ? -1 : a.dir > b.dir ? 1 : 0));\n}\n\n// A JSON.stringify replacer that makes a piece's metadata serializable: props\n// carry resolvers, defaults may be class instances, and a schema may cycle.\nexport function createJsonReplacer() {\n const ancestors: object[] = [];\n return function replace(this: unknown, _key: string, value: unknown) {\n if (typeof value === \"function\" || value === undefined) return undefined;\n if (typeof value === \"bigint\") return value.toString();\n if (typeof value !== \"object\" || value === null) return value;\n // `this` is the holder, so popping back to it leaves the current path.\n while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();\n if (ancestors.includes(value)) return undefined;\n ancestors.push(value);\n return value;\n };\n}\n\n// The half of the child script that needs nothing from the job: a test\n// evaluates this text on its own, so neither copy can drift from the other.\n\n// `constructor?.name`: a module may export an Object.create(null), and the\n// real piece is usually beside it in the same module.\nexport const DESCRIBE_HELPERS = `\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\n\nfunction findPiece(mod) {\n const candidates = [\n ...Object.values(mod),\n ...(isRecord(mod.default) ? Object.values(mod.default) : []),\n mod.default,\n ];\n for (const candidate of candidates) {\n if (isRecord(candidate) && candidate.constructor?.name === \"Piece\") {\n return candidate;\n }\n }\n for (const candidate of candidates) {\n if (\n isRecord(candidate) &&\n typeof candidate.displayName === \"string\" &&\n (isRecord(candidate.actions) ||\n typeof candidate.actions === \"function\" ||\n typeof candidate.getAction === \"function\")\n ) {\n return candidate;\n }\n }\n return undefined;\n}\n\nfunction describePiece(piece) {\n if (typeof piece.metadata === \"function\") return piece.metadata();\n const call = (value) => (typeof value === \"function\" ? value.call(piece) : value);\n return {\n displayName: piece.displayName,\n logoUrl: piece.logoUrl,\n description: piece.description,\n authors: piece.authors,\n categories: piece.categories,\n auth: piece.auth,\n minimumSupportedRelease: piece.minimumSupportedRelease,\n maximumSupportedRelease: piece.maximumSupportedRelease,\n deprecated: piece.deprecated,\n actions: call(piece.actions) ?? {},\n triggers: call(piece.triggers) ?? {},\n };\n}\n\nfunction createJsonReplacer() {\n const ancestors = [];\n return function replace(_key, value) {\n if (typeof value === \"function\" || value === undefined) return undefined;\n if (typeof value === \"bigint\") return value.toString();\n if (typeof value !== \"object\" || value === null) return value;\n while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();\n if (ancestors.includes(value)) return undefined;\n ancestors.push(value);\n return value;\n };\n}\n`;\n\n// Runs in a child node process: loading a piece runs piece-authored top-level\n// code, and the runtime describes pieces in a worker for the same reason.\n\n// A string so it works from `src` under bun or tsx as well as from `dist`. It\n// answers through a file, leaving both its streams to the piece.\nexport const DESCRIBE_SCRIPT = `\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { isAbsolute, join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nconst job = JSON.parse(readFileSync(process.argv[2], \"utf8\"));\n${DESCRIBE_HELPERS}\n// Says why the child gave up in the one place the parent always reads, so a\n// failure reports the cause and never the text of this script.\nfunction fail(message) {\n writeFileSync(job.outFile, JSON.stringify({ fatal: message }));\n process.exit(1);\n}\n\n// The module to load for a list entry; a bundle names its own main.\nfunction entryFile(piece) {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\") return undefined;\n const path = isAbsolute(declared) ? declared : join(job.projectRoot, declared);\n if (piece.entry) return path;\n const pkgFile = join(path, \"package.json\");\n if (!existsSync(pkgFile)) return undefined;\n const pkg = JSON.parse(readFileSync(pkgFile, \"utf8\"));\n return join(path, typeof pkg.main === \"string\" ? pkg.main : \"index.mjs\");\n}\n\nlet listModule;\ntry {\n listModule = await import(pathToFileURL(job.listPath).href);\n} catch (error) {\n fail(job.listPath + \" threw on import: \" + (error instanceof Error ? error.message : String(error)));\n}\nconst list = listModule.pieces ?? listModule.default;\nif (!Array.isArray(list)) {\n fail(job.listPath + ' exports no \"pieces\" array');\n}\n\nconst out = { list, pieces: [], errors: [] };\nfor (const piece of list) {\n const file = entryFile(piece);\n // A missing file is the parent's to report, with the message it owns.\n if (!file || !existsSync(file)) continue;\n try {\n const mod = await import(pathToFileURL(file).href);\n const found = findPiece(mod);\n if (!found) {\n throw new Error(\n \"no Piece export found in \" + file + \"; exports: \" + Object.keys(mod).join(\", \"),\n );\n }\n const metadata = JSON.parse(JSON.stringify(describePiece(found), createJsonReplacer()));\n out.pieces.push({ name: piece.name, metadata });\n } catch (error) {\n out.errors.push({\n name: piece.name,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n}\nwriteFileSync(job.outFile, JSON.stringify(out, createJsonReplacer()));\n`;\n\n// What the child said went wrong, if it got that far, and otherwise how it\n// died: an exit status, never the whole script an `Error.message` carries.\nfunction childFailure(error: unknown, outFile: string): string {\n try {\n const answer = JSON.parse(readFileSync(outFile, \"utf8\")) as {\n fatal?: unknown;\n };\n if (typeof answer.fatal === \"string\") return answer.fatal;\n } catch {\n // no answer on disk: fall through to the exit status\n }\n const { status, signal } = error as {\n status?: number | null;\n signal?: string | null;\n };\n if (signal) return `the describe child was killed by ${signal}`;\n return `the describe child exited with code ${status ?? \"unknown\"}`;\n}\n\n// Load the built list and every piece it names in a child process and return\n// what they say about themselves. Throws when the list itself cannot be read.\n\n// Both of the child's streams are the parent's, so a piece that prints at\n// import time is heard rather than mixed into the answer.\nexport function describePieces(\n projectRoot: string,\n listPath: string,\n): DescribeResult {\n const dir = mkdtempSync(join(tmpdir(), \"ph-build-pieces-\"));\n const rel = toPosix(relative(projectRoot, listPath));\n try {\n const jobFile = join(dir, \"job.json\");\n const scriptFile = join(dir, \"describe.mjs\");\n const outFile = join(dir, \"describe.json\");\n writeFileSync(scriptFile, DESCRIBE_SCRIPT);\n writeFileSync(jobFile, JSON.stringify({ projectRoot, listPath, outFile }));\n try {\n execFileSync(process.execPath, [scriptFile, jobFile], {\n timeout: 60_000,\n stdio: \"inherit\",\n });\n } catch (error) {\n throw new Error(\n `pieces: could not load ${rel}: ${childFailure(error, outFile)}`,\n { cause: error },\n );\n }\n return JSON.parse(readFileSync(outFile, \"utf8\")) as DescribeResult;\n } finally {\n rmSync(dir, { recursive: true, force: true });\n }\n}\n\nexport type PieceLocation = {\n /** The piece directory, absolute. */\n dir: string;\n /** The module file, absolute; unset for a bundle, whose package.json names it. */\n entryFile?: string;\n form: \"entry\" | \"bundle\";\n};\n\n// Where a list entry says its built piece is, checked against the disk: a\n// listed piece nobody built would otherwise fail much later, in a host.\nexport function resolvePieceLocation(\n piece: PackagePiece,\n projectRoot: string,\n outDir: string,\n): PieceLocation {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\" || declared === \"\") {\n throw new Error(\n `pieces: \"${piece.name}\" declares neither an entry nor a bundle`,\n );\n }\n const path = isAbsolute(declared) ? declared : join(projectRoot, declared);\n const form = piece.entry ? \"entry\" : \"bundle\";\n const present =\n form === \"entry\"\n ? statSafe(path)?.isFile()\n : statSafe(join(path, \"package.json\"))?.isFile();\n if (!present) {\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is missing`,\n );\n }\n const dir = form === \"entry\" ? dirname(path) : path;\n // Both forms, not just `entry`: a descriptor.json is written into this\n // directory, and outside outDir that lands in tracked source.\n const piecesRoot = resolve(projectRoot, outDir, \"node\", \"pieces\");\n const inside = relative(piecesRoot, dir);\n if (inside === \"\" || inside.startsWith(\"..\") || isAbsolute(inside)) {\n const expected = toPosix(join(outDir, \"node\", \"pieces\"));\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is outside ${expected}/; ` +\n `a piece is built to ${expected}/<dir>/index.mjs and its entry must point there`,\n );\n }\n return form === \"entry\" ? { dir, entryFile: path, form } : { dir, form };\n}\n\n// Where the node build leaves the list of pieces a package ships. Its presence\n// on disk, not a pieces/<dir> in the source, is what says a package has them.\nexport function pieceListPath(target: {\n projectRoot: string;\n outDir: string;\n}): string {\n return resolve(\n target.projectRoot,\n target.outDir,\n \"node\",\n \"pieces\",\n \"index.mjs\",\n );\n}\n\n// `dist` is not a default here but a contract: a host reads a piece from\n// dist/node/pieces/<name>, and a list entry names that path literally.\nexport function assertPiecesOutDir(target: {\n outDir: string;\n pieces: PiecePlan[];\n}): void {\n if (target.pieces.length === 0 || target.outDir === \"dist\") return;\n throw new Error(\n `pieces: --out-dir ${target.outDir} cannot hold pieces; a piece is loaded from ` +\n `dist/node/pieces/<name> by the host, so a package that ships pieces builds to dist`,\n );\n}\n\n// A piece's version is its package's, written by the build; a list entry that\n// declares one is refused, so `name@version` always names one tarball.\nexport function assertPieceVersion(\n piece: PackagePiece,\n pkg: PackageIdentity,\n): void {\n if (\"version\" in piece) {\n throw new Error(\n `pieces: \"${piece.name}\" declares version ${String(piece.version)}; a piece takes its package's version (${pkg.version}), so remove \"version\" from pieces/index.ts`,\n );\n }\n}\n\n// The package.json written beside a piece built from an `entry`, giving the\n// directory npm-bundle shape so a registry can serve it on its own.\nexport function piecePackageJson(options: {\n name: string;\n version: string;\n description?: string;\n main: string;\n license?: string;\n}): Record<string, unknown> {\n return {\n name: options.name,\n version: options.version,\n description: options.description ?? \"\",\n type: \"module\",\n main: options.main,\n ...(options.license ? { license: options.license } : {}),\n // Empty on purpose: the runtime treats a bundle that declares dependencies\n // as not self-contained, and everything a piece needs is inlined already.\n dependencies: {},\n };\n}\n\n// A prebuilt bundle's own package.json, restamped with the package's version.\nexport function bundlePackageJson(\n dir: string,\n version: string,\n): Record<string, unknown> {\n const current = JSON.parse(\n readFileSync(join(dir, \"package.json\"), \"utf8\"),\n ) as Record<string, unknown>;\n return { ...current, version };\n}\n\n// The descriptor written beside a piece: the list's name, the package's version,\n// then whatever the piece said about itself, in the framework's PieceMetadata shape.\nexport function pieceDescriptor(\n piece: PackagePiece,\n version: string,\n metadata: PieceMetadata,\n): Record<string, unknown> {\n const { name: _name, version: _version, ...rest } = metadata;\n return { name: piece.name, version, ...rest };\n}\n\n// The manifest's `pieces` with what the build learned: a built piece replaces\n// the source entry with its id in place, or is appended at the end.\n\n// A source entry nothing built is kept as it is and returned as `unbuilt`,\n// for the caller to warn about.\nexport function enrichManifestPieces(\n manifest: Manifest,\n built: BuiltPiece[],\n): { manifest: Manifest; unbuilt: string[] } {\n const byId = new Map(built.map((piece) => [piece.name, piece]));\n const toModule = (piece: BuiltPiece): PieceModule => ({\n id: piece.name,\n name: piece.displayName ?? piece.name,\n version: piece.version,\n ...(piece.description ? { description: piece.description } : {}),\n bundle: piece.bundle,\n descriptor: piece.descriptor,\n });\n const unbuilt: string[] = [];\n const seen = new Set<string>();\n const pieces: PieceModule[] = (manifest.pieces ?? []).map((entry) => {\n const hit = byId.get(entry.id);\n if (!hit) {\n unbuilt.push(entry.id);\n return entry;\n }\n seen.add(entry.id);\n return toModule(hit);\n });\n for (const piece of built) {\n if (!seen.has(piece.name)) pieces.push(toModule(piece));\n }\n return { manifest: { ...manifest, pieces }, unbuilt };\n}\n\nconst count = (record: unknown) =>\n typeof record === \"object\" && record !== null\n ? Object.keys(record).length\n : 0;\n\n// Build every planned piece, then read the built list and describe what it\n// names. Returns what was built, for the manifest.\nexport async function buildPieces(\n target: PieceBuildTarget,\n pkg: PackageIdentity,\n options: PieceBuildOptions,\n): Promise<BuiltPiece[]> {\n const { projectRoot, outDir } = target;\n assertPiecesOutDir(target);\n // resolve, not join: an absolute --out-dir is what the browser and node\n // steps hand tsdown, and joining it onto the project root mangles it.\n for (const piece of target.pieces) {\n console.log(`\\n▶ Building piece ${piece.dir}...`);\n await options.bundle(\n buildPieceBuildConfig({\n entry: resolve(projectRoot, piece.entry),\n outDir: resolve(projectRoot, piece.outDir),\n }),\n );\n }\n\n // The list is the source of truth for names; a package that\n // built pieces without a list has nothing a host could read.\n const listPath = pieceListPath(target);\n if (!existsSync(listPath)) {\n throw new Error(\n `pieces: ${toPosix(relative(projectRoot, listPath))} was not built; ` +\n `pieces/index.ts must export the list of pieces this package ships`,\n );\n }\n const described = describePieces(projectRoot, listPath);\n\n const built: BuiltPiece[] = [];\n const listedDirs = new Set<string>();\n for (const piece of described.list) {\n const location = resolvePieceLocation(piece, projectRoot, outDir);\n assertPieceVersion(piece, pkg);\n const failure = described.errors.find((e) => e.name === piece.name);\n if (failure) {\n throw new Error(\n `pieces: \"${piece.name}\" could not be described: ${failure.message}`,\n );\n }\n const found = described.pieces.find((p) => p.name === piece.name);\n if (!found) {\n throw new Error(`pieces: \"${piece.name}\" was not described`);\n }\n const metadata = found.metadata;\n const relDir = toPosix(relative(projectRoot, location.dir));\n listedDirs.add(relDir);\n\n writeFileSync(\n join(location.dir, \"descriptor.json\"),\n JSON.stringify(\n pieceDescriptor(piece, pkg.version, metadata),\n createJsonReplacer(),\n 2,\n ) + \"\\n\",\n );\n const piecePackage =\n location.form === \"entry\" && location.entryFile\n ? piecePackageJson({\n name: piece.name,\n version: pkg.version,\n description: metadata.description,\n main: relative(location.dir, location.entryFile),\n license: pkg.license,\n })\n : bundlePackageJson(location.dir, pkg.version);\n writeFileSync(\n join(location.dir, \"package.json\"),\n JSON.stringify(piecePackage, null, 2) + \"\\n\",\n );\n console.log(\n `piece: ${piece.name}@${pkg.version} -> ${relDir} ` +\n `(${count(metadata.actions)} actions, ${count(metadata.triggers)} triggers)`,\n );\n built.push({\n name: piece.name,\n version: pkg.version,\n displayName: metadata.displayName,\n description: metadata.description,\n bundle: relDir,\n descriptor: `${relDir}/descriptor.json`,\n });\n }\n\n warnUnlistedPieces(target.pieces, listedDirs);\n return built;\n}\n\n// A built piece no list entry points into ships without a host ever finding it.\nfunction warnUnlistedPieces(\n planned: PiecePlan[],\n listedDirs: Set<string>,\n): void {\n for (const piece of planned) {\n if (!listedDirs.has(toPosix(piece.outDir))) {\n console.warn(\n `⚠ pieces: pieces/${piece.dir} was built but pieces/index.ts does not list it; a host will not find it`,\n );\n }\n }\n}\n\n// Make sure the manifest ships under outDir (tsdown copies it only in the\n// browser build) and, when pieces were built, list them in that copy.\n\n// Always copied afresh: only <outDir>/node is cleaned by the builds, so a copy\n// left by the last build would otherwise outlive an edit to the source.\n\n// The source file is never written. Returns the path of the copy, if any.\nexport function syncDistManifest(\n target: PieceBuildTarget,\n built: BuiltPiece[],\n): string | undefined {\n const { projectRoot, outDir } = target;\n const source = join(projectRoot, \"powerhouse.manifest.json\");\n // resolve, not join: an absolute --out-dir is a location, not a suffix.\n const copy = resolve(projectRoot, outDir, \"powerhouse.manifest.json\");\n // The built list, not the source plan: a package whose pieces are all\n // `bundle:` entries has no pieces/<dir> and still ships pieces.\n const shipsPieces = existsSync(pieceListPath(target));\n if (!existsSync(source)) {\n if (shipsPieces) {\n console.warn(\"⚠ no powerhouse.manifest.json; pieces will not be listed\");\n }\n return undefined;\n }\n mkdirSync(dirname(copy), { recursive: true });\n copyFileSync(source, copy);\n if (!shipsPieces) return copy;\n\n const manifest = JSON.parse(readFileSync(copy, \"utf8\")) as Manifest;\n const enriched = enrichManifestPieces(manifest, built);\n for (const id of enriched.unbuilt) {\n console.warn(`⚠ manifest lists piece \"${id}\" but nothing built it`);\n }\n writeFileSync(copy, JSON.stringify(enriched.manifest, null, 2) + \"\\n\");\n return copy;\n}\n"],"mappings":";;;;;;AA+FA,MAAM,WAAW,MAAc,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;AAEpD,SAAgB,SAAS,GAAW;CAClC,IAAI;EACF,OAAO,SAAS,CAAC;CACnB,QAAQ;EACN,OAAO;CACT;AACF;AAIA,SAAgB,iBAAiB,MAAc,OAA2B;CACxE,MAAM,wBAAQ,IAAI,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CAC5C,aAAa,QAAQ,IAAI;CACzB,IAAI,CAAC,aAAa,OAAO;CAGzB,MAAM,WAAW,qBADA,KAAK,MAAM,aAAa,MAAM,MAAM,CACR,GAAG,KAAK;CACrD,KAAK,MAAM,MAAM,SAAS,SACxB,QAAQ,KAAK,2BAA2B,GAAG,uBAAuB;CAEpE,cAAc,MAAM,KAAK,UAAU,SAAS,UAAU,MAAM,CAAC,IAAI,IAAI;CACrE,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"build-pieces.mjs","names":[],"sources":["../../clis/external-deps.mts","../../clis/build-pieces.mts"],"sourcesContent":["// External dependencies: a package whose code needs a native addon or a\n// WebAssembly module cannot be inlined, so it stays a bare import the host installs.\nimport { readdirSync, readFileSync, realpathSync } from \"node:fs\";\nimport { isBuiltin } from \"node:module\";\nimport { isAbsolute, join, relative, sep } from \"node:path\";\nimport type { InlineConfig } from \"tsdown\";\n\n/** The files one module needs at run time, and why each was included. */\nexport type FileTrace = {\n /** Absolute paths. */\n fileList: Set<string>;\n /** Absolute path -> the absolute paths of the files that pulled it in. */\n reasons: Map<string, { parents: Set<string> }>;\n};\n\n/** Traces one file: @vercel/nft's nodeFileTrace, handed in by the CLI. */\nexport type TraceFiles = (file: string) => Promise<FileTrace>;\n\n/** A file the bundle cannot carry: a native addon or a WebAssembly module. */\nexport type RequiredFile = { file: string; kind: \"native\" | \"wasm\" };\n\nexport type ExternalDependency = RequiredFile & {\n name: string;\n version: string;\n /** The first of the package's own files seen importing it. */\n importer?: string;\n};\n\n/** What one `ph build` learns about packages, shared by all of its builds. */\nexport type DetectionCache = {\n files: Map<string, Promise<RequiredFile | undefined>>;\n wasm: Map<string, string | undefined>;\n};\n\nexport const createDetectionCache = (): DetectionCache => ({\n files: new Map(),\n wasm: new Map(),\n});\n\nexport type ExternalDepsPluginOptions = {\n /** The project root the dirs below are relative to. */\n root?: string;\n /** Browser build: a native package fails it; WebAssembly is bundled. */\n browser?: boolean;\n /** Dirs whose imports the bundler handles as usual: code no host runs. */\n ignoreDirs?: string[];\n /** Dirs that may not import a native or WebAssembly package. */\n forbidDirs?: string[];\n cache?: DetectionCache;\n};\n\ntype Plugin = NonNullable<InlineConfig[\"plugins\"]>;\n\ntype PackageJson = {\n name?: string;\n version?: string;\n dependencies?: Record<string, string>;\n optionalDependencies?: Record<string, string>;\n peerDependencies?: Record<string, string>;\n};\n\nconst NODE_MODULES = `${sep}node_modules${sep}`;\n\n/** `file` relative to `root`, with forward slashes on every platform. */\nexport function projectPath(root: string, file: string): string {\n return relative(root, file).split(sep).join(\"/\");\n}\n\n// Windows paths compare case-insensitively, drive letter included.\nconst samePath = (file: string) =>\n process.platform === \"win32\" ? file.toLowerCase() : file;\n\n// \"@scope/name/sub\" -> \"@scope/name\", \"name/sub\" -> \"name\".\nexport function packageNameOf(specifier: string): string | undefined {\n if (specifier.startsWith(\".\") || isAbsolute(specifier)) return undefined;\n const parts = specifier.split(\"/\");\n const name = specifier.startsWith(\"@\")\n ? parts.slice(0, 2).join(\"/\")\n : parts[0];\n return name || undefined;\n}\n\n// The root of the installed package a file belongs to, if it is in one.\nexport function packageRootOf(file: string): string | undefined {\n const at = file.lastIndexOf(NODE_MODULES);\n if (at < 0) return undefined;\n const rest = file.slice(at + NODE_MODULES.length).split(sep);\n const depth = rest[0]?.startsWith(\"@\") ? 2 : 1;\n if (rest.length <= depth) return undefined;\n return join(file.slice(0, at + NODE_MODULES.length), ...rest.slice(0, depth));\n}\n\nfunction readPackageJson(root: string): PackageJson | undefined {\n try {\n return JSON.parse(\n readFileSync(join(root, \"package.json\"), \"utf8\"),\n ) as PackageJson;\n } catch {\n return undefined;\n }\n}\n\n// Only links the importer requires count: an optional peer such as\n// ws -> bufferutil is a speed-up the importer runs without.\nfunction requires(importerRoot: string, importedRoot: string): boolean {\n const importer = readPackageJson(importerRoot);\n const name = readPackageJson(importedRoot)?.name;\n if (!importer || !name) return false;\n return (\n importer.dependencies?.[name] !== undefined ||\n importer.optionalDependencies?.[name] !== undefined\n );\n}\n\n// The first .wasm file in a package's own files. Presence is enough: most\n// packages compute the path or let their caller pass it, so a trace misses it.\nfunction wasmIn(root: string, cache?: DetectionCache): string | undefined {\n if (cache?.wasm.has(root)) return cache.wasm.get(root);\n const found = scanForWasm(root);\n cache?.wasm.set(root, found);\n return found;\n}\n\nfunction scanForWasm(root: string): string | undefined {\n try {\n const found = readdirSync(root, { recursive: true, encoding: \"utf8\" }).find(\n (file) =>\n file.endsWith(\".wasm\") && !file.split(sep).includes(\"node_modules\"),\n );\n return found && join(root, found);\n } catch {\n return undefined;\n }\n}\n\n/** The first file `entry` cannot load without that a bundle cannot carry. */\nexport async function findRequiredFile(\n entry: string,\n trace: TraceFiles,\n cache?: DetectionCache,\n): Promise<RequiredFile | undefined> {\n const { fileList, reasons } = await trace(entry);\n // A tracer reports real paths, and the entry may sit behind a symlink.\n const start = samePath(realpathSync(entry));\n // What to report, and the traced file the walk back to the entry starts at.\n const candidates: (RequiredFile & { from: string })[] = [...fileList]\n .filter((file) => file.endsWith(\".node\"))\n .map((file) => ({ file, kind: \"native\" as const, from: file }));\n {\n const traced = new Map<string, string>();\n for (const file of fileList) {\n const root = packageRootOf(file);\n if (root && !traced.has(root) && /\\.[cm]?js$/.test(file)) {\n traced.set(root, file);\n }\n }\n const tracedWasm = [...fileList].filter((file) => file.endsWith(\".wasm\"));\n for (const [root, from] of traced) {\n const file =\n tracedWasm.find((wasm) => packageRootOf(wasm) === root) ??\n wasmIn(root, cache);\n if (file) candidates.push({ file, kind: \"wasm\", from });\n }\n }\n for (const { from, ...required } of candidates) {\n // Back to the entry, crossing into a parent's package only when that\n // package requires the one being left.\n const seen = new Set([from]);\n const queue = [from];\n while (queue.length > 0) {\n const file = queue.shift()!;\n if (samePath(file) === start) return required;\n for (const parent of reasons.get(file)?.parents ?? []) {\n if (seen.has(parent)) continue;\n const fromRoot = packageRootOf(parent);\n const toRoot = packageRootOf(file);\n if (\n fromRoot !== toRoot &&\n (!fromRoot || !toRoot || !requires(fromRoot, toRoot))\n ) {\n continue;\n }\n seen.add(parent);\n queue.push(parent);\n }\n }\n }\n return undefined;\n}\n\n/** Keeps each package the code imports that needs such a file out of the bundle. */\nexport function externalDepsPlugin(\n trace: TraceFiles,\n found: Map<string, ExternalDependency>,\n options: ExternalDepsPluginOptions = {},\n): Plugin {\n const cache = options.cache ?? createDetectionCache();\n const root = options.root ?? process.cwd();\n const show = (file: string) => projectPath(root, file);\n const inDir = (id: string, dirs: string[] = []) =>\n dirs.some((dir) => show(id).startsWith(`${dir}/`));\n // By resolved file: a package's subpaths can differ in what they load.\n const detect = (id: string) => {\n let verdict = cache.files.get(id);\n if (!verdict) {\n verdict = findRequiredFile(id, trace, cache);\n cache.files.set(id, verdict);\n }\n return verdict;\n };\n return {\n name: \"powerhouse:external-deps\",\n async resolveId(source, importer, extra) {\n // The project's own imports only: whatever a dependency pulls in goes\n // wherever that dependency goes.\n if (!importer || importer.includes(NODE_MODULES)) return null;\n if (isBuiltin(source) || inDir(importer, options.ignoreDirs)) return null;\n const name = packageNameOf(source);\n if (!name) return null;\n const resolved = await this.resolve(source, importer, {\n ...extra,\n skipSelf: true,\n });\n if (!resolved || resolved.external) return null;\n const required = await detect(resolved.id);\n const pkgRoot = packageRootOf(resolved.id);\n const version = pkgRoot ? readPackageJson(pkgRoot)?.version : undefined;\n if (!required || !version) return null;\n const what =\n required.kind === \"native\"\n ? `the native addon ${show(required.file)}`\n : `the WebAssembly module ${show(required.file)}`;\n if (options.browser) {\n if (required.kind === \"wasm\") return null;\n throw new Error(\n `${show(importer)} imports ${name}, which needs ${what}. ` +\n \"Native code cannot run in the browser: import it only from subgraphs, switchboard processors or pieces.\",\n );\n }\n if (inDir(importer, options.forbidDirs)) {\n throw new Error(\n `${show(importer)} imports ${name}, which needs ${what}. ` +\n \"Document models run in Connect and on every host: use it from a subgraph, processor or piece instead.\",\n );\n }\n if (!found.has(name)) {\n found.set(name, { name, version, ...required, importer });\n }\n return { id: source, external: true };\n },\n };\n}\n\n/**\n * The detected packages `pkg` does not install for its consumers: anything\n * outside dependencies, optionalDependencies and peerDependencies.\n */\nexport function undeclaredExternalDependencies(\n found: Iterable<ExternalDependency>,\n pkg: Partial<\n Record<\n \"dependencies\" | \"optionalDependencies\" | \"peerDependencies\",\n Partial<Record<string, string>>\n >\n >,\n): ExternalDependency[] {\n return [...found].filter(\n (dep) =>\n pkg.dependencies?.[dep.name] === undefined &&\n pkg.optionalDependencies?.[dep.name] === undefined &&\n pkg.peerDependencies?.[dep.name] === undefined,\n );\n}\n\n/** name -> version, sorted by name. */\nexport function externalDependencyVersions(\n found: Iterable<ExternalDependency>,\n): Record<string, string> {\n return Object.fromEntries(\n [...found]\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((dep) => [dep.name, dep.version]),\n );\n}\n","// The pieces half of a package build: find and bundle each piece whole, load\n// it once in a child process to learn what it is, and write what a host reads.\nimport { execFileSync } from \"node:child_process\";\nimport {\n copyFileSync,\n existsSync,\n mkdirSync,\n mkdtempSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport {\n basename,\n dirname,\n isAbsolute,\n join,\n relative,\n resolve,\n sep,\n} from \"node:path\";\nimport type { InlineConfig } from \"tsdown\";\nimport type { Manifest, PieceModule } from \"../document-model/types.js\";\nimport { buildPieceBuildConfig, PIECE_ENTRY_GLOB } from \"./build-config.mjs\";\nimport {\n externalDependencyVersions,\n externalDepsPlugin,\n projectPath,\n type DetectionCache,\n type ExternalDependency,\n type TraceFiles,\n} from \"./external-deps.mjs\";\n\nexport {\n createDetectionCache,\n projectPath,\n findRequiredFile,\n externalDependencyVersions,\n externalDepsPlugin,\n undeclaredExternalDependencies,\n} from \"./external-deps.mjs\";\nexport type {\n DetectionCache,\n FileTrace,\n ExternalDependency,\n ExternalDepsPluginOptions,\n TraceFiles,\n} from \"./external-deps.mjs\";\n\nexport type PiecePlan = {\n /** The directory under pieces/, and so under <outDir>/node/pieces. */\n dir: string;\n /** Source entry, relative to the project root: pieces/<dir>/index.ts. */\n entry: string;\n /** Where the piece lands, relative to the project root. */\n outDir: string;\n};\n\n// What buildPieces needs to know about the package it works in: where it is,\n// where it builds to, and which pieces the plan found.\nexport type PieceBuildTarget = {\n projectRoot: string;\n outDir: string;\n pieces: PiecePlan[];\n};\n\n// One entry of pieces/index.ts, as @powerhousedao/pieces-framework declares it.\n// Declared here so the build needs no dependency on a package meant for pieces.\nexport type PackagePiece = {\n name: string;\n entry?: string;\n bundle?: string;\n};\n\n// What a piece says about itself, in the framework's PieceMetadata shape.\n// Read from the built piece, so nothing in the build has to know the framework.\nexport type PieceMetadata = Record<string, unknown> & {\n displayName?: string;\n description?: string;\n actions?: Record<string, unknown>;\n triggers?: Record<string, unknown>;\n};\n\nexport type DescribedPiece = {\n name: string;\n metadata: PieceMetadata;\n};\n\nexport type DescribeResult = {\n list: PackagePiece[];\n pieces: DescribedPiece[];\n errors: { name: string; message: string }[];\n};\n\nexport type BuiltPiece = {\n name: string;\n version: string;\n displayName?: string;\n description?: string;\n /** Piece directory, relative to the project root, `/` separated. */\n bundle: string;\n /** The descriptor inside it, relative to the project root, `/` separated. */\n descriptor: string;\n};\n\nexport type PackageIdentity = {\n name: string;\n version: string;\n license?: string;\n};\n\nexport type PieceBuildOptions = {\n /** The bundler: tsdown's `build`, handed in so this module never loads it. */\n bundle: (config: InlineConfig) => Promise<unknown>;\n /** Traces a module's run-time files; without it nothing is kept external. */\n trace?: TraceFiles;\n cache?: DetectionCache;\n};\n\nconst toPosix = (p: string) => p.split(sep).join(\"/\");\n\nexport function statSafe(p: string) {\n try {\n return statSync(p);\n } catch {\n return null;\n }\n}\n\n// Expand entry globs (single-`*` segments only — the shape `browserEntry`\n// uses) against files on disk, resolving against `root`.\nexport function expandEntryGlobs(root: string, globs: string[]): string[] {\n const files = new Set<string>();\n for (const pattern of globs) {\n const segments = pattern.split(\"/\").filter(Boolean);\n let dirs = [root];\n for (const seg of segments) {\n const next: string[] = [];\n for (const d of dirs) {\n if (!statSafe(d)?.isDirectory()) continue;\n if (seg === \"*\") {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n next.push(join(d, e.name));\n }\n } else {\n next.push(join(d, seg));\n }\n }\n dirs = next;\n }\n for (const f of dirs) {\n if (statSafe(f)?.isFile()) files.add(f);\n }\n }\n return [...files];\n}\n\n// The pieces a project holds, one per pieces/<dir>/index.ts, sorted by dir so\n// a build log and a manifest read the same from one run to the next.\nexport function planPieces(projectRoot: string, outDir: string): PiecePlan[] {\n return expandEntryGlobs(projectRoot, [PIECE_ENTRY_GLOB])\n .map((file) => {\n const dir = basename(dirname(file));\n return {\n dir,\n entry: relative(projectRoot, file),\n outDir: join(outDir, \"node\", \"pieces\", dir),\n };\n })\n .sort((a, b) => (a.dir < b.dir ? -1 : a.dir > b.dir ? 1 : 0));\n}\n\n// A JSON.stringify replacer that makes a piece's metadata serializable: props\n// carry resolvers, defaults may be class instances, and a schema may cycle.\nexport function createJsonReplacer() {\n const ancestors: object[] = [];\n return function replace(this: unknown, _key: string, value: unknown) {\n if (typeof value === \"function\" || value === undefined) return undefined;\n if (typeof value === \"bigint\") return value.toString();\n if (typeof value !== \"object\" || value === null) return value;\n // `this` is the holder, so popping back to it leaves the current path.\n while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();\n if (ancestors.includes(value)) return undefined;\n ancestors.push(value);\n return value;\n };\n}\n\n// The half of the child script that needs nothing from the job: a test\n// evaluates this text on its own, so neither copy can drift from the other.\n\n// `constructor?.name`: a module may export an Object.create(null), and the\n// real piece is usually beside it in the same module.\nexport const DESCRIBE_HELPERS = `\nconst isRecord = (value) => typeof value === \"object\" && value !== null;\n\nfunction findPiece(mod) {\n const candidates = [\n ...Object.values(mod),\n ...(isRecord(mod.default) ? Object.values(mod.default) : []),\n mod.default,\n ];\n for (const candidate of candidates) {\n if (isRecord(candidate) && candidate.constructor?.name === \"Piece\") {\n return candidate;\n }\n }\n for (const candidate of candidates) {\n if (\n isRecord(candidate) &&\n typeof candidate.displayName === \"string\" &&\n (isRecord(candidate.actions) ||\n typeof candidate.actions === \"function\" ||\n typeof candidate.getAction === \"function\")\n ) {\n return candidate;\n }\n }\n return undefined;\n}\n\nfunction describePiece(piece) {\n if (typeof piece.metadata === \"function\") return piece.metadata();\n const call = (value) => (typeof value === \"function\" ? value.call(piece) : value);\n return {\n displayName: piece.displayName,\n logoUrl: piece.logoUrl,\n description: piece.description,\n authors: piece.authors,\n categories: piece.categories,\n auth: piece.auth,\n minimumSupportedRelease: piece.minimumSupportedRelease,\n maximumSupportedRelease: piece.maximumSupportedRelease,\n deprecated: piece.deprecated,\n actions: call(piece.actions) ?? {},\n triggers: call(piece.triggers) ?? {},\n };\n}\n\nfunction createJsonReplacer() {\n const ancestors = [];\n return function replace(_key, value) {\n if (typeof value === \"function\" || value === undefined) return undefined;\n if (typeof value === \"bigint\") return value.toString();\n if (typeof value !== \"object\" || value === null) return value;\n while (ancestors.length > 0 && ancestors.at(-1) !== this) ancestors.pop();\n if (ancestors.includes(value)) return undefined;\n ancestors.push(value);\n return value;\n };\n}\n`;\n\n// Runs in a child node process: loading a piece runs piece-authored top-level\n// code, and the runtime describes pieces in a worker for the same reason.\n\n// A string so it works from `src` under bun or tsx as well as from `dist`. It\n// answers through a file, leaving both its streams to the piece.\nexport const DESCRIBE_SCRIPT = `\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { isAbsolute, join } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nconst job = JSON.parse(readFileSync(process.argv[2], \"utf8\"));\n${DESCRIBE_HELPERS}\n// Says why the child gave up in the one place the parent always reads, so a\n// failure reports the cause and never the text of this script.\nfunction fail(message) {\n writeFileSync(job.outFile, JSON.stringify({ fatal: message }));\n process.exit(1);\n}\n\n// The module to load for a list entry; a bundle names its own main.\nfunction entryFile(piece) {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\") return undefined;\n const path = isAbsolute(declared) ? declared : join(job.projectRoot, declared);\n if (piece.entry) return path;\n const pkgFile = join(path, \"package.json\");\n if (!existsSync(pkgFile)) return undefined;\n const pkg = JSON.parse(readFileSync(pkgFile, \"utf8\"));\n return join(path, typeof pkg.main === \"string\" ? pkg.main : \"index.mjs\");\n}\n\nlet listModule;\ntry {\n listModule = await import(pathToFileURL(job.listPath).href);\n} catch (error) {\n fail(job.listPath + \" threw on import: \" + (error instanceof Error ? error.message : String(error)));\n}\nconst list = listModule.pieces ?? listModule.default;\nif (!Array.isArray(list)) {\n fail(job.listPath + ' exports no \"pieces\" array');\n}\n\nconst out = { list, pieces: [], errors: [] };\nfor (const piece of list) {\n const file = entryFile(piece);\n // A missing file is the parent's to report, with the message it owns.\n if (!file || !existsSync(file)) continue;\n try {\n const mod = await import(pathToFileURL(file).href);\n const found = findPiece(mod);\n if (!found) {\n throw new Error(\n \"no Piece export found in \" + file + \"; exports: \" + Object.keys(mod).join(\", \"),\n );\n }\n const metadata = JSON.parse(JSON.stringify(describePiece(found), createJsonReplacer()));\n out.pieces.push({ name: piece.name, metadata });\n } catch (error) {\n out.errors.push({\n name: piece.name,\n message: error instanceof Error ? error.message : String(error),\n });\n }\n}\nwriteFileSync(job.outFile, JSON.stringify(out, createJsonReplacer()));\n`;\n\n// What the child said went wrong, if it got that far, and otherwise how it\n// died: an exit status, never the whole script an `Error.message` carries.\nfunction childFailure(error: unknown, outFile: string): string {\n try {\n const answer = JSON.parse(readFileSync(outFile, \"utf8\")) as {\n fatal?: unknown;\n };\n if (typeof answer.fatal === \"string\") return answer.fatal;\n } catch {\n // no answer on disk: fall through to the exit status\n }\n const { status, signal } = error as {\n status?: number | null;\n signal?: string | null;\n };\n if (signal) return `the describe child was killed by ${signal}`;\n return `the describe child exited with code ${status ?? \"unknown\"}`;\n}\n\n// Load the built list and every piece it names in a child process and return\n// what they say about themselves. Throws when the list itself cannot be read.\n\n// Both of the child's streams are the parent's, so a piece that prints at\n// import time is heard rather than mixed into the answer.\nexport function describePieces(\n projectRoot: string,\n listPath: string,\n): DescribeResult {\n const dir = mkdtempSync(join(tmpdir(), \"ph-build-pieces-\"));\n const rel = toPosix(relative(projectRoot, listPath));\n try {\n const jobFile = join(dir, \"job.json\");\n const scriptFile = join(dir, \"describe.mjs\");\n const outFile = join(dir, \"describe.json\");\n writeFileSync(scriptFile, DESCRIBE_SCRIPT);\n writeFileSync(jobFile, JSON.stringify({ projectRoot, listPath, outFile }));\n try {\n execFileSync(process.execPath, [scriptFile, jobFile], {\n timeout: 60_000,\n stdio: \"inherit\",\n });\n } catch (error) {\n throw new Error(\n `pieces: could not load ${rel}: ${childFailure(error, outFile)}`,\n { cause: error },\n );\n }\n return JSON.parse(readFileSync(outFile, \"utf8\")) as DescribeResult;\n } finally {\n rmSync(dir, { recursive: true, force: true });\n }\n}\n\nexport type PieceLocation = {\n /** The piece directory, absolute. */\n dir: string;\n /** The module file, absolute; unset for a bundle, whose package.json names it. */\n entryFile?: string;\n form: \"entry\" | \"bundle\";\n};\n\n// Where a list entry says its built piece is, checked against the disk: a\n// listed piece nobody built would otherwise fail much later, in a host.\nexport function resolvePieceLocation(\n piece: PackagePiece,\n projectRoot: string,\n outDir: string,\n): PieceLocation {\n const declared = piece.entry ?? piece.bundle;\n if (typeof declared !== \"string\" || declared === \"\") {\n throw new Error(\n `pieces: \"${piece.name}\" declares neither an entry nor a bundle`,\n );\n }\n const path = isAbsolute(declared) ? declared : join(projectRoot, declared);\n const form = piece.entry ? \"entry\" : \"bundle\";\n const present =\n form === \"entry\"\n ? statSafe(path)?.isFile()\n : statSafe(join(path, \"package.json\"))?.isFile();\n if (!present) {\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is missing`,\n );\n }\n const dir = form === \"entry\" ? dirname(path) : path;\n // Both forms, not just `entry`: a descriptor.json is written into this\n // directory, and outside outDir that lands in tracked source.\n const piecesRoot = resolve(projectRoot, outDir, \"node\", \"pieces\");\n const inside = relative(piecesRoot, dir);\n if (inside === \"\" || inside.startsWith(\"..\") || isAbsolute(inside)) {\n const expected = toPosix(join(outDir, \"node\", \"pieces\"));\n throw new Error(\n `pieces: \"${piece.name}\" declares ${declared}, which is outside ${expected}/; ` +\n `a piece is built to ${expected}/<dir>/index.mjs and its entry must point there`,\n );\n }\n return form === \"entry\" ? { dir, entryFile: path, form } : { dir, form };\n}\n\n// Where the node build leaves the list of pieces a package ships. Its presence\n// on disk, not a pieces/<dir> in the source, is what says a package has them.\nexport function pieceListPath(target: {\n projectRoot: string;\n outDir: string;\n}): string {\n return resolve(\n target.projectRoot,\n target.outDir,\n \"node\",\n \"pieces\",\n \"index.mjs\",\n );\n}\n\n// `dist` is not a default here but a contract: a host reads a piece from\n// dist/node/pieces/<name>, and a list entry names that path literally.\nexport function assertPiecesOutDir(target: {\n outDir: string;\n pieces: PiecePlan[];\n}): void {\n if (target.pieces.length === 0 || target.outDir === \"dist\") return;\n throw new Error(\n `pieces: --out-dir ${target.outDir} cannot hold pieces; a piece is loaded from ` +\n `dist/node/pieces/<name> by the host, so a package that ships pieces builds to dist`,\n );\n}\n\n// A piece's version is its package's, written by the build; a list entry that\n// declares one is refused, so `name@version` always names one tarball.\nexport function assertPieceVersion(\n piece: PackagePiece,\n pkg: PackageIdentity,\n): void {\n if (\"version\" in piece) {\n throw new Error(\n `pieces: \"${piece.name}\" declares version ${String(piece.version)}; a piece takes its package's version (${pkg.version}), so remove \"version\" from pieces/index.ts`,\n );\n }\n}\n\n// The package.json written beside a piece built from an `entry`, giving the\n// directory npm-bundle shape so a registry can serve it on its own.\nexport function piecePackageJson(options: {\n name: string;\n version: string;\n description?: string;\n main: string;\n license?: string;\n dependencies?: Record<string, string>;\n}): Record<string, unknown> {\n return {\n name: options.name,\n version: options.version,\n description: options.description ?? \"\",\n type: \"module\",\n main: options.main,\n ...(options.license ? { license: options.license } : {}),\n // Only external packages: everything else is inlined, and a host installs\n // what is listed here before it loads the piece.\n dependencies: options.dependencies ?? {},\n };\n}\n\n// A prebuilt bundle's own package.json, restamped with the package's version.\nexport function bundlePackageJson(\n dir: string,\n version: string,\n): Record<string, unknown> {\n const current = JSON.parse(\n readFileSync(join(dir, \"package.json\"), \"utf8\"),\n ) as Record<string, unknown>;\n return { ...current, version };\n}\n\n// The descriptor written beside a piece: the list's name, the package's version,\n// then whatever the piece said about itself, in the framework's PieceMetadata shape.\nexport function pieceDescriptor(\n piece: PackagePiece,\n version: string,\n metadata: PieceMetadata,\n): Record<string, unknown> {\n const { name: _name, version: _version, ...rest } = metadata;\n return { name: piece.name, version, ...rest };\n}\n\n// The manifest's `pieces` with what the build learned: a built piece replaces\n// the source entry with its id in place, or is appended at the end.\n\n// A source entry nothing built is kept as it is and returned as `unbuilt`,\n// for the caller to warn about.\nexport function enrichManifestPieces(\n manifest: Manifest,\n built: BuiltPiece[],\n): { manifest: Manifest; unbuilt: string[] } {\n const byId = new Map(built.map((piece) => [piece.name, piece]));\n const toModule = (piece: BuiltPiece): PieceModule => ({\n id: piece.name,\n name: piece.displayName ?? piece.name,\n version: piece.version,\n ...(piece.description ? { description: piece.description } : {}),\n bundle: piece.bundle,\n descriptor: piece.descriptor,\n });\n const unbuilt: string[] = [];\n const seen = new Set<string>();\n const pieces: PieceModule[] = (manifest.pieces ?? []).map((entry) => {\n const hit = byId.get(entry.id);\n if (!hit) {\n unbuilt.push(entry.id);\n return entry;\n }\n seen.add(entry.id);\n return toModule(hit);\n });\n for (const piece of built) {\n if (!seen.has(piece.name)) pieces.push(toModule(piece));\n }\n return { manifest: { ...manifest, pieces }, unbuilt };\n}\n\nconst count = (record: unknown) =>\n typeof record === \"object\" && record !== null\n ? Object.keys(record).length\n : 0;\n\n// Build every planned piece, then read the built list and describe what it\n// names. Returns what was built, for the manifest.\nexport async function buildPieces(\n target: PieceBuildTarget,\n pkg: PackageIdentity,\n options: PieceBuildOptions,\n): Promise<BuiltPiece[]> {\n const { projectRoot, outDir } = target;\n assertPiecesOutDir(target);\n // resolve, not join: an absolute --out-dir is what the browser and node\n // steps hand tsdown, and joining it onto the project root mangles it.\n const externalByDir = new Map<string, Map<string, ExternalDependency>>();\n for (const piece of target.pieces) {\n console.log(`\\n▶ Building piece ${piece.dir}...`);\n const outDir = resolve(projectRoot, piece.outDir);\n const external = new Map<string, ExternalDependency>();\n await options.bundle(\n buildPieceBuildConfig({\n entry: resolve(projectRoot, piece.entry),\n outDir,\n ...(options.trace\n ? {\n plugins: [\n externalDepsPlugin(options.trace, external, {\n root: projectRoot,\n ...(options.cache ? { cache: options.cache } : {}),\n }),\n ],\n }\n : {}),\n }),\n );\n for (const dep of external.values()) {\n console.log(\n `piece ${piece.dir}: ${dep.name}@${dep.version} stays external, it needs ${projectPath(projectRoot, dep.file)}`,\n );\n }\n externalByDir.set(outDir, external);\n }\n\n // The list is the source of truth for names; a package that\n // built pieces without a list has nothing a host could read.\n const listPath = pieceListPath(target);\n if (!existsSync(listPath)) {\n throw new Error(\n `pieces: ${toPosix(relative(projectRoot, listPath))} was not built; ` +\n `pieces/index.ts must export the list of pieces this package ships`,\n );\n }\n const described = describePieces(projectRoot, listPath);\n\n const built: BuiltPiece[] = [];\n const listedDirs = new Set<string>();\n for (const piece of described.list) {\n const location = resolvePieceLocation(piece, projectRoot, outDir);\n assertPieceVersion(piece, pkg);\n const failure = described.errors.find((e) => e.name === piece.name);\n if (failure) {\n throw new Error(\n `pieces: \"${piece.name}\" could not be described: ${failure.message}`,\n );\n }\n const found = described.pieces.find((p) => p.name === piece.name);\n if (!found) {\n throw new Error(`pieces: \"${piece.name}\" was not described`);\n }\n const metadata = found.metadata;\n const relDir = toPosix(relative(projectRoot, location.dir));\n listedDirs.add(relDir);\n\n writeFileSync(\n join(location.dir, \"descriptor.json\"),\n JSON.stringify(\n pieceDescriptor(piece, pkg.version, metadata),\n createJsonReplacer(),\n 2,\n ) + \"\\n\",\n );\n const piecePackage =\n location.form === \"entry\" && location.entryFile\n ? piecePackageJson({\n name: piece.name,\n version: pkg.version,\n description: metadata.description,\n main: relative(location.dir, location.entryFile),\n license: pkg.license,\n dependencies: externalDependencyVersions(\n externalByDir.get(resolve(location.dir))?.values() ?? [],\n ),\n })\n : bundlePackageJson(location.dir, pkg.version);\n writeFileSync(\n join(location.dir, \"package.json\"),\n JSON.stringify(piecePackage, null, 2) + \"\\n\",\n );\n console.log(\n `piece: ${piece.name}@${pkg.version} -> ${relDir} ` +\n `(${count(metadata.actions)} actions, ${count(metadata.triggers)} triggers)`,\n );\n built.push({\n name: piece.name,\n version: pkg.version,\n displayName: metadata.displayName,\n description: metadata.description,\n bundle: relDir,\n descriptor: `${relDir}/descriptor.json`,\n });\n }\n\n warnUnlistedPieces(target.pieces, listedDirs);\n return built;\n}\n\n// A built piece no list entry points into ships without a host ever finding it.\nfunction warnUnlistedPieces(\n planned: PiecePlan[],\n listedDirs: Set<string>,\n): void {\n for (const piece of planned) {\n if (!listedDirs.has(toPosix(piece.outDir))) {\n console.warn(\n `⚠ pieces: pieces/${piece.dir} was built but pieces/index.ts does not list it; a host will not find it`,\n );\n }\n }\n}\n\n// Make sure the manifest ships under outDir (tsdown copies it only in the\n// browser build) and, when pieces were built, list them in that copy.\n\n// Always copied afresh: only <outDir>/node is cleaned by the builds, so a copy\n// left by the last build would otherwise outlive an edit to the source.\n\n// The source file is never written. Returns the path of the copy, if any.\nexport function syncDistManifest(\n target: PieceBuildTarget,\n built: BuiltPiece[],\n externalDependencies: Record<string, string> = {},\n): string | undefined {\n const { projectRoot, outDir } = target;\n const source = join(projectRoot, \"powerhouse.manifest.json\");\n // resolve, not join: an absolute --out-dir is a location, not a suffix.\n const copy = resolve(projectRoot, outDir, \"powerhouse.manifest.json\");\n // The built list, not the source plan: a package whose pieces are all\n // `bundle:` entries has no pieces/<dir> and still ships pieces.\n const shipsPieces = existsSync(pieceListPath(target));\n const shipsExternal = Object.keys(externalDependencies).length > 0;\n if (!existsSync(source)) {\n if (shipsPieces) {\n console.warn(\"⚠ no powerhouse.manifest.json; pieces will not be listed\");\n }\n if (shipsExternal) {\n console.warn(\n \"⚠ no powerhouse.manifest.json; external dependencies will not be listed\",\n );\n }\n return undefined;\n }\n mkdirSync(dirname(copy), { recursive: true });\n copyFileSync(source, copy);\n if (!shipsPieces && !shipsExternal) return copy;\n\n let manifest = JSON.parse(readFileSync(copy, \"utf8\")) as Manifest;\n if (shipsPieces) {\n const enriched = enrichManifestPieces(manifest, built);\n for (const id of enriched.unbuilt) {\n console.warn(`⚠ manifest lists piece \"${id}\" but nothing built it`);\n }\n manifest = enriched.manifest;\n }\n if (shipsExternal) manifest = { ...manifest, externalDependencies };\n writeFileSync(copy, JSON.stringify(manifest, null, 2) + \"\\n\");\n return copy;\n}\n"],"mappings":";;;;;;;AAkCA,MAAa,8BAA8C;CACzD,uBAAO,IAAI,IAAI;CACf,sBAAM,IAAI,IAAI;AAChB;AAwBA,MAAM,eAAe,GAAG,IAAI,cAAc;;AAG1C,SAAgB,YAAY,MAAc,MAAsB;CAC9D,OAAO,SAAS,MAAM,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,GAAG;AACjD;AAGA,MAAM,YAAY,SAChB,QAAQ,aAAa,UAAU,KAAK,YAAY,IAAI;AAGtD,SAAgB,cAAc,WAAuC;CACnE,IAAI,UAAU,WAAW,GAAG,KAAK,WAAW,SAAS,GAAG,OAAO,KAAA;CAC/D,MAAM,QAAQ,UAAU,MAAM,GAAG;CAIjC,QAHa,UAAU,WAAW,GAAG,IACjC,MAAM,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAC1B,MAAM,OACK,KAAA;AACjB;AAGA,SAAgB,cAAc,MAAkC;CAC9D,MAAM,KAAK,KAAK,YAAY,YAAY;CACxC,IAAI,KAAK,GAAG,OAAO,KAAA;CACnB,MAAM,OAAO,KAAK,MAAM,KAAK,aAAa,MAAM,CAAC,CAAC,MAAM,GAAG;CAC3D,MAAM,QAAQ,KAAK,EAAE,EAAE,WAAW,GAAG,IAAI,IAAI;CAC7C,IAAI,KAAK,UAAU,OAAO,OAA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CAAC,CAAC,SAAS;CACjE,IAAI,CAAC,WAAW,MAAM,GAAG;EACvB,IAAI,aACF,QAAQ,KAAK,0DAA0D;EAEzE,IAAI,eACF,QAAQ,KACN,yEACF;EAEF;CACF;CACA,UAAU,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;CAC5C,aAAa,QAAQ,IAAI;CACzB,IAAI,CAAC,eAAe,CAAC,eAAe,OAAO;CAE3C,IAAI,WAAW,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC;CACpD,IAAI,aAAa;EACf,MAAM,WAAW,qBAAqB,UAAU,KAAK;EACrD,KAAK,MAAM,MAAM,SAAS,SACxB,QAAQ,KAAK,2BAA2B,GAAG,uBAAuB;EAEpE,WAAW,SAAS;CACtB;CACA,IAAI,eAAe,WAAW;EAAE,GAAG;EAAU;CAAqB;CAClE,cAAc,MAAM,KAAK,UAAU,UAAU,MAAM,CAAC,IAAI,IAAI;CAC5D,OAAO;AACT"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as
|
|
2
|
-
export { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, SECONDS_IN_DAY, SERVICE_ACTIONS, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, externalDependencies, externalDevDependencies, packageJsonExports, packageScripts };
|
|
1
|
+
import { A as PH_GLOBAL_PROJECT_NAME, B as SERVICE_ACTIONS, C as LEGACY_LINT_FORMAT_DEPENDENCIES, D as PEER_EXTERNAL_DEPENDENCIES, E as MINIMUM_NODE_VERSION, F as PROJECT_PORT_BAND_STUDIO, G as externalDependencies, H as VERSIONED_DEV_DEPENDENCIES, I as PROJECT_PORT_BAND_SWITCHBOARD, J as packageScripts, K as externalDevDependencies, L as PROJECT_PORT_BAND_VETRA_CONNECT, M as POWERHOUSE_CONFIG_FILE, N as POWERHOUSE_GLOBAL_DIR, O as PH_BIN, P as PROJECT_PORT_BAND_SIZE, R as REACTOR_API_PACKAGE, S as HOME_DIR, T as LOG_LEVELS, U as VERSIONED_PEER_DEPENDENCIES, V as VERSIONED_DEPENDENCIES, W as defaultManifest, _ as DEFAULT_VETRA_DRIVE_ID, a as DEFAULT_CONFIG, b as GRAPHQL_PACKAGE, c as DEFAULT_CONNECT_STUDIO_PORT, d as DEFAULT_EXPIRY_SECONDS, f as DEFAULT_REGISTRY_URL, g as DEFAULT_VETRA_CONNECT_PORT, h as DEFAULT_TIMEOUT, i as BOILERPLATE_DEPENDENCY_OVERRIDES, j as PIECES_FRAMEWORK_PACKAGE, k as PH_GLOBAL_DIR_NAME, l as DEFAULT_DRIVE_ICON, m as DEFAULT_SWITCHBOARD_PORT, n as ANALYTICS_ENGINE_CORE_PACKAGE, o as DEFAULT_CONNECT_OUTDIR, p as DEFAULT_RENOWN_URL, q as packageJsonExports, r as BOILERPLATE_ALLOWED_BUILDS, s as DEFAULT_CONNECT_PREVIEW_PORT, u as DEFAULT_EXPIRY_DAYS, v as DRIVES_PRESERVE_STRATEGIES, w as LEGACY_LINT_FORMAT_FILES, x as GRAPHQL_TAG_PACKAGE, y as FEATURE_DEPENDENCIES, z as SECONDS_IN_DAY } from "./types-BZBiwi6I.mjs";
|
|
2
|
+
export { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_DRIVE_ICON, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, SECONDS_IN_DAY, SERVICE_ACTIONS, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, externalDependencies, externalDevDependencies, packageJsonExports, packageScripts };
|
|
3
3
|
export {};
|
package/dist/clis/constants.mjs
CHANGED
|
@@ -31,6 +31,18 @@ const PROJECT_PORT_BAND_SIZE = 1e3;
|
|
|
31
31
|
const PROJECT_PORT_BAND_SWITCHBOARD = 7e3;
|
|
32
32
|
const PROJECT_PORT_BAND_STUDIO = 6e3;
|
|
33
33
|
const PROJECT_PORT_BAND_VETRA_CONNECT = 2e3;
|
|
34
|
+
/**
|
|
35
|
+
* Icon for the drives switchboard creates by default, inlined as a data URI.
|
|
36
|
+
*
|
|
37
|
+
* A remote URL is the wrong shape for this: the value is baked into the drive
|
|
38
|
+
* document and rendered by every Connect that opens it, so the icon only
|
|
39
|
+
* appears when that client can reach that host. A desktop or air-gapped install
|
|
40
|
+
* cannot, and the ipfs.io gateway this previously pointed at now answers 403
|
|
41
|
+
* regardless.
|
|
42
|
+
*
|
|
43
|
+
* The mark is drawn dark-on-light so it stays legible against either theme.
|
|
44
|
+
*/
|
|
45
|
+
const DEFAULT_DRIVE_ICON = "data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Crect%20width='16'%20height='16'%20rx='3'%20fill='%23F3F5F7'/%3E%3Cpath%20fill='%23343839'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.0059%200L3.41636%205.45646C2.44979%206.25682%202.3795%207.71452%203.26456%208.60418L5.54425%2010.8957C6.21311%2011.568%206.35783%2012.6012%205.89944%2013.4314L4.48126%2016H2.13333C0.955126%2016%200%2015.0449%200%2013.8667V2.13333C0%200.955126%200.955126%200%202.13333%200H10.0059ZM11.2436%200L10.0128%202.24221C9.55899%203.06891%209.70183%204.09549%2010.3641%204.7669L12.7825%207.21868C13.6656%208.11402%2013.5866%209.57512%2012.612%2010.37L5.70922%2016H13.8667C15.0449%2016%2016%2015.0449%2016%2013.8667V2.13333C16%200.955126%2015.0449%200%2013.8667%200H11.2436Z'/%3E%3C/svg%3E";
|
|
34
46
|
const DEFAULT_VETRA_DRIVE_ID = "vetra";
|
|
35
47
|
const MINIMUM_NODE_VERSION = "24.0.0";
|
|
36
48
|
const PH_BIN = "ph-cli-legacy";
|
|
@@ -135,7 +147,6 @@ const packageJsonExports = {
|
|
|
135
147
|
},
|
|
136
148
|
"./subgraphs": {
|
|
137
149
|
types: "./dist/types/subgraphs/index.d.ts",
|
|
138
|
-
browser: "./dist/browser/subgraphs/index.js",
|
|
139
150
|
node: "./dist/node/subgraphs/index.mjs"
|
|
140
151
|
},
|
|
141
152
|
"./processors": {
|
|
@@ -254,6 +265,6 @@ const DEFAULT_CONFIG = {
|
|
|
254
265
|
}
|
|
255
266
|
};
|
|
256
267
|
//#endregion
|
|
257
|
-
export { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, SECONDS_IN_DAY, SERVICE_ACTIONS, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, externalDependencies, externalDevDependencies, packageJsonExports, packageScripts };
|
|
268
|
+
export { ANALYTICS_ENGINE_CORE_PACKAGE, BOILERPLATE_ALLOWED_BUILDS, BOILERPLATE_DEPENDENCY_OVERRIDES, DEFAULT_CONFIG, DEFAULT_CONNECT_OUTDIR, DEFAULT_CONNECT_PREVIEW_PORT, DEFAULT_CONNECT_STUDIO_PORT, DEFAULT_DRIVE_ICON, DEFAULT_EXPIRY_DAYS, DEFAULT_EXPIRY_SECONDS, DEFAULT_REGISTRY_URL, DEFAULT_RENOWN_URL, DEFAULT_SWITCHBOARD_PORT, DEFAULT_TIMEOUT, DEFAULT_VETRA_CONNECT_PORT, DEFAULT_VETRA_DRIVE_ID, DRIVES_PRESERVE_STRATEGIES, FEATURE_DEPENDENCIES, GRAPHQL_PACKAGE, GRAPHQL_TAG_PACKAGE, HOME_DIR, LEGACY_LINT_FORMAT_DEPENDENCIES, LEGACY_LINT_FORMAT_FILES, LOG_LEVELS, MINIMUM_NODE_VERSION, PEER_EXTERNAL_DEPENDENCIES, PH_BIN, PH_GLOBAL_DIR_NAME, PH_GLOBAL_PROJECT_NAME, PIECES_FRAMEWORK_PACKAGE, POWERHOUSE_CONFIG_FILE, POWERHOUSE_GLOBAL_DIR, PROJECT_PORT_BAND_SIZE, PROJECT_PORT_BAND_STUDIO, PROJECT_PORT_BAND_SWITCHBOARD, PROJECT_PORT_BAND_VETRA_CONNECT, REACTOR_API_PACKAGE, SECONDS_IN_DAY, SERVICE_ACTIONS, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, externalDependencies, externalDevDependencies, packageJsonExports, packageScripts };
|
|
258
269
|
|
|
259
270
|
//# sourceMappingURL=constants.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.mjs","names":[],"sources":["../../clis/constants.ts"],"sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Manifest } from \"../document-model/types.js\";\nimport type { PowerhouseConfig } from \"./types.js\";\n\nexport const SERVICE_ACTIONS = [\n \"start\",\n \"stop\",\n \"status\",\n \"setup\",\n \"restart\",\n] as const;\n\nexport const SECONDS_IN_DAY = 24 * 60 * 60;\nexport const DEFAULT_EXPIRY_DAYS = 7;\nexport const DEFAULT_EXPIRY_SECONDS = DEFAULT_EXPIRY_DAYS * SECONDS_IN_DAY;\n\nexport const DRIVES_PRESERVE_STRATEGIES = [\n \"preserve-all\",\n \"preserve-by-url-and-detach\",\n] as const;\n\nexport const LOG_LEVELS = [\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"verbose\",\n] as const;\n\nexport const DEFAULT_TIMEOUT = 300 as const;\n\nexport const DEFAULT_CONNECT_STUDIO_PORT = 3000 as const;\n\nexport const DEFAULT_VETRA_CONNECT_PORT = 3001 as const;\n\nexport const DEFAULT_CONNECT_PREVIEW_PORT = 4173 as const;\n\nexport const DEFAULT_CONNECT_OUTDIR = \".ph/connect-build/dist/\" as const;\n\nexport const DEFAULT_RENOWN_URL = \"https://www.renown.id\" as const;\n\nexport const DEFAULT_REGISTRY_URL = \"https://registry.vetra.io\" as const;\n\nexport const DEFAULT_SWITCHBOARD_PORT = 4001 as const;\n\n// Per-project dev-server port bands. `ph init` assigns each project a port\n// triple derived from its name, so two projects never collide and an agent's\n// MCP URL can be baked into .mcp.json before a session starts.\n//\n// Two hard constraints picked these bands, both below 10000:\n//\n// 1. Below the OS ephemeral range. Linux allocates outbound source ports\n// from 32768-60999 (`/proc/sys/net/ipv4/ip_local_port_range`); macOS and\n// Windows start at 49152. A listener parked in that window can lose a\n// race to a transient outbound socket, which would surface as a\n// `--strictPort` failure blaming a project conflict that does not exist.\n// 2. Below 10000, which is where ph-clint starts. ph-clint derives its own\n// per-CLI ports by hashing into 10000-59900, so staying under 10000\n// keeps the two schemes from ever contending.\n//\n// Within those limits the blocks were chosen by measuring which ports the\n// Powerhouse repos actually reference: 2000-2999 has none, 7000-7999 has one,\n// 6000-6999 has five. See PROJECT_PORT_DENYLIST in project-ports.ts for the\n// individual ports skipped inside them.\nexport const PROJECT_PORT_BAND_SIZE = 1000 as const;\nexport const PROJECT_PORT_BAND_SWITCHBOARD = 7000 as const;\nexport const PROJECT_PORT_BAND_STUDIO = 6000 as const;\nexport const PROJECT_PORT_BAND_VETRA_CONNECT = 2000 as const;\n\nexport const DEFAULT_VETRA_DRIVE_ID = \"vetra\" as const;\n\nexport const MINIMUM_NODE_VERSION = \"24.0.0\" as const;\nexport const PH_BIN = \"ph-cli-legacy\" as const;\nexport const POWERHOUSE_CONFIG_FILE = \"powerhouse.config.json\" as const;\nexport const PH_GLOBAL_DIR_NAME = \".ph\" as const;\n// Keep PH_GLOBAL_PROJECT_NAME for backwards compatibility\nexport const PH_GLOBAL_PROJECT_NAME = PH_GLOBAL_DIR_NAME;\n\nexport const HOME_DIR = homedir();\n\nexport const POWERHOUSE_GLOBAL_DIR = join(HOME_DIR, PH_GLOBAL_DIR_NAME);\n\n// Workspace packages that go in peerDependencies of every generated project.\nexport const VERSIONED_PEER_DEPENDENCIES = [\n \"document-model\",\n \"@powerhousedao/reactor-browser\",\n];\n\ntype PeerSpec = { peer: string; dev: string };\n\nexport const REACTOR_API_PACKAGE = \"@powerhousedao/reactor-api\";\nexport const ANALYTICS_ENGINE_CORE_PACKAGE =\n \"@powerhousedao/analytics-engine-core\";\nexport const GRAPHQL_PACKAGE = \"graphql\";\nexport const GRAPHQL_TAG_PACKAGE = \"graphql-tag\";\nexport const PIECES_FRAMEWORK_PACKAGE = \"@powerhousedao/pieces-framework\";\n\n// External peerDependencies of every generated project.\n// `peer` is the consumer-facing range; `dev` is the exact build-tested pin.\n// graphql / graphql-tag are always-on because the workspace packages pulled\n// in by every `ph init` project (codegen, reactor-api, reactor-browser,\n// vetra-packages) declare them as peers — even projects without subgraphs\n// need them in scope so pnpm hoists a single graphql instance.\nexport const PEER_EXTERNAL_DEPENDENCIES = {\n [GRAPHQL_PACKAGE]: { peer: \"^16\", dev: \"16.12.0\" },\n [GRAPHQL_TAG_PACKAGE]: { peer: \"^2\", dev: \"2.12.6\" },\n react: { peer: \"^19\", dev: \"19.2.6\" },\n \"react-dom\": { peer: \"^19\", dev: \"19.2.6\" },\n zod: { peer: \"^4\", dev: \"4.3.6\" },\n} as const satisfies Record<string, PeerSpec>;\n\n// Per-feature deps added dynamically by codegen when required. `devVersioned`\n// is for a workspace package the build inlines, which no consumer provides.\nexport const FEATURE_DEPENDENCIES = {\n analyticsProcessor: {\n peerVersioned: [ANALYTICS_ENGINE_CORE_PACKAGE],\n peerExternal: {},\n devVersioned: [],\n },\n // Each piece is bundled whole (build-pieces.mts), framework included, so the\n // framework is only ever needed to compile the piece's own source.\n piece: {\n peerVersioned: [],\n peerExternal: {},\n devVersioned: [PIECES_FRAMEWORK_PACKAGE],\n },\n} as const satisfies Record<\n string,\n {\n peerVersioned: readonly string[];\n peerExternal: Record<string, PeerSpec>;\n devVersioned: readonly string[];\n }\n>;\n\nexport const VERSIONED_DEPENDENCIES = [\n ...VERSIONED_PEER_DEPENDENCIES,\n ...FEATURE_DEPENDENCIES.analyticsProcessor.peerVersioned,\n];\n\n// Transitive dependencies whose postinstall scripts the generated project\n// trusts. Mirrors the `allowBuilds` map in the boilerplate's\n// pnpm-workspace.yaml and is also passed as `--allow-build` flags to\n// `pnpm dlx @powerhousedao/ph-cli init` so pnpm 11's strict-dep-builds\n// default doesn't prompt during the outer dlx download.\nexport const BOILERPLATE_ALLOWED_BUILDS = [\n \"@apollo/protobufjs\",\n \"@datadog/pprof\",\n \"@parcel/watcher\",\n \"@reown/appkit\",\n \"bufferutil\",\n \"esbuild\",\n \"keccak\",\n \"protobufjs\",\n \"utf-8-validate\",\n] as const;\n\n// Single-version pins the boilerplate enforces on generated projects,\n// avoiding duplicates from coexisting version ranges. Rendered as pnpm\n// `overrides` (pnpm-workspace.yaml) and as yarn v1 `resolutions`\n// (package.json). Generated-project only — never change the monorepo\n// catalog for this (a re-resolution there pulls a tsc-crashing TS6 beta).\nexport const BOILERPLATE_DEPENDENCY_OVERRIDES = {\n \"date-fns\": \"4.3.0\",\n vite: \"8.0.14\",\n rolldown: \"1.0.2\",\n} as const satisfies Record<string, string>;\n\nexport const VERSIONED_DEV_DEPENDENCIES = [\n \"@powerhousedao/ph-cli\",\n \"@powerhousedao/reactor\",\n \"@powerhousedao/shared\",\n \"@powerhousedao/connect\",\n \"@powerhousedao/design-system\",\n];\n\nexport const packageJsonExports = {\n \".\": {\n types: \"./dist/types/index.d.ts\",\n browser: \"./dist/browser/index.js\",\n node: \"./dist/node/index.mjs\",\n },\n \"./reactor\": {\n types: \"./dist/types/reactor/index.d.ts\",\n browser: \"./dist/browser/reactor/index.js\",\n },\n \"./document-models\": {\n types: \"./dist/types/document-models/index.d.ts\",\n browser: \"./dist/browser/document-models/index.js\",\n node: \"./dist/node/document-models/index.mjs\",\n },\n \"./document-models/*\": {\n types: \"./dist/types/document-models/*/index.d.ts\",\n browser: \"./dist/browser/document-models/*/index.js\",\n node: \"./dist/node/document-models/*/index.mjs\",\n },\n \"./editors\": {\n types: \"./dist/types/editors/index.d.ts\",\n browser: \"./dist/browser/editors/index.js\",\n node: \"./dist/node/editors/index.mjs\",\n },\n \"./editors/*\": {\n types: \"./dist/types/editors/*/editor.d.ts\",\n browser: \"./dist/browser/editors/*/editor.js\",\n node: \"./dist/node/editors/*/editor.mjs\",\n },\n \"./subgraphs\": {\n types: \"./dist/types/subgraphs/index.d.ts\",\n browser: \"./dist/browser/subgraphs/index.js\",\n node: \"./dist/node/subgraphs/index.mjs\",\n },\n \"./processors\": {\n types: \"./dist/types/processors/index.d.ts\",\n browser: \"./dist/browser/processors/index.js\",\n node: \"./dist/node/processors/index.mjs\",\n },\n // Node only, as the build is: a piece is loaded by a host process, never by\n // the browser. Without these a package can build a piece and still fail the\n // `packageName/pieces` import a host resolves it through.\n \"./pieces\": {\n types: \"./dist/types/pieces/index.d.ts\",\n node: \"./dist/node/pieces/index.mjs\",\n },\n \"./pieces/*\": {\n types: \"./dist/types/pieces/*/index.d.ts\",\n node: \"./dist/node/pieces/*/index.mjs\",\n },\n \"./manifest\": \"./dist/powerhouse.manifest.json\",\n \"./style.css\": \"./dist/style.css\",\n} as const;\n\nexport const packageScripts = {\n \"test:watch\": \"vitest\",\n lint: \"oxlint --type-aware --type-check\",\n \"lint:fix\": \"oxlint --type-aware --type-check --fix\",\n format: \"oxfmt\",\n \"format:check\": \"oxfmt --check\",\n tsc: \"tsc\",\n \"tsc:watch\": \"tsc --watch\",\n generate: \"ph-cli generate\",\n connect: \"ph-cli connect\",\n build: \"ph-cli build\",\n reactor: \"ph-cli reactor\",\n service: \"ph-cli service\",\n vetra: \"ph-cli vetra\",\n \"service-startup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-startup.sh\",\n \"service-unstartup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh\",\n} as const;\n\nexport const externalDependencies = {} as const;\n\n// eslint/prettier devDependencies present in projects scaffolded before the oxc migration.\n// Stripped from package.json during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_DEPENDENCIES = [\n \"@eslint/js\",\n \"eslint\",\n \"eslint-config-prettier\",\n \"eslint-plugin-prettier\",\n \"eslint-plugin-react\",\n \"eslint-plugin-react-hooks\",\n \"globals\",\n \"prettier\",\n \"typescript-eslint\",\n] as const;\n\n// Legacy lint/format config files written by eslint/prettier boilerplate.\n// Removed from the project root during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_FILES = [\n \"eslint.config.js\",\n \"eslint.config.mjs\",\n \"eslint.config.cjs\",\n \"eslint.config.ts\",\n \".eslintrc\",\n \".eslintrc.js\",\n \".eslintrc.cjs\",\n \".eslintrc.json\",\n \".eslintrc.yml\",\n \".eslintrc.yaml\",\n \".eslintignore\",\n \".prettierrc\",\n \".prettierrc.js\",\n \".prettierrc.cjs\",\n \".prettierrc.json\",\n \".prettierrc.yml\",\n \".prettierrc.yaml\",\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n \"prettier.config.mjs\",\n \".prettierignore\",\n] as const;\n\nexport const externalDevDependencies = {\n \"@electric-sql/pglite\": \"0.3.15\",\n \"@electric-sql/pglite-tools\": \"0.2.20\",\n \"@powerhousedao/document-engineering\": \"1.40.5\",\n \"@tailwindcss/cli\": \"^4.1.18\",\n \"@tailwindcss/vite\": \"^4.1.18\",\n \"@types/node\": \"^24.9.2\",\n \"@types/react\": \"^19.2.3\",\n \"@types/react-dom\": \"^19.2.3\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"@vitest/coverage-v8\": \"5.0.3\",\n oxfmt: \"0.68.0\",\n oxlint: \"1.70.0\",\n \"oxlint-tsgolint\": \"0.23.0\",\n tailwindcss: \"^4.1.16\",\n typescript: \"~7.0.2\",\n vite: \"^8.0.10\",\n \"vite-tsconfig-paths\": \"6.1.1\",\n vitest: \"5.0.3\",\n} as const;\n\nexport const defaultManifest: Manifest = {\n name: \"\",\n description: \"\",\n category: \"\",\n publisher: {\n name: \"\",\n url: \"\",\n },\n documentModels: [],\n editors: [],\n apps: [],\n subgraphs: [],\n processors: [],\n};\n\nconst DEFAULT_DOCUMENT_MODELS_DIR = \"./document-models\";\nconst DEFAULT_EDITORS_DIR = \"./editors\";\nconst DEFAULT_PROCESSORS_DIR = \"./processors\";\nconst DEFAULT_SUBGRAPHS_DIR = \"./subgraphs\";\nconst DEFAULT_IMPORT_SCRIPTS_DIR = \"./scripts\";\nconst DEFAULT_SKIP_FORMAT = false;\nconst DEFAULT_LOG_LEVEL = \"info\";\n\nexport const DEFAULT_CONFIG: PowerhouseConfig = {\n documentModelsDir: DEFAULT_DOCUMENT_MODELS_DIR,\n editorsDir: DEFAULT_EDITORS_DIR,\n processorsDir: DEFAULT_PROCESSORS_DIR,\n subgraphsDir: DEFAULT_SUBGRAPHS_DIR,\n importScriptsDir: DEFAULT_IMPORT_SCRIPTS_DIR,\n skipFormat: DEFAULT_SKIP_FORMAT,\n logLevel: DEFAULT_LOG_LEVEL,\n auth: {\n enabled: false,\n admins: [],\n },\n};\n"],"mappings":";;;AAKA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,iBAAiB;AAC9B,MAAa,sBAAsB;AACnC,MAAa,yBAAA,IAA+C;AAE5D,MAAa,6BAA6B,CACxC,gBACA,4BACF;AAEA,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,kBAAkB;AAE/B,MAAa,8BAA8B;AAE3C,MAAa,6BAA6B;AAE1C,MAAa,+BAA+B;AAE5C,MAAa,yBAAyB;AAEtC,MAAa,qBAAqB;AAElC,MAAa,uBAAuB;AAEpC,MAAa,2BAA2B;AAqBxC,MAAa,yBAAyB;AACtC,MAAa,gCAAgC;AAC7C,MAAa,2BAA2B;AACxC,MAAa,kCAAkC;AAE/C,MAAa,yBAAyB;AAEtC,MAAa,uBAAuB;AACpC,MAAa,SAAS;AACtB,MAAa,yBAAyB;AACtC,MAAa,qBAAqB;AAElC,MAAa,yBAAA;AAEb,MAAa,WAAW,QAAQ;AAEhC,MAAa,wBAAwB,KAAK,UAAA,KAA4B;AAGtE,MAAa,8BAA8B,CACzC,kBACA,gCACF;AAIA,MAAa,sBAAsB;AACnC,MAAa,gCACX;AACF,MAAa,kBAAkB;AAC/B,MAAa,sBAAsB;AACnC,MAAa,2BAA2B;AAQxC,MAAa,6BAA6B;EACvC,kBAAkB;EAAE,MAAM;EAAO,KAAK;CAAU;EAChD,sBAAsB;EAAE,MAAM;EAAM,KAAK;CAAS;CACnD,OAAO;EAAE,MAAM;EAAO,KAAK;C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ACE;AACJ;AAEA,MAAa,uBAAuB,CAAC;AAIrC,MAAa,kCAAkC;CAC7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAIA,MAAa,2BAA2B;CACtC;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,0BAA0B;CACrC,wBAAwB;CACxB,8BAA8B;CAC9B,uCAAuC;CACvC,oBAAoB;CACpB,qBAAqB;CACrB,eAAe;CACf,gBAAgB;CAChB,oBAAoB;CACpB,wBAAwB;CACxB,uBAAuB;CACvB,OAAO;CACP,QAAQ;CACR,mBAAmB;CACnB,aAAa;CACb,YAAY;CACZ,MAAM;CACN,uBAAuB;CACvB,QAAQ;AACV;AAEA,MAAa,kBAA4B;CACvC,MAAM;CACN,aAAa;CACb,UAAU;CACV,WAAW;EACT,MAAM;EACN,KAAK;CACP;CACA,gBAAgB,CAAC;CACjB,SAAS,CAAC;CACV,MAAM,CAAC;CACP,WAAW,CAAC;CACZ,YAAY,CAAC;AACf;AAUA,MAAa,iBAAmC;CAC9C,mBAAmB;CACnB,YAAY;CACZ,eAAe;CACf,cAAc;CACd,kBAAkB;CAClB,YAAY;CACZ,UAAU;CACV,MAAM;EACJ,SAAS;EACT,QAAQ,CAAC;CACX;AACF"}
|
|
1
|
+
{"version":3,"file":"constants.mjs","names":[],"sources":["../../clis/constants.ts"],"sourcesContent":["import { homedir } from \"node:os\";\nimport { join } from \"node:path\";\nimport type { Manifest } from \"../document-model/types.js\";\nimport type { PowerhouseConfig } from \"./types.js\";\n\nexport const SERVICE_ACTIONS = [\n \"start\",\n \"stop\",\n \"status\",\n \"setup\",\n \"restart\",\n] as const;\n\nexport const SECONDS_IN_DAY = 24 * 60 * 60;\nexport const DEFAULT_EXPIRY_DAYS = 7;\nexport const DEFAULT_EXPIRY_SECONDS = DEFAULT_EXPIRY_DAYS * SECONDS_IN_DAY;\n\nexport const DRIVES_PRESERVE_STRATEGIES = [\n \"preserve-all\",\n \"preserve-by-url-and-detach\",\n] as const;\n\nexport const LOG_LEVELS = [\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"verbose\",\n] as const;\n\nexport const DEFAULT_TIMEOUT = 300 as const;\n\nexport const DEFAULT_CONNECT_STUDIO_PORT = 3000 as const;\n\nexport const DEFAULT_VETRA_CONNECT_PORT = 3001 as const;\n\nexport const DEFAULT_CONNECT_PREVIEW_PORT = 4173 as const;\n\nexport const DEFAULT_CONNECT_OUTDIR = \".ph/connect-build/dist/\" as const;\n\nexport const DEFAULT_RENOWN_URL = \"https://www.renown.id\" as const;\n\nexport const DEFAULT_REGISTRY_URL = \"https://registry.vetra.io\" as const;\n\nexport const DEFAULT_SWITCHBOARD_PORT = 4001 as const;\n\n// Per-project dev-server port bands. `ph init` assigns each project a port\n// triple derived from its name, so two projects never collide and an agent's\n// MCP URL can be baked into .mcp.json before a session starts.\n//\n// Two hard constraints picked these bands, both below 10000:\n//\n// 1. Below the OS ephemeral range. Linux allocates outbound source ports\n// from 32768-60999 (`/proc/sys/net/ipv4/ip_local_port_range`); macOS and\n// Windows start at 49152. A listener parked in that window can lose a\n// race to a transient outbound socket, which would surface as a\n// `--strictPort` failure blaming a project conflict that does not exist.\n// 2. Below 10000, which is where ph-clint starts. ph-clint derives its own\n// per-CLI ports by hashing into 10000-59900, so staying under 10000\n// keeps the two schemes from ever contending.\n//\n// Within those limits the blocks were chosen by measuring which ports the\n// Powerhouse repos actually reference: 2000-2999 has none, 7000-7999 has one,\n// 6000-6999 has five. See PROJECT_PORT_DENYLIST in project-ports.ts for the\n// individual ports skipped inside them.\nexport const PROJECT_PORT_BAND_SIZE = 1000 as const;\nexport const PROJECT_PORT_BAND_SWITCHBOARD = 7000 as const;\nexport const PROJECT_PORT_BAND_STUDIO = 6000 as const;\nexport const PROJECT_PORT_BAND_VETRA_CONNECT = 2000 as const;\n\n/**\n * Icon for the drives switchboard creates by default, inlined as a data URI.\n *\n * A remote URL is the wrong shape for this: the value is baked into the drive\n * document and rendered by every Connect that opens it, so the icon only\n * appears when that client can reach that host. A desktop or air-gapped install\n * cannot, and the ipfs.io gateway this previously pointed at now answers 403\n * regardless.\n *\n * The mark is drawn dark-on-light so it stays legible against either theme.\n */\nexport const DEFAULT_DRIVE_ICON =\n \"data:image/svg+xml,%3Csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2016%2016'%3E%3Crect%20width='16'%20height='16'%20rx='3'%20fill='%23F3F5F7'/%3E%3Cpath%20fill='%23343839'%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M10.0059%200L3.41636%205.45646C2.44979%206.25682%202.3795%207.71452%203.26456%208.60418L5.54425%2010.8957C6.21311%2011.568%206.35783%2012.6012%205.89944%2013.4314L4.48126%2016H2.13333C0.955126%2016%200%2015.0449%200%2013.8667V2.13333C0%200.955126%200.955126%200%202.13333%200H10.0059ZM11.2436%200L10.0128%202.24221C9.55899%203.06891%209.70183%204.09549%2010.3641%204.7669L12.7825%207.21868C13.6656%208.11402%2013.5866%209.57512%2012.612%2010.37L5.70922%2016H13.8667C15.0449%2016%2016%2015.0449%2016%2013.8667V2.13333C16%200.955126%2015.0449%200%2013.8667%200H11.2436Z'/%3E%3C/svg%3E\" as const;\n\nexport const DEFAULT_VETRA_DRIVE_ID = \"vetra\" as const;\n\nexport const MINIMUM_NODE_VERSION = \"24.0.0\" as const;\nexport const PH_BIN = \"ph-cli-legacy\" as const;\nexport const POWERHOUSE_CONFIG_FILE = \"powerhouse.config.json\" as const;\nexport const PH_GLOBAL_DIR_NAME = \".ph\" as const;\n// Keep PH_GLOBAL_PROJECT_NAME for backwards compatibility\nexport const PH_GLOBAL_PROJECT_NAME = PH_GLOBAL_DIR_NAME;\n\nexport const HOME_DIR = homedir();\n\nexport const POWERHOUSE_GLOBAL_DIR = join(HOME_DIR, PH_GLOBAL_DIR_NAME);\n\n// Workspace packages that go in peerDependencies of every generated project.\nexport const VERSIONED_PEER_DEPENDENCIES = [\n \"document-model\",\n \"@powerhousedao/reactor-browser\",\n];\n\ntype PeerSpec = { peer: string; dev: string };\n\nexport const REACTOR_API_PACKAGE = \"@powerhousedao/reactor-api\";\nexport const ANALYTICS_ENGINE_CORE_PACKAGE =\n \"@powerhousedao/analytics-engine-core\";\nexport const GRAPHQL_PACKAGE = \"graphql\";\nexport const GRAPHQL_TAG_PACKAGE = \"graphql-tag\";\nexport const PIECES_FRAMEWORK_PACKAGE = \"@powerhousedao/pieces-framework\";\n\n// External peerDependencies of every generated project.\n// `peer` is the consumer-facing range; `dev` is the exact build-tested pin.\n// graphql / graphql-tag are always-on because the workspace packages pulled\n// in by every `ph init` project (codegen, reactor-api, reactor-browser,\n// vetra-packages) declare them as peers — even projects without subgraphs\n// need them in scope so pnpm hoists a single graphql instance.\nexport const PEER_EXTERNAL_DEPENDENCIES = {\n [GRAPHQL_PACKAGE]: { peer: \"^16\", dev: \"16.12.0\" },\n [GRAPHQL_TAG_PACKAGE]: { peer: \"^2\", dev: \"2.12.6\" },\n react: { peer: \"^19\", dev: \"19.2.6\" },\n \"react-dom\": { peer: \"^19\", dev: \"19.2.6\" },\n zod: { peer: \"^4\", dev: \"4.3.6\" },\n} as const satisfies Record<string, PeerSpec>;\n\n// Per-feature deps added dynamically by codegen when required. `devVersioned`\n// is for a workspace package the build inlines, which no consumer provides.\nexport const FEATURE_DEPENDENCIES = {\n analyticsProcessor: {\n peerVersioned: [ANALYTICS_ENGINE_CORE_PACKAGE],\n peerExternal: {},\n devVersioned: [],\n },\n // Each piece is bundled whole (build-pieces.mts), framework included, so the\n // framework is only ever needed to compile the piece's own source.\n piece: {\n peerVersioned: [],\n peerExternal: {},\n devVersioned: [PIECES_FRAMEWORK_PACKAGE],\n },\n} as const satisfies Record<\n string,\n {\n peerVersioned: readonly string[];\n peerExternal: Record<string, PeerSpec>;\n devVersioned: readonly string[];\n }\n>;\n\nexport const VERSIONED_DEPENDENCIES = [\n ...VERSIONED_PEER_DEPENDENCIES,\n ...FEATURE_DEPENDENCIES.analyticsProcessor.peerVersioned,\n];\n\n// Transitive dependencies whose postinstall scripts the generated project\n// trusts. Mirrors the `allowBuilds` map in the boilerplate's\n// pnpm-workspace.yaml and is also passed as `--allow-build` flags to\n// `pnpm dlx @powerhousedao/ph-cli init` so pnpm 11's strict-dep-builds\n// default doesn't prompt during the outer dlx download.\nexport const BOILERPLATE_ALLOWED_BUILDS = [\n \"@apollo/protobufjs\",\n \"@datadog/pprof\",\n \"@parcel/watcher\",\n \"@reown/appkit\",\n \"bufferutil\",\n \"esbuild\",\n \"keccak\",\n \"protobufjs\",\n \"utf-8-validate\",\n] as const;\n\n// Single-version pins the boilerplate enforces on generated projects,\n// avoiding duplicates from coexisting version ranges. Rendered as pnpm\n// `overrides` (pnpm-workspace.yaml) and as yarn v1 `resolutions`\n// (package.json). Generated-project only — never change the monorepo\n// catalog for this (a re-resolution there pulls a tsc-crashing TS6 beta).\nexport const BOILERPLATE_DEPENDENCY_OVERRIDES = {\n \"date-fns\": \"4.3.0\",\n vite: \"8.0.14\",\n rolldown: \"1.0.2\",\n} as const satisfies Record<string, string>;\n\nexport const VERSIONED_DEV_DEPENDENCIES = [\n \"@powerhousedao/ph-cli\",\n \"@powerhousedao/reactor\",\n \"@powerhousedao/shared\",\n \"@powerhousedao/connect\",\n \"@powerhousedao/design-system\",\n];\n\nexport const packageJsonExports = {\n \".\": {\n types: \"./dist/types/index.d.ts\",\n browser: \"./dist/browser/index.js\",\n node: \"./dist/node/index.mjs\",\n },\n \"./reactor\": {\n types: \"./dist/types/reactor/index.d.ts\",\n browser: \"./dist/browser/reactor/index.js\",\n },\n \"./document-models\": {\n types: \"./dist/types/document-models/index.d.ts\",\n browser: \"./dist/browser/document-models/index.js\",\n node: \"./dist/node/document-models/index.mjs\",\n },\n \"./document-models/*\": {\n types: \"./dist/types/document-models/*/index.d.ts\",\n browser: \"./dist/browser/document-models/*/index.js\",\n node: \"./dist/node/document-models/*/index.mjs\",\n },\n \"./editors\": {\n types: \"./dist/types/editors/index.d.ts\",\n browser: \"./dist/browser/editors/index.js\",\n node: \"./dist/node/editors/index.mjs\",\n },\n \"./editors/*\": {\n types: \"./dist/types/editors/*/editor.d.ts\",\n browser: \"./dist/browser/editors/*/editor.js\",\n node: \"./dist/node/editors/*/editor.mjs\",\n },\n \"./subgraphs\": {\n types: \"./dist/types/subgraphs/index.d.ts\",\n node: \"./dist/node/subgraphs/index.mjs\",\n },\n \"./processors\": {\n types: \"./dist/types/processors/index.d.ts\",\n browser: \"./dist/browser/processors/index.js\",\n node: \"./dist/node/processors/index.mjs\",\n },\n // Node only, as the build is: a piece is loaded by a host process, never by\n // the browser. Without these a package can build a piece and still fail the\n // `packageName/pieces` import a host resolves it through.\n \"./pieces\": {\n types: \"./dist/types/pieces/index.d.ts\",\n node: \"./dist/node/pieces/index.mjs\",\n },\n \"./pieces/*\": {\n types: \"./dist/types/pieces/*/index.d.ts\",\n node: \"./dist/node/pieces/*/index.mjs\",\n },\n \"./manifest\": \"./dist/powerhouse.manifest.json\",\n \"./style.css\": \"./dist/style.css\",\n} as const;\n\nexport const packageScripts = {\n \"test:watch\": \"vitest\",\n lint: \"oxlint --type-aware --type-check\",\n \"lint:fix\": \"oxlint --type-aware --type-check --fix\",\n format: \"oxfmt\",\n \"format:check\": \"oxfmt --check\",\n tsc: \"tsc\",\n \"tsc:watch\": \"tsc --watch\",\n generate: \"ph-cli generate\",\n connect: \"ph-cli connect\",\n build: \"ph-cli build\",\n reactor: \"ph-cli reactor\",\n service: \"ph-cli service\",\n vetra: \"ph-cli vetra\",\n \"service-startup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-startup.sh\",\n \"service-unstartup\":\n \"bash ./node_modules/@powerhousedao/ph-cli/dist/scripts/service-unstartup.sh\",\n} as const;\n\nexport const externalDependencies = {} as const;\n\n// eslint/prettier devDependencies present in projects scaffolded before the oxc migration.\n// Stripped from package.json during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_DEPENDENCIES = [\n \"@eslint/js\",\n \"eslint\",\n \"eslint-config-prettier\",\n \"eslint-plugin-prettier\",\n \"eslint-plugin-react\",\n \"eslint-plugin-react-hooks\",\n \"globals\",\n \"prettier\",\n \"typescript-eslint\",\n] as const;\n\n// Legacy lint/format config files written by eslint/prettier boilerplate.\n// Removed from the project root during `ph migrate`.\nexport const LEGACY_LINT_FORMAT_FILES = [\n \"eslint.config.js\",\n \"eslint.config.mjs\",\n \"eslint.config.cjs\",\n \"eslint.config.ts\",\n \".eslintrc\",\n \".eslintrc.js\",\n \".eslintrc.cjs\",\n \".eslintrc.json\",\n \".eslintrc.yml\",\n \".eslintrc.yaml\",\n \".eslintignore\",\n \".prettierrc\",\n \".prettierrc.js\",\n \".prettierrc.cjs\",\n \".prettierrc.json\",\n \".prettierrc.yml\",\n \".prettierrc.yaml\",\n \"prettier.config.js\",\n \"prettier.config.cjs\",\n \"prettier.config.mjs\",\n \".prettierignore\",\n] as const;\n\nexport const externalDevDependencies = {\n \"@electric-sql/pglite\": \"0.3.15\",\n \"@electric-sql/pglite-tools\": \"0.2.20\",\n \"@powerhousedao/document-engineering\": \"1.40.5\",\n \"@tailwindcss/cli\": \"^4.1.18\",\n \"@tailwindcss/vite\": \"^4.1.18\",\n \"@types/node\": \"^24.9.2\",\n \"@types/react\": \"^19.2.3\",\n \"@types/react-dom\": \"^19.2.3\",\n \"@vitejs/plugin-react\": \"^6.0.1\",\n \"@vitest/coverage-v8\": \"5.0.3\",\n oxfmt: \"0.68.0\",\n oxlint: \"1.70.0\",\n \"oxlint-tsgolint\": \"0.23.0\",\n tailwindcss: \"^4.1.16\",\n typescript: \"~7.0.2\",\n vite: \"^8.0.10\",\n \"vite-tsconfig-paths\": \"6.1.1\",\n vitest: \"5.0.3\",\n} as const;\n\nexport const defaultManifest: Manifest = {\n name: \"\",\n description: \"\",\n category: \"\",\n publisher: {\n name: \"\",\n url: \"\",\n },\n documentModels: [],\n editors: [],\n apps: [],\n subgraphs: [],\n processors: [],\n};\n\nconst DEFAULT_DOCUMENT_MODELS_DIR = \"./document-models\";\nconst DEFAULT_EDITORS_DIR = \"./editors\";\nconst DEFAULT_PROCESSORS_DIR = \"./processors\";\nconst DEFAULT_SUBGRAPHS_DIR = \"./subgraphs\";\nconst DEFAULT_IMPORT_SCRIPTS_DIR = \"./scripts\";\nconst DEFAULT_SKIP_FORMAT = false;\nconst DEFAULT_LOG_LEVEL = \"info\";\n\nexport const DEFAULT_CONFIG: PowerhouseConfig = {\n documentModelsDir: DEFAULT_DOCUMENT_MODELS_DIR,\n editorsDir: DEFAULT_EDITORS_DIR,\n processorsDir: DEFAULT_PROCESSORS_DIR,\n subgraphsDir: DEFAULT_SUBGRAPHS_DIR,\n importScriptsDir: DEFAULT_IMPORT_SCRIPTS_DIR,\n skipFormat: DEFAULT_SKIP_FORMAT,\n logLevel: DEFAULT_LOG_LEVEL,\n auth: {\n enabled: false,\n admins: [],\n },\n};\n"],"mappings":";;;AAKA,MAAa,kBAAkB;CAC7B;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,iBAAiB;AAC9B,MAAa,sBAAsB;AACnC,MAAa,yBAAA,IAA+C;AAE5D,MAAa,6BAA6B,CACxC,gBACA,4BACF;AAEA,MAAa,aAAa;CACxB;CACA;CACA;CACA;CACA;AACF;AAEA,MAAa,kBAAkB;AAE/B,MAAa,8BAA8B;AAE3C,MAAa,6BAA6B;AAE1C,MAAa,+BAA+B;AAE5C,MAAa,yBAAyB;AAEtC,MAAa,qBAAqB;AAElC,MAAa,uBAAuB;AAEpC,MAAa,2BAA2B;AAqBxC,MAAa,yBAAyB;AACtC,MAAa,gCAAgC;AAC7C,MAAa,2BAA2B;AACxC,MAAa,kCAAkC;;;;;;;;;;;;AAa/C,MAAa,qBACX;AAEF,MAAa,yBAAyB;AAEtC,MAAa,uBAAuB;AACpC,MAAa,SAAS;AACtB,MAAa,yBAAyB;AACtC,MAAa,qBAAqB;AAElC,MAAa,yBAA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