weapp-tailwindcss 3.0.2 → 3.0.4

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/README.md CHANGED
@@ -21,8 +21,12 @@
21
21
  [![test](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/sonofmagic/weapp-tailwindcss/actions/workflows/test.yml)
22
22
  [![codecov](https://codecov.io/gh/sonofmagic/weapp-tailwindcss/branch/main/graph/badge.svg?token=zn05qXYznt)](https://codecov.io/gh/sonofmagic/weapp-tailwindcss)
23
23
 
24
- > `小程序` + `tailwindcss` 全方面解决方案
25
- > 想试试在小程序里使用 `CSS-in-JS` 思想? 👉🏻👉🏻试试 [`weapp-pandacss`](https://github.com/sonofmagic/weapp-pandacss)
24
+ > 降低开发维护成本,提升开发效率的 `小程序` `tailwindcss` 全方面解决方案
25
+ >
26
+ > 我的其他项目:
27
+ > `CSS UI` 生成器 [`@icestack/ui`](https://ui.icebreaker.top/zh-CN) 已经发布,快来用它管理你的`CSS` 组件吧!
28
+ >
29
+ > 想试试在小程序里使用**编译时**`CSS-in-JS` 工具? 👉🏻👉🏻试试 [`weapp-pandacss`](https://github.com/sonofmagic/weapp-pandacss)
26
30
 
27
31
  \[[国内部署的文档地址](https://weapp-tw.icebreaker.top)\] \| \[[备用Github Page](https://sonofmagic.github.io/weapp-tailwindcss/)\] \| \[[1.x文档]('./v1.md')\]
28
32
 
@@ -0,0 +1,8 @@
1
+ import type { Compiler } from 'webpack4';
2
+ import type { AppType, UserDefinedOptions, InternalUserDefinedOptions, IBaseWebpackPlugin } from "../../../types";
3
+ export declare class UnifiedWebpackPluginV4 implements IBaseWebpackPlugin {
4
+ options: InternalUserDefinedOptions;
5
+ appType?: AppType;
6
+ constructor(options?: UserDefinedOptions);
7
+ apply(compiler: Compiler): void;
8
+ }
package/dist/cli.js CHANGED
@@ -1,6 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var options = require('./options-5eiKwcXx.js');
3
+ var semver = require('semver');
4
+ var options = require('./options-N9g3FpWO.js');
5
+ var index = require('./index-Fkmyt0Rc.js');
4
6
  require('magic-string');
5
7
  require('./replace.js');
6
8
  require('@weapp-core/escape');
@@ -15,20 +17,27 @@ require('./defu-KWuJnZLV.js');
15
17
  require('@babel/types');
16
18
  require('htmlparser2');
17
19
  require('postcss');
18
- require('./postcss-zkCNv4BC.js');
19
- require('@csstools/postcss-is-pseudo-class');
20
- require('postcss-rem-to-responsive-pixel');
21
- require('postcss-selector-parser');
22
20
  require('node:path');
23
21
  require('node:fs');
24
- require('semver');
25
22
  require('tailwindcss-patch');
26
23
  require('@tailwindcss-mangle/shared');
27
24
  require('lru-cache');
28
25
  require('md5');
26
+ require('@csstools/postcss-is-pseudo-class');
27
+ require('postcss-rem-to-responsive-pixel');
28
+ require('postcss-selector-parser');
29
+
30
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
31
+
32
+ var semver__default = /*#__PURE__*/_interopDefaultCompat(semver);
29
33
 
30
34
  const args = process.argv.slice(2);
31
- if (args[0] === 'patch') {
35
+ if (semver__default["default"].lt(process.versions.node, index.WEAPP_TW_REQUIRED_NODE_VERSION)) {
36
+ console.error(`You are using Node.js ${process.versions.node}. For weapp-tailwindcss, Node.js version >= v${index.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`);
37
+ process.exit(1);
38
+ }
39
+ const command = args[0];
40
+ if (command === 'patch') {
32
41
  const options$1 = options.getOptions();
33
42
  const patch = options.createPatch(options$1.supportCustomLengthUnitsPatch);
34
43
  patch();
package/dist/cli.mjs CHANGED
@@ -1,4 +1,6 @@
1
- import { g as getOptions, c as createPatch } from './options-UXRHB24i.mjs';
1
+ import semver from 'semver';
2
+ import { g as getOptions, a as createPatch } from './options-6YPFqoRJ.mjs';
3
+ import { W as WEAPP_TW_REQUIRED_NODE_VERSION } from './index-_74RBzwy.mjs';
2
4
  import 'magic-string';
3
5
  import './replace.mjs';
4
6
  import '@weapp-core/escape';
@@ -13,20 +15,23 @@ import './defu-ms_ZBCiB.mjs';
13
15
  import '@babel/types';
14
16
  import 'htmlparser2';
15
17
  import 'postcss';
16
- import './postcss-irzTcRfl.mjs';
17
- import '@csstools/postcss-is-pseudo-class';
18
- import 'postcss-rem-to-responsive-pixel';
19
- import 'postcss-selector-parser';
20
18
  import 'node:path';
21
19
  import 'node:fs';
22
- import 'semver';
23
20
  import 'tailwindcss-patch';
24
21
  import '@tailwindcss-mangle/shared';
25
22
  import 'lru-cache';
26
23
  import 'md5';
24
+ import '@csstools/postcss-is-pseudo-class';
25
+ import 'postcss-rem-to-responsive-pixel';
26
+ import 'postcss-selector-parser';
27
27
 
28
28
  const args = process.argv.slice(2);
29
- if (args[0] === 'patch') {
29
+ if (semver.lt(process.versions.node, WEAPP_TW_REQUIRED_NODE_VERSION)) {
30
+ console.error(`You are using Node.js ${process.versions.node}. For weapp-tailwindcss, Node.js version >= v${WEAPP_TW_REQUIRED_NODE_VERSION} is required.`);
31
+ process.exit(1);
32
+ }
33
+ const command = args[0];
34
+ if (command === 'patch') {
30
35
  const options = getOptions();
31
36
  const patch = createPatch(options.supportCustomLengthUnitsPatch);
32
37
  patch();
@@ -4,3 +4,4 @@ export declare const ManglePluginHooks = "ManglePluginHooks";
4
4
  export declare const WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks = "WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks";
5
5
  export declare const pluginName = "weapp-tailwindcss-webpack-plugin";
6
6
  export declare const vitePluginName = "vite-plugin-uni-app-weapp-tailwindcss-adaptor";
7
+ export declare const WEAPP_TW_REQUIRED_NODE_VERSION = "16.6.0";
package/dist/core.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-5eiKwcXx.js');
5
+ var options = require('./options-N9g3FpWO.js');
6
6
  require('magic-string');
7
7
  require('./replace.js');
8
8
  require('@weapp-core/escape');
@@ -17,7 +17,7 @@ require('./defu-KWuJnZLV.js');
17
17
  require('@babel/types');
18
18
  require('htmlparser2');
19
19
  require('postcss');
20
- require('./postcss-zkCNv4BC.js');
20
+ require('./index-Fkmyt0Rc.js');
21
21
  require('@csstools/postcss-is-pseudo-class');
22
22
  require('postcss-rem-to-responsive-pixel');
23
23
  require('postcss-selector-parser');
package/dist/core.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-UXRHB24i.mjs';
1
+ import { g as getOptions, c as createTailwindcssPatcher, _ as __awaiter } from './options-6YPFqoRJ.mjs';
2
2
  import 'magic-string';
3
3
  import './replace.mjs';
4
4
  import '@weapp-core/escape';
@@ -13,7 +13,7 @@ import './defu-ms_ZBCiB.mjs';
13
13
  import '@babel/types';
14
14
  import 'htmlparser2';
15
15
  import 'postcss';
16
- import './postcss-irzTcRfl.mjs';
16
+ import './index-_74RBzwy.mjs';
17
17
  import '@csstools/postcss-is-pseudo-class';
18
18
  import 'postcss-rem-to-responsive-pixel';
19
19
  import 'postcss-selector-parser';
@@ -4,7 +4,7 @@ var plugin = require('tailwindcss/plugin');
4
4
  var constants = require('../constants-EVxkHOXL.js');
5
5
  var defu = require('../defu-KWuJnZLV.js');
6
6
 
7
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
8
8
 
9
9
  var plugin__default = /*#__PURE__*/_interopDefaultCompat(plugin);
10
10
 
package/dist/gulp.js CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var options = require('./options-5eiKwcXx.js');
6
- var stream = require('node:stream');
5
+ var index = require('./index-8OJKpYld.js');
6
+ require('./options-N9g3FpWO.js');
7
7
  require('magic-string');
8
8
  require('./replace.js');
9
9
  require('@weapp-core/escape');
@@ -18,7 +18,7 @@ require('./defu-KWuJnZLV.js');
18
18
  require('@babel/types');
19
19
  require('htmlparser2');
20
20
  require('postcss');
21
- require('./postcss-zkCNv4BC.js');
21
+ require('./index-Fkmyt0Rc.js');
22
22
  require('@csstools/postcss-is-pseudo-class');
23
23
  require('postcss-rem-to-responsive-pixel');
24
24
  require('postcss-selector-parser');
@@ -29,69 +29,8 @@ require('tailwindcss-patch');
29
29
  require('@tailwindcss-mangle/shared');
30
30
  require('lru-cache');
31
31
  require('md5');
32
+ require('node:stream');
32
33
 
33
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
34
34
 
35
- var stream__default = /*#__PURE__*/_interopDefaultCompat(stream);
36
35
 
37
- const Transform = stream__default["default"].Transform;
38
- function createPlugins(options$1 = {}) {
39
- const opts = options.getOptions(options$1);
40
- const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, tailwindcssBasedir } = opts;
41
- let runtimeSet = new Set();
42
- patch === null || patch === void 0 ? void 0 : patch();
43
- const twPatcher = options.createTailwindcssPatcher();
44
- function transformWxss() {
45
- const transformStream = new Transform({ objectMode: true });
46
- transformStream._transform = function (file, encoding, callback) {
47
- return options.__awaiter(this, void 0, void 0, function* () {
48
- runtimeSet = twPatcher.getClassSet({
49
- basedir: tailwindcssBasedir
50
- });
51
- setMangleRuntimeSet(runtimeSet);
52
- const error = null;
53
- if (file.contents) {
54
- const code = yield styleHandler(file.contents.toString(), {
55
- isMainChunk: true
56
- });
57
- file.contents = Buffer.from(code);
58
- }
59
- callback(error, file);
60
- });
61
- };
62
- return transformStream;
63
- }
64
- function transformJs() {
65
- const transformStream = new Transform({ objectMode: true });
66
- transformStream._transform = function (file, encoding, callback) {
67
- const error = null;
68
- if (file.contents) {
69
- const { code } = jsHandler(file.contents.toString(), runtimeSet);
70
- file.contents = Buffer.from(code);
71
- }
72
- callback(error, file);
73
- };
74
- return transformStream;
75
- }
76
- function transformWxml() {
77
- const transformStream = new Transform({ objectMode: true });
78
- transformStream._transform = function (file, encoding, callback) {
79
- const error = null;
80
- if (file.contents) {
81
- const code = templateHandler(file.contents.toString(), {
82
- runtimeSet
83
- });
84
- file.contents = Buffer.from(code);
85
- }
86
- callback(error, file);
87
- };
88
- return transformStream;
89
- }
90
- return {
91
- transformWxss,
92
- transformWxml,
93
- transformJs
94
- };
95
- }
96
-
97
- exports.createPlugins = createPlugins;
36
+ exports.createPlugins = index.createPlugins;
package/dist/gulp.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-UXRHB24i.mjs';
2
- import stream from 'node:stream';
1
+ export { c as createPlugins } from './index-u-U9HdG6.mjs';
2
+ import './options-6YPFqoRJ.mjs';
3
3
  import 'magic-string';
4
4
  import './replace.mjs';
5
5
  import '@weapp-core/escape';
@@ -14,7 +14,7 @@ import './defu-ms_ZBCiB.mjs';
14
14
  import '@babel/types';
15
15
  import 'htmlparser2';
16
16
  import 'postcss';
17
- import './postcss-irzTcRfl.mjs';
17
+ import './index-_74RBzwy.mjs';
18
18
  import '@csstools/postcss-is-pseudo-class';
19
19
  import 'postcss-rem-to-responsive-pixel';
20
20
  import 'postcss-selector-parser';
@@ -25,65 +25,4 @@ import 'tailwindcss-patch';
25
25
  import '@tailwindcss-mangle/shared';
26
26
  import 'lru-cache';
27
27
  import 'md5';
28
-
29
- const Transform = stream.Transform;
30
- function createPlugins(options = {}) {
31
- const opts = getOptions(options);
32
- const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, tailwindcssBasedir } = opts;
33
- let runtimeSet = new Set();
34
- patch === null || patch === void 0 ? void 0 : patch();
35
- const twPatcher = createTailwindcssPatcher();
36
- function transformWxss() {
37
- const transformStream = new Transform({ objectMode: true });
38
- transformStream._transform = function (file, encoding, callback) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- runtimeSet = twPatcher.getClassSet({
41
- basedir: tailwindcssBasedir
42
- });
43
- setMangleRuntimeSet(runtimeSet);
44
- const error = null;
45
- if (file.contents) {
46
- const code = yield styleHandler(file.contents.toString(), {
47
- isMainChunk: true
48
- });
49
- file.contents = Buffer.from(code);
50
- }
51
- callback(error, file);
52
- });
53
- };
54
- return transformStream;
55
- }
56
- function transformJs() {
57
- const transformStream = new Transform({ objectMode: true });
58
- transformStream._transform = function (file, encoding, callback) {
59
- const error = null;
60
- if (file.contents) {
61
- const { code } = jsHandler(file.contents.toString(), runtimeSet);
62
- file.contents = Buffer.from(code);
63
- }
64
- callback(error, file);
65
- };
66
- return transformStream;
67
- }
68
- function transformWxml() {
69
- const transformStream = new Transform({ objectMode: true });
70
- transformStream._transform = function (file, encoding, callback) {
71
- const error = null;
72
- if (file.contents) {
73
- const code = templateHandler(file.contents.toString(), {
74
- runtimeSet
75
- });
76
- file.contents = Buffer.from(code);
77
- }
78
- callback(error, file);
79
- };
80
- return transformStream;
81
- }
82
- return {
83
- transformWxss,
84
- transformWxml,
85
- transformJs
86
- };
87
- }
88
-
89
- export { createPlugins };
28
+ import 'node:stream';
@@ -0,0 +1,70 @@
1
+ 'use strict';
2
+
3
+ var options = require('./options-N9g3FpWO.js');
4
+ var stream = require('node:stream');
5
+
6
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
7
+
8
+ var stream__default = /*#__PURE__*/_interopDefaultCompat(stream);
9
+
10
+ const Transform = stream__default["default"].Transform;
11
+ function createPlugins(options$1 = {}) {
12
+ const opts = options.getOptions(options$1);
13
+ const { templateHandler, styleHandler, patch, jsHandler, setMangleRuntimeSet, tailwindcssBasedir } = opts;
14
+ let runtimeSet = new Set();
15
+ patch === null || patch === void 0 ? void 0 : patch();
16
+ const twPatcher = options.createTailwindcssPatcher();
17
+ function transformWxss() {
18
+ const transformStream = new Transform({ objectMode: true });
19
+ transformStream._transform = function (file, encoding, callback) {
20
+ return options.__awaiter(this, void 0, void 0, function* () {
21
+ runtimeSet = twPatcher.getClassSet({
22
+ basedir: tailwindcssBasedir
23
+ });
24
+ setMangleRuntimeSet(runtimeSet);
25
+ const error = null;
26
+ if (file.contents) {
27
+ const code = yield styleHandler(file.contents.toString(), {
28
+ isMainChunk: true
29
+ });
30
+ file.contents = Buffer.from(code);
31
+ }
32
+ callback(error, file);
33
+ });
34
+ };
35
+ return transformStream;
36
+ }
37
+ function transformJs() {
38
+ const transformStream = new Transform({ objectMode: true });
39
+ transformStream._transform = function (file, encoding, callback) {
40
+ const error = null;
41
+ if (file.contents) {
42
+ const { code } = jsHandler(file.contents.toString(), runtimeSet);
43
+ file.contents = Buffer.from(code);
44
+ }
45
+ callback(error, file);
46
+ };
47
+ return transformStream;
48
+ }
49
+ function transformWxml() {
50
+ const transformStream = new Transform({ objectMode: true });
51
+ transformStream._transform = function (file, encoding, callback) {
52
+ const error = null;
53
+ if (file.contents) {
54
+ const code = templateHandler(file.contents.toString(), {
55
+ runtimeSet
56
+ });
57
+ file.contents = Buffer.from(code);
58
+ }
59
+ callback(error, file);
60
+ };
61
+ return transformStream;
62
+ }
63
+ return {
64
+ transformWxss,
65
+ transformWxml,
66
+ transformJs
67
+ };
68
+ }
69
+
70
+ exports.createPlugins = createPlugins;
@@ -6,13 +6,13 @@ var selectorParser = require('postcss-selector-parser');
6
6
  var shared = require('./shared-AxeHlAoJ.js');
7
7
  var postcss = require('postcss');
8
8
 
9
- function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
10
10
 
11
11
  var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIsPseudoClass);
12
12
  var postcssRem2rpx__default = /*#__PURE__*/_interopDefaultCompat(postcssRem2rpx);
13
13
  var selectorParser__default = /*#__PURE__*/_interopDefaultCompat(selectorParser);
14
14
 
15
- const createTransform = (rule, options) => {
15
+ const createRuleTransform = (rule, options) => {
16
16
  const { escapeMap, mangleContext, cssSelectorReplacement } = options;
17
17
  const transform = (selectors) => {
18
18
  selectors.walk((selector) => {
@@ -39,16 +39,45 @@ const createTransform = (rule, options) => {
39
39
  };
40
40
  return transform;
41
41
  };
42
- const getTransformer = (rule, options) => {
43
- return selectorParser__default["default"](createTransform(rule, options));
42
+ const getRuleTransformer = (rule, options) => {
43
+ return selectorParser__default["default"](createRuleTransform(rule, options));
44
44
  };
45
- const transformSync = (rule, options) => {
46
- const transformer = getTransformer(rule, options);
45
+ const ruleTransformSync = (rule, options) => {
46
+ const transformer = getRuleTransformer(rule, options);
47
47
  return transformer.transformSync(rule, {
48
48
  lossless: false,
49
49
  updateSelector: true
50
50
  });
51
51
  };
52
+ function isOnlyBeforeAndAfterPseudoElement(node) {
53
+ let b = false;
54
+ let a = false;
55
+ selectorParser__default["default"]((selectors) => {
56
+ selectors.walkPseudos((s) => {
57
+ var _a;
58
+ if (((_a = s.parent) === null || _a === void 0 ? void 0 : _a.length) === 1) {
59
+ if (/^:?:before$/.test(s.value)) {
60
+ b = true;
61
+ }
62
+ if (/^:?:after$/.test(s.value)) {
63
+ a = true;
64
+ }
65
+ }
66
+ });
67
+ }).astSync(node);
68
+ return b && a;
69
+ }
70
+ const fallbackRemove = selectorParser__default["default"]((selectors) => {
71
+ selectors.walk((selector) => {
72
+ var _a, _b;
73
+ if (selector.type === 'universal') {
74
+ (_a = selector.parent) === null || _a === void 0 ? void 0 : _a.remove();
75
+ }
76
+ if (selector.type === 'pseudo' && selector.value === ':is') {
77
+ (_b = selector.parent) === null || _b === void 0 ? void 0 : _b.remove();
78
+ }
79
+ });
80
+ });
52
81
 
53
82
  var cssVars = [
54
83
  {
@@ -241,8 +270,6 @@ var cssVars = [
241
270
  }
242
271
  ];
243
272
 
244
- const VariablesScopeSymbol = Symbol('VariablesScope');
245
-
246
273
  const initialNodes = cssVars.map((x) => {
247
274
  return new postcss.Declaration({
248
275
  prop: x.prop,
@@ -252,7 +279,7 @@ const initialNodes = cssVars.map((x) => {
252
279
  const PATTERNS = [/:not\(template\)\s*[~+]\s*:not\(template\)/.source, /:not\(\[hidden\]\)\s*[~+]\s*:not\(\[hidden\]\)/.source].join('|');
253
280
  const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
254
281
  function testIfVariablesScope(node, count = 2) {
255
- if (/:?:before/.test(node.selector) && /:?:after/.test(node.selector)) {
282
+ if (isOnlyBeforeAndAfterPseudoElement(node)) {
256
283
  const nodes = node.nodes;
257
284
  let c = 0;
258
285
  for (const tryTestDecl of nodes) {
@@ -329,7 +356,7 @@ function commonChunkPreflight(node, options) {
329
356
  const { ctx, cssChildCombinatorReplaceValue, cssInjectPreflight, injectAdditionalCssVarScope } = options;
330
357
  node.selector = remakeCombinatorSelector(node.selector, cssChildCombinatorReplaceValue);
331
358
  if (testIfVariablesScope(node)) {
332
- ctx === null || ctx === void 0 ? void 0 : ctx.variablesScopeWeakMap.set(node, VariablesScopeSymbol);
359
+ ctx === null || ctx === void 0 ? void 0 : ctx.markVariablesScope(node);
333
360
  node.selectors = remakeCssVarSelector(node.selectors, options);
334
361
  node.before(makePseudoVarRule());
335
362
  if (typeof cssInjectPreflight === 'function') {
@@ -353,6 +380,7 @@ function commonChunkPreflight(node, options) {
353
380
  const postcssPlugin = 'postcss-weapp-tailwindcss-rename-plugin';
354
381
  const pluginName = 'weapp-tailwindcss-webpack-plugin';
355
382
  const vitePluginName = 'vite-plugin-uni-app-weapp-tailwindcss-adaptor';
383
+ const WEAPP_TW_REQUIRED_NODE_VERSION = '16.6.0';
356
384
 
357
385
  function isAtMediaHover(atRule) {
358
386
  return /media\(\s*hover\s*:\s*hover\s*\)/.test(atRule.name) || (atRule.name === 'media' && /\(\s*hover\s*:\s*hover\s*\)/.test(atRule.params));
@@ -364,7 +392,7 @@ const postcssWeappTailwindcssPrePlugin = (options = {
364
392
  const p = {
365
393
  postcssPlugin,
366
394
  Rule(rule) {
367
- transformSync(rule, options);
395
+ ruleTransformSync(rule, options);
368
396
  },
369
397
  AtRule(atRule) {
370
398
  if (isAtMediaHover(atRule)) {
@@ -384,17 +412,6 @@ const postcssWeappTailwindcssPrePlugin = (options = {
384
412
  };
385
413
  postcssWeappTailwindcssPrePlugin.postcss = true;
386
414
 
387
- const fallback = selectorParser__default["default"]((selectors) => {
388
- selectors.walk((selector) => {
389
- var _a, _b;
390
- if (selector.type === 'universal') {
391
- (_a = selector.parent) === null || _a === void 0 ? void 0 : _a.remove();
392
- }
393
- if (selector.type === 'pseudo' && selector.value === ':is') {
394
- (_b = selector.parent) === null || _b === void 0 ? void 0 : _b.remove();
395
- }
396
- });
397
- });
398
415
  const postcssWeappTailwindcssPostPlugin = (options = {
399
416
  isMainChunk: true
400
417
  }) => {
@@ -406,15 +423,15 @@ const postcssWeappTailwindcssPostPlugin = (options = {
406
423
  p.OnceExit = (root) => {
407
424
  root.walkRules((rule) => {
408
425
  if (ctx) {
409
- if (ctx.variablesScopeWeakMap.get(rule) === VariablesScopeSymbol) {
410
- fallback.transformSync(rule, {
426
+ if (ctx.isVariablesScope(rule)) {
427
+ fallbackRemove.transformSync(rule, {
411
428
  updateSelector: true,
412
429
  lossless: false
413
430
  });
414
431
  }
415
432
  }
416
433
  else if (testIfVariablesScope(rule)) {
417
- fallback.transformSync(rule, {
434
+ fallbackRemove.transformSync(rule, {
418
435
  updateSelector: true,
419
436
  lossless: false
420
437
  });
@@ -431,9 +448,20 @@ const postcssWeappTailwindcssPostPlugin = (options = {
431
448
  };
432
449
  postcssWeappTailwindcssPostPlugin.postcss = true;
433
450
 
451
+ const VariablesScopeSymbol = Symbol('VariablesScope');
452
+
434
453
  function createContext() {
454
+ const variablesScopeWeakMap = new WeakMap();
455
+ function isVariablesScope(rule) {
456
+ return variablesScopeWeakMap.get(rule) === VariablesScopeSymbol;
457
+ }
458
+ function markVariablesScope(rule) {
459
+ variablesScopeWeakMap.set(rule, VariablesScopeSymbol);
460
+ }
435
461
  return {
436
- variablesScopeWeakMap: new WeakMap()
462
+ variablesScopeWeakMap,
463
+ isVariablesScope,
464
+ markVariablesScope
437
465
  };
438
466
  }
439
467
 
@@ -459,6 +487,7 @@ function getPlugins(options) {
459
487
  return plugins;
460
488
  }
461
489
 
490
+ exports.WEAPP_TW_REQUIRED_NODE_VERSION = WEAPP_TW_REQUIRED_NODE_VERSION;
462
491
  exports.getPlugins = getPlugins;
463
492
  exports.pluginName = pluginName;
464
493
  exports.postcssWeappTailwindcssPostPlugin = postcssWeappTailwindcssPostPlugin;