@vanilla-extract/vite-plugin 3.9.2 → 3.9.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.
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vanilla-extract-vite-plugin.cjs.d.ts","sourceRoot":"","sources":["./declarations/src/index.d.ts"],"names":[],"mappings":"AAAA"}
|
|
@@ -3,30 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var path = require('path');
|
|
6
|
-
var vite = require('vite');
|
|
7
6
|
var outdent = require('outdent');
|
|
8
7
|
var integration = require('@vanilla-extract/integration');
|
|
9
8
|
|
|
10
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
10
|
|
|
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
|
-
|
|
30
11
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
31
12
|
var outdent__default = /*#__PURE__*/_interopDefault(outdent);
|
|
32
13
|
|
|
@@ -49,7 +30,7 @@ const resolvePostcssConfig = async config => {
|
|
|
49
30
|
} else {
|
|
50
31
|
try {
|
|
51
32
|
const searchPath = typeof inlineOptions === 'string' ? inlineOptions : config.root;
|
|
52
|
-
const postCssConfig = await (await
|
|
33
|
+
const postCssConfig = await (await import('postcss-load-config')).default({}, searchPath);
|
|
53
34
|
return {
|
|
54
35
|
options: postCssConfig.options,
|
|
55
36
|
plugins: postCssConfig.plugins
|
|
@@ -74,11 +55,13 @@ function vanillaExtractPlugin({
|
|
|
74
55
|
let config;
|
|
75
56
|
let server;
|
|
76
57
|
let postCssConfig;
|
|
58
|
+
// We lazily load this utility from Vite
|
|
59
|
+
let normalizePath;
|
|
77
60
|
const cssMap = new Map();
|
|
78
61
|
const hasEmitCssOverride = typeof emitCssInSsr === 'boolean';
|
|
79
62
|
let resolvedEmitCssInSsr = hasEmitCssOverride ? emitCssInSsr : !!process.env.VITE_RSC_BUILD;
|
|
80
63
|
let packageName;
|
|
81
|
-
const getAbsoluteVirtualFileId = source =>
|
|
64
|
+
const getAbsoluteVirtualFileId = source => normalizePath(path__default["default"].join(config.root, source));
|
|
82
65
|
return {
|
|
83
66
|
name: 'vanilla-extract',
|
|
84
67
|
enforce: 'pre',
|
|
@@ -99,6 +82,7 @@ function vanillaExtractPlugin({
|
|
|
99
82
|
async configResolved(resolvedConfig) {
|
|
100
83
|
config = resolvedConfig;
|
|
101
84
|
packageName = integration.getPackageInfo(config.root).name;
|
|
85
|
+
normalizePath = (await import('vite')).normalizePath;
|
|
102
86
|
if (config.command === 'serve') {
|
|
103
87
|
postCssConfig = await resolvePostcssConfig(config);
|
|
104
88
|
}
|
|
@@ -160,7 +144,7 @@ function vanillaExtractPlugin({
|
|
|
160
144
|
if (!integration.cssFileFilter.test(validId)) {
|
|
161
145
|
return null;
|
|
162
146
|
}
|
|
163
|
-
const identOption = identifiers
|
|
147
|
+
const identOption = identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
|
164
148
|
let ssr;
|
|
165
149
|
if (typeof ssrParam === 'boolean') {
|
|
166
150
|
ssr = ssrParam;
|
|
@@ -170,7 +154,7 @@ function vanillaExtractPlugin({
|
|
|
170
154
|
if (ssr && !resolvedEmitCssInSsr) {
|
|
171
155
|
return integration.transform({
|
|
172
156
|
source: code,
|
|
173
|
-
filePath:
|
|
157
|
+
filePath: normalizePath(validId),
|
|
174
158
|
rootPath: config.root,
|
|
175
159
|
packageName,
|
|
176
160
|
identOption
|
|
@@ -188,7 +172,7 @@ function vanillaExtractPlugin({
|
|
|
188
172
|
for (const file of watchFiles) {
|
|
189
173
|
// In start mode, we need to prevent the file from rewatching itself.
|
|
190
174
|
// If it's a `build --watch`, it needs to watch everything.
|
|
191
|
-
if (config.command === 'build' ||
|
|
175
|
+
if (config.command === 'build' || normalizePath(file) !== validId) {
|
|
192
176
|
this.addWatchFile(file);
|
|
193
177
|
}
|
|
194
178
|
}
|
|
@@ -204,14 +188,14 @@ function vanillaExtractPlugin({
|
|
|
204
188
|
const absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
|
|
205
189
|
let cssSource = source;
|
|
206
190
|
if (postCssConfig) {
|
|
207
|
-
const postCssResult = await (await
|
|
191
|
+
const postCssResult = await (await import('postcss')).default(postCssConfig.plugins).process(source, {
|
|
208
192
|
...postCssConfig.options,
|
|
209
193
|
from: undefined,
|
|
210
194
|
map: false
|
|
211
195
|
});
|
|
212
196
|
cssSource = postCssResult.css;
|
|
213
197
|
}
|
|
214
|
-
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !==
|
|
198
|
+
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== cssSource) {
|
|
215
199
|
const {
|
|
216
200
|
moduleGraph
|
|
217
201
|
} = server;
|
|
@@ -3,30 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var path = require('path');
|
|
6
|
-
var vite = require('vite');
|
|
7
6
|
var outdent = require('outdent');
|
|
8
7
|
var integration = require('@vanilla-extract/integration');
|
|
9
8
|
|
|
10
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
11
10
|
|
|
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
|
-
|
|
30
11
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
|
31
12
|
var outdent__default = /*#__PURE__*/_interopDefault(outdent);
|
|
32
13
|
|
|
@@ -49,7 +30,7 @@ const resolvePostcssConfig = async config => {
|
|
|
49
30
|
} else {
|
|
50
31
|
try {
|
|
51
32
|
const searchPath = typeof inlineOptions === 'string' ? inlineOptions : config.root;
|
|
52
|
-
const postCssConfig = await (await
|
|
33
|
+
const postCssConfig = await (await import('postcss-load-config')).default({}, searchPath);
|
|
53
34
|
return {
|
|
54
35
|
options: postCssConfig.options,
|
|
55
36
|
plugins: postCssConfig.plugins
|
|
@@ -74,11 +55,13 @@ function vanillaExtractPlugin({
|
|
|
74
55
|
let config;
|
|
75
56
|
let server;
|
|
76
57
|
let postCssConfig;
|
|
58
|
+
// We lazily load this utility from Vite
|
|
59
|
+
let normalizePath;
|
|
77
60
|
const cssMap = new Map();
|
|
78
61
|
const hasEmitCssOverride = typeof emitCssInSsr === 'boolean';
|
|
79
62
|
let resolvedEmitCssInSsr = hasEmitCssOverride ? emitCssInSsr : !!process.env.VITE_RSC_BUILD;
|
|
80
63
|
let packageName;
|
|
81
|
-
const getAbsoluteVirtualFileId = source =>
|
|
64
|
+
const getAbsoluteVirtualFileId = source => normalizePath(path__default["default"].join(config.root, source));
|
|
82
65
|
return {
|
|
83
66
|
name: 'vanilla-extract',
|
|
84
67
|
enforce: 'pre',
|
|
@@ -99,6 +82,7 @@ function vanillaExtractPlugin({
|
|
|
99
82
|
async configResolved(resolvedConfig) {
|
|
100
83
|
config = resolvedConfig;
|
|
101
84
|
packageName = integration.getPackageInfo(config.root).name;
|
|
85
|
+
normalizePath = (await import('vite')).normalizePath;
|
|
102
86
|
if (config.command === 'serve') {
|
|
103
87
|
postCssConfig = await resolvePostcssConfig(config);
|
|
104
88
|
}
|
|
@@ -160,7 +144,7 @@ function vanillaExtractPlugin({
|
|
|
160
144
|
if (!integration.cssFileFilter.test(validId)) {
|
|
161
145
|
return null;
|
|
162
146
|
}
|
|
163
|
-
const identOption = identifiers
|
|
147
|
+
const identOption = identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
|
164
148
|
let ssr;
|
|
165
149
|
if (typeof ssrParam === 'boolean') {
|
|
166
150
|
ssr = ssrParam;
|
|
@@ -170,7 +154,7 @@ function vanillaExtractPlugin({
|
|
|
170
154
|
if (ssr && !resolvedEmitCssInSsr) {
|
|
171
155
|
return integration.transform({
|
|
172
156
|
source: code,
|
|
173
|
-
filePath:
|
|
157
|
+
filePath: normalizePath(validId),
|
|
174
158
|
rootPath: config.root,
|
|
175
159
|
packageName,
|
|
176
160
|
identOption
|
|
@@ -188,7 +172,7 @@ function vanillaExtractPlugin({
|
|
|
188
172
|
for (const file of watchFiles) {
|
|
189
173
|
// In start mode, we need to prevent the file from rewatching itself.
|
|
190
174
|
// If it's a `build --watch`, it needs to watch everything.
|
|
191
|
-
if (config.command === 'build' ||
|
|
175
|
+
if (config.command === 'build' || normalizePath(file) !== validId) {
|
|
192
176
|
this.addWatchFile(file);
|
|
193
177
|
}
|
|
194
178
|
}
|
|
@@ -204,14 +188,14 @@ function vanillaExtractPlugin({
|
|
|
204
188
|
const absoluteId = getAbsoluteVirtualFileId(rootRelativeId);
|
|
205
189
|
let cssSource = source;
|
|
206
190
|
if (postCssConfig) {
|
|
207
|
-
const postCssResult = await (await
|
|
191
|
+
const postCssResult = await (await import('postcss')).default(postCssConfig.plugins).process(source, {
|
|
208
192
|
...postCssConfig.options,
|
|
209
193
|
from: undefined,
|
|
210
194
|
map: false
|
|
211
195
|
});
|
|
212
196
|
cssSource = postCssResult.css;
|
|
213
197
|
}
|
|
214
|
-
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !==
|
|
198
|
+
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== cssSource) {
|
|
215
199
|
const {
|
|
216
200
|
moduleGraph
|
|
217
201
|
} = server;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
-
import { normalizePath } from 'vite';
|
|
3
2
|
import outdent from 'outdent';
|
|
4
3
|
import { getPackageInfo, cssFileFilter, transform, compile, processVanillaFile } from '@vanilla-extract/integration';
|
|
5
4
|
|
|
@@ -47,6 +46,8 @@ function vanillaExtractPlugin({
|
|
|
47
46
|
let config;
|
|
48
47
|
let server;
|
|
49
48
|
let postCssConfig;
|
|
49
|
+
// We lazily load this utility from Vite
|
|
50
|
+
let normalizePath;
|
|
50
51
|
const cssMap = new Map();
|
|
51
52
|
const hasEmitCssOverride = typeof emitCssInSsr === 'boolean';
|
|
52
53
|
let resolvedEmitCssInSsr = hasEmitCssOverride ? emitCssInSsr : !!process.env.VITE_RSC_BUILD;
|
|
@@ -72,6 +73,7 @@ function vanillaExtractPlugin({
|
|
|
72
73
|
async configResolved(resolvedConfig) {
|
|
73
74
|
config = resolvedConfig;
|
|
74
75
|
packageName = getPackageInfo(config.root).name;
|
|
76
|
+
normalizePath = (await import('vite')).normalizePath;
|
|
75
77
|
if (config.command === 'serve') {
|
|
76
78
|
postCssConfig = await resolvePostcssConfig(config);
|
|
77
79
|
}
|
|
@@ -133,7 +135,7 @@ function vanillaExtractPlugin({
|
|
|
133
135
|
if (!cssFileFilter.test(validId)) {
|
|
134
136
|
return null;
|
|
135
137
|
}
|
|
136
|
-
const identOption = identifiers
|
|
138
|
+
const identOption = identifiers ?? (config.mode === 'production' ? 'short' : 'debug');
|
|
137
139
|
let ssr;
|
|
138
140
|
if (typeof ssrParam === 'boolean') {
|
|
139
141
|
ssr = ssrParam;
|
|
@@ -184,7 +186,7 @@ function vanillaExtractPlugin({
|
|
|
184
186
|
});
|
|
185
187
|
cssSource = postCssResult.css;
|
|
186
188
|
}
|
|
187
|
-
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !==
|
|
189
|
+
if (server && cssMap.has(absoluteId) && cssMap.get(absoluteId) !== cssSource) {
|
|
188
190
|
const {
|
|
189
191
|
moduleGraph
|
|
190
192
|
} = server;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vanilla-extract/vite-plugin",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.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": "^6.2.
|
|
18
|
+
"@vanilla-extract/integration": "^6.2.5",
|
|
19
19
|
"outdent": "^0.8.0",
|
|
20
20
|
"postcss": "^8.3.6",
|
|
21
21
|
"postcss-load-config": "^4.0.1"
|