@vanilla-extract/vite-plugin 3.0.1 → 3.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 SEEK
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -82,7 +82,6 @@ Want to work at a higher level while maximising style re-use? Check out 🍨 [S
82
82
  - [webpack](#webpack)
83
83
  - [esbuild](#esbuild)
84
84
  - [Vite](#vite)
85
- - [Snowpack](#snowpack)
86
85
  - [Next.js](#nextjs)
87
86
  - [Gatsby](#gatsby)
88
87
  - [Test environments](#test-environments)
@@ -95,6 +94,7 @@ Want to work at a higher level while maximising style re-use? Check out 🍨 [S
95
94
  - [createTheme](#createtheme)
96
95
  - [createGlobalTheme](#createglobaltheme)
97
96
  - [createThemeContract](#createthemecontract)
97
+ - [createGlobalThemeContract](#createglobalthemecontract)
98
98
  - [assignVars](#assignvars)
99
99
  - [createVar](#createvar)
100
100
  - [fallbackVar](#fallbackvar)
@@ -271,27 +271,6 @@ export default {
271
271
 
272
272
  > Please note: There are currently no automatic readable class names during development. However, you can still manually provide a debug ID as the last argument to functions that generate scoped styles, e.g. `export const className = style({ ... }, 'className');`
273
273
 
274
- ### Snowpack
275
-
276
- 1. Install the dependencies.
277
-
278
- ```bash
279
- npm install @vanilla-extract/css @vanilla-extract/snowpack-plugin
280
- ```
281
-
282
- 2. Add the [Snowpack](https://www.snowpack.dev/) plugin to your snowpack config.
283
-
284
- > 💡 This plugin accepts an optional [configuration object](#configuration).
285
-
286
- ```js
287
- // snowpack.config.json
288
- {
289
- "plugins": ["@vanilla-extract/snowpack-plugin"]
290
- }
291
- ```
292
-
293
- > Please note: There are currently no automatic readable class names during development. However, you can still manually provide a debug ID as the last argument to functions that generate scoped styles, e.g. `export const className = style({ ... }, 'className');`
294
-
295
274
  ### Next.js
296
275
 
297
276
  1. Install the dependencies.
@@ -300,16 +279,7 @@ npm install @vanilla-extract/css @vanilla-extract/snowpack-plugin
300
279
  npm install @vanilla-extract/css @vanilla-extract/babel-plugin @vanilla-extract/next-plugin
301
280
  ```
302
281
 
303
- 2. If you don't have a `.babelrc` file in the root of your project, create one. Add the [Babel](https://babeljs.io) plugin to your `.babelrc` file, ensuring that you're also including `"next/babel"` in your `presets` array.
304
-
305
- ```json
306
- {
307
- "presets": ["next/babel"],
308
- "plugins": ["@vanilla-extract/babel-plugin"]
309
- }
310
- ```
311
-
312
- 3. If you don't have a `next.config.js` file in the root of your project, create one. Add the [Next.js](https://nextjs.org) plugin to your `next.config.js` file.
282
+ 2. If you don't have a `next.config.js` file in the root of your project, create one. Add the [Next.js](https://nextjs.org) plugin to your `next.config.js` file.
313
283
 
314
284
  > 💡 This plugin accepts an optional [configuration object](#configuration).
315
285
 
@@ -319,6 +289,7 @@ const {
319
289
  } = require('@vanilla-extract/next-plugin');
320
290
  const withVanillaExtract = createVanillaExtractPlugin();
321
291
 
292
+ /** @type {import('next').NextConfig} */
322
293
  const nextConfig = {};
323
294
 
324
295
  module.exports = withVanillaExtract(nextConfig);
@@ -336,11 +307,25 @@ const withMDX = require('@next/mdx')({
336
307
  extension: /\.mdx$/
337
308
  });
338
309
 
310
+ /** @type {import('next').NextConfig} */
339
311
  const nextConfig = {};
340
312
 
341
313
  module.exports = withVanillaExtract(withMDX(nextConfig));
342
314
  ```
343
315
 
316
+ 3. (Optional) If you want to automatically generate debug IDs during development, you can add the [Babel](https://babeljs.io) plugin. Note that this step will cause Next.js to switch from [SWC](https://github.com/swc-project/swc) to Babel, increasing build times. This may or may not be an issue depending on the size of your project.
317
+
318
+ > Note: While optional for Next.js, the Babel plugin is still required when trying to run `.css.ts` files in Node for unit testing since the files are no longer being processed by a bundler.
319
+
320
+ If you don't have a `.babelrc` file in the root of your project, create one. Add the Babel plugin to your `.babelrc` file, ensuring that you're also including `"next/babel"` in your `presets` array.
321
+
322
+ ```json
323
+ {
324
+ "presets": ["next/babel"],
325
+ "plugins": ["@vanilla-extract/babel-plugin"]
326
+ }
327
+ ```
328
+
344
329
  ### Gatsby
345
330
 
346
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.
@@ -1,7 +1,7 @@
1
- import type { Plugin } from 'vite';
2
- import { IdentifierOption } from '@vanilla-extract/integration';
3
- interface Options {
4
- identifiers?: IdentifierOption;
5
- }
6
- export declare function vanillaExtractPlugin({ identifiers }?: Options): Plugin;
7
- export {};
1
+ import type { Plugin } from 'vite';
2
+ import { IdentifierOption } from '@vanilla-extract/integration';
3
+ interface Options {
4
+ identifiers?: IdentifierOption;
5
+ }
6
+ export declare function vanillaExtractPlugin({ identifiers }?: Options): Plugin;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { ResolvedConfig } from 'vite';
2
+ import type { ProcessOptions, Plugin } from 'postcss';
3
+ export interface PostCSSConfigResult {
4
+ options: ProcessOptions;
5
+ plugins: Plugin[];
6
+ }
7
+ export declare const resolvePostcssConfig: (config: ResolvedConfig) => Promise<PostCSSConfigResult | null>;
@@ -9,9 +9,61 @@ var integration = require('@vanilla-extract/integration');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
11
11
 
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n["default"] = e;
27
+ return Object.freeze(n);
28
+ }
29
+
12
30
  var path__default = /*#__PURE__*/_interopDefault(path);
13
31
  var outdent__default = /*#__PURE__*/_interopDefault(outdent);
14
32
 
33
+ // Mostly copied from vite's implementation
34
+ // https://github.com/vitejs/vite/blob/efec70f816b80e55b64255b32a5f120e1cf4e4be/packages/vite/src/node/plugins/css.ts
35
+ const resolvePostcssConfig = async config => {
36
+ // inline postcss config via vite config
37
+ const inlineOptions = config.css?.postcss;
38
+ const inlineOptionsIsString = typeof inlineOptions === 'string';
39
+
40
+ if (inlineOptions && !inlineOptionsIsString) {
41
+ const options = { ...inlineOptions
42
+ };
43
+ delete options.plugins;
44
+ return {
45
+ options,
46
+ plugins: inlineOptions.plugins || []
47
+ };
48
+ } else {
49
+ try {
50
+ const searchPath = typeof inlineOptions === 'string' ? inlineOptions : config.root;
51
+ const postCssConfig = await (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('postcss-load-config')); })).default({}, searchPath);
52
+ return {
53
+ options: postCssConfig.options,
54
+ // @ts-expect-error - The postcssrc options don't agree with real postcss, but it should be ok
55
+ plugins: postCssConfig.plugins
56
+ };
57
+ } catch (e) {
58
+ if (!/No PostCSS Config found/.test(e.message)) {
59
+ throw e;
60
+ }
61
+
62
+ return null;
63
+ }
64
+ }
65
+ };
66
+
15
67
  const styleUpdateEvent = fileId => `vanilla-extract-style-update:${fileId}`;
16
68
 
17
69
  const virtualPrefix = 'virtual:vanilla-extract:';
@@ -21,6 +73,7 @@ function vanillaExtractPlugin({
21
73
  let config;
22
74
  let packageInfo;
23
75
  let server;
76
+ let postCssConfig;
24
77
  const cssMap = new Map();
25
78
  let virtualExt;
26
79
  return {
@@ -43,8 +96,13 @@ function vanillaExtractPlugin({
43
96
  };
44
97
  },
45
98
 
46
- configResolved(resolvedConfig) {
99
+ async configResolved(resolvedConfig) {
47
100
  config = resolvedConfig;
101
+
102
+ if (config.command === 'serve') {
103
+ postCssConfig = await resolvePostcssConfig(config);
104
+ }
105
+
48
106
  virtualExt = `.vanilla.${config.command === 'serve' ? 'js' : 'css'}`;
49
107
  packageInfo = integration.getPackageInfo(config.root);
50
108
  },
@@ -70,7 +128,7 @@ function vanillaExtractPlugin({
70
128
  }
71
129
 
72
130
  const fileScope = integration.parseFileScope(fileScopeId);
73
- return outdent__default['default']`
131
+ return outdent__default["default"]`
74
132
  import { injectStyles } from '@vanilla-extract/css/injectStyles';
75
133
 
76
134
  const inject = (css) => injectStyles({
@@ -100,7 +158,7 @@ function vanillaExtractPlugin({
100
158
  if (ssr) {
101
159
  return integration.addFileScope({
102
160
  source: code,
103
- filePath: vite.normalizePath(path__default['default'].relative(packageInfo.dirname, validId)),
161
+ filePath: vite.normalizePath(path__default["default"].relative(packageInfo.dirname, validId)),
104
162
  packageInfo
105
163
  }).source;
106
164
  }
@@ -124,13 +182,22 @@ function vanillaExtractPlugin({
124
182
  return integration.processVanillaFile({
125
183
  source,
126
184
  filePath: validId,
127
- identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
128
- serializeVirtualCssPath: ({
185
+ identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),
186
+ serializeVirtualCssPath: async ({
129
187
  fileScope,
130
188
  source
131
189
  }) => {
132
190
  const fileId = integration.stringifyFileScope(fileScope);
133
191
  const id = `${virtualPrefix}${fileId}${virtualExt}`;
192
+ let cssSource = source;
193
+
194
+ if (postCssConfig) {
195
+ const postCssResult = await (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('postcss')); })).default(postCssConfig.plugins).process(source, { ...postCssConfig.options,
196
+ from: undefined,
197
+ map: false
198
+ });
199
+ cssSource = postCssResult.css;
200
+ }
134
201
 
135
202
  if (server && cssMap.has(fileId) && cssMap.get(fileId) !== source) {
136
203
  const {
@@ -145,11 +212,11 @@ function vanillaExtractPlugin({
145
212
  server.ws.send({
146
213
  type: 'custom',
147
214
  event: styleUpdateEvent(fileId),
148
- data: source
215
+ data: cssSource
149
216
  });
150
217
  }
151
218
 
152
- cssMap.set(fileId, source);
219
+ cssMap.set(fileId, cssSource);
153
220
  return `import "${id}";`;
154
221
  }
155
222
  });
@@ -9,9 +9,61 @@ var integration = require('@vanilla-extract/integration');
9
9
 
10
10
  function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
11
11
 
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () { return e[k]; }
22
+ });
23
+ }
24
+ });
25
+ }
26
+ n["default"] = e;
27
+ return Object.freeze(n);
28
+ }
29
+
12
30
  var path__default = /*#__PURE__*/_interopDefault(path);
13
31
  var outdent__default = /*#__PURE__*/_interopDefault(outdent);
14
32
 
33
+ // Mostly copied from vite's implementation
34
+ // https://github.com/vitejs/vite/blob/efec70f816b80e55b64255b32a5f120e1cf4e4be/packages/vite/src/node/plugins/css.ts
35
+ const resolvePostcssConfig = async config => {
36
+ // inline postcss config via vite config
37
+ const inlineOptions = config.css?.postcss;
38
+ const inlineOptionsIsString = typeof inlineOptions === 'string';
39
+
40
+ if (inlineOptions && !inlineOptionsIsString) {
41
+ const options = { ...inlineOptions
42
+ };
43
+ delete options.plugins;
44
+ return {
45
+ options,
46
+ plugins: inlineOptions.plugins || []
47
+ };
48
+ } else {
49
+ try {
50
+ const searchPath = typeof inlineOptions === 'string' ? inlineOptions : config.root;
51
+ const postCssConfig = await (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('postcss-load-config')); })).default({}, searchPath);
52
+ return {
53
+ options: postCssConfig.options,
54
+ // @ts-expect-error - The postcssrc options don't agree with real postcss, but it should be ok
55
+ plugins: postCssConfig.plugins
56
+ };
57
+ } catch (e) {
58
+ if (!/No PostCSS Config found/.test(e.message)) {
59
+ throw e;
60
+ }
61
+
62
+ return null;
63
+ }
64
+ }
65
+ };
66
+
15
67
  const styleUpdateEvent = fileId => `vanilla-extract-style-update:${fileId}`;
16
68
 
17
69
  const virtualPrefix = 'virtual:vanilla-extract:';
@@ -21,6 +73,7 @@ function vanillaExtractPlugin({
21
73
  let config;
22
74
  let packageInfo;
23
75
  let server;
76
+ let postCssConfig;
24
77
  const cssMap = new Map();
25
78
  let virtualExt;
26
79
  return {
@@ -43,8 +96,13 @@ function vanillaExtractPlugin({
43
96
  };
44
97
  },
45
98
 
46
- configResolved(resolvedConfig) {
99
+ async configResolved(resolvedConfig) {
47
100
  config = resolvedConfig;
101
+
102
+ if (config.command === 'serve') {
103
+ postCssConfig = await resolvePostcssConfig(config);
104
+ }
105
+
48
106
  virtualExt = `.vanilla.${config.command === 'serve' ? 'js' : 'css'}`;
49
107
  packageInfo = integration.getPackageInfo(config.root);
50
108
  },
@@ -70,7 +128,7 @@ function vanillaExtractPlugin({
70
128
  }
71
129
 
72
130
  const fileScope = integration.parseFileScope(fileScopeId);
73
- return outdent__default['default']`
131
+ return outdent__default["default"]`
74
132
  import { injectStyles } from '@vanilla-extract/css/injectStyles';
75
133
 
76
134
  const inject = (css) => injectStyles({
@@ -100,7 +158,7 @@ function vanillaExtractPlugin({
100
158
  if (ssr) {
101
159
  return integration.addFileScope({
102
160
  source: code,
103
- filePath: vite.normalizePath(path__default['default'].relative(packageInfo.dirname, validId)),
161
+ filePath: vite.normalizePath(path__default["default"].relative(packageInfo.dirname, validId)),
104
162
  packageInfo
105
163
  }).source;
106
164
  }
@@ -124,13 +182,22 @@ function vanillaExtractPlugin({
124
182
  return integration.processVanillaFile({
125
183
  source,
126
184
  filePath: validId,
127
- identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
128
- serializeVirtualCssPath: ({
185
+ identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),
186
+ serializeVirtualCssPath: async ({
129
187
  fileScope,
130
188
  source
131
189
  }) => {
132
190
  const fileId = integration.stringifyFileScope(fileScope);
133
191
  const id = `${virtualPrefix}${fileId}${virtualExt}`;
192
+ let cssSource = source;
193
+
194
+ if (postCssConfig) {
195
+ const postCssResult = await (await Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require('postcss')); })).default(postCssConfig.plugins).process(source, { ...postCssConfig.options,
196
+ from: undefined,
197
+ map: false
198
+ });
199
+ cssSource = postCssResult.css;
200
+ }
134
201
 
135
202
  if (server && cssMap.has(fileId) && cssMap.get(fileId) !== source) {
136
203
  const {
@@ -145,11 +212,11 @@ function vanillaExtractPlugin({
145
212
  server.ws.send({
146
213
  type: 'custom',
147
214
  event: styleUpdateEvent(fileId),
148
- data: source
215
+ data: cssSource
149
216
  });
150
217
  }
151
218
 
152
- cssMap.set(fileId, source);
219
+ cssMap.set(fileId, cssSource);
153
220
  return `import "${id}";`;
154
221
  }
155
222
  });
@@ -3,6 +3,40 @@ import { normalizePath } from 'vite';
3
3
  import outdent from 'outdent';
4
4
  import { getPackageInfo, parseFileScope, cssFileFilter, addFileScope, compile, processVanillaFile, stringifyFileScope } from '@vanilla-extract/integration';
5
5
 
6
+ // Mostly copied from vite's implementation
7
+ // https://github.com/vitejs/vite/blob/efec70f816b80e55b64255b32a5f120e1cf4e4be/packages/vite/src/node/plugins/css.ts
8
+ const resolvePostcssConfig = async config => {
9
+ // inline postcss config via vite config
10
+ const inlineOptions = config.css?.postcss;
11
+ const inlineOptionsIsString = typeof inlineOptions === 'string';
12
+
13
+ if (inlineOptions && !inlineOptionsIsString) {
14
+ const options = { ...inlineOptions
15
+ };
16
+ delete options.plugins;
17
+ return {
18
+ options,
19
+ plugins: inlineOptions.plugins || []
20
+ };
21
+ } else {
22
+ try {
23
+ const searchPath = typeof inlineOptions === 'string' ? inlineOptions : config.root;
24
+ const postCssConfig = await (await import('postcss-load-config')).default({}, searchPath);
25
+ return {
26
+ options: postCssConfig.options,
27
+ // @ts-expect-error - The postcssrc options don't agree with real postcss, but it should be ok
28
+ plugins: postCssConfig.plugins
29
+ };
30
+ } catch (e) {
31
+ if (!/No PostCSS Config found/.test(e.message)) {
32
+ throw e;
33
+ }
34
+
35
+ return null;
36
+ }
37
+ }
38
+ };
39
+
6
40
  const styleUpdateEvent = fileId => `vanilla-extract-style-update:${fileId}`;
7
41
 
8
42
  const virtualPrefix = 'virtual:vanilla-extract:';
@@ -12,6 +46,7 @@ function vanillaExtractPlugin({
12
46
  let config;
13
47
  let packageInfo;
14
48
  let server;
49
+ let postCssConfig;
15
50
  const cssMap = new Map();
16
51
  let virtualExt;
17
52
  return {
@@ -34,8 +69,13 @@ function vanillaExtractPlugin({
34
69
  };
35
70
  },
36
71
 
37
- configResolved(resolvedConfig) {
72
+ async configResolved(resolvedConfig) {
38
73
  config = resolvedConfig;
74
+
75
+ if (config.command === 'serve') {
76
+ postCssConfig = await resolvePostcssConfig(config);
77
+ }
78
+
39
79
  virtualExt = `.vanilla.${config.command === 'serve' ? 'js' : 'css'}`;
40
80
  packageInfo = getPackageInfo(config.root);
41
81
  },
@@ -115,13 +155,22 @@ function vanillaExtractPlugin({
115
155
  return processVanillaFile({
116
156
  source,
117
157
  filePath: validId,
118
- identOption: identifiers !== null && identifiers !== void 0 ? identifiers : config.mode === 'production' ? 'short' : 'debug',
119
- serializeVirtualCssPath: ({
158
+ identOption: identifiers ?? (config.mode === 'production' ? 'short' : 'debug'),
159
+ serializeVirtualCssPath: async ({
120
160
  fileScope,
121
161
  source
122
162
  }) => {
123
163
  const fileId = stringifyFileScope(fileScope);
124
164
  const id = `${virtualPrefix}${fileId}${virtualExt}`;
165
+ let cssSource = source;
166
+
167
+ if (postCssConfig) {
168
+ const postCssResult = await (await import('postcss')).default(postCssConfig.plugins).process(source, { ...postCssConfig.options,
169
+ from: undefined,
170
+ map: false
171
+ });
172
+ cssSource = postCssResult.css;
173
+ }
125
174
 
126
175
  if (server && cssMap.has(fileId) && cssMap.get(fileId) !== source) {
127
176
  const {
@@ -136,11 +185,11 @@ function vanillaExtractPlugin({
136
185
  server.ws.send({
137
186
  type: 'custom',
138
187
  event: styleUpdateEvent(fileId),
139
- data: source
188
+ data: cssSource
140
189
  });
141
190
  }
142
191
 
143
- cssMap.set(fileId, source);
192
+ cssMap.set(fileId, cssSource);
144
193
  return `import "${id}";`;
145
194
  }
146
195
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vanilla-extract/vite-plugin",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
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,8 +15,10 @@
15
15
  "author": "SEEK",
16
16
  "license": "MIT",
17
17
  "dependencies": {
18
- "@vanilla-extract/integration": "^1.4.3",
19
- "outdent": "^0.8.0"
18
+ "@vanilla-extract/integration": "^2.0.0",
19
+ "outdent": "^0.8.0",
20
+ "postcss": "^8.3.6",
21
+ "postcss-load-config": "^3.1.0"
20
22
  },
21
23
  "devDependencies": {
22
24
  "vite": "^2.6.0"
@@ -24,4 +26,4 @@
24
26
  "peerDependencies": {
25
27
  "vite": "^2.2.3"
26
28
  }
27
- }
29
+ }
package/CHANGELOG.md DELETED
@@ -1,191 +0,0 @@
1
- # @vanilla-extract/vite-plugin
2
-
3
- ## 3.0.1
4
-
5
- ### Patch Changes
6
-
7
- - [#470](https://github.com/seek-oss/vanilla-extract/pull/470) [`a6383e8`](https://github.com/seek-oss/vanilla-extract/commit/a6383e86218a49b5dd9fa471e0776f8cb50c9d7f) Thanks [@Katarina-UBCO](https://github.com/Katarina-UBCO)! - Prefix `.vanilla.js` and `.vanilla.css` virtual modules with `virtual:vanilla-extract:`.
8
-
9
- ## 3.0.0
10
-
11
- ### Major Changes
12
-
13
- - [#422](https://github.com/seek-oss/vanilla-extract/pull/422) [`4e5ba05`](https://github.com/seek-oss/vanilla-extract/commit/4e5ba05549bc0baae8d82b9e9da9e69f032a1191) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Remove the `devStyleRuntime` option
14
-
15
- ### Patch Changes
16
-
17
- - [#422](https://github.com/seek-oss/vanilla-extract/pull/422) [`4e5ba05`](https://github.com/seek-oss/vanilla-extract/commit/4e5ba05549bc0baae8d82b9e9da9e69f032a1191) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix HMR for pre-existing CSS
18
-
19
- Previously, styles would not hot reload correctly when returning to a previously cached version
20
-
21
- ## 2.1.3
22
-
23
- ### Patch Changes
24
-
25
- - [#409](https://github.com/seek-oss/vanilla-extract/pull/409) [`a9c5cb7`](https://github.com/seek-oss/vanilla-extract/commit/a9c5cb768ad10bd25dd1a31041733fc96cd467a0) Thanks [@benjervis](https://github.com/benjervis)! - Fix plugin for watch mode.
26
-
27
- The vite plugin previously relied on a one to one matching of resolve to load calls, and would clean up the CSS stored in memory after it was loaded.
28
-
29
- This isn't true in `--watch` mode, as the same file can be loaded on the rebuild without having to be resolved, which the plugin now handles.
30
-
31
- * [#409](https://github.com/seek-oss/vanilla-extract/pull/409) [`a9c5cb7`](https://github.com/seek-oss/vanilla-extract/commit/a9c5cb768ad10bd25dd1a31041733fc96cd467a0) Thanks [@benjervis](https://github.com/benjervis)! - Update the "vanilla-extract" devStyleRuntime option.
32
-
33
- When using the vanilla browser runtime in vite, it now operates on a new model where a .css.js file is generated, that uses @vanilla-extract/css/injectStyles to add the css to the browser.
34
-
35
- This allows for hot reloading of styles, and makes styles a bit easier to debug at dev time (because they're actually visible).
36
-
37
- - [#409](https://github.com/seek-oss/vanilla-extract/pull/409) [`a9c5cb7`](https://github.com/seek-oss/vanilla-extract/commit/a9c5cb768ad10bd25dd1a31041733fc96cd467a0) Thanks [@benjervis](https://github.com/benjervis)! - Handle vite 2.6.
38
-
39
- As of vite 2.6 and greater, `?used` gets appended to css imports, which causes the file imports to be not what we expected.
40
-
41
- This caused mismatching classnames in the vite plugin, and it caused the babel plugin to not add filescopes when it should have.
42
-
43
- * [#409](https://github.com/seek-oss/vanilla-extract/pull/409) [`a9c5cb7`](https://github.com/seek-oss/vanilla-extract/commit/a9c5cb768ad10bd25dd1a31041733fc96cd467a0) Thanks [@benjervis](https://github.com/benjervis)! - Automatically optimize deps.
44
-
45
- When using the new vanilla browser runtime, the new `injectStyles` dependency gets injected at runtime, so vite can't discover it ahead of time and pre-bundle it.
46
-
47
- The plugin will now add the dependency to optimizeDeps if the vanilla runtime is being used so that it's optimized up front.
48
- It also ensures that some relevant vanilla packages are externalised in SSR mode.
49
-
50
- * Updated dependencies [[`a9c5cb7`](https://github.com/seek-oss/vanilla-extract/commit/a9c5cb768ad10bd25dd1a31041733fc96cd467a0)]:
51
- - @vanilla-extract/integration@1.4.3
52
-
53
- ## 2.1.2
54
-
55
- ### Patch Changes
56
-
57
- - [#398](https://github.com/seek-oss/vanilla-extract/pull/398) [`63f4ed0`](https://github.com/seek-oss/vanilla-extract/commit/63f4ed0e67419df565f3f447cf27cec612afbb8d) Thanks [@benjervis](https://github.com/benjervis)! - Fixes a bug with vite where "?used" is appended to the file path of css files.
58
-
59
- This could cause different class name hashes to be generated between SSR and client builds.
60
- This was introduced in vite 2.6.0.
61
-
62
- ## 2.1.1
63
-
64
- ### Patch Changes
65
-
66
- - [#393](https://github.com/seek-oss/vanilla-extract/pull/393) [`2f379f1`](https://github.com/seek-oss/vanilla-extract/commit/2f379f118c2a2fe6dc08a1cc15a395dbc0f17ece) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Fix compilation errors in Vite 2.6
67
-
68
- - Updated dependencies [[`2f379f1`](https://github.com/seek-oss/vanilla-extract/commit/2f379f118c2a2fe6dc08a1cc15a395dbc0f17ece)]:
69
- - @vanilla-extract/integration@1.4.2
70
-
71
- ## 2.1.0
72
-
73
- ### Minor Changes
74
-
75
- - [#373](https://github.com/seek-oss/vanilla-extract/pull/373) [`a55d2cf`](https://github.com/seek-oss/vanilla-extract/commit/a55d2cfd7c4ca9175a2c86557888df90907bfd0f) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Add `devStyleRuntime` option to allow switching between dev style runtimes
76
-
77
- The built-in Vite dev style runtime (what adds styles to the page when running `vite serve`) doesn't seem to clean up old styles as expected. Passing `devStyleRuntime: 'vanilla-extract'` will instead use vanilla-extract's browser runtime. This pushes all style creation in development to the browser, but may give a better HMR experience.
78
-
79
- ## 2.0.2
80
-
81
- ### Patch Changes
82
-
83
- - [#341](https://github.com/seek-oss/vanilla-extract/pull/341) [`0b743e7`](https://github.com/seek-oss/vanilla-extract/commit/0b743e744447616f8daf0c6b88beff8ffef8d41b) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Refactor SSR file scoping to use centralised `addFileScope` implementation
84
-
85
- - Updated dependencies [[`50bae14`](https://github.com/seek-oss/vanilla-extract/commit/50bae14bf38c8a971ad1727cb8e827c86da06772), [`0b743e7`](https://github.com/seek-oss/vanilla-extract/commit/0b743e744447616f8daf0c6b88beff8ffef8d41b)]:
86
- - @vanilla-extract/integration@1.3.0
87
-
88
- ## 2.0.1
89
-
90
- ### Patch Changes
91
-
92
- - [#327](https://github.com/seek-oss/vanilla-extract/pull/327) [`73b55f8`](https://github.com/seek-oss/vanilla-extract/commit/73b55f8e7e205701abdb1cbb029c3f2f5080b6fd) Thanks [@benjervis](https://github.com/benjervis)! - Fix bug where precompiled .css.ts files (.css.js) were treated differently in SSR mode.
93
-
94
- ## 2.0.0
95
-
96
- ### Major Changes
97
-
98
- - [#323](https://github.com/seek-oss/vanilla-extract/pull/323) [`1e7d647`](https://github.com/seek-oss/vanilla-extract/commit/1e7d6470398a0fbcbdef4118e678150932cd9275) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Formatting of identifiers (e.g. class names, keyframes, CSS Vars, etc) can now be configured via the `identifiers` option which accepts either `short` or `debug`.
99
-
100
- - `short` identifiers are a 7+ character hash. e.g. `hnw5tz3`
101
- - `debug` identifiers contain human readable prefixes representing the owning filename and a potential rule level debug name. e.g. `somefile_mystyle_hnw5tz3`
102
-
103
- ```js
104
- import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
105
-
106
- vanillaExtractPlugin({ identifiers: 'short' });
107
- ```
108
-
109
- BREAKING CHANGE
110
-
111
- Previously identifiers were formatted as `short` when `process.env.NODE_ENV` was set to "production". By default, they will now be formatted according to Vite's [mode config](https://vitejs.dev/config/#mode).
112
-
113
- ### Patch Changes
114
-
115
- - Updated dependencies [[`1e7d647`](https://github.com/seek-oss/vanilla-extract/commit/1e7d6470398a0fbcbdef4118e678150932cd9275)]:
116
- - @vanilla-extract/integration@1.2.0
117
-
118
- ## 1.2.0
119
-
120
- ### Minor Changes
121
-
122
- - [#311](https://github.com/seek-oss/vanilla-extract/pull/311) [`416eb9a`](https://github.com/seek-oss/vanilla-extract/commit/416eb9ae99661597a8443594f4376aacf4d295cc) Thanks [@mattcompiles](https://github.com/mattcompiles)! - In SSR mode, move to runtime evaluation of vanilla-extract files
123
-
124
- This unlocks the potential for CSS extraction on the server.
125
-
126
- ## 1.1.2
127
-
128
- ### Patch Changes
129
-
130
- - [#290](https://github.com/seek-oss/vanilla-extract/pull/290) [`adc1d64`](https://github.com/seek-oss/vanilla-extract/commit/adc1d644635a1197edd36f522f78658a641027d4) Thanks [@ygj6](https://github.com/ygj6)! - Normalize path of generated CSS files
131
-
132
- ## 1.1.1
133
-
134
- ### Patch Changes
135
-
136
- - [#270](https://github.com/seek-oss/vanilla-extract/pull/270) [`fe19158`](https://github.com/seek-oss/vanilla-extract/commit/fe1915808b374a1bbf8f67eca85c0253153e2cb9) Thanks [@yyx990803](https://github.com/yyx990803)! - Fix watching of modules imported by `.css.ts` files
137
-
138
- ## 1.1.0
139
-
140
- ### Minor Changes
141
-
142
- - [#259](https://github.com/seek-oss/vanilla-extract/pull/259) [`b8a6441`](https://github.com/seek-oss/vanilla-extract/commit/b8a6441e3400be388a520e3acf94f3bb6519cf0a) Thanks [@markdalgleish](https://github.com/markdalgleish)! - Allow the result of `composeStyles` to be used in selectors
143
-
144
- When style compositions are used in selectors, they are now assigned an additional class so they can be uniquely identified. When selectors are processed internally, the composed classes are removed, only leaving behind the unique identifier classes. This allows you to treat them as if they were a single class within vanilla-extract selectors.
145
-
146
- ```ts
147
- import { style, globalStyle, composeStyles } from '@vanilla-extract/css';
148
-
149
- const background = style({ background: 'mintcream' });
150
- const padding = style({ padding: 12 });
151
-
152
- export const container = composeStyles(background, padding);
153
-
154
- globalStyle(`${container} *`, {
155
- boxSizing: 'border-box',
156
- });
157
- ```
158
-
159
- ### Patch Changes
160
-
161
- - Updated dependencies [[`b8a6441`](https://github.com/seek-oss/vanilla-extract/commit/b8a6441e3400be388a520e3acf94f3bb6519cf0a)]:
162
- - @vanilla-extract/integration@1.1.0
163
-
164
- ## 1.0.0
165
-
166
- ### Major Changes
167
-
168
- - [#171](https://github.com/seek-oss/vanilla-extract/pull/171) [`84a8611`](https://github.com/seek-oss/vanilla-extract/commit/84a8611972f32a00a6cbd85267a01dd2d31be869) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Release v1
169
-
170
- ### Patch Changes
171
-
172
- - Updated dependencies [[`84a8611`](https://github.com/seek-oss/vanilla-extract/commit/84a8611972f32a00a6cbd85267a01dd2d31be869)]:
173
- - @vanilla-extract/integration@1.0.0
174
-
175
- ## 0.1.1
176
-
177
- ### Patch Changes
178
-
179
- - [#96](https://github.com/seek-oss/vanilla-extract/pull/96) [`697a233`](https://github.com/seek-oss/vanilla-extract/commit/697a2332cdb34886af26224c13f1efb73b6d36b3) Thanks [@mattcompiles](https://github.com/mattcompiles)! - Change vite-plugin to be a named export
180
-
181
- BREAKING CHANGE
182
-
183
- ```diff
184
- -import vanillaExtractPlugin from '@vanilla-extract/vite-plugin';
185
- +import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
186
-
187
- // vite.config.js
188
- export default {
189
- plugins: [vanillaExtractPlugin()]
190
- }
191
- ```