@vanilla-extract/vite-plugin 4.0.7 → 4.0.9

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.
@@ -81,7 +81,8 @@ function vanillaExtractPlugin({
81
81
  packageName = integration.getPackageInfo(config.root).name;
82
82
  },
83
83
  async buildStart() {
84
- if (mode !== 'transform') {
84
+ // Ensure we re-use the compiler instance between builds, e.g. in watch mode
85
+ if (mode !== 'transform' && !compiler) {
85
86
  var _configFile$config$pl;
86
87
  const {
87
88
  loadConfigFromFile
@@ -114,8 +115,16 @@ function vanillaExtractPlugin({
114
115
  }
115
116
  },
116
117
  buildEnd() {
117
- var _compiler;
118
- (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
118
+ // When using the rollup watcher, we don't want to close the compiler after every build.
119
+ // Instead, we close it when the watcher is closed via the closeWatcher hook.
120
+ if (!config.build.watch) {
121
+ var _compiler;
122
+ (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
123
+ }
124
+ },
125
+ closeWatcher() {
126
+ var _compiler2;
127
+ return (_compiler2 = compiler) === null || _compiler2 === void 0 ? void 0 : _compiler2.close();
119
128
  },
120
129
  async transform(code, id) {
121
130
  const [validId] = id.split('?');
@@ -153,14 +162,14 @@ function vanillaExtractPlugin({
153
162
  }
154
163
  },
155
164
  resolveId(source) {
156
- var _compiler2;
165
+ var _compiler3;
157
166
  const [validId, query] = source.split('?');
158
167
  if (!isVirtualId(validId)) return;
159
168
  const absoluteId = getAbsoluteId(validId);
160
169
  if ( // We should always have CSS for a file here.
161
170
  // The only valid scenario for a missing one is if someone had written
162
171
  // a file in their app using the .vanilla.js/.vanilla.css extension
163
- (_compiler2 = compiler) !== null && _compiler2 !== void 0 && _compiler2.getCssForFile(virtualIdToFileId(absoluteId))) {
172
+ (_compiler3 = compiler) !== null && _compiler3 !== void 0 && _compiler3.getCssForFile(virtualIdToFileId(absoluteId))) {
164
173
  // Keep the original query string for HMR.
165
174
  return absoluteId + (query ? `?${query}` : '');
166
175
  }
@@ -81,7 +81,8 @@ function vanillaExtractPlugin({
81
81
  packageName = integration.getPackageInfo(config.root).name;
82
82
  },
83
83
  async buildStart() {
84
- if (mode !== 'transform') {
84
+ // Ensure we re-use the compiler instance between builds, e.g. in watch mode
85
+ if (mode !== 'transform' && !compiler) {
85
86
  var _configFile$config$pl;
86
87
  const {
87
88
  loadConfigFromFile
@@ -114,8 +115,16 @@ function vanillaExtractPlugin({
114
115
  }
115
116
  },
116
117
  buildEnd() {
117
- var _compiler;
118
- (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
118
+ // When using the rollup watcher, we don't want to close the compiler after every build.
119
+ // Instead, we close it when the watcher is closed via the closeWatcher hook.
120
+ if (!config.build.watch) {
121
+ var _compiler;
122
+ (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
123
+ }
124
+ },
125
+ closeWatcher() {
126
+ var _compiler2;
127
+ return (_compiler2 = compiler) === null || _compiler2 === void 0 ? void 0 : _compiler2.close();
119
128
  },
120
129
  async transform(code, id) {
121
130
  const [validId] = id.split('?');
@@ -153,14 +162,14 @@ function vanillaExtractPlugin({
153
162
  }
154
163
  },
155
164
  resolveId(source) {
156
- var _compiler2;
165
+ var _compiler3;
157
166
  const [validId, query] = source.split('?');
158
167
  if (!isVirtualId(validId)) return;
159
168
  const absoluteId = getAbsoluteId(validId);
160
169
  if ( // We should always have CSS for a file here.
161
170
  // The only valid scenario for a missing one is if someone had written
162
171
  // a file in their app using the .vanilla.js/.vanilla.css extension
163
- (_compiler2 = compiler) !== null && _compiler2 !== void 0 && _compiler2.getCssForFile(virtualIdToFileId(absoluteId))) {
172
+ (_compiler3 = compiler) !== null && _compiler3 !== void 0 && _compiler3.getCssForFile(virtualIdToFileId(absoluteId))) {
164
173
  // Keep the original query string for HMR.
165
174
  return absoluteId + (query ? `?${query}` : '');
166
175
  }
@@ -73,7 +73,8 @@ function vanillaExtractPlugin({
73
73
  packageName = getPackageInfo(config.root).name;
74
74
  },
75
75
  async buildStart() {
76
- if (mode !== 'transform') {
76
+ // Ensure we re-use the compiler instance between builds, e.g. in watch mode
77
+ if (mode !== 'transform' && !compiler) {
77
78
  var _configFile$config$pl;
78
79
  const {
79
80
  loadConfigFromFile
@@ -106,8 +107,16 @@ function vanillaExtractPlugin({
106
107
  }
107
108
  },
108
109
  buildEnd() {
109
- var _compiler;
110
- (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
110
+ // When using the rollup watcher, we don't want to close the compiler after every build.
111
+ // Instead, we close it when the watcher is closed via the closeWatcher hook.
112
+ if (!config.build.watch) {
113
+ var _compiler;
114
+ (_compiler = compiler) === null || _compiler === void 0 || _compiler.close();
115
+ }
116
+ },
117
+ closeWatcher() {
118
+ var _compiler2;
119
+ return (_compiler2 = compiler) === null || _compiler2 === void 0 ? void 0 : _compiler2.close();
111
120
  },
112
121
  async transform(code, id) {
113
122
  const [validId] = id.split('?');
@@ -145,14 +154,14 @@ function vanillaExtractPlugin({
145
154
  }
146
155
  },
147
156
  resolveId(source) {
148
- var _compiler2;
157
+ var _compiler3;
149
158
  const [validId, query] = source.split('?');
150
159
  if (!isVirtualId(validId)) return;
151
160
  const absoluteId = getAbsoluteId(validId);
152
161
  if ( // We should always have CSS for a file here.
153
162
  // The only valid scenario for a missing one is if someone had written
154
163
  // a file in their app using the .vanilla.js/.vanilla.css extension
155
- (_compiler2 = compiler) !== null && _compiler2 !== void 0 && _compiler2.getCssForFile(virtualIdToFileId(absoluteId))) {
164
+ (_compiler3 = compiler) !== null && _compiler3 !== void 0 && _compiler3.getCssForFile(virtualIdToFileId(absoluteId))) {
156
165
  // Keep the original query string for HMR.
157
166
  return absoluteId + (query ? `?${query}` : '');
158
167
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanilla-extract/vite-plugin",
3
- "version": "4.0.7",
3
+ "version": "4.0.9",
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",
@@ -15,7 +15,7 @@
15
15
  "author": "SEEK",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@vanilla-extract/integration": "^7.1.2"
18
+ "@vanilla-extract/integration": "^7.1.3"
19
19
  },
20
20
  "devDependencies": {
21
21
  "vite": "^5.0.11"