vue-ssr-lite 0.1.14 → 0.2.3
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 +156 -140
- package/dist/SsrApplicationRuntime.d.ts.map +1 -1
- package/dist/SsrBrowserRuntime.d.ts +7 -6
- package/dist/SsrBrowserRuntime.d.ts.map +1 -1
- package/dist/SsrConfigCompileRuntime.d.ts +40 -0
- package/dist/SsrConfigCompileRuntime.d.ts.map +1 -0
- package/dist/SsrConfigRuntime.d.ts +4 -0
- package/dist/SsrConfigRuntime.d.ts.map +1 -0
- package/dist/SsrConfigTypes.d.ts +107 -0
- package/dist/SsrConfigTypes.d.ts.map +1 -0
- package/dist/SsrDomainRuntime.d.ts +38 -0
- package/dist/SsrDomainRuntime.d.ts.map +1 -0
- package/dist/SsrRenderRuntime.d.ts.map +1 -1
- package/dist/SsrRuntimeTypes.d.ts +6 -21
- package/dist/SsrRuntimeTypes.d.ts.map +1 -1
- package/dist/SsrTestFixtures.d.ts +8 -0
- package/dist/SsrTestFixtures.d.ts.map +1 -0
- package/dist/chunks/SsrApplicationRuntime-D4arUtsy.mjs +238 -0
- package/dist/chunks/SsrConfigRuntime-D0DkOrVQ.mjs +4 -0
- package/dist/chunks/{SsrReactivityRuntime-CB3IYMti.mjs → SsrReactivityRuntime-CroM1WJG.mjs} +1 -1
- package/dist/chunks/SsrServerRuntime-DqUVv06J.mjs +1004 -0
- package/dist/cli.mjs +34 -34
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.mjs +79 -56
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +25 -19
- package/dist/server/SsrHostRuntime.d.ts +52 -2
- package/dist/server/SsrHostRuntime.d.ts.map +1 -1
- package/dist/server/SsrServerRuntime.d.ts.map +1 -1
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.mjs +73 -60
- package/package.json +1 -1
- package/dist/chunks/SsrApplicationRuntime-lMR_sMdk.mjs +0 -155
- package/dist/chunks/SsrServerRuntime-nBan8KxD.mjs +0 -731
package/README.md
CHANGED
|
@@ -37,15 +37,15 @@ It includes routing, browser hydration, production builds, a managed Node server
|
|
|
37
37
|
|
|
38
38
|
| Import | Purpose |
|
|
39
39
|
| --- | --- |
|
|
40
|
-
| `vue-ssr-lite` | `defineSsrApplication`, `
|
|
41
|
-
| `vue-ssr-lite/client` | Browser hydration
|
|
42
|
-
| `vue-ssr-lite/server` | Managed Node server, host matching, cookies
|
|
40
|
+
| `vue-ssr-lite` | `defineSsrConfig`, `defineSsrApplication`, `useSsrDomain`, request context |
|
|
41
|
+
| `vue-ssr-lite/client` | Browser hydration and SPA mount |
|
|
42
|
+
| `vue-ssr-lite/server` | Managed Node server, config compile, host matching, cookies |
|
|
43
43
|
| `vue-ssr-lite/vite` | Vite plugin that wires HTML templates and virtual client entries |
|
|
44
44
|
|
|
45
|
-
CLI binary:
|
|
45
|
+
CLI binary (auto-discovers `ssr.config.ts|.mts|.js|.mjs` in the project root):
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
vue-ssr-lite <dev|build|start> [--root .] [--
|
|
48
|
+
vue-ssr-lite <dev|build|start> [--root .] [--config ssr.config.ts] [--server-output dist/server/SsrRuntime.js] [--hmr-port 31001]
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
Requires Node.js 20 or newer.
|
|
@@ -269,51 +269,63 @@ Create its HTML template:
|
|
|
269
269
|
|
|
270
270
|
The SSR browser entry and hydration setup are added automatically.
|
|
271
271
|
|
|
272
|
-
## 3. Create
|
|
272
|
+
## 3. Create `ssr.config.ts`
|
|
273
273
|
|
|
274
|
-
|
|
274
|
+
Every application is one self-contained object: runtime, domain, GraphQL,
|
|
275
|
+
cookies, endpoints, and roles. The library expands domains, matches hosts by
|
|
276
|
+
specificity, and exposes context through `useSsrDomain()`.
|
|
275
277
|
|
|
276
278
|
```ts
|
|
277
|
-
//
|
|
278
|
-
import {
|
|
279
|
+
// ssr.config.ts
|
|
280
|
+
import { defineSsrConfig } from 'vue-ssr-lite'
|
|
281
|
+
import { websiteApplication } from './src/website/SsrApplication'
|
|
279
282
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
export default defineSsrRuntime({
|
|
283
|
+
export default defineSsrConfig({
|
|
283
284
|
name: 'my-platform',
|
|
284
|
-
|
|
285
|
-
entries: [
|
|
286
|
-
{
|
|
287
|
-
id: 'dashboard',
|
|
288
|
-
kind: 'spa',
|
|
289
|
-
template: 'index.html',
|
|
290
|
-
hosts: ['app.example.com', 'localhost'],
|
|
291
|
-
},
|
|
292
|
-
{
|
|
293
|
-
id: 'website',
|
|
294
|
-
kind: 'ssr',
|
|
295
|
-
template: 'site.html',
|
|
296
|
-
hosts: ['*'],
|
|
297
|
-
application: websiteApplication,
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
|
|
301
|
-
defaultEntryId: 'website',
|
|
302
|
-
|
|
285
|
+
runtime: process.env.APP_RUNTIME || 'unified',
|
|
303
286
|
server: {
|
|
304
287
|
host: '0.0.0.0',
|
|
305
288
|
port: Number(process.env.PORT || 4173),
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
289
|
+
trustProxy: true,
|
|
290
|
+
},
|
|
291
|
+
applications: {
|
|
292
|
+
dashboard: {
|
|
293
|
+
spa: true,
|
|
294
|
+
template: 'index.html',
|
|
295
|
+
roles: ['unified', 'dashboard'],
|
|
296
|
+
domain: {
|
|
297
|
+
development: 'localhost',
|
|
298
|
+
production: 'app.example.com',
|
|
299
|
+
mode: 'root-and-subdomains',
|
|
300
|
+
localAliases: true,
|
|
301
|
+
expose: { subdomainAs: 'workspace' },
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
website: {
|
|
305
|
+
ssr: websiteApplication,
|
|
306
|
+
template: 'site.html',
|
|
307
|
+
roles: ['unified', 'website'],
|
|
308
|
+
domain: {
|
|
309
|
+
development: 'shop.localhost',
|
|
310
|
+
production: 'shop.example.com',
|
|
311
|
+
mode: 'root-and-subdomains',
|
|
312
|
+
customDomains: true,
|
|
313
|
+
expose: { subdomainOrHostnameAs: 'storeDomain' },
|
|
314
|
+
},
|
|
310
315
|
},
|
|
311
316
|
},
|
|
312
317
|
})
|
|
313
318
|
```
|
|
314
319
|
|
|
315
|
-
|
|
316
|
-
|
|
320
|
+
Host ownership is resolved by **specificity**, not application declaration order:
|
|
321
|
+
|
|
322
|
+
1. Exact hostname
|
|
323
|
+
2. Longest matching wildcard suffix (for example `*.shop.example.com` beats `*.example.com`)
|
|
324
|
+
3. Shorter matching wildcard suffix
|
|
325
|
+
4. Catch-all `*` (from `customDomains: true`)
|
|
326
|
+
5. `defaultApplicationId` when no host pattern matches
|
|
327
|
+
|
|
328
|
+
Overlapping wildcards are valid. Duplicate exact or identical wildcard patterns across applications are rejected at startup.
|
|
317
329
|
|
|
318
330
|
When the server starts, the console prints a ready message with a clickable local URL and the active role:
|
|
319
331
|
|
|
@@ -372,8 +384,8 @@ Do not add SPA applications to the `applications` array.
|
|
|
372
384
|
```json
|
|
373
385
|
{
|
|
374
386
|
"scripts": {
|
|
375
|
-
"dev": "vue-ssr-lite dev
|
|
376
|
-
"build": "vue-ssr-lite build
|
|
387
|
+
"dev": "vue-ssr-lite dev",
|
|
388
|
+
"build": "vue-ssr-lite build",
|
|
377
389
|
"start": "vue-ssr-lite start"
|
|
378
390
|
}
|
|
379
391
|
}
|
|
@@ -397,21 +409,18 @@ npm run start
|
|
|
397
409
|
For a project that only needs SSR:
|
|
398
410
|
|
|
399
411
|
```ts
|
|
400
|
-
export default
|
|
412
|
+
export default defineSsrConfig({
|
|
401
413
|
name: 'my-website',
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
id: 'website',
|
|
406
|
-
kind: 'ssr',
|
|
414
|
+
applications: {
|
|
415
|
+
website: {
|
|
416
|
+
ssr: websiteApplication,
|
|
407
417
|
template: 'site.html',
|
|
408
|
-
|
|
409
|
-
|
|
418
|
+
domain: {
|
|
419
|
+
development: 'localhost',
|
|
420
|
+
production: 'example.com',
|
|
421
|
+
customDomains: true,
|
|
422
|
+
},
|
|
410
423
|
},
|
|
411
|
-
],
|
|
412
|
-
|
|
413
|
-
server: {
|
|
414
|
-
publicConfig: {},
|
|
415
424
|
},
|
|
416
425
|
})
|
|
417
426
|
```
|
|
@@ -433,23 +442,21 @@ vueSsrLite({
|
|
|
433
442
|
|
|
434
443
|
## SPA-Only Application
|
|
435
444
|
|
|
436
|
-
A
|
|
445
|
+
A config can also serve a normal SPA without an SSR application:
|
|
437
446
|
|
|
438
447
|
```ts
|
|
439
|
-
export default
|
|
448
|
+
export default defineSsrConfig({
|
|
440
449
|
name: 'my-dashboard',
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
id: 'dashboard',
|
|
445
|
-
kind: 'spa',
|
|
450
|
+
applications: {
|
|
451
|
+
dashboard: {
|
|
452
|
+
spa: true,
|
|
446
453
|
template: 'index.html',
|
|
447
|
-
|
|
454
|
+
domain: {
|
|
455
|
+
development: 'localhost',
|
|
456
|
+
production: 'app.example.com',
|
|
457
|
+
localAliases: true,
|
|
458
|
+
},
|
|
448
459
|
},
|
|
449
|
-
],
|
|
450
|
-
|
|
451
|
-
server: {
|
|
452
|
-
publicConfig: {},
|
|
453
460
|
},
|
|
454
461
|
})
|
|
455
462
|
```
|
|
@@ -686,31 +693,75 @@ context.response.redirect = {
|
|
|
686
693
|
|
|
687
694
|
## Domain Routing
|
|
688
695
|
|
|
689
|
-
|
|
696
|
+
Domain configuration lives on each application. The library owns normalization
|
|
697
|
+
(ports, trailing dots, IPv4/IPv6 aliases), proxy header handling, environment
|
|
698
|
+
selection (`development` vs `production`), host specificity matching, custom
|
|
699
|
+
domains, context serialization, and hydration.
|
|
690
700
|
|
|
691
701
|
```ts
|
|
692
|
-
|
|
693
|
-
```
|
|
694
|
-
|
|
695
|
-
Subdomains:
|
|
702
|
+
import { defineSsrConfig, useSsrDomain } from 'vue-ssr-lite'
|
|
696
703
|
|
|
697
|
-
|
|
698
|
-
|
|
704
|
+
export default defineSsrConfig({
|
|
705
|
+
name: 'my-platform',
|
|
706
|
+
runtime: process.env.APP_RUNTIME || 'unified',
|
|
707
|
+
server: { trustProxy: true },
|
|
708
|
+
applications: {
|
|
709
|
+
admin: {
|
|
710
|
+
spa: true,
|
|
711
|
+
template: 'index.html',
|
|
712
|
+
domain: {
|
|
713
|
+
development: 'localhost',
|
|
714
|
+
production: process.env.VITE_ROOT_DOMAIN || 'app.example.com',
|
|
715
|
+
mode: 'root-and-subdomains',
|
|
716
|
+
localAliases: true,
|
|
717
|
+
expose: { subdomainAs: 'workspace' },
|
|
718
|
+
},
|
|
719
|
+
},
|
|
720
|
+
website: {
|
|
721
|
+
ssr: websiteApplication,
|
|
722
|
+
template: 'site.html',
|
|
723
|
+
domain: {
|
|
724
|
+
development: 'shop.localhost',
|
|
725
|
+
production: process.env.VITE_SHOP_BASE_DOMAIN || 'shop.example.com',
|
|
726
|
+
mode: 'root-and-subdomains',
|
|
727
|
+
customDomains: true,
|
|
728
|
+
expose: { subdomainOrHostnameAs: 'storeDomain' },
|
|
729
|
+
},
|
|
730
|
+
},
|
|
731
|
+
},
|
|
732
|
+
})
|
|
699
733
|
```
|
|
700
734
|
|
|
701
|
-
|
|
735
|
+
Consume the resolved context anywhere (SSR, SPA, endpoints, hydration):
|
|
702
736
|
|
|
703
737
|
```ts
|
|
704
|
-
|
|
738
|
+
const domain = useSsrDomain()
|
|
739
|
+
|
|
740
|
+
domain.entry
|
|
741
|
+
domain.hostname
|
|
742
|
+
domain.baseDomain
|
|
743
|
+
domain.subdomain
|
|
744
|
+
domain.isCustomDomain
|
|
745
|
+
domain.params.workspace
|
|
746
|
+
domain.params.storeDomain
|
|
747
|
+
domain.buildSubdomainUrl('acme', '/dashboard')
|
|
705
748
|
```
|
|
706
749
|
|
|
707
|
-
|
|
750
|
+
### Precedence
|
|
708
751
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
752
|
+
| Priority | Pattern | Example winner |
|
|
753
|
+
| --- | --- | --- |
|
|
754
|
+
| 1 | Exact hostname | `shop.localhost` over `*.localhost` |
|
|
755
|
+
| 2 | Longer wildcard suffix | `*.shop.localhost` over `*.localhost` |
|
|
756
|
+
| 3 | Shorter wildcard suffix | `*.localhost` over `*` |
|
|
757
|
+
| 4 | Catch-all `*` | custom domains with no specific rule |
|
|
758
|
+
| 5 | `defaultApplicationId` | only when no pattern matches |
|
|
712
759
|
|
|
713
|
-
|
|
760
|
+
Overlapping roots such as `*.localhost` and `*.shop.localhost` are supported
|
|
761
|
+
because the longer suffix wins. Duplicate exact/wildcard ownership and multiple
|
|
762
|
+
catch-all (`*`) applications are rejected at startup.
|
|
763
|
+
|
|
764
|
+
Do not include protocols, paths, query strings, or ports in domain values.
|
|
714
765
|
|
|
715
766
|
Set `server.trustProxy` to `true` only when the Node process sits behind a trusted reverse proxy. Then `X-Forwarded-Host` and `X-Forwarded-Proto` are used for host matching and absolute URLs. Leave it `false` for direct local traffic.
|
|
716
767
|
|
|
@@ -718,95 +769,60 @@ Set `server.trustProxy` to `true` only when the Node process sits behind a trust
|
|
|
718
769
|
|
|
719
770
|
Roles let one codebase and one Docker image run as different process modes.
|
|
720
771
|
|
|
721
|
-
- Set `
|
|
722
|
-
- Set `roles` on each
|
|
723
|
-
- Omit `roles` (or omit `
|
|
772
|
+
- Set top-level `runtime` to the active mode for this process.
|
|
773
|
+
- Set `roles` on each application to list which modes may serve it.
|
|
774
|
+
- Omit `roles` (or omit `runtime`) to keep an application available in every mode.
|
|
724
775
|
|
|
725
776
|
Role names are application-defined strings. Common patterns:
|
|
726
777
|
|
|
727
778
|
| Mode | Typical use |
|
|
728
779
|
| --- | --- |
|
|
729
|
-
| `unified` | Local development or a single process that serves every
|
|
780
|
+
| `unified` | Local development or a single process that serves every application |
|
|
730
781
|
| A private role | SPA / admin / back-office only |
|
|
731
782
|
| A public role | SSR website / marketing / storefront only |
|
|
732
783
|
|
|
733
784
|
Example:
|
|
734
785
|
|
|
735
786
|
```ts
|
|
736
|
-
export default
|
|
787
|
+
export default defineSsrConfig({
|
|
737
788
|
name: 'my-platform',
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
{
|
|
741
|
-
|
|
742
|
-
kind: 'spa',
|
|
789
|
+
runtime: process.env.APP_RUNTIME || 'unified',
|
|
790
|
+
applications: {
|
|
791
|
+
admin: {
|
|
792
|
+
spa: true,
|
|
743
793
|
template: 'index.html',
|
|
744
|
-
hosts: ['app.example.com', 'localhost'],
|
|
745
794
|
roles: ['unified', 'admin'],
|
|
795
|
+
domain: {
|
|
796
|
+
development: 'localhost',
|
|
797
|
+
production: 'app.example.com',
|
|
798
|
+
mode: 'root-and-subdomains',
|
|
799
|
+
localAliases: true,
|
|
800
|
+
},
|
|
746
801
|
},
|
|
747
|
-
{
|
|
748
|
-
|
|
749
|
-
kind: 'ssr',
|
|
802
|
+
website: {
|
|
803
|
+
ssr: websiteApplication,
|
|
750
804
|
template: 'site.html',
|
|
751
|
-
hosts: ['*'],
|
|
752
805
|
roles: ['unified', 'website'],
|
|
753
|
-
|
|
806
|
+
domain: {
|
|
807
|
+
development: 'shop.localhost',
|
|
808
|
+
production: 'shop.example.com',
|
|
809
|
+
mode: 'root-and-subdomains',
|
|
810
|
+
customDomains: true,
|
|
811
|
+
},
|
|
754
812
|
},
|
|
755
|
-
],
|
|
756
|
-
|
|
757
|
-
server: {
|
|
758
|
-
role: process.env.APP_RUNTIME || 'unified',
|
|
759
|
-
publicConfig: {},
|
|
760
813
|
},
|
|
761
814
|
})
|
|
762
815
|
```
|
|
763
816
|
|
|
764
817
|
With that setup:
|
|
765
818
|
|
|
766
|
-
- `APP_RUNTIME=unified` serves both
|
|
767
|
-
- `APP_RUNTIME=admin` serves only the SPA
|
|
768
|
-
- `APP_RUNTIME=website` serves only the SSR
|
|
819
|
+
- `APP_RUNTIME=unified` serves both applications (host routing still applies).
|
|
820
|
+
- `APP_RUNTIME=admin` serves only the SPA application.
|
|
821
|
+
- `APP_RUNTIME=website` serves only the SSR application.
|
|
769
822
|
|
|
770
|
-
If a host matches an
|
|
771
|
-
|
|
772
|
-
You can also load role-specific code only when needed:
|
|
773
|
-
|
|
774
|
-
```ts
|
|
775
|
-
export default async () => {
|
|
776
|
-
const role = process.env.APP_RUNTIME || 'unified'
|
|
777
|
-
const websiteApplication =
|
|
778
|
-
role === 'admin'
|
|
779
|
-
? undefined
|
|
780
|
-
: (await import('./website/SsrApplication')).websiteApplication
|
|
781
|
-
|
|
782
|
-
return defineSsrRuntime({
|
|
783
|
-
name: 'my-platform',
|
|
784
|
-
entries: [
|
|
785
|
-
{
|
|
786
|
-
id: 'admin',
|
|
787
|
-
kind: 'spa',
|
|
788
|
-
template: 'index.html',
|
|
789
|
-
hosts: ['app.example.com'],
|
|
790
|
-
roles: ['unified', 'admin'],
|
|
791
|
-
},
|
|
792
|
-
{
|
|
793
|
-
id: 'website',
|
|
794
|
-
kind: 'ssr',
|
|
795
|
-
template: 'site.html',
|
|
796
|
-
hosts: ['*'],
|
|
797
|
-
roles: ['unified', 'website'],
|
|
798
|
-
application: websiteApplication,
|
|
799
|
-
},
|
|
800
|
-
],
|
|
801
|
-
server: {
|
|
802
|
-
role,
|
|
803
|
-
publicConfig: {},
|
|
804
|
-
},
|
|
805
|
-
})
|
|
806
|
-
}
|
|
807
|
-
```
|
|
823
|
+
If a host matches an application that the current role does not allow, the server responds with `421`.
|
|
808
824
|
|
|
809
|
-
`
|
|
825
|
+
`defineSsrConfig` accepts either a plain object or an async factory function.
|
|
810
826
|
|
|
811
827
|
## Custom Endpoints
|
|
812
828
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrApplicationRuntime.d.ts","sourceRoot":"","sources":["../src/SsrApplicationRuntime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SsrApplicationRuntime.d.ts","sourceRoot":"","sources":["../src/SsrApplicationRuntime.ts"],"names":[],"mappings":"AAeA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,2BAA2B,CAC1C,iBAAiB,EACjB,aAAa;IAEb,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IACxC,cAAc,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAAG,IAAI,CAAA;IAC3E;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC5C;;;OAGG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAA;CACrC;AAED,eAAO,MAAM,oBAAoB,GAC/B,iBAAiB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,aAAa,GAAG,OAAO,EACvB,UAAU,GAAG,OAAO,EAEpB,YAAY,wBAAwB,CAClC,iBAAiB,EACjB,aAAa,EACb,UAAU,CACX,EACD,SAAS,2BAA2B,CAAC,iBAAiB,EAAE,aAAa,CAAC,KACrE,OAAO,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,aAAa,EAAE,UAAU,CAAC,CAkH7E,CAAA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { App } from 'vue';
|
|
2
|
+
import { SsrDomainContext } from './SsrConfigTypes';
|
|
2
3
|
import { SsrApplicationDefinition } from './SsrRuntimeTypes';
|
|
3
4
|
export interface SsrHydrateOptions {
|
|
4
5
|
mountSelector?: string;
|
|
@@ -7,10 +8,12 @@ export interface SsrHydrateOptions {
|
|
|
7
8
|
}
|
|
8
9
|
export interface SsrSpaMountOptions<TPublicConfig = unknown> {
|
|
9
10
|
mountSelector?: string;
|
|
10
|
-
/** Client-side public config. Defaults to
|
|
11
|
+
/** Client-side public config. Defaults to injected SPA domain state. */
|
|
11
12
|
publicConfig?: TPublicConfig;
|
|
12
13
|
/** Initial URL to route to. Defaults to `window.location`. */
|
|
13
14
|
url?: string;
|
|
15
|
+
/** Domain context. Defaults to `#vue-ssr-lite-domain` injection. */
|
|
16
|
+
domain?: SsrDomainContext;
|
|
14
17
|
}
|
|
15
18
|
export interface SsrMountedApplication {
|
|
16
19
|
app: App;
|
|
@@ -19,11 +22,9 @@ export interface SsrMountedApplication {
|
|
|
19
22
|
}
|
|
20
23
|
export declare const hydrateSsrApplication: (definition: SsrApplicationDefinition<any, any, any>, options?: SsrHydrateOptions) => Promise<void>;
|
|
21
24
|
/**
|
|
22
|
-
* Mounts an {@link SsrApplicationDefinition} as a pure client-side SPA
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* all three, so a consumer's SPA entry and SSR entry cannot drift. No server
|
|
26
|
-
* markup is required: Vue performs a full client render.
|
|
25
|
+
* Mounts an {@link SsrApplicationDefinition} as a pure client-side SPA.
|
|
26
|
+
* Domain context is restored from the server-injected `#vue-ssr-lite-domain`
|
|
27
|
+
* payload so SPA and SSR share the same library-owned resolution.
|
|
27
28
|
*/
|
|
28
29
|
export declare const mountSpaApplication: <TApplicationState extends Record<string, any> = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown>(definition: SsrApplicationDefinition<TApplicationState, TPublicConfig, TExtension>, options?: SsrSpaMountOptions<TPublicConfig>) => Promise<SsrMountedApplication>;
|
|
29
30
|
//# sourceMappingURL=SsrBrowserRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrBrowserRuntime.d.ts","sourceRoot":"","sources":["../src/SsrBrowserRuntime.ts"],"names":[],"mappings":"AAAA,OAA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kBAAkB,CAAC,aAAa,CAAM,KAC9C,OAAO,CAAC,qBAAqB,CAyD/B,CAAA"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { SsrApplicationDomainConfig, SsrDomainMode } from './SsrConfigTypes';
|
|
2
|
+
import { defineSsrConfig } from './SsrConfigRuntime';
|
|
3
|
+
import { SsrApplicationDefinition, SsrEndpointDefinition, SsrEntryKind, SsrReadinessProbe, SsrResponseCacheStrategy, SsrServerOptions } from './SsrRuntimeTypes';
|
|
4
|
+
export { defineSsrConfig };
|
|
5
|
+
export interface SsrCompiledApplication {
|
|
6
|
+
id: string;
|
|
7
|
+
kind: SsrEntryKind;
|
|
8
|
+
template: string;
|
|
9
|
+
hosts: string[];
|
|
10
|
+
roles?: string[];
|
|
11
|
+
application?: SsrApplicationDefinition<any, any, any>;
|
|
12
|
+
mountSelector?: string;
|
|
13
|
+
cacheControl?: string;
|
|
14
|
+
responseCache?: SsrResponseCacheStrategy<any>;
|
|
15
|
+
endpoints: SsrEndpointDefinition<any>[];
|
|
16
|
+
cookieAllowlist: string[];
|
|
17
|
+
cookieDenylist: string[];
|
|
18
|
+
publicConfig: Record<string, unknown>;
|
|
19
|
+
domain: {
|
|
20
|
+
development: string;
|
|
21
|
+
production: string;
|
|
22
|
+
mode: SsrDomainMode;
|
|
23
|
+
localAliases: boolean;
|
|
24
|
+
customDomains: boolean;
|
|
25
|
+
expose: SsrApplicationDomainConfig['expose'];
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface SsrCompiledConfig {
|
|
29
|
+
name: string;
|
|
30
|
+
applications: SsrCompiledApplication[];
|
|
31
|
+
defaultApplicationId?: string;
|
|
32
|
+
server: SsrServerOptions<Record<string, unknown>>;
|
|
33
|
+
readiness?: SsrReadinessProbe[];
|
|
34
|
+
development: boolean;
|
|
35
|
+
}
|
|
36
|
+
export declare const resolveSsrConfigPath: (root: string, explicit?: string) => Promise<string>;
|
|
37
|
+
export declare const compileSsrConfig: (loaded: unknown, options?: {
|
|
38
|
+
development?: boolean;
|
|
39
|
+
}) => Promise<SsrCompiledConfig>;
|
|
40
|
+
//# sourceMappingURL=SsrConfigCompileRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrConfigCompileRuntime.d.ts","sourceRoot":"","sources":["../src/SsrConfigCompileRuntime.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,0BAA0B,EAI1B,aAAa,EACd,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,YAAY,EACZ,iBAAiB,EACjB,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,mBAAmB,CAAA;AAQ1B,OAAO,EAAE,eAAe,EAAE,CAAA;AAU1B,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,YAAY,CAAA;IAClB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,EAAE,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;IAChB,WAAW,CAAC,EAAE,wBAAwB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAA;IACrD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,aAAa,CAAC,EAAE,wBAAwB,CAAC,GAAG,CAAC,CAAA;IAC7C,SAAS,EAAE,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAA;IACvC,eAAe,EAAE,MAAM,EAAE,CAAA;IACzB,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACrC,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAA;QACnB,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,aAAa,CAAA;QACnB,YAAY,EAAE,OAAO,CAAA;QACrB,aAAa,EAAE,OAAO,CAAA;QACtB,MAAM,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAA;KAC7C,CAAA;CACF;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,YAAY,EAAE,sBAAsB,EAAE,CAAA;IACtC,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAA;IACjD,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAA;IAC/B,WAAW,EAAE,OAAO,CAAA;CACrB;AA8FD,eAAO,MAAM,oBAAoB,GAC/B,MAAM,MAAM,EACZ,WAAW,MAAM,KAChB,OAAO,CAAC,MAAM,CAchB,CAAA;AAED,eAAO,MAAM,gBAAgB,GAC3B,QAAQ,OAAO,EACf,UAAS;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,KACtC,OAAO,CAAC,iBAAiB,CA8H3B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrConfigRuntime.d.ts","sourceRoot":"","sources":["../src/SsrConfigRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,gEAAgE;AAChE,eAAO,MAAM,eAAe,GAAI,CAAC,SAAS,SAAS,EAAE,QAAQ,CAAC,KAAG,CAAW,CAAA"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { SsrApplicationDefinition, SsrEndpointDefinition, SsrLogger, SsrReadinessProbe, SsrResponseCacheStrategy } from './SsrRuntimeTypes';
|
|
2
|
+
/** How an application owns its apex hostname and subdomains. */
|
|
3
|
+
export type SsrDomainMode = 'root' | 'subdomains' | 'root-and-subdomains';
|
|
4
|
+
export interface SsrApplicationDomainExpose {
|
|
5
|
+
/** Expose the last subdomain label under the app base (e.g. workspace). */
|
|
6
|
+
subdomainAs?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Expose the remaining labels under the app base, or the full hostname for
|
|
9
|
+
* custom domains (e.g. storeDomain).
|
|
10
|
+
*/
|
|
11
|
+
subdomainOrHostnameAs?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SsrApplicationDomainConfig {
|
|
14
|
+
/** Apex used while `NODE_ENV !== 'production'`. */
|
|
15
|
+
development: string;
|
|
16
|
+
/** Apex used in production. */
|
|
17
|
+
production: string;
|
|
18
|
+
/** Defaults to `root-and-subdomains`. */
|
|
19
|
+
mode?: SsrDomainMode;
|
|
20
|
+
/** Register loopback aliases in development. Defaults to false. */
|
|
21
|
+
localAliases?: boolean;
|
|
22
|
+
/** Own unmatched hosts via catch-all `*`. Defaults to false. */
|
|
23
|
+
customDomains?: boolean;
|
|
24
|
+
/** Extra exact hostnames owned by this application. */
|
|
25
|
+
additionalHosts?: readonly string[];
|
|
26
|
+
/** Map resolved subdomain/hostname values onto `useSsrDomain().params`. */
|
|
27
|
+
expose?: SsrApplicationDomainExpose;
|
|
28
|
+
}
|
|
29
|
+
export interface SsrApplicationGraphqlConfig {
|
|
30
|
+
endpoint: string;
|
|
31
|
+
timeout?: number;
|
|
32
|
+
}
|
|
33
|
+
export interface SsrApplicationCookiesConfig {
|
|
34
|
+
allow?: string | readonly string[];
|
|
35
|
+
deny?: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
export type SsrApplicationLoader = SsrApplicationDefinition<any, any, any> | (() => SsrApplicationDefinition<any, any, any> | Promise<SsrApplicationDefinition<any, any, any>>);
|
|
38
|
+
/**
|
|
39
|
+
* One self-contained SPA or SSR application: runtime, domain, security,
|
|
40
|
+
* endpoints, and public configuration live together.
|
|
41
|
+
*/
|
|
42
|
+
export interface SsrApplicationConfig {
|
|
43
|
+
/**
|
|
44
|
+
* SPA HTML shell. Use `true` (recommended) or a client-only loader reference.
|
|
45
|
+
* The Node server never executes SPA loaders — mount with
|
|
46
|
+
* `mountSpaApplication()` from a browser entry instead.
|
|
47
|
+
*/
|
|
48
|
+
spa?: true | SsrApplicationLoader;
|
|
49
|
+
/** Server-rendered Vue application. */
|
|
50
|
+
ssr?: SsrApplicationLoader;
|
|
51
|
+
template: string;
|
|
52
|
+
roles?: readonly string[];
|
|
53
|
+
domain: SsrApplicationDomainConfig;
|
|
54
|
+
graphql?: SsrApplicationGraphqlConfig;
|
|
55
|
+
cookies?: SsrApplicationCookiesConfig;
|
|
56
|
+
endpoints?: SsrEndpointDefinition<any>[];
|
|
57
|
+
mountSelector?: string;
|
|
58
|
+
cacheControl?: string;
|
|
59
|
+
responseCache?: SsrResponseCacheStrategy<any>;
|
|
60
|
+
/** Merged into the request `publicConfig` for this application. */
|
|
61
|
+
publicConfig?: Record<string, unknown>;
|
|
62
|
+
}
|
|
63
|
+
export interface SsrConfigServerOptions {
|
|
64
|
+
root?: string;
|
|
65
|
+
host?: string;
|
|
66
|
+
port?: number;
|
|
67
|
+
trustProxy?: boolean;
|
|
68
|
+
clientOutDir?: string;
|
|
69
|
+
requestTimeoutMs?: number;
|
|
70
|
+
shutdownTimeoutMs?: number;
|
|
71
|
+
healthPath?: string;
|
|
72
|
+
readinessPath?: string;
|
|
73
|
+
maxResolutionPasses?: number;
|
|
74
|
+
resolutionDeadlineMs?: number;
|
|
75
|
+
diagnostics?: boolean;
|
|
76
|
+
logger?: SsrLogger;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Flat Vite/Nuxt-style SSR configuration.
|
|
80
|
+
* Everything about an application lives under `applications.<id>`.
|
|
81
|
+
*/
|
|
82
|
+
export interface SsrConfig {
|
|
83
|
+
name: string;
|
|
84
|
+
server?: SsrConfigServerOptions;
|
|
85
|
+
/** Active process role (`unified`, `erp`, `storefront`, …). */
|
|
86
|
+
runtime?: string;
|
|
87
|
+
applications: Record<string, SsrApplicationConfig>;
|
|
88
|
+
/** Used only when no application host pattern matches. */
|
|
89
|
+
defaultApplicationId?: string;
|
|
90
|
+
readiness?: SsrReadinessProbe[];
|
|
91
|
+
}
|
|
92
|
+
export type SsrConfigExport = SsrConfig | (() => SsrConfig | Promise<SsrConfig>);
|
|
93
|
+
/** Serializable domain snapshot attached to every request and hydration state. */
|
|
94
|
+
export interface SsrDomainContext {
|
|
95
|
+
/** Selected application id. */
|
|
96
|
+
entry: string;
|
|
97
|
+
hostname: string;
|
|
98
|
+
/** Active environment apex for the selected application. */
|
|
99
|
+
baseDomain: string;
|
|
100
|
+
/** Remaining labels under `baseDomain`, or null on the apex / custom host. */
|
|
101
|
+
subdomain: string | null;
|
|
102
|
+
isCustomDomain: boolean;
|
|
103
|
+
development: boolean;
|
|
104
|
+
/** Values declared via `domain.expose`. */
|
|
105
|
+
params: Record<string, string>;
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=SsrConfigTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrConfigTypes.d.ts","sourceRoot":"","sources":["../src/SsrConfigTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AACjE,OAAO,KAAK,EACV,qBAAqB,EACrB,SAAS,EACT,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,mBAAmB,CAAA;AAE1B,gEAAgE;AAChE,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,YAAY,GAAG,qBAAqB,CAAA;AAEzE,MAAM,WAAW,0BAA0B;IACzC,2EAA2E;IAC3E,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAA;CAC/B;AAED,MAAM,WAAW,0BAA0B;IACzC,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAA;IACnB,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,yCAAyC;IACzC,IAAI,CAAC,EAAE,aAAa,CAAA;IACpB,mEAAmE;IACnE,YAAY,CAAC,EA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,EAAE,OAAO,CAAA;IACvB,WAAW,EAAE,OAAO,CAAA;IACpB,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC/B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { SsrApplicationDomainConfig, SsrDomainContext, SsrDomainMode } from './SsrConfigTypes';
|
|
3
|
+
export declare const SSR_DOMAIN_CONTEXT: InjectionKey<SsrDomainContext>;
|
|
4
|
+
export interface SsrDomainApplicationRef {
|
|
5
|
+
id: string;
|
|
6
|
+
domain: {
|
|
7
|
+
development: string;
|
|
8
|
+
production: string;
|
|
9
|
+
mode: SsrDomainMode;
|
|
10
|
+
localAliases: boolean;
|
|
11
|
+
customDomains: boolean;
|
|
12
|
+
expose?: SsrApplicationDomainConfig['expose'];
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export declare const resolveSsrDomainContext: (host: string, application: SsrDomainApplicationRef, development: boolean) => SsrDomainContext;
|
|
16
|
+
export declare const buildSsrSubdomainUrl: (options: {
|
|
17
|
+
baseDomain: string;
|
|
18
|
+
subdomain: string;
|
|
19
|
+
path?: string;
|
|
20
|
+
protocol?: "http" | "https";
|
|
21
|
+
port?: string | number;
|
|
22
|
+
development?: boolean;
|
|
23
|
+
}) => string;
|
|
24
|
+
export interface SsrDomainApi extends SsrDomainContext {
|
|
25
|
+
buildSubdomainUrl: (subdomain: string, path?: string, options?: {
|
|
26
|
+
port?: string | number;
|
|
27
|
+
protocol?: 'http' | 'https';
|
|
28
|
+
}) => string;
|
|
29
|
+
}
|
|
30
|
+
export declare const installSsrDomainContext: (domain: SsrDomainContext) => (() => void);
|
|
31
|
+
/**
|
|
32
|
+
* Domain context for the application selected for the current request.
|
|
33
|
+
* Works during SSR, SPA mounting, endpoint handling, route guards, and
|
|
34
|
+
* browser hydration.
|
|
35
|
+
*/
|
|
36
|
+
export declare const useSsrDomain: () => SsrDomainApi;
|
|
37
|
+
export type { SsrDomainContext } from './SsrConfigTypes';
|
|
38
|
+
//# sourceMappingURL=SsrDomainRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrDomainRuntime.d.ts","sourceRoot":"","sources":["../src/SsrDomainRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,KAAK,EACV,0BAA0B,EAC1B,gBAAgB,EAChB,aAAa,EACd,MAAM,kBAAkB,CAAA;AAGzB,eAAO,MAAM,kBAAkB,EAE1B,YAAY,CAAC,gBAAgB,CAAC,CAAA;AAEnC,MAAM,WAAW,uBAAuB;IACtC,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE;QACN,WAAW,EAAE,MAAM,CAAA;QACnB,UAAU,EAAE,MAAM,CAAA;QAClB,IAAI,EAAE,aAAa,CAAA;QACnB,YAAY,EAAE,OAAO,CAAA;QACrB,aAAa,EAAE,OAAO,CAAA;QACtB,MAAM,CAAC,EAAE,0BAA0B,CAAC,QAAQ,CAAC,CAAA;KAC9C,CAAA;CACF;AAYD,eAAO,MAAM,uBAAuB,GAClC,MAAM,MAAM,EACZ,aAAa,uBAAuB,EACpC,aAAa,OAAO,KACnB,gBAsDF,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS;IAC5C,UAAU,EAAE,MAAM,CAAA;IAClB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;IAC3B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB,KAAG,MA0BH,CAAA;AAED,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD,iBAAiB,EAAE,CACjB,SAAS,EAAE,MAAM,EACjB,IAAI,CAAC,EAAE,MAAM,EACb,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