@unocss/webpack 66.7.2-beta.1 → 66.7.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.
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_unplugin = require("./unplugin-
|
|
5
|
+
const require_unplugin = require("./unplugin-CxzwqVxh.cjs");
|
|
6
6
|
//#region src/index.ts
|
|
7
7
|
function WebpackPlugin(configOrPath, defaults) {
|
|
8
8
|
return require_unplugin.unplugin(configOrPath, defaults).webpack();
|
package/dist/index.mjs
CHANGED
package/dist/rspack.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_unplugin = require("./unplugin-
|
|
2
|
+
const require_unplugin = require("./unplugin-CxzwqVxh.cjs");
|
|
3
3
|
//#region src/rspack.ts
|
|
4
4
|
function UnoCSSRspackPlugin(configOrPath, defaults) {
|
|
5
5
|
return require_unplugin.unplugin(configOrPath, defaults).rspack();
|
package/dist/rspack.mjs
CHANGED
|
@@ -48,18 +48,39 @@ function restoreSkipCode(code, map) {
|
|
|
48
48
|
}
|
|
49
49
|
//#endregion
|
|
50
50
|
//#region ../../virtual-shared/integration/src/transformers.ts
|
|
51
|
+
const transformerCache = /* @__PURE__ */ new WeakMap();
|
|
52
|
+
function getTransformers(ctx, enforce) {
|
|
53
|
+
const configured = ctx.uno.config.transformers;
|
|
54
|
+
if (!configured?.length) return;
|
|
55
|
+
let grouped = transformerCache.get(configured);
|
|
56
|
+
if (!grouped) {
|
|
57
|
+
grouped = {
|
|
58
|
+
pre: [],
|
|
59
|
+
default: [],
|
|
60
|
+
post: []
|
|
61
|
+
};
|
|
62
|
+
for (const transformer of configured) grouped[transformer.enforce || "default"].push(transformer);
|
|
63
|
+
transformerCache.set(configured, grouped);
|
|
64
|
+
}
|
|
65
|
+
return grouped[enforce];
|
|
66
|
+
}
|
|
51
67
|
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
52
68
|
if (original.includes("@unocss-ignore")) return;
|
|
53
|
-
const transformers = (ctx
|
|
54
|
-
if (!transformers
|
|
55
|
-
const skipMap = /* @__PURE__ */ new Map();
|
|
69
|
+
const transformers = getTransformers(ctx, enforce);
|
|
70
|
+
if (!transformers?.length) return;
|
|
56
71
|
let code = original;
|
|
57
|
-
let
|
|
72
|
+
let skipMap;
|
|
73
|
+
let s;
|
|
58
74
|
const maps = [];
|
|
59
75
|
for (const t of transformers) {
|
|
60
76
|
if (t.idFilter) {
|
|
61
77
|
if (!t.idFilter(id)) continue;
|
|
62
78
|
} else if (!ctx.filter(code, id)) continue;
|
|
79
|
+
if (t.codeFilter && !t.codeFilter(code, id)) continue;
|
|
80
|
+
if (!s) {
|
|
81
|
+
skipMap = /* @__PURE__ */ new Map();
|
|
82
|
+
s = new MagicString(transformSkipCode(code, skipMap, SKIP_COMMENT_RE, "@unocss-skip-placeholder-"));
|
|
83
|
+
}
|
|
63
84
|
await t.transform(s, id, ctx);
|
|
64
85
|
if (s.hasChanged()) {
|
|
65
86
|
code = restoreSkipCode(s.toString(), skipMap);
|
|
@@ -115,7 +136,8 @@ async function setupContentExtractor(ctx, shouldWatch = false) {
|
|
|
115
136
|
}
|
|
116
137
|
});
|
|
117
138
|
}
|
|
118
|
-
|
|
139
|
+
const BATCH_SIZE = 50;
|
|
140
|
+
for (let i = 0; i < files.length; i += BATCH_SIZE) await Promise.all(files.slice(i, i + BATCH_SIZE).map(extractFile));
|
|
119
141
|
}
|
|
120
142
|
}
|
|
121
143
|
//#endregion
|
|
@@ -76,18 +76,39 @@ function restoreSkipCode(code, map) {
|
|
|
76
76
|
}
|
|
77
77
|
//#endregion
|
|
78
78
|
//#region ../../virtual-shared/integration/src/transformers.ts
|
|
79
|
+
const transformerCache = /* @__PURE__ */ new WeakMap();
|
|
80
|
+
function getTransformers(ctx, enforce) {
|
|
81
|
+
const configured = ctx.uno.config.transformers;
|
|
82
|
+
if (!configured?.length) return;
|
|
83
|
+
let grouped = transformerCache.get(configured);
|
|
84
|
+
if (!grouped) {
|
|
85
|
+
grouped = {
|
|
86
|
+
pre: [],
|
|
87
|
+
default: [],
|
|
88
|
+
post: []
|
|
89
|
+
};
|
|
90
|
+
for (const transformer of configured) grouped[transformer.enforce || "default"].push(transformer);
|
|
91
|
+
transformerCache.set(configured, grouped);
|
|
92
|
+
}
|
|
93
|
+
return grouped[enforce];
|
|
94
|
+
}
|
|
79
95
|
async function applyTransformers(ctx, original, id, enforce = "default") {
|
|
80
96
|
if (original.includes("@unocss-ignore")) return;
|
|
81
|
-
const transformers = (ctx
|
|
82
|
-
if (!transformers
|
|
83
|
-
const skipMap = /* @__PURE__ */ new Map();
|
|
97
|
+
const transformers = getTransformers(ctx, enforce);
|
|
98
|
+
if (!transformers?.length) return;
|
|
84
99
|
let code = original;
|
|
85
|
-
let
|
|
100
|
+
let skipMap;
|
|
101
|
+
let s;
|
|
86
102
|
const maps = [];
|
|
87
103
|
for (const t of transformers) {
|
|
88
104
|
if (t.idFilter) {
|
|
89
105
|
if (!t.idFilter(id)) continue;
|
|
90
106
|
} else if (!ctx.filter(code, id)) continue;
|
|
107
|
+
if (t.codeFilter && !t.codeFilter(code, id)) continue;
|
|
108
|
+
if (!s) {
|
|
109
|
+
skipMap = /* @__PURE__ */ new Map();
|
|
110
|
+
s = new magic_string.default(transformSkipCode(code, skipMap, SKIP_COMMENT_RE, "@unocss-skip-placeholder-"));
|
|
111
|
+
}
|
|
91
112
|
await t.transform(s, id, ctx);
|
|
92
113
|
if (s.hasChanged()) {
|
|
93
114
|
code = restoreSkipCode(s.toString(), skipMap);
|
|
@@ -143,7 +164,8 @@ async function setupContentExtractor(ctx, shouldWatch = false) {
|
|
|
143
164
|
}
|
|
144
165
|
});
|
|
145
166
|
}
|
|
146
|
-
|
|
167
|
+
const BATCH_SIZE = 50;
|
|
168
|
+
for (let i = 0; i < files.length; i += BATCH_SIZE) await Promise.all(files.slice(i, i + BATCH_SIZE).map(extractFile));
|
|
147
169
|
}
|
|
148
170
|
}
|
|
149
171
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unocss/webpack",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "66.7.
|
|
4
|
+
"version": "66.7.3",
|
|
5
5
|
"description": "The Webpack plugin for UnoCSS",
|
|
6
6
|
"author": "Anthony Fu <anthonyfu117@hotmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -53,12 +53,12 @@
|
|
|
53
53
|
"chokidar": "^5.0.0",
|
|
54
54
|
"magic-string": "^0.30.21",
|
|
55
55
|
"pathe": "^2.0.3",
|
|
56
|
-
"tinyglobby": "^0.2.
|
|
57
|
-
"unplugin": "^3.
|
|
56
|
+
"tinyglobby": "^0.2.17",
|
|
57
|
+
"unplugin": "^3.2.0",
|
|
58
58
|
"unplugin-utils": "^0.3.1",
|
|
59
|
-
"webpack-sources": "^3.
|
|
60
|
-
"@unocss/config": "66.7.
|
|
61
|
-
"@unocss/core": "66.7.
|
|
59
|
+
"webpack-sources": "^3.5.0",
|
|
60
|
+
"@unocss/config": "66.7.3",
|
|
61
|
+
"@unocss/core": "66.7.3"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"webpack": "^5.106.2"
|