@unocss/nuxt 0.63.1 → 0.63.3

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.
Files changed (2) hide show
  1. package/dist/index.mjs +13 -20
  2. package/package.json +14 -14
package/dist/index.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  import { dirname, resolve } from 'node:path';
2
2
  import process from 'node:process';
3
3
  import { fileURLToPath } from 'node:url';
4
- import { defineNuxtModule, addPluginTemplate, isNuxt2, addComponentsDir, addTemplate, findPath, isNuxt3, extendWebpackConfig } from '@nuxt/kit';
4
+ import { defineNuxtModule, addPluginTemplate, isNuxt2, addComponentsDir, addTemplate, findPath, isNuxt3, extendViteConfig, extendWebpackConfig } from '@nuxt/kit';
5
5
  import { createRecoveryConfigLoader } from '@unocss/config';
6
6
  import VitePlugin from '@unocss/vite';
7
7
  import WebpackPlugin from '@unocss/webpack';
@@ -111,13 +111,8 @@ export default mergeConfigs([${configPaths.map((_, index) => `cfg${index}`).join
111
111
  },
112
112
  write: true
113
113
  });
114
- nuxt.hook("app:templatesGenerated", async () => {
115
- await loadUnoConfig();
116
- });
117
- } else {
118
- await loadUnoConfig();
119
114
  }
120
- async function loadUnoConfig() {
115
+ nuxt.hook("build:before", async () => {
121
116
  const { config: unoConfig } = await loadConfig(
122
117
  process.cwd(),
123
118
  { configFile: options.configFile },
@@ -128,20 +123,23 @@ export default mergeConfigs([${configPaths.map((_, index) => `cfg${index}`).join
128
123
  const preset = nuxt.options.postcss.plugins.cssnano.preset;
129
124
  nuxt.options.postcss.plugins.cssnano = {
130
125
  preset: [preset?.[0] || "default", Object.assign(
126
+ // Following optimizations result in invalid CSS if the directives not transformed yet
131
127
  { mergeRules: false, normalizeWhitespace: false, discardComments: false },
132
128
  preset?.[1]
133
129
  )]
134
130
  };
135
131
  }
136
- return unoConfig;
137
- }
138
- nuxt.hook("vite:extend", async ({ config }) => {
139
- const unoConfig = await loadUnoConfig();
140
132
  await nuxt.callHook("unocss:config", unoConfig);
141
- config.plugins = config.plugins || [];
142
- config.plugins.unshift(...VitePlugin({
143
- mode: options.mode
144
- }, unoConfig));
133
+ extendViteConfig(async (config) => {
134
+ config.plugins = config.plugins || [];
135
+ config.plugins.unshift(...VitePlugin({
136
+ mode: options.mode
137
+ }, unoConfig));
138
+ });
139
+ extendWebpackConfig(async (config) => {
140
+ config.plugins = config.plugins || [];
141
+ config.plugins.unshift(WebpackPlugin({}, unoConfig));
142
+ });
145
143
  });
146
144
  if (nuxt.options.dev) {
147
145
  nuxt.hook("devtools:customTabs", (tabs) => {
@@ -165,11 +163,6 @@ export default mergeConfigs([${configPaths.map((_, index) => `cfg${index}`).join
165
163
  config.plugins = [plugin];
166
164
  });
167
165
  }
168
- extendWebpackConfig(async (config) => {
169
- const unoConfig = await loadUnoConfig();
170
- config.plugins = config.plugins || [];
171
- config.plugins.unshift(WebpackPlugin({}, unoConfig));
172
- });
173
166
  }
174
167
  });
175
168
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unocss/nuxt",
3
3
  "type": "module",
4
- "version": "0.63.1",
4
+ "version": "0.63.3",
5
5
  "description": "Nuxt module for UnoCSS",
6
6
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
7
7
  "license": "MIT",
@@ -39,19 +39,19 @@
39
39
  ],
40
40
  "dependencies": {
41
41
  "@nuxt/kit": "^3.13.2",
42
- "@unocss/config": "0.63.1",
43
- "@unocss/core": "0.63.1",
44
- "@unocss/preset-attributify": "0.63.1",
45
- "@unocss/preset-typography": "0.63.1",
46
- "@unocss/preset-tagify": "0.63.1",
47
- "@unocss/preset-uno": "0.63.1",
48
- "@unocss/preset-icons": "0.63.1",
49
- "@unocss/preset-web-fonts": "0.63.1",
50
- "@unocss/preset-wind": "0.63.1",
51
- "@unocss/vite": "0.63.1",
52
- "@unocss/reset": "0.63.1",
53
- "unocss": "0.63.1",
54
- "@unocss/webpack": "0.63.1"
42
+ "@unocss/preset-attributify": "0.63.3",
43
+ "@unocss/core": "0.63.3",
44
+ "@unocss/preset-icons": "0.63.3",
45
+ "@unocss/config": "0.63.3",
46
+ "@unocss/preset-tagify": "0.63.3",
47
+ "@unocss/preset-typography": "0.63.3",
48
+ "@unocss/preset-uno": "0.63.3",
49
+ "@unocss/preset-web-fonts": "0.63.3",
50
+ "@unocss/vite": "0.63.3",
51
+ "@unocss/preset-wind": "0.63.3",
52
+ "@unocss/reset": "0.63.3",
53
+ "@unocss/webpack": "0.63.3",
54
+ "unocss": "0.63.3"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@nuxt/schema": "^3.13.2"