@weapp-tailwindcss/postcss 2.1.7 → 2.2.0-alpha.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/index.js CHANGED
@@ -1,7 +1,11 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;require('./chunk-GGNOJ77I.js');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class;
2
+
3
+ var _chunk2Y3ULRB3js = require('./chunk-2Y3ULRB3.js');
4
+ require('./chunk-GGNOJ77I.js');
2
5
 
3
6
  // src/handler.ts
4
7
  var _shared = require('@weapp-tailwindcss/shared');
8
+ var _lrucache = require('lru-cache');
5
9
 
6
10
  // src/compat/uni-app-x.ts
7
11
  var _postcss = require('postcss'); var _postcss2 = _interopRequireDefault(_postcss);
@@ -132,6 +136,145 @@ function shouldRemoveEmptyRuleForUniAppX(rule, options) {
132
136
  return isUniAppXEnabled(options) && rule.nodes.length === 0;
133
137
  }
134
138
 
139
+ // src/compat/uni-app-x-uvue.ts
140
+ var _postcssselectorparser = require('postcss-selector-parser'); var _postcssselectorparser2 = _interopRequireDefault(_postcssselectorparser);
141
+ var ALLOWED_DISPLAY_VALUES = /* @__PURE__ */ new Set(["flex", "none"]);
142
+ var FALLBACK_CLASS_RE = /\.((?:\\.|[\w-])+)/g;
143
+ var IMPORTANT_SUFFIX_RE = /\s*!important$/i;
144
+ function isUniAppXUvueTarget(options) {
145
+ return Boolean(_optionalChain([options, 'optionalAccess', _2 => _2.uniAppX])) && _optionalChain([options, 'optionalAccess', _3 => _3.uniAppXCssTarget]) === "uvue";
146
+ }
147
+ function normalizeUnsupportedMode(mode) {
148
+ return _nullishCoalesce(mode, () => ( "warn"));
149
+ }
150
+ function normalizeValue(value) {
151
+ return value.trim().toLowerCase().replace(IMPORTANT_SUFFIX_RE, "");
152
+ }
153
+ function getSourceFile(rule, result) {
154
+ return _nullishCoalesce(_nullishCoalesce(_optionalChain([rule, 'access', _4 => _4.source, 'optionalAccess', _5 => _5.input, 'access', _6 => _6.from]), () => ( result.opts.from)), () => ( "unknown source"));
155
+ }
156
+ function collectUtilityClassNames(rule) {
157
+ const classNames = /* @__PURE__ */ new Set();
158
+ for (const selector of _nullishCoalesce(rule.selectors, () => ( []))) {
159
+ try {
160
+ const ast = _postcssselectorparser2.default.call(void 0, ).astSync(selector);
161
+ ast.walkClasses((node) => {
162
+ if (node.value) {
163
+ classNames.add(node.value);
164
+ }
165
+ });
166
+ } catch (e) {
167
+ for (const match of selector.matchAll(FALLBACK_CLASS_RE)) {
168
+ if (match[1]) {
169
+ classNames.add(match[1].replaceAll("\\", ""));
170
+ }
171
+ }
172
+ }
173
+ }
174
+ return [...classNames];
175
+ }
176
+ function hasOnlyClassSelectors(rule) {
177
+ const selectors = _nullishCoalesce(rule.selectors, () => ( []));
178
+ if (selectors.length === 0) {
179
+ return false;
180
+ }
181
+ return selectors.every((selector) => {
182
+ try {
183
+ const ast = _postcssselectorparser2.default.call(void 0, ).astSync(selector);
184
+ return ast.nodes.every((node) => node.nodes.length > 0 && node.nodes.every((child) => child.type === "class"));
185
+ } catch (e2) {
186
+ return false;
187
+ }
188
+ });
189
+ }
190
+ function getUnsupportedDeclarationReason(prop, value) {
191
+ const normalizedProp = prop.trim().toLowerCase();
192
+ const normalizedValue = normalizeValue(value);
193
+ if (normalizedProp === "display" && !ALLOWED_DISPLAY_VALUES.has(normalizedValue)) {
194
+ return `${normalizedProp}: ${value}`;
195
+ }
196
+ if (normalizedProp === "min-height" && normalizedValue === "100vh") {
197
+ return `${normalizedProp}: ${value}`;
198
+ }
199
+ if (normalizedProp === "grid-template-columns" || normalizedProp === "grid-template-rows" || normalizedProp === "grid-auto-columns" || normalizedProp === "grid-auto-rows" || normalizedProp === "grid-auto-flow") {
200
+ return `${normalizedProp}: ${value}`;
201
+ }
202
+ if (normalizedProp === "gap" || normalizedProp === "row-gap" || normalizedProp === "column-gap") {
203
+ return `${normalizedProp}: ${value}`;
204
+ }
205
+ }
206
+ function reportUnsupportedRule(rule, result, mode, warningCache, reason) {
207
+ if (mode === "silent") {
208
+ return;
209
+ }
210
+ const classNames = collectUtilityClassNames(rule);
211
+ const classLabel = classNames.length > 0 ? classNames.join(", ") : rule.selector;
212
+ const source = getSourceFile(rule, result);
213
+ const message = `uni-app x uvue unsupported utility: ${classLabel} (${reason}) in ${source}`;
214
+ if (mode === "error") {
215
+ throw rule.error(message);
216
+ }
217
+ if (warningCache.has(message)) {
218
+ return;
219
+ }
220
+ warningCache.add(message);
221
+ rule.warn(result, message);
222
+ }
223
+ function applyUniAppXUvueCompatibility(result, options) {
224
+ if (!isUniAppXUvueTarget(options)) {
225
+ return result;
226
+ }
227
+ const mode = normalizeUnsupportedMode(_optionalChain([options, 'optionalAccess', _7 => _7.uniAppXUnsupported]));
228
+ const warningCache = /* @__PURE__ */ new Set();
229
+ result.root.walkRules((rule) => {
230
+ if (!hasOnlyClassSelectors(rule)) {
231
+ reportUnsupportedRule(rule, result, mode, warningCache, "selector must be class-only");
232
+ rule.remove();
233
+ return;
234
+ }
235
+ rule.walkDecls((decl) => {
236
+ const reason = getUnsupportedDeclarationReason(decl.prop, decl.value);
237
+ if (!reason) {
238
+ return;
239
+ }
240
+ reportUnsupportedRule(rule, result, mode, warningCache, reason);
241
+ decl.remove();
242
+ });
243
+ if ((_nullishCoalesce(_optionalChain([rule, 'access', _8 => _8.nodes, 'optionalAccess', _9 => _9.length]), () => ( 0))) === 0) {
244
+ rule.remove();
245
+ }
246
+ });
247
+ result.root.walkAtRules((atRule) => {
248
+ if ((_nullishCoalesce(_optionalChain([atRule, 'access', _10 => _10.nodes, 'optionalAccess', _11 => _11.length]), () => ( 0))) === 0) {
249
+ atRule.remove();
250
+ }
251
+ });
252
+ const nextResult = result.root.toResult(result.opts);
253
+ nextResult.messages.push(...result.messages);
254
+ return nextResult;
255
+ }
256
+
257
+ // src/content-probe.ts
258
+ var EMPTY_SIGNAL = {
259
+ hasModernColorFunction: false,
260
+ hasPresetEnvFeatures: false
261
+ };
262
+ var MODERN_COLOR_RE = /rgb\w*\s*\([^),][^\s),]*\s[^),][^\s),]*\s[^),][^),/]*\/[^)]+\)/i;
263
+ function probeFeatures(css) {
264
+ if (!css) {
265
+ return { ...EMPTY_SIGNAL };
266
+ }
267
+ const hasModernColorFunction = MODERN_COLOR_RE.test(css);
268
+ const hasPresetEnvFeatures = true;
269
+ return {
270
+ hasModernColorFunction,
271
+ hasPresetEnvFeatures
272
+ };
273
+ }
274
+ function signalToCacheKey(signal) {
275
+ return `signal:${signal.hasPresetEnvFeatures ? 1 : 0},${signal.hasModernColorFunction ? 1 : 0}`;
276
+ }
277
+
135
278
  // src/defaults.ts
136
279
  function getDefaultOptions(options) {
137
280
  return {
@@ -144,9 +287,9 @@ function getDefaultOptions(options) {
144
287
  },
145
288
  "oklab-function": true,
146
289
  "color-mix": true,
147
- "color-functional-notation": _nullishCoalesce(_optionalChain([options, 'optionalAccess', _2 => _2.cssPresetEnv, 'optionalAccess', _3 => _3.features, 'optionalAccess', _4 => _4["color-functional-notation"]]), () => ( { preserve: false })),
290
+ "color-functional-notation": _nullishCoalesce(_optionalChain([options, 'optionalAccess', _12 => _12.cssPresetEnv, 'optionalAccess', _13 => _13.features, 'optionalAccess', _14 => _14["color-functional-notation"]]), () => ( { preserve: false })),
148
291
  // 在 calc 下,这个需要开启
149
- "custom-properties": _nullishCoalesce(_optionalChain([options, 'optionalAccess', _5 => _5.cssPresetEnv, 'optionalAccess', _6 => _6.features, 'optionalAccess', _7 => _7["custom-properties"]]), () => ( _optionalChain([options, 'optionalAccess', _8 => _8.cssCalc]))) ? { preserve: true } : false
292
+ "custom-properties": _nullishCoalesce(_optionalChain([options, 'optionalAccess', _15 => _15.cssPresetEnv, 'optionalAccess', _16 => _16.features, 'optionalAccess', _17 => _17["custom-properties"]]), () => ( _optionalChain([options, 'optionalAccess', _18 => _18.cssCalc]))) ? { preserve: true } : false
150
293
  },
151
294
  autoprefixer: {
152
295
  add: false
@@ -154,6 +297,7 @@ function getDefaultOptions(options) {
154
297
  },
155
298
  // 支付宝小程序不支持,所以默认关闭
156
299
  cssRemoveProperty: true,
300
+ uniAppXUnsupported: "warn",
157
301
  // cssRemoveAtSupports: true,
158
302
  // cssRemoveAtMedia: true,
159
303
  cssSelectorReplacement: {
@@ -163,9 +307,6 @@ function getDefaultOptions(options) {
163
307
  };
164
308
  }
165
309
 
166
- // src/options-resolver.ts
167
-
168
-
169
310
  // src/fingerprint.ts
170
311
  function fingerprintOptions(value, state = { map: /* @__PURE__ */ new WeakMap(), counter: 0 }) {
171
312
  if (value === null || value === void 0) {
@@ -197,6 +338,7 @@ function fingerprintOptions(value, state = { map: /* @__PURE__ */ new WeakMap(),
197
338
  }
198
339
 
199
340
  // src/options-resolver.ts
341
+
200
342
  var BASE_CACHE_KEY = "base";
201
343
  var SIMPLE_OVERRIDE_UNSET = "__unset__";
202
344
  function getSimpleOverrideCacheKey(options) {
@@ -213,6 +355,7 @@ function getSimpleOverrideCacheKey(options) {
213
355
  let cssCalc = SIMPLE_OVERRIDE_UNSET;
214
356
  let cssChildCombinatorReplaceValue = SIMPLE_OVERRIDE_UNSET;
215
357
  let cssPreflight = SIMPLE_OVERRIDE_UNSET;
358
+ let autoprefixer = SIMPLE_OVERRIDE_UNSET;
216
359
  for (const key of Object.keys(options)) {
217
360
  const value = options[key];
218
361
  switch (key) {
@@ -294,6 +437,12 @@ function getSimpleOverrideCacheKey(options) {
294
437
  }
295
438
  cssPreflight = "0";
296
439
  break;
440
+ case "autoprefixer":
441
+ if (typeof value !== "boolean") {
442
+ return void 0;
443
+ }
444
+ autoprefixer = value ? "1" : "0";
445
+ break;
297
446
  default:
298
447
  return void 0;
299
448
  }
@@ -312,7 +461,8 @@ function getSimpleOverrideCacheKey(options) {
312
461
  unitsToPx,
313
462
  cssCalc,
314
463
  cssChildCombinatorReplaceValue,
315
- cssPreflight
464
+ cssPreflight,
465
+ autoprefixer
316
466
  ].join(":");
317
467
  }
318
468
  function hasOverrides(options) {
@@ -387,6 +537,28 @@ function createInjectPreflight(options) {
387
537
  // src/pipeline.ts
388
538
  var _postcsspresetenv = require('postcss-preset-env'); var _postcsspresetenv2 = _interopRequireDefault(_postcsspresetenv);
389
539
 
540
+ // src/autoprefixer.ts
541
+ var _autoprefixer = require('autoprefixer'); var _autoprefixer2 = _interopRequireDefault(_autoprefixer);
542
+ var WEAPP_AUTOPREFIXER_BROWSERS = [
543
+ "iOS >= 8",
544
+ "Android >= 4.4",
545
+ "ChromeAndroid >= 37"
546
+ ];
547
+ var AUTOPREFIXER_PLUGIN_NAME = "autoprefixer";
548
+ function isAutoprefixerPlugin(plugin) {
549
+ return _optionalChain([plugin, 'optionalAccess', _19 => _19.postcssPlugin]) === AUTOPREFIXER_PLUGIN_NAME;
550
+ }
551
+ function resolveAutoprefixerPlugin(option) {
552
+ if (option === false) {
553
+ return void 0;
554
+ }
555
+ const userOptions = option === true || option === void 0 ? {} : option;
556
+ return _autoprefixer2.default.call(void 0, {
557
+ ...userOptions,
558
+ overrideBrowserslist: _nullishCoalesce(userOptions.overrideBrowserslist, () => ( WEAPP_AUTOPREFIXER_BROWSERS))
559
+ });
560
+ }
561
+
390
562
  // src/plugins/colorFunctionalFallback.ts
391
563
  var _postcssvalueparser = require('postcss-value-parser'); var _postcssvalueparser2 = _interopRequireDefault(_postcssvalueparser);
392
564
  var RGB_FUNCTION_NAME = "rgb";
@@ -394,10 +566,10 @@ var isSlashDiv = (node) => node.type === "div" && node.value === "/";
394
566
  function trimNodes(nodes2) {
395
567
  let start = 0;
396
568
  let end = nodes2.length;
397
- while (start < end && _optionalChain([nodes2, 'access', _9 => _9[start], 'optionalAccess', _10 => _10.type]) === "space") {
569
+ while (start < end && _optionalChain([nodes2, 'access', _20 => _20[start], 'optionalAccess', _21 => _21.type]) === "space") {
398
570
  start += 1;
399
571
  }
400
- while (end > start && _optionalChain([nodes2, 'access', _11 => _11[end - 1], 'optionalAccess', _12 => _12.type]) === "space") {
572
+ while (end > start && _optionalChain([nodes2, 'access', _22 => _22[end - 1], 'optionalAccess', _23 => _23.type]) === "space") {
401
573
  end -= 1;
402
574
  }
403
575
  return nodes2.slice(start, end);
@@ -532,7 +704,7 @@ function getCalcDuplicateCleaner(options) {
532
704
  // src/plugins/getCalcPlugin.ts
533
705
  var _postcsscalc = require('@weapp-tailwindcss/postcss-calc'); var _postcsscalc2 = _interopRequireDefault(_postcsscalc);
534
706
 
535
- // ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/omit.mjs
707
+ // ../../node_modules/.pnpm/es-toolkit@1.46.1/node_modules/es-toolkit/dist/object/omit.mjs
536
708
  function omit(obj, keys) {
537
709
  const result = { ...obj };
538
710
  for (let i = 0; i < keys.length; i++) {
@@ -667,13 +839,52 @@ function getRemTransformPlugin(options) {
667
839
  }
668
840
 
669
841
  // src/plugins/getUnitsToPxPlugin.ts
670
- var _postcssunitstopx = require('postcss-units-to-px'); var _postcssunitstopx2 = _interopRequireDefault(_postcssunitstopx);
842
+ var _postcssruleunitconverter = require('postcss-rule-unit-converter'); var _postcssruleunitconverter2 = _interopRequireDefault(_postcssruleunitconverter);
671
843
  function getUnitsToPxPlugin(options) {
672
844
  if (!options.unitsToPx) {
673
845
  return null;
674
846
  }
675
847
  const userOptions = typeof options.unitsToPx === "object" ? options.unitsToPx : void 0;
676
- return _postcssunitstopx2.default.call(void 0, userOptions);
848
+ if (_optionalChain([userOptions, 'optionalAccess', _24 => _24.disabled]) || _optionalChain([userOptions, 'optionalAccess', _25 => _25.transform]) === false) {
849
+ return _postcssruleunitconverter2.default.call(void 0, { disabled: true });
850
+ }
851
+ const presetOptions = {};
852
+ const converterOptions = {
853
+ rules: []
854
+ };
855
+ if (_optionalChain([userOptions, 'optionalAccess', _26 => _26.minValue]) !== void 0) {
856
+ presetOptions.minValue = userOptions.minValue;
857
+ converterOptions.minValue = userOptions.minValue;
858
+ }
859
+ if (_optionalChain([userOptions, 'optionalAccess', _27 => _27.to]) !== void 0) {
860
+ presetOptions.to = userOptions.to;
861
+ }
862
+ if (_optionalChain([userOptions, 'optionalAccess', _28 => _28.transform]) !== void 0) {
863
+ presetOptions.transform = userOptions.transform;
864
+ }
865
+ if (_optionalChain([userOptions, 'optionalAccess', _29 => _29.unitMap]) !== void 0) {
866
+ presetOptions.unitMap = userOptions.unitMap;
867
+ }
868
+ if (_optionalChain([userOptions, 'optionalAccess', _30 => _30.exclude]) !== void 0) {
869
+ converterOptions.exclude = userOptions.exclude;
870
+ }
871
+ if (_optionalChain([userOptions, 'optionalAccess', _31 => _31.mediaQuery]) !== void 0) {
872
+ converterOptions.mediaQuery = userOptions.mediaQuery;
873
+ }
874
+ if (_optionalChain([userOptions, 'optionalAccess', _32 => _32.propList]) !== void 0) {
875
+ converterOptions.propList = userOptions.propList;
876
+ }
877
+ if (_optionalChain([userOptions, 'optionalAccess', _33 => _33.replace]) !== void 0) {
878
+ converterOptions.replace = userOptions.replace;
879
+ }
880
+ if (_optionalChain([userOptions, 'optionalAccess', _34 => _34.selectorBlackList]) !== void 0) {
881
+ converterOptions.selectorBlackList = userOptions.selectorBlackList;
882
+ }
883
+ if (_optionalChain([userOptions, 'optionalAccess', _35 => _35.unitPrecision]) !== void 0) {
884
+ converterOptions.unitPrecision = userOptions.unitPrecision;
885
+ }
886
+ converterOptions.rules = _postcssruleunitconverter.presets.unitsToPx(presetOptions);
887
+ return _postcssruleunitconverter2.default.call(void 0, converterOptions);
677
888
  }
678
889
 
679
890
  // src/plugins/post.ts
@@ -682,7 +893,7 @@ function getUnitsToPxPlugin(options) {
682
893
  // src/compat/tailwindcss-rpx.ts
683
894
  var LENGTH_VALUE_REGEXP = /^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?rpx$/i;
684
895
  function normalizeTailwindcssRpxDeclaration(decl, options) {
685
- const majorVersion = _optionalChain([options, 'optionalAccess', _13 => _13.majorVersion]);
896
+ const majorVersion = _optionalChain([options, 'optionalAccess', _36 => _36.majorVersion]);
686
897
  const normalizedValue = decl.value.trim();
687
898
  if (LENGTH_VALUE_REGEXP.test(normalizedValue) && (majorVersion === void 0 || majorVersion === 2 || majorVersion === 3 || majorVersion === 4)) {
688
899
  const lowerProp = decl.prop.toLowerCase();
@@ -869,7 +1080,7 @@ var MODERN_CHECK_COLOR_RGB_RE = /color\s*:\s*rgb\(\s*from\s+red\s+r\s+g\s+b\s*\)
869
1080
  var RADIUS_VALUE_RE = /\b([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*(r?px)\b/gi;
870
1081
  var SCIENTIFIC_NOTATION_RE = /e/i;
871
1082
  function isTailwindcssV4(options) {
872
- return _optionalChain([options, 'optionalAccess', _14 => _14.majorVersion]) === 4;
1083
+ return _optionalChain([options, 'optionalAccess', _37 => _37.majorVersion]) === 4;
873
1084
  }
874
1085
  function testIfRootHostForV4(node) {
875
1086
  return node.type === "rule" && node.selector.includes(":root") && node.selector.includes(":host");
@@ -919,7 +1130,7 @@ function normalizeTailwindcssV4Declaration(decl) {
919
1130
  var postcssPlugin = "postcss-weapp-tailwindcss-rename-plugin";
920
1131
 
921
1132
  // src/selectorParser/before-after.ts
922
- var _postcssselectorparser = require('postcss-selector-parser'); var _postcssselectorparser2 = _interopRequireDefault(_postcssselectorparser);
1133
+
923
1134
  var beforeAfterStateRef = null;
924
1135
  var BEFORE_PSEUDO_RE = /^:?:before$/;
925
1136
  var AFTER_PSEUDO_RE = /^:?:after$/;
@@ -929,7 +1140,7 @@ var beforeAfterParser = _postcssselectorparser2.default.call(void 0, (selectors)
929
1140
  return;
930
1141
  }
931
1142
  selectors.walkPseudos((s) => {
932
- if (_optionalChain([s, 'access', _15 => _15.parent, 'optionalAccess', _16 => _16.length]) === 1) {
1143
+ if (_optionalChain([s, 'access', _38 => _38.parent, 'optionalAccess', _39 => _39.length]) === 1) {
933
1144
  if (BEFORE_PSEUDO_RE.test(s.value)) {
934
1145
  state.before = true;
935
1146
  }
@@ -1032,13 +1243,13 @@ function getFallbackRemove(_rule, options) {
1032
1243
  maybeImportantId = true;
1033
1244
  }
1034
1245
  if (selector.type === "universal") {
1035
- _optionalChain([selector, 'access', _17 => _17.parent, 'optionalAccess', _18 => _18.remove, 'call', _19 => _19()]);
1246
+ _optionalChain([selector, 'access', _40 => _40.parent, 'optionalAccess', _41 => _41.remove, 'call', _42 => _42()]);
1036
1247
  } else if (selector.type === "pseudo") {
1037
1248
  if (selector.value === ":is") {
1038
- if (maybeImportantId && _optionalChain([selector, 'access', _20 => _20.nodes, 'access', _21 => _21[0], 'optionalAccess', _22 => _22.type]) === "selector") {
1249
+ if (maybeImportantId && _optionalChain([selector, 'access', _43 => _43.nodes, 'access', _44 => _44[0], 'optionalAccess', _45 => _45.type]) === "selector") {
1039
1250
  selector.replaceWith(selector.nodes[0]);
1040
1251
  } else {
1041
- _optionalChain([selector, 'access', _23 => _23.parent, 'optionalAccess', _24 => _24.remove, 'call', _25 => _25()]);
1252
+ _optionalChain([selector, 'access', _46 => _46.parent, 'optionalAccess', _47 => _47.remove, 'call', _48 => _48()]);
1042
1253
  }
1043
1254
  } else if (selector.value === ":not") {
1044
1255
  for (const x of selector.nodes) {
@@ -1061,7 +1272,7 @@ function getFallbackRemove(_rule, options) {
1061
1272
  }
1062
1273
  } else if (selector.type === "attribute") {
1063
1274
  if (selector.attribute === "hidden") {
1064
- _optionalChain([activeRule, 'optionalAccess', _26 => _26.remove, 'call', _27 => _27()]);
1275
+ _optionalChain([activeRule, 'optionalAccess', _49 => _49.remove, 'call', _50 => _50()]);
1065
1276
  }
1066
1277
  }
1067
1278
  });
@@ -1147,7 +1358,7 @@ function getEscapeOptions(escapeMap) {
1147
1358
  return cached;
1148
1359
  }
1149
1360
  function internalCssSelectorReplacer(selectors, options) {
1150
- const escapeMap = _optionalChain([options, 'optionalAccess', _28 => _28.escapeMap]);
1361
+ const escapeMap = _optionalChain([options, 'optionalAccess', _51 => _51.escapeMap]);
1151
1362
  if (escapeMap === void 0 || escapeMap === _escape.MappingChars2String) {
1152
1363
  return _escape.escape.call(void 0, selectors);
1153
1364
  }
@@ -1191,7 +1402,7 @@ function reorderLiteralFirst(rule, declarations, isVariable) {
1191
1402
  if (alreadyOrdered) {
1192
1403
  return;
1193
1404
  }
1194
- const anchor = _nullishCoalesce(_optionalChain([declarations, 'access', _29 => _29.at, 'call', _30 => _30(-1), 'optionalAccess', _31 => _31.next, 'call', _32 => _32()]), () => ( void 0));
1405
+ const anchor = _nullishCoalesce(_optionalChain([declarations, 'access', _52 => _52.at, 'call', _53 => _53(-1), 'optionalAccess', _54 => _54.next, 'call', _55 => _55()]), () => ( void 0));
1195
1406
  for (const decl of declarations) {
1196
1407
  decl.remove();
1197
1408
  }
@@ -1269,7 +1480,7 @@ function isNotLastChildPseudo(node) {
1269
1480
  if (!firstSelector || firstSelector.type !== "selector") {
1270
1481
  return false;
1271
1482
  }
1272
- const target = _optionalChain([firstSelector, 'access', _33 => _33.nodes, 'optionalAccess', _34 => _34[0]]);
1483
+ const target = _optionalChain([firstSelector, 'access', _56 => _56.nodes, 'optionalAccess', _57 => _57[0]]);
1273
1484
  return Boolean(target && target.type === "pseudo" && target.value === ":last-child");
1274
1485
  }
1275
1486
  function transformSpacingSelector(nodes2, options) {
@@ -1381,7 +1592,7 @@ function flattenWherePseudo(node, context, index, parent) {
1381
1592
  node.value = ":is";
1382
1593
  }
1383
1594
  if (index === 0 && node.length === 1) {
1384
- const targetSelector = _optionalChain([node, 'access', _35 => _35.nodes, 'optionalAccess', _36 => _36[0]]);
1595
+ const targetSelector = _optionalChain([node, 'access', _58 => _58.nodes, 'optionalAccess', _59 => _59[0]]);
1385
1596
  if (targetSelector && targetSelector.type === "selector" && transformSpacingSelector(targetSelector.nodes, context.options)) {
1386
1597
  context.requiresSpacingNormalization = true;
1387
1598
  }
@@ -1449,7 +1660,7 @@ function handleCombinatorNode(node, index, context) {
1449
1660
  if (node.type !== "combinator" || node.value !== ">") {
1450
1661
  return;
1451
1662
  }
1452
- const nodes2 = _optionalChain([node, 'access', _37 => _37.parent, 'optionalAccess', _38 => _38.nodes]);
1663
+ const nodes2 = _optionalChain([node, 'access', _60 => _60.parent, 'optionalAccess', _61 => _61.nodes]);
1453
1664
  if (!nodes2) {
1454
1665
  return;
1455
1666
  }
@@ -1502,7 +1713,7 @@ function canSkipRuleTransform(rule) {
1502
1713
  }
1503
1714
  function transformSelectors(selectors, context) {
1504
1715
  selectors.walk((node, index) => {
1505
- const parent = _optionalChain([node, 'access', _39 => _39.parent, 'optionalAccess', _40 => _40.type]) === "selector" ? node.parent : void 0;
1716
+ const parent = _optionalChain([node, 'access', _62 => _62.parent, 'optionalAccess', _63 => _63.type]) === "selector" ? node.parent : void 0;
1506
1717
  switch (node.type) {
1507
1718
  case "class":
1508
1719
  handleClassNode(node, context);
@@ -1549,8 +1760,8 @@ function createRuleTransformer(options) {
1549
1760
  let context;
1550
1761
  const selectorResultCache = /* @__PURE__ */ new Map();
1551
1762
  const selectorResultCacheLimit = 5e4;
1552
- const rootReplacement = _optionalChain([options, 'access', _41 => _41.cssSelectorReplacement, 'optionalAccess', _42 => _42.root]) ? composeIsPseudo(options.cssSelectorReplacement.root) : void 0;
1553
- const universalReplacement = _optionalChain([options, 'access', _43 => _43.cssSelectorReplacement, 'optionalAccess', _44 => _44.universal]) ? composeIsPseudo(options.cssSelectorReplacement.universal) : void 0;
1763
+ const rootReplacement = _optionalChain([options, 'access', _64 => _64.cssSelectorReplacement, 'optionalAccess', _65 => _65.root]) ? composeIsPseudo(options.cssSelectorReplacement.root) : void 0;
1764
+ const universalReplacement = _optionalChain([options, 'access', _66 => _66.cssSelectorReplacement, 'optionalAccess', _67 => _67.universal]) ? composeIsPseudo(options.cssSelectorReplacement.universal) : void 0;
1554
1765
  const selectorReplacerOptions = options.escapeMap ? { escapeMap: options.escapeMap } : void 0;
1555
1766
  function writeSelectorResultCache(selector, result) {
1556
1767
  if (selectorResultCache.size >= selectorResultCacheLimit) {
@@ -1598,7 +1809,7 @@ function createRuleTransformer(options) {
1598
1809
  } finally {
1599
1810
  const currentContext = context;
1600
1811
  wasRemoved = rule.parent == null;
1601
- requiresSpacingNormalization = _optionalChain([currentContext, 'optionalAccess', _45 => _45.requiresSpacingNormalization]) === true;
1812
+ requiresSpacingNormalization = _optionalChain([currentContext, 'optionalAccess', _68 => _68.requiresSpacingNormalization]) === true;
1602
1813
  context = void 0;
1603
1814
  }
1604
1815
  if (wasRemoved) {
@@ -1830,7 +2041,7 @@ function normalizeSelectorList(value) {
1830
2041
  return Array.isArray(value) ? value.filter(Boolean) : [value];
1831
2042
  }
1832
2043
  function getSpecificityMatchingName(options) {
1833
- const feature = _optionalChain([options, 'access', _46 => _46.cssPresetEnv, 'optionalAccess', _47 => _47.features, 'optionalAccess', _48 => _48["is-pseudo-class"]]);
2044
+ const feature = _optionalChain([options, 'access', _69 => _69.cssPresetEnv, 'optionalAccess', _70 => _70.features, 'optionalAccess', _71 => _71["is-pseudo-class"]]);
1834
2045
  if (feature && typeof feature === "object" && "specificityMatchingName" in feature) {
1835
2046
  const specificityName = feature.specificityMatchingName;
1836
2047
  return typeof specificityName === "string" && specificityName.length > 0 ? specificityName : void 0;
@@ -1878,12 +2089,12 @@ function createFallbackPlaceholderCleaner() {
1878
2089
  }
1879
2090
  function createRootSpecificityCleaner(options) {
1880
2091
  const specificityMatchingName = getSpecificityMatchingName(options);
1881
- const selectors = normalizeSelectorList(_optionalChain([options, 'access', _49 => _49.cssSelectorReplacement, 'optionalAccess', _50 => _50.root]));
2092
+ const selectors = normalizeSelectorList(_optionalChain([options, 'access', _72 => _72.cssSelectorReplacement, 'optionalAccess', _73 => _73.root]));
1882
2093
  if (!specificityMatchingName || selectors.length === 0) {
1883
2094
  return void 0;
1884
2095
  }
1885
2096
  const suffix = `:not(.${specificityMatchingName})`;
1886
- const targets = selectors.map((selector) => _optionalChain([selector, 'optionalAccess', _51 => _51.trim, 'call', _52 => _52()])).filter((selector) => Boolean(_optionalChain([selector, 'optionalAccess', _53 => _53.length]))).map((selector) => ({
2097
+ const targets = selectors.map((selector) => _optionalChain([selector, 'optionalAccess', _74 => _74.trim, 'call', _75 => _75()])).filter((selector) => Boolean(_optionalChain([selector, 'optionalAccess', _76 => _76.length]))).map((selector) => ({
1887
2098
  match: `${selector}${suffix}`,
1888
2099
  spacedMatch: `${selector} ${suffix}`,
1889
2100
  replacement: selector
@@ -1927,7 +2138,7 @@ function normalizeRootSelectors(value) {
1927
2138
  return Array.isArray(value) ? value.filter(Boolean) : [value];
1928
2139
  }
1929
2140
  function createHostSelectorAppender(options) {
1930
- const rootSelectors = normalizeRootSelectors(_optionalChain([options, 'access', _54 => _54.cssSelectorReplacement, 'optionalAccess', _55 => _55.root]));
2141
+ const rootSelectors = normalizeRootSelectors(_optionalChain([options, 'access', _77 => _77.cssSelectorReplacement, 'optionalAccess', _78 => _78.root]));
1931
2142
  const shouldAppendHostSelector = rootSelectors.length === DEFAULT_ROOT_SELECTORS.length && rootSelectors.every((selector, index) => selector === DEFAULT_ROOT_SELECTORS[index]);
1932
2143
  if (!shouldAppendHostSelector) {
1933
2144
  return void 0;
@@ -1955,12 +2166,12 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
1955
2166
  const fallbackRemove = enableMainChunkTransforms ? getFallbackRemove(void 0, opts) : void 0;
1956
2167
  p.RuleExit = (rule) => {
1957
2168
  if (enableMainChunkTransforms) {
1958
- _optionalChain([fallbackRemove, 'optionalAccess', _56 => _56.transformSync, 'call', _57 => _57(rule)]);
2169
+ _optionalChain([fallbackRemove, 'optionalAccess', _79 => _79.transformSync, 'call', _80 => _80(rule)]);
1959
2170
  }
1960
2171
  cleanFallbackPlaceholder(rule);
1961
- _optionalChain([cleanRootSpecificity, 'optionalCall', _58 => _58(rule)]);
2172
+ _optionalChain([cleanRootSpecificity, 'optionalCall', _81 => _81(rule)]);
1962
2173
  if (enableMainChunkTransforms) {
1963
- if (_optionalChain([shouldAppendHostSelector, 'optionalCall', _59 => _59(rule)])) {
2174
+ if (_optionalChain([shouldAppendHostSelector, 'optionalCall', _82 => _82(rule)])) {
1964
2175
  appendRuleSelector(rule, ":host", {
1965
2176
  phase: "post",
1966
2177
  reason: "append-host-selector"
@@ -1989,7 +2200,7 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
1989
2200
  if (opts.cssRemoveProperty && atRule.name === "property") {
1990
2201
  atRule.remove();
1991
2202
  }
1992
- _optionalChain([atRule, 'access', _60 => _60.nodes, 'optionalAccess', _61 => _61.length]) === 0 && atRule.remove();
2203
+ _optionalChain([atRule, 'access', _83 => _83.nodes, 'optionalAccess', _84 => _84.length]) === 0 && atRule.remove();
1993
2204
  };
1994
2205
  }
1995
2206
  return p;
@@ -2271,7 +2482,7 @@ function remakeCssVarSelector(selectors, options) {
2271
2482
  return selectors;
2272
2483
  }
2273
2484
  function resolveUniAppXVariableScopeSelectors(options) {
2274
- const universal = _optionalChain([options, 'access', _62 => _62.cssSelectorReplacement, 'optionalAccess', _63 => _63.universal]);
2485
+ const universal = _optionalChain([options, 'access', _85 => _85.cssSelectorReplacement, 'optionalAccess', _86 => _86.universal]);
2275
2486
  if (Array.isArray(universal) && universal.length > 0) {
2276
2487
  return [...universal];
2277
2488
  }
@@ -2283,7 +2494,7 @@ function resolveUniAppXVariableScopeSelectors(options) {
2283
2494
  function commonChunkPreflight(node, options) {
2284
2495
  const { ctx, cssInjectPreflight, injectAdditionalCssVarScope } = options;
2285
2496
  const uniAppXEnabled = isUniAppXEnabled(options);
2286
- const rootOption = _optionalChain([options, 'access', _64 => _64.cssSelectorReplacement, 'optionalAccess', _65 => _65.root]);
2497
+ const rootOption = _optionalChain([options, 'access', _87 => _87.cssSelectorReplacement, 'optionalAccess', _88 => _88.root]);
2287
2498
  const rootSelectors = rootOption === false || rootOption === void 0 ? [] : Array.isArray(rootOption) ? rootOption.filter(Boolean) : [rootOption];
2288
2499
  const hasHostSelector = node.selectors.some((selector) => selector.includes(":host"));
2289
2500
  const hasRootPseudoSelector = node.selectors.some((selector) => selector.includes(":root"));
@@ -2295,7 +2506,7 @@ function commonChunkPreflight(node, options) {
2295
2506
  });
2296
2507
  }
2297
2508
  if (testIfVariablesScope(node) || uniAppXEnabled && node.selectors.includes("*") && hasTwVars(node, 2)) {
2298
- _optionalChain([ctx, 'optionalAccess', _66 => _66.markVariablesScope, 'call', _67 => _67(node)]);
2509
+ _optionalChain([ctx, 'optionalAccess', _89 => _89.markVariablesScope, 'call', _90 => _90(node)]);
2299
2510
  assignRuleSelectors(node, uniAppXEnabled ? resolveUniAppXVariableScopeSelectors(options) : remakeCssVarSelector(node.selectors, options), {
2300
2511
  phase: "pre",
2301
2512
  reason: "rewrite-variable-scope"
@@ -2367,9 +2578,9 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
2367
2578
  root.walkAtRules((atRule) => {
2368
2579
  if (atRule.name === "layer") {
2369
2580
  if (atRule.params === "properties") {
2370
- if (atRule.nodes === void 0 || _optionalChain([atRule, 'access', _68 => _68.nodes, 'optionalAccess', _69 => _69.length]) === 0) {
2581
+ if (atRule.nodes === void 0 || _optionalChain([atRule, 'access', _91 => _91.nodes, 'optionalAccess', _92 => _92.length]) === 0) {
2371
2582
  layerProperties = atRule;
2372
- } else if (_optionalChain([atRule, 'access', _70 => _70.first, 'optionalAccess', _71 => _71.type]) === "atrule" && isTailwindcssV4ModernCheck(atRule.first)) {
2583
+ } else if (_optionalChain([atRule, 'access', _93 => _93.first, 'optionalAccess', _94 => _94.type]) === "atrule" && isTailwindcssV4ModernCheck(atRule.first)) {
2373
2584
  if (layerProperties) {
2374
2585
  layerProperties.replaceWith(atRule.first.nodes);
2375
2586
  atRule.remove();
@@ -2381,7 +2592,7 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
2381
2592
  atRule.replaceWith(atRule.nodes);
2382
2593
  }
2383
2594
  } else if (isTailwindcssV4ModernCheck(atRule)) {
2384
- if (_optionalChain([atRule, 'access', _72 => _72.first, 'optionalAccess', _73 => _73.type]) === "atrule" && atRule.first.name === "layer") {
2595
+ if (_optionalChain([atRule, 'access', _95 => _95.first, 'optionalAccess', _96 => _96.type]) === "atrule" && atRule.first.name === "layer") {
2385
2596
  atRule.replaceWith(atRule.first.nodes);
2386
2597
  }
2387
2598
  }
@@ -2415,16 +2626,42 @@ function createPreparedNode(id, stage, createPlugin) {
2415
2626
  createPlugin
2416
2627
  };
2417
2628
  }
2418
- function createPreparedNodes(options) {
2629
+ function hasUserAutoprefixerPlugin(rawPlugins, plugins) {
2630
+ if (plugins.some((plugin) => isAutoprefixerPlugin(plugin))) {
2631
+ return true;
2632
+ }
2633
+ if (rawPlugins && !Array.isArray(rawPlugins) && typeof rawPlugins === "object") {
2634
+ const autoprefixerEntry = rawPlugins["autoprefixer"];
2635
+ return Boolean(autoprefixerEntry);
2636
+ }
2637
+ return false;
2638
+ }
2639
+ function shouldUseDefaultAutoprefixer(options, userPlugins) {
2640
+ if (options.autoprefixer === false) {
2641
+ return false;
2642
+ }
2643
+ if (hasUserAutoprefixerPlugin(_optionalChain([options, 'access', _97 => _97.postcssOptions, 'optionalAccess', _98 => _98.plugins]), userPlugins)) {
2644
+ return false;
2645
+ }
2646
+ if (options.autoprefixer === true || typeof options.autoprefixer === "object") {
2647
+ return true;
2648
+ }
2649
+ return options.majorVersion === 4;
2650
+ }
2651
+ function createPreparedNodes(options, signal) {
2419
2652
  const preparedNodes = [];
2420
- const userPlugins = normalizeUserPlugins(_optionalChain([options, 'access', _74 => _74.postcssOptions, 'optionalAccess', _75 => _75.plugins]));
2653
+ const userPlugins = normalizeUserPlugins(_optionalChain([options, 'access', _99 => _99.postcssOptions, 'optionalAccess', _100 => _100.plugins]));
2421
2654
  const presetEnvOptions = options.cssPresetEnv;
2422
2655
  userPlugins.forEach((plugin, index) => {
2423
2656
  preparedNodes.push(createPreparedNode(`pre:user-${index}`, "pre", () => plugin));
2424
2657
  });
2425
2658
  preparedNodes.push(createPreparedNode("pre:core", "pre", () => postcssWeappTailwindcssPrePlugin(options)));
2426
- preparedNodes.push(createPreparedNode("normal:preset-env", "normal", () => _postcsspresetenv2.default.call(void 0, presetEnvOptions)));
2427
- preparedNodes.push(createPreparedNode("normal:color-functional-fallback", "normal", () => createColorFunctionalFallback()));
2659
+ if (!signal || signal.hasPresetEnvFeatures) {
2660
+ preparedNodes.push(createPreparedNode("normal:preset-env", "normal", () => _postcsspresetenv2.default.call(void 0, presetEnvOptions)));
2661
+ }
2662
+ if (!signal || signal.hasModernColorFunction) {
2663
+ preparedNodes.push(createPreparedNode("normal:color-functional-fallback", "normal", () => createColorFunctionalFallback()));
2664
+ }
2428
2665
  const unitsToPxPlugin = getUnitsToPxPlugin(options);
2429
2666
  if (unitsToPxPlugin) {
2430
2667
  preparedNodes.push(createPreparedNode("normal:units-to-px", "normal", () => unitsToPxPlugin));
@@ -2449,12 +2686,18 @@ function createPreparedNodes(options) {
2449
2686
  if (customPropertyCleaner) {
2450
2687
  preparedNodes.push(createPreparedNode("normal:custom-property-cleaner", "normal", () => customPropertyCleaner));
2451
2688
  }
2689
+ if (shouldUseDefaultAutoprefixer(options, userPlugins)) {
2690
+ const plugin = resolveAutoprefixerPlugin(options.autoprefixer);
2691
+ if (plugin) {
2692
+ preparedNodes.push(createPreparedNode("normal:autoprefixer", "normal", () => plugin));
2693
+ }
2694
+ }
2452
2695
  preparedNodes.push(createPreparedNode("post:core", "post", () => postcssWeappTailwindcssPostPlugin(options)));
2453
2696
  return preparedNodes;
2454
2697
  }
2455
- function createStylePipeline(options) {
2698
+ function createStylePipeline(options, signal) {
2456
2699
  options.ctx = createContext();
2457
- const preparedNodes = createPreparedNodes(options);
2700
+ const preparedNodes = createPreparedNodes(options, signal);
2458
2701
  if (preparedNodes.length === 0) {
2459
2702
  return {
2460
2703
  nodes: [],
@@ -2513,7 +2756,7 @@ function createStylePipeline(options) {
2513
2756
  function createProcessOptions(options) {
2514
2757
  return {
2515
2758
  from: void 0,
2516
- ..._nullishCoalesce(_optionalChain([options, 'access', _76 => _76.postcssOptions, 'optionalAccess', _77 => _77.options]), () => ( {}))
2759
+ ..._nullishCoalesce(_optionalChain([options, 'access', _101 => _101.postcssOptions, 'optionalAccess', _102 => _102.options]), () => ( {}))
2517
2760
  };
2518
2761
  }
2519
2762
  function getSimpleProcessOptionsCacheKey(options) {
@@ -2545,14 +2788,13 @@ function getSimpleProcessOptionsCacheKey(options) {
2545
2788
  }
2546
2789
  return parts.join("|");
2547
2790
  }
2548
- var StyleProcessorCache = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);_class.prototype.__init5.call(this); }
2549
- __init() {this.pipelineCache = /* @__PURE__ */ new WeakMap()}
2791
+ var StyleProcessorCache = (_class = class {constructor() { _class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this); }
2792
+ __init() {this.pipelineCacheByKey = /* @__PURE__ */ new Map()}
2550
2793
  __init2() {this.processOptionsCache = /* @__PURE__ */ new WeakMap()}
2551
- __init3() {this.processorCache = /* @__PURE__ */ new WeakMap()}
2552
- __init4() {this.processorCacheByKey = /* @__PURE__ */ new Map()}
2553
- __init5() {this.processorKeyCache = /* @__PURE__ */ new WeakMap()}
2794
+ __init3() {this.processorCacheByKey = /* @__PURE__ */ new Map()}
2795
+ __init4() {this.processorKeyCache = /* @__PURE__ */ new WeakMap()}
2554
2796
  createProcessorCacheKey(options) {
2555
- const from = _optionalChain([options, 'access', _78 => _78.postcssOptions, 'optionalAccess', _79 => _79.options, 'optionalAccess', _80 => _80.from]);
2797
+ const from = _optionalChain([options, 'access', _103 => _103.postcssOptions, 'optionalAccess', _104 => _104.options, 'optionalAccess', _105 => _105.from]);
2556
2798
  if (from == null) {
2557
2799
  return fingerprintOptions(options);
2558
2800
  }
@@ -2561,22 +2803,37 @@ var StyleProcessorCache = (_class = class {constructor() { _class.prototype.__in
2561
2803
  postcssOptions: {
2562
2804
  ..._nullishCoalesce(options.postcssOptions, () => ( {})),
2563
2805
  options: {
2564
- ..._nullishCoalesce(_optionalChain([options, 'access', _81 => _81.postcssOptions, 'optionalAccess', _82 => _82.options]), () => ( {})),
2806
+ ..._nullishCoalesce(_optionalChain([options, 'access', _106 => _106.postcssOptions, 'optionalAccess', _107 => _107.options]), () => ( {})),
2565
2807
  from: void 0
2566
2808
  }
2567
2809
  }
2568
2810
  });
2569
2811
  }
2570
- getPipeline(options) {
2571
- let pipeline = this.pipelineCache.get(options);
2812
+ /**
2813
+ * 构建包含信号的复合缓存键
2814
+ */
2815
+ createCompositeCacheKey(optionsFingerprint, signal) {
2816
+ if (!signal) {
2817
+ return optionsFingerprint;
2818
+ }
2819
+ return `${optionsFingerprint}|${signalToCacheKey(signal)}`;
2820
+ }
2821
+ getPipeline(options, signal) {
2822
+ let optionsKey = this.processorKeyCache.get(options);
2823
+ if (!optionsKey) {
2824
+ optionsKey = this.createProcessorCacheKey(options);
2825
+ this.processorKeyCache.set(options, optionsKey);
2826
+ }
2827
+ const compositeKey = this.createCompositeCacheKey(optionsKey, signal);
2828
+ let pipeline = this.pipelineCacheByKey.get(compositeKey);
2572
2829
  if (!pipeline) {
2573
- pipeline = createStylePipeline(options);
2574
- this.pipelineCache.set(options, pipeline);
2830
+ pipeline = createStylePipeline(options, signal);
2831
+ this.pipelineCacheByKey.set(compositeKey, pipeline);
2575
2832
  }
2576
2833
  return pipeline;
2577
2834
  }
2578
2835
  getProcessOptions(options) {
2579
- const source = _optionalChain([options, 'access', _83 => _83.postcssOptions, 'optionalAccess', _84 => _84.options]);
2836
+ const source = _optionalChain([options, 'access', _108 => _108.postcssOptions, 'optionalAccess', _109 => _109.options]);
2580
2837
  const cacheKey = source ? _nullishCoalesce(getSimpleProcessOptionsCacheKey(source), () => ( fingerprintOptions(source))) : void 0;
2581
2838
  const cached = this.processOptionsCache.get(options);
2582
2839
  if (!cached || cached.cacheKey !== cacheKey) {
@@ -2586,27 +2843,33 @@ var StyleProcessorCache = (_class = class {constructor() { _class.prototype.__in
2586
2843
  }
2587
2844
  return { ...cached.value };
2588
2845
  }
2589
- getProcessor(options) {
2590
- let processor = this.processorCache.get(options);
2846
+ getProcessor(options, signal) {
2847
+ let optionsKey = this.processorKeyCache.get(options);
2848
+ if (!optionsKey) {
2849
+ optionsKey = this.createProcessorCacheKey(options);
2850
+ this.processorKeyCache.set(options, optionsKey);
2851
+ }
2852
+ const compositeKey = this.createCompositeCacheKey(optionsKey, signal);
2853
+ let processor = this.processorCacheByKey.get(compositeKey);
2591
2854
  if (!processor) {
2592
- let cacheKey = this.processorKeyCache.get(options);
2593
- if (!cacheKey) {
2594
- cacheKey = this.createProcessorCacheKey(options);
2595
- this.processorKeyCache.set(options, cacheKey);
2596
- }
2597
- processor = this.processorCacheByKey.get(cacheKey);
2598
- if (!processor) {
2599
- const pipeline = this.getPipeline(options);
2600
- processor = _postcss2.default.call(void 0, pipeline.plugins);
2601
- this.processorCacheByKey.set(cacheKey, processor);
2602
- }
2603
- this.processorCache.set(options, processor);
2855
+ const pipeline = this.getPipeline(options, signal);
2856
+ processor = _postcss2.default.call(void 0, pipeline.plugins);
2857
+ this.processorCacheByKey.set(compositeKey, processor);
2604
2858
  }
2605
2859
  return processor;
2606
2860
  }
2607
2861
  }, _class);
2608
2862
 
2609
2863
  // src/handler.ts
2864
+ var CSS_RESULT_CACHE_MAX = 256;
2865
+ function simpleHash(str) {
2866
+ let hash = 2166136261 | 0;
2867
+ for (let i = 0; i < str.length; i++) {
2868
+ hash ^= str.charCodeAt(i);
2869
+ hash = hash * 16777619 | 0;
2870
+ }
2871
+ return (hash >>> 0).toString(36);
2872
+ }
2610
2873
  function createStyleHandler(options) {
2611
2874
  const cachedOptions = _shared.defuOverrideArray.call(void 0,
2612
2875
  options,
@@ -2614,22 +2877,57 @@ function createStyleHandler(options) {
2614
2877
  );
2615
2878
  cachedOptions.cssInjectPreflight = createInjectPreflight(cachedOptions.cssPreflight);
2616
2879
  const resolver = createOptionsResolver(cachedOptions);
2617
- const cache = new StyleProcessorCache();
2880
+ const processorCache = new StyleProcessorCache();
2618
2881
  const base = resolver.resolve();
2619
- cache.getProcessor(base);
2620
- cache.getProcessOptions(base);
2882
+ processorCache.getProcessor(base);
2883
+ processorCache.getProcessOptions(base);
2884
+ const optionsFingerprintCache = /* @__PURE__ */ new WeakMap();
2885
+ function getOptionsFingerprint(opts) {
2886
+ const cached = optionsFingerprintCache.get(opts);
2887
+ if (cached) {
2888
+ return cached;
2889
+ }
2890
+ const fp = fingerprintOptions(opts);
2891
+ optionsFingerprintCache.set(opts, fp);
2892
+ return fp;
2893
+ }
2894
+ const resultCache = new (0, _lrucache.LRUCache)({ max: CSS_RESULT_CACHE_MAX });
2895
+ const hasUserPlugins = Boolean(
2896
+ _optionalChain([cachedOptions, 'access', _110 => _110.postcssOptions, 'optionalAccess', _111 => _111.plugins]) && (Array.isArray(cachedOptions.postcssOptions.plugins) ? cachedOptions.postcssOptions.plugins.length > 0 : typeof cachedOptions.postcssOptions.plugins === "object" && Object.keys(cachedOptions.postcssOptions.plugins).length > 0)
2897
+ );
2621
2898
  const handler = ((rawSource, opt) => {
2622
2899
  const resolvedOptions = resolver.resolve(opt);
2623
- const processor = cache.getProcessor(resolvedOptions);
2624
- const processOptions = cache.getProcessOptions(resolvedOptions);
2900
+ let signal;
2901
+ if (!hasUserPlugins) {
2902
+ try {
2903
+ signal = probeFeatures(rawSource);
2904
+ } catch (e3) {
2905
+ signal = void 0;
2906
+ }
2907
+ }
2908
+ const optsFp = getOptionsFingerprint(resolvedOptions);
2909
+ const signalKey = signal ? signalToCacheKey(signal) : "";
2910
+ const contentHash = simpleHash(rawSource);
2911
+ const cacheKey = `${optsFp}|${signalKey}|${contentHash}`;
2912
+ const cachedResult = resultCache.get(cacheKey);
2913
+ if (cachedResult) {
2914
+ return Promise.resolve(cachedResult);
2915
+ }
2916
+ const processor = processorCache.getProcessor(resolvedOptions, signal);
2917
+ const processOptions = processorCache.getProcessOptions(resolvedOptions);
2625
2918
  return processor.process(
2626
2919
  rawSource,
2627
2920
  processOptions
2628
- ).async().then((result) => applyUniAppXBaseCompatibility(result, resolvedOptions));
2921
+ ).async().then((result) => {
2922
+ const baseCompatible = applyUniAppXBaseCompatibility(result, resolvedOptions);
2923
+ const finalResult = applyUniAppXUvueCompatibility(baseCompatible, resolvedOptions);
2924
+ resultCache.set(cacheKey, finalResult);
2925
+ return finalResult;
2926
+ });
2629
2927
  });
2630
2928
  handler.getPipeline = (opt) => {
2631
2929
  const resolvedOptions = resolver.resolve(opt);
2632
- return cache.getPipeline(resolvedOptions);
2930
+ return processorCache.getPipeline(resolvedOptions);
2633
2931
  };
2634
2932
  return handler;
2635
2933
  }
@@ -2639,4 +2937,5 @@ function createStyleHandler(options) {
2639
2937
 
2640
2938
 
2641
2939
 
2642
- exports.createFallbackPlaceholderReplacer = createFallbackPlaceholderReplacer; exports.createInjectPreflight = createInjectPreflight; exports.createStyleHandler = createStyleHandler; exports.createStylePipeline = createStylePipeline; exports.internalCssSelectorReplacer = internalCssSelectorReplacer;
2940
+
2941
+ exports.createFallbackPlaceholderReplacer = createFallbackPlaceholderReplacer; exports.createInjectPreflight = createInjectPreflight; exports.createStyleHandler = createStyleHandler; exports.createStylePipeline = createStylePipeline; exports.internalCssSelectorReplacer = internalCssSelectorReplacer; exports.postcssHtmlTransform = _chunk2Y3ULRB3js.html_transform_default;