@sveltejs/kit 1.11.0 → 1.12.0
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
|
+
"version": "1.12.0",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/sveltejs/kit",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"set-cookie-parser": "^2.5.1",
|
|
23
23
|
"sirv": "^2.0.2",
|
|
24
24
|
"tiny-glob": "^0.2.9",
|
|
25
|
-
"undici": "5.
|
|
25
|
+
"undici": "5.21.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@playwright/test": "^1.29.2",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@types/set-cookie-parser": "^2.4.2",
|
|
35
35
|
"marked": "^4.2.3",
|
|
36
36
|
"rollup": "^3.7.0",
|
|
37
|
-
"svelte": "^3.
|
|
37
|
+
"svelte": "^3.56.0",
|
|
38
38
|
"svelte-preprocess": "^5.0.0",
|
|
39
39
|
"typescript": "^4.9.4",
|
|
40
40
|
"uvu": "^0.5.6",
|
|
@@ -179,12 +179,15 @@ export function crawl(html, base) {
|
|
|
179
179
|
let insideURL = true;
|
|
180
180
|
value = value.trim();
|
|
181
181
|
for (let i = 0; i < value.length; i++) {
|
|
182
|
-
if (
|
|
182
|
+
if (
|
|
183
|
+
value[i] === ',' &&
|
|
184
|
+
(!insideURL || (insideURL && WHITESPACE.test(value[i + 1])))
|
|
185
|
+
) {
|
|
183
186
|
candidates.push(value.slice(0, i));
|
|
184
187
|
value = value.substring(i + 1).trim();
|
|
185
188
|
i = 0;
|
|
186
189
|
insideURL = true;
|
|
187
|
-
} else if (value[i]
|
|
190
|
+
} else if (WHITESPACE.test(value[i])) {
|
|
188
191
|
insideURL = false;
|
|
189
192
|
}
|
|
190
193
|
}
|
|
@@ -176,7 +176,12 @@ function load_user_tsconfig(cwd) {
|
|
|
176
176
|
function validate_user_config(kit, cwd, out, config) {
|
|
177
177
|
// we need to check that the user's tsconfig extends the framework config
|
|
178
178
|
const extend = config.options.extends;
|
|
179
|
-
const extends_framework_config =
|
|
179
|
+
const extends_framework_config =
|
|
180
|
+
typeof extend === 'string'
|
|
181
|
+
? path.resolve(cwd, extend) === out
|
|
182
|
+
: Array.isArray(extend)
|
|
183
|
+
? extend.some((e) => path.resolve(cwd, e) === out)
|
|
184
|
+
: false;
|
|
180
185
|
|
|
181
186
|
const options = config.options.compilerOptions || {};
|
|
182
187
|
|
package/src/runtime/app/forms.js
CHANGED
|
@@ -277,6 +277,9 @@ export function create_client(app, target) {
|
|
|
277
277
|
let navigation_result = intent && (await load_route(intent));
|
|
278
278
|
|
|
279
279
|
if (!navigation_result) {
|
|
280
|
+
if (is_external_url(url, base)) {
|
|
281
|
+
return await native_navigation(url);
|
|
282
|
+
}
|
|
280
283
|
navigation_result = await server_fallback(
|
|
281
284
|
url,
|
|
282
285
|
{ id: null },
|
|
@@ -1190,7 +1193,7 @@ export function create_client(app, target) {
|
|
|
1190
1193
|
});
|
|
1191
1194
|
}
|
|
1192
1195
|
|
|
1193
|
-
if (__SVELTEKIT_DEV__) {
|
|
1196
|
+
if (__SVELTEKIT_DEV__ && status !== 404) {
|
|
1194
1197
|
console.error(
|
|
1195
1198
|
'An error occurred while loading the page. This will cause a full page reload. (This message will only appear during development.)'
|
|
1196
1199
|
);
|
|
@@ -1569,11 +1572,11 @@ export function create_client(app, target) {
|
|
|
1569
1572
|
navigate({
|
|
1570
1573
|
url,
|
|
1571
1574
|
scroll: options.noscroll ? scroll_state() : null,
|
|
1572
|
-
keepfocus: false,
|
|
1575
|
+
keepfocus: options.keep_focus ?? false,
|
|
1573
1576
|
redirect_chain: [],
|
|
1574
1577
|
details: {
|
|
1575
1578
|
state: {},
|
|
1576
|
-
replaceState: url.href === location.href
|
|
1579
|
+
replaceState: options.replace_state ?? url.href === location.href
|
|
1577
1580
|
},
|
|
1578
1581
|
accepted: () => event.preventDefault(),
|
|
1579
1582
|
blocked: () => event.preventDefault(),
|
|
@@ -1604,7 +1607,7 @@ export function create_client(app, target) {
|
|
|
1604
1607
|
|
|
1605
1608
|
const event_form = /** @type {HTMLFormElement} */ (event.target);
|
|
1606
1609
|
|
|
1607
|
-
const { noscroll, reload } = get_router_options(event_form);
|
|
1610
|
+
const { keep_focus, noscroll, reload, replace_state } = get_router_options(event_form);
|
|
1608
1611
|
if (reload) return;
|
|
1609
1612
|
|
|
1610
1613
|
event.preventDefault();
|
|
@@ -1623,11 +1626,11 @@ export function create_client(app, target) {
|
|
|
1623
1626
|
navigate({
|
|
1624
1627
|
url,
|
|
1625
1628
|
scroll: noscroll ? scroll_state() : null,
|
|
1626
|
-
keepfocus: false,
|
|
1629
|
+
keepfocus: keep_focus ?? false,
|
|
1627
1630
|
redirect_chain: [],
|
|
1628
1631
|
details: {
|
|
1629
1632
|
state: {},
|
|
1630
|
-
replaceState:
|
|
1633
|
+
replaceState: replace_state ?? url.href === location.href
|
|
1631
1634
|
},
|
|
1632
1635
|
nav_token: {},
|
|
1633
1636
|
accepted: () => {},
|
|
@@ -32,8 +32,10 @@ const warned = new WeakSet();
|
|
|
32
32
|
const valid_link_options = /** @type {const} */ ({
|
|
33
33
|
'preload-code': ['', 'off', 'tap', 'hover', 'viewport', 'eager'],
|
|
34
34
|
'preload-data': ['', 'off', 'tap', 'hover'],
|
|
35
|
+
keepfocus: ['', 'off'],
|
|
35
36
|
noscroll: ['', 'off'],
|
|
36
|
-
reload: ['', 'off']
|
|
37
|
+
reload: ['', 'off'],
|
|
38
|
+
replacestate: ['', 'off']
|
|
37
39
|
});
|
|
38
40
|
|
|
39
41
|
/**
|
|
@@ -141,6 +143,9 @@ export function get_link_info(a, base) {
|
|
|
141
143
|
* @param {HTMLFormElement | HTMLAnchorElement | SVGAElement} element
|
|
142
144
|
*/
|
|
143
145
|
export function get_router_options(element) {
|
|
146
|
+
/** @type {ValidLinkOptions<'keepfocus'> | null} */
|
|
147
|
+
let keep_focus = null;
|
|
148
|
+
|
|
144
149
|
/** @type {ValidLinkOptions<'noscroll'> | null} */
|
|
145
150
|
let noscroll = null;
|
|
146
151
|
|
|
@@ -153,14 +158,19 @@ export function get_router_options(element) {
|
|
|
153
158
|
/** @type {ValidLinkOptions<'reload'> | null} */
|
|
154
159
|
let reload = null;
|
|
155
160
|
|
|
161
|
+
/** @type {ValidLinkOptions<'replacestate'> | null} */
|
|
162
|
+
let replace_state = null;
|
|
163
|
+
|
|
156
164
|
/** @type {Element} */
|
|
157
165
|
let el = element;
|
|
158
166
|
|
|
159
167
|
while (el && el !== document.documentElement) {
|
|
160
168
|
if (preload_code === null) preload_code = link_option(el, 'preload-code');
|
|
161
169
|
if (preload_data === null) preload_data = link_option(el, 'preload-data');
|
|
170
|
+
if (keep_focus === null) keep_focus = link_option(el, 'keepfocus');
|
|
162
171
|
if (noscroll === null) noscroll = link_option(el, 'noscroll');
|
|
163
172
|
if (reload === null) reload = link_option(el, 'reload');
|
|
173
|
+
if (replace_state === null) replace_state = link_option(el, 'replacestate');
|
|
164
174
|
|
|
165
175
|
el = /** @type {Element} */ (parent_element(el));
|
|
166
176
|
}
|
|
@@ -168,8 +178,10 @@ export function get_router_options(element) {
|
|
|
168
178
|
return {
|
|
169
179
|
preload_code: levels[preload_code ?? 'off'],
|
|
170
180
|
preload_data: levels[preload_data ?? 'off'],
|
|
181
|
+
keep_focus: keep_focus === 'off' ? false : keep_focus === '' ? true : null,
|
|
171
182
|
noscroll: noscroll === 'off' ? false : noscroll === '' ? true : null,
|
|
172
|
-
reload: reload === 'off' ? false : reload === '' ? true : null
|
|
183
|
+
reload: reload === 'off' ? false : reload === '' ? true : null,
|
|
184
|
+
replace_state: replace_state === 'off' ? false : replace_state === '' ? true : null
|
|
173
185
|
};
|
|
174
186
|
}
|
|
175
187
|
|