@weapp-tailwindcss/postcss 1.0.19 → 1.0.21

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,9 @@ function createRuleTransform(rule, options) {
190
190
  }
191
191
  }
192
192
  }
193
+ if (uniAppX) {
194
+ selector.remove();
195
+ }
193
196
  } else if (selector.type === "combinator") {
194
197
  if (selector.value === ">") {
195
198
  const nodes2 = _optionalChain([selector, 'access', _5 => _5.parent, 'optionalAccess', _6 => _6.nodes]);
@@ -211,6 +214,19 @@ function createRuleTransform(rule, options) {
211
214
  }
212
215
  }
213
216
  }
217
+ } else if (selector.type === "tag") {
218
+ if (uniAppX) {
219
+ selector.remove();
220
+ }
221
+ } else if (selector.type === "attribute") {
222
+ if (uniAppX) {
223
+ selector.remove();
224
+ }
225
+ }
226
+ });
227
+ selectors.walk((selector) => {
228
+ if (selector.type === "selector") {
229
+ selector.length === 0 && selector.remove();
214
230
  }
215
231
  });
216
232
  if (selectors.length === 0) {
@@ -252,8 +268,7 @@ function getFallbackRemove(rule) {
252
268
  }
253
269
  if (selector.type === "universal") {
254
270
  _optionalChain([selector, 'access', _13 => _13.parent, 'optionalAccess', _14 => _14.remove, 'call', _15 => _15()]);
255
- }
256
- if (selector.type === "pseudo") {
271
+ } else if (selector.type === "pseudo") {
257
272
  if (selector.value === ":is") {
258
273
  if (maybeImportantId && _optionalChain([selector, 'access', _16 => _16.nodes, 'access', _17 => _17[0], 'optionalAccess', _18 => _18.type]) === "selector") {
259
274
  selector.replaceWith(selector.nodes[0]);
@@ -279,8 +294,7 @@ function getFallbackRemove(rule) {
279
294
  }
280
295
  }
281
296
  }
282
- }
283
- if (selector.type === "attribute") {
297
+ } else if (selector.type === "attribute") {
284
298
  if (selector.attribute === "hidden") {
285
299
  _optionalChain([rule, 'optionalAccess', _22 => _22.remove, 'call', _23 => _23()]);
286
300
  }
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,9 @@ function createRuleTransform(rule, options) {
190
190
  }
191
191
  }
192
192
  }
193
+ if (uniAppX) {
194
+ selector.remove();
195
+ }
193
196
  } else if (selector.type === "combinator") {
194
197
  if (selector.value === ">") {
195
198
  const nodes2 = selector.parent?.nodes;
@@ -211,6 +214,19 @@ function createRuleTransform(rule, options) {
211
214
  }
212
215
  }
213
216
  }
217
+ } else if (selector.type === "tag") {
218
+ if (uniAppX) {
219
+ selector.remove();
220
+ }
221
+ } else if (selector.type === "attribute") {
222
+ if (uniAppX) {
223
+ selector.remove();
224
+ }
225
+ }
226
+ });
227
+ selectors.walk((selector) => {
228
+ if (selector.type === "selector") {
229
+ selector.length === 0 && selector.remove();
214
230
  }
215
231
  });
216
232
  if (selectors.length === 0) {
@@ -252,8 +268,7 @@ function getFallbackRemove(rule) {
252
268
  }
253
269
  if (selector.type === "universal") {
254
270
  selector.parent?.remove();
255
- }
256
- if (selector.type === "pseudo") {
271
+ } else if (selector.type === "pseudo") {
257
272
  if (selector.value === ":is") {
258
273
  if (maybeImportantId && selector.nodes[0]?.type === "selector") {
259
274
  selector.replaceWith(selector.nodes[0]);
@@ -279,8 +294,7 @@ function getFallbackRemove(rule) {
279
294
  }
280
295
  }
281
296
  }
282
- }
283
- if (selector.type === "attribute") {
297
+ } else if (selector.type === "attribute") {
284
298
  if (selector.attribute === "hidden") {
285
299
  rule?.remove();
286
300
  }
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.21",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",