@unocss/vite 0.44.7 → 0.45.1
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/client.cjs +5 -1
- package/dist/client.mjs +5 -1
- package/dist/index.cjs +27 -9
- package/dist/index.mjs +27 -9
- package/package.json +8 -8
package/dist/client.cjs
CHANGED
|
@@ -13,7 +13,11 @@ function include(set, v) {
|
|
|
13
13
|
for (const i of v)
|
|
14
14
|
set.add(i);
|
|
15
15
|
}
|
|
16
|
-
console.log(
|
|
16
|
+
console.log(
|
|
17
|
+
"%c[unocss] devtools support enabled %c\nread more at https://windicss.org",
|
|
18
|
+
"background:#0ea5e9; color:white; padding: 1px 4px; border-radius: 3px;",
|
|
19
|
+
""
|
|
20
|
+
);
|
|
17
21
|
const visitedClasses = /* @__PURE__ */ new Set();
|
|
18
22
|
const pendingClasses = /* @__PURE__ */ new Set();
|
|
19
23
|
let _timer;
|
package/dist/client.mjs
CHANGED
|
@@ -11,7 +11,11 @@ function include(set, v) {
|
|
|
11
11
|
for (const i of v)
|
|
12
12
|
set.add(i);
|
|
13
13
|
}
|
|
14
|
-
console.log(
|
|
14
|
+
console.log(
|
|
15
|
+
"%c[unocss] devtools support enabled %c\nread more at https://windicss.org",
|
|
16
|
+
"background:#0ea5e9; color:white; padding: 1px 4px; border-radius: 3px;",
|
|
17
|
+
""
|
|
18
|
+
);
|
|
15
19
|
const visitedClasses = /* @__PURE__ */ new Set();
|
|
16
20
|
const pendingClasses = /* @__PURE__ */ new Set();
|
|
17
21
|
let _timer;
|
package/dist/index.cjs
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const UnocssInspector = require('@unocss/inspector');
|
|
6
|
-
const path = require('path');
|
|
7
|
-
const crypto = require('crypto');
|
|
8
6
|
const core = require('@unocss/core');
|
|
9
7
|
const pluginutils = require('@rollup/pluginutils');
|
|
8
|
+
const config = require('@unocss/config');
|
|
9
|
+
const crypto = require('crypto');
|
|
10
|
+
const path = require('path');
|
|
10
11
|
const MagicString = require('magic-string');
|
|
11
12
|
const remapping = require('@ampproject/remapping');
|
|
12
13
|
const fs = require('fs');
|
|
13
14
|
const url = require('url');
|
|
14
|
-
const config = require('@unocss/config');
|
|
15
15
|
|
|
16
16
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e["default"] : e; }
|
|
17
17
|
|
|
@@ -72,7 +72,10 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
72
72
|
rawConfig = result.config;
|
|
73
73
|
uno.setConfig(rawConfig);
|
|
74
74
|
uno.config.envMode = "dev";
|
|
75
|
-
rollupFilter = pluginutils.createFilter(
|
|
75
|
+
rollupFilter = pluginutils.createFilter(
|
|
76
|
+
rawConfig.include || defaultInclude,
|
|
77
|
+
rawConfig.exclude || defaultExclude
|
|
78
|
+
);
|
|
76
79
|
tokens.clear();
|
|
77
80
|
await Promise.all(modules.map((code, id) => uno.applyExtractors(code, id, tokens)));
|
|
78
81
|
invalidate();
|
|
@@ -164,7 +167,9 @@ function replaceAsync(string, searchValue, replacer) {
|
|
|
164
167
|
});
|
|
165
168
|
});
|
|
166
169
|
} else {
|
|
167
|
-
return Promise.resolve(
|
|
170
|
+
return Promise.resolve(
|
|
171
|
+
String.prototype.replace.call(string, searchValue, replacer)
|
|
172
|
+
);
|
|
168
173
|
}
|
|
169
174
|
} catch (error) {
|
|
170
175
|
return Promise.reject(error);
|
|
@@ -607,7 +612,10 @@ function VueScopedPlugin({ uno, ready }) {
|
|
|
607
612
|
enforce: "pre",
|
|
608
613
|
async configResolved() {
|
|
609
614
|
const { config } = await ready;
|
|
610
|
-
filter = pluginutils.createFilter(
|
|
615
|
+
filter = pluginutils.createFilter(
|
|
616
|
+
config.include || [/\.vue$/],
|
|
617
|
+
config.exclude || defaultExclude
|
|
618
|
+
);
|
|
611
619
|
},
|
|
612
620
|
transform(code, id) {
|
|
613
621
|
if (!filter(id))
|
|
@@ -642,7 +650,10 @@ function SvelteScopedPlugin({ uno, ready }) {
|
|
|
642
650
|
enforce: "pre",
|
|
643
651
|
async configResolved() {
|
|
644
652
|
const { config } = await ready;
|
|
645
|
-
filter = pluginutils.createFilter(
|
|
653
|
+
filter = pluginutils.createFilter(
|
|
654
|
+
config.include || [/\.svelte$/],
|
|
655
|
+
config.exclude || defaultExclude
|
|
656
|
+
);
|
|
646
657
|
},
|
|
647
658
|
transform(code, id) {
|
|
648
659
|
if (!filter(id))
|
|
@@ -716,7 +727,11 @@ function ShadowDomModuleModePlugin({ uno }) {
|
|
|
716
727
|
const partsToApply = /* @__PURE__ */ new Map();
|
|
717
728
|
const { idxResolver, incrementIdx } = idxMapFactory();
|
|
718
729
|
while (element = nameRegexp.exec(useCode)) {
|
|
719
|
-
const result = checkElement(
|
|
730
|
+
const result = checkElement(
|
|
731
|
+
useParts,
|
|
732
|
+
idxResolver,
|
|
733
|
+
element
|
|
734
|
+
);
|
|
720
735
|
if (result) {
|
|
721
736
|
result.entries.forEach(([name, replacement]) => {
|
|
722
737
|
let list = partsToApply.get(name);
|
|
@@ -982,7 +997,10 @@ function UnocssPlugin(configOrPath, defaults = {}) {
|
|
|
982
997
|
} else if (mode === "global") {
|
|
983
998
|
plugins.push(...GlobalModePlugin(ctx));
|
|
984
999
|
} else if (mode === "dist-chunk") {
|
|
985
|
-
plugins.push(
|
|
1000
|
+
plugins.push(
|
|
1001
|
+
ChunkModeBuildPlugin(ctx),
|
|
1002
|
+
...GlobalModeDevPlugin(ctx)
|
|
1003
|
+
);
|
|
986
1004
|
} else {
|
|
987
1005
|
throw new Error(`[unocss] unknown mode "${mode}"`);
|
|
988
1006
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import UnocssInspector from '@unocss/inspector';
|
|
2
|
-
import { resolve, dirname } from 'path';
|
|
3
|
-
import { createHash } from 'crypto';
|
|
4
2
|
import { cssIdRE, createGenerator, BetterMap, notNull, toEscapedSelector } from '@unocss/core';
|
|
5
3
|
import { createFilter } from '@rollup/pluginutils';
|
|
4
|
+
import { loadConfig } from '@unocss/config';
|
|
5
|
+
import { createHash } from 'crypto';
|
|
6
|
+
import { resolve, dirname } from 'path';
|
|
6
7
|
import MagicString from 'magic-string';
|
|
7
8
|
import remapping from '@ampproject/remapping';
|
|
8
9
|
import fs from 'fs';
|
|
9
10
|
import { fileURLToPath } from 'url';
|
|
10
|
-
import { loadConfig } from '@unocss/config';
|
|
11
11
|
|
|
12
12
|
const defaultExclude = [cssIdRE];
|
|
13
13
|
const defaultInclude = [/\.vue$/, /\.vue\?vue/, /\.svelte$/, /\.[jt]sx$/, /\.mdx?$/, /\.astro$/, /\.elm$/, /\.html$/];
|
|
@@ -61,7 +61,10 @@ function createContext(configOrPath, defaults = {}, extraConfigSources = [], res
|
|
|
61
61
|
rawConfig = result.config;
|
|
62
62
|
uno.setConfig(rawConfig);
|
|
63
63
|
uno.config.envMode = "dev";
|
|
64
|
-
rollupFilter = createFilter(
|
|
64
|
+
rollupFilter = createFilter(
|
|
65
|
+
rawConfig.include || defaultInclude,
|
|
66
|
+
rawConfig.exclude || defaultExclude
|
|
67
|
+
);
|
|
65
68
|
tokens.clear();
|
|
66
69
|
await Promise.all(modules.map((code, id) => uno.applyExtractors(code, id, tokens)));
|
|
67
70
|
invalidate();
|
|
@@ -153,7 +156,9 @@ function replaceAsync(string, searchValue, replacer) {
|
|
|
153
156
|
});
|
|
154
157
|
});
|
|
155
158
|
} else {
|
|
156
|
-
return Promise.resolve(
|
|
159
|
+
return Promise.resolve(
|
|
160
|
+
String.prototype.replace.call(string, searchValue, replacer)
|
|
161
|
+
);
|
|
157
162
|
}
|
|
158
163
|
} catch (error) {
|
|
159
164
|
return Promise.reject(error);
|
|
@@ -596,7 +601,10 @@ function VueScopedPlugin({ uno, ready }) {
|
|
|
596
601
|
enforce: "pre",
|
|
597
602
|
async configResolved() {
|
|
598
603
|
const { config } = await ready;
|
|
599
|
-
filter = createFilter(
|
|
604
|
+
filter = createFilter(
|
|
605
|
+
config.include || [/\.vue$/],
|
|
606
|
+
config.exclude || defaultExclude
|
|
607
|
+
);
|
|
600
608
|
},
|
|
601
609
|
transform(code, id) {
|
|
602
610
|
if (!filter(id))
|
|
@@ -631,7 +639,10 @@ function SvelteScopedPlugin({ uno, ready }) {
|
|
|
631
639
|
enforce: "pre",
|
|
632
640
|
async configResolved() {
|
|
633
641
|
const { config } = await ready;
|
|
634
|
-
filter = createFilter(
|
|
642
|
+
filter = createFilter(
|
|
643
|
+
config.include || [/\.svelte$/],
|
|
644
|
+
config.exclude || defaultExclude
|
|
645
|
+
);
|
|
635
646
|
},
|
|
636
647
|
transform(code, id) {
|
|
637
648
|
if (!filter(id))
|
|
@@ -705,7 +716,11 @@ function ShadowDomModuleModePlugin({ uno }) {
|
|
|
705
716
|
const partsToApply = /* @__PURE__ */ new Map();
|
|
706
717
|
const { idxResolver, incrementIdx } = idxMapFactory();
|
|
707
718
|
while (element = nameRegexp.exec(useCode)) {
|
|
708
|
-
const result = checkElement(
|
|
719
|
+
const result = checkElement(
|
|
720
|
+
useParts,
|
|
721
|
+
idxResolver,
|
|
722
|
+
element
|
|
723
|
+
);
|
|
709
724
|
if (result) {
|
|
710
725
|
result.entries.forEach(([name, replacement]) => {
|
|
711
726
|
let list = partsToApply.get(name);
|
|
@@ -971,7 +986,10 @@ function UnocssPlugin(configOrPath, defaults = {}) {
|
|
|
971
986
|
} else if (mode === "global") {
|
|
972
987
|
plugins.push(...GlobalModePlugin(ctx));
|
|
973
988
|
} else if (mode === "dist-chunk") {
|
|
974
|
-
plugins.push(
|
|
989
|
+
plugins.push(
|
|
990
|
+
ChunkModeBuildPlugin(ctx),
|
|
991
|
+
...GlobalModeDevPlugin(ctx)
|
|
992
|
+
);
|
|
975
993
|
} else {
|
|
976
994
|
throw new Error(`[unocss] unknown mode "${mode}"`);
|
|
977
995
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/vite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.45.1",
|
|
4
4
|
"description": "The Vite plugin for UnoCSS",
|
|
5
5
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,16 +44,16 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@ampproject/remapping": "^2.2.0",
|
|
46
46
|
"@rollup/pluginutils": "^4.2.1",
|
|
47
|
-
"@unocss/config": "0.
|
|
48
|
-
"@unocss/core": "0.
|
|
49
|
-
"@unocss/inspector": "0.
|
|
50
|
-
"@unocss/scope": "0.
|
|
51
|
-
"@unocss/transformer-directives": "0.
|
|
47
|
+
"@unocss/config": "0.45.1",
|
|
48
|
+
"@unocss/core": "0.45.1",
|
|
49
|
+
"@unocss/inspector": "0.45.1",
|
|
50
|
+
"@unocss/scope": "0.45.1",
|
|
51
|
+
"@unocss/transformer-directives": "0.45.1",
|
|
52
52
|
"magic-string": "^0.26.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@unocss/shared-integration": "0.
|
|
56
|
-
"vite": "^
|
|
55
|
+
"@unocss/shared-integration": "0.45.1",
|
|
56
|
+
"vite": "^3.0.4"
|
|
57
57
|
},
|
|
58
58
|
"scripts": {
|
|
59
59
|
"build": "unbuild",
|