@sveltejs/kit 1.0.0-next.293 → 1.0.0-next.296
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 +4 -5
- package/assets/server/index.js +1 -1
- package/dist/chunks/index.js +1 -1
- package/dist/chunks/index2.js +23 -17
- package/dist/chunks/index3.js +1 -1
- package/dist/cli.js +2 -2
- package/package.json +1 -1
- package/types/ambient.d.ts +3 -8
- package/types/index.d.ts +3 -2
package/assets/client/start.js
CHANGED
|
@@ -864,11 +864,6 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
864
864
|
}
|
|
865
865
|
);
|
|
866
866
|
|
|
867
|
-
if (res.status === 204) {
|
|
868
|
-
// fallthrough
|
|
869
|
-
return;
|
|
870
|
-
}
|
|
871
|
-
|
|
872
867
|
if (res.ok) {
|
|
873
868
|
const redirect = res.headers.get('x-sveltekit-location');
|
|
874
869
|
|
|
@@ -880,6 +875,10 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
880
875
|
};
|
|
881
876
|
}
|
|
882
877
|
|
|
878
|
+
if (res.status === 204) {
|
|
879
|
+
// fallthrough
|
|
880
|
+
return;
|
|
881
|
+
}
|
|
883
882
|
props = await res.json();
|
|
884
883
|
} else {
|
|
885
884
|
status = res.status;
|
package/assets/server/index.js
CHANGED
|
@@ -1685,7 +1685,7 @@ async function load_node({
|
|
|
1685
1685
|
|
|
1686
1686
|
if (options.read) {
|
|
1687
1687
|
const type = is_asset
|
|
1688
|
-
? options.manifest.
|
|
1688
|
+
? options.manifest.mimeTypes[filename.slice(filename.lastIndexOf('.'))]
|
|
1689
1689
|
: 'text/html';
|
|
1690
1690
|
|
|
1691
1691
|
response = new Response(options.read(file), {
|
package/dist/chunks/index.js
CHANGED
|
@@ -61,8 +61,8 @@ async function create_plugin(config, cwd) {
|
|
|
61
61
|
manifest = {
|
|
62
62
|
appDir: config.kit.appDir,
|
|
63
63
|
assets: new Set(manifest_data.assets.map((asset) => asset.file)),
|
|
64
|
+
mimeTypes: get_mime_lookup(manifest_data),
|
|
64
65
|
_: {
|
|
65
|
-
mime: get_mime_lookup(manifest_data),
|
|
66
66
|
entry: {
|
|
67
67
|
file: `/@fs${runtime}/client/start.js`,
|
|
68
68
|
css: [],
|
package/dist/chunks/index2.js
CHANGED
|
@@ -56,7 +56,12 @@ async function build_service_worker(
|
|
|
56
56
|
fs__default.writeFileSync(
|
|
57
57
|
service_worker,
|
|
58
58
|
`
|
|
59
|
-
|
|
59
|
+
// TODO remove for 1.0
|
|
60
|
+
export const timestamp = {
|
|
61
|
+
toString: () => {
|
|
62
|
+
throw new Error('\`timestamp\` has been removed from $service-worker. Use \`version\` instead');
|
|
63
|
+
}
|
|
64
|
+
};
|
|
60
65
|
|
|
61
66
|
export const build = [
|
|
62
67
|
${Array.from(app_files)
|
|
@@ -75,6 +80,8 @@ async function build_service_worker(
|
|
|
75
80
|
.map((path) => s(normalize_path(path, config.kit.trailingSlash)))
|
|
76
81
|
.join(',\n\t\t\t\t')}
|
|
77
82
|
];
|
|
83
|
+
|
|
84
|
+
export const version = ${s(config.kit.version.name)};
|
|
78
85
|
`
|
|
79
86
|
.replace(/^\t{3}/gm, '')
|
|
80
87
|
.trim()
|
|
@@ -299,15 +306,6 @@ let read = null;
|
|
|
299
306
|
|
|
300
307
|
set_paths(${s(config.kit.paths)});
|
|
301
308
|
|
|
302
|
-
// this looks redundant, but the indirection allows us to access
|
|
303
|
-
// named imports without triggering Rollup's missing import detection
|
|
304
|
-
const get_hooks = hooks => ({
|
|
305
|
-
getSession: hooks.getSession || (() => ({})),
|
|
306
|
-
handle: hooks.handle || (({ event, resolve }) => resolve(event)),
|
|
307
|
-
handleError: hooks.handleError || (({ error }) => console.error(error.stack)),
|
|
308
|
-
externalFetch: hooks.externalFetch || fetch
|
|
309
|
-
});
|
|
310
|
-
|
|
311
309
|
let default_protocol = 'https';
|
|
312
310
|
|
|
313
311
|
// allow paths to be globally overridden
|
|
@@ -321,8 +319,6 @@ export function override(settings) {
|
|
|
321
319
|
|
|
322
320
|
export class Server {
|
|
323
321
|
constructor(manifest) {
|
|
324
|
-
const hooks = get_hooks(user_hooks);
|
|
325
|
-
|
|
326
322
|
this.options = {
|
|
327
323
|
amp: ${config.kit.amp},
|
|
328
324
|
csp: ${s(config.kit.csp)},
|
|
@@ -330,7 +326,7 @@ export class Server {
|
|
|
330
326
|
floc: ${config.kit.floc},
|
|
331
327
|
get_stack: error => String(error), // for security
|
|
332
328
|
handle_error: (error, event) => {
|
|
333
|
-
hooks.handleError({
|
|
329
|
+
this.options.hooks.handleError({
|
|
334
330
|
error,
|
|
335
331
|
event,
|
|
336
332
|
|
|
@@ -342,7 +338,7 @@ export class Server {
|
|
|
342
338
|
});
|
|
343
339
|
error.stack = this.options.get_stack(error);
|
|
344
340
|
},
|
|
345
|
-
hooks,
|
|
341
|
+
hooks: null,
|
|
346
342
|
hydrate: ${s(config.kit.browser.hydrate)},
|
|
347
343
|
manifest,
|
|
348
344
|
method_override: ${s(config.kit.methodOverride)},
|
|
@@ -359,9 +355,19 @@ export class Server {
|
|
|
359
355
|
};
|
|
360
356
|
}
|
|
361
357
|
|
|
362
|
-
respond(request, options = {}) {
|
|
358
|
+
async respond(request, options = {}) {
|
|
363
359
|
if (!(request instanceof Request)) {
|
|
364
|
-
throw new Error('The first argument to
|
|
360
|
+
throw new Error('The first argument to server.respond must be a Request object. See https://github.com/sveltejs/kit/pull/3384 for details');
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
if (!this.options.hooks) {
|
|
364
|
+
const module = await import(${s(hooks)});
|
|
365
|
+
this.options.hooks = {
|
|
366
|
+
getSession: module.getSession || (() => ({})),
|
|
367
|
+
handle: module.handle || (({ event, resolve }) => resolve(event)),
|
|
368
|
+
handleError: module.handleError || (({ error }) => console.error(error.stack)),
|
|
369
|
+
externalFetch: module.externalFetch || fetch
|
|
370
|
+
};
|
|
365
371
|
}
|
|
366
372
|
|
|
367
373
|
return respond(request, this.options, options);
|
|
@@ -424,7 +430,7 @@ async function build_server(
|
|
|
424
430
|
const relative = path__default.relative(config.kit.files.routes, resolved);
|
|
425
431
|
|
|
426
432
|
const name = relative.startsWith('..')
|
|
427
|
-
? posixify(path__default.join('entries/
|
|
433
|
+
? posixify(path__default.join('entries/fallbacks', path__default.basename(file)))
|
|
428
434
|
: posixify(path__default.join('entries/pages', relative));
|
|
429
435
|
input[name] = resolved;
|
|
430
436
|
});
|
package/dist/chunks/index3.js
CHANGED
|
@@ -58,8 +58,8 @@ function generate_manifest({ build_data, relative_path, routes, format = 'esm' }
|
|
|
58
58
|
return `{
|
|
59
59
|
appDir: ${s(build_data.app_dir)},
|
|
60
60
|
assets: new Set(${s(assets)}),
|
|
61
|
+
mimeTypes: ${s(get_mime_lookup(build_data.manifest_data))},
|
|
61
62
|
_: {
|
|
62
|
-
mime: ${s(get_mime_lookup(build_data.manifest_data))},
|
|
63
63
|
entry: ${s(build_data.client.entry)},
|
|
64
64
|
nodes: [
|
|
65
65
|
${Array.from(bundled_nodes.values()).map(node => importer(node.path)).join(',\n\t\t\t\t')}
|
package/dist/cli.js
CHANGED
|
@@ -870,7 +870,7 @@ async function launch(port, https) {
|
|
|
870
870
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
873
|
+
const prog = sade('svelte-kit').version('1.0.0-next.296');
|
|
874
874
|
|
|
875
875
|
prog
|
|
876
876
|
.command('dev')
|
|
@@ -1043,7 +1043,7 @@ async function check_port(port) {
|
|
|
1043
1043
|
function welcome({ port, host, https, open, loose, allow, cwd }) {
|
|
1044
1044
|
if (open) launch(port, https);
|
|
1045
1045
|
|
|
1046
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1046
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.296'}\n`));
|
|
1047
1047
|
|
|
1048
1048
|
const protocol = https ? 'https:' : 'http:';
|
|
1049
1049
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/package.json
CHANGED
package/types/ambient.d.ts
CHANGED
|
@@ -207,14 +207,9 @@ declare module '$app/stores' {
|
|
|
207
207
|
export const updated: Readable<boolean> & { check: () => boolean };
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
/**
|
|
211
|
-
* This is a simple alias to `src/lib`, or whatever directory is specified as [`config.kit.files.lib`](/docs/configuration#files). It allows you to access common components and utility modules without `../../../../` nonsense.
|
|
212
|
-
*/
|
|
213
|
-
declare module '$lib' {}
|
|
214
|
-
|
|
215
210
|
/**
|
|
216
211
|
* ```ts
|
|
217
|
-
* import { build, files,
|
|
212
|
+
* import { build, files, prerendered, version } from '$service-worker';
|
|
218
213
|
* ```
|
|
219
214
|
*
|
|
220
215
|
* This module is only available to [service workers](/docs/service-workers).
|
|
@@ -233,9 +228,9 @@ declare module '$service-worker' {
|
|
|
233
228
|
*/
|
|
234
229
|
export const prerendered: string[];
|
|
235
230
|
/**
|
|
236
|
-
*
|
|
231
|
+
* See [`config.kit.version`](/docs/configuration#version). It's useful for generating unique cache names inside your service worker, so that a later deployment of your app can invalidate old caches.
|
|
237
232
|
*/
|
|
238
|
-
export const
|
|
233
|
+
export const version: string;
|
|
239
234
|
}
|
|
240
235
|
|
|
241
236
|
declare module '@sveltejs/kit/hooks' {
|
package/types/index.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ import { SSRNodeLoader, SSRRoute, ValidatedConfig } from './internal';
|
|
|
28
28
|
|
|
29
29
|
export interface Adapter {
|
|
30
30
|
name: string;
|
|
31
|
-
adapt(builder: Builder):
|
|
31
|
+
adapt(builder: Builder): MaybePromise<void>;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export interface Builder {
|
|
@@ -241,9 +241,10 @@ export class Server {
|
|
|
241
241
|
export interface SSRManifest {
|
|
242
242
|
appDir: string;
|
|
243
243
|
assets: Set<string>;
|
|
244
|
+
mimeTypes: Record<string, string>;
|
|
245
|
+
|
|
244
246
|
/** private fields */
|
|
245
247
|
_: {
|
|
246
|
-
mime: Record<string, string>;
|
|
247
248
|
entry: {
|
|
248
249
|
file: string;
|
|
249
250
|
js: string[];
|