weapp-tailwindcss 5.0.0-next.22 → 5.0.0-next.24
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/{bundle-state-CLnuf2CW.mjs → bundle-state-CP_BWXfx.mjs} +1 -1
- package/dist/{bundle-state-BnV8o2Yn.js → bundle-state-DXFq2nEo.js} +1 -1
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{defaults-B1igPF_e.mjs → defaults-C6sIKXgC.mjs} +1 -1
- package/dist/{defaults-IHhYxNeU.js → defaults-D3cFX6Cq.js} +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/{generator-CV_APjnB.js → generator-BcH28HU-.js} +1 -1
- package/dist/{generator-DPX8vA2P.mjs → generator-DdEgn8nG.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-Cwpw6aZK.mjs → incremental-runtime-class-set-Bux7viee.mjs} +20 -11
- package/dist/{incremental-runtime-class-set-C6akmwlk.js → incremental-runtime-class-set-CWdfLHON.js} +20 -11
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-Csaggbm7.js → postcss-cD5PXmMU.js} +2 -2
- package/dist/{postcss-ioX7S9x5.mjs → postcss-nk5bhdoV.mjs} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-D1O5AWzy.mjs → precheck-DreRGvYH.mjs} +3 -3
- package/dist/{precheck-8pQbjqpq.js → precheck-DtYqujIx.js} +3 -3
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{source-candidates-CnD4vyic.mjs → source-candidates-B7wmEa-G.mjs} +81 -10
- package/dist/{source-candidates-CUTNdsiz.js → source-candidates-lHtAHLQq.js} +81 -10
- package/dist/{tailwindcss-whZE3HpL.js → tailwindcss-BtUBeOes.js} +1 -1
- package/dist/{tailwindcss-B_JAdOQf.mjs → tailwindcss-DO-VVR5k.mjs} +1 -1
- package/dist/{v3-engine-DyIcbpZm.mjs → v3-engine-CXqgQZUc.mjs} +100 -13
- package/dist/{v3-engine-CCwvhRrQ.js → v3-engine-vHlppqaZ.js} +100 -13
- package/dist/{vite-k4Nlk42j.js → vite-BkNDGBZ2.js} +65 -15
- package/dist/{vite-BcXuBYy3.mjs → vite-BthAm8kt.mjs} +65 -15
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +115 -19
- package/dist/{webpack-C4pViZ7V.mjs → webpack-hPc8wUAi.mjs} +5 -5
- package/dist/{webpack-DC7v6ylA.js → webpack-prCus5xn.js} +5 -5
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +4 -4
|
@@ -436,8 +436,8 @@ function isFileMatchedByTailwindSourceEntries(file, entries) {
|
|
|
436
436
|
if (!entries?.length) return true;
|
|
437
437
|
const positiveEntries = entries.filter((entry) => !entry.negated);
|
|
438
438
|
const negativeEntries = entries.filter((entry) => entry.negated);
|
|
439
|
-
if (positiveEntries.length === 0) return false;
|
|
440
439
|
const resolvedFile = resolveSourceScanPath(file);
|
|
440
|
+
if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
441
441
|
if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
|
|
442
442
|
return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
443
443
|
}
|
|
@@ -1480,6 +1480,37 @@ function createTailwindV4DefaultColorThemeCss() {
|
|
|
1480
1480
|
//#region src/tailwindcss/v4-engine/generator.ts
|
|
1481
1481
|
const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
|
|
1482
1482
|
const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
|
|
1483
|
+
const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
|
|
1484
|
+
const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
|
|
1485
|
+
const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
|
|
1486
|
+
"**/.git/**",
|
|
1487
|
+
"**/.hg/**",
|
|
1488
|
+
"**/.jj/**",
|
|
1489
|
+
"**/.next/**",
|
|
1490
|
+
"**/.parcel-cache/**",
|
|
1491
|
+
"**/.pnpm-store/**",
|
|
1492
|
+
"**/.svelte-kit/**",
|
|
1493
|
+
"**/.svn/**",
|
|
1494
|
+
"**/.turbo/**",
|
|
1495
|
+
"**/.venv/**",
|
|
1496
|
+
"**/.vercel/**",
|
|
1497
|
+
"**/.yarn/**",
|
|
1498
|
+
"**/__pycache__/**",
|
|
1499
|
+
"**/node_modules/**",
|
|
1500
|
+
"**/venv/**",
|
|
1501
|
+
"**/*.less",
|
|
1502
|
+
"**/*.lock",
|
|
1503
|
+
"**/*.sass",
|
|
1504
|
+
"**/*.scss",
|
|
1505
|
+
"**/*.styl",
|
|
1506
|
+
"**/*.log",
|
|
1507
|
+
"**/package-lock.json",
|
|
1508
|
+
"**/pnpm-lock.yaml",
|
|
1509
|
+
"**/bun.lockb",
|
|
1510
|
+
"**/.gitignore",
|
|
1511
|
+
"**/.env",
|
|
1512
|
+
"**/.env.*"
|
|
1513
|
+
];
|
|
1483
1514
|
function findLeadingImportInsertionIndex(css) {
|
|
1484
1515
|
const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
|
|
1485
1516
|
let insertionIndex = 0;
|
|
@@ -1499,6 +1530,38 @@ function applyMiniProgramTailwindV4DefaultColorCss(css) {
|
|
|
1499
1530
|
function collectCandidates$1(candidates) {
|
|
1500
1531
|
return new Set(candidates ?? []);
|
|
1501
1532
|
}
|
|
1533
|
+
function normalizeRpxTextCandidate(candidate) {
|
|
1534
|
+
return candidate.replace(BARE_RPX_TEXT_CANDIDATE_RE, "$1text-[length:$2]$3");
|
|
1535
|
+
}
|
|
1536
|
+
function normalizeRpxTextCandidates(candidates) {
|
|
1537
|
+
const normalized = /* @__PURE__ */ new Set();
|
|
1538
|
+
const restoreCandidates = /* @__PURE__ */ new Map();
|
|
1539
|
+
for (const candidate of candidates) {
|
|
1540
|
+
const normalizedCandidate = normalizeRpxTextCandidate(candidate);
|
|
1541
|
+
normalized.add(normalizedCandidate);
|
|
1542
|
+
if (normalizedCandidate !== candidate) restoreCandidates.set(normalizedCandidate, candidate);
|
|
1543
|
+
}
|
|
1544
|
+
return {
|
|
1545
|
+
candidates: normalized,
|
|
1546
|
+
restoreCandidates
|
|
1547
|
+
};
|
|
1548
|
+
}
|
|
1549
|
+
function restoreRpxTextCandidates(candidates, restoreCandidates) {
|
|
1550
|
+
if (restoreCandidates.size === 0) return new Set(candidates);
|
|
1551
|
+
return new Set([...candidates].map((candidate) => restoreCandidates.get(candidate) ?? candidate));
|
|
1552
|
+
}
|
|
1553
|
+
function normalizeCssEscapedRpxSelectorValue(value) {
|
|
1554
|
+
return value.replace(/\\([.+-])/g, "$1");
|
|
1555
|
+
}
|
|
1556
|
+
function restoreRpxTextCssSelectors(css, restoreCandidates) {
|
|
1557
|
+
if (restoreCandidates.size === 0 || !css.includes("text-\\[length\\:")) return css;
|
|
1558
|
+
const restoredValues = new Set([...restoreCandidates.keys()].map((candidate) => {
|
|
1559
|
+
return BARE_RPX_TEXT_CANDIDATE_RE.exec(candidate.replace("[length:", "["))?.[2];
|
|
1560
|
+
}).filter((value) => Boolean(value)));
|
|
1561
|
+
return css.replace(RPX_TEXT_LENGTH_SELECTOR_RE, (match, value) => {
|
|
1562
|
+
return restoredValues.has(normalizeCssEscapedRpxSelectorValue(value)) ? `text-\\[${value}\\]` : match;
|
|
1563
|
+
});
|
|
1564
|
+
}
|
|
1502
1565
|
function createStableJson$1(value) {
|
|
1503
1566
|
if (value === void 0) return "undefined";
|
|
1504
1567
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -1655,6 +1718,20 @@ function removeUnlayeredTailwindV4PreflightImports(css) {
|
|
|
1655
1718
|
function resolveSourceBase$1(base, sourcePath) {
|
|
1656
1719
|
return path.isAbsolute(sourcePath) ? sourcePath : path.resolve(base, sourcePath);
|
|
1657
1720
|
}
|
|
1721
|
+
function createDefaultIgnoredScanSources(base) {
|
|
1722
|
+
return TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS.map((pattern) => ({
|
|
1723
|
+
base,
|
|
1724
|
+
pattern,
|
|
1725
|
+
negated: true
|
|
1726
|
+
}));
|
|
1727
|
+
}
|
|
1728
|
+
function normalizeCssDefinedScanSources(base, entries) {
|
|
1729
|
+
return entries.length > 0 && entries.every((entry) => entry.negated) ? [{
|
|
1730
|
+
base,
|
|
1731
|
+
pattern: "**/*",
|
|
1732
|
+
negated: false
|
|
1733
|
+
}, ...entries] : entries;
|
|
1734
|
+
}
|
|
1658
1735
|
async function resolveCssDefinedScanSources(source) {
|
|
1659
1736
|
let importSourceBase;
|
|
1660
1737
|
let hasSourceNone = false;
|
|
@@ -1675,11 +1752,15 @@ async function resolveCssDefinedScanSources(source) {
|
|
|
1675
1752
|
});
|
|
1676
1753
|
const sourcePatterns = await resolveCssSourceEntries(root, source.base, "**/*");
|
|
1677
1754
|
if (!importSourceBase) {
|
|
1678
|
-
if (sourcePatterns.length > 0) return sourcePatterns;
|
|
1755
|
+
if (sourcePatterns.length > 0) return [...normalizeCssDefinedScanSources(source.base, sourcePatterns), ...createDefaultIgnoredScanSources(source.base)];
|
|
1679
1756
|
if (hasSourceNone) return false;
|
|
1680
1757
|
return;
|
|
1681
1758
|
}
|
|
1682
|
-
return [
|
|
1759
|
+
return [
|
|
1760
|
+
await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"),
|
|
1761
|
+
...sourcePatterns,
|
|
1762
|
+
...createDefaultIgnoredScanSources(importSourceBase)
|
|
1763
|
+
];
|
|
1683
1764
|
}
|
|
1684
1765
|
async function resolveScanSources(source, scanSources) {
|
|
1685
1766
|
if (scanSources !== true) return scanSources;
|
|
@@ -1719,16 +1800,18 @@ function createTailwindV4Engine$1(source) {
|
|
|
1719
1800
|
const engine = createTailwindV4Engine(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
|
|
1720
1801
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1721
1802
|
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await extractRawCandidates(resolvedScanSources)) : void 0;
|
|
1722
|
-
const
|
|
1803
|
+
const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates$1(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
|
|
1723
1804
|
const result = await engine.generate(omitUndefined({
|
|
1724
1805
|
scanSources: false,
|
|
1725
1806
|
...patchOptions,
|
|
1726
|
-
candidates:
|
|
1807
|
+
candidates: normalizedCandidates.candidates
|
|
1727
1808
|
}));
|
|
1728
|
-
const rawCss = result.css;
|
|
1809
|
+
const rawCss = restoreRpxTextCssSelectors(result.css, normalizedCandidates.restoreCandidates);
|
|
1729
1810
|
const css = await transformTailwindV4CssByTarget(rawCss, target, styleOptions);
|
|
1730
1811
|
return {
|
|
1731
1812
|
...result,
|
|
1813
|
+
classSet: restoreRpxTextCandidates(result.classSet, normalizedCandidates.restoreCandidates),
|
|
1814
|
+
rawCandidates: restoreRpxTextCandidates(result.rawCandidates, normalizedCandidates.restoreCandidates),
|
|
1732
1815
|
css,
|
|
1733
1816
|
rawCss,
|
|
1734
1817
|
target
|
|
@@ -1768,15 +1851,18 @@ function createTailwindV4Engine$1(source) {
|
|
|
1768
1851
|
target: cached.target
|
|
1769
1852
|
};
|
|
1770
1853
|
return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1771
|
-
const
|
|
1854
|
+
const designSystem = await cached.designSystemPromise;
|
|
1855
|
+
const normalizedMissing = normalizeRpxTextCandidates(missingCandidates);
|
|
1856
|
+
const normalizedMissingCandidates = [...normalizedMissing.candidates];
|
|
1857
|
+
const cssByCandidate = designSystem.candidatesToCss(normalizedMissingCandidates);
|
|
1772
1858
|
const rawCssParts = [];
|
|
1773
1859
|
const classSet = /* @__PURE__ */ new Set();
|
|
1774
|
-
for (let index = 0; index <
|
|
1775
|
-
const candidate =
|
|
1860
|
+
for (let index = 0; index < normalizedMissingCandidates.length; index += 1) {
|
|
1861
|
+
const candidate = normalizedMissingCandidates[index];
|
|
1776
1862
|
const css = cssByCandidate[index];
|
|
1777
1863
|
if (candidate && typeof css === "string" && css.trim().length > 0) {
|
|
1778
|
-
rawCssParts.push(css);
|
|
1779
|
-
classSet.add(candidate);
|
|
1864
|
+
rawCssParts.push(restoreRpxTextCssSelectors(css, normalizedMissing.restoreCandidates));
|
|
1865
|
+
classSet.add(normalizedMissing.restoreCandidates.get(candidate) ?? candidate);
|
|
1780
1866
|
}
|
|
1781
1867
|
}
|
|
1782
1868
|
const rawCss = rawCssParts.join("\n");
|
|
@@ -2252,6 +2338,7 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
2252
2338
|
let hasTailwindCssImport = false;
|
|
2253
2339
|
const [sourceEntries, configEntries] = await Promise.all([resolveCssSourceEntries(root, base, VITE_SOURCE_CANDIDATE_PATTERN), resolveConfigContentEntries(root, base)]);
|
|
2254
2340
|
const entries = [...configEntries.entries, ...sourceEntries];
|
|
2341
|
+
const hasPositiveEntries = entries.some((entry) => !entry.negated);
|
|
2255
2342
|
const inlineCandidates = collectCssInlineSourceCandidates(root);
|
|
2256
2343
|
root.walkAtRules("import", (rule) => {
|
|
2257
2344
|
if (!isTailwindCssImport(rule.params)) return;
|
|
@@ -2276,7 +2363,7 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
2276
2363
|
inlineCandidates,
|
|
2277
2364
|
dependencies: configEntries.dependencies
|
|
2278
2365
|
};
|
|
2279
|
-
if (
|
|
2366
|
+
if (hasPositiveEntries) return {
|
|
2280
2367
|
entries,
|
|
2281
2368
|
explicit: true,
|
|
2282
2369
|
inlineCandidates,
|
|
@@ -2289,7 +2376,7 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
2289
2376
|
dependencies: configEntries.dependencies
|
|
2290
2377
|
};
|
|
2291
2378
|
return hasTailwindCssImport ? {
|
|
2292
|
-
entries
|
|
2379
|
+
entries,
|
|
2293
2380
|
explicit: false,
|
|
2294
2381
|
inlineCandidates,
|
|
2295
2382
|
dependencies: configEntries.dependencies
|
|
@@ -444,8 +444,8 @@ function isFileMatchedByTailwindSourceEntries(file, entries) {
|
|
|
444
444
|
if (!entries?.length) return true;
|
|
445
445
|
const positiveEntries = entries.filter((entry) => !entry.negated);
|
|
446
446
|
const negativeEntries = entries.filter((entry) => entry.negated);
|
|
447
|
-
if (positiveEntries.length === 0) return false;
|
|
448
447
|
const resolvedFile = resolveSourceScanPath(file);
|
|
448
|
+
if (positiveEntries.length === 0) return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
449
449
|
if (!positiveEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry))) return false;
|
|
450
450
|
return !negativeEntries.some((entry) => isFileMatchedByTailwindSourceEntry(resolvedFile, entry));
|
|
451
451
|
}
|
|
@@ -1488,6 +1488,37 @@ function createTailwindV4DefaultColorThemeCss() {
|
|
|
1488
1488
|
//#region src/tailwindcss/v4-engine/generator.ts
|
|
1489
1489
|
const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
|
|
1490
1490
|
const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
|
|
1491
|
+
const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
|
|
1492
|
+
const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
|
|
1493
|
+
const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
|
|
1494
|
+
"**/.git/**",
|
|
1495
|
+
"**/.hg/**",
|
|
1496
|
+
"**/.jj/**",
|
|
1497
|
+
"**/.next/**",
|
|
1498
|
+
"**/.parcel-cache/**",
|
|
1499
|
+
"**/.pnpm-store/**",
|
|
1500
|
+
"**/.svelte-kit/**",
|
|
1501
|
+
"**/.svn/**",
|
|
1502
|
+
"**/.turbo/**",
|
|
1503
|
+
"**/.venv/**",
|
|
1504
|
+
"**/.vercel/**",
|
|
1505
|
+
"**/.yarn/**",
|
|
1506
|
+
"**/__pycache__/**",
|
|
1507
|
+
"**/node_modules/**",
|
|
1508
|
+
"**/venv/**",
|
|
1509
|
+
"**/*.less",
|
|
1510
|
+
"**/*.lock",
|
|
1511
|
+
"**/*.sass",
|
|
1512
|
+
"**/*.scss",
|
|
1513
|
+
"**/*.styl",
|
|
1514
|
+
"**/*.log",
|
|
1515
|
+
"**/package-lock.json",
|
|
1516
|
+
"**/pnpm-lock.yaml",
|
|
1517
|
+
"**/bun.lockb",
|
|
1518
|
+
"**/.gitignore",
|
|
1519
|
+
"**/.env",
|
|
1520
|
+
"**/.env.*"
|
|
1521
|
+
];
|
|
1491
1522
|
function findLeadingImportInsertionIndex(css) {
|
|
1492
1523
|
const importPattern = /(?:^|\n)\s*@import\b[^;]*;/g;
|
|
1493
1524
|
let insertionIndex = 0;
|
|
@@ -1507,6 +1538,38 @@ function applyMiniProgramTailwindV4DefaultColorCss(css) {
|
|
|
1507
1538
|
function collectCandidates$1(candidates) {
|
|
1508
1539
|
return new Set(candidates ?? []);
|
|
1509
1540
|
}
|
|
1541
|
+
function normalizeRpxTextCandidate(candidate) {
|
|
1542
|
+
return candidate.replace(BARE_RPX_TEXT_CANDIDATE_RE, "$1text-[length:$2]$3");
|
|
1543
|
+
}
|
|
1544
|
+
function normalizeRpxTextCandidates(candidates) {
|
|
1545
|
+
const normalized = /* @__PURE__ */ new Set();
|
|
1546
|
+
const restoreCandidates = /* @__PURE__ */ new Map();
|
|
1547
|
+
for (const candidate of candidates) {
|
|
1548
|
+
const normalizedCandidate = normalizeRpxTextCandidate(candidate);
|
|
1549
|
+
normalized.add(normalizedCandidate);
|
|
1550
|
+
if (normalizedCandidate !== candidate) restoreCandidates.set(normalizedCandidate, candidate);
|
|
1551
|
+
}
|
|
1552
|
+
return {
|
|
1553
|
+
candidates: normalized,
|
|
1554
|
+
restoreCandidates
|
|
1555
|
+
};
|
|
1556
|
+
}
|
|
1557
|
+
function restoreRpxTextCandidates(candidates, restoreCandidates) {
|
|
1558
|
+
if (restoreCandidates.size === 0) return new Set(candidates);
|
|
1559
|
+
return new Set([...candidates].map((candidate) => restoreCandidates.get(candidate) ?? candidate));
|
|
1560
|
+
}
|
|
1561
|
+
function normalizeCssEscapedRpxSelectorValue(value) {
|
|
1562
|
+
return value.replace(/\\([.+-])/g, "$1");
|
|
1563
|
+
}
|
|
1564
|
+
function restoreRpxTextCssSelectors(css, restoreCandidates) {
|
|
1565
|
+
if (restoreCandidates.size === 0 || !css.includes("text-\\[length\\:")) return css;
|
|
1566
|
+
const restoredValues = new Set([...restoreCandidates.keys()].map((candidate) => {
|
|
1567
|
+
return BARE_RPX_TEXT_CANDIDATE_RE.exec(candidate.replace("[length:", "["))?.[2];
|
|
1568
|
+
}).filter((value) => Boolean(value)));
|
|
1569
|
+
return css.replace(RPX_TEXT_LENGTH_SELECTOR_RE, (match, value) => {
|
|
1570
|
+
return restoredValues.has(normalizeCssEscapedRpxSelectorValue(value)) ? `text-\\[${value}\\]` : match;
|
|
1571
|
+
});
|
|
1572
|
+
}
|
|
1510
1573
|
function createStableJson$1(value) {
|
|
1511
1574
|
if (value === void 0) return "undefined";
|
|
1512
1575
|
if (value === null || typeof value !== "object") return JSON.stringify(value);
|
|
@@ -1663,6 +1726,20 @@ function removeUnlayeredTailwindV4PreflightImports(css) {
|
|
|
1663
1726
|
function resolveSourceBase$1(base, sourcePath) {
|
|
1664
1727
|
return node_path.default.isAbsolute(sourcePath) ? sourcePath : node_path.default.resolve(base, sourcePath);
|
|
1665
1728
|
}
|
|
1729
|
+
function createDefaultIgnoredScanSources(base) {
|
|
1730
|
+
return TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS.map((pattern) => ({
|
|
1731
|
+
base,
|
|
1732
|
+
pattern,
|
|
1733
|
+
negated: true
|
|
1734
|
+
}));
|
|
1735
|
+
}
|
|
1736
|
+
function normalizeCssDefinedScanSources(base, entries) {
|
|
1737
|
+
return entries.length > 0 && entries.every((entry) => entry.negated) ? [{
|
|
1738
|
+
base,
|
|
1739
|
+
pattern: "**/*",
|
|
1740
|
+
negated: false
|
|
1741
|
+
}, ...entries] : entries;
|
|
1742
|
+
}
|
|
1666
1743
|
async function resolveCssDefinedScanSources(source) {
|
|
1667
1744
|
let importSourceBase;
|
|
1668
1745
|
let hasSourceNone = false;
|
|
@@ -1683,11 +1760,15 @@ async function resolveCssDefinedScanSources(source) {
|
|
|
1683
1760
|
});
|
|
1684
1761
|
const sourcePatterns = await resolveCssSourceEntries(root, source.base, "**/*");
|
|
1685
1762
|
if (!importSourceBase) {
|
|
1686
|
-
if (sourcePatterns.length > 0) return sourcePatterns;
|
|
1763
|
+
if (sourcePatterns.length > 0) return [...normalizeCssDefinedScanSources(source.base, sourcePatterns), ...createDefaultIgnoredScanSources(source.base)];
|
|
1687
1764
|
if (hasSourceNone) return false;
|
|
1688
1765
|
return;
|
|
1689
1766
|
}
|
|
1690
|
-
return [
|
|
1767
|
+
return [
|
|
1768
|
+
await resolveTailwindSourceEntry(".", importSourceBase, false, "**/*"),
|
|
1769
|
+
...sourcePatterns,
|
|
1770
|
+
...createDefaultIgnoredScanSources(importSourceBase)
|
|
1771
|
+
];
|
|
1691
1772
|
}
|
|
1692
1773
|
async function resolveScanSources(source, scanSources) {
|
|
1693
1774
|
if (scanSources !== true) return scanSources;
|
|
@@ -1727,16 +1808,18 @@ function createTailwindV4Engine(source) {
|
|
|
1727
1808
|
const engine = (0, tailwindcss_patch.createTailwindV4Engine)(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
|
|
1728
1809
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1729
1810
|
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources)) : void 0;
|
|
1730
|
-
const
|
|
1811
|
+
const normalizedCandidates = normalizeRpxTextCandidates(resolveTargetCandidates(new Set([...collectCandidates$1(patchOptions.candidates), ...filesystemCandidates ?? []]), target));
|
|
1731
1812
|
const result = await engine.generate(omitUndefined({
|
|
1732
1813
|
scanSources: false,
|
|
1733
1814
|
...patchOptions,
|
|
1734
|
-
candidates:
|
|
1815
|
+
candidates: normalizedCandidates.candidates
|
|
1735
1816
|
}));
|
|
1736
|
-
const rawCss = result.css;
|
|
1817
|
+
const rawCss = restoreRpxTextCssSelectors(result.css, normalizedCandidates.restoreCandidates);
|
|
1737
1818
|
const css = await transformTailwindV4CssByTarget(rawCss, target, styleOptions);
|
|
1738
1819
|
return {
|
|
1739
1820
|
...result,
|
|
1821
|
+
classSet: restoreRpxTextCandidates(result.classSet, normalizedCandidates.restoreCandidates),
|
|
1822
|
+
rawCandidates: restoreRpxTextCandidates(result.rawCandidates, normalizedCandidates.restoreCandidates),
|
|
1740
1823
|
css,
|
|
1741
1824
|
rawCss,
|
|
1742
1825
|
target
|
|
@@ -1776,15 +1859,18 @@ function createTailwindV4Engine(source) {
|
|
|
1776
1859
|
target: cached.target
|
|
1777
1860
|
};
|
|
1778
1861
|
return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1779
|
-
const
|
|
1862
|
+
const designSystem = await cached.designSystemPromise;
|
|
1863
|
+
const normalizedMissing = normalizeRpxTextCandidates(missingCandidates);
|
|
1864
|
+
const normalizedMissingCandidates = [...normalizedMissing.candidates];
|
|
1865
|
+
const cssByCandidate = designSystem.candidatesToCss(normalizedMissingCandidates);
|
|
1780
1866
|
const rawCssParts = [];
|
|
1781
1867
|
const classSet = /* @__PURE__ */ new Set();
|
|
1782
|
-
for (let index = 0; index <
|
|
1783
|
-
const candidate =
|
|
1868
|
+
for (let index = 0; index < normalizedMissingCandidates.length; index += 1) {
|
|
1869
|
+
const candidate = normalizedMissingCandidates[index];
|
|
1784
1870
|
const css = cssByCandidate[index];
|
|
1785
1871
|
if (candidate && typeof css === "string" && css.trim().length > 0) {
|
|
1786
|
-
rawCssParts.push(css);
|
|
1787
|
-
classSet.add(candidate);
|
|
1872
|
+
rawCssParts.push(restoreRpxTextCssSelectors(css, normalizedMissing.restoreCandidates));
|
|
1873
|
+
classSet.add(normalizedMissing.restoreCandidates.get(candidate) ?? candidate);
|
|
1788
1874
|
}
|
|
1789
1875
|
}
|
|
1790
1876
|
const rawCss = rawCssParts.join("\n");
|
|
@@ -2260,6 +2346,7 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
2260
2346
|
let hasTailwindCssImport = false;
|
|
2261
2347
|
const [sourceEntries, configEntries] = await Promise.all([resolveCssSourceEntries(root, base, VITE_SOURCE_CANDIDATE_PATTERN), resolveConfigContentEntries(root, base)]);
|
|
2262
2348
|
const entries = [...configEntries.entries, ...sourceEntries];
|
|
2349
|
+
const hasPositiveEntries = entries.some((entry) => !entry.negated);
|
|
2263
2350
|
const inlineCandidates = collectCssInlineSourceCandidates(root);
|
|
2264
2351
|
root.walkAtRules("import", (rule) => {
|
|
2265
2352
|
if (!isTailwindCssImport(rule.params)) return;
|
|
@@ -2284,7 +2371,7 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
2284
2371
|
inlineCandidates,
|
|
2285
2372
|
dependencies: configEntries.dependencies
|
|
2286
2373
|
};
|
|
2287
|
-
if (
|
|
2374
|
+
if (hasPositiveEntries) return {
|
|
2288
2375
|
entries,
|
|
2289
2376
|
explicit: true,
|
|
2290
2377
|
inlineCandidates,
|
|
@@ -2297,7 +2384,7 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
2297
2384
|
dependencies: configEntries.dependencies
|
|
2298
2385
|
};
|
|
2299
2386
|
return hasTailwindCssImport ? {
|
|
2300
|
-
entries
|
|
2387
|
+
entries,
|
|
2301
2388
|
explicit: false,
|
|
2302
2389
|
inlineCandidates,
|
|
2303
2390
|
dependencies: configEntries.dependencies
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-vHlppqaZ.js");
|
|
3
|
+
const require_generator = require("./generator-BcH28HU-.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CWdfLHON.js");
|
|
5
|
+
const require_precheck = require("./precheck-DtYqujIx.js");
|
|
6
6
|
const require_utils = require("./utils-4ODFyoqD.js");
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_source_candidates = require("./source-candidates-
|
|
9
|
-
const require_bundle_state = require("./bundle-state-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-BtUBeOes.js");
|
|
8
|
+
const require_source_candidates = require("./source-candidates-lHtAHLQq.js");
|
|
9
|
+
const require_bundle_state = require("./bundle-state-DXFq2nEo.js");
|
|
10
10
|
require("./logger-EVNB9z7i.js");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -568,7 +568,7 @@ function createCssHandlerOptions(opts, majorVersion, file) {
|
|
|
568
568
|
}
|
|
569
569
|
function shouldGenerateCssByGenerator(opts, file, rawSource, processed) {
|
|
570
570
|
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
571
|
-
if (generatorOptions.target === "web") return false;
|
|
571
|
+
if (generatorOptions.target === "web" && opts.twPatcher.majorVersion !== 3) return false;
|
|
572
572
|
if (require_incremental_runtime_class_set.hasTailwindGeneratedCssMarkers(rawSource) || require_incremental_runtime_class_set.hasTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })) return true;
|
|
573
573
|
if (opts.twPatcher.majorVersion === 3) return false;
|
|
574
574
|
return processed && shouldFinalizeProcessedCssAsset(opts, file);
|
|
@@ -644,7 +644,7 @@ function createViteCssFinalizerOutputPlugin(context) {
|
|
|
644
644
|
styleHandler: opts.styleHandler,
|
|
645
645
|
debug
|
|
646
646
|
}) : void 0;
|
|
647
|
-
const nextCss = generated?.css ?? (await opts.styleHandler(rawSource, cssHandlerOptions)).css;
|
|
647
|
+
const nextCss = generated?.css ?? (generatorOptions.target === "web" ? rawSource : (await opts.styleHandler(rawSource, cssHandlerOptions)).css);
|
|
648
648
|
if (generated) {
|
|
649
649
|
registerGeneratorDependencies$1(this, generated.dependencies);
|
|
650
650
|
debug("css finalizer generated result: %s bytes=%d", file, nextCss.length);
|
|
@@ -1000,6 +1000,7 @@ function createGenerateBundleHook(context) {
|
|
|
1000
1000
|
const { cache, onEnd, onStart, onUpdate, styleHandler, templateHandler, jsHandler, uniAppX } = opts;
|
|
1001
1001
|
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
1002
1002
|
const isWebGeneratorTarget = generatorOptions.target === "web";
|
|
1003
|
+
const shouldGenerateWebCssByGenerator = isWebGeneratorTarget && runtimeState.twPatcher.majorVersion === 3;
|
|
1003
1004
|
const { getCssHandlerOptions, getCssUserHandlerOptions } = cssHandlerOptions;
|
|
1004
1005
|
await runtimeState.readyPromise;
|
|
1005
1006
|
debug("start");
|
|
@@ -1041,7 +1042,7 @@ function createGenerateBundleHook(context) {
|
|
|
1041
1042
|
const snapshotStart = performance.now();
|
|
1042
1043
|
const snapshot = require_bundle_state.buildBundleSnapshot(bundle, opts, outDir, state, disableDirtyOptimization || !useIncrementalMode);
|
|
1043
1044
|
recordTimingDetail("snapshot", snapshotStart);
|
|
1044
|
-
const useBundleRuntimeClassSet = useIncrementalMode || runtimeState.twPatcher.majorVersion === 4;
|
|
1045
|
+
const useBundleRuntimeClassSet = !isWebGeneratorTarget && (useIncrementalMode || runtimeState.twPatcher.majorVersion === 4);
|
|
1045
1046
|
const forceRuntimeRefreshBySource = useIncrementalMode && hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
1046
1047
|
const processFiles = snapshot.processFiles;
|
|
1047
1048
|
logBundleProcessPlan({
|
|
@@ -1061,7 +1062,7 @@ function createGenerateBundleHook(context) {
|
|
|
1061
1062
|
const hasRuntimeAffectingChanges = hasRuntimeAffectingSourceChanges(snapshot.runtimeAffectingChangedByType);
|
|
1062
1063
|
const useV3OxideSourceRuntime = runtimeState.twPatcher.majorVersion === 3 && sourceCandidates.size > 0 && hasCssAssetEntry && !forceRuntimeRefreshByEnv && !disableV3OxideSourceRuntime;
|
|
1063
1064
|
const runtimeStart = performance.now();
|
|
1064
|
-
const runtime = useV3OxideSourceRuntime ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv, {
|
|
1065
|
+
const runtime = isWebGeneratorTarget && !shouldGenerateWebCssByGenerator ? /* @__PURE__ */ new Set() : useV3OxideSourceRuntime ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv, {
|
|
1065
1066
|
allowBaselineOnlyInitialSync: true,
|
|
1066
1067
|
baseClassSet: sourceCandidates
|
|
1067
1068
|
}) : useBundleRuntimeClassSet ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv, { allowBaselineOnlyInitialSync: buildCommand }) : await context.ensureRuntimeClassSet(forceRuntimeRefreshByEnv);
|
|
@@ -1122,6 +1123,10 @@ function createGenerateBundleHook(context) {
|
|
|
1122
1123
|
const { file, output: originalSource, source: originalEntrySource, type } = entry;
|
|
1123
1124
|
if (type === "html" && originalSource.type === "asset") {
|
|
1124
1125
|
metrics.html.total++;
|
|
1126
|
+
if (isWebGeneratorTarget) {
|
|
1127
|
+
debug("html skip web target: %s", file);
|
|
1128
|
+
continue;
|
|
1129
|
+
}
|
|
1125
1130
|
if (!processFiles.html.has(file)) continue;
|
|
1126
1131
|
const rawSource = originalEntrySource;
|
|
1127
1132
|
tasks.push(timeTask("html", () => require_incremental_runtime_class_set.processCachedTask({
|
|
@@ -1186,7 +1191,7 @@ function createGenerateBundleHook(context) {
|
|
|
1186
1191
|
debug("css skip vite-processed asset: %s", outputFile);
|
|
1187
1192
|
continue;
|
|
1188
1193
|
}
|
|
1189
|
-
if (isWebGeneratorTarget) {
|
|
1194
|
+
if (isWebGeneratorTarget && !shouldGenerateWebCssByGenerator) {
|
|
1190
1195
|
applyCssResult(rawSource);
|
|
1191
1196
|
markCssAssetProcessed?.(originalSource, outputFile);
|
|
1192
1197
|
onUpdate(outputFile, rawSource, rawSource);
|
|
@@ -1263,6 +1268,12 @@ function createGenerateBundleHook(context) {
|
|
|
1263
1268
|
debug("css handle via tailwind v%s engine(%s): %s", runtimeState.twPatcher.majorVersion, generated.target, outputFile);
|
|
1264
1269
|
return generated.css;
|
|
1265
1270
|
}
|
|
1271
|
+
if (isWebGeneratorTarget) {
|
|
1272
|
+
metrics.css.elapsed += measureElapsed(start);
|
|
1273
|
+
metrics.css.transformed++;
|
|
1274
|
+
debug("css preserve web target: %s", outputFile);
|
|
1275
|
+
return rawSource;
|
|
1276
|
+
}
|
|
1266
1277
|
const { css } = await styleHandler(rawSource, getCssHandlerOptions(file));
|
|
1267
1278
|
if (debugCssDiff) debug("css diff %s: %s", file, summarizeStringDiff(rawSource, css));
|
|
1268
1279
|
metrics.css.elapsed += measureElapsed(start);
|
|
@@ -1281,6 +1292,10 @@ function createGenerateBundleHook(context) {
|
|
|
1281
1292
|
}
|
|
1282
1293
|
if (type !== "js") continue;
|
|
1283
1294
|
metrics.js.total++;
|
|
1295
|
+
if (isWebGeneratorTarget) {
|
|
1296
|
+
debug("js skip web target: %s", file);
|
|
1297
|
+
continue;
|
|
1298
|
+
}
|
|
1284
1299
|
const shouldTransformJs = !useIncrementalMode || processFiles.js.has(file);
|
|
1285
1300
|
if (!shouldTransformJs) debug("js skip transform (clean), replay cache: %s", file);
|
|
1286
1301
|
if (originalSource.type === "chunk") {
|
|
@@ -1630,13 +1645,14 @@ function stripTailwindConfigDirectives(code) {
|
|
|
1630
1645
|
return code.replace(/^\s*@config\s+(?:"[^"]+"|'[^']+')[^;\n]*;\s*$/gm, "");
|
|
1631
1646
|
}
|
|
1632
1647
|
function createRewriteCssImportsPlugins(options) {
|
|
1633
|
-
if (!options.shouldRewrite) return [];
|
|
1648
|
+
if (!options.shouldRewrite && !options.shouldOwnTailwindGeneration) return [];
|
|
1634
1649
|
const { appType, getAppType, rootImport, shouldOwnTailwindGeneration, weappTailwindcssDirPosix } = options;
|
|
1635
1650
|
const resolveAppType = () => getAppType?.() ?? appType;
|
|
1636
1651
|
return [{
|
|
1637
1652
|
name: `${require_precheck.vitePluginName}:rewrite-css-imports`,
|
|
1638
1653
|
enforce: "pre",
|
|
1639
1654
|
resolveId(id, importer) {
|
|
1655
|
+
if (!options.shouldRewrite) return null;
|
|
1640
1656
|
const replacement = resolveTailwindcssImport(id, weappTailwindcssDirPosix, {
|
|
1641
1657
|
join: joinPosixPath,
|
|
1642
1658
|
appType: resolveAppType(),
|
|
@@ -1658,6 +1674,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1658
1674
|
};
|
|
1659
1675
|
}
|
|
1660
1676
|
}
|
|
1677
|
+
if (!options.shouldRewrite) return null;
|
|
1661
1678
|
const rewritten = rewriteTailwindcssImportsInCode(code, weappTailwindcssDirPosix, {
|
|
1662
1679
|
join: joinPosixPath,
|
|
1663
1680
|
appType: resolveAppType(),
|
|
@@ -1867,7 +1884,9 @@ function WeappTailwindcss(options = {}) {
|
|
|
1867
1884
|
const tailwindcssMajorVersion = initialTwPatcher.majorVersion ?? 0;
|
|
1868
1885
|
const shouldOwnTailwindGeneration = !disabledOptions.plugin;
|
|
1869
1886
|
const shouldRewriteCssImports = tailwindcssMajorVersion >= 4;
|
|
1870
|
-
const
|
|
1887
|
+
const generatorOptions = require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator);
|
|
1888
|
+
const isWebGeneratorTarget = generatorOptions.target === "web";
|
|
1889
|
+
const shouldInferAppType = !hasExplicitAppType && generatorOptions.target !== "web";
|
|
1871
1890
|
const hasInitialTailwindCssRoots = require_tailwindcss.hasConfiguredTailwindV4CssRoots({
|
|
1872
1891
|
...options,
|
|
1873
1892
|
cssEntries: opts.cssEntries ?? options.cssEntries
|
|
@@ -1942,6 +1961,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
1942
1961
|
const viteProcessedCssAssetResults = /* @__PURE__ */ new Map();
|
|
1943
1962
|
const rememberedMainCssSources = /* @__PURE__ */ new Map();
|
|
1944
1963
|
const rememberedMainCssSignatureByFile = /* @__PURE__ */ new Map();
|
|
1964
|
+
const tailwindRootCssModuleIds = /* @__PURE__ */ new Set();
|
|
1945
1965
|
const { runtimeState, refreshRuntimeState, ensureRuntimeClassSet, ensureBundleRuntimeClassSet } = createViteRuntimeClassSet({
|
|
1946
1966
|
opts,
|
|
1947
1967
|
initialTwPatcher,
|
|
@@ -1966,6 +1986,9 @@ function WeappTailwindcss(options = {}) {
|
|
|
1966
1986
|
recordedGeneratorCandidates = new Set(candidates);
|
|
1967
1987
|
};
|
|
1968
1988
|
const getRecordedGeneratorCandidates = () => recordedGeneratorCandidates;
|
|
1989
|
+
const invalidateRecordedGeneratorCandidates = () => {
|
|
1990
|
+
recordedGeneratorCandidates = void 0;
|
|
1991
|
+
};
|
|
1969
1992
|
const getSourceCandidates = () => sourceCandidateCollector.values();
|
|
1970
1993
|
const getSourceCandidatesForEntries = (entries) => sourceCandidateCollector.valuesForEntries(entries);
|
|
1971
1994
|
const isWatchBuild = () => resolvedConfig?.command === "build" && resolvedConfig.build.watch != null;
|
|
@@ -2123,6 +2146,28 @@ function WeappTailwindcss(options = {}) {
|
|
|
2123
2146
|
const markViteProcessedCssSource = (file) => {
|
|
2124
2147
|
viteProcessedCssSourceFiles.add(normalizeViteProcessedCssFile(file));
|
|
2125
2148
|
};
|
|
2149
|
+
const rememberTailwindRootCssModule = (id) => {
|
|
2150
|
+
if (!shouldOwnTailwindGeneration) return;
|
|
2151
|
+
tailwindRootCssModuleIds.add(id);
|
|
2152
|
+
tailwindRootCssModuleIds.add((0, _weapp_tailwindcss_shared.cleanUrl)(id));
|
|
2153
|
+
};
|
|
2154
|
+
const resolveHotTailwindCssModules = (ctx) => {
|
|
2155
|
+
const modules = [];
|
|
2156
|
+
const seenModules = /* @__PURE__ */ new Set();
|
|
2157
|
+
for (const id of tailwindRootCssModuleIds) {
|
|
2158
|
+
const candidates = [ctx.server.moduleGraph.getModuleById(id), ...ctx.server.moduleGraph.getModulesByFile(id) ?? []].filter((mod) => {
|
|
2159
|
+
if (mod == null) return false;
|
|
2160
|
+
return require_bundle_state.isSourceStyleRequest(mod.id ?? mod.url);
|
|
2161
|
+
});
|
|
2162
|
+
for (const mod of candidates) {
|
|
2163
|
+
if (seenModules.has(mod)) continue;
|
|
2164
|
+
seenModules.add(mod);
|
|
2165
|
+
ctx.server.moduleGraph.invalidateModule(mod);
|
|
2166
|
+
modules.push(mod);
|
|
2167
|
+
}
|
|
2168
|
+
}
|
|
2169
|
+
return modules;
|
|
2170
|
+
};
|
|
2126
2171
|
const matchesViteProcessedCssSource = (candidate) => {
|
|
2127
2172
|
const normalized = normalizeViteProcessedCssFile(candidate);
|
|
2128
2173
|
return viteProcessedCssSourceFiles.has(normalized);
|
|
@@ -2164,6 +2209,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2164
2209
|
for (const dependency of generated.dependencies) hookContext?.addWatchFile?.(dependency);
|
|
2165
2210
|
viteGeneratedCssByFile.set(file, generated.css);
|
|
2166
2211
|
markViteProcessedCssSource(file);
|
|
2212
|
+
rememberTailwindRootCssModule(id);
|
|
2167
2213
|
recordGeneratorCandidates(runtime);
|
|
2168
2214
|
rememberMainCssSource(file, code);
|
|
2169
2215
|
debug("css generated for vite postcss pipeline: %s bytes=%d", file, generated.css.length);
|
|
@@ -2222,6 +2268,7 @@ function WeappTailwindcss(options = {}) {
|
|
|
2222
2268
|
});
|
|
2223
2269
|
const isIosPlatform = require_utils.resolveUniUtsPlatform().isAppIos;
|
|
2224
2270
|
const prepareTailwindGeneration = async () => {
|
|
2271
|
+
if (isWebGeneratorTarget && runtimeState.twPatcher.majorVersion !== 3) return;
|
|
2225
2272
|
if (shouldDiscoverAutoCssSources()) await discoverAndRegisterAutoCssSources();
|
|
2226
2273
|
await syncSourceCandidateScan();
|
|
2227
2274
|
};
|
|
@@ -2272,8 +2319,11 @@ function WeappTailwindcss(options = {}) {
|
|
|
2272
2319
|
}, { emit: false });
|
|
2273
2320
|
},
|
|
2274
2321
|
async handleHotUpdate(ctx) {
|
|
2275
|
-
|
|
2322
|
+
return hmrTimingRecorder.measure("sourceCandidates.handleHotUpdate", async () => {
|
|
2276
2323
|
await syncChangedSourceCandidateFile(ctx.file);
|
|
2324
|
+
invalidateRecordedGeneratorCandidates();
|
|
2325
|
+
const cssModules = resolveHotTailwindCssModules(ctx);
|
|
2326
|
+
return cssModules.length > 0 ? [...ctx.modules, ...cssModules] : void 0;
|
|
2277
2327
|
}, { emit: false });
|
|
2278
2328
|
},
|
|
2279
2329
|
async buildStart() {
|