@weapp-tailwindcss/postcss 3.2.5 → 3.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3047,8 +3047,14 @@ function isWebCssCompatEnabled(options) {
3047
3047
  }
3048
3048
  function collectCustomPropertyValues(root) {
3049
3049
  const values = /* @__PURE__ */ new Map();
3050
- root.walkDecls((decl) => {
3051
- if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
3050
+ root.walkRules((rule) => {
3051
+ if (!rule.selectors.some((selector) => selector.trim() === ":root" || selector.trim() === ":host")) return;
3052
+ rule.each((node) => {
3053
+ if (node.type === "decl" && node.prop.startsWith("--") && !node.prop.startsWith("--tw-")) {
3054
+ const decl = node;
3055
+ values.set(decl.prop, decl.value.trim());
3056
+ }
3057
+ });
3052
3058
  });
3053
3059
  return values;
3054
3060
  }
@@ -6507,8 +6513,27 @@ function shouldUseDefaultAutoprefixer(options, userPlugins) {
6507
6513
  if (options.autoprefixer === true || typeof options.autoprefixer === "object") return true;
6508
6514
  return options.majorVersion === 4;
6509
6515
  }
6516
+ function isUniAppXNativeAuthorStyle(options) {
6517
+ const source = options.uniAppXCssSource;
6518
+ return options.uniAppX === true && options.uniAppXCssTarget === "uvue" && (source === "author" || source === "author-apply");
6519
+ }
6520
+ function appendUniAppXNativeAuthorDeclarationNodes(preparedNodes, options) {
6521
+ if (options.uniAppXCssSource !== "author-apply") return;
6522
+ const declarationPlugins = [
6523
+ ["normal:units-to-px", getUnitsToPxPlugin(options)],
6524
+ ["normal:px-transform", getPxTransformPlugin(options)],
6525
+ ["normal:rem-transform", getRemTransformPlugin(options)],
6526
+ ["normal:unit-conversion", getUnitConversionPlugin(options)],
6527
+ ["normal:calc", getCalcPlugin(options)]
6528
+ ];
6529
+ for (const [id, plugin] of declarationPlugins) if (plugin) preparedNodes.push(createPreparedNode(id, "normal", () => plugin));
6530
+ }
6510
6531
  function createPreparedNodes(options, signal) {
6511
6532
  const preparedNodes = [];
6533
+ if (isUniAppXNativeAuthorStyle(options)) {
6534
+ appendUniAppXNativeAuthorDeclarationNodes(preparedNodes, options);
6535
+ return preparedNodes;
6536
+ }
6512
6537
  const userPlugins = normalizeUserPlugins(options.postcssOptions?.plugins);
6513
6538
  const presetEnvOptions = {
6514
6539
  ...options.cssPresetEnv,
package/dist/index.js CHANGED
@@ -3032,8 +3032,14 @@ function isWebCssCompatEnabled(options) {
3032
3032
  }
3033
3033
  function collectCustomPropertyValues(root) {
3034
3034
  const values = /* @__PURE__ */ new Map();
3035
- root.walkDecls((decl) => {
3036
- if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
3035
+ root.walkRules((rule) => {
3036
+ if (!rule.selectors.some((selector) => selector.trim() === ":root" || selector.trim() === ":host")) return;
3037
+ rule.each((node) => {
3038
+ if (node.type === "decl" && node.prop.startsWith("--") && !node.prop.startsWith("--tw-")) {
3039
+ const decl = node;
3040
+ values.set(decl.prop, decl.value.trim());
3041
+ }
3042
+ });
3037
3043
  });
3038
3044
  return values;
3039
3045
  }
@@ -6492,8 +6498,27 @@ function shouldUseDefaultAutoprefixer(options, userPlugins) {
6492
6498
  if (options.autoprefixer === true || typeof options.autoprefixer === "object") return true;
6493
6499
  return options.majorVersion === 4;
6494
6500
  }
6501
+ function isUniAppXNativeAuthorStyle(options) {
6502
+ const source = options.uniAppXCssSource;
6503
+ return options.uniAppX === true && options.uniAppXCssTarget === "uvue" && (source === "author" || source === "author-apply");
6504
+ }
6505
+ function appendUniAppXNativeAuthorDeclarationNodes(preparedNodes, options) {
6506
+ if (options.uniAppXCssSource !== "author-apply") return;
6507
+ const declarationPlugins = [
6508
+ ["normal:units-to-px", getUnitsToPxPlugin(options)],
6509
+ ["normal:px-transform", getPxTransformPlugin(options)],
6510
+ ["normal:rem-transform", getRemTransformPlugin(options)],
6511
+ ["normal:unit-conversion", getUnitConversionPlugin(options)],
6512
+ ["normal:calc", getCalcPlugin(options)]
6513
+ ];
6514
+ for (const [id, plugin] of declarationPlugins) if (plugin) preparedNodes.push(createPreparedNode(id, "normal", () => plugin));
6515
+ }
6495
6516
  function createPreparedNodes(options, signal) {
6496
6517
  const preparedNodes = [];
6518
+ if (isUniAppXNativeAuthorStyle(options)) {
6519
+ appendUniAppXNativeAuthorDeclarationNodes(preparedNodes, options);
6520
+ return preparedNodes;
6521
+ }
6497
6522
  const userPlugins = normalizeUserPlugins(options.postcssOptions?.plugins);
6498
6523
  const presetEnvOptions = {
6499
6524
  ...options.cssPresetEnv,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
3
  "type": "module",
4
- "version": "3.2.5",
4
+ "version": "3.2.6",
5
5
  "description": "@weapp-tailwindcss/postcss",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -74,7 +74,7 @@
74
74
  "es-toolkit": "^1.50.0",
75
75
  "lru-cache": "11.5.2",
76
76
  "micromatch": "^4.0.8",
77
- "postcss": "^8.5.24",
77
+ "postcss": "^8.5.25",
78
78
  "postcss-load-config": "^6.0.1",
79
79
  "postcss-preset-env": "^11.3.2",
80
80
  "postcss-pxtrans": "^1.0.4",
@@ -83,8 +83,8 @@
83
83
  "postcss-selector-parser": "~7.1.4",
84
84
  "postcss-value-parser": "^4.2.0",
85
85
  "@weapp-tailwindcss/postcss-calc": "^1.0.3",
86
- "@weapp-tailwindcss/shared": "2.0.1",
87
- "tailwindcss-config": "2.0.2"
86
+ "tailwindcss-config": "2.0.2",
87
+ "@weapp-tailwindcss/shared": "2.0.1"
88
88
  },
89
89
  "devDependencies": {
90
90
  "@csstools/postcss-is-pseudo-class": "^6.0.0",