@powerhousedao/builder-tools 6.2.3-dev.10 → 6.2.3-dev.101
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 +629 -731
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3409 -775
- package/dist/index.mjs.map +1 -1
- package/dist/service-worker/service-worker.ts +29 -23
- package/dist/service-worker/virtual-sw-config.d.ts +3 -0
- package/package.json +15 -12
package/dist/index.d.mts
CHANGED
|
@@ -1,17 +1,66 @@
|
|
|
1
|
-
import { CommonServerOptions, HtmlTagDescriptor, InlineConfig, Plugin } from "vite";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { Alias, CommonServerOptions, ErrorPayload, HtmlTagDescriptor, InlineConfig, Plugin, PluginOption } from "vite";
|
|
2
|
+
import { AppShell, AppShellVariant, AppShells, ShellPlugins } from "@powerhousedao/shared/connect/app-shell";
|
|
3
|
+
import { GeneratorPlugin } from "@tanstack/router-generator";
|
|
4
|
+
import { DYNAMIC_BASE_PLACEHOLDER } from "@powerhousedao/shared/connect";
|
|
5
|
+
import { PHConnectBranding, PHConnectLoader, PHConnectRuntimeConfig, PowerhouseConfig } from "@powerhousedao/shared/clis";
|
|
6
|
+
import { PowerhouseConfig as PowerhouseConfig$1, PowerhousePackage } from "@powerhousedao/config";
|
|
7
|
+
export * from "@powerhousedao/shared/connect/app-shell";
|
|
5
8
|
//#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";
|
|
9
|
+
export declare const EXTERNAL_PACKAGES_IMPORT = "PH:EXTERNAL_PACKAGES";
|
|
10
|
+
export declare const IMPORT_SCRIPT_FILE = "external-packages.js";
|
|
11
|
+
export declare const LOCAL_PACKAGE_ID = "ph:local-package";
|
|
12
|
+
export declare const PH_DIR_NAME = ".ph";
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region connect-utils/vite-plugins/project-brand.d.ts
|
|
15
|
+
type ProjectAsset = {
|
|
16
|
+
/** Emitted next to index.html under this name. */
|
|
17
|
+
fileName: string;
|
|
18
|
+
/** Absolute source file. */
|
|
19
|
+
file: string;
|
|
20
|
+
contentType: string;
|
|
21
|
+
};
|
|
22
|
+
type ProjectLoader = ProjectAsset & {
|
|
23
|
+
animation: NonNullable<PHConnectLoader["animation"]>;
|
|
24
|
+
size: number;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region connect-utils/vite-plugins/app-shell.d.ts
|
|
28
|
+
/** The shell manifest of the installed Connect, if it ships one. */
|
|
29
|
+
export declare function readShellPlugins(projectRoot: string): ShellPlugins | undefined;
|
|
30
|
+
/** The shell Connect's build prerendered, if the installed Connect ships one. */
|
|
31
|
+
export declare function readAppShell(projectRoot: string, variant?: AppShellVariant): AppShell | undefined;
|
|
32
|
+
/** Every variant the installed Connect ships. */
|
|
33
|
+
export declare function readAppShells(projectRoot: string): AppShells;
|
|
34
|
+
export type ConnectAppShellOptions = {
|
|
35
|
+
/** The composition the app boots with; picks the variant. */
|
|
36
|
+
composition?: readonly {
|
|
37
|
+
module: string;
|
|
38
|
+
}[] | null;
|
|
39
|
+
/** The served `connect.branding.appName`. */
|
|
40
|
+
appName?: string;
|
|
41
|
+
/** With the project's routes: the aliases that point Connect at its tree. */
|
|
42
|
+
routeAliases?: Alias[];
|
|
43
|
+
/** The project's routes folder; dev renders the shell again when it changes. */
|
|
44
|
+
routesDir?: string;
|
|
45
|
+
/** The project's loading image, in place of the shell's logo. */
|
|
46
|
+
loader?: ProjectLoader;
|
|
47
|
+
/** The host's stylesheet, which the page's build adds to the project's. */
|
|
48
|
+
hostStylesheet?: string;
|
|
49
|
+
};
|
|
50
|
+
/** The prerender's error with each `(at <component> (<file>:<line>:<col>))` in
|
|
51
|
+
* its message mapped back to the source, as React reports the transformed code. */
|
|
52
|
+
export declare function withSourceLocations(error: unknown, rewrite: (stack: string) => string): unknown;
|
|
53
|
+
/** Vite's error overlay over the page, for a failure no module request reports. */
|
|
54
|
+
export declare function withErrorOverlay(html: string, err: ErrorPayload["err"], base: string): string;
|
|
55
|
+
/** Build: the composition's shell in #root and every variant in the dist, from
|
|
56
|
+
* the project's routes when it has them. Dev: the shell from the project's routes
|
|
57
|
+
* when it has them, else core's for a core composition. */
|
|
58
|
+
export declare function connectAppShellPlugin(projectRoot: string, { composition, appName, routeAliases, routesDir, loader, hostStylesheet }?: ConnectAppShellOptions): Plugin;
|
|
10
59
|
//#endregion
|
|
11
60
|
//#region connect-utils/vite-plugins/build-hash.d.ts
|
|
12
61
|
/** Name of the build-identity file emitted into the build output. */
|
|
13
|
-
declare const BUILD_HASH_FILE: "build-hash.json";
|
|
14
|
-
interface BuildHashInput {
|
|
62
|
+
export declare const BUILD_HASH_FILE: "build-hash.json";
|
|
63
|
+
export interface BuildHashInput {
|
|
15
64
|
/** Monorepo workspace git SHA (CI/dev builds); empty outside the monorepo. */
|
|
16
65
|
workspaceGitSha: string;
|
|
17
66
|
/** Monorepo workspace version (CI/dev builds); empty outside it. */
|
|
@@ -38,8 +87,8 @@ interface BuildHashInput {
|
|
|
38
87
|
* (define `PH_CONNECT_BUILD_HASH`) to `build-hash.json`, which the build
|
|
39
88
|
* emits alongside the app and the server must serve no-cache.
|
|
40
89
|
*/
|
|
41
|
-
declare function computeBuildHash(input: BuildHashInput): string;
|
|
42
|
-
declare function buildHashFromBuildOptions(options: {
|
|
90
|
+
export declare function computeBuildHash(input: BuildHashInput): string;
|
|
91
|
+
export declare function buildHashFromBuildOptions(options: {
|
|
43
92
|
dirname: string;
|
|
44
93
|
phConfig: unknown;
|
|
45
94
|
packages: ReadonlyArray<{
|
|
@@ -57,13 +106,191 @@ declare function buildHashFromBuildOptions(options: {
|
|
|
57
106
|
* Build-only: dev (studio) never runs generateBundle, and the SPA check
|
|
58
107
|
* treats a missing file as "nothing to compare" and stays silent.
|
|
59
108
|
*/
|
|
60
|
-
declare function connectBuildHashPlugin(buildHash: string): Plugin;
|
|
109
|
+
export declare function connectBuildHashPlugin(buildHash: string): Plugin;
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region connect-utils/vite-plugins/connect-routes.d.ts
|
|
112
|
+
/** A project's routes for its Connect deployment, beside Connect's own. */
|
|
113
|
+
export declare const HOST_ROUTES_DIR = "hosts/connect/routes";
|
|
114
|
+
/** The generated tree of Connect's and the project's routes. */
|
|
115
|
+
export declare const CONNECT_ROUTES_GEN = ".ph/connect-routes.gen.ts";
|
|
116
|
+
/** Connect's dist imports its route tree by this specifier. */
|
|
117
|
+
export declare const ROUTE_TREE_SPECIFIER = "@powerhousedao/connect/route-tree";
|
|
118
|
+
/** Core's types name the app's tree by this one; both resolve to one tree. */
|
|
119
|
+
export declare const CORE_ROUTE_TREE_SPECIFIER = "@powerhousedao/connect-core/route-tree";
|
|
120
|
+
/** A host's routes folder: `routes` (a host's `runner.routes`), relative to the
|
|
121
|
+
* project, else `hosts/connect/routes/`; undefined if none or `false`. */
|
|
122
|
+
export declare function resolveConnectRoutesDir(projectRoot: string, routes?: string | false): string | undefined;
|
|
123
|
+
/** The tree generated from `routesDir`: `.ph/connect-routes.gen.ts` for
|
|
124
|
+
* `hosts/connect/routes/`, else `.ph/<folder>.gen.ts`. */
|
|
125
|
+
export declare function connectRoutesTreeOf(projectRoot: string, routesDir: string): string;
|
|
126
|
+
/** The dev watcher's filter for `.ph/`, which holds build output: ignored but
|
|
127
|
+
* for the host's route tree, rewritten as route files come and go. */
|
|
128
|
+
export declare function ignoreDotPhButRouteTree(projectRoot: string, routesDir?: string | false): (file: string) => boolean;
|
|
129
|
+
/**
|
|
130
|
+
* The dev watcher's filter for the project's build output: its own `dist/`
|
|
131
|
+
* and a Tauri shell's Rust `target/`. Nothing the dev server serves lives
|
|
132
|
+
* there, and on Windows every watched file costs a synchronous `fs.watch`
|
|
133
|
+
* at startup (over a minute for a built project with a built desktop shell).
|
|
134
|
+
*/
|
|
135
|
+
export declare function ignoreBuildOutput(projectRoot: string): (file: string) => boolean;
|
|
136
|
+
/** Connect's pathless sidebar layout; a project's routes in `_app/` render in it. */
|
|
137
|
+
export declare const APP_LAYOUT = "_app";
|
|
138
|
+
/** Whether the project's `_app` replaces Connect's layout (and its chrome). */
|
|
139
|
+
export declare function hasProjectAppLayout(routesDir: string | undefined): boolean;
|
|
140
|
+
export type ConnectRoutes = {
|
|
141
|
+
/** Points Connect at the tree to route with, then at what its route files render. */
|
|
142
|
+
aliases: Alias[];
|
|
143
|
+
/** The router plugin, only when the project has routes. */
|
|
144
|
+
plugins: PluginOption[];
|
|
145
|
+
/** Connect's route files and the project's share one router. */
|
|
146
|
+
dedupe: string[];
|
|
147
|
+
/** Pre-bundled for Connect's route files; see connectRouteFileDeps. */
|
|
148
|
+
include: string[];
|
|
149
|
+
};
|
|
150
|
+
/** Connect's route files: core's routes with Connect's views. */
|
|
151
|
+
export declare function connectRoutesDirOf(connectDir: string): string;
|
|
152
|
+
/** A route file's id below its folder: route groups and `route` files
|
|
153
|
+
* resolved, flat `a.b` names read as folders. */
|
|
154
|
+
export declare function routeIdOf(file: string): string;
|
|
155
|
+
/** Connect's `_app/` route files that a project file at the same id replaces. */
|
|
156
|
+
export declare function overriddenConnectRoutes(connectAppDir: string, projectAppDir: string): Set<string>;
|
|
157
|
+
/** The routes a package offers other Connects, as `ph build` publishes them
|
|
158
|
+
* (`./connect-routes`); generated beside the route tree. */
|
|
159
|
+
export declare const PACKAGE_ROUTES_MODULE = ".ph/connect-routes.package.ts";
|
|
160
|
+
/** The router plugin's config: Connect's root and routes, and the project's. */
|
|
161
|
+
export declare function connectRoutesGeneratorConfig(connectDir: string, projectRoot: string, projectRoutes: string): {
|
|
162
|
+
target: "react" | "solid" | "vue";
|
|
163
|
+
virtualRouteConfig?: string | import("@tanstack/virtual-file-routes").VirtualRootRoute | undefined;
|
|
164
|
+
routeFilePrefix?: string | undefined;
|
|
165
|
+
routeFileIgnorePrefix: string;
|
|
166
|
+
routeFileIgnorePattern?: string | undefined;
|
|
167
|
+
routesDirectory: string;
|
|
168
|
+
quoteStyle: "double" | "single";
|
|
169
|
+
semicolons: boolean;
|
|
170
|
+
disableLogging: boolean;
|
|
171
|
+
routeTreeFileHeader: string[];
|
|
172
|
+
indexToken: string | RegExp | {
|
|
173
|
+
regex: string;
|
|
174
|
+
flags?: string | undefined;
|
|
175
|
+
};
|
|
176
|
+
routeToken: string | RegExp | {
|
|
177
|
+
regex: string;
|
|
178
|
+
flags?: string | undefined;
|
|
179
|
+
};
|
|
180
|
+
pathParamsAllowedCharacters?: ("$" | "&" | "+" | "," | ":" | ";" | "=" | "@")[] | undefined;
|
|
181
|
+
generatedRouteTree: string;
|
|
182
|
+
disableTypes: boolean;
|
|
183
|
+
addExtensions: string | boolean;
|
|
184
|
+
enableRouteTreeFormatting: boolean;
|
|
185
|
+
routeTreeFileFooter?: string[] | (() => Array<string>) | undefined;
|
|
186
|
+
autoCodeSplitting?: boolean | undefined;
|
|
187
|
+
customScaffolding?: {
|
|
188
|
+
routeTemplate?: string | undefined;
|
|
189
|
+
lazyRouteTemplate?: string | undefined;
|
|
190
|
+
} | undefined;
|
|
191
|
+
experimental?: {
|
|
192
|
+
enableCodeSplitting?: boolean | undefined;
|
|
193
|
+
} | undefined;
|
|
194
|
+
plugins?: GeneratorPlugin[] | undefined;
|
|
195
|
+
tmpDir: string;
|
|
196
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
197
|
+
};
|
|
198
|
+
/** Writes the route tree of Connect's and the project's routes; throws on a
|
|
199
|
+
* collision that is not an override, which the router plugin would only log. */
|
|
200
|
+
export declare function generateConnectRoutes(projectRoot: string, routesDir: string, config?: {
|
|
201
|
+
target: "react" | "solid" | "vue";
|
|
202
|
+
virtualRouteConfig?: string | import("@tanstack/virtual-file-routes").VirtualRootRoute | undefined;
|
|
203
|
+
routeFilePrefix?: string | undefined;
|
|
204
|
+
routeFileIgnorePrefix: string;
|
|
205
|
+
routeFileIgnorePattern?: string | undefined;
|
|
206
|
+
routesDirectory: string;
|
|
207
|
+
quoteStyle: "double" | "single";
|
|
208
|
+
semicolons: boolean;
|
|
209
|
+
disableLogging: boolean;
|
|
210
|
+
routeTreeFileHeader: string[];
|
|
211
|
+
indexToken: string | RegExp | {
|
|
212
|
+
regex: string;
|
|
213
|
+
flags?: string | undefined;
|
|
214
|
+
};
|
|
215
|
+
routeToken: string | RegExp | {
|
|
216
|
+
regex: string;
|
|
217
|
+
flags?: string | undefined;
|
|
218
|
+
};
|
|
219
|
+
pathParamsAllowedCharacters?: ("$" | "&" | "+" | "," | ":" | ";" | "=" | "@")[] | undefined;
|
|
220
|
+
generatedRouteTree: string;
|
|
221
|
+
disableTypes: boolean;
|
|
222
|
+
addExtensions: string | boolean;
|
|
223
|
+
enableRouteTreeFormatting: boolean;
|
|
224
|
+
routeTreeFileFooter?: string[] | (() => Array<string>) | undefined;
|
|
225
|
+
autoCodeSplitting?: boolean | undefined;
|
|
226
|
+
customScaffolding?: {
|
|
227
|
+
routeTemplate?: string | undefined;
|
|
228
|
+
lazyRouteTemplate?: string | undefined;
|
|
229
|
+
} | undefined;
|
|
230
|
+
experimental?: {
|
|
231
|
+
enableCodeSplitting?: boolean | undefined;
|
|
232
|
+
} | undefined;
|
|
233
|
+
plugins?: GeneratorPlugin[] | undefined;
|
|
234
|
+
tmpDir: string;
|
|
235
|
+
importRoutesUsingAbsolutePaths: boolean;
|
|
236
|
+
}, warn?: (message: string) => void): Promise<void>;
|
|
237
|
+
/** Connect's route files, as the generated tree imports them: by Connect's
|
|
238
|
+
* package name, which a project depends on. */
|
|
239
|
+
export declare const CONNECT_ROUTES_SPECIFIER = "@powerhousedao/connect/routes";
|
|
240
|
+
/** Generates the tree when the project has routes. Without them, a tree there
|
|
241
|
+
* is rewritten with Connect's routes only, never removed: Studio routes
|
|
242
|
+
* through it, and a removed folder's routes leave it, as tsc needs. */
|
|
243
|
+
export declare function syncConnectRoutes(projectRoot: string, routesDir?: string | undefined): Promise<void>;
|
|
244
|
+
/** What Connect's route files import, besides each other. */
|
|
245
|
+
export declare const CONNECT_ROUTE_FILE_DEPS: string[];
|
|
246
|
+
/**
|
|
247
|
+
* The `optimizeDeps.include` entries an installed Connect's route files need.
|
|
248
|
+
*
|
|
249
|
+
* Connect and core ship their route files as `.tsx`, which Vite never
|
|
250
|
+
* pre-bundles, so the dev server serves them as they are. Vite also discovers
|
|
251
|
+
* no dependency for a module inside node_modules, so their bare imports load
|
|
252
|
+
* unbundled too, and the CommonJS packages under the router
|
|
253
|
+
* (use-sync-external-store, safe-stable-stringify) then fail in the browser.
|
|
254
|
+
* Pre-bundling these by Connect's name gives the route files the copies they
|
|
255
|
+
* resolve to; core need not be resolvable from the project. A Connect outside
|
|
256
|
+
* node_modules (the monorepo, a linked checkout) is source to Vite, so its
|
|
257
|
+
* imports are discovered and pre-bundled anyway.
|
|
258
|
+
*/
|
|
259
|
+
export declare function connectRouteFileDeps(connectDir: string): string[];
|
|
260
|
+
/** Mounts a project's routes folder over Connect's routes; without one,
|
|
261
|
+
* Connect keeps its prebuilt tree and no router plugin runs. Dev may pass a
|
|
262
|
+
* folder that does not exist yet: it is mounted once it does. */
|
|
263
|
+
export declare function connectRoutes(projectRoot: string, routesDir?: string | false | undefined): ConnectRoutes;
|
|
264
|
+
/** Dev: rewrites the tree as files and folders under the routes folder come and
|
|
265
|
+
* go, the folder itself included; the router plugin follows the tree. */
|
|
266
|
+
export declare function connectRoutesWatcher(projectRoot: string, routesDir: string, config: ReturnType<typeof connectRoutesGeneratorConfig>): Plugin;
|
|
267
|
+
/** One chunk for the router and the project's route configs, which the split
|
|
268
|
+
* route components would otherwise spread over several shared chunks. */
|
|
269
|
+
export declare function connectRouterChunkGroups(routesDir?: string | false): ({
|
|
270
|
+
name: string;
|
|
271
|
+
test: RegExp;
|
|
272
|
+
priority: number;
|
|
273
|
+
} | {
|
|
274
|
+
priority?: undefined;
|
|
275
|
+
name: string;
|
|
276
|
+
test: (id: string) => boolean;
|
|
277
|
+
})[];
|
|
278
|
+
//#endregion
|
|
279
|
+
//#region connect-utils/vite-plugins/host-stylesheet.d.ts
|
|
280
|
+
/** The host's stylesheet, which may not exist yet: `style.css` beside its routes
|
|
281
|
+
* folder, so `hosts/connect/style.css` by default. `ph build` never reads it. */
|
|
282
|
+
export declare function hostStylesheetPath(projectRoot: string, routesDir?: string | false): string;
|
|
283
|
+
/** The project's `style.css` with the host's stylesheet imported last when it
|
|
284
|
+
* exists (else `missing`), so the host's theme wins in the page's one build. */
|
|
285
|
+
export declare function withHostStylesheet(css: string, stylesheet: string, hostStylesheet: string | undefined, missing?: string): string;
|
|
286
|
+
/** Serves the project's `style.css` with the host's stylesheet in it. */
|
|
287
|
+
export declare function hostStylesheetPlugin(projectRoot: string, hostStylesheet: string): Plugin;
|
|
61
288
|
//#endregion
|
|
62
289
|
//#region connect-utils/externalize-vendor.d.ts
|
|
63
|
-
interface VendorPrebuildOptions {
|
|
64
|
-
/** Project root
|
|
290
|
+
export interface VendorPrebuildOptions {
|
|
291
|
+
/** Project root the vendor deps resolve from. */
|
|
65
292
|
dirname: string;
|
|
66
|
-
/**
|
|
293
|
+
/** Specifiers to prebuild into the vendor (defaults to the dev set). */
|
|
67
294
|
include?: string[];
|
|
68
295
|
/** Specifiers left external to the build (defaults to the React family). */
|
|
69
296
|
external?: string[];
|
|
@@ -73,39 +300,328 @@ interface VendorPrebuildOptions {
|
|
|
73
300
|
errorRef?: {
|
|
74
301
|
message?: string;
|
|
75
302
|
};
|
|
303
|
+
/**
|
|
304
|
+
* The APP's base — the same string the app build uses (the dynamic-base
|
|
305
|
+
* placeholder, or a normalized deploy base like "/app/"). The vendor's own
|
|
306
|
+
* build base is this plus the vendor segment, so emitted asset URLs land
|
|
307
|
+
* under <app-base>__vendor__/. Default: the dynamic placeholder (dev
|
|
308
|
+
* behavior; the segment is still appended once by the build worker).
|
|
309
|
+
* Import-map values stay base-relative; the production
|
|
310
|
+
* build strips the leading slash (values then resolve against the page URL
|
|
311
|
+
* under any deploy base), the dev flow prefixes its own base.
|
|
312
|
+
*/
|
|
313
|
+
base?: string;
|
|
314
|
+
/** NODE_ENV define for the vendor build (default "development"). */
|
|
315
|
+
nodeEnv?: "development" | "production";
|
|
316
|
+
/** The app's own deps the vendored packages also bundle: vendored as listed,
|
|
317
|
+
* resolved from `from` (projects don't install them). */
|
|
318
|
+
ownDeps?: {
|
|
319
|
+
specs: string[];
|
|
320
|
+
from: string;
|
|
321
|
+
};
|
|
76
322
|
}
|
|
77
323
|
/**
|
|
78
324
|
* The stable Connect libraries worth prebuilding. The React family is NOT here —
|
|
79
325
|
* it's externalized from the build (see `VENDOR_EXTERNAL`) so the vendor shares
|
|
80
326
|
* the dev server's single React instance via the import map.
|
|
81
327
|
*/
|
|
82
|
-
declare const DEFAULT_VENDOR_INCLUDE: string[];
|
|
328
|
+
export declare const DEFAULT_VENDOR_INCLUDE: string[];
|
|
329
|
+
/** Never vendored: the route tree is the project's, the config path the app's
|
|
330
|
+
* base, and SSR server-only. */
|
|
331
|
+
export declare const VENDOR_SKIP_SUBPATHS: Set<string>;
|
|
83
332
|
/**
|
|
84
333
|
* React-family specifiers kept external to the vendor build. The vendor's chunks
|
|
85
334
|
* emit bare imports for these; `devReactImportmapPlugin`'s import map resolves
|
|
86
335
|
* them to Vite's pre-bundled React, so there is exactly one React instance.
|
|
87
336
|
*/
|
|
88
|
-
declare const VENDOR_EXTERNAL: string[];
|
|
89
|
-
interface PrebuiltVendor {
|
|
337
|
+
export declare const VENDOR_EXTERNAL: string[];
|
|
338
|
+
export interface PrebuiltVendor {
|
|
90
339
|
vendorDir: string;
|
|
91
|
-
/** import map: bare specifier -> "/__vendor__/<entry>.js". */
|
|
340
|
+
/** import map: bare specifier -> "/__vendor__/<entry>-<hash>.js" (base-relative). */
|
|
92
341
|
imports: Record<string, string>;
|
|
342
|
+
/** Resolved versions of every included + external package. */
|
|
343
|
+
versions: Record<string, string>;
|
|
344
|
+
/** Content-hashed shared-deps module ("/__vendor__/shared-deps-<hash>.js", base-relative). */
|
|
345
|
+
sharedDeps: string;
|
|
93
346
|
}
|
|
94
347
|
/** URL prefix the vendor bundle is served under by the dev middleware. */
|
|
95
|
-
declare const VENDOR_URL_PREFIX = "/__vendor__/";
|
|
348
|
+
export declare const VENDOR_URL_PREFIX = "/__vendor__/";
|
|
96
349
|
/**
|
|
97
350
|
* Build the prebuilt vendor (once, in a throwaway subprocess) and return its dir
|
|
98
351
|
* + import map. Idempotent: reuses a cached vendor built for the same dep set.
|
|
99
352
|
* Returns null on any failure (caller falls back to a normal dev server).
|
|
100
353
|
*/
|
|
101
|
-
declare function prebuildConnectVendor(options: VendorPrebuildOptions): Promise<PrebuiltVendor | null>;
|
|
354
|
+
export declare function prebuildConnectVendor(options: VendorPrebuildOptions): Promise<PrebuiltVendor | null>;
|
|
355
|
+
export declare function linkedBuildStamp(pkgRoot: string): string;
|
|
356
|
+
export declare function resolveVersionDigest(versions: Record<string, string>, own: Record<string, string>, stamps: Map<string, string>, build: {
|
|
357
|
+
base: string;
|
|
358
|
+
nodeEnv: string;
|
|
359
|
+
}): string;
|
|
360
|
+
export declare const LOCK_STALE_MS: number;
|
|
361
|
+
export interface VendorLock {
|
|
362
|
+
dir: string;
|
|
363
|
+
token: string;
|
|
364
|
+
timer: ReturnType<typeof setInterval>;
|
|
365
|
+
}
|
|
366
|
+
export declare function acquireLock(lockDir: string): VendorLock | null;
|
|
367
|
+
export declare function releaseLock(lock: VendorLock): void;
|
|
368
|
+
/** The package root at or above `from` that Node would load `pkg` from, or null. */
|
|
369
|
+
export declare function findPackageRoot(from: string, pkg: string): string | null;
|
|
370
|
+
/** Each spec's browser/import entry file when resolved from `from`; unresolvable specs are left out. */
|
|
371
|
+
export declare function resolveOwnDeps(from: string, specs: string[]): Record<string, string>;
|
|
372
|
+
/**
|
|
373
|
+
* The published specifiers whose entry file the vendor build never emitted.
|
|
374
|
+
* URLs are base-less (`/__vendor__/x.js`) and resolve inside `vendorDir`.
|
|
375
|
+
*/
|
|
376
|
+
export declare function missingVendorEntries(vendorDir: string, imports: Record<string, string>): {
|
|
377
|
+
spec: string;
|
|
378
|
+
url: string;
|
|
379
|
+
}[];
|
|
380
|
+
/**
|
|
381
|
+
* Rebase the vendor's base-less entry URLs (`/__vendor__/x.js`) onto the
|
|
382
|
+
* deploy base, so a consumer that resolves them against the page origin lands
|
|
383
|
+
* under that base rather than the server root. A dynamic-base build keeps its
|
|
384
|
+
* placeholder, which the runtime substitutes.
|
|
385
|
+
*
|
|
386
|
+
* `base` is the app base from `prebuildConnectVendor` callers; a base that
|
|
387
|
+
* already carries the vendor segment has it dropped first so it is never
|
|
388
|
+
* doubled.
|
|
389
|
+
*/
|
|
390
|
+
export declare function withVendorBase(imports: Record<string, string>, base: string): Record<string, string>;
|
|
391
|
+
//#endregion
|
|
392
|
+
//#region connect-utils/reactor-worker-build.d.ts
|
|
393
|
+
/** URL prefix the worker bundle is served under, next to `__vendor__/`. */
|
|
394
|
+
export declare const REACTOR_WORKER_URL_PREFIX = "/__reactor_worker__/";
|
|
395
|
+
/** Entry filename of the bundle; the tab constructs its SharedWorker from it. */
|
|
396
|
+
export declare const REACTOR_WORKER_ENTRY = "reactor.worker.js";
|
|
397
|
+
/** Content-Type for the extensions the worker build emits; JS is the default. */
|
|
398
|
+
export declare const REACTOR_WORKER_MIME: Record<string, string>;
|
|
399
|
+
export interface ReactorWorkerVendorOptions {
|
|
400
|
+
/** The vendor's import map (`spec -> /__vendor__/<entry>.js`). */
|
|
401
|
+
imports: Record<string, string>;
|
|
402
|
+
/** The built vendor dir, needed to verify which entries are worker-safe. */
|
|
403
|
+
dir: string;
|
|
404
|
+
}
|
|
405
|
+
export interface ReactorWorkerBuildOptions {
|
|
406
|
+
/** Project root the worker's dependencies resolve from. */
|
|
407
|
+
dirname: string;
|
|
408
|
+
/** Directory to hold the bundle (e.g. `<dist>/__reactor_worker__`). */
|
|
409
|
+
outDir: string;
|
|
410
|
+
/**
|
|
411
|
+
* The prebuilt vendor to share dependencies with. Only the worker-safe
|
|
412
|
+
* subset of its entries is externalized (see
|
|
413
|
+
* {@link workerSafeVendorImports}); omit to bundle everything.
|
|
414
|
+
*/
|
|
415
|
+
vendor?: ReactorWorkerVendorOptions;
|
|
416
|
+
/**
|
|
417
|
+
* Worker entry to build. Defaults to the installed Connect dist's
|
|
418
|
+
* `reactor.worker.js`; tests inject a fixture entry here.
|
|
419
|
+
*/
|
|
420
|
+
entryPath?: string;
|
|
421
|
+
/** NODE_ENV define for the build (default "development"). */
|
|
422
|
+
nodeEnv?: "development" | "production";
|
|
423
|
+
/** Filled with the failure cause when the prebuild returns null. */
|
|
424
|
+
errorRef?: {
|
|
425
|
+
message?: string;
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
export interface PrebuiltReactorWorker {
|
|
429
|
+
outDir: string;
|
|
430
|
+
/** Entry filename inside outDir ({@link REACTOR_WORKER_ENTRY}). */
|
|
431
|
+
entry: string;
|
|
432
|
+
/**
|
|
433
|
+
* Digest of everything that shaped this bundle's output (see
|
|
434
|
+
* {@link computeSourceDigest}); identical for a cache hit and a fresh
|
|
435
|
+
* build. The dev plugin serves it in `worker-meta.json` next to the
|
|
436
|
+
* bundle; `apps/connect/src/utils/reactor-worker-url.ts` fetches it to
|
|
437
|
+
* fold the actual built worker code into the tab's version fingerprint
|
|
438
|
+
* (W0.6).
|
|
439
|
+
*/
|
|
440
|
+
sourceDigest: string;
|
|
441
|
+
/**
|
|
442
|
+
* The worker-safe vendor subset this bundle externalizes (see
|
|
443
|
+
* {@link workerSafeVendorImports}); empty without a vendor.
|
|
444
|
+
*/
|
|
445
|
+
vendorImports: Record<string, string>;
|
|
446
|
+
}
|
|
447
|
+
/**
|
|
448
|
+
* The installed Connect dist's worker entry, or null when the installed
|
|
449
|
+
* version predates the worker (the feature is then unavailable, not broken).
|
|
450
|
+
*/
|
|
451
|
+
export declare function resolveReactorWorkerSource(dirname: string): string | null;
|
|
452
|
+
/** `/__vendor__/<entry>.js` -> `../__vendor__/<entry>.js` (sibling dirs). */
|
|
453
|
+
export declare function vendorRelativePath(vendorUrl: string): string;
|
|
454
|
+
/**
|
|
455
|
+
* Module specifiers a worker cannot resolve: anything that is not relative,
|
|
456
|
+
* root-relative, or an http(s)/data/blob URL. Used as a post-build guard so a
|
|
457
|
+
* leftover bare (or `node:`) import fails the build with a name instead of
|
|
458
|
+
* shipping a worker that dies on its first import statement.
|
|
459
|
+
*/
|
|
460
|
+
export declare function findDisallowedSpecifiers(code: string): string[];
|
|
461
|
+
/**
|
|
462
|
+
* Packages whose BUILT dist shapes the worker bundle's output even when
|
|
463
|
+
* connect's own dist/reactor.worker.js entry file did not change.
|
|
464
|
+
*
|
|
465
|
+
* That entry is a library artifact whose bare imports this build resolves
|
|
466
|
+
* through node_modules at BUILD time, so a rebuilt dist anywhere in its
|
|
467
|
+
* closure changes the bundle output without touching the entry file's own
|
|
468
|
+
* size/mtime. The list is DERIVED from the installed Connect's own
|
|
469
|
+
* dependencies rather than hardcoded: the bundle pulls `@renown/sdk`,
|
|
470
|
+
* `@powerhousedao/powerhouse-vetra-packages` and `@powerhousedao/shared` out
|
|
471
|
+
* of node_modules too, and a hardcoded pair left every one of those able to be
|
|
472
|
+
* rebuilt behind a cache hit. Connect's dependency list is the cheap stand-in
|
|
473
|
+
* for the resolved bundle graph: every workspace package the worker can reach
|
|
474
|
+
* is reachable through it, and a package not in the bundle only costs a readdir.
|
|
475
|
+
*/
|
|
476
|
+
export declare function upstreamWorkerPackages(dirname: string): string[];
|
|
477
|
+
/**
|
|
478
|
+
* This module's own installed version, read by walking up from its file to
|
|
479
|
+
* the nearest `package.json` named "@powerhousedao/builder-tools" (same
|
|
480
|
+
* technique as `build-hash.ts`'s `readConnectVersion`: builder-tools'
|
|
481
|
+
* `exports` map has no `./package.json` subpath, so node resolution can't
|
|
482
|
+
* get there). Works whether this runs from source (tests, this monorepo) or
|
|
483
|
+
* the built dist.
|
|
484
|
+
*/
|
|
485
|
+
export declare function resolveOwnPackageVersion(): string;
|
|
486
|
+
/**
|
|
487
|
+
* This package's own version, computed once. Folded into the worker bundle
|
|
488
|
+
* cache key so a builder-tools release — which can change how the bundle is
|
|
489
|
+
* built (anything in this module beyond {@link WORKER_BUILD_WORKER} itself,
|
|
490
|
+
* e.g. `workerSafeVendorImports`, the resolve plugin) — invalidates bundles
|
|
491
|
+
* a prior builder-tools version cached.
|
|
492
|
+
*/
|
|
493
|
+
export declare const BUILDER_TOOLS_VERSION: string;
|
|
494
|
+
/**
|
|
495
|
+
* A workspace package's real directory, resolved the way Node's resolver
|
|
496
|
+
* would (through `node_modules`), or null when it is not installed (e.g. a
|
|
497
|
+
* non-monorepo consumer project — graceful, not an error). pnpm's
|
|
498
|
+
* node_modules symlinks resolve to the real package directory, so this
|
|
499
|
+
* reflects the monorepo's actual dist state, not a stale symlink target.
|
|
500
|
+
*/
|
|
501
|
+
export declare function resolveWorkspacePackageDir(dirname: string, pkgName: string): string | null;
|
|
502
|
+
/**
|
|
503
|
+
* Cheap content fingerprint of a directory's immediate files: no file bytes
|
|
504
|
+
* are read, just each entry's name/size/mtime, so it stays fast even for a
|
|
505
|
+
* large dist. Sensitive to a rebuild in the common cases: Vite's
|
|
506
|
+
* content-hashed chunk filenames change the name itself; a stable-named file
|
|
507
|
+
* (an entry point) changes size or mtime. Bounded (`maxFiles`) so a
|
|
508
|
+
* pathological directory cannot make this slow — deliberately not a
|
|
509
|
+
* full-tree hash.
|
|
510
|
+
*
|
|
511
|
+
* The names are sorted BEFORE the bound is applied, so the subset the bound
|
|
512
|
+
* keeps is the same subset on every run: readdir order is unspecified, and
|
|
513
|
+
* truncating it first made the fingerprint of a directory past the bound a
|
|
514
|
+
* function of whatever order the filesystem happened to report.
|
|
515
|
+
*/
|
|
516
|
+
export declare function distDirFingerprint(dir: string, maxFiles?: number): string;
|
|
517
|
+
export declare function computeSourceDigest(dirname: string, entryPath: string, vendorDir?: string, builderToolsVersion?: string): string;
|
|
518
|
+
/** Content digest of a directory tree (relative paths + bytes; source maps skipped). */
|
|
519
|
+
export declare function directoryContentDigest(dir: string): string;
|
|
520
|
+
/**
|
|
521
|
+
* Build the worker bundle (once, in a throwaway subprocess) into `outDir`.
|
|
522
|
+
* Idempotent: reuses a cached bundle built from the same connect dist, vendor
|
|
523
|
+
* mapping, and builder logic. Returns null on failure (`errorRef` carries the
|
|
524
|
+
* cause) or when the installed Connect has no worker entry.
|
|
525
|
+
*/
|
|
526
|
+
export declare function prebuildReactorWorker(options: ReactorWorkerBuildOptions): Promise<PrebuiltReactorWorker | null>;
|
|
527
|
+
/** Replace `outDir` with the finished `tmpDir`, old contents removed last. */
|
|
528
|
+
export declare function publishDirAtomic(tmpDir: string, outDir: string): void;
|
|
529
|
+
/**
|
|
530
|
+
* Scan the emitted JS files REACHABLE from the entry via import statements
|
|
531
|
+
* for specifiers a worker cannot resolve. Vendor externals were rewritten to
|
|
532
|
+
* ../__vendor__/ relative paths, so anything bare that survives in the graph
|
|
533
|
+
* is a real defect.
|
|
534
|
+
*
|
|
535
|
+
* Deliberately a graph walk, not a directory walk: the bundled reactor code
|
|
536
|
+
* carries `new URL(..., import.meta.url)` references to its node
|
|
537
|
+
* worker-thread entries (executor/projection workers), which Vite emits as
|
|
538
|
+
* stray assets full of node-only imports. They are unreachable dead weight in
|
|
539
|
+
* a browser bundle — the production vendor output tolerates the same files —
|
|
540
|
+
* and must not fail the build.
|
|
541
|
+
*/
|
|
542
|
+
export declare function findBundleSpecifierOffenders(bundleDir: string, entry?: string): {
|
|
543
|
+
file: string;
|
|
544
|
+
specs: string[];
|
|
545
|
+
}[];
|
|
546
|
+
/** The page-only markers present in `code`, in a fixed order. */
|
|
547
|
+
export declare function findWorkerUnsafeMarkers(code: string): string[];
|
|
548
|
+
/**
|
|
549
|
+
* The subset of the vendor's entries a worker may import.
|
|
550
|
+
*
|
|
551
|
+
* The vendor build keeps the React family external: its chunks carry bare
|
|
552
|
+
* `import "react"` statements that the PAGE resolves through its import map.
|
|
553
|
+
* A worker resolves no import map, so externalizing a vendor spec whose chunk
|
|
554
|
+
* closure reaches such an import would kill the worker on its first load —
|
|
555
|
+
* and the chunk graph is shared across vendor entries, so even a React-free
|
|
556
|
+
* module (e.g. an rpc subpath) can be entangled with React through a shared
|
|
557
|
+
* chunk. The vendor is also built for the page: a dynamic-base build rewrites
|
|
558
|
+
* its asset URLs onto a global only the page sets, and its dynamic imports go
|
|
559
|
+
* through Vite's preload helper, which needs `document`. Each entry's own
|
|
560
|
+
* closure inside the vendor dir decides: clean closure, worker-safe; anything
|
|
561
|
+
* bare or page-only in it (see {@link findWorkerUnsafeMarkers}), or a missing
|
|
562
|
+
* entry file, bundled into the worker instead.
|
|
563
|
+
*/
|
|
564
|
+
export declare function workerSafeVendorImports(vendorDir: string, vendorImports: Record<string, string>): Record<string, string>;
|
|
565
|
+
/**
|
|
566
|
+
* Builds arbitrary worker-loadable entries with the worker build config.
|
|
567
|
+
* Exported for the local-package bundles, which need the same self-contained
|
|
568
|
+
* output and vendor externalization at a different depth.
|
|
569
|
+
*/
|
|
570
|
+
export declare function runWorkerBuildEntries(dirname: string, outDir: string, entries: Record<string, string>, vendorImports: Record<string, string>, nodeEnv: "development" | "production", vendorPrefix?: string): Promise<{
|
|
571
|
+
ok: boolean;
|
|
572
|
+
stderr: string;
|
|
573
|
+
}>;
|
|
574
|
+
//#endregion
|
|
575
|
+
//#region connect-utils/worker-packages-build.d.ts
|
|
576
|
+
/** Served under `<base>__reactor_worker__/packages/`. */
|
|
577
|
+
export declare const WORKER_PACKAGES_MANIFEST = "manifest.json";
|
|
578
|
+
export interface WorkerPackagesBuildOptions {
|
|
579
|
+
/** Project root the packages resolve from. */
|
|
580
|
+
dirname: string;
|
|
581
|
+
/** Local package names (`provider: "local"` in powerhouse.config.json). */
|
|
582
|
+
packages: string[];
|
|
583
|
+
/** Directory to hold the bundles (`<dist>/__reactor_worker__/packages`). */
|
|
584
|
+
outDir: string;
|
|
585
|
+
/** The prebuilt vendor to share dependencies with, when one was built. */
|
|
586
|
+
vendor?: ReactorWorkerVendorOptions;
|
|
587
|
+
/**
|
|
588
|
+
* The vendor's worker-safe subset, when the caller already computed it
|
|
589
|
+
* (`PrebuiltReactorWorker.vendorImports`); skips walking the vendor again.
|
|
590
|
+
*/
|
|
591
|
+
safeVendorImports?: Record<string, string>;
|
|
592
|
+
nodeEnv?: "development" | "production";
|
|
593
|
+
errorRef?: {
|
|
594
|
+
message?: string;
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
export interface WorkerPackageManifestEntry {
|
|
598
|
+
name: string;
|
|
599
|
+
version?: string;
|
|
600
|
+
/** Filename inside outDir, as {@link workerPackageFileName} spells it. */
|
|
601
|
+
file: string;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* The project's own package name when it ships a models bundle, so a caller
|
|
605
|
+
* can include it beside the configured `provider: "local"` packages. A vetra
|
|
606
|
+
* project declares no package entry for itself, yet its models are exactly
|
|
607
|
+
* the ones the worker is missing.
|
|
608
|
+
*/
|
|
609
|
+
export declare function ownProjectPackage(dirname: string): string | undefined;
|
|
610
|
+
/**
|
|
611
|
+
* Build each local package's models entry into `outDir` and write the
|
|
612
|
+
* manifest the tab reads. Returns the manifest entries (empty when no local
|
|
613
|
+
* package ships a models bundle), or null when the build itself failed -
|
|
614
|
+
* `errorRef` then carries the cause. Both of those remove `outDir`, so a
|
|
615
|
+
* previous build's bundles never outlive the packages they came from.
|
|
616
|
+
*/
|
|
617
|
+
export declare function prebuildWorkerPackages(options: WorkerPackagesBuildOptions): Promise<WorkerPackageManifestEntry[] | null>;
|
|
102
618
|
//#endregion
|
|
103
619
|
//#region connect-utils/types.d.ts
|
|
104
|
-
type IConnectOptions = {
|
|
620
|
+
export type IConnectOptions = {
|
|
105
621
|
mode: string;
|
|
106
622
|
dirname: string;
|
|
107
623
|
envDir?: string;
|
|
108
|
-
powerhouseConfig?: PowerhouseConfig;
|
|
624
|
+
powerhouseConfig?: PowerhouseConfig$1;
|
|
109
625
|
watchTimeout?: number;
|
|
110
626
|
/**
|
|
111
627
|
* CLI-supplied connect override. Final (highest precedence) layer of the
|
|
@@ -127,8 +643,28 @@ type IConnectOptions = {
|
|
|
127
643
|
cliPackageRegistryUrl?: string;
|
|
128
644
|
dynamicBase?: boolean;
|
|
129
645
|
favicon?: string;
|
|
646
|
+
/** The routes folder, relative to the project (a host's `runner.routes`);
|
|
647
|
+
* `false` for none. Default: `hosts/connect/routes/` when it exists. */
|
|
648
|
+
routes?: string | false;
|
|
649
|
+
/** Vite's cache folder. Default: Vite's, `node_modules/.vite`; a host's own
|
|
650
|
+
* keeps dev servers running side by side from rewriting each other's deps. */
|
|
651
|
+
cacheDir?: string;
|
|
652
|
+
/**
|
|
653
|
+
* Production vendor: the prebuilt shared-dependency bundle's import map and
|
|
654
|
+
* version table (from `prebuildConnectVendor`). When set on a production
|
|
655
|
+
* build, the shared specifiers are externalized from the app bundle and
|
|
656
|
+
* merged into the page import map. Build input only.
|
|
657
|
+
*/
|
|
658
|
+
vendor?: {
|
|
659
|
+
imports: Record<string, string>;
|
|
660
|
+
versions: Record<string, string>;
|
|
661
|
+
/** Base-applied URL of the content-hashed shared-deps module. */
|
|
662
|
+
sharedDeps?: string;
|
|
663
|
+
};
|
|
664
|
+
/** Content digest of the prebuilt reactor worker dir; versions its URLs. */
|
|
665
|
+
reactorWorkerVersion?: string;
|
|
130
666
|
};
|
|
131
|
-
type ConnectCommonOptions = {
|
|
667
|
+
export type ConnectCommonOptions = {
|
|
132
668
|
base?: string;
|
|
133
669
|
mode?: string;
|
|
134
670
|
configFile?: string;
|
|
@@ -138,71 +674,71 @@ type ConnectCommonOptions = {
|
|
|
138
674
|
defaultDrivesUrl?: string[];
|
|
139
675
|
drivesPreserveStrategy?: "preserve-all" | "preserve-by-url-and-detach";
|
|
140
676
|
};
|
|
141
|
-
type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
|
|
677
|
+
export type ViteDevOptions = Pick<CommonServerOptions, "port" | "host" | "open" | "cors" | "strictPort"> & {
|
|
142
678
|
force?: boolean;
|
|
143
679
|
};
|
|
144
|
-
type ConnectStudioOptions = ConnectCommonOptions & {
|
|
680
|
+
export type ConnectStudioOptions = ConnectCommonOptions & {
|
|
145
681
|
devServerOptions?: ViteDevOptions;
|
|
146
682
|
printUrls?: boolean;
|
|
147
683
|
bindCLIShortcuts?: boolean;
|
|
148
684
|
};
|
|
149
|
-
type ConnectBuildOptions = ConnectCommonOptions & {
|
|
685
|
+
export type ConnectBuildOptions = ConnectCommonOptions & {
|
|
150
686
|
outDir?: string;
|
|
151
687
|
};
|
|
152
|
-
type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
|
|
688
|
+
export type ConnectPreviewOptions = ConnectCommonOptions & Omit<ViteDevOptions, "cors"> & {
|
|
153
689
|
outDir?: string;
|
|
154
690
|
printUrls?: boolean;
|
|
155
691
|
bindCLIShortcuts?: boolean;
|
|
156
692
|
};
|
|
157
693
|
//#endregion
|
|
158
694
|
//#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;
|
|
695
|
+
export declare const DEFAULT_CONNECT_OUTDIR: ".ph/connect-build/dist/";
|
|
696
|
+
export declare function resolveViteConfigPath(options: Pick<ConnectCommonOptions, "projectRoot" | "viteConfigFile">): string;
|
|
697
|
+
export declare function resolvePackage(packageName: string, root?: string): string;
|
|
698
|
+
export declare function resolveConnectPackageJson(root?: string): JSON | null;
|
|
163
699
|
/**
|
|
164
700
|
* Finds the dist dir of Connect on the local machine
|
|
165
701
|
*/
|
|
166
|
-
declare function resolveConnectBundle(root?: string): string;
|
|
167
|
-
declare function resolveConnectPublicDir(root?: string): string;
|
|
702
|
+
export declare function resolveConnectBundle(root?: string): string;
|
|
703
|
+
export declare function resolveConnectPublicDir(root?: string): string;
|
|
168
704
|
/**
|
|
169
705
|
* Copies the Connect dist dir to the target path
|
|
170
706
|
*/
|
|
171
|
-
declare function copyConnect(sourcePath: string, targetPath: string): void;
|
|
707
|
+
export declare function copyConnect(sourcePath: string, targetPath: string): void;
|
|
172
708
|
/**
|
|
173
709
|
* Backs up the index.html file
|
|
174
710
|
*
|
|
175
711
|
* Needed when running the Connect Studio dev server on Windows
|
|
176
712
|
*/
|
|
177
|
-
declare function backupIndexHtml(appPath: string, restore?: boolean): void;
|
|
178
|
-
declare function removeBase64EnvValues(appPath: string): void;
|
|
179
|
-
declare function readJsonFile(filePath: string): PowerhouseConfig | null;
|
|
713
|
+
export declare function backupIndexHtml(appPath: string, restore?: boolean): void;
|
|
714
|
+
export declare function removeBase64EnvValues(appPath: string): void;
|
|
715
|
+
export declare function readJsonFile(filePath: string): PowerhouseConfig$1 | null;
|
|
180
716
|
/**
|
|
181
717
|
* 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
718
|
*/
|
|
183
|
-
declare function makeImportScriptFromPackages(args: {
|
|
719
|
+
export declare function makeImportScriptFromPackages(args: {
|
|
184
720
|
packages: string[];
|
|
185
721
|
importStyles?: boolean;
|
|
186
722
|
localJsPath?: string;
|
|
187
723
|
localCssPath?: string;
|
|
188
724
|
}): string;
|
|
189
|
-
declare function ensureNodeVersion(minVersion?: string): void;
|
|
190
|
-
declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
|
|
725
|
+
export declare function ensureNodeVersion(minVersion?: string): void;
|
|
726
|
+
export declare function runShellScriptPlugin(scriptName: string, connectPath: string): Plugin;
|
|
191
727
|
/**
|
|
192
728
|
* Appends the contents to the <head> tag of the index.html file
|
|
193
729
|
*/
|
|
194
|
-
declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
|
|
730
|
+
export declare function appendToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
|
|
195
731
|
/**
|
|
196
732
|
* Prepends the contents to the <head> tag of the index.html file
|
|
197
733
|
*/
|
|
198
|
-
declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
|
|
199
|
-
declare function runTsc(outDir: string): void;
|
|
200
|
-
declare function stripVersionFromPackage(packageName: string): string;
|
|
734
|
+
export declare function prependToHtmlHead(pathToHtml: string, contents: string): Promise<void>;
|
|
735
|
+
export declare function runTsc(outDir: string): void;
|
|
736
|
+
export declare function stripVersionFromPackage(packageName: string): string;
|
|
201
737
|
//#endregion
|
|
202
738
|
//#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: {
|
|
739
|
+
export declare const RUNTIME_CONFIG_SCHEMA_ID = "https://powerhouse.inc/schemas/powerhouse.config.json";
|
|
740
|
+
export declare const RUNTIME_CONFIG_SCHEMA_URL = "https://raw.githubusercontent.com/powerhouse-inc/powerhouse/main/packages/builder-tools/connect-utils/runtime-config.schema.json";
|
|
741
|
+
export declare const runtimeConfigSchema: {
|
|
206
742
|
readonly $schema: "http://json-schema.org/draft-07/schema#";
|
|
207
743
|
readonly $id: "https://powerhouse.inc/schemas/powerhouse.config.json";
|
|
208
744
|
readonly title: "Powerhouse Connect runtime configuration";
|
|
@@ -269,686 +805,22 @@ declare const runtimeConfigSchema: {
|
|
|
269
805
|
};
|
|
270
806
|
}];
|
|
271
807
|
};
|
|
272
|
-
readonly connect:
|
|
273
|
-
readonly type: "object";
|
|
274
|
-
readonly additionalProperties: false;
|
|
275
|
-
readonly description: "Connect-specific UI customisations. All fields optional; omit the section entirely for default behaviour.";
|
|
276
|
-
readonly properties: {
|
|
277
|
-
readonly branding: {
|
|
278
|
-
readonly type: "object";
|
|
279
|
-
readonly additionalProperties: false;
|
|
280
|
-
readonly description: "App identity and visual branding.";
|
|
281
|
-
readonly properties: {
|
|
282
|
-
readonly appName: {
|
|
283
|
-
readonly type: "string";
|
|
284
|
-
readonly description: "Browser tab title and any in-app brand text. Defaults to 'Powerhouse Connect'.";
|
|
285
|
-
};
|
|
286
|
-
readonly homeBackground: {
|
|
287
|
-
readonly type: readonly ["string", "null"];
|
|
288
|
-
readonly description: "Hero image on the empty home screen. URL or path to override; null or omitted uses the bundled default image.";
|
|
289
|
-
};
|
|
290
|
-
};
|
|
291
|
-
};
|
|
292
|
-
readonly app: {
|
|
293
|
-
readonly type: "object";
|
|
294
|
-
readonly additionalProperties: false;
|
|
295
|
-
readonly description: "Top-level Connect application behaviour.";
|
|
296
|
-
readonly properties: {
|
|
297
|
-
readonly logLevel: {
|
|
298
|
-
readonly type: "string";
|
|
299
|
-
readonly enum: readonly ["debug", "info", "warn", "error"];
|
|
300
|
-
readonly description: "Log level applied by Connect's logger at boot. Affects browser-side output only.";
|
|
301
|
-
readonly default: "info";
|
|
302
|
-
};
|
|
303
|
-
readonly basePath: {
|
|
304
|
-
readonly type: "string";
|
|
305
|
-
readonly description: "Base path Connect is mounted under (e.g. '/connect' for subpath deploys). Normalised at runtime to start and end with '/'. Defaults to the build-time BASE_URL.";
|
|
306
|
-
readonly default: "/";
|
|
307
|
-
};
|
|
308
|
-
readonly offline: {
|
|
309
|
-
readonly type: "boolean";
|
|
310
|
-
readonly description: "When true (default), the build emits a precaching service worker so Connect's app shell works offline, and the SPA registers it at boot. Set false to opt this deployment out: no service worker is built, the SPA skips registration, and any previously-installed worker is unregistered.";
|
|
311
|
-
readonly default: true;
|
|
312
|
-
};
|
|
313
|
-
readonly studioMode: {
|
|
314
|
-
readonly type: "boolean";
|
|
315
|
-
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
|
-
readonly default: false;
|
|
317
|
-
};
|
|
318
|
-
};
|
|
319
|
-
};
|
|
320
|
-
readonly ai: {
|
|
321
|
-
readonly type: "object";
|
|
322
|
-
readonly additionalProperties: false;
|
|
323
|
-
readonly description: "AI assistant (chat) behaviour.";
|
|
324
|
-
readonly properties: {
|
|
325
|
-
readonly assistantEnabled: {
|
|
326
|
-
readonly type: "boolean";
|
|
327
|
-
readonly description: "When true, Connect mounts the in-browser AI assistant (bottom-right chat FAB that talks to a user-configured OpenAI-compatible endpoint and acts on the reactor). Disabled by default.";
|
|
328
|
-
readonly default: false;
|
|
329
|
-
};
|
|
330
|
-
};
|
|
331
|
-
};
|
|
332
|
-
readonly packages: {
|
|
333
|
-
readonly type: "object";
|
|
334
|
-
readonly additionalProperties: false;
|
|
335
|
-
readonly description: "Runtime behaviour for the Connect package manager (separate from top-level `packages[]`, which lists which packages to load).";
|
|
336
|
-
readonly properties: {
|
|
337
|
-
readonly externalEnabled: {
|
|
338
|
-
readonly type: "boolean";
|
|
339
|
-
readonly description: "When false, Connect refuses to load any package that wasn't bundled at build time. Affirmative replacement for the legacy PH_CONNECT_EXTERNAL_PACKAGES_DISABLED env var.";
|
|
340
|
-
readonly default: true;
|
|
341
|
-
};
|
|
342
|
-
readonly liveReload: {
|
|
343
|
-
readonly type: "boolean";
|
|
344
|
-
readonly description: "When true, Connect subscribes to the static-mode `/__packages` SSE channel so live publishes flow into the running tab without a page reload. Only works under hosting that serves this channel (e.g. ph-clint static mode).";
|
|
345
|
-
readonly default: false;
|
|
346
|
-
};
|
|
347
|
-
};
|
|
348
|
-
};
|
|
349
|
-
readonly drives: {
|
|
350
|
-
readonly type: "object";
|
|
351
|
-
readonly additionalProperties: false;
|
|
352
|
-
readonly description: "Default-drive and add-drive UI behaviour.";
|
|
353
|
-
readonly properties: {
|
|
354
|
-
readonly allowAddDrive: {
|
|
355
|
-
readonly type: "boolean";
|
|
356
|
-
readonly description: "When false, the SPA hides the 'add drive' affordance entirely (top-level). Per-section overrides live in `sections.{remote,local}.allowAdd`.";
|
|
357
|
-
readonly default: true;
|
|
358
|
-
};
|
|
359
|
-
readonly defaultDrives: {
|
|
360
|
-
readonly type: "array";
|
|
361
|
-
readonly description: "Drives the SPA auto-connects to on first load. Each entry is either a remote drive (a URL, with optional name/icon overrides) or a local drive (created locally on first boot, with a stable id and optional name/icon/app).";
|
|
362
|
-
readonly default: readonly [];
|
|
363
|
-
readonly items: {
|
|
364
|
-
readonly oneOf: readonly [{
|
|
365
|
-
readonly type: "object";
|
|
366
|
-
readonly additionalProperties: false;
|
|
367
|
-
readonly required: readonly ["url"];
|
|
368
|
-
readonly properties: {
|
|
369
|
-
readonly url: {
|
|
370
|
-
readonly type: "string";
|
|
371
|
-
};
|
|
372
|
-
readonly name: {
|
|
373
|
-
readonly type: readonly ["string", "null"];
|
|
374
|
-
};
|
|
375
|
-
readonly icon: {
|
|
376
|
-
readonly type: readonly ["string", "null"];
|
|
377
|
-
};
|
|
378
|
-
};
|
|
379
|
-
}, {
|
|
380
|
-
readonly type: "object";
|
|
381
|
-
readonly additionalProperties: false;
|
|
382
|
-
readonly required: readonly ["local", "id"];
|
|
383
|
-
readonly properties: {
|
|
384
|
-
readonly local: {
|
|
385
|
-
readonly const: true;
|
|
386
|
-
readonly description: "Discriminator: this entry is a local drive created on first boot.";
|
|
387
|
-
};
|
|
388
|
-
readonly id: {
|
|
389
|
-
readonly type: "string";
|
|
390
|
-
readonly description: "Stable drive id. The drive is created with this id on first boot and is not re-created on later boots.";
|
|
391
|
-
};
|
|
392
|
-
readonly name: {
|
|
393
|
-
readonly type: readonly ["string", "null"];
|
|
394
|
-
};
|
|
395
|
-
readonly icon: {
|
|
396
|
-
readonly type: readonly ["string", "null"];
|
|
397
|
-
};
|
|
398
|
-
readonly app: {
|
|
399
|
-
readonly type: "string";
|
|
400
|
-
readonly description: "Drive app (preferred editor) to open on the drive.";
|
|
401
|
-
};
|
|
402
|
-
};
|
|
403
|
-
}];
|
|
404
|
-
};
|
|
405
|
-
};
|
|
406
|
-
readonly preserveStrategy: {
|
|
407
|
-
readonly type: "string";
|
|
408
|
-
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.";
|
|
410
|
-
};
|
|
411
|
-
readonly sections: {
|
|
412
|
-
readonly type: "object";
|
|
413
|
-
readonly additionalProperties: false;
|
|
414
|
-
readonly description: "Per-section visibility and affordance toggles. `remote` covers what was historically split into 'public' + 'cloud'; `local` is browser-local drives.";
|
|
415
|
-
readonly properties: {
|
|
416
|
-
readonly remote: {
|
|
417
|
-
readonly type: "object";
|
|
418
|
-
readonly additionalProperties: false;
|
|
419
|
-
readonly description: "Visibility and add/delete affordances for a drive section in the sidebar.";
|
|
420
|
-
readonly properties: {
|
|
421
|
-
readonly enabled: {
|
|
422
|
-
readonly type: "boolean";
|
|
423
|
-
readonly description: "When false, the section is hidden in the sidebar.";
|
|
424
|
-
readonly default: true;
|
|
425
|
-
};
|
|
426
|
-
readonly allowAdd: {
|
|
427
|
-
readonly type: "boolean";
|
|
428
|
-
readonly description: "When false, the section's 'add drive' affordance is hidden.";
|
|
429
|
-
readonly default: true;
|
|
430
|
-
};
|
|
431
|
-
readonly allowDelete: {
|
|
432
|
-
readonly type: "boolean";
|
|
433
|
-
readonly description: "When false, drives in this section cannot be deleted from the UI.";
|
|
434
|
-
readonly default: true;
|
|
435
|
-
};
|
|
436
|
-
};
|
|
437
|
-
};
|
|
438
|
-
readonly local: {
|
|
439
|
-
readonly type: "object";
|
|
440
|
-
readonly additionalProperties: false;
|
|
441
|
-
readonly description: "Visibility and add/delete affordances for a drive section in the sidebar.";
|
|
442
|
-
readonly properties: {
|
|
443
|
-
readonly enabled: {
|
|
444
|
-
readonly type: "boolean";
|
|
445
|
-
readonly description: "When false, the section is hidden in the sidebar.";
|
|
446
|
-
readonly default: true;
|
|
447
|
-
};
|
|
448
|
-
readonly allowAdd: {
|
|
449
|
-
readonly type: "boolean";
|
|
450
|
-
readonly description: "When false, the section's 'add drive' affordance is hidden.";
|
|
451
|
-
readonly default: true;
|
|
452
|
-
};
|
|
453
|
-
readonly allowDelete: {
|
|
454
|
-
readonly type: "boolean";
|
|
455
|
-
readonly description: "When false, drives in this section cannot be deleted from the UI.";
|
|
456
|
-
readonly default: true;
|
|
457
|
-
};
|
|
458
|
-
};
|
|
459
|
-
};
|
|
460
|
-
};
|
|
461
|
-
};
|
|
462
|
-
};
|
|
463
|
-
};
|
|
464
|
-
readonly renown: {
|
|
465
|
-
readonly type: "object";
|
|
466
|
-
readonly additionalProperties: false;
|
|
467
|
-
readonly description: "Renown identity / authentication coordinates.";
|
|
468
|
-
readonly properties: {
|
|
469
|
-
readonly url: {
|
|
470
|
-
readonly type: "string";
|
|
471
|
-
readonly description: "Renown auth service URL.";
|
|
472
|
-
readonly default: "https://www.renown.id";
|
|
473
|
-
};
|
|
474
|
-
readonly networkId: {
|
|
475
|
-
readonly type: "string";
|
|
476
|
-
readonly description: "CAIP-2 network namespace (e.g. 'eip155').";
|
|
477
|
-
readonly default: "eip155";
|
|
478
|
-
};
|
|
479
|
-
readonly chainId: {
|
|
480
|
-
readonly type: "number";
|
|
481
|
-
readonly description: "CAIP-2 chain reference within the network namespace.";
|
|
482
|
-
readonly default: 1;
|
|
483
|
-
};
|
|
484
|
-
readonly namespace: {
|
|
485
|
-
readonly type: "string";
|
|
486
|
-
readonly description: "Renown localStorage namespace; share it across Connects to share login.";
|
|
487
|
-
};
|
|
488
|
-
readonly switchboardUrl: {
|
|
489
|
-
readonly type: "string";
|
|
490
|
-
readonly description: "Switchboard GraphQL URL. When set, Connect enables in-page (no-redirect) Renown sign-in; otherwise it falls back to the redirect flow via `url`.";
|
|
491
|
-
};
|
|
492
|
-
readonly adapters: {
|
|
493
|
-
readonly type: "object";
|
|
494
|
-
readonly additionalProperties: false;
|
|
495
|
-
readonly description: "Per-adapter wallet config for in-page auth. Presence of an adapter key enables it; omit or leave empty for redirect-only behaviour.";
|
|
496
|
-
readonly properties: {
|
|
497
|
-
readonly rainbow: {
|
|
498
|
-
readonly type: "object";
|
|
499
|
-
readonly additionalProperties: false;
|
|
500
|
-
readonly description: "wagmi + RainbowKit external-wallet adapter config.";
|
|
501
|
-
readonly properties: {
|
|
502
|
-
readonly walletConnectProjectId: {
|
|
503
|
-
readonly type: "string";
|
|
504
|
-
readonly description: "WalletConnect project id; required for this adapter to function.";
|
|
505
|
-
};
|
|
506
|
-
readonly infuraProjectId: {
|
|
507
|
-
readonly type: "string";
|
|
508
|
-
readonly description: "Optional Infura project id used to build RPC transports.";
|
|
509
|
-
};
|
|
510
|
-
};
|
|
511
|
-
};
|
|
512
|
-
readonly privy: {
|
|
513
|
-
readonly type: "object";
|
|
514
|
-
readonly additionalProperties: false;
|
|
515
|
-
readonly description: "Privy embedded/social adapter config.";
|
|
516
|
-
readonly properties: {
|
|
517
|
-
readonly appId: {
|
|
518
|
-
readonly type: "string";
|
|
519
|
-
readonly description: "Privy application id; required for this adapter to function.";
|
|
520
|
-
};
|
|
521
|
-
readonly clientId: {
|
|
522
|
-
readonly type: "string";
|
|
523
|
-
readonly description: "Optional Privy client id.";
|
|
524
|
-
};
|
|
525
|
-
readonly methods: {
|
|
526
|
-
readonly type: "array";
|
|
527
|
-
readonly description: "Login methods this adapter offers; default per adapter when omitted.";
|
|
528
|
-
readonly items: {
|
|
529
|
-
readonly type: "string";
|
|
530
|
-
};
|
|
531
|
-
};
|
|
532
|
-
};
|
|
533
|
-
};
|
|
534
|
-
};
|
|
535
|
-
};
|
|
536
|
-
};
|
|
537
|
-
};
|
|
538
|
-
readonly sentry: {
|
|
539
|
-
readonly type: "object";
|
|
540
|
-
readonly additionalProperties: false;
|
|
541
|
-
readonly description: "Sentry error-tracking coordinates. Set `dsn` to enable Sentry; leave `dsn` null to disable. The Sentry release tag stays build-time (stamped via Vite's `define` from WORKSPACE_VERSION) so it always matches the sourcemaps uploaded by CI.";
|
|
542
|
-
readonly properties: {
|
|
543
|
-
readonly dsn: {
|
|
544
|
-
readonly type: readonly ["string", "null"];
|
|
545
|
-
readonly description: "Sentry DSN URL. `null` disables Sentry entirely; the SPA never loads the Sentry SDK chunk.";
|
|
546
|
-
readonly default: null;
|
|
547
|
-
};
|
|
548
|
-
readonly env: {
|
|
549
|
-
readonly type: "string";
|
|
550
|
-
readonly description: "Sentry environment label, surfaced as the `environment` tag on every event.";
|
|
551
|
-
readonly default: "dev";
|
|
552
|
-
};
|
|
553
|
-
readonly tracing: {
|
|
554
|
-
readonly type: "boolean";
|
|
555
|
-
readonly description: "Enable Sentry performance tracing.";
|
|
556
|
-
readonly default: false;
|
|
557
|
-
};
|
|
558
|
-
};
|
|
559
|
-
};
|
|
560
|
-
readonly instance: {
|
|
561
|
-
readonly type: "object";
|
|
562
|
-
readonly additionalProperties: false;
|
|
563
|
-
readonly required: readonly ["namespace", "reactorWorker"];
|
|
564
|
-
readonly description: "Per-instance identity. Lets one origin host multiple isolated Connect instances, each with its own storage + SharedWorker namespace.";
|
|
565
|
-
readonly properties: {
|
|
566
|
-
readonly namespace: {
|
|
567
|
-
readonly type: readonly ["string", "null"];
|
|
568
|
-
readonly description: "Explicit storage/SharedWorker namespace for this instance. `null` derives it from the base path (and, later, the configured endpoint), so root deployments stay byte-identical.";
|
|
569
|
-
readonly default: null;
|
|
570
|
-
};
|
|
571
|
-
readonly reactorWorker: {
|
|
572
|
-
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.";
|
|
574
|
-
readonly default: false;
|
|
575
|
-
};
|
|
576
|
-
};
|
|
577
|
-
};
|
|
578
|
-
readonly reactor: {
|
|
579
|
-
readonly type: "object";
|
|
580
|
-
readonly additionalProperties: false;
|
|
581
|
-
readonly description: "Settings for the reactor Connect runs in the browser, on the main thread or in the shared worker alike.";
|
|
582
|
-
readonly properties: {
|
|
583
|
-
readonly featureFlags: {
|
|
584
|
-
readonly type: "object";
|
|
585
|
-
readonly additionalProperties: false;
|
|
586
|
-
readonly description: "Enforcement flags. Each implies its predecessors, and the reactor refuses to boot on a set that names a later flag without an earlier one. These are consensus settings: a Connect syncing with a fleet must carry the same flags the fleet does, or the two reach different replay outcomes for the same history and diverge.";
|
|
587
|
-
readonly properties: {
|
|
588
|
-
readonly documentDecisions: {
|
|
589
|
-
readonly type: "boolean";
|
|
590
|
-
readonly description: "Decide writes from the document stream rather than the document meta cache, so a backdated deletion denies the operations that sort after it.";
|
|
591
|
-
readonly default: false;
|
|
592
|
-
};
|
|
593
|
-
readonly authEnforcement: {
|
|
594
|
-
readonly type: "boolean";
|
|
595
|
-
readonly description: "Enforce the auth scope's policy at admission, replay, and read. Requires documentDecisions.";
|
|
596
|
-
readonly default: false;
|
|
597
|
-
};
|
|
598
|
-
readonly authGroups: {
|
|
599
|
-
readonly type: "boolean";
|
|
600
|
-
readonly description: "Let `{ group }` principals match against the rosters of the group documents a policy names. Requires authEnforcement.";
|
|
601
|
-
readonly default: false;
|
|
602
|
-
};
|
|
603
|
-
readonly authConditions: {
|
|
604
|
-
readonly type: "boolean";
|
|
605
|
-
readonly description: "Evaluate `where` and `match` conditions on grants. Requires authGroups. Do not enable on a fleet `preflight:auth` reports as crossing a reducer version.";
|
|
606
|
-
readonly default: false;
|
|
607
|
-
};
|
|
608
|
-
};
|
|
609
|
-
};
|
|
610
|
-
};
|
|
611
|
-
};
|
|
612
|
-
readonly pwa: {
|
|
613
|
-
readonly type: "object";
|
|
614
|
-
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.";
|
|
616
|
-
readonly properties: {
|
|
617
|
-
readonly manifest: {
|
|
618
|
-
readonly type: "object";
|
|
619
|
-
readonly additionalProperties: false;
|
|
620
|
-
readonly description: "Web-app-manifest field overrides.";
|
|
621
|
-
readonly properties: {
|
|
622
|
-
readonly name: {
|
|
623
|
-
readonly type: "string";
|
|
624
|
-
};
|
|
625
|
-
readonly short_name: {
|
|
626
|
-
readonly type: "string";
|
|
627
|
-
};
|
|
628
|
-
readonly description: {
|
|
629
|
-
readonly type: "string";
|
|
630
|
-
};
|
|
631
|
-
readonly theme_color: {
|
|
632
|
-
readonly type: "string";
|
|
633
|
-
};
|
|
634
|
-
readonly background_color: {
|
|
635
|
-
readonly type: "string";
|
|
636
|
-
};
|
|
637
|
-
readonly display: {
|
|
638
|
-
readonly type: "string";
|
|
639
|
-
readonly enum: readonly ["fullscreen", "standalone", "minimal-ui", "browser"];
|
|
640
|
-
};
|
|
641
|
-
readonly start_url: {
|
|
642
|
-
readonly type: "string";
|
|
643
|
-
};
|
|
644
|
-
readonly scope: {
|
|
645
|
-
readonly type: "string";
|
|
646
|
-
};
|
|
647
|
-
readonly icons: {
|
|
648
|
-
readonly type: "array";
|
|
649
|
-
readonly description: "Icons appended to the built-in set and de-duplicated by (src, sizes, purpose).";
|
|
650
|
-
readonly items: {
|
|
651
|
-
readonly type: "object";
|
|
652
|
-
readonly additionalProperties: false;
|
|
653
|
-
readonly required: readonly ["src"];
|
|
654
|
-
readonly properties: {
|
|
655
|
-
readonly src: {
|
|
656
|
-
readonly type: "string";
|
|
657
|
-
};
|
|
658
|
-
readonly sizes: {
|
|
659
|
-
readonly type: "string";
|
|
660
|
-
};
|
|
661
|
-
readonly type: {
|
|
662
|
-
readonly type: "string";
|
|
663
|
-
};
|
|
664
|
-
readonly purpose: {
|
|
665
|
-
readonly type: "string";
|
|
666
|
-
};
|
|
667
|
-
};
|
|
668
|
-
};
|
|
669
|
-
};
|
|
670
|
-
readonly file_handlers: {
|
|
671
|
-
readonly type: "array";
|
|
672
|
-
readonly description: "File associations appended after Connect's built-in .phd/.phdm handler and de-duplicated on the whole entry. Entries only declare accepted types; there is no action field, because opening the files requires Connect's own runtime handling, so every handler opens at the app root.";
|
|
673
|
-
readonly items: {
|
|
674
|
-
readonly type: "object";
|
|
675
|
-
readonly additionalProperties: false;
|
|
676
|
-
readonly required: readonly ["accept"];
|
|
677
|
-
readonly properties: {
|
|
678
|
-
readonly accept: {
|
|
679
|
-
readonly type: "object";
|
|
680
|
-
readonly description: "MIME type \u2192 file extensions. Each extension must start with '.'; browsers ignore entries without it.";
|
|
681
|
-
readonly additionalProperties: {
|
|
682
|
-
readonly type: "array";
|
|
683
|
-
readonly items: {
|
|
684
|
-
readonly type: "string";
|
|
685
|
-
readonly pattern: "^\\.";
|
|
686
|
-
};
|
|
687
|
-
};
|
|
688
|
-
};
|
|
689
|
-
readonly icons: {
|
|
690
|
-
readonly type: "array";
|
|
691
|
-
readonly description: "OS-level file-type icons.";
|
|
692
|
-
readonly items: {
|
|
693
|
-
readonly type: "object";
|
|
694
|
-
readonly additionalProperties: false;
|
|
695
|
-
readonly required: readonly ["src"];
|
|
696
|
-
readonly properties: {
|
|
697
|
-
readonly src: {
|
|
698
|
-
readonly type: "string";
|
|
699
|
-
};
|
|
700
|
-
readonly sizes: {
|
|
701
|
-
readonly type: "string";
|
|
702
|
-
};
|
|
703
|
-
readonly type: {
|
|
704
|
-
readonly type: "string";
|
|
705
|
-
};
|
|
706
|
-
readonly purpose: {
|
|
707
|
-
readonly type: "string";
|
|
708
|
-
};
|
|
709
|
-
};
|
|
710
|
-
};
|
|
711
|
-
};
|
|
712
|
-
readonly launch_type: {
|
|
713
|
-
readonly type: "string";
|
|
714
|
-
readonly enum: readonly ["single-client", "multiple-clients"];
|
|
715
|
-
};
|
|
716
|
-
};
|
|
717
|
-
};
|
|
718
|
-
};
|
|
719
|
-
readonly launch_handler: {
|
|
720
|
-
readonly type: "object";
|
|
721
|
-
readonly additionalProperties: false;
|
|
722
|
-
readonly required: readonly ["client_mode"];
|
|
723
|
-
readonly description: "How the OS launches the app for handled files/links. Connect defaults to focus-existing.";
|
|
724
|
-
readonly properties: {
|
|
725
|
-
readonly client_mode: {
|
|
726
|
-
readonly type: "string";
|
|
727
|
-
readonly enum: readonly ["auto", "focus-existing", "navigate-existing", "navigate-new"];
|
|
728
|
-
};
|
|
729
|
-
};
|
|
730
|
-
};
|
|
731
|
-
};
|
|
732
|
-
};
|
|
733
|
-
readonly globPatterns: {
|
|
734
|
-
readonly type: "array";
|
|
735
|
-
readonly items: {
|
|
736
|
-
readonly type: "string";
|
|
737
|
-
};
|
|
738
|
-
readonly description: "Extra Workbox precache globs, unioned with the built-ins.";
|
|
739
|
-
};
|
|
740
|
-
readonly globIgnores: {
|
|
741
|
-
readonly type: "array";
|
|
742
|
-
readonly items: {
|
|
743
|
-
readonly type: "string";
|
|
744
|
-
};
|
|
745
|
-
readonly description: "Extra precache ignore globs, unioned with the built-ins.";
|
|
746
|
-
};
|
|
747
|
-
readonly maximumFileSizeToCacheInBytes: {
|
|
748
|
-
readonly type: "number";
|
|
749
|
-
readonly description: "Raise the precache file-size ceiling. The max across all contributors wins, so no contributor can shrink another's limit.";
|
|
750
|
-
};
|
|
751
|
-
readonly runtimeCaching: {
|
|
752
|
-
readonly type: "array";
|
|
753
|
-
readonly description: "Runtime-caching rules appended after the built-in rules. Workbox is first-match-wins, so these cannot override a built-in rule matching the same URL.";
|
|
754
|
-
readonly items: {
|
|
755
|
-
readonly type: "object";
|
|
756
|
-
readonly additionalProperties: false;
|
|
757
|
-
readonly required: readonly ["urlPattern", "handler"];
|
|
758
|
-
readonly properties: {
|
|
759
|
-
readonly urlPattern: {
|
|
760
|
-
readonly description: "URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.";
|
|
761
|
-
readonly oneOf: readonly [{
|
|
762
|
-
readonly type: "string";
|
|
763
|
-
}, {
|
|
764
|
-
readonly type: "object";
|
|
765
|
-
readonly additionalProperties: false;
|
|
766
|
-
readonly required: readonly ["source"];
|
|
767
|
-
readonly properties: {
|
|
768
|
-
readonly source: {
|
|
769
|
-
readonly type: "string";
|
|
770
|
-
readonly description: "RegExp source.";
|
|
771
|
-
};
|
|
772
|
-
readonly flags: {
|
|
773
|
-
readonly type: "string";
|
|
774
|
-
readonly description: "RegExp flags (e.g. 'i').";
|
|
775
|
-
};
|
|
776
|
-
};
|
|
777
|
-
}];
|
|
778
|
-
};
|
|
779
|
-
readonly handler: {
|
|
780
|
-
readonly type: "string";
|
|
781
|
-
readonly enum: readonly ["CacheFirst", "CacheOnly", "NetworkFirst", "NetworkOnly", "StaleWhileRevalidate"];
|
|
782
|
-
};
|
|
783
|
-
readonly method: {
|
|
784
|
-
readonly type: "string";
|
|
785
|
-
readonly enum: readonly ["GET", "POST", "PUT", "DELETE", "HEAD", "PATCH"];
|
|
786
|
-
};
|
|
787
|
-
readonly options: {
|
|
788
|
-
readonly type: "object";
|
|
789
|
-
readonly additionalProperties: false;
|
|
790
|
-
readonly properties: {
|
|
791
|
-
readonly cacheName: {
|
|
792
|
-
readonly type: "string";
|
|
793
|
-
};
|
|
794
|
-
readonly networkTimeoutSeconds: {
|
|
795
|
-
readonly type: "number";
|
|
796
|
-
readonly description: "Seconds a NetworkFirst rule waits for the network before falling back to the cache.";
|
|
797
|
-
};
|
|
798
|
-
readonly expiration: {
|
|
799
|
-
readonly type: "object";
|
|
800
|
-
readonly additionalProperties: false;
|
|
801
|
-
readonly properties: {
|
|
802
|
-
readonly maxEntries: {
|
|
803
|
-
readonly type: "number";
|
|
804
|
-
};
|
|
805
|
-
readonly maxAgeSeconds: {
|
|
806
|
-
readonly type: "number";
|
|
807
|
-
};
|
|
808
|
-
};
|
|
809
|
-
};
|
|
810
|
-
readonly cacheableResponse: {
|
|
811
|
-
readonly type: "object";
|
|
812
|
-
readonly additionalProperties: false;
|
|
813
|
-
readonly properties: {
|
|
814
|
-
readonly statuses: {
|
|
815
|
-
readonly type: "array";
|
|
816
|
-
readonly items: {
|
|
817
|
-
readonly type: "number";
|
|
818
|
-
};
|
|
819
|
-
};
|
|
820
|
-
readonly headers: {
|
|
821
|
-
readonly type: "object";
|
|
822
|
-
readonly additionalProperties: {
|
|
823
|
-
readonly type: "string";
|
|
824
|
-
};
|
|
825
|
-
};
|
|
826
|
-
};
|
|
827
|
-
};
|
|
828
|
-
};
|
|
829
|
-
};
|
|
830
|
-
};
|
|
831
|
-
};
|
|
832
|
-
};
|
|
833
|
-
readonly navigateFallbackDenylist: {
|
|
834
|
-
readonly type: "array";
|
|
835
|
-
readonly description: "Extra SPA navigate-fallback denylist patterns, unioned with the built-ins.";
|
|
836
|
-
readonly items: {
|
|
837
|
-
readonly description: "URL match. A string is matched verbatim by Workbox; { source, flags } is rebuilt into a RegExp at build time.";
|
|
838
|
-
readonly oneOf: readonly [{
|
|
839
|
-
readonly type: "string";
|
|
840
|
-
}, {
|
|
841
|
-
readonly type: "object";
|
|
842
|
-
readonly additionalProperties: false;
|
|
843
|
-
readonly required: readonly ["source"];
|
|
844
|
-
readonly properties: {
|
|
845
|
-
readonly source: {
|
|
846
|
-
readonly type: "string";
|
|
847
|
-
readonly description: "RegExp source.";
|
|
848
|
-
};
|
|
849
|
-
readonly flags: {
|
|
850
|
-
readonly type: "string";
|
|
851
|
-
readonly description: "RegExp flags (e.g. 'i').";
|
|
852
|
-
};
|
|
853
|
-
};
|
|
854
|
-
}];
|
|
855
|
-
};
|
|
856
|
-
};
|
|
857
|
-
};
|
|
858
|
-
};
|
|
859
|
-
};
|
|
860
|
-
};
|
|
808
|
+
readonly connect: import("@powerhousedao/shared/connect").JsonSchemaFragment;
|
|
861
809
|
};
|
|
862
810
|
};
|
|
863
811
|
//#endregion
|
|
864
812
|
//#region connect-utils/vite-config.d.ts
|
|
865
|
-
declare function getConnectHtmlTags(options?: {
|
|
813
|
+
export declare function getConnectHtmlTags(options?: {
|
|
866
814
|
registryUrl?: string | null;
|
|
815
|
+
/** The project's own name, from `connect.branding.appName`. */
|
|
816
|
+
appName?: string;
|
|
867
817
|
injectTo?: HtmlTagDescriptor["injectTo"];
|
|
868
|
-
}): [
|
|
869
|
-
|
|
870
|
-
readonly attrs: {
|
|
871
|
-
readonly "http-equiv": "Content-Security-Policy";
|
|
872
|
-
readonly content: `script-src 'self' 'unsafe-inline' 'unsafe-eval'${string}; worker-src 'self' blob:; object-src 'none'; base-uri 'self';`;
|
|
873
|
-
};
|
|
874
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
875
|
-
}, {
|
|
876
|
-
readonly tag: "meta";
|
|
877
|
-
readonly attrs: {
|
|
878
|
-
readonly property: "og:title";
|
|
879
|
-
readonly content: "Connect";
|
|
880
|
-
};
|
|
881
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
882
|
-
}, {
|
|
883
|
-
readonly tag: "meta";
|
|
884
|
-
readonly attrs: {
|
|
885
|
-
readonly property: "og:type";
|
|
886
|
-
readonly content: "website";
|
|
887
|
-
};
|
|
888
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
889
|
-
}, {
|
|
890
|
-
readonly tag: "meta";
|
|
891
|
-
readonly attrs: {
|
|
892
|
-
readonly property: "og:url";
|
|
893
|
-
readonly content: "https://apps.powerhouse.io/powerhouse/connect/";
|
|
894
|
-
};
|
|
895
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
896
|
-
}, {
|
|
897
|
-
readonly tag: "meta";
|
|
898
|
-
readonly attrs: {
|
|
899
|
-
readonly property: "og:description";
|
|
900
|
-
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
|
-
};
|
|
902
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
903
|
-
}, {
|
|
904
|
-
readonly tag: "meta";
|
|
905
|
-
readonly attrs: {
|
|
906
|
-
readonly property: "og:image";
|
|
907
|
-
readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
|
|
908
|
-
};
|
|
909
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
910
|
-
}, {
|
|
911
|
-
readonly tag: "meta";
|
|
912
|
-
readonly attrs: {
|
|
913
|
-
readonly name: "twitter:card";
|
|
914
|
-
readonly content: "summary_large_image";
|
|
915
|
-
};
|
|
916
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
917
|
-
}, {
|
|
918
|
-
readonly tag: "meta";
|
|
919
|
-
readonly attrs: {
|
|
920
|
-
readonly name: "twitter:image";
|
|
921
|
-
readonly content: "https://cf-ipfs.com/ipfs/bafkreigrmclndf2jpbolaq22535q2sw5t44uad3az3dpvkzrnt4lpjt63e";
|
|
922
|
-
};
|
|
923
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
924
|
-
}, {
|
|
925
|
-
readonly tag: "meta";
|
|
926
|
-
readonly attrs: {
|
|
927
|
-
readonly name: "twitter:title";
|
|
928
|
-
readonly content: "Connect";
|
|
929
|
-
};
|
|
930
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
931
|
-
}, {
|
|
932
|
-
readonly tag: "meta";
|
|
933
|
-
readonly attrs: {
|
|
934
|
-
readonly name: "twitter:description";
|
|
935
|
-
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
|
-
};
|
|
937
|
-
readonly injectTo: "head" | "body" | "head-prepend" | "body-prepend";
|
|
938
|
-
}];
|
|
939
|
-
declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
|
|
818
|
+
}): HtmlTagDescriptor[];
|
|
819
|
+
export declare function getConnectBaseViteConfig(options: IConnectOptions): InlineConfig;
|
|
940
820
|
//#endregion
|
|
941
821
|
//#region connect-utils/vite-plugins/dynamic-base.d.ts
|
|
942
|
-
/**
|
|
943
|
-
|
|
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__/";
|
|
822
|
+
/** Rewrites `url(<placeholder>assets/x)` relative to the stylesheet at `fileName`. */
|
|
823
|
+
export declare function relativeCssUrls(css: string, fileName: string): string;
|
|
952
824
|
/**
|
|
953
825
|
* Rewrites the placeholder base in emitted JS chunks to a runtime expression so
|
|
954
826
|
* one built `dist/connect` serves under any subpath. Rolldown-native: per-match
|
|
@@ -973,21 +845,23 @@ declare const DYNAMIC_BASE_PLACEHOLDER = "/__PH_DYNAMIC_BASE__/";
|
|
|
973
845
|
* (the same proxy also sets the runtime global for the JS rewrite). See the
|
|
974
846
|
* plugin's module doc / report for the exact serve-time contract.
|
|
975
847
|
*
|
|
976
|
-
* CSS `url(...)` references
|
|
977
|
-
*
|
|
978
|
-
*
|
|
848
|
+
* CSS `url(...)` references that Vite emits with the placeholder (e.g. bundled
|
|
849
|
+
* fonts) are rewritten relative to the stylesheet, which the HTML substitution
|
|
850
|
+
* already loads from the right prefix.
|
|
979
851
|
*/
|
|
980
|
-
declare function connectDynamicBasePlugin(options?: {
|
|
852
|
+
export declare function connectDynamicBasePlugin(options?: {
|
|
981
853
|
forWorker?: boolean;
|
|
982
854
|
workerStripPrefix?: string;
|
|
983
855
|
}): Plugin;
|
|
984
|
-
declare function escapeForRegExp(s: string): string;
|
|
856
|
+
export declare function escapeForRegExp(s: string): string;
|
|
985
857
|
//#endregion
|
|
986
858
|
//#region connect-utils/vite-plugins/ph-config.d.ts
|
|
987
|
-
type PhConfigPluginOptions = {
|
|
859
|
+
export type PhConfigPluginOptions = {
|
|
988
860
|
packages: PowerhousePackage[];
|
|
989
861
|
projectRoot?: string;
|
|
990
862
|
connect?: PHConnectRuntimeConfig;
|
|
863
|
+
/** The source's top-level `workflows` block; `connect.app.workflowsEnabled` falls back to it. */
|
|
864
|
+
workflows?: PowerhouseConfig["workflows"];
|
|
991
865
|
/**
|
|
992
866
|
* Project-wide package registry URL — the effective value (CLI override
|
|
993
867
|
* `??` source) the caller has already resolved. Copied verbatim into the
|
|
@@ -1001,8 +875,24 @@ type PhConfigPluginOptions = {
|
|
|
1001
875
|
* See clis/ph-cli/src/utils/cli-connect-override.ts.
|
|
1002
876
|
*/
|
|
1003
877
|
cliConnectOverride?: PHConnectRuntimeConfig;
|
|
878
|
+
/**
|
|
879
|
+
* The resolved `connect.branding` (images as data URIs, null = default),
|
|
880
|
+
* computed once by the Vite config from the same ladder. Replaces the
|
|
881
|
+
* merged block, so the browser never sees a project path.
|
|
882
|
+
*/
|
|
883
|
+
branding?: PHConnectBranding;
|
|
884
|
+
};
|
|
885
|
+
/** `html` with its `<title>` text set to `appName`, when one is configured. */
|
|
886
|
+
export declare function withAppTitle(html: string, appName: string | undefined): string;
|
|
887
|
+
type PhConfigApi = {
|
|
888
|
+
connect: PHConnectRuntimeConfig;
|
|
889
|
+
favicon?: string;
|
|
890
|
+
};
|
|
891
|
+
/** `api.connect`: the connect config the app is served, for plugins that render
|
|
892
|
+
* ahead of it; `api.favicon`: its `branding.favicon`, which it leaves out. */
|
|
893
|
+
export declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin<PhConfigApi> & {
|
|
894
|
+
api: PhConfigApi;
|
|
1004
895
|
};
|
|
1005
|
-
declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin;
|
|
1006
896
|
//#endregion
|
|
1007
897
|
//#region connect-utils/vite-plugins/theme-boot.d.ts
|
|
1008
898
|
/**
|
|
@@ -1010,13 +900,21 @@ declare function phConfigPlugin(options: PhConfigPluginOptions): Plugin;
|
|
|
1010
900
|
* ph-clint connect proxy) and this plugin both check it, so the script is
|
|
1011
901
|
* applied exactly once no matter which layer runs first.
|
|
1012
902
|
*/
|
|
1013
|
-
declare const THEME_BOOT_MARKER = "data-ph-theme-boot";
|
|
903
|
+
export declare const THEME_BOOT_MARKER = "data-ph-theme-boot";
|
|
1014
904
|
/**
|
|
1015
905
|
* Injects the theme boot script at the top of `<head>` of every emitted
|
|
1016
906
|
* index.html, so built Connect apps render the stored theme from first paint
|
|
1017
907
|
* without depending on a serve-time injector.
|
|
1018
908
|
*/
|
|
1019
|
-
declare function connectThemeBootPlugin(): Plugin;
|
|
909
|
+
export declare function connectThemeBootPlugin(): Plugin;
|
|
910
|
+
//#endregion
|
|
911
|
+
//#region connect-utils/vite-plugins/vendor-import-map.d.ts
|
|
912
|
+
export type VendorImportMapOptions = {
|
|
913
|
+
/** bare specifier -> URL (already base-prefixed by the caller). */
|
|
914
|
+
imports: Record<string, string>;
|
|
915
|
+
};
|
|
916
|
+
export declare function vendorImportMapPlugin(options: VendorImportMapOptions): Plugin;
|
|
1020
917
|
//#endregion
|
|
1021
|
-
export {
|
|
918
|
+
export { DYNAMIC_BASE_PLACEHOLDER };
|
|
919
|
+
export {};
|
|
1022
920
|
//# sourceMappingURL=index.d.mts.map
|