@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.
@@ -1410,7 +1410,7 @@ async function respond$1(opts) {
1410
1410
  new Response(undefined, {
1411
1411
  status: loaded.loaded.status,
1412
1412
  headers: {
1413
- location: encodeURI(loaded.loaded.redirect)
1413
+ location: loaded.loaded.redirect
1414
1414
  }
1415
1415
  }),
1416
1416
  set_cookie_headers
@@ -1361,7 +1361,7 @@ async function respond$1(opts) {
1361
1361
  new Response(undefined, {
1362
1362
  status: loaded.loaded.status,
1363
1363
  headers: {
1364
- location: encodeURI(loaded.loaded.redirect)
1364
+ location: loaded.loaded.redirect
1365
1365
  }
1366
1366
  }),
1367
1367
  set_cookie_headers
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.235');
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.235'}\n`));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.235",
3
+ "version": "1.0.0-next.236",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -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
  }
@@ -1,19 +1,18 @@
1
1
  import { RequestEvent } from './hooks';
2
- import { JSONString, MaybePromise, ResponseHeaders, Either, Fallthrough } from './helper';
2
+ import { Either, JSONString, MaybePromise, ResponseHeaders } from './helper';
3
3
 
4
- type DefaultBody = JSONString | Uint8Array;
4
+ type Body = JSONString | Uint8Array | ReadableStream | import('stream').Readable;
5
5
 
6
- export interface EndpointOutput<Body extends DefaultBody = DefaultBody> {
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 RequestHandler<
13
- Locals = Record<string, any>,
14
- Output extends DefaultBody = DefaultBody
15
- > {
16
- (request: RequestEvent<Locals>): MaybePromise<
17
- Either<Response | EndpointOutput<Output>, Fallthrough>
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
- }
@@ -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 { InferValue, MaybePromise, Rec, Either, Fallthrough } from './helper';
1
+ import { Fallthrough } from './endpoint';
2
+ import { Either, InferValue, MaybePromise } from './helper';
2
3
 
3
4
  export interface LoadInput<
4
- PageParams extends Rec<string> = Rec<string>,
5
- Stuff extends Rec = Rec,
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 Rec<string> = Rec<string>,
17
- Stuff extends Rec = Rec,
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<Props extends Rec = Rec, Stuff extends Rec = Rec> {
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?: Rec;
35
- pageParams?: Rec<string>;
38
+ stuff?: Record<string, any>;
39
+ pageParams?: Record<string, string>;
36
40
  session?: any;
37
41
  }
38
42
 
39
43
  interface LoadOutputExtends {
40
- stuff?: Rec;
41
- props?: Rec;
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', Rec<string>>,
51
- InferValue<Input, 'stuff', Rec>,
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
- LoadOutput<InferValue<Output, 'props', Rec>, InferValue<Output, 'stuff', Rec>>,
57
- Fallthrough
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', Rec<string>>,
69
- InferValue<Input, 'stuff', Rec>,
75
+ InferValue<Input, 'pageParams', Record<string, string>>,
76
+ InferValue<Input, 'stuff', Record<string, any>>,
70
77
  InferValue<Input, 'session', any>
71
78
  >
72
- ): MaybePromise<LoadOutput<InferValue<Output, 'props', Rec>, InferValue<Output, 'stuff', Rec>>>;
79
+ ): MaybePromise<
80
+ LoadOutput<
81
+ InferValue<Output, 'props', Record<string, any>>,
82
+ InferValue<Output, 'stuff', Record<string, any>>
83
+ >
84
+ >;
73
85
  }