@sveltejs/kit 1.15.2 → 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,7 @@
1
1
  {
2
2
  "name": "@sveltejs/kit",
3
- "version": "1.15.2",
3
+ "version": "1.15.4",
4
+ "description": "The fastest way to build Svelte apps",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/sveltejs/kit",
@@ -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 }
@@ -550,7 +554,11 @@ function kit({ svelte_config }) {
550
554
  new_config = {
551
555
  base: ssr ? assets_base(kit) : './',
552
556
  build: {
557
+ copyPublicDir: !ssr,
553
558
  cssCodeSplit: true,
559
+ cssMinify: initial_config.build?.minify == null ? true : !!initial_config.build.minify,
560
+ // don't use the default name to avoid collisions with 'static/manifest.json'
561
+ manifest: 'vite-manifest.json',
554
562
  outDir: `${out}/${ssr ? 'server' : 'client'}`,
555
563
  rollupOptions: {
556
564
  input,
@@ -559,15 +567,13 @@ function kit({ svelte_config }) {
559
567
  entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`,
560
568
  chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[name].[hash].${ext}`,
561
569
  assetFileNames: `${prefix}/assets/[name].[hash][extname]`,
562
- hoistTransitiveImports: false
570
+ hoistTransitiveImports: false,
571
+ sourcemapIgnoreList
563
572
  },
564
573
  preserveEntrySignatures: 'strict'
565
574
  },
566
575
  ssrEmitAssets: true,
567
- copyPublicDir: !ssr,
568
- target: ssr ? 'node16.14' : undefined,
569
- // don't use the default name to avoid collisions with 'static/manifest.json'
570
- manifest: 'vite-manifest.json'
576
+ target: ssr ? 'node16.14' : undefined
571
577
  },
572
578
  publicDir: kit.files.assets,
573
579
  worker: {
@@ -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