@vanilla-extract/vite-plugin 5.1.0-vite-ssr-20250611005022 → 5.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.
@@ -13,7 +13,7 @@ type PluginFilter = (filterProps: {
13
13
  interface Options {
14
14
  identifiers?: IdentifierOption;
15
15
  unstable_pluginFilter?: PluginFilter;
16
- unstable_mode?: 'transform' | 'emitCss' | 'inlineCssInSsrDev';
16
+ unstable_mode?: 'transform' | 'emitCss' | 'inlineCssInDev';
17
17
  }
18
18
  declare function vanillaExtractPlugin({ identifiers, unstable_pluginFilter: pluginFilter, unstable_mode, }?: Options): Plugin[];
19
19
 
@@ -71,26 +71,22 @@ function vanillaExtractPlugin({
71
71
  }
72
72
  }
73
73
  return [{
74
- name: `${PLUGIN_NAMESPACE}-inline-css-in-ssr-dev`,
75
- apply: (config, {
74
+ name: `${PLUGIN_NAMESPACE}-inline-dev-css`,
75
+ apply: (_, {
76
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
- },
77
+ }) => command === 'serve' && unstable_mode === 'inlineCssInDev',
85
78
  transformIndexHtml: async () => {
86
79
  var _compiler;
87
80
  const allCss = (_compiler = compiler$1) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
88
- console.log('doing the thing');
81
+ if (!allCss) {
82
+ return [];
83
+ }
89
84
  return [{
90
85
  tag: 'style',
91
86
  children: allCss,
92
87
  attrs: {
93
- type: 'text/css'
88
+ type: 'text/css',
89
+ 'data-vanilla-extract-inline-dev-css': true
94
90
  },
95
91
  injectTo: 'head-prepend'
96
92
  }];
@@ -163,7 +159,7 @@ function vanillaExtractPlugin({
163
159
  var _compiler3;
164
160
  return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
165
161
  },
166
- async transform(code, id) {
162
+ async transform(code, id, options = {}) {
167
163
  const [validId] = id.split('?');
168
164
  if (!integration.cssFileFilter.test(validId)) {
169
165
  return null;
@@ -193,8 +189,8 @@ function vanillaExtractPlugin({
193
189
  }
194
190
  };
195
191
 
196
- // We don't need to watch files in build mode
197
- if (isBuild) {
192
+ // We don't need to watch files or invalidate modules in build mode or during SSR
193
+ if (isBuild || options.ssr) {
198
194
  return result;
199
195
  }
200
196
  for (const file of watchFiles) {
@@ -71,26 +71,22 @@ function vanillaExtractPlugin({
71
71
  }
72
72
  }
73
73
  return [{
74
- name: `${PLUGIN_NAMESPACE}-inline-css-in-ssr-dev`,
75
- apply: (config, {
74
+ name: `${PLUGIN_NAMESPACE}-inline-dev-css`,
75
+ apply: (_, {
76
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
- },
77
+ }) => command === 'serve' && unstable_mode === 'inlineCssInDev',
85
78
  transformIndexHtml: async () => {
86
79
  var _compiler;
87
80
  const allCss = (_compiler = compiler$1) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
88
- console.log('doing the thing');
81
+ if (!allCss) {
82
+ return [];
83
+ }
89
84
  return [{
90
85
  tag: 'style',
91
86
  children: allCss,
92
87
  attrs: {
93
- type: 'text/css'
88
+ type: 'text/css',
89
+ 'data-vanilla-extract-inline-dev-css': true
94
90
  },
95
91
  injectTo: 'head-prepend'
96
92
  }];
@@ -163,7 +159,7 @@ function vanillaExtractPlugin({
163
159
  var _compiler3;
164
160
  return (_compiler3 = compiler$1) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
165
161
  },
166
- async transform(code, id) {
162
+ async transform(code, id, options = {}) {
167
163
  const [validId] = id.split('?');
168
164
  if (!integration.cssFileFilter.test(validId)) {
169
165
  return null;
@@ -193,8 +189,8 @@ function vanillaExtractPlugin({
193
189
  }
194
190
  };
195
191
 
196
- // We don't need to watch files in build mode
197
- if (isBuild) {
192
+ // We don't need to watch files or invalidate modules in build mode or during SSR
193
+ if (isBuild || options.ssr) {
198
194
  return result;
199
195
  }
200
196
  for (const file of watchFiles) {
@@ -63,26 +63,22 @@ function vanillaExtractPlugin({
63
63
  }
64
64
  }
65
65
  return [{
66
- name: `${PLUGIN_NAMESPACE}-inline-css-in-ssr-dev`,
67
- apply: (config, {
66
+ name: `${PLUGIN_NAMESPACE}-inline-dev-css`,
67
+ apply: (_, {
68
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
- },
69
+ }) => command === 'serve' && unstable_mode === 'inlineCssInDev',
77
70
  transformIndexHtml: async () => {
78
71
  var _compiler;
79
72
  const allCss = (_compiler = compiler) === null || _compiler === void 0 ? void 0 : _compiler.getAllCss();
80
- console.log('doing the thing');
73
+ if (!allCss) {
74
+ return [];
75
+ }
81
76
  return [{
82
77
  tag: 'style',
83
78
  children: allCss,
84
79
  attrs: {
85
- type: 'text/css'
80
+ type: 'text/css',
81
+ 'data-vanilla-extract-inline-dev-css': true
86
82
  },
87
83
  injectTo: 'head-prepend'
88
84
  }];
@@ -155,7 +151,7 @@ function vanillaExtractPlugin({
155
151
  var _compiler3;
156
152
  return (_compiler3 = compiler) === null || _compiler3 === void 0 ? void 0 : _compiler3.close();
157
153
  },
158
- async transform(code, id) {
154
+ async transform(code, id, options = {}) {
159
155
  const [validId] = id.split('?');
160
156
  if (!cssFileFilter.test(validId)) {
161
157
  return null;
@@ -185,8 +181,8 @@ function vanillaExtractPlugin({
185
181
  }
186
182
  };
187
183
 
188
- // We don't need to watch files in build mode
189
- if (isBuild) {
184
+ // We don't need to watch files or invalidate modules in build mode or during SSR
185
+ if (isBuild || options.ssr) {
190
186
  return result;
191
187
  }
192
188
  for (const file of watchFiles) {
package/package.json CHANGED
@@ -1,18 +1,10 @@
1
1
  {
2
2
  "name": "@vanilla-extract/vite-plugin",
3
- "version": "5.1.0-vite-ssr-20250611005022",
3
+ "version": "5.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",
7
7
  "types": "dist/vanilla-extract-vite-plugin.cjs.d.ts",
8
- "exports": {
9
- ".": {
10
- "types": "./dist/vanilla-extract-vite-plugin.cjs.d.ts",
11
- "import": "./dist/vanilla-extract-vite-plugin.esm.js",
12
- "default": "./dist/vanilla-extract-vite-plugin.cjs.js"
13
- },
14
- "./package.json": "./package.json"
15
- },
16
8
  "files": [
17
9
  "/dist"
18
10
  ],
@@ -24,8 +16,8 @@
24
16
  "author": "SEEK",
25
17
  "license": "MIT",
26
18
  "dependencies": {
27
- "@vanilla-extract/compiler": "^0.3.0-vite-ssr-20250611005022",
28
- "@vanilla-extract/integration": "^8.0.3"
19
+ "@vanilla-extract/compiler": "^0.3.0",
20
+ "@vanilla-extract/integration": "^8.0.4"
29
21
  },
30
22
  "devDependencies": {
31
23
  "vite": "^5.0.0 || ^6.0.0"