@powerhousedao/builder-tools 6.2.3-dev.66 → 6.2.3-dev.68
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 +102 -21
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +426 -62
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
+
import react from "@vitejs/plugin-react";
|
|
2
3
|
import fs, { chmodSync, cpSync, createReadStream, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
4
|
import path, { dirname, extname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { createLogger, createServer, esmExternalRequirePlugin, loadEnv, searchForWorkspaceRoot } from "vite";
|
|
4
6
|
import { exec, execSync, spawn } from "node:child_process";
|
|
5
7
|
import { readFile, writeFile } from "node:fs/promises";
|
|
6
8
|
import { cwd } from "node:process";
|
|
7
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
8
10
|
import { Generator, getConfig } from "@tanstack/router-generator";
|
|
9
11
|
import { tanstackRouter } from "@tanstack/router-plugin/vite";
|
|
10
|
-
import { layout, physical, rootRoute } from "@tanstack/virtual-file-routes";
|
|
12
|
+
import { index, layout, physical, rootRoute, route } from "@tanstack/virtual-file-routes";
|
|
11
13
|
import { fileURLToPath } from "node:url";
|
|
12
14
|
import { DYNAMIC_BASE_PLACEHOLDER, PWA_FILE_HANDLER_ACTION, buildRuntimeConfig, deepMerge, loadConnectEnv, mergeManifest, mergePwaConfig, normalizeBasePath, phConnectRuntimeConfigSchema, powerhousePackageSchema, resolveSourceConnect, setConnectEnv, unionStrings, withInferredCategory, workerPackageFileName, workflowsSettingConflict } from "@powerhousedao/shared/connect";
|
|
13
15
|
import MagicString from "magic-string";
|
|
14
16
|
import { getConfig as getConfig$1 } from "@powerhousedao/config/node";
|
|
15
17
|
import tailwind from "@tailwindcss/vite";
|
|
16
|
-
import react from "@vitejs/plugin-react";
|
|
17
|
-
import { createLogger, esmExternalRequirePlugin, loadEnv, searchForWorkspaceRoot } from "vite";
|
|
18
18
|
import { createHtmlPlugin } from "vite-plugin-html";
|
|
19
19
|
import { PwaConfigSchema } from "@powerhousedao/shared/document-model";
|
|
20
20
|
import { toCdnUrl } from "@powerhousedao/shared/registry/urls";
|
|
@@ -211,22 +211,69 @@ function stripVersionFromPackage(packageName) {
|
|
|
211
211
|
//#region connect-utils/vite-plugins/app-shell.ts
|
|
212
212
|
/** On the prerendered shell's elements; marks an index.html that has it. */
|
|
213
213
|
const APP_SHELL_MARKER = "data-ph-shell";
|
|
214
|
-
/**
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
/** In Connect's dist, and copied to a project's: the plugins that pick a shell. */
|
|
215
|
+
const SHELL_PLUGINS_FILE = "shell-plugins.json";
|
|
216
|
+
/** In a project's dist: every variant, for a server that swaps the shell to the served composition. */
|
|
217
|
+
const APP_SHELLS_FILE = "app-shells.json";
|
|
218
|
+
const SHELL_FILES = {
|
|
219
|
+
generic: "shell",
|
|
220
|
+
core: "shell-core"
|
|
221
|
+
};
|
|
222
|
+
/** The shell of the composition's first plugin that has one, else core's; no composition is classic.
|
|
223
|
+
* Without `plugins` (an older Connect): core for a composition, generic for classic. */
|
|
224
|
+
function appShellVariant(composition, plugins) {
|
|
225
|
+
if (!plugins) return composition ? "core" : "generic";
|
|
226
|
+
if (!composition) return Object.values(plugins)[0] ?? "core";
|
|
227
|
+
for (const { module } of composition) if (Object.hasOwn(plugins, module)) return plugins[module];
|
|
228
|
+
return "core";
|
|
229
|
+
}
|
|
230
|
+
function connectDistDir(projectRoot) {
|
|
231
|
+
try {
|
|
232
|
+
return join(dirname(resolvePackage("@powerhousedao/connect/package.json", projectRoot)), "dist");
|
|
233
|
+
} catch {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
/** The plugins' shell manifest in `dir`, if there is a valid one. */
|
|
238
|
+
function readShellPluginsIn(dir) {
|
|
239
|
+
const file = join(dir, SHELL_PLUGINS_FILE);
|
|
240
|
+
if (!existsSync(file)) return void 0;
|
|
217
241
|
try {
|
|
218
|
-
|
|
242
|
+
const manifest = JSON.parse(readFileSync(file, "utf8"));
|
|
243
|
+
if (!manifest || typeof manifest !== "object") return void 0;
|
|
244
|
+
const plugins = {};
|
|
245
|
+
for (const [module, variant] of Object.entries(manifest)) if (variant === "generic" || variant === "core") plugins[module] = variant;
|
|
246
|
+
return plugins;
|
|
219
247
|
} catch {
|
|
220
248
|
return;
|
|
221
249
|
}
|
|
222
|
-
|
|
223
|
-
|
|
250
|
+
}
|
|
251
|
+
/** The shell manifest of the installed Connect, if it ships one. */
|
|
252
|
+
function readShellPlugins(projectRoot) {
|
|
253
|
+
const distDir = connectDistDir(projectRoot);
|
|
254
|
+
return distDir ? readShellPluginsIn(distDir) : void 0;
|
|
255
|
+
}
|
|
256
|
+
/** The shell Connect's build prerendered, if the installed Connect ships one. */
|
|
257
|
+
function readAppShell(projectRoot, variant = "generic") {
|
|
258
|
+
const distDir = connectDistDir(projectRoot);
|
|
259
|
+
if (!distDir) return void 0;
|
|
260
|
+
const body = join(distDir, `${SHELL_FILES[variant]}.html`);
|
|
261
|
+
const head = join(distDir, `${SHELL_FILES[variant]}-head.html`);
|
|
224
262
|
if (!existsSync(body) || !existsSync(head)) return void 0;
|
|
225
263
|
return {
|
|
226
264
|
body: readFileSync(body, "utf8"),
|
|
227
265
|
head: readFileSync(head, "utf8")
|
|
228
266
|
};
|
|
229
267
|
}
|
|
268
|
+
/** Every variant the installed Connect ships. */
|
|
269
|
+
function readAppShells(projectRoot) {
|
|
270
|
+
const shells = {};
|
|
271
|
+
for (const variant of Object.keys(SHELL_FILES)) {
|
|
272
|
+
const shell = readAppShell(projectRoot, variant);
|
|
273
|
+
if (shell) shells[variant] = shell;
|
|
274
|
+
}
|
|
275
|
+
return shells;
|
|
276
|
+
}
|
|
230
277
|
/** On the boot-recovery script; its sessionStorage key guards against reload loops. */
|
|
231
278
|
const BOOT_RECOVER_MARKER = "data-ph-boot-recover";
|
|
232
279
|
const BOOT_RECOVER_KEY = "ph:sw-recover";
|
|
@@ -241,34 +288,166 @@ const STYLESHEET_LINK = /<link\b(?=[^>]*\brel=["']?stylesheet\b)[^>]*>/gi;
|
|
|
241
288
|
function deferStylesheet(link) {
|
|
242
289
|
return `${link.replace(/\brel=["']?stylesheet["']?/i, "rel=\"preload\" as=\"style\"").replace(/\/?>$/, ` onload="this.onload=null;this.rel='stylesheet'">`)}<noscript>${link}</noscript>`;
|
|
243
290
|
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
291
|
+
const region = (name, content) => `<!--ph-shell:${name}-->${content}<!--/ph-shell:${name}-->`;
|
|
292
|
+
const REGION = (name) => new RegExp(`<!--ph-shell:${name}-->[\\s\\S]*?<!--/ph-shell:${name}-->`);
|
|
293
|
+
/** The app's title without `connect.branding.appName`; core's `appTitle` fallback. */
|
|
294
|
+
const DEFAULT_APP_NAME = "Connect";
|
|
295
|
+
const APP_NAME = /(<!--ph-shell:app-name-->)[\s\S]*?(<!--\/ph-shell:app-name-->)/g;
|
|
296
|
+
const escapeHtml = (text) => text.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
297
|
+
/** Fills the shell's app name as the app resolves it: the branding name, else the default. */
|
|
298
|
+
function withShellAppName(html, appName) {
|
|
299
|
+
const name = escapeHtml(appName || "Connect");
|
|
300
|
+
return html.replace(APP_NAME, (_m, open, close) => [
|
|
301
|
+
open,
|
|
302
|
+
name,
|
|
303
|
+
close
|
|
304
|
+
].join(""));
|
|
305
|
+
}
|
|
306
|
+
/** Inlines `shell` into an empty `#root`, adds its critical CSS and, unless
|
|
307
|
+
* `deferStyles` is false, defers the stylesheets; React replaces the markup when the app renders. */
|
|
308
|
+
function injectAppShell(html, shell, base = "/", { deferStyles = true, appName } = {}) {
|
|
247
309
|
if (html.includes("data-ph-shell")) return html;
|
|
248
310
|
const root = /<div id="root"><\/div>/;
|
|
249
311
|
if (!root.test(html)) return html;
|
|
250
312
|
const firstSheet = html.search(STYLESHEET_LINK);
|
|
251
313
|
const at = firstSheet >= 0 ? firstSheet : html.indexOf("</head>");
|
|
252
314
|
const recover = `<script ${BOOT_RECOVER_MARKER}>${BOOT_RECOVER_SCRIPT}<\/script>`;
|
|
253
|
-
const body = rebaseShellLinks(shell.body, base);
|
|
254
|
-
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
315
|
+
const body = withShellAppName(rebaseShellLinks(shell.body, base), appName);
|
|
316
|
+
const withHead = html.slice(0, at) + region("head", shell.head) + recover + html.slice(at);
|
|
317
|
+
return (deferStyles ? withHead.replace(STYLESHEET_LINK, deferStylesheet) : withHead).replace(root, () => `<div id="root">${region("body", body)}</div>`);
|
|
318
|
+
}
|
|
319
|
+
/** The variant an index.html carries, from its shell's marker value. */
|
|
320
|
+
function appShellVariantOf(html) {
|
|
321
|
+
const head = REGION("head").exec(html)?.[0];
|
|
322
|
+
const value = head && new RegExp(`data-ph-shell="(\\w+)"`).exec(head);
|
|
323
|
+
if (!value) return void 0;
|
|
324
|
+
return value[1] === "core" ? "core" : "generic";
|
|
325
|
+
}
|
|
326
|
+
/** Replaces the shell an index.html carries with `shell`, titled `appName`; a page without one is unchanged. */
|
|
327
|
+
function swapAppShell(html, shell, base = "/", appName) {
|
|
328
|
+
if (!REGION("head").test(html) || !REGION("body").test(html)) return html;
|
|
329
|
+
const body = withShellAppName(rebaseShellLinks(shell.body, base), appName);
|
|
330
|
+
return html.replace(REGION("head"), () => region("head", shell.head)).replace(REGION("body"), () => region("body", body));
|
|
331
|
+
}
|
|
332
|
+
const DEV_SHELL_WAIT_MS = 1e4;
|
|
333
|
+
async function renderProjectAppShells(projectRoot, config, routeAliases) {
|
|
334
|
+
const server = await createServer({
|
|
335
|
+
configFile: false,
|
|
336
|
+
root: projectRoot,
|
|
337
|
+
logLevel: "error",
|
|
338
|
+
appType: "custom",
|
|
339
|
+
server: {
|
|
340
|
+
middlewareMode: true,
|
|
341
|
+
hmr: false,
|
|
342
|
+
ws: false
|
|
343
|
+
},
|
|
344
|
+
plugins: [react()],
|
|
345
|
+
resolve: {
|
|
346
|
+
alias: routeAliases,
|
|
347
|
+
dedupe: config.resolve.dedupe,
|
|
348
|
+
tsconfigPaths: true
|
|
349
|
+
},
|
|
350
|
+
define: config.define
|
|
351
|
+
});
|
|
352
|
+
try {
|
|
353
|
+
return await (await server.ssrLoadModule("@powerhousedao/connect/prerender")).renderProjectShells(join(projectRoot, "style.css"));
|
|
354
|
+
} finally {
|
|
355
|
+
await server.close();
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const sourceText = (source) => typeof source === "string" ? source : new TextDecoder().decode(source);
|
|
359
|
+
/** Build: the composition's shell in #root and every variant in the dist, from
|
|
360
|
+
* the project's routes when it has them. Dev: the shell from the project's routes
|
|
361
|
+
* when it has them, else core's for a core composition. */
|
|
362
|
+
function connectAppShellPlugin(projectRoot, { composition, appName, routeAliases, routesDir } = {}) {
|
|
363
|
+
let variant = "generic";
|
|
364
|
+
let shells = {};
|
|
365
|
+
let shellPlugins;
|
|
259
366
|
let base = "/";
|
|
367
|
+
let isBuild = true;
|
|
368
|
+
let config;
|
|
369
|
+
const fromRoutes = () => isBuild && !!routeAliases;
|
|
370
|
+
const shell = () => {
|
|
371
|
+
if (fromRoutes()) return void 0;
|
|
372
|
+
return isBuild || variant === "core" ? shells[variant] : void 0;
|
|
373
|
+
};
|
|
374
|
+
let devShells;
|
|
375
|
+
let devRender;
|
|
376
|
+
const renderDevShells = () => {
|
|
377
|
+
if (!config || !routeAliases) return;
|
|
378
|
+
const logger = config.logger;
|
|
379
|
+
devShells = renderProjectAppShells(projectRoot, config, routeAliases).catch((error) => {
|
|
380
|
+
logger.warn(`[connect] the loading shell failed to render from the project's routes: ${String(error)}`);
|
|
381
|
+
return {};
|
|
382
|
+
});
|
|
383
|
+
};
|
|
384
|
+
const devShell = async () => {
|
|
385
|
+
if (!devShells) return void 0;
|
|
386
|
+
let timer;
|
|
387
|
+
const wait = new Promise((resolve) => {
|
|
388
|
+
timer = setTimeout(() => resolve(void 0), DEV_SHELL_WAIT_MS);
|
|
389
|
+
});
|
|
390
|
+
try {
|
|
391
|
+
return (await Promise.race([devShells, wait]))?.[variant];
|
|
392
|
+
} finally {
|
|
393
|
+
clearTimeout(timer);
|
|
394
|
+
}
|
|
395
|
+
};
|
|
260
396
|
return {
|
|
261
397
|
name: "ph-connect-app-shell",
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
398
|
+
configureServer(server) {
|
|
399
|
+
if (!routeAliases) return;
|
|
400
|
+
renderDevShells();
|
|
401
|
+
const stylesheet = join(projectRoot, "style.css");
|
|
402
|
+
const rerender = (file) => {
|
|
403
|
+
if (!(file === stylesheet || !!routesDir && file.startsWith(`${routesDir}${sep}`))) return;
|
|
404
|
+
clearTimeout(devRender);
|
|
405
|
+
devRender = setTimeout(renderDevShells, 300);
|
|
406
|
+
};
|
|
407
|
+
server.watcher.on("change", rerender);
|
|
408
|
+
server.watcher.on("add", rerender);
|
|
409
|
+
server.watcher.on("unlink", rerender);
|
|
265
410
|
},
|
|
266
|
-
|
|
267
|
-
|
|
411
|
+
configResolved(resolved) {
|
|
412
|
+
config = resolved;
|
|
413
|
+
base = resolved.base;
|
|
414
|
+
isBuild = resolved.command === "build";
|
|
415
|
+
shells = readAppShells(projectRoot);
|
|
416
|
+
shellPlugins = readShellPlugins(projectRoot);
|
|
417
|
+
variant = appShellVariant(composition, shellPlugins);
|
|
268
418
|
},
|
|
269
419
|
transformIndexHtml: {
|
|
270
420
|
order: "post",
|
|
271
|
-
handler: (html) =>
|
|
421
|
+
handler: async (html) => {
|
|
422
|
+
const current = !isBuild && routeAliases ? await devShell() : shell();
|
|
423
|
+
return current ? injectAppShell(html, current, base, {
|
|
424
|
+
deferStyles: isBuild,
|
|
425
|
+
appName
|
|
426
|
+
}) : html;
|
|
427
|
+
}
|
|
428
|
+
},
|
|
429
|
+
generateBundle: {
|
|
430
|
+
order: "post",
|
|
431
|
+
async handler(_options, bundle) {
|
|
432
|
+
if (!isBuild) return;
|
|
433
|
+
if (fromRoutes() && config && routeAliases) {
|
|
434
|
+
shells = await renderProjectAppShells(projectRoot, config, routeAliases);
|
|
435
|
+
const index = bundle["index.html"];
|
|
436
|
+
const current = shells[variant];
|
|
437
|
+
if (index?.type === "asset" && current) index.source = injectAppShell(sourceText(index.source), current, base, { appName });
|
|
438
|
+
}
|
|
439
|
+
if (!Object.keys(shells).length) return;
|
|
440
|
+
this.emitFile({
|
|
441
|
+
type: "asset",
|
|
442
|
+
fileName: APP_SHELLS_FILE,
|
|
443
|
+
source: JSON.stringify(shells)
|
|
444
|
+
});
|
|
445
|
+
if (shellPlugins) this.emitFile({
|
|
446
|
+
type: "asset",
|
|
447
|
+
fileName: SHELL_PLUGINS_FILE,
|
|
448
|
+
source: JSON.stringify(shellPlugins)
|
|
449
|
+
});
|
|
450
|
+
}
|
|
272
451
|
}
|
|
273
452
|
};
|
|
274
453
|
}
|
|
@@ -348,11 +527,28 @@ const HOST_ROUTES_DIR = "hosts/connect/routes";
|
|
|
348
527
|
const CONNECT_ROUTES_GEN = ".ph/connect-routes.gen.ts";
|
|
349
528
|
/** Connect's dist imports its route tree by this specifier. */
|
|
350
529
|
const ROUTE_TREE_SPECIFIER = "@powerhousedao/connect/route-tree";
|
|
351
|
-
/**
|
|
352
|
-
|
|
530
|
+
/** Core's types name the app's tree by this one; both resolve to one tree. */
|
|
531
|
+
const CORE_ROUTE_TREE_SPECIFIER = "@powerhousedao/connect-core/route-tree";
|
|
532
|
+
const ROUTE_TREE_FIND = new RegExp(`^(${[ROUTE_TREE_SPECIFIER, CORE_ROUTE_TREE_SPECIFIER].map(escapeRegExp).join("|")})$`);
|
|
533
|
+
/** A host's routes folder: `routes` (a host's `runner.routes`), relative to the
|
|
534
|
+
* project, else `hosts/connect/routes/`; undefined if none or `false`. */
|
|
535
|
+
function resolveConnectRoutesDir(projectRoot, routes) {
|
|
536
|
+
if (routes === false) return void 0;
|
|
537
|
+
if (routes !== void 0) {
|
|
538
|
+
const dir = resolve(projectRoot, routes);
|
|
539
|
+
if (!existsSync(dir)) throw new Error(`The routes folder ${routes} does not exist.`);
|
|
540
|
+
return dir;
|
|
541
|
+
}
|
|
353
542
|
const dir = join(projectRoot, HOST_ROUTES_DIR);
|
|
354
543
|
return existsSync(dir) ? dir : void 0;
|
|
355
544
|
}
|
|
545
|
+
const isDefaultRoutesDir = (projectRoot, routesDir) => resolve(routesDir) === join(resolve(projectRoot), HOST_ROUTES_DIR);
|
|
546
|
+
/** The tree generated from `routesDir`: `.ph/connect-routes.gen.ts` for
|
|
547
|
+
* `hosts/connect/routes/`, else `.ph/<folder>.gen.ts`. */
|
|
548
|
+
function connectRoutesTreeOf(projectRoot, routesDir) {
|
|
549
|
+
if (isDefaultRoutesDir(projectRoot, routesDir)) return join(projectRoot, CONNECT_ROUTES_GEN);
|
|
550
|
+
return join(projectRoot, ".ph", `${relative(projectRoot, routesDir)}.gen.ts`);
|
|
551
|
+
}
|
|
356
552
|
/** Connect's pathless sidebar layout; a project's routes in `_app/` render in it. */
|
|
357
553
|
const APP_LAYOUT = "_app";
|
|
358
554
|
function findRouteFile(dir, name) {
|
|
@@ -363,17 +559,144 @@ function findRouteFile(dir, name) {
|
|
|
363
559
|
".js"
|
|
364
560
|
].map((ext) => join(dir, `${name}${ext}`)).find((file) => existsSync(file));
|
|
365
561
|
}
|
|
366
|
-
/**
|
|
562
|
+
/** Connect's route files: core's routes with Connect's views. */
|
|
563
|
+
function connectRoutesDirOf(connectDir) {
|
|
564
|
+
return join(connectDir, "src/routes");
|
|
565
|
+
}
|
|
566
|
+
const ROUTE_FILE = /\.[cm]?[jt]sx?$/;
|
|
567
|
+
const isRouteEntry = (name) => !name.startsWith(".") && !name.startsWith("-");
|
|
568
|
+
/** The route files under `dir`, by path relative to it. */
|
|
569
|
+
function routeFilesIn(dir, at = "") {
|
|
570
|
+
if (!existsSync(dir)) return [];
|
|
571
|
+
return readdirSync(join(dir, at), { withFileTypes: true }).filter((entry) => isRouteEntry(entry.name)).flatMap((entry) => {
|
|
572
|
+
const path = at ? `${at}/${entry.name}` : entry.name;
|
|
573
|
+
if (entry.isDirectory()) return routeFilesIn(dir, path);
|
|
574
|
+
return ROUTE_FILE.test(entry.name) ? [path] : [];
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
/** A route file's id below its folder: route groups and `route` files
|
|
578
|
+
* resolved, flat `a.b` names read as folders. */
|
|
579
|
+
function routeIdOf(file) {
|
|
580
|
+
const segments = file.replace(ROUTE_FILE, "").split("/").filter((segment) => !/^\(.+\)$/.test(segment));
|
|
581
|
+
if (segments.at(-1) === "route") segments.pop();
|
|
582
|
+
return segments.join("/").replaceAll(".", "/");
|
|
583
|
+
}
|
|
584
|
+
/** Connect's `_app/` route files that a project file at the same id replaces. */
|
|
585
|
+
function overriddenConnectRoutes(connectAppDir, projectAppDir) {
|
|
586
|
+
const projectIds = new Set(routeFilesIn(projectAppDir).map(routeIdOf));
|
|
587
|
+
return new Set(routeFilesIn(connectAppDir).filter((file) => projectIds.has(routeIdOf(file))));
|
|
588
|
+
}
|
|
589
|
+
const stemOf = (name) => name.replace(ROUTE_FILE, "");
|
|
590
|
+
/** Mounts Connect's routes in `dir` without the `overridden` files: a folder
|
|
591
|
+
* whole when none is in it, else file by file. */
|
|
592
|
+
function mountConnectRoutes(routesDirectory, dir, overridden, prefix = "") {
|
|
593
|
+
if (![...overridden].some((file) => file.startsWith(`${dir}/`))) return [physical(prefix, dir)];
|
|
594
|
+
const entries = readdirSync(join(routesDirectory, dir), { withFileTypes: true }).filter((entry) => isRouteEntry(entry.name));
|
|
595
|
+
const files = entries.filter((entry) => entry.isFile() && ROUTE_FILE.test(entry.name)).map((entry) => entry.name);
|
|
596
|
+
const folders = entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
|
|
597
|
+
const at = (name) => prefix ? `${prefix}/${name}` : name;
|
|
598
|
+
const nodes = [];
|
|
599
|
+
for (const name of files) {
|
|
600
|
+
const file = `${dir}/${name}`;
|
|
601
|
+
const stem = stemOf(name);
|
|
602
|
+
const folder = folders.includes(stem) ? `${dir}/${stem}` : void 0;
|
|
603
|
+
if (overridden.has(file)) {
|
|
604
|
+
if (folder) nodes.push(physical(at(stem), folder));
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
607
|
+
const children = folder && mountConnectRoutes(routesDirectory, folder, overridden);
|
|
608
|
+
if (stem === "index") nodes.push(prefix ? route(`${prefix}/`, file) : index(file));
|
|
609
|
+
else if (!prefix && stem.startsWith("_")) nodes.push(layout(stem, file, children || []));
|
|
610
|
+
else nodes.push(children ? route(at(stem), file, children) : route(at(stem), file));
|
|
611
|
+
}
|
|
612
|
+
for (const name of folders) {
|
|
613
|
+
if (files.some((file) => stemOf(file) === name)) continue;
|
|
614
|
+
nodes.push(...mountConnectRoutes(routesDirectory, `${dir}/${name}`, overridden, at(name)));
|
|
615
|
+
}
|
|
616
|
+
return nodes;
|
|
617
|
+
}
|
|
618
|
+
/** The routes a package offers other Connects, as `ph build` publishes them
|
|
619
|
+
* (`./connect-routes`); generated beside the route tree. */
|
|
620
|
+
const PACKAGE_ROUTES_MODULE = ".ph/connect-routes.package.ts";
|
|
621
|
+
/** Writes the package's routes for registerPackageRoutes: its files but its
|
|
622
|
+
* `_app` layout and its overrides of Connect's `_app/` routes, parents first. */
|
|
623
|
+
function writePackageRoutesModule(projectRoot, projectRoutes, routeNodes, options) {
|
|
624
|
+
const module = join(projectRoot, PACKAGE_ROUTES_MODULE);
|
|
625
|
+
const appDir = join(projectRoutes, APP_LAYOUT);
|
|
626
|
+
const offered = routeNodes.map((node) => ({
|
|
627
|
+
node,
|
|
628
|
+
file: join(options.routesDirectory, node.filePath)
|
|
629
|
+
})).filter(({ node, file }) => {
|
|
630
|
+
if (!file.startsWith(`${projectRoutes}${sep}`)) return false;
|
|
631
|
+
if (node.routePath === `/_app`) return false;
|
|
632
|
+
if (!file.startsWith(`${appDir}${sep}`)) return true;
|
|
633
|
+
const id = routeIdOf(relative(appDir, file).split(sep).join("/"));
|
|
634
|
+
return !options.connectAppIds.has(id);
|
|
635
|
+
}).sort((a, b) => (a.node.routePath ?? "").split("/").length - (b.node.routePath ?? "").split("/").length);
|
|
636
|
+
if (offered.length === 0) {
|
|
637
|
+
rmSync(module, { force: true });
|
|
638
|
+
return;
|
|
639
|
+
}
|
|
640
|
+
const from = (file) => {
|
|
641
|
+
return relative(dirname(module), file).split(sep).join("/").replace(ROUTE_FILE, ".js");
|
|
642
|
+
};
|
|
643
|
+
const lines = [
|
|
644
|
+
"// Generated by ph build: the routes this package offers other Connects.",
|
|
645
|
+
"import type { PackageRoute } from \"@powerhousedao/connect-core/router\";",
|
|
646
|
+
...offered.map(({ file }, i) => `import { Route as r${i} } from "${from(file)}";`),
|
|
647
|
+
"",
|
|
648
|
+
"export const connectRoutes: PackageRoute[] = [",
|
|
649
|
+
...offered.map(({ node }, i) => {
|
|
650
|
+
const pathless = node._fsRouteType === "pathless_layout";
|
|
651
|
+
const entry = {
|
|
652
|
+
id: node.routePath,
|
|
653
|
+
...pathless ? {} : { path: node.path },
|
|
654
|
+
parentId: node.parent?.routePath ?? "__root__"
|
|
655
|
+
};
|
|
656
|
+
return ` { route: r${i}, ${Object.entries(entry).map(([key, value]) => `${key}: ${JSON.stringify(value)}`).join(", ")} },`;
|
|
657
|
+
}),
|
|
658
|
+
"];",
|
|
659
|
+
""
|
|
660
|
+
];
|
|
661
|
+
mkdirSync(dirname(module), { recursive: true });
|
|
662
|
+
const text = lines.join("\n");
|
|
663
|
+
if (!existsSync(module) || readFileSync(module, "utf8") !== text) writeFileSync(module, text);
|
|
664
|
+
}
|
|
665
|
+
/** The router plugin's config: Connect's root and routes, and the project's. */
|
|
367
666
|
function connectRoutesGeneratorConfig(connectDir, projectRoot, projectRoutes) {
|
|
368
|
-
const routesDirectory =
|
|
667
|
+
const routesDirectory = connectRoutesDirOf(connectDir);
|
|
369
668
|
const fromRoutes = (path) => relative(routesDirectory, path);
|
|
370
|
-
const
|
|
371
|
-
|
|
669
|
+
const virtualRouteConfig = () => {
|
|
670
|
+
const appLayout = findRouteFile(projectRoutes, APP_LAYOUT);
|
|
671
|
+
const appRoutes = join(projectRoutes, APP_LAYOUT);
|
|
672
|
+
const overridden = new Set([...overriddenConnectRoutes(join(routesDirectory, APP_LAYOUT), appRoutes)].map((file) => `${APP_LAYOUT}/${file}`));
|
|
673
|
+
return rootRoute("__root.tsx", [layout(APP_LAYOUT, appLayout ? fromRoutes(appLayout) : `${APP_LAYOUT}.tsx`, [...mountConnectRoutes(routesDirectory, APP_LAYOUT, overridden), ...existsSync(appRoutes) ? [physical("", fromRoutes(appRoutes))] : []]), physical("", fromRoutes(projectRoutes))]);
|
|
674
|
+
};
|
|
675
|
+
const overrides = {
|
|
676
|
+
name: "ph-connect-route-overrides",
|
|
677
|
+
init: ({ generator }) => {
|
|
678
|
+
Object.defineProperty(generator.config, "virtualRouteConfig", {
|
|
679
|
+
get: virtualRouteConfig,
|
|
680
|
+
configurable: true,
|
|
681
|
+
enumerable: true
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
};
|
|
685
|
+
const offers = isDefaultRoutesDir(projectRoot, projectRoutes);
|
|
372
686
|
return getConfig({
|
|
373
687
|
target: "react",
|
|
374
688
|
routesDirectory,
|
|
375
|
-
generatedRouteTree:
|
|
376
|
-
virtualRouteConfig:
|
|
689
|
+
generatedRouteTree: connectRoutesTreeOf(projectRoot, projectRoutes),
|
|
690
|
+
virtualRouteConfig: virtualRouteConfig(),
|
|
691
|
+
plugins: offers ? [overrides, {
|
|
692
|
+
name: "ph-connect-offered-routes",
|
|
693
|
+
onRouteTreeChanged: ({ routeNodes }) => {
|
|
694
|
+
writePackageRoutesModule(projectRoot, projectRoutes, routeNodes, {
|
|
695
|
+
routesDirectory,
|
|
696
|
+
connectAppIds: new Set(routeFilesIn(join(routesDirectory, APP_LAYOUT)).map(routeIdOf))
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
}] : [overrides],
|
|
377
700
|
routeFileIgnorePattern: `^${APP_LAYOUT}(\\.[cm]?[jt]sx?)?$`,
|
|
378
701
|
quoteStyle: "double",
|
|
379
702
|
semicolons: true,
|
|
@@ -391,7 +714,7 @@ function connectRoutesGeneratorConfig(connectDir, projectRoot, projectRoutes) {
|
|
|
391
714
|
}, projectRoot);
|
|
392
715
|
}
|
|
393
716
|
/** Writes the route tree of Connect's and the project's routes; throws on a
|
|
394
|
-
* collision
|
|
717
|
+
* collision that is not an override, which the router plugin would only log. */
|
|
395
718
|
async function generateConnectRoutes(projectRoot, routesDir, config = connectRoutesGeneratorConfig(connectDirOf(projectRoot), projectRoot, routesDir)) {
|
|
396
719
|
mkdirSync(dirname(config.generatedRouteTree), { recursive: true });
|
|
397
720
|
try {
|
|
@@ -400,16 +723,17 @@ async function generateConnectRoutes(projectRoot, routesDir, config = connectRou
|
|
|
400
723
|
root: projectRoot
|
|
401
724
|
}).run();
|
|
402
725
|
assertNoDuplicateRoutes(config.generatedRouteTree);
|
|
403
|
-
|
|
726
|
+
importConnectRoutesByPackage(config.generatedRouteTree, config.routesDirectory);
|
|
404
727
|
} catch (error) {
|
|
405
728
|
const message = (Array.isArray(error) ? error : [error]).map((e) => e instanceof Error ? e.message : String(e)).join("\n");
|
|
406
729
|
const shown = relative(projectRoot, routesDir).split(sep).join("/");
|
|
407
730
|
throw new Error(`Connect could not mount the routes in ${shown}/:\n${message}`, { cause: error });
|
|
408
731
|
}
|
|
409
732
|
}
|
|
410
|
-
/** Connect's route files, as the generated tree imports them
|
|
733
|
+
/** Connect's route files, as the generated tree imports them: by Connect's
|
|
734
|
+
* package name, which a project depends on. */
|
|
411
735
|
const CONNECT_ROUTES_SPECIFIER = "@powerhousedao/connect/routes";
|
|
412
|
-
function
|
|
736
|
+
function importConnectRoutesByPackage(treeFile, routesDirectory) {
|
|
413
737
|
const prefix = `"./${relative(dirname(treeFile), routesDirectory).split(sep).join("/")}/`;
|
|
414
738
|
const tree = readFileSync(treeFile, "utf8");
|
|
415
739
|
const rewritten = tree.replace(new RegExp(`${escapeRegExp(prefix)}([^"]+)\\.js"`, "g"), `"${CONNECT_ROUTES_SPECIFIER}/$1"`);
|
|
@@ -429,23 +753,26 @@ function escapeRegExp(text) {
|
|
|
429
753
|
/** Generates the tree when the project has routes, else drops a stale one. */
|
|
430
754
|
async function syncConnectRoutes(projectRoot, routesDir = resolveConnectRoutesDir(projectRoot)) {
|
|
431
755
|
if (routesDir) await generateConnectRoutes(projectRoot, routesDir);
|
|
432
|
-
else
|
|
756
|
+
else {
|
|
757
|
+
rmSync(join(projectRoot, CONNECT_ROUTES_GEN), { force: true });
|
|
758
|
+
rmSync(join(projectRoot, PACKAGE_ROUTES_MODULE), { force: true });
|
|
759
|
+
}
|
|
433
760
|
}
|
|
434
761
|
function connectDirOf(projectRoot) {
|
|
435
762
|
return dirname(resolvePackage("@powerhousedao/connect/package.json", projectRoot));
|
|
436
763
|
}
|
|
437
|
-
/** Mounts a project's routes folder
|
|
438
|
-
* Connect keeps its prebuilt
|
|
764
|
+
/** Mounts a project's routes folder over Connect's routes; without one,
|
|
765
|
+
* Connect keeps its prebuilt tree and no router plugin runs. */
|
|
439
766
|
function connectRoutes(projectRoot, routesDir = resolveConnectRoutesDir(projectRoot)) {
|
|
440
767
|
const connectDir = connectDirOf(projectRoot);
|
|
441
|
-
const find =
|
|
768
|
+
const find = ROUTE_TREE_FIND;
|
|
442
769
|
if (!routesDir) {
|
|
443
|
-
rmSync(join(projectRoot, CONNECT_ROUTES_GEN), { force: true });
|
|
770
|
+
if (!resolveConnectRoutesDir(projectRoot)) rmSync(join(projectRoot, CONNECT_ROUTES_GEN), { force: true });
|
|
444
771
|
return {
|
|
445
|
-
|
|
772
|
+
aliases: [{
|
|
446
773
|
find,
|
|
447
774
|
replacement: join(connectDir, "dist/route-tree.js")
|
|
448
|
-
},
|
|
775
|
+
}],
|
|
449
776
|
plugins: [],
|
|
450
777
|
dedupe: []
|
|
451
778
|
};
|
|
@@ -453,10 +780,13 @@ function connectRoutes(projectRoot, routesDir = resolveConnectRoutesDir(projectR
|
|
|
453
780
|
const config = connectRoutesGeneratorConfig(connectDir, projectRoot, routesDir);
|
|
454
781
|
mkdirSync(dirname(config.generatedRouteTree), { recursive: true });
|
|
455
782
|
return {
|
|
456
|
-
|
|
783
|
+
aliases: [{
|
|
457
784
|
find,
|
|
458
785
|
replacement: config.generatedRouteTree
|
|
459
|
-
},
|
|
786
|
+
}, {
|
|
787
|
+
find: /^@powerhousedao\/connect\/route-views$/,
|
|
788
|
+
replacement: join(connectDir, "dist/route-views.js")
|
|
789
|
+
}],
|
|
460
790
|
plugins: [{
|
|
461
791
|
name: "ph-connect-routes-check",
|
|
462
792
|
buildStart: () => generateConnectRoutes(projectRoot, routesDir, config)
|
|
@@ -611,8 +941,18 @@ const DEFAULT_VENDOR_INCLUDE = [
|
|
|
611
941
|
"zod",
|
|
612
942
|
"@powerhousedao/design-system/connect",
|
|
613
943
|
"@powerhousedao/reactor-browser",
|
|
614
|
-
"@powerhousedao/document-engineering"
|
|
944
|
+
"@powerhousedao/document-engineering",
|
|
945
|
+
"@powerhousedao/connect-core",
|
|
946
|
+
"@tanstack/react-router"
|
|
615
947
|
];
|
|
948
|
+
/** Never vendored: the route tree is the project's, the config path the app's
|
|
949
|
+
* base, and SSR server-only. */
|
|
950
|
+
const VENDOR_SKIP_SUBPATHS = /* @__PURE__ */ new Set([
|
|
951
|
+
"@powerhousedao/connect-core/route-tree",
|
|
952
|
+
"@powerhousedao/connect-core/runtime-config",
|
|
953
|
+
"@tanstack/react-router/ssr/client",
|
|
954
|
+
"@tanstack/react-router/ssr/server"
|
|
955
|
+
]);
|
|
616
956
|
/**
|
|
617
957
|
* React-family specifiers kept external to the vendor build. The vendor's chunks
|
|
618
958
|
* emit bare imports for these; `devReactImportmapPlugin`'s import map resolves
|
|
@@ -979,7 +1319,8 @@ function expandIncludeSubpaths(dirname, include) {
|
|
|
979
1319
|
const target = importTarget$1(expMap[key]);
|
|
980
1320
|
if (!target || /\.(css|json|scss)$/.test(target)) continue;
|
|
981
1321
|
if (!existsSync(join(pkgRoot, target))) continue;
|
|
982
|
-
|
|
1322
|
+
const expanded = key === "." ? pkg : pkg + key.slice(1);
|
|
1323
|
+
if (!VENDOR_SKIP_SUBPATHS.has(expanded)) out.add(expanded);
|
|
983
1324
|
}
|
|
984
1325
|
}
|
|
985
1326
|
return [...out];
|
|
@@ -2078,6 +2419,10 @@ function readBundledPackageVersion(projectRoot, name) {
|
|
|
2078
2419
|
return;
|
|
2079
2420
|
}
|
|
2080
2421
|
}
|
|
2422
|
+
function offeredRoutesFile(projectRoot, name) {
|
|
2423
|
+
const file = path.join(projectRoot, "node_modules", name, "dist/browser/connect-routes.js");
|
|
2424
|
+
return fs.existsSync(file) ? file : void 0;
|
|
2425
|
+
}
|
|
2081
2426
|
function makeRegisterModule(packages, projectRoot) {
|
|
2082
2427
|
if (packages.length === 0) return "export default () => {};\n";
|
|
2083
2428
|
const imports = [];
|
|
@@ -2087,7 +2432,9 @@ function makeRegisterModule(packages, projectRoot) {
|
|
|
2087
2432
|
const version = readBundledPackageVersion(projectRoot, name);
|
|
2088
2433
|
imports.push(`import * as ${moduleName} from ${JSON.stringify(name)};`);
|
|
2089
2434
|
imports.push(`import ${JSON.stringify(`${name}/style.css`)};`);
|
|
2090
|
-
|
|
2435
|
+
const routesFile = offeredRoutesFile(projectRoot, name);
|
|
2436
|
+
const routes = routesFile ? `, () => import(${JSON.stringify(routesFile)})` : "";
|
|
2437
|
+
calls.push(` pm.addLocalPackage(${JSON.stringify(name)}, ${moduleName}, ${JSON.stringify(version)}${routes});`);
|
|
2091
2438
|
});
|
|
2092
2439
|
return `${imports.join("\n")}\n\nexport default function register(pm) {\n${calls.join("\n")}\n};\n`;
|
|
2093
2440
|
}
|
|
@@ -2370,6 +2717,8 @@ function withAppTitle(html, appName) {
|
|
|
2370
2717
|
const escaped = appName.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">");
|
|
2371
2718
|
return html.replace(/<title>[^<]*<\/title>/, () => `<title>${escaped}</title>`);
|
|
2372
2719
|
}
|
|
2720
|
+
/** `api.connect`: the connect config the app is served, for plugins that render
|
|
2721
|
+
* ahead of it; `api.favicon`: its `branding.favicon`, which it leaves out. */
|
|
2373
2722
|
function phConfigPlugin(options) {
|
|
2374
2723
|
const localPackage = readProjectPackageInfo(options.projectRoot ?? process.cwd());
|
|
2375
2724
|
const sourceSettings = {
|
|
@@ -2380,10 +2729,14 @@ function phConfigPlugin(options) {
|
|
|
2380
2729
|
if (conflict) console.warn(`[powerhouse] ${conflict}`);
|
|
2381
2730
|
const withDefaults = resolveSourceConnect(sourceSettings);
|
|
2382
2731
|
const mergedConnect = options.cliConnectOverride ? deepMerge(withDefaults, options.cliConnectOverride) : withDefaults;
|
|
2732
|
+
const { favicon, ...branding } = mergedConnect.branding ?? {};
|
|
2383
2733
|
const source = {
|
|
2384
2734
|
packages: options.packages,
|
|
2385
2735
|
packageRegistryUrl: options.packageRegistryUrl,
|
|
2386
|
-
connect: mergedConnect
|
|
2736
|
+
connect: mergedConnect.branding ? {
|
|
2737
|
+
...mergedConnect,
|
|
2738
|
+
branding
|
|
2739
|
+
} : mergedConnect
|
|
2387
2740
|
};
|
|
2388
2741
|
const runtimeConfig = buildRuntimeConfig(source, localPackage);
|
|
2389
2742
|
const content = JSON.stringify({
|
|
@@ -2392,6 +2745,10 @@ function phConfigPlugin(options) {
|
|
|
2392
2745
|
}, null, 2);
|
|
2393
2746
|
return {
|
|
2394
2747
|
name: "vite-plugin-ph-config",
|
|
2748
|
+
api: {
|
|
2749
|
+
connect: runtimeConfig.connect,
|
|
2750
|
+
favicon: favicon ?? void 0
|
|
2751
|
+
},
|
|
2395
2752
|
configureServer(server) {
|
|
2396
2753
|
server.middlewares.use((req, res, next) => {
|
|
2397
2754
|
if (req.url?.endsWith("/powerhouse.config.json")) {
|
|
@@ -3310,6 +3667,15 @@ function getConnectBaseViteConfig(options) {
|
|
|
3310
3667
|
const phPackages = (phPackagesStr ? parsePackagesEnvOverride(phPackagesStr) : void 0) ?? packagesFromConfig;
|
|
3311
3668
|
const phPackageRegistryUrl = options.cliPackageRegistryUrl ?? phConfig.packageRegistryUrl ?? null;
|
|
3312
3669
|
const connectBasePath = options.cliConnectOverride?.app?.basePath ?? phConfig.connect?.app?.basePath;
|
|
3670
|
+
const configPlugin = phConfigPlugin({
|
|
3671
|
+
packages: phPackages,
|
|
3672
|
+
projectRoot: options.dirname,
|
|
3673
|
+
connect: phConfig.connect,
|
|
3674
|
+
workflows: phConfig.workflows,
|
|
3675
|
+
packageRegistryUrl: phPackageRegistryUrl ?? void 0,
|
|
3676
|
+
cliConnectOverride: options.cliConnectOverride
|
|
3677
|
+
});
|
|
3678
|
+
const servedConnect = configPlugin.api.connect;
|
|
3313
3679
|
const offlineEnabled = options.cliConnectOverride?.app?.offline ?? phConfig.connect?.app?.offline ?? true;
|
|
3314
3680
|
const authToken = env.PH_SENTRY_AUTH_TOKEN;
|
|
3315
3681
|
const org = env.PH_SENTRY_ORG;
|
|
@@ -3391,7 +3757,7 @@ function getConnectBaseViteConfig(options) {
|
|
|
3391
3757
|
return null;
|
|
3392
3758
|
}
|
|
3393
3759
|
}).filter((p) => p !== null);
|
|
3394
|
-
const routesDir = resolveConnectRoutesDir(options.dirname);
|
|
3760
|
+
const routesDir = resolveConnectRoutesDir(options.dirname, options.routes) ?? false;
|
|
3395
3761
|
const routes = connectRoutes(options.dirname, routesDir);
|
|
3396
3762
|
return {
|
|
3397
3763
|
configFile: false,
|
|
@@ -3402,7 +3768,7 @@ function getConnectBaseViteConfig(options) {
|
|
|
3402
3768
|
fs: { allow: [searchForWorkspaceRoot(options.dirname), ...linkedRoots] }
|
|
3403
3769
|
},
|
|
3404
3770
|
resolve: {
|
|
3405
|
-
alias:
|
|
3771
|
+
alias: routes.aliases,
|
|
3406
3772
|
dedupe: [
|
|
3407
3773
|
"react",
|
|
3408
3774
|
"react-dom",
|
|
@@ -3429,14 +3795,7 @@ function getConnectBaseViteConfig(options) {
|
|
|
3429
3795
|
exclude: ["@electric-sql/pglite", "@electric-sql/pglite-tools"]
|
|
3430
3796
|
},
|
|
3431
3797
|
plugins: [
|
|
3432
|
-
|
|
3433
|
-
packages: phPackages,
|
|
3434
|
-
projectRoot: options.dirname,
|
|
3435
|
-
connect: phConfig.connect,
|
|
3436
|
-
workflows: phConfig.workflows,
|
|
3437
|
-
packageRegistryUrl: phPackageRegistryUrl ?? void 0,
|
|
3438
|
-
cliConnectOverride: options.cliConnectOverride
|
|
3439
|
-
}),
|
|
3798
|
+
configPlugin,
|
|
3440
3799
|
phBundledPackagesPlugin({
|
|
3441
3800
|
packages: localPackagesFromConfig,
|
|
3442
3801
|
projectRoot: options.dirname
|
|
@@ -3451,9 +3810,14 @@ function getConnectBaseViteConfig(options) {
|
|
|
3451
3810
|
dev: mode !== "production" || isDebug
|
|
3452
3811
|
}),
|
|
3453
3812
|
...options.vendor && mode === "production" ? [vendorImportMapPlugin({ imports: options.vendor.imports })] : [],
|
|
3454
|
-
connectFaviconPlugin({ faviconPath: options.favicon }),
|
|
3813
|
+
connectFaviconPlugin({ faviconPath: options.favicon ?? configPlugin.api.favicon }),
|
|
3455
3814
|
connectThemeBootPlugin(),
|
|
3456
|
-
connectAppShellPlugin(options.dirname
|
|
3815
|
+
connectAppShellPlugin(options.dirname, {
|
|
3816
|
+
composition: servedConnect.composition,
|
|
3817
|
+
appName: servedConnect.branding?.appName,
|
|
3818
|
+
routeAliases: routesDir ? routes.aliases : void 0,
|
|
3819
|
+
routesDir: routesDir || void 0
|
|
3820
|
+
}),
|
|
3457
3821
|
connectBuildHashPlugin(buildHash),
|
|
3458
3822
|
...options.dynamicBase ? [connectDynamicBasePlugin()] : [],
|
|
3459
3823
|
pwaPlugins
|
|
@@ -3472,6 +3836,6 @@ function getConnectBaseViteConfig(options) {
|
|
|
3472
3836
|
};
|
|
3473
3837
|
}
|
|
3474
3838
|
//#endregion
|
|
3475
|
-
export { APP_LAYOUT, APP_SHELL_MARKER, BOOT_RECOVER_KEY, BOOT_RECOVER_MARKER, BOOT_RECOVER_SCRIPT, BUILDER_TOOLS_VERSION, BUILD_HASH_FILE, CONNECT_ROUTES_GEN, CONNECT_ROUTES_SPECIFIER, DEFAULT_CONNECT_OUTDIR, DEFAULT_VENDOR_INCLUDE, DYNAMIC_BASE_PLACEHOLDER, EXTERNAL_PACKAGES_IMPORT, HOST_ROUTES_DIR, IMPORT_SCRIPT_FILE, LOCAL_PACKAGE_ID, LOCK_STALE_MS, PH_DIR_NAME, REACTOR_WORKER_ENTRY, REACTOR_WORKER_MIME, REACTOR_WORKER_URL_PREFIX, ROUTE_TREE_SPECIFIER, RUNTIME_CONFIG_SCHEMA_ID, RUNTIME_CONFIG_SCHEMA_URL, THEME_BOOT_MARKER, VENDOR_EXTERNAL, VENDOR_URL_PREFIX, WORKER_PACKAGES_MANIFEST, acquireLock, appendToHtmlHead, backupIndexHtml, buildHashFromBuildOptions, computeBuildHash, computeSourceDigest, connectAppShellPlugin, connectBuildHashPlugin, connectDynamicBasePlugin, connectRouterChunkGroups, connectRoutes, connectRoutesGeneratorConfig, connectThemeBootPlugin, copyConnect, directoryContentDigest, distDirFingerprint, ensureNodeVersion, escapeForRegExp, findBundleSpecifierOffenders, findDisallowedSpecifiers, findPackageRoot, findWorkerUnsafeMarkers, generateConnectRoutes, getConnectBaseViteConfig, getConnectHtmlTags, injectAppShell, linkedBuildStamp, makeImportScriptFromPackages, missingVendorEntries, ownProjectPackage, phConfigPlugin, prebuildConnectVendor, prebuildReactorWorker, prebuildWorkerPackages, prependToHtmlHead, publishDirAtomic, readAppShell, readJsonFile, rebaseShellLinks, relativeCssUrls, releaseLock, removeBase64EnvValues, resolveConnectBundle, resolveConnectPackageJson, resolveConnectPublicDir, resolveConnectRoutesDir, resolveOwnDeps, resolveOwnPackageVersion, resolvePackage, resolveReactorWorkerSource, resolveVersionDigest, resolveViteConfigPath, resolveWorkspacePackageDir, runShellScriptPlugin, runTsc, runWorkerBuildEntries, runtimeConfigSchema, stripVersionFromPackage, syncConnectRoutes, upstreamWorkerPackages, vendorImportMapPlugin, vendorRelativePath, withAppTitle, withVendorBase, workerSafeVendorImports };
|
|
3839
|
+
export { APP_LAYOUT, APP_SHELLS_FILE, APP_SHELL_MARKER, BOOT_RECOVER_KEY, BOOT_RECOVER_MARKER, BOOT_RECOVER_SCRIPT, BUILDER_TOOLS_VERSION, BUILD_HASH_FILE, CONNECT_ROUTES_GEN, CONNECT_ROUTES_SPECIFIER, CORE_ROUTE_TREE_SPECIFIER, DEFAULT_APP_NAME, DEFAULT_CONNECT_OUTDIR, DEFAULT_VENDOR_INCLUDE, DYNAMIC_BASE_PLACEHOLDER, EXTERNAL_PACKAGES_IMPORT, HOST_ROUTES_DIR, IMPORT_SCRIPT_FILE, LOCAL_PACKAGE_ID, LOCK_STALE_MS, PACKAGE_ROUTES_MODULE, PH_DIR_NAME, REACTOR_WORKER_ENTRY, REACTOR_WORKER_MIME, REACTOR_WORKER_URL_PREFIX, ROUTE_TREE_SPECIFIER, RUNTIME_CONFIG_SCHEMA_ID, RUNTIME_CONFIG_SCHEMA_URL, SHELL_PLUGINS_FILE, THEME_BOOT_MARKER, VENDOR_EXTERNAL, VENDOR_SKIP_SUBPATHS, VENDOR_URL_PREFIX, WORKER_PACKAGES_MANIFEST, acquireLock, appShellVariant, appShellVariantOf, appendToHtmlHead, backupIndexHtml, buildHashFromBuildOptions, computeBuildHash, computeSourceDigest, connectAppShellPlugin, connectBuildHashPlugin, connectDynamicBasePlugin, connectRouterChunkGroups, connectRoutes, connectRoutesDirOf, connectRoutesGeneratorConfig, connectRoutesTreeOf, connectThemeBootPlugin, copyConnect, directoryContentDigest, distDirFingerprint, ensureNodeVersion, escapeForRegExp, findBundleSpecifierOffenders, findDisallowedSpecifiers, findPackageRoot, findWorkerUnsafeMarkers, generateConnectRoutes, getConnectBaseViteConfig, getConnectHtmlTags, injectAppShell, linkedBuildStamp, makeImportScriptFromPackages, missingVendorEntries, overriddenConnectRoutes, ownProjectPackage, phConfigPlugin, prebuildConnectVendor, prebuildReactorWorker, prebuildWorkerPackages, prependToHtmlHead, publishDirAtomic, readAppShell, readAppShells, readJsonFile, readShellPlugins, readShellPluginsIn, rebaseShellLinks, relativeCssUrls, releaseLock, removeBase64EnvValues, resolveConnectBundle, resolveConnectPackageJson, resolveConnectPublicDir, resolveConnectRoutesDir, resolveOwnDeps, resolveOwnPackageVersion, resolvePackage, resolveReactorWorkerSource, resolveVersionDigest, resolveViteConfigPath, resolveWorkspacePackageDir, routeIdOf, runShellScriptPlugin, runTsc, runWorkerBuildEntries, runtimeConfigSchema, stripVersionFromPackage, swapAppShell, syncConnectRoutes, upstreamWorkerPackages, vendorImportMapPlugin, vendorRelativePath, withAppTitle, withShellAppName, withVendorBase, workerSafeVendorImports };
|
|
3476
3840
|
|
|
3477
3841
|
//# sourceMappingURL=index.mjs.map
|