weapp-tailwindcss 5.0.0-next.9 → 5.0.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.
Files changed (167) hide show
  1. package/README.md +2 -2
  2. package/dist/auto-DEHRmEAx.mjs +200 -0
  3. package/dist/auto-dPpsm6FB.js +238 -0
  4. package/dist/bundle-state-CBF5YX1m.js +529 -0
  5. package/dist/bundle-state-CQmxxx0R.mjs +413 -0
  6. package/dist/bundlers/shared/cache.d.ts +9 -7
  7. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
  8. package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
  9. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  10. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  11. package/dist/bundlers/shared/generator-css/directives.d.ts +11 -3
  12. package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
  13. package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
  14. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
  15. package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +6 -2
  17. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  18. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  19. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  20. package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
  21. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
  22. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
  23. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
  24. package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
  25. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
  26. package/dist/bundlers/vite/index.d.ts +5 -2
  27. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  28. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
  29. package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
  30. package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
  31. package/dist/bundlers/vite/source-candidates.d.ts +24 -2
  32. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  33. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  34. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
  35. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
  36. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
  37. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  38. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  39. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
  40. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  41. package/dist/cache/index.d.ts +6 -6
  42. package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
  43. package/dist/cli/context.d.ts +1 -11
  44. package/dist/cli/doctor/types.d.ts +11 -11
  45. package/dist/cli/vscode-entry.d.ts +3 -3
  46. package/dist/cli.js +684 -41
  47. package/dist/cli.mjs +682 -40
  48. package/dist/context/runtime-package-replacements.d.ts +2 -0
  49. package/dist/context/style-options.d.ts +3 -0
  50. package/dist/context/tailwindcss.d.ts +1 -1
  51. package/dist/core.js +1 -2
  52. package/dist/core.mjs +1 -1
  53. package/dist/css-macro/auto.d.ts +11 -0
  54. package/dist/css-macro/constants.d.ts +5 -2
  55. package/dist/css-macro/postcss.d.ts +1 -0
  56. package/dist/css-macro/postcss.js +7 -46
  57. package/dist/css-macro/postcss.mjs +2 -46
  58. package/dist/css-macro.js +16 -7
  59. package/dist/css-macro.mjs +15 -6
  60. package/dist/defaults-8xrgzxFY.mjs +151 -0
  61. package/dist/defaults-zKUH2mDe.js +193 -0
  62. package/dist/defaults.js +6 -150
  63. package/dist/defaults.mjs +1 -143
  64. package/dist/escape.js +10 -2
  65. package/dist/escape.mjs +10 -2
  66. package/dist/generator/options.d.ts +11 -6
  67. package/dist/generator/types.d.ts +3 -3
  68. package/dist/generator-CvmsIQFI.js +92 -0
  69. package/dist/generator-DDtsUvkH.mjs +67 -0
  70. package/dist/generator.js +12 -12
  71. package/dist/generator.mjs +2 -1
  72. package/dist/gulp.js +163 -40
  73. package/dist/gulp.mjs +155 -32
  74. package/dist/incremental-runtime-class-set-BffodqHh.js +2366 -0
  75. package/dist/incremental-runtime-class-set-DArodvWs.mjs +2291 -0
  76. package/dist/index.d.ts +2 -1
  77. package/dist/index.js +17 -5
  78. package/dist/index.mjs +6 -5
  79. package/dist/js/babel/cache-options.d.ts +3 -0
  80. package/dist/js/babel/parse.d.ts +7 -4
  81. package/dist/js/precheck.d.ts +2 -2
  82. package/dist/js/replacement-cache.d.ts +5 -0
  83. package/dist/{postcss-w48mGIhe.mjs → postcss-BzNYQUOH.mjs} +54 -114
  84. package/dist/postcss-C7BMYpEF.mjs +169 -0
  85. package/dist/postcss-CiYLsqZn.js +192 -0
  86. package/dist/{postcss-QIXwT40c.js → postcss-DE0TOtV9.js} +60 -121
  87. package/dist/postcss-html-transform.js +1 -1
  88. package/dist/postcss.js +1 -1
  89. package/dist/postcss.mjs +1 -1
  90. package/dist/precheck-BzYPm-EG.js +4842 -0
  91. package/dist/precheck-jZvTVXXG.mjs +4716 -0
  92. package/dist/presets/index.d.ts +1 -0
  93. package/dist/presets/uni-app-x.d.ts +1 -0
  94. package/dist/presets.js +27 -13
  95. package/dist/presets.mjs +25 -13
  96. package/dist/reset.js +1 -1
  97. package/dist/runtime-registry-DpcR3IHI.js +5496 -0
  98. package/dist/shared/mpx.d.ts +1 -0
  99. package/dist/source-candidates-BuTlMabx.mjs +322 -0
  100. package/dist/source-candidates-CxoIaS88.js +335 -0
  101. package/dist/tailwindcss/miniprogram.d.ts +1 -5
  102. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  103. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  104. package/dist/tailwindcss/runtime.d.ts +9 -9
  105. package/dist/tailwindcss/source-scan.d.ts +35 -0
  106. package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
  107. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  108. package/dist/tailwindcss/v4/patcher.d.ts +1 -1
  109. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  110. package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
  111. package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-CCZcu0lr.mjs} +75 -98
  112. package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-DZckITp1.js} +83 -106
  113. package/dist/typedoc.export.d.ts +1 -1
  114. package/dist/types/index.d.ts +51 -41
  115. package/dist/types/shared.d.ts +3 -0
  116. package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
  117. package/dist/types/user-defined-options/general.d.ts +25 -22
  118. package/dist/types/user-defined-options/important.d.ts +32 -27
  119. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  120. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  121. package/dist/unocss/index.d.ts +2 -0
  122. package/dist/utils/object.d.ts +9 -0
  123. package/dist/utils/options.d.ts +2 -0
  124. package/dist/utils/regex.d.ts +1 -0
  125. package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
  126. package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
  127. package/dist/v3-engine-DGBhUnjn.mjs +3419 -0
  128. package/dist/v3-engine-M6Aqru5T.js +3714 -0
  129. package/dist/vite-BBcQIJpD.mjs +24493 -0
  130. package/dist/vite-DgRkWVPG.js +24507 -0
  131. package/dist/vite.js +1 -1
  132. package/dist/vite.mjs +1 -1
  133. package/dist/weapp-tw-css-import-rewrite-loader.js +5456 -22
  134. package/dist/weapp-tw-runtime-classset-loader.js +32 -9
  135. package/dist/{webpack-BzN2ly34.js → webpack-D-gb4ZvO.js} +341 -96
  136. package/dist/{webpack-DJazm5sT.mjs → webpack-D43aMQzO.mjs} +323 -79
  137. package/dist/webpack.d.ts +1 -3
  138. package/dist/webpack.js +3 -4
  139. package/dist/webpack.mjs +2 -2
  140. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
  141. package/package.json +22 -20
  142. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
  143. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
  144. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
  145. package/dist/cache-BVAiJV3J.js +0 -502
  146. package/dist/cache-CHs4DXui.mjs +0 -434
  147. package/dist/constants-BoB_6lFw.js +0 -73
  148. package/dist/constants-E_loJC49.mjs +0 -44
  149. package/dist/generator-DKkhJbOg.js +0 -1531
  150. package/dist/generator-UBmfduYg.mjs +0 -1432
  151. package/dist/generator-css-Bwp3nbrl.js +0 -1381
  152. package/dist/generator-css-DeLLmp2N.mjs +0 -1342
  153. package/dist/lightningcss/index.d.ts +0 -8
  154. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  155. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  156. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  157. package/dist/lightningcss/style-handler.d.ts +0 -17
  158. package/dist/precheck-B32p-gLI.js +0 -2736
  159. package/dist/precheck-B4RH6ZNN.mjs +0 -2622
  160. package/dist/run-tasks-B50A3pxt.js +0 -128
  161. package/dist/run-tasks-DdNi-hkk.mjs +0 -91
  162. package/dist/runtime-patch-CwN5ya72.mjs +0 -71
  163. package/dist/runtime-patch-D6mBo_KB.js +0 -85
  164. package/dist/vite-By5KQi9s.js +0 -2419
  165. package/dist/vite-Cyp42bBf.mjs +0 -2406
  166. /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
  167. /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
package/dist/defaults.js CHANGED
@@ -1,151 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./chunk-8l464Juk.js");
3
- require("./utils-BiShvil9.js");
4
- let _weapp_core_escape = require("@weapp-core/escape");
5
- let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
6
- //#region src/defaults.ts
7
- const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
8
- const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
9
- const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
10
- const BACKSLASH_RE = /\\/g;
11
- function normalizePath(p) {
12
- return p.replace(BACKSLASH_RE, "/");
13
- }
14
- const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
15
- const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
16
- const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
17
- const MAIN_CSS_CHUNK_MATCHERS = {
18
- "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
19
- "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
20
- "uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
21
- "mpx": (file) => {
22
- const normalized = normalizePath(file);
23
- if (normalized.startsWith("app")) return true;
24
- return MPX_STYLES_DIR_PATTERN.test(normalized);
25
- },
26
- "taro": (file) => file.startsWith("app"),
27
- "remax": (file) => file.startsWith("app"),
28
- "rax": (file) => file.startsWith("bundle"),
29
- "native": (file) => file.startsWith("app"),
30
- "weapp-vite": (file) => file.startsWith("app"),
31
- "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
32
- };
33
- const alwaysFalse = () => false;
34
- const TAILWIND_V3_CSS_PREFLIGHT = {
35
- "box-sizing": "border-box",
36
- "border-width": "0",
37
- "border-style": "solid",
38
- "border-color": "currentColor"
39
- };
40
- const TAILWIND_V4_CSS_PREFLIGHT = {
41
- "box-sizing": "border-box",
42
- "margin": "0",
43
- "padding": "0",
44
- "border": "0 solid"
45
- };
46
- function getDefaultCssPreflight(tailwindcssMajorVersion) {
47
- return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
48
- }
49
- function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
50
- if (cssPreflight === false) return false;
51
- return {
52
- ...getDefaultCssPreflight(tailwindcssMajorVersion),
53
- ...cssPreflight ?? {}
54
- };
55
- }
56
- function createMainCssChunkMatcher() {
57
- return (file, appType) => {
58
- if (!appType) {
59
- const normalized = normalizePath(file);
60
- return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
61
- }
62
- const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
63
- return matcher ? matcher(file) : true;
64
- };
65
- }
66
- function getDefaultOptions() {
67
- return {
68
- /**
69
- * wxss 微信小程序
70
- * acss 支付宝小程序
71
- * jxss 京东小程序
72
- * ttss 头条小程序
73
- * qss QQ小程序
74
- * css 最正常的样式文件
75
- * tyss 涂鸦小程序
76
- */
77
- cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
78
- /**
79
- * wxml 微信小程序
80
- * axml 支付宝小程序
81
- * jxml 京东小程序
82
- * ksml 快手小程序
83
- * ttml 头条小程序
84
- * qml QQ小程序
85
- * tyml 涂鸦小程序
86
- * xhsml 小红书小程序
87
- * swan 百度小程序
88
- */
89
- htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
90
- jsMatcher: (file) => {
91
- if (file.includes("node_modules")) return false;
92
- return JS_FILE_PATTERN.test(file);
93
- },
94
- mainCssChunkMatcher: createMainCssChunkMatcher(),
95
- wxsMatcher: alwaysFalse,
96
- cssPreflight: getDefaultCssPreflight(3),
97
- disabled: false,
98
- onLoad: _weapp_tailwindcss_shared.noop,
99
- onStart: _weapp_tailwindcss_shared.noop,
100
- onEnd: _weapp_tailwindcss_shared.noop,
101
- onUpdate: _weapp_tailwindcss_shared.noop,
102
- customAttributes: {},
103
- customReplaceDictionary: _weapp_core_escape.MappingChars2String,
104
- appType: void 0,
105
- arbitraryValues: {
106
- allowDoubleQuotes: false,
107
- bareArbitraryValues: false
108
- },
109
- cssChildCombinatorReplaceValue: ["view", "text"],
110
- inlineWxs: false,
111
- injectAdditionalCssVarScope: false,
112
- jsPreserveClass: (keyword) => {
113
- /**
114
- * 默认保留 keyword
115
- */
116
- if (keyword === "*") return true;
117
- return false;
118
- },
119
- disabledDefaultTemplateHandler: false,
120
- cssSelectorReplacement: {
121
- root: [
122
- "page",
123
- ".tw-root",
124
- "wx-root-portal-content"
125
- ],
126
- universal: ["view", "text"]
127
- },
128
- babelParserOptions: {
129
- sourceType: "unambiguous",
130
- cache: true,
131
- cacheKey: "st:unambiguous"
132
- },
133
- postcssOptions: {},
134
- cssRemoveProperty: true,
135
- cssRemoveHoverPseudoClass: true,
136
- ignoreCallExpressionIdentifiers: [],
137
- ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
138
- replaceRuntimePackages: false,
139
- generator: { target: "weapp" },
140
- tailwindcssPatcherOptions: { filter(className) {
141
- return !(0, _weapp_core_escape.isAllowedClassName)(className);
142
- } },
143
- logLevel: "info"
144
- };
145
- }
146
- //#endregion
147
- exports.TAILWIND_V3_CSS_PREFLIGHT = TAILWIND_V3_CSS_PREFLIGHT;
148
- exports.TAILWIND_V4_CSS_PREFLIGHT = TAILWIND_V4_CSS_PREFLIGHT;
149
- exports.getDefaultCssPreflight = getDefaultCssPreflight;
150
- exports.getDefaultOptions = getDefaultOptions;
151
- exports.resolveDefaultCssPreflight = resolveDefaultCssPreflight;
2
+ const require_defaults = require("./defaults-zKUH2mDe.js");
3
+ exports.TAILWIND_V3_CSS_PREFLIGHT = require_defaults.TAILWIND_V3_CSS_PREFLIGHT;
4
+ exports.TAILWIND_V4_CSS_PREFLIGHT = require_defaults.TAILWIND_V4_CSS_PREFLIGHT;
5
+ exports.getDefaultCssPreflight = require_defaults.getDefaultCssPreflight;
6
+ exports.getDefaultOptions = require_defaults.getDefaultOptions;
7
+ exports.resolveDefaultCssPreflight = require_defaults.resolveDefaultCssPreflight;
package/dist/defaults.mjs CHANGED
@@ -1,144 +1,2 @@
1
- import { a as noop } from "./utils-Btw1iOVV.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)
29
- };
30
- const alwaysFalse = () => false;
31
- const TAILWIND_V3_CSS_PREFLIGHT = {
32
- "box-sizing": "border-box",
33
- "border-width": "0",
34
- "border-style": "solid",
35
- "border-color": "currentColor"
36
- };
37
- const TAILWIND_V4_CSS_PREFLIGHT = {
38
- "box-sizing": "border-box",
39
- "margin": "0",
40
- "padding": "0",
41
- "border": "0 solid"
42
- };
43
- function getDefaultCssPreflight(tailwindcssMajorVersion) {
44
- return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
45
- }
46
- function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
47
- if (cssPreflight === false) return false;
48
- return {
49
- ...getDefaultCssPreflight(tailwindcssMajorVersion),
50
- ...cssPreflight ?? {}
51
- };
52
- }
53
- function createMainCssChunkMatcher() {
54
- return (file, appType) => {
55
- if (!appType) {
56
- const normalized = normalizePath(file);
57
- return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
58
- }
59
- const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
60
- return matcher ? matcher(file) : true;
61
- };
62
- }
63
- function getDefaultOptions() {
64
- return {
65
- /**
66
- * wxss 微信小程序
67
- * acss 支付宝小程序
68
- * jxss 京东小程序
69
- * ttss 头条小程序
70
- * qss QQ小程序
71
- * css 最正常的样式文件
72
- * tyss 涂鸦小程序
73
- */
74
- cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
75
- /**
76
- * wxml 微信小程序
77
- * axml 支付宝小程序
78
- * jxml 京东小程序
79
- * ksml 快手小程序
80
- * ttml 头条小程序
81
- * qml QQ小程序
82
- * tyml 涂鸦小程序
83
- * xhsml 小红书小程序
84
- * swan 百度小程序
85
- */
86
- htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
87
- jsMatcher: (file) => {
88
- if (file.includes("node_modules")) return false;
89
- return JS_FILE_PATTERN.test(file);
90
- },
91
- mainCssChunkMatcher: createMainCssChunkMatcher(),
92
- wxsMatcher: alwaysFalse,
93
- cssPreflight: getDefaultCssPreflight(3),
94
- disabled: false,
95
- onLoad: noop,
96
- onStart: noop,
97
- onEnd: noop,
98
- onUpdate: noop,
99
- customAttributes: {},
100
- customReplaceDictionary: MappingChars2String,
101
- appType: void 0,
102
- arbitraryValues: {
103
- allowDoubleQuotes: false,
104
- bareArbitraryValues: false
105
- },
106
- cssChildCombinatorReplaceValue: ["view", "text"],
107
- inlineWxs: false,
108
- injectAdditionalCssVarScope: false,
109
- jsPreserveClass: (keyword) => {
110
- /**
111
- * 默认保留 keyword
112
- */
113
- if (keyword === "*") return true;
114
- return false;
115
- },
116
- disabledDefaultTemplateHandler: false,
117
- cssSelectorReplacement: {
118
- root: [
119
- "page",
120
- ".tw-root",
121
- "wx-root-portal-content"
122
- ],
123
- universal: ["view", "text"]
124
- },
125
- babelParserOptions: {
126
- sourceType: "unambiguous",
127
- cache: true,
128
- cacheKey: "st:unambiguous"
129
- },
130
- postcssOptions: {},
131
- cssRemoveProperty: true,
132
- cssRemoveHoverPseudoClass: true,
133
- ignoreCallExpressionIdentifiers: [],
134
- ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
135
- replaceRuntimePackages: false,
136
- generator: { target: "weapp" },
137
- tailwindcssPatcherOptions: { filter(className) {
138
- return !isAllowedClassName(className);
139
- } },
140
- logLevel: "info"
141
- };
142
- }
143
- //#endregion
1
+ import { a as resolveDefaultCssPreflight, i as getDefaultOptions, n as TAILWIND_V4_CSS_PREFLIGHT, r as getDefaultCssPreflight, t as TAILWIND_V3_CSS_PREFLIGHT } from "./defaults-8xrgzxFY.mjs";
144
2
  export { TAILWIND_V3_CSS_PREFLIGHT, TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
package/dist/escape.js CHANGED
@@ -1,5 +1,13 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _weapp_core_escape = require("@weapp-core/escape");
3
+ //#region src/utils/object.ts
4
+ function definedEntries(value) {
5
+ return Object.entries(value).filter(([, item]) => item !== void 0);
6
+ }
7
+ function omitUndefined(value) {
8
+ return Object.fromEntries(definedEntries(value));
9
+ }
10
+ //#endregion
3
11
  //#region src/wxml/shared.ts
4
12
  const NEWLINE_RE = /[\n\r]+/g;
5
13
  function replaceWxml(original, options = {
@@ -9,10 +17,10 @@ function replaceWxml(original, options = {
9
17
  const { keepEOL, escapeMap, ignoreHead } = options;
10
18
  let res = original;
11
19
  if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
12
- res = (0, _weapp_core_escape.escape)(res, {
20
+ res = (0, _weapp_core_escape.escape)(res, omitUndefined({
13
21
  map: escapeMap,
14
22
  ignoreHead
15
- });
23
+ }));
16
24
  return res;
17
25
  }
18
26
  //#endregion
package/dist/escape.mjs CHANGED
@@ -1,4 +1,12 @@
1
1
  import { MappingChars2String, escape, isAllowedClassName, unescape } from "@weapp-core/escape";
2
+ //#region src/utils/object.ts
3
+ function definedEntries(value) {
4
+ return Object.entries(value).filter(([, item]) => item !== void 0);
5
+ }
6
+ function omitUndefined(value) {
7
+ return Object.fromEntries(definedEntries(value));
8
+ }
9
+ //#endregion
2
10
  //#region src/wxml/shared.ts
3
11
  const NEWLINE_RE = /[\n\r]+/g;
4
12
  function replaceWxml(original, options = {
@@ -8,10 +16,10 @@ function replaceWxml(original, options = {
8
16
  const { keepEOL, escapeMap, ignoreHead } = options;
9
17
  let res = original;
10
18
  if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
11
- res = escape(res, {
19
+ res = escape(res, omitUndefined({
12
20
  map: escapeMap,
13
21
  ignoreHead
14
- });
22
+ }));
15
23
  return res;
16
24
  }
17
25
  //#endregion
@@ -1,16 +1,21 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  import type { WeappTailwindcssGeneratorTarget } from './types';
3
+ import type { IArbitraryValues } from '../types/shared';
3
4
  export interface WeappTailwindcssGeneratorOptions {
4
- target?: WeappTailwindcssGeneratorTarget;
5
- config?: string;
6
- styleOptions?: Partial<IStyleHandlerOptions>;
7
- tailwindcssV3Compatibility?: boolean;
5
+ target?: WeappTailwindcssGeneratorTarget | undefined;
6
+ config?: string | undefined;
7
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
8
+ importFallback?: boolean | undefined;
9
+ tailwindcssV3Compatibility?: boolean | undefined;
10
+ bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
8
11
  }
9
12
  export type WeappTailwindcssGeneratorUserOptions = WeappTailwindcssGeneratorOptions;
10
13
  export interface NormalizedWeappTailwindcssGeneratorOptions {
11
14
  target: WeappTailwindcssGeneratorTarget;
12
- config?: string;
13
- styleOptions?: Partial<IStyleHandlerOptions>;
15
+ config?: string | undefined;
16
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
17
+ importFallback: boolean;
14
18
  tailwindcssV3Compatibility: boolean;
19
+ bareArbitraryValues?: IArbitraryValues['bareArbitraryValues'] | undefined;
15
20
  }
16
21
  export declare function normalizeWeappTailwindcssGeneratorOptions(options: WeappTailwindcssGeneratorUserOptions | undefined): NormalizedWeappTailwindcssGeneratorOptions;
@@ -6,9 +6,9 @@ export type TailwindGeneratorVersion = 3 | 4;
6
6
  export type TailwindCandidateSource = TailwindV3CandidateSource | TailwindV4CandidateSource;
7
7
  export type TailwindResolvedSource = TailwindV3ResolvedSource | TailwindV4ResolvedSource;
8
8
  export interface WeappTailwindcssGenerateOptions extends Omit<TailwindV3GenerateOptions & TailwindV4GenerateOptions, 'target'> {
9
- target?: WeappTailwindcssGeneratorTarget;
10
- styleOptions?: Partial<IStyleHandlerOptions>;
11
- tailwindcssV3Compatibility?: boolean;
9
+ target?: WeappTailwindcssGeneratorTarget | undefined;
10
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
11
+ tailwindcssV3Compatibility?: boolean | undefined;
12
12
  }
13
13
  export type WeappTailwindcssGenerateResult = (TailwindV3GenerateResult | TailwindV4GenerateResult) & {
14
14
  target: WeappTailwindcssGeneratorTarget;
@@ -0,0 +1,92 @@
1
+ const require_chunk = require("./chunk-C5U5_Hdc.js");
2
+ const require_v3_engine = require("./v3-engine-M6Aqru5T.js");
3
+ let node_process = require("node:process");
4
+ node_process = require_chunk.__toESM(node_process);
5
+ //#region src/generator/options.ts
6
+ const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
7
+ const uniWebPlatformEnvKeys = ["UNI_PLATFORM", "UNI_UTS_PLATFORM"];
8
+ const mpxWebPlatformEnvKeys = ["MPX_CLI_MODE", "MPX_CURRENT_TARGET_MODE"];
9
+ function getEnvValue(key) {
10
+ return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
11
+ }
12
+ function normalizeGeneratorTargetValue(value) {
13
+ return value === "weapp" || value === "web" || value === "tailwind" ? value : void 0;
14
+ }
15
+ function isUniWebPlatform(value) {
16
+ const normalized = value?.trim().toLowerCase();
17
+ return normalized === "h5" || normalized?.startsWith("web") === true;
18
+ }
19
+ function isUniAppWebViewPlatform(value) {
20
+ const normalized = value?.trim().toLowerCase();
21
+ return normalized === "app" || normalized === "app-plus";
22
+ }
23
+ function isUniNativeAppPlatform(value) {
24
+ return (value?.trim().toLowerCase())?.startsWith("app-") === true;
25
+ }
26
+ function isMpxWebPlatform(value) {
27
+ return value?.trim().toLowerCase() === "web";
28
+ }
29
+ function inferGeneratorTargetFromEnv() {
30
+ for (const key of explicitGeneratorTargetEnvKeys) {
31
+ const target = normalizeGeneratorTargetValue(getEnvValue(key));
32
+ if (target !== void 0) return target;
33
+ }
34
+ if (uniWebPlatformEnvKeys.some((key) => isUniWebPlatform(getEnvValue(key))) || isUniAppWebViewPlatform(getEnvValue("UNI_PLATFORM")) && !isUniNativeAppPlatform(getEnvValue("UNI_UTS_PLATFORM")) || mpxWebPlatformEnvKeys.some((key) => isMpxWebPlatform(getEnvValue(key))) || getEnvValue("TARO_ENV") === "h5") return "web";
35
+ return "weapp";
36
+ }
37
+ function normalizeWeappTailwindcssGeneratorOptions(options) {
38
+ const target = options?.target ?? inferGeneratorTargetFromEnv();
39
+ if (options == null) return {
40
+ target,
41
+ importFallback: true,
42
+ tailwindcssV3Compatibility: target === "weapp",
43
+ bareArbitraryValues: void 0
44
+ };
45
+ return {
46
+ target,
47
+ config: options.config,
48
+ styleOptions: options.styleOptions,
49
+ importFallback: options.importFallback ?? true,
50
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility ?? target === "weapp",
51
+ bareArbitraryValues: options.bareArbitraryValues
52
+ };
53
+ }
54
+ //#endregion
55
+ //#region src/generator/index.ts
56
+ function isTailwindV3Source(source) {
57
+ return "version" in source && source.version === 3;
58
+ }
59
+ function createWeappTailwindcssGenerator(source) {
60
+ return isTailwindV3Source(source) ? require_v3_engine.createTailwindV3Engine(source) : require_v3_engine.createTailwindV4Engine(source);
61
+ }
62
+ async function resolveTailwindSourceFromPatcher(patcher) {
63
+ return patcher.majorVersion === 3 ? require_v3_engine.resolveTailwindV3SourceFromPatcher(patcher) : require_v3_engine.resolveTailwindV4SourceFromPatcher(patcher);
64
+ }
65
+ async function createWeappTailwindcssGeneratorFromPatcher(patcher) {
66
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromPatcher(patcher));
67
+ }
68
+ //#endregion
69
+ Object.defineProperty(exports, "createWeappTailwindcssGenerator", {
70
+ enumerable: true,
71
+ get: function() {
72
+ return createWeappTailwindcssGenerator;
73
+ }
74
+ });
75
+ Object.defineProperty(exports, "createWeappTailwindcssGeneratorFromPatcher", {
76
+ enumerable: true,
77
+ get: function() {
78
+ return createWeappTailwindcssGeneratorFromPatcher;
79
+ }
80
+ });
81
+ Object.defineProperty(exports, "normalizeWeappTailwindcssGeneratorOptions", {
82
+ enumerable: true,
83
+ get: function() {
84
+ return normalizeWeappTailwindcssGeneratorOptions;
85
+ }
86
+ });
87
+ Object.defineProperty(exports, "resolveTailwindSourceFromPatcher", {
88
+ enumerable: true,
89
+ get: function() {
90
+ return resolveTailwindSourceFromPatcher;
91
+ }
92
+ });
@@ -0,0 +1,67 @@
1
+ import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-DGBhUnjn.mjs";
2
+ import process from "node:process";
3
+ //#region src/generator/options.ts
4
+ const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
5
+ const uniWebPlatformEnvKeys = ["UNI_PLATFORM", "UNI_UTS_PLATFORM"];
6
+ const mpxWebPlatformEnvKeys = ["MPX_CLI_MODE", "MPX_CURRENT_TARGET_MODE"];
7
+ function getEnvValue(key) {
8
+ return typeof process === "undefined" ? void 0 : process.env[key];
9
+ }
10
+ function normalizeGeneratorTargetValue(value) {
11
+ return value === "weapp" || value === "web" || value === "tailwind" ? value : void 0;
12
+ }
13
+ function isUniWebPlatform(value) {
14
+ const normalized = value?.trim().toLowerCase();
15
+ return normalized === "h5" || normalized?.startsWith("web") === true;
16
+ }
17
+ function isUniAppWebViewPlatform(value) {
18
+ const normalized = value?.trim().toLowerCase();
19
+ return normalized === "app" || normalized === "app-plus";
20
+ }
21
+ function isUniNativeAppPlatform(value) {
22
+ return (value?.trim().toLowerCase())?.startsWith("app-") === true;
23
+ }
24
+ function isMpxWebPlatform(value) {
25
+ return value?.trim().toLowerCase() === "web";
26
+ }
27
+ function inferGeneratorTargetFromEnv() {
28
+ for (const key of explicitGeneratorTargetEnvKeys) {
29
+ const target = normalizeGeneratorTargetValue(getEnvValue(key));
30
+ if (target !== void 0) return target;
31
+ }
32
+ if (uniWebPlatformEnvKeys.some((key) => isUniWebPlatform(getEnvValue(key))) || isUniAppWebViewPlatform(getEnvValue("UNI_PLATFORM")) && !isUniNativeAppPlatform(getEnvValue("UNI_UTS_PLATFORM")) || mpxWebPlatformEnvKeys.some((key) => isMpxWebPlatform(getEnvValue(key))) || getEnvValue("TARO_ENV") === "h5") return "web";
33
+ return "weapp";
34
+ }
35
+ function normalizeWeappTailwindcssGeneratorOptions(options) {
36
+ const target = options?.target ?? inferGeneratorTargetFromEnv();
37
+ if (options == null) return {
38
+ target,
39
+ importFallback: true,
40
+ tailwindcssV3Compatibility: target === "weapp",
41
+ bareArbitraryValues: void 0
42
+ };
43
+ return {
44
+ target,
45
+ config: options.config,
46
+ styleOptions: options.styleOptions,
47
+ importFallback: options.importFallback ?? true,
48
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility ?? target === "weapp",
49
+ bareArbitraryValues: options.bareArbitraryValues
50
+ };
51
+ }
52
+ //#endregion
53
+ //#region src/generator/index.ts
54
+ function isTailwindV3Source(source) {
55
+ return "version" in source && source.version === 3;
56
+ }
57
+ function createWeappTailwindcssGenerator(source) {
58
+ return isTailwindV3Source(source) ? createTailwindV3Engine(source) : createTailwindV4Engine(source);
59
+ }
60
+ async function resolveTailwindSourceFromPatcher(patcher) {
61
+ return patcher.majorVersion === 3 ? resolveTailwindV3SourceFromPatcher(patcher) : resolveTailwindV4SourceFromPatcher(patcher);
62
+ }
63
+ async function createWeappTailwindcssGeneratorFromPatcher(patcher) {
64
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromPatcher(patcher));
65
+ }
66
+ //#endregion
67
+ export { normalizeWeappTailwindcssGeneratorOptions as i, createWeappTailwindcssGeneratorFromPatcher as n, resolveTailwindSourceFromPatcher as r, createWeappTailwindcssGenerator as t };
package/dist/generator.js CHANGED
@@ -1,19 +1,19 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./chunk-8l464Juk.js");
3
- const require_generator = require("./generator-DKkhJbOg.js");
2
+ const require_v3_engine = require("./v3-engine-M6Aqru5T.js");
3
+ const require_generator = require("./generator-CvmsIQFI.js");
4
4
  let tailwindcss_patch = require("tailwindcss-patch");
5
5
  exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
6
6
  exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
7
7
  exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
8
8
  exports.resolveTailwindSourceFromPatcher = require_generator.resolveTailwindSourceFromPatcher;
9
- exports.resolveTailwindV3Source = require_generator.resolveTailwindV3Source;
10
- exports.resolveTailwindV3SourceFromPatcher = require_generator.resolveTailwindV3SourceFromPatcher;
11
- exports.resolveTailwindV3SourceOptionsFromPatcher = require_generator.resolveTailwindV3SourceOptionsFromPatcher;
12
- exports.resolveTailwindV4Source = require_generator.resolveTailwindV4Source;
9
+ exports.resolveTailwindV3Source = require_v3_engine.resolveTailwindV3Source;
10
+ exports.resolveTailwindV3SourceFromPatcher = require_v3_engine.resolveTailwindV3SourceFromPatcher;
11
+ exports.resolveTailwindV3SourceOptionsFromPatcher = require_v3_engine.resolveTailwindV3SourceOptionsFromPatcher;
12
+ exports.resolveTailwindV4Source = require_v3_engine.resolveTailwindV4Source;
13
13
  exports.resolveTailwindV4SourceFromPatchOptions = tailwindcss_patch.resolveTailwindV4SourceFromPatchOptions;
14
- exports.resolveTailwindV4SourceFromPatcher = require_generator.resolveTailwindV4SourceFromPatcher;
15
- exports.resolveTailwindV4SourceOptionsFromPatcher = require_generator.resolveTailwindV4SourceOptionsFromPatcher;
16
- exports.transformTailwindV3CssByTarget = require_generator.transformTailwindV3CssByTarget;
17
- exports.transformTailwindV3CssToWeapp = require_generator.transformTailwindV3CssToWeapp;
18
- exports.transformTailwindV4CssByTarget = require_generator.transformTailwindV4CssByTarget;
19
- exports.transformTailwindV4CssToWeapp = require_generator.transformTailwindV4CssToWeapp;
14
+ exports.resolveTailwindV4SourceFromPatcher = require_v3_engine.resolveTailwindV4SourceFromPatcher;
15
+ exports.resolveTailwindV4SourceOptionsFromPatcher = require_v3_engine.resolveTailwindV4SourceOptionsFromPatcher;
16
+ exports.transformTailwindV3CssByTarget = require_v3_engine.transformTailwindV3CssByTarget;
17
+ exports.transformTailwindV3CssToWeapp = require_v3_engine.transformTailwindV3CssToWeapp;
18
+ exports.transformTailwindV4CssByTarget = require_v3_engine.transformTailwindV4CssByTarget;
19
+ exports.transformTailwindV4CssToWeapp = require_v3_engine.transformTailwindV4CssToWeapp;
@@ -1,2 +1,3 @@
1
- import { _ as transformTailwindV3CssToWeapp, a as resolveTailwindV4Source, c as resolveTailwindV4SourceOptionsFromPatcher, g as transformTailwindV3CssByTarget, h as resolveTailwindV3SourceOptionsFromPatcher, i as normalizeWeappTailwindcssGeneratorOptions, l as transformTailwindV4CssByTarget, m as resolveTailwindV3SourceFromPatcher, n as createWeappTailwindcssGeneratorFromPatcher, o as resolveTailwindV4SourceFromPatchOptions, p as resolveTailwindV3Source, r as resolveTailwindSourceFromPatcher, s as resolveTailwindV4SourceFromPatcher, t as createWeappTailwindcssGenerator, u as transformTailwindV4CssToWeapp } from "./generator-UBmfduYg.mjs";
1
+ import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-DGBhUnjn.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-DDtsUvkH.mjs";
2
3
  export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };