weapp-tailwindcss 5.0.0-next.30 → 5.0.0-next.32
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/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/{bundle-state-Bi-cQua6.mjs → bundle-state-BIsgsoNW.mjs} +2 -2
- package/dist/{bundle-state-Ct_8GcSR.js → bundle-state-C4ib5xPG.js} +3 -3
- package/dist/bundlers/shared/generator-css/directives.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +2 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{generator-CrU-Ghc1.js → generator-BEXaaUzP.js} +1 -1
- package/dist/{generator-Qw-tZ0Z2.mjs → generator-CpsHA4Wd.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +7 -7
- package/dist/gulp.mjs +6 -6
- package/dist/{incremental-runtime-class-set-BxvZONkv.js → incremental-runtime-class-set-CLP1Qv8F.js} +266 -11
- package/dist/{incremental-runtime-class-set-BdZHkoTs.mjs → incremental-runtime-class-set-D2fsgk5t.mjs} +260 -11
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-C6zOQqlL.mjs → postcss-BvkdIZr8.mjs} +3 -3
- package/dist/{postcss-DAWf9D3C.js → postcss-DN7IQzYb.js} +4 -4
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-D7gJSmJz.js → precheck-CQeqnfo5.js} +4 -4
- package/dist/{precheck-D7K12zeX.mjs → precheck-nITnYBDn.mjs} +3 -3
- package/dist/presets.js +4 -4
- package/dist/presets.mjs +3 -3
- package/dist/{source-candidates-DNM8iwXW.js → source-candidates-7Q-kTOSb.js} +1 -1
- package/dist/{source-candidates-CX2ozpKM.mjs → source-candidates-_x8bq0Mz.mjs} +1 -1
- package/dist/{tailwindcss-B-e2RiXr.js → tailwindcss-Cl7hUlYV.js} +3 -3
- package/dist/{tailwindcss-C7dJHZ0G.mjs → tailwindcss-udhXxMX9.mjs} +2 -2
- package/dist/{v3-engine-DcvCCHfs.mjs → v3-engine-C_KeUQG3.mjs} +6 -6
- package/dist/{v3-engine-CHItlVq5.js → v3-engine-DwY4Fixu.js} +7 -7
- package/dist/{vite-rmL1rsA_.mjs → vite-BAHjBu8j.mjs} +17 -10
- package/dist/{vite-C65DdWEj.js → vite-CYkkJZ3Q.js} +18 -11
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +328 -12
- package/dist/{webpack-CqGvjvSQ.js → webpack-CPwDaKy3.js} +8 -8
- package/dist/{webpack-BU2Er4qg.mjs → webpack-xxmiRxcy.mjs} +7 -7
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -4
- package/dist/auto-TH1jG2UW.js +0 -115
- package/dist/auto-XyKTOP7B.mjs +0 -78
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { C as __esmMin, S as __commonJSMin, _ as toCustomAttributesEntities, a as vitePluginName, c as createAttributeMatcher, d as _defineProperty, f as init_defineProperty, h as babelParse, l as analyzeSource, m as replaceWxml, n as getCompilerContext, p as isClassContextLiteralPath, s as generateCode, t as shouldSkipJsTransform, u as JsTokenUpdater, v as collectRuntimeClassSet, w as __require, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./precheck-
|
|
2
|
-
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-
|
|
3
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
4
|
-
import { a as validateCandidatesByGenerator, c as
|
|
1
|
+
import { C as __esmMin, S as __commonJSMin, _ as toCustomAttributesEntities, a as vitePluginName, c as createAttributeMatcher, d as _defineProperty, f as init_defineProperty, h as babelParse, l as analyzeSource, m as replaceWxml, n as getCompilerContext, p as isClassContextLiteralPath, s as generateCode, t as shouldSkipJsTransform, u as JsTokenUpdater, v as collectRuntimeClassSet, w as __require, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./precheck-nITnYBDn.mjs";
|
|
2
|
+
import { B as createDebug, E as filterUnsupportedMiniProgramTailwindV4Candidates, J as findNearestPackageRoot, U as findTailwindConfig, W as resolveTailwindcssOptions, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, q as omitUndefined, v as resolveViteTailwindV4CssDependencies } from "./v3-engine-C_KeUQG3.mjs";
|
|
3
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-CpsHA4Wd.mjs";
|
|
4
|
+
import { a as validateCandidatesByGenerator, c as hasTailwindRootDirectives, d as hasTailwindGeneratedCssMarkers, i as generateCssByGenerator, l as hasTailwindSourceDirectives, n as createHmrTimingRecorder, o as mergeMarkedUserLayerComponentsCss, s as processCachedTask, t as createBundleRuntimeClassSetManager, u as normalizeTailwindSourceForGenerator } from "./incremental-runtime-class-set-D2fsgk5t.mjs";
|
|
5
5
|
import { o as resolveUniUtsPlatform } from "./utils-DsaS975I.mjs";
|
|
6
|
-
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
7
|
-
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-
|
|
8
|
-
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-
|
|
6
|
+
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-udhXxMX9.mjs";
|
|
7
|
+
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-_x8bq0Mz.mjs";
|
|
8
|
+
import { a as createBundleModuleGraphOptions, b as toAbsoluteOutputPath, c as hasBundlerGeneratedCssMarker, d as resolvePluginDisabledState, f as cleanUrl, g as isSourceStyleRequest, h as slash, i as applyLinkedResults, l as stripBundlerGeneratedCssMarkers, m as isCSSRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as formatPostcssSourceMap, r as updateBundleBuildState, s as createBundlerGeneratedCssMarker, t as buildBundleSnapshot, u as resolvePackageDir, v as normalizeOutputPathKey } from "./bundle-state-BIsgsoNW.mjs";
|
|
9
9
|
import { t as logger$1 } from "./logger-BNzxZbZj.mjs";
|
|
10
10
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
11
11
|
import postcss from "postcss";
|
|
12
|
-
import path from "node:path";
|
|
13
12
|
import process$1 from "node:process";
|
|
13
|
+
import path from "node:path";
|
|
14
14
|
import { logger } from "@weapp-tailwindcss/logger";
|
|
15
15
|
import { readFile } from "node:fs/promises";
|
|
16
16
|
import MagicString from "magic-string";
|
|
@@ -22380,7 +22380,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
22380
22380
|
return collected;
|
|
22381
22381
|
}
|
|
22382
22382
|
function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
22383
|
-
const viteCssResults = [...options.getViteProcessedCssAssetResults?.() ?? []].filter(([
|
|
22383
|
+
const viteCssResults = [...options.getViteProcessedCssAssetResults?.() ?? []].filter(([, css]) => css.length > 0);
|
|
22384
22384
|
if (viteCssResults.length === 0) return 0;
|
|
22385
22385
|
let injected = 0;
|
|
22386
22386
|
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
@@ -22393,7 +22393,13 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
22393
22393
|
for (const [sourceFile, sourceCss] of viteCssResults) {
|
|
22394
22394
|
if (normalizeOutputPathKey(sourceFile) === mainFileKey || options.opts.mainCssChunkMatcher(sourceFile, options.opts.appType)) continue;
|
|
22395
22395
|
const css = stripBundlerGeneratedCssMarkers(sourceCss).trim();
|
|
22396
|
-
if (css.length === 0
|
|
22396
|
+
if (css.length === 0) continue;
|
|
22397
|
+
const mergedLayerCss = mergeMarkedUserLayerComponentsCss(nextCss, css);
|
|
22398
|
+
if (mergedLayerCss.merged) {
|
|
22399
|
+
nextCss = mergedLayerCss.css;
|
|
22400
|
+
continue;
|
|
22401
|
+
}
|
|
22402
|
+
if (nextCss.includes(css)) continue;
|
|
22397
22403
|
nextCss = appendCss(nextCss, css);
|
|
22398
22404
|
}
|
|
22399
22405
|
if (nextCss === originalSource) continue;
|
|
@@ -24209,6 +24215,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
24209
24215
|
if (!generated) return;
|
|
24210
24216
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
24211
24217
|
viteGeneratedCssByFile.set(file, generated.css);
|
|
24218
|
+
if (generated.css.includes("weapp-tailwindcss layer components start")) recordViteProcessedCssAssetResult(file, generated.css);
|
|
24212
24219
|
markViteProcessedCssSource(file);
|
|
24213
24220
|
rememberTailwindRootCssModule(id);
|
|
24214
24221
|
recordGeneratorCandidates(runtime);
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
|
|
3
|
+
const require_generator = require("./generator-BEXaaUzP.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CLP1Qv8F.js");
|
|
5
|
+
const require_precheck = require("./precheck-CQeqnfo5.js");
|
|
6
6
|
const require_utils = require("./utils-D7Ygohep.js");
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_source_candidates = require("./source-candidates-
|
|
9
|
-
const require_bundle_state = require("./bundle-state-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-Cl7hUlYV.js");
|
|
8
|
+
const require_source_candidates = require("./source-candidates-7Q-kTOSb.js");
|
|
9
|
+
const require_bundle_state = require("./bundle-state-C4ib5xPG.js");
|
|
10
10
|
require("./logger-TlKT3xmR.js");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
node_fs = require_chunk.__toESM(node_fs);
|
|
13
13
|
let postcss = require("postcss");
|
|
14
14
|
postcss = require_chunk.__toESM(postcss);
|
|
15
|
-
let node_path = require("node:path");
|
|
16
|
-
node_path = require_chunk.__toESM(node_path);
|
|
17
15
|
let node_process = require("node:process");
|
|
18
16
|
node_process = require_chunk.__toESM(node_process);
|
|
17
|
+
let node_path = require("node:path");
|
|
18
|
+
node_path = require_chunk.__toESM(node_path);
|
|
19
19
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
20
20
|
let node_fs_promises = require("node:fs/promises");
|
|
21
21
|
let magic_string = require("magic-string");
|
|
@@ -22389,7 +22389,7 @@ function collectViteProcessedCssAssetResults(bundle, options) {
|
|
|
22389
22389
|
return collected;
|
|
22390
22390
|
}
|
|
22391
22391
|
function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
22392
|
-
const viteCssResults = [...options.getViteProcessedCssAssetResults?.() ?? []].filter(([
|
|
22392
|
+
const viteCssResults = [...options.getViteProcessedCssAssetResults?.() ?? []].filter(([, css]) => css.length > 0);
|
|
22393
22393
|
if (viteCssResults.length === 0) return 0;
|
|
22394
22394
|
let injected = 0;
|
|
22395
22395
|
for (const [bundleFile, output] of Object.entries(bundle)) {
|
|
@@ -22402,7 +22402,13 @@ function injectViteProcessedCssIntoMainCssAssets(bundle, options) {
|
|
|
22402
22402
|
for (const [sourceFile, sourceCss] of viteCssResults) {
|
|
22403
22403
|
if (require_bundle_state.normalizeOutputPathKey(sourceFile) === mainFileKey || options.opts.mainCssChunkMatcher(sourceFile, options.opts.appType)) continue;
|
|
22404
22404
|
const css = require_bundle_state.stripBundlerGeneratedCssMarkers(sourceCss).trim();
|
|
22405
|
-
if (css.length === 0
|
|
22405
|
+
if (css.length === 0) continue;
|
|
22406
|
+
const mergedLayerCss = require_incremental_runtime_class_set.mergeMarkedUserLayerComponentsCss(nextCss, css);
|
|
22407
|
+
if (mergedLayerCss.merged) {
|
|
22408
|
+
nextCss = mergedLayerCss.css;
|
|
22409
|
+
continue;
|
|
22410
|
+
}
|
|
22411
|
+
if (nextCss.includes(css)) continue;
|
|
22406
22412
|
nextCss = appendCss(nextCss, css);
|
|
22407
22413
|
}
|
|
22408
22414
|
if (nextCss === originalSource) continue;
|
|
@@ -24218,6 +24224,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
24218
24224
|
if (!generated) return;
|
|
24219
24225
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
24220
24226
|
viteGeneratedCssByFile.set(file, generated.css);
|
|
24227
|
+
if (generated.css.includes("weapp-tailwindcss layer components start")) recordViteProcessedCssAssetResult(file, generated.css);
|
|
24221
24228
|
markViteProcessedCssSource(file);
|
|
24222
24229
|
rememberTailwindRootCssModule(id);
|
|
24223
24230
|
recordGeneratorCandidates(runtime);
|
package/dist/vite.js
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-CYkkJZ3Q.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-BAHjBu8j.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -278,6 +278,126 @@ const creator = () => {
|
|
|
278
278
|
};
|
|
279
279
|
creator.postcss = true;
|
|
280
280
|
const CSS_MACRO_STYLE_OPTIONS_MARKER = "__weappTailwindcssCssMacroEnabled";
|
|
281
|
+
const PLATFORM_ENV_KEYS = [
|
|
282
|
+
"WEAPP_TW_TARGET",
|
|
283
|
+
"WEAPP_TAILWINDCSS_TARGET",
|
|
284
|
+
"UNI_PLATFORM",
|
|
285
|
+
"UNI_UTS_PLATFORM",
|
|
286
|
+
"TARO_ENV",
|
|
287
|
+
"MPX_CLI_MODE",
|
|
288
|
+
"MPX_CURRENT_TARGET_MODE"
|
|
289
|
+
];
|
|
290
|
+
const CONDITIONAL_END_RE = /^\s*#endif\s*$/;
|
|
291
|
+
function readEnvValue(key) {
|
|
292
|
+
return typeof node_process.default === "undefined" ? void 0 : node_process.default.env[key];
|
|
293
|
+
}
|
|
294
|
+
function normalizePlatformToken(value) {
|
|
295
|
+
return value?.trim().replaceAll("_", "-").toUpperCase() || void 0;
|
|
296
|
+
}
|
|
297
|
+
function resolveCssMacroPlatform(options) {
|
|
298
|
+
const explicit = normalizePlatformToken(options?.platform);
|
|
299
|
+
if (explicit) return explicit;
|
|
300
|
+
for (const key of PLATFORM_ENV_KEYS) {
|
|
301
|
+
const value = normalizePlatformToken(readEnvValue(key));
|
|
302
|
+
if (value) return value;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
function createPlatformTokenSet(platform) {
|
|
306
|
+
const normalized = normalizePlatformToken(platform);
|
|
307
|
+
const tokens = /* @__PURE__ */ new Set();
|
|
308
|
+
if (!normalized) return tokens;
|
|
309
|
+
tokens.add(normalized);
|
|
310
|
+
if (normalized.startsWith("MP-")) tokens.add("MP");
|
|
311
|
+
if (normalized === "WEAPP" || normalized === "WEIXIN" || normalized === "WX") {
|
|
312
|
+
tokens.add("MP");
|
|
313
|
+
tokens.add("MP-WEIXIN");
|
|
314
|
+
}
|
|
315
|
+
if (normalized === "MP-WEIXIN") {
|
|
316
|
+
tokens.add("WEAPP");
|
|
317
|
+
tokens.add("WEIXIN");
|
|
318
|
+
tokens.add("WX");
|
|
319
|
+
}
|
|
320
|
+
if (normalized === "H5") tokens.add("WEB");
|
|
321
|
+
if (normalized === "WEB") tokens.add("H5");
|
|
322
|
+
if (normalized === "APP") tokens.add("APP-PLUS");
|
|
323
|
+
if (normalized.startsWith("APP-")) tokens.add("APP");
|
|
324
|
+
if (normalized.startsWith("QUICKAPP-WEBVIEW")) tokens.add("QUICKAPP-WEBVIEW");
|
|
325
|
+
return tokens;
|
|
326
|
+
}
|
|
327
|
+
function combineAnd(values) {
|
|
328
|
+
if (values.includes(false)) return false;
|
|
329
|
+
return values.every((value) => value === true) ? true : void 0;
|
|
330
|
+
}
|
|
331
|
+
function combineOr(values) {
|
|
332
|
+
if (values.includes(true)) return true;
|
|
333
|
+
return values.every((value) => value === false) ? false : void 0;
|
|
334
|
+
}
|
|
335
|
+
function evaluatePlatformExpression(expression, platformTokens) {
|
|
336
|
+
return combineOr(expression.split(/\s*\|\|\s*/).map((orPart) => {
|
|
337
|
+
return combineAnd(orPart.split(/\s*&&\s*/).map((part) => {
|
|
338
|
+
const token = normalizePlatformToken(part);
|
|
339
|
+
if (!token || /[<>=!()]/.test(token)) return;
|
|
340
|
+
return platformTokens.has(token);
|
|
341
|
+
}));
|
|
342
|
+
}));
|
|
343
|
+
}
|
|
344
|
+
function negateConditionalValue(value) {
|
|
345
|
+
return value === void 0 ? void 0 : !value;
|
|
346
|
+
}
|
|
347
|
+
function getActiveConditionalValue(stack) {
|
|
348
|
+
if (stack.includes(false)) return false;
|
|
349
|
+
return stack.includes(void 0) ? void 0 : true;
|
|
350
|
+
}
|
|
351
|
+
function parseConditionalStart(text) {
|
|
352
|
+
const normalized = text.trim();
|
|
353
|
+
if (!normalized.startsWith("#")) return;
|
|
354
|
+
const body = normalized.slice(1).trimStart();
|
|
355
|
+
for (const directive of ["ifndef", "ifdef"]) {
|
|
356
|
+
if (!body.startsWith(directive)) continue;
|
|
357
|
+
const expression = body.slice(directive.length).trim();
|
|
358
|
+
if (expression.length === 0) return;
|
|
359
|
+
return {
|
|
360
|
+
directive,
|
|
361
|
+
expression
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
function compileCssMacroConditionalComments(css, options) {
|
|
366
|
+
const platformTokens = createPlatformTokenSet(resolveCssMacroPlatform(options));
|
|
367
|
+
if (platformTokens.size === 0 || !css.includes("#if")) return css;
|
|
368
|
+
try {
|
|
369
|
+
const root = require_runtime_registry.postcss_default.parse(css);
|
|
370
|
+
const transformContainer = (container) => {
|
|
371
|
+
const stack = [];
|
|
372
|
+
for (const node of [...container.nodes ?? []]) {
|
|
373
|
+
if (node.type === "comment") {
|
|
374
|
+
const start = parseConditionalStart(node.text);
|
|
375
|
+
if (start) {
|
|
376
|
+
const value = start.directive === "ifndef" ? negateConditionalValue(evaluatePlatformExpression(start.expression, platformTokens)) : evaluatePlatformExpression(start.expression, platformTokens);
|
|
377
|
+
const parentActive = getActiveConditionalValue(stack);
|
|
378
|
+
stack.push(value);
|
|
379
|
+
if (parentActive !== void 0 && value !== void 0) node.remove();
|
|
380
|
+
continue;
|
|
381
|
+
}
|
|
382
|
+
if (CONDITIONAL_END_RE.test(node.text)) {
|
|
383
|
+
const value = stack.pop();
|
|
384
|
+
if (getActiveConditionalValue(stack) !== void 0 && value !== void 0) node.remove();
|
|
385
|
+
continue;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
if (getActiveConditionalValue(stack) === false) {
|
|
389
|
+
node.remove();
|
|
390
|
+
continue;
|
|
391
|
+
}
|
|
392
|
+
if ("nodes" in node && node.nodes) transformContainer(node);
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
transformContainer(root);
|
|
396
|
+
return root.toString();
|
|
397
|
+
} catch {
|
|
398
|
+
return css;
|
|
399
|
+
}
|
|
400
|
+
}
|
|
281
401
|
function isCssMacroTailwindPlugin(value) {
|
|
282
402
|
return Boolean(value && (typeof value === "function" || typeof value === "object") && value["__weappTailwindcssCssMacro"] === true);
|
|
283
403
|
}
|
|
@@ -338,8 +458,9 @@ function withCssMacroStyleOptions(options) {
|
|
|
338
458
|
function hasCssMacroStyleOptions(options) {
|
|
339
459
|
return Boolean(options?.[CSS_MACRO_STYLE_OPTIONS_MARKER]);
|
|
340
460
|
}
|
|
341
|
-
async function transformCssMacroCss(css) {
|
|
342
|
-
|
|
461
|
+
async function transformCssMacroCss(css, options) {
|
|
462
|
+
const result = (await require_runtime_registry.postcss_default([creator()]).process(css, { from: void 0 })).css;
|
|
463
|
+
return compileCssMacroConditionalComments(result, options);
|
|
343
464
|
}
|
|
344
465
|
//#endregion
|
|
345
466
|
//#region src/context/workspace.ts
|
|
@@ -912,7 +1033,7 @@ function normalizeTailwindV4GeneratedUrlValues(css) {
|
|
|
912
1033
|
});
|
|
913
1034
|
}
|
|
914
1035
|
async function transformTailwindV4CssToWeapp(css, options) {
|
|
915
|
-
const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
|
|
1036
|
+
const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
|
|
916
1037
|
const result = await defaultStyleHandler$1(protectedCss.css, {
|
|
917
1038
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
918
1039
|
cssRemoveHoverPseudoClass: true,
|
|
@@ -925,7 +1046,7 @@ async function transformTailwindV4CssToWeapp(css, options) {
|
|
|
925
1046
|
}
|
|
926
1047
|
async function transformTailwindV4CssByTarget(css, target, options) {
|
|
927
1048
|
if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
|
|
928
|
-
return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css) : css;
|
|
1049
|
+
return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
|
|
929
1050
|
}
|
|
930
1051
|
//#endregion
|
|
931
1052
|
//#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
|
|
@@ -2625,7 +2746,7 @@ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
|
|
|
2625
2746
|
}
|
|
2626
2747
|
}
|
|
2627
2748
|
async function transformTailwindV3CssToWeapp(css, options) {
|
|
2628
|
-
const result = await defaultStyleHandler(css, {
|
|
2749
|
+
const result = await defaultStyleHandler(hasCssMacroStyleOptions(options) ? await transformCssMacroCss(css, options) : css, {
|
|
2629
2750
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
2630
2751
|
cssRemoveHoverPseudoClass: true,
|
|
2631
2752
|
isMainChunk: true,
|
|
@@ -2640,7 +2761,7 @@ async function transformTailwindV3CssToWeapp(css, options) {
|
|
|
2640
2761
|
}
|
|
2641
2762
|
async function transformTailwindV3CssByTarget(css, target, options) {
|
|
2642
2763
|
if (target === "weapp") return transformTailwindV3CssToWeapp(css, options);
|
|
2643
|
-
return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css) : css;
|
|
2764
|
+
return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css, options) : css;
|
|
2644
2765
|
}
|
|
2645
2766
|
//#endregion
|
|
2646
2767
|
//#region src/tailwindcss/v3-engine/generator.ts
|
|
@@ -3272,6 +3393,11 @@ const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?
|
|
|
3272
3393
|
const TAILWIND_EXTRACTABLE_DIRECTIVE_RE = /^\s*@(?:import|use|forward|tailwind|config|source|reference|plugin)\b[\s\S]*?(?:;|$)/;
|
|
3273
3394
|
const TAILWIND_EXTRACTABLE_LAYER_STATEMENT_RE = /^\s*@layer\s[^;{]+;\s*$/;
|
|
3274
3395
|
const TAILWIND_EXTRACTABLE_BLOCK_START_RE = /^\s*@(?:layer|theme|utility|variant|custom-variant)\b[\s\S]*\{/;
|
|
3396
|
+
const TAILWIND_V3_SUBPATH_IMPORT_LAYERS = new Map([
|
|
3397
|
+
["tailwindcss/base", "base"],
|
|
3398
|
+
["tailwindcss/components", "components"],
|
|
3399
|
+
["tailwindcss/utilities", "utilities"]
|
|
3400
|
+
]);
|
|
3275
3401
|
function parseImportRequest(params) {
|
|
3276
3402
|
return /^(?:url\(\s*)?(["']?)([^"')\s]+)\1\s*\)?/.exec(params.trim())?.[2];
|
|
3277
3403
|
}
|
|
@@ -3451,6 +3577,24 @@ function hasPreprocessorOnlySyntax(rawSource) {
|
|
|
3451
3577
|
function normalizeTailwindSourceForGenerator(rawSource, options = {}) {
|
|
3452
3578
|
return hasPreprocessorOnlySyntax(rawSource) ? extractTailwindSourceForPostcssFallback(rawSource, options) ?? rawSource : rawSource;
|
|
3453
3579
|
}
|
|
3580
|
+
function normalizeTailwindV3CssEntrySource(rawSource) {
|
|
3581
|
+
try {
|
|
3582
|
+
const root = require_runtime_registry.postcss_default.parse(rawSource);
|
|
3583
|
+
let changed = false;
|
|
3584
|
+
root.walkAtRules("import", (node) => {
|
|
3585
|
+
const layer = TAILWIND_V3_SUBPATH_IMPORT_LAYERS.get(parseImportRequest(node.params) ?? "");
|
|
3586
|
+
if (!layer) return;
|
|
3587
|
+
node.replaceWith(require_runtime_registry.postcss_default.atRule({
|
|
3588
|
+
name: "tailwind",
|
|
3589
|
+
params: layer
|
|
3590
|
+
}));
|
|
3591
|
+
changed = true;
|
|
3592
|
+
});
|
|
3593
|
+
return changed ? root.toString() : rawSource;
|
|
3594
|
+
} catch {
|
|
3595
|
+
return rawSource;
|
|
3596
|
+
}
|
|
3597
|
+
}
|
|
3454
3598
|
function normalizeTailwindSourceDirectives(rawSource, options = {}) {
|
|
3455
3599
|
if (!options.importFallback) return rawSource;
|
|
3456
3600
|
try {
|
|
@@ -4332,14 +4476,14 @@ async function resolveGeneratorSource(majorVersion, runtimeState, rawSource, fil
|
|
|
4332
4476
|
css: rawSource
|
|
4333
4477
|
} : void 0;
|
|
4334
4478
|
const sourceSideEntrySource = canResolveSourceSideCssEntry(file, cssHandlerOptions) ? resolveSourceSideCssEntrySource(file, mergedSourceOptions, { removeConfig: true }) : void 0;
|
|
4335
|
-
const resolvedEntrySource = shouldResolveSourceSideCssEntry(rawSource) ?
|
|
4479
|
+
const resolvedEntrySource = shouldResolveSourceSideCssEntry(rawSource) ? cssEntrySource ?? applyEntrySource ?? sourceSideEntrySource : shouldPreferTailwindV3SourceSideEntry(rawSource, sourceSideEntrySource) ? sourceSideEntrySource ?? cssEntrySource : cssEntrySource ?? applyEntrySource ?? sourceSideEntrySource;
|
|
4336
4480
|
if (!resolvedEntrySource) return generatorOptions?.config ? resolveTailwindV3Source(mergedSourceOptions) : resolveTailwindV3SourceFromPatcher(runtimeState.twPatcher);
|
|
4337
4481
|
if (cssEntrySource && !sourceSideEntrySource && !applyEntrySource && !hasTailwindRootDirectives(rawSource, { importFallback: true })) return generatorOptions?.config ? resolveTailwindV3Source(mergedSourceOptions) : resolveTailwindV3SourceFromPatcher(runtimeState.twPatcher);
|
|
4338
4482
|
const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, omitUndefined(mergedSourceOptions));
|
|
4339
4483
|
return resolveTailwindV3Source({
|
|
4340
4484
|
...mergedSourceOptions,
|
|
4341
4485
|
base: resolvedEntrySource.base,
|
|
4342
|
-
css: resolvedEntrySource.css,
|
|
4486
|
+
css: normalizeTailwindV3CssEntrySource(resolvedEntrySource.css),
|
|
4343
4487
|
...config ? { config } : {}
|
|
4344
4488
|
});
|
|
4345
4489
|
}
|
|
@@ -4686,6 +4830,71 @@ function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
|
|
|
4686
4830
|
}
|
|
4687
4831
|
}
|
|
4688
4832
|
//#endregion
|
|
4833
|
+
//#region src/bundlers/shared/generator-css/user-layer-order.ts
|
|
4834
|
+
const USER_LAYER_COMPONENTS_START = "/*! weapp-tailwindcss layer components start */";
|
|
4835
|
+
const USER_LAYER_COMPONENTS_END = "/*! weapp-tailwindcss layer components end */";
|
|
4836
|
+
const UTILITY_LAYER_INSERTION_RES = [
|
|
4837
|
+
/(^|\n)\.(?:fixed|absolute|relative|sticky|static)\s*\{/,
|
|
4838
|
+
/(^|\n)\.(?:block|inline-block|inline|flex|inline-flex|grid|hidden)\s*\{/,
|
|
4839
|
+
/(^|\n)\.(?:m|mx|my|mt|mr|mb|ml|p|px|py|pt|pr|pb|pl)-/,
|
|
4840
|
+
/(^|\n)\.(?:w|h|min-w|min-h|max-w|max-h)-/,
|
|
4841
|
+
/(^|\n)\.(?:bg|text|border|rounded|shadow|opacity|transition|transform|translate|scale|rotate|gap|items|justify|content)-/
|
|
4842
|
+
];
|
|
4843
|
+
function appendCss(base, extra) {
|
|
4844
|
+
if (!base) return extra;
|
|
4845
|
+
if (!extra) return base;
|
|
4846
|
+
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
4847
|
+
return `${base}\n${extra}`;
|
|
4848
|
+
}
|
|
4849
|
+
function wrapUserLayerComponentsCss(css) {
|
|
4850
|
+
return css.trim().length > 0 ? `${USER_LAYER_COMPONENTS_START}\n${css}\n${USER_LAYER_COMPONENTS_END}` : css;
|
|
4851
|
+
}
|
|
4852
|
+
function extractMarkedUserLayerComponentsCss(css) {
|
|
4853
|
+
const layers = [];
|
|
4854
|
+
let rest = "";
|
|
4855
|
+
let cursor = 0;
|
|
4856
|
+
while (cursor < css.length) {
|
|
4857
|
+
const startIndex = css.indexOf(USER_LAYER_COMPONENTS_START, cursor);
|
|
4858
|
+
if (startIndex === -1) {
|
|
4859
|
+
rest += css.slice(cursor);
|
|
4860
|
+
break;
|
|
4861
|
+
}
|
|
4862
|
+
rest += css.slice(cursor, startIndex);
|
|
4863
|
+
const contentStart = startIndex + 47;
|
|
4864
|
+
const endIndex = css.indexOf(USER_LAYER_COMPONENTS_END, contentStart);
|
|
4865
|
+
if (endIndex === -1) {
|
|
4866
|
+
rest += css.slice(startIndex);
|
|
4867
|
+
break;
|
|
4868
|
+
}
|
|
4869
|
+
const layerCss = css.slice(contentStart, endIndex).trim();
|
|
4870
|
+
if (layerCss) layers.push(layerCss);
|
|
4871
|
+
cursor = endIndex + 45;
|
|
4872
|
+
}
|
|
4873
|
+
return {
|
|
4874
|
+
layers,
|
|
4875
|
+
rest
|
|
4876
|
+
};
|
|
4877
|
+
}
|
|
4878
|
+
function findUtilityLayerInsertionIndex(css) {
|
|
4879
|
+
let index = -1;
|
|
4880
|
+
for (const pattern of UTILITY_LAYER_INSERTION_RES) {
|
|
4881
|
+
const match = pattern.exec(css);
|
|
4882
|
+
if (!match) continue;
|
|
4883
|
+
const nextIndex = match.index + (match[1]?.length ?? 0);
|
|
4884
|
+
index = index === -1 ? nextIndex : Math.min(index, nextIndex);
|
|
4885
|
+
}
|
|
4886
|
+
return index;
|
|
4887
|
+
}
|
|
4888
|
+
function reorderMarkedUserLayerComponentsCss(css) {
|
|
4889
|
+
if (!css.includes(USER_LAYER_COMPONENTS_START)) return css;
|
|
4890
|
+
const { layers, rest } = extractMarkedUserLayerComponentsCss(css);
|
|
4891
|
+
if (layers.length === 0) return rest;
|
|
4892
|
+
const layerCss = layers.join("\n");
|
|
4893
|
+
const insertionIndex = findUtilityLayerInsertionIndex(rest);
|
|
4894
|
+
if (insertionIndex === -1) return appendCss(rest, layerCss);
|
|
4895
|
+
return appendCss(appendCss(rest.slice(0, insertionIndex), layerCss), rest.slice(insertionIndex));
|
|
4896
|
+
}
|
|
4897
|
+
//#endregion
|
|
4689
4898
|
//#region src/bundlers/shared/generator-css.ts
|
|
4690
4899
|
const SUPPORTED_GENERATOR_MAJOR_VERSIONS = new Set([3, 4]);
|
|
4691
4900
|
const REMOTE_IMPORT_RE = /^(?:https?:)?\/\//i;
|
|
@@ -4759,6 +4968,9 @@ function createCssSourceOrderAppend(base, extra) {
|
|
|
4759
4968
|
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
4760
4969
|
return `${base}\n${extra}`;
|
|
4761
4970
|
}
|
|
4971
|
+
function shouldFinalizeMarkedUserLayerComponentsCss(file) {
|
|
4972
|
+
return !/\.(?:vue|svelte|astro|scss|sass|less|styl)(?:[?#].*)?$/i.test(file);
|
|
4973
|
+
}
|
|
4762
4974
|
function splitRawSourceByGeneratedCssOrder(rawSource, rawTailwindCss) {
|
|
4763
4975
|
const placeholderParts = splitGeneratorPlaceholderCssBySourceOrder(rawSource, rawTailwindCss);
|
|
4764
4976
|
if (placeholderParts) return placeholderParts;
|
|
@@ -4766,6 +4978,84 @@ function splitRawSourceByGeneratedCssOrder(rawSource, rawTailwindCss) {
|
|
|
4766
4978
|
if (exactParts) return exactParts;
|
|
4767
4979
|
return splitTailwindGeneratedCssByBanner(rawSource);
|
|
4768
4980
|
}
|
|
4981
|
+
function splitUserCssLayerBlocks(source) {
|
|
4982
|
+
if (!source.includes("@layer")) return {
|
|
4983
|
+
layer: "",
|
|
4984
|
+
rest: source
|
|
4985
|
+
};
|
|
4986
|
+
try {
|
|
4987
|
+
const root = require_runtime_registry.postcss_default.parse(source);
|
|
4988
|
+
const layerRoot = require_runtime_registry.postcss_default.root();
|
|
4989
|
+
const restRoot = require_runtime_registry.postcss_default.root();
|
|
4990
|
+
for (const node of root.nodes) (node.type === "atrule" && node.name === "layer" && node.nodes?.length ? layerRoot : restRoot).append(node.clone());
|
|
4991
|
+
return {
|
|
4992
|
+
layer: layerRoot.toString(),
|
|
4993
|
+
rest: restRoot.toString()
|
|
4994
|
+
};
|
|
4995
|
+
} catch {
|
|
4996
|
+
return {
|
|
4997
|
+
layer: source,
|
|
4998
|
+
rest: ""
|
|
4999
|
+
};
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
function hasUserCssLayerBlocks(source) {
|
|
5003
|
+
if (!source.includes("@layer")) return false;
|
|
5004
|
+
try {
|
|
5005
|
+
let hasLayerBlock = false;
|
|
5006
|
+
require_runtime_registry.postcss_default.parse(source).walkAtRules("layer", (node) => {
|
|
5007
|
+
if (node.nodes?.length) hasLayerBlock = true;
|
|
5008
|
+
});
|
|
5009
|
+
return hasLayerBlock;
|
|
5010
|
+
} catch {
|
|
5011
|
+
return true;
|
|
5012
|
+
}
|
|
5013
|
+
}
|
|
5014
|
+
function collectUserLayerSelectors(source) {
|
|
5015
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
5016
|
+
try {
|
|
5017
|
+
require_runtime_registry.postcss_default.parse(source).walkRules((rule) => {
|
|
5018
|
+
for (const selector of rule.selectors ?? [rule.selector]) {
|
|
5019
|
+
const normalized = selector.trim();
|
|
5020
|
+
if (normalized) selectors.add(normalized);
|
|
5021
|
+
}
|
|
5022
|
+
});
|
|
5023
|
+
} catch {}
|
|
5024
|
+
return selectors;
|
|
5025
|
+
}
|
|
5026
|
+
function matchesUserLayerSelector(selector, userLayerSelector) {
|
|
5027
|
+
if (selector === userLayerSelector) return true;
|
|
5028
|
+
if (!selector.startsWith(userLayerSelector)) return false;
|
|
5029
|
+
const next = selector[userLayerSelector.length];
|
|
5030
|
+
return next === ":" || next === "[";
|
|
5031
|
+
}
|
|
5032
|
+
function extractGeneratedCssForUserLayerSelectors(css, userLayerSource) {
|
|
5033
|
+
const selectors = collectUserLayerSelectors(userLayerSource);
|
|
5034
|
+
if (selectors.size === 0) return {
|
|
5035
|
+
layer: "",
|
|
5036
|
+
rest: css
|
|
5037
|
+
};
|
|
5038
|
+
try {
|
|
5039
|
+
const root = require_runtime_registry.postcss_default.parse(css);
|
|
5040
|
+
const layerRoot = require_runtime_registry.postcss_default.root();
|
|
5041
|
+
const selectorList = [...selectors];
|
|
5042
|
+
root.walkRules((rule) => {
|
|
5043
|
+
if ((rule.selectors ?? [rule.selector]).some((selector) => selectorList.some((userSelector) => matchesUserLayerSelector(selector.trim(), userSelector)))) {
|
|
5044
|
+
layerRoot.append(rule.clone());
|
|
5045
|
+
rule.remove();
|
|
5046
|
+
}
|
|
5047
|
+
});
|
|
5048
|
+
return {
|
|
5049
|
+
layer: layerRoot.toString(),
|
|
5050
|
+
rest: root.toString()
|
|
5051
|
+
};
|
|
5052
|
+
} catch {
|
|
5053
|
+
return {
|
|
5054
|
+
layer: "",
|
|
5055
|
+
rest: css
|
|
5056
|
+
};
|
|
5057
|
+
}
|
|
5058
|
+
}
|
|
4769
5059
|
async function transformGeneratorUserCss(source, options) {
|
|
4770
5060
|
if (source.trim().length === 0) return "";
|
|
4771
5061
|
const cleanedSource = removeTailwindSourceDirectives(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(source)), { importFallback: options.importFallback });
|
|
@@ -4894,7 +5184,7 @@ async function generateCssByGenerator(options) {
|
|
|
4894
5184
|
sources: generatedResults.flatMap((item) => item.sources)
|
|
4895
5185
|
};
|
|
4896
5186
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
4897
|
-
if (typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
5187
|
+
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(effectiveRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
4898
5188
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
4899
5189
|
return {
|
|
4900
5190
|
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: false })) : options.previousCss,
|
|
@@ -4916,9 +5206,14 @@ async function generateCssByGenerator(options) {
|
|
|
4916
5206
|
styleHandler,
|
|
4917
5207
|
importFallback: generatorOptions.importFallback
|
|
4918
5208
|
};
|
|
5209
|
+
const afterLayerParts = generated.target === "weapp" ? splitUserCssLayerBlocks(orderedExtraCss.after) : {
|
|
5210
|
+
layer: "",
|
|
5211
|
+
rest: orderedExtraCss.after
|
|
5212
|
+
};
|
|
4919
5213
|
const beforeUserCss = await transformGeneratorUserCss(orderedExtraCss.before, userCssOptions);
|
|
4920
|
-
const
|
|
4921
|
-
|
|
5214
|
+
const afterLayerUserCss = await transformGeneratorUserCss(afterLayerParts.layer, userCssOptions);
|
|
5215
|
+
const afterUserCss = await transformGeneratorUserCss(afterLayerParts.rest, userCssOptions);
|
|
5216
|
+
css = createCssSourceOrderAppend(createCssSourceOrderAppend(createCssSourceOrderAppend(beforeUserCss, generated.target === "weapp" ? wrapUserLayerComponentsCss(afterLayerUserCss) : afterLayerUserCss), css), afterUserCss);
|
|
4922
5217
|
if (isEmptyCssSourceOrderParts(orderedExtraCss) && shouldAppendWebBundleCssFallback(generated.target, {
|
|
4923
5218
|
hasSourceDirectives,
|
|
4924
5219
|
hasMatchedCssSourceFile
|
|
@@ -4927,6 +5222,7 @@ async function generateCssByGenerator(options) {
|
|
|
4927
5222
|
css = createCssSourceOrderAppend(css, userCss);
|
|
4928
5223
|
}
|
|
4929
5224
|
if (generated.target === "weapp") {
|
|
5225
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
4930
5226
|
css = await appendLegacyCompatCss(css, effectiveRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
4931
5227
|
css = await appendLegacyContainerCompatCss(css, effectiveRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
4932
5228
|
}
|
|
@@ -4939,7 +5235,27 @@ async function generateCssByGenerator(options) {
|
|
|
4939
5235
|
}
|
|
4940
5236
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
4941
5237
|
let css = stripTailwindBanner(generated.css);
|
|
4942
|
-
if (generated.target === "weapp")
|
|
5238
|
+
if (generated.target === "weapp") {
|
|
5239
|
+
css = inheritLegacyUnitConvertedDeclarations(css, effectiveRawSource);
|
|
5240
|
+
if (hasUserCssLayerBlocks(effectiveRawSource)) {
|
|
5241
|
+
const layerParts = splitUserCssLayerBlocks(effectiveRawSource);
|
|
5242
|
+
const layerUserCss = await transformGeneratorUserCss(layerParts.layer, {
|
|
5243
|
+
generatorTarget: generated.target,
|
|
5244
|
+
generatorStyleOptions,
|
|
5245
|
+
cssUserHandlerOptions,
|
|
5246
|
+
styleHandler,
|
|
5247
|
+
importFallback: generatorOptions.importFallback
|
|
5248
|
+
});
|
|
5249
|
+
const layerCss = layerUserCss.trim().length > 0 && !hasTailwindApplyDirective(layerUserCss) ? {
|
|
5250
|
+
layer: layerUserCss,
|
|
5251
|
+
rest: css
|
|
5252
|
+
} : extractGeneratedCssForUserLayerSelectors(css, layerParts.layer);
|
|
5253
|
+
if (layerCss.layer.trim().length > 0) {
|
|
5254
|
+
css = createCssSourceOrderAppend(wrapUserLayerComponentsCss(layerCss.layer), layerCss.rest);
|
|
5255
|
+
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
5256
|
+
}
|
|
5257
|
+
}
|
|
5258
|
+
}
|
|
4943
5259
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
4944
5260
|
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
4945
5261
|
hasSourceDirectives,
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-DwY4Fixu.js");
|
|
3
|
+
const require_generator = require("./generator-BEXaaUzP.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CLP1Qv8F.js");
|
|
5
|
+
const require_precheck = require("./precheck-CQeqnfo5.js");
|
|
6
6
|
const require_utils = require("./utils-D7Ygohep.js");
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_bundle_state = require("./bundle-state-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-Cl7hUlYV.js");
|
|
8
|
+
const require_bundle_state = require("./bundle-state-C4ib5xPG.js");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
10
10
|
node_fs = require_chunk.__toESM(node_fs);
|
|
11
11
|
let node_module = require("node:module");
|
|
12
12
|
node_module = require_chunk.__toESM(node_module);
|
|
13
|
-
let node_path = require("node:path");
|
|
14
|
-
node_path = require_chunk.__toESM(node_path);
|
|
15
13
|
let node_process = require("node:process");
|
|
16
14
|
node_process = require_chunk.__toESM(node_process);
|
|
15
|
+
let node_path = require("node:path");
|
|
16
|
+
node_path = require_chunk.__toESM(node_path);
|
|
17
17
|
//#region src/shared/tailwindcss-css-redirect.ts
|
|
18
18
|
const moduleWithMutableResolve = node_module.default;
|
|
19
19
|
const patched = /* @__PURE__ */ new WeakSet();
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { b as ensureRuntimeClassSet, d as _defineProperty, f as init_defineProperty, i as pluginName, n as getCompilerContext, t as shouldSkipJsTransform, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./precheck-
|
|
2
|
-
import { B as createDebug, W as resolveTailwindcssOptions, l as getRuntimeClassSetSignature } from "./v3-engine-
|
|
3
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
4
|
-
import { i as generateCssByGenerator,
|
|
1
|
+
import { b as ensureRuntimeClassSet, d as _defineProperty, f as init_defineProperty, i as pluginName, n as getCompilerContext, t as shouldSkipJsTransform, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./precheck-nITnYBDn.mjs";
|
|
2
|
+
import { B as createDebug, W as resolveTailwindcssOptions, l as getRuntimeClassSetSignature } from "./v3-engine-C_KeUQG3.mjs";
|
|
3
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-CpsHA4Wd.mjs";
|
|
4
|
+
import { i as generateCssByGenerator, r as emitHmrTiming, s as processCachedTask, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-D2fsgk5t.mjs";
|
|
5
5
|
import { r as getGroupedEntries } from "./utils-DsaS975I.mjs";
|
|
6
|
-
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
7
|
-
import { _ as stripRequestQuery, b as toAbsoluteOutputPath, d as resolvePluginDisabledState, g as isSourceStyleRequest, l as stripBundlerGeneratedCssMarkers, n as createBundleBuildState, o as pushConcurrentTaskFactories, r as updateBundleBuildState, t as buildBundleSnapshot, u as resolvePackageDir, y as resolveOutputSpecifier } from "./bundle-state-
|
|
6
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-udhXxMX9.mjs";
|
|
7
|
+
import { _ as stripRequestQuery, b as toAbsoluteOutputPath, d as resolvePluginDisabledState, g as isSourceStyleRequest, l as stripBundlerGeneratedCssMarkers, n as createBundleBuildState, o as pushConcurrentTaskFactories, r as updateBundleBuildState, t as buildBundleSnapshot, u as resolvePackageDir, y as resolveOutputSpecifier } from "./bundle-state-BIsgsoNW.mjs";
|
|
8
8
|
import Module, { createRequire } from "node:module";
|
|
9
9
|
import fs from "node:fs";
|
|
10
|
-
import path from "node:path";
|
|
11
10
|
import process from "node:process";
|
|
11
|
+
import path from "node:path";
|
|
12
12
|
import { fileURLToPath } from "node:url";
|
|
13
13
|
//#region src/shared/tailwindcss-css-redirect.ts
|
|
14
14
|
const moduleWithMutableResolve = Module;
|
package/dist/webpack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_webpack = require("./webpack-
|
|
2
|
+
const require_webpack = require("./webpack-CPwDaKy3.js");
|
|
3
3
|
exports.WeappTailwindcss = require_webpack.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_webpack.WeappTailwindcss;
|
|
5
5
|
exports.weappTailwindcssPackageDir = require_webpack.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-xxmiRxcy.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss, weappTailwindcssPackageDir };
|