@vanilla-extract/vite-plugin 3.1.0 → 3.1.3

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.
package/README.md CHANGED
@@ -328,7 +328,7 @@ If you don't have a `.babelrc` file in the root of your project, create one. Add
328
328
 
329
329
  ### Gatsby
330
330
 
331
- To add to your [Gatsby](https://www.gatsbyjs.com) site, use the [gatsby-plugin-vanilla-extract](https://github.com/KyleAMathews/gatsby-plugin-vanilla-extract) plugin.
331
+ To add to your [Gatsby](https://www.gatsbyjs.com) site, use the [gatsby-plugin-vanilla-extract](https://github.com/gatsby-uc/plugins/tree/main/packages/gatsby-plugin-vanilla-extract) plugin.
332
332
 
333
333
  ### Test environments
334
334
 
@@ -33,8 +33,10 @@ var outdent__default = /*#__PURE__*/_interopDefault(outdent);
33
33
  // Mostly copied from vite's implementation
34
34
  // https://github.com/vitejs/vite/blob/efec70f816b80e55b64255b32a5f120e1cf4e4be/packages/vite/src/node/plugins/css.ts
35
35
  const resolvePostcssConfig = async config => {
36
+ var _config$css;
37
+
36
38
  // inline postcss config via vite config
37
- const inlineOptions = config.css?.postcss;
39
+ const inlineOptions = (_config$css = config.css) === null || _config$css === void 0 ? void 0 : _config$css.postcss;
38
40
  const inlineOptionsIsString = typeof inlineOptions === 'string';
39
41
 
40
42
  if (inlineOptions && !inlineOptionsIsString) {
@@ -147,11 +149,19 @@ function vanillaExtractPlugin({
147
149
  return null;
148
150
  },
149
151
 
150
- async transform(code, id, ssr) {
152
+ async transform(code, id, ssrParam) {
151
153
  if (!integration.cssFileFilter.test(id)) {
152
154
  return null;
153
155
  }
154
156
 
157
+ let ssr;
158
+
159
+ if (typeof ssrParam === 'boolean') {
160
+ ssr = ssrParam;
161
+ } else {
162
+ ssr = ssrParam === null || ssrParam === void 0 ? void 0 : ssrParam.ssr;
163
+ }
164
+
155
165
  const index = id.indexOf('?');
156
166
  const validId = index === -1 ? id : id.substring(0, index);
157
167
 
@@ -182,7 +192,7 @@ function vanillaExtractPlugin({
182
192
  return integration.processVanillaFile({
183
193
  source,
184
194
  filePath: validId,
185
- identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),
195
+ identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
186
196
  serializeVirtualCssPath: async ({
187
197
  fileScope,
188
198
  source
@@ -33,8 +33,10 @@ var outdent__default = /*#__PURE__*/_interopDefault(outdent);
33
33
  // Mostly copied from vite's implementation
34
34
  // https://github.com/vitejs/vite/blob/efec70f816b80e55b64255b32a5f120e1cf4e4be/packages/vite/src/node/plugins/css.ts
35
35
  const resolvePostcssConfig = async config => {
36
+ var _config$css;
37
+
36
38
  // inline postcss config via vite config
37
- const inlineOptions = config.css?.postcss;
39
+ const inlineOptions = (_config$css = config.css) === null || _config$css === void 0 ? void 0 : _config$css.postcss;
38
40
  const inlineOptionsIsString = typeof inlineOptions === 'string';
39
41
 
40
42
  if (inlineOptions && !inlineOptionsIsString) {
@@ -147,11 +149,19 @@ function vanillaExtractPlugin({
147
149
  return null;
148
150
  },
149
151
 
150
- async transform(code, id, ssr) {
152
+ async transform(code, id, ssrParam) {
151
153
  if (!integration.cssFileFilter.test(id)) {
152
154
  return null;
153
155
  }
154
156
 
157
+ let ssr;
158
+
159
+ if (typeof ssrParam === 'boolean') {
160
+ ssr = ssrParam;
161
+ } else {
162
+ ssr = ssrParam === null || ssrParam === void 0 ? void 0 : ssrParam.ssr;
163
+ }
164
+
155
165
  const index = id.indexOf('?');
156
166
  const validId = index === -1 ? id : id.substring(0, index);
157
167
 
@@ -182,7 +192,7 @@ function vanillaExtractPlugin({
182
192
  return integration.processVanillaFile({
183
193
  source,
184
194
  filePath: validId,
185
- identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),
195
+ identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
186
196
  serializeVirtualCssPath: async ({
187
197
  fileScope,
188
198
  source
@@ -6,8 +6,10 @@ import { getPackageInfo, parseFileScope, cssFileFilter, addFileScope, compile, p
6
6
  // Mostly copied from vite's implementation
7
7
  // https://github.com/vitejs/vite/blob/efec70f816b80e55b64255b32a5f120e1cf4e4be/packages/vite/src/node/plugins/css.ts
8
8
  const resolvePostcssConfig = async config => {
9
+ var _config$css;
10
+
9
11
  // inline postcss config via vite config
10
- const inlineOptions = config.css?.postcss;
12
+ const inlineOptions = (_config$css = config.css) === null || _config$css === void 0 ? void 0 : _config$css.postcss;
11
13
  const inlineOptionsIsString = typeof inlineOptions === 'string';
12
14
 
13
15
  if (inlineOptions && !inlineOptionsIsString) {
@@ -120,11 +122,19 @@ function vanillaExtractPlugin({
120
122
  return null;
121
123
  },
122
124
 
123
- async transform(code, id, ssr) {
125
+ async transform(code, id, ssrParam) {
124
126
  if (!cssFileFilter.test(id)) {
125
127
  return null;
126
128
  }
127
129
 
130
+ let ssr;
131
+
132
+ if (typeof ssrParam === 'boolean') {
133
+ ssr = ssrParam;
134
+ } else {
135
+ ssr = ssrParam === null || ssrParam === void 0 ? void 0 : ssrParam.ssr;
136
+ }
137
+
128
138
  const index = id.indexOf('?');
129
139
  const validId = index === -1 ? id : id.substring(0, index);
130
140
 
@@ -155,7 +165,7 @@ function vanillaExtractPlugin({
155
165
  return processVanillaFile({
156
166
  source,
157
167
  filePath: validId,
158
- identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),
168
+ identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
159
169
  serializeVirtualCssPath: async ({
160
170
  fileScope,
161
171
  source
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanilla-extract/vite-plugin",
3
- "version": "3.1.0",
3
+ "version": "3.1.3",
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,13 +15,13 @@
15
15
  "author": "SEEK",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@vanilla-extract/integration": "^2.0.0",
18
+ "@vanilla-extract/integration": "^3.0.0",
19
19
  "outdent": "^0.8.0",
20
20
  "postcss": "^8.3.6",
21
21
  "postcss-load-config": "^3.1.0"
22
22
  },
23
23
  "devDependencies": {
24
- "vite": "^2.6.0"
24
+ "vite": "^2.7.0"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "vite": "^2.2.3"