@sveltejs/kit 1.0.0-next.286 → 1.0.0-next.289
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 +31 -19
- package/assets/server/index.js +62 -36
- package/dist/chunks/amp_hook.js +1 -1
- package/dist/chunks/index.js +6 -5
- package/dist/chunks/index2.js +543 -728
- package/dist/chunks/index3.js +99 -622
- package/dist/chunks/index4.js +871 -96
- package/dist/chunks/index5.js +120 -831
- package/dist/chunks/index6.js +15546 -132
- package/dist/chunks/index7.js +3746 -15123
- package/dist/chunks/tsconfig.js +1032 -0
- package/dist/cli.js +6 -6
- package/dist/install-fetch.js +2 -2
- package/package.json +13 -4
- package/types/ambient.d.ts +5 -6
- package/types/index.d.ts +26 -9
- package/types/internal.d.ts +7 -3
- package/types/private.d.ts +19 -13
- package/dist/chunks/index8.js +0 -4207
package/dist/cli.js
CHANGED
|
@@ -998,7 +998,7 @@ async function launch(port, https) {
|
|
|
998
998
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
999
999
|
}
|
|
1000
1000
|
|
|
1001
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
1001
|
+
const prog = sade('svelte-kit').version('1.0.0-next.289');
|
|
1002
1002
|
|
|
1003
1003
|
prog
|
|
1004
1004
|
.command('dev')
|
|
@@ -1050,7 +1050,7 @@ prog
|
|
|
1050
1050
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
|
1051
1051
|
const config = await load_config();
|
|
1052
1052
|
|
|
1053
|
-
const { build } = await import('./chunks/
|
|
1053
|
+
const { build } = await import('./chunks/index2.js');
|
|
1054
1054
|
const build_data = await build(config);
|
|
1055
1055
|
|
|
1056
1056
|
console.log(
|
|
@@ -1058,7 +1058,7 @@ prog
|
|
|
1058
1058
|
);
|
|
1059
1059
|
|
|
1060
1060
|
if (config.kit.adapter) {
|
|
1061
|
-
const { adapt } = await import('./chunks/
|
|
1061
|
+
const { adapt } = await import('./chunks/index4.js');
|
|
1062
1062
|
await adapt(config, build_data, { verbose });
|
|
1063
1063
|
|
|
1064
1064
|
// this is necessary to close any open db connections, etc
|
|
@@ -1093,7 +1093,7 @@ prog
|
|
|
1093
1093
|
process.env.NODE_ENV = process.env.NODE_ENV || 'production';
|
|
1094
1094
|
const config = await load_config();
|
|
1095
1095
|
|
|
1096
|
-
const { preview } = await import('./chunks/
|
|
1096
|
+
const { preview } = await import('./chunks/index5.js');
|
|
1097
1097
|
|
|
1098
1098
|
await preview({ port, host, config, https });
|
|
1099
1099
|
|
|
@@ -1111,7 +1111,7 @@ prog
|
|
|
1111
1111
|
try {
|
|
1112
1112
|
const config = await load_config();
|
|
1113
1113
|
|
|
1114
|
-
const { make_package } = await import('./chunks/
|
|
1114
|
+
const { make_package } = await import('./chunks/index6.js');
|
|
1115
1115
|
|
|
1116
1116
|
await make_package(config);
|
|
1117
1117
|
} catch (error) {
|
|
@@ -1156,7 +1156,7 @@ async function check_port(port) {
|
|
|
1156
1156
|
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
1157
1157
|
if (open) launch(port, https);
|
|
1158
1158
|
|
|
1159
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1159
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.289'}\n`));
|
|
1160
1160
|
|
|
1161
1161
|
const protocol = https ? 'https:' : 'http:';
|
|
1162
1162
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/dist/install-fetch.js
CHANGED
|
@@ -6490,7 +6490,7 @@ function fixResponseChunkedTransferBadEnding(request, errorCallback) {
|
|
|
6490
6490
|
}
|
|
6491
6491
|
|
|
6492
6492
|
// exported for dev/preview and node environments
|
|
6493
|
-
function
|
|
6493
|
+
function installFetch() {
|
|
6494
6494
|
Object.defineProperties(globalThis, {
|
|
6495
6495
|
fetch: {
|
|
6496
6496
|
enumerable: true,
|
|
@@ -6515,4 +6515,4 @@ function __fetch_polyfill() {
|
|
|
6515
6515
|
});
|
|
6516
6516
|
}
|
|
6517
6517
|
|
|
6518
|
-
export { FormData as F,
|
|
6518
|
+
export { FormData as F, File as a, commonjsGlobal as c, installFetch };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/kit",
|
|
3
|
-
"version": "1.0.0-next.
|
|
3
|
+
"version": "1.0.0-next.289",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"vite": "^2.8.0"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@playwright/test": "^1.
|
|
18
|
+
"@playwright/test": "^1.19.1",
|
|
19
19
|
"@rollup/plugin-replace": "^4.0.0",
|
|
20
20
|
"@types/amphtml-validator": "^1.0.1",
|
|
21
21
|
"@types/cookie": "^0.4.1",
|
|
@@ -79,11 +79,20 @@
|
|
|
79
79
|
"build": "rollup -c && node scripts/cp.js src/runtime/components assets/components && npm run types",
|
|
80
80
|
"dev": "rollup -cw",
|
|
81
81
|
"lint": "eslint --ignore-path .gitignore --ignore-pattern \"src/packaging/test/**\" \"{src,test}/**/*.{ts,mjs,js,svelte}\" && npm run check-format",
|
|
82
|
-
"check": "tsc &&
|
|
82
|
+
"check": "tsc && npm run check:integration && npm run check:prerendering",
|
|
83
|
+
"check:integration": "npm run check:integration:amp && npm run check:integration:basics && npm run check:integration:options && npm run check:integration:options-2",
|
|
84
|
+
"check:integration:amp": "cd test/apps/amp && pnpm check",
|
|
85
|
+
"check:integration:basics": "cd test/apps/basics && pnpm check",
|
|
86
|
+
"check:integration:options": "cd test/apps/options && pnpm check",
|
|
87
|
+
"check:integration:options-2": "cd test/apps/options-2 && pnpm check",
|
|
88
|
+
"check:prerendering": "npm run check:prerendering:basics && npm run check:prerendering:options",
|
|
89
|
+
"check:prerendering:basics": "cd test/prerendering/basics && pnpm check",
|
|
90
|
+
"check:prerendering:options": "cd test/prerendering/options && pnpm check",
|
|
83
91
|
"format": "npm run check-format -- --write",
|
|
84
92
|
"check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
|
|
85
|
-
"test": "npm run test:unit && npm run test:packaging && npm run test:prerendering && npm run test:integration",
|
|
93
|
+
"test": "npm run test:unit && npm run test:typings && npm run test:packaging && npm run test:prerendering && npm run test:integration",
|
|
86
94
|
"test:unit": "uvu src \"(spec\\.js|test[\\\\/]index\\.js)\" -i packaging",
|
|
95
|
+
"test:typings": "tsc --project test/typings",
|
|
87
96
|
"test:prerendering": "pnpm test:prerendering:basics && pnpm test:prerendering:options",
|
|
88
97
|
"test:prerendering:basics": "cd test/prerendering/basics && pnpm test",
|
|
89
98
|
"test:prerendering:options": "cd test/prerendering/options && pnpm test",
|
package/types/ambient.d.ts
CHANGED
|
@@ -125,7 +125,7 @@ declare module '$app/navigation' {
|
|
|
125
125
|
* If no argument is given, all routes will be fetched, otherwise you can specify routes by any matching pathname
|
|
126
126
|
* such as `/about` (to match `src/routes/about.svelte`) or `/blog/*` (to match `src/routes/blog/[slug].svelte`).
|
|
127
127
|
*
|
|
128
|
-
* Unlike prefetch, this won't call
|
|
128
|
+
* Unlike prefetch, this won't call load for individual pages.
|
|
129
129
|
* Returns a Promise that resolves when the routes have been prefetched.
|
|
130
130
|
*/
|
|
131
131
|
export function prefetchRoutes(routes?: string[]): Promise<void>;
|
|
@@ -281,11 +281,10 @@ declare module '@sveltejs/kit/hooks' {
|
|
|
281
281
|
* A polyfill for `fetch` and its related interfaces, used by adapters for environments that don't provide a native implementation.
|
|
282
282
|
*/
|
|
283
283
|
declare module '@sveltejs/kit/install-fetch' {
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
export { fetch, Headers, Request, Response };
|
|
284
|
+
/**
|
|
285
|
+
* Make `fetch`, `Headers`, `Request` and `Response` available as globals, via `node-fetch`
|
|
286
|
+
*/
|
|
287
|
+
export function installFetch(): void;
|
|
289
288
|
}
|
|
290
289
|
|
|
291
290
|
/**
|
package/types/index.d.ts
CHANGED
|
@@ -9,7 +9,6 @@ import {
|
|
|
9
9
|
Builder,
|
|
10
10
|
CspDirectives,
|
|
11
11
|
Either,
|
|
12
|
-
EndpointOutput,
|
|
13
12
|
ErrorLoadInput,
|
|
14
13
|
Fallthrough,
|
|
15
14
|
LoadInput,
|
|
@@ -18,6 +17,7 @@ import {
|
|
|
18
17
|
PrerenderOnErrorValue,
|
|
19
18
|
RequestEvent,
|
|
20
19
|
ResolveOptions,
|
|
20
|
+
ResponseHeaders,
|
|
21
21
|
TrailingSlash
|
|
22
22
|
} from './private';
|
|
23
23
|
|
|
@@ -110,10 +110,20 @@ export interface HandleError {
|
|
|
110
110
|
(input: { error: Error & { frame?: string }; event: RequestEvent }): void;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
+
/**
|
|
114
|
+
* The type of a `load` function exported from `<script context="module">` in a page or layout.
|
|
115
|
+
*
|
|
116
|
+
* Note that you can use [generated types](/docs/types#generated-types) instead of manually specifying the Params generic argument.
|
|
117
|
+
*/
|
|
113
118
|
export interface Load<Params = Record<string, string>, Props = Record<string, any>> {
|
|
114
119
|
(input: LoadInput<Params>): MaybePromise<Either<Fallthrough, LoadOutput<Props>>>;
|
|
115
120
|
}
|
|
116
121
|
|
|
122
|
+
export interface Navigation {
|
|
123
|
+
from: URL;
|
|
124
|
+
to: URL;
|
|
125
|
+
}
|
|
126
|
+
|
|
117
127
|
export interface Page<Params extends Record<string, string> = Record<string, string>> {
|
|
118
128
|
url: URL;
|
|
119
129
|
params: Params;
|
|
@@ -122,19 +132,26 @@ export interface Page<Params extends Record<string, string> = Record<string, str
|
|
|
122
132
|
error: Error | null;
|
|
123
133
|
}
|
|
124
134
|
|
|
125
|
-
export interface Navigation {
|
|
126
|
-
from: URL;
|
|
127
|
-
to: URL;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
135
|
/**
|
|
131
136
|
* A function exported from an endpoint that corresponds to an
|
|
132
137
|
* HTTP verb (`get`, `put`, `patch`, etc) and handles requests with
|
|
133
138
|
* that method. Note that since 'delete' is a reserved word in
|
|
134
139
|
* JavaScript, delete handles are called `del` instead.
|
|
140
|
+
*
|
|
141
|
+
* Note that you can use [generated types](/docs/types#generated)
|
|
142
|
+
* instead of manually specifying the `Params` generic argument.
|
|
135
143
|
*/
|
|
136
144
|
export interface RequestHandler<Params = Record<string, string>, Output extends Body = Body> {
|
|
137
|
-
(event: RequestEvent<Params>):
|
|
138
|
-
Either<Output extends Response ? Response : EndpointOutput<Output>, Fallthrough>
|
|
139
|
-
>;
|
|
145
|
+
(event: RequestEvent<Params>): RequestHandlerOutput<Output>;
|
|
140
146
|
}
|
|
147
|
+
|
|
148
|
+
export type RequestHandlerOutput<Output extends Body = Body> = MaybePromise<
|
|
149
|
+
Either<
|
|
150
|
+
{
|
|
151
|
+
status?: number;
|
|
152
|
+
headers?: Headers | Partial<ResponseHeaders>;
|
|
153
|
+
body?: Output;
|
|
154
|
+
},
|
|
155
|
+
Fallthrough
|
|
156
|
+
>
|
|
157
|
+
>;
|
package/types/internal.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { OutputAsset, OutputChunk } from 'rollup';
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
Load,
|
|
3
|
+
Config,
|
|
5
4
|
ExternalFetch,
|
|
6
5
|
GetSession,
|
|
7
6
|
Handle,
|
|
8
7
|
HandleError,
|
|
9
|
-
|
|
8
|
+
Load,
|
|
9
|
+
RequestHandler
|
|
10
10
|
} from './index';
|
|
11
11
|
import {
|
|
12
12
|
Either,
|
|
@@ -139,6 +139,10 @@ export interface PageData {
|
|
|
139
139
|
b: string[];
|
|
140
140
|
}
|
|
141
141
|
|
|
142
|
+
export type PayloadScriptAttributes =
|
|
143
|
+
| { type: 'data'; url: string; body?: string }
|
|
144
|
+
| { type: 'props' };
|
|
145
|
+
|
|
142
146
|
export interface PrerenderDependency {
|
|
143
147
|
response: Response;
|
|
144
148
|
body: null | string | Uint8Array;
|
package/types/private.d.ts
CHANGED
|
@@ -126,7 +126,7 @@ export namespace Csp {
|
|
|
126
126
|
type UriPath = `${HttpDelineator}${string}`;
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
export
|
|
129
|
+
export interface CspDirectives {
|
|
130
130
|
'child-src'?: Csp.Sources;
|
|
131
131
|
'default-src'?: Array<Csp.Source | Csp.ActionSource>;
|
|
132
132
|
'frame-src'?: Csp.Sources;
|
|
@@ -191,16 +191,10 @@ export type CspDirectives = {
|
|
|
191
191
|
| 'unsafe-url'
|
|
192
192
|
| 'none'
|
|
193
193
|
>;
|
|
194
|
-
}
|
|
194
|
+
}
|
|
195
195
|
|
|
196
196
|
export type Either<T, U> = Only<T, U> | Only<U, T>;
|
|
197
197
|
|
|
198
|
-
export interface EndpointOutput<Output extends Body = Body> {
|
|
199
|
-
status?: number;
|
|
200
|
-
headers?: Headers | Partial<ResponseHeaders>;
|
|
201
|
-
body?: Output;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
198
|
export interface ErrorLoadInput<Params = Record<string, string>> extends LoadInput<Params> {
|
|
205
199
|
status?: number;
|
|
206
200
|
error?: Error;
|
|
@@ -212,9 +206,19 @@ export interface Fallthrough {
|
|
|
212
206
|
|
|
213
207
|
export type HttpMethod = 'get' | 'head' | 'post' | 'put' | 'delete' | 'patch';
|
|
214
208
|
|
|
215
|
-
export
|
|
209
|
+
export interface JSONObject {
|
|
210
|
+
[key: string]: JSONValue;
|
|
211
|
+
}
|
|
216
212
|
|
|
217
|
-
export type JSONValue =
|
|
213
|
+
export type JSONValue =
|
|
214
|
+
| string
|
|
215
|
+
| number
|
|
216
|
+
| boolean
|
|
217
|
+
| null
|
|
218
|
+
| undefined
|
|
219
|
+
| ToJSON
|
|
220
|
+
| JSONValue[]
|
|
221
|
+
| JSONObject;
|
|
218
222
|
|
|
219
223
|
export interface LoadInput<Params = Record<string, string>> {
|
|
220
224
|
url: URL;
|
|
@@ -296,10 +300,10 @@ export interface RequestOptions {
|
|
|
296
300
|
platform?: App.Platform;
|
|
297
301
|
}
|
|
298
302
|
|
|
299
|
-
export
|
|
303
|
+
export interface ResolveOptions {
|
|
300
304
|
ssr?: boolean;
|
|
301
305
|
transformPage?: ({ html }: { html: string }) => MaybePromise<string>;
|
|
302
|
-
}
|
|
306
|
+
}
|
|
303
307
|
|
|
304
308
|
/** `string[]` is only for set-cookie, everything else must be type of `string` */
|
|
305
309
|
export type ResponseHeaders = Record<string, string | number | string[]>;
|
|
@@ -338,6 +342,8 @@ export interface SSRManifest {
|
|
|
338
342
|
};
|
|
339
343
|
}
|
|
340
344
|
|
|
341
|
-
export
|
|
345
|
+
export interface ToJSON {
|
|
346
|
+
toJSON(...args: any[]): Exclude<JSONValue, ToJSON>;
|
|
347
|
+
}
|
|
342
348
|
|
|
343
349
|
export type TrailingSlash = 'never' | 'always' | 'ignore';
|