@sveltejs/vite-plugin-svelte 2.4.1 → 2.4.3
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 +9 -9
- package/src/utils/compile.js +9 -7
- package/src/utils/constants.js +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sveltejs/vite-plugin-svelte",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "dominikg",
|
|
6
6
|
"files": [
|
|
@@ -37,20 +37,20 @@
|
|
|
37
37
|
"debug": "^4.3.4",
|
|
38
38
|
"deepmerge": "^4.3.1",
|
|
39
39
|
"kleur": "^4.1.5",
|
|
40
|
-
"magic-string": "^0.30.
|
|
41
|
-
"svelte-hmr": "^0.15.
|
|
40
|
+
"magic-string": "^0.30.1",
|
|
41
|
+
"svelte-hmr": "^0.15.2",
|
|
42
42
|
"vitefu": "^0.2.4",
|
|
43
|
-
"@sveltejs/vite-plugin-svelte-inspector": "^1.0.
|
|
43
|
+
"@sveltejs/vite-plugin-svelte-inspector": "^1.0.3"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"svelte": "^3.54.0 || ^4.0.0
|
|
46
|
+
"svelte": "^3.54.0 || ^4.0.0",
|
|
47
47
|
"vite": "^4.0.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@types/debug": "^4.1.
|
|
51
|
-
"esbuild": "^0.
|
|
52
|
-
"svelte": "^
|
|
53
|
-
"vite": "^4.
|
|
50
|
+
"@types/debug": "^4.1.8",
|
|
51
|
+
"esbuild": "^0.18.16",
|
|
52
|
+
"svelte": "^4.1.1",
|
|
53
|
+
"vite": "^4.4.6"
|
|
54
54
|
},
|
|
55
55
|
"scripts": {
|
|
56
56
|
"check:publint": "publint --strict",
|
package/src/utils/compile.js
CHANGED
|
@@ -125,13 +125,15 @@ export const _createCompileSvelte = (makeHot) => {
|
|
|
125
125
|
const endStat = stats?.start(filename);
|
|
126
126
|
const compiled = compile(finalCode, finalCompileOptions);
|
|
127
127
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
128
|
+
if (isSvelte3) {
|
|
129
|
+
// prevent dangling pure comments
|
|
130
|
+
// see https://github.com/sveltejs/kit/issues/9492#issuecomment-1487704985
|
|
131
|
+
// uses regex replace with whitespace to keep sourcemap/character count unmodified
|
|
132
|
+
compiled.js.code = compiled.js.code.replace(
|
|
133
|
+
/\/\* [@#]__PURE__ \*\/(\s*)$/gm,
|
|
134
|
+
' $1'
|
|
135
|
+
);
|
|
136
|
+
}
|
|
135
137
|
if (endStat) {
|
|
136
138
|
endStat();
|
|
137
139
|
}
|
package/src/utils/constants.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { isSvelte3 } from './svelte-version.js';
|
|
2
|
+
|
|
1
3
|
export const VITE_RESOLVE_MAIN_FIELDS = ['module', 'jsnext:main', 'jsnext'];
|
|
2
4
|
|
|
3
5
|
export const SVELTE_RESOLVE_MAIN_FIELDS = ['svelte'];
|
|
@@ -12,6 +14,10 @@ export const SVELTE_IMPORTS = [
|
|
|
12
14
|
'svelte/transition',
|
|
13
15
|
'svelte'
|
|
14
16
|
];
|
|
17
|
+
// TODO add to global list after dropping svelte 3
|
|
18
|
+
if (!isSvelte3) {
|
|
19
|
+
SVELTE_IMPORTS.push('svelte/internal/disclose-version');
|
|
20
|
+
}
|
|
15
21
|
|
|
16
22
|
export const SVELTE_HMR_IMPORTS = [
|
|
17
23
|
'svelte-hmr/runtime/hot-api-esm.js',
|