@vanilla-extract/vite-plugin 5.0.2 → 5.0.3-compiler-use-parent-watcher-20250521111515
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.
@@ -15,6 +15,6 @@ interface Options {
|
|
15
15
|
unstable_pluginFilter?: PluginFilter;
|
16
16
|
unstable_mode?: 'transform' | 'emitCss';
|
17
17
|
}
|
18
|
-
declare function vanillaExtractPlugin({ identifiers, unstable_pluginFilter: pluginFilter, unstable_mode
|
18
|
+
declare function vanillaExtractPlugin({ identifiers, unstable_pluginFilter: pluginFilter, unstable_mode, }?: Options): Plugin;
|
19
19
|
|
20
20
|
export { vanillaExtractPlugin };
|
@@ -32,13 +32,14 @@ const withUserPluginFilter = ({
|
|
32
32
|
function vanillaExtractPlugin({
|
33
33
|
identifiers,
|
34
34
|
unstable_pluginFilter: pluginFilter = defaultPluginFilter,
|
35
|
-
unstable_mode
|
35
|
+
unstable_mode = 'emitCss'
|
36
36
|
} = {}) {
|
37
37
|
let config;
|
38
38
|
let configEnv;
|
39
39
|
let server;
|
40
40
|
let packageName;
|
41
41
|
let compiler$1;
|
42
|
+
let isBuild;
|
42
43
|
const vitePromise = import('vite');
|
43
44
|
const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
44
45
|
const getAbsoluteId = filePath => {
|
@@ -84,11 +85,12 @@ function vanillaExtractPlugin({
|
|
84
85
|
},
|
85
86
|
async configResolved(_resolvedConfig) {
|
86
87
|
config = _resolvedConfig;
|
88
|
+
isBuild = config.command === 'build' && !config.build.watch;
|
87
89
|
packageName = integration.getPackageInfo(config.root).name;
|
88
90
|
},
|
89
91
|
async buildStart() {
|
90
92
|
// Ensure we re-use the compiler instance between builds, e.g. in watch mode
|
91
|
-
if (
|
93
|
+
if (unstable_mode !== 'transform' && !compiler$1) {
|
92
94
|
var _configForViteCompile;
|
93
95
|
const {
|
94
96
|
loadConfigFromFile
|
@@ -119,7 +121,8 @@ function vanillaExtractPlugin({
|
|
119
121
|
root: config.root,
|
120
122
|
identifiers: getIdentOption(),
|
121
123
|
cssImportSpecifier: fileIdToVirtualId,
|
122
|
-
viteConfig
|
124
|
+
viteConfig,
|
125
|
+
enableFileWatcher: !isBuild
|
123
126
|
});
|
124
127
|
}
|
125
128
|
},
|
@@ -141,7 +144,7 @@ function vanillaExtractPlugin({
|
|
141
144
|
return null;
|
142
145
|
}
|
143
146
|
const identOption = getIdentOption();
|
144
|
-
if (
|
147
|
+
if (unstable_mode === 'transform') {
|
145
148
|
return integration.transform({
|
146
149
|
source: code,
|
147
150
|
filePath: integration.normalizePath(validId),
|
@@ -166,7 +169,7 @@ function vanillaExtractPlugin({
|
|
166
169
|
};
|
167
170
|
|
168
171
|
// We don't need to watch files in build mode
|
169
|
-
if (
|
172
|
+
if (isBuild) {
|
170
173
|
return result;
|
171
174
|
}
|
172
175
|
for (const file of watchFiles) {
|
@@ -32,13 +32,14 @@ const withUserPluginFilter = ({
|
|
32
32
|
function vanillaExtractPlugin({
|
33
33
|
identifiers,
|
34
34
|
unstable_pluginFilter: pluginFilter = defaultPluginFilter,
|
35
|
-
unstable_mode
|
35
|
+
unstable_mode = 'emitCss'
|
36
36
|
} = {}) {
|
37
37
|
let config;
|
38
38
|
let configEnv;
|
39
39
|
let server;
|
40
40
|
let packageName;
|
41
41
|
let compiler$1;
|
42
|
+
let isBuild;
|
42
43
|
const vitePromise = import('vite');
|
43
44
|
const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
44
45
|
const getAbsoluteId = filePath => {
|
@@ -84,11 +85,12 @@ function vanillaExtractPlugin({
|
|
84
85
|
},
|
85
86
|
async configResolved(_resolvedConfig) {
|
86
87
|
config = _resolvedConfig;
|
88
|
+
isBuild = config.command === 'build' && !config.build.watch;
|
87
89
|
packageName = integration.getPackageInfo(config.root).name;
|
88
90
|
},
|
89
91
|
async buildStart() {
|
90
92
|
// Ensure we re-use the compiler instance between builds, e.g. in watch mode
|
91
|
-
if (
|
93
|
+
if (unstable_mode !== 'transform' && !compiler$1) {
|
92
94
|
var _configForViteCompile;
|
93
95
|
const {
|
94
96
|
loadConfigFromFile
|
@@ -119,7 +121,8 @@ function vanillaExtractPlugin({
|
|
119
121
|
root: config.root,
|
120
122
|
identifiers: getIdentOption(),
|
121
123
|
cssImportSpecifier: fileIdToVirtualId,
|
122
|
-
viteConfig
|
124
|
+
viteConfig,
|
125
|
+
enableFileWatcher: !isBuild
|
123
126
|
});
|
124
127
|
}
|
125
128
|
},
|
@@ -141,7 +144,7 @@ function vanillaExtractPlugin({
|
|
141
144
|
return null;
|
142
145
|
}
|
143
146
|
const identOption = getIdentOption();
|
144
|
-
if (
|
147
|
+
if (unstable_mode === 'transform') {
|
145
148
|
return integration.transform({
|
146
149
|
source: code,
|
147
150
|
filePath: integration.normalizePath(validId),
|
@@ -166,7 +169,7 @@ function vanillaExtractPlugin({
|
|
166
169
|
};
|
167
170
|
|
168
171
|
// We don't need to watch files in build mode
|
169
|
-
if (
|
172
|
+
if (isBuild) {
|
170
173
|
return result;
|
171
174
|
}
|
172
175
|
for (const file of watchFiles) {
|
@@ -24,13 +24,14 @@ const withUserPluginFilter = ({
|
|
24
24
|
function vanillaExtractPlugin({
|
25
25
|
identifiers,
|
26
26
|
unstable_pluginFilter: pluginFilter = defaultPluginFilter,
|
27
|
-
unstable_mode
|
27
|
+
unstable_mode = 'emitCss'
|
28
28
|
} = {}) {
|
29
29
|
let config;
|
30
30
|
let configEnv;
|
31
31
|
let server;
|
32
32
|
let packageName;
|
33
33
|
let compiler;
|
34
|
+
let isBuild;
|
34
35
|
const vitePromise = import('vite');
|
35
36
|
const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
36
37
|
const getAbsoluteId = filePath => {
|
@@ -76,11 +77,12 @@ function vanillaExtractPlugin({
|
|
76
77
|
},
|
77
78
|
async configResolved(_resolvedConfig) {
|
78
79
|
config = _resolvedConfig;
|
80
|
+
isBuild = config.command === 'build' && !config.build.watch;
|
79
81
|
packageName = getPackageInfo(config.root).name;
|
80
82
|
},
|
81
83
|
async buildStart() {
|
82
84
|
// Ensure we re-use the compiler instance between builds, e.g. in watch mode
|
83
|
-
if (
|
85
|
+
if (unstable_mode !== 'transform' && !compiler) {
|
84
86
|
var _configForViteCompile;
|
85
87
|
const {
|
86
88
|
loadConfigFromFile
|
@@ -111,7 +113,8 @@ function vanillaExtractPlugin({
|
|
111
113
|
root: config.root,
|
112
114
|
identifiers: getIdentOption(),
|
113
115
|
cssImportSpecifier: fileIdToVirtualId,
|
114
|
-
viteConfig
|
116
|
+
viteConfig,
|
117
|
+
enableFileWatcher: !isBuild
|
115
118
|
});
|
116
119
|
}
|
117
120
|
},
|
@@ -133,7 +136,7 @@ function vanillaExtractPlugin({
|
|
133
136
|
return null;
|
134
137
|
}
|
135
138
|
const identOption = getIdentOption();
|
136
|
-
if (
|
139
|
+
if (unstable_mode === 'transform') {
|
137
140
|
return transform({
|
138
141
|
source: code,
|
139
142
|
filePath: normalizePath(validId),
|
@@ -158,7 +161,7 @@ function vanillaExtractPlugin({
|
|
158
161
|
};
|
159
162
|
|
160
163
|
// We don't need to watch files in build mode
|
161
|
-
if (
|
164
|
+
if (isBuild) {
|
162
165
|
return result;
|
163
166
|
}
|
164
167
|
for (const file of watchFiles) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vanilla-extract/vite-plugin",
|
3
|
-
"version": "5.0.
|
3
|
+
"version": "5.0.3-compiler-use-parent-watcher-20250521111515",
|
4
4
|
"description": "Zero-runtime Stylesheets-in-TypeScript",
|
5
5
|
"main": "dist/vanilla-extract-vite-plugin.cjs.js",
|
6
6
|
"module": "dist/vanilla-extract-vite-plugin.esm.js",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"author": "SEEK",
|
17
17
|
"license": "MIT",
|
18
18
|
"dependencies": {
|
19
|
-
"@vanilla-extract/compiler": "^0.
|
19
|
+
"@vanilla-extract/compiler": "^0.2.0-compiler-use-parent-watcher-20250521111515",
|
20
20
|
"@vanilla-extract/integration": "^8.0.2"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|