@sveltejs/kit 1.0.0-next.235 → 1.0.0-next.236
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/server/index.js +1 -1
- package/dist/chunks/index.js +1 -1
- package/dist/cli.js +2 -2
- package/package.json +1 -1
- package/types/ambient-modules.d.ts +2 -0
- package/types/endpoint.d.ts +9 -10
- package/types/helper.d.ts +4 -24
- package/types/internal.d.ts +2 -4
- package/types/page.d.ts +29 -17
package/assets/server/index.js
CHANGED
package/dist/chunks/index.js
CHANGED
package/dist/cli.js
CHANGED
|
@@ -933,7 +933,7 @@ async function launch(port, https) {
|
|
|
933
933
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
934
934
|
}
|
|
935
935
|
|
|
936
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
936
|
+
const prog = sade('svelte-kit').version('1.0.0-next.236');
|
|
937
937
|
|
|
938
938
|
prog
|
|
939
939
|
.command('dev')
|
|
@@ -1085,7 +1085,7 @@ async function check_port(port) {
|
|
|
1085
1085
|
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
1086
1086
|
if (open) launch(port, https);
|
|
1087
1087
|
|
|
1088
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1088
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.236'}\n`));
|
|
1089
1089
|
|
|
1090
1090
|
const protocol = https ? 'https:' : 'http:';
|
|
1091
1091
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/package.json
CHANGED
|
@@ -195,5 +195,7 @@ declare module '@sveltejs/kit/node' {
|
|
|
195
195
|
declare module '@sveltejs/kit/install-fetch' {
|
|
196
196
|
import fetch, { Headers, Request, Response } from 'node-fetch';
|
|
197
197
|
|
|
198
|
+
export function __fetch_polyfill(): void;
|
|
199
|
+
|
|
198
200
|
export { fetch, Headers, Request, Response };
|
|
199
201
|
}
|
package/types/endpoint.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { RequestEvent } from './hooks';
|
|
2
|
-
import { JSONString, MaybePromise, ResponseHeaders
|
|
2
|
+
import { Either, JSONString, MaybePromise, ResponseHeaders } from './helper';
|
|
3
3
|
|
|
4
|
-
type
|
|
4
|
+
type Body = JSONString | Uint8Array | ReadableStream | import('stream').Readable;
|
|
5
5
|
|
|
6
|
-
export interface EndpointOutput
|
|
6
|
+
export interface EndpointOutput {
|
|
7
7
|
status?: number;
|
|
8
8
|
headers?: Headers | Partial<ResponseHeaders>;
|
|
9
9
|
body?: Body;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export interface
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>;
|
|
12
|
+
export interface Fallthrough {
|
|
13
|
+
fallthrough: true;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface RequestHandler<Locals = Record<string, any>> {
|
|
17
|
+
(event: RequestEvent<Locals>): MaybePromise<Either<Response | EndpointOutput, Fallthrough>>;
|
|
19
18
|
}
|
package/types/helper.d.ts
CHANGED
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
interface ReadOnlyFormData {
|
|
2
|
-
get(key: string): string | null;
|
|
3
|
-
getAll(key: string): string[];
|
|
4
|
-
has(key: string): boolean;
|
|
5
|
-
entries(): Generator<[string, string], void>;
|
|
6
|
-
keys(): Generator<string, void>;
|
|
7
|
-
values(): Generator<string, void>;
|
|
8
|
-
[Symbol.iterator](): Generator<[string, string], void>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
1
|
type ToJSON = { toJSON(...args: any[]): JSONValue };
|
|
12
2
|
type JSONValue = Exclude<JSONString, ToJSON>;
|
|
13
3
|
export type JSONString =
|
|
@@ -22,12 +12,14 @@ export type JSONString =
|
|
|
22
12
|
/** `string[]` is only for set-cookie, everything else must be type of `string` */
|
|
23
13
|
export type ResponseHeaders = Record<string, string | string[]>;
|
|
24
14
|
|
|
25
|
-
// Utility Types
|
|
15
|
+
// <-- Utility Types -->
|
|
16
|
+
type Only<T, U> = { [P in keyof T]: T[P] } & { [P in keyof U]?: never };
|
|
17
|
+
|
|
18
|
+
export type Either<T, U> = Only<T, U> | Only<U, T>;
|
|
26
19
|
export type InferValue<T, Key extends keyof T, Default> = T extends Record<Key, infer Val>
|
|
27
20
|
? Val
|
|
28
21
|
: Default;
|
|
29
22
|
export type MaybePromise<T> = T | Promise<T>;
|
|
30
|
-
export type Rec<T = any> = Record<string, T>;
|
|
31
23
|
export type RecursiveRequired<T> = {
|
|
32
24
|
// Recursive implementation of TypeScript's Required utility type.
|
|
33
25
|
// Will recursively continue until it reaches primitive or union
|
|
@@ -38,15 +30,3 @@ export type RecursiveRequired<T> = {
|
|
|
38
30
|
? Extract<T[K], Function> // only take the Function type.
|
|
39
31
|
: T[K]; // Use the exact type for everything else
|
|
40
32
|
};
|
|
41
|
-
|
|
42
|
-
type Only<T, U> = {
|
|
43
|
-
[P in keyof T]: T[P];
|
|
44
|
-
} & {
|
|
45
|
-
[P in keyof U]?: never;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type Either<T, U> = Only<T, U> | Only<U, T>;
|
|
49
|
-
|
|
50
|
-
export interface Fallthrough {
|
|
51
|
-
fallthrough: true;
|
|
52
|
-
}
|
package/types/internal.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { OutputAsset, OutputChunk } from 'rollup';
|
|
2
|
-
import { RequestHandler } from './endpoint';
|
|
3
2
|
import { InternalApp, SSRManifest } from './app';
|
|
3
|
+
import { Fallthrough, RequestHandler } from './endpoint';
|
|
4
|
+
import { Either } from './helper';
|
|
4
5
|
import { ExternalFetch, GetSession, HandleError, InternalHandle, RequestEvent } from './hooks';
|
|
5
6
|
import { Load } from './page';
|
|
6
|
-
import { Either, Fallthrough } from './helper';
|
|
7
|
-
|
|
8
|
-
type PageId = string;
|
|
9
7
|
|
|
10
8
|
export interface PrerenderOptions {
|
|
11
9
|
fallback?: string;
|
package/types/page.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Fallthrough } from './endpoint';
|
|
2
|
+
import { Either, InferValue, MaybePromise } from './helper';
|
|
2
3
|
|
|
3
4
|
export interface LoadInput<
|
|
4
|
-
PageParams extends
|
|
5
|
-
Stuff extends
|
|
5
|
+
PageParams extends Record<string, string> = Record<string, string>,
|
|
6
|
+
Stuff extends Record<string, any> = Record<string, any>,
|
|
6
7
|
Session = any
|
|
7
8
|
> {
|
|
8
9
|
url: URL;
|
|
@@ -13,15 +14,18 @@ export interface LoadInput<
|
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export interface ErrorLoadInput<
|
|
16
|
-
PageParams extends
|
|
17
|
-
Stuff extends
|
|
17
|
+
PageParams extends Record<string, string> = Record<string, string>,
|
|
18
|
+
Stuff extends Record<string, any> = Record<string, any>,
|
|
18
19
|
Session = any
|
|
19
20
|
> extends LoadInput<PageParams, Stuff, Session> {
|
|
20
21
|
status?: number;
|
|
21
22
|
error?: Error;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
|
-
export interface LoadOutput<
|
|
25
|
+
export interface LoadOutput<
|
|
26
|
+
Props extends Record<string, any> = Record<string, any>,
|
|
27
|
+
Stuff extends Record<string, any> = Record<string, any>
|
|
28
|
+
> {
|
|
25
29
|
status?: number;
|
|
26
30
|
error?: string | Error;
|
|
27
31
|
redirect?: string;
|
|
@@ -31,14 +35,14 @@ export interface LoadOutput<Props extends Rec = Rec, Stuff extends Rec = Rec> {
|
|
|
31
35
|
}
|
|
32
36
|
|
|
33
37
|
interface LoadInputExtends {
|
|
34
|
-
stuff?:
|
|
35
|
-
pageParams?:
|
|
38
|
+
stuff?: Record<string, any>;
|
|
39
|
+
pageParams?: Record<string, string>;
|
|
36
40
|
session?: any;
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
interface LoadOutputExtends {
|
|
40
|
-
stuff?:
|
|
41
|
-
props?:
|
|
44
|
+
stuff?: Record<string, any>;
|
|
45
|
+
props?: Record<string, any>;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
48
|
export interface Load<
|
|
@@ -47,14 +51,17 @@ export interface Load<
|
|
|
47
51
|
> {
|
|
48
52
|
(
|
|
49
53
|
input: LoadInput<
|
|
50
|
-
InferValue<Input, 'pageParams',
|
|
51
|
-
InferValue<Input, 'stuff',
|
|
54
|
+
InferValue<Input, 'pageParams', Record<string, string>>,
|
|
55
|
+
InferValue<Input, 'stuff', Record<string, any>>,
|
|
52
56
|
InferValue<Input, 'session', any>
|
|
53
57
|
>
|
|
54
58
|
): MaybePromise<
|
|
55
59
|
Either<
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
Fallthrough,
|
|
61
|
+
LoadOutput<
|
|
62
|
+
InferValue<Output, 'props', Record<string, any>>,
|
|
63
|
+
InferValue<Output, 'stuff', Record<string, any>>
|
|
64
|
+
>
|
|
58
65
|
>
|
|
59
66
|
>;
|
|
60
67
|
}
|
|
@@ -65,9 +72,14 @@ export interface ErrorLoad<
|
|
|
65
72
|
> {
|
|
66
73
|
(
|
|
67
74
|
input: ErrorLoadInput<
|
|
68
|
-
InferValue<Input, 'pageParams',
|
|
69
|
-
InferValue<Input, 'stuff',
|
|
75
|
+
InferValue<Input, 'pageParams', Record<string, string>>,
|
|
76
|
+
InferValue<Input, 'stuff', Record<string, any>>,
|
|
70
77
|
InferValue<Input, 'session', any>
|
|
71
78
|
>
|
|
72
|
-
): MaybePromise<
|
|
79
|
+
): MaybePromise<
|
|
80
|
+
LoadOutput<
|
|
81
|
+
InferValue<Output, 'props', Record<string, any>>,
|
|
82
|
+
InferValue<Output, 'stuff', Record<string, any>>
|
|
83
|
+
>
|
|
84
|
+
>;
|
|
73
85
|
}
|