weapp-tailwindcss 5.5.2 → 5.5.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.
- package/dist/compiler/cache-telemetry.d.ts +30 -0
- package/dist/compiler/candidate-index.d.ts +3 -0
- package/dist/compiler/capabilities.d.ts +37 -0
- package/dist/compiler/events.d.ts +38 -1
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/runtime-state.d.ts +2 -1
- package/dist/{compiler-tHMcW3BT.js → compiler-CJ5yX-on.js} +70 -22
- package/dist/{compiler-BSMSbVVt.cjs → compiler-DFROuh5Z.cjs} +70 -23
- package/dist/core/compiler/types.d.ts +2 -0
- package/dist/core.cjs +57 -8
- package/dist/core.d.ts +3 -0
- package/dist/core.js +56 -7
- package/dist/{css-imports-DsCSPIj2.cjs → css-imports-_5cwJnx-.cjs} +1 -1
- package/dist/{generator-DxEsInLz.js → generator-BgbYHNgD.js} +87 -23
- package/dist/{generator-CCw17l0G.cjs → generator-RK2HtgOb.cjs} +87 -23
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-C1r36Y_f.cjs → gulp-BS7fTmyj.cjs} +16 -6
- package/dist/{gulp-qGXKwQMZ.js → gulp-nl-2p5Dw.js} +14 -4
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-DixZjtTS.js → hmr-timing-BfxWwMeT.js} +3 -3
- package/dist/{hmr-timing-DuIbach8.cjs → hmr-timing-D45cTIzM.cjs} +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{pipeline-helpers-CUwwOFt3.cjs → pipeline-helpers-BEhISt4D.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{runtime-state-BBQcA0n5.cjs → runtime-state-XYSycuGu.cjs} +6 -0
- package/dist/{scoped-generator-CO9xZ06m.cjs → scoped-generator-DccPwmJT.cjs} +3 -3
- package/dist/{scoped-generator-BJvL2CKZ.js → scoped-generator-Dqq2iLky.js} +3 -3
- package/dist/{source-candidate-scan-signature-CgJi--lh.js → source-candidate-scan-signature-BJkQJtRM.js} +2 -2
- package/dist/{source-candidate-scan-signature-_UPwg8oJ.cjs → source-candidate-scan-signature-CnUlGWhP.cjs} +2 -2
- package/dist/{tailwindcss-DhaLV5a2.cjs → tailwindcss-B03BGeTO.cjs} +1 -1
- package/dist/{tailwindcss-D2joPNdN.js → tailwindcss-o3Xe-o7M.js} +1 -1
- package/dist/{transform-BNtyKkZi.js → transform-BVH7iLHn.js} +3 -3
- package/dist/{transform-DAg85t9Z.cjs → transform-MIhriZRr.cjs} +3 -3
- package/dist/uni-app-x/style-reference-path.d.ts +1 -0
- package/dist/uni-app-x/vite/style-request.d.ts +5 -0
- package/dist/uni-app-x/vite/style-source.d.ts +1 -1
- package/dist/uni-app-x/vite/web-sfc-hmr.d.ts +14 -0
- package/dist/{v4-generation-core-bOm8k4AY.cjs → v4-generation-core-BvW2aK23.cjs} +3 -3
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-bJZi1V-l.cjs → vite-4RznbXVI.cjs} +86 -39
- package/dist/{vite-C_JJxZWl.js → vite-hGECCqfq.js} +85 -38
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +6 -6
- package/dist/{web-BiubXhxs.js → web-0FAisq6H.js} +50 -13
- package/dist/{web-B4wa3xrE.cjs → web-DQZ27KWH.cjs} +53 -16
- package/dist/{webpack-BDOQUv3J.js → webpack-8cQlXIo4.js} +16 -6
- package/dist/{webpack-CsBe1G_1.cjs → webpack-DOQ_3ViW.cjs} +19 -9
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +2 -2
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
4
|
+
let node_process = require("node:process");
|
|
5
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
1
6
|
//#region src/compiler/events.ts
|
|
2
7
|
/** 创建跨 bundler 共用的生命周期事件总线。 */
|
|
3
8
|
function createCompilationEventBus() {
|
|
@@ -26,6 +31,7 @@ function createCompilationEventBus() {
|
|
|
26
31
|
/** 创建构建器无关的 runtime state,并保留旧字段供现有插件继续使用。 */
|
|
27
32
|
function createCompilerRuntimeState(options) {
|
|
28
33
|
const events = options.events ?? createCompilationEventBus();
|
|
34
|
+
if (options.reporter) events.subscribe(options.reporter);
|
|
29
35
|
return {
|
|
30
36
|
tailwindRuntime: options.tailwindRuntime,
|
|
31
37
|
readyPromise: options.readyPromise ?? Promise.resolve(),
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
3
|
require("./auto-DtU6f3X6.cjs");
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
6
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-B03BGeTO.cjs");
|
|
5
|
+
const require_v4_generation_core = require("./v4-generation-core-BvW2aK23.cjs");
|
|
6
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-CnUlGWhP.cjs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
9
9
|
let weapp_style_injector_vite = require("weapp-style-injector/vite");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { detectAppType } from "./framework.js";
|
|
2
2
|
import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-2dg_uhEJ.js";
|
|
3
|
-
import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-
|
|
4
|
-
import { C as isSourceStyleRequest } from "./hmr-timing-
|
|
5
|
-
import { o as normalizeStyleInjectorOptions } from "./source-candidate-scan-signature-
|
|
3
|
+
import { g as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-o3Xe-o7M.js";
|
|
4
|
+
import { C as isSourceStyleRequest } from "./hmr-timing-BfxWwMeT.js";
|
|
5
|
+
import { o as normalizeStyleInjectorOptions } from "./source-candidate-scan-signature-BJkQJtRM.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { weappStyleInjector } from "weapp-style-injector/vite";
|
|
8
8
|
import { StyleInjector } from "weapp-style-injector/vite/taro";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jt as toPosixPath } from "./generator-
|
|
2
|
-
import "./tailwindcss-
|
|
1
|
+
import { jt as toPosixPath } from "./generator-BgbYHNgD.js";
|
|
2
|
+
import "./tailwindcss-o3Xe-o7M.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
//#region src/style-injector/options.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
require("./tailwindcss-
|
|
2
|
+
const require_generator = require("./generator-RK2HtgOb.cjs");
|
|
3
|
+
require("./tailwindcss-B03BGeTO.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
6
|
let node_module = require("node:module");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-RK2HtgOb.cjs");
|
|
3
3
|
require("./utils-CuKLf1Zv.cjs");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as resolveTailwindV4CssSourceBase, C as findWorkspacePackageDir, Ct as expandTailwindSourceEntries, D as normalizeTailwindcssRuntimeOptions, Dt as parseConfigParam, E as normalizeExtendLengthUnits, Et as normalizeLegacyContentEntries, Lt as resolveCssMacroTailwindV4Source, O as resolveTailwindcssOptions, Ot as resolveCssSourceEntries, S as findNearestPackageRoot, St as FULL_SOURCE_SCAN_PATTERN, T as omitUndefined, Vt as loadTailwindV4DesignSystem, b as isTailwindV4CssEntry, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, k as normalizeStringListOption, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as groupCssEntriesByBase, w as findWorkspaceRoot, x as normalizeCssEntries, y as guessBasedirFromEntries } from "./generator-
|
|
1
|
+
import { At as resolveTailwindV4CssSourceBase, C as findWorkspacePackageDir, Ct as expandTailwindSourceEntries, D as normalizeTailwindcssRuntimeOptions, Dt as parseConfigParam, E as normalizeExtendLengthUnits, Et as normalizeLegacyContentEntries, Lt as resolveCssMacroTailwindV4Source, O as resolveTailwindcssOptions, Ot as resolveCssSourceEntries, S as findNearestPackageRoot, St as FULL_SOURCE_SCAN_PATTERN, T as omitUndefined, Vt as loadTailwindV4DesignSystem, b as isTailwindV4CssEntry, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, k as normalizeStringListOption, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as groupCssEntriesByBase, w as findWorkspaceRoot, x as normalizeCssEntries, y as guessBasedirFromEntries } from "./generator-BgbYHNgD.js";
|
|
2
2
|
import { n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Mt as _defineProperty } from "./generator-
|
|
2
|
-
import { G as replaceWxml, H as analyzeSource, J as traverse$1, U as JsTokenUpdater, V as createAttributeMatcher, W as isClassContextLiteralPath, _ as generateCode, q as babelParse } from "./compiler-
|
|
3
|
-
import { a as shouldEnablePageLocalStyle, i as shouldEnableComponentLocalStyle, n as injectBorderPreflightClass, o as isUniAppXStyleSourceEmpty, r as shouldInjectBorderPreflight } from "./vite-
|
|
1
|
+
import { Mt as _defineProperty } from "./generator-BgbYHNgD.js";
|
|
2
|
+
import { G as replaceWxml, H as analyzeSource, J as traverse$1, U as JsTokenUpdater, V as createAttributeMatcher, W as isClassContextLiteralPath, _ as generateCode, q as babelParse } from "./compiler-CJ5yX-on.js";
|
|
3
|
+
import { a as shouldEnablePageLocalStyle, i as shouldEnableComponentLocalStyle, n as injectBorderPreflightClass, o as isUniAppXStyleSourceEmpty, r as shouldInjectBorderPreflight } from "./vite-hGECCqfq.js";
|
|
4
4
|
import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
5
5
|
import { UNI_APP_X_IMPORTANT_APPLY_MARKER, normalizeUniAppXImportantApplyForSass } from "@weapp-tailwindcss/postcss";
|
|
6
6
|
import MagicString from "magic-string";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_generator = require("./generator-
|
|
2
|
-
const require_compiler = require("./compiler-
|
|
3
|
-
const require_vite = require("./vite-
|
|
1
|
+
const require_generator = require("./generator-RK2HtgOb.cjs");
|
|
2
|
+
const require_compiler = require("./compiler-DFROuh5Z.cjs");
|
|
3
|
+
const require_vite = require("./vite-4RznbXVI.cjs");
|
|
4
4
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
5
5
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
6
6
|
let _vue_compiler_dom = require("@vue/compiler-dom");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function resolveStyleReferencePath(sourceFile: string, request: string): string;
|
|
@@ -12,4 +12,9 @@ export declare function resolvePreprocessorTransform(code: string, id: string, l
|
|
|
12
12
|
map: null;
|
|
13
13
|
} | undefined;
|
|
14
14
|
} | undefined;
|
|
15
|
+
export declare function reportStyleWarnings(result: {
|
|
16
|
+
warnings?: () => {
|
|
17
|
+
toString: () => string;
|
|
18
|
+
}[];
|
|
19
|
+
}): void;
|
|
15
20
|
export {};
|
|
@@ -3,7 +3,7 @@ type VueStyleQuery = ReturnType<typeof parseVueRequest>['query'];
|
|
|
3
3
|
export declare function createUniAppXSfcStyleSources(): {
|
|
4
4
|
rememberSource(id: string, source: string): void;
|
|
5
5
|
rememberGenerated(id: string, source: string): void;
|
|
6
|
-
getGenerated(id: string, index: number)
|
|
6
|
+
getGenerated: (id: string, index: number) => string | undefined;
|
|
7
7
|
hasGenerated(id: string): boolean;
|
|
8
8
|
load(id: string, index: number): {
|
|
9
9
|
code: string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HmrContext } from 'vite';
|
|
2
|
+
import type { ViteHmrCssModuleVersionTracker } from '../../bundlers/vite/shared/framework-hmr-module-version.js';
|
|
3
|
+
interface WebSfcHmrOptions {
|
|
4
|
+
isEnabled: () => boolean;
|
|
5
|
+
transform: (source: string, id: string) => Promise<{
|
|
6
|
+
code: string;
|
|
7
|
+
} | undefined | null>;
|
|
8
|
+
hmrCssModuleVersions: ViteHmrCssModuleVersionTracker | undefined;
|
|
9
|
+
}
|
|
10
|
+
export declare function createUniAppXWebSfcHmr(options: WebSfcHmrOptions): {
|
|
11
|
+
prepare(ctx: HmrContext): Promise<void>;
|
|
12
|
+
finish(ctx: HmrContext): Promise<boolean>;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-RK2HtgOb.cjs");
|
|
3
3
|
require("./auto-DtU6f3X6.cjs");
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
-
const require_compiler = require("./compiler-
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-B03BGeTO.cjs");
|
|
5
|
+
const require_compiler = require("./compiler-DFROuh5Z.cjs");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
package/dist/vite/web.cjs
CHANGED
package/dist/vite/web.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
3
|
+
const require_generator = require("./generator-RK2HtgOb.cjs");
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-B03BGeTO.cjs");
|
|
5
5
|
require("./utils-CuKLf1Zv.cjs");
|
|
6
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
7
|
-
const require_compiler = require("./compiler-
|
|
6
|
+
const require_v4_generation_core = require("./v4-generation-core-BvW2aK23.cjs");
|
|
7
|
+
const require_compiler = require("./compiler-DFROuh5Z.cjs");
|
|
8
8
|
const require_cache = require("./cache-CBJFB1HN.cjs");
|
|
9
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
9
|
+
const require_hmr_timing = require("./hmr-timing-D45cTIzM.cjs");
|
|
10
10
|
const require_final_css_cleanup = require("./final-css-cleanup-DSjczga3.cjs");
|
|
11
|
-
const require_scoped_generator = require("./scoped-generator-
|
|
12
|
-
const require_web = require("./web-
|
|
13
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
11
|
+
const require_scoped_generator = require("./scoped-generator-DccPwmJT.cjs");
|
|
12
|
+
const require_web = require("./web-DQZ27KWH.cjs");
|
|
13
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-CnUlGWhP.cjs");
|
|
14
14
|
require("./logger-TlKT3xmR.cjs");
|
|
15
15
|
let node_fs = require("node:fs");
|
|
16
16
|
node_fs = require_rolldown_runtime.__toESM(node_fs, 1);
|
|
@@ -101,6 +101,14 @@ function shouldEnablePageLocalStyle(id, matcher) {
|
|
|
101
101
|
return matcher ? matcher(normalizedId) : PAGE_RE.test(normalizedId);
|
|
102
102
|
}
|
|
103
103
|
//#endregion
|
|
104
|
+
//#region src/uni-app-x/style-reference-path.ts
|
|
105
|
+
const WINDOWS_SOURCE_RE = /^[a-z]:[\\/]|^[\\/]{2}[^\\/]/i;
|
|
106
|
+
/** 按来源文件的盘符或共享根目录解析,再在 CSS 引用边界统一分隔符。 */
|
|
107
|
+
function resolveStyleReferencePath(sourceFile, request) {
|
|
108
|
+
const paths = WINDOWS_SOURCE_RE.test(sourceFile) ? node_path.default.win32 : node_path.default;
|
|
109
|
+
return paths.resolve(paths.dirname(sourceFile), request).replaceAll("\\", "/");
|
|
110
|
+
}
|
|
111
|
+
//#endregion
|
|
104
112
|
//#region src/uni-app-x/style-asset/style-value.ts
|
|
105
113
|
const GEN_APP_STYLES_RE = /const\s+GenAppStyles\s*=\s*\[_uM\(\[([\s\S]*?)\]\)\]/;
|
|
106
114
|
const STYLE_ENTRY_RE = /\[\s*("((?:\\.|[^"\\])+)")\s*,\s*(_pS\(_uM\(\[[\s\S]*?\]\)\))\s*\]/g;
|
|
@@ -296,7 +304,6 @@ function resolveReferencePaths(styleSource, sourceId) {
|
|
|
296
304
|
}
|
|
297
305
|
if (!sourceId || !styleSource.includes("@reference")) return root.toString();
|
|
298
306
|
const cleanSourceId = sourceId.replace(/\?.*$/, "");
|
|
299
|
-
const pathApi = /^[a-z]:[\\/]/i.test(cleanSourceId) ? node_path.default.win32 : node_path.default;
|
|
300
307
|
root.walkAtRules("reference", (rule) => {
|
|
301
308
|
const quote = rule.params[0];
|
|
302
309
|
if (quote !== "\"" && quote !== "'") return;
|
|
@@ -304,7 +311,7 @@ function resolveReferencePaths(styleSource, sourceId) {
|
|
|
304
311
|
if (closingQuoteIndex <= 1) return;
|
|
305
312
|
const referencePath = rule.params.slice(1, closingQuoteIndex);
|
|
306
313
|
if (!referencePath.startsWith(".")) return;
|
|
307
|
-
rule.params = `${quote}${
|
|
314
|
+
rule.params = `${quote}${resolveStyleReferencePath(cleanSourceId, referencePath)}${quote}${rule.params.slice(closingQuoteIndex + 1)}`;
|
|
308
315
|
});
|
|
309
316
|
return root.toString();
|
|
310
317
|
}
|
|
@@ -4622,7 +4629,6 @@ function createUniAppXNativeBuildTargetResolver(getResolvedConfig) {
|
|
|
4622
4629
|
const UVUE_NVUE_RE$1 = /\.(?:uvue|nvue)$/;
|
|
4623
4630
|
const CSS_MODULE_EXPORT_RE = /^\s*export\s+default\s+(?:\{|\w|\[\])/;
|
|
4624
4631
|
const RELATIVE_REFERENCE_RE = /@reference\s+(["'])(\.\.?[\\/][^"']+)\1\s*;?/g;
|
|
4625
|
-
const WINDOWS_ABSOLUTE_PATH_RE$1 = /^[a-z]:[\\/]/i;
|
|
4626
4632
|
function isPreprocessorRequest(id, lang) {
|
|
4627
4633
|
return require_v4_generation_core.isSourcePreprocessorRequest(id, lang);
|
|
4628
4634
|
}
|
|
@@ -4635,10 +4641,8 @@ function isCssModuleExport(code) {
|
|
|
4635
4641
|
function normalizeRelativeTailwindReferences(code, id) {
|
|
4636
4642
|
if (!code.includes("@reference")) return code;
|
|
4637
4643
|
const sourceFile = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
4638
|
-
const pathApi = WINDOWS_ABSOLUTE_PATH_RE$1.test(sourceFile) ? node_path.default.win32 : node_path.default;
|
|
4639
|
-
const sourceDir = pathApi.dirname(sourceFile);
|
|
4640
4644
|
return code.replace(RELATIVE_REFERENCE_RE, (_full, quote, request) => {
|
|
4641
|
-
return `@reference ${quote}${
|
|
4645
|
+
return `@reference ${quote}${resolveStyleReferencePath(sourceFile, request)}${quote};`;
|
|
4642
4646
|
});
|
|
4643
4647
|
}
|
|
4644
4648
|
function resolvePreprocessorTransform(code, id, lang, options) {
|
|
@@ -4652,12 +4656,22 @@ function resolvePreprocessorTransform(code, id, lang, options) {
|
|
|
4652
4656
|
}
|
|
4653
4657
|
if (!options.isNativeAppStyleTarget) return { result: void 0 };
|
|
4654
4658
|
}
|
|
4659
|
+
function reportStyleWarnings(result) {
|
|
4660
|
+
const warnings = typeof result.warnings === "function" ? result.warnings() : [];
|
|
4661
|
+
for (const warning of warnings) _weapp_tailwindcss_logger.logger.warn(warning.toString());
|
|
4662
|
+
}
|
|
4655
4663
|
//#endregion
|
|
4656
4664
|
//#region src/uni-app-x/vite/style-source.ts
|
|
4657
4665
|
const VITE_CSS_HMR_MODULE_RE = /\b(?:const\s+__vite__css\s*=|__vite__updateStyle\s*\()/;
|
|
4658
4666
|
function createUniAppXSfcStyleSources() {
|
|
4659
4667
|
const authoredByFile = /* @__PURE__ */ new Map();
|
|
4660
4668
|
const generatedByFile = /* @__PURE__ */ new Map();
|
|
4669
|
+
const generatedIndicesByFile = /* @__PURE__ */ new Map();
|
|
4670
|
+
function getGenerated(id, index) {
|
|
4671
|
+
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
4672
|
+
if (authoredByFile.get(file)?.[index]) return;
|
|
4673
|
+
return generatedByFile.get(file)?.get(index) ?? (generatedIndicesByFile.get(file)?.has(index) ? "" : void 0);
|
|
4674
|
+
}
|
|
4661
4675
|
return {
|
|
4662
4676
|
rememberSource(id, source) {
|
|
4663
4677
|
authoredByFile.set((0, _weapp_tailwindcss_shared.cleanUrl)(id), require_web.extractSfcStyleBlocks(source));
|
|
@@ -4666,12 +4680,15 @@ function createUniAppXSfcStyleSources() {
|
|
|
4666
4680
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
4667
4681
|
const authoredCount = authoredByFile.get(file)?.length ?? 0;
|
|
4668
4682
|
const generated = /* @__PURE__ */ new Map();
|
|
4669
|
-
|
|
4683
|
+
const generatedIndices = generatedIndicesByFile.get(file) ?? /* @__PURE__ */ new Set();
|
|
4684
|
+
for (const [index, style] of require_web.extractSfcStyleBlocks(source).entries()) if (index >= authoredCount) {
|
|
4685
|
+
generated.set(index, style.source);
|
|
4686
|
+
generatedIndices.add(index);
|
|
4687
|
+
}
|
|
4670
4688
|
generatedByFile.set(file, generated);
|
|
4689
|
+
generatedIndicesByFile.set(file, generatedIndices);
|
|
4671
4690
|
},
|
|
4672
|
-
getGenerated
|
|
4673
|
-
return generatedByFile.get((0, _weapp_tailwindcss_shared.cleanUrl)(id))?.get(index);
|
|
4674
|
-
},
|
|
4691
|
+
getGenerated,
|
|
4675
4692
|
hasGenerated(id) {
|
|
4676
4693
|
return Boolean(generatedByFile.get((0, _weapp_tailwindcss_shared.cleanUrl)(id))?.size);
|
|
4677
4694
|
},
|
|
@@ -4679,7 +4696,7 @@ function createUniAppXSfcStyleSources() {
|
|
|
4679
4696
|
const file = (0, _weapp_tailwindcss_shared.cleanUrl)(id);
|
|
4680
4697
|
const style = authoredByFile.get(file)?.[index];
|
|
4681
4698
|
if (!style) {
|
|
4682
|
-
const generated =
|
|
4699
|
+
const generated = getGenerated(file, index);
|
|
4683
4700
|
return generated === void 0 ? void 0 : {
|
|
4684
4701
|
code: generated,
|
|
4685
4702
|
map: null
|
|
@@ -4738,6 +4755,37 @@ function createUniAppXWebLocalStyleBridge(isEnabled, hmrCssModuleVersions) {
|
|
|
4738
4755
|
};
|
|
4739
4756
|
}
|
|
4740
4757
|
//#endregion
|
|
4758
|
+
//#region src/uni-app-x/vite/web-sfc-hmr.ts
|
|
4759
|
+
function createUniAppXWebSfcHmr(options) {
|
|
4760
|
+
const sources = /* @__PURE__ */ new WeakMap();
|
|
4761
|
+
function enabled(ctx) {
|
|
4762
|
+
return options.isEnabled() && /\.(?:uvue|nvue)$/.test(ctx.file) && typeof ctx.read === "function";
|
|
4763
|
+
}
|
|
4764
|
+
return {
|
|
4765
|
+
async prepare(ctx) {
|
|
4766
|
+
if (!enabled(ctx)) return;
|
|
4767
|
+
const source = await ctx.read();
|
|
4768
|
+
sources.set(ctx, source);
|
|
4769
|
+
const result = await options.transform(source, ctx.file);
|
|
4770
|
+
ctx.read = async () => result?.code ?? source;
|
|
4771
|
+
},
|
|
4772
|
+
async finish(ctx) {
|
|
4773
|
+
if (!enabled(ctx)) return false;
|
|
4774
|
+
options.hmrCssModuleVersions?.clear();
|
|
4775
|
+
const source = sources.get(ctx) ?? await ctx.read();
|
|
4776
|
+
if (hasUniAppXImportantApply(source, _weapp_tailwindcss_postcss.normalizeUniAppXImportantApplyForSass)) {
|
|
4777
|
+
ctx.server.ws.send({
|
|
4778
|
+
type: "full-reload",
|
|
4779
|
+
path: ctx.file
|
|
4780
|
+
});
|
|
4781
|
+
return true;
|
|
4782
|
+
}
|
|
4783
|
+
if (!sources.has(ctx)) await options.transform(source, ctx.file);
|
|
4784
|
+
return false;
|
|
4785
|
+
}
|
|
4786
|
+
};
|
|
4787
|
+
}
|
|
4788
|
+
//#endregion
|
|
4741
4789
|
//#region src/uni-app-x/vite/asset-task.ts
|
|
4742
4790
|
function resolveUniAppXJsTransformEnabled(uniAppX) {
|
|
4743
4791
|
return uniAppX === void 0 ? true : require_tailwindcss.isUniAppXEnabled(uniAppX);
|
|
@@ -4781,7 +4829,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
4781
4829
|
//#region src/uni-app-x/vite.ts
|
|
4782
4830
|
let transformUVuePromise;
|
|
4783
4831
|
function loadTransformUVue() {
|
|
4784
|
-
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-
|
|
4832
|
+
transformUVuePromise ?? (transformUVuePromise = Promise.resolve().then(() => require("./transform-MIhriZRr.cjs")).then((mod) => mod.transformUVue));
|
|
4785
4833
|
return transformUVuePromise;
|
|
4786
4834
|
}
|
|
4787
4835
|
const UVUE_NVUE_QUERY_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
@@ -4795,6 +4843,11 @@ function createUniAppXPlugins(options) {
|
|
|
4795
4843
|
const nativeLocalStyleModuleIds = /* @__PURE__ */ new Set();
|
|
4796
4844
|
const sfcStyleSources = createUniAppXSfcStyleSources();
|
|
4797
4845
|
const pendingSfcTransforms = /* @__PURE__ */ new Map();
|
|
4846
|
+
const webSfcHmr = createUniAppXWebSfcHmr({
|
|
4847
|
+
isEnabled: () => isEnabled() && isWebGeneratorTarget() && getResolvedConfig()?.command === "serve",
|
|
4848
|
+
transform: (source, id) => runTransformSfc(source, id, {}),
|
|
4849
|
+
hmrCssModuleVersions
|
|
4850
|
+
});
|
|
4798
4851
|
const webLocalStyle = createUniAppXWebLocalStyleBridge(isWebGeneratorTarget, hmrCssModuleVersions);
|
|
4799
4852
|
let componentLocalStyleEnabled;
|
|
4800
4853
|
const isNativeAppBuildTarget = createUniAppXNativeBuildTargetResolver(getResolvedConfig);
|
|
@@ -4850,10 +4903,6 @@ function createUniAppXPlugins(options) {
|
|
|
4850
4903
|
}
|
|
4851
4904
|
return styleHandlerOptions;
|
|
4852
4905
|
}
|
|
4853
|
-
function reportStyleWarnings(result) {
|
|
4854
|
-
const warnings = typeof result.warnings === "function" ? result.warnings() : [];
|
|
4855
|
-
for (const warning of warnings) _weapp_tailwindcss_logger.logger.warn(warning.toString());
|
|
4856
|
-
}
|
|
4857
4906
|
async function transformStyle(code, id, query, hookContext) {
|
|
4858
4907
|
const isNativeStyle = isNativeAppBuildTarget(id);
|
|
4859
4908
|
const parsed = query ?? require_web.parseVueRequest(id).query;
|
|
@@ -4907,6 +4956,10 @@ function createUniAppXPlugins(options) {
|
|
|
4907
4956
|
}, {
|
|
4908
4957
|
name: "weapp-tailwindcss:uni-app-x:css:pre",
|
|
4909
4958
|
enforce: "pre",
|
|
4959
|
+
handleHotUpdate: {
|
|
4960
|
+
order: "pre",
|
|
4961
|
+
handler: (ctx) => webSfcHmr.prepare(ctx)
|
|
4962
|
+
},
|
|
4910
4963
|
load: {
|
|
4911
4964
|
order: "pre",
|
|
4912
4965
|
async handler(id) {
|
|
@@ -4921,9 +4974,10 @@ function createUniAppXPlugins(options) {
|
|
|
4921
4974
|
await runtimeState.readyPromise;
|
|
4922
4975
|
const { filename, query } = require_web.parseVueRequest(id);
|
|
4923
4976
|
if (query.vue && query.type === "style") await pendingSfcTransforms.get((0, _weapp_tailwindcss_shared.cleanUrl)(filename));
|
|
4924
|
-
const
|
|
4977
|
+
const generatedSource = sfcStyleSources.getGenerated(filename, query.index ?? 0);
|
|
4978
|
+
const resolvedSource = resolveUniAppXStyleSource(code, query, generatedSource);
|
|
4925
4979
|
if (resolvedSource.skip) return;
|
|
4926
|
-
const styleCode = query.vue && query.type === "style" && !sfcStyleSources.hasGenerated(filename) ? webLocalStyle.appendToStyle(resolvedSource.code, id) : resolvedSource.code;
|
|
4980
|
+
const styleCode = query.vue && query.type === "style" && generatedSource === void 0 && !sfcStyleSources.hasGenerated(filename) ? webLocalStyle.appendToStyle(resolvedSource.code, id) : resolvedSource.code;
|
|
4927
4981
|
const preprocessorCode = query.vue && query.type === "style" ? (0, _weapp_tailwindcss_postcss.normalizeUniAppXImportantApplyForSass)(styleCode) : styleCode;
|
|
4928
4982
|
const preprocessor = resolvePreprocessorTransform(preprocessorCode, id, query.lang, {
|
|
4929
4983
|
isIosPlatform,
|
|
@@ -4933,7 +4987,10 @@ function createUniAppXPlugins(options) {
|
|
|
4933
4987
|
code: preprocessorCode,
|
|
4934
4988
|
map: null
|
|
4935
4989
|
} : void 0);
|
|
4936
|
-
return transformStyle(preprocessorCode, id, query, this)
|
|
4990
|
+
return await transformStyle(preprocessorCode, id, query, this) ?? (preprocessorCode !== code ? {
|
|
4991
|
+
code: preprocessorCode,
|
|
4992
|
+
map: null
|
|
4993
|
+
} : void 0);
|
|
4937
4994
|
}
|
|
4938
4995
|
}];
|
|
4939
4996
|
async function transformSfc(code, id, context) {
|
|
@@ -5000,6 +5057,7 @@ function createUniAppXPlugins(options) {
|
|
|
5000
5057
|
if (!isEnabled()) return;
|
|
5001
5058
|
const { query } = require_web.parseVueRequest(id);
|
|
5002
5059
|
if (!UVUE_NVUE_QUERY_RE.test(id) || query.vue && query.type === "style") return;
|
|
5060
|
+
if (isWebGeneratorTarget() && query.vue && query.type) return;
|
|
5003
5061
|
return runTransformSfc(code, id, this);
|
|
5004
5062
|
}
|
|
5005
5063
|
},
|
|
@@ -5008,18 +5066,7 @@ function createUniAppXPlugins(options) {
|
|
|
5008
5066
|
async handler(ctx) {
|
|
5009
5067
|
if (!isEnabled() || getResolvedConfig()?.command !== "serve") return;
|
|
5010
5068
|
if (!UVUE_NVUE_RE.test(ctx.file) && !require_web.isCSSRequest(ctx.file)) return;
|
|
5011
|
-
if (
|
|
5012
|
-
hmrCssModuleVersions?.clear();
|
|
5013
|
-
const source = await ctx.read();
|
|
5014
|
-
if (hasUniAppXImportantApply(source, _weapp_tailwindcss_postcss.normalizeUniAppXImportantApplyForSass)) {
|
|
5015
|
-
ctx.server.ws.send({
|
|
5016
|
-
type: "full-reload",
|
|
5017
|
-
path: ctx.file
|
|
5018
|
-
});
|
|
5019
|
-
return [];
|
|
5020
|
-
}
|
|
5021
|
-
await runTransformSfc(source, ctx.file, this);
|
|
5022
|
-
}
|
|
5069
|
+
if (await webSfcHmr.finish(ctx)) return [];
|
|
5023
5070
|
return webLocalStyle.handleHotUpdate(ctx) ?? nativeHmrReloader.handleHotUpdate(ctx);
|
|
5024
5071
|
}
|
|
5025
5072
|
},
|