@vanilla-extract/vite-plugin 3.1.1 → 3.1.4
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/
|
|
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
|
|
|
@@ -443,6 +443,15 @@ export const childClass = style({
|
|
|
443
443
|
>
|
|
444
444
|
> If you want to globally target child nodes within the current element (e.g. `'& a[href]'`), you should use [`globalStyle`](#globalstyle) instead.
|
|
445
445
|
|
|
446
|
+
For fallback styles you may simply pass an array of properties instead of a single prop.
|
|
447
|
+
|
|
448
|
+
```ts
|
|
449
|
+
export const exampleStyle = style({
|
|
450
|
+
// in Firefox and IE the "overflow: overlay" will be ignored and the "overflow: auto" will be applied
|
|
451
|
+
overflow: ['auto', 'overlay'],
|
|
452
|
+
});
|
|
453
|
+
```
|
|
454
|
+
|
|
446
455
|
Multiple styles can be composed into a single rule by providing an array of styles.
|
|
447
456
|
|
|
448
457
|
```ts
|
|
@@ -837,7 +846,7 @@ import { createVar, fallbackVar, style } from '@vanilla-extract/css';
|
|
|
837
846
|
export const colorVar = createVar();
|
|
838
847
|
|
|
839
848
|
export const exampleStyle = style({
|
|
840
|
-
color: fallbackVar(colorVar, 'blue')
|
|
849
|
+
color: fallbackVar(colorVar, 'blue'),
|
|
841
850
|
});
|
|
842
851
|
```
|
|
843
852
|
|
|
@@ -850,7 +859,7 @@ export const primaryColorVar = createVar();
|
|
|
850
859
|
export const secondaryColorVar = createVar();
|
|
851
860
|
|
|
852
861
|
export const exampleStyle = style({
|
|
853
|
-
color: fallbackVar(primaryColorVar, secondaryColorVar, 'blue')
|
|
862
|
+
color: fallbackVar(primaryColorVar, secondaryColorVar, 'blue'),
|
|
854
863
|
});
|
|
855
864
|
```
|
|
856
865
|
|
|
@@ -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
|
|
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) {
|
|
@@ -157,7 +159,7 @@ function vanillaExtractPlugin({
|
|
|
157
159
|
if (typeof ssrParam === 'boolean') {
|
|
158
160
|
ssr = ssrParam;
|
|
159
161
|
} else {
|
|
160
|
-
ssr = ssrParam
|
|
162
|
+
ssr = ssrParam === null || ssrParam === void 0 ? void 0 : ssrParam.ssr;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
const index = id.indexOf('?');
|
|
@@ -190,12 +192,13 @@ function vanillaExtractPlugin({
|
|
|
190
192
|
return integration.processVanillaFile({
|
|
191
193
|
source,
|
|
192
194
|
filePath: validId,
|
|
193
|
-
identOption: identifiers
|
|
195
|
+
identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
|
|
194
196
|
serializeVirtualCssPath: async ({
|
|
195
197
|
fileScope,
|
|
196
198
|
source
|
|
197
199
|
}) => {
|
|
198
|
-
|
|
200
|
+
// This file id is requested through a URL where ".." isn't valid.
|
|
201
|
+
const fileId = integration.stringifyFileScope(fileScope).replace(/\.\./g, '_dir_up_');
|
|
199
202
|
const id = `${virtualPrefix}${fileId}${virtualExt}`;
|
|
200
203
|
let cssSource = source;
|
|
201
204
|
|
|
@@ -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
|
|
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) {
|
|
@@ -157,7 +159,7 @@ function vanillaExtractPlugin({
|
|
|
157
159
|
if (typeof ssrParam === 'boolean') {
|
|
158
160
|
ssr = ssrParam;
|
|
159
161
|
} else {
|
|
160
|
-
ssr = ssrParam
|
|
162
|
+
ssr = ssrParam === null || ssrParam === void 0 ? void 0 : ssrParam.ssr;
|
|
161
163
|
}
|
|
162
164
|
|
|
163
165
|
const index = id.indexOf('?');
|
|
@@ -190,12 +192,13 @@ function vanillaExtractPlugin({
|
|
|
190
192
|
return integration.processVanillaFile({
|
|
191
193
|
source,
|
|
192
194
|
filePath: validId,
|
|
193
|
-
identOption: identifiers
|
|
195
|
+
identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
|
|
194
196
|
serializeVirtualCssPath: async ({
|
|
195
197
|
fileScope,
|
|
196
198
|
source
|
|
197
199
|
}) => {
|
|
198
|
-
|
|
200
|
+
// This file id is requested through a URL where ".." isn't valid.
|
|
201
|
+
const fileId = integration.stringifyFileScope(fileScope).replace(/\.\./g, '_dir_up_');
|
|
199
202
|
const id = `${virtualPrefix}${fileId}${virtualExt}`;
|
|
200
203
|
let cssSource = source;
|
|
201
204
|
|
|
@@ -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
|
|
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) {
|
|
@@ -130,7 +132,7 @@ function vanillaExtractPlugin({
|
|
|
130
132
|
if (typeof ssrParam === 'boolean') {
|
|
131
133
|
ssr = ssrParam;
|
|
132
134
|
} else {
|
|
133
|
-
ssr = ssrParam
|
|
135
|
+
ssr = ssrParam === null || ssrParam === void 0 ? void 0 : ssrParam.ssr;
|
|
134
136
|
}
|
|
135
137
|
|
|
136
138
|
const index = id.indexOf('?');
|
|
@@ -163,12 +165,13 @@ function vanillaExtractPlugin({
|
|
|
163
165
|
return processVanillaFile({
|
|
164
166
|
source,
|
|
165
167
|
filePath: validId,
|
|
166
|
-
identOption: identifiers
|
|
168
|
+
identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
|
|
167
169
|
serializeVirtualCssPath: async ({
|
|
168
170
|
fileScope,
|
|
169
171
|
source
|
|
170
172
|
}) => {
|
|
171
|
-
|
|
173
|
+
// This file id is requested through a URL where ".." isn't valid.
|
|
174
|
+
const fileId = stringifyFileScope(fileScope).replace(/\.\./g, '_dir_up_');
|
|
172
175
|
const id = `${virtualPrefix}${fileId}${virtualExt}`;
|
|
173
176
|
let cssSource = source;
|
|
174
177
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanilla-extract/vite-plugin",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.4",
|
|
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": "^
|
|
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"
|