@sveltejs/kit 1.0.0-next.463 → 1.0.0-next.464
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
|
@@ -60,13 +60,13 @@ export function generate_manifest({ build_data, relative_path, routes, format =
|
|
|
60
60
|
if (!route.page && !route.endpoint) return;
|
|
61
61
|
|
|
62
62
|
return `{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
63
|
+
id: ${s(route.id)},
|
|
64
|
+
pattern: ${route.pattern},
|
|
65
|
+
names: ${s(route.names)},
|
|
66
|
+
types: ${s(route.types)},
|
|
67
|
+
page: ${route.page ? `{ layouts: ${get_nodes(route.page.layouts)}, errors: ${get_nodes(route.page.errors)}, leaf: ${route.page.leaf} }` : 'null'},
|
|
68
|
+
endpoint: ${route.endpoint ? loader(`${relative_path}/${build_data.server.vite_manifest[route.endpoint.file].file}`) : 'null'}
|
|
69
|
+
}`;
|
|
70
70
|
}).filter(Boolean).join(',\n\t\t\t\t')}
|
|
71
71
|
],
|
|
72
72
|
matchers: async () => {
|
|
@@ -76,3 +76,17 @@ export function generate_manifest({ build_data, relative_path, routes, format =
|
|
|
76
76
|
}
|
|
77
77
|
}`.replace(/^\t/gm, '');
|
|
78
78
|
}
|
|
79
|
+
|
|
80
|
+
/** @param {Array<number | undefined>} indexes */
|
|
81
|
+
function get_nodes(indexes) {
|
|
82
|
+
let string = indexes.map((n) => n ?? '').join(',');
|
|
83
|
+
|
|
84
|
+
if (indexes.at(-1) === undefined) {
|
|
85
|
+
// since JavaScript ignores trailing commas, we need to insert a dummy
|
|
86
|
+
// comma so that the array has the correct length if the last item
|
|
87
|
+
// is undefined
|
|
88
|
+
string += ',';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return `[${string}]`;
|
|
92
|
+
}
|
|
@@ -943,7 +943,7 @@ export function create_client({ target, base, trailing_slash }) {
|
|
|
943
943
|
|
|
944
944
|
/** @param {URL} url */
|
|
945
945
|
function get_navigation_intent(url) {
|
|
946
|
-
if (url
|
|
946
|
+
if (is_external_url(url)) return;
|
|
947
947
|
|
|
948
948
|
const path = decodeURI(url.pathname.slice(base.length) || '/');
|
|
949
949
|
|
|
@@ -962,6 +962,11 @@ export function create_client({ target, base, trailing_slash }) {
|
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
964
|
|
|
965
|
+
/** @param {URL} url */
|
|
966
|
+
function is_external_url(url) {
|
|
967
|
+
return url.origin !== location.origin || !url.pathname.startsWith(base);
|
|
968
|
+
}
|
|
969
|
+
|
|
965
970
|
/**
|
|
966
971
|
* @param {{
|
|
967
972
|
* url: URL;
|
|
@@ -1156,6 +1161,7 @@ export function create_client({ target, base, trailing_slash }) {
|
|
|
1156
1161
|
const trigger_prefetch = (event) => {
|
|
1157
1162
|
const { url, options } = find_anchor(event);
|
|
1158
1163
|
if (url && options.prefetch === '') {
|
|
1164
|
+
if (is_external_url(url)) return;
|
|
1159
1165
|
prefetch(url);
|
|
1160
1166
|
}
|
|
1161
1167
|
};
|