weapp-tailwindcss 5.0.0-next.1 → 5.0.0-next.11

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 (215) hide show
  1. package/README.md +4 -5
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/bundle-state-BRkhpjio.js +448 -0
  4. package/dist/bundle-state-BrtFgX-A.mjs +369 -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 +4 -0
  9. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  10. package/dist/bundlers/shared/css-cleanup.d.ts +1 -2
  11. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  12. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  13. package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
  14. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  15. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  16. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  17. package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
  18. package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
  19. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
  20. package/dist/bundlers/shared/generator-css.d.ts +12 -20
  21. package/dist/bundlers/shared/hmr-timing.d.ts +5 -0
  22. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  23. package/dist/bundlers/vite/css-finalizer.d.ts +4 -1
  24. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  25. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
  26. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
  27. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  28. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  29. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  30. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  31. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  32. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  33. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  34. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  35. package/dist/bundlers/vite/generate-bundle.d.ts +16 -2
  36. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +4 -1
  37. package/dist/bundlers/vite/index.d.ts +1 -1
  38. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  39. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  40. package/dist/bundlers/vite/rewrite-css-imports.d.ts +5 -3
  41. package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
  42. package/dist/bundlers/vite/source-candidates.d.ts +18 -0
  43. package/dist/bundlers/vite/source-scan.d.ts +9 -0
  44. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  45. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
  46. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -2
  47. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +4 -3
  48. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
  49. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -1
  50. package/dist/cache/index.d.ts +6 -6
  51. package/dist/cache-B_9E7FxF.js +517 -0
  52. package/dist/cache-DEDxBMIw.mjs +443 -0
  53. package/dist/cli/context.d.ts +1 -14
  54. package/dist/cli/doctor/types.d.ts +11 -11
  55. package/dist/cli/helpers.d.ts +1 -2
  56. package/dist/cli/mount-options.d.ts +2 -0
  57. package/dist/cli/types.d.ts +0 -2
  58. package/dist/cli/vscode-entry.d.ts +3 -3
  59. package/dist/cli.js +126 -602
  60. package/dist/cli.mjs +135 -610
  61. package/dist/constants.d.ts +1 -2
  62. package/dist/core.js +13 -20
  63. package/dist/core.mjs +8 -14
  64. package/dist/css-macro/postcss.js +3 -2
  65. package/dist/css-macro/postcss.mjs +3 -2
  66. package/dist/css-macro.d.ts +1 -0
  67. package/dist/css-macro.js +2 -2
  68. package/dist/css-macro.mjs +2 -2
  69. package/dist/defaults.d.ts +15 -1
  70. package/dist/defaults.js +33 -14
  71. package/dist/defaults.mjs +30 -15
  72. package/dist/escape.js +10 -2
  73. package/dist/escape.mjs +10 -2
  74. package/dist/generator/index.d.ts +1 -1
  75. package/dist/generator/options.d.ts +10 -7
  76. package/dist/generator/types.d.ts +3 -2
  77. package/dist/generator-CahkD2vq.mjs +1469 -0
  78. package/dist/generator-Ck1Dd1V0.js +1568 -0
  79. package/dist/generator.js +1 -1
  80. package/dist/generator.mjs +1 -1
  81. package/dist/gulp.js +149 -47
  82. package/dist/gulp.mjs +144 -42
  83. package/dist/incremental-runtime-class-set-CBMefNHQ.js +1744 -0
  84. package/dist/incremental-runtime-class-set-DaS2yw5c.mjs +1687 -0
  85. package/dist/index.d.ts +1 -1
  86. package/dist/index.js +6 -6
  87. package/dist/index.mjs +5 -5
  88. package/dist/js/index.d.ts +1 -0
  89. package/dist/js/literal-transform.d.ts +2 -0
  90. package/dist/js/precheck.d.ts +2 -2
  91. package/dist/lightningcss/style-handler/selector-transform.d.ts +1 -1
  92. package/dist/lightningcss/style-handler.d.ts +3 -3
  93. package/dist/logger-CZUxvJJD.mjs +2 -0
  94. package/dist/logger-EVNB9z7i.js +1 -0
  95. package/dist/postcss/config-directive.d.ts +1 -0
  96. package/dist/postcss/context.d.ts +9 -0
  97. package/dist/postcss/source-files.d.ts +8 -0
  98. package/dist/postcss/tailwind-version.d.ts +3 -0
  99. package/dist/postcss-BdcRlSpp.js +243 -0
  100. package/dist/postcss-Bs-RbNzK.js +5477 -0
  101. package/dist/postcss-xZDiTRII.mjs +234 -0
  102. package/dist/postcss.d.ts +2 -2
  103. package/dist/postcss.js +3 -274
  104. package/dist/postcss.mjs +1 -267
  105. package/dist/{recorder-rn_2v_nd.js → precheck-D5eEdqeH.js} +168 -304
  106. package/dist/{recorder-B_XyZ576.mjs → precheck-DtBGFS-n.mjs} +134 -269
  107. package/dist/presets.js +13 -11
  108. package/dist/presets.mjs +11 -9
  109. package/dist/reset.d.ts +1 -0
  110. package/dist/runtime-patch-CqB-A4zA.js +85 -0
  111. package/dist/runtime-patch-DGKsVkiG.mjs +71 -0
  112. package/dist/shared/mpx.d.ts +1 -0
  113. package/dist/source-scan-CIVTa3Cj.js +297 -0
  114. package/dist/source-scan-CJ0y0XBj.mjs +258 -0
  115. package/dist/tailwindcss/miniprogram.d.ts +5 -1
  116. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  117. package/dist/tailwindcss/patcher.d.ts +1 -2
  118. package/dist/tailwindcss/runtime/cache.d.ts +3 -3
  119. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  120. package/dist/tailwindcss/runtime.d.ts +11 -12
  121. package/dist/tailwindcss/source-scan.d.ts +25 -0
  122. package/dist/tailwindcss/targets.d.ts +1 -5
  123. package/dist/tailwindcss/v3-engine/types.d.ts +14 -14
  124. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  125. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  126. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  127. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  128. package/dist/tailwindcss/v4-engine/candidates.d.ts +2 -0
  129. package/dist/tailwindcss/v4-engine/miniprogram.d.ts +1 -0
  130. package/dist/tailwindcss/v4-engine/tailwind-v3-compatibility.d.ts +1 -0
  131. package/dist/tailwindcss/v4-engine/tailwind-v3-default-colors.d.ts +1 -0
  132. package/dist/tailwindcss/v4-engine/tailwind-v4-default-colors.d.ts +1 -0
  133. package/dist/tailwindcss/v4-engine/types.d.ts +6 -3
  134. package/dist/tailwindcss/version.d.ts +4 -0
  135. package/dist/tailwindcss-B78nj6n7.js +644 -0
  136. package/dist/tailwindcss-DGM8lHUj.mjs +593 -0
  137. package/dist/typedoc.export.d.ts +0 -2
  138. package/dist/types/index.d.ts +45 -48
  139. package/dist/types/shared.d.ts +3 -0
  140. package/dist/types/user-defined-options/general.d.ts +21 -23
  141. package/dist/types/user-defined-options/important.d.ts +31 -28
  142. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  143. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  144. package/dist/uni-app-x/vite.d.ts +1 -1
  145. package/dist/utils/disabled.d.ts +2 -3
  146. package/dist/utils/object.d.ts +9 -0
  147. package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
  148. package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
  149. package/dist/{vite-BHpAqldo.js → vite-BEj9JOOA.js} +1245 -876
  150. package/dist/{vite-C8JlHiyR.mjs → vite-C8S1wfyQ.mjs} +1208 -842
  151. package/dist/vite.d.ts +1 -2
  152. package/dist/vite.js +3 -4
  153. package/dist/vite.mjs +2 -2
  154. package/dist/weapp-tw-css-import-rewrite-loader.js +129 -15
  155. package/dist/weapp-tw-runtime-classset-loader.js +44 -6
  156. package/dist/webpack-Dm1IXTIh.js +778 -0
  157. package/dist/webpack-ZGIKKpFf.mjs +768 -0
  158. package/dist/webpack.js +1 -1
  159. package/dist/webpack.mjs +1 -1
  160. package/package.json +26 -39
  161. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  162. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  163. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  164. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  165. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  166. package/dist/cli/config.d.ts +0 -5
  167. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  168. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  169. package/dist/cli/patch-options.d.ts +0 -6
  170. package/dist/cli/tokens.d.ts +0 -4
  171. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  172. package/dist/cli/workspace/patch-package.d.ts +0 -3
  173. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  174. package/dist/cli/workspace/types.d.ts +0 -11
  175. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  176. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  177. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  178. package/dist/cli/workspace.d.ts +0 -2
  179. package/dist/css-imports-BbrbluP9.js +0 -177
  180. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  181. package/dist/experimental/index.d.ts +0 -2
  182. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  183. package/dist/experimental/oxc/index.d.ts +0 -2
  184. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  185. package/dist/experimental/shared/cache.d.ts +0 -3
  186. package/dist/experimental/shared/transform.d.ts +0 -3
  187. package/dist/experimental/shared.d.ts +0 -8
  188. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  189. package/dist/experimental/swc/index.d.ts +0 -2
  190. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  191. package/dist/generator-CZ-JXw6T.js +0 -492
  192. package/dist/generator-Dwxgra97.mjs +0 -399
  193. package/dist/generator-css-CnYjiMrD.js +0 -1084
  194. package/dist/generator-css-DhPFjSzK.mjs +0 -1057
  195. package/dist/js/syntax.d.ts +0 -10
  196. package/dist/loader-anchors-DvwgIYdA.mjs +0 -205
  197. package/dist/loader-anchors-cprm4Klq.js +0 -273
  198. package/dist/logger-BZ45DZJT.js +0 -1003
  199. package/dist/logger-BoVx1Dbt.mjs +0 -935
  200. package/dist/patcher-options-6gJN2EXy.js +0 -115
  201. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  202. package/dist/tailwindcss/recorder.d.ts +0 -13
  203. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  204. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  205. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  206. package/dist/tailwindcss/targets/types.d.ts +0 -35
  207. package/dist/types/disabled-options.d.ts +0 -4
  208. package/dist/webpack-CABjKGGQ.mjs +0 -441
  209. package/dist/webpack-DNIJ0ysE.js +0 -456
  210. package/dist/webpack4.d.ts +0 -4
  211. package/dist/webpack4.js +0 -387
  212. package/dist/webpack4.mjs +0 -379
  213. package/scripts/postinstall.mjs +0 -59
  214. /package/dist/{constants-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
  215. /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
package/dist/presets.js CHANGED
@@ -1,7 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-8l464Juk.js");
3
- const require_utils = require("./utils-DmC9_In3.js");
4
- const require_logger = require("./logger-BZ45DZJT.js");
3
+ const require_cache = require("./cache-B_9E7FxF.js");
4
+ const require_utils = require("./utils-4ODFyoqD.js");
5
+ const require_tailwindcss = require("./tailwindcss-B78nj6n7.js");
6
+ require("./logger-EVNB9z7i.js");
5
7
  let node_process = require("node:process");
6
8
  node_process = require_chunk.__toESM(node_process);
7
9
  let local_pkg = require("local-pkg");
@@ -15,15 +17,15 @@ function normalizeCssEntries(entries) {
15
17
  }
16
18
  function createBasePreset(options = {}) {
17
19
  const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
18
- const baseDir = require_logger.resolveTailwindcssBasedir(base);
20
+ const baseDir = require_tailwindcss.resolveTailwindcssBasedir(base);
19
21
  const normalizedCssEntries = normalizeCssEntries(cssEntries);
20
22
  const tailwindConfig = {
21
23
  v2: { cwd: baseDir },
22
24
  v3: { cwd: baseDir },
23
- v4: {
25
+ v4: require_cache.omitUndefined({
24
26
  base: baseDir,
25
27
  cssEntries: normalizedCssEntries
26
- }
28
+ })
27
29
  };
28
30
  if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
29
31
  const preset = {
@@ -42,7 +44,7 @@ function createBasePreset(options = {}) {
42
44
  //#endregion
43
45
  //#region src/presets/uni-app.ts
44
46
  function uniApp(options = {}) {
45
- const uniPlatform = node_process.default.env.UNI_PLATFORM;
47
+ const uniPlatform = node_process.default.env["UNI_PLATFORM"];
46
48
  return createBasePreset({
47
49
  disabled: uniPlatform === "h5" || uniPlatform === "app" || uniPlatform === "app-plus" ? true : void 0,
48
50
  ...options
@@ -79,15 +81,15 @@ function resolveInstalledTailwindDefaults(resolve) {
79
81
  };
80
82
  }
81
83
  function uniAppX(options) {
82
- _weapp_tailwindcss_logger.logger.info(`UNI_PLATFORM: ${node_process.default.env.UNI_PLATFORM}`);
84
+ _weapp_tailwindcss_logger.logger.info(`UNI_PLATFORM: ${node_process.default.env["UNI_PLATFORM"]}`);
83
85
  const utsPlatform = require_utils.resolveUniUtsPlatform();
84
- const uniPlatform = require_utils.resolveUniUtsPlatform(node_process.default.env.UNI_PLATFORM);
86
+ const uniPlatform = require_utils.resolveUniUtsPlatform(node_process.default.env["UNI_PLATFORM"]);
85
87
  _weapp_tailwindcss_logger.logger.info(`UNI_UTS_PLATFORM: ${utsPlatform.raw ?? "undefined"}`);
86
88
  const isApp = utsPlatform.isApp || uniPlatform.isApp;
87
89
  const cssEntries = normalizeCssEntries(options.cssEntries);
88
90
  const resolvedResolve = resolveTailwindResolveOptions(options.base, options.resolve);
89
91
  const installedTailwindDefaults = resolveInstalledTailwindDefaults(resolvedResolve);
90
- const resolvedUniAppX = require_logger.resolveUniAppXOptions({
92
+ const resolvedUniAppX = require_tailwindcss.resolveUniAppXOptions({
91
93
  enabled: isApp,
92
94
  componentLocalStyles: options.componentLocalStyles ?? true,
93
95
  uvueUnsupported: options.uvueUnsupported,
@@ -107,10 +109,10 @@ function uniAppX(options) {
107
109
  cwd: options.base,
108
110
  resolve: resolvedResolve,
109
111
  v3: { cwd: options.base },
110
- v4: {
112
+ v4: require_cache.omitUndefined({
111
113
  base: options.base,
112
114
  cssEntries
113
- }
115
+ })
114
116
  }
115
117
  },
116
118
  tailwindcss: {
package/dist/presets.mjs CHANGED
@@ -1,5 +1,7 @@
1
- import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-7DUGTFED.mjs";
2
- import { a as resolveUniAppXOptions, r as resolveTailwindcssBasedir, t as logger } from "./logger-BoVx1Dbt.mjs";
1
+ import { l as omitUndefined } from "./cache-DEDxBMIw.mjs";
2
+ import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-CGBVVNm6.mjs";
3
+ import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-DGM8lHUj.mjs";
4
+ import { t as logger } from "./logger-CZUxvJJD.mjs";
3
5
  import process from "node:process";
4
6
  import { getPackageInfoSync } from "local-pkg";
5
7
  //#region src/presets/shared.ts
@@ -15,10 +17,10 @@ function createBasePreset(options = {}) {
15
17
  const tailwindConfig = {
16
18
  v2: { cwd: baseDir },
17
19
  v3: { cwd: baseDir },
18
- v4: {
20
+ v4: omitUndefined({
19
21
  base: baseDir,
20
22
  cssEntries: normalizedCssEntries
21
- }
23
+ })
22
24
  };
23
25
  if (normalizedCssEntries && normalizedCssEntries.length > 0) tailwindConfig.version = 4;
24
26
  const preset = {
@@ -37,7 +39,7 @@ function createBasePreset(options = {}) {
37
39
  //#endregion
38
40
  //#region src/presets/uni-app.ts
39
41
  function uniApp(options = {}) {
40
- const uniPlatform = process.env.UNI_PLATFORM;
42
+ const uniPlatform = process.env["UNI_PLATFORM"];
41
43
  return createBasePreset({
42
44
  disabled: uniPlatform === "h5" || uniPlatform === "app" || uniPlatform === "app-plus" ? true : void 0,
43
45
  ...options
@@ -74,9 +76,9 @@ function resolveInstalledTailwindDefaults(resolve) {
74
76
  };
75
77
  }
76
78
  function uniAppX(options) {
77
- logger.info(`UNI_PLATFORM: ${process.env.UNI_PLATFORM}`);
79
+ logger.info(`UNI_PLATFORM: ${process.env["UNI_PLATFORM"]}`);
78
80
  const utsPlatform = resolveUniUtsPlatform();
79
- const uniPlatform = resolveUniUtsPlatform(process.env.UNI_PLATFORM);
81
+ const uniPlatform = resolveUniUtsPlatform(process.env["UNI_PLATFORM"]);
80
82
  logger.info(`UNI_UTS_PLATFORM: ${utsPlatform.raw ?? "undefined"}`);
81
83
  const isApp = utsPlatform.isApp || uniPlatform.isApp;
82
84
  const cssEntries = normalizeCssEntries(options.cssEntries);
@@ -102,10 +104,10 @@ function uniAppX(options) {
102
104
  cwd: options.base,
103
105
  resolve: resolvedResolve,
104
106
  v3: { cwd: options.base },
105
- v4: {
107
+ v4: omitUndefined({
106
108
  base: options.base,
107
109
  cssEntries
108
- }
110
+ })
109
111
  }
110
112
  },
111
113
  tailwindcss: {
package/dist/reset.d.ts CHANGED
@@ -1 +1,2 @@
1
+ export { default } from './reset/index'
1
2
  export * from './reset/index'
@@ -0,0 +1,85 @@
1
+ const require_chunk = require("./chunk-8l464Juk.js");
2
+ const require_cache = require("./cache-B_9E7FxF.js");
3
+ let node_module = require("node:module");
4
+ let node_path = require("node:path");
5
+ node_path = require_chunk.__toESM(node_path);
6
+ let debug = require("debug");
7
+ debug = require_chunk.__toESM(debug);
8
+ //#region src/debug/index.ts
9
+ const _debug = (0, debug.default)("weapp-tw");
10
+ function createDebug(prefix) {
11
+ const debug$2 = ((formatter, ...args) => {
12
+ return _debug((prefix ?? "") + formatter, ...args);
13
+ });
14
+ Object.defineProperty(debug$2, "enabled", {
15
+ enumerable: false,
16
+ configurable: false,
17
+ get() {
18
+ return _debug.enabled;
19
+ }
20
+ });
21
+ return debug$2;
22
+ }
23
+ //#endregion
24
+ //#region src/tailwindcss/runtime-patch.ts
25
+ const debug$1 = createDebug("[tailwindcss:runtime-patch] ");
26
+ const require$1 = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
27
+ const runtimePatchPromiseCache = /* @__PURE__ */ new WeakMap();
28
+ function getNestedPatchers(twPatcher) {
29
+ const nested = twPatcher[require_cache.runtimeSignaturePatchersSymbol];
30
+ return Array.isArray(nested) && nested.length > 0 ? nested : void 0;
31
+ }
32
+ function shouldApplyRuntimePatch(twPatcher) {
33
+ return twPatcher.majorVersion === 3 && typeof twPatcher.patch === "function";
34
+ }
35
+ function clearTailwindcssRequireCache(twPatcher) {
36
+ const rootPath = twPatcher.packageInfo?.rootPath;
37
+ if (!rootPath) return;
38
+ const normalizedRoot = node_path.default.resolve(rootPath);
39
+ let count = 0;
40
+ for (const id of Object.keys(require$1.cache)) {
41
+ const normalizedId = node_path.default.resolve(id);
42
+ if (normalizedId === normalizedRoot || normalizedId.startsWith(`${normalizedRoot}${node_path.default.sep}`)) {
43
+ delete require$1.cache[id];
44
+ count += 1;
45
+ }
46
+ }
47
+ if (count > 0) debug$1("clear tailwindcss require cache after runtime patch, count=%d root=%s", count, normalizedRoot);
48
+ }
49
+ async function ensureTailwindcssRuntimePatch(twPatcher, options = {}) {
50
+ const nestedPatchers = getNestedPatchers(twPatcher);
51
+ if (nestedPatchers) {
52
+ await Promise.all(nestedPatchers.map((patcher) => ensureTailwindcssRuntimePatch(patcher)));
53
+ return;
54
+ }
55
+ if (!shouldApplyRuntimePatch(twPatcher)) return;
56
+ const cached = runtimePatchPromiseCache.get(twPatcher);
57
+ if (cached) {
58
+ await cached;
59
+ if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
60
+ return;
61
+ }
62
+ const task = Promise.resolve().then(async () => {
63
+ debug$1("apply tailwindcss runtime patch, package=%s version=%s root=%s", twPatcher.packageInfo?.name ?? "tailwindcss", twPatcher.packageInfo?.version ?? "unknown", twPatcher.packageInfo?.rootPath ?? "unknown");
64
+ await twPatcher.patch?.();
65
+ if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
66
+ }).catch((error) => {
67
+ runtimePatchPromiseCache.delete(twPatcher);
68
+ throw error;
69
+ });
70
+ runtimePatchPromiseCache.set(twPatcher, task);
71
+ return task;
72
+ }
73
+ //#endregion
74
+ Object.defineProperty(exports, "createDebug", {
75
+ enumerable: true,
76
+ get: function() {
77
+ return createDebug;
78
+ }
79
+ });
80
+ Object.defineProperty(exports, "ensureTailwindcssRuntimePatch", {
81
+ enumerable: true,
82
+ get: function() {
83
+ return ensureTailwindcssRuntimePatch;
84
+ }
85
+ });
@@ -0,0 +1,71 @@
1
+ import { i as runtimeSignaturePatchersSymbol } from "./cache-DEDxBMIw.mjs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import _createDebug from "debug";
5
+ //#region src/debug/index.ts
6
+ const _debug = _createDebug("weapp-tw");
7
+ function createDebug(prefix) {
8
+ const debug = ((formatter, ...args) => {
9
+ return _debug((prefix ?? "") + formatter, ...args);
10
+ });
11
+ Object.defineProperty(debug, "enabled", {
12
+ enumerable: false,
13
+ configurable: false,
14
+ get() {
15
+ return _debug.enabled;
16
+ }
17
+ });
18
+ return debug;
19
+ }
20
+ //#endregion
21
+ //#region src/tailwindcss/runtime-patch.ts
22
+ const debug = createDebug("[tailwindcss:runtime-patch] ");
23
+ const require = createRequire(import.meta.url);
24
+ const runtimePatchPromiseCache = /* @__PURE__ */ new WeakMap();
25
+ function getNestedPatchers(twPatcher) {
26
+ const nested = twPatcher[runtimeSignaturePatchersSymbol];
27
+ return Array.isArray(nested) && nested.length > 0 ? nested : void 0;
28
+ }
29
+ function shouldApplyRuntimePatch(twPatcher) {
30
+ return twPatcher.majorVersion === 3 && typeof twPatcher.patch === "function";
31
+ }
32
+ function clearTailwindcssRequireCache(twPatcher) {
33
+ const rootPath = twPatcher.packageInfo?.rootPath;
34
+ if (!rootPath) return;
35
+ const normalizedRoot = path.resolve(rootPath);
36
+ let count = 0;
37
+ for (const id of Object.keys(require.cache)) {
38
+ const normalizedId = path.resolve(id);
39
+ if (normalizedId === normalizedRoot || normalizedId.startsWith(`${normalizedRoot}${path.sep}`)) {
40
+ delete require.cache[id];
41
+ count += 1;
42
+ }
43
+ }
44
+ if (count > 0) debug("clear tailwindcss require cache after runtime patch, count=%d root=%s", count, normalizedRoot);
45
+ }
46
+ async function ensureTailwindcssRuntimePatch(twPatcher, options = {}) {
47
+ const nestedPatchers = getNestedPatchers(twPatcher);
48
+ if (nestedPatchers) {
49
+ await Promise.all(nestedPatchers.map((patcher) => ensureTailwindcssRuntimePatch(patcher)));
50
+ return;
51
+ }
52
+ if (!shouldApplyRuntimePatch(twPatcher)) return;
53
+ const cached = runtimePatchPromiseCache.get(twPatcher);
54
+ if (cached) {
55
+ await cached;
56
+ if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
57
+ return;
58
+ }
59
+ const task = Promise.resolve().then(async () => {
60
+ debug("apply tailwindcss runtime patch, package=%s version=%s root=%s", twPatcher.packageInfo?.name ?? "tailwindcss", twPatcher.packageInfo?.version ?? "unknown", twPatcher.packageInfo?.rootPath ?? "unknown");
61
+ await twPatcher.patch?.();
62
+ if (options.clearRequireCache) clearTailwindcssRequireCache(twPatcher);
63
+ }).catch((error) => {
64
+ runtimePatchPromiseCache.delete(twPatcher);
65
+ throw error;
66
+ });
67
+ runtimePatchPromiseCache.set(twPatcher, task);
68
+ return task;
69
+ }
70
+ //#endregion
71
+ export { createDebug as n, ensureTailwindcssRuntimePatch as t };
@@ -1,6 +1,7 @@
1
1
  import type { AppType } from '../types';
2
2
  export declare function isMpx(appType?: AppType): appType is "mpx";
3
3
  export declare function getTailwindcssCssEntry(pkgDir: string): string;
4
+ export declare function patchMpxWebpackPluginNormalizeLib(compiler: any, mpxWebpackPluginDir: string | undefined): boolean;
4
5
  export declare function ensureMpxTailwindcssAliases(compiler: any, pkgDir: string): string;
5
6
  export declare function patchMpxLoaderResolve(loaderContext: any, pkgDir: string, enabled: boolean): void;
6
7
  export declare function setupMpxTailwindcssRedirect(pkgDir: string, enabled: boolean): void;
@@ -0,0 +1,297 @@
1
+ const require_chunk = require("./chunk-8l464Juk.js");
2
+ let node_path = require("node:path");
3
+ node_path = require_chunk.__toESM(node_path);
4
+ let node_fs_promises = require("node:fs/promises");
5
+ let fast_glob = require("fast-glob");
6
+ fast_glob = require_chunk.__toESM(fast_glob);
7
+ let micromatch = require("micromatch");
8
+ micromatch = require_chunk.__toESM(micromatch);
9
+ //#region src/tailwindcss/source-scan.ts
10
+ const DEFAULT_SOURCE_SCAN_EXTENSIONS = [
11
+ "html",
12
+ "wxml",
13
+ "axml",
14
+ "jxml",
15
+ "ksml",
16
+ "ttml",
17
+ "qml",
18
+ "tyml",
19
+ "xhsml",
20
+ "swan",
21
+ "vue",
22
+ "mpx",
23
+ "js",
24
+ "jsx",
25
+ "ts",
26
+ "tsx"
27
+ ];
28
+ function createSourceScanPattern(extensions = DEFAULT_SOURCE_SCAN_EXTENSIONS) {
29
+ return `**/*.{${extensions.join(",")}}`;
30
+ }
31
+ const NUMERICAL_RANGE_RE = /^(-?\d+)\.\.(-?\d+)(?:\.\.(-?\d+))?$/;
32
+ function parseConfigParam(params) {
33
+ const value = params.trim();
34
+ return /^(['"])(.+)\1$/.exec(value)?.[2];
35
+ }
36
+ function isLegacyContentObject(value) {
37
+ return typeof value === "object" && value !== null && "files" in value;
38
+ }
39
+ function normalizeGlobPattern(pattern) {
40
+ return pattern.startsWith("./") ? pattern.slice(2) : pattern;
41
+ }
42
+ function segmentTopLevel(input, separator) {
43
+ const parts = [];
44
+ const stack = [];
45
+ let lastPos = 0;
46
+ let quote;
47
+ for (let index = 0; index < input.length; index++) {
48
+ const char = input[index];
49
+ if (char === "\\") {
50
+ index += 1;
51
+ continue;
52
+ }
53
+ if (quote) {
54
+ if (char === quote) quote = void 0;
55
+ continue;
56
+ }
57
+ if (char === "\"" || char === "'") {
58
+ quote = char;
59
+ continue;
60
+ }
61
+ if (char === "(") {
62
+ stack.push(")");
63
+ continue;
64
+ }
65
+ if (char === "[") {
66
+ stack.push("]");
67
+ continue;
68
+ }
69
+ if (char === "{") {
70
+ stack.push("}");
71
+ continue;
72
+ }
73
+ if (stack.length > 0 && char === stack[stack.length - 1]) {
74
+ stack.pop();
75
+ continue;
76
+ }
77
+ if (stack.length === 0 && char === separator) {
78
+ parts.push(input.slice(lastPos, index));
79
+ lastPos = index + 1;
80
+ }
81
+ }
82
+ parts.push(input.slice(lastPos));
83
+ return parts;
84
+ }
85
+ function isSequence(value) {
86
+ return NUMERICAL_RANGE_RE.test(value);
87
+ }
88
+ function expandSequence(value) {
89
+ const match = value.match(NUMERICAL_RANGE_RE);
90
+ if (!match) return [value];
91
+ const [, start, end, stepValue] = match;
92
+ if (start === void 0 || end === void 0) return [value];
93
+ let step = stepValue ? Number.parseInt(stepValue, 10) : void 0;
94
+ const startNumber = Number.parseInt(start, 10);
95
+ const endNumber = Number.parseInt(end, 10);
96
+ const increasing = startNumber < endNumber;
97
+ if (step === void 0) step = increasing ? 1 : -1;
98
+ if (step === 0) return [];
99
+ if (increasing && step < 0) step = -step;
100
+ if (!increasing && step > 0) step = -step;
101
+ const result = [];
102
+ for (let value = startNumber; increasing ? value <= endNumber : value >= endNumber; value += step) result.push(String(value));
103
+ return result;
104
+ }
105
+ function expandInlineSourceCandidatePattern(pattern) {
106
+ const index = pattern.indexOf("{");
107
+ if (index === -1) return [pattern];
108
+ const prefix = pattern.slice(0, index);
109
+ const rest = pattern.slice(index);
110
+ let depth = 0;
111
+ let endIndex = -1;
112
+ for (let index = 0; index < rest.length; index++) {
113
+ const char = rest[index];
114
+ if (char === "{") depth += 1;
115
+ else if (char === "}") {
116
+ depth -= 1;
117
+ if (depth === 0) {
118
+ endIndex = index;
119
+ break;
120
+ }
121
+ }
122
+ }
123
+ if (endIndex === -1) return [pattern];
124
+ const inner = rest.slice(1, endIndex);
125
+ const suffix = rest.slice(endIndex + 1);
126
+ const parts = (isSequence(inner) ? expandSequence(inner) : segmentTopLevel(inner, ",")).flatMap((part) => expandInlineSourceCandidatePattern(part));
127
+ return expandInlineSourceCandidatePattern(suffix).flatMap((suffix) => parts.map((part) => `${prefix}${part}${suffix}`));
128
+ }
129
+ function parseSourceInlineParam(params) {
130
+ let value = params.trim();
131
+ const negated = value.startsWith("not ");
132
+ if (negated) value = value.slice(4).trim();
133
+ if (!value.startsWith("inline(") || !value.endsWith(")")) return;
134
+ const inlineValue = value.slice(7, -1).trim();
135
+ const match = /^(['"])([\s\S]*)\1$/.exec(inlineValue);
136
+ if (!match) return;
137
+ const source = match[2];
138
+ if (source === void 0) return;
139
+ return {
140
+ negated,
141
+ source
142
+ };
143
+ }
144
+ function collectCssInlineSourceCandidates(root) {
145
+ const included = /* @__PURE__ */ new Set();
146
+ const excluded = /* @__PURE__ */ new Set();
147
+ root.walkAtRules("source", (rule) => {
148
+ const parsed = parseSourceInlineParam(rule.params);
149
+ if (!parsed) return;
150
+ const target = parsed.negated ? excluded : included;
151
+ for (const source of segmentTopLevel(parsed.source, " ")) {
152
+ const trimmed = source.trim();
153
+ if (!trimmed) continue;
154
+ for (const candidate of expandInlineSourceCandidatePattern(trimmed)) {
155
+ const normalized = candidate.trim();
156
+ if (normalized) target.add(normalized);
157
+ }
158
+ }
159
+ });
160
+ for (const candidate of excluded) included.delete(candidate);
161
+ return {
162
+ included,
163
+ excluded
164
+ };
165
+ }
166
+ function normalizeLegacyContentEntries(content, base) {
167
+ if (typeof content === "string") {
168
+ const negated = content.startsWith("!");
169
+ return [{
170
+ base,
171
+ negated,
172
+ pattern: normalizeGlobPattern(negated ? content.slice(1) : content)
173
+ }];
174
+ }
175
+ if (Array.isArray(content)) return content.flatMap((item) => normalizeLegacyContentEntries(item, base));
176
+ if (isLegacyContentObject(content)) return normalizeLegacyContentEntries(content.files, base);
177
+ return [];
178
+ }
179
+ async function pathExistsAsDirectory(file) {
180
+ try {
181
+ return (await (0, node_fs_promises.stat)(file)).isDirectory();
182
+ } catch {
183
+ return false;
184
+ }
185
+ }
186
+ async function resolveTailwindSourceEntry(sourcePath, base, negated, defaultPattern = createSourceScanPattern()) {
187
+ const absoluteSource = node_path.default.isAbsolute(sourcePath) ? node_path.default.resolve(sourcePath) : node_path.default.resolve(base, sourcePath);
188
+ if (await pathExistsAsDirectory(absoluteSource)) return {
189
+ base: absoluteSource,
190
+ negated,
191
+ pattern: normalizeGlobPattern(defaultPattern)
192
+ };
193
+ if (node_path.default.isAbsolute(sourcePath)) return {
194
+ base: node_path.default.dirname(absoluteSource),
195
+ negated,
196
+ pattern: normalizeGlobPattern(node_path.default.basename(absoluteSource))
197
+ };
198
+ return {
199
+ base,
200
+ negated,
201
+ pattern: normalizeGlobPattern(sourcePath)
202
+ };
203
+ }
204
+ function parseSourceFileParam(params) {
205
+ const value = params.trim();
206
+ if (!value || value === "none" || value.startsWith("inline(")) return;
207
+ const negated = value.startsWith("not ");
208
+ const sourceValue = negated ? value.slice(4).trim() : value;
209
+ if (sourceValue.startsWith("inline(")) return;
210
+ const match = /^(['"])(.+)\1$/.exec(sourceValue);
211
+ return match?.[2] ? {
212
+ negated,
213
+ sourcePath: match[2]
214
+ } : void 0;
215
+ }
216
+ async function resolveCssSourceEntries(root, base, defaultPattern = createSourceScanPattern()) {
217
+ const entries = [];
218
+ const tasks = [];
219
+ root.walkAtRules("source", (rule) => {
220
+ const parsed = parseSourceFileParam(rule.params);
221
+ if (!parsed) return;
222
+ tasks.push(resolveTailwindSourceEntry(parsed.sourcePath, base, parsed.negated, defaultPattern));
223
+ });
224
+ entries.push(...await Promise.all(tasks));
225
+ return entries;
226
+ }
227
+ async function expandTailwindSourceEntries(entries, options = {}) {
228
+ const files = /* @__PURE__ */ new Set();
229
+ const negativeEntries = entries.filter((entry) => entry.negated);
230
+ const entriesByBase = /* @__PURE__ */ new Map();
231
+ for (const entry of entries) {
232
+ const base = node_path.default.resolve(entry.base);
233
+ const group = entriesByBase.get(base) ?? [];
234
+ group.push({
235
+ ...entry,
236
+ base
237
+ });
238
+ entriesByBase.set(base, group);
239
+ }
240
+ await Promise.all([...entriesByBase.entries()].map(async ([base, group]) => {
241
+ const patterns = group.map((entry) => {
242
+ const pattern = normalizeGlobPattern(entry.pattern);
243
+ return entry.negated ? `!${pattern}` : pattern;
244
+ });
245
+ if (!patterns.some((pattern) => !pattern.startsWith("!"))) return;
246
+ const ignore = options.ignore;
247
+ const matched = await (0, fast_glob.default)(patterns, {
248
+ absolute: true,
249
+ cwd: base,
250
+ ...ignore === void 0 ? {} : { ignore },
251
+ onlyFiles: true,
252
+ unique: true
253
+ });
254
+ for (const file of matched) files.add(node_path.default.resolve(file));
255
+ }));
256
+ return [...files].filter((file) => !negativeEntries.some((entry) => {
257
+ const relative = node_path.default.relative(node_path.default.resolve(entry.base), file).split(node_path.default.sep).join("/");
258
+ return relative && !relative.startsWith("../") && !node_path.default.isAbsolute(relative) && micromatch.default.isMatch(relative, normalizeGlobPattern(entry.pattern));
259
+ }));
260
+ }
261
+ //#endregion
262
+ Object.defineProperty(exports, "collectCssInlineSourceCandidates", {
263
+ enumerable: true,
264
+ get: function() {
265
+ return collectCssInlineSourceCandidates;
266
+ }
267
+ });
268
+ Object.defineProperty(exports, "createSourceScanPattern", {
269
+ enumerable: true,
270
+ get: function() {
271
+ return createSourceScanPattern;
272
+ }
273
+ });
274
+ Object.defineProperty(exports, "expandTailwindSourceEntries", {
275
+ enumerable: true,
276
+ get: function() {
277
+ return expandTailwindSourceEntries;
278
+ }
279
+ });
280
+ Object.defineProperty(exports, "normalizeLegacyContentEntries", {
281
+ enumerable: true,
282
+ get: function() {
283
+ return normalizeLegacyContentEntries;
284
+ }
285
+ });
286
+ Object.defineProperty(exports, "parseConfigParam", {
287
+ enumerable: true,
288
+ get: function() {
289
+ return parseConfigParam;
290
+ }
291
+ });
292
+ Object.defineProperty(exports, "resolveCssSourceEntries", {
293
+ enumerable: true,
294
+ get: function() {
295
+ return resolveCssSourceEntries;
296
+ }
297
+ });