@weapp-tailwindcss/postcss 1.0.19 → 1.0.20

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
@@ -123,7 +123,7 @@ function getCombinatorSelectorAst(options) {
123
123
  return childCombinatorReplaceValue;
124
124
  }
125
125
  function createRuleTransform(rule, options) {
126
- const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass } = options;
126
+ const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass, uniAppX } = options;
127
127
  const transform = (selectors) => {
128
128
  selectors.walk((selector, index) => {
129
129
  if (selector.type === "class") {
@@ -190,6 +190,11 @@ function createRuleTransform(rule, options) {
190
190
  }
191
191
  }
192
192
  }
193
+ if (uniAppX) {
194
+ if (selector.value === "::before" || selector.value === "::after" || selector.value === "::backdrop" || selector.value === "::file-selector-button") {
195
+ selector.remove();
196
+ }
197
+ }
193
198
  } else if (selector.type === "combinator") {
194
199
  if (selector.value === ">") {
195
200
  const nodes2 = _optionalChain([selector, 'access', _5 => _5.parent, 'optionalAccess', _6 => _6.nodes]);
@@ -213,6 +218,11 @@ function createRuleTransform(rule, options) {
213
218
  }
214
219
  }
215
220
  });
221
+ selectors.walk((selector) => {
222
+ if (selector.type === "selector") {
223
+ selector.length === 0 && selector.remove();
224
+ }
225
+ });
216
226
  if (selectors.length === 0) {
217
227
  rule.remove();
218
228
  }
@@ -252,8 +262,7 @@ function getFallbackRemove(rule) {
252
262
  }
253
263
  if (selector.type === "universal") {
254
264
  _optionalChain([selector, 'access', _13 => _13.parent, 'optionalAccess', _14 => _14.remove, 'call', _15 => _15()]);
255
- }
256
- if (selector.type === "pseudo") {
265
+ } else if (selector.type === "pseudo") {
257
266
  if (selector.value === ":is") {
258
267
  if (maybeImportantId && _optionalChain([selector, 'access', _16 => _16.nodes, 'access', _17 => _17[0], 'optionalAccess', _18 => _18.type]) === "selector") {
259
268
  selector.replaceWith(selector.nodes[0]);
@@ -279,8 +288,7 @@ function getFallbackRemove(rule) {
279
288
  }
280
289
  }
281
290
  }
282
- }
283
- if (selector.type === "attribute") {
291
+ } else if (selector.type === "attribute") {
284
292
  if (selector.attribute === "hidden") {
285
293
  _optionalChain([rule, 'optionalAccess', _22 => _22.remove, 'call', _23 => _23()]);
286
294
  }
package/dist/index.mjs CHANGED
@@ -123,7 +123,7 @@ function getCombinatorSelectorAst(options) {
123
123
  return childCombinatorReplaceValue;
124
124
  }
125
125
  function createRuleTransform(rule, options) {
126
- const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass } = options;
126
+ const { escapeMap, mangleContext, cssSelectorReplacement, cssRemoveHoverPseudoClass, uniAppX } = options;
127
127
  const transform = (selectors) => {
128
128
  selectors.walk((selector, index) => {
129
129
  if (selector.type === "class") {
@@ -190,6 +190,11 @@ function createRuleTransform(rule, options) {
190
190
  }
191
191
  }
192
192
  }
193
+ if (uniAppX) {
194
+ if (selector.value === "::before" || selector.value === "::after" || selector.value === "::backdrop" || selector.value === "::file-selector-button") {
195
+ selector.remove();
196
+ }
197
+ }
193
198
  } else if (selector.type === "combinator") {
194
199
  if (selector.value === ">") {
195
200
  const nodes2 = selector.parent?.nodes;
@@ -213,6 +218,11 @@ function createRuleTransform(rule, options) {
213
218
  }
214
219
  }
215
220
  });
221
+ selectors.walk((selector) => {
222
+ if (selector.type === "selector") {
223
+ selector.length === 0 && selector.remove();
224
+ }
225
+ });
216
226
  if (selectors.length === 0) {
217
227
  rule.remove();
218
228
  }
@@ -252,8 +262,7 @@ function getFallbackRemove(rule) {
252
262
  }
253
263
  if (selector.type === "universal") {
254
264
  selector.parent?.remove();
255
- }
256
- if (selector.type === "pseudo") {
265
+ } else if (selector.type === "pseudo") {
257
266
  if (selector.value === ":is") {
258
267
  if (maybeImportantId && selector.nodes[0]?.type === "selector") {
259
268
  selector.replaceWith(selector.nodes[0]);
@@ -279,8 +288,7 @@ function getFallbackRemove(rule) {
279
288
  }
280
289
  }
281
290
  }
282
- }
283
- if (selector.type === "attribute") {
291
+ } else if (selector.type === "attribute") {
284
292
  if (selector.attribute === "hidden") {
285
293
  rule?.remove();
286
294
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "1.0.19",
3
+ "version": "1.0.20",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",