@sveltejs/kit 1.15.8 → 1.15.10

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.15.8",
3
+ "version": "1.15.10",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -11,7 +11,7 @@
11
11
  "homepage": "https://kit.svelte.dev",
12
12
  "type": "module",
13
13
  "dependencies": {
14
- "@sveltejs/vite-plugin-svelte": "^2.1.0",
14
+ "@sveltejs/vite-plugin-svelte": "^2.1.1",
15
15
  "@types/cookie": "^0.5.1",
16
16
  "cookie": "^0.5.0",
17
17
  "devalue": "^4.3.0",
@@ -20,13 +20,13 @@
20
20
  "magic-string": "^0.30.0",
21
21
  "mime": "^3.0.0",
22
22
  "sade": "^1.8.1",
23
- "set-cookie-parser": "^2.5.1",
23
+ "set-cookie-parser": "^2.6.0",
24
24
  "sirv": "^2.0.2",
25
25
  "tiny-glob": "^0.2.9",
26
26
  "undici": "~5.22.0"
27
27
  },
28
28
  "devDependencies": {
29
- "@playwright/test": "^1.29.2",
29
+ "@playwright/test": "1.30.0",
30
30
  "@types/connect": "^3.4.35",
31
31
  "@types/marked": "^4.0.7",
32
32
  "@types/mime": "^3.0.1",
@@ -1532,7 +1532,6 @@ export function create_client(app, target) {
1532
1532
  if (hash !== undefined && nonhash === location.href.split('#')[0]) {
1533
1533
  // set this flag to distinguish between navigations triggered by
1534
1534
  // clicking a hash link and those triggered by popstate
1535
- // TODO why not update history here directly?
1536
1535
  hash_navigating = true;
1537
1536
 
1538
1537
  update_scroll_positions(current_history_index);
@@ -1541,7 +1540,11 @@ export function create_client(app, target) {
1541
1540
  stores.page.set({ ...page, url });
1542
1541
  stores.page.notify();
1543
1542
 
1544
- return;
1543
+ if (!options.replace_state) return;
1544
+
1545
+ // hashchange event shouldn't occur if the router is replacing state.
1546
+ hash_navigating = false;
1547
+ event.preventDefault();
1545
1548
  }
1546
1549
 
1547
1550
  navigate({
@@ -41,8 +41,7 @@ export class Server {
41
41
 
42
42
  this.#options.hooks = {
43
43
  handle: module.handle || (({ event, resolve }) => resolve(event)),
44
- // @ts-expect-error
45
- handleError: module.handleError || (({ error }) => console.error(error?.stack)),
44
+ handleError: module.handleError || (({ error }) => console.error(error)),
46
45
  handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request))
47
46
  };
48
47
  } catch (error) {
@@ -51,8 +50,7 @@ export class Server {
51
50
  handle: () => {
52
51
  throw error;
53
52
  },
54
- // @ts-expect-error
55
- handleError: ({ error }) => console.error(error?.stack),
53
+ handleError: ({ error }) => console.error(error),
56
54
  handleFetch: ({ request, fetch }) => fetch(request)
57
55
  };
58
56
  } else {
@@ -175,7 +175,7 @@ export async function respond(request, options, manifest, state) {
175
175
 
176
176
  try {
177
177
  // determine whether we need to redirect to add/remove a trailing slash
178
- if (route && !is_data_request) {
178
+ if (route) {
179
179
  // if `paths.base === '/a/b/c`, then the root route is `/a/b/c/`,
180
180
  // regardless of the `trailingSlash` route option
181
181
  if (url.pathname === base || url.pathname === base + '/') {
@@ -217,19 +217,21 @@ export async function respond(request, options, manifest, state) {
217
217
  }
218
218
  }
219
219
 
220
- const normalized = normalize_path(url.pathname, trailing_slash ?? 'never');
221
-
222
- if (normalized !== url.pathname && !state.prerendering?.fallback) {
223
- return new Response(undefined, {
224
- status: 308,
225
- headers: {
226
- 'x-sveltekit-normalize': '1',
227
- location:
228
- // ensure paths starting with '//' are not treated as protocol-relative
229
- (normalized.startsWith('//') ? url.origin + normalized : normalized) +
230
- (url.search === '?' ? '' : url.search)
231
- }
232
- });
220
+ if (!is_data_request) {
221
+ const normalized = normalize_path(url.pathname, trailing_slash ?? 'never');
222
+
223
+ if (normalized !== url.pathname && !state.prerendering?.fallback) {
224
+ return new Response(undefined, {
225
+ status: 308,
226
+ headers: {
227
+ 'x-sveltekit-normalize': '1',
228
+ location:
229
+ // ensure paths starting with '//' are not treated as protocol-relative
230
+ (normalized.startsWith('//') ? url.origin + normalized : normalized) +
231
+ (url.search === '?' ? '' : url.search)
232
+ }
233
+ });
234
+ }
233
235
  }
234
236
  }
235
237