weapp-tailwindcss 5.1.0 → 5.1.1
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/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-BHxLe743.js → context-B6hVF7dr.js} +20 -9
- package/dist/{context-Mbzkek1q.mjs → context-DlpKD7aN.mjs} +15 -10
- 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/types.d.ts +1 -1
- package/dist/{generator-9rUz4Hcb.js → generator-6oMJtTDO.js} +1 -1
- package/dist/{generator-Dc4qaPmT.mjs → generator-CjzBK7h-.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-B_sdP6dx.js → gulp-BtGq6LP9.js} +11 -9
- package/dist/{gulp-uM36oIJs.mjs → gulp-DNU10Vtc.mjs} +11 -9
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BXMLsF4b.mjs → hmr-timing-B0KuWDjV.mjs} +121 -85
- package/dist/{hmr-timing-CogqkFaF.js → hmr-timing-CegXR9O4.js} +132 -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-Cvb5z1ha.mjs → source-candidate-scan-signature-B5af2Ahe.mjs} +3 -3
- package/dist/{source-candidate-scan-signature-2ybpptAK.js → source-candidate-scan-signature-BKYb9jxa.js} +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-tExdt40m.mjs → transform-fRBeuuK-.mjs} +1 -1
- package/dist/{transform-CQVOgmzM.js → transform-vLwZpiTE.js} +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-CWRooooa.mjs} +730 -393
- package/dist/{vite-CP0ylSxZ.js → vite-w-RkgaTY.js} +730 -392
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +122 -85
- package/dist/{webpack-BzqhJ8yK.mjs → webpack-8PaV1gG3.mjs} +923 -671
- package/dist/{webpack-Bsek8VhR.js → webpack-CGgBOx9l.js} +923 -671
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +5 -5
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-w-RkgaTY.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-CWRooooa.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) {
|
|
@@ -2261,6 +2257,46 @@ function createWeappTailwindcssGenerator(source) {
|
|
|
2261
2257
|
return createTailwindV4Engine(source);
|
|
2262
2258
|
}
|
|
2263
2259
|
//#endregion
|
|
2260
|
+
//#region src/wxml/shared.ts
|
|
2261
|
+
const NEWLINE_RE = /[\n\r]+/g;
|
|
2262
|
+
function replaceWxml(original, options = {
|
|
2263
|
+
keepEOL: false,
|
|
2264
|
+
escapeMap: _weapp_core_escape.MappingChars2String
|
|
2265
|
+
}) {
|
|
2266
|
+
const { keepEOL, escapeMap, ignoreHead } = options;
|
|
2267
|
+
let res = original;
|
|
2268
|
+
if (!keepEOL) res = res.replaceAll(NEWLINE_RE, "");
|
|
2269
|
+
res = (0, _weapp_core_escape.escape)(res, omitUndefined({
|
|
2270
|
+
map: escapeMap,
|
|
2271
|
+
ignoreHead
|
|
2272
|
+
}));
|
|
2273
|
+
return res;
|
|
2274
|
+
}
|
|
2275
|
+
//#endregion
|
|
2276
|
+
//#region src/bundlers/shared/generator-css/class-selectors.ts
|
|
2277
|
+
function normalizeCssClassSelector(value) {
|
|
2278
|
+
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
2279
|
+
}
|
|
2280
|
+
function collectRawSourceClassSelectors(rawSource) {
|
|
2281
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
2282
|
+
try {
|
|
2283
|
+
_weapp_tailwindcss_postcss.postcss.parse(rawSource).walkRules((rule) => {
|
|
2284
|
+
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]));
|
|
2285
|
+
});
|
|
2286
|
+
} catch {}
|
|
2287
|
+
return selectors;
|
|
2288
|
+
}
|
|
2289
|
+
function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
2290
|
+
const selectors = collectRawSourceClassSelectors(rawSource);
|
|
2291
|
+
if (selectors.size === 0) return /* @__PURE__ */ new Set();
|
|
2292
|
+
const matched = /* @__PURE__ */ new Set();
|
|
2293
|
+
for (const candidate of candidates) {
|
|
2294
|
+
const escaped = normalizeCssClassSelector(replaceWxml(candidate, { escapeMap }));
|
|
2295
|
+
if (selectors.has(candidate) || selectors.has(escaped)) matched.add(candidate);
|
|
2296
|
+
}
|
|
2297
|
+
return matched;
|
|
2298
|
+
}
|
|
2299
|
+
//#endregion
|
|
2264
2300
|
//#region src/uni-app-x/options.ts
|
|
2265
2301
|
const DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS = {
|
|
2266
2302
|
enabled: true,
|
|
@@ -2300,6 +2336,9 @@ function isUniAppXEnabled(option) {
|
|
|
2300
2336
|
}
|
|
2301
2337
|
//#endregion
|
|
2302
2338
|
//#region src/context/style-options.ts
|
|
2339
|
+
function normalizeStyleHandlerMajorVersion(majorVersion) {
|
|
2340
|
+
return majorVersion === 4 ? 4 : void 0;
|
|
2341
|
+
}
|
|
2303
2342
|
function resolveStyleOptionsFromContext(ctx, tailwindcssMajorVersion) {
|
|
2304
2343
|
const resolvedUniAppXOptions = resolveUniAppXOptions(ctx.uniAppX);
|
|
2305
2344
|
const branch = resolveGeneratorRuntimeBranch(normalizeWeappTailwindcssGeneratorOptions(ctx.generator, {
|
|
@@ -2438,7 +2477,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
|
|
|
2438
2477
|
const hasApplyDirectives = hasTailwindApplyDirective(options.rawSource);
|
|
2439
2478
|
const sourceCss = cssHandlerOptions.sourceOptions?.sourceCss;
|
|
2440
2479
|
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;
|
|
2480
|
+
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
2481
|
}
|
|
2443
2482
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
2444
2483
|
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
@@ -2461,22 +2500,6 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
2461
2500
|
};
|
|
2462
2501
|
}
|
|
2463
2502
|
//#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
2503
|
//#region src/babel/index.ts
|
|
2481
2504
|
function _interopDefaultCompat(e) {
|
|
2482
2505
|
return e && typeof e === "object" && "default" in e ? e.default : e;
|
|
@@ -3752,7 +3775,7 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
3752
3775
|
_weapp_tailwindcss_postcss.postcss.parse(styleSource).walkAtRules("import", (rule) => {
|
|
3753
3776
|
const request = parseImportRequest(rule.params);
|
|
3754
3777
|
if (!isLocalStyleImportRequest(request)) return;
|
|
3755
|
-
const file = resolveLocalStyleImportFile(request, base);
|
|
3778
|
+
const file = request ? resolveLocalStyleImportFile(request, base) : void 0;
|
|
3756
3779
|
if (file) files.push(file);
|
|
3757
3780
|
});
|
|
3758
3781
|
} catch {}
|
|
@@ -5013,7 +5036,7 @@ function hasConfiguredContainerCompatSource(source) {
|
|
|
5013
5036
|
if (cssEntrySource?.config) try {
|
|
5014
5037
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(cssEntrySource.config, "utf8"))) return true;
|
|
5015
5038
|
} catch {}
|
|
5016
|
-
if ("config" in source && source.config) try {
|
|
5039
|
+
if ("config" in source && typeof source.config === "string") try {
|
|
5017
5040
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(source.config, "utf8"))) return true;
|
|
5018
5041
|
} catch {}
|
|
5019
5042
|
return false;
|
|
@@ -5320,6 +5343,11 @@ function isCssAlreadyRepresentedByMarkers(css, source) {
|
|
|
5320
5343
|
for (const marker of sourceMarkers) if (!cssMarkers.has(marker)) return false;
|
|
5321
5344
|
return true;
|
|
5322
5345
|
}
|
|
5346
|
+
function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
5347
|
+
const merged = new Set(classSet);
|
|
5348
|
+
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
5349
|
+
return merged;
|
|
5350
|
+
}
|
|
5323
5351
|
async function generateCssByGenerator(options) {
|
|
5324
5352
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
5325
5353
|
const generatorOptions = {
|
|
@@ -5346,8 +5374,10 @@ async function generateCssByGenerator(options) {
|
|
|
5346
5374
|
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
5347
5375
|
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
5348
5376
|
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
5349
|
-
const
|
|
5350
|
-
const
|
|
5377
|
+
const generatedUserCssOrderSource = hasTailwindGeneratedCss(userSource) ? splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
5378
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? createCssAppend(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : hasTailwindGeneratedCss(userSource) ? "" : userCssRawSource;
|
|
5379
|
+
const userCssOrderSource = GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : hasTailwindGeneratedCss(userSource) ? userSource : generatedUserCssRawSource;
|
|
5380
|
+
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
5351
5381
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
5352
5382
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
5353
5383
|
css: shouldUseMiniProgramCssBranch(generatorBranch) ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
@@ -5369,7 +5399,10 @@ async function generateCssByGenerator(options) {
|
|
|
5369
5399
|
hasGeneratedCss,
|
|
5370
5400
|
hasGeneratedMarkers,
|
|
5371
5401
|
hasSourceDirectives,
|
|
5372
|
-
rawSource: generatorRawSource
|
|
5402
|
+
rawSource: generatorRawSource,
|
|
5403
|
+
runtimeCandidateCount: runtime.size,
|
|
5404
|
+
target: generatorOptions.target,
|
|
5405
|
+
configuredCssSourceCount: options.cssSources?.length
|
|
5373
5406
|
})) return;
|
|
5374
5407
|
try {
|
|
5375
5408
|
await runtimeState.readyPromise;
|
|
@@ -5425,12 +5458,13 @@ async function generateCssByGenerator(options) {
|
|
|
5425
5458
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
5426
5459
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
5427
5460
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
5461
|
+
const finalCss = restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
5462
|
+
injectPreflight: false,
|
|
5463
|
+
styleOptions: generatorStyleOptions
|
|
5464
|
+
})) : options.previousCss, localImports);
|
|
5428
5465
|
return {
|
|
5429
|
-
css:
|
|
5430
|
-
|
|
5431
|
-
styleOptions: generatorStyleOptions
|
|
5432
|
-
})) : options.previousCss, localImports),
|
|
5433
|
-
classSet: generated.classSet,
|
|
5466
|
+
css: finalCss,
|
|
5467
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5434
5468
|
target: generated.target,
|
|
5435
5469
|
source: "generator",
|
|
5436
5470
|
dependencies: generated.dependencies,
|
|
@@ -5483,28 +5517,29 @@ async function generateCssByGenerator(options) {
|
|
|
5483
5517
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
5484
5518
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5485
5519
|
}
|
|
5486
|
-
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(
|
|
5487
|
-
const userCss = await transformGeneratorUserCss(
|
|
5488
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
5520
|
+
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
5521
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, userCssOptions);
|
|
5522
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
5489
5523
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5490
5524
|
}
|
|
5491
5525
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
5492
5526
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
5493
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
5494
|
-
css = await appendLegacyCompatCss(css,
|
|
5495
|
-
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css,
|
|
5527
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
5528
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5529
|
+
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5496
5530
|
}
|
|
5497
5531
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
5532
|
+
const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
|
|
5533
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5534
|
+
cssHandlerOptions,
|
|
5535
|
+
isolateCurrentCssCandidates,
|
|
5536
|
+
localImports
|
|
5537
|
+
}),
|
|
5538
|
+
styleOptions: generatorStyleOptions
|
|
5539
|
+
}), localImports);
|
|
5498
5540
|
return {
|
|
5499
|
-
css:
|
|
5500
|
-
|
|
5501
|
-
cssHandlerOptions,
|
|
5502
|
-
isolateCurrentCssCandidates,
|
|
5503
|
-
localImports
|
|
5504
|
-
}),
|
|
5505
|
-
styleOptions: generatorStyleOptions
|
|
5506
|
-
}), localImports),
|
|
5507
|
-
classSet: generated.classSet,
|
|
5541
|
+
css: finalCss,
|
|
5542
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5508
5543
|
target: generated.target,
|
|
5509
5544
|
source: "generator",
|
|
5510
5545
|
dependencies: generated.dependencies,
|
|
@@ -5517,7 +5552,7 @@ async function generateCssByGenerator(options) {
|
|
|
5517
5552
|
}
|
|
5518
5553
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
5519
5554
|
let css = generatedCss;
|
|
5520
|
-
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(
|
|
5555
|
+
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5521
5556
|
generatorTarget: generated.target,
|
|
5522
5557
|
generatorStyleOptions,
|
|
5523
5558
|
cssUserHandlerOptions,
|
|
@@ -5549,7 +5584,7 @@ async function generateCssByGenerator(options) {
|
|
|
5549
5584
|
}
|
|
5550
5585
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
5551
5586
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
5552
|
-
const userCss = await transformGeneratorUserCss(
|
|
5587
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5553
5588
|
generatorTarget: generated.target,
|
|
5554
5589
|
generatorStyleOptions,
|
|
5555
5590
|
cssUserHandlerOptions,
|
|
@@ -5557,9 +5592,9 @@ async function generateCssByGenerator(options) {
|
|
|
5557
5592
|
importFallback: generatorOptions.importFallback,
|
|
5558
5593
|
processed: userRawSourceProcessed
|
|
5559
5594
|
});
|
|
5560
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
5595
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
5561
5596
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5562
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers) {
|
|
5597
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
5563
5598
|
const userCss = await transformGeneratorUserCss(removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource), {
|
|
5564
5599
|
generatorTarget: generated.target,
|
|
5565
5600
|
generatorStyleOptions,
|
|
@@ -5570,8 +5605,8 @@ async function generateCssByGenerator(options) {
|
|
|
5570
5605
|
});
|
|
5571
5606
|
const missingUserCss = (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
5572
5607
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5573
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(
|
|
5574
|
-
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(
|
|
5608
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(generatedUserCssRawSource)) {
|
|
5609
|
+
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(generatedUserCssRawSource).layer, {
|
|
5575
5610
|
generatorTarget: generated.target,
|
|
5576
5611
|
generatorStyleOptions,
|
|
5577
5612
|
cssUserHandlerOptions,
|
|
@@ -5585,13 +5620,13 @@ async function generateCssByGenerator(options) {
|
|
|
5585
5620
|
}
|
|
5586
5621
|
}
|
|
5587
5622
|
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
5588
|
-
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed) css = await appendLegacyContainerCompatCss(css,
|
|
5623
|
+
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5589
5624
|
}
|
|
5590
5625
|
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
5591
5626
|
hasSourceDirectives,
|
|
5592
5627
|
hasMatchedCssSourceFile
|
|
5593
5628
|
})) {
|
|
5594
|
-
const userCss = await transformGeneratorUserCss(
|
|
5629
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5595
5630
|
generatorTarget: generated.target,
|
|
5596
5631
|
generatorStyleOptions,
|
|
5597
5632
|
cssUserHandlerOptions,
|
|
@@ -5602,16 +5637,17 @@ async function generateCssByGenerator(options) {
|
|
|
5602
5637
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
5603
5638
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5604
5639
|
}
|
|
5640
|
+
const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
|
|
5641
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5642
|
+
cssHandlerOptions,
|
|
5643
|
+
isolateCurrentCssCandidates,
|
|
5644
|
+
localImports
|
|
5645
|
+
}),
|
|
5646
|
+
styleOptions: generatorStyleOptions
|
|
5647
|
+
}), localImports);
|
|
5605
5648
|
return {
|
|
5606
|
-
css:
|
|
5607
|
-
|
|
5608
|
-
cssHandlerOptions,
|
|
5609
|
-
isolateCurrentCssCandidates,
|
|
5610
|
-
localImports
|
|
5611
|
-
}),
|
|
5612
|
-
styleOptions: generatorStyleOptions
|
|
5613
|
-
}), localImports),
|
|
5614
|
-
classSet: generated.classSet,
|
|
5649
|
+
css: finalCss,
|
|
5650
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5615
5651
|
target: generated.target,
|
|
5616
5652
|
source: "generator",
|
|
5617
5653
|
dependencies: generated.dependencies,
|
|
@@ -5622,12 +5658,12 @@ async function generateCssByGenerator(options) {
|
|
|
5622
5658
|
}
|
|
5623
5659
|
};
|
|
5624
5660
|
}
|
|
5625
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
5626
|
-
css = await appendLegacyCompatCss(css,
|
|
5627
|
-
css = await appendLegacyContainerCompatCss(css,
|
|
5661
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
5662
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5663
|
+
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
5628
5664
|
}
|
|
5629
|
-
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(
|
|
5630
|
-
const userCss = await transformGeneratorUserCss(
|
|
5665
|
+
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
5666
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
5631
5667
|
generatorTarget: generated.target,
|
|
5632
5668
|
generatorStyleOptions,
|
|
5633
5669
|
cssUserHandlerOptions,
|
|
@@ -5635,19 +5671,20 @@ async function generateCssByGenerator(options) {
|
|
|
5635
5671
|
importFallback: generatorOptions.importFallback,
|
|
5636
5672
|
processed: userRawSourceProcessed
|
|
5637
5673
|
});
|
|
5638
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
5674
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
5639
5675
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
5640
5676
|
}
|
|
5677
|
+
const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
|
|
5678
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
5679
|
+
cssHandlerOptions,
|
|
5680
|
+
isolateCurrentCssCandidates,
|
|
5681
|
+
localImports
|
|
5682
|
+
}),
|
|
5683
|
+
styleOptions: generatorStyleOptions
|
|
5684
|
+
}), localImports);
|
|
5641
5685
|
return {
|
|
5642
|
-
css:
|
|
5643
|
-
|
|
5644
|
-
cssHandlerOptions,
|
|
5645
|
-
isolateCurrentCssCandidates,
|
|
5646
|
-
localImports
|
|
5647
|
-
}),
|
|
5648
|
-
styleOptions: generatorStyleOptions
|
|
5649
|
-
}), localImports),
|
|
5650
|
-
classSet: generated.classSet,
|
|
5686
|
+
css: finalCss,
|
|
5687
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
5651
5688
|
target: generated.target,
|
|
5652
5689
|
source: "generator",
|
|
5653
5690
|
dependencies: generated.dependencies,
|
|
@@ -7181,7 +7218,7 @@ function createCssHandlerOptions(options, majorVersion, file, appType) {
|
|
|
7181
7218
|
return {
|
|
7182
7219
|
isMainChunk: options.mainCssChunkMatcher(file, appType),
|
|
7183
7220
|
postcssOptions: { options: { from: file } },
|
|
7184
|
-
...majorVersion === void 0 ? {} : { majorVersion }
|
|
7221
|
+
...normalizeStyleHandlerMajorVersion(majorVersion) === void 0 ? {} : { majorVersion: 4 }
|
|
7185
7222
|
};
|
|
7186
7223
|
}
|
|
7187
7224
|
async function resolveWebpackLoaderSourceCandidates(source, loaderContext, options) {
|
|
@@ -7193,7 +7230,7 @@ async function resolveWebpackLoaderSourceCandidates(source, loaderContext, optio
|
|
|
7193
7230
|
if (!resolved) return;
|
|
7194
7231
|
const collector = createSourceCandidateStore({ bareArbitraryValues: compilerOptions.arbitraryValues?.bareArbitraryValues });
|
|
7195
7232
|
collector.syncInline(resolved.inlineCandidates);
|
|
7196
|
-
const outDir = loaderContext.rootContext ? node_path.default.resolve(loaderContext.rootContext,
|
|
7233
|
+
const outDir = loaderContext.rootContext ? node_path.default.resolve(loaderContext.rootContext, "dist") : void 0;
|
|
7197
7234
|
const scanFiles = await resolveSourceCandidateScanFiles({
|
|
7198
7235
|
entries: resolved.entries,
|
|
7199
7236
|
explicit: resolved.explicit,
|