weapp-tailwindcss 5.0.0-next.16 → 5.0.0-next.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{bundle-state-5CBF59C0.js → bundle-state-DDgxuERW.js} +1 -1
- package/dist/{bundle-state-CUuNIG4-.mjs → bundle-state-YW-zLcsc.mjs} +1 -1
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +1 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/{generator-BTf14-zB.js → generator-BIEhxFdv.js} +1 -1
- package/dist/{generator-BjB20Esq.mjs → generator-Ber8UVgv.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +5 -5
- package/dist/{incremental-runtime-class-set-DtYQ57bs.js → incremental-runtime-class-set-CfznDtJ0.js} +42 -11
- package/dist/{incremental-runtime-class-set-Dten3guT.mjs → incremental-runtime-class-set-DC0RsBbK.mjs} +42 -11
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/{postcss-CbrupBCk.js → postcss-DCOUtuwI.js} +2 -2
- package/dist/{postcss-CBUuHzjH.mjs → postcss-DW08tZXt.mjs} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-CL0BmEi5.mjs → precheck-CX-5VqM1.mjs} +2 -2
- package/dist/{precheck-CfyWVL3l.js → precheck-CZfnh4T6.js} +2 -2
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{source-candidates-bTqXER8H.js → source-candidates-BDyoPviV.js} +1 -1
- package/dist/{source-candidates-D9iHMeLE.mjs → source-candidates-DGlDzkvf.mjs} +1 -1
- package/dist/{tailwindcss-CSdlV4y2.js → tailwindcss-BVoa7vx-.js} +1 -1
- package/dist/{tailwindcss-CJ487R7-.mjs → tailwindcss-D74Wk4ys.mjs} +1 -1
- package/dist/{v3-engine-B1AJfKB1.js → v3-engine-BRInt2DS.js} +47 -2
- package/dist/{v3-engine-BBvwlLWp.mjs → v3-engine-CCxDqZ8e.mjs} +48 -3
- package/dist/{vite-Br-D3jQe.js → vite-DnHdmHHD.js} +7 -7
- package/dist/{vite-CPhJAYeg.mjs → vite-bmU2kkO6.mjs} +7 -7
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/{webpack-om3uHco-.mjs → webpack-BkBoEn4k.mjs} +5 -5
- package/dist/{webpack-DNcEK3jn.js → webpack-SxEdWHlL.js} +5 -5
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +5 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_precheck = require("./precheck-CZfnh4T6.js");
|
|
3
3
|
let node_module = require("node:module");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -2,3 +2,4 @@ import type postcss from 'postcss';
|
|
|
2
2
|
export declare function removeSpecificityPlaceholders(root: postcss.Root): void;
|
|
3
3
|
export declare function removeUnsupportedBrowserSelectors(root: postcss.Root): void;
|
|
4
4
|
export declare function removeDisplayP3Declarations(root: postcss.Root): void;
|
|
5
|
+
export declare function removeUnsupportedModernColorDeclarations(root: postcss.Root): void;
|
package/dist/core.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_precheck = require("./precheck-
|
|
3
|
+
const require_precheck = require("./precheck-CZfnh4T6.js");
|
|
4
4
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
5
5
|
//#region src/core.ts
|
|
6
6
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
package/dist/core.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-
|
|
1
|
+
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-CX-5VqM1.mjs";
|
|
2
2
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
3
3
|
//#region src/core.ts
|
|
4
4
|
const DEFAULT_MAIN_CHUNK_STYLE_OPTIONS = Object.freeze({ isMainChunk: true });
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-
|
|
1
|
+
import { C as createTailwindV4Engine, i as createTailwindV3Engine, n as resolveTailwindV3SourceFromPatcher, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
//#region src/generator/options.ts
|
|
3
3
|
function normalizeWeappTailwindcssGeneratorOptions(options) {
|
|
4
4
|
if (options == null) return {
|
package/dist/generator.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
4
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
4
|
+
const require_generator = require("./generator-BIEhxFdv.js");
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
6
6
|
exports.createWeappTailwindcssGenerator = require_generator.createWeappTailwindcssGenerator;
|
|
7
7
|
exports.createWeappTailwindcssGeneratorFromPatcher = require_generator.createWeappTailwindcssGeneratorFromPatcher;
|
package/dist/generator.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { S as resolveTailwindV4SourceOptionsFromPatcher, T as transformTailwindV4CssToWeapp, a as transformTailwindV3CssByTarget, b as resolveTailwindV4SourceFromPatchOptions, n as resolveTailwindV3SourceFromPatcher, o as transformTailwindV3CssToWeapp, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, w as transformTailwindV4CssByTarget, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, n as createWeappTailwindcssGeneratorFromPatcher, r as resolveTailwindSourceFromPatcher, t as createWeappTailwindcssGenerator } from "./generator-Ber8UVgv.mjs";
|
|
3
3
|
export { createWeappTailwindcssGenerator, createWeappTailwindcssGeneratorFromPatcher, normalizeWeappTailwindcssGeneratorOptions, resolveTailwindSourceFromPatcher, resolveTailwindV3Source, resolveTailwindV3SourceFromPatcher, resolveTailwindV3SourceOptionsFromPatcher, resolveTailwindV4Source, resolveTailwindV4SourceFromPatchOptions, resolveTailwindV4SourceFromPatcher, resolveTailwindV4SourceOptionsFromPatcher, transformTailwindV3CssByTarget, transformTailwindV3CssToWeapp, transformTailwindV4CssByTarget, transformTailwindV4CssToWeapp };
|
package/dist/gulp.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_source_candidates = require("./source-candidates-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CfznDtJ0.js");
|
|
5
|
+
const require_precheck = require("./precheck-CZfnh4T6.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
7
|
+
const require_source_candidates = require("./source-candidates-BDyoPviV.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
10
|
let node_path = require("node:path");
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { F as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-
|
|
2
|
-
import { i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, o as processCachedTask, r as emitHmrTiming, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-
|
|
3
|
-
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-
|
|
4
|
-
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
5
|
-
import { t as createSourceCandidateCollector } from "./source-candidates-
|
|
1
|
+
import { F as createDebug, _ as resolveViteSourceScanEntries, l as getRuntimeClassSetSignature } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, o as processCachedTask, r as emitHmrTiming, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-DC0RsBbK.mjs";
|
|
3
|
+
import { _ as ensureRuntimeClassSet, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, t as shouldSkipJsTransform } from "./precheck-CX-5VqM1.mjs";
|
|
4
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-D74Wk4ys.mjs";
|
|
5
|
+
import { t as createSourceCandidateCollector } from "./source-candidates-DGlDzkvf.mjs";
|
|
6
6
|
import fs from "node:fs";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
package/dist/{incremental-runtime-class-set-DtYQ57bs.js → incremental-runtime-class-set-CfznDtJ0.js}
RENAMED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_precheck = require("./precheck-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
|
+
const require_generator = require("./generator-BIEhxFdv.js");
|
|
4
|
+
const require_precheck = require("./precheck-CZfnh4T6.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let postcss = require("postcss");
|
|
8
8
|
postcss = require_chunk.__toESM(postcss);
|
|
@@ -11,6 +11,7 @@ node_path = require_chunk.__toESM(node_path);
|
|
|
11
11
|
let node_process = require("node:process");
|
|
12
12
|
node_process = require_chunk.__toESM(node_process);
|
|
13
13
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
14
|
+
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
14
15
|
//#region src/bundlers/shared/generator-css/markers.ts
|
|
15
16
|
const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
|
|
16
17
|
const TAILWIND_GENERATED_CSS_MARKER_RE = /\/\*!\s*tailwindcss v|@property\s+--tw-|--tw-|:not\(#\\#\)|\.[^,{]*(?:\\:|\\\[|\\#)|(?::host|page|\.tw-root|wx-root-portal-content)[^{]*\{[^}]*--(?:color|spacing|text|font-weight|radius)-/;
|
|
@@ -587,8 +588,19 @@ function removeDisplayP3Declarations(root) {
|
|
|
587
588
|
removeEmptyAtRuleAncestors(parent);
|
|
588
589
|
}
|
|
589
590
|
});
|
|
591
|
+
}
|
|
592
|
+
function removeUnsupportedModernColorDeclarations(root) {
|
|
593
|
+
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
590
594
|
root.walkDecls((decl) => {
|
|
591
|
-
if (
|
|
595
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
596
|
+
});
|
|
597
|
+
root.walkDecls((decl) => {
|
|
598
|
+
const normalized = (0, _weapp_tailwindcss_postcss.normalizeModernColorValue)(decl.value, customPropertyValues);
|
|
599
|
+
if (normalized.changed) {
|
|
600
|
+
decl.value = normalized.value;
|
|
601
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
602
|
+
}
|
|
603
|
+
if (normalized.hasUnsupported) removeDeclarationAndEmptyRule(decl);
|
|
592
604
|
});
|
|
593
605
|
}
|
|
594
606
|
//#endregion
|
|
@@ -603,6 +615,7 @@ const PREFLIGHT_RESET_PROPS = new Set([
|
|
|
603
615
|
"padding"
|
|
604
616
|
]);
|
|
605
617
|
const CONTENT_VAR_RE = /var\(\s*--tw-content\b/;
|
|
618
|
+
const HOIST_ANCHOR_COMMENT = "__weapp_tailwindcss_base_anchor__";
|
|
606
619
|
function isMiniProgramThemeScopeSelector$1(selectors) {
|
|
607
620
|
return selectors.length > 0 && selectors.every((selector) => MINI_PROGRAM_THEME_SCOPE_SELECTORS$1.has(selector));
|
|
608
621
|
}
|
|
@@ -720,11 +733,27 @@ function getTopDirectiveTail(root) {
|
|
|
720
733
|
}
|
|
721
734
|
return tail;
|
|
722
735
|
}
|
|
723
|
-
function
|
|
724
|
-
|
|
736
|
+
function createHoistInsertionAnchor(root) {
|
|
737
|
+
for (const node of root.nodes ?? []) if (isTailwindPreflightRule(node) || isMiniProgramThemeVariableRule(node)) {
|
|
738
|
+
const anchor = postcss.default.comment({ text: HOIST_ANCHOR_COMMENT });
|
|
739
|
+
node.before(anchor);
|
|
740
|
+
return anchor;
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
function insertHoistedRules(root, rules, anchor) {
|
|
744
|
+
if (anchor && !anchor.parent) anchor = void 0;
|
|
745
|
+
if (rules.length === 0) {
|
|
746
|
+
anchor?.remove();
|
|
747
|
+
return;
|
|
748
|
+
}
|
|
725
749
|
const topDirectiveTail = getTopDirectiveTail(root);
|
|
726
750
|
const firstRule = rules[0];
|
|
727
751
|
if (!firstRule) return;
|
|
752
|
+
if (anchor) {
|
|
753
|
+
firstRule.raws.before = anchor.raws.before;
|
|
754
|
+
anchor.replaceWith(rules);
|
|
755
|
+
return;
|
|
756
|
+
}
|
|
728
757
|
firstRule.raws.before = topDirectiveTail ? "\n" : "";
|
|
729
758
|
if (topDirectiveTail) topDirectiveTail.after(rules);
|
|
730
759
|
else root.prepend(rules);
|
|
@@ -738,13 +767,15 @@ function finalizeMiniProgramCssRoot(root, options = {}) {
|
|
|
738
767
|
removeSpecificityPlaceholders(root);
|
|
739
768
|
removeUnsupportedBrowserSelectors(root);
|
|
740
769
|
removeDisplayP3Declarations(root);
|
|
770
|
+
removeUnsupportedModernColorDeclarations(root);
|
|
771
|
+
const hoistAnchor = createHoistInsertionAnchor(root);
|
|
741
772
|
const preflightRules = collectPreflightRules(root, options);
|
|
742
773
|
if (preflightRules.length === 0) {
|
|
743
774
|
const resetRule = createPreflightResetRule(options.cssPreflight);
|
|
744
775
|
if (resetRule) preflightRules.push(resetRule);
|
|
745
776
|
}
|
|
746
777
|
const themeRule = collectThemeVariableRule(root, options);
|
|
747
|
-
insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules);
|
|
778
|
+
insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules, hoistAnchor);
|
|
748
779
|
}
|
|
749
780
|
function unwrapTailwindSourceMedia(root) {
|
|
750
781
|
root.walkAtRules("media", (atRule) => {
|
|
@@ -1676,10 +1707,10 @@ function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
|
|
|
1676
1707
|
//#region src/bundlers/shared/generator-css.ts
|
|
1677
1708
|
const SUPPORTED_GENERATOR_MAJOR_VERSIONS = new Set([3, 4]);
|
|
1678
1709
|
const REMOTE_IMPORT_RE = /^(?:https?:)?\/\//i;
|
|
1679
|
-
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight) {
|
|
1710
|
+
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight, options = {}) {
|
|
1680
1711
|
if (target !== "weapp") return css;
|
|
1681
1712
|
return finalizeMiniProgramCss(css, {
|
|
1682
|
-
cssPreflight: majorVersion === 4 ? cssPreflight : void 0,
|
|
1713
|
+
cssPreflight: majorVersion === 4 && options.injectPreflight !== false ? cssPreflight : void 0,
|
|
1683
1714
|
preservePseudoContentInit: majorVersion === 3
|
|
1684
1715
|
});
|
|
1685
1716
|
}
|
|
@@ -1882,7 +1913,7 @@ async function generateCssByGenerator(options) {
|
|
|
1882
1913
|
if (typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
1883
1914
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
1884
1915
|
return {
|
|
1885
|
-
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight)) : options.previousCss,
|
|
1916
|
+
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: false })) : options.previousCss,
|
|
1886
1917
|
target: generated.target,
|
|
1887
1918
|
source: "generator",
|
|
1888
1919
|
dependencies: generated.dependencies,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { B as omitUndefined, E as removeUnsupportedCascadeLayers, F as createDebug, O as loadTailwindV4DesignSystem, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { l as replaceWxml } from "./precheck-
|
|
4
|
-
import { i as resolveUniAppXOptions } from "./tailwindcss-
|
|
1
|
+
import { B as omitUndefined, E as removeUnsupportedCascadeLayers, F as createDebug, O as loadTailwindV4DesignSystem, S as resolveTailwindV4SourceOptionsFromPatcher, h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, n as resolveTailwindV3SourceFromPatcher, r as resolveTailwindV3SourceOptionsFromPatcher, t as resolveTailwindV3Source, x as resolveTailwindV4SourceFromPatcher, y as resolveTailwindV4Source$1 } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-Ber8UVgv.mjs";
|
|
3
|
+
import { l as replaceWxml } from "./precheck-CX-5VqM1.mjs";
|
|
4
|
+
import { i as resolveUniAppXOptions } from "./tailwindcss-D74Wk4ys.mjs";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import postcss from "postcss";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import process from "node:process";
|
|
9
9
|
import { extractRawCandidatesWithPositions, extractValidCandidates } from "tailwindcss-patch";
|
|
10
|
+
import { normalizeModernColorValue } from "@weapp-tailwindcss/postcss";
|
|
10
11
|
//#region src/bundlers/shared/generator-css/markers.ts
|
|
11
12
|
const TAILWIND_V4_BANNER_RE = /\/\*!\s*tailwindcss v4\./;
|
|
12
13
|
const TAILWIND_GENERATED_CSS_MARKER_RE = /\/\*!\s*tailwindcss v|@property\s+--tw-|--tw-|:not\(#\\#\)|\.[^,{]*(?:\\:|\\\[|\\#)|(?::host|page|\.tw-root|wx-root-portal-content)[^{]*\{[^}]*--(?:color|spacing|text|font-weight|radius)-/;
|
|
@@ -583,8 +584,19 @@ function removeDisplayP3Declarations(root) {
|
|
|
583
584
|
removeEmptyAtRuleAncestors(parent);
|
|
584
585
|
}
|
|
585
586
|
});
|
|
587
|
+
}
|
|
588
|
+
function removeUnsupportedModernColorDeclarations(root) {
|
|
589
|
+
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
586
590
|
root.walkDecls((decl) => {
|
|
587
|
-
if (
|
|
591
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
592
|
+
});
|
|
593
|
+
root.walkDecls((decl) => {
|
|
594
|
+
const normalized = normalizeModernColorValue(decl.value, customPropertyValues);
|
|
595
|
+
if (normalized.changed) {
|
|
596
|
+
decl.value = normalized.value;
|
|
597
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
598
|
+
}
|
|
599
|
+
if (normalized.hasUnsupported) removeDeclarationAndEmptyRule(decl);
|
|
588
600
|
});
|
|
589
601
|
}
|
|
590
602
|
//#endregion
|
|
@@ -599,6 +611,7 @@ const PREFLIGHT_RESET_PROPS = new Set([
|
|
|
599
611
|
"padding"
|
|
600
612
|
]);
|
|
601
613
|
const CONTENT_VAR_RE = /var\(\s*--tw-content\b/;
|
|
614
|
+
const HOIST_ANCHOR_COMMENT = "__weapp_tailwindcss_base_anchor__";
|
|
602
615
|
function isMiniProgramThemeScopeSelector$1(selectors) {
|
|
603
616
|
return selectors.length > 0 && selectors.every((selector) => MINI_PROGRAM_THEME_SCOPE_SELECTORS$1.has(selector));
|
|
604
617
|
}
|
|
@@ -716,11 +729,27 @@ function getTopDirectiveTail(root) {
|
|
|
716
729
|
}
|
|
717
730
|
return tail;
|
|
718
731
|
}
|
|
719
|
-
function
|
|
720
|
-
|
|
732
|
+
function createHoistInsertionAnchor(root) {
|
|
733
|
+
for (const node of root.nodes ?? []) if (isTailwindPreflightRule(node) || isMiniProgramThemeVariableRule(node)) {
|
|
734
|
+
const anchor = postcss.comment({ text: HOIST_ANCHOR_COMMENT });
|
|
735
|
+
node.before(anchor);
|
|
736
|
+
return anchor;
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
function insertHoistedRules(root, rules, anchor) {
|
|
740
|
+
if (anchor && !anchor.parent) anchor = void 0;
|
|
741
|
+
if (rules.length === 0) {
|
|
742
|
+
anchor?.remove();
|
|
743
|
+
return;
|
|
744
|
+
}
|
|
721
745
|
const topDirectiveTail = getTopDirectiveTail(root);
|
|
722
746
|
const firstRule = rules[0];
|
|
723
747
|
if (!firstRule) return;
|
|
748
|
+
if (anchor) {
|
|
749
|
+
firstRule.raws.before = anchor.raws.before;
|
|
750
|
+
anchor.replaceWith(rules);
|
|
751
|
+
return;
|
|
752
|
+
}
|
|
724
753
|
firstRule.raws.before = topDirectiveTail ? "\n" : "";
|
|
725
754
|
if (topDirectiveTail) topDirectiveTail.after(rules);
|
|
726
755
|
else root.prepend(rules);
|
|
@@ -734,13 +763,15 @@ function finalizeMiniProgramCssRoot(root, options = {}) {
|
|
|
734
763
|
removeSpecificityPlaceholders(root);
|
|
735
764
|
removeUnsupportedBrowserSelectors(root);
|
|
736
765
|
removeDisplayP3Declarations(root);
|
|
766
|
+
removeUnsupportedModernColorDeclarations(root);
|
|
767
|
+
const hoistAnchor = createHoistInsertionAnchor(root);
|
|
737
768
|
const preflightRules = collectPreflightRules(root, options);
|
|
738
769
|
if (preflightRules.length === 0) {
|
|
739
770
|
const resetRule = createPreflightResetRule(options.cssPreflight);
|
|
740
771
|
if (resetRule) preflightRules.push(resetRule);
|
|
741
772
|
}
|
|
742
773
|
const themeRule = collectThemeVariableRule(root, options);
|
|
743
|
-
insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules);
|
|
774
|
+
insertHoistedRules(root, themeRule ? [...preflightRules, themeRule] : preflightRules, hoistAnchor);
|
|
744
775
|
}
|
|
745
776
|
function unwrapTailwindSourceMedia(root) {
|
|
746
777
|
root.walkAtRules("media", (atRule) => {
|
|
@@ -1672,10 +1703,10 @@ function inheritLegacyUnitConvertedDeclarations(css, legacyCss) {
|
|
|
1672
1703
|
//#region src/bundlers/shared/generator-css.ts
|
|
1673
1704
|
const SUPPORTED_GENERATOR_MAJOR_VERSIONS = new Set([3, 4]);
|
|
1674
1705
|
const REMOTE_IMPORT_RE = /^(?:https?:)?\/\//i;
|
|
1675
|
-
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight) {
|
|
1706
|
+
function finalizeMiniProgramGeneratorCss(css, target, majorVersion, cssPreflight, options = {}) {
|
|
1676
1707
|
if (target !== "weapp") return css;
|
|
1677
1708
|
return finalizeMiniProgramCss(css, {
|
|
1678
|
-
cssPreflight: majorVersion === 4 ? cssPreflight : void 0,
|
|
1709
|
+
cssPreflight: majorVersion === 4 && options.injectPreflight !== false ? cssPreflight : void 0,
|
|
1679
1710
|
preservePseudoContentInit: majorVersion === 3
|
|
1680
1711
|
});
|
|
1681
1712
|
}
|
|
@@ -1878,7 +1909,7 @@ async function generateCssByGenerator(options) {
|
|
|
1878
1909
|
if (typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
1879
1910
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
1880
1911
|
return {
|
|
1881
|
-
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight)) : options.previousCss,
|
|
1912
|
+
css: incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, { injectPreflight: false })) : options.previousCss,
|
|
1882
1913
|
target: generated.target,
|
|
1883
1914
|
source: "generator",
|
|
1884
1915
|
dependencies: generated.dependencies,
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-BIEhxFdv.js");
|
|
3
3
|
const require_gulp = require("./gulp.js");
|
|
4
|
-
const require_postcss = require("./postcss-
|
|
5
|
-
const require_vite = require("./vite-
|
|
6
|
-
const require_webpack = require("./webpack-
|
|
4
|
+
const require_postcss = require("./postcss-DCOUtuwI.js");
|
|
5
|
+
const require_vite = require("./vite-DnHdmHHD.js");
|
|
6
|
+
const require_webpack = require("./webpack-SxEdWHlL.js");
|
|
7
7
|
exports.UnifiedWebpackPluginV5 = require_webpack.UnifiedWebpackPluginV5;
|
|
8
8
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
9
9
|
exports.createPlugins = require_gulp.createPlugins;
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-Ber8UVgv.mjs";
|
|
2
2
|
import { WeappTailwindcss as createPlugins } from "./gulp.mjs";
|
|
3
|
-
import { t as weappTailwindcssPostcssPlugin } from "./postcss-
|
|
4
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
5
|
-
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-
|
|
3
|
+
import { t as weappTailwindcssPostcssPlugin } from "./postcss-DW08tZXt.mjs";
|
|
4
|
+
import { t as WeappTailwindcss } from "./vite-bmU2kkO6.mjs";
|
|
5
|
+
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-BkBoEn4k.mjs";
|
|
6
6
|
export { UnifiedWebpackPluginV5, WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
|
+
const require_generator = require("./generator-BIEhxFdv.js");
|
|
4
4
|
let postcss = require("postcss");
|
|
5
5
|
postcss = require_chunk.__toESM(postcss);
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { A as createSourceScanPattern, L as readInstalledPackageMajorVersion, M as normalizeLegacyContentEntries, N as parseConfigParam, P as resolveCssSourceEntries, j as expandTailwindSourceEntries, k as collectCssInlineSourceCandidates, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { A as createSourceScanPattern, L as readInstalledPackageMajorVersion, M as normalizeLegacyContentEntries, N as parseConfigParam, P as resolveCssSourceEntries, j as expandTailwindSourceEntries, k as collectCssInlineSourceCandidates, t as resolveTailwindV3Source, y as resolveTailwindV4Source$1 } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-Ber8UVgv.mjs";
|
|
3
3
|
import postcss from "postcss";
|
|
4
4
|
import path from "node:path";
|
|
5
5
|
import process from "node:process";
|
package/dist/postcss.js
CHANGED
|
@@ -2,6 +2,6 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_postcss = require("./postcss-
|
|
5
|
+
const require_postcss = require("./postcss-DCOUtuwI.js");
|
|
6
6
|
exports.default = require_postcss.weappTailwindcssPostcssPlugin;
|
|
7
7
|
exports.weappTailwindcssPostcssPlugin = require_postcss.weappTailwindcssPostcssPlugin;
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as weappTailwindcssPostcssPlugin } from "./postcss-
|
|
1
|
+
import { t as weappTailwindcssPostcssPlugin } from "./postcss-DW08tZXt.mjs";
|
|
2
2
|
export { weappTailwindcssPostcssPlugin as default, weappTailwindcssPostcssPlugin };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { B as omitUndefined, C as createTailwindV4Engine, F as createDebug, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-
|
|
1
|
+
import { B as omitUndefined, C as createTailwindV4Engine, F as createDebug, c as getRuntimeClassSetCacheEntry, d as invalidateRuntimeClassSet, s as ensureTailwindcssRuntimePatch, u as getRuntimeClassSetSignatureWithSources, x as resolveTailwindV4SourceFromPatcher } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import { a as resolveDefaultCssPreflight, i as getDefaultOptions, o as DEFAULT_PARSE_CACHE_MAX_SOURCE_LENGTH, s as HARD_PARSE_CACHE_MAX_ENTRIES } from "./defaults-B1igPF_e.mjs";
|
|
3
3
|
import { i as isMap, n as defuOverrideArray } from "./utils-CGBVVNm6.mjs";
|
|
4
|
-
import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, r as isUniAppXEnabled, t as createTailwindcssPatcherFromContext } from "./tailwindcss-
|
|
4
|
+
import { a as applyV4CssCalcDefaults, i as resolveUniAppXOptions, o as warnMissingCssEntries, r as isUniAppXEnabled, t as createTailwindcssPatcherFromContext } from "./tailwindcss-D74Wk4ys.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { logger, pc } from "@weapp-tailwindcss/logger";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
3
|
const require_defaults = require("./defaults-IHhYxNeU.js");
|
|
4
4
|
require("./utils-4ODFyoqD.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
6
6
|
let node_path = require("node:path");
|
|
7
7
|
node_path = require_chunk.__toESM(node_path);
|
|
8
8
|
let node_process = require("node:process");
|
package/dist/presets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
3
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
4
4
|
const require_utils = require("./utils-4ODFyoqD.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
6
6
|
require("./logger-EVNB9z7i.js");
|
|
7
7
|
let node_process = require("node:process");
|
|
8
8
|
node_process = require_chunk.__toESM(node_process);
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as omitUndefined } from "./v3-engine-
|
|
1
|
+
import { B as omitUndefined } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-CGBVVNm6.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-D74Wk4ys.mjs";
|
|
4
4
|
import { t as logger } from "./logger-CZUxvJJD.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { getPackageInfoSync } from "local-pkg";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_chunk.__toESM(node_path);
|
|
5
5
|
let tailwindcss_patch = require("tailwindcss-patch");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { j as expandTailwindSourceEntries } from "./v3-engine-
|
|
1
|
+
import { j as expandTailwindSourceEntries } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { extractSourceCandidates } from "tailwindcss-patch";
|
|
4
4
|
import { readFile } from "node:fs/promises";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
3
|
require("./utils-4ODFyoqD.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_module = require("node:module");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { B as omitUndefined, H as findWorkspacePackageDir, I as createTailwindcssPatcher, L as readInstalledPackageMajorVersion, U as findWorkspaceRoot, V as findNearestPackageRoot, f as runtimeSignaturePatchersSymbol } from "./v3-engine-
|
|
1
|
+
import { B as omitUndefined, H as findWorkspacePackageDir, I as createTailwindcssPatcher, L as readInstalledPackageMajorVersion, U as findWorkspaceRoot, V as findNearestPackageRoot, f as runtimeSignaturePatchersSymbol } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
2
|
import { n as defuOverrideArray } from "./utils-CGBVVNm6.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -787,6 +787,25 @@ function isKeyframesRule(rule) {
|
|
|
787
787
|
}
|
|
788
788
|
return false;
|
|
789
789
|
}
|
|
790
|
+
function removeDeclarationAndEmptyRule(decl) {
|
|
791
|
+
const parent = decl.parent;
|
|
792
|
+
decl.remove();
|
|
793
|
+
if (parent?.type === "rule" && parent.nodes.length === 0) parent.remove();
|
|
794
|
+
}
|
|
795
|
+
function normalizeMiniProgramColorValues(root) {
|
|
796
|
+
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
797
|
+
root.walkDecls((decl) => {
|
|
798
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
799
|
+
});
|
|
800
|
+
root.walkDecls((decl) => {
|
|
801
|
+
const normalized = (0, _weapp_tailwindcss_postcss.normalizeModernColorValue)(decl.value, customPropertyValues);
|
|
802
|
+
if (normalized.changed) {
|
|
803
|
+
decl.value = normalized.value;
|
|
804
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
805
|
+
}
|
|
806
|
+
if (normalized.hasUnsupported) removeDeclarationAndEmptyRule(decl);
|
|
807
|
+
});
|
|
808
|
+
}
|
|
790
809
|
/**
|
|
791
810
|
* 裁剪 Tailwind 生成 CSS 中面向浏览器的 classless 规则。
|
|
792
811
|
*
|
|
@@ -800,6 +819,7 @@ function pruneMiniProgramGeneratedCss(css, options = {}) {
|
|
|
800
819
|
comment.remove();
|
|
801
820
|
});
|
|
802
821
|
removeUnsupportedCascadeLayers(root);
|
|
822
|
+
normalizeMiniProgramColorValues(root);
|
|
803
823
|
root.walkAtRules("supports", (atRule) => {
|
|
804
824
|
atRule.remove();
|
|
805
825
|
});
|
|
@@ -854,7 +874,7 @@ function normalizeTailwindV4GeneratedUrlValues(css) {
|
|
|
854
874
|
});
|
|
855
875
|
}
|
|
856
876
|
async function transformTailwindV4CssToWeapp(css, options) {
|
|
857
|
-
const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(css));
|
|
877
|
+
const protectedCss = (0, _weapp_tailwindcss_postcss.protectDynamicColorMixAlpha)(normalizeTailwindV4GeneratedUrlValues(css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
|
|
858
878
|
const result = await defaultStyleHandler$1(protectedCss.css, {
|
|
859
879
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
860
880
|
cssRemoveHoverPseudoClass: true,
|
|
@@ -1697,13 +1717,34 @@ function collectSeenCandidates(generated, requestedCandidates) {
|
|
|
1697
1717
|
...generated.classSet
|
|
1698
1718
|
]);
|
|
1699
1719
|
}
|
|
1720
|
+
function createIncrementalStyleOptions(styleOptions) {
|
|
1721
|
+
return {
|
|
1722
|
+
...styleOptions,
|
|
1723
|
+
isMainChunk: false
|
|
1724
|
+
};
|
|
1725
|
+
}
|
|
1726
|
+
function collectCustomPropertyValues(css) {
|
|
1727
|
+
const values = /* @__PURE__ */ new Map();
|
|
1728
|
+
try {
|
|
1729
|
+
postcss.default.parse(css).walkDecls((decl) => {
|
|
1730
|
+
if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
|
|
1731
|
+
});
|
|
1732
|
+
} catch {}
|
|
1733
|
+
return values;
|
|
1734
|
+
}
|
|
1735
|
+
function mergeCustomPropertyValues(target, css) {
|
|
1736
|
+
for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
|
|
1737
|
+
}
|
|
1700
1738
|
function seedIncrementalGenerateCache(options) {
|
|
1701
1739
|
const cacheKey = createIncrementalGenerateCacheKey$1(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
|
|
1740
|
+
const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
|
|
1741
|
+
mergeCustomPropertyValues(customPropertyValues, options.generated.css);
|
|
1702
1742
|
incrementalGenerateCache$1.set(cacheKey, {
|
|
1703
1743
|
seenCandidates: collectSeenCandidates(options.generated, options.requestedCandidates),
|
|
1704
1744
|
classSet: new Set(options.generated.classSet),
|
|
1705
1745
|
css: options.generated.css,
|
|
1706
1746
|
rawCss: options.generated.rawCss,
|
|
1747
|
+
customPropertyValues,
|
|
1707
1748
|
designSystemPromise: createIncrementalDesignSystemPromise(options.compatibleSource, cacheKey),
|
|
1708
1749
|
dependencies: options.generated.dependencies,
|
|
1709
1750
|
sources: options.generated.sources,
|
|
@@ -1903,11 +1944,15 @@ function createTailwindV4Engine(source) {
|
|
|
1903
1944
|
}
|
|
1904
1945
|
}
|
|
1905
1946
|
const rawCss = rawCssParts.join("\n");
|
|
1906
|
-
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target,
|
|
1947
|
+
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
|
|
1948
|
+
...createIncrementalStyleOptions(options.styleOptions),
|
|
1949
|
+
customPropertyValues: cached.customPropertyValues
|
|
1950
|
+
}) : "";
|
|
1907
1951
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
1908
1952
|
for (const className of classSet) cached.classSet.add(className);
|
|
1909
1953
|
cached.css = [cached.css, incrementalCss].filter(Boolean).join("\n");
|
|
1910
1954
|
cached.rawCss = [cached.rawCss, rawCss].filter(Boolean).join("\n");
|
|
1955
|
+
mergeCustomPropertyValues(cached.customPropertyValues, incrementalCss);
|
|
1911
1956
|
return {
|
|
1912
1957
|
css: cached.css,
|
|
1913
1958
|
rawCss: cached.rawCss,
|
|
@@ -12,7 +12,7 @@ import { stat } from "node:fs/promises";
|
|
|
12
12
|
import fg from "fast-glob";
|
|
13
13
|
import micromatch from "micromatch";
|
|
14
14
|
import { loadConfig } from "tailwindcss-config";
|
|
15
|
-
import { createStyleHandler, protectDynamicColorMixAlpha } from "@weapp-tailwindcss/postcss";
|
|
15
|
+
import { createStyleHandler, normalizeModernColorValue, protectDynamicColorMixAlpha } from "@weapp-tailwindcss/postcss";
|
|
16
16
|
//#region src/context/workspace.ts
|
|
17
17
|
const IGNORED_WORKSPACE_DIRS = new Set([
|
|
18
18
|
"node_modules",
|
|
@@ -779,6 +779,25 @@ function isKeyframesRule(rule) {
|
|
|
779
779
|
}
|
|
780
780
|
return false;
|
|
781
781
|
}
|
|
782
|
+
function removeDeclarationAndEmptyRule(decl) {
|
|
783
|
+
const parent = decl.parent;
|
|
784
|
+
decl.remove();
|
|
785
|
+
if (parent?.type === "rule" && parent.nodes.length === 0) parent.remove();
|
|
786
|
+
}
|
|
787
|
+
function normalizeMiniProgramColorValues(root) {
|
|
788
|
+
const customPropertyValues = /* @__PURE__ */ new Map();
|
|
789
|
+
root.walkDecls((decl) => {
|
|
790
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
791
|
+
});
|
|
792
|
+
root.walkDecls((decl) => {
|
|
793
|
+
const normalized = normalizeModernColorValue(decl.value, customPropertyValues);
|
|
794
|
+
if (normalized.changed) {
|
|
795
|
+
decl.value = normalized.value;
|
|
796
|
+
if (decl.prop.startsWith("--")) customPropertyValues.set(decl.prop, decl.value.trim());
|
|
797
|
+
}
|
|
798
|
+
if (normalized.hasUnsupported) removeDeclarationAndEmptyRule(decl);
|
|
799
|
+
});
|
|
800
|
+
}
|
|
782
801
|
/**
|
|
783
802
|
* 裁剪 Tailwind 生成 CSS 中面向浏览器的 classless 规则。
|
|
784
803
|
*
|
|
@@ -792,6 +811,7 @@ function pruneMiniProgramGeneratedCss(css, options = {}) {
|
|
|
792
811
|
comment.remove();
|
|
793
812
|
});
|
|
794
813
|
removeUnsupportedCascadeLayers(root);
|
|
814
|
+
normalizeMiniProgramColorValues(root);
|
|
795
815
|
root.walkAtRules("supports", (atRule) => {
|
|
796
816
|
atRule.remove();
|
|
797
817
|
});
|
|
@@ -846,7 +866,7 @@ function normalizeTailwindV4GeneratedUrlValues(css) {
|
|
|
846
866
|
});
|
|
847
867
|
}
|
|
848
868
|
async function transformTailwindV4CssToWeapp(css, options) {
|
|
849
|
-
const protectedCss = protectDynamicColorMixAlpha(normalizeTailwindV4GeneratedUrlValues(css));
|
|
869
|
+
const protectedCss = protectDynamicColorMixAlpha(normalizeTailwindV4GeneratedUrlValues(css), { customPropertyValues: options && "customPropertyValues" in options ? options.customPropertyValues : void 0 });
|
|
850
870
|
const result = await defaultStyleHandler$1(protectedCss.css, {
|
|
851
871
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
852
872
|
cssRemoveHoverPseudoClass: true,
|
|
@@ -1689,13 +1709,34 @@ function collectSeenCandidates(generated, requestedCandidates) {
|
|
|
1689
1709
|
...generated.classSet
|
|
1690
1710
|
]);
|
|
1691
1711
|
}
|
|
1712
|
+
function createIncrementalStyleOptions(styleOptions) {
|
|
1713
|
+
return {
|
|
1714
|
+
...styleOptions,
|
|
1715
|
+
isMainChunk: false
|
|
1716
|
+
};
|
|
1717
|
+
}
|
|
1718
|
+
function collectCustomPropertyValues(css) {
|
|
1719
|
+
const values = /* @__PURE__ */ new Map();
|
|
1720
|
+
try {
|
|
1721
|
+
postcss.parse(css).walkDecls((decl) => {
|
|
1722
|
+
if (decl.prop.startsWith("--")) values.set(decl.prop, decl.value.trim());
|
|
1723
|
+
});
|
|
1724
|
+
} catch {}
|
|
1725
|
+
return values;
|
|
1726
|
+
}
|
|
1727
|
+
function mergeCustomPropertyValues(target, css) {
|
|
1728
|
+
for (const [prop, value] of collectCustomPropertyValues(css)) target.set(prop, value);
|
|
1729
|
+
}
|
|
1692
1730
|
function seedIncrementalGenerateCache(options) {
|
|
1693
1731
|
const cacheKey = createIncrementalGenerateCacheKey$1(options.compatibleSource, options.target, options.styleOptions, options.tailwindcssV3Compatibility);
|
|
1732
|
+
const customPropertyValues = collectCustomPropertyValues(options.compatibleSource.css);
|
|
1733
|
+
mergeCustomPropertyValues(customPropertyValues, options.generated.css);
|
|
1694
1734
|
incrementalGenerateCache$1.set(cacheKey, {
|
|
1695
1735
|
seenCandidates: collectSeenCandidates(options.generated, options.requestedCandidates),
|
|
1696
1736
|
classSet: new Set(options.generated.classSet),
|
|
1697
1737
|
css: options.generated.css,
|
|
1698
1738
|
rawCss: options.generated.rawCss,
|
|
1739
|
+
customPropertyValues,
|
|
1699
1740
|
designSystemPromise: createIncrementalDesignSystemPromise(options.compatibleSource, cacheKey),
|
|
1700
1741
|
dependencies: options.generated.dependencies,
|
|
1701
1742
|
sources: options.generated.sources,
|
|
@@ -1895,11 +1936,15 @@ function createTailwindV4Engine$1(source) {
|
|
|
1895
1936
|
}
|
|
1896
1937
|
}
|
|
1897
1938
|
const rawCss = rawCssParts.join("\n");
|
|
1898
|
-
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target,
|
|
1939
|
+
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
|
|
1940
|
+
...createIncrementalStyleOptions(options.styleOptions),
|
|
1941
|
+
customPropertyValues: cached.customPropertyValues
|
|
1942
|
+
}) : "";
|
|
1899
1943
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
1900
1944
|
for (const className of classSet) cached.classSet.add(className);
|
|
1901
1945
|
cached.css = [cached.css, incrementalCss].filter(Boolean).join("\n");
|
|
1902
1946
|
cached.rawCss = [cached.rawCss, rawCss].filter(Boolean).join("\n");
|
|
1947
|
+
mergeCustomPropertyValues(cached.customPropertyValues, incrementalCss);
|
|
1903
1948
|
return {
|
|
1904
1949
|
css: cached.css,
|
|
1905
1950
|
rawCss: cached.rawCss,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
5
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
|
+
const require_generator = require("./generator-BIEhxFdv.js");
|
|
4
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CfznDtJ0.js");
|
|
5
|
+
const require_precheck = require("./precheck-CZfnh4T6.js");
|
|
6
6
|
const require_utils = require("./utils-4ODFyoqD.js");
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
8
|
-
const require_source_candidates = require("./source-candidates-
|
|
9
|
-
const require_bundle_state = require("./bundle-state-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
8
|
+
const require_source_candidates = require("./source-candidates-BDyoPviV.js");
|
|
9
|
+
const require_bundle_state = require("./bundle-state-DDgxuERW.js");
|
|
10
10
|
require("./logger-EVNB9z7i.js");
|
|
11
11
|
let node_fs = require("node:fs");
|
|
12
12
|
node_fs = require_chunk.__toESM(node_fs);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { B as omitUndefined, D as filterUnsupportedMiniProgramTailwindV4Candidates, F as createDebug, R as findTailwindConfig, V as findNearestPackageRoot, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, v as resolveViteTailwindV4CssDependencies, z as resolveTailwindcssOptions } from "./v3-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-
|
|
3
|
-
import { a as validateCandidatesByGenerator, c as hasTailwindSourceDirectives, i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, n as createHmrTimingRecorder, o as processCachedTask, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager, u as hasTailwindGeneratedCssMarkers } from "./incremental-runtime-class-set-
|
|
4
|
-
import { a as analyzeSource, c as isClassContextLiteralPath, g as createTailwindRuntimeReadyPromise, h as collectRuntimeClassSet, i as createAttributeMatcher, l as replaceWxml, m as toCustomAttributesEntities, n as getCompilerContext, o as JsTokenUpdater, p as vitePluginName, r as generateCode, s as _defineProperty, t as shouldSkipJsTransform, u as babelParse, v as refreshTailwindRuntimeState } from "./precheck-
|
|
1
|
+
import { B as omitUndefined, D as filterUnsupportedMiniProgramTailwindV4Candidates, F as createDebug, R as findTailwindConfig, V as findNearestPackageRoot, _ as resolveViteSourceScanEntries, g as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, m as discoverTailwindV4CssEntries, p as createViteSourceScanMatcher, v as resolveViteTailwindV4CssDependencies, z as resolveTailwindcssOptions } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions } from "./generator-Ber8UVgv.mjs";
|
|
3
|
+
import { a as validateCandidatesByGenerator, c as hasTailwindSourceDirectives, i as generateCssByGenerator, l as normalizeTailwindSourceForGenerator, n as createHmrTimingRecorder, o as processCachedTask, s as hasTailwindRootDirectives, t as createBundleRuntimeClassSetManager, u as hasTailwindGeneratedCssMarkers } from "./incremental-runtime-class-set-DC0RsBbK.mjs";
|
|
4
|
+
import { a as analyzeSource, c as isClassContextLiteralPath, g as createTailwindRuntimeReadyPromise, h as collectRuntimeClassSet, i as createAttributeMatcher, l as replaceWxml, m as toCustomAttributesEntities, n as getCompilerContext, o as JsTokenUpdater, p as vitePluginName, r as generateCode, s as _defineProperty, t as shouldSkipJsTransform, u as babelParse, v as refreshTailwindRuntimeState } from "./precheck-CX-5VqM1.mjs";
|
|
5
5
|
import { o as resolveUniUtsPlatform } from "./utils-CGBVVNm6.mjs";
|
|
6
|
-
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
7
|
-
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-
|
|
8
|
-
import { a as createBundleModuleGraphOptions, c as resolvePluginDisabledState, d as normalizeOutputPathKey, i as applyLinkedResults, l as isSourceStyleRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as toAbsoluteOutputPath, r as updateBundleBuildState, s as resolvePackageDir, t as buildBundleSnapshot } from "./bundle-state-
|
|
6
|
+
import { c as upsertTailwindV4CssSource, i as resolveUniAppXOptions, r as isUniAppXEnabled, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-D74Wk4ys.mjs";
|
|
7
|
+
import { n as isSourceCandidateRequest, t as createSourceCandidateCollector } from "./source-candidates-DGlDzkvf.mjs";
|
|
8
|
+
import { a as createBundleModuleGraphOptions, c as resolvePluginDisabledState, d as normalizeOutputPathKey, i as applyLinkedResults, l as isSourceStyleRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as toAbsoluteOutputPath, r as updateBundleBuildState, s as resolvePackageDir, t as buildBundleSnapshot } from "./bundle-state-YW-zLcsc.mjs";
|
|
9
9
|
import { t as logger$1 } from "./logger-CZUxvJJD.mjs";
|
|
10
10
|
import fs, { existsSync, readFileSync } from "node:fs";
|
|
11
11
|
import path from "node:path";
|
package/dist/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-DnHdmHHD.js");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-bmU2kkO6.mjs";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { F as createDebug, l as getRuntimeClassSetSignature, z as resolveTailwindcssOptions } from "./v3-engine-
|
|
2
|
-
import { i as generateCssByGenerator, o as processCachedTask, r as emitHmrTiming, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-
|
|
3
|
-
import { _ as ensureRuntimeClassSet, f as pluginName, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, s as _defineProperty, t as shouldSkipJsTransform, v as refreshTailwindRuntimeState } from "./precheck-
|
|
1
|
+
import { F as createDebug, l as getRuntimeClassSetSignature, z as resolveTailwindcssOptions } from "./v3-engine-CCxDqZ8e.mjs";
|
|
2
|
+
import { i as generateCssByGenerator, o as processCachedTask, r as emitHmrTiming, t as createBundleRuntimeClassSetManager } from "./incremental-runtime-class-set-DC0RsBbK.mjs";
|
|
3
|
+
import { _ as ensureRuntimeClassSet, f as pluginName, g as createTailwindRuntimeReadyPromise, n as getCompilerContext, s as _defineProperty, t as shouldSkipJsTransform, v as refreshTailwindRuntimeState } from "./precheck-CX-5VqM1.mjs";
|
|
4
4
|
import { r as getGroupedEntries } from "./utils-CGBVVNm6.mjs";
|
|
5
|
-
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-
|
|
6
|
-
import { c as resolvePluginDisabledState, f as resolveOutputSpecifier, l as isSourceStyleRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as toAbsoluteOutputPath, r as updateBundleBuildState, s as resolvePackageDir, t as buildBundleSnapshot, u as stripRequestQuery } from "./bundle-state-
|
|
5
|
+
import { c as upsertTailwindV4CssSource, s as hasConfiguredTailwindV4CssRoots } from "./tailwindcss-D74Wk4ys.mjs";
|
|
6
|
+
import { c as resolvePluginDisabledState, f as resolveOutputSpecifier, l as isSourceStyleRequest, n as createBundleBuildState, o as pushConcurrentTaskFactories, p as toAbsoluteOutputPath, r as updateBundleBuildState, s as resolvePackageDir, t as buildBundleSnapshot, u as stripRequestQuery } from "./bundle-state-YW-zLcsc.mjs";
|
|
7
7
|
import Module, { createRequire } from "node:module";
|
|
8
8
|
import fs from "node:fs";
|
|
9
9
|
import path from "node:path";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-
|
|
4
|
-
const require_precheck = require("./precheck-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-BRInt2DS.js");
|
|
3
|
+
const require_incremental_runtime_class_set = require("./incremental-runtime-class-set-CfznDtJ0.js");
|
|
4
|
+
const require_precheck = require("./precheck-CZfnh4T6.js");
|
|
5
5
|
const require_utils = require("./utils-4ODFyoqD.js");
|
|
6
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
-
const require_bundle_state = require("./bundle-state-
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-BVoa7vx-.js");
|
|
7
|
+
const require_bundle_state = require("./bundle-state-DDgxuERW.js");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
node_fs = require_chunk.__toESM(node_fs);
|
|
10
10
|
let node_module = require("node:module");
|
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-SxEdWHlL.js");
|
|
3
3
|
exports.UnifiedWebpackPluginV5 = require_webpack.UnifiedWebpackPluginV5;
|
|
4
4
|
exports.WeappTailwindcss = require_webpack.UnifiedWebpackPluginV5;
|
|
5
5
|
exports.weappTailwindcss = require_webpack.UnifiedWebpackPluginV5;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, t as UnifiedWebpackPluginV5 } from "./webpack-BkBoEn4k.mjs";
|
|
2
2
|
export { UnifiedWebpackPluginV5, UnifiedWebpackPluginV5 as WeappTailwindcss, UnifiedWebpackPluginV5 as weappTailwindcss, weappTailwindcssPackageDir };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "5.0.0-next.
|
|
3
|
+
"version": "5.0.0-next.17",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -189,11 +189,11 @@
|
|
|
189
189
|
"semver": "~7.8.0",
|
|
190
190
|
"tailwindcss-patch": "9.3.5",
|
|
191
191
|
"yaml": "^2.9.0",
|
|
192
|
-
"@weapp-tailwindcss/
|
|
193
|
-
"@weapp-tailwindcss/postcss": "2.2.1-next.2",
|
|
194
|
-
"tailwindcss-config": "1.1.6-next.1",
|
|
192
|
+
"@weapp-tailwindcss/postcss": "2.2.1-next.3",
|
|
195
193
|
"@weapp-tailwindcss/reset": "0.1.1-next.0",
|
|
196
|
-
"@weapp-tailwindcss/shared": "1.1.3"
|
|
194
|
+
"@weapp-tailwindcss/shared": "1.1.3",
|
|
195
|
+
"@weapp-tailwindcss/logger": "1.1.0",
|
|
196
|
+
"tailwindcss-config": "1.1.6-next.1"
|
|
197
197
|
},
|
|
198
198
|
"scripts": {
|
|
199
199
|
"dev": "tsdown --watch --sourcemap",
|