@weapp-tailwindcss/postcss 1.3.3 → 1.3.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.d.mts +2 -3
- package/dist/index.d.ts +2 -3
- package/dist/index.js +76 -25
- package/dist/index.mjs +67 -16
- package/dist/{types-3q99gNro.d.mts → types-BuslrX7I.d.mts} +0 -3
- package/dist/{types-3q99gNro.d.ts → types-BuslrX7I.d.ts} +0 -3
- package/dist/types.d.mts +1 -2
- package/dist/types.d.ts +1 -2
- package/package.json +3 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-
|
|
2
|
-
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-
|
|
1
|
+
import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-BuslrX7I.mjs';
|
|
2
|
+
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-BuslrX7I.mjs';
|
|
3
3
|
import postcss from 'postcss';
|
|
4
4
|
export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
|
|
5
5
|
export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
|
|
6
6
|
export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
|
|
7
|
-
import '@weapp-tailwindcss/mangle';
|
|
8
7
|
import '@weapp-tailwindcss/postcss-calc';
|
|
9
8
|
import 'postcss-load-config';
|
|
10
9
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-
|
|
2
|
-
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-
|
|
1
|
+
import { I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions } from './types-BuslrX7I.js';
|
|
2
|
+
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions, c as createInjectPreflight } from './types-BuslrX7I.js';
|
|
3
3
|
import postcss from 'postcss';
|
|
4
4
|
export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
|
|
5
5
|
export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
|
|
6
6
|
export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
|
|
7
|
-
import '@weapp-tailwindcss/mangle';
|
|
8
7
|
import '@weapp-tailwindcss/postcss-calc';
|
|
9
8
|
import 'postcss-load-config';
|
|
10
9
|
|
package/dist/index.js
CHANGED
|
@@ -56,7 +56,7 @@ function createContext() {
|
|
|
56
56
|
// src/plugins/getCalcPlugin.ts
|
|
57
57
|
var _postcsscalc = require('@weapp-tailwindcss/postcss-calc'); var _postcsscalc2 = _interopRequireDefault(_postcsscalc);
|
|
58
58
|
|
|
59
|
-
// ../../node_modules/.pnpm/es-toolkit@1.
|
|
59
|
+
// ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/object/omit.mjs
|
|
60
60
|
function omit(obj, keys) {
|
|
61
61
|
const result = { ...obj };
|
|
62
62
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -357,10 +357,7 @@ var _escape = require('@weapp-core/escape');
|
|
|
357
357
|
function internalCssSelectorReplacer(selectors, options = {
|
|
358
358
|
escapeMap: _escape.MappingChars2String
|
|
359
359
|
}) {
|
|
360
|
-
const {
|
|
361
|
-
if (mangleContext) {
|
|
362
|
-
selectors = mangleContext.cssHandler(selectors);
|
|
363
|
-
}
|
|
360
|
+
const { escapeMap } = options;
|
|
364
361
|
return _escape.escape.call(void 0, selectors, {
|
|
365
362
|
map: escapeMap
|
|
366
363
|
});
|
|
@@ -379,7 +376,7 @@ function composeIsPseudo(strs) {
|
|
|
379
376
|
var ruleTransformCache = /* @__PURE__ */ new WeakMap();
|
|
380
377
|
function createRuleTransformer(options) {
|
|
381
378
|
let currentRule;
|
|
382
|
-
const { escapeMap,
|
|
379
|
+
const { escapeMap, cssSelectorReplacement, cssRemoveHoverPseudoClass, uniAppX } = options;
|
|
383
380
|
const transform = (selectors) => {
|
|
384
381
|
const rule = currentRule;
|
|
385
382
|
if (!rule) {
|
|
@@ -388,8 +385,7 @@ function createRuleTransformer(options) {
|
|
|
388
385
|
selectors.walk((selector, index) => {
|
|
389
386
|
if (selector.type === "class") {
|
|
390
387
|
selector.value = internalCssSelectorReplacer(selector.value, {
|
|
391
|
-
escapeMap
|
|
392
|
-
mangleContext
|
|
388
|
+
escapeMap
|
|
393
389
|
});
|
|
394
390
|
} else if (selector.type === "universal") {
|
|
395
391
|
if (_optionalChain([cssSelectorReplacement, 'optionalAccess', _22 => _22.universal])) {
|
|
@@ -513,6 +509,54 @@ function ruleTransformSync(rule, options) {
|
|
|
513
509
|
}
|
|
514
510
|
|
|
515
511
|
// src/plugins/post.ts
|
|
512
|
+
function normalizeSelectorList(value) {
|
|
513
|
+
if (value === void 0 || value === false) {
|
|
514
|
+
return [];
|
|
515
|
+
}
|
|
516
|
+
return Array.isArray(value) ? value.filter(Boolean) : [value];
|
|
517
|
+
}
|
|
518
|
+
function getSpecificityMatchingName(options) {
|
|
519
|
+
const feature = _optionalChain([options, 'access', _32 => _32.cssPresetEnv, 'optionalAccess', _33 => _33.features, 'optionalAccess', _34 => _34["is-pseudo-class"]]);
|
|
520
|
+
if (feature && typeof feature === "object" && "specificityMatchingName" in feature) {
|
|
521
|
+
const specificityName = feature.specificityMatchingName;
|
|
522
|
+
return typeof specificityName === "string" && specificityName.length > 0 ? specificityName : void 0;
|
|
523
|
+
}
|
|
524
|
+
return void 0;
|
|
525
|
+
}
|
|
526
|
+
function createRootSpecificityCleaner(options) {
|
|
527
|
+
const specificityMatchingName = getSpecificityMatchingName(options);
|
|
528
|
+
const selectors = normalizeSelectorList(_optionalChain([options, 'access', _35 => _35.cssSelectorReplacement, 'optionalAccess', _36 => _36.root]));
|
|
529
|
+
if (!specificityMatchingName || selectors.length === 0) {
|
|
530
|
+
return void 0;
|
|
531
|
+
}
|
|
532
|
+
const suffix = `:not(.${specificityMatchingName})`;
|
|
533
|
+
const targets = selectors.map((selector) => _optionalChain([selector, 'optionalAccess', _37 => _37.trim, 'call', _38 => _38()])).filter((selector) => Boolean(_optionalChain([selector, 'optionalAccess', _39 => _39.length]))).map((selector) => ({
|
|
534
|
+
match: `${selector}${suffix}`,
|
|
535
|
+
spacedMatch: `${selector} ${suffix}`,
|
|
536
|
+
replacement: selector
|
|
537
|
+
}));
|
|
538
|
+
if (!targets.length) {
|
|
539
|
+
return void 0;
|
|
540
|
+
}
|
|
541
|
+
return (rule) => {
|
|
542
|
+
if (!rule.selectors || rule.selectors.length === 0) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const next = rule.selectors.map((selector) => {
|
|
546
|
+
let updated = selector;
|
|
547
|
+
for (const target of targets) {
|
|
548
|
+
if (updated.includes(target.match)) {
|
|
549
|
+
updated = updated.split(target.match).join(target.replacement);
|
|
550
|
+
}
|
|
551
|
+
if (updated.includes(target.spacedMatch)) {
|
|
552
|
+
updated = updated.split(target.spacedMatch).join(target.replacement);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return updated;
|
|
556
|
+
});
|
|
557
|
+
rule.selectors = next;
|
|
558
|
+
};
|
|
559
|
+
}
|
|
516
560
|
var OklabSuffix = "in oklab";
|
|
517
561
|
var logicalPropMap = /* @__PURE__ */ new Map([
|
|
518
562
|
["margin-inline-start", "margin-left"],
|
|
@@ -582,20 +626,27 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
|
|
|
582
626
|
const p = {
|
|
583
627
|
postcssPlugin
|
|
584
628
|
};
|
|
585
|
-
|
|
586
|
-
|
|
629
|
+
const cleanRootSpecificity = createRootSpecificityCleaner(opts);
|
|
630
|
+
const enableMainChunkTransforms = opts.isMainChunk !== false;
|
|
631
|
+
if (enableMainChunkTransforms || cleanRootSpecificity) {
|
|
632
|
+
const fallbackRemove = enableMainChunkTransforms ? getFallbackRemove(void 0, opts) : void 0;
|
|
587
633
|
p.RuleExit = (rule) => {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
if (rule.selectors.length === 0 || rule.selectors.length === 1 && rule.selector.trim() === "") {
|
|
591
|
-
rule.remove();
|
|
634
|
+
if (enableMainChunkTransforms) {
|
|
635
|
+
_optionalChain([fallbackRemove, 'optionalAccess', _40 => _40.transformSync, 'call', _41 => _41(rule)]);
|
|
592
636
|
}
|
|
593
|
-
|
|
594
|
-
|
|
637
|
+
_optionalChain([cleanRootSpecificity, 'optionalCall', _42 => _42(rule)]);
|
|
638
|
+
if (enableMainChunkTransforms) {
|
|
639
|
+
dedupeDeclarations(rule);
|
|
640
|
+
if (rule.selectors.length === 0 || rule.selectors.length === 1 && rule.selector.trim() === "") {
|
|
641
|
+
rule.remove();
|
|
642
|
+
}
|
|
643
|
+
if (opts.uniAppX && rule.nodes.length === 0) {
|
|
595
644
|
rule.remove();
|
|
596
645
|
}
|
|
597
646
|
}
|
|
598
647
|
};
|
|
648
|
+
}
|
|
649
|
+
if (enableMainChunkTransforms) {
|
|
599
650
|
p.DeclarationExit = (decl) => {
|
|
600
651
|
if (decl.prop === "--tw-gradient-position" && decl.value.endsWith(OklabSuffix)) {
|
|
601
652
|
decl.value = decl.value.slice(0, decl.value.length - OklabSuffix.length);
|
|
@@ -607,12 +658,12 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
|
|
|
607
658
|
if (opts.cssRemoveProperty && atRule.name === "property") {
|
|
608
659
|
atRule.remove();
|
|
609
660
|
}
|
|
610
|
-
_optionalChain([atRule, 'access',
|
|
661
|
+
_optionalChain([atRule, 'access', _43 => _43.nodes, 'optionalAccess', _44 => _44.length]) === 0 && atRule.remove();
|
|
611
662
|
};
|
|
612
663
|
}
|
|
613
664
|
if (typeof opts.customRuleCallback === "function") {
|
|
614
665
|
p.Rule = (rule) => {
|
|
615
|
-
_optionalChain([opts, 'access',
|
|
666
|
+
_optionalChain([opts, 'access', _45 => _45.customRuleCallback, 'optionalCall', _46 => _46(rule, opts)]);
|
|
616
667
|
};
|
|
617
668
|
}
|
|
618
669
|
return p;
|
|
@@ -1053,7 +1104,7 @@ function remakeCssVarSelector(selectors, options) {
|
|
|
1053
1104
|
function commonChunkPreflight(node, options) {
|
|
1054
1105
|
const { ctx, cssInjectPreflight, injectAdditionalCssVarScope } = options;
|
|
1055
1106
|
if (testIfVariablesScope(node)) {
|
|
1056
|
-
_optionalChain([ctx, 'optionalAccess',
|
|
1107
|
+
_optionalChain([ctx, 'optionalAccess', _47 => _47.markVariablesScope, 'call', _48 => _48(node)]);
|
|
1057
1108
|
node.selectors = remakeCssVarSelector(node.selectors, options);
|
|
1058
1109
|
node.before(makePseudoVarRule());
|
|
1059
1110
|
if (typeof cssInjectPreflight === "function") {
|
|
@@ -1118,9 +1169,9 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
1118
1169
|
root.walkAtRules((atRule) => {
|
|
1119
1170
|
if (atRule.name === "layer") {
|
|
1120
1171
|
if (atRule.params === "properties") {
|
|
1121
|
-
if (atRule.nodes === void 0 || _optionalChain([atRule, 'access',
|
|
1172
|
+
if (atRule.nodes === void 0 || _optionalChain([atRule, 'access', _49 => _49.nodes, 'optionalAccess', _50 => _50.length]) === 0) {
|
|
1122
1173
|
layerProperties = atRule;
|
|
1123
|
-
} else if (_optionalChain([atRule, 'access',
|
|
1174
|
+
} else if (_optionalChain([atRule, 'access', _51 => _51.first, 'optionalAccess', _52 => _52.type]) === "atrule" && isTailwindcssV4ModernCheck(atRule.first)) {
|
|
1124
1175
|
if (layerProperties) {
|
|
1125
1176
|
layerProperties.replaceWith(atRule.first.nodes);
|
|
1126
1177
|
atRule.remove();
|
|
@@ -1132,7 +1183,7 @@ var postcssWeappTailwindcssPrePlugin = (options) => {
|
|
|
1132
1183
|
atRule.replaceWith(atRule.nodes);
|
|
1133
1184
|
}
|
|
1134
1185
|
} else if (isTailwindcssV4ModernCheck(atRule)) {
|
|
1135
|
-
if (_optionalChain([atRule, 'access',
|
|
1186
|
+
if (_optionalChain([atRule, 'access', _53 => _53.first, 'optionalAccess', _54 => _54.type]) === "atrule" && atRule.first.name === "layer") {
|
|
1136
1187
|
atRule.replaceWith(atRule.first.nodes);
|
|
1137
1188
|
}
|
|
1138
1189
|
}
|
|
@@ -1172,7 +1223,7 @@ function getPlugins(options) {
|
|
|
1172
1223
|
const ctx = createContext();
|
|
1173
1224
|
options.ctx = ctx;
|
|
1174
1225
|
const plugins = [
|
|
1175
|
-
..._nullishCoalesce(_optionalChain([options, 'access',
|
|
1226
|
+
..._nullishCoalesce(_optionalChain([options, 'access', _55 => _55.postcssOptions, 'optionalAccess', _56 => _56.plugins]), () => ( [])),
|
|
1176
1227
|
postcssWeappTailwindcssPrePlugin(options),
|
|
1177
1228
|
_postcsspresetenv2.default.call(void 0, options.cssPresetEnv),
|
|
1178
1229
|
...normalizePlugins(options),
|
|
@@ -1204,7 +1255,7 @@ function createInjectPreflight(options) {
|
|
|
1204
1255
|
function createProcessOptions(options) {
|
|
1205
1256
|
return {
|
|
1206
1257
|
from: void 0,
|
|
1207
|
-
..._nullishCoalesce(_optionalChain([options, 'access',
|
|
1258
|
+
..._nullishCoalesce(_optionalChain([options, 'access', _57 => _57.postcssOptions, 'optionalAccess', _58 => _58.options]), () => ( {}))
|
|
1208
1259
|
};
|
|
1209
1260
|
}
|
|
1210
1261
|
var pluginCache = /* @__PURE__ */ new WeakMap();
|
|
@@ -1219,7 +1270,7 @@ function getCachedPlugins(options) {
|
|
|
1219
1270
|
return plugins;
|
|
1220
1271
|
}
|
|
1221
1272
|
function getCachedProcessOptions(options) {
|
|
1222
|
-
const source = _optionalChain([options, 'access',
|
|
1273
|
+
const source = _optionalChain([options, 'access', _59 => _59.postcssOptions, 'optionalAccess', _60 => _60.options]);
|
|
1223
1274
|
let cached = processOptionsCache.get(options);
|
|
1224
1275
|
const cachedSource = processOptionsSourceCache.get(options);
|
|
1225
1276
|
if (!cached || cachedSource !== source) {
|
package/dist/index.mjs
CHANGED
|
@@ -56,7 +56,7 @@ function createContext() {
|
|
|
56
56
|
// src/plugins/getCalcPlugin.ts
|
|
57
57
|
import postcssCalc from "@weapp-tailwindcss/postcss-calc";
|
|
58
58
|
|
|
59
|
-
// ../../node_modules/.pnpm/es-toolkit@1.
|
|
59
|
+
// ../../node_modules/.pnpm/es-toolkit@1.41.0/node_modules/es-toolkit/dist/object/omit.mjs
|
|
60
60
|
function omit(obj, keys) {
|
|
61
61
|
const result = { ...obj };
|
|
62
62
|
for (let i = 0; i < keys.length; i++) {
|
|
@@ -357,10 +357,7 @@ import { escape, MappingChars2String } from "@weapp-core/escape";
|
|
|
357
357
|
function internalCssSelectorReplacer(selectors, options = {
|
|
358
358
|
escapeMap: MappingChars2String
|
|
359
359
|
}) {
|
|
360
|
-
const {
|
|
361
|
-
if (mangleContext) {
|
|
362
|
-
selectors = mangleContext.cssHandler(selectors);
|
|
363
|
-
}
|
|
360
|
+
const { escapeMap } = options;
|
|
364
361
|
return escape(selectors, {
|
|
365
362
|
map: escapeMap
|
|
366
363
|
});
|
|
@@ -379,7 +376,7 @@ function composeIsPseudo(strs) {
|
|
|
379
376
|
var ruleTransformCache = /* @__PURE__ */ new WeakMap();
|
|
380
377
|
function createRuleTransformer(options) {
|
|
381
378
|
let currentRule;
|
|
382
|
-
const { escapeMap,
|
|
379
|
+
const { escapeMap, cssSelectorReplacement, cssRemoveHoverPseudoClass, uniAppX } = options;
|
|
383
380
|
const transform = (selectors) => {
|
|
384
381
|
const rule = currentRule;
|
|
385
382
|
if (!rule) {
|
|
@@ -388,8 +385,7 @@ function createRuleTransformer(options) {
|
|
|
388
385
|
selectors.walk((selector, index) => {
|
|
389
386
|
if (selector.type === "class") {
|
|
390
387
|
selector.value = internalCssSelectorReplacer(selector.value, {
|
|
391
|
-
escapeMap
|
|
392
|
-
mangleContext
|
|
388
|
+
escapeMap
|
|
393
389
|
});
|
|
394
390
|
} else if (selector.type === "universal") {
|
|
395
391
|
if (cssSelectorReplacement?.universal) {
|
|
@@ -513,6 +509,54 @@ function ruleTransformSync(rule, options) {
|
|
|
513
509
|
}
|
|
514
510
|
|
|
515
511
|
// src/plugins/post.ts
|
|
512
|
+
function normalizeSelectorList(value) {
|
|
513
|
+
if (value === void 0 || value === false) {
|
|
514
|
+
return [];
|
|
515
|
+
}
|
|
516
|
+
return Array.isArray(value) ? value.filter(Boolean) : [value];
|
|
517
|
+
}
|
|
518
|
+
function getSpecificityMatchingName(options) {
|
|
519
|
+
const feature = options.cssPresetEnv?.features?.["is-pseudo-class"];
|
|
520
|
+
if (feature && typeof feature === "object" && "specificityMatchingName" in feature) {
|
|
521
|
+
const specificityName = feature.specificityMatchingName;
|
|
522
|
+
return typeof specificityName === "string" && specificityName.length > 0 ? specificityName : void 0;
|
|
523
|
+
}
|
|
524
|
+
return void 0;
|
|
525
|
+
}
|
|
526
|
+
function createRootSpecificityCleaner(options) {
|
|
527
|
+
const specificityMatchingName = getSpecificityMatchingName(options);
|
|
528
|
+
const selectors = normalizeSelectorList(options.cssSelectorReplacement?.root);
|
|
529
|
+
if (!specificityMatchingName || selectors.length === 0) {
|
|
530
|
+
return void 0;
|
|
531
|
+
}
|
|
532
|
+
const suffix = `:not(.${specificityMatchingName})`;
|
|
533
|
+
const targets = selectors.map((selector) => selector?.trim()).filter((selector) => Boolean(selector?.length)).map((selector) => ({
|
|
534
|
+
match: `${selector}${suffix}`,
|
|
535
|
+
spacedMatch: `${selector} ${suffix}`,
|
|
536
|
+
replacement: selector
|
|
537
|
+
}));
|
|
538
|
+
if (!targets.length) {
|
|
539
|
+
return void 0;
|
|
540
|
+
}
|
|
541
|
+
return (rule) => {
|
|
542
|
+
if (!rule.selectors || rule.selectors.length === 0) {
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
const next = rule.selectors.map((selector) => {
|
|
546
|
+
let updated = selector;
|
|
547
|
+
for (const target of targets) {
|
|
548
|
+
if (updated.includes(target.match)) {
|
|
549
|
+
updated = updated.split(target.match).join(target.replacement);
|
|
550
|
+
}
|
|
551
|
+
if (updated.includes(target.spacedMatch)) {
|
|
552
|
+
updated = updated.split(target.spacedMatch).join(target.replacement);
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
return updated;
|
|
556
|
+
});
|
|
557
|
+
rule.selectors = next;
|
|
558
|
+
};
|
|
559
|
+
}
|
|
516
560
|
var OklabSuffix = "in oklab";
|
|
517
561
|
var logicalPropMap = /* @__PURE__ */ new Map([
|
|
518
562
|
["margin-inline-start", "margin-left"],
|
|
@@ -582,20 +626,27 @@ var postcssWeappTailwindcssPostPlugin = (options) => {
|
|
|
582
626
|
const p = {
|
|
583
627
|
postcssPlugin
|
|
584
628
|
};
|
|
585
|
-
|
|
586
|
-
|
|
629
|
+
const cleanRootSpecificity = createRootSpecificityCleaner(opts);
|
|
630
|
+
const enableMainChunkTransforms = opts.isMainChunk !== false;
|
|
631
|
+
if (enableMainChunkTransforms || cleanRootSpecificity) {
|
|
632
|
+
const fallbackRemove = enableMainChunkTransforms ? getFallbackRemove(void 0, opts) : void 0;
|
|
587
633
|
p.RuleExit = (rule) => {
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
if (rule.selectors.length === 0 || rule.selectors.length === 1 && rule.selector.trim() === "") {
|
|
591
|
-
rule.remove();
|
|
634
|
+
if (enableMainChunkTransforms) {
|
|
635
|
+
fallbackRemove?.transformSync(rule);
|
|
592
636
|
}
|
|
593
|
-
|
|
594
|
-
|
|
637
|
+
cleanRootSpecificity?.(rule);
|
|
638
|
+
if (enableMainChunkTransforms) {
|
|
639
|
+
dedupeDeclarations(rule);
|
|
640
|
+
if (rule.selectors.length === 0 || rule.selectors.length === 1 && rule.selector.trim() === "") {
|
|
641
|
+
rule.remove();
|
|
642
|
+
}
|
|
643
|
+
if (opts.uniAppX && rule.nodes.length === 0) {
|
|
595
644
|
rule.remove();
|
|
596
645
|
}
|
|
597
646
|
}
|
|
598
647
|
};
|
|
648
|
+
}
|
|
649
|
+
if (enableMainChunkTransforms) {
|
|
599
650
|
p.DeclarationExit = (decl) => {
|
|
600
651
|
if (decl.prop === "--tw-gradient-position" && decl.value.endsWith(OklabSuffix)) {
|
|
601
652
|
decl.value = decl.value.slice(0, decl.value.length - OklabSuffix.length);
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
|
|
2
1
|
import { PostCssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
|
|
3
2
|
import { Rule } from 'postcss';
|
|
4
3
|
import { Result } from 'postcss-load-config';
|
|
@@ -35,7 +34,6 @@ type RequiredStyleHandlerOptions = {
|
|
|
35
34
|
escapeMap?: Record<string, string>;
|
|
36
35
|
} & Pick<UserDefinedPostcssOptions, 'cssPreflightRange' | 'cssChildCombinatorReplaceValue' | 'injectAdditionalCssVarScope' | 'cssSelectorReplacement' | 'rem2rpx' | 'px2rpx'>;
|
|
37
36
|
interface InternalCssSelectorReplacerOptions {
|
|
38
|
-
mangleContext?: IMangleScopeContext;
|
|
39
37
|
escapeMap?: Record<string, string>;
|
|
40
38
|
}
|
|
41
39
|
interface CssCalcOptions extends PostCssCalcOptions {
|
|
@@ -43,7 +41,6 @@ interface CssCalcOptions extends PostCssCalcOptions {
|
|
|
43
41
|
}
|
|
44
42
|
type IStyleHandlerOptions = {
|
|
45
43
|
customRuleCallback?: CustomRuleCallback;
|
|
46
|
-
mangleContext?: IMangleScopeContext;
|
|
47
44
|
ctx?: IContext;
|
|
48
45
|
postcssOptions?: LoadedPostcssOptions;
|
|
49
46
|
cssRemoveProperty?: boolean;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { IMangleScopeContext } from '@weapp-tailwindcss/mangle';
|
|
2
1
|
import { PostCssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
|
|
3
2
|
import { Rule } from 'postcss';
|
|
4
3
|
import { Result } from 'postcss-load-config';
|
|
@@ -35,7 +34,6 @@ type RequiredStyleHandlerOptions = {
|
|
|
35
34
|
escapeMap?: Record<string, string>;
|
|
36
35
|
} & Pick<UserDefinedPostcssOptions, 'cssPreflightRange' | 'cssChildCombinatorReplaceValue' | 'injectAdditionalCssVarScope' | 'cssSelectorReplacement' | 'rem2rpx' | 'px2rpx'>;
|
|
37
36
|
interface InternalCssSelectorReplacerOptions {
|
|
38
|
-
mangleContext?: IMangleScopeContext;
|
|
39
37
|
escapeMap?: Record<string, string>;
|
|
40
38
|
}
|
|
41
39
|
interface CssCalcOptions extends PostCssCalcOptions {
|
|
@@ -43,7 +41,6 @@ interface CssCalcOptions extends PostCssCalcOptions {
|
|
|
43
41
|
}
|
|
44
42
|
type IStyleHandlerOptions = {
|
|
45
43
|
customRuleCallback?: CustomRuleCallback;
|
|
46
|
-
mangleContext?: IMangleScopeContext;
|
|
47
44
|
ctx?: IContext;
|
|
48
45
|
postcssOptions?: LoadedPostcssOptions;
|
|
49
46
|
cssRemoveProperty?: boolean;
|
package/dist/types.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import '@weapp-tailwindcss/mangle';
|
|
2
1
|
import '@weapp-tailwindcss/postcss-calc';
|
|
3
2
|
import 'postcss';
|
|
4
3
|
import 'postcss-load-config';
|
|
5
4
|
export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
|
|
6
5
|
export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
|
|
7
6
|
export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
|
|
8
|
-
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-
|
|
7
|
+
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-BuslrX7I.mjs';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import '@weapp-tailwindcss/mangle';
|
|
2
1
|
import '@weapp-tailwindcss/postcss-calc';
|
|
3
2
|
import 'postcss';
|
|
4
3
|
import 'postcss-load-config';
|
|
5
4
|
export { pluginOptions as PresetEnvOptions } from 'postcss-preset-env';
|
|
6
5
|
export { PxtransformOptions as Px2rpxOptions } from 'postcss-pxtransform';
|
|
7
6
|
export { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
|
|
8
|
-
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-
|
|
7
|
+
export { C as CssCalcOptions, e as CssPreflightOptions, b as CustomRuleCallback, d as IPropValue, I as IStyleHandlerOptions, a as InternalCssSelectorReplacerOptions, L as LoadedPostcssOptions, R as RequiredStyleHandlerOptions, U as UserDefinedPostcssOptions } from './types-BuslrX7I.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weapp-tailwindcss/postcss",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"description": "@weapp-tailwindcss/postcss",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"postcss": "~8.5.6",
|
|
45
45
|
"postcss-preset-env": "^10.4.0",
|
|
46
46
|
"postcss-pxtransform": "^4.1.7",
|
|
47
|
-
"postcss-rem-to-responsive-pixel": "
|
|
47
|
+
"postcss-rem-to-responsive-pixel": "^6.1.0",
|
|
48
48
|
"postcss-selector-parser": "~7.1.0",
|
|
49
49
|
"postcss-value-parser": "^4.2.0",
|
|
50
50
|
"@weapp-tailwindcss/shared": "1.1.0"
|
|
@@ -52,8 +52,7 @@
|
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@csstools/postcss-is-pseudo-class": "^5.0.3",
|
|
54
54
|
"postcss-calc": "^10.1.1",
|
|
55
|
-
"postcss-custom-properties": "^14.0.6"
|
|
56
|
-
"@weapp-tailwindcss/mangle": "1.0.6"
|
|
55
|
+
"postcss-custom-properties": "^14.0.6"
|
|
57
56
|
},
|
|
58
57
|
"scripts": {
|
|
59
58
|
"dev": "tsup --watch --sourcemap",
|