@sveltejs/kit 1.15.3 → 1.15.4

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.15.3",
3
+ "version": "1.15.4",
4
4
  "description": "The fastest way to build Svelte apps",
5
5
  "repository": {
6
6
  "type": "git",
@@ -188,6 +188,9 @@ function kit({ svelte_config }) {
188
188
 
189
189
  const service_worker_entry_file = resolve_entry(kit.files.serviceWorker);
190
190
 
191
+ const sourcemapIgnoreList = /** @param {string} relative_path */ (relative_path) =>
192
+ relative_path.includes('node_modules') || relative_path.includes(kit.outDir);
193
+
191
194
  /** @type {import('vite').Plugin} */
192
195
  const plugin_setup = {
193
196
  name: 'vite-plugin-sveltekit-setup',
@@ -231,16 +234,17 @@ function kit({ svelte_config }) {
231
234
  },
232
235
  root: cwd,
233
236
  server: {
237
+ cors: { preflightContinue: true },
234
238
  fs: {
235
239
  allow: [...allow]
236
240
  },
241
+ sourcemapIgnoreList,
237
242
  watch: {
238
243
  ignored: [
239
244
  // Ignore all siblings of config.kit.outDir/generated
240
245
  `${posixify(kit.outDir)}/!(generated)`
241
246
  ]
242
- },
243
- cors: { preflightContinue: true }
247
+ }
244
248
  },
245
249
  preview: {
246
250
  cors: { preflightContinue: true }
@@ -563,7 +567,8 @@ function kit({ svelte_config }) {
563
567
  entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`,
564
568
  chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[name].[hash].${ext}`,
565
569
  assetFileNames: `${prefix}/assets/[name].[hash][extname]`,
566
- hoistTransitiveImports: false
570
+ hoistTransitiveImports: false,
571
+ sourcemapIgnoreList
567
572
  },
568
573
  preserveEntrySignatures: 'strict'
569
574
  },
@@ -1,6 +1,7 @@
1
1
  import { respond } from './respond.js';
2
2
  import { set_private_env, set_public_env } from '../shared-server.js';
3
3
  import { options, get_hooks } from '__SERVER__/internal.js';
4
+ import { DEV } from 'esm-env';
4
5
 
5
6
  export class Server {
6
7
  /** @type {import('types').SSROptions} */
@@ -35,14 +36,29 @@ export class Server {
35
36
  set_public_env(pub);
36
37
 
37
38
  if (!this.#options.hooks) {
38
- const module = await get_hooks();
39
+ try {
40
+ const module = await get_hooks();
39
41
 
40
- this.#options.hooks = {
41
- handle: module.handle || (({ event, resolve }) => resolve(event)),
42
- // @ts-expect-error
43
- handleError: module.handleError || (({ error }) => console.error(error?.stack)),
44
- handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request))
45
- };
42
+ this.#options.hooks = {
43
+ handle: module.handle || (({ event, resolve }) => resolve(event)),
44
+ // @ts-expect-error
45
+ handleError: module.handleError || (({ error }) => console.error(error?.stack)),
46
+ handleFetch: module.handleFetch || (({ request, fetch }) => fetch(request))
47
+ };
48
+ } catch (error) {
49
+ if (DEV) {
50
+ this.#options.hooks = {
51
+ handle: () => {
52
+ throw error;
53
+ },
54
+ // @ts-expect-error
55
+ handleError: ({ error }) => console.error(error?.stack),
56
+ handleFetch: ({ request, fetch }) => fetch(request)
57
+ };
58
+ } else {
59
+ throw error;
60
+ }
61
+ }
46
62
  }
47
63
  }
48
64