@sveltejs/kit 1.0.0-next.376 → 1.0.0-next.379

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/README.md CHANGED
@@ -5,7 +5,7 @@ This is the [SvelteKit](https://kit.svelte.dev) framework and CLI.
5
5
  The quickest way to get started is via the [create-svelte](https://github.com/sveltejs/kit/tree/master/packages/create-svelte) package:
6
6
 
7
7
  ```bash
8
- npm init svelte my-app
8
+ npm create svelte@latest my-app
9
9
  cd my-app
10
10
  npm install
11
11
  npm run dev
@@ -126,6 +126,8 @@ class LoadURL extends URL {
126
126
  }
127
127
  }
128
128
 
129
+ /* global __SVELTEKIT_APP_VERSION__, __SVELTEKIT_APP_VERSION_FILE__, __SVELTEKIT_APP_VERSION_POLL_INTERVAL__ */
130
+
129
131
  /** @param {HTMLDocument} doc */
130
132
  function get_base_uri(doc) {
131
133
  let baseURI = doc.baseURI;
@@ -193,10 +195,7 @@ function notifiable_store(value) {
193
195
  function create_updated_store() {
194
196
  const { set, subscribe } = writable(false);
195
197
 
196
- const interval = +(
197
- /** @type {string} */ (import.meta.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL)
198
- );
199
- const initial = import.meta.env.VITE_SVELTEKIT_APP_VERSION;
198
+ const interval = __SVELTEKIT_APP_VERSION_POLL_INTERVAL__;
200
199
 
201
200
  /** @type {NodeJS.Timeout} */
202
201
  let timeout;
@@ -208,9 +207,7 @@ function create_updated_store() {
208
207
 
209
208
  if (interval) timeout = setTimeout(check, interval);
210
209
 
211
- const file = import.meta.env.VITE_SVELTEKIT_APP_VERSION_FILE;
212
-
213
- const res = await fetch(`${assets}/${file}`, {
210
+ const res = await fetch(`${assets}/${__SVELTEKIT_APP_VERSION_FILE__}`, {
214
211
  headers: {
215
212
  pragma: 'no-cache',
216
213
  'cache-control': 'no-cache'
@@ -219,7 +216,7 @@ function create_updated_store() {
219
216
 
220
217
  if (res.ok) {
221
218
  const { version } = await res.json();
222
- const updated = version !== initial;
219
+ const updated = version !== __SVELTEKIT_APP_VERSION__;
223
220
 
224
221
  if (updated) {
225
222
  set(true);
@@ -145,12 +145,6 @@ function is_pojo(body) {
145
145
  return true;
146
146
  }
147
147
 
148
- /** @param {import('types').RequestEvent} event */
149
- function normalize_request_method(event) {
150
- const method = event.request.method.toLowerCase();
151
- return method === 'delete' ? 'del' : method; // 'delete' is a reserved word
152
- }
153
-
154
148
  /**
155
149
  * Serialize an error into a JSON string, by copying its `name`, `message`
156
150
  * and (in dev) `stack`, plus any custom properties, plus recursively
@@ -171,8 +165,6 @@ function clone_error(error, get_stack) {
171
165
  const {
172
166
  name,
173
167
  message,
174
- // this should constitute 'using' a var, since it affects `custom`
175
- // eslint-disable-next-line
176
168
  stack,
177
169
  // @ts-expect-error i guess typescript doesn't know about error.cause yet
178
170
  cause,
@@ -192,6 +184,19 @@ function clone_error(error, get_stack) {
192
184
  return object;
193
185
  }
194
186
 
187
+ // TODO: Remove for 1.0
188
+ /** @param {Record<string, any>} mod */
189
+ function check_method_names(mod) {
190
+ ['get', 'post', 'put', 'patch', 'del'].forEach((m) => {
191
+ if (m in mod) {
192
+ const replacement = m === 'del' ? 'DELETE' : m.toUpperCase();
193
+ throw Error(
194
+ `Endpoint method "${m}" has changed to "${replacement}". See https://github.com/sveltejs/kit/discussions/5359 for more information.`
195
+ );
196
+ }
197
+ });
198
+ }
199
+
195
200
  /** @type {import('types').SSRErrorPage} */
196
201
  const GENERIC_ERROR = {
197
202
  id: '__error'
@@ -238,24 +243,25 @@ function is_text(content_type) {
238
243
  * @returns {Promise<Response>}
239
244
  */
240
245
  async function render_endpoint(event, mod, options) {
241
- const method = normalize_request_method(event);
246
+ const { method } = event.request;
247
+
248
+ check_method_names(mod);
242
249
 
243
250
  /** @type {import('types').RequestHandler} */
244
251
  let handler = mod[method];
245
252
 
246
- if (!handler && method === 'head') {
247
- handler = mod.get;
253
+ if (!handler && method === 'HEAD') {
254
+ handler = mod.GET;
248
255
  }
249
256
 
250
257
  if (!handler) {
251
258
  const allowed = [];
252
259
 
253
- for (const method in ['get', 'post', 'put', 'patch']) {
254
- if (mod[method]) allowed.push(method.toUpperCase());
260
+ for (const method in ['GET', 'POST', 'PUT', 'PATCH', 'DELETE']) {
261
+ if (mod[method]) allowed.push(method);
255
262
  }
256
263
 
257
- if (mod.del) allowed.push('DELETE');
258
- if (mod.get || mod.head) allowed.push('HEAD');
264
+ if (mod.GET || mod.HEAD) allowed.push('HEAD');
259
265
 
260
266
  return event.request.headers.get('x-sveltekit-load')
261
267
  ? // TODO would be nice to avoid these requests altogether,
@@ -263,7 +269,7 @@ async function render_endpoint(event, mod, options) {
263
269
  new Response(undefined, {
264
270
  status: 204
265
271
  })
266
- : new Response(`${event.request.method} method not allowed`, {
272
+ : new Response(`${method} method not allowed`, {
267
273
  status: 405,
268
274
  headers: {
269
275
  // https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405
@@ -327,7 +333,7 @@ async function render_endpoint(event, mod, options) {
327
333
  }
328
334
 
329
335
  return new Response(
330
- method !== 'head' && !bodyless_status_codes.has(status) ? normalized_body : undefined,
336
+ method !== 'HEAD' && !bodyless_status_codes.has(status) ? normalized_body : undefined,
331
337
  {
332
338
  status,
333
339
  headers
@@ -2620,13 +2626,15 @@ async function load_shadow_data(route, event, options, prerender) {
2620
2626
  try {
2621
2627
  const mod = await route.shadow();
2622
2628
 
2623
- if (prerender && (mod.post || mod.put || mod.del || mod.patch)) {
2629
+ check_method_names(mod);
2630
+
2631
+ if (prerender && (mod.POST || mod.PUT || mod.DELETE || mod.PATCH)) {
2624
2632
  throw new Error('Cannot prerender pages that have endpoints with mutative methods');
2625
2633
  }
2626
2634
 
2627
- const method = normalize_request_method(event);
2628
- const is_get = method === 'head' || method === 'get';
2629
- const handler = method === 'head' ? mod.head || mod.get : mod[method];
2635
+ const { method } = event.request;
2636
+ const is_get = method === 'HEAD' || method === 'GET';
2637
+ const handler = method === 'HEAD' ? mod.HEAD || mod.GET : mod[method];
2630
2638
 
2631
2639
  if (!handler && !is_get) {
2632
2640
  return {
@@ -2673,7 +2681,7 @@ async function load_shadow_data(route, event, options, prerender) {
2673
2681
  data.body = body;
2674
2682
  }
2675
2683
 
2676
- const get = (method === 'head' && mod.head) || mod.get;
2684
+ const get = (method === 'HEAD' && mod.HEAD) || mod.GET;
2677
2685
  if (get) {
2678
2686
  const { status, headers, body } = validate_shadow_output(await get(event));
2679
2687
  add_cookies(/** @type {string[]} */ (data.cookies), headers);
@@ -3204,6 +3212,8 @@ function exec(match, names, types, matchers) {
3204
3212
  return params;
3205
3213
  }
3206
3214
 
3215
+ /* global __SVELTEKIT_ADAPTER_NAME__ */
3216
+
3207
3217
  const DATA_SUFFIX = '/__data.json';
3208
3218
 
3209
3219
  /** @param {{ html: string }} opts */
@@ -3311,9 +3321,7 @@ async function respond(request, options, state) {
3311
3321
  get clientAddress() {
3312
3322
  if (!state.getClientAddress) {
3313
3323
  throw new Error(
3314
- `${
3315
- import.meta.env.VITE_SVELTEKIT_ADAPTER_NAME
3316
- } does not specify getClientAddress. Please raise an issue`
3324
+ `${__SVELTEKIT_ADAPTER_NAME__} does not specify getClientAddress. Please raise an issue`
3317
3325
  );
3318
3326
  }
3319
3327
 
@@ -83,7 +83,7 @@ function create_builder({ config, build_data, prerendered, log }) {
83
83
  content: segment
84
84
  })),
85
85
  pattern: route.pattern,
86
- methods: route.type === 'page' ? ['get'] : build_data.server.methods[route.file]
86
+ methods: route.type === 'page' ? ['GET'] : build_data.server.methods[route.file]
87
87
  }));
88
88
 
89
89
  const seen = new Set();
@@ -564,7 +564,6 @@ function trace(file, path, tree, extensions) {
564
564
 
565
565
  // walk up the tree, find which __layout and __error components
566
566
  // apply to this page
567
- // eslint-disable-next-line
568
567
  while (true) {
569
568
  const node = tree.get(parts.join('/'));
570
569
  const layout = node?.layouts[layout_id];
@@ -726,7 +725,7 @@ function copy_assets(dest) {
726
725
  }
727
726
 
728
727
  prefix = `../${prefix}`;
729
- } while (true); // eslint-disable-line
728
+ } while (true);
730
729
  }
731
730
 
732
731
  const s = JSON.stringify;
package/dist/cli.js CHANGED
@@ -18,7 +18,7 @@ function handle_error(e) {
18
18
  process.exit(1);
19
19
  }
20
20
 
21
- const prog = sade('svelte-kit').version('1.0.0-next.376');
21
+ const prog = sade('svelte-kit').version('1.0.0-next.379');
22
22
 
23
23
  prog
24
24
  .command('package')
package/dist/node.js CHANGED
@@ -2,7 +2,7 @@ import http from 'node:http';
2
2
  import 'node:https';
3
3
  import 'node:zlib';
4
4
  import Stream, { PassThrough } from 'node:stream';
5
- import { Buffer as Buffer$1 } from 'node:buffer';
5
+ import { Buffer } from 'node:buffer';
6
6
  import { promisify, deprecate, types } from 'node:util';
7
7
  import { c as commonjsGlobal } from './chunks/_commonjsHelpers.js';
8
8
  import { format } from 'node:url';
@@ -4945,13 +4945,13 @@ class Body {
4945
4945
  body = null;
4946
4946
  } else if (isURLSearchParameters(body)) {
4947
4947
  // Body is a URLSearchParams
4948
- body = Buffer$1.from(body.toString());
4949
- } else if (isBlob(body)) ; else if (Buffer$1.isBuffer(body)) ; else if (types.isAnyArrayBuffer(body)) {
4948
+ body = Buffer.from(body.toString());
4949
+ } else if (isBlob(body)) ; else if (Buffer.isBuffer(body)) ; else if (types.isAnyArrayBuffer(body)) {
4950
4950
  // Body is ArrayBuffer
4951
- body = Buffer$1.from(body);
4951
+ body = Buffer.from(body);
4952
4952
  } else if (ArrayBuffer.isView(body)) {
4953
4953
  // Body is ArrayBufferView
4954
- body = Buffer$1.from(body.buffer, body.byteOffset, body.byteLength);
4954
+ body = Buffer.from(body.buffer, body.byteOffset, body.byteLength);
4955
4955
  } else if (body instanceof Stream) ; else if (body instanceof FormData) {
4956
4956
  // Body is FormData
4957
4957
  body = formDataToBlob(body);
@@ -4959,12 +4959,12 @@ class Body {
4959
4959
  } else {
4960
4960
  // None of the above
4961
4961
  // coerce to string then buffer
4962
- body = Buffer$1.from(String(body));
4962
+ body = Buffer.from(String(body));
4963
4963
  }
4964
4964
 
4965
4965
  let stream = body;
4966
4966
 
4967
- if (Buffer$1.isBuffer(body)) {
4967
+ if (Buffer.isBuffer(body)) {
4968
4968
  stream = Stream.Readable.from(body);
4969
4969
  } else if (isBlob(body)) {
4970
4970
  stream = Stream.Readable.from(body.stream());
@@ -5106,12 +5106,12 @@ async function consumeBody(data) {
5106
5106
 
5107
5107
  // Body is null
5108
5108
  if (body === null) {
5109
- return Buffer$1.alloc(0);
5109
+ return Buffer.alloc(0);
5110
5110
  }
5111
5111
 
5112
5112
  /* c8 ignore next 3 */
5113
5113
  if (!(body instanceof Stream)) {
5114
- return Buffer$1.alloc(0);
5114
+ return Buffer.alloc(0);
5115
5115
  }
5116
5116
 
5117
5117
  // Body is stream
@@ -5138,10 +5138,10 @@ async function consumeBody(data) {
5138
5138
  if (body.readableEnded === true || body._readableState.ended === true) {
5139
5139
  try {
5140
5140
  if (accum.every(c => typeof c === 'string')) {
5141
- return Buffer$1.from(accum.join(''));
5141
+ return Buffer.from(accum.join(''));
5142
5142
  }
5143
5143
 
5144
- return Buffer$1.concat(accum, accumBytes);
5144
+ return Buffer.concat(accum, accumBytes);
5145
5145
  } catch (error) {
5146
5146
  throw new FetchError(`Could not create Buffer from response body for ${data.url}: ${error.message}`, 'system', error);
5147
5147
  }
@@ -5221,7 +5221,7 @@ const extractContentType = (body, request) => {
5221
5221
  }
5222
5222
 
5223
5223
  // Body is a Buffer (Buffer, ArrayBuffer or ArrayBufferView)
5224
- if (Buffer$1.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
5224
+ if (Buffer.isBuffer(body) || types.isAnyArrayBuffer(body) || ArrayBuffer.isView(body)) {
5225
5225
  return null;
5226
5226
  }
5227
5227
 
@@ -5745,6 +5745,12 @@ function get_raw_body(req) {
5745
5745
  return null;
5746
5746
  }
5747
5747
 
5748
+ if (req.destroyed) {
5749
+ const readable = new ReadableStream();
5750
+ readable.cancel();
5751
+ return readable;
5752
+ }
5753
+
5748
5754
  let size = 0;
5749
5755
  let cancelled = false;
5750
5756
 
@@ -5755,31 +5761,34 @@ function get_raw_body(req) {
5755
5761
  });
5756
5762
 
5757
5763
  req.on('end', () => {
5758
- if (!cancelled) {
5759
- controller.close();
5760
- }
5764
+ if (cancelled) return;
5765
+ controller.close();
5761
5766
  });
5762
- },
5763
5767
 
5764
- pull(controller) {
5765
- return new Promise((fulfil) => {
5766
- req.once('data', (chunk) => {
5767
- if (!cancelled) {
5768
- size += chunk.length;
5769
- if (size > length) {
5770
- controller.error(new Error('content-length exceeded'));
5771
- }
5768
+ req.on('data', (chunk) => {
5769
+ if (cancelled) return;
5770
+
5771
+ size += chunk.length;
5772
+ if (size > length) {
5773
+ controller.error(new Error('content-length exceeded'));
5774
+ return;
5775
+ }
5772
5776
 
5773
- controller.enqueue(chunk);
5774
- }
5777
+ controller.enqueue(chunk);
5775
5778
 
5776
- fulfil();
5777
- });
5779
+ if (controller.desiredSize === null || controller.desiredSize <= 0) {
5780
+ req.pause();
5781
+ }
5778
5782
  });
5779
5783
  },
5780
5784
 
5781
- cancel() {
5785
+ pull() {
5786
+ req.resume();
5787
+ },
5788
+
5789
+ cancel(reason) {
5782
5790
  cancelled = true;
5791
+ req.destroy(reason);
5783
5792
  }
5784
5793
  });
5785
5794
  }
@@ -5831,16 +5840,26 @@ async function setResponse(res, response) {
5831
5840
  res.writeHead(response.status, headers);
5832
5841
 
5833
5842
  if (response.body) {
5834
- let cancelled = false;
5835
-
5836
5843
  const reader = response.body.getReader();
5837
5844
 
5845
+ if (res.destroyed) {
5846
+ reader.cancel();
5847
+ return;
5848
+ }
5849
+
5850
+ let cancelled = false;
5851
+
5838
5852
  res.on('close', () => {
5839
5853
  reader.cancel();
5840
5854
  cancelled = true;
5841
5855
  });
5842
5856
 
5843
- const next = async () => {
5857
+ res.on('error', (error) => {
5858
+ reader.cancel(error);
5859
+ cancelled = true;
5860
+ });
5861
+
5862
+ for (;;) {
5844
5863
  const { done, value } = await reader.read();
5845
5864
 
5846
5865
  if (cancelled) return;
@@ -5850,17 +5869,12 @@ async function setResponse(res, response) {
5850
5869
  return;
5851
5870
  }
5852
5871
 
5853
- res.write(Buffer.from(value), (error) => {
5854
- if (error) {
5855
- console.error('Error writing stream', error);
5856
- res.end();
5857
- } else {
5858
- next();
5859
- }
5860
- });
5861
- };
5872
+ const ok = res.write(value);
5862
5873
 
5863
- next();
5874
+ if (!ok) {
5875
+ await new Promise((fulfil) => res.once('drain', fulfil));
5876
+ }
5877
+ }
5864
5878
  } else {
5865
5879
  res.end();
5866
5880
  }
package/dist/vite.js CHANGED
@@ -4,7 +4,7 @@ import path__default, { join, dirname, resolve as resolve$1, normalize } from 'p
4
4
  import { a as load_template, $, c as coalesce_to_error, l as load_config } from './chunks/error.js';
5
5
  import { svelte } from '@sveltejs/vite-plugin-svelte';
6
6
  import * as vite from 'vite';
7
- import { loadConfigFromFile, searchForWorkspaceRoot } from 'vite';
7
+ import { loadConfigFromFile } from 'vite';
8
8
  import { p as posixify, m as mkdirp, r as rimraf } from './chunks/write_tsconfig.js';
9
9
  import { g as get_runtime_directory, s, i as init, a as get_runtime_prefix, u as update, b as get_mime_lookup, p as parse_route_id, c as all, l as logger } from './chunks/sync.js';
10
10
  import { pathToFileURL, URL as URL$1 } from 'url';
@@ -273,6 +273,12 @@ const get_default_config = function ({ config, input, ssr, outDir }) {
273
273
  ssr,
274
274
  target: ssr ? 'node14.8' : undefined
275
275
  },
276
+ define: {
277
+ __SVELTEKIT_ADAPTER_NAME__: JSON.stringify(config.kit.adapter?.name),
278
+ __SVELTEKIT_APP_VERSION__: JSON.stringify(config.kit.version.name),
279
+ __SVELTEKIT_APP_VERSION_FILE__: JSON.stringify(`${config.kit.appDir}/version.json`),
280
+ __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: JSON.stringify(config.kit.version.pollInterval)
281
+ },
276
282
  // prevent Vite copying the contents of `config.kit.files.assets`,
277
283
  // if it happens to be 'public' instead of 'static'
278
284
  publicDir: false,
@@ -315,6 +321,17 @@ function remove_svelte_kit(config) {
315
321
  .filter((plugin) => plugin.name !== 'vite-plugin-svelte-kit');
316
322
  }
317
323
 
324
+ const method_names = new Set(['GET', 'HEAD', 'PUT', 'POST', 'DELETE', 'PATCH']);
325
+
326
+ // If we'd written this in TypeScript, it could be easy...
327
+ /**
328
+ * @param {string} str
329
+ * @returns {str is import('types').HttpMethod}
330
+ */
331
+ function is_http_method(str) {
332
+ return method_names.has(str);
333
+ }
334
+
318
335
  /**
319
336
  * @param {{
320
337
  * hooks: string;
@@ -499,8 +516,6 @@ async function build_server(options, client) {
499
516
 
500
517
  remove_svelte_kit(merged_config);
501
518
 
502
- process.env.VITE_SVELTEKIT_ADAPTER_NAME = config.kit.adapter?.name;
503
-
504
519
  const { chunks } = await create_build(merged_config);
505
520
 
506
521
  /** @type {import('vite').Manifest} */
@@ -563,16 +578,6 @@ async function build_server(options, client) {
563
578
  };
564
579
  }
565
580
 
566
- /** @type {Record<string, string>} */
567
- const method_names = {
568
- get: 'get',
569
- head: 'head',
570
- post: 'post',
571
- put: 'put',
572
- del: 'delete',
573
- patch: 'patch'
574
- };
575
-
576
581
  /**
577
582
  * @param {string} cwd
578
583
  * @param {import('rollup').OutputChunk[]} output
@@ -593,9 +598,7 @@ function get_methods(cwd, output, manifest_data) {
593
598
  const file = route.type === 'endpoint' ? route.file : route.shadow;
594
599
 
595
600
  if (file && lookup[file]) {
596
- methods[file] = lookup[file]
597
- .map((x) => /** @type {import('types').HttpMethod} */ (method_names[x]))
598
- .filter(Boolean);
601
+ methods[file] = lookup[file].filter(is_http_method);
599
602
  }
600
603
  });
601
604
 
@@ -2054,8 +2057,6 @@ async function dev(vite, vite_config, svelte_config) {
2054
2057
 
2055
2058
  const runtime = get_runtime_prefix(svelte_config.kit);
2056
2059
 
2057
- process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = '0';
2058
-
2059
2060
  /** @type {import('types').Respond} */
2060
2061
  const respond = (await import(`${runtime}/server/index.js`)).respond;
2061
2062
 
@@ -2876,7 +2877,7 @@ function kit() {
2876
2877
 
2877
2878
  let completed_build = false;
2878
2879
 
2879
- function vite_client_config() {
2880
+ function vite_client_build_config() {
2880
2881
  /** @type {Record<string, string>} */
2881
2882
  const input = {
2882
2883
  // Put unchanging assets in immutable directory. We don't set that in the
@@ -2949,13 +2950,9 @@ function kit() {
2949
2950
  };
2950
2951
 
2951
2952
  if (is_build) {
2952
- process.env.VITE_SVELTEKIT_APP_VERSION = svelte_config.kit.version.name;
2953
- process.env.VITE_SVELTEKIT_APP_VERSION_FILE = `${svelte_config.kit.appDir}/version.json`;
2954
- process.env.VITE_SVELTEKIT_APP_VERSION_POLL_INTERVAL = `${svelte_config.kit.version.pollInterval}`;
2955
-
2956
2953
  manifest_data = all(svelte_config).manifest_data;
2957
2954
 
2958
- const new_config = vite_client_config();
2955
+ const new_config = vite_client_build_config();
2959
2956
 
2960
2957
  warn_overridden_config(config, new_config);
2961
2958
 
@@ -2974,6 +2971,9 @@ function kit() {
2974
2971
  input: `${get_runtime_directory(svelte_config.kit)}/client/start.js`
2975
2972
  }
2976
2973
  },
2974
+ define: {
2975
+ __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: '0'
2976
+ },
2977
2977
  resolve: {
2978
2978
  alias: get_aliases(svelte_config.kit)
2979
2979
  },
@@ -2987,7 +2987,7 @@ function kit() {
2987
2987
  svelte_config.kit.outDir,
2988
2988
  path__default.resolve(cwd, 'src'),
2989
2989
  path__default.resolve(cwd, 'node_modules'),
2990
- path__default.resolve(searchForWorkspaceRoot(cwd), 'node_modules')
2990
+ path__default.resolve(vite.searchForWorkspaceRoot(cwd), 'node_modules')
2991
2991
  ])
2992
2992
  ]
2993
2993
  },
@@ -3038,7 +3038,7 @@ function kit() {
3038
3038
 
3039
3039
  fs__default.writeFileSync(
3040
3040
  `${paths.client_out_dir}/version.json`,
3041
- JSON.stringify({ version: process.env.VITE_SVELTEKIT_APP_VERSION })
3041
+ JSON.stringify({ version: svelte_config.kit.version.name })
3042
3042
  );
3043
3043
 
3044
3044
  const { assets, chunks } = collect_output(bundle);
@@ -3167,18 +3167,14 @@ function kit() {
3167
3167
  }
3168
3168
 
3169
3169
  function check_vite_version() {
3170
- let vite_major = 3;
3171
-
3172
- try {
3173
- const pkg = JSON.parse(fs__default.readFileSync('package.json', 'utf-8'));
3174
- vite_major = +pkg.devDependencies['vite'].replace(/^[~^]/, '')[0];
3175
- } catch {
3176
- // do nothing
3177
- }
3170
+ // TODO parse from kit peer deps and maybe do a full semver compare if we ever require feature releases a min
3171
+ const min_required_vite_major = 3;
3172
+ const vite_version = vite.version ?? '2.x'; // vite started exporting it's version in 3.0
3173
+ const current_vite_major = parseInt(vite_version.split('.')[0], 10);
3178
3174
 
3179
- if (vite_major < 3) {
3175
+ if (current_vite_major < min_required_vite_major) {
3180
3176
  throw new Error(
3181
- `Vite version ${vite_major} is no longer supported. Please upgrade to version 3`
3177
+ `Vite version ${current_vite_major} is no longer supported. Please upgrade to version ${min_required_vite_major}`
3182
3178
  );
3183
3179
  }
3184
3180
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.376",
3
+ "version": "1.0.0-next.379",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -15,7 +15,7 @@
15
15
  "sade": "^1.8.1"
16
16
  },
17
17
  "devDependencies": {
18
- "@playwright/test": "^1.23.3",
18
+ "@playwright/test": "^1.23.4",
19
19
  "@rollup/plugin-replace": "^4.0.0",
20
20
  "@types/connect": "^3.4.35",
21
21
  "@types/cookie": "^0.5.1",
@@ -27,7 +27,6 @@
27
27
  "cookie": "^0.5.0",
28
28
  "cross-env": "^7.0.3",
29
29
  "devalue": "^2.0.1",
30
- "eslint": "^8.16.0",
31
30
  "kleur": "^4.1.4",
32
31
  "locate-character": "^2.0.5",
33
32
  "marked": "^4.0.16",
@@ -85,11 +84,10 @@
85
84
  "scripts": {
86
85
  "build": "rollup -c && node scripts/cp.js src/runtime/components assets/components && npm run types",
87
86
  "dev": "rollup -cw",
88
- "lint": "eslint --ignore-path .gitignore --ignore-pattern \"src/packaging/test/**\" \"{src,test}/**/*.{ts,mjs,js,svelte}\" && npm run check-format",
87
+ "lint": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
89
88
  "check": "tsc",
90
89
  "check:all": "tsc && pnpm -r --filter=\"./**\" check",
91
90
  "format": "npm run check-format -- --write",
92
- "check-format": "prettier --check . --config ../../.prettierrc --ignore-path .gitignore",
93
91
  "test": "npm run test:unit && npm run test:typings && npm run test:packaging && npm run test:integration",
94
92
  "test:integration": "pnpm run -r --workspace-concurrency 1 --filter=\"./test/**\" test",
95
93
  "test:unit": "uvu src \"(spec\\.js|test[\\\\/]index\\.js)\" -i packaging",
package/types/index.d.ts CHANGED
@@ -244,7 +244,7 @@ export interface RequestEvent<Params extends Record<string, string> = Record<str
244
244
  }
245
245
 
246
246
  /**
247
- * A `(event: RequestEvent) => RequestHandlerOutput` function exported from an endpoint that corresponds to an HTTP verb (`get`, `put`, `patch`, etc) and handles requests with that method. Note that since 'delete' is a reserved word in JavaScript, delete handles are called `del` instead.
247
+ * A `(event: RequestEvent) => RequestHandlerOutput` function exported from an endpoint that corresponds to an HTTP verb (`GET`, `PUT`, `PATCH`, etc) and handles requests with that method.
248
248
  *
249
249
  * It receives `Params` as the first generic argument, which you can skip by using [generated types](/docs/types#generated-types) instead.
250
250
  *
@@ -317,3 +317,10 @@ export type ValidatedKitConfig = RecursiveRequired<KitConfig>;
317
317
 
318
318
  export * from './index';
319
319
  export * from './private';
320
+
321
+ declare global {
322
+ const __SVELTEKIT_ADAPTER_NAME__: string;
323
+ const __SVELTEKIT_APP_VERSION__: string;
324
+ const __SVELTEKIT_APP_VERSION_FILE__: string;
325
+ const __SVELTEKIT_APP_VERSION_POLL_INTERVAL__: number;
326
+ }
@@ -142,7 +142,7 @@ export interface CspDirectives {
142
142
  >;
143
143
  }
144
144
 
145
- export type HttpMethod = 'get' | 'head' | 'post' | 'put' | 'delete' | 'patch';
145
+ export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
146
146
 
147
147
  export interface JSONObject {
148
148
  [key: string]: JSONValue;