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,17 +1,17 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
2
|
require("./auto-DtU6f3X6.js");
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
|
-
node_fs =
|
|
4
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
5
5
|
let node_path = require("node:path");
|
|
6
|
-
node_path =
|
|
6
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
7
7
|
let node_process = require("node:process");
|
|
8
|
-
node_process =
|
|
8
|
+
node_process = require_rolldown_runtime.__toESM(node_process);
|
|
9
9
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
10
10
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
11
11
|
let lru_cache = require("lru-cache");
|
|
12
12
|
let node_fs_promises = require("node:fs/promises");
|
|
13
13
|
let micromatch = require("micromatch");
|
|
14
|
-
micromatch =
|
|
14
|
+
micromatch = require_rolldown_runtime.__toESM(micromatch);
|
|
15
15
|
let node_module = require("node:module");
|
|
16
16
|
//#region src/runtime-branch/generator-target-env.ts
|
|
17
17
|
const explicitGeneratorTargetEnvKeys = ["WEAPP_TW_TARGET", "WEAPP_TAILWINDCSS_TARGET"];
|
|
@@ -68,6 +68,15 @@ function filterUnsupportedMiniProgramTailwindV4Candidates(candidates) {
|
|
|
68
68
|
return new Set([...candidates].filter((candidate) => !isUnsupportedMiniProgramTailwindV4Candidate(candidate)));
|
|
69
69
|
}
|
|
70
70
|
//#endregion
|
|
71
|
+
//#region src/tailwindcss/v4-engine/css-macro-source.ts
|
|
72
|
+
function resolveCssMacroTailwindV4Source(source) {
|
|
73
|
+
const css = (0, _weapp_tailwindcss_postcss.transformCssMacroTailwindV4Source)(source.css);
|
|
74
|
+
return css === source.css ? source : {
|
|
75
|
+
...source,
|
|
76
|
+
css
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
71
80
|
//#region src/tailwindcss/v4-engine/tailwind-v4-default-colors.ts
|
|
72
81
|
const TAILWIND_V4_COLOR_STEPS = [
|
|
73
82
|
"50",
|
|
@@ -1169,7 +1178,7 @@ function createIncrementalStyleOptions(styleOptions) {
|
|
|
1169
1178
|
};
|
|
1170
1179
|
}
|
|
1171
1180
|
function resolveStyleOptions(source, options) {
|
|
1172
|
-
return (0, _weapp_tailwindcss_postcss.
|
|
1181
|
+
return (0, _weapp_tailwindcss_postcss.hasCssMacroTailwindV4Source)(source.css) ? (0, _weapp_tailwindcss_postcss.withCssMacroStyleOptions)(options) : options;
|
|
1173
1182
|
}
|
|
1174
1183
|
function collectCustomPropertyValues(css) {
|
|
1175
1184
|
const values = /* @__PURE__ */ new Map();
|
|
@@ -1236,11 +1245,11 @@ function createTailwindV4Engine(source) {
|
|
|
1236
1245
|
async function generateOnce(generateSource, options = {}) {
|
|
1237
1246
|
const { scanSources = true, styleOptions, target = "weapp", ...patchOptions } = options;
|
|
1238
1247
|
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
1239
|
-
const engine = (0, _tailwindcss_mangle_engine.createTailwindV4Engine)(createCompatibleSource(generateSource, target));
|
|
1248
|
+
const engine = (0, _tailwindcss_mangle_engine.createTailwindV4Engine)(createCompatibleSource(resolveCssMacroTailwindV4Source(generateSource), target));
|
|
1240
1249
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1241
1250
|
const delegateSourceScan = shouldDelegateWebSourceScanToTailwind(target, resolvedScanSources);
|
|
1242
1251
|
const filesystemCandidates = !delegateSourceScan && Array.isArray(resolvedScanSources) ? new Set(await (0, _tailwindcss_mangle_engine.extractRawCandidates)(resolvedScanSources, { ...patchOptions.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: patchOptions.bareArbitraryValues } })) : void 0;
|
|
1243
|
-
const normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target), target, resolvedStyleOptions);
|
|
1252
|
+
const normalizedCandidates = normalizeTargetRpxLengthCandidates(resolveTargetCandidates(/* @__PURE__ */ new Set([...collectCandidates(patchOptions.candidates), ...filesystemCandidates ?? []]), target), target, resolvedStyleOptions);
|
|
1244
1253
|
const result = await engine.generate(omitUndefined({
|
|
1245
1254
|
scanSources: delegateSourceScan ? resolvedScanSources : false,
|
|
1246
1255
|
...patchOptions,
|
|
@@ -1259,13 +1268,14 @@ function createTailwindV4Engine(source) {
|
|
|
1259
1268
|
}
|
|
1260
1269
|
async function generateWithIncrementalCache(options = {}) {
|
|
1261
1270
|
const target = options.target ?? "weapp";
|
|
1262
|
-
const
|
|
1271
|
+
const cssMacroSource = resolveCssMacroTailwindV4Source(source);
|
|
1272
|
+
const compatibleSource = createCompatibleSource(cssMacroSource, target);
|
|
1263
1273
|
const requestedCandidates = resolveTargetCandidates(options.candidates, target);
|
|
1264
1274
|
const styleOptions = resolveStyleOptions(source, options.styleOptions);
|
|
1265
|
-
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(
|
|
1275
|
+
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(cssMacroSource, options);
|
|
1266
1276
|
const cacheKey = createIncrementalGenerateCacheKey(compatibleSource, target, styleOptions);
|
|
1267
1277
|
if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1268
|
-
const generated = await generateOnce(
|
|
1278
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1269
1279
|
if (!seedIncrementalGenerateCache({
|
|
1270
1280
|
compatibleSource,
|
|
1271
1281
|
generated,
|
|
@@ -1278,7 +1288,7 @@ function createTailwindV4Engine(source) {
|
|
|
1278
1288
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
1279
1289
|
if (cached) {
|
|
1280
1290
|
if (hasRemovedCandidates(cached.seenCandidates, requestedCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1281
|
-
const generated = await generateOnce(
|
|
1291
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1282
1292
|
if (!seedIncrementalGenerateCache({
|
|
1283
1293
|
compatibleSource,
|
|
1284
1294
|
generated,
|
|
@@ -1302,7 +1312,7 @@ function createTailwindV4Engine(source) {
|
|
|
1302
1312
|
target: cached.target
|
|
1303
1313
|
};
|
|
1304
1314
|
if (shouldRebuildIncrementalEntry(cached, requestedCandidates, missingCandidates)) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1305
|
-
const generated = await generateOnce(
|
|
1315
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1306
1316
|
if (!seedIncrementalGenerateCache({
|
|
1307
1317
|
compatibleSource,
|
|
1308
1318
|
generated,
|
|
@@ -1352,7 +1362,7 @@ function createTailwindV4Engine(source) {
|
|
|
1352
1362
|
});
|
|
1353
1363
|
}
|
|
1354
1364
|
return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1355
|
-
const generated = await generateOnce(
|
|
1365
|
+
const generated = await generateOnce(cssMacroSource, options);
|
|
1356
1366
|
seedIncrementalGenerateCache({
|
|
1357
1367
|
compatibleSource,
|
|
1358
1368
|
generated,
|
|
@@ -1495,14 +1505,14 @@ function parseConfigRequest$1(params) {
|
|
|
1495
1505
|
function isPackageJsonImportRequest$1(request) {
|
|
1496
1506
|
return typeof request === "string" && request.startsWith("#");
|
|
1497
1507
|
}
|
|
1498
|
-
function isWeappTailwindcssImportRequest
|
|
1508
|
+
function isWeappTailwindcssImportRequest(request) {
|
|
1499
1509
|
return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
|
|
1500
1510
|
}
|
|
1501
1511
|
function isTailwindImportRequest$1(request) {
|
|
1502
1512
|
return request === "tailwindcss" || request === "tailwindcss4" || request?.startsWith("tailwindcss/") || request?.startsWith("tailwindcss4/");
|
|
1503
1513
|
}
|
|
1504
1514
|
function normalizeTailwindImportRequest$1(request, options = {}) {
|
|
1505
|
-
if (options.importFallback && isWeappTailwindcssImportRequest
|
|
1515
|
+
if (options.importFallback && isWeappTailwindcssImportRequest(request)) return request.replace(/^weapp-tailwindcss/, "tailwindcss");
|
|
1506
1516
|
return request;
|
|
1507
1517
|
}
|
|
1508
1518
|
function replaceImportRequest$1(params, request, replacement) {
|
|
@@ -1514,7 +1524,7 @@ function normalizeTailwindDirectiveLine(line, options = {}) {
|
|
|
1514
1524
|
const trimmed = line.trimStart();
|
|
1515
1525
|
if (/^@(?:use|forward)\b/.test(trimmed)) {
|
|
1516
1526
|
const request = parseImportRequest$1(trimmed.replace(/^@(?:use|forward)\b/, ""));
|
|
1517
|
-
if (isTailwindImportRequest$1(request) || options.importFallback && isWeappTailwindcssImportRequest
|
|
1527
|
+
if (isTailwindImportRequest$1(request) || options.importFallback && isWeappTailwindcssImportRequest(request)) {
|
|
1518
1528
|
const normalizedRequest = normalizeTailwindImportRequest$1(request, options);
|
|
1519
1529
|
return replaceImportRequest$1(line.replace(/^(\s*)@(?:use|forward)\b/, "$1@import"), request, normalizedRequest);
|
|
1520
1530
|
}
|
|
@@ -1522,7 +1532,7 @@ function normalizeTailwindDirectiveLine(line, options = {}) {
|
|
|
1522
1532
|
}
|
|
1523
1533
|
if (!options.importFallback || !trimmed.startsWith("@import")) return line;
|
|
1524
1534
|
const request = parseImportRequest$1(trimmed.replace(/^@import\b/, ""));
|
|
1525
|
-
if (!request || !isWeappTailwindcssImportRequest
|
|
1535
|
+
if (!request || !isWeappTailwindcssImportRequest(request)) return line;
|
|
1526
1536
|
return replaceImportRequest$1(line, request, request.replace(/^weapp-tailwindcss/, "tailwindcss"));
|
|
1527
1537
|
}
|
|
1528
1538
|
function extractTailwindDirectiveLines(rawSource, options = {}) {
|
|
@@ -1642,7 +1652,7 @@ function extractConfigRequestFromSource(rawSource) {
|
|
|
1642
1652
|
}
|
|
1643
1653
|
//#endregion
|
|
1644
1654
|
//#region src/bundlers/shared/generator-css/directives.ts
|
|
1645
|
-
const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
|
|
1655
|
+
const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = /* @__PURE__ */ new Set([
|
|
1646
1656
|
"config",
|
|
1647
1657
|
"custom-variant",
|
|
1648
1658
|
"layer",
|
|
@@ -1654,45 +1664,21 @@ const TAILWIND_REMOVABLE_SOURCE_DIRECTIVE_NAMES = new Set([
|
|
|
1654
1664
|
"utility",
|
|
1655
1665
|
"variant"
|
|
1656
1666
|
]);
|
|
1657
|
-
const TAILWIND_ROOT_DIRECTIVE_NAMES = new Set([
|
|
1658
|
-
"config",
|
|
1659
|
-
"custom-variant",
|
|
1660
|
-
"plugin",
|
|
1661
|
-
"source",
|
|
1662
|
-
"tailwind",
|
|
1663
|
-
"theme",
|
|
1664
|
-
"utility",
|
|
1665
|
-
"variant"
|
|
1666
|
-
]);
|
|
1667
1667
|
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/;
|
|
1668
1668
|
function parseImportRequest(params) {
|
|
1669
|
-
return
|
|
1669
|
+
return (0, _weapp_tailwindcss_postcss.parseTailwindCssDirectiveRequest)(params);
|
|
1670
1670
|
}
|
|
1671
1671
|
function hasLocalCssImport(rawSource) {
|
|
1672
|
-
|
|
1673
|
-
try {
|
|
1674
|
-
_weapp_tailwindcss_postcss.postcss.parse(rawSource).walkAtRules("import", (rule) => {
|
|
1675
|
-
const request = parseImportRequest(rule.params);
|
|
1676
|
-
if (request?.startsWith(".") === true || request?.startsWith("/") === true) {
|
|
1677
|
-
found = true;
|
|
1678
|
-
return false;
|
|
1679
|
-
}
|
|
1680
|
-
});
|
|
1681
|
-
} catch {}
|
|
1682
|
-
return found;
|
|
1672
|
+
return analyzeParseableTailwindDirectives(rawSource)?.hasLocalCssImport ?? false;
|
|
1683
1673
|
}
|
|
1684
1674
|
function parseConfigRequest(params) {
|
|
1685
|
-
return
|
|
1675
|
+
return (0, _weapp_tailwindcss_postcss.parseTailwindCssConfigRequest)(params);
|
|
1686
1676
|
}
|
|
1687
1677
|
function isPackageJsonImportRequest(request) {
|
|
1688
|
-
return
|
|
1689
|
-
}
|
|
1690
|
-
function isWeappTailwindcssImportRequest(request) {
|
|
1691
|
-
return request === "weapp-tailwindcss" || request?.startsWith("weapp-tailwindcss/");
|
|
1678
|
+
return (0, _weapp_tailwindcss_postcss.isTailwindCssPackageJsonImportRequest)(request);
|
|
1692
1679
|
}
|
|
1693
1680
|
function normalizeTailwindImportRequest(request, options = {}) {
|
|
1694
|
-
|
|
1695
|
-
return request;
|
|
1681
|
+
return (0, _weapp_tailwindcss_postcss.normalizeTailwindCssImportRequest)(request, options);
|
|
1696
1682
|
}
|
|
1697
1683
|
function replaceImportRequest(params, request, replacement) {
|
|
1698
1684
|
const index = params.indexOf(request);
|
|
@@ -1748,12 +1734,11 @@ function normalizeTailwindSourceDirectives(rawSource, options = {}) {
|
|
|
1748
1734
|
}
|
|
1749
1735
|
}
|
|
1750
1736
|
function isTailwindImportRequest(request) {
|
|
1751
|
-
|
|
1737
|
+
const normalized = normalizeTailwindImportRequest(request);
|
|
1738
|
+
return normalized === "tailwindcss" || normalized === "tailwindcss4" || normalized?.startsWith("tailwindcss/") === true || normalized?.startsWith("tailwindcss4/") === true;
|
|
1752
1739
|
}
|
|
1753
1740
|
function isTailwindImportAtRule(node, options = {}) {
|
|
1754
|
-
|
|
1755
|
-
if (node.name !== "import" && node.name !== "use" && node.name !== "forward") return false;
|
|
1756
|
-
return isTailwindImportRequest(normalizeTailwindImportRequest(parseImportRequest(node.params), options));
|
|
1741
|
+
return (0, _weapp_tailwindcss_postcss.isTailwindCssImportAtRule)(node, options);
|
|
1757
1742
|
}
|
|
1758
1743
|
function isTailwindSourceDirective(node, options = {}) {
|
|
1759
1744
|
if (node.type !== "atrule") return false;
|
|
@@ -1767,10 +1752,18 @@ function hasGeneratedCssArtifacts(rawSource) {
|
|
|
1767
1752
|
return hasTailwindGeneratedCssMarkers(rawSource) && !GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource);
|
|
1768
1753
|
}
|
|
1769
1754
|
function isTailwindGenerationDirective(node, options = {}) {
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1755
|
+
return (0, _weapp_tailwindcss_postcss.isTailwindCssGenerationDirective)(node, options);
|
|
1756
|
+
}
|
|
1757
|
+
function analyzeParseableTailwindDirectives(rawSource, options = {}) {
|
|
1758
|
+
try {
|
|
1759
|
+
const ignoreLayer = options.ignoreLayer ?? hasGeneratedCssArtifacts(rawSource);
|
|
1760
|
+
return (0, _weapp_tailwindcss_postcss.analyzeTailwindCssDirectives)(_weapp_tailwindcss_postcss.postcss.parse(rawSource), {
|
|
1761
|
+
...options,
|
|
1762
|
+
ignoreLayer
|
|
1763
|
+
});
|
|
1764
|
+
} catch {
|
|
1765
|
+
return;
|
|
1766
|
+
}
|
|
1774
1767
|
}
|
|
1775
1768
|
function removeTailwindSourceDirectives(rawSource, options = {}) {
|
|
1776
1769
|
try {
|
|
@@ -1790,76 +1783,23 @@ function removeTailwindSourceDirectives(rawSource, options = {}) {
|
|
|
1790
1783
|
}
|
|
1791
1784
|
}
|
|
1792
1785
|
function hasTailwindSourceDirectives(rawSource, options = {}) {
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
|
|
1796
|
-
let found = false;
|
|
1797
|
-
const ignoreLayer = hasGeneratedCssArtifacts(rawSource);
|
|
1798
|
-
root.walk((node) => {
|
|
1799
|
-
if (isTailwindGenerationDirective(node, {
|
|
1800
|
-
...options,
|
|
1801
|
-
ignoreLayer
|
|
1802
|
-
})) {
|
|
1803
|
-
found = true;
|
|
1804
|
-
return false;
|
|
1805
|
-
}
|
|
1806
|
-
});
|
|
1807
|
-
return found;
|
|
1808
|
-
} catch {
|
|
1809
|
-
return extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1810
|
-
}
|
|
1786
|
+
if (GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
|
|
1787
|
+
return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindSourceDirectives ?? extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1811
1788
|
}
|
|
1812
1789
|
function hasTailwindNonRootGenerationDirectives(rawSource, options = {}) {
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
|
|
1816
|
-
let found = false;
|
|
1817
|
-
const ignoreLayer = hasGeneratedCssArtifacts(rawSource);
|
|
1818
|
-
root.walk((node) => {
|
|
1819
|
-
if (isTailwindGenerationDirective(node, {
|
|
1820
|
-
...options,
|
|
1821
|
-
ignoreLayer
|
|
1822
|
-
}) && !(node.type === "atrule" && isTailwindImportAtRule(node, options))) {
|
|
1823
|
-
found = true;
|
|
1824
|
-
return false;
|
|
1825
|
-
}
|
|
1826
|
-
});
|
|
1827
|
-
return found;
|
|
1828
|
-
} catch {
|
|
1829
|
-
return GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource) || /@(?:apply|config|custom-variant|plugin|source|theme|utility|variant)\b/.test(rawSource);
|
|
1830
|
-
}
|
|
1790
|
+
if (GENERATOR_PLACEHOLDER_MARKER_RE.test(rawSource)) return true;
|
|
1791
|
+
return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindNonRootGenerationDirectives ?? /@(?:apply|config|custom-variant|plugin|source|theme|utility|variant)\b/.test(rawSource);
|
|
1831
1792
|
}
|
|
1832
1793
|
function hasTailwindRootDirectives(rawSource, options = {}) {
|
|
1833
1794
|
if (!TAILWIND_ROOT_DIRECTIVE_RE.test(rawSource) && !(options.importFallback && rawSource.includes("weapp-tailwindcss"))) return false;
|
|
1834
|
-
|
|
1835
|
-
const root = _weapp_tailwindcss_postcss.postcss.parse(rawSource);
|
|
1836
|
-
let found = false;
|
|
1837
|
-
root.walkAtRules((node) => {
|
|
1838
|
-
const request = node.name === "import" ? parseImportRequest(node.params) : node.name === "config" || node.name === "plugin" ? parseConfigRequest(node.params) : void 0;
|
|
1839
|
-
if (isTailwindImportAtRule(node, options) || isPackageJsonImportRequest(request) || TAILWIND_ROOT_DIRECTIVE_NAMES.has(node.name)) {
|
|
1840
|
-
found = true;
|
|
1841
|
-
return false;
|
|
1842
|
-
}
|
|
1843
|
-
});
|
|
1844
|
-
return found;
|
|
1845
|
-
} catch {
|
|
1846
|
-
return extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1847
|
-
}
|
|
1795
|
+
return analyzeParseableTailwindDirectives(rawSource, options)?.hasTailwindRootDirectives ?? extractTailwindDirectiveLines(rawSource, options).length > 0;
|
|
1848
1796
|
}
|
|
1849
1797
|
function hasTailwindApplyDirective(rawSource) {
|
|
1850
1798
|
if (!rawSource.includes("@apply")) return false;
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
found = true;
|
|
1856
|
-
return false;
|
|
1857
|
-
});
|
|
1858
|
-
return found;
|
|
1859
|
-
} catch {
|
|
1860
|
-
const fallback = extractTailwindSourceForPostcssFallback(rawSource);
|
|
1861
|
-
return typeof fallback === "string" && /@apply\s[^;{}]+;/.test(fallback);
|
|
1862
|
-
}
|
|
1799
|
+
const analysis = analyzeParseableTailwindDirectives(rawSource);
|
|
1800
|
+
if (analysis) return analysis.hasTailwindApplyDirective;
|
|
1801
|
+
const fallback = extractTailwindSourceForPostcssFallback(rawSource);
|
|
1802
|
+
return typeof fallback === "string" && /@apply\s[^;{}]+;/.test(fallback);
|
|
1863
1803
|
}
|
|
1864
1804
|
function resolveCssEntrySource(rawSource, base, options = {}) {
|
|
1865
1805
|
try {
|
|
@@ -1951,7 +1891,7 @@ function normalizeTailwindcssRuntimeOptions(options) {
|
|
|
1951
1891
|
}
|
|
1952
1892
|
//#endregion
|
|
1953
1893
|
//#region src/context/workspace.ts
|
|
1954
|
-
const IGNORED_WORKSPACE_DIRS = new Set([
|
|
1894
|
+
const IGNORED_WORKSPACE_DIRS = /* @__PURE__ */ new Set([
|
|
1955
1895
|
"node_modules",
|
|
1956
1896
|
".git",
|
|
1957
1897
|
".hg",
|
|
@@ -2217,7 +2157,7 @@ function quoteCssImportSpecifier(specifier, quote = "\"") {
|
|
|
2217
2157
|
return `${quote}${specifier.replaceAll("\\", "\\\\").replaceAll(quote, `\\${quote}`)}${quote}`;
|
|
2218
2158
|
}
|
|
2219
2159
|
function createTailwindV4CssImportSpecifierSet(packageName) {
|
|
2220
|
-
const specifiers = new Set(["tailwindcss"]);
|
|
2160
|
+
const specifiers = /* @__PURE__ */ new Set(["tailwindcss"]);
|
|
2221
2161
|
if (packageName && isBarePackageSpecifier(packageName)) specifiers.add(packageName);
|
|
2222
2162
|
return specifiers;
|
|
2223
2163
|
}
|
|
@@ -2642,6 +2582,12 @@ Object.defineProperty(exports, "resolveCssEntrySource", {
|
|
|
2642
2582
|
return resolveCssEntrySource;
|
|
2643
2583
|
}
|
|
2644
2584
|
});
|
|
2585
|
+
Object.defineProperty(exports, "resolveCssMacroTailwindV4Source", {
|
|
2586
|
+
enumerable: true,
|
|
2587
|
+
get: function() {
|
|
2588
|
+
return resolveCssMacroTailwindV4Source;
|
|
2589
|
+
}
|
|
2590
|
+
});
|
|
2645
2591
|
Object.defineProperty(exports, "resolveCssSourceEntries", {
|
|
2646
2592
|
enumerable: true,
|
|
2647
2593
|
get: function() {
|