weapp-tailwindcss 4.12.0 → 5.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +41 -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 +19 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +20 -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/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 +15 -0
- package/dist/generator/types.d.ts +19 -0
- package/dist/generator-CZ-JXw6T.js +492 -0
- package/dist/generator-Dwxgra97.mjs +399 -0
- package/dist/generator-css-CnYjiMrD.js +1084 -0
- package/dist/generator-css-DhPFjSzK.mjs +1057 -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-DvwgIYdA.mjs +205 -0
- package/dist/loader-anchors-cprm4Klq.js +273 -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 +278 -0
- package/dist/postcss.mjs +268 -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-B_XyZ576.mjs +2763 -0
- package/dist/recorder-rn_2v_nd.js +2878 -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/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 +4 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +7 -0
- package/dist/tailwindcss/v4-engine/types.d.ts +17 -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-BHpAqldo.js +1952 -0
- package/dist/vite-C8JlHiyR.mjs +1940 -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-CABjKGGQ.mjs +441 -0
- package/dist/webpack-DNIJ0ysE.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 -5
- 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
package/dist/defaults.mjs
CHANGED
|
@@ -1,8 +1,129 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { a as noop } from "./utils-7DUGTFED.mjs";
|
|
2
|
+
import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
|
|
3
|
+
//#region src/defaults.ts
|
|
4
|
+
const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
|
|
5
|
+
const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
|
|
6
|
+
const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
|
|
7
|
+
const BACKSLASH_RE = /\\/g;
|
|
8
|
+
function normalizePath(p) {
|
|
9
|
+
return p.replace(BACKSLASH_RE, "/");
|
|
10
|
+
}
|
|
11
|
+
const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
|
|
12
|
+
const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
|
|
13
|
+
const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
|
|
14
|
+
const MAIN_CSS_CHUNK_MATCHERS = {
|
|
15
|
+
"uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
|
|
16
|
+
"uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
17
|
+
"uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
|
|
18
|
+
"mpx": (file) => {
|
|
19
|
+
const normalized = normalizePath(file);
|
|
20
|
+
if (normalized.startsWith("app")) return true;
|
|
21
|
+
return MPX_STYLES_DIR_PATTERN.test(normalized);
|
|
22
|
+
},
|
|
23
|
+
"taro": (file) => file.startsWith("app"),
|
|
24
|
+
"remax": (file) => file.startsWith("app"),
|
|
25
|
+
"rax": (file) => file.startsWith("bundle"),
|
|
26
|
+
"native": (file) => file.startsWith("app"),
|
|
27
|
+
"weapp-vite": (file) => file.startsWith("app"),
|
|
28
|
+
"kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
|
|
8
29
|
};
|
|
30
|
+
const alwaysFalse = () => false;
|
|
31
|
+
function createMainCssChunkMatcher() {
|
|
32
|
+
return (file, appType) => {
|
|
33
|
+
if (!appType) {
|
|
34
|
+
const normalized = normalizePath(file);
|
|
35
|
+
return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
|
|
36
|
+
}
|
|
37
|
+
const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
|
|
38
|
+
return matcher ? matcher(file) : true;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function getDefaultOptions() {
|
|
42
|
+
return {
|
|
43
|
+
/**
|
|
44
|
+
* wxss 微信小程序
|
|
45
|
+
* acss 支付宝小程序
|
|
46
|
+
* jxss 京东小程序
|
|
47
|
+
* ttss 头条小程序
|
|
48
|
+
* qss QQ小程序
|
|
49
|
+
* css 最正常的样式文件
|
|
50
|
+
* tyss 涂鸦小程序
|
|
51
|
+
*/
|
|
52
|
+
cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
|
|
53
|
+
/**
|
|
54
|
+
* wxml 微信小程序
|
|
55
|
+
* axml 支付宝小程序
|
|
56
|
+
* jxml 京东小程序
|
|
57
|
+
* ksml 快手小程序
|
|
58
|
+
* ttml 头条小程序
|
|
59
|
+
* qml QQ小程序
|
|
60
|
+
* tyml 涂鸦小程序
|
|
61
|
+
* xhsml 小红书小程序
|
|
62
|
+
* swan 百度小程序
|
|
63
|
+
*/
|
|
64
|
+
htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
|
|
65
|
+
jsMatcher: (file) => {
|
|
66
|
+
if (file.includes("node_modules")) return false;
|
|
67
|
+
return JS_FILE_PATTERN.test(file);
|
|
68
|
+
},
|
|
69
|
+
mainCssChunkMatcher: createMainCssChunkMatcher(),
|
|
70
|
+
wxsMatcher: alwaysFalse,
|
|
71
|
+
cssPreflight: {
|
|
72
|
+
"box-sizing": "border-box",
|
|
73
|
+
"border-width": "0",
|
|
74
|
+
"border-style": "solid",
|
|
75
|
+
"border-color": "currentColor"
|
|
76
|
+
},
|
|
77
|
+
disabled: false,
|
|
78
|
+
onLoad: noop,
|
|
79
|
+
onStart: noop,
|
|
80
|
+
onEnd: noop,
|
|
81
|
+
onUpdate: noop,
|
|
82
|
+
customAttributes: {},
|
|
83
|
+
customReplaceDictionary: MappingChars2String,
|
|
84
|
+
appType: void 0,
|
|
85
|
+
arbitraryValues: { allowDoubleQuotes: false },
|
|
86
|
+
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
87
|
+
inlineWxs: false,
|
|
88
|
+
injectAdditionalCssVarScope: false,
|
|
89
|
+
rewriteCssImports: true,
|
|
90
|
+
jsPreserveClass: (keyword) => {
|
|
91
|
+
/**
|
|
92
|
+
* 默认保留 keyword
|
|
93
|
+
*/
|
|
94
|
+
if (keyword === "*") return true;
|
|
95
|
+
return false;
|
|
96
|
+
},
|
|
97
|
+
staleClassNameFallback: void 0,
|
|
98
|
+
disabledDefaultTemplateHandler: false,
|
|
99
|
+
cssSelectorReplacement: {
|
|
100
|
+
root: [
|
|
101
|
+
"page",
|
|
102
|
+
".tw-root",
|
|
103
|
+
"wx-root-portal-content"
|
|
104
|
+
],
|
|
105
|
+
universal: ["view", "text"]
|
|
106
|
+
},
|
|
107
|
+
babelParserOptions: {
|
|
108
|
+
sourceType: "unambiguous",
|
|
109
|
+
cache: true,
|
|
110
|
+
cacheKey: "st:unambiguous"
|
|
111
|
+
},
|
|
112
|
+
postcssOptions: {},
|
|
113
|
+
cssRemoveProperty: true,
|
|
114
|
+
cssRemoveHoverPseudoClass: true,
|
|
115
|
+
ignoreCallExpressionIdentifiers: [],
|
|
116
|
+
ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
|
|
117
|
+
replaceRuntimePackages: false,
|
|
118
|
+
generator: {
|
|
119
|
+
mode: "auto",
|
|
120
|
+
target: "weapp"
|
|
121
|
+
},
|
|
122
|
+
tailwindcssPatcherOptions: { filter(className) {
|
|
123
|
+
return !isAllowedClassName(className);
|
|
124
|
+
} },
|
|
125
|
+
logLevel: "info"
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
//#endregion
|
|
129
|
+
export { getDefaultOptions };
|
package/dist/escape.js
CHANGED
|
@@ -1,58 +1,35 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
|
|
20
|
-
// src/escape.ts
|
|
21
|
-
var escape_exports = {};
|
|
22
|
-
__export(escape_exports, {
|
|
23
|
-
escape: () => replaceWxml,
|
|
24
|
-
isAllowedClassName: () => import_escape2.isAllowedClassName,
|
|
25
|
-
unescape: () => import_escape2.unescape,
|
|
26
|
-
weappTwIgnore: () => weappTwIgnore
|
|
27
|
-
});
|
|
28
|
-
module.exports = __toCommonJS(escape_exports);
|
|
29
|
-
|
|
30
|
-
// src/wxml/shared.ts
|
|
31
|
-
var import_escape = require("@weapp-core/escape");
|
|
32
|
-
var NEWLINE_RE = /[\n\r]+/g;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let _weapp_core_escape = require("@weapp-core/escape");
|
|
3
|
+
//#region src/wxml/shared.ts
|
|
4
|
+
const NEWLINE_RE = /[\n\r]+/g;
|
|
33
5
|
function replaceWxml(original, options = {
|
|
34
|
-
|
|
35
|
-
|
|
6
|
+
keepEOL: false,
|
|
7
|
+
escapeMap: _weapp_core_escape.MappingChars2String
|
|
36
8
|
}) {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
});
|
|
46
|
-
return res;
|
|
9
|
+
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
10
|
+
let res = original;
|
|
11
|
+
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
|
|
12
|
+
res = (0, _weapp_core_escape.escape)(res, {
|
|
13
|
+
map: escapeMap,
|
|
14
|
+
ignoreHead
|
|
15
|
+
});
|
|
16
|
+
return res;
|
|
47
17
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/escape.ts
|
|
20
|
+
const weappTwIgnore = String.raw;
|
|
21
|
+
//#endregion
|
|
22
|
+
exports.escape = replaceWxml;
|
|
23
|
+
Object.defineProperty(exports, "isAllowedClassName", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return _weapp_core_escape.isAllowedClassName;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
Object.defineProperty(exports, "unescape", {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function() {
|
|
32
|
+
return _weapp_core_escape.unescape;
|
|
33
|
+
}
|
|
58
34
|
});
|
|
35
|
+
exports.weappTwIgnore = weappTwIgnore;
|
package/dist/escape.mjs
CHANGED
|
@@ -1,28 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { MappingChars2String, escape, isAllowedClassName, unescape } from "@weapp-core/escape";
|
|
2
|
+
//#region src/wxml/shared.ts
|
|
3
|
+
const NEWLINE_RE = /[\n\r]+/g;
|
|
4
4
|
function replaceWxml(original, options = {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
keepEOL: false,
|
|
6
|
+
escapeMap: MappingChars2String
|
|
7
7
|
}) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
});
|
|
17
|
-
return res;
|
|
8
|
+
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
9
|
+
let res = original;
|
|
10
|
+
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
|
|
11
|
+
res = escape(res, {
|
|
12
|
+
map: escapeMap,
|
|
13
|
+
ignoreHead
|
|
14
|
+
});
|
|
15
|
+
return res;
|
|
18
16
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
export {
|
|
24
|
-
replaceWxml as escape,
|
|
25
|
-
isAllowedClassName,
|
|
26
|
-
unescape,
|
|
27
|
-
weappTwIgnore
|
|
28
|
-
};
|
|
17
|
+
//#endregion
|
|
18
|
+
//#region src/escape.ts
|
|
19
|
+
const weappTwIgnore = String.raw;
|
|
20
|
+
//#endregion
|
|
21
|
+
export { replaceWxml as escape, isAllowedClassName, unescape, weappTwIgnore };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface Oxcast {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
4
|
+
export declare function parseWithOxc(code: string): Oxcast;
|
|
5
|
+
export declare function getIdentifierName(node: any): string | undefined;
|
|
6
|
+
export declare function isStringLiteral(node: any): node is {
|
|
7
|
+
type: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function isTemplateLiteral(node: any): boolean;
|
|
11
|
+
export declare function getTemplateQuasis(node: any): any[];
|
|
12
|
+
export declare function getTplElementRaw(elem: any): string | undefined;
|
|
13
|
+
export declare function isTaggedTemplate(node: any): boolean;
|
|
14
|
+
export declare function getTaggedTemplateTag(node: any): any;
|
|
15
|
+
export declare function isCallExpression(node: any): boolean;
|
|
16
|
+
export declare function getCallCallee(node: any): any;
|
|
17
|
+
export declare function getCallArguments(node: any): any[];
|
|
18
|
+
export declare function isImportDeclaration(node: any): boolean;
|
|
19
|
+
export declare function isExportAllDeclaration(node: any): boolean;
|
|
20
|
+
export declare function getImportSourceLiteral(node: any): any | undefined;
|
|
21
|
+
export declare function sliceStringLiteralText(code: string, node: any): {
|
|
22
|
+
start: number;
|
|
23
|
+
end: number;
|
|
24
|
+
text: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
export declare function sliceTplElementText(code: string, elem: any): {
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
text: string;
|
|
30
|
+
} | undefined;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { IJsHandlerOptions } from '../../types';
|
|
2
|
+
export declare function shouldTransformClassName(candidate: string, options: Pick<IJsHandlerOptions, 'alwaysEscape' | 'classNameSet' | 'jsPreserveClass'>): boolean;
|
|
3
|
+
export declare function transformLiteralText(literal: string, options: IJsHandlerOptions): string | undefined;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { getPattern, getReplacement } from './shared/cache';
|
|
2
|
+
export { shouldTransformClassName, transformLiteralText } from './shared/transform';
|
|
3
|
+
export declare function createToken(start: number, end: number, value: string): {
|
|
4
|
+
start: number;
|
|
5
|
+
end: number;
|
|
6
|
+
value: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function createNameMatcher(patterns: (string | RegExp)[] | undefined, exact?: boolean): (name: string) => boolean;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface SwcAst {
|
|
2
|
+
[key: string]: any;
|
|
3
|
+
}
|
|
4
|
+
export declare function parseWithSwc(code: string): SwcAst;
|
|
5
|
+
export declare function getIdentifierName(node: any): string | undefined;
|
|
6
|
+
export declare function isStringLiteral(node: any): node is {
|
|
7
|
+
type: string;
|
|
8
|
+
value: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function isTemplateLiteral(node: any): boolean;
|
|
11
|
+
export declare function getTemplateQuasis(node: any): any[];
|
|
12
|
+
export declare function getTplElementRaw(elem: any): string | undefined;
|
|
13
|
+
export declare function isTaggedTemplate(node: any): boolean;
|
|
14
|
+
export declare function getTaggedTemplateTag(node: any): any;
|
|
15
|
+
export declare function isCallExpression(node: any): boolean;
|
|
16
|
+
export declare function getCallCallee(node: any): any;
|
|
17
|
+
export declare function getCallArguments(node: any): any[];
|
|
18
|
+
export declare function isImportDeclaration(node: any): boolean;
|
|
19
|
+
export declare function isExportAllDeclaration(node: any): boolean;
|
|
20
|
+
export declare function getImportSourceLiteral(node: any): any | undefined;
|
|
21
|
+
export declare function sliceStringLiteralText(code: string, node: any): {
|
|
22
|
+
start: number;
|
|
23
|
+
end: number;
|
|
24
|
+
text: string;
|
|
25
|
+
} | undefined;
|
|
26
|
+
export declare function sliceTplElementText(code: string, elem: any): {
|
|
27
|
+
start: number;
|
|
28
|
+
end: number;
|
|
29
|
+
text: string;
|
|
30
|
+
} | undefined;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { TailwindResolvedSource, WeappTailwindcssGenerator } from './types';
|
|
2
|
+
import type { TailwindcssPatcherLike } from '../types';
|
|
3
|
+
import { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp } from '../tailwindcss/v3-engine';
|
|
4
|
+
import { resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp } from '../tailwindcss/v4-engine';
|
|
5
|
+
export declare function createWeappTailwindcssGenerator(source: TailwindResolvedSource): WeappTailwindcssGenerator;
|
|
6
|
+
export declare function resolveTailwindSourceFromPatcher(patcher: TailwindcssPatcherLike): Promise<TailwindResolvedSource>;
|
|
7
|
+
export declare function createWeappTailwindcssGeneratorFromPatcher(patcher: TailwindcssPatcherLike): Promise<WeappTailwindcssGenerator>;
|
|
8
|
+
export { normalizeWeappTailwindcssGeneratorOptions, } from './options';
|
|
9
|
+
export { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
|
|
10
|
+
export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorMode, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
|
|
11
|
+
export type { TailwindCandidateSource, TailwindGeneratorVersion, TailwindResolvedSource, TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, } from './types';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { WeappTailwindcssGeneratorTarget } from './types';
|
|
3
|
+
export type WeappTailwindcssGeneratorMode = 'auto' | 'force' | 'off';
|
|
4
|
+
export interface WeappTailwindcssGeneratorOptions {
|
|
5
|
+
mode?: WeappTailwindcssGeneratorMode;
|
|
6
|
+
target?: WeappTailwindcssGeneratorTarget;
|
|
7
|
+
styleOptions?: Partial<IStyleHandlerOptions>;
|
|
8
|
+
}
|
|
9
|
+
export type WeappTailwindcssGeneratorUserOptions = boolean | WeappTailwindcssGeneratorOptions;
|
|
10
|
+
export interface NormalizedWeappTailwindcssGeneratorOptions {
|
|
11
|
+
mode: WeappTailwindcssGeneratorMode;
|
|
12
|
+
target: WeappTailwindcssGeneratorTarget;
|
|
13
|
+
styleOptions?: Partial<IStyleHandlerOptions>;
|
|
14
|
+
}
|
|
15
|
+
export declare function normalizeWeappTailwindcssGeneratorOptions(options: WeappTailwindcssGeneratorUserOptions | undefined): NormalizedWeappTailwindcssGeneratorOptions;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
|
+
import type { TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions } from '../tailwindcss/v3-engine';
|
|
3
|
+
import type { TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions } from '../tailwindcss/v4-engine';
|
|
4
|
+
export type WeappTailwindcssGeneratorTarget = TailwindV3GenerateTarget | TailwindV4GenerateTarget;
|
|
5
|
+
export type TailwindGeneratorVersion = 3 | 4;
|
|
6
|
+
export type TailwindCandidateSource = TailwindV3CandidateSource | TailwindV4CandidateSource;
|
|
7
|
+
export type TailwindResolvedSource = TailwindV3ResolvedSource | TailwindV4ResolvedSource;
|
|
8
|
+
export interface WeappTailwindcssGenerateOptions extends Omit<TailwindV3GenerateOptions & TailwindV4GenerateOptions, 'target'> {
|
|
9
|
+
target?: WeappTailwindcssGeneratorTarget;
|
|
10
|
+
styleOptions?: Partial<IStyleHandlerOptions>;
|
|
11
|
+
}
|
|
12
|
+
export type WeappTailwindcssGenerateResult = (TailwindV3GenerateResult | TailwindV4GenerateResult) & {
|
|
13
|
+
target: WeappTailwindcssGeneratorTarget;
|
|
14
|
+
rawCss: string;
|
|
15
|
+
};
|
|
16
|
+
export interface WeappTailwindcssGenerator extends Omit<TailwindV3Engine | TailwindV4Engine, 'generate'> {
|
|
17
|
+
generate: (options?: WeappTailwindcssGenerateOptions) => Promise<WeappTailwindcssGenerateResult>;
|
|
18
|
+
}
|
|
19
|
+
export type { TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, };
|