@vanilla-extract/vite-plugin 4.0.12 → 4.0.13

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.
@@ -64,17 +64,6 @@ function vanillaExtractPlugin({
64
64
  }
65
65
  }
66
66
  }
67
- function addWatchFiles(fromId, files) {
68
- // We don't need to watch files in build mode
69
- if (config.command === 'build' && !config.build.watch) {
70
- return;
71
- }
72
- for (const file of files) {
73
- if (!file.includes('node_modules') && integration.normalizePath(file) !== fromId) {
74
- this.addWatchFile(file);
75
- }
76
- }
77
- }
78
67
  return {
79
68
  name: 'vanilla-extract',
80
69
  configureServer(_server) {
@@ -161,16 +150,30 @@ function vanillaExtractPlugin({
161
150
  } = await compiler.processVanillaFile(absoluteId, {
162
151
  outputCss: true
163
152
  });
164
- addWatchFiles.call(this, absoluteId, watchFiles);
165
-
166
- // We have to invalidate the virtual module, not the real one we just transformed
167
- invalidateModule(fileIdToVirtualId(absoluteId));
168
- return {
153
+ const result = {
169
154
  code: source,
170
155
  map: {
171
156
  mappings: ''
172
157
  }
173
158
  };
159
+
160
+ // We don't need to watch files in build mode
161
+ if (config.command === 'build' && !config.build.watch) {
162
+ return result;
163
+ }
164
+ for (const file of watchFiles) {
165
+ if (!file.includes('node_modules') && integration.normalizePath(file) !== absoluteId) {
166
+ this.addWatchFile(file);
167
+ }
168
+
169
+ // We have to invalidate the virtual module & deps, not the real one we just transformed
170
+ // The deps have to be invalidated in case one of them changing was the trigger causing
171
+ // the current transformation
172
+ if (file.endsWith('.css.ts')) {
173
+ invalidateModule(fileIdToVirtualId(file));
174
+ }
175
+ }
176
+ return result;
174
177
  }
175
178
  },
176
179
  resolveId(source) {
@@ -64,17 +64,6 @@ function vanillaExtractPlugin({
64
64
  }
65
65
  }
66
66
  }
67
- function addWatchFiles(fromId, files) {
68
- // We don't need to watch files in build mode
69
- if (config.command === 'build' && !config.build.watch) {
70
- return;
71
- }
72
- for (const file of files) {
73
- if (!file.includes('node_modules') && integration.normalizePath(file) !== fromId) {
74
- this.addWatchFile(file);
75
- }
76
- }
77
- }
78
67
  return {
79
68
  name: 'vanilla-extract',
80
69
  configureServer(_server) {
@@ -161,16 +150,30 @@ function vanillaExtractPlugin({
161
150
  } = await compiler.processVanillaFile(absoluteId, {
162
151
  outputCss: true
163
152
  });
164
- addWatchFiles.call(this, absoluteId, watchFiles);
165
-
166
- // We have to invalidate the virtual module, not the real one we just transformed
167
- invalidateModule(fileIdToVirtualId(absoluteId));
168
- return {
153
+ const result = {
169
154
  code: source,
170
155
  map: {
171
156
  mappings: ''
172
157
  }
173
158
  };
159
+
160
+ // We don't need to watch files in build mode
161
+ if (config.command === 'build' && !config.build.watch) {
162
+ return result;
163
+ }
164
+ for (const file of watchFiles) {
165
+ if (!file.includes('node_modules') && integration.normalizePath(file) !== absoluteId) {
166
+ this.addWatchFile(file);
167
+ }
168
+
169
+ // We have to invalidate the virtual module & deps, not the real one we just transformed
170
+ // The deps have to be invalidated in case one of them changing was the trigger causing
171
+ // the current transformation
172
+ if (file.endsWith('.css.ts')) {
173
+ invalidateModule(fileIdToVirtualId(file));
174
+ }
175
+ }
176
+ return result;
174
177
  }
175
178
  },
176
179
  resolveId(source) {
@@ -56,17 +56,6 @@ function vanillaExtractPlugin({
56
56
  }
57
57
  }
58
58
  }
59
- function addWatchFiles(fromId, files) {
60
- // We don't need to watch files in build mode
61
- if (config.command === 'build' && !config.build.watch) {
62
- return;
63
- }
64
- for (const file of files) {
65
- if (!file.includes('node_modules') && normalizePath(file) !== fromId) {
66
- this.addWatchFile(file);
67
- }
68
- }
69
- }
70
59
  return {
71
60
  name: 'vanilla-extract',
72
61
  configureServer(_server) {
@@ -153,16 +142,30 @@ function vanillaExtractPlugin({
153
142
  } = await compiler.processVanillaFile(absoluteId, {
154
143
  outputCss: true
155
144
  });
156
- addWatchFiles.call(this, absoluteId, watchFiles);
157
-
158
- // We have to invalidate the virtual module, not the real one we just transformed
159
- invalidateModule(fileIdToVirtualId(absoluteId));
160
- return {
145
+ const result = {
161
146
  code: source,
162
147
  map: {
163
148
  mappings: ''
164
149
  }
165
150
  };
151
+
152
+ // We don't need to watch files in build mode
153
+ if (config.command === 'build' && !config.build.watch) {
154
+ return result;
155
+ }
156
+ for (const file of watchFiles) {
157
+ if (!file.includes('node_modules') && normalizePath(file) !== absoluteId) {
158
+ this.addWatchFile(file);
159
+ }
160
+
161
+ // We have to invalidate the virtual module & deps, not the real one we just transformed
162
+ // The deps have to be invalidated in case one of them changing was the trigger causing
163
+ // the current transformation
164
+ if (file.endsWith('.css.ts')) {
165
+ invalidateModule(fileIdToVirtualId(file));
166
+ }
167
+ }
168
+ return result;
166
169
  }
167
170
  },
168
171
  resolveId(source) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanilla-extract/vite-plugin",
3
- "version": "4.0.12",
3
+ "version": "4.0.13",
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",