@unocss/vite 0.43.2 → 0.44.2
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 +10 -16
- package/dist/index.cjs +101 -85
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +100 -85
- package/package.json +8 -7
package/README.md
CHANGED
|
@@ -251,26 +251,20 @@ To support `class:foo` and `class:foo={bar}` add the plugin and configure `extra
|
|
|
251
251
|
You can use simple rules with `class:`, for example `class:bg-red-500={foo}` or using `shorcuts` to include multiples rules, see `src/routes/__layout.svelte` on linked example project below.
|
|
252
252
|
|
|
253
253
|
```ts
|
|
254
|
-
//
|
|
255
|
-
import
|
|
254
|
+
// vite.config.js
|
|
255
|
+
import { sveltekit } from '@sveltejs/kit/vite'
|
|
256
256
|
import UnoCss from 'unocss/vite'
|
|
257
257
|
import { extractorSvelte } from '@unocss/core'
|
|
258
258
|
|
|
259
|
-
/** @type {import('
|
|
259
|
+
/** @type {import('vite').UserConfig} */
|
|
260
260
|
const config = {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
extractors: [extractorSvelte],
|
|
269
|
-
/* more options */
|
|
270
|
-
}),
|
|
271
|
-
],
|
|
272
|
-
},
|
|
273
|
-
},
|
|
261
|
+
plugins: [
|
|
262
|
+
sveltekit(),
|
|
263
|
+
UnoCss({
|
|
264
|
+
extractors: [extractorSvelte],
|
|
265
|
+
/* more options */
|
|
266
|
+
}),
|
|
267
|
+
],
|
|
274
268
|
}
|
|
275
269
|
```
|
|
276
270
|
|
package/dist/index.cjs
CHANGED
|
@@ -8,6 +8,7 @@ const crypto = require('crypto');
|
|
|
8
8
|
const core = require('@unocss/core');
|
|
9
9
|
const pluginutils = require('@rollup/pluginutils');
|
|
10
10
|
const MagicString = require('magic-string');
|
|
11
|
+
const remapping = require('@ampproject/remapping');
|
|
11
12
|
const fs = require('fs');
|
|
12
13
|
const url = require('url');
|
|
13
14
|
const config = require('@unocss/config');
|
|
@@ -16,6 +17,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
16
17
|
|
|
17
18
|
const UnocssInspector__default = /*#__PURE__*/_interopDefaultLegacy(UnocssInspector);
|
|
18
19
|
const MagicString__default = /*#__PURE__*/_interopDefaultLegacy(MagicString);
|
|
20
|
+
const remapping__default = /*#__PURE__*/_interopDefaultLegacy(remapping);
|
|
19
21
|
const fs__default = /*#__PURE__*/_interopDefaultLegacy(fs);
|
|
20
22
|
|
|
21
23
|
const defaultExclude = [core.cssIdRE];
|
|
@@ -354,7 +356,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, getConfig
|
|
|
354
356
|
chunk.code = await replaceAsync(js, LAYER_PLACEHOLDER_RE, async (_, __, layer) => {
|
|
355
357
|
replaced = true;
|
|
356
358
|
const css = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(vfsLayers)) : result.getLayer(layer) || "";
|
|
357
|
-
return css;
|
|
359
|
+
return css.replace(/\n/g, "").replace(/(?<!\\)(['"])/g, "\\$1");
|
|
358
360
|
});
|
|
359
361
|
}
|
|
360
362
|
}
|
|
@@ -528,44 +530,67 @@ function PerModuleModePlugin({ uno, filter }) {
|
|
|
528
530
|
}]
|
|
529
531
|
});
|
|
530
532
|
};
|
|
531
|
-
return
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
};
|
|
553
|
-
},
|
|
554
|
-
resolveId(id) {
|
|
555
|
-
return id.startsWith(VIRTUAL_PREFIX) ? id : null;
|
|
533
|
+
return [
|
|
534
|
+
{
|
|
535
|
+
name: "unocss:module-scope:pre",
|
|
536
|
+
enforce: "pre",
|
|
537
|
+
async transform(code, id) {
|
|
538
|
+
if (!filter(code, id))
|
|
539
|
+
return;
|
|
540
|
+
const hash = getHash(id);
|
|
541
|
+
const { css } = await uno.generate(code, {
|
|
542
|
+
id,
|
|
543
|
+
preflights: true
|
|
544
|
+
});
|
|
545
|
+
if (!css)
|
|
546
|
+
return null;
|
|
547
|
+
moduleMap.set(hash, [id, css]);
|
|
548
|
+
invalidate(hash);
|
|
549
|
+
return {
|
|
550
|
+
code: `import "${VIRTUAL_PREFIX}${hash}.css";${code}`,
|
|
551
|
+
map: null
|
|
552
|
+
};
|
|
553
|
+
}
|
|
556
554
|
},
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
555
|
+
{
|
|
556
|
+
name: "unocss:module-scope",
|
|
557
|
+
enforce: "post",
|
|
558
|
+
configureServer(_server) {
|
|
559
|
+
server = _server;
|
|
560
|
+
},
|
|
561
|
+
async transform(code, id) {
|
|
562
|
+
if (!filter(code, id))
|
|
563
|
+
return;
|
|
564
|
+
const hash = getHash(id);
|
|
565
|
+
const hasScope = code.match(SCOPE_IMPORT_RE);
|
|
566
|
+
const { css } = await uno.generate(code, { id, scope: hasScope ? `.${hash}` : void 0, preflights: false });
|
|
567
|
+
if (!css && !hasScope)
|
|
568
|
+
return null;
|
|
569
|
+
if (hasScope)
|
|
570
|
+
code = code.replace(SCOPE_IMPORT_RE, ` from 'data:text/javascript;base64,${Buffer.from(`export default () => "${hash}"`).toString("base64")}'`);
|
|
571
|
+
moduleMap.set(hash, [id, css]);
|
|
572
|
+
invalidate(hash);
|
|
573
|
+
return {
|
|
574
|
+
code: `import "${VIRTUAL_PREFIX}${hash}.css";${code}`,
|
|
575
|
+
map: null
|
|
576
|
+
};
|
|
577
|
+
},
|
|
578
|
+
resolveId(id) {
|
|
579
|
+
return id.startsWith(VIRTUAL_PREFIX) ? id : null;
|
|
580
|
+
},
|
|
581
|
+
load(id) {
|
|
582
|
+
if (!id.startsWith(VIRTUAL_PREFIX))
|
|
583
|
+
return null;
|
|
584
|
+
const hash = id.slice(VIRTUAL_PREFIX.length, -".css".length);
|
|
585
|
+
const [source, css] = moduleMap.get(hash) || [];
|
|
586
|
+
if (source)
|
|
587
|
+
this.addWatchFile(source);
|
|
588
|
+
return `
|
|
565
589
|
/* unocss ${source} */
|
|
566
590
|
${css}`;
|
|
591
|
+
}
|
|
567
592
|
}
|
|
568
|
-
|
|
593
|
+
];
|
|
569
594
|
}
|
|
570
595
|
|
|
571
596
|
function VueScopedPlugin({ uno, ready }) {
|
|
@@ -756,62 +781,53 @@ function ConfigHMRPlugin(ctx) {
|
|
|
756
781
|
};
|
|
757
782
|
}
|
|
758
783
|
|
|
759
|
-
function
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
} else if (!ctx.filter(code, id)) {
|
|
784
|
+
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
785
|
+
if (original.includes(IGNORE_COMMENT))
|
|
786
|
+
return;
|
|
787
|
+
const transformers = (ctx.uno.config.transformers || []).filter((i) => (i.enforce || "default") === enforce);
|
|
788
|
+
if (!transformers.length)
|
|
789
|
+
return;
|
|
790
|
+
let code = original;
|
|
791
|
+
let s = new MagicString__default(code);
|
|
792
|
+
const maps = [];
|
|
793
|
+
for (const t of transformers) {
|
|
794
|
+
if (t.idFilter) {
|
|
795
|
+
if (!t.idFilter(id))
|
|
772
796
|
continue;
|
|
773
|
-
|
|
774
|
-
|
|
797
|
+
} else if (!ctx.filter(code, id)) {
|
|
798
|
+
continue;
|
|
775
799
|
}
|
|
800
|
+
await t.transform(s, id, ctx);
|
|
776
801
|
if (s.hasChanged()) {
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
map: s.generateMap({ hires: true, source: id })
|
|
781
|
-
};
|
|
802
|
+
code = s.toString();
|
|
803
|
+
maps.push(s.generateMap({ hires: true, source: id }));
|
|
804
|
+
s = new MagicString__default(code);
|
|
782
805
|
}
|
|
783
806
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
transformIndexHtml(code) {
|
|
801
|
-
return applyTransformers(code, "index.html", "pre").then((t) => t?.code);
|
|
802
|
-
}
|
|
807
|
+
if (code !== original) {
|
|
808
|
+
ctx.affectedModules.add(id);
|
|
809
|
+
return {
|
|
810
|
+
code,
|
|
811
|
+
map: remapping__default(maps, () => null)
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
function createTransformerPlugins(ctx) {
|
|
817
|
+
const enforces = ["default", "pre", "post"];
|
|
818
|
+
return enforces.map((enforce) => ({
|
|
819
|
+
name: `unocss:transformers:${enforce}`,
|
|
820
|
+
enforce: enforce === "default" ? void 0 : enforce,
|
|
821
|
+
transform(code, id) {
|
|
822
|
+
return applyTransformers(ctx, code, id, enforce);
|
|
803
823
|
},
|
|
804
|
-
{
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
return applyTransformers(code, id, "post");
|
|
809
|
-
},
|
|
810
|
-
transformIndexHtml(code) {
|
|
811
|
-
applyTransformers(code, "index.html", "post").then((t) => t?.code);
|
|
824
|
+
transformIndexHtml: {
|
|
825
|
+
enforce: enforce === "default" ? void 0 : enforce,
|
|
826
|
+
transform(code) {
|
|
827
|
+
return applyTransformers(ctx, code, "index.html", enforce).then((t) => t?.code);
|
|
812
828
|
}
|
|
813
829
|
}
|
|
814
|
-
|
|
830
|
+
}));
|
|
815
831
|
}
|
|
816
832
|
|
|
817
833
|
const _dirname = typeof __dirname !== "undefined" ? __dirname : path.dirname(url.fileURLToPath((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
@@ -950,13 +966,13 @@ function UnocssPlugin(configOrPath, defaults = {}) {
|
|
|
950
966
|
const mode = inlineConfig.mode ?? "global";
|
|
951
967
|
const plugins = [
|
|
952
968
|
ConfigHMRPlugin(ctx),
|
|
953
|
-
...
|
|
969
|
+
...createTransformerPlugins(ctx),
|
|
954
970
|
...createDevtoolsPlugin(ctx)
|
|
955
971
|
];
|
|
956
972
|
if (inlineConfig.inspector !== false)
|
|
957
973
|
plugins.push(UnocssInspector__default(ctx));
|
|
958
974
|
if (mode === "per-module") {
|
|
959
|
-
plugins.push(PerModuleModePlugin(ctx));
|
|
975
|
+
plugins.push(...PerModuleModePlugin(ctx));
|
|
960
976
|
} else if (mode === "vue-scoped") {
|
|
961
977
|
plugins.push(VueScopedPlugin(ctx));
|
|
962
978
|
} else if (mode === "svelte-scoped") {
|
package/dist/index.d.ts
CHANGED
|
@@ -45,7 +45,7 @@ declare function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, ge
|
|
|
45
45
|
|
|
46
46
|
declare function GlobalModePlugin(ctx: UnocssPluginContext): vite.Plugin[];
|
|
47
47
|
|
|
48
|
-
declare function PerModuleModePlugin({ uno, filter }: UnocssPluginContext): Plugin;
|
|
48
|
+
declare function PerModuleModePlugin({ uno, filter }: UnocssPluginContext): Plugin[];
|
|
49
49
|
|
|
50
50
|
declare function VueScopedPlugin({ uno, ready }: UnocssPluginContext): Plugin;
|
|
51
51
|
|
package/dist/index.mjs
CHANGED
|
@@ -4,6 +4,7 @@ import { createHash } from 'crypto';
|
|
|
4
4
|
import { cssIdRE, createGenerator, BetterMap, notNull, toEscapedSelector } from '@unocss/core';
|
|
5
5
|
import { createFilter } from '@rollup/pluginutils';
|
|
6
6
|
import MagicString from 'magic-string';
|
|
7
|
+
import remapping from '@ampproject/remapping';
|
|
7
8
|
import fs from 'fs';
|
|
8
9
|
import { fileURLToPath } from 'url';
|
|
9
10
|
import { loadConfig } from '@unocss/config';
|
|
@@ -344,7 +345,7 @@ function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, getConfig
|
|
|
344
345
|
chunk.code = await replaceAsync(js, LAYER_PLACEHOLDER_RE, async (_, __, layer) => {
|
|
345
346
|
replaced = true;
|
|
346
347
|
const css = layer === LAYER_MARK_ALL ? result.getLayers(void 0, Array.from(vfsLayers)) : result.getLayer(layer) || "";
|
|
347
|
-
return css;
|
|
348
|
+
return css.replace(/\n/g, "").replace(/(?<!\\)(['"])/g, "\\$1");
|
|
348
349
|
});
|
|
349
350
|
}
|
|
350
351
|
}
|
|
@@ -518,44 +519,67 @@ function PerModuleModePlugin({ uno, filter }) {
|
|
|
518
519
|
}]
|
|
519
520
|
});
|
|
520
521
|
};
|
|
521
|
-
return
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
};
|
|
543
|
-
},
|
|
544
|
-
resolveId(id) {
|
|
545
|
-
return id.startsWith(VIRTUAL_PREFIX) ? id : null;
|
|
522
|
+
return [
|
|
523
|
+
{
|
|
524
|
+
name: "unocss:module-scope:pre",
|
|
525
|
+
enforce: "pre",
|
|
526
|
+
async transform(code, id) {
|
|
527
|
+
if (!filter(code, id))
|
|
528
|
+
return;
|
|
529
|
+
const hash = getHash(id);
|
|
530
|
+
const { css } = await uno.generate(code, {
|
|
531
|
+
id,
|
|
532
|
+
preflights: true
|
|
533
|
+
});
|
|
534
|
+
if (!css)
|
|
535
|
+
return null;
|
|
536
|
+
moduleMap.set(hash, [id, css]);
|
|
537
|
+
invalidate(hash);
|
|
538
|
+
return {
|
|
539
|
+
code: `import "${VIRTUAL_PREFIX}${hash}.css";${code}`,
|
|
540
|
+
map: null
|
|
541
|
+
};
|
|
542
|
+
}
|
|
546
543
|
},
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
544
|
+
{
|
|
545
|
+
name: "unocss:module-scope",
|
|
546
|
+
enforce: "post",
|
|
547
|
+
configureServer(_server) {
|
|
548
|
+
server = _server;
|
|
549
|
+
},
|
|
550
|
+
async transform(code, id) {
|
|
551
|
+
if (!filter(code, id))
|
|
552
|
+
return;
|
|
553
|
+
const hash = getHash(id);
|
|
554
|
+
const hasScope = code.match(SCOPE_IMPORT_RE);
|
|
555
|
+
const { css } = await uno.generate(code, { id, scope: hasScope ? `.${hash}` : void 0, preflights: false });
|
|
556
|
+
if (!css && !hasScope)
|
|
557
|
+
return null;
|
|
558
|
+
if (hasScope)
|
|
559
|
+
code = code.replace(SCOPE_IMPORT_RE, ` from 'data:text/javascript;base64,${Buffer.from(`export default () => "${hash}"`).toString("base64")}'`);
|
|
560
|
+
moduleMap.set(hash, [id, css]);
|
|
561
|
+
invalidate(hash);
|
|
562
|
+
return {
|
|
563
|
+
code: `import "${VIRTUAL_PREFIX}${hash}.css";${code}`,
|
|
564
|
+
map: null
|
|
565
|
+
};
|
|
566
|
+
},
|
|
567
|
+
resolveId(id) {
|
|
568
|
+
return id.startsWith(VIRTUAL_PREFIX) ? id : null;
|
|
569
|
+
},
|
|
570
|
+
load(id) {
|
|
571
|
+
if (!id.startsWith(VIRTUAL_PREFIX))
|
|
572
|
+
return null;
|
|
573
|
+
const hash = id.slice(VIRTUAL_PREFIX.length, -".css".length);
|
|
574
|
+
const [source, css] = moduleMap.get(hash) || [];
|
|
575
|
+
if (source)
|
|
576
|
+
this.addWatchFile(source);
|
|
577
|
+
return `
|
|
555
578
|
/* unocss ${source} */
|
|
556
579
|
${css}`;
|
|
580
|
+
}
|
|
557
581
|
}
|
|
558
|
-
|
|
582
|
+
];
|
|
559
583
|
}
|
|
560
584
|
|
|
561
585
|
function VueScopedPlugin({ uno, ready }) {
|
|
@@ -746,62 +770,53 @@ function ConfigHMRPlugin(ctx) {
|
|
|
746
770
|
};
|
|
747
771
|
}
|
|
748
772
|
|
|
749
|
-
function
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
} else if (!ctx.filter(code, id)) {
|
|
773
|
+
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
774
|
+
if (original.includes(IGNORE_COMMENT))
|
|
775
|
+
return;
|
|
776
|
+
const transformers = (ctx.uno.config.transformers || []).filter((i) => (i.enforce || "default") === enforce);
|
|
777
|
+
if (!transformers.length)
|
|
778
|
+
return;
|
|
779
|
+
let code = original;
|
|
780
|
+
let s = new MagicString(code);
|
|
781
|
+
const maps = [];
|
|
782
|
+
for (const t of transformers) {
|
|
783
|
+
if (t.idFilter) {
|
|
784
|
+
if (!t.idFilter(id))
|
|
762
785
|
continue;
|
|
763
|
-
|
|
764
|
-
|
|
786
|
+
} else if (!ctx.filter(code, id)) {
|
|
787
|
+
continue;
|
|
765
788
|
}
|
|
789
|
+
await t.transform(s, id, ctx);
|
|
766
790
|
if (s.hasChanged()) {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
map: s.generateMap({ hires: true, source: id })
|
|
771
|
-
};
|
|
791
|
+
code = s.toString();
|
|
792
|
+
maps.push(s.generateMap({ hires: true, source: id }));
|
|
793
|
+
s = new MagicString(code);
|
|
772
794
|
}
|
|
773
795
|
}
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
transformIndexHtml(code) {
|
|
791
|
-
return applyTransformers(code, "index.html", "pre").then((t) => t?.code);
|
|
792
|
-
}
|
|
796
|
+
if (code !== original) {
|
|
797
|
+
ctx.affectedModules.add(id);
|
|
798
|
+
return {
|
|
799
|
+
code,
|
|
800
|
+
map: remapping(maps, () => null)
|
|
801
|
+
};
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
function createTransformerPlugins(ctx) {
|
|
806
|
+
const enforces = ["default", "pre", "post"];
|
|
807
|
+
return enforces.map((enforce) => ({
|
|
808
|
+
name: `unocss:transformers:${enforce}`,
|
|
809
|
+
enforce: enforce === "default" ? void 0 : enforce,
|
|
810
|
+
transform(code, id) {
|
|
811
|
+
return applyTransformers(ctx, code, id, enforce);
|
|
793
812
|
},
|
|
794
|
-
{
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
return applyTransformers(code, id, "post");
|
|
799
|
-
},
|
|
800
|
-
transformIndexHtml(code) {
|
|
801
|
-
applyTransformers(code, "index.html", "post").then((t) => t?.code);
|
|
813
|
+
transformIndexHtml: {
|
|
814
|
+
enforce: enforce === "default" ? void 0 : enforce,
|
|
815
|
+
transform(code) {
|
|
816
|
+
return applyTransformers(ctx, code, "index.html", enforce).then((t) => t?.code);
|
|
802
817
|
}
|
|
803
818
|
}
|
|
804
|
-
|
|
819
|
+
}));
|
|
805
820
|
}
|
|
806
821
|
|
|
807
822
|
const _dirname = typeof __dirname !== "undefined" ? __dirname : dirname(fileURLToPath(import.meta.url));
|
|
@@ -940,13 +955,13 @@ function UnocssPlugin(configOrPath, defaults = {}) {
|
|
|
940
955
|
const mode = inlineConfig.mode ?? "global";
|
|
941
956
|
const plugins = [
|
|
942
957
|
ConfigHMRPlugin(ctx),
|
|
943
|
-
...
|
|
958
|
+
...createTransformerPlugins(ctx),
|
|
944
959
|
...createDevtoolsPlugin(ctx)
|
|
945
960
|
];
|
|
946
961
|
if (inlineConfig.inspector !== false)
|
|
947
962
|
plugins.push(UnocssInspector(ctx));
|
|
948
963
|
if (mode === "per-module") {
|
|
949
|
-
plugins.push(PerModuleModePlugin(ctx));
|
|
964
|
+
plugins.push(...PerModuleModePlugin(ctx));
|
|
950
965
|
} else if (mode === "vue-scoped") {
|
|
951
966
|
plugins.push(VueScopedPlugin(ctx));
|
|
952
967
|
} else if (mode === "svelte-scoped") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.2",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,16 +42,17 @@
|
|
|
42
42
|
"vite": "^2.9.0 || ^3.0.0-0"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
+
"@ampproject/remapping": "^2.2.0",
|
|
45
46
|
"@rollup/pluginutils": "^4.2.1",
|
|
46
|
-
"@unocss/config": "0.
|
|
47
|
-
"@unocss/core": "0.
|
|
48
|
-
"@unocss/inspector": "0.
|
|
49
|
-
"@unocss/scope": "0.
|
|
50
|
-
"@unocss/transformer-directives": "0.
|
|
47
|
+
"@unocss/config": "0.44.2",
|
|
48
|
+
"@unocss/core": "0.44.2",
|
|
49
|
+
"@unocss/inspector": "0.44.2",
|
|
50
|
+
"@unocss/scope": "0.44.2",
|
|
51
|
+
"@unocss/transformer-directives": "0.44.2",
|
|
51
52
|
"magic-string": "^0.26.2"
|
|
52
53
|
},
|
|
53
54
|
"devDependencies": {
|
|
54
|
-
"@unocss/shared-integration": "0.
|
|
55
|
+
"@unocss/shared-integration": "0.44.2",
|
|
55
56
|
"vite": "^2.9.12"
|
|
56
57
|
},
|
|
57
58
|
"scripts": {
|