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
|
@@ -53,14 +53,14 @@ function resolveRegisteredCssSource(file, source) {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
function isPlainCssResource(file) {
|
|
56
|
-
return new Set([
|
|
56
|
+
return (/* @__PURE__ */ new Set([
|
|
57
57
|
".acss",
|
|
58
58
|
".css",
|
|
59
59
|
".jxss",
|
|
60
60
|
".qss",
|
|
61
61
|
".ttss",
|
|
62
62
|
".wxss"
|
|
63
|
-
]).has(node_path.default.extname(file.replace(/[?#].*$/, "")).toLowerCase());
|
|
63
|
+
])).has(node_path.default.extname(file.replace(/[?#].*$/, "")).toLowerCase());
|
|
64
64
|
}
|
|
65
65
|
const WeappTwRuntimeClassSetLoader = function(source) {
|
|
66
66
|
if (node_process.default.env["WEAPP_TW_LOADER_DEBUG"]) node_process.default.stdout.write(`[weapp-tw-runtime-classset-loader] executing for ${this.resourcePath}\n`);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { C as hasTailwindRootDirectives, F as hasTailwindGeneratedCssMarkers, G as getTailwindV4IncrementalGenerateCacheStats, O as parseImportRequest, P as hasTailwindGeneratedCss, T as normalizeTailwindConfigDirectives, _ as resolveTailwindcssOptions,
|
|
2
|
-
import { o as resolveRuntimeBranch } from "./generator-
|
|
1
|
+
import { C as hasTailwindRootDirectives, F as hasTailwindGeneratedCssMarkers, G as getTailwindV4IncrementalGenerateCacheStats, O as parseImportRequest, P as hasTailwindGeneratedCss, T as normalizeTailwindConfigDirectives, _ as resolveTailwindcssOptions, k as removeTailwindSourceDirectives, lt as inferGeneratorTargetFromEnv, nt as resolveSourceScanPath, o as hasConfiguredTailwindV4CssRoots, s as upsertTailwindV4CssSource, w as hasTailwindSourceDirectives, x as hasTailwindApplyDirective } from "./v4-engine-BuuYDXt1.mjs";
|
|
2
|
+
import { o as resolveRuntimeBranch } from "./generator-24-HgU9F.mjs";
|
|
3
3
|
import { r as getGroupedEntries } from "./utils-DodxWHGz.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-
|
|
6
|
-
import { C as stripTailwindSourceMediaFragments, D as createCssSourceOrderAppend, E as removeGeneratedSelectorCompatCss, F as createCssTokenSourceMap, I as isCssSourceTraceEnabled, L as processCachedTask, M as stripMiniProgramCssSpecificityPlaceholders, N as annotateCssSourceTrace, O as hasMiniProgramTailwindV4PreflightReset, P as createCssSourceTraceCacheSignature, S as removeTailwindV4GeneratorAtRules, T as scoreTailwindV4CssSourceFileMatch, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, b as removeMiniProgramHoverSelectors, c as collectStrictEscapedRuntimeCandidates, f as pushConcurrentTaskFactories, i as createSourceCandidateStore, j as pruneMiniProgramGeneratedCss, k as finalizeMiniProgramCss, l as createEscapeFragments, n as emitHmrTiming, o as resolveSourceCandidateScanFiles, p as resolveTaskConcurrency, s as createBundleRuntimeClassSetManager, w as stripUnmatchedTailwindSourceMediaCloseFragments, x as removeTailwindV4GeneratedUserCssArtifacts } from "./hmr-timing-
|
|
7
|
-
import { A as isSourceStyleRequest, C as resolvePluginDisabledState, N as resolveOutputSpecifier, P as toAbsoluteOutputPath, S as resolvePackageDir, _ as generateTailwindV4Css, d as classifyBundleEntry, f as createBundleBuildState, i as createCandidateSignature, j as stripRequestQuery, m as createRuntimeAffectingSourceSignature, p as updateBundleBuildState, r as createScopedGeneratorRuntime, t as createSourceCandidateScanSignature, x as stripBundlerGeneratedCssMarkers, y as hasBundlerGeneratedCssMarker } from "./source-candidate-scan-signature-
|
|
4
|
+
import { S as createDebug, b as ensureRuntimeClassSet, f as _defineProperty, i as pluginName, l as shouldSkipJsTransform, n as normalizeStyleHandlerMajorVersion, r as resolveStyleOptionsFromContext, t as getCompilerContext, w as md5Hash, x as refreshTailwindRuntimeState, y as createTailwindRuntimeReadyPromise } from "./context-Bkpmt3ja.mjs";
|
|
5
|
+
import { l as getRuntimeClassSetSignature, p as resolveViteSourceScanEntries } from "./tailwindcss-D0JF0fuZ.mjs";
|
|
6
|
+
import { C as stripTailwindSourceMediaFragments, D as createCssSourceOrderAppend, E as removeGeneratedSelectorCompatCss, F as createCssTokenSourceMap, I as isCssSourceTraceEnabled, L as processCachedTask, M as stripMiniProgramCssSpecificityPlaceholders, N as annotateCssSourceTrace, O as hasMiniProgramTailwindV4PreflightReset, P as createCssSourceTraceCacheSignature, S as removeTailwindV4GeneratorAtRules, T as scoreTailwindV4CssSourceFileMatch, _ as isPureLocalCssImportWrapper, a as isSourceCandidateRequest, b as removeMiniProgramHoverSelectors, c as collectStrictEscapedRuntimeCandidates, f as pushConcurrentTaskFactories, i as createSourceCandidateStore, j as pruneMiniProgramGeneratedCss, k as finalizeMiniProgramCss, l as createEscapeFragments, n as emitHmrTiming, o as resolveSourceCandidateScanFiles, p as resolveTaskConcurrency, s as createBundleRuntimeClassSetManager, w as stripUnmatchedTailwindSourceMediaCloseFragments, x as removeTailwindV4GeneratedUserCssArtifacts } from "./hmr-timing-BRNaz8Od.mjs";
|
|
7
|
+
import { A as isSourceStyleRequest, C as resolvePluginDisabledState, N as resolveOutputSpecifier, P as toAbsoluteOutputPath, S as resolvePackageDir, _ as generateTailwindV4Css, d as classifyBundleEntry, f as createBundleBuildState, i as createCandidateSignature, j as stripRequestQuery, m as createRuntimeAffectingSourceSignature, p as updateBundleBuildState, r as createScopedGeneratorRuntime, t as createSourceCandidateScanSignature, x as stripBundlerGeneratedCssMarkers, y as hasBundlerGeneratedCssMarker } from "./source-candidate-scan-signature-BB1hvW68.mjs";
|
|
8
8
|
import Module, { createRequire } from "node:module";
|
|
9
9
|
import fs from "node:fs";
|
|
10
10
|
import path from "node:path";
|
|
@@ -21,7 +21,7 @@ function installTailwindcssCssRedirect(pkgDir) {
|
|
|
21
21
|
const target = path.join(pkgDir, "index.css");
|
|
22
22
|
const original = moduleWithMutableResolve._resolveFilename;
|
|
23
23
|
if (patched.has(original)) return;
|
|
24
|
-
const replacements = new Set(["tailwindcss", "tailwindcss$"]);
|
|
24
|
+
const replacements = /* @__PURE__ */ new Set(["tailwindcss", "tailwindcss$"]);
|
|
25
25
|
const resolveTailwindcssCss = (request, parent, isMain, options) => {
|
|
26
26
|
if (replacements.has(request)) return target;
|
|
27
27
|
if (request.startsWith("tailwindcss/")) return path.join(pkgDir, request.slice(12));
|
|
@@ -398,6 +398,45 @@ function normalizeWebpackGeneratorCssSources(cssSources) {
|
|
|
398
398
|
const normalized = cssSources.filter((source) => typeof source?.css === "string" && source.css.length > 0);
|
|
399
399
|
return normalized.length > 0 ? normalized : void 0;
|
|
400
400
|
}
|
|
401
|
+
function scopeWebpackGeneratorOptionsToCssSource(compilerOptions, sourceFile, options = {}) {
|
|
402
|
+
const withoutCssEntries = () => ({
|
|
403
|
+
...compilerOptions,
|
|
404
|
+
...compilerOptions.cssEntries?.length ? { cssEntries: [] } : {},
|
|
405
|
+
tailwindcss: {
|
|
406
|
+
...compilerOptions.tailwindcss,
|
|
407
|
+
v4: {
|
|
408
|
+
...compilerOptions.tailwindcss?.v4,
|
|
409
|
+
...compilerOptions.tailwindcss?.v4?.cssEntries?.length || compilerOptions.cssEntries?.length ? { cssEntries: [] } : {}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
});
|
|
413
|
+
if (!sourceFile) {
|
|
414
|
+
if (options.disableUnmatchedCssEntries !== true) return compilerOptions;
|
|
415
|
+
if (!compilerOptions.cssEntries?.length && !compilerOptions.tailwindcss?.v4?.cssEntries?.length) return compilerOptions;
|
|
416
|
+
return withoutCssEntries();
|
|
417
|
+
}
|
|
418
|
+
const resolvedSourceFile = path.resolve(sourceFile);
|
|
419
|
+
if (options.disableUnmatchedCssEntries === true) {
|
|
420
|
+
const configuredEntries = [...compilerOptions.cssEntries ?? [], ...compilerOptions.tailwindcss?.v4?.cssEntries ?? []];
|
|
421
|
+
if (configuredEntries.length > 0 && !configuredEntries.some((entry) => path.resolve(entry) === resolvedSourceFile)) return withoutCssEntries();
|
|
422
|
+
}
|
|
423
|
+
const cssEntries = compilerOptions.cssEntries?.filter((entry) => path.resolve(entry) === resolvedSourceFile);
|
|
424
|
+
const runtimeCssEntries = compilerOptions.tailwindcss?.v4?.cssEntries?.filter((entry) => path.resolve(entry) === resolvedSourceFile);
|
|
425
|
+
const hasScopedCssEntries = Boolean(cssEntries?.length);
|
|
426
|
+
const hasScopedRuntimeCssEntries = Boolean(runtimeCssEntries?.length);
|
|
427
|
+
if (!hasScopedCssEntries && !hasScopedRuntimeCssEntries) return compilerOptions;
|
|
428
|
+
return {
|
|
429
|
+
...compilerOptions,
|
|
430
|
+
...hasScopedCssEntries ? { cssEntries } : {},
|
|
431
|
+
tailwindcss: {
|
|
432
|
+
...compilerOptions.tailwindcss,
|
|
433
|
+
v4: {
|
|
434
|
+
...compilerOptions.tailwindcss?.v4,
|
|
435
|
+
...hasScopedRuntimeCssEntries ? { cssEntries: runtimeCssEntries } : hasScopedCssEntries ? { cssEntries } : {}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
}
|
|
401
440
|
function hasProcessedCssAssetUrl(css) {
|
|
402
441
|
return /url\(\s*["']?data:/i.test(css);
|
|
403
442
|
}
|
|
@@ -424,13 +463,14 @@ function collectWebpackAssetUserCssMarkers(source) {
|
|
|
424
463
|
} catch {}
|
|
425
464
|
return markers;
|
|
426
465
|
}
|
|
427
|
-
const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = new Set([
|
|
466
|
+
const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = /* @__PURE__ */ new Set([
|
|
428
467
|
"theme",
|
|
429
468
|
"base",
|
|
430
469
|
"utilities"
|
|
431
470
|
]);
|
|
432
471
|
const WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE = /(?:^|[^\w-])\.[^,{]{0,512}(?:\\:|\\\[|\\#)/;
|
|
433
472
|
const WEBPACK_TAILWIND_UTILITY_PREFIX_RE = /^\.(?:-?(?:bg|text|border|ring|shadow|drop-shadow|[pmwhz]|px|py|pt|pr|pb|pl|mx|my|mt|mr|mb|ml|min-w|min-h|max-w|max-h|flex|grid|inline|block|hidden|rounded|opacity|translate|scale|rotate|skew|top|right|bottom|left|inset|gap|font|leading|tracking|underline|container)(?:[\-\\{]|$)|\\\[)/;
|
|
473
|
+
const WEBPACK_TAILWIND_BANNER_RE = /tailwindcss v4\./;
|
|
434
474
|
function parseWebpackCssLayerNames(params) {
|
|
435
475
|
return params.split(",").map((name) => name.trim()).filter(Boolean);
|
|
436
476
|
}
|
|
@@ -439,6 +479,22 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
439
479
|
try {
|
|
440
480
|
const root = postcss.parse(cleaned);
|
|
441
481
|
let changed = false;
|
|
482
|
+
let removingBannerPrefix = false;
|
|
483
|
+
for (const node of [...root.nodes]) {
|
|
484
|
+
if (node.type === "comment" && WEBPACK_TAILWIND_BANNER_RE.test(node.text)) {
|
|
485
|
+
node.remove();
|
|
486
|
+
changed = true;
|
|
487
|
+
removingBannerPrefix = true;
|
|
488
|
+
continue;
|
|
489
|
+
}
|
|
490
|
+
if (!removingBannerPrefix) continue;
|
|
491
|
+
if (isWebpackTailwindGeneratedPrefixNode(node)) {
|
|
492
|
+
node.remove();
|
|
493
|
+
changed = true;
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
removingBannerPrefix = false;
|
|
497
|
+
}
|
|
442
498
|
root.walkAtRules("layer", (rule) => {
|
|
443
499
|
const names = parseWebpackCssLayerNames(rule.params);
|
|
444
500
|
const hasGeneratedLayerName = names.some((name) => WEBPACK_TAILWIND_GENERATED_LAYER_NAMES.has(name));
|
|
@@ -468,6 +524,20 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
468
524
|
}
|
|
469
525
|
}
|
|
470
526
|
});
|
|
527
|
+
root.walkRules((rule) => {
|
|
528
|
+
if (rule.parent?.type === "atrule" && rule.parent.name === "layer") return;
|
|
529
|
+
const selector = rule.selector.trim();
|
|
530
|
+
if (WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE.test(selector)) {
|
|
531
|
+
rule.remove();
|
|
532
|
+
changed = true;
|
|
533
|
+
}
|
|
534
|
+
});
|
|
535
|
+
root.walkComments((comment) => {
|
|
536
|
+
if (WEBPACK_TAILWIND_BANNER_RE.test(comment.text)) {
|
|
537
|
+
comment.remove();
|
|
538
|
+
changed = true;
|
|
539
|
+
}
|
|
540
|
+
});
|
|
471
541
|
root.walkAtRules((rule) => {
|
|
472
542
|
if (rule.nodes !== void 0 && rule.nodes.length === 0) {
|
|
473
543
|
rule.remove();
|
|
@@ -479,6 +549,18 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
479
549
|
return cleaned;
|
|
480
550
|
}
|
|
481
551
|
}
|
|
552
|
+
function isWebpackTailwindGeneratedPrefixNode(node) {
|
|
553
|
+
if (node.type === "rule") return node.selectors.every((selector) => isWebpackTailwindGeneratedUtilitySelector(selector.trim(), true));
|
|
554
|
+
if (node.type !== "atrule") return false;
|
|
555
|
+
const names = node.name === "layer" ? parseWebpackCssLayerNames(node.params) : [];
|
|
556
|
+
if (node.name === "property" && node.params.trim().startsWith("--tw-")) return true;
|
|
557
|
+
if (names.length > 0 && names.every((name) => WEBPACK_TAILWIND_GENERATED_LAYER_NAMES.has(name))) return true;
|
|
558
|
+
if (node.nodes === void 0 || node.nodes.length === 0) return false;
|
|
559
|
+
return node.nodes.every((child) => isWebpackTailwindGeneratedPrefixNode(child));
|
|
560
|
+
}
|
|
561
|
+
function isWebpackTailwindGeneratedUtilitySelector(selector, includePrefix) {
|
|
562
|
+
return WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE.test(selector) || includePrefix && WEBPACK_TAILWIND_UTILITY_PREFIX_RE.test(selector);
|
|
563
|
+
}
|
|
482
564
|
function collectWebpackCssRuleIdentityMarkers(source) {
|
|
483
565
|
const markers = /* @__PURE__ */ new Set();
|
|
484
566
|
try {
|
|
@@ -787,6 +869,7 @@ function createWebpackCssSourceResolvers(options) {
|
|
|
787
869
|
const activeWebpackCssSourceFiles = /* @__PURE__ */ new Set();
|
|
788
870
|
const resolveConfiguredMainCssSourceFile = (file) => {
|
|
789
871
|
if (!isMainCssChunk(file)) return;
|
|
872
|
+
if (configuredMainCssEntryFiles.length !== 1) return;
|
|
790
873
|
for (const sourceFile of configuredMainCssEntryFiles) if (cssSources.has(sourceFile)) {
|
|
791
874
|
activeWebpackCssSourceFiles.add(sourceFile);
|
|
792
875
|
return sourceFile;
|
|
@@ -1764,7 +1847,9 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1764
1847
|
if (isPureLocalCssImportWrapper(currentRawSource)) return { result: new ConcatSource(removeTailwindSourceDirectives(stripBundlerGeneratedCssMarkers(currentRawSource), { importFallback: true })) };
|
|
1765
1848
|
const fallbackGeneratorRuntimeSet = getGeneratorRuntimeSet();
|
|
1766
1849
|
const hasExplicitTailwindV4SourceCss = sourceCss !== void 0 && (hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || sourceCss.includes("@config"));
|
|
1767
|
-
const
|
|
1850
|
+
const currentAssetHasTailwindDirectives = hasTailwindRootDirectives(generatorRawSource, { importFallback: true }) || hasTailwindSourceDirectives(generatorRawSource, { importFallback: true }) || hasTailwindApplyDirective(generatorRawSource);
|
|
1851
|
+
const shouldForceTailwindV4Generation = cssHandlerOptions.isMainChunk && hasConfiguredTailwindV4SourceRoots() && (configuredMainCssEntryFiles.length > 0 || currentAssetHasTailwindDirectives || hasExplicitTailwindV4SourceCss);
|
|
1852
|
+
const shouldSkipUnmatchedMainCssGeneration = !isWebGeneratorTarget && cssHandlerOptions.isMainChunk && sourceFile === void 0 && configuredMainCssEntryFiles.length > 0 && !currentAssetHasTailwindDirectives;
|
|
1768
1853
|
const resolvedScopedGeneratorRuntimeSet = await createScopedGeneratorRuntime({
|
|
1769
1854
|
cssHandlerOptions,
|
|
1770
1855
|
fallbackRuntime: hasExplicitTailwindV4SourceCss ? /* @__PURE__ */ new Set() : fallbackGeneratorRuntimeSet,
|
|
@@ -1776,8 +1861,9 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1776
1861
|
sourceFile: sourceFile ?? file,
|
|
1777
1862
|
scopedSourceCandidateGetter: webpackSourceCandidates?.getSourceCandidatesForEntries
|
|
1778
1863
|
});
|
|
1779
|
-
const scopedGeneratorRuntimeSet = !hasExplicitTailwindV4SourceCss && resolvedScopedGeneratorRuntimeSet !== fallbackGeneratorRuntimeSet ? new Set([...fallbackGeneratorRuntimeSet, ...resolvedScopedGeneratorRuntimeSet]) : resolvedScopedGeneratorRuntimeSet;
|
|
1864
|
+
const scopedGeneratorRuntimeSet = !hasExplicitTailwindV4SourceCss && resolvedScopedGeneratorRuntimeSet !== fallbackGeneratorRuntimeSet ? /* @__PURE__ */ new Set([...fallbackGeneratorRuntimeSet, ...resolvedScopedGeneratorRuntimeSet]) : resolvedScopedGeneratorRuntimeSet;
|
|
1780
1865
|
const generatorCssSources = normalizeWebpackGeneratorCssSources(cssHandlerOptions.sourceOptions?.cssSources);
|
|
1866
|
+
const scopedGeneratorCompilerOptions = scopeWebpackGeneratorOptionsToCssSource(compilerOptions, sourceFile, { disableUnmatchedCssEntries: !isWebGeneratorTarget && cssHandlerOptions.isMainChunk });
|
|
1781
1867
|
const generatorCssHandlerOptions = generatorCssSources === void 0 ? cssHandlerOptions : {
|
|
1782
1868
|
...cssHandlerOptions,
|
|
1783
1869
|
sourceOptions: {
|
|
@@ -1786,7 +1872,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1786
1872
|
}
|
|
1787
1873
|
};
|
|
1788
1874
|
const generatorOptions = {
|
|
1789
|
-
opts:
|
|
1875
|
+
opts: scopedGeneratorCompilerOptions,
|
|
1790
1876
|
runtimeState,
|
|
1791
1877
|
runtime: scopedGeneratorRuntimeSet,
|
|
1792
1878
|
rawSource: generatorRawSource,
|
|
@@ -1804,7 +1890,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1804
1890
|
debug
|
|
1805
1891
|
};
|
|
1806
1892
|
let generated;
|
|
1807
|
-
try {
|
|
1893
|
+
if (!shouldSkipUnmatchedMainCssGeneration) try {
|
|
1808
1894
|
generated = await generateTailwindV4Css({
|
|
1809
1895
|
...generatorOptions,
|
|
1810
1896
|
outputFile: file
|
|
@@ -1818,6 +1904,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1818
1904
|
debug("css generator skipped for plain webpack css asset: %s %O", file, error);
|
|
1819
1905
|
generated = void 0;
|
|
1820
1906
|
}
|
|
1907
|
+
else debug("css generator skipped for unmatched webpack main css asset: %s", file);
|
|
1821
1908
|
const source = new ConcatSource(finalizeTracedCss(generated ? finalizeCssAssetSource(isWebGeneratorTarget && currentRawSource.includes("tailwindcss v4.") ? createWebpackGeneratorUserCssSourceAppend({
|
|
1822
1909
|
css: generated.css,
|
|
1823
1910
|
processed: true
|
|
@@ -1850,7 +1937,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1850
1937
|
});
|
|
1851
1938
|
const activeCssFiles = new Set(groupedEntries.css.map(([file]) => file));
|
|
1852
1939
|
pruneWebpackCssHandlerOptionCaches(cssHandlerOptionsCache, cssUserHandlerOptionsCache, activeCssFiles);
|
|
1853
|
-
if (activeCssFiles.size > 0) pruneWebpackCssSources?.(new Set([
|
|
1940
|
+
if (activeCssFiles.size > 0) pruneWebpackCssSources?.(/* @__PURE__ */ new Set([
|
|
1854
1941
|
...registeredWebpackCssSourceFiles,
|
|
1855
1942
|
...activeWebpackCssSourceFiles,
|
|
1856
1943
|
...[...cssAssetResources.values()].flatMap((resources) => [...resources])
|
|
@@ -1872,7 +1959,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1872
1959
|
});
|
|
1873
1960
|
}
|
|
1874
1961
|
//#endregion
|
|
1875
|
-
//#region ../../node_modules/.pnpm/tsdown@0.22.
|
|
1962
|
+
//#region ../../node_modules/.pnpm/tsdown@0.22.3_oxc-resolver@11.20.0_tsx@4.22.4_typescript@6.0.3_unrun@0.2.37_synckit@0.1_6cbb3bb94bab8b3379a6056ffc71c3e9/node_modules/tsdown/esm-shims.js
|
|
1876
1963
|
const getFilename = () => fileURLToPath(import.meta.url);
|
|
1877
1964
|
const getDirname = () => path.dirname(getFilename());
|
|
1878
1965
|
const __dirname = /* @__PURE__ */ getDirname();
|
|
@@ -2001,7 +2088,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
2001
2088
|
};
|
|
2002
2089
|
if (cssImportRewriteLoaderOptions && runtimeCssImportRewriteLoaderExists && runtimeCssImportRewriteLoader && isCssModule) {
|
|
2003
2090
|
const existingIndex = loaderEntries.findIndex((entry) => entry.loader?.includes?.(runtimeCssImportRewriteLoader));
|
|
2004
|
-
const rewriteLoaderEntry = existingIndex !== -1 ?
|
|
2091
|
+
const rewriteLoaderEntry = existingIndex !== -1 ? {
|
|
2092
|
+
...loaderEntries.splice(existingIndex, 1)[0],
|
|
2093
|
+
loader: runtimeCssImportRewriteLoader,
|
|
2094
|
+
options: cssImportRewriteLoaderOptions
|
|
2095
|
+
} : createCssImportRewriteLoaderEntry();
|
|
2005
2096
|
if (rewriteLoaderEntry) {
|
|
2006
2097
|
const anchorIndex = findRewriteAnchor(loaderEntries);
|
|
2007
2098
|
if (anchorIndex === -1) anchorlessInsert(rewriteLoaderEntry, "after");
|
|
@@ -2164,7 +2255,7 @@ var WeappTailwindcss = class {
|
|
|
2164
2255
|
};
|
|
2165
2256
|
const collectWatchChangedFiles = () => {
|
|
2166
2257
|
const compilerLike = compiler;
|
|
2167
|
-
return new Set([...compilerLike.modifiedFiles ?? [], ...compilerLike.removedFiles ?? []]);
|
|
2258
|
+
return /* @__PURE__ */ new Set([...compilerLike.modifiedFiles ?? [], ...compilerLike.removedFiles ?? []]);
|
|
2168
2259
|
};
|
|
2169
2260
|
const hasRuntimeDependencyChanges = (files) => {
|
|
2170
2261
|
for (const file of files) if (isWatchFileInRuntimeDependencies(file, {
|
|
@@ -2234,7 +2325,7 @@ var WeappTailwindcss = class {
|
|
|
2234
2325
|
const configuredSourceFiles = /* @__PURE__ */ new Set();
|
|
2235
2326
|
for (const entry of tailwindOptions?.v4?.cssEntries ?? []) configuredSourceFiles.add(path.resolve(entry));
|
|
2236
2327
|
for (const source of tailwindOptions?.v4?.cssSources ?? []) if (source.file) configuredSourceFiles.add(path.resolve(source.file));
|
|
2237
|
-
const activeSourceFiles = new Set([
|
|
2328
|
+
const activeSourceFiles = /* @__PURE__ */ new Set([
|
|
2238
2329
|
...configuredSourceFiles,
|
|
2239
2330
|
...currentWebpackCssSourceModules,
|
|
2240
2331
|
...activeAssetResources,
|
|
@@ -2331,4 +2422,4 @@ var WeappTailwindcss = class {
|
|
|
2331
2422
|
}
|
|
2332
2423
|
};
|
|
2333
2424
|
//#endregion
|
|
2334
|
-
export { weappTailwindcssPackageDir as n, WeappTailwindcss as t };
|
|
2425
|
+
export { weappTailwindcssPackageDir as n, __dirname as r, WeappTailwindcss as t };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_v4_engine = require("./v4-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_utils = require("./utils-
|
|
5
|
-
const require_context = require("./context-
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
8
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
+
const require_v4_engine = require("./v4-engine-CKtsdKxK.js");
|
|
3
|
+
const require_generator = require("./generator-CilgHtxb.js");
|
|
4
|
+
const require_utils = require("./utils-D3h8j7Mk.js");
|
|
5
|
+
const require_context = require("./context-DCVMkTRj.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-D2xs4OEu.js");
|
|
7
|
+
const require_hmr_timing = require("./hmr-timing-BV6nFPoT.js");
|
|
8
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-CaDT0gkj.js");
|
|
9
9
|
let node_fs = require("node:fs");
|
|
10
|
-
node_fs =
|
|
10
|
+
node_fs = require_rolldown_runtime.__toESM(node_fs);
|
|
11
11
|
let node_path = require("node:path");
|
|
12
|
-
node_path =
|
|
12
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
13
13
|
let node_process = require("node:process");
|
|
14
|
-
node_process =
|
|
14
|
+
node_process = require_rolldown_runtime.__toESM(node_process);
|
|
15
15
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
16
16
|
let node_fs_promises = require("node:fs/promises");
|
|
17
17
|
let micromatch = require("micromatch");
|
|
18
|
-
micromatch =
|
|
18
|
+
micromatch = require_rolldown_runtime.__toESM(micromatch);
|
|
19
19
|
let node_module = require("node:module");
|
|
20
|
-
node_module =
|
|
20
|
+
node_module = require_rolldown_runtime.__toESM(node_module);
|
|
21
21
|
let _weapp_core_escape = require("@weapp-core/escape");
|
|
22
22
|
let _weapp_tailwindcss_shared_node = require("@weapp-tailwindcss/shared/node");
|
|
23
23
|
//#region src/shared/tailwindcss-css-redirect.ts
|
|
@@ -27,7 +27,7 @@ function installTailwindcssCssRedirect(pkgDir) {
|
|
|
27
27
|
const target = node_path.default.join(pkgDir, "index.css");
|
|
28
28
|
const original = moduleWithMutableResolve._resolveFilename;
|
|
29
29
|
if (patched.has(original)) return;
|
|
30
|
-
const replacements = new Set(["tailwindcss", "tailwindcss$"]);
|
|
30
|
+
const replacements = /* @__PURE__ */ new Set(["tailwindcss", "tailwindcss$"]);
|
|
31
31
|
const resolveTailwindcssCss = (request, parent, isMain, options) => {
|
|
32
32
|
if (replacements.has(request)) return target;
|
|
33
33
|
if (request.startsWith("tailwindcss/")) return node_path.default.join(pkgDir, request.slice(12));
|
|
@@ -404,6 +404,45 @@ function normalizeWebpackGeneratorCssSources(cssSources) {
|
|
|
404
404
|
const normalized = cssSources.filter((source) => typeof source?.css === "string" && source.css.length > 0);
|
|
405
405
|
return normalized.length > 0 ? normalized : void 0;
|
|
406
406
|
}
|
|
407
|
+
function scopeWebpackGeneratorOptionsToCssSource(compilerOptions, sourceFile, options = {}) {
|
|
408
|
+
const withoutCssEntries = () => ({
|
|
409
|
+
...compilerOptions,
|
|
410
|
+
...compilerOptions.cssEntries?.length ? { cssEntries: [] } : {},
|
|
411
|
+
tailwindcss: {
|
|
412
|
+
...compilerOptions.tailwindcss,
|
|
413
|
+
v4: {
|
|
414
|
+
...compilerOptions.tailwindcss?.v4,
|
|
415
|
+
...compilerOptions.tailwindcss?.v4?.cssEntries?.length || compilerOptions.cssEntries?.length ? { cssEntries: [] } : {}
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
if (!sourceFile) {
|
|
420
|
+
if (options.disableUnmatchedCssEntries !== true) return compilerOptions;
|
|
421
|
+
if (!compilerOptions.cssEntries?.length && !compilerOptions.tailwindcss?.v4?.cssEntries?.length) return compilerOptions;
|
|
422
|
+
return withoutCssEntries();
|
|
423
|
+
}
|
|
424
|
+
const resolvedSourceFile = node_path.default.resolve(sourceFile);
|
|
425
|
+
if (options.disableUnmatchedCssEntries === true) {
|
|
426
|
+
const configuredEntries = [...compilerOptions.cssEntries ?? [], ...compilerOptions.tailwindcss?.v4?.cssEntries ?? []];
|
|
427
|
+
if (configuredEntries.length > 0 && !configuredEntries.some((entry) => node_path.default.resolve(entry) === resolvedSourceFile)) return withoutCssEntries();
|
|
428
|
+
}
|
|
429
|
+
const cssEntries = compilerOptions.cssEntries?.filter((entry) => node_path.default.resolve(entry) === resolvedSourceFile);
|
|
430
|
+
const runtimeCssEntries = compilerOptions.tailwindcss?.v4?.cssEntries?.filter((entry) => node_path.default.resolve(entry) === resolvedSourceFile);
|
|
431
|
+
const hasScopedCssEntries = Boolean(cssEntries?.length);
|
|
432
|
+
const hasScopedRuntimeCssEntries = Boolean(runtimeCssEntries?.length);
|
|
433
|
+
if (!hasScopedCssEntries && !hasScopedRuntimeCssEntries) return compilerOptions;
|
|
434
|
+
return {
|
|
435
|
+
...compilerOptions,
|
|
436
|
+
...hasScopedCssEntries ? { cssEntries } : {},
|
|
437
|
+
tailwindcss: {
|
|
438
|
+
...compilerOptions.tailwindcss,
|
|
439
|
+
v4: {
|
|
440
|
+
...compilerOptions.tailwindcss?.v4,
|
|
441
|
+
...hasScopedRuntimeCssEntries ? { cssEntries: runtimeCssEntries } : hasScopedCssEntries ? { cssEntries } : {}
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
}
|
|
407
446
|
function hasProcessedCssAssetUrl(css) {
|
|
408
447
|
return /url\(\s*["']?data:/i.test(css);
|
|
409
448
|
}
|
|
@@ -430,13 +469,14 @@ function collectWebpackAssetUserCssMarkers(source) {
|
|
|
430
469
|
} catch {}
|
|
431
470
|
return markers;
|
|
432
471
|
}
|
|
433
|
-
const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = new Set([
|
|
472
|
+
const WEBPACK_TAILWIND_GENERATED_LAYER_NAMES = /* @__PURE__ */ new Set([
|
|
434
473
|
"theme",
|
|
435
474
|
"base",
|
|
436
475
|
"utilities"
|
|
437
476
|
]);
|
|
438
477
|
const WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE = /(?:^|[^\w-])\.[^,{]{0,512}(?:\\:|\\\[|\\#)/;
|
|
439
478
|
const WEBPACK_TAILWIND_UTILITY_PREFIX_RE = /^\.(?:-?(?:bg|text|border|ring|shadow|drop-shadow|[pmwhz]|px|py|pt|pr|pb|pl|mx|my|mt|mr|mb|ml|min-w|min-h|max-w|max-h|flex|grid|inline|block|hidden|rounded|opacity|translate|scale|rotate|skew|top|right|bottom|left|inset|gap|font|leading|tracking|underline|container)(?:[\-\\{]|$)|\\\[)/;
|
|
479
|
+
const WEBPACK_TAILWIND_BANNER_RE = /tailwindcss v4\./;
|
|
440
480
|
function parseWebpackCssLayerNames(params) {
|
|
441
481
|
return params.split(",").map((name) => name.trim()).filter(Boolean);
|
|
442
482
|
}
|
|
@@ -445,6 +485,22 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
445
485
|
try {
|
|
446
486
|
const root = _weapp_tailwindcss_postcss.postcss.parse(cleaned);
|
|
447
487
|
let changed = false;
|
|
488
|
+
let removingBannerPrefix = false;
|
|
489
|
+
for (const node of [...root.nodes]) {
|
|
490
|
+
if (node.type === "comment" && WEBPACK_TAILWIND_BANNER_RE.test(node.text)) {
|
|
491
|
+
node.remove();
|
|
492
|
+
changed = true;
|
|
493
|
+
removingBannerPrefix = true;
|
|
494
|
+
continue;
|
|
495
|
+
}
|
|
496
|
+
if (!removingBannerPrefix) continue;
|
|
497
|
+
if (isWebpackTailwindGeneratedPrefixNode(node)) {
|
|
498
|
+
node.remove();
|
|
499
|
+
changed = true;
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
removingBannerPrefix = false;
|
|
503
|
+
}
|
|
448
504
|
root.walkAtRules("layer", (rule) => {
|
|
449
505
|
const names = parseWebpackCssLayerNames(rule.params);
|
|
450
506
|
const hasGeneratedLayerName = names.some((name) => WEBPACK_TAILWIND_GENERATED_LAYER_NAMES.has(name));
|
|
@@ -474,6 +530,20 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
474
530
|
}
|
|
475
531
|
}
|
|
476
532
|
});
|
|
533
|
+
root.walkRules((rule) => {
|
|
534
|
+
if (rule.parent?.type === "atrule" && rule.parent.name === "layer") return;
|
|
535
|
+
const selector = rule.selector.trim();
|
|
536
|
+
if (WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE.test(selector)) {
|
|
537
|
+
rule.remove();
|
|
538
|
+
changed = true;
|
|
539
|
+
}
|
|
540
|
+
});
|
|
541
|
+
root.walkComments((comment) => {
|
|
542
|
+
if (WEBPACK_TAILWIND_BANNER_RE.test(comment.text)) {
|
|
543
|
+
comment.remove();
|
|
544
|
+
changed = true;
|
|
545
|
+
}
|
|
546
|
+
});
|
|
477
547
|
root.walkAtRules((rule) => {
|
|
478
548
|
if (rule.nodes !== void 0 && rule.nodes.length === 0) {
|
|
479
549
|
rule.remove();
|
|
@@ -485,6 +555,18 @@ function removeWebpackTailwindGeneratedAssetCss(source) {
|
|
|
485
555
|
return cleaned;
|
|
486
556
|
}
|
|
487
557
|
}
|
|
558
|
+
function isWebpackTailwindGeneratedPrefixNode(node) {
|
|
559
|
+
if (node.type === "rule") return node.selectors.every((selector) => isWebpackTailwindGeneratedUtilitySelector(selector.trim(), true));
|
|
560
|
+
if (node.type !== "atrule") return false;
|
|
561
|
+
const names = node.name === "layer" ? parseWebpackCssLayerNames(node.params) : [];
|
|
562
|
+
if (node.name === "property" && node.params.trim().startsWith("--tw-")) return true;
|
|
563
|
+
if (names.length > 0 && names.every((name) => WEBPACK_TAILWIND_GENERATED_LAYER_NAMES.has(name))) return true;
|
|
564
|
+
if (node.nodes === void 0 || node.nodes.length === 0) return false;
|
|
565
|
+
return node.nodes.every((child) => isWebpackTailwindGeneratedPrefixNode(child));
|
|
566
|
+
}
|
|
567
|
+
function isWebpackTailwindGeneratedUtilitySelector(selector, includePrefix) {
|
|
568
|
+
return WEBPACK_TAILWIND_UTILITY_RULE_MARKER_RE.test(selector) || includePrefix && WEBPACK_TAILWIND_UTILITY_PREFIX_RE.test(selector);
|
|
569
|
+
}
|
|
488
570
|
function collectWebpackCssRuleIdentityMarkers(source) {
|
|
489
571
|
const markers = /* @__PURE__ */ new Set();
|
|
490
572
|
try {
|
|
@@ -793,6 +875,7 @@ function createWebpackCssSourceResolvers(options) {
|
|
|
793
875
|
const activeWebpackCssSourceFiles = /* @__PURE__ */ new Set();
|
|
794
876
|
const resolveConfiguredMainCssSourceFile = (file) => {
|
|
795
877
|
if (!isMainCssChunk(file)) return;
|
|
878
|
+
if (configuredMainCssEntryFiles.length !== 1) return;
|
|
796
879
|
for (const sourceFile of configuredMainCssEntryFiles) if (cssSources.has(sourceFile)) {
|
|
797
880
|
activeWebpackCssSourceFiles.add(sourceFile);
|
|
798
881
|
return sourceFile;
|
|
@@ -1767,10 +1850,12 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1767
1850
|
}),
|
|
1768
1851
|
sourceCssProcessed
|
|
1769
1852
|
}), registeredUserRawSource);
|
|
1770
|
-
if (
|
|
1853
|
+
if ((0, _weapp_tailwindcss_postcss.isPureLocalCssImportWrapper)(currentRawSource)) return { result: new ConcatSource(require_v4_engine.removeTailwindSourceDirectives(require_source_candidate_scan_signature.stripBundlerGeneratedCssMarkers(currentRawSource), { importFallback: true })) };
|
|
1771
1854
|
const fallbackGeneratorRuntimeSet = getGeneratorRuntimeSet();
|
|
1772
1855
|
const hasExplicitTailwindV4SourceCss = sourceCss !== void 0 && (require_v4_engine.hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || sourceCss.includes("@config"));
|
|
1773
|
-
const
|
|
1856
|
+
const currentAssetHasTailwindDirectives = require_v4_engine.hasTailwindRootDirectives(generatorRawSource, { importFallback: true }) || require_v4_engine.hasTailwindSourceDirectives(generatorRawSource, { importFallback: true }) || require_v4_engine.hasTailwindApplyDirective(generatorRawSource);
|
|
1857
|
+
const shouldForceTailwindV4Generation = cssHandlerOptions.isMainChunk && hasConfiguredTailwindV4SourceRoots() && (configuredMainCssEntryFiles.length > 0 || currentAssetHasTailwindDirectives || hasExplicitTailwindV4SourceCss);
|
|
1858
|
+
const shouldSkipUnmatchedMainCssGeneration = !isWebGeneratorTarget && cssHandlerOptions.isMainChunk && sourceFile === void 0 && configuredMainCssEntryFiles.length > 0 && !currentAssetHasTailwindDirectives;
|
|
1774
1859
|
const resolvedScopedGeneratorRuntimeSet = await require_source_candidate_scan_signature.createScopedGeneratorRuntime({
|
|
1775
1860
|
cssHandlerOptions,
|
|
1776
1861
|
fallbackRuntime: hasExplicitTailwindV4SourceCss ? /* @__PURE__ */ new Set() : fallbackGeneratorRuntimeSet,
|
|
@@ -1782,8 +1867,9 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1782
1867
|
sourceFile: sourceFile ?? file,
|
|
1783
1868
|
scopedSourceCandidateGetter: webpackSourceCandidates?.getSourceCandidatesForEntries
|
|
1784
1869
|
});
|
|
1785
|
-
const scopedGeneratorRuntimeSet = !hasExplicitTailwindV4SourceCss && resolvedScopedGeneratorRuntimeSet !== fallbackGeneratorRuntimeSet ? new Set([...fallbackGeneratorRuntimeSet, ...resolvedScopedGeneratorRuntimeSet]) : resolvedScopedGeneratorRuntimeSet;
|
|
1870
|
+
const scopedGeneratorRuntimeSet = !hasExplicitTailwindV4SourceCss && resolvedScopedGeneratorRuntimeSet !== fallbackGeneratorRuntimeSet ? /* @__PURE__ */ new Set([...fallbackGeneratorRuntimeSet, ...resolvedScopedGeneratorRuntimeSet]) : resolvedScopedGeneratorRuntimeSet;
|
|
1786
1871
|
const generatorCssSources = normalizeWebpackGeneratorCssSources(cssHandlerOptions.sourceOptions?.cssSources);
|
|
1872
|
+
const scopedGeneratorCompilerOptions = scopeWebpackGeneratorOptionsToCssSource(compilerOptions, sourceFile, { disableUnmatchedCssEntries: !isWebGeneratorTarget && cssHandlerOptions.isMainChunk });
|
|
1787
1873
|
const generatorCssHandlerOptions = generatorCssSources === void 0 ? cssHandlerOptions : {
|
|
1788
1874
|
...cssHandlerOptions,
|
|
1789
1875
|
sourceOptions: {
|
|
@@ -1792,7 +1878,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1792
1878
|
}
|
|
1793
1879
|
};
|
|
1794
1880
|
const generatorOptions = {
|
|
1795
|
-
opts:
|
|
1881
|
+
opts: scopedGeneratorCompilerOptions,
|
|
1796
1882
|
runtimeState,
|
|
1797
1883
|
runtime: scopedGeneratorRuntimeSet,
|
|
1798
1884
|
rawSource: generatorRawSource,
|
|
@@ -1810,7 +1896,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1810
1896
|
debug
|
|
1811
1897
|
};
|
|
1812
1898
|
let generated;
|
|
1813
|
-
try {
|
|
1899
|
+
if (!shouldSkipUnmatchedMainCssGeneration) try {
|
|
1814
1900
|
generated = await require_source_candidate_scan_signature.generateTailwindV4Css({
|
|
1815
1901
|
...generatorOptions,
|
|
1816
1902
|
outputFile: file
|
|
@@ -1824,6 +1910,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1824
1910
|
debug("css generator skipped for plain webpack css asset: %s %O", file, error);
|
|
1825
1911
|
generated = void 0;
|
|
1826
1912
|
}
|
|
1913
|
+
else debug("css generator skipped for unmatched webpack main css asset: %s", file);
|
|
1827
1914
|
const source = new ConcatSource(finalizeTracedCss(generated ? finalizeCssAssetSource(isWebGeneratorTarget && currentRawSource.includes("tailwindcss v4.") ? createWebpackGeneratorUserCssSourceAppend({
|
|
1828
1915
|
css: generated.css,
|
|
1829
1916
|
processed: true
|
|
@@ -1856,7 +1943,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
1856
1943
|
});
|
|
1857
1944
|
const activeCssFiles = new Set(groupedEntries.css.map(([file]) => file));
|
|
1858
1945
|
pruneWebpackCssHandlerOptionCaches(cssHandlerOptionsCache, cssUserHandlerOptionsCache, activeCssFiles);
|
|
1859
|
-
if (activeCssFiles.size > 0) pruneWebpackCssSources?.(new Set([
|
|
1946
|
+
if (activeCssFiles.size > 0) pruneWebpackCssSources?.(/* @__PURE__ */ new Set([
|
|
1860
1947
|
...registeredWebpackCssSourceFiles,
|
|
1861
1948
|
...activeWebpackCssSourceFiles,
|
|
1862
1949
|
...[...cssAssetResources.values()].flatMap((resources) => [...resources])
|
|
@@ -2002,7 +2089,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
2002
2089
|
};
|
|
2003
2090
|
if (cssImportRewriteLoaderOptions && runtimeCssImportRewriteLoaderExists && runtimeCssImportRewriteLoader && isCssModule) {
|
|
2004
2091
|
const existingIndex = loaderEntries.findIndex((entry) => entry.loader?.includes?.(runtimeCssImportRewriteLoader));
|
|
2005
|
-
const rewriteLoaderEntry = existingIndex !== -1 ?
|
|
2092
|
+
const rewriteLoaderEntry = existingIndex !== -1 ? {
|
|
2093
|
+
...loaderEntries.splice(existingIndex, 1)[0],
|
|
2094
|
+
loader: runtimeCssImportRewriteLoader,
|
|
2095
|
+
options: cssImportRewriteLoaderOptions
|
|
2096
|
+
} : createCssImportRewriteLoaderEntry();
|
|
2006
2097
|
if (rewriteLoaderEntry) {
|
|
2007
2098
|
const anchorIndex = findRewriteAnchor(loaderEntries);
|
|
2008
2099
|
if (anchorIndex === -1) anchorlessInsert(rewriteLoaderEntry, "after");
|
|
@@ -2165,7 +2256,7 @@ var WeappTailwindcss = class {
|
|
|
2165
2256
|
};
|
|
2166
2257
|
const collectWatchChangedFiles = () => {
|
|
2167
2258
|
const compilerLike = compiler;
|
|
2168
|
-
return new Set([...compilerLike.modifiedFiles ?? [], ...compilerLike.removedFiles ?? []]);
|
|
2259
|
+
return /* @__PURE__ */ new Set([...compilerLike.modifiedFiles ?? [], ...compilerLike.removedFiles ?? []]);
|
|
2169
2260
|
};
|
|
2170
2261
|
const hasRuntimeDependencyChanges = (files) => {
|
|
2171
2262
|
for (const file of files) if (isWatchFileInRuntimeDependencies(file, {
|
|
@@ -2235,7 +2326,7 @@ var WeappTailwindcss = class {
|
|
|
2235
2326
|
const configuredSourceFiles = /* @__PURE__ */ new Set();
|
|
2236
2327
|
for (const entry of tailwindOptions?.v4?.cssEntries ?? []) configuredSourceFiles.add(node_path.default.resolve(entry));
|
|
2237
2328
|
for (const source of tailwindOptions?.v4?.cssSources ?? []) if (source.file) configuredSourceFiles.add(node_path.default.resolve(source.file));
|
|
2238
|
-
const activeSourceFiles = new Set([
|
|
2329
|
+
const activeSourceFiles = /* @__PURE__ */ new Set([
|
|
2239
2330
|
...configuredSourceFiles,
|
|
2240
2331
|
...currentWebpackCssSourceModules,
|
|
2241
2332
|
...activeAssetResources,
|
package/dist/webpack.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_webpack = require("./webpack-
|
|
2
|
+
const require_webpack = require("./webpack-khSwkXP5.js");
|
|
3
3
|
exports.WeappTailwindcss = require_webpack.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_webpack.WeappTailwindcss;
|
|
5
5
|
exports.weappTailwindcssPackageDir = require_webpack.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-Bg6pefpb.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss, weappTailwindcssPackageDir };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,6 +60,11 @@
|
|
|
60
60
|
"import": "./dist/webpack.mjs",
|
|
61
61
|
"require": "./dist/webpack.js"
|
|
62
62
|
},
|
|
63
|
+
"./rspack": {
|
|
64
|
+
"types": "./dist/rspack.d.ts",
|
|
65
|
+
"import": "./dist/rspack.mjs",
|
|
66
|
+
"require": "./dist/rspack.js"
|
|
67
|
+
},
|
|
63
68
|
"./core": {
|
|
64
69
|
"types": "./dist/core.d.ts",
|
|
65
70
|
"import": "./dist/core.mjs",
|
|
@@ -177,7 +182,7 @@
|
|
|
177
182
|
"@babel/traverse": "~7.29.7",
|
|
178
183
|
"@babel/types": "~7.29.7",
|
|
179
184
|
"@tailwindcss-mangle/engine": "0.1.1",
|
|
180
|
-
"@vue/compiler-dom": "^3.5.
|
|
185
|
+
"@vue/compiler-dom": "^3.5.39",
|
|
181
186
|
"@weapp-core/escape": "~8.0.0",
|
|
182
187
|
"comment-json": "^5.0.0",
|
|
183
188
|
"debug": "~4.4.3",
|
|
@@ -189,10 +194,10 @@
|
|
|
189
194
|
"semver": "~7.8.5",
|
|
190
195
|
"yaml": "^2.9.0",
|
|
191
196
|
"@weapp-tailwindcss/logger": "2.0.0",
|
|
192
|
-
"@weapp-tailwindcss/postcss": "3.1.
|
|
197
|
+
"@weapp-tailwindcss/postcss": "3.1.4",
|
|
193
198
|
"@weapp-tailwindcss/reset": "0.1.1",
|
|
194
199
|
"@weapp-tailwindcss/shared": "2.0.0",
|
|
195
|
-
"tailwindcss-config": "2.0.
|
|
200
|
+
"tailwindcss-config": "2.0.1"
|
|
196
201
|
},
|
|
197
202
|
"devDependencies": {
|
|
198
203
|
"htmlparser2": "12.0.0"
|
package/dist/auto-Ba6hDrse.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { hasCssMacroStyleOptions, hasCssMacroTailwindV4Directive, transformCssMacroCss, withCssMacroStyleOptions } from "@weapp-tailwindcss/postcss";
|
|
2
|
-
//#region src/css-macro/auto.ts
|
|
3
|
-
const CSS_MACRO_PLUGIN_MARKER = "__weappTailwindcssCssMacro";
|
|
4
|
-
function markCssMacroPlugin(value) {
|
|
5
|
-
Object.defineProperty(value, CSS_MACRO_PLUGIN_MARKER, {
|
|
6
|
-
configurable: false,
|
|
7
|
-
enumerable: false,
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
return value;
|
|
11
|
-
}
|
|
12
|
-
//#endregion
|
|
13
|
-
export { withCssMacroStyleOptions as a, transformCssMacroCss as i, hasCssMacroTailwindV4Directive as n, markCssMacroPlugin as r, hasCssMacroStyleOptions as t };
|
|
File without changes
|