@sveltejs/vite-plugin-svelte 5.0.1 → 5.0.2
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 +8 -8
- package/src/utils/error.js +11 -1
- package/src/utils/log.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/vite-plugin-svelte",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "dominikg",
|
|
6
6
|
"files": [
|
|
@@ -36,12 +36,12 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://github.com/sveltejs/vite-plugin-svelte#readme",
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@sveltejs/vite-plugin-svelte-inspector": "^4.0.
|
|
40
|
-
"debug": "^4.
|
|
39
|
+
"@sveltejs/vite-plugin-svelte-inspector": "^4.0.1",
|
|
40
|
+
"debug": "^4.4.0",
|
|
41
41
|
"deepmerge": "^4.3.1",
|
|
42
42
|
"kleur": "^4.1.5",
|
|
43
|
-
"magic-string": "^0.30.
|
|
44
|
-
"vitefu": "^1.0.
|
|
43
|
+
"magic-string": "^0.30.15",
|
|
44
|
+
"vitefu": "^1.0.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"svelte": "^5.0.0",
|
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/debug": "^4.1.12",
|
|
52
52
|
"esbuild": "^0.24.0",
|
|
53
|
-
"sass": "^1.
|
|
54
|
-
"svelte": "^5.
|
|
55
|
-
"vite": "^6.0.
|
|
53
|
+
"sass": "^1.82.0",
|
|
54
|
+
"svelte": "^5.10.0",
|
|
55
|
+
"vite": "^6.0.3"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"check:publint": "publint --strict",
|
package/src/utils/error.js
CHANGED
|
@@ -101,6 +101,16 @@ function formatFrameForVite(frame) {
|
|
|
101
101
|
.join('\n');
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
/**
|
|
105
|
+
*
|
|
106
|
+
* @param {string} code the svelte error code
|
|
107
|
+
* @see https://github.com/sveltejs/svelte/blob/main/packages/svelte/src/compiler/errors.js
|
|
108
|
+
* @returns {boolean}
|
|
109
|
+
*/
|
|
110
|
+
function couldBeFixedByCssPreprocessor(code) {
|
|
111
|
+
return code === 'expected_token' || code === 'unexpected_eof' || code.startsWith('css_');
|
|
112
|
+
}
|
|
113
|
+
|
|
104
114
|
/**
|
|
105
115
|
* @param {import('svelte/compiler').Warning & Error} err a svelte compiler error, which is a mix of Warning and an error
|
|
106
116
|
* @param {string} originalCode
|
|
@@ -113,7 +123,7 @@ export function enhanceCompileError(err, originalCode, preprocessors) {
|
|
|
113
123
|
const additionalMessages = [];
|
|
114
124
|
|
|
115
125
|
// Handle incorrect CSS preprocessor usage
|
|
116
|
-
if (err.code
|
|
126
|
+
if (couldBeFixedByCssPreprocessor(err.code)) {
|
|
117
127
|
// Reference from Svelte: https://github.com/sveltejs/svelte/blob/9926347ad9dbdd0f3324d5538e25dcb7f5e442f8/packages/svelte/src/compiler/preprocess/index.js#L257
|
|
118
128
|
const styleRe =
|
|
119
129
|
/<!--[^]*?-->|<style((?:\s+[^=>'"/]+=(?:"[^"]*"|'[^']*'|[^>\s]+)|\s+[^=>'"/]+)*\s*)(?:\/>|>([\S\s]*?)<\/style>)/g;
|
package/src/utils/log.js
CHANGED
|
@@ -182,7 +182,7 @@ export function logCompilerWarnings(svelteRequest, warnings, options) {
|
|
|
182
182
|
*/
|
|
183
183
|
function ignoreCompilerWarning(warning, isBuild, emitCss) {
|
|
184
184
|
return (
|
|
185
|
-
(!emitCss && warning.code === '
|
|
185
|
+
(!emitCss && warning.code === 'css_unused_selector') || // same as rollup-plugin-svelte
|
|
186
186
|
(!isBuild && isNoScopableElementWarning(warning))
|
|
187
187
|
);
|
|
188
188
|
}
|
|
@@ -194,7 +194,7 @@ function ignoreCompilerWarning(warning, isBuild, emitCss) {
|
|
|
194
194
|
*/
|
|
195
195
|
function isNoScopableElementWarning(warning) {
|
|
196
196
|
// see https://github.com/sveltejs/vite-plugin-svelte/issues/153
|
|
197
|
-
return warning.code === '
|
|
197
|
+
return warning.code === 'css_unused_selector' && warning.message.includes('"*"');
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|