@weapp-tailwindcss/postcss 3.0.5 → 3.0.7
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/compat/mini-program-css/predicates.d.ts +1 -0
- package/dist/compat/mini-program-css/selectors.d.ts +3 -0
- package/dist/css-macro/auto.d.ts +7 -0
- package/dist/css-macro/constants.d.ts +17 -0
- package/dist/css-macro/postcss.d.ts +6 -0
- package/dist/css-macro/postcss.js +7 -0
- package/dist/css-macro/postcss.mjs +2 -0
- package/dist/generator-plugin/config-directive.d.ts +1 -0
- package/dist/generator-plugin/context.d.ts +8 -0
- package/dist/generator-plugin/directives.d.ts +5 -0
- package/dist/generator-plugin/index.d.ts +4 -0
- package/dist/generator-plugin/package-version.d.ts +3 -0
- package/dist/generator-plugin/source-files.d.ts +7 -0
- package/dist/generator-plugin/tailwind-version.d.ts +3 -0
- package/dist/generator-plugin/types.d.ts +100 -0
- package/dist/html-transform.js +1 -1
- package/dist/html-transform.mjs +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.js +1654 -190
- package/dist/index.mjs +1657 -220
- package/dist/postcss-BebUgs5n.mjs +158 -0
- package/dist/postcss-by-0mwIg.js +169 -0
- package/dist/postcss-config.d.ts +8 -0
- package/dist/postcss-runtime.d.ts +2 -0
- package/dist/source-scan/inline-source.d.ts +7 -0
- package/dist/source-scan.d.ts +31 -0
- package/dist/vite-css-rules.d.ts +17 -0
- package/package.json +14 -2
- package/dist/{html-transform-Dgak7hXa.js → html-transform-CMF3g0Cc.js} +1 -1
|
@@ -7,4 +7,5 @@ export declare function isEmptyTwContentDeclaration(decl: postcss.Declaration):
|
|
|
7
7
|
export declare function isPseudoContentInitRule(rule: postcss.Rule): boolean;
|
|
8
8
|
export declare function usesTwContentVariable(root: postcss.Root): boolean;
|
|
9
9
|
export declare function isMiniProgramPreflightRule(node: postcss.Node): node is postcss.Rule;
|
|
10
|
+
export declare function isBrowserElementPreflightRule(node: postcss.Node): node is postcss.Rule;
|
|
10
11
|
export declare function isMiniProgramThemeVariableRule(node: postcss.Node): node is postcss.Rule;
|
|
@@ -2,6 +2,7 @@ import type postcss from 'postcss';
|
|
|
2
2
|
export declare const MINI_PROGRAM_THEME_SCOPE_SELECTOR = ":host,page,.tw-root,wx-root-portal-content";
|
|
3
3
|
export declare const MINI_PROGRAM_ELEMENT_SCOPE_SELECTOR = "view,text,::after,::before";
|
|
4
4
|
export declare const MINI_PROGRAM_ELEMENT_SCOPE_SELECTORS: Set<string>;
|
|
5
|
+
export declare const MINI_PROGRAM_NATIVE_ELEMENT_SELECTORS: Set<string>;
|
|
5
6
|
export declare const MINI_PROGRAM_PREFLIGHT_SELECTORS: Set<string>;
|
|
6
7
|
export declare const MINI_PROGRAM_THEME_SCOPE_SELECTORS: Set<string>;
|
|
7
8
|
export declare const SPECIFICITY_PLACEHOLDER_SUFFIXES: string[];
|
|
@@ -10,5 +11,7 @@ export declare function normalizePseudoElementSelector(selector: string): string
|
|
|
10
11
|
export declare function getRuleSelectors(rule: postcss.Rule): string[];
|
|
11
12
|
export declare function getSortedRuleSelectorKey(rule: postcss.Rule): string;
|
|
12
13
|
export declare function isUnsupportedBrowserSelector(selector: string): boolean;
|
|
14
|
+
export declare function isUnsupportedBrowserPreflightSelector(selector: string): boolean;
|
|
15
|
+
export declare function isMiniProgramNativeElementSelector(selector: string): boolean;
|
|
13
16
|
export declare function isMiniProgramPreflightSelector(selectors: string[]): boolean;
|
|
14
17
|
export declare function isMiniProgramThemeScopeSelector(selectors: string[]): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '../types';
|
|
2
|
+
export declare const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
3
|
+
export declare function compileCssMacroConditionalComments(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): string;
|
|
4
|
+
export declare function hasCssMacroTailwindV4Directive(css: string | undefined): boolean;
|
|
5
|
+
export declare function withCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
|
|
6
|
+
export declare function hasCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): boolean;
|
|
7
|
+
export declare function transformCssMacroCss(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const uniAppPlatform: string[];
|
|
2
|
+
export declare const queryKey = "weapp-tw-platform";
|
|
3
|
+
export declare const ifdefAtRule = "weapp-tw-ifdef";
|
|
4
|
+
export declare const ifndefAtRule = "weapp-tw-ifndef";
|
|
5
|
+
export declare function createConditionalAtRule(value: string): string;
|
|
6
|
+
export declare function createNegativeConditionalAtRule(value: string): string;
|
|
7
|
+
export declare function normalComment(text: string): string;
|
|
8
|
+
export declare function ifdef(text: string): {
|
|
9
|
+
start: string;
|
|
10
|
+
end: string;
|
|
11
|
+
};
|
|
12
|
+
export declare function ifndef(text: string): {
|
|
13
|
+
start: string;
|
|
14
|
+
end: string;
|
|
15
|
+
};
|
|
16
|
+
export declare function matchCustomPropertyFromValue(str: string, cb: (arr: RegExpExecArray, index: number) => void): void;
|
|
17
|
+
export declare function parseConditionalAtRuleParam(params: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_postcss = require("../postcss-by-0mwIg.js");
|
|
6
|
+
exports.CSS_MACRO_POSTCSS_PLUGIN_NAME = require_postcss.CSS_MACRO_POSTCSS_PLUGIN_NAME;
|
|
7
|
+
exports.default = require_postcss.creator;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function prependConfigDirective(css: string, config: string | undefined): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Result, Root } from 'postcss';
|
|
2
|
+
import type { WeappTailwindcssPostcssGenerateResult, WeappTailwindcssPostcssPluginOptions } from './types';
|
|
3
|
+
export declare function resolveInputFile(result: Result): string | undefined;
|
|
4
|
+
export declare function resolvePostcssBase(result: Result, options: WeappTailwindcssPostcssPluginOptions): string;
|
|
5
|
+
export declare function resolvePostcssProjectRoot(result: Result, options: WeappTailwindcssPostcssPluginOptions): string;
|
|
6
|
+
export declare function replaceRootCss(root: Root, css: string, result: Result): void;
|
|
7
|
+
export declare function addDependencyMessages(result: Result, generated: WeappTailwindcssPostcssGenerateResult): void;
|
|
8
|
+
export declare function addSourceDependencyMessages(result: Result, files: string[]): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { PluginCreator } from 'postcss';
|
|
2
|
+
import type { WeappTailwindcssPostcssPluginAdapters, WeappTailwindcssPostcssPluginOptions } from './types';
|
|
3
|
+
export declare function createWeappTailwindcssPostcssPlugin(adapters: WeappTailwindcssPostcssPluginAdapters): PluginCreator<WeappTailwindcssPostcssPluginOptions>;
|
|
4
|
+
export type { NormalizedWeappTailwindcssPostcssGeneratorOptions, TailwindCandidateSource, TailwindResolvedSource, TailwindV3SourceOptions, TailwindV4SourceOptions, WeappTailwindcssPostcssGenerateOptions, WeappTailwindcssPostcssGenerateResult, WeappTailwindcssPostcssGenerator, WeappTailwindcssPostcssGeneratorUserOptions, WeappTailwindcssPostcssPluginAdapters, WeappTailwindcssPostcssPluginOptions, WeappTailwindcssPostcssTailwindVersion, WeappTailwindcssPostcssTarget, } from './types';
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { WeappTailwindcssPostcssTailwindVersion } from './types';
|
|
2
|
+
export declare const DEFAULT_TAILWINDCSS_GENERATOR_MAJOR_VERSION: WeappTailwindcssPostcssTailwindVersion;
|
|
3
|
+
export declare function readInstalledPackageMajorVersion(packageName: string, base: string): WeappTailwindcssPostcssTailwindVersion | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Result, Root } from 'postcss';
|
|
2
|
+
import type { TailwindCandidateSource, WeappTailwindcssPostcssPluginOptions } from './types';
|
|
3
|
+
export declare function collectAutoTailwindCandidates(root: Root, result: Result, options: WeappTailwindcssPostcssPluginOptions): Promise<Set<string>>;
|
|
4
|
+
export declare function collectPostcssLocalSources(root: Root, result: Result, options: WeappTailwindcssPostcssPluginOptions): Promise<{
|
|
5
|
+
files: string[];
|
|
6
|
+
sources: TailwindCandidateSource[];
|
|
7
|
+
}>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { Result, Root } from 'postcss';
|
|
2
|
+
import type { WeappTailwindcssPostcssPluginOptions } from './types';
|
|
3
|
+
export declare function resolvePostcssTailwindVersion(root: Root, result: Result, options: WeappTailwindcssPostcssPluginOptions): import("./types").WeappTailwindcssPostcssTailwindVersion;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '../types';
|
|
2
|
+
export type WeappTailwindcssPostcssTarget = 'weapp' | 'web' | 'tailwind';
|
|
3
|
+
export type WeappTailwindcssPostcssTailwindVersion = 3 | 4;
|
|
4
|
+
export interface TailwindCandidateSource {
|
|
5
|
+
content: string;
|
|
6
|
+
extension?: string | undefined;
|
|
7
|
+
}
|
|
8
|
+
export interface WeappTailwindcssPostcssGenerateOptions {
|
|
9
|
+
candidates?: Iterable<string> | undefined;
|
|
10
|
+
scanSources?: boolean | undefined;
|
|
11
|
+
sources?: TailwindCandidateSource[] | undefined;
|
|
12
|
+
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
13
|
+
tailwindcssV3Compatibility?: boolean | undefined;
|
|
14
|
+
target?: WeappTailwindcssPostcssTarget | undefined;
|
|
15
|
+
}
|
|
16
|
+
export interface WeappTailwindcssPostcssGenerateResult {
|
|
17
|
+
css: string;
|
|
18
|
+
rawCss: string;
|
|
19
|
+
target: WeappTailwindcssPostcssTarget;
|
|
20
|
+
classSet: Set<string>;
|
|
21
|
+
dependencies: string[];
|
|
22
|
+
}
|
|
23
|
+
export interface WeappTailwindcssPostcssGenerator {
|
|
24
|
+
generate: (options?: WeappTailwindcssPostcssGenerateOptions) => Promise<WeappTailwindcssPostcssGenerateResult>;
|
|
25
|
+
}
|
|
26
|
+
export interface TailwindV3SourceOptions {
|
|
27
|
+
projectRoot?: string | undefined;
|
|
28
|
+
cwd?: string | undefined;
|
|
29
|
+
base?: string | undefined;
|
|
30
|
+
css?: string | undefined;
|
|
31
|
+
config?: string | undefined;
|
|
32
|
+
packageName?: string | undefined;
|
|
33
|
+
postcssPlugin?: string | undefined;
|
|
34
|
+
}
|
|
35
|
+
export interface TailwindV4SourceOptions {
|
|
36
|
+
projectRoot?: string | undefined;
|
|
37
|
+
base?: string | undefined;
|
|
38
|
+
css?: string | undefined;
|
|
39
|
+
packageName?: string | undefined;
|
|
40
|
+
}
|
|
41
|
+
export type TailwindResolvedSource = unknown;
|
|
42
|
+
export interface WeappTailwindcssPostcssGeneratorUserOptions {
|
|
43
|
+
target?: WeappTailwindcssPostcssTarget | undefined;
|
|
44
|
+
config?: string | undefined;
|
|
45
|
+
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
46
|
+
importFallback?: boolean | undefined;
|
|
47
|
+
tailwindcssV3Compatibility?: boolean | undefined;
|
|
48
|
+
bareArbitraryValues?: unknown;
|
|
49
|
+
}
|
|
50
|
+
export interface NormalizedWeappTailwindcssPostcssGeneratorOptions {
|
|
51
|
+
target: WeappTailwindcssPostcssTarget;
|
|
52
|
+
config?: string | undefined;
|
|
53
|
+
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
54
|
+
importFallback: boolean;
|
|
55
|
+
tailwindcssV3Compatibility: boolean;
|
|
56
|
+
bareArbitraryValues?: unknown;
|
|
57
|
+
}
|
|
58
|
+
export interface WeappTailwindcssPostcssPluginAdapters {
|
|
59
|
+
createGenerator: (source: TailwindResolvedSource) => WeappTailwindcssPostcssGenerator;
|
|
60
|
+
normalizeGeneratorOptions: (options: WeappTailwindcssPostcssGeneratorUserOptions | undefined) => NormalizedWeappTailwindcssPostcssGeneratorOptions;
|
|
61
|
+
resolveTailwindV3Source: (options: TailwindV3SourceOptions) => Promise<TailwindResolvedSource>;
|
|
62
|
+
resolveTailwindV4Source: (options: TailwindV4SourceOptions) => Promise<TailwindResolvedSource>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* `weapp-tailwindcss` PostCSS 插件配置。
|
|
66
|
+
*/
|
|
67
|
+
export interface WeappTailwindcssPostcssPluginOptions extends TailwindV4SourceOptions {
|
|
68
|
+
/**
|
|
69
|
+
* 生成器配置,用于控制目标端、Tailwind 配置路径和 v4 兼容层。
|
|
70
|
+
*/
|
|
71
|
+
generator?: WeappTailwindcssPostcssGeneratorUserOptions | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* 显式指定 Tailwind CSS 主版本。未传入时会从 CSS 与依赖环境推断。
|
|
74
|
+
*/
|
|
75
|
+
version?: WeappTailwindcssPostcssTailwindVersion | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Tailwind 配置文件路径。
|
|
78
|
+
*/
|
|
79
|
+
config?: string | undefined;
|
|
80
|
+
/**
|
|
81
|
+
* Tailwind PostCSS 插件名称。
|
|
82
|
+
*/
|
|
83
|
+
postcssPlugin?: string | undefined;
|
|
84
|
+
/**
|
|
85
|
+
* 额外传入的候选类名。
|
|
86
|
+
*/
|
|
87
|
+
candidates?: Iterable<string> | undefined;
|
|
88
|
+
/**
|
|
89
|
+
* 是否扫描 Tailwind v4 源码入口中的候选类名。
|
|
90
|
+
*/
|
|
91
|
+
scanSources?: WeappTailwindcssPostcssGenerateOptions['scanSources'];
|
|
92
|
+
/**
|
|
93
|
+
* 额外传入的 Tailwind v4 内联候选来源。
|
|
94
|
+
*/
|
|
95
|
+
sources?: TailwindCandidateSource[] | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* 传给小程序 CSS 兼容转换器的额外配置。
|
|
98
|
+
*/
|
|
99
|
+
styleOptions?: Partial<IStyleHandlerOptions> | undefined;
|
|
100
|
+
}
|
package/dist/html-transform.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const require_html_transform = require("./html-transform-
|
|
1
|
+
const require_html_transform = require("./html-transform-CMF3g0Cc.js");
|
|
2
2
|
module.exports = require_html_transform.postcssHtmlTransform;
|
package/dist/html-transform.mjs
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
export { type DynamicColorMixAlphaProtection, type DynamicColorMixAlphaProtectionOptions, type ModernColorValueNormalization, normalizeModernColorValue, protectDynamicColorMixAlpha, } from './compat/color-mix';
|
|
2
2
|
export { finalizeMiniProgramCss, hoistTailwindPreflightBase, pruneMiniProgramGeneratedCss, removeUnsupportedAtSupports, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, } from './compat/mini-program-css';
|
|
3
3
|
export { normalizeMiniProgramPrefixedDeclaration, removeUnsupportedMiniProgramPrefixedAtRule, } from './compat/mini-program-prefixes';
|
|
4
|
+
export { compileCssMacroConditionalComments, CSS_MACRO_STYLE_OPTIONS_MARKER, hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, transformCssMacroCss, withCssMacroStyleOptions, } from './css-macro/auto';
|
|
5
|
+
export { CSS_MACRO_POSTCSS_PLUGIN_NAME, default as cssMacroPostcssPlugin } from './css-macro/postcss';
|
|
6
|
+
export { createWeappTailwindcssPostcssPlugin } from './generator-plugin';
|
|
7
|
+
export type { NormalizedWeappTailwindcssPostcssGeneratorOptions, TailwindCandidateSource, TailwindResolvedSource, TailwindV3SourceOptions, TailwindV4SourceOptions, WeappTailwindcssPostcssGenerateOptions, WeappTailwindcssPostcssGenerateResult, WeappTailwindcssPostcssGenerator, WeappTailwindcssPostcssGeneratorUserOptions, WeappTailwindcssPostcssPluginAdapters, WeappTailwindcssPostcssPluginOptions, WeappTailwindcssPostcssTailwindVersion, WeappTailwindcssPostcssTarget, } from './generator-plugin';
|
|
4
8
|
export * from './handler';
|
|
5
9
|
export { default as postcssHtmlTransform, type IOptions as PostcssHtmlTransformOptions } from './html-transform';
|
|
6
10
|
export { createStylePipeline, type PipelineNodeContext, type PipelineNodeCursor, type PipelineStage, type ResolvedPipelineNode, type StyleProcessingPipeline, } from './pipeline';
|
|
7
11
|
export { createFallbackPlaceholderReplacer } from './plugins/post/specificity-cleaner';
|
|
12
|
+
export { getPostcssPluginName, removeTailwindPostcssPlugins, resolveFilteredPostcssConfig, } from './postcss-config';
|
|
13
|
+
export { postcss } from './postcss-runtime';
|
|
14
|
+
export type { AcceptedPlugin, AtRule, Container, Declaration, Document, Helpers, Plugin, PluginCreator, Node as PostcssNode, ProcessOptions, Processor, Result, Root, Rule, } from './postcss-runtime';
|
|
8
15
|
export { createInjectPreflight } from './preflight';
|
|
9
16
|
export { internalCssSelectorReplacer } from './shared';
|
|
10
17
|
export * from './types';
|
|
18
|
+
export { containsCssAfterMinify, filterExistingCssRules, mergeCoveredCssRuleDeclarations, mergeMiniProgramPreflightRuleDeclarations, mergeMiniProgramThemeScopeRuleDeclarations, } from './vite-css-rules';
|
|
11
19
|
export { composeRules as unitConversionComposeRules, presets as unitConversionPresets, } from 'postcss-rule-unit-converter';
|