vue-ssr-lite 0.2.5 → 0.2.6
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/README.md +141 -117
- package/dist/SsrConfigCompileRuntime.d.ts +13 -21
- package/dist/SsrConfigCompileRuntime.d.ts.map +1 -1
- package/dist/SsrConfigTypes.d.ts +28 -35
- package/dist/SsrConfigTypes.d.ts.map +1 -1
- package/dist/SsrDomainRuntime.d.ts +22 -6
- package/dist/SsrDomainRuntime.d.ts.map +1 -1
- package/dist/SsrHostnameRuntime.d.ts +17 -0
- package/dist/SsrHostnameRuntime.d.ts.map +1 -0
- package/dist/chunks/SsrApplicationRuntime-CKjoPpvD.mjs +272 -0
- package/dist/chunks/SsrHtmlRuntime-DW8Os5kA.mjs +494 -0
- package/dist/chunks/{SsrReactivityRuntime-CroM1WJG.mjs → SsrReactivityRuntime-Cug-AFwk.mjs} +1 -1
- package/dist/chunks/SsrSerialization-DeKozeIm.mjs +80 -0
- package/dist/chunks/{SsrServerRuntime-Cwm6YaxC.mjs → SsrServerRuntime-Cheg50nG.mjs} +20 -20
- package/dist/cli.mjs +19 -19
- package/dist/client.mjs +43 -42
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +28 -23
- package/dist/server/SsrHostRuntime.d.ts +1 -3
- package/dist/server/SsrHostRuntime.d.ts.map +1 -1
- package/dist/server.mjs +79 -74
- package/dist/vite/SsrVitePlugin.d.ts +3 -14
- package/dist/vite/SsrVitePlugin.d.ts.map +1 -1
- package/dist/vite.mjs +51 -79
- package/package.json +1 -1
- package/dist/chunks/SsrApplicationRuntime-D4arUtsy.mjs +0 -238
- package/dist/chunks/SsrHtmlRuntime-DlQTSRzv.mjs +0 -451
- package/dist/chunks/SsrSerialization-k-3aCFYt.mjs +0 -47
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ It includes routing, browser hydration, production builds, a managed Node server
|
|
|
22
22
|
- Multiple applications and HTML entries
|
|
23
23
|
- Domain and subdomain routing
|
|
24
24
|
- Runtime roles for one image / many process modes
|
|
25
|
-
- Apollo,
|
|
25
|
+
- Generic `publicConfig` transport (Apollo, REST, Pinia, i18n stay in the app)
|
|
26
26
|
- SEO metadata and status codes
|
|
27
27
|
- Custom server endpoints
|
|
28
28
|
- Health and readiness checks
|
|
@@ -70,33 +70,18 @@ yarn add --dev vite @vitejs/plugin-vue
|
|
|
70
70
|
|
|
71
71
|
## Choose Your Application Type
|
|
72
72
|
|
|
73
|
-
`vue-ssr-lite` supports two
|
|
73
|
+
`vue-ssr-lite` supports two render modes, both declared only in `ssr.config.ts`:
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
Examples:
|
|
80
|
-
|
|
81
|
-
- Admin dashboard
|
|
82
|
-
- Internal application
|
|
83
|
-
- Editor
|
|
84
|
-
- Authenticated application
|
|
85
|
-
- Client-side portal
|
|
86
|
-
|
|
87
|
-
A single application definition is mountable in three modes — server render,
|
|
88
|
-
browser hydration of a server render, and pure client-side SPA. Define the app
|
|
89
|
-
once with `defineSsrApplication()` and mount it in the SPA entry with
|
|
90
|
-
`mountSpaApplication()`, so the SPA and SSR paths of the same application share
|
|
91
|
-
one plugin set, router and public-config delivery and cannot drift:
|
|
75
|
+
| `render` | Behavior |
|
|
76
|
+
| --- | --- |
|
|
77
|
+
| `spa` | Serves the HTML shell; the library generates the browser mount entry |
|
|
78
|
+
| `ssr` | Server-renders Vue and generates the hydration client entry |
|
|
92
79
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
80
|
+
Define each application once with `defineSsrApplication()` and point
|
|
81
|
+
`application: { module, exportName }` at that module. Do not maintain a separate
|
|
82
|
+
`main.ts` / `ErpClient.ts` bootstrap — `vueSsrLite()` injects the client entry
|
|
83
|
+
from `ssr.config`.
|
|
97
84
|
|
|
98
|
-
void mountSpaApplication(app)
|
|
99
|
-
```
|
|
100
85
|
|
|
101
86
|
A plain Vite `main.ts` (`createApp(App).use(router).mount('#app')`) still works
|
|
102
87
|
for an application that never needs SSR, but prefer the unified definition when
|
|
@@ -276,12 +261,12 @@ cookies, endpoints, and roles. The library expands domains, matches hosts by
|
|
|
276
261
|
specificity, and exposes context through `useSsrDomain()`.
|
|
277
262
|
|
|
278
263
|
```ts
|
|
279
|
-
// ssr.config.ts —
|
|
264
|
+
// ssr.config.ts — the only application / domain registration source
|
|
280
265
|
import { defineSsrConfig } from 'vue-ssr-lite'
|
|
281
266
|
|
|
282
267
|
export default defineSsrConfig({
|
|
283
268
|
name: 'my-platform',
|
|
284
|
-
runtime: process.env.APP_RUNTIME
|
|
269
|
+
runtime: process.env.APP_RUNTIME, // required in production
|
|
285
270
|
server: {
|
|
286
271
|
host: '0.0.0.0',
|
|
287
272
|
port: Number(process.env.PORT || 4173),
|
|
@@ -289,21 +274,32 @@ export default defineSsrConfig({
|
|
|
289
274
|
},
|
|
290
275
|
applications: {
|
|
291
276
|
dashboard: {
|
|
292
|
-
|
|
277
|
+
render: 'spa',
|
|
278
|
+
application: {
|
|
279
|
+
module: './src/dashboard/DashboardBootstrap.ts',
|
|
280
|
+
exportName: 'createDashboardApplication',
|
|
281
|
+
},
|
|
293
282
|
template: 'index.html',
|
|
294
283
|
roles: ['unified', 'dashboard'],
|
|
295
284
|
domain: {
|
|
296
285
|
development: 'localhost',
|
|
297
|
-
production:
|
|
286
|
+
production: process.env.VITE_ROOT_DOMAIN!,
|
|
298
287
|
mode: 'root-and-subdomains',
|
|
299
288
|
localAliases: true,
|
|
300
|
-
|
|
289
|
+
params: {
|
|
290
|
+
workspace: { source: 'last-subdomain-label' },
|
|
291
|
+
},
|
|
292
|
+
},
|
|
293
|
+
publicConfig: {
|
|
294
|
+
api: {
|
|
295
|
+
endpoint: process.env.VITE_GRAPHQL_ENDPOINT!,
|
|
296
|
+
timeout: 8_000,
|
|
297
|
+
},
|
|
301
298
|
},
|
|
302
299
|
},
|
|
303
300
|
website: {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
ssr: {
|
|
301
|
+
render: 'ssr',
|
|
302
|
+
application: {
|
|
307
303
|
module: './src/website/SsrApplication.ts',
|
|
308
304
|
exportName: 'websiteApplication',
|
|
309
305
|
},
|
|
@@ -311,16 +307,27 @@ export default defineSsrConfig({
|
|
|
311
307
|
roles: ['unified', 'website'],
|
|
312
308
|
domain: {
|
|
313
309
|
development: 'shop.localhost',
|
|
314
|
-
production:
|
|
310
|
+
production: process.env.VITE_SHOP_BASE_DOMAIN!,
|
|
315
311
|
mode: 'root-and-subdomains',
|
|
316
312
|
customDomains: true,
|
|
317
|
-
|
|
313
|
+
params: {
|
|
314
|
+
storeDomain: { source: 'subdomain-or-hostname' },
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
publicConfig: {
|
|
318
|
+
api: {
|
|
319
|
+
endpoint: process.env.VITE_GRAPHQL_ENDPOINT!,
|
|
320
|
+
timeout: 8_000,
|
|
321
|
+
},
|
|
318
322
|
},
|
|
319
323
|
},
|
|
320
324
|
},
|
|
321
325
|
})
|
|
322
326
|
```
|
|
323
327
|
|
|
328
|
+
The object key under `applications` is the canonical application ID everywhere
|
|
329
|
+
(routing, Apollo `applicationId`, hydration state).
|
|
330
|
+
|
|
324
331
|
Host ownership is resolved by **specificity**, not application declaration order:
|
|
325
332
|
|
|
326
333
|
1. Exact hostname
|
|
@@ -342,8 +349,8 @@ When the server starts, the console prints a ready message with a clickable loca
|
|
|
342
349
|
|
|
343
350
|
## 4. Configure Vite
|
|
344
351
|
|
|
345
|
-
Keep Vite-only concerns here (Vue, CSS,
|
|
346
|
-
|
|
352
|
+
Keep Vite-only concerns here (Vue, CSS, codegen, aliases). Application wiring
|
|
353
|
+
stays in `ssr.config.ts`:
|
|
347
354
|
|
|
348
355
|
```ts
|
|
349
356
|
// vite.config.ts
|
|
@@ -359,8 +366,14 @@ export default defineConfig({
|
|
|
359
366
|
})
|
|
360
367
|
```
|
|
361
368
|
|
|
362
|
-
`vueSsrLite()`
|
|
363
|
-
|
|
369
|
+
`vueSsrLite()` generates:
|
|
370
|
+
|
|
371
|
+
- HTML Rollup inputs from each `template`
|
|
372
|
+
- `virtual:vue-ssr-lite/client/<id>` SPA mount / SSR hydrate entries
|
|
373
|
+
- `virtual:vue-ssr-lite/runtime` for the Node server (static application imports)
|
|
374
|
+
|
|
375
|
+
HTML templates should not include a manual `<script type="module" src="...">`
|
|
376
|
+
bootstrap — the plugin injects the generated client entry.
|
|
364
377
|
|
|
365
378
|
## 5. Add Commands
|
|
366
379
|
|
|
@@ -389,63 +402,64 @@ npm run start
|
|
|
389
402
|
|
|
390
403
|
## SSR-Only Application
|
|
391
404
|
|
|
392
|
-
For a project that only needs SSR:
|
|
393
|
-
|
|
394
405
|
```ts
|
|
395
406
|
export default defineSsrConfig({
|
|
396
407
|
name: 'my-website',
|
|
408
|
+
runtime: process.env.APP_RUNTIME,
|
|
397
409
|
applications: {
|
|
398
410
|
website: {
|
|
399
|
-
|
|
411
|
+
render: 'ssr',
|
|
412
|
+
application: {
|
|
400
413
|
module: './src/website/SsrApplication.ts',
|
|
401
414
|
exportName: 'websiteApplication',
|
|
402
415
|
},
|
|
403
416
|
template: 'site.html',
|
|
404
417
|
domain: {
|
|
405
418
|
development: 'localhost',
|
|
406
|
-
production:
|
|
419
|
+
production: process.env.VITE_ROOT_DOMAIN!,
|
|
407
420
|
customDomains: true,
|
|
408
421
|
},
|
|
422
|
+
publicConfig: {
|
|
423
|
+
api: { endpoint: process.env.VITE_API_ENDPOINT!, timeout: 8_000 },
|
|
424
|
+
},
|
|
409
425
|
},
|
|
410
426
|
},
|
|
411
427
|
})
|
|
412
428
|
```
|
|
413
429
|
|
|
414
|
-
```ts
|
|
415
|
-
// vite.config.ts
|
|
416
|
-
vueSsrLite()
|
|
417
|
-
```
|
|
418
|
-
|
|
419
430
|
## SPA-Only Application
|
|
420
431
|
|
|
421
|
-
A config can also serve a normal SPA without an SSR application:
|
|
422
|
-
|
|
423
432
|
```ts
|
|
424
433
|
export default defineSsrConfig({
|
|
425
434
|
name: 'my-dashboard',
|
|
435
|
+
runtime: process.env.APP_RUNTIME,
|
|
426
436
|
applications: {
|
|
427
437
|
dashboard: {
|
|
428
|
-
|
|
438
|
+
render: 'spa',
|
|
439
|
+
application: {
|
|
440
|
+
module: './src/dashboard/DashboardBootstrap.ts',
|
|
441
|
+
exportName: 'createDashboardApplication',
|
|
442
|
+
},
|
|
429
443
|
template: 'index.html',
|
|
430
444
|
domain: {
|
|
431
445
|
development: 'localhost',
|
|
432
|
-
production:
|
|
446
|
+
production: process.env.VITE_ROOT_DOMAIN!,
|
|
433
447
|
localAliases: true,
|
|
434
448
|
},
|
|
449
|
+
publicConfig: {
|
|
450
|
+
api: { endpoint: process.env.VITE_API_ENDPOINT!, timeout: 8_000 },
|
|
451
|
+
},
|
|
435
452
|
},
|
|
436
453
|
},
|
|
437
454
|
})
|
|
438
455
|
```
|
|
439
456
|
|
|
440
|
-
|
|
441
|
-
`
|
|
442
|
-
HTML input from `ssr.config`.
|
|
457
|
+
The library generates the SPA client entry from `application.module`. Keep
|
|
458
|
+
`index.html` free of manual bootstrap scripts.
|
|
443
459
|
|
|
444
460
|
## Using the Same Vue Plugins
|
|
445
461
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
For example:
|
|
462
|
+
Plugins read opaque `publicConfig` — the library does not know about GraphQL:
|
|
449
463
|
|
|
450
464
|
```ts
|
|
451
465
|
// src/config/apollo.ts
|
|
@@ -453,30 +467,12 @@ import { defineApollo } from 'vue-apollo-client'
|
|
|
453
467
|
|
|
454
468
|
export default defineApollo(({ publicConfig }) => ({
|
|
455
469
|
endPoints: {
|
|
456
|
-
default:
|
|
457
|
-
publicConfig?.graphqlEndpoint ||
|
|
458
|
-
import.meta.env.VITE_GRAPHQL_ENDPOINT,
|
|
470
|
+
default: publicConfig?.api?.endpoint,
|
|
459
471
|
},
|
|
472
|
+
requestTimeoutMs: publicConfig?.api?.timeout,
|
|
460
473
|
}))
|
|
461
474
|
```
|
|
462
475
|
|
|
463
|
-
Use it in the SPA:
|
|
464
|
-
|
|
465
|
-
```ts
|
|
466
|
-
// src/spa/main.ts
|
|
467
|
-
import { createApp } from 'vue'
|
|
468
|
-
|
|
469
|
-
import apollo from '../config/apollo'
|
|
470
|
-
import App from './App.vue'
|
|
471
|
-
import router from './router'
|
|
472
|
-
|
|
473
|
-
const app = createApp(App)
|
|
474
|
-
|
|
475
|
-
app.use(apollo)
|
|
476
|
-
app.use(router)
|
|
477
|
-
app.mount('#app')
|
|
478
|
-
```
|
|
479
|
-
|
|
480
476
|
Use the same configuration in SSR:
|
|
481
477
|
|
|
482
478
|
```ts
|
|
@@ -681,32 +677,47 @@ import { defineSsrConfig, useSsrDomain } from 'vue-ssr-lite'
|
|
|
681
677
|
|
|
682
678
|
export default defineSsrConfig({
|
|
683
679
|
name: 'my-platform',
|
|
684
|
-
runtime: process.env.APP_RUNTIME
|
|
680
|
+
runtime: process.env.APP_RUNTIME,
|
|
685
681
|
server: { trustProxy: true },
|
|
686
682
|
applications: {
|
|
687
683
|
admin: {
|
|
688
|
-
|
|
684
|
+
render: 'spa',
|
|
685
|
+
application: {
|
|
686
|
+
module: './src/admin/AdminBootstrap.ts',
|
|
687
|
+
exportName: 'createAdminApplication',
|
|
688
|
+
},
|
|
689
689
|
template: 'index.html',
|
|
690
690
|
domain: {
|
|
691
691
|
development: 'localhost',
|
|
692
|
-
production: process.env.VITE_ROOT_DOMAIN
|
|
692
|
+
production: process.env.VITE_ROOT_DOMAIN!,
|
|
693
693
|
mode: 'root-and-subdomains',
|
|
694
694
|
localAliases: true,
|
|
695
|
-
|
|
695
|
+
params: {
|
|
696
|
+
workspace: { source: 'last-subdomain-label' },
|
|
697
|
+
},
|
|
698
|
+
},
|
|
699
|
+
publicConfig: {
|
|
700
|
+
api: { endpoint: process.env.VITE_API_ENDPOINT!, timeout: 8_000 },
|
|
696
701
|
},
|
|
697
702
|
},
|
|
698
703
|
website: {
|
|
699
|
-
|
|
704
|
+
render: 'ssr',
|
|
705
|
+
application: {
|
|
700
706
|
module: './src/website/SsrApplication.ts',
|
|
701
707
|
exportName: 'websiteApplication',
|
|
702
708
|
},
|
|
703
709
|
template: 'site.html',
|
|
704
710
|
domain: {
|
|
705
711
|
development: 'shop.localhost',
|
|
706
|
-
production: process.env.VITE_SHOP_BASE_DOMAIN
|
|
712
|
+
production: process.env.VITE_SHOP_BASE_DOMAIN!,
|
|
707
713
|
mode: 'root-and-subdomains',
|
|
708
714
|
customDomains: true,
|
|
709
|
-
|
|
715
|
+
params: {
|
|
716
|
+
storeDomain: { source: 'subdomain-or-hostname' },
|
|
717
|
+
},
|
|
718
|
+
},
|
|
719
|
+
publicConfig: {
|
|
720
|
+
api: { endpoint: process.env.VITE_API_ENDPOINT!, timeout: 8_000 },
|
|
710
721
|
},
|
|
711
722
|
},
|
|
712
723
|
},
|
|
@@ -725,7 +736,7 @@ domain.subdomain
|
|
|
725
736
|
domain.isCustomDomain
|
|
726
737
|
domain.params.workspace
|
|
727
738
|
domain.params.storeDomain
|
|
728
|
-
domain.
|
|
739
|
+
domain.createUrl({ subdomain: 'department.acme', path: '/projects', query: { page: 2 } })
|
|
729
740
|
```
|
|
730
741
|
|
|
731
742
|
### Precedence
|
|
@@ -767,21 +778,29 @@ Example:
|
|
|
767
778
|
```ts
|
|
768
779
|
export default defineSsrConfig({
|
|
769
780
|
name: 'my-platform',
|
|
770
|
-
runtime: process.env.APP_RUNTIME
|
|
781
|
+
runtime: process.env.APP_RUNTIME, // required in production
|
|
771
782
|
applications: {
|
|
772
783
|
admin: {
|
|
773
|
-
|
|
784
|
+
render: 'spa',
|
|
785
|
+
application: {
|
|
786
|
+
module: './src/admin/AdminBootstrap.ts',
|
|
787
|
+
exportName: 'createAdminApplication',
|
|
788
|
+
},
|
|
774
789
|
template: 'index.html',
|
|
775
790
|
roles: ['unified', 'admin'],
|
|
776
791
|
domain: {
|
|
777
792
|
development: 'localhost',
|
|
778
|
-
production:
|
|
793
|
+
production: process.env.VITE_ROOT_DOMAIN!,
|
|
779
794
|
mode: 'root-and-subdomains',
|
|
780
795
|
localAliases: true,
|
|
781
796
|
},
|
|
797
|
+
publicConfig: {
|
|
798
|
+
api: { endpoint: process.env.VITE_API_ENDPOINT!, timeout: 8_000 },
|
|
799
|
+
},
|
|
782
800
|
},
|
|
783
801
|
website: {
|
|
784
|
-
|
|
802
|
+
render: 'ssr',
|
|
803
|
+
application: {
|
|
785
804
|
module: './src/website/SsrApplication.ts',
|
|
786
805
|
exportName: 'websiteApplication',
|
|
787
806
|
},
|
|
@@ -789,10 +808,13 @@ export default defineSsrConfig({
|
|
|
789
808
|
roles: ['unified', 'website'],
|
|
790
809
|
domain: {
|
|
791
810
|
development: 'shop.localhost',
|
|
792
|
-
production:
|
|
811
|
+
production: process.env.VITE_SHOP_BASE_DOMAIN!,
|
|
793
812
|
mode: 'root-and-subdomains',
|
|
794
813
|
customDomains: true,
|
|
795
814
|
},
|
|
815
|
+
publicConfig: {
|
|
816
|
+
api: { endpoint: process.env.VITE_API_ENDPOINT!, timeout: 8_000 },
|
|
817
|
+
},
|
|
796
818
|
},
|
|
797
819
|
},
|
|
798
820
|
})
|
|
@@ -806,6 +828,9 @@ With that setup:
|
|
|
806
828
|
|
|
807
829
|
If a host matches an application that the current role does not allow, the server responds with `421`.
|
|
808
830
|
|
|
831
|
+
Development may default `runtime` in your `ssr.config`. Production compilation
|
|
832
|
+
rejects a missing `runtime`, `domain.production`, or `publicConfig.api.endpoint`.
|
|
833
|
+
|
|
809
834
|
`defineSsrConfig` accepts either a plain object or an async factory function.
|
|
810
835
|
|
|
811
836
|
## Custom Endpoints
|
|
@@ -876,37 +901,45 @@ const responseCache = createSsrMemoryResponseCache({
|
|
|
876
901
|
})
|
|
877
902
|
```
|
|
878
903
|
|
|
879
|
-
Add it
|
|
904
|
+
Add it on the application object:
|
|
880
905
|
|
|
881
906
|
```ts
|
|
882
|
-
{
|
|
883
|
-
|
|
884
|
-
|
|
907
|
+
website: {
|
|
908
|
+
render: 'ssr',
|
|
909
|
+
application: {
|
|
910
|
+
module: './src/website/SsrApplication.ts',
|
|
911
|
+
exportName: 'websiteApplication',
|
|
912
|
+
},
|
|
885
913
|
template: 'site.html',
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
914
|
+
domain: {
|
|
915
|
+
development: 'localhost',
|
|
916
|
+
production: process.env.VITE_ROOT_DOMAIN!,
|
|
917
|
+
customDomains: true,
|
|
918
|
+
},
|
|
889
919
|
responseCache: {
|
|
890
920
|
store: responseCache,
|
|
891
921
|
ttlMs: 60_000,
|
|
892
922
|
},
|
|
923
|
+
publicConfig: {
|
|
924
|
+
api: { endpoint: process.env.VITE_API_ENDPOINT!, timeout: 8_000 },
|
|
925
|
+
},
|
|
893
926
|
}
|
|
894
927
|
```
|
|
895
928
|
|
|
896
929
|
## Cookie Filtering
|
|
897
930
|
|
|
898
|
-
SSR requests can forward a filtered `Cookie` header to upstream APIs.
|
|
931
|
+
SSR requests can forward a filtered `Cookie` header to upstream APIs. Configure
|
|
932
|
+
cookies per application:
|
|
899
933
|
|
|
900
934
|
```ts
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
publicConfig: {},
|
|
935
|
+
cookies: {
|
|
936
|
+
allow: ['session'],
|
|
937
|
+
deny: ['admin_token', 'refresh_token'],
|
|
905
938
|
}
|
|
906
939
|
```
|
|
907
940
|
|
|
908
|
-
- If `
|
|
909
|
-
- `
|
|
941
|
+
- If `allow` is non-empty, only listed cookies are forwarded.
|
|
942
|
+
- `deny` always removes matching cookies.
|
|
910
943
|
- Leave both empty when the browser talks to the API directly and SSR needs no cookies.
|
|
911
944
|
|
|
912
945
|
## Server Configuration
|
|
@@ -915,21 +948,11 @@ server: {
|
|
|
915
948
|
server: {
|
|
916
949
|
host: '0.0.0.0',
|
|
917
950
|
port: 4173,
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
publicConfig: {},
|
|
921
|
-
|
|
951
|
+
trustProxy: false,
|
|
922
952
|
requestTimeoutMs: 15_000,
|
|
923
953
|
shutdownTimeoutMs: 10_000,
|
|
924
|
-
|
|
925
954
|
healthPath: '/healthz',
|
|
926
955
|
readinessPath: '/readyz',
|
|
927
|
-
|
|
928
|
-
trustProxy: false,
|
|
929
|
-
|
|
930
|
-
cookieAllowlist: [],
|
|
931
|
-
cookieDenylist: [],
|
|
932
|
-
|
|
933
956
|
logger: {
|
|
934
957
|
info: (event, details) => console.info(event, details ?? ''),
|
|
935
958
|
warn: (event, details) => console.warn(event, details ?? ''),
|
|
@@ -938,7 +961,8 @@ server: {
|
|
|
938
961
|
}
|
|
939
962
|
```
|
|
940
963
|
|
|
941
|
-
|
|
964
|
+
The active process role comes from top-level `runtime`, not `server.role`.
|
|
965
|
+
`/healthz` and `/readyz` include that role in their JSON responses.
|
|
942
966
|
|
|
943
967
|
## Server-side data resolution
|
|
944
968
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { SsrApplicationDomainConfig, SsrApplicationModuleRef, SsrConfig, SsrDomainMode } from './SsrConfigTypes';
|
|
1
|
+
import { SsrApplicationDomainConfig, SsrApplicationModuleRef, SsrConfig, SsrDomainMode, SsrRenderMode } from './SsrConfigTypes';
|
|
2
2
|
import { defineSsrConfig } from './SsrConfigRuntime';
|
|
3
3
|
import { SsrApplicationDefinition, SsrEndpointDefinition, SsrEntryKind, SsrReadinessProbe, SsrResponseCacheStrategy, SsrServerOptions } from './SsrRuntimeTypes';
|
|
4
4
|
export { defineSsrConfig };
|
|
5
|
+
export declare const SSR_RUNTIME_VIRTUAL_ID = "virtual:vue-ssr-lite/runtime";
|
|
6
|
+
export declare const SSR_CLIENT_VIRTUAL_PREFIX = "virtual:vue-ssr-lite/client/";
|
|
5
7
|
export interface SsrCompiledApplication {
|
|
6
8
|
id: string;
|
|
7
9
|
kind: SsrEntryKind;
|
|
@@ -16,15 +18,14 @@ export interface SsrCompiledApplication {
|
|
|
16
18
|
cookieAllowlist: string[];
|
|
17
19
|
cookieDenylist: string[];
|
|
18
20
|
publicConfig: Record<string, unknown>;
|
|
19
|
-
|
|
20
|
-
ssrModule?: SsrApplicationModuleRef;
|
|
21
|
+
applicationModule?: SsrApplicationModuleRef;
|
|
21
22
|
domain: {
|
|
22
23
|
development: string;
|
|
23
24
|
production: string;
|
|
24
25
|
mode: SsrDomainMode;
|
|
25
26
|
localAliases: boolean;
|
|
26
27
|
customDomains: boolean;
|
|
27
|
-
|
|
28
|
+
params: SsrApplicationDomainConfig['params'];
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
31
|
export interface SsrCompiledConfig {
|
|
@@ -37,6 +38,7 @@ export interface SsrCompiledConfig {
|
|
|
37
38
|
}
|
|
38
39
|
export interface SsrViteApplicationEntry {
|
|
39
40
|
id: string;
|
|
41
|
+
kind: SsrRenderMode;
|
|
40
42
|
definition: string;
|
|
41
43
|
exportName?: string;
|
|
42
44
|
template: string;
|
|
@@ -44,37 +46,27 @@ export interface SsrViteApplicationEntry {
|
|
|
44
46
|
}
|
|
45
47
|
export interface SsrViteEntries {
|
|
46
48
|
applications: SsrViteApplicationEntry[];
|
|
47
|
-
spaEntries: Record<string, string>;
|
|
48
49
|
}
|
|
49
50
|
export declare const isSsrApplicationModuleRef: (value: unknown) => value is SsrApplicationModuleRef;
|
|
50
51
|
export interface CompileSsrConfigOptions {
|
|
51
52
|
development?: boolean;
|
|
52
|
-
/** Project root used to resolve `{ module }` paths. */
|
|
53
53
|
root?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Custom importer for module references (Vite `ssrLoadModule` in development).
|
|
56
|
-
* Falls back to a Node ESM import of the resolved file URL.
|
|
57
|
-
*/
|
|
58
54
|
importModule?: (specifier: string) => Promise<Record<string, unknown>>;
|
|
59
55
|
}
|
|
60
56
|
export declare const resolveSsrConfigPath: (root: string, explicit?: string) => Promise<string>;
|
|
61
|
-
/** Derive Vite HTML /
|
|
57
|
+
/** Derive Vite HTML / client entries from a loaded `SsrConfig`. */
|
|
62
58
|
export declare const extractSsrViteEntries: (config: SsrConfig) => SsrViteEntries;
|
|
63
59
|
/**
|
|
64
|
-
* Load `ssr.config` for Vite entry discovery
|
|
65
|
-
*
|
|
66
|
-
* stay external.
|
|
67
|
-
*
|
|
68
|
-
* The bundled file is written under the project `node_modules` tree so Node can
|
|
69
|
-
* resolve bare imports like `vue-ssr-lite` from the consumer's dependencies.
|
|
70
|
-
* Writing under the OS temp directory breaks package resolution.
|
|
60
|
+
* Load `ssr.config` for Vite entry discovery / runtime module generation.
|
|
61
|
+
* Written under the project `node_modules` tree so bare imports resolve.
|
|
71
62
|
*/
|
|
72
63
|
export declare const loadSsrConfigFile: (root: string, configPath?: string) => Promise<SsrConfig>;
|
|
73
64
|
export declare const resolveSsrViteEntries: (root: string, configPath?: string) => Promise<SsrViteEntries>;
|
|
74
65
|
/**
|
|
75
|
-
*
|
|
76
|
-
*
|
|
66
|
+
* Generate a Vite-analyzable runtime module that imports each application
|
|
67
|
+
* module statically and merges it into the user `ssr.config` export.
|
|
77
68
|
*/
|
|
78
|
-
export declare const
|
|
69
|
+
export declare const generateSsrRuntimeModule: (root: string, configPath: string, entries: SsrViteApplicationEntry[]) => string;
|
|
70
|
+
export declare const generateSsrClientModule: (root: string, entry: SsrViteApplicationEntry) => string;
|
|
79
71
|
export declare const compileSsrConfig: (loaded: unknown, options?: CompileSsrConfigOptions) => Promise<SsrCompiledConfig>;
|
|
80
72
|
//# sourceMappingURL=SsrConfigCompileRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrConfigCompileRuntime.d.ts","sourceRoot":"","sources":["../src/SsrConfigCompileRuntime.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAEV,0BAA0B,EAE1B,uBAAuB,EAEvB,SAAS,EAET,aAAa,EACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
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