@sveltejs/kit 2.1.0 → 2.1.1

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.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -349,6 +349,7 @@ export interface KitConfig {
349
349
  };
350
350
  /**
351
351
  * Whether or not the app is embedded inside a larger app. If `true`, SvelteKit will add its event listeners related to navigation etc on the parent of `%sveltekit.body%` instead of `window`, and will pass `params` from the server rather than inferring them from `location.pathname`.
352
+ * Note that it is generally not supported to embed multiple SvelteKit apps on the same page and use client-side SvelteKit features within them (things such as pushing to the history state assume a single instance).
352
353
  * @default false
353
354
  */
354
355
  embedded?: boolean;
@@ -441,10 +441,19 @@ async function get_navigation_result_from_branch({
441
441
  }) {
442
442
  /** @type {import('types').TrailingSlash} */
443
443
  let slash = 'never';
444
- for (const node of branch) {
445
- if (node?.slash !== undefined) slash = node.slash;
444
+
445
+ // if `paths.base === '/a/b/c`, then the root route is always `/a/b/c/`, regardless of
446
+ // the `trailingSlash` route option, so that relative paths to JS and CSS work
447
+ if (base && (url.pathname === base || url.pathname === base + '/')) {
448
+ slash = 'always';
449
+ } else {
450
+ for (const node of branch) {
451
+ if (node?.slash !== undefined) slash = node.slash;
452
+ }
446
453
  }
454
+
447
455
  url.pathname = normalize_path(url.pathname, slash);
456
+
448
457
  // eslint-disable-next-line
449
458
  url.search = url.search; // turn `/?` into `/`
450
459
 
@@ -694,12 +703,7 @@ async function load_node({ loader, parent, url, params, route, server_data_node
694
703
  server: server_data_node,
695
704
  universal: node.universal?.load ? { type: 'data', data, uses } : null,
696
705
  data: data ?? server_data_node?.data ?? null,
697
- // if `paths.base === '/a/b/c`, then the root route is always `/a/b/c/`, regardless of
698
- // the `trailingSlash` route option, so that relative paths to JS and CSS work
699
- slash:
700
- base && (url.pathname === base || url.pathname === base + '/')
701
- ? 'always'
702
- : node.universal?.trailingSlash ?? server_data_node?.slash
706
+ slash: node.universal?.trailingSlash ?? server_data_node?.slash
703
707
  };
704
708
  }
705
709
 
@@ -1117,7 +1121,7 @@ function _before_navigate({ url, type, intent, delta }) {
1117
1121
  ...nav.navigation,
1118
1122
  cancel: () => {
1119
1123
  should_block = true;
1120
- nav.reject(new Error('navigation was cancelled'));
1124
+ nav.reject(new Error('navigation cancelled'));
1121
1125
  }
1122
1126
  };
1123
1127
 
@@ -1206,7 +1210,7 @@ async function navigate({
1206
1210
 
1207
1211
  // abort if user navigated during update
1208
1212
  if (token !== nav_token) {
1209
- nav.reject(new Error('navigation was aborted'));
1213
+ nav.reject(new Error('navigation aborted'));
1210
1214
  return false;
1211
1215
  }
1212
1216
 
@@ -1899,7 +1903,7 @@ function _start_router() {
1899
1903
  ...nav.navigation,
1900
1904
  cancel: () => {
1901
1905
  should_block = true;
1902
- nav.reject(new Error('navigation was cancelled'));
1906
+ nav.reject(new Error('navigation cancelled'));
1903
1907
  }
1904
1908
  };
1905
1909
 
@@ -62,12 +62,9 @@ export function parse_route_id(id) {
62
62
  );
63
63
  }
64
64
 
65
- const match = param_pattern.exec(content);
66
- if (!match) {
67
- throw new Error(
68
- `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
69
- );
70
- }
65
+ // We know the match cannot be null because manifest generation would have
66
+ // if we hit an invalid param/matcher name with non-alphanumeric character.
67
+ const match = /** @type {RegExpExecArray} */ (param_pattern.exec(content));
71
68
 
72
69
  const [, is_optional, is_rest, name, matcher] = match;
73
70
  // It's assumed that the following invalid route id cases are already checked
package/src/utils/url.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BROWSER } from 'esm-env';
1
+ import { BROWSER, DEV } from 'esm-env';
2
2
 
3
3
  /**
4
4
  * Matches a URI scheme. See https://www.rfc-editor.org/rfc/rfc3986#section-3.1
@@ -146,7 +146,9 @@ export function make_trackable(url, callback, search_params_callback) {
146
146
  };
147
147
  }
148
148
 
149
- disable_hash(tracked);
149
+ if (DEV || !BROWSER) {
150
+ disable_hash(tracked);
151
+ }
150
152
 
151
153
  return tracked;
152
154
  }
@@ -155,7 +157,7 @@ export function make_trackable(url, callback, search_params_callback) {
155
157
  * Disallow access to `url.hash` on the server and in `load`
156
158
  * @param {URL} url
157
159
  */
158
- export function disable_hash(url) {
160
+ function disable_hash(url) {
159
161
  allow_nodejs_console_log(url);
160
162
 
161
163
  Object.defineProperty(url, 'hash', {
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.1.0';
4
+ export const VERSION = '2.1.1';
package/types/index.d.ts CHANGED
@@ -331,6 +331,7 @@ declare module '@sveltejs/kit' {
331
331
  };
332
332
  /**
333
333
  * Whether or not the app is embedded inside a larger app. If `true`, SvelteKit will add its event listeners related to navigation etc on the parent of `%sveltekit.body%` instead of `window`, and will pass `params` from the server rather than inferring them from `location.pathname`.
334
+ * Note that it is generally not supported to embed multiple SvelteKit apps on the same page and use client-side SvelteKit features within them (things such as pushing to the history state assume a single instance).
334
335
  * @default false
335
336
  */
336
337
  embedded?: boolean;
@@ -143,5 +143,5 @@
143
143
  null,
144
144
  null
145
145
  ],
146
- "mappings": ";;;;;;;;;kBA2BiBA,OAAOA;;;;;;;;;;;;aAYZC,cAAcA;;;;;;aAMdC,cAAcA;;;;;;;;;;;;;;;kBAeTC,aAAaA;;;;;;;;;;;;;;;;kBAgBbC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4FPC,MAAMA;;;;;;;;;;;;;;;;;;;;;kBAqBNC,OAAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAyDPC,SAASA;;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