weapp-tailwindcss 5.2.14 → 5.3.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/README.md +55 -8
- package/README.zh-CN.md +64 -0
- package/dist/bundlers/rspack/rule-match.d.ts +13 -0
- package/dist/bundlers/shared/generator-css/types.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +7 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-plugin-order.d.ts +2 -0
- package/dist/{transform-52FLRu-0.js → component-local-style-C2wC8o9F.js} +23 -174
- package/dist/{transform-BiHG42Rp.cjs → component-local-style-CNhEhd2B.cjs} +34 -168
- package/dist/{context-vWlNv-Cf.cjs → context-CB4Ef9U0.cjs} +4 -4
- package/dist/{context-CKQKq4Mv.js → context-Kvr3lLEC.js} +2 -2
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/generator/index.d.ts +2 -2
- package/dist/{generator-BXrWA7Sj.cjs → generator-DKiYbTFR.cjs} +11 -1
- package/dist/{generator-BP4WmgIo.js → generator-EnTXLBlK.js} +1 -1
- package/dist/generator.cjs +8 -1
- package/dist/generator.js +2 -2
- package/dist/{gulp-DzIR7eO3.cjs → gulp-QJ_oz-06.cjs} +7 -7
- package/dist/{gulp-DG6cWPF4.js → gulp-vz36-uQP.js} +4 -4
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-CoyM6Dg2.js → hmr-timing-HGlM4hX3.js} +9 -11
- package/dist/{hmr-timing-BIPr9t9m.cjs → hmr-timing-W3kro20F.cjs} +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{options-DbYws6lr.cjs → options-CKZW99r4.cjs} +1 -1
- package/dist/{pipeline-helpers-Bp343-ik.cjs → pipeline-helpers-t95KPu4O.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +1 -1
- package/dist/rspack.cjs +124 -7
- package/dist/rspack.js +124 -7
- package/dist/{source-candidate-scan-signature-BLXoEZN5.js → source-candidate-scan-signature-BHCPQVoD.js} +3 -3
- package/dist/{source-candidate-scan-signature-J9EW91KX.cjs → source-candidate-scan-signature-BSad7bMQ.cjs} +3 -3
- package/dist/{style-options-Cta1OP3i.cjs → style-options-PCgz2ywM.cjs} +2 -2
- package/dist/tailwindcss/candidates.d.ts +2 -2
- package/dist/{tailwindcss-C2K-vjJv.js → tailwindcss-BSEdWieh.js} +1 -1
- package/dist/{tailwindcss-D1M2xj5O.cjs → tailwindcss-jKzY37Sk.cjs} +2 -2
- package/dist/transform-CgohToUV.cjs +200 -0
- package/dist/transform-DSRPiBWz.js +201 -0
- package/dist/uni-app-x/component-local-style.d.ts +3 -1
- package/dist/uni-app-x/transform.d.ts +2 -0
- package/dist/uni-app-x/vite/style-request.d.ts +1 -0
- package/dist/uni-app-x/vite/web-local-style.d.ts +6 -0
- package/dist/{v4-generation-core-CCnEsAgV.cjs → v4-generation-core-BfeXEc6R.cjs} +9 -11
- package/dist/{vite-DNTQV3gN.js → vite-Crz1mQR4.js} +186 -66
- package/dist/{vite-RJpkDte7.cjs → vite-CtmGLZXy.cjs} +189 -69
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +28 -10
- package/dist/{webpack-BY5y7f0X.cjs → webpack-Cf5RnhXt.cjs} +9 -9
- package/dist/{webpack-DYoIysDo.js → webpack-DwtdWqwr.js} +6 -6
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +9 -14
- package/README.en.md +0 -17
- package/bin/weapp-tailwindcss.cjs +0 -8
- package/dist/cli/context.d.ts +0 -3
- package/dist/cli/doctor/constants.d.ts +0 -7
- package/dist/cli/doctor/types.d.ts +0 -31
- package/dist/cli/doctor.d.ts +0 -4
- package/dist/cli/helpers/options/format.d.ts +0 -2
- package/dist/cli/helpers/options/parse.d.ts +0 -3
- package/dist/cli/helpers/options/resolve.d.ts +0 -1
- package/dist/cli/helpers/options.d.ts +0 -3
- package/dist/cli/helpers.d.ts +0 -4
- package/dist/cli/mount-options.d.ts +0 -4
- package/dist/cli/types.d.ts +0 -15
- package/dist/cli/vscode-entry.d.ts +0 -14
- package/dist/cli.cjs +0 -37065
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -2298
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import { n as generateCode, p as replaceWxml, r as createAttributeMatcher } from "./wxml-B7OAVpXJ.js";
|
|
2
|
+
import { n as shouldEnableComponentLocalStyle, r as shouldEnablePageLocalStyle, t as UniAppXComponentLocalStyleCollector } from "./component-local-style-C2wC8o9F.js";
|
|
3
|
+
import MagicString from "magic-string";
|
|
4
|
+
import { NodeTypes, parse } from "@vue/compiler-dom";
|
|
5
|
+
//#region src/uni-app-x/transform.ts
|
|
6
|
+
function traverse(node, visitor) {
|
|
7
|
+
visitor(node);
|
|
8
|
+
if (Array.isArray(node.children)) {
|
|
9
|
+
for (const child of node.children) if (child && typeof child === "object" && "type" in child) traverse(child, visitor);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function updateStaticAttribute(ms, prop, offset, content = prop.value?.content) {
|
|
13
|
+
if (!prop.value) return;
|
|
14
|
+
const start = offset + prop.value.loc.start.offset + 1;
|
|
15
|
+
const end = offset + prop.value.loc.end.offset - 1;
|
|
16
|
+
if (start < end) ms.update(start, end, replaceWxml(content ?? ""));
|
|
17
|
+
}
|
|
18
|
+
function updateStaticAttributeWithLocalStyle(ms, prop, offset, collector, deep, content = prop.value?.content) {
|
|
19
|
+
if (!prop.value) return;
|
|
20
|
+
const start = offset + prop.value.loc.start.offset + 1;
|
|
21
|
+
const end = offset + prop.value.loc.end.offset - 1;
|
|
22
|
+
if (start < end) ms.update(start, end, collector.collectAndRewriteStaticClass(content ?? "", { deep }));
|
|
23
|
+
}
|
|
24
|
+
function updateDirectiveExpression(ms, prop, offset, jsHandler, runtimeSet) {
|
|
25
|
+
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION) return;
|
|
26
|
+
const expression = prop.exp.content;
|
|
27
|
+
const start = offset + prop.exp.loc.start.offset;
|
|
28
|
+
const end = offset + prop.exp.loc.end.offset;
|
|
29
|
+
if (start >= end) return;
|
|
30
|
+
const generated = generateCode(expression, {
|
|
31
|
+
jsHandler,
|
|
32
|
+
runtimeSet,
|
|
33
|
+
wrapExpression: true
|
|
34
|
+
});
|
|
35
|
+
ms.update(start, end, generated);
|
|
36
|
+
}
|
|
37
|
+
function updateDirectiveExpressionWithLocalStyle(ms, prop, offset, jsHandler, collector, deep, runtimeSet) {
|
|
38
|
+
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION) return;
|
|
39
|
+
const expression = prop.exp.content;
|
|
40
|
+
const start = offset + prop.exp.loc.start.offset;
|
|
41
|
+
const end = offset + prop.exp.loc.end.offset;
|
|
42
|
+
if (start >= end) return;
|
|
43
|
+
collector.collectRuntimeClasses(expression, {
|
|
44
|
+
deep,
|
|
45
|
+
wrapExpression: true
|
|
46
|
+
});
|
|
47
|
+
const generated = generateCode(expression, {
|
|
48
|
+
jsHandler,
|
|
49
|
+
runtimeSet,
|
|
50
|
+
wrapExpression: true
|
|
51
|
+
});
|
|
52
|
+
ms.update(start, end, collector.rewriteTransformedCode(generated, { wrapExpression: true }));
|
|
53
|
+
}
|
|
54
|
+
function shouldEnableLocalStyle(id, options) {
|
|
55
|
+
if (options.enableComponentLocalStyle && shouldEnableComponentLocalStyle(id)) return true;
|
|
56
|
+
if (options.enablePageLocalStyle && shouldEnablePageLocalStyle(id)) return true;
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute) {
|
|
60
|
+
const lowerName = attrName.toLowerCase();
|
|
61
|
+
const shouldHandleDefault = !disabledDefaultTemplateHandler && lowerName === "class";
|
|
62
|
+
const shouldHandleCustom = matchCustomAttribute?.(tag, attrName) ?? false;
|
|
63
|
+
return {
|
|
64
|
+
shouldHandleDefault,
|
|
65
|
+
shouldHandleCustom,
|
|
66
|
+
shouldHandle: shouldHandleDefault || shouldHandleCustom
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const defaultCreateJsHandlerOptions = { babelParserOptions: { plugins: ["typescript"] } };
|
|
70
|
+
const UVUE_NVUE_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
71
|
+
const SFC_BLOCK_RE = /<(template|script|style)\b([^>]*)>/gi;
|
|
72
|
+
const SCRIPT_SETUP_RE = /(?:^|\s)setup(?:\s|=|$)/;
|
|
73
|
+
const STYLE_SCOPED_RE = /(?:^|\s)scoped(?:\s|=|$)/i;
|
|
74
|
+
function findSfcBlockEnd(code, type, contentStart) {
|
|
75
|
+
const closeTag = new RegExp(`<\\/${type}\\s*>`, "gi");
|
|
76
|
+
if (type !== "template") {
|
|
77
|
+
const match = closeTag.exec(code.slice(contentStart));
|
|
78
|
+
return match ? {
|
|
79
|
+
blockEnd: contentStart + match.index + match[0].length,
|
|
80
|
+
contentEnd: contentStart + match.index
|
|
81
|
+
} : void 0;
|
|
82
|
+
}
|
|
83
|
+
const tag = new RegExp(`<\\/?${type}\\b[^>]*>`, "gi");
|
|
84
|
+
tag.lastIndex = contentStart;
|
|
85
|
+
let depth = 1;
|
|
86
|
+
let match = tag.exec(code);
|
|
87
|
+
while (match) {
|
|
88
|
+
if (match[0].startsWith("</")) depth -= 1;
|
|
89
|
+
else if (!match[0].trimEnd().endsWith("/>")) depth += 1;
|
|
90
|
+
if (depth === 0) return {
|
|
91
|
+
blockEnd: tag.lastIndex,
|
|
92
|
+
contentEnd: match.index
|
|
93
|
+
};
|
|
94
|
+
match = tag.exec(code);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function parseSfc(code) {
|
|
98
|
+
const descriptor = {
|
|
99
|
+
errors: [],
|
|
100
|
+
styles: []
|
|
101
|
+
};
|
|
102
|
+
for (const match of code.matchAll(SFC_BLOCK_RE)) {
|
|
103
|
+
const type = match[1];
|
|
104
|
+
const attrs = match[2] ?? "";
|
|
105
|
+
const contentStart = (match.index ?? 0) + match[0].length;
|
|
106
|
+
const blockBoundary = findSfcBlockEnd(code, type, contentStart);
|
|
107
|
+
if (!blockBoundary) {
|
|
108
|
+
descriptor.errors.push(/* @__PURE__ */ new Error(`未闭合的 ${type} SFC 块`));
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const { contentEnd } = blockBoundary;
|
|
112
|
+
const content = code.slice(contentStart, contentEnd);
|
|
113
|
+
const block = {
|
|
114
|
+
content,
|
|
115
|
+
start: contentStart,
|
|
116
|
+
end: contentEnd,
|
|
117
|
+
attrs
|
|
118
|
+
};
|
|
119
|
+
if (type === "template" && !descriptor.template) {
|
|
120
|
+
try {
|
|
121
|
+
descriptor.template = {
|
|
122
|
+
...block,
|
|
123
|
+
ast: parse(content)
|
|
124
|
+
};
|
|
125
|
+
} catch (error) {
|
|
126
|
+
descriptor.errors.push(error);
|
|
127
|
+
descriptor.template = block;
|
|
128
|
+
}
|
|
129
|
+
continue;
|
|
130
|
+
}
|
|
131
|
+
if (type === "script") {
|
|
132
|
+
if (SCRIPT_SETUP_RE.test(attrs)) descriptor.scriptSetup ?? (descriptor.scriptSetup = block);
|
|
133
|
+
else descriptor.script ?? (descriptor.script = block);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
if (type === "style") descriptor.styles.push(block);
|
|
137
|
+
}
|
|
138
|
+
return descriptor;
|
|
139
|
+
}
|
|
140
|
+
function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
141
|
+
if (!UVUE_NVUE_RE.test(id)) return;
|
|
142
|
+
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
143
|
+
const matchCustomAttribute = createAttributeMatcher(customAttributesEntities);
|
|
144
|
+
const ms = new MagicString(code);
|
|
145
|
+
const descriptor = parseSfc(code);
|
|
146
|
+
const localStyleCollector = shouldEnableLocalStyle(id, options) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
|
|
147
|
+
if (descriptor.errors.length === 0) {
|
|
148
|
+
if (descriptor.template?.ast) {
|
|
149
|
+
const templateOffset = descriptor.template.start;
|
|
150
|
+
traverse(descriptor.template.ast, (node) => {
|
|
151
|
+
if (node.type !== NodeTypes.ELEMENT) return;
|
|
152
|
+
const tag = node.tag;
|
|
153
|
+
for (const prop of node.props) if (prop.type === NodeTypes.ATTRIBUTE) {
|
|
154
|
+
const { shouldHandle, shouldHandleCustom, shouldHandleDefault } = shouldHandleAttribute(tag, prop.name, disabledDefaultTemplateHandler, matchCustomAttribute);
|
|
155
|
+
if (!shouldHandle) continue;
|
|
156
|
+
if (localStyleCollector) updateStaticAttributeWithLocalStyle(ms, prop, templateOffset, localStyleCollector, options.webCustomAttributeDeep === true && shouldHandleCustom);
|
|
157
|
+
else updateStaticAttribute(ms, prop, templateOffset);
|
|
158
|
+
if (shouldHandleDefault) continue;
|
|
159
|
+
} else if (prop.type === NodeTypes.DIRECTIVE && prop.name === "bind" && prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.isStatic) {
|
|
160
|
+
const attrName = prop.arg.content;
|
|
161
|
+
const { shouldHandle, shouldHandleCustom } = shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, matchCustomAttribute);
|
|
162
|
+
if (!shouldHandle) continue;
|
|
163
|
+
if (localStyleCollector) updateDirectiveExpressionWithLocalStyle(ms, prop, templateOffset, jsHandler, localStyleCollector, options.webCustomAttributeDeep === true && shouldHandleCustom, runtimeSet);
|
|
164
|
+
else updateDirectiveExpression(ms, prop, templateOffset, jsHandler, runtimeSet);
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
if (descriptor.script) {
|
|
169
|
+
localStyleCollector?.collectRuntimeClasses(descriptor.script.content);
|
|
170
|
+
const { code } = jsHandler(descriptor.script.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
171
|
+
ms.update(descriptor.script.start, descriptor.script.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
172
|
+
}
|
|
173
|
+
if (descriptor.scriptSetup) {
|
|
174
|
+
localStyleCollector?.collectRuntimeClasses(descriptor.scriptSetup.content);
|
|
175
|
+
const { code } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
176
|
+
ms.update(descriptor.scriptSetup.start, descriptor.scriptSetup.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
177
|
+
}
|
|
178
|
+
if (localStyleCollector?.hasStyles()) {
|
|
179
|
+
const scopedStyle = descriptor.styles.findLast((style) => STYLE_SCOPED_RE.test(style.attrs));
|
|
180
|
+
if (scopedStyle && options.onWebLocalStyleRules) options.onWebLocalStyleRules(localStyleCollector.toStyleRules());
|
|
181
|
+
else if (scopedStyle) {
|
|
182
|
+
const separator = scopedStyle.content.endsWith("\n") ? "" : "\n";
|
|
183
|
+
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules()}`);
|
|
184
|
+
} else ms.append(`\n${localStyleCollector.toStyleBlock()}`);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
const result = {
|
|
188
|
+
code: ms.toString(),
|
|
189
|
+
map: null
|
|
190
|
+
};
|
|
191
|
+
Object.defineProperty(result, "map", {
|
|
192
|
+
configurable: true,
|
|
193
|
+
enumerable: true,
|
|
194
|
+
get() {
|
|
195
|
+
return ms.generateMap();
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
return result;
|
|
199
|
+
}
|
|
200
|
+
//#endregion
|
|
201
|
+
export { transformUVue };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
interface RewriteCodeOptions {
|
|
2
|
+
deep?: boolean;
|
|
2
3
|
wrapExpression?: boolean;
|
|
3
4
|
}
|
|
4
5
|
export declare function hasTopLevelVariant(candidate: string): boolean;
|
|
@@ -10,10 +11,11 @@ export declare class UniAppXComponentLocalStyleCollector {
|
|
|
10
11
|
private aliasByUtility;
|
|
11
12
|
private aliasByLookup;
|
|
12
13
|
private classBindingNames;
|
|
14
|
+
private deepUtilities;
|
|
13
15
|
constructor(fileId: string, runtimeSet?: Set<string> | undefined);
|
|
14
16
|
private ensureAlias;
|
|
15
17
|
private rewriteLiteral;
|
|
16
|
-
collectAndRewriteStaticClass(literal: string): string;
|
|
18
|
+
collectAndRewriteStaticClass(literal: string, options?: RewriteCodeOptions): string;
|
|
17
19
|
collectRuntimeClasses(rawSource: string, options?: RewriteCodeOptions): void;
|
|
18
20
|
rewriteTransformedCode(rawSource: string, options?: RewriteCodeOptions): string;
|
|
19
21
|
hasStyles(): boolean;
|
|
@@ -5,6 +5,8 @@ interface TransformUVueOptions {
|
|
|
5
5
|
disabledDefaultTemplateHandler?: boolean;
|
|
6
6
|
enableComponentLocalStyle?: boolean;
|
|
7
7
|
enablePageLocalStyle?: boolean;
|
|
8
|
+
webCustomAttributeDeep?: boolean;
|
|
9
|
+
onWebLocalStyleRules?: (rules: string) => void;
|
|
8
10
|
}
|
|
9
11
|
export declare function transformUVue(code: string, id: string, jsHandler: JsHandler, runtimeSet?: Set<string>, options?: TransformUVueOptions): undefined | TransformResult;
|
|
10
12
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare function isPreprocessorRequest(id: string, lang?: string): boolean;
|
|
2
2
|
export declare function resolveUniAppXCssTarget(id: string): "uvue" | undefined;
|
|
3
3
|
export declare function isCssModuleExport(code: string): boolean;
|
|
4
|
+
export declare function normalizeRelativeTailwindReferences(code: string, id: string): string;
|
|
4
5
|
interface ResolvePreprocessorTransformOptions {
|
|
5
6
|
isIosPlatform: boolean;
|
|
6
7
|
isNativeAppStyleTarget: boolean;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { HmrContext, ModuleNode } from 'vite';
|
|
2
|
+
export declare function createUniAppXWebLocalStyleBridge(isEnabled: () => boolean): {
|
|
3
|
+
appendToStyle(code: string, id: string): string;
|
|
4
|
+
handleHotUpdate(ctx: HmrContext): ModuleNode[] | undefined;
|
|
5
|
+
remember(id: string, rules: string): void;
|
|
6
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-DKiYbTFR.cjs");
|
|
3
3
|
require("./auto-DtU6f3X6.cjs");
|
|
4
4
|
const require_object = require("./object-DbHtAXRk.cjs");
|
|
5
|
-
const require_options = require("./options-
|
|
5
|
+
const require_options = require("./options-CKZW99r4.cjs");
|
|
6
6
|
const require_wxml = require("./wxml-CQmBCjOR.cjs");
|
|
7
|
-
const require_style_options = require("./style-options-
|
|
7
|
+
const require_style_options = require("./style-options-PCgz2ywM.cjs");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
let node_path = require("node:path");
|
|
10
10
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -4848,9 +4848,9 @@ function resolveCompilationDependencies(dependencies) {
|
|
|
4848
4848
|
}));
|
|
4849
4849
|
}
|
|
4850
4850
|
async function executeGeneratorPipeline(context) {
|
|
4851
|
-
return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context));
|
|
4851
|
+
return runCompilerOwnerActivity(context.runtimeState, () => executeGeneratorPipelineWithOwner(context, getCompilationSessionPool(context.runtimeState), getTailwindGenerationSessionPool(context.runtimeState)));
|
|
4852
4852
|
}
|
|
4853
|
-
async function executeGeneratorPipelineWithOwner(context) {
|
|
4853
|
+
async function executeGeneratorPipelineWithOwner(context, compilationPool, generationSession) {
|
|
4854
4854
|
const { cssHandlerOptions, debug, file, generatorBranch, generatorOptions, generatorRawSource, getSourceCandidatesForEntries, hasGeneratedCss, hasGeneratedMarkers, localImports, majorVersion, normalizeGeneratorSource, normalizedCssSources, options, opts, runtime, runtimeState, useMiniProgramCssBranch } = context;
|
|
4855
4855
|
await runtimeState.readyPromise;
|
|
4856
4856
|
const currentCssCandidates = collectGeneratorCssCandidates(generatorRawSource);
|
|
@@ -4873,7 +4873,6 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4873
4873
|
const generatorStyleOptions = resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorOptions.styleOptions);
|
|
4874
4874
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(generatorSourceRecords.map((record) => record.source));
|
|
4875
4875
|
const sourceConcurrency = resolveGeneratorSourceConcurrency();
|
|
4876
|
-
const generationSession = getTailwindGenerationSessionPool(runtimeState);
|
|
4877
4876
|
const preparedGenerationInputs = (await runWithConcurrency(generatorSourceRecords.map((record, index) => async () => {
|
|
4878
4877
|
const { metadata: sourceMetadata, source } = record;
|
|
4879
4878
|
const sourceCss = options.deferCssAdaptation ? (0, _weapp_tailwindcss_postcss.removeMatchingLocalCssImports)(source.css, localImports) : source.css;
|
|
@@ -4921,7 +4920,7 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4921
4920
|
generated: await generationSession.generate(input.generatorSource, {
|
|
4922
4921
|
bareArbitraryValues: generatorOptions.bareArbitraryValues,
|
|
4923
4922
|
candidates: currentCandidates,
|
|
4924
|
-
incrementalCache: true,
|
|
4923
|
+
incrementalCache: options.incrementalCache ?? true,
|
|
4925
4924
|
scanSources: options.disableSourceScan === true ? false : shouldScanTailwindV4Sources(majorVersion, generatorOptions.target, currentCandidates, input.isolateCssSource),
|
|
4926
4925
|
styleOptions: generatorStyleOptions,
|
|
4927
4926
|
target: generatorOptions.target
|
|
@@ -4933,7 +4932,7 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4933
4932
|
let compilationRevision;
|
|
4934
4933
|
let generated;
|
|
4935
4934
|
if (options.compilation?.enabled) {
|
|
4936
|
-
const execution = await
|
|
4935
|
+
const execution = await compilationPool.run({
|
|
4937
4936
|
scope: options.compilation.scope,
|
|
4938
4937
|
outputId: options.outputFile ?? file,
|
|
4939
4938
|
changes: options.compilation.changes,
|
|
@@ -5189,9 +5188,9 @@ async function generateCssByGenerator(options) {
|
|
|
5189
5188
|
//#endregion
|
|
5190
5189
|
//#region src/bundlers/shared/generator-css/validate.ts
|
|
5191
5190
|
async function validateCandidatesByGenerator(options) {
|
|
5192
|
-
return runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options));
|
|
5191
|
+
return runCompilerOwnerActivity(options.runtimeState, () => validateCandidatesByGeneratorWithOwner(options, getTailwindGenerationSessionPool(options.runtimeState)));
|
|
5193
5192
|
}
|
|
5194
|
-
async function validateCandidatesByGeneratorWithOwner(options) {
|
|
5193
|
+
async function validateCandidatesByGeneratorWithOwner(options, generationSession) {
|
|
5195
5194
|
const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState } = options;
|
|
5196
5195
|
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
5197
5196
|
if (majorVersion !== 4 || candidates.size === 0) return /* @__PURE__ */ new Set();
|
|
@@ -5206,7 +5205,6 @@ async function validateCandidatesByGeneratorWithOwner(options) {
|
|
|
5206
5205
|
cssEntries: opts.cssEntries,
|
|
5207
5206
|
runtime: candidates
|
|
5208
5207
|
});
|
|
5209
|
-
const generationSession = getTailwindGenerationSessionPool(runtimeState);
|
|
5210
5208
|
const classSets = await Promise.all(sourceRecords.map(async ({ source }) => {
|
|
5211
5209
|
return generationSession.validateCandidates(source, candidates);
|
|
5212
5210
|
}));
|