@weapp-tailwindcss/postcss 3.1.12 → 3.2.1

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.
Files changed (88) hide show
  1. package/dist/branches/index.d.ts +1 -1
  2. package/dist/branches/mini-program/index.d.ts +1 -1
  3. package/dist/branches/style.d.ts +3 -3
  4. package/dist/branches/uni-app-x-css-uvue/index.d.ts +1 -1
  5. package/dist/branches/uni-app-x-css-webview/index.d.ts +1 -1
  6. package/dist/branches/web/index.d.ts +1 -1
  7. package/dist/compat/mini-program-css/finalize-options.d.ts +8 -1
  8. package/dist/compat/mini-program-css/finalize.d.ts +4 -4
  9. package/dist/compat/mini-program-css/index.d.ts +5 -5
  10. package/dist/compat/mini-program-css/preflight.d.ts +1 -1
  11. package/dist/compat/mini-program-css/prune-generated.d.ts +1 -0
  12. package/dist/compat/mini-program-css/root-cleanups.d.ts +2 -1
  13. package/dist/compat/mini-program-css/selectors.d.ts +1 -1
  14. package/dist/compat/mini-program-css/theme.d.ts +1 -1
  15. package/dist/compat/tailwindcss-v4/gradients.d.ts +2 -0
  16. package/dist/compat/tailwindcss-v4.d.ts +4 -4
  17. package/dist/compat/uni-app-x-uvue/theme.d.ts +7 -0
  18. package/dist/compat/uni-app-x-uvue.d.ts +3 -2
  19. package/dist/compat/uni-app-x.d.ts +1 -1
  20. package/dist/compat/web-css.d.ts +1 -1
  21. package/dist/css-macro/auto.d.ts +1 -1
  22. package/dist/css-macro/postcss.cjs +7 -0
  23. package/dist/css-macro/postcss.js +2 -7
  24. package/dist/defaults.d.ts +1 -1
  25. package/dist/frameworks/generic/index.d.ts +1 -1
  26. package/dist/frameworks/index.d.ts +3 -3
  27. package/dist/frameworks/kbone/index.d.ts +1 -1
  28. package/dist/frameworks/mpx/index.d.ts +1 -1
  29. package/dist/frameworks/native/index.d.ts +1 -1
  30. package/dist/frameworks/remax/index.d.ts +1 -1
  31. package/dist/frameworks/shared.d.ts +2 -2
  32. package/dist/frameworks/taro/index.d.ts +1 -1
  33. package/dist/frameworks/types.d.ts +3 -3
  34. package/dist/frameworks/uni-app/index.d.ts +1 -1
  35. package/dist/frameworks/uni-app-vite/index.d.ts +1 -1
  36. package/dist/frameworks/uni-app-x/index.d.ts +1 -1
  37. package/dist/frameworks/weapp-vite/index.d.ts +1 -1
  38. package/dist/generator-plugin/context.d.ts +1 -1
  39. package/dist/generator-plugin/index.d.ts +2 -2
  40. package/dist/generator-plugin/local-imports.d.ts +1 -1
  41. package/dist/generator-plugin/source-files.d.ts +2 -2
  42. package/dist/generator-plugin/types.d.ts +1 -1
  43. package/dist/handler.d.ts +1 -1
  44. package/dist/{html-transform.mjs → html-transform.cjs} +6 -4
  45. package/dist/html-transform.js +4 -6
  46. package/dist/{index.mjs → index.cjs} +10670 -28300
  47. package/dist/index.d.ts +28 -27
  48. package/dist/index.js +2226 -62553
  49. package/dist/mp.d.ts +1 -1
  50. package/dist/options-resolver.d.ts +1 -1
  51. package/dist/pipeline.d.ts +3 -3
  52. package/dist/plugins/getCalcDuplicateCleaner.d.ts +1 -1
  53. package/dist/plugins/getCalcPlugin.d.ts +1 -1
  54. package/dist/plugins/getCustomPropertyCleaner.d.ts +1 -1
  55. package/dist/plugins/getPxTransformPlugin.d.ts +1 -1
  56. package/dist/plugins/getRemTransformPlugin.d.ts +1 -1
  57. package/dist/plugins/getUnitConversionPlugin.d.ts +1 -1
  58. package/dist/plugins/getUnitsToPxPlugin.d.ts +1 -1
  59. package/dist/plugins/index.d.ts +4 -4
  60. package/dist/plugins/post/specificity-cleaner.d.ts +1 -1
  61. package/dist/plugins/post.d.ts +2 -2
  62. package/dist/plugins/pre.d.ts +1 -1
  63. package/dist/{postcss-BNPP2oxO.mjs → postcss-CICDAfoB.js} +11 -2
  64. package/dist/{postcss-DAEMn9OL.js → postcss-CfbYRXJi.cjs} +11 -2
  65. package/dist/preflight.d.ts +1 -1
  66. package/dist/processor-cache.d.ts +3 -3
  67. package/dist/selectorParser/fallback.d.ts +1 -1
  68. package/dist/selectorParser/rule-transformer/nodes.d.ts +1 -1
  69. package/dist/selectorParser/rule-transformer/pseudos.d.ts +2 -2
  70. package/dist/selectorParser/rule-transformer/types.d.ts +1 -1
  71. package/dist/selectorParser/rule-transformer.d.ts +1 -1
  72. package/dist/selectorParser/spacing.d.ts +1 -1
  73. package/dist/selectorParser/utils.d.ts +1 -1
  74. package/dist/selectorParser.d.ts +4 -4
  75. package/dist/shared.d.ts +1 -1
  76. package/dist/source-scan.d.ts +2 -2
  77. package/dist/style-targets/index.d.ts +1 -1
  78. package/dist/style-targets/style.d.ts +1 -1
  79. package/dist/types.cjs +0 -0
  80. package/dist/types.d.ts +15 -7
  81. package/dist/types.js +1 -0
  82. package/dist/vite-css-rules/coverage.d.ts +1 -1
  83. package/dist/vite-css-rules/structure.d.ts +1 -1
  84. package/dist/vite-css-rules.d.ts +3 -3
  85. package/package.json +26 -24
  86. package/dist/css-macro/postcss.mjs +0 -2
  87. package/dist/types.mjs +0 -1
  88. /package/dist/{rolldown-runtime-emK7D4bc.js → rolldown-runtime-emK7D4bc.cjs} +0 -0
package/dist/mp.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { IStyleHandlerOptions } from './types';
1
+ import type { IStyleHandlerOptions } from './types.js';
2
2
  import { Rule } from 'postcss';
3
3
  /**
4
4
  * 带有子选择器的
@@ -1,4 +1,4 @@
1
- import type { IStyleHandlerOptions } from './types';
1
+ import type { IStyleHandlerOptions } from './types.js';
2
2
  export declare function normalizeCssOptions<T extends Partial<IStyleHandlerOptions>>(options: T, mirrorTopLevel?: boolean): T;
3
3
  export interface OptionsResolver {
4
4
  resolve: (overrides?: Partial<IStyleHandlerOptions>) => IStyleHandlerOptions;
@@ -1,7 +1,7 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { FeatureSignal } from './content-probe';
3
- import type { IStyleHandlerOptions } from './types';
4
- import { resolvePostcssFrameworkProfile } from './frameworks';
2
+ import type { FeatureSignal } from './content-probe.js';
3
+ import type { IStyleHandlerOptions } from './types.js';
4
+ import { resolvePostcssFrameworkProfile } from './frameworks/index.js';
5
5
  export type PipelineStage = 'pre' | 'normal' | 'post';
6
6
  export interface PipelineNodeCursor {
7
7
  id: string;
@@ -1,3 +1,3 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export declare function getCalcDuplicateCleaner(options: IStyleHandlerOptions): AcceptedPlugin | null;
@@ -1,3 +1,3 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export declare function getCalcPlugin(options: IStyleHandlerOptions): AcceptedPlugin | null;
@@ -1,3 +1,3 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export declare function getCustomPropertyCleaner(options: IStyleHandlerOptions): AcceptedPlugin | null;
@@ -1,3 +1,3 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export declare function getPxTransformPlugin(options: IStyleHandlerOptions): AcceptedPlugin | null;
@@ -1,3 +1,3 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export declare function getRemTransformPlugin(options: IStyleHandlerOptions): AcceptedPlugin | null;
@@ -1,5 +1,5 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions, UnitConversionConfig } from '../types';
2
+ import type { IStyleHandlerOptions, UnitConversionConfig } from '../types.js';
3
3
  export declare function resolveUnitConversionPlatform(options: Pick<IStyleHandlerOptions, 'platform'>): string | undefined;
4
4
  export declare function resolveUnitConversionConfig(options: Pick<IStyleHandlerOptions, 'platform' | 'unitConversion'>): UnitConversionConfig | undefined;
5
5
  export declare function getUnitConversionPlugin(options: IStyleHandlerOptions): AcceptedPlugin | null;
@@ -1,3 +1,3 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export declare function getUnitsToPxPlugin(options: IStyleHandlerOptions): AcceptedPlugin | null;
@@ -1,7 +1,7 @@
1
1
  import type { AcceptedPlugin } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
3
- export { createStylePipeline } from '../pipeline';
4
- export { postcssWeappTailwindcssPostPlugin } from './post';
5
- export { postcssWeappTailwindcssPrePlugin } from './pre';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
+ export { createStylePipeline } from '../pipeline.js';
4
+ export { postcssWeappTailwindcssPostPlugin } from './post.js';
5
+ export { postcssWeappTailwindcssPrePlugin } from './pre.js';
6
6
  export { default as postcssRem2rpx } from 'postcss-rem-to-responsive-pixel';
7
7
  export declare function getPlugins(options: IStyleHandlerOptions): AcceptedPlugin[];
@@ -1,5 +1,5 @@
1
1
  import type { Rule } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../../types';
2
+ import type { IStyleHandlerOptions } from '../../types.js';
3
3
  export declare function createFallbackPlaceholderReplacer(): (code: string) => string;
4
4
  export declare function createFallbackPlaceholderCleaner(): (rule: Rule) => void;
5
5
  export declare function createRootSpecificityCleaner(options: IStyleHandlerOptions): ((rule: Rule) => void) | undefined;
@@ -1,6 +1,6 @@
1
1
  import type { PluginCreator } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export type PostcssWeappTailwindcssRenamePlugin = PluginCreator<IStyleHandlerOptions>;
4
- export { reorderVariableDeclarations } from './post/decl-dedupe';
4
+ export { reorderVariableDeclarations } from './post/decl-dedupe.js';
5
5
  declare const postcssWeappTailwindcssPostPlugin: PostcssWeappTailwindcssRenamePlugin;
6
6
  export { postcssWeappTailwindcssPostPlugin };
@@ -1,5 +1,5 @@
1
1
  import type { PluginCreator } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export type PostcssWeappTailwindcssRenamePlugin = PluginCreator<IStyleHandlerOptions>;
4
4
  declare const postcssWeappTailwindcssPrePlugin: PostcssWeappTailwindcssRenamePlugin;
5
5
  export { postcssWeappTailwindcssPrePlugin };
@@ -47,13 +47,22 @@ function parseConditionalAtRuleParam(params) {
47
47
  const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
48
48
  const CONDITIONAL_COMMENT_SPACING = " ";
49
49
  const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
50
+ function cloneConditionalNodes(atRule) {
51
+ let nodes = (atRule.nodes ?? []).map((node) => node.clone());
52
+ while (nodes.length === 1) {
53
+ const node = nodes[0];
54
+ if (node?.type !== "rule" || node.selector.trim() !== "&") break;
55
+ nodes = (node.nodes ?? []).map((child) => child.clone());
56
+ }
57
+ return nodes;
58
+ }
50
59
  const creator = () => {
51
60
  return {
52
61
  postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
53
62
  prepare() {
54
63
  function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
55
64
  const hasPreviousNode = Boolean(atRule.prev());
56
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
65
+ const clonedNodes = cloneConditionalNodes(atRule);
57
66
  const startComment = helper.comment({
58
67
  raws: {
59
68
  left: CONDITIONAL_COMMENT_SPACING,
@@ -85,7 +94,7 @@ const creator = () => {
85
94
  function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
86
95
  if (atRule.parent?.type !== "rule") return false;
87
96
  const parentRule = atRule.parent;
88
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
97
+ const clonedNodes = cloneConditionalNodes(atRule);
89
98
  const conditionalRule = parentRule.clone();
90
99
  conditionalRule.removeAll();
91
100
  conditionalRule.append(...clonedNodes);
@@ -47,13 +47,22 @@ function parseConditionalAtRuleParam(params) {
47
47
  const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
48
48
  const CONDITIONAL_COMMENT_SPACING = " ";
49
49
  const CSS_MACRO_POSTCSS_PLUGIN_NAME = "postcss-weapp-tw-css-macro-plugin";
50
+ function cloneConditionalNodes(atRule) {
51
+ let nodes = (atRule.nodes ?? []).map((node) => node.clone());
52
+ while (nodes.length === 1) {
53
+ const node = nodes[0];
54
+ if (node?.type !== "rule" || node.selector.trim() !== "&") break;
55
+ nodes = (node.nodes ?? []).map((child) => child.clone());
56
+ }
57
+ return nodes;
58
+ }
50
59
  const creator = () => {
51
60
  return {
52
61
  postcssPlugin: CSS_MACRO_POSTCSS_PLUGIN_NAME,
53
62
  prepare() {
54
63
  function replaceAtRuleWithConditionalComments(atRule, helper, comment) {
55
64
  const hasPreviousNode = Boolean(atRule.prev());
56
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
65
+ const clonedNodes = cloneConditionalNodes(atRule);
57
66
  const startComment = helper.comment({
58
67
  raws: {
59
68
  left: CONDITIONAL_COMMENT_SPACING,
@@ -85,7 +94,7 @@ const creator = () => {
85
94
  function replaceNestedAtRuleWithConditionalRule(atRule, helper, comment) {
86
95
  if (atRule.parent?.type !== "rule") return false;
87
96
  const parentRule = atRule.parent;
88
- const clonedNodes = (atRule.nodes ?? []).map((node) => node.clone());
97
+ const clonedNodes = cloneConditionalNodes(atRule);
89
98
  const conditionalRule = parentRule.clone();
90
99
  conditionalRule.removeAll();
91
100
  conditionalRule.append(...clonedNodes);
@@ -1,3 +1,3 @@
1
- import type { CssPreflightOptions, IPropValue } from './types';
1
+ import type { CssPreflightOptions, IPropValue } from './types.js';
2
2
  export type InjectPreflight = () => IPropValue[];
3
3
  export declare function createInjectPreflight(options?: CssPreflightOptions): InjectPreflight;
@@ -1,7 +1,7 @@
1
1
  import type { ProcessOptions, Processor } from 'postcss';
2
- import type { FeatureSignal } from './content-probe';
3
- import type { StyleProcessingPipeline } from './pipeline';
4
- import type { IStyleHandlerOptions } from './types';
2
+ import type { FeatureSignal } from './content-probe.js';
3
+ import type { StyleProcessingPipeline } from './pipeline.js';
4
+ import type { IStyleHandlerOptions } from './types.js';
5
5
  export declare class StyleProcessorCache {
6
6
  private readonly pipelineCacheByKey;
7
7
  private readonly processOptionsCache;
@@ -1,5 +1,5 @@
1
1
  import type { Rule } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  import psp from 'postcss-selector-parser';
4
4
  /**
5
5
  * 获取用于小程序兼容性处理的解析器,内部会缓存实例并移除不支持的选择器。
@@ -1,5 +1,5 @@
1
1
  import type { Node, Selector } from 'postcss-selector-parser';
2
- import type { TransformContext } from './types';
2
+ import type { TransformContext } from './types.js';
3
3
  export declare function handleClassNode(node: Node, context: TransformContext): void;
4
4
  export declare function handleUniversalNode(node: Node, context: TransformContext): void;
5
5
  export declare function handleCombinatorNode(node: Node, index: number, context: TransformContext): void;
@@ -1,6 +1,6 @@
1
1
  import type { Node, Pseudo, Selector } from 'postcss-selector-parser';
2
- import type { IStyleHandlerOptions } from '../../types';
3
- import type { TransformContext } from './types';
2
+ import type { IStyleHandlerOptions } from '../../types.js';
3
+ import type { TransformContext } from './types.js';
4
4
  export declare function shouldRemoveEmptyFunctionalPseudo(node: Node): node is Pseudo;
5
5
  export declare function shouldRemoveUnsupportedPseudoElementSelector(selector: Selector, options: IStyleHandlerOptions): boolean;
6
6
  export declare function handlePseudoNode(node: Node, index: number, context: TransformContext, parent: Selector | undefined): void;
@@ -1,5 +1,5 @@
1
1
  import type { Rule } from 'postcss';
2
- import type { InternalCssSelectorReplacerOptions, IStyleHandlerOptions } from '../../types';
2
+ import type { InternalCssSelectorReplacerOptions, IStyleHandlerOptions } from '../../types.js';
3
3
  export interface TransformContext {
4
4
  rule: Rule;
5
5
  options: IStyleHandlerOptions;
@@ -1,4 +1,4 @@
1
1
  import type { Rule } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export type RuleTransformer = (rule: Rule) => void;
4
4
  export declare function ruleTransformSync(rule: Rule, options: IStyleHandlerOptions): void;
@@ -1,6 +1,6 @@
1
1
  import type { Rule } from 'postcss';
2
2
  import type { Node, Pseudo } from 'postcss-selector-parser';
3
- import type { IStyleHandlerOptions } from '../types';
3
+ import type { IStyleHandlerOptions } from '../types.js';
4
4
  export declare function isNotLastChildPseudo(node?: Node | null): node is Pseudo;
5
5
  export declare function transformSpacingSelector(nodes: Node[] | undefined, options: IStyleHandlerOptions): boolean;
6
6
  export declare function normalizeSpacingDeclarations(rule: Rule): void;
@@ -1,5 +1,5 @@
1
1
  import type { Node } from 'postcss-selector-parser';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  import psp from 'postcss-selector-parser';
4
4
  export type ParserTransformOptions = Partial<{
5
5
  lossless: boolean;
@@ -1,4 +1,4 @@
1
- export { isOnlyBeforeAndAfterPseudoElement } from './selectorParser/before-after';
2
- export { getFallbackRemove } from './selectorParser/fallback';
3
- export { ruleTransformSync } from './selectorParser/rule-transformer';
4
- export { composeIsPseudoAst, getCombinatorSelectorAst, mklist, } from './selectorParser/utils';
1
+ export { isOnlyBeforeAndAfterPseudoElement } from './selectorParser/before-after.js';
2
+ export { getFallbackRemove } from './selectorParser/fallback.js';
3
+ export { ruleTransformSync } from './selectorParser/rule-transformer.js';
4
+ export { composeIsPseudoAst, getCombinatorSelectorAst, mklist, } from './selectorParser/utils.js';
package/dist/shared.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import type { InternalCssSelectorReplacerOptions } from './types';
1
+ import type { InternalCssSelectorReplacerOptions } from './types.js';
2
2
  export declare function internalCssSelectorReplacer(selectors: string, options?: InternalCssSelectorReplacerOptions): string;
3
3
  export declare function composeIsPseudo(strs: string | string[]): string;
@@ -4,8 +4,8 @@ export interface TailwindSourceEntry {
4
4
  pattern: string;
5
5
  negated: boolean;
6
6
  }
7
- export type { TailwindInlineSourceCandidates } from './source-scan/inline-source';
8
- export { collectCssInlineSourceCandidates, expandInlineSourceCandidatePattern } from './source-scan/inline-source';
7
+ export type { TailwindInlineSourceCandidates } from './source-scan/inline-source.js';
8
+ export { collectCssInlineSourceCandidates, expandInlineSourceCandidatePattern } from './source-scan/inline-source.js';
9
9
  export declare const DEFAULT_SOURCE_SCAN_EXTENSIONS: string[];
10
10
  export declare const FULL_SOURCE_SCAN_EXTENSIONS: string[];
11
11
  export declare function createSourceScanPattern(extensions?: string[]): string;
@@ -1 +1 @@
1
- export { createPostcssStyleTargetProfile, type PostcssStyleTarget, type PostcssStyleTargetProfile, } from './style';
1
+ export { createPostcssStyleTargetProfile, type PostcssStyleTarget, type PostcssStyleTargetProfile, } from './style.js';
@@ -1,5 +1,5 @@
1
1
  import type { Result } from 'postcss';
2
- import type { IStyleHandlerOptions } from '../types';
2
+ import type { IStyleHandlerOptions } from '../types.js';
3
3
  export type PostcssStyleTarget = 'generic' | 'mini-program' | 'uni-app-x-css-uvue' | 'uni-app-x-css-webview' | 'web';
4
4
  export interface PostcssStyleTargetProfile {
5
5
  target: PostcssStyleTarget;
package/dist/types.cjs ADDED
File without changes
package/dist/types.d.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  import type { PostCssCalcOptions } from '@weapp-tailwindcss/postcss-calc';
2
- import type { Result as PostcssResult } from 'postcss';
2
+ import type { Result as PostcssResult, Root } from 'postcss';
3
3
  import type { Result } from 'postcss-load-config';
4
4
  import type pxtrans from 'postcss-pxtrans';
5
5
  import type { UserDefinedOptions as Rem2rpxOptions } from 'postcss-rem-to-responsive-pixel';
6
6
  import type { GlobalUnitTransform, UserDefinedOptions as UnitConverterOptions, UnitMap } from 'postcss-rule-unit-converter';
7
- import type { WeappAutoprefixerOptions } from './autoprefixer';
8
- import type { PostcssAppType } from './branches';
9
- import type { StyleProcessingPipeline } from './pipeline';
10
- import type { IContext as PostcssContext } from './plugins/ctx';
11
- import type { InjectPreflight } from './preflight';
12
- import type { PresetEnvOptions } from './preset-env-options';
7
+ import type { WeappAutoprefixerOptions } from './autoprefixer.js';
8
+ import type { PostcssAppType } from './branches/index.js';
9
+ import type { StyleProcessingPipeline } from './pipeline.js';
10
+ import type { IContext as PostcssContext } from './plugins/ctx.js';
11
+ import type { InjectPreflight } from './preflight.js';
12
+ import type { PresetEnvOptions } from './preset-env-options.js';
13
13
  export type LoadedPostcssOptions = Partial<Omit<Result, 'file'>>;
14
14
  export interface IPropValue {
15
15
  prop: string;
@@ -178,6 +178,10 @@ export type IStyleHandlerOptions = {
178
178
  /** uni-app x 的 CSS 输出目标;`uvue` 表示原生 uvue/nvue 样式链路,未设置时按 WebView CSS 处理。 */
179
179
  uniAppXCssTarget?: UniAppXCssTarget | undefined;
180
180
  uniAppXUnsupported?: UniAppXUnsupportedMode | undefined;
181
+ /**
182
+ * @internal
183
+ */
184
+ customPropertyValues?: ReadonlyMap<string, string> | undefined;
181
185
  majorVersion?: 4 | undefined;
182
186
  } & RequiredStyleHandlerOptions;
183
187
  export interface UserDefinedPostcssOptions {
@@ -257,5 +261,9 @@ export interface UserDefinedPostcssOptions {
257
261
  export type { CssCalcOptions, PresetEnvOptions, Rem2rpxOptions, WeappAutoprefixerOptions, };
258
262
  export interface StyleHandler {
259
263
  (rawSource: string, opt?: Partial<IStyleHandlerOptions>): Promise<PostcssResult>;
264
+ /**
265
+ * 处理调用方持有的 CSS AST。输入 Root 不会被原地修改,返回结果也不会与内部缓存共享可变节点。
266
+ */
267
+ transformRoot: (root: Root, opt?: Partial<IStyleHandlerOptions>) => Promise<PostcssResult>;
260
268
  getPipeline: (opt?: Partial<IStyleHandlerOptions>) => StyleProcessingPipeline;
261
269
  }
package/dist/types.js CHANGED
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,4 @@
1
- import { postcss } from '../postcss-runtime';
1
+ import { postcss } from '../postcss-runtime.js';
2
2
  export declare function isCssRuleCoveredByDeclarations(rule: postcss.Rule, baseRuleDeclarationKeys: Map<string, Set<string>>): boolean;
3
3
  export declare function dedupeCoveredCssRules(css: string): string;
4
4
  export declare function mergeCoveredCssRuleDeclarations(baseCss: string, css: string): {
@@ -1,4 +1,4 @@
1
- import { postcss } from '../postcss-runtime';
1
+ import { postcss } from '../postcss-runtime.js';
2
2
  export declare const MINI_PROGRAM_PREFLIGHT_SELECTOR_KEY = "view,text,::after,::before";
3
3
  export declare const MINI_PROGRAM_PREFLIGHT_SELECTOR_KEYS: Set<string>;
4
4
  export declare const MINI_PROGRAM_THEME_SCOPE_SELECTOR_KEY = ":host,page,.tw-root,wx-root-portal-content";
@@ -1,3 +1,3 @@
1
- export { containsCssAfterMinify, filterExistingCssRules } from './vite-css-rules/containment';
2
- export { dedupeCoveredCssRules, mergeCoveredCssRuleDeclarations } from './vite-css-rules/coverage';
3
- export { mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations } from './vite-css-rules/mini-program';
1
+ export { containsCssAfterMinify, filterExistingCssRules } from './vite-css-rules/containment.js';
2
+ export { dedupeCoveredCssRules, mergeCoveredCssRuleDeclarations } from './vite-css-rules/coverage.js';
3
+ export { mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations } from './vite-css-rules/mini-program.js';
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@weapp-tailwindcss/postcss",
3
- "version": "3.1.12",
3
+ "type": "module",
4
+ "version": "3.2.1",
4
5
  "description": "@weapp-tailwindcss/postcss",
5
6
  "author": "ice breaker <1324318532@qq.com>",
6
7
  "license": "MIT",
@@ -17,28 +18,28 @@
17
18
  "exports": {
18
19
  ".": {
19
20
  "types": "./dist/index.d.ts",
20
- "import": "./dist/index.mjs",
21
- "require": "./dist/index.js"
21
+ "import": "./dist/index.js",
22
+ "require": "./dist/index.cjs"
22
23
  },
23
24
  "./types": {
24
25
  "types": "./dist/types.d.ts",
25
- "import": "./dist/types.mjs",
26
- "require": "./dist/types.js"
26
+ "import": "./dist/types.js",
27
+ "require": "./dist/types.cjs"
27
28
  },
28
29
  "./html-transform": {
29
30
  "types": "./dist/html-transform.d.ts",
30
- "import": "./dist/html-transform.mjs",
31
- "require": "./dist/html-transform.js"
31
+ "import": "./dist/html-transform.js",
32
+ "require": "./dist/html-transform.cjs"
32
33
  },
33
34
  "./css-macro/postcss": {
34
35
  "types": "./dist/css-macro/postcss.d.ts",
35
- "import": "./dist/css-macro/postcss.mjs",
36
- "require": "./dist/css-macro/postcss.js"
36
+ "import": "./dist/css-macro/postcss.js",
37
+ "require": "./dist/css-macro/postcss.cjs"
37
38
  },
38
39
  "./package.json": "./package.json"
39
40
  },
40
- "main": "./dist/index.js",
41
- "module": "./dist/index.mjs",
41
+ "main": "./dist/index.cjs",
42
+ "module": "./dist/index.js",
42
43
  "types": "./dist/index.d.ts",
43
44
  "typesVersions": {
44
45
  "*": {
@@ -64,36 +65,37 @@
64
65
  "node": "^20.19.0 || >=22.12.0"
65
66
  },
66
67
  "dependencies": {
67
- "@tailwindcss-mangle/engine": "0.1.3",
68
+ "@csstools/css-color-parser": "^4.1.10",
69
+ "@csstools/css-parser-algorithms": "^4.0.0",
70
+ "@csstools/css-tokenizer": "^4.0.0",
71
+ "@tailwindcss-mangle/engine": "0.2.0",
68
72
  "@weapp-core/escape": "~8.0.0",
69
- "autoprefixer": "^10.5.3",
73
+ "autoprefixer": "^10.5.4",
74
+ "es-toolkit": "^1.49.0",
70
75
  "lru-cache": "11.5.2",
71
76
  "micromatch": "^4.0.8",
72
- "postcss": "^8.5.19",
77
+ "postcss": "^8.5.22",
73
78
  "postcss-load-config": "^6.0.1",
79
+ "postcss-preset-env": "^11.3.2",
74
80
  "postcss-pxtrans": "^1.0.4",
75
81
  "postcss-rem-to-responsive-pixel": "^7.0.4",
76
82
  "postcss-rule-unit-converter": "^0.2.2",
77
83
  "postcss-selector-parser": "~7.1.4",
78
84
  "postcss-value-parser": "^4.2.0",
79
- "tailwindcss-config": "2.0.1",
80
- "@weapp-tailwindcss/postcss-calc": "^1.0.2",
81
- "@weapp-tailwindcss/shared": "2.0.0"
85
+ "@weapp-tailwindcss/postcss-calc": "^1.0.3",
86
+ "@weapp-tailwindcss/shared": "2.0.1",
87
+ "tailwindcss-config": "2.0.2"
82
88
  },
83
89
  "devDependencies": {
84
- "@csstools/css-color-parser": "^4.1.9",
85
- "@csstools/css-parser-algorithms": "^4.0.0",
86
- "@csstools/css-tokenizer": "^4.0.0",
87
90
  "@csstools/postcss-is-pseudo-class": "^6.0.0",
88
91
  "fast-check": "^4.9.0",
89
92
  "postcss-calc": "link:packages/postcss-calc",
90
- "postcss-custom-properties": "^15.0.1",
91
- "postcss-preset-env": "^11.3.2"
93
+ "postcss-custom-properties": "^15.0.1"
92
94
  },
93
95
  "scripts": {
94
96
  "dev": "tsdown --watch --sourcemap",
95
- "build": "tsdown && tsc -p tsconfig.build.json",
96
- "build:types": "tsc -p tsconfig.build.json",
97
+ "build": "tsdown && tsc -p tsconfig.build.json && tsx ../../tools/weapp-tailwindcss-scripts/src/rewrite-dts-aliases.ts .",
98
+ "build:types": "tsc -p tsconfig.build.json && tsx ../../tools/weapp-tailwindcss-scripts/src/rewrite-dts-aliases.ts .",
97
99
  "test": "vitest run",
98
100
  "bench": "vitest bench",
99
101
  "test:dev": "vitest",
@@ -1,2 +0,0 @@
1
- import { CSS_MACRO_POSTCSS_PLUGIN_NAME, creator } from "../postcss-BNPP2oxO.mjs";
2
- export { CSS_MACRO_POSTCSS_PLUGIN_NAME, creator as default };
package/dist/types.mjs DELETED
@@ -1 +0,0 @@
1
- export {};