@dokebi/template-inertia 0.4.13 → 0.4.15
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/AI.md +1 -1
- package/dist/index.js +18 -6
- package/package.json +2 -2
package/AI.md
CHANGED
|
@@ -28,7 +28,7 @@ npm run build # dist/ (browser) + dist/ssr
|
|
|
28
28
|
| `scripts` · `styles` | string[] | none | module scripts and stylesheets of the first HTML (local URLs starting with `/`) |
|
|
29
29
|
| `vite: { manifest, entry, base? }` | object | none | computes scripts, styles and version from the manifest; `base` defaults to `/`. Refused together with version, scripts or styles |
|
|
30
30
|
| `ssr: { bundle, failure?, entry?, timeoutMs? }` | object | none | server rendering. `failure`: `fallback` (default) or `error`. `entry` is the bundle's source module used in development mode (§5.1). `timeoutMs` (1 to 600000, default 5000): how long one `render(page)` may take; past it the render fails with `SSR_TIMEOUT` and `failure` decides ([D-0107](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0107-stream-and-render-bounds.md)). Size it above your slowest page render (`ssrStats()` and the `INERTIA_SSR_FAILED` logs show cut renders) |
|
|
31
|
-
| `devHosts` | string[] | `[]` | development only (`DOKEBI_VITE_DEV=1`): host names, besides loopback names, IP addresses and @dokebi/app domains, that may load the Vite dev routes, for example a tunnel host. `.example.com` also allows its subdomains. At most 256 names; no `*`, no port ([D-0107](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0107-stream-and-render-bounds.md)) |
|
|
31
|
+
| `devHosts` | string[] | `[]` | development only (`DOKEBI_VITE_DEV=1`): host names, besides loopback names, IP addresses and @dokebi/app domains (with a domain provider, the domains of the moment, D-0252), that may load the Vite dev routes, for example a tunnel host. `.example.com` also allows its subdomains. At most 256 names; no `*`, no port ([D-0107](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0107-stream-and-render-bounds.md)) |
|
|
32
32
|
| `devDepsRepairIntervalMs` | integer 1000–3600000 | 10000 | development only (`dokebi dev`): the Vite dev host re-optimizes the pre-bundled dependencies (`node_modules/.vite/deps`) when they changed on disk under it, at most once per this many ms; a cache that keeps changing faster is reported (`INERTIA_VITE_DEPS_CHANGING`). Read by the host when `dokebi dev` starts (§5.1, [D-0128](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0128-vite-deps-cache-repair.md)) |
|
|
33
33
|
| `encryptHistory` | `true` · `false` · `'sealed'` | `'sealed'` | Inertia history encryption; `'sealed'` turns it on for sealed requests (D-0062) |
|
|
34
34
|
| `routeIds: { assets?, viteDev? }` | strings | `template-inertia.assets`, `template-inertia.viteDev` | the route ids of the routes this plugin adds ([D-0142](https://git.nyx-zone.com/dokebi/framework/-/blob/main/docs/decisions/D-0142-plugin-route-ids.md)): `assets` every built file of `vite.manifest` (one route per file, one id), `viteDev` the `<base>*` routes of the Vite dev server (development only). `request.routeOptions.config.id` and `dokebi describe` `routes[].id` show them (describe serves no build, so it lists neither). An id taken by another route of the same app fails the start (`DUPLICATE_ROUTE_ID`) |
|
package/dist/index.js
CHANGED
|
@@ -133,7 +133,10 @@ function renderWithin(render, page, timeoutMs, late) {
|
|
|
133
133
|
class DevHosts {
|
|
134
134
|
#exact;
|
|
135
135
|
#suffixes;
|
|
136
|
-
|
|
136
|
+
/** D-0252: a domain of the app group now (a domain provider adds them while the app runs). */
|
|
137
|
+
#known;
|
|
138
|
+
constructor(appDomains, configured, known = () => false) {
|
|
139
|
+
this.#known = known;
|
|
137
140
|
const exact = new Set(appDomains.map((host) => host.toLowerCase().replace(/:\d+$/, '')));
|
|
138
141
|
const suffixes = [];
|
|
139
142
|
for (const host of configured) {
|
|
@@ -157,7 +160,8 @@ class DevHosts {
|
|
|
157
160
|
host.endsWith('.localhost') ||
|
|
158
161
|
isIP(host) !== 0 ||
|
|
159
162
|
this.#exact.has(host) ||
|
|
160
|
-
this.#suffixes.some((suffix) => host.endsWith(suffix))
|
|
163
|
+
this.#suffixes.some((suffix) => host.endsWith(suffix)) ||
|
|
164
|
+
this.#known(host));
|
|
161
165
|
}
|
|
162
166
|
}
|
|
163
167
|
/**
|
|
@@ -519,7 +523,12 @@ class InertiaRuntime {
|
|
|
519
523
|
}
|
|
520
524
|
// Development (D-0045): one Vite for every scope, reached by the first `vite` (the host of
|
|
521
525
|
// `dokebi dev`, shared by every worker, or one started in this process).
|
|
522
|
-
|
|
526
|
+
// D-0251: a process that opens no web port (`dokebi-web.listen: false`, a worker next to the
|
|
527
|
+
// web process) serves no page: it reads no Vite manifest or SSR bundle and opens no Vite, so a
|
|
528
|
+
// worker starts without a build and `dokebi dev` gives it no Vite.
|
|
529
|
+
const serving = context.app.config['dokebi-web']?.listen !==
|
|
530
|
+
false;
|
|
531
|
+
const develop = serving && viteDevRequested();
|
|
523
532
|
// When the dev host restarts, Vite's client pings it from a `blob:` SharedWorker, which
|
|
524
533
|
// script-src would block without worker-src (community request A4). The HMR socket itself
|
|
525
534
|
// goes to the page's own origin, which connect-src 'self' allows; a Vite config that sends it
|
|
@@ -532,6 +541,7 @@ class InertiaRuntime {
|
|
|
532
541
|
});
|
|
533
542
|
logger.log('debug', 'Inertia settings resolved', {
|
|
534
543
|
develop,
|
|
544
|
+
serving,
|
|
535
545
|
vite: this.settings.vite ? { ...this.settings.vite } : false,
|
|
536
546
|
ssr: this.settings.ssr ? { ...this.settings.ssr } : false,
|
|
537
547
|
devHosts: this.settings.devHosts.length,
|
|
@@ -557,7 +567,7 @@ class InertiaRuntime {
|
|
|
557
567
|
// domains of @dokebi/app (the same in every cluster worker) and `devHosts` (D-0107 §5).
|
|
558
568
|
const appDomains = context.app.config['dokebi-app']
|
|
559
569
|
?.domains;
|
|
560
|
-
const devHosts = new DevHosts(Object.keys(appDomains ?? {}), this.settings.devHosts);
|
|
570
|
+
const devHosts = new DevHosts(Object.keys(appDomains ?? {}), this.settings.devHosts, (name) => server.apps?.domainApp(name) !== undefined);
|
|
561
571
|
const hostName = (request) => server
|
|
562
572
|
.requestHost(request)
|
|
563
573
|
.toLowerCase()
|
|
@@ -756,6 +766,8 @@ class InertiaRuntime {
|
|
|
756
766
|
const built = async (options) => {
|
|
757
767
|
if (describing)
|
|
758
768
|
return { scripts: [], styles: [], version: 'describe' };
|
|
769
|
+
if (!serving)
|
|
770
|
+
return { scripts: [], styles: [], version: 'not-serving' };
|
|
759
771
|
if (develop) {
|
|
760
772
|
await viteDev(options.base);
|
|
761
773
|
return {
|
|
@@ -855,7 +867,7 @@ class InertiaRuntime {
|
|
|
855
867
|
const bundles = new Map();
|
|
856
868
|
const stats = { renders: 0, failures: 0 };
|
|
857
869
|
const serverRendering = async (ssr, vite) => {
|
|
858
|
-
if (!ssr || describing)
|
|
870
|
+
if (!ssr || describing || !serving)
|
|
859
871
|
return undefined;
|
|
860
872
|
let render;
|
|
861
873
|
if (develop) {
|
|
@@ -1053,7 +1065,7 @@ class InertiaRuntime {
|
|
|
1053
1065
|
}
|
|
1054
1066
|
export const createPlugin = definePlugin({
|
|
1055
1067
|
name: 'dokebi-template-inertia',
|
|
1056
|
-
version: '0.4.
|
|
1068
|
+
version: '0.4.15',
|
|
1057
1069
|
core: '^0.4.2',
|
|
1058
1070
|
options,
|
|
1059
1071
|
entry: parseEntry,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dokebi/template-inertia",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.15",
|
|
4
4
|
"description": "Inertia v3 server adapter for Dokebi: page JSON, Vite manifest assets and optional server-side rendering.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dokebi",
|
|
@@ -145,7 +145,7 @@
|
|
|
145
145
|
"devDependencies": {
|
|
146
146
|
"@dokebi/i18n": "0.2.8",
|
|
147
147
|
"@dokebi/session": "0.4.9",
|
|
148
|
-
"@dokebi/web": "0.4.
|
|
148
|
+
"@dokebi/web": "0.4.21",
|
|
149
149
|
"@dokebi/websocket": "0.4.9",
|
|
150
150
|
"@dokebi/websocket-hub": "0.4.5",
|
|
151
151
|
"@inertiajs/vue3": "3.9.1",
|