@blinkk/root 3.0.1 → 3.0.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/dist/{chunk-FQBA5QSG.js → chunk-3Z5TNZEP.js} +3 -3
- package/dist/chunk-3Z5TNZEP.js.map +7 -0
- package/dist/{chunk-JCRXBB26.js → chunk-6NBKAR5Y.js} +2 -2
- package/dist/chunk-6NBKAR5Y.js.map +7 -0
- package/dist/chunk-6P3B7ZXL.js +1 -1
- package/dist/chunk-6P3B7ZXL.js.map +7 -1
- package/dist/{chunk-PVBPP5LN.js → chunk-7PSEEE6C.js} +10 -10
- package/dist/chunk-7PSEEE6C.js.map +7 -0
- package/dist/{chunk-M6WGW5VY.js → chunk-DU7JUEDY.js} +48 -6
- package/dist/chunk-DU7JUEDY.js.map +7 -0
- package/dist/{chunk-GSR74KEI.js → chunk-JTZWI4MH.js} +279 -73
- package/dist/chunk-JTZWI4MH.js.map +7 -0
- package/dist/{chunk-WAZTR3DX.js → chunk-KW7KTYGC.js} +2 -2
- package/dist/chunk-KW7KTYGC.js.map +7 -0
- package/dist/chunk-XSNCF7WU.js +1 -1
- package/dist/chunk-XSNCF7WU.js.map +7 -1
- package/dist/cli/build.d.ts +7 -0
- package/dist/cli/cli.d.ts +12 -0
- package/dist/cli/codegen.d.ts +5 -0
- package/dist/cli/create-package.d.ts +14 -0
- package/dist/cli/dev.d.ts +10 -0
- package/dist/cli/gae-deploy.d.ts +18 -0
- package/dist/cli/preview.d.ts +8 -0
- package/dist/cli/start.d.ts +8 -0
- package/dist/cli/startup/check-version.d.ts +17 -0
- package/dist/cli/startup/startup-tasks.d.ts +39 -0
- package/dist/cli.js +4 -4
- package/dist/cli.js.map +7 -1
- package/dist/core/components/Body.d.ts +23 -0
- package/dist/core/components/Head.d.ts +18 -0
- package/dist/core/components/Html.d.ts +24 -0
- package/dist/core/components/Script.d.ts +16 -0
- package/dist/core/config.d.ts +285 -0
- package/dist/core/core.d.ts +14 -0
- package/dist/core/hooks/useI18nContext.d.ts +11 -0
- package/dist/core/hooks/useRequestContext.d.ts +36 -0
- package/dist/core/hooks/useStringParams.d.ts +34 -0
- package/dist/core/hooks/useTranslations.d.ts +20 -0
- package/dist/core/hooks/useTranslationsMiddleware.d.ts +25 -0
- package/dist/core/pages/DevErrorPage.d.ts +9 -0
- package/dist/core/pages/DevNotFoundPage.d.ts +10 -0
- package/dist/core/pages/ErrorPage.d.ts +9 -0
- package/dist/core/plugin.d.ts +80 -0
- package/dist/core/pod.d.ts +54 -0
- package/dist/core/types.d.ts +228 -0
- package/dist/core.js +3 -3
- package/dist/core.js.map +7 -1
- package/dist/functions/functions.d.ts +1 -0
- package/dist/functions/server.d.ts +10 -0
- package/dist/functions.js +5 -5
- package/dist/functions.js.map +7 -1
- package/dist/jsx/jsx-dev-runtime.d.ts +10 -1
- package/dist/jsx/jsx-dev-runtime.js +2 -2
- package/dist/jsx/jsx-dev-runtime.js.map +7 -1
- package/dist/{jsx-C8BaDh-4.d.ts → jsx/jsx-render.d.ts} +3 -6
- package/dist/jsx/jsx-runtime.d.ts +120 -1
- package/dist/jsx/jsx-runtime.js +2 -2
- package/dist/jsx/jsx-runtime.js.map +7 -1
- package/dist/jsx/jsx.d.ts +37 -0
- package/dist/{jsx-dev-runtime-DUJrvx5P.d.ts → jsx/types.d.ts} +9 -125
- package/dist/jsx.js +3 -3
- package/dist/jsx.js.map +7 -1
- package/dist/middleware/common.d.ts +22 -0
- package/dist/middleware/hooks.d.ts +8 -0
- package/dist/middleware/middleware.d.ts +3 -0
- package/dist/middleware/multipart.d.ts +11 -0
- package/dist/middleware/redirects.d.ts +10 -0
- package/dist/middleware/session.d.ts +24 -0
- package/dist/middleware.js +2 -2
- package/dist/middleware.js.map +7 -1
- package/dist/node/element-graph.d.ts +51 -0
- package/dist/node/load-config.d.ts +17 -0
- package/dist/node/monorepo.d.ts +14 -0
- package/dist/node/node.d.ts +4 -0
- package/dist/node/pod-collector.d.ts +33 -0
- package/dist/node/pods-vite-plugin.d.ts +6 -0
- package/dist/node/vite-plugin-preact-alias.d.ts +10 -0
- package/dist/node/vite-plugin-prune-empty-chunks.d.ts +27 -0
- package/dist/node/vite-plugin-root-jsx-virtual.d.ts +16 -0
- package/dist/node/vite.d.ts +18 -0
- package/dist/node.js +2 -2
- package/dist/node.js.map +7 -1
- package/dist/render/accept-language.d.ts +8 -0
- package/dist/render/asset-map/asset-map.d.ts +25 -0
- package/dist/render/asset-map/build-asset-map.d.ts +47 -0
- package/dist/render/asset-map/dev-asset-map.d.ts +26 -0
- package/dist/render/countrie-language.d.ts +13 -0
- package/dist/render/html-minify.d.ts +3 -0
- package/dist/render/html-pretty.d.ts +3 -0
- package/dist/render/i18n-fallbacks.d.ts +11 -0
- package/dist/render/render.d.ts +91 -0
- package/dist/render/route-trie.d.ts +44 -0
- package/dist/render/router.d.ts +18 -0
- package/dist/render.js +9 -9
- package/dist/render.js.map +7 -1
- package/dist/utils/batch.d.ts +1 -0
- package/dist/utils/elements.d.ts +12 -0
- package/dist/utils/fsutils.d.ts +24 -0
- package/dist/utils/i18n.d.ts +8 -0
- package/dist/utils/ports.d.ts +8 -0
- package/dist/utils/rand.d.ts +10 -0
- package/dist/utils/url-path-params.d.ts +2 -0
- package/package.json +14 -15
- package/dist/chunk-FQBA5QSG.js.map +0 -1
- package/dist/chunk-GSR74KEI.js.map +0 -1
- package/dist/chunk-JCRXBB26.js.map +0 -1
- package/dist/chunk-M6WGW5VY.js.map +0 -1
- package/dist/chunk-PVBPP5LN.js.map +0 -1
- package/dist/chunk-WAZTR3DX.js.map +0 -1
- package/dist/cli.d.ts +0 -60
- package/dist/core.d.ts +0 -214
- package/dist/functions.d.ts +0 -14
- package/dist/jsx.d.ts +0 -2
- package/dist/middleware.d.ts +0 -43
- package/dist/node.d.ts +0 -91
- package/dist/render.d.ts +0 -8
- package/dist/types-Cksf99CK.d.ts +0 -827
package/dist/types-Cksf99CK.d.ts
DELETED
|
@@ -1,827 +0,0 @@
|
|
|
1
|
-
import { Express, Request as Request$1, Response as Response$1, NextFunction as NextFunction$1 } from 'express';
|
|
2
|
-
import { ComponentType } from 'preact';
|
|
3
|
-
import { PluginOption, UserConfig, ViteDevServer } from 'vite';
|
|
4
|
-
import { J as JsxRenderOptions } from './jsx-C8BaDh-4.js';
|
|
5
|
-
import { Options } from 'html-minifier-terser';
|
|
6
|
-
import { HTMLBeautifyOptions } from 'js-beautify';
|
|
7
|
-
|
|
8
|
-
declare class Hooks {
|
|
9
|
-
private callbacks;
|
|
10
|
-
add(name: string, cb: (...args: any[]) => any): void;
|
|
11
|
-
trigger(name: string, ...args: any[]): void;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
declare const SESSION_COOKIE = "__session";
|
|
15
|
-
interface SessionMiddlewareOptions {
|
|
16
|
-
maxAge?: number;
|
|
17
|
-
}
|
|
18
|
-
interface SaveSessionOptions {
|
|
19
|
-
sameSite?: 'strict' | 'lax' | 'none';
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Middleware for storing session data stored in an http cookie called
|
|
23
|
-
* `__session`. This cookie is compatible with Firebase Hosting:
|
|
24
|
-
* https://firebase.google.com/docs/hosting/manage-cache#using_cookies
|
|
25
|
-
*/
|
|
26
|
-
declare function sessionMiddleware(options?: SessionMiddlewareOptions): (req: Request, res: Response, next: NextFunction) => void;
|
|
27
|
-
declare class Session {
|
|
28
|
-
private data;
|
|
29
|
-
hasChanges: boolean;
|
|
30
|
-
constructor(data?: Record<string, string>);
|
|
31
|
-
static fromCookieValue(cookieValue: string): Session;
|
|
32
|
-
getItem(key: string): string | null;
|
|
33
|
-
setItem(key: string, value: string): void;
|
|
34
|
-
removeItem(key: string): void;
|
|
35
|
-
toString(): string;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
type HtmlMinifyOptions = Options;
|
|
39
|
-
|
|
40
|
-
type HtmlPrettyOptions = HTMLBeautifyOptions;
|
|
41
|
-
|
|
42
|
-
interface Pod {
|
|
43
|
-
/** Unique pod name, e.g. '@blinkk/root-docs-pod'. */
|
|
44
|
-
name: string;
|
|
45
|
-
/**
|
|
46
|
-
* URL prefix for pod routes. Routes within the pod are served under this
|
|
47
|
-
* mount path. Defaults to '/'.
|
|
48
|
-
*/
|
|
49
|
-
mount?: string;
|
|
50
|
-
/**
|
|
51
|
-
* Priority for route conflict resolution. Higher values win when multiple
|
|
52
|
-
* pods register the same URL path. User-site routes always take precedence
|
|
53
|
-
* regardless of priority. Defaults to 0.
|
|
54
|
-
*/
|
|
55
|
-
priority?: number;
|
|
56
|
-
/** Absolute path to the pod's routes/ directory. */
|
|
57
|
-
routesDir?: string;
|
|
58
|
-
/** Absolute path(s) to the pod's elements/ directory(s). */
|
|
59
|
-
elementsDirs?: string[];
|
|
60
|
-
/** Absolute path to the pod's bundles/ directory. */
|
|
61
|
-
bundlesDir?: string;
|
|
62
|
-
/** Absolute path to the pod's collections/ directory (root-cms only). */
|
|
63
|
-
collectionsDir?: string;
|
|
64
|
-
/** Absolute path to the pod's translations/ directory. */
|
|
65
|
-
translationsDir?: string;
|
|
66
|
-
/** Extra Vite plugins contributed by the pod. */
|
|
67
|
-
vitePlugins?: PluginOption[];
|
|
68
|
-
}
|
|
69
|
-
type PodFactory = (ctx: {
|
|
70
|
-
rootConfig: RootConfig;
|
|
71
|
-
}) => Pod | Promise<Pod>;
|
|
72
|
-
interface PodConfig {
|
|
73
|
-
/** Whether the pod is enabled. Defaults to true. */
|
|
74
|
-
enabled?: boolean;
|
|
75
|
-
/** Override the pod's mount path. */
|
|
76
|
-
mount?: string;
|
|
77
|
-
/** Override the pod's priority. */
|
|
78
|
-
priority?: number;
|
|
79
|
-
/** Filter pod routes. */
|
|
80
|
-
routes?: {
|
|
81
|
-
exclude?: (string | RegExp)[];
|
|
82
|
-
};
|
|
83
|
-
/** Configure pod collections. */
|
|
84
|
-
collections?: {
|
|
85
|
-
exclude?: string[];
|
|
86
|
-
/** Rename collection ids, e.g. {Posts: 'DocsPosts'}. */
|
|
87
|
-
rename?: Record<string, string>;
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* Helper to define a pod with type-checking.
|
|
92
|
-
*/
|
|
93
|
-
declare function definePod(pod: Pod): Pod;
|
|
94
|
-
|
|
95
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
96
|
-
type PreBuildHook = (rootConfig: RootConfig) => MaybePromise<void>;
|
|
97
|
-
interface PostBuildOptions {
|
|
98
|
-
/** Whether the build was SSR-only (no SSG pre-rendering). */
|
|
99
|
-
ssrOnly?: boolean;
|
|
100
|
-
}
|
|
101
|
-
type PostBuildHook = (rootConfig: RootConfig, options?: PostBuildOptions) => MaybePromise<void>;
|
|
102
|
-
type ConfigureServerHook = (server: Server, options: ConfigureServerOptions) => MaybePromise<void> | MaybePromise<() => void>;
|
|
103
|
-
interface ConfigureServerOptions {
|
|
104
|
-
type: 'dev' | 'preview' | 'prod';
|
|
105
|
-
rootConfig: RootConfig;
|
|
106
|
-
}
|
|
107
|
-
interface PluginHooks {
|
|
108
|
-
/**
|
|
109
|
-
* Hook that runs before the build starts.
|
|
110
|
-
*/
|
|
111
|
-
preBuild?: PreBuildHook;
|
|
112
|
-
/**
|
|
113
|
-
* Hook that runs after the build completes.
|
|
114
|
-
*/
|
|
115
|
-
postBuild?: PostBuildHook;
|
|
116
|
-
/**
|
|
117
|
-
* Post-render hook that's called before the HTML is rendered to the response
|
|
118
|
-
* object. If a string is returned from this hook, it will replace the
|
|
119
|
-
* rendered HTML.
|
|
120
|
-
*/
|
|
121
|
-
preRender?: (html: string) => void | MaybePromise<string>;
|
|
122
|
-
}
|
|
123
|
-
interface Plugin {
|
|
124
|
-
[key: string]: any;
|
|
125
|
-
/** The name of the plugin. */
|
|
126
|
-
name?: string;
|
|
127
|
-
/**
|
|
128
|
-
* Configures the root.js express server. Any middleware defined by the plugin
|
|
129
|
-
* will be added to the server first. If a callback fn is returned, it will
|
|
130
|
-
* be called after the root.js middlewares are added.
|
|
131
|
-
*/
|
|
132
|
-
configureServer?: ConfigureServerHook;
|
|
133
|
-
/**
|
|
134
|
-
* Hook for file changes.
|
|
135
|
-
*/
|
|
136
|
-
onFileChange?: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string) => void;
|
|
137
|
-
/**
|
|
138
|
-
* Returns a list of deps to bundle for ssr. The files will be bundled and
|
|
139
|
-
* output to `dist/server/`. The return value should be a map of
|
|
140
|
-
* `{output filename => input filepath}`.
|
|
141
|
-
*
|
|
142
|
-
* E.g. a value of `{foo: 'path/to/bar.js'}` will output `dist/server/foo.js`.
|
|
143
|
-
*
|
|
144
|
-
* @experimental This config is subject to change to be incorporated into a
|
|
145
|
-
* broader config option called "ssr" or "ssrOptions".
|
|
146
|
-
*/
|
|
147
|
-
ssrInput?: () => {
|
|
148
|
-
[entryAlias: string]: string;
|
|
149
|
-
};
|
|
150
|
-
/** Adds vite plugins. */
|
|
151
|
-
vitePlugins?: PluginOption[];
|
|
152
|
-
/** Plugin lifecycle callback hooks. */
|
|
153
|
-
hooks?: PluginHooks;
|
|
154
|
-
/** Custom 404 handler. */
|
|
155
|
-
handle404?: (req: Request, res: Response, next: NextFunction) => void | Promise<void>;
|
|
156
|
-
/**
|
|
157
|
-
* Registers a pod (a mini root.js site) that gets merged into the parent
|
|
158
|
-
* site at dev/build time. A plugin may return a single pod, an array of
|
|
159
|
-
* pods, or a factory that receives the rootConfig.
|
|
160
|
-
*/
|
|
161
|
-
pod?: Pod | Pod[] | PodFactory;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Runs the pre-hook configureServer method of every plugin, calls a callback
|
|
165
|
-
* function, and then runs the configureServer's post-hook if provided. Plugins
|
|
166
|
-
* provide a post-hook by returning a callback function from configureServer.
|
|
167
|
-
*/
|
|
168
|
-
declare function configureServerPlugins(server: Server, callback: () => Promise<void>, plugins: Plugin[], options: ConfigureServerOptions): Promise<void>;
|
|
169
|
-
declare function getVitePlugins(plugins: Plugin[]): PluginOption[];
|
|
170
|
-
|
|
171
|
-
interface RootUserConfig {
|
|
172
|
-
/**
|
|
173
|
-
* Canonical domain the website will serve on. Useful for things like the
|
|
174
|
-
* sitemap, SEO tags, etc.
|
|
175
|
-
*/
|
|
176
|
-
domain?: string;
|
|
177
|
-
/**
|
|
178
|
-
* The base URL path that the site will serve on. Defaults to `/`;
|
|
179
|
-
*/
|
|
180
|
-
base?: string;
|
|
181
|
-
/**
|
|
182
|
-
* Config for auto-injecting custom element dependencies.
|
|
183
|
-
*/
|
|
184
|
-
elements?: {
|
|
185
|
-
/**
|
|
186
|
-
* A list of directories to use to look for custom elements. The dir path
|
|
187
|
-
* should be relative to the project dir, e.g. "path/to/elements".
|
|
188
|
-
*/
|
|
189
|
-
include?: string[];
|
|
190
|
-
/**
|
|
191
|
-
* A list of RegEx patterns to exclude. The string passed to the RegEx is
|
|
192
|
-
* the file URL relative to the project root, e.g. "/elements/foo/foo.ts".
|
|
193
|
-
*/
|
|
194
|
-
exclude?: RegExp[];
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* Config for manually injecting stylesheet entries as
|
|
198
|
-
* `<link rel="stylesheet">` tags.
|
|
199
|
-
*/
|
|
200
|
-
styles?: {
|
|
201
|
-
/**
|
|
202
|
-
* Project-root-relative stylesheet files to include on every rendered
|
|
203
|
-
* page, e.g. `styles/index.css`.
|
|
204
|
-
*
|
|
205
|
-
* Entries are normalized as URL paths, so both `styles/index.css` and
|
|
206
|
-
* `/styles/index.css` resolve to `/styles/index.css`.
|
|
207
|
-
*
|
|
208
|
-
* Manual entries are injected first, then auto-collected CSS
|
|
209
|
-
* dependencies are merged after. Duplicate URLs are de-duped so each
|
|
210
|
-
* stylesheet is only injected once.
|
|
211
|
-
*/
|
|
212
|
-
entries?: string[];
|
|
213
|
-
};
|
|
214
|
-
/**
|
|
215
|
-
* Config options for localization and internationalization.
|
|
216
|
-
*/
|
|
217
|
-
i18n?: RootI18nConfig;
|
|
218
|
-
/**
|
|
219
|
-
* Config options for the Root.js express server.
|
|
220
|
-
*/
|
|
221
|
-
server?: RootServerConfig;
|
|
222
|
-
/**
|
|
223
|
-
* Build options for the `root build` command.
|
|
224
|
-
*/
|
|
225
|
-
build?: RootBuildConfig;
|
|
226
|
-
/**
|
|
227
|
-
* Vite config.
|
|
228
|
-
* @see {@link https://vitejs.dev/config/} for more information.
|
|
229
|
-
*/
|
|
230
|
-
vite?: UserConfig;
|
|
231
|
-
/**
|
|
232
|
-
* Config for the built-in JSX-to-HTML renderer.
|
|
233
|
-
*
|
|
234
|
-
* - `mode: 'pretty'` (default) — block-level elements render on their own
|
|
235
|
-
* line with no indentation.
|
|
236
|
-
* - `mode: 'minimal'` — compact output with no extra whitespace.
|
|
237
|
-
*
|
|
238
|
-
* Use `blockElements` to specify additional custom element tag names that
|
|
239
|
-
* should be treated as block-level in pretty mode.
|
|
240
|
-
*
|
|
241
|
-
* @example
|
|
242
|
-
* ```ts
|
|
243
|
-
* export default defineConfig({
|
|
244
|
-
* jsxRenderer: {
|
|
245
|
-
* mode: 'pretty',
|
|
246
|
-
* blockElements: ['my-card', 'my-section'],
|
|
247
|
-
* },
|
|
248
|
-
* });
|
|
249
|
-
* ```
|
|
250
|
-
*/
|
|
251
|
-
jsxRenderer?: JsxRenderOptions;
|
|
252
|
-
/**
|
|
253
|
-
* Whether to automatically minify HTML output. This is enabled by default,
|
|
254
|
-
* in order to disable, pass `minifyHtml: false` to root.config.ts.
|
|
255
|
-
*/
|
|
256
|
-
minifyHtml?: boolean;
|
|
257
|
-
/**
|
|
258
|
-
* Options to pass to html-minifier-terser.
|
|
259
|
-
*/
|
|
260
|
-
minifyHtmlOptions?: HtmlMinifyOptions;
|
|
261
|
-
/**
|
|
262
|
-
* Whether to pretty print HTML output.
|
|
263
|
-
*/
|
|
264
|
-
prettyHtml?: boolean;
|
|
265
|
-
/**
|
|
266
|
-
* Options to pass to js-beautify.
|
|
267
|
-
*/
|
|
268
|
-
prettyHtmlOptions?: HtmlPrettyOptions;
|
|
269
|
-
/**
|
|
270
|
-
* Whether to include a sitemap.xml file to the build output.
|
|
271
|
-
*/
|
|
272
|
-
sitemap?: boolean;
|
|
273
|
-
/**
|
|
274
|
-
* Plugins.
|
|
275
|
-
*/
|
|
276
|
-
plugins?: Plugin[];
|
|
277
|
-
/**
|
|
278
|
-
* Per-pod user-level overrides. The key is the pod name as declared in
|
|
279
|
-
* Pod.name.
|
|
280
|
-
*/
|
|
281
|
-
pods?: Record<string, PodConfig>;
|
|
282
|
-
/**
|
|
283
|
-
* Experimental config options. Note: these are subject to change at any time.
|
|
284
|
-
*/
|
|
285
|
-
experiments?: {
|
|
286
|
-
/** Whether to render `<script>` tags with `async`. */
|
|
287
|
-
enableScriptAsync?: boolean;
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
type RootConfig = RootUserConfig & {
|
|
291
|
-
rootDir: string;
|
|
292
|
-
};
|
|
293
|
-
interface LocaleGroup {
|
|
294
|
-
label?: string;
|
|
295
|
-
locales: string[];
|
|
296
|
-
}
|
|
297
|
-
interface RootI18nConfig {
|
|
298
|
-
/**
|
|
299
|
-
* Locales enabled for the site.
|
|
300
|
-
*/
|
|
301
|
-
locales?: string[];
|
|
302
|
-
/**
|
|
303
|
-
* The default locale to use. Defaults is `en`.
|
|
304
|
-
*/
|
|
305
|
-
defaultLocale?: string;
|
|
306
|
-
/**
|
|
307
|
-
* URL format for localized content. Default is `/[locale]/[base]/[path]`.
|
|
308
|
-
*/
|
|
309
|
-
urlFormat?: string;
|
|
310
|
-
/**
|
|
311
|
-
* Localization groups, to help UIs (like Root.js CMS) logically group
|
|
312
|
-
* locales.
|
|
313
|
-
*/
|
|
314
|
-
groups?: Record<string, LocaleGroup>;
|
|
315
|
-
}
|
|
316
|
-
interface RootBuildConfig {
|
|
317
|
-
/**
|
|
318
|
-
* Excludes the `/intl/{defaultLocale}/...` path from the SSG build.
|
|
319
|
-
*/
|
|
320
|
-
excludeDefaultLocaleFromIntlPaths?: boolean;
|
|
321
|
-
}
|
|
322
|
-
interface RootRedirectConfig {
|
|
323
|
-
/**
|
|
324
|
-
* The source path to redirect. Accepts placeholders in the format
|
|
325
|
-
* `[key]` or `[...key]`. Use `[key]` for single segments and
|
|
326
|
-
* `[...key]` for multi-segment wildcards.
|
|
327
|
-
* @example "/old-path/[id]" or "/old-path/[...wildcard]"
|
|
328
|
-
*/
|
|
329
|
-
source: string;
|
|
330
|
-
/**
|
|
331
|
-
* The destination to redirect to. Placeholders from the source can
|
|
332
|
-
* optionally be inserted into the destination using the same
|
|
333
|
-
* placeholder format.
|
|
334
|
-
* @example "/new-path/[id]" or "/new-path/[...wildcard]"
|
|
335
|
-
*/
|
|
336
|
-
destination: string;
|
|
337
|
-
/**
|
|
338
|
-
* The redirect type (`301` = permanent, `302` = temporary). If unspecified,
|
|
339
|
-
* defaults to `302` (temporary).
|
|
340
|
-
*/
|
|
341
|
-
type?: 301 | 302;
|
|
342
|
-
}
|
|
343
|
-
interface RootHeaderConfig {
|
|
344
|
-
/** A glob pattern match (regex not supported yet). */
|
|
345
|
-
source: string;
|
|
346
|
-
headers: Array<{
|
|
347
|
-
key: string;
|
|
348
|
-
value: string;
|
|
349
|
-
}>;
|
|
350
|
-
}
|
|
351
|
-
interface ContentSecurityPolicyConfig {
|
|
352
|
-
directives?: Record<string, string[]>;
|
|
353
|
-
reportOnly?: boolean;
|
|
354
|
-
}
|
|
355
|
-
interface XFrameOptionsConfig {
|
|
356
|
-
action: 'DENY' | 'SAMEORIGIN';
|
|
357
|
-
}
|
|
358
|
-
interface RootSecurityConfig {
|
|
359
|
-
/**
|
|
360
|
-
* Content-Security-Policy config. If enabled, a nonce is auto-generated
|
|
361
|
-
* for every request and appended to script and stylesheet tags. You can
|
|
362
|
-
* validate your CSP headers using a tool like {@link https://csp-evaluator.withgoogle.com/}.
|
|
363
|
-
*
|
|
364
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP}
|
|
365
|
-
*/
|
|
366
|
-
contentSecurityPolicy?: ContentSecurityPolicyConfig | boolean;
|
|
367
|
-
/**
|
|
368
|
-
* Strict-Transport-Security config. When enabled, the header value is set
|
|
369
|
-
* to `Strict-Transport-Security: max-age=63072000; includeSubDomains; preload`.
|
|
370
|
-
*/
|
|
371
|
-
strictTransportSecurity?: boolean;
|
|
372
|
-
/**
|
|
373
|
-
* X-Content-Type-Options config. When enabled, the header value is set to
|
|
374
|
-
* `X-Content-Type-Options: nosniff`.
|
|
375
|
-
*/
|
|
376
|
-
xContentTypeOptions?: boolean;
|
|
377
|
-
/**
|
|
378
|
-
* X-Frame-Options config. Setting this value to `true` will default the
|
|
379
|
-
* header value to `X-Frame-Options: SAMEORIGIN`.
|
|
380
|
-
*
|
|
381
|
-
* @see {@link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options}
|
|
382
|
-
*/
|
|
383
|
-
xFrameOptions?: 'DENY' | 'SAMEORIGIN' | boolean;
|
|
384
|
-
/**
|
|
385
|
-
* X-XSS-Protection config. When enabled, the header value is set to
|
|
386
|
-
* `X-XSS-Protection: 1; mode=block`.
|
|
387
|
-
*/
|
|
388
|
-
xXssProtection?: boolean;
|
|
389
|
-
}
|
|
390
|
-
interface RootServerConfig {
|
|
391
|
-
/**
|
|
392
|
-
* An array of middleware to add to the express server. These middleware are
|
|
393
|
-
* added to the beginning of the express app.
|
|
394
|
-
*/
|
|
395
|
-
middlewares?: RequestMiddleware[];
|
|
396
|
-
/**
|
|
397
|
-
* The `trailingSlash` config allows you to control how the server handles
|
|
398
|
-
* trailing slashes. This config only affects URLs that do not have a file
|
|
399
|
-
* extension (i.e. HTML paths).
|
|
400
|
-
*
|
|
401
|
-
* - When `true`, the server redirects URLs to add a trailing slash
|
|
402
|
-
* - When `false`, the server redirects URLs to remove a trailing slash
|
|
403
|
-
* - When unspecified, the server allows URLs with and without trailing slash
|
|
404
|
-
*/
|
|
405
|
-
trailingSlash?: boolean;
|
|
406
|
-
/**
|
|
407
|
-
* Cookie secret for the session middleware.
|
|
408
|
-
*
|
|
409
|
-
* Generate a secure secret with:
|
|
410
|
-
* ```
|
|
411
|
-
* node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"
|
|
412
|
-
* ```
|
|
413
|
-
*/
|
|
414
|
-
sessionCookieSecret?: string | string[];
|
|
415
|
-
/**
|
|
416
|
-
* List of redirects. Supports optional wildcards.
|
|
417
|
-
*
|
|
418
|
-
* @example
|
|
419
|
-
* ```ts
|
|
420
|
-
* redirects: [
|
|
421
|
-
* {
|
|
422
|
-
* source: '/old-path/[id]',
|
|
423
|
-
* destination: '/new-path/[id]',
|
|
424
|
-
* type: 301,
|
|
425
|
-
* },
|
|
426
|
-
* {
|
|
427
|
-
* source: '/old-path/[...wildcard]',
|
|
428
|
-
* destination: '/new-path/[...wildcard]',
|
|
429
|
-
* },
|
|
430
|
-
* ]
|
|
431
|
-
* ```
|
|
432
|
-
*/
|
|
433
|
-
redirects?: RootRedirectConfig[];
|
|
434
|
-
/**
|
|
435
|
-
* HTTP headers to add to a response.
|
|
436
|
-
*/
|
|
437
|
-
headers?: RootHeaderConfig[];
|
|
438
|
-
/**
|
|
439
|
-
* HTTP security settings. By default, all security settings are enabled with
|
|
440
|
-
* commonly used default values.
|
|
441
|
-
*/
|
|
442
|
-
security?: RootSecurityConfig;
|
|
443
|
-
/**
|
|
444
|
-
* Home page URL path, which is printed when the dev server starts.
|
|
445
|
-
*/
|
|
446
|
-
homePagePath?: string;
|
|
447
|
-
}
|
|
448
|
-
declare function defineConfig(config: RootUserConfig): RootUserConfig;
|
|
449
|
-
|
|
450
|
-
interface ElementSourceFile {
|
|
451
|
-
/** Full file path. */
|
|
452
|
-
filePath: string;
|
|
453
|
-
/** Path relative to the root project directory. */
|
|
454
|
-
relPath: string;
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Dependency graph for element files to capture which other elements are used
|
|
458
|
-
* by any particular element.
|
|
459
|
-
*/
|
|
460
|
-
declare class ElementGraph {
|
|
461
|
-
/**
|
|
462
|
-
* Element tagName => sourceFile.
|
|
463
|
-
*/
|
|
464
|
-
readonly sourceFiles: {
|
|
465
|
-
[tagName: string]: ElementSourceFile;
|
|
466
|
-
};
|
|
467
|
-
/**
|
|
468
|
-
* Element tagName => set of element tagName dependencies.
|
|
469
|
-
*/
|
|
470
|
-
private deps;
|
|
471
|
-
constructor(sourceFiles: {
|
|
472
|
-
[tagName: string]: ElementSourceFile;
|
|
473
|
-
});
|
|
474
|
-
toJson(): {
|
|
475
|
-
sourceFiles: {
|
|
476
|
-
[tagName: string]: ElementSourceFile;
|
|
477
|
-
};
|
|
478
|
-
deps: Record<string, string[]>;
|
|
479
|
-
};
|
|
480
|
-
static fromJson(data: {
|
|
481
|
-
deps: any;
|
|
482
|
-
sourceFiles: any;
|
|
483
|
-
}): ElementGraph;
|
|
484
|
-
getDeps(tagName: string, visited?: Set<string>): string[];
|
|
485
|
-
/**
|
|
486
|
-
* Parses an element's source file for usage of other custom elements.
|
|
487
|
-
*/
|
|
488
|
-
private parseDepsFromSource;
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
interface Asset {
|
|
492
|
-
/**
|
|
493
|
-
* The path to the asset's src file, relative to the project root.
|
|
494
|
-
*/
|
|
495
|
-
src: string;
|
|
496
|
-
/**
|
|
497
|
-
* The serving URL for the asset.
|
|
498
|
-
*/
|
|
499
|
-
assetUrl: string;
|
|
500
|
-
/**
|
|
501
|
-
* Recursively walks all deps and returns a list of CSS asset URLs.
|
|
502
|
-
*/
|
|
503
|
-
getCssDeps(): Promise<string[]>;
|
|
504
|
-
/**
|
|
505
|
-
* Recursively walks all deps and returns a list of JS asset URLs.
|
|
506
|
-
*/
|
|
507
|
-
getJsDeps(): Promise<string[]>;
|
|
508
|
-
}
|
|
509
|
-
interface AssetMap {
|
|
510
|
-
/**
|
|
511
|
-
* Returns the asset for a given src file. The `src` value should be a path
|
|
512
|
-
* relative to the project root, e.g. "routes/index.tsx".
|
|
513
|
-
*/
|
|
514
|
-
get: (src: string) => Promise<Asset | null>;
|
|
515
|
-
}
|
|
516
|
-
|
|
517
|
-
declare class Renderer {
|
|
518
|
-
private rootConfig;
|
|
519
|
-
private assetMap;
|
|
520
|
-
private elementGraph;
|
|
521
|
-
private router;
|
|
522
|
-
constructor(rootConfig: RootConfig, options: {
|
|
523
|
-
assetMap: AssetMap;
|
|
524
|
-
elementGraph: ElementGraph;
|
|
525
|
-
});
|
|
526
|
-
/** Returns a route from the router. */
|
|
527
|
-
getRoute(url: string): [Route | undefined, Record<string, string>];
|
|
528
|
-
handle(req: Request, res: Response, next: NextFunction): Promise<void>;
|
|
529
|
-
private renderComponent;
|
|
530
|
-
/** SSG renders a route. */
|
|
531
|
-
renderRoute(route: Route, options: {
|
|
532
|
-
routeParams: Record<string, string>;
|
|
533
|
-
}): Promise<{
|
|
534
|
-
html?: string;
|
|
535
|
-
notFound?: boolean;
|
|
536
|
-
}>;
|
|
537
|
-
/** Handles the SSR rendering of a route. */
|
|
538
|
-
handleRoute(req: Request, res: Response, next: NextFunction, route: Route, options?: {
|
|
539
|
-
defaultStatusCode?: number;
|
|
540
|
-
/**
|
|
541
|
-
* URL placeholder params.
|
|
542
|
-
*/
|
|
543
|
-
routeParams?: Record<string, string>;
|
|
544
|
-
/**
|
|
545
|
-
* Handler function that tries the next matching route if multiple routes
|
|
546
|
-
* match for a given url path.
|
|
547
|
-
*/
|
|
548
|
-
nextRouteHandler?: () => void | Promise<void>;
|
|
549
|
-
}): Promise<void>;
|
|
550
|
-
/**
|
|
551
|
-
* Constructs and returns the project's sitemap.
|
|
552
|
-
*
|
|
553
|
-
* The sitemap is used to:
|
|
554
|
-
* - determine all paths to build in SSG mode
|
|
555
|
-
* - display links on the dev server's 404 page
|
|
556
|
-
* - construct alternates for localized URL paths
|
|
557
|
-
*/
|
|
558
|
-
getSitemap(): Promise<Sitemap>;
|
|
559
|
-
private getJsxRenderOptions;
|
|
560
|
-
/**
|
|
561
|
-
* Renders JSX via either the `@blinkk/root/jsx` package or
|
|
562
|
-
* `preact-render-to-string` depending if the `jsxRenderer` config is set up
|
|
563
|
-
* in `root.config.ts`.
|
|
564
|
-
*/
|
|
565
|
-
private renderJsx;
|
|
566
|
-
private getConfiguredStyleEntries;
|
|
567
|
-
private renderHtml;
|
|
568
|
-
private ensureNewline;
|
|
569
|
-
render404(options?: {
|
|
570
|
-
currentPath?: string;
|
|
571
|
-
}): Promise<{
|
|
572
|
-
html: string;
|
|
573
|
-
}>;
|
|
574
|
-
renderError(err: any, options?: {
|
|
575
|
-
currentPath?: string;
|
|
576
|
-
}): Promise<{
|
|
577
|
-
html: string;
|
|
578
|
-
}>;
|
|
579
|
-
renderDevServer404(req: Request): Promise<{
|
|
580
|
-
html: string;
|
|
581
|
-
}>;
|
|
582
|
-
renderDevServer500(req: Request, error: unknown): Promise<{
|
|
583
|
-
html: string;
|
|
584
|
-
}>;
|
|
585
|
-
/**
|
|
586
|
-
* Parses rendered HTML for custom element tags used on the page and
|
|
587
|
-
* automatically adds the JS/CSS deps to the page.
|
|
588
|
-
*/
|
|
589
|
-
private collectElementDeps;
|
|
590
|
-
/**
|
|
591
|
-
* Returns the `security` config value with default values inserted wherever
|
|
592
|
-
* a user config value is blank or set to `true`.
|
|
593
|
-
*/
|
|
594
|
-
private getSecurityConfig;
|
|
595
|
-
/**
|
|
596
|
-
* Generates a random string that can be used as the "nonce" value for CSP.
|
|
597
|
-
*/
|
|
598
|
-
private generateNonce;
|
|
599
|
-
/**
|
|
600
|
-
* Sets security-related HTTP headers.
|
|
601
|
-
*/
|
|
602
|
-
private setSecurityHeaders;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
/**
|
|
606
|
-
* Param values from the route, e.g. a route like `/route/[slug].tsx` will pass
|
|
607
|
-
* `{slug: 'foo'}`.
|
|
608
|
-
*/
|
|
609
|
-
type RouteParams = Record<string, string>;
|
|
610
|
-
/**
|
|
611
|
-
* The `getStaticProps()` function is an optional function that routes can
|
|
612
|
-
* define to fetch and transform props before passing it to the route's
|
|
613
|
-
* component.
|
|
614
|
-
*/
|
|
615
|
-
type GetStaticProps<T = unknown> = (ctx: {
|
|
616
|
-
rootConfig: RootConfig;
|
|
617
|
-
params: RouteParams;
|
|
618
|
-
}) => Promise<{
|
|
619
|
-
/** Props to pass to the component. */
|
|
620
|
-
props?: T;
|
|
621
|
-
/** The rendered locale. */
|
|
622
|
-
locale?: string;
|
|
623
|
-
/**
|
|
624
|
-
* Translations to pass to `useTranslations()`. If provided, the translations
|
|
625
|
-
* map passed here will be merged with the translations from
|
|
626
|
-
* `/translations/{locale}.json`.
|
|
627
|
-
*/
|
|
628
|
-
translations?: Record<string, string>;
|
|
629
|
-
/** Set to true if the route should result in a 404 page. */
|
|
630
|
-
notFound?: boolean;
|
|
631
|
-
}>;
|
|
632
|
-
/**
|
|
633
|
-
* The `getStaticPaths()` is used by the SSG build to determine all of the
|
|
634
|
-
* paths that exist for a given route. This should be used alongside a
|
|
635
|
-
* parameterized route, e.g. `/routes/blog/[slug].tsx`.
|
|
636
|
-
*/
|
|
637
|
-
type GetStaticPaths<T = RouteParams> = (ctx: {
|
|
638
|
-
rootConfig: RootConfig;
|
|
639
|
-
}) => Promise<{
|
|
640
|
-
paths: Array<{
|
|
641
|
-
params: T;
|
|
642
|
-
}>;
|
|
643
|
-
}>;
|
|
644
|
-
/** Multipart file type for the multipartMiddleware(). */
|
|
645
|
-
interface MultipartFile {
|
|
646
|
-
fieldname: string;
|
|
647
|
-
originalName: string;
|
|
648
|
-
encoding: string;
|
|
649
|
-
mimetype: string;
|
|
650
|
-
buffer: Buffer;
|
|
651
|
-
}
|
|
652
|
-
type RequestMiddleware = ((req: Request, res: Response) => any) | ((req: Request, res: Response, next: NextFunction) => any) | ((err: any, req: Request, res: Response, next: NextFunction) => any);
|
|
653
|
-
/** Root.js express app. */
|
|
654
|
-
type Server = Express & {
|
|
655
|
-
use(middlewares: RequestMiddleware | RequestMiddleware[]): any;
|
|
656
|
-
use(urlPath: string, middlewares: RequestMiddleware | RequestMiddleware[]): any;
|
|
657
|
-
};
|
|
658
|
-
/** Root.js express request. */
|
|
659
|
-
type Request = Request$1 & {
|
|
660
|
-
/** The root.js project config. */
|
|
661
|
-
rootConfig?: RootConfig & {
|
|
662
|
-
rootDir: string;
|
|
663
|
-
};
|
|
664
|
-
/** The vite dev server. This is only available when running `root dev`. */
|
|
665
|
-
viteServer?: ViteDevServer;
|
|
666
|
-
/** The root.js renderer, to render routes within middleware. */
|
|
667
|
-
renderer?: Renderer;
|
|
668
|
-
/** Logged in user for the request. */
|
|
669
|
-
user?: {
|
|
670
|
-
email: string;
|
|
671
|
-
};
|
|
672
|
-
/**
|
|
673
|
-
* Handler context, provided to route files that export a custom `handler()`
|
|
674
|
-
* function.
|
|
675
|
-
*/
|
|
676
|
-
handlerContext?: HandlerContext;
|
|
677
|
-
hooks: Hooks;
|
|
678
|
-
/** Gets and sets session data via cookie. */
|
|
679
|
-
session: Session;
|
|
680
|
-
/** Firebase functions uses rawBody for its multipart data. */
|
|
681
|
-
rawBody?: any;
|
|
682
|
-
/** Map of field name to file. */
|
|
683
|
-
files?: {
|
|
684
|
-
[fieldname: string]: MultipartFile;
|
|
685
|
-
};
|
|
686
|
-
};
|
|
687
|
-
/** Root.js express response. */
|
|
688
|
-
type Response = Response$1 & {
|
|
689
|
-
session: Session;
|
|
690
|
-
saveSession: (options?: SaveSessionOptions) => void;
|
|
691
|
-
};
|
|
692
|
-
/** Root.js express next function. */
|
|
693
|
-
type NextFunction = NextFunction$1;
|
|
694
|
-
/**
|
|
695
|
-
* A context variable passed to a route's `handle()` method within the req
|
|
696
|
-
* object.
|
|
697
|
-
*/
|
|
698
|
-
interface HandlerContext<Props = any> {
|
|
699
|
-
/**
|
|
700
|
-
* The resolved route.
|
|
701
|
-
*/
|
|
702
|
-
route: Route;
|
|
703
|
-
/**
|
|
704
|
-
* Param values from the route, e.g. a route like `/route/[slug].tsx` will
|
|
705
|
-
* pass `{slug: 'foo'}`.
|
|
706
|
-
*/
|
|
707
|
-
params: RouteParams;
|
|
708
|
-
/**
|
|
709
|
-
* i18n locales to try for the user's http request. The priority order mimics
|
|
710
|
-
* the Firebase Hosting i18n fallback logic.
|
|
711
|
-
* https://firebase.google.com/docs/hosting/i18n-rewrites#priority-order
|
|
712
|
-
*/
|
|
713
|
-
i18nFallbackLocales: string[];
|
|
714
|
-
/**
|
|
715
|
-
* Iterates through the i18nFallbackLocales and returns the first available
|
|
716
|
-
* locale.
|
|
717
|
-
*/
|
|
718
|
-
getPreferredLocale: (availableLocales: string[]) => string;
|
|
719
|
-
/** Renders the default exported component from the route. */
|
|
720
|
-
render: HandlerRenderFn<Props>;
|
|
721
|
-
/**
|
|
722
|
-
* Renders a 404 page. When `nextRoute` is true, the next matching route
|
|
723
|
-
* handler will be invoked instead of rendering the default 404 page.
|
|
724
|
-
*/
|
|
725
|
-
render404: (options?: {
|
|
726
|
-
nextRoute?: boolean;
|
|
727
|
-
}) => Promise<void>;
|
|
728
|
-
}
|
|
729
|
-
/**
|
|
730
|
-
* The `handle()` function can be exported by a route to define a custom express
|
|
731
|
-
* request handler. The `req` object will contain a `handlerContext` which
|
|
732
|
-
* contains the route's param values and also a `render()` method that can be
|
|
733
|
-
* used to render the route's default component.
|
|
734
|
-
*/
|
|
735
|
-
type Handler = (req: Request, res: Response, next: NextFunction) => void | Promise<void>;
|
|
736
|
-
interface StaticContentResult {
|
|
737
|
-
body: string;
|
|
738
|
-
contentType?: string;
|
|
739
|
-
}
|
|
740
|
-
/**
|
|
741
|
-
* The `getStaticContent()` function is a SSG handler function for non-HTML
|
|
742
|
-
* routes, e.g. `routes/sitemap.xml.ts`.
|
|
743
|
-
*
|
|
744
|
-
* If the route exports a `getStaticProps()` function, the props returned from
|
|
745
|
-
* that function is passed to `getStaticContent()`. Otherwise a default props
|
|
746
|
-
* value is passed which includes the `rootConfig` and route param values.
|
|
747
|
-
*/
|
|
748
|
-
type GetStaticContent = (props: any) => Promise<StaticContentResult | string> | StaticContentResult | string;
|
|
749
|
-
interface RouteModule {
|
|
750
|
-
default?: ComponentType<unknown>;
|
|
751
|
-
getStaticPaths?: GetStaticPaths;
|
|
752
|
-
getStaticProps?: GetStaticProps;
|
|
753
|
-
handle?: Handler;
|
|
754
|
-
getStaticContent?: GetStaticContent;
|
|
755
|
-
}
|
|
756
|
-
interface Route {
|
|
757
|
-
/** The relative path to the route file, e.g. `routes/index.tsx`. */
|
|
758
|
-
src: string;
|
|
759
|
-
/** The imported route module. */
|
|
760
|
-
module: RouteModule;
|
|
761
|
-
/** The locale used for the route. */
|
|
762
|
-
locale: string;
|
|
763
|
-
/**
|
|
764
|
-
* Returns `true` if the route is the default locale route mapped without the
|
|
765
|
-
* i18n url prefix. For example, a route may be mapped to `/foo` and
|
|
766
|
-
* `/[locale]/foo`. The `/foo` route would have `route.isDefaultLocale` set to
|
|
767
|
-
* `true` whereas for `/[locale]/foo` it would be `false`.
|
|
768
|
-
*/
|
|
769
|
-
isDefaultLocale: boolean;
|
|
770
|
-
/**
|
|
771
|
-
* The mapped URL path for the route, e.g.:
|
|
772
|
-
*
|
|
773
|
-
* routes/index.tsx => `/`.
|
|
774
|
-
* routes/events.tsx => `/events`.
|
|
775
|
-
* routes/blog/[slug].tsx => `/blog/[slug]`.
|
|
776
|
-
*
|
|
777
|
-
* Per the example above, this value may contain placeholder params.
|
|
778
|
-
*/
|
|
779
|
-
routePath: string;
|
|
780
|
-
/**
|
|
781
|
-
* The localized URL path for the route, e.g. `/[locale]/blog/[slug]`.
|
|
782
|
-
* Per the example above, this value contains placeholder params.
|
|
783
|
-
*/
|
|
784
|
-
localeRoutePath: string;
|
|
785
|
-
/**
|
|
786
|
-
* The name of the pod that contributed this route, or undefined if the
|
|
787
|
-
* route is from the user's project.
|
|
788
|
-
*/
|
|
789
|
-
podName?: string;
|
|
790
|
-
}
|
|
791
|
-
interface HandlerRenderOptions {
|
|
792
|
-
/** HTTP status code to return. Defaults to 200. */
|
|
793
|
-
statusCode?: number;
|
|
794
|
-
/** The rendered locale. */
|
|
795
|
-
locale?: string;
|
|
796
|
-
/**
|
|
797
|
-
* Translations to pass to `useTranslations()`. If provided, the translations
|
|
798
|
-
* map passed here will be merged with the translations from
|
|
799
|
-
* `/translations/{locale}.json`.
|
|
800
|
-
*/
|
|
801
|
-
translations?: Record<string, string>;
|
|
802
|
-
}
|
|
803
|
-
type HandlerRenderFn<Props = any> = (props: Props, options?: HandlerRenderOptions) => Promise<void>;
|
|
804
|
-
/**
|
|
805
|
-
* Sitemap is a map of URL path -> route info.
|
|
806
|
-
*/
|
|
807
|
-
type Sitemap = Record<string, SitemapItem>;
|
|
808
|
-
/**
|
|
809
|
-
* Sitemap route info. The "default locale" route provides "alts" that can be
|
|
810
|
-
* used for outputting the localized url paths.
|
|
811
|
-
*/
|
|
812
|
-
interface SitemapItem {
|
|
813
|
-
urlPath: string;
|
|
814
|
-
route: Route;
|
|
815
|
-
params: Record<string, string>;
|
|
816
|
-
locale: string;
|
|
817
|
-
hrefLang: string;
|
|
818
|
-
/**
|
|
819
|
-
* Hreflang alts.
|
|
820
|
-
*/
|
|
821
|
-
alts: Record<string, {
|
|
822
|
-
hrefLang: string;
|
|
823
|
-
urlPath: string;
|
|
824
|
-
}>;
|
|
825
|
-
}
|
|
826
|
-
|
|
827
|
-
export { type RouteParams as A, type GetStaticPaths as B, type ContentSecurityPolicyConfig as C, type RequestMiddleware as D, type Handler as E, type StaticContentResult as F, type GetStaticProps as G, type HandlerContext as H, type GetStaticContent as I, type RouteModule as J, type HandlerRenderOptions as K, type LocaleGroup as L, type MultipartFile as M, type NextFunction as N, type HandlerRenderFn as O, type PodConfig as P, type Sitemap as Q, type RootConfig as R, SESSION_COOKIE as S, type SitemapItem as T, Renderer as U, type XFrameOptionsConfig as X, type Request as a, type Response as b, type SessionMiddlewareOptions as c, type SaveSessionOptions as d, Session as e, type Server as f, type Route as g, type RootUserConfig as h, type RootI18nConfig as i, type RootBuildConfig as j, type RootRedirectConfig as k, type RootHeaderConfig as l, type RootSecurityConfig as m, type RootServerConfig as n, defineConfig as o, type Pod as p, type PodFactory as q, definePod as r, sessionMiddleware as s, type PostBuildOptions as t, type ConfigureServerHook as u, type ConfigureServerOptions as v, type PluginHooks as w, type Plugin as x, configureServerPlugins as y, getVitePlugins as z };
|