weapp-tailwindcss 5.2.3 → 5.2.5
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.
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +9 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +2 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/uni-app-x/vite/native-hmr.d.ts +13 -0
- package/dist/uni-app-x/vite.d.ts +6 -5
- package/dist/{vite-x4mekvGN.cjs → vite-AB_sUPv9.cjs} +303 -175
- package/dist/{vite-QFjJkpPj.js → vite-Dafw4jK-.js} +303 -175
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/package.json +3 -3
|
@@ -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
|
|
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;
|
|
@@ -31,6 +31,8 @@ export interface ViteFrameworkExtraPluginContext {
|
|
|
31
31
|
mainCssChunkMatcher: ReturnType<typeof getCompilerContext>['mainCssChunkMatcher'];
|
|
32
32
|
runtimeState: ReturnType<typeof createViteRuntimeClassSet>['runtimeState'];
|
|
33
33
|
styleHandler: ReturnType<typeof getCompilerContext>['styleHandler'];
|
|
34
|
+
tailwindRootCssModuleIds: Set<string>;
|
|
34
35
|
uniAppX: ReturnType<typeof getCompilerContext>['uniAppX'];
|
|
36
|
+
viteProcessedCssSourceFiles: Iterable<string>;
|
|
35
37
|
}
|
|
36
38
|
export declare function createViteFrameworkPlugins(options: (UserDefinedOptions | InternalUserDefinedOptions) | undefined, frameworkBranch: ViteFrameworkBranchContext): WeappTailwindcssVitePlugin[] | undefined;
|
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-
|
|
6
|
+
const require_vite = require("./vite-AB_sUPv9.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-
|
|
5
|
+
import { t as WeappTailwindcss } from "./vite-Dafw4jK-.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";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { HmrContext } from 'vite';
|
|
2
|
+
interface CreateUniAppXNativeHmrReloaderOptions {
|
|
3
|
+
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
4
|
+
isNativeAppBuildTarget: (id?: string) => boolean;
|
|
5
|
+
tailwindRootCssModuleIds: Iterable<string>;
|
|
6
|
+
viteProcessedCssSourceFiles: Iterable<string>;
|
|
7
|
+
}
|
|
8
|
+
export declare function createUniAppXNativeHmrReloader(options: CreateUniAppXNativeHmrReloaderOptions): {
|
|
9
|
+
handleHotUpdate: (ctx: HmrContext) => Promise<import("vite").ModuleNode[] | undefined>;
|
|
10
|
+
refreshBaseline: () => Promise<Set<string>>;
|
|
11
|
+
remember: (runtimeClassSet: Set<string>) => Set<string>;
|
|
12
|
+
};
|
|
13
|
+
export {};
|
package/dist/uni-app-x/vite.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ import type { OutputAsset } from 'rollup';
|
|
|
2
2
|
import type { Plugin, ResolvedConfig } from 'vite';
|
|
3
3
|
import type { ICreateCacheReturnType } from '../cache/index.js';
|
|
4
4
|
import type { AppType, CreateJsHandlerOptions, ICustomAttributesEntities, InternalUserDefinedOptions, JsHandler, LinkedJsModuleResult } from '../types/index.js';
|
|
5
|
-
interface UniAppXRuntimeState {
|
|
6
|
-
readyPromise: Promise<unknown>;
|
|
7
|
-
}
|
|
8
5
|
interface CreateUniAppXPluginsOptions {
|
|
9
6
|
appType: AppType;
|
|
10
7
|
customAttributesEntities: ICustomAttributesEntities;
|
|
11
|
-
disabledDefaultTemplateHandler: boolean;
|
|
8
|
+
disabledDefaultTemplateHandler: boolean | undefined;
|
|
12
9
|
mainCssChunkMatcher: NonNullable<InternalUserDefinedOptions['mainCssChunkMatcher']>;
|
|
13
|
-
runtimeState:
|
|
10
|
+
runtimeState: {
|
|
11
|
+
readyPromise: Promise<unknown>;
|
|
12
|
+
};
|
|
14
13
|
styleHandler: InternalUserDefinedOptions['styleHandler'];
|
|
14
|
+
tailwindRootCssModuleIds?: Iterable<string> | undefined;
|
|
15
15
|
generateCss?: ((id: string, code: string, hookContext?: {
|
|
16
16
|
addWatchFile?: (id: string) => void;
|
|
17
17
|
transient?: boolean;
|
|
@@ -22,6 +22,7 @@ interface CreateUniAppXPluginsOptions {
|
|
|
22
22
|
isIosPlatform?: boolean;
|
|
23
23
|
isEnabled?: (() => boolean) | undefined;
|
|
24
24
|
uniAppX?: InternalUserDefinedOptions['uniAppX'];
|
|
25
|
+
viteProcessedCssSourceFiles?: Iterable<string> | undefined;
|
|
25
26
|
}
|
|
26
27
|
export declare function createUniAppXPlugins(options: CreateUniAppXPluginsOptions): Plugin[];
|
|
27
28
|
type ApplyLinkedResults = (linked: Record<string, LinkedJsModuleResult> | undefined) => void;
|
|
@@ -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/
|
|
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
|
-
|
|
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
|
|
2475
|
-
return declarations.length > 0 && declarations.every(
|
|
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
|
|
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();
|
|
@@ -5666,6 +5756,168 @@ function createUniAppXHarmonyApplyExpander(options) {
|
|
|
5666
5756
|
};
|
|
5667
5757
|
}
|
|
5668
5758
|
//#endregion
|
|
5759
|
+
//#region src/bundlers/vite/hot-css-modules.ts
|
|
5760
|
+
function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
5761
|
+
const modules = [];
|
|
5762
|
+
const seenModules = /* @__PURE__ */ new Set();
|
|
5763
|
+
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
5764
|
+
const outDir = ctx.server.config?.build?.outDir ? normalizeAbsoluteFilePath(node_path.default.resolve(root, ctx.server.config.build.outDir)) : void 0;
|
|
5765
|
+
const isHotSourceStyleModule = (id) => {
|
|
5766
|
+
if (!require_v4_generation_core.isSourceStyleRequest(id)) return false;
|
|
5767
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
5768
|
+
if (isRootMiniProgramStyleUrl(file) || !isAbsoluteFilePath(file) && !file.startsWith("/")) return false;
|
|
5769
|
+
if (outDir && isAbsoluteFilePath(file)) {
|
|
5770
|
+
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
5771
|
+
if (normalizedFile === outDir || normalizedFile.startsWith(`${outDir}/`)) return false;
|
|
5772
|
+
}
|
|
5773
|
+
return true;
|
|
5774
|
+
};
|
|
5775
|
+
const collectModule = (mod) => {
|
|
5776
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
5777
|
+
const modId = mod.id ?? mod.url;
|
|
5778
|
+
if (!isHotSourceStyleModule(modId)) return;
|
|
5779
|
+
seenModules.add(mod);
|
|
5780
|
+
ctx.server.moduleGraph.invalidateModule(mod);
|
|
5781
|
+
modules.push(mod);
|
|
5782
|
+
};
|
|
5783
|
+
for (const id of tailwindRootCssModuleIds) {
|
|
5784
|
+
const candidates = [
|
|
5785
|
+
ctx.server.moduleGraph.getModuleById(id),
|
|
5786
|
+
ctx.server.moduleGraph.getModuleById((0, _weapp_tailwindcss_shared.cleanUrl)(id)),
|
|
5787
|
+
...ctx.server.moduleGraph.getModulesByFile(id) ?? [],
|
|
5788
|
+
...ctx.server.moduleGraph.getModulesByFile((0, _weapp_tailwindcss_shared.cleanUrl)(id)) ?? []
|
|
5789
|
+
];
|
|
5790
|
+
for (const mod of candidates) collectModule(mod);
|
|
5791
|
+
}
|
|
5792
|
+
return modules;
|
|
5793
|
+
}
|
|
5794
|
+
function resolveHotSourceModules(ctx) {
|
|
5795
|
+
const modules = [];
|
|
5796
|
+
const seenModules = /* @__PURE__ */ new Set();
|
|
5797
|
+
const collectModule = (mod) => {
|
|
5798
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
5799
|
+
if (require_v4_generation_core.isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
5800
|
+
seenModules.add(mod);
|
|
5801
|
+
modules.push(mod);
|
|
5802
|
+
};
|
|
5803
|
+
for (const mod of ctx.modules) collectModule(mod);
|
|
5804
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile(ctx.file) ?? []) collectModule(mod);
|
|
5805
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file)) ?? []) collectModule(mod);
|
|
5806
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.(ctx.file));
|
|
5807
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file)));
|
|
5808
|
+
return modules;
|
|
5809
|
+
}
|
|
5810
|
+
function resolveModuleHotUrl(mod) {
|
|
5811
|
+
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
5812
|
+
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
5813
|
+
}
|
|
5814
|
+
function isAbsoluteFilePath(file) {
|
|
5815
|
+
return node_path.default.isAbsolute(file) || /^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\");
|
|
5816
|
+
}
|
|
5817
|
+
function normalizeAbsoluteFilePath(file) {
|
|
5818
|
+
if (/^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\")) return slash(node_path.default.win32.resolve(file));
|
|
5819
|
+
return slash(node_path.default.resolve(file));
|
|
5820
|
+
}
|
|
5821
|
+
function isRootMiniProgramStyleUrl(file) {
|
|
5822
|
+
return /^\/[^/]+\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
5823
|
+
}
|
|
5824
|
+
function resolveCssHotUrl(id, root) {
|
|
5825
|
+
const suffix = /[?#]/.test(id) ? id.slice(id.search(/[?#]/)) : "";
|
|
5826
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
5827
|
+
if (/^\/(?![A-Z]:)/i.test(file) && !file.startsWith(slash(root))) {
|
|
5828
|
+
if (isRootMiniProgramStyleUrl(file)) return;
|
|
5829
|
+
return `${file}${suffix}`;
|
|
5830
|
+
}
|
|
5831
|
+
if (!isAbsoluteFilePath(file)) return;
|
|
5832
|
+
const normalizedRoot = normalizeAbsoluteFilePath(root);
|
|
5833
|
+
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
5834
|
+
if (!normalizedFile.startsWith(`${normalizedRoot}/`)) return;
|
|
5835
|
+
return `/${slash(node_path.default.relative(normalizedRoot, normalizedFile))}${suffix}`;
|
|
5836
|
+
}
|
|
5837
|
+
function includesHotModule(modules, target) {
|
|
5838
|
+
const targetUrl = resolveModuleHotUrl(target);
|
|
5839
|
+
const targetId = target.id;
|
|
5840
|
+
return modules.some((mod) => {
|
|
5841
|
+
if (mod === target) return true;
|
|
5842
|
+
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
5843
|
+
});
|
|
5844
|
+
}
|
|
5845
|
+
function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
5846
|
+
return {
|
|
5847
|
+
type: "js-update",
|
|
5848
|
+
timestamp,
|
|
5849
|
+
path: hotUrl,
|
|
5850
|
+
acceptedPath: hotUrl,
|
|
5851
|
+
explicitImportRequired: false,
|
|
5852
|
+
isWithinCircularImport: false
|
|
5853
|
+
};
|
|
5854
|
+
}
|
|
5855
|
+
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
5856
|
+
return modules.some((mod) => {
|
|
5857
|
+
return !require_v4_generation_core.isSourceStyleRequest(mod.id ?? mod.url) && mod.isSelfAccepting === true;
|
|
5858
|
+
});
|
|
5859
|
+
}
|
|
5860
|
+
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = []) {
|
|
5861
|
+
const seenUrls = /* @__PURE__ */ new Set();
|
|
5862
|
+
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
5863
|
+
const updates = [];
|
|
5864
|
+
for (const id of fallbackCssIds) {
|
|
5865
|
+
if (!require_v4_generation_core.isSourceStyleRequest(id)) continue;
|
|
5866
|
+
const hotUrl = resolveCssHotUrl(id, root);
|
|
5867
|
+
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
5868
|
+
seenUrls.add(hotUrl);
|
|
5869
|
+
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
5870
|
+
}
|
|
5871
|
+
for (const mod of cssModules) {
|
|
5872
|
+
if (includesHotModule(ctx.modules, mod)) continue;
|
|
5873
|
+
const moduleHotUrl = resolveModuleHotUrl(mod);
|
|
5874
|
+
const hotUrl = moduleHotUrl ? resolveCssHotUrl(moduleHotUrl, root) : void 0;
|
|
5875
|
+
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
5876
|
+
seenUrls.add(hotUrl);
|
|
5877
|
+
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
5878
|
+
}
|
|
5879
|
+
if (updates.length === 0) return;
|
|
5880
|
+
queueMicrotask(() => {
|
|
5881
|
+
ctx.server.ws?.send?.({
|
|
5882
|
+
type: "update",
|
|
5883
|
+
updates
|
|
5884
|
+
});
|
|
5885
|
+
});
|
|
5886
|
+
}
|
|
5887
|
+
function sendFullReloadForUnresolvedHotUpdate(ctx) {
|
|
5888
|
+
ctx.server.ws?.send?.({
|
|
5889
|
+
type: "full-reload",
|
|
5890
|
+
path: "*",
|
|
5891
|
+
triggeredBy: ctx.file
|
|
5892
|
+
});
|
|
5893
|
+
}
|
|
5894
|
+
//#endregion
|
|
5895
|
+
//#region src/uni-app-x/vite/native-hmr.ts
|
|
5896
|
+
function createUniAppXNativeHmrReloader(options) {
|
|
5897
|
+
let previousRuntimeClassSet;
|
|
5898
|
+
function remember(runtimeClassSet) {
|
|
5899
|
+
previousRuntimeClassSet = new Set(runtimeClassSet);
|
|
5900
|
+
return runtimeClassSet;
|
|
5901
|
+
}
|
|
5902
|
+
async function refreshBaseline() {
|
|
5903
|
+
return remember(await options.ensureRuntimeClassSet(true));
|
|
5904
|
+
}
|
|
5905
|
+
async function handleHotUpdate(ctx) {
|
|
5906
|
+
if (!options.isNativeAppBuildTarget(ctx.file)) return;
|
|
5907
|
+
const cssModules = ctx.server?.moduleGraph ? resolveHotTailwindCssModules(ctx, /* @__PURE__ */ new Set([...options.tailwindRootCssModuleIds, ...options.viteProcessedCssSourceFiles])) : [];
|
|
5908
|
+
const currentRuntimeClassSet = await options.ensureRuntimeClassSet(true);
|
|
5909
|
+
const hasAddedClass = previousRuntimeClassSet !== void 0 && [...currentRuntimeClassSet].some((candidate) => !previousRuntimeClassSet.has(candidate));
|
|
5910
|
+
remember(currentRuntimeClassSet);
|
|
5911
|
+
if (hasAddedClass) sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
5912
|
+
return cssModules.length > 0 ? [.../* @__PURE__ */ new Set([...ctx.modules, ...cssModules])] : void 0;
|
|
5913
|
+
}
|
|
5914
|
+
return {
|
|
5915
|
+
handleHotUpdate,
|
|
5916
|
+
refreshBaseline,
|
|
5917
|
+
remember
|
|
5918
|
+
};
|
|
5919
|
+
}
|
|
5920
|
+
//#endregion
|
|
5669
5921
|
//#region src/uni-app-x/vite/native-target.ts
|
|
5670
5922
|
function createUniAppXNativeBuildTargetResolver(getResolvedConfig) {
|
|
5671
5923
|
let observedNativeAppBuildTarget = false;
|
|
@@ -5712,13 +5964,19 @@ function isCssModuleExport(code) {
|
|
|
5712
5964
|
return CSS_MODULE_EXPORT_RE.test(code);
|
|
5713
5965
|
}
|
|
5714
5966
|
function createUniAppXPlugins(options) {
|
|
5715
|
-
const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, runtimeState, styleHandler, generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, uniAppX } = options;
|
|
5967
|
+
const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, runtimeState, styleHandler, tailwindRootCssModuleIds = [], generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, uniAppX, viteProcessedCssSourceFiles = [] } = options;
|
|
5716
5968
|
const resolvedUniAppXOptions = require_options.resolveUniAppXOptions(uniAppX);
|
|
5717
5969
|
const utsPlatform = require_generator.resolveUniUtsPlatform();
|
|
5718
5970
|
const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
|
|
5719
5971
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
5720
5972
|
let componentLocalStyleEnabled;
|
|
5721
5973
|
const isNativeAppBuildTarget = createUniAppXNativeBuildTargetResolver(getResolvedConfig);
|
|
5974
|
+
const nativeHmrReloader = createUniAppXNativeHmrReloader({
|
|
5975
|
+
ensureRuntimeClassSet,
|
|
5976
|
+
isNativeAppBuildTarget,
|
|
5977
|
+
tailwindRootCssModuleIds,
|
|
5978
|
+
viteProcessedCssSourceFiles
|
|
5979
|
+
});
|
|
5722
5980
|
function shouldEnableComponentLocalStyle() {
|
|
5723
5981
|
if (!resolvedUniAppXOptions.componentLocalStyles.enabled) {
|
|
5724
5982
|
componentLocalStyleEnabled = false;
|
|
@@ -5746,7 +6004,7 @@ function createUniAppXPlugins(options) {
|
|
|
5746
6004
|
if (!styleHandlerOptions) {
|
|
5747
6005
|
styleHandlerOptions = require_object.omitUndefined({
|
|
5748
6006
|
isMainChunk: mainCssChunkMatcher(id, appType),
|
|
5749
|
-
uniAppXCssTarget: resolveUniAppXCssTarget(id),
|
|
6007
|
+
uniAppXCssTarget: isNativeAppBuildTarget(id) ? resolveUniAppXCssTarget(id) : void 0,
|
|
5750
6008
|
uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
|
|
5751
6009
|
postcssOptions: { options: {
|
|
5752
6010
|
from: id,
|
|
@@ -5771,6 +6029,7 @@ function createUniAppXPlugins(options) {
|
|
|
5771
6029
|
if (isCSSRequest(id) || parsed.vue && parsed.type === "style") {
|
|
5772
6030
|
if (isCssModuleExport(code)) return;
|
|
5773
6031
|
const shouldGenerateCss = require_generator.hasTailwindSourceDirectives(code, { importFallback: true }) || require_generator.hasTailwindApplyDirective(code);
|
|
6032
|
+
if (!isNativeAppBuildTarget(id) && !shouldGenerateCss) return;
|
|
5774
6033
|
harmonyApply.rememberSource(code, id);
|
|
5775
6034
|
const generatedCss = shouldGenerateCss ? await generateCss?.(id, code, hookContext) : void 0;
|
|
5776
6035
|
const styleCode = typeof generatedCss === "string" && generatedCss.trim().length > 0 ? generatedCss : code;
|
|
@@ -5824,7 +6083,7 @@ function createUniAppXPlugins(options) {
|
|
|
5824
6083
|
enforce: "pre",
|
|
5825
6084
|
async buildStart() {
|
|
5826
6085
|
if (!isEnabled()) return;
|
|
5827
|
-
await
|
|
6086
|
+
await nativeHmrReloader.refreshBaseline();
|
|
5828
6087
|
},
|
|
5829
6088
|
async transform(code, id) {
|
|
5830
6089
|
if (!isEnabled()) return;
|
|
@@ -5836,6 +6095,7 @@ function createUniAppXPlugins(options) {
|
|
|
5836
6095
|
const isWatchBuild = resolvedConfig?.command === "build" && !!resolvedConfig.build?.watch;
|
|
5837
6096
|
const isNonWatchBuild = resolvedConfig?.command === "build" && !resolvedConfig.build?.watch;
|
|
5838
6097
|
const currentRuntimeSet = isServeCommand || isWatchBuild || isNonWatchBuild ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
|
|
6098
|
+
nativeHmrReloader.remember(currentRuntimeSet);
|
|
5839
6099
|
const transformUVue = await loadTransformUVue();
|
|
5840
6100
|
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
5841
6101
|
const enablePageLocalStyle = shouldEnableNativePageLocalStyle(id);
|
|
@@ -5859,7 +6119,7 @@ function createUniAppXPlugins(options) {
|
|
|
5859
6119
|
if (!isEnabled()) return;
|
|
5860
6120
|
if (getResolvedConfig()?.command !== "serve") return;
|
|
5861
6121
|
if (!UVUE_NVUE_RE.test(ctx.file)) return;
|
|
5862
|
-
|
|
6122
|
+
return nativeHmrReloader.handleHotUpdate(ctx);
|
|
5863
6123
|
},
|
|
5864
6124
|
async watchChange(id) {
|
|
5865
6125
|
if (!isEnabled()) return;
|
|
@@ -8736,142 +8996,6 @@ function sameStringList(first, second) {
|
|
|
8736
8996
|
return first.every((item, index) => item === second[index]);
|
|
8737
8997
|
}
|
|
8738
8998
|
//#endregion
|
|
8739
|
-
//#region src/bundlers/vite/hot-css-modules.ts
|
|
8740
|
-
function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
8741
|
-
const modules = [];
|
|
8742
|
-
const seenModules = /* @__PURE__ */ new Set();
|
|
8743
|
-
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
8744
|
-
const outDir = ctx.server.config?.build?.outDir ? normalizeAbsoluteFilePath(node_path.default.resolve(root, ctx.server.config.build.outDir)) : void 0;
|
|
8745
|
-
const isHotSourceStyleModule = (id) => {
|
|
8746
|
-
if (!require_v4_generation_core.isSourceStyleRequest(id)) return false;
|
|
8747
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
8748
|
-
if (isRootMiniProgramStyleUrl(file) || !isAbsoluteFilePath(file) && !file.startsWith("/")) return false;
|
|
8749
|
-
if (outDir && isAbsoluteFilePath(file)) {
|
|
8750
|
-
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
8751
|
-
if (normalizedFile === outDir || normalizedFile.startsWith(`${outDir}/`)) return false;
|
|
8752
|
-
}
|
|
8753
|
-
return true;
|
|
8754
|
-
};
|
|
8755
|
-
const collectModule = (mod) => {
|
|
8756
|
-
if (mod == null || seenModules.has(mod)) return;
|
|
8757
|
-
const modId = mod.id ?? mod.url;
|
|
8758
|
-
if (!isHotSourceStyleModule(modId)) return;
|
|
8759
|
-
seenModules.add(mod);
|
|
8760
|
-
ctx.server.moduleGraph.invalidateModule(mod);
|
|
8761
|
-
modules.push(mod);
|
|
8762
|
-
};
|
|
8763
|
-
for (const id of tailwindRootCssModuleIds) {
|
|
8764
|
-
const candidates = [
|
|
8765
|
-
ctx.server.moduleGraph.getModuleById(id),
|
|
8766
|
-
ctx.server.moduleGraph.getModuleById((0, _weapp_tailwindcss_shared.cleanUrl)(id)),
|
|
8767
|
-
...ctx.server.moduleGraph.getModulesByFile(id) ?? [],
|
|
8768
|
-
...ctx.server.moduleGraph.getModulesByFile((0, _weapp_tailwindcss_shared.cleanUrl)(id)) ?? []
|
|
8769
|
-
];
|
|
8770
|
-
for (const mod of candidates) collectModule(mod);
|
|
8771
|
-
}
|
|
8772
|
-
return modules;
|
|
8773
|
-
}
|
|
8774
|
-
function resolveHotSourceModules(ctx) {
|
|
8775
|
-
const modules = [];
|
|
8776
|
-
const seenModules = /* @__PURE__ */ new Set();
|
|
8777
|
-
const collectModule = (mod) => {
|
|
8778
|
-
if (mod == null || seenModules.has(mod)) return;
|
|
8779
|
-
if (require_v4_generation_core.isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
8780
|
-
seenModules.add(mod);
|
|
8781
|
-
modules.push(mod);
|
|
8782
|
-
};
|
|
8783
|
-
for (const mod of ctx.modules) collectModule(mod);
|
|
8784
|
-
for (const mod of ctx.server.moduleGraph.getModulesByFile(ctx.file) ?? []) collectModule(mod);
|
|
8785
|
-
for (const mod of ctx.server.moduleGraph.getModulesByFile((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file)) ?? []) collectModule(mod);
|
|
8786
|
-
collectModule(ctx.server.moduleGraph.getModuleById?.(ctx.file));
|
|
8787
|
-
collectModule(ctx.server.moduleGraph.getModuleById?.((0, _weapp_tailwindcss_shared.cleanUrl)(ctx.file)));
|
|
8788
|
-
return modules;
|
|
8789
|
-
}
|
|
8790
|
-
function resolveModuleHotUrl(mod) {
|
|
8791
|
-
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
8792
|
-
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
8793
|
-
}
|
|
8794
|
-
function isAbsoluteFilePath(file) {
|
|
8795
|
-
return node_path.default.isAbsolute(file) || /^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\");
|
|
8796
|
-
}
|
|
8797
|
-
function normalizeAbsoluteFilePath(file) {
|
|
8798
|
-
if (/^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\")) return slash(node_path.default.win32.resolve(file));
|
|
8799
|
-
return slash(node_path.default.resolve(file));
|
|
8800
|
-
}
|
|
8801
|
-
function isRootMiniProgramStyleUrl(file) {
|
|
8802
|
-
return /^\/[^/]+\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
8803
|
-
}
|
|
8804
|
-
function resolveCssHotUrl(id, root) {
|
|
8805
|
-
const suffix = /[?#]/.test(id) ? id.slice(id.search(/[?#]/)) : "";
|
|
8806
|
-
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
8807
|
-
if (/^\/(?![A-Z]:)/i.test(file) && !file.startsWith(slash(root))) {
|
|
8808
|
-
if (isRootMiniProgramStyleUrl(file)) return;
|
|
8809
|
-
return `${file}${suffix}`;
|
|
8810
|
-
}
|
|
8811
|
-
if (!isAbsoluteFilePath(file)) return;
|
|
8812
|
-
const normalizedRoot = normalizeAbsoluteFilePath(root);
|
|
8813
|
-
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
8814
|
-
if (!normalizedFile.startsWith(`${normalizedRoot}/`)) return;
|
|
8815
|
-
return `/${slash(node_path.default.relative(normalizedRoot, normalizedFile))}${suffix}`;
|
|
8816
|
-
}
|
|
8817
|
-
function includesHotModule(modules, target) {
|
|
8818
|
-
const targetUrl = resolveModuleHotUrl(target);
|
|
8819
|
-
const targetId = target.id;
|
|
8820
|
-
return modules.some((mod) => {
|
|
8821
|
-
if (mod === target) return true;
|
|
8822
|
-
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
8823
|
-
});
|
|
8824
|
-
}
|
|
8825
|
-
function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
8826
|
-
return {
|
|
8827
|
-
type: "js-update",
|
|
8828
|
-
timestamp,
|
|
8829
|
-
path: hotUrl,
|
|
8830
|
-
acceptedPath: hotUrl,
|
|
8831
|
-
explicitImportRequired: false,
|
|
8832
|
-
isWithinCircularImport: false
|
|
8833
|
-
};
|
|
8834
|
-
}
|
|
8835
|
-
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
8836
|
-
return modules.some((mod) => {
|
|
8837
|
-
return !require_v4_generation_core.isSourceStyleRequest(mod.id ?? mod.url) && mod.isSelfAccepting === true;
|
|
8838
|
-
});
|
|
8839
|
-
}
|
|
8840
|
-
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = []) {
|
|
8841
|
-
const seenUrls = /* @__PURE__ */ new Set();
|
|
8842
|
-
const root = ctx.server.config?.root ?? node_process.default.cwd();
|
|
8843
|
-
const updates = [];
|
|
8844
|
-
for (const id of fallbackCssIds) {
|
|
8845
|
-
if (!require_v4_generation_core.isSourceStyleRequest(id)) continue;
|
|
8846
|
-
const hotUrl = resolveCssHotUrl(id, root);
|
|
8847
|
-
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
8848
|
-
seenUrls.add(hotUrl);
|
|
8849
|
-
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
8850
|
-
}
|
|
8851
|
-
for (const mod of cssModules) {
|
|
8852
|
-
if (includesHotModule(ctx.modules, mod)) continue;
|
|
8853
|
-
const moduleHotUrl = resolveModuleHotUrl(mod);
|
|
8854
|
-
const hotUrl = moduleHotUrl ? resolveCssHotUrl(moduleHotUrl, root) : void 0;
|
|
8855
|
-
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
8856
|
-
seenUrls.add(hotUrl);
|
|
8857
|
-
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
8858
|
-
}
|
|
8859
|
-
if (updates.length === 0) return;
|
|
8860
|
-
queueMicrotask(() => {
|
|
8861
|
-
ctx.server.ws?.send?.({
|
|
8862
|
-
type: "update",
|
|
8863
|
-
updates
|
|
8864
|
-
});
|
|
8865
|
-
});
|
|
8866
|
-
}
|
|
8867
|
-
function sendFullReloadForUnresolvedHotUpdate(ctx) {
|
|
8868
|
-
ctx.server.ws?.send?.({
|
|
8869
|
-
type: "full-reload",
|
|
8870
|
-
path: "*",
|
|
8871
|
-
triggeredBy: ctx.file
|
|
8872
|
-
});
|
|
8873
|
-
}
|
|
8874
|
-
//#endregion
|
|
8875
8999
|
//#region src/bundlers/vite/shared/framework-source-candidates-plugin.ts
|
|
8876
9000
|
function createFrameworkSourceCandidatesPlugin(options) {
|
|
8877
9001
|
return {
|
|
@@ -9792,7 +9916,9 @@ ${tracedCss}`;
|
|
|
9792
9916
|
mainCssChunkMatcher,
|
|
9793
9917
|
runtimeState,
|
|
9794
9918
|
styleHandler,
|
|
9795
|
-
|
|
9919
|
+
tailwindRootCssModuleIds,
|
|
9920
|
+
uniAppX,
|
|
9921
|
+
viteProcessedCssSourceFiles: processedCssRegistry.sourceFiles
|
|
9796
9922
|
}) ?? [];
|
|
9797
9923
|
const installFrameworkWatchCssCacheAdapter = async (config) => {
|
|
9798
9924
|
if (!shouldAdaptFrameworkWatchCss()) return;
|
|
@@ -10201,7 +10327,9 @@ function createUniAppXVitePlugins(options = {}) {
|
|
|
10201
10327
|
mainCssChunkMatcher: context.mainCssChunkMatcher,
|
|
10202
10328
|
runtimeState: context.runtimeState,
|
|
10203
10329
|
styleHandler: context.styleHandler,
|
|
10204
|
-
|
|
10330
|
+
tailwindRootCssModuleIds: context.tailwindRootCssModuleIds,
|
|
10331
|
+
uniAppX: context.uniAppX,
|
|
10332
|
+
viteProcessedCssSourceFiles: context.viteProcessedCssSourceFiles
|
|
10205
10333
|
})
|
|
10206
10334
|
});
|
|
10207
10335
|
}
|
|
@@ -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/
|
|
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
|
-
|
|
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
|
|
2466
|
-
return declarations.length > 0 && declarations.every(
|
|
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
|
|
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();
|
|
@@ -5657,6 +5747,168 @@ function createUniAppXHarmonyApplyExpander(options) {
|
|
|
5657
5747
|
};
|
|
5658
5748
|
}
|
|
5659
5749
|
//#endregion
|
|
5750
|
+
//#region src/bundlers/vite/hot-css-modules.ts
|
|
5751
|
+
function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
5752
|
+
const modules = [];
|
|
5753
|
+
const seenModules = /* @__PURE__ */ new Set();
|
|
5754
|
+
const root = ctx.server.config?.root ?? process$1.cwd();
|
|
5755
|
+
const outDir = ctx.server.config?.build?.outDir ? normalizeAbsoluteFilePath(path.resolve(root, ctx.server.config.build.outDir)) : void 0;
|
|
5756
|
+
const isHotSourceStyleModule = (id) => {
|
|
5757
|
+
if (!isSourceStyleRequest(id)) return false;
|
|
5758
|
+
const file = cleanUrl(id);
|
|
5759
|
+
if (isRootMiniProgramStyleUrl(file) || !isAbsoluteFilePath(file) && !file.startsWith("/")) return false;
|
|
5760
|
+
if (outDir && isAbsoluteFilePath(file)) {
|
|
5761
|
+
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
5762
|
+
if (normalizedFile === outDir || normalizedFile.startsWith(`${outDir}/`)) return false;
|
|
5763
|
+
}
|
|
5764
|
+
return true;
|
|
5765
|
+
};
|
|
5766
|
+
const collectModule = (mod) => {
|
|
5767
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
5768
|
+
const modId = mod.id ?? mod.url;
|
|
5769
|
+
if (!isHotSourceStyleModule(modId)) return;
|
|
5770
|
+
seenModules.add(mod);
|
|
5771
|
+
ctx.server.moduleGraph.invalidateModule(mod);
|
|
5772
|
+
modules.push(mod);
|
|
5773
|
+
};
|
|
5774
|
+
for (const id of tailwindRootCssModuleIds) {
|
|
5775
|
+
const candidates = [
|
|
5776
|
+
ctx.server.moduleGraph.getModuleById(id),
|
|
5777
|
+
ctx.server.moduleGraph.getModuleById(cleanUrl(id)),
|
|
5778
|
+
...ctx.server.moduleGraph.getModulesByFile(id) ?? [],
|
|
5779
|
+
...ctx.server.moduleGraph.getModulesByFile(cleanUrl(id)) ?? []
|
|
5780
|
+
];
|
|
5781
|
+
for (const mod of candidates) collectModule(mod);
|
|
5782
|
+
}
|
|
5783
|
+
return modules;
|
|
5784
|
+
}
|
|
5785
|
+
function resolveHotSourceModules(ctx) {
|
|
5786
|
+
const modules = [];
|
|
5787
|
+
const seenModules = /* @__PURE__ */ new Set();
|
|
5788
|
+
const collectModule = (mod) => {
|
|
5789
|
+
if (mod == null || seenModules.has(mod)) return;
|
|
5790
|
+
if (isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
5791
|
+
seenModules.add(mod);
|
|
5792
|
+
modules.push(mod);
|
|
5793
|
+
};
|
|
5794
|
+
for (const mod of ctx.modules) collectModule(mod);
|
|
5795
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile(ctx.file) ?? []) collectModule(mod);
|
|
5796
|
+
for (const mod of ctx.server.moduleGraph.getModulesByFile(cleanUrl(ctx.file)) ?? []) collectModule(mod);
|
|
5797
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.(ctx.file));
|
|
5798
|
+
collectModule(ctx.server.moduleGraph.getModuleById?.(cleanUrl(ctx.file)));
|
|
5799
|
+
return modules;
|
|
5800
|
+
}
|
|
5801
|
+
function resolveModuleHotUrl(mod) {
|
|
5802
|
+
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
5803
|
+
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
5804
|
+
}
|
|
5805
|
+
function isAbsoluteFilePath(file) {
|
|
5806
|
+
return path.isAbsolute(file) || /^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\");
|
|
5807
|
+
}
|
|
5808
|
+
function normalizeAbsoluteFilePath(file) {
|
|
5809
|
+
if (/^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\")) return slash(path.win32.resolve(file));
|
|
5810
|
+
return slash(path.resolve(file));
|
|
5811
|
+
}
|
|
5812
|
+
function isRootMiniProgramStyleUrl(file) {
|
|
5813
|
+
return /^\/[^/]+\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
5814
|
+
}
|
|
5815
|
+
function resolveCssHotUrl(id, root) {
|
|
5816
|
+
const suffix = /[?#]/.test(id) ? id.slice(id.search(/[?#]/)) : "";
|
|
5817
|
+
const file = cleanUrl(id);
|
|
5818
|
+
if (/^\/(?![A-Z]:)/i.test(file) && !file.startsWith(slash(root))) {
|
|
5819
|
+
if (isRootMiniProgramStyleUrl(file)) return;
|
|
5820
|
+
return `${file}${suffix}`;
|
|
5821
|
+
}
|
|
5822
|
+
if (!isAbsoluteFilePath(file)) return;
|
|
5823
|
+
const normalizedRoot = normalizeAbsoluteFilePath(root);
|
|
5824
|
+
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
5825
|
+
if (!normalizedFile.startsWith(`${normalizedRoot}/`)) return;
|
|
5826
|
+
return `/${slash(path.relative(normalizedRoot, normalizedFile))}${suffix}`;
|
|
5827
|
+
}
|
|
5828
|
+
function includesHotModule(modules, target) {
|
|
5829
|
+
const targetUrl = resolveModuleHotUrl(target);
|
|
5830
|
+
const targetId = target.id;
|
|
5831
|
+
return modules.some((mod) => {
|
|
5832
|
+
if (mod === target) return true;
|
|
5833
|
+
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
5834
|
+
});
|
|
5835
|
+
}
|
|
5836
|
+
function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
5837
|
+
return {
|
|
5838
|
+
type: "js-update",
|
|
5839
|
+
timestamp,
|
|
5840
|
+
path: hotUrl,
|
|
5841
|
+
acceptedPath: hotUrl,
|
|
5842
|
+
explicitImportRequired: false,
|
|
5843
|
+
isWithinCircularImport: false
|
|
5844
|
+
};
|
|
5845
|
+
}
|
|
5846
|
+
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
5847
|
+
return modules.some((mod) => {
|
|
5848
|
+
return !isSourceStyleRequest(mod.id ?? mod.url) && mod.isSelfAccepting === true;
|
|
5849
|
+
});
|
|
5850
|
+
}
|
|
5851
|
+
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = []) {
|
|
5852
|
+
const seenUrls = /* @__PURE__ */ new Set();
|
|
5853
|
+
const root = ctx.server.config?.root ?? process$1.cwd();
|
|
5854
|
+
const updates = [];
|
|
5855
|
+
for (const id of fallbackCssIds) {
|
|
5856
|
+
if (!isSourceStyleRequest(id)) continue;
|
|
5857
|
+
const hotUrl = resolveCssHotUrl(id, root);
|
|
5858
|
+
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
5859
|
+
seenUrls.add(hotUrl);
|
|
5860
|
+
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
5861
|
+
}
|
|
5862
|
+
for (const mod of cssModules) {
|
|
5863
|
+
if (includesHotModule(ctx.modules, mod)) continue;
|
|
5864
|
+
const moduleHotUrl = resolveModuleHotUrl(mod);
|
|
5865
|
+
const hotUrl = moduleHotUrl ? resolveCssHotUrl(moduleHotUrl, root) : void 0;
|
|
5866
|
+
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
5867
|
+
seenUrls.add(hotUrl);
|
|
5868
|
+
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
5869
|
+
}
|
|
5870
|
+
if (updates.length === 0) return;
|
|
5871
|
+
queueMicrotask(() => {
|
|
5872
|
+
ctx.server.ws?.send?.({
|
|
5873
|
+
type: "update",
|
|
5874
|
+
updates
|
|
5875
|
+
});
|
|
5876
|
+
});
|
|
5877
|
+
}
|
|
5878
|
+
function sendFullReloadForUnresolvedHotUpdate(ctx) {
|
|
5879
|
+
ctx.server.ws?.send?.({
|
|
5880
|
+
type: "full-reload",
|
|
5881
|
+
path: "*",
|
|
5882
|
+
triggeredBy: ctx.file
|
|
5883
|
+
});
|
|
5884
|
+
}
|
|
5885
|
+
//#endregion
|
|
5886
|
+
//#region src/uni-app-x/vite/native-hmr.ts
|
|
5887
|
+
function createUniAppXNativeHmrReloader(options) {
|
|
5888
|
+
let previousRuntimeClassSet;
|
|
5889
|
+
function remember(runtimeClassSet) {
|
|
5890
|
+
previousRuntimeClassSet = new Set(runtimeClassSet);
|
|
5891
|
+
return runtimeClassSet;
|
|
5892
|
+
}
|
|
5893
|
+
async function refreshBaseline() {
|
|
5894
|
+
return remember(await options.ensureRuntimeClassSet(true));
|
|
5895
|
+
}
|
|
5896
|
+
async function handleHotUpdate(ctx) {
|
|
5897
|
+
if (!options.isNativeAppBuildTarget(ctx.file)) return;
|
|
5898
|
+
const cssModules = ctx.server?.moduleGraph ? resolveHotTailwindCssModules(ctx, /* @__PURE__ */ new Set([...options.tailwindRootCssModuleIds, ...options.viteProcessedCssSourceFiles])) : [];
|
|
5899
|
+
const currentRuntimeClassSet = await options.ensureRuntimeClassSet(true);
|
|
5900
|
+
const hasAddedClass = previousRuntimeClassSet !== void 0 && [...currentRuntimeClassSet].some((candidate) => !previousRuntimeClassSet.has(candidate));
|
|
5901
|
+
remember(currentRuntimeClassSet);
|
|
5902
|
+
if (hasAddedClass) sendFullReloadForUnresolvedHotUpdate(ctx);
|
|
5903
|
+
return cssModules.length > 0 ? [.../* @__PURE__ */ new Set([...ctx.modules, ...cssModules])] : void 0;
|
|
5904
|
+
}
|
|
5905
|
+
return {
|
|
5906
|
+
handleHotUpdate,
|
|
5907
|
+
refreshBaseline,
|
|
5908
|
+
remember
|
|
5909
|
+
};
|
|
5910
|
+
}
|
|
5911
|
+
//#endregion
|
|
5660
5912
|
//#region src/uni-app-x/vite/native-target.ts
|
|
5661
5913
|
function createUniAppXNativeBuildTargetResolver(getResolvedConfig) {
|
|
5662
5914
|
let observedNativeAppBuildTarget = false;
|
|
@@ -5703,13 +5955,19 @@ function isCssModuleExport(code) {
|
|
|
5703
5955
|
return CSS_MODULE_EXPORT_RE.test(code);
|
|
5704
5956
|
}
|
|
5705
5957
|
function createUniAppXPlugins(options) {
|
|
5706
|
-
const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, runtimeState, styleHandler, generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, uniAppX } = options;
|
|
5958
|
+
const { appType, customAttributesEntities, disabledDefaultTemplateHandler, isIosPlatform: providedIosPlatform, mainCssChunkMatcher, runtimeState, styleHandler, tailwindRootCssModuleIds = [], generateCss, jsHandler, ensureRuntimeClassSet, getResolvedConfig, isEnabled = () => true, uniAppX, viteProcessedCssSourceFiles = [] } = options;
|
|
5707
5959
|
const resolvedUniAppXOptions = resolveUniAppXOptions(uniAppX);
|
|
5708
5960
|
const utsPlatform = resolveUniUtsPlatform();
|
|
5709
5961
|
const isIosPlatform = providedIosPlatform ?? utsPlatform.isAppIos;
|
|
5710
5962
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
5711
5963
|
let componentLocalStyleEnabled;
|
|
5712
5964
|
const isNativeAppBuildTarget = createUniAppXNativeBuildTargetResolver(getResolvedConfig);
|
|
5965
|
+
const nativeHmrReloader = createUniAppXNativeHmrReloader({
|
|
5966
|
+
ensureRuntimeClassSet,
|
|
5967
|
+
isNativeAppBuildTarget,
|
|
5968
|
+
tailwindRootCssModuleIds,
|
|
5969
|
+
viteProcessedCssSourceFiles
|
|
5970
|
+
});
|
|
5713
5971
|
function shouldEnableComponentLocalStyle() {
|
|
5714
5972
|
if (!resolvedUniAppXOptions.componentLocalStyles.enabled) {
|
|
5715
5973
|
componentLocalStyleEnabled = false;
|
|
@@ -5737,7 +5995,7 @@ function createUniAppXPlugins(options) {
|
|
|
5737
5995
|
if (!styleHandlerOptions) {
|
|
5738
5996
|
styleHandlerOptions = omitUndefined({
|
|
5739
5997
|
isMainChunk: mainCssChunkMatcher(id, appType),
|
|
5740
|
-
uniAppXCssTarget: resolveUniAppXCssTarget(id),
|
|
5998
|
+
uniAppXCssTarget: isNativeAppBuildTarget(id) ? resolveUniAppXCssTarget(id) : void 0,
|
|
5741
5999
|
uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
|
|
5742
6000
|
postcssOptions: { options: {
|
|
5743
6001
|
from: id,
|
|
@@ -5762,6 +6020,7 @@ function createUniAppXPlugins(options) {
|
|
|
5762
6020
|
if (isCSSRequest(id) || parsed.vue && parsed.type === "style") {
|
|
5763
6021
|
if (isCssModuleExport(code)) return;
|
|
5764
6022
|
const shouldGenerateCss = hasTailwindSourceDirectives(code, { importFallback: true }) || hasTailwindApplyDirective(code);
|
|
6023
|
+
if (!isNativeAppBuildTarget(id) && !shouldGenerateCss) return;
|
|
5765
6024
|
harmonyApply.rememberSource(code, id);
|
|
5766
6025
|
const generatedCss = shouldGenerateCss ? await generateCss?.(id, code, hookContext) : void 0;
|
|
5767
6026
|
const styleCode = typeof generatedCss === "string" && generatedCss.trim().length > 0 ? generatedCss : code;
|
|
@@ -5815,7 +6074,7 @@ function createUniAppXPlugins(options) {
|
|
|
5815
6074
|
enforce: "pre",
|
|
5816
6075
|
async buildStart() {
|
|
5817
6076
|
if (!isEnabled()) return;
|
|
5818
|
-
await
|
|
6077
|
+
await nativeHmrReloader.refreshBaseline();
|
|
5819
6078
|
},
|
|
5820
6079
|
async transform(code, id) {
|
|
5821
6080
|
if (!isEnabled()) return;
|
|
@@ -5827,6 +6086,7 @@ function createUniAppXPlugins(options) {
|
|
|
5827
6086
|
const isWatchBuild = resolvedConfig?.command === "build" && !!resolvedConfig.build?.watch;
|
|
5828
6087
|
const isNonWatchBuild = resolvedConfig?.command === "build" && !resolvedConfig.build?.watch;
|
|
5829
6088
|
const currentRuntimeSet = isServeCommand || isWatchBuild || isNonWatchBuild ? await ensureRuntimeClassSet(true) : await ensureRuntimeClassSet();
|
|
6089
|
+
nativeHmrReloader.remember(currentRuntimeSet);
|
|
5830
6090
|
const transformUVue = await loadTransformUVue();
|
|
5831
6091
|
const enableComponentLocalStyle = shouldEnableComponentLocalStyle();
|
|
5832
6092
|
const enablePageLocalStyle = shouldEnableNativePageLocalStyle(id);
|
|
@@ -5850,7 +6110,7 @@ function createUniAppXPlugins(options) {
|
|
|
5850
6110
|
if (!isEnabled()) return;
|
|
5851
6111
|
if (getResolvedConfig()?.command !== "serve") return;
|
|
5852
6112
|
if (!UVUE_NVUE_RE.test(ctx.file)) return;
|
|
5853
|
-
|
|
6113
|
+
return nativeHmrReloader.handleHotUpdate(ctx);
|
|
5854
6114
|
},
|
|
5855
6115
|
async watchChange(id) {
|
|
5856
6116
|
if (!isEnabled()) return;
|
|
@@ -8755,142 +9015,6 @@ function sameStringList(first, second) {
|
|
|
8755
9015
|
return first.every((item, index) => item === second[index]);
|
|
8756
9016
|
}
|
|
8757
9017
|
//#endregion
|
|
8758
|
-
//#region src/bundlers/vite/hot-css-modules.ts
|
|
8759
|
-
function resolveHotTailwindCssModules(ctx, tailwindRootCssModuleIds) {
|
|
8760
|
-
const modules = [];
|
|
8761
|
-
const seenModules = /* @__PURE__ */ new Set();
|
|
8762
|
-
const root = ctx.server.config?.root ?? process$1.cwd();
|
|
8763
|
-
const outDir = ctx.server.config?.build?.outDir ? normalizeAbsoluteFilePath(path.resolve(root, ctx.server.config.build.outDir)) : void 0;
|
|
8764
|
-
const isHotSourceStyleModule = (id) => {
|
|
8765
|
-
if (!isSourceStyleRequest(id)) return false;
|
|
8766
|
-
const file = cleanUrl(id);
|
|
8767
|
-
if (isRootMiniProgramStyleUrl(file) || !isAbsoluteFilePath(file) && !file.startsWith("/")) return false;
|
|
8768
|
-
if (outDir && isAbsoluteFilePath(file)) {
|
|
8769
|
-
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
8770
|
-
if (normalizedFile === outDir || normalizedFile.startsWith(`${outDir}/`)) return false;
|
|
8771
|
-
}
|
|
8772
|
-
return true;
|
|
8773
|
-
};
|
|
8774
|
-
const collectModule = (mod) => {
|
|
8775
|
-
if (mod == null || seenModules.has(mod)) return;
|
|
8776
|
-
const modId = mod.id ?? mod.url;
|
|
8777
|
-
if (!isHotSourceStyleModule(modId)) return;
|
|
8778
|
-
seenModules.add(mod);
|
|
8779
|
-
ctx.server.moduleGraph.invalidateModule(mod);
|
|
8780
|
-
modules.push(mod);
|
|
8781
|
-
};
|
|
8782
|
-
for (const id of tailwindRootCssModuleIds) {
|
|
8783
|
-
const candidates = [
|
|
8784
|
-
ctx.server.moduleGraph.getModuleById(id),
|
|
8785
|
-
ctx.server.moduleGraph.getModuleById(cleanUrl(id)),
|
|
8786
|
-
...ctx.server.moduleGraph.getModulesByFile(id) ?? [],
|
|
8787
|
-
...ctx.server.moduleGraph.getModulesByFile(cleanUrl(id)) ?? []
|
|
8788
|
-
];
|
|
8789
|
-
for (const mod of candidates) collectModule(mod);
|
|
8790
|
-
}
|
|
8791
|
-
return modules;
|
|
8792
|
-
}
|
|
8793
|
-
function resolveHotSourceModules(ctx) {
|
|
8794
|
-
const modules = [];
|
|
8795
|
-
const seenModules = /* @__PURE__ */ new Set();
|
|
8796
|
-
const collectModule = (mod) => {
|
|
8797
|
-
if (mod == null || seenModules.has(mod)) return;
|
|
8798
|
-
if (isSourceStyleRequest(mod.id ?? mod.url)) return;
|
|
8799
|
-
seenModules.add(mod);
|
|
8800
|
-
modules.push(mod);
|
|
8801
|
-
};
|
|
8802
|
-
for (const mod of ctx.modules) collectModule(mod);
|
|
8803
|
-
for (const mod of ctx.server.moduleGraph.getModulesByFile(ctx.file) ?? []) collectModule(mod);
|
|
8804
|
-
for (const mod of ctx.server.moduleGraph.getModulesByFile(cleanUrl(ctx.file)) ?? []) collectModule(mod);
|
|
8805
|
-
collectModule(ctx.server.moduleGraph.getModuleById?.(ctx.file));
|
|
8806
|
-
collectModule(ctx.server.moduleGraph.getModuleById?.(cleanUrl(ctx.file)));
|
|
8807
|
-
return modules;
|
|
8808
|
-
}
|
|
8809
|
-
function resolveModuleHotUrl(mod) {
|
|
8810
|
-
if (typeof mod.url === "string" && mod.url.length > 0) return mod.url;
|
|
8811
|
-
if (typeof mod.id === "string" && mod.id.startsWith("/")) return mod.id;
|
|
8812
|
-
}
|
|
8813
|
-
function isAbsoluteFilePath(file) {
|
|
8814
|
-
return path.isAbsolute(file) || /^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\");
|
|
8815
|
-
}
|
|
8816
|
-
function normalizeAbsoluteFilePath(file) {
|
|
8817
|
-
if (/^[A-Z]:[\\/]/i.test(file) || file.startsWith("\\\\")) return slash(path.win32.resolve(file));
|
|
8818
|
-
return slash(path.resolve(file));
|
|
8819
|
-
}
|
|
8820
|
-
function isRootMiniProgramStyleUrl(file) {
|
|
8821
|
-
return /^\/[^/]+\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(file);
|
|
8822
|
-
}
|
|
8823
|
-
function resolveCssHotUrl(id, root) {
|
|
8824
|
-
const suffix = /[?#]/.test(id) ? id.slice(id.search(/[?#]/)) : "";
|
|
8825
|
-
const file = cleanUrl(id);
|
|
8826
|
-
if (/^\/(?![A-Z]:)/i.test(file) && !file.startsWith(slash(root))) {
|
|
8827
|
-
if (isRootMiniProgramStyleUrl(file)) return;
|
|
8828
|
-
return `${file}${suffix}`;
|
|
8829
|
-
}
|
|
8830
|
-
if (!isAbsoluteFilePath(file)) return;
|
|
8831
|
-
const normalizedRoot = normalizeAbsoluteFilePath(root);
|
|
8832
|
-
const normalizedFile = normalizeAbsoluteFilePath(file);
|
|
8833
|
-
if (!normalizedFile.startsWith(`${normalizedRoot}/`)) return;
|
|
8834
|
-
return `/${slash(path.relative(normalizedRoot, normalizedFile))}${suffix}`;
|
|
8835
|
-
}
|
|
8836
|
-
function includesHotModule(modules, target) {
|
|
8837
|
-
const targetUrl = resolveModuleHotUrl(target);
|
|
8838
|
-
const targetId = target.id;
|
|
8839
|
-
return modules.some((mod) => {
|
|
8840
|
-
if (mod === target) return true;
|
|
8841
|
-
return targetUrl !== void 0 && resolveModuleHotUrl(mod) === targetUrl || typeof targetId === "string" && targetId.length > 0 && mod.id === targetId;
|
|
8842
|
-
});
|
|
8843
|
-
}
|
|
8844
|
-
function createSupplementalHotUpdate(hotUrl, timestamp) {
|
|
8845
|
-
return {
|
|
8846
|
-
type: "js-update",
|
|
8847
|
-
timestamp,
|
|
8848
|
-
path: hotUrl,
|
|
8849
|
-
acceptedPath: hotUrl,
|
|
8850
|
-
explicitImportRequired: false,
|
|
8851
|
-
isWithinCircularImport: false
|
|
8852
|
-
};
|
|
8853
|
-
}
|
|
8854
|
-
function hasSelfAcceptingNonStyleHotModule(modules) {
|
|
8855
|
-
return modules.some((mod) => {
|
|
8856
|
-
return !isSourceStyleRequest(mod.id ?? mod.url) && mod.isSelfAccepting === true;
|
|
8857
|
-
});
|
|
8858
|
-
}
|
|
8859
|
-
function sendSupplementalCssHotUpdates(ctx, cssModules, fallbackCssIds = []) {
|
|
8860
|
-
const seenUrls = /* @__PURE__ */ new Set();
|
|
8861
|
-
const root = ctx.server.config?.root ?? process$1.cwd();
|
|
8862
|
-
const updates = [];
|
|
8863
|
-
for (const id of fallbackCssIds) {
|
|
8864
|
-
if (!isSourceStyleRequest(id)) continue;
|
|
8865
|
-
const hotUrl = resolveCssHotUrl(id, root);
|
|
8866
|
-
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
8867
|
-
seenUrls.add(hotUrl);
|
|
8868
|
-
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
8869
|
-
}
|
|
8870
|
-
for (const mod of cssModules) {
|
|
8871
|
-
if (includesHotModule(ctx.modules, mod)) continue;
|
|
8872
|
-
const moduleHotUrl = resolveModuleHotUrl(mod);
|
|
8873
|
-
const hotUrl = moduleHotUrl ? resolveCssHotUrl(moduleHotUrl, root) : void 0;
|
|
8874
|
-
if (!hotUrl || seenUrls.has(hotUrl)) continue;
|
|
8875
|
-
seenUrls.add(hotUrl);
|
|
8876
|
-
updates.push(createSupplementalHotUpdate(hotUrl, ctx.timestamp));
|
|
8877
|
-
}
|
|
8878
|
-
if (updates.length === 0) return;
|
|
8879
|
-
queueMicrotask(() => {
|
|
8880
|
-
ctx.server.ws?.send?.({
|
|
8881
|
-
type: "update",
|
|
8882
|
-
updates
|
|
8883
|
-
});
|
|
8884
|
-
});
|
|
8885
|
-
}
|
|
8886
|
-
function sendFullReloadForUnresolvedHotUpdate(ctx) {
|
|
8887
|
-
ctx.server.ws?.send?.({
|
|
8888
|
-
type: "full-reload",
|
|
8889
|
-
path: "*",
|
|
8890
|
-
triggeredBy: ctx.file
|
|
8891
|
-
});
|
|
8892
|
-
}
|
|
8893
|
-
//#endregion
|
|
8894
9018
|
//#region src/bundlers/vite/shared/framework-source-candidates-plugin.ts
|
|
8895
9019
|
function createFrameworkSourceCandidatesPlugin(options) {
|
|
8896
9020
|
return {
|
|
@@ -9811,7 +9935,9 @@ ${tracedCss}`;
|
|
|
9811
9935
|
mainCssChunkMatcher,
|
|
9812
9936
|
runtimeState,
|
|
9813
9937
|
styleHandler,
|
|
9814
|
-
|
|
9938
|
+
tailwindRootCssModuleIds,
|
|
9939
|
+
uniAppX,
|
|
9940
|
+
viteProcessedCssSourceFiles: processedCssRegistry.sourceFiles
|
|
9815
9941
|
}) ?? [];
|
|
9816
9942
|
const installFrameworkWatchCssCacheAdapter = async (config) => {
|
|
9817
9943
|
if (!shouldAdaptFrameworkWatchCss()) return;
|
|
@@ -10220,7 +10346,9 @@ function createUniAppXVitePlugins(options = {}) {
|
|
|
10220
10346
|
mainCssChunkMatcher: context.mainCssChunkMatcher,
|
|
10221
10347
|
runtimeState: context.runtimeState,
|
|
10222
10348
|
styleHandler: context.styleHandler,
|
|
10223
|
-
|
|
10349
|
+
tailwindRootCssModuleIds: context.tailwindRootCssModuleIds,
|
|
10350
|
+
uniAppX: context.uniAppX,
|
|
10351
|
+
viteProcessedCssSourceFiles: context.viteProcessedCssSourceFiles
|
|
10224
10352
|
})
|
|
10225
10353
|
});
|
|
10226
10354
|
}
|
package/dist/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-AB_sUPv9.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-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-Dafw4jK-.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.
|
|
4
|
+
"version": "5.2.5",
|
|
5
5
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -216,14 +216,14 @@
|
|
|
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.
|
|
219
|
+
"@weapp-tailwindcss/postcss": "3.2.5",
|
|
220
220
|
"@weapp-tailwindcss/reset": "0.1.2",
|
|
221
221
|
"@weapp-tailwindcss/shared": "2.0.1",
|
|
222
222
|
"tailwindcss-config": "2.0.2",
|
|
223
223
|
"weapp-style-injector": "1.0.2"
|
|
224
224
|
},
|
|
225
225
|
"devDependencies": {
|
|
226
|
-
"@mpxjs/webpack-plugin": "^2.11.
|
|
226
|
+
"@mpxjs/webpack-plugin": "^2.11.1",
|
|
227
227
|
"webpack": "5.105.4"
|
|
228
228
|
},
|
|
229
229
|
"scripts": {
|