Repository: sveltejs/kit
Pull request #9619 (2023-04-08 03:33:01)

feat: set `sourcemapIgnoreList` to filter out non-source directories
closes https://github.com/sveltejs/kit/issues/9306

FYI @bmeurer 

changeset-bot[bot]: ###  🦋  Changeset detected

Latest commit: 48da665354f930f064102adc50687c573375ee61

**The changes in this PR will be included in the next version bump.**

<details><summary>This PR includes changesets to release 1 package</summary>

  | Name          | Type  |
| ------------- | ----- |
| @sveltejs/kit | Patch |

</details>

Not sure what this means? [Click here  to learn what changesets are](https://github.com/changesets/changesets/blob/main/docs/adding-a-changeset.md).

[Click here if you're a maintainer who wants to add another changeset to this PR](https://github.com/sveltejs/kit/new/sourcemapIgnoreList?filename=.changeset/fair-cheetahs-design.md&value=---%0A%22%40sveltejs%2Fkit%22%3A%20patch%0A---%0A%0Afeat%3A%20set%20%60sourcemapIgnoreList%60%20to%20filter%20out%20non-source%20directories%0A)



Patch:
diff --git a/.changeset/grumpy-years-know.md b/.changeset/grumpy-years-know.md
new file mode 100644
index 000000000..b8d93f7d2
--- /dev/null
+++ b/.changeset/grumpy-years-know.md
@@ -0,0 +1,5 @@
+---
+'@sveltejs/kit': patch
+---
+
+feat: set sourcemapIgnoreList to filter out non-source directories
diff --git a/package.json b/package.json
index c949c5b93..4376af29b 100644
--- a/package.json
+++ b/package.json
@@ -41,7 +41,7 @@
 		"tiny-glob": "^0.2.9",
 		"typescript": "^4.9.4"
 	},
-	"packageManager": "pnpm@7.31.0",
+	"packageManager": "pnpm@7.32.0",
 	"engines": {
 		"pnpm": "^7.0.0"
 	},
diff --git a/packages/adapter-auto/package.json b/packages/adapter-auto/package.json
index 5f71889d1..5922f88ce 100644
--- a/packages/adapter-auto/package.json
+++ b/packages/adapter-auto/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/adapter-auto",
 	"version": "2.0.0",
+	"description": "Automatically chooses the SvelteKit adapter for your current environment, if possible.",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/adapter-cloudflare-workers/package.json b/packages/adapter-cloudflare-workers/package.json
index 864e14a77..9ba6153e1 100644
--- a/packages/adapter-cloudflare-workers/package.json
+++ b/packages/adapter-cloudflare-workers/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/adapter-cloudflare-workers",
 	"version": "1.1.0",
+	"description": "SvelteKit adapter that creates a Cloudflare Workers site using a function for dynamic server rendering",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/adapter-cloudflare/package.json b/packages/adapter-cloudflare/package.json
index 20094afb7..77a30bddd 100644
--- a/packages/adapter-cloudflare/package.json
+++ b/packages/adapter-cloudflare/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/adapter-cloudflare",
 	"version": "2.2.0",
+	"description": "Adapter for building SvelteKit applications on Cloudflare Pages with Workers integration",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/adapter-netlify/package.json b/packages/adapter-netlify/package.json
index 9708d4c44..a7009d3c2 100644
--- a/packages/adapter-netlify/package.json
+++ b/packages/adapter-netlify/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/adapter-netlify",
 	"version": "2.0.6",
+	"description": "A SvelteKit adapter that creates a Netlify app",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
@@ -44,7 +45,7 @@
 		"@sveltejs/kit": "workspace:^",
 		"@types/node": "^16.18.6",
 		"@types/set-cookie-parser": "^2.4.2",
-		"rimraf": "^4.0.0",
+		"rimraf": "^5.0.0",
 		"rollup": "^3.7.0",
 		"typescript": "^4.9.4",
 		"uvu": "^0.5.6"
diff --git a/packages/adapter-node/package.json b/packages/adapter-node/package.json
index 74b13b0ab..f17fd9e67 100644
--- a/packages/adapter-node/package.json
+++ b/packages/adapter-node/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/adapter-node",
 	"version": "1.2.3",
+	"description": "Adapter for SvelteKit apps that generates a standalone Node server",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
@@ -37,7 +38,7 @@
 		"@types/node": "^16.18.6",
 		"c8": "^7.12.0",
 		"polka": "^1.0.0-next.22",
-		"rimraf": "^4.0.0",
+		"rimraf": "^5.0.0",
 		"sirv": "^2.0.2",
 		"typescript": "^4.9.4",
 		"uvu": "^0.5.6"
diff --git a/packages/adapter-static/CHANGELOG.md b/packages/adapter-static/CHANGELOG.md
index dcda7b9ca..e9c52593a 100644
--- a/packages/adapter-static/CHANGELOG.md
+++ b/packages/adapter-static/CHANGELOG.md
@@ -1,5 +1,14 @@
 # @sveltejs/adapter-static
 
+## 2.0.2
+
+### Patch Changes
+
+- fix: update broken link in error message ([`118ce5a0`](https://github.com/sveltejs/kit/commit/118ce5a07a3a984353c3fc858b34c67e9e560fa0))
+
+- Updated dependencies [[`748a8720`](https://github.com/sveltejs/kit/commit/748a8720fea8ea938576041207b81e19bb8f7dff)]:
+  - @sveltejs/kit@1.15.3
+
 ## 2.0.1
 
 ### Patch Changes
diff --git a/packages/adapter-static/index.js b/packages/adapter-static/index.js
index c151afc2c..f2db6ae30 100644
--- a/packages/adapter-static/index.js
+++ b/packages/adapter-static/index.js
@@ -25,7 +25,7 @@ export default function (options) {
 ${builder.routes.map((route) => `  - ${path.posix.join(prefix, route.id)}`).join('\n')}
 
 You have the following options:
-  - set the \`fallback\` option — see https://github.com/sveltejs/kit/tree/master/packages/adapter-static#spa-mode for more info.
+  - set the \`fallback\` option — see https://kit.svelte.dev/docs/single-page-apps#usage for more info.
   - add \`export const prerender = true\` to your root \`+layout.js/.ts\` or \`+layout.server.js/.ts\` file. This will try to prerender all pages.
   - add \`export const prerender = true\` to any \`+server.js/ts\` files that are not fetched by page \`load\` functions.
 ${config_option}
diff --git a/packages/adapter-static/package.json b/packages/adapter-static/package.json
index 0c64fa1ac..b5af4d083 100644
--- a/packages/adapter-static/package.json
+++ b/packages/adapter-static/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/adapter-static",
-	"version": "2.0.1",
+	"version": "2.0.2",
+	"description": "Adapter for SvelteKit apps that prerenders your entire site as a collection of static files",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/adapter-vercel/package.json b/packages/adapter-vercel/package.json
index de9d0fd23..075380f03 100644
--- a/packages/adapter-vercel/package.json
+++ b/packages/adapter-vercel/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/adapter-vercel",
 	"version": "2.4.1",
+	"description": "A SvelteKit adapter that creates a Vercel app",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/amp/package.json b/packages/amp/package.json
index 171463ec5..c204ba87f 100644
--- a/packages/amp/package.json
+++ b/packages/amp/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/amp",
 	"version": "1.0.2",
+	"description": "AMP integration for SvelteKit",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/create-svelte/package.json b/packages/create-svelte/package.json
index 78b7d4e77..49cff7772 100644
--- a/packages/create-svelte/package.json
+++ b/packages/create-svelte/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "create-svelte",
 	"version": "3.3.0",
+	"description": "A CLI for creating new SvelteKit projects",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/CHANGELOG.md b/packages/kit/CHANGELOG.md
index 53d4f1934..06b55acc5 100644
--- a/packages/kit/CHANGELOG.md
+++ b/packages/kit/CHANGELOG.md
@@ -1,5 +1,11 @@
 # @sveltejs/kit
 
+## 1.15.3
+
+### Patch Changes
+
+- fix: prevent building duplicate CSS files ([#9382](https://github.com/sveltejs/kit/pull/9382))
+
 ## 1.15.2
 
 ### Patch Changes
diff --git a/packages/kit/package.json b/packages/kit/package.json
index 54596a596..9c6a8af37 100644
--- a/packages/kit/package.json
+++ b/packages/kit/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/kit",
-	"version": "1.15.2",
+	"version": "1.15.3",
+	"description": "The fastest way to build Svelte apps",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/kit/src/exports/vite/index.js b/packages/kit/src/exports/vite/index.js
index c2a339693..ec3b42b56 100644
--- a/packages/kit/src/exports/vite/index.js
+++ b/packages/kit/src/exports/vite/index.js
@@ -188,6 +188,9 @@ function kit({ svelte_config }) {
 
 	const service_worker_entry_file = resolve_entry(kit.files.serviceWorker);
 
+	const sourcemapIgnoreList = /** @param {string} relative_path */ (relative_path) =>
+		relative_path.includes('node_modules') || relative_path.includes(kit.outDir);
+
 	/** @type {import('vite').Plugin} */
 	const plugin_setup = {
 		name: 'vite-plugin-sveltekit-setup',
@@ -231,16 +234,17 @@ function kit({ svelte_config }) {
 				},
 				root: cwd,
 				server: {
+					cors: { preflightContinue: true },
 					fs: {
 						allow: [...allow]
 					},
+					sourcemapIgnoreList,
 					watch: {
 						ignored: [
 							// Ignore all siblings of config.kit.outDir/generated
 							`${posixify(kit.outDir)}/!(generated)`
 						]
-					},
-					cors: { preflightContinue: true }
+					}
 				},
 				preview: {
 					cors: { preflightContinue: true }
@@ -550,7 +554,11 @@ function kit({ svelte_config }) {
 				new_config = {
 					base: ssr ? assets_base(kit) : './',
 					build: {
+						copyPublicDir: !ssr,
 						cssCodeSplit: true,
+						cssMinify: initial_config.build?.minify == null ? true : !!initial_config.build.minify,
+						// don't use the default name to avoid collisions with 'static/manifest.json'
+						manifest: 'vite-manifest.json',
 						outDir: `${out}/${ssr ? 'server' : 'client'}`,
 						rollupOptions: {
 							input,
@@ -559,15 +567,13 @@ function kit({ svelte_config }) {
 								entryFileNames: ssr ? '[name].js' : `${prefix}/[name].[hash].${ext}`,
 								chunkFileNames: ssr ? 'chunks/[name].js' : `${prefix}/chunks/[name].[hash].${ext}`,
 								assetFileNames: `${prefix}/assets/[name].[hash][extname]`,
-								hoistTransitiveImports: false
+								hoistTransitiveImports: false,
+								sourcemapIgnoreList
 							},
 							preserveEntrySignatures: 'strict'
 						},
 						ssrEmitAssets: true,
-						copyPublicDir: !ssr,
-						target: ssr ? 'node16.14' : undefined,
-						// don't use the default name to avoid collisions with 'static/manifest.json'
-						manifest: 'vite-manifest.json'
+						target: ssr ? 'node16.14' : undefined
 					},
 					publicDir: kit.files.assets,
 					worker: {
diff --git a/packages/migrate/package.json b/packages/migrate/package.json
index a57a49152..39e238638 100644
--- a/packages/migrate/package.json
+++ b/packages/migrate/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "svelte-migrate",
 	"version": "1.1.3",
+	"description": "A CLI for migrating Svelte(Kit) codebases",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/packages/package/package.json b/packages/package/package.json
index a54bd8c7b..48f01e8d4 100644
--- a/packages/package/package.json
+++ b/packages/package/package.json
@@ -1,6 +1,7 @@
 {
 	"name": "@sveltejs/package",
 	"version": "2.0.2",
+	"description": "The fastest way to build Svelte packages",
 	"repository": {
 		"type": "git",
 		"url": "https://github.com/sveltejs/kit",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 6e7525025..9b250ed20 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -92,7 +92,7 @@ importers:
       '@types/node': ^16.18.6
       '@types/set-cookie-parser': ^2.4.2
       esbuild: ^0.16.3
-      rimraf: ^4.0.0
+      rimraf: ^5.0.0
       rollup: ^3.7.0
       set-cookie-parser: ^2.5.1
       typescript: ^4.9.4
@@ -109,7 +109,7 @@ importers:
       '@sveltejs/kit': link:../kit
       '@types/node': 16.18.6
       '@types/set-cookie-parser': 2.4.2
-      rimraf: 4.0.1
+      rimraf: 5.0.0
       rollup: 3.7.0
       typescript: 4.9.4
       uvu: 0.5.6
@@ -124,7 +124,7 @@ importers:
       '@types/node': ^16.18.6
       c8: ^7.12.0
       polka: ^1.0.0-next.22
-      rimraf: ^4.0.0
+      rimraf: ^5.0.0
       rollup: ^3.7.0
       sirv: ^2.0.2
       typescript: ^4.9.4
@@ -140,7 +140,7 @@ importers:
       '@types/node': 16.18.6
       c8: 7.12.0
       polka: 1.0.0-next.22
-      rimraf: 4.0.1
+      rimraf: 5.0.0
       sirv: 2.0.2
       typescript: 4.9.4
       uvu: 0.5.6
@@ -344,7 +344,7 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^4.0.0
+      rimraf: ^5.0.0
       svelte: ^3.56.0
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -352,7 +352,7 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 4.0.1
+      rimraf: 5.0.0
       svelte: 3.56.0
       svelte-check: 3.0.2_svelte@3.56.0
       typescript: 4.9.4
@@ -412,7 +412,7 @@ importers:
     specifiers:
       '@sveltejs/kit': workspace:^
       cross-env: ^7.0.3
-      rimraf: ^4.0.0
+      rimraf: ^5.0.0
       svelte: ^3.56.0
       svelte-check: ^3.0.2
       typescript: ^4.9.4
@@ -420,7 +420,7 @@ importers:
     devDependencies:
       '@sveltejs/kit': link:../../..
       cross-env: 7.0.3
-      rimraf: 4.0.1
+      rimraf: 5.0.0
       svelte: 3.56.0
       svelte-check: 3.0.2_svelte@3.56.0
       typescript: 4.9.4
@@ -3117,6 +3117,16 @@ packages:
       is-glob: 4.0.3
     dev: true
 
+  /glob/10.0.0:
+    resolution: {integrity: sha512-zmp9ZDC6NpDNLujV2W2n+3lH+BafIVZ4/ct+Yj3BMZTH/+bgm/eVjHzeFLwxJrrIGgjjS2eiQLlpurHsNlEAtQ==}
+    engines: {node: '>=16 || 14 >=14.17'}
+    dependencies:
+      fs.realpath: 1.0.0
+      minimatch: 9.0.0
+      minipass: 5.0.0
+      path-scurry: 1.6.4
+    dev: true
+
   /glob/7.1.6:
     resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==}
     dependencies:
@@ -3692,6 +3702,11 @@ packages:
     dependencies:
       yallist: 4.0.0
 
+  /lru-cache/9.0.0:
+    resolution: {integrity: sha512-9AEKXzvOZc4BMacFnYiTOlDH/197LNnQIK9wZ6iMB5NXPzuv4bWR/Msv7iUMplkiMQ1qQL+KSv/JF1mZAB5Lrg==}
+    engines: {node: '>=16.14'}
+    dev: true
+
   /lz-string/1.4.4:
     resolution: {integrity: sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ==}
     hasBin: true
@@ -3798,6 +3813,13 @@ packages:
     dependencies:
       brace-expansion: 2.0.1
 
+  /minimatch/9.0.0:
+    resolution: {integrity: sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==}
+    engines: {node: '>=16 || 14 >=14.17'}
+    dependencies:
+      brace-expansion: 2.0.1
+    dev: true
+
   /minimist-options/4.1.0:
     resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==}
     engines: {node: '>= 6'}
@@ -3818,6 +3840,11 @@ packages:
       yallist: 4.0.0
     dev: false
 
+  /minipass/5.0.0:
+    resolution: {integrity: sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==}
+    engines: {node: '>=8'}
+    dev: true
+
   /minizlib/2.1.2:
     resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==}
     engines: {node: '>= 8'}
@@ -4145,6 +4172,14 @@ packages:
   /path-parse/1.0.7:
     resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==}
 
+  /path-scurry/1.6.4:
+    resolution: {integrity: sha512-Qp/9IHkdNiXJ3/Kon++At2nVpnhRiPq/aSvQN+H3U1WZbvNRK0RIQK/o4HMqPoXjpuGJUEWpHSs6Mnjxqh3TQg==}
+    engines: {node: '>=16 || 14 >=14.17'}
+    dependencies:
+      lru-cache: 9.0.0
+      minipass: 5.0.0
+    dev: true
+
   /path-type/2.0.0:
     resolution: {integrity: sha512-dUnb5dXUf+kzhC/W/F4e5/SkluXIFf5VUHolW1Eg1irn1hGWjPGdsRcvYJ1nD6lhk8Ir7VM0bHJKsYTx8Jx9OQ==}
     engines: {node: '>=4'}
@@ -4503,10 +4538,12 @@ packages:
     dependencies:
       glob: 7.2.3
 
-  /rimraf/4.0.1:
-    resolution: {integrity: sha512-qwvb/Wzf8XJxdv8InnDtmijfbIk6gk576swPeogHbUh7AT4ezF42lvhXUdbIzMYrO4HbaXi1rYGhKTDyPF1AJw==}
+  /rimraf/5.0.0:
+    resolution: {integrity: sha512-Jf9llaP+RvaEVS5nPShYFhtXIrb3LRKP281ib3So0KkeZKo2wIKyq0Re7TOSwanasA423PSr6CCIL4bP6T040g==}
     engines: {node: '>=14'}
     hasBin: true
+    dependencies:
+      glob: 10.0.0
     dev: true
 
   /rollup-pluginutils/2.8.2:


Test patch:
diff --git a/packages/kit/test/apps/basics/package.json b/packages/kit/test/apps/basics/package.json
index cf6beb03a..038408b26 100644
--- a/packages/kit/test/apps/basics/package.json
+++ b/packages/kit/test/apps/basics/package.json
@@ -16,7 +16,7 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^4.0.0",
+		"rimraf": "^5.0.0",
 		"svelte": "^3.56.0",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",
diff --git a/packages/kit/test/apps/writes/package.json b/packages/kit/test/apps/writes/package.json
index c5aa94136..52ef77937 100644
--- a/packages/kit/test/apps/writes/package.json
+++ b/packages/kit/test/apps/writes/package.json
@@ -14,7 +14,7 @@
 	"devDependencies": {
 		"@sveltejs/kit": "workspace:^",
 		"cross-env": "^7.0.3",
-		"rimraf": "^4.0.0",
+		"rimraf": "^5.0.0",
 		"svelte": "^3.56.0",
 		"svelte-check": "^3.0.2",
 		"typescript": "^4.9.4",