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

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 (53) hide show
  1. package/dist/{bundle-state-BlXvU4jl.js → bundle-state-BnV8o2Yn.js} +1 -1
  2. package/dist/{bundle-state-PO6MysTJ.mjs → bundle-state-CLnuf2CW.mjs} +1 -1
  3. package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
  4. package/dist/bundlers/shared/css-cleanup.d.ts +1 -8
  5. package/dist/core.js +1 -1
  6. package/dist/core.mjs +1 -1
  7. package/dist/{generator-N4jy1HCk.js → generator-CV_APjnB.js} +33 -5
  8. package/dist/generator-DPX8vA2P.mjs +58 -0
  9. package/dist/generator.js +2 -2
  10. package/dist/generator.mjs +2 -2
  11. package/dist/gulp.js +5 -5
  12. package/dist/gulp.mjs +5 -5
  13. package/dist/{incremental-runtime-class-set-CJ0Pnsw2.js → incremental-runtime-class-set-C6akmwlk.js} +11 -433
  14. package/dist/{incremental-runtime-class-set-hF-uiw6W.mjs → incremental-runtime-class-set-Cwpw6aZK.mjs} +5 -427
  15. package/dist/index.js +4 -4
  16. package/dist/index.mjs +4 -4
  17. package/dist/{postcss-DlY-YRvA.js → postcss-Csaggbm7.js} +2 -2
  18. package/dist/{postcss-D4UdbBQ6.mjs → postcss-ioX7S9x5.mjs} +2 -2
  19. package/dist/postcss.js +1 -1
  20. package/dist/postcss.mjs +1 -1
  21. package/dist/{precheck-BjEbVEpX.js → precheck-8pQbjqpq.js} +2 -2
  22. package/dist/{precheck-tbk626YL.mjs → precheck-D1O5AWzy.mjs} +2 -2
  23. package/dist/presets.js +2 -2
  24. package/dist/presets.mjs +2 -2
  25. package/dist/{runtime-registry-D5qnaSpo.js → runtime-registry-CdCV3Opt.js} +0 -20
  26. package/dist/{source-candidates-gxijpPI3.js → source-candidates-CUTNdsiz.js} +1 -1
  27. package/dist/{source-candidates-BrvneDDd.mjs → source-candidates-CnD4vyic.mjs} +1 -1
  28. package/dist/tailwindcss/miniprogram.d.ts +1 -5
  29. package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
  30. package/dist/{tailwindcss-c6ROlNNW.mjs → tailwindcss-B_JAdOQf.mjs} +1 -1
  31. package/dist/{tailwindcss-BhG7BtB-.js → tailwindcss-whZE3HpL.js} +1 -1
  32. package/dist/{v3-engine-5LoZUH-4.js → v3-engine-CCwvhRrQ.js} +2 -224
  33. package/dist/{v3-engine-DIXDEDmL.mjs → v3-engine-DyIcbpZm.mjs} +2 -218
  34. package/dist/{vite-B5faZcbE.mjs → vite-BcXuBYy3.mjs} +7 -7
  35. package/dist/{vite-MyXBNux0.js → vite-k4Nlk42j.js} +7 -7
  36. package/dist/vite.js +1 -1
  37. package/dist/vite.mjs +1 -1
  38. package/dist/weapp-tw-css-import-rewrite-loader.js +42 -641
  39. package/dist/weapp-tw-runtime-classset-loader.js +3 -2
  40. package/dist/{webpack-BnVyDmsD.mjs → webpack-C4pViZ7V.mjs} +5 -5
  41. package/dist/{webpack-Mz1V0A9p.js → webpack-DC7v6ylA.js} +5 -5
  42. package/dist/webpack.js +1 -1
  43. package/dist/webpack.mjs +1 -1
  44. package/package.json +7 -7
  45. package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
  46. package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -5
  47. package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
  48. package/dist/generator-DIuglJub.mjs +0 -32
  49. package/dist/lightningcss/index.d.ts +0 -8
  50. package/dist/lightningcss/style-handler/options.d.ts +0 -3
  51. package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
  52. package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
  53. package/dist/lightningcss/style-handler.d.ts +0 -17
@@ -1,13 +1,13 @@
1
- import { D as filterUnsupportedMiniProgramTailwindV4Candidates, E as removeUnsupportedCascadeLayers, K as omitUndefined, O as loadTailwindV4DesignSystem, S as resolveTailwindV4SourceOptionsFromPatcher, V as createDebug, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1, z as resolveTailwindV4CssSourceBase } from "./v3-engine-DIXDEDmL.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-DIuglJub.mjs";
3
- import { l as replaceWxml } from "./precheck-tbk626YL.mjs";
4
- import { i as resolveUniAppXOptions } from "./tailwindcss-c6ROlNNW.mjs";
1
+ import { B as createDebug, D as loadTailwindV4DesignSystem, E as filterUnsupportedMiniProgramTailwindV4Candidates, G as omitUndefined, R as resolveTailwindV4CssSourceBase, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-DyIcbpZm.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-DPX8vA2P.mjs";
3
+ import { l as replaceWxml } from "./precheck-D1O5AWzy.mjs";
4
+ import { i as resolveUniAppXOptions } from "./tailwindcss-B_JAdOQf.mjs";
5
5
  import { existsSync, readFileSync } from "node:fs";
6
6
  import postcss from "postcss";
7
7
  import path from "node:path";
8
8
  import process from "node:process";
9
9
  import { extractRawCandidatesWithPositions, extractValidCandidates } from "tailwindcss-patch";
10
- import { normalizeMiniProgramPrefixedDeclaration, normalizeModernColorValue, removeUnsupportedMiniProgramPrefixedAtRule } from "@weapp-tailwindcss/postcss";
10
+ import { finalizeMiniProgramCss, removeUnsupportedMiniProgramAtRules } from "@weapp-tailwindcss/postcss";
11
11
  //#region src/bundlers/shared/generator-css/markers.ts
12
12
  const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
13
13
  const TAILWIND_GENERATED_CSS_MARKER_RE = /\/\*!\s*tailwindcss v|@property\s+--tw-|--tw-|:not\(#\\#\)|\.[^,{]*(?:\\:|\\\[|\\#)|(?::host|page|\.tw-root|wx-root-portal-content)[^{]*\{[^}]*--(?:color|spacing|text|font-weight|radius)-/;
@@ -374,428 +374,6 @@ async function processCachedTask({ cache, cacheKey, hashKey = cacheKey, rawSourc
374
374
  if (!cacheHit) await applyResult(result);
375
375
  }
376
376
  //#endregion
377
- //#region src/bundlers/shared/css-cleanup/at-rules.ts
378
- const MINI_PROGRAM_UNSUPPORTED_AT_RULES = new Set(["property", "supports"]);
379
- function removeAtRulesByScan(css, names) {
380
- let index = 0;
381
- let result = "";
382
- const atRulePattern = new RegExp(`@(?:${[...names].join("|")})\\b`, "i");
383
- while (index < css.length) {
384
- const match = atRulePattern.exec(css.slice(index));
385
- if (!match || match.index === void 0) {
386
- result += css.slice(index);
387
- break;
388
- }
389
- const start = index + match.index;
390
- result += css.slice(index, start);
391
- const blockStart = css.indexOf("{", start);
392
- if (blockStart === -1) {
393
- result += css.slice(start);
394
- break;
395
- }
396
- let depth = 0;
397
- let cursor = blockStart;
398
- for (; cursor < css.length; cursor++) {
399
- const char = css[cursor];
400
- if (char === "{") depth++;
401
- else if (char === "}") {
402
- depth--;
403
- if (depth === 0) {
404
- cursor++;
405
- break;
406
- }
407
- }
408
- }
409
- index = cursor;
410
- }
411
- return result;
412
- }
413
- function removeUnsupportedMiniProgramAtRules(css) {
414
- try {
415
- const root = postcss.parse(css);
416
- root.walkAtRules((atRule) => {
417
- if (MINI_PROGRAM_UNSUPPORTED_AT_RULES.has(atRule.name)) atRule.remove();
418
- });
419
- root.walkAtRules((atRule) => {
420
- if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
421
- });
422
- return root.toString();
423
- } catch {
424
- return removeAtRulesByScan(css, MINI_PROGRAM_UNSUPPORTED_AT_RULES);
425
- }
426
- }
427
- //#endregion
428
- //#region src/bundlers/shared/css-cleanup/color-gamut.ts
429
- const DISPLAY_P3_VALUE_RE = /color\(\s*display-p3\b/i;
430
- const COLOR_GAMUT_P3_RE = /\(\s*color-gamut\s*:\s*p3\s*\)/i;
431
- function isDisplayP3MediaRule(atRule) {
432
- return atRule.name === "media" && COLOR_GAMUT_P3_RE.test(atRule.params);
433
- }
434
- function isDisplayP3Declaration(decl) {
435
- return DISPLAY_P3_VALUE_RE.test(decl.value);
436
- }
437
- //#endregion
438
- //#region src/bundlers/shared/css-cleanup/selectors.ts
439
- const MINI_PROGRAM_THEME_SCOPE_SELECTOR = ":host,page,.tw-root,wx-root-portal-content";
440
- const MINI_PROGRAM_PREFLIGHT_SELECTORS = new Set([
441
- "*",
442
- "view",
443
- "text",
444
- ":before",
445
- ":after",
446
- "::before",
447
- "::after"
448
- ]);
449
- const MINI_PROGRAM_THEME_SCOPE_SELECTORS$1 = new Set([
450
- ":host",
451
- ":root",
452
- "page",
453
- ".tw-root",
454
- "wx-root-portal-content"
455
- ]);
456
- const SPECIFICITY_PLACEHOLDER_SUFFIXES = [":not(#n)", ":not(#\\#)"];
457
- const MINI_PROGRAM_UNSUPPORTED_BROWSER_SELECTORS = new Set([
458
- ":-moz-focusring",
459
- ":-moz-ui-invalid",
460
- "::-webkit-calendar-picker-indicator",
461
- "::-webkit-date-and-time-value",
462
- "::-webkit-datetime-edit",
463
- "::-webkit-datetime-edit-day-field",
464
- "::-webkit-datetime-edit-fields-wrapper",
465
- "::-webkit-datetime-edit-hour-field",
466
- "::-webkit-datetime-edit-meridiem-field",
467
- "::-webkit-datetime-edit-millisecond-field",
468
- "::-webkit-datetime-edit-minute-field",
469
- "::-webkit-datetime-edit-month-field",
470
- "::-webkit-datetime-edit-second-field",
471
- "::-webkit-datetime-edit-year-field",
472
- "::-webkit-inner-spin-button",
473
- "::-webkit-input-placeholder",
474
- "::-webkit-outer-spin-button",
475
- "::-webkit-search-decoration",
476
- "::placeholder",
477
- "[hidden]:where(:not([hidden='until-found']))"
478
- ]);
479
- const MINI_PROGRAM_UNSUPPORTED_BROWSER_TAG_SELECTORS = new Set([
480
- "a",
481
- "abbr:where([title])",
482
- "audio",
483
- "b",
484
- "button",
485
- "canvas",
486
- "code",
487
- "embed",
488
- "h1",
489
- "h2",
490
- "h3",
491
- "h4",
492
- "h5",
493
- "h6",
494
- "hr",
495
- "html",
496
- "iframe",
497
- "img",
498
- "input",
499
- "input:where([type='button'],[type='reset'],[type='submit'])",
500
- "kbd",
501
- "menu",
502
- "object",
503
- "ol",
504
- "optgroup",
505
- "pre",
506
- "progress",
507
- "samp",
508
- "select",
509
- "select[multiple]optgroup",
510
- "select[multiple]optgroupoption",
511
- "select[size]optgroup",
512
- "select[size]optgroupoption",
513
- "small",
514
- "strong",
515
- "sub",
516
- "summary",
517
- "sup",
518
- "svg",
519
- "table",
520
- "textarea",
521
- "ul",
522
- "video"
523
- ]);
524
- function normalizeSelector(selector) {
525
- return selector.trim().replace(/\s+/g, "");
526
- }
527
- function getRuleSelectors(rule) {
528
- return rule.selector.split(",").map(normalizeSelector).filter(Boolean);
529
- }
530
- function isUnsupportedBrowserSelector(selector) {
531
- const normalized = normalizeSelector(selector);
532
- return MINI_PROGRAM_UNSUPPORTED_BROWSER_SELECTORS.has(normalized) || MINI_PROGRAM_UNSUPPORTED_BROWSER_TAG_SELECTORS.has(normalized);
533
- }
534
- //#endregion
535
- //#region src/bundlers/shared/css-cleanup/root-cleanups.ts
536
- function removeSpecificityPlaceholders(root) {
537
- root.walkRules((rule) => {
538
- if (!rule.selectors || rule.selectors.length === 0) return;
539
- let changed = false;
540
- const selectors = rule.selectors.map((selector) => {
541
- let next = selector;
542
- for (const suffix of SPECIFICITY_PLACEHOLDER_SUFFIXES) if (next.includes(suffix)) next = next.split(suffix).join("");
543
- if (next !== selector) changed = true;
544
- return next;
545
- });
546
- if (changed) rule.selectors = selectors;
547
- });
548
- }
549
- function removeEmptyAtRuleAncestors(parent) {
550
- while (parent?.type === "atrule" && (!parent.nodes || parent.nodes.length === 0)) {
551
- const nextParent = parent.parent;
552
- parent.remove();
553
- parent = nextParent?.type === "atrule" ? nextParent : void 0;
554
- }
555
- }
556
- function removeUnsupportedBrowserSelectors(root) {
557
- root.walkRules((rule) => {
558
- if (!rule.selectors || rule.selectors.length === 0) return;
559
- const selectors = rule.selectors.filter((selector) => !isUnsupportedBrowserSelector(selector));
560
- if (selectors.length === rule.selectors.length) return;
561
- if (selectors.length === 0) {
562
- const parent = rule.parent;
563
- rule.remove();
564
- removeEmptyAtRuleAncestors(parent);
565
- return;
566
- }
567
- rule.selectors = selectors;
568
- });
569
- }
570
- function removeDeclarationAndEmptyRule(decl) {
571
- const parent = decl.parent;
572
- decl.remove();
573
- if (parent?.type === "rule" && parent.nodes.length === 0) {
574
- const ruleParent = parent.parent;
575
- parent.remove();
576
- removeEmptyAtRuleAncestors(ruleParent);
577
- }
578
- }
579
- function removeDisplayP3Declarations(root) {
580
- root.walkAtRules((atRule) => {
581
- if (isDisplayP3MediaRule(atRule)) {
582
- const parent = atRule.parent;
583
- atRule.remove();
584
- removeEmptyAtRuleAncestors(parent);
585
- }
586
- });
587
- }
588
- function removeUnsupportedModernColorDeclarations(root) {
589
- const customPropertyValues = /* @__PURE__ */ new Map();
590
- root.walkDecls((decl) => {
591
- if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
592
- });
593
- root.walkDecls((decl) => {
594
- const normalized = normalizeModernColorValue(decl.value, customPropertyValues);
595
- if (normalized.changed) {
596
- decl.value = normalized.value;
597
- if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
598
- }
599
- if (normalized.hasUnsupported) removeDeclarationAndEmptyRule(decl);
600
- });
601
- }
602
- //#endregion
603
- //#region src/bundlers/shared/css-cleanup.ts
604
- const PREFLIGHT_RESET_PROPS = new Set([
605
- "box-sizing",
606
- "border",
607
- "border-width",
608
- "border-style",
609
- "border-color",
610
- "margin",
611
- "padding"
612
- ]);
613
- const CONTENT_VAR_RE = /var\(\s*--tw-content\b/;
614
- const HOIST_ANCHOR_COMMENT = "__weapp_tailwindcss_base_anchor__";
615
- function isMiniProgramThemeScopeSelector$1(selectors) {
616
- return selectors.length > 0 && selectors.every((selector) => MINI_PROGRAM_THEME_SCOPE_SELECTORS$1.has(selector));
617
- }
618
- function isMiniProgramPreflightSelector(selectors) {
619
- return selectors.length > 0 && selectors.every((selector) => MINI_PROGRAM_PREFLIGHT_SELECTORS.has(selector)) && selectors.some((selector) => selector === "*" || selector === ":before" || selector === ":after" || selector === "::before" || selector === "::after");
620
- }
621
- function hasTailwindPreflightDeclaration(rule) {
622
- let hasTailwindVar = false;
623
- let hasResetProp = false;
624
- rule.walkDecls((decl) => {
625
- if (decl.prop.startsWith("--tw-")) hasTailwindVar = true;
626
- if (PREFLIGHT_RESET_PROPS.has(decl.prop)) hasResetProp = true;
627
- });
628
- return hasTailwindVar || hasResetProp;
629
- }
630
- function isCustomPropertyOnlyRule$1(rule) {
631
- let hasDeclaration = false;
632
- let allCustomProperties = true;
633
- rule.each((node) => {
634
- if (node.type !== "decl") return;
635
- hasDeclaration = true;
636
- if (!node.prop.startsWith("--")) allCustomProperties = false;
637
- });
638
- return hasDeclaration && allCustomProperties;
639
- }
640
- function hasContentInitDeclaration(rule) {
641
- let hasContentInit = false;
642
- rule.walkDecls("--tw-content", () => {
643
- hasContentInit = true;
644
- });
645
- return hasContentInit;
646
- }
647
- function isEmptyContentInitDeclaration(decl) {
648
- return decl.prop === "--tw-content" && (decl.value === "\"\"" || decl.value === "''");
649
- }
650
- function usesTwContentVariable(root) {
651
- let used = false;
652
- root.walkDecls((decl) => {
653
- if (CONTENT_VAR_RE.test(decl.value)) used = true;
654
- });
655
- return used;
656
- }
657
- function isTailwindPreflightRule(node) {
658
- if (node.type !== "rule" || node.parent?.type !== "root") return false;
659
- const rule = node;
660
- return isMiniProgramPreflightSelector(getRuleSelectors(rule)) && hasTailwindPreflightDeclaration(rule);
661
- }
662
- function isMiniProgramThemeVariableRule(node) {
663
- if (node.type !== "rule" || node.parent?.type !== "root") return false;
664
- const rule = node;
665
- return isMiniProgramThemeScopeSelector$1(getRuleSelectors(rule)) && isCustomPropertyOnlyRule$1(rule);
666
- }
667
- function createPseudoContentInitRule() {
668
- const rule = postcss.rule({ selector: "::before,\n::after" });
669
- rule.append({
670
- prop: "--tw-content",
671
- value: "''"
672
- });
673
- return rule;
674
- }
675
- function collectPreflightRules(root, options = {}) {
676
- const preflightNodes = [];
677
- let hasContentInit = false;
678
- for (const node of root.nodes ?? []) if (isTailwindPreflightRule(node)) {
679
- preflightNodes.push(node);
680
- if (hasContentInitDeclaration(node)) hasContentInit = true;
681
- }
682
- if (preflightNodes.length === 0) return [];
683
- const clonedPreflightRules = preflightNodes.map((node) => node.clone());
684
- const contentInitRules = options.preservePseudoContentInit ? clonedPreflightRules.filter((rule) => hasContentInitDeclaration(rule)) : [];
685
- const otherPreflightRules = clonedPreflightRules.filter((rule) => !hasContentInitDeclaration(rule));
686
- const preflightRules = hasContentInit ? [...contentInitRules, ...otherPreflightRules] : [...options.preservePseudoContentInit ? [createPseudoContentInitRule()] : [], ...otherPreflightRules];
687
- for (const node of preflightNodes) node.remove();
688
- return preflightRules;
689
- }
690
- function createPreflightResetRule(cssPreflight) {
691
- if (!cssPreflight || typeof cssPreflight !== "object") return;
692
- const rule = postcss.rule({ selector: "view,text,:after,:before" });
693
- for (const [prop, value] of Object.entries(cssPreflight)) {
694
- if (value === false) continue;
695
- rule.append({
696
- prop,
697
- value: value.toString()
698
- });
699
- }
700
- return rule.nodes?.length ? rule : void 0;
701
- }
702
- function collectThemeVariableRule(root, options = {}) {
703
- const themeRules = [];
704
- const declarations = /* @__PURE__ */ new Map();
705
- const shouldPreserveContentInit = options.preservePseudoContentInit || usesTwContentVariable(root);
706
- for (const node of root.nodes ?? []) {
707
- if (!isMiniProgramThemeVariableRule(node)) continue;
708
- themeRules.push(node);
709
- node.walkDecls((decl) => {
710
- if (isDisplayP3Declaration(decl)) return;
711
- if (!shouldPreserveContentInit && isEmptyContentInitDeclaration(decl)) return;
712
- declarations.set(decl.prop, decl.clone());
713
- });
714
- }
715
- for (const rule of themeRules) rule.remove();
716
- if (declarations.size === 0) return;
717
- const rule = postcss.rule({ selector: MINI_PROGRAM_THEME_SCOPE_SELECTOR });
718
- for (const decl of declarations.values()) rule.append(decl);
719
- return rule;
720
- }
721
- function getTopDirectiveTail(root) {
722
- let tail;
723
- for (const node of root.nodes ?? []) {
724
- if (node.type === "atrule" && (node.name === "charset" || node.name === "import")) {
725
- tail = node;
726
- continue;
727
- }
728
- break;
729
- }
730
- return tail;
731
- }
732
- function createHoistInsertionAnchor(root) {
733
- for (const node of root.nodes ?? []) if (isTailwindPreflightRule(node) || isMiniProgramThemeVariableRule(node)) {
734
- const anchor = postcss.comment({ text: HOIST_ANCHOR_COMMENT });
735
- node.before(anchor);
736
- return anchor;
737
- }
738
- }
739
- function insertHoistedRules(root, rules, anchor) {
740
- if (anchor && !anchor.parent) anchor = void 0;
741
- if (rules.length === 0) {
742
- anchor?.remove();
743
- return;
744
- }
745
- const topDirectiveTail = getTopDirectiveTail(root);
746
- const firstRule = rules[0];
747
- if (!firstRule) return;
748
- if (anchor) {
749
- if (anchor.raws.before === void 0) delete firstRule.raws.before;
750
- else firstRule.raws.before = anchor.raws.before;
751
- anchor.replaceWith(rules);
752
- return;
753
- }
754
- firstRule.raws.before = topDirectiveTail ? "\n" : "";
755
- if (topDirectiveTail) topDirectiveTail.after(rules);
756
- else root.prepend(rules);
757
- }
758
- function finalizeMiniProgramCssRoot(root, options = {}) {
759
- removeUnsupportedCascadeLayers(root);
760
- unwrapTailwindSourceMedia(root);
761
- root.walkAtRules("property", (atRule) => {
762
- atRule.remove();
763
- });
764
- removeSpecificityPlaceholders(root);
765
- removeUnsupportedBrowserSelectors(root);
766
- removeDisplayP3Declarations(root);
767
- removeUnsupportedModernColorDeclarations(root);
768
- root.walkDecls((decl) => {
769
- normalizeMiniProgramPrefixedDeclaration(decl);
770
- });
771
- root.walkAtRules((atRule) => {
772
- removeUnsupportedMiniProgramPrefixedAtRule(atRule);
773
- });
774
- const hoistAnchor = createHoistInsertionAnchor(root);
775
- const preflightRules = collectPreflightRules(root, options);
776
- if (preflightRules.length === 0) {
777
- const resetRule = createPreflightResetRule(options.cssPreflight);
778
- if (resetRule) preflightRules.push(resetRule);
779
- }
780
- const themeRule = collectThemeVariableRule(root, options);
781
- insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules, hoistAnchor);
782
- }
783
- function unwrapTailwindSourceMedia(root) {
784
- root.walkAtRules("media", (atRule) => {
785
- if (atRule.params.startsWith("source(") && atRule.nodes && atRule.nodes.length > 0) atRule.replaceWith(...atRule.nodes);
786
- });
787
- }
788
- function finalizeMiniProgramCss(css, options = {}) {
789
- const cleanedCss = removeUnsupportedMiniProgramAtRules(css);
790
- try {
791
- const root = postcss.parse(cleanedCss);
792
- finalizeMiniProgramCssRoot(root, options);
793
- return root.toString();
794
- } catch {
795
- return cleanedCss;
796
- }
797
- }
798
- //#endregion
799
377
  //#region src/bundlers/shared/generator-css/legacy-selectors.ts
800
378
  const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
801
379
  const MINI_PROGRAM_THEME_SCOPE_SELECTORS = new Set([
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_generator = require("./generator-N4jy1HCk.js");
2
+ const require_generator = require("./generator-CV_APjnB.js");
3
3
  const require_gulp = require("./gulp.js");
4
- const require_postcss = require("./postcss-DlY-YRvA.js");
5
- const require_vite = require("./vite-MyXBNux0.js");
6
- const require_webpack = require("./webpack-Mz1V0A9p.js");
4
+ const require_postcss = require("./postcss-Csaggbm7.js");
5
+ const require_vite = require("./vite-k4Nlk42j.js");
6
+ const require_webpack = require("./webpack-DC7v6ylA.js");
7
7
  exports.UnifiedWebpackPluginV5 = require_webpack.UnifiedWebpackPluginV5;
8
8
  exports.WeappTailwindcss = require_vite.WeappTailwindcss;
9
9
  exports.createPlugins = require_gulp.createPlugins;
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { t as createWeappTailwindcssGenerator } from "./generator-DIuglJub.mjs";
1
+ import { t as createWeappTailwindcssGenerator } from "./generator-DPX8vA2P.mjs";
2
2
  import { WeappTailwindcss as createPlugins } from "./gulp.mjs";
3
- import { t as weappTailwindcssPostcssPlugin } from "./postcss-D4UdbBQ6.mjs";
4
- import { t as WeappTailwindcss } from "./vite-B5faZcbE.mjs";
5
- import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-BnVyDmsD.mjs";
3
+ import { t as weappTailwindcssPostcssPlugin } from "./postcss-ioX7S9x5.mjs";
4
+ import { t as WeappTailwindcss } from "./vite-BcXuBYy3.mjs";
5
+ import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-C4pViZ7V.mjs";
6
6
  export { UnifiedWebpackPluginV5, WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
@@ -1,6 +1,6 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
3
- const require_generator = require("./generator-N4jy1HCk.js");
2
+ const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
3
+ const require_generator = require("./generator-CV_APjnB.js");
4
4
  let postcss = require("postcss");
5
5
  postcss = require_chunk.__toESM(postcss);
6
6
  let node_path = require("node:path");
@@ -1,5 +1,5 @@
1
- import { F as normalizeLegacyContentEntries, I as parseConfigParam, L as resolveCssSourceEntries, M as createSourceScanPattern, N as expandTailwindSourceEntries, U as readInstalledPackageMajorVersion, j as collectCssInlineSourceCandidates, k as DEFAULT_SOURCE_SCAN_EXTENSIONS, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-DIXDEDmL.mjs";
2
- import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-DIuglJub.mjs";
1
+ import { A as collectCssInlineSourceCandidates, F as parseConfigParam, H as readInstalledPackageMajorVersion, I as resolveCssSourceEntries, M as expandTailwindSourceEntries, O as DEFAULT_SOURCE_SCAN_EXTENSIONS, P as normalizeLegacyContentEntries, j as createSourceScanPattern, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-DyIcbpZm.mjs";
2
+ import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-DPX8vA2P.mjs";
3
3
  import postcss from "postcss";
4
4
  import path from "node:path";
5
5
  import process from "node:process";
package/dist/postcss.js CHANGED
@@ -2,6 +2,6 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_postcss = require("./postcss-DlY-YRvA.js");
5
+ const require_postcss = require("./postcss-Csaggbm7.js");
6
6
  exports.default = require_postcss.weappTailwindcssPostcssPlugin;
7
7
  exports.weappTailwindcssPostcssPlugin = require_postcss.weappTailwindcssPostcssPlugin;
package/dist/postcss.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { t as weappTailwindcssPostcssPlugin } from "./postcss-D4UdbBQ6.mjs";
1
+ import { t as weappTailwindcssPostcssPlugin } from "./postcss-ioX7S9x5.mjs";
2
2
  export { weappTailwindcssPostcssPlugin as default, weappTailwindcssPostcssPlugin };
@@ -1,8 +1,8 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
2
+ const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
3
3
  const require_defaults = require("./defaults-IHhYxNeU.js");
4
4
  require("./utils-4ODFyoqD.js");
5
- const require_tailwindcss = require("./tailwindcss-BhG7BtB-.js");
5
+ const require_tailwindcss = require("./tailwindcss-whZE3HpL.js");
6
6
  let node_path = require("node:path");
7
7
  node_path = require_chunk.__toESM(node_path);
8
8
  let node_process = require("node:process");
@@ -1,7 +1,7 @@
1
- import { C as createTailwindV4Engine, K as omitUndefined, V as createDebug, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-DIXDEDmL.mjs";
1
+ import { B as createDebug, C as createTailwindV4Engine, G as omitUndefined, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-DyIcbpZm.mjs";
2
2
  import { a as resolveDefaultCssPreflight, i as getDefaultOptions, o as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, s as HARD_PARSE_CACHE_MAX_ENTRIES } from "./defaults-B1igPF_e.mjs";
3
3
  import { i as isMap, n as defuOverrideArray } from "./utils-CGBVVNm6.mjs";
4
- import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, r as isUniAppXEnabled, t as createTailwindcssPatcherFromContext } from "./tailwindcss-c6ROlNNW.mjs";
4
+ import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, r as isUniAppXEnabled, t as createTailwindcssPatcherFromContext } from "./tailwindcss-B_JAdOQf.mjs";
5
5
  import path from "node:path";
6
6
  import process from "node:process";
7
7
  import { logger, pc } from "@weapp-tailwindcss/logger";
package/dist/presets.js CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("./chunk-8l464Juk.js");
3
- const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
3
+ const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
4
4
  const require_utils = require("./utils-4ODFyoqD.js");
5
- const require_tailwindcss = require("./tailwindcss-BhG7BtB-.js");
5
+ const require_tailwindcss = require("./tailwindcss-whZE3HpL.js");
6
6
  require("./logger-EVNB9z7i.js");
7
7
  let node_process = require("node:process");
8
8
  node_process = require_chunk.__toESM(node_process);
package/dist/presets.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { K as omitUndefined } from "./v3-engine-DIXDEDmL.mjs";
1
+ import { G as omitUndefined } from "./v3-engine-DyIcbpZm.mjs";
2
2
  import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-CGBVVNm6.mjs";
3
- import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-c6ROlNNW.mjs";
3
+ import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-B_JAdOQf.mjs";
4
4
  import { t as logger } from "./logger-CZUxvJJD.mjs";
5
5
  import process from "node:process";
6
6
  import { getPackageInfoSync } from "local-pkg";
@@ -5469,20 +5469,6 @@ import_postcss.default.Rule;
5469
5469
  import_postcss.default.Root;
5470
5470
  import_postcss.default.Node;
5471
5471
  //#endregion
5472
- //#region src/tailwindcss/remove-unsupported-css.ts
5473
- /**
5474
- * 移除小程序不支持的 cascade layer 语法,同时保留 layer 内的实际规则。
5475
- */
5476
- function removeUnsupportedCascadeLayers(root) {
5477
- root.walkAtRules("layer", (atRule) => {
5478
- if (!atRule.nodes || atRule.nodes.length === 0) {
5479
- atRule.remove();
5480
- return;
5481
- }
5482
- atRule.replaceWith(...atRule.nodes);
5483
- });
5484
- }
5485
- //#endregion
5486
5472
  //#region src/bundlers/webpack/loaders/runtime-registry.ts
5487
5473
  const runtimeRegistryHolder = globalThis;
5488
5474
  const runtimeRegistry = runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ ?? (runtimeRegistryHolder.__WEAPP_TW_WEBPACK_LOADER_RUNTIME_REGISTRY__ = /* @__PURE__ */ new Map());
@@ -5508,9 +5494,3 @@ Object.defineProperty(exports, "postcss_default", {
5508
5494
  return postcss_default;
5509
5495
  }
5510
5496
  });
5511
- Object.defineProperty(exports, "removeUnsupportedCascadeLayers", {
5512
- enumerable: true,
5513
- get: function() {
5514
- return removeUnsupportedCascadeLayers;
5515
- }
5516
- });
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
2
+ const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
3
3
  let node_path = require("node:path");
4
4
  node_path = require_chunk.__toESM(node_path);
5
5
  let tailwindcss_patch = require("tailwindcss-patch");
@@ -1,4 +1,4 @@
1
- import { A as FULL_SOURCE_SCAN_EXTENSION_RE, B as toPosixPath, P as isFileMatchedByTailwindSourceEntries, R as resolveSourceScanPath } from "./v3-engine-DIXDEDmL.mjs";
1
+ import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-DyIcbpZm.mjs";
2
2
  import path from "node:path";
3
3
  import { extractSourceCandidates, resolveProjectSourceFiles } from "tailwindcss-patch";
4
4
  import { readFile } from "node:fs/promises";
@@ -1,5 +1 @@
1
- interface PruneMiniProgramGeneratedCssOptions {
2
- preservePreflight?: boolean;
3
- }
4
- export declare function pruneMiniProgramGeneratedCss(css: string, options?: PruneMiniProgramGeneratedCssOptions): string;
5
- export {};
1
+ export { pruneMiniProgramGeneratedCss } from '@weapp-tailwindcss/postcss';
@@ -1,2 +1 @@
1
- import type postcss from 'postcss';
2
- export declare function removeUnsupportedCascadeLayers(root: postcss.Root): void;
1
+ export { removeUnsupportedCascadeLayers, } from '@weapp-tailwindcss/postcss';
@@ -1,4 +1,4 @@
1
- import { H as createTailwindcssPatcher, J as findWorkspacePackageDir, K as omitUndefined, U as readInstalledPackageMajorVersion, Y as findWorkspaceRoot, f as runtimeSignaturePatchersSymbol, q as findNearestPackageRoot } from "./v3-engine-DIXDEDmL.mjs";
1
+ import { G as omitUndefined, H as readInstalledPackageMajorVersion, J as findWorkspaceRoot, K as findNearestPackageRoot, V as createTailwindcssPatcher, f as runtimeSignaturePatchersSymbol, q as findWorkspacePackageDir } from "./v3-engine-DyIcbpZm.mjs";
2
2
  import { n as defuOverrideArray } from "./utils-CGBVVNm6.mjs";
3
3
  import { createRequire } from "node:module";
4
4
  import { existsSync, readFileSync } from "node:fs";
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-8l464Juk.js");
2
- const require_v3_engine = require("./v3-engine-5LoZUH-4.js");
2
+ const require_v3_engine = require("./v3-engine-CCwvhRrQ.js");
3
3
  require("./utils-4ODFyoqD.js");
4
4
  let node_fs = require("node:fs");
5
5
  let node_module = require("node:module");