@sveltejs/kit 1.5.7 → 1.6.0
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/package.json +1 -1
- package/src/core/postbuild/analyse.js +1 -0
- package/src/exports/vite/build/utils.js +1 -1
- package/src/exports/vite/index.js +7 -3
- package/src/internal.d.ts +1 -1
- package/src/runtime/app/paths.js +1 -1
- package/src/runtime/client/client.js +1 -1
- package/src/runtime/client/utils.js +1 -1
- package/src/runtime/server/endpoint.js +1 -1
- package/src/runtime/server/fetch.js +1 -1
- package/src/runtime/server/page/render.js +1 -1
- package/src/runtime/server/respond.js +1 -1
- package/src/runtime/server/utils.js +1 -1
- package/src/runtime/shared.js +1 -1
- package/src/utils/exports.js +1 -0
- package/types/private.d.ts +1 -1
package/package.json
CHANGED
|
@@ -87,7 +87,7 @@ export function assets_base(config) {
|
|
|
87
87
|
return (config.paths.assets || config.paths.base || '.') + '/';
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
const method_names = new Set(['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH']);
|
|
90
|
+
const method_names = new Set(['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH', 'OPTIONS']);
|
|
91
91
|
|
|
92
92
|
// If we'd written this in TypeScript, it could be easy...
|
|
93
93
|
/**
|
|
@@ -240,7 +240,11 @@ function kit({ svelte_config }) {
|
|
|
240
240
|
// Ignore all siblings of config.kit.outDir/generated
|
|
241
241
|
`${posixify(kit.outDir)}/!(generated)`
|
|
242
242
|
]
|
|
243
|
-
}
|
|
243
|
+
},
|
|
244
|
+
cors: { preflightContinue: true }
|
|
245
|
+
},
|
|
246
|
+
preview: {
|
|
247
|
+
cors: { preflightContinue: true }
|
|
244
248
|
},
|
|
245
249
|
optimizeDeps: {
|
|
246
250
|
exclude: [
|
|
@@ -320,7 +324,7 @@ function kit({ svelte_config }) {
|
|
|
320
324
|
|
|
321
325
|
async resolveId(id) {
|
|
322
326
|
// treat $env/static/[public|private] as virtual
|
|
323
|
-
if (id.startsWith('$env/') || id === '
|
|
327
|
+
if (id.startsWith('$env/') || id === '__sveltekit/paths' || id === '$service-worker') {
|
|
324
328
|
return `\0${id}`;
|
|
325
329
|
}
|
|
326
330
|
},
|
|
@@ -360,7 +364,7 @@ function kit({ svelte_config }) {
|
|
|
360
364
|
return create_service_worker_module(svelte_config);
|
|
361
365
|
// for internal use only. it's published as $app/paths externally
|
|
362
366
|
// we use this alias so that we won't collide with user aliases
|
|
363
|
-
case '\
|
|
367
|
+
case '\0__sveltekit/paths':
|
|
364
368
|
const { assets, base } = svelte_config.kit.paths;
|
|
365
369
|
return `export const base = ${s(base)};
|
|
366
370
|
export let assets = ${assets ? s(assets) : 'base'};
|
package/src/internal.d.ts
CHANGED
package/src/runtime/app/paths.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { base, assets } from '
|
|
1
|
+
export { base, assets } from '__sveltekit/paths';
|
|
@@ -27,7 +27,7 @@ import { parse } from './parse.js';
|
|
|
27
27
|
|
|
28
28
|
import Root from '__GENERATED__/root.svelte';
|
|
29
29
|
import { nodes, server_loads, dictionary, matchers, hooks } from '__CLIENT__/manifest.js';
|
|
30
|
-
import { base } from '
|
|
30
|
+
import { base } from '__sveltekit/paths';
|
|
31
31
|
import { HttpError, Redirect } from '../control.js';
|
|
32
32
|
import { stores } from './singletons.js';
|
|
33
33
|
import { unwrap_promises } from '../../utils/promises.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BROWSER, DEV } from 'esm-env';
|
|
2
2
|
import { writable } from 'svelte/store';
|
|
3
|
-
import { assets } from '
|
|
3
|
+
import { assets } from '__sveltekit/paths';
|
|
4
4
|
import { version } from '../shared.js';
|
|
5
5
|
import { PRELOAD_PRIORITIES } from './constants.js';
|
|
6
6
|
|
|
@@ -75,7 +75,7 @@ export async function render_endpoint(event, route, mod, state) {
|
|
|
75
75
|
export function is_endpoint_request(event) {
|
|
76
76
|
const { method, headers } = event.request;
|
|
77
77
|
|
|
78
|
-
if (method === 'PUT' || method === 'PATCH' || method === 'DELETE') {
|
|
78
|
+
if (method === 'PUT' || method === 'PATCH' || method === 'DELETE' || method === 'OPTIONS') {
|
|
79
79
|
// These methods exist exclusively for endpoints
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as devalue from 'devalue';
|
|
2
2
|
import { readable, writable } from 'svelte/store';
|
|
3
3
|
import { DEV } from 'esm-env';
|
|
4
|
-
import { assets, base } from '
|
|
4
|
+
import { assets, base } from '__sveltekit/paths';
|
|
5
5
|
import { hash } from '../../hash.js';
|
|
6
6
|
import { serialize_data } from './serialize_data.js';
|
|
7
7
|
import { s } from '../../../utils/misc.js';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DEV } from 'esm-env';
|
|
2
|
-
import { base } from '
|
|
2
|
+
import { base } from '__sveltekit/paths';
|
|
3
3
|
import { is_endpoint_request, render_endpoint } from './endpoint.js';
|
|
4
4
|
import { render_page } from './page/index.js';
|
|
5
5
|
import { render_response } from './page/render.js';
|
|
@@ -41,7 +41,7 @@ export function method_not_allowed(mod, method) {
|
|
|
41
41
|
export function allowed_methods(mod) {
|
|
42
42
|
const allowed = [];
|
|
43
43
|
|
|
44
|
-
for (const method
|
|
44
|
+
for (const method in ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']) {
|
|
45
45
|
if (method in mod) allowed.push(method);
|
|
46
46
|
}
|
|
47
47
|
|
package/src/runtime/shared.js
CHANGED
package/src/utils/exports.js
CHANGED
package/types/private.d.ts
CHANGED
|
@@ -143,7 +143,7 @@ export interface CspDirectives {
|
|
|
143
143
|
>;
|
|
144
144
|
}
|
|
145
145
|
|
|
146
|
-
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
146
|
+
export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'OPTIONS';
|
|
147
147
|
|
|
148
148
|
export interface Logger {
|
|
149
149
|
(msg: string): void;
|