@vanilla-extract/vite-plugin 5.1.0-vite-inline-dev-css-20250617003237 → 5.1.1-vite-hmr-fix-20250706080631

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.
@@ -63,10 +63,7 @@ function vanillaExtractPlugin({
63
63
  const modules = moduleGraph.getModulesByFile(absoluteId);
64
64
  if (modules) {
65
65
  for (const module of modules) {
66
- moduleGraph.invalidateModule(module);
67
-
68
- // Vite uses this timestamp to add `?t=` query string automatically for HMR.
69
- module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now();
66
+ moduleGraph.invalidateModule(module, undefined, undefined, true);
70
67
  }
71
68
  }
72
69
  }
@@ -85,7 +82,8 @@ function vanillaExtractPlugin({
85
82
  tag: 'style',
86
83
  children: allCss,
87
84
  attrs: {
88
- type: 'text/css'
85
+ type: 'text/css',
86
+ 'data-vanilla-extract-inline-dev-css': true
89
87
  },
90
88
  injectTo: 'head-prepend'
91
89
  }];
@@ -158,7 +156,7 @@ function vanillaExtractPlugin({
158
156
  var _compiler3;
159
157
  return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
160
158
  },
161
- async transform(code, id) {
159
+ async transform(code, id, options = {}) {
162
160
  const [validId] = id.split('?');
163
161
  if (!integration.cssFileFilter.test(validId)) {
164
162
  return null;
@@ -188,8 +186,8 @@ function vanillaExtractPlugin({
188
186
  }
189
187
  };
190
188
 
191
- // We don't need to watch files in build mode
192
- if (isBuild) {
189
+ // We don't need to watch files or invalidate modules in build mode or during SSR
190
+ if (isBuild || options.ssr) {
193
191
  return result;
194
192
  }
195
193
  for (const file of watchFiles) {
@@ -63,10 +63,7 @@ function vanillaExtractPlugin({
63
63
  const modules = moduleGraph.getModulesByFile(absoluteId);
64
64
  if (modules) {
65
65
  for (const module of modules) {
66
- moduleGraph.invalidateModule(module);
67
-
68
- // Vite uses this timestamp to add `?t=` query string automatically for HMR.
69
- module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now();
66
+ moduleGraph.invalidateModule(module, undefined, undefined, true);
70
67
  }
71
68
  }
72
69
  }
@@ -85,7 +82,8 @@ function vanillaExtractPlugin({
85
82
  tag: 'style',
86
83
  children: allCss,
87
84
  attrs: {
88
- type: 'text/css'
85
+ type: 'text/css',
86
+ 'data-vanilla-extract-inline-dev-css': true
89
87
  },
90
88
  injectTo: 'head-prepend'
91
89
  }];
@@ -158,7 +156,7 @@ function vanillaExtractPlugin({
158
156
  var _compiler3;
159
157
  return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
160
158
  },
161
- async transform(code, id) {
159
+ async transform(code, id, options = {}) {
162
160
  const [validId] = id.split('?');
163
161
  if (!integration.cssFileFilter.test(validId)) {
164
162
  return null;
@@ -188,8 +186,8 @@ function vanillaExtractPlugin({
188
186
  }
189
187
  };
190
188
 
191
- // We don't need to watch files in build mode
192
- if (isBuild) {
189
+ // We don't need to watch files or invalidate modules in build mode or during SSR
190
+ if (isBuild || options.ssr) {
193
191
  return result;
194
192
  }
195
193
  for (const file of watchFiles) {
@@ -55,10 +55,7 @@ function vanillaExtractPlugin({
55
55
  const modules = moduleGraph.getModulesByFile(absoluteId);
56
56
  if (modules) {
57
57
  for (const module of modules) {
58
- moduleGraph.invalidateModule(module);
59
-
60
- // Vite uses this timestamp to add `?t=` query string automatically for HMR.
61
- module.lastHMRTimestamp = module.lastInvalidationTimestamp || Date.now();
58
+ moduleGraph.invalidateModule(module, undefined, undefined, true);
62
59
  }
63
60
  }
64
61
  }
@@ -77,7 +74,8 @@ function vanillaExtractPlugin({
77
74
  tag: 'style',
78
75
  children: allCss,
79
76
  attrs: {
80
- type: 'text/css'
77
+ type: 'text/css',
78
+ 'data-vanilla-extract-inline-dev-css': true
81
79
  },
82
80
  injectTo: 'head-prepend'
83
81
  }];
@@ -150,7 +148,7 @@ function vanillaExtractPlugin({
150
148
  var _compiler3;
151
149
  return (_compiler3 = compiler) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
152
150
  },
153
- async transform(code, id) {
151
+ async transform(code, id, options = {}) {
154
152
  const [validId] = id.split('?');
155
153
  if (!cssFileFilter.test(validId)) {
156
154
  return null;
@@ -180,8 +178,8 @@ function vanillaExtractPlugin({
180
178
  }
181
179
  };
182
180
 
183
- // We don't need to watch files in build mode
184
- if (isBuild) {
181
+ // We don't need to watch files or invalidate modules in build mode or during SSR
182
+ if (isBuild || options.ssr) {
185
183
  return result;
186
184
  }
187
185
  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.1.0-vite-inline-dev-css-20250617003237",
3
+ "version": "5.1.1-vite-hmr-fix-20250706080631",
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.3.0-vite-inline-dev-css-20250617003237",
19
+ "@vanilla-extract/compiler": "^0.3.0",
20
20
  "@vanilla-extract/integration": "^8.0.4"
21
21
  },
22
22
  "devDependencies": {