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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/README.md +6 -7
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/bundle-state-BlXvU4jl.js +530 -0
  4. package/dist/bundle-state-PO6MysTJ.mjs +414 -0
  5. package/dist/bundlers/shared/cache.d.ts +6 -6
  6. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
  7. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
  8. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +5 -0
  9. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  10. package/dist/bundlers/shared/css-cleanup.d.ts +7 -3
  11. package/dist/bundlers/shared/css-imports.d.ts +3 -3
  12. package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
  13. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  14. package/dist/bundlers/shared/generator-css/directives.d.ts +20 -0
  15. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  16. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  17. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  18. package/dist/bundlers/shared/generator-css/markers.d.ts +28 -0
  19. package/dist/bundlers/shared/generator-css/source-files.d.ts +14 -0
  20. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +24 -0
  21. package/dist/bundlers/shared/generator-css.d.ts +16 -22
  22. package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
  23. package/dist/bundlers/shared/style-requests.d.ts +2 -0
  24. package/dist/bundlers/vite/bundle-state.d.ts +1 -0
  25. package/dist/bundlers/vite/css-finalizer.d.ts +7 -1
  26. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  27. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +24 -0
  28. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +4 -0
  29. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  30. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  31. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  32. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  33. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  34. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  35. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  36. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  37. package/dist/bundlers/vite/generate-bundle.d.ts +14 -2
  38. package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +5 -1
  39. package/dist/bundlers/vite/index.d.ts +1 -1
  40. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  41. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  42. package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
  43. package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -3
  44. package/dist/bundlers/vite/runtime-class-set.d.ts +25 -0
  45. package/dist/bundlers/vite/source-candidates.d.ts +16 -1
  46. package/dist/bundlers/vite/source-scan.d.ts +26 -0
  47. package/dist/bundlers/vite/static-config-content.d.ts +5 -0
  48. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  49. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
  50. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +6 -2
  51. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +9 -3
  52. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -0
  53. package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
  54. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -6
  55. package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
  56. package/dist/cache/index.d.ts +6 -6
  57. package/dist/cli/context.d.ts +1 -14
  58. package/dist/cli/doctor/types.d.ts +11 -11
  59. package/dist/cli/helpers.d.ts +1 -2
  60. package/dist/cli/mount-options.d.ts +2 -0
  61. package/dist/cli/types.d.ts +0 -2
  62. package/dist/cli/vscode-entry.d.ts +3 -3
  63. package/dist/cli.js +605 -611
  64. package/dist/cli.mjs +614 -620
  65. package/dist/constants.d.ts +1 -2
  66. package/dist/core.js +13 -20
  67. package/dist/core.mjs +8 -14
  68. package/dist/css-macro/postcss.js +3 -2
  69. package/dist/css-macro/postcss.mjs +3 -2
  70. package/dist/css-macro.d.ts +1 -0
  71. package/dist/css-macro.js +2 -2
  72. package/dist/css-macro.mjs +2 -2
  73. package/dist/defaults-B1igPF_e.mjs +150 -0
  74. package/dist/defaults-IHhYxNeU.js +193 -0
  75. package/dist/defaults.d.ts +15 -1
  76. package/dist/defaults.js +6 -131
  77. package/dist/defaults.mjs +2 -129
  78. package/dist/escape.js +10 -2
  79. package/dist/escape.mjs +10 -2
  80. package/dist/generator/index.d.ts +1 -1
  81. package/dist/generator/options.d.ts +9 -8
  82. package/dist/generator/types.d.ts +3 -3
  83. package/dist/generator-DIuglJub.mjs +32 -0
  84. package/dist/generator-N4jy1HCk.js +55 -0
  85. package/dist/generator.js +12 -11
  86. package/dist/generator.mjs +2 -1
  87. package/dist/gulp.js +185 -47
  88. package/dist/gulp.mjs +179 -41
  89. package/dist/incremental-runtime-class-set-CJ0Pnsw2.js +2348 -0
  90. package/dist/incremental-runtime-class-set-hF-uiw6W.mjs +2285 -0
  91. package/dist/index.d.ts +1 -1
  92. package/dist/index.js +6 -6
  93. package/dist/index.mjs +5 -5
  94. package/dist/js/babel/cache-options.d.ts +3 -0
  95. package/dist/js/babel/parse.d.ts +7 -4
  96. package/dist/js/index.d.ts +1 -0
  97. package/dist/js/literal-transform.d.ts +2 -0
  98. package/dist/js/precheck.d.ts +2 -2
  99. package/dist/lightningcss/style-handler/selector-transform.d.ts +1 -1
  100. package/dist/lightningcss/style-handler.d.ts +3 -3
  101. package/dist/logger-CZUxvJJD.mjs +2 -0
  102. package/dist/logger-EVNB9z7i.js +1 -0
  103. package/dist/postcss/config-directive.d.ts +1 -0
  104. package/dist/postcss/context.d.ts +9 -0
  105. package/dist/postcss/source-files.d.ts +8 -0
  106. package/dist/postcss/tailwind-version.d.ts +3 -0
  107. package/dist/postcss-D4UdbBQ6.mjs +228 -0
  108. package/dist/postcss-DlY-YRvA.js +237 -0
  109. package/dist/postcss.d.ts +2 -2
  110. package/dist/postcss.js +3 -276
  111. package/dist/postcss.mjs +1 -269
  112. package/dist/{recorder-gYSNLfOP.js → precheck-BjEbVEpX.js} +218 -314
  113. package/dist/{recorder-zsgatmkB.mjs → precheck-tbk626YL.mjs} +186 -281
  114. package/dist/presets.js +13 -11
  115. package/dist/presets.mjs +11 -9
  116. package/dist/reset.d.ts +1 -0
  117. package/dist/runtime-registry-D5qnaSpo.js +5516 -0
  118. package/dist/shared/mpx.d.ts +1 -0
  119. package/dist/source-candidates-BrvneDDd.mjs +209 -0
  120. package/dist/source-candidates-gxijpPI3.js +222 -0
  121. package/dist/tailwindcss/miniprogram.d.ts +5 -1
  122. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  123. package/dist/tailwindcss/patcher.d.ts +1 -2
  124. package/dist/tailwindcss/runtime/cache.d.ts +4 -3
  125. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  126. package/dist/tailwindcss/runtime.d.ts +11 -12
  127. package/dist/tailwindcss/source-scan.d.ts +35 -0
  128. package/dist/tailwindcss/targets.d.ts +1 -5
  129. package/dist/tailwindcss/v3-engine/types.d.ts +17 -14
  130. package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
  131. package/dist/tailwindcss/v4/css-sources.d.ts +5 -0
  132. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  133. package/dist/tailwindcss/v4/patcher.d.ts +1 -0
  134. package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
  135. package/dist/tailwindcss/v4-engine/types.d.ts +17 -5
  136. package/dist/tailwindcss/version.d.ts +4 -0
  137. package/dist/tailwindcss-BhG7BtB-.js +651 -0
  138. package/dist/tailwindcss-c6ROlNNW.mjs +600 -0
  139. package/dist/typedoc.export.d.ts +0 -2
  140. package/dist/types/index.d.ts +51 -48
  141. package/dist/types/shared.d.ts +3 -0
  142. package/dist/types/user-defined-options/general.d.ts +23 -23
  143. package/dist/types/user-defined-options/important.d.ts +31 -28
  144. package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
  145. package/dist/types/user-defined-options/matcher.d.ts +6 -6
  146. package/dist/uni-app-x/vite.d.ts +1 -1
  147. package/dist/utils/disabled.d.ts +2 -3
  148. package/dist/utils/object.d.ts +9 -0
  149. package/dist/{utils-DmC9_In3.js → utils-4ODFyoqD.js} +1 -1
  150. package/dist/{utils-7DUGTFED.mjs → utils-CGBVVNm6.mjs} +1 -1
  151. package/dist/v3-engine-5LoZUH-4.js +3695 -0
  152. package/dist/v3-engine-DIXDEDmL.mjs +3406 -0
  153. package/dist/{vite-CrlzCNqz.mjs → vite-B5faZcbE.mjs} +1256 -1088
  154. package/dist/vite-MyXBNux0.js +2368 -0
  155. package/dist/vite.d.ts +1 -2
  156. package/dist/vite.js +3 -4
  157. package/dist/vite.mjs +2 -2
  158. package/dist/weapp-tw-css-import-rewrite-loader.js +5157 -16
  159. package/dist/weapp-tw-runtime-classset-loader.js +32 -7
  160. package/dist/webpack-BnVyDmsD.mjs +836 -0
  161. package/dist/webpack-Mz1V0A9p.js +846 -0
  162. package/dist/webpack.js +1 -1
  163. package/dist/webpack.mjs +1 -1
  164. package/package.json +27 -37
  165. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  166. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  167. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  168. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  169. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  170. package/dist/cli/config.d.ts +0 -5
  171. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  172. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  173. package/dist/cli/patch-options.d.ts +0 -6
  174. package/dist/cli/tokens.d.ts +0 -4
  175. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  176. package/dist/cli/workspace/patch-package.d.ts +0 -3
  177. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  178. package/dist/cli/workspace/types.d.ts +0 -11
  179. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  180. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  181. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  182. package/dist/cli/workspace.d.ts +0 -2
  183. package/dist/css-imports-BbrbluP9.js +0 -177
  184. package/dist/css-imports-CSdPq_Sc.mjs +0 -128
  185. package/dist/experimental/index.d.ts +0 -2
  186. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  187. package/dist/experimental/oxc/index.d.ts +0 -2
  188. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  189. package/dist/experimental/shared/cache.d.ts +0 -3
  190. package/dist/experimental/shared/transform.d.ts +0 -3
  191. package/dist/experimental/shared.d.ts +0 -8
  192. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  193. package/dist/experimental/swc/index.d.ts +0 -2
  194. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  195. package/dist/generator-Y-Ikv4Fu.mjs +0 -1177
  196. package/dist/generator-css-B5ejWUMv.mjs +0 -1098
  197. package/dist/generator-css-D3OdPRiS.js +0 -1125
  198. package/dist/generator-mmhXzZnv.js +0 -1276
  199. package/dist/js/syntax.d.ts +0 -10
  200. package/dist/loader-anchors-CNkWT8hx.js +0 -273
  201. package/dist/loader-anchors-TrU7EUr7.mjs +0 -205
  202. package/dist/logger-BZ45DZJT.js +0 -1003
  203. package/dist/logger-BoVx1Dbt.mjs +0 -935
  204. package/dist/patcher-options-6gJN2EXy.js +0 -115
  205. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  206. package/dist/tailwindcss/recorder.d.ts +0 -13
  207. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  208. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  209. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  210. package/dist/tailwindcss/targets/types.d.ts +0 -35
  211. package/dist/types/disabled-options.d.ts +0 -4
  212. package/dist/vite-BC9U7ahn.js +0 -2199
  213. package/dist/webpack-Bu6M-Hbw.mjs +0 -441
  214. package/dist/webpack-DD7A6V0u.js +0 -456
  215. package/dist/webpack4.d.ts +0 -4
  216. package/dist/webpack4.js +0 -387
  217. package/dist/webpack4.mjs +0 -379
  218. package/scripts/postinstall.mjs +0 -59
  219. /package/dist/{constants-B-_T5UnW.mjs → constants-BG12WAKw.mjs} +0 -0
  220. /package/dist/{constants-p1dyh1x1.js → constants-BeeyfJ9k.js} +0 -0
@@ -1,7 +1,6 @@
1
1
  export declare const runtimeAopLoader = "weapp-tw-runtime-aop-loader";
2
- export declare const ManglePluginHooks = "ManglePluginHooks";
3
2
  export declare const WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks = "WeappTailwindcssWebpackPluginOptimizeChunkAssetsHooks";
4
- export declare const pluginName = "weapp-tailwindcss-webpack-plugin";
3
+ export declare const pluginName = "weapp-tailwindcss";
5
4
  export declare const vitePluginName = "weapp-tailwindcss:adaptor";
6
5
  export declare const WEAPP_TW_REQUIRED_NODE_VERSION = "20.19.0";
7
6
  export declare const WEAPP_TW_REQUIRED_NODE_VERSION_RANGE = "^20.19.0 || >=22.12.0";
package/dist/core.js CHANGED
@@ -1,8 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_chunk = require("./chunk-8l464Juk.js");
3
- const require_recorder = require("./recorder-gYSNLfOP.js");
4
- let node_process = require("node:process");
5
- node_process = require_chunk.__toESM(node_process);
2
+ require("./chunk-8l464Juk.js");
3
+ const require_precheck = require("./precheck-BjEbVEpX.js");
6
4
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
7
5
  //#region src/core.ts
8
6
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
@@ -17,18 +15,13 @@ function resolveTransformWxssOptions(options) {
17
15
  * @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
18
16
  */
19
17
  function createContext(options = {}) {
20
- const opts = require_recorder.getCompilerContext(options);
21
- const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
22
- const patchRecorderState = require_recorder.setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
23
- source: "runtime",
24
- cwd: opts.tailwindcssBasedir ?? node_process.default.cwd()
25
- });
18
+ const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = require_precheck.getCompilerContext(options);
19
+ const readyPromise = require_precheck.createTailwindRuntimeReadyPromise(initialTwPatcher);
26
20
  let runtimeSet = /* @__PURE__ */ new Set();
27
21
  const runtimeState = {
28
22
  twPatcher: initialTwPatcher,
29
- patchPromise: patchRecorderState.patchPromise,
30
- refreshTailwindcssPatcher,
31
- onPatchCompleted: patchRecorderState.onPatchCompleted
23
+ readyPromise,
24
+ refreshTailwindcssPatcher
32
25
  };
33
26
  const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
34
27
  function getDefaultJsHandlerOptions(majorVersion = runtimeState.twPatcher.majorVersion) {
@@ -112,25 +105,25 @@ function createContext(options = {}) {
112
105
  });
113
106
  }
114
107
  async function transformWxss(rawCss, options) {
115
- await runtimeState.patchPromise;
108
+ await runtimeState.readyPromise;
116
109
  const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
117
- runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, {
110
+ runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, {
118
111
  forceRefresh: true,
119
112
  forceCollect: true
120
113
  });
121
114
  return result;
122
115
  }
123
116
  async function transformJs(rawJs, options) {
124
- await runtimeState.patchPromise;
117
+ await runtimeState.readyPromise;
125
118
  if (options?.runtimeSet) runtimeSet = options.runtimeSet;
126
- else if (runtimeSet.size === 0) runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
119
+ else if (runtimeSet.size === 0) runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
127
120
  const resolvedOptions = resolveTransformJsOptions(options);
128
- if (require_recorder.shouldSkipJsTransform(rawJs, resolvedOptions)) return { code: rawJs };
121
+ if (require_precheck.shouldSkipJsTransform(rawJs, resolvedOptions)) return { code: rawJs };
129
122
  return await jsHandler(rawJs, runtimeSet, resolvedOptions);
130
123
  }
131
124
  async function transformWxml(rawWxml, options) {
132
- await runtimeState.patchPromise;
133
- if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await require_recorder.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
125
+ await runtimeState.readyPromise;
126
+ if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await require_precheck.ensureRuntimeClassSet(runtimeState, { forceCollect: true });
134
127
  return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
135
128
  }
136
129
  return {
package/dist/core.mjs CHANGED
@@ -1,5 +1,4 @@
1
- import { g as ensureRuntimeClassSet, n as shouldSkipJsTransform, r as getCompilerContext, t as setupPatchRecorder } from "./recorder-zsgatmkB.mjs";
2
- import process from "node:process";
1
+ import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-tbk626YL.mjs";
3
2
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
4
3
  //#region src/core.ts
5
4
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
@@ -14,18 +13,13 @@ function resolveTransformWxssOptions(options) {
14
13
  * @returns 返回一个包含 transformWxss、transformWxml 和 transformJs 方法的对象
15
14
  */
16
15
  function createContext(options = {}) {
17
- const opts = getCompilerContext(options);
18
- const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
19
- const patchRecorderState = setupPatchRecorder(initialTwPatcher, opts.tailwindcssBasedir, {
20
- source: "runtime",
21
- cwd: opts.tailwindcssBasedir ?? process.cwd()
22
- });
16
+ const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = getCompilerContext(options);
17
+ const readyPromise = createTailwindRuntimeReadyPromise(initialTwPatcher);
23
18
  let runtimeSet = /* @__PURE__ */ new Set();
24
19
  const runtimeState = {
25
20
  twPatcher: initialTwPatcher,
26
- patchPromise: patchRecorderState.patchPromise,
27
- refreshTailwindcssPatcher,
28
- onPatchCompleted: patchRecorderState.onPatchCompleted
21
+ readyPromise,
22
+ refreshTailwindcssPatcher
29
23
  };
30
24
  const defaultJsHandlerOptionsCache = /* @__PURE__ */ new Map();
31
25
  function getDefaultJsHandlerOptions(majorVersion = runtimeState.twPatcher.majorVersion) {
@@ -109,7 +103,7 @@ function createContext(options = {}) {
109
103
  });
110
104
  }
111
105
  async function transformWxss(rawCss, options) {
112
- await runtimeState.patchPromise;
106
+ await runtimeState.readyPromise;
113
107
  const result = await styleHandler(rawCss, resolveTransformWxssOptions(options));
114
108
  runtimeSet = await ensureRuntimeClassSet(runtimeState, {
115
109
  forceRefresh: true,
@@ -118,7 +112,7 @@ function createContext(options = {}) {
118
112
  return result;
119
113
  }
120
114
  async function transformJs(rawJs, options) {
121
- await runtimeState.patchPromise;
115
+ await runtimeState.readyPromise;
122
116
  if (options?.runtimeSet) runtimeSet = options.runtimeSet;
123
117
  else if (runtimeSet.size === 0) runtimeSet = await ensureRuntimeClassSet(runtimeState, { forceCollect: true });
124
118
  const resolvedOptions = resolveTransformJsOptions(options);
@@ -126,7 +120,7 @@ function createContext(options = {}) {
126
120
  return await jsHandler(rawJs, runtimeSet, resolvedOptions);
127
121
  }
128
122
  async function transformWxml(rawWxml, options) {
129
- await runtimeState.patchPromise;
123
+ await runtimeState.readyPromise;
130
124
  if (!options?.runtimeSet && runtimeSet.size === 0) runtimeSet = await ensureRuntimeClassSet(runtimeState, { forceCollect: true });
131
125
  return templateHandler(rawWxml, resolveTransformWxmlOptions(options));
132
126
  }
@@ -1,4 +1,4 @@
1
- const require_constants = require("../constants-p1dyh1x1.js");
1
+ const require_constants = require("../constants-BeeyfJ9k.js");
2
2
  //#region src/css-macro/postcss.ts
3
3
  const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
4
4
  const creator = () => {
@@ -10,7 +10,8 @@ const creator = () => {
10
10
  if (atRule.name === "media") {
11
11
  const values = [];
12
12
  require_constants.matchCustomPropertyFromValue(atRule.params, (arr) => {
13
- values.push(arr[1]);
13
+ const value = arr[1];
14
+ if (value) values.push(value);
14
15
  });
15
16
  if (values.length > 0) {
16
17
  const isNegative = atRule.params.includes("not");
@@ -1,4 +1,4 @@
1
- import { a as matchCustomPropertyFromValue, i as ifndef, r as ifdef } from "../constants-B-_T5UnW.mjs";
1
+ import { a as matchCustomPropertyFromValue, i as ifndef, r as ifdef } from "../constants-BG12WAKw.mjs";
2
2
  //#region src/css-macro/postcss.ts
3
3
  const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
4
4
  const creator = () => {
@@ -10,7 +10,8 @@ const creator = () => {
10
10
  if (atRule.name === "media") {
11
11
  const values = [];
12
12
  matchCustomPropertyFromValue(atRule.params, (arr) => {
13
- values.push(arr[1]);
13
+ const value = arr[1];
14
+ if (value) values.push(value);
14
15
  });
15
16
  if (values.length > 0) {
16
17
  const isNegative = atRule.params.includes("not");
@@ -1 +1,2 @@
1
+ export { default } from './css-macro/index'
1
2
  export * from './css-macro/index'
package/dist/css-macro.js CHANGED
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- require("./utils-DmC9_In3.js");
3
- const require_constants = require("./constants-p1dyh1x1.js");
2
+ require("./utils-4ODFyoqD.js");
3
+ const require_constants = require("./constants-BeeyfJ9k.js");
4
4
  let tailwindcss_plugin = require("tailwindcss/plugin");
5
5
  tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
6
6
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
@@ -1,5 +1,5 @@
1
- import { t as defu } from "./utils-7DUGTFED.mjs";
2
- import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-B-_T5UnW.mjs";
1
+ import { t as defu } from "./utils-CGBVVNm6.mjs";
2
+ import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-BG12WAKw.mjs";
3
3
  import plugin from "tailwindcss/plugin";
4
4
  //#region src/css-macro/index.ts
5
5
  const defaultOptions = {
@@ -0,0 +1,150 @@
1
+ import { a as noop } from "./utils-CGBVVNm6.mjs";
2
+ import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
3
+ //#region src/js/babel/cache-options.ts
4
+ const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
5
+ const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
6
+ //#endregion
7
+ //#region src/defaults.ts
8
+ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
9
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
10
+ const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
11
+ const BACKSLASH_RE = /\\/g;
12
+ function normalizePath(p) {
13
+ return p.replace(BACKSLASH_RE, "/");
14
+ }
15
+ const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
16
+ const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
17
+ const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
18
+ const MAIN_CSS_CHUNK_MATCHERS = {
19
+ "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
20
+ "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
21
+ "uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
22
+ "mpx": (file) => {
23
+ const normalized = normalizePath(file);
24
+ if (normalized.startsWith("app")) return true;
25
+ return MPX_STYLES_DIR_PATTERN.test(normalized);
26
+ },
27
+ "taro": (file) => file.startsWith("app"),
28
+ "remax": (file) => file.startsWith("app"),
29
+ "rax": (file) => file.startsWith("bundle"),
30
+ "native": (file) => file.startsWith("app"),
31
+ "weapp-vite": (file) => file.startsWith("app"),
32
+ "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
33
+ };
34
+ const alwaysFalse = () => false;
35
+ const TAILWIND_V3_CSS_PREFLIGHT = {
36
+ "box-sizing": "border-box",
37
+ "border-width": "0",
38
+ "border-style": "solid",
39
+ "border-color": "currentColor"
40
+ };
41
+ const TAILWIND_V4_CSS_PREFLIGHT = {
42
+ "box-sizing": "border-box",
43
+ "margin": "0",
44
+ "padding": "0",
45
+ "border": "0 solid"
46
+ };
47
+ function getDefaultCssPreflight(tailwindcssMajorVersion) {
48
+ return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
49
+ }
50
+ function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
51
+ if (cssPreflight === false) return false;
52
+ return {
53
+ ...getDefaultCssPreflight(tailwindcssMajorVersion),
54
+ ...cssPreflight ?? {}
55
+ };
56
+ }
57
+ function createMainCssChunkMatcher() {
58
+ return (file, appType) => {
59
+ if (!appType) {
60
+ const normalized = normalizePath(file);
61
+ return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
62
+ }
63
+ const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
64
+ return matcher ? matcher(file) : true;
65
+ };
66
+ }
67
+ function getDefaultOptions() {
68
+ return {
69
+ /**
70
+ * wxss 微信小程序
71
+ * acss 支付宝小程序
72
+ * jxss 京东小程序
73
+ * ttss 头条小程序
74
+ * qss QQ小程序
75
+ * css 最正常的样式文件
76
+ * tyss 涂鸦小程序
77
+ */
78
+ cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
79
+ /**
80
+ * wxml 微信小程序
81
+ * axml 支付宝小程序
82
+ * jxml 京东小程序
83
+ * ksml 快手小程序
84
+ * ttml 头条小程序
85
+ * qml QQ小程序
86
+ * tyml 涂鸦小程序
87
+ * xhsml 小红书小程序
88
+ * swan 百度小程序
89
+ */
90
+ htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
91
+ jsMatcher: (file) => {
92
+ if (file.includes("node_modules")) return false;
93
+ return JS_FILE_PATTERN.test(file);
94
+ },
95
+ mainCssChunkMatcher: createMainCssChunkMatcher(),
96
+ wxsMatcher: alwaysFalse,
97
+ cssPreflight: getDefaultCssPreflight(3),
98
+ disabled: false,
99
+ onLoad: noop,
100
+ onStart: noop,
101
+ onEnd: noop,
102
+ onUpdate: noop,
103
+ customAttributes: {},
104
+ customReplaceDictionary: MappingChars2String,
105
+ appType: void 0,
106
+ arbitraryValues: {
107
+ allowDoubleQuotes: false,
108
+ bareArbitraryValues: false
109
+ },
110
+ cssChildCombinatorReplaceValue: ["view", "text"],
111
+ inlineWxs: false,
112
+ injectAdditionalCssVarScope: false,
113
+ jsPreserveClass: (keyword) => {
114
+ /**
115
+ * 默认保留 keyword
116
+ */
117
+ if (keyword === "*") return true;
118
+ return false;
119
+ },
120
+ disabledDefaultTemplateHandler: false,
121
+ cssSelectorReplacement: {
122
+ root: [
123
+ "page",
124
+ ".tw-root",
125
+ "wx-root-portal-content"
126
+ ],
127
+ universal: ["view", "text"]
128
+ },
129
+ babelParserOptions: {
130
+ sourceType: "unambiguous",
131
+ cache: true,
132
+ cacheKey: "st:unambiguous",
133
+ cacheMaxEntries: 128,
134
+ cacheMaxSourceLength: DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH
135
+ },
136
+ postcssOptions: {},
137
+ cssRemoveProperty: true,
138
+ cssRemoveHoverPseudoClass: true,
139
+ ignoreCallExpressionIdentifiers: [],
140
+ ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
141
+ replaceRuntimePackages: false,
142
+ generator: { target: "weapp" },
143
+ tailwindcssPatcherOptions: { filter(className) {
144
+ return !isAllowedClassName(className);
145
+ } },
146
+ logLevel: "info"
147
+ };
148
+ }
149
+ //#endregion
150
+ export { resolveDefaultCssPreflight as a, getDefaultOptions as i, TAILWIND_V4_CSS_PREFLIGHT as n, DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH as o, getDefaultCssPreflight as r, HARD_PARSE_CACHE_MAX_ENTRIES as s, TAILWIND_V3_CSS_PREFLIGHT as t };
@@ -0,0 +1,193 @@
1
+ require("./chunk-8l464Juk.js");
2
+ require("./utils-4ODFyoqD.js");
3
+ let _weapp_core_escape = require("@weapp-core/escape");
4
+ let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
5
+ //#region src/js/babel/cache-options.ts
6
+ const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
7
+ const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
8
+ //#endregion
9
+ //#region src/defaults.ts
10
+ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
11
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|ty|xhs)ml|swan)$/;
12
+ const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
13
+ const BACKSLASH_RE = /\\/g;
14
+ function normalizePath(p) {
15
+ return p.replace(BACKSLASH_RE, "/");
16
+ }
17
+ const MPX_STYLES_DIR_PATTERN = /(?:^|\/)styles\/.*\.(?:wx|ac|jx|tt|q|c|ty)ss$/i;
18
+ const KBONE_MAIN_CSS_RE = /^(?:common\/)?miniprogram-app/;
19
+ const IMPLICIT_MAIN_CSS_RE = /^(?:app|common\/main|bundle)(?:\.|\/|$)/;
20
+ const MAIN_CSS_CHUNK_MATCHERS = {
21
+ "uni-app": (file) => file.startsWith("common/main") || file.startsWith("app"),
22
+ "uni-app-vite": (file) => file.startsWith("app") || file.startsWith("common/main"),
23
+ "uni-app-x": (file) => file.startsWith("app") || file.startsWith("common/main"),
24
+ "mpx": (file) => {
25
+ const normalized = normalizePath(file);
26
+ if (normalized.startsWith("app")) return true;
27
+ return MPX_STYLES_DIR_PATTERN.test(normalized);
28
+ },
29
+ "taro": (file) => file.startsWith("app"),
30
+ "remax": (file) => file.startsWith("app"),
31
+ "rax": (file) => file.startsWith("bundle"),
32
+ "native": (file) => file.startsWith("app"),
33
+ "weapp-vite": (file) => file.startsWith("app"),
34
+ "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
35
+ };
36
+ const alwaysFalse = () => false;
37
+ const TAILWIND_V3_CSS_PREFLIGHT = {
38
+ "box-sizing": "border-box",
39
+ "border-width": "0",
40
+ "border-style": "solid",
41
+ "border-color": "currentColor"
42
+ };
43
+ const TAILWIND_V4_CSS_PREFLIGHT = {
44
+ "box-sizing": "border-box",
45
+ "margin": "0",
46
+ "padding": "0",
47
+ "border": "0 solid"
48
+ };
49
+ function getDefaultCssPreflight(tailwindcssMajorVersion) {
50
+ return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
51
+ }
52
+ function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
53
+ if (cssPreflight === false) return false;
54
+ return {
55
+ ...getDefaultCssPreflight(tailwindcssMajorVersion),
56
+ ...cssPreflight ?? {}
57
+ };
58
+ }
59
+ function createMainCssChunkMatcher() {
60
+ return (file, appType) => {
61
+ if (!appType) {
62
+ const normalized = normalizePath(file);
63
+ return IMPLICIT_MAIN_CSS_RE.test(normalized) || MPX_STYLES_DIR_PATTERN.test(normalized) || KBONE_MAIN_CSS_RE.test(normalized);
64
+ }
65
+ const matcher = MAIN_CSS_CHUNK_MATCHERS[appType];
66
+ return matcher ? matcher(file) : true;
67
+ };
68
+ }
69
+ function getDefaultOptions() {
70
+ return {
71
+ /**
72
+ * wxss 微信小程序
73
+ * acss 支付宝小程序
74
+ * jxss 京东小程序
75
+ * ttss 头条小程序
76
+ * qss QQ小程序
77
+ * css 最正常的样式文件
78
+ * tyss 涂鸦小程序
79
+ */
80
+ cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
81
+ /**
82
+ * wxml 微信小程序
83
+ * axml 支付宝小程序
84
+ * jxml 京东小程序
85
+ * ksml 快手小程序
86
+ * ttml 头条小程序
87
+ * qml QQ小程序
88
+ * tyml 涂鸦小程序
89
+ * xhsml 小红书小程序
90
+ * swan 百度小程序
91
+ */
92
+ htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
93
+ jsMatcher: (file) => {
94
+ if (file.includes("node_modules")) return false;
95
+ return JS_FILE_PATTERN.test(file);
96
+ },
97
+ mainCssChunkMatcher: createMainCssChunkMatcher(),
98
+ wxsMatcher: alwaysFalse,
99
+ cssPreflight: getDefaultCssPreflight(3),
100
+ disabled: false,
101
+ onLoad: _weapp_tailwindcss_shared.noop,
102
+ onStart: _weapp_tailwindcss_shared.noop,
103
+ onEnd: _weapp_tailwindcss_shared.noop,
104
+ onUpdate: _weapp_tailwindcss_shared.noop,
105
+ customAttributes: {},
106
+ customReplaceDictionary: _weapp_core_escape.MappingChars2String,
107
+ appType: void 0,
108
+ arbitraryValues: {
109
+ allowDoubleQuotes: false,
110
+ bareArbitraryValues: false
111
+ },
112
+ cssChildCombinatorReplaceValue: ["view", "text"],
113
+ inlineWxs: false,
114
+ injectAdditionalCssVarScope: false,
115
+ jsPreserveClass: (keyword) => {
116
+ /**
117
+ * 默认保留 keyword
118
+ */
119
+ if (keyword === "*") return true;
120
+ return false;
121
+ },
122
+ disabledDefaultTemplateHandler: false,
123
+ cssSelectorReplacement: {
124
+ root: [
125
+ "page",
126
+ ".tw-root",
127
+ "wx-root-portal-content"
128
+ ],
129
+ universal: ["view", "text"]
130
+ },
131
+ babelParserOptions: {
132
+ sourceType: "unambiguous",
133
+ cache: true,
134
+ cacheKey: "st:unambiguous",
135
+ cacheMaxEntries: 128,
136
+ cacheMaxSourceLength: DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH
137
+ },
138
+ postcssOptions: {},
139
+ cssRemoveProperty: true,
140
+ cssRemoveHoverPseudoClass: true,
141
+ ignoreCallExpressionIdentifiers: [],
142
+ ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
143
+ replaceRuntimePackages: false,
144
+ generator: { target: "weapp" },
145
+ tailwindcssPatcherOptions: { filter(className) {
146
+ return !(0, _weapp_core_escape.isAllowedClassName)(className);
147
+ } },
148
+ logLevel: "info"
149
+ };
150
+ }
151
+ //#endregion
152
+ Object.defineProperty(exports, "DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH", {
153
+ enumerable: true,
154
+ get: function() {
155
+ return DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH;
156
+ }
157
+ });
158
+ Object.defineProperty(exports, "HARD_PARSE_CACHE_MAX_ENTRIES", {
159
+ enumerable: true,
160
+ get: function() {
161
+ return HARD_PARSE_CACHE_MAX_ENTRIES;
162
+ }
163
+ });
164
+ Object.defineProperty(exports, "TAILWIND_V3_CSS_PREFLIGHT", {
165
+ enumerable: true,
166
+ get: function() {
167
+ return TAILWIND_V3_CSS_PREFLIGHT;
168
+ }
169
+ });
170
+ Object.defineProperty(exports, "TAILWIND_V4_CSS_PREFLIGHT", {
171
+ enumerable: true,
172
+ get: function() {
173
+ return TAILWIND_V4_CSS_PREFLIGHT;
174
+ }
175
+ });
176
+ Object.defineProperty(exports, "getDefaultCssPreflight", {
177
+ enumerable: true,
178
+ get: function() {
179
+ return getDefaultCssPreflight;
180
+ }
181
+ });
182
+ Object.defineProperty(exports, "getDefaultOptions", {
183
+ enumerable: true,
184
+ get: function() {
185
+ return getDefaultOptions;
186
+ }
187
+ });
188
+ Object.defineProperty(exports, "resolveDefaultCssPreflight", {
189
+ enumerable: true,
190
+ get: function() {
191
+ return resolveDefaultCssPreflight;
192
+ }
193
+ });
@@ -1,2 +1,16 @@
1
- import type { UserDefinedOptions } from './types';
1
+ import type { CssPreflightOptions, UserDefinedOptions } from './types';
2
+ export declare const TAILWIND_V3_CSS_PREFLIGHT: {
3
+ 'box-sizing': string;
4
+ 'border-width': string;
5
+ 'border-style': string;
6
+ 'border-color': string;
7
+ };
8
+ export declare const TAILWIND_V4_CSS_PREFLIGHT: {
9
+ 'box-sizing': string;
10
+ margin: string;
11
+ padding: string;
12
+ border: string;
13
+ };
14
+ export declare function getDefaultCssPreflight(tailwindcssMajorVersion?: number): Exclude<CssPreflightOptions, false>;
15
+ export declare function resolveDefaultCssPreflight(cssPreflight: CssPreflightOptions | undefined, tailwindcssMajorVersion?: number): CssPreflightOptions;
2
16
  export declare function getDefaultOptions(): UserDefinedOptions;