@sveltejs/kit 1.22.5 → 1.22.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": "1.22.5",
3
+ "version": "1.22.6",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,7 +60,7 @@ async function analyse({ manifest_path, env }) {
60
60
  const node = await loader();
61
61
 
62
62
  metadata.nodes[node.index] = {
63
- has_server_load: node.server?.load !== undefined
63
+ has_server_load: node.server?.load !== undefined || node.server?.trailingSlash !== undefined
64
64
  };
65
65
  }
66
66
 
@@ -31,7 +31,7 @@ import { compact } from '../../utils/array.js';
31
31
  import { validate_page_exports } from '../../utils/exports.js';
32
32
  import { unwrap_promises } from '../../utils/promises.js';
33
33
  import { HttpError, Redirect } from '../control.js';
34
- import { INVALIDATED_PARAM, validate_depends } from '../shared.js';
34
+ import { INVALIDATED_PARAM, TRAILING_SLASH_PARAM, validate_depends } from '../shared.js';
35
35
  import { INDEX_KEY, PRELOAD_PRIORITIES, SCROLL_KEY, SNAPSHOT_KEY } from './constants.js';
36
36
  import { stores } from './singletons.js';
37
37
 
@@ -1819,6 +1819,9 @@ export function create_client(app, target) {
1819
1819
  async function load_data(url, invalid) {
1820
1820
  const data_url = new URL(url);
1821
1821
  data_url.pathname = add_data_suffix(url.pathname);
1822
+ if (url.pathname.endsWith('/')) {
1823
+ data_url.searchParams.append(TRAILING_SLASH_PARAM, '1');
1824
+ }
1822
1825
  if (DEV && url.searchParams.has(INVALIDATED_PARAM)) {
1823
1826
  throw new Error(`Cannot used reserved query parameter "${INVALIDATED_PARAM}"`);
1824
1827
  }
@@ -29,7 +29,7 @@ import {
29
29
  import { get_option } from '../../utils/options.js';
30
30
  import { error, json, text } from '../../exports/index.js';
31
31
  import { action_json_redirect, is_action_json_request } from './page/actions.js';
32
- import { INVALIDATED_PARAM } from '../shared.js';
32
+ import { INVALIDATED_PARAM, TRAILING_SLASH_PARAM } from '../shared.js';
33
33
 
34
34
  /* global __SVELTEKIT_ADAPTER_NAME__ */
35
35
 
@@ -100,7 +100,10 @@ export async function respond(request, options, manifest, state) {
100
100
  let invalidated_data_nodes;
101
101
  if (is_data_request) {
102
102
  decoded = strip_data_suffix(decoded) || '/';
103
- url.pathname = strip_data_suffix(url.pathname) || '/';
103
+ url.pathname =
104
+ strip_data_suffix(url.pathname) +
105
+ (url.searchParams.get(TRAILING_SLASH_PARAM) === '1' ? '/' : '') || '/';
106
+ url.searchParams.delete(TRAILING_SLASH_PARAM);
104
107
  invalidated_data_nodes = url.searchParams
105
108
  .get(INVALIDATED_PARAM)
106
109
  ?.split('')
@@ -12,3 +12,5 @@ export function validate_depends(route_id, dep) {
12
12
  }
13
13
 
14
14
  export const INVALIDATED_PARAM = 'x-sveltekit-invalidated';
15
+
16
+ export const TRAILING_SLASH_PARAM = 'x-sveltekit-trailing-slash';
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 = '1.22.5';
4
+ export const VERSION = '1.22.6';