@powerhousedao/ph-cli 6.2.3-dev.66 → 6.2.3-dev.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-BM-zayLm.mjs → build-BP1PCFAd.mjs} +95 -11
- package/dist/build-BP1PCFAd.mjs.map +1 -0
- package/dist/build-MGRC-NiE.mjs +4 -0
- package/dist/cli.mjs +3 -3
- package/dist/{connect-build-DO93w0f7.mjs → connect-build-DBmBetdz.mjs} +17 -8
- package/dist/connect-build-DBmBetdz.mjs.map +1 -0
- package/dist/{connect-preview-DqWtPruk.mjs → connect-preview-8-qLgWKt.mjs} +25 -9
- package/dist/connect-preview-8-qLgWKt.mjs.map +1 -0
- package/dist/{connect-studio-k5vB41GX.mjs → connect-studio-BehPZzN7.mjs} +3 -3
- package/dist/{connect-studio-FEEyWfwB.mjs → connect-studio-Bhlc77WI.mjs} +6 -5
- package/dist/connect-studio-Bhlc77WI.mjs.map +1 -0
- package/dist/{ph-cli-commands-ifxjNJoa.mjs → ph-cli-commands-B4NF0Tge.mjs} +8 -8
- package/dist/{ph-cli-commands-ifxjNJoa.mjs.map → ph-cli-commands-B4NF0Tge.mjs.map} +1 -1
- package/dist/ph-cli-commands-x2tgI92h.mjs +4 -0
- package/dist/runners/compound.mjs +1 -1
- package/dist/runners/connect.d.mts +2 -1
- package/dist/runners/connect.d.mts.map +1 -1
- package/dist/runners/connect.mjs +24 -11
- package/dist/runners/connect.mjs.map +1 -1
- package/dist/runners/switchboard.mjs +2 -2
- package/dist/{vetra-DPN1SpOC.mjs → vetra-LGTnoMVO.mjs} +4 -4
- package/dist/{vetra-DPN1SpOC.mjs.map → vetra-LGTnoMVO.mjs.map} +1 -1
- package/package.json +13 -13
- package/dist/build-BM-zayLm.mjs.map +0 -1
- package/dist/build-BZGpUn8f.mjs +0 -4
- package/dist/connect-build-DO93w0f7.mjs.map +0 -1
- package/dist/connect-preview-DqWtPruk.mjs.map +0 -1
- package/dist/connect-studio-FEEyWfwB.mjs.map +0 -1
- package/dist/ph-cli-commands-qdvATJ2S.mjs +0 -4
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="6768a595-74db-5dc7-ae1d-02422e474076")}catch(e){}}();
|
|
3
|
+
import { existsSync, readFileSync, readdirSync, writeFileSync } from "node:fs";
|
|
4
4
|
import { join, resolve } from "node:path";
|
|
5
5
|
import { execSync } from "node:child_process";
|
|
6
6
|
import { detect, resolveCommand } from "package-manager-detector";
|
|
@@ -45,6 +45,78 @@ async function assertManifestNameMatchesPackage(projectPath) {
|
|
|
45
45
|
}
|
|
46
46
|
if (manifestName !== packageName) throw new Error(`Package name mismatch — "package.json" and "powerhouse.manifest.json" must have the same "name":\n package.json "name": ${JSON.stringify(packageName)}\n powerhouse.manifest.json "name": ${JSON.stringify(manifestName)}\n\nUpdate one so they match, then run the build again.`);
|
|
47
47
|
}
|
|
48
|
+
const OFFERED_ROUTES_MODULE = ".ph/connect-routes.package.ts";
|
|
49
|
+
const HOST_ROUTES_DIR = "hosts/connect/routes";
|
|
50
|
+
function withOfferedRoutes(json, offers) {
|
|
51
|
+
const manifest = JSON.parse(json);
|
|
52
|
+
if (offers ? manifest.connectRoutes === true : !("connectRoutes" in manifest)) return json;
|
|
53
|
+
if (offers) manifest.connectRoutes = true;
|
|
54
|
+
else delete manifest.connectRoutes;
|
|
55
|
+
return `${JSON.stringify(manifest, null, 2)}\n`;
|
|
56
|
+
}
|
|
57
|
+
const slashes = (path) => path.replaceAll("\\", "/");
|
|
58
|
+
/** Sets `connectRoutes` in the manifest the package's root module imports,
|
|
59
|
+
* leaving the project's file as it is. */
|
|
60
|
+
function offeredRoutesManifest(projectRoot, offers) {
|
|
61
|
+
const manifestPath = slashes(join(projectRoot, "powerhouse.manifest.json"));
|
|
62
|
+
return {
|
|
63
|
+
name: "ph-offered-routes-manifest",
|
|
64
|
+
transform(code, id) {
|
|
65
|
+
if (slashes(id) !== manifestPath) return null;
|
|
66
|
+
return {
|
|
67
|
+
code: withOfferedRoutes(code, offers),
|
|
68
|
+
map: null
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/** Sets `connectRoutes` in the dist copy of the manifest. */
|
|
74
|
+
function markOfferedRoutes(dir, offers) {
|
|
75
|
+
const manifestPath = join(dir, "powerhouse.manifest.json");
|
|
76
|
+
if (!existsSync(manifestPath)) return;
|
|
77
|
+
const json = readFileSync(manifestPath, "utf-8");
|
|
78
|
+
writeFileSync(manifestPath, withOfferedRoutes(json, offers));
|
|
79
|
+
}
|
|
80
|
+
const CONNECT_IMPORT = /^@powerhousedao\/connect(\/|$)/;
|
|
81
|
+
const CONNECT_IMPORT_HINT = "Routes a package offers other Connects import @powerhousedao/connect-core instead (ContentOutlet, ModalDialog, RouteSelection, useDriveRouteData, useNavRoutes and useSidebarMode from @powerhousedao/connect-core/router, SidebarItem from @powerhousedao/design-system/connect); only its own host's _app.tsx and overrides may use @powerhousedao/connect.";
|
|
82
|
+
function reachableFrom(graph, entry) {
|
|
83
|
+
const reached = /* @__PURE__ */ new Set();
|
|
84
|
+
const pending = [entry];
|
|
85
|
+
for (let id = pending.pop(); id !== void 0; id = pending.pop()) {
|
|
86
|
+
if (reached.has(id)) continue;
|
|
87
|
+
reached.add(id);
|
|
88
|
+
const info = graph.getModuleInfo(id);
|
|
89
|
+
if (info) pending.push(...info.importedIds, ...info.dynamicallyImportedIds);
|
|
90
|
+
}
|
|
91
|
+
return reached;
|
|
92
|
+
}
|
|
93
|
+
/** Fails the build on an import of Connect that the offered routes reach, as
|
|
94
|
+
* other Connects don't share Connect with the package; warns on one from the
|
|
95
|
+
* rest of the package, which bundles a copy of the Connect modules it uses. */
|
|
96
|
+
function noConnectImports(routesEntry, routesDir) {
|
|
97
|
+
const imports = /* @__PURE__ */ new Map();
|
|
98
|
+
const slash = (path) => path.replaceAll("\\", "/");
|
|
99
|
+
const isRoute = (id) => slash(id) === slash(routesEntry) || slash(id).startsWith(`${slash(routesDir)}/`);
|
|
100
|
+
return {
|
|
101
|
+
name: "ph-offered-routes-imports",
|
|
102
|
+
resolveId(source, importer) {
|
|
103
|
+
if (!importer || !CONNECT_IMPORT.test(source)) return null;
|
|
104
|
+
if (isRoute(importer)) throw new Error(`${importer} imports "${source}". ${CONNECT_IMPORT_HINT}`);
|
|
105
|
+
const sources = imports.get(importer) ?? /* @__PURE__ */ new Set();
|
|
106
|
+
imports.set(importer, sources.add(source));
|
|
107
|
+
return null;
|
|
108
|
+
},
|
|
109
|
+
buildEnd(error) {
|
|
110
|
+
if (error || !imports.size) return;
|
|
111
|
+
const entry = this.getModuleInfo(routesEntry) ? routesEntry : slash(routesEntry);
|
|
112
|
+
const reached = reachableFrom(this, entry);
|
|
113
|
+
const described = ([importer, sources]) => `${importer} imports ${[...sources].map((s) => `"${s}"`).join(", ")}`;
|
|
114
|
+
const offered = [...imports].filter(([id]) => reached.has(id));
|
|
115
|
+
if (offered.length) this.error(`${offered.map(described).join("\n")}\n${CONNECT_IMPORT_HINT}`);
|
|
116
|
+
console.warn(`⚠ ${[...imports].map(described).join("\n")}\nConnect isn't shared with the packages it loads, so the build bundles a copy of these modules, apart from the app's state. Import @powerhousedao/connect-core instead; a later version fails the build.`);
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
48
120
|
async function runBuild(args) {
|
|
49
121
|
const { outDir } = args;
|
|
50
122
|
const projectRoot = process.cwd();
|
|
@@ -57,23 +129,34 @@ async function runBuild(args) {
|
|
|
57
129
|
assertPiecesOutDir(target);
|
|
58
130
|
const sharedDeps = !args.noSharedDeps;
|
|
59
131
|
const agent = (await detect())?.agent ?? "npm";
|
|
60
|
-
if ([
|
|
132
|
+
if ([
|
|
133
|
+
HOST_ROUTES_DIR,
|
|
134
|
+
".ph/connect-routes.gen.ts",
|
|
135
|
+
OFFERED_ROUTES_MODULE
|
|
136
|
+
].some((p) => existsSync(join(projectRoot, p)))) {
|
|
61
137
|
const { resolveConnectRoutesDir, syncConnectRoutes } = await import("@powerhousedao/builder-tools");
|
|
62
138
|
await syncConnectRoutes(projectRoot, resolveConnectRoutesDir(projectRoot));
|
|
63
139
|
}
|
|
140
|
+
const offersRoutes = existsSync(join(projectRoot, OFFERED_ROUTES_MODULE));
|
|
64
141
|
const typesOk = emitTypes(agent, outDir);
|
|
65
142
|
if (!typesOk && !args.ignoreTypeErrors) await confirmBuildDespiteTypeErrors();
|
|
66
143
|
const detection = createDetectionCache();
|
|
67
144
|
const trace = createTraceFiles();
|
|
145
|
+
const routesEntry = join(projectRoot, OFFERED_ROUTES_MODULE);
|
|
68
146
|
await build({
|
|
69
147
|
...buildBrowserBuildConfig({
|
|
70
148
|
sharedDeps,
|
|
71
|
-
plugins: [
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
149
|
+
plugins: [
|
|
150
|
+
externalDepsPlugin(trace, /* @__PURE__ */ new Map(), {
|
|
151
|
+
root: projectRoot,
|
|
152
|
+
browser: true,
|
|
153
|
+
cache: detection
|
|
154
|
+
}),
|
|
155
|
+
offeredRoutesManifest(projectRoot, offersRoutes),
|
|
156
|
+
noConnectImports(routesEntry, join(projectRoot, HOST_ROUTES_DIR))
|
|
157
|
+
]
|
|
76
158
|
}),
|
|
159
|
+
...offersRoutes ? { entry: [...browserEntry, { "connect-routes": routesEntry }] } : {},
|
|
77
160
|
outDir: join(outDir, "browser")
|
|
78
161
|
});
|
|
79
162
|
if (sharedDeps) {
|
|
@@ -107,6 +190,7 @@ async function runBuild(args) {
|
|
|
107
190
|
cache: detection
|
|
108
191
|
});
|
|
109
192
|
syncDistManifest(target, built, externalDependencyVersions(external.values()));
|
|
193
|
+
markOfferedRoutes(outDir, offersRoutes);
|
|
110
194
|
const executeLocalCommand = resolveCommand(agent, "execute-local", [
|
|
111
195
|
"tailwindcss",
|
|
112
196
|
"-i",
|
|
@@ -208,7 +292,7 @@ function readDistBrowserFiles(dir) {
|
|
|
208
292
|
return out;
|
|
209
293
|
}
|
|
210
294
|
//#endregion
|
|
211
|
-
export {
|
|
295
|
+
export { noConnectImports as a, markOfferedRoutes as i, assertManifestNameMatchesPackage as n, offeredRoutesManifest as o, createTraceFiles as r, runBuild as s, assertExternalDependenciesDeclared as t };
|
|
212
296
|
|
|
213
|
-
//# sourceMappingURL=build-
|
|
214
|
-
//# debugId=
|
|
297
|
+
//# sourceMappingURL=build-BP1PCFAd.mjs.map
|
|
298
|
+
//# debugId=6768a595-74db-5dc7-ae1d-02422e474076
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-BP1PCFAd.mjs","sources":["../src/services/build.ts"],"sourcesContent":["import {\n browserEntry,\n buildBrowserBuildConfig,\n buildNodeBuildConfig,\n findBundledSharedDeps,\n} from \"@powerhousedao/shared/build-config\";\nimport type {\n BuiltPiece,\n ExternalDependency,\n TraceFiles,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n assertPiecesOutDir,\n buildPieces,\n expandEntryGlobs,\n createDetectionCache,\n externalDependencyVersions,\n projectPath,\n externalDepsPlugin,\n pieceListPath,\n planPieces,\n syncDistManifest,\n undeclaredExternalDependencies,\n} from \"@powerhousedao/shared/build-pieces\";\nimport {\n findSharedImports,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n} from \"@powerhousedao/shared/connect\";\nimport { execSync } from \"node:child_process\";\nimport { existsSync, readdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport { nodeFileTrace } from \"@vercel/nft\";\nimport { detect, resolveCommand, type Agent } from \"package-manager-detector\";\nimport { readPackage } from \"read-pkg\";\nimport { build as tsdownBuild } from \"tsdown\";\nimport type { BuildArgs } from \"../types.js\";\n\n// nft reports paths relative to its base; from \"/\" that is every path minus its root.\n// One cache per build: the traces of a project's packages share most files.\nexport function createTraceFiles(): TraceFiles {\n const cache = {};\n return (file) => traceFile(file, cache);\n}\n\nexport const traceFiles: TraceFiles = createTraceFiles();\n\nasync function traceFile(file: string, cache: object) {\n const { fileList, reasons } = await nodeFileTrace([file], {\n base: \"/\",\n cache,\n });\n const absolute = (p: string) => resolve(\"/\", p);\n return {\n fileList: new Set([...fileList].map(absolute)),\n reasons: new Map(\n [...reasons].map(([p, reason]) => [\n absolute(p),\n { parents: new Set([...reason.parents].map(absolute)) },\n ]),\n ),\n };\n}\n\n/**\n * A Powerhouse package's `powerhouse.manifest.json` \"name\" must match its\n * `package.json` \"name\" — Connect and the registry resolve installed versions\n * by treating the manifest name as the npm package name, so a mismatch silently\n * breaks resolution. Fail the build early if they diverge. No-op when the\n * project has no manifest (nothing to compare).\n */\nexport async function assertManifestNameMatchesPackage(projectPath: string) {\n const manifestPath = join(projectPath, \"powerhouse.manifest.json\");\n if (!existsSync(manifestPath)) return;\n\n const { name: packageName } = await readPackage({ cwd: projectPath });\n\n let manifestName: unknown;\n try {\n manifestName = (\n JSON.parse(readFileSync(manifestPath, \"utf-8\")) as { name?: unknown }\n ).name;\n } catch {\n throw new Error(\n `Failed to parse \"powerhouse.manifest.json\" at ${manifestPath}. Make sure it is valid JSON.`,\n );\n }\n\n if (manifestName !== packageName) {\n throw new Error(\n `Package name mismatch — \"package.json\" and \"powerhouse.manifest.json\" must have the same \"name\":\\n` +\n ` package.json \"name\": ${JSON.stringify(packageName)}\\n` +\n ` powerhouse.manifest.json \"name\": ${JSON.stringify(manifestName)}\\n\\n` +\n `Update one so they match, then run the build again.`,\n );\n }\n}\n\n// builder-tools' PACKAGE_ROUTES_MODULE and HOST_ROUTES_DIR, without loading it\n// for packages with no routes.\nconst OFFERED_ROUTES_MODULE = \".ph/connect-routes.package.ts\";\nconst HOST_ROUTES_DIR = \"hosts/connect/routes\";\n\n// The manifest with `connectRoutes` set when the package offers routes; as it\n// is, byte for byte, when the flag is already right.\nfunction withOfferedRoutes(json: string, offers: boolean) {\n const manifest = JSON.parse(json) as { connectRoutes?: boolean };\n if (offers ? manifest.connectRoutes === true : !(\"connectRoutes\" in manifest))\n return json;\n if (offers) manifest.connectRoutes = true;\n else delete manifest.connectRoutes;\n return `${JSON.stringify(manifest, null, 2)}\\n`;\n}\n\nconst slashes = (path: string) => path.replaceAll(\"\\\\\", \"/\");\n\n/** Sets `connectRoutes` in the manifest the package's root module imports,\n * leaving the project's file as it is. */\nexport function offeredRoutesManifest(projectRoot: string, offers: boolean) {\n // Vite's ids use forward slashes on Windows too.\n const manifestPath = slashes(join(projectRoot, \"powerhouse.manifest.json\"));\n return {\n name: \"ph-offered-routes-manifest\",\n transform(code: string, id: string) {\n if (slashes(id) !== manifestPath) return null;\n return { code: withOfferedRoutes(code, offers), map: null };\n },\n };\n}\n\n/** Sets `connectRoutes` in the dist copy of the manifest. */\nexport function markOfferedRoutes(dir: string, offers: boolean) {\n const manifestPath = join(dir, \"powerhouse.manifest.json\");\n if (!existsSync(manifestPath)) return;\n const json = readFileSync(manifestPath, \"utf-8\");\n writeFileSync(manifestPath, withOfferedRoutes(json, offers));\n}\n\nconst CONNECT_IMPORT = /^@powerhousedao\\/connect(\\/|$)/;\n\nconst CONNECT_IMPORT_HINT =\n \"Routes a package offers other Connects import @powerhousedao/connect-core instead (ContentOutlet, ModalDialog, RouteSelection, useDriveRouteData, useNavRoutes and useSidebarMode from @powerhousedao/connect-core/router, SidebarItem from @powerhousedao/design-system/connect); only its own host's _app.tsx and overrides may use @powerhousedao/connect.\";\n\ntype ModuleGraph = {\n getModuleInfo(id: string): {\n importedIds: readonly string[];\n dynamicallyImportedIds: readonly string[];\n } | null;\n error(message: string): never;\n};\n\nfunction reachableFrom(graph: ModuleGraph, entry: string) {\n const reached = new Set<string>();\n const pending = [entry];\n for (let id = pending.pop(); id !== undefined; id = pending.pop()) {\n if (reached.has(id)) continue;\n reached.add(id);\n const info = graph.getModuleInfo(id);\n if (info) pending.push(...info.importedIds, ...info.dynamicallyImportedIds);\n }\n return reached;\n}\n\n/** Fails the build on an import of Connect that the offered routes reach, as\n * other Connects don't share Connect with the package; warns on one from the\n * rest of the package, which bundles a copy of the Connect modules it uses. */\nexport function noConnectImports(routesEntry: string, routesDir: string) {\n const imports = new Map<string, Set<string>>();\n // Module ids may spell a Windows path with either separator.\n const slash = (path: string) => path.replaceAll(\"\\\\\", \"/\");\n const isRoute = (id: string) =>\n slash(id) === slash(routesEntry) ||\n slash(id).startsWith(`${slash(routesDir)}/`);\n return {\n name: \"ph-offered-routes-imports\",\n resolveId(source: string, importer: string | undefined) {\n if (!importer || !CONNECT_IMPORT.test(source)) return null;\n // Before resolving it: a route file's import fails even unresolved.\n if (isRoute(importer)) {\n throw new Error(\n `${importer} imports \"${source}\". ${CONNECT_IMPORT_HINT}`,\n );\n }\n const sources = imports.get(importer) ?? new Set<string>();\n imports.set(importer, sources.add(source));\n return null;\n },\n buildEnd(this: ModuleGraph, error?: Error) {\n if (error || !imports.size) return;\n const entry = this.getModuleInfo(routesEntry)\n ? routesEntry\n : slash(routesEntry);\n const reached = reachableFrom(this, entry);\n const described = ([importer, sources]: [string, Set<string>]) =>\n `${importer} imports ${[...sources].map((s) => `\"${s}\"`).join(\", \")}`;\n const offered = [...imports].filter(([id]) => reached.has(id));\n if (offered.length) {\n this.error(\n `${offered.map(described).join(\"\\n\")}\\n${CONNECT_IMPORT_HINT}`,\n );\n }\n console.warn(\n `⚠ ${[...imports].map(described).join(\"\\n\")}\\nConnect isn't shared with the packages it loads, so the build bundles a copy of these modules, apart from the app's state. Import @powerhousedao/connect-core instead; a later version fails the build.`,\n );\n },\n };\n}\n\nexport async function runBuild(args: BuildArgs) {\n const { outDir } = args;\n const projectRoot = process.cwd();\n\n // Fail fast if the manifest name and package.json name have drifted apart.\n await assertManifestNameMatchesPackage(projectRoot);\n\n const target = {\n projectRoot,\n outDir,\n pieces: planPieces(projectRoot, outDir),\n };\n // Before any bundler runs: an out-dir a host will never read from is worth\n // nothing built, and the failure names what the contract is.\n assertPiecesOutDir(target);\n const sharedDeps = !args.noSharedDeps;\n\n const detectResult = await detect();\n const agent = detectResult?.agent ?? \"npm\";\n\n // Project routes type-check against the tree generated from them. The\n // probes mirror resolveConnectRoutesDir, so builder-tools loads only when needed.\n const routeProbes = [\n HOST_ROUTES_DIR,\n \".ph/connect-routes.gen.ts\",\n OFFERED_ROUTES_MODULE,\n ];\n if (routeProbes.some((p) => existsSync(join(projectRoot, p)))) {\n const { resolveConnectRoutesDir, syncConnectRoutes } =\n await import(\"@powerhousedao/builder-tools\");\n await syncConnectRoutes(projectRoot, resolveConnectRoutesDir(projectRoot));\n }\n // Connect reads the manifest's flag to load the package's routes.\n const offersRoutes = existsSync(join(projectRoot, OFFERED_ROUTES_MODULE));\n\n // Before any bundler runs, so declining leaves nothing half built.\n const typesOk = emitTypes(agent, outDir);\n if (!typesOk && !args.ignoreTypeErrors) {\n await confirmBuildDespiteTypeErrors();\n }\n\n // Shared by the browser, node and piece builds: nothing is traced twice.\n const detection = createDetectionCache();\n const trace = createTraceFiles();\n const routesEntry = join(projectRoot, OFFERED_ROUTES_MODULE);\n // Everything in the browser build is code Connect can load: native fails it.\n await tsdownBuild({\n ...buildBrowserBuildConfig({\n sharedDeps,\n plugins: [\n externalDepsPlugin(trace, new Map(), {\n root: projectRoot,\n browser: true,\n cache: detection,\n }),\n offeredRoutesManifest(projectRoot, offersRoutes),\n noConnectImports(routesEntry, join(projectRoot, HOST_ROUTES_DIR)),\n ],\n }),\n // The offered routes in the package's build: a module both import is one\n // chunk, which other Connects evaluate once. Absolute: a relative entry\n // is a glob, and globs skip `.ph`.\n ...(offersRoutes\n ? { entry: [...browserEntry, { \"connect-routes\": routesEntry }] }\n : {}),\n outDir: join(outDir, \"browser\"),\n });\n\n // Advisory: a shared dep the source imports but the output no longer\n // references as a bare import was inlined despite the external set.\n if (sharedDeps) {\n const imported = findSharedImportsInSources(projectRoot, browserEntry);\n const bundled = findBundledSharedDeps(\n imported,\n readDistBrowserFiles(join(outDir, \"browser\")),\n );\n if (bundled.length > 0) {\n console.warn(\n `⚠ shared deps bundled instead of externalized: ${bundled.join(\", \")} — check your neverBundle config`,\n );\n }\n }\n\n const external = new Map<string, ExternalDependency>();\n await tsdownBuild({\n ...buildNodeBuildConfig({\n sharedDeps,\n plugins: [\n // Editors never run on a host; document models run in Connect too.\n externalDepsPlugin(trace, external, {\n root: projectRoot,\n ignoreDirs: [\"editors\"],\n forbidDirs: [\"document-models\"],\n cache: detection,\n }),\n ],\n }),\n outDir: join(outDir, \"node\"),\n });\n const pkg = await readPackage({ cwd: projectRoot });\n assertExternalDependenciesDeclared(projectRoot, [...external.values()], pkg);\n\n // After the node build: it cleans <outDir>/node, where the pieces land. The\n // built list is the gate, so a `bundle:` entry is validated with no piece dir.\n let built: BuiltPiece[] = [];\n if (existsSync(pieceListPath(target))) {\n built = await buildPieces(\n target,\n {\n name: pkg.name,\n version: pkg.version,\n license: typeof pkg.license === \"string\" ? pkg.license : undefined,\n },\n { bundle: tsdownBuild, trace, cache: detection },\n );\n }\n syncDistManifest(\n target,\n built,\n externalDependencyVersions(external.values()),\n );\n markOfferedRoutes(outDir, offersRoutes);\n\n const executeLocalCommand = resolveCommand(agent, \"execute-local\", [\n \"tailwindcss\",\n \"-i\",\n \"./style.css\",\n \"-o\",\n \"./dist/style.css\",\n ]);\n if (executeLocalCommand === null) {\n console.error(\n \"You need to have tailwindcss installed to use the `build` command.\",\n );\n process.exit(1);\n }\n execSync(\n `${executeLocalCommand.command} ${executeLocalCommand.args.join(\" \")}`,\n );\n\n // Last, so it is the line a finished build leaves on screen.\n if (!typesOk) console.warn(`\\n${UNSAFE_BUILD_WARNING}`);\n}\n\n// A package with a native addon or WebAssembly module stays external, so the\n// package's consumers must install it: devDependencies are skipped by every install.\nexport function assertExternalDependenciesDeclared(\n projectRoot: string,\n found: ExternalDependency[],\n pkg: Parameters<typeof undeclaredExternalDependencies>[1],\n) {\n for (const dep of found) {\n console.log(\n `${dep.name}@${dep.version} stays external, it needs ${projectPath(projectRoot, dep.file)}`,\n );\n }\n const undeclared = undeclaredExternalDependencies(found, pkg);\n if (undeclared.length === 0) return;\n const lines = undeclared.map(\n (dep) =>\n ` ${dep.name}${dep.importer ? ` (imported by ${projectPath(projectRoot, dep.importer)})` : \"\"}`,\n );\n throw new Error(\n `Packages with native addons or WebAssembly modules must be listed in package.json \"dependencies\", \"optionalDependencies\" or \"peerDependencies\":\\n` +\n `${lines.join(\"\\n\")}\\n\\n` +\n `They stay external to the build, and installs of this package skip devDependencies.`,\n );\n}\n\n// Runs tsc, which checks the project and writes its declarations either way.\n// Returns whether it reported no type errors.\nfunction emitTypes(agent: Agent, outDir: string): boolean {\n const tscCommand = resolveCommand(agent, \"execute-local\", [\"tsc\", \"--build\"]);\n if (tscCommand === null) {\n console.error(\n \"You need to have typescript installed to use the `build` command.\",\n );\n process.exit(1);\n }\n console.log(\"\\n▶ Type-checking and emitting types via tsc...\");\n try {\n execSync(`${tscCommand.command} ${tscCommand.args.join(\" \")}`, {\n stdio: \"inherit\",\n });\n console.log(\"✔ Types emitted to\", join(outDir, \"types\"));\n return true;\n } catch {\n return false;\n }\n}\n\nfunction isInteractive(): boolean {\n return Boolean(process.stdin.isTTY) && !process.env.CI;\n}\n\nconst TYPE_ERROR_RISK =\n \"A package built with type errors can load and still fail at runtime.\";\n\nconst UNSAFE_BUILD_WARNING =\n \"⚠ Built despite type errors. \" +\n TYPE_ERROR_RISK +\n \" Fix them before you publish or deploy it.\";\n\nasync function confirmBuildDespiteTypeErrors(): Promise<void> {\n const hint =\n \"Fix them and build again. --ignore-type-errors skips this check, at the risk of shipping that failure.\";\n if (!isInteractive()) {\n console.error(\n `\\n✘ tsc reported the type errors above. ${TYPE_ERROR_RISK}\\n${hint}`,\n );\n process.exit(1);\n }\n const enquirer = await import(\"enquirer\");\n let confirmed: boolean;\n try {\n const answer = await enquirer.default.prompt<{ confirmed: boolean }>({\n type: \"confirm\",\n name: \"confirmed\",\n message: `tsc reported the type errors above. ${TYPE_ERROR_RISK} Build anyway?`,\n initial: false,\n });\n confirmed = answer.confirmed;\n } catch {\n // Ctrl-C at the prompt is a decline.\n confirmed = false;\n }\n if (!confirmed) {\n console.error(`Build cancelled. ${hint}`);\n process.exit(1);\n }\n}\n\n/**\n * Every shared specifier imported from the entry sources; the post-build\n * scan compares these against the built output.\n *\n * Scoped to the specifiers the build actually externalizes: a specifier the\n * vendor does not publish (the bare `@powerhousedao/shared` root, an\n * unvendored subpath) is deliberately bundled, so reporting it as \"bundled\n * instead of externalized\" would be a false alarm.\n */\nfunction findSharedImportsInSources(root: string, globs: string[]): string[] {\n const found = new Set<string>();\n for (const file of expandEntryGlobs(root, globs)) {\n const src = readFileSync(file, \"utf8\");\n for (const spec of findSharedImports(\n src,\n EXTERNALIZABLE_SHARED_SPECIFIERS,\n )) {\n found.add(spec);\n }\n }\n return [...found].sort();\n}\n\n/**\n * The built JS outputs of a browser build (entry files and chunks).\n */\nfunction readDistBrowserFiles(\n dir: string,\n): { path: string; content: string }[] {\n const out: { path: string; content: string }[] = [];\n if (!existsSync(dir)) return out;\n const walk = (d: string) => {\n for (const e of readdirSync(d, { withFileTypes: true })) {\n const p = join(d, e.name);\n if (e.isDirectory()) walk(p);\n else if (e.isFile() && e.name.endsWith(\".js\")) {\n out.push({ path: p, content: readFileSync(p, \"utf8\") });\n }\n }\n };\n walk(dir);\n return out;\n}\n"],"names":["tsdownBuild"],"mappings":";;;;;;;;;;;;;AAuCA,SAAgB,mBAA+B;CAC7C,MAAM,QAAQ,CAAC;CACf,Q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AM,QAAQ,MAAc;EAC1B,KAAK,MAAM,KAAK,YAAY,GAAG,EAAE,eAAe,KAAK,CAAC,GAAG;GACvD,MAAM,IAAI,KAAK,GAAG,EAAE,IAAI;GACxB,IAAI,EAAE,YAAY,GAAG,KAAK,CAAC;QACtB,IAAI,EAAE,OAAO,KAAK,EAAE,KAAK,SAAS,KAAK,GAC1C,IAAI,KAAK;IAAE,MAAM;IAAG,SAAS,aAAa,GAAG,MAAM;GAAE,CAAC;EAE1D;CACF;CACA,KAAK,GAAG;CACR,OAAO;AACT","debug_id":"6768a595-74db-5dc7-ae1d-02422e474076"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { s as runBuild } from "./build-BP1PCFAd.mjs";
|
|
2
|
+
export { runBuild };
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="99a4b729-3560-5c2e-8717-787540d03ba8")}catch(e){}}();
|
|
4
|
+
//# debugId=99a4b729-3560-5c2e-8717-787540d03ba8
|
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d751098f-ddb0-5813-9f72-4bdc5e15a867")}catch(e){}}();
|
|
4
|
-
import { n as phCliCommands } from "./ph-cli-commands-
|
|
4
|
+
import { n as phCliCommands } from "./ph-cli-commands-B4NF0Tge.mjs";
|
|
5
5
|
import { t as isUniformRunnersEnabled } from "./feature-flags-xwqcHEWC.mjs";
|
|
6
6
|
import { initCliTelemetry } from "@powerhousedao/shared/clis/telemetry";
|
|
7
7
|
import { assertNodeVersion } from "@powerhousedao/shared/clis/utils";
|
|
@@ -10,7 +10,7 @@ import { phCliHelpCommands } from "@powerhousedao/shared/clis/args";
|
|
|
10
10
|
import { bold, yellow } from "colorette";
|
|
11
11
|
//#region src/get-version.ts
|
|
12
12
|
function getVersion() {
|
|
13
|
-
return "6.2.3-dev.
|
|
13
|
+
return "6.2.3-dev.67";
|
|
14
14
|
}
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/utils/constants.ts
|
|
@@ -93,7 +93,7 @@ async function main() {
|
|
|
93
93
|
let args = process.argv.slice(2);
|
|
94
94
|
if (isUniformRunnersEnabled()) {
|
|
95
95
|
const { applyRunSugar } = await import("./run-sugar-BdjKTPGO.mjs");
|
|
96
|
-
const { phCliCommands } = await import("./ph-cli-commands-
|
|
96
|
+
const { phCliCommands } = await import("./ph-cli-commands-x2tgI92h.mjs");
|
|
97
97
|
const sugar = applyRunSugar(args, new Set(Object.keys(phCliCommands)), process.cwd());
|
|
98
98
|
if (sugar.warning) console.warn(sugar.warning);
|
|
99
99
|
args = sugar.args;
|
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
3
|
-
import {
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c63f999a-a189-5178-96be-68414e8b76fd")}catch(e){}}();
|
|
3
|
+
import { s as runBuild } from "./build-BP1PCFAd.mjs";
|
|
4
4
|
import { t as buildCliConnectOverride } from "./cli-connect-override-Cf7WutqU.mjs";
|
|
5
5
|
import { n as isPrecompressEnabled, r as precompressAssets } from "./precompress-P6cJDPVC.mjs";
|
|
6
6
|
import { existsSync, mkdirSync, readdirSync, rmSync } from "node:fs";
|
|
7
7
|
import { join, resolve } from "node:path";
|
|
8
8
|
import { getConfig } from "@powerhousedao/shared/clis";
|
|
9
|
-
import { SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
9
|
+
import { SHARED_DEP_SPECIFIERS, SHARED_SUBPATHS, deepMerge, normalizeBasePath } from "@powerhousedao/shared/connect";
|
|
10
10
|
import { DEFAULT_VENDOR_INCLUDE, DYNAMIC_BASE_PLACEHOLDER, directoryContentDigest, findPackageRoot, getConnectBaseViteConfig, missingVendorEntries, ownProjectPackage, prebuildConnectVendor, prebuildReactorWorker, prebuildWorkerPackages, resolveReactorWorkerSource } from "@powerhousedao/builder-tools";
|
|
11
11
|
import { build, mergeConfig } from "vite";
|
|
12
12
|
//#region src/services/connect-build.ts
|
|
13
|
-
async function runConnectBuild(args) {
|
|
13
|
+
async function runConnectBuild(args, callerOverride, { routes } = {}) {
|
|
14
14
|
const { outDir, debug, dynamicBase, favicon } = args;
|
|
15
15
|
const mode = "production";
|
|
16
16
|
const dirname = process.cwd();
|
|
17
17
|
if (args.keyPositional !== void 0 && args.valuePositional === void 0) throw new Error("ph connect build: positional override requires both <key> and <value> (e.g. `ph connect build connect.renown.url https://renown.staging`). To read a value, use `ph connect config <key>`.");
|
|
18
18
|
assertLocalPackagesInstalled(dirname);
|
|
19
|
-
const
|
|
19
|
+
const cli = buildCliConnectOverride(args);
|
|
20
|
+
const { packageRegistryUrl } = cli;
|
|
21
|
+
const connectOverride = callerOverride ? deepMerge(callerOverride, cli.connectOverride ?? {}) : cli.connectOverride;
|
|
20
22
|
await runBuild({
|
|
21
23
|
outDir: "dist",
|
|
22
24
|
debug,
|
|
@@ -57,6 +59,7 @@ async function runConnectBuild(args) {
|
|
|
57
59
|
cliPackageRegistryUrl: packageRegistryUrl,
|
|
58
60
|
dynamicBase,
|
|
59
61
|
favicon,
|
|
62
|
+
routes,
|
|
60
63
|
vendor: vendor ? {
|
|
61
64
|
imports: vendorImportMapEntries(vendor.imports, appBase),
|
|
62
65
|
versions: vendor.versions,
|
|
@@ -115,7 +118,13 @@ const CONNECT_OWN_VENDOR_DEPS = [
|
|
|
115
118
|
"@renown/sdk",
|
|
116
119
|
"@renown/sdk/crypto",
|
|
117
120
|
"@renown/sdk/trust",
|
|
118
|
-
"@powerhousedao/reactor-attachments/client"
|
|
121
|
+
"@powerhousedao/reactor-attachments/client",
|
|
122
|
+
"@powerhousedao/connect-core",
|
|
123
|
+
"@powerhousedao/connect-core/router",
|
|
124
|
+
"@powerhousedao/connect-core/plugins",
|
|
125
|
+
"@powerhousedao/connect-core/runtime",
|
|
126
|
+
"@powerhousedao/connect-core/views",
|
|
127
|
+
"@tanstack/react-router"
|
|
119
128
|
];
|
|
120
129
|
function connectOwnVendorDeps(dirname) {
|
|
121
130
|
const from = findPackageRoot(dirname, "@powerhousedao/connect");
|
|
@@ -240,5 +249,5 @@ function assertLocalPackagesInstalled(projectPath) {
|
|
|
240
249
|
//#endregion
|
|
241
250
|
export { runConnectBuild };
|
|
242
251
|
|
|
243
|
-
//# sourceMappingURL=connect-build-
|
|
244
|
-
//# debugId=
|
|
252
|
+
//# sourceMappingURL=connect-build-DBmBetdz.mjs.map
|
|
253
|
+
//# debugId=c63f999a-a189-5178-96be-68414e8b76fd
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-build-DBmBetdz.mjs","sources":["../src/services/connect-build.ts"],"sourcesContent":["import {\n DEFAULT_VENDOR_INCLUDE,\n DYNAMIC_BASE_PLACEHOLDER,\n directoryContentDigest,\n findPackageRoot,\n getConnectBaseViteConfig,\n missingVendorEntries,\n prebuildConnectVendor,\n ownProjectPackage,\n prebuildReactorWorker,\n prebuildWorkerPackages,\n resolveReactorWorkerSource,\n type PrebuiltReactorWorker,\n type PrebuiltVendor,\n} from \"@powerhousedao/builder-tools\";\nimport { getConfig } from \"@powerhousedao/shared/clis\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport {\n deepMerge,\n normalizeBasePath,\n SHARED_DEP_SPECIFIERS,\n SHARED_SUBPATHS,\n} from \"@powerhousedao/shared/connect\";\nimport { existsSync, mkdirSync, readdirSync, rmSync } from \"node:fs\";\nimport { join, resolve } from \"node:path\";\nimport type { InlineConfig } from \"vite\";\nimport { build, mergeConfig } from \"vite\";\nimport type { ConnectBuildArgs } from \"../types.js\";\nimport { buildCliConnectOverride } from \"../utils/cli-connect-override.js\";\nimport {\n isPrecompressEnabled,\n precompressAssets,\n} from \"../utils/precompress.js\";\nimport { runBuild } from \"./build.js\";\n\nexport async function runConnectBuild(\n args: ConnectBuildArgs,\n callerOverride?: PHConnectRuntimeConfig,\n { routes }: { routes?: string | false } = {},\n) {\n const { outDir, debug, dynamicBase, favicon } = args;\n\n const mode = \"production\";\n const dirname = process.cwd();\n\n // Build has no read mode; a bare positional `<key>` is a user error. The\n // 2-positional `<key> <value>` form is handled inside buildCliConnectOverride\n // so it layers on top of --json + flags like any other override input.\n if (args.keyPositional !== undefined && args.valuePositional === undefined) {\n throw new Error(\n \"ph connect build: positional override requires both <key> and <value> (e.g. `ph connect build connect.renown.url https://renown.staging`). To read a value, use `ph connect config <key>`.\",\n );\n }\n\n // Fail fast if any package marked as provider: \"local\" is missing from\n // node_modules — the Vite plugin that bundles them needs them on disk.\n assertLocalPackagesInstalled(dirname);\n\n // Build the CLI override layers (--json + individual flags + positional)\n // once here so a bad payload fails before we waste a build.\n // `--packages-registry` lands at the top-level `packageRegistryUrl`\n // (mirrors source-config shape); every other flag feeds the connect-block\n // precedence ladder.\n const cli = buildCliConnectOverride(args);\n const { packageRegistryUrl } = cli;\n // A runner's host config sits under the CLI's flags.\n const connectOverride = callerOverride\n ? deepMerge(callerOverride, cli.connectOverride ?? {})\n : cli.connectOverride;\n\n await runBuild({\n outDir: \"dist\",\n debug,\n // Local packages built for Connect share deps with the app vendor, same\n // as a plain `ph build`.\n noSharedDeps: false,\n ignoreTypeErrors: false,\n });\n\n // Production shared-dependency vendor: prebuilt into <outDir>/__vendor__\n // before the app build. On by default; PH_CONNECT_VENDOR=0|false disables\n // it. A failed prebuild fails the build — production must not ship import\n // map entries pointing at a vendor that was never built (the dev server\n // keeps its own soft fallback in the dev plugin).\n const outDirAbs = resolve(dirname, outDir);\n let vendor: PrebuiltVendor | null = null;\n // The deploy base the vendor's import-map addresses are written against.\n // Only meaningful when the vendor is built; \"/\" is the inert default.\n let appBase = \"/\";\n // The prebuild out dirs' parent must exist before the prebuilds: their\n // build locks are siblings of the out dirs, and the package build\n // (runBuild) writes to a different out dir, so nothing else creates it yet.\n mkdirSync(outDirAbs, { recursive: true });\n if (isVendorEnabled()) {\n const errorRef: { message?: string } = {};\n // The same base string the app build uses below: the dynamic-base\n // placeholder, or the normalized deploy base (CLI override wins over the\n // source config). The vendor worker appends its own segment.\n const phConfig = getConfig(join(dirname, \"powerhouse.config.json\"));\n const connectBasePath =\n connectOverride?.app?.basePath ?? phConfig.connect?.app?.basePath;\n appBase = dynamicBase\n ? DYNAMIC_BASE_PLACEHOLDER\n : connectBasePath\n ? normalizeBasePath(connectBasePath)\n : \"/\";\n vendor = await prebuildConnectVendor({\n dirname,\n include: productionVendorInclude(),\n vendorDir: join(outDirAbs, \"__vendor__\"),\n base: appBase,\n nodeEnv: \"production\",\n errorRef,\n ...connectOwnVendorDeps(dirname),\n });\n if (!vendor) {\n console.error(\n `ph connect build: the shared-dependency vendor failed to build${\n errorRef.message ? `:\\n${errorRef.message}` : \"\"\n }`,\n );\n throw new Error(\"shared-dependency vendor prebuild failed\");\n }\n }\n\n // Reactor SharedWorker bundle: the dist worker is a library artifact whose\n // bare imports no worker can resolve (import maps do not apply to workers),\n // so the deployable form is prebuilt here. With a vendor, its shared deps\n // are externalized onto ../__vendor__/ so page and worker share one cache\n // entry per dep; without one it is fully self-contained.\n const reactorWorker = await prebuildReactorWorkerBundle(\n dirname,\n outDirAbs,\n vendor,\n connectOverride,\n );\n\n // Local project models the worker cannot get from the registry, built into\n // the worker bundle's own directory so they share its vendor.\n if (reactorWorker) {\n await prebuildLocalWorkerPackages(\n dirname,\n outDirAbs,\n vendor,\n reactorWorker.vendorImports,\n );\n }\n\n const keepDirs = [\n ...(vendor ? [\"__vendor__\"] : []),\n ...(reactorWorker ? [\"__reactor_worker__\"] : []),\n ];\n // Stale top-level output goes, the prebuilt dirs stay: the app build below\n // runs with emptyOutDir: false and must not wipe them.\n if (keepDirs.length > 0) {\n cleanDistExcept(outDirAbs, keepDirs);\n }\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n cliConnectOverride: connectOverride,\n cliPackageRegistryUrl: packageRegistryUrl,\n dynamicBase,\n favicon,\n routes,\n // Vendor import-map entries are relative (leading slash stripped) so\n // they resolve against the page URL under any deploy base — root or\n // subpath, dynamic or concrete.\n vendor: vendor\n ? {\n imports: vendorImportMapEntries(vendor.imports, appBase),\n versions: vendor.versions,\n sharedDeps: vendorImportMapEntries(\n { sharedDeps: vendor.sharedDeps },\n appBase,\n ).sharedDeps,\n }\n : undefined,\n reactorWorkerVersion: reactorWorker\n ? directoryContentDigest(join(outDirAbs, \"__reactor_worker__\"))\n : undefined,\n });\n\n const buildConfig: InlineConfig = {\n build: {\n outDir,\n // The vendor / worker dirs were prebuilt into the out dir above; the\n // build must not empty them.\n ...(keepDirs.length > 0 ? { emptyOutDir: false } : {}),\n },\n };\n\n const config = mergeConfig(baseConfig, buildConfig);\n\n await build(config);\n\n // Last word on the shipped artifact: every specifier the page's import map\n // publishes must have a file next to it. The prebuild verifies its own\n // output, but it can return a cache hit it never rebuilt, and both the\n // stale-output clean and the app build run afterwards. An entry with no\n // file behind it ships as a URL that 404s, and a SPA answers that with\n // index.html — so the browser reports only an opaque MIME-type error with\n // no filename. Fail here instead, naming the entries.\n if (vendor) {\n const unbacked = missingVendorEntries(\n join(outDirAbs, \"__vendor__\"),\n vendor.imports,\n );\n if (unbacked.length > 0) {\n throw new Error(\n `ph connect build: the shared-dependency vendor is missing ` +\n `${unbacked.length} of the ${Object.keys(vendor.imports).length} ` +\n `entries its import map publishes:\\n` +\n unbacked.map((e) => ` ${e.spec} -> ${e.url}`).join(\"\\n\"),\n );\n }\n }\n\n // Runs after the PWA plugin, so the siblings never enter the precache list.\n if (isPrecompressEnabled()) {\n const r = await precompressAssets(outDirAbs);\n console.log(\n `ph connect build: precompressed ${r.files} wasm/data files ` +\n `(${r.written} .gz written, ${(r.outputBytes / 1e6).toFixed(1)} MB) in ${(r.ms / 1000).toFixed(1)}s`,\n );\n }\n}\n\n/**\n * The specifier set the production vendor bundles: the dev-proven heavy set\n * ∪ the package-shared set — everything the app and loaded packages\n * externalize onto the vendor.\n *\n * Two specifiers are deliberately dropped:\n *\n * - `@powerhousedao/connect`. It is in DEFAULT_VENDOR_INCLUDE because the dev\n * server vendors the app to keep rebuilds cheap, but in a production build\n * the app *is* Connect: `SHARED_DEP_SPECIFIERS` omits it, so the app build\n * never externalizes it and nothing would ever resolve its import-map\n * entry. Vendoring it is not merely dead weight — bundling Connect's dist\n * for the browser pulls in its node-only `@powerhousedao/config/node`\n * import, and so `read-pkg` -> `unicorn-magic`, whose browser entry has no\n * `toPath`. That fails the vendor build, and a failed prebuild fails\n * `ph connect build`.\n * - the bare `@powerhousedao/shared` root, whose barrel likewise reaches\n * node-only modules. Its browser-safe subpaths (SHARED_SUBPATHS) are\n * listed instead; a package importing the bare root bundles its own copy.\n */\nexport function productionVendorInclude(): string[] {\n return [\n ...new Set([\n ...DEFAULT_VENDOR_INCLUDE.filter((s) => s !== \"@powerhousedao/connect\"),\n ...SHARED_DEP_SPECIFIERS.filter((s) => s !== \"@powerhousedao/shared\"),\n ...SHARED_SUBPATHS.map((s) => `@powerhousedao/shared/${s}`),\n // Connect imports these roots too; unvendored, the app re-bundles their shared chunks.\n \"@powerhousedao/design-system\",\n \"@powerhousedao/reactor\",\n ]),\n ];\n}\n\n/** Connect's own deps that vendored packages also bundle; projects don't install them. */\nexport const CONNECT_OWN_VENDOR_DEPS = [\n \"kysely\",\n \"tailwind-merge\",\n \"@renown/sdk\",\n \"@renown/sdk/crypto\",\n \"@renown/sdk/trust\",\n \"@powerhousedao/reactor-attachments/client\",\n // One core and router for Connect and packages; the route tree, config and\n // embedded subpaths stay with the app.\n \"@powerhousedao/connect-core\",\n \"@powerhousedao/connect-core/router\",\n \"@powerhousedao/connect-core/plugins\",\n \"@powerhousedao/connect-core/runtime\",\n \"@powerhousedao/connect-core/views\",\n \"@tanstack/react-router\",\n];\n\nexport function connectOwnVendorDeps(dirname: string): {\n ownDeps?: { specs: string[]; from: string };\n} {\n const from = findPackageRoot(dirname, \"@powerhousedao/connect\");\n return from ? { ownDeps: { specs: CONNECT_OWN_VENDOR_DEPS, from } } : {};\n}\n\n/**\n * Turn the vendor's base-less URLs (`/__vendor__/x.js`) into the addresses\n * the page's import map ships, by prefixing the deploy base.\n *\n * An import map *address* must be a URL or begin with `/`, `./` or `../`;\n * anything else is a bare specifier, which the browser rejects — it drops the\n * entry, resolves the specifier to null, and every shared import then fails\n * with \"blocked by a null value\". So the base is applied rather than the\n * leading slash stripped: a root-relative address is both valid and correct\n * under a subpath deploy, and a dynamic-base build keeps its placeholder for\n * the serving proxy to substitute (the dynamic-base plugin leaves HTML\n * tokens alone by design).\n */\nexport function vendorImportMapEntries(\n imports: Record<string, string>,\n appBase: string,\n): Record<string, string> {\n return Object.fromEntries(\n Object.entries(imports).map(([spec, url]) => [\n spec,\n `${appBase}/${url}`.replace(/\\/{2,}/g, \"/\"),\n ]),\n );\n}\n\n/**\n * The production vendor prebuild runs on every `ph connect build` unless\n * disabled with PH_CONNECT_VENDOR=0 or false.\n */\nexport function isVendorEnabled(env: NodeJS.ProcessEnv = process.env): boolean {\n const raw = env.PH_CONNECT_VENDOR ?? \"1\";\n return raw !== \"0\" && raw !== \"false\";\n}\n\n/**\n * The reactor worker bundle prebuild runs on every `ph connect build` unless\n * disabled with PH_CONNECT_REACTOR_WORKER=0 or false. It is built even when\n * `connect.instance.reactorWorker` is off, because the `?reactorWorker=true`\n * runtime override can enable the feature on a flag-off deployment.\n */\nexport function isReactorWorkerBundleEnabled(\n env: NodeJS.ProcessEnv = process.env,\n): boolean {\n const raw = env.PH_CONNECT_REACTOR_WORKER ?? \"1\";\n return raw !== \"0\" && raw !== \"false\";\n}\n\n/**\n * Prebuild the reactor SharedWorker bundle into `<dist>/__reactor_worker__`.\n * Returns null when the prebuild is disabled, the installed Connect ships no\n * worker entry, or the build fails. A failure only fails `ph connect build`\n * when the project explicitly enables `connect.instance.reactorWorker` —\n * otherwise the feature degrades to unavailable and the build goes on.\n */\nasync function prebuildReactorWorkerBundle(\n dirname: string,\n outDirAbs: string,\n vendor: PrebuiltVendor | null,\n connectOverride: PHConnectRuntimeConfig | undefined,\n): Promise<PrebuiltReactorWorker | null> {\n if (!isReactorWorkerBundleEnabled()) return null;\n if (!resolveReactorWorkerSource(dirname)) return null;\n\n const errorRef: { message?: string } = {};\n const bundle = await prebuildReactorWorker({\n dirname,\n outDir: join(outDirAbs, \"__reactor_worker__\"),\n vendor: vendor\n ? { imports: vendor.imports, dir: join(outDirAbs, \"__vendor__\") }\n : undefined,\n nodeEnv: \"production\",\n errorRef,\n });\n if (bundle) return bundle;\n\n const message = `ph connect build: the reactor worker bundle failed to build${\n errorRef.message ? `:\\n${errorRef.message}` : \"\"\n }`;\n const phConfig = getConfig(join(dirname, \"powerhouse.config.json\"));\n const required =\n connectOverride?.instance?.reactorWorker ??\n phConfig.connect?.instance?.reactorWorker ??\n false;\n if (required) {\n throw new Error(message);\n }\n console.warn(\n `${message}\\nThe reactorWorker feature will be unavailable in this build.`,\n );\n return null;\n}\n\n/**\n * Build the project's `provider: \"local\"` packages into worker-loadable model\n * bundles beside the worker. A failure is a warning, not a build failure: the\n * worker still runs, and documents of registry types still work - only the\n * project's own types would be unavailable in worker mode.\n */\nasync function prebuildLocalWorkerPackages(\n dirname: string,\n outDirAbs: string,\n vendor: PrebuiltVendor | null,\n safeVendorImports: Record<string, string>,\n): Promise<void> {\n const config = getConfig(join(dirname, \"powerhouse.config.json\"));\n const configured = (config.packages ?? [])\n .filter((p) => p.provider === \"local\")\n .map((p) => p.packageName);\n // The project itself is a local package in all but name: a vetra project\n // declares no entry for itself, and its models are the ones the worker\n // cannot otherwise get.\n const own = ownProjectPackage(dirname);\n const localPackages = [...new Set([...configured, ...(own ? [own] : [])])];\n\n const errorRef: { message?: string } = {};\n const built = await prebuildWorkerPackages({\n dirname,\n packages: localPackages,\n outDir: join(outDirAbs, \"__reactor_worker__\", \"packages\"),\n vendor: vendor\n ? { imports: vendor.imports, dir: join(outDirAbs, \"__vendor__\") }\n : undefined,\n safeVendorImports,\n nodeEnv: \"production\",\n errorRef,\n });\n if (!built) {\n console.warn(\n `ph connect build: the reactor worker's local package bundles failed to build${\n errorRef.message ? `:\\n${errorRef.message}` : \"\"\n }\\nDocuments of this project's own types will not load in worker mode.`,\n );\n }\n}\n\n/**\n * Remove every top-level entry of `dist` except the kept names. Used between\n * the vendor prebuild and the app build so stale app output goes but the\n * just-built vendor stays (the build then runs with emptyOutDir: false).\n * Returns the number of entries removed.\n */\nexport function cleanDistExcept(dist: string, keep: string[] = []): number {\n if (!existsSync(dist)) return 0;\n let removed = 0;\n for (const entry of readdirSync(dist)) {\n if (keep.includes(entry)) continue;\n rmSync(join(dist, entry), { recursive: true, force: true });\n removed += 1;\n }\n return removed;\n}\n\nfunction assertLocalPackagesInstalled(projectPath: string) {\n const config = getConfig(join(projectPath, \"powerhouse.config.json\"));\n const localPackages = (config.packages ?? []).filter(\n (p) => p.provider === \"local\",\n );\n if (localPackages.length === 0) return;\n\n const missing = localPackages.filter(\n (p) =>\n !existsSync(\n join(projectPath, \"node_modules\", p.packageName, \"package.json\"),\n ),\n );\n if (missing.length === 0) return;\n\n const names = missing.map((p) => p.packageName);\n throw new Error(\n `ph connect build requires these packages to be installed in node_modules (they are declared with provider: \"local\" in powerhouse.config.json):\\n` +\n names.map((n) => ` - ${n}`).join(\"\\n\") +\n `\\n\\nInstall them with:\\n ph install --local ${names.join(\" \")}`,\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAmCA,eAAsB,gBACpB,MACA,gBACA,EAAE,WAAwC,CAAC,GAC3C;CACA,MAAM,EAAE,QAAQ,OAAO,aAAa,YAAY;CAEhD,MAAM,OAAO;CACb,MAAM,UAAU,QAAQ,IAAI;CAK5B,IAAI,KAAK,kBAAkB,KAAA,KAAa,KAAK,oBAAoB,KAAA,GAC/D,MAAM,IAAI,MACR,4LACF;CAKF,6BAA6B,OAAO;CAOpC,MAAM,MAAM,wBAAwB,IAAI;CACxC,MAAM,EAAE,uBAAuB;CAE/B,MAAM,kBAAkB,iBACpB,UAAU,gBAAgB,IAAI,mBAAmB,CAAC,CAAC,IACnD,IAAI;CAER,MAAM,SAAS;EACb,QAAQ;EACR;EAGA,cAAc;EACd,kBAAkB;CACpB,CAAC;CAOD,MAAM,YAAY,QAAQ,SAAS,MAAM;CACzC,IAAI,SAAgC;CAGpC,IAAI,UAAU;CAId,UAAU,WAAW,EAAE,WAAW,KAAK,CAAC;CACxC,IAAI,gBAAgB,GAAG;EACrB,MAAM,WAAiC,CAAC;EAIxC,MAAM,WAAW,UAAU,KAAK,SAAS,wBAAwB,CAAC;EAClE,MAAM,kBACJ,iBAAiB,KAAK,YAAY,SAAS,SAAS,KAAK;EAC3D,UAAU,cACN,2BACA,kBACE,kBAAkB,eAAe,IACjC;EACN,SAAS,MAAM,sBAAsB;GACnC;GACA,SAAS,wBAAwB;GACjC,WAAW,KAAK,WAAW,YAAY;GACvC,MAAM;GACN,SAAS;GACT;GACA,GAAG,qBAAqB,OAAO;EACjC,CAAC;EACD,IAAI,CAAC,QAAQ;GACX,QAAQ,MACN,iEACE,SAAS,UAAU,MAAM,SAAS,YAAY,IAElD;GACA,MAAM,IAAI,MAAM,0CAA0C;E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,SAAS,KAAK,GAAG;EAC1B,OAAO,KAAK,MAAM,KAAK,GAAG;GAAE,WAAW;GAAM,OAAO;EAAK,CAAC;EAC1D,WAAW;CACb;CACA,OAAO;AACT;AAEA,SAAS,6BAA6B,aAAqB;CAEzD,MAAM,iBADS,UAAU,KAAK,aAAa,wBAAwB,CACvC,CAAC,CAAC,YAAY,CAAC,EAAA,CAAG,QAC3C,MAAM,EAAE,aAAa,OACxB;CACA,IAAI,cAAc,WAAW,GAAG;CAEhC,MAAM,UAAU,cAAc,QAC3B,MACC,CAAC,WACC,KAAK,aAAa,gBAAgB,EAAE,aAAa,cAAc,CACjE,CACJ;CACA,IAAI,QAAQ,WAAW,GAAG;CAE1B,MAAM,QAAQ,QAAQ,KAAK,MAAM,EAAE,WAAW;CAC9C,MAAM,IAAI,MACR,qJACE,MAAM,KAAK,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,IAAI,IACtC,gDAAgD,MAAM,KAAK,GAAG,GAClE;AACF","debug_id":"c63f999a-a189-5178-96be-68414e8b76fd"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="bccaf695-1303-5b73-91f4-0f1423bc1c73")}catch(e){}}();
|
|
3
3
|
import { t as PRECOMPRESS_EXTENSIONS } from "./precompress-P6cJDPVC.mjs";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -96,7 +96,19 @@ function previewCacheHeadersPlugin(outDir, base) {
|
|
|
96
96
|
}
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
|
|
99
|
+
/** The dist's shell for the served config: its composition's variant and its app name. */
|
|
100
|
+
async function shellSwapFor(outDir, override, base = "/") {
|
|
101
|
+
const composition = override.connect?.composition;
|
|
102
|
+
const renamed = override.connect?.branding?.appName !== void 0;
|
|
103
|
+
if (!composition && !renamed) return void 0;
|
|
104
|
+
const { APP_SHELLS_FILE, appShellVariant, appShellVariantOf, readShellPluginsIn, swapAppShell, withShellAppName } = await import("@powerhousedao/builder-tools");
|
|
105
|
+
const file = path.join(outDir, APP_SHELLS_FILE);
|
|
106
|
+
const variant = composition && appShellVariant(composition, readShellPluginsIn(outDir));
|
|
107
|
+
const shell = variant && existsSync(file) ? JSON.parse(readFileSync(file, "utf8"))[variant] : void 0;
|
|
108
|
+
const appName = JSON.parse(mergedConfigBody(outDir, override)).connect?.branding?.appName;
|
|
109
|
+
return (html) => shell && appShellVariantOf(html) !== variant ? swapAppShell(html, shell, base, appName) : withShellAppName(html, appName);
|
|
110
|
+
}
|
|
111
|
+
function serveOverridePlugin(outDir, override, base = "/", swapShell) {
|
|
100
112
|
return {
|
|
101
113
|
name: "ph:serve-override",
|
|
102
114
|
configurePreviewServer(server) {
|
|
@@ -111,16 +123,20 @@ function serveOverridePlugin(outDir, override, base = "/") {
|
|
|
111
123
|
return;
|
|
112
124
|
}
|
|
113
125
|
const isHtml = urlPath === "/" || urlPath.endsWith("/index.html") || !path.extname(urlPath);
|
|
114
|
-
if (override.cspRegistrySync && isHtml) {
|
|
126
|
+
if ((override.cspRegistrySync || swapShell) && isHtml) {
|
|
115
127
|
const file = path.join(outDir, "index.html");
|
|
116
128
|
if (existsSync(file)) {
|
|
117
|
-
|
|
118
|
-
|
|
129
|
+
let html = readFileSync(file, "utf8");
|
|
130
|
+
if (override.cspRegistrySync) {
|
|
131
|
+
const registry = JSON.parse(mergedConfigBody(outDir, override)).packageRegistryUrl;
|
|
132
|
+
if (registry) html = patchCspScriptSrc(html, registry);
|
|
133
|
+
}
|
|
134
|
+
if (swapShell) html = swapShell(html);
|
|
119
135
|
res.writeHead(200, {
|
|
120
136
|
"content-type": "text/html; charset=utf-8",
|
|
121
137
|
"cache-control": "no-store"
|
|
122
138
|
});
|
|
123
|
-
res.end(
|
|
139
|
+
res.end(html);
|
|
124
140
|
return;
|
|
125
141
|
}
|
|
126
142
|
}
|
|
@@ -184,7 +200,7 @@ async function runConnectPreview(args, serveOverride, dirname = process.cwd()) {
|
|
|
184
200
|
plugins: [
|
|
185
201
|
previewCacheHeadersPlugin(outDirAbs, base),
|
|
186
202
|
precompressedAssetsPlugin(outDirAbs, base),
|
|
187
|
-
...serveOverride ? [serveOverridePlugin(outDirAbs, serveOverride, base)] : []
|
|
203
|
+
...serveOverride ? [serveOverridePlugin(outDirAbs, serveOverride, base, await shellSwapFor(outDirAbs, serveOverride, base))] : []
|
|
188
204
|
]
|
|
189
205
|
};
|
|
190
206
|
const server = await preview(previewConfig);
|
|
@@ -195,5 +211,5 @@ async function runConnectPreview(args, serveOverride, dirname = process.cwd()) {
|
|
|
195
211
|
//#endregion
|
|
196
212
|
export { runConnectPreview };
|
|
197
213
|
|
|
198
|
-
//# sourceMappingURL=connect-preview-
|
|
199
|
-
//# debugId=
|
|
214
|
+
//# sourceMappingURL=connect-preview-8-qLgWKt.mjs.map
|
|
215
|
+
//# debugId=bccaf695-1303-5b73-91f4-0f1423bc1c73
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-preview-8-qLgWKt.mjs","sources":["../src/services/connect-preview.ts"],"sourcesContent":["import { getConfig } from \"@powerhousedao/config/node\";\nimport type { AppShells } from \"@powerhousedao/builder-tools\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport { deepMerge, normalizeBasePath } from \"@powerhousedao/shared/connect\";\nimport { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\nimport sirv from \"sirv\";\nimport type { InlineConfig, Plugin } from \"vite\";\nimport { preview } from \"vite\";\nimport type { ConnectPreviewArgs } from \"../types.js\";\nimport { PRECOMPRESS_EXTENSIONS } from \"../utils/precompress.js\";\n\n/**\n * Runtime shaping for a served (built) Connect, desktop shape: the compound\n * projects the live switchboard's drive into the connect member's config, and\n * this override makes the STATIC dist serve it — the built\n * powerhouse.config.json is baked, so without this the drive injection never\n * reaches the SPA. `cspRegistrySync` additionally patches the baked CSP's\n * script-src with the runtime registry (the build bakes the CSP for the\n * registry it was built against; setting the registry at run time breaks that\n * coupling and every package import gets blocked otherwise).\n */\nexport interface ConnectServeOverride {\n connect?: PHConnectRuntimeConfig;\n cspRegistrySync?: boolean;\n /** Overrides the baked top-level packageRegistryUrl in the served config. */\n packageRegistryUrl?: string;\n}\n\n/**\n * The env contract a supervisor can drive the preview with — the same\n * variables the Docker entrypoint and clint's service manager already speak:\n * PH_CONNECT_DEFAULT_DRIVES_URL (comma-separated drive urls, injected into\n * drives.defaultDrives), PH_CONNECT_DRIVES_PRESERVE_STRATEGY, and\n * PH_CONNECT_PACKAGES_REGISTRY (runtime registry: served config + baked-CSP\n * patch). Lets `ph connect preview` replace hand-rolled static servers\n * (clint's connect-server, the ph-win sidecar) without losing injection.\n */\nexport function overrideFromEnv(\n env: Record<string, string | undefined> = process.env,\n): ConnectServeOverride | undefined {\n const drivesUrl = env.PH_CONNECT_DEFAULT_DRIVES_URL;\n const registry = env.PH_CONNECT_PACKAGES_REGISTRY;\n if (!drivesUrl && !registry) return undefined;\n const override: ConnectServeOverride = {};\n if (drivesUrl) {\n override.connect = {\n drives: {\n defaultDrives: drivesUrl\n .split(\",\")\n .map((s) => s.trim())\n .filter(Boolean)\n .map((url) => ({ url, name: null, icon: null })),\n preserveStrategy:\n env.PH_CONNECT_DRIVES_PRESERVE_STRATEGY ?? \"preserve-all\",\n },\n } as PHConnectRuntimeConfig;\n }\n if (registry) {\n override.packageRegistryUrl = registry;\n override.cspRegistrySync = true;\n }\n return override;\n}\n\nfunction mergedConfigBody(\n outDir: string,\n override: ConnectServeOverride,\n): string {\n const file = path.join(outDir, \"powerhouse.config.json\");\n const baked = existsSync(file)\n ? (JSON.parse(readFileSync(file, \"utf8\")) as Record<string, unknown>)\n : {};\n const connect = override.connect\n ? deepMerge(\n (baked.connect ?? {}) as PHConnectRuntimeConfig,\n override.connect,\n )\n : baked.connect;\n return JSON.stringify({\n ...baked,\n connect,\n ...(override.packageRegistryUrl\n ? { packageRegistryUrl: override.packageRegistryUrl }\n : {}),\n });\n}\n\n/**\n * Append the registry origin to the baked CSP's script-src. The attribute\n * value is HTML-escaped (every CSP keyword is `'`-quoted, which contains a\n * semicolon), so decode before touching directives and re-escape after —\n * ported from the ph-win-desktop sidecar, which this path replaces.\n */\nexport function patchCspScriptSrc(html: string, registryUrl: string): string {\n return html.replace(\n /(<meta\\s+http-equiv=\"Content-Security-Policy\"\\s+content=\")([^\"]*)(\")/i,\n (_match, open: string, escaped: string, close: string) => {\n const policy = escaped.replace(/&/g, \"&\").replace(/'/g, \"'\");\n if (policy.includes(registryUrl)) return open + escaped + close;\n const patched = policy.replace(\n /script-src\\s+([^;]*)/i,\n (_directive, sources: string) =>\n `script-src ${sources.trim()} ${registryUrl}`,\n );\n const reEscaped = patched.replace(/&/g, \"&\").replace(/'/g, \"'\");\n return open + reEscaped + close;\n },\n );\n}\n\n// The serve base: an explicit `--base`, else the basePath the dist was built with.\nexport function resolvePreviewBase(\n argBase: string | undefined,\n outDirAbs: string,\n): string | undefined {\n if (argBase && argBase !== \"/\") return normalizeBasePath(argBase);\n try {\n const built = JSON.parse(\n readFileSync(path.join(outDirAbs, \"powerhouse.config.json\"), \"utf8\"),\n ) as { connect?: { app?: { basePath?: unknown } } };\n const basePath = built.connect?.app?.basePath;\n if (typeof basePath === \"string\" && basePath) {\n return normalizeBasePath(basePath);\n }\n } catch {\n // no readable dist config\n }\n return undefined;\n}\n\n// `pathname` relative to the deploy base (\"/\" + rest), or itself when outside it.\nexport function stripBase(pathname: string, base: string): string {\n return base !== \"/\" && pathname.startsWith(base)\n ? `/${pathname.slice(base.length)}`\n : pathname;\n}\n\nconst IMMUTABLE = \"public, max-age=31536000, immutable\";\n\nconst HASHED_DIRS = [\"/assets/\", \"/fonts/\", \"/__reactor_worker__/assets/\"];\n\n// Content-addressed output (hashed names, or a `v` query on the worker's), as in the nginx image.\nexport function previewCacheControl(\n pathname: string,\n search: string,\n): string | undefined {\n if (HASHED_DIRS.some((dir) => pathname.startsWith(dir))) return IMMUTABLE;\n if (pathname.startsWith(\"/__vendor__/\")) {\n return /\\/(shared-deps|import-map)\\.js(on)?$/.test(pathname)\n ? \"no-cache\"\n : IMMUTABLE;\n }\n if (pathname.startsWith(\"/__react__/\")) return IMMUTABLE;\n if (pathname.startsWith(\"/__reactor_worker__/\")) {\n return new URLSearchParams(search).has(\"v\") ? IMMUTABLE : \"no-cache\";\n }\n return undefined;\n}\n\nfunction previewCacheHeadersPlugin(outDir: string, base: string): Plugin {\n return {\n name: \"ph:preview-cache-headers\",\n configurePreviewServer(server) {\n server.middlewares.use((req, res, next) => {\n const [rawPath, search = \"\"] = (req.url ?? \"/\").split(\"?\");\n const rel = stripBase(rawPath, base);\n let value = previewCacheControl(rel, search);\n // A cached 404 would outlive the next deploy.\n if (value === IMMUTABLE && !existsSync(path.join(outDir, rel))) {\n value = undefined;\n }\n if (value) res.setHeader(\"Cache-Control\", value);\n next();\n });\n },\n };\n}\n\ntype HtmlTransform = (html: string) => string;\n\n/** The dist's shell for the served config: its composition's variant and its app name. */\nexport async function shellSwapFor(\n outDir: string,\n override: ConnectServeOverride,\n base = \"/\",\n): Promise<HtmlTransform | undefined> {\n const composition = override.connect?.composition;\n const renamed = override.connect?.branding?.appName !== undefined;\n if (!composition && !renamed) return undefined;\n const {\n APP_SHELLS_FILE,\n appShellVariant,\n appShellVariantOf,\n readShellPluginsIn,\n swapAppShell,\n withShellAppName,\n } = await import(\"@powerhousedao/builder-tools\");\n const file = path.join(outDir, APP_SHELLS_FILE);\n // The manifest the build copied from the Connect it used.\n const variant =\n composition && appShellVariant(composition, readShellPluginsIn(outDir));\n const shell =\n variant && existsSync(file)\n ? (JSON.parse(readFileSync(file, \"utf8\")) as AppShells)[variant]\n : undefined;\n // The name the app will title itself with: the served (baked + override) config's.\n const appName = (\n JSON.parse(mergedConfigBody(outDir, override)) as {\n connect?: { branding?: { appName?: string } };\n }\n ).connect?.branding?.appName;\n return (html) =>\n shell && appShellVariantOf(html) !== variant\n ? swapAppShell(html, shell, base, appName)\n : withShellAppName(html, appName);\n}\n\nfunction serveOverridePlugin(\n outDir: string,\n override: ConnectServeOverride,\n base = \"/\",\n swapShell?: HtmlTransform,\n): Plugin {\n return {\n name: \"ph:serve-override\",\n configurePreviewServer(server) {\n server.middlewares.use((req, res, next) => {\n const urlPath = stripBase((req.url ?? \"/\").split(\"?\")[0], base);\n if (urlPath === \"/powerhouse.config.json\") {\n res.writeHead(200, {\n \"content-type\": \"application/json; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(mergedConfigBody(outDir, override));\n return;\n }\n // index.html and extensionless SPA routes get the CSP patch.\n const isHtml =\n urlPath === \"/\" ||\n urlPath.endsWith(\"/index.html\") ||\n !path.extname(urlPath);\n if ((override.cspRegistrySync || swapShell) && isHtml) {\n const file = path.join(outDir, \"index.html\");\n if (existsSync(file)) {\n let html = readFileSync(file, \"utf8\");\n if (override.cspRegistrySync) {\n const merged = JSON.parse(mergedConfigBody(outDir, override)) as {\n packageRegistryUrl?: string;\n };\n const registry = merged.packageRegistryUrl;\n if (registry) html = patchCspScriptSrc(html, registry);\n }\n if (swapShell) html = swapShell(html);\n res.writeHead(200, {\n \"content-type\": \"text/html; charset=utf-8\",\n \"cache-control\": \"no-store\",\n });\n res.end(html);\n return;\n }\n }\n next();\n });\n },\n };\n}\n\nconst PRECOMPRESSED_TYPES: Record<string, string> = {\n \".wasm\": \"application/wasm\",\n \".data\": \"application/octet-stream\",\n};\n\n// Serves the build's `.gz` siblings of wasm/data; Vite's sirv ignores them.\nexport function precompressedAssetsPlugin(outDir: string, base = \"/\"): Plugin {\n return {\n name: \"ph:precompressed-assets\",\n configurePreviewServer(server) {\n const headers = server.config.preview.headers;\n const serve = sirv(outDir, {\n dev: true,\n etag: true,\n gzip: true,\n extensions: [],\n setHeaders(res, pathname) {\n if (headers) for (const k in headers) res.setHeader(k, headers[k]!);\n res.setHeader(\n \"Content-Type\",\n PRECOMPRESSED_TYPES[path.extname(pathname)],\n );\n },\n });\n server.middlewares.use((req, res, next) => {\n const url = req.url ?? \"/\";\n const [rawPath, search] = url.split(\"?\");\n const rel = stripBase(rawPath, base);\n // Ranges are byte offsets into the identity body: leave them to Vite.\n if (\n !(PRECOMPRESS_EXTENSIONS as readonly string[]).includes(\n path.extname(rel),\n ) ||\n req.headers.range ||\n (base !== \"/\" && rel === rawPath)\n ) {\n return next();\n }\n req.url = search === undefined ? rel : `${rel}?${search}`;\n serve(req, res, () => {\n req.url = url;\n next();\n });\n });\n },\n };\n}\n\nexport async function runConnectPreview(\n args: ConnectPreviewArgs,\n serveOverride?: ConnectServeOverride,\n dirname = process.cwd(),\n) {\n // A supervisor can drive the preview via env when no explicit override is\n // passed (the classic `ph connect preview` command path).\n serveOverride ??= overrideFromEnv();\n const {\n outDir,\n port,\n host,\n open,\n cors,\n strictPort,\n printUrls,\n bindCLIShortcuts,\n } = args;\n\n const mode = \"production\";\n\n // Serving a dist needs only its base, not the build's plugin stack.\n const sourceBasePath = getConfig(path.join(dirname, \"powerhouse.config.json\"))\n .connect?.app?.basePath;\n const outDirAbs = path.resolve(dirname, outDir);\n const base =\n resolvePreviewBase(args.connectBasePath, outDirAbs) ??\n (sourceBasePath ? normalizeBasePath(sourceBasePath) : \"/\");\n\n const previewConfig: InlineConfig = {\n configFile: false,\n mode,\n base,\n build: {\n outDir: outDirAbs,\n },\n preview: {\n cors,\n port,\n strictPort,\n host,\n open,\n },\n plugins: [\n previewCacheHeadersPlugin(outDirAbs, base),\n precompressedAssetsPlugin(outDirAbs, base),\n ...(serveOverride\n ? [\n serveOverridePlugin(\n outDirAbs,\n serveOverride,\n base,\n await shellSwapFor(outDirAbs, serveOverride, base),\n ),\n ]\n : []),\n ],\n };\n\n const server = await preview(previewConfig);\n\n if (printUrls) server.printUrls();\n if (bindCLIShortcuts) server.bindCLIShortcuts({ print: true });\n return server;\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsCA,SAAgB,gBACd,MAA0C,QAAQ,KAChB;CAClC,MAAM,YAAY,IAAI;CACtB,MAAM,WAAW,IAAI;CACrB,IAAI,CAAC,aAAa,CAAC,UAAU,OAAO,KAAA;CACpC,MAAM,WAAiC,CAAC;CACxC,IAAI,WACF,SAAS,UAAU,EACjB,QAAQ;EACN,eAAe,UACZ,MAAM,GAAG,CAAC,CACV,KAAK,MAAM,EAAE,KAAK,CAAC,CAAC,CACpB,OAAO,OAAO,CAAC,CACf,KAAK,SAAS;GAAE;GAAK,MAAM;GAAM,MAAM;EAAK,EAAE;EACjD,kBACE,IAAI,uCAAuC;CAC/C,EACF;CAEF,IAAI,UAAU;EACZ,SAAS,qBAAqB;EAC9B,SAAS,kBAAkB;CAC7B;CACA,OAAO;AACT;AAEA,SAAS,iBACP,QACA,UACQ;CACR,MAAM,OAAO,KAAK,KAAK,QAAQ,wBAAwB;CACvD,MAAM,QAAQ,WAAW,IAAI,IACxB,KAAK,MAAM,aAAa,MAAM,MAAM,CAAC,IACtC,CAAC;CACL,MAAM,UAAU,SAAS,UACrB,UACG,MAAM,WAAW,CAAC,GACnB,SAAS,OACX,IACA,MAAM;CACV,OAAO,KAAK,UAAU;EACpB,GAAG;EACH;EACA,GAAI,SAAS,qBACT,EAAE,oBAAoB,SAAS,mBAAmB,IAClD,CAAC;CACP,CAAC;AACH;;;;;;;AAQA,SAAgB,kBAAkB,MAAc,aAA6B;CAC3E,OAAO,KAAK,QACV,0EACC,QAAQ,MAAc,SAAiB,UAAkB;EACxD,MAAM,SAAS,QAAQ,QAAQ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AG,CAClB,KACA,IAAI,QAAQ,SACX,SAAS,OAAO,QAAQ,SAEzB,OAAO,KAAK;IAEd,IAAI,MAAM,WAAW,KAAA,IAAY,MAAM,GAAG,IAAI,GAAG;IACjD,MAAM,KAAK,WAAW;KACpB,IAAI,MAAM;KACV,KAAK;IACP,CAAC;GACH,CAAC;EACH;CACF;AACF;AAEA,eAAsB,kBACpB,MACA,eACA,UAAU,QAAQ,IAAI,GACtB;CAGA,kBAAkB,gBAAgB;CAClC,MAAM,EACJ,QACA,MACA,MACA,MACA,MACA,YACA,WACA,qBACE;CAEJ,MAAM,OAAO;CAGb,MAAM,iBAAiB,UAAU,KAAK,KAAK,SAAS,wBAAwB,CAAC,CAAC,CAC3E,SAAS,KAAK;CACjB,MAAM,YAAY,KAAK,QAAQ,SAAS,MAAM;CAC9C,MAAM,OACJ,mBAAmB,KAAK,iBAAiB,SAAS,MACjD,iBAAiB,kBAAkB,cAAc,IAAI;CAExD,MAAM,gBAA8B;EAClC,YAAY;EACZ;EACA;EACA,OAAO,EACL,QAAQ,UACV;EACA,SAAS;GACP;GACA;GACA;GACA;GACA;EACF;EACA,SAAS;GACP,0BAA0B,WAAW,IAAI;GACzC,0BAA0B,WAAW,IAAI;GACzC,GAAI,gBACA,CACE,oBACE,WACA,eACA,MACA,MAAM,aAAa,WAAW,eAAe,IAAI,CACnD,CACF,IACA,CAAC;EACP;CACF;CAEA,MAAM,SAAS,MAAM,QAAQ,aAAa;CAE1C,IAAI,WAAW,OAAO,UAAU;CAChC,IAAI,kBAAkB,OAAO,iBAAiB,EAAE,OAAO,KAAK,CAAC;CAC7D,OAAO;AACT","debug_id":"bccaf695-1303-5b73-91f4-0f1423bc1c73"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as runConnectStudio } from "./connect-studio-
|
|
1
|
+
import { t as runConnectStudio } from "./connect-studio-Bhlc77WI.mjs";
|
|
2
2
|
export { runConnectStudio };
|
|
3
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
4
|
-
//# debugId=
|
|
3
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b9346ad4-0a20-549a-bf23-eb2b0269b174")}catch(e){}}();
|
|
4
|
+
//# debugId=b9346ad4-0a20-549a-bf23-eb2b0269b174
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="96923790-4c18-58e4-9218-e7981e186e08")}catch(e){}}();
|
|
3
3
|
import { r as buildStudioConnectOverride } from "./cli-connect-override-Cf7WutqU.mjs";
|
|
4
4
|
import { getConnectBaseViteConfig } from "@powerhousedao/builder-tools";
|
|
5
5
|
import { createServer, mergeConfig } from "vite";
|
|
6
6
|
//#region src/services/connect-studio.ts
|
|
7
|
-
async function runConnectStudio(args, customLogger, callerOverride) {
|
|
7
|
+
async function runConnectStudio(args, customLogger, callerOverride, { routes } = {}) {
|
|
8
8
|
const { port, host, open, cors, strictPort, printUrls, bindCLIShortcuts } = args;
|
|
9
9
|
const mode = "development";
|
|
10
10
|
const dirname = process.cwd();
|
|
@@ -12,7 +12,8 @@ async function runConnectStudio(args, customLogger, callerOverride) {
|
|
|
12
12
|
const baseConfig = getConnectBaseViteConfig({
|
|
13
13
|
mode,
|
|
14
14
|
dirname,
|
|
15
|
-
cliConnectOverride
|
|
15
|
+
cliConnectOverride,
|
|
16
|
+
routes
|
|
16
17
|
});
|
|
17
18
|
const config = mergeConfig(baseConfig, {
|
|
18
19
|
server: {
|
|
@@ -32,5 +33,5 @@ async function runConnectStudio(args, customLogger, callerOverride) {
|
|
|
32
33
|
//#endregion
|
|
33
34
|
export { runConnectStudio as t };
|
|
34
35
|
|
|
35
|
-
//# sourceMappingURL=connect-studio-
|
|
36
|
-
//# debugId=
|
|
36
|
+
//# sourceMappingURL=connect-studio-Bhlc77WI.mjs.map
|
|
37
|
+
//# debugId=96923790-4c18-58e4-9218-e7981e186e08
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-studio-Bhlc77WI.mjs","sources":["../src/services/connect-studio.ts"],"sourcesContent":["import { getConnectBaseViteConfig } from \"@powerhousedao/builder-tools\";\nimport type { PHConnectRuntimeConfig } from \"@powerhousedao/shared/clis\";\nimport type { InlineConfig, Logger } from \"vite\";\nimport { createServer, mergeConfig } from \"vite\";\nimport type { ConnectStudioArgs } from \"../types.js\";\nimport { buildStudioConnectOverride } from \"../utils/cli-connect-override.js\";\n\nexport async function runConnectStudio(\n args: ConnectStudioArgs,\n customLogger?: Logger,\n callerOverride?: PHConnectRuntimeConfig,\n { routes }: { routes?: string | false } = {},\n) {\n const { port, host, open, cors, strictPort, printUrls, bindCLIShortcuts } =\n args;\n const mode = \"development\";\n\n const dirname = process.cwd();\n\n const cliConnectOverride = buildStudioConnectOverride(args, callerOverride);\n\n const baseConfig = getConnectBaseViteConfig({\n mode,\n dirname,\n cliConnectOverride,\n routes,\n });\n\n const devServerConfig: InlineConfig = {\n server: { port, host, open, cors, strictPort },\n customLogger,\n };\n\n const config = mergeConfig(baseConfig, devServerConfig);\n\n const server = await createServer(config);\n\n await server.listen();\n\n if (printUrls) server.printUrls();\n if (bindCLIShortcuts) server.bindCLIShortcuts({ print: true });\n}\n"],"names":[],"mappings":";;;;;;AAOA,eAAsB,iBACpB,MACA,cACA,gBACA,EAAE,WAAwC,CAAC,GAC3C;CACA,MAAM,EAAE,MAAM,MAAM,MAAM,MAAM,YAAY,WAAW,qBACrD;CACF,MAAM,OAAO;CAEb,MAAM,UAAU,QAAQ,IAAI;CAE5B,MAAM,qBAAqB,2BAA2B,MAAM,cAAc;CAE1E,MAAM,aAAa,yBAAyB;EAC1C;EACA;EACA;EACA;CACF,CAAC;CAOD,MAAM,SAAS,YAAY,YAAY;EAJrC,QAAQ;GAAE;GAAM;GAAM;GAAM;GAAM;EAAW;EAC7C;CAGmD,CAAC;CAEtD,MAAM,SAAS,MAAM,aAAa,MAAM;CAExC,MAAM,OAAO,OAAO;CAEpB,IAAI,WAAW,OAAO,UAAU;CAChC,IAAI,kBAAkB,OAAO,iBAAiB,EAAE,OAAO,KAAK,CAAC;AAC/D","debug_id":"96923790-4c18-58e4-9218-e7981e186e08"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="
|
|
2
|
+
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="b6cc4256-c4dc-59ae-9119-1d0048815ed2")}catch(e){}}();
|
|
3
3
|
import { n as skipInstallArgs } from "./install-added-dependencies-DVSbzler.mjs";
|
|
4
4
|
import { t as isUniformRunnersEnabled } from "./feature-flags-xwqcHEWC.mjs";
|
|
5
5
|
import { boolean, command, extendType, flag, multioption, oneOf, option, optional, positional, string, subcommands } from "cmd-ts";
|
|
@@ -104,7 +104,7 @@ can load and still fail at runtime, so don't publish it.`,
|
|
|
104
104
|
handler: async (args) => {
|
|
105
105
|
if (args.debug) console.log(args);
|
|
106
106
|
try {
|
|
107
|
-
const { runBuild } = await import("./build-
|
|
107
|
+
const { runBuild } = await import("./build-MGRC-NiE.mjs");
|
|
108
108
|
await runBuild(args);
|
|
109
109
|
} catch (error) {
|
|
110
110
|
console.error(error);
|
|
@@ -129,7 +129,7 @@ This command:
|
|
|
129
129
|
args: connectStudioArgs,
|
|
130
130
|
handler: async (args) => {
|
|
131
131
|
if (args.debug) console.log(args);
|
|
132
|
-
const { runConnectStudio } = await import("./connect-studio-
|
|
132
|
+
const { runConnectStudio } = await import("./connect-studio-BehPZzN7.mjs");
|
|
133
133
|
await runConnectStudio(args);
|
|
134
134
|
}
|
|
135
135
|
});
|
|
@@ -151,7 +151,7 @@ Build has no read mode; passing only <key> without <value> errors out (use \`ph
|
|
|
151
151
|
args: connectBuildArgs,
|
|
152
152
|
handler: async (args) => {
|
|
153
153
|
if (args.debug) console.log(args);
|
|
154
|
-
const { runConnectBuild } = await import("./connect-build-
|
|
154
|
+
const { runConnectBuild } = await import("./connect-build-DBmBetdz.mjs");
|
|
155
155
|
await runConnectBuild(args);
|
|
156
156
|
process.exit(0);
|
|
157
157
|
}
|
|
@@ -164,7 +164,7 @@ NOTE: You must run \`ph connect build\` first
|
|
|
164
164
|
args: connectPreviewArgs,
|
|
165
165
|
handler: async (args) => {
|
|
166
166
|
if (args.debug) console.log(args);
|
|
167
|
-
const { runConnectPreview } = await import("./connect-preview-
|
|
167
|
+
const { runConnectPreview } = await import("./connect-preview-8-qLgWKt.mjs");
|
|
168
168
|
await runConnectPreview(args);
|
|
169
169
|
}
|
|
170
170
|
});
|
|
@@ -1449,7 +1449,7 @@ it never replaces the Vetra drive.
|
|
|
1449
1449
|
args: vetraArgs,
|
|
1450
1450
|
handler: async (args) => {
|
|
1451
1451
|
if (args.debug) console.log(args);
|
|
1452
|
-
const { startVetra } = await import("./vetra-
|
|
1452
|
+
const { startVetra } = await import("./vetra-LGTnoMVO.mjs");
|
|
1453
1453
|
await startVetra(args);
|
|
1454
1454
|
}
|
|
1455
1455
|
}),
|
|
@@ -1480,5 +1480,5 @@ const phCliCommands = buildPhCliCommands(isUniformRunnersEnabled());
|
|
|
1480
1480
|
//#endregion
|
|
1481
1481
|
export { phCliCommands as n, buildPhCliCommands as t };
|
|
1482
1482
|
|
|
1483
|
-
//# sourceMappingURL=ph-cli-commands-
|
|
1484
|
-
//# debugId=
|
|
1483
|
+
//# sourceMappingURL=ph-cli-commands-B4NF0Tge.mjs.map
|
|
1484
|
+
//# debugId=b6cc4256-c4dc-59ae-9119-1d0048815ed2
|