weapp-tailwindcss 5.0.0-next.9 → 5.0.0
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/README.md +2 -2
- package/dist/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/bundle-state-CnaJxkFY.mjs +413 -0
- package/dist/bundle-state-DgGEhk_z.js +529 -0
- package/dist/bundlers/shared/cache.d.ts +9 -7
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
- package/dist/bundlers/shared/css-imports.d.ts +3 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +11 -3
- package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +6 -2
- package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
- package/dist/bundlers/shared/style-requests.d.ts +2 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
- package/dist/bundlers/vite/index.d.ts +5 -2
- package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/bundlers/vite/source-candidates.d.ts +24 -2
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
- package/dist/cli/context.d.ts +1 -11
- package/dist/cli/doctor/types.d.ts +11 -11
- package/dist/cli/vscode-entry.d.ts +3 -3
- package/dist/cli.js +684 -41
- package/dist/cli.mjs +682 -40
- package/dist/context/runtime-package-replacements.d.ts +2 -0
- package/dist/context/style-options.d.ts +3 -0
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +1 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +11 -0
- package/dist/css-macro/constants.d.ts +5 -2
- package/dist/css-macro/postcss.d.ts +1 -0
- package/dist/css-macro/postcss.js +7 -46
- package/dist/css-macro/postcss.mjs +2 -46
- package/dist/css-macro.js +16 -7
- package/dist/css-macro.mjs +15 -6
- package/dist/defaults-8xrgzxFY.mjs +151 -0
- package/dist/defaults-zKUH2mDe.js +193 -0
- package/dist/defaults.js +6 -150
- package/dist/defaults.mjs +1 -143
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/options.d.ts +11 -6
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator--0-ekuVO.js +92 -0
- package/dist/generator-B76ovqsv.mjs +67 -0
- package/dist/generator.js +12 -12
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +163 -40
- package/dist/gulp.mjs +155 -32
- package/dist/incremental-runtime-class-set-CN6K_97P.js +2366 -0
- package/dist/incremental-runtime-class-set-x10M9bn_.mjs +2291 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -5
- package/dist/index.mjs +6 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/precheck.d.ts +2 -2
- package/dist/js/replacement-cache.d.ts +5 -0
- package/dist/postcss-C7BMYpEF.mjs +169 -0
- package/dist/{postcss-w48mGIhe.mjs → postcss-CR9UCaIK.mjs} +54 -114
- package/dist/postcss-CiYLsqZn.js +192 -0
- package/dist/{postcss-QIXwT40c.js → postcss-hYimKoN_.js} +60 -121
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/precheck-BrNwLG2e.mjs +4716 -0
- package/dist/precheck-DPtJjZmV.js +4842 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +27 -13
- package/dist/presets.mjs +25 -13
- package/dist/reset.js +1 -1
- package/dist/runtime-registry-DpcR3IHI.js +5496 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-DN1mihlU.mjs +322 -0
- package/dist/source-candidates-DSxme_O2.js +335 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -5
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/tailwindcss/runtime/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime.d.ts +9 -9
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/patcher.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
- package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-DWtPieNE.mjs} +72 -60
- package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-glCm_d3H.js} +81 -69
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +51 -41
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
- package/dist/types/user-defined-options/general.d.ts +25 -22
- package/dist/types/user-defined-options/important.d.ts +32 -27
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/unocss/index.d.ts +2 -0
- package/dist/utils/object.d.ts +9 -0
- package/dist/utils/options.d.ts +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
- package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
- package/dist/v3-engine-D3BMLVAN.js +3712 -0
- package/dist/v3-engine-DCxNPBVs.mjs +3417 -0
- package/dist/vite-DOprpdH-.mjs +24493 -0
- package/dist/vite-Ec0uX6kF.js +24507 -0
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5444 -22
- package/dist/weapp-tw-runtime-classset-loader.js +32 -9
- package/dist/{webpack-BzN2ly34.js → webpack-Ccohlg3A.js} +341 -96
- package/dist/{webpack-DJazm5sT.mjs → webpack-DFlZcqAU.mjs} +323 -79
- package/dist/webpack.d.ts +1 -3
- package/dist/webpack.js +3 -4
- package/dist/webpack.mjs +2 -2
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
- package/package.json +22 -20
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
- package/dist/cache-BVAiJV3J.js +0 -502
- package/dist/cache-CHs4DXui.mjs +0 -434
- package/dist/constants-BoB_6lFw.js +0 -73
- package/dist/constants-E_loJC49.mjs +0 -44
- package/dist/generator-DKkhJbOg.js +0 -1531
- package/dist/generator-UBmfduYg.mjs +0 -1432
- package/dist/generator-css-Bwp3nbrl.js +0 -1381
- package/dist/generator-css-DeLLmp2N.mjs +0 -1342
- package/dist/lightningcss/index.d.ts +0 -8
- package/dist/lightningcss/style-handler/options.d.ts +0 -3
- package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
- package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
- package/dist/lightningcss/style-handler.d.ts +0 -17
- package/dist/precheck-B32p-gLI.js +0 -2736
- package/dist/precheck-B4RH6ZNN.mjs +0 -2622
- package/dist/run-tasks-B50A3pxt.js +0 -128
- package/dist/run-tasks-DdNi-hkk.mjs +0 -91
- package/dist/runtime-patch-CwN5ya72.mjs +0 -71
- package/dist/runtime-patch-D6mBo_KB.js +0 -85
- package/dist/vite-By5KQi9s.js +0 -2419
- package/dist/vite-Cyp42bBf.mjs +0 -2406
- /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
- /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { InternalUserDefinedOptions } from '../types';
|
|
2
2
|
import { resolveTailwindcssBasedir } from './tailwindcss/basedir';
|
|
3
|
-
export declare function createTailwindcssPatcherFromContext(ctx: InternalUserDefinedOptions): import("@/types").TailwindcssPatcherLike
|
|
3
|
+
export declare function createTailwindcssPatcherFromContext(ctx: InternalUserDefinedOptions): import("@/types").TailwindcssPatcherLike;
|
|
4
4
|
export { resolveTailwindcssBasedir };
|
package/dist/core.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
require("./
|
|
3
|
-
const require_precheck = require("./precheck-B32p-gLI.js");
|
|
2
|
+
const require_precheck = require("./precheck-DPtJjZmV.js");
|
|
4
3
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
5
4
|
//#region src/core.ts
|
|
6
5
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as ensureRuntimeClassSet, n as getCompilerContext, t as shouldSkipJsTransform, y as createTailwindRuntimeReadyPromise } from "./precheck-BrNwLG2e.mjs";
|
|
2
2
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
3
3
|
//#region src/core.ts
|
|
4
4
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
export declare const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
|
|
3
|
+
export declare const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
4
|
+
export declare function compileCssMacroConditionalComments(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): string;
|
|
5
|
+
export declare function markCssMacroPlugin<T extends object>(value: T): T;
|
|
6
|
+
export declare function isCssMacroTailwindPlugin(value: unknown): boolean;
|
|
7
|
+
export declare function hasCssMacroTailwindPlugin(plugins: unknown): boolean;
|
|
8
|
+
export declare function hasCssMacroTailwindV4Directive(css: string | undefined): boolean;
|
|
9
|
+
export declare function withCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): Partial<IStyleHandlerOptions>;
|
|
10
|
+
export declare function hasCssMacroStyleOptions(options: Partial<IStyleHandlerOptions> | undefined): boolean;
|
|
11
|
+
export declare function transformCssMacroCss(css: string, options?: Pick<IStyleHandlerOptions, 'platform'>): Promise<string>;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export declare const uniAppPlatform: string[];
|
|
2
2
|
export declare const queryKey = "weapp-tw-platform";
|
|
3
|
-
export declare
|
|
4
|
-
export declare
|
|
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;
|
|
5
7
|
export declare function normalComment(text: string): string;
|
|
6
8
|
export declare function ifdef(text: string): {
|
|
7
9
|
start: string;
|
|
@@ -12,3 +14,4 @@ export declare function ifndef(text: string): {
|
|
|
12
14
|
end: string;
|
|
13
15
|
};
|
|
14
16
|
export declare function matchCustomPropertyFromValue(str: string, cb: (arr: RegExpExecArray, index: number) => void): void;
|
|
17
|
+
export declare function parseConditionalAtRuleParam(params: string): string;
|
|
@@ -1,46 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return {
|
|
9
|
-
AtRule(atRule, helper) {
|
|
10
|
-
if (atRule.name === "media") {
|
|
11
|
-
const values = [];
|
|
12
|
-
require_constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
13
|
-
values.push(arr[1]);
|
|
14
|
-
});
|
|
15
|
-
if (values.length > 0) {
|
|
16
|
-
const isNegative = atRule.params.includes("not");
|
|
17
|
-
const text = values.join(" ");
|
|
18
|
-
const comment = isNegative ? require_constants.ifndef(text) : require_constants.ifdef(text);
|
|
19
|
-
const nextNodes = [
|
|
20
|
-
helper.comment({
|
|
21
|
-
raws: { before: "\n" },
|
|
22
|
-
text: comment.start
|
|
23
|
-
}),
|
|
24
|
-
...(atRule.nodes ?? []).map((node) => node.clone()),
|
|
25
|
-
helper.comment({
|
|
26
|
-
raws: { before: "\n" },
|
|
27
|
-
text: comment.end
|
|
28
|
-
})
|
|
29
|
-
];
|
|
30
|
-
atRule.replaceWith(nextNodes);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
CommentExit(comment) {
|
|
35
|
-
if (IFDEF_ENDIF_RE.test(comment.text)) {
|
|
36
|
-
comment.raws.left = " ";
|
|
37
|
-
comment.raws.right = " ";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
creator.postcss = true;
|
|
45
|
-
//#endregion
|
|
46
|
-
module.exports = creator;
|
|
1
|
+
Object.defineProperties(exports, {
|
|
2
|
+
__esModule: { value: true },
|
|
3
|
+
[Symbol.toStringTag]: { value: "Module" }
|
|
4
|
+
});
|
|
5
|
+
const require_postcss = require("../postcss-CiYLsqZn.js");
|
|
6
|
+
exports.CSS_MACRO_POSTCSS_PLUGIN_NAME = require_postcss.CSS_MACRO_POSTCSS_PLUGIN_NAME;
|
|
7
|
+
exports.default = require_postcss.creator;
|
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
|
|
4
|
-
const creator = () => {
|
|
5
|
-
return {
|
|
6
|
-
postcssPlugin: "postcss-weapp-tw-css-macro-plugin",
|
|
7
|
-
prepare() {
|
|
8
|
-
return {
|
|
9
|
-
AtRule(atRule, helper) {
|
|
10
|
-
if (atRule.name === "media") {
|
|
11
|
-
const values = [];
|
|
12
|
-
matchCustomPropertyFromValue(atRule.params, (arr) => {
|
|
13
|
-
values.push(arr[1]);
|
|
14
|
-
});
|
|
15
|
-
if (values.length > 0) {
|
|
16
|
-
const isNegative = atRule.params.includes("not");
|
|
17
|
-
const text = values.join(" ");
|
|
18
|
-
const comment = isNegative ? ifndef(text) : ifdef(text);
|
|
19
|
-
const nextNodes = [
|
|
20
|
-
helper.comment({
|
|
21
|
-
raws: { before: "\n" },
|
|
22
|
-
text: comment.start
|
|
23
|
-
}),
|
|
24
|
-
...(atRule.nodes ?? []).map((node) => node.clone()),
|
|
25
|
-
helper.comment({
|
|
26
|
-
raws: { before: "\n" },
|
|
27
|
-
text: comment.end
|
|
28
|
-
})
|
|
29
|
-
];
|
|
30
|
-
atRule.replaceWith(nextNodes);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
CommentExit(comment) {
|
|
35
|
-
if (IFDEF_ENDIF_RE.test(comment.text)) {
|
|
36
|
-
comment.raws.left = " ";
|
|
37
|
-
comment.raws.right = " ";
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
creator.postcss = true;
|
|
45
|
-
//#endregion
|
|
46
|
-
export { creator as default };
|
|
1
|
+
import { n as creator, t as CSS_MACRO_POSTCSS_PLUGIN_NAME } from "../postcss-C7BMYpEF.mjs";
|
|
2
|
+
export { CSS_MACRO_POSTCSS_PLUGIN_NAME, creator as default };
|
package/dist/css-macro.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
require("./
|
|
3
|
-
const
|
|
1
|
+
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
+
const require_postcss = require("./postcss-CiYLsqZn.js");
|
|
3
|
+
const require_auto = require("./auto-dPpsm6FB.js");
|
|
4
|
+
require("./utils-D7Ygohep.js");
|
|
4
5
|
let tailwindcss_plugin = require("tailwindcss/plugin");
|
|
5
6
|
tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
|
|
6
7
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
@@ -9,7 +10,7 @@ const defaultOptions = {
|
|
|
9
10
|
dynamic: true,
|
|
10
11
|
variantsMap: {}
|
|
11
12
|
};
|
|
12
|
-
const
|
|
13
|
+
const cssMacroFactory = tailwindcss_plugin.default.withOptions((options) => {
|
|
13
14
|
const { dynamic, variantsMap } = (0, _weapp_tailwindcss_shared.defu)(options ?? {}, defaultOptions);
|
|
14
15
|
const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
|
|
15
16
|
if (typeof config === "string") return {
|
|
@@ -26,14 +27,22 @@ const cssMacro = tailwindcss_plugin.default.withOptions((options) => {
|
|
|
26
27
|
return (api) => {
|
|
27
28
|
const { matchVariant, addVariant } = api;
|
|
28
29
|
if (dynamic && typeof matchVariant === "function") {
|
|
29
|
-
matchVariant("ifdef", (value) =>
|
|
30
|
-
matchVariant("ifndef", (value) =>
|
|
30
|
+
matchVariant("ifdef", (value) => require_postcss.createConditionalAtRule(value));
|
|
31
|
+
matchVariant("ifndef", (value) => require_postcss.createNegativeConditionalAtRule(value));
|
|
31
32
|
}
|
|
32
33
|
if (typeof addVariant === "function") for (const variant of staticVariants) {
|
|
33
|
-
const query = variant.negative ?
|
|
34
|
+
const query = variant.negative ? require_postcss.createNegativeConditionalAtRule(variant.value) : require_postcss.createConditionalAtRule(variant.value);
|
|
34
35
|
addVariant(variant.name, query);
|
|
35
36
|
}
|
|
36
37
|
};
|
|
37
38
|
});
|
|
39
|
+
const cssMacro = require_auto.markCssMacroPlugin(((options) => {
|
|
40
|
+
return require_auto.markCssMacroPlugin(cssMacroFactory(options));
|
|
41
|
+
}));
|
|
42
|
+
const cssMacroOptionsFunction = cssMacro;
|
|
43
|
+
const cssMacroFactoryOptionsFunction = cssMacroFactory;
|
|
44
|
+
cssMacroOptionsFunction.__isOptionsFunction = cssMacroFactoryOptionsFunction.__isOptionsFunction;
|
|
45
|
+
cssMacroOptionsFunction.__pluginFunction = cssMacroFactoryOptionsFunction.__pluginFunction;
|
|
46
|
+
cssMacroOptionsFunction.__configFunction = cssMacroFactoryOptionsFunction.__configFunction;
|
|
38
47
|
//#endregion
|
|
39
48
|
module.exports = cssMacro;
|
package/dist/css-macro.mjs
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as createNegativeConditionalAtRule, r as createConditionalAtRule } from "./postcss-C7BMYpEF.mjs";
|
|
2
|
+
import { i as markCssMacroPlugin } from "./auto-DEHRmEAx.mjs";
|
|
3
|
+
import { t as defu } from "./utils-DsaS975I.mjs";
|
|
3
4
|
import plugin from "tailwindcss/plugin";
|
|
4
5
|
//#region src/css-macro/index.ts
|
|
5
6
|
const defaultOptions = {
|
|
6
7
|
dynamic: true,
|
|
7
8
|
variantsMap: {}
|
|
8
9
|
};
|
|
9
|
-
const
|
|
10
|
+
const cssMacroFactory = plugin.withOptions((options) => {
|
|
10
11
|
const { dynamic, variantsMap } = defu(options ?? {}, defaultOptions);
|
|
11
12
|
const staticVariants = Object.entries(variantsMap).map(([name, config]) => {
|
|
12
13
|
if (typeof config === "string") return {
|
|
@@ -23,14 +24,22 @@ const cssMacro = plugin.withOptions((options) => {
|
|
|
23
24
|
return (api) => {
|
|
24
25
|
const { matchVariant, addVariant } = api;
|
|
25
26
|
if (dynamic && typeof matchVariant === "function") {
|
|
26
|
-
matchVariant("ifdef", (value) =>
|
|
27
|
-
matchVariant("ifndef", (value) =>
|
|
27
|
+
matchVariant("ifdef", (value) => createConditionalAtRule(value));
|
|
28
|
+
matchVariant("ifndef", (value) => createNegativeConditionalAtRule(value));
|
|
28
29
|
}
|
|
29
30
|
if (typeof addVariant === "function") for (const variant of staticVariants) {
|
|
30
|
-
const query = variant.negative ?
|
|
31
|
+
const query = variant.negative ? createNegativeConditionalAtRule(variant.value) : createConditionalAtRule(variant.value);
|
|
31
32
|
addVariant(variant.name, query);
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
});
|
|
36
|
+
const cssMacro = markCssMacroPlugin(((options) => {
|
|
37
|
+
return markCssMacroPlugin(cssMacroFactory(options));
|
|
38
|
+
}));
|
|
39
|
+
const cssMacroOptionsFunction = cssMacro;
|
|
40
|
+
const cssMacroFactoryOptionsFunction = cssMacroFactory;
|
|
41
|
+
cssMacroOptionsFunction.__isOptionsFunction = cssMacroFactoryOptionsFunction.__isOptionsFunction;
|
|
42
|
+
cssMacroOptionsFunction.__pluginFunction = cssMacroFactoryOptionsFunction.__pluginFunction;
|
|
43
|
+
cssMacroOptionsFunction.__configFunction = cssMacroFactoryOptionsFunction.__configFunction;
|
|
35
44
|
//#endregion
|
|
36
45
|
export { cssMacro as default };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { a as noop } from "./utils-DsaS975I.mjs";
|
|
2
|
+
import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
|
|
3
|
+
//#region src/js/babel/cache-options.ts
|
|
4
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
5
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
6
|
+
//#endregion
|
|
7
|
+
//#region src/defaults.ts
|
|
8
|
+
const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
9
|
+
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
10
|
+
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
11
|
+
const BACKSLASH_RE = /\\/g;
|
|
12
|
+
function normalizePath(p) {
|
|
13
|
+
return p.replace(BACKSLASH_RE, "/");
|
|
14
|
+
}
|
|
15
|
+
const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
|
|
16
|
+
const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
|
|
17
|
+
const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
|
|
18
|
+
const MAIN_CSS_CHUNK_MATCHERS = {
|
|
19
|
+
"uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
|
|
20
|
+
"uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
21
|
+
"uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
22
|
+
"mpx": (file) => {
|
|
23
|
+
const normalized = normalizePath(file);
|
|
24
|
+
if (normalized.startsWith("app")) return true;
|
|
25
|
+
return MPX_STYLES_DIR_PATTERN.test(normalized);
|
|
26
|
+
},
|
|
27
|
+
"taro": (file) => file.startsWith("app"),
|
|
28
|
+
"remax": (file) => file.startsWith("app"),
|
|
29
|
+
"rax": (file) => file.startsWith("bundle"),
|
|
30
|
+
"native": (file) => file.startsWith("app"),
|
|
31
|
+
"weapp-vite": (file) => file.startsWith("app"),
|
|
32
|
+
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
33
|
+
};
|
|
34
|
+
const alwaysFalse = () => false;
|
|
35
|
+
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
36
|
+
"box-sizing": "border-box",
|
|
37
|
+
"border-width": "0",
|
|
38
|
+
"border-style": "solid",
|
|
39
|
+
"border-color": "currentColor"
|
|
40
|
+
};
|
|
41
|
+
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
42
|
+
"box-sizing": "border-box",
|
|
43
|
+
"margin": "0",
|
|
44
|
+
"padding": "0",
|
|
45
|
+
"border": "0 solid"
|
|
46
|
+
};
|
|
47
|
+
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
48
|
+
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
49
|
+
}
|
|
50
|
+
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
51
|
+
if (cssPreflight === false) return false;
|
|
52
|
+
return {
|
|
53
|
+
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
54
|
+
...cssPreflight ?? {}
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function createMainCssChunkMatcher() {
|
|
58
|
+
return (file, appType) => {
|
|
59
|
+
if (!appType) {
|
|
60
|
+
const normalized = normalizePath(file);
|
|
61
|
+
return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
|
|
62
|
+
}
|
|
63
|
+
const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
|
|
64
|
+
return matcher ? matcher(file) : true;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function getDefaultOptions() {
|
|
68
|
+
return {
|
|
69
|
+
/**
|
|
70
|
+
* wxss 微信小程序
|
|
71
|
+
* acss 支付宝小程序
|
|
72
|
+
* jxss 京东小程序
|
|
73
|
+
* ttss 头条小程序
|
|
74
|
+
* qss QQ小程序
|
|
75
|
+
* css 最正常的样式文件
|
|
76
|
+
* tyss 涂鸦小程序
|
|
77
|
+
*/
|
|
78
|
+
cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
|
|
79
|
+
/**
|
|
80
|
+
* wxml 微信小程序
|
|
81
|
+
* axml 支付宝小程序
|
|
82
|
+
* jxml 京东小程序
|
|
83
|
+
* ksml 快手小程序
|
|
84
|
+
* ttml 头条小程序
|
|
85
|
+
* qml QQ小程序
|
|
86
|
+
* tyml 涂鸦小程序
|
|
87
|
+
* xhsml 小红书小程序
|
|
88
|
+
* swan 百度小程序
|
|
89
|
+
*/
|
|
90
|
+
htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
|
|
91
|
+
jsMatcher: (file) => {
|
|
92
|
+
if (file.includes("node_modules")) return false;
|
|
93
|
+
return JS_FILE_PATTERN.test(file);
|
|
94
|
+
},
|
|
95
|
+
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
96
|
+
wxsMatcher: alwaysFalse,
|
|
97
|
+
cssPreflight: getDefaultCssPreflight(3),
|
|
98
|
+
disabled: false,
|
|
99
|
+
onLoad: noop,
|
|
100
|
+
onStart: noop,
|
|
101
|
+
onEnd: noop,
|
|
102
|
+
onUpdate: noop,
|
|
103
|
+
customAttributes: {},
|
|
104
|
+
customReplaceDictionary: MappingChars2String,
|
|
105
|
+
appType: void 0,
|
|
106
|
+
arbitraryValues: {
|
|
107
|
+
allowDoubleQuotes: false,
|
|
108
|
+
bareArbitraryValues: false
|
|
109
|
+
},
|
|
110
|
+
unocss: false,
|
|
111
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
112
|
+
inlineWxs: false,
|
|
113
|
+
injectAdditionalCssVarScope: false,
|
|
114
|
+
jsPreserveClass: (keyword) => {
|
|
115
|
+
/**
|
|
116
|
+
* 默认保留 keyword
|
|
117
|
+
*/
|
|
118
|
+
if (keyword === "*") return true;
|
|
119
|
+
return false;
|
|
120
|
+
},
|
|
121
|
+
disabledDefaultTemplateHandler: false,
|
|
122
|
+
cssSelectorReplacement: {
|
|
123
|
+
root: [
|
|
124
|
+
"page",
|
|
125
|
+
".tw-root",
|
|
126
|
+
"wx-root-portal-content"
|
|
127
|
+
],
|
|
128
|
+
universal: ["view", "text"]
|
|
129
|
+
},
|
|
130
|
+
babelParserOptions: {
|
|
131
|
+
sourceType: "unambiguous",
|
|
132
|
+
cache: true,
|
|
133
|
+
cacheKey: "st:unambiguous",
|
|
134
|
+
cacheMaxEntries: 128,
|
|
135
|
+
cacheMaxSourceLength: DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH
|
|
136
|
+
},
|
|
137
|
+
postcssOptions: {},
|
|
138
|
+
cssRemoveProperty: true,
|
|
139
|
+
cssRemoveHoverPseudoClass: true,
|
|
140
|
+
ignoreCallExpressionIdentifiers: [],
|
|
141
|
+
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
142
|
+
replaceRuntimePackages: false,
|
|
143
|
+
generator: {},
|
|
144
|
+
tailwindcssPatcherOptions: { filter(className) {
|
|
145
|
+
return !isAllowedClassName(className);
|
|
146
|
+
} },
|
|
147
|
+
logLevel: "info"
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
//#endregion
|
|
151
|
+
export { resolveDefaultCssPreflight as a, getDefaultOptions as i, TAILWIND_V4_CSS_PREFLIGHT as n, DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH as o, getDefaultCssPreflight as r, HARD_PARSE_CACHE_MAX_ENTRIES as s, TAILWIND_V3_CSS_PREFLIGHT as t };
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
require("./utils-D7Ygohep.js");
|
|
2
|
+
let _weapp_core_escape = require("@weapp-core/escape");
|
|
3
|
+
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
4
|
+
//#region src/js/babel/cache-options.ts
|
|
5
|
+
const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
|
|
6
|
+
const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/defaults.ts
|
|
9
|
+
const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
10
|
+
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
11
|
+
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
12
|
+
const BACKSLASH_RE = /\\/g;
|
|
13
|
+
function normalizePath(p) {
|
|
14
|
+
return p.replace(BACKSLASH_RE, "/");
|
|
15
|
+
}
|
|
16
|
+
const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
|
|
17
|
+
const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
|
|
18
|
+
const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
|
|
19
|
+
const MAIN_CSS_CHUNK_MATCHERS = {
|
|
20
|
+
"uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
|
|
21
|
+
"uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
22
|
+
"uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
23
|
+
"mpx": (file) => {
|
|
24
|
+
const normalized = normalizePath(file);
|
|
25
|
+
if (normalized.startsWith("app")) return true;
|
|
26
|
+
return MPX_STYLES_DIR_PATTERN.test(normalized);
|
|
27
|
+
},
|
|
28
|
+
"taro": (file) => file.startsWith("app"),
|
|
29
|
+
"remax": (file) => file.startsWith("app"),
|
|
30
|
+
"rax": (file) => file.startsWith("bundle"),
|
|
31
|
+
"native": (file) => file.startsWith("app"),
|
|
32
|
+
"weapp-vite": (file) => file.startsWith("app"),
|
|
33
|
+
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
34
|
+
};
|
|
35
|
+
const alwaysFalse = () => false;
|
|
36
|
+
const TAILWIND_V3_CSS_PREFLIGHT = {
|
|
37
|
+
"box-sizing": "border-box",
|
|
38
|
+
"border-width": "0",
|
|
39
|
+
"border-style": "solid",
|
|
40
|
+
"border-color": "currentColor"
|
|
41
|
+
};
|
|
42
|
+
const TAILWIND_V4_CSS_PREFLIGHT = {
|
|
43
|
+
"box-sizing": "border-box",
|
|
44
|
+
"margin": "0",
|
|
45
|
+
"padding": "0",
|
|
46
|
+
"border": "0 solid"
|
|
47
|
+
};
|
|
48
|
+
function getDefaultCssPreflight(tailwindcssMajorVersion) {
|
|
49
|
+
return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
|
|
50
|
+
}
|
|
51
|
+
function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
|
|
52
|
+
if (cssPreflight === false) return false;
|
|
53
|
+
return {
|
|
54
|
+
...getDefaultCssPreflight(tailwindcssMajorVersion),
|
|
55
|
+
...cssPreflight ?? {}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
function createMainCssChunkMatcher() {
|
|
59
|
+
return (file, appType) => {
|
|
60
|
+
if (!appType) {
|
|
61
|
+
const normalized = normalizePath(file);
|
|
62
|
+
return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
|
|
63
|
+
}
|
|
64
|
+
const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
|
|
65
|
+
return matcher ? matcher(file) : true;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function getDefaultOptions() {
|
|
69
|
+
return {
|
|
70
|
+
/**
|
|
71
|
+
* wxss 微信小程序
|
|
72
|
+
* acss 支付宝小程序
|
|
73
|
+
* jxss 京东小程序
|
|
74
|
+
* ttss 头条小程序
|
|
75
|
+
* qss QQ小程序
|
|
76
|
+
* css 最正常的样式文件
|
|
77
|
+
* tyss 涂鸦小程序
|
|
78
|
+
*/
|
|
79
|
+
cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
|
|
80
|
+
/**
|
|
81
|
+
* wxml 微信小程序
|
|
82
|
+
* axml 支付宝小程序
|
|
83
|
+
* jxml 京东小程序
|
|
84
|
+
* ksml 快手小程序
|
|
85
|
+
* ttml 头条小程序
|
|
86
|
+
* qml QQ小程序
|
|
87
|
+
* tyml 涂鸦小程序
|
|
88
|
+
* xhsml 小红书小程序
|
|
89
|
+
* swan 百度小程序
|
|
90
|
+
*/
|
|
91
|
+
htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
|
|
92
|
+
jsMatcher: (file) => {
|
|
93
|
+
if (file.includes("node_modules")) return false;
|
|
94
|
+
return JS_FILE_PATTERN.test(file);
|
|
95
|
+
},
|
|
96
|
+
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
97
|
+
wxsMatcher: alwaysFalse,
|
|
98
|
+
cssPreflight: getDefaultCssPreflight(3),
|
|
99
|
+
disabled: false,
|
|
100
|
+
onLoad: _weapp_tailwindcss_shared.noop,
|
|
101
|
+
onStart: _weapp_tailwindcss_shared.noop,
|
|
102
|
+
onEnd: _weapp_tailwindcss_shared.noop,
|
|
103
|
+
onUpdate: _weapp_tailwindcss_shared.noop,
|
|
104
|
+
customAttributes: {},
|
|
105
|
+
customReplaceDictionary: _weapp_core_escape.MappingChars2String,
|
|
106
|
+
appType: void 0,
|
|
107
|
+
arbitraryValues: {
|
|
108
|
+
allowDoubleQuotes: false,
|
|
109
|
+
bareArbitraryValues: false
|
|
110
|
+
},
|
|
111
|
+
unocss: false,
|
|
112
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
113
|
+
inlineWxs: false,
|
|
114
|
+
injectAdditionalCssVarScope: false,
|
|
115
|
+
jsPreserveClass: (keyword) => {
|
|
116
|
+
/**
|
|
117
|
+
* 默认保留 keyword
|
|
118
|
+
*/
|
|
119
|
+
if (keyword === "*") return true;
|
|
120
|
+
return false;
|
|
121
|
+
},
|
|
122
|
+
disabledDefaultTemplateHandler: false,
|
|
123
|
+
cssSelectorReplacement: {
|
|
124
|
+
root: [
|
|
125
|
+
"page",
|
|
126
|
+
".tw-root",
|
|
127
|
+
"wx-root-portal-content"
|
|
128
|
+
],
|
|
129
|
+
universal: ["view", "text"]
|
|
130
|
+
},
|
|
131
|
+
babelParserOptions: {
|
|
132
|
+
sourceType: "unambiguous",
|
|
133
|
+
cache: true,
|
|
134
|
+
cacheKey: "st:unambiguous",
|
|
135
|
+
cacheMaxEntries: 128,
|
|
136
|
+
cacheMaxSourceLength: DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH
|
|
137
|
+
},
|
|
138
|
+
postcssOptions: {},
|
|
139
|
+
cssRemoveProperty: true,
|
|
140
|
+
cssRemoveHoverPseudoClass: true,
|
|
141
|
+
ignoreCallExpressionIdentifiers: [],
|
|
142
|
+
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
143
|
+
replaceRuntimePackages: false,
|
|
144
|
+
generator: {},
|
|
145
|
+
tailwindcssPatcherOptions: { filter(className) {
|
|
146
|
+
return !(0, _weapp_core_escape.isAllowedClassName)(className);
|
|
147
|
+
} },
|
|
148
|
+
logLevel: "info"
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
//#endregion
|
|
152
|
+
Object.defineProperty(exports, "DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH", {
|
|
153
|
+
enumerable: true,
|
|
154
|
+
get: function() {
|
|
155
|
+
return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
Object.defineProperty(exports, "HARD_PARSE_CACHE_MAX_ENTRIES", {
|
|
159
|
+
enumerable: true,
|
|
160
|
+
get: function() {
|
|
161
|
+
return HARD_PARSE_CACHE_MAX_ENTRIES;
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
Object.defineProperty(exports, "TAILWIND_V3_CSS_PREFLIGHT", {
|
|
165
|
+
enumerable: true,
|
|
166
|
+
get: function() {
|
|
167
|
+
return TAILWIND_V3_CSS_PREFLIGHT;
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
Object.defineProperty(exports, "TAILWIND_V4_CSS_PREFLIGHT", {
|
|
171
|
+
enumerable: true,
|
|
172
|
+
get: function() {
|
|
173
|
+
return TAILWIND_V4_CSS_PREFLIGHT;
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
Object.defineProperty(exports, "getDefaultCssPreflight", {
|
|
177
|
+
enumerable: true,
|
|
178
|
+
get: function() {
|
|
179
|
+
return getDefaultCssPreflight;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
Object.defineProperty(exports, "getDefaultOptions", {
|
|
183
|
+
enumerable: true,
|
|
184
|
+
get: function() {
|
|
185
|
+
return getDefaultOptions;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
Object.defineProperty(exports, "resolveDefaultCssPreflight", {
|
|
189
|
+
enumerable: true,
|
|
190
|
+
get: function() {
|
|
191
|
+
return resolveDefaultCssPreflight;
|
|
192
|
+
}
|
|
193
|
+
});
|