@weapp-tailwindcss/postcss 1.0.10-alpha.1 → 1.0.10-alpha.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/index.js +33 -14
- package/dist/index.mjs +24 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -21,7 +21,11 @@ function getDefaultOptions() {
|
|
|
21
21
|
add: false
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
cssRemoveProperty: true
|
|
24
|
+
cssRemoveProperty: true,
|
|
25
|
+
cssSelectorReplacement: {
|
|
26
|
+
root: "page",
|
|
27
|
+
universal: ["view", "text"]
|
|
28
|
+
}
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -664,15 +668,30 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
664
668
|
} else {
|
|
665
669
|
atRule.remove();
|
|
666
670
|
}
|
|
667
|
-
} else if (isTailwindcssV4ModernCheck(atRule)) {
|
|
668
|
-
if (_optionalChain([atRule, 'access', _28 => _28.first, 'optionalAccess', _29 => _29.type]) === "atrule" && atRule.first.name === "layer") {
|
|
669
|
-
atRule.replaceWith(atRule.first.nodes);
|
|
670
|
-
}
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
};
|
|
674
674
|
if (opts.isMainChunk) {
|
|
675
|
+
let layerProperties;
|
|
675
676
|
p.Once = (root) => {
|
|
677
|
+
root.walkAtRules((atRule) => {
|
|
678
|
+
if (atRule.name === "layer" && atRule.params === "properties") {
|
|
679
|
+
if (atRule.nodes === void 0 || _optionalChain([atRule, 'access', _28 => _28.nodes, 'optionalAccess', _29 => _29.length]) === 0) {
|
|
680
|
+
layerProperties = atRule;
|
|
681
|
+
} else if (_optionalChain([atRule, 'access', _30 => _30.first, 'optionalAccess', _31 => _31.type]) === "atrule" && isTailwindcssV4ModernCheck(atRule.first)) {
|
|
682
|
+
if (layerProperties) {
|
|
683
|
+
layerProperties.replaceWith(atRule.first.nodes);
|
|
684
|
+
atRule.remove();
|
|
685
|
+
} else {
|
|
686
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
} else if (isTailwindcssV4ModernCheck(atRule)) {
|
|
690
|
+
if (_optionalChain([atRule, 'access', _32 => _32.first, 'optionalAccess', _33 => _33.type]) === "atrule" && atRule.first.name === "layer") {
|
|
691
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
});
|
|
676
695
|
root.walkRules((rule) => {
|
|
677
696
|
commonChunkPreflight(rule, opts);
|
|
678
697
|
});
|
|
@@ -691,7 +710,7 @@ function compare(e3, t2) {
|
|
|
691
710
|
return e3.a === t2.a ? e3.b === t2.b ? e3.c - t2.c : e3.b - t2.b : e3.a - t2.a;
|
|
692
711
|
}
|
|
693
712
|
function selectorSpecificity(t2, s) {
|
|
694
|
-
const i = _optionalChain([s, 'optionalAccess',
|
|
713
|
+
const i = _optionalChain([s, 'optionalAccess', _34 => _34.customSpecificity, 'optionalCall', _35 => _35(t2)]);
|
|
695
714
|
if (i) return i;
|
|
696
715
|
if (!t2) return { a: 0, b: 0, c: 0 };
|
|
697
716
|
let c = 0, n = 0, o2 = 0;
|
|
@@ -767,7 +786,7 @@ function selectorSpecificity(t2, s) {
|
|
|
767
786
|
case ":active-view-transition-type":
|
|
768
787
|
return { a: 0, b: 1, c: 0 };
|
|
769
788
|
}
|
|
770
|
-
else _postcssselectorparser2.default.isContainer(t2) && _optionalChain([t2, 'access',
|
|
789
|
+
else _postcssselectorparser2.default.isContainer(t2) && _optionalChain([t2, 'access', _36 => _36.nodes, 'optionalAccess', _37 => _37.length]) > 0 && t2.nodes.forEach((e3) => {
|
|
771
790
|
const t3 = selectorSpecificity(e3, s);
|
|
772
791
|
c += t3.a, n += t3.b, o2 += t3.c;
|
|
773
792
|
});
|
|
@@ -795,8 +814,8 @@ function alwaysValidSelector(s) {
|
|
|
795
814
|
const o2 = _postcssselectorparser2.default.call(void 0, ).astSync(s);
|
|
796
815
|
let t2 = true;
|
|
797
816
|
return o2.walk((e3) => {
|
|
798
|
-
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',
|
|
799
|
-
if ("pseudo" === e3.type && 1 === _optionalChain([e3, 'access',
|
|
817
|
+
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', _38 => _38.nodes, 'optionalAccess', _39 => _39.length]) || ":hover" !== e3.value.toLowerCase() && ":focus" !== e3.value.toLowerCase())) {
|
|
818
|
+
if ("pseudo" === e3.type && 1 === _optionalChain([e3, 'access', _40 => _40.nodes, 'optionalAccess', _41 => _41.length]) && ":not" === e3.value.toLowerCase()) {
|
|
800
819
|
let s2 = true;
|
|
801
820
|
if (e3.nodes[0].walkCombinators(() => {
|
|
802
821
|
s2 = false;
|
|
@@ -908,8 +927,8 @@ function splitSelectors(o2, t2, n = 0) {
|
|
|
908
927
|
if (_postcssselectorparser2.default.call(void 0, ).astSync(o3).walkPseudos((e3) => {
|
|
909
928
|
if (":is" !== e3.value.toLowerCase() || !e3.nodes || !e3.nodes.length) return;
|
|
910
929
|
if ("selector" === e3.nodes[0].type && 0 === e3.nodes[0].nodes.length) return;
|
|
911
|
-
if ("pseudo" === _optionalChain([e3, 'access',
|
|
912
|
-
if ("pseudo" === _optionalChain([e3, 'access',
|
|
930
|
+
if ("pseudo" === _optionalChain([e3, 'access', _42 => _42.parent, 'optionalAccess', _43 => _43.parent, 'optionalAccess', _44 => _44.type]) && ":not" === _optionalChain([e3, 'access', _45 => _45.parent, 'optionalAccess', _46 => _46.parent, 'optionalAccess', _47 => _47.value, 'optionalAccess', _48 => _48.toLowerCase, 'call', _49 => _49()])) return void i.push([{ start: e3.parent.parent.sourceIndex, end: e3.parent.parent.sourceIndex + e3.parent.parent.toString().length, option: `:not(${e3.nodes.toString()})` }]);
|
|
931
|
+
if ("pseudo" === _optionalChain([e3, 'access', _50 => _50.parent, 'optionalAccess', _51 => _51.parent, 'optionalAccess', _52 => _52.type]) && ":has" === _optionalChain([e3, 'access', _53 => _53.parent, 'optionalAccess', _54 => _54.parent, 'optionalAccess', _55 => _55.value, 'optionalAccess', _56 => _56.toLowerCase, 'call', _57 => _57()])) return void (e3.value = ":-csstools-matches");
|
|
913
932
|
let o4 = e3.parent;
|
|
914
933
|
for (; o4; ) {
|
|
915
934
|
if (o4.value && ":is" === o4.value.toLowerCase() && "pseudo" === o4.type) return void (a = true);
|
|
@@ -931,7 +950,7 @@ function splitSelectors(o2, t2, n = 0) {
|
|
|
931
950
|
let s = "";
|
|
932
951
|
for (let t3 = 0; t3 < e3.length; t3++) {
|
|
933
952
|
const n2 = e3[t3];
|
|
934
|
-
s += o3.substring(_optionalChain([e3, 'access',
|
|
953
|
+
s += o3.substring(_optionalChain([e3, 'access', _58 => _58[t3 - 1], 'optionalAccess', _59 => _59.end]) || 0, e3[t3].start), s += ":-csstools-matches(" + n2.option + ")", t3 === e3.length - 1 && (s += o3.substring(e3[t3].end));
|
|
935
954
|
}
|
|
936
955
|
c.push(s);
|
|
937
956
|
}), a && n < 10 && (c = splitSelectors(c, t2, n + 1)), c;
|
|
@@ -992,7 +1011,7 @@ function getPlugins(options) {
|
|
|
992
1011
|
const ctx = createContext();
|
|
993
1012
|
options.ctx = ctx;
|
|
994
1013
|
const plugins = [
|
|
995
|
-
..._nullishCoalesce(_optionalChain([options, 'access',
|
|
1014
|
+
..._nullishCoalesce(_optionalChain([options, 'access', _60 => _60.postcssOptions, 'optionalAccess', _61 => _61.plugins]), () => ( [])),
|
|
996
1015
|
postcssWeappTailwindcssPrePlugin(options),
|
|
997
1016
|
_postcsspresetenv2.default.call(void 0, options.cssPresetEnv)
|
|
998
1017
|
];
|
|
@@ -1036,7 +1055,7 @@ function styleHandler(rawSource, options) {
|
|
|
1036
1055
|
getPlugins(options)
|
|
1037
1056
|
).process(
|
|
1038
1057
|
rawSource,
|
|
1039
|
-
_nullishCoalesce(_optionalChain([options, 'access',
|
|
1058
|
+
_nullishCoalesce(_optionalChain([options, 'access', _62 => _62.postcssOptions, 'optionalAccess', _63 => _63.options]), () => ( {
|
|
1040
1059
|
from: void 0
|
|
1041
1060
|
}))
|
|
1042
1061
|
).async();
|
package/dist/index.mjs
CHANGED
|
@@ -21,7 +21,11 @@ function getDefaultOptions() {
|
|
|
21
21
|
add: false
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
|
-
cssRemoveProperty: true
|
|
24
|
+
cssRemoveProperty: true,
|
|
25
|
+
cssSelectorReplacement: {
|
|
26
|
+
root: "page",
|
|
27
|
+
universal: ["view", "text"]
|
|
28
|
+
}
|
|
25
29
|
};
|
|
26
30
|
}
|
|
27
31
|
|
|
@@ -664,15 +668,30 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
664
668
|
} else {
|
|
665
669
|
atRule.remove();
|
|
666
670
|
}
|
|
667
|
-
} else if (isTailwindcssV4ModernCheck(atRule)) {
|
|
668
|
-
if (atRule.first?.type === "atrule" && atRule.first.name === "layer") {
|
|
669
|
-
atRule.replaceWith(atRule.first.nodes);
|
|
670
|
-
}
|
|
671
671
|
}
|
|
672
672
|
}
|
|
673
673
|
};
|
|
674
674
|
if (opts.isMainChunk) {
|
|
675
|
+
let layerProperties;
|
|
675
676
|
p.Once = (root) => {
|
|
677
|
+
root.walkAtRules((atRule) => {
|
|
678
|
+
if (atRule.name === "layer" && atRule.params === "properties") {
|
|
679
|
+
if (atRule.nodes === void 0 || atRule.nodes?.length === 0) {
|
|
680
|
+
layerProperties = atRule;
|
|
681
|
+
} else if (atRule.first?.type === "atrule" && isTailwindcssV4ModernCheck(atRule.first)) {
|
|
682
|
+
if (layerProperties) {
|
|
683
|
+
layerProperties.replaceWith(atRule.first.nodes);
|
|
684
|
+
atRule.remove();
|
|
685
|
+
} else {
|
|
686
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
} else if (isTailwindcssV4ModernCheck(atRule)) {
|
|
690
|
+
if (atRule.first?.type === "atrule" && atRule.first.name === "layer") {
|
|
691
|
+
atRule.replaceWith(atRule.first.nodes);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
});
|
|
676
695
|
root.walkRules((rule) => {
|
|
677
696
|
commonChunkPreflight(rule, opts);
|
|
678
697
|
});
|