weapp-tailwindcss 4.12.0 → 5.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babel/index.d.ts +3 -0
- package/dist/bundlers/gulp/index.d.ts +7 -0
- package/dist/bundlers/shared/cache.d.ts +16 -0
- package/dist/bundlers/shared/css-cleanup.d.ts +4 -0
- package/dist/bundlers/shared/css-imports.d.ts +8 -0
- package/dist/bundlers/shared/generator-candidates.d.ts +5 -0
- package/dist/bundlers/shared/generator-css.d.ts +43 -0
- package/dist/bundlers/shared/module-graph.d.ts +5 -0
- package/dist/bundlers/shared/run-tasks.d.ts +2 -0
- package/dist/bundlers/vite/bundle-entries.d.ts +14 -0
- package/dist/bundlers/vite/bundle-state.d.ts +43 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +22 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +33 -0
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +21 -0
- package/dist/bundlers/vite/index.d.ts +3 -0
- package/dist/bundlers/vite/js-precheck.d.ts +1 -0
- package/dist/bundlers/vite/query.d.ts +15 -0
- package/dist/bundlers/vite/resolve-app-type.d.ts +2 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +11 -0
- package/dist/bundlers/vite/runtime-affecting-signature.d.ts +2 -0
- package/dist/bundlers/vite/source-candidates.d.ts +15 -0
- package/dist/bundlers/vite/utils.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +20 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +14 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +15 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +17 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +19 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +9 -0
- package/dist/bundlers/webpack/index.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +12 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +11 -0
- package/dist/bundlers/webpack/shared/css-imports.d.ts +6 -0
- package/dist/bundlers/webpack/shared/loader-anchors.d.ts +8 -0
- package/dist/cache/index.d.ts +38 -0
- package/dist/cache/md5.d.ts +1 -0
- package/dist/chunk-8l464Juk.js +28 -0
- package/dist/cli/config.d.ts +5 -0
- package/dist/cli/context.d.ts +16 -0
- package/dist/cli/doctor/constants.d.ts +7 -0
- package/dist/cli/doctor/types.d.ts +31 -0
- package/dist/cli/doctor.d.ts +4 -0
- package/dist/cli/helpers/options/format.d.ts +2 -0
- package/dist/cli/helpers/options/parse.d.ts +3 -0
- package/dist/cli/helpers/options/resolve.d.ts +1 -0
- package/dist/cli/helpers/options.d.ts +3 -0
- package/dist/cli/helpers/patch-cwd.d.ts +1 -0
- package/dist/cli/helpers.d.ts +5 -0
- package/dist/cli/mount-options/patch-status.d.ts +2 -0
- package/dist/cli/mount-options.d.ts +2 -0
- package/dist/cli/patch-options.d.ts +6 -0
- package/dist/cli/tokens.d.ts +4 -0
- package/dist/cli/types.d.ts +17 -0
- package/dist/cli/vscode-entry.d.ts +14 -0
- package/dist/cli/workspace/package-dirs.d.ts +3 -0
- package/dist/cli/workspace/patch-package.d.ts +3 -0
- package/dist/cli/workspace/patch-utils.d.ts +3 -0
- package/dist/cli/workspace/types.d.ts +11 -0
- package/dist/cli/workspace/workspace-globs.d.ts +2 -0
- package/dist/cli/workspace/workspace-io.d.ts +1 -0
- package/dist/cli/workspace/workspace-lock.d.ts +1 -0
- package/dist/cli/workspace.d.ts +2 -0
- package/dist/cli.d.ts +1 -2
- package/dist/cli.js +2425 -3524
- package/dist/cli.mjs +2402 -3505
- package/dist/constants-B-_T5UnW.mjs +44 -0
- package/dist/constants-p1dyh1x1.js +73 -0
- package/dist/constants.d.ts +13 -0
- package/dist/context/compiler-context-cache.d.ts +3 -0
- package/dist/context/custom-attributes.d.ts +2 -0
- package/dist/context/handlers.d.ts +6 -0
- package/dist/context/index.d.ts +7 -0
- package/dist/context/logger.d.ts +4 -0
- package/dist/context/tailwindcss/basedir.d.ts +1 -0
- package/dist/context/tailwindcss/rax.d.ts +2 -0
- package/dist/context/tailwindcss.d.ts +4 -0
- package/dist/context/workspace.d.ts +3 -0
- package/dist/core.d.ts +5 -21
- package/dist/core.js +138 -180
- package/dist/core.mjs +135 -180
- package/dist/css-imports-BbrbluP9.js +177 -0
- package/dist/css-imports-CSdPq_Sc.mjs +128 -0
- package/dist/css-macro/constants.d.ts +14 -0
- package/dist/css-macro/index.d.ts +15 -0
- package/dist/css-macro/postcss.d.ts +3 -7
- package/dist/css-macro/postcss.js +44 -58
- package/dist/css-macro/postcss.mjs +44 -56
- package/dist/css-macro.d.ts +1 -20
- package/dist/css-macro.js +37 -50
- package/dist/css-macro.mjs +33 -47
- package/dist/debug/index.d.ts +5 -0
- package/dist/defaults.d.ts +2 -11
- package/dist/defaults.js +132 -8
- package/dist/defaults.mjs +128 -7
- package/dist/escape.js +31 -54
- package/dist/escape.mjs +18 -25
- package/dist/experimental/index.d.ts +2 -0
- package/dist/experimental/oxc/ast-utils.d.ts +30 -0
- package/dist/experimental/oxc/index.d.ts +2 -0
- package/dist/experimental/oxc/module-specifiers.d.ts +2 -0
- package/dist/experimental/shared/cache.d.ts +3 -0
- package/dist/experimental/shared/transform.d.ts +3 -0
- package/dist/experimental/shared.d.ts +8 -0
- package/dist/experimental/swc/ast-utils.d.ts +30 -0
- package/dist/experimental/swc/index.d.ts +2 -0
- package/dist/experimental/swc/module-specifiers.d.ts +2 -0
- package/dist/generator/index.d.ts +11 -0
- package/dist/generator/options.d.ts +17 -0
- package/dist/generator/types.d.ts +20 -0
- package/dist/generator-Y-Ikv4Fu.mjs +1177 -0
- package/dist/generator-css-B5ejWUMv.mjs +1098 -0
- package/dist/generator-css-D3OdPRiS.js +1125 -0
- package/dist/generator-mmhXzZnv.js +1276 -0
- package/dist/generator.d.ts +1 -0
- package/dist/generator.js +19 -0
- package/dist/generator.mjs +2 -0
- package/dist/gulp.d.ts +4 -24
- package/dist/gulp.js +271 -13
- package/dist/gulp.mjs +263 -13
- package/dist/index.d.ts +8 -15
- package/dist/index.js +12 -24
- package/dist/index.mjs +6 -24
- package/dist/js/JsTokenUpdater.d.ts +14 -0
- package/dist/js/ModuleGraph.d.ts +18 -0
- package/dist/js/NodePathWalker.d.ts +33 -0
- package/dist/js/babel/parse.d.ts +9 -0
- package/dist/js/babel/process.d.ts +4 -0
- package/dist/js/babel.d.ts +13 -0
- package/dist/js/class-context.d.ts +3 -0
- package/dist/js/evalTransforms.d.ts +7 -0
- package/dist/js/handlers.d.ts +5 -0
- package/dist/js/index.d.ts +4 -0
- package/dist/js/module-graph/ignored-exports.d.ts +18 -0
- package/dist/js/module-graph/types.d.ts +17 -0
- package/dist/js/node-path-walker/export-handlers.d.ts +12 -0
- package/dist/js/node-path-walker/import-tokens.d.ts +24 -0
- package/dist/js/precheck.d.ts +2 -0
- package/dist/js/sourceAnalysis.d.ts +17 -0
- package/dist/js/syntax.d.ts +10 -0
- package/dist/js/taggedTemplateIgnore.d.ts +13 -0
- package/dist/js/types.d.ts +11 -0
- package/dist/lightningcss/index.d.ts +8 -0
- package/dist/lightningcss/style-handler/options.d.ts +3 -0
- package/dist/lightningcss/style-handler/selector-transform.d.ts +10 -0
- package/dist/lightningcss/style-handler/selector-utils.d.ts +10 -0
- package/dist/lightningcss/style-handler.d.ts +17 -0
- package/dist/loader-anchors-CNkWT8hx.js +273 -0
- package/dist/loader-anchors-TrU7EUr7.mjs +205 -0
- package/dist/logger/index.d.ts +2 -0
- package/dist/logger-BZ45DZJT.js +1003 -0
- package/dist/logger-BoVx1Dbt.mjs +935 -0
- package/dist/patcher-options-6gJN2EXy.js +115 -0
- package/dist/patcher-options-DQfR5xxT.mjs +92 -0
- package/dist/postcss-html-transform.d.ts +3 -3
- package/dist/postcss-html-transform.js +7 -10
- package/dist/postcss-html-transform.mjs +3 -6
- package/dist/postcss.d.ts +15 -0
- package/dist/postcss.js +280 -0
- package/dist/postcss.mjs +270 -0
- package/dist/presets/hbuilderx.d.ts +4 -0
- package/dist/presets/index.d.ts +3 -0
- package/dist/presets/shared.d.ts +10 -0
- package/dist/presets/taro.d.ts +4 -0
- package/dist/presets/uni-app-x.d.ts +16 -0
- package/dist/presets/uni-app.d.ts +4 -0
- package/dist/presets.d.ts +1 -76
- package/dist/presets.js +115 -163
- package/dist/presets.mjs +107 -163
- package/dist/recorder-gYSNLfOP.js +2878 -0
- package/dist/recorder-zsgatmkB.mjs +2763 -0
- package/dist/reset/index.d.ts +2 -0
- package/dist/reset.d.ts +1 -4
- package/dist/reset.js +19 -8
- package/dist/reset.mjs +2 -8
- package/dist/shared/classname-transform.d.ts +14 -0
- package/dist/shared/mpx.d.ts +7 -0
- package/dist/shared/tailwindcss-css-redirect.d.ts +1 -0
- package/dist/tailwindcss/index.d.ts +11 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -0
- package/dist/tailwindcss/patcher-options.d.ts +56 -0
- package/dist/tailwindcss/patcher-resolve.d.ts +4 -0
- package/dist/tailwindcss/patcher.d.ts +13 -0
- package/dist/tailwindcss/recorder.d.ts +13 -0
- package/dist/tailwindcss/remove-unsupported-css.d.ts +2 -0
- package/dist/tailwindcss/runtime/cache.d.ts +11 -0
- package/dist/tailwindcss/runtime-logs.d.ts +3 -0
- package/dist/tailwindcss/runtime.d.ts +29 -0
- package/dist/tailwindcss/targets/paths.d.ts +13 -0
- package/dist/tailwindcss/targets/record-io.d.ts +5 -0
- package/dist/tailwindcss/targets/recorder.d.ts +3 -0
- package/dist/tailwindcss/targets/types.d.ts +35 -0
- package/dist/tailwindcss/targets.d.ts +6 -0
- package/dist/tailwindcss/v3-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v3-engine/index.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/miniprogram.d.ts +4 -0
- package/dist/tailwindcss/v3-engine/source.d.ts +5 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +55 -0
- package/dist/tailwindcss/v4/config.d.ts +5 -0
- package/dist/tailwindcss/v4/css-entries.d.ts +7 -0
- package/dist/tailwindcss/v4/index.d.ts +2 -0
- package/dist/tailwindcss/v4/multi-patcher.d.ts +2 -0
- package/dist/tailwindcss/v4/patcher-options.d.ts +24 -0
- package/dist/tailwindcss/v4/patcher.d.ts +14 -0
- package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/design-system.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/generator.d.ts +2 -0
- package/dist/tailwindcss/v4-engine/index.d.ts +5 -0
- package/dist/tailwindcss/v4-engine/miniprogram.d.ts +5 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
- package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +19 -0
- package/dist/typedoc.export.d.ts +5 -0
- package/dist/types/base.d.ts +1 -0
- package/dist/types/disabled-options.d.ts +4 -0
- package/dist/types/index.d.ts +104 -0
- package/dist/types/shared.d.ts +7 -0
- package/dist/types/user-defined-options/general.d.ts +31 -0
- package/dist/types/user-defined-options/important.d.ts +37 -0
- package/dist/types/user-defined-options/index.d.ts +11 -0
- package/dist/types/user-defined-options/lifecycle.d.ts +6 -0
- package/dist/types/user-defined-options/matcher.d.ts +9 -0
- package/dist/types.d.ts +1 -150
- package/dist/types.js +0 -1
- package/dist/types.mjs +1 -1
- package/dist/uni-app-x/component-local-style.d.ts +19 -0
- package/dist/uni-app-x/index.d.ts +2 -0
- package/dist/uni-app-x/options.d.ts +12 -0
- package/dist/uni-app-x/style-isolation.d.ts +2 -0
- package/dist/uni-app-x/transform.d.ts +9 -0
- package/dist/uni-app-x/vite.d.ts +36 -0
- package/dist/utils/decode.d.ts +2 -0
- package/dist/utils/disabled.d.ts +6 -0
- package/dist/utils/hbuilderx.d.ts +5 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/nameMatcher.d.ts +4 -0
- package/dist/utils/resolve-package.d.ts +1 -0
- package/dist/utils/uni-platform.d.ts +11 -0
- package/dist/utils-7DUGTFED.mjs +48 -0
- package/dist/utils-DmC9_In3.js +61 -0
- package/dist/vite-BC9U7ahn.js +2199 -0
- package/dist/vite-CrlzCNqz.mjs +2186 -0
- package/dist/vite.d.ts +4 -17
- package/dist/vite.js +5 -14
- package/dist/vite.mjs +2 -14
- package/dist/weapp-tw-css-import-rewrite-loader.js +59 -92
- package/dist/weapp-tw-runtime-classset-loader.js +31 -50
- package/dist/webpack-Bu6M-Hbw.mjs +441 -0
- package/dist/webpack-DD7A6V0u.js +456 -0
- package/dist/webpack.d.ts +4 -25
- package/dist/webpack.js +6 -17
- package/dist/webpack.mjs +2 -17
- package/dist/webpack4.d.ts +4 -26
- package/dist/webpack4.js +375 -481
- package/dist/webpack4.mjs +366 -482
- package/dist/wxml/Tokenizer.d.ts +15 -0
- package/dist/wxml/custom-attributes.d.ts +4 -0
- package/dist/wxml/index.d.ts +2 -0
- package/dist/wxml/shared.d.ts +2 -0
- package/dist/wxml/tokenizer/types.d.ts +18 -0
- package/dist/wxml/utils/codegen/legacy-rewriter.d.ts +2 -0
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +8 -0
- package/dist/wxml/utils/codegen.d.ts +2 -0
- package/dist/wxml/utils/custom-template.d.ts +3 -0
- package/dist/wxml/utils/fragment-helpers.d.ts +6 -0
- package/dist/wxml/utils/fragment-updater.d.ts +4 -0
- package/dist/wxml/utils/template-fragments.d.ts +3 -0
- package/dist/wxml/utils.d.ts +8 -0
- package/dist/wxml/whitespace.d.ts +2 -0
- package/generator-placeholder.css +1 -0
- package/package.json +19 -8
- package/dist/chunk-24AGZQVR.js +0 -183
- package/dist/chunk-3VQKDHGP.mjs +0 -179
- package/dist/chunk-4AFQP74Z.js +0 -24
- package/dist/chunk-57SOQCAU.mjs +0 -582
- package/dist/chunk-5ZYHNDEK.mjs +0 -2439
- package/dist/chunk-76S2EME4.mjs +0 -34
- package/dist/chunk-A5PB4KZT.js +0 -138
- package/dist/chunk-DUHYLR2R.js +0 -276
- package/dist/chunk-DYLQ6UOI.js +0 -71
- package/dist/chunk-E7I5TW5K.js +0 -52
- package/dist/chunk-FS2NOOEB.js +0 -292
- package/dist/chunk-HVNGIKLS.js +0 -3930
- package/dist/chunk-JZQBZHN5.js +0 -579
- package/dist/chunk-KGTVD4EP.mjs +0 -3930
- package/dist/chunk-NNOQDMUP.mjs +0 -10
- package/dist/chunk-OF6MFURR.js +0 -34
- package/dist/chunk-OFB2KBRP.js +0 -2442
- package/dist/chunk-OOHJLO5M.mjs +0 -71
- package/dist/chunk-PCDYXXSK.mjs +0 -1515
- package/dist/chunk-RKISS72P.js +0 -7
- package/dist/chunk-RRQZL7FQ.mjs +0 -292
- package/dist/chunk-XAKAD2CR.mjs +0 -138
- package/dist/chunk-XZP3MREK.mjs +0 -276
- package/dist/chunk-ZAA5ZG3D.js +0 -1518
- package/dist/chunk-ZCH4YINE.mjs +0 -52
- package/dist/cli.d.mts +0 -2
- package/dist/core.d.mts +0 -26
- package/dist/css-macro/postcss.d.mts +0 -7
- package/dist/css-macro.d.mts +0 -18
- package/dist/defaults.d.mts +0 -11
- package/dist/gulp.d.mts +0 -24
- package/dist/index-BXrmQelt.d.mts +0 -672
- package/dist/index-BXrmQelt.d.ts +0 -672
- package/dist/index.d.mts +0 -15
- package/dist/postcss-html-transform.d.mts +0 -2
- package/dist/presets.d.mts +0 -76
- package/dist/reset.d.mts +0 -1
- package/dist/types.d.mts +0 -150
- package/dist/vite.d.mts +0 -17
- package/dist/webpack.d.mts +0 -25
- package/dist/webpack4.d.mts +0 -26
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
//#region src/css-macro/constants.ts
|
|
2
|
+
const queryKey = "weapp-tw-platform";
|
|
3
|
+
function createMediaQuery(value) {
|
|
4
|
+
return `@media (${queryKey}:"${value}"){&}`;
|
|
5
|
+
}
|
|
6
|
+
function createNegativeMediaQuery(value) {
|
|
7
|
+
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
8
|
+
}
|
|
9
|
+
const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
|
|
10
|
+
const WHITESPACE_RE = /\s+/g;
|
|
11
|
+
const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
|
|
12
|
+
function normalComment(text) {
|
|
13
|
+
if (typeof text === "string") {
|
|
14
|
+
const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
|
|
15
|
+
if (normalized.includes("\\")) return normalized;
|
|
16
|
+
return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
|
|
17
|
+
}
|
|
18
|
+
return text;
|
|
19
|
+
}
|
|
20
|
+
function ifdef(text) {
|
|
21
|
+
return {
|
|
22
|
+
start: `#ifdef ${normalComment(text)}`,
|
|
23
|
+
end: `#endif`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function ifndef(text) {
|
|
27
|
+
return {
|
|
28
|
+
start: `#ifndef ${normalComment(text)}`,
|
|
29
|
+
end: `#endif`
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
|
|
33
|
+
function matchCustomPropertyFromValue(str, cb) {
|
|
34
|
+
let index = 0;
|
|
35
|
+
QUERY_KEY_REGEX.lastIndex = 0;
|
|
36
|
+
let arr = QUERY_KEY_REGEX.exec(str);
|
|
37
|
+
while (arr !== null) {
|
|
38
|
+
cb(arr, index);
|
|
39
|
+
index++;
|
|
40
|
+
arr = QUERY_KEY_REGEX.exec(str);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { matchCustomPropertyFromValue as a, ifndef as i, createNegativeMediaQuery as n, ifdef as r, createMediaQuery as t };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
//#region src/css-macro/constants.ts
|
|
2
|
+
const queryKey = "weapp-tw-platform";
|
|
3
|
+
function createMediaQuery(value) {
|
|
4
|
+
return `@media (${queryKey}:"${value}"){&}`;
|
|
5
|
+
}
|
|
6
|
+
function createNegativeMediaQuery(value) {
|
|
7
|
+
return `@media not screen and (${queryKey}:"${value}"){&}`;
|
|
8
|
+
}
|
|
9
|
+
const UNESCAPED_UNDERSCORE_RE = /(?<!\\)_/g;
|
|
10
|
+
const WHITESPACE_RE = /\s+/g;
|
|
11
|
+
const LOGICAL_OPERATOR_RE = /\s*(\|\||&&)\s*/g;
|
|
12
|
+
function normalComment(text) {
|
|
13
|
+
if (typeof text === "string") {
|
|
14
|
+
const normalized = text.replaceAll(UNESCAPED_UNDERSCORE_RE, " ").replaceAll(WHITESPACE_RE, " ").trim();
|
|
15
|
+
if (normalized.includes("\\")) return normalized;
|
|
16
|
+
return normalized.replaceAll(LOGICAL_OPERATOR_RE, " $1 ").replaceAll(WHITESPACE_RE, " ").trim();
|
|
17
|
+
}
|
|
18
|
+
return text;
|
|
19
|
+
}
|
|
20
|
+
function ifdef(text) {
|
|
21
|
+
return {
|
|
22
|
+
start: `#ifdef ${normalComment(text)}`,
|
|
23
|
+
end: `#endif`
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function ifndef(text) {
|
|
27
|
+
return {
|
|
28
|
+
start: `#ifndef ${normalComment(text)}`,
|
|
29
|
+
end: `#endif`
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
|
|
33
|
+
function matchCustomPropertyFromValue(str, cb) {
|
|
34
|
+
let index = 0;
|
|
35
|
+
QUERY_KEY_REGEX.lastIndex = 0;
|
|
36
|
+
let arr = QUERY_KEY_REGEX.exec(str);
|
|
37
|
+
while (arr !== null) {
|
|
38
|
+
cb(arr, index);
|
|
39
|
+
index++;
|
|
40
|
+
arr = QUERY_KEY_REGEX.exec(str);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
Object.defineProperty(exports, "createMediaQuery", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function() {
|
|
47
|
+
return createMediaQuery;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "createNegativeMediaQuery", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function() {
|
|
53
|
+
return createNegativeMediaQuery;
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
Object.defineProperty(exports, "ifdef", {
|
|
57
|
+
enumerable: true,
|
|
58
|
+
get: function() {
|
|
59
|
+
return ifdef;
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
Object.defineProperty(exports, "ifndef", {
|
|
63
|
+
enumerable: true,
|
|
64
|
+
get: function() {
|
|
65
|
+
return ifndef;
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
Object.defineProperty(exports, "matchCustomPropertyFromValue", {
|
|
69
|
+
enumerable: true,
|
|
70
|
+
get: function() {
|
|
71
|
+
return matchCustomPropertyFromValue;
|
|
72
|
+
}
|
|
73
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const runtimeAopLoader = "weapp-tw-runtime-aop-loader";
|
|
2
|
+
export declare const ManglePluginHooks = "ManglePluginHooks";
|
|
3
|
+
export declare const WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks = "WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks";
|
|
4
|
+
export declare const pluginName = "weapp-tailwindcss-webpack-plugin";
|
|
5
|
+
export declare const vitePluginName = "weapp-tailwindcss:adaptor";
|
|
6
|
+
export declare const WEAPP_TW_REQUIRED_NODE_VERSION = "20.19.0";
|
|
7
|
+
export declare const WEAPP_TW_REQUIRED_NODE_VERSION_RANGE = "^20.19.0 || >=22.12.0";
|
|
8
|
+
export declare const WEAPP_TW_VERSION: string;
|
|
9
|
+
export declare const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS: {
|
|
10
|
+
readonly 'tailwind-merge': "@weapp-tailwindcss/merge";
|
|
11
|
+
readonly 'class-variance-authority': "@weapp-tailwindcss/cva";
|
|
12
|
+
readonly 'tailwind-variants': "@weapp-tailwindcss/variants";
|
|
13
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { InternalUserDefinedOptions, UserDefinedOptions } from '../types';
|
|
2
|
+
export declare function createCompilerContextCacheKey(opts?: UserDefinedOptions): string | undefined;
|
|
3
|
+
export declare function withCompilerContextCache(opts: UserDefinedOptions | undefined, factory: () => InternalUserDefinedOptions): InternalUserDefinedOptions;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ICustomAttributesEntities, InternalUserDefinedOptions } from '../types';
|
|
2
|
+
export declare function createHandlersFromContext(ctx: InternalUserDefinedOptions, customAttributesEntities: ICustomAttributesEntities, cssCalcOptions: InternalUserDefinedOptions['cssCalc'], tailwindcssMajorVersion?: number): {
|
|
3
|
+
styleHandler: import("@weapp-tailwindcss/postcss").StyleHandler;
|
|
4
|
+
jsHandler: import("@/types").JsHandler;
|
|
5
|
+
templateHandler: (rawSource: string, opt?: Pick<import("@/types").ITemplateHandlerOptions, "runtimeSet">) => Promise<string>;
|
|
6
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InternalUserDefinedOptions, TailwindcssPatcherLike, UserDefinedOptions } from '../types';
|
|
2
|
+
interface ClearTailwindcssPatcherCacheOptions {
|
|
3
|
+
removeDirectory?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare function clearTailwindcssPatcherCache(patcher: TailwindcssPatcherLike | undefined, options?: ClearTailwindcssPatcherCacheOptions): Promise<void>;
|
|
6
|
+
export declare function getCompilerContext(opts?: UserDefinedOptions): InternalUserDefinedOptions;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveTailwindcssBasedir(basedir?: string, fallback?: string): string;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { InternalUserDefinedOptions } from '../types';
|
|
2
|
+
import { resolveTailwindcssBasedir } from './tailwindcss/basedir';
|
|
3
|
+
export declare function createTailwindcssPatcherFromContext(ctx: InternalUserDefinedOptions): import("@/types").TailwindcssPatcherLike;
|
|
4
|
+
export { resolveTailwindcssBasedir };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare function findWorkspaceRoot(startDir: string | undefined): string | undefined;
|
|
2
|
+
export declare function findNearestPackageRoot(startDir?: string): string | undefined;
|
|
3
|
+
export declare function findWorkspacePackageDir(rootDir: string, packageName: string): string | undefined;
|
package/dist/core.d.ts
CHANGED
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as postcss from 'postcss';
|
|
3
|
-
import { e as UserDefinedOptions } from './index-BXrmQelt.js';
|
|
4
|
-
import { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
5
|
-
import '@babel/parser';
|
|
6
|
-
import 'magic-string';
|
|
7
|
-
import 'tailwindcss-patch';
|
|
8
|
-
import 'node:buffer';
|
|
9
|
-
import 'webpack';
|
|
10
|
-
import 'lru-cache';
|
|
11
|
-
|
|
1
|
+
import type { CreateJsHandlerOptions, IStyleHandlerOptions, ITemplateHandlerOptions, UserDefinedOptions } from './types';
|
|
12
2
|
type RuntimeJsTransformOptions = {
|
|
13
3
|
runtimeSet?: Set<string>;
|
|
14
4
|
} & CreateJsHandlerOptions;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
* @param options - 用户定义的选项对象
|
|
18
|
-
* @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
|
|
19
|
-
*/
|
|
20
|
-
declare function createContext(options?: UserDefinedOptions): {
|
|
21
|
-
transformWxss: (rawCss: string, options?: Partial<IStyleHandlerOptions>) => Promise<postcss.Result<postcss.Document | postcss.Root>>;
|
|
5
|
+
export declare function createContext(options?: UserDefinedOptions): {
|
|
6
|
+
transformWxss: (rawCss: string, options?: Partial<IStyleHandlerOptions>) => Promise<import("postcss").Result<import("postcss").Document | import("postcss").Root>>;
|
|
22
7
|
transformWxml: (rawWxml: string, options?: ITemplateHandlerOptions) => Promise<string>;
|
|
23
|
-
transformJs: (rawJs: string, options?: RuntimeJsTransformOptions) => Promise<JsHandlerResult>;
|
|
8
|
+
transformJs: (rawJs: string, options?: RuntimeJsTransformOptions) => Promise<import("./types").JsHandlerResult>;
|
|
24
9
|
};
|
|
25
|
-
|
|
26
|
-
export { createContext };
|
|
10
|
+
export {};
|
package/dist/core.js
CHANGED
|
@@ -1,185 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
require('./chunk-DYLQ6UOI.js');
|
|
10
|
-
require('./chunk-RKISS72P.js');
|
|
11
|
-
|
|
12
|
-
// src/core.ts
|
|
13
|
-
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
14
|
-
var _shared = require('@weapp-tailwindcss/shared');
|
|
15
|
-
var DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({
|
|
16
|
-
isMainChunk: true
|
|
17
|
-
});
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
+
const require_recorder = require("./recorder-gYSNLfOP.js");
|
|
4
|
+
let node_process = require("node:process");
|
|
5
|
+
node_process = require_chunk.__toESM(node_process);
|
|
6
|
+
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
7
|
+
//#region src/core.ts
|
|
8
|
+
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
18
9
|
function resolveTransformWxssOptions(options) {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
if (options.isMainChunk === true) {
|
|
23
|
-
return options;
|
|
24
|
-
}
|
|
25
|
-
return _shared.defuOverrideArray.call(void 0, options, DEFAULT_MAIN_CHUNK_STYLE_OPTIONS);
|
|
10
|
+
if (!options) return DEFAULT_MAIN_CHUNK_STYLE_OPTIONS;
|
|
11
|
+
if (options.isMainChunk === true) return options;
|
|
12
|
+
return (0, _weapp_tailwindcss_shared.defuOverrideArray)(options, DEFAULT_MAIN_CHUNK_STYLE_OPTIONS);
|
|
26
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* 创建一个上下文对象,用于处理小程序的模板、样式和脚本转换。
|
|
16
|
+
* @param options - 用户定义的选项对象
|
|
17
|
+
* @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
|
|
18
|
+
*/
|
|
27
19
|
function createContext(options = {}) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
forceCollect: true
|
|
150
|
-
});
|
|
151
|
-
return result;
|
|
152
|
-
}
|
|
153
|
-
async function transformJs(rawJs, options2) {
|
|
154
|
-
await runtimeState.patchPromise;
|
|
155
|
-
if (_optionalChain([options2, 'optionalAccess', _ => _.runtimeSet])) {
|
|
156
|
-
runtimeSet = options2.runtimeSet;
|
|
157
|
-
} else if (runtimeSet.size === 0) {
|
|
158
|
-
runtimeSet = await _chunkHVNGIKLSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
159
|
-
forceCollect: true
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
const resolvedOptions = resolveTransformJsOptions(options2);
|
|
163
|
-
if (_chunkHVNGIKLSjs.shouldSkipJsTransform.call(void 0, rawJs, resolvedOptions)) {
|
|
164
|
-
return { code: rawJs };
|
|
165
|
-
}
|
|
166
|
-
return await jsHandler(rawJs, runtimeSet, resolvedOptions);
|
|
167
|
-
}
|
|
168
|
-
async function transformWxml(rawWxml, options2) {
|
|
169
|
-
await runtimeState.patchPromise;
|
|
170
|
-
if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
|
|
171
|
-
runtimeSet = await _chunkHVNGIKLSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
172
|
-
forceCollect: true
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
return templateHandler(rawWxml, resolveTransformWxmlOptions(options2));
|
|
176
|
-
}
|
|
177
|
-
return {
|
|
178
|
-
transformWxss,
|
|
179
|
-
transformWxml,
|
|
180
|
-
transformJs
|
|
181
|
-
};
|
|
20
|
+
const opts = require_recorder.getCompilerContext(options);
|
|
21
|
+
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
22
|
+
const patchRecorderState = require_recorder.setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
|
|
23
|
+
source: "runtime",
|
|
24
|
+
cwd: opts.tailwindcssBasedir ?? node_process.default.cwd()
|
|
25
|
+
});
|
|
26
|
+
let runtimeSet = /* @__PURE__ */ new Set();
|
|
27
|
+
const runtimeState = {
|
|
28
|
+
twPatcher: initialTwPatcher,
|
|
29
|
+
patchPromise: patchRecorderState.patchPromise,
|
|
30
|
+
refreshTailwindcssPatcher,
|
|
31
|
+
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
32
|
+
};
|
|
33
|
+
const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
34
|
+
function getDefaultJsHandlerOptions(majorVersion = runtimeState.twPatcher.majorVersion) {
|
|
35
|
+
if (typeof majorVersion !== "number") return;
|
|
36
|
+
let cached = defaultJsHandlerOptionsCache.get(majorVersion);
|
|
37
|
+
if (!cached) {
|
|
38
|
+
cached = { tailwindcssMajorVersion: majorVersion };
|
|
39
|
+
defaultJsHandlerOptionsCache.set(majorVersion, cached);
|
|
40
|
+
}
|
|
41
|
+
return cached;
|
|
42
|
+
}
|
|
43
|
+
function withRuntimeTailwindMajorVersion(options) {
|
|
44
|
+
if (!options) return getDefaultJsHandlerOptions();
|
|
45
|
+
if (typeof options.tailwindcssMajorVersion === "number") return options;
|
|
46
|
+
const majorVersion = runtimeState.twPatcher.majorVersion;
|
|
47
|
+
if (typeof majorVersion !== "number") return options;
|
|
48
|
+
return {
|
|
49
|
+
...options,
|
|
50
|
+
tailwindcssMajorVersion: majorVersion
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function resolveTransformJsOptions(options) {
|
|
54
|
+
if (!options) return getDefaultJsHandlerOptions();
|
|
55
|
+
let hasHandlerOption = false;
|
|
56
|
+
let runtimeSetProvided = false;
|
|
57
|
+
for (const key in options) {
|
|
58
|
+
if (key === "runtimeSet") {
|
|
59
|
+
runtimeSetProvided = true;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
hasHandlerOption = true;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
if (!hasHandlerOption) return getDefaultJsHandlerOptions();
|
|
66
|
+
if (!runtimeSetProvided && typeof options.tailwindcssMajorVersion === "number") return options;
|
|
67
|
+
if (runtimeSetProvided) {
|
|
68
|
+
const { runtimeSet: _runtimeSet, ...handlerOptions } = options;
|
|
69
|
+
return withRuntimeTailwindMajorVersion(handlerOptions);
|
|
70
|
+
}
|
|
71
|
+
return withRuntimeTailwindMajorVersion(options);
|
|
72
|
+
}
|
|
73
|
+
const runtimeAwareTemplateJsHandler = (source, runtime, handlerOptions) => {
|
|
74
|
+
return jsHandler(source, runtime, withRuntimeTailwindMajorVersion(handlerOptions));
|
|
75
|
+
};
|
|
76
|
+
let cachedDefaultTemplateHandlerOptions;
|
|
77
|
+
let cachedDefaultTemplateRuntimeSet;
|
|
78
|
+
let cachedRuntimeOnlyTemplateHandlerOptions;
|
|
79
|
+
let cachedRuntimeOnlyTemplateRuntimeSet;
|
|
80
|
+
function getDefaultTemplateHandlerOptions() {
|
|
81
|
+
if (cachedDefaultTemplateRuntimeSet !== runtimeSet || !cachedDefaultTemplateHandlerOptions) {
|
|
82
|
+
cachedDefaultTemplateRuntimeSet = runtimeSet;
|
|
83
|
+
cachedDefaultTemplateHandlerOptions = {
|
|
84
|
+
runtimeSet,
|
|
85
|
+
jsHandler: runtimeAwareTemplateJsHandler
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return cachedDefaultTemplateHandlerOptions;
|
|
89
|
+
}
|
|
90
|
+
function resolveTransformWxmlOptions(options) {
|
|
91
|
+
if (!options) return getDefaultTemplateHandlerOptions();
|
|
92
|
+
let hasOverride = false;
|
|
93
|
+
for (const key in options) if (key !== "runtimeSet") {
|
|
94
|
+
hasOverride = true;
|
|
95
|
+
break;
|
|
96
|
+
}
|
|
97
|
+
if (!hasOverride) {
|
|
98
|
+
const runtimeOverride = options.runtimeSet;
|
|
99
|
+
if (runtimeOverride === void 0 || runtimeOverride === runtimeSet) return getDefaultTemplateHandlerOptions();
|
|
100
|
+
if (cachedRuntimeOnlyTemplateRuntimeSet !== runtimeOverride || !cachedRuntimeOnlyTemplateHandlerOptions) {
|
|
101
|
+
cachedRuntimeOnlyTemplateRuntimeSet = runtimeOverride;
|
|
102
|
+
cachedRuntimeOnlyTemplateHandlerOptions = {
|
|
103
|
+
runtimeSet: runtimeOverride,
|
|
104
|
+
jsHandler: runtimeAwareTemplateJsHandler
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return cachedRuntimeOnlyTemplateHandlerOptions;
|
|
108
|
+
}
|
|
109
|
+
return (0, _weapp_tailwindcss_shared.defuOverrideArray)(options, {
|
|
110
|
+
runtimeSet,
|
|
111
|
+
jsHandler: runtimeAwareTemplateJsHandler
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
async function transformWxss(rawCss, options) {
|
|
115
|
+
await runtimeState.patchPromise;
|
|
116
|
+
const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
|
|
117
|
+
runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, {
|
|
118
|
+
forceRefresh: true,
|
|
119
|
+
forceCollect: true
|
|
120
|
+
});
|
|
121
|
+
return result;
|
|
122
|
+
}
|
|
123
|
+
async function transformJs(rawJs, options) {
|
|
124
|
+
await runtimeState.patchPromise;
|
|
125
|
+
if (options?.runtimeSet) runtimeSet = options.runtimeSet;
|
|
126
|
+
else if (runtimeSet.size === 0) runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
127
|
+
const resolvedOptions = resolveTransformJsOptions(options);
|
|
128
|
+
if (require_recorder.shouldSkipJsTransform(rawJs, resolvedOptions)) return { code: rawJs };
|
|
129
|
+
return await jsHandler(rawJs, runtimeSet, resolvedOptions);
|
|
130
|
+
}
|
|
131
|
+
async function transformWxml(rawWxml, options) {
|
|
132
|
+
await runtimeState.patchPromise;
|
|
133
|
+
if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
|
|
134
|
+
return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
|
|
135
|
+
}
|
|
136
|
+
return {
|
|
137
|
+
transformWxss,
|
|
138
|
+
transformWxml,
|
|
139
|
+
transformJs
|
|
140
|
+
};
|
|
182
141
|
}
|
|
183
|
-
|
|
184
|
-
|
|
142
|
+
//#endregion
|
|
185
143
|
exports.createContext = createContext;
|