weapp-tailwindcss 5.5.4 → 5.5.6
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/gulp/shared/create-native-framework-plugins/file-transforms.d.ts +5 -4
- package/dist/bundlers/shared/final-css-cleanup.d.ts +1 -2
- package/dist/bundlers/shared/framework-css-composition.d.ts +1 -0
- package/dist/bundlers/shared/framework-postcss.d.ts +2 -1
- package/dist/bundlers/shared/framework-user-css.d.ts +1 -0
- package/dist/bundlers/shared/generated-css-marker.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/generation-helpers/results.d.ts +5 -7
- package/dist/bundlers/shared/generator-css/legacy-compat.d.ts +4 -1
- package/dist/bundlers/shared/generator-css/legacy-selectors.d.ts +1 -4
- package/dist/bundlers/shared/generator-css/legacy-units.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/pipeline/context.d.ts +4 -2
- package/dist/bundlers/shared/generator-css/source-resolver/apply-reference.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/types.d.ts +6 -3
- package/dist/bundlers/shared/generator-css/user-css/apply-only.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/user-css/compile-functions.d.ts +4 -0
- package/dist/bundlers/shared/generator-css/user-css/generated-cleanup.d.ts +3 -1
- package/dist/bundlers/shared/generator-css/user-css/source-fragments.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/user-css/transform.d.ts +3 -0
- package/dist/bundlers/shared/style-handler-options.d.ts +7 -0
- package/dist/bundlers/shared/v4-generation-core.d.ts +0 -1
- package/dist/bundlers/vite/css-finalizer/css-calc.d.ts +3 -0
- package/dist/bundlers/vite/css-finalizer/final-assets.d.ts +3 -0
- package/dist/bundlers/vite/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/frameworks/generic/web.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/css-transform-decision-plan.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/finalize/sync-processed-css.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/framework-style-memory.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/js-handler-options.d.ts +7 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/rollup-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/runtime.d.ts +3 -1
- package/dist/bundlers/vite/generate-bundle/sfc-style-source.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +2 -2
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/web-css-module.d.ts +1 -0
- package/dist/bundlers/vite/plugin-hook.d.ts +3 -0
- package/dist/bundlers/vite/processed-css-assets/coverage.d.ts +3 -1
- package/dist/bundlers/vite/processed-css-assets/markers-imports.d.ts +1 -1
- package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +1 -1
- package/dist/bundlers/vite/shared/create-framework-plugins-runtime.d.ts +3 -1
- package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +2 -1
- package/dist/bundlers/vite/shared/framework-runtime-configuration.d.ts +3 -0
- package/dist/bundlers/vite/shared/framework-runtime-options.d.ts +9 -0
- package/dist/bundlers/vite/shared/framework-runtime-utils.d.ts +6 -5
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +3 -3
- package/dist/bundlers/vite/shared/framework-strategy.d.ts +3 -1
- package/dist/bundlers/vite/shared/hmr-source.d.ts +2 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/processed-css-task.d.ts +2 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/bundlers/webpack/shared/create-framework-plugin/plugin.d.ts +1 -1
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/semantic-css.d.ts +1 -1
- package/dist/compiler/types.d.ts +1 -1
- package/dist/{compiler-DFROuh5Z.cjs → compiler-C8FqI-P3.cjs} +1060 -1163
- package/dist/{compiler-CJ5yX-on.js → compiler-D3GBwxoa.js} +32 -23
- package/dist/core/compiler/transforms.d.ts +1 -1
- package/dist/core.cjs +4 -4
- package/dist/core.js +4 -4
- package/dist/{css-imports-_5cwJnx-.cjs → css-imports-XvtI1zCY.cjs} +2 -3
- package/dist/css-macro.cjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/{defaults-CKx-4LcW.js → defaults-AQuvJS-h.js} +4 -2
- package/dist/{defaults-CiGsr8Xq.cjs → defaults-CyX5iO9y.cjs} +4 -2
- package/dist/defaults.cjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/final-css-cleanup-CDTmVAye.cjs +1 -0
- package/dist/{final-css-cleanup-B0HUBtiE.js → final-css-cleanup-u_sI2p56.js} +1 -126
- package/dist/framework/index.d.ts +1 -1
- package/dist/framework/platform.d.ts +2 -2
- package/dist/{generator-RK2HtgOb.cjs → generator-Bvr4WmuF.cjs} +150 -150
- package/dist/{generator-BgbYHNgD.js → generator-C0BJjyLM.js} +131 -131
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-BS7fTmyj.cjs → gulp-BExe5RBF.cjs} +8 -8
- package/dist/{gulp-nl-2p5Dw.js → gulp-BhkIIk7J.js} +5 -5
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-BfxWwMeT.js → hmr-timing-B9Yt86-U.js} +299 -404
- package/dist/{hmr-timing-D45cTIzM.cjs → hmr-timing-CoiJIqDu.cjs} +4 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/js/NodePathWalker.d.ts +1 -1
- package/dist/js/node-path-walker/export-handlers.d.ts +1 -1
- package/dist/js/node-path-walker/import-tokens.d.ts +1 -1
- package/dist/{pipeline-helpers-BEhISt4D.cjs → pipeline-helpers-BOjTEmMi.cjs} +6 -6
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/rspack.cjs +2 -2
- package/dist/rspack.js +2 -2
- package/dist/{scoped-generator-Dqq2iLky.js → scoped-generator-B6Y1bxzM.js} +46 -31
- package/dist/{scoped-generator-DccPwmJT.cjs → scoped-generator-BUBls_oM.cjs} +46 -31
- package/dist/{source-candidate-scan-signature-CnUlGWhP.cjs → source-candidate-scan-signature-BtJZp28T.cjs} +32 -3
- package/dist/{source-candidate-scan-signature-BJkQJtRM.js → source-candidate-scan-signature-DNuGKTqf.js} +21 -4
- package/dist/style-injector/internal.d.ts +118 -8
- package/dist/style-injector/options.d.ts +5 -1
- package/dist/tailwindcss/runtime-options.d.ts +5 -0
- package/dist/tailwindcss/v4/preflight.d.ts +0 -1
- package/dist/tailwindcss/v4-engine/generator/incremental-cache.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/generator/style-context.d.ts +4 -0
- package/dist/{tailwindcss-o3Xe-o7M.js → tailwindcss-B_4E52WF.js} +7 -13
- package/dist/{tailwindcss-B03BGeTO.cjs → tailwindcss-CBYjzRmV.cjs} +4 -10
- package/dist/{transform-BVH7iLHn.js → transform-CkEnJYIP.js} +18 -12
- package/dist/{transform-MIhriZRr.cjs → transform-FkqbTBJR.cjs} +17 -11
- package/dist/types/index.d.ts +3 -2
- package/dist/uni-app-x/border-preflight.d.ts +1 -2
- package/dist/uni-app-x/component-local-style.d.ts +2 -1
- package/dist/uni-app-x/transform.d.ts +4 -2
- package/dist/uni-app-x/vite/author-apply.d.ts +3 -1
- package/dist/uni-app-x/vite/native-hmr.d.ts +1 -1
- package/dist/uni-app-x/vite/style-result.d.ts +5 -0
- package/dist/{v4-generation-core-BvW2aK23.cjs → v4-generation-core-Cz1D7wm1.cjs} +313 -418
- package/dist/vite/web.cjs +1 -1
- package/dist/vite/web.js +1 -1
- package/dist/{vite-4RznbXVI.cjs → vite-DxuKPZlp.cjs} +565 -592
- package/dist/{vite-hGECCqfq.js → vite-lP35OguX.js} +558 -578
- package/dist/vite-web.d.ts +1 -1
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +2 -2
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +7 -7
- package/dist/{web-0FAisq6H.js → web-Dfz_jpNj.js} +144 -107
- package/dist/{web-DQZ27KWH.cjs → web-DhDxhlkq.cjs} +156 -107
- package/dist/{webpack-8cQlXIo4.js → webpack-D6jp1o3m.js} +18 -17
- package/dist/{webpack-DOQ_3ViW.cjs → webpack-R2Sbggiy.cjs} +20 -20
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -2
- package/dist/wxml/utils/custom-template.d.ts +1 -1
- package/package.json +9 -11
- package/dist/final-css-cleanup-DSjczga3.cjs +0 -138
- package/dist/tailwindcss/v4-engine/css-import.d.ts +0 -14
- package/dist/uni-app-x/style-asset/source-parser.d.ts +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-Bvr4WmuF.cjs");
|
|
3
3
|
require("./auto-DtU6f3X6.cjs");
|
|
4
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
-
const require_compiler = require("./compiler-
|
|
4
|
+
const require_tailwindcss = require("./tailwindcss-CBYjzRmV.cjs");
|
|
5
|
+
const require_compiler = require("./compiler-C8FqI-P3.cjs");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -1165,15 +1165,19 @@ function annotateCssSourceTrace(css, options) {
|
|
|
1165
1165
|
const BUNDLER_GENERATED_CSS_MARKER_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/i;
|
|
1166
1166
|
const BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css(?:\s*:\s*[^\s*]+)?\s*\*\/\s*/gi;
|
|
1167
1167
|
const BUNDLER_GENERATED_CSS_MARKER_CAPTURE_RE = /\/\*!?\s*weapp-tailwindcss (gulp|vite|webpack)-generated-css(?:\s*:\s*([^\s*]+))?\s*\*\/\s*/gi;
|
|
1168
|
+
const BUNDLER_GENERATED_CSS_END_MARKER_GLOBAL_RE = /\/\*!?\s*weapp-tailwindcss (?:gulp|vite|webpack)-generated-css-end\s*:\s*[^\s*]+\s*\*\/\s*/gi;
|
|
1168
1169
|
const VITE_INTERNAL_CSS_MARKER_GLOBAL_RE = /\/\*\$vite\$:\d+\*\/\s*/g;
|
|
1169
1170
|
function createBundlerGeneratedCssMarker(bundler, file) {
|
|
1170
1171
|
return `/*! weapp-tailwindcss ${bundler}-generated-css:${encodeURIComponent(file)} */`;
|
|
1171
1172
|
}
|
|
1173
|
+
function createBundlerGeneratedCssEndMarker(bundler, file) {
|
|
1174
|
+
return `/*! weapp-tailwindcss ${bundler}-generated-css-end:${encodeURIComponent(file)} */`;
|
|
1175
|
+
}
|
|
1172
1176
|
function hasBundlerGeneratedCssMarker(source) {
|
|
1173
1177
|
return typeof source === "string" && BUNDLER_GENERATED_CSS_MARKER_RE.test(source);
|
|
1174
1178
|
}
|
|
1175
1179
|
function stripBundlerGeneratedCssMarkers(source) {
|
|
1176
|
-
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
|
|
1180
|
+
return source.replace(BUNDLER_GENERATED_CSS_MARKER_GLOBAL_RE, "").replace(BUNDLER_GENERATED_CSS_END_MARKER_GLOBAL_RE, "").replace(VITE_INTERNAL_CSS_MARKER_GLOBAL_RE, "");
|
|
1177
1181
|
}
|
|
1178
1182
|
function parseBundlerGeneratedCssMarkerBlocks(source) {
|
|
1179
1183
|
const blocks = [];
|
|
@@ -1341,21 +1345,21 @@ function createCssSourceOrderAppend(base, extra) {
|
|
|
1341
1345
|
if (/\s$/.test(base) || /^\s/.test(extra)) return `${base}${extra}`;
|
|
1342
1346
|
return `${base}\n${extra}`;
|
|
1343
1347
|
}
|
|
1344
|
-
const LEGACY_PSEUDO_ELEMENTS
|
|
1348
|
+
const LEGACY_PSEUDO_ELEMENTS = [
|
|
1345
1349
|
"before",
|
|
1346
1350
|
"after",
|
|
1347
1351
|
"first-letter",
|
|
1348
1352
|
"first-line"
|
|
1349
1353
|
];
|
|
1350
1354
|
const CSS_STRING_LITERAL_RE = /(["'])((?:\\[\s\S]|(?!\1)[\s\S])*)\1/g;
|
|
1351
|
-
function isLegacyPseudoElementAt
|
|
1352
|
-
for (const name of LEGACY_PSEUDO_ELEMENTS
|
|
1355
|
+
function isLegacyPseudoElementAt(selector, index) {
|
|
1356
|
+
for (const name of LEGACY_PSEUDO_ELEMENTS) {
|
|
1353
1357
|
if (!selector.startsWith(name, index)) continue;
|
|
1354
1358
|
const next = selector[index + name.length];
|
|
1355
1359
|
if (next === void 0 || !/[\w-]/.test(next)) return name;
|
|
1356
1360
|
}
|
|
1357
1361
|
}
|
|
1358
|
-
function normalizeLegacyPseudoElements
|
|
1362
|
+
function normalizeLegacyPseudoElements(selector) {
|
|
1359
1363
|
let result = "";
|
|
1360
1364
|
let quote;
|
|
1361
1365
|
let bracketDepth = 0;
|
|
@@ -1397,7 +1401,7 @@ function normalizeLegacyPseudoElements$1(selector) {
|
|
|
1397
1401
|
continue;
|
|
1398
1402
|
}
|
|
1399
1403
|
if (bracketDepth === 0 && char === ":") {
|
|
1400
|
-
const name = isLegacyPseudoElementAt
|
|
1404
|
+
const name = isLegacyPseudoElementAt(selector, index + 1);
|
|
1401
1405
|
if (name) {
|
|
1402
1406
|
result += `::${name}`;
|
|
1403
1407
|
index += name.length + 1;
|
|
@@ -1410,7 +1414,7 @@ function normalizeLegacyPseudoElements$1(selector) {
|
|
|
1410
1414
|
return result;
|
|
1411
1415
|
}
|
|
1412
1416
|
function normalizeCssRuleDeduplicationSelector(selector) {
|
|
1413
|
-
return normalizeLegacyPseudoElements
|
|
1417
|
+
return normalizeLegacyPseudoElements(selector).replace(/\s+/g, " ").replace(/\s*([>+~])\s*/g, "$1").replace(/\(\s+/g, "(").replace(/\s+\)/g, ")").trim();
|
|
1414
1418
|
}
|
|
1415
1419
|
function normalizeCssRuleDeduplicationValue(value) {
|
|
1416
1420
|
return value.replace(/\s+/g, " ").replace(CSS_STRING_LITERAL_RE, (_match, _quote, content) => {
|
|
@@ -1647,7 +1651,7 @@ function createFrameworkReplayArtifact(generated, options) {
|
|
|
1647
1651
|
scope,
|
|
1648
1652
|
stage: "raw"
|
|
1649
1653
|
})], {
|
|
1650
|
-
classSet: generated.classSet,
|
|
1654
|
+
classSet: new Set(generated.classSet),
|
|
1651
1655
|
rawCandidates: new Set(options.rawCandidates),
|
|
1652
1656
|
dependencies: generated.dependencies,
|
|
1653
1657
|
sourceEntries: options.cssHandlerOptions.sourceOptions?.cssEntries ?? [],
|
|
@@ -1655,7 +1659,9 @@ function createFrameworkReplayArtifact(generated, options) {
|
|
|
1655
1659
|
});
|
|
1656
1660
|
}
|
|
1657
1661
|
async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options) {
|
|
1658
|
-
const
|
|
1662
|
+
const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
|
|
1663
|
+
if (generated.target === "web") return (await (0, _weapp_tailwindcss_postcss.processFrameworkCss)(generated.css, handlerOptions.postcssOptions)).css;
|
|
1664
|
+
const handled = await options.styleHandler(generated.css, handlerOptions);
|
|
1659
1665
|
const preflightMode = generated.metadata?.preflightMode;
|
|
1660
1666
|
const injectPreflight = preflightMode?.inject ?? options.cssHandlerOptions.isMainChunk;
|
|
1661
1667
|
const preservePreflight = preflightMode?.preserve ?? options.cssHandlerOptions.isMainChunk;
|
|
@@ -1667,6 +1673,7 @@ async function adaptGeneratedCssWithFrameworkPipeline(owner, generated, options)
|
|
|
1667
1673
|
}
|
|
1668
1674
|
async function adaptGeneratedCssWithFrameworkRootPipeline(owner, generated, options) {
|
|
1669
1675
|
const handlerOptions = createGeneratedCssHandlerOptions(owner, options.cssHandlerOptions, options.file);
|
|
1676
|
+
if (generated.target === "web") return (await (0, _weapp_tailwindcss_postcss.processFrameworkCss)(generated.css, handlerOptions.postcssOptions)).css;
|
|
1670
1677
|
const replayArtifact = createFrameworkReplayArtifact(generated, options);
|
|
1671
1678
|
const handled = options.compiler && options.snapshot ? require_compiler.composeGenerationArtifact(await (async () => {
|
|
1672
1679
|
for (const fragment of replayArtifact.fragments) {
|
|
@@ -1689,6 +1696,154 @@ async function adaptGeneratedCssWithFrameworkRootPipeline(owner, generated, opti
|
|
|
1689
1696
|
});
|
|
1690
1697
|
}
|
|
1691
1698
|
//#endregion
|
|
1699
|
+
//#region src/bundlers/shared/framework-css-composition.ts
|
|
1700
|
+
function nodeContent(node) {
|
|
1701
|
+
switch (node.type) {
|
|
1702
|
+
case "decl": return `decl\u0000${node.prop}\u0000${node.value}\u0000${node.important ? "1" : "0"}`;
|
|
1703
|
+
case "rule": return `rule\u0000${node.selectors.map((selector) => selector.trim()).join("")}\u0000${node.nodes.reduce((parts, child) => {
|
|
1704
|
+
if (child.type !== "comment") parts.push(nodeContent(child));
|
|
1705
|
+
return parts;
|
|
1706
|
+
}, []).join("")}`;
|
|
1707
|
+
case "atrule": return `atrule\u0000${node.name}\u0000${node.params}\u0000${node.nodes?.reduce((parts, child) => {
|
|
1708
|
+
if (child.type !== "comment") parts.push(nodeContent(child));
|
|
1709
|
+
return parts;
|
|
1710
|
+
}, []).join("") ?? ""}`;
|
|
1711
|
+
default: return `comment\u0000${node.text}`;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
function visitRules(container, context, visit) {
|
|
1715
|
+
container.each((node) => {
|
|
1716
|
+
if (node.type === "rule" || node.type === "atrule" && /^(?:font-face|(?:-\w+-)?keyframes)$/.test(node.name)) visit(node, `${context}\u0000${nodeContent(node)}`, context);
|
|
1717
|
+
else if (node.type === "atrule" && node.nodes && !(node.name === "layer" && !node.params.trim())) visitRules(node, `${context}\u0000${node.name}\u0000${node.params}`, visit);
|
|
1718
|
+
});
|
|
1719
|
+
}
|
|
1720
|
+
function collectRules(root) {
|
|
1721
|
+
const rules = [];
|
|
1722
|
+
visitRules(root, "", (node, key, context) => rules.push({
|
|
1723
|
+
node,
|
|
1724
|
+
key,
|
|
1725
|
+
context
|
|
1726
|
+
}));
|
|
1727
|
+
return rules;
|
|
1728
|
+
}
|
|
1729
|
+
function removeRules(container, removed, ruleKeys) {
|
|
1730
|
+
const nodes = container.nodes ?? [];
|
|
1731
|
+
const retained = [];
|
|
1732
|
+
for (const node of nodes) {
|
|
1733
|
+
if (removed.has(node)) continue;
|
|
1734
|
+
const key = ruleKeys.get(node);
|
|
1735
|
+
const previous = retained.at(-1);
|
|
1736
|
+
if (key && previous && key === ruleKeys.get(previous)) continue;
|
|
1737
|
+
if (node.type === "atrule" && node.nodes?.length) {
|
|
1738
|
+
removeRules(node, removed, ruleKeys);
|
|
1739
|
+
if (node.nodes.length === 0 && node.name !== "layer") continue;
|
|
1740
|
+
}
|
|
1741
|
+
retained.push(node);
|
|
1742
|
+
}
|
|
1743
|
+
if (retained.length !== nodes.length) {
|
|
1744
|
+
container.removeAll();
|
|
1745
|
+
container.append(retained);
|
|
1746
|
+
}
|
|
1747
|
+
}
|
|
1748
|
+
function matchOrderedPrefix(rules, positions) {
|
|
1749
|
+
const prefix = [];
|
|
1750
|
+
let previous = -1;
|
|
1751
|
+
for (const rule of rules) {
|
|
1752
|
+
const matches = positions.get(rule.key) ?? [];
|
|
1753
|
+
let left = 0;
|
|
1754
|
+
let right = matches.length;
|
|
1755
|
+
while (left < right) {
|
|
1756
|
+
const middle = left + right >>> 1;
|
|
1757
|
+
if (matches[middle] <= previous) left = middle + 1;
|
|
1758
|
+
else right = middle;
|
|
1759
|
+
}
|
|
1760
|
+
if (left === matches.length) break;
|
|
1761
|
+
previous = matches[left];
|
|
1762
|
+
prefix.push(previous);
|
|
1763
|
+
}
|
|
1764
|
+
return prefix;
|
|
1765
|
+
}
|
|
1766
|
+
/** 保留生成侧已确定的层位置;框架侧重复选择器及其间的覆盖区间按原顺序恢复。 */
|
|
1767
|
+
function composeFrameworkProcessedCss(before, generated, after) {
|
|
1768
|
+
if (!before.trim() && !after.trim()) return generated;
|
|
1769
|
+
const inputs = [
|
|
1770
|
+
before,
|
|
1771
|
+
generated,
|
|
1772
|
+
after
|
|
1773
|
+
];
|
|
1774
|
+
try {
|
|
1775
|
+
const roots = inputs.map((css) => _weapp_tailwindcss_postcss.postcss.parse(css));
|
|
1776
|
+
const generatedRules = collectRules(roots[1]);
|
|
1777
|
+
const generatedKeys = new Set(generatedRules.map((rule) => rule.key));
|
|
1778
|
+
const positions = /* @__PURE__ */ new Map();
|
|
1779
|
+
generatedRules.forEach((rule, index) => {
|
|
1780
|
+
const matches = positions.get(rule.key) ?? [];
|
|
1781
|
+
matches.push(index);
|
|
1782
|
+
positions.set(rule.key, matches);
|
|
1783
|
+
});
|
|
1784
|
+
const frameworkRules = [...collectRules(roots[0]), ...collectRules(roots[2])];
|
|
1785
|
+
const ruleKeys = new Map([...generatedRules, ...frameworkRules].map((record) => [record.node, record.key]));
|
|
1786
|
+
const scopes = /* @__PURE__ */ new Map();
|
|
1787
|
+
for (const record of frameworkRules) {
|
|
1788
|
+
const rules = scopes.get(record.context) ?? [];
|
|
1789
|
+
rules.push(record);
|
|
1790
|
+
scopes.set(record.context, rules);
|
|
1791
|
+
}
|
|
1792
|
+
const preserve = /* @__PURE__ */ new Set();
|
|
1793
|
+
const generatedPrefix = /* @__PURE__ */ new Set();
|
|
1794
|
+
for (const rules of scopes.values()) {
|
|
1795
|
+
const ranges = /* @__PURE__ */ new Map();
|
|
1796
|
+
rules.forEach(({ node }, index) => {
|
|
1797
|
+
const selectors = node.type === "rule" ? node.selectors : [JSON.stringify([node.name, node.params])];
|
|
1798
|
+
for (const selector of selectors) {
|
|
1799
|
+
const range = ranges.get(selector);
|
|
1800
|
+
if (range) range[1] = index;
|
|
1801
|
+
else ranges.set(selector, [index, index]);
|
|
1802
|
+
}
|
|
1803
|
+
});
|
|
1804
|
+
const boundaries = new Int32Array(rules.length + 1);
|
|
1805
|
+
for (const [first, last] of ranges.values()) if (first !== last) {
|
|
1806
|
+
boundaries[first] += 1;
|
|
1807
|
+
boundaries[last + 1] -= 1;
|
|
1808
|
+
}
|
|
1809
|
+
let depth = 0;
|
|
1810
|
+
let start = 0;
|
|
1811
|
+
for (let index = 0; index < rules.length; index++) {
|
|
1812
|
+
const previousDepth = depth;
|
|
1813
|
+
depth += boundaries[index];
|
|
1814
|
+
if (previousDepth === 0 && depth > 0) start = index;
|
|
1815
|
+
if (depth > 0 && depth + boundaries[index + 1] === 0) {
|
|
1816
|
+
const group = rules.slice(start, index + 1);
|
|
1817
|
+
const prefix = matchOrderedPrefix(group, positions);
|
|
1818
|
+
if (prefix.length !== group.length) {
|
|
1819
|
+
prefix.forEach((position) => generatedPrefix.add(generatedRules[position].node));
|
|
1820
|
+
group.slice(prefix.length).forEach((record) => preserve.add(record));
|
|
1821
|
+
}
|
|
1822
|
+
}
|
|
1823
|
+
}
|
|
1824
|
+
}
|
|
1825
|
+
const restoredKeys = new Set([...preserve].map((record) => record.key));
|
|
1826
|
+
const removed = /* @__PURE__ */ new Set();
|
|
1827
|
+
for (const record of frameworkRules) if (!preserve.has(record) && generatedKeys.has(record.key)) removed.add(record.node);
|
|
1828
|
+
for (const record of generatedRules) if (restoredKeys.has(record.key) && !generatedPrefix.has(record.node)) removed.add(record.node);
|
|
1829
|
+
let charset;
|
|
1830
|
+
for (const root of roots) {
|
|
1831
|
+
removeRules(root, removed, ruleKeys);
|
|
1832
|
+
root.walkAtRules("charset", (rule) => {
|
|
1833
|
+
charset ?? (charset = rule.clone({ raws: {
|
|
1834
|
+
before: "",
|
|
1835
|
+
afterName: " "
|
|
1836
|
+
} }));
|
|
1837
|
+
rule.remove();
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
const css = roots.map((root) => root.toString()).filter((value) => value.trim()).join("\n");
|
|
1841
|
+
return charset ? `${charset.toString()};\n${css}` : css;
|
|
1842
|
+
} catch {
|
|
1843
|
+
return inputs.filter((value) => value.trim()).join("\n");
|
|
1844
|
+
}
|
|
1845
|
+
}
|
|
1846
|
+
//#endregion
|
|
1692
1847
|
//#region src/bundlers/shared/generator-css/user-layer-order.ts
|
|
1693
1848
|
const USER_LAYER_COMPONENTS_START = "/*! weapp-tailwindcss layer components start */";
|
|
1694
1849
|
const USER_LAYER_COMPONENTS_END = "/*! weapp-tailwindcss layer components end */";
|
|
@@ -1854,7 +2009,8 @@ function mergeMarkedUserLayerComponentsCss(baseCss, markedCss) {
|
|
|
1854
2009
|
}
|
|
1855
2010
|
//#endregion
|
|
1856
2011
|
//#region src/bundlers/shared/framework-user-css.ts
|
|
1857
|
-
function
|
|
2012
|
+
function normalizeFrameworkProcessedUserCss(source) {
|
|
2013
|
+
if (!source.includes("source(")) return source;
|
|
1858
2014
|
try {
|
|
1859
2015
|
const root = _weapp_tailwindcss_postcss.postcss.parse(source);
|
|
1860
2016
|
root.walkAtRules("media", (rule) => {
|
|
@@ -1866,8 +2022,11 @@ function normalizeUserSource(source) {
|
|
|
1866
2022
|
}
|
|
1867
2023
|
}
|
|
1868
2024
|
async function restoreFrameworkProcessedUserCss(css, generated, source, options, generatorOptions) {
|
|
2025
|
+
const generatedSource = require_generator.createGeneratedThemeDeclarationResolver([generated.metadata?.rawCss, css].filter(Boolean).join("\n"));
|
|
1869
2026
|
const userCssOptions = {
|
|
2027
|
+
compileAuthorCssFunctions: generated.compileAuthorCssFunctions,
|
|
1870
2028
|
generatorTarget: generated.target,
|
|
2029
|
+
generatedSource,
|
|
1871
2030
|
generatorStyleOptions: resolveGeneratorStyleOptions(options.opts, options.cssHandlerOptions, generatorOptions.styleOptions),
|
|
1872
2031
|
cssUserHandlerOptions: options.cssUserHandlerOptions,
|
|
1873
2032
|
styleHandler: options.styleHandler,
|
|
@@ -1881,316 +2040,19 @@ async function restoreFrameworkProcessedUserCss(css, generated, source, options,
|
|
|
1881
2040
|
injectPreflight: false,
|
|
1882
2041
|
preservePreflight: generated.metadata?.preflightMode?.preserve,
|
|
1883
2042
|
styleOptions: options.cssHandlerOptions
|
|
1884
|
-
}));
|
|
2043
|
+
}), generatedSource);
|
|
1885
2044
|
};
|
|
1886
|
-
const userSource =
|
|
2045
|
+
const userSource = normalizeFrameworkProcessedUserCss(source);
|
|
1887
2046
|
const ordered = splitRawSourceByGeneratedCssOrder(userSource, generated.metadata?.rawCss ?? "") ?? {
|
|
1888
2047
|
before: "",
|
|
1889
2048
|
after: userSource
|
|
1890
2049
|
};
|
|
1891
|
-
const
|
|
1892
|
-
|
|
2050
|
+
const before = await transform(ordered.before);
|
|
2051
|
+
const after = await transform(ordered.after);
|
|
2052
|
+
return require_generator.stripTailwindBanners(reorderMarkedUserLayerComponentsCss(composeFrameworkProcessedCss(before, css, after)));
|
|
1893
2053
|
}
|
|
1894
2054
|
//#endregion
|
|
1895
2055
|
//#region src/bundlers/shared/generator-css/legacy-selectors.ts
|
|
1896
|
-
const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
|
|
1897
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
|
|
1898
|
-
":host",
|
|
1899
|
-
"page",
|
|
1900
|
-
".tw-root",
|
|
1901
|
-
"wx-root-portal-content"
|
|
1902
|
-
]);
|
|
1903
|
-
const SPECIFICITY_PLACEHOLDER_RE = /:not\(#(?:\\#|n)\)/g;
|
|
1904
|
-
const SELECTOR_CACHE_LIMIT = 64;
|
|
1905
|
-
const LEGACY_PSEUDO_ELEMENTS = [
|
|
1906
|
-
"before",
|
|
1907
|
-
"after",
|
|
1908
|
-
"first-letter",
|
|
1909
|
-
"first-line"
|
|
1910
|
-
];
|
|
1911
|
-
const generatedSelectorCache = /* @__PURE__ */ new Map();
|
|
1912
|
-
function setGeneratedSelectorCache(css, selectors) {
|
|
1913
|
-
if (generatedSelectorCache.size >= SELECTOR_CACHE_LIMIT) {
|
|
1914
|
-
const firstKey = generatedSelectorCache.keys().next().value;
|
|
1915
|
-
if (firstKey !== void 0) generatedSelectorCache.delete(firstKey);
|
|
1916
|
-
}
|
|
1917
|
-
generatedSelectorCache.set(css, selectors);
|
|
1918
|
-
}
|
|
1919
|
-
function normalizeCompatSelector(selector) {
|
|
1920
|
-
return selector.replace(SPECIFICITY_PLACEHOLDER_RE, "").replace(/\s+/g, " ").trim();
|
|
1921
|
-
}
|
|
1922
|
-
function isLegacyPseudoElementAt(selector, index) {
|
|
1923
|
-
for (const name of LEGACY_PSEUDO_ELEMENTS) {
|
|
1924
|
-
if (!selector.startsWith(name, index)) continue;
|
|
1925
|
-
const next = selector[index + name.length];
|
|
1926
|
-
if (next === void 0 || !/[\w-]/.test(next)) return name;
|
|
1927
|
-
}
|
|
1928
|
-
}
|
|
1929
|
-
function normalizeLegacyPseudoElements(selector) {
|
|
1930
|
-
let result = "";
|
|
1931
|
-
let quote;
|
|
1932
|
-
let bracketDepth = 0;
|
|
1933
|
-
let index = 0;
|
|
1934
|
-
while (index < selector.length) {
|
|
1935
|
-
const char = selector[index];
|
|
1936
|
-
if (char === "\\") {
|
|
1937
|
-
result += selector.slice(index, index + 2);
|
|
1938
|
-
index += 2;
|
|
1939
|
-
continue;
|
|
1940
|
-
}
|
|
1941
|
-
if (quote !== void 0) {
|
|
1942
|
-
result += char;
|
|
1943
|
-
if (char === quote) quote = void 0;
|
|
1944
|
-
index += 1;
|
|
1945
|
-
continue;
|
|
1946
|
-
}
|
|
1947
|
-
if (char === "\"" || char === "'") {
|
|
1948
|
-
quote = char;
|
|
1949
|
-
result += char;
|
|
1950
|
-
index += 1;
|
|
1951
|
-
continue;
|
|
1952
|
-
}
|
|
1953
|
-
if (char === "[") {
|
|
1954
|
-
bracketDepth++;
|
|
1955
|
-
result += char;
|
|
1956
|
-
index += 1;
|
|
1957
|
-
continue;
|
|
1958
|
-
}
|
|
1959
|
-
if (char === "]") {
|
|
1960
|
-
bracketDepth = Math.max(0, bracketDepth - 1);
|
|
1961
|
-
result += char;
|
|
1962
|
-
index += 1;
|
|
1963
|
-
continue;
|
|
1964
|
-
}
|
|
1965
|
-
if (bracketDepth === 0 && char === ":" && selector[index + 1] === ":") {
|
|
1966
|
-
result += "::";
|
|
1967
|
-
index += 2;
|
|
1968
|
-
continue;
|
|
1969
|
-
}
|
|
1970
|
-
if (bracketDepth === 0 && char === ":") {
|
|
1971
|
-
const name = isLegacyPseudoElementAt(selector, index + 1);
|
|
1972
|
-
if (name) {
|
|
1973
|
-
result += `::${name}`;
|
|
1974
|
-
index += name.length + 1;
|
|
1975
|
-
continue;
|
|
1976
|
-
}
|
|
1977
|
-
}
|
|
1978
|
-
result += char;
|
|
1979
|
-
index += 1;
|
|
1980
|
-
}
|
|
1981
|
-
return result;
|
|
1982
|
-
}
|
|
1983
|
-
function isClassSelectorTerminator(char) {
|
|
1984
|
-
return /[\s>+~#,.:()[\]]/.test(char);
|
|
1985
|
-
}
|
|
1986
|
-
function unescapeSimpleCssIdent(value) {
|
|
1987
|
-
return value.replaceAll(/\\(.)/g, "$1");
|
|
1988
|
-
}
|
|
1989
|
-
function escapeCompatSelectorClasses(selector) {
|
|
1990
|
-
let result = "";
|
|
1991
|
-
let index = 0;
|
|
1992
|
-
let changed = false;
|
|
1993
|
-
while (index < selector.length) {
|
|
1994
|
-
const char = selector[index];
|
|
1995
|
-
if (char !== ".") {
|
|
1996
|
-
result += char;
|
|
1997
|
-
index += 1;
|
|
1998
|
-
continue;
|
|
1999
|
-
}
|
|
2000
|
-
let end = index + 1;
|
|
2001
|
-
let className = "";
|
|
2002
|
-
while (end < selector.length) {
|
|
2003
|
-
const current = selector[end];
|
|
2004
|
-
if (current === void 0) break;
|
|
2005
|
-
if (current === "\\" && end + 1 < selector.length) {
|
|
2006
|
-
const escaped = selector[end + 1];
|
|
2007
|
-
if (escaped === void 0) break;
|
|
2008
|
-
className += current + escaped;
|
|
2009
|
-
end += 2;
|
|
2010
|
-
continue;
|
|
2011
|
-
}
|
|
2012
|
-
if (isClassSelectorTerminator(current)) break;
|
|
2013
|
-
className += current;
|
|
2014
|
-
end += 1;
|
|
2015
|
-
}
|
|
2016
|
-
if (className.includes("\\")) {
|
|
2017
|
-
result += `.${require_compiler.replaceWxml(unescapeSimpleCssIdent(className))}`;
|
|
2018
|
-
changed = true;
|
|
2019
|
-
} else result += `.${className}`;
|
|
2020
|
-
index = end;
|
|
2021
|
-
}
|
|
2022
|
-
return changed ? result : selector;
|
|
2023
|
-
}
|
|
2024
|
-
function normalizeCompatSelectors(selector) {
|
|
2025
|
-
const normalized = normalizeCompatSelector(selector);
|
|
2026
|
-
if (!normalized) return [];
|
|
2027
|
-
const selectors = /* @__PURE__ */ new Set([normalized]);
|
|
2028
|
-
const escaped = normalizeCompatSelector(escapeCompatSelectorClasses(normalized));
|
|
2029
|
-
if (escaped) selectors.add(escaped);
|
|
2030
|
-
return [...selectors];
|
|
2031
|
-
}
|
|
2032
|
-
function normalizeCssSelector(selector) {
|
|
2033
|
-
return normalizeLegacyPseudoElements(selector).trim().replace(/\s+/g, "");
|
|
2034
|
-
}
|
|
2035
|
-
function getCompatSelectorKeys(selector) {
|
|
2036
|
-
return normalizeCompatSelectors(selector).map(normalizeCssSelector);
|
|
2037
|
-
}
|
|
2038
|
-
function getRuleCompatSelectorKeys(rule) {
|
|
2039
|
-
return (rule.selectors?.length ? rule.selectors : [rule.selector]).flatMap((selector) => getCompatSelectorKeys(selector));
|
|
2040
|
-
}
|
|
2041
|
-
function hasClassSelector(selector) {
|
|
2042
|
-
return CLASS_SELECTOR_RE.test(selector);
|
|
2043
|
-
}
|
|
2044
|
-
function getNormalizedSelectorList(selector) {
|
|
2045
|
-
return selector.split(",").map(normalizeCssSelector).filter(Boolean);
|
|
2046
|
-
}
|
|
2047
|
-
function isMiniProgramThemeScopeSelector(selector) {
|
|
2048
|
-
const selectors = getNormalizedSelectorList(selector);
|
|
2049
|
-
return selectors.length > 0 && selectors.every((item) => MINI_PROGRAM_THEME_SCOPE_SELECTORS.has(item));
|
|
2050
|
-
}
|
|
2051
|
-
function hasUtilityClassSelector(selector) {
|
|
2052
|
-
return hasClassSelector(selector) && !isMiniProgramThemeScopeSelector(selector);
|
|
2053
|
-
}
|
|
2054
|
-
function isCustomPropertyOnlyRule(rule) {
|
|
2055
|
-
let hasDeclaration = false;
|
|
2056
|
-
let allCustomProperties = true;
|
|
2057
|
-
rule.each((node) => {
|
|
2058
|
-
if (node.type !== "decl") return;
|
|
2059
|
-
hasDeclaration = true;
|
|
2060
|
-
if (!node.prop.startsWith("--")) allCustomProperties = false;
|
|
2061
|
-
});
|
|
2062
|
-
return hasDeclaration && allCustomProperties;
|
|
2063
|
-
}
|
|
2064
|
-
function isPseudoContentInitRule(rule) {
|
|
2065
|
-
let hasDeclaration = false;
|
|
2066
|
-
let onlyContentVariable = true;
|
|
2067
|
-
rule.each((node) => {
|
|
2068
|
-
if (node.type !== "decl") return;
|
|
2069
|
-
hasDeclaration = true;
|
|
2070
|
-
if (node.prop !== "--tw-content") onlyContentVariable = false;
|
|
2071
|
-
});
|
|
2072
|
-
return hasDeclaration && onlyContentVariable;
|
|
2073
|
-
}
|
|
2074
|
-
function collectGeneratedSelectors(css) {
|
|
2075
|
-
const cached = generatedSelectorCache.get(css);
|
|
2076
|
-
if (cached) return cached;
|
|
2077
|
-
const selectors = /* @__PURE__ */ new Set();
|
|
2078
|
-
try {
|
|
2079
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
2080
|
-
if (isCustomPropertyOnlyRule(rule) && !isPseudoContentInitRule(rule) && !hasUtilityClassSelector(rule.selector)) return;
|
|
2081
|
-
for (const selector of getRuleCompatSelectorKeys(rule)) selectors.add(selector);
|
|
2082
|
-
});
|
|
2083
|
-
} catch {
|
|
2084
|
-
return selectors;
|
|
2085
|
-
}
|
|
2086
|
-
setGeneratedSelectorCache(css, selectors);
|
|
2087
|
-
return selectors;
|
|
2088
|
-
}
|
|
2089
|
-
function collectGeneratedDeclarationPropsBySelector(generatedCss, selectors) {
|
|
2090
|
-
const propsBySelector = /* @__PURE__ */ new Map();
|
|
2091
|
-
try {
|
|
2092
|
-
_weapp_tailwindcss_postcss.postcss.parse(generatedCss).walkRules((rule) => {
|
|
2093
|
-
const matchedSelectors = getRuleCompatSelectorKeys(rule).filter((selector) => selectors.has(selector));
|
|
2094
|
-
if (matchedSelectors.length === 0) return;
|
|
2095
|
-
const props = /* @__PURE__ */ new Set();
|
|
2096
|
-
rule.walkDecls((decl) => {
|
|
2097
|
-
props.add(decl.prop);
|
|
2098
|
-
});
|
|
2099
|
-
for (const selector of matchedSelectors) {
|
|
2100
|
-
const existing = propsBySelector.get(selector);
|
|
2101
|
-
if (existing) for (const prop of props) existing.add(prop);
|
|
2102
|
-
else propsBySelector.set(selector, new Set(props));
|
|
2103
|
-
}
|
|
2104
|
-
});
|
|
2105
|
-
} catch {
|
|
2106
|
-
return propsBySelector;
|
|
2107
|
-
}
|
|
2108
|
-
return propsBySelector;
|
|
2109
|
-
}
|
|
2110
|
-
function isRuleCoveredByGeneratedProps(rule, generatedDeclarationPropsBySelector) {
|
|
2111
|
-
const nodeSelectors = getRuleCompatSelectorKeys(rule);
|
|
2112
|
-
if (nodeSelectors.length === 0) return false;
|
|
2113
|
-
const props = /* @__PURE__ */ new Set();
|
|
2114
|
-
rule.walkDecls((decl) => {
|
|
2115
|
-
props.add(decl.prop);
|
|
2116
|
-
});
|
|
2117
|
-
if (props.size === 0) return false;
|
|
2118
|
-
for (const selector of nodeSelectors) {
|
|
2119
|
-
const generatedProps = generatedDeclarationPropsBySelector.get(selector);
|
|
2120
|
-
if (!generatedProps) continue;
|
|
2121
|
-
if ([...props].every((prop) => generatedProps.has(prop))) return true;
|
|
2122
|
-
}
|
|
2123
|
-
return false;
|
|
2124
|
-
}
|
|
2125
|
-
function removeGeneratedSelectorCompatCss(css, generatedCss) {
|
|
2126
|
-
const generatedSelectors = collectGeneratedSelectors(generatedCss);
|
|
2127
|
-
if (generatedSelectors.size === 0) return css;
|
|
2128
|
-
try {
|
|
2129
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2130
|
-
let removed = false;
|
|
2131
|
-
root.walkRules((rule) => {
|
|
2132
|
-
if (isPseudoContentInitRule(rule)) {
|
|
2133
|
-
rule.remove();
|
|
2134
|
-
removed = true;
|
|
2135
|
-
return;
|
|
2136
|
-
}
|
|
2137
|
-
if (isCustomPropertyOnlyRule(rule) && !isPseudoContentInitRule(rule) && !hasUtilityClassSelector(rule.selector)) return;
|
|
2138
|
-
if (getRuleCompatSelectorKeys(rule).some((selector) => generatedSelectors.has(selector))) {
|
|
2139
|
-
rule.remove();
|
|
2140
|
-
removed = true;
|
|
2141
|
-
}
|
|
2142
|
-
});
|
|
2143
|
-
root.walkAtRules((atRule) => {
|
|
2144
|
-
if (atRule.nodes && atRule.nodes.length === 0) atRule.remove();
|
|
2145
|
-
});
|
|
2146
|
-
return removed ? root.toString() : css;
|
|
2147
|
-
} catch {
|
|
2148
|
-
return css;
|
|
2149
|
-
}
|
|
2150
|
-
}
|
|
2151
|
-
function collectDedupedPostTransformCompatCss(css, generatedCss) {
|
|
2152
|
-
const generatedSelectors = collectGeneratedSelectors(generatedCss);
|
|
2153
|
-
if (generatedSelectors.size === 0) return css;
|
|
2154
|
-
const generatedDeclarationPropsBySelector = collectGeneratedDeclarationPropsBySelector(generatedCss, generatedSelectors);
|
|
2155
|
-
const preservedNodes = [];
|
|
2156
|
-
try {
|
|
2157
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
2158
|
-
root.each((node) => {
|
|
2159
|
-
if (node.type === "rule") {
|
|
2160
|
-
const nodeSelectors = getRuleCompatSelectorKeys(node);
|
|
2161
|
-
if (!nodeSelectors.some((selector) => generatedSelectors.has(selector))) {
|
|
2162
|
-
preservedNodes.push(node.clone());
|
|
2163
|
-
return;
|
|
2164
|
-
}
|
|
2165
|
-
if (isRuleCoveredByGeneratedProps(node, generatedDeclarationPropsBySelector)) return;
|
|
2166
|
-
if (isCustomPropertyOnlyRule(node) && !isPseudoContentInitRule(node) && !hasUtilityClassSelector(node.selector)) {
|
|
2167
|
-
const declarationProps = /* @__PURE__ */ new Set();
|
|
2168
|
-
node.walkDecls((decl) => {
|
|
2169
|
-
declarationProps.add(decl.prop);
|
|
2170
|
-
});
|
|
2171
|
-
for (const selector of nodeSelectors) {
|
|
2172
|
-
const generatedProps = generatedDeclarationPropsBySelector.get(selector);
|
|
2173
|
-
if (!generatedProps) continue;
|
|
2174
|
-
for (const prop of generatedProps) declarationProps.delete(prop);
|
|
2175
|
-
}
|
|
2176
|
-
const nextRule = node.clone();
|
|
2177
|
-
nextRule.walkDecls((decl) => {
|
|
2178
|
-
if (!declarationProps.has(decl.prop)) decl.remove();
|
|
2179
|
-
});
|
|
2180
|
-
if (nextRule.nodes.length > 0) preservedNodes.push(nextRule);
|
|
2181
|
-
}
|
|
2182
|
-
return;
|
|
2183
|
-
}
|
|
2184
|
-
preservedNodes.push(node.clone());
|
|
2185
|
-
});
|
|
2186
|
-
if (preservedNodes.length === root.nodes.length) return css;
|
|
2187
|
-
const nextRoot = _weapp_tailwindcss_postcss.postcss.root();
|
|
2188
|
-
nextRoot.append(preservedNodes);
|
|
2189
|
-
return nextRoot.toString();
|
|
2190
|
-
} catch {
|
|
2191
|
-
return css;
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
2056
|
function removeDuplicatedViteMarkers(css, baseCss) {
|
|
2195
2057
|
if (!require_generator.VITE_MARKER_RE.test(baseCss)) return css;
|
|
2196
2058
|
require_generator.VITE_MARKER_RE.lastIndex = 0;
|
|
@@ -2985,7 +2847,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
2985
2847
|
}
|
|
2986
2848
|
const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
|
|
2987
2849
|
const sourceSideEntrySource = normalizedSourceOptions && (shouldPreferSourceSideEntry || normalizedSourceOptions.sourceFile !== void 0) && canResolveSourceSideCssEntry(file, cssHandlerOptions, normalizedSourceOptions) ? resolveSourceSideCssEntrySource(file, normalizedSourceOptions, { removeConfig: false }) : void 0;
|
|
2988
|
-
const
|
|
2850
|
+
const shouldPreferMatchedSourceSideCssSource = sourceSideEntrySource?.file && (sourceOptions?.cssEntries?.some((cssEntry) => node_path.default.resolve(cssEntry.replace(/[?#].*$/, "")) === node_path.default.resolve(sourceSideEntrySource.file)) || isSfcStyleSourceRequest(file) && sourceOptions?.cssSources?.some((cssSource) => typeof cssSource.file === "string" && node_path.default.resolve(cssSource.file.replace(/[?#].*$/, "")) === node_path.default.resolve(sourceSideEntrySource.file)));
|
|
2851
|
+
const sourceSideCssSource = normalizedSourceOptions && shouldPreferMatchedSourceSideCssSource ? await resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file, rawSource) : void 0;
|
|
2989
2852
|
if (sourceSideCssSource) return sourceSideCssSource;
|
|
2990
2853
|
const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
|
|
2991
2854
|
const matchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOptions, normalizedSourceOptions, selectionOptions) : void 0;
|
|
@@ -3226,30 +3089,12 @@ function closeTrailingUnclosedBlocks(source) {
|
|
|
3226
3089
|
return unclosedBlocks > 0 ? `${source}${"}".repeat(unclosedBlocks)}` : source;
|
|
3227
3090
|
}
|
|
3228
3091
|
}
|
|
3229
|
-
function removeTailwindApplyRules(rawSource) {
|
|
3230
|
-
try {
|
|
3231
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
|
|
3232
|
-
let removed = false;
|
|
3233
|
-
root.walkAtRules("apply", (rule) => {
|
|
3234
|
-
const parent = rule.parent;
|
|
3235
|
-
if (parent?.type === "rule") parent.remove();
|
|
3236
|
-
else rule.remove();
|
|
3237
|
-
removed = true;
|
|
3238
|
-
});
|
|
3239
|
-
root.walkAtRules((rule) => {
|
|
3240
|
-
if (rule.nodes && rule.nodes.length === 0) rule.remove();
|
|
3241
|
-
});
|
|
3242
|
-
return removed ? root.toString() : rawSource;
|
|
3243
|
-
} catch {
|
|
3244
|
-
return rawSource;
|
|
3245
|
-
}
|
|
3246
|
-
}
|
|
3247
3092
|
function resolveLegacyCompatCssSource(rawSource) {
|
|
3248
3093
|
const cached = legacyCompatSourceCache.get(rawSource);
|
|
3249
3094
|
if (cached !== void 0) return cached;
|
|
3250
3095
|
const parseableSource = closeTrailingUnclosedBlocks(require_generator.stripTailwindBanners(rawSource));
|
|
3251
3096
|
const source = require_generator.removeTailwindSourceDirectives(parseableSource);
|
|
3252
|
-
const resolved = closeTrailingUnclosedBlocks(require_generator.removeTailwindV4GeneratedUserCssArtifacts((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(removeTailwindApplyRules(source))));
|
|
3097
|
+
const resolved = closeTrailingUnclosedBlocks(require_generator.removeTailwindV4GeneratedUserCssArtifacts((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)((0, _weapp_tailwindcss_postcss.removeTailwindApplyRules)(source))));
|
|
3253
3098
|
setLimitedCacheValue(legacyCompatSourceCache, rawSource, resolved);
|
|
3254
3099
|
return resolved;
|
|
3255
3100
|
}
|
|
@@ -3306,8 +3151,9 @@ function hasConfiguredContainerCompatSources(sources) {
|
|
|
3306
3151
|
async function appendLegacyCompatCss(css, rawSource, generatorTarget, styleHandler, cssHandlerOptions, generatorStyleOptions, options = {}) {
|
|
3307
3152
|
const resolvedCompatSource = resolveLegacyCompatCssSource(rawSource);
|
|
3308
3153
|
const normalizedCompatSource = generatorTarget === "weapp" ? removeMiniProgramContainerCompatCss(resolvedCompatSource) : resolvedCompatSource;
|
|
3309
|
-
const
|
|
3310
|
-
if (
|
|
3154
|
+
const filteredCompatSource = options.preserveSelectorOverrides ? normalizedCompatSource : (0, _weapp_tailwindcss_postcss.removeGeneratedSelectorCompatCss)(normalizedCompatSource, css);
|
|
3155
|
+
if (filteredCompatSource.trim().length === 0) return css;
|
|
3156
|
+
const compatSource = await options.compileAuthorCssFunctions?.(filteredCompatSource) ?? filteredCompatSource;
|
|
3311
3157
|
if (generatorTarget !== "weapp") return require_generator.createCssAppend(css, compatSource);
|
|
3312
3158
|
const styleOptions = {
|
|
3313
3159
|
...cssHandlerOptions,
|
|
@@ -3319,16 +3165,16 @@ async function appendLegacyCompatCss(css, rawSource, generatorTarget, styleHandl
|
|
|
3319
3165
|
compatCss = (await styleHandler(compatSource, styleOptions)).css;
|
|
3320
3166
|
setLimitedCacheValue(legacyCompatTransformCache, compatCssCacheKey, compatCss);
|
|
3321
3167
|
}
|
|
3322
|
-
const transformedCompatCss = require_generator.removeTailwindV4GeneratedUserCssArtifacts(removeDuplicatedViteMarkers((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(compatCss), css));
|
|
3323
|
-
const cleanedCompatCss = options.preserveSelectorOverrides ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, transformedCompatCss) : collectDedupedPostTransformCompatCss(transformedCompatCss, css);
|
|
3168
|
+
const transformedCompatCss = require_generator.removeTailwindV4GeneratedUserCssArtifacts(removeDuplicatedViteMarkers((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(compatCss), css), options.generatedSource ?? css);
|
|
3169
|
+
const cleanedCompatCss = options.preserveSelectorOverrides ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, transformedCompatCss) : (0, _weapp_tailwindcss_postcss.collectDedupedPostTransformCompatCss)(transformedCompatCss, css);
|
|
3324
3170
|
if (cleanedCompatCss.trim().length === 0) return css;
|
|
3325
3171
|
return require_generator.createCssAppend(css, cleanedCompatCss);
|
|
3326
3172
|
}
|
|
3327
3173
|
async function appendLegacyContainerCompatCss(css, rawSource, file, runtime, configuredContainerCompat, generatorTarget, styleHandler, cssHandlerOptions, generatorStyleOptions) {
|
|
3328
3174
|
if (generatorTarget === "weapp") return css;
|
|
3329
3175
|
const compatSource = resolveLegacyCompatCssSource(rawSource);
|
|
3330
|
-
const shouldAppendContainer = runtime.has("container") || hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) || configuredContainerCompat || collectGeneratedSelectors(compatSource).has(".container");
|
|
3331
|
-
if (generatorTarget !== "weapp" || !shouldAppendContainer || collectGeneratedSelectors(css).has(".container")) return css;
|
|
3176
|
+
const shouldAppendContainer = runtime.has("container") || hasConfiguredContainerCompat(rawSource, file, cssHandlerOptions) || configuredContainerCompat || (0, _weapp_tailwindcss_postcss.collectGeneratedSelectors)(compatSource).has(".container");
|
|
3177
|
+
if (generatorTarget !== "weapp" || !shouldAppendContainer || (0, _weapp_tailwindcss_postcss.collectGeneratedSelectors)(css).has(".container")) return css;
|
|
3332
3178
|
const styleOptions = {
|
|
3333
3179
|
...cssHandlerOptions,
|
|
3334
3180
|
...generatorStyleOptions
|
|
@@ -3339,55 +3185,11 @@ async function appendLegacyContainerCompatCss(css, rawSource, file, runtime, con
|
|
|
3339
3185
|
compatCss = (await styleHandler(LEGACY_CONTAINER_COMPAT_CSS, styleOptions)).css;
|
|
3340
3186
|
setLimitedCacheValue(legacyCompatTransformCache, compatCssCacheKey, compatCss);
|
|
3341
3187
|
}
|
|
3342
|
-
const cleanedCompatCss = collectDedupedPostTransformCompatCss((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(compatCss), css);
|
|
3188
|
+
const cleanedCompatCss = (0, _weapp_tailwindcss_postcss.collectDedupedPostTransformCompatCss)((0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(compatCss), css);
|
|
3343
3189
|
if (cleanedCompatCss.trim().length === 0) return css;
|
|
3344
3190
|
return require_generator.createCssAppend(css, cleanedCompatCss);
|
|
3345
3191
|
}
|
|
3346
3192
|
//#endregion
|
|
3347
|
-
//#region src/bundlers/shared/generator-css/legacy-units.ts
|
|
3348
|
-
const CSS_LENGTH_UNIT_RE = /(?:^|[\s(,])[-+]?(?:\d+|\d*\.\d+)(?:px|rem)\b/i;
|
|
3349
|
-
const RPX_UNIT_RE = /(?:^|[\s(,])[-+]?(?:\d+|\d*\.\d+)rpx\b/i;
|
|
3350
|
-
function createLegacyDeclarationValueMap(css) {
|
|
3351
|
-
const values = /* @__PURE__ */ new Map();
|
|
3352
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkRules((rule) => {
|
|
3353
|
-
if (!rule.selectors || rule.selectors.length === 0) return;
|
|
3354
|
-
for (const selector of rule.selectors) {
|
|
3355
|
-
const normalizedSelectors = normalizeCompatSelectors(selector);
|
|
3356
|
-
rule.walkDecls((decl) => {
|
|
3357
|
-
if (RPX_UNIT_RE.test(decl.value)) for (const normalizedSelector of normalizedSelectors) values.set(`${normalizedSelector}\n${decl.prop}`, decl.value);
|
|
3358
|
-
});
|
|
3359
|
-
}
|
|
3360
|
-
});
|
|
3361
|
-
return values;
|
|
3362
|
-
}
|
|
3363
|
-
function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
|
|
3364
|
-
try {
|
|
3365
|
-
const legacyValues = createLegacyDeclarationValueMap(legacyCss);
|
|
3366
|
-
if (legacyValues.size === 0) return css;
|
|
3367
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(css);
|
|
3368
|
-
let changed = false;
|
|
3369
|
-
root.walkRules((rule) => {
|
|
3370
|
-
if (!rule.selectors || rule.selectors.length === 0) return;
|
|
3371
|
-
const selectors = rule.selectors.flatMap((selector) => normalizeCompatSelectors(selector));
|
|
3372
|
-
if (selectors.length === 0) return;
|
|
3373
|
-
rule.walkDecls((decl) => {
|
|
3374
|
-
if (!CSS_LENGTH_UNIT_RE.test(decl.value)) return;
|
|
3375
|
-
for (const selector of selectors) {
|
|
3376
|
-
const legacyValue = legacyValues.get(`${selector}\n${decl.prop}`);
|
|
3377
|
-
if (legacyValue && legacyValue !== decl.value) {
|
|
3378
|
-
decl.value = legacyValue;
|
|
3379
|
-
changed = true;
|
|
3380
|
-
return;
|
|
3381
|
-
}
|
|
3382
|
-
}
|
|
3383
|
-
});
|
|
3384
|
-
});
|
|
3385
|
-
return changed ? root.toString() : css;
|
|
3386
|
-
} catch {
|
|
3387
|
-
return css;
|
|
3388
|
-
}
|
|
3389
|
-
}
|
|
3390
|
-
//#endregion
|
|
3391
3193
|
//#region src/bundlers/shared/generator-css/output-import-shell.ts
|
|
3392
3194
|
const MINI_PROGRAM_OUTPUT_IMPORT_RE = /(@import\s+(?:url\(\s*)?)(["'])([^"']+\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:[?#][^"']*)?)\2([^;]*;)/gi;
|
|
3393
3195
|
const MINI_PROGRAM_OUTPUT_STYLE_RE = /\.(?:wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i;
|
|
@@ -3403,10 +3205,10 @@ function normalizeMiniProgramImportShell(css, output) {
|
|
|
3403
3205
|
const files = new Set([...output.outputFiles].map(normalizeOutputPath));
|
|
3404
3206
|
const root = _weapp_tailwindcss_postcss.postcss.parse(normalized);
|
|
3405
3207
|
root.walkAtRules("import", (rule) => {
|
|
3406
|
-
const parsed =
|
|
3208
|
+
const parsed = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(rule.params);
|
|
3407
3209
|
if (!parsed || output.cssOnly && !/\.css(?:$|[?#])/i.test(parsed.specifier) || !files.has(resolveOutputImportRequest(output.outputFile, parsed.specifier))) return;
|
|
3408
3210
|
const request = normalizeMiniProgramOutputImportRequest(parsed.specifier);
|
|
3409
|
-
if (request !== parsed.specifier) rule.params = rule.params.replace(parsed.raw,
|
|
3211
|
+
if (request !== parsed.specifier) rule.params = rule.params.replace(parsed.raw, (0, _weapp_tailwindcss_postcss.quoteCssImportSpecifier)(request, parsed.quote));
|
|
3410
3212
|
});
|
|
3411
3213
|
return root.toString();
|
|
3412
3214
|
}
|
|
@@ -3442,7 +3244,7 @@ function isMiniProgramOutputImport(node) {
|
|
|
3442
3244
|
}
|
|
3443
3245
|
function isSelfMiniProgramOutputImport(outputFile, node) {
|
|
3444
3246
|
if (node.type !== "atrule" || node.name !== "import") return false;
|
|
3445
|
-
const request =
|
|
3247
|
+
const request = (0, _weapp_tailwindcss_postcss.parseCssImportSpecifier)(node.params)?.specifier;
|
|
3446
3248
|
return request !== void 0 && /\.(?:css|wxss|acss|ttss|qss|jxss|tyss)(?:$|[?#])/i.test(request) && resolveOutputImportRequest(outputFile, request) === normalizeOutputPath(outputFile);
|
|
3447
3249
|
}
|
|
3448
3250
|
function removeMiniProgramOutputImportsBy(css, predicate) {
|
|
@@ -3513,6 +3315,54 @@ function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
|
3513
3315
|
queue.push(runWithConcurrency(factories, limit).then(() => void 0));
|
|
3514
3316
|
}
|
|
3515
3317
|
//#endregion
|
|
3318
|
+
//#region src/bundlers/shared/generator-css/user-css/compile-functions.ts
|
|
3319
|
+
const AUTHOR_THEME_FUNCTION_RE = /(?:^|[^-\w])(?:theme|--theme)\(/;
|
|
3320
|
+
const AUTHOR_SPACING_FUNCTION_RE = /(?:--spacing|--alpha)\(/;
|
|
3321
|
+
const GENERATED_AUTHOR_FUNCTION_SKIP_MAX_LENGTH = 8192;
|
|
3322
|
+
/**
|
|
3323
|
+
* 判断这段 CSS 是否还需要走作者函数编译。
|
|
3324
|
+
*
|
|
3325
|
+
* `theme()` / `--theme()` 一定要编译。`--spacing()` / `--alpha()` 只在短小的作者 CSS 里保留;
|
|
3326
|
+
* 大段或带生成标记的样式里它们通常已是 Tailwind 工具输出,再 parse 会拖垮 generateBundle。
|
|
3327
|
+
*/
|
|
3328
|
+
function shouldCompileAuthorCssFunctions(css) {
|
|
3329
|
+
if (AUTHOR_THEME_FUNCTION_RE.test(css)) return true;
|
|
3330
|
+
if (!AUTHOR_SPACING_FUNCTION_RE.test(css)) return false;
|
|
3331
|
+
return css.length <= GENERATED_AUTHOR_FUNCTION_SKIP_MAX_LENGTH && !css.includes("weapp-tailwindcss") && !css.includes("tailwindcss v4");
|
|
3332
|
+
}
|
|
3333
|
+
function createAuthorCssFunctionCompiler(sources, session) {
|
|
3334
|
+
const cache = /* @__PURE__ */ new Map();
|
|
3335
|
+
return (css) => {
|
|
3336
|
+
if (!shouldCompileAuthorCssFunctions(css)) return Promise.resolve(css);
|
|
3337
|
+
return (0, _weapp_tailwindcss_postcss.compileTailwindAuthorFunctions)(css, async (values) => {
|
|
3338
|
+
const missing = [...new Set(values.filter((value) => !cache.has(value)))];
|
|
3339
|
+
if (missing.length > 0) {
|
|
3340
|
+
let selector = `.weapp-author-functions-${(0, _weapp_tailwindcss_shared_node.md5)(missing.join("\0"))}`;
|
|
3341
|
+
while (sources.some((source) => source.css.includes(selector))) selector += "-probe";
|
|
3342
|
+
const probe = (0, _weapp_tailwindcss_postcss.createTailwindAuthorFunctionProbe)(missing, selector);
|
|
3343
|
+
let resolved;
|
|
3344
|
+
for (const source of sources) {
|
|
3345
|
+
const result = await session.generate({
|
|
3346
|
+
...source,
|
|
3347
|
+
css: `${source.css}\n${probe.css}`
|
|
3348
|
+
}, {
|
|
3349
|
+
candidates: [],
|
|
3350
|
+
scanSources: false,
|
|
3351
|
+
incrementalCache: false,
|
|
3352
|
+
target: "web"
|
|
3353
|
+
});
|
|
3354
|
+
const current = probe.read(result.rawCss);
|
|
3355
|
+
if (resolved && current.some((value, index) => value !== resolved[index])) throw new Error("作者样式函数匹配到多个不同的 Tailwind 配置上下文,无法安全回填。");
|
|
3356
|
+
resolved = current;
|
|
3357
|
+
}
|
|
3358
|
+
if (!resolved) throw new Error("作者样式函数缺少 Tailwind 编译上下文。");
|
|
3359
|
+
missing.forEach((value, index) => cache.set(value, resolved[index]));
|
|
3360
|
+
}
|
|
3361
|
+
return values.map((value) => cache.get(value));
|
|
3362
|
+
});
|
|
3363
|
+
};
|
|
3364
|
+
}
|
|
3365
|
+
//#endregion
|
|
3516
3366
|
//#region src/bundlers/shared/generator-css/class-selectors.ts
|
|
3517
3367
|
function normalizeCssClassSelector(value) {
|
|
3518
3368
|
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
@@ -3521,7 +3371,7 @@ function collectRawSourceClassSelectors(rawSource) {
|
|
|
3521
3371
|
const selectors = /* @__PURE__ */ new Set();
|
|
3522
3372
|
try {
|
|
3523
3373
|
_weapp_tailwindcss_postcss.postcss.parse(rawSource).walkRules((rule) => {
|
|
3524
|
-
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]));
|
|
3374
|
+
for (const selector of rule.selectors ?? [rule.selector]) for (const match of selector.matchAll(/\.((?:\\.|[_a-z\u00A0-\uFFFF-])(?:\\.|[\w\u00A0-\uFFFF-])*)/gi)) if (match[1]) selectors.add(normalizeCssClassSelector(match[1]));
|
|
3525
3375
|
});
|
|
3526
3376
|
} catch {}
|
|
3527
3377
|
return selectors;
|
|
@@ -3598,6 +3448,8 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3598
3448
|
if (generated.target !== "weapp" || generatedUserCssRawSource.trim().length === 0) return css;
|
|
3599
3449
|
const userCssOptions = {
|
|
3600
3450
|
generatorTarget: generated.target,
|
|
3451
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3452
|
+
generatedSource: generated.rawCss,
|
|
3601
3453
|
generatorStyleOptions,
|
|
3602
3454
|
cssUserHandlerOptions,
|
|
3603
3455
|
styleHandler,
|
|
@@ -3622,8 +3474,9 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3622
3474
|
};
|
|
3623
3475
|
const canAppendIncrementalCss = generated.target !== "weapp" || !require_generator.hasUserCssLayerBlocks(generatorRawSource);
|
|
3624
3476
|
const incrementalRawCss = generated.incrementalRawCss ?? generated.incrementalCss;
|
|
3625
|
-
const
|
|
3626
|
-
const
|
|
3477
|
+
const previousCss = options.previousCss;
|
|
3478
|
+
const shouldAppendIncrementalCss = canAppendIncrementalCss && typeof previousCss === "string" && typeof incrementalRawCss === "string";
|
|
3479
|
+
const normalizedCss = shouldAppendIncrementalCss ? incrementalRawCss.trim().length > 0 ? require_generator.createCssAppend(previousCss, await normalizeDeferredGeneratedCss(incrementalRawCss)) : previousCss : await normalizeDeferredGeneratedCss(generated.rawCss ?? generated.css);
|
|
3627
3480
|
const intermediateCss = shouldAppendIncrementalCss ? normalizedCss : await restoreDeferredUserCss(normalizedCss);
|
|
3628
3481
|
const css = (0, _weapp_tailwindcss_postcss.restoreLocalCssImports)(intermediateCss, localImports, { outputFile: file });
|
|
3629
3482
|
return {
|
|
@@ -3631,7 +3484,7 @@ async function finalizeDeferredGeneratorCss(context) {
|
|
|
3631
3484
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, css, opts.escapeMap, options.previousClassSet),
|
|
3632
3485
|
target: generated.target,
|
|
3633
3486
|
source: "generator",
|
|
3634
|
-
dependencies: generated.dependencies,
|
|
3487
|
+
dependencies: [...generated.dependencies],
|
|
3635
3488
|
incremental: shouldAppendIncrementalCss,
|
|
3636
3489
|
metadata: {
|
|
3637
3490
|
file,
|
|
@@ -3652,6 +3505,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3652
3505
|
let restoredDistinctUserLayerCss = false;
|
|
3653
3506
|
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !require_generator.hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend(await require_generator.transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
3654
3507
|
generatorTarget: generated.target,
|
|
3508
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3509
|
+
generatedSource: generated.rawCss,
|
|
3655
3510
|
generatorStyleOptions,
|
|
3656
3511
|
cssUserHandlerOptions,
|
|
3657
3512
|
styleHandler,
|
|
@@ -3659,11 +3514,13 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3659
3514
|
processed: userRawSourceProcessed
|
|
3660
3515
|
}), css);
|
|
3661
3516
|
if (generated.target === "weapp") {
|
|
3662
|
-
css = inheritLegacyUnitConvertedDeclarations(css, generatorRawSource);
|
|
3517
|
+
css = (0, _weapp_tailwindcss_postcss.inheritLegacyUnitConvertedDeclarations)(css, generatorRawSource);
|
|
3663
3518
|
if (require_generator.hasUserCssLayerBlocks(generatorRawSource)) {
|
|
3664
3519
|
const layerParts = require_generator.splitUserCssLayerBlocks(generatorRawSource);
|
|
3665
3520
|
const layerUserCss = await require_generator.transformGeneratorUserCss(layerParts.layer, {
|
|
3666
3521
|
generatorTarget: generated.target,
|
|
3522
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3523
|
+
generatedSource: generated.rawCss,
|
|
3667
3524
|
generatorStyleOptions,
|
|
3668
3525
|
cssUserHandlerOptions,
|
|
3669
3526
|
styleHandler,
|
|
@@ -3682,6 +3539,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3682
3539
|
if (hasDistinctUserRawSource && distinctUserLayerParts) {
|
|
3683
3540
|
const layerUserCss = await require_generator.transformGeneratorUserCss(distinctUserLayerParts.layer, {
|
|
3684
3541
|
generatorTarget: generated.target,
|
|
3542
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3543
|
+
generatedSource: generated.rawCss,
|
|
3685
3544
|
generatorStyleOptions,
|
|
3686
3545
|
cssUserHandlerOptions,
|
|
3687
3546
|
styleHandler,
|
|
@@ -3700,6 +3559,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3700
3559
|
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
3701
3560
|
const userCss = await require_generator.transformGeneratorUserCss(distinctUserCssRawSource, {
|
|
3702
3561
|
generatorTarget: generated.target,
|
|
3562
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3563
|
+
generatedSource: generated.rawCss,
|
|
3703
3564
|
generatorStyleOptions,
|
|
3704
3565
|
cssUserHandlerOptions,
|
|
3705
3566
|
styleHandler,
|
|
@@ -3709,10 +3570,12 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3709
3570
|
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, distinctUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
3710
3571
|
css = createCssSourceOrderAppend(css, missingUserCss);
|
|
3711
3572
|
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
3712
|
-
const cleanedUserCssRawSource = require_generator.removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource);
|
|
3573
|
+
const cleanedUserCssRawSource = require_generator.removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource, generated.rawCss);
|
|
3713
3574
|
const cleanedUserCssRestSource = restoredDistinctUserLayerCss && require_generator.hasUserCssLayerBlocks(cleanedUserCssRawSource) ? require_generator.splitUserCssLayerBlocks(cleanedUserCssRawSource).rest : cleanedUserCssRawSource;
|
|
3714
3575
|
const userCss = await require_generator.transformGeneratorUserCss(cleanedUserCssRestSource, {
|
|
3715
3576
|
generatorTarget: generated.target,
|
|
3577
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3578
|
+
generatedSource: generated.rawCss,
|
|
3716
3579
|
generatorStyleOptions,
|
|
3717
3580
|
cssUserHandlerOptions,
|
|
3718
3581
|
styleHandler,
|
|
@@ -3724,6 +3587,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3724
3587
|
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && require_generator.hasUserCssLayerBlocks(generatedUserCssRawSource)) {
|
|
3725
3588
|
const layerUserCss = await require_generator.transformGeneratorUserCss(require_generator.splitUserCssLayerBlocks(generatedUserCssRawSource).layer, {
|
|
3726
3589
|
generatorTarget: generated.target,
|
|
3590
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3591
|
+
generatedSource: generated.rawCss,
|
|
3727
3592
|
generatorStyleOptions,
|
|
3728
3593
|
cssUserHandlerOptions,
|
|
3729
3594
|
styleHandler,
|
|
@@ -3744,6 +3609,8 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3744
3609
|
})) {
|
|
3745
3610
|
const userCss = await require_generator.transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
3746
3611
|
generatorTarget: generated.target,
|
|
3612
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3613
|
+
generatedSource: generated.rawCss,
|
|
3747
3614
|
generatorStyleOptions,
|
|
3748
3615
|
cssUserHandlerOptions,
|
|
3749
3616
|
styleHandler,
|
|
@@ -3763,7 +3630,7 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3763
3630
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3764
3631
|
target: generated.target,
|
|
3765
3632
|
source: "generator",
|
|
3766
|
-
dependencies: generated.dependencies,
|
|
3633
|
+
dependencies: [...generated.dependencies],
|
|
3767
3634
|
metadata: {
|
|
3768
3635
|
file,
|
|
3769
3636
|
majorVersion,
|
|
@@ -3772,13 +3639,19 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3772
3639
|
};
|
|
3773
3640
|
}
|
|
3774
3641
|
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
3775
|
-
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
3642
|
+
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
3643
|
+
preserveSelectorOverrides: shouldPreserveLegacyCompatSelectorOverrides,
|
|
3644
|
+
generatedSource: generated.rawCss,
|
|
3645
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions
|
|
3646
|
+
});
|
|
3776
3647
|
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
3777
3648
|
}
|
|
3778
3649
|
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_generator.hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
3779
3650
|
const distinctUserCssRawSource = restoredDistinctUserLayerCss ? distinctUserLayerParts?.rest ?? generatedUserCssRawSource : generatedUserCssRawSource;
|
|
3780
3651
|
const userCss = await require_generator.transformGeneratorUserCss(distinctUserCssRawSource, {
|
|
3781
3652
|
generatorTarget: generated.target,
|
|
3653
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3654
|
+
generatedSource: generated.rawCss,
|
|
3782
3655
|
generatorStyleOptions,
|
|
3783
3656
|
cssUserHandlerOptions,
|
|
3784
3657
|
styleHandler,
|
|
@@ -3798,7 +3671,7 @@ async function finalizeFallbackGeneratorCss(context) {
|
|
|
3798
3671
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3799
3672
|
target: generated.target,
|
|
3800
3673
|
source: "generator",
|
|
3801
|
-
dependencies: generated.dependencies,
|
|
3674
|
+
dependencies: [...generated.dependencies],
|
|
3802
3675
|
metadata: {
|
|
3803
3676
|
file,
|
|
3804
3677
|
majorVersion,
|
|
@@ -3823,7 +3696,7 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3823
3696
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3824
3697
|
target: generated.target,
|
|
3825
3698
|
source: "generator",
|
|
3826
|
-
dependencies: generated.dependencies,
|
|
3699
|
+
dependencies: [...generated.dependencies],
|
|
3827
3700
|
incremental: true,
|
|
3828
3701
|
metadata: {
|
|
3829
3702
|
file,
|
|
@@ -3837,9 +3710,11 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3837
3710
|
const shouldAppendMatchedCssSourceCompat = !hasMatchedCssSourceFile || orderedExtraCss !== void 0;
|
|
3838
3711
|
if (orderedExtraCss) {
|
|
3839
3712
|
let css = generatedCss;
|
|
3840
|
-
if (generated.target === "weapp") css = inheritLegacyUnitConvertedDeclarations(css, generatorRawSource);
|
|
3713
|
+
if (generated.target === "weapp") css = (0, _weapp_tailwindcss_postcss.inheritLegacyUnitConvertedDeclarations)(css, generatorRawSource);
|
|
3841
3714
|
const userCssOptions = {
|
|
3842
3715
|
generatorTarget: generated.target,
|
|
3716
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions,
|
|
3717
|
+
generatedSource: generated.rawCss,
|
|
3843
3718
|
generatorStyleOptions,
|
|
3844
3719
|
cssUserHandlerOptions,
|
|
3845
3720
|
styleHandler,
|
|
@@ -3875,7 +3750,11 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3875
3750
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
3876
3751
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
3877
3752
|
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
3878
|
-
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
3753
|
+
css = await appendLegacyCompatCss(css, legacyCompatUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions, {
|
|
3754
|
+
preserveSelectorOverrides: shouldPreserveLegacyCompatSelectorOverrides,
|
|
3755
|
+
generatedSource: generated.rawCss,
|
|
3756
|
+
compileAuthorCssFunctions: context.compileAuthorCssFunctions
|
|
3757
|
+
});
|
|
3879
3758
|
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
3880
3759
|
}
|
|
3881
3760
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
@@ -3889,7 +3768,7 @@ async function finalizeOrderedGeneratorCss(context) {
|
|
|
3889
3768
|
classSet: resolveGeneratedCssClassSet(generated.target, generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap, options.previousClassSet),
|
|
3890
3769
|
target: generated.target,
|
|
3891
3770
|
source: "generator",
|
|
3892
|
-
dependencies: generated.dependencies,
|
|
3771
|
+
dependencies: [...generated.dependencies],
|
|
3893
3772
|
metadata: {
|
|
3894
3773
|
file,
|
|
3895
3774
|
majorVersion,
|
|
@@ -4038,7 +3917,7 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4038
3917
|
dependenciesBySource: results.map((result) => [result.sourceId, resolveCompilationDependencies(result.generated.dependencies)]),
|
|
4039
3918
|
generated: merged,
|
|
4040
3919
|
...compilerSession ? (() => {
|
|
4041
|
-
const snapshots = results.map((result) => result.generated.snapshot).filter((snapshot) => snapshot !== void 0);
|
|
3920
|
+
const snapshots = results.map((result) => "snapshot" in result.generated ? result.generated.snapshot : void 0).filter((snapshot) => snapshot !== void 0);
|
|
4042
3921
|
return snapshots.length > 0 ? { snapshot: compilerSession.mergeSnapshots(snapshots) } : {};
|
|
4043
3922
|
})() : {}
|
|
4044
3923
|
} : void 0;
|
|
@@ -4074,7 +3953,10 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4074
3953
|
});
|
|
4075
3954
|
const filterGeneratedApplyOnlyCss = (css) => {
|
|
4076
3955
|
if (!shouldFilterApplyOnlyCss) return css;
|
|
4077
|
-
return require_generator.filterApplyOnlyGeneratedCss(css, generatorRawSource, {
|
|
3956
|
+
return require_generator.filterApplyOnlyGeneratedCss(css, generatorRawSource, {
|
|
3957
|
+
preserveVariables: generated.target !== "web",
|
|
3958
|
+
preserveRuntimeProperties: generated.target === "web" && opts.appType === "uni-app-x"
|
|
3959
|
+
});
|
|
4078
3960
|
};
|
|
4079
3961
|
const preflightMode = resolveMiniProgramPreflightModeForGeneratorCss(opts, {
|
|
4080
3962
|
cssHandlerOptions,
|
|
@@ -4083,6 +3965,8 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4083
3965
|
explicitCssSource: hasExplicitCssSource,
|
|
4084
3966
|
primaryCssSource: hasOnlyPrimaryCssSource || hasPreflightCssSource || hasPreflightRawSource
|
|
4085
3967
|
});
|
|
3968
|
+
const compileAuthorCssFunctions = createAuthorCssFunctionCompiler(preparedGenerationInputs.map((input) => input.generatorSource), generationSession);
|
|
3969
|
+
const frameworkProcessedUserCss = options.frameworkProcessedUserCss === void 0 ? void 0 : await compileAuthorCssFunctions(options.frameworkProcessedUserCss);
|
|
4086
3970
|
const outputContext = {
|
|
4087
3971
|
...context,
|
|
4088
3972
|
...compilerSession && options.compilation?.preserveDeletedCss !== true ? { options: {
|
|
@@ -4090,6 +3974,7 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4090
3974
|
previousClassSet: void 0,
|
|
4091
3975
|
previousCss: void 0
|
|
4092
3976
|
} } : {},
|
|
3977
|
+
compileAuthorCssFunctions,
|
|
4093
3978
|
configuredContainerCompat,
|
|
4094
3979
|
filterGeneratedApplyOnlyCss,
|
|
4095
3980
|
generated,
|
|
@@ -4102,10 +3987,17 @@ async function executeGeneratorPipelineWithOwner(context, compilationPool, gener
|
|
|
4102
3987
|
shouldFilterApplyOnlyCss
|
|
4103
3988
|
};
|
|
4104
3989
|
const withCompilationMetadata = (result) => {
|
|
3990
|
+
if (result && frameworkProcessedUserCss !== void 0) result = {
|
|
3991
|
+
...result,
|
|
3992
|
+
compileAuthorCssFunctions,
|
|
3993
|
+
frameworkProcessedUserCss
|
|
3994
|
+
};
|
|
4105
3995
|
if (!result || compilationRevision === void 0) return result;
|
|
4106
3996
|
return {
|
|
4107
3997
|
...result,
|
|
3998
|
+
...generated.snapshot ? { snapshot: generated.snapshot } : {},
|
|
4108
3999
|
metadata: {
|
|
4000
|
+
file,
|
|
4109
4001
|
...result.metadata,
|
|
4110
4002
|
revision: compilationRevision
|
|
4111
4003
|
}
|
|
@@ -4167,7 +4059,7 @@ async function generateCssByGenerator(options) {
|
|
|
4167
4059
|
return useMiniProgramCssBranch ? normalizeMiniProgramGeneratorCssSource(css, file) : css;
|
|
4168
4060
|
};
|
|
4169
4061
|
const normalizeGeneratorSource = (source) => {
|
|
4170
|
-
const css = normalizeGeneratorCssSource(source.css);
|
|
4062
|
+
const css = useMiniProgramCssBranch ? removeMiniProgramOutputImports(normalizeGeneratorCssSource(source.css)) : source.css;
|
|
4171
4063
|
return css === source.css ? source : {
|
|
4172
4064
|
...source,
|
|
4173
4065
|
css
|
|
@@ -4350,7 +4242,7 @@ function createCoreArtifact(generated, css, options) {
|
|
|
4350
4242
|
scope,
|
|
4351
4243
|
stage: "adapted"
|
|
4352
4244
|
})], {
|
|
4353
|
-
classSet: generated.classSet,
|
|
4245
|
+
classSet: new Set(generated.classSet),
|
|
4354
4246
|
rawCandidates: options.runtime,
|
|
4355
4247
|
dependencies: generated.dependencies,
|
|
4356
4248
|
sourceEntries: options.cssHandlerOptions.sourceOptions?.cssEntries ?? [],
|
|
@@ -4367,10 +4259,11 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4367
4259
|
tailwindcssMajorVersion: majorVersion,
|
|
4368
4260
|
uniAppX: options.opts.uniAppX
|
|
4369
4261
|
});
|
|
4370
|
-
const shouldReplayFrameworkPostcss = options.cssStage === "framework-processed" && hasFrameworkPostcssOptions(frameworkPostcssOwner)
|
|
4262
|
+
const shouldReplayFrameworkPostcss = options.cssStage === "framework-processed" && hasFrameworkPostcssOptions(frameworkPostcssOwner);
|
|
4371
4263
|
const generationInput = !shouldReplayFrameworkPostcss && options.frameworkProcessedUserCss ? {
|
|
4372
4264
|
...options,
|
|
4373
|
-
userRawSource: [options.userRawSource, options.frameworkProcessedUserCss].filter(Boolean).join("\n")
|
|
4265
|
+
userRawSource: [options.userRawSource, options.frameworkProcessedUserCss].filter(Boolean).join("\n"),
|
|
4266
|
+
frameworkProcessedUserCss: void 0
|
|
4374
4267
|
} : options;
|
|
4375
4268
|
const scope = options.scope ?? {
|
|
4376
4269
|
id: options.outputFile ?? options.file,
|
|
@@ -4378,13 +4271,14 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4378
4271
|
};
|
|
4379
4272
|
const generated = await generateCssByGenerator(shouldReplayFrameworkPostcss ? {
|
|
4380
4273
|
...generationInput,
|
|
4274
|
+
frameworkProcessedUserCss: options.frameworkProcessedUserCss === void 0 ? void 0 : normalizeFrameworkProcessedUserCss(options.frameworkProcessedUserCss),
|
|
4381
4275
|
compilation: implementation.frameworkAdapter === "graph" ? {
|
|
4382
4276
|
enabled: true,
|
|
4383
4277
|
preserveDeletedCss: normalizedGeneratorOptions.hmr?.preserveDeletedCss ?? true,
|
|
4384
4278
|
scope,
|
|
4385
4279
|
...options.compilationChanges === void 0 ? {} : { changes: options.compilationChanges }
|
|
4386
4280
|
} : void 0,
|
|
4387
|
-
deferCssAdaptation:
|
|
4281
|
+
deferCssAdaptation: normalizedGeneratorOptions.target === "weapp"
|
|
4388
4282
|
} : {
|
|
4389
4283
|
...generationInput,
|
|
4390
4284
|
compilation: implementation.frameworkAdapter === "graph" ? {
|
|
@@ -4406,15 +4300,16 @@ async function generateTailwindV4CssWithImplementation(options, implementation)
|
|
|
4406
4300
|
snapshot: generated.snapshot
|
|
4407
4301
|
} : {}
|
|
4408
4302
|
}) : generated.css;
|
|
4409
|
-
const composedCss = shouldReplayFrameworkPostcss && options.frameworkProcessedUserCss ? await restoreFrameworkProcessedUserCss(adaptedCss, generated, options.frameworkProcessedUserCss, options, normalizedGeneratorOptions) : adaptedCss;
|
|
4303
|
+
const composedCss = shouldReplayFrameworkPostcss && options.frameworkProcessedUserCss ? await restoreFrameworkProcessedUserCss(adaptedCss, generated, generated.frameworkProcessedUserCss ?? options.frameworkProcessedUserCss, options, normalizedGeneratorOptions) : adaptedCss;
|
|
4410
4304
|
const css = isVueScopedStyleRequest(resolvePostcssRequestOption(options.cssHandlerOptions)) ? require_generator.preferScopedGeneratedCssRules(composedCss) : composedCss;
|
|
4411
|
-
const classSet = options.frameworkProcessedUserCss ? resolveGeneratedCssClassSet(generated.target, generated.classSet, options.runtime, css, options.opts.escapeMap, options.previousClassSet) : generated.classSet;
|
|
4305
|
+
const classSet = options.frameworkProcessedUserCss ? resolveGeneratedCssClassSet(generated.target, generated.classSet, options.runtime, css, options.opts.escapeMap, options.previousClassSet) : new Set(generated.classSet);
|
|
4412
4306
|
const artifact = implementation.emitArtifact ? createCoreArtifact({
|
|
4413
4307
|
...generated,
|
|
4414
4308
|
classSet
|
|
4415
4309
|
}, css, options) : void 0;
|
|
4310
|
+
const { compileAuthorCssFunctions: _compileAuthorCssFunctions, ...generatedRest } = generated;
|
|
4416
4311
|
return {
|
|
4417
|
-
...
|
|
4312
|
+
...generatedRest,
|
|
4418
4313
|
...artifact ? { artifact } : {},
|
|
4419
4314
|
css,
|
|
4420
4315
|
classSet,
|
|
@@ -4505,6 +4400,12 @@ Object.defineProperty(exports, "collectStrictEscapedRuntimeCandidates", {
|
|
|
4505
4400
|
return collectStrictEscapedRuntimeCandidates;
|
|
4506
4401
|
}
|
|
4507
4402
|
});
|
|
4403
|
+
Object.defineProperty(exports, "createBundlerGeneratedCssEndMarker", {
|
|
4404
|
+
enumerable: true,
|
|
4405
|
+
get: function() {
|
|
4406
|
+
return createBundlerGeneratedCssEndMarker;
|
|
4407
|
+
}
|
|
4408
|
+
});
|
|
4508
4409
|
Object.defineProperty(exports, "createBundlerGeneratedCssMarker", {
|
|
4509
4410
|
enumerable: true,
|
|
4510
4411
|
get: function() {
|
|
@@ -4643,12 +4544,6 @@ Object.defineProperty(exports, "pushConcurrentTaskFactories", {
|
|
|
4643
4544
|
return pushConcurrentTaskFactories;
|
|
4644
4545
|
}
|
|
4645
4546
|
});
|
|
4646
|
-
Object.defineProperty(exports, "removeGeneratedSelectorCompatCss", {
|
|
4647
|
-
enumerable: true,
|
|
4648
|
-
get: function() {
|
|
4649
|
-
return removeGeneratedSelectorCompatCss;
|
|
4650
|
-
}
|
|
4651
|
-
});
|
|
4652
4547
|
Object.defineProperty(exports, "resolveCompilerMode", {
|
|
4653
4548
|
enumerable: true,
|
|
4654
4549
|
get: function() {
|