@weapp-tailwindcss/postcss 1.0.8 → 1.0.10-alpha.0
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 +17 -9
- package/dist/index.mjs +8 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -642,6 +642,10 @@ function commonChunkPreflight(node, options) {
|
|
|
642
642
|
function isAtMediaHover(atRule) {
|
|
643
643
|
return /media\(\s*hover\s*:\s*hover\s*\)/.test(atRule.name) || atRule.name === "media" && /\(\s*hover\s*:\s*hover\s*\)/.test(atRule.params);
|
|
644
644
|
}
|
|
645
|
+
var TAILWIND_V4_MODERN_REGEX = /^\(\(-webkit-hyphens:\s*none\)\s+and\s+\(not\s+\(margin-trim:\s*inline\)\)\)\s+or\s+\(\(-moz-orient:\s*inline\)\s+and\s+\(not\s+\(color:\s*rgb\(from\s+red\s+r\s+g\s+b\)\)\)\)$/;
|
|
646
|
+
function isTailwindcssV4ModernCheck(atRule) {
|
|
647
|
+
return atRule.name === "supports" && TAILWIND_V4_MODERN_REGEX.test(atRule.params);
|
|
648
|
+
}
|
|
645
649
|
var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
646
650
|
const opts = _shared.defu.call(void 0, options, { isMainChunk: true });
|
|
647
651
|
const p = {
|
|
@@ -656,6 +660,10 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
656
660
|
} else {
|
|
657
661
|
atRule.remove();
|
|
658
662
|
}
|
|
663
|
+
} else if (isTailwindcssV4ModernCheck(atRule)) {
|
|
664
|
+
if (_optionalChain([atRule, 'access', _28 => _28.first, 'optionalAccess', _29 => _29.type]) === "atrule" && atRule.first.name === "layer") {
|
|
665
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
666
|
+
}
|
|
659
667
|
}
|
|
660
668
|
}
|
|
661
669
|
};
|
|
@@ -679,7 +687,7 @@ function compare(e3, t2) {
|
|
|
679
687
|
return e3.a === t2.a ? e3.b === t2.b ? e3.c - t2.c : e3.b - t2.b : e3.a - t2.a;
|
|
680
688
|
}
|
|
681
689
|
function selectorSpecificity(t2, s) {
|
|
682
|
-
const i = _optionalChain([s, 'optionalAccess',
|
|
690
|
+
const i = _optionalChain([s, 'optionalAccess', _30 => _30.customSpecificity, 'optionalCall', _31 => _31(t2)]);
|
|
683
691
|
if (i) return i;
|
|
684
692
|
if (!t2) return { a: 0, b: 0, c: 0 };
|
|
685
693
|
let c = 0, n = 0, o2 = 0;
|
|
@@ -755,7 +763,7 @@ function selectorSpecificity(t2, s) {
|
|
|
755
763
|
case ":active-view-transition-type":
|
|
756
764
|
return { a: 0, b: 1, c: 0 };
|
|
757
765
|
}
|
|
758
|
-
else _postcssselectorparser2.default.isContainer(t2) && _optionalChain([t2, 'access',
|
|
766
|
+
else _postcssselectorparser2.default.isContainer(t2) && _optionalChain([t2, 'access', _32 => _32.nodes, 'optionalAccess', _33 => _33.length]) > 0 && t2.nodes.forEach((e3) => {
|
|
759
767
|
const t3 = selectorSpecificity(e3, s);
|
|
760
768
|
c += t3.a, n += t3.b, o2 += t3.c;
|
|
761
769
|
});
|
|
@@ -783,8 +791,8 @@ function alwaysValidSelector(s) {
|
|
|
783
791
|
const o2 = _postcssselectorparser2.default.call(void 0, ).astSync(s);
|
|
784
792
|
let t2 = true;
|
|
785
793
|
return o2.walk((e3) => {
|
|
786
|
-
if ("class" !== e3.type && "comment" !== e3.type && "id" !== e3.type && "root" !== e3.type && "selector" !== e3.type && "string" !== e3.type && "tag" !== e3.type && "universal" !== e3.type && ("attribute" !== e3.type || e3.insensitive) && ("combinator" !== e3.type || "+" !== e3.value && ">" !== e3.value && "~" !== e3.value && " " !== e3.value) && ("pseudo" !== e3.type || _optionalChain([e3, 'access',
|
|
787
|
-
if ("pseudo" === e3.type && 1 === _optionalChain([e3, 'access',
|
|
794
|
+
if ("class" !== e3.type && "comment" !== e3.type && "id" !== e3.type && "root" !== e3.type && "selector" !== e3.type && "string" !== e3.type && "tag" !== e3.type && "universal" !== e3.type && ("attribute" !== e3.type || e3.insensitive) && ("combinator" !== e3.type || "+" !== e3.value && ">" !== e3.value && "~" !== e3.value && " " !== e3.value) && ("pseudo" !== e3.type || _optionalChain([e3, 'access', _34 => _34.nodes, 'optionalAccess', _35 => _35.length]) || ":hover" !== e3.value.toLowerCase() && ":focus" !== e3.value.toLowerCase())) {
|
|
795
|
+
if ("pseudo" === e3.type && 1 === _optionalChain([e3, 'access', _36 => _36.nodes, 'optionalAccess', _37 => _37.length]) && ":not" === e3.value.toLowerCase()) {
|
|
788
796
|
let s2 = true;
|
|
789
797
|
if (e3.nodes[0].walkCombinators(() => {
|
|
790
798
|
s2 = false;
|
|
@@ -896,8 +904,8 @@ function splitSelectors(o2, t2, n = 0) {
|
|
|
896
904
|
if (_postcssselectorparser2.default.call(void 0, ).astSync(o3).walkPseudos((e3) => {
|
|
897
905
|
if (":is" !== e3.value.toLowerCase() || !e3.nodes || !e3.nodes.length) return;
|
|
898
906
|
if ("selector" === e3.nodes[0].type && 0 === e3.nodes[0].nodes.length) return;
|
|
899
|
-
if ("pseudo" === _optionalChain([e3, 'access',
|
|
900
|
-
if ("pseudo" === _optionalChain([e3, 'access',
|
|
907
|
+
if ("pseudo" === _optionalChain([e3, 'access', _38 => _38.parent, 'optionalAccess', _39 => _39.parent, 'optionalAccess', _40 => _40.type]) && ":not" === _optionalChain([e3, 'access', _41 => _41.parent, 'optionalAccess', _42 => _42.parent, 'optionalAccess', _43 => _43.value, 'optionalAccess', _44 => _44.toLowerCase, 'call', _45 => _45()])) return void i.push([{ start: e3.parent.parent.sourceIndex, end: e3.parent.parent.sourceIndex + e3.parent.parent.toString().length, option: `:not(${e3.nodes.toString()})` }]);
|
|
908
|
+
if ("pseudo" === _optionalChain([e3, 'access', _46 => _46.parent, 'optionalAccess', _47 => _47.parent, 'optionalAccess', _48 => _48.type]) && ":has" === _optionalChain([e3, 'access', _49 => _49.parent, 'optionalAccess', _50 => _50.parent, 'optionalAccess', _51 => _51.value, 'optionalAccess', _52 => _52.toLowerCase, 'call', _53 => _53()])) return void (e3.value = ":-csstools-matches");
|
|
901
909
|
let o4 = e3.parent;
|
|
902
910
|
for (; o4; ) {
|
|
903
911
|
if (o4.value && ":is" === o4.value.toLowerCase() && "pseudo" === o4.type) return void (a = true);
|
|
@@ -919,7 +927,7 @@ function splitSelectors(o2, t2, n = 0) {
|
|
|
919
927
|
let s = "";
|
|
920
928
|
for (let t3 = 0; t3 < e3.length; t3++) {
|
|
921
929
|
const n2 = e3[t3];
|
|
922
|
-
s += o3.substring(_optionalChain([e3, 'access',
|
|
930
|
+
s += o3.substring(_optionalChain([e3, 'access', _54 => _54[t3 - 1], 'optionalAccess', _55 => _55.end]) || 0, e3[t3].start), s += ":-csstools-matches(" + n2.option + ")", t3 === e3.length - 1 && (s += o3.substring(e3[t3].end));
|
|
923
931
|
}
|
|
924
932
|
c.push(s);
|
|
925
933
|
}), a && n < 10 && (c = splitSelectors(c, t2, n + 1)), c;
|
|
@@ -980,7 +988,7 @@ function getPlugins(options) {
|
|
|
980
988
|
const ctx = createContext();
|
|
981
989
|
options.ctx = ctx;
|
|
982
990
|
const plugins = [
|
|
983
|
-
..._nullishCoalesce(_optionalChain([options, 'access',
|
|
991
|
+
..._nullishCoalesce(_optionalChain([options, 'access', _56 => _56.postcssOptions, 'optionalAccess', _57 => _57.plugins]), () => ( [])),
|
|
984
992
|
postcssWeappTailwindcssPrePlugin(options),
|
|
985
993
|
_postcsspresetenv2.default.call(void 0, options.cssPresetEnv)
|
|
986
994
|
];
|
|
@@ -1024,7 +1032,7 @@ function styleHandler(rawSource, options) {
|
|
|
1024
1032
|
getPlugins(options)
|
|
1025
1033
|
).process(
|
|
1026
1034
|
rawSource,
|
|
1027
|
-
_nullishCoalesce(_optionalChain([options, 'access',
|
|
1035
|
+
_nullishCoalesce(_optionalChain([options, 'access', _58 => _58.postcssOptions, 'optionalAccess', _59 => _59.options]), () => ( {
|
|
1028
1036
|
from: void 0
|
|
1029
1037
|
}))
|
|
1030
1038
|
).async();
|
package/dist/index.mjs
CHANGED
|
@@ -642,6 +642,10 @@ function commonChunkPreflight(node, options) {
|
|
|
642
642
|
function isAtMediaHover(atRule) {
|
|
643
643
|
return /media\(\s*hover\s*:\s*hover\s*\)/.test(atRule.name) || atRule.name === "media" && /\(\s*hover\s*:\s*hover\s*\)/.test(atRule.params);
|
|
644
644
|
}
|
|
645
|
+
var TAILWIND_V4_MODERN_REGEX = /^\(\(-webkit-hyphens:\s*none\)\s+and\s+\(not\s+\(margin-trim:\s*inline\)\)\)\s+or\s+\(\(-moz-orient:\s*inline\)\s+and\s+\(not\s+\(color:\s*rgb\(from\s+red\s+r\s+g\s+b\)\)\)\)$/;
|
|
646
|
+
function isTailwindcssV4ModernCheck(atRule) {
|
|
647
|
+
return atRule.name === "supports" && TAILWIND_V4_MODERN_REGEX.test(atRule.params);
|
|
648
|
+
}
|
|
645
649
|
var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
646
650
|
const opts = defu2(options, { isMainChunk: true });
|
|
647
651
|
const p = {
|
|
@@ -656,6 +660,10 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
656
660
|
} else {
|
|
657
661
|
atRule.remove();
|
|
658
662
|
}
|
|
663
|
+
} else if (isTailwindcssV4ModernCheck(atRule)) {
|
|
664
|
+
if (atRule.first?.type === "atrule" && atRule.first.name === "layer") {
|
|
665
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
666
|
+
}
|
|
659
667
|
}
|
|
660
668
|
}
|
|
661
669
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/postcss",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.10-alpha.0",
|
|
4
4
|
"description": "@weapp-tailwindcss/postcss",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"@weapp-tailwindcss/shared": "1.0.2"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@weapp-tailwindcss/mangle": "1.0.
|
|
44
|
+
"@weapp-tailwindcss/mangle": "1.0.4"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"dev": "tsup --watch --sourcemap",
|