weapp-tailwindcss 5.1.2 → 5.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/auto-CrJJc5rK.mjs +13 -0
- package/dist/bundlers/gulp/index.d.ts +3 -3
- package/dist/bundlers/rspack/index.d.ts +20 -0
- package/dist/bundlers/shared/generator-css/local-imports.d.ts +1 -10
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
- package/dist/bundlers/vite/css-memory.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +12 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
- package/dist/bundlers/vite/processed-css-assets.d.ts +1 -0
- package/dist/bundlers/vite/serve-js-transform.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +4 -1
- package/dist/cli.js +8 -8
- package/dist/cli.mjs +8 -8
- package/dist/{context-C-r8ki7x.mjs → context-Bkpmt3ja.mjs} +62 -36
- package/dist/{context-CH4HFZP2.js → context-DCVMkTRj.js} +76 -44
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +1 -1
- package/dist/css-macro/postcss.js +2 -2
- package/dist/css-macro.js +3 -3
- package/dist/css-macro.mjs +1 -1
- package/dist/{defaults-CmFBmxsr.js → defaults-DQhgnnn-.js} +1 -1
- package/dist/defaults.js +1 -1
- package/dist/framework/index.d.ts +7 -2
- package/dist/framework/platform.d.ts +2 -0
- package/dist/framework.js +39 -8
- package/dist/framework.mjs +33 -6
- package/dist/{generator-BsPIaLtV.mjs → generator-24-HgU9F.mjs} +5 -3
- package/dist/{generator-B6pUjNdD.js → generator-CilgHtxb.js} +6 -4
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-CTdcASq8.mjs → gulp-0RsqkF_d.mjs} +4 -4
- package/dist/{gulp-BBCeA7ky.js → gulp-Bogfnoki.js} +12 -11
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BRx-KnBh.mjs → hmr-timing-BRNaz8Od.mjs} +62 -166
- package/dist/{hmr-timing-Da1eI8S0.js → hmr-timing-BV6nFPoT.js} +65 -187
- package/dist/index.js +9 -4
- package/dist/index.mjs +7 -6
- package/dist/postcss-html-transform.js +2 -2
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets/shared.d.ts +4 -0
- package/dist/presets.js +32 -16
- package/dist/presets.mjs +28 -14
- package/dist/reset.js +2 -2
- package/dist/rspack.d.ts +3 -0
- package/dist/rspack.js +68 -0
- package/dist/rspack.mjs +62 -0
- package/dist/{source-candidate-scan-signature-Dugfplms.mjs → source-candidate-scan-signature-BB1hvW68.mjs} +12 -6
- package/dist/{source-candidate-scan-signature-BO6JSskQ.js → source-candidate-scan-signature-CaDT0gkj.js} +16 -9
- package/dist/tailwindcss/v4-engine/css-macro-source.d.ts +2 -0
- package/dist/{tailwindcss-B5mRo0-M.mjs → tailwindcss-D0JF0fuZ.mjs} +6 -6
- package/dist/{tailwindcss-dbrbY4cd.js → tailwindcss-D2xs4OEu.js} +11 -11
- package/dist/{transform-DeqFRp1D.mjs → transform-BP86eSZp.mjs} +19 -19
- package/dist/{transform-BLleu_bA.js → transform-CXCQ28Tc.js} +47 -47
- package/dist/{utils-BCa37Wqj.js → utils-D3h8j7Mk.js} +2 -2
- package/dist/{v4-engine-C3qSwQ-e.mjs → v4-engine-BuuYDXt1.mjs} +58 -118
- package/dist/{v4-engine-ON_oSLfO.js → v4-engine-CKtsdKxK.js} +66 -120
- package/dist/{vite-CXmUiI9f.mjs → vite-B1SlBmqO.mjs} +436 -73
- package/dist/{vite-Da4uEG_u.js → vite-BYgT1ir9.js} +443 -80
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +143 -216
- package/dist/weapp-tw-runtime-classset-loader.js +2 -2
- package/dist/{webpack-CrFZmdo7.mjs → webpack-Bg6pefpb.mjs} +109 -18
- package/dist/{webpack-Cwqnznng.js → webpack-khSwkXP5.js} +115 -24
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +9 -4
- package/dist/auto-Ba6hDrse.mjs +0 -13
- /package/dist/{chunk-emK7D4bc.js → rolldown-runtime-emK7D4bc.js} +0 -0
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as transformCssMacroCss, o as transformCssMacroTailwindV4Source, r as hasCssMacroTailwindV4Source, s as withCssMacroStyleOptions, t as hasCssMacroStyleOptions } from "./auto-CrJJc5rK.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import fs, { existsSync, readFileSync, readdirSync, realpathSync } from "node:fs";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { createTailwindV4Engine, extractRawCandidates, loadTailwindV4DesignSystem, resolveProjectSourceFiles, resolveTailwindV4Source, resolveValidTailwindV4Candidates as resolveValidTailwindV4Candidates$1 } from "@tailwindcss-mangle/engine";
|
|
7
|
-
import { createStyleHandler, normalizeTailwindcssWebRpxDeclarations, postcss, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss } from "@weapp-tailwindcss/postcss";
|
|
7
|
+
import { analyzeTailwindCssDirectives, createStyleHandler, isTailwindCssGenerationDirective, isTailwindCssImportAtRule, isTailwindCssPackageJsonImportRequest, normalizeTailwindCssImportRequest, normalizeTailwindcssWebRpxDeclarations, parseTailwindCssConfigRequest, parseTailwindCssDirectiveRequest, postcss, protectDynamicColorMixAlpha, pruneMiniProgramGeneratedCss } from "@weapp-tailwindcss/postcss";
|
|
8
8
|
import { LRUCache } from "lru-cache";
|
|
9
9
|
import { stat } from "node:fs/promises";
|
|
10
10
|
import micromatch from "micromatch";
|
|
@@ -63,6 +63,15 @@ function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
|
|
|
63
63
|
return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
|
|
64
64
|
}
|
|
65
65
|
//#endregion
|
|
66
|
+
//#region src/tailwindcss/v4-engine/css-macro-source.ts
|
|
67
|
+
function resolveCssMacroTailwindV4Source(source) {
|
|
68
|
+
const css = transformCssMacroTailwindV4Source(source.css);
|
|
69
|
+
return css === source.css ? source : {
|
|
70
|
+
...source,
|
|
71
|
+
css
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
//#endregion
|
|
66
75
|
//#region src/tailwindcss/v4-engine/tailwind-v4-default-colors.ts
|
|
67
76
|
const TAILWIND_V4_COLOR_STEPS = [
|
|
68
77
|
"50",
|
|
@@ -1164,7 +1173,7 @@ function createIncrementalStyleOptions(styleOptions) {
|
|
|
1164
1173
|
};
|
|
1165
1174
|
}
|
|
1166
1175
|
function resolveStyleOptions(source, options) {
|
|
1167
|
-
return
|
|
1176
|
+
return hasCssMacroTailwindV4Source(source.css) ? withCssMacroStyleOptions(options) : options;
|
|
1168
1177
|
}
|
|
1169
1178
|
function collectCustomPropertyValues(css) {
|
|
1170
1179
|
const values = /* @__PURE__ */ new Map();
|
|
@@ -1231,11 +1240,11 @@ function createTailwindV4Engine$1(source) {
|
|
|
1231
1240
|
async function generateOnce(generateSource, options = {}) {
|
|
1232
1241
|
const { scanSources = true, styleOptions, target = "weapp", ...patchOptions } = options;
|
|
1233
1242
|
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
1234
|
-
const engine = createTailwindV4Engine(createCompatibleSource(generateSource, target));
|
|
1243
|
+
const engine = createTailwindV4Engine(createCompatibleSource(resolveCssMacroTailwindV4Source(generateSource), target));
|
|
1235
1244
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1236
1245
|
const delegateSourceScan = shouldDelegateWebSourceScanToTailwind(target, resolvedScanSources);
|
|
1237
1246
|
const filesystemCandidates = !delegateSourceScan && Array.isArray(resolvedScanSources) ? new Set(await extractRawCandidates(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
|
|
1238
|
-
const normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target), target, resolvedStyleOptions);
|
|
1247
|
+
const normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(/* @__PURE__ */ new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target), target, resolvedStyleOptions);
|
|
1239
1248
|
const result = await engine.generate(omitUndefined({
|
|
1240
1249
|
scanSources: delegateSourceScan ? resolvedScanSources : false,
|
|
1241
1250
|
...patchOptions,
|
|
@@ -1254,13 +1263,14 @@ function createTailwindV4Engine$1(source) {
|
|
|
1254
1263
|
}
|
|
1255
1264
|
async function generateWithIncrementalCache(options = {}) {
|
|
1256
1265
|
const target = options.target ?? "weapp";
|
|
1257
|
-
const
|
|
1266
|
+
const cssMacroSource = resolveCssMacroTailwindV4Source(source);
|
|
1267
|
+
const compatibleSource = createCompatibleSource(cssMacroSource, target);
|
|
1258
1268
|
const requestedCandidates = resolveTargetCandidates(options.candidates, target);
|
|
1259
1269
|
const styleOptions = resolveStyleOptions(source, options.styleOptions);
|
|
1260
|
-
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(
|
|
1270
|
+
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(cssMacroSource, options);
|
|
1261
1271
|
const cacheKey = createIncrementalGenerateCacheKey(compatibleSource, target, styleOptions);
|
|
1262
1272
|
if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1263
|
-
const generated = await generateOnce(
|
|
1273
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1264
1274
|
if (!seedIncrementalGenerateCache({
|
|
1265
1275
|
compatibleSource,
|
|
1266
1276
|
generated,
|
|
@@ -1273,7 +1283,7 @@ function createTailwindV4Engine$1(source) {
|
|
|
1273
1283
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
1274
1284
|
if (cached) {
|
|
1275
1285
|
if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1276
|
-
const generated = await generateOnce(
|
|
1286
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1277
1287
|
if (!seedIncrementalGenerateCache({
|
|
1278
1288
|
compatibleSource,
|
|
1279
1289
|
generated,
|
|
@@ -1297,7 +1307,7 @@ function createTailwindV4Engine$1(source) {
|
|
|
1297
1307
|
target: cached.target
|
|
1298
1308
|
};
|
|
1299
1309
|
if (shouldRebuildIncrementalEntry(cached, requestedCandidates, missingCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1300
|
-
const generated = await generateOnce(
|
|
1310
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1301
1311
|
if (!seedIncrementalGenerateCache({
|
|
1302
1312
|
compatibleSource,
|
|
1303
1313
|
generated,
|
|
@@ -1347,7 +1357,7 @@ function createTailwindV4Engine$1(source) {
|
|
|
1347
1357
|
});
|
|
1348
1358
|
}
|
|
1349
1359
|
return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1350
|
-
const generated = await generateOnce(
|
|
1360
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1351
1361
|
seedIncrementalGenerateCache({
|
|
1352
1362
|
compatibleSource,
|
|
1353
1363
|
generated,
|
|
@@ -1490,14 +1500,14 @@ function parseConfigRequest$1(params) {
|
|
|
1490
1500
|
function isPackageJsonImportRequest$1(request) {
|
|
1491
1501
|
return typeof request === "string" && request.startsWith("#");
|
|
1492
1502
|
}
|
|
1493
|
-
function isWeappTailwindcssImportRequest
|
|
1503
|
+
function isWeappTailwindcssImportRequest(request) {
|
|
1494
1504
|
return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
|
|
1495
1505
|
}
|
|
1496
1506
|
function isTailwindImportRequest$1(request) {
|
|
1497
1507
|
return request === "tailwindcss" || request === "tailwindcss4" || request?.startsWith("tailwindcss/") || request?.startsWith("tailwindcss4/");
|
|
1498
1508
|
}
|
|
1499
1509
|
function normalizeTailwindImportRequest$1(request, options = {}) {
|
|
1500
|
-
if (options.importFallback && isWeappTailwindcssImportRequest
|
|
1510
|
+
if (options.importFallback && isWeappTailwindcssImportRequest(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
|
|
1501
1511
|
return request;
|
|
1502
1512
|
}
|
|
1503
1513
|
function replaceImportRequest$1(params, request, replacement) {
|
|
@@ -1509,7 +1519,7 @@ function normalizeTailwindDirectiveLine(line, options = {}) {
|
|
|
1509
1519
|
const trimmed = line.trimStart();
|
|
1510
1520
|
if (/^@(?:use|forward)\b/.test(trimmed)) {
|
|
1511
1521
|
const request = parseImportRequest$1(trimmed.replace(/^@(?:use|forward)\b/, ""));
|
|
1512
|
-
if (isTailwindImportRequest$1(request) || options.importFallback && isWeappTailwindcssImportRequest
|
|
1522
|
+
if (isTailwindImportRequest$1(request) || options.importFallback && isWeappTailwindcssImportRequest(request)) {
|
|
1513
1523
|
const normalizedRequest = normalizeTailwindImportRequest$1(request, options);
|
|
1514
1524
|
return replaceImportRequest$1(line.replace(/^(\s*)@(?:use|forward)\b/, "$1@import"), request, normalizedRequest);
|
|
1515
1525
|
}
|
|
@@ -1517,7 +1527,7 @@ function normalizeTailwindDirectiveLine(line, options = {}) {
|
|
|
1517
1527
|
}
|
|
1518
1528
|
if (!options.importFallback || !trimmed.startsWith("@import")) return line;
|
|
1519
1529
|
const request = parseImportRequest$1(trimmed.replace(/^@import\b/, ""));
|
|
1520
|
-
if (!request || !isWeappTailwindcssImportRequest
|
|
1530
|
+
if (!request || !isWeappTailwindcssImportRequest(request)) return line;
|
|
1521
1531
|
return replaceImportRequest$1(line, request, request.replace(/^weapp-tailwindcss/, "tailwindcss"));
|
|
1522
1532
|
}
|
|
1523
1533
|
function extractTailwindDirectiveLines(rawSource, options = {}) {
|
|
@@ -1637,7 +1647,7 @@ function extractConfigRequestFromSource(rawSource) {
|
|
|
1637
1647
|
}
|
|
1638
1648
|
//#endregion
|
|
1639
1649
|
//#region src/bundlers/shared/generator-css/directives.ts
|
|
1640
|
-
const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
|
|
1650
|
+
const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = /* @__PURE__ */ new Set([
|
|
1641
1651
|
"config",
|
|
1642
1652
|
"custom-variant",
|
|
1643
1653
|
"layer",
|
|
@@ -1649,45 +1659,21 @@ const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
|
|
|
1649
1659
|
"utility",
|
|
1650
1660
|
"variant"
|
|
1651
1661
|
]);
|
|
1652
|
-
const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
|
|
1653
|
-
"config",
|
|
1654
|
-
"custom-variant",
|
|
1655
|
-
"plugin",
|
|
1656
|
-
"source",
|
|
1657
|
-
"tailwind",
|
|
1658
|
-
"theme",
|
|
1659
|
-
"utility",
|
|
1660
|
-
"variant"
|
|
1661
|
-
]);
|
|
1662
1662
|
const TAILWIND_ROOT_DIRECTIVE_RE = /@(?:import\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|(?:use|forward)\s+(?:url\(\s*)?["']?tailwindcss4?(?:\/[^"')\s]*)?|tailwind|config|custom-variant|plugin|source|theme|utility|variant)\b/;
|
|
1663
1663
|
function parseImportRequest(params) {
|
|
1664
|
-
return
|
|
1664
|
+
return parseTailwindCssDirectiveRequest(params);
|
|
1665
1665
|
}
|
|
1666
1666
|
function hasLocalCssImport(rawSource) {
|
|
1667
|
-
|
|
1668
|
-
try {
|
|
1669
|
-
postcss.parse(rawSource).walkAtRules("import", (rule) => {
|
|
1670
|
-
const request = parseImportRequest(rule.params);
|
|
1671
|
-
if (request?.startsWith(".") === true || request?.startsWith("/") === true) {
|
|
1672
|
-
found = true;
|
|
1673
|
-
return false;
|
|
1674
|
-
}
|
|
1675
|
-
});
|
|
1676
|
-
} catch {}
|
|
1677
|
-
return found;
|
|
1667
|
+
return analyzeParseableTailwindDirectives(rawSource)?.hasLocalCssImport ?? false;
|
|
1678
1668
|
}
|
|
1679
1669
|
function parseConfigRequest(params) {
|
|
1680
|
-
return
|
|
1670
|
+
return parseTailwindCssConfigRequest(params);
|
|
1681
1671
|
}
|
|
1682
1672
|
function isPackageJsonImportRequest(request) {
|
|
1683
|
-
return
|
|
1684
|
-
}
|
|
1685
|
-
function isWeappTailwindcssImportRequest(request) {
|
|
1686
|
-
return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
|
|
1673
|
+
return isTailwindCssPackageJsonImportRequest(request);
|
|
1687
1674
|
}
|
|
1688
1675
|
function normalizeTailwindImportRequest(request, options = {}) {
|
|
1689
|
-
|
|
1690
|
-
return request;
|
|
1676
|
+
return normalizeTailwindCssImportRequest(request, options);
|
|
1691
1677
|
}
|
|
1692
1678
|
function replaceImportRequest(params, request, replacement) {
|
|
1693
1679
|
const index = params.indexOf(request);
|
|
@@ -1743,12 +1729,11 @@ function normalizeTailwindSourceDirectives(rawSource, options = {}) {
|
|
|
1743
1729
|
}
|
|
1744
1730
|
}
|
|
1745
1731
|
function isTailwindImportRequest(request) {
|
|
1746
|
-
|
|
1732
|
+
const normalized = normalizeTailwindImportRequest(request);
|
|
1733
|
+
return normalized === "tailwindcss" || normalized === "tailwindcss4" || normalized?.startsWith("tailwindcss/") === true || normalized?.startsWith("tailwindcss4/") === true;
|
|
1747
1734
|
}
|
|
1748
1735
|
function isTailwindImportAtRule(node, options = {}) {
|
|
1749
|
-
|
|
1750
|
-
if (node.name !== "import" && node.name !== "use" && node.name !== "forward") return false;
|
|
1751
|
-
return isTailwindImportRequest(normalizeTailwindImportRequest(parseImportRequest(node.params), options));
|
|
1736
|
+
return isTailwindCssImportAtRule(node, options);
|
|
1752
1737
|
}
|
|
1753
1738
|
function isTailwindSourceDirective(node, options = {}) {
|
|
1754
1739
|
if (node.type !== "atrule") return false;
|
|
@@ -1762,10 +1747,18 @@ function hasGeneratedCssArtifacts(rawSource) {
|
|
|
1762
1747
|
return hasTailwindGeneratedCssMarkers(rawSource) && !GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource);
|
|
1763
1748
|
}
|
|
1764
1749
|
function isTailwindGenerationDirective(node, options = {}) {
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1750
|
+
return isTailwindCssGenerationDirective(node, options);
|
|
1751
|
+
}
|
|
1752
|
+
function analyzeParseableTailwindDirectives(rawSource, options = {}) {
|
|
1753
|
+
try {
|
|
1754
|
+
const ignoreLayer = options.ignoreLayer ?? hasGeneratedCssArtifacts(rawSource);
|
|
1755
|
+
return analyzeTailwindCssDirectives(postcss.parse(rawSource), {
|
|
1756
|
+
...options,
|
|
1757
|
+
ignoreLayer
|
|
1758
|
+
});
|
|
1759
|
+
} catch {
|
|
1760
|
+
return;
|
|
1761
|
+
}
|
|
1769
1762
|
}
|
|
1770
1763
|
function removeTailwindSourceDirectives(rawSource, options = {}) {
|
|
1771
1764
|
try {
|
|
@@ -1785,76 +1778,23 @@ function removeTailwindSourceDirectives(rawSource, options = {}) {
|
|
|
1785
1778
|
}
|
|
1786
1779
|
}
|
|
1787
1780
|
function hasTailwindSourceDirectives(rawSource, options = {}) {
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
const root = postcss.parse(rawSource);
|
|
1791
|
-
let found = false;
|
|
1792
|
-
const ignoreLayer = hasGeneratedCssArtifacts(rawSource);
|
|
1793
|
-
root.walk((node) => {
|
|
1794
|
-
if (isTailwindGenerationDirective(node, {
|
|
1795
|
-
...options,
|
|
1796
|
-
ignoreLayer
|
|
1797
|
-
})) {
|
|
1798
|
-
found = true;
|
|
1799
|
-
return false;
|
|
1800
|
-
}
|
|
1801
|
-
});
|
|
1802
|
-
return found;
|
|
1803
|
-
} catch {
|
|
1804
|
-
return extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1805
|
-
}
|
|
1781
|
+
if (GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
|
|
1782
|
+
return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindSourceDirectives ?? extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1806
1783
|
}
|
|
1807
1784
|
function hasTailwindNonRootGenerationDirectives(rawSource, options = {}) {
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
const root = postcss.parse(rawSource);
|
|
1811
|
-
let found = false;
|
|
1812
|
-
const ignoreLayer = hasGeneratedCssArtifacts(rawSource);
|
|
1813
|
-
root.walk((node) => {
|
|
1814
|
-
if (isTailwindGenerationDirective(node, {
|
|
1815
|
-
...options,
|
|
1816
|
-
ignoreLayer
|
|
1817
|
-
}) && !(node.type === "atrule" && isTailwindImportAtRule(node, options))) {
|
|
1818
|
-
found = true;
|
|
1819
|
-
return false;
|
|
1820
|
-
}
|
|
1821
|
-
});
|
|
1822
|
-
return found;
|
|
1823
|
-
} catch {
|
|
1824
|
-
return GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource) || /@(?:apply|config|custom-variant|plugin|source|theme|utility|variant)\b/.test(rawSource);
|
|
1825
|
-
}
|
|
1785
|
+
if (GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
|
|
1786
|
+
return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindNonRootGenerationDirectives ?? /@(?:apply|config|custom-variant|plugin|source|theme|utility|variant)\b/.test(rawSource);
|
|
1826
1787
|
}
|
|
1827
1788
|
function hasTailwindRootDirectives(rawSource, options = {}) {
|
|
1828
1789
|
if (!TAILWIND_ROOT_DIRECTIVE_RE.test(rawSource) && !(options.importFallback && rawSource.includes("weapp-tailwindcss"))) return false;
|
|
1829
|
-
|
|
1830
|
-
const root = postcss.parse(rawSource);
|
|
1831
|
-
let found = false;
|
|
1832
|
-
root.walkAtRules((node) => {
|
|
1833
|
-
const request = node.name === "import" ? parseImportRequest(node.params) : node.name === "config" || node.name === "plugin" ? parseConfigRequest(node.params) : void 0;
|
|
1834
|
-
if (isTailwindImportAtRule(node, options) || isPackageJsonImportRequest(request) || TAILWIND_ROOT_DIRECTIVE_NAMES.has(node.name)) {
|
|
1835
|
-
found = true;
|
|
1836
|
-
return false;
|
|
1837
|
-
}
|
|
1838
|
-
});
|
|
1839
|
-
return found;
|
|
1840
|
-
} catch {
|
|
1841
|
-
return extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1842
|
-
}
|
|
1790
|
+
return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindRootDirectives ?? extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1843
1791
|
}
|
|
1844
1792
|
function hasTailwindApplyDirective(rawSource) {
|
|
1845
1793
|
if (!rawSource.includes("@apply")) return false;
|
|
1846
|
-
|
|
1847
|
-
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
found = true;
|
|
1851
|
-
return false;
|
|
1852
|
-
});
|
|
1853
|
-
return found;
|
|
1854
|
-
} catch {
|
|
1855
|
-
const fallback = extractTailwindSourceForPostcssFallback(rawSource);
|
|
1856
|
-
return typeof fallback === "string" && /@apply\s[^;{}]+;/.test(fallback);
|
|
1857
|
-
}
|
|
1794
|
+
const analysis = analyzeParseableTailwindDirectives(rawSource);
|
|
1795
|
+
if (analysis) return analysis.hasTailwindApplyDirective;
|
|
1796
|
+
const fallback = extractTailwindSourceForPostcssFallback(rawSource);
|
|
1797
|
+
return typeof fallback === "string" && /@apply\s[^;{}]+;/.test(fallback);
|
|
1858
1798
|
}
|
|
1859
1799
|
function resolveCssEntrySource(rawSource, base, options = {}) {
|
|
1860
1800
|
try {
|
|
@@ -1946,7 +1886,7 @@ function normalizeTailwindcssRuntimeOptions(options) {
|
|
|
1946
1886
|
}
|
|
1947
1887
|
//#endregion
|
|
1948
1888
|
//#region src/context/workspace.ts
|
|
1949
|
-
const IGNORED_WORKSPACE_DIRS = new Set([
|
|
1889
|
+
const IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
|
|
1950
1890
|
"node_modules",
|
|
1951
1891
|
".git",
|
|
1952
1892
|
".hg",
|
|
@@ -2212,7 +2152,7 @@ function quoteCssImportSpecifier(specifier, quote = "\"") {
|
|
|
2212
2152
|
return `${quote}${specifier.replaceAll("\\", "\\\\").replaceAll(quote, `\\${quote}`)}${quote}`;
|
|
2213
2153
|
}
|
|
2214
2154
|
function createTailwindV4CssImportSpecifierSet(packageName) {
|
|
2215
|
-
const specifiers = new Set(["tailwindcss"]);
|
|
2155
|
+
const specifiers = /* @__PURE__ */ new Set(["tailwindcss"]);
|
|
2216
2156
|
if (packageName && isBarePackageSpecifier(packageName)) specifiers.add(packageName);
|
|
2217
2157
|
return specifiers;
|
|
2218
2158
|
}
|
|
@@ -2373,4 +2313,4 @@ async function resolveTailwindV4SourceFromRuntime(runtime) {
|
|
|
2373
2313
|
return resolveTailwindV4Source$1(resolveTailwindV4SourceOptionsFromRuntime(runtime));
|
|
2374
2314
|
}
|
|
2375
2315
|
//#endregion
|
|
2376
|
-
export { normalizeLegacyContentEntries as $, resolveCssEntrySource as A, stripTailwindBanner as B, hasTailwindRootDirectives as C, normalizeTailwindSourceForGenerator as D, normalizeTailwindSourceDirectives as E, hasTailwindGeneratedCssMarkers as F, getTailwindV4IncrementalGenerateCacheStats as G, normalizeConfigDirective as H, splitGeneratorPlaceholderCssBySourceOrder as I, FULL_SOURCE_SCAN_EXTENSION_RE as J, transformTailwindV4CssByTarget as K, splitTailwindGeneratedCssByBanner as L, VITE_MARKER_RE as M, createCssAppend as N, parseImportRequest as O, hasTailwindGeneratedCss as P, isFileMatchedByTailwindSourceEntries as Q, splitTailwindV4GeneratedCssBySourceOrder as R, hasTailwindNonRootGenerationDirectives as S, normalizeTailwindConfigDirectives as T, prependConfigDirective as U, stripTailwindBanners as V, createTailwindV4Engine$1 as W, createTailwindSourceEntryMatcher as X, FULL_SOURCE_SCAN_PATTERN as Y, expandTailwindSourceEntries as Z, resolveTailwindcssOptions as _, filterTailwindV4CssSourceRoots as a, collectCssInlineSourceCandidates as at, hasLocalCssImport as b, groupCssEntriesByBase as c,
|
|
2316
|
+
export { normalizeLegacyContentEntries as $, resolveCssEntrySource as A, stripTailwindBanner as B, hasTailwindRootDirectives as C, normalizeTailwindSourceForGenerator as D, normalizeTailwindSourceDirectives as E, hasTailwindGeneratedCssMarkers as F, getTailwindV4IncrementalGenerateCacheStats as G, normalizeConfigDirective as H, splitGeneratorPlaceholderCssBySourceOrder as I, FULL_SOURCE_SCAN_EXTENSION_RE as J, transformTailwindV4CssByTarget as K, splitTailwindGeneratedCssByBanner as L, VITE_MARKER_RE as M, createCssAppend as N, parseImportRequest as O, hasTailwindGeneratedCss as P, isFileMatchedByTailwindSourceEntries as Q, splitTailwindV4GeneratedCssBySourceOrder as R, hasTailwindNonRootGenerationDirectives as S, normalizeTailwindConfigDirectives as T, prependConfigDirective as U, stripTailwindBanners as V, createTailwindV4Engine$1 as W, createTailwindSourceEntryMatcher as X, FULL_SOURCE_SCAN_PATTERN as Y, expandTailwindSourceEntries as Z, resolveTailwindcssOptions as _, filterTailwindV4CssSourceRoots as a, collectCssInlineSourceCandidates as at, hasLocalCssImport as b, groupCssEntriesByBase as c, omitUndefined as ct, normalizeCssEntries as d, resolveValidTailwindV4Candidates$1 as dt, parseConfigParam as et, findNearestPackageRoot as f, normalizeTailwindcssRuntimeOptions as g, normalizeExtendLengthUnits as h, resolveTailwindV4SourceOptionsFromRuntime as i, toPosixPath as it, GENERATOR_PLACEHOLDER_MARKER_RE as j, removeTailwindSourceDirectives as k, guessBasedirFromEntries as l, inferGeneratorTargetFromEnv as lt, findWorkspaceRoot as m, resolveTailwindV4SourceFromRuntime as n, resolveSourceScanPath as nt, hasConfiguredTailwindV4CssRoots as o, resolveCssMacroTailwindV4Source as ot, findWorkspacePackageDir as p, transformTailwindV4CssToWeapp as q, resolveTailwindV4SourceFromRuntimeOptions as r, resolveTailwindV4CssSourceBase as rt, upsertTailwindV4CssSource as s, filterUnsupportedMiniProgramTailwindV4Candidates as st, resolveTailwindV4Source$1 as t, resolveCssSourceEntries as tt, isTailwindV4CssEntry as u, loadTailwindV4DesignSystem as ut, normalizeStringListOption as v, hasTailwindSourceDirectives as w, hasTailwindApplyDirective as x, resolveBooleanObjectOption as y, stripGeneratorPlaceholderMarkers as z };
|