@sveltejs/vite-plugin-svelte 6.1.0 → 6.1.1
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/vite-plugin-svelte",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "dominikg",
|
|
6
6
|
"files": [
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@sveltejs/vite-plugin-svelte-inspector": "^5.0.0
|
|
37
|
+
"@sveltejs/vite-plugin-svelte-inspector": "^5.0.0",
|
|
38
38
|
"debug": "^4.4.1",
|
|
39
39
|
"deepmerge": "^4.3.1",
|
|
40
40
|
"kleur": "^4.1.5",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/debug": "^4.1.12",
|
|
50
|
-
"sass": "^1.
|
|
51
|
-
"svelte": "^5.
|
|
52
|
-
"vite": "^7.
|
|
50
|
+
"sass": "^1.90.0",
|
|
51
|
+
"svelte": "^5.38.0",
|
|
52
|
+
"vite": "^7.1.1"
|
|
53
53
|
},
|
|
54
54
|
"scripts": {
|
|
55
55
|
"check:publint": "publint --strict",
|
|
@@ -8,9 +8,16 @@ const filter = { id: SVELTE_VIRTUAL_STYLE_ID_REGEX };
|
|
|
8
8
|
* @returns {import('vite').Plugin}
|
|
9
9
|
*/
|
|
10
10
|
export function loadCompiledCss(api) {
|
|
11
|
+
let isBuildWatch = false;
|
|
12
|
+
/** @type{Map<string,any>} */
|
|
13
|
+
const buildWatchCssCache = new Map();
|
|
11
14
|
return {
|
|
12
15
|
name: 'vite-plugin-svelte:load-compiled-css',
|
|
13
16
|
|
|
17
|
+
configResolved(c) {
|
|
18
|
+
isBuildWatch = !!c.build?.watch;
|
|
19
|
+
},
|
|
20
|
+
|
|
14
21
|
resolveId: {
|
|
15
22
|
filter, // same filter in load to ensure minimal work
|
|
16
23
|
handler(id) {
|
|
@@ -26,7 +33,17 @@ export function loadCompiledCss(api) {
|
|
|
26
33
|
if (!svelteRequest) {
|
|
27
34
|
return;
|
|
28
35
|
}
|
|
29
|
-
|
|
36
|
+
let cachedCss = this.getModuleInfo(svelteRequest.filename)?.meta.svelte?.css;
|
|
37
|
+
// in build --watch getModuleInfo only returns changed module data.
|
|
38
|
+
// To ensure virtual css is loaded unchanged, we cache it here separately
|
|
39
|
+
if (isBuildWatch) {
|
|
40
|
+
if (cachedCss) {
|
|
41
|
+
buildWatchCssCache.set(svelteRequest.filename, cachedCss);
|
|
42
|
+
} else {
|
|
43
|
+
cachedCss = buildWatchCssCache.get(svelteRequest.filename);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
30
47
|
if (cachedCss) {
|
|
31
48
|
const { hasGlobal, ...css } = cachedCss;
|
|
32
49
|
if (hasGlobal === false) {
|
|
@@ -37,6 +54,8 @@ export function loadCompiledCss(api) {
|
|
|
37
54
|
}
|
|
38
55
|
css.moduleType = 'css';
|
|
39
56
|
return css;
|
|
57
|
+
} else {
|
|
58
|
+
log.warn(`failed to load virtual css module ${id}`, undefined, 'load');
|
|
40
59
|
}
|
|
41
60
|
}
|
|
42
61
|
}
|