@weapp-tailwindcss/postcss 3.1.0 → 3.1.2

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.
@@ -0,0 +1,7 @@
1
+ import type { WebCssCompatFeatures, WebCssCompatUserOptions } from '../types';
2
+ export interface NormalizedWebCssCompatOptions {
3
+ preset: 'off' | 'legacy-web';
4
+ features: Required<WebCssCompatFeatures>;
5
+ }
6
+ export declare function normalizeWebCssCompatOptions(options: WebCssCompatUserOptions | undefined): NormalizedWebCssCompatOptions;
7
+ export declare function transformWebCssCompat(css: string, options: WebCssCompatUserOptions | undefined): string;
@@ -1,4 +1,4 @@
1
- import type { IStyleHandlerOptions } from '../types';
1
+ import type { IStyleHandlerOptions, WebCssCompatUserOptions } from '../types';
2
2
  export type WeappTailwindcssPostcssTarget = 'weapp' | 'web' | 'tailwind';
3
3
  export interface TailwindCandidateSource {
4
4
  content: string;
@@ -32,6 +32,7 @@ export interface WeappTailwindcssPostcssGeneratorUserOptions {
32
32
  target?: WeappTailwindcssPostcssTarget | undefined;
33
33
  config?: string | undefined;
34
34
  styleOptions?: Partial<IStyleHandlerOptions> | undefined;
35
+ webCompat?: WebCssCompatUserOptions | undefined;
35
36
  importFallback?: boolean | undefined;
36
37
  bareArbitraryValues?: unknown;
37
38
  }
@@ -39,6 +40,7 @@ export interface NormalizedWeappTailwindcssPostcssGeneratorOptions {
39
40
  target: WeappTailwindcssPostcssTarget;
40
41
  config?: string | undefined;
41
42
  styleOptions?: Partial<IStyleHandlerOptions> | undefined;
43
+ webCompat: WebCssCompatUserOptions | undefined;
42
44
  importFallback: boolean;
43
45
  bareArbitraryValues?: unknown;
44
46
  }
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export { type DynamicColorMixAlphaProtection, type DynamicColorMixAlphaProtectio
2
2
  export { finalizeMiniProgramCss, hasMiniProgramCssSpecificityPlaceholders, hoistTailwindPreflightBase, pruneMiniProgramGeneratedCss, removeUnsupportedAtSupports, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, stripMiniProgramCssSpecificityPlaceholders, } from './compat/mini-program-css';
3
3
  export { normalizeMiniProgramPrefixedDeclaration, removeUnsupportedMiniProgramPrefixedAtRule, } from './compat/mini-program-prefixes';
4
4
  export { convertTailwindcssRpxDeclarationsToRem, convertTailwindcssRpxDeclarationToRem, convertTailwindcssRpxValueToRem, normalizeTailwindcssRpxDeclaration, normalizeTailwindcssRpxDeclarations, normalizeTailwindcssWebRpxDeclarations, type TailwindcssRpxToRemOptions, } from './compat/tailwindcss-rpx';
5
+ export { type NormalizedWebCssCompatOptions, normalizeWebCssCompatOptions, transformWebCssCompat, } from './compat/web-css';
5
6
  export { compileCssMacroConditionalComments, CSS_MACRO_STYLE_OPTIONS_MARKER, hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, transformCssMacroCss, withCssMacroStyleOptions, } from './css-macro/auto';
6
7
  export { CSS_MACRO_POSTCSS_PLUGIN_NAME, default as cssMacroPostcssPlugin } from './css-macro/postcss';
7
8
  export { createWeappTailwindcssPostcssPlugin } from './generator-plugin';
package/dist/index.js CHANGED
@@ -12,8 +12,8 @@ node_path = require_html_transform.__toESM(node_path);
12
12
  let node_process = require("node:process");
13
13
  node_process = require_html_transform.__toESM(node_process);
14
14
  let node_fs_promises = require("node:fs/promises");
15
+ let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
15
16
  let tailwindcss_config = require("tailwindcss-config");
16
- let tailwindcss_patch = require("tailwindcss-patch");
17
17
  let node_fs = require("node:fs");
18
18
  let micromatch = require("micromatch");
19
19
  micromatch = require_html_transform.__toESM(micromatch);
@@ -8016,7 +8016,7 @@ function removeRootSpecificityPlaceholders(root) {
8016
8016
  function isEffectivelyEmptyContainer(container) {
8017
8017
  return !container.nodes || container.nodes.every((node) => node.type === "comment");
8018
8018
  }
8019
- function removeEmptyAtRules$1(root) {
8019
+ function removeEmptyAtRules$2(root) {
8020
8020
  root.walkAtRules((atRule) => {
8021
8021
  if (isEffectivelyEmptyContainer(atRule)) atRule.remove();
8022
8022
  });
@@ -8185,7 +8185,7 @@ function finalizeMiniProgramCssRoot(root, options = {}) {
8185
8185
  }));
8186
8186
  const themeRule = collectThemeVariableRule(root, options);
8187
8187
  insertHoistedRules(root, mergeEquivalentHoistedRules(themeRule ? [...preflightRules, themeRule] : preflightRules), hoistAnchor);
8188
- removeEmptyAtRules$1(root);
8188
+ removeEmptyAtRules$2(root);
8189
8189
  }
8190
8190
  function hoistTailwindPreflightBase(css) {
8191
8191
  try {
@@ -8437,6 +8437,110 @@ function normalizeTailwindcssWebRpxDeclarations(root, options) {
8437
8437
  return normalized || converted;
8438
8438
  }
8439
8439
  //#endregion
8440
+ //#region src/compat/web-css.ts
8441
+ const disabledFeatures = {
8442
+ theme: false,
8443
+ layer: false,
8444
+ property: false,
8445
+ oklch: false,
8446
+ colorFunctions: false,
8447
+ supports: false
8448
+ };
8449
+ const legacyWebFeatures = {
8450
+ theme: true,
8451
+ layer: true,
8452
+ property: true,
8453
+ oklch: true,
8454
+ colorFunctions: true,
8455
+ supports: true
8456
+ };
8457
+ function normalizeWebCssCompatOptionsObject(options) {
8458
+ const preset = options.preset ?? "legacy-web";
8459
+ return {
8460
+ preset,
8461
+ features: {
8462
+ ...preset === "legacy-web" ? legacyWebFeatures : disabledFeatures,
8463
+ ...options.features
8464
+ }
8465
+ };
8466
+ }
8467
+ function normalizeWebCssCompatOptions(options) {
8468
+ if (options === true) return normalizeWebCssCompatOptionsObject({ preset: "legacy-web" });
8469
+ if (!options) return {
8470
+ preset: "off",
8471
+ features: disabledFeatures
8472
+ };
8473
+ return normalizeWebCssCompatOptionsObject(options);
8474
+ }
8475
+ function isWebCssCompatEnabled(options) {
8476
+ return Object.values(options.features).some(Boolean);
8477
+ }
8478
+ function collectCustomPropertyValues(root) {
8479
+ const values = /* @__PURE__ */ new Map();
8480
+ root.walkDecls((decl) => {
8481
+ if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
8482
+ });
8483
+ return values;
8484
+ }
8485
+ function removeRegisteredCustomProperties(root) {
8486
+ root.walkAtRules("property", (atRule) => {
8487
+ atRule.remove();
8488
+ });
8489
+ }
8490
+ function unwrapThemeAtRules(root) {
8491
+ root.walkAtRules("theme", (atRule) => {
8492
+ if (atRule.nodes && atRule.nodes.length > 0) {
8493
+ const rootNodes = [];
8494
+ const hoistedNodes = [];
8495
+ for (const node of atRule.nodes) if (node.type === "decl" || node.type === "comment") rootNodes.push(node.clone());
8496
+ else hoistedNodes.push(node.clone());
8497
+ const replacements = [...rootNodes.length > 0 ? [postcss.default.rule({
8498
+ selector: ":root",
8499
+ nodes: rootNodes
8500
+ })] : [], ...hoistedNodes];
8501
+ atRule.replaceWith(...replacements);
8502
+ } else atRule.remove();
8503
+ });
8504
+ }
8505
+ function normalizeModernColorDeclarations(root, features) {
8506
+ if (!features.oklch && !features.colorFunctions) return;
8507
+ const customPropertyValues = collectCustomPropertyValues(root);
8508
+ root.walkDecls((decl) => {
8509
+ const normalized = normalizeModernColorValue(decl.value, customPropertyValues);
8510
+ if (!normalized.changed) return;
8511
+ if (!features.colorFunctions && !/oklch|oklab/i.test(decl.value)) return;
8512
+ decl.value = normalized.value;
8513
+ });
8514
+ }
8515
+ function removeModernColorSupports(root) {
8516
+ root.walkAtRules("supports", (atRule) => {
8517
+ if (!/color-mix|oklch|oklab|lab|lch|display-p3/i.test(atRule.params)) return;
8518
+ if (atRule.nodes && atRule.nodes.length > 0) atRule.replaceWith(...atRule.nodes);
8519
+ else atRule.remove();
8520
+ });
8521
+ }
8522
+ function removeEmptyAtRules$1(root) {
8523
+ root.walkAtRules((atRule) => {
8524
+ if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
8525
+ });
8526
+ }
8527
+ function transformWebCssCompat(css, options) {
8528
+ const normalized = normalizeWebCssCompatOptions(options);
8529
+ if (!isWebCssCompatEnabled(normalized)) return css;
8530
+ try {
8531
+ const root = postcss.default.parse(css);
8532
+ if (normalized.features.theme) unwrapThemeAtRules(root);
8533
+ if (normalized.features.layer) removeUnsupportedCascadeLayers(root);
8534
+ if (normalized.features.property) removeRegisteredCustomProperties(root);
8535
+ if (normalized.features.supports) removeModernColorSupports(root);
8536
+ normalizeModernColorDeclarations(root, normalized.features);
8537
+ removeEmptyAtRules$1(root);
8538
+ return root.toString();
8539
+ } catch {
8540
+ return css;
8541
+ }
8542
+ }
8543
+ //#endregion
8440
8544
  //#region src/css-macro/auto.ts
8441
8545
  const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
8442
8546
  const PLATFORM_ENV_KEYS$1 = [
@@ -9036,7 +9140,7 @@ async function expandTailwindSourceEntries(entries, options = {}) {
9036
9140
  pattern: normalizeGlobPattern(pattern),
9037
9141
  negated: true
9038
9142
  }));
9039
- const matched = await (0, tailwindcss_patch.resolveProjectSourceFiles)({
9143
+ const matched = await (0, _tailwindcss_mangle_engine.resolveProjectSourceFiles)({
9040
9144
  cwd: base,
9041
9145
  sources: group,
9042
9146
  ...ignoredSources === void 0 ? {} : { ignoredSources }
@@ -9095,7 +9199,7 @@ async function collectAutoTailwindCandidates(root, result, options) {
9095
9199
  pattern: POSTCSS_SOURCE_PATTERN
9096
9200
  });
9097
9201
  sourceEntries.push(...await resolveCssSourceEntries(root, base, POSTCSS_SOURCE_PATTERN));
9098
- const candidates = sourceEntries.length === 0 ? [] : await (0, tailwindcss_patch.extractValidCandidates)({
9202
+ const candidates = sourceEntries.length === 0 ? [] : await (0, _tailwindcss_mangle_engine.extractValidCandidates)({
9099
9203
  base,
9100
9204
  css: root.toString(),
9101
9205
  cwd: projectRoot,
@@ -9192,7 +9296,8 @@ function createWeappTailwindcssPostcssPlugin(adapters) {
9192
9296
  },
9193
9297
  target: generatorOptions.target
9194
9298
  });
9195
- replaceRootCss(root, isApplyOnlyTailwindV4Css ? filterApplyOnlyGeneratedCss(generated.css, rawCss) : generated.css, result);
9299
+ const css = isApplyOnlyTailwindV4Css ? filterApplyOnlyGeneratedCss(generated.css, rawCss) : generated.css;
9300
+ replaceRootCss(root, generated.target === "web" ? transformWebCssCompat(css, generatorOptions.webCompat) : css, result);
9196
9301
  addDependencyMessages(result, generated);
9197
9302
  addSourceDependencyMessages(result, collectedSources.files);
9198
9303
  result.messages.push({
@@ -57092,6 +57197,7 @@ exports.normalizeModernColorValue = normalizeModernColorValue;
57092
57197
  exports.normalizeTailwindcssRpxDeclaration = normalizeTailwindcssRpxDeclaration;
57093
57198
  exports.normalizeTailwindcssRpxDeclarations = normalizeTailwindcssRpxDeclarations;
57094
57199
  exports.normalizeTailwindcssWebRpxDeclarations = normalizeTailwindcssWebRpxDeclarations;
57200
+ exports.normalizeWebCssCompatOptions = normalizeWebCssCompatOptions;
57095
57201
  Object.defineProperty(exports, "postcss", {
57096
57202
  enumerable: true,
57097
57203
  get: function() {
@@ -57109,6 +57215,7 @@ exports.removeUnsupportedMiniProgramPrefixedAtRule = removeUnsupportedMiniProgra
57109
57215
  exports.resolveFilteredPostcssConfig = resolveFilteredPostcssConfig;
57110
57216
  exports.stripMiniProgramCssSpecificityPlaceholders = stripMiniProgramCssSpecificityPlaceholders;
57111
57217
  exports.transformCssMacroCss = transformCssMacroCss;
57218
+ exports.transformWebCssCompat = transformWebCssCompat;
57112
57219
  Object.defineProperty(exports, "unitConversionComposeRules", {
57113
57220
  enumerable: true,
57114
57221
  get: function() {
package/dist/index.mjs CHANGED
@@ -7,8 +7,8 @@ import valueParser from "postcss-value-parser";
7
7
  import path from "node:path";
8
8
  import process$1 from "node:process";
9
9
  import { readFile, stat } from "node:fs/promises";
10
+ import { extractValidCandidates, resolveProjectSourceFiles } from "@tailwindcss-mangle/engine";
10
11
  import { loadConfig } from "tailwindcss-config";
11
- import { extractValidCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
12
12
  import { realpathSync } from "node:fs";
13
13
  import micromatch from "micromatch";
14
14
  import { defu, defuOverrideArray, regExpTest } from "@weapp-tailwindcss/shared";
@@ -8024,7 +8024,7 @@ function removeRootSpecificityPlaceholders(root) {
8024
8024
  function isEffectivelyEmptyContainer(container) {
8025
8025
  return !container.nodes || container.nodes.every((node) => node.type === "comment");
8026
8026
  }
8027
- function removeEmptyAtRules$1(root) {
8027
+ function removeEmptyAtRules$2(root) {
8028
8028
  root.walkAtRules((atRule) => {
8029
8029
  if (isEffectivelyEmptyContainer(atRule)) atRule.remove();
8030
8030
  });
@@ -8193,7 +8193,7 @@ function finalizeMiniProgramCssRoot(root, options = {}) {
8193
8193
  }));
8194
8194
  const themeRule = collectThemeVariableRule(root, options);
8195
8195
  insertHoistedRules(root, mergeEquivalentHoistedRules(themeRule ? [...preflightRules, themeRule] : preflightRules), hoistAnchor);
8196
- removeEmptyAtRules$1(root);
8196
+ removeEmptyAtRules$2(root);
8197
8197
  }
8198
8198
  function hoistTailwindPreflightBase(css) {
8199
8199
  try {
@@ -8445,6 +8445,110 @@ function normalizeTailwindcssWebRpxDeclarations(root, options) {
8445
8445
  return normalized || converted;
8446
8446
  }
8447
8447
  //#endregion
8448
+ //#region src/compat/web-css.ts
8449
+ const disabledFeatures = {
8450
+ theme: false,
8451
+ layer: false,
8452
+ property: false,
8453
+ oklch: false,
8454
+ colorFunctions: false,
8455
+ supports: false
8456
+ };
8457
+ const legacyWebFeatures = {
8458
+ theme: true,
8459
+ layer: true,
8460
+ property: true,
8461
+ oklch: true,
8462
+ colorFunctions: true,
8463
+ supports: true
8464
+ };
8465
+ function normalizeWebCssCompatOptionsObject(options) {
8466
+ const preset = options.preset ?? "legacy-web";
8467
+ return {
8468
+ preset,
8469
+ features: {
8470
+ ...preset === "legacy-web" ? legacyWebFeatures : disabledFeatures,
8471
+ ...options.features
8472
+ }
8473
+ };
8474
+ }
8475
+ function normalizeWebCssCompatOptions(options) {
8476
+ if (options === true) return normalizeWebCssCompatOptionsObject({ preset: "legacy-web" });
8477
+ if (!options) return {
8478
+ preset: "off",
8479
+ features: disabledFeatures
8480
+ };
8481
+ return normalizeWebCssCompatOptionsObject(options);
8482
+ }
8483
+ function isWebCssCompatEnabled(options) {
8484
+ return Object.values(options.features).some(Boolean);
8485
+ }
8486
+ function collectCustomPropertyValues(root) {
8487
+ const values = /* @__PURE__ */ new Map();
8488
+ root.walkDecls((decl) => {
8489
+ if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
8490
+ });
8491
+ return values;
8492
+ }
8493
+ function removeRegisteredCustomProperties(root) {
8494
+ root.walkAtRules("property", (atRule) => {
8495
+ atRule.remove();
8496
+ });
8497
+ }
8498
+ function unwrapThemeAtRules(root) {
8499
+ root.walkAtRules("theme", (atRule) => {
8500
+ if (atRule.nodes && atRule.nodes.length > 0) {
8501
+ const rootNodes = [];
8502
+ const hoistedNodes = [];
8503
+ for (const node of atRule.nodes) if (node.type === "decl" || node.type === "comment") rootNodes.push(node.clone());
8504
+ else hoistedNodes.push(node.clone());
8505
+ const replacements = [...rootNodes.length > 0 ? [postcss$1.rule({
8506
+ selector: ":root",
8507
+ nodes: rootNodes
8508
+ })] : [], ...hoistedNodes];
8509
+ atRule.replaceWith(...replacements);
8510
+ } else atRule.remove();
8511
+ });
8512
+ }
8513
+ function normalizeModernColorDeclarations(root, features) {
8514
+ if (!features.oklch && !features.colorFunctions) return;
8515
+ const customPropertyValues = collectCustomPropertyValues(root);
8516
+ root.walkDecls((decl) => {
8517
+ const normalized = normalizeModernColorValue(decl.value, customPropertyValues);
8518
+ if (!normalized.changed) return;
8519
+ if (!features.colorFunctions && !/oklch|oklab/i.test(decl.value)) return;
8520
+ decl.value = normalized.value;
8521
+ });
8522
+ }
8523
+ function removeModernColorSupports(root) {
8524
+ root.walkAtRules("supports", (atRule) => {
8525
+ if (!/color-mix|oklch|oklab|lab|lch|display-p3/i.test(atRule.params)) return;
8526
+ if (atRule.nodes && atRule.nodes.length > 0) atRule.replaceWith(...atRule.nodes);
8527
+ else atRule.remove();
8528
+ });
8529
+ }
8530
+ function removeEmptyAtRules$1(root) {
8531
+ root.walkAtRules((atRule) => {
8532
+ if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
8533
+ });
8534
+ }
8535
+ function transformWebCssCompat(css, options) {
8536
+ const normalized = normalizeWebCssCompatOptions(options);
8537
+ if (!isWebCssCompatEnabled(normalized)) return css;
8538
+ try {
8539
+ const root = postcss$1.parse(css);
8540
+ if (normalized.features.theme) unwrapThemeAtRules(root);
8541
+ if (normalized.features.layer) removeUnsupportedCascadeLayers(root);
8542
+ if (normalized.features.property) removeRegisteredCustomProperties(root);
8543
+ if (normalized.features.supports) removeModernColorSupports(root);
8544
+ normalizeModernColorDeclarations(root, normalized.features);
8545
+ removeEmptyAtRules$1(root);
8546
+ return root.toString();
8547
+ } catch {
8548
+ return css;
8549
+ }
8550
+ }
8551
+ //#endregion
8448
8552
  //#region src/css-macro/auto.ts
8449
8553
  const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
8450
8554
  const PLATFORM_ENV_KEYS$1 = [
@@ -9200,7 +9304,8 @@ function createWeappTailwindcssPostcssPlugin(adapters) {
9200
9304
  },
9201
9305
  target: generatorOptions.target
9202
9306
  });
9203
- replaceRootCss(root, isApplyOnlyTailwindV4Css ? filterApplyOnlyGeneratedCss(generated.css, rawCss) : generated.css, result);
9307
+ const css = isApplyOnlyTailwindV4Css ? filterApplyOnlyGeneratedCss(generated.css, rawCss) : generated.css;
9308
+ replaceRootCss(root, generated.target === "web" ? transformWebCssCompat(css, generatorOptions.webCompat) : css, result);
9204
9309
  addDependencyMessages(result, generated);
9205
9310
  addSourceDependencyMessages(result, collectedSources.files);
9206
9311
  result.messages.push({
@@ -57053,4 +57158,4 @@ function containsCssAfterMinify(baseCss, css) {
57053
57158
  return ruleKeys.size > 0 && [...ruleKeys].every((key) => baseRuleKeys.has(key));
57054
57159
  }
57055
57160
  //#endregion
57056
- export { CSS_MACRO_POSTCSS_PLUGIN_NAME, CSS_MACRO_STYLE_OPTIONS_MARKER, compileCssMacroConditionalComments, containsCssAfterMinify, convertTailwindcssRpxDeclarationToRem, convertTailwindcssRpxDeclarationsToRem, convertTailwindcssRpxValueToRem, createFallbackPlaceholderReplacer, createInjectPreflight, createStyleHandler, createStylePipeline, createWeappTailwindcssPostcssPlugin, creator as cssMacroPostcssPlugin, filterExistingCssRules, finalizeMiniProgramCss, getPostcssPluginName, hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, hasMiniProgramCssSpecificityPlaceholders, hoistTailwindPreflightBase, internalCssSelectorReplacer, mergeCoveredCssRuleDeclarations, mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations, normalizeMiniProgramPrefixedDeclaration, normalizeModernColorValue, normalizeTailwindcssRpxDeclaration, normalizeTailwindcssRpxDeclarations, normalizeTailwindcssWebRpxDeclarations, postcss, postcssHtmlTransform, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss, removeTailwindPostcssPlugins, removeUnsupportedAtSupports, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, removeUnsupportedMiniProgramPrefixedAtRule, resolveFilteredPostcssConfig, stripMiniProgramCssSpecificityPlaceholders, transformCssMacroCss, unitConversionComposeRules, unitConversionPresets, withCssMacroStyleOptions };
57161
+ export { CSS_MACRO_POSTCSS_PLUGIN_NAME, CSS_MACRO_STYLE_OPTIONS_MARKER, compileCssMacroConditionalComments, containsCssAfterMinify, convertTailwindcssRpxDeclarationToRem, convertTailwindcssRpxDeclarationsToRem, convertTailwindcssRpxValueToRem, createFallbackPlaceholderReplacer, createInjectPreflight, createStyleHandler, createStylePipeline, createWeappTailwindcssPostcssPlugin, creator as cssMacroPostcssPlugin, filterExistingCssRules, finalizeMiniProgramCss, getPostcssPluginName, hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, hasMiniProgramCssSpecificityPlaceholders, hoistTailwindPreflightBase, internalCssSelectorReplacer, mergeCoveredCssRuleDeclarations, mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations, normalizeMiniProgramPrefixedDeclaration, normalizeModernColorValue, normalizeTailwindcssRpxDeclaration, normalizeTailwindcssRpxDeclarations, normalizeTailwindcssWebRpxDeclarations, normalizeWebCssCompatOptions, postcss, postcssHtmlTransform, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss, removeTailwindPostcssPlugins, removeUnsupportedAtSupports, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, removeUnsupportedMiniProgramPrefixedAtRule, resolveFilteredPostcssConfig, stripMiniProgramCssSpecificityPlaceholders, transformCssMacroCss, transformWebCssCompat, unitConversionComposeRules, unitConversionPresets, withCssMacroStyleOptions };
package/dist/types.d.ts CHANGED
@@ -62,6 +62,20 @@ export interface CssAtRules {
62
62
  supports?: boolean | undefined;
63
63
  media?: boolean | undefined;
64
64
  }
65
+ export type WebCssCompatPreset = 'off' | 'legacy-web';
66
+ export interface WebCssCompatFeatures {
67
+ theme?: boolean | undefined;
68
+ layer?: boolean | undefined;
69
+ property?: boolean | undefined;
70
+ oklch?: boolean | undefined;
71
+ colorFunctions?: boolean | undefined;
72
+ supports?: boolean | undefined;
73
+ }
74
+ export interface WebCssCompatOptions {
75
+ preset?: WebCssCompatPreset | undefined;
76
+ features?: WebCssCompatFeatures | undefined;
77
+ }
78
+ export type WebCssCompatUserOptions = boolean | WebCssCompatOptions;
65
79
  export interface CssOptions {
66
80
  cssPreflight?: CssPreflightOptions | undefined;
67
81
  cssPreflightRange?: 'all' | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "3.1.0",
3
+ "version": "3.1.2",
4
4
  "description": "@weapp-tailwindcss/postcss",
5
5
  "author": "ice breaker <1324318532@qq.com>",
6
6
  "license": "MIT",
@@ -64,8 +64,9 @@
64
64
  "node": "^20.19.0 || >=22.12.0"
65
65
  },
66
66
  "dependencies": {
67
+ "@tailwindcss-mangle/engine": "0.1.1",
67
68
  "@weapp-core/escape": "~8.0.0",
68
- "autoprefixer": "^10.5.0",
69
+ "autoprefixer": "^10.5.2",
69
70
  "lru-cache": "11.5.1",
70
71
  "micromatch": "^4.0.8",
71
72
  "postcss": "^8.5.15",
@@ -75,10 +76,9 @@
75
76
  "postcss-rule-unit-converter": "^0.2.2",
76
77
  "postcss-selector-parser": "~7.1.4",
77
78
  "postcss-value-parser": "^4.2.0",
78
- "tailwindcss-patch": "9.5.0",
79
79
  "@weapp-tailwindcss/postcss-calc": "^1.0.2",
80
- "tailwindcss-config": "2.0.0",
81
- "@weapp-tailwindcss/shared": "2.0.0"
80
+ "@weapp-tailwindcss/shared": "2.0.0",
81
+ "tailwindcss-config": "2.0.0"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@csstools/css-color-parser": "^4.1.8",