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
@@ -1,21 +1,20 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- require("./utils-DmC9_In3.js");
2
+ const require_cache = require("./cache-B_9E7FxF.js");
3
+ const require_runtime_patch = require("./runtime-patch-CqB-A4zA.js");
4
+ require("./utils-4ODFyoqD.js");
3
5
  const require_defaults = require("./defaults.js");
4
- const require_logger = require("./logger-BZ45DZJT.js");
5
- let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
6
+ const require_tailwindcss = require("./tailwindcss-B78nj6n7.js");
6
7
  let node_path = require("node:path");
7
8
  node_path = require_chunk.__toESM(node_path);
8
9
  let node_process = require("node:process");
9
10
  node_process = require_chunk.__toESM(node_process);
11
+ let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
12
+ let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
10
13
  let node_buffer = require("node:buffer");
11
- let node_fs = require("node:fs");
12
14
  let node_fs_promises = require("node:fs/promises");
13
- let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
14
15
  let lru_cache = require("lru-cache");
15
16
  let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
16
17
  let _weapp_core_escape = require("@weapp-core/escape");
17
- let debug = require("debug");
18
- debug = require_chunk.__toESM(debug);
19
18
  let _babel_traverse = require("@babel/traverse");
20
19
  _babel_traverse = require_chunk.__toESM(_babel_traverse);
21
20
  let _babel_parser = require("@babel/parser");
@@ -110,33 +109,13 @@ function initializeCache(cacheConfig) {
110
109
  return cacheConfig;
111
110
  }
112
111
  //#endregion
113
- //#region src/debug/index.ts
114
- const _debug = (0, debug.default)("weapp-tw");
115
- function createDebug(prefix) {
116
- const debug$3 = ((formatter, ...args) => {
117
- return _debug((prefix ?? "") + formatter, ...args);
118
- });
119
- Object.defineProperty(debug$3, "enabled", {
120
- enumerable: false,
121
- configurable: false,
122
- get() {
123
- return _debug.enabled;
124
- }
125
- });
126
- return debug$3;
127
- }
128
- //#endregion
129
112
  //#region src/tailwindcss/runtime.ts
130
- const debug$2 = createDebug("[tailwindcss:runtime] ");
113
+ const debug$1 = require_runtime_patch.createDebug("[tailwindcss:runtime] ");
131
114
  const refreshTailwindcssPatcherSymbol = Symbol.for("weapp-tailwindcss.refreshTailwindcssPatcher");
132
- function createTailwindPatchPromise(twPatcher, onPatched) {
133
- return Promise.resolve(twPatcher.patch()).then(async () => {
134
- require_logger.invalidateRuntimeClassSet(twPatcher);
135
- if (onPatched) try {
136
- await onPatched();
137
- } catch (error) {
138
- debug$2("failed to persist patch target after patch(): %O", error);
139
- }
115
+ function createTailwindRuntimeReadyPromise(twPatcher) {
116
+ return Promise.resolve().then(async () => {
117
+ await require_runtime_patch.ensureTailwindcssRuntimePatch(twPatcher);
118
+ require_cache.invalidateRuntimeClassSet(twPatcher);
140
119
  });
141
120
  }
142
121
  const runtimeClassSetStateCache = /* @__PURE__ */ new WeakMap();
@@ -153,16 +132,16 @@ async function refreshTailwindRuntimeState(state, forceOrOptions) {
153
132
  const force = normalizedOptions.force;
154
133
  const clearCache = normalizedOptions.clearCache === true;
155
134
  if (!force) return false;
156
- debug$2("refresh runtime state start, clearCache=%s major=%s", clearCache, state.twPatcher.majorVersion ?? "unknown");
157
- await state.patchPromise;
135
+ debug$1("refresh runtime state start, clearCache=%s major=%s", clearCache, state.twPatcher.majorVersion ?? "unknown");
136
+ await state.readyPromise;
158
137
  let refreshed = false;
159
138
  if (typeof state.refreshTailwindcssPatcher === "function") {
160
139
  const next = await state.refreshTailwindcssPatcher({ clearCache });
161
140
  if (next !== state.twPatcher) state.twPatcher = next;
162
141
  refreshed = true;
163
142
  }
164
- if (refreshed) state.patchPromise = createTailwindPatchPromise(state.twPatcher, state.onPatchCompleted);
165
- debug$2("refresh runtime state end, refreshed=%s major=%s", refreshed, state.twPatcher.majorVersion ?? "unknown");
143
+ if (refreshed) state.readyPromise = createTailwindRuntimeReadyPromise(state.twPatcher);
144
+ debug$1("refresh runtime state end, refreshed=%s major=%s", refreshed, state.twPatcher.majorVersion ?? "unknown");
166
145
  return refreshed;
167
146
  }
168
147
  async function ensureRuntimeClassSet(state, options = {}) {
@@ -174,9 +153,9 @@ async function ensureRuntimeClassSet(state, options = {}) {
174
153
  force: true,
175
154
  clearCache
176
155
  });
177
- await state.patchPromise;
156
+ await state.readyPromise;
178
157
  const entry = getRuntimeClassSetStateEntry(state);
179
- const signature = require_logger.getRuntimeClassSetSignature(state.twPatcher);
158
+ const signature = require_cache.getRuntimeClassSetSignature(state.twPatcher);
180
159
  const signatureChanged = entry.signature !== signature;
181
160
  const shouldForceCollect = forceCollect || forceRefresh || signatureChanged;
182
161
  if (!shouldForceCollect) {
@@ -194,7 +173,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
194
173
  force: true,
195
174
  clearCache: true
196
175
  });
197
- await state.patchPromise;
176
+ await state.readyPromise;
198
177
  return collectRuntimeClassSet(state.twPatcher, {
199
178
  force: true,
200
179
  skipRefresh: true,
@@ -205,7 +184,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
205
184
  try {
206
185
  const runtimeSet = await task;
207
186
  entry.value = runtimeSet;
208
- entry.signature = require_logger.getRuntimeClassSetSignature(state.twPatcher);
187
+ entry.signature = require_cache.getRuntimeClassSetSignature(state.twPatcher);
209
188
  return runtimeSet;
210
189
  } finally {
211
190
  if (entry.promise === task) entry.promise = void 0;
@@ -225,8 +204,8 @@ function tryGetRuntimeClassSetSync(twPatcher) {
225
204
  if (set && set.size === 0) return;
226
205
  return set;
227
206
  } catch (error) {
228
- if (twPatcher.majorVersion === 4) debug$2("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
229
- else debug$2("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
207
+ if (twPatcher.majorVersion === 4) debug$1("getClassSetSync() unavailable for tailwindcss v4, fallback to async getClassSet(): %O", error);
208
+ else debug$1("getClassSetSync() failed, fallback to async getClassSet(): %O", error);
230
209
  return;
231
210
  }
232
211
  }
@@ -238,49 +217,50 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
238
217
  const refreshed = await refresh({ clearCache: options.clearCache === true });
239
218
  if (refreshed) activePatcher = refreshed;
240
219
  } catch (error) {
241
- debug$2("refreshTailwindcssPatcher failed, continuing with existing patcher: %O", error);
220
+ debug$1("refreshTailwindcssPatcher failed, continuing with existing patcher: %O", error);
242
221
  }
243
222
  }
244
- const entry = require_logger.getRuntimeClassSetCacheEntry(activePatcher);
245
- const signature = require_logger.getRuntimeClassSetSignature(activePatcher);
223
+ const entry = require_cache.getRuntimeClassSetCacheEntry(activePatcher);
224
+ const signature = require_cache.getRuntimeClassSetSignature(activePatcher);
246
225
  if (!options.force) {
247
226
  if (entry.value && entry.signature === signature) return entry.value;
248
227
  if (entry.promise) return entry.promise;
249
228
  } else entry.value = void 0;
250
229
  const task = (async () => {
230
+ await require_runtime_patch.ensureTailwindcssRuntimePatch(activePatcher);
251
231
  const preExtractSyncSet = options.force ? tryGetRuntimeClassSetSync(activePatcher) : void 0;
252
- if (preExtractSyncSet) debug$2("runtime class set snapshot via getClassSetSync() before extract(), size=%d", preExtractSyncSet.size);
232
+ if (preExtractSyncSet) debug$1("runtime class set snapshot via getClassSetSync() before extract(), size=%d", preExtractSyncSet.size);
253
233
  const preferExtract = options.force === true;
254
234
  try {
255
235
  const result = await activePatcher.extract({ write: false });
256
236
  if (result?.classSet) {
257
237
  if (result.classSet.size > 0) {
258
- debug$2("runtime class set resolved via extract(), size=%d", result.classSet.size);
238
+ debug$1("runtime class set resolved via extract(), size=%d", result.classSet.size);
259
239
  return result.classSet;
260
240
  }
261
- if (preferExtract) debug$2("runtime class set from extract() is empty on force collect, fallback to sync/async class set");
262
- else debug$2("runtime class set from extract() is empty, fallback to sync/async class set");
241
+ if (preferExtract) debug$1("runtime class set from extract() is empty on force collect, fallback to sync/async class set");
242
+ else debug$1("runtime class set from extract() is empty, fallback to sync/async class set");
263
243
  }
264
244
  } catch (error) {
265
- debug$2("extract() failed, fallback to getClassSet(): %O", error);
245
+ debug$1("extract() failed, fallback to getClassSet(): %O", error);
266
246
  }
267
247
  if (preExtractSyncSet) {
268
- debug$2("runtime class set fallback to pre-extract sync snapshot, size=%d", preExtractSyncSet.size);
248
+ debug$1("runtime class set fallback to pre-extract sync snapshot, size=%d", preExtractSyncSet.size);
269
249
  return preExtractSyncSet;
270
250
  }
271
251
  const syncSet = tryGetRuntimeClassSetSync(activePatcher);
272
252
  if (syncSet) {
273
- debug$2("runtime class set resolved via getClassSetSync(), size=%d", syncSet.size);
253
+ debug$1("runtime class set resolved via getClassSetSync(), size=%d", syncSet.size);
274
254
  return syncSet;
275
255
  }
276
256
  try {
277
257
  const fallbackSet = await Promise.resolve(activePatcher.getClassSet());
278
258
  if (fallbackSet) {
279
- debug$2("runtime class set resolved via getClassSet(), size=%d", fallbackSet.size);
259
+ debug$1("runtime class set resolved via getClassSet(), size=%d", fallbackSet.size);
280
260
  return fallbackSet;
281
261
  }
282
262
  } catch (error) {
283
- debug$2("getClassSet() failed, returning empty set: %O", error);
263
+ debug$1("getClassSet() failed, returning empty set: %O", error);
284
264
  }
285
265
  return /* @__PURE__ */ new Set();
286
266
  })();
@@ -327,197 +307,29 @@ function logRuntimeTailwindcssVersion(baseDir, rootPath, version) {
327
307
  return;
328
308
  }
329
309
  if (!markRuntimeLog("missing", baseDir, rootPath, version)) return;
330
- _weapp_tailwindcss_logger.logger.warn(`${_weapp_tailwindcss_logger.pc.cyanBright("Tailwind CSS")} 未安装,已跳过版本检测与补丁应用。`);
310
+ _weapp_tailwindcss_logger.logger.warn(`${_weapp_tailwindcss_logger.pc.cyanBright("Tailwind CSS")} 未安装,已跳过版本检测与运行时初始化。`);
331
311
  }
332
312
  //#endregion
333
- //#region src/tailwindcss/targets/paths.ts
334
- const PATCH_INFO_FILENAME = "tailwindcss-target.json";
335
- const PATCH_INFO_CACHE_RELATIVE_PATH = node_path.default.join("node_modules", ".cache", "weapp-tailwindcss", PATCH_INFO_FILENAME);
336
- const PATCH_INFO_LEGACY_RELATIVE_PATH = node_path.default.join(".tw-patch", PATCH_INFO_FILENAME);
337
- function toDisplayPath(value) {
338
- return node_path.default.normalize(value).replace(/\\/g, "/");
339
- }
313
+ //#region src/tailwindcss/targets.ts
340
314
  function formatRelativeToBase(targetPath, baseDir) {
341
- if (!baseDir) return toDisplayPath(targetPath);
342
- const relative = node_path.default.relative(baseDir, targetPath);
315
+ const normalized = node_path.default.normalize(targetPath);
316
+ if (!baseDir) return normalized.replace(/\\/g, "/");
317
+ const relative = node_path.default.relative(baseDir, normalized);
343
318
  if (!relative || relative === ".") return ".";
344
- if (relative.startsWith("..")) return toDisplayPath(targetPath);
345
- return toDisplayPath(node_path.default.join(".", relative));
346
- }
347
- function resolveRecordLocation(baseDir) {
348
- const normalizedBase = node_path.default.normalize(baseDir);
349
- const packageRoot = require_logger.findNearestPackageRoot(normalizedBase) ?? normalizedBase;
350
- const packageJsonPath = node_path.default.join(packageRoot, "package.json");
351
- const hasPackageJson = (0, node_fs.existsSync)(packageJsonPath);
352
- const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
353
- const recordKey = (0, _weapp_tailwindcss_shared_node.md5)(node_path.default.normalize(recordKeySource));
354
- const recordDir = node_path.default.join(packageRoot, "node_modules", ".cache", "weapp-tailwindcss", recordKey);
355
- return {
356
- normalizedBase,
357
- packageRoot,
358
- recordDir,
359
- recordKey,
360
- recordPath: node_path.default.join(recordDir, PATCH_INFO_FILENAME),
361
- packageJsonPath: hasPackageJson ? packageJsonPath : void 0
362
- };
363
- }
364
- function getRecordFileCandidates(baseDir) {
365
- const { normalizedBase, packageRoot, recordPath } = resolveRecordLocation(baseDir);
366
- return [...new Set([
367
- recordPath,
368
- node_path.default.join(packageRoot, PATCH_INFO_CACHE_RELATIVE_PATH),
369
- node_path.default.join(normalizedBase, PATCH_INFO_CACHE_RELATIVE_PATH),
370
- node_path.default.join(normalizedBase, PATCH_INFO_LEGACY_RELATIVE_PATH)
371
- ])];
372
- }
373
- //#endregion
374
- //#region package.json
375
- var version = "5.0.0-next.1";
376
- //#endregion
377
- //#region src/constants.ts
378
- const pluginName = "weapp-tailwindcss-webpack-plugin";
379
- const vitePluginName = "weapp-tailwindcss:adaptor";
380
- const WEAPP_TW_VERSION = version;
381
- const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
382
- "tailwind-merge": "@weapp-tailwindcss/merge",
383
- "class-variance-authority": "@weapp-tailwindcss/cva",
384
- "tailwind-variants": "@weapp-tailwindcss/variants"
385
- };
386
- //#endregion
387
- //#region src/tailwindcss/targets/record-io.ts
388
- const loggedInvalidPatchRecords = /* @__PURE__ */ new Set();
389
- function warnInvalidPatchTargetRecord(baseDir, recordPath, reason) {
390
- const normalizedPath = node_path.default.normalize(recordPath);
391
- if (loggedInvalidPatchRecords.has(normalizedPath)) return;
392
- loggedInvalidPatchRecords.add(normalizedPath);
393
- const fileDisplay = formatRelativeToBase(normalizedPath, baseDir);
394
- const baseDisplay = formatRelativeToBase(node_path.default.normalize(baseDir), node_process.default.cwd());
395
- const reasonMessage = reason ? `:${reason}` : "";
396
- _weapp_tailwindcss_logger.logger.warn(`检测到损坏的 Tailwind CSS 目标记录 ${fileDisplay}${reasonMessage}。请在 ${baseDisplay} 重新执行 "weapp-tw patch --record-target" 或删除该文件后再运行。`);
397
- }
398
- function readPatchTargetRecord(baseDir) {
399
- if (!baseDir) return;
400
- const normalizedBase = node_path.default.normalize(baseDir);
401
- for (const recordPath of getRecordFileCandidates(normalizedBase)) {
402
- if (!(0, node_fs.existsSync)(recordPath)) continue;
403
- try {
404
- const content = (0, node_fs.readFileSync)(recordPath, "utf8");
405
- const parsed = JSON.parse(content);
406
- if (!parsed || typeof parsed.tailwindPackagePath !== "string") {
407
- warnInvalidPatchTargetRecord(normalizedBase, recordPath, "缺少 tailwindPackagePath 字段");
408
- continue;
409
- }
410
- return {
411
- baseDir: normalizedBase,
412
- path: recordPath,
413
- record: parsed
414
- };
415
- } catch (error) {
416
- warnInvalidPatchTargetRecord(normalizedBase, recordPath, error instanceof Error ? error.message : String(error));
417
- continue;
418
- }
419
- }
420
- }
421
- async function saveCliPatchTargetRecord(baseDir, patcher, options) {
422
- if (!baseDir || !patcher?.packageInfo?.rootPath) return;
423
- const normalizedBase = node_path.default.normalize(baseDir);
424
- const location = resolveRecordLocation(normalizedBase);
425
- const recordPath = options?.recordPath ? node_path.default.normalize(options.recordPath) : location.recordPath;
426
- const record = {
427
- tailwindPackagePath: node_path.default.normalize(patcher.packageInfo.rootPath),
428
- packageVersion: patcher.packageInfo.version,
429
- recordedAt: (/* @__PURE__ */ new Date()).toISOString(),
430
- source: options?.source ?? "cli",
431
- tailwindcssBasedir: normalizedBase,
432
- cwd: options?.cwd ? node_path.default.normalize(options.cwd) : normalizedBase,
433
- patchVersion: WEAPP_TW_VERSION,
434
- packageJsonPath: options?.packageJsonPath ?? location.packageJsonPath,
435
- recordKey: options?.recordKey ?? location.recordKey
436
- };
437
- try {
438
- await (0, node_fs_promises.mkdir)(node_path.default.dirname(recordPath), { recursive: true });
439
- await (0, node_fs_promises.writeFile)(recordPath, `${JSON.stringify(record, null, 2)}\n`, "utf8");
440
- return recordPath;
441
- } catch (error) {
442
- const baseDisplay = formatRelativeToBase(normalizedBase, node_process.default.cwd());
443
- _weapp_tailwindcss_logger.logger.warn("自动更新 Tailwind CSS 补丁记录失败,请在 %s 运行 \"weapp-tw patch --cwd %s\"。", baseDisplay, normalizedBase);
444
- _weapp_tailwindcss_logger.logger.debug("failed to persist patch target record %s: %O", recordPath, error);
445
- return;
446
- }
447
- }
448
- //#endregion
449
- //#region src/tailwindcss/targets/recorder.ts
450
- function findPatchTargetRecord(baseDir) {
451
- const visited = /* @__PURE__ */ new Set();
452
- const fallback = baseDir ?? node_process.default.cwd();
453
- let current = node_path.default.resolve(fallback);
454
- while (!visited.has(current)) {
455
- const record = readPatchTargetRecord(current);
456
- if (record) return record;
457
- const parent = node_path.default.dirname(current);
458
- if (parent === current) break;
459
- visited.add(current);
460
- current = parent;
461
- }
462
- }
463
- function createPatchTargetRecorder(baseDir, patcher, options) {
464
- if (!baseDir || !patcher?.packageInfo?.rootPath || options?.recordTarget === false) return;
465
- const normalizedBase = node_path.default.normalize(baseDir);
466
- const recorded = findPatchTargetRecord(normalizedBase);
467
- const location = resolveRecordLocation(normalizedBase);
468
- const expectedPath = node_path.default.normalize(patcher.packageInfo.rootPath);
469
- let reason;
470
- if (!recorded) reason = "missing";
471
- else if (node_path.default.normalize(recorded.record.tailwindPackagePath) !== expectedPath) reason = "mismatch";
472
- else if (node_path.default.normalize(recorded.path) !== node_path.default.normalize(location.recordPath) || !recorded.record.recordKey || recorded.record.recordKey !== location.recordKey) reason = "migrate";
473
- else if (!recorded.record.patchVersion || recorded.record.patchVersion !== WEAPP_TW_VERSION) reason = "stale";
474
- else if (options?.cwd && recorded.record.cwd && node_path.default.normalize(recorded.record.cwd) !== node_path.default.normalize(options.cwd)) reason = "metadata";
475
- else if (!recorded.record.cwd && options?.cwd) reason = "metadata";
476
- if (!(options?.alwaysRecord || !recorded || Boolean(reason))) return;
477
- let message;
478
- switch (reason) {
479
- case "mismatch":
480
- message = "检测到 Tailwind CSS 目标记录与当前解析结果不一致,正在自动重新 patch 并刷新缓存。";
481
- break;
482
- case "migrate":
483
- case "stale":
484
- message = "正在刷新当前子包的 Tailwind CSS 补丁记录,确保缓存隔离。";
485
- break;
486
- case "missing":
487
- message = "未找到当前子包的 Tailwind CSS 目标记录,正在生成。";
488
- break;
489
- default: break;
490
- }
491
- const onPatched = async () => saveCliPatchTargetRecord(normalizedBase, patcher, {
492
- cwd: options?.cwd ?? normalizedBase,
493
- source: options?.source ?? "cli",
494
- recordPath: location.recordPath,
495
- recordKey: location.recordKey,
496
- packageJsonPath: location.packageJsonPath
497
- });
498
- return {
499
- recordPath: location.recordPath,
500
- message,
501
- reason,
502
- onPatched
503
- };
319
+ if (relative.startsWith("..")) return normalized.replace(/\\/g, "/");
320
+ return node_path.default.join(".", relative).replace(/\\/g, "/");
504
321
  }
505
- //#endregion
506
- //#region src/tailwindcss/targets.ts
507
- function logTailwindcssTarget(kind, patcher, baseDir) {
322
+ function logTailwindcssTarget(patcher, baseDir) {
508
323
  const packageInfo = patcher?.packageInfo;
509
- const label = kind === "cli" ? "weapp-tw patch" : "Weapp-tailwindcss";
324
+ const label = "Weapp-tailwindcss";
510
325
  if (!packageInfo?.rootPath) {
511
326
  _weapp_tailwindcss_logger.logger.warn("%s 未找到 Tailwind CSS 依赖,请检查在 %s 是否已安装 tailwindcss", label, baseDir ?? node_process.default.cwd());
512
327
  return;
513
328
  }
514
329
  const displayPath = formatRelativeToBase(packageInfo.rootPath, baseDir);
515
330
  const version = packageInfo.version ? ` (v${packageInfo.version})` : "";
516
- if (kind === "runtime") {
517
- logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
518
- return;
519
- }
520
- _weapp_tailwindcss_logger.logger.info("%s 绑定 Tailwind CSS -> %s%s", label, displayPath, version);
331
+ logRuntimeTailwindcssTarget(baseDir, packageInfo.rootPath, packageInfo.version);
332
+ _weapp_tailwindcss_logger.logger.debug("%s 解析 Tailwind CSS -> %s%s", label, displayPath, version);
521
333
  }
522
334
  //#endregion
523
335
  //#region src/context/compiler-context-cache.ts
@@ -539,7 +351,7 @@ function withCircularGuard(value, stack, factory) {
539
351
  }
540
352
  function encodeTaggedValue(type, value) {
541
353
  const record = { __type: type };
542
- if (value !== void 0) record.value = value;
354
+ if (value !== void 0) record["value"] = value;
543
355
  return record;
544
356
  }
545
357
  function hasExplicitOptionBasedir(opts) {
@@ -547,7 +359,7 @@ function hasExplicitOptionBasedir(opts) {
547
359
  }
548
360
  function shouldProbeCallerLocation(opts) {
549
361
  if (hasExplicitOptionBasedir(opts)) return false;
550
- return !(node_process.default.env.WEAPP_TAILWINDCSS_BASEDIR || node_process.default.env.WEAPP_TAILWINDCSS_BASE_DIR || node_process.default.env.TAILWINDCSS_BASEDIR || node_process.default.env.TAILWINDCSS_BASE_DIR);
362
+ return !(node_process.default.env["WEAPP_TAILWINDCSS_BASEDIR"] || node_process.default.env["WEAPP_TAILWINDCSS_BASE_DIR"] || node_process.default.env["TAILWINDCSS_BASEDIR"] || node_process.default.env["TAILWINDCSS_BASE_DIR"]);
551
363
  }
552
364
  function detectCallerLocation() {
553
365
  const stack = (/* @__PURE__ */ new Error("compiler-context-cache stack probe")).stack;
@@ -567,19 +379,19 @@ function getRuntimeCacheScope(opts) {
567
379
  const runtimeScope = {
568
380
  caller: void 0,
569
381
  cwd: node_process.default.cwd(),
570
- init_cwd: node_process.default.env.INIT_CWD,
571
- npm_config_local_prefix: node_process.default.env.npm_config_local_prefix,
572
- npm_package_json: node_process.default.env.npm_package_json,
573
- pnpm_package_name: node_process.default.env.PNPM_PACKAGE_NAME,
574
- pwd: node_process.default.env.PWD,
575
- tailwindcss_base_dir: node_process.default.env.TAILWINDCSS_BASE_DIR,
576
- tailwindcss_basedir: node_process.default.env.TAILWINDCSS_BASEDIR,
577
- uni_app_input_dir: node_process.default.env.UNI_APP_INPUT_DIR,
578
- uni_cli_root: node_process.default.env.UNI_CLI_ROOT,
579
- uni_input_dir: node_process.default.env.UNI_INPUT_DIR,
580
- uni_input_root: node_process.default.env.UNI_INPUT_ROOT,
581
- weapp_tailwindcss_base_dir: node_process.default.env.WEAPP_TAILWINDCSS_BASE_DIR,
582
- weapp_tailwindcss_basedir: node_process.default.env.WEAPP_TAILWINDCSS_BASEDIR
382
+ init_cwd: node_process.default.env["INIT_CWD"],
383
+ npm_config_local_prefix: node_process.default.env["npm_config_local_prefix"],
384
+ npm_package_json: node_process.default.env["npm_package_json"],
385
+ pnpm_package_name: node_process.default.env["PNPM_PACKAGE_NAME"],
386
+ pwd: node_process.default.env["PWD"],
387
+ tailwindcss_base_dir: node_process.default.env["TAILWINDCSS_BASE_DIR"],
388
+ tailwindcss_basedir: node_process.default.env["TAILWINDCSS_BASEDIR"],
389
+ uni_app_input_dir: node_process.default.env["UNI_APP_INPUT_DIR"],
390
+ uni_cli_root: node_process.default.env["UNI_CLI_ROOT"],
391
+ uni_input_dir: node_process.default.env["UNI_INPUT_DIR"],
392
+ uni_input_root: node_process.default.env["UNI_INPUT_ROOT"],
393
+ weapp_tailwindcss_base_dir: node_process.default.env["WEAPP_TAILWINDCSS_BASE_DIR"],
394
+ weapp_tailwindcss_basedir: node_process.default.env["WEAPP_TAILWINDCSS_BASEDIR"]
583
395
  };
584
396
  if (shouldProbeCallerLocation(opts)) runtimeScope.caller = detectCallerLocation();
585
397
  return runtimeScope;
@@ -722,6 +534,15 @@ function toCustomAttributesEntities(customAttributes) {
722
534
  return Object.entries(customAttributes);
723
535
  }
724
536
  //#endregion
537
+ //#region src/constants.ts
538
+ const pluginName = "weapp-tailwindcss";
539
+ const vitePluginName = "weapp-tailwindcss:adaptor";
540
+ const DEFAULT_RUNTIME_PACKAGE_REPLACEMENTS = {
541
+ "tailwind-merge": "@weapp-tailwindcss/merge",
542
+ "class-variance-authority": "@weapp-tailwindcss/cva",
543
+ "tailwind-variants": "@weapp-tailwindcss/variants"
544
+ };
545
+ //#endregion
725
546
  //#region src/babel/index.ts
726
547
  function _interopDefaultCompat(e) {
727
548
  return e && typeof e === "object" && "default" in e ? e.default : e;
@@ -735,6 +556,7 @@ function buildFuzzyMatcher(fuzzyStrings) {
735
556
  if (fuzzyStrings.length === 0) return;
736
557
  if (fuzzyStrings.length === 1) {
737
558
  const [needle] = fuzzyStrings;
559
+ if (needle === void 0) return;
738
560
  return (value) => value.includes(needle);
739
561
  }
740
562
  const unique = [...new Set(fuzzyStrings)];
@@ -758,11 +580,13 @@ function createNameMatcher(list, { exact = false } = {}) {
758
580
  const exactStringCount = exactStrings?.size ?? 0;
759
581
  if (exactStringCount === 1 && regexList.length === 0) {
760
582
  const [needle] = exactStrings;
583
+ if (needle === void 0) return NEVER_MATCH_NAME$1;
761
584
  return (value) => value === needle;
762
585
  }
763
586
  if (regexList.length === 0) return (value) => exactStrings.has(value);
764
587
  if (exactStringCount === 0 && regexList.length === 1) {
765
588
  const [regex] = regexList;
589
+ if (!regex) return NEVER_MATCH_NAME$1;
766
590
  return (value) => regex.test(value);
767
591
  }
768
592
  return (value) => {
@@ -775,6 +599,7 @@ function createNameMatcher(list, { exact = false } = {}) {
775
599
  if (fuzzyMatcher && !hasRegex) return fuzzyMatcher;
776
600
  if (!fuzzyMatcher && regexList.length === 1) {
777
601
  const [regex] = regexList;
602
+ if (!regex) return NEVER_MATCH_NAME$1;
778
603
  return (value) => regex.test(value);
779
604
  }
780
605
  return (value) => {
@@ -812,10 +637,10 @@ function replaceWxml(original, options = {
812
637
  const { keepEOL, escapeMap, ignoreHead } = options;
813
638
  let res = original;
814
639
  if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
815
- res = (0, _weapp_core_escape.escape)(res, {
640
+ res = (0, _weapp_core_escape.escape)(res, require_cache.omitUndefined({
816
641
  map: escapeMap,
817
642
  ignoreHead
818
- });
643
+ }));
819
644
  return res;
820
645
  }
821
646
  //#endregion
@@ -1012,7 +837,7 @@ function isClassContextLiteralPath(path) {
1012
837
  }
1013
838
  //#endregion
1014
839
  //#region src/js/handlers.ts
1015
- const debug$1 = createDebug("[js:handlers] ");
840
+ const debug = require_runtime_patch.createDebug("[js:handlers] ");
1016
841
  const replacementCacheByEscapeMap = /* @__PURE__ */ new WeakMap();
1017
842
  const defaultReplacementCache = /* @__PURE__ */ new Map();
1018
843
  const WEAPP_TW_IGNORE_MARKER = "weapp-tw";
@@ -1113,7 +938,7 @@ function replaceHandleValue(path, options) {
1113
938
  const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path, options);
1114
939
  const candidates = (0, _weapp_tailwindcss_shared_extractors.splitCode)(literal, allowDoubleQuotes);
1115
940
  if (candidates.length === 0) return;
1116
- const debugEnabled = debug$1.enabled;
941
+ const debugEnabled = debug.enabled;
1117
942
  const classContext = options.wrapExpression || isClassContextLiteralPath(path);
1118
943
  let transformed = literal;
1119
944
  let mutated = false;
@@ -1149,7 +974,7 @@ function replaceHandleValue(path, options) {
1149
974
  }
1150
975
  const node = path.node;
1151
976
  if (!mutated || typeof node.start !== "number" || typeof node.end !== "number") return;
1152
- if (debugEnabled) debug$1("runtimeSet size=%d fallbackTriggered=%s candidates=%d matched=%d escapedHits=%d skipped=%d file=%s escapedSamples=%s skippedSamples=%s", classNameSet?.size ?? 0, fallbackDecisionCount > 0, candidates.length, matchedCandidateCount, escapedDecisionCount, skippedSamples?.length ?? 0, options.filename ?? "unknown", escapedSamples?.join(",") || "-", skippedSamples?.join(",") || "-");
977
+ if (debugEnabled) debug("runtimeSet size=%d fallbackTriggered=%s candidates=%d matched=%d escapedHits=%d skipped=%d file=%s escapedSamples=%s skippedSamples=%s", classNameSet?.size ?? 0, fallbackDecisionCount > 0, candidates.length, matchedCandidateCount, escapedDecisionCount, skippedSamples?.length ?? 0, options.filename ?? "unknown", escapedSamples?.join(",") || "-", skippedSamples?.join(",") || "-");
1153
978
  const start = node.start + offset;
1154
979
  const end = node.end - offset;
1155
980
  if (start >= end || transformed === original) return;
@@ -1353,6 +1178,44 @@ function walkEvalExpression(path, options, updater, handler) {
1353
1178
  }
1354
1179
  }
1355
1180
  //#endregion
1181
+ //#region \0@oxc-project+runtime@0.129.0/helpers/typeof.js
1182
+ function _typeof(o) {
1183
+ "@babel/helpers - typeof";
1184
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
1185
+ return typeof o;
1186
+ } : function(o) {
1187
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
1188
+ }, _typeof(o);
1189
+ }
1190
+ //#endregion
1191
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPrimitive.js
1192
+ function toPrimitive(t, r) {
1193
+ if ("object" != _typeof(t) || !t) return t;
1194
+ var e = t[Symbol.toPrimitive];
1195
+ if (void 0 !== e) {
1196
+ var i = e.call(t, r || "default");
1197
+ if ("object" != _typeof(i)) return i;
1198
+ throw new TypeError("@@toPrimitive must return a primitive value.");
1199
+ }
1200
+ return ("string" === r ? String : Number)(t);
1201
+ }
1202
+ //#endregion
1203
+ //#region \0@oxc-project+runtime@0.129.0/helpers/toPropertyKey.js
1204
+ function toPropertyKey(t) {
1205
+ var i = toPrimitive(t, "string");
1206
+ return "symbol" == _typeof(i) ? i : i + "";
1207
+ }
1208
+ //#endregion
1209
+ //#region \0@oxc-project+runtime@0.129.0/helpers/defineProperty.js
1210
+ function _defineProperty(e, r, t) {
1211
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1212
+ value: t,
1213
+ enumerable: !0,
1214
+ configurable: !0,
1215
+ writable: !0
1216
+ }) : e[r] = t, e;
1217
+ }
1218
+ //#endregion
1356
1219
  //#region src/js/JsTokenUpdater.ts
1357
1220
  /**
1358
1221
  * Lightweight helper that batches updates to {@link MagicString}.
@@ -1361,6 +1224,7 @@ function walkEvalExpression(path, options, updater, handler) {
1361
1224
  */
1362
1225
  var JsTokenUpdater = class {
1363
1226
  constructor({ value } = {}) {
1227
+ _defineProperty(this, "tokens", void 0);
1364
1228
  this.tokens = value ? [...value] : [];
1365
1229
  }
1366
1230
  addToken(token) {
@@ -1394,7 +1258,7 @@ var JsTokenUpdater = class {
1394
1258
  var IgnoredExportsTracker = class {
1395
1259
  constructor(options) {
1396
1260
  this.options = options;
1397
- this.ignoredExportNames = /* @__PURE__ */ new Map();
1261
+ _defineProperty(this, "ignoredExportNames", /* @__PURE__ */ new Map());
1398
1262
  }
1399
1263
  addIgnoredExport(filename, exportName) {
1400
1264
  if (!exportName) return;
@@ -1513,8 +1377,16 @@ var IgnoredExportsTracker = class {
1513
1377
  //#region src/js/ModuleGraph.ts
1514
1378
  var JsModuleGraph = class {
1515
1379
  constructor(entry, graphOptions) {
1516
- this.modules = /* @__PURE__ */ new Map();
1517
- this.queue = [];
1380
+ _defineProperty(this, "modules", /* @__PURE__ */ new Map());
1381
+ _defineProperty(this, "queue", []);
1382
+ _defineProperty(this, "resolve", void 0);
1383
+ _defineProperty(this, "load", void 0);
1384
+ _defineProperty(this, "filter", void 0);
1385
+ _defineProperty(this, "maxDepth", void 0);
1386
+ _defineProperty(this, "baseOptions", void 0);
1387
+ _defineProperty(this, "parserOptions", void 0);
1388
+ _defineProperty(this, "rootFilename", void 0);
1389
+ _defineProperty(this, "ignoredExports", void 0);
1518
1390
  this.resolve = graphOptions.resolve;
1519
1391
  this.load = graphOptions.load;
1520
1392
  this.filter = graphOptions.filter;
@@ -1686,6 +1558,12 @@ const NEVER_MATCH_NAME = () => false;
1686
1558
  */
1687
1559
  var NodePathWalker = class {
1688
1560
  constructor({ ignoreCallExpressionIdentifiers, callback } = {}) {
1561
+ _defineProperty(this, "ignoreCallExpressionIdentifiers", void 0);
1562
+ _defineProperty(this, "callback", void 0);
1563
+ _defineProperty(this, "isIgnoredCallIdentifier", void 0);
1564
+ _defineProperty(this, "hasIgnoredCallIdentifiers", void 0);
1565
+ _defineProperty(this, "importsStore", void 0);
1566
+ _defineProperty(this, "visitedStore", void 0);
1689
1567
  this.hasIgnoredCallIdentifiers = Boolean(ignoreCallExpressionIdentifiers && ignoreCallExpressionIdentifiers.length > 0);
1690
1568
  this.ignoreCallExpressionIdentifiers = ignoreCallExpressionIdentifiers ?? EMPTY_IGNORE_CALL_EXPRESSION_IDENTIFIERS;
1691
1569
  this.callback = callback ?? NOOP_STRING_PATH_CALLBACK;
@@ -1948,7 +1826,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
1948
1826
  const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
1949
1827
  const ignoredPaths = needScope ? /* @__PURE__ */ new WeakSet() : EMPTY_IGNORED_PATHS;
1950
1828
  const walker = needScope ? new NodePathWalker({
1951
- ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers,
1829
+ ...options.ignoreCallExpressionIdentifiers === void 0 ? {} : { ignoreCallExpressionIdentifiers: options.ignoreCallExpressionIdentifiers },
1952
1830
  callback(path) {
1953
1831
  ignoredPaths.add(path);
1954
1832
  }
@@ -1958,7 +1836,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
1958
1836
  function getTaggedTemplateIgnore() {
1959
1837
  if (!taggedTemplateIgnore) taggedTemplateIgnore = createTaggedTemplateIgnore({
1960
1838
  matcher: getIgnoredTaggedTemplateMatcher(options),
1961
- names: options.ignoreTaggedTemplateExpressionIdentifiers
1839
+ ...options.ignoreTaggedTemplateExpressionIdentifiers === void 0 ? {} : { names: options.ignoreTaggedTemplateExpressionIdentifiers }
1962
1840
  });
1963
1841
  return taggedTemplateIgnore;
1964
1842
  }
@@ -2112,7 +1990,6 @@ function getOptionsFingerprint(options) {
2112
1990
  options.uniAppX ? "1" : "0",
2113
1991
  options.wrapExpression ? "1" : "0",
2114
1992
  String(options.tailwindcssMajorVersion ?? ""),
2115
- String(options.staleClassNameFallback ?? ""),
2116
1993
  String(options.jsArbitraryValueFallback ?? ""),
2117
1994
  JSON.stringify(options.arbitraryValues ?? null),
2118
1995
  JSON.stringify(options.ignoreCallExpressionIdentifiers ?? null),
@@ -2136,7 +2013,6 @@ function shouldCacheJsResult(rawSource, options) {
2136
2013
  function createJsHandler(options) {
2137
2014
  const defaults = {
2138
2015
  escapeMap: options.escapeMap,
2139
- staleClassNameFallback: options.staleClassNameFallback,
2140
2016
  jsArbitraryValueFallback: options.jsArbitraryValueFallback,
2141
2017
  tailwindcssMajorVersion: options.tailwindcssMajorVersion,
2142
2018
  arbitraryValues: options.arbitraryValues,
@@ -2298,11 +2174,7 @@ function generateCode(match, options = {}) {
2298
2174
  const initial = jsHandler(match, runtimeSet, wrapExpression ? WRAP_EXPRESSION_HANDLER_OPTIONS : void 0);
2299
2175
  if (!initial.error || wrapExpression) return initial.code;
2300
2176
  return jsHandler(match, runtimeSet, WRAP_EXPRESSION_HANDLER_OPTIONS).code;
2301
- } else
2302
- /**
2303
- * @deprecated
2304
- */
2305
- return rewriteLegacyExpression(match, options);
2177
+ } else return rewriteLegacyExpression(match, options);
2306
2178
  } catch {
2307
2179
  return match;
2308
2180
  }
@@ -2331,6 +2203,13 @@ function isAllWhitespace(value) {
2331
2203
  //#region src/wxml/Tokenizer.ts
2332
2204
  var Tokenizer = class {
2333
2205
  constructor() {
2206
+ _defineProperty(this, "state", void 0);
2207
+ _defineProperty(this, "buffer", void 0);
2208
+ _defineProperty(this, "tokens", void 0);
2209
+ _defineProperty(this, "bufferStartIndex", void 0);
2210
+ _defineProperty(this, "expressionStartIndex", void 0);
2211
+ _defineProperty(this, "expressionBuffer", void 0);
2212
+ _defineProperty(this, "expressions", void 0);
2334
2213
  this.reset();
2335
2214
  }
2336
2215
  processChar(char, index) {
@@ -2421,6 +2300,7 @@ var Tokenizer = class {
2421
2300
  this.reset();
2422
2301
  for (let i = 0; i < input.length; i++) {
2423
2302
  const char = input[i];
2303
+ if (char === void 0) continue;
2424
2304
  this.processChar(char, i);
2425
2305
  }
2426
2306
  if (this.buffer.length > 0) this.tokens.push({
@@ -2483,6 +2363,7 @@ function handleEachClassFragment(ms, tokens, options = {}) {
2483
2363
  }
2484
2364
  if (tokens.length > 0) {
2485
2365
  const lastToken = tokens[tokens.length - 1];
2366
+ if (!lastToken) return;
2486
2367
  if (lastToken.end < ms.original.length) updateWhitespaceGap(ms, lastToken.end, ms.original.length, options);
2487
2368
  }
2488
2369
  }
@@ -2557,7 +2438,7 @@ async function customTemplateHandler(rawSource, options, cachedMatcher) {
2557
2438
  }, { xmlMode: true });
2558
2439
  parser.write(rawSource);
2559
2440
  parser.end();
2560
- for (const { data, endIndex, startIndex } of wxsArray ?? []) {
2441
+ if (jsHandler) for (const { data, endIndex, startIndex } of wxsArray ?? []) {
2561
2442
  const { code } = await jsHandler(data, runtimeSet);
2562
2443
  if (code !== data) getMagicString().update(startIndex, endIndex, code);
2563
2444
  }
@@ -2596,9 +2477,9 @@ function resolveRuntimePackageReplacements(option) {
2596
2477
  return Object.keys(normalized).length > 0 ? normalized : void 0;
2597
2478
  }
2598
2479
  function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions, tailwindcssMajorVersion) {
2599
- const { cssPreflight, cssPreflightRange, escapeMap, cssChildCombinatorReplaceValue, injectAdditionalCssVarScope, cssSelectorReplacement, rem2rpx, postcssOptions, cssRemoveProperty, cssRemoveHoverPseudoClass, cssPresetEnv, autoprefixer, uniAppX, px2rpx, unitsToPx, arbitraryValues, jsPreserveClass, staleClassNameFallback, jsArbitraryValueFallback, babelParserOptions, ignoreCallExpressionIdentifiers, ignoreTaggedTemplateExpressionIdentifiers, inlineWxs, disabledDefaultTemplateHandler, replaceRuntimePackages } = ctx;
2600
- const uniAppXEnabled = require_logger.isUniAppXEnabled(uniAppX);
2601
- const resolvedUniAppXOptions = require_logger.resolveUniAppXOptions(uniAppX);
2480
+ const { cssPreflight, cssPreflightRange, escapeMap, cssChildCombinatorReplaceValue, injectAdditionalCssVarScope, cssSelectorReplacement, rem2rpx, postcssOptions, cssRemoveProperty, cssRemoveHoverPseudoClass, cssPresetEnv, autoprefixer, uniAppX, px2rpx, unitsToPx, arbitraryValues, jsPreserveClass, jsArbitraryValueFallback, babelParserOptions, ignoreCallExpressionIdentifiers, ignoreTaggedTemplateExpressionIdentifiers, inlineWxs, disabledDefaultTemplateHandler, replaceRuntimePackages } = ctx;
2481
+ const uniAppXEnabled = require_tailwindcss.isUniAppXEnabled(uniAppX);
2482
+ const resolvedUniAppXOptions = require_tailwindcss.resolveUniAppXOptions(uniAppX);
2602
2483
  const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
2603
2484
  const styleHandler = (0, _weapp_tailwindcss_postcss.createStyleHandler)({
2604
2485
  cssPreflight,
@@ -2624,7 +2505,6 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
2624
2505
  escapeMap,
2625
2506
  arbitraryValues,
2626
2507
  jsPreserveClass,
2627
- staleClassNameFallback,
2628
2508
  jsArbitraryValueFallback: jsArbitraryValueFallback ?? "auto",
2629
2509
  tailwindcssMajorVersion,
2630
2510
  generateMap: true,
@@ -2691,11 +2571,12 @@ function createInternalCompilerContext(opts) {
2691
2571
  const ctx = (0, _weapp_tailwindcss_shared.defuOverrideArray)(opts, require_defaults.getDefaultOptions(), {});
2692
2572
  ctx.escapeMap = ctx.customReplaceDictionary;
2693
2573
  applyLoggerLevel(ctx.logLevel);
2694
- const twPatcher = require_logger.createTailwindcssPatcherFromContext(ctx);
2695
- logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
2574
+ const twPatcher = require_tailwindcss.createTailwindcssPatcherFromContext(ctx);
2575
+ logTailwindcssTarget(twPatcher, ctx.tailwindcssBasedir);
2696
2576
  logRuntimeTailwindcssVersion(ctx.tailwindcssBasedir, twPatcher.packageInfo?.rootPath, twPatcher.packageInfo?.version);
2697
- require_logger.warnMissingCssEntries(ctx, twPatcher);
2698
- const cssCalcOptions = require_logger.applyV4CssCalcDefaults(ctx.cssCalc, twPatcher);
2577
+ if (opts?.__internalDeferMissingCssEntriesWarning !== true) require_tailwindcss.warnMissingCssEntries(ctx, twPatcher);
2578
+ ctx.cssPreflight = require_defaults.resolveDefaultCssPreflight(opts?.cssPreflight, twPatcher.majorVersion);
2579
+ const cssCalcOptions = require_tailwindcss.applyV4CssCalcDefaults(ctx.cssCalc, twPatcher);
2699
2580
  ctx.cssCalc = cssCalcOptions;
2700
2581
  const { styleHandler, jsHandler, templateHandler } = createHandlersFromContext(ctx, toCustomAttributesEntities(ctx.customAttributes), cssCalcOptions, twPatcher.majorVersion);
2701
2582
  ctx.styleHandler = styleHandler;
@@ -2706,8 +2587,8 @@ function createInternalCompilerContext(opts) {
2706
2587
  const refreshTailwindcssPatcher = async (options) => {
2707
2588
  const previousPatcher = ctx.twPatcher;
2708
2589
  if (options?.clearCache !== false) await clearTailwindcssPatcherCache(previousPatcher);
2709
- require_logger.invalidateRuntimeClassSet(previousPatcher);
2710
- const nextPatcher = require_logger.createTailwindcssPatcherFromContext(ctx);
2590
+ require_cache.invalidateRuntimeClassSet(previousPatcher);
2591
+ const nextPatcher = require_tailwindcss.createTailwindcssPatcherFromContext(ctx);
2711
2592
  Object.assign(previousPatcher, nextPatcher);
2712
2593
  ctx.twPatcher = previousPatcher;
2713
2594
  return previousPatcher;
@@ -2720,9 +2601,9 @@ function createInternalCompilerContext(opts) {
2720
2601
  return ctx;
2721
2602
  }
2722
2603
  /**
2723
- * 获取用户定义选项的内部表示,并初始化相关的处理程序和补丁。
2604
+ * 获取用户定义选项的内部表示,并初始化相关的处理程序和 Tailwind 运行时。
2724
2605
  * @param opts - 用户定义的选项,可选。
2725
- * @returns 返回一个包含内部用户定义选项的对象,包括样式、JS和模板处理程序,以及Tailwind CSS补丁。
2606
+ * @returns 返回一个包含内部用户定义选项的对象,包括样式、JS 和模板处理程序,以及 Tailwind CSS 运行时。
2726
2607
  */
2727
2608
  function getCompilerContext(opts) {
2728
2609
  return withCompilerContextCache(opts, () => createInternalCompilerContext(opts));
@@ -2742,7 +2623,7 @@ const DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+f
2742
2623
  * @returns 如果可以跳过转换返回 `true`,否则返回 `false`
2743
2624
  */
2744
2625
  function shouldSkipJsTransform(rawSource, options) {
2745
- if (node_process.default.env.WEAPP_TW_DISABLE_JS_PRECHECK === "1") return false;
2626
+ if (node_process.default.env["WEAPP_TW_DISABLE_JS_PRECHECK"] === "1") return false;
2746
2627
  if (!rawSource) return true;
2747
2628
  if (options?.alwaysEscape) return false;
2748
2629
  if (options?.moduleSpecifierReplacements && Object.keys(options.moduleSpecifierReplacements).length > 0) return false;
@@ -2751,29 +2632,18 @@ function shouldSkipJsTransform(rawSource, options) {
2751
2632
  return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
2752
2633
  }
2753
2634
  //#endregion
2754
- //#region src/tailwindcss/recorder.ts
2755
- function setupPatchRecorder(patcher, baseDir, options) {
2756
- const recorder = createPatchTargetRecorder(baseDir, patcher, options);
2757
- if (recorder?.message && options?.logMessage !== false) {
2758
- const prefix = options?.messagePrefix ? `${options.messagePrefix} ` : "";
2759
- _weapp_tailwindcss_logger.logger.info("%s%s", prefix, recorder.message);
2760
- }
2761
- const onPatchCompleted = recorder?.onPatched ? async () => {
2762
- await recorder.onPatched();
2763
- } : void 0;
2764
- return {
2765
- recorder,
2766
- patchPromise: patcher ? createTailwindPatchPromise(patcher, onPatchCompleted) : Promise.resolve(),
2767
- onPatchCompleted
2768
- };
2769
- }
2770
- //#endregion
2771
2635
  Object.defineProperty(exports, "JsTokenUpdater", {
2772
2636
  enumerable: true,
2773
2637
  get: function() {
2774
2638
  return JsTokenUpdater;
2775
2639
  }
2776
2640
  });
2641
+ Object.defineProperty(exports, "_defineProperty", {
2642
+ enumerable: true,
2643
+ get: function() {
2644
+ return _defineProperty;
2645
+ }
2646
+ });
2777
2647
  Object.defineProperty(exports, "analyzeSource", {
2778
2648
  enumerable: true,
2779
2649
  get: function() {
@@ -2798,10 +2668,10 @@ Object.defineProperty(exports, "createAttributeMatcher", {
2798
2668
  return createAttributeMatcher;
2799
2669
  }
2800
2670
  });
2801
- Object.defineProperty(exports, "createDebug", {
2671
+ Object.defineProperty(exports, "createTailwindRuntimeReadyPromise", {
2802
2672
  enumerable: true,
2803
2673
  get: function() {
2804
- return createDebug;
2674
+ return createTailwindRuntimeReadyPromise;
2805
2675
  }
2806
2676
  });
2807
2677
  Object.defineProperty(exports, "ensureRuntimeClassSet", {
@@ -2846,12 +2716,6 @@ Object.defineProperty(exports, "replaceWxml", {
2846
2716
  return replaceWxml;
2847
2717
  }
2848
2718
  });
2849
- Object.defineProperty(exports, "setupPatchRecorder", {
2850
- enumerable: true,
2851
- get: function() {
2852
- return setupPatchRecorder;
2853
- }
2854
- });
2855
2719
  Object.defineProperty(exports, "shouldSkipJsTransform", {
2856
2720
  enumerable: true,
2857
2721
  get: function() {