@stratal/inertia 0.0.22 → 0.0.24
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 +33 -1
- package/dist/build-seo-tags-DBsHKxX9.mjs +123 -0
- package/dist/build-seo-tags-DBsHKxX9.mjs.map +1 -0
- package/dist/{decorate-CzXVx7ZH.mjs → decorate-B7nr7eBl.mjs} +1 -1
- package/dist/generator/type-generator.worker.mjs +1 -1
- package/dist/generator/type-generator.worker.mjs.map +1 -1
- package/dist/index.d.mts +209 -78
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +274 -60
- package/dist/index.mjs.map +1 -1
- package/dist/quarry.d.mts +9 -0
- package/dist/quarry.d.mts.map +1 -1
- package/dist/quarry.mjs +56 -9
- package/dist/quarry.mjs.map +1 -1
- package/dist/react.d.mts +15 -3
- package/dist/react.d.mts.map +1 -1
- package/dist/react.mjs +21 -8
- package/dist/react.mjs.map +1 -1
- package/dist/seo-runtime.d.mts +1 -0
- package/dist/seo-runtime.mjs +56 -0
- package/dist/seo-runtime.mjs.map +1 -0
- package/dist/ssr.d.mts +65 -0
- package/dist/ssr.d.mts.map +1 -0
- package/dist/ssr.mjs +56 -0
- package/dist/ssr.mjs.map +1 -0
- package/dist/testing.d.mts +1 -1
- package/dist/testing.mjs.map +1 -1
- package/dist/{type-generator-bfo14BJI.mjs → type-generator-DFpha_Fp.mjs} +178 -28
- package/dist/type-generator-DFpha_Fp.mjs.map +1 -0
- package/dist/types-BhgXhWx6.d.mts +82 -0
- package/dist/types-BhgXhWx6.d.mts.map +1 -0
- package/dist/types-DzE1pdZs.d.mts +76 -0
- package/dist/types-DzE1pdZs.d.mts.map +1 -0
- package/dist/vite.d.mts.map +1 -1
- package/dist/vite.mjs +22 -2
- package/dist/vite.mjs.map +1 -1
- package/package.json +27 -18
- package/dist/type-generator-bfo14BJI.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Inertia.js v3 server adapter for [Stratal](https://github.com/strataljs/stratal)
|
|
|
16
16
|
## Features
|
|
17
17
|
|
|
18
18
|
- **InertiaModule** — Drop-in Stratal module with `forRoot()` / `forRootAsync()` configuration
|
|
19
|
-
- **
|
|
19
|
+
- **Streaming SSR** — React 19 `renderToReadableStream` streaming via `createInertiaSsrApp`, with configurable per-route disabling
|
|
20
20
|
- **Shared Data** — Global shared props with static values or request-scoped resolvers
|
|
21
21
|
- **@InertiaRoute Decorator** — Convention-based Inertia page routes with auto-applied response schema
|
|
22
22
|
- **Partial Reloads** — Optional, deferred, and merge props for efficient data loading
|
|
@@ -82,6 +82,38 @@ export class NotesController {
|
|
|
82
82
|
}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
+
### Streaming SSR
|
|
86
|
+
|
|
87
|
+
Enable SSR by pointing the module at a bundle that exports a streaming `render`:
|
|
88
|
+
|
|
89
|
+
```typescript
|
|
90
|
+
InertiaModule.forRoot({
|
|
91
|
+
rootView: 'app',
|
|
92
|
+
ssr: { bundle: () => import('./inertia/ssr') },
|
|
93
|
+
})
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
`src/inertia/ssr.tsx` (scaffolded by `quarry inertia:install`) uses
|
|
97
|
+
`createInertiaSsrApp`, which wires Inertia's `App`, head collection, and React 19's
|
|
98
|
+
`renderToReadableStream` — the shell flushes early and the body streams progressively:
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
import { createInertiaSsrApp } from '@stratal/inertia/ssr'
|
|
102
|
+
|
|
103
|
+
export const { render } = createInertiaSsrApp({
|
|
104
|
+
resolve: async (name) => {
|
|
105
|
+
const pages = import.meta.glob('./pages/**/*.tsx')
|
|
106
|
+
const page = await pages[`./pages/${name}.tsx`]?.()
|
|
107
|
+
if (!page) throw new Error(`Page not found: ${name}`)
|
|
108
|
+
return page
|
|
109
|
+
},
|
|
110
|
+
})
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
There is no client-side fallback — an SSR failure surfaces as an error rather than
|
|
114
|
+
silently degrading. Skip SSR per route with `ctx.withoutSsr()` or globally with
|
|
115
|
+
`ssr.disabled: ['admin/*']`.
|
|
116
|
+
|
|
85
117
|
## Documentation
|
|
86
118
|
|
|
87
119
|
Full guides and examples are available at **[stratal.dev](https://stratal.dev)**.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
//#region src/seo/build-seo-tags.ts
|
|
2
|
+
/**
|
|
3
|
+
* Marker attribute stamped on every SEO-managed head element. The server emits
|
|
4
|
+
* it on injected tags and the client head-sync runtime uses it to find and
|
|
5
|
+
* reconcile the same tags across SPA navigations.
|
|
6
|
+
*/
|
|
7
|
+
const DATA_SEO_ATTR = "data-seo";
|
|
8
|
+
/**
|
|
9
|
+
* Maps resolved {@link SeoData} into a flat list of {@link SeoTagDescriptor}s.
|
|
10
|
+
*
|
|
11
|
+
* Pure and framework-free: used server-side to render HTML strings and
|
|
12
|
+
* client-side to build DOM nodes, so the two never drift. Every descriptor
|
|
13
|
+
* carries the {@link DATA_SEO_ATTR} marker.
|
|
14
|
+
*/
|
|
15
|
+
function buildSeoTags(data) {
|
|
16
|
+
const tags = [];
|
|
17
|
+
if (data.title != null) tags.push({
|
|
18
|
+
tag: "title",
|
|
19
|
+
attrs: {},
|
|
20
|
+
content: data.title
|
|
21
|
+
});
|
|
22
|
+
meta(tags, { name: "description" }, data.description);
|
|
23
|
+
meta(tags, { name: "keywords" }, Array.isArray(data.keywords) ? data.keywords.join(", ") : data.keywords);
|
|
24
|
+
meta(tags, { name: "author" }, data.author);
|
|
25
|
+
meta(tags, { name: "robots" }, data.robots);
|
|
26
|
+
if (data.canonical != null) tags.push({
|
|
27
|
+
tag: "link",
|
|
28
|
+
attrs: {
|
|
29
|
+
rel: "canonical",
|
|
30
|
+
href: data.canonical
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const og = data.openGraph;
|
|
34
|
+
if (og) {
|
|
35
|
+
metaProp(tags, "og:title", og.title);
|
|
36
|
+
metaProp(tags, "og:description", og.description);
|
|
37
|
+
metaProp(tags, "og:image", og.image);
|
|
38
|
+
metaProp(tags, "og:type", og.type);
|
|
39
|
+
metaProp(tags, "og:url", og.url);
|
|
40
|
+
metaProp(tags, "og:site_name", og.siteName);
|
|
41
|
+
}
|
|
42
|
+
const tw = data.twitter;
|
|
43
|
+
if (tw) {
|
|
44
|
+
meta(tags, { name: "twitter:card" }, tw.card);
|
|
45
|
+
meta(tags, { name: "twitter:title" }, tw.title);
|
|
46
|
+
meta(tags, { name: "twitter:description" }, tw.description);
|
|
47
|
+
meta(tags, { name: "twitter:image" }, tw.image);
|
|
48
|
+
meta(tags, { name: "twitter:site" }, tw.site);
|
|
49
|
+
meta(tags, { name: "twitter:creator" }, tw.creator);
|
|
50
|
+
}
|
|
51
|
+
if (data.meta) for (const entry of data.meta) {
|
|
52
|
+
const attrs = {};
|
|
53
|
+
if (entry.name != null) attrs.name = entry.name;
|
|
54
|
+
if (entry.property != null) attrs.property = entry.property;
|
|
55
|
+
attrs.content = entry.content;
|
|
56
|
+
tags.push({
|
|
57
|
+
tag: "meta",
|
|
58
|
+
attrs
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
if (data.link) for (const entry of data.link) {
|
|
62
|
+
const attrs = {};
|
|
63
|
+
for (const [key, value] of Object.entries(entry)) if (isSafeAttrName(key)) attrs[key] = value;
|
|
64
|
+
tags.push({
|
|
65
|
+
tag: "link",
|
|
66
|
+
attrs
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
for (const t of tags) t.attrs[DATA_SEO_ATTR] = "";
|
|
70
|
+
return tags;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Valid HTML attribute name. Used to drop any attribute whose name (e.g. a key
|
|
74
|
+
* spread from a user-supplied custom `meta`/`link` entry) could otherwise break
|
|
75
|
+
* out of the tag and inject markup — attribute values are escaped, but names are
|
|
76
|
+
* emitted verbatim, so an unsafe name like `x onload=…` must be rejected.
|
|
77
|
+
*/
|
|
78
|
+
const VALID_ATTR_NAME = /^[A-Za-z_:][\w.:-]*$/;
|
|
79
|
+
/**
|
|
80
|
+
* A valid attribute name that is also not an inline event handler. Even with a
|
|
81
|
+
* well-formed name and an escaped value, `on*` attributes execute JS, so a
|
|
82
|
+
* user-supplied `onload`/`onerror`/… key must never be emitted.
|
|
83
|
+
*/
|
|
84
|
+
function isSafeAttrName(name) {
|
|
85
|
+
return VALID_ATTR_NAME.test(name) && !/^on/i.test(name);
|
|
86
|
+
}
|
|
87
|
+
/** Renders a descriptor to an HTML string with attribute/text escaping (server-side). */
|
|
88
|
+
function descriptorToHtml(d) {
|
|
89
|
+
const attrs = Object.entries(d.attrs).filter(([key]) => isSafeAttrName(key)).map(([key, value]) => value === "" ? key : `${key}="${escapeAttr(value)}"`).join(" ");
|
|
90
|
+
const open = attrs ? `${d.tag} ${attrs}` : d.tag;
|
|
91
|
+
if (d.tag === "title") return `<title ${attrs}>${escapeText(d.content ?? "")}</title>`;
|
|
92
|
+
return `<${open} />`;
|
|
93
|
+
}
|
|
94
|
+
function meta(tags, attrs, content) {
|
|
95
|
+
if (content == null) return;
|
|
96
|
+
tags.push({
|
|
97
|
+
tag: "meta",
|
|
98
|
+
attrs: {
|
|
99
|
+
...attrs,
|
|
100
|
+
content
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function metaProp(tags, property, content) {
|
|
105
|
+
if (content == null) return;
|
|
106
|
+
tags.push({
|
|
107
|
+
tag: "meta",
|
|
108
|
+
attrs: {
|
|
109
|
+
property,
|
|
110
|
+
content
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
function escapeAttr(value) {
|
|
115
|
+
return value.replace(/&/g, "&").replace(/"/g, """).replace(/</g, "<").replace(/>/g, ">");
|
|
116
|
+
}
|
|
117
|
+
function escapeText(value) {
|
|
118
|
+
return value.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { buildSeoTags as n, descriptorToHtml as r, DATA_SEO_ATTR as t };
|
|
122
|
+
|
|
123
|
+
//# sourceMappingURL=build-seo-tags-DBsHKxX9.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"build-seo-tags-DBsHKxX9.mjs","names":[],"sources":["../src/seo/build-seo-tags.ts"],"sourcesContent":["import type { SeoData, SeoTagDescriptor } from './types'\n\n/**\n * Marker attribute stamped on every SEO-managed head element. The server emits\n * it on injected tags and the client head-sync runtime uses it to find and\n * reconcile the same tags across SPA navigations.\n */\nexport const DATA_SEO_ATTR = 'data-seo'\n\n/**\n * Maps resolved {@link SeoData} into a flat list of {@link SeoTagDescriptor}s.\n *\n * Pure and framework-free: used server-side to render HTML strings and\n * client-side to build DOM nodes, so the two never drift. Every descriptor\n * carries the {@link DATA_SEO_ATTR} marker.\n */\nexport function buildSeoTags(data: SeoData): SeoTagDescriptor[] {\n const tags: SeoTagDescriptor[] = []\n\n if (data.title != null) {\n tags.push({ tag: 'title', attrs: {}, content: data.title })\n }\n\n meta(tags, { name: 'description' }, data.description)\n meta(tags, { name: 'keywords' }, Array.isArray(data.keywords) ? data.keywords.join(', ') : data.keywords)\n meta(tags, { name: 'author' }, data.author)\n meta(tags, { name: 'robots' }, data.robots)\n\n if (data.canonical != null) {\n tags.push({ tag: 'link', attrs: { rel: 'canonical', href: data.canonical } })\n }\n\n const og = data.openGraph\n if (og) {\n metaProp(tags, 'og:title', og.title)\n metaProp(tags, 'og:description', og.description)\n metaProp(tags, 'og:image', og.image)\n metaProp(tags, 'og:type', og.type)\n metaProp(tags, 'og:url', og.url)\n metaProp(tags, 'og:site_name', og.siteName)\n }\n\n const tw = data.twitter\n if (tw) {\n meta(tags, { name: 'twitter:card' }, tw.card)\n meta(tags, { name: 'twitter:title' }, tw.title)\n meta(tags, { name: 'twitter:description' }, tw.description)\n meta(tags, { name: 'twitter:image' }, tw.image)\n meta(tags, { name: 'twitter:site' }, tw.site)\n meta(tags, { name: 'twitter:creator' }, tw.creator)\n }\n\n if (data.meta) {\n for (const entry of data.meta) {\n const attrs: Record<string, string> = {}\n if (entry.name != null) attrs.name = entry.name\n if (entry.property != null) attrs.property = entry.property\n attrs.content = entry.content\n tags.push({ tag: 'meta', attrs })\n }\n }\n\n if (data.link) {\n for (const entry of data.link) {\n const attrs: Record<string, string> = {}\n // Custom link entries carry arbitrary keys; drop any whose name isn't a\n // safe attribute so a crafted key can't break out of the tag (server),\n // throw from `setAttribute` (client head-sync), or smuggle in an inline\n // event handler (`<link rel=… onload=…>` fires for some rel values).\n for (const [key, value] of Object.entries(entry)) {\n if (isSafeAttrName(key)) attrs[key] = value\n }\n tags.push({ tag: 'link', attrs })\n }\n }\n\n // Stamp the marker on every descriptor.\n for (const t of tags) {\n t.attrs[DATA_SEO_ATTR] = ''\n }\n\n return tags\n}\n\n/**\n * Valid HTML attribute name. Used to drop any attribute whose name (e.g. a key\n * spread from a user-supplied custom `meta`/`link` entry) could otherwise break\n * out of the tag and inject markup — attribute values are escaped, but names are\n * emitted verbatim, so an unsafe name like `x onload=…` must be rejected.\n */\nconst VALID_ATTR_NAME = /^[A-Za-z_:][\\w.:-]*$/\n\n/**\n * A valid attribute name that is also not an inline event handler. Even with a\n * well-formed name and an escaped value, `on*` attributes execute JS, so a\n * user-supplied `onload`/`onerror`/… key must never be emitted.\n */\nfunction isSafeAttrName(name: string): boolean {\n return VALID_ATTR_NAME.test(name) && !/^on/i.test(name)\n}\n\n/** Renders a descriptor to an HTML string with attribute/text escaping (server-side). */\nexport function descriptorToHtml(d: SeoTagDescriptor): string {\n const attrs = Object.entries(d.attrs)\n .filter(([key]) => isSafeAttrName(key))\n .map(([key, value]) => (value === '' ? key : `${key}=\"${escapeAttr(value)}\"`))\n .join(' ')\n const open = attrs ? `${d.tag} ${attrs}` : d.tag\n\n if (d.tag === 'title') {\n return `<title ${attrs}>${escapeText(d.content ?? '')}</title>`\n }\n return `<${open} />`\n}\n\nfunction meta(tags: SeoTagDescriptor[], attrs: Record<string, string>, content: string | undefined): void {\n if (content == null) return\n tags.push({ tag: 'meta', attrs: { ...attrs, content } })\n}\n\nfunction metaProp(tags: SeoTagDescriptor[], property: string, content: string | undefined): void {\n if (content == null) return\n tags.push({ tag: 'meta', attrs: { property, content } })\n}\n\nfunction escapeAttr(value: string): string {\n return value.replace(/&/g, '&').replace(/\"/g, '"').replace(/</g, '<').replace(/>/g, '>')\n}\n\nfunction escapeText(value: string): string {\n return value.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')\n}\n"],"mappings":";;;;;;AAOA,MAAa,gBAAgB;;;;;;;;AAS7B,SAAgB,aAAa,MAAmC;CAC9D,MAAM,OAA2B,CAAC;CAElC,IAAI,KAAK,SAAS,MAChB,KAAK,KAAK;EAAE,KAAK;EAAS,OAAO,CAAC;EAAG,SAAS,KAAK;CAAM,CAAC;CAG5D,KAAK,MAAM,EAAE,MAAM,cAAc,GAAG,KAAK,WAAW;CACpD,KAAK,MAAM,EAAE,MAAM,WAAW,GAAG,MAAM,QAAQ,KAAK,QAAQ,IAAI,KAAK,SAAS,KAAK,IAAI,IAAI,KAAK,QAAQ;CACxG,KAAK,MAAM,EAAE,MAAM,SAAS,GAAG,KAAK,MAAM;CAC1C,KAAK,MAAM,EAAE,MAAM,SAAS,GAAG,KAAK,MAAM;CAE1C,IAAI,KAAK,aAAa,MACpB,KAAK,KAAK;EAAE,KAAK;EAAQ,OAAO;GAAE,KAAK;GAAa,MAAM,KAAK;EAAU;CAAE,CAAC;CAG9E,MAAM,KAAK,KAAK;CAChB,IAAI,IAAI;EACN,SAAS,MAAM,YAAY,GAAG,KAAK;EACnC,SAAS,MAAM,kBAAkB,GAAG,WAAW;EAC/C,SAAS,MAAM,YAAY,GAAG,KAAK;EACnC,SAAS,MAAM,WAAW,GAAG,IAAI;EACjC,SAAS,MAAM,UAAU,GAAG,GAAG;EAC/B,SAAS,MAAM,gBAAgB,GAAG,QAAQ;CAC5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U,KAAK,MAAM,GAAG,IAAI,IAAI,WAAW,KAAK,EAAE,EAAG,EAC5E,KAAK,GAAG;CACX,MAAM,OAAO,QAAQ,GAAG,EAAE,IAAI,GAAG,UAAU,EAAE;CAE7C,IAAI,EAAE,QAAQ,SACZ,OAAO,UAAU,MAAM,GAAG,WAAW,EAAE,WAAW,EAAE,EAAE;CAExD,OAAO,IAAI,KAAK;AAClB;AAEA,SAAS,KAAK,MAA0B,OAA+B,SAAmC;CACxG,IAAI,WAAW,MAAM;CACrB,KAAK,KAAK;EAAE,KAAK;EAAQ,OAAO;GAAE,GAAG;GAAO;EAAQ;CAAE,CAAC;AACzD;AAEA,SAAS,SAAS,MAA0B,UAAkB,SAAmC;CAC/F,IAAI,WAAW,MAAM;CACrB,KAAK,KAAK;EAAE,KAAK;EAAQ,OAAO;GAAE;GAAU;EAAQ;CAAE,CAAC;AACzD;AAEA,SAAS,WAAW,OAAuB;CACzC,OAAO,MAAM,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,QAAQ,EAAE,QAAQ,MAAM,MAAM,EAAE,QAAQ,MAAM,MAAM;AACxG;AAEA,SAAS,WAAW,OAAuB;CACzC,OAAO,MAAM,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,MAAM,EAAE,QAAQ,MAAM,MAAM;AAChF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region \0@oxc-project+runtime@0.
|
|
1
|
+
//#region \0@oxc-project+runtime@0.133.0/helpers/esm/decorate.js
|
|
2
2
|
function __decorate(decorators, target, key, desc) {
|
|
3
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as runTypeGeneration } from "../type-generator-
|
|
1
|
+
import { n as runTypeGeneration } from "../type-generator-DFpha_Fp.mjs";
|
|
2
2
|
import { parentPort, workerData } from "node:worker_threads";
|
|
3
3
|
//#region src/generator/type-generator.worker.ts
|
|
4
4
|
async function main() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type-generator.worker.mjs","names":[],"sources":["../../src/generator/type-generator.worker.ts"],"sourcesContent":["import { parentPort, workerData } from 'node:worker_threads'\nimport { runTypeGeneration } from './type-generator'\n\ninterface WorkerInput {\n cwd: string\n}\n\nasync function main() {\n if (!parentPort) {\n throw new Error('[stratal:inertia-types] worker spawned without a parent port')\n }\n\n const { cwd } = workerData as WorkerInput\n\n try {\n const { outputPath, pageCount } = await runTypeGeneration(cwd)\n parentPort.postMessage({ ok: true, outputPath, pageCount })\n } catch (error) {\n parentPort.postMessage({\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n}\n\nvoid main()\n"],"mappings":";;;AAOA,eAAe,OAAO;CACpB,IAAI,CAAC,YACH,MAAM,IAAI,MAAM
|
|
1
|
+
{"version":3,"file":"type-generator.worker.mjs","names":[],"sources":["../../src/generator/type-generator.worker.ts"],"sourcesContent":["import { parentPort, workerData } from 'node:worker_threads'\nimport { runTypeGeneration } from './type-generator'\n\ninterface WorkerInput {\n cwd: string\n}\n\nasync function main() {\n if (!parentPort) {\n throw new Error('[stratal:inertia-types] worker spawned without a parent port')\n }\n\n const { cwd } = workerData as WorkerInput\n\n try {\n const { outputPath, pageCount } = await runTypeGeneration(cwd)\n parentPort.postMessage({ ok: true, outputPath, pageCount })\n } catch (error) {\n parentPort.postMessage({\n ok: false,\n error: error instanceof Error ? error.message : String(error),\n })\n }\n}\n\nvoid main()\n"],"mappings":";;;AAOA,eAAe,OAAO;CACpB,IAAI,CAAC,YACH,MAAM,IAAI,MAAM,8DAA8D;CAGhF,MAAM,EAAE,QAAQ;CAEhB,IAAI;EACF,MAAM,EAAE,YAAY,cAAc,MAAM,kBAAkB,GAAG;EAC7D,WAAW,YAAY;GAAE,IAAI;GAAM;GAAY;EAAU,CAAC;CAC5D,SAAS,OAAO;EACd,WAAW,YAAY;GACrB,IAAI;GACJ,OAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;EAC9D,CAAC;CACH;AACF;AAEK,KAAK"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
/// <reference path="../global.d.ts" />
|
|
2
|
+
import { a as SeoTagDescriptor, i as SeoOpenGraph, n as SeoLinkTag, o as SeoTwitter, r as SeoMetaTag, t as SeoData } from "./types-DzE1pdZs.mjs";
|
|
3
|
+
import { _ as ResolvedInertiaPageProps, a as InertiaMergeProp, b as ViteManifestEntry, c as InertiaOptionalProp, d as InertiaPageRegistry, f as InertiaRenderOptions, g as InertiaTranslationKeys, h as InertiaSsrResult, i as InertiaI18nConfig, l as InertiaPage, m as InertiaSsrBundle, n as InertiaDeferredProp, o as InertiaMergeStrategy, p as InertiaSharedProps, r as InertiaFullPageProps, s as InertiaOnceProp, t as InertiaAlwaysProp, u as InertiaPageComponent, v as SharedDataResolver, y as ViteManifest } from "./types-BhgXhWx6.mjs";
|
|
2
4
|
import { ExceptionHandler } from "stratal/errors";
|
|
3
5
|
import { AsyncModuleOptions, DynamicModule, OnException, OnInitialize } from "stratal/module";
|
|
4
6
|
import { Middleware, Next, RouteConfig, RouteConfigurable, Router, RouterContext } from "stratal/router";
|
|
7
|
+
import { Container } from "stratal/di";
|
|
5
8
|
import { MessageKeyPrefix } from "stratal/i18n";
|
|
6
|
-
import { LoggerService } from "stratal/logger";
|
|
7
9
|
import { z } from "stratal/validation";
|
|
8
|
-
import {
|
|
9
|
-
import { ContentfulStatusCode } from "hono/utils/http-status";
|
|
10
|
+
import { Page } from "@inertiajs/core";
|
|
10
11
|
import { CookieOptions } from "hono/utils/cookie";
|
|
11
12
|
|
|
12
13
|
//#region src/flash/flash-store.d.ts
|
|
@@ -17,12 +18,9 @@ interface FlashStore {
|
|
|
17
18
|
}
|
|
18
19
|
//#endregion
|
|
19
20
|
//#region src/inertia.options.d.ts
|
|
20
|
-
interface SsrBundleModule {
|
|
21
|
-
render(page: Page): Promise<InertiaAppSSRResponse>;
|
|
22
|
-
}
|
|
23
21
|
interface InertiaSsrOptions {
|
|
24
|
-
bundle: () => Promise<
|
|
25
|
-
default:
|
|
22
|
+
bundle: () => Promise<InertiaSsrBundle | {
|
|
23
|
+
default: InertiaSsrBundle;
|
|
26
24
|
}>;
|
|
27
25
|
/**
|
|
28
26
|
* Route patterns where SSR is disabled (e.g., `"admin/*"`).
|
|
@@ -67,6 +65,56 @@ interface InertiaI18nOptions {
|
|
|
67
65
|
interface InertiaFlashOptions {
|
|
68
66
|
store: FlashStore;
|
|
69
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* Configuration for backend-driven SEO metadata.
|
|
70
|
+
*
|
|
71
|
+
* Set on {@link InertiaModuleOptions.seo}. Controllers contribute per-page
|
|
72
|
+
* metadata via `ctx.seo()`; the module merges it over these defaults, applies
|
|
73
|
+
* the title template, injects the resulting tags into `<head>`, and shares the
|
|
74
|
+
* resolved data as the `seo` prop. The client head stays in sync automatically
|
|
75
|
+
* via the runtime the `stratalInertia()` Vite plugin injects; read the data in a
|
|
76
|
+
* component with `useSeo()` from `@stratal/inertia/react`.
|
|
77
|
+
*
|
|
78
|
+
* Both `defaults` and `titleTemplate` accept a static value or a `ctx`-aware
|
|
79
|
+
* resolver function (optionally async), so they can pull from the database or
|
|
80
|
+
* elsewhere for personalization — mirroring {@link InertiaModuleOptions.sharedData}.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* InertiaModule.forRoot({
|
|
85
|
+
* rootView,
|
|
86
|
+
* seo: {
|
|
87
|
+
* defaults: { openGraph: { siteName: 'Acme' }, twitter: { card: 'summary_large_image' } },
|
|
88
|
+
* titleTemplate: '%s — Acme',
|
|
89
|
+
* },
|
|
90
|
+
* })
|
|
91
|
+
*
|
|
92
|
+
* // Dynamic / personalized:
|
|
93
|
+
* InertiaModule.forRoot({
|
|
94
|
+
* rootView,
|
|
95
|
+
* seo: {
|
|
96
|
+
* titleTemplate: async (title, ctx) => `${title} — ${(await ctx.user()).name}'s Workspace`,
|
|
97
|
+
* },
|
|
98
|
+
* })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
interface InertiaSeoOptions {
|
|
102
|
+
/**
|
|
103
|
+
* App-wide default SEO metadata, merged under each page's `ctx.seo()` values.
|
|
104
|
+
* Provide a static object or a (possibly async) resolver receiving the request `ctx`.
|
|
105
|
+
*/
|
|
106
|
+
defaults?: SeoData | ((ctx: RouterContext) => SeoData | Promise<SeoData>);
|
|
107
|
+
/**
|
|
108
|
+
* Template applied to a page-provided title. The string form replaces `%s`
|
|
109
|
+
* with the page title (e.g. `'%s — Acme'`); a bare default title is used as-is.
|
|
110
|
+
* The function form receives the resolved title (possibly `undefined` when no
|
|
111
|
+
* page or default title is set) and the request `ctx`, and returns the final
|
|
112
|
+
* title (full control, may be async). Return `undefined` to leave the title
|
|
113
|
+
* unset — useful for conditionally skipping the template (e.g. for a subset of
|
|
114
|
+
* routes that build their own title).
|
|
115
|
+
*/
|
|
116
|
+
titleTemplate?: string | ((title: string | undefined, ctx: RouterContext) => string | undefined | Promise<string | undefined>);
|
|
117
|
+
}
|
|
70
118
|
interface InertiaModuleOptions {
|
|
71
119
|
rootView: string;
|
|
72
120
|
version?: string;
|
|
@@ -104,6 +152,12 @@ interface InertiaModuleOptions {
|
|
|
104
152
|
* ```
|
|
105
153
|
*/
|
|
106
154
|
routes?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* SEO configuration: app-wide defaults and a title template for backend-driven
|
|
157
|
+
* page metadata. Pages set their metadata via `ctx.seo()`; the frontend reads
|
|
158
|
+
* it with `<Seo/>` / `useSeo()` from `@stratal/inertia/react`.
|
|
159
|
+
*/
|
|
160
|
+
seo?: InertiaSeoOptions;
|
|
107
161
|
/**
|
|
108
162
|
* Client entry path relative to project root (default: `src/inertia/app.tsx`).
|
|
109
163
|
* Used in dev mode to inject the entry script tag.
|
|
@@ -119,6 +173,20 @@ declare class InertiaModule implements RouteConfigurable, OnInitialize, OnExcept
|
|
|
119
173
|
onException(handler: ExceptionHandler): void;
|
|
120
174
|
onInitialize(): void;
|
|
121
175
|
private isInertiaRequest;
|
|
176
|
+
/**
|
|
177
|
+
* GET/HEAD requests are idempotent navigations — including Inertia deferred
|
|
178
|
+
* partial reloads, which fetch deferred props over a follow-up XHR that still
|
|
179
|
+
* carries `X-Inertia: true`.
|
|
180
|
+
*
|
|
181
|
+
* Such requests must NOT use the flash-errors + redirect-back convention: the
|
|
182
|
+
* redirect points back at the very URL that just threw, so an error raised
|
|
183
|
+
* while resolving a deferred prop would redirect → re-request → throw again
|
|
184
|
+
* in an infinite loop (`ERR_TOO_MANY_REDIRECTS`). For these we fall through to
|
|
185
|
+
* the errorPage pipeline, which renders `Errors/${status}` in place as an
|
|
186
|
+
* Inertia response. Redirect-back stays for mutations (POST/PUT/PATCH/DELETE),
|
|
187
|
+
* where it drives the post-submit form-error flow.
|
|
188
|
+
*/
|
|
189
|
+
private isReadRequest;
|
|
122
190
|
private isPrecognitionRequest;
|
|
123
191
|
private handlePrecognitionValidationError;
|
|
124
192
|
private createPrecognitionErrorResponse;
|
|
@@ -132,70 +200,27 @@ declare const INERTIA_TOKENS: {
|
|
|
132
200
|
readonly TemplateService: symbol;
|
|
133
201
|
readonly ManifestService: symbol;
|
|
134
202
|
readonly SsrRenderer: symbol;
|
|
203
|
+
readonly HreflangService: symbol;
|
|
204
|
+
readonly SeoService: symbol;
|
|
135
205
|
};
|
|
136
206
|
//#endregion
|
|
137
|
-
//#region src/
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
type InertiaSsrResult = InertiaAppSSRResponse;
|
|
155
|
-
interface InertiaSsrBundle {
|
|
156
|
-
render(page: Page): Promise<InertiaSsrResult>;
|
|
157
|
-
}
|
|
158
|
-
type SharedDataResolver = (ctx: RouterContext) => any;
|
|
159
|
-
interface ViteManifestEntry {
|
|
160
|
-
file: string;
|
|
161
|
-
css?: string[];
|
|
162
|
-
isEntry?: boolean;
|
|
163
|
-
imports?: string[];
|
|
164
|
-
dynamicImports?: string[];
|
|
165
|
-
src?: string;
|
|
166
|
-
}
|
|
167
|
-
type ViteManifest = Record<string, ViteManifestEntry>;
|
|
168
|
-
declare const INERTIA_PROP_OPTIONAL: unique symbol;
|
|
169
|
-
declare const INERTIA_PROP_DEFERRED: unique symbol;
|
|
170
|
-
declare const INERTIA_PROP_MERGE: unique symbol;
|
|
171
|
-
declare const INERTIA_PROP_ONCE: unique symbol;
|
|
172
|
-
declare const INERTIA_PROP_ALWAYS: unique symbol;
|
|
173
|
-
interface InertiaOptionalProp<T = unknown> {
|
|
174
|
-
[INERTIA_PROP_OPTIONAL]: true;
|
|
175
|
-
callback: () => T;
|
|
176
|
-
}
|
|
177
|
-
interface InertiaDeferredProp<T = unknown> {
|
|
178
|
-
[INERTIA_PROP_DEFERRED]: true;
|
|
179
|
-
callback: () => T;
|
|
180
|
-
group: string;
|
|
181
|
-
}
|
|
182
|
-
type InertiaMergeStrategy = 'append' | 'prepend' | 'deep';
|
|
183
|
-
interface InertiaMergeProp<T = unknown> {
|
|
184
|
-
[INERTIA_PROP_MERGE]: true;
|
|
185
|
-
callback: () => T;
|
|
186
|
-
strategy: InertiaMergeStrategy;
|
|
187
|
-
matchOn?: string;
|
|
188
|
-
}
|
|
189
|
-
interface InertiaOnceProp<T = unknown> {
|
|
190
|
-
[INERTIA_PROP_ONCE]: true;
|
|
191
|
-
callback: () => T;
|
|
192
|
-
expiresAt?: number | null;
|
|
193
|
-
key?: string;
|
|
194
|
-
}
|
|
195
|
-
interface InertiaAlwaysProp<T = unknown> {
|
|
196
|
-
[INERTIA_PROP_ALWAYS]: true;
|
|
197
|
-
callback: () => T;
|
|
198
|
-
}
|
|
207
|
+
//#region src/seo/build-seo-tags.d.ts
|
|
208
|
+
/**
|
|
209
|
+
* Marker attribute stamped on every SEO-managed head element. The server emits
|
|
210
|
+
* it on injected tags and the client head-sync runtime uses it to find and
|
|
211
|
+
* reconcile the same tags across SPA navigations.
|
|
212
|
+
*/
|
|
213
|
+
declare const DATA_SEO_ATTR = "data-seo";
|
|
214
|
+
/**
|
|
215
|
+
* Maps resolved {@link SeoData} into a flat list of {@link SeoTagDescriptor}s.
|
|
216
|
+
*
|
|
217
|
+
* Pure and framework-free: used server-side to render HTML strings and
|
|
218
|
+
* client-side to build DOM nodes, so the two never drift. Every descriptor
|
|
219
|
+
* carries the {@link DATA_SEO_ATTR} marker.
|
|
220
|
+
*/
|
|
221
|
+
declare function buildSeoTags(data: SeoData): SeoTagDescriptor[];
|
|
222
|
+
/** Renders a descriptor to an HTML string with attribute/text escaping (server-side). */
|
|
223
|
+
declare function descriptorToHtml(d: SeoTagDescriptor): string;
|
|
199
224
|
//#endregion
|
|
200
225
|
//#region src/flash/cookie-flash-store.d.ts
|
|
201
226
|
interface CookieFlashStoreOptions {
|
|
@@ -238,19 +263,104 @@ declare module 'stratal/router' {
|
|
|
238
263
|
always<T>(callback: () => T): InertiaAlwaysProp<T>;
|
|
239
264
|
/** Sets a flash data entry that will be available on the next page visit. */
|
|
240
265
|
flash(key: string, value: unknown): void;
|
|
266
|
+
/**
|
|
267
|
+
* Adds a shared prop to the current request, available on every Inertia page
|
|
268
|
+
* rendered during this request. Useful for middleware and packages that want
|
|
269
|
+
* to contribute data to the frontend without a controller passing it through.
|
|
270
|
+
*/
|
|
271
|
+
share(key: string, value: unknown): void;
|
|
272
|
+
/**
|
|
273
|
+
* Sets SEO metadata (title, description, Open Graph, Twitter, etc.) for the
|
|
274
|
+
* page rendered in this request. Merges with module-level defaults and any
|
|
275
|
+
* earlier `seo()` calls. The resolved tags are injected into `<head>` and
|
|
276
|
+
* shared as the `seo` prop; the client head is kept in sync automatically
|
|
277
|
+
* by the runtime the `stratalInertia()` Vite plugin injects.
|
|
278
|
+
*/
|
|
279
|
+
seo(data: SeoData): void;
|
|
241
280
|
/** Disables server-side rendering for the current request. */
|
|
242
281
|
withoutSsr(): void;
|
|
243
282
|
}
|
|
244
283
|
}
|
|
245
284
|
//#endregion
|
|
285
|
+
//#region src/services/hreflang.service.d.ts
|
|
286
|
+
/**
|
|
287
|
+
* Produces `rel="alternate" hreflang="…"` link descriptors for the SEO pipeline.
|
|
288
|
+
*
|
|
289
|
+
* Activated when i18n detection produces URL-distinct locale variants:
|
|
290
|
+
* - `path` strategy with ≥2 locales → locale-prefixed pathname variants
|
|
291
|
+
* - `querystring` strategy with ≥2 locales → `?locale=xx` variants
|
|
292
|
+
*
|
|
293
|
+
* Returns `[]` for cookie/header strategies (no URL distinction) and for
|
|
294
|
+
* single-locale apps. Emits an additional `x-default` link pointing at the
|
|
295
|
+
* default-locale URL.
|
|
296
|
+
*
|
|
297
|
+
* The descriptors are merged into the resolved {@link SeoData} by
|
|
298
|
+
* {@link import('./seo.service').SeoService}, so hreflang rides the same
|
|
299
|
+
* `<head>` injection (initial render) and client reconciliation (SPA
|
|
300
|
+
* navigation) as the rest of the SEO tags — no separate head path.
|
|
301
|
+
*
|
|
302
|
+
* Every generated `href` runs through {@link applyTrailingSlash} with the
|
|
303
|
+
* app-wide mode so hreflang URLs match the canonical form the rest of the
|
|
304
|
+
* router emits.
|
|
305
|
+
*/
|
|
306
|
+
declare class HreflangService {
|
|
307
|
+
private readonly container;
|
|
308
|
+
constructor(container: Container);
|
|
309
|
+
buildLinks(currentUrl: URL): SeoLinkTag[];
|
|
310
|
+
private buildPathLinks;
|
|
311
|
+
private buildQuerystringLinks;
|
|
312
|
+
private compose;
|
|
313
|
+
private composeQuery;
|
|
314
|
+
private linkTag;
|
|
315
|
+
}
|
|
316
|
+
//#endregion
|
|
317
|
+
//#region src/services/seo.service.d.ts
|
|
318
|
+
/**
|
|
319
|
+
* Request-scoped accumulator for page SEO metadata.
|
|
320
|
+
*
|
|
321
|
+
* Controllers (and middleware) call `ctx.seo()` to contribute metadata; at
|
|
322
|
+
* render time {@link InertiaService} resolves it against the module-level
|
|
323
|
+
* defaults and title template, shares the result as the `seo` prop, and injects
|
|
324
|
+
* the rendered tags into `<head>`.
|
|
325
|
+
*/
|
|
326
|
+
declare class SeoService {
|
|
327
|
+
private readonly options;
|
|
328
|
+
private readonly hreflang;
|
|
329
|
+
private accumulated;
|
|
330
|
+
constructor(options: InertiaModuleOptions, hreflang: HreflangService);
|
|
331
|
+
/** Merges the given metadata into the request's accumulated SEO data. */
|
|
332
|
+
set(data: SeoData): void;
|
|
333
|
+
/**
|
|
334
|
+
* Resolves the final SEO data: module defaults (base) merged with the
|
|
335
|
+
* request's accumulated data, then the title template applied. Resolver
|
|
336
|
+
* functions for `defaults`/`titleTemplate` are awaited with the request `ctx`.
|
|
337
|
+
* Locale-aware `hreflang` alternates are appended last so they ride the same
|
|
338
|
+
* head injection and SPA reconciliation as the rest of the SEO tags.
|
|
339
|
+
*
|
|
340
|
+
* The resolved `title` is ALWAYS a string (falling back to `''`). This makes
|
|
341
|
+
* the `<title>` descriptor deterministic: every navigation — including to a
|
|
342
|
+
* page with no SEO — produces a title, so the client head-sync sets
|
|
343
|
+
* `document.title` rather than leaving the previous page's title stale.
|
|
344
|
+
*/
|
|
345
|
+
resolve(ctx: RouterContext): Promise<SeoData>;
|
|
346
|
+
/** Renders resolved SEO data into a list of head-tag HTML strings. */
|
|
347
|
+
tagsFor(resolved: SeoData): string[];
|
|
348
|
+
}
|
|
349
|
+
//#endregion
|
|
246
350
|
//#region src/services/ssr-renderer.service.d.ts
|
|
247
351
|
declare class SsrRendererService {
|
|
248
352
|
private readonly options;
|
|
249
|
-
private readonly logger;
|
|
250
353
|
private bundle;
|
|
251
354
|
private loadPromise;
|
|
252
|
-
constructor(options: InertiaModuleOptions
|
|
253
|
-
|
|
355
|
+
constructor(options: InertiaModuleOptions);
|
|
356
|
+
/**
|
|
357
|
+
* Render a page to a streaming SSR result.
|
|
358
|
+
*
|
|
359
|
+
* The SSR bundle is imported once per worker (memoized). Bundle-load and render
|
|
360
|
+
* errors propagate — there is no silent client-side fallback. Callers must only
|
|
361
|
+
* invoke this when `options.ssr` is configured.
|
|
362
|
+
*/
|
|
363
|
+
render(page: Page): Promise<InertiaSsrResult>;
|
|
254
364
|
private ensureBundle;
|
|
255
365
|
private loadBundle;
|
|
256
366
|
}
|
|
@@ -260,18 +370,37 @@ declare class ManifestService {
|
|
|
260
370
|
private readonly manifest;
|
|
261
371
|
private readonly entryClientPath;
|
|
262
372
|
private readonly isDev;
|
|
373
|
+
private headTags;
|
|
374
|
+
private scriptTags;
|
|
263
375
|
constructor(options: InertiaModuleOptions);
|
|
264
376
|
getHeadTags(): string;
|
|
265
377
|
getScriptTags(): string;
|
|
378
|
+
private buildHeadTags;
|
|
379
|
+
private buildScriptTags;
|
|
266
380
|
}
|
|
267
381
|
//#endregion
|
|
268
382
|
//#region src/services/template.service.d.ts
|
|
269
383
|
declare class TemplateService {
|
|
270
|
-
private readonly options;
|
|
271
384
|
private readonly manifest;
|
|
385
|
+
private readonly pre;
|
|
386
|
+
private readonly post;
|
|
272
387
|
constructor(options: InertiaModuleOptions, manifest: ManifestService);
|
|
273
|
-
|
|
274
|
-
|
|
388
|
+
/**
|
|
389
|
+
* Compose the streamed HTML response: the document shell (head + opening
|
|
390
|
+
* `#app` wrapper) is flushed first, the React stream is piped verbatim, then
|
|
391
|
+
* the wrapper is closed and the trailing scripts are appended.
|
|
392
|
+
*
|
|
393
|
+
* Reproduces Inertia's `buildSSRBody` markup: a `<script data-page>` JSON tag
|
|
394
|
+
* (parsed before hydration) followed by `<div data-server-rendered id="app">`.
|
|
395
|
+
*/
|
|
396
|
+
renderStream(page: Page, head: string[], reactStream: ReadableStream<Uint8Array>): ReadableStream<Uint8Array>;
|
|
397
|
+
/**
|
|
398
|
+
* Buffered, client-only document used when SSR is disabled for the request.
|
|
399
|
+
* Emits an empty `#app` div for the client bundle to hydrate.
|
|
400
|
+
*/
|
|
401
|
+
renderClientOnly(page: Page, head: string[]): string;
|
|
402
|
+
private fillPlaceholders;
|
|
403
|
+
private serialize;
|
|
275
404
|
}
|
|
276
405
|
//#endregion
|
|
277
406
|
//#region src/services/inertia.service.d.ts
|
|
@@ -279,9 +408,11 @@ declare class InertiaService {
|
|
|
279
408
|
private readonly options;
|
|
280
409
|
private readonly template;
|
|
281
410
|
private readonly ssr;
|
|
411
|
+
private readonly seoService;
|
|
282
412
|
private sharedData;
|
|
283
|
-
constructor(options: InertiaModuleOptions, template: TemplateService, ssr: SsrRendererService);
|
|
413
|
+
constructor(options: InertiaModuleOptions, template: TemplateService, ssr: SsrRendererService, seoService: SeoService);
|
|
284
414
|
share(key: string, value: unknown): void;
|
|
415
|
+
seo(data: SeoData): void;
|
|
285
416
|
location(url: string): Response;
|
|
286
417
|
optional<T>(callback: () => T): InertiaOptionalProp<T>;
|
|
287
418
|
defer<T>(callback: () => T, group?: string): InertiaDeferredProp<T>;
|
|
@@ -431,5 +562,5 @@ declare module 'stratal/router' {
|
|
|
431
562
|
}
|
|
432
563
|
}
|
|
433
564
|
//#endregion
|
|
434
|
-
export { CookieFlashStore, type FlashStore, HandlePrecognitiveRequests, INERTIA_TOKENS, type InertiaAlwaysProp, type InertiaDeferredProp, InertiaDelete, type InertiaFlashOptions, type InertiaFullPageProps, InertiaGet, type InertiaI18nOptions, type InertiaMergeProp, type InertiaMergeStrategy, InertiaMiddleware, InertiaModule, type InertiaModuleOptions, type InertiaOnceProp, type InertiaOptionalProp, type InertiaPage, type InertiaPageComponent, type InertiaPageRegistry, InertiaPatch, InertiaPost, InertiaPut, type InertiaRenderOptions, InertiaRoute, type InertiaRouteConfig, InertiaService, type InertiaSharedProps, type InertiaSsrBundle, type InertiaSsrOptions, type InertiaSsrResult, ManifestService, type ResolvedInertiaPageProps, type SharedDataResolver, SsrRendererService, TemplateService, type ViteManifest, type ViteManifestEntry };
|
|
565
|
+
export { CookieFlashStore, DATA_SEO_ATTR, type FlashStore, HandlePrecognitiveRequests, INERTIA_TOKENS, type InertiaAlwaysProp, type InertiaDeferredProp, InertiaDelete, type InertiaFlashOptions, type InertiaFullPageProps, InertiaGet, type InertiaI18nConfig, type InertiaI18nOptions, type InertiaMergeProp, type InertiaMergeStrategy, InertiaMiddleware, InertiaModule, type InertiaModuleOptions, type InertiaOnceProp, type InertiaOptionalProp, type InertiaPage, type InertiaPageComponent, type InertiaPageRegistry, InertiaPatch, InertiaPost, InertiaPut, type InertiaRenderOptions, InertiaRoute, type InertiaRouteConfig, type InertiaSeoOptions, InertiaService, type InertiaSharedProps, type InertiaSsrBundle, type InertiaSsrOptions, type InertiaSsrResult, type InertiaTranslationKeys, ManifestService, type ResolvedInertiaPageProps, type SeoData, type SeoLinkTag, type SeoMetaTag, type SeoOpenGraph, SeoService, type SeoTagDescriptor, type SeoTwitter, type SharedDataResolver, SsrRendererService, TemplateService, type ViteManifest, type ViteManifestEntry, buildSeoTags, descriptorToHtml };
|
|
435
566
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/flash/flash-store.ts","../src/inertia.options.ts","../src/inertia.module.ts","../src/inertia.tokens.ts","../src/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/flash/flash-store.ts","../src/inertia.options.ts","../src/inertia.module.ts","../src/inertia.tokens.ts","../src/seo/build-seo-tags.ts","../src/flash/cookie-flash-store.ts","../src/augment/router-context.ts","../src/services/hreflang.service.ts","../src/services/seo.service.ts","../src/services/ssr-renderer.service.ts","../src/services/manifest.service.ts","../src/services/template.service.ts","../src/services/inertia.service.ts","../src/decorators/inertia.decorators.ts","../src/middleware/handle-precognitive-requests.middleware.ts","../src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