weapp-tailwindcss 5.5.4 → 5.5.6
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/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +5 -4
- package/dist/bundlers/shared/final-css-cleanup.d.ts +1 -2
- package/dist/bundlers/shared/framework-css-composition.d.ts +1 -0
- package/dist/bundlers/shared/framework-postcss.d.ts +2 -1
- package/dist/bundlers/shared/framework-user-css.d.ts +1 -0
- package/dist/bundlers/shared/generated-css-marker.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +5 -7
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +4 -1
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +4 -2
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/types.d.ts +6 -3
- package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/user-css/compile-functions.d.ts +4 -0
- package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +3 -1
- package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +3 -0
- package/dist/bundlers/shared/style-handler-options.d.ts +7 -0
- package/dist/bundlers/shared/v4-generation-core.d.ts +0 -1
- package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +3 -0
- package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +3 -0
- package/dist/bundlers/vite/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/frameworks/generic/web.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/css-transform-decision-plan.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/finalize/sync-processed-css.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/framework-style-memory.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/runtime.d.ts +3 -1
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/web-css-module.d.ts +1 -0
- package/dist/bundlers/vite/plugin-hook.d.ts +3 -0
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +3 -1
- package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +1 -1
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +3 -1
- package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +2 -1
- package/dist/bundlers/vite/shared/framework-runtime-configuration.d.ts +3 -0
- package/dist/bundlers/vite/shared/framework-runtime-options.d.ts +9 -0
- package/dist/bundlers/vite/shared/framework-runtime-utils.d.ts +6 -5
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +3 -3
- package/dist/bundlers/vite/shared/framework-strategy.d.ts +3 -1
- package/dist/bundlers/vite/shared/hmr-source.d.ts +2 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/processed-css-task.d.ts +2 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +1 -1
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/semantic-css.d.ts +1 -1
- package/dist/compiler/types.d.ts +1 -1
- package/dist/{compiler-DFROuh5Z.cjs → compiler-C8FqI-P3.cjs} +1060 -1163
- package/dist/{compiler-CJ5yX-on.js → compiler-D3GBwxoa.js} +32 -23
- package/dist/core/compiler/transforms.d.ts +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.js +4 -4
- package/dist/{css-imports-_5cwJnx-.cjs → css-imports-XvtI1zCY.cjs} +2 -3
- package/dist/css-macro.cjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/{defaults-CKx-4LcW.js → defaults-AQuvJS-h.js} +4 -2
- package/dist/{defaults-CiGsr8Xq.cjs → defaults-CyX5iO9y.cjs} +4 -2
- package/dist/defaults.cjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/final-css-cleanup-CDTmVAye.cjs +1 -0
- package/dist/{final-css-cleanup-B0HUBtiE.js → final-css-cleanup-u_sI2p56.js} +1 -126
- package/dist/framework/index.d.ts +1 -1
- package/dist/framework/platform.d.ts +2 -2
- package/dist/{generator-RK2HtgOb.cjs → generator-Bvr4WmuF.cjs} +150 -150
- package/dist/{generator-BgbYHNgD.js → generator-C0BJjyLM.js} +131 -131
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-BS7fTmyj.cjs → gulp-BExe5RBF.cjs} +8 -8
- package/dist/{gulp-nl-2p5Dw.js → gulp-BhkIIk7J.js} +5 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-BfxWwMeT.js → hmr-timing-B9Yt86-U.js} +299 -404
- package/dist/{hmr-timing-D45cTIzM.cjs → hmr-timing-CoiJIqDu.cjs} +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/js/NodePathWalker.d.ts +1 -1
- package/dist/js/node-path-walker/export-handlers.d.ts +1 -1
- package/dist/js/node-path-walker/import-tokens.d.ts +1 -1
- package/dist/{pipeline-helpers-BEhISt4D.cjs → pipeline-helpers-BOjTEmMi.cjs} +6 -6
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{scoped-generator-Dqq2iLky.js → scoped-generator-B6Y1bxzM.js} +46 -31
- package/dist/{scoped-generator-DccPwmJT.cjs → scoped-generator-BUBls_oM.cjs} +46 -31
- package/dist/{source-candidate-scan-signature-CnUlGWhP.cjs → source-candidate-scan-signature-BtJZp28T.cjs} +32 -3
- package/dist/{source-candidate-scan-signature-BJkQJtRM.js → source-candidate-scan-signature-DNuGKTqf.js} +21 -4
- package/dist/style-injector/internal.d.ts +118 -8
- package/dist/style-injector/options.d.ts +5 -1
- package/dist/tailwindcss/runtime-options.d.ts +5 -0
- package/dist/tailwindcss/v4/preflight.d.ts +0 -1
- package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +4 -0
- package/dist/{tailwindcss-o3Xe-o7M.js → tailwindcss-B_4E52WF.js} +7 -13
- package/dist/{tailwindcss-B03BGeTO.cjs → tailwindcss-CBYjzRmV.cjs} +4 -10
- package/dist/{transform-BVH7iLHn.js → transform-CkEnJYIP.js} +18 -12
- package/dist/{transform-MIhriZRr.cjs → transform-FkqbTBJR.cjs} +17 -11
- package/dist/types/index.d.ts +3 -2
- package/dist/uni-app-x/border-preflight.d.ts +1 -2
- package/dist/uni-app-x/component-local-style.d.ts +2 -1
- package/dist/uni-app-x/transform.d.ts +4 -2
- package/dist/uni-app-x/vite/author-apply.d.ts +3 -1
- package/dist/uni-app-x/vite/native-hmr.d.ts +1 -1
- package/dist/uni-app-x/vite/style-result.d.ts +5 -0
- package/dist/{v4-generation-core-BvW2aK23.cjs → v4-generation-core-Cz1D7wm1.cjs} +313 -418
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-4RznbXVI.cjs → vite-DxuKPZlp.cjs} +565 -592
- package/dist/{vite-hGECCqfq.js → vite-lP35OguX.js} +558 -578
- package/dist/vite-web.d.ts +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +7 -7
- package/dist/{web-0FAisq6H.js → web-Dfz_jpNj.js} +144 -107
- package/dist/{web-DQZ27KWH.cjs → web-DhDxhlkq.cjs} +156 -107
- package/dist/{webpack-8cQlXIo4.js → webpack-D6jp1o3m.js} +18 -17
- package/dist/{webpack-DOQ_3ViW.cjs → webpack-R2Sbggiy.cjs} +20 -20
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -2
- package/dist/wxml/utils/custom-template.d.ts +1 -1
- package/package.json +9 -11
- package/dist/final-css-cleanup-DSjczga3.cjs +0 -138
- package/dist/tailwindcss/v4-engine/css-import.d.ts +0 -14
- package/dist/uni-app-x/style-asset/source-parser.d.ts +0 -2
|
@@ -4,17 +4,127 @@ import type { WeappTailwindcssStyleInjectorUserOptions } from './options.js';
|
|
|
4
4
|
import { normalizeStyleInjectorOptions } from './options.js';
|
|
5
5
|
export type ViteStyleInjectorDelegateFactory = (options: NonNullable<ReturnType<typeof normalizeStyleInjectorOptions>>) => Plugin[];
|
|
6
6
|
export type WebpackStyleInjectorDelegateFactory = (options: NonNullable<ReturnType<typeof normalizeWebpackStyleInjectorOptions>>) => WebpackObjectPluginInstance;
|
|
7
|
-
declare function normalizeWebpackStyleInjectorOptions(options: WeappTailwindcssStyleInjectorUserOptions | undefined):
|
|
7
|
+
declare function normalizeWebpackStyleInjectorOptions(options: WeappTailwindcssStyleInjectorUserOptions | undefined): ({
|
|
8
|
+
pagesJsonPath?: string | string[];
|
|
9
|
+
appConfigPath?: string | string[];
|
|
10
|
+
appPath?: string | string[];
|
|
11
|
+
sourceRoot?: string;
|
|
12
|
+
subPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[] | import("weapp-style-injector").TaroSubPackageConfig | import("weapp-style-injector").TaroSubPackageConfig[] | import("weapp-style-injector").MpxSubPackageConfig | import("weapp-style-injector").MpxSubPackageConfig[];
|
|
13
|
+
uniAppSubPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[];
|
|
14
|
+
uniAppStyleScopes?: import("weapp-style-injector").UniAppManualStyleConfig | import("weapp-style-injector").UniAppManualStyleConfig[];
|
|
15
|
+
subpackageStyleScopes?: import("weapp-style-injector").ResolvedSubpackageStyleScope[];
|
|
16
|
+
sourceFileName?: string | string[];
|
|
17
|
+
outputName?: string;
|
|
18
|
+
files?: string | string[];
|
|
19
|
+
include?: string | string[];
|
|
20
|
+
exclude?: string | string[];
|
|
21
|
+
indexFileName?: string | string[];
|
|
22
|
+
indexFileNames?: string | string[];
|
|
23
|
+
styleScopes?: import("weapp-style-injector").UniAppStyleScopeInput | import("weapp-style-injector").UniAppStyleScopeInput[];
|
|
24
|
+
rules?: import("weapp-style-injector").SubpackageStyleRules;
|
|
25
|
+
preprocess?: boolean;
|
|
26
|
+
imports?: string[];
|
|
27
|
+
perFileImports?: import("weapp-style-injector").PerFileImportResolver;
|
|
28
|
+
dedupe?: boolean;
|
|
29
|
+
} & Pick<WebpackWeappStyleInjectorOptions, "generateSubpackageStyle" | "loadSubpackageTargetStyle">) | undefined;
|
|
8
30
|
export declare const viteStyleInjectorDelegates: {
|
|
9
|
-
generic: (options: import("./options.js").
|
|
10
|
-
taro: (options: import("./options.js").
|
|
11
|
-
uniApp: (options: import("./options.js").
|
|
31
|
+
generic: (options: import("./options.js").DefinedStyleInjectorOptions) => Plugin<any>[];
|
|
32
|
+
taro: (options: import("./options.js").DefinedStyleInjectorOptions) => Plugin<any>[];
|
|
33
|
+
uniApp: (options: import("./options.js").DefinedStyleInjectorOptions) => Plugin<any>[];
|
|
12
34
|
};
|
|
13
35
|
export declare const webpackStyleInjectorDelegates: {
|
|
14
|
-
generic: (options:
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
36
|
+
generic: (options: {
|
|
37
|
+
pagesJsonPath?: string | string[];
|
|
38
|
+
appConfigPath?: string | string[];
|
|
39
|
+
appPath?: string | string[];
|
|
40
|
+
sourceRoot?: string;
|
|
41
|
+
subPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[] | import("weapp-style-injector").TaroSubPackageConfig | import("weapp-style-injector").TaroSubPackageConfig[] | import("weapp-style-injector").MpxSubPackageConfig | import("weapp-style-injector").MpxSubPackageConfig[];
|
|
42
|
+
uniAppSubPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[];
|
|
43
|
+
uniAppStyleScopes?: import("weapp-style-injector").UniAppManualStyleConfig | import("weapp-style-injector").UniAppManualStyleConfig[];
|
|
44
|
+
subpackageStyleScopes?: import("weapp-style-injector").ResolvedSubpackageStyleScope[];
|
|
45
|
+
sourceFileName?: string | string[];
|
|
46
|
+
outputName?: string;
|
|
47
|
+
files?: string | string[];
|
|
48
|
+
include?: string | string[];
|
|
49
|
+
exclude?: string | string[];
|
|
50
|
+
indexFileName?: string | string[];
|
|
51
|
+
indexFileNames?: string | string[];
|
|
52
|
+
styleScopes?: import("weapp-style-injector").UniAppStyleScopeInput | import("weapp-style-injector").UniAppStyleScopeInput[];
|
|
53
|
+
rules?: import("weapp-style-injector").SubpackageStyleRules;
|
|
54
|
+
preprocess?: boolean;
|
|
55
|
+
imports?: string[];
|
|
56
|
+
perFileImports?: import("weapp-style-injector").PerFileImportResolver;
|
|
57
|
+
dedupe?: boolean;
|
|
58
|
+
} & Pick<WebpackWeappStyleInjectorOptions, "generateSubpackageStyle" | "loadSubpackageTargetStyle">) => WebpackObjectPluginInstance;
|
|
59
|
+
mpx: (options: {
|
|
60
|
+
pagesJsonPath?: string | string[];
|
|
61
|
+
appConfigPath?: string | string[];
|
|
62
|
+
appPath?: string | string[];
|
|
63
|
+
sourceRoot?: string;
|
|
64
|
+
subPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[] | import("weapp-style-injector").TaroSubPackageConfig | import("weapp-style-injector").TaroSubPackageConfig[] | import("weapp-style-injector").MpxSubPackageConfig | import("weapp-style-injector").MpxSubPackageConfig[];
|
|
65
|
+
uniAppSubPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[];
|
|
66
|
+
uniAppStyleScopes?: import("weapp-style-injector").UniAppManualStyleConfig | import("weapp-style-injector").UniAppManualStyleConfig[];
|
|
67
|
+
subpackageStyleScopes?: import("weapp-style-injector").ResolvedSubpackageStyleScope[];
|
|
68
|
+
sourceFileName?: string | string[];
|
|
69
|
+
outputName?: string;
|
|
70
|
+
files?: string | string[];
|
|
71
|
+
include?: string | string[];
|
|
72
|
+
exclude?: string | string[];
|
|
73
|
+
indexFileName?: string | string[];
|
|
74
|
+
indexFileNames?: string | string[];
|
|
75
|
+
styleScopes?: import("weapp-style-injector").UniAppStyleScopeInput | import("weapp-style-injector").UniAppStyleScopeInput[];
|
|
76
|
+
rules?: import("weapp-style-injector").SubpackageStyleRules;
|
|
77
|
+
preprocess?: boolean;
|
|
78
|
+
imports?: string[];
|
|
79
|
+
perFileImports?: import("weapp-style-injector").PerFileImportResolver;
|
|
80
|
+
dedupe?: boolean;
|
|
81
|
+
} & Pick<WebpackWeappStyleInjectorOptions, "generateSubpackageStyle" | "loadSubpackageTargetStyle">) => WebpackObjectPluginInstance;
|
|
82
|
+
taro: (options: {
|
|
83
|
+
pagesJsonPath?: string | string[];
|
|
84
|
+
appConfigPath?: string | string[];
|
|
85
|
+
appPath?: string | string[];
|
|
86
|
+
sourceRoot?: string;
|
|
87
|
+
subPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[] | import("weapp-style-injector").TaroSubPackageConfig | import("weapp-style-injector").TaroSubPackageConfig[] | import("weapp-style-injector").MpxSubPackageConfig | import("weapp-style-injector").MpxSubPackageConfig[];
|
|
88
|
+
uniAppSubPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[];
|
|
89
|
+
uniAppStyleScopes?: import("weapp-style-injector").UniAppManualStyleConfig | import("weapp-style-injector").UniAppManualStyleConfig[];
|
|
90
|
+
subpackageStyleScopes?: import("weapp-style-injector").ResolvedSubpackageStyleScope[];
|
|
91
|
+
sourceFileName?: string | string[];
|
|
92
|
+
outputName?: string;
|
|
93
|
+
files?: string | string[];
|
|
94
|
+
include?: string | string[];
|
|
95
|
+
exclude?: string | string[];
|
|
96
|
+
indexFileName?: string | string[];
|
|
97
|
+
indexFileNames?: string | string[];
|
|
98
|
+
styleScopes?: import("weapp-style-injector").UniAppStyleScopeInput | import("weapp-style-injector").UniAppStyleScopeInput[];
|
|
99
|
+
rules?: import("weapp-style-injector").SubpackageStyleRules;
|
|
100
|
+
preprocess?: boolean;
|
|
101
|
+
imports?: string[];
|
|
102
|
+
perFileImports?: import("weapp-style-injector").PerFileImportResolver;
|
|
103
|
+
dedupe?: boolean;
|
|
104
|
+
} & Pick<WebpackWeappStyleInjectorOptions, "generateSubpackageStyle" | "loadSubpackageTargetStyle">) => WebpackObjectPluginInstance;
|
|
105
|
+
uniApp: (options: {
|
|
106
|
+
pagesJsonPath?: string | string[];
|
|
107
|
+
appConfigPath?: string | string[];
|
|
108
|
+
appPath?: string | string[];
|
|
109
|
+
sourceRoot?: string;
|
|
110
|
+
subPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[] | import("weapp-style-injector").TaroSubPackageConfig | import("weapp-style-injector").TaroSubPackageConfig[] | import("weapp-style-injector").MpxSubPackageConfig | import("weapp-style-injector").MpxSubPackageConfig[];
|
|
111
|
+
uniAppSubPackages?: import("weapp-style-injector").UniAppSubPackageConfig | import("weapp-style-injector").UniAppSubPackageConfig[];
|
|
112
|
+
uniAppStyleScopes?: import("weapp-style-injector").UniAppManualStyleConfig | import("weapp-style-injector").UniAppManualStyleConfig[];
|
|
113
|
+
subpackageStyleScopes?: import("weapp-style-injector").ResolvedSubpackageStyleScope[];
|
|
114
|
+
sourceFileName?: string | string[];
|
|
115
|
+
outputName?: string;
|
|
116
|
+
files?: string | string[];
|
|
117
|
+
include?: string | string[];
|
|
118
|
+
exclude?: string | string[];
|
|
119
|
+
indexFileName?: string | string[];
|
|
120
|
+
indexFileNames?: string | string[];
|
|
121
|
+
styleScopes?: import("weapp-style-injector").UniAppStyleScopeInput | import("weapp-style-injector").UniAppStyleScopeInput[];
|
|
122
|
+
rules?: import("weapp-style-injector").SubpackageStyleRules;
|
|
123
|
+
preprocess?: boolean;
|
|
124
|
+
imports?: string[];
|
|
125
|
+
perFileImports?: import("weapp-style-injector").PerFileImportResolver;
|
|
126
|
+
dedupe?: boolean;
|
|
127
|
+
} & Pick<WebpackWeappStyleInjectorOptions, "generateSubpackageStyle" | "loadSubpackageTargetStyle">) => WebpackObjectPluginInstance;
|
|
18
128
|
};
|
|
19
129
|
export declare function createBuiltinViteStyleInjectorPlugins(options: WeappTailwindcssStyleInjectorUserOptions | undefined, getDelegateFactory: () => ViteStyleInjectorDelegateFactory): Plugin[];
|
|
20
130
|
export declare function createBuiltinWebpackStyleInjectorPlugin(options: WeappTailwindcssStyleInjectorUserOptions | undefined, delegateFactory: WebpackStyleInjectorDelegateFactory): WebpackObjectPluginInstance | undefined;
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import type { MpxSubPackageConfig, ResolvedSubpackageStyleScope, SubpackageStyleGenerateContext, SubpackageStyleGenerator, SubpackageStyleRules, TaroSubPackageConfig, UniAppManualStyleConfig, UniAppStyleScopeInput, UniAppSubPackageConfig, WeappStyleInjectorOptions } from 'weapp-style-injector';
|
|
2
|
+
export type DefinedStyleInjectorOptions = {
|
|
3
|
+
[K in keyof WeappTailwindcssStyleInjectorOptions]: Exclude<WeappTailwindcssStyleInjectorOptions[K], undefined>;
|
|
4
|
+
};
|
|
2
5
|
export type WeappTailwindcssStyleInjectorUserOptions = boolean | WeappTailwindcssStyleInjectorOptions;
|
|
3
6
|
export interface WeappTailwindcssStyleInjectorOptions extends WeappStyleInjectorOptions {
|
|
4
7
|
pagesJsonPath?: string | string[] | undefined;
|
|
@@ -22,4 +25,5 @@ export interface WeappTailwindcssStyleInjectorOptions extends WeappStyleInjector
|
|
|
22
25
|
rules?: SubpackageStyleRules | undefined;
|
|
23
26
|
preprocess?: boolean | undefined;
|
|
24
27
|
}
|
|
25
|
-
export declare function normalizeStyleInjectorOptions(options: WeappTailwindcssStyleInjectorUserOptions | undefined):
|
|
28
|
+
export declare function normalizeStyleInjectorOptions(options: WeappTailwindcssStyleInjectorUserOptions | undefined): DefinedStyleInjectorOptions | undefined;
|
|
29
|
+
export declare function resolveStyleInjectorSubPackages<K extends 'appConfigPath' | 'pagesJsonPath' | 'appPath'>(subPackages: DefinedStyleInjectorOptions['subPackages'], key: K): Extract<UniAppSubPackageConfig | TaroSubPackageConfig | MpxSubPackageConfig, Record<K, string>>[] | undefined;
|
|
@@ -5,4 +5,9 @@ type TailwindExtendLengthUnitsOption = TailwindApplyOptions['extendLengthUnits']
|
|
|
5
5
|
export declare function resolveTailwindcssOptions(options?: TailwindCssRuntimeOptions): TailwindUserOptions | undefined;
|
|
6
6
|
export declare function normalizeExtendLengthUnits(value: boolean | LengthUnitsRuntimeOptions | undefined): TailwindExtendLengthUnitsOption | undefined;
|
|
7
7
|
export declare function normalizeTailwindcssRuntimeOptions(options?: TailwindCssRuntimeOptions): TailwindCssRuntimeOptions | undefined;
|
|
8
|
+
export declare function resolveRuntimeBareArbitraryValues(options?: TailwindCssRuntimeOptions): boolean | {
|
|
9
|
+
units?: never;
|
|
10
|
+
} | {
|
|
11
|
+
units: string[];
|
|
12
|
+
} | undefined;
|
|
8
13
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
export declare function parseCssImportSpecifier(params: string): string | undefined;
|
|
2
1
|
export declare function isTailwindV4CssImportParam(params: string): boolean;
|
|
3
2
|
export declare function isTailwindV4PreflightImportParam(params: string): boolean;
|
|
4
3
|
export declare function includesTailwindV4PreflightDirective(css: string): boolean;
|
|
@@ -37,6 +37,7 @@ export declare function runIncrementalGenerateTask(cacheKey: string, requestedCa
|
|
|
37
37
|
export declare function resolveTargetCandidates(candidates: Iterable<string> | undefined, target: TailwindV4GenerateTarget): Set<string>;
|
|
38
38
|
export declare function createIncrementalStyleOptions(styleOptions: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
|
|
39
39
|
export declare function resolveStyleOptions(source: TailwindV4ResolvedSource, options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions> | undefined;
|
|
40
|
+
export declare function collectCustomPropertyValues(css: string): Map<string, string>;
|
|
40
41
|
export declare function mergeCustomPropertyValues(target: Map<string, string>, css: string): void;
|
|
41
42
|
export declare function summarizeIncrementalCacheKey(key: string): {
|
|
42
43
|
keyHash: string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
type GenerationStyleOptions = Partial<IStyleHandlerOptions>;
|
|
3
|
+
export declare function resolveGenerationStyleContext(sourceCss: string, generatedCss: string, options?: GenerationStyleOptions): GenerationStyleOptions | undefined;
|
|
4
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A as normalizeStringListOption, At as resolveCssSourceEntries, C as findWorkspacePackageDir, D as normalizeTailwindcssRuntimeOptions, E as normalizeExtendLengthUnits, Lt as resolveCssMacroTailwindV4Source, Mt as resolveTailwindV4CssSourceBase, O as resolveRuntimeBareArbitraryValues, Ot as normalizeLegacyContentEntries, S as findNearestPackageRoot, T as omitUndefined, Tt as expandTailwindSourceEntries, Vt as loadTailwindV4DesignSystem, b as isTailwindV4CssEntry, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, k as resolveTailwindcssOptions, kt as parseConfigParam, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as groupCssEntriesByBase, w as findWorkspaceRoot, wt as FULL_SOURCE_SCAN_PATTERN, x as normalizeCssEntries, y as guessBasedirFromEntries } from "./generator-C0BJjyLM.js";
|
|
2
2
|
import { n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { extractProjectCandidatesWithPositions, resolveValidTailwindV4Candidates } from "@tailwindcss-mangle/engine";
|
|
8
|
-
import { postcss } from "@weapp-tailwindcss/postcss";
|
|
8
|
+
import { parseCssImportSpecifier, postcss } from "@weapp-tailwindcss/postcss";
|
|
9
9
|
import { stat } from "node:fs/promises";
|
|
10
10
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
11
11
|
import fg from "fast-glob";
|
|
@@ -142,15 +142,8 @@ function collectCssInlineSourceCandidates(root) {
|
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region src/tailwindcss/v4/preflight.ts
|
|
145
|
-
function parseCssImportSpecifier(params) {
|
|
146
|
-
const value = params.trim();
|
|
147
|
-
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
148
|
-
if (quoted) return quoted[2];
|
|
149
|
-
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
150
|
-
return url?.[2] ?? url?.[3];
|
|
151
|
-
}
|
|
152
145
|
function normalizeTailwindImportSpecifier(params) {
|
|
153
|
-
return parseCssImportSpecifier(params)?.replaceAll("\\", "/");
|
|
146
|
+
return parseCssImportSpecifier(params)?.specifier.replaceAll("\\", "/");
|
|
154
147
|
}
|
|
155
148
|
function isTailwindV4CssImportParam(params) {
|
|
156
149
|
const specifier = normalizeTailwindImportSpecifier(params);
|
|
@@ -350,7 +343,7 @@ function readStaticConfigContent(configPath) {
|
|
|
350
343
|
const SOURCE_CANDIDATE_PATTERN = FULL_SOURCE_SCAN_PATTERN;
|
|
351
344
|
const TAILWIND_CSS_ENTRY_PATTERN = "**/*.css";
|
|
352
345
|
const tailwindV4CssEntriesCache = /* @__PURE__ */ new Map();
|
|
353
|
-
function parseImportSourceParam(params) {
|
|
346
|
+
function parseImportSourceParam$1(params) {
|
|
354
347
|
const match = /\bsource\(\s*(none|(['"])(.*?)\2)\s*\)/.exec(params);
|
|
355
348
|
if (!match) return;
|
|
356
349
|
return {
|
|
@@ -456,7 +449,7 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
456
449
|
if (!isTailwindV4CssImportParam(rule.params)) return;
|
|
457
450
|
hasTailwindCssImport = true;
|
|
458
451
|
includesPreflight || (includesPreflight = isTailwindV4PreflightImportParam(rule.params));
|
|
459
|
-
const sourceParam = parseImportSourceParam(rule.params);
|
|
452
|
+
const sourceParam = parseImportSourceParam$1(rule.params);
|
|
460
453
|
if (sourceParam?.none) hasSourceNone = true;
|
|
461
454
|
if (sourceParam?.sourcePath) importSourceBase = resolveSourceBase(base, sourceParam.sourcePath);
|
|
462
455
|
});
|
|
@@ -1123,8 +1116,9 @@ function createEngineTailwindcssRuntime(options) {
|
|
|
1123
1116
|
return typeof entry === "string" ? entry : entry.rawCandidate;
|
|
1124
1117
|
}).filter((entry) => typeof entry === "string" && entry.length > 0));
|
|
1125
1118
|
const source = resolveCssMacroTailwindV4Source(await resolveTailwindV4SourceFromRuntime(runtime));
|
|
1119
|
+
const bareArbitraryValues = resolveRuntimeBareArbitraryValues(runtime.options);
|
|
1126
1120
|
const designSystem = await loadTailwindV4DesignSystem(source);
|
|
1127
|
-
const candidates = new Set(resolveValidTailwindV4Candidates(designSystem, rawCandidates, { ...
|
|
1121
|
+
const candidates = new Set(resolveValidTailwindV4Candidates(designSystem, rawCandidates, { ...bareArbitraryValues === void 0 ? {} : { bareArbitraryValues } }));
|
|
1128
1122
|
await collectTailwindV4CssCandidates(candidates);
|
|
1129
1123
|
return applyClassSetFilter(candidates);
|
|
1130
1124
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-Bvr4WmuF.cjs");
|
|
3
3
|
require("./utils-CuKLf1Zv.cjs");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -146,15 +146,8 @@ function collectCssInlineSourceCandidates(root) {
|
|
|
146
146
|
}
|
|
147
147
|
//#endregion
|
|
148
148
|
//#region src/tailwindcss/v4/preflight.ts
|
|
149
|
-
function parseCssImportSpecifier(params) {
|
|
150
|
-
const value = params.trim();
|
|
151
|
-
const quoted = /^(['"])(.*?)\1/.exec(value);
|
|
152
|
-
if (quoted) return quoted[2];
|
|
153
|
-
const url = /^url\(\s*(?:(['"])(.*?)\1|([^'")\s]+))\s*\)/.exec(value);
|
|
154
|
-
return url?.[2] ?? url?.[3];
|
|
155
|
-
}
|
|
156
149
|
function normalizeTailwindImportSpecifier(params) {
|
|
157
|
-
return parseCssImportSpecifier(params)?.replaceAll("\\", "/");
|
|
150
|
+
return (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(params)?.specifier.replaceAll("\\", "/");
|
|
158
151
|
}
|
|
159
152
|
function isTailwindV4CssImportParam(params) {
|
|
160
153
|
const specifier = normalizeTailwindImportSpecifier(params);
|
|
@@ -1127,8 +1120,9 @@ function createEngineTailwindcssRuntime(options) {
|
|
|
1127
1120
|
return typeof entry === "string" ? entry : entry.rawCandidate;
|
|
1128
1121
|
}).filter((entry) => typeof entry === "string" && entry.length > 0));
|
|
1129
1122
|
const source = require_generator.resolveCssMacroTailwindV4Source(await require_generator.resolveTailwindV4SourceFromRuntime(runtime));
|
|
1123
|
+
const bareArbitraryValues = require_generator.resolveRuntimeBareArbitraryValues(runtime.options);
|
|
1130
1124
|
const designSystem = await (0, _tailwindcss_mangle_engine.loadTailwindV4DesignSystem)(source);
|
|
1131
|
-
const candidates = new Set((0, _tailwindcss_mangle_engine.resolveValidTailwindV4Candidates)(designSystem, rawCandidates, { ...
|
|
1125
|
+
const candidates = new Set((0, _tailwindcss_mangle_engine.resolveValidTailwindV4Candidates)(designSystem, rawCandidates, { ...bareArbitraryValues === void 0 ? {} : { bareArbitraryValues } }));
|
|
1132
1126
|
await collectTailwindV4CssCandidates(candidates);
|
|
1133
1127
|
return applyClassSetFilter(candidates);
|
|
1134
1128
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { G as replaceWxml, H as analyzeSource, J as traverse$1, U as JsTokenUpdater, V as createAttributeMatcher, W as isClassContextLiteralPath, _ as generateCode, q as babelParse } from "./compiler-
|
|
3
|
-
import { a as shouldEnablePageLocalStyle, i as shouldEnableComponentLocalStyle, n as injectBorderPreflightClass,
|
|
1
|
+
import { Pt as _defineProperty } from "./generator-C0BJjyLM.js";
|
|
2
|
+
import { G as replaceWxml, H as analyzeSource, J as traverse$1, U as JsTokenUpdater, V as createAttributeMatcher, W as isClassContextLiteralPath, _ as generateCode, q as babelParse } from "./compiler-D3GBwxoa.js";
|
|
3
|
+
import { a as shouldEnablePageLocalStyle, i as shouldEnableComponentLocalStyle, n as injectBorderPreflightClass, r as shouldInjectBorderPreflight } from "./vite-lP35OguX.js";
|
|
4
4
|
import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
5
|
-
import { UNI_APP_X_IMPORTANT_APPLY_MARKER, normalizeUniAppXImportantApplyForSass } from "@weapp-tailwindcss/postcss";
|
|
5
|
+
import { UNI_APP_X_IMPORTANT_APPLY_MARKER, isUniAppXStyleSourceEmpty, normalizeUniAppXImportantApplyForSass } from "@weapp-tailwindcss/postcss";
|
|
6
6
|
import MagicString from "magic-string";
|
|
7
7
|
import { NodeTypes, parse } from "@vue/compiler-dom";
|
|
8
8
|
//#region src/uni-app-x/component-local-style-binding.ts
|
|
@@ -174,9 +174,10 @@ function hasTopLevelVariant(candidate) {
|
|
|
174
174
|
return false;
|
|
175
175
|
}
|
|
176
176
|
var UniAppXComponentLocalStyleCollector = class {
|
|
177
|
-
constructor(fileId, runtimeSet) {
|
|
177
|
+
constructor(fileId, runtimeSet, includeVariants = false) {
|
|
178
178
|
this.fileId = fileId;
|
|
179
179
|
this.runtimeSet = runtimeSet;
|
|
180
|
+
this.includeVariants = includeVariants;
|
|
180
181
|
_defineProperty(this, "aliasByUtility", /* @__PURE__ */ new Map());
|
|
181
182
|
_defineProperty(this, "aliasByLookup", /* @__PURE__ */ new Map());
|
|
182
183
|
_defineProperty(this, "classBindingNames", /* @__PURE__ */ new Set());
|
|
@@ -187,8 +188,9 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
187
188
|
if (cached) return cached;
|
|
188
189
|
const alias = createAlias(this.fileId, utility, this.aliasByUtility.size);
|
|
189
190
|
this.aliasByUtility.set(utility, alias);
|
|
190
|
-
|
|
191
|
-
this.aliasByLookup.set(
|
|
191
|
+
const replacement = hasTopLevelVariant(utility) ? `${replaceWxml(utility)} ${alias}` : alias;
|
|
192
|
+
this.aliasByLookup.set(utility, replacement);
|
|
193
|
+
this.aliasByLookup.set(replaceWxml(utility), replacement);
|
|
192
194
|
return alias;
|
|
193
195
|
}
|
|
194
196
|
rewriteLiteral(literal) {
|
|
@@ -197,7 +199,11 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
197
199
|
let rewritten = literal;
|
|
198
200
|
for (const candidate of candidates) {
|
|
199
201
|
if (!isRuntimeCandidate(candidate, this.runtimeSet)) continue;
|
|
200
|
-
rewritten = rewritten.replace(candidate,
|
|
202
|
+
if (!this.includeVariants && hasTopLevelVariant(candidate)) rewritten = rewritten.replace(candidate, replaceWxml(candidate));
|
|
203
|
+
else {
|
|
204
|
+
this.ensureAlias(candidate);
|
|
205
|
+
rewritten = rewritten.replace(candidate, this.aliasByLookup.get(candidate));
|
|
206
|
+
}
|
|
201
207
|
}
|
|
202
208
|
return rewritten;
|
|
203
209
|
}
|
|
@@ -224,7 +230,7 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
224
230
|
const classContext = options.wrapExpression || isClassContextLiteralPath(path) || isClassBindingLiteralPath(path, classBindingRoots);
|
|
225
231
|
for (const candidate of candidates) {
|
|
226
232
|
if (!candidate || !classContext || !isRuntimeCandidate(candidate, this.runtimeSet)) continue;
|
|
227
|
-
if (!hasTopLevelVariant(candidate)) {
|
|
233
|
+
if (this.includeVariants || !hasTopLevelVariant(candidate)) {
|
|
228
234
|
this.ensureAlias(candidate);
|
|
229
235
|
if (options.deep) this.deepUtilities.add(candidate);
|
|
230
236
|
}
|
|
@@ -446,7 +452,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
446
452
|
const normalized = normalizeUniAppXImportantApplyForSass(style.content);
|
|
447
453
|
if (normalized !== style.content) ms.update(style.start, style.end, normalized);
|
|
448
454
|
}
|
|
449
|
-
const localStyleCollector = shouldEnableLocalStyle(id, options) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
|
|
455
|
+
const localStyleCollector = shouldEnableLocalStyle(id, options) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet, options.localStyleVariants) : void 0;
|
|
450
456
|
if (descriptor.errors.length === 0) {
|
|
451
457
|
if (descriptor.template?.ast) {
|
|
452
458
|
const templateOffset = descriptor.template.start;
|
|
@@ -480,11 +486,11 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
480
486
|
const { code } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
481
487
|
ms.update(descriptor.scriptSetup.start, descriptor.scriptSetup.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
482
488
|
}
|
|
483
|
-
const scopedStyle = descriptor.styles.
|
|
489
|
+
const scopedStyle = [...descriptor.styles].reverse().find((style) => STYLE_SCOPED_RE.test(style.attrs) && (!options.onWebLocalStyleRules || !isUniAppXStyleSourceEmpty(style.content)));
|
|
484
490
|
if (localStyleCollector && options.onWebLocalStyleRules && descriptor.template) options.onWebLocalStyleRules(localStyleCollector.hasStyles() ? localStyleCollector.toStyleRules({ web: true }) : "");
|
|
485
491
|
if (localStyleCollector?.hasStyles() && scopedStyle && !options.onWebLocalStyleRules) {
|
|
486
492
|
const separator = scopedStyle.content.endsWith("\n") ? "" : "\n";
|
|
487
|
-
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules({ native: options.native })}`);
|
|
493
|
+
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules({ native: options.native === true })}`);
|
|
488
494
|
} else if (localStyleCollector?.hasStyles() && !scopedStyle) ms.append(`\n${localStyleCollector.toStyleBlock({
|
|
489
495
|
native: options.native || Boolean(options.onWebLocalStyleRules),
|
|
490
496
|
web: Boolean(options.onWebLocalStyleRules)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_generator = require("./generator-
|
|
2
|
-
const require_compiler = require("./compiler-
|
|
3
|
-
const require_vite = require("./vite-
|
|
1
|
+
const require_generator = require("./generator-Bvr4WmuF.cjs");
|
|
2
|
+
const require_compiler = require("./compiler-C8FqI-P3.cjs");
|
|
3
|
+
const require_vite = require("./vite-DxuKPZlp.cjs");
|
|
4
4
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
5
5
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
6
6
|
let _vue_compiler_dom = require("@vue/compiler-dom");
|
|
@@ -173,9 +173,10 @@ function hasTopLevelVariant(candidate) {
|
|
|
173
173
|
return false;
|
|
174
174
|
}
|
|
175
175
|
var UniAppXComponentLocalStyleCollector = class {
|
|
176
|
-
constructor(fileId, runtimeSet) {
|
|
176
|
+
constructor(fileId, runtimeSet, includeVariants = false) {
|
|
177
177
|
this.fileId = fileId;
|
|
178
178
|
this.runtimeSet = runtimeSet;
|
|
179
|
+
this.includeVariants = includeVariants;
|
|
179
180
|
require_generator._defineProperty(this, "aliasByUtility", /* @__PURE__ */ new Map());
|
|
180
181
|
require_generator._defineProperty(this, "aliasByLookup", /* @__PURE__ */ new Map());
|
|
181
182
|
require_generator._defineProperty(this, "classBindingNames", /* @__PURE__ */ new Set());
|
|
@@ -186,8 +187,9 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
186
187
|
if (cached) return cached;
|
|
187
188
|
const alias = createAlias(this.fileId, utility, this.aliasByUtility.size);
|
|
188
189
|
this.aliasByUtility.set(utility, alias);
|
|
189
|
-
|
|
190
|
-
this.aliasByLookup.set(
|
|
190
|
+
const replacement = hasTopLevelVariant(utility) ? `${require_compiler.replaceWxml(utility)} ${alias}` : alias;
|
|
191
|
+
this.aliasByLookup.set(utility, replacement);
|
|
192
|
+
this.aliasByLookup.set(require_compiler.replaceWxml(utility), replacement);
|
|
191
193
|
return alias;
|
|
192
194
|
}
|
|
193
195
|
rewriteLiteral(literal) {
|
|
@@ -196,7 +198,11 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
196
198
|
let rewritten = literal;
|
|
197
199
|
for (const candidate of candidates) {
|
|
198
200
|
if (!isRuntimeCandidate(candidate, this.runtimeSet)) continue;
|
|
199
|
-
rewritten = rewritten.replace(candidate,
|
|
201
|
+
if (!this.includeVariants && hasTopLevelVariant(candidate)) rewritten = rewritten.replace(candidate, require_compiler.replaceWxml(candidate));
|
|
202
|
+
else {
|
|
203
|
+
this.ensureAlias(candidate);
|
|
204
|
+
rewritten = rewritten.replace(candidate, this.aliasByLookup.get(candidate));
|
|
205
|
+
}
|
|
200
206
|
}
|
|
201
207
|
return rewritten;
|
|
202
208
|
}
|
|
@@ -223,7 +229,7 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
223
229
|
const classContext = options.wrapExpression || require_compiler.isClassContextLiteralPath(path) || isClassBindingLiteralPath(path, classBindingRoots);
|
|
224
230
|
for (const candidate of candidates) {
|
|
225
231
|
if (!candidate || !classContext || !isRuntimeCandidate(candidate, this.runtimeSet)) continue;
|
|
226
|
-
if (!hasTopLevelVariant(candidate)) {
|
|
232
|
+
if (this.includeVariants || !hasTopLevelVariant(candidate)) {
|
|
227
233
|
this.ensureAlias(candidate);
|
|
228
234
|
if (options.deep) this.deepUtilities.add(candidate);
|
|
229
235
|
}
|
|
@@ -445,7 +451,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
445
451
|
const normalized = (0, _weapp_tailwindcss_postcss.normalizeUniAppXImportantApplyForSass)(style.content);
|
|
446
452
|
if (normalized !== style.content) ms.update(style.start, style.end, normalized);
|
|
447
453
|
}
|
|
448
|
-
const localStyleCollector = shouldEnableLocalStyle(id, options) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet) : void 0;
|
|
454
|
+
const localStyleCollector = shouldEnableLocalStyle(id, options) ? new UniAppXComponentLocalStyleCollector(id, runtimeSet, options.localStyleVariants) : void 0;
|
|
449
455
|
if (descriptor.errors.length === 0) {
|
|
450
456
|
if (descriptor.template?.ast) {
|
|
451
457
|
const templateOffset = descriptor.template.start;
|
|
@@ -479,11 +485,11 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
479
485
|
const { code } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
480
486
|
ms.update(descriptor.scriptSetup.start, descriptor.scriptSetup.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
481
487
|
}
|
|
482
|
-
const scopedStyle = descriptor.styles.
|
|
488
|
+
const scopedStyle = [...descriptor.styles].reverse().find((style) => STYLE_SCOPED_RE.test(style.attrs) && (!options.onWebLocalStyleRules || !(0, _weapp_tailwindcss_postcss.isUniAppXStyleSourceEmpty)(style.content)));
|
|
483
489
|
if (localStyleCollector && options.onWebLocalStyleRules && descriptor.template) options.onWebLocalStyleRules(localStyleCollector.hasStyles() ? localStyleCollector.toStyleRules({ web: true }) : "");
|
|
484
490
|
if (localStyleCollector?.hasStyles() && scopedStyle && !options.onWebLocalStyleRules) {
|
|
485
491
|
const separator = scopedStyle.content.endsWith("\n") ? "" : "\n";
|
|
486
|
-
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules({ native: options.native })}`);
|
|
492
|
+
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules({ native: options.native === true })}`);
|
|
487
493
|
} else if (localStyleCollector?.hasStyles() && !scopedStyle) ms.append(`\n${localStyleCollector.toStyleBlock({
|
|
488
494
|
native: options.native || Boolean(options.onWebLocalStyleRules),
|
|
489
495
|
web: Boolean(options.onWebLocalStyleRules)
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ParseError, ParserOptions } from '@babel/parser';
|
|
2
|
-
import type { CssPreflightOptions,
|
|
2
|
+
import type { CssPreflightOptions, IStyleHandlerOptions, StyleHandler } from '@weapp-tailwindcss/postcss';
|
|
3
3
|
import type { SourceMap } from 'magic-string';
|
|
4
4
|
import type { ICreateCacheReturnType } from '../cache/index.js';
|
|
5
5
|
import type { ItemOrItemArray } from './base.js';
|
|
@@ -83,9 +83,10 @@ export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
|
|
|
83
83
|
filename?: string | undefined;
|
|
84
84
|
}
|
|
85
85
|
export interface InternalUserDefinedOptions extends InternalUserDefinedOptionsBase {
|
|
86
|
+
customAttributesEntities: ICustomAttributesEntities;
|
|
86
87
|
supportCustomLengthUnits: LengthUnitsRuntimeOptions | boolean;
|
|
87
88
|
templateHandler: (rawSource: string, options?: ITemplateHandlerOptions) => Promise<string>;
|
|
88
|
-
styleHandler:
|
|
89
|
+
styleHandler: StyleHandler;
|
|
89
90
|
jsHandler: JsHandler;
|
|
90
91
|
escapeMap: Record<string, string>;
|
|
91
92
|
customReplaceDictionary: Record<string, string>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import type { ElementNode } from '@vue/compiler-dom';
|
|
2
2
|
import type MagicString from 'magic-string';
|
|
3
3
|
import type { CssPreflightOptions } from '../types/index.js';
|
|
4
|
+
export { createUniAppXBorderPreflight, hoistUniAppXBorderPreflight, } from '@weapp-tailwindcss/postcss';
|
|
4
5
|
export declare const BORDER_PREFLIGHT_CLASS = "weapp-tw-border";
|
|
5
|
-
export declare function hoistUniAppXBorderPreflight(css: string): string;
|
|
6
|
-
export declare function createUniAppXBorderPreflight(options?: CssPreflightOptions): string | undefined;
|
|
7
6
|
export declare function resolveUniAppXBorderPreflightOptions(options: {
|
|
8
7
|
cssPreflight?: CssPreflightOptions;
|
|
9
8
|
cssPreflightRange?: 'all';
|
|
@@ -6,11 +6,12 @@ export declare function hasTopLevelVariant(candidate: string): boolean;
|
|
|
6
6
|
export declare class UniAppXComponentLocalStyleCollector {
|
|
7
7
|
private readonly fileId;
|
|
8
8
|
private readonly runtimeSet?;
|
|
9
|
+
private readonly includeVariants;
|
|
9
10
|
private aliasByUtility;
|
|
10
11
|
private aliasByLookup;
|
|
11
12
|
private classBindingNames;
|
|
12
13
|
private deepUtilities;
|
|
13
|
-
constructor(fileId: string, runtimeSet?: Set<string> | undefined);
|
|
14
|
+
constructor(fileId: string, runtimeSet?: Set<string> | undefined, includeVariants?: boolean);
|
|
14
15
|
private ensureAlias;
|
|
15
16
|
private rewriteLiteral;
|
|
16
17
|
collectAndRewriteStaticClass(literal: string, options?: RewriteCodeOptions): string;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SourceDescription } from 'rollup';
|
|
2
2
|
import type { ICustomAttributesEntities, JsHandler } from '../types/index.js';
|
|
3
|
+
type UniAppXTransformResult = Pick<SourceDescription, 'code' | 'map'>;
|
|
3
4
|
interface TransformUVueOptions {
|
|
4
5
|
componentMatcher?: (id: string) => boolean;
|
|
5
6
|
customAttributesEntities?: ICustomAttributesEntities;
|
|
@@ -8,10 +9,11 @@ interface TransformUVueOptions {
|
|
|
8
9
|
enablePageLocalStyle?: boolean;
|
|
9
10
|
pageMatcher?: (id: string) => boolean;
|
|
10
11
|
native?: boolean;
|
|
12
|
+
localStyleVariants?: boolean;
|
|
11
13
|
borderPreflight?: string;
|
|
12
14
|
borderPreflightRange?: 'all';
|
|
13
15
|
webCustomAttributeDeep?: boolean;
|
|
14
16
|
onWebLocalStyleRules?: (rules: string) => void;
|
|
15
17
|
}
|
|
16
|
-
export declare function transformUVue(code: string, id: string, jsHandler: JsHandler, runtimeSet?: Set<string>, options?: TransformUVueOptions): undefined |
|
|
18
|
+
export declare function transformUVue(code: string, id: string, jsHandler: JsHandler, runtimeSet?: Set<string>, options?: TransformUVueOptions): undefined | UniAppXTransformResult;
|
|
17
19
|
export {};
|
|
@@ -3,7 +3,7 @@ interface CreateUniAppXNativeHmrReloaderOptions {
|
|
|
3
3
|
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
4
4
|
isNativeAppBuildTarget: (id?: string) => boolean;
|
|
5
5
|
localStyleModuleIds: Iterable<string>;
|
|
6
|
-
syncSourceCandidates?: (ctx: HmrContext) => Promise<void
|
|
6
|
+
syncSourceCandidates?: ((ctx: HmrContext) => Promise<void>) | undefined;
|
|
7
7
|
tailwindRootCssModuleIds: Iterable<string>;
|
|
8
8
|
viteProcessedCssSourceFiles: Iterable<string>;
|
|
9
9
|
}
|