@sveltejs/vite-plugin-svelte 6.1.2 → 6.1.4
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 +4 -5
- package/src/plugins/compile.js +1 -1
- package/src/plugins/configure.js +2 -2
- package/src/plugins/hot-update.js +2 -2
- package/src/plugins/load-custom.js +1 -1
- package/src/plugins/preprocess.js +6 -3
- package/src/public.d.ts +2 -2
- package/src/types/plugin-api.d.ts +6 -1
- package/src/utils/log.js +6 -1
- package/types/index.d.ts +2 -2
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.4",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "dominikg",
|
|
6
6
|
"files": [
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"@sveltejs/vite-plugin-svelte-inspector": "^5.0.0",
|
|
38
38
|
"debug": "^4.4.1",
|
|
39
39
|
"deepmerge": "^4.3.1",
|
|
40
|
-
"kleur": "^4.1.5",
|
|
41
40
|
"magic-string": "^0.30.17",
|
|
42
41
|
"vitefu": "^1.1.1"
|
|
43
42
|
},
|
|
@@ -47,9 +46,9 @@
|
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@types/debug": "^4.1.12",
|
|
50
|
-
"sass": "^1.
|
|
51
|
-
"svelte": "^5.38.
|
|
52
|
-
"vite": "^7.1.
|
|
49
|
+
"sass": "^1.91.0",
|
|
50
|
+
"svelte": "^5.38.6",
|
|
51
|
+
"vite": "^7.1.4"
|
|
53
52
|
},
|
|
54
53
|
"scripts": {
|
|
55
54
|
"check:publint": "publint --strict",
|
package/src/plugins/compile.js
CHANGED
|
@@ -20,7 +20,7 @@ export function compile(api) {
|
|
|
20
20
|
name: 'vite-plugin-svelte:compile',
|
|
21
21
|
configResolved() {
|
|
22
22
|
//@ts-expect-error defined below but filter not in type
|
|
23
|
-
plugin.transform.filter = api.
|
|
23
|
+
plugin.transform.filter = api.filter;
|
|
24
24
|
options = api.options;
|
|
25
25
|
compileSvelte = api.compileSvelte;
|
|
26
26
|
},
|
package/src/plugins/configure.js
CHANGED
|
@@ -71,8 +71,8 @@ export function configure(api, inlineOptions) {
|
|
|
71
71
|
api.options.stats = new VitePluginSvelteStats();
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
api.
|
|
75
|
-
|
|
74
|
+
api.filter = buildIdFilter(options);
|
|
75
|
+
api.idFilter = api.filter;
|
|
76
76
|
api.idParser = buildIdParser(options);
|
|
77
77
|
api.compileSvelte = createCompileSvelte();
|
|
78
78
|
log.debug('resolved options', api.options, 'config');
|
|
@@ -34,12 +34,12 @@ export function hotUpdate(api) {
|
|
|
34
34
|
plugin.transform.filter = {
|
|
35
35
|
id: {
|
|
36
36
|
// reinclude virtual styles to get their output
|
|
37
|
-
include: [...api.
|
|
37
|
+
include: [...api.filter.id.include, SVELTE_VIRTUAL_STYLE_ID_REGEX],
|
|
38
38
|
exclude: [
|
|
39
39
|
// ignore files in node_modules, we don't hot update them
|
|
40
40
|
/\/node_modules\//,
|
|
41
41
|
// remove style exclusion
|
|
42
|
-
...api.
|
|
42
|
+
...api.filter.id.exclude.filter((filter) => filter !== SVELTE_VIRTUAL_STYLE_ID_REGEX)
|
|
43
43
|
]
|
|
44
44
|
}
|
|
45
45
|
};
|
|
@@ -15,7 +15,7 @@ export function loadCustom(api) {
|
|
|
15
15
|
enforce: 'pre', // must come before vites own asset handling or custom extensions like .svg won't work
|
|
16
16
|
configResolved() {
|
|
17
17
|
//@ts-expect-error load defined below but filter not in type
|
|
18
|
-
plugin.load.filter = api.
|
|
18
|
+
plugin.load.filter = api.filter;
|
|
19
19
|
},
|
|
20
20
|
|
|
21
21
|
load: {
|
|
@@ -31,18 +31,21 @@ export function preprocess(api) {
|
|
|
31
31
|
name: 'vite-plugin-svelte:preprocess',
|
|
32
32
|
enforce: 'pre',
|
|
33
33
|
configResolved(c) {
|
|
34
|
-
//@ts-expect-error defined below but filter not in type
|
|
35
|
-
plugin.transform.filter = api.idFilter;
|
|
36
34
|
options = api.options;
|
|
37
35
|
if (arraify(options.preprocess).length > 0) {
|
|
38
36
|
preprocessSvelte = createPreprocessSvelte(options, c);
|
|
37
|
+
// @ts-expect-error defined below but filter not in type
|
|
38
|
+
plugin.transform.filter = api.filter;
|
|
39
39
|
} else {
|
|
40
40
|
log.debug(
|
|
41
41
|
`disabling ${plugin.name} because no preprocessor is configured`,
|
|
42
42
|
undefined,
|
|
43
43
|
'preprocess'
|
|
44
44
|
);
|
|
45
|
-
|
|
45
|
+
// @ts-expect-error force set undefined to clear memory
|
|
46
|
+
preprocessSvelte = undefined;
|
|
47
|
+
// @ts-expect-error defined below but filter not in type
|
|
48
|
+
plugin.transform.filter = { id: /$./ }; // never match
|
|
46
49
|
}
|
|
47
50
|
},
|
|
48
51
|
configureServer(server) {
|
package/src/public.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ export interface SvelteConfig {
|
|
|
121
121
|
/**
|
|
122
122
|
* An array of preprocessors to transform the Svelte source code before compilation
|
|
123
123
|
*
|
|
124
|
-
* @see https://svelte.dev/docs#
|
|
124
|
+
* @see https://svelte.dev/docs/svelte/svelte-compiler#PreprocessorGroup
|
|
125
125
|
*/
|
|
126
126
|
preprocess?: Arrayable<PreprocessorGroup>;
|
|
127
127
|
/**
|
|
@@ -129,7 +129,7 @@ export interface SvelteConfig {
|
|
|
129
129
|
* including `dev` and `css`. However, some options are non-configurable, like
|
|
130
130
|
* `filename`, `format`, `generate`, and `cssHash` (in dev).
|
|
131
131
|
*
|
|
132
|
-
* @see https://svelte.dev/docs#
|
|
132
|
+
* @see https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions
|
|
133
133
|
*/
|
|
134
134
|
compilerOptions?: Omit<CompileOptions, 'filename' | 'format' | 'generate'>;
|
|
135
135
|
|
|
@@ -4,7 +4,12 @@ import type { CompileSvelte } from './compile.d.ts';
|
|
|
4
4
|
|
|
5
5
|
export interface PluginAPI {
|
|
6
6
|
options: ResolvedOptions;
|
|
7
|
-
|
|
7
|
+
filter: IdFilter;
|
|
8
8
|
idParser: IdParser;
|
|
9
9
|
compileSvelte: CompileSvelte;
|
|
10
|
+
/**
|
|
11
|
+
* @deprecated use 'filter' instead
|
|
12
|
+
* // TODO remove in next major
|
|
13
|
+
*/
|
|
14
|
+
idFilter: IdFilter;
|
|
10
15
|
}
|
package/src/utils/log.js
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
-
|
|
2
|
+
|
|
3
|
+
import { styleText } from 'node:util';
|
|
4
|
+
const cyan = (/** @type {string} */ txt) => styleText('cyan', txt);
|
|
5
|
+
const yellow = (/** @type {string} */ txt) => styleText('yellow', txt);
|
|
6
|
+
const red = (/** @type {string} */ txt) => styleText('red', txt);
|
|
7
|
+
|
|
3
8
|
import debug from 'debug';
|
|
4
9
|
|
|
5
10
|
/** @type {import('../types/log.d.ts').LogLevel[]} */
|
package/types/index.d.ts
CHANGED
|
@@ -121,7 +121,7 @@ declare module '@sveltejs/vite-plugin-svelte' {
|
|
|
121
121
|
/**
|
|
122
122
|
* An array of preprocessors to transform the Svelte source code before compilation
|
|
123
123
|
*
|
|
124
|
-
* @see https://svelte.dev/docs#
|
|
124
|
+
* @see https://svelte.dev/docs/svelte/svelte-compiler#PreprocessorGroup
|
|
125
125
|
*/
|
|
126
126
|
preprocess?: Arrayable<PreprocessorGroup>;
|
|
127
127
|
/**
|
|
@@ -129,7 +129,7 @@ declare module '@sveltejs/vite-plugin-svelte' {
|
|
|
129
129
|
* including `dev` and `css`. However, some options are non-configurable, like
|
|
130
130
|
* `filename`, `format`, `generate`, and `cssHash` (in dev).
|
|
131
131
|
*
|
|
132
|
-
* @see https://svelte.dev/docs#
|
|
132
|
+
* @see https://svelte.dev/docs/svelte/svelte-compiler#CompileOptions
|
|
133
133
|
*/
|
|
134
134
|
compilerOptions?: Omit<CompileOptions, 'filename' | 'format' | 'generate'>;
|
|
135
135
|
|