From 20320c193579c5f2cf7a308d88d77e991e4826f6 Mon Sep 17 00:00:00 2001
From: dumbmoron <log@riseup.net>
Date: Sun, 21 Jul 2024 10:06:16 +0000
Subject: [PATCH] web: use svelte-preprocess instead of vitePreprocess this
 allows us to use <style src={...}></style> also for scoped styles (and not
 just global styles)

---
 web/package-lock.json | 103 ++++++++++++++++++++++++++++++------------
 web/package.json      |   1 +
 web/svelte.config.js  |   4 +-
 3 files changed, 76 insertions(+), 32 deletions(-)

diff --git a/web/package-lock.json b/web/package-lock.json
index 476e94e0..774a7bf7 100644
--- a/web/package-lock.json
+++ b/web/package-lock.json
@@ -27,6 +27,7 @@
                 "mdsvex": "^0.11.2",
                 "svelte": "^4.2.7",
                 "svelte-check": "^3.6.0",
+                "svelte-preprocess": "^6.0.2",
                 "tslib": "^2.4.1",
                 "typescript": "^5.4.5",
                 "typescript-eslint": "^7.13.1",
@@ -1048,8 +1049,7 @@
             "version": "2.0.10",
             "resolved": "https://registry.npmjs.org/@types/pug/-/pug-2.0.10.tgz",
             "integrity": "sha512-Sk/uYFOBAB7mb74XcpizmH0KOR2Pv3D2Hmrh1Dmy5BmK3MpdSa5kqZcg6EKBdklU0bFXX9gCfzvpnyUehrPIuA==",
-            "dev": true,
-            "license": "MIT"
+            "dev": true
         },
         "node_modules/@types/unist": {
             "version": "2.0.10",
@@ -1447,7 +1447,6 @@
             "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-1.0.0.tgz",
             "integrity": "sha512-Db1SbgBS/fg/392AblrMJk97KggmvYhr4pB5ZIMTWtaivCPMWLkmb7m21cJvpvgK+J3nsU2CmmixNBZx4vFj/w==",
             "dev": true,
-            "license": "MIT",
             "engines": {
                 "node": ">=8.0.0"
             }
@@ -1651,7 +1650,6 @@
             "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.1.0.tgz",
             "integrity": "sha512-reYkTUJAZb9gUuZ2RvVCNhVHdg62RHnJ7WJl8ftMi4diZ6NWlciOzQN88pUhSELEwflJht4oQDv0F0BMlwaYtA==",
             "dev": true,
-            "license": "MIT",
             "engines": {
                 "node": ">=8"
             }
@@ -1693,8 +1691,7 @@
             "version": "3.3.1",
             "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz",
             "integrity": "sha512-SOp9Phqvqn7jtEUxPWdWfWoLmyt2VaJ6MpvP9Comy1MceMXqE6bxvaTu4iaxpYYPzhny28Lc+M87/c2cPK6lDg==",
-            "dev": true,
-            "license": "MIT"
+            "dev": true
         },
         "node_modules/esbuild": {
             "version": "0.21.5",
@@ -2162,8 +2159,7 @@
             "version": "4.2.11",
             "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
             "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
-            "dev": true,
-            "license": "ISC"
+            "dev": true
         },
         "node_modules/graphemer": {
             "version": "1.4.0",
@@ -2478,7 +2474,6 @@
             "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
             "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
             "dev": true,
-            "license": "MIT",
             "engines": {
                 "node": ">=4"
             }
@@ -2501,7 +2496,6 @@
             "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
             "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
             "dev": true,
-            "license": "MIT",
             "funding": {
                 "url": "https://github.com/sponsors/ljharb"
             }
@@ -2511,7 +2505,6 @@
             "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz",
             "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==",
             "dev": true,
-            "license": "MIT",
             "dependencies": {
                 "minimist": "^1.2.6"
             },
@@ -2942,7 +2935,6 @@
             "resolved": "https://registry.npmjs.org/sander/-/sander-0.5.1.tgz",
             "integrity": "sha512-3lVqBir7WuKDHGrKRDn/1Ye3kwpXaDOMsiRP1wd6wpZW56gJhsbp5RqQpA6JG/P+pkXizygnr1dKR8vzWaVsfA==",
             "dev": true,
-            "license": "MIT",
             "dependencies": {
                 "es6-promise": "^3.1.2",
                 "graceful-fs": "^4.1.3",
@@ -2956,7 +2948,6 @@
             "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==",
             "deprecated": "Rimraf versions prior to v4 are no longer supported",
             "dev": true,
-            "license": "ISC",
             "dependencies": {
                 "glob": "^7.1.3"
             },
@@ -3037,7 +3028,6 @@
             "resolved": "https://registry.npmjs.org/sorcery/-/sorcery-0.11.1.tgz",
             "integrity": "sha512-o7npfeJE6wi6J9l0/5LKshFzZ2rMatRiCDwYeDQaOzqdzRJwALhX7mk/A/ecg6wjMu7wdZbmXfD2S/vpOg0bdQ==",
             "dev": true,
-            "license": "MIT",
             "dependencies": {
                 "@jridgewell/sourcemap-codec": "^1.4.14",
                 "buffer-crc32": "^1.0.0",
@@ -3075,7 +3065,6 @@
             "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
             "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
             "dev": true,
-            "license": "MIT",
             "dependencies": {
                 "min-indent": "^1.0.0"
             },
@@ -3155,26 +3144,12 @@
                 "svelte": "^3.55.0 || ^4.0.0-next.0 || ^4.0.0 || ^5.0.0-next.0"
             }
         },
-        "node_modules/svelte-hmr": {
-            "version": "0.16.0",
-            "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.16.0.tgz",
-            "integrity": "sha512-Gyc7cOS3VJzLlfj7wKS0ZnzDVdv3Pn2IuVeJPk9m2skfhcu5bq3wtIZyQGggr7/Iim5rH5cncyQft/kRLupcnA==",
-            "dev": true,
-            "license": "ISC",
-            "engines": {
-                "node": "^12.20 || ^14.13.1 || >= 16"
-            },
-            "peerDependencies": {
-                "svelte": "^3.19.0 || ^4.0.0"
-            }
-        },
-        "node_modules/svelte-preprocess": {
+        "node_modules/svelte-check/node_modules/svelte-preprocess": {
             "version": "5.1.4",
             "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-5.1.4.tgz",
             "integrity": "sha512-IvnbQ6D6Ao3Gg6ftiM5tdbR6aAETwjhHV+UKGf5bHGYR69RQvF1ho0JKPcbUON4vy4R7zom13jPjgdOWCQ5hDA==",
             "dev": true,
             "hasInstallScript": true,
-            "license": "MIT",
             "dependencies": {
                 "@types/pug": "^2.0.6",
                 "detect-indent": "^6.1.0",
@@ -3231,6 +3206,74 @@
                 }
             }
         },
+        "node_modules/svelte-hmr": {
+            "version": "0.16.0",
+            "resolved": "https://registry.npmjs.org/svelte-hmr/-/svelte-hmr-0.16.0.tgz",
+            "integrity": "sha512-Gyc7cOS3VJzLlfj7wKS0ZnzDVdv3Pn2IuVeJPk9m2skfhcu5bq3wtIZyQGggr7/Iim5rH5cncyQft/kRLupcnA==",
+            "dev": true,
+            "license": "ISC",
+            "engines": {
+                "node": "^12.20 || ^14.13.1 || >= 16"
+            },
+            "peerDependencies": {
+                "svelte": "^3.19.0 || ^4.0.0"
+            }
+        },
+        "node_modules/svelte-preprocess": {
+            "version": "6.0.2",
+            "resolved": "https://registry.npmjs.org/svelte-preprocess/-/svelte-preprocess-6.0.2.tgz",
+            "integrity": "sha512-OvDTLfaOkkhjprbDKO0SOCkjNYuHy16dbD4SpqbIi6QiabOMHxRT4km5/dzbFFkmW1L0E2INF3MFltG2pgOyKQ==",
+            "dev": true,
+            "hasInstallScript": true,
+            "engines": {
+                "node": ">= 18.0.0"
+            },
+            "peerDependencies": {
+                "@babel/core": "^7.10.2",
+                "coffeescript": "^2.5.1",
+                "less": "^3.11.3 || ^4.0.0",
+                "postcss": "^7 || ^8",
+                "postcss-load-config": ">=3",
+                "pug": "^3.0.0",
+                "sass": "^1.26.8",
+                "stylus": ">=0.55",
+                "sugarss": "^2.0.0 || ^3.0.0 || ^4.0.0",
+                "svelte": "^4.0.0 || ^5.0.0-next.100 || ^5.0.0",
+                "typescript": "^5.0.0"
+            },
+            "peerDependenciesMeta": {
+                "@babel/core": {
+                    "optional": true
+                },
+                "coffeescript": {
+                    "optional": true
+                },
+                "less": {
+                    "optional": true
+                },
+                "postcss": {
+                    "optional": true
+                },
+                "postcss-load-config": {
+                    "optional": true
+                },
+                "pug": {
+                    "optional": true
+                },
+                "sass": {
+                    "optional": true
+                },
+                "stylus": {
+                    "optional": true
+                },
+                "sugarss": {
+                    "optional": true
+                },
+                "typescript": {
+                    "optional": true
+                }
+            }
+        },
         "node_modules/sveltekit-i18n": {
             "version": "2.4.2",
             "resolved": "https://registry.npmjs.org/sveltekit-i18n/-/sveltekit-i18n-2.4.2.tgz",
diff --git a/web/package.json b/web/package.json
index 30e9f0e3..710e92a3 100644
--- a/web/package.json
+++ b/web/package.json
@@ -35,6 +35,7 @@
         "mdsvex": "^0.11.2",
         "svelte": "^4.2.7",
         "svelte-check": "^3.6.0",
+        "svelte-preprocess": "^6.0.2",
         "tslib": "^2.4.1",
         "typescript": "^5.4.5",
         "typescript-eslint": "^7.13.1",
diff --git a/web/svelte.config.js b/web/svelte.config.js
index d5fa6bbd..fe1f30ee 100644
--- a/web/svelte.config.js
+++ b/web/svelte.config.js
@@ -1,8 +1,8 @@
 import adapter from '@sveltejs/adapter-static';
-import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
 import { mdsvex } from 'mdsvex';
 import { fileURLToPath } from 'node:url';
 import { dirname, join } from 'node:path';
+import { sveltePreprocess } from 'svelte-preprocess';
 
 /** @type {import('@sveltejs/kit').Config} */
 const config = {
@@ -10,7 +10,7 @@ const config = {
     // for more information about preprocessors
     extensions: [".svelte", ".md"],
     preprocess: [
-        vitePreprocess(),
+        sveltePreprocess(),
         mdsvex({
             extensions: ['.md'],
             layout: join(