weapp-tailwindcss 3.0.1 → 3.0.3
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/cli.js +2 -2
- package/dist/cli.mjs +2 -2
- package/dist/core.js +2 -2
- package/dist/core.mjs +2 -2
- package/dist/gulp.js +2 -2
- package/dist/gulp.mjs +2 -2
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{options-mJwenBmV.mjs → options-9bBYg22L.mjs} +1 -1
- package/dist/{options-M6TutRrF.js → options-MDCr-9Qn.js} +1 -1
- package/dist/postcss/plugins/ctx.d.ts +2 -0
- package/dist/postcss/selectorParser.d.ts +4 -1
- package/dist/{postcss-kpIT_QQe.mjs → postcss-MxkGjr8g.mjs} +53 -26
- package/dist/{postcss-XAQSRPqF.js → postcss-bdPbDgs7.js} +53 -26
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/vite.js +2 -2
- package/dist/vite.mjs +2 -2
- package/dist/webpack.js +2 -2
- package/dist/webpack.mjs +2 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var options = require('./options-
|
|
3
|
+
var options = require('./options-MDCr-9Qn.js');
|
|
4
4
|
require('magic-string');
|
|
5
5
|
require('./replace.js');
|
|
6
6
|
require('@weapp-core/escape');
|
|
@@ -15,7 +15,7 @@ require('./defu-KWuJnZLV.js');
|
|
|
15
15
|
require('@babel/types');
|
|
16
16
|
require('htmlparser2');
|
|
17
17
|
require('postcss');
|
|
18
|
-
require('./postcss-
|
|
18
|
+
require('./postcss-bdPbDgs7.js');
|
|
19
19
|
require('@csstools/postcss-is-pseudo-class');
|
|
20
20
|
require('postcss-rem-to-responsive-pixel');
|
|
21
21
|
require('postcss-selector-parser');
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, c as createPatch } from './options-
|
|
1
|
+
import { g as getOptions, c as createPatch } from './options-9bBYg22L.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-
|
|
16
|
+
import './postcss-MxkGjr8g.mjs';
|
|
17
17
|
import '@csstools/postcss-is-pseudo-class';
|
|
18
18
|
import 'postcss-rem-to-responsive-pixel';
|
|
19
19
|
import 'postcss-selector-parser';
|
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-
|
|
5
|
+
var options = require('./options-MDCr-9Qn.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-
|
|
20
|
+
require('./postcss-bdPbDgs7.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-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-9bBYg22L.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-
|
|
16
|
+
import './postcss-MxkGjr8g.mjs';
|
|
17
17
|
import '@csstools/postcss-is-pseudo-class';
|
|
18
18
|
import 'postcss-rem-to-responsive-pixel';
|
|
19
19
|
import 'postcss-selector-parser';
|
package/dist/gulp.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-MDCr-9Qn.js');
|
|
6
6
|
var stream = require('node:stream');
|
|
7
7
|
require('magic-string');
|
|
8
8
|
require('./replace.js');
|
|
@@ -18,7 +18,7 @@ require('./defu-KWuJnZLV.js');
|
|
|
18
18
|
require('@babel/types');
|
|
19
19
|
require('htmlparser2');
|
|
20
20
|
require('postcss');
|
|
21
|
-
require('./postcss-
|
|
21
|
+
require('./postcss-bdPbDgs7.js');
|
|
22
22
|
require('@csstools/postcss-is-pseudo-class');
|
|
23
23
|
require('postcss-rem-to-responsive-pixel');
|
|
24
24
|
require('postcss-selector-parser');
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-9bBYg22L.mjs';
|
|
2
2
|
import stream from 'node:stream';
|
|
3
3
|
import 'magic-string';
|
|
4
4
|
import './replace.mjs';
|
|
@@ -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-
|
|
17
|
+
import './postcss-MxkGjr8g.mjs';
|
|
18
18
|
import '@csstools/postcss-is-pseudo-class';
|
|
19
19
|
import 'postcss-rem-to-responsive-pixel';
|
|
20
20
|
import 'postcss-selector-parser';
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var webpack = require('./webpack.js');
|
|
6
6
|
var vite = require('./vite.js');
|
|
7
7
|
var gulp = require('./gulp.js');
|
|
8
|
-
require('./options-
|
|
8
|
+
require('./options-MDCr-9Qn.js');
|
|
9
9
|
require('magic-string');
|
|
10
10
|
require('./replace.js');
|
|
11
11
|
require('@weapp-core/escape');
|
|
@@ -20,7 +20,7 @@ require('./defu-KWuJnZLV.js');
|
|
|
20
20
|
require('@babel/types');
|
|
21
21
|
require('htmlparser2');
|
|
22
22
|
require('postcss');
|
|
23
|
-
require('./postcss-
|
|
23
|
+
require('./postcss-bdPbDgs7.js');
|
|
24
24
|
require('@csstools/postcss-is-pseudo-class');
|
|
25
25
|
require('postcss-rem-to-responsive-pixel');
|
|
26
26
|
require('postcss-selector-parser');
|
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { UnifiedWebpackPluginV5 } from './webpack.mjs';
|
|
2
2
|
export { UnifiedViteWeappTailwindcssPlugin } from './vite.mjs';
|
|
3
3
|
export { createPlugins } from './gulp.mjs';
|
|
4
|
-
import './options-
|
|
4
|
+
import './options-9bBYg22L.mjs';
|
|
5
5
|
import 'magic-string';
|
|
6
6
|
import './replace.mjs';
|
|
7
7
|
import '@weapp-core/escape';
|
|
@@ -16,7 +16,7 @@ import './defu-ms_ZBCiB.mjs';
|
|
|
16
16
|
import '@babel/types';
|
|
17
17
|
import 'htmlparser2';
|
|
18
18
|
import 'postcss';
|
|
19
|
-
import './postcss-
|
|
19
|
+
import './postcss-MxkGjr8g.mjs';
|
|
20
20
|
import '@csstools/postcss-is-pseudo-class';
|
|
21
21
|
import 'postcss-rem-to-responsive-pixel';
|
|
22
22
|
import 'postcss-selector-parser';
|
|
@@ -10,7 +10,7 @@ import { d as defuOverrideArray, n as noop, a as defaultOptions, i as isMap } fr
|
|
|
10
10
|
import * as t from '@babel/types';
|
|
11
11
|
import { Parser } from 'htmlparser2';
|
|
12
12
|
import postcss from 'postcss';
|
|
13
|
-
import { g as getPlugins } from './postcss-
|
|
13
|
+
import { g as getPlugins } from './postcss-MxkGjr8g.mjs';
|
|
14
14
|
import path from 'node:path';
|
|
15
15
|
import fs from 'node:fs';
|
|
16
16
|
import { gte } from 'semver';
|
|
@@ -12,7 +12,7 @@ var defaults = require('./defaults-QOAV8NSV.js');
|
|
|
12
12
|
var t = require('@babel/types');
|
|
13
13
|
var htmlparser2 = require('htmlparser2');
|
|
14
14
|
var postcss = require('postcss');
|
|
15
|
-
var postcss$1 = require('./postcss-
|
|
15
|
+
var postcss$1 = require('./postcss-bdPbDgs7.js');
|
|
16
16
|
var path = require('node:path');
|
|
17
17
|
var fs = require('node:fs');
|
|
18
18
|
var semver = require('semver');
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import selectorParser from 'postcss-selector-parser';
|
|
1
2
|
import type { Rule } from 'postcss';
|
|
2
3
|
import type { IStyleHandlerOptions } from "../types";
|
|
3
|
-
export declare const
|
|
4
|
+
export declare const ruleTransformSync: (rule: Rule, options: IStyleHandlerOptions) => void;
|
|
5
|
+
export declare function isOnlyBeforeAndAfterPseudoElement(node: Rule): boolean;
|
|
6
|
+
export declare const fallbackRemove: selectorParser.Processor<void, selectorParser.Selectors>;
|
|
@@ -4,7 +4,7 @@ import selectorParser from 'postcss-selector-parser';
|
|
|
4
4
|
import { c as composeIsPseudo, i as internalCssSelectorReplacer } from './shared-0D5OOeXo.mjs';
|
|
5
5
|
import { Declaration, Rule } from 'postcss';
|
|
6
6
|
|
|
7
|
-
const
|
|
7
|
+
const createRuleTransform = (rule, options) => {
|
|
8
8
|
const { escapeMap, mangleContext, cssSelectorReplacement } = options;
|
|
9
9
|
const transform = (selectors) => {
|
|
10
10
|
selectors.walk((selector) => {
|
|
@@ -31,16 +31,45 @@ const createTransform = (rule, options) => {
|
|
|
31
31
|
};
|
|
32
32
|
return transform;
|
|
33
33
|
};
|
|
34
|
-
const
|
|
35
|
-
return selectorParser(
|
|
34
|
+
const getRuleTransformer = (rule, options) => {
|
|
35
|
+
return selectorParser(createRuleTransform(rule, options));
|
|
36
36
|
};
|
|
37
|
-
const
|
|
38
|
-
const transformer =
|
|
37
|
+
const ruleTransformSync = (rule, options) => {
|
|
38
|
+
const transformer = getRuleTransformer(rule, options);
|
|
39
39
|
return transformer.transformSync(rule, {
|
|
40
40
|
lossless: false,
|
|
41
41
|
updateSelector: true
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
+
function isOnlyBeforeAndAfterPseudoElement(node) {
|
|
45
|
+
let b = false;
|
|
46
|
+
let a = false;
|
|
47
|
+
selectorParser((selectors) => {
|
|
48
|
+
selectors.walkPseudos((s) => {
|
|
49
|
+
var _a;
|
|
50
|
+
if (((_a = s.parent) === null || _a === void 0 ? void 0 : _a.length) === 1) {
|
|
51
|
+
if (/^:?:before$/.test(s.value)) {
|
|
52
|
+
b = true;
|
|
53
|
+
}
|
|
54
|
+
if (/^:?:after$/.test(s.value)) {
|
|
55
|
+
a = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}).astSync(node);
|
|
60
|
+
return b && a;
|
|
61
|
+
}
|
|
62
|
+
const fallbackRemove = selectorParser((selectors) => {
|
|
63
|
+
selectors.walk((selector) => {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
if (selector.type === 'universal') {
|
|
66
|
+
(_a = selector.parent) === null || _a === void 0 ? void 0 : _a.remove();
|
|
67
|
+
}
|
|
68
|
+
if (selector.type === 'pseudo' && selector.value === ':is') {
|
|
69
|
+
(_b = selector.parent) === null || _b === void 0 ? void 0 : _b.remove();
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
});
|
|
44
73
|
|
|
45
74
|
var cssVars = [
|
|
46
75
|
{
|
|
@@ -233,18 +262,16 @@ var cssVars = [
|
|
|
233
262
|
}
|
|
234
263
|
];
|
|
235
264
|
|
|
236
|
-
const VariablesScopeSymbol = Symbol('VariablesScope');
|
|
237
|
-
|
|
238
265
|
const initialNodes = cssVars.map((x) => {
|
|
239
266
|
return new Declaration({
|
|
240
267
|
prop: x.prop,
|
|
241
268
|
value: x.value
|
|
242
269
|
});
|
|
243
270
|
});
|
|
244
|
-
const PATTERNS = [/:not\(template\)\s
|
|
271
|
+
const PATTERNS = [/:not\(template\)\s*[~+]\s*:not\(template\)/.source, /:not\(\[hidden\]\)\s*[~+]\s*:not\(\[hidden\]\)/.source].join('|');
|
|
245
272
|
const BROAD_MATCH_GLOBAL_REGEXP = new RegExp(PATTERNS, 'g');
|
|
246
273
|
function testIfVariablesScope(node, count = 2) {
|
|
247
|
-
if (
|
|
274
|
+
if (isOnlyBeforeAndAfterPseudoElement(node)) {
|
|
248
275
|
const nodes = node.nodes;
|
|
249
276
|
let c = 0;
|
|
250
277
|
for (const tryTestDecl of nodes) {
|
|
@@ -321,7 +348,7 @@ function commonChunkPreflight(node, options) {
|
|
|
321
348
|
const { ctx, cssChildCombinatorReplaceValue, cssInjectPreflight, injectAdditionalCssVarScope } = options;
|
|
322
349
|
node.selector = remakeCombinatorSelector(node.selector, cssChildCombinatorReplaceValue);
|
|
323
350
|
if (testIfVariablesScope(node)) {
|
|
324
|
-
ctx === null || ctx === void 0 ? void 0 : ctx.
|
|
351
|
+
ctx === null || ctx === void 0 ? void 0 : ctx.markVariablesScope(node);
|
|
325
352
|
node.selectors = remakeCssVarSelector(node.selectors, options);
|
|
326
353
|
node.before(makePseudoVarRule());
|
|
327
354
|
if (typeof cssInjectPreflight === 'function') {
|
|
@@ -356,7 +383,7 @@ const postcssWeappTailwindcssPrePlugin = (options = {
|
|
|
356
383
|
const p = {
|
|
357
384
|
postcssPlugin,
|
|
358
385
|
Rule(rule) {
|
|
359
|
-
|
|
386
|
+
ruleTransformSync(rule, options);
|
|
360
387
|
},
|
|
361
388
|
AtRule(atRule) {
|
|
362
389
|
if (isAtMediaHover(atRule)) {
|
|
@@ -376,17 +403,6 @@ const postcssWeappTailwindcssPrePlugin = (options = {
|
|
|
376
403
|
};
|
|
377
404
|
postcssWeappTailwindcssPrePlugin.postcss = true;
|
|
378
405
|
|
|
379
|
-
const fallback = selectorParser((selectors) => {
|
|
380
|
-
selectors.walk((selector) => {
|
|
381
|
-
var _a, _b;
|
|
382
|
-
if (selector.type === 'universal') {
|
|
383
|
-
(_a = selector.parent) === null || _a === void 0 ? void 0 : _a.remove();
|
|
384
|
-
}
|
|
385
|
-
if (selector.type === 'pseudo' && selector.value === ':is') {
|
|
386
|
-
(_b = selector.parent) === null || _b === void 0 ? void 0 : _b.remove();
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
});
|
|
390
406
|
const postcssWeappTailwindcssPostPlugin = (options = {
|
|
391
407
|
isMainChunk: true
|
|
392
408
|
}) => {
|
|
@@ -398,15 +414,15 @@ const postcssWeappTailwindcssPostPlugin = (options = {
|
|
|
398
414
|
p.OnceExit = (root) => {
|
|
399
415
|
root.walkRules((rule) => {
|
|
400
416
|
if (ctx) {
|
|
401
|
-
if (ctx.
|
|
402
|
-
|
|
417
|
+
if (ctx.isVariablesScope(rule)) {
|
|
418
|
+
fallbackRemove.transformSync(rule, {
|
|
403
419
|
updateSelector: true,
|
|
404
420
|
lossless: false
|
|
405
421
|
});
|
|
406
422
|
}
|
|
407
423
|
}
|
|
408
424
|
else if (testIfVariablesScope(rule)) {
|
|
409
|
-
|
|
425
|
+
fallbackRemove.transformSync(rule, {
|
|
410
426
|
updateSelector: true,
|
|
411
427
|
lossless: false
|
|
412
428
|
});
|
|
@@ -423,9 +439,20 @@ const postcssWeappTailwindcssPostPlugin = (options = {
|
|
|
423
439
|
};
|
|
424
440
|
postcssWeappTailwindcssPostPlugin.postcss = true;
|
|
425
441
|
|
|
442
|
+
const VariablesScopeSymbol = Symbol('VariablesScope');
|
|
443
|
+
|
|
426
444
|
function createContext() {
|
|
445
|
+
const variablesScopeWeakMap = new WeakMap();
|
|
446
|
+
function isVariablesScope(rule) {
|
|
447
|
+
return variablesScopeWeakMap.get(rule) === VariablesScopeSymbol;
|
|
448
|
+
}
|
|
449
|
+
function markVariablesScope(rule) {
|
|
450
|
+
variablesScopeWeakMap.set(rule, VariablesScopeSymbol);
|
|
451
|
+
}
|
|
427
452
|
return {
|
|
428
|
-
variablesScopeWeakMap
|
|
453
|
+
variablesScopeWeakMap,
|
|
454
|
+
isVariablesScope,
|
|
455
|
+
markVariablesScope
|
|
429
456
|
};
|
|
430
457
|
}
|
|
431
458
|
|
|
@@ -12,7 +12,7 @@ var postcssIsPseudoClass__default = /*#__PURE__*/_interopDefaultCompat(postcssIs
|
|
|
12
12
|
var postcssRem2rpx__default = /*#__PURE__*/_interopDefaultCompat(postcssRem2rpx);
|
|
13
13
|
var selectorParser__default = /*#__PURE__*/_interopDefaultCompat(selectorParser);
|
|
14
14
|
|
|
15
|
-
const
|
|
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
|
|
43
|
-
return selectorParser__default["default"](
|
|
42
|
+
const getRuleTransformer = (rule, options) => {
|
|
43
|
+
return selectorParser__default["default"](createRuleTransform(rule, options));
|
|
44
44
|
};
|
|
45
|
-
const
|
|
46
|
-
const transformer =
|
|
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,18 +270,16 @@ 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,
|
|
249
276
|
value: x.value
|
|
250
277
|
});
|
|
251
278
|
});
|
|
252
|
-
const PATTERNS = [/:not\(template\)\s
|
|
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 (
|
|
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.
|
|
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') {
|
|
@@ -364,7 +391,7 @@ const postcssWeappTailwindcssPrePlugin = (options = {
|
|
|
364
391
|
const p = {
|
|
365
392
|
postcssPlugin,
|
|
366
393
|
Rule(rule) {
|
|
367
|
-
|
|
394
|
+
ruleTransformSync(rule, options);
|
|
368
395
|
},
|
|
369
396
|
AtRule(atRule) {
|
|
370
397
|
if (isAtMediaHover(atRule)) {
|
|
@@ -384,17 +411,6 @@ const postcssWeappTailwindcssPrePlugin = (options = {
|
|
|
384
411
|
};
|
|
385
412
|
postcssWeappTailwindcssPrePlugin.postcss = true;
|
|
386
413
|
|
|
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
414
|
const postcssWeappTailwindcssPostPlugin = (options = {
|
|
399
415
|
isMainChunk: true
|
|
400
416
|
}) => {
|
|
@@ -406,15 +422,15 @@ const postcssWeappTailwindcssPostPlugin = (options = {
|
|
|
406
422
|
p.OnceExit = (root) => {
|
|
407
423
|
root.walkRules((rule) => {
|
|
408
424
|
if (ctx) {
|
|
409
|
-
if (ctx.
|
|
410
|
-
|
|
425
|
+
if (ctx.isVariablesScope(rule)) {
|
|
426
|
+
fallbackRemove.transformSync(rule, {
|
|
411
427
|
updateSelector: true,
|
|
412
428
|
lossless: false
|
|
413
429
|
});
|
|
414
430
|
}
|
|
415
431
|
}
|
|
416
432
|
else if (testIfVariablesScope(rule)) {
|
|
417
|
-
|
|
433
|
+
fallbackRemove.transformSync(rule, {
|
|
418
434
|
updateSelector: true,
|
|
419
435
|
lossless: false
|
|
420
436
|
});
|
|
@@ -431,9 +447,20 @@ const postcssWeappTailwindcssPostPlugin = (options = {
|
|
|
431
447
|
};
|
|
432
448
|
postcssWeappTailwindcssPostPlugin.postcss = true;
|
|
433
449
|
|
|
450
|
+
const VariablesScopeSymbol = Symbol('VariablesScope');
|
|
451
|
+
|
|
434
452
|
function createContext() {
|
|
453
|
+
const variablesScopeWeakMap = new WeakMap();
|
|
454
|
+
function isVariablesScope(rule) {
|
|
455
|
+
return variablesScopeWeakMap.get(rule) === VariablesScopeSymbol;
|
|
456
|
+
}
|
|
457
|
+
function markVariablesScope(rule) {
|
|
458
|
+
variablesScopeWeakMap.set(rule, VariablesScopeSymbol);
|
|
459
|
+
}
|
|
435
460
|
return {
|
|
436
|
-
variablesScopeWeakMap
|
|
461
|
+
variablesScopeWeakMap,
|
|
462
|
+
isVariablesScope,
|
|
463
|
+
markVariablesScope
|
|
437
464
|
};
|
|
438
465
|
}
|
|
439
466
|
|
package/dist/postcss.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var postcss = require('./postcss-
|
|
5
|
+
var postcss = require('./postcss-bdPbDgs7.js');
|
|
6
6
|
var postcssIsPseudoClass = require('@csstools/postcss-is-pseudo-class');
|
|
7
7
|
var postcssRem2rpx = require('postcss-rem-to-responsive-pixel');
|
|
8
8
|
require('postcss-selector-parser');
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { g as getPlugins, a as postcssWeappTailwindcssPostPlugin, b as postcssWeappTailwindcssPrePlugin } from './postcss-
|
|
1
|
+
export { g as getPlugins, a as postcssWeappTailwindcssPostPlugin, b as postcssWeappTailwindcssPrePlugin } from './postcss-MxkGjr8g.mjs';
|
|
2
2
|
export { default as postcssIsPseudoClass } from '@csstools/postcss-is-pseudo-class';
|
|
3
3
|
export { default as postcssRem2rpx } from 'postcss-rem-to-responsive-pixel';
|
|
4
4
|
import 'postcss-selector-parser';
|
package/dist/vite.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
6
|
-
var postcss = require('./postcss-
|
|
5
|
+
var options = require('./options-MDCr-9Qn.js');
|
|
6
|
+
var postcss = require('./postcss-bdPbDgs7.js');
|
|
7
7
|
var defaults = require('./defaults-QOAV8NSV.js');
|
|
8
8
|
var index = require('./index-z25r_Htj.js');
|
|
9
9
|
require('magic-string');
|
package/dist/vite.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-
|
|
2
|
-
import { v as vitePluginName } from './postcss-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-9bBYg22L.mjs';
|
|
2
|
+
import { v as vitePluginName } from './postcss-MxkGjr8g.mjs';
|
|
3
3
|
import { g as getGroupedEntries } from './defaults-TZpmwtzd.mjs';
|
|
4
4
|
import { c as createDebug } from './index-06BoOZig.mjs';
|
|
5
5
|
import 'magic-string';
|
package/dist/webpack.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var options = require('./options-
|
|
5
|
+
var options = require('./options-MDCr-9Qn.js');
|
|
6
6
|
var path = require('node:path');
|
|
7
7
|
var fs = require('node:fs');
|
|
8
|
-
var postcss = require('./postcss-
|
|
8
|
+
var postcss = require('./postcss-bdPbDgs7.js');
|
|
9
9
|
var defaults = require('./defaults-QOAV8NSV.js');
|
|
10
10
|
var index = require('./index-z25r_Htj.js');
|
|
11
11
|
require('magic-string');
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-
|
|
1
|
+
import { g as getOptions, a as createTailwindcssPatcher, _ as __awaiter } from './options-9bBYg22L.mjs';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import fs from 'node:fs';
|
|
4
|
-
import { p as pluginName } from './postcss-
|
|
4
|
+
import { p as pluginName } from './postcss-MxkGjr8g.mjs';
|
|
5
5
|
import { g as getGroupedEntries, r as removeExt } from './defaults-TZpmwtzd.mjs';
|
|
6
6
|
import { c as createDebug } from './index-06BoOZig.mjs';
|
|
7
7
|
import 'magic-string';
|
package/package.json
CHANGED