@weapp-tailwindcss/postcss 2.2.0-next.0 → 2.2.0

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.d.mts CHANGED
@@ -1,12 +1,12 @@
1
- import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-DJDvtI8K.mjs';
2
- export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions, k as createInjectPreflight, l as createStylePipeline } from './types-DJDvtI8K.mjs';
1
+ import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-DiOShlJF.mjs';
2
+ export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions, l as createInjectPreflight, m as createStylePipeline } from './types-DiOShlJF.mjs';
3
3
  export { IOptions as PostcssHtmlTransformOptions, default as postcssHtmlTransform } from './html-transform.mjs';
4
4
  export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
5
5
  export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
6
- export { UserDefinedOptions as UnitsToPxOptions } from 'postcss-units-to-px';
7
6
  import '@weapp-tailwindcss/postcss-calc';
8
7
  import 'postcss';
9
8
  import 'postcss-load-config';
9
+ import 'postcss-rule-unit-converter';
10
10
  import 'autoprefixer';
11
11
 
12
12
  declare function createStyleHandler(options?: Partial<IStyleHandlerOptions>): StyleHandler;
package/dist/index.d.ts CHANGED
@@ -1,12 +1,12 @@
1
- import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-DJDvtI8K.js';
2
- export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions, k as createInjectPreflight, l as createStylePipeline } from './types-DJDvtI8K.js';
1
+ import { I as IStyleHandlerOptions, S as StyleHandler, a as InternalCssSelectorReplacerOptions } from './types-DiOShlJF.js';
2
+ export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, L as LoadedPostcssOptions, P as PipelineNodeContext, d as PipelineNodeCursor, e as PipelineStage, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, g as ResolvedPipelineNode, h as StyleProcessingPipeline, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions, l as createInjectPreflight, m as createStylePipeline } from './types-DiOShlJF.js';
3
3
  export { IOptions as PostcssHtmlTransformOptions, default as postcssHtmlTransform } from './html-transform.js';
4
4
  export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
5
5
  export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
6
- export { UserDefinedOptions as UnitsToPxOptions } from 'postcss-units-to-px';
7
6
  import '@weapp-tailwindcss/postcss-calc';
8
7
  import 'postcss';
9
8
  import 'postcss-load-config';
9
+ import 'postcss-rule-unit-converter';
10
10
  import 'autoprefixer';
11
11
 
12
12
  declare function createStyleHandler(options?: Partial<IStyleHandlerOptions>): StyleHandler;
package/dist/index.js CHANGED
@@ -704,7 +704,7 @@ function getCalcDuplicateCleaner(options) {
704
704
  // src/plugins/getCalcPlugin.ts
705
705
  var _postcsscalc = require('@weapp-tailwindcss/postcss-calc'); var _postcsscalc2 = _interopRequireDefault(_postcsscalc);
706
706
 
707
- // ../../node_modules/.pnpm/es-toolkit@1.46.0/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
708
708
  function omit(obj, keys) {
709
709
  const result = { ...obj };
710
710
  for (let i = 0; i < keys.length; i++) {
@@ -839,13 +839,52 @@ function getRemTransformPlugin(options) {
839
839
  }
840
840
 
841
841
  // src/plugins/getUnitsToPxPlugin.ts
842
- var _postcssunitstopx = require('postcss-units-to-px'); var _postcssunitstopx2 = _interopRequireDefault(_postcssunitstopx);
842
+ var _postcssruleunitconverter = require('postcss-rule-unit-converter'); var _postcssruleunitconverter2 = _interopRequireDefault(_postcssruleunitconverter);
843
843
  function getUnitsToPxPlugin(options) {
844
844
  if (!options.unitsToPx) {
845
845
  return null;
846
846
  }
847
847
  const userOptions = typeof options.unitsToPx === "object" ? options.unitsToPx : void 0;
848
- 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);
849
888
  }
850
889
 
851
890
  // src/plugins/post.ts
@@ -854,7 +893,7 @@ function getUnitsToPxPlugin(options) {
854
893
  // src/compat/tailwindcss-rpx.ts
855
894
  var LENGTH_VALUE_REGEXP = /^[+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?rpx$/i;
856
895
  function normalizeTailwindcssRpxDeclaration(decl, options) {
857
- const majorVersion = _optionalChain([options, 'optionalAccess', _24 => _24.majorVersion]);
896
+ const majorVersion = _optionalChain([options, 'optionalAccess', _36 => _36.majorVersion]);
858
897
  const normalizedValue = decl.value.trim();
859
898
  if (LENGTH_VALUE_REGEXP.test(normalizedValue) && (majorVersion === void 0 || majorVersion === 2 || majorVersion === 3 || majorVersion === 4)) {
860
899
  const lowerProp = decl.prop.toLowerCase();
@@ -1038,10 +1077,11 @@ var MODERN_CHECK_WEBKIT_HYPHENS_RE = /-webkit-hyphens\s*:\s*none/;
1038
1077
  var MODERN_CHECK_MARGIN_TRIM_RE = /margin-trim\s*:\s*inline/;
1039
1078
  var MODERN_CHECK_MOZ_ORIENT_RE = /-moz-orient\s*:\s*inline/;
1040
1079
  var MODERN_CHECK_COLOR_RGB_RE = /color\s*:\s*rgb\(\s*from\s+red\s+r\s+g\s+b\s*\)/;
1080
+ var LINEAR_GRADIENT_LAB_RE = /background-image\s*:\s*linear-gradient\(\s*in\s+lab\s*,\s*red\s*,\s*red\s*\)/;
1041
1081
  var RADIUS_VALUE_RE = /\b([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*(r?px)\b/gi;
1042
1082
  var SCIENTIFIC_NOTATION_RE = /e/i;
1043
1083
  function isTailwindcssV4(options) {
1044
- return _optionalChain([options, 'optionalAccess', _25 => _25.majorVersion]) === 4;
1084
+ return _optionalChain([options, 'optionalAccess', _37 => _37.majorVersion]) === 4;
1045
1085
  }
1046
1086
  function testIfRootHostForV4(node) {
1047
1087
  return node.type === "rule" && node.selector.includes(":root") && node.selector.includes(":host");
@@ -1055,6 +1095,9 @@ function isTailwindcssV4ModernCheck(atRule) {
1055
1095
  MODERN_CHECK_COLOR_RGB_RE
1056
1096
  ].every((regex) => regex.test(atRule.params));
1057
1097
  }
1098
+ function isTailwindcssV4LinearGradientSupports(atRule) {
1099
+ return atRule.name === "supports" && LINEAR_GRADIENT_LAB_RE.test(atRule.params);
1100
+ }
1058
1101
  function normalizeTailwindcssV4Declaration(decl) {
1059
1102
  if (decl.prop === "--tw-gradient-position" && decl.value.endsWith(OKLAB_SUFFIX)) {
1060
1103
  decl.value = decl.value.slice(0, decl.value.length - OKLAB_SUFFIX.length);
@@ -1101,7 +1144,7 @@ var beforeAfterParser = _postcssselectorparser2.default.call(void 0, (selectors)
1101
1144
  return;
1102
1145
  }
1103
1146
  selectors.walkPseudos((s) => {
1104
- if (_optionalChain([s, 'access', _26 => _26.parent, 'optionalAccess', _27 => _27.length]) === 1) {
1147
+ if (_optionalChain([s, 'access', _38 => _38.parent, 'optionalAccess', _39 => _39.length]) === 1) {
1105
1148
  if (BEFORE_PSEUDO_RE.test(s.value)) {
1106
1149
  state.before = true;
1107
1150
  }
@@ -1204,13 +1247,13 @@ function getFallbackRemove(_rule, options) {
1204
1247
  maybeImportantId = true;
1205
1248
  }
1206
1249
  if (selector.type === "universal") {
1207
- _optionalChain([selector, 'access', _28 => _28.parent, 'optionalAccess', _29 => _29.remove, 'call', _30 => _30()]);
1250
+ _optionalChain([selector, 'access', _40 => _40.parent, 'optionalAccess', _41 => _41.remove, 'call', _42 => _42()]);
1208
1251
  } else if (selector.type === "pseudo") {
1209
1252
  if (selector.value === ":is") {
1210
- if (maybeImportantId && _optionalChain([selector, 'access', _31 => _31.nodes, 'access', _32 => _32[0], 'optionalAccess', _33 => _33.type]) === "selector") {
1253
+ if (maybeImportantId && _optionalChain([selector, 'access', _43 => _43.nodes, 'access', _44 => _44[0], 'optionalAccess', _45 => _45.type]) === "selector") {
1211
1254
  selector.replaceWith(selector.nodes[0]);
1212
1255
  } else {
1213
- _optionalChain([selector, 'access', _34 => _34.parent, 'optionalAccess', _35 => _35.remove, 'call', _36 => _36()]);
1256
+ _optionalChain([selector, 'access', _46 => _46.parent, 'optionalAccess', _47 => _47.remove, 'call', _48 => _48()]);
1214
1257
  }
1215
1258
  } else if (selector.value === ":not") {
1216
1259
  for (const x of selector.nodes) {
@@ -1233,7 +1276,7 @@ function getFallbackRemove(_rule, options) {
1233
1276
  }
1234
1277
  } else if (selector.type === "attribute") {
1235
1278
  if (selector.attribute === "hidden") {
1236
- _optionalChain([activeRule, 'optionalAccess', _37 => _37.remove, 'call', _38 => _38()]);
1279
+ _optionalChain([activeRule, 'optionalAccess', _49 => _49.remove, 'call', _50 => _50()]);
1237
1280
  }
1238
1281
  }
1239
1282
  });
@@ -1251,19 +1294,21 @@ function getFallbackRemove(_rule, options) {
1251
1294
  });
1252
1295
  });
1253
1296
  const rawTransformSync = parser.transformSync.bind(parser);
1254
- const transform = (targetRule) => {
1297
+ const transformRule = (targetRule, transformOptions = FALLBACK_TRANSFORM_OPTIONS) => {
1255
1298
  const sourceSelector = targetRule.selector;
1256
1299
  if (!sourceSelector) {
1257
1300
  return;
1258
1301
  }
1259
- const cached = selectorCache.get(sourceSelector);
1260
- if (cached) {
1261
- if (cached.action === "remove") {
1262
- targetRule.remove();
1263
- } else if (cached.action === "update" && cached.selector && cached.selector !== sourceSelector) {
1264
- targetRule.selector = cached.selector;
1302
+ if (transformOptions === FALLBACK_TRANSFORM_OPTIONS) {
1303
+ const cached = selectorCache.get(sourceSelector);
1304
+ if (cached) {
1305
+ if (cached.action === "remove") {
1306
+ targetRule.remove();
1307
+ } else if (cached.action === "update" && cached.selector && cached.selector !== sourceSelector) {
1308
+ targetRule.selector = cached.selector;
1309
+ }
1310
+ return;
1265
1311
  }
1266
- return;
1267
1312
  }
1268
1313
  currentRule = targetRule;
1269
1314
  try {
@@ -1271,13 +1316,15 @@ function getFallbackRemove(_rule, options) {
1271
1316
  } finally {
1272
1317
  currentRule = void 0;
1273
1318
  }
1274
- const wasRemoved = targetRule.parent == null;
1275
- if (wasRemoved) {
1276
- writeSelectorCache2(sourceSelector, { action: "remove" });
1277
- } else if (targetRule.selector === sourceSelector) {
1278
- writeSelectorCache2(sourceSelector, { action: "keep" });
1279
- } else {
1280
- writeSelectorCache2(sourceSelector, { action: "update", selector: targetRule.selector });
1319
+ if (transformOptions === FALLBACK_TRANSFORM_OPTIONS) {
1320
+ const wasRemoved = targetRule.parent == null;
1321
+ if (wasRemoved) {
1322
+ writeSelectorCache2(sourceSelector, { action: "remove" });
1323
+ } else if (targetRule.selector === sourceSelector) {
1324
+ writeSelectorCache2(sourceSelector, { action: "keep" });
1325
+ } else {
1326
+ writeSelectorCache2(sourceSelector, { action: "update", selector: targetRule.selector });
1327
+ }
1281
1328
  }
1282
1329
  };
1283
1330
  parser.transformSync = ((input, opts) => {
@@ -1285,19 +1332,14 @@ function getFallbackRemove(_rule, options) {
1285
1332
  if (input && typeof input === "object" && "type" in input) {
1286
1333
  const maybeRule = input;
1287
1334
  if (maybeRule.type === "rule") {
1288
- currentRule = input;
1289
- try {
1290
- return rawTransformSync(input, transformOptions);
1291
- } finally {
1292
- currentRule = void 0;
1293
- }
1335
+ transformRule(input, transformOptions);
1336
+ return void 0;
1294
1337
  }
1295
1338
  }
1296
1339
  return rawTransformSync(input, transformOptions);
1297
1340
  });
1298
1341
  entry = {
1299
- parser,
1300
- transform
1342
+ parser
1301
1343
  };
1302
1344
  fallbackRemoveCache.set(cacheKey, entry);
1303
1345
  }
@@ -1319,7 +1361,7 @@ function getEscapeOptions(escapeMap) {
1319
1361
  return cached;
1320
1362
  }
1321
1363
  function internalCssSelectorReplacer(selectors, options) {
1322
- const escapeMap = _optionalChain([options, 'optionalAccess', _39 => _39.escapeMap]);
1364
+ const escapeMap = _optionalChain([options, 'optionalAccess', _51 => _51.escapeMap]);
1323
1365
  if (escapeMap === void 0 || escapeMap === _escape.MappingChars2String) {
1324
1366
  return _escape.escape.call(void 0, selectors);
1325
1367
  }
@@ -1363,7 +1405,7 @@ function reorderLiteralFirst(rule, declarations, isVariable) {
1363
1405
  if (alreadyOrdered) {
1364
1406
  return;
1365
1407
  }
1366
- const anchor = _nullishCoalesce(_optionalChain([declarations, 'access', _40 => _40.at, 'call', _41 => _41(-1), 'optionalAccess', _42 => _42.next, 'call', _43 => _43()]), () => ( void 0));
1408
+ const anchor = _nullishCoalesce(_optionalChain([declarations, 'access', _52 => _52.at, 'call', _53 => _53(-1), 'optionalAccess', _54 => _54.next, 'call', _55 => _55()]), () => ( void 0));
1367
1409
  for (const decl of declarations) {
1368
1410
  decl.remove();
1369
1411
  }
@@ -1441,7 +1483,7 @@ function isNotLastChildPseudo(node) {
1441
1483
  if (!firstSelector || firstSelector.type !== "selector") {
1442
1484
  return false;
1443
1485
  }
1444
- const target = _optionalChain([firstSelector, 'access', _44 => _44.nodes, 'optionalAccess', _45 => _45[0]]);
1486
+ const target = _optionalChain([firstSelector, 'access', _56 => _56.nodes, 'optionalAccess', _57 => _57[0]]);
1445
1487
  return Boolean(target && target.type === "pseudo" && target.value === ":last-child");
1446
1488
  }
1447
1489
  function transformSpacingSelector(nodes2, options) {
@@ -1553,7 +1595,7 @@ function flattenWherePseudo(node, context, index, parent) {
1553
1595
  node.value = ":is";
1554
1596
  }
1555
1597
  if (index === 0 && node.length === 1) {
1556
- const targetSelector = _optionalChain([node, 'access', _46 => _46.nodes, 'optionalAccess', _47 => _47[0]]);
1598
+ const targetSelector = _optionalChain([node, 'access', _58 => _58.nodes, 'optionalAccess', _59 => _59[0]]);
1557
1599
  if (targetSelector && targetSelector.type === "selector" && transformSpacingSelector(targetSelector.nodes, context.options)) {
1558
1600
  context.requiresSpacingNormalization = true;
1559
1601
  }
@@ -1621,7 +1663,7 @@ function handleCombinatorNode(node, index, context) {
1621
1663
  if (node.type !== "combinator" || node.value !== ">") {
1622
1664
  return;
1623
1665
  }
1624
- const nodes2 = _optionalChain([node, 'access', _48 => _48.parent, 'optionalAccess', _49 => _49.nodes]);
1666
+ const nodes2 = _optionalChain([node, 'access', _60 => _60.parent, 'optionalAccess', _61 => _61.nodes]);
1625
1667
  if (!nodes2) {
1626
1668
  return;
1627
1669
  }
@@ -1674,7 +1716,7 @@ function canSkipRuleTransform(rule) {
1674
1716
  }
1675
1717
  function transformSelectors(selectors, context) {
1676
1718
  selectors.walk((node, index) => {
1677
- const parent = _optionalChain([node, 'access', _50 => _50.parent, 'optionalAccess', _51 => _51.type]) === "selector" ? node.parent : void 0;
1719
+ const parent = _optionalChain([node, 'access', _62 => _62.parent, 'optionalAccess', _63 => _63.type]) === "selector" ? node.parent : void 0;
1678
1720
  switch (node.type) {
1679
1721
  case "class":
1680
1722
  handleClassNode(node, context);
@@ -1721,8 +1763,8 @@ function createRuleTransformer(options) {
1721
1763
  let context;
1722
1764
  const selectorResultCache = /* @__PURE__ */ new Map();
1723
1765
  const selectorResultCacheLimit = 5e4;
1724
- const rootReplacement = _optionalChain([options, 'access', _52 => _52.cssSelectorReplacement, 'optionalAccess', _53 => _53.root]) ? composeIsPseudo(options.cssSelectorReplacement.root) : void 0;
1725
- const universalReplacement = _optionalChain([options, 'access', _54 => _54.cssSelectorReplacement, 'optionalAccess', _55 => _55.universal]) ? composeIsPseudo(options.cssSelectorReplacement.universal) : void 0;
1766
+ const rootReplacement = _optionalChain([options, 'access', _64 => _64.cssSelectorReplacement, 'optionalAccess', _65 => _65.root]) ? composeIsPseudo(options.cssSelectorReplacement.root) : void 0;
1767
+ const universalReplacement = _optionalChain([options, 'access', _66 => _66.cssSelectorReplacement, 'optionalAccess', _67 => _67.universal]) ? composeIsPseudo(options.cssSelectorReplacement.universal) : void 0;
1726
1768
  const selectorReplacerOptions = options.escapeMap ? { escapeMap: options.escapeMap } : void 0;
1727
1769
  function writeSelectorResultCache(selector, result) {
1728
1770
  if (selectorResultCache.size >= selectorResultCacheLimit) {
@@ -1770,7 +1812,7 @@ function createRuleTransformer(options) {
1770
1812
  } finally {
1771
1813
  const currentContext = context;
1772
1814
  wasRemoved = rule.parent == null;
1773
- requiresSpacingNormalization = _optionalChain([currentContext, 'optionalAccess', _56 => _56.requiresSpacingNormalization]) === true;
1815
+ requiresSpacingNormalization = _optionalChain([currentContext, 'optionalAccess', _68 => _68.requiresSpacingNormalization]) === true;
1774
1816
  context = void 0;
1775
1817
  }
1776
1818
  if (wasRemoved) {
@@ -2002,7 +2044,7 @@ function normalizeSelectorList(value) {
2002
2044
  return Array.isArray(value) ? value.filter(Boolean) : [value];
2003
2045
  }
2004
2046
  function getSpecificityMatchingName(options) {
2005
- const feature = _optionalChain([options, 'access', _57 => _57.cssPresetEnv, 'optionalAccess', _58 => _58.features, 'optionalAccess', _59 => _59["is-pseudo-class"]]);
2047
+ const feature = _optionalChain([options, 'access', _69 => _69.cssPresetEnv, 'optionalAccess', _70 => _70.features, 'optionalAccess', _71 => _71["is-pseudo-class"]]);
2006
2048
  if (feature && typeof feature === "object" && "specificityMatchingName" in feature) {
2007
2049
  const specificityName = feature.specificityMatchingName;
2008
2050
  return typeof specificityName === "string" && specificityName.length > 0 ? specificityName : void 0;
@@ -2050,12 +2092,12 @@ function createFallbackPlaceholderCleaner() {
2050
2092
  }
2051
2093
  function createRootSpecificityCleaner(options) {
2052
2094
  const specificityMatchingName = getSpecificityMatchingName(options);
2053
- const selectors = normalizeSelectorList(_optionalChain([options, 'access', _60 => _60.cssSelectorReplacement, 'optionalAccess', _61 => _61.root]));
2095
+ const selectors = normalizeSelectorList(_optionalChain([options, 'access', _72 => _72.cssSelectorReplacement, 'optionalAccess', _73 => _73.root]));
2054
2096
  if (!specificityMatchingName || selectors.length === 0) {
2055
2097
  return void 0;
2056
2098
  }
2057
2099
  const suffix = `:not(.${specificityMatchingName})`;
2058
- const targets = selectors.map((selector) => _optionalChain([selector, 'optionalAccess', _62 => _62.trim, 'call', _63 => _63()])).filter((selector) => Boolean(_optionalChain([selector, 'optionalAccess', _64 => _64.length]))).map((selector) => ({
2100
+ 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) => ({
2059
2101
  match: `${selector}${suffix}`,
2060
2102
  spacedMatch: `${selector} ${suffix}`,
2061
2103
  replacement: selector
@@ -2099,7 +2141,7 @@ function normalizeRootSelectors(value) {
2099
2141
  return Array.isArray(value) ? value.filter(Boolean) : [value];
2100
2142
  }
2101
2143
  function createHostSelectorAppender(options) {
2102
- const rootSelectors = normalizeRootSelectors(_optionalChain([options, 'access', _65 => _65.cssSelectorReplacement, 'optionalAccess', _66 => _66.root]));
2144
+ const rootSelectors = normalizeRootSelectors(_optionalChain([options, 'access', _77 => _77.cssSelectorReplacement, 'optionalAccess', _78 => _78.root]));
2103
2145
  const shouldAppendHostSelector = rootSelectors.length === DEFAULT_ROOT_SELECTORS.length && rootSelectors.every((selector, index) => selector === DEFAULT_ROOT_SELECTORS[index]);
2104
2146
  if (!shouldAppendHostSelector) {
2105
2147
  return void 0;
@@ -2127,12 +2169,12 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
2127
2169
  const fallbackRemove = enableMainChunkTransforms ? getFallbackRemove(void 0, opts) : void 0;
2128
2170
  p.RuleExit = (rule) => {
2129
2171
  if (enableMainChunkTransforms) {
2130
- _optionalChain([fallbackRemove, 'optionalAccess', _67 => _67.transformSync, 'call', _68 => _68(rule)]);
2172
+ _optionalChain([fallbackRemove, 'optionalAccess', _79 => _79.transformSync, 'call', _80 => _80(rule)]);
2131
2173
  }
2132
2174
  cleanFallbackPlaceholder(rule);
2133
- _optionalChain([cleanRootSpecificity, 'optionalCall', _69 => _69(rule)]);
2175
+ _optionalChain([cleanRootSpecificity, 'optionalCall', _81 => _81(rule)]);
2134
2176
  if (enableMainChunkTransforms) {
2135
- if (_optionalChain([shouldAppendHostSelector, 'optionalCall', _70 => _70(rule)])) {
2177
+ if (_optionalChain([shouldAppendHostSelector, 'optionalCall', _82 => _82(rule)])) {
2136
2178
  appendRuleSelector(rule, ":host", {
2137
2179
  phase: "post",
2138
2180
  reason: "append-host-selector"
@@ -2161,7 +2203,7 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
2161
2203
  if (opts.cssRemoveProperty && atRule.name === "property") {
2162
2204
  atRule.remove();
2163
2205
  }
2164
- _optionalChain([atRule, 'access', _71 => _71.nodes, 'optionalAccess', _72 => _72.length]) === 0 && atRule.remove();
2206
+ _optionalChain([atRule, 'access', _83 => _83.nodes, 'optionalAccess', _84 => _84.length]) === 0 && atRule.remove();
2165
2207
  };
2166
2208
  }
2167
2209
  return p;
@@ -2443,7 +2485,7 @@ function remakeCssVarSelector(selectors, options) {
2443
2485
  return selectors;
2444
2486
  }
2445
2487
  function resolveUniAppXVariableScopeSelectors(options) {
2446
- const universal = _optionalChain([options, 'access', _73 => _73.cssSelectorReplacement, 'optionalAccess', _74 => _74.universal]);
2488
+ const universal = _optionalChain([options, 'access', _85 => _85.cssSelectorReplacement, 'optionalAccess', _86 => _86.universal]);
2447
2489
  if (Array.isArray(universal) && universal.length > 0) {
2448
2490
  return [...universal];
2449
2491
  }
@@ -2455,7 +2497,7 @@ function resolveUniAppXVariableScopeSelectors(options) {
2455
2497
  function commonChunkPreflight(node, options) {
2456
2498
  const { ctx, cssInjectPreflight, injectAdditionalCssVarScope } = options;
2457
2499
  const uniAppXEnabled = isUniAppXEnabled(options);
2458
- const rootOption = _optionalChain([options, 'access', _75 => _75.cssSelectorReplacement, 'optionalAccess', _76 => _76.root]);
2500
+ const rootOption = _optionalChain([options, 'access', _87 => _87.cssSelectorReplacement, 'optionalAccess', _88 => _88.root]);
2459
2501
  const rootSelectors = rootOption === false || rootOption === void 0 ? [] : Array.isArray(rootOption) ? rootOption.filter(Boolean) : [rootOption];
2460
2502
  const hasHostSelector = node.selectors.some((selector) => selector.includes(":host"));
2461
2503
  const hasRootPseudoSelector = node.selectors.some((selector) => selector.includes(":root"));
@@ -2467,7 +2509,7 @@ function commonChunkPreflight(node, options) {
2467
2509
  });
2468
2510
  }
2469
2511
  if (testIfVariablesScope(node) || uniAppXEnabled && node.selectors.includes("*") && hasTwVars(node, 2)) {
2470
- _optionalChain([ctx, 'optionalAccess', _77 => _77.markVariablesScope, 'call', _78 => _78(node)]);
2512
+ _optionalChain([ctx, 'optionalAccess', _89 => _89.markVariablesScope, 'call', _90 => _90(node)]);
2471
2513
  assignRuleSelectors(node, uniAppXEnabled ? resolveUniAppXVariableScopeSelectors(options) : remakeCssVarSelector(node.selectors, options), {
2472
2514
  phase: "pre",
2473
2515
  reason: "rewrite-variable-scope"
@@ -2525,6 +2567,8 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
2525
2567
  } else if (atRule.name === "supports") {
2526
2568
  if (COLOR_MIX_RE.test(atRule.params)) {
2527
2569
  atRule.remove();
2570
+ } else if (isTailwindcssV4LinearGradientSupports(atRule)) {
2571
+ atRule.remove();
2528
2572
  }
2529
2573
  } else if (atRule.name === "layer") {
2530
2574
  if (atRule.nodes === void 0 || Array.isArray(atRule.nodes) && atRule.nodes.length === 0) {
@@ -2539,9 +2583,9 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
2539
2583
  root.walkAtRules((atRule) => {
2540
2584
  if (atRule.name === "layer") {
2541
2585
  if (atRule.params === "properties") {
2542
- if (atRule.nodes === void 0 || _optionalChain([atRule, 'access', _79 => _79.nodes, 'optionalAccess', _80 => _80.length]) === 0) {
2586
+ if (atRule.nodes === void 0 || _optionalChain([atRule, 'access', _91 => _91.nodes, 'optionalAccess', _92 => _92.length]) === 0) {
2543
2587
  layerProperties = atRule;
2544
- } else if (_optionalChain([atRule, 'access', _81 => _81.first, 'optionalAccess', _82 => _82.type]) === "atrule" && isTailwindcssV4ModernCheck(atRule.first)) {
2588
+ } else if (_optionalChain([atRule, 'access', _93 => _93.first, 'optionalAccess', _94 => _94.type]) === "atrule" && isTailwindcssV4ModernCheck(atRule.first)) {
2545
2589
  if (layerProperties) {
2546
2590
  layerProperties.replaceWith(atRule.first.nodes);
2547
2591
  atRule.remove();
@@ -2553,7 +2597,7 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
2553
2597
  atRule.replaceWith(atRule.nodes);
2554
2598
  }
2555
2599
  } else if (isTailwindcssV4ModernCheck(atRule)) {
2556
- if (_optionalChain([atRule, 'access', _83 => _83.first, 'optionalAccess', _84 => _84.type]) === "atrule" && atRule.first.name === "layer") {
2600
+ if (_optionalChain([atRule, 'access', _95 => _95.first, 'optionalAccess', _96 => _96.type]) === "atrule" && atRule.first.name === "layer") {
2557
2601
  atRule.replaceWith(atRule.first.nodes);
2558
2602
  }
2559
2603
  }
@@ -2601,7 +2645,7 @@ function shouldUseDefaultAutoprefixer(options, userPlugins) {
2601
2645
  if (options.autoprefixer === false) {
2602
2646
  return false;
2603
2647
  }
2604
- if (hasUserAutoprefixerPlugin(_optionalChain([options, 'access', _85 => _85.postcssOptions, 'optionalAccess', _86 => _86.plugins]), userPlugins)) {
2648
+ if (hasUserAutoprefixerPlugin(_optionalChain([options, 'access', _97 => _97.postcssOptions, 'optionalAccess', _98 => _98.plugins]), userPlugins)) {
2605
2649
  return false;
2606
2650
  }
2607
2651
  if (options.autoprefixer === true || typeof options.autoprefixer === "object") {
@@ -2611,7 +2655,7 @@ function shouldUseDefaultAutoprefixer(options, userPlugins) {
2611
2655
  }
2612
2656
  function createPreparedNodes(options, signal) {
2613
2657
  const preparedNodes = [];
2614
- const userPlugins = normalizeUserPlugins(_optionalChain([options, 'access', _87 => _87.postcssOptions, 'optionalAccess', _88 => _88.plugins]));
2658
+ const userPlugins = normalizeUserPlugins(_optionalChain([options, 'access', _99 => _99.postcssOptions, 'optionalAccess', _100 => _100.plugins]));
2615
2659
  const presetEnvOptions = options.cssPresetEnv;
2616
2660
  userPlugins.forEach((plugin, index) => {
2617
2661
  preparedNodes.push(createPreparedNode(`pre:user-${index}`, "pre", () => plugin));
@@ -2717,7 +2761,7 @@ function createStylePipeline(options, signal) {
2717
2761
  function createProcessOptions(options) {
2718
2762
  return {
2719
2763
  from: void 0,
2720
- ..._nullishCoalesce(_optionalChain([options, 'access', _89 => _89.postcssOptions, 'optionalAccess', _90 => _90.options]), () => ( {}))
2764
+ ..._nullishCoalesce(_optionalChain([options, 'access', _101 => _101.postcssOptions, 'optionalAccess', _102 => _102.options]), () => ( {}))
2721
2765
  };
2722
2766
  }
2723
2767
  function getSimpleProcessOptionsCacheKey(options) {
@@ -2755,7 +2799,7 @@ var StyleProcessorCache = (_class = class {constructor() { _class.prototype.__in
2755
2799
  __init3() {this.processorCacheByKey = /* @__PURE__ */ new Map()}
2756
2800
  __init4() {this.processorKeyCache = /* @__PURE__ */ new WeakMap()}
2757
2801
  createProcessorCacheKey(options) {
2758
- const from = _optionalChain([options, 'access', _91 => _91.postcssOptions, 'optionalAccess', _92 => _92.options, 'optionalAccess', _93 => _93.from]);
2802
+ const from = _optionalChain([options, 'access', _103 => _103.postcssOptions, 'optionalAccess', _104 => _104.options, 'optionalAccess', _105 => _105.from]);
2759
2803
  if (from == null) {
2760
2804
  return fingerprintOptions(options);
2761
2805
  }
@@ -2764,7 +2808,7 @@ var StyleProcessorCache = (_class = class {constructor() { _class.prototype.__in
2764
2808
  postcssOptions: {
2765
2809
  ..._nullishCoalesce(options.postcssOptions, () => ( {})),
2766
2810
  options: {
2767
- ..._nullishCoalesce(_optionalChain([options, 'access', _94 => _94.postcssOptions, 'optionalAccess', _95 => _95.options]), () => ( {})),
2811
+ ..._nullishCoalesce(_optionalChain([options, 'access', _106 => _106.postcssOptions, 'optionalAccess', _107 => _107.options]), () => ( {})),
2768
2812
  from: void 0
2769
2813
  }
2770
2814
  }
@@ -2794,7 +2838,7 @@ var StyleProcessorCache = (_class = class {constructor() { _class.prototype.__in
2794
2838
  return pipeline;
2795
2839
  }
2796
2840
  getProcessOptions(options) {
2797
- const source = _optionalChain([options, 'access', _96 => _96.postcssOptions, 'optionalAccess', _97 => _97.options]);
2841
+ const source = _optionalChain([options, 'access', _108 => _108.postcssOptions, 'optionalAccess', _109 => _109.options]);
2798
2842
  const cacheKey = source ? _nullishCoalesce(getSimpleProcessOptionsCacheKey(source), () => ( fingerprintOptions(source))) : void 0;
2799
2843
  const cached = this.processOptionsCache.get(options);
2800
2844
  if (!cached || cached.cacheKey !== cacheKey) {
@@ -2854,7 +2898,7 @@ function createStyleHandler(options) {
2854
2898
  }
2855
2899
  const resultCache = new (0, _lrucache.LRUCache)({ max: CSS_RESULT_CACHE_MAX });
2856
2900
  const hasUserPlugins = Boolean(
2857
- _optionalChain([cachedOptions, 'access', _98 => _98.postcssOptions, 'optionalAccess', _99 => _99.plugins]) && (Array.isArray(cachedOptions.postcssOptions.plugins) ? cachedOptions.postcssOptions.plugins.length > 0 : typeof cachedOptions.postcssOptions.plugins === "object" && Object.keys(cachedOptions.postcssOptions.plugins).length > 0)
2901
+ _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)
2858
2902
  );
2859
2903
  const handler = ((rawSource, opt) => {
2860
2904
  const resolvedOptions = resolver.resolve(opt);
package/dist/index.mjs CHANGED
@@ -704,7 +704,7 @@ function getCalcDuplicateCleaner(options) {
704
704
  // src/plugins/getCalcPlugin.ts
705
705
  import postcssCalc from "@weapp-tailwindcss/postcss-calc";
706
706
 
707
- // ../../node_modules/.pnpm/es-toolkit@1.46.0/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
708
708
  function omit(obj, keys) {
709
709
  const result = { ...obj };
710
710
  for (let i = 0; i < keys.length; i++) {
@@ -839,13 +839,52 @@ function getRemTransformPlugin(options) {
839
839
  }
840
840
 
841
841
  // src/plugins/getUnitsToPxPlugin.ts
842
- import postcssUnitsToPx from "postcss-units-to-px";
842
+ import postcssUnitConverter, { presets } from "postcss-rule-unit-converter";
843
843
  function getUnitsToPxPlugin(options) {
844
844
  if (!options.unitsToPx) {
845
845
  return null;
846
846
  }
847
847
  const userOptions = typeof options.unitsToPx === "object" ? options.unitsToPx : void 0;
848
- return postcssUnitsToPx(userOptions);
848
+ if (userOptions?.disabled || userOptions?.transform === false) {
849
+ return postcssUnitConverter({ disabled: true });
850
+ }
851
+ const presetOptions = {};
852
+ const converterOptions = {
853
+ rules: []
854
+ };
855
+ if (userOptions?.minValue !== void 0) {
856
+ presetOptions.minValue = userOptions.minValue;
857
+ converterOptions.minValue = userOptions.minValue;
858
+ }
859
+ if (userOptions?.to !== void 0) {
860
+ presetOptions.to = userOptions.to;
861
+ }
862
+ if (userOptions?.transform !== void 0) {
863
+ presetOptions.transform = userOptions.transform;
864
+ }
865
+ if (userOptions?.unitMap !== void 0) {
866
+ presetOptions.unitMap = userOptions.unitMap;
867
+ }
868
+ if (userOptions?.exclude !== void 0) {
869
+ converterOptions.exclude = userOptions.exclude;
870
+ }
871
+ if (userOptions?.mediaQuery !== void 0) {
872
+ converterOptions.mediaQuery = userOptions.mediaQuery;
873
+ }
874
+ if (userOptions?.propList !== void 0) {
875
+ converterOptions.propList = userOptions.propList;
876
+ }
877
+ if (userOptions?.replace !== void 0) {
878
+ converterOptions.replace = userOptions.replace;
879
+ }
880
+ if (userOptions?.selectorBlackList !== void 0) {
881
+ converterOptions.selectorBlackList = userOptions.selectorBlackList;
882
+ }
883
+ if (userOptions?.unitPrecision !== void 0) {
884
+ converterOptions.unitPrecision = userOptions.unitPrecision;
885
+ }
886
+ converterOptions.rules = presets.unitsToPx(presetOptions);
887
+ return postcssUnitConverter(converterOptions);
849
888
  }
850
889
 
851
890
  // src/plugins/post.ts
@@ -1038,6 +1077,7 @@ var MODERN_CHECK_WEBKIT_HYPHENS_RE = /-webkit-hyphens\s*:\s*none/;
1038
1077
  var MODERN_CHECK_MARGIN_TRIM_RE = /margin-trim\s*:\s*inline/;
1039
1078
  var MODERN_CHECK_MOZ_ORIENT_RE = /-moz-orient\s*:\s*inline/;
1040
1079
  var MODERN_CHECK_COLOR_RGB_RE = /color\s*:\s*rgb\(\s*from\s+red\s+r\s+g\s+b\s*\)/;
1080
+ var LINEAR_GRADIENT_LAB_RE = /background-image\s*:\s*linear-gradient\(\s*in\s+lab\s*,\s*red\s*,\s*red\s*\)/;
1041
1081
  var RADIUS_VALUE_RE = /\b([+-]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[+-]?\d+)?)\s*(r?px)\b/gi;
1042
1082
  var SCIENTIFIC_NOTATION_RE = /e/i;
1043
1083
  function isTailwindcssV4(options) {
@@ -1055,6 +1095,9 @@ function isTailwindcssV4ModernCheck(atRule) {
1055
1095
  MODERN_CHECK_COLOR_RGB_RE
1056
1096
  ].every((regex) => regex.test(atRule.params));
1057
1097
  }
1098
+ function isTailwindcssV4LinearGradientSupports(atRule) {
1099
+ return atRule.name === "supports" && LINEAR_GRADIENT_LAB_RE.test(atRule.params);
1100
+ }
1058
1101
  function normalizeTailwindcssV4Declaration(decl) {
1059
1102
  if (decl.prop === "--tw-gradient-position" && decl.value.endsWith(OKLAB_SUFFIX)) {
1060
1103
  decl.value = decl.value.slice(0, decl.value.length - OKLAB_SUFFIX.length);
@@ -1251,19 +1294,21 @@ function getFallbackRemove(_rule, options) {
1251
1294
  });
1252
1295
  });
1253
1296
  const rawTransformSync = parser.transformSync.bind(parser);
1254
- const transform = (targetRule) => {
1297
+ const transformRule = (targetRule, transformOptions = FALLBACK_TRANSFORM_OPTIONS) => {
1255
1298
  const sourceSelector = targetRule.selector;
1256
1299
  if (!sourceSelector) {
1257
1300
  return;
1258
1301
  }
1259
- const cached = selectorCache.get(sourceSelector);
1260
- if (cached) {
1261
- if (cached.action === "remove") {
1262
- targetRule.remove();
1263
- } else if (cached.action === "update" && cached.selector && cached.selector !== sourceSelector) {
1264
- targetRule.selector = cached.selector;
1302
+ if (transformOptions === FALLBACK_TRANSFORM_OPTIONS) {
1303
+ const cached = selectorCache.get(sourceSelector);
1304
+ if (cached) {
1305
+ if (cached.action === "remove") {
1306
+ targetRule.remove();
1307
+ } else if (cached.action === "update" && cached.selector && cached.selector !== sourceSelector) {
1308
+ targetRule.selector = cached.selector;
1309
+ }
1310
+ return;
1265
1311
  }
1266
- return;
1267
1312
  }
1268
1313
  currentRule = targetRule;
1269
1314
  try {
@@ -1271,13 +1316,15 @@ function getFallbackRemove(_rule, options) {
1271
1316
  } finally {
1272
1317
  currentRule = void 0;
1273
1318
  }
1274
- const wasRemoved = targetRule.parent == null;
1275
- if (wasRemoved) {
1276
- writeSelectorCache2(sourceSelector, { action: "remove" });
1277
- } else if (targetRule.selector === sourceSelector) {
1278
- writeSelectorCache2(sourceSelector, { action: "keep" });
1279
- } else {
1280
- writeSelectorCache2(sourceSelector, { action: "update", selector: targetRule.selector });
1319
+ if (transformOptions === FALLBACK_TRANSFORM_OPTIONS) {
1320
+ const wasRemoved = targetRule.parent == null;
1321
+ if (wasRemoved) {
1322
+ writeSelectorCache2(sourceSelector, { action: "remove" });
1323
+ } else if (targetRule.selector === sourceSelector) {
1324
+ writeSelectorCache2(sourceSelector, { action: "keep" });
1325
+ } else {
1326
+ writeSelectorCache2(sourceSelector, { action: "update", selector: targetRule.selector });
1327
+ }
1281
1328
  }
1282
1329
  };
1283
1330
  parser.transformSync = ((input, opts) => {
@@ -1285,19 +1332,14 @@ function getFallbackRemove(_rule, options) {
1285
1332
  if (input && typeof input === "object" && "type" in input) {
1286
1333
  const maybeRule = input;
1287
1334
  if (maybeRule.type === "rule") {
1288
- currentRule = input;
1289
- try {
1290
- return rawTransformSync(input, transformOptions);
1291
- } finally {
1292
- currentRule = void 0;
1293
- }
1335
+ transformRule(input, transformOptions);
1336
+ return void 0;
1294
1337
  }
1295
1338
  }
1296
1339
  return rawTransformSync(input, transformOptions);
1297
1340
  });
1298
1341
  entry = {
1299
- parser,
1300
- transform
1342
+ parser
1301
1343
  };
1302
1344
  fallbackRemoveCache.set(cacheKey, entry);
1303
1345
  }
@@ -2525,6 +2567,8 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
2525
2567
  } else if (atRule.name === "supports") {
2526
2568
  if (COLOR_MIX_RE.test(atRule.params)) {
2527
2569
  atRule.remove();
2570
+ } else if (isTailwindcssV4LinearGradientSupports(atRule)) {
2571
+ atRule.remove();
2528
2572
  }
2529
2573
  } else if (atRule.name === "layer") {
2530
2574
  if (atRule.nodes === void 0 || Array.isArray(atRule.nodes) && atRule.nodes.length === 0) {
@@ -3,7 +3,7 @@ import { AcceptedPlugin, Result as Result$1 } from 'postcss';
3
3
  import { Result } from 'postcss-load-config';
4
4
  import { PxTransformOptions } from 'postcss-pxtrans';
5
5
  import { UserDefinedOptions } from 'postcss-rem-to-responsive-pixel';
6
- import { UserDefinedOptions as UserDefinedOptions$1 } from 'postcss-units-to-px';
6
+ import { UserDefinedOptions as UserDefinedOptions$1, UnitMap, GlobalUnitTransform } from 'postcss-rule-unit-converter';
7
7
  import autoprefixer from 'autoprefixer';
8
8
 
9
9
  type AutoprefixerOptions = autoprefixer.Options;
@@ -118,6 +118,12 @@ interface InternalCssSelectorReplacerOptions {
118
118
  interface CssCalcOptions extends PostCssCalcOptions {
119
119
  includeCustomProperties?: (string | RegExp)[];
120
120
  }
121
+ interface UnitsToPxOptions extends Pick<UserDefinedOptions$1, 'disabled' | 'exclude' | 'mediaQuery' | 'propList' | 'replace' | 'selectorBlackList' | 'unitPrecision'> {
122
+ minValue?: number;
123
+ to?: string;
124
+ unitMap?: UnitMap;
125
+ transform?: GlobalUnitTransform | false;
126
+ }
121
127
  type IStyleHandlerOptions = {
122
128
  ctx?: IContext;
123
129
  postcssOptions?: LoadedPostcssOptions;
@@ -149,7 +155,7 @@ interface UserDefinedPostcssOptions {
149
155
  };
150
156
  rem2rpx?: boolean | UserDefinedOptions;
151
157
  px2rpx?: boolean | PxTransformOptions;
152
- unitsToPx?: boolean | UserDefinedOptions$1;
158
+ unitsToPx?: boolean | UnitsToPxOptions;
153
159
  postcssOptions?: LoadedPostcssOptions;
154
160
  cssRemoveHoverPseudoClass?: boolean;
155
161
  cssRemoveProperty?: boolean;
@@ -163,4 +169,4 @@ interface StyleHandler {
163
169
  getPipeline: (opt?: Partial<IStyleHandlerOptions>) => StyleProcessingPipeline;
164
170
  }
165
171
 
166
- export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type UniAppXCssTarget as U, type WeappAutoprefixerOptions as W, type InternalCssSelectorReplacerOptions as a, type CssPreflightOptions as b, type IPropValue as c, type PipelineNodeCursor as d, type PipelineStage as e, type PresetEnvOptions as f, type ResolvedPipelineNode as g, type StyleProcessingPipeline as h, type UniAppXUnsupportedMode as i, type UserDefinedPostcssOptions as j, createInjectPreflight as k, createStylePipeline as l };
172
+ export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type UniAppXCssTarget as U, type WeappAutoprefixerOptions as W, type InternalCssSelectorReplacerOptions as a, type CssPreflightOptions as b, type IPropValue as c, type PipelineNodeCursor as d, type PipelineStage as e, type PresetEnvOptions as f, type ResolvedPipelineNode as g, type StyleProcessingPipeline as h, type UniAppXUnsupportedMode as i, type UnitsToPxOptions as j, type UserDefinedPostcssOptions as k, createInjectPreflight as l, createStylePipeline as m };
@@ -3,7 +3,7 @@ import { AcceptedPlugin, Result as Result$1 } from 'postcss';
3
3
  import { Result } from 'postcss-load-config';
4
4
  import { PxTransformOptions } from 'postcss-pxtrans';
5
5
  import { UserDefinedOptions } from 'postcss-rem-to-responsive-pixel';
6
- import { UserDefinedOptions as UserDefinedOptions$1 } from 'postcss-units-to-px';
6
+ import { UserDefinedOptions as UserDefinedOptions$1, UnitMap, GlobalUnitTransform } from 'postcss-rule-unit-converter';
7
7
  import autoprefixer from 'autoprefixer';
8
8
 
9
9
  type AutoprefixerOptions = autoprefixer.Options;
@@ -118,6 +118,12 @@ interface InternalCssSelectorReplacerOptions {
118
118
  interface CssCalcOptions extends PostCssCalcOptions {
119
119
  includeCustomProperties?: (string | RegExp)[];
120
120
  }
121
+ interface UnitsToPxOptions extends Pick<UserDefinedOptions$1, 'disabled' | 'exclude' | 'mediaQuery' | 'propList' | 'replace' | 'selectorBlackList' | 'unitPrecision'> {
122
+ minValue?: number;
123
+ to?: string;
124
+ unitMap?: UnitMap;
125
+ transform?: GlobalUnitTransform | false;
126
+ }
121
127
  type IStyleHandlerOptions = {
122
128
  ctx?: IContext;
123
129
  postcssOptions?: LoadedPostcssOptions;
@@ -149,7 +155,7 @@ interface UserDefinedPostcssOptions {
149
155
  };
150
156
  rem2rpx?: boolean | UserDefinedOptions;
151
157
  px2rpx?: boolean | PxTransformOptions;
152
- unitsToPx?: boolean | UserDefinedOptions$1;
158
+ unitsToPx?: boolean | UnitsToPxOptions;
153
159
  postcssOptions?: LoadedPostcssOptions;
154
160
  cssRemoveHoverPseudoClass?: boolean;
155
161
  cssRemoveProperty?: boolean;
@@ -163,4 +169,4 @@ interface StyleHandler {
163
169
  getPipeline: (opt?: Partial<IStyleHandlerOptions>) => StyleProcessingPipeline;
164
170
  }
165
171
 
166
- export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type UniAppXCssTarget as U, type WeappAutoprefixerOptions as W, type InternalCssSelectorReplacerOptions as a, type CssPreflightOptions as b, type IPropValue as c, type PipelineNodeCursor as d, type PipelineStage as e, type PresetEnvOptions as f, type ResolvedPipelineNode as g, type StyleProcessingPipeline as h, type UniAppXUnsupportedMode as i, type UserDefinedPostcssOptions as j, createInjectPreflight as k, createStylePipeline as l };
172
+ export { type CssCalcOptions as C, type IStyleHandlerOptions as I, type LoadedPostcssOptions as L, type PipelineNodeContext as P, type RequiredStyleHandlerOptions as R, type StyleHandler as S, type UniAppXCssTarget as U, type WeappAutoprefixerOptions as W, type InternalCssSelectorReplacerOptions as a, type CssPreflightOptions as b, type IPropValue as c, type PipelineNodeCursor as d, type PipelineStage as e, type PresetEnvOptions as f, type ResolvedPipelineNode as g, type StyleProcessingPipeline as h, type UniAppXUnsupportedMode as i, type UnitsToPxOptions as j, type UserDefinedPostcssOptions as k, createInjectPreflight as l, createStylePipeline as m };
package/dist/types.d.mts CHANGED
@@ -3,6 +3,6 @@ import 'postcss';
3
3
  import 'postcss-load-config';
4
4
  export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
5
5
  export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
6
- export { UserDefinedOptions as UnitsToPxOptions } from 'postcss-units-to-px';
7
- export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions } from './types-DJDvtI8K.mjs';
6
+ import 'postcss-rule-unit-converter';
7
+ export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions } from './types-DiOShlJF.mjs';
8
8
  import 'autoprefixer';
package/dist/types.d.ts CHANGED
@@ -3,6 +3,6 @@ import 'postcss';
3
3
  import 'postcss-load-config';
4
4
  export { PxTransformOptions as Px2rpxOptions } from 'postcss-pxtrans';
5
5
  export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
6
- export { UserDefinedOptions as UnitsToPxOptions } from 'postcss-units-to-px';
7
- export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions } from './types-DJDvtI8K.js';
6
+ import 'postcss-rule-unit-converter';
7
+ export { C as CssCalcOptions, b as CssPreflightOptions, c as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, f as PresetEnvOptions, R as RequiredStyleHandlerOptions, S as StyleHandler, U as UniAppXCssTarget, i as UniAppXUnsupportedMode, j as UnitsToPxOptions, k as UserDefinedPostcssOptions, W as WeappAutoprefixerOptions } from './types-DiOShlJF.js';
8
8
  import 'autoprefixer';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "2.2.0-next.0",
3
+ "version": "2.2.0",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -60,12 +60,12 @@
60
60
  "@weapp-tailwindcss/postcss-calc": "^1.0.0",
61
61
  "autoprefixer": "^10.5.0",
62
62
  "lru-cache": "10.4.3",
63
- "postcss": "^8.5.12",
63
+ "postcss": "^8.5.13",
64
64
  "postcss-preset-env": "^10.6.1",
65
65
  "postcss-pxtrans": "^1.0.4",
66
66
  "postcss-rem-to-responsive-pixel": "^7.0.4",
67
+ "postcss-rule-unit-converter": "^0.2.2",
67
68
  "postcss-selector-parser": "~7.1.1",
68
- "postcss-units-to-px": "^0.2.2",
69
69
  "postcss-value-parser": "^4.2.0",
70
70
  "@weapp-tailwindcss/shared": "1.1.3"
71
71
  },