@vanilla-extract/vite-plugin 5.0.5 → 5.1.0-vite-ssr-20250611005022
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' | 'inlineCssInSsrDev';
|
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,33 @@ function vanillaExtractPlugin({
|
|
70
70
|
}
|
71
71
|
}
|
72
72
|
}
|
73
|
-
return {
|
74
|
-
name:
|
73
|
+
return [{
|
74
|
+
name: `${PLUGIN_NAMESPACE}-inline-css-in-ssr-dev`,
|
75
|
+
apply: (config, {
|
76
|
+
command
|
77
|
+
}) => {
|
78
|
+
var _config$build;
|
79
|
+
console.log({
|
80
|
+
command,
|
81
|
+
c: config.build
|
82
|
+
});
|
83
|
+
return command === 'serve' && Boolean((_config$build = config.build) === null || _config$build === void 0 ? void 0 : _config$build.ssr) && unstable_mode === 'inlineCssInSsrDev';
|
84
|
+
},
|
85
|
+
transformIndexHtml: async () => {
|
86
|
+
var _compiler;
|
87
|
+
const allCss = (_compiler = compiler$1) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
|
88
|
+
console.log('doing the thing');
|
89
|
+
return [{
|
90
|
+
tag: 'style',
|
91
|
+
children: allCss,
|
92
|
+
attrs: {
|
93
|
+
type: 'text/css'
|
94
|
+
},
|
95
|
+
injectTo: 'head-prepend'
|
96
|
+
}];
|
97
|
+
}
|
98
|
+
}, {
|
99
|
+
name: PLUGIN_NAMESPACE,
|
75
100
|
configureServer(_server) {
|
76
101
|
server = _server;
|
77
102
|
},
|
@@ -130,13 +155,13 @@ function vanillaExtractPlugin({
|
|
130
155
|
// When using the rollup watcher, we don't want to close the compiler after every build.
|
131
156
|
// Instead, we close it when the watcher is closed via the closeWatcher hook.
|
132
157
|
if (!config.build.watch) {
|
133
|
-
var
|
134
|
-
(
|
158
|
+
var _compiler2;
|
159
|
+
(_compiler2 = compiler$1) === null || _compiler2 === void 0 || _compiler2.close();
|
135
160
|
}
|
136
161
|
},
|
137
162
|
closeWatcher() {
|
138
|
-
var
|
139
|
-
return (
|
163
|
+
var _compiler3;
|
164
|
+
return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
|
140
165
|
},
|
141
166
|
async transform(code, id) {
|
142
167
|
const [validId] = id.split('?');
|
@@ -188,14 +213,14 @@ function vanillaExtractPlugin({
|
|
188
213
|
}
|
189
214
|
},
|
190
215
|
resolveId(source) {
|
191
|
-
var
|
216
|
+
var _compiler4;
|
192
217
|
const [validId, query] = source.split('?');
|
193
218
|
if (!isVirtualId(validId)) return;
|
194
219
|
const absoluteId = getAbsoluteId(validId);
|
195
220
|
if ( // We should always have CSS for a file here.
|
196
221
|
// The only valid scenario for a missing one is if someone had written
|
197
222
|
// a file in their app using the .vanilla.js/.vanilla.css extension
|
198
|
-
(
|
223
|
+
(_compiler4 = compiler$1) !== null && _compiler4 !== void 0 && _compiler4.getCssForFile(virtualIdToFileId(absoluteId))) {
|
199
224
|
// Keep the original query string for HMR.
|
200
225
|
return absoluteId + (query ? `?${query}` : '');
|
201
226
|
}
|
@@ -209,7 +234,7 @@ function vanillaExtractPlugin({
|
|
209
234
|
} = compiler$1.getCssForFile(virtualIdToFileId(absoluteId));
|
210
235
|
return css;
|
211
236
|
}
|
212
|
-
};
|
237
|
+
}];
|
213
238
|
}
|
214
239
|
|
215
240
|
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,33 @@ function vanillaExtractPlugin({
|
|
70
70
|
}
|
71
71
|
}
|
72
72
|
}
|
73
|
-
return {
|
74
|
-
name:
|
73
|
+
return [{
|
74
|
+
name: `${PLUGIN_NAMESPACE}-inline-css-in-ssr-dev`,
|
75
|
+
apply: (config, {
|
76
|
+
command
|
77
|
+
}) => {
|
78
|
+
var _config$build;
|
79
|
+
console.log({
|
80
|
+
command,
|
81
|
+
c: config.build
|
82
|
+
});
|
83
|
+
return command === 'serve' && Boolean((_config$build = config.build) === null || _config$build === void 0 ? void 0 : _config$build.ssr) && unstable_mode === 'inlineCssInSsrDev';
|
84
|
+
},
|
85
|
+
transformIndexHtml: async () => {
|
86
|
+
var _compiler;
|
87
|
+
const allCss = (_compiler = compiler$1) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
|
88
|
+
console.log('doing the thing');
|
89
|
+
return [{
|
90
|
+
tag: 'style',
|
91
|
+
children: allCss,
|
92
|
+
attrs: {
|
93
|
+
type: 'text/css'
|
94
|
+
},
|
95
|
+
injectTo: 'head-prepend'
|
96
|
+
}];
|
97
|
+
}
|
98
|
+
}, {
|
99
|
+
name: PLUGIN_NAMESPACE,
|
75
100
|
configureServer(_server) {
|
76
101
|
server = _server;
|
77
102
|
},
|
@@ -130,13 +155,13 @@ function vanillaExtractPlugin({
|
|
130
155
|
// When using the rollup watcher, we don't want to close the compiler after every build.
|
131
156
|
// Instead, we close it when the watcher is closed via the closeWatcher hook.
|
132
157
|
if (!config.build.watch) {
|
133
|
-
var
|
134
|
-
(
|
158
|
+
var _compiler2;
|
159
|
+
(_compiler2 = compiler$1) === null || _compiler2 === void 0 || _compiler2.close();
|
135
160
|
}
|
136
161
|
},
|
137
162
|
closeWatcher() {
|
138
|
-
var
|
139
|
-
return (
|
163
|
+
var _compiler3;
|
164
|
+
return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
|
140
165
|
},
|
141
166
|
async transform(code, id) {
|
142
167
|
const [validId] = id.split('?');
|
@@ -188,14 +213,14 @@ function vanillaExtractPlugin({
|
|
188
213
|
}
|
189
214
|
},
|
190
215
|
resolveId(source) {
|
191
|
-
var
|
216
|
+
var _compiler4;
|
192
217
|
const [validId, query] = source.split('?');
|
193
218
|
if (!isVirtualId(validId)) return;
|
194
219
|
const absoluteId = getAbsoluteId(validId);
|
195
220
|
if ( // We should always have CSS for a file here.
|
196
221
|
// The only valid scenario for a missing one is if someone had written
|
197
222
|
// a file in their app using the .vanilla.js/.vanilla.css extension
|
198
|
-
(
|
223
|
+
(_compiler4 = compiler$1) !== null && _compiler4 !== void 0 && _compiler4.getCssForFile(virtualIdToFileId(absoluteId))) {
|
199
224
|
// Keep the original query string for HMR.
|
200
225
|
return absoluteId + (query ? `?${query}` : '');
|
201
226
|
}
|
@@ -209,7 +234,7 @@ function vanillaExtractPlugin({
|
|
209
234
|
} = compiler$1.getCssForFile(virtualIdToFileId(absoluteId));
|
210
235
|
return css;
|
211
236
|
}
|
212
|
-
};
|
237
|
+
}];
|
213
238
|
}
|
214
239
|
|
215
240
|
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,33 @@ function vanillaExtractPlugin({
|
|
62
62
|
}
|
63
63
|
}
|
64
64
|
}
|
65
|
-
return {
|
66
|
-
name:
|
65
|
+
return [{
|
66
|
+
name: `${PLUGIN_NAMESPACE}-inline-css-in-ssr-dev`,
|
67
|
+
apply: (config, {
|
68
|
+
command
|
69
|
+
}) => {
|
70
|
+
var _config$build;
|
71
|
+
console.log({
|
72
|
+
command,
|
73
|
+
c: config.build
|
74
|
+
});
|
75
|
+
return command === 'serve' && Boolean((_config$build = config.build) === null || _config$build === void 0 ? void 0 : _config$build.ssr) && unstable_mode === 'inlineCssInSsrDev';
|
76
|
+
},
|
77
|
+
transformIndexHtml: async () => {
|
78
|
+
var _compiler;
|
79
|
+
const allCss = (_compiler = compiler) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
|
80
|
+
console.log('doing the thing');
|
81
|
+
return [{
|
82
|
+
tag: 'style',
|
83
|
+
children: allCss,
|
84
|
+
attrs: {
|
85
|
+
type: 'text/css'
|
86
|
+
},
|
87
|
+
injectTo: 'head-prepend'
|
88
|
+
}];
|
89
|
+
}
|
90
|
+
}, {
|
91
|
+
name: PLUGIN_NAMESPACE,
|
67
92
|
configureServer(_server) {
|
68
93
|
server = _server;
|
69
94
|
},
|
@@ -122,13 +147,13 @@ function vanillaExtractPlugin({
|
|
122
147
|
// When using the rollup watcher, we don't want to close the compiler after every build.
|
123
148
|
// Instead, we close it when the watcher is closed via the closeWatcher hook.
|
124
149
|
if (!config.build.watch) {
|
125
|
-
var
|
126
|
-
(
|
150
|
+
var _compiler2;
|
151
|
+
(_compiler2 = compiler) === null || _compiler2 === void 0 || _compiler2.close();
|
127
152
|
}
|
128
153
|
},
|
129
154
|
closeWatcher() {
|
130
|
-
var
|
131
|
-
return (
|
155
|
+
var _compiler3;
|
156
|
+
return (_compiler3 = compiler) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
|
132
157
|
},
|
133
158
|
async transform(code, id) {
|
134
159
|
const [validId] = id.split('?');
|
@@ -180,14 +205,14 @@ function vanillaExtractPlugin({
|
|
180
205
|
}
|
181
206
|
},
|
182
207
|
resolveId(source) {
|
183
|
-
var
|
208
|
+
var _compiler4;
|
184
209
|
const [validId, query] = source.split('?');
|
185
210
|
if (!isVirtualId(validId)) return;
|
186
211
|
const absoluteId = getAbsoluteId(validId);
|
187
212
|
if ( // We should always have CSS for a file here.
|
188
213
|
// The only valid scenario for a missing one is if someone had written
|
189
214
|
// a file in their app using the .vanilla.js/.vanilla.css extension
|
190
|
-
(
|
215
|
+
(_compiler4 = compiler) !== null && _compiler4 !== void 0 && _compiler4.getCssForFile(virtualIdToFileId(absoluteId))) {
|
191
216
|
// Keep the original query string for HMR.
|
192
217
|
return absoluteId + (query ? `?${query}` : '');
|
193
218
|
}
|
@@ -201,7 +226,7 @@ function vanillaExtractPlugin({
|
|
201
226
|
} = compiler.getCssForFile(virtualIdToFileId(absoluteId));
|
202
227
|
return css;
|
203
228
|
}
|
204
|
-
};
|
229
|
+
}];
|
205
230
|
}
|
206
231
|
|
207
232
|
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-20250611005022",
|
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",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"author": "SEEK",
|
25
25
|
"license": "MIT",
|
26
26
|
"dependencies": {
|
27
|
-
"@vanilla-extract/compiler": "^0.
|
27
|
+
"@vanilla-extract/compiler": "^0.3.0-vite-ssr-20250611005022",
|
28
28
|
"@vanilla-extract/integration": "^8.0.3"
|
29
29
|
},
|
30
30
|
"devDependencies": {
|