@sveltejs/kit 1.5.5 → 1.5.6
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
|
@@ -179,6 +179,9 @@ function kit({ svelte_config }) {
|
|
|
179
179
|
/** @type {() => Promise<void>} */
|
|
180
180
|
let finalise;
|
|
181
181
|
|
|
182
|
+
/** @type {import('vite').UserConfig} */
|
|
183
|
+
let initial_config;
|
|
184
|
+
|
|
182
185
|
const service_worker_entry_file = resolve_entry(kit.files.serviceWorker);
|
|
183
186
|
|
|
184
187
|
/** @type {import('vite').Plugin} */
|
|
@@ -190,6 +193,7 @@ function kit({ svelte_config }) {
|
|
|
190
193
|
* @see https://vitejs.dev/guide/api-plugin.html#config
|
|
191
194
|
*/
|
|
192
195
|
async config(config, config_env) {
|
|
196
|
+
initial_config = config;
|
|
193
197
|
vite_config_env = config_env;
|
|
194
198
|
is_build = config_env.command === 'build';
|
|
195
199
|
|
|
@@ -634,7 +638,7 @@ export function set_assets(path) {
|
|
|
634
638
|
logLevel: vite_config.logLevel,
|
|
635
639
|
clearScreen: vite_config.clearScreen,
|
|
636
640
|
build: {
|
|
637
|
-
minify:
|
|
641
|
+
minify: initial_config.build?.minify,
|
|
638
642
|
assetsInlineLimit: vite_config.build.assetsInlineLimit,
|
|
639
643
|
sourcemap: vite_config.build.sourcemap
|
|
640
644
|
},
|
|
@@ -311,7 +311,7 @@ export function create_client({ target }) {
|
|
|
311
311
|
);
|
|
312
312
|
return false;
|
|
313
313
|
}
|
|
314
|
-
} else if (/** @type {number} */ (navigation_result.props
|
|
314
|
+
} else if (/** @type {number} */ (navigation_result.props.page?.status) >= 400) {
|
|
315
315
|
const updated = await stores.updated.check();
|
|
316
316
|
if (updated) {
|
|
317
317
|
await native_navigation(url);
|
|
@@ -331,6 +331,14 @@ export function create_client({ target }) {
|
|
|
331
331
|
capture_snapshot(previous_history_index);
|
|
332
332
|
}
|
|
333
333
|
|
|
334
|
+
// ensure the url pathname matches the page's trailing slash option
|
|
335
|
+
if (
|
|
336
|
+
navigation_result.props.page?.url &&
|
|
337
|
+
navigation_result.props.page.url.pathname !== url.pathname
|
|
338
|
+
) {
|
|
339
|
+
url.pathname = navigation_result.props.page?.url.pathname;
|
|
340
|
+
}
|
|
341
|
+
|
|
334
342
|
if (opts && opts.details) {
|
|
335
343
|
const { details } = opts;
|
|
336
344
|
const change = details.replaceState ? 0 : 1;
|
|
@@ -355,6 +363,7 @@ export function create_client({ target }) {
|
|
|
355
363
|
if (started) {
|
|
356
364
|
current = navigation_result.state;
|
|
357
365
|
|
|
366
|
+
// reset url before updating page store
|
|
358
367
|
if (navigation_result.props.page) {
|
|
359
368
|
navigation_result.props.page.url = url;
|
|
360
369
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1129,7 +1129,7 @@ export type ActionResult<
|
|
|
1129
1129
|
* Creates an `HttpError` object with an HTTP status code and an optional message.
|
|
1130
1130
|
* This object, if thrown during request handling, will cause SvelteKit to
|
|
1131
1131
|
* return an error response without invoking `handleError`.
|
|
1132
|
-
* Make sure you're not catching the thrown error, which
|
|
1132
|
+
* Make sure you're not catching the thrown error, which would prevent SvelteKit from handling it.
|
|
1133
1133
|
* @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.
|
|
1134
1134
|
* @param body An object that conforms to the App.Error type. If a string is passed, it will be used as the message property.
|
|
1135
1135
|
*/
|
|
@@ -1152,7 +1152,7 @@ export interface HttpError {
|
|
|
1152
1152
|
|
|
1153
1153
|
/**
|
|
1154
1154
|
* Create a `Redirect` object. If thrown during request handling, SvelteKit will return a redirect response.
|
|
1155
|
-
* Make sure you're not catching the thrown redirect, which
|
|
1155
|
+
* Make sure you're not catching the thrown redirect, which would prevent SvelteKit from handling it.
|
|
1156
1156
|
* @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.
|
|
1157
1157
|
* @param location The location to redirect to.
|
|
1158
1158
|
*/
|