@unocss/postcss 66.5.10 → 66.5.12
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/esm.cjs +284 -0
- package/dist/esm.d.cts +969 -0
- package/dist/esm.d.mts +965 -17
- package/dist/esm.mjs +241 -276
- package/dist/index.d.mts +970 -23
- package/dist/index.mjs +13 -12
- package/package.json +7 -8
- package/dist/esm.d.ts +0 -21
- package/dist/index.cjs +0 -19
- package/dist/index.d.cts +0 -30
- package/dist/index.d.ts +0 -30
package/dist/esm.mjs
CHANGED
|
@@ -1,290 +1,255 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { normalize } from
|
|
3
|
-
import process from
|
|
4
|
-
import { expandVariantGroup, notNull, regexScopePlaceholder
|
|
5
|
-
import { createRecoveryConfigLoader } from
|
|
6
|
-
import { calcMaxWidthBySize,
|
|
7
|
-
import postcss from
|
|
8
|
-
import { glob } from
|
|
9
|
-
import {
|
|
1
|
+
import { readFile, stat } from "node:fs/promises";
|
|
2
|
+
import { normalize } from "node:path";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { createGenerator, expandVariantGroup, notNull, regexScopePlaceholder } from "@unocss/core";
|
|
5
|
+
import { createRecoveryConfigLoader } from "@unocss/config";
|
|
6
|
+
import { calcMaxWidthBySize, hasThemeFn, transformThemeFn } from "@unocss/rule-utils";
|
|
7
|
+
import postcss from "postcss";
|
|
8
|
+
import { glob } from "tinyglobby";
|
|
9
|
+
import { clone, generate, parse } from "css-tree";
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
];
|
|
11
|
+
//#region ../../virtual-shared/integration/src/defaults.ts
|
|
12
|
+
const defaultFilesystemGlobs = ["**/*.{html,js,ts,jsx,tsx,vue,svelte,astro,elm,php,phtml,mdx,md,marko}"];
|
|
14
13
|
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/apply.ts
|
|
15
16
|
async function parseApply(root, uno, directiveName) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const css = postcss.parse(body);
|
|
69
|
-
css.walkDecls((declaration) => {
|
|
70
|
-
declaration.source = source;
|
|
71
|
-
});
|
|
72
|
-
rule.parent.insertAfter(rule, css);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
rule.parent.after(parentAfterNodes);
|
|
76
|
-
rule.remove();
|
|
77
|
-
})());
|
|
78
|
-
});
|
|
79
|
-
await Promise.all(promises);
|
|
17
|
+
const promises = [];
|
|
18
|
+
root.walkAtRules(directiveName, (rule) => {
|
|
19
|
+
promises.push((async () => {
|
|
20
|
+
if (!rule.parent) return;
|
|
21
|
+
const source = rule.source;
|
|
22
|
+
const classNames = expandVariantGroup(rule.params).split(/\s+/g).map((className) => className.trim().replace(/\\/, ""));
|
|
23
|
+
const utils = (await Promise.all(classNames.map((i) => uno.parseToken(i, "-")))).filter(notNull).flat().sort((a, b) => a[0] - b[0]).sort((a, b) => (a[3] ? uno.parentOrders.get(a[3]) ?? 0 : 0) - (b[3] ? uno.parentOrders.get(b[3]) ?? 0 : 0)).reduce((acc, item) => {
|
|
24
|
+
const target = acc.find((i) => i[1] === item[1] && i[3] === item[3]);
|
|
25
|
+
if (target) target[2] += item[2];
|
|
26
|
+
else acc.push([...item]);
|
|
27
|
+
return acc;
|
|
28
|
+
}, []);
|
|
29
|
+
if (!utils.length) return;
|
|
30
|
+
const parentAfterNodes = [];
|
|
31
|
+
for (const i of utils) {
|
|
32
|
+
const [, _selector, body, parent] = i;
|
|
33
|
+
const selector = (_selector === null || _selector === void 0 ? void 0 : _selector.replace(regexScopePlaceholder, " ")) || _selector;
|
|
34
|
+
if (parent || selector && selector !== ".\\-" && !selector.startsWith("@property")) {
|
|
35
|
+
const node = parse(rule.parent.toString(), { context: "rule" });
|
|
36
|
+
let newSelector = generate(node.prelude);
|
|
37
|
+
if (selector && selector !== ".\\-") {
|
|
38
|
+
const selectorAST = parse(selector, { context: "selector" });
|
|
39
|
+
const prelude = clone(node.prelude);
|
|
40
|
+
prelude.children.forEach((child) => {
|
|
41
|
+
const parentSelectorAst = clone(selectorAST);
|
|
42
|
+
parentSelectorAst.children.forEach((i$1) => {
|
|
43
|
+
if (i$1.type === "ClassSelector" && i$1.name === "\\-") Object.assign(i$1, clone(child));
|
|
44
|
+
});
|
|
45
|
+
Object.assign(child, parentSelectorAst);
|
|
46
|
+
});
|
|
47
|
+
newSelector = generate(prelude);
|
|
48
|
+
}
|
|
49
|
+
let css = `${newSelector}{${body}}`;
|
|
50
|
+
if (parent) css = `${parent}{${css}}`;
|
|
51
|
+
const css_parsed = postcss.parse(css);
|
|
52
|
+
css_parsed.walkDecls((declaration) => {
|
|
53
|
+
declaration.source = source;
|
|
54
|
+
});
|
|
55
|
+
parentAfterNodes.push(...css_parsed.nodes);
|
|
56
|
+
} else {
|
|
57
|
+
const css = postcss.parse(body);
|
|
58
|
+
css.walkDecls((declaration) => {
|
|
59
|
+
declaration.source = source;
|
|
60
|
+
});
|
|
61
|
+
rule.parent.insertAfter(rule, css);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
rule.parent.after(parentAfterNodes);
|
|
65
|
+
rule.remove();
|
|
66
|
+
})());
|
|
67
|
+
});
|
|
68
|
+
await Promise.all(promises);
|
|
80
69
|
}
|
|
81
70
|
|
|
71
|
+
//#endregion
|
|
72
|
+
//#region src/screen.ts
|
|
82
73
|
async function parseScreen(root, uno, directiveName) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
74
|
+
root.walkAtRules(directiveName, async (rule) => {
|
|
75
|
+
let breakpointName = "";
|
|
76
|
+
let prefix = "";
|
|
77
|
+
if (rule.params) breakpointName = rule.params.trim();
|
|
78
|
+
if (!breakpointName) return;
|
|
79
|
+
const match = breakpointName.match(/^(?:(lt|at)-)?(\w+)$/);
|
|
80
|
+
if (match) {
|
|
81
|
+
prefix = match[1];
|
|
82
|
+
breakpointName = match[2];
|
|
83
|
+
}
|
|
84
|
+
const resolveBreakpoints = () => {
|
|
85
|
+
const key = uno.config.presets.some((p) => p.name === "@unocss/preset-wind4") ? "breakpoint" : "breakpoints";
|
|
86
|
+
const breakpoints = uno.config.theme[key];
|
|
87
|
+
return breakpoints ? Object.entries(breakpoints).sort((a, b) => Number.parseInt(a[1].replace(/[a-z]+/gi, "")) - Number.parseInt(b[1].replace(/[a-z]+/gi, ""))).map(([point, size]) => ({
|
|
88
|
+
point,
|
|
89
|
+
size
|
|
90
|
+
})) : void 0;
|
|
91
|
+
};
|
|
92
|
+
const variantEntries = (resolveBreakpoints() ?? []).map(({ point, size }, idx) => [
|
|
93
|
+
point,
|
|
94
|
+
size,
|
|
95
|
+
idx
|
|
96
|
+
]);
|
|
97
|
+
const generateMediaQuery = (breakpointName$1, prefix$1) => {
|
|
98
|
+
const [, size, idx] = variantEntries.find((i) => i[0] === breakpointName$1);
|
|
99
|
+
if (prefix$1) if (prefix$1 === "lt") return `(max-width: ${calcMaxWidthBySize(size)})`;
|
|
100
|
+
else if (prefix$1 === "at") return `(min-width: ${size})${variantEntries[idx + 1] ? ` and (max-width: ${calcMaxWidthBySize(variantEntries[idx + 1][1])})` : ""}`;
|
|
101
|
+
else throw new Error(`breakpoint variant not supported: ${prefix$1}`);
|
|
102
|
+
return `(min-width: ${size})`;
|
|
103
|
+
};
|
|
104
|
+
if (!variantEntries.find((i) => i[0] === breakpointName)) throw new Error(`breakpoint ${breakpointName} not found`);
|
|
105
|
+
rule.name = "media";
|
|
106
|
+
rule.params = `${generateMediaQuery(breakpointName, prefix)}`;
|
|
107
|
+
});
|
|
117
108
|
}
|
|
118
109
|
|
|
110
|
+
//#endregion
|
|
111
|
+
//#region src/theme.ts
|
|
119
112
|
async function parseTheme(root, uno) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
113
|
+
root.walkDecls((decl) => {
|
|
114
|
+
decl.value = transformThemeFn(decl.value, uno.config.theme);
|
|
115
|
+
});
|
|
123
116
|
}
|
|
124
117
|
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/esm.ts
|
|
125
120
|
function createPlugin(options) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
excludeLayers.push(name.slice(1));
|
|
258
|
-
}
|
|
259
|
-
} else {
|
|
260
|
-
includeLayers.push(name);
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
if (excludeLayers.length > 0 && includeLayers.length > 0) {
|
|
264
|
-
console.warn(`Warning: Mixing normal and negated layer names in "@${directiveMap.unocss} ${rule.params}" is not recommended.`);
|
|
265
|
-
}
|
|
266
|
-
let result2 = "";
|
|
267
|
-
if (includeLayers.length > 0) {
|
|
268
|
-
result2 = includeLayers.map((i) => (i === "all" ? c.getLayers() : c.getLayer(i)) || "").filter(Boolean).join("\n");
|
|
269
|
-
excludes.push(...includeLayers);
|
|
270
|
-
} else if (excludeLayers.length > 0) {
|
|
271
|
-
result2 = c.getLayers(void 0, excludeLayers) || "";
|
|
272
|
-
excludes.push(...excludeLayers);
|
|
273
|
-
}
|
|
274
|
-
const css = postcss.parse(result2);
|
|
275
|
-
css.walkDecls((declaration) => {
|
|
276
|
-
declaration.source = source;
|
|
277
|
-
});
|
|
278
|
-
rule.replaceWith(css);
|
|
279
|
-
} else {
|
|
280
|
-
const css = postcss.parse(c.getLayers(void 0, excludes) || "");
|
|
281
|
-
css.walkDecls((declaration) => {
|
|
282
|
-
declaration.source = source;
|
|
283
|
-
});
|
|
284
|
-
rule.replaceWith(css);
|
|
285
|
-
}
|
|
286
|
-
});
|
|
287
|
-
};
|
|
121
|
+
const { cwd = process.cwd(), configOrPath } = options;
|
|
122
|
+
const directiveMap = Object.assign({
|
|
123
|
+
apply: "apply",
|
|
124
|
+
theme: "theme",
|
|
125
|
+
screen: "screen",
|
|
126
|
+
unocss: "unocss"
|
|
127
|
+
}, options.directiveMap || {});
|
|
128
|
+
const fileMap = /* @__PURE__ */ new Map();
|
|
129
|
+
const fileClassMap = /* @__PURE__ */ new Map();
|
|
130
|
+
const classes = /* @__PURE__ */ new Set();
|
|
131
|
+
const targetCache = /* @__PURE__ */ new Set();
|
|
132
|
+
const loadConfig = createRecoveryConfigLoader();
|
|
133
|
+
const config = loadConfig(cwd, configOrPath);
|
|
134
|
+
let uno;
|
|
135
|
+
let promises = [];
|
|
136
|
+
let last_config_mtime = 0;
|
|
137
|
+
const targetRE = new RegExp(Object.values(directiveMap).join("|"));
|
|
138
|
+
return async function plugin(root, result) {
|
|
139
|
+
var _result$opts$from, _uno$config$content, _uno$config$content2;
|
|
140
|
+
const from = (_result$opts$from = result.opts.from) === null || _result$opts$from === void 0 ? void 0 : _result$opts$from.split("?")[0];
|
|
141
|
+
if (!from) return;
|
|
142
|
+
let isTarget = targetCache.has(from);
|
|
143
|
+
const isScanTarget = root.toString().includes(`@${directiveMap.unocss}`);
|
|
144
|
+
if (targetRE.test(root.toString())) {
|
|
145
|
+
if (!isTarget) {
|
|
146
|
+
root.walkAtRules((rule) => {
|
|
147
|
+
if (rule.name === directiveMap.unocss || rule.name === directiveMap.apply || rule.name === directiveMap.screen) isTarget = true;
|
|
148
|
+
if (isTarget) return false;
|
|
149
|
+
});
|
|
150
|
+
if (!isTarget) root.walkDecls((decl) => {
|
|
151
|
+
if (hasThemeFn(decl.value)) {
|
|
152
|
+
isTarget = true;
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
else targetCache.add(from);
|
|
157
|
+
}
|
|
158
|
+
} else if (targetCache.has(from)) targetCache.delete(from);
|
|
159
|
+
if (!isTarget) return;
|
|
160
|
+
try {
|
|
161
|
+
const cfg = await config;
|
|
162
|
+
if (!uno) uno = await createGenerator(cfg.config);
|
|
163
|
+
else if (cfg.sources.length) {
|
|
164
|
+
const config_mtime = (await stat(cfg.sources[0])).mtimeMs;
|
|
165
|
+
if (config_mtime > last_config_mtime) {
|
|
166
|
+
uno = await createGenerator((await loadConfig()).config);
|
|
167
|
+
last_config_mtime = config_mtime;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
} catch (error) {
|
|
171
|
+
throw new Error(`UnoCSS config not found: ${error.message}`);
|
|
172
|
+
}
|
|
173
|
+
const globs = ((_uno$config$content = uno.config.content) === null || _uno$config$content === void 0 ? void 0 : _uno$config$content.filesystem) ?? defaultFilesystemGlobs;
|
|
174
|
+
const needCheckNodeMoudules = globs.some((i) => i.includes("node_modules"));
|
|
175
|
+
const plainContent = ((_uno$config$content2 = uno.config.content) === null || _uno$config$content2 === void 0 ? void 0 : _uno$config$content2.inline) ?? [];
|
|
176
|
+
const entries = await glob(isScanTarget ? globs : [from], {
|
|
177
|
+
cwd,
|
|
178
|
+
absolute: true,
|
|
179
|
+
ignore: needCheckNodeMoudules ? void 0 : ["**/node_modules/**"],
|
|
180
|
+
expandDirectories: false
|
|
181
|
+
});
|
|
182
|
+
await parseApply(root, uno, directiveMap.apply);
|
|
183
|
+
await parseTheme(root, uno);
|
|
184
|
+
await parseScreen(root, uno, directiveMap.screen);
|
|
185
|
+
promises.push(...plainContent.map(async (c$1, idx) => {
|
|
186
|
+
if (typeof c$1 === "function") c$1 = await c$1();
|
|
187
|
+
if (typeof c$1 === "string") c$1 = { code: c$1 };
|
|
188
|
+
const { matched } = await uno.generate(c$1.code, { id: c$1.id ?? `__plain_content_${idx}__` });
|
|
189
|
+
for (const candidate of matched) classes.add(candidate);
|
|
190
|
+
}));
|
|
191
|
+
await Promise.all(promises);
|
|
192
|
+
promises = [];
|
|
193
|
+
const BATCH_SIZE = 500;
|
|
194
|
+
for (let i = 0; i < entries.length; i += BATCH_SIZE) {
|
|
195
|
+
const batch = entries.slice(i, i + BATCH_SIZE);
|
|
196
|
+
promises.push(...batch.map(async (file) => {
|
|
197
|
+
result.messages.push({
|
|
198
|
+
type: "dependency",
|
|
199
|
+
plugin: directiveMap.unocss,
|
|
200
|
+
file: normalize(file),
|
|
201
|
+
parent: from
|
|
202
|
+
});
|
|
203
|
+
const { mtimeMs } = await stat(file);
|
|
204
|
+
if (fileMap.has(file) && mtimeMs <= fileMap.get(file)) return;
|
|
205
|
+
fileMap.set(file, mtimeMs);
|
|
206
|
+
const content = await readFile(file, "utf8");
|
|
207
|
+
const { matched } = await uno.generate(content, { id: file });
|
|
208
|
+
fileClassMap.set(file, matched);
|
|
209
|
+
}));
|
|
210
|
+
await Promise.all(promises);
|
|
211
|
+
promises = [];
|
|
212
|
+
}
|
|
213
|
+
for (const set of fileClassMap.values()) for (const candidate of set) classes.add(candidate);
|
|
214
|
+
const c = await uno.generate(classes);
|
|
215
|
+
classes.clear();
|
|
216
|
+
const excludes = [];
|
|
217
|
+
root.walkAtRules(directiveMap.unocss, (rule) => {
|
|
218
|
+
const source = rule.source;
|
|
219
|
+
if (rule.params) {
|
|
220
|
+
const excludeLayers = [];
|
|
221
|
+
const includeLayers = [];
|
|
222
|
+
for (const layer of rule.params.split(",")) {
|
|
223
|
+
const name = layer.trim();
|
|
224
|
+
if (!name) continue;
|
|
225
|
+
if (name.startsWith("!")) {
|
|
226
|
+
if (name.slice(1)) excludeLayers.push(name.slice(1));
|
|
227
|
+
} else includeLayers.push(name);
|
|
228
|
+
}
|
|
229
|
+
if (excludeLayers.length > 0 && includeLayers.length > 0) console.warn(`Warning: Mixing normal and negated layer names in "@${directiveMap.unocss} ${rule.params}" is not recommended.`);
|
|
230
|
+
let result$1 = "";
|
|
231
|
+
if (includeLayers.length > 0) {
|
|
232
|
+
result$1 = includeLayers.map((i) => (i === "all" ? c.getLayers() : c.getLayer(i)) || "").filter(Boolean).join("\n");
|
|
233
|
+
excludes.push(...includeLayers);
|
|
234
|
+
} else if (excludeLayers.length > 0) {
|
|
235
|
+
result$1 = c.getLayers(void 0, excludeLayers) || "";
|
|
236
|
+
excludes.push(...excludeLayers);
|
|
237
|
+
}
|
|
238
|
+
const css = postcss.parse(result$1);
|
|
239
|
+
css.walkDecls((declaration) => {
|
|
240
|
+
declaration.source = source;
|
|
241
|
+
});
|
|
242
|
+
rule.replaceWith(css);
|
|
243
|
+
} else {
|
|
244
|
+
const css = postcss.parse(c.getLayers(void 0, excludes) || "");
|
|
245
|
+
css.walkDecls((declaration) => {
|
|
246
|
+
declaration.source = source;
|
|
247
|
+
});
|
|
248
|
+
rule.replaceWith(css);
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
};
|
|
288
252
|
}
|
|
289
253
|
|
|
290
|
-
|
|
254
|
+
//#endregion
|
|
255
|
+
export { createPlugin };
|