@sveltejs/kit 1.0.0-next.355 → 1.0.0-next.356

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.
@@ -77,13 +77,13 @@ function is_pojo(body) {
77
77
 
78
78
  if (body) {
79
79
  if (body instanceof Uint8Array) return false;
80
+ if (body instanceof ReadableStream) return false;
80
81
 
81
- // body could be a node Readable, but we don't want to import
82
- // node built-ins, so we use duck typing
83
- if (body._readableState && typeof body.pipe === 'function') return false;
84
-
85
- // similarly, it could be a web ReadableStream
86
- if (typeof ReadableStream !== 'undefined' && body instanceof ReadableStream) return false;
82
+ // if body is a node Readable, throw an error
83
+ // TODO remove this for 1.0
84
+ if (body._readableState && typeof body.pipe === 'function') {
85
+ throw new Error('Node streams are no longer supported — use a ReadableStream instead');
86
+ }
87
87
  }
88
88
 
89
89
  return true;
@@ -114,6 +114,8 @@ const text_types = new Set([
114
114
  'multipart/form-data'
115
115
  ]);
116
116
 
117
+ const bodyless_status_codes = new Set([101, 204, 205, 304]);
118
+
117
119
  /**
118
120
  * Decides how the body should be parsed based on its mime type
119
121
  *
@@ -217,10 +219,13 @@ async function render_endpoint(event, mod) {
217
219
  }
218
220
  }
219
221
 
220
- return new Response(method !== 'head' ? normalized_body : undefined, {
221
- status,
222
- headers
223
- });
222
+ return new Response(
223
+ method !== 'head' && !bodyless_status_codes.has(status) ? normalized_body : undefined,
224
+ {
225
+ status,
226
+ headers
227
+ }
228
+ );
224
229
  }
225
230
 
226
231
  var chars$1 = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_$';
@@ -2279,6 +2284,11 @@ async function load_node({
2279
2284
  if (cookie) opts.headers.set('cookie', cookie);
2280
2285
  }
2281
2286
 
2287
+ // we need to delete the connection header, as explained here:
2288
+ // https://github.com/nodejs/undici/issues/1470#issuecomment-1140798467
2289
+ // TODO this may be a case for being selective about which headers we let through
2290
+ opts.headers.delete('connection');
2291
+
2282
2292
  const external_request = new Request(requested, /** @type {RequestInit} */ (opts));
2283
2293
  response = await options.hooks.externalFetch.call(null, external_request);
2284
2294
  }
@@ -0,0 +1,3 @@
1
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
2
+
3
+ export { commonjsGlobal as c };
@@ -15255,9 +15255,9 @@ async function preprocess(source, preprocessor, options) {
15255
15255
  /**
15256
15256
  * Resolves the `$lib` alias.
15257
15257
  *
15258
- * TODO: make this more generic to also handle other aliases the user could have defined
15259
- * via `kit.vite.resolve.alias`. Also investigate how to do this in a more robust way
15260
- * (right now regex string replacement is used).
15258
+ * TODO: make this more generic to also handle other aliases the user could have defined via
15259
+ * `kit.alias`. Also investigate how to do this in a more robust way (right now regex string
15260
+ * replacement is used).
15261
15261
  * For more discussion see https://github.com/sveltejs/kit/pull/2453
15262
15262
  *
15263
15263
  * @param {string} file Relative to the lib root
@@ -8,20 +8,34 @@ import '@sveltejs/vite-plugin-svelte';
8
8
  import 'vite';
9
9
  import './sync.js';
10
10
  import '../node/polyfills.js';
11
+ import 'assert';
12
+ import 'net';
13
+ import 'http';
14
+ import 'stream';
15
+ import 'buffer';
16
+ import 'util';
17
+ import 'stream/web';
18
+ import 'perf_hooks';
19
+ import 'util/types';
20
+ import 'events';
21
+ import 'tls';
22
+ import './_commonjsHelpers.js';
23
+ import 'async_hooks';
24
+ import 'console';
25
+ import 'zlib';
26
+ import 'crypto';
27
+ import 'querystring';
28
+ import '../node.js';
11
29
  import 'node:http';
12
30
  import 'node:https';
13
31
  import 'node:zlib';
14
32
  import 'node:stream';
15
33
  import 'node:buffer';
16
- import 'node:util';
17
34
  import 'node:url';
35
+ import 'node:util';
18
36
  import 'node:net';
19
37
  import 'node:fs';
20
38
  import 'node:path';
21
- import 'crypto';
22
- import 'querystring';
23
- import '../node.js';
24
- import 'stream';
25
39
 
26
40
  /**
27
41
  * Creates the Builder which is passed to adapters for building the application.
@@ -1,15 +1,16 @@
1
1
  import 'node:fs';
2
2
  import 'node:path';
3
- import { F as FormData, a as File } from '../node/polyfills.js';
3
+ import { F as FormData, a as File } from '../node.js';
4
4
  import 'node:http';
5
5
  import 'node:https';
6
6
  import 'node:zlib';
7
7
  import 'node:stream';
8
8
  import 'node:buffer';
9
- import 'node:util';
10
9
  import 'node:url';
10
+ import 'node:util';
11
+ import './_commonjsHelpers.js';
11
12
  import 'node:net';
12
- import 'crypto';
13
+ import 'stream';
13
14
 
14
15
  let s = 0;
15
16
  const S = {
package/dist/cli.js CHANGED
@@ -41,7 +41,7 @@ async function launch(port, https, base) {
41
41
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
42
42
  }
43
43
 
44
- const prog = sade('svelte-kit').version('1.0.0-next.355');
44
+ const prog = sade('svelte-kit').version('1.0.0-next.356');
45
45
 
46
46
  prog
47
47
  .command('dev')
@@ -242,7 +242,7 @@ prog.parse(process.argv, { unknown: (arg) => `Unknown option: ${arg}` });
242
242
  function welcome({ port, host, https, open, base, loose, allow, cwd }) {
243
243
  if (open) launch(port, https, base);
244
244
 
245
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.355'}\n`));
245
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.356'}\n`));
246
246
 
247
247
  const protocol = https ? 'https:' : 'http:';
248
248
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';