weapp-tailwindcss 5.1.14 → 5.1.15
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-2dg_uhEJ.mjs +13 -0
- package/dist/bundlers/gulp/frameworks/native/index.d.ts +2 -0
- package/dist/bundlers/gulp/index.d.ts +2 -0
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +2 -0
- package/dist/bundlers/shared/generated-css-marker.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver/postcss-source.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/types.d.ts +5 -0
- package/dist/bundlers/shared/style-requests.d.ts +1 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/bundle-markup-candidates.d.ts +20 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +5 -0
- package/dist/bundlers/vite/serve-css-generation.d.ts +3 -2
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
- package/dist/bundlers/vite/watch-css-post.d.ts +10 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +6 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +1 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +2 -0
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +1 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-generation-loader.d.ts +4 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +3 -0
- package/dist/{context-BL8Gy71H.mjs → context-BgGWVAmN.mjs} +2 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/{generator-B59OA64h.mjs → generator-CEo920So.mjs} +1 -1
- package/dist/generator.mjs +1 -1
- package/dist/{gulp-C1Q3LRzg.js → gulp-3m1dAiig.js} +84 -50
- package/dist/{gulp-DUYWxmZC.mjs → gulp-DP71z1jG.mjs} +87 -53
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-C3ed5vCx.mjs → hmr-timing-1aS6--U7.mjs} +170 -44
- package/dist/{hmr-timing-BZ5sWIqO.js → hmr-timing-B8p4f0ca.js} +219 -39
- package/dist/index.js +3 -3
- package/dist/index.mjs +4 -4
- package/dist/postcss.mjs +1 -1
- package/dist/presets.mjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/shared/mpx.d.ts +4 -1
- package/dist/{source-candidate-scan-signature-R3dzamcm.js → source-candidate-scan-signature-BAahhiwb.js} +4 -96
- package/dist/{source-candidate-scan-signature-D7RWjWsY.mjs → source-candidate-scan-signature-Cf7259PR.mjs} +6 -62
- package/dist/{tailwindcss-DPcKMLxL.mjs → tailwindcss-xs704TRw.mjs} +1 -1
- package/dist/{transform-D5JUgMpE.mjs → transform-B_KM9sLX.mjs} +47 -5
- package/dist/{transform-COFRlmDF.js → transform-CcYptivi.js} +47 -5
- package/dist/uni-app-x/component-local-style.d.ts +1 -0
- package/dist/uni-app-x/style-asset/style-value.d.ts +1 -1
- package/dist/{vite-BNlPdsGM.js → vite-DUVjMduj.js} +550 -273
- package/dist/{vite-CBU5NXTX.mjs → vite-nXZEiwG0.mjs} +501 -224
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-generation-loader.js +12 -0
- package/dist/weapp-tw-css-import-rewrite-loader-DNk0IxAt.js +10198 -0
- package/dist/weapp-tw-css-import-rewrite-loader.js +6 -10255
- package/dist/{webpack-CZ38fMGC.mjs → webpack-C_UUFRgj.mjs} +223 -57
- package/dist/{webpack-Jpe048pQ.js → webpack-nppysF4B.js} +232 -66
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +11 -3
- package/dist/auto-CrJJc5rK.mjs +0 -13
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Q as normalizeTailwindConfigDirectives, X as hasTailwindRootDirectives, et as normalizeTailwindSourceForGenerator, g as upsertTailwindV4CssSource, gt as prependConfigDirective, h as hasConfiguredTailwindV4CssRoots, vt as getTailwindV4IncrementalGenerateCacheStats } from "./generator-
|
|
2
|
-
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-
|
|
1
|
+
import { Q as normalizeTailwindConfigDirectives, X as hasTailwindRootDirectives, et as normalizeTailwindSourceForGenerator, g as upsertTailwindV4CssSource, gt as prependConfigDirective, h as hasConfiguredTailwindV4CssRoots, vt as getTailwindV4IncrementalGenerateCacheStats } from "./generator-CEo920So.mjs";
|
|
2
|
+
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-xs704TRw.mjs";
|
|
3
3
|
import { y as createDebug } from "./wxml-DdGdeqaH.mjs";
|
|
4
|
-
import { l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-
|
|
5
|
-
import {
|
|
4
|
+
import { l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-BgGWVAmN.mjs";
|
|
5
|
+
import { E as finalizeMiniProgramGeneratorCss, F as annotateCssSourceTrace, I as createCssSourceTraceCacheSignature, L as createCssTokenSourceMap, M as hasBundlerGeneratedCssMarker, P as stripBundlerGeneratedCssMarkers, S as splitLocalCssImports, c as createBundleRuntimeClassSetManager, d as generateCssByGenerator, j as createBundlerGeneratedCssMarker, n as emitHmrTiming, r as createSourceCandidateCollector, x as rewriteLocalCssImportRequestsForOutput, z as processCachedTask } from "./hmr-timing-1aS6--U7.mjs";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
@@ -217,6 +217,7 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
217
217
|
let runtimeSetDirty = false;
|
|
218
218
|
const runtimeSourceHashByFile = /* @__PURE__ */ new Map();
|
|
219
219
|
const runtimeSourcesByFile = /* @__PURE__ */ new Map();
|
|
220
|
+
const generatedCssPreflightModeByFile = /* @__PURE__ */ new Map();
|
|
220
221
|
let cachedGulpSourceCandidateSignature;
|
|
221
222
|
const gulpProcessCacheKeys = /* @__PURE__ */ new Set();
|
|
222
223
|
const bundleRuntimeClassSetManager = options.__internalGulpRuntimeClassSetManager ?? createBundleRuntimeClassSetManager();
|
|
@@ -414,58 +415,89 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
414
415
|
runtimeSourcesByFile
|
|
415
416
|
}) };
|
|
416
417
|
}
|
|
417
|
-
|
|
418
|
+
function createWxssTransform(options, stage) {
|
|
419
|
+
return createVinylTransform(`css:${stage}`, async (file) => {
|
|
420
|
+
if (!file.contents) return;
|
|
421
|
+
const rawSource = file.contents.toString();
|
|
422
|
+
const cssSourceChanged = await registerAutoCssSource(file, rawSource);
|
|
423
|
+
const shouldUseGenerator = runtimeState.tailwindRuntime.majorVersion === 4;
|
|
424
|
+
let gulpSourceCandidateGetter;
|
|
425
|
+
if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
426
|
+
const nextRuntimeSet = await refreshRuntimeSet({
|
|
427
|
+
forceRefresh: cssSourceChanged,
|
|
428
|
+
forceCollect: cssSourceChanged,
|
|
429
|
+
clearCache: cssSourceChanged
|
|
430
|
+
});
|
|
431
|
+
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
432
|
+
const sourceTraceSignature = createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
433
|
+
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
434
|
+
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
435
|
+
const outputSignature = styleOutputExtension ? `gulp-output:1:${stage}:${styleOutputExtension}` : `gulp-output:0:${stage}`;
|
|
436
|
+
await processCachedTask({
|
|
437
|
+
cache,
|
|
438
|
+
cacheKey: file.path,
|
|
439
|
+
hash: createRuntimeSetHash(rawSource, nextRuntimeSet, sourceTraceSignature, sourceCandidateSignature, outputSignature),
|
|
440
|
+
applyResult(source) {
|
|
441
|
+
file.contents = Buffer.from(source);
|
|
442
|
+
},
|
|
443
|
+
onCacheHit() {
|
|
444
|
+
debug("css cache hit: %s", file.path);
|
|
445
|
+
},
|
|
446
|
+
async transform() {
|
|
447
|
+
await runtimeState.readyPromise;
|
|
448
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
449
|
+
const generated = shouldUseGenerator ? await generateCssByGenerator({
|
|
450
|
+
opts,
|
|
451
|
+
runtimeState,
|
|
452
|
+
runtime: nextRuntimeSet,
|
|
453
|
+
rawSource,
|
|
454
|
+
file: file.path,
|
|
455
|
+
cssHandlerOptions,
|
|
456
|
+
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
457
|
+
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
458
|
+
styleHandler,
|
|
459
|
+
debug,
|
|
460
|
+
deferCssAdaptation: stage === "generate"
|
|
461
|
+
}) : void 0;
|
|
462
|
+
const transformedCss = generated?.css ?? (stage === "generate" ? rawSource : (await styleHandler(rawSource, cssHandlerOptions)).css);
|
|
463
|
+
if (stage === "generate") {
|
|
464
|
+
const preflightMode = generated?.metadata?.preflightMode;
|
|
465
|
+
if (preflightMode) generatedCssPreflightModeByFile.set(file.path, preflightMode);
|
|
466
|
+
else generatedCssPreflightModeByFile.delete(file.path);
|
|
467
|
+
}
|
|
468
|
+
const css = annotateCssSourceTrace(transformedCss, {
|
|
469
|
+
opts,
|
|
470
|
+
tokenSources: sourceTraceTokenSources
|
|
471
|
+
});
|
|
472
|
+
const generatedCss = stage === "generate" && generated ? `${createBundlerGeneratedCssMarker("gulp", file.path)}\n${css}` : css;
|
|
473
|
+
const outputCss = stage === "generate" ? generatedCss : rewriteLocalCssImportRequestsForOutput(generatedCss, { styleOutputExtension });
|
|
474
|
+
debug("css handle: %s", file.path);
|
|
475
|
+
return { result: outputCss };
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
479
|
+
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
480
|
+
}, () => resolveGulpTransformTimingDetails(`css:${stage}`));
|
|
481
|
+
}
|
|
482
|
+
const generateWxss = (options = {}) => createWxssTransform(options, "generate");
|
|
483
|
+
const transformWxss = (options = {}) => createWxssTransform(options, "transform");
|
|
484
|
+
const adaptWxss = (options = {}) => createVinylTransform("css:adapt", async (file) => {
|
|
418
485
|
if (!file.contents) return;
|
|
419
486
|
const rawSource = file.contents.toString();
|
|
420
|
-
const
|
|
421
|
-
const
|
|
422
|
-
let gulpSourceCandidateGetter;
|
|
423
|
-
if (shouldUseGenerator) gulpSourceCandidateGetter = await refreshGulpV4SourceCandidates(cssSourceChanged);
|
|
424
|
-
const nextRuntimeSet = await refreshRuntimeSet({
|
|
425
|
-
forceRefresh: cssSourceChanged,
|
|
426
|
-
forceCollect: cssSourceChanged,
|
|
427
|
-
clearCache: cssSourceChanged
|
|
428
|
-
});
|
|
429
|
-
const sourceTraceTokenSources = cachedGulpSourceCandidateSourceGetter ? createCssTokenSourceMap(cachedGulpSourceCandidateSourceGetter(void 0), opts) : void 0;
|
|
430
|
-
const sourceTraceSignature = createCssSourceTraceCacheSignature(sourceTraceTokenSources, opts);
|
|
431
|
-
const sourceCandidateSignature = cachedGulpSourceCandidateGetter ? `gulp-source-candidates:1:${[...cachedGulpSourceCandidateGetter(void 0)].sort().join("\n")}` : void 0;
|
|
487
|
+
const generatedCss = hasBundlerGeneratedCssMarker(rawSource);
|
|
488
|
+
const source = generatedCss ? stripBundlerGeneratedCssMarkers(rawSource) : rawSource;
|
|
432
489
|
const styleOutputExtension = resolveGulpStyleOutputExtension(file);
|
|
433
|
-
const
|
|
434
|
-
await
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
async transform() {
|
|
445
|
-
await runtimeState.readyPromise;
|
|
446
|
-
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, rawSource, options);
|
|
447
|
-
const outputCss = rewriteLocalCssImportRequestsForOutput(annotateCssSourceTrace((shouldUseGenerator ? await generateCssByGenerator({
|
|
448
|
-
opts,
|
|
449
|
-
runtimeState,
|
|
450
|
-
runtime: nextRuntimeSet,
|
|
451
|
-
rawSource,
|
|
452
|
-
file: file.path,
|
|
453
|
-
cssHandlerOptions,
|
|
454
|
-
cssUserHandlerOptions: resolveWxssUserHandlerOptions(options),
|
|
455
|
-
getSourceCandidatesForEntries: gulpSourceCandidateGetter,
|
|
456
|
-
styleHandler,
|
|
457
|
-
debug
|
|
458
|
-
}) : void 0)?.css ?? (await styleHandler(rawSource, cssHandlerOptions)).css, {
|
|
459
|
-
opts,
|
|
460
|
-
tokenSources: sourceTraceTokenSources
|
|
461
|
-
}), { styleOutputExtension });
|
|
462
|
-
debug("css handle: %s", file.path);
|
|
463
|
-
return { result: outputCss };
|
|
464
|
-
}
|
|
465
|
-
});
|
|
466
|
-
rememberGulpProcessCacheKey(gulpProcessCacheKeys, file.path);
|
|
467
|
-
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
468
|
-
}, () => resolveGulpTransformTimingDetails("css"));
|
|
490
|
+
const cssHandlerOptions = resolveWxssFileHandlerOptions(file, source, options);
|
|
491
|
+
const handled = await styleHandler(source, cssHandlerOptions);
|
|
492
|
+
const preflightMode = generatedCssPreflightModeByFile.get(file.path);
|
|
493
|
+
const finalized = generatedCss ? finalizeMiniProgramGeneratorCss(handled.css, "weapp", runtimeState.tailwindRuntime.majorVersion, opts.cssPreflight, {
|
|
494
|
+
injectPreflight: preflightMode?.inject ?? cssHandlerOptions.isMainChunk,
|
|
495
|
+
preservePreflight: preflightMode?.preserve ?? cssHandlerOptions.isMainChunk,
|
|
496
|
+
styleOptions: cssHandlerOptions
|
|
497
|
+
}) : handled.css;
|
|
498
|
+
file.contents = Buffer.from(rewriteLocalCssImportRequestsForOutput(finalized, { styleOutputExtension }));
|
|
499
|
+
debug("css adapt: %s", file.path);
|
|
500
|
+
}, () => resolveGulpTransformTimingDetails("css:adapt"));
|
|
469
501
|
const transformJs = (options = {}) => createVinylTransform("js", async (file) => {
|
|
470
502
|
if (!file.contents) return;
|
|
471
503
|
const filename = path.resolve(file.path);
|
|
@@ -535,6 +567,8 @@ function createNativeGulpPlugins(options = {}) {
|
|
|
535
567
|
pruneGulpProcessCache(cache, gulpProcessCacheKeys);
|
|
536
568
|
}, () => resolveGulpTransformTimingDetails("html"));
|
|
537
569
|
return {
|
|
570
|
+
adaptWxss,
|
|
571
|
+
generateWxss,
|
|
538
572
|
transformWxss,
|
|
539
573
|
transformWxml,
|
|
540
574
|
transformJs
|
package/dist/gulp.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_gulp = require("./gulp-
|
|
2
|
+
const require_gulp = require("./gulp-3m1dAiig.js");
|
|
3
3
|
exports.WeappTailwindcss = require_gulp.createPlugins;
|
|
4
4
|
exports.createPlugins = require_gulp.createPlugins;
|
|
5
5
|
exports.weappTailwindcss = require_gulp.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createPlugins } from "./gulp-
|
|
1
|
+
import { t as createPlugins } from "./gulp-DP71z1jG.mjs";
|
|
2
2
|
export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { $ as normalizeTailwindSourceDirectives, A as filterApplyOnlyGeneratedCss, At as resolveTailwindV4CssSourceBase, B as stripUnmatchedTailwindSourceMediaCloseFragments, F as removeTailwindV4GeneratedUserCssArtifacts, G as removeUnsupportedMiniProgramAtRules, H as finalizeMiniProgramCss, I as removeTailwindV4GeneratorAtRules, J as hasTailwindApplyDirective, L as shouldFilterApplyOnlyGeneratedCss, M as isCommentOnlyCss, N as normalizeEmptyTailwindCustomVariants, Nt as filterUnsupportedMiniProgramTailwindV4Candidates, Pt as loadTailwindV4DesignSystem, R as splitUserCssLayerBlocks, Tt as isFileMatchedByTailwindSourceEntries, V as transformGeneratorUserCss, X as hasTailwindRootDirectives, Z as hasTailwindSourceDirectives, a as resolveGeneratorRuntimeBranch, at as VITE_MARKER_RE, ct as hasTailwindGeneratedCssMarkers, d as resolveTailwindV4SourceFromRuntime, dt as splitTailwindV4GeneratedCssBySourceOrder, ft as stripGeneratorPlaceholderMarkers, gt as prependConfigDirective, ht as normalizeConfigDirective, i as normalizeWeappTailwindcssGeneratorOptions, it as GENERATOR_PLACEHOLDER_MARKER_RE, j as hasUserCssLayerBlocks, jt as toPosixPath$1, k as extractGeneratedCssForUserLayerSelectors, kt as resolveSourceScanPath, lt as splitGeneratorPlaceholderCssBySourceOrder, mt as stripTailwindBanners, nt as removeTailwindSourceDirectives, ot as createCssAppend, p as resolveTailwindV4SourceOptionsFromRuntime, pt as stripTailwindBanner, rt as resolveCssEntrySource, s as shouldUseMiniProgramCssBranch, st as hasTailwindGeneratedCss, t as createWeappTailwindcssGenerator, tt as parseImportRequest, u as resolveTailwindV4Source$1, ut as splitTailwindGeneratedCssByBanner, xt as FULL_SOURCE_SCAN_EXTENSION_RE, z as stripTailwindSourceMediaFragments } from "./generator-
|
|
1
|
+
import { $ as normalizeTailwindSourceDirectives, A as filterApplyOnlyGeneratedCss, At as resolveTailwindV4CssSourceBase, B as stripUnmatchedTailwindSourceMediaCloseFragments, F as removeTailwindV4GeneratedUserCssArtifacts, G as removeUnsupportedMiniProgramAtRules, H as finalizeMiniProgramCss, I as removeTailwindV4GeneratorAtRules, J as hasTailwindApplyDirective, L as shouldFilterApplyOnlyGeneratedCss, M as isCommentOnlyCss, N as normalizeEmptyTailwindCustomVariants, Nt as filterUnsupportedMiniProgramTailwindV4Candidates, Pt as loadTailwindV4DesignSystem, R as splitUserCssLayerBlocks, Tt as isFileMatchedByTailwindSourceEntries, V as transformGeneratorUserCss, X as hasTailwindRootDirectives, Z as hasTailwindSourceDirectives, a as resolveGeneratorRuntimeBranch, at as VITE_MARKER_RE, ct as hasTailwindGeneratedCssMarkers, d as resolveTailwindV4SourceFromRuntime, dt as splitTailwindV4GeneratedCssBySourceOrder, ft as stripGeneratorPlaceholderMarkers, gt as prependConfigDirective, ht as normalizeConfigDirective, i as normalizeWeappTailwindcssGeneratorOptions, it as GENERATOR_PLACEHOLDER_MARKER_RE, j as hasUserCssLayerBlocks, jt as toPosixPath$1, k as extractGeneratedCssForUserLayerSelectors, kt as resolveSourceScanPath, lt as splitGeneratorPlaceholderCssBySourceOrder, mt as stripTailwindBanners, nt as removeTailwindSourceDirectives, ot as createCssAppend, p as resolveTailwindV4SourceOptionsFromRuntime, pt as stripTailwindBanner, rt as resolveCssEntrySource, s as shouldUseMiniProgramCssBranch, st as hasTailwindGeneratedCss, t as createWeappTailwindcssGenerator, tt as parseImportRequest, u as resolveTailwindV4Source$1, ut as splitTailwindGeneratedCssByBanner, xt as FULL_SOURCE_SCAN_EXTENSION_RE, z as stripTailwindSourceMediaFragments } from "./generator-CEo920So.mjs";
|
|
2
|
+
import { o as transformCssMacroCss, r as hasCssMacroTailwindV4InternalAtRules, t as hasCssMacroStyleOptions } from "./auto-2dg_uhEJ.mjs";
|
|
2
3
|
import { t as omitUndefined } from "./object-BJSWl-E5.mjs";
|
|
3
|
-
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as includesTailwindV4PreflightDirective } from "./tailwindcss-
|
|
4
|
+
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as includesTailwindV4PreflightDirective } from "./tailwindcss-xs704TRw.mjs";
|
|
4
5
|
import { _ as babelParse, b as md5Hash, g as replaceWxml, i as createAttributeMatcher, n as Parser, v as traverse, y as createDebug } from "./wxml-DdGdeqaH.mjs";
|
|
5
|
-
import { r as resolveStyleOptionsFromContext } from "./context-
|
|
6
|
+
import { r as resolveStyleOptionsFromContext } from "./context-BgGWVAmN.mjs";
|
|
6
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
7
8
|
import path from "node:path";
|
|
8
9
|
import process from "node:process";
|
|
9
10
|
import { extractRawCandidatesWithPositions, extractSourceCandidates, extractValidCandidates, resolveProjectSourceFiles, resolveValidTailwindV4Candidates, splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
10
|
-
import { cleanLocalCssImportWrapperTailwindDirectives, cleanLocalCssImportWrapperTailwindDirectivesRoot, filterExistingCssRules, isPureLocalCssImportWrapper, isPureLocalCssImportWrapperRoot, postcss, restoreLocalCssImports, rewriteLocalCssImportRequestsForOutput, splitLocalCssImports, splitLocalCssImportsRoot, transformWebCssCompat } from "@weapp-tailwindcss/postcss";
|
|
11
|
+
import { cleanLocalCssImportWrapperTailwindDirectives, cleanLocalCssImportWrapperTailwindDirectivesRoot, filterExistingCssRules, isPureLocalCssImportWrapper, isPureLocalCssImportWrapperRoot, normalizeMiniProgramGeneratedCssForPostcss, postcss, removeMatchingLocalCssImports, restoreLocalCssImports, rewriteLocalCssImportRequestsForOutput, splitLocalCssImports, splitLocalCssImportsRoot, transformWebCssCompat } from "@weapp-tailwindcss/postcss";
|
|
11
12
|
import { LRUCache } from "lru-cache";
|
|
12
13
|
import { readFile } from "node:fs/promises";
|
|
13
14
|
import { MappingChars2String, unescape } from "@weapp-core/escape";
|
|
@@ -129,6 +130,39 @@ function annotateCssSourceTrace(css, options) {
|
|
|
129
130
|
}
|
|
130
131
|
}
|
|
131
132
|
//#endregion
|
|
133
|
+
//#region src/bundlers/shared/generated-css-marker.ts
|
|
134
|
+
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
|
|
135
|
+
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
136
|
+
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (gulp|vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
137
|
+
const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
|
|
138
|
+
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
139
|
+
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
140
|
+
}
|
|
141
|
+
function hasBundlerGeneratedCssMarker(source) {
|
|
142
|
+
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
143
|
+
}
|
|
144
|
+
function stripBundlerGeneratedCssMarkers(source) {
|
|
145
|
+
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
|
|
146
|
+
}
|
|
147
|
+
function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
148
|
+
const blocks = [];
|
|
149
|
+
BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex = 0;
|
|
150
|
+
let match = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
151
|
+
while (match !== null) {
|
|
152
|
+
const cssStart = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.lastIndex;
|
|
153
|
+
const nextMatch = BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE.exec(source);
|
|
154
|
+
const cssEnd = nextMatch?.index ?? source.length;
|
|
155
|
+
const file = match[2] ? decodeURIComponent(match[2]) : void 0;
|
|
156
|
+
blocks.push({
|
|
157
|
+
bundler: match[1],
|
|
158
|
+
file,
|
|
159
|
+
css: source.slice(cssStart, cssEnd)
|
|
160
|
+
});
|
|
161
|
+
match = nextMatch;
|
|
162
|
+
}
|
|
163
|
+
return blocks;
|
|
164
|
+
}
|
|
165
|
+
//#endregion
|
|
132
166
|
//#region src/bundlers/shared/generator-css/class-selectors.ts
|
|
133
167
|
function normalizeCssClassSelector(value) {
|
|
134
168
|
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
@@ -153,11 +187,47 @@ function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
|
153
187
|
return matched;
|
|
154
188
|
}
|
|
155
189
|
//#endregion
|
|
190
|
+
//#region src/bundlers/shared/style-requests.ts
|
|
191
|
+
const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
|
|
192
|
+
const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
|
|
193
|
+
const VUE_STYLE_QUERY_RE = /(?:^|&)type=style(?:&|$)/;
|
|
194
|
+
const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
|
|
195
|
+
function stripHash(request) {
|
|
196
|
+
const hashIndex = request.indexOf("#");
|
|
197
|
+
return hashIndex === -1 ? request : request.slice(0, hashIndex);
|
|
198
|
+
}
|
|
199
|
+
function stripRequestQuery(request) {
|
|
200
|
+
const normalized = stripHash(request);
|
|
201
|
+
const queryIndex = normalized.indexOf("?");
|
|
202
|
+
return queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
203
|
+
}
|
|
204
|
+
function isSourceStyleRequest(request) {
|
|
205
|
+
if (typeof request !== "string" || request.length === 0) return false;
|
|
206
|
+
const normalized = stripHash(request);
|
|
207
|
+
const queryIndex = normalized.indexOf("?");
|
|
208
|
+
const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
|
|
209
|
+
if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
|
|
210
|
+
if (queryIndex === -1) return false;
|
|
211
|
+
const query = normalized.slice(queryIndex + 1);
|
|
212
|
+
return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
|
|
213
|
+
}
|
|
214
|
+
function isVueScopedStyleRequest(request) {
|
|
215
|
+
if (typeof request !== "string" || request.length === 0) return false;
|
|
216
|
+
const normalized = stripHash(request);
|
|
217
|
+
const queryIndex = normalized.indexOf("?");
|
|
218
|
+
if (queryIndex === -1) return false;
|
|
219
|
+
const query = normalized.slice(queryIndex + 1);
|
|
220
|
+
return VUE_STYLE_QUERY_RE.test(query) && /(?:^|&)scoped(?:=[^&]*)?(?:&|$)/.test(query);
|
|
221
|
+
}
|
|
222
|
+
//#endregion
|
|
156
223
|
//#region src/bundlers/shared/generator-css/source-resolver/postcss-source.ts
|
|
157
224
|
function resolvePostcssFromOption(cssHandlerOptions) {
|
|
158
225
|
const from = cssHandlerOptions.postcssOptions?.options?.from;
|
|
159
226
|
return typeof from === "string" && from.length > 0 ? from : void 0;
|
|
160
227
|
}
|
|
228
|
+
function resolvePostcssRequestOption(cssHandlerOptions) {
|
|
229
|
+
return resolveCssHandlerSourceOptions(cssHandlerOptions)?.requestFile ?? resolvePostcssFromOption(cssHandlerOptions);
|
|
230
|
+
}
|
|
161
231
|
function resolvePostcssSourceFile(cssHandlerOptions) {
|
|
162
232
|
const from = resolvePostcssFromOption(cssHandlerOptions);
|
|
163
233
|
if (!from || !path.isAbsolute(from)) return;
|
|
@@ -172,13 +242,6 @@ function resolveCssSourceBase(file, cssHandlerOptions) {
|
|
|
172
242
|
}
|
|
173
243
|
//#endregion
|
|
174
244
|
//#region src/bundlers/shared/generator-css/generation-helpers.ts
|
|
175
|
-
function isVueScopedStyleSource(from) {
|
|
176
|
-
if (typeof from !== "string" || from.length === 0) return false;
|
|
177
|
-
const queryIndex = from.indexOf("?");
|
|
178
|
-
if (queryIndex === -1) return false;
|
|
179
|
-
const query = from.slice(queryIndex + 1);
|
|
180
|
-
return /(?:^|&)type=style(?:&|$)/.test(query) && /(?:^|&)scoped(?:=[^&]*)?(?:&|$)/.test(query);
|
|
181
|
-
}
|
|
182
245
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
183
246
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
184
247
|
}
|
|
@@ -187,7 +250,7 @@ function isMiniProgramGeneratorTarget(target) {
|
|
|
187
250
|
}
|
|
188
251
|
function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPreflight, options = {}) {
|
|
189
252
|
if (!isMiniProgramGeneratorTarget(target)) return css;
|
|
190
|
-
if (
|
|
253
|
+
if (options.styleOptions && isVueScopedStyleRequest(resolvePostcssRequestOption(options.styleOptions))) return finalizeMiniProgramCss(css, {
|
|
191
254
|
cssPreflight: false,
|
|
192
255
|
cssSelectorReplacement: options.styleOptions?.cssOptions?.cssSelectorReplacement ?? options.styleOptions?.cssSelectorReplacement,
|
|
193
256
|
isTailwindcssV4: true,
|
|
@@ -204,7 +267,7 @@ function finalizeMiniProgramGeneratorCss(css, target, _majorVersion, cssPrefligh
|
|
|
204
267
|
});
|
|
205
268
|
}
|
|
206
269
|
function resolveMiniProgramPreflightModeForGeneratorCss(opts, options) {
|
|
207
|
-
if (
|
|
270
|
+
if (isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions))) return {
|
|
208
271
|
inject: false,
|
|
209
272
|
preserve: false
|
|
210
273
|
};
|
|
@@ -274,7 +337,7 @@ function isEmptyCssSourceOrderParts(parts) {
|
|
|
274
337
|
}
|
|
275
338
|
function resolveGeneratorStyleOptions(opts, cssHandlerOptions, generatorStyleOptions) {
|
|
276
339
|
const resolvedStyleOptions = resolveStyleOptionsFromContext(opts);
|
|
277
|
-
const scopedVueStyleSource =
|
|
340
|
+
const scopedVueStyleSource = isVueScopedStyleRequest(resolvePostcssRequestOption(cssHandlerOptions));
|
|
278
341
|
const preflightStyleOptions = {
|
|
279
342
|
cssPreflight: scopedVueStyleSource ? false : resolvedStyleOptions.cssPreflight,
|
|
280
343
|
cssPreflightRange: scopedVueStyleSource ? void 0 : resolvedStyleOptions.cssPreflightRange
|
|
@@ -2315,10 +2378,14 @@ async function generateCssByGenerator(options) {
|
|
|
2315
2378
|
const configuredContainerCompat = hasConfiguredContainerCompatSources(generatorSources);
|
|
2316
2379
|
const sourceConcurrency = resolveGeneratorSourceConcurrency();
|
|
2317
2380
|
const generated = mergeGeneratorResults((await runWithConcurrency(generatorSources.map((source) => async () => {
|
|
2381
|
+
const sourceCss = options.deferCssAdaptation ? removeMatchingLocalCssImports(source.css, localImports) : source.css;
|
|
2318
2382
|
const generator = createWeappTailwindcssGenerator(options.disableSourceScan === true ? {
|
|
2319
2383
|
...source,
|
|
2320
|
-
css: removeTailwindSourceDirectives(
|
|
2321
|
-
} : source
|
|
2384
|
+
css: removeTailwindSourceDirectives(sourceCss, { importFallback: generatorOptions.importFallback })
|
|
2385
|
+
} : sourceCss === source.css ? source : {
|
|
2386
|
+
...source,
|
|
2387
|
+
css: sourceCss
|
|
2388
|
+
});
|
|
2322
2389
|
const sourceEntries = getSourceCandidatesForEntries ? await resolveGeneratorSourceEntries(source, runtimeState) : void 0;
|
|
2323
2390
|
const sourceScopedRuntime = sourceEntries && sourceEntries.length > 0 ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
2324
2391
|
const scopedRuntime = resolveScopedRuntimeCandidates(options.sourceCandidates, sourceScopedRuntime);
|
|
@@ -2351,6 +2418,91 @@ async function generateCssByGenerator(options) {
|
|
|
2351
2418
|
}), sourceConcurrency)).filter((item) => Boolean(item)));
|
|
2352
2419
|
if (!generated) return;
|
|
2353
2420
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2421
|
+
const hasMatchedCssSourceFile = generatorSources.some((source) => source.__weappTailwindcssMeta?.matchedCssSourceFile);
|
|
2422
|
+
const hasExplicitCssSource = generatorSources.some((source) => {
|
|
2423
|
+
const metadata = source.__weappTailwindcssMeta;
|
|
2424
|
+
return metadata?.candidateMatchedCssSource !== true && (metadata?.cssEntryIndex !== void 0 || metadata?.cssSourceIndex !== void 0);
|
|
2425
|
+
});
|
|
2426
|
+
const hasPreflightCssSource = generatorSources.some((source) => {
|
|
2427
|
+
const metadata = source.__weappTailwindcssMeta;
|
|
2428
|
+
const appEntryMatchedByCandidates = metadata?.candidateMatchedCssSource === true && metadata.cssEntryIndex === 0 && metadata.cssSourceIndex === void 0;
|
|
2429
|
+
return metadata?.includesPreflight === true && !appEntryMatchedByCandidates;
|
|
2430
|
+
});
|
|
2431
|
+
const hasPreflightRawSource = includesTailwindV4PreflightDirective(generatorRawSource);
|
|
2432
|
+
const hasOnlyPrimaryCssSource = generatorSources.length > 0 && generatorSources.every((source) => {
|
|
2433
|
+
const metadata = source.__weappTailwindcssMeta;
|
|
2434
|
+
return metadata?.candidateMatchedCssSource !== true && metadata?.primaryCssSource === true;
|
|
2435
|
+
});
|
|
2436
|
+
const shouldFilterApplyOnlyCss = shouldFilterApplyOnlyGeneratedCss(majorVersion, generated.target, generatorRawSource, {
|
|
2437
|
+
hasGeneratedCss,
|
|
2438
|
+
hasGeneratedMarkers
|
|
2439
|
+
});
|
|
2440
|
+
const filterGeneratedApplyOnlyCss = (css) => {
|
|
2441
|
+
if (!shouldFilterApplyOnlyCss) return css;
|
|
2442
|
+
return filterApplyOnlyGeneratedCss(css, generatorRawSource, { preserveVariables: generated.target !== "web" });
|
|
2443
|
+
};
|
|
2444
|
+
const preflightMode = resolveMiniProgramPreflightModeForGeneratorCss(opts, {
|
|
2445
|
+
cssHandlerOptions,
|
|
2446
|
+
isolateCurrentCssCandidates,
|
|
2447
|
+
localImports,
|
|
2448
|
+
explicitCssSource: hasExplicitCssSource,
|
|
2449
|
+
primaryCssSource: hasOnlyPrimaryCssSource || hasPreflightCssSource || hasPreflightRawSource
|
|
2450
|
+
});
|
|
2451
|
+
if (options.deferCssAdaptation) {
|
|
2452
|
+
const normalizeDeferredGeneratedCss = async (css) => {
|
|
2453
|
+
const rawCss = stripTailwindBanner(css);
|
|
2454
|
+
const generationCss = generated.target === "weapp" && (hasCssMacroStyleOptions(generatorStyleOptions) || hasCssMacroTailwindV4InternalAtRules(rawCss)) ? await transformCssMacroCss(rawCss, generatorStyleOptions) : rawCss;
|
|
2455
|
+
const normalizedCss = generated.target === "weapp" ? await normalizeMiniProgramGeneratedCssForPostcss(generationCss, {
|
|
2456
|
+
preservePreflight: true,
|
|
2457
|
+
preserveRawClassRules: true
|
|
2458
|
+
}) : generationCss;
|
|
2459
|
+
return filterGeneratedApplyOnlyCss(normalizedCss);
|
|
2460
|
+
};
|
|
2461
|
+
const restoreDeferredUserCss = async (css) => {
|
|
2462
|
+
if (generated.target !== "weapp" || generatedUserCssRawSource.trim().length === 0) return css;
|
|
2463
|
+
const userCssOptions = {
|
|
2464
|
+
generatorTarget: generated.target,
|
|
2465
|
+
generatorStyleOptions,
|
|
2466
|
+
cssUserHandlerOptions,
|
|
2467
|
+
styleHandler,
|
|
2468
|
+
importFallback: generatorOptions.importFallback,
|
|
2469
|
+
processed: userRawSourceProcessed
|
|
2470
|
+
};
|
|
2471
|
+
const transformDeferredUserCss = async (source) => {
|
|
2472
|
+
const parts = splitUserCssLayerBlocks(source);
|
|
2473
|
+
const layerCss = await transformGeneratorUserCss(parts.layer, userCssOptions);
|
|
2474
|
+
const restCss = await transformGeneratorUserCss(parts.rest, userCssOptions);
|
|
2475
|
+
return createCssSourceOrderAppend$1(wrapUserLayerComponentsCss(layerCss), restCss);
|
|
2476
|
+
};
|
|
2477
|
+
const orderedUserCss = splitGeneratorPlaceholderCssBySourceOrder(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? splitTailwindV4GeneratedCssBySourceOrder(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
2478
|
+
if (orderedUserCss) {
|
|
2479
|
+
const beforeUserCss = await transformDeferredUserCss(orderedUserCss.before);
|
|
2480
|
+
const afterUserCss = await transformDeferredUserCss(orderedUserCss.after);
|
|
2481
|
+
const cssWithBeforeUserCss = createCssSourceOrderAppend$1(filterExistingCssRules(css, beforeUserCss), css);
|
|
2482
|
+
return reorderMarkedUserLayerComponentsCss(createCssSourceOrderAppend$1(cssWithBeforeUserCss, filterExistingCssRules(cssWithBeforeUserCss, afterUserCss)));
|
|
2483
|
+
}
|
|
2484
|
+
return reorderMarkedUserLayerComponentsCss(createCssSourceOrderAppend$1(css, filterExistingCssRules(css, await transformDeferredUserCss(generatedUserCssRawSource))));
|
|
2485
|
+
};
|
|
2486
|
+
const canAppendIncrementalCss = generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource);
|
|
2487
|
+
const incrementalRawCss = generated.incrementalRawCss ?? generated.incrementalCss;
|
|
2488
|
+
const shouldAppendIncrementalCss = canAppendIncrementalCss && typeof options.previousCss === "string" && typeof incrementalRawCss === "string";
|
|
2489
|
+
const normalizedCss = shouldAppendIncrementalCss ? incrementalRawCss.trim().length > 0 ? createCssAppend(options.previousCss, await normalizeDeferredGeneratedCss(incrementalRawCss)) : options.previousCss : await normalizeDeferredGeneratedCss(generated.rawCss ?? generated.css);
|
|
2490
|
+
const css = restoreLocalCssImports(shouldAppendIncrementalCss ? normalizedCss : await restoreDeferredUserCss(normalizedCss), localImports, { outputFile: file });
|
|
2491
|
+
return {
|
|
2492
|
+
css,
|
|
2493
|
+
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, css, opts.escapeMap, options.previousClassSet),
|
|
2494
|
+
target: generated.target,
|
|
2495
|
+
source: "generator",
|
|
2496
|
+
dependencies: generated.dependencies,
|
|
2497
|
+
incremental: shouldAppendIncrementalCss,
|
|
2498
|
+
metadata: {
|
|
2499
|
+
file,
|
|
2500
|
+
majorVersion,
|
|
2501
|
+
preflightMode,
|
|
2502
|
+
rawCss: generated.rawCss
|
|
2503
|
+
}
|
|
2504
|
+
};
|
|
2505
|
+
}
|
|
2354
2506
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2355
2507
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
2356
2508
|
const css = incrementalCss.trim().length > 0 ? finalizeIncrementalGeneratorCss(options.previousCss, incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
@@ -2372,33 +2524,7 @@ async function generateCssByGenerator(options) {
|
|
|
2372
2524
|
}
|
|
2373
2525
|
};
|
|
2374
2526
|
}
|
|
2375
|
-
const
|
|
2376
|
-
hasGeneratedCss,
|
|
2377
|
-
hasGeneratedMarkers
|
|
2378
|
-
});
|
|
2379
|
-
const generatedCssSource = generated.target === "web" ? generated.css : stripTailwindBanner(generated.css);
|
|
2380
|
-
const generatedCss = shouldFilterApplyOnlyCss ? filterApplyOnlyGeneratedCss(generatedCssSource, generatorRawSource, { preserveVariables: generated.target !== "web" }) : generatedCssSource;
|
|
2381
|
-
const hasMatchedCssSourceFile = generatorSources.some((source) => source.__weappTailwindcssMeta?.matchedCssSourceFile);
|
|
2382
|
-
const hasExplicitCssSource = generatorSources.some((source) => {
|
|
2383
|
-
const metadata = source.__weappTailwindcssMeta;
|
|
2384
|
-
return metadata?.candidateMatchedCssSource !== true && (metadata?.cssEntryIndex !== void 0 || metadata?.cssSourceIndex !== void 0);
|
|
2385
|
-
});
|
|
2386
|
-
const hasPreflightCssSource = generatorSources.some((source) => {
|
|
2387
|
-
const metadata = source.__weappTailwindcssMeta;
|
|
2388
|
-
const appEntryMatchedByCandidates = metadata?.candidateMatchedCssSource === true && metadata.cssEntryIndex === 0 && metadata.cssSourceIndex === void 0;
|
|
2389
|
-
return metadata?.includesPreflight === true && !appEntryMatchedByCandidates;
|
|
2390
|
-
});
|
|
2391
|
-
const hasPreflightRawSource = includesTailwindV4PreflightDirective(generatorRawSource);
|
|
2392
|
-
const preflightMode = resolveMiniProgramPreflightModeForGeneratorCss(opts, {
|
|
2393
|
-
cssHandlerOptions,
|
|
2394
|
-
isolateCurrentCssCandidates,
|
|
2395
|
-
localImports,
|
|
2396
|
-
explicitCssSource: hasExplicitCssSource,
|
|
2397
|
-
primaryCssSource: generatorSources.length > 0 && generatorSources.every((source) => {
|
|
2398
|
-
const metadata = source.__weappTailwindcssMeta;
|
|
2399
|
-
return metadata?.candidateMatchedCssSource !== true && metadata?.primaryCssSource === true;
|
|
2400
|
-
}) || hasPreflightCssSource || hasPreflightRawSource
|
|
2401
|
-
});
|
|
2527
|
+
const generatedCss = filterGeneratedApplyOnlyCss(generated.target === "web" ? generated.css : stripTailwindBanner(generated.css));
|
|
2402
2528
|
const orderedExtraCss = splitGeneratorPlaceholderCssBySourceOrder(userCssOrderSource, generated.rawCss) ?? (hasMatchedCssSourceFile ? splitTailwindV4GeneratedCssBySourceOrder(userCssOrderSource, generated.rawCss) : splitRawSourceByGeneratedCssOrder(userCssOrderSource, generated.rawCss));
|
|
2403
2529
|
const shouldAppendMatchedCssSourceCompat = !hasMatchedCssSourceFile || orderedExtraCss !== void 0;
|
|
2404
2530
|
if (orderedExtraCss) {
|
|
@@ -3542,4 +3668,4 @@ function createHmrTimingRecorder(bundler) {
|
|
|
3542
3668
|
};
|
|
3543
3669
|
}
|
|
3544
3670
|
//#endregion
|
|
3545
|
-
export {
|
|
3671
|
+
export { collectRawSourceClassSelectors as A, scoreTailwindV4CssSourceFileMatch as C, hasMiniProgramTailwindV4PreflightReset as D, finalizeMiniProgramGeneratorCss as E, annotateCssSourceTrace as F, createCssSourceTraceCacheSignature as I, createCssTokenSourceMap as L, hasBundlerGeneratedCssMarker as M, parseBundlerGeneratedCssMarkerBlocks as N, isSourceStyleRequest as O, stripBundlerGeneratedCssMarkers as P, isCssSourceTraceEnabled as R, splitLocalCssImports as S, createCssSourceOrderAppend$1 as T, mergeMarkedUserLayerComponentsCss as _, isSourceCandidateRequest as a, isPureLocalCssImportWrapper as b, createBundleRuntimeClassSetManager as c, generateCssByGenerator as d, validateCandidatesByGenerator as f, extractMarkedUserLayerComponentsCss as g, runWithConcurrency as h, createSourceCandidateStore as i, createBundlerGeneratedCssMarker as j, stripRequestQuery as k, collectStrictEscapedRuntimeCandidates as l, resolveTaskConcurrency as m, emitHmrTiming as n, resolveSourceCandidateScanFiles as o, pushConcurrentTaskFactories as p, createSourceCandidateCollector as r, extractCandidatesFromSource as s, createHmrTimingRecorder as t, createEscapeFragments as u, normalizeMiniProgramGeneratorCssSource as v, removeGeneratedSelectorCompatCss as w, rewriteLocalCssImportRequestsForOutput as x, normalizeMiniProgramImportShell as y, processCachedTask as z };
|