@unocss/vite 0.12.0 → 0.12.5

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.
package/dist/index.js CHANGED
@@ -208,7 +208,12 @@ function GlobalModeBuildPlugin({ uno, extract, tokens, modules, filter }) {
208
208
  if (layer)
209
209
  return getLayerPlaceholder(layer);
210
210
  },
211
+ configResolved(config) {
212
+ cssPlugin = config.plugins.find((i) => i.name === "vite:css-post");
213
+ },
211
214
  async renderChunk(_, chunk) {
215
+ if (!cssPlugin)
216
+ return null;
212
217
  const chunks = Object.keys(chunk.modules).filter((i) => modules.has(i));
213
218
  if (!chunks.length)
214
219
  return null;
@@ -236,9 +241,6 @@ function GlobalModeBuildPlugin({ uno, extract, tokens, modules, filter }) {
236
241
  var _a;
237
242
  return command === "build" && !((_a = options.build) == null ? void 0 : _a.ssr);
238
243
  },
239
- configResolved(config) {
240
- cssPlugin = config.plugins.find((i) => i.name === "vite:css-post");
241
- },
242
244
  enforce: "post",
243
245
  async generateBundle(_, bundle) {
244
246
  const files = Object.keys(bundle);
@@ -515,10 +517,9 @@ function defineConfig(config) {
515
517
  return config;
516
518
  }
517
519
  function UnocssPlugin(configOrPath, defaults = {}) {
518
- var _a;
519
520
  const ctx = createContext(configOrPath, defaults);
520
521
  const { config } = ctx;
521
- const mode = (_a = config.mode) != null ? _a : "global";
522
+ const mode = config.mode ?? "global";
522
523
  const plugins = [
523
524
  ConfigHMRPlugin(ctx)
524
525
  ];
package/dist/index.mjs CHANGED
@@ -174,7 +174,12 @@ function GlobalModeBuildPlugin({ uno, extract, tokens, modules, filter }) {
174
174
  if (layer)
175
175
  return getLayerPlaceholder(layer);
176
176
  },
177
+ configResolved(config) {
178
+ cssPlugin = config.plugins.find((i) => i.name === "vite:css-post");
179
+ },
177
180
  async renderChunk(_, chunk) {
181
+ if (!cssPlugin)
182
+ return null;
178
183
  const chunks = Object.keys(chunk.modules).filter((i) => modules.has(i));
179
184
  if (!chunks.length)
180
185
  return null;
@@ -202,9 +207,6 @@ function GlobalModeBuildPlugin({ uno, extract, tokens, modules, filter }) {
202
207
  var _a;
203
208
  return command === "build" && !((_a = options.build) == null ? void 0 : _a.ssr);
204
209
  },
205
- configResolved(config) {
206
- cssPlugin = config.plugins.find((i) => i.name === "vite:css-post");
207
- },
208
210
  enforce: "post",
209
211
  async generateBundle(_, bundle) {
210
212
  const files = Object.keys(bundle);
@@ -481,10 +483,9 @@ function defineConfig(config) {
481
483
  return config;
482
484
  }
483
485
  function UnocssPlugin(configOrPath, defaults = {}) {
484
- var _a;
485
486
  const ctx = createContext(configOrPath, defaults);
486
487
  const { config } = ctx;
487
- const mode = (_a = config.mode) != null ? _a : "global";
488
+ const mode = config.mode ?? "global";
488
489
  const plugins = [
489
490
  ConfigHMRPlugin(ctx)
490
491
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.12.0",
3
+ "version": "0.12.5",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "keywords": [
6
6
  "unocss",
@@ -23,7 +23,8 @@
23
23
  "exports": {
24
24
  ".": {
25
25
  "require": "./dist/index.js",
26
- "import": "./dist/index.mjs"
26
+ "import": "./dist/index.mjs",
27
+ "types": "./dist/index.d.ts"
27
28
  }
28
29
  },
29
30
  "main": "dist/index.js",
@@ -34,13 +35,13 @@
34
35
  ],
35
36
  "dependencies": {
36
37
  "@rollup/pluginutils": "^4.1.1",
37
- "@unocss/config": "0.12.0",
38
- "@unocss/core": "0.12.0",
39
- "@unocss/scope": "0.12.0",
40
- "@unocss/inspector": "0.12.0"
38
+ "@unocss/config": "0.12.5",
39
+ "@unocss/core": "0.12.5",
40
+ "@unocss/inspector": "0.12.5",
41
+ "@unocss/scope": "0.12.5"
41
42
  },
42
43
  "devDependencies": {
43
- "vite": "^2.6.13"
44
+ "vite": "^2.6.14"
44
45
  },
45
46
  "scripts": {
46
47
  "build": "tsup",