@sveltejs/kit 1.30.0 → 1.30.2

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.30.0",
3
+ "version": "1.30.2",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -71,7 +71,19 @@ export async function preview(vite, vite_config, svelte_config) {
71
71
 
72
72
  vite.middlewares.use((req, res, next) => {
73
73
  const original_url = /** @type {string} */ (req.url);
74
- const { pathname } = new URL(original_url, 'http://dummy');
74
+ const { pathname, search } = new URL(original_url, 'http://dummy');
75
+
76
+ // if `paths.base === '/a/b/c`, then the root route is `/a/b/c/`,
77
+ // regardless of the `trailingSlash` route option
78
+ if (base.length > 1 && pathname === base) {
79
+ let location = base + '/';
80
+ if (search) location += search;
81
+ res.writeHead(307, {
82
+ location
83
+ });
84
+ res.end();
85
+ return;
86
+ }
75
87
 
76
88
  if (pathname.startsWith(base)) {
77
89
  next();
@@ -572,7 +572,12 @@ export function create_client(app, target) {
572
572
  server: server_data_node,
573
573
  universal: node.universal?.load ? { type: 'data', data, uses } : null,
574
574
  data: data ?? server_data_node?.data ?? null,
575
- slash: node.universal?.trailingSlash ?? server_data_node?.slash
575
+ // if `paths.base === '/a/b/c`, then the root route is `/a/b/c/`,
576
+ // regardless of the `trailingSlash` route option
577
+ slash:
578
+ url.pathname === base || url.pathname === base + '/'
579
+ ? 'always'
580
+ : node.universal?.trailingSlash ?? server_data_node?.slash
576
581
  };
577
582
  }
578
583
 
@@ -220,8 +220,7 @@ async function call_action(event, actions) {
220
220
  }
221
221
 
222
222
  if (!is_form_content_type(event.request)) {
223
- throw error(
224
- 415,
223
+ throw new Error(
225
224
  `Actions expect form-encoded data (received ${event.request.headers.get('content-type')})`
226
225
  );
227
226
  }
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // generated during release, do not modify
2
2
 
3
3
  /** @type {string} */
4
- export const VERSION = '1.30.0';
4
+ export const VERSION = '1.30.2';