weapp-tailwindcss 5.0.0-next.3 → 5.0.0-next.7

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 (171) hide show
  1. package/README.md +4 -5
  2. package/bin/weapp-tailwindcss.js +1 -21
  3. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +2 -0
  4. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +3 -0
  5. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +4 -0
  6. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +8 -0
  7. package/dist/bundlers/shared/css-cleanup.d.ts +1 -2
  8. package/dist/bundlers/shared/generator-css/config-directive.d.ts +2 -0
  9. package/dist/bundlers/shared/generator-css/directives.d.ts +11 -0
  10. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +7 -0
  11. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +5 -0
  12. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -0
  13. package/dist/bundlers/shared/generator-css/markers.d.ts +16 -0
  14. package/dist/bundlers/shared/generator-css/source-files.d.ts +11 -0
  15. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +10 -0
  16. package/dist/bundlers/shared/generator-css.d.ts +12 -22
  17. package/dist/bundlers/vite/css-finalizer.d.ts +1 -1
  18. package/dist/bundlers/vite/generate-bundle/candidates.d.ts +2 -0
  19. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +20 -0
  20. package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +3 -0
  21. package/dist/bundlers/vite/generate-bundle/dirty-state.d.ts +1 -0
  22. package/dist/bundlers/vite/generate-bundle/js-entries.d.ts +2 -0
  23. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +8 -0
  24. package/dist/bundlers/vite/generate-bundle/js-linking.d.ts +13 -0
  25. package/dist/bundlers/vite/generate-bundle/metrics.d.ts +17 -0
  26. package/dist/bundlers/vite/generate-bundle/process-plan.d.ts +9 -0
  27. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +7 -0
  28. package/dist/bundlers/vite/generate-bundle/signatures.d.ts +8 -0
  29. package/dist/bundlers/vite/generate-bundle.d.ts +2 -1
  30. package/dist/bundlers/vite/index.d.ts +1 -1
  31. package/dist/bundlers/vite/official-tailwind-plugins.d.ts +5 -0
  32. package/dist/bundlers/vite/postcss-config.d.ts +6 -0
  33. package/dist/bundlers/vite/rewrite-css-imports.d.ts +1 -0
  34. package/dist/bundlers/vite/runtime-class-set.d.ts +22 -0
  35. package/dist/bundlers/vite/tailwind-basedir.d.ts +1 -0
  36. package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -0
  37. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -1
  38. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +0 -1
  39. package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +1 -1
  40. package/dist/cache-DPN5yKSX.js +497 -0
  41. package/dist/cache-nq0_XJoS.mjs +429 -0
  42. package/dist/cli/context.d.ts +0 -3
  43. package/dist/cli/helpers.d.ts +1 -2
  44. package/dist/cli/mount-options.d.ts +2 -0
  45. package/dist/cli/types.d.ts +0 -2
  46. package/dist/cli.js +108 -598
  47. package/dist/cli.mjs +119 -608
  48. package/dist/constants.d.ts +1 -2
  49. package/dist/context/tailwindcss.d.ts +1 -1
  50. package/dist/core.js +13 -20
  51. package/dist/core.mjs +8 -14
  52. package/dist/css-macro/postcss.js +1 -1
  53. package/dist/css-macro/postcss.mjs +1 -1
  54. package/dist/css-macro.d.ts +1 -0
  55. package/dist/css-macro.js +2 -2
  56. package/dist/css-macro.mjs +2 -2
  57. package/dist/defaults.d.ts +15 -1
  58. package/dist/defaults.js +33 -14
  59. package/dist/defaults.mjs +30 -15
  60. package/dist/generator/index.d.ts +1 -1
  61. package/dist/generator/options.d.ts +3 -4
  62. package/dist/{generator-Y-Ikv4Fu.mjs → generator-CzfdCZyd.mjs} +277 -23
  63. package/dist/{generator-mmhXzZnv.js → generator-TOp4uz7c.js} +281 -27
  64. package/dist/{generator-css-Bwy_Uz89.mjs → generator-css-B938WI9a.mjs} +694 -506
  65. package/dist/{generator-css-CRLrHW4F.js → generator-css-Dnpl-IY2.js} +699 -505
  66. package/dist/generator.js +1 -1
  67. package/dist/generator.mjs +1 -1
  68. package/dist/gulp.js +29 -28
  69. package/dist/gulp.mjs +25 -24
  70. package/dist/index.d.ts +1 -1
  71. package/dist/index.js +6 -6
  72. package/dist/index.mjs +5 -5
  73. package/dist/js/index.d.ts +1 -0
  74. package/dist/js/literal-transform.d.ts +2 -0
  75. package/dist/logger-BRy6XPQ2.js +1 -0
  76. package/dist/logger-Bub1jggA.mjs +2 -0
  77. package/dist/postcss/config-directive.d.ts +1 -0
  78. package/dist/postcss/context.d.ts +9 -0
  79. package/dist/postcss/source-files.d.ts +8 -0
  80. package/dist/postcss/tailwind-version.d.ts +3 -0
  81. package/dist/postcss-BtAP6sQO.mjs +288 -0
  82. package/dist/postcss-WsXlC7A-.js +298 -0
  83. package/dist/postcss.d.ts +2 -2
  84. package/dist/postcss.js +3 -276
  85. package/dist/postcss.mjs +1 -269
  86. package/dist/{recorder-GdTJ3QqX.js → precheck-Dka94ArV.js} +141 -283
  87. package/dist/{recorder-XdFvVASS.mjs → precheck-DlrmwCc-.mjs} +106 -247
  88. package/dist/presets.js +6 -4
  89. package/dist/presets.mjs +4 -2
  90. package/dist/reset.d.ts +1 -0
  91. package/dist/{css-imports-BbrbluP9.js → run-tasks-B50A3pxt.js} +6 -55
  92. package/dist/{css-imports-CSdPq_Sc.mjs → run-tasks-DdNi-hkk.mjs} +5 -42
  93. package/dist/runtime-patch-pGdCqAEu.mjs +71 -0
  94. package/dist/runtime-patch-qwuisukL.js +85 -0
  95. package/dist/tailwindcss/miniprogram.d.ts +5 -1
  96. package/dist/tailwindcss/patcher-options.d.ts +3 -51
  97. package/dist/tailwindcss/patcher.d.ts +1 -2
  98. package/dist/tailwindcss/runtime-patch.d.ts +5 -0
  99. package/dist/tailwindcss/runtime.d.ts +2 -3
  100. package/dist/tailwindcss/targets.d.ts +1 -5
  101. package/dist/tailwindcss/v4/patcher-options.d.ts +1 -23
  102. package/dist/tailwindcss/v4/patcher.d.ts +2 -1
  103. package/dist/tailwindcss/v4-engine/types.d.ts +1 -1
  104. package/dist/tailwindcss/version.d.ts +4 -0
  105. package/dist/{logger-BoVx1Dbt.mjs → tailwindcss-BIJ185GB.mjs} +25 -434
  106. package/dist/{logger-BZ45DZJT.js → tailwindcss-T1U5T-iF.js} +30 -468
  107. package/dist/typedoc.export.d.ts +0 -2
  108. package/dist/types/index.d.ts +2 -9
  109. package/dist/types/shared.d.ts +3 -0
  110. package/dist/types/user-defined-options/general.d.ts +0 -2
  111. package/dist/types/user-defined-options/important.d.ts +3 -3
  112. package/dist/uni-app-x/vite.d.ts +1 -1
  113. package/dist/utils/disabled.d.ts +2 -3
  114. package/dist/{vite-BDywuCjn.mjs → vite-BXChkciE.mjs} +669 -481
  115. package/dist/{vite-DgRh_GXn.js → vite-D0CoRblu.js} +707 -519
  116. package/dist/vite.d.ts +1 -2
  117. package/dist/vite.js +3 -4
  118. package/dist/vite.mjs +2 -2
  119. package/dist/weapp-tw-css-import-rewrite-loader.js +1 -1
  120. package/dist/{webpack-CiHqVZTg.mjs → webpack-BNdGm9KL.mjs} +224 -38
  121. package/dist/{webpack-CAJR4hhP.js → webpack-D-sUCY0u.js} +250 -69
  122. package/dist/webpack.js +1 -1
  123. package/dist/webpack.mjs +1 -1
  124. package/package.json +23 -35
  125. package/dist/bundlers/shared/generator-candidates.d.ts +0 -5
  126. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-assets.d.ts +0 -14
  127. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4-loaders.d.ts +0 -15
  128. package/dist/bundlers/webpack/BaseUnifiedPlugin/v4.d.ts +0 -9
  129. package/dist/bundlers/webpack/shared/css-imports.d.ts +0 -6
  130. package/dist/cli/config.d.ts +0 -5
  131. package/dist/cli/helpers/patch-cwd.d.ts +0 -1
  132. package/dist/cli/mount-options/patch-status.d.ts +0 -2
  133. package/dist/cli/patch-options.d.ts +0 -6
  134. package/dist/cli/tokens.d.ts +0 -4
  135. package/dist/cli/workspace/package-dirs.d.ts +0 -3
  136. package/dist/cli/workspace/patch-package.d.ts +0 -3
  137. package/dist/cli/workspace/patch-utils.d.ts +0 -3
  138. package/dist/cli/workspace/types.d.ts +0 -11
  139. package/dist/cli/workspace/workspace-globs.d.ts +0 -2
  140. package/dist/cli/workspace/workspace-io.d.ts +0 -1
  141. package/dist/cli/workspace/workspace-lock.d.ts +0 -1
  142. package/dist/cli/workspace.d.ts +0 -2
  143. package/dist/experimental/index.d.ts +0 -2
  144. package/dist/experimental/oxc/ast-utils.d.ts +0 -30
  145. package/dist/experimental/oxc/index.d.ts +0 -2
  146. package/dist/experimental/oxc/module-specifiers.d.ts +0 -2
  147. package/dist/experimental/shared/cache.d.ts +0 -3
  148. package/dist/experimental/shared/transform.d.ts +0 -3
  149. package/dist/experimental/shared.d.ts +0 -8
  150. package/dist/experimental/swc/ast-utils.d.ts +0 -30
  151. package/dist/experimental/swc/index.d.ts +0 -2
  152. package/dist/experimental/swc/module-specifiers.d.ts +0 -2
  153. package/dist/js/syntax.d.ts +0 -10
  154. package/dist/loader-anchors-1MumTAtA.mjs +0 -205
  155. package/dist/loader-anchors-TrFvT6g1.js +0 -273
  156. package/dist/patcher-options-6gJN2EXy.js +0 -115
  157. package/dist/patcher-options-DQfR5xxT.mjs +0 -92
  158. package/dist/tailwindcss/recorder.d.ts +0 -13
  159. package/dist/tailwindcss/targets/paths.d.ts +0 -13
  160. package/dist/tailwindcss/targets/record-io.d.ts +0 -5
  161. package/dist/tailwindcss/targets/recorder.d.ts +0 -3
  162. package/dist/tailwindcss/targets/types.d.ts +0 -35
  163. package/dist/types/disabled-options.d.ts +0 -4
  164. package/dist/webpack4.d.ts +0 -4
  165. package/dist/webpack4.js +0 -387
  166. package/dist/webpack4.mjs +0 -379
  167. package/scripts/postinstall.mjs +0 -59
  168. /package/dist/{constants-p1dyh1x1.js → constants-BoB_6lFw.js} +0 -0
  169. /package/dist/{constants-B-_T5UnW.mjs → constants-E_loJC49.mjs} +0 -0
  170. /package/dist/{utils-7DUGTFED.mjs → utils-BJjKRQgf.mjs} +0 -0
  171. /package/dist/{utils-DmC9_In3.js → utils-VZvGusYs.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";
@@ -1,4 +1,4 @@
1
1
  import type { InternalUserDefinedOptions } from '../types';
2
2
  import { resolveTailwindcssBasedir } from './tailwindcss/basedir';
3
- export declare function createTailwindcssPatcherFromContext(ctx: InternalUserDefinedOptions): import("@/types").TailwindcssPatcherLike;
3
+ export declare function createTailwindcssPatcherFromContext(ctx: InternalUserDefinedOptions): import("@/types").TailwindcssPatcherLike | undefined;
4
4
  export { resolveTailwindcssBasedir };
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-GdTJ3QqX.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-Dka94ArV.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-XdFvVASS.mjs";
2
- import process from "node:process";
1
+ import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-DlrmwCc-.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-BoB_6lFw.js");
2
2
  //#region src/css-macro/postcss.ts
3
3
  const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
4
4
  const creator = () => {
@@ -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-E_loJC49.mjs";
2
2
  //#region src/css-macro/postcss.ts
3
3
  const IFDEF_ENDIF_RE = /#(?:ifn?def|endif)/;
4
4
  const creator = () => {
@@ -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-VZvGusYs.js");
3
+ const require_constants = require("./constants-BoB_6lFw.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-BJjKRQgf.mjs";
2
+ import { n as createNegativeMediaQuery, t as createMediaQuery } from "./constants-E_loJC49.mjs";
3
3
  import plugin from "tailwindcss/plugin";
4
4
  //#region src/css-macro/index.ts
5
5
  const defaultOptions = {
@@ -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;
package/dist/defaults.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  require("./chunk-8l464Juk.js");
3
- require("./utils-DmC9_In3.js");
3
+ require("./utils-VZvGusYs.js");
4
4
  let _weapp_core_escape = require("@weapp-core/escape");
5
5
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
6
6
  //#region src/defaults.ts
@@ -31,6 +31,28 @@ const MAIN_CSS_CHUNK_MATCHERS = {
31
31
  "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
32
32
  };
33
33
  const alwaysFalse = () => false;
34
+ const TAILWIND_V3_CSS_PREFLIGHT = {
35
+ "box-sizing": "border-box",
36
+ "border-width": "0",
37
+ "border-style": "solid",
38
+ "border-color": "currentColor"
39
+ };
40
+ const TAILWIND_V4_CSS_PREFLIGHT = {
41
+ "box-sizing": "border-box",
42
+ "margin": "0",
43
+ "padding": "0",
44
+ "border": "0 solid"
45
+ };
46
+ function getDefaultCssPreflight(tailwindcssMajorVersion) {
47
+ return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
48
+ }
49
+ function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
50
+ if (cssPreflight === false) return false;
51
+ return {
52
+ ...getDefaultCssPreflight(tailwindcssMajorVersion),
53
+ ...cssPreflight ?? {}
54
+ };
55
+ }
34
56
  function createMainCssChunkMatcher() {
35
57
  return (file, appType) => {
36
58
  if (!appType) {
@@ -71,12 +93,7 @@ function getDefaultOptions() {
71
93
  },
72
94
  mainCssChunkMatcher: createMainCssChunkMatcher(),
73
95
  wxsMatcher: alwaysFalse,
74
- cssPreflight: {
75
- "box-sizing": "border-box",
76
- "border-width": "0",
77
- "border-style": "solid",
78
- "border-color": "currentColor"
79
- },
96
+ cssPreflight: getDefaultCssPreflight(3),
80
97
  disabled: false,
81
98
  onLoad: _weapp_tailwindcss_shared.noop,
82
99
  onStart: _weapp_tailwindcss_shared.noop,
@@ -85,11 +102,13 @@ function getDefaultOptions() {
85
102
  customAttributes: {},
86
103
  customReplaceDictionary: _weapp_core_escape.MappingChars2String,
87
104
  appType: void 0,
88
- arbitraryValues: { allowDoubleQuotes: false },
105
+ arbitraryValues: {
106
+ allowDoubleQuotes: false,
107
+ bareArbitraryValues: false
108
+ },
89
109
  cssChildCombinatorReplaceValue: ["view", "text"],
90
110
  inlineWxs: false,
91
111
  injectAdditionalCssVarScope: false,
92
- rewriteCssImports: true,
93
112
  jsPreserveClass: (keyword) => {
94
113
  /**
95
114
  * 默认保留 keyword
@@ -97,7 +116,6 @@ function getDefaultOptions() {
97
116
  if (keyword === "*") return true;
98
117
  return false;
99
118
  },
100
- staleClassNameFallback: void 0,
101
119
  disabledDefaultTemplateHandler: false,
102
120
  cssSelectorReplacement: {
103
121
  root: [
@@ -118,10 +136,7 @@ function getDefaultOptions() {
118
136
  ignoreCallExpressionIdentifiers: [],
119
137
  ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
120
138
  replaceRuntimePackages: false,
121
- generator: {
122
- mode: "auto",
123
- target: "weapp"
124
- },
139
+ generator: { target: "weapp" },
125
140
  tailwindcssPatcherOptions: { filter(className) {
126
141
  return !(0, _weapp_core_escape.isAllowedClassName)(className);
127
142
  } },
@@ -129,4 +144,8 @@ function getDefaultOptions() {
129
144
  };
130
145
  }
131
146
  //#endregion
147
+ exports.TAILWIND_V3_CSS_PREFLIGHT = TAILWIND_V3_CSS_PREFLIGHT;
148
+ exports.TAILWIND_V4_CSS_PREFLIGHT = TAILWIND_V4_CSS_PREFLIGHT;
149
+ exports.getDefaultCssPreflight = getDefaultCssPreflight;
132
150
  exports.getDefaultOptions = getDefaultOptions;
151
+ exports.resolveDefaultCssPreflight = resolveDefaultCssPreflight;
package/dist/defaults.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { a as noop } from "./utils-7DUGTFED.mjs";
1
+ import { a as noop } from "./utils-BJjKRQgf.mjs";
2
2
  import { MappingChars2String, isAllowedClassName } from "@weapp-core/escape";
3
3
  //#region src/defaults.ts
4
4
  const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
@@ -28,6 +28,28 @@ const MAIN_CSS_CHUNK_MATCHERS = {
28
28
  "kbone": (file) => KBONE_MAIN_CSS_RE.test(file)
29
29
  };
30
30
  const alwaysFalse = () => false;
31
+ const TAILWIND_V3_CSS_PREFLIGHT = {
32
+ "box-sizing": "border-box",
33
+ "border-width": "0",
34
+ "border-style": "solid",
35
+ "border-color": "currentColor"
36
+ };
37
+ const TAILWIND_V4_CSS_PREFLIGHT = {
38
+ "box-sizing": "border-box",
39
+ "margin": "0",
40
+ "padding": "0",
41
+ "border": "0 solid"
42
+ };
43
+ function getDefaultCssPreflight(tailwindcssMajorVersion) {
44
+ return { ...tailwindcssMajorVersion === 4 ? TAILWIND_V4_CSS_PREFLIGHT : TAILWIND_V3_CSS_PREFLIGHT };
45
+ }
46
+ function resolveDefaultCssPreflight(cssPreflight, tailwindcssMajorVersion) {
47
+ if (cssPreflight === false) return false;
48
+ return {
49
+ ...getDefaultCssPreflight(tailwindcssMajorVersion),
50
+ ...cssPreflight ?? {}
51
+ };
52
+ }
31
53
  function createMainCssChunkMatcher() {
32
54
  return (file, appType) => {
33
55
  if (!appType) {
@@ -68,12 +90,7 @@ function getDefaultOptions() {
68
90
  },
69
91
  mainCssChunkMatcher: createMainCssChunkMatcher(),
70
92
  wxsMatcher: alwaysFalse,
71
- cssPreflight: {
72
- "box-sizing": "border-box",
73
- "border-width": "0",
74
- "border-style": "solid",
75
- "border-color": "currentColor"
76
- },
93
+ cssPreflight: getDefaultCssPreflight(3),
77
94
  disabled: false,
78
95
  onLoad: noop,
79
96
  onStart: noop,
@@ -82,11 +99,13 @@ function getDefaultOptions() {
82
99
  customAttributes: {},
83
100
  customReplaceDictionary: MappingChars2String,
84
101
  appType: void 0,
85
- arbitraryValues: { allowDoubleQuotes: false },
102
+ arbitraryValues: {
103
+ allowDoubleQuotes: false,
104
+ bareArbitraryValues: false
105
+ },
86
106
  cssChildCombinatorReplaceValue: ["view", "text"],
87
107
  inlineWxs: false,
88
108
  injectAdditionalCssVarScope: false,
89
- rewriteCssImports: true,
90
109
  jsPreserveClass: (keyword) => {
91
110
  /**
92
111
  * 默认保留 keyword
@@ -94,7 +113,6 @@ function getDefaultOptions() {
94
113
  if (keyword === "*") return true;
95
114
  return false;
96
115
  },
97
- staleClassNameFallback: void 0,
98
116
  disabledDefaultTemplateHandler: false,
99
117
  cssSelectorReplacement: {
100
118
  root: [
@@ -115,10 +133,7 @@ function getDefaultOptions() {
115
133
  ignoreCallExpressionIdentifiers: [],
116
134
  ignoreTaggedTemplateExpressionIdentifiers: ["weappTwIgnore"],
117
135
  replaceRuntimePackages: false,
118
- generator: {
119
- mode: "auto",
120
- target: "weapp"
121
- },
136
+ generator: { target: "weapp" },
122
137
  tailwindcssPatcherOptions: { filter(className) {
123
138
  return !isAllowedClassName(className);
124
139
  } },
@@ -126,4 +141,4 @@ function getDefaultOptions() {
126
141
  };
127
142
  }
128
143
  //#endregion
129
- export { getDefaultOptions };
144
+ export { TAILWIND_V3_CSS_PREFLIGHT, TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
@@ -7,5 +7,5 @@ export declare function resolveTailwindSourceFromPatcher(patcher: TailwindcssPat
7
7
  export declare function createWeappTailwindcssGeneratorFromPatcher(patcher: TailwindcssPatcherLike): Promise<WeappTailwindcssGenerator>;
8
8
  export { normalizeWeappTailwindcssGeneratorOptions, } from './options';
9
9
  export { resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp, };
10
- export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorMode, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
10
+ export type { NormalizedWeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorOptions, WeappTailwindcssGeneratorUserOptions, } from './options';
11
11
  export type { TailwindCandidateSource, TailwindGeneratorVersion, TailwindResolvedSource, TailwindV3CandidateSource, TailwindV3Engine, TailwindV3GenerateOptions, TailwindV3GenerateResult, TailwindV3GenerateTarget, TailwindV3ResolvedSource, TailwindV3SourceOptions, TailwindV4CandidateSource, TailwindV4DesignSystem, TailwindV4Engine, TailwindV4GenerateOptions, TailwindV4GenerateResult, TailwindV4GenerateTarget, TailwindV4ResolvedSource, TailwindV4SourceOptions, WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, } from './types';
@@ -1,16 +1,15 @@
1
1
  import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
2
2
  import type { WeappTailwindcssGeneratorTarget } from './types';
3
- export type WeappTailwindcssGeneratorMode = 'auto' | 'force' | 'off';
4
3
  export interface WeappTailwindcssGeneratorOptions {
5
- mode?: WeappTailwindcssGeneratorMode;
6
4
  target?: WeappTailwindcssGeneratorTarget;
5
+ config?: string;
7
6
  styleOptions?: Partial<IStyleHandlerOptions>;
8
7
  tailwindcssV3Compatibility?: boolean;
9
8
  }
10
- export type WeappTailwindcssGeneratorUserOptions = boolean | WeappTailwindcssGeneratorOptions;
9
+ export type WeappTailwindcssGeneratorUserOptions = WeappTailwindcssGeneratorOptions;
11
10
  export interface NormalizedWeappTailwindcssGeneratorOptions {
12
- mode: WeappTailwindcssGeneratorMode;
13
11
  target: WeappTailwindcssGeneratorTarget;
12
+ config?: string;
14
13
  styleOptions?: Partial<IStyleHandlerOptions>;
15
14
  tailwindcssV3Compatibility: boolean;
16
15
  }