@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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.5.7",
3
+ "version": "1.6.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -89,6 +89,7 @@ async function analyse({ manifest_path, env }) {
89
89
  if (mod.PUT) methods.add('PUT');
90
90
  if (mod.PATCH) methods.add('PATCH');
91
91
  if (mod.DELETE) methods.add('DELETE');
92
+ if (mod.OPTIONS) methods.add('OPTIONS');
92
93
 
93
94
  config = mod.config;
94
95
  }
@@ -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 === '@sveltejs/kit/paths' || id === '$service-worker') {
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 '\0@sveltejs/kit/paths':
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
@@ -1,5 +1,5 @@
1
1
  /** Internal version of $app/paths */
2
- declare module '@sveltejs/kit/paths' {
2
+ declare module '__sveltekit/paths' {
3
3
  export const base: `/${string}`;
4
4
  export let assets: `https://${string}` | `http://${string}`;
5
5
  export function set_assets(path: string): void;
@@ -1 +1 @@
1
- export { base, assets } from '@sveltejs/kit/paths';
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 '@sveltejs/kit/paths';
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 '@sveltejs/kit/paths';
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,6 +1,6 @@
1
1
  import * as set_cookie_parser from 'set-cookie-parser';
2
2
  import { respond } from './respond.js';
3
- import * as paths from '@sveltejs/kit/paths';
3
+ import * as paths from '__sveltekit/paths';
4
4
 
5
5
  /**
6
6
  * @param {{
@@ -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 '@sveltejs/kit/paths';
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 '@sveltejs/kit/paths';
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 of ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']) {
44
+ for (const method in ['GET', 'POST', 'PUT', 'PATCH', 'DELETE', 'OPTIONS']) {
45
45
  if (method in mod) allowed.push(method);
46
46
  }
47
47
 
@@ -1,4 +1,4 @@
1
- export { set_assets } from '@sveltejs/kit/paths';
1
+ export { set_assets } from '__sveltekit/paths';
2
2
 
3
3
  export let building = false;
4
4
  export let version = '';
@@ -51,6 +51,7 @@ export const validate_server_exports = validator([
51
51
  'PATCH',
52
52
  'PUT',
53
53
  'DELETE',
54
+ 'OPTIONS',
54
55
  'prerender',
55
56
  'trailingSlash',
56
57
  'config'
@@ -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;