@sveltejs/kit 2.20.5 → 2.20.6

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": "2.20.5",
3
+ "version": "2.20.6",
4
4
  "description": "SvelteKit is the fastest way to build Svelte apps",
5
5
  "keywords": [
6
6
  "framework",
@@ -2,7 +2,7 @@ import { HttpError, SvelteKitError, Redirect } from '../../control.js';
2
2
  import { normalize_error } from '../../../utils/error.js';
3
3
  import { once } from '../../../utils/functions.js';
4
4
  import { load_server_data } from '../page/load_data.js';
5
- import { clarify_devalue_error, handle_error_and_jsonify, stringify_uses } from '../utils.js';
5
+ import { clarify_devalue_error, handle_error_and_jsonify, serialize_uses } from '../utils.js';
6
6
  import { normalize_path } from '../../../utils/url.js';
7
7
  import { text } from '../../../exports/index.js';
8
8
  import * as devalue from 'devalue';
@@ -253,8 +253,8 @@ export function get_data_json(event, options, nodes) {
253
253
  return JSON.stringify(node);
254
254
  }
255
255
 
256
- return `{"type":"data","data":${devalue.stringify(node.data, reducers)},${stringify_uses(
257
- node
256
+ return `{"type":"data","data":${devalue.stringify(node.data, reducers)},${JSON.stringify(
257
+ serialize_uses(node)
258
258
  )}${node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ''}}`;
259
259
  });
260
260
 
@@ -7,7 +7,7 @@ import { serialize_data } from './serialize_data.js';
7
7
  import { s } from '../../../utils/misc.js';
8
8
  import { Csp } from './csp.js';
9
9
  import { uneval_action_response } from './actions.js';
10
- import { clarify_devalue_error, stringify_uses, handle_error_and_jsonify } from '../utils.js';
10
+ import { clarify_devalue_error, handle_error_and_jsonify, serialize_uses } from '../utils.js';
11
11
  import { public_env, safe_public_env } from '../../shared-server.js';
12
12
  import { text } from '../../../exports/index.js';
13
13
  import { create_async_iterator } from '../../../utils/streaming.js';
@@ -646,9 +646,11 @@ function get_data(event, options, nodes, csp, global) {
646
646
  const strings = nodes.map((node) => {
647
647
  if (!node) return 'null';
648
648
 
649
- return `{"type":"data","data":${devalue.uneval(node.data, replacer)},${stringify_uses(node)}${
650
- node.slash ? `,"slash":${JSON.stringify(node.slash)}` : ''
651
- }}`;
649
+ /** @type {any} */
650
+ const payload = { type: 'data', data: node.data, uses: serialize_uses(node) };
651
+ if (node.slash) payload.slash = node.slash;
652
+
653
+ return devalue.uneval(payload, replacer);
652
654
  });
653
655
 
654
656
  return {
@@ -147,26 +147,26 @@ export function clarify_devalue_error(event, error) {
147
147
  /**
148
148
  * @param {import('types').ServerDataNode} node
149
149
  */
150
- export function stringify_uses(node) {
151
- const uses = [];
150
+ export function serialize_uses(node) {
151
+ const uses = {};
152
152
 
153
153
  if (node.uses && node.uses.dependencies.size > 0) {
154
- uses.push(`"dependencies":${JSON.stringify(Array.from(node.uses.dependencies))}`);
154
+ uses.dependencies = Array.from(node.uses.dependencies);
155
155
  }
156
156
 
157
157
  if (node.uses && node.uses.search_params.size > 0) {
158
- uses.push(`"search_params":${JSON.stringify(Array.from(node.uses.search_params))}`);
158
+ uses.search_params = Array.from(node.uses.search_params);
159
159
  }
160
160
 
161
161
  if (node.uses && node.uses.params.size > 0) {
162
- uses.push(`"params":${JSON.stringify(Array.from(node.uses.params))}`);
162
+ uses.params = Array.from(node.uses.params);
163
163
  }
164
164
 
165
- if (node.uses?.parent) uses.push('"parent":1');
166
- if (node.uses?.route) uses.push('"route":1');
167
- if (node.uses?.url) uses.push('"url":1');
165
+ if (node.uses?.parent) uses.parent = 1;
166
+ if (node.uses?.route) uses.route = 1;
167
+ if (node.uses?.url) uses.url = 1;
168
168
 
169
- return `"uses":{${uses.join(',')}}`;
169
+ return uses;
170
170
  }
171
171
 
172
172
  /**
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // generated during release, do not modify
2
2
 
3
3
  /** @type {string} */
4
- export const VERSION = '2.20.5';
4
+ export const VERSION = '2.20.6';