@sveltejs/kit 1.0.0-next.316 → 1.0.0-next.317
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/assets/client/start.js +9 -26
- package/dist/chunks/index4.js +3 -2
- package/dist/cli.js +2 -2
- package/package.json +1 -1
- package/types/index.d.ts +1 -1
- package/types/private.d.ts +2 -1
package/assets/client/start.js
CHANGED
|
@@ -492,9 +492,6 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
492
492
|
});
|
|
493
493
|
ready = true;
|
|
494
494
|
|
|
495
|
-
/** Keeps tracks of multiple navigations caused by redirects during rendering */
|
|
496
|
-
let navigating = 0;
|
|
497
|
-
|
|
498
495
|
let router_enabled = true;
|
|
499
496
|
|
|
500
497
|
// keeping track of the history index in order to prevent popstate navigation events if needed
|
|
@@ -529,9 +526,6 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
529
526
|
/** @type {{}} */
|
|
530
527
|
let token;
|
|
531
528
|
|
|
532
|
-
/** @type {{}} */
|
|
533
|
-
let navigating_token;
|
|
534
|
-
|
|
535
529
|
/**
|
|
536
530
|
* @param {string} href
|
|
537
531
|
* @param {{ noscroll?: boolean; replaceState?: boolean; keepfocus?: boolean; state?: any }} opts
|
|
@@ -577,6 +571,7 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
577
571
|
}
|
|
578
572
|
|
|
579
573
|
/**
|
|
574
|
+
* Returns `true` if update completes, `false` if it is aborted
|
|
580
575
|
* @param {URL} url
|
|
581
576
|
* @param {string[]} redirect_chain
|
|
582
577
|
* @param {boolean} no_cache
|
|
@@ -608,11 +603,11 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
608
603
|
|
|
609
604
|
if (!navigation_result) {
|
|
610
605
|
await native_navigation(url);
|
|
611
|
-
return; // unnecessary, but TypeScript prefers it this way
|
|
606
|
+
return false; // unnecessary, but TypeScript prefers it this way
|
|
612
607
|
}
|
|
613
608
|
|
|
614
609
|
// abort if user navigated during update
|
|
615
|
-
if (token !== current_token) return;
|
|
610
|
+
if (token !== current_token) return false;
|
|
616
611
|
|
|
617
612
|
invalidated.length = 0;
|
|
618
613
|
|
|
@@ -634,7 +629,7 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
634
629
|
await native_navigation(new URL(navigation_result.redirect, location.href));
|
|
635
630
|
}
|
|
636
631
|
|
|
637
|
-
return;
|
|
632
|
+
return false;
|
|
638
633
|
}
|
|
639
634
|
} else if (navigation_result.props?.page?.status >= 400) {
|
|
640
635
|
const updated = await stores.updated.check();
|
|
@@ -717,6 +712,8 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
717
712
|
|
|
718
713
|
const leaf_node = navigation_result.state.branch[navigation_result.state.branch.length - 1];
|
|
719
714
|
router_enabled = leaf_node?.module.router !== false;
|
|
715
|
+
|
|
716
|
+
return true;
|
|
720
717
|
}
|
|
721
718
|
|
|
722
719
|
/** @param {import('./types').NavigationResult} result */
|
|
@@ -1269,10 +1266,6 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
1269
1266
|
|
|
1270
1267
|
accepted();
|
|
1271
1268
|
|
|
1272
|
-
navigating++;
|
|
1273
|
-
|
|
1274
|
-
const current_navigating_token = (navigating_token = {});
|
|
1275
|
-
|
|
1276
1269
|
if (started) {
|
|
1277
1270
|
stores.navigating.set({
|
|
1278
1271
|
from: current.url,
|
|
@@ -1280,18 +1273,13 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
1280
1273
|
});
|
|
1281
1274
|
}
|
|
1282
1275
|
|
|
1283
|
-
await update(normalized, redirect_chain, false, {
|
|
1276
|
+
const completed = await update(normalized, redirect_chain, false, {
|
|
1284
1277
|
scroll,
|
|
1285
1278
|
keepfocus,
|
|
1286
1279
|
details
|
|
1287
1280
|
});
|
|
1288
1281
|
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
// navigation was aborted
|
|
1292
|
-
if (navigating_token !== current_navigating_token) return;
|
|
1293
|
-
|
|
1294
|
-
if (!navigating) {
|
|
1282
|
+
if (completed) {
|
|
1295
1283
|
const navigation = { from, to: normalized };
|
|
1296
1284
|
callbacks.after_navigate.forEach((fn) => fn(navigation));
|
|
1297
1285
|
|
|
@@ -1484,11 +1472,6 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
1484
1472
|
// Ignore if <a> has a target
|
|
1485
1473
|
if (is_svg_a_element ? a.target.baseVal : a.target) return;
|
|
1486
1474
|
|
|
1487
|
-
if (url.href === location.href) {
|
|
1488
|
-
if (!location.hash) event.preventDefault();
|
|
1489
|
-
return;
|
|
1490
|
-
}
|
|
1491
|
-
|
|
1492
1475
|
// Check if new url only differs by hash and use the browser default behavior in that case
|
|
1493
1476
|
// This will ensure the `hashchange` event is fired
|
|
1494
1477
|
// Removing the hash does a full page navigation in the browser, so make sure a hash is present
|
|
@@ -1513,7 +1496,7 @@ function create_client({ target, session, base, trailing_slash }) {
|
|
|
1513
1496
|
redirect_chain: [],
|
|
1514
1497
|
details: {
|
|
1515
1498
|
state: {},
|
|
1516
|
-
replaceState:
|
|
1499
|
+
replaceState: url.href === location.href
|
|
1517
1500
|
},
|
|
1518
1501
|
accepted: () => event.preventDefault(),
|
|
1519
1502
|
blocked: () => event.preventDefault()
|
package/dist/chunks/index4.js
CHANGED
|
@@ -42,11 +42,12 @@ function create_builder({ config, build_data, prerendered, log }) {
|
|
|
42
42
|
config,
|
|
43
43
|
prerendered,
|
|
44
44
|
|
|
45
|
-
createEntries(fn) {
|
|
45
|
+
async createEntries(fn) {
|
|
46
46
|
const { routes } = build_data.manifest_data;
|
|
47
47
|
|
|
48
48
|
/** @type {import('types').RouteDefinition[]} */
|
|
49
49
|
const facades = routes.map((route) => ({
|
|
50
|
+
id: route.id,
|
|
50
51
|
type: route.type,
|
|
51
52
|
segments: route.id.split('/').map((segment) => ({
|
|
52
53
|
dynamic: segment.includes('['),
|
|
@@ -90,7 +91,7 @@ function create_builder({ config, build_data, prerendered, log }) {
|
|
|
90
91
|
});
|
|
91
92
|
|
|
92
93
|
if (filtered.size > 0) {
|
|
93
|
-
complete({
|
|
94
|
+
await complete({
|
|
94
95
|
generateManifest: ({ relativePath, format }) =>
|
|
95
96
|
generate_manifest({
|
|
96
97
|
build_data,
|
package/dist/cli.js
CHANGED
|
@@ -870,7 +870,7 @@ async function launch(port, https, base) {
|
|
|
870
870
|
exec(`${cmd} ${https ? 'https' : 'http'}://localhost:${port}${base}`);
|
|
871
871
|
}
|
|
872
872
|
|
|
873
|
-
const prog = sade('svelte-kit').version('1.0.0-next.
|
|
873
|
+
const prog = sade('svelte-kit').version('1.0.0-next.317');
|
|
874
874
|
|
|
875
875
|
prog
|
|
876
876
|
.command('dev')
|
|
@@ -1049,7 +1049,7 @@ async function check_port(port) {
|
|
|
1049
1049
|
function welcome({ port, host, https, open, base, loose, allow, cwd }) {
|
|
1050
1050
|
if (open) launch(port, https, base);
|
|
1051
1051
|
|
|
1052
|
-
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.
|
|
1052
|
+
console.log($.bold().cyan(`\n SvelteKit v${'1.0.0-next.317'}\n`));
|
|
1053
1053
|
|
|
1054
1054
|
const protocol = https ? 'https:' : 'http:';
|
|
1055
1055
|
const exposed = typeof host !== 'undefined' && host !== 'localhost' && host !== '127.0.0.1';
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ export interface Builder {
|
|
|
38
38
|
* Create entry points that map to individual functions
|
|
39
39
|
* @param fn A function that groups a set of routes into an entry point
|
|
40
40
|
*/
|
|
41
|
-
createEntries(fn: (route: RouteDefinition) => AdapterEntry): void
|
|
41
|
+
createEntries(fn: (route: RouteDefinition) => AdapterEntry): Promise<void>;
|
|
42
42
|
|
|
43
43
|
generateManifest: (opts: { relativePath: string; format?: 'esm' | 'cjs' }) => string;
|
|
44
44
|
|
package/types/private.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ export interface AdapterEntry {
|
|
|
23
23
|
*/
|
|
24
24
|
complete: (entry: {
|
|
25
25
|
generateManifest: (opts: { relativePath: string; format?: 'esm' | 'cjs' }) => string;
|
|
26
|
-
}) => void
|
|
26
|
+
}) => Promise<void>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
29
|
// Based on https://github.com/josh-hemphill/csp-typed-directives/blob/latest/src/csp.types.ts
|
|
@@ -222,6 +222,7 @@ export interface ResolveOptions {
|
|
|
222
222
|
export type ResponseHeaders = Record<string, string | number | string[]>;
|
|
223
223
|
|
|
224
224
|
export interface RouteDefinition {
|
|
225
|
+
id: string;
|
|
225
226
|
type: 'page' | 'endpoint';
|
|
226
227
|
pattern: RegExp;
|
|
227
228
|
segments: RouteSegment[];
|