weapp-tailwindcss 5.1.0 → 5.1.2
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/README.en.md +2 -0
- package/README.md +2 -0
- package/dist/bundlers/shared/generator-css/class-selectors.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +6 -14
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
- package/dist/bundlers/vite/css-memory.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +39 -0
- package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +26 -0
- package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +25 -0
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +15 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +1 -2
- package/dist/bundlers/vite/plugin-cache.d.ts +15 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +2 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +3 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +34 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +37 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +199 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -0
- package/dist/cli.js +15 -8
- package/dist/cli.mjs +15 -8
- package/dist/context/style-options.d.ts +1 -0
- package/dist/{context-Mbzkek1q.mjs → context-C-r8ki7x.mjs} +15 -10
- package/dist/{context-BHxLe743.js → context-CH4HFZP2.js} +20 -9
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/index.d.ts +3 -7
- package/dist/{defaults-ZElj1zKc.mjs → defaults-BhE26nSw.mjs} +7 -3
- package/dist/{defaults-CVcKbXBG.js → defaults-CmFBmxsr.js} +7 -3
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/generator/options.d.ts +3 -1
- package/dist/generator/types.d.ts +1 -1
- package/dist/{generator-9rUz4Hcb.js → generator-B6pUjNdD.js} +3 -1
- package/dist/{generator-Dc4qaPmT.mjs → generator-BsPIaLtV.mjs} +3 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-B_sdP6dx.js → gulp-BBCeA7ky.js} +11 -9
- package/dist/{gulp-uM36oIJs.mjs → gulp-CTdcASq8.mjs} +11 -9
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BXMLsF4b.mjs → hmr-timing-BRx-KnBh.mjs} +128 -86
- package/dist/{hmr-timing-CogqkFaF.js → hmr-timing-Da1eI8S0.js} +138 -84
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{source-candidate-scan-signature-2ybpptAK.js → source-candidate-scan-signature-BO6JSskQ.js} +3 -3
- package/dist/{source-candidate-scan-signature-Cvb5z1ha.mjs → source-candidate-scan-signature-Dugfplms.mjs} +3 -3
- package/dist/tailwindcss/runtime-types.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +5 -14
- package/dist/tailwindcss/v4-engine/types.d.ts +10 -2
- package/dist/{tailwindcss-wyUHrfil.mjs → tailwindcss-B5mRo0-M.mjs} +12 -7
- package/dist/{tailwindcss-DHIYcqXT.js → tailwindcss-dbrbY4cd.js} +11 -6
- package/dist/{transform-CQVOgmzM.js → transform-BLleu_bA.js} +1 -1
- package/dist/{transform-tExdt40m.mjs → transform-DeqFRp1D.mjs} +1 -1
- package/dist/types/user-defined-options/matcher.d.ts +7 -0
- package/dist/{v4-engine-CF9zt4Cw.mjs → v4-engine-C3qSwQ-e.mjs} +7 -27
- package/dist/{v4-engine-D4ubP7N5.js → v4-engine-ON_oSLfO.js} +5 -31
- package/dist/{vite-CPO83EhA.mjs → vite-CXmUiI9f.mjs} +734 -393
- package/dist/{vite-CP0ylSxZ.js → vite-Da4uEG_u.js} +734 -392
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +130 -85
- package/dist/{webpack-BzqhJ8yK.mjs → webpack-CrFZmdo7.mjs} +923 -671
- package/dist/{webpack-Bsek8VhR.js → webpack-Cwqnznng.js} +923 -671
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_v4_engine = require("./v4-engine-
|
|
1
|
+
const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
|
|
2
2
|
const require_utils = require("./utils-BCa37Wqj.js");
|
|
3
3
|
//#region src/runtime-branch/create-branch.ts
|
|
4
4
|
function createRuntimeBranch(base, platformFamily, options) {
|
|
@@ -96,6 +96,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
|
96
96
|
if (options == null) return {
|
|
97
97
|
target,
|
|
98
98
|
branch,
|
|
99
|
+
webCompat: void 0,
|
|
99
100
|
importFallback: false,
|
|
100
101
|
bareArbitraryValues: void 0
|
|
101
102
|
};
|
|
@@ -104,6 +105,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
|
104
105
|
branch,
|
|
105
106
|
config: options.config,
|
|
106
107
|
styleOptions: options.styleOptions,
|
|
108
|
+
webCompat: options.webCompat,
|
|
107
109
|
importFallback: options.importFallback ?? false,
|
|
108
110
|
bareArbitraryValues: options.bareArbitraryValues
|
|
109
111
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { W as createTailwindV4Engine, ct as inferGeneratorTargetFromEnv, n as resolveTailwindV4SourceFromRuntime } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
2
|
import { o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
|
|
3
3
|
//#region src/runtime-branch/create-branch.ts
|
|
4
4
|
function createRuntimeBranch(base, platformFamily, options) {
|
|
@@ -96,6 +96,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
|
96
96
|
if (options == null) return {
|
|
97
97
|
target,
|
|
98
98
|
branch,
|
|
99
|
+
webCompat: void 0,
|
|
99
100
|
importFallback: false,
|
|
100
101
|
bareArbitraryValues: void 0
|
|
101
102
|
};
|
|
@@ -104,6 +105,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
|
104
105
|
branch,
|
|
105
106
|
config: options.config,
|
|
106
107
|
styleOptions: options.styleOptions,
|
|
108
|
+
webCompat: options.webCompat,
|
|
107
109
|
importFallback: options.importFallback ?? false,
|
|
108
110
|
bareArbitraryValues: options.bareArbitraryValues
|
|
109
111
|
};
|
package/dist/generator.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_v4_engine = require("./v4-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
|
|
3
|
+
const require_generator = require("./generator-B6pUjNdD.js");
|
|
4
4
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
5
5
|
exports.createWeappTailwindcssGeneratorFromRuntime = require_generator.createWeappTailwindcssGeneratorFromRuntime;
|
|
6
6
|
exports.normalizeWeappTailwindcssGeneratorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { K as transformTailwindV4CssByTarget, i as resolveTailwindV4SourceOptionsFromRuntime, n as resolveTailwindV4SourceFromRuntime, q as transformTailwindV4CssToWeapp, r as resolveTailwindV4SourceFromRuntimeOptions, t as resolveTailwindV4Source } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromRuntime, r as resolveTailwindSourceFromRuntime, t as createWeappTailwindcssGenerator } from "./generator-BsPIaLtV.mjs";
|
|
3
3
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromRuntime, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromRuntime, resolveTailwindV4Source, resolveTailwindV4SourceFromRuntime, resolveTailwindV4SourceFromRuntimeOptions, resolveTailwindV4SourceOptionsFromRuntime, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const require_v4_engine = require("./v4-engine-
|
|
3
|
-
const require_context = require("./context-
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
2
|
+
const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
|
|
3
|
+
const require_context = require("./context-CH4HFZP2.js");
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
|
|
5
|
+
const require_hmr_timing = require("./hmr-timing-Da1eI8S0.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
node_fs = require_chunk.__toESM(node_fs);
|
|
8
8
|
let node_path = require("node:path");
|
|
@@ -312,7 +312,8 @@ function createPlugins(options = {}) {
|
|
|
312
312
|
if (hasInitialTailwindCssRoots || (runtimeState.tailwindRuntime.majorVersion ?? 0) < 4 || !file.path || !require_v4_engine.hasTailwindRootDirectives(rawSource)) return false;
|
|
313
313
|
const sourceFile = node_path.default.resolve(file.path);
|
|
314
314
|
const sourceCss = require_v4_engine.normalizeTailwindSourceForGenerator(require_v4_engine.normalizeTailwindConfigDirectives(rawSource, node_path.default.dirname(sourceFile)), { importFallback: true });
|
|
315
|
-
const
|
|
315
|
+
const config = runtimeState.tailwindRuntime.options?.tailwindcss?.config;
|
|
316
|
+
const generatorSourceCss = require_v4_engine.prependConfigDirective(require_hmr_timing.splitLocalCssImports(sourceCss)?.source ?? sourceCss, config);
|
|
316
317
|
if (!require_v4_engine.upsertTailwindV4CssSource(opts, {
|
|
317
318
|
file: sourceFile,
|
|
318
319
|
base: node_path.default.dirname(sourceFile),
|
|
@@ -330,17 +331,18 @@ function createPlugins(options = {}) {
|
|
|
330
331
|
return cachedDefaultModuleGraphOptions;
|
|
331
332
|
}
|
|
332
333
|
function resolveWxssHandlerOptions(options) {
|
|
333
|
-
const
|
|
334
|
+
const styleHandlerMajorVersion = require_context.normalizeStyleHandlerMajorVersion(runtimeState.tailwindRuntime.majorVersion);
|
|
335
|
+
const majorVersion = styleHandlerMajorVersion ?? "unknown";
|
|
334
336
|
if (!options || Object.keys(options).length === 0) {
|
|
335
337
|
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
336
338
|
if (!cached) {
|
|
337
|
-
cached =
|
|
339
|
+
cached = styleHandlerMajorVersion === void 0 ? {} : { majorVersion: styleHandlerMajorVersion };
|
|
338
340
|
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
339
341
|
}
|
|
340
342
|
return cached;
|
|
341
343
|
}
|
|
342
|
-
return
|
|
343
|
-
majorVersion:
|
|
344
|
+
return styleHandlerMajorVersion === void 0 ? { ...options } : {
|
|
345
|
+
majorVersion: styleHandlerMajorVersion,
|
|
344
346
|
...options
|
|
345
347
|
};
|
|
346
348
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { C as hasTailwindRootDirectives,
|
|
2
|
-
import {
|
|
3
|
-
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-
|
|
4
|
-
import { F as
|
|
1
|
+
import { C as hasTailwindRootDirectives, D as normalizeTailwindSourceForGenerator, G as getTailwindV4IncrementalGenerateCacheStats, T as normalizeTailwindConfigDirectives, U as prependConfigDirective, o as hasConfiguredTailwindV4CssRoots, s as upsertTailwindV4CssSource } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
|
+
import { S as createDebug, b as ensureRuntimeClassSet, l as shouldSkipJsTransform, n as normalizeStyleHandlerMajorVersion, t as getCompilerContext, y as createTailwindRuntimeReadyPromise } from "./context-C-r8ki7x.mjs";
|
|
3
|
+
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-B5mRo0-M.mjs";
|
|
4
|
+
import { F as createCssTokenSourceMap, L as processCachedTask, N as annotateCssSourceTrace, P as createCssSourceTraceCacheSignature, n as emitHmrTiming, r as createSourceCandidateCollector, s as createBundleRuntimeClassSetManager, u as generateCssByGenerator, v as rewriteLocalCssImportRequestsForOutput, y as splitLocalCssImports } from "./hmr-timing-BRx-KnBh.mjs";
|
|
5
5
|
import fs from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
@@ -307,7 +307,8 @@ function createPlugins(options = {}) {
|
|
|
307
307
|
if (hasInitialTailwindCssRoots || (runtimeState.tailwindRuntime.majorVersion ?? 0) < 4 || !file.path || !hasTailwindRootDirectives(rawSource)) return false;
|
|
308
308
|
const sourceFile = path.resolve(file.path);
|
|
309
309
|
const sourceCss = normalizeTailwindSourceForGenerator(normalizeTailwindConfigDirectives(rawSource, path.dirname(sourceFile)), { importFallback: true });
|
|
310
|
-
const
|
|
310
|
+
const config = runtimeState.tailwindRuntime.options?.tailwindcss?.config;
|
|
311
|
+
const generatorSourceCss = prependConfigDirective(splitLocalCssImports(sourceCss)?.source ?? sourceCss, config);
|
|
311
312
|
if (!upsertTailwindV4CssSource(opts, {
|
|
312
313
|
file: sourceFile,
|
|
313
314
|
base: path.dirname(sourceFile),
|
|
@@ -325,17 +326,18 @@ function createPlugins(options = {}) {
|
|
|
325
326
|
return cachedDefaultModuleGraphOptions;
|
|
326
327
|
}
|
|
327
328
|
function resolveWxssHandlerOptions(options) {
|
|
328
|
-
const
|
|
329
|
+
const styleHandlerMajorVersion = normalizeStyleHandlerMajorVersion(runtimeState.tailwindRuntime.majorVersion);
|
|
330
|
+
const majorVersion = styleHandlerMajorVersion ?? "unknown";
|
|
329
331
|
if (!options || Object.keys(options).length === 0) {
|
|
330
332
|
let cached = defaultStyleHandlerOptionsCache.get(majorVersion);
|
|
331
333
|
if (!cached) {
|
|
332
|
-
cached =
|
|
334
|
+
cached = styleHandlerMajorVersion === void 0 ? {} : { majorVersion: styleHandlerMajorVersion };
|
|
333
335
|
defaultStyleHandlerOptionsCache.set(majorVersion, cached);
|
|
334
336
|
}
|
|
335
337
|
return cached;
|
|
336
338
|
}
|
|
337
|
-
return
|
|
338
|
-
majorVersion:
|
|
339
|
+
return styleHandlerMajorVersion === void 0 ? { ...options } : {
|
|
340
|
+
majorVersion: styleHandlerMajorVersion,
|
|
339
341
|
...options
|
|
340
342
|
};
|
|
341
343
|
}
|
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-BBCeA7ky.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-CTdcASq8.mjs";
|
|
2
2
|
export { createPlugins as WeappTailwindcss, createPlugins, createPlugins as weappTailwindcss };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as resolveGeneratorRuntimeBranch, i as normalizeWeappTailwindcssGeneratorOptions, s as shouldUseMiniProgramCssBranch, t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import {
|
|
4
|
-
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled } from "./tailwindcss-
|
|
1
|
+
import { A as resolveCssEntrySource, B as stripTailwindBanner, C as hasTailwindRootDirectives, E as normalizeTailwindSourceDirectives, F as hasTailwindGeneratedCssMarkers, H as normalizeConfigDirective, I as splitGeneratorPlaceholderCssBySourceOrder, J as FULL_SOURCE_SCAN_EXTENSION_RE, L as splitTailwindGeneratedCssByBanner, M as VITE_MARKER_RE, N as createCssAppend, O as parseImportRequest, P as hasTailwindGeneratedCss, Q as isFileMatchedByTailwindSourceEntries, R as splitTailwindV4GeneratedCssBySourceOrder, U as prependConfigDirective, V as stripTailwindBanners, i as resolveTailwindV4SourceOptionsFromRuntime, it as toPosixPath$1, j as GENERATOR_PLACEHOLDER_MARKER_RE, k as removeTailwindSourceDirectives, lt as loadTailwindV4DesignSystem, n as resolveTailwindV4SourceFromRuntime, nt as resolveSourceScanPath, ot as filterUnsupportedMiniProgramTailwindV4Candidates, rt as resolveTailwindV4CssSourceBase, st as omitUndefined, t as resolveTailwindV4Source$1, w as hasTailwindSourceDirectives, x as hasTailwindApplyDirective, z as stripGeneratorPlaceholderMarkers } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
|
+
import { a as resolveGeneratorRuntimeBranch, i as normalizeWeappTailwindcssGeneratorOptions, s as shouldUseMiniProgramCssBranch, t as createWeappTailwindcssGenerator } from "./generator-BsPIaLtV.mjs";
|
|
3
|
+
import { C as md5Hash, S as createDebug, g as traverse, h as babelParse, m as replaceWxml, r as resolveStyleOptionsFromContext } from "./context-C-r8ki7x.mjs";
|
|
4
|
+
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled } from "./tailwindcss-B5mRo0-M.mjs";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { extractRawCandidatesWithPositions, extractSourceCandidates, extractValidCandidates, resolveProjectSourceFiles, resolveValidTailwindV4Candidates, splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
9
|
-
import { filterExistingCssRules, finalizeMiniProgramCss, hasMiniProgramCssSpecificityPlaceholders, postcss, pruneMiniProgramGeneratedCss, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, stripMiniProgramCssSpecificityPlaceholders } from "@weapp-tailwindcss/postcss";
|
|
9
|
+
import { filterExistingCssRules, finalizeMiniProgramCss, hasMiniProgramCssSpecificityPlaceholders, postcss, pruneMiniProgramGeneratedCss, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, stripMiniProgramCssSpecificityPlaceholders, transformWebCssCompat } from "@weapp-tailwindcss/postcss";
|
|
10
10
|
import { LRUCache } from "lru-cache";
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
12
12
|
import { MappingChars2String, unescape } from "@weapp-core/escape";
|
|
@@ -128,6 +128,30 @@ function annotateCssSourceTrace(css, options) {
|
|
|
128
128
|
}
|
|
129
129
|
}
|
|
130
130
|
//#endregion
|
|
131
|
+
//#region src/bundlers/shared/generator-css/class-selectors.ts
|
|
132
|
+
function normalizeCssClassSelector(value) {
|
|
133
|
+
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
134
|
+
}
|
|
135
|
+
function collectRawSourceClassSelectors(rawSource) {
|
|
136
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
137
|
+
try {
|
|
138
|
+
postcss.parse(rawSource).walkRules((rule) => {
|
|
139
|
+
for (const selector of rule.selectors ?? [rule.selector]) for (const match of selector.matchAll(/\.((?:\\.|[_a-z\u00A0-\uFFFF-])(?:\\.|[\w\u00A0-\uFFFF-])*)/gi)) selectors.add(normalizeCssClassSelector(match[1]));
|
|
140
|
+
});
|
|
141
|
+
} catch {}
|
|
142
|
+
return selectors;
|
|
143
|
+
}
|
|
144
|
+
function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
145
|
+
const selectors = collectRawSourceClassSelectors(rawSource);
|
|
146
|
+
if (selectors.size === 0) return /* @__PURE__ */ new Set();
|
|
147
|
+
const matched = /* @__PURE__ */ new Set();
|
|
148
|
+
for (const candidate of candidates) {
|
|
149
|
+
const escaped = normalizeCssClassSelector(replaceWxml(candidate, { escapeMap }));
|
|
150
|
+
if (selectors.has(candidate) || selectors.has(escaped)) matched.add(candidate);
|
|
151
|
+
}
|
|
152
|
+
return matched;
|
|
153
|
+
}
|
|
154
|
+
//#endregion
|
|
131
155
|
//#region src/bundlers/shared/generator-css/generation-helpers.ts
|
|
132
156
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
133
157
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
@@ -210,7 +234,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
|
|
|
210
234
|
const hasApplyDirectives = hasTailwindApplyDirective(options.rawSource);
|
|
211
235
|
const sourceCss = cssHandlerOptions.sourceOptions?.sourceCss;
|
|
212
236
|
const hasSourceCssDirectives = typeof sourceCss === "string" && (hasTailwindRootDirectives(sourceCss, { importFallback: true }) || hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || hasTailwindApplyDirective(sourceCss));
|
|
213
|
-
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives;
|
|
237
|
+
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives || cssHandlerOptions.isMainChunk && (options.configuredCssSourceCount ?? 0) > 0 || cssHandlerOptions.isMainChunk && options.rawSource.includes("weapp-tailwindcss") || options.target === "web" && cssHandlerOptions.isMainChunk && (options.runtimeCandidateCount ?? 0) > 0;
|
|
214
238
|
}
|
|
215
239
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
216
240
|
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
@@ -620,7 +644,7 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
620
644
|
postcss.parse(styleSource).walkAtRules("import", (rule) => {
|
|
621
645
|
const request = parseImportRequest(rule.params);
|
|
622
646
|
if (!isLocalStyleImportRequest(request)) return;
|
|
623
|
-
const file = resolveLocalStyleImportFile(request, base);
|
|
647
|
+
const file = request ? resolveLocalStyleImportFile(request, base) : void 0;
|
|
624
648
|
if (file) files.push(file);
|
|
625
649
|
});
|
|
626
650
|
} catch {}
|
|
@@ -1881,7 +1905,7 @@ function hasConfiguredContainerCompatSource(source) {
|
|
|
1881
1905
|
if (cssEntrySource?.config) try {
|
|
1882
1906
|
if (/\bcontainer\b/.test(readFileSync(cssEntrySource.config, "utf8"))) return true;
|
|
1883
1907
|
} catch {}
|
|
1884
|
-
if ("config" in source && source.config) try {
|
|
1908
|
+
if ("config" in source && typeof source.config === "string") try {
|
|
1885
1909
|
if (/\bcontainer\b/.test(readFileSync(source.config, "utf8"))) return true;
|
|
1886
1910
|
} catch {}
|
|
1887
1911
|
return false;
|
|
@@ -2257,30 +2281,28 @@ function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
|
2257
2281
|
//#endregion
|
|
2258
2282
|
//#region src/bundlers/shared/generator-css/validate.ts
|
|
2259
2283
|
async function validateCandidatesByGenerator(options) {
|
|
2260
|
-
const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState
|
|
2284
|
+
const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState } = options;
|
|
2261
2285
|
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
2262
2286
|
if (majorVersion !== 4 || candidates.size === 0) return /* @__PURE__ */ new Set();
|
|
2263
|
-
const
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
const
|
|
2273
|
-
|
|
2274
|
-
if (typeof generator.validateCandidates
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
}));
|
|
2283
|
-
const classSet = new Set(classSets.flatMap((item) => [...item]));
|
|
2287
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
2288
|
+
try {
|
|
2289
|
+
const sources = await resolveGeneratorSources(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, {
|
|
2290
|
+
...normalizeWeappTailwindcssGeneratorOptions(opts.generator),
|
|
2291
|
+
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues
|
|
2292
|
+
}, {
|
|
2293
|
+
cssEntries: opts.cssEntries,
|
|
2294
|
+
runtime: candidates
|
|
2295
|
+
});
|
|
2296
|
+
const classSets = await Promise.all(sources.map(async (source) => {
|
|
2297
|
+
const generator = createWeappTailwindcssGenerator(source);
|
|
2298
|
+
if (typeof generator.validateCandidates !== "function") return /* @__PURE__ */ new Set();
|
|
2299
|
+
return generator.validateCandidates(candidates);
|
|
2300
|
+
}));
|
|
2301
|
+
for (const candidate of classSets.flatMap((item) => [...item])) classSet.add(candidate);
|
|
2302
|
+
} catch {}
|
|
2303
|
+
const rawSourceCandidates = collectGeneratedRawSourceCandidates(candidates, rawSource, opts.escapeMap);
|
|
2304
|
+
for (const candidate of rawSourceCandidates) classSet.add(candidate);
|
|
2305
|
+
for (const generatedCss of options.generatedCssSources ?? []) for (const candidate of collectGeneratedRawSourceCandidates(candidates, generatedCss, opts.escapeMap)) classSet.add(candidate);
|
|
2284
2306
|
debug("tailwind generator validated candidates: %s candidates=%d classSet=%d", file, candidates.size, classSet.size);
|
|
2285
2307
|
return classSet;
|
|
2286
2308
|
}
|
|
@@ -2318,6 +2340,14 @@ function isCssAlreadyRepresentedByMarkers(css, source) {
|
|
|
2318
2340
|
for (const marker of sourceMarkers) if (!cssMarkers.has(marker)) return false;
|
|
2319
2341
|
return true;
|
|
2320
2342
|
}
|
|
2343
|
+
function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
2344
|
+
const merged = new Set(classSet);
|
|
2345
|
+
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
2346
|
+
return merged;
|
|
2347
|
+
}
|
|
2348
|
+
function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
2349
|
+
return target === "web" ? transformWebCssCompat(css, webCompat) : css;
|
|
2350
|
+
}
|
|
2321
2351
|
async function generateCssByGenerator(options) {
|
|
2322
2352
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
2323
2353
|
const generatorOptions = {
|
|
@@ -2340,12 +2370,17 @@ async function generateCssByGenerator(options) {
|
|
|
2340
2370
|
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
2341
2371
|
const localImportParts = splitLocalCssImports(effectiveRawSource);
|
|
2342
2372
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
2373
|
+
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
2374
|
+
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
2375
|
+
};
|
|
2343
2376
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
2344
2377
|
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
2345
2378
|
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
2346
2379
|
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
2347
|
-
const
|
|
2348
|
-
const
|
|
2380
|
+
const generatedUserCssOrderSource = hasTailwindGeneratedCss(userSource) ? splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
2381
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? createCssAppend(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : hasTailwindGeneratedCss(userSource) ? "" : userCssRawSource;
|
|
2382
|
+
const userCssOrderSource = GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : hasTailwindGeneratedCss(userSource) ? userSource : generatedUserCssRawSource;
|
|
2383
|
+
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
2349
2384
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
2350
2385
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
2351
2386
|
css: shouldUseMiniProgramCssBranch(generatorBranch) ? removeUnsupportedMiniProgramAtRules(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
@@ -2367,7 +2402,10 @@ async function generateCssByGenerator(options) {
|
|
|
2367
2402
|
hasGeneratedCss,
|
|
2368
2403
|
hasGeneratedMarkers,
|
|
2369
2404
|
hasSourceDirectives,
|
|
2370
|
-
rawSource: generatorRawSource
|
|
2405
|
+
rawSource: generatorRawSource,
|
|
2406
|
+
runtimeCandidateCount: runtime.size,
|
|
2407
|
+
target: generatorOptions.target,
|
|
2408
|
+
configuredCssSourceCount: options.cssSources?.length
|
|
2371
2409
|
})) return;
|
|
2372
2410
|
try {
|
|
2373
2411
|
await runtimeState.readyPromise;
|
|
@@ -2423,12 +2461,13 @@ async function generateCssByGenerator(options) {
|
|
|
2423
2461
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2424
2462
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2425
2463
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
2464
|
+
const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2465
|
+
injectPreflight: false,
|
|
2466
|
+
styleOptions: generatorStyleOptions
|
|
2467
|
+
})) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
|
|
2426
2468
|
return {
|
|
2427
|
-
css:
|
|
2428
|
-
|
|
2429
|
-
styleOptions: generatorStyleOptions
|
|
2430
|
-
})) : options.previousCss, localImports),
|
|
2431
|
-
classSet: generated.classSet,
|
|
2469
|
+
css: finalCss,
|
|
2470
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2432
2471
|
target: generated.target,
|
|
2433
2472
|
source: "generator",
|
|
2434
2473
|
dependencies: generated.dependencies,
|
|
@@ -2481,28 +2520,29 @@ async function generateCssByGenerator(options) {
|
|
|
2481
2520
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : filterExistingCssRules(css, userCss);
|
|
2482
2521
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2483
2522
|
}
|
|
2484
|
-
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(
|
|
2485
|
-
const userCss = await transformGeneratorUserCss(
|
|
2486
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2523
|
+
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
2524
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, userCssOptions);
|
|
2525
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? filterExistingCssRules(css, userCss) : userCss;
|
|
2487
2526
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2488
2527
|
}
|
|
2489
2528
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
2490
2529
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2491
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
2492
|
-
css = await appendLegacyCompatCss(css,
|
|
2493
|
-
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css,
|
|
2530
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2531
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2532
|
+
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2494
2533
|
}
|
|
2495
2534
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2535
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2536
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2537
|
+
cssHandlerOptions,
|
|
2538
|
+
isolateCurrentCssCandidates,
|
|
2539
|
+
localImports
|
|
2540
|
+
}),
|
|
2541
|
+
styleOptions: generatorStyleOptions
|
|
2542
|
+
});
|
|
2496
2543
|
return {
|
|
2497
|
-
css:
|
|
2498
|
-
|
|
2499
|
-
cssHandlerOptions,
|
|
2500
|
-
isolateCurrentCssCandidates,
|
|
2501
|
-
localImports
|
|
2502
|
-
}),
|
|
2503
|
-
styleOptions: generatorStyleOptions
|
|
2504
|
-
}), localImports),
|
|
2505
|
-
classSet: generated.classSet,
|
|
2544
|
+
css: finalCss,
|
|
2545
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2506
2546
|
target: generated.target,
|
|
2507
2547
|
source: "generator",
|
|
2508
2548
|
dependencies: generated.dependencies,
|
|
@@ -2515,7 +2555,7 @@ async function generateCssByGenerator(options) {
|
|
|
2515
2555
|
}
|
|
2516
2556
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
2517
2557
|
let css = generatedCss;
|
|
2518
|
-
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(
|
|
2558
|
+
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2519
2559
|
generatorTarget: generated.target,
|
|
2520
2560
|
generatorStyleOptions,
|
|
2521
2561
|
cssUserHandlerOptions,
|
|
@@ -2547,7 +2587,7 @@ async function generateCssByGenerator(options) {
|
|
|
2547
2587
|
}
|
|
2548
2588
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
2549
2589
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2550
|
-
const userCss = await transformGeneratorUserCss(
|
|
2590
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2551
2591
|
generatorTarget: generated.target,
|
|
2552
2592
|
generatorStyleOptions,
|
|
2553
2593
|
cssUserHandlerOptions,
|
|
@@ -2555,9 +2595,9 @@ async function generateCssByGenerator(options) {
|
|
|
2555
2595
|
importFallback: generatorOptions.importFallback,
|
|
2556
2596
|
processed: userRawSourceProcessed
|
|
2557
2597
|
});
|
|
2558
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2598
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? filterExistingCssRules(css, userCss) : userCss;
|
|
2559
2599
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2560
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers) {
|
|
2600
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
2561
2601
|
const userCss = await transformGeneratorUserCss(removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource), {
|
|
2562
2602
|
generatorTarget: generated.target,
|
|
2563
2603
|
generatorStyleOptions,
|
|
@@ -2568,8 +2608,8 @@ async function generateCssByGenerator(options) {
|
|
|
2568
2608
|
});
|
|
2569
2609
|
const missingUserCss = filterExistingCssRules(css, userCss);
|
|
2570
2610
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2571
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(
|
|
2572
|
-
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(
|
|
2611
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(generatedUserCssRawSource)) {
|
|
2612
|
+
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(generatedUserCssRawSource).layer, {
|
|
2573
2613
|
generatorTarget: generated.target,
|
|
2574
2614
|
generatorStyleOptions,
|
|
2575
2615
|
cssUserHandlerOptions,
|
|
@@ -2583,13 +2623,13 @@ async function generateCssByGenerator(options) {
|
|
|
2583
2623
|
}
|
|
2584
2624
|
}
|
|
2585
2625
|
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
2586
|
-
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed) css = await appendLegacyContainerCompatCss(css,
|
|
2626
|
+
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2587
2627
|
}
|
|
2588
2628
|
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
2589
2629
|
hasSourceDirectives,
|
|
2590
2630
|
hasMatchedCssSourceFile
|
|
2591
2631
|
})) {
|
|
2592
|
-
const userCss = await transformGeneratorUserCss(
|
|
2632
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2593
2633
|
generatorTarget: generated.target,
|
|
2594
2634
|
generatorStyleOptions,
|
|
2595
2635
|
cssUserHandlerOptions,
|
|
@@ -2600,16 +2640,17 @@ async function generateCssByGenerator(options) {
|
|
|
2600
2640
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : filterExistingCssRules(css, userCss);
|
|
2601
2641
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2602
2642
|
}
|
|
2643
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2644
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2645
|
+
cssHandlerOptions,
|
|
2646
|
+
isolateCurrentCssCandidates,
|
|
2647
|
+
localImports
|
|
2648
|
+
}),
|
|
2649
|
+
styleOptions: generatorStyleOptions
|
|
2650
|
+
});
|
|
2603
2651
|
return {
|
|
2604
|
-
css:
|
|
2605
|
-
|
|
2606
|
-
cssHandlerOptions,
|
|
2607
|
-
isolateCurrentCssCandidates,
|
|
2608
|
-
localImports
|
|
2609
|
-
}),
|
|
2610
|
-
styleOptions: generatorStyleOptions
|
|
2611
|
-
}), localImports),
|
|
2612
|
-
classSet: generated.classSet,
|
|
2652
|
+
css: finalCss,
|
|
2653
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2613
2654
|
target: generated.target,
|
|
2614
2655
|
source: "generator",
|
|
2615
2656
|
dependencies: generated.dependencies,
|
|
@@ -2620,12 +2661,12 @@ async function generateCssByGenerator(options) {
|
|
|
2620
2661
|
}
|
|
2621
2662
|
};
|
|
2622
2663
|
}
|
|
2623
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
2624
|
-
css = await appendLegacyCompatCss(css,
|
|
2625
|
-
css = await appendLegacyContainerCompatCss(css,
|
|
2664
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2665
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2666
|
+
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2626
2667
|
}
|
|
2627
|
-
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(
|
|
2628
|
-
const userCss = await transformGeneratorUserCss(
|
|
2668
|
+
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
2669
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2629
2670
|
generatorTarget: generated.target,
|
|
2630
2671
|
generatorStyleOptions,
|
|
2631
2672
|
cssUserHandlerOptions,
|
|
@@ -2633,19 +2674,20 @@ async function generateCssByGenerator(options) {
|
|
|
2633
2674
|
importFallback: generatorOptions.importFallback,
|
|
2634
2675
|
processed: userRawSourceProcessed
|
|
2635
2676
|
});
|
|
2636
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2677
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? filterExistingCssRules(css, userCss) : userCss;
|
|
2637
2678
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2638
2679
|
}
|
|
2680
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2681
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2682
|
+
cssHandlerOptions,
|
|
2683
|
+
isolateCurrentCssCandidates,
|
|
2684
|
+
localImports
|
|
2685
|
+
}),
|
|
2686
|
+
styleOptions: generatorStyleOptions
|
|
2687
|
+
});
|
|
2639
2688
|
return {
|
|
2640
|
-
css:
|
|
2641
|
-
|
|
2642
|
-
cssHandlerOptions,
|
|
2643
|
-
isolateCurrentCssCandidates,
|
|
2644
|
-
localImports
|
|
2645
|
-
}),
|
|
2646
|
-
styleOptions: generatorStyleOptions
|
|
2647
|
-
}), localImports),
|
|
2648
|
-
classSet: generated.classSet,
|
|
2689
|
+
css: finalCss,
|
|
2690
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2649
2691
|
target: generated.target,
|
|
2650
2692
|
source: "generator",
|
|
2651
2693
|
dependencies: generated.dependencies,
|
|
@@ -3479,4 +3521,4 @@ function createHmrTimingRecorder(bundler) {
|
|
|
3479
3521
|
};
|
|
3480
3522
|
}
|
|
3481
3523
|
//#endregion
|
|
3482
|
-
export {
|
|
3524
|
+
export { hasMiniProgramCssSpecificityPlaceholders as A, stripTailwindSourceMediaFragments as C, createCssSourceOrderAppend$1 as D, removeGeneratedSelectorCompatCss as E, createCssTokenSourceMap as F, isCssSourceTraceEnabled as I, processCachedTask as L, stripMiniProgramCssSpecificityPlaceholders as M, annotateCssSourceTrace as N, hasMiniProgramTailwindV4PreflightReset as O, createCssSourceTraceCacheSignature as P, removeTailwindV4GeneratorAtRules as S, scoreTailwindV4CssSourceFileMatch as T, isPureLocalCssImportWrapper as _, isSourceCandidateRequest as a, removeMiniProgramHoverSelectors as b, collectStrictEscapedRuntimeCandidates as c, validateCandidatesByGenerator as d, pushConcurrentTaskFactories as f, mergeMarkedUserLayerComponentsCss as g, extractMarkedUserLayerComponentsCss as h, createSourceCandidateStore as i, pruneMiniProgramGeneratedCss as j, finalizeMiniProgramCss as k, createEscapeFragments as l, runWithConcurrency as m, emitHmrTiming as n, resolveSourceCandidateScanFiles as o, resolveTaskConcurrency as p, createSourceCandidateCollector as r, createBundleRuntimeClassSetManager as s, createHmrTimingRecorder as t, generateCssByGenerator as u, rewriteLocalCssImportRequestsForOutput as v, stripUnmatchedTailwindSourceMediaCloseFragments as w, removeTailwindV4GeneratedUserCssArtifacts as x, splitLocalCssImports as y };
|