weapp-tailwindcss 5.1.2 → 5.1.4

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 (75) hide show
  1. package/README.md +1 -1
  2. package/dist/auto-CrJJc5rK.mjs +13 -0
  3. package/dist/bundlers/gulp/index.d.ts +3 -3
  4. package/dist/bundlers/rspack/index.d.ts +20 -0
  5. package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -10
  6. package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
  7. package/dist/bundlers/vite/css-memory.d.ts +1 -0
  8. package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
  9. package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -1
  10. package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +12 -0
  11. package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
  12. package/dist/bundlers/vite/processed-css-assets.d.ts +1 -0
  13. package/dist/bundlers/vite/serve-js-transform.d.ts +11 -0
  14. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +4 -1
  15. package/dist/cli.js +8 -8
  16. package/dist/cli.mjs +8 -8
  17. package/dist/{context-C-r8ki7x.mjs → context-Bkpmt3ja.mjs} +62 -36
  18. package/dist/{context-CH4HFZP2.js → context-DCVMkTRj.js} +76 -44
  19. package/dist/core.js +1 -1
  20. package/dist/core.mjs +1 -1
  21. package/dist/css-macro/auto.d.ts +1 -1
  22. package/dist/css-macro/postcss.js +2 -2
  23. package/dist/css-macro.js +3 -3
  24. package/dist/css-macro.mjs +1 -1
  25. package/dist/{defaults-CmFBmxsr.js → defaults-DQhgnnn-.js} +1 -1
  26. package/dist/defaults.js +1 -1
  27. package/dist/framework/index.d.ts +7 -2
  28. package/dist/framework/platform.d.ts +2 -0
  29. package/dist/framework.js +39 -8
  30. package/dist/framework.mjs +33 -6
  31. package/dist/{generator-BsPIaLtV.mjs → generator-24-HgU9F.mjs} +5 -3
  32. package/dist/{generator-B6pUjNdD.js → generator-CilgHtxb.js} +6 -4
  33. package/dist/generator.js +2 -2
  34. package/dist/generator.mjs +2 -2
  35. package/dist/{gulp-CTdcASq8.mjs → gulp-0RsqkF_d.mjs} +4 -4
  36. package/dist/{gulp-BBCeA7ky.js → gulp-Bogfnoki.js} +12 -11
  37. package/dist/gulp.js +1 -1
  38. package/dist/gulp.mjs +1 -1
  39. package/dist/{hmr-timing-BRx-KnBh.mjs → hmr-timing-BRNaz8Od.mjs} +62 -166
  40. package/dist/{hmr-timing-Da1eI8S0.js → hmr-timing-BV6nFPoT.js} +65 -187
  41. package/dist/index.js +9 -4
  42. package/dist/index.mjs +7 -6
  43. package/dist/postcss-html-transform.js +2 -2
  44. package/dist/postcss.js +2 -2
  45. package/dist/postcss.mjs +2 -2
  46. package/dist/presets/shared.d.ts +4 -0
  47. package/dist/presets.js +32 -16
  48. package/dist/presets.mjs +28 -14
  49. package/dist/reset.js +2 -2
  50. package/dist/rspack.d.ts +3 -0
  51. package/dist/rspack.js +68 -0
  52. package/dist/rspack.mjs +62 -0
  53. package/dist/{source-candidate-scan-signature-Dugfplms.mjs → source-candidate-scan-signature-BB1hvW68.mjs} +12 -6
  54. package/dist/{source-candidate-scan-signature-BO6JSskQ.js → source-candidate-scan-signature-CaDT0gkj.js} +16 -9
  55. package/dist/tailwindcss/v4-engine/css-macro-source.d.ts +2 -0
  56. package/dist/{tailwindcss-B5mRo0-M.mjs → tailwindcss-D0JF0fuZ.mjs} +6 -6
  57. package/dist/{tailwindcss-dbrbY4cd.js → tailwindcss-D2xs4OEu.js} +11 -11
  58. package/dist/{transform-DeqFRp1D.mjs → transform-BP86eSZp.mjs} +19 -19
  59. package/dist/{transform-BLleu_bA.js → transform-CXCQ28Tc.js} +47 -47
  60. package/dist/{utils-BCa37Wqj.js → utils-D3h8j7Mk.js} +2 -2
  61. package/dist/{v4-engine-C3qSwQ-e.mjs → v4-engine-BuuYDXt1.mjs} +58 -118
  62. package/dist/{v4-engine-ON_oSLfO.js → v4-engine-CKtsdKxK.js} +66 -120
  63. package/dist/{vite-CXmUiI9f.mjs → vite-B1SlBmqO.mjs} +436 -73
  64. package/dist/{vite-Da4uEG_u.js → vite-BYgT1ir9.js} +443 -80
  65. package/dist/vite.js +1 -1
  66. package/dist/vite.mjs +1 -1
  67. package/dist/weapp-tw-css-import-rewrite-loader.js +143 -216
  68. package/dist/weapp-tw-runtime-classset-loader.js +2 -2
  69. package/dist/{webpack-CrFZmdo7.mjs → webpack-Bg6pefpb.mjs} +109 -18
  70. package/dist/{webpack-Cwqnznng.js → webpack-khSwkXP5.js} +115 -24
  71. package/dist/webpack.js +1 -1
  72. package/dist/webpack.mjs +1 -1
  73. package/package.json +9 -4
  74. package/dist/auto-Ba6hDrse.mjs +0 -13
  75. /package/dist/{chunk-emK7D4bc.js → rolldown-runtime-emK7D4bc.js} +0 -0
@@ -1,13 +1,14 @@
1
- const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
3
- const require_generator = require("./generator-B6pUjNdD.js");
4
- require("./utils-BCa37Wqj.js");
5
- const require_defaults = require("./defaults-CmFBmxsr.js");
6
- const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
+ const require_framework = require("./framework.js");
3
+ const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
4
+ const require_generator = require("./generator-CilgHtxb.js");
5
+ require("./utils-D3h8j7Mk.js");
6
+ const require_defaults = require("./defaults-DQhgnnn-.js");
7
+ const require_tailwindcss = require("./tailwindcss-D2xs4OEu.js");
7
8
  let node_path = require("node:path");
8
- node_path = require_chunk.__toESM(node_path);
9
+ node_path = require_rolldown_runtime.__toESM(node_path);
9
10
  let node_process = require("node:process");
10
- node_process = require_chunk.__toESM(node_process);
11
+ node_process = require_rolldown_runtime.__toESM(node_process);
11
12
  let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
12
13
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
13
14
  let lru_cache = require("lru-cache");
@@ -18,15 +19,15 @@ let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
18
19
  let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
19
20
  let _weapp_core_escape = require("@weapp-core/escape");
20
21
  let debug = require("debug");
21
- debug = require_chunk.__toESM(debug);
22
+ debug = require_rolldown_runtime.__toESM(debug);
22
23
  let _babel_traverse = require("@babel/traverse");
23
- _babel_traverse = require_chunk.__toESM(_babel_traverse);
24
+ _babel_traverse = require_rolldown_runtime.__toESM(_babel_traverse);
24
25
  let _babel_parser = require("@babel/parser");
25
26
  let magic_string = require("magic-string");
26
- magic_string = require_chunk.__toESM(magic_string);
27
+ magic_string = require_rolldown_runtime.__toESM(magic_string);
27
28
  let _ast_core_escape = require("@ast-core/escape");
28
29
  let _babel_types = require("@babel/types");
29
- _babel_types = require_chunk.__toESM(_babel_types);
30
+ _babel_types = require_rolldown_runtime.__toESM(_babel_types);
30
31
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
31
32
  //#region src/cache/index.ts
32
33
  function isProcessResult(value) {
@@ -121,6 +122,23 @@ function initializeCache(cacheConfig) {
121
122
  return cacheConfig;
122
123
  }
123
124
  //#endregion
125
+ //#region src/framework/platform.ts
126
+ const MPX_TO_UNI_PLATFORM = {
127
+ ali: "mp-alipay",
128
+ dd: "mp-dingtalk",
129
+ jd: "mp-jd",
130
+ qq: "mp-qq",
131
+ swan: "mp-baidu",
132
+ tt: "mp-toutiao",
133
+ wx: "mp-weixin"
134
+ };
135
+ function normalizeFrameworkStylePlatform(platform, appType) {
136
+ const normalized = platform?.trim().toLowerCase();
137
+ if (!normalized) return;
138
+ if (appType === "mpx") return MPX_TO_UNI_PLATFORM[normalized] ?? normalized;
139
+ return normalized;
140
+ }
141
+ //#endregion
124
142
  //#region src/debug/index.ts
125
143
  const _debug = (0, debug.default)("weapp-tw");
126
144
  function createDebug(prefix) {
@@ -241,7 +259,7 @@ function tryGetRuntimeClassSetSync(tailwindRuntime) {
241
259
  async function collectTailwindV4GeneratorClassSet(tailwindRuntime) {
242
260
  if (typeof tailwindRuntime.collectContentTokens !== "function") return;
243
261
  try {
244
- const source = await require_v4_engine.resolveTailwindV4SourceFromRuntime(tailwindRuntime);
262
+ const source = require_v4_engine.resolveCssMacroTailwindV4Source(await require_v4_engine.resolveTailwindV4SourceFromRuntime(tailwindRuntime));
245
263
  const generated = await require_v4_engine.createTailwindV4Engine(source).generate({
246
264
  scanSources: true,
247
265
  target: "web"
@@ -257,7 +275,7 @@ async function collectTailwindV4GeneratorClassSet(tailwindRuntime) {
257
275
  async function mergeTailwindV4GeneratorClassSet(tailwindRuntime, classSet) {
258
276
  const generatorClassSet = await collectTailwindV4GeneratorClassSet(tailwindRuntime).catch(() => void 0);
259
277
  if (!generatorClassSet || generatorClassSet.size === 0) return classSet;
260
- return new Set([...classSet, ...generatorClassSet]);
278
+ return /* @__PURE__ */ new Set([...classSet, ...generatorClassSet]);
261
279
  }
262
280
  async function collectRuntimeClassSet(tailwindRuntime, options = {}) {
263
281
  let activeRuntime = tailwindRuntime;
@@ -844,14 +862,14 @@ function decodeUnicode2(input) {
844
862
  }
845
863
  //#endregion
846
864
  //#region src/js/class-context.ts
847
- const CLASS_LIKE_KEYWORDS = new Set([
865
+ const CLASS_LIKE_KEYWORDS = /* @__PURE__ */ new Set([
848
866
  "class",
849
867
  "classname",
850
868
  "hoverclass",
851
869
  "virtualhostclass",
852
870
  "rootclass"
853
871
  ]);
854
- const CLASS_HELPER_IDENTIFIERS = new Set([
872
+ const CLASS_HELPER_IDENTIFIERS = /* @__PURE__ */ new Set([
855
873
  "cn",
856
874
  "clsx",
857
875
  "classnames",
@@ -1297,7 +1315,7 @@ function walkEvalExpression(path, options, updater, handler) {
1297
1315
  }
1298
1316
  }
1299
1317
  //#endregion
1300
- //#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
1318
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/typeof.js
1301
1319
  function _typeof(o) {
1302
1320
  "@babel/helpers - typeof";
1303
1321
  return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
@@ -1307,7 +1325,7 @@ function _typeof(o) {
1307
1325
  }, _typeof(o);
1308
1326
  }
1309
1327
  //#endregion
1310
- //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
1328
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPrimitive.js
1311
1329
  function toPrimitive(t, r) {
1312
1330
  if ("object" != _typeof(t) || !t) return t;
1313
1331
  var e = t[Symbol.toPrimitive];
@@ -1319,13 +1337,13 @@ function toPrimitive(t, r) {
1319
1337
  return ("string" === r ? String : Number)(t);
1320
1338
  }
1321
1339
  //#endregion
1322
- //#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
1340
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/toPropertyKey.js
1323
1341
  function toPropertyKey(t) {
1324
1342
  var i = toPrimitive(t, "string");
1325
1343
  return "symbol" == _typeof(i) ? i : i + "";
1326
1344
  }
1327
1345
  //#endregion
1328
- //#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
1346
+ //#region \0@oxc-project+runtime@0.137.0/helpers/esm/defineProperty.js
1329
1347
  function _defineProperty(e, r, t) {
1330
1348
  return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
1331
1349
  value: t,
@@ -1799,7 +1817,7 @@ function createTaggedTemplateIgnore({ matcher, names }) {
1799
1817
  }
1800
1818
  if (item === singleCanonicalIgnoreName) continue;
1801
1819
  if (!canonicalIgnoreNames) {
1802
- canonicalIgnoreNames = new Set([singleCanonicalIgnoreName, item]);
1820
+ canonicalIgnoreNames = /* @__PURE__ */ new Set([singleCanonicalIgnoreName, item]);
1803
1821
  continue;
1804
1822
  }
1805
1823
  canonicalIgnoreNames.add(item);
@@ -2500,7 +2518,7 @@ function generateCode(match, options = {}) {
2500
2518
  }
2501
2519
  //#endregion
2502
2520
  //#region ../../node_modules/.pnpm/entities@8.0.0/node_modules/entities/dist/decode-codepoint.js
2503
- const decodeMap = new Map([
2521
+ const decodeMap = /* @__PURE__ */ new Map([
2504
2522
  [0, 65533],
2505
2523
  [128, 8364],
2506
2524
  [130, 8218],
@@ -3043,7 +3061,7 @@ var QuoteType;
3043
3061
  * sequences with an increased offset.
3044
3062
  */
3045
3063
  const Sequences = {
3046
- Empty: new Uint8Array(0),
3064
+ Empty: /* @__PURE__ */ new Uint8Array(0),
3047
3065
  Cdata: new Uint8Array([
3048
3066
  67,
3049
3067
  68,
@@ -3172,7 +3190,7 @@ const Sequences = {
3172
3190
  * where index 2 is the first tag-name character, so matching always
3173
3191
  * continues from offset 3.
3174
3192
  */
3175
- const specialStartSequences = new Map([
3193
+ const specialStartSequences = /* @__PURE__ */ new Map([
3176
3194
  [Sequences.IframeEnd[2], Sequences.IframeEnd],
3177
3195
  [Sequences.NoembedEnd[2], Sequences.NoembedEnd],
3178
3196
  [Sequences.Plaintext[2], Sequences.Plaintext],
@@ -3900,7 +3918,7 @@ var Tokenizer$1 = class {
3900
3918
  //#endregion
3901
3919
  //#region ../../node_modules/.pnpm/htmlparser2@12.0.0/node_modules/htmlparser2/dist/Parser.js
3902
3920
  const { fromCodePoint } = String;
3903
- const formTags = new Set([
3921
+ const formTags = /* @__PURE__ */ new Set([
3904
3922
  "input",
3905
3923
  "option",
3906
3924
  "optgroup",
@@ -3909,8 +3927,8 @@ const formTags = new Set([
3909
3927
  "datalist",
3910
3928
  "textarea"
3911
3929
  ]);
3912
- const pTag = new Set(["p"]);
3913
- const headingTags = new Set([
3930
+ const pTag = /* @__PURE__ */ new Set(["p"]);
3931
+ const headingTags = /* @__PURE__ */ new Set([
3914
3932
  "h1",
3915
3933
  "h2",
3916
3934
  "h3",
@@ -3919,28 +3937,28 @@ const headingTags = new Set([
3919
3937
  "h6",
3920
3938
  "p"
3921
3939
  ]);
3922
- const tableSectionTags = new Set(["thead", "tbody"]);
3923
- const ddtTags = new Set(["dd", "dt"]);
3924
- const rtpTags = new Set(["rt", "rp"]);
3925
- const openImpliesClose = new Map([
3926
- ["tr", new Set([
3940
+ const tableSectionTags = /* @__PURE__ */ new Set(["thead", "tbody"]);
3941
+ const ddtTags = /* @__PURE__ */ new Set(["dd", "dt"]);
3942
+ const rtpTags = /* @__PURE__ */ new Set(["rt", "rp"]);
3943
+ const openImpliesClose = /* @__PURE__ */ new Map([
3944
+ ["tr", /* @__PURE__ */ new Set([
3927
3945
  "tr",
3928
3946
  "th",
3929
3947
  "td"
3930
3948
  ])],
3931
- ["th", new Set(["th"])],
3932
- ["td", new Set([
3949
+ ["th", /* @__PURE__ */ new Set(["th"])],
3950
+ ["td", /* @__PURE__ */ new Set([
3933
3951
  "thead",
3934
3952
  "th",
3935
3953
  "td"
3936
3954
  ])],
3937
- ["body", new Set([
3955
+ ["body", /* @__PURE__ */ new Set([
3938
3956
  "head",
3939
3957
  "link",
3940
3958
  "script"
3941
3959
  ])],
3942
- ["a", new Set(["a"])],
3943
- ["li", new Set(["li"])],
3960
+ ["a", /* @__PURE__ */ new Set(["a"])],
3961
+ ["li", /* @__PURE__ */ new Set(["li"])],
3944
3962
  ["p", pTag],
3945
3963
  ["h1", headingTags],
3946
3964
  ["h2", headingTags],
@@ -3954,8 +3972,8 @@ const openImpliesClose = new Map([
3954
3972
  ["button", formTags],
3955
3973
  ["datalist", formTags],
3956
3974
  ["textarea", formTags],
3957
- ["option", new Set(["option"])],
3958
- ["optgroup", new Set(["optgroup", "option"])],
3975
+ ["option", /* @__PURE__ */ new Set(["option"])],
3976
+ ["optgroup", /* @__PURE__ */ new Set(["optgroup", "option"])],
3959
3977
  ["dd", ddtTags],
3960
3978
  ["dt", ddtTags],
3961
3979
  ["address", pTag],
@@ -3985,7 +4003,7 @@ const openImpliesClose = new Map([
3985
4003
  ["tfoot", tableSectionTags]
3986
4004
  ]);
3987
4005
  const DOCUMENT_TYPE = "doctype";
3988
- const voidElements = new Set([
4006
+ const voidElements = /* @__PURE__ */ new Set([
3989
4007
  "area",
3990
4008
  "base",
3991
4009
  "basefont",
@@ -4006,14 +4024,14 @@ const voidElements = new Set([
4006
4024
  "track",
4007
4025
  "wbr"
4008
4026
  ]);
4009
- const foreignContextElements = new Set(["math", "svg"]);
4027
+ const foreignContextElements = /* @__PURE__ */ new Set(["math", "svg"]);
4010
4028
  /**
4011
4029
  * Elements that can be used to integrate HTML content within foreign namespaces (e.g., SVG or MathML).
4012
4030
  *
4013
4031
  * Entries must use the SVG-adjusted casing (e.g. "foreignObject" not
4014
4032
  * "foreignobject") since they are compared against adjusted tag names.
4015
4033
  */
4016
- const htmlIntegrationElements = new Set([
4034
+ const htmlIntegrationElements = /* @__PURE__ */ new Set([
4017
4035
  "mi",
4018
4036
  "mo",
4019
4037
  "mn",
@@ -4024,7 +4042,7 @@ const htmlIntegrationElements = new Set([
4024
4042
  "desc",
4025
4043
  "title"
4026
4044
  ]);
4027
- const svgTagNameAdjustments = new Map([
4045
+ const svgTagNameAdjustments = /* @__PURE__ */ new Map([
4028
4046
  ["altglyph", "altGlyph"],
4029
4047
  ["altglyphdef", "altGlyphDef"],
4030
4048
  ["altglyphitem", "altGlyphItem"],
@@ -4488,7 +4506,7 @@ var Parser = class {
4488
4506
  };
4489
4507
  //#endregion
4490
4508
  //#region src/wxml/whitespace.ts
4491
- const WHITESPACE_CODES = new Set([
4509
+ const WHITESPACE_CODES = /* @__PURE__ */ new Set([
4492
4510
  9,
4493
4511
  10,
4494
4512
  11,
@@ -4965,6 +4983,13 @@ function syncLegacyFieldsToCssOptions(ctx) {
4965
4983
  injectAdditionalCssVarScope: ctx.injectAdditionalCssVarScope
4966
4984
  };
4967
4985
  }
4986
+ function applyFrameworkPlatformDefaults(ctx) {
4987
+ if (ctx.cssOptions?.platform || ctx.platform) {
4988
+ ctx.platform = normalizeFrameworkStylePlatform(ctx.cssOptions?.platform ?? ctx.platform, ctx.appType);
4989
+ return;
4990
+ }
4991
+ if (ctx.appType === "mpx") ctx.platform = normalizeFrameworkStylePlatform(require_framework.resolveMpxPlatform().normalized, ctx.appType);
4992
+ }
4968
4993
  async function clearTailwindcssRuntimeCache(tailwindRuntime, options) {
4969
4994
  if (!tailwindRuntime) return;
4970
4995
  const cacheOptions = tailwindRuntime.options?.cache;
@@ -4998,6 +5023,7 @@ function createInternalCompilerContext(opts) {
4998
5023
  ctx.arbitraryValues = resolveUnocssBareArbitraryValues(ctx.arbitraryValues, ctx.unocss);
4999
5024
  ctx.escapeMap = ctx.customReplaceDictionary;
5000
5025
  syncCssOptionsToLegacyFields(ctx);
5026
+ applyFrameworkPlatformDefaults(ctx);
5001
5027
  applyLoggerLevel(ctx.logLevel);
5002
5028
  const tailwindRuntime = require_tailwindcss.createTailwindcssRuntimeFromContext(ctx);
5003
5029
  logTailwindcssTarget(tailwindRuntime, ctx.tailwindcssBasedir);
@@ -5116,6 +5142,12 @@ Object.defineProperty(exports, "isClassContextLiteralPath", {
5116
5142
  return isClassContextLiteralPath;
5117
5143
  }
5118
5144
  });
5145
+ Object.defineProperty(exports, "normalizeFrameworkStylePlatform", {
5146
+ enumerable: true,
5147
+ get: function() {
5148
+ return normalizeFrameworkStylePlatform;
5149
+ }
5150
+ });
5119
5151
  Object.defineProperty(exports, "normalizeStyleHandlerMajorVersion", {
5120
5152
  enumerable: true,
5121
5153
  get: function() {
package/dist/core.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_context = require("./context-CH4HFZP2.js");
2
+ const require_context = require("./context-DCVMkTRj.js");
3
3
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
4
4
  //#region src/core.ts
5
5
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
package/dist/core.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { b as ensureRuntimeClassSet, l as shouldSkipJsTransform, t as getCompilerContext, y as createTailwindRuntimeReadyPromise } from "./context-C-r8ki7x.mjs";
1
+ import { b as ensureRuntimeClassSet, l as shouldSkipJsTransform, t as getCompilerContext, y as createTailwindRuntimeReadyPromise } from "./context-Bkpmt3ja.mjs";
2
2
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
3
3
  //#region src/core.ts
4
4
  const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
@@ -1,4 +1,4 @@
1
- export { compileCssMacroConditionalComments, CSS_MACRO_STYLE_OPTIONS_MARKER, hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, transformCssMacroCss, withCssMacroStyleOptions, } from '@weapp-tailwindcss/postcss';
1
+ export { compileCssMacroConditionalComments, CSS_MACRO_STYLE_OPTIONS_MARKER, hasCssMacroStyleOptions, hasCssMacroTailwindV4CustomVariantConditionalComments, hasCssMacroTailwindV4Directive, hasCssMacroTailwindV4InternalAtRules, hasCssMacroTailwindV4Source, transformCssMacroCss, transformCssMacroTailwindV4Source, withCssMacroStyleOptions, } from '@weapp-tailwindcss/postcss';
2
2
  export declare const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
3
3
  export declare function markCssMacroPlugin<T extends object>(value: T): T;
4
4
  export declare function isCssMacroTailwindPlugin(value: unknown): boolean;
@@ -2,9 +2,9 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_chunk = require("../chunk-emK7D4bc.js");
5
+ const require_rolldown_runtime = require("../rolldown-runtime-emK7D4bc.js");
6
6
  let _weapp_tailwindcss_postcss_css_macro_postcss = require("@weapp-tailwindcss/postcss/css-macro/postcss");
7
- _weapp_tailwindcss_postcss_css_macro_postcss = require_chunk.__toESM(_weapp_tailwindcss_postcss_css_macro_postcss);
7
+ _weapp_tailwindcss_postcss_css_macro_postcss = require_rolldown_runtime.__toESM(_weapp_tailwindcss_postcss_css_macro_postcss);
8
8
  Object.defineProperty(exports, "CSS_MACRO_POSTCSS_PLUGIN_NAME", {
9
9
  enumerable: true,
10
10
  get: function() {
package/dist/css-macro.js CHANGED
@@ -1,8 +1,8 @@
1
- const require_chunk = require("./chunk-emK7D4bc.js");
1
+ const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
2
2
  const require_auto = require("./auto-DtU6f3X6.js");
3
- require("./utils-BCa37Wqj.js");
3
+ require("./utils-D3h8j7Mk.js");
4
4
  let tailwindcss_plugin = require("tailwindcss/plugin");
5
- tailwindcss_plugin = require_chunk.__toESM(tailwindcss_plugin);
5
+ tailwindcss_plugin = require_rolldown_runtime.__toESM(tailwindcss_plugin);
6
6
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
7
7
  //#region src/css-macro/constants.ts
8
8
  const queryKey = "weapp-tw-platform";
@@ -1,4 +1,4 @@
1
- import { r as markCssMacroPlugin } from "./auto-Ba6hDrse.mjs";
1
+ import { i as markCssMacroPlugin } from "./auto-CrJJc5rK.mjs";
2
2
  import { t as defu } from "./utils-DodxWHGz.mjs";
3
3
  import plugin from "tailwindcss/plugin";
4
4
  //#region src/css-macro/constants.ts
@@ -1,4 +1,4 @@
1
- require("./utils-BCa37Wqj.js");
1
+ require("./utils-D3h8j7Mk.js");
2
2
  let _weapp_core_escape = require("@weapp-core/escape");
3
3
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
4
4
  //#region src/js/babel/cache-options.ts
package/dist/defaults.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defaults = require("./defaults-CmFBmxsr.js");
2
+ const require_defaults = require("./defaults-DQhgnnn-.js");
3
3
  exports.TAILWIND_V4_CSS_PREFLIGHT = require_defaults.TAILWIND_V4_CSS_PREFLIGHT;
4
4
  exports.getDefaultCssPreflight = require_defaults.getDefaultCssPreflight;
5
5
  exports.getDefaultOptions = require_defaults.getDefaultOptions;
@@ -37,10 +37,15 @@ export interface DetectAppTypeOptions {
37
37
  hbuilderxVite?: boolean | undefined;
38
38
  }
39
39
  export declare function isRunningInHBuilderX(options?: HBuilderXRuntimeHints): boolean;
40
- export declare function resolveUniPlatform(value: string | undefined): UniPlatformInfo;
41
- export declare function resolveUniUtsPlatform(value: string | undefined): UniPlatformInfo;
40
+ export declare function resolvePlatform(value: string | undefined): UniPlatformInfo;
41
+ export declare function resolveTaroPlatform(value?: string | undefined): UniPlatformInfo;
42
+ export declare function resolveMpxPlatform(value?: string | undefined): UniPlatformInfo;
43
+ export declare function resolveUniPlatform(value?: string | undefined): UniPlatformInfo;
44
+ export declare function resolveUniUtsPlatform(value?: string | undefined): UniPlatformInfo;
45
+ export declare function resolveUniAppXPlatform(value?: string | undefined): UniPlatformInfo;
42
46
  export declare function resolveUniPlatformsFromEnv(env?: FrameworkEnv): {
43
47
  uniPlatform: UniPlatformInfo;
48
+ uniAppXPlatform: UniPlatformInfo;
44
49
  uniUtsPlatform: UniPlatformInfo;
45
50
  };
46
51
  export declare function detectAppTypeFromEnv(env?: FrameworkEnv, options?: {
@@ -0,0 +1,2 @@
1
+ import type { DetectableAppType } from './index';
2
+ export declare function normalizeFrameworkStylePlatform(platform: string | undefined, appType: DetectableAppType | undefined): string | undefined;
package/dist/framework.js CHANGED
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_chunk = require("./chunk-emK7D4bc.js");
2
+ const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
3
3
  let node_fs = require("node:fs");
4
4
  let node_path = require("node:path");
5
- node_path = require_chunk.__toESM(node_path);
5
+ node_path = require_rolldown_runtime.__toESM(node_path);
6
6
  let node_process = require("node:process");
7
- node_process = require_chunk.__toESM(node_process);
7
+ node_process = require_rolldown_runtime.__toESM(node_process);
8
8
  //#region src/framework/index.ts
9
9
  const KNOWN_MAC_HBUILDERX_PLUGIN_DIRS = ["/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli-vite", "/Applications/HBuilderX.app/Contents/HBuilderX/plugins/uniapp-cli"];
10
10
  const HBUILDERX_PLUGIN_CWD_RE = /[\\/]HBuilderX(?:\.[^\\/]*)?(?:[\\/]Contents[\\/]HBuilderX)?[\\/]plugins[\\/]uniapp-cli(?:-vite)?(?:[\\/]|$)/i;
@@ -15,6 +15,17 @@ const TARO_SCRIPT_RE = /\btaro\b/u;
15
15
  const WEAPP_VITE_SCRIPT_RE = /\bweapp-vite\b/u;
16
16
  const UNI_APP_SCRIPT_RE = /\buni(?:\s|$)/u;
17
17
  const UNI_APP_VITE_SCRIPT_RE = /\buni(?:\s|$)/u;
18
+ const MINI_PROGRAM_PLATFORMS = /* @__PURE__ */ new Set([
19
+ "alipay",
20
+ "baidu",
21
+ "jd",
22
+ "qq",
23
+ "swan",
24
+ "tt",
25
+ "weapp",
26
+ "wechat",
27
+ "wx"
28
+ ]);
18
29
  const MPX_MARKERS = [["src/app.mpx", "mpx"], ["app.mpx", "mpx"]];
19
30
  function getProcessEnv() {
20
31
  return {
@@ -29,7 +40,7 @@ function getProcessEnv() {
29
40
  };
30
41
  }
31
42
  function resolveDependencyNames(pkg) {
32
- return new Set([
43
+ return /* @__PURE__ */ new Set([
33
44
  ...Object.keys(pkg.dependencies ?? {}),
34
45
  ...Object.keys(pkg.devDependencies ?? {}),
35
46
  ...Object.keys(pkg.peerDependencies ?? {}),
@@ -57,7 +68,7 @@ function resolvePlatformInfo(value) {
57
68
  isAppAndroid,
58
69
  isAppHarmony,
59
70
  isAppIos,
60
- isMp: normalized?.startsWith("mp-") === true,
71
+ isMp: normalized?.startsWith("mp-") === true || (normalized ? MINI_PROGRAM_PLATFORMS.has(normalized) : false),
61
72
  isWeb: normalized?.startsWith("web") === true || normalized === "h5"
62
73
  };
63
74
  }
@@ -79,15 +90,31 @@ function isRunningInHBuilderX(options = {}) {
79
90
  if (!(nodePath == null || nodePath.trim().length === 0)) return false;
80
91
  return matchesHBuilderXPluginCwd(options.cwd ?? node_process.default.cwd());
81
92
  }
82
- function resolveUniPlatform(value) {
93
+ function resolvePlatform(value) {
83
94
  return resolvePlatformInfo(value);
84
95
  }
85
- function resolveUniUtsPlatform(value) {
86
- return resolvePlatformInfo(value);
96
+ function resolveTaroPlatform(value = getProcessEnv().TARO_ENV) {
97
+ return resolvePlatform(value);
98
+ }
99
+ function resolveMpxPlatformValue(env = getProcessEnv()) {
100
+ return env.MPX_CURRENT_TARGET_MODE ?? env.MPX_CLI_MODE;
101
+ }
102
+ function resolveMpxPlatform(value = resolveMpxPlatformValue()) {
103
+ return resolvePlatform(value);
104
+ }
105
+ function resolveUniPlatform(value = getProcessEnv().UNI_PLATFORM) {
106
+ return resolvePlatform(value);
107
+ }
108
+ function resolveUniUtsPlatform(value = getProcessEnv().UNI_UTS_PLATFORM) {
109
+ return resolvePlatform(value);
110
+ }
111
+ function resolveUniAppXPlatform(value = getProcessEnv().UNI_UTS_PLATFORM) {
112
+ return resolvePlatform(value);
87
113
  }
88
114
  function resolveUniPlatformsFromEnv(env = getProcessEnv()) {
89
115
  return {
90
116
  uniPlatform: resolveUniPlatform(env.UNI_PLATFORM),
117
+ uniAppXPlatform: resolveUniAppXPlatform(env.UNI_UTS_PLATFORM),
91
118
  uniUtsPlatform: resolveUniUtsPlatform(env.UNI_UTS_PLATFORM)
92
119
  };
93
120
  }
@@ -193,6 +220,10 @@ exports.isUniAppXManifest = isUniAppXManifest;
193
220
  exports.isUniAppXPackage = isUniAppXPackage;
194
221
  exports.isWeappVitePackage = isWeappVitePackage;
195
222
  exports.resolveImplicitAppTypeFromViteRoot = resolveImplicitAppTypeFromViteRoot;
223
+ exports.resolveMpxPlatform = resolveMpxPlatform;
224
+ exports.resolvePlatform = resolvePlatform;
225
+ exports.resolveTaroPlatform = resolveTaroPlatform;
226
+ exports.resolveUniAppXPlatform = resolveUniAppXPlatform;
196
227
  exports.resolveUniPlatform = resolveUniPlatform;
197
228
  exports.resolveUniPlatformsFromEnv = resolveUniPlatformsFromEnv;
198
229
  exports.resolveUniUtsPlatform = resolveUniUtsPlatform;
@@ -11,6 +11,17 @@ const TARO_SCRIPT_RE = /\btaro\b/u;
11
11
  const WEAPP_VITE_SCRIPT_RE = /\bweapp-vite\b/u;
12
12
  const UNI_APP_SCRIPT_RE = /\buni(?:\s|$)/u;
13
13
  const UNI_APP_VITE_SCRIPT_RE = /\buni(?:\s|$)/u;
14
+ const MINI_PROGRAM_PLATFORMS = /* @__PURE__ */ new Set([
15
+ "alipay",
16
+ "baidu",
17
+ "jd",
18
+ "qq",
19
+ "swan",
20
+ "tt",
21
+ "weapp",
22
+ "wechat",
23
+ "wx"
24
+ ]);
14
25
  const MPX_MARKERS = [["src/app.mpx", "mpx"], ["app.mpx", "mpx"]];
15
26
  function getProcessEnv() {
16
27
  return {
@@ -25,7 +36,7 @@ function getProcessEnv() {
25
36
  };
26
37
  }
27
38
  function resolveDependencyNames(pkg) {
28
- return new Set([
39
+ return /* @__PURE__ */ new Set([
29
40
  ...Object.keys(pkg.dependencies ?? {}),
30
41
  ...Object.keys(pkg.devDependencies ?? {}),
31
42
  ...Object.keys(pkg.peerDependencies ?? {}),
@@ -53,7 +64,7 @@ function resolvePlatformInfo(value) {
53
64
  isAppAndroid,
54
65
  isAppHarmony,
55
66
  isAppIos,
56
- isMp: normalized?.startsWith("mp-") === true,
67
+ isMp: normalized?.startsWith("mp-") === true || (normalized ? MINI_PROGRAM_PLATFORMS.has(normalized) : false),
57
68
  isWeb: normalized?.startsWith("web") === true || normalized === "h5"
58
69
  };
59
70
  }
@@ -75,15 +86,31 @@ function isRunningInHBuilderX(options = {}) {
75
86
  if (!(nodePath == null || nodePath.trim().length === 0)) return false;
76
87
  return matchesHBuilderXPluginCwd(options.cwd ?? process.cwd());
77
88
  }
78
- function resolveUniPlatform(value) {
89
+ function resolvePlatform(value) {
79
90
  return resolvePlatformInfo(value);
80
91
  }
81
- function resolveUniUtsPlatform(value) {
82
- return resolvePlatformInfo(value);
92
+ function resolveTaroPlatform(value = getProcessEnv().TARO_ENV) {
93
+ return resolvePlatform(value);
94
+ }
95
+ function resolveMpxPlatformValue(env = getProcessEnv()) {
96
+ return env.MPX_CURRENT_TARGET_MODE ?? env.MPX_CLI_MODE;
97
+ }
98
+ function resolveMpxPlatform(value = resolveMpxPlatformValue()) {
99
+ return resolvePlatform(value);
100
+ }
101
+ function resolveUniPlatform(value = getProcessEnv().UNI_PLATFORM) {
102
+ return resolvePlatform(value);
103
+ }
104
+ function resolveUniUtsPlatform(value = getProcessEnv().UNI_UTS_PLATFORM) {
105
+ return resolvePlatform(value);
106
+ }
107
+ function resolveUniAppXPlatform(value = getProcessEnv().UNI_UTS_PLATFORM) {
108
+ return resolvePlatform(value);
83
109
  }
84
110
  function resolveUniPlatformsFromEnv(env = getProcessEnv()) {
85
111
  return {
86
112
  uniPlatform: resolveUniPlatform(env.UNI_PLATFORM),
113
+ uniAppXPlatform: resolveUniAppXPlatform(env.UNI_UTS_PLATFORM),
87
114
  uniUtsPlatform: resolveUniUtsPlatform(env.UNI_UTS_PLATFORM)
88
115
  };
89
116
  }
@@ -177,4 +204,4 @@ function detectAppType(options = {}) {
177
204
  }
178
205
  const resolveImplicitAppTypeFromViteRoot = (root) => detectAppType({ root });
179
206
  //#endregion
180
- export { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform };
207
+ export { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform };
@@ -1,4 +1,4 @@
1
- import { W as createTailwindV4Engine, ct as inferGeneratorTargetFromEnv, n as resolveTailwindV4SourceFromRuntime } from "./v4-engine-C3qSwQ-e.mjs";
1
+ import { W as createTailwindV4Engine, lt as inferGeneratorTargetFromEnv, n as resolveTailwindV4SourceFromRuntime } from "./v4-engine-BuuYDXt1.mjs";
2
2
  import { o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
3
3
  //#region src/runtime-branch/create-branch.ts
4
4
  function createRuntimeBranch(base, platformFamily, options) {
@@ -93,10 +93,12 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
93
93
  ...context,
94
94
  generatorTarget: target
95
95
  });
96
+ const hasExplicitTarget = options !== void 0 && Object.hasOwn(options, "target");
97
+ const webCompat = options?.webCompat ?? (!hasExplicitTarget && branch.isWeb ? true : void 0);
96
98
  if (options == null) return {
97
99
  target,
98
100
  branch,
99
- webCompat: void 0,
101
+ webCompat,
100
102
  importFallback: false,
101
103
  bareArbitraryValues: void 0
102
104
  };
@@ -105,7 +107,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
105
107
  branch,
106
108
  config: options.config,
107
109
  styleOptions: options.styleOptions,
108
- webCompat: options.webCompat,
110
+ webCompat,
109
111
  importFallback: options.importFallback ?? false,
110
112
  bareArbitraryValues: options.bareArbitraryValues
111
113
  };
@@ -1,5 +1,5 @@
1
- const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
2
- const require_utils = require("./utils-BCa37Wqj.js");
1
+ const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
2
+ const require_utils = require("./utils-D3h8j7Mk.js");
3
3
  //#region src/runtime-branch/create-branch.ts
4
4
  function createRuntimeBranch(base, platformFamily, options) {
5
5
  const { context, tailwindcssVersion } = base;
@@ -93,10 +93,12 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
93
93
  ...context,
94
94
  generatorTarget: target
95
95
  });
96
+ const hasExplicitTarget = options !== void 0 && Object.hasOwn(options, "target");
97
+ const webCompat = options?.webCompat ?? (!hasExplicitTarget && branch.isWeb ? true : void 0);
96
98
  if (options == null) return {
97
99
  target,
98
100
  branch,
99
- webCompat: void 0,
101
+ webCompat,
100
102
  importFallback: false,
101
103
  bareArbitraryValues: void 0
102
104
  };
@@ -105,7 +107,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
105
107
  branch,
106
108
  config: options.config,
107
109
  styleOptions: options.styleOptions,
108
- webCompat: options.webCompat,
110
+ webCompat,
109
111
  importFallback: options.importFallback ?? false,
110
112
  bareArbitraryValues: options.bareArbitraryValues
111
113
  };
package/dist/generator.js CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
3
- const require_generator = require("./generator-B6pUjNdD.js");
2
+ const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
3
+ const require_generator = require("./generator-CilgHtxb.js");
4
4
  exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
5
5
  exports.createWeappTailwindcssGeneratorFromRuntime = require_generator.createWeappTailwindcssGeneratorFromRuntime;
6
6
  exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
@@ -1,3 +1,3 @@
1
- import { K as transformTailwindV4CssByTarget, i as resolveTailwindV4SourceOptionsFromRuntime, n as resolveTailwindV4SourceFromRuntime, q as transformTailwindV4CssToWeapp, r as resolveTailwindV4SourceFromRuntimeOptions, t as resolveTailwindV4Source } from "./v4-engine-C3qSwQ-e.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator } from "./generator-BsPIaLtV.mjs";
1
+ import { K as transformTailwindV4CssByTarget, i as resolveTailwindV4SourceOptionsFromRuntime, n as resolveTailwindV4SourceFromRuntime, q as transformTailwindV4CssToWeapp, r as resolveTailwindV4SourceFromRuntimeOptions, t as resolveTailwindV4Source } from "./v4-engine-BuuYDXt1.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator } from "./generator-24-HgU9F.mjs";
3
3
  export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromRuntime, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromRuntime, resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };