@weapp-tailwindcss/postcss 1.0.8 → 1.0.9
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 +16 -9
- package/dist/index.mjs +7 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -642,6 +642,9 @@ 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
|
+
function isTailwindcssV4ModerCheck(atRule) {
|
|
646
|
+
return atRule.name === "supports" && atRule.params === "((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b))))";
|
|
647
|
+
}
|
|
645
648
|
var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
646
649
|
const opts = _shared.defu.call(void 0, options, { isMainChunk: true });
|
|
647
650
|
const p = {
|
|
@@ -656,6 +659,10 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
656
659
|
} else {
|
|
657
660
|
atRule.remove();
|
|
658
661
|
}
|
|
662
|
+
} else if (isTailwindcssV4ModerCheck(atRule)) {
|
|
663
|
+
if (_optionalChain([atRule, 'access', _28 => _28.first, 'optionalAccess', _29 => _29.type]) === "atrule" && atRule.first.name === "layer") {
|
|
664
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
665
|
+
}
|
|
659
666
|
}
|
|
660
667
|
}
|
|
661
668
|
};
|
|
@@ -679,7 +686,7 @@ function compare(e3, t2) {
|
|
|
679
686
|
return e3.a === t2.a ? e3.b === t2.b ? e3.c - t2.c : e3.b - t2.b : e3.a - t2.a;
|
|
680
687
|
}
|
|
681
688
|
function selectorSpecificity(t2, s) {
|
|
682
|
-
const i = _optionalChain([s, 'optionalAccess',
|
|
689
|
+
const i = _optionalChain([s, 'optionalAccess', _30 => _30.customSpecificity, 'optionalCall', _31 => _31(t2)]);
|
|
683
690
|
if (i) return i;
|
|
684
691
|
if (!t2) return { a: 0, b: 0, c: 0 };
|
|
685
692
|
let c = 0, n = 0, o2 = 0;
|
|
@@ -755,7 +762,7 @@ function selectorSpecificity(t2, s) {
|
|
|
755
762
|
case ":active-view-transition-type":
|
|
756
763
|
return { a: 0, b: 1, c: 0 };
|
|
757
764
|
}
|
|
758
|
-
else _postcssselectorparser2.default.isContainer(t2) && _optionalChain([t2, 'access',
|
|
765
|
+
else _postcssselectorparser2.default.isContainer(t2) && _optionalChain([t2, 'access', _32 => _32.nodes, 'optionalAccess', _33 => _33.length]) > 0 && t2.nodes.forEach((e3) => {
|
|
759
766
|
const t3 = selectorSpecificity(e3, s);
|
|
760
767
|
c += t3.a, n += t3.b, o2 += t3.c;
|
|
761
768
|
});
|
|
@@ -783,8 +790,8 @@ function alwaysValidSelector(s) {
|
|
|
783
790
|
const o2 = _postcssselectorparser2.default.call(void 0, ).astSync(s);
|
|
784
791
|
let t2 = true;
|
|
785
792
|
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',
|
|
793
|
+
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())) {
|
|
794
|
+
if ("pseudo" === e3.type && 1 === _optionalChain([e3, 'access', _36 => _36.nodes, 'optionalAccess', _37 => _37.length]) && ":not" === e3.value.toLowerCase()) {
|
|
788
795
|
let s2 = true;
|
|
789
796
|
if (e3.nodes[0].walkCombinators(() => {
|
|
790
797
|
s2 = false;
|
|
@@ -896,8 +903,8 @@ function splitSelectors(o2, t2, n = 0) {
|
|
|
896
903
|
if (_postcssselectorparser2.default.call(void 0, ).astSync(o3).walkPseudos((e3) => {
|
|
897
904
|
if (":is" !== e3.value.toLowerCase() || !e3.nodes || !e3.nodes.length) return;
|
|
898
905
|
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',
|
|
906
|
+
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()})` }]);
|
|
907
|
+
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
908
|
let o4 = e3.parent;
|
|
902
909
|
for (; o4; ) {
|
|
903
910
|
if (o4.value && ":is" === o4.value.toLowerCase() && "pseudo" === o4.type) return void (a = true);
|
|
@@ -919,7 +926,7 @@ function splitSelectors(o2, t2, n = 0) {
|
|
|
919
926
|
let s = "";
|
|
920
927
|
for (let t3 = 0; t3 < e3.length; t3++) {
|
|
921
928
|
const n2 = e3[t3];
|
|
922
|
-
s += o3.substring(_optionalChain([e3, 'access',
|
|
929
|
+
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
930
|
}
|
|
924
931
|
c.push(s);
|
|
925
932
|
}), a && n < 10 && (c = splitSelectors(c, t2, n + 1)), c;
|
|
@@ -980,7 +987,7 @@ function getPlugins(options) {
|
|
|
980
987
|
const ctx = createContext();
|
|
981
988
|
options.ctx = ctx;
|
|
982
989
|
const plugins = [
|
|
983
|
-
..._nullishCoalesce(_optionalChain([options, 'access',
|
|
990
|
+
..._nullishCoalesce(_optionalChain([options, 'access', _56 => _56.postcssOptions, 'optionalAccess', _57 => _57.plugins]), () => ( [])),
|
|
984
991
|
postcssWeappTailwindcssPrePlugin(options),
|
|
985
992
|
_postcsspresetenv2.default.call(void 0, options.cssPresetEnv)
|
|
986
993
|
];
|
|
@@ -1024,7 +1031,7 @@ function styleHandler(rawSource, options) {
|
|
|
1024
1031
|
getPlugins(options)
|
|
1025
1032
|
).process(
|
|
1026
1033
|
rawSource,
|
|
1027
|
-
_nullishCoalesce(_optionalChain([options, 'access',
|
|
1034
|
+
_nullishCoalesce(_optionalChain([options, 'access', _58 => _58.postcssOptions, 'optionalAccess', _59 => _59.options]), () => ( {
|
|
1028
1035
|
from: void 0
|
|
1029
1036
|
}))
|
|
1030
1037
|
).async();
|
package/dist/index.mjs
CHANGED
|
@@ -642,6 +642,9 @@ 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
|
+
function isTailwindcssV4ModerCheck(atRule) {
|
|
646
|
+
return atRule.name === "supports" && atRule.params === "((-webkit-hyphens: none) and (not (margin-trim: inline))) or ((-moz-orient: inline) and (not (color:rgb(from red r g b))))";
|
|
647
|
+
}
|
|
645
648
|
var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
646
649
|
const opts = defu2(options, { isMainChunk: true });
|
|
647
650
|
const p = {
|
|
@@ -656,6 +659,10 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
656
659
|
} else {
|
|
657
660
|
atRule.remove();
|
|
658
661
|
}
|
|
662
|
+
} else if (isTailwindcssV4ModerCheck(atRule)) {
|
|
663
|
+
if (atRule.first?.type === "atrule" && atRule.first.name === "layer") {
|
|
664
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
665
|
+
}
|
|
659
666
|
}
|
|
660
667
|
}
|
|
661
668
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/postcss",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
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",
|