weapp-tailwindcss 5.0.0-next.23 → 5.0.0-next.25
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/auto-AduSz49t.mjs +80 -0
- package/dist/auto-B11j1XiD.js +117 -0
- package/dist/{bundle-state-BxWD-X7F.js → bundle-state-BY7PWHAc.js} +1 -1
- package/dist/{bundle-state-CCjtHdeS.mjs → bundle-state-CBouNDzi.mjs} +1 -1
- package/dist/cli.js +167 -5
- package/dist/cli.mjs +166 -4
- package/dist/context/runtime-package-replacements.d.ts +2 -0
- package/dist/context/style-options.d.ts +3 -0
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +10 -0
- package/dist/css-macro/constants.d.ts +5 -2
- package/dist/css-macro/postcss.d.ts +1 -0
- package/dist/css-macro/postcss.js +7 -47
- package/dist/css-macro/postcss.mjs +2 -47
- package/dist/css-macro.js +15 -6
- package/dist/css-macro.mjs +15 -6
- package/dist/{defaults-C6sIKXgC.mjs → defaults-B-1EEhdL.mjs} +2 -1
- package/dist/{defaults-D3cFX6Cq.js → defaults-C10hYUch.js} +2 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/{generator-BP_VdS_x.mjs → generator-CtqzN9L-.mjs} +1 -1
- package/dist/{generator-D6gEmxIp.js → generator-DTPePQZ9.js} +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-DEf-VOwB.mjs → incremental-runtime-class-set-BlJ86j-A.mjs} +4 -16
- package/dist/{incremental-runtime-class-set-CdcqejGM.js → incremental-runtime-class-set-CERcE0fP.js} +4 -16
- package/dist/index.d.ts +1 -0
- package/dist/index.js +18 -4
- package/dist/index.mjs +6 -5
- package/dist/{postcss-D8kdiqHg.js → postcss-BAO9tGi5.js} +2 -2
- package/dist/{postcss-KBUSjpTr.mjs → postcss-CYPHxj7a.mjs} +2 -2
- package/dist/postcss-DXkxsPNg.js +192 -0
- package/dist/postcss-DYktK8_T.mjs +169 -0
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/{precheck-DT3ydSET.mjs → precheck-B4CpMt_w.mjs} +69 -32
- package/dist/{precheck-DrBpp5HA.js → precheck-ezN3ovAq.js} +75 -32
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +5 -4
- package/dist/presets.mjs +5 -4
- package/dist/{source-candidates-CHJBRaDA.js → source-candidates-0jPRIPmC.js} +1 -1
- package/dist/{source-candidates-CvmmNj4x.mjs → source-candidates-DoyOltpZ.mjs} +1 -1
- package/dist/{tailwindcss-CxAd28dW.js → tailwindcss-nQetCaPp.js} +17 -26
- package/dist/{tailwindcss-eov9DmH3.mjs → tailwindcss-ujlr9Iad.mjs} +17 -26
- package/dist/types/index.d.ts +1 -1
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/user-defined-options/general.d.ts +2 -1
- package/dist/types/user-defined-options/important.d.ts +3 -1
- package/dist/unocss/index.d.ts +2 -0
- package/dist/utils/options.d.ts +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/{v3-engine-CxCp7Ydh.js → v3-engine-Bbsrez2w.js} +72 -21
- package/dist/{v3-engine-CzD7OvXg.mjs → v3-engine-COw08vWd.mjs} +61 -22
- package/dist/{vite-xq8oINaq.js → vite-DE8Vfzal.js} +40 -10
- package/dist/{vite-DyQrAtpx.mjs → vite-hZsQAY1a.mjs} +40 -10
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +334 -74
- package/dist/weapp-tw-runtime-classset-loader.js +1 -4
- package/dist/{webpack-bTvAcuj4.js → webpack-CTJcw_sX.js} +6 -6
- package/dist/{webpack-CZIJ7caJ.mjs → webpack-c2WJnCJI.mjs} +6 -6
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +9 -11
- package/dist/constants-BG12WAKw.mjs +0 -44
- package/dist/constants-BeeyfJ9k.js +0 -73
- /package/dist/{logger-EVNB9z7i.js → logger-Cdzl3p8j.js} +0 -0
- /package/dist/{logger-CZUxvJJD.mjs → logger-Dr7IvyH2.mjs} +0 -0
- /package/dist/{utils-CGBVVNm6.mjs → utils-B2SJgA1L.mjs} +0 -0
- /package/dist/{utils-4ODFyoqD.js → utils-CSA174-I.js} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { G as
|
|
2
|
-
import { n as defuOverrideArray } from "./utils-
|
|
1
|
+
import { G as normalizeStringListOption, H as readInstalledPackageMajorVersion, J as findNearestPackageRoot, V as createTailwindcssPatcher, X as findWorkspaceRoot, Y as findWorkspacePackageDir, f as runtimeSignaturePatchersSymbol, q as omitUndefined } from "./v3-engine-COw08vWd.mjs";
|
|
2
|
+
import { n as defuOverrideArray } from "./utils-B2SJgA1L.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -107,14 +107,7 @@ function ensureDefaultsIncluded(value) {
|
|
|
107
107
|
return value;
|
|
108
108
|
}
|
|
109
109
|
function normalizeCssEntriesConfig(entries) {
|
|
110
|
-
|
|
111
|
-
if (typeof entries === "string") {
|
|
112
|
-
const trimmed = entries.trim();
|
|
113
|
-
return trimmed ? [trimmed] : void 0;
|
|
114
|
-
}
|
|
115
|
-
if (!Array.isArray(entries)) return;
|
|
116
|
-
const normalized = entries.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
|
|
117
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
110
|
+
return normalizeStringListOption(entries);
|
|
118
111
|
}
|
|
119
112
|
function hasConfiguredCssEntries(ctx) {
|
|
120
113
|
if (normalizeCssEntriesConfig(ctx.cssEntries)) return true;
|
|
@@ -368,24 +361,22 @@ function tryCreateMultiTailwindcssPatcher(groups, options) {
|
|
|
368
361
|
}
|
|
369
362
|
//#endregion
|
|
370
363
|
//#region src/uni-app-x/options.ts
|
|
364
|
+
const DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS = {
|
|
365
|
+
enabled: true,
|
|
366
|
+
onlyWhenStyleIsolationVersion2: true
|
|
367
|
+
};
|
|
368
|
+
const DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS = {
|
|
369
|
+
enabled: false,
|
|
370
|
+
onlyWhenStyleIsolationVersion2: true
|
|
371
|
+
};
|
|
372
|
+
function isBooleanUniAppXShortcut(option) {
|
|
373
|
+
return option === true || option === false || option === void 0;
|
|
374
|
+
}
|
|
371
375
|
function resolveComponentLocalStyles(option) {
|
|
372
|
-
if (option
|
|
373
|
-
enabled: false,
|
|
374
|
-
onlyWhenStyleIsolationVersion2: true
|
|
375
|
-
};
|
|
376
|
-
if (option === true || option === void 0) return {
|
|
377
|
-
enabled: false,
|
|
378
|
-
onlyWhenStyleIsolationVersion2: true
|
|
379
|
-
};
|
|
376
|
+
if (isBooleanUniAppXShortcut(option)) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
380
377
|
const componentLocalStyles = option.componentLocalStyles;
|
|
381
|
-
if (componentLocalStyles === false) return
|
|
382
|
-
|
|
383
|
-
onlyWhenStyleIsolationVersion2: true
|
|
384
|
-
};
|
|
385
|
-
if (componentLocalStyles === true || componentLocalStyles === void 0) return {
|
|
386
|
-
enabled: true,
|
|
387
|
-
onlyWhenStyleIsolationVersion2: true
|
|
388
|
-
};
|
|
378
|
+
if (componentLocalStyles === false) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
379
|
+
if (componentLocalStyles === true || componentLocalStyles === void 0) return DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
389
380
|
return {
|
|
390
381
|
enabled: componentLocalStyles.enabled !== false,
|
|
391
382
|
onlyWhenStyleIsolationVersion2: componentLocalStyles.onlyWhenStyleIsolationVersion2 !== false
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ import type { UniAppXComponentLocalStylesOptions, UniAppXOptions as UniAppXUserD
|
|
|
10
10
|
type AsyncableMethod<T> = T extends (...args: infer A) => infer R ? (...args: A) => Promise<Awaited<R>> | Awaited<R> : never;
|
|
11
11
|
export type { UniAppXComponentLocalStylesOptions, UniAppXUserDefinedOptions, UserDefinedOptions, };
|
|
12
12
|
export type { CssPreflightOptions, IStyleHandlerOptions, ItemOrItemArray };
|
|
13
|
-
export type { AppType, IArbitraryValues, ICustomAttributes, ICustomAttributesEntities } from './shared';
|
|
13
|
+
export type { AppType, IArbitraryValues, ICustomAttributes, ICustomAttributesEntities, IUnocssCompatibilityOptions } from './shared';
|
|
14
14
|
export type RequiredDefined<T> = {
|
|
15
15
|
[K in keyof T]-?: Exclude<T[K], undefined>;
|
|
16
16
|
};
|
package/dist/types/shared.d.ts
CHANGED
|
@@ -3,11 +3,12 @@ import type { LoadedPostcssOptions } from '@weapp-tailwindcss/postcss/types';
|
|
|
3
3
|
import type { ILengthUnitsPatchOptions, TailwindCssPatchOptions } from 'tailwindcss-patch';
|
|
4
4
|
import type { ICreateCacheReturnType } from '../../cache';
|
|
5
5
|
import type { WeappTailwindcssGeneratorUserOptions } from '../../generator';
|
|
6
|
-
import type { AppType, IArbitraryValues } from '../shared';
|
|
6
|
+
import type { AppType, IArbitraryValues, IUnocssCompatibilityOptions } from '../shared';
|
|
7
7
|
export interface UserDefinedOptionsGeneralPart {
|
|
8
8
|
supportCustomLengthUnitsPatch?: ILengthUnitsPatchOptions | boolean | undefined;
|
|
9
9
|
appType?: AppType | undefined;
|
|
10
10
|
arbitraryValues?: IArbitraryValues | undefined;
|
|
11
|
+
unocss?: boolean | IUnocssCompatibilityOptions | undefined;
|
|
11
12
|
jsPreserveClass?: ((keyword: string) => boolean | undefined) | undefined;
|
|
12
13
|
jsArbitraryValueFallback?: boolean | 'auto' | undefined;
|
|
13
14
|
replaceRuntimePackages?: boolean | Record<string, string> | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CssCalcOptions, CssPreflightOptions, IStyleHandlerOptions, PresetEnvOptions, Px2rpxOptions, Rem2rpxOptions, UniAppXUnsupportedMode, UnitsToPxOptions, WeappAutoprefixerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
1
|
+
import type { CssCalcOptions, CssPreflightOptions, IStyleHandlerOptions, PresetEnvOptions, Px2rpxOptions, Rem2rpxOptions, UniAppXUnsupportedMode, UnitConversionOptions, UnitsToPxOptions, WeappAutoprefixerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
2
2
|
import type { TailwindCssPatchOptions } from 'tailwindcss-patch';
|
|
3
3
|
import type { ICustomAttributes } from '../shared';
|
|
4
4
|
export interface UniAppXComponentLocalStylesOptions {
|
|
@@ -29,6 +29,8 @@ export interface UserDefinedOptionsImportantPart {
|
|
|
29
29
|
rem2rpx?: boolean | Rem2rpxOptions | undefined;
|
|
30
30
|
px2rpx?: boolean | Px2rpxOptions | undefined;
|
|
31
31
|
unitsToPx?: boolean | UnitsToPxOptions | undefined;
|
|
32
|
+
platform?: IStyleHandlerOptions['platform'] | undefined;
|
|
33
|
+
unitConversion?: UnitConversionOptions | undefined;
|
|
32
34
|
cssPresetEnv?: PresetEnvOptions | undefined;
|
|
33
35
|
atRules?: IStyleHandlerOptions['atRules'] | undefined;
|
|
34
36
|
autoprefixer?: WeappAutoprefixerOptions | undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function escapeStringRegexp(str: string): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
+
const require_auto = require("./auto-B11j1XiD.js");
|
|
2
3
|
let node_fs = require("node:fs");
|
|
3
4
|
node_fs = require_chunk.__toESM(node_fs);
|
|
4
5
|
let node_module = require("node:module");
|
|
@@ -88,17 +89,31 @@ function omitUndefined(value) {
|
|
|
88
89
|
return Object.fromEntries(definedEntries(value));
|
|
89
90
|
}
|
|
90
91
|
//#endregion
|
|
92
|
+
//#region src/utils/options.ts
|
|
93
|
+
function resolveBooleanObjectOption(value, enabledValue) {
|
|
94
|
+
if (!value) return false;
|
|
95
|
+
if (value === true) return enabledValue;
|
|
96
|
+
return value;
|
|
97
|
+
}
|
|
98
|
+
function normalizeStringListOption(value) {
|
|
99
|
+
if (!value) return;
|
|
100
|
+
const values = typeof value === "string" ? [value] : Array.isArray(value) ? value : void 0;
|
|
101
|
+
if (!values) return;
|
|
102
|
+
const normalized = values.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
|
|
103
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
91
106
|
//#region src/tailwindcss/patcher-options.ts
|
|
92
107
|
function resolveTailwindcssOptions(options) {
|
|
93
108
|
return options?.tailwindcss ?? options?.tailwind;
|
|
94
109
|
}
|
|
95
110
|
function normalizeExtendLengthUnits(value) {
|
|
96
|
-
if (value ===
|
|
97
|
-
|
|
98
|
-
|
|
111
|
+
if (value === void 0) return;
|
|
112
|
+
const resolved = resolveBooleanObjectOption(value, { enabled: true });
|
|
113
|
+
return resolved && typeof resolved === "object" ? {
|
|
99
114
|
enabled: true,
|
|
100
|
-
...
|
|
101
|
-
};
|
|
115
|
+
...resolved
|
|
116
|
+
} : resolved;
|
|
102
117
|
}
|
|
103
118
|
function normalizeTailwindcssPatcherOptions(options) {
|
|
104
119
|
return options;
|
|
@@ -748,10 +763,12 @@ async function transformTailwindV4CssToWeapp(css, options) {
|
|
|
748
763
|
majorVersion: 4,
|
|
749
764
|
...options
|
|
750
765
|
});
|
|
751
|
-
|
|
766
|
+
const pruneOptions = { preserveConditionalComments: require_auto.hasCssMacroStyleOptions(options) };
|
|
767
|
+
return (0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(protectedCss.restore(result.css), pruneOptions);
|
|
752
768
|
}
|
|
753
769
|
async function transformTailwindV4CssByTarget(css, target, options) {
|
|
754
|
-
|
|
770
|
+
if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
|
|
771
|
+
return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css) : css;
|
|
755
772
|
}
|
|
756
773
|
//#endregion
|
|
757
774
|
//#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
|
|
@@ -1489,7 +1506,7 @@ function createTailwindV4DefaultColorThemeCss() {
|
|
|
1489
1506
|
const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
|
|
1490
1507
|
const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
|
|
1491
1508
|
const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
|
|
1492
|
-
const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:([
|
|
1509
|
+
const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
|
|
1493
1510
|
const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
|
|
1494
1511
|
"**/.git/**",
|
|
1495
1512
|
"**/.hg/**",
|
|
@@ -1558,13 +1575,16 @@ function restoreRpxTextCandidates(candidates, restoreCandidates) {
|
|
|
1558
1575
|
if (restoreCandidates.size === 0) return new Set(candidates);
|
|
1559
1576
|
return new Set([...candidates].map((candidate) => restoreCandidates.get(candidate) ?? candidate));
|
|
1560
1577
|
}
|
|
1578
|
+
function normalizeCssEscapedRpxSelectorValue(value) {
|
|
1579
|
+
return value.replace(/\\([.+-])/g, "$1");
|
|
1580
|
+
}
|
|
1561
1581
|
function restoreRpxTextCssSelectors(css, restoreCandidates) {
|
|
1562
1582
|
if (restoreCandidates.size === 0 || !css.includes("text-\\[length\\:")) return css;
|
|
1563
1583
|
const restoredValues = new Set([...restoreCandidates.keys()].map((candidate) => {
|
|
1564
1584
|
return BARE_RPX_TEXT_CANDIDATE_RE.exec(candidate.replace("[length:", "["))?.[2];
|
|
1565
1585
|
}).filter((value) => Boolean(value)));
|
|
1566
1586
|
return css.replace(RPX_TEXT_LENGTH_SELECTOR_RE, (match, value) => {
|
|
1567
|
-
return restoredValues.has(value) ? `text-\\[${value}\\]` : match;
|
|
1587
|
+
return restoredValues.has(normalizeCssEscapedRpxSelectorValue(value)) ? `text-\\[${value}\\]` : match;
|
|
1568
1588
|
});
|
|
1569
1589
|
}
|
|
1570
1590
|
function createStableJson$1(value) {
|
|
@@ -1649,6 +1669,9 @@ function createIncrementalStyleOptions(styleOptions) {
|
|
|
1649
1669
|
isMainChunk: false
|
|
1650
1670
|
};
|
|
1651
1671
|
}
|
|
1672
|
+
function resolveStyleOptions$1(source, options) {
|
|
1673
|
+
return require_auto.hasCssMacroTailwindV4Directive(source.css) ? require_auto.withCssMacroStyleOptions(options) : options;
|
|
1674
|
+
}
|
|
1652
1675
|
function collectCustomPropertyValues(css) {
|
|
1653
1676
|
const values = /* @__PURE__ */ new Map();
|
|
1654
1677
|
try {
|
|
@@ -1802,6 +1825,7 @@ function removeUnsupportedThemeVendorKeyframes(css) {
|
|
|
1802
1825
|
function createTailwindV4Engine(source) {
|
|
1803
1826
|
async function generateOnce(generateSource, options = {}) {
|
|
1804
1827
|
const { scanSources = true, styleOptions, tailwindcssV3Compatibility, target = "weapp", ...patchOptions } = options;
|
|
1828
|
+
const resolvedStyleOptions = resolveStyleOptions$1(generateSource, styleOptions);
|
|
1805
1829
|
const engine = (0, tailwindcss_patch.createTailwindV4Engine)(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
|
|
1806
1830
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1807
1831
|
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources)) : void 0;
|
|
@@ -1812,7 +1836,7 @@ function createTailwindV4Engine(source) {
|
|
|
1812
1836
|
candidates: normalizedCandidates.candidates
|
|
1813
1837
|
}));
|
|
1814
1838
|
const rawCss = restoreRpxTextCssSelectors(result.css, normalizedCandidates.restoreCandidates);
|
|
1815
|
-
const css = await transformTailwindV4CssByTarget(rawCss, target,
|
|
1839
|
+
const css = await transformTailwindV4CssByTarget(rawCss, target, resolvedStyleOptions);
|
|
1816
1840
|
return {
|
|
1817
1841
|
...result,
|
|
1818
1842
|
classSet: restoreRpxTextCandidates(result.classSet, normalizedCandidates.restoreCandidates),
|
|
@@ -1826,8 +1850,9 @@ function createTailwindV4Engine(source) {
|
|
|
1826
1850
|
const target = options.target ?? "weapp";
|
|
1827
1851
|
const compatibleSource = createCompatibleSource(source, target, options.tailwindcssV3Compatibility);
|
|
1828
1852
|
const requestedCandidates = resolveTargetCandidates(options.candidates, target);
|
|
1853
|
+
const styleOptions = resolveStyleOptions$1(source, options.styleOptions);
|
|
1829
1854
|
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(source, options);
|
|
1830
|
-
const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target,
|
|
1855
|
+
const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
|
|
1831
1856
|
if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1832
1857
|
const generated = await generateOnce(source, options);
|
|
1833
1858
|
seedIncrementalGenerateCache({
|
|
@@ -1872,7 +1897,7 @@ function createTailwindV4Engine(source) {
|
|
|
1872
1897
|
}
|
|
1873
1898
|
const rawCss = rawCssParts.join("\n");
|
|
1874
1899
|
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
|
|
1875
|
-
...createIncrementalStyleOptions(
|
|
1900
|
+
...createIncrementalStyleOptions(styleOptions),
|
|
1876
1901
|
customPropertyValues: cached.customPropertyValues
|
|
1877
1902
|
}) : "";
|
|
1878
1903
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
@@ -1900,7 +1925,7 @@ function createTailwindV4Engine(source) {
|
|
|
1900
1925
|
compatibleSource,
|
|
1901
1926
|
generated,
|
|
1902
1927
|
requestedCandidates,
|
|
1903
|
-
styleOptions
|
|
1928
|
+
styleOptions,
|
|
1904
1929
|
tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
|
|
1905
1930
|
target
|
|
1906
1931
|
});
|
|
@@ -2799,16 +2824,22 @@ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
|
|
|
2799
2824
|
}
|
|
2800
2825
|
}
|
|
2801
2826
|
async function transformTailwindV3CssToWeapp(css, options) {
|
|
2802
|
-
|
|
2827
|
+
const result = await defaultStyleHandler(css, {
|
|
2803
2828
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
2804
2829
|
cssRemoveHoverPseudoClass: true,
|
|
2805
2830
|
isMainChunk: true,
|
|
2806
2831
|
majorVersion: 3,
|
|
2807
2832
|
...options
|
|
2808
|
-
})
|
|
2833
|
+
});
|
|
2834
|
+
const pruneOptions = {
|
|
2835
|
+
preservePreflight: true,
|
|
2836
|
+
preserveConditionalComments: require_auto.hasCssMacroStyleOptions(options)
|
|
2837
|
+
};
|
|
2838
|
+
return ensureMiniProgramV3PreflightReset((0, _weapp_tailwindcss_postcss.pruneMiniProgramGeneratedCss)(result.css, pruneOptions), options?.cssPreflight);
|
|
2809
2839
|
}
|
|
2810
2840
|
async function transformTailwindV3CssByTarget(css, target, options) {
|
|
2811
|
-
|
|
2841
|
+
if (target === "weapp") return transformTailwindV3CssToWeapp(css, options);
|
|
2842
|
+
return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css) : css;
|
|
2812
2843
|
}
|
|
2813
2844
|
//#endregion
|
|
2814
2845
|
//#region src/tailwindcss/v3-engine/generator.ts
|
|
@@ -2871,7 +2902,7 @@ function extractClassCandidatesFromSelector(selector, candidates) {
|
|
|
2871
2902
|
escaped = true;
|
|
2872
2903
|
continue;
|
|
2873
2904
|
}
|
|
2874
|
-
if (/[\w-]/.test(char)) {
|
|
2905
|
+
if (char && /[\w-]/.test(char)) {
|
|
2875
2906
|
candidate += char;
|
|
2876
2907
|
continue;
|
|
2877
2908
|
}
|
|
@@ -2932,6 +2963,12 @@ function createTailwindConfig(source, options) {
|
|
|
2932
2963
|
config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
|
|
2933
2964
|
return config;
|
|
2934
2965
|
}
|
|
2966
|
+
function shouldAutoEnableCssMacro(source) {
|
|
2967
|
+
return require_auto.hasCssMacroTailwindPlugin(normalizeConfigObject(source.configObject)?.plugins);
|
|
2968
|
+
}
|
|
2969
|
+
function resolveStyleOptions(source, options) {
|
|
2970
|
+
return shouldAutoEnableCssMacro(source) ? require_auto.withCssMacroStyleOptions(options) : options;
|
|
2971
|
+
}
|
|
2935
2972
|
function loadTailwindV3Internals(source) {
|
|
2936
2973
|
const requireFromProject = (0, node_module.createRequire)(`${source.cwd}/package.json`);
|
|
2937
2974
|
const requireFromRuntime = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
@@ -3066,6 +3103,7 @@ function createTailwindV3Engine(source) {
|
|
|
3066
3103
|
tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
|
|
3067
3104
|
const internals = tailwindInternals;
|
|
3068
3105
|
const { styleOptions, target = "weapp" } = options;
|
|
3106
|
+
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
3069
3107
|
const tailwindConfig = internals.validateConfig(internals.resolveConfig(createTailwindConfig(generateSource, options)));
|
|
3070
3108
|
const candidates = mergeGenerateCandidates(generateSource, options);
|
|
3071
3109
|
const changedContent = createChangedContentEntries(candidates, options.sources ?? []);
|
|
@@ -3090,7 +3128,7 @@ function createTailwindV3Engine(source) {
|
|
|
3090
3128
|
context = await internals.processTailwindFeatures(setupContext)(root, result);
|
|
3091
3129
|
}
|
|
3092
3130
|
const rawCss = root.toString();
|
|
3093
|
-
const css = await transformTailwindV3CssByTarget(rawCss, target,
|
|
3131
|
+
const css = await transformTailwindV3CssByTarget(rawCss, target, resolvedStyleOptions);
|
|
3094
3132
|
const dependencies = collectDependencyMessages(result);
|
|
3095
3133
|
for (const dependency of generateSource.dependencies) dependencies.add(dependency);
|
|
3096
3134
|
const classSet = collectClassSet(context);
|
|
@@ -3121,7 +3159,7 @@ function createTailwindV3Engine(source) {
|
|
|
3121
3159
|
internals.collapseDuplicateDeclarations(context)(root, result);
|
|
3122
3160
|
const rawCss = root.toString();
|
|
3123
3161
|
return {
|
|
3124
|
-
css: await transformTailwindV3CssByTarget(rawCss, target, styleOptions),
|
|
3162
|
+
css: await transformTailwindV3CssByTarget(rawCss, target, resolveStyleOptions(source, styleOptions)),
|
|
3125
3163
|
rawCss,
|
|
3126
3164
|
classSet: collectClassSet(context),
|
|
3127
3165
|
dependencies: collectDependencyMessages(result)
|
|
@@ -3132,7 +3170,8 @@ function createTailwindV3Engine(source) {
|
|
|
3132
3170
|
const target = options.target ?? "weapp";
|
|
3133
3171
|
const requestedCandidates = mergeGenerateCandidates(source, options);
|
|
3134
3172
|
if (requestedCandidates.size === 0) return generateOnce(source, options);
|
|
3135
|
-
const
|
|
3173
|
+
const styleOptions = resolveStyleOptions(source, options.styleOptions);
|
|
3174
|
+
const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions);
|
|
3136
3175
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
3137
3176
|
if (cached) {
|
|
3138
3177
|
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
@@ -3149,7 +3188,7 @@ function createTailwindV3Engine(source) {
|
|
|
3149
3188
|
target: cached.target,
|
|
3150
3189
|
version: 3
|
|
3151
3190
|
};
|
|
3152
|
-
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target,
|
|
3191
|
+
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target, styleOptions);
|
|
3153
3192
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
3154
3193
|
for (const className of generated.classSet) cached.classSet.add(className);
|
|
3155
3194
|
cached.css = [cached.css, generated.css].filter(Boolean).join("\n");
|
|
@@ -3417,6 +3456,12 @@ Object.defineProperty(exports, "normalizeLegacyContentEntries", {
|
|
|
3417
3456
|
return normalizeLegacyContentEntries;
|
|
3418
3457
|
}
|
|
3419
3458
|
});
|
|
3459
|
+
Object.defineProperty(exports, "normalizeStringListOption", {
|
|
3460
|
+
enumerable: true,
|
|
3461
|
+
get: function() {
|
|
3462
|
+
return normalizeStringListOption;
|
|
3463
|
+
}
|
|
3464
|
+
});
|
|
3420
3465
|
Object.defineProperty(exports, "omitUndefined", {
|
|
3421
3466
|
enumerable: true,
|
|
3422
3467
|
get: function() {
|
|
@@ -3435,6 +3480,12 @@ Object.defineProperty(exports, "readInstalledPackageMajorVersion", {
|
|
|
3435
3480
|
return readInstalledPackageMajorVersion;
|
|
3436
3481
|
}
|
|
3437
3482
|
});
|
|
3483
|
+
Object.defineProperty(exports, "resolveBooleanObjectOption", {
|
|
3484
|
+
enumerable: true,
|
|
3485
|
+
get: function() {
|
|
3486
|
+
return resolveBooleanObjectOption;
|
|
3487
|
+
}
|
|
3488
|
+
});
|
|
3438
3489
|
Object.defineProperty(exports, "resolveCssSourceEntries", {
|
|
3439
3490
|
enumerable: true,
|
|
3440
3491
|
get: function() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { a as transformCssMacroCss, n as hasCssMacroTailwindPlugin, o as withCssMacroStyleOptions, r as hasCssMacroTailwindV4Directive, t as hasCssMacroStyleOptions } from "./auto-AduSz49t.mjs";
|
|
1
2
|
import { createRequire } from "node:module";
|
|
2
3
|
import fs, { existsSync, readFileSync, readdirSync, realpathSync, statSync } from "node:fs";
|
|
3
4
|
import postcss from "postcss";
|
|
@@ -80,17 +81,31 @@ function omitUndefined(value) {
|
|
|
80
81
|
return Object.fromEntries(definedEntries(value));
|
|
81
82
|
}
|
|
82
83
|
//#endregion
|
|
84
|
+
//#region src/utils/options.ts
|
|
85
|
+
function resolveBooleanObjectOption(value, enabledValue) {
|
|
86
|
+
if (!value) return false;
|
|
87
|
+
if (value === true) return enabledValue;
|
|
88
|
+
return value;
|
|
89
|
+
}
|
|
90
|
+
function normalizeStringListOption(value) {
|
|
91
|
+
if (!value) return;
|
|
92
|
+
const values = typeof value === "string" ? [value] : Array.isArray(value) ? value : void 0;
|
|
93
|
+
if (!values) return;
|
|
94
|
+
const normalized = values.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
|
|
95
|
+
return normalized.length > 0 ? normalized : void 0;
|
|
96
|
+
}
|
|
97
|
+
//#endregion
|
|
83
98
|
//#region src/tailwindcss/patcher-options.ts
|
|
84
99
|
function resolveTailwindcssOptions(options) {
|
|
85
100
|
return options?.tailwindcss ?? options?.tailwind;
|
|
86
101
|
}
|
|
87
102
|
function normalizeExtendLengthUnits(value) {
|
|
88
|
-
if (value ===
|
|
89
|
-
|
|
90
|
-
|
|
103
|
+
if (value === void 0) return;
|
|
104
|
+
const resolved = resolveBooleanObjectOption(value, { enabled: true });
|
|
105
|
+
return resolved && typeof resolved === "object" ? {
|
|
91
106
|
enabled: true,
|
|
92
|
-
...
|
|
93
|
-
};
|
|
107
|
+
...resolved
|
|
108
|
+
} : resolved;
|
|
94
109
|
}
|
|
95
110
|
function normalizeTailwindcssPatcherOptions(options) {
|
|
96
111
|
return options;
|
|
@@ -740,10 +755,12 @@ async function transformTailwindV4CssToWeapp(css, options) {
|
|
|
740
755
|
majorVersion: 4,
|
|
741
756
|
...options
|
|
742
757
|
});
|
|
743
|
-
|
|
758
|
+
const pruneOptions = { preserveConditionalComments: hasCssMacroStyleOptions(options) };
|
|
759
|
+
return pruneMiniProgramGeneratedCss(protectedCss.restore(result.css), pruneOptions);
|
|
744
760
|
}
|
|
745
761
|
async function transformTailwindV4CssByTarget(css, target, options) {
|
|
746
|
-
|
|
762
|
+
if (target === "weapp") return transformTailwindV4CssToWeapp(css, options);
|
|
763
|
+
return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css) : css;
|
|
747
764
|
}
|
|
748
765
|
//#endregion
|
|
749
766
|
//#region src/tailwindcss/v4-engine/tailwind-v3-default-colors.ts
|
|
@@ -1481,7 +1498,7 @@ function createTailwindV4DefaultColorThemeCss() {
|
|
|
1481
1498
|
const incrementalGenerateCache$1 = /* @__PURE__ */ new Map();
|
|
1482
1499
|
const incrementalGenerateTaskCache = /* @__PURE__ */ new Map();
|
|
1483
1500
|
const BARE_RPX_TEXT_CANDIDATE_RE = /(^|:)text-\[([-+]?(?:\d+|\d*\.\d+)rpx)\](.*)$/u;
|
|
1484
|
-
const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:([
|
|
1501
|
+
const RPX_TEXT_LENGTH_SELECTOR_RE = /text-\\\[length\\:((?:\\[.+-]|[+\-.\d])+rpx)\\\]/g;
|
|
1485
1502
|
const TAILWIND_V4_DEFAULT_IGNORED_SOURCE_PATTERNS = [
|
|
1486
1503
|
"**/.git/**",
|
|
1487
1504
|
"**/.hg/**",
|
|
@@ -1550,13 +1567,16 @@ function restoreRpxTextCandidates(candidates, restoreCandidates) {
|
|
|
1550
1567
|
if (restoreCandidates.size === 0) return new Set(candidates);
|
|
1551
1568
|
return new Set([...candidates].map((candidate) => restoreCandidates.get(candidate) ?? candidate));
|
|
1552
1569
|
}
|
|
1570
|
+
function normalizeCssEscapedRpxSelectorValue(value) {
|
|
1571
|
+
return value.replace(/\\([.+-])/g, "$1");
|
|
1572
|
+
}
|
|
1553
1573
|
function restoreRpxTextCssSelectors(css, restoreCandidates) {
|
|
1554
1574
|
if (restoreCandidates.size === 0 || !css.includes("text-\\[length\\:")) return css;
|
|
1555
1575
|
const restoredValues = new Set([...restoreCandidates.keys()].map((candidate) => {
|
|
1556
1576
|
return BARE_RPX_TEXT_CANDIDATE_RE.exec(candidate.replace("[length:", "["))?.[2];
|
|
1557
1577
|
}).filter((value) => Boolean(value)));
|
|
1558
1578
|
return css.replace(RPX_TEXT_LENGTH_SELECTOR_RE, (match, value) => {
|
|
1559
|
-
return restoredValues.has(value) ? `text-\\[${value}\\]` : match;
|
|
1579
|
+
return restoredValues.has(normalizeCssEscapedRpxSelectorValue(value)) ? `text-\\[${value}\\]` : match;
|
|
1560
1580
|
});
|
|
1561
1581
|
}
|
|
1562
1582
|
function createStableJson$1(value) {
|
|
@@ -1641,6 +1661,9 @@ function createIncrementalStyleOptions(styleOptions) {
|
|
|
1641
1661
|
isMainChunk: false
|
|
1642
1662
|
};
|
|
1643
1663
|
}
|
|
1664
|
+
function resolveStyleOptions$1(source, options) {
|
|
1665
|
+
return hasCssMacroTailwindV4Directive(source.css) ? withCssMacroStyleOptions(options) : options;
|
|
1666
|
+
}
|
|
1644
1667
|
function collectCustomPropertyValues(css) {
|
|
1645
1668
|
const values = /* @__PURE__ */ new Map();
|
|
1646
1669
|
try {
|
|
@@ -1794,6 +1817,7 @@ function removeUnsupportedThemeVendorKeyframes(css) {
|
|
|
1794
1817
|
function createTailwindV4Engine$1(source) {
|
|
1795
1818
|
async function generateOnce(generateSource, options = {}) {
|
|
1796
1819
|
const { scanSources = true, styleOptions, tailwindcssV3Compatibility, target = "weapp", ...patchOptions } = options;
|
|
1820
|
+
const resolvedStyleOptions = resolveStyleOptions$1(generateSource, styleOptions);
|
|
1797
1821
|
const engine = createTailwindV4Engine(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
|
|
1798
1822
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1799
1823
|
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await extractRawCandidates(resolvedScanSources)) : void 0;
|
|
@@ -1804,7 +1828,7 @@ function createTailwindV4Engine$1(source) {
|
|
|
1804
1828
|
candidates: normalizedCandidates.candidates
|
|
1805
1829
|
}));
|
|
1806
1830
|
const rawCss = restoreRpxTextCssSelectors(result.css, normalizedCandidates.restoreCandidates);
|
|
1807
|
-
const css = await transformTailwindV4CssByTarget(rawCss, target,
|
|
1831
|
+
const css = await transformTailwindV4CssByTarget(rawCss, target, resolvedStyleOptions);
|
|
1808
1832
|
return {
|
|
1809
1833
|
...result,
|
|
1810
1834
|
classSet: restoreRpxTextCandidates(result.classSet, normalizedCandidates.restoreCandidates),
|
|
@@ -1818,8 +1842,9 @@ function createTailwindV4Engine$1(source) {
|
|
|
1818
1842
|
const target = options.target ?? "weapp";
|
|
1819
1843
|
const compatibleSource = createCompatibleSource(source, target, options.tailwindcssV3Compatibility);
|
|
1820
1844
|
const requestedCandidates = resolveTargetCandidates(options.candidates, target);
|
|
1845
|
+
const styleOptions = resolveStyleOptions$1(source, options.styleOptions);
|
|
1821
1846
|
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(source, options);
|
|
1822
|
-
const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target,
|
|
1847
|
+
const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
|
|
1823
1848
|
if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1824
1849
|
const generated = await generateOnce(source, options);
|
|
1825
1850
|
seedIncrementalGenerateCache({
|
|
@@ -1864,7 +1889,7 @@ function createTailwindV4Engine$1(source) {
|
|
|
1864
1889
|
}
|
|
1865
1890
|
const rawCss = rawCssParts.join("\n");
|
|
1866
1891
|
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
|
|
1867
|
-
...createIncrementalStyleOptions(
|
|
1892
|
+
...createIncrementalStyleOptions(styleOptions),
|
|
1868
1893
|
customPropertyValues: cached.customPropertyValues
|
|
1869
1894
|
}) : "";
|
|
1870
1895
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
@@ -1892,7 +1917,7 @@ function createTailwindV4Engine$1(source) {
|
|
|
1892
1917
|
compatibleSource,
|
|
1893
1918
|
generated,
|
|
1894
1919
|
requestedCandidates,
|
|
1895
|
-
styleOptions
|
|
1920
|
+
styleOptions,
|
|
1896
1921
|
tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
|
|
1897
1922
|
target
|
|
1898
1923
|
});
|
|
@@ -2791,16 +2816,22 @@ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
|
|
|
2791
2816
|
}
|
|
2792
2817
|
}
|
|
2793
2818
|
async function transformTailwindV3CssToWeapp(css, options) {
|
|
2794
|
-
|
|
2819
|
+
const result = await defaultStyleHandler(css, {
|
|
2795
2820
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
2796
2821
|
cssRemoveHoverPseudoClass: true,
|
|
2797
2822
|
isMainChunk: true,
|
|
2798
2823
|
majorVersion: 3,
|
|
2799
2824
|
...options
|
|
2800
|
-
})
|
|
2825
|
+
});
|
|
2826
|
+
const pruneOptions = {
|
|
2827
|
+
preservePreflight: true,
|
|
2828
|
+
preserveConditionalComments: hasCssMacroStyleOptions(options)
|
|
2829
|
+
};
|
|
2830
|
+
return ensureMiniProgramV3PreflightReset(pruneMiniProgramGeneratedCss(result.css, pruneOptions), options?.cssPreflight);
|
|
2801
2831
|
}
|
|
2802
2832
|
async function transformTailwindV3CssByTarget(css, target, options) {
|
|
2803
|
-
|
|
2833
|
+
if (target === "weapp") return transformTailwindV3CssToWeapp(css, options);
|
|
2834
|
+
return hasCssMacroStyleOptions(options) ? transformCssMacroCss(css) : css;
|
|
2804
2835
|
}
|
|
2805
2836
|
//#endregion
|
|
2806
2837
|
//#region src/tailwindcss/v3-engine/generator.ts
|
|
@@ -2863,7 +2894,7 @@ function extractClassCandidatesFromSelector(selector, candidates) {
|
|
|
2863
2894
|
escaped = true;
|
|
2864
2895
|
continue;
|
|
2865
2896
|
}
|
|
2866
|
-
if (/[\w-]/.test(char)) {
|
|
2897
|
+
if (char && /[\w-]/.test(char)) {
|
|
2867
2898
|
candidate += char;
|
|
2868
2899
|
continue;
|
|
2869
2900
|
}
|
|
@@ -2924,6 +2955,12 @@ function createTailwindConfig(source, options) {
|
|
|
2924
2955
|
config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
|
|
2925
2956
|
return config;
|
|
2926
2957
|
}
|
|
2958
|
+
function shouldAutoEnableCssMacro(source) {
|
|
2959
|
+
return hasCssMacroTailwindPlugin(normalizeConfigObject(source.configObject)?.plugins);
|
|
2960
|
+
}
|
|
2961
|
+
function resolveStyleOptions(source, options) {
|
|
2962
|
+
return shouldAutoEnableCssMacro(source) ? withCssMacroStyleOptions(options) : options;
|
|
2963
|
+
}
|
|
2927
2964
|
function loadTailwindV3Internals(source) {
|
|
2928
2965
|
const requireFromProject = createRequire(`${source.cwd}/package.json`);
|
|
2929
2966
|
const requireFromRuntime = createRequire(import.meta.url);
|
|
@@ -3058,6 +3095,7 @@ function createTailwindV3Engine(source) {
|
|
|
3058
3095
|
tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
|
|
3059
3096
|
const internals = tailwindInternals;
|
|
3060
3097
|
const { styleOptions, target = "weapp" } = options;
|
|
3098
|
+
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
3061
3099
|
const tailwindConfig = internals.validateConfig(internals.resolveConfig(createTailwindConfig(generateSource, options)));
|
|
3062
3100
|
const candidates = mergeGenerateCandidates(generateSource, options);
|
|
3063
3101
|
const changedContent = createChangedContentEntries(candidates, options.sources ?? []);
|
|
@@ -3082,7 +3120,7 @@ function createTailwindV3Engine(source) {
|
|
|
3082
3120
|
context = await internals.processTailwindFeatures(setupContext)(root, result);
|
|
3083
3121
|
}
|
|
3084
3122
|
const rawCss = root.toString();
|
|
3085
|
-
const css = await transformTailwindV3CssByTarget(rawCss, target,
|
|
3123
|
+
const css = await transformTailwindV3CssByTarget(rawCss, target, resolvedStyleOptions);
|
|
3086
3124
|
const dependencies = collectDependencyMessages(result);
|
|
3087
3125
|
for (const dependency of generateSource.dependencies) dependencies.add(dependency);
|
|
3088
3126
|
const classSet = collectClassSet(context);
|
|
@@ -3113,7 +3151,7 @@ function createTailwindV3Engine(source) {
|
|
|
3113
3151
|
internals.collapseDuplicateDeclarations(context)(root, result);
|
|
3114
3152
|
const rawCss = root.toString();
|
|
3115
3153
|
return {
|
|
3116
|
-
css: await transformTailwindV3CssByTarget(rawCss, target, styleOptions),
|
|
3154
|
+
css: await transformTailwindV3CssByTarget(rawCss, target, resolveStyleOptions(source, styleOptions)),
|
|
3117
3155
|
rawCss,
|
|
3118
3156
|
classSet: collectClassSet(context),
|
|
3119
3157
|
dependencies: collectDependencyMessages(result)
|
|
@@ -3124,7 +3162,8 @@ function createTailwindV3Engine(source) {
|
|
|
3124
3162
|
const target = options.target ?? "weapp";
|
|
3125
3163
|
const requestedCandidates = mergeGenerateCandidates(source, options);
|
|
3126
3164
|
if (requestedCandidates.size === 0) return generateOnce(source, options);
|
|
3127
|
-
const
|
|
3165
|
+
const styleOptions = resolveStyleOptions(source, options.styleOptions);
|
|
3166
|
+
const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions);
|
|
3128
3167
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
3129
3168
|
if (cached) {
|
|
3130
3169
|
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
@@ -3141,7 +3180,7 @@ function createTailwindV3Engine(source) {
|
|
|
3141
3180
|
target: cached.target,
|
|
3142
3181
|
version: 3
|
|
3143
3182
|
};
|
|
3144
|
-
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target,
|
|
3183
|
+
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target, styleOptions);
|
|
3145
3184
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
3146
3185
|
for (const className of generated.classSet) cached.classSet.add(className);
|
|
3147
3186
|
cached.css = [cached.css, generated.css].filter(Boolean).join("\n");
|
|
@@ -3271,4 +3310,4 @@ function resolveTailwindV3SourceFromPatcher(patcher) {
|
|
|
3271
3310
|
return resolveTailwindV3Source(resolveTailwindV3SourceOptionsFromPatcher(patcher));
|
|
3272
3311
|
}
|
|
3273
3312
|
//#endregion
|
|
3274
|
-
export { collectCssInlineSourceCandidates as A, createDebug as B, createTailwindV4Engine$1 as C, loadTailwindV4DesignSystem as D, filterUnsupportedMiniProgramTailwindV4Candidates as E, parseConfigParam$1 as F,
|
|
3313
|
+
export { collectCssInlineSourceCandidates as A, createDebug as B, createTailwindV4Engine$1 as C, loadTailwindV4DesignSystem as D, filterUnsupportedMiniProgramTailwindV4Candidates as E, parseConfigParam$1 as F, normalizeStringListOption as G, readInstalledPackageMajorVersion as H, resolveCssSourceEntries as I, findNearestPackageRoot as J, resolveBooleanObjectOption as K, resolveSourceScanPath as L, expandTailwindSourceEntries as M, isFileMatchedByTailwindSourceEntries as N, DEFAULT_SOURCE_SCAN_EXTENSIONS as O, normalizeLegacyContentEntries as P, resolveTailwindV4CssSourceBase as R, resolveTailwindV4SourceOptionsFromPatcher as S, transformTailwindV4CssToWeapp as T, findTailwindConfig as U, createTailwindcssPatcher as V, resolveTailwindcssOptions as W, findWorkspaceRoot as X, findWorkspacePackageDir as Y, resolveViteSourceScanEntries as _, transformTailwindV3CssByTarget as a, resolveTailwindV4SourceFromPatchOptions as b, getRuntimeClassSetCacheEntry as c, invalidateRuntimeClassSet as d, runtimeSignaturePatchersSymbol as f, resolveTailwindV4EntriesFromCssCached as g, resolveTailwindV4EntriesFromCss as h, createTailwindV3Engine as i, createSourceScanPattern as j, FULL_SOURCE_SCAN_EXTENSION_RE as k, getRuntimeClassSetSignature as l, discoverTailwindV4CssEntries as m, resolveTailwindV3SourceFromPatcher as n, transformTailwindV3CssToWeapp as o, createViteSourceScanMatcher as p, omitUndefined as q, resolveTailwindV3SourceOptionsFromPatcher as r, ensureTailwindcssRuntimePatch as s, resolveTailwindV3Source as t, getRuntimeClassSetSignatureWithSources as u, resolveViteTailwindV4CssDependencies as v, transformTailwindV4CssByTarget as w, resolveTailwindV4SourceFromPatcher as x, resolveTailwindV4Source$1 as y, toPosixPath as z };
|