weapp-tailwindcss 5.5.4 → 5.5.6

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 (134) hide show
  1. package/dist/bundlers/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +5 -4
  2. package/dist/bundlers/shared/final-css-cleanup.d.ts +1 -2
  3. package/dist/bundlers/shared/framework-css-composition.d.ts +1 -0
  4. package/dist/bundlers/shared/framework-postcss.d.ts +2 -1
  5. package/dist/bundlers/shared/framework-user-css.d.ts +1 -0
  6. package/dist/bundlers/shared/generated-css-marker.d.ts +1 -0
  7. package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +5 -7
  8. package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +4 -1
  9. package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +1 -4
  10. package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -1
  11. package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +4 -2
  12. package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +1 -1
  13. package/dist/bundlers/shared/generator-css/types.d.ts +6 -3
  14. package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +1 -0
  15. package/dist/bundlers/shared/generator-css/user-css/compile-functions.d.ts +4 -0
  16. package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +3 -1
  17. package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +1 -1
  18. package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +3 -0
  19. package/dist/bundlers/shared/style-handler-options.d.ts +7 -0
  20. package/dist/bundlers/shared/v4-generation-core.d.ts +0 -1
  21. package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +3 -0
  22. package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +3 -0
  23. package/dist/bundlers/vite/css-handler-options.d.ts +1 -1
  24. package/dist/bundlers/vite/frameworks/generic/web.d.ts +2 -1
  25. package/dist/bundlers/vite/generate-bundle/css-transform-decision-plan.d.ts +1 -0
  26. package/dist/bundlers/vite/generate-bundle/finalize/sync-processed-css.d.ts +4 -0
  27. package/dist/bundlers/vite/generate-bundle/framework-style-memory.d.ts +4 -0
  28. package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +7 -0
  29. package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -0
  30. package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +1 -1
  31. package/dist/bundlers/vite/generate-bundle/runtime.d.ts +3 -1
  32. package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +1 -1
  33. package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +2 -2
  34. package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -1
  35. package/dist/bundlers/vite/generate-bundle/web-css-module.d.ts +1 -0
  36. package/dist/bundlers/vite/plugin-hook.d.ts +3 -0
  37. package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +3 -1
  38. package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +1 -1
  39. package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +1 -1
  40. package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +3 -1
  41. package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +2 -1
  42. package/dist/bundlers/vite/shared/framework-runtime-configuration.d.ts +3 -0
  43. package/dist/bundlers/vite/shared/framework-runtime-options.d.ts +9 -0
  44. package/dist/bundlers/vite/shared/framework-runtime-utils.d.ts +6 -5
  45. package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +3 -3
  46. package/dist/bundlers/vite/shared/framework-strategy.d.ts +3 -1
  47. package/dist/bundlers/vite/shared/hmr-source.d.ts +2 -0
  48. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/processed-css-task.d.ts +2 -1
  49. package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
  50. package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +1 -1
  51. package/dist/compiler/index.d.ts +2 -0
  52. package/dist/compiler/semantic-css.d.ts +1 -1
  53. package/dist/compiler/types.d.ts +1 -1
  54. package/dist/{compiler-DFROuh5Z.cjs → compiler-C8FqI-P3.cjs} +1060 -1163
  55. package/dist/{compiler-CJ5yX-on.js → compiler-D3GBwxoa.js} +32 -23
  56. package/dist/core/compiler/transforms.d.ts +1 -1
  57. package/dist/core.cjs +4 -4
  58. package/dist/core.js +4 -4
  59. package/dist/{css-imports-_5cwJnx-.cjs → css-imports-XvtI1zCY.cjs} +2 -3
  60. package/dist/css-macro.cjs +1 -1
  61. package/dist/css-macro.js +1 -1
  62. package/dist/{defaults-CKx-4LcW.js → defaults-AQuvJS-h.js} +4 -2
  63. package/dist/{defaults-CiGsr8Xq.cjs → defaults-CyX5iO9y.cjs} +4 -2
  64. package/dist/defaults.cjs +1 -1
  65. package/dist/defaults.js +1 -1
  66. package/dist/final-css-cleanup-CDTmVAye.cjs +1 -0
  67. package/dist/{final-css-cleanup-B0HUBtiE.js → final-css-cleanup-u_sI2p56.js} +1 -126
  68. package/dist/framework/index.d.ts +1 -1
  69. package/dist/framework/platform.d.ts +2 -2
  70. package/dist/{generator-RK2HtgOb.cjs → generator-Bvr4WmuF.cjs} +150 -150
  71. package/dist/{generator-BgbYHNgD.js → generator-C0BJjyLM.js} +131 -131
  72. package/dist/generator.cjs +1 -1
  73. package/dist/generator.js +1 -1
  74. package/dist/{gulp-BS7fTmyj.cjs → gulp-BExe5RBF.cjs} +8 -8
  75. package/dist/{gulp-nl-2p5Dw.js → gulp-BhkIIk7J.js} +5 -5
  76. package/dist/gulp.cjs +1 -1
  77. package/dist/gulp.js +1 -1
  78. package/dist/{hmr-timing-BfxWwMeT.js → hmr-timing-B9Yt86-U.js} +299 -404
  79. package/dist/{hmr-timing-D45cTIzM.cjs → hmr-timing-CoiJIqDu.cjs} +4 -4
  80. package/dist/index.cjs +4 -4
  81. package/dist/index.js +4 -4
  82. package/dist/js/NodePathWalker.d.ts +1 -1
  83. package/dist/js/node-path-walker/export-handlers.d.ts +1 -1
  84. package/dist/js/node-path-walker/import-tokens.d.ts +1 -1
  85. package/dist/{pipeline-helpers-BEhISt4D.cjs → pipeline-helpers-BOjTEmMi.cjs} +6 -6
  86. package/dist/postcss.cjs +1 -1
  87. package/dist/postcss.js +1 -1
  88. package/dist/presets.cjs +2 -2
  89. package/dist/presets.js +2 -2
  90. package/dist/rspack.cjs +2 -2
  91. package/dist/rspack.js +2 -2
  92. package/dist/{scoped-generator-Dqq2iLky.js → scoped-generator-B6Y1bxzM.js} +46 -31
  93. package/dist/{scoped-generator-DccPwmJT.cjs → scoped-generator-BUBls_oM.cjs} +46 -31
  94. package/dist/{source-candidate-scan-signature-CnUlGWhP.cjs → source-candidate-scan-signature-BtJZp28T.cjs} +32 -3
  95. package/dist/{source-candidate-scan-signature-BJkQJtRM.js → source-candidate-scan-signature-DNuGKTqf.js} +21 -4
  96. package/dist/style-injector/internal.d.ts +118 -8
  97. package/dist/style-injector/options.d.ts +5 -1
  98. package/dist/tailwindcss/runtime-options.d.ts +5 -0
  99. package/dist/tailwindcss/v4/preflight.d.ts +0 -1
  100. package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +1 -0
  101. package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +4 -0
  102. package/dist/{tailwindcss-o3Xe-o7M.js → tailwindcss-B_4E52WF.js} +7 -13
  103. package/dist/{tailwindcss-B03BGeTO.cjs → tailwindcss-CBYjzRmV.cjs} +4 -10
  104. package/dist/{transform-BVH7iLHn.js → transform-CkEnJYIP.js} +18 -12
  105. package/dist/{transform-MIhriZRr.cjs → transform-FkqbTBJR.cjs} +17 -11
  106. package/dist/types/index.d.ts +3 -2
  107. package/dist/uni-app-x/border-preflight.d.ts +1 -2
  108. package/dist/uni-app-x/component-local-style.d.ts +2 -1
  109. package/dist/uni-app-x/transform.d.ts +4 -2
  110. package/dist/uni-app-x/vite/author-apply.d.ts +3 -1
  111. package/dist/uni-app-x/vite/native-hmr.d.ts +1 -1
  112. package/dist/uni-app-x/vite/style-result.d.ts +5 -0
  113. package/dist/{v4-generation-core-BvW2aK23.cjs → v4-generation-core-Cz1D7wm1.cjs} +313 -418
  114. package/dist/vite/web.cjs +1 -1
  115. package/dist/vite/web.js +1 -1
  116. package/dist/{vite-4RznbXVI.cjs → vite-DxuKPZlp.cjs} +565 -592
  117. package/dist/{vite-hGECCqfq.js → vite-lP35OguX.js} +558 -578
  118. package/dist/vite-web.d.ts +1 -1
  119. package/dist/vite.cjs +1 -1
  120. package/dist/vite.js +1 -1
  121. package/dist/weapp-tw-css-generation-loader.cjs +2 -2
  122. package/dist/weapp-tw-css-import-rewrite-loader.cjs +7 -7
  123. package/dist/{web-0FAisq6H.js → web-Dfz_jpNj.js} +144 -107
  124. package/dist/{web-DQZ27KWH.cjs → web-DhDxhlkq.cjs} +156 -107
  125. package/dist/{webpack-8cQlXIo4.js → webpack-D6jp1o3m.js} +18 -17
  126. package/dist/{webpack-DOQ_3ViW.cjs → webpack-R2Sbggiy.cjs} +20 -20
  127. package/dist/webpack.cjs +1 -1
  128. package/dist/webpack.js +1 -1
  129. package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -2
  130. package/dist/wxml/utils/custom-template.d.ts +1 -1
  131. package/package.json +9 -11
  132. package/dist/final-css-cleanup-DSjczga3.cjs +0 -138
  133. package/dist/tailwindcss/v4-engine/css-import.d.ts +0 -14
  134. package/dist/uni-app-x/style-asset/source-parser.d.ts +0 -2
@@ -1,8 +1,8 @@
1
1
  import { resolveMpxPlatform } from "./framework.js";
2
- import { A as resolveBooleanObjectOption, Bt as shouldUseUniAppWebRpxCompatibility, Ht as resolveValidTailwindV4Candidates$1, Lt as resolveCssMacroTailwindV4Source, Mt as _defineProperty, T as omitUndefined, Tt as isFileMatchedByTailwindSourceEntries, Vt as loadTailwindV4DesignSystem, a as resolveGeneratorRuntimeBranch, bt as createTailwindV4Engine$1, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source$1 } from "./generator-BgbYHNgD.js";
3
- import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources } from "./tailwindcss-o3Xe-o7M.js";
2
+ import { Bt as shouldUseUniAppWebRpxCompatibility, Dt as isFileMatchedByTailwindSourceEntries, Ht as resolveValidTailwindV4Candidates$1, Lt as resolveCssMacroTailwindV4Source, O as resolveRuntimeBareArbitraryValues, Pt as _defineProperty, St as createTailwindV4Engine$1, T as omitUndefined, Vt as loadTailwindV4DesignSystem, a as resolveGeneratorRuntimeBranch, d as resolveTailwindV4SourceFromRuntime, i as normalizeWeappTailwindcssGeneratorOptions, j as resolveBooleanObjectOption, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source$1 } from "./generator-C0BJjyLM.js";
3
+ import { c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, i as resolveUniAppXOptions, o as applyV4CssCalcDefaults, s as warnMissingCssEntries, t as createTailwindcssRuntimeFromContext, u as getRuntimeClassSetSignatureWithSources } from "./tailwindcss-B_4E52WF.js";
4
4
  import { i as isMap, n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
5
- import { a as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, i as resolveDefaultCssPreflight, o as HARD_PARSE_CACHE_MAX_ENTRIES, r as getDefaultOptions } from "./defaults-CKx-4LcW.js";
5
+ import { a as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, i as resolveDefaultCssPreflight, o as HARD_PARSE_CACHE_MAX_ENTRIES, r as getDefaultOptions } from "./defaults-AQuvJS-h.js";
6
6
  import { createRequire } from "node:module";
7
7
  import path from "node:path";
8
8
  import process from "node:process";
@@ -1561,7 +1561,7 @@ var CandidateIndex = class {
1561
1561
  layer: "candidate-index",
1562
1562
  keyFingerprint: createCompilerValueFingerprint(sourceId),
1563
1563
  hit: addedCandidates.size === 0 && removedCandidates.size === 0,
1564
- invalidationReason: addedCandidates.size || removedCandidates.size ? "source-change" : void 0,
1564
+ ...addedCandidates.size || removedCandidates.size ? { invalidationReason: "source-change" } : {},
1565
1565
  entries: this.candidatesBySource.size,
1566
1566
  memoryBytes: [...this.candidatesBySource.values()].reduce((total, values) => total + values.size * 32, 0)
1567
1567
  });
@@ -2574,7 +2574,7 @@ const readonlySetValues = /* @__PURE__ */ new WeakMap();
2574
2574
  const snapshotRegistry = /* @__PURE__ */ new WeakMap();
2575
2575
  var ImmutableSetView = class {
2576
2576
  constructor(values) {
2577
- readonlySetValues.set(this, new Set(values));
2577
+ readonlySetValues.set(this, values instanceof Set ? values : new Set(values));
2578
2578
  Object.freeze(this);
2579
2579
  }
2580
2580
  get size() {
@@ -2619,29 +2619,32 @@ function uniqueSortedSources(sources) {
2619
2619
  }
2620
2620
  return Object.freeze([...values.entries()].sort(([left], [right]) => left.localeCompare(right)).map(([, value]) => value));
2621
2621
  }
2622
+ function createFingerprint(parts) {
2623
+ return md5Hash([...parts].join("\0"));
2624
+ }
2622
2625
  function createRootFingerprint(root, target, classSet, dependencies, sources) {
2623
- return [
2626
+ return createFingerprint([
2624
2627
  root.id,
2625
2628
  String(root.revision),
2626
2629
  target,
2627
2630
  ...[...classSet].sort(),
2628
2631
  ...dependencies,
2629
2632
  ...[...sources].map(sourceKey)
2630
- ].join("\0");
2633
+ ]);
2631
2634
  }
2632
2635
  function createSnapshotFromState(state, reusableClassSet, reusableClassSetView) {
2633
2636
  const roots = Object.freeze([...state.roots.values()].sort((left, right) => left.id.localeCompare(right.id)).map(({ id, revision }) => Object.freeze({
2634
2637
  id,
2635
2638
  revision
2636
2639
  })));
2637
- const classSet = reusableClassSet ?? new Set(state.classSet);
2638
- const fingerprint = [
2640
+ const classSet = reusableClassSet ?? (state.classSet instanceof Set ? state.classSet : new Set(state.classSet));
2641
+ const fingerprint = createFingerprint([
2639
2642
  state.target,
2640
2643
  ...[...state.roots.values()].map((root) => `${root.id}\0${root.revision}\0${root.fingerprint}`).sort(),
2641
2644
  ...[...classSet].sort(),
2642
2645
  ...state.dependencies,
2643
2646
  ...state.sources.map(sourceKey)
2644
- ].join("\0");
2647
+ ]);
2645
2648
  const snapshot = Object.freeze({
2646
2649
  classSet: reusableClassSetView ?? new ImmutableSetView(classSet),
2647
2650
  dependencies: state.dependencies,
@@ -2933,12 +2936,14 @@ async function collectTailwindV4GeneratorClassSet(tailwindRuntime) {
2933
2936
  if (typeof tailwindRuntime.collectContentTokens !== "function") return;
2934
2937
  try {
2935
2938
  const source = resolveCssMacroTailwindV4Source(await resolveTailwindV4SourceFromRuntime(tailwindRuntime));
2939
+ const bareArbitraryValues = resolveRuntimeBareArbitraryValues(tailwindRuntime.options);
2936
2940
  const generated = await createTailwindV4Engine$1(source).generate({
2941
+ ...bareArbitraryValues === void 0 ? {} : { bareArbitraryValues },
2937
2942
  scanSources: true,
2938
2943
  target: "web"
2939
2944
  });
2940
2945
  const designSystem = await loadTailwindV4DesignSystem(source);
2941
- const classSet = resolveValidTailwindV4Candidates$1(designSystem, generated.classSet, { ...source.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: source.bareArbitraryValues } });
2946
+ const classSet = resolveValidTailwindV4Candidates$1(designSystem, generated.classSet, { ...bareArbitraryValues === void 0 ? {} : { bareArbitraryValues } });
2942
2947
  debug("runtime class set resolved via tailwindcss v4 generator source scan, raw=%d valid=%d", generated.classSet.size, classSet.size);
2943
2948
  return classSet;
2944
2949
  } catch (error) {
@@ -4199,10 +4204,10 @@ function syncLegacyFieldsToCssOptions(ctx) {
4199
4204
  }
4200
4205
  function applyFrameworkPlatformDefaults(ctx) {
4201
4206
  if (ctx.cssOptions?.platform || ctx.platform) {
4202
- ctx.platform = normalizeFrameworkStylePlatform(ctx.cssOptions?.platform ?? ctx.platform, ctx.appType);
4207
+ ctx.platform = normalizeFrameworkStylePlatform(ctx.cssOptions?.platform ?? ctx.platform, ctx.appType) ?? ctx.platform;
4203
4208
  return;
4204
4209
  }
4205
- if (ctx.appType === "mpx") ctx.platform = normalizeFrameworkStylePlatform(resolveMpxPlatform().normalized, ctx.appType);
4210
+ if (ctx.appType === "mpx") ctx.platform = normalizeFrameworkStylePlatform(resolveMpxPlatform().normalized, ctx.appType) ?? ctx.platform;
4206
4211
  }
4207
4212
  async function clearTailwindcssRuntimeCache(tailwindRuntime, options) {
4208
4213
  if (!tailwindRuntime) return;
@@ -4218,7 +4223,7 @@ async function clearTailwindcssRuntimeCache(tailwindRuntime, options) {
4218
4223
  const normalizedCacheOptions = typeof cacheOptions === "object" ? cacheOptions : void 0;
4219
4224
  const privateCachePath = tailwindRuntime?.cacheStore?.options?.path;
4220
4225
  if (privateCachePath) cachePaths.set(privateCachePath, false);
4221
- if (normalizedCacheOptions?.path) cachePaths.set(normalizedCacheOptions.path, false);
4226
+ if (normalizedCacheOptions && "path" in normalizedCacheOptions && typeof normalizedCacheOptions.path === "string") cachePaths.set(normalizedCacheOptions.path, false);
4222
4227
  if (options?.removeDirectory && normalizedCacheOptions?.dir) cachePaths.set(normalizedCacheOptions.dir, true);
4223
4228
  if (!cachePaths.size) return;
4224
4229
  for (const [cachePath, recursive] of cachePaths.entries()) try {
@@ -4306,8 +4311,11 @@ function resolveCssTransformOptions(options) {
4306
4311
  };
4307
4312
  }
4308
4313
  function finalizeResultRoot(result, snapshot, shouldFinalize) {
4309
- if (!shouldFinalize || result.root.type !== "root") return;
4310
- finalizeMiniProgramCssRoot(result.root, { isTailwindcssV4: snapshot.target === "weapp" });
4314
+ if (!shouldFinalize) return;
4315
+ if (result.root.type === "root") finalizeMiniProgramCssRoot(result.root, { isTailwindcssV4: snapshot.target === "weapp" });
4316
+ if (snapshot.target === "weapp") result.root.walkComments((comment) => {
4317
+ if (/^!\s*tailwindcss v/i.test(comment.text)) comment.remove();
4318
+ });
4311
4319
  result.css = result.root.toString();
4312
4320
  }
4313
4321
  function createCompilerTransforms({ ensureActive, track, userOptions }) {
@@ -4429,19 +4437,20 @@ function createCompiler(options = {}) {
4429
4437
  const prepared = prepareCompilerGeneration(entry, request, source, !sourceReused || entry.appliedInvalidation !== invalidation);
4430
4438
  const generationCacheKey = createCompilerGenerationCacheKey(request, prepared.compilation.candidates, target);
4431
4439
  const reusableGeneration = engineReused && entry.generationCache && isSameCompilerGenerationCacheKey(entry.generationCache.key, generationCacheKey) ? entry.generationCache.result : void 0;
4440
+ const latestRevision = getLatestRevision(entry);
4432
4441
  cacheTelemetry?.record({
4433
4442
  layer: "tailwind-generation",
4434
4443
  keyFingerprint: generationCacheKey.candidateSignature,
4435
4444
  hit: reusableGeneration !== void 0,
4436
- invalidationReason: reusableGeneration === void 0 && !engineReused ? "source-change" : void 0,
4445
+ ...reusableGeneration === void 0 && !engineReused ? { invalidationReason: "source-change" } : {},
4437
4446
  entries: entry.generationCache ? 1 : 0,
4438
- revision: getLatestRevision(entry),
4447
+ ...latestRevision === void 0 ? {} : { revision: latestRevision },
4439
4448
  operationId: entry.id
4440
4449
  });
4441
4450
  try {
4442
4451
  const generated = reusableGeneration ? reuseCompilerGenerationResult(reusableGeneration) : await generator.generate({
4443
4452
  ...generateOptions,
4444
- candidates: prepared.explicitCandidates ? prepared.compilation.candidates : void 0,
4453
+ ...prepared.explicitCandidates ? { candidates: prepared.compilation.candidates } : {},
4445
4454
  incrementalCache: generateOptions.incrementalCache ?? true,
4446
4455
  target: target === "tailwind" ? "web" : target
4447
4456
  });
@@ -4869,10 +4878,10 @@ function createJsRuntimeAffectingSignature(source) {
4869
4878
  const stack = [ast];
4870
4879
  while (stack.length > 0) {
4871
4880
  const node = stack.pop();
4872
- if (node.type === "StringLiteral" && typeof node.value === "string") parts.push(`s:${node.value}`);
4873
- else if (node.type === "TemplateElement" && node.value && typeof node.value === "object" && "raw" in node.value && typeof node.value.raw === "string") parts.push(`t:${node.value.raw}`);
4874
- else if (node.type === "JSXText" && typeof node.value === "string") {
4875
- const value = node.value.trim();
4881
+ if (node.type === "StringLiteral" && typeof node["value"] === "string") parts.push(`s:${node["value"]}`);
4882
+ else if (node.type === "TemplateElement" && node["value"] && typeof node["value"] === "object" && "raw" in node["value"] && typeof node["value"].raw === "string") parts.push(`t:${node["value"].raw}`);
4883
+ else if (node.type === "JSXText" && typeof node["value"] === "string") {
4884
+ const value = node["value"].trim();
4876
4885
  if (value.length > 0) parts.push(`x:${value}`);
4877
4886
  }
4878
4887
  const children = [];
@@ -8,7 +8,7 @@ interface CreateCompilerTransformsOptions {
8
8
  export declare function createCompilerTransforms({ ensureActive, track, userOptions }: CreateCompilerTransformsOptions): {
9
9
  clearCache: () => void;
10
10
  transformCss: (css: string, snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformCss"]>[2]) => Promise<import("postcss").Result<import("postcss").Document | import("postcss").Root>>;
11
- transformCssRoot: (root: Parameters<Compiler["transformCssRoot"]>[0], snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformCssRoot"]>[2]) => Promise<import("postcss").Result<import("postcss").Document | import("postcss").Root>>;
11
+ transformCssRoot: (root: Parameters<Compiler["transformCssRoot"]>[0], snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformCssRoot"]>[2]) => Promise<import("postcss").Result<import("postcss").Root>>;
12
12
  transformJavaScript: (source: string, snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformJavaScript"]>[2]) => Promise<import("../../types/index.js").JsHandlerResult>;
13
13
  transformTemplate: (source: string, snapshot: CompilerSnapshot, options?: Parameters<Compiler["transformTemplate"]>[2]) => Promise<string>;
14
14
  };
package/dist/core.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_compiler = require("./compiler-DFROuh5Z.cjs");
2
+ const require_compiler = require("./compiler-C8FqI-P3.cjs");
3
3
  const require_runtime_state = require("./runtime-state-XYSycuGu.cjs");
4
4
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
5
5
  let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
@@ -43,10 +43,10 @@ function createContext(options = {}) {
43
43
  revision: runtimeState.revision,
44
44
  operationId,
45
45
  durationMs: node_perf_hooks.performance.now() - startedAt,
46
- error: error ? {
47
- name: error instanceof Error ? error.name : void 0,
46
+ ...error ? { error: {
47
+ ...error instanceof Error ? { name: error.name } : {},
48
48
  message: error instanceof Error ? error.message : String(error)
49
- } : void 0
49
+ } } : {}
50
50
  });
51
51
  }
52
52
  function getDefaultJsHandlerOptions(majorVersion = runtimeState.tailwindRuntime.majorVersion) {
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as createTailwindRuntimeReadyPromise, D as createCompilationEventBus, d as createCompiler, f as getCompilerContext, t as createCompilerRuntimeState, v as shouldSkipJsTransform, w as ensureRuntimeClassSet } from "./compiler-CJ5yX-on.js";
1
+ import { C as createTailwindRuntimeReadyPromise, D as createCompilationEventBus, d as createCompiler, f as getCompilerContext, t as createCompilerRuntimeState, v as shouldSkipJsTransform, w as ensureRuntimeClassSet } from "./compiler-D3GBwxoa.js";
2
2
  import { finalizeMiniProgramCss, finalizeMiniProgramCssRoot, postcss, removeTailwindSourceDirectivesRoot } from "@weapp-tailwindcss/postcss";
3
3
  import { defuOverrideArray } from "@weapp-tailwindcss/shared";
4
4
  import { performance } from "node:perf_hooks";
@@ -41,10 +41,10 @@ function createContext(options = {}) {
41
41
  revision: runtimeState.revision,
42
42
  operationId,
43
43
  durationMs: performance.now() - startedAt,
44
- error: error ? {
45
- name: error instanceof Error ? error.name : void 0,
44
+ ...error ? { error: {
45
+ ...error instanceof Error ? { name: error.name } : {},
46
46
  message: error instanceof Error ? error.message : String(error)
47
- } : void 0
47
+ } } : {}
48
48
  });
49
49
  }
50
50
  function getDefaultJsHandlerOptions(majorVersion = runtimeState.tailwindRuntime.majorVersion) {
@@ -1,5 +1,4 @@
1
1
  const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
- const require_generator = require("./generator-RK2HtgOb.cjs");
3
2
  let node_path = require("node:path");
4
3
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
5
4
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
@@ -12,7 +11,7 @@ function normalizeResolvedTailwindcssImports(code, pkgDir) {
12
11
  const root = _weapp_tailwindcss_postcss.postcss.parse(code);
13
12
  let changed = false;
14
13
  root.walkAtRules("import", (rule) => {
15
- const parsed = require_generator.parseCssImportSpecifier(rule.params);
14
+ const parsed = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(rule.params);
16
15
  if (!parsed || !paths.isAbsolute(parsed.specifier)) return;
17
16
  const subpath = paths.relative(pkgDir, parsed.specifier);
18
17
  if (![
@@ -22,7 +21,7 @@ function normalizeResolvedTailwindcssImports(code, pkgDir) {
22
21
  "preflight.css"
23
22
  ].includes(subpath)) return;
24
23
  const request = subpath === "index.css" ? "tailwindcss" : `tailwindcss/${subpath}`;
25
- rule.params = rule.params.replace(parsed.raw, () => require_generator.quoteCssImportSpecifier(request, parsed.quote));
24
+ rule.params = rule.params.replace(parsed.raw, () => (0, _weapp_tailwindcss_postcss.quoteCssImportSpecifier)(request, parsed.quote));
26
25
  changed = true;
27
26
  });
28
27
  return changed ? root.toString() : code;
@@ -55,7 +55,7 @@ const cssMacro = require_auto.markCssMacroPlugin(((options) => {
55
55
  }));
56
56
  const cssMacroOptionsFunction = cssMacro;
57
57
  const cssMacroFactoryOptionsFunction = cssMacroFactory;
58
- cssMacroOptionsFunction.__isOptionsFunction = cssMacroFactoryOptionsFunction.__isOptionsFunction;
58
+ if (cssMacroFactoryOptionsFunction.__isOptionsFunction !== void 0) cssMacroOptionsFunction.__isOptionsFunction = cssMacroFactoryOptionsFunction.__isOptionsFunction;
59
59
  cssMacroOptionsFunction.__pluginFunction = cssMacroFactoryOptionsFunction.__pluginFunction;
60
60
  cssMacroOptionsFunction.__configFunction = cssMacroFactoryOptionsFunction.__configFunction;
61
61
  //#endregion
package/dist/css-macro.js CHANGED
@@ -52,7 +52,7 @@ const cssMacro = markCssMacroPlugin(((options) => {
52
52
  }));
53
53
  const cssMacroOptionsFunction = cssMacro;
54
54
  const cssMacroFactoryOptionsFunction = cssMacroFactory;
55
- cssMacroOptionsFunction.__isOptionsFunction = cssMacroFactoryOptionsFunction.__isOptionsFunction;
55
+ if (cssMacroFactoryOptionsFunction.__isOptionsFunction !== void 0) cssMacroOptionsFunction.__isOptionsFunction = cssMacroFactoryOptionsFunction.__isOptionsFunction;
56
56
  cssMacroOptionsFunction.__pluginFunction = cssMacroFactoryOptionsFunction.__pluginFunction;
57
57
  cssMacroOptionsFunction.__configFunction = cssMacroFactoryOptionsFunction.__configFunction;
58
58
  //#endregion
@@ -5,8 +5,8 @@ const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
5
5
  const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
6
6
  //#endregion
7
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|qx|ty|xhs)ml|swan)$/;
8
+ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty|dd)ss$/;
9
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|qx|ty|xhs|dd)ml|swan)$/;
10
10
  const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
11
11
  const alwaysFalse = () => false;
12
12
  const TAILWIND_V4_CSS_PREFLIGHT = {
@@ -35,6 +35,7 @@ function getDefaultOptions() {
35
35
  * qss QQ小程序
36
36
  * css 最正常的样式文件
37
37
  * tyss 涂鸦小程序
38
+ * ddss 钉钉小程序
38
39
  */
39
40
  cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
40
41
  /**
@@ -47,6 +48,7 @@ function getDefaultOptions() {
47
48
  * tyml 涂鸦小程序
48
49
  * xhsml 小红书小程序
49
50
  * swan 百度小程序
51
+ * ddml 钉钉小程序
50
52
  */
51
53
  htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
52
54
  jsMatcher: (file) => {
@@ -6,8 +6,8 @@ const DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH = 5e4;
6
6
  const HARD_PARSE_CACHE_MAX_ENTRIES = 1024;
7
7
  //#endregion
8
8
  //#region src/defaults.ts
9
- const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty)ss$/;
10
- const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|qx|ty|xhs)ml|swan)$/;
9
+ const CSS_FILE_PATTERN = /.+\.(?:wx|ac|jx|tt|q|c|ty|dd)ss$/;
10
+ const HTML_FILE_PATTERN = /.+\.(?:(?:wx|ax|jx|ks|tt|q|qx|ty|xhs|dd)ml|swan)$/;
11
11
  const JS_FILE_PATTERN = /.+\.[cm]?js?$/;
12
12
  const alwaysFalse = () => false;
13
13
  const TAILWIND_V4_CSS_PREFLIGHT = {
@@ -36,6 +36,7 @@ function getDefaultOptions() {
36
36
  * qss QQ小程序
37
37
  * css 最正常的样式文件
38
38
  * tyss 涂鸦小程序
39
+ * ddss 钉钉小程序
39
40
  */
40
41
  cssMatcher: (file) => CSS_FILE_PATTERN.test(file),
41
42
  /**
@@ -48,6 +49,7 @@ function getDefaultOptions() {
48
49
  * tyml 涂鸦小程序
49
50
  * xhsml 小红书小程序
50
51
  * swan 百度小程序
52
+ * ddml 钉钉小程序
51
53
  */
52
54
  htmlMatcher: (file) => HTML_FILE_PATTERN.test(file),
53
55
  jsMatcher: (file) => {
package/dist/defaults.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_defaults = require("./defaults-CiGsr8Xq.cjs");
2
+ const require_defaults = require("./defaults-CyX5iO9y.cjs");
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;
package/dist/defaults.js CHANGED
@@ -1,2 +1,2 @@
1
- import { i as resolveDefaultCssPreflight, n as getDefaultCssPreflight, r as getDefaultOptions, t as TAILWIND_V4_CSS_PREFLIGHT } from "./defaults-CKx-4LcW.js";
1
+ import { i as resolveDefaultCssPreflight, n as getDefaultCssPreflight, r as getDefaultOptions, t as TAILWIND_V4_CSS_PREFLIGHT } from "./defaults-AQuvJS-h.js";
2
2
  export { TAILWIND_V4_CSS_PREFLIGHT, getDefaultCssPreflight, getDefaultOptions, resolveDefaultCssPreflight };
@@ -0,0 +1 @@
1
+ require("@weapp-tailwindcss/postcss");
@@ -1,4 +1,4 @@
1
- import { postcss, removeEmptyAtRules, removeEmptyRules, repairTrailingUnclosedTailwindSourceMedia } from "@weapp-tailwindcss/postcss";
1
+ import { finalizeMiniProgramCssStructure, hasEmptyCssBlockCandidate } from "@weapp-tailwindcss/postcss";
2
2
  //#region src/compiler/runtime-build-state.ts
3
3
  function invertLinkedByEntry(linkedByEntry) {
4
4
  const dependentsByLinkedFile = /* @__PURE__ */ new Map();
@@ -180,129 +180,4 @@ async function processCachedTask({ cache, cacheKey, hashKey = cacheKey, rawSourc
180
180
  if (!cacheHit) await applyResult(result, { cacheHit: false });
181
181
  }
182
182
  //#endregion
183
- //#region src/bundlers/shared/final-css-cleanup.ts
184
- function isCssWhitespace(code) {
185
- return code === 9 || code === 10 || code === 12 || code === 13 || code === 32;
186
- }
187
- function isCssWordChar(code) {
188
- return code >= 48 && code <= 57 || code >= 65 && code <= 90 || code >= 97 && code <= 122 || code === 95;
189
- }
190
- const EMPTY_CSS_BLOCK_RE = /\{(?:[\t\n\f\r ]|\/\*(?:[^*]|\*(?!\/))*\*\/)*\}/;
191
- function findCssPreludeStart(css, start, end) {
192
- let cursor = start;
193
- while (cursor < end) {
194
- while (cursor < end && isCssWhitespace(css.charCodeAt(cursor))) cursor++;
195
- if (css.charCodeAt(cursor) !== 47 || css.charCodeAt(cursor + 1) !== 42) return cursor;
196
- const commentEnd = css.indexOf("*/", cursor + 2);
197
- if (commentEnd < 0 || commentEnd + 2 > end) return end;
198
- cursor = commentEnd + 2;
199
- }
200
- return end;
201
- }
202
- function isKeyframesAtRule(css, start, end) {
203
- let cursor = start + 1;
204
- if (css.charCodeAt(cursor) === 45) {
205
- cursor++;
206
- const prefixStart = cursor;
207
- while (cursor < end && isCssWordChar(css.charCodeAt(cursor))) cursor++;
208
- if (cursor === prefixStart || css.charCodeAt(cursor) !== 45) return false;
209
- cursor++;
210
- }
211
- if (cursor + 9 > end || css.slice(cursor, cursor + 9).toLowerCase() !== "keyframes") return false;
212
- return !isCssWordChar(css.charCodeAt(cursor + 9));
213
- }
214
- function hasEmptyCssBlockCandidate(css) {
215
- if (!EMPTY_CSS_BLOCK_RE.test(css)) return false;
216
- const blocks = [];
217
- let parenthesisDepth = 0;
218
- let quote = 0;
219
- let squareBracketDepth = 0;
220
- let statementStart = 0;
221
- for (let index = 0; index < css.length; index++) {
222
- const code = css.charCodeAt(index);
223
- if (quote !== 0) {
224
- if (code === 92) index++;
225
- else if (code === quote) quote = 0;
226
- continue;
227
- }
228
- if (code === 34 || code === 39) {
229
- quote = code;
230
- if (blocks.length > 0) blocks[blocks.length - 1].hasContent = true;
231
- continue;
232
- }
233
- if (code === 92) {
234
- if (blocks.length > 0) blocks[blocks.length - 1].hasContent = true;
235
- index++;
236
- continue;
237
- }
238
- if (code === 47 && css.charCodeAt(index + 1) === 42) {
239
- const commentEnd = css.indexOf("*/", index + 2);
240
- if (commentEnd < 0) return false;
241
- index = commentEnd + 1;
242
- continue;
243
- }
244
- if (code === 40) {
245
- parenthesisDepth++;
246
- continue;
247
- }
248
- if (code === 41 && parenthesisDepth > 0) {
249
- parenthesisDepth--;
250
- continue;
251
- }
252
- if (code === 91) {
253
- squareBracketDepth++;
254
- continue;
255
- }
256
- if (code === 93 && squareBracketDepth > 0) {
257
- squareBracketDepth--;
258
- continue;
259
- }
260
- if (code === 123 && parenthesisDepth === 0 && squareBracketDepth === 0) {
261
- const preludeStart = findCssPreludeStart(css, statementStart, index);
262
- const isAtRule = css.charCodeAt(preludeStart) === 64;
263
- const isKeyframesContainer = isAtRule && isKeyframesAtRule(css, preludeStart, index);
264
- blocks.push({
265
- hasContent: false,
266
- isKeyframesContainer,
267
- isKeyframeStep: !isAtRule && blocks[blocks.length - 1]?.isKeyframesContainer === true
268
- });
269
- statementStart = index + 1;
270
- continue;
271
- }
272
- if (code === 125 && parenthesisDepth === 0 && squareBracketDepth === 0) {
273
- const block = blocks.pop();
274
- if (!block) continue;
275
- if (!block.hasContent && !block.isKeyframeStep) return true;
276
- if (blocks.length > 0) blocks[blocks.length - 1].hasContent = true;
277
- statementStart = index + 1;
278
- continue;
279
- }
280
- if (code === 59 && parenthesisDepth === 0 && squareBracketDepth === 0) {
281
- statementStart = index + 1;
282
- continue;
283
- }
284
- if (!isCssWhitespace(code) && blocks.length > 0) blocks[blocks.length - 1].hasContent = true;
285
- }
286
- return false;
287
- }
288
- /**
289
- * 在小程序样式进入最终产物图时递归清理无语义的空 CSS 块。
290
- */
291
- function finalizeMiniProgramCssStructure(css) {
292
- const repaired = repairTrailingUnclosedTailwindSourceMedia(css);
293
- if (!hasEmptyCssBlockCandidate(repaired)) return repaired;
294
- try {
295
- const root = postcss.parse(repaired);
296
- let removed = 0;
297
- let passRemoved = 0;
298
- do {
299
- passRemoved = removeEmptyRules(root) + removeEmptyAtRules(root);
300
- removed += passRemoved;
301
- } while (passRemoved > 0);
302
- return removed > 0 ? root.toString() : repaired;
303
- } catch {
304
- return repaired;
305
- }
306
- }
307
- //#endregion
308
183
  export { createRuntimeCompilationAffectingSignature as a, resetRuntimeCompilationBuildState as c, buildRuntimeCompilationSnapshot as i, updateRuntimeCompilationBuildState as l, hasEmptyCssBlockCandidate as n, createRuntimeCompilationBuildState as o, processCachedTask as r, removeRuntimeCompilationBuildStateFiles as s, finalizeMiniProgramCssStructure as t };
@@ -1,5 +1,5 @@
1
1
  export type DetectableAppType = 'mpx' | 'taro' | 'uni-app' | 'uni-app-vite' | 'uni-app-x' | 'weapp-vite';
2
- export type FrameworkEnv = Partial<Record<'MPX_CLI_MODE' | 'MPX_CURRENT_TARGET_MODE' | 'NODE_PATH' | 'TARO_ENV' | 'UNI_PLATFORM' | 'UNI_UTS_PLATFORM' | 'WEAPP_TAILWINDCSS_TARGET' | 'WEAPP_TW_TARGET', string | undefined>>;
2
+ export type FrameworkEnv = Record<string, string | undefined> & Partial<Record<'MPX_CLI_MODE' | 'MPX_CURRENT_TARGET_MODE' | 'NODE_PATH' | 'TARO_ENV' | 'UNI_PLATFORM' | 'UNI_UTS_PLATFORM' | 'WEAPP_TAILWINDCSS_TARGET' | 'WEAPP_TW_TARGET', string | undefined>>;
3
3
  export interface UniPlatformInfo {
4
4
  raw: string | undefined;
5
5
  normalized: string | undefined;
@@ -1,2 +1,2 @@
1
- import type { DetectableAppType } from './index.js';
2
- export declare function normalizeFrameworkStylePlatform(platform: string | undefined, appType: DetectableAppType | undefined): string | undefined;
1
+ import type { AppType } from '../types/index.js';
2
+ export declare function normalizeFrameworkStylePlatform(platform: string | undefined, appType: AppType | undefined): string | undefined;