@vanilla-extract/vite-plugin 5.0.3 → 5.1.0-vite-ssr-20250603032431
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.
@@ -13,8 +13,8 @@ type PluginFilter = (filterProps: {
|
|
13
13
|
interface Options {
|
14
14
|
identifiers?: IdentifierOption;
|
15
15
|
unstable_pluginFilter?: PluginFilter;
|
16
|
-
unstable_mode?: 'transform' | 'emitCss';
|
16
|
+
unstable_mode?: 'transform' | 'emitCss' | 'inlineCriticalCssInSsrDev';
|
17
17
|
}
|
18
|
-
declare function vanillaExtractPlugin({ identifiers, unstable_pluginFilter: pluginFilter, unstable_mode, }?: Options): Plugin;
|
18
|
+
declare function vanillaExtractPlugin({ identifiers, unstable_pluginFilter: pluginFilter, unstable_mode, }?: Options): Plugin[];
|
19
19
|
|
20
20
|
export { vanillaExtractPlugin };
|
@@ -10,7 +10,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
|
|
10
10
|
|
11
11
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
12
12
|
|
13
|
-
const
|
13
|
+
const PLUGIN_NAMESPACE = 'vite-plugin-vanilla-extract';
|
14
14
|
const virtualExtCss = '.vanilla.css';
|
15
15
|
const isVirtualId = id => id.endsWith(virtualExtCss);
|
16
16
|
const fileIdToVirtualId = id => `${id}${virtualExtCss}`;
|
@@ -70,8 +70,22 @@ function vanillaExtractPlugin({
|
|
70
70
|
}
|
71
71
|
}
|
72
72
|
}
|
73
|
-
return {
|
74
|
-
name:
|
73
|
+
return [{
|
74
|
+
name: `${PLUGIN_NAMESPACE}-inline-critical-css-in-ssr-dev`,
|
75
|
+
apply: (_config, {
|
76
|
+
command
|
77
|
+
}) => command === 'serve' && unstable_mode === 'inlineCriticalCssInSsrDev',
|
78
|
+
transformIndexHtml: _html => {
|
79
|
+
var _compiler;
|
80
|
+
const allCss = (_compiler = compiler$1) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
|
81
|
+
return [{
|
82
|
+
tag: 'style',
|
83
|
+
children: allCss,
|
84
|
+
injectTo: 'head-prepend'
|
85
|
+
}];
|
86
|
+
}
|
87
|
+
}, {
|
88
|
+
name: PLUGIN_NAMESPACE,
|
75
89
|
configureServer(_server) {
|
76
90
|
server = _server;
|
77
91
|
},
|
@@ -130,13 +144,13 @@ function vanillaExtractPlugin({
|
|
130
144
|
// When using the rollup watcher, we don't want to close the compiler after every build.
|
131
145
|
// Instead, we close it when the watcher is closed via the closeWatcher hook.
|
132
146
|
if (!config.build.watch) {
|
133
|
-
var
|
134
|
-
(
|
147
|
+
var _compiler2;
|
148
|
+
(_compiler2 = compiler$1) === null || _compiler2 === void 0 || _compiler2.close();
|
135
149
|
}
|
136
150
|
},
|
137
151
|
closeWatcher() {
|
138
|
-
var
|
139
|
-
return (
|
152
|
+
var _compiler3;
|
153
|
+
return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
|
140
154
|
},
|
141
155
|
async transform(code, id) {
|
142
156
|
const [validId] = id.split('?');
|
@@ -188,14 +202,14 @@ function vanillaExtractPlugin({
|
|
188
202
|
}
|
189
203
|
},
|
190
204
|
resolveId(source) {
|
191
|
-
var
|
205
|
+
var _compiler4;
|
192
206
|
const [validId, query] = source.split('?');
|
193
207
|
if (!isVirtualId(validId)) return;
|
194
208
|
const absoluteId = getAbsoluteId(validId);
|
195
209
|
if ( // We should always have CSS for a file here.
|
196
210
|
// The only valid scenario for a missing one is if someone had written
|
197
211
|
// a file in their app using the .vanilla.js/.vanilla.css extension
|
198
|
-
(
|
212
|
+
(_compiler4 = compiler$1) !== null && _compiler4 !== void 0 && _compiler4.getCssForFile(virtualIdToFileId(absoluteId))) {
|
199
213
|
// Keep the original query string for HMR.
|
200
214
|
return absoluteId + (query ? `?${query}` : '');
|
201
215
|
}
|
@@ -209,7 +223,7 @@ function vanillaExtractPlugin({
|
|
209
223
|
} = compiler$1.getCssForFile(virtualIdToFileId(absoluteId));
|
210
224
|
return css;
|
211
225
|
}
|
212
|
-
};
|
226
|
+
}];
|
213
227
|
}
|
214
228
|
|
215
229
|
exports.vanillaExtractPlugin = vanillaExtractPlugin;
|
@@ -10,7 +10,7 @@ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e };
|
|
10
10
|
|
11
11
|
var path__default = /*#__PURE__*/_interopDefault(path);
|
12
12
|
|
13
|
-
const
|
13
|
+
const PLUGIN_NAMESPACE = 'vite-plugin-vanilla-extract';
|
14
14
|
const virtualExtCss = '.vanilla.css';
|
15
15
|
const isVirtualId = id => id.endsWith(virtualExtCss);
|
16
16
|
const fileIdToVirtualId = id => `${id}${virtualExtCss}`;
|
@@ -70,8 +70,22 @@ function vanillaExtractPlugin({
|
|
70
70
|
}
|
71
71
|
}
|
72
72
|
}
|
73
|
-
return {
|
74
|
-
name:
|
73
|
+
return [{
|
74
|
+
name: `${PLUGIN_NAMESPACE}-inline-critical-css-in-ssr-dev`,
|
75
|
+
apply: (_config, {
|
76
|
+
command
|
77
|
+
}) => command === 'serve' && unstable_mode === 'inlineCriticalCssInSsrDev',
|
78
|
+
transformIndexHtml: _html => {
|
79
|
+
var _compiler;
|
80
|
+
const allCss = (_compiler = compiler$1) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
|
81
|
+
return [{
|
82
|
+
tag: 'style',
|
83
|
+
children: allCss,
|
84
|
+
injectTo: 'head-prepend'
|
85
|
+
}];
|
86
|
+
}
|
87
|
+
}, {
|
88
|
+
name: PLUGIN_NAMESPACE,
|
75
89
|
configureServer(_server) {
|
76
90
|
server = _server;
|
77
91
|
},
|
@@ -130,13 +144,13 @@ function vanillaExtractPlugin({
|
|
130
144
|
// When using the rollup watcher, we don't want to close the compiler after every build.
|
131
145
|
// Instead, we close it when the watcher is closed via the closeWatcher hook.
|
132
146
|
if (!config.build.watch) {
|
133
|
-
var
|
134
|
-
(
|
147
|
+
var _compiler2;
|
148
|
+
(_compiler2 = compiler$1) === null || _compiler2 === void 0 || _compiler2.close();
|
135
149
|
}
|
136
150
|
},
|
137
151
|
closeWatcher() {
|
138
|
-
var
|
139
|
-
return (
|
152
|
+
var _compiler3;
|
153
|
+
return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
|
140
154
|
},
|
141
155
|
async transform(code, id) {
|
142
156
|
const [validId] = id.split('?');
|
@@ -188,14 +202,14 @@ function vanillaExtractPlugin({
|
|
188
202
|
}
|
189
203
|
},
|
190
204
|
resolveId(source) {
|
191
|
-
var
|
205
|
+
var _compiler4;
|
192
206
|
const [validId, query] = source.split('?');
|
193
207
|
if (!isVirtualId(validId)) return;
|
194
208
|
const absoluteId = getAbsoluteId(validId);
|
195
209
|
if ( // We should always have CSS for a file here.
|
196
210
|
// The only valid scenario for a missing one is if someone had written
|
197
211
|
// a file in their app using the .vanilla.js/.vanilla.css extension
|
198
|
-
(
|
212
|
+
(_compiler4 = compiler$1) !== null && _compiler4 !== void 0 && _compiler4.getCssForFile(virtualIdToFileId(absoluteId))) {
|
199
213
|
// Keep the original query string for HMR.
|
200
214
|
return absoluteId + (query ? `?${query}` : '');
|
201
215
|
}
|
@@ -209,7 +223,7 @@ function vanillaExtractPlugin({
|
|
209
223
|
} = compiler$1.getCssForFile(virtualIdToFileId(absoluteId));
|
210
224
|
return css;
|
211
225
|
}
|
212
|
-
};
|
226
|
+
}];
|
213
227
|
}
|
214
228
|
|
215
229
|
exports.vanillaExtractPlugin = vanillaExtractPlugin;
|
@@ -2,7 +2,7 @@ import path from 'path';
|
|
2
2
|
import { createCompiler } from '@vanilla-extract/compiler';
|
3
3
|
import { getPackageInfo, cssFileFilter, transform, normalizePath } from '@vanilla-extract/integration';
|
4
4
|
|
5
|
-
const
|
5
|
+
const PLUGIN_NAMESPACE = 'vite-plugin-vanilla-extract';
|
6
6
|
const virtualExtCss = '.vanilla.css';
|
7
7
|
const isVirtualId = id => id.endsWith(virtualExtCss);
|
8
8
|
const fileIdToVirtualId = id => `${id}${virtualExtCss}`;
|
@@ -62,8 +62,22 @@ function vanillaExtractPlugin({
|
|
62
62
|
}
|
63
63
|
}
|
64
64
|
}
|
65
|
-
return {
|
66
|
-
name:
|
65
|
+
return [{
|
66
|
+
name: `${PLUGIN_NAMESPACE}-inline-critical-css-in-ssr-dev`,
|
67
|
+
apply: (_config, {
|
68
|
+
command
|
69
|
+
}) => command === 'serve' && unstable_mode === 'inlineCriticalCssInSsrDev',
|
70
|
+
transformIndexHtml: _html => {
|
71
|
+
var _compiler;
|
72
|
+
const allCss = (_compiler = compiler) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
|
73
|
+
return [{
|
74
|
+
tag: 'style',
|
75
|
+
children: allCss,
|
76
|
+
injectTo: 'head-prepend'
|
77
|
+
}];
|
78
|
+
}
|
79
|
+
}, {
|
80
|
+
name: PLUGIN_NAMESPACE,
|
67
81
|
configureServer(_server) {
|
68
82
|
server = _server;
|
69
83
|
},
|
@@ -122,13 +136,13 @@ function vanillaExtractPlugin({
|
|
122
136
|
// When using the rollup watcher, we don't want to close the compiler after every build.
|
123
137
|
// Instead, we close it when the watcher is closed via the closeWatcher hook.
|
124
138
|
if (!config.build.watch) {
|
125
|
-
var
|
126
|
-
(
|
139
|
+
var _compiler2;
|
140
|
+
(_compiler2 = compiler) === null || _compiler2 === void 0 || _compiler2.close();
|
127
141
|
}
|
128
142
|
},
|
129
143
|
closeWatcher() {
|
130
|
-
var
|
131
|
-
return (
|
144
|
+
var _compiler3;
|
145
|
+
return (_compiler3 = compiler) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
|
132
146
|
},
|
133
147
|
async transform(code, id) {
|
134
148
|
const [validId] = id.split('?');
|
@@ -180,14 +194,14 @@ function vanillaExtractPlugin({
|
|
180
194
|
}
|
181
195
|
},
|
182
196
|
resolveId(source) {
|
183
|
-
var
|
197
|
+
var _compiler4;
|
184
198
|
const [validId, query] = source.split('?');
|
185
199
|
if (!isVirtualId(validId)) return;
|
186
200
|
const absoluteId = getAbsoluteId(validId);
|
187
201
|
if ( // We should always have CSS for a file here.
|
188
202
|
// The only valid scenario for a missing one is if someone had written
|
189
203
|
// a file in their app using the .vanilla.js/.vanilla.css extension
|
190
|
-
(
|
204
|
+
(_compiler4 = compiler) !== null && _compiler4 !== void 0 && _compiler4.getCssForFile(virtualIdToFileId(absoluteId))) {
|
191
205
|
// Keep the original query string for HMR.
|
192
206
|
return absoluteId + (query ? `?${query}` : '');
|
193
207
|
}
|
@@ -201,7 +215,7 @@ function vanillaExtractPlugin({
|
|
201
215
|
} = compiler.getCssForFile(virtualIdToFileId(absoluteId));
|
202
216
|
return css;
|
203
217
|
}
|
204
|
-
};
|
218
|
+
}];
|
205
219
|
}
|
206
220
|
|
207
221
|
export { vanillaExtractPlugin };
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vanilla-extract/vite-plugin",
|
3
|
-
"version": "5.0
|
3
|
+
"version": "5.1.0-vite-ssr-20250603032431",
|
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",
|
@@ -16,7 +16,7 @@
|
|
16
16
|
"author": "SEEK",
|
17
17
|
"license": "MIT",
|
18
18
|
"dependencies": {
|
19
|
-
"@vanilla-extract/compiler": "^0.
|
19
|
+
"@vanilla-extract/compiler": "^0.3.0-vite-ssr-20250603032431",
|
20
20
|
"@vanilla-extract/integration": "^8.0.2"
|
21
21
|
},
|
22
22
|
"devDependencies": {
|