@powerhousedao/shared 6.2.3-dev.93 → 6.2.3-dev.95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/clis/args/access-token.mjs +1 -1
  2. package/dist/clis/args/{common-CBLen_yt.mjs → common-DG_SF8fN.mjs} +9 -1
  3. package/dist/clis/args/{common-CBLen_yt.mjs.map → common-DG_SF8fN.mjs.map} +1 -1
  4. package/dist/clis/args/{common-BpLj4peE.d.mts → common-DmerPWXo.d.mts} +5 -1
  5. package/dist/clis/args/common-DmerPWXo.d.mts.map +1 -0
  6. package/dist/clis/args/common.d.mts +1 -1
  7. package/dist/clis/args/common.mjs +1 -1
  8. package/dist/clis/args/connect.mjs +1 -1
  9. package/dist/clis/args/{generate-a36SaAn4.mjs → generate-DoDfK_Wi.mjs} +2 -2
  10. package/dist/clis/args/{generate-a36SaAn4.mjs.map → generate-DoDfK_Wi.mjs.map} +1 -1
  11. package/dist/clis/args/generate.mjs +1 -1
  12. package/dist/clis/args/{help-D_wYe_Fx.mjs → help-DJCRTkC9.mjs} +4 -4
  13. package/dist/clis/args/{help-D_wYe_Fx.mjs.map → help-DJCRTkC9.mjs.map} +1 -1
  14. package/dist/clis/args/help.mjs +1 -1
  15. package/dist/clis/args/index.d.mts +2 -2
  16. package/dist/clis/args/index.mjs +4 -4
  17. package/dist/clis/args/init.mjs +1 -1
  18. package/dist/clis/args/inspect.mjs +1 -1
  19. package/dist/clis/args/install.mjs +1 -1
  20. package/dist/clis/args/keyframes.mjs +1 -1
  21. package/dist/clis/args/list.mjs +1 -1
  22. package/dist/clis/args/login.mjs +1 -1
  23. package/dist/clis/args/mcp.mjs +1 -1
  24. package/dist/clis/args/migrate.mjs +1 -1
  25. package/dist/clis/args/model.d.mts +8 -0
  26. package/dist/clis/args/model.d.mts.map +1 -1
  27. package/dist/clis/args/model.mjs +17 -1
  28. package/dist/clis/args/model.mjs.map +1 -1
  29. package/dist/clis/args/publish.d.mts +4 -0
  30. package/dist/clis/args/publish.mjs +10 -2
  31. package/dist/clis/args/publish.mjs.map +1 -1
  32. package/dist/clis/args/registry.mjs +1 -1
  33. package/dist/clis/args/{service-IZ0Aq58z.d.mts → service-CLCvH3kf.d.mts} +2 -2
  34. package/dist/clis/args/{service-IZ0Aq58z.d.mts.map → service-CLCvH3kf.d.mts.map} +1 -1
  35. package/dist/clis/args/service.d.mts +1 -1
  36. package/dist/clis/args/service.mjs +1 -1
  37. package/dist/clis/args/switchboard.mjs +1 -1
  38. package/dist/clis/args/uninstall.mjs +1 -1
  39. package/dist/clis/args/unpublish.mjs +1 -1
  40. package/dist/clis/args/{vetra-DlAEC_Mv.mjs → vetra-BqjDopAP.mjs} +2 -2
  41. package/dist/clis/args/{vetra-DlAEC_Mv.mjs.map → vetra-BqjDopAP.mjs.map} +1 -1
  42. package/dist/clis/args/vetra.mjs +1 -1
  43. package/dist/clis/build-pieces.d.mts +9 -2
  44. package/dist/clis/build-pieces.d.mts.map +1 -1
  45. package/dist/clis/build-pieces.mjs +61 -16
  46. package/dist/clis/build-pieces.mjs.map +1 -1
  47. package/dist/clis/constants.d.mts +1 -1
  48. package/dist/clis/index.d.mts +16 -0
  49. package/dist/clis/index.d.mts.map +1 -1
  50. package/dist/clis/index.mjs +39 -3
  51. package/dist/clis/index.mjs.map +1 -1
  52. package/dist/clis/{types-DNeGTpnB.d.mts → types-B-2NDvpx.d.mts} +9 -1
  53. package/dist/clis/{types-DNeGTpnB.d.mts.map → types-B-2NDvpx.d.mts.map} +1 -1
  54. package/dist/connect/config-loader.d.ts +1 -1
  55. package/dist/connect/connect-config-schema.d.ts +1 -1
  56. package/dist/connect/connect-config-schema.js +1 -0
  57. package/dist/connect/connect-config-schema.js.map +1 -1
  58. package/dist/connect/index.d.ts +2 -2
  59. package/dist/{connect-config-schema-UFEAoO5W.d.ts → connect-config-schema-cBfkNo1b.d.ts} +9 -1
  60. package/dist/{connect-config-schema-UFEAoO5W.d.ts.map → connect-config-schema-cBfkNo1b.d.ts.map} +1 -1
  61. package/dist/document-drive/index.d.ts +3 -3
  62. package/dist/document-model/dispatch.d.ts +1 -1
  63. package/dist/document-model/errors.d.ts +1 -1
  64. package/dist/document-model/index.d.ts +1 -1
  65. package/dist/document-model/utils.d.ts +1 -1
  66. package/dist/{index-DD0XMv4t.d.ts → index-C_lizUqn.d.ts} +2 -2
  67. package/dist/{index-DD0XMv4t.d.ts.map → index-C_lizUqn.d.ts.map} +1 -1
  68. package/dist/index.d.ts +3 -3
  69. package/dist/processors/index.d.ts +1 -1
  70. package/dist/processors/testing.d.ts +1 -1
  71. package/dist/registry/index.d.ts +2 -2
  72. package/dist/registry/manifest-slim.d.ts +2 -2
  73. package/dist/{types-Btd9TO_L.d.ts → types-BuEzD0jp.d.ts} +2 -2
  74. package/dist/{types-Btd9TO_L.d.ts.map → types-BuEzD0jp.d.ts.map} +1 -1
  75. package/dist/{types-Dp2OWq1-.d.ts → types-cIIv_Rsg.d.ts} +2 -2
  76. package/dist/{types-Dp2OWq1-.d.ts.map → types-cIIv_Rsg.d.ts.map} +1 -1
  77. package/package.json +1 -1
  78. package/dist/clis/args/common-BpLj4peE.d.mts.map +0 -1
@@ -1 +1 @@
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 and scalars 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,UA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ACxB,CAAC;CACH;CAEA,mBAAmB,OAAO,QAAQ,UAAU;CAC5C,OAAO;AACT;AAGA,SAAS,mBACP,SACA,YACM;CACN,KAAK,MAAM,SAAS,SAClB,IAAI,CAAC,WAAW,IAAI,QAAQ,MAAM,MAAM,CAAC,GACvC,QAAQ,KACN,oBAAoB,MAAM,IAAI,yEAChC;AAGN;AASA,SAAgB,iBACd,QACA,OACA,uBAA+C,CAAC,GAC5B;CACpB,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,SAAS,KAAK,aAAa,0BAA0B;CAE3D,MAAM,OAAO,QAAQ,aAAa,QAAQ,0BAA0B;CAGpE,MAAM,cAAc,WAAW,cAAc,MAAM,CAAC;CACpD,MAAM,gBAAgB,OAAO,KAAK,oBAAoB,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
+ {"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 and scalars 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 realpathSync,\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 /**\n * @experimental Absolute: the directory that stands in for\n * `<projectRoot>/<outDir>` on disk during this build. Every path the build\n * names stays under `outDir`. Experimental while staged builds are\n * introduced.\n */\n writeTo?: 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\n/**\n * An output directory, absolute, and the directory written in its place;\n * `toReal` is `to` as `import.meta.url` spells it, through any symlink.\n */\ntype Redirect = { from: string; to: string; toReal: string };\n\n/** `relative(dir, path)` leaves `dir`: `..`, `../…`, or another root. */\nconst leaves = (inside: string) =>\n inside === \"..\" || inside.startsWith(`..${sep}`) || isAbsolute(inside);\n\n// Where a path is on disk: moved to `to` when it lies under `from`.\nfunction onDisk(path: string, redirect: Redirect | undefined): string {\n if (!redirect) return path;\n const inside = relative(redirect.from, path);\n return leaves(inside) ? path : join(redirect.to, inside);\n}\n\n// Where a path in the written directory stands in the output: the inverse of\n// onDisk, for a location a module derived from its own URL.\nfunction toLogical(path: string, redirect: Redirect | undefined): string {\n if (!redirect) return path;\n for (const dir of [redirect.to, redirect.toReal]) {\n const inside = relative(dir, path);\n if (!leaves(inside)) return join(redirect.from, inside);\n }\n return path;\n}\n\nexport function statSafe(p: string) {\n try {\n return statSync(p);\n } catch {\n return null;\n }\n}\n\nfunction realpathSafe(p: string) {\n try {\n return realpathSync(p);\n } catch {\n return p;\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, relative, sep } from \"node:path\";\nimport { pathToFileURL } from \"node:url\";\n\nconst job = JSON.parse(readFileSync(process.argv[2], \"utf8\"));\n${DESCRIBE_HELPERS}\n// The parent's onDisk, for the paths a list names under the output directory.\nfunction onDisk(path) {\n if (!job.redirect) return path;\n const inside = relative(job.redirect.from, path);\n const leaves = inside === \"..\" || inside.startsWith(\"..\" + sep) || isAbsolute(inside);\n return leaves ? path : join(job.redirect.to, inside);\n}\n\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(onDisk(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(onDisk(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(onDisk(file))) continue;\n try {\n const mod = await import(pathToFileURL(onDisk(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 return describePiecesThrough(projectRoot, listPath, undefined);\n}\n\nfunction describePiecesThrough(\n projectRoot: string,\n listPath: string,\n redirect: Redirect | undefined,\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(\n jobFile,\n JSON.stringify({ projectRoot, listPath, outFile, redirect }),\n );\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 return locatePieceThrough(piece, projectRoot, outDir, undefined);\n}\n\nfunction locatePieceThrough(\n piece: PackagePiece,\n projectRoot: string,\n outDir: string,\n redirect: Redirect | undefined,\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 // A list may derive a location from import.meta.url, which names the\n // written directory: it is read as the output it stands in for.\n const shown = isAbsolute(declared) ? toLogical(declared, redirect) : declared;\n const path = isAbsolute(declared) ? shown : join(projectRoot, declared);\n const form = piece.entry ? \"entry\" : \"bundle\";\n const disk = onDisk(path, redirect);\n const present =\n form === \"entry\"\n ? statSafe(disk)?.isFile()\n : statSafe(join(disk, \"package.json\"))?.isFile();\n if (!present) {\n throw new Error(\n `pieces: \"${piece.name}\" declares ${shown}, 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 ${shown}, 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 const redirect = target.writeTo\n ? {\n from: resolve(projectRoot, outDir),\n to: target.writeTo,\n toReal: realpathSafe(target.writeTo),\n }\n : undefined;\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: onDisk(outDir, redirect),\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(onDisk(listPath, redirect))) {\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 = describePiecesThrough(projectRoot, listPath, redirect);\n\n const built: BuiltPiece[] = [];\n const listedDirs = new Set<string>();\n for (const piece of described.list) {\n const location = locatePieceThrough(piece, projectRoot, outDir, redirect);\n const dirOnDisk = onDisk(location.dir, redirect);\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(dirOnDisk, \"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(dirOnDisk, pkg.version);\n writeFileSync(\n join(dirOnDisk, \"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,OAAO,KAAA;CACjC,OAAO,KAAK,KAAK,MAAM,GAAG,KAAK,aAAa,MAAM,GAAG,GAAG,KAAK,MAAM,GAAG,KAAK,CAAC;AAC9E;AAEA,SAAS,gBAAgB,MAAuC;CAC9D,IAAI;EACF,OAAO,KAAK,MACV,aAAa,KAAK,MAAM,cAAc,GAAG,MAAM,C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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 PH_GLOBAL_DIR_NAME, B as RELATIONAL_DB_PROCESSOR_CLASS, C as KYSELY_PACKAGE, D as MINIMUM_NODE_VERSION, E as LOG_LEVELS, F as PROJECT_PORT_BAND_SIZE, G as VERSIONED_PEER_DEPENDENCIES, H as SERVICE_ACTIONS, I as PROJECT_PORT_BAND_STUDIO, J as externalDevDependencies, K as defaultManifest, L as PROJECT_PORT_BAND_SWITCHBOARD, M as PIECES_FRAMEWORK_PACKAGE, N as POWERHOUSE_CONFIG_FILE, O as PEER_EXTERNAL_DEPENDENCIES, P as POWERHOUSE_GLOBAL_DIR, R as PROJECT_PORT_BAND_VETRA_CONNECT, S as HOME_DIR, T as LEGACY_LINT_FORMAT_FILES, U as VERSIONED_DEPENDENCIES, V as SECONDS_IN_DAY, W as VERSIONED_DEV_DEPENDENCIES, X as packageScripts, Y as packageJsonExports, _ 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 PH_GLOBAL_PROJECT_NAME, k as PH_BIN, 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 externalDependencies, 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_DEPENDENCIES, x as GRAPHQL_TAG_PACKAGE, y as FEATURE_DEPENDENCIES, z as REACTOR_API_PACKAGE } from "./types-DNeGTpnB.mjs";
1
+ import { A as PH_GLOBAL_DIR_NAME, B as RELATIONAL_DB_PROCESSOR_CLASS, C as KYSELY_PACKAGE, D as MINIMUM_NODE_VERSION, E as LOG_LEVELS, F as PROJECT_PORT_BAND_SIZE, G as VERSIONED_PEER_DEPENDENCIES, H as SERVICE_ACTIONS, I as PROJECT_PORT_BAND_STUDIO, J as externalDevDependencies, K as defaultManifest, L as PROJECT_PORT_BAND_SWITCHBOARD, M as PIECES_FRAMEWORK_PACKAGE, N as POWERHOUSE_CONFIG_FILE, O as PEER_EXTERNAL_DEPENDENCIES, P as POWERHOUSE_GLOBAL_DIR, R as PROJECT_PORT_BAND_VETRA_CONNECT, S as HOME_DIR, T as LEGACY_LINT_FORMAT_FILES, U as VERSIONED_DEPENDENCIES, V as SECONDS_IN_DAY, W as VERSIONED_DEV_DEPENDENCIES, X as packageScripts, Y as packageJsonExports, _ 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 PH_GLOBAL_PROJECT_NAME, k as PH_BIN, 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 externalDependencies, 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_DEPENDENCIES, x as GRAPHQL_TAG_PACKAGE, y as FEATURE_DEPENDENCIES, z as REACTOR_API_PACKAGE } from "./types-B-2NDvpx.mjs";
2
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, KYSELY_PACKAGE, 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, RELATIONAL_DB_PROCESSOR_CLASS, SECONDS_IN_DAY, SERVICE_ACTIONS, VERSIONED_DEPENDENCIES, VERSIONED_DEV_DEPENDENCIES, VERSIONED_PEER_DEPENDENCIES, defaultManifest, externalDependencies, externalDevDependencies, packageJsonExports, packageScripts };
3
3
  export {};
@@ -38,6 +38,10 @@ export declare const buildArgs: {
38
38
  ignoreTypeErrors: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
39
39
  parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<boolean>>;
40
40
  } & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/argparser.js").Register & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive>;
41
+ /** @experimental Builds for a release: the release check, then a release approval. */
42
+ release: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
43
+ parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<boolean>>;
44
+ } & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/argparser.js").Register & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive>;
41
45
  };
42
46
  export declare const packageManagerArgs: {
43
47
  packageManager: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
@@ -1167,6 +1171,10 @@ export declare const publishArgs: {
1167
1171
  registry: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
1168
1172
  parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<string | undefined>>;
1169
1173
  } & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive>;
1174
+ /** @experimental Refuses to publish a package without a current release approval. */
1175
+ requireApproval: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
1176
+ parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<boolean>>;
1177
+ } & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp & import("cmd-ts/dist/cjs/argparser.js").Register & Partial<import("cmd-ts/dist/cjs/helpdoc.js").Descriptive>;
1170
1178
  forwardedArgs: Partial<import("cmd-ts/dist/cjs/argparser.js").Register> & {
1171
1179
  parse(context: import("cmd-ts/dist/cjs/argparser.js").ParseContext): Promise<import("cmd-ts/dist/cjs/argparser.js").ParsingResult<string[]>>;
1172
1180
  } & import("cmd-ts/dist/cjs/helpdoc.js").ProvidesHelp;
@@ -2705,6 +2713,10 @@ declare const connectRuntimeInstanceSchema: z.ZodObject<{
2705
2713
  router: "router";
2706
2714
  worker: "worker";
2707
2715
  }>>;
2716
+ storage: z.ZodOptional<z.ZodEnum<{
2717
+ idb: "idb";
2718
+ memory: "memory";
2719
+ }>>;
2708
2720
  remoteBackends: z.ZodOptional<z.ZodArray<z.ZodObject<{
2709
2721
  name: z.ZodString;
2710
2722
  url: z.ZodString;
@@ -3082,6 +3094,10 @@ declare const connectRuntimeConfigSchema: z.ZodObject<{
3082
3094
  router: "router";
3083
3095
  worker: "worker";
3084
3096
  }>>;
3097
+ storage: z.ZodOptional<z.ZodEnum<{
3098
+ idb: "idb";
3099
+ memory: "memory";
3100
+ }>>;
3085
3101
  remoteBackends: z.ZodOptional<z.ZodArray<z.ZodObject<{
3086
3102
  name: z.ZodString;
3087
3103
  url: z.ZodString;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../clis/args/access-token.ts","../../clis/args/common.ts","../../clis/args/connect.ts","../../clis/args/generate.ts","../../clis/command-names.ts","../../clis/args/help.ts","../../clis/args/init.ts","../../clis/args/inspect.ts","../../clis/args/install.ts","../../clis/args/keyframes.ts","../../clis/args/list.ts","../../clis/args/login.ts","../../clis/args/migrate.ts","../../clis/args/publish.ts","../../clis/args/registry.ts","../../host-tokens/index.ts","../../connect/connect-config-schema.ts","../../document-model/definition-types.ts","../../document-model/schemas.ts","../../document-model/types.ts","../../clis/constants.ts","../../clis/types.ts","../../clis/args/service.ts","../../clis/args/switchboard.ts","../../clis/args/uninstall.ts","../../clis/args/unpublish.ts","../../clis/args/vetra.ts","../../clis/ph-dir.ts","../../clis/file-system/dependencies.ts","../../clis/file-system/directory-exists.ts","../../clis/file-system/file-exists.ts","../../clis/file-system/get-config.ts","../../clis/file-system/package-json.ts","../../clis/file-system/projects.ts","../../clis/file-system/run-cmd.ts","../../clis/file-system/spawn-async.ts","../../clis/file-system/version-info.ts","../../clis/file-system/write-file-ensuring-dir.ts","../../clis/services/telemetry.ts","../../clis/services/use-local.ts","../../clis/source-config-schema.ts","../../clis/utils.ts"],"mappings":";;;;;;;;qBAIa;;;;;;;;;;;;;qBCmBA,QAAQ;qBAER;EACX,OAAK,+CAAA;;;;qBAOM;;;;;;;;;;;;;;qBA2BA;EACX,gBAAc,+CAAA;;;EAOd,KAAG,+CAAA;;;EAKH,MAAI,+CAAA;;;EAKJ,MAAI,+CAAA;;;EAKJ,KAAG,+CAAA;;;;qBAMQ,0BAAwB,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAInC,6CAAA,iDAAA,mDAAA;qBACW,UAAQ,+CAAA;;yCAKnB,eAAA,6CAAA;qBAEW,cAAY,+CAAA;;yCAKvB,eAAA,6CAAA;qBAGW,sBAAoB,+CAAA;;yCAI/B,sDAAA,WAAA,6CAAA;qBAEW,cAAY,+CAAA;;yCAWvB,eAAA,6CAAA;qBAEW,eAAa,+CAAA;;yCAWxB,eAAA,6CAAA;qBAEW,OAAK,+CAAA;;yCAUhB,sDAAA,WAAA,6CAAA;qBAEW;;;;;;;;;;;;;;;;;;;;;;;qBAmBA,kBAAgB,+CAAA;;yCAK3B,eAAA,6CAAA;qBAEW,UAAQ,+CAAA;;yCAOnB,eAAA,6CAAA;qBAEW,iBAAe,+CAAA;;yCAK1B,eAAA,6CAAA;qBAEW,iBAAe,+CAAA;;yCAK1B,eAAA,6CAAA;qBAEW,sBAAoB,+CAAA;;yCAK/B,eAAA,6CAAA;qBAEW,wBAAsB,+CAAA;;yCAMjC,eAAA,6CAAA;qBAEW,OAAK,+CAAA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iBAEF;mBACE;mBACA;;iBAEF;mBACE;mBACA;;;;;eAKJ;eACA;eAEA;;;;;;;;;;;;;;;;;;;;;;;;;;eAGA;eACA;eACA;eACA;iBACE;mBAAW;;iBACX;mBAAY;;iBACZ;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBACA;mBAEA;qBACE;uBACE;uBACA;;;;;;;eAQR;eACA;eACA;eAEA;iBACE;mBACE;mBACA;;;;;eAMJ;eACA;eACA;eACA;iBACE;mBACE;mBACA;;;;;eAMJ;eACA;;;4BAhRO;eAsRL;;;eArVA;eAEJ;;iBAGE;iBACA;iBACA;iBACA;iBAEA;mBACE;qBAhBC;qBACM;;mBAgBP;qBACE;qBACA;;mBAEF;qBACE;qBACA;qBAEA;uBACE;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;2BACA;;yBAGF;2BACE;2BACA;6BAAS;;2BACT;;;;;;;iBASV;iBACA;iBACA;iBACA;iBAEA;mBACE;;;;mBACA;qBACE;qBACA;;;;;;;;;;;;;;;wBChFM,sBACd,YACA;EAAY;EAAiB;;qBAOlB,yBAAyB;EACpC,YAAY,wBAAwB;SAOpB,QAAQ,iBAAiB,SAAS;;wBAKpC,kBAAkB"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../clis/args/access-token.ts","../../clis/args/common.ts","../../clis/args/connect.ts","../../clis/args/generate.ts","../../clis/command-names.ts","../../clis/args/help.ts","../../clis/args/init.ts","../../clis/args/inspect.ts","../../clis/args/install.ts","../../clis/args/keyframes.ts","../../clis/args/list.ts","../../clis/args/login.ts","../../clis/args/migrate.ts","../../clis/args/publish.ts","../../clis/args/registry.ts","../../host-tokens/index.ts","../../connect/connect-config-schema.ts","../../document-model/definition-types.ts","../../document-model/schemas.ts","../../document-model/types.ts","../../clis/constants.ts","../../clis/types.ts","../../clis/args/service.ts","../../clis/args/switchboard.ts","../../clis/args/uninstall.ts","../../clis/args/unpublish.ts","../../clis/args/vetra.ts","../../clis/ph-dir.ts","../../clis/file-system/dependencies.ts","../../clis/file-system/directory-exists.ts","../../clis/file-system/file-exists.ts","../../clis/file-system/get-config.ts","../../clis/file-system/package-json.ts","../../clis/file-system/projects.ts","../../clis/file-system/run-cmd.ts","../../clis/file-system/spawn-async.ts","../../clis/file-system/version-info.ts","../../clis/file-system/write-file-ensuring-dir.ts","../../clis/services/telemetry.ts","../../clis/services/use-local.ts","../../clis/source-config-schema.ts","../../clis/utils.ts"],"mappings":";;;;;;;;qBAIa;;;;;;;;;;;;;qBCmBA,QAAQ;qBAER;EACX,OAAK,+CAAA;;;;qBAOM;;;;;;;;;;;;;;;;;;qBAoCA;EACX,gBAAc,+CAAA;;;EAOd,KAAG,+CAAA;;;EAKH,MAAI,+CAAA;;;EAKJ,MAAI,+CAAA;;;EAKJ,KAAG,+CAAA;;;;qBAMQ,0BAAwB,+CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAInC,6CAAA,iDAAA,mDAAA;qBACW,UAAQ,+CAAA;;yCAKnB,eAAA,6CAAA;qBAEW,cAAY,+CAAA;;yCAKvB,eAAA,6CAAA;qBAGW,sBAAoB,+CAAA;;yCAI/B,sDAAA,WAAA,6CAAA;qBAEW,cAAY,+CAAA;;yCAWvB,eAAA,6CAAA;qBAEW,eAAa,+CAAA;;yCAWxB,eAAA,6CAAA;qBAEW,OAAK,+CAAA;;yCAUhB,sDAAA,WAAA,6CAAA;qBAEW;;;;;;;;;;;;;;;;;;;;;;;qBAmBA,kBAAgB,+CAAA;;yCAK3B,eAAA,6CAAA;qBAEW,UAAQ,+CAAA;;yCAOnB,eAAA,6CAAA;qBAEW,iBAAe,+CAAA;;yCAK1B,eAAA,6CAAA;qBAEW,iBAAe,+CAAA;;yCAK1B,eAAA,6CAAA;qBAEW,sBAAoB,+CAAA;;yCAK/B,eAAA,6CAAA;qBAEW,wBAAsB,+CAAA;;yCAMjC,eAAA,6CAAA;qBAEW,OAAK,+CAAA;;yCAKhB,sDAAA,WAAA,6CAAA;qBAEW;;;;;;;;;;;;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;;;;;eAKJ;eACA;eAEA;;;;;;;;;;;;;;;;;;;;;;;;;;eAGA;eACA;eACA;eACA;iBACE;mBAAW;;iBACX;mBAAY;;iBACZ;mBACE;mBACA;;iBAGF;mBACE;mBACA;mBACA;mBAEA;qBACE;uBACE;uBACA;;;;;;;eAQR;eACA;eACA;eAEA;iBACE;mBACE;mBACA;;;;;eAMJ;eACA;eACA;eACA;iBACE;mBACE;mBACA;;;;;eAMJ;eACA;;;4BAhRO;eAsRL;;;eArVA;eAEJ;;iBAGE;iBACA;iBACA;iBACA;iBAEA;mBACE;qBAhBC;qBACM;;mBAgBP;qBACE;qBACA;;mBAEF;qBACE;qBACA;qBAEA;uBACE;uBACA;uBACA;uBACA;yBACE;2BACE;2BACA;2BACA;;yBAGF;2BACE;2BACA;6BAAS;;2BACT;;;;;;;iBASV;iBACA;iBACA;iBACA;iBAEA;mBACE;;;;mBACA;qBACE;qBACA;;;;;;;;;;;;;;;wBChFM,sBACd,YACA;EAAY;EAAiB;;qBAOlB,yBAAyB;EACpC,YAAY,wBAAwB;SAOpB,QAAQ,iBAAiB,SAAS;;wBAKpC,kBAAkB"}
@@ -366,6 +366,14 @@ const buildArgs = {
366
366
  defaultValue: () => false,
367
367
  defaultValueIsSerializable: true
368
368
  }),
369
+ /** @experimental Builds for a release: the release check, then a release approval. */
370
+ release: flag({
371
+ type: boolean,
372
+ long: "release",
373
+ description: "Experimental: check every document model as for a release and stop the build, previous output intact, when the check finds them invalid or cannot run; then write the release approval ph publish verifies",
374
+ defaultValue: () => false,
375
+ defaultValueIsSerializable: true
376
+ }),
369
377
  ...debugArgs
370
378
  };
371
379
  const packageManagerArgs = {
@@ -1162,18 +1170,37 @@ const migrateArgs = {
1162
1170
  }),
1163
1171
  ...debugArgs
1164
1172
  };
1173
+ //#endregion
1174
+ //#region clis/args/model.ts
1175
+ const json = flag({
1176
+ type: boolean,
1177
+ long: "json",
1178
+ description: "Print exactly one JSON report on stdout and nothing else",
1179
+ defaultValue: () => false,
1180
+ defaultValueIsSerializable: true
1181
+ });
1165
1182
  /**
1166
1183
  * @experimental Arguments of `ph model check`. Experimental while code-first
1167
1184
  * projects are introduced.
1168
1185
  */
1169
1186
  const modelCheckArgs = {
1170
- json: flag({
1187
+ /** @experimental Runs the release profile instead of the edit profile. */
1188
+ release: flag({
1171
1189
  type: boolean,
1172
- long: "json",
1173
- description: "Print exactly one JSON report on stdout and nothing else",
1190
+ long: "release",
1191
+ description: "Experimental: check as ph build --release does, with the release checks and host validation over every model. Writes nothing",
1174
1192
  defaultValue: () => false,
1175
1193
  defaultValueIsSerializable: true
1176
1194
  }),
1195
+ /** @experimental Verifies the release approval without loading the project. */
1196
+ prepack: flag({
1197
+ type: boolean,
1198
+ long: "prepack",
1199
+ description: "Experimental: without loading the package, exit 0 when the release approval ph build --release wrote matches it, 1 when it does not, and 2 when it cannot be checked. For a \"prepack\" script, so npm publish stops too",
1200
+ defaultValue: () => false,
1201
+ defaultValueIsSerializable: true
1202
+ }),
1203
+ json,
1177
1204
  ...debugArgs
1178
1205
  };
1179
1206
  positional({
@@ -1189,6 +1216,14 @@ const publishArgs = {
1189
1216
  long: "registry",
1190
1217
  description: "Registry URL to publish to (overrides config and environment)"
1191
1218
  }),
1219
+ /** @experimental Refuses to publish a package without a current release approval. */
1220
+ requireApproval: flag({
1221
+ type: boolean,
1222
+ long: "require-approval",
1223
+ description: "Experimental: publish only when the release approval that ph build --release wrote matches this package; otherwise exit 1 before contacting the registry. Forwards only --tag, --access, --otp, --dry-run, --provenance, --json and --loglevel to npm, refuses npm configuration in the environment that selects another package (npm_config_workspace, npm_config_workspaces, npm_config_include_workspace_root), and publishes with --ignore-scripts so lifecycle scripts cannot change the files it checked",
1224
+ defaultValue: () => false,
1225
+ defaultValueIsSerializable: true
1226
+ }),
1192
1227
  ...debugArgs,
1193
1228
  forwardedArgs: rest({
1194
1229
  displayName: "npm-args",
@@ -7259,6 +7294,7 @@ const connectCollectionSchema = z.strictObject({
7259
7294
  /** `collections` holds placed drives that are not default drives, keyed by declared slug. */
7260
7295
  const connectRuntimeInstanceSchema = connectInstanceSchema.extend({
7261
7296
  reactorClient: connectReactorClientModeSchema.optional(),
7297
+ storage: z.enum(["idb", "memory"]).optional().meta({ description: "Where the browser reactor keeps its stores. `memory`: nothing outlives the page (or its shared worker). Absent: idb." }),
7262
7298
  remoteBackends: z.array(connectRemoteBackendSchema).optional(),
7263
7299
  collections: z.record(z.string(), connectCollectionSchema).optional(),
7264
7300
  router: connectRouterSettingsSchema.optional()