@sveltejs/kit 1.3.1 → 1.3.3

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.3.1",
3
+ "version": "1.3.3",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",
@@ -984,7 +984,7 @@ export function create_client({ target, base }) {
984
984
  function get_navigation_intent(url, invalidating) {
985
985
  if (is_external_url(url, base)) return;
986
986
 
987
- const path = decode_pathname(url.pathname.slice(base.length) || '/');
987
+ const path = get_url_path(url);
988
988
 
989
989
  for (const route of routes) {
990
990
  const params = route.exec(path);
@@ -998,6 +998,11 @@ export function create_client({ target, base }) {
998
998
  }
999
999
  }
1000
1000
 
1001
+ /** @param {URL} url */
1002
+ function get_url_path(url) {
1003
+ return decode_pathname(url.pathname.slice(base.length) || '/');
1004
+ }
1005
+
1001
1006
  /**
1002
1007
  * @param {{
1003
1008
  * url: URL;
@@ -1175,7 +1180,9 @@ export function create_client({ target, base }) {
1175
1180
  (entries) => {
1176
1181
  for (const entry of entries) {
1177
1182
  if (entry.isIntersecting) {
1178
- preload_code(new URL(/** @type {HTMLAnchorElement} */ (entry.target).href).pathname);
1183
+ preload_code(
1184
+ get_url_path(new URL(/** @type {HTMLAnchorElement} */ (entry.target).href))
1185
+ );
1179
1186
  observer.unobserve(entry.target);
1180
1187
  }
1181
1188
  }
@@ -1200,7 +1207,7 @@ export function create_client({ target, base }) {
1200
1207
  if (priority <= options.preload_data) {
1201
1208
  preload_data(/** @type {URL} */ (url));
1202
1209
  } else if (priority <= options.preload_code) {
1203
- preload_code(/** @type {URL} */ (url).pathname);
1210
+ preload_code(get_url_path(/** @type {URL} */ (url)));
1204
1211
  }
1205
1212
  }
1206
1213
  }
@@ -1220,7 +1227,7 @@ export function create_client({ target, base }) {
1220
1227
  }
1221
1228
 
1222
1229
  if (options.preload_code === PRELOAD_PRIORITIES.eager) {
1223
- preload_code(/** @type {URL} */ (url).pathname);
1230
+ preload_code(get_url_path(/** @type {URL} */ (url)));
1224
1231
  }
1225
1232
  }
1226
1233
  }
package/src/utils/fork.js CHANGED
@@ -36,11 +36,10 @@ export function forked(module, callback) {
36
36
  */
37
37
  const fn = function (opts) {
38
38
  return new Promise((fulfil, reject) => {
39
- const script = fileURLToPath(new URL(module, import.meta.url));
40
-
41
- const child = child_process.fork(script, {
39
+ const child = child_process.fork(fileURLToPath(module), {
42
40
  stdio: 'inherit',
43
41
  env: {
42
+ ...process.env,
44
43
  SVELTEKIT_FORK: 'true'
45
44
  },
46
45
  serialization: 'advanced'
@@ -237,7 +237,7 @@ declare module '$app/navigation' {
237
237
  * Programmatically imports the code for routes that haven't yet been fetched.
238
238
  * Typically, you might call this to speed up subsequent navigation.
239
239
  *
240
- * You can specify routes by any matching pathname such as `/about` (to match `src/routes/about.svelte`) or `/blog/*` (to match `src/routes/blog/[slug].svelte`).
240
+ * You can specify routes by any matching pathname such as `/about` (to match `src/routes/about/+page.svelte`) or `/blog/*` (to match `src/routes/blog/[slug]/+page.svelte`).
241
241
  *
242
242
  * Unlike `preloadData`, this won't call `load` functions.
243
243
  * Returns a Promise that resolves when the modules have been imported.
package/types/index.d.ts CHANGED
@@ -1087,7 +1087,8 @@ export type ActionResult<
1087
1087
  /**
1088
1088
  * Creates an `HttpError` object with an HTTP status code and an optional message.
1089
1089
  * This object, if thrown during request handling, will cause SvelteKit to
1090
- * return an error response without invoking `handleError`
1090
+ * return an error response without invoking `handleError`.
1091
+ * Make sure you're not catching the thrown error, which results in a noop.
1091
1092
  * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
1092
1093
  * @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
1093
1094
  */
@@ -1110,6 +1111,7 @@ export interface HttpError {
1110
1111
 
1111
1112
  /**
1112
1113
  * Create a `Redirect` object. If thrown during request handling, SvelteKit will return a redirect response.
1114
+ * Make sure you're not catching the thrown redirect, which results in a noop.
1113
1115
  * @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#redirection_messages). Must be in the range 300-308.
1114
1116
  * @param location The location to redirect to.
1115
1117
  */