@weapp-tailwindcss/postcss 2.2.1-next.3 → 2.2.1-next.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/dist/index.js +26 -1
- package/dist/index.mjs +26 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -691,6 +691,7 @@ const WEAPP_AUTOPREFIXER_BROWSERS = [
|
|
|
691
691
|
"Android >= 4.4",
|
|
692
692
|
"ChromeAndroid >= 37"
|
|
693
693
|
];
|
|
694
|
+
const WEAPP_AUTOPREFIXER_DEFAULT_OPTIONS = { flexbox: false };
|
|
694
695
|
const AUTOPREFIXER_PLUGIN_NAME = "autoprefixer";
|
|
695
696
|
function isAutoprefixerPlugin(plugin) {
|
|
696
697
|
return plugin?.postcssPlugin === AUTOPREFIXER_PLUGIN_NAME;
|
|
@@ -699,6 +700,7 @@ function resolveAutoprefixerPlugin(option) {
|
|
|
699
700
|
if (option === false) return;
|
|
700
701
|
const userOptions = option === true || option === void 0 ? {} : option;
|
|
701
702
|
return (0, autoprefixer.default)({
|
|
703
|
+
...WEAPP_AUTOPREFIXER_DEFAULT_OPTIONS,
|
|
702
704
|
...userOptions,
|
|
703
705
|
overrideBrowserslist: userOptions.overrideBrowserslist ?? WEAPP_AUTOPREFIXER_BROWSERS
|
|
704
706
|
});
|
|
@@ -1966,6 +1968,21 @@ const DEFAULT_ROOT_SELECTORS$1 = [
|
|
|
1966
1968
|
".tw-root",
|
|
1967
1969
|
"wx-root-portal-content"
|
|
1968
1970
|
];
|
|
1971
|
+
const LEGACY_FLEXBOX_DECLARATION_PROPS = new Set([
|
|
1972
|
+
"-webkit-align-content",
|
|
1973
|
+
"-webkit-align-items",
|
|
1974
|
+
"-webkit-align-self",
|
|
1975
|
+
"-webkit-flex",
|
|
1976
|
+
"-webkit-flex-basis",
|
|
1977
|
+
"-webkit-flex-direction",
|
|
1978
|
+
"-webkit-flex-flow",
|
|
1979
|
+
"-webkit-flex-grow",
|
|
1980
|
+
"-webkit-flex-shrink",
|
|
1981
|
+
"-webkit-flex-wrap",
|
|
1982
|
+
"-webkit-justify-content",
|
|
1983
|
+
"-webkit-order"
|
|
1984
|
+
]);
|
|
1985
|
+
const LEGACY_FLEXBOX_DISPLAY_VALUES = new Set(["-webkit-flex", "-webkit-inline-flex"]);
|
|
1969
1986
|
function normalizeRootSelectors(value) {
|
|
1970
1987
|
if (value === void 0 || value === false) return [];
|
|
1971
1988
|
return Array.isArray(value) ? value.filter(Boolean) : [value];
|
|
@@ -1979,6 +1996,13 @@ function createHostSelectorAppender(options) {
|
|
|
1979
1996
|
return DEFAULT_ROOT_SELECTORS$1.every((selector) => selectors.includes(selector));
|
|
1980
1997
|
};
|
|
1981
1998
|
}
|
|
1999
|
+
function removeLegacyFlexboxPrefix(decl) {
|
|
2000
|
+
if (decl.prop === "display" && LEGACY_FLEXBOX_DISPLAY_VALUES.has(decl.value)) {
|
|
2001
|
+
decl.remove();
|
|
2002
|
+
return;
|
|
2003
|
+
}
|
|
2004
|
+
if (LEGACY_FLEXBOX_DECLARATION_PROPS.has(decl.prop)) decl.remove();
|
|
2005
|
+
}
|
|
1982
2006
|
const postcssWeappTailwindcssPostPlugin = (options) => {
|
|
1983
2007
|
const opts = (0, _weapp_tailwindcss_shared.defu)(options, { isMainChunk: true });
|
|
1984
2008
|
const p = { postcssPlugin };
|
|
@@ -2007,6 +2031,7 @@ const postcssWeappTailwindcssPostPlugin = (options) => {
|
|
|
2007
2031
|
if (opts.majorVersion === void 0) normalizeTailwindcssRpxDeclaration(decl);
|
|
2008
2032
|
else normalizeTailwindcssRpxDeclaration(decl, { majorVersion: opts.majorVersion });
|
|
2009
2033
|
if (enableMainChunkTransforms) normalizeTailwindcssV4Declaration(decl);
|
|
2034
|
+
removeLegacyFlexboxPrefix(decl);
|
|
2010
2035
|
};
|
|
2011
2036
|
if (enableMainChunkTransforms) p.AtRuleExit = (atRule) => {
|
|
2012
2037
|
/**
|
|
@@ -2464,7 +2489,7 @@ function shouldUseDefaultAutoprefixer(options, userPlugins) {
|
|
|
2464
2489
|
if (options.autoprefixer === false) return false;
|
|
2465
2490
|
if (hasUserAutoprefixerPlugin(options.postcssOptions?.plugins, userPlugins)) return false;
|
|
2466
2491
|
if (options.autoprefixer === true || typeof options.autoprefixer === "object") return true;
|
|
2467
|
-
return options.majorVersion === 4;
|
|
2492
|
+
return options.majorVersion === 3 || options.majorVersion === 4;
|
|
2468
2493
|
}
|
|
2469
2494
|
function createPreparedNodes(options, signal) {
|
|
2470
2495
|
const preparedNodes = [];
|
package/dist/index.mjs
CHANGED
|
@@ -681,6 +681,7 @@ const WEAPP_AUTOPREFIXER_BROWSERS = [
|
|
|
681
681
|
"Android >= 4.4",
|
|
682
682
|
"ChromeAndroid >= 37"
|
|
683
683
|
];
|
|
684
|
+
const WEAPP_AUTOPREFIXER_DEFAULT_OPTIONS = { flexbox: false };
|
|
684
685
|
const AUTOPREFIXER_PLUGIN_NAME = "autoprefixer";
|
|
685
686
|
function isAutoprefixerPlugin(plugin) {
|
|
686
687
|
return plugin?.postcssPlugin === AUTOPREFIXER_PLUGIN_NAME;
|
|
@@ -689,6 +690,7 @@ function resolveAutoprefixerPlugin(option) {
|
|
|
689
690
|
if (option === false) return;
|
|
690
691
|
const userOptions = option === true || option === void 0 ? {} : option;
|
|
691
692
|
return autoprefixerPlugin({
|
|
693
|
+
...WEAPP_AUTOPREFIXER_DEFAULT_OPTIONS,
|
|
692
694
|
...userOptions,
|
|
693
695
|
overrideBrowserslist: userOptions.overrideBrowserslist ?? WEAPP_AUTOPREFIXER_BROWSERS
|
|
694
696
|
});
|
|
@@ -1956,6 +1958,21 @@ const DEFAULT_ROOT_SELECTORS$1 = [
|
|
|
1956
1958
|
".tw-root",
|
|
1957
1959
|
"wx-root-portal-content"
|
|
1958
1960
|
];
|
|
1961
|
+
const LEGACY_FLEXBOX_DECLARATION_PROPS = new Set([
|
|
1962
|
+
"-webkit-align-content",
|
|
1963
|
+
"-webkit-align-items",
|
|
1964
|
+
"-webkit-align-self",
|
|
1965
|
+
"-webkit-flex",
|
|
1966
|
+
"-webkit-flex-basis",
|
|
1967
|
+
"-webkit-flex-direction",
|
|
1968
|
+
"-webkit-flex-flow",
|
|
1969
|
+
"-webkit-flex-grow",
|
|
1970
|
+
"-webkit-flex-shrink",
|
|
1971
|
+
"-webkit-flex-wrap",
|
|
1972
|
+
"-webkit-justify-content",
|
|
1973
|
+
"-webkit-order"
|
|
1974
|
+
]);
|
|
1975
|
+
const LEGACY_FLEXBOX_DISPLAY_VALUES = new Set(["-webkit-flex", "-webkit-inline-flex"]);
|
|
1959
1976
|
function normalizeRootSelectors(value) {
|
|
1960
1977
|
if (value === void 0 || value === false) return [];
|
|
1961
1978
|
return Array.isArray(value) ? value.filter(Boolean) : [value];
|
|
@@ -1969,6 +1986,13 @@ function createHostSelectorAppender(options) {
|
|
|
1969
1986
|
return DEFAULT_ROOT_SELECTORS$1.every((selector) => selectors.includes(selector));
|
|
1970
1987
|
};
|
|
1971
1988
|
}
|
|
1989
|
+
function removeLegacyFlexboxPrefix(decl) {
|
|
1990
|
+
if (decl.prop === "display" && LEGACY_FLEXBOX_DISPLAY_VALUES.has(decl.value)) {
|
|
1991
|
+
decl.remove();
|
|
1992
|
+
return;
|
|
1993
|
+
}
|
|
1994
|
+
if (LEGACY_FLEXBOX_DECLARATION_PROPS.has(decl.prop)) decl.remove();
|
|
1995
|
+
}
|
|
1972
1996
|
const postcssWeappTailwindcssPostPlugin = (options) => {
|
|
1973
1997
|
const opts = defu(options, { isMainChunk: true });
|
|
1974
1998
|
const p = { postcssPlugin };
|
|
@@ -1997,6 +2021,7 @@ const postcssWeappTailwindcssPostPlugin = (options) => {
|
|
|
1997
2021
|
if (opts.majorVersion === void 0) normalizeTailwindcssRpxDeclaration(decl);
|
|
1998
2022
|
else normalizeTailwindcssRpxDeclaration(decl, { majorVersion: opts.majorVersion });
|
|
1999
2023
|
if (enableMainChunkTransforms) normalizeTailwindcssV4Declaration(decl);
|
|
2024
|
+
removeLegacyFlexboxPrefix(decl);
|
|
2000
2025
|
};
|
|
2001
2026
|
if (enableMainChunkTransforms) p.AtRuleExit = (atRule) => {
|
|
2002
2027
|
/**
|
|
@@ -2454,7 +2479,7 @@ function shouldUseDefaultAutoprefixer(options, userPlugins) {
|
|
|
2454
2479
|
if (options.autoprefixer === false) return false;
|
|
2455
2480
|
if (hasUserAutoprefixerPlugin(options.postcssOptions?.plugins, userPlugins)) return false;
|
|
2456
2481
|
if (options.autoprefixer === true || typeof options.autoprefixer === "object") return true;
|
|
2457
|
-
return options.majorVersion === 4;
|
|
2482
|
+
return options.majorVersion === 3 || options.majorVersion === 4;
|
|
2458
2483
|
}
|
|
2459
2484
|
function createPreparedNodes(options, signal) {
|
|
2460
2485
|
const preparedNodes = [];
|