@sveltejs/kit 1.0.0-next.369 → 1.0.0-next.371

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/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.369');
21
+ const prog = sade('svelte-kit').version('1.0.0-next.371');
22
22
 
23
23
  prog
24
24
  .command('package')
package/dist/node.js CHANGED
@@ -5745,27 +5745,41 @@ function get_raw_body(req) {
5745
5745
  return null;
5746
5746
  }
5747
5747
 
5748
+ let size = 0;
5749
+ let cancelled = false;
5750
+
5748
5751
  return new ReadableStream({
5749
5752
  start(controller) {
5750
5753
  req.on('error', (error) => {
5751
5754
  controller.error(error);
5752
5755
  });
5753
5756
 
5754
- let size = 0;
5755
-
5756
- req.on('data', (chunk) => {
5757
- size += chunk.length;
5758
-
5759
- if (size > length) {
5760
- controller.error(new Error('content-length exceeded'));
5757
+ req.on('end', () => {
5758
+ if (!cancelled) {
5759
+ controller.close();
5761
5760
  }
5762
-
5763
- controller.enqueue(chunk);
5764
5761
  });
5762
+ },
5763
+
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
+ }
5765
5772
 
5766
- req.on('end', () => {
5767
- controller.close();
5773
+ controller.enqueue(chunk);
5774
+ }
5775
+
5776
+ fulfil();
5777
+ });
5768
5778
  });
5779
+ },
5780
+
5781
+ cancel() {
5782
+ cancelled = true;
5769
5783
  }
5770
5784
  });
5771
5785
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.369",
3
+ "version": "1.0.0-next.371",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -10,7 +10,7 @@
10
10
  "homepage": "https://kit.svelte.dev",
11
11
  "type": "module",
12
12
  "dependencies": {
13
- "@sveltejs/vite-plugin-svelte": "^1.0.0-next.48",
13
+ "@sveltejs/vite-plugin-svelte": "1.0.0-next.49",
14
14
  "chokidar": "^3.5.3",
15
15
  "sade": "^1.8.1"
16
16
  },
@@ -33,7 +33,6 @@
33
33
  "marked": "^4.0.16",
34
34
  "mime": "^3.0.0",
35
35
  "node-fetch": "^3.2.4",
36
- "port-authority": "^2.0.1",
37
36
  "rollup": "^2.75.3",
38
37
  "selfsigned": "^2.0.1",
39
38
  "set-cookie-parser": "^2.4.8",
package/types/index.d.ts CHANGED
@@ -246,7 +246,9 @@ export interface RequestEvent<Params extends Record<string, string> = Record<str
246
246
  /**
247
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.
248
248
  *
249
- * Note that you can use [generated types](/docs/types#generated-types) instead of manually specifying the `Params` generic argument.
249
+ * It receives `Params` as the first generic argument, which you can skip by using [generated types](/docs/types#generated-types) instead.
250
+ *
251
+ * The next generic argument `Output` is used to validate the returned `body` from your functions by passing it through `BodyValidator`, which will make sure the variable in the `body` matches what with you assign here. It defaults to `ResponseBody`, which will error when `body` receives a [custom object type](https://www.typescriptlang.org/docs/handbook/2/objects.html).
250
252
  */
251
253
  export interface RequestHandler<
252
254
  Params extends Record<string, string> = Record<string, string>,