weapp-tailwindcss 5.2.3 → 5.2.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.
@@ -1,7 +1,7 @@
1
1
  import type { OutputBundle } from 'rollup';
2
2
  import type { CssAssetMarkerMatcher, CssAssetResultRecorder } from './markers-imports.js';
3
3
  import { postcss } from '@weapp-tailwindcss/postcss';
4
- export declare function normalizeCssSignatureValue(value: string): string;
4
+ export { normalizeCssSignatureValue } from './scoped-tailwind-noise.js';
5
5
  export declare function collectRootScopedComparableCssCoverage(cssSources: string[]): {
6
6
  rules: Set<string>;
7
7
  atRules: Set<string>;
@@ -0,0 +1,9 @@
1
+ import type { AtRule, Rule } from 'postcss';
2
+ export declare function hasVueScopedAttr(value: string): boolean;
3
+ export declare function normalizeCssSignatureValue(value: string): string;
4
+ export declare function isLikelyTailwindGlobalRule(rule: Rule): boolean;
5
+ export declare function isLikelyTailwindPropertyAtRule(atRule: AtRule): boolean;
6
+ export declare function isUnscopedMiniProgramTailwindPreflightRule(rule: Rule): boolean;
7
+ export declare function isScopedMiniProgramTailwindContentInitRule(rule: Rule): boolean;
8
+ export declare function hasUnscopedMiniProgramTailwindPreflightRule(css: string): boolean;
9
+ export declare function hasScopedMiniProgramTailwindContentInitRule(css: string): boolean;
package/dist/index.cjs CHANGED
@@ -3,7 +3,7 @@ const require_framework = require("./framework.cjs");
3
3
  const require_generator = require("./generator-BE34PYSC.cjs");
4
4
  const require_gulp = require("./gulp-Nhszi1kK.cjs");
5
5
  const require_postcss = require("./postcss.cjs");
6
- const require_vite = require("./vite-x4mekvGN.cjs");
6
+ const require_vite = require("./vite-BvbnZ6aZ.cjs");
7
7
  const require_webpack = require("./webpack-B2ojv_HI.cjs");
8
8
  require("./webpack.cjs");
9
9
  let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMp
2
2
  import { t as createWeappTailwindcssGenerator } from "./generator-DYeAa2-5.js";
3
3
  import { t as createPlugins } from "./gulp-DSi73qr-.js";
4
4
  import weappTailwindcssPostcssPlugin from "./postcss.js";
5
- import { t as WeappTailwindcss } from "./vite-QFjJkpPj.js";
5
+ import { t as WeappTailwindcss } from "./vite-DTWQPkyq.js";
6
6
  import { n as weappTailwindcssPackageDir } from "./webpack-Rx3u2_2x.js";
7
7
  import "./webpack.js";
8
8
  import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
@@ -2411,9 +2411,85 @@ function collectMiniProgramSubpackageSourceEntries(snapshot, subpackageRoots, so
2411
2411
  return sourceEntries;
2412
2412
  }
2413
2413
  //#endregion
2414
- //#region src/bundlers/vite/processed-css-assets/coverage.ts
2414
+ //#region src/bundlers/vite/processed-css-assets/scoped-tailwind-noise.ts
2415
2415
  const VUE_SCOPED_ATTR_RE = /\[data-v-[^\]]+\]/gi;
2416
2416
  const VUE_SCOPED_CLASS_RE = /\.data-v-[\w-]+/gi;
2417
+ const SCOPED_UNIVERSAL_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
2418
+ "*",
2419
+ "::after",
2420
+ "::before",
2421
+ "::backdrop",
2422
+ "::file-selector-button"
2423
+ ]);
2424
+ const MINI_PROGRAM_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
2425
+ "view",
2426
+ "text",
2427
+ "::after",
2428
+ "::before"
2429
+ ]);
2430
+ const MINI_PROGRAM_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
2431
+ "box-sizing",
2432
+ "margin",
2433
+ "padding",
2434
+ "border"
2435
+ ]);
2436
+ const TAILWIND_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
2437
+ "-moz-tab-size:4",
2438
+ "-webkit-appearance:none",
2439
+ "-webkit-appearance:button",
2440
+ "-webkit-tap-highlight-color:transparent",
2441
+ "-webkit-text-decoration:inherit",
2442
+ "-webkit-text-decoration:underline dotted",
2443
+ "-webkit-text-size-adjust:100%",
2444
+ "-o-tab-size:4",
2445
+ "appearance:button",
2446
+ "background-color:transparent",
2447
+ "border-collapse:collapse",
2448
+ "border-color:inherit",
2449
+ "border-radius:0",
2450
+ "border-top-width:1px",
2451
+ "bottom:-.25em",
2452
+ "color:inherit",
2453
+ "display:block",
2454
+ "display:inline-flex",
2455
+ "display:list-item",
2456
+ "font:inherit",
2457
+ "font-family:inherit",
2458
+ "font-feature-settings:inherit",
2459
+ "font-size:1em",
2460
+ "font-size:75%",
2461
+ "font-size:80%",
2462
+ "font-size:inherit",
2463
+ "font-variation-settings:inherit",
2464
+ "font-weight:bolder",
2465
+ "font-weight:inherit",
2466
+ "height:0",
2467
+ "height:auto",
2468
+ "letter-spacing:inherit",
2469
+ "line-height:1",
2470
+ "line-height:1.5",
2471
+ "line-height:0",
2472
+ "line-height:inherit",
2473
+ "list-style:none",
2474
+ "margin-inline-end:4px",
2475
+ "max-width:100%",
2476
+ "min-height:1lh",
2477
+ "opacity:1",
2478
+ "outline:auto",
2479
+ "padding:0",
2480
+ "padding-block:0",
2481
+ "position:relative",
2482
+ "resize:vertical",
2483
+ "tab-size:4",
2484
+ "text-align:inherit",
2485
+ "text-decoration:inherit",
2486
+ "text-decoration:underline dotted",
2487
+ "text-indent:0",
2488
+ "text-transform:none",
2489
+ "top:-.5em",
2490
+ "vertical-align:baseline",
2491
+ "vertical-align:middle"
2492
+ ]);
2417
2493
  function hasVueScopedAttr(value) {
2418
2494
  VUE_SCOPED_ATTR_RE.lastIndex = 0;
2419
2495
  VUE_SCOPED_CLASS_RE.lastIndex = 0;
@@ -2425,54 +2501,54 @@ function hasVueScopedAttr(value) {
2425
2501
  function normalizeCssSignatureValue(value) {
2426
2502
  return value.replace(VUE_SCOPED_ATTR_RE, "").replace(VUE_SCOPED_CLASS_RE, "").replace(/\s+/g, " ").replace(/\s*([>+~])\s*/g, "$1").replace(/\(\s+/g, "(").replace(/\s+\)/g, ")").trim();
2427
2503
  }
2428
- function createDeclarationSignature(rule) {
2429
- return createDeclarationKeys(rule).sort().join(";");
2430
- }
2431
- function createRuleCoverageKey(selector, declarations) {
2432
- return `${normalizeCssSignatureValue(selector)}\0${declarations}`;
2433
- }
2434
- function createDeclarationKeys(rule) {
2435
- return (rule.nodes ?? []).filter((node) => node.type === "decl").map((node) => `${node.prop}:${normalizeCssSignatureValue(node.value)}${node.important ? "!important" : ""}`);
2436
- }
2437
- function createAtRuleCoverageKey(atRule) {
2438
- return `${atRule.name}\0${normalizeCssSignatureValue(atRule.params)}\0${normalizeCssSignatureValue(atRule.toString())}`;
2439
- }
2440
2504
  function hasClassSelector(selector) {
2441
2505
  return /(?:^|[^\\])\.[_a-z\u00A0-\uFFFF-]/i.test(normalizeCssSignatureValue(selector));
2442
2506
  }
2443
2507
  function isLikelyTailwindGlobalSelector(selector) {
2444
2508
  const normalized = normalizeCssSignatureValue(selector);
2445
- return normalized === "*" || normalized.startsWith("::") || normalized.startsWith(":root") || normalized.startsWith(":host") || /^(?:html|body|hr|abbr|h1|h2|h3|h4|h5|h6|a|b|strong|code|kbd|samp|small|sub|sup|table|button|input|select|optgroup|textarea|summary|blockquote|dl|dd|fieldset|legend|ol|ul|menu|dialog|progress|video|audio|canvas|embed|iframe|img|object|svg|details|template|[uo]ni-progress)(?:$|[:,[\s>+~.#])/.test(normalized);
2509
+ return normalized === "*" || normalized.startsWith("::") || normalized.startsWith(":root") || normalized.startsWith(":host") || /^(?:html|body|hr|abbr|h1|h2|h3|h4|h5|h6|a|b|strong|code|kbd|samp|pre|small|sub|sup|table|button|input|select|optgroup|textarea|summary|blockquote|dl|dd|fieldset|legend|ol|ul|menu|dialog|progress|video|audio|canvas|embed|iframe|img|object|svg|details|template|[uo]ni-progress)(?:$|[:,[\s>+~.#])/.test(normalized);
2510
+ }
2511
+ function isTailwindPreflightDeclaration(decl) {
2512
+ const prop = decl.prop.trim().toLowerCase();
2513
+ const value = normalizeCssSignatureValue(decl.value.trim().toLowerCase());
2514
+ if (prop.startsWith("--tw-")) return true;
2515
+ if (prop === "color" && value.startsWith("color-mix(") && value.includes("currentcolor") && value.includes("transparent")) return true;
2516
+ if (prop === "color" && value === "currentcolor") return true;
2517
+ if (prop === "font-family" && value.startsWith("var(--default-font-family") || prop === "font-feature-settings" && value.startsWith("var(--default-font-feature-settings") || prop === "font-variation-settings" && value.startsWith("var(--default-font-variation-settings")) return true;
2518
+ return TAILWIND_PREFLIGHT_DECLARATIONS.has(`${prop}:${value}`);
2519
+ }
2520
+ function getRuleDeclarations(rule) {
2521
+ return rule.nodes?.filter((node) => node.type === "decl") ?? [];
2522
+ }
2523
+ function isScopedTailwindThemeCarrierRule(rule) {
2524
+ const selectors = rule.selectors ?? [rule.selector];
2525
+ const declarations = getRuleDeclarations(rule);
2526
+ return selectors.length > 0 && selectors.every((selector) => {
2527
+ const normalized = normalizeCssSignatureValue(selector);
2528
+ return hasVueScopedAttr(selector) && (normalized.startsWith(":root") || normalized.startsWith(":host"));
2529
+ }) && declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--"));
2530
+ }
2531
+ function isScopedUniversalTailwindPreflightRule(rule) {
2532
+ const selectors = rule.selectors ?? [rule.selector];
2533
+ const declarations = getRuleDeclarations(rule);
2534
+ return selectors.length > 0 && selectors.every((selector) => hasVueScopedAttr(selector) && SCOPED_UNIVERSAL_PREFLIGHT_SELECTORS.has(normalizeCssSignatureValue(selector))) && declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop));
2446
2535
  }
2447
2536
  function isLikelyTailwindGlobalRule(rule) {
2448
- return (rule.selectors ?? [rule.selector]).every((selector) => !hasClassSelector(selector) && isLikelyTailwindGlobalSelector(selector));
2537
+ const selectors = rule.selectors ?? [rule.selector];
2538
+ const declarations = getRuleDeclarations(rule);
2539
+ return isScopedTailwindThemeCarrierRule(rule) || isScopedUniversalTailwindPreflightRule(rule) || selectors.every((selector) => !hasClassSelector(selector) && isLikelyTailwindGlobalSelector(selector)) && declarations.length > 0 && declarations.every(isTailwindPreflightDeclaration);
2449
2540
  }
2450
2541
  function isLikelyTailwindPropertyAtRule(atRule) {
2451
2542
  return atRule.name.toLowerCase() === "property" && normalizeCssSignatureValue(atRule.params).startsWith("--tw-");
2452
2543
  }
2453
- const MINI_PROGRAM_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
2454
- "view",
2455
- "text",
2456
- "::after",
2457
- "::before"
2458
- ]);
2459
- const MINI_PROGRAM_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
2460
- "box-sizing",
2461
- "margin",
2462
- "padding",
2463
- "border"
2464
- ]);
2465
- function isMiniProgramTailwindPreflightDeclaration(decl) {
2466
- return decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop);
2467
- }
2468
2544
  function isUnscopedMiniProgramTailwindPreflightRule(rule) {
2469
2545
  const selectors = rule.selectors ?? [rule.selector];
2470
2546
  if (selectors.length === 0 || !selectors.every((selector) => {
2471
2547
  const normalized = normalizeCssSignatureValue(selector);
2472
2548
  return !hasVueScopedAttr(selector) && MINI_PROGRAM_PREFLIGHT_SELECTORS.has(normalized);
2473
2549
  })) return false;
2474
- const declarations = rule.nodes?.filter((node) => node.type === "decl") ?? [];
2475
- return declarations.length > 0 && declarations.every(isMiniProgramTailwindPreflightDeclaration);
2550
+ const declarations = getRuleDeclarations(rule);
2551
+ return declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop));
2476
2552
  }
2477
2553
  function isScopedMiniProgramTailwindContentInitRule(rule) {
2478
2554
  const selectors = rule.selectors ?? [rule.selector];
@@ -2480,7 +2556,7 @@ function isScopedMiniProgramTailwindContentInitRule(rule) {
2480
2556
  const normalized = normalizeCssSignatureValue(selector);
2481
2557
  return hasVueScopedAttr(selector) && MINI_PROGRAM_PREFLIGHT_SELECTORS.has(normalized);
2482
2558
  })) return false;
2483
- const declarations = rule.nodes?.filter((node) => node.type === "decl") ?? [];
2559
+ const declarations = getRuleDeclarations(rule);
2484
2560
  return declarations.length > 0 && declarations.every((decl) => decl.prop === "--tw-content");
2485
2561
  }
2486
2562
  function hasUnscopedMiniProgramTailwindPreflightRule(css) {
@@ -2489,6 +2565,20 @@ function hasUnscopedMiniProgramTailwindPreflightRule(css) {
2489
2565
  function hasScopedMiniProgramTailwindContentInitRule(css) {
2490
2566
  return /(?:^|[{}])[^{}]*\.data-v-[\w-][^{}]*\{\s*--tw-content\s*:/.test(css);
2491
2567
  }
2568
+ //#endregion
2569
+ //#region src/bundlers/vite/processed-css-assets/coverage.ts
2570
+ function createDeclarationSignature(rule) {
2571
+ return createDeclarationKeys(rule).sort().join(";");
2572
+ }
2573
+ function createRuleCoverageKey(selector, declarations) {
2574
+ return `${normalizeCssSignatureValue(selector)}\0${declarations}`;
2575
+ }
2576
+ function createDeclarationKeys(rule) {
2577
+ return (rule.nodes ?? []).filter((node) => node.type === "decl").map((node) => `${node.prop}:${normalizeCssSignatureValue(node.value)}${node.important ? "!important" : ""}`);
2578
+ }
2579
+ function createAtRuleCoverageKey(atRule) {
2580
+ return `${atRule.name}\0${normalizeCssSignatureValue(atRule.params)}\0${normalizeCssSignatureValue(atRule.toString())}`;
2581
+ }
2492
2582
  function collectRootScopedComparableCssCoverage(cssSources) {
2493
2583
  const rules = /* @__PURE__ */ new Set();
2494
2584
  const atRules = /* @__PURE__ */ new Set();
@@ -2402,9 +2402,85 @@ function collectMiniProgramSubpackageSourceEntries(snapshot, subpackageRoots, so
2402
2402
  return sourceEntries;
2403
2403
  }
2404
2404
  //#endregion
2405
- //#region src/bundlers/vite/processed-css-assets/coverage.ts
2405
+ //#region src/bundlers/vite/processed-css-assets/scoped-tailwind-noise.ts
2406
2406
  const VUE_SCOPED_ATTR_RE = /\[data-v-[^\]]+\]/gi;
2407
2407
  const VUE_SCOPED_CLASS_RE = /\.data-v-[\w-]+/gi;
2408
+ const SCOPED_UNIVERSAL_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
2409
+ "*",
2410
+ "::after",
2411
+ "::before",
2412
+ "::backdrop",
2413
+ "::file-selector-button"
2414
+ ]);
2415
+ const MINI_PROGRAM_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
2416
+ "view",
2417
+ "text",
2418
+ "::after",
2419
+ "::before"
2420
+ ]);
2421
+ const MINI_PROGRAM_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
2422
+ "box-sizing",
2423
+ "margin",
2424
+ "padding",
2425
+ "border"
2426
+ ]);
2427
+ const TAILWIND_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
2428
+ "-moz-tab-size:4",
2429
+ "-webkit-appearance:none",
2430
+ "-webkit-appearance:button",
2431
+ "-webkit-tap-highlight-color:transparent",
2432
+ "-webkit-text-decoration:inherit",
2433
+ "-webkit-text-decoration:underline dotted",
2434
+ "-webkit-text-size-adjust:100%",
2435
+ "-o-tab-size:4",
2436
+ "appearance:button",
2437
+ "background-color:transparent",
2438
+ "border-collapse:collapse",
2439
+ "border-color:inherit",
2440
+ "border-radius:0",
2441
+ "border-top-width:1px",
2442
+ "bottom:-.25em",
2443
+ "color:inherit",
2444
+ "display:block",
2445
+ "display:inline-flex",
2446
+ "display:list-item",
2447
+ "font:inherit",
2448
+ "font-family:inherit",
2449
+ "font-feature-settings:inherit",
2450
+ "font-size:1em",
2451
+ "font-size:75%",
2452
+ "font-size:80%",
2453
+ "font-size:inherit",
2454
+ "font-variation-settings:inherit",
2455
+ "font-weight:bolder",
2456
+ "font-weight:inherit",
2457
+ "height:0",
2458
+ "height:auto",
2459
+ "letter-spacing:inherit",
2460
+ "line-height:1",
2461
+ "line-height:1.5",
2462
+ "line-height:0",
2463
+ "line-height:inherit",
2464
+ "list-style:none",
2465
+ "margin-inline-end:4px",
2466
+ "max-width:100%",
2467
+ "min-height:1lh",
2468
+ "opacity:1",
2469
+ "outline:auto",
2470
+ "padding:0",
2471
+ "padding-block:0",
2472
+ "position:relative",
2473
+ "resize:vertical",
2474
+ "tab-size:4",
2475
+ "text-align:inherit",
2476
+ "text-decoration:inherit",
2477
+ "text-decoration:underline dotted",
2478
+ "text-indent:0",
2479
+ "text-transform:none",
2480
+ "top:-.5em",
2481
+ "vertical-align:baseline",
2482
+ "vertical-align:middle"
2483
+ ]);
2408
2484
  function hasVueScopedAttr(value) {
2409
2485
  VUE_SCOPED_ATTR_RE.lastIndex = 0;
2410
2486
  VUE_SCOPED_CLASS_RE.lastIndex = 0;
@@ -2416,54 +2492,54 @@ function hasVueScopedAttr(value) {
2416
2492
  function normalizeCssSignatureValue(value) {
2417
2493
  return value.replace(VUE_SCOPED_ATTR_RE, "").replace(VUE_SCOPED_CLASS_RE, "").replace(/\s+/g, " ").replace(/\s*([>+~])\s*/g, "$1").replace(/\(\s+/g, "(").replace(/\s+\)/g, ")").trim();
2418
2494
  }
2419
- function createDeclarationSignature(rule) {
2420
- return createDeclarationKeys(rule).sort().join(";");
2421
- }
2422
- function createRuleCoverageKey(selector, declarations) {
2423
- return `${normalizeCssSignatureValue(selector)}\0${declarations}`;
2424
- }
2425
- function createDeclarationKeys(rule) {
2426
- return (rule.nodes ?? []).filter((node) => node.type === "decl").map((node) => `${node.prop}:${normalizeCssSignatureValue(node.value)}${node.important ? "!important" : ""}`);
2427
- }
2428
- function createAtRuleCoverageKey(atRule) {
2429
- return `${atRule.name}\0${normalizeCssSignatureValue(atRule.params)}\0${normalizeCssSignatureValue(atRule.toString())}`;
2430
- }
2431
2495
  function hasClassSelector(selector) {
2432
2496
  return /(?:^|[^\\])\.[_a-z\u00A0-\uFFFF-]/i.test(normalizeCssSignatureValue(selector));
2433
2497
  }
2434
2498
  function isLikelyTailwindGlobalSelector(selector) {
2435
2499
  const normalized = normalizeCssSignatureValue(selector);
2436
- return normalized === "*" || normalized.startsWith("::") || normalized.startsWith(":root") || normalized.startsWith(":host") || /^(?:html|body|hr|abbr|h1|h2|h3|h4|h5|h6|a|b|strong|code|kbd|samp|small|sub|sup|table|button|input|select|optgroup|textarea|summary|blockquote|dl|dd|fieldset|legend|ol|ul|menu|dialog|progress|video|audio|canvas|embed|iframe|img|object|svg|details|template|[uo]ni-progress)(?:$|[:,[\s>+~.#])/.test(normalized);
2500
+ return normalized === "*" || normalized.startsWith("::") || normalized.startsWith(":root") || normalized.startsWith(":host") || /^(?:html|body|hr|abbr|h1|h2|h3|h4|h5|h6|a|b|strong|code|kbd|samp|pre|small|sub|sup|table|button|input|select|optgroup|textarea|summary|blockquote|dl|dd|fieldset|legend|ol|ul|menu|dialog|progress|video|audio|canvas|embed|iframe|img|object|svg|details|template|[uo]ni-progress)(?:$|[:,[\s>+~.#])/.test(normalized);
2501
+ }
2502
+ function isTailwindPreflightDeclaration(decl) {
2503
+ const prop = decl.prop.trim().toLowerCase();
2504
+ const value = normalizeCssSignatureValue(decl.value.trim().toLowerCase());
2505
+ if (prop.startsWith("--tw-")) return true;
2506
+ if (prop === "color" && value.startsWith("color-mix(") && value.includes("currentcolor") && value.includes("transparent")) return true;
2507
+ if (prop === "color" && value === "currentcolor") return true;
2508
+ if (prop === "font-family" && value.startsWith("var(--default-font-family") || prop === "font-feature-settings" && value.startsWith("var(--default-font-feature-settings") || prop === "font-variation-settings" && value.startsWith("var(--default-font-variation-settings")) return true;
2509
+ return TAILWIND_PREFLIGHT_DECLARATIONS.has(`${prop}:${value}`);
2510
+ }
2511
+ function getRuleDeclarations(rule) {
2512
+ return rule.nodes?.filter((node) => node.type === "decl") ?? [];
2513
+ }
2514
+ function isScopedTailwindThemeCarrierRule(rule) {
2515
+ const selectors = rule.selectors ?? [rule.selector];
2516
+ const declarations = getRuleDeclarations(rule);
2517
+ return selectors.length > 0 && selectors.every((selector) => {
2518
+ const normalized = normalizeCssSignatureValue(selector);
2519
+ return hasVueScopedAttr(selector) && (normalized.startsWith(":root") || normalized.startsWith(":host"));
2520
+ }) && declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--"));
2521
+ }
2522
+ function isScopedUniversalTailwindPreflightRule(rule) {
2523
+ const selectors = rule.selectors ?? [rule.selector];
2524
+ const declarations = getRuleDeclarations(rule);
2525
+ return selectors.length > 0 && selectors.every((selector) => hasVueScopedAttr(selector) && SCOPED_UNIVERSAL_PREFLIGHT_SELECTORS.has(normalizeCssSignatureValue(selector))) && declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop));
2437
2526
  }
2438
2527
  function isLikelyTailwindGlobalRule(rule) {
2439
- return (rule.selectors ?? [rule.selector]).every((selector) => !hasClassSelector(selector) && isLikelyTailwindGlobalSelector(selector));
2528
+ const selectors = rule.selectors ?? [rule.selector];
2529
+ const declarations = getRuleDeclarations(rule);
2530
+ return isScopedTailwindThemeCarrierRule(rule) || isScopedUniversalTailwindPreflightRule(rule) || selectors.every((selector) => !hasClassSelector(selector) && isLikelyTailwindGlobalSelector(selector)) && declarations.length > 0 && declarations.every(isTailwindPreflightDeclaration);
2440
2531
  }
2441
2532
  function isLikelyTailwindPropertyAtRule(atRule) {
2442
2533
  return atRule.name.toLowerCase() === "property" && normalizeCssSignatureValue(atRule.params).startsWith("--tw-");
2443
2534
  }
2444
- const MINI_PROGRAM_PREFLIGHT_SELECTORS = /* @__PURE__ */ new Set([
2445
- "view",
2446
- "text",
2447
- "::after",
2448
- "::before"
2449
- ]);
2450
- const MINI_PROGRAM_PREFLIGHT_DECLARATIONS = /* @__PURE__ */ new Set([
2451
- "box-sizing",
2452
- "margin",
2453
- "padding",
2454
- "border"
2455
- ]);
2456
- function isMiniProgramTailwindPreflightDeclaration(decl) {
2457
- return decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop);
2458
- }
2459
2535
  function isUnscopedMiniProgramTailwindPreflightRule(rule) {
2460
2536
  const selectors = rule.selectors ?? [rule.selector];
2461
2537
  if (selectors.length === 0 || !selectors.every((selector) => {
2462
2538
  const normalized = normalizeCssSignatureValue(selector);
2463
2539
  return !hasVueScopedAttr(selector) && MINI_PROGRAM_PREFLIGHT_SELECTORS.has(normalized);
2464
2540
  })) return false;
2465
- const declarations = rule.nodes?.filter((node) => node.type === "decl") ?? [];
2466
- return declarations.length > 0 && declarations.every(isMiniProgramTailwindPreflightDeclaration);
2541
+ const declarations = getRuleDeclarations(rule);
2542
+ return declarations.length > 0 && declarations.every((decl) => decl.prop.startsWith("--tw-") || MINI_PROGRAM_PREFLIGHT_DECLARATIONS.has(decl.prop));
2467
2543
  }
2468
2544
  function isScopedMiniProgramTailwindContentInitRule(rule) {
2469
2545
  const selectors = rule.selectors ?? [rule.selector];
@@ -2471,7 +2547,7 @@ function isScopedMiniProgramTailwindContentInitRule(rule) {
2471
2547
  const normalized = normalizeCssSignatureValue(selector);
2472
2548
  return hasVueScopedAttr(selector) && MINI_PROGRAM_PREFLIGHT_SELECTORS.has(normalized);
2473
2549
  })) return false;
2474
- const declarations = rule.nodes?.filter((node) => node.type === "decl") ?? [];
2550
+ const declarations = getRuleDeclarations(rule);
2475
2551
  return declarations.length > 0 && declarations.every((decl) => decl.prop === "--tw-content");
2476
2552
  }
2477
2553
  function hasUnscopedMiniProgramTailwindPreflightRule(css) {
@@ -2480,6 +2556,20 @@ function hasUnscopedMiniProgramTailwindPreflightRule(css) {
2480
2556
  function hasScopedMiniProgramTailwindContentInitRule(css) {
2481
2557
  return /(?:^|[{}])[^{}]*\.data-v-[\w-][^{}]*\{\s*--tw-content\s*:/.test(css);
2482
2558
  }
2559
+ //#endregion
2560
+ //#region src/bundlers/vite/processed-css-assets/coverage.ts
2561
+ function createDeclarationSignature(rule) {
2562
+ return createDeclarationKeys(rule).sort().join(";");
2563
+ }
2564
+ function createRuleCoverageKey(selector, declarations) {
2565
+ return `${normalizeCssSignatureValue(selector)}\0${declarations}`;
2566
+ }
2567
+ function createDeclarationKeys(rule) {
2568
+ return (rule.nodes ?? []).filter((node) => node.type === "decl").map((node) => `${node.prop}:${normalizeCssSignatureValue(node.value)}${node.important ? "!important" : ""}`);
2569
+ }
2570
+ function createAtRuleCoverageKey(atRule) {
2571
+ return `${atRule.name}\0${normalizeCssSignatureValue(atRule.params)}\0${normalizeCssSignatureValue(atRule.toString())}`;
2572
+ }
2483
2573
  function collectRootScopedComparableCssCoverage(cssSources) {
2484
2574
  const rules = /* @__PURE__ */ new Set();
2485
2575
  const atRules = /* @__PURE__ */ new Set();
package/dist/vite.cjs CHANGED
@@ -1,4 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_vite = require("./vite-x4mekvGN.cjs");
2
+ const require_vite = require("./vite-BvbnZ6aZ.cjs");
3
3
  exports.WeappTailwindcss = require_vite.WeappTailwindcss;
4
4
  exports.weappTailwindcss = require_vite.WeappTailwindcss;
package/dist/vite.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as WeappTailwindcss } from "./vite-QFjJkpPj.js";
1
+ import { t as WeappTailwindcss } from "./vite-DTWQPkyq.js";
2
2
  export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "weapp-tailwindcss",
3
3
  "type": "module",
4
- "version": "5.2.3",
4
+ "version": "5.2.4",
5
5
  "description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
6
6
  "author": "ice breaker <1324318532@qq.com>",
7
7
  "license": "MIT",
@@ -216,9 +216,9 @@
216
216
  "semver": "~7.8.5",
217
217
  "yaml": "^2.9.0",
218
218
  "@weapp-tailwindcss/logger": "2.0.1",
219
- "@weapp-tailwindcss/postcss": "3.2.3",
220
- "@weapp-tailwindcss/reset": "0.1.2",
219
+ "@weapp-tailwindcss/postcss": "3.2.4",
221
220
  "@weapp-tailwindcss/shared": "2.0.1",
221
+ "@weapp-tailwindcss/reset": "0.1.2",
222
222
  "tailwindcss-config": "2.0.2",
223
223
  "weapp-style-injector": "1.0.2"
224
224
  },