weapp-tailwindcss 5.1.6 → 5.1.8
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/framework-selector.d.ts +26 -0
- package/dist/bundlers/gulp/frameworks/native/index.d.ts +6 -0
- package/dist/bundlers/gulp/index.d.ts +4 -4
- package/dist/bundlers/gulp/shared/create-native-framework-plugins.d.ts +6 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/generic/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/taro/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/uni-app-x/index.d.ts +2 -0
- package/dist/bundlers/vite/frameworks/weapp-vite/index.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +8 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +2 -0
- package/dist/bundlers/vite/index.d.ts +2 -4
- package/dist/bundlers/vite/processed-css-assets.d.ts +5 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +35 -0
- package/dist/bundlers/vite/shared/framework-strategy.d.ts +88 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +1 -2
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -2
- package/dist/bundlers/webpack/frameworks/generic/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/index.d.ts +8 -0
- package/dist/bundlers/webpack/frameworks/mpx/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/taro/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/uni-app/index.d.ts +5 -0
- package/dist/bundlers/webpack/frameworks/weapp-vite/index.d.ts +5 -0
- package/dist/bundlers/webpack/shared/create-framework-plugin.d.ts +21 -0
- package/dist/bundlers/webpack/shared/loader-anchors.d.ts +4 -3
- package/dist/cli.js +8 -0
- package/dist/cli.mjs +8 -0
- package/dist/{context-BCSk_YnL.js → context-CRhUs_5e.js} +13 -4
- package/dist/{context-3GGqW9vw.mjs → context-CfXr3hWz.mjs} +13 -4
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-CqWzj2Z1.js → generator-DaaFxR5V.js} +1 -1
- package/dist/{generator-CoT5vu9w.mjs → generator-DugIHBgl.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-Bss4wJ8t.mjs → gulp-CRjkPsbX.mjs} +22 -7
- package/dist/{gulp-hXE1U4Cu.js → gulp-JUfnhOOo.js} +22 -7
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-Cfu-4Bnf.mjs → hmr-timing-BecOXMd8.mjs} +13 -7
- package/dist/{hmr-timing-Df4203aI.js → hmr-timing-DcIEXnf8.js} +13 -7
- 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/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/{source-candidate-scan-signature-5Uk6U72B.js → source-candidate-scan-signature-10tvdJVC.js} +185 -98
- package/dist/{source-candidate-scan-signature-BbCmW975.mjs → source-candidate-scan-signature-DAg8QSgh.mjs} +162 -99
- package/dist/style-injector/internal.d.ts +18 -4
- package/dist/{tailwindcss-DYJ3HZD2.js → tailwindcss-BZjZZi60.js} +1 -1
- package/dist/{tailwindcss-Bjr3aphG.mjs → tailwindcss-PA2jHHpx.mjs} +1 -1
- package/dist/{transform-B6_y_yCB.js → transform-B0BxX3XB.js} +1 -1
- package/dist/{transform--155BmeJ.mjs → transform-wNEbcZeQ.mjs} +1 -1
- package/dist/uni-app-x/vite.d.ts +1 -0
- package/dist/uni-app-x/web-preflight-reset.d.ts +3 -0
- package/dist/{v4-engine-C9cmNlP8.js → v4-engine-BZP2462H.js} +44 -1
- package/dist/{v4-engine-DRQaCFMm.mjs → v4-engine-CjjWONB0.mjs} +45 -2
- package/dist/{vite-Baw9qNrc.js → vite-GdzlG_lx.js} +1332 -790
- package/dist/{vite-PdxjaqhO.mjs → vite-vf2-cDdk.mjs} +1330 -788
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +162 -7
- package/dist/{webpack-BffTDmod.mjs → webpack-2s-TFhgm.mjs} +583 -238
- package/dist/{webpack-C9u7mfGE.js → webpack-BhM4Hqla.js} +582 -237
- 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-GdzlG_lx.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-vf2-cDdk.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -60,9 +60,13 @@ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
|
|
|
60
60
|
}
|
|
61
61
|
//#endregion
|
|
62
62
|
//#region src/bundlers/shared/generated-css-marker.ts
|
|
63
|
+
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
63
64
|
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
64
65
|
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
65
66
|
}
|
|
67
|
+
function stripBundlerGeneratedCssMarkers(source) {
|
|
68
|
+
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "");
|
|
69
|
+
}
|
|
66
70
|
//#endregion
|
|
67
71
|
//#region src/bundlers/shared/generator-css/markers.ts
|
|
68
72
|
const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
|
|
@@ -1406,6 +1410,18 @@ const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
|
|
|
1406
1410
|
"**/*.scss",
|
|
1407
1411
|
"**/*.styl",
|
|
1408
1412
|
"**/*.log",
|
|
1413
|
+
"**/tailwind.config.js",
|
|
1414
|
+
"**/tailwind.config.cjs",
|
|
1415
|
+
"**/tailwind.config.mjs",
|
|
1416
|
+
"**/tailwind.config.ts",
|
|
1417
|
+
"**/tailwind.config.cts",
|
|
1418
|
+
"**/tailwind.config.mts",
|
|
1419
|
+
"**/tailwind.config.*.js",
|
|
1420
|
+
"**/tailwind.config.*.cjs",
|
|
1421
|
+
"**/tailwind.config.*.mjs",
|
|
1422
|
+
"**/tailwind.config.*.ts",
|
|
1423
|
+
"**/tailwind.config.*.cts",
|
|
1424
|
+
"**/tailwind.config.*.mts",
|
|
1409
1425
|
"**/package-lock.json",
|
|
1410
1426
|
"**/pnpm-lock.yaml",
|
|
1411
1427
|
"**/bun.lockb",
|
|
@@ -2150,6 +2166,34 @@ function unwrapMiniProgramCascadeLayers(source) {
|
|
|
2150
2166
|
return source;
|
|
2151
2167
|
}
|
|
2152
2168
|
}
|
|
2169
|
+
function hasClassSelector$1(selector) {
|
|
2170
|
+
return /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i.test(selector);
|
|
2171
|
+
}
|
|
2172
|
+
function collectBareSelectorUserCss(source) {
|
|
2173
|
+
try {
|
|
2174
|
+
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
2175
|
+
let changed = false;
|
|
2176
|
+
root.walkAtRules("import", (rule) => {
|
|
2177
|
+
rule.remove();
|
|
2178
|
+
changed = true;
|
|
2179
|
+
});
|
|
2180
|
+
root.walkRules((rule) => {
|
|
2181
|
+
if ((rule.selectors?.length ? rule.selectors : [rule.selector]).some((selector) => hasClassSelector$1(selector))) {
|
|
2182
|
+
rule.remove();
|
|
2183
|
+
changed = true;
|
|
2184
|
+
}
|
|
2185
|
+
});
|
|
2186
|
+
root.walkAtRules((rule) => {
|
|
2187
|
+
if (rule.nodes !== void 0 && rule.nodes.length === 0) {
|
|
2188
|
+
rule.remove();
|
|
2189
|
+
changed = true;
|
|
2190
|
+
}
|
|
2191
|
+
});
|
|
2192
|
+
return changed ? root.toString() : source;
|
|
2193
|
+
} catch {
|
|
2194
|
+
return "";
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2153
2197
|
function stripTailwindSourceMediaFragments(source) {
|
|
2154
2198
|
let removedSourceMediaStart = false;
|
|
2155
2199
|
return terminateTailwindSourceAtRulesBeforeNextDirective(removeTailwindSourceMediaBlocks(source)).split(/\r?\n/).filter((line) => {
|
|
@@ -2354,7 +2398,10 @@ async function transformGeneratorUserCss(source, options) {
|
|
|
2354
2398
|
...options.generatorStyleOptions,
|
|
2355
2399
|
...options.cssUserHandlerOptions
|
|
2356
2400
|
});
|
|
2357
|
-
|
|
2401
|
+
const transformedCss = removeTailwindV4GeneratedUserCssArtifacts((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(css));
|
|
2402
|
+
const bareSelectorUserCss = collectBareSelectorUserCss(userSource);
|
|
2403
|
+
const missingBareSelectorUserCss = bareSelectorUserCss.trim().length > 0 ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(transformedCss, bareSelectorUserCss) : "";
|
|
2404
|
+
return missingBareSelectorUserCss.trim().length > 0 ? `${transformedCss}\n${missingBareSelectorUserCss}` : transformedCss;
|
|
2358
2405
|
}
|
|
2359
2406
|
//#endregion
|
|
2360
2407
|
//#region src/tailwindcss/runtime-options.ts
|
|
@@ -2972,7 +3019,7 @@ function isVueScopedStyleSource(from) {
|
|
|
2972
3019
|
const queryIndex = from.indexOf("?");
|
|
2973
3020
|
if (queryIndex === -1) return false;
|
|
2974
3021
|
const query = from.slice(queryIndex + 1);
|
|
2975
|
-
return /(?:^|&)type=style(?:&|$)/.test(query) && /(?:^|&)scoped(?:=
|
|
3022
|
+
return /(?:^|&)type=style(?:&|$)/.test(query) && /(?:^|&)scoped(?:=[^&]*)?(?:&|$)/.test(query);
|
|
2976
3023
|
}
|
|
2977
3024
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
2978
3025
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
@@ -3194,6 +3241,13 @@ let lastEscapedCandidateCacheStore;
|
|
|
3194
3241
|
function isUrlLikeCandidate(candidate) {
|
|
3195
3242
|
return candidate.startsWith("//") || candidate.startsWith("http://") || candidate.startsWith("https://");
|
|
3196
3243
|
}
|
|
3244
|
+
function isPlainSlashPathCandidate(candidate) {
|
|
3245
|
+
const slashIndex = candidate.indexOf("/");
|
|
3246
|
+
if (slashIndex <= 0) return false;
|
|
3247
|
+
if (isUrlLikeCandidate(candidate)) return true;
|
|
3248
|
+
if (candidate.includes("[") || candidate.includes("]") || candidate.includes(":")) return false;
|
|
3249
|
+
return !candidate.slice(0, slashIndex).includes("-");
|
|
3250
|
+
}
|
|
3197
3251
|
function isArbitraryValueCandidate(candidate) {
|
|
3198
3252
|
let hasOpenBracket = false;
|
|
3199
3253
|
let hasCloseBracket = false;
|
|
@@ -3249,6 +3303,7 @@ function getEscapedCandidate(candidate, escapeMap, store = getEscapedCandidateCa
|
|
|
3249
3303
|
function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNameSet, escapeMap, jsArbitraryValueFallback, jsPreserveClass, tailwindcssMajorVersion, classContext }) {
|
|
3250
3304
|
if (alwaysEscape) return DIRECT_RESULT;
|
|
3251
3305
|
if (jsPreserveClass?.(candidate)) return SKIP_RESULT;
|
|
3306
|
+
if (!classContext && isPlainSlashPathCandidate(candidate)) return SKIP_RESULT;
|
|
3252
3307
|
if (classNameSet?.has(candidate)) return DIRECT_RESULT;
|
|
3253
3308
|
if (classNameSet && classNameSet.size > 0) {
|
|
3254
3309
|
const escapedCandidate = getEscapedCandidate(candidate, escapeMap);
|
|
@@ -5450,6 +5505,12 @@ function intersectCandidateSets(left, right) {
|
|
|
5450
5505
|
for (const candidate of small) if (large.has(candidate)) matched.add(candidate);
|
|
5451
5506
|
return matched;
|
|
5452
5507
|
}
|
|
5508
|
+
function resolveScopedRuntimeCandidates(sourceCandidates, sourceScopedRuntime) {
|
|
5509
|
+
if (!sourceCandidates) return sourceScopedRuntime;
|
|
5510
|
+
if (!sourceScopedRuntime) return sourceCandidates;
|
|
5511
|
+
if (sourceCandidates.size === 0) return sourceScopedRuntime;
|
|
5512
|
+
return intersectCandidateSets(sourceCandidates, sourceScopedRuntime);
|
|
5513
|
+
}
|
|
5453
5514
|
function parseCssSourceRoot(rawSource) {
|
|
5454
5515
|
try {
|
|
5455
5516
|
return _weapp_tailwindcss_postcss.postcss.parse(rawSource);
|
|
@@ -5582,7 +5643,7 @@ async function generateCssByGenerator(options) {
|
|
|
5582
5643
|
const generator = createWeappTailwindcssGenerator(source);
|
|
5583
5644
|
const sourceEntries = getSourceCandidatesForEntries ? await resolveGeneratorSourceEntries(source, runtimeState) : void 0;
|
|
5584
5645
|
const sourceScopedRuntime = sourceEntries && sourceEntries.length > 0 ? getSourceCandidatesForEntries?.(sourceEntries) : void 0;
|
|
5585
|
-
const scopedRuntime =
|
|
5646
|
+
const scopedRuntime = resolveScopedRuntimeCandidates(options.sourceCandidates, sourceScopedRuntime);
|
|
5586
5647
|
const isolateCssSource = shouldIsolateScopedCssSource(majorVersion, source, sourceEntries, {
|
|
5587
5648
|
cssHandlerOptions,
|
|
5588
5649
|
target: generatorOptions.target
|
|
@@ -5672,7 +5733,7 @@ async function generateCssByGenerator(options) {
|
|
|
5672
5733
|
const beforeUserCss = await transformGeneratorUserCss(orderedExtraCss.before, userCssOptions);
|
|
5673
5734
|
const afterLayerUserCss = await transformGeneratorUserCss(afterLayerParts.layer, userCssOptions);
|
|
5674
5735
|
const afterUserCss = await transformGeneratorUserCss(afterLayerParts.rest, userCssOptions);
|
|
5675
|
-
const fallbackLayerUserCss = generated.target === "weapp" &&
|
|
5736
|
+
const fallbackLayerUserCss = generated.target === "weapp" && hasUserCssLayerBlocks(userCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(afterLayerUserCss, await transformGeneratorUserCss(splitUserCssLayerBlocks(userCssRawSource).layer, userCssOptions)) : "";
|
|
5676
5737
|
css = createCssSourceOrderAppend$1(createCssSourceOrderAppend$1(createCssSourceOrderAppend$1(beforeUserCss, generated.target === "weapp" ? wrapUserLayerComponentsCss(createCssSourceOrderAppend$1(afterLayerUserCss, fallbackLayerUserCss)) : afterLayerUserCss), css), afterUserCss);
|
|
5677
5738
|
if (isEmptyCssSourceOrderParts(orderedExtraCss) && shouldAppendWebBundleCssFallback(generated.target, {
|
|
5678
5739
|
hasSourceDirectives,
|
|
@@ -7342,6 +7403,92 @@ function createSourceCandidateStore(options = {}) {
|
|
|
7342
7403
|
}
|
|
7343
7404
|
}
|
|
7344
7405
|
//#endregion
|
|
7406
|
+
//#region src/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.ts
|
|
7407
|
+
function removeTailwindV4StandaloneHostPreflightRule(source) {
|
|
7408
|
+
if (!source.includes("--theme(")) return source;
|
|
7409
|
+
try {
|
|
7410
|
+
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
7411
|
+
let changed = false;
|
|
7412
|
+
root.walkRules((rule) => {
|
|
7413
|
+
if (rule.selector.trim() !== ":host") return;
|
|
7414
|
+
if (!rule.nodes?.some((node) => node.type === "decl" && node.value?.includes("--theme("))) return;
|
|
7415
|
+
rule.remove();
|
|
7416
|
+
changed = true;
|
|
7417
|
+
});
|
|
7418
|
+
return changed ? root.toString() : source;
|
|
7419
|
+
} catch {
|
|
7420
|
+
return source;
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7423
|
+
function stripTrailingLineWhitespace(source) {
|
|
7424
|
+
return source.replace(/[ \t]+$/gm, "");
|
|
7425
|
+
}
|
|
7426
|
+
function hasWebpackClassSelector(selector) {
|
|
7427
|
+
return /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i.test(selector);
|
|
7428
|
+
}
|
|
7429
|
+
function isWebpackKeyframesRule(rule) {
|
|
7430
|
+
let parent = rule.parent;
|
|
7431
|
+
while (parent) {
|
|
7432
|
+
if (parent.type === "atrule" && parent.name.endsWith("keyframes")) return true;
|
|
7433
|
+
parent = parent.parent;
|
|
7434
|
+
}
|
|
7435
|
+
return false;
|
|
7436
|
+
}
|
|
7437
|
+
function collectWebpackBareSelectorUserCss(source) {
|
|
7438
|
+
try {
|
|
7439
|
+
const root = _weapp_tailwindcss_postcss.postcss.parse(removeTailwindSourceDirectives(stripTailwindSourceMediaFragments(removeTailwindV4GeneratorAtRules(source)), { importFallback: true }));
|
|
7440
|
+
let changed = false;
|
|
7441
|
+
root.walkAtRules((rule) => {
|
|
7442
|
+
if (rule.name === "import" || rule.name === "font-face" || rule.name.endsWith("keyframes")) {
|
|
7443
|
+
rule.remove();
|
|
7444
|
+
changed = true;
|
|
7445
|
+
}
|
|
7446
|
+
});
|
|
7447
|
+
root.walkRules((rule) => {
|
|
7448
|
+
if (isWebpackKeyframesRule(rule) || rule.selectors.some((selector) => hasWebpackClassSelector(selector))) {
|
|
7449
|
+
rule.remove();
|
|
7450
|
+
changed = true;
|
|
7451
|
+
}
|
|
7452
|
+
});
|
|
7453
|
+
root.walkAtRules((rule) => {
|
|
7454
|
+
if (rule.nodes !== void 0 && rule.nodes.length === 0) {
|
|
7455
|
+
rule.remove();
|
|
7456
|
+
changed = true;
|
|
7457
|
+
}
|
|
7458
|
+
});
|
|
7459
|
+
return changed ? root.toString() : source;
|
|
7460
|
+
} catch {
|
|
7461
|
+
return "";
|
|
7462
|
+
}
|
|
7463
|
+
}
|
|
7464
|
+
function finalizeMiniProgramUserCssAssetSource(source, compilerOptions, isWebGeneratorTarget, options = {}) {
|
|
7465
|
+
const styleOptions = resolveStyleOptionsFromContext(compilerOptions);
|
|
7466
|
+
if (isWebGeneratorTarget) return source;
|
|
7467
|
+
return (0, _weapp_tailwindcss_postcss.stripMiniProgramCssSpecificityPlaceholders)(removeTailwindV4StandaloneHostPreflightRule((0, _weapp_tailwindcss_postcss.finalizeMiniProgramCss)(removeMiniProgramHoverSelectors(source, styleOptions.cssRemoveHoverPseudoClass), {
|
|
7468
|
+
cssPreflight: options.cssPreflight === false ? false : !hasMiniProgramTailwindV4PreflightReset(source) ? compilerOptions.cssPreflight : void 0,
|
|
7469
|
+
isTailwindcssV4: true,
|
|
7470
|
+
tailwindcssV4GradientFallback: styleOptions.tailwindcssV4GradientFallback
|
|
7471
|
+
})));
|
|
7472
|
+
}
|
|
7473
|
+
function finalizeWebpackCssAssetSource(source, compilerOptions, isWebGeneratorTarget, options = {}) {
|
|
7474
|
+
const styleOptions = resolveStyleOptionsFromContext(compilerOptions);
|
|
7475
|
+
if (isWebGeneratorTarget) {
|
|
7476
|
+
if (options.generatedCss === true) return stripTrailingLineWhitespace(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(stripBundlerGeneratedCssMarkers(source))));
|
|
7477
|
+
return stripTrailingLineWhitespace(stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(removeTailwindV4GeneratorAtRules(removeTailwindSourceDirectives(stripBundlerGeneratedCssMarkers(source), { importFallback: true })))));
|
|
7478
|
+
}
|
|
7479
|
+
let finalized = removeTailwindSourceDirectives(stripBundlerGeneratedCssMarkers(source), { importFallback: true });
|
|
7480
|
+
if (options.generatedCss !== true) return (0, _weapp_tailwindcss_postcss.stripMiniProgramCssSpecificityPlaceholders)(removeMiniProgramHoverSelectors(finalized, styleOptions.cssRemoveHoverPseudoClass));
|
|
7481
|
+
try {
|
|
7482
|
+
finalized = (0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(finalized, { preservePreflight: options.cssPreflight !== false });
|
|
7483
|
+
} catch {}
|
|
7484
|
+
finalized = (0, _weapp_tailwindcss_postcss.finalizeMiniProgramCss)(finalized, {
|
|
7485
|
+
cssPreflight: options.cssPreflight === false ? false : !hasMiniProgramTailwindV4PreflightReset(finalized) ? compilerOptions.cssPreflight : void 0,
|
|
7486
|
+
isTailwindcssV4: true,
|
|
7487
|
+
tailwindcssV4GradientFallback: styleOptions.tailwindcssV4GradientFallback
|
|
7488
|
+
});
|
|
7489
|
+
return (0, _weapp_tailwindcss_postcss.stripMiniProgramCssSpecificityPlaceholders)(removeMiniProgramHoverSelectors(finalized, styleOptions.cssRemoveHoverPseudoClass));
|
|
7490
|
+
}
|
|
7491
|
+
//#endregion
|
|
7345
7492
|
//#region src/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.ts
|
|
7346
7493
|
function resolveLoaderOptions(options) {
|
|
7347
7494
|
const runtime = require_watch_dependencies.getWebpackLoaderRuntime(options?.tailwindcssImportRewriteRuntimeKey)?.cssImportRewrite;
|
|
@@ -7447,14 +7594,22 @@ async function generateCssForWebpackPipeline(source, loaderContext, options) {
|
|
|
7447
7594
|
});
|
|
7448
7595
|
if (!generated) return;
|
|
7449
7596
|
rewriteOptions.markGeneratedCssSource?.(file);
|
|
7597
|
+
for (const dependency of generated.dependencies) require_watch_dependencies.registerWebpackWatchFile(loaderContext, dependency);
|
|
7598
|
+
const generatedCss = removeTailwindSourceDirectives(generated.css, { importFallback: true });
|
|
7599
|
+
const finalizedGeneratedCss = finalizeWebpackCssAssetSource(generatedCss, compilerOptions, generatorTarget === "web", {
|
|
7600
|
+
cssPreflight: cssHandlerOptions.isMainChunk,
|
|
7601
|
+
generatedCss: true
|
|
7602
|
+
});
|
|
7603
|
+
const bareUserCss = generatorTarget === "web" ? "" : collectWebpackBareSelectorUserCss(normalizedSource);
|
|
7604
|
+
const finalizedBareUserCss = bareUserCss.trim().length === 0 ? "" : finalizeMiniProgramUserCssAssetSource(bareUserCss, compilerOptions, generatorTarget === "web", { cssPreflight: false });
|
|
7605
|
+
const missingBareUserCss = finalizedBareUserCss.trim().length === 0 ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(finalizedGeneratedCss, finalizedBareUserCss);
|
|
7606
|
+
const css = missingBareUserCss.trim().length === 0 ? generatedCss : `${generatedCss}\n${missingBareUserCss}`;
|
|
7450
7607
|
rewriteOptions.registerGeneratedCss?.({
|
|
7451
7608
|
classSet: generated.classSet,
|
|
7452
|
-
css
|
|
7609
|
+
css,
|
|
7453
7610
|
dependencies: generated.dependencies,
|
|
7454
7611
|
file
|
|
7455
7612
|
});
|
|
7456
|
-
for (const dependency of generated.dependencies) require_watch_dependencies.registerWebpackWatchFile(loaderContext, dependency);
|
|
7457
|
-
const css = removeTailwindSourceDirectives(generated.css, { importFallback: true });
|
|
7458
7613
|
return `${createBundlerGeneratedCssMarker("webpack", file)}\n${css}`;
|
|
7459
7614
|
}
|
|
7460
7615
|
function transformCssImportRewriteSource(source, options) {
|