weapp-tailwindcss 5.1.9 → 5.1.11
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/shared/generator-css/generation-helpers.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/output-import-shell.d.ts +4 -0
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -0
- package/dist/bundlers/shared/generator-css/types.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/scoped-generator.d.ts +1 -0
- package/dist/bundlers/vite/hot-css-modules.d.ts +1 -1
- package/dist/bundlers/vite/source-candidates.d.ts +7 -2
- package/dist/bundlers/vite/web-css-compat.d.ts +3 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +9 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +3 -0
- package/dist/cli.js +3 -2
- package/dist/cli.mjs +2 -1
- package/dist/{context-CfXr3hWz.mjs → context-DzkSFEVL.mjs} +4 -4
- package/dist/{context-CRhUs_5e.js → context-y2BGCok4.js} +10 -10
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/generator/options.d.ts +8 -1
- package/dist/{v4-engine-BZP2462H.js → generator-Bz94KTkH.js} +229 -17
- package/dist/{v4-engine-CjjWONB0.mjs → generator-ROzBodj6.mjs} +185 -9
- package/dist/generator.js +7 -8
- package/dist/generator.mjs +1 -2
- package/dist/{gulp-CRjkPsbX.mjs → gulp-BKqMb_Ds.mjs} +4 -4
- package/dist/{gulp-JUfnhOOo.js → gulp-DfOLvYLs.js} +10 -10
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-DcIEXnf8.js → hmr-timing-DOTdH18A.js} +556 -170
- package/dist/{hmr-timing-BecOXMd8.mjs → hmr-timing-DwtYJdwb.mjs} +430 -56
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +2 -3
- package/dist/postcss.mjs +1 -2
- package/dist/presets.js +7 -6
- package/dist/presets.mjs +5 -4
- package/dist/rspack.js +1 -1
- package/dist/rspack.mjs +1 -1
- package/dist/{source-candidate-scan-signature-10tvdJVC.js → source-candidate-scan-signature-BrWuBTjY.js} +34 -6
- package/dist/{source-candidate-scan-signature-DAg8QSgh.mjs → source-candidate-scan-signature-CQ04hiox.mjs} +29 -7
- package/dist/{tailwindcss-BZjZZi60.js → tailwindcss-Dn5DVlkI.js} +55 -47
- package/dist/{tailwindcss-PA2jHHpx.mjs → tailwindcss-hzy_WaC9.mjs} +14 -6
- package/dist/{transform-wNEbcZeQ.mjs → transform-BgnNYkIG.mjs} +1 -1
- package/dist/{transform-B0BxX3XB.js → transform-DZQETx51.js} +1 -1
- package/dist/{vite-CHk7V9EA.js → vite-DODC15Fr.js} +865 -254
- package/dist/{vite-ClpyoD9e.mjs → vite-oI2ReOic.mjs} +818 -207
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +613 -63
- package/dist/{webpack-2s-TFhgm.mjs → webpack-CCapGlNg.mjs} +235 -38
- package/dist/{webpack-BhM4Hqla.js → webpack-XxBCIrBp.js} +276 -79
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +5 -5
- package/dist/generator-DaaFxR5V.js +0 -174
- package/dist/generator-DugIHBgl.mjs +0 -127
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
-
const
|
|
2
|
+
const require_generator = require("./generator-Bz94KTkH.js");
|
|
3
3
|
require("./utils-D3h8j7Mk.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_path = require("node:path");
|
|
@@ -8,8 +8,8 @@ let node_process = require("node:process");
|
|
|
8
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
|
-
let node_fs_promises = require("node:fs/promises");
|
|
12
11
|
let node_module = require("node:module");
|
|
12
|
+
let node_fs_promises = require("node:fs/promises");
|
|
13
13
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
14
14
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
15
15
|
let fast_glob = require("fast-glob");
|
|
@@ -222,7 +222,7 @@ function readStaticConfigContent(configPath) {
|
|
|
222
222
|
}
|
|
223
223
|
//#endregion
|
|
224
224
|
//#region src/bundlers/vite/source-scan/css-entries.ts
|
|
225
|
-
const VITE_SOURCE_CANDIDATE_PATTERN =
|
|
225
|
+
const VITE_SOURCE_CANDIDATE_PATTERN = require_generator.FULL_SOURCE_SCAN_PATTERN;
|
|
226
226
|
const VITE_TAILWIND_CSS_ENTRY_PATTERN = "**/*.css";
|
|
227
227
|
const tailwindV4CssEntriesCache = /* @__PURE__ */ new Map();
|
|
228
228
|
function parseImportSourceParam(params) {
|
|
@@ -266,7 +266,7 @@ async function statConfigDependency(file) {
|
|
|
266
266
|
async function collectConfigDependencySignatures(root, base) {
|
|
267
267
|
const configPaths = /* @__PURE__ */ new Set();
|
|
268
268
|
root.walkAtRules("config", (rule) => {
|
|
269
|
-
const configPath =
|
|
269
|
+
const configPath = require_generator.parseConfigParam(rule.params);
|
|
270
270
|
if (configPath) configPaths.add(resolveConfigPath(base, configPath));
|
|
271
271
|
});
|
|
272
272
|
return Promise.all([...configPaths].sort().map(statConfigDependency));
|
|
@@ -289,14 +289,14 @@ function mergeTailwindInlineSourceCandidates(allInlineCandidates) {
|
|
|
289
289
|
async function resolveConfigContentEntries(root, base) {
|
|
290
290
|
const configPaths = /* @__PURE__ */ new Set();
|
|
291
291
|
root.walkAtRules("config", (rule) => {
|
|
292
|
-
const configPath =
|
|
292
|
+
const configPath = require_generator.parseConfigParam(rule.params);
|
|
293
293
|
if (configPath) configPaths.add(resolveConfigPath(base, configPath));
|
|
294
294
|
});
|
|
295
295
|
const entries = [];
|
|
296
296
|
for (const configPath of configPaths) {
|
|
297
297
|
const staticContent = readStaticConfigContent(configPath);
|
|
298
298
|
if (staticContent !== void 0) {
|
|
299
|
-
entries.push(...
|
|
299
|
+
entries.push(...require_generator.normalizeLegacyContentEntries(staticContent, node_path.default.dirname(configPath), { relativeBase: node_path.default.dirname(configPath) }));
|
|
300
300
|
continue;
|
|
301
301
|
}
|
|
302
302
|
try {
|
|
@@ -304,7 +304,7 @@ async function resolveConfigContentEntries(root, base) {
|
|
|
304
304
|
config: configPath,
|
|
305
305
|
cwd: node_path.default.dirname(configPath)
|
|
306
306
|
});
|
|
307
|
-
entries.push(...
|
|
307
|
+
entries.push(...require_generator.normalizeLegacyContentEntries(loaded?.config.content, node_path.default.dirname(configPath), { relativeBase: node_path.default.dirname(configPath) }));
|
|
308
308
|
} catch {}
|
|
309
309
|
}
|
|
310
310
|
return {
|
|
@@ -323,10 +323,10 @@ async function resolveTailwindV4EntriesFromCss(css, base) {
|
|
|
323
323
|
let hasSourceNone = false;
|
|
324
324
|
let hasTailwindCssImport = false;
|
|
325
325
|
let includesPreflight = false;
|
|
326
|
-
const [sourceEntries, configEntries] = await Promise.all([
|
|
326
|
+
const [sourceEntries, configEntries] = await Promise.all([require_generator.resolveCssSourceEntries(root, base, VITE_SOURCE_CANDIDATE_PATTERN), resolveConfigContentEntries(root, base)]);
|
|
327
327
|
const entries = [...configEntries.entries, ...sourceEntries];
|
|
328
328
|
const hasPositiveEntries = entries.some((entry) => !entry.negated);
|
|
329
|
-
const inlineCandidates =
|
|
329
|
+
const inlineCandidates = require_generator.collectCssInlineSourceCandidates(root);
|
|
330
330
|
root.walkAtRules("import", (rule) => {
|
|
331
331
|
if (!isTailwindV4CssImportParam(rule.params)) return;
|
|
332
332
|
hasTailwindCssImport = true;
|
|
@@ -386,7 +386,7 @@ function collectExistingCssEntries(options) {
|
|
|
386
386
|
...options.cssEntries ?? [],
|
|
387
387
|
...options.tailwindcss?.v4?.cssEntries ?? [],
|
|
388
388
|
...options.tailwindcssRuntimeOptions?.tailwindcss?.v4?.cssEntries ?? []
|
|
389
|
-
].filter((item) => typeof item === "string" && item.length > 0).filter(
|
|
389
|
+
].filter((item) => typeof item === "string" && item.length > 0).filter(require_generator.isTailwindV4CssEntry).map((item) => node_path.default.resolve(item)).filter((item) => (0, node_fs.existsSync)(item));
|
|
390
390
|
}
|
|
391
391
|
async function pathExistsAsFile(file) {
|
|
392
392
|
try {
|
|
@@ -440,7 +440,7 @@ async function discoverTailwindV4CssEntries(root, outDir) {
|
|
|
440
440
|
return entries;
|
|
441
441
|
}
|
|
442
442
|
function collectConfiguredCssSources(options) {
|
|
443
|
-
return
|
|
443
|
+
return require_generator.filterTailwindV4CssSourceRoots([...options.tailwindcss?.v4?.cssSources ?? [], ...options.tailwindcssRuntimeOptions?.tailwindcss?.v4?.cssSources ?? []]) ?? [];
|
|
444
444
|
}
|
|
445
445
|
//#endregion
|
|
446
446
|
//#region src/bundlers/vite/source-scan/dependencies.ts
|
|
@@ -463,15 +463,19 @@ function createMergedCssEntrySourceScanEntries(entries, options) {
|
|
|
463
463
|
const positiveEntries = entries.filter((entry) => !entry.negated);
|
|
464
464
|
return positiveEntries.length > 0 ? positiveEntries : entries;
|
|
465
465
|
}
|
|
466
|
+
function resolveExplicitSourceScanEntries(entries, explicit) {
|
|
467
|
+
if (!explicit) return entries.length > 0 ? entries : void 0;
|
|
468
|
+
return entries.some((entry) => !entry.negated) ? entries : [];
|
|
469
|
+
}
|
|
466
470
|
function createResolvedV4CssScanInput(entries, inlineCandidates, explicit) {
|
|
467
471
|
return {
|
|
468
|
-
entries:
|
|
472
|
+
entries: resolveExplicitSourceScanEntries(entries, explicit),
|
|
469
473
|
explicit,
|
|
470
474
|
inlineCandidates
|
|
471
475
|
};
|
|
472
476
|
}
|
|
473
477
|
async function resolveViteSourceScanEntries(options, runtime, scanOptions = {}) {
|
|
474
|
-
const sourceOptions =
|
|
478
|
+
const sourceOptions = require_generator.resolveTailwindV4SourceOptionsFromRuntime(runtime);
|
|
475
479
|
const cssEntries = collectExistingCssEntries(options);
|
|
476
480
|
if (cssEntries.length === 0 && !sourceOptions.css && !sourceOptions.cssSources?.length) {
|
|
477
481
|
const scanRoot = scanOptions.root;
|
|
@@ -506,7 +510,7 @@ async function resolveViteSourceScanEntries(options, runtime, scanOptions = {})
|
|
|
506
510
|
const inlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
|
|
507
511
|
const scanEntries = createMergedCssEntrySourceScanEntries(entries, { sourceCount: readableCssEntryCount });
|
|
508
512
|
if (scanEntries.length > 0 || inlineCandidates || explicit || readableCssEntryCount > 0) return createResolvedViteSourceScan({
|
|
509
|
-
entries:
|
|
513
|
+
entries: resolveExplicitSourceScanEntries(scanEntries, explicit),
|
|
510
514
|
explicit,
|
|
511
515
|
inlineCandidates
|
|
512
516
|
}, dependencies);
|
|
@@ -520,7 +524,7 @@ async function resolveViteSourceScanEntries(options, runtime, scanOptions = {})
|
|
|
520
524
|
if (typeof cssSource.css !== "string" || cssSource.css.length === 0) continue;
|
|
521
525
|
addSourceScanDependency(dependencies, cssSource.file);
|
|
522
526
|
addSourceScanDependencies(dependencies, cssSource.dependencies);
|
|
523
|
-
const resolved = await resolveTailwindV4EntriesFromCssCached(cssSource.css,
|
|
527
|
+
const resolved = await resolveTailwindV4EntriesFromCssCached(cssSource.css, require_generator.resolveTailwindV4CssSourceBase(cssSource, sourceOptionBase));
|
|
524
528
|
if (resolved) {
|
|
525
529
|
entries.push(...resolved.entries);
|
|
526
530
|
cssInlineCandidates.push(resolved.inlineCandidates);
|
|
@@ -532,20 +536,20 @@ async function resolveViteSourceScanEntries(options, runtime, scanOptions = {})
|
|
|
532
536
|
const cssSourceCount = (sourceOptions.cssSources?.length ?? 0) + configuredCssSources.length;
|
|
533
537
|
const cssSourceScanEntries = createMergedCssEntrySourceScanEntries(entries, { sourceCount: cssSourceCount });
|
|
534
538
|
if (cssSourceScanEntries.length > 0 || cssSourceInlineCandidates || explicit) return createResolvedViteSourceScan({
|
|
535
|
-
entries:
|
|
539
|
+
entries: resolveExplicitSourceScanEntries(cssSourceScanEntries, explicit),
|
|
536
540
|
explicit,
|
|
537
541
|
inlineCandidates: cssSourceInlineCandidates
|
|
538
542
|
}, dependencies);
|
|
539
543
|
if (cssSourceCount > 0) return;
|
|
540
|
-
const source = await
|
|
544
|
+
const source = await require_generator.resolveTailwindV4SourceFromRuntime(runtime);
|
|
541
545
|
addSourceScanDependency(dependencies, source.file);
|
|
542
546
|
addSourceScanDependencies(dependencies, source.dependencies);
|
|
543
547
|
const resolved = await resolveTailwindV4EntriesFromCssCached(source.css, source.base);
|
|
544
548
|
return resolved ? createResolvedViteSourceScan(createResolvedV4CssScanInput(resolved.entries.length > 0 ? resolved.entries : [], resolved.inlineCandidates, resolved.entries.length > 0 ? resolved.explicit : false), /* @__PURE__ */ new Set([...dependencies, ...resolved.dependencies])) : void 0;
|
|
545
549
|
}
|
|
546
550
|
function createViteSourceScanMatcher(entries) {
|
|
547
|
-
if (entries?.length === 0) return;
|
|
548
|
-
return
|
|
551
|
+
if (entries?.length === 0) return () => false;
|
|
552
|
+
return require_generator.createTailwindSourceEntryMatcher(entries);
|
|
549
553
|
}
|
|
550
554
|
//#endregion
|
|
551
555
|
//#region src/tailwindcss/runtime/cache.ts
|
|
@@ -586,7 +590,7 @@ function getFileSignature(filePath) {
|
|
|
586
590
|
return signature;
|
|
587
591
|
}
|
|
588
592
|
function getTailwindTrackedFiles(tailwindRuntime) {
|
|
589
|
-
const tailwindOptions =
|
|
593
|
+
const tailwindOptions = require_generator.resolveTailwindcssOptions(tailwindRuntime.options);
|
|
590
594
|
const tracked = /* @__PURE__ */ new Set();
|
|
591
595
|
const configPath = tailwindOptions?.config;
|
|
592
596
|
if (typeof configPath === "string" && configPath.length > 0) tracked.add(configPath);
|
|
@@ -607,7 +611,7 @@ function normalizeTrackedSourceSignature(cssEntries, cssSources) {
|
|
|
607
611
|
});
|
|
608
612
|
}
|
|
609
613
|
async function collectTailwindV4TrackedSourceFiles(tailwindRuntime) {
|
|
610
|
-
const tailwindOptions =
|
|
614
|
+
const tailwindOptions = require_generator.resolveTailwindcssOptions(tailwindRuntime.options);
|
|
611
615
|
const signature = normalizeTrackedSourceSignature(tailwindOptions?.v4?.cssEntries, tailwindOptions?.v4?.cssSources);
|
|
612
616
|
const cached = runtimeTrackedSourceFilesCache.get(signature);
|
|
613
617
|
if (cached) return cached;
|
|
@@ -615,14 +619,14 @@ async function collectTailwindV4TrackedSourceFiles(tailwindRuntime) {
|
|
|
615
619
|
for (const cssEntry of tailwindOptions?.v4?.cssEntries ?? []) {
|
|
616
620
|
if (!(0, node_fs.existsSync)(cssEntry)) continue;
|
|
617
621
|
const resolved = await resolveTailwindV4EntriesFromCssCached((0, node_fs.readFileSync)(cssEntry, "utf8"), node_path.default.dirname(cssEntry));
|
|
618
|
-
const expanded = resolved?.entries?.length ? await
|
|
622
|
+
const expanded = resolved?.entries?.length ? await require_generator.expandTailwindSourceEntries(resolved.entries) : [];
|
|
619
623
|
for (const file of expanded) files.add(file);
|
|
620
624
|
}
|
|
621
625
|
for (const cssSource of tailwindOptions?.v4?.cssSources ?? []) {
|
|
622
626
|
if (typeof cssSource.css !== "string" || cssSource.css.length === 0) continue;
|
|
623
627
|
const base = typeof cssSource.file === "string" && cssSource.file.length > 0 ? node_path.default.dirname(cssSource.file) : tailwindOptions?.v4?.base ?? tailwindOptions?.cwd ?? tailwindRuntime.options?.projectRoot ?? node_process.default.cwd();
|
|
624
628
|
const resolved = await resolveTailwindV4EntriesFromCssCached(cssSource.css, base);
|
|
625
|
-
const expanded = resolved?.entries?.length ? await
|
|
629
|
+
const expanded = resolved?.entries?.length ? await require_generator.expandTailwindSourceEntries(resolved.entries) : [];
|
|
626
630
|
for (const file of expanded) files.add(file);
|
|
627
631
|
}
|
|
628
632
|
const result = [...files].sort((a, b) => a.localeCompare(b));
|
|
@@ -643,7 +647,7 @@ function readOptionalProperty(value, key) {
|
|
|
643
647
|
}
|
|
644
648
|
function getTailwindOptionsSignature(tailwindRuntime) {
|
|
645
649
|
const options = tailwindRuntime.options;
|
|
646
|
-
const tailwindOptions =
|
|
650
|
+
const tailwindOptions = require_generator.resolveTailwindcssOptions(options);
|
|
647
651
|
return normalizeSignatureValue({
|
|
648
652
|
projectRoot: options?.projectRoot,
|
|
649
653
|
packageName: tailwindOptions?.packageName,
|
|
@@ -741,7 +745,7 @@ function ensureDefaultsIncluded(value) {
|
|
|
741
745
|
return value;
|
|
742
746
|
}
|
|
743
747
|
function normalizeCssEntriesConfig(entries) {
|
|
744
|
-
const normalized =
|
|
748
|
+
const normalized = require_generator.normalizeStringListOption(entries)?.filter(require_generator.isTailwindV4CssEntry);
|
|
745
749
|
return normalized && normalized.length > 0 ? normalized : void 0;
|
|
746
750
|
}
|
|
747
751
|
function hasConfiguredCssEntries(ctx) {
|
|
@@ -757,7 +761,7 @@ let hasWarnedMissingCssEntries = false;
|
|
|
757
761
|
function warnMissingCssEntries(ctx, tailwindRuntime) {
|
|
758
762
|
if (hasWarnedMissingCssEntries) return;
|
|
759
763
|
if (!tailwindRuntime) return;
|
|
760
|
-
if (hasConfiguredCssEntries(ctx) ||
|
|
764
|
+
if (hasConfiguredCssEntries(ctx) || require_generator.hasConfiguredTailwindV4CssRoots(ctx)) return;
|
|
761
765
|
hasWarnedMissingCssEntries = true;
|
|
762
766
|
_weapp_tailwindcss_logger.logger.warn("[tailwindcss@4] 未检测到 cssEntries 配置。请传入包含 tailwindcss 引用的 CSS 绝对路径,例如 cssEntries: [\"/absolute/path/to/src/app.css\"],否则 tailwindcss 生成的类名不会参与转译。");
|
|
763
767
|
}
|
|
@@ -817,12 +821,12 @@ function createDefaultResolvePaths(basedir) {
|
|
|
817
821
|
const resolvedBase = node_path.default.resolve(basedir);
|
|
818
822
|
appendNodeModules(paths, resolvedBase);
|
|
819
823
|
fallbackCandidates.push(resolvedBase);
|
|
820
|
-
const packageRoot =
|
|
824
|
+
const packageRoot = require_generator.findNearestPackageRoot(resolvedBase);
|
|
821
825
|
if (packageRoot) {
|
|
822
826
|
appendNodeModules(paths, packageRoot);
|
|
823
827
|
fallbackCandidates.push(packageRoot);
|
|
824
828
|
}
|
|
825
|
-
const workspaceRoot =
|
|
829
|
+
const workspaceRoot = require_generator.findWorkspaceRoot(resolvedBase);
|
|
826
830
|
if (workspaceRoot) {
|
|
827
831
|
appendNodeModules(paths, workspaceRoot);
|
|
828
832
|
fallbackCandidates.push(workspaceRoot);
|
|
@@ -996,14 +1000,14 @@ function createEngineTailwindcssRuntime(options) {
|
|
|
996
1000
|
const rawCandidates = new Set(report.entries.map((entry) => {
|
|
997
1001
|
return typeof entry === "string" ? entry : entry.rawCandidate;
|
|
998
1002
|
}).filter((entry) => typeof entry === "string" && entry.length > 0));
|
|
999
|
-
const source =
|
|
1003
|
+
const source = require_generator.resolveCssMacroTailwindV4Source(await require_generator.resolveTailwindV4SourceFromRuntime(runtime));
|
|
1000
1004
|
const designSystem = await (0, _tailwindcss_mangle_engine.loadTailwindV4DesignSystem)(source);
|
|
1001
1005
|
const candidates = new Set((0, _tailwindcss_mangle_engine.resolveValidTailwindV4Candidates)(designSystem, rawCandidates, { ...source.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: source.bareArbitraryValues } }));
|
|
1002
1006
|
await collectTailwindV4CssCandidates(candidates);
|
|
1003
1007
|
return applyClassSetFilter(candidates);
|
|
1004
1008
|
}
|
|
1005
1009
|
async function collectTailwindV4CssCandidates(candidates) {
|
|
1006
|
-
const source =
|
|
1010
|
+
const source = require_generator.resolveCssMacroTailwindV4Source(await require_generator.resolveTailwindV4SourceFromRuntime(runtime));
|
|
1007
1011
|
const cssList = [source.css, ...(source.cssSources ?? []).map((cssSource) => cssSource.css).filter((css) => typeof css === "string")];
|
|
1008
1012
|
for (const css of cssList) {
|
|
1009
1013
|
if (!hasTailwindV4ApplyContext(css)) continue;
|
|
@@ -1018,7 +1022,7 @@ function createEngineTailwindcssRuntime(options) {
|
|
|
1018
1022
|
}
|
|
1019
1023
|
}
|
|
1020
1024
|
async function collectContentTokens() {
|
|
1021
|
-
const source =
|
|
1025
|
+
const source = require_generator.resolveCssMacroTailwindV4Source(await require_generator.resolveTailwindV4SourceFromRuntime(runtime));
|
|
1022
1026
|
const report = await (0, _tailwindcss_mangle_engine.extractProjectCandidatesWithPositions)({
|
|
1023
1027
|
base: source.base,
|
|
1024
1028
|
baseFallbacks: source.baseFallbacks,
|
|
@@ -1069,16 +1073,16 @@ function createTailwindcssRuntime(options) {
|
|
|
1069
1073
|
driver: "memory"
|
|
1070
1074
|
};
|
|
1071
1075
|
const normalizedBasedir = basedir ? node_path.default.resolve(basedir) : void 0;
|
|
1072
|
-
const cacheRoot =
|
|
1076
|
+
const cacheRoot = require_generator.findNearestPackageRoot(normalizedBasedir) ?? normalizedBasedir ?? node_process.default.cwd();
|
|
1073
1077
|
if (cacheDir) if (node_path.default.isAbsolute(cacheDir)) cache.dir = cacheDir;
|
|
1074
1078
|
else if (normalizedBasedir) cache.dir = node_path.default.resolve(normalizedBasedir, cacheDir);
|
|
1075
1079
|
else cache.dir = node_path.default.resolve(node_process.default.cwd(), cacheDir);
|
|
1076
1080
|
else cache.dir = node_path.default.join(cacheRoot, "node_modules", ".cache", "@tailwindcss-mangle", "engine");
|
|
1077
1081
|
if (normalizedBasedir) cache.cwd = normalizedBasedir;
|
|
1078
1082
|
const resolvePaths = createDefaultResolvePaths(cache.cwd ?? normalizedBasedir ?? node_process.default.cwd());
|
|
1079
|
-
const normalizedUserOptions =
|
|
1080
|
-
const extendLengthUnits =
|
|
1081
|
-
const baseTailwindOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(tailwindcss ?? {},
|
|
1083
|
+
const normalizedUserOptions = require_generator.normalizeTailwindcssRuntimeOptions(tailwindcssRuntimeOptions);
|
|
1084
|
+
const extendLengthUnits = require_generator.normalizeExtendLengthUnits(supportCustomLengthUnits ?? true);
|
|
1085
|
+
const baseTailwindOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(tailwindcss ?? {}, require_generator.omitUndefined({
|
|
1082
1086
|
cwd: normalizedBasedir,
|
|
1083
1087
|
resolve: { paths: resolvePaths }
|
|
1084
1088
|
}));
|
|
@@ -1088,11 +1092,11 @@ function createTailwindcssRuntime(options) {
|
|
|
1088
1092
|
const resolvedPlugin = resolveModuleFromPaths(baseTailwindOptions.postcssPlugin, resolvePaths);
|
|
1089
1093
|
if (resolvedPlugin) baseTailwindOptions.postcssPlugin = resolvedPlugin;
|
|
1090
1094
|
}
|
|
1091
|
-
const baseOptions =
|
|
1095
|
+
const baseOptions = require_generator.omitUndefined({
|
|
1092
1096
|
projectRoot: normalizedBasedir,
|
|
1093
1097
|
cache,
|
|
1094
1098
|
tailwindcss: baseTailwindOptions,
|
|
1095
|
-
apply:
|
|
1099
|
+
apply: require_generator.omitUndefined({
|
|
1096
1100
|
exposeContext: true,
|
|
1097
1101
|
extendLengthUnits
|
|
1098
1102
|
})
|
|
@@ -1182,7 +1186,7 @@ function createMultiTailwindcssRuntime(runtimes) {
|
|
|
1182
1186
|
}
|
|
1183
1187
|
if (result.classSet) for (const className of result.classSet) aggregatedSet.add(className);
|
|
1184
1188
|
}
|
|
1185
|
-
return
|
|
1189
|
+
return require_generator.omitUndefined({
|
|
1186
1190
|
classList: aggregatedList,
|
|
1187
1191
|
classSet: aggregatedSet,
|
|
1188
1192
|
filename
|
|
@@ -1246,7 +1250,7 @@ function createTailwindcssRuntimeForBase(baseDir, cssEntries, options) {
|
|
|
1246
1250
|
const hasCssEntries = Boolean(cssEntries?.length);
|
|
1247
1251
|
const defaultTailwindcssConfig = {
|
|
1248
1252
|
cwd: baseDir,
|
|
1249
|
-
v4: hasCssEntries ?
|
|
1253
|
+
v4: hasCssEntries ? require_generator.omitUndefined({ cssEntries }) : require_generator.omitUndefined({
|
|
1250
1254
|
base: baseDir,
|
|
1251
1255
|
cssEntries
|
|
1252
1256
|
})
|
|
@@ -1274,7 +1278,7 @@ function createTailwindcssRuntimeForBase(baseDir, cssEntries, options) {
|
|
|
1274
1278
|
packageName: configuredPackageName ?? mergedTailwindOptions.packageName ?? readPackageNameFromBaseDir(baseDir) ?? "tailwindcss"
|
|
1275
1279
|
};
|
|
1276
1280
|
if (supportedResolvedTailwindVersion) tailwindOptionsForPackage.version = supportedResolvedTailwindVersion;
|
|
1277
|
-
return createTailwindcssRuntime(
|
|
1281
|
+
return createTailwindcssRuntime(require_generator.omitUndefined({
|
|
1278
1282
|
basedir: baseDir,
|
|
1279
1283
|
supportCustomLengthUnits: supportCustomLengthUnits ?? true,
|
|
1280
1284
|
tailwindcss: tailwindOptionsForPackage,
|
|
@@ -1427,9 +1431,9 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
1427
1431
|
return node_path.default.normalize(node_path.default.dirname(packageJsonPath));
|
|
1428
1432
|
} catch {
|
|
1429
1433
|
if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("failed to resolve package json for %s", packageName);
|
|
1430
|
-
const workspaceRoot =
|
|
1434
|
+
const workspaceRoot = require_generator.findWorkspaceRoot(anchor);
|
|
1431
1435
|
if (workspaceRoot) {
|
|
1432
|
-
const packageDir =
|
|
1436
|
+
const packageDir = require_generator.findWorkspacePackageDir(workspaceRoot, packageName);
|
|
1433
1437
|
if (packageDir) return packageDir;
|
|
1434
1438
|
}
|
|
1435
1439
|
}
|
|
@@ -1440,12 +1444,16 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
1440
1444
|
//#region src/context/tailwindcss.ts
|
|
1441
1445
|
function createTailwindcssRuntimeFromContext(ctx) {
|
|
1442
1446
|
const { tailwindcssBasedir, supportCustomLengthUnits, tailwindcss, tailwindcssRuntimeOptions, cssEntries: rawCssEntries, appType, arbitraryValues } = ctx;
|
|
1443
|
-
const effectiveSupportCustomLengthUnits = ctx.generator
|
|
1444
|
-
|
|
1447
|
+
const effectiveSupportCustomLengthUnits = require_generator.normalizeWeappTailwindcssGeneratorOptions(ctx.generator, {
|
|
1448
|
+
appType,
|
|
1449
|
+
platform: ctx.cssOptions?.platform ?? ctx.platform,
|
|
1450
|
+
uniAppX: ctx.uniAppX
|
|
1451
|
+
}).target === "web" ? false : supportCustomLengthUnits;
|
|
1452
|
+
const absoluteCssEntryBasedir = require_generator.guessBasedirFromEntries(rawCssEntries);
|
|
1445
1453
|
const resolvedTailwindcssBasedir = resolveTailwindcssBasedir(tailwindcssBasedir, absoluteCssEntryBasedir);
|
|
1446
1454
|
ctx.tailwindcssBasedir = resolvedTailwindcssBasedir;
|
|
1447
1455
|
_weapp_tailwindcss_logger.logger.debug("tailwindcss basedir resolved: %s", resolvedTailwindcssBasedir);
|
|
1448
|
-
const normalizedCssEntries =
|
|
1456
|
+
const normalizedCssEntries = require_generator.normalizeCssEntries(rawCssEntries, resolvedTailwindcssBasedir);
|
|
1449
1457
|
if (normalizedCssEntries) ctx.cssEntries = normalizedCssEntries;
|
|
1450
1458
|
const runtimeOptions = {
|
|
1451
1459
|
tailwindcss,
|
|
@@ -1454,8 +1462,8 @@ function createTailwindcssRuntimeFromContext(ctx) {
|
|
|
1454
1462
|
appType,
|
|
1455
1463
|
bareArbitraryValues: arbitraryValues?.bareArbitraryValues
|
|
1456
1464
|
};
|
|
1457
|
-
const workspaceRoot =
|
|
1458
|
-
const groupedCssEntries = normalizedCssEntries ?
|
|
1465
|
+
const workspaceRoot = require_generator.findWorkspaceRoot(resolvedTailwindcssBasedir) ?? (absoluteCssEntryBasedir ? require_generator.findWorkspaceRoot(absoluteCssEntryBasedir) : void 0);
|
|
1466
|
+
const groupedCssEntries = normalizedCssEntries ? require_generator.groupCssEntriesByBase(normalizedCssEntries, require_generator.omitUndefined({
|
|
1459
1467
|
preferredBaseDir: resolvedTailwindcssBasedir,
|
|
1460
1468
|
workspaceRoot
|
|
1461
1469
|
})) : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Ct as
|
|
1
|
+
import { C as normalizeExtendLengthUnits, Ct as expandTailwindSourceEntries, Dt as resolveCssSourceEntries, E as normalizeStringListOption, Et as parseConfigParam, Ft as loadTailwindV4DesignSystem, Mt as resolveCssMacroTailwindV4Source, Pt as omitUndefined, S as findWorkspaceRoot, St as createTailwindSourceEntryMatcher, T as resolveTailwindcssOptions, Tt as normalizeLegacyContentEntries, _ as guessBasedirFromEntries, b as findNearestPackageRoot, f as resolveTailwindV4SourceOptionsFromRuntime, g as groupCssEntriesByBase, i as normalizeWeappTailwindcssGeneratorOptions, jt as collectCssInlineSourceCandidates, kt as resolveTailwindV4CssSourceBase, m as hasConfiguredTailwindV4CssRoots, p as filterTailwindV4CssSourceRoots, u as resolveTailwindV4SourceFromRuntime, v as isTailwindV4CssEntry, w as normalizeTailwindcssRuntimeOptions, x as findWorkspacePackageDir, xt as FULL_SOURCE_SCAN_PATTERN, y as normalizeCssEntries } from "./generator-ROzBodj6.mjs";
|
|
2
2
|
import { n as defuOverrideArray$1 } from "./utils-DodxWHGz.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
@@ -459,9 +459,13 @@ function createMergedCssEntrySourceScanEntries(entries, options) {
|
|
|
459
459
|
const positiveEntries = entries.filter((entry) => !entry.negated);
|
|
460
460
|
return positiveEntries.length > 0 ? positiveEntries : entries;
|
|
461
461
|
}
|
|
462
|
+
function resolveExplicitSourceScanEntries(entries, explicit) {
|
|
463
|
+
if (!explicit) return entries.length > 0 ? entries : void 0;
|
|
464
|
+
return entries.some((entry) => !entry.negated) ? entries : [];
|
|
465
|
+
}
|
|
462
466
|
function createResolvedV4CssScanInput(entries, inlineCandidates, explicit) {
|
|
463
467
|
return {
|
|
464
|
-
entries:
|
|
468
|
+
entries: resolveExplicitSourceScanEntries(entries, explicit),
|
|
465
469
|
explicit,
|
|
466
470
|
inlineCandidates
|
|
467
471
|
};
|
|
@@ -502,7 +506,7 @@ async function resolveViteSourceScanEntries(options, runtime, scanOptions = {})
|
|
|
502
506
|
const inlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
|
|
503
507
|
const scanEntries = createMergedCssEntrySourceScanEntries(entries, { sourceCount: readableCssEntryCount });
|
|
504
508
|
if (scanEntries.length > 0 || inlineCandidates || explicit || readableCssEntryCount > 0) return createResolvedViteSourceScan({
|
|
505
|
-
entries:
|
|
509
|
+
entries: resolveExplicitSourceScanEntries(scanEntries, explicit),
|
|
506
510
|
explicit,
|
|
507
511
|
inlineCandidates
|
|
508
512
|
}, dependencies);
|
|
@@ -528,7 +532,7 @@ async function resolveViteSourceScanEntries(options, runtime, scanOptions = {})
|
|
|
528
532
|
const cssSourceCount = (sourceOptions.cssSources?.length ?? 0) + configuredCssSources.length;
|
|
529
533
|
const cssSourceScanEntries = createMergedCssEntrySourceScanEntries(entries, { sourceCount: cssSourceCount });
|
|
530
534
|
if (cssSourceScanEntries.length > 0 || cssSourceInlineCandidates || explicit) return createResolvedViteSourceScan({
|
|
531
|
-
entries:
|
|
535
|
+
entries: resolveExplicitSourceScanEntries(cssSourceScanEntries, explicit),
|
|
532
536
|
explicit,
|
|
533
537
|
inlineCandidates: cssSourceInlineCandidates
|
|
534
538
|
}, dependencies);
|
|
@@ -540,7 +544,7 @@ async function resolveViteSourceScanEntries(options, runtime, scanOptions = {})
|
|
|
540
544
|
return resolved ? createResolvedViteSourceScan(createResolvedV4CssScanInput(resolved.entries.length > 0 ? resolved.entries : [], resolved.inlineCandidates, resolved.entries.length > 0 ? resolved.explicit : false), /* @__PURE__ */ new Set([...dependencies, ...resolved.dependencies])) : void 0;
|
|
541
545
|
}
|
|
542
546
|
function createViteSourceScanMatcher(entries) {
|
|
543
|
-
if (entries?.length === 0) return;
|
|
547
|
+
if (entries?.length === 0) return () => false;
|
|
544
548
|
return createTailwindSourceEntryMatcher(entries);
|
|
545
549
|
}
|
|
546
550
|
//#endregion
|
|
@@ -1436,7 +1440,11 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
1436
1440
|
//#region src/context/tailwindcss.ts
|
|
1437
1441
|
function createTailwindcssRuntimeFromContext(ctx) {
|
|
1438
1442
|
const { tailwindcssBasedir, supportCustomLengthUnits, tailwindcss, tailwindcssRuntimeOptions, cssEntries: rawCssEntries, appType, arbitraryValues } = ctx;
|
|
1439
|
-
const effectiveSupportCustomLengthUnits = ctx.generator
|
|
1443
|
+
const effectiveSupportCustomLengthUnits = normalizeWeappTailwindcssGeneratorOptions(ctx.generator, {
|
|
1444
|
+
appType,
|
|
1445
|
+
platform: ctx.cssOptions?.platform ?? ctx.platform,
|
|
1446
|
+
uniAppX: ctx.uniAppX
|
|
1447
|
+
}).target === "web" ? false : supportCustomLengthUnits;
|
|
1440
1448
|
const absoluteCssEntryBasedir = guessBasedirFromEntries(rawCssEntries);
|
|
1441
1449
|
const resolvedTailwindcssBasedir = resolveTailwindcssBasedir(tailwindcssBasedir, absoluteCssEntryBasedir);
|
|
1442
1450
|
ctx.tailwindcssBasedir = resolvedTailwindcssBasedir;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as createAttributeMatcher, d as JsTokenUpdater, f as _defineProperty, h as babelParse, m as replaceWxml, p as isClassContextLiteralPath, s as generateCode, u as analyzeSource } from "./context-
|
|
1
|
+
import { c as createAttributeMatcher, d as JsTokenUpdater, f as _defineProperty, h as babelParse, m as replaceWxml, p as isClassContextLiteralPath, s as generateCode, u as analyzeSource } from "./context-DzkSFEVL.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import { splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
4
4
|
import MagicString from "magic-string";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
-
const require_context = require("./context-
|
|
2
|
+
const require_context = require("./context-y2BGCok4.js");
|
|
3
3
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
4
4
|
let magic_string = require("magic-string");
|
|
5
5
|
magic_string = require_rolldown_runtime.__toESM(magic_string);
|