@sveltejs/kit 1.0.0-next.278 → 1.0.0-next.279
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 +12 -12
- package/assets/server/index.js +92 -97
- package/dist/chunks/amp_hook.js +1 -1
- package/dist/chunks/index.js +9 -9
- package/dist/chunks/index2.js +6 -6
- package/dist/chunks/index3.js +12 -12
- package/dist/chunks/index4.js +2 -2
- package/dist/chunks/index5.js +50 -55
- package/dist/chunks/index6.js +2 -2
- package/dist/chunks/index7.js +3 -3
- package/dist/cli.js +6 -6
- package/dist/hooks.js +4 -4
- package/dist/node.js +1 -1
- package/package.json +4 -3
- package/types/{ambient-modules.d.ts → ambient.d.ts} +0 -0
- package/types/index.d.ts +388 -21
- package/types/internal.d.ts +255 -143
- package/types/app.d.ts +0 -35
- package/types/config.d.ts +0 -200
- package/types/csp.d.ts +0 -115
- package/types/endpoint.d.ts +0 -39
- package/types/helper.d.ts +0 -23
- package/types/hooks.d.ts +0 -37
- package/types/page.d.ts +0 -33
package/types/csp.d.ts
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts
|
|
3
|
-
*
|
|
4
|
-
* MIT License
|
|
5
|
-
*
|
|
6
|
-
* Copyright (c) 2021-present, Joshua Hemphill
|
|
7
|
-
* Copyright (c) 2021, Tecnico Corporation
|
|
8
|
-
*
|
|
9
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
11
|
-
* in the Software without restriction, including without limitation the rights
|
|
12
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
14
|
-
* furnished to do so, subject to the following conditions:
|
|
15
|
-
*
|
|
16
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
17
|
-
* copies or substantial portions of the Software.
|
|
18
|
-
*
|
|
19
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
-
* SOFTWARE.
|
|
26
|
-
*/
|
|
27
|
-
type SchemeSource = 'http:' | 'https:' | 'data:' | 'mediastream:' | 'blob:' | 'filesystem:';
|
|
28
|
-
|
|
29
|
-
type HostProtocolSchemes = `${string}://` | '';
|
|
30
|
-
type PortScheme = `:${number}` | '' | ':*';
|
|
31
|
-
/** Can actually be any string, but typed more explicitly to
|
|
32
|
-
* restrict the combined optional types of Source from collapsing to just bing `string` */
|
|
33
|
-
type HostNameScheme = `${string}.${string}` | `localhost`;
|
|
34
|
-
type HostSource = `${HostProtocolSchemes}${HostNameScheme}${PortScheme}`;
|
|
35
|
-
|
|
36
|
-
type CryptoSource = `${'nonce' | 'sha256' | 'sha384' | 'sha512'}-${string}`;
|
|
37
|
-
|
|
38
|
-
type BaseSource = 'self' | 'unsafe-eval' | 'unsafe-hashes' | 'unsafe-inline' | 'none';
|
|
39
|
-
|
|
40
|
-
export type Source = HostSource | SchemeSource | CryptoSource | BaseSource;
|
|
41
|
-
type Sources = Source[];
|
|
42
|
-
|
|
43
|
-
type ActionSource = 'strict-dynamic' | 'report-sample';
|
|
44
|
-
|
|
45
|
-
type FrameSource = HostSource | SchemeSource | 'self' | 'none';
|
|
46
|
-
|
|
47
|
-
type HttpDelineator = '/' | '?' | '#' | '\\';
|
|
48
|
-
type UriPath = `${HttpDelineator}${string}`;
|
|
49
|
-
|
|
50
|
-
export type CspDirectives = {
|
|
51
|
-
'child-src'?: Sources;
|
|
52
|
-
'default-src'?: Array<Source | ActionSource>;
|
|
53
|
-
'frame-src'?: Sources;
|
|
54
|
-
'worker-src'?: Sources;
|
|
55
|
-
'connect-src'?: Sources;
|
|
56
|
-
'font-src'?: Sources;
|
|
57
|
-
'img-src'?: Sources;
|
|
58
|
-
'manifest-src'?: Sources;
|
|
59
|
-
'media-src'?: Sources;
|
|
60
|
-
'object-src'?: Sources;
|
|
61
|
-
'prefetch-src'?: Sources;
|
|
62
|
-
'script-src'?: Array<Source | ActionSource>;
|
|
63
|
-
'script-src-elem'?: Sources;
|
|
64
|
-
'script-src-attr'?: Sources;
|
|
65
|
-
'style-src'?: Array<Source | ActionSource>;
|
|
66
|
-
'style-src-elem'?: Sources;
|
|
67
|
-
'style-src-attr'?: Sources;
|
|
68
|
-
'base-uri'?: Array<Source | ActionSource>;
|
|
69
|
-
sandbox?: Array<
|
|
70
|
-
| 'allow-downloads-without-user-activation'
|
|
71
|
-
| 'allow-forms'
|
|
72
|
-
| 'allow-modals'
|
|
73
|
-
| 'allow-orientation-lock'
|
|
74
|
-
| 'allow-pointer-lock'
|
|
75
|
-
| 'allow-popups'
|
|
76
|
-
| 'allow-popups-to-escape-sandbox'
|
|
77
|
-
| 'allow-presentation'
|
|
78
|
-
| 'allow-same-origin'
|
|
79
|
-
| 'allow-scripts'
|
|
80
|
-
| 'allow-storage-access-by-user-activation'
|
|
81
|
-
| 'allow-top-navigation'
|
|
82
|
-
| 'allow-top-navigation-by-user-activation'
|
|
83
|
-
>;
|
|
84
|
-
'form-action'?: Array<Source | ActionSource>;
|
|
85
|
-
'frame-ancestors'?: Array<HostSource | SchemeSource | FrameSource>;
|
|
86
|
-
'navigate-to'?: Array<Source | ActionSource>;
|
|
87
|
-
'report-uri'?: UriPath[];
|
|
88
|
-
'report-to'?: string[];
|
|
89
|
-
|
|
90
|
-
'require-trusted-types-for'?: Array<'script'>;
|
|
91
|
-
'trusted-types'?: Array<'none' | 'allow-duplicates' | '*' | string>;
|
|
92
|
-
'upgrade-insecure-requests'?: boolean;
|
|
93
|
-
|
|
94
|
-
/** @deprecated */
|
|
95
|
-
'require-sri-for'?: Array<'script' | 'style' | 'script style'>;
|
|
96
|
-
|
|
97
|
-
/** @deprecated */
|
|
98
|
-
'block-all-mixed-content'?: boolean;
|
|
99
|
-
|
|
100
|
-
/** @deprecated */
|
|
101
|
-
'plugin-types'?: Array<`${string}/${string}` | 'none'>;
|
|
102
|
-
|
|
103
|
-
/** @deprecated */
|
|
104
|
-
referrer?: Array<
|
|
105
|
-
| 'no-referrer'
|
|
106
|
-
| 'no-referrer-when-downgrade'
|
|
107
|
-
| 'origin'
|
|
108
|
-
| 'origin-when-cross-origin'
|
|
109
|
-
| 'same-origin'
|
|
110
|
-
| 'strict-origin'
|
|
111
|
-
| 'strict-origin-when-cross-origin'
|
|
112
|
-
| 'unsafe-url'
|
|
113
|
-
| 'none'
|
|
114
|
-
>;
|
|
115
|
-
};
|
package/types/endpoint.d.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { RequestEvent } from './hooks';
|
|
2
|
-
import { Either, JSONObject, JSONValue, MaybePromise, ResponseHeaders } from './helper';
|
|
3
|
-
|
|
4
|
-
type Body = JSONValue | Uint8Array | ReadableStream | import('stream').Readable;
|
|
5
|
-
|
|
6
|
-
export interface EndpointOutput<Output extends Body = Body> {
|
|
7
|
-
status?: number;
|
|
8
|
-
headers?: Headers | Partial<ResponseHeaders>;
|
|
9
|
-
body?: Output;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface Fallthrough {
|
|
13
|
-
fallthrough: true;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface RequestHandler<Output extends Body = Body> {
|
|
17
|
-
(event: RequestEvent): MaybePromise<
|
|
18
|
-
Either<Output extends Response ? Response : EndpointOutput<Output>, Fallthrough>
|
|
19
|
-
>;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export interface ShadowEndpointOutput<Output extends JSONObject = JSONObject> {
|
|
23
|
-
status?: number;
|
|
24
|
-
headers?: Partial<ResponseHeaders>;
|
|
25
|
-
body?: Output;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export interface ShadowRequestHandler<Output extends JSONObject = JSONObject> {
|
|
29
|
-
(event: RequestEvent): MaybePromise<Either<ShadowEndpointOutput<Output>, Fallthrough>>;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface ShadowData {
|
|
33
|
-
fallthrough?: boolean;
|
|
34
|
-
status?: number;
|
|
35
|
-
error?: Error;
|
|
36
|
-
redirect?: string;
|
|
37
|
-
cookies?: string[];
|
|
38
|
-
body?: JSONObject;
|
|
39
|
-
}
|
package/types/helper.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
type ToJSON = { toJSON(...args: any[]): Exclude<JSONValue, ToJSON> };
|
|
2
|
-
|
|
3
|
-
export type JSONObject = { [key: string]: JSONValue };
|
|
4
|
-
export type JSONValue = string | number | boolean | null | ToJSON | JSONValue[] | JSONObject;
|
|
5
|
-
|
|
6
|
-
/** `string[]` is only for set-cookie, everything else must be type of `string` */
|
|
7
|
-
export type ResponseHeaders = Record<string, string | number | string[]>;
|
|
8
|
-
|
|
9
|
-
// <-- Utility Types -->
|
|
10
|
-
type Only<T, U> = { [P in keyof T]: T[P] } & { [P in Exclude<keyof U, keyof T>]?: never };
|
|
11
|
-
|
|
12
|
-
export type Either<T, U> = Only<T, U> | Only<U, T>;
|
|
13
|
-
export type MaybePromise<T> = T | Promise<T>;
|
|
14
|
-
export type RecursiveRequired<T> = {
|
|
15
|
-
// Recursive implementation of TypeScript's Required utility type.
|
|
16
|
-
// Will recursively continue until it reaches primitive or union
|
|
17
|
-
// with a Function in it, except those commented below
|
|
18
|
-
[K in keyof T]-?: Extract<T[K], Function> extends never // If it does not have a Function type
|
|
19
|
-
? RecursiveRequired<T[K]> // recursively continue through.
|
|
20
|
-
: K extends 'vite' // If it reaches the 'vite' key
|
|
21
|
-
? Extract<T[K], Function> // only take the Function type.
|
|
22
|
-
: T[K]; // Use the exact type for everything else
|
|
23
|
-
};
|
package/types/hooks.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { MaybePromise } from './helper';
|
|
2
|
-
|
|
3
|
-
export type StrictBody = string | Uint8Array;
|
|
4
|
-
|
|
5
|
-
export interface RequestEvent {
|
|
6
|
-
request: Request;
|
|
7
|
-
url: URL;
|
|
8
|
-
params: Record<string, string>;
|
|
9
|
-
locals: App.Locals;
|
|
10
|
-
platform: Readonly<App.Platform>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface GetSession {
|
|
14
|
-
(event: RequestEvent): MaybePromise<App.Session>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface RequiredResolveOptions {
|
|
18
|
-
ssr: boolean;
|
|
19
|
-
transformPage: ({ html }: { html: string }) => string;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export type ResolveOptions = Partial<RequiredResolveOptions>;
|
|
23
|
-
|
|
24
|
-
export interface Handle {
|
|
25
|
-
(input: {
|
|
26
|
-
event: RequestEvent;
|
|
27
|
-
resolve(event: RequestEvent, opts?: ResolveOptions): MaybePromise<Response>;
|
|
28
|
-
}): MaybePromise<Response>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface HandleError {
|
|
32
|
-
(input: { error: Error & { frame?: string }; event: RequestEvent }): void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export interface ExternalFetch {
|
|
36
|
-
(req: Request): Promise<Response>;
|
|
37
|
-
}
|
package/types/page.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Fallthrough } from './endpoint';
|
|
2
|
-
import { Either, MaybePromise } from './helper';
|
|
3
|
-
|
|
4
|
-
export interface LoadInput<Params = Record<string, string>> {
|
|
5
|
-
url: URL;
|
|
6
|
-
params: Params;
|
|
7
|
-
props: Record<string, any>;
|
|
8
|
-
fetch(info: RequestInfo, init?: RequestInit): Promise<Response>;
|
|
9
|
-
session: App.Session;
|
|
10
|
-
stuff: Partial<App.Stuff>;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface ErrorLoadInput<Params = Record<string, string>> extends LoadInput<Params> {
|
|
14
|
-
status?: number;
|
|
15
|
-
error?: Error;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface LoadOutput<Props = Record<string, any>> {
|
|
19
|
-
status?: number;
|
|
20
|
-
error?: string | Error;
|
|
21
|
-
redirect?: string;
|
|
22
|
-
props?: Props;
|
|
23
|
-
stuff?: Partial<App.Stuff>;
|
|
24
|
-
maxage?: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface Load<Params = Record<string, string>, Props = Record<string, any>> {
|
|
28
|
-
(input: LoadInput<Params>): MaybePromise<Either<Fallthrough, LoadOutput<Props>>>;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export interface ErrorLoad<Params = Record<string, string>, Props = Record<string, any>> {
|
|
32
|
-
(input: ErrorLoadInput<Params>): MaybePromise<LoadOutput<Props>>;
|
|
33
|
-
}
|