@sveltejs/kit 1.0.0-next.285 → 1.0.0-next.288
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/assets/client/start.js +21 -8
- package/assets/server/index.js +62 -35
- package/dist/chunks/index.js +30 -6
- package/dist/chunks/index5.js +22 -8
- package/dist/chunks/index6.js +2 -2
- package/dist/cli.js +3 -3
- package/dist/install-fetch.js +2 -2
- package/dist/node.js +3 -4
- package/package.json +4 -3
- package/types/ambient.d.ts +163 -70
- package/types/index.d.ts +28 -271
- package/types/internal.d.ts +18 -81
- package/types/private.d.ts +351 -0
package/types/index.d.ts
CHANGED
|
@@ -5,82 +5,27 @@ import './ambient';
|
|
|
5
5
|
|
|
6
6
|
import { CompileOptions } from 'svelte/types/compiler/interfaces';
|
|
7
7
|
import {
|
|
8
|
-
AdapterEntry,
|
|
9
8
|
Body,
|
|
9
|
+
Builder,
|
|
10
|
+
CspDirectives,
|
|
10
11
|
Either,
|
|
12
|
+
ErrorLoadInput,
|
|
11
13
|
Fallthrough,
|
|
12
|
-
|
|
14
|
+
LoadInput,
|
|
15
|
+
LoadOutput,
|
|
13
16
|
MaybePromise,
|
|
14
17
|
PrerenderOnErrorValue,
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
RequestEvent,
|
|
19
|
+
ResolveOptions,
|
|
17
20
|
ResponseHeaders,
|
|
18
|
-
RouteDefinition,
|
|
19
|
-
SSRNodeLoader,
|
|
20
|
-
SSRRoute,
|
|
21
21
|
TrailingSlash
|
|
22
|
-
} from './
|
|
22
|
+
} from './private';
|
|
23
23
|
|
|
24
24
|
export interface Adapter {
|
|
25
25
|
name: string;
|
|
26
26
|
adapt(builder: Builder): Promise<void>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
export interface Builder {
|
|
30
|
-
log: Logger;
|
|
31
|
-
rimraf(dir: string): void;
|
|
32
|
-
mkdirp(dir: string): void;
|
|
33
|
-
|
|
34
|
-
appDir: string;
|
|
35
|
-
trailingSlash: TrailingSlash;
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Create entry points that map to individual functions
|
|
39
|
-
* @param fn A function that groups a set of routes into an entry point
|
|
40
|
-
*/
|
|
41
|
-
createEntries(fn: (route: RouteDefinition) => AdapterEntry): void;
|
|
42
|
-
|
|
43
|
-
generateManifest: (opts: { relativePath: string; format?: 'esm' | 'cjs' }) => string;
|
|
44
|
-
|
|
45
|
-
getBuildDirectory(name: string): string;
|
|
46
|
-
getClientDirectory(): string;
|
|
47
|
-
getServerDirectory(): string;
|
|
48
|
-
getStaticDirectory(): string;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* @param dest the destination folder to which files should be copied
|
|
52
|
-
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
53
|
-
*/
|
|
54
|
-
writeClient(dest: string): string[];
|
|
55
|
-
/**
|
|
56
|
-
* @param dest the destination folder to which files should be copied
|
|
57
|
-
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
58
|
-
*/
|
|
59
|
-
writeServer(dest: string): string[];
|
|
60
|
-
/**
|
|
61
|
-
* @param dest the destination folder to which files should be copied
|
|
62
|
-
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
63
|
-
*/
|
|
64
|
-
writeStatic(dest: string): string[];
|
|
65
|
-
/**
|
|
66
|
-
* @param from the source file or folder
|
|
67
|
-
* @param to the destination file or folder
|
|
68
|
-
* @param opts.filter a function to determine whether a file or folder should be copied
|
|
69
|
-
* @param opts.replace a map of strings to replace
|
|
70
|
-
* @returns an array of paths corresponding to the files that have been created by the copy
|
|
71
|
-
*/
|
|
72
|
-
copy(
|
|
73
|
-
from: string,
|
|
74
|
-
to: string,
|
|
75
|
-
opts?: {
|
|
76
|
-
filter?: (basename: string) => boolean;
|
|
77
|
-
replace?: Record<string, string>;
|
|
78
|
-
}
|
|
79
|
-
): string[];
|
|
80
|
-
|
|
81
|
-
prerender(options: { all?: boolean; dest: string; fallback?: string }): Promise<Prerendered>;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
29
|
export interface Config {
|
|
85
30
|
compilerOptions?: CompileOptions;
|
|
86
31
|
extensions?: string[];
|
|
@@ -142,129 +87,10 @@ export interface Config {
|
|
|
142
87
|
preprocess?: any;
|
|
143
88
|
}
|
|
144
89
|
|
|
145
|
-
// Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts
|
|
146
|
-
//
|
|
147
|
-
// MIT License
|
|
148
|
-
//
|
|
149
|
-
// Copyright (c) 2021-present, Joshua Hemphill
|
|
150
|
-
// Copyright (c) 2021, Tecnico Corporation
|
|
151
|
-
//
|
|
152
|
-
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
153
|
-
// of this software and associated documentation files (the "Software"), to deal
|
|
154
|
-
// in the Software without restriction, including without limitation the rights
|
|
155
|
-
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
156
|
-
// copies of the Software, and to permit persons to whom the Software is
|
|
157
|
-
// furnished to do so, subject to the following conditions:
|
|
158
|
-
//
|
|
159
|
-
// The above copyright notice and this permission notice shall be included in all
|
|
160
|
-
// copies or substantial portions of the Software.
|
|
161
|
-
//
|
|
162
|
-
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
163
|
-
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
164
|
-
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
165
|
-
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
166
|
-
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
167
|
-
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
168
|
-
// SOFTWARE.
|
|
169
|
-
|
|
170
|
-
export namespace Csp {
|
|
171
|
-
type ActionSource = 'strict-dynamic' | 'report-sample';
|
|
172
|
-
type BaseSource = 'self' | 'unsafe-eval' | 'unsafe-hashes' | 'unsafe-inline' | 'none';
|
|
173
|
-
type CryptoSource = `${'nonce' | 'sha256' | 'sha384' | 'sha512'}-${string}`;
|
|
174
|
-
type FrameSource = HostSource | SchemeSource | 'self' | 'none';
|
|
175
|
-
type HostNameScheme = `${string}.${string}` | 'localhost';
|
|
176
|
-
type HostSource = `${HostProtocolSchemes}${HostNameScheme}${PortScheme}`;
|
|
177
|
-
type HostProtocolSchemes = `${string}://` | '';
|
|
178
|
-
type HttpDelineator = '/' | '?' | '#' | '\\';
|
|
179
|
-
type PortScheme = `:${number}` | '' | ':*';
|
|
180
|
-
type SchemeSource = 'http:' | 'https:' | 'data:' | 'mediastream:' | 'blob:' | 'filesystem:';
|
|
181
|
-
type Source = HostSource | SchemeSource | CryptoSource | BaseSource;
|
|
182
|
-
type Sources = Source[];
|
|
183
|
-
type UriPath = `${HttpDelineator}${string}`;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
export type CspDirectives = {
|
|
187
|
-
'child-src'?: Csp.Sources;
|
|
188
|
-
'default-src'?: Array<Csp.Source | Csp.ActionSource>;
|
|
189
|
-
'frame-src'?: Csp.Sources;
|
|
190
|
-
'worker-src'?: Csp.Sources;
|
|
191
|
-
'connect-src'?: Csp.Sources;
|
|
192
|
-
'font-src'?: Csp.Sources;
|
|
193
|
-
'img-src'?: Csp.Sources;
|
|
194
|
-
'manifest-src'?: Csp.Sources;
|
|
195
|
-
'media-src'?: Csp.Sources;
|
|
196
|
-
'object-src'?: Csp.Sources;
|
|
197
|
-
'prefetch-src'?: Csp.Sources;
|
|
198
|
-
'script-src'?: Array<Csp.Source | Csp.ActionSource>;
|
|
199
|
-
'script-src-elem'?: Csp.Sources;
|
|
200
|
-
'script-src-attr'?: Csp.Sources;
|
|
201
|
-
'style-src'?: Array<Csp.Source | Csp.ActionSource>;
|
|
202
|
-
'style-src-elem'?: Csp.Sources;
|
|
203
|
-
'style-src-attr'?: Csp.Sources;
|
|
204
|
-
'base-uri'?: Array<Csp.Source | Csp.ActionSource>;
|
|
205
|
-
sandbox?: Array<
|
|
206
|
-
| 'allow-downloads-without-user-activation'
|
|
207
|
-
| 'allow-forms'
|
|
208
|
-
| 'allow-modals'
|
|
209
|
-
| 'allow-orientation-lock'
|
|
210
|
-
| 'allow-pointer-lock'
|
|
211
|
-
| 'allow-popups'
|
|
212
|
-
| 'allow-popups-to-escape-sandbox'
|
|
213
|
-
| 'allow-presentation'
|
|
214
|
-
| 'allow-same-origin'
|
|
215
|
-
| 'allow-scripts'
|
|
216
|
-
| 'allow-storage-access-by-user-activation'
|
|
217
|
-
| 'allow-top-navigation'
|
|
218
|
-
| 'allow-top-navigation-by-user-activation'
|
|
219
|
-
>;
|
|
220
|
-
'form-action'?: Array<Csp.Source | Csp.ActionSource>;
|
|
221
|
-
'frame-ancestors'?: Array<Csp.HostSource | Csp.SchemeSource | Csp.FrameSource>;
|
|
222
|
-
'navigate-to'?: Array<Csp.Source | Csp.ActionSource>;
|
|
223
|
-
'report-uri'?: Csp.UriPath[];
|
|
224
|
-
'report-to'?: string[];
|
|
225
|
-
|
|
226
|
-
'require-trusted-types-for'?: Array<'script'>;
|
|
227
|
-
'trusted-types'?: Array<'none' | 'allow-duplicates' | '*' | string>;
|
|
228
|
-
'upgrade-insecure-requests'?: boolean;
|
|
229
|
-
|
|
230
|
-
/** @deprecated */
|
|
231
|
-
'require-sri-for'?: Array<'script' | 'style' | 'script style'>;
|
|
232
|
-
|
|
233
|
-
/** @deprecated */
|
|
234
|
-
'block-all-mixed-content'?: boolean;
|
|
235
|
-
|
|
236
|
-
/** @deprecated */
|
|
237
|
-
'plugin-types'?: Array<`${string}/${string}` | 'none'>;
|
|
238
|
-
|
|
239
|
-
/** @deprecated */
|
|
240
|
-
referrer?: Array<
|
|
241
|
-
| 'no-referrer'
|
|
242
|
-
| 'no-referrer-when-downgrade'
|
|
243
|
-
| 'origin'
|
|
244
|
-
| 'origin-when-cross-origin'
|
|
245
|
-
| 'same-origin'
|
|
246
|
-
| 'strict-origin'
|
|
247
|
-
| 'strict-origin-when-cross-origin'
|
|
248
|
-
| 'unsafe-url'
|
|
249
|
-
| 'none'
|
|
250
|
-
>;
|
|
251
|
-
};
|
|
252
|
-
|
|
253
|
-
export interface EndpointOutput<Output extends Body = Body> {
|
|
254
|
-
status?: number;
|
|
255
|
-
headers?: Headers | Partial<ResponseHeaders>;
|
|
256
|
-
body?: Output;
|
|
257
|
-
}
|
|
258
|
-
|
|
259
90
|
export interface ErrorLoad<Params = Record<string, string>, Props = Record<string, any>> {
|
|
260
91
|
(input: ErrorLoadInput<Params>): MaybePromise<LoadOutput<Props>>;
|
|
261
92
|
}
|
|
262
93
|
|
|
263
|
-
export interface ErrorLoadInput<Params = Record<string, string>> extends LoadInput<Params> {
|
|
264
|
-
status?: number;
|
|
265
|
-
error?: Error;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
94
|
export interface ExternalFetch {
|
|
269
95
|
(req: Request): Promise<Response>;
|
|
270
96
|
}
|
|
@@ -288,105 +114,36 @@ export interface Load<Params = Record<string, string>, Props = Record<string, an
|
|
|
288
114
|
(input: LoadInput<Params>): MaybePromise<Either<Fallthrough, LoadOutput<Props>>>;
|
|
289
115
|
}
|
|
290
116
|
|
|
291
|
-
export interface
|
|
117
|
+
export interface Page<Params extends Record<string, string> = Record<string, string>> {
|
|
292
118
|
url: URL;
|
|
293
119
|
params: Params;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
stuff: Partial<App.Stuff>;
|
|
120
|
+
stuff: App.Stuff;
|
|
121
|
+
status: number;
|
|
122
|
+
error: Error | null;
|
|
298
123
|
}
|
|
299
124
|
|
|
300
|
-
export interface
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
redirect?: string;
|
|
304
|
-
props?: Props;
|
|
305
|
-
stuff?: Partial<App.Stuff>;
|
|
306
|
-
maxage?: number;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
export interface Prerendered {
|
|
310
|
-
pages: Map<
|
|
311
|
-
string,
|
|
312
|
-
{
|
|
313
|
-
/** The location of the .html file relative to the output directory */
|
|
314
|
-
file: string;
|
|
315
|
-
}
|
|
316
|
-
>;
|
|
317
|
-
assets: Map<
|
|
318
|
-
string,
|
|
319
|
-
{
|
|
320
|
-
/** The MIME type of the asset */
|
|
321
|
-
type: string;
|
|
322
|
-
}
|
|
323
|
-
>;
|
|
324
|
-
redirects: Map<
|
|
325
|
-
string,
|
|
326
|
-
{
|
|
327
|
-
status: number;
|
|
328
|
-
location: string;
|
|
329
|
-
}
|
|
330
|
-
>;
|
|
331
|
-
/** An array of prerendered paths (without trailing slashes, regardless of the trailingSlash config) */
|
|
332
|
-
paths: string[];
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
export interface PrerenderErrorHandler {
|
|
336
|
-
(details: {
|
|
337
|
-
status: number;
|
|
338
|
-
path: string;
|
|
339
|
-
referrer: string | null;
|
|
340
|
-
referenceType: 'linked' | 'fetched';
|
|
341
|
-
}): void;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
export interface RequestEvent<Params = Record<string, string>> {
|
|
345
|
-
request: Request;
|
|
346
|
-
url: URL;
|
|
347
|
-
params: Params;
|
|
348
|
-
locals: App.Locals;
|
|
349
|
-
platform: Readonly<App.Platform>;
|
|
125
|
+
export interface Navigation {
|
|
126
|
+
from: URL;
|
|
127
|
+
to: URL;
|
|
350
128
|
}
|
|
351
129
|
|
|
352
130
|
/**
|
|
353
131
|
* A function exported from an endpoint that corresponds to an
|
|
354
|
-
* HTTP verb (get
|
|
132
|
+
* HTTP verb (`get`, `put`, `patch`, etc) and handles requests with
|
|
355
133
|
* that method. Note that since 'delete' is a reserved word in
|
|
356
|
-
* JavaScript, delete handles are called
|
|
134
|
+
* JavaScript, delete handles are called `del` instead.
|
|
357
135
|
*/
|
|
358
136
|
export interface RequestHandler<Params = Record<string, string>, Output extends Body = Body> {
|
|
359
|
-
(event: RequestEvent<Params>):
|
|
360
|
-
Either<Output extends Response ? Response : EndpointOutput<Output>, Fallthrough>
|
|
361
|
-
>;
|
|
137
|
+
(event: RequestEvent<Params>): RequestHandlerOutput<Output>;
|
|
362
138
|
}
|
|
363
139
|
|
|
364
|
-
export
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
export interface SSRManifest {
|
|
376
|
-
appDir: string;
|
|
377
|
-
assets: Set<string>;
|
|
378
|
-
/** private fields */
|
|
379
|
-
_: {
|
|
380
|
-
mime: Record<string, string>;
|
|
381
|
-
entry: {
|
|
382
|
-
file: string;
|
|
383
|
-
js: string[];
|
|
384
|
-
css: string[];
|
|
385
|
-
};
|
|
386
|
-
nodes: SSRNodeLoader[];
|
|
387
|
-
routes: SSRRoute[];
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
// TODO should this be public?
|
|
392
|
-
export type ValidatedConfig = RecursiveRequired<Config>;
|
|
140
|
+
export type RequestHandlerOutput<Output extends Body = Body> = MaybePromise<
|
|
141
|
+
Either<
|
|
142
|
+
{
|
|
143
|
+
status?: number;
|
|
144
|
+
headers?: Headers | Partial<ResponseHeaders>;
|
|
145
|
+
body?: Output;
|
|
146
|
+
},
|
|
147
|
+
Fallthrough
|
|
148
|
+
>
|
|
149
|
+
>;
|
package/types/internal.d.ts
CHANGED
|
@@ -1,42 +1,28 @@
|
|
|
1
1
|
import { OutputAsset, OutputChunk } from 'rollup';
|
|
2
2
|
import {
|
|
3
|
-
SSRManifest,
|
|
4
|
-
ValidatedConfig,
|
|
5
3
|
RequestHandler,
|
|
6
4
|
Load,
|
|
7
5
|
ExternalFetch,
|
|
8
6
|
GetSession,
|
|
9
7
|
Handle,
|
|
10
8
|
HandleError,
|
|
9
|
+
Config
|
|
10
|
+
} from './index';
|
|
11
|
+
import {
|
|
12
|
+
Either,
|
|
13
|
+
Fallthrough,
|
|
14
|
+
HttpMethod,
|
|
15
|
+
JSONObject,
|
|
16
|
+
MaybePromise,
|
|
11
17
|
RequestEvent,
|
|
12
18
|
RequestOptions,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* For example, `/foo/a-[b]` and `/foo/[c]` are different routes, but would both
|
|
21
|
-
* be represented in a Netlify _redirects file as `/foo/:param`, so they share an ID
|
|
22
|
-
*/
|
|
23
|
-
id: string;
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* A function that compares the candidate route with the current route to determine
|
|
27
|
-
* if it should be treated as a fallback for the current route. For example, `/foo/[c]`
|
|
28
|
-
* is a fallback for `/foo/a-[b]`, and `/[...catchall]` is a fallback for all routes
|
|
29
|
-
*/
|
|
30
|
-
filter: (route: RouteDefinition) => boolean;
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* A function that is invoked once the entry has been created. This is where you
|
|
34
|
-
* should write the function to the filesystem and generate redirect manifests.
|
|
35
|
-
*/
|
|
36
|
-
complete: (entry: {
|
|
37
|
-
generateManifest: (opts: { relativePath: string; format?: 'esm' | 'cjs' }) => string;
|
|
38
|
-
}) => void;
|
|
39
|
-
}
|
|
19
|
+
ResolveOptions,
|
|
20
|
+
ResponseHeaders,
|
|
21
|
+
RouteSegment,
|
|
22
|
+
Server,
|
|
23
|
+
SSRManifest,
|
|
24
|
+
TrailingSlash
|
|
25
|
+
} from './private';
|
|
40
26
|
|
|
41
27
|
export interface ServerModule {
|
|
42
28
|
Server: typeof InternalServer;
|
|
@@ -58,8 +44,6 @@ export interface Asset {
|
|
|
58
44
|
type: string | null;
|
|
59
45
|
}
|
|
60
46
|
|
|
61
|
-
export type Body = JSONValue | Uint8Array | ReadableStream | import('stream').Readable;
|
|
62
|
-
|
|
63
47
|
export interface BuildData {
|
|
64
48
|
app_dir: string;
|
|
65
49
|
manifest_data: ManifestData;
|
|
@@ -89,8 +73,6 @@ export type CSRComponentLoader = () => Promise<CSRComponent>;
|
|
|
89
73
|
|
|
90
74
|
export type CSRRoute = [RegExp, CSRComponentLoader[], CSRComponentLoader[], GetParams?, HasShadow?];
|
|
91
75
|
|
|
92
|
-
export type Either<T, U> = Only<T, U> | Only<U, T>;
|
|
93
|
-
|
|
94
76
|
export interface EndpointData {
|
|
95
77
|
type: 'endpoint';
|
|
96
78
|
key: string;
|
|
@@ -100,10 +82,6 @@ export interface EndpointData {
|
|
|
100
82
|
file: string;
|
|
101
83
|
}
|
|
102
84
|
|
|
103
|
-
export interface Fallthrough {
|
|
104
|
-
fallthrough: true;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
85
|
export type GetParams = (match: RegExpExecArray) => Record<string, string>;
|
|
108
86
|
|
|
109
87
|
type HasShadow = 1;
|
|
@@ -115,8 +93,6 @@ export interface Hooks {
|
|
|
115
93
|
handleError: HandleError;
|
|
116
94
|
}
|
|
117
95
|
|
|
118
|
-
export type HttpMethod = 'get' | 'head' | 'post' | 'put' | 'delete' | 'patch';
|
|
119
|
-
|
|
120
96
|
export class InternalServer extends Server {
|
|
121
97
|
respond(
|
|
122
98
|
request: Request,
|
|
@@ -126,19 +102,6 @@ export class InternalServer extends Server {
|
|
|
126
102
|
): Promise<Response>;
|
|
127
103
|
}
|
|
128
104
|
|
|
129
|
-
export type JSONObject = { [key: string]: JSONValue };
|
|
130
|
-
|
|
131
|
-
export type JSONValue = string | number | boolean | null | ToJSON | JSONValue[] | JSONObject;
|
|
132
|
-
|
|
133
|
-
export interface Logger {
|
|
134
|
-
(msg: string): void;
|
|
135
|
-
success(msg: string): void;
|
|
136
|
-
error(msg: string): void;
|
|
137
|
-
warn(msg: string): void;
|
|
138
|
-
minor(msg: string): void;
|
|
139
|
-
info(msg: string): void;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
105
|
export interface ManifestData {
|
|
143
106
|
assets: Asset[];
|
|
144
107
|
layout: string;
|
|
@@ -147,8 +110,6 @@ export interface ManifestData {
|
|
|
147
110
|
routes: RouteData[];
|
|
148
111
|
}
|
|
149
112
|
|
|
150
|
-
export type MaybePromise<T> = T | Promise<T>;
|
|
151
|
-
|
|
152
113
|
export interface MethodOverride {
|
|
153
114
|
parameter: string;
|
|
154
115
|
allowed: string[];
|
|
@@ -166,8 +127,6 @@ export type NormalizedLoadOutput = Either<
|
|
|
166
127
|
Fallthrough
|
|
167
128
|
>;
|
|
168
129
|
|
|
169
|
-
type Only<T, U> = { [P in keyof T]: T[P] } & { [P in Exclude<keyof U, keyof T>]?: never };
|
|
170
|
-
|
|
171
130
|
export interface PageData {
|
|
172
131
|
type: 'page';
|
|
173
132
|
key: string;
|
|
@@ -185,8 +144,6 @@ export interface PrerenderDependency {
|
|
|
185
144
|
body: null | string | Uint8Array;
|
|
186
145
|
}
|
|
187
146
|
|
|
188
|
-
export type PrerenderOnErrorValue = 'fail' | 'continue' | PrerenderErrorHandler;
|
|
189
|
-
|
|
190
147
|
export interface PrerenderOptions {
|
|
191
148
|
fallback?: string;
|
|
192
149
|
all: boolean;
|
|
@@ -204,33 +161,14 @@ export type RecursiveRequired<T> = {
|
|
|
204
161
|
: T[K]; // Use the exact type for everything else
|
|
205
162
|
};
|
|
206
163
|
|
|
207
|
-
export
|
|
208
|
-
ssr: boolean;
|
|
209
|
-
transformPage: ({ html }: { html: string }) => MaybePromise<string>;
|
|
210
|
-
}
|
|
164
|
+
export type RequiredResolveOptions = Required<ResolveOptions>;
|
|
211
165
|
|
|
212
166
|
export interface Respond {
|
|
213
167
|
(request: Request, options: SSROptions, state?: SSRState): Promise<Response>;
|
|
214
168
|
}
|
|
215
169
|
|
|
216
|
-
/** `string[]` is only for set-cookie, everything else must be type of `string` */
|
|
217
|
-
export type ResponseHeaders = Record<string, string | number | string[]>;
|
|
218
|
-
|
|
219
170
|
export type RouteData = PageData | EndpointData;
|
|
220
171
|
|
|
221
|
-
export interface RouteDefinition {
|
|
222
|
-
type: 'page' | 'endpoint';
|
|
223
|
-
pattern: RegExp;
|
|
224
|
-
segments: RouteSegment[];
|
|
225
|
-
methods: HttpMethod[];
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
export interface RouteSegment {
|
|
229
|
-
content: string;
|
|
230
|
-
dynamic: boolean;
|
|
231
|
-
rest: boolean;
|
|
232
|
-
}
|
|
233
|
-
|
|
234
172
|
export interface ShadowEndpointOutput<Output extends JSONObject = JSONObject> {
|
|
235
173
|
status?: number;
|
|
236
174
|
headers?: Partial<ResponseHeaders>;
|
|
@@ -365,8 +303,7 @@ export interface SSRState {
|
|
|
365
303
|
|
|
366
304
|
export type StrictBody = string | Uint8Array;
|
|
367
305
|
|
|
368
|
-
type
|
|
369
|
-
|
|
370
|
-
export type TrailingSlash = 'never' | 'always' | 'ignore';
|
|
306
|
+
export type ValidatedConfig = RecursiveRequired<Config>;
|
|
371
307
|
|
|
372
308
|
export * from './index';
|
|
309
|
+
export * from './private';
|