@sveltejs/kit 1.0.0-next.284 → 1.0.0-next.285

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.
@@ -445,20 +445,13 @@ class Router {
445
445
 
446
446
  accepted();
447
447
 
448
- if (!this.navigating) {
449
- dispatchEvent(new CustomEvent('sveltekit:navigation-start'));
450
- }
451
448
  this.navigating++;
452
449
 
453
450
  const pathname = normalize_path(url.pathname, this.trailing_slash);
454
451
 
455
452
  info.url = new URL(url.origin + pathname + url.search + url.hash);
456
453
 
457
- if (details) {
458
- const change = details.replaceState ? 0 : 1;
459
- details.state['sveltekit:index'] = this.current_history_index += change;
460
- history[details.replaceState ? 'replaceState' : 'pushState'](details.state, '', info.url);
461
- }
454
+ const token = (this.navigating_token = {});
462
455
 
463
456
  await this.renderer.handle_navigation(info, chain, false, {
464
457
  scroll,
@@ -466,12 +459,19 @@ class Router {
466
459
  });
467
460
 
468
461
  this.navigating--;
469
- if (!this.navigating) {
470
- dispatchEvent(new CustomEvent('sveltekit:navigation-end'));
471
462
 
463
+ // navigation was aborted
464
+ if (this.navigating_token !== token) return;
465
+ if (!this.navigating) {
472
466
  const navigation = { from, to: url };
473
467
  this.callbacks.after_navigate.forEach((fn) => fn(navigation));
474
468
  }
469
+
470
+ if (details) {
471
+ const change = details.replaceState ? 0 : 1;
472
+ details.state['sveltekit:index'] = this.current_history_index += change;
473
+ history[details.replaceState ? 'replaceState' : 'pushState'](details.state, '', info.url);
474
+ }
475
475
  }
476
476
  }
477
477
 
@@ -898,11 +898,10 @@ class Renderer {
898
898
  });
899
899
  } else {
900
900
  if (this.router) {
901
- this.router.goto(
902
- new URL(navigation_result.redirect, info.url).href,
903
- { replaceState: true },
904
- [...chain, info.url.pathname]
905
- );
901
+ this.router.goto(new URL(navigation_result.redirect, info.url).href, {}, [
902
+ ...chain,
903
+ info.url.pathname
904
+ ]);
906
905
  } else {
907
906
  location.href = new URL(navigation_result.redirect, location.href).href;
908
907
  }
@@ -1637,8 +1637,6 @@ async function load_node({
1637
1637
  }
1638
1638
  }
1639
1639
 
1640
- opts.headers.set('referer', event.url.href);
1641
-
1642
1640
  const resolved = resolve(event.url.pathname, requested.split('?')[0]);
1643
1641
 
1644
1642
  /** @type {Response} */
package/dist/cli.js CHANGED
@@ -998,7 +998,7 @@ async function launch(port, https) {
998
998
  exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}`);
999
999
  }
1000
1000
 
1001
- const prog = sade('svelte-kit').version('1.0.0-next.284');
1001
+ const prog = sade('svelte-kit').version('1.0.0-next.285');
1002
1002
 
1003
1003
  prog
1004
1004
  .command('dev')
@@ -1156,7 +1156,7 @@ async function check_port(port) {
1156
1156
  function welcome({ port, host, https, open, loose, allow, cwd }) {
1157
1157
  if (open) launch(port, https);
1158
1158
 
1159
- console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.284'}\n`));
1159
+ console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.285'}\n`));
1160
1160
 
1161
1161
  const protocol = https ? 'https:' : 'http:';
1162
1162
  const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.0.0-next.284",
3
+ "version": "1.0.0-next.285",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/sveltejs/kit",