@vanilla-extract/vite-plugin 5.0.3-compiler-use-parent-watcher-20250521111515 → 5.0.3-vite-ssr-fix-20250523020545

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, }?: Options): Plugin;
18
+ declare function vanillaExtractPlugin({ identifiers, unstable_pluginFilter: pluginFilter, unstable_mode: mode, }?: Options): Plugin;
19
19
 
20
20
  export { vanillaExtractPlugin };
@@ -32,14 +32,13 @@ const withUserPluginFilter = ({
32
32
  function vanillaExtractPlugin({
33
33
  identifiers,
34
34
  unstable_pluginFilter: pluginFilter = defaultPluginFilter,
35
- unstable_mode = 'emitCss'
35
+ unstable_mode: 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;
43
42
  const vitePromise = import('vite');
44
43
  const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
45
44
  const getAbsoluteId = filePath => {
@@ -85,12 +84,11 @@ function vanillaExtractPlugin({
85
84
  },
86
85
  async configResolved(_resolvedConfig) {
87
86
  config = _resolvedConfig;
88
- isBuild = config.command === 'build' && !config.build.watch;
89
87
  packageName = integration.getPackageInfo(config.root).name;
90
88
  },
91
89
  async buildStart() {
92
90
  // Ensure we re-use the compiler instance between builds, e.g. in watch mode
93
- if (unstable_mode !== 'transform' && !compiler$1) {
91
+ if (mode !== 'transform' && !compiler$1) {
94
92
  var _configForViteCompile;
95
93
  const {
96
94
  loadConfigFromFile
@@ -121,8 +119,7 @@ function vanillaExtractPlugin({
121
119
  root: config.root,
122
120
  identifiers: getIdentOption(),
123
121
  cssImportSpecifier: fileIdToVirtualId,
124
- viteConfig,
125
- enableFileWatcher: !isBuild
122
+ viteConfig
126
123
  });
127
124
  }
128
125
  },
@@ -138,13 +135,13 @@ function vanillaExtractPlugin({
138
135
  var _compiler2;
139
136
  return (_compiler2 = compiler$1) === null || _compiler2 === void 0 ? void 0 : _compiler2.close();
140
137
  },
141
- async transform(code, id) {
138
+ async transform(code, id, ssr) {
142
139
  const [validId] = id.split('?');
143
140
  if (!integration.cssFileFilter.test(validId)) {
144
141
  return null;
145
142
  }
146
143
  const identOption = getIdentOption();
147
- if (unstable_mode === 'transform') {
144
+ if (ssr || mode === 'transform') {
148
145
  return integration.transform({
149
146
  source: code,
150
147
  filePath: integration.normalizePath(validId),
@@ -169,7 +166,7 @@ function vanillaExtractPlugin({
169
166
  };
170
167
 
171
168
  // We don't need to watch files in build mode
172
- if (isBuild) {
169
+ if (config.command === 'build' && !config.build.watch) {
173
170
  return result;
174
171
  }
175
172
  for (const file of watchFiles) {
@@ -32,14 +32,13 @@ const withUserPluginFilter = ({
32
32
  function vanillaExtractPlugin({
33
33
  identifiers,
34
34
  unstable_pluginFilter: pluginFilter = defaultPluginFilter,
35
- unstable_mode = 'emitCss'
35
+ unstable_mode: 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;
43
42
  const vitePromise = import('vite');
44
43
  const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
45
44
  const getAbsoluteId = filePath => {
@@ -85,12 +84,11 @@ function vanillaExtractPlugin({
85
84
  },
86
85
  async configResolved(_resolvedConfig) {
87
86
  config = _resolvedConfig;
88
- isBuild = config.command === 'build' && !config.build.watch;
89
87
  packageName = integration.getPackageInfo(config.root).name;
90
88
  },
91
89
  async buildStart() {
92
90
  // Ensure we re-use the compiler instance between builds, e.g. in watch mode
93
- if (unstable_mode !== 'transform' && !compiler$1) {
91
+ if (mode !== 'transform' && !compiler$1) {
94
92
  var _configForViteCompile;
95
93
  const {
96
94
  loadConfigFromFile
@@ -121,8 +119,7 @@ function vanillaExtractPlugin({
121
119
  root: config.root,
122
120
  identifiers: getIdentOption(),
123
121
  cssImportSpecifier: fileIdToVirtualId,
124
- viteConfig,
125
- enableFileWatcher: !isBuild
122
+ viteConfig
126
123
  });
127
124
  }
128
125
  },
@@ -138,13 +135,13 @@ function vanillaExtractPlugin({
138
135
  var _compiler2;
139
136
  return (_compiler2 = compiler$1) === null || _compiler2 === void 0 ? void 0 : _compiler2.close();
140
137
  },
141
- async transform(code, id) {
138
+ async transform(code, id, ssr) {
142
139
  const [validId] = id.split('?');
143
140
  if (!integration.cssFileFilter.test(validId)) {
144
141
  return null;
145
142
  }
146
143
  const identOption = getIdentOption();
147
- if (unstable_mode === 'transform') {
144
+ if (ssr || mode === 'transform') {
148
145
  return integration.transform({
149
146
  source: code,
150
147
  filePath: integration.normalizePath(validId),
@@ -169,7 +166,7 @@ function vanillaExtractPlugin({
169
166
  };
170
167
 
171
168
  // We don't need to watch files in build mode
172
- if (isBuild) {
169
+ if (config.command === 'build' && !config.build.watch) {
173
170
  return result;
174
171
  }
175
172
  for (const file of watchFiles) {
@@ -24,14 +24,13 @@ const withUserPluginFilter = ({
24
24
  function vanillaExtractPlugin({
25
25
  identifiers,
26
26
  unstable_pluginFilter: pluginFilter = defaultPluginFilter,
27
- unstable_mode = 'emitCss'
27
+ unstable_mode: 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;
35
34
  const vitePromise = import('vite');
36
35
  const getIdentOption = () => identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
37
36
  const getAbsoluteId = filePath => {
@@ -77,12 +76,11 @@ function vanillaExtractPlugin({
77
76
  },
78
77
  async configResolved(_resolvedConfig) {
79
78
  config = _resolvedConfig;
80
- isBuild = config.command === 'build' && !config.build.watch;
81
79
  packageName = getPackageInfo(config.root).name;
82
80
  },
83
81
  async buildStart() {
84
82
  // Ensure we re-use the compiler instance between builds, e.g. in watch mode
85
- if (unstable_mode !== 'transform' && !compiler) {
83
+ if (mode !== 'transform' && !compiler) {
86
84
  var _configForViteCompile;
87
85
  const {
88
86
  loadConfigFromFile
@@ -113,8 +111,7 @@ function vanillaExtractPlugin({
113
111
  root: config.root,
114
112
  identifiers: getIdentOption(),
115
113
  cssImportSpecifier: fileIdToVirtualId,
116
- viteConfig,
117
- enableFileWatcher: !isBuild
114
+ viteConfig
118
115
  });
119
116
  }
120
117
  },
@@ -130,13 +127,13 @@ function vanillaExtractPlugin({
130
127
  var _compiler2;
131
128
  return (_compiler2 = compiler) === null || _compiler2 === void 0 ? void 0 : _compiler2.close();
132
129
  },
133
- async transform(code, id) {
130
+ async transform(code, id, ssr) {
134
131
  const [validId] = id.split('?');
135
132
  if (!cssFileFilter.test(validId)) {
136
133
  return null;
137
134
  }
138
135
  const identOption = getIdentOption();
139
- if (unstable_mode === 'transform') {
136
+ if (ssr || mode === 'transform') {
140
137
  return transform({
141
138
  source: code,
142
139
  filePath: normalizePath(validId),
@@ -161,7 +158,7 @@ function vanillaExtractPlugin({
161
158
  };
162
159
 
163
160
  // We don't need to watch files in build mode
164
- if (isBuild) {
161
+ if (config.command === 'build' && !config.build.watch) {
165
162
  return result;
166
163
  }
167
164
  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-compiler-use-parent-watcher-20250521111515",
3
+ "version": "5.0.3-vite-ssr-fix-20250523020545",
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.2.0-compiler-use-parent-watcher-20250521111515",
19
+ "@vanilla-extract/compiler": "^0.1.3",
20
20
  "@vanilla-extract/integration": "^8.0.2"
21
21
  },
22
22
  "devDependencies": {