@powerhousedao/builder-tools 6.2.3-dev.7 → 6.2.3-dev.70

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/index.d.mts CHANGED
@@ -1,17 +1,88 @@
1
- import { CommonServerOptions, HtmlTagDescriptor, InlineConfig, Plugin } from "vite";
1
+ import { Alias, CommonServerOptions, HtmlTagDescriptor, InlineConfig, Plugin, PluginOption } from "vite";
2
+ import { GeneratorPlugin } from "@tanstack/router-generator";
3
+ import { DYNAMIC_BASE_PLACEHOLDER } from "@powerhousedao/shared/connect";
2
4
  import { PowerhouseConfig, PowerhousePackage } from "@powerhousedao/config";
3
- import { PHConnectRuntimeConfig } from "@powerhousedao/shared/clis";
4
-
5
+ import { PHConnectRuntimeConfig, PowerhouseConfig as PowerhouseConfig$1 } from "@powerhousedao/shared/clis";
5
6
  //#region connect-utils/constants.d.ts
6
- declare const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
7
- declare const IMPORT_SCRIPT_FILE = "external-packages.js";
8
- declare const LOCAL_PACKAGE_ID = "ph:local-package";
9
- declare const PH_DIR_NAME = ".ph";
7
+ export declare const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
8
+ export declare const IMPORT_SCRIPT_FILE = "external-packages.js";
9
+ export declare const LOCAL_PACKAGE_ID = "ph:local-package";
10
+ export declare const PH_DIR_NAME = ".ph";
11
+ //#endregion
12
+ //#region connect-utils/vite-plugins/app-shell.d.ts
13
+ /** On the prerendered shell's elements; marks an index.html that has it. */
14
+ export declare const APP_SHELL_MARKER = "data-ph-shell";
15
+ export type AppShell = {
16
+ /** `#root`'s markup. */
17
+ body: string;
18
+ /** Critical CSS and the pre-paint guard, for `<head>`. */
19
+ head: string;
20
+ };
21
+ /** `generic`: Connect's chrome. `core`: core's views, for a composition without the generic plugin. */
22
+ export type AppShellVariant = "generic" | "core";
23
+ export type AppShells = Partial<Record<AppShellVariant, AppShell>>;
24
+ /** Each plugin specifier Connect ships a shell for, to the variant it picks. */
25
+ export type ShellPlugins = Record<string, AppShellVariant>;
26
+ /** In Connect's dist, and copied to a project's: the plugins that pick a shell. */
27
+ export declare const SHELL_PLUGINS_FILE = "shell-plugins.json";
28
+ /** In a project's dist: every variant, for a server that swaps the shell to the served composition. */
29
+ export declare const APP_SHELLS_FILE = "app-shells.json";
30
+ /** The shell of the composition's first plugin that has one, else core's; no composition is classic.
31
+ * Without `plugins` (an older Connect): core for a composition, generic for classic. */
32
+ export declare function appShellVariant(composition: readonly {
33
+ module: string;
34
+ }[] | null | undefined, plugins: ShellPlugins | undefined): AppShellVariant;
35
+ /** The plugins' shell manifest in `dir`, if there is a valid one. */
36
+ export declare function readShellPluginsIn(dir: string): ShellPlugins | undefined;
37
+ /** The shell manifest of the installed Connect, if it ships one. */
38
+ export declare function readShellPlugins(projectRoot: string): ShellPlugins | undefined;
39
+ /** The shell Connect's build prerendered, if the installed Connect ships one. */
40
+ export declare function readAppShell(projectRoot: string, variant?: AppShellVariant): AppShell | undefined;
41
+ /** Every variant the installed Connect ships. */
42
+ export declare function readAppShells(projectRoot: string): AppShells;
43
+ /** On the boot-recovery script; its sessionStorage key guards against reload loops. */
44
+ export declare const BOOT_RECOVER_MARKER = "data-ph-boot-recover";
45
+ export declare const BOOT_RECOVER_KEY = "ph:sw-recover";
46
+ export declare const BOOT_RECOVER_SCRIPT: string;
47
+ /** Prefixes the shell's root-relative links with the deploy base. */
48
+ export declare function rebaseShellLinks(body: string, base: string): string;
49
+ /** The app's title without `connect.branding.appName`; core's `appTitle` fallback. */
50
+ export declare const DEFAULT_APP_NAME = "Connect";
51
+ /** Fills the shell's app name as the app resolves it: the branding name, else the default. */
52
+ export declare function withShellAppName(html: string, appName: string | undefined): string;
53
+ /** Inlines `shell` into an empty `#root`, adds its critical CSS and, unless
54
+ * `deferStyles` is false, defers the stylesheets; React replaces the markup when the app renders. */
55
+ export declare function injectAppShell(html: string, shell: AppShell, base?: string, { deferStyles, appName }?: {
56
+ deferStyles?: boolean;
57
+ appName?: string;
58
+ }): string;
59
+ /** The variant an index.html carries, from its shell's marker value. */
60
+ export declare function appShellVariantOf(html: string): AppShellVariant | undefined;
61
+ /** Replaces the shell an index.html carries with `shell`, titled `appName`; a page without one is unchanged. */
62
+ export declare function swapAppShell(html: string, shell: AppShell, base?: string, appName?: string): string;
63
+ export type ConnectAppShellOptions = {
64
+ /** The composition the app boots with; picks the variant. */
65
+ composition?: readonly {
66
+ module: string;
67
+ }[] | null;
68
+ /** The served `connect.branding.appName`. */
69
+ appName?: string;
70
+ /** With the project's routes: the aliases that point Connect at its tree. */
71
+ routeAliases?: Alias[];
72
+ /** The project's routes folder; dev renders the shell again when it changes. */
73
+ routesDir?: string;
74
+ /** The host's stylesheet, which the page's build adds to the project's. */
75
+ hostStylesheet?: string;
76
+ };
77
+ /** Build: the composition's shell in #root and every variant in the dist, from
78
+ * the project's routes when it has them. Dev: the shell from the project's routes
79
+ * when it has them, else core's for a core composition. */
80
+ export declare function connectAppShellPlugin(projectRoot: string, { composition, appName, routeAliases, routesDir, hostStylesheet }?: ConnectAppShellOptions): Plugin;
10
81
  //#endregion
11
82
  //#region connect-utils/vite-plugins/build-hash.d.ts
12
83
  /** Name of the build-identity file emitted into the build output. */
13
- declare const BUILD_HASH_FILE: "build-hash.json";
14
- interface BuildHashInput {
84
+ export declare const BUILD_HASH_FILE: "build-hash.json";
85
+ export interface BuildHashInput {
15
86
  /** Monorepo workspace git SHA (CI/dev builds); empty outside the monorepo. */
16
87
  workspaceGitSha: string;
17
88
  /** Monorepo workspace version (CI/dev builds); empty outside it. */
@@ -38,8 +109,8 @@ interface BuildHashInput {
38
109
  * (define `PH_CONNECT_BUILD_HASH`) to `build-hash.json`, which the build
39
110
  * emits alongside the app and the server must serve no-cache.
40
111
  */
41
- declare function computeBuildHash(input: BuildHashInput): string;
42
- declare function buildHashFromBuildOptions(options: {
112
+ export declare function computeBuildHash(input: BuildHashInput): string;
113
+ export declare function buildHashFromBuildOptions(options: {
43
114
  dirname: string;
44
115
  phConfig: unknown;
45
116
  packages: ReadonlyArray<{
@@ -57,13 +128,155 @@ declare function buildHashFromBuildOptions(options: {
57
128
  * Build-only: dev (studio) never runs generateBundle, and the SPA check
58
129
  * treats a missing file as "nothing to compare" and stays silent.
59
130
  */
60
- declare function connectBuildHashPlugin(buildHash: string): Plugin;
131
+ export declare function connectBuildHashPlugin(buildHash: string): Plugin;
132
+ //#endregion
133
+ //#region connect-utils/vite-plugins/connect-routes.d.ts
134
+ /** A project's routes for its Connect deployment, beside Connect's own. */
135
+ export declare const HOST_ROUTES_DIR = "hosts/connect/routes";
136
+ /** The generated tree of Connect's and the project's routes. */
137
+ export declare const CONNECT_ROUTES_GEN = ".ph/connect-routes.gen.ts";
138
+ /** Connect's dist imports its route tree by this specifier. */
139
+ export declare const ROUTE_TREE_SPECIFIER = "@powerhousedao/connect/route-tree";
140
+ /** Core's types name the app's tree by this one; both resolve to one tree. */
141
+ export declare const CORE_ROUTE_TREE_SPECIFIER = "@powerhousedao/connect-core/route-tree";
142
+ /** A host's routes folder: `routes` (a host's `runner.routes`), relative to the
143
+ * project, else `hosts/connect/routes/`; undefined if none or `false`. */
144
+ export declare function resolveConnectRoutesDir(projectRoot: string, routes?: string | false): string | undefined;
145
+ /** The tree generated from `routesDir`: `.ph/connect-routes.gen.ts` for
146
+ * `hosts/connect/routes/`, else `.ph/<folder>.gen.ts`. */
147
+ export declare function connectRoutesTreeOf(projectRoot: string, routesDir: string): string;
148
+ /** Connect's pathless sidebar layout; a project's routes in `_app/` render in it. */
149
+ export declare const APP_LAYOUT = "_app";
150
+ export type ConnectRoutes = {
151
+ /** Points Connect at the tree to route with, then at what its route files render. */
152
+ aliases: Alias[];
153
+ /** The router plugin, only when the project has routes. */
154
+ plugins: PluginOption[];
155
+ /** Connect's route files and the project's share one router. */
156
+ dedupe: string[];
157
+ };
158
+ /** Connect's route files: core's routes with Connect's views. */
159
+ export declare function connectRoutesDirOf(connectDir: string): string;
160
+ /** A route file's id below its folder: route groups and `route` files
161
+ * resolved, flat `a.b` names read as folders. */
162
+ export declare function routeIdOf(file: string): string;
163
+ /** Connect's `_app/` route files that a project file at the same id replaces. */
164
+ export declare function overriddenConnectRoutes(connectAppDir: string, projectAppDir: string): Set<string>;
165
+ /** The routes a package offers other Connects, as `ph build` publishes them
166
+ * (`./connect-routes`); generated beside the route tree. */
167
+ export declare const PACKAGE_ROUTES_MODULE = ".ph/connect-routes.package.ts";
168
+ /** The router plugin's config: Connect's root and routes, and the project's. */
169
+ export declare function connectRoutesGeneratorConfig(connectDir: string, projectRoot: string, projectRoutes: string): {
170
+ target: "react" | "solid" | "vue";
171
+ virtualRouteConfig?: string | import("@tanstack/virtual-file-routes").VirtualRootRoute | undefined;
172
+ routeFilePrefix?: string | undefined;
173
+ routeFileIgnorePrefix: string;
174
+ routeFileIgnorePattern?: string | undefined;
175
+ routesDirectory: string;
176
+ quoteStyle: "double" | "single";
177
+ semicolons: boolean;
178
+ disableLogging: boolean;
179
+ routeTreeFileHeader: string[];
180
+ indexToken: string | RegExp | {
181
+ regex: string;
182
+ flags?: string | undefined;
183
+ };
184
+ routeToken: string | RegExp | {
185
+ regex: string;
186
+ flags?: string | undefined;
187
+ };
188
+ pathParamsAllowedCharacters?: ("$" | "&" | "+" | "," | ":" | ";" | "=" | "@")[] | undefined;
189
+ generatedRouteTree: string;
190
+ disableTypes: boolean;
191
+ addExtensions: string | boolean;
192
+ enableRouteTreeFormatting: boolean;
193
+ routeTreeFileFooter?: string[] | (() => Array<string>) | undefined;
194
+ autoCodeSplitting?: boolean | undefined;
195
+ customScaffolding?: {
196
+ routeTemplate?: string | undefined;
197
+ lazyRouteTemplate?: string | undefined;
198
+ } | undefined;
199
+ experimental?: {
200
+ enableCodeSplitting?: boolean | undefined;
201
+ } | undefined;
202
+ plugins?: GeneratorPlugin[] | undefined;
203
+ tmpDir: string;
204
+ importRoutesUsingAbsolutePaths: boolean;
205
+ };
206
+ /** Writes the route tree of Connect's and the project's routes; throws on a
207
+ * collision that is not an override, which the router plugin would only log. */
208
+ export declare function generateConnectRoutes(projectRoot: string, routesDir: string, config?: {
209
+ target: "react" | "solid" | "vue";
210
+ virtualRouteConfig?: string | import("@tanstack/virtual-file-routes").VirtualRootRoute | undefined;
211
+ routeFilePrefix?: string | undefined;
212
+ routeFileIgnorePrefix: string;
213
+ routeFileIgnorePattern?: string | undefined;
214
+ routesDirectory: string;
215
+ quoteStyle: "double" | "single";
216
+ semicolons: boolean;
217
+ disableLogging: boolean;
218
+ routeTreeFileHeader: string[];
219
+ indexToken: string | RegExp | {
220
+ regex: string;
221
+ flags?: string | undefined;
222
+ };
223
+ routeToken: string | RegExp | {
224
+ regex: string;
225
+ flags?: string | undefined;
226
+ };
227
+ pathParamsAllowedCharacters?: ("$" | "&" | "+" | "," | ":" | ";" | "=" | "@")[] | undefined;
228
+ generatedRouteTree: string;
229
+ disableTypes: boolean;
230
+ addExtensions: string | boolean;
231
+ enableRouteTreeFormatting: boolean;
232
+ routeTreeFileFooter?: string[] | (() => Array<string>) | undefined;
233
+ autoCodeSplitting?: boolean | undefined;
234
+ customScaffolding?: {
235
+ routeTemplate?: string | undefined;
236
+ lazyRouteTemplate?: string | undefined;
237
+ } | undefined;
238
+ experimental?: {
239
+ enableCodeSplitting?: boolean | undefined;
240
+ } | undefined;
241
+ plugins?: GeneratorPlugin[] | undefined;
242
+ tmpDir: string;
243
+ importRoutesUsingAbsolutePaths: boolean;
244
+ }): Promise<void>;
245
+ /** Connect's route files, as the generated tree imports them: by Connect's
246
+ * package name, which a project depends on. */
247
+ export declare const CONNECT_ROUTES_SPECIFIER = "@powerhousedao/connect/routes";
248
+ /** Generates the tree when the project has routes, else drops a stale one. */
249
+ export declare function syncConnectRoutes(projectRoot: string, routesDir?: string | undefined): Promise<void>;
250
+ /** Mounts a project's routes folder over Connect's routes; without one,
251
+ * Connect keeps its prebuilt tree and no router plugin runs. */
252
+ export declare function connectRoutes(projectRoot: string, routesDir?: string | false | undefined): ConnectRoutes;
253
+ /** One chunk for the router and the project's route configs, which the split
254
+ * route components would otherwise spread over several shared chunks. */
255
+ export declare function connectRouterChunkGroups(routesDir?: string | false): ({
256
+ name: string;
257
+ test: RegExp;
258
+ priority: number;
259
+ } | {
260
+ priority?: undefined;
261
+ name: string;
262
+ test: (id: string) => boolean;
263
+ })[];
264
+ //#endregion
265
+ //#region connect-utils/vite-plugins/host-stylesheet.d.ts
266
+ /** The host's stylesheet, which may not exist yet: `style.css` beside its routes
267
+ * folder, so `hosts/connect/style.css` by default. `ph build` never reads it. */
268
+ export declare function hostStylesheetPath(projectRoot: string, routesDir?: string | false): string;
269
+ /** The project's `style.css` with the host's stylesheet imported last when it
270
+ * exists (else `missing`), so the host's theme wins in the page's one build. */
271
+ export declare function withHostStylesheet(css: string, stylesheet: string, hostStylesheet: string | undefined, missing?: string): string;
272
+ /** Serves the project's `style.css` with the host's stylesheet in it. */
273
+ export declare function hostStylesheetPlugin(projectRoot: string, hostStylesheet: string): Plugin;
61
274
  //#endregion
62
275
  //#region connect-utils/externalize-vendor.d.ts
63
- interface VendorPrebuildOptions {
64
- /** Project root (the reactor-project dir). */
276
+ export interface VendorPrebuildOptions {
277
+ /** Project root the vendor deps resolve from. */
65
278
  dirname: string;
66
- /** Bare specifiers to bundle into the vendor (defaults to the heavy libs). */
279
+ /** Specifiers to prebuild into the vendor (defaults to the dev set). */
67
280
  include?: string[];
68
281
  /** Specifiers left external to the build (defaults to the React family). */
69
282
  external?: string[];
@@ -73,35 +286,328 @@ interface VendorPrebuildOptions {
73
286
  errorRef?: {
74
287
  message?: string;
75
288
  };
289
+ /**
290
+ * The APP's base — the same string the app build uses (the dynamic-base
291
+ * placeholder, or a normalized deploy base like "/app/"). The vendor's own
292
+ * build base is this plus the vendor segment, so emitted asset URLs land
293
+ * under <app-base>__vendor__/. Default: the dynamic placeholder (dev
294
+ * behavior; the segment is still appended once by the build worker).
295
+ * Import-map values stay base-relative; the production
296
+ * build strips the leading slash (values then resolve against the page URL
297
+ * under any deploy base), the dev flow prefixes its own base.
298
+ */
299
+ base?: string;
300
+ /** NODE_ENV define for the vendor build (default "development"). */
301
+ nodeEnv?: "development" | "production";
302
+ /** The app's own deps the vendored packages also bundle: vendored as listed,
303
+ * resolved from `from` (projects don't install them). */
304
+ ownDeps?: {
305
+ specs: string[];
306
+ from: string;
307
+ };
76
308
  }
77
309
  /**
78
310
  * The stable Connect libraries worth prebuilding. The React family is NOT here —
79
311
  * it's externalized from the build (see `VENDOR_EXTERNAL`) so the vendor shares
80
312
  * the dev server's single React instance via the import map.
81
313
  */
82
- declare const DEFAULT_VENDOR_INCLUDE: string[];
314
+ export declare const DEFAULT_VENDOR_INCLUDE: string[];
315
+ /** Never vendored: the route tree is the project's, the config path the app's
316
+ * base, and SSR server-only. */
317
+ export declare const VENDOR_SKIP_SUBPATHS: Set<string>;
83
318
  /**
84
319
  * React-family specifiers kept external to the vendor build. The vendor's chunks
85
320
  * emit bare imports for these; `devReactImportmapPlugin`'s import map resolves
86
321
  * them to Vite's pre-bundled React, so there is exactly one React instance.
87
322
  */
88
- declare const VENDOR_EXTERNAL: string[];
89
- interface PrebuiltVendor {
323
+ export declare const VENDOR_EXTERNAL: string[];
324
+ export interface PrebuiltVendor {
90
325
  vendorDir: string;
91
- /** import map: bare specifier -> "/__vendor__/<entry>.js". */
326
+ /** import map: bare specifier -> "/__vendor__/<entry>-<hash>.js" (base-relative). */
92
327
  imports: Record<string, string>;
328
+ /** Resolved versions of every included + external package. */
329
+ versions: Record<string, string>;
330
+ /** Content-hashed shared-deps module ("/__vendor__/shared-deps-<hash>.js", base-relative). */
331
+ sharedDeps: string;
93
332
  }
94
333
  /** URL prefix the vendor bundle is served under by the dev middleware. */
95
- declare const VENDOR_URL_PREFIX = "/__vendor__/";
334
+ export declare const VENDOR_URL_PREFIX = "/__vendor__/";
96
335
  /**
97
336
  * Build the prebuilt vendor (once, in a throwaway subprocess) and return its dir
98
337
  * + import map. Idempotent: reuses a cached vendor built for the same dep set.
99
338
  * Returns null on any failure (caller falls back to a normal dev server).
100
339
  */
101
- declare function prebuildConnectVendor(options: VendorPrebuildOptions): Promise<PrebuiltVendor | null>;
340
+ export declare function prebuildConnectVendor(options: VendorPrebuildOptions): Promise<PrebuiltVendor | null>;
341
+ export declare function linkedBuildStamp(pkgRoot: string): string;
342
+ export declare function resolveVersionDigest(versions: Record<string, string>, own: Record<string, string>, stamps: Map<string, string>, build: {
343
+ base: string;
344
+ nodeEnv: string;
345
+ }): string;
346
+ export declare const LOCK_STALE_MS: number;
347
+ export interface VendorLock {
348
+ dir: string;
349
+ token: string;
350
+ timer: ReturnType<typeof setInterval>;
351
+ }
352
+ export declare function acquireLock(lockDir: string): VendorLock | null;
353
+ export declare function releaseLock(lock: VendorLock): void;
354
+ /** The package root at or above `from` that Node would load `pkg` from, or null. */
355
+ export declare function findPackageRoot(from: string, pkg: string): string | null;
356
+ /** Each spec's browser/import entry file when resolved from `from`; unresolvable specs are left out. */
357
+ export declare function resolveOwnDeps(from: string, specs: string[]): Record<string, string>;
358
+ /**
359
+ * The published specifiers whose entry file the vendor build never emitted.
360
+ * URLs are base-less (`/__vendor__/x.js`) and resolve inside `vendorDir`.
361
+ */
362
+ export declare function missingVendorEntries(vendorDir: string, imports: Record<string, string>): {
363
+ spec: string;
364
+ url: string;
365
+ }[];
366
+ /**
367
+ * Rebase the vendor's base-less entry URLs (`/__vendor__/x.js`) onto the
368
+ * deploy base, so a consumer that resolves them against the page origin lands
369
+ * under that base rather than the server root. A dynamic-base build keeps its
370
+ * placeholder, which the runtime substitutes.
371
+ *
372
+ * `base` is the app base from `prebuildConnectVendor` callers; a base that
373
+ * already carries the vendor segment has it dropped first so it is never
374
+ * doubled.
375
+ */
376
+ export declare function withVendorBase(imports: Record<string, string>, base: string): Record<string, string>;
377
+ //#endregion
378
+ //#region connect-utils/reactor-worker-build.d.ts
379
+ /** URL prefix the worker bundle is served under, next to `__vendor__/`. */
380
+ export declare const REACTOR_WORKER_URL_PREFIX = "/__reactor_worker__/";
381
+ /** Entry filename of the bundle; the tab constructs its SharedWorker from it. */
382
+ export declare const REACTOR_WORKER_ENTRY = "reactor.worker.js";
383
+ /** Content-Type for the extensions the worker build emits; JS is the default. */
384
+ export declare const REACTOR_WORKER_MIME: Record<string, string>;
385
+ export interface ReactorWorkerVendorOptions {
386
+ /** The vendor's import map (`spec -> /__vendor__/<entry>.js`). */
387
+ imports: Record<string, string>;
388
+ /** The built vendor dir, needed to verify which entries are worker-safe. */
389
+ dir: string;
390
+ }
391
+ export interface ReactorWorkerBuildOptions {
392
+ /** Project root the worker's dependencies resolve from. */
393
+ dirname: string;
394
+ /** Directory to hold the bundle (e.g. `<dist>/__reactor_worker__`). */
395
+ outDir: string;
396
+ /**
397
+ * The prebuilt vendor to share dependencies with. Only the worker-safe
398
+ * subset of its entries is externalized (see
399
+ * {@link workerSafeVendorImports}); omit to bundle everything.
400
+ */
401
+ vendor?: ReactorWorkerVendorOptions;
402
+ /**
403
+ * Worker entry to build. Defaults to the installed Connect dist's
404
+ * `reactor.worker.js`; tests inject a fixture entry here.
405
+ */
406
+ entryPath?: string;
407
+ /** NODE_ENV define for the build (default "development"). */
408
+ nodeEnv?: "development" | "production";
409
+ /** Filled with the failure cause when the prebuild returns null. */
410
+ errorRef?: {
411
+ message?: string;
412
+ };
413
+ }
414
+ export interface PrebuiltReactorWorker {
415
+ outDir: string;
416
+ /** Entry filename inside outDir ({@link REACTOR_WORKER_ENTRY}). */
417
+ entry: string;
418
+ /**
419
+ * Digest of everything that shaped this bundle's output (see
420
+ * {@link computeSourceDigest}); identical for a cache hit and a fresh
421
+ * build. The dev plugin serves it in `worker-meta.json` next to the
422
+ * bundle; `apps/connect/src/utils/reactor-worker-url.ts` fetches it to
423
+ * fold the actual built worker code into the tab's version fingerprint
424
+ * (W0.6).
425
+ */
426
+ sourceDigest: string;
427
+ /**
428
+ * The worker-safe vendor subset this bundle externalizes (see
429
+ * {@link workerSafeVendorImports}); empty without a vendor.
430
+ */
431
+ vendorImports: Record<string, string>;
432
+ }
433
+ /**
434
+ * The installed Connect dist's worker entry, or null when the installed
435
+ * version predates the worker (the feature is then unavailable, not broken).
436
+ */
437
+ export declare function resolveReactorWorkerSource(dirname: string): string | null;
438
+ /** `/__vendor__/<entry>.js` -> `../__vendor__/<entry>.js` (sibling dirs). */
439
+ export declare function vendorRelativePath(vendorUrl: string): string;
440
+ /**
441
+ * Module specifiers a worker cannot resolve: anything that is not relative,
442
+ * root-relative, or an http(s)/data/blob URL. Used as a post-build guard so a
443
+ * leftover bare (or `node:`) import fails the build with a name instead of
444
+ * shipping a worker that dies on its first import statement.
445
+ *
446
+ * Expects minified (comment-free) output: a raw-text scan cannot tell a real
447
+ * import from a JSDoc code sample, and unminified kysely/viem are full of the
448
+ * latter. The build below always minifies for exactly this reason.
449
+ */
450
+ export declare function findDisallowedSpecifiers(code: string): string[];
451
+ /**
452
+ * Packages whose BUILT dist shapes the worker bundle's output even when
453
+ * connect's own dist/reactor.worker.js entry file did not change.
454
+ *
455
+ * That entry is a library artifact whose bare imports this build resolves
456
+ * through node_modules at BUILD time, so a rebuilt dist anywhere in its
457
+ * closure changes the bundle output without touching the entry file's own
458
+ * size/mtime. The list is DERIVED from the installed Connect's own
459
+ * dependencies rather than hardcoded: the bundle pulls `@renown/sdk`,
460
+ * `@powerhousedao/powerhouse-vetra-packages` and `@powerhousedao/shared` out
461
+ * of node_modules too, and a hardcoded pair left every one of those able to be
462
+ * rebuilt behind a cache hit. Connect's dependency list is the cheap stand-in
463
+ * for the resolved bundle graph: every workspace package the worker can reach
464
+ * is reachable through it, and a package not in the bundle only costs a readdir.
465
+ */
466
+ export declare function upstreamWorkerPackages(dirname: string): string[];
467
+ /**
468
+ * This module's own installed version, read by walking up from its file to
469
+ * the nearest `package.json` named "@powerhousedao/builder-tools" (same
470
+ * technique as `build-hash.ts`'s `readConnectVersion`: builder-tools'
471
+ * `exports` map has no `./package.json` subpath, so node resolution can't
472
+ * get there). Works whether this runs from source (tests, this monorepo) or
473
+ * the built dist.
474
+ */
475
+ export declare function resolveOwnPackageVersion(): string;
476
+ /**
477
+ * This package's own version, computed once. Folded into the worker bundle
478
+ * cache key so a builder-tools release — which can change how the bundle is
479
+ * built (anything in this module beyond {@link WORKER_BUILD_WORKER} itself,
480
+ * e.g. `workerSafeVendorImports`, the resolve plugin) — invalidates bundles
481
+ * a prior builder-tools version cached.
482
+ */
483
+ export declare const BUILDER_TOOLS_VERSION: string;
484
+ /**
485
+ * A workspace package's real directory, resolved the way Node's resolver
486
+ * would (through `node_modules`), or null when it is not installed (e.g. a
487
+ * non-monorepo consumer project — graceful, not an error). pnpm's
488
+ * node_modules symlinks resolve to the real package directory, so this
489
+ * reflects the monorepo's actual dist state, not a stale symlink target.
490
+ */
491
+ export declare function resolveWorkspacePackageDir(dirname: string, pkgName: string): string | null;
492
+ /**
493
+ * Cheap content fingerprint of a directory's immediate files: no file bytes
494
+ * are read, just each entry's name/size/mtime, so it stays fast even for a
495
+ * large dist. Sensitive to a rebuild in the common cases: Vite's
496
+ * content-hashed chunk filenames change the name itself; a stable-named file
497
+ * (an entry point) changes size or mtime. Bounded (`maxFiles`) so a
498
+ * pathological directory cannot make this slow — deliberately not a
499
+ * full-tree hash.
500
+ *
501
+ * The names are sorted BEFORE the bound is applied, so the subset the bound
502
+ * keeps is the same subset on every run: readdir order is unspecified, and
503
+ * truncating it first made the fingerprint of a directory past the bound a
504
+ * function of whatever order the filesystem happened to report.
505
+ */
506
+ export declare function distDirFingerprint(dir: string, maxFiles?: number): string;
507
+ export declare function computeSourceDigest(dirname: string, entryPath: string, vendorDir?: string, builderToolsVersion?: string): string;
508
+ /** Content digest of a directory tree (relative paths + bytes; source maps skipped). */
509
+ export declare function directoryContentDigest(dir: string): string;
510
+ /**
511
+ * Build the worker bundle (once, in a throwaway subprocess) into `outDir`.
512
+ * Idempotent: reuses a cached bundle built from the same connect dist, vendor
513
+ * mapping, and builder logic. Returns null on failure (`errorRef` carries the
514
+ * cause) or when the installed Connect has no worker entry.
515
+ */
516
+ export declare function prebuildReactorWorker(options: ReactorWorkerBuildOptions): Promise<PrebuiltReactorWorker | null>;
517
+ /** Replace `outDir` with the finished `tmpDir`, old contents removed last. */
518
+ export declare function publishDirAtomic(tmpDir: string, outDir: string): void;
519
+ /**
520
+ * Scan the emitted JS files REACHABLE from the entry via import statements
521
+ * for specifiers a worker cannot resolve. Vendor externals were rewritten to
522
+ * ../__vendor__/ relative paths, so anything bare that survives in the graph
523
+ * is a real defect.
524
+ *
525
+ * Deliberately a graph walk, not a directory walk: the bundled reactor code
526
+ * carries `new URL(..., import.meta.url)` references to its node
527
+ * worker-thread entries (executor/projection workers), which Vite emits as
528
+ * stray assets full of node-only imports. They are unreachable dead weight in
529
+ * a browser bundle — the production vendor output tolerates the same files —
530
+ * and must not fail the build.
531
+ */
532
+ export declare function findBundleSpecifierOffenders(bundleDir: string, entry?: string): {
533
+ file: string;
534
+ specs: string[];
535
+ }[];
536
+ /** The page-only markers present in `code`, in a fixed order. */
537
+ export declare function findWorkerUnsafeMarkers(code: string): string[];
538
+ /**
539
+ * The subset of the vendor's entries a worker may import.
540
+ *
541
+ * The vendor build keeps the React family external: its chunks carry bare
542
+ * `import "react"` statements that the PAGE resolves through its import map.
543
+ * A worker resolves no import map, so externalizing a vendor spec whose chunk
544
+ * closure reaches such an import would kill the worker on its first load —
545
+ * and the chunk graph is shared across vendor entries, so even a React-free
546
+ * module (e.g. an rpc subpath) can be entangled with React through a shared
547
+ * chunk. The vendor is also built for the page: a dynamic-base build rewrites
548
+ * its asset URLs onto a global only the page sets, and its dynamic imports go
549
+ * through Vite's preload helper, which needs `document`. Each entry's own
550
+ * closure inside the vendor dir decides: clean closure, worker-safe; anything
551
+ * bare or page-only in it (see {@link findWorkerUnsafeMarkers}), or a missing
552
+ * entry file, bundled into the worker instead.
553
+ */
554
+ export declare function workerSafeVendorImports(vendorDir: string, vendorImports: Record<string, string>): Record<string, string>;
555
+ /**
556
+ * Builds arbitrary worker-loadable entries with the worker build config.
557
+ * Exported for the local-package bundles, which need the same self-contained
558
+ * output and vendor externalization at a different depth.
559
+ */
560
+ export declare function runWorkerBuildEntries(dirname: string, outDir: string, entries: Record<string, string>, vendorImports: Record<string, string>, nodeEnv: "development" | "production", vendorPrefix?: string): Promise<{
561
+ ok: boolean;
562
+ stderr: string;
563
+ }>;
564
+ //#endregion
565
+ //#region connect-utils/worker-packages-build.d.ts
566
+ /** Served under `<base>__reactor_worker__/packages/`. */
567
+ export declare const WORKER_PACKAGES_MANIFEST = "manifest.json";
568
+ export interface WorkerPackagesBuildOptions {
569
+ /** Project root the packages resolve from. */
570
+ dirname: string;
571
+ /** Local package names (`provider: "local"` in powerhouse.config.json). */
572
+ packages: string[];
573
+ /** Directory to hold the bundles (`<dist>/__reactor_worker__/packages`). */
574
+ outDir: string;
575
+ /** The prebuilt vendor to share dependencies with, when one was built. */
576
+ vendor?: ReactorWorkerVendorOptions;
577
+ /**
578
+ * The vendor's worker-safe subset, when the caller already computed it
579
+ * (`PrebuiltReactorWorker.vendorImports`); skips walking the vendor again.
580
+ */
581
+ safeVendorImports?: Record<string, string>;
582
+ nodeEnv?: "development" | "production";
583
+ errorRef?: {
584
+ message?: string;
585
+ };
586
+ }
587
+ export interface WorkerPackageManifestEntry {
588
+ name: string;
589
+ version?: string;
590
+ /** Filename inside outDir, as {@link workerPackageFileName} spells it. */
591
+ file: string;
592
+ }
593
+ /**
594
+ * The project's own package name when it ships a models bundle, so a caller
595
+ * can include it beside the configured `provider: "local"` packages. A vetra
596
+ * project declares no package entry for itself, yet its models are exactly
597
+ * the ones the worker is missing.
598
+ */
599
+ export declare function ownProjectPackage(dirname: string): string | undefined;
600
+ /**
601
+ * Build each local package's models entry into `outDir` and write the
602
+ * manifest the tab reads. Returns the manifest entries (empty when no local
603
+ * package ships a models bundle), or null when the build itself failed -
604
+ * `errorRef` then carries the cause. Both of those remove `outDir`, so a
605
+ * previous build's bundles never outlive the packages they came from.
606
+ */
607
+ export declare function prebuildWorkerPackages(options: WorkerPackagesBuildOptions): Promise<WorkerPackageManifestEntry[] | null>;
102
608
  //#endregion
103
609
  //#region connect-utils/types.d.ts
104
- type IConnectOptions = {
610
+ export type IConnectOptions = {
105
611
  mode: string;
106
612
  dirname: string;
107
613
  envDir?: string;
@@ -127,8 +633,25 @@ type IConnectOptions = {
127
633
  cliPackageRegistryUrl?: string;
128
634
  dynamicBase?: boolean;
129
635
  favicon?: string;
636
+ /** The routes folder, relative to the project (a host's `runner.routes`);
637
+ * `false` for none. Default: `hosts/connect/routes/` when it exists. */
638
+ routes?: string | false;
639
+ /**
640
+ * Production vendor: the prebuilt shared-dependency bundle's import map and
641
+ * version table (from `prebuildConnectVendor`). When set on a production
642
+ * build, the shared specifiers are externalized from the app bundle and
643
+ * merged into the page import map. Build input only.
644
+ */
645
+ vendor?: {
646
+ imports: Record<string, string>;
647
+ versions: Record<string, string>;
648
+ /** Base-applied URL of the content-hashed shared-deps module. */
649
+ sharedDeps?: string;
650
+ };
651
+ /** Content digest of the prebuilt reactor worker dir; versions its URLs. */
652
+ reactorWorkerVersion?: string;
130
653
  };
131
- type ConnectCommonOptions = {
654
+ export type ConnectCommonOptions = {
132
655
  base?: string;
133
656
  mode?: string;
134
657
  configFile?: string;
@@ -138,71 +661,71 @@ type ConnectCommonOptions = {
138
661
  defaultDrivesUrl?: string[];
139
662
  drivesPreserveStrategy?: "preserve-all" | "preserve-by-url-and-detach";
140
663
  };
141
- type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
664
+ export type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
142
665
  force?: boolean;
143
666
  };
144
- type ConnectStudioOptions = ConnectCommonOptions & {
667
+ export type ConnectStudioOptions = ConnectCommonOptions & {
145
668
  devServerOptions?: ViteDevOptions;
146
669
  printUrls?: boolean;
147
670
  bindCLIShortcuts?: boolean;
148
671
  };
149
- type ConnectBuildOptions = ConnectCommonOptions & {
672
+ export type ConnectBuildOptions = ConnectCommonOptions & {
150
673
  outDir?: string;
151
674
  };
152
- type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
675
+ export type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
153
676
  outDir?: string;
154
677
  printUrls?: boolean;
155
678
  bindCLIShortcuts?: boolean;
156
679
  };
157
680
  //#endregion
158
681
  //#region connect-utils/helpers.d.ts
159
- declare const DEFAULT_CONNECT_OUTDIR: ".ph/connect-build/dist/";
160
- declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
161
- declare function resolvePackage(packageName: string, root?: string): string;
162
- declare function resolveConnectPackageJson(root?: string): JSON | null;
682
+ export declare const DEFAULT_CONNECT_OUTDIR: ".ph/connect-build/dist/";
683
+ export declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
684
+ export declare function resolvePackage(packageName: string, root?: string): string;
685
+ export declare function resolveConnectPackageJson(root?: string): JSON | null;
163
686
  /**
164
687
  * Finds the dist dir of Connect on the local machine
165
688
  */
166
- declare function resolveConnectBundle(root?: string): string;
167
- declare function resolveConnectPublicDir(root?: string): string;
689
+ export declare function resolveConnectBundle(root?: string): string;
690
+ export declare function resolveConnectPublicDir(root?: string): string;
168
691
  /**
169
692
  * Copies the Connect dist dir to the target path
170
693
  */
171
- declare function copyConnect(sourcePath: string, targetPath: string): void;
694
+ export declare function copyConnect(sourcePath: string, targetPath: string): void;
172
695
  /**
173
696
  * Backs up the index.html file
174
697
  *
175
698
  * Needed when running the Connect Studio dev server on Windows
176
699
  */
177
- declare function backupIndexHtml(appPath: string, restore?: boolean): void;
178
- declare function removeBase64EnvValues(appPath: string): void;
179
- declare function readJsonFile(filePath: string): PowerhouseConfig | null;
700
+ export declare function backupIndexHtml(appPath: string, restore?: boolean): void;
701
+ export declare function removeBase64EnvValues(appPath: string): void;
702
+ export declare function readJsonFile(filePath: string): PowerhouseConfig | null;
180
703
  /**
181
704
  * Takes a list of Powerhouse project packages and optionally local Powerhouse packages and outputs a js file which exports those packages for use in Connect Studio.
182
705
  */
183
- declare function makeImportScriptFromPackages(args: {
706
+ export declare function makeImportScriptFromPackages(args: {
184
707
  packages: string[];
185
708
  importStyles?: boolean;
186
709
  localJsPath?: string;
187
710
  localCssPath?: string;
188
711
  }): string;
189
- declare function ensureNodeVersion(minVersion?: string): void;
190
- declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
712
+ export declare function ensureNodeVersion(minVersion?: string): void;
713
+ export declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
191
714
  /**
192
715
  * Appends the contents to the <head> tag of the index.html file
193
716
  */
194
- declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
717
+ export declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
195
718
  /**
196
719
  * Prepends the contents to the <head> tag of the index.html file
197
720
  */
198
- declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
199
- declare function runTsc(outDir: string): void;
200
- declare function stripVersionFromPackage(packageName: string): string;
721
+ export declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
722
+ export declare function runTsc(outDir: string): void;
723
+ export declare function stripVersionFromPackage(packageName: string): string;
201
724
  //#endregion
202
725
  //#region connect-utils/runtime-config-schema.d.ts
203
- declare const RUNTIME_CONFIG_SCHEMA_ID = "https://powerhouse.inc/schemas/powerhouse.config.json";
204
- declare const RUNTIME_CONFIG_SCHEMA_URL = "https://raw.githubusercontent.com/powerhouse-inc/powerhouse/main/packages/builder-tools/connect-utils/runtime-config.schema.json";
205
- declare const runtimeConfigSchema: {
726
+ export declare const RUNTIME_CONFIG_SCHEMA_ID = "https://powerhouse.inc/schemas/powerhouse.config.json";
727
+ export declare const RUNTIME_CONFIG_SCHEMA_URL = "https://raw.githubusercontent.com/powerhouse-inc/powerhouse/main/packages/builder-tools/connect-utils/runtime-config.schema.json";
728
+ export declare const runtimeConfigSchema: {
206
729
  readonly $schema: "http://json-schema.org/draft-07/schema#";
207
730
  readonly $id: "https://powerhouse.inc/schemas/powerhouse.config.json";
208
731
  readonly title: "Powerhouse Connect runtime configuration";
@@ -287,6 +810,10 @@ declare const runtimeConfigSchema: {
287
810
  readonly type: readonly ["string", "null"];
288
811
  readonly description: "Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image.";
289
812
  };
813
+ readonly favicon: {
814
+ readonly type: readonly ["string", "null"];
815
+ readonly description: "The browser tab icon: a file (.ico, .svg or .png) relative to the project, served and built as icon.ico. A build input; the built runtime config leaves it out. `ph connect build --favicon` wins over it.";
816
+ };
290
817
  };
291
818
  };
292
819
  readonly app: {
@@ -315,6 +842,10 @@ declare const runtimeConfigSchema: {
315
842
  readonly description: "Studio mode. Enables builder-only capabilities: Connect loads the vetra package and exposes DocumentModel (and vetra spec types) as creatable documents. Forced on by `ph vetra` / `ph connect studio`; false by default.";
316
843
  readonly default: false;
317
844
  };
845
+ readonly workflowsEnabled: {
846
+ readonly type: "boolean";
847
+ readonly description: "Powerhouse workflows in Connect. When true the tab loads the @powerhousedao/workflow package (workflow + connection documents, their editors and Workflow Studio) and the reactor worker registers its document models. Falls back to the top-level `workflows.enabled`; set it to override that for Connect. Independent of studioMode. False when neither is set.";
848
+ };
318
849
  };
319
850
  };
320
851
  readonly ai: {
@@ -406,7 +937,7 @@ declare const runtimeConfigSchema: {
406
937
  readonly preserveStrategy: {
407
938
  readonly type: "string";
408
939
  readonly enum: readonly ["preserve-all", "preserve-by-url-and-detach"];
409
- readonly description: "Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default \u2014 opt-in only.";
940
+ readonly description: "Strategy applied when defaultDrives change between deploys. 'preserve-all' keeps user-added drives untouched; 'preserve-by-url-and-detach' detaches removed default drives. No schema default — opt-in only.";
410
941
  };
411
942
  readonly sections: {
412
943
  readonly type: "object";
@@ -557,6 +1088,32 @@ declare const runtimeConfigSchema: {
557
1088
  };
558
1089
  };
559
1090
  };
1091
+ readonly openPanel: {
1092
+ readonly type: "object";
1093
+ readonly additionalProperties: false;
1094
+ readonly description: "OpenPanel product analytics. Set `clientId` to enable; an empty `clientId` disables it. Events are only sent after the user accepts analytics cookies. Takes precedence over the build-time PH_CONNECT_OPENPANEL_* env vars.";
1095
+ readonly properties: {
1096
+ readonly clientId: {
1097
+ readonly type: "string";
1098
+ readonly description: "OpenPanel client id. Empty string disables OpenPanel entirely.";
1099
+ readonly default: "";
1100
+ };
1101
+ readonly apiUrl: {
1102
+ readonly type: "string";
1103
+ readonly description: "OpenPanel API URL for self-hosted instances (e.g. 'https://openpanel.example/api'). Omit to use OpenPanel's hosted API.";
1104
+ };
1105
+ readonly trackUiEvents: {
1106
+ readonly type: "boolean";
1107
+ readonly description: "Track UI events.";
1108
+ readonly default: true;
1109
+ };
1110
+ readonly trackOperations: {
1111
+ readonly type: "boolean";
1112
+ readonly description: "Track document operations.";
1113
+ readonly default: true;
1114
+ };
1115
+ };
1116
+ };
560
1117
  readonly instance: {
561
1118
  readonly type: "object";
562
1119
  readonly additionalProperties: false;
@@ -570,7 +1127,12 @@ declare const runtimeConfigSchema: {
570
1127
  };
571
1128
  readonly reactorWorker: {
572
1129
  readonly type: "boolean";
573
- readonly description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified.";
1130
+ readonly description: "Host the reactor in a shared worker instead of on the main thread. Off by default; the main-thread reactor stays the proven path until cutover is verified. Packaged deployments load the worker from the prebuilt bundle `ph connect build` emits under __reactor_worker__/ (the dev server builds it lazily at the same path); when that bundle is absent the feature reports itself unavailable instead of starting a worker that cannot load.";
1131
+ readonly default: false;
1132
+ };
1133
+ readonly multiReactor: {
1134
+ readonly type: "boolean";
1135
+ readonly description: "Opt-in multi-reactor routing. When on, Connect routes through the in-browser reactor plus remote backends instead of the single in-browser reactor. Off by default; the single-reactor path is unchanged.";
574
1136
  readonly default: false;
575
1137
  };
576
1138
  };
@@ -607,12 +1169,24 @@ declare const runtimeConfigSchema: {
607
1169
  };
608
1170
  };
609
1171
  };
1172
+ readonly createSignaturePolicy: {
1173
+ readonly type: "string";
1174
+ readonly enum: readonly ["legacy", "v2-required"];
1175
+ readonly description: "What new documents are created as. `v2-required` documents accept only v2 action signatures and take content-addressed ids; set `legacy` while any peer Connect syncs with predates them. Existing documents keep their policy.";
1176
+ readonly default: "v2-required";
1177
+ };
1178
+ readonly unsupportedStoredDocuments: {
1179
+ readonly type: "string";
1180
+ readonly enum: readonly ["refuse", "read-only"];
1181
+ readonly description: "What the reactor does when this browser's store holds documents at protocol versions this build does not run. `refuse` fails the boot and names the versions; `read-only` boots and keeps those documents read-only.";
1182
+ readonly default: "refuse";
1183
+ };
610
1184
  };
611
1185
  };
612
1186
  readonly pwa: {
613
1187
  readonly type: "object";
614
1188
  readonly additionalProperties: false;
615
- readonly description: "Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here \u2014 it is derived from the manifest's category field.) Only applied when connect.app.offline is true.";
1189
+ readonly description: "Progressive-web-app / service-worker overrides, layered on Connect's built-in PWA defaults at build time. Scalar fields deep-merge (this layer wins); the array members (icons, file_handlers, globs, runtimeCaching and denylist patterns) are additive; maximumFileSizeToCacheInBytes takes the max across contributors. (categories is not set here — it is derived from the manifest's category field.) Only applied when connect.app.offline is true.";
616
1190
  readonly properties: {
617
1191
  readonly manifest: {
618
1192
  readonly type: "object";
@@ -677,7 +1251,7 @@ declare const runtimeConfigSchema: {
677
1251
  readonly properties: {
678
1252
  readonly accept: {
679
1253
  readonly type: "object";
680
- readonly description: "MIME type \u2192 file extensions. Each extension must start with '.'; browsers ignore entries without it.";
1254
+ readonly description: "MIME type → file extensions. Each extension must start with '.'; browsers ignore entries without it.";
681
1255
  readonly additionalProperties: {
682
1256
  readonly type: "array";
683
1257
  readonly items: {
@@ -862,7 +1436,7 @@ declare const runtimeConfigSchema: {
862
1436
  };
863
1437
  //#endregion
864
1438
  //#region connect-utils/vite-config.d.ts
865
- declare function getConnectHtmlTags(options?: {
1439
+ export declare function getConnectHtmlTags(options?: {
866
1440
  registryUrl?: string | null;
867
1441
  injectTo?: HtmlTagDescriptor["injectTo"];
868
1442
  }): [{
@@ -871,84 +1445,76 @@ declare function getConnectHtmlTags(options?: {
871
1445
  readonly "http-equiv": "Content-Security-Policy";
872
1446
  readonly content: `script-src 'self' 'unsafe-inline' 'unsafe-eval'${string}; worker-src 'self' blob:; object-src 'none'; base-uri 'self';`;
873
1447
  };
874
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1448
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
875
1449
  }, {
876
1450
  readonly tag: "meta";
877
1451
  readonly attrs: {
878
1452
  readonly property: "og:title";
879
1453
  readonly content: "Connect";
880
1454
  };
881
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1455
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
882
1456
  }, {
883
1457
  readonly tag: "meta";
884
1458
  readonly attrs: {
885
1459
  readonly property: "og:type";
886
1460
  readonly content: "website";
887
1461
  };
888
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1462
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
889
1463
  }, {
890
1464
  readonly tag: "meta";
891
1465
  readonly attrs: {
892
1466
  readonly property: "og:url";
893
1467
  readonly content: "https://apps.powerhouse.io/powerhouse/connect/";
894
1468
  };
895
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1469
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
896
1470
  }, {
897
1471
  readonly tag: "meta";
898
1472
  readonly attrs: {
899
1473
  readonly property: "og:description";
900
1474
  readonly content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation.";
901
1475
  };
902
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1476
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
903
1477
  }, {
904
1478
  readonly tag: "meta";
905
1479
  readonly attrs: {
906
1480
  readonly property: "og:image";
907
1481
  readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
908
1482
  };
909
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1483
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
910
1484
  }, {
911
1485
  readonly tag: "meta";
912
1486
  readonly attrs: {
913
1487
  readonly name: "twitter:card";
914
1488
  readonly content: "summary_large_image";
915
1489
  };
916
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1490
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
917
1491
  }, {
918
1492
  readonly tag: "meta";
919
1493
  readonly attrs: {
920
1494
  readonly name: "twitter:image";
921
1495
  readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
922
1496
  };
923
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1497
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
924
1498
  }, {
925
1499
  readonly tag: "meta";
926
1500
  readonly attrs: {
927
1501
  readonly name: "twitter:title";
928
1502
  readonly content: "Connect";
929
1503
  };
930
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1504
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
931
1505
  }, {
932
1506
  readonly tag: "meta";
933
1507
  readonly attrs: {
934
1508
  readonly name: "twitter:description";
935
1509
  readonly content: "Navigate your organisation’s toughest operational challenges and steer your contributors to success with Connect. A navigation, collaboration and reporting tool for decentralised and open organisation.";
936
1510
  };
937
- readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
1511
+ readonly injectTo: "body" | "body-prepend" | "head" | "head-prepend";
938
1512
  }];
939
- declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
1513
+ export declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
940
1514
  //#endregion
941
1515
  //#region connect-utils/vite-plugins/dynamic-base.d.ts
942
- /**
943
- * Placeholder base used when Connect is built in dynamic-base mode. The Vite
944
- * `base` option is set to this token; this plugin rewrites it in the emitted
945
- * output so the effective base is resolved at serve time from a global instead
946
- * of being baked at build time.
947
- *
948
- * Trailing slash matches `normalizeBasePath` output, so the token sits in the
949
- * same syntactic position as a concrete base would.
950
- */
951
- declare const DYNAMIC_BASE_PLACEHOLDER = "/__PH_DYNAMIC_BASE__/";
1516
+ /** Rewrites `url(<placeholder>assets/x)` relative to the stylesheet at `fileName`. */
1517
+ export declare function relativeCssUrls(css: string, fileName: string): string;
952
1518
  /**
953
1519
  * Rewrites the placeholder base in emitted JS chunks to a runtime expression so
954
1520
  * one built `dist/connect` serves under any subpath. Rolldown-native: per-match
@@ -973,21 +1539,23 @@ declare const DYNAMIC_BASE_PLACEHOLDER = "/__PH_DYNAMIC_BASE__/";
973
1539
  * (the same proxy also sets the runtime global for the JS rewrite). See the
974
1540
  * plugin's module doc / report for the exact serve-time contract.
975
1541
  *
976
- * CSS `url(...)` references resolve relative to the stylesheet's own URL, so
977
- * they need no rewrite once the stylesheet itself is loaded from the right
978
- * prefix (which the HTML substitution handles).
1542
+ * CSS `url(...)` references that Vite emits with the placeholder (e.g. bundled
1543
+ * fonts) are rewritten relative to the stylesheet, which the HTML substitution
1544
+ * already loads from the right prefix.
979
1545
  */
980
- declare function connectDynamicBasePlugin(options?: {
1546
+ export declare function connectDynamicBasePlugin(options?: {
981
1547
  forWorker?: boolean;
982
1548
  workerStripPrefix?: string;
983
1549
  }): Plugin;
984
- declare function escapeForRegExp(s: string): string;
1550
+ export declare function escapeForRegExp(s: string): string;
985
1551
  //#endregion
986
1552
  //#region connect-utils/vite-plugins/ph-config.d.ts
987
- type PhConfigPluginOptions = {
1553
+ export type PhConfigPluginOptions = {
988
1554
  packages: PowerhousePackage[];
989
1555
  projectRoot?: string;
990
1556
  connect?: PHConnectRuntimeConfig;
1557
+ /** The source's top-level `workflows` block; `connect.app.workflowsEnabled` falls back to it. */
1558
+ workflows?: PowerhouseConfig$1["workflows"];
991
1559
  /**
992
1560
  * Project-wide package registry URL — the effective value (CLI override
993
1561
  * `??` source) the caller has already resolved. Copied verbatim into the
@@ -1002,7 +1570,17 @@ type PhConfigPluginOptions = {
1002
1570
  */
1003
1571
  cliConnectOverride?: PHConnectRuntimeConfig;
1004
1572
  };
1005
- declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin;
1573
+ /** `html` with its `<title>` text set to `appName`, when one is configured. */
1574
+ export declare function withAppTitle(html: string, appName: string | undefined): string;
1575
+ type PhConfigApi = {
1576
+ connect: PHConnectRuntimeConfig;
1577
+ favicon?: string;
1578
+ };
1579
+ /** `api.connect`: the connect config the app is served, for plugins that render
1580
+ * ahead of it; `api.favicon`: its `branding.favicon`, which it leaves out. */
1581
+ export declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin<PhConfigApi> & {
1582
+ api: PhConfigApi;
1583
+ };
1006
1584
  //#endregion
1007
1585
  //#region connect-utils/vite-plugins/theme-boot.d.ts
1008
1586
  /**
@@ -1010,13 +1588,21 @@ declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin;
1010
1588
  * ph-clint connect proxy) and this plugin both check it, so the script is
1011
1589
  * applied exactly once no matter which layer runs first.
1012
1590
  */
1013
- declare const THEME_BOOT_MARKER = "data-ph-theme-boot";
1591
+ export declare const THEME_BOOT_MARKER = "data-ph-theme-boot";
1014
1592
  /**
1015
1593
  * Injects the theme boot script at the top of `<head>` of every emitted
1016
1594
  * index.html, so built Connect apps render the stored theme from first paint
1017
1595
  * without depending on a serve-time injector.
1018
1596
  */
1019
- declare function connectThemeBootPlugin(): Plugin;
1597
+ export declare function connectThemeBootPlugin(): Plugin;
1598
+ //#endregion
1599
+ //#region connect-utils/vite-plugins/vendor-import-map.d.ts
1600
+ export type VendorImportMapOptions = {
1601
+ /** bare specifier -> URL (already base-prefixed by the caller). */
1602
+ imports: Record<string, string>;
1603
+ };
1604
+ export declare function vendorImportMapPlugin(options: VendorImportMapOptions): Plugin;
1020
1605
  //#endregion
1021
- export { BUILD_HASH_FILE, BuildHashInput, ConnectBuildOptions, ConnectCommonOptions, ConnectPreviewOptions, ConnectStudioOptions, DEFAULT_CONNECT_OUTDIR, DEFAULT_VENDOR_INCLUDE, DYNAMIC_BASE_PLACEHOLDER, EXTERNAL_PACKAGES_IMPORT, IConnectOptions, IMPORT_SCRIPT_FILE, LOCAL_PACKAGE_ID, PH_DIR_NAME, PhConfigPluginOptions, PrebuiltVendor, RUNTIME_CONFIG_SCHEMA_ID, RUNTIME_CONFIG_SCHEMA_URL, THEME_BOOT_MARKER, VENDOR_EXTERNAL, VENDOR_URL_PREFIX, VendorPrebuildOptions, ViteDevOptions, appendToHtmlHead, backupIndexHtml, buildHashFromBuildOptions, computeBuildHash, connectBuildHashPlugin, connectDynamicBasePlugin, connectThemeBootPlugin, copyConnect, ensureNodeVersion, escapeForRegExp, getConnectBaseViteConfig, getConnectHtmlTags, makeImportScriptFromPackages, phConfigPlugin, prebuildConnectVendor, prependToHtmlHead, readJsonFile, removeBase64EnvValues, resolveConnectBundle, resolveConnectPackageJson, resolveConnectPublicDir, resolvePackage, resolveViteConfigPath, runShellScriptPlugin, runTsc, runtimeConfigSchema, stripVersionFromPackage };
1606
+ export { DYNAMIC_BASE_PLACEHOLDER };
1607
+ export {};
1022
1608
  //# sourceMappingURL=index.d.mts.map