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
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-Da4uEG_u.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-CXmUiI9f.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -1649,12 +1649,8 @@ function resolveTargetCandidates(candidates, target) {
|
|
|
1649
1649
|
const collected = collectCandidates(candidates);
|
|
1650
1650
|
return target === "weapp" ? filterUnsupportedMiniProgramTailwindV4Candidates(collected) : collected;
|
|
1651
1651
|
}
|
|
1652
|
-
function collectSeenCandidates(generated
|
|
1653
|
-
return new Set(
|
|
1654
|
-
...requestedCandidates,
|
|
1655
|
-
...generated.rawCandidates,
|
|
1656
|
-
...generated.classSet
|
|
1657
|
-
]);
|
|
1652
|
+
function collectSeenCandidates(generated) {
|
|
1653
|
+
return new Set(generated.classSet);
|
|
1658
1654
|
}
|
|
1659
1655
|
function shouldDelegateWebSourceScanToTailwind(target, scanSources) {
|
|
1660
1656
|
return target === "web" && scanSources !== false;
|
|
@@ -1692,7 +1688,7 @@ function seedIncrementalGenerateCache(options) {
|
|
|
1692
1688
|
const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
|
|
1693
1689
|
mergeCustomPropertyValues(customPropertyValues, options.generated.css);
|
|
1694
1690
|
incrementalGenerateCache.set(cacheKey, {
|
|
1695
|
-
seenCandidates: collectSeenCandidates(options.generated
|
|
1691
|
+
seenCandidates: collectSeenCandidates(options.generated),
|
|
1696
1692
|
classSet: new Set(options.generated.classSet),
|
|
1697
1693
|
css: options.generated.css,
|
|
1698
1694
|
rawCss: options.generated.rawCss,
|
|
@@ -2061,9 +2057,9 @@ function normalizeTailwindV4SourceOptions(options) {
|
|
|
2061
2057
|
if (css === options.css && cssSources === options.cssSources && cssEntries === options.cssEntries) return options;
|
|
2062
2058
|
return {
|
|
2063
2059
|
...options,
|
|
2064
|
-
css,
|
|
2060
|
+
...css === void 0 ? {} : { css },
|
|
2065
2061
|
...cssEntries === void 0 ? {} : { cssEntries },
|
|
2066
|
-
cssSources
|
|
2062
|
+
...cssSources === void 0 ? {} : { cssSources }
|
|
2067
2063
|
};
|
|
2068
2064
|
}
|
|
2069
2065
|
function resolveTailwindCssImportTarget(runtime) {
|
|
@@ -2243,6 +2239,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
|
2243
2239
|
if (options == null) return {
|
|
2244
2240
|
target,
|
|
2245
2241
|
branch,
|
|
2242
|
+
webCompat: void 0,
|
|
2246
2243
|
importFallback: false,
|
|
2247
2244
|
bareArbitraryValues: void 0
|
|
2248
2245
|
};
|
|
@@ -2251,6 +2248,7 @@ function normalizeWeappTailwindcssGeneratorOptions(options, context = {}) {
|
|
|
2251
2248
|
branch,
|
|
2252
2249
|
config: options.config,
|
|
2253
2250
|
styleOptions: options.styleOptions,
|
|
2251
|
+
webCompat: options.webCompat,
|
|
2254
2252
|
importFallback: options.importFallback ?? false,
|
|
2255
2253
|
bareArbitraryValues: options.bareArbitraryValues
|
|
2256
2254
|
};
|
|
@@ -2261,6 +2259,46 @@ function createWeappTailwindcssGenerator(source) {
|
|
|
2261
2259
|
return createTailwindV4Engine(source);
|
|
2262
2260
|
}
|
|
2263
2261
|
//#endregion
|
|
2262
|
+
//#region src/wxml/shared.ts
|
|
2263
|
+
const NEWLINE_RE = /[\n\r]+/g;
|
|
2264
|
+
function replaceWxml(original, options = {
|
|
2265
|
+
keepEOL: false,
|
|
2266
|
+
escapeMap: _weapp_core_escape.MappingChars2String
|
|
2267
|
+
}) {
|
|
2268
|
+
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
2269
|
+
let res = original;
|
|
2270
|
+
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
|
|
2271
|
+
res = (0, _weapp_core_escape.escape)(res, omitUndefined({
|
|
2272
|
+
map: escapeMap,
|
|
2273
|
+
ignoreHead
|
|
2274
|
+
}));
|
|
2275
|
+
return res;
|
|
2276
|
+
}
|
|
2277
|
+
//#endregion
|
|
2278
|
+
//#region src/bundlers/shared/generator-css/class-selectors.ts
|
|
2279
|
+
function normalizeCssClassSelector(value) {
|
|
2280
|
+
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
2281
|
+
}
|
|
2282
|
+
function collectRawSourceClassSelectors(rawSource) {
|
|
2283
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
2284
|
+
try {
|
|
2285
|
+
_weapp_tailwindcss_postcss.postcss.parse(rawSource).walkRules((rule) => {
|
|
2286
|
+
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]));
|
|
2287
|
+
});
|
|
2288
|
+
} catch {}
|
|
2289
|
+
return selectors;
|
|
2290
|
+
}
|
|
2291
|
+
function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
2292
|
+
const selectors = collectRawSourceClassSelectors(rawSource);
|
|
2293
|
+
if (selectors.size === 0) return /* @__PURE__ */ new Set();
|
|
2294
|
+
const matched = /* @__PURE__ */ new Set();
|
|
2295
|
+
for (const candidate of candidates) {
|
|
2296
|
+
const escaped = normalizeCssClassSelector(replaceWxml(candidate, { escapeMap }));
|
|
2297
|
+
if (selectors.has(candidate) || selectors.has(escaped)) matched.add(candidate);
|
|
2298
|
+
}
|
|
2299
|
+
return matched;
|
|
2300
|
+
}
|
|
2301
|
+
//#endregion
|
|
2264
2302
|
//#region src/uni-app-x/options.ts
|
|
2265
2303
|
const DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS = {
|
|
2266
2304
|
enabled: true,
|
|
@@ -2300,6 +2338,9 @@ function isUniAppXEnabled(option) {
|
|
|
2300
2338
|
}
|
|
2301
2339
|
//#endregion
|
|
2302
2340
|
//#region src/context/style-options.ts
|
|
2341
|
+
function normalizeStyleHandlerMajorVersion(majorVersion) {
|
|
2342
|
+
return majorVersion === 4 ? 4 : void 0;
|
|
2343
|
+
}
|
|
2303
2344
|
function resolveStyleOptionsFromContext(ctx, tailwindcssMajorVersion) {
|
|
2304
2345
|
const resolvedUniAppXOptions = resolveUniAppXOptions(ctx.uniAppX);
|
|
2305
2346
|
const branch = resolveGeneratorRuntimeBranch(normalizeWeappTailwindcssGeneratorOptions(ctx.generator, {
|
|
@@ -2438,7 +2479,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
|
|
|
2438
2479
|
const hasApplyDirectives = hasTailwindApplyDirective(options.rawSource);
|
|
2439
2480
|
const sourceCss = cssHandlerOptions.sourceOptions?.sourceCss;
|
|
2440
2481
|
const hasSourceCssDirectives = typeof sourceCss === "string" && (hasTailwindRootDirectives(sourceCss, { importFallback: true }) || hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || hasTailwindApplyDirective(sourceCss));
|
|
2441
|
-
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives;
|
|
2482
|
+
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;
|
|
2442
2483
|
}
|
|
2443
2484
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
2444
2485
|
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
@@ -2461,22 +2502,6 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
2461
2502
|
};
|
|
2462
2503
|
}
|
|
2463
2504
|
//#endregion
|
|
2464
|
-
//#region src/wxml/shared.ts
|
|
2465
|
-
const NEWLINE_RE = /[\n\r]+/g;
|
|
2466
|
-
function replaceWxml(original, options = {
|
|
2467
|
-
keepEOL: false,
|
|
2468
|
-
escapeMap: _weapp_core_escape.MappingChars2String
|
|
2469
|
-
}) {
|
|
2470
|
-
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
2471
|
-
let res = original;
|
|
2472
|
-
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
|
|
2473
|
-
res = (0, _weapp_core_escape.escape)(res, omitUndefined({
|
|
2474
|
-
map: escapeMap,
|
|
2475
|
-
ignoreHead
|
|
2476
|
-
}));
|
|
2477
|
-
return res;
|
|
2478
|
-
}
|
|
2479
|
-
//#endregion
|
|
2480
2505
|
//#region src/babel/index.ts
|
|
2481
2506
|
function _interopDefaultCompat(e) {
|
|
2482
2507
|
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
@@ -3752,7 +3777,7 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
3752
3777
|
_weapp_tailwindcss_postcss.postcss.parse(styleSource).walkAtRules("import", (rule) => {
|
|
3753
3778
|
const request = parseImportRequest(rule.params);
|
|
3754
3779
|
if (!isLocalStyleImportRequest(request)) return;
|
|
3755
|
-
const file = resolveLocalStyleImportFile(request, base);
|
|
3780
|
+
const file = request ? resolveLocalStyleImportFile(request, base) : void 0;
|
|
3756
3781
|
if (file) files.push(file);
|
|
3757
3782
|
});
|
|
3758
3783
|
} catch {}
|
|
@@ -5013,7 +5038,7 @@ function hasConfiguredContainerCompatSource(source) {
|
|
|
5013
5038
|
if (cssEntrySource?.config) try {
|
|
5014
5039
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(cssEntrySource.config, "utf8"))) return true;
|
|
5015
5040
|
} catch {}
|
|
5016
|
-
if ("config" in source && source.config) try {
|
|
5041
|
+
if ("config" in source && typeof source.config === "string") try {
|
|
5017
5042
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(source.config, "utf8"))) return true;
|
|
5018
5043
|
} catch {}
|
|
5019
5044
|
return false;
|
|
@@ -5320,6 +5345,14 @@ function isCssAlreadyRepresentedByMarkers(css, source) {
|
|
|
5320
5345
|
for (const marker of sourceMarkers) if (!cssMarkers.has(marker)) return false;
|
|
5321
5346
|
return true;
|
|
5322
5347
|
}
|
|
5348
|
+
function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
5349
|
+
const merged = new Set(classSet);
|
|
5350
|
+
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
5351
|
+
return merged;
|
|
5352
|
+
}
|
|
5353
|
+
function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
5354
|
+
return target === "web" ? (0, _weapp_tailwindcss_postcss.transformWebCssCompat)(css, webCompat) : css;
|
|
5355
|
+
}
|
|
5323
5356
|
async function generateCssByGenerator(options) {
|
|
5324
5357
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
5325
5358
|
const generatorOptions = {
|
|
@@ -5342,12 +5375,17 @@ async function generateCssByGenerator(options) {
|
|
|
5342
5375
|
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
5343
5376
|
const localImportParts = splitLocalCssImports(effectiveRawSource);
|
|
5344
5377
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
5378
|
+
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
5379
|
+
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
5380
|
+
};
|
|
5345
5381
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
5346
5382
|
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
5347
5383
|
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
5348
5384
|
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
5349
|
-
const
|
|
5350
|
-
const
|
|
5385
|
+
const generatedUserCssOrderSource = hasTailwindGeneratedCss(userSource) ? splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
5386
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? createCssAppend(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : hasTailwindGeneratedCss(userSource) ? "" : userCssRawSource;
|
|
5387
|
+
const userCssOrderSource = GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : hasTailwindGeneratedCss(userSource) ? userSource : generatedUserCssRawSource;
|
|
5388
|
+
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
5351
5389
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
5352
5390
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
5353
5391
|
css: shouldUseMiniProgramCssBranch(generatorBranch) ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
@@ -5369,7 +5407,10 @@ async function generateCssByGenerator(options) {
|
|
|
5369
5407
|
hasGeneratedCss,
|
|
5370
5408
|
hasGeneratedMarkers,
|
|
5371
5409
|
hasSourceDirectives,
|
|
5372
|
-
rawSource: generatorRawSource
|
|
5410
|
+
rawSource: generatorRawSource,
|
|
5411
|
+
runtimeCandidateCount: runtime.size,
|
|
5412
|
+
target: generatorOptions.target,
|
|
5413
|
+
configuredCssSourceCount: options.cssSources?.length
|
|
5373
5414
|
})) return;
|
|
5374
5415
|
try {
|
|
5375
5416
|
await runtimeState.readyPromise;
|
|
@@ -5425,12 +5466,13 @@ async function generateCssByGenerator(options) {
|
|
|
5425
5466
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
5426
5467
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
5427
5468
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
5469
|
+
const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
5470
|
+
injectPreflight: false,
|
|
5471
|
+
styleOptions: generatorStyleOptions
|
|
5472
|
+
})) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
|
|
5428
5473
|
return {
|
|
5429
|
-
css:
|
|
5430
|
-
|
|
5431
|
-
styleOptions: generatorStyleOptions
|
|
5432
|
-
})) : options.previousCss, localImports),
|
|
5433
|
-
classSet: generated.classSet,
|
|
5474
|
+
css: finalCss,
|
|
5475
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5434
5476
|
target: generated.target,
|
|
5435
5477
|
source: "generator",
|
|
5436
5478
|
dependencies: generated.dependencies,
|
|
@@ -5483,28 +5525,29 @@ async function generateCssByGenerator(options) {
|
|
|
5483
5525
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
5484
5526
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5485
5527
|
}
|
|
5486
|
-
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(
|
|
5487
|
-
const userCss = await transformGeneratorUserCss(
|
|
5488
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
5528
|
+
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
5529
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, userCssOptions);
|
|
5530
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
5489
5531
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5490
5532
|
}
|
|
5491
5533
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
5492
5534
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
5493
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
5494
|
-
css = await appendLegacyCompatCss(css,
|
|
5495
|
-
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css,
|
|
5535
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
5536
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5537
|
+
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5496
5538
|
}
|
|
5497
5539
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
5540
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
5541
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5542
|
+
cssHandlerOptions,
|
|
5543
|
+
isolateCurrentCssCandidates,
|
|
5544
|
+
localImports
|
|
5545
|
+
}),
|
|
5546
|
+
styleOptions: generatorStyleOptions
|
|
5547
|
+
});
|
|
5498
5548
|
return {
|
|
5499
|
-
css:
|
|
5500
|
-
|
|
5501
|
-
cssHandlerOptions,
|
|
5502
|
-
isolateCurrentCssCandidates,
|
|
5503
|
-
localImports
|
|
5504
|
-
}),
|
|
5505
|
-
styleOptions: generatorStyleOptions
|
|
5506
|
-
}), localImports),
|
|
5507
|
-
classSet: generated.classSet,
|
|
5549
|
+
css: finalCss,
|
|
5550
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5508
5551
|
target: generated.target,
|
|
5509
5552
|
source: "generator",
|
|
5510
5553
|
dependencies: generated.dependencies,
|
|
@@ -5517,7 +5560,7 @@ async function generateCssByGenerator(options) {
|
|
|
5517
5560
|
}
|
|
5518
5561
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
5519
5562
|
let css = generatedCss;
|
|
5520
|
-
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(
|
|
5563
|
+
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5521
5564
|
generatorTarget: generated.target,
|
|
5522
5565
|
generatorStyleOptions,
|
|
5523
5566
|
cssUserHandlerOptions,
|
|
@@ -5549,7 +5592,7 @@ async function generateCssByGenerator(options) {
|
|
|
5549
5592
|
}
|
|
5550
5593
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
5551
5594
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
5552
|
-
const userCss = await transformGeneratorUserCss(
|
|
5595
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5553
5596
|
generatorTarget: generated.target,
|
|
5554
5597
|
generatorStyleOptions,
|
|
5555
5598
|
cssUserHandlerOptions,
|
|
@@ -5557,9 +5600,9 @@ async function generateCssByGenerator(options) {
|
|
|
5557
5600
|
importFallback: generatorOptions.importFallback,
|
|
5558
5601
|
processed: userRawSourceProcessed
|
|
5559
5602
|
});
|
|
5560
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
5603
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
5561
5604
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5562
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers) {
|
|
5605
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
5563
5606
|
const userCss = await transformGeneratorUserCss(removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource), {
|
|
5564
5607
|
generatorTarget: generated.target,
|
|
5565
5608
|
generatorStyleOptions,
|
|
@@ -5570,8 +5613,8 @@ async function generateCssByGenerator(options) {
|
|
|
5570
5613
|
});
|
|
5571
5614
|
const missingUserCss = (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
5572
5615
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5573
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(
|
|
5574
|
-
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(
|
|
5616
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(generatedUserCssRawSource)) {
|
|
5617
|
+
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(generatedUserCssRawSource).layer, {
|
|
5575
5618
|
generatorTarget: generated.target,
|
|
5576
5619
|
generatorStyleOptions,
|
|
5577
5620
|
cssUserHandlerOptions,
|
|
@@ -5585,13 +5628,13 @@ async function generateCssByGenerator(options) {
|
|
|
5585
5628
|
}
|
|
5586
5629
|
}
|
|
5587
5630
|
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
5588
|
-
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed) css = await appendLegacyContainerCompatCss(css,
|
|
5631
|
+
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5589
5632
|
}
|
|
5590
5633
|
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
5591
5634
|
hasSourceDirectives,
|
|
5592
5635
|
hasMatchedCssSourceFile
|
|
5593
5636
|
})) {
|
|
5594
|
-
const userCss = await transformGeneratorUserCss(
|
|
5637
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5595
5638
|
generatorTarget: generated.target,
|
|
5596
5639
|
generatorStyleOptions,
|
|
5597
5640
|
cssUserHandlerOptions,
|
|
@@ -5602,16 +5645,17 @@ async function generateCssByGenerator(options) {
|
|
|
5602
5645
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
5603
5646
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5604
5647
|
}
|
|
5648
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
5649
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5650
|
+
cssHandlerOptions,
|
|
5651
|
+
isolateCurrentCssCandidates,
|
|
5652
|
+
localImports
|
|
5653
|
+
}),
|
|
5654
|
+
styleOptions: generatorStyleOptions
|
|
5655
|
+
});
|
|
5605
5656
|
return {
|
|
5606
|
-
css:
|
|
5607
|
-
|
|
5608
|
-
cssHandlerOptions,
|
|
5609
|
-
isolateCurrentCssCandidates,
|
|
5610
|
-
localImports
|
|
5611
|
-
}),
|
|
5612
|
-
styleOptions: generatorStyleOptions
|
|
5613
|
-
}), localImports),
|
|
5614
|
-
classSet: generated.classSet,
|
|
5657
|
+
css: finalCss,
|
|
5658
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5615
5659
|
target: generated.target,
|
|
5616
5660
|
source: "generator",
|
|
5617
5661
|
dependencies: generated.dependencies,
|
|
@@ -5622,12 +5666,12 @@ async function generateCssByGenerator(options) {
|
|
|
5622
5666
|
}
|
|
5623
5667
|
};
|
|
5624
5668
|
}
|
|
5625
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
5626
|
-
css = await appendLegacyCompatCss(css,
|
|
5627
|
-
css = await appendLegacyContainerCompatCss(css,
|
|
5669
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
5670
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5671
|
+
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5628
5672
|
}
|
|
5629
|
-
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(
|
|
5630
|
-
const userCss = await transformGeneratorUserCss(
|
|
5673
|
+
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
5674
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5631
5675
|
generatorTarget: generated.target,
|
|
5632
5676
|
generatorStyleOptions,
|
|
5633
5677
|
cssUserHandlerOptions,
|
|
@@ -5635,19 +5679,20 @@ async function generateCssByGenerator(options) {
|
|
|
5635
5679
|
importFallback: generatorOptions.importFallback,
|
|
5636
5680
|
processed: userRawSourceProcessed
|
|
5637
5681
|
});
|
|
5638
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
5682
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
5639
5683
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5640
5684
|
}
|
|
5685
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
5686
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5687
|
+
cssHandlerOptions,
|
|
5688
|
+
isolateCurrentCssCandidates,
|
|
5689
|
+
localImports
|
|
5690
|
+
}),
|
|
5691
|
+
styleOptions: generatorStyleOptions
|
|
5692
|
+
});
|
|
5641
5693
|
return {
|
|
5642
|
-
css:
|
|
5643
|
-
|
|
5644
|
-
cssHandlerOptions,
|
|
5645
|
-
isolateCurrentCssCandidates,
|
|
5646
|
-
localImports
|
|
5647
|
-
}),
|
|
5648
|
-
styleOptions: generatorStyleOptions
|
|
5649
|
-
}), localImports),
|
|
5650
|
-
classSet: generated.classSet,
|
|
5694
|
+
css: finalCss,
|
|
5695
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5651
5696
|
target: generated.target,
|
|
5652
5697
|
source: "generator",
|
|
5653
5698
|
dependencies: generated.dependencies,
|
|
@@ -7181,7 +7226,7 @@ function createCssHandlerOptions(options, majorVersion, file, appType) {
|
|
|
7181
7226
|
return {
|
|
7182
7227
|
isMainChunk: options.mainCssChunkMatcher(file, appType),
|
|
7183
7228
|
postcssOptions: { options: { from: file } },
|
|
7184
|
-
...majorVersion === void 0 ? {} : { majorVersion }
|
|
7229
|
+
...normalizeStyleHandlerMajorVersion(majorVersion) === void 0 ? {} : { majorVersion: 4 }
|
|
7185
7230
|
};
|
|
7186
7231
|
}
|
|
7187
7232
|
async function resolveWebpackLoaderSourceCandidates(source, loaderContext, options) {
|
|
@@ -7193,7 +7238,7 @@ async function resolveWebpackLoaderSourceCandidates(source, loaderContext, optio
|
|
|
7193
7238
|
if (!resolved) return;
|
|
7194
7239
|
const collector = createSourceCandidateStore({ bareArbitraryValues: compilerOptions.arbitraryValues?.bareArbitraryValues });
|
|
7195
7240
|
collector.syncInline(resolved.inlineCandidates);
|
|
7196
|
-
const outDir = loaderContext.rootContext ? node_path.default.resolve(loaderContext.rootContext,
|
|
7241
|
+
const outDir = loaderContext.rootContext ? node_path.default.resolve(loaderContext.rootContext, "dist") : void 0;
|
|
7197
7242
|
const scanFiles = await resolveSourceCandidateScanFiles({
|
|
7198
7243
|
entries: resolved.entries,
|
|
7199
7244
|
explicit: resolved.explicit,
|