@unocss/vite 0.48.4 → 0.49.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.
package/README.md CHANGED
@@ -10,11 +10,11 @@ npm i -D unocss
10
10
 
11
11
  ```ts
12
12
  // vite.config.ts
13
- import Unocss from 'unocss/vite'
13
+ import UnoCSS from 'unocss/vite'
14
14
 
15
15
  export default {
16
16
  plugins: [
17
- Unocss({ /* options */ }),
17
+ UnoCSS({ /* options */ }),
18
18
  ],
19
19
  }
20
20
  ```
@@ -37,11 +37,11 @@ npm i -D @unocss/vite
37
37
 
38
38
  ```ts
39
39
  // vite.config.ts
40
- import Unocss from '@unocss/vite'
40
+ import UnoCSS from '@unocss/vite'
41
41
 
42
42
  export default {
43
43
  plugins: [
44
- Unocss({
44
+ UnoCSS({
45
45
  presets: [
46
46
  /* no presets by default */
47
47
  ],
@@ -111,12 +111,12 @@ If you're using `@vitejs/plugin-react`:
111
111
  ```ts
112
112
  // vite.config.js
113
113
  import react from '@vitejs/plugin-react'
114
- import Unocss from 'unocss/vite'
114
+ import UnoCSS from 'unocss/vite'
115
115
 
116
116
  export default {
117
117
  plugins: [
118
118
  react(),
119
- Unocss({
119
+ UnoCSS({
120
120
  /* options */
121
121
  }),
122
122
  ],
@@ -128,12 +128,12 @@ or if you're using `@vitejs/plugin-react-refresh`:
128
128
  ```ts
129
129
  // vite.config.js
130
130
  import reactRefresh from '@vitejs/plugin-react-refresh'
131
- import Unocss from 'unocss/vite'
131
+ import UnoCSS from 'unocss/vite'
132
132
 
133
133
  export default {
134
134
  plugins: [
135
135
  reactRefresh(),
136
- Unocss({
136
+ UnoCSS({
137
137
  /* options */
138
138
  }),
139
139
  ],
@@ -147,11 +147,11 @@ If you are using `@vitejs/plugin-react` with `@unocss/preset-attributify`, you m
147
147
  ```ts
148
148
  // vite.config.js
149
149
  import react from '@vitejs/plugin-react'
150
- import Unocss from 'unocss/vite'
150
+ import UnoCSS from 'unocss/vite'
151
151
 
152
152
  export default {
153
153
  plugins: [
154
- Unocss({
154
+ UnoCSS({
155
155
  /* options */
156
156
  }),
157
157
  react(),
@@ -168,12 +168,12 @@ If you're using `@preact/preset-vite`:
168
168
  ```ts
169
169
  // vite.config.js
170
170
  import preact from '@preact/preset-vite'
171
- import Unocss from 'unocss/vite'
171
+ import UnoCSS from 'unocss/vite'
172
172
 
173
173
  export default {
174
174
  plugins: [
175
175
  preact(),
176
- Unocss({
176
+ UnoCSS({
177
177
  /* options */
178
178
  }),
179
179
  ],
@@ -185,12 +185,12 @@ or if you're using `@prefresh/vite`:
185
185
  ```ts
186
186
  // vite.config.js
187
187
  import prefresh from '@prefresh/vite'
188
- import Unocss from 'unocss/vite'
188
+ import UnoCSS from 'unocss/vite'
189
189
 
190
190
  export default {
191
191
  plugins: [
192
192
  prefresh(),
193
- Unocss({
193
+ UnoCSS({
194
194
  /* options */
195
195
  }),
196
196
  ],
@@ -204,11 +204,11 @@ If you are using `@preact/preset-vite` with `@unocss/preset-attributify`, you mu
204
204
  ```ts
205
205
  // vite.config.js
206
206
  import preact from '@preact/preset-vite'
207
- import Unocss from 'unocss/vite'
207
+ import UnoCSS from 'unocss/vite'
208
208
 
209
209
  export default {
210
210
  plugins: [
211
- Unocss({
211
+ UnoCSS({
212
212
  /* options */
213
213
  }),
214
214
  preact(),
@@ -224,17 +224,17 @@ You must add the plugin before `@sveltejs/vite-plugin-svelte`.
224
224
 
225
225
  To support `class:foo` and `class:foo={bar}` add the plugin and configure `extractorSvelte` on `extractors` option.
226
226
 
227
- You can use simple rules with `class:`, for example `class:bg-red-500={foo}` or using `shorcuts` to include multiples rules, see `src/App.svelte` on linked example project below.
227
+ You can use simple rules with `class:`, for example `class:bg-red-500={foo}` or using `shortcuts` to include multiples rules, see `src/App.svelte` on linked example project below.
228
228
 
229
229
  ```ts
230
230
  // vite.config.js
231
231
  import { svelte } from '@sveltejs/vite-plugin-svelte'
232
- import Unocss from 'unocss/vite'
232
+ import UnoCSS from 'unocss/vite'
233
233
  import { extractorSvelte } from '@unocss/core'
234
234
 
235
235
  export default {
236
236
  plugins: [
237
- Unocss({
237
+ UnoCSS({
238
238
  extractors: [extractorSvelte],
239
239
  /* more options */
240
240
  }),
@@ -312,11 +312,11 @@ Don't forget to remove the import for `uno.css` since the `shadow-dom` mode will
312
312
 
313
313
  ```ts
314
314
  // vite.config.js
315
- import Unocss from 'unocss/vite'
315
+ import UnoCSS from 'unocss/vite'
316
316
 
317
317
  export default {
318
318
  plugins: [
319
- Unocss({
319
+ UnoCSS({
320
320
  mode: 'shadow-dom',
321
321
  /* more options */
322
322
  }),
@@ -363,11 +363,11 @@ The plugin uses `nth-of-type` to avoid collisions with multiple parts in the sam
363
363
 
364
364
  ```ts
365
365
  // vite.config.js
366
- import Unocss from 'unocss/vite'
366
+ import UnoCSS from 'unocss/vite'
367
367
 
368
368
  export default {
369
369
  plugins: [
370
- Unocss({
370
+ UnoCSS({
371
371
  mode: 'shadow-dom',
372
372
  shortcuts: [
373
373
  { 'cool-blue': 'bg-blue-500 text-white' },
@@ -413,12 +413,12 @@ template.innerHTML = `
413
413
  ```ts
414
414
  // vite.config.js
415
415
  import solidPlugin from 'vite-plugin-solid'
416
- import Unocss from 'unocss/vite'
416
+ import UnoCSS from 'unocss/vite'
417
417
 
418
418
  export default {
419
419
  plugins: [
420
420
  solidPlugin(),
421
- Unocss({
421
+ UnoCSS({
422
422
  /* options */
423
423
  }),
424
424
  ],
@@ -435,12 +435,12 @@ You need to add the `vite-plugin-elm` plugin before UnoCSS's plugin.
435
435
  // vite.config.js
436
436
  import { defineConfig } from 'vite'
437
437
  import elmPlugin from 'vite-plugin-elm'
438
- import Unocss from 'unocss/vite'
438
+ import UnoCSS from 'unocss/vite'
439
439
 
440
440
  export default defineConfig({
441
441
  plugins: [
442
442
  elmPlugin(),
443
- Unocss({
443
+ UnoCSS({
444
444
  /* options */
445
445
  }),
446
446
  ],
package/dist/index.cjs CHANGED
@@ -379,8 +379,10 @@ function GlobalModeBuildPlugin(ctx) {
379
379
  },
380
380
  load(id) {
381
381
  const layer = resolveLayer(getPath(id));
382
- if (layer)
382
+ if (layer) {
383
+ vfsLayers.add(layer);
383
384
  return getLayerPlaceholder(layer);
385
+ }
384
386
  },
385
387
  moduleParsed({ id, importedIds }) {
386
388
  if (!layerImporterMap.has(id))
package/dist/index.mjs CHANGED
@@ -366,8 +366,10 @@ function GlobalModeBuildPlugin(ctx) {
366
366
  },
367
367
  load(id) {
368
368
  const layer = resolveLayer(getPath(id));
369
- if (layer)
369
+ if (layer) {
370
+ vfsLayers.add(layer);
370
371
  return getLayerPlaceholder(layer);
372
+ }
371
373
  },
372
374
  moduleParsed({ id, importedIds }) {
373
375
  if (!layerImporterMap.has(id))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unocss/vite",
3
- "version": "0.48.4",
3
+ "version": "0.49.0",
4
4
  "description": "The Vite plugin for UnoCSS",
5
5
  "author": "Anthony Fu <anthonyfu117@hotmail.com>",
6
6
  "license": "MIT",
@@ -44,17 +44,17 @@
44
44
  "dependencies": {
45
45
  "@ampproject/remapping": "^2.2.0",
46
46
  "@rollup/pluginutils": "^5.0.2",
47
- "@unocss/config": "0.48.4",
48
- "@unocss/core": "0.48.4",
49
- "@unocss/inspector": "0.48.4",
50
- "@unocss/scope": "0.48.4",
51
- "@unocss/transformer-directives": "0.48.4",
47
+ "@unocss/config": "0.49.0",
48
+ "@unocss/core": "0.49.0",
49
+ "@unocss/inspector": "0.49.0",
50
+ "@unocss/scope": "0.49.0",
51
+ "@unocss/transformer-directives": "0.49.0",
52
52
  "chokidar": "^3.5.3",
53
53
  "fast-glob": "^3.2.12",
54
54
  "magic-string": "^0.27.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@unocss/shared-integration": "0.48.4",
57
+ "@unocss/shared-integration": "0.49.0",
58
58
  "vite": "^4.0.4"
59
59
  },
60
60
  "scripts": {