weapp-tailwindcss 5.0.0-next.2 → 5.0.0-next.20

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 (220) hide show
  1. package/README.md +6 -7
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/bundle-state-BlXvU4jl.js +530 -0
  4. package/dist/bundle-state-PO6MysTJ.mjs +414 -0
  5. package/dist/bundlers/shared/cache.d.ts +6 -6
  6. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
  7. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
  8. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +5 -0
  9. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  10. package/dist/bundlers/shared/css-cleanup.d.ts +7 -3
  11. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  12. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  13. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  14. package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
  15. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  16. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  17. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  18. package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
  19. package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
  20. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
  21. package/dist/bundlers/shared/generator-css.d.ts +16 -22
  22. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  23. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  24. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  25. package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
  26. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  27. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
  28. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
  29. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  30. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  31. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  32. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  33. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  34. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  35. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  36. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  37. package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
  38. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
  39. package/dist/bundlers/vite/index.d.ts +1 -1
  40. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  41. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  42. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  43. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
  44. package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
  45. package/dist/bundlers/vite/source-candidates.d.ts +16 -1
  46. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  47. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  48. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  49. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  50. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
  51. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
  52. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
  53. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  54. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
  55. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  56. package/dist/cache/index.d.ts +6 -6
  57. package/dist/cli/context.d.ts +1 -14
  58. package/dist/cli/doctor/types.d.ts +11 -11
  59. package/dist/cli/helpers.d.ts +1 -2
  60. package/dist/cli/mount-options.d.ts +2 -0
  61. package/dist/cli/types.d.ts +0 -2
  62. package/dist/cli/vscode-entry.d.ts +3 -3
  63. package/dist/cli.js +605 -611
  64. package/dist/cli.mjs +614 -620
  65. package/dist/constants.d.ts +1 -2
  66. package/dist/core.js +13 -20
  67. package/dist/core.mjs +8 -14
  68. package/dist/css-macro/postcss.js +3 -2
  69. package/dist/css-macro/postcss.mjs +3 -2
  70. package/dist/css-macro.d.ts +1 -0
  71. package/dist/css-macro.js +2 -2
  72. package/dist/css-macro.mjs +2 -2
  73. package/dist/defaults-B1igPF_e.mjs +150 -0
  74. package/dist/defaults-IHhYxNeU.js +193 -0
  75. package/dist/defaults.d.ts +15 -1
  76. package/dist/defaults.js +6 -131
  77. package/dist/defaults.mjs +2 -129
  78. package/dist/escape.js +10 -2
  79. package/dist/escape.mjs +10 -2
  80. package/dist/generator/index.d.ts +1 -1
  81. package/dist/generator/options.d.ts +9 -8
  82. package/dist/generator/types.d.ts +3 -3
  83. package/dist/generator-DIuglJub.mjs +32 -0
  84. package/dist/generator-N4jy1HCk.js +55 -0
  85. package/dist/generator.js +12 -11
  86. package/dist/generator.mjs +2 -1
  87. package/dist/gulp.js +185 -47
  88. package/dist/gulp.mjs +179 -41
  89. package/dist/incremental-runtime-class-set-CJ0Pnsw2.js +2348 -0
  90. package/dist/incremental-runtime-class-set-hF-uiw6W.mjs +2285 -0
  91. package/dist/index.d.ts +1 -1
  92. package/dist/index.js +6 -6
  93. package/dist/index.mjs +5 -5
  94. package/dist/js/babel/cache-options.d.ts +3 -0
  95. package/dist/js/babel/parse.d.ts +7 -4
  96. package/dist/js/index.d.ts +1 -0
  97. package/dist/js/literal-transform.d.ts +2 -0
  98. package/dist/js/precheck.d.ts +2 -2
  99. package/dist/lightningcss/style-handler/selector-transform.d.ts +1 -1
  100. package/dist/lightningcss/style-handler.d.ts +3 -3
  101. package/dist/logger-CZUxvJJD.mjs +2 -0
  102. package/dist/logger-EVNB9z7i.js +1 -0
  103. package/dist/postcss/config-directive.d.ts +1 -0
  104. package/dist/postcss/context.d.ts +9 -0
  105. package/dist/postcss/source-files.d.ts +8 -0
  106. package/dist/postcss/tailwind-version.d.ts +3 -0
  107. package/dist/postcss-D4UdbBQ6.mjs +228 -0
  108. package/dist/postcss-DlY-YRvA.js +237 -0
  109. package/dist/postcss.d.ts +2 -2
  110. package/dist/postcss.js +3 -276
  111. package/dist/postcss.mjs +1 -269
  112. package/dist/{recorder-gYSNLfOP.js → precheck-BjEbVEpX.js} +218 -314
  113. package/dist/{recorder-zsgatmkB.mjs → precheck-tbk626YL.mjs} +186 -281
  114. package/dist/presets.js +13 -11
  115. package/dist/presets.mjs +11 -9
  116. package/dist/reset.d.ts +1 -0
  117. package/dist/runtime-registry-D5qnaSpo.js +5516 -0
  118. package/dist/shared/mpx.d.ts +1 -0
  119. package/dist/source-candidates-BrvneDDd.mjs +209 -0
  120. package/dist/source-candidates-gxijpPI3.js +222 -0
  121. package/dist/tailwindcss/miniprogram.d.ts +5 -1
  122. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  123. package/dist/tailwindcss/patcher.d.ts +1 -2
  124. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  125. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  126. package/dist/tailwindcss/runtime.d.ts +11 -12
  127. package/dist/tailwindcss/source-scan.d.ts +35 -0
  128. package/dist/tailwindcss/targets.d.ts +1 -5
  129. package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
  130. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  131. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  132. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  133. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  134. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  135. package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
  136. package/dist/tailwindcss/version.d.ts +4 -0
  137. package/dist/tailwindcss-BhG7BtB-.js +651 -0
  138. package/dist/tailwindcss-c6ROlNNW.mjs +600 -0
  139. package/dist/typedoc.export.d.ts +0 -2
  140. package/dist/types/index.d.ts +51 -48
  141. package/dist/types/shared.d.ts +3 -0
  142. package/dist/types/user-defined-options/general.d.ts +23 -23
  143. package/dist/types/user-defined-options/important.d.ts +31 -28
  144. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  145. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  146. package/dist/uni-app-x/vite.d.ts +1 -1
  147. package/dist/utils/disabled.d.ts +2 -3
  148. package/dist/utils/object.d.ts +9 -0
  149. package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
  150. package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
  151. package/dist/v3-engine-5LoZUH-4.js +3695 -0
  152. package/dist/v3-engine-DIXDEDmL.mjs +3406 -0
  153. package/dist/{vite-CrlzCNqz.mjs → vite-B5faZcbE.mjs} +1256 -1088
  154. package/dist/vite-MyXBNux0.js +2368 -0
  155. package/dist/vite.d.ts +1 -2
  156. package/dist/vite.js +3 -4
  157. package/dist/vite.mjs +2 -2
  158. package/dist/weapp-tw-css-import-rewrite-loader.js +5157 -16
  159. package/dist/weapp-tw-runtime-classset-loader.js +32 -7
  160. package/dist/webpack-BnVyDmsD.mjs +836 -0
  161. package/dist/webpack-Mz1V0A9p.js +846 -0
  162. package/dist/webpack.js +1 -1
  163. package/dist/webpack.mjs +1 -1
  164. package/package.json +27 -37
  165. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  166. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  167. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  168. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  169. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  170. package/dist/cli/config.d.ts +0 -5
  171. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  172. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  173. package/dist/cli/patch-options.d.ts +0 -6
  174. package/dist/cli/tokens.d.ts +0 -4
  175. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  176. package/dist/cli/workspace/patch-package.d.ts +0 -3
  177. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  178. package/dist/cli/workspace/types.d.ts +0 -11
  179. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  180. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  181. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  182. package/dist/cli/workspace.d.ts +0 -2
  183. package/dist/css-imports-BbrbluP9.js +0 -177
  184. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  185. package/dist/experimental/index.d.ts +0 -2
  186. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  187. package/dist/experimental/oxc/index.d.ts +0 -2
  188. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  189. package/dist/experimental/shared/cache.d.ts +0 -3
  190. package/dist/experimental/shared/transform.d.ts +0 -3
  191. package/dist/experimental/shared.d.ts +0 -8
  192. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  193. package/dist/experimental/swc/index.d.ts +0 -2
  194. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  195. package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
  196. package/dist/generator-css-B5ejWUMv.mjs +0 -1098
  197. package/dist/generator-css-D3OdPRiS.js +0 -1125
  198. package/dist/generator-mmhXzZnv.js +0 -1276
  199. package/dist/js/syntax.d.ts +0 -10
  200. package/dist/loader-anchors-CNkWT8hx.js +0 -273
  201. package/dist/loader-anchors-TrU7EUr7.mjs +0 -205
  202. package/dist/logger-BZ45DZJT.js +0 -1003
  203. package/dist/logger-BoVx1Dbt.mjs +0 -935
  204. package/dist/patcher-options-6gJN2EXy.js +0 -115
  205. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  206. package/dist/tailwindcss/recorder.d.ts +0 -13
  207. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  208. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  209. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  210. package/dist/tailwindcss/targets/types.d.ts +0 -35
  211. package/dist/types/disabled-options.d.ts +0 -4
  212. package/dist/vite-BC9U7ahn.js +0 -2199
  213. package/dist/webpack-Bu6M-Hbw.mjs +0 -441
  214. package/dist/webpack-DD7A6V0u.js +0 -456
  215. package/dist/webpack4.d.ts +0 -4
  216. package/dist/webpack4.js +0 -387
  217. package/dist/webpack4.mjs +0 -379
  218. package/scripts/postinstall.mjs +0 -59
  219. /package/dist/{constants-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
  220. /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
package/dist/defaults.js CHANGED
@@ -1,132 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- require("./chunk-8l464Juk.js");
3
- require("./utils-DmC9_In3.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
- function createMainCssChunkMatcher() {
35
- return (file, appType) => {
36
- if (!appType) {
37
- const normalized = normalizePath(file);
38
- return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
39
- }
40
- const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
41
- return matcher ? matcher(file) : true;
42
- };
43
- }
44
- function getDefaultOptions() {
45
- return {
46
- /**
47
- * wxss 微信小程序
48
- * acss 支付宝小程序
49
- * jxss 京东小程序
50
- * ttss 头条小程序
51
- * qss QQ小程序
52
- * css 最正常的样式文件
53
- * tyss 涂鸦小程序
54
- */
55
- cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
56
- /**
57
- * wxml 微信小程序
58
- * axml 支付宝小程序
59
- * jxml 京东小程序
60
- * ksml 快手小程序
61
- * ttml 头条小程序
62
- * qml QQ小程序
63
- * tyml 涂鸦小程序
64
- * xhsml 小红书小程序
65
- * swan 百度小程序
66
- */
67
- htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
68
- jsMatcher: (file) => {
69
- if (file.includes("node_modules")) return false;
70
- return JS_FILE_PATTERN.test(file);
71
- },
72
- mainCssChunkMatcher: createMainCssChunkMatcher(),
73
- wxsMatcher: alwaysFalse,
74
- cssPreflight: {
75
- "box-sizing": "border-box",
76
- "border-width": "0",
77
- "border-style": "solid",
78
- "border-color": "currentColor"
79
- },
80
- disabled: false,
81
- onLoad: _weapp_tailwindcss_shared.noop,
82
- onStart: _weapp_tailwindcss_shared.noop,
83
- onEnd: _weapp_tailwindcss_shared.noop,
84
- onUpdate: _weapp_tailwindcss_shared.noop,
85
- customAttributes: {},
86
- customReplaceDictionary: _weapp_core_escape.MappingChars2String,
87
- appType: void 0,
88
- arbitraryValues: { allowDoubleQuotes: false },
89
- cssChildCombinatorReplaceValue: ["view", "text"],
90
- inlineWxs: false,
91
- injectAdditionalCssVarScope: false,
92
- rewriteCssImports: true,
93
- jsPreserveClass: (keyword) => {
94
- /**
95
- * 默认保留 keyword
96
- */
97
- if (keyword === "*") return true;
98
- return false;
99
- },
100
- staleClassNameFallback: void 0,
101
- disabledDefaultTemplateHandler: false,
102
- cssSelectorReplacement: {
103
- root: [
104
- "page",
105
- ".tw-root",
106
- "wx-root-portal-content"
107
- ],
108
- universal: ["view", "text"]
109
- },
110
- babelParserOptions: {
111
- sourceType: "unambiguous",
112
- cache: true,
113
- cacheKey: "st:unambiguous"
114
- },
115
- postcssOptions: {},
116
- cssRemoveProperty: true,
117
- cssRemoveHoverPseudoClass: true,
118
- ignoreCallExpressionIdentifiers: [],
119
- ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
120
- replaceRuntimePackages: false,
121
- generator: {
122
- mode: "auto",
123
- target: "weapp"
124
- },
125
- tailwindcssPatcherOptions: { filter(className) {
126
- return !(0, _weapp_core_escape.isAllowedClassName)(className);
127
- } },
128
- logLevel: "info"
129
- };
130
- }
131
- //#endregion
132
- exports.getDefaultOptions = getDefaultOptions;
2
+ const require_defaults = require("./defaults-IHhYxNeU.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,129 +1,2 @@
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)
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 };
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-B1igPF_e.mjs";
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
@@ -7,5 +7,5 @@ export declare function resolveTailwindSourceFromPatcher(patcher: TailwindcssPat
7
7
  export declare function createWeappTailwindcssGeneratorFromPatcher(patcher: TailwindcssPatcherLike): Promise<WeappTailwindcssGenerator>;
8
8
  export { normalizeWeappTailwindcssGeneratorOptions, } from './options';
9
9
  export { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
10
- export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorMode, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
10
+ export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
11
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';
@@ -1,17 +1,18 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  import type { WeappTailwindcssGeneratorTarget } from './types';
3
- export type WeappTailwindcssGeneratorMode = 'auto' | 'force' | 'off';
4
3
  export interface WeappTailwindcssGeneratorOptions {
5
- mode?: WeappTailwindcssGeneratorMode;
6
- target?: WeappTailwindcssGeneratorTarget;
7
- styleOptions?: Partial<IStyleHandlerOptions>;
8
- tailwindcssV3Compatibility?: boolean;
4
+ target?: WeappTailwindcssGeneratorTarget | undefined;
5
+ config?: string | undefined;
6
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
7
+ importFallback?: boolean | undefined;
8
+ tailwindcssV3Compatibility?: boolean | undefined;
9
9
  }
10
- export type WeappTailwindcssGeneratorUserOptions = boolean | WeappTailwindcssGeneratorOptions;
10
+ export type WeappTailwindcssGeneratorUserOptions = WeappTailwindcssGeneratorOptions;
11
11
  export interface NormalizedWeappTailwindcssGeneratorOptions {
12
- mode: WeappTailwindcssGeneratorMode;
13
12
  target: WeappTailwindcssGeneratorTarget;
14
- styleOptions?: Partial<IStyleHandlerOptions>;
13
+ config?: string | undefined;
14
+ styleOptions?: Partial<IStyleHandlerOptions> | undefined;
15
+ importFallback: boolean;
15
16
  tailwindcssV3Compatibility: boolean;
16
17
  }
17
18
  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,32 @@
1
+ import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-DIXDEDmL.mjs";
2
+ //#region src/generator/options.ts
3
+ function normalizeWeappTailwindcssGeneratorOptions(options) {
4
+ if (options == null) return {
5
+ target: "weapp",
6
+ importFallback: true,
7
+ tailwindcssV3Compatibility: true
8
+ };
9
+ return {
10
+ target: options.target ?? "weapp",
11
+ config: options.config,
12
+ styleOptions: options.styleOptions,
13
+ importFallback: options.importFallback ?? true,
14
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility ?? (options.target ?? "weapp") === "weapp"
15
+ };
16
+ }
17
+ //#endregion
18
+ //#region src/generator/index.ts
19
+ function isTailwindV3Source(source) {
20
+ return "version" in source && source.version === 3;
21
+ }
22
+ function createWeappTailwindcssGenerator(source) {
23
+ return isTailwindV3Source(source) ? createTailwindV3Engine(source) : createTailwindV4Engine(source);
24
+ }
25
+ async function resolveTailwindSourceFromPatcher(patcher) {
26
+ return patcher.majorVersion === 3 ? resolveTailwindV3SourceFromPatcher(patcher) : resolveTailwindV4SourceFromPatcher(patcher);
27
+ }
28
+ async function createWeappTailwindcssGeneratorFromPatcher(patcher) {
29
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromPatcher(patcher));
30
+ }
31
+ //#endregion
32
+ export { normalizeWeappTailwindcssGeneratorOptions as i, createWeappTailwindcssGeneratorFromPatcher as n, resolveTailwindSourceFromPatcher as r, createWeappTailwindcssGenerator as t };
@@ -0,0 +1,55 @@
1
+ const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
2
+ //#region src/generator/options.ts
3
+ function normalizeWeappTailwindcssGeneratorOptions(options) {
4
+ if (options == null) return {
5
+ target: "weapp",
6
+ importFallback: true,
7
+ tailwindcssV3Compatibility: true
8
+ };
9
+ return {
10
+ target: options.target ?? "weapp",
11
+ config: options.config,
12
+ styleOptions: options.styleOptions,
13
+ importFallback: options.importFallback ?? true,
14
+ tailwindcssV3Compatibility: options.tailwindcssV3Compatibility ?? (options.target ?? "weapp") === "weapp"
15
+ };
16
+ }
17
+ //#endregion
18
+ //#region src/generator/index.ts
19
+ function isTailwindV3Source(source) {
20
+ return "version" in source && source.version === 3;
21
+ }
22
+ function createWeappTailwindcssGenerator(source) {
23
+ return isTailwindV3Source(source) ? require_v3_engine.createTailwindV3Engine(source) : require_v3_engine.createTailwindV4Engine(source);
24
+ }
25
+ async function resolveTailwindSourceFromPatcher(patcher) {
26
+ return patcher.majorVersion === 3 ? require_v3_engine.resolveTailwindV3SourceFromPatcher(patcher) : require_v3_engine.resolveTailwindV4SourceFromPatcher(patcher);
27
+ }
28
+ async function createWeappTailwindcssGeneratorFromPatcher(patcher) {
29
+ return createWeappTailwindcssGenerator(await resolveTailwindSourceFromPatcher(patcher));
30
+ }
31
+ //#endregion
32
+ Object.defineProperty(exports, "createWeappTailwindcssGenerator", {
33
+ enumerable: true,
34
+ get: function() {
35
+ return createWeappTailwindcssGenerator;
36
+ }
37
+ });
38
+ Object.defineProperty(exports, "createWeappTailwindcssGeneratorFromPatcher", {
39
+ enumerable: true,
40
+ get: function() {
41
+ return createWeappTailwindcssGeneratorFromPatcher;
42
+ }
43
+ });
44
+ Object.defineProperty(exports, "normalizeWeappTailwindcssGeneratorOptions", {
45
+ enumerable: true,
46
+ get: function() {
47
+ return normalizeWeappTailwindcssGeneratorOptions;
48
+ }
49
+ });
50
+ Object.defineProperty(exports, "resolveTailwindSourceFromPatcher", {
51
+ enumerable: true,
52
+ get: function() {
53
+ return resolveTailwindSourceFromPatcher;
54
+ }
55
+ });
package/dist/generator.js CHANGED
@@ -1,19 +1,20 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./chunk-8l464Juk.js");
3
- const require_generator = require("./generator-mmhXzZnv.js");
3
+ const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
4
+ const require_generator = require("./generator-N4jy1HCk.js");
4
5
  let tailwindcss_patch = require("tailwindcss-patch");
5
6
  exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
6
7
  exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
7
8
  exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
8
9
  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;
10
+ exports.resolveTailwindV3Source = require_v3_engine.resolveTailwindV3Source;
11
+ exports.resolveTailwindV3SourceFromPatcher = require_v3_engine.resolveTailwindV3SourceFromPatcher;
12
+ exports.resolveTailwindV3SourceOptionsFromPatcher = require_v3_engine.resolveTailwindV3SourceOptionsFromPatcher;
13
+ exports.resolveTailwindV4Source = require_v3_engine.resolveTailwindV4Source;
13
14
  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;
15
+ exports.resolveTailwindV4SourceFromPatcher = require_v3_engine.resolveTailwindV4SourceFromPatcher;
16
+ exports.resolveTailwindV4SourceOptionsFromPatcher = require_v3_engine.resolveTailwindV4SourceOptionsFromPatcher;
17
+ exports.transformTailwindV3CssByTarget = require_v3_engine.transformTailwindV3CssByTarget;
18
+ exports.transformTailwindV3CssToWeapp = require_v3_engine.transformTailwindV3CssToWeapp;
19
+ exports.transformTailwindV4CssByTarget = require_v3_engine.transformTailwindV4CssByTarget;
20
+ 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-Y-Ikv4Fu.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-DIXDEDmL.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-DIuglJub.mjs";
2
3
  export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };