weapp-tailwindcss 5.0.0-next.24 → 5.0.0-next.26
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-CqyEtds4.js +115 -0
- package/dist/auto-CsWz6lsU.mjs +78 -0
- package/dist/{bundle-state-CP_BWXfx.mjs → bundle-state-CWcrb3mH.mjs} +1 -2
- package/dist/{bundle-state-DXFq2nEo.js → bundle-state-uCtqRm0p.js} +2 -3
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/cli.js +167 -6
- package/dist/cli.mjs +166 -5
- 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-BcH28HU-.js → generator-BH6a0xuB.js} +1 -1
- package/dist/{generator-DdEgn8nG.mjs → generator-iI_265gt.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-Bux7viee.mjs → incremental-runtime-class-set-ECHyKwUL.mjs} +4 -16
- package/dist/{incremental-runtime-class-set-CWdfLHON.js → incremental-runtime-class-set-mY0v1k-Y.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-BwW8zO24.js +192 -0
- package/dist/postcss-BzaRjBL0.mjs +169 -0
- package/dist/{postcss-cD5PXmMU.js → postcss-DEEAZ8J5.js} +2 -2
- package/dist/{postcss-nk5bhdoV.mjs → postcss-DJoU--Z-.mjs} +2 -2
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/precheck-BI8oBeUg.mjs +4692 -0
- package/dist/{precheck-DtYqujIx.js → precheck-DLJg0_pu.js} +2070 -34
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +19 -5
- package/dist/presets.mjs +18 -6
- package/dist/{source-candidates-B7wmEa-G.mjs → source-candidates-DkScNh9A.mjs} +1 -1
- package/dist/{source-candidates-lHtAHLQq.js → source-candidates-mfvC9gMc.js} +1 -1
- package/dist/{tailwindcss-BtUBeOes.js → tailwindcss-Cm93idme.js} +17 -26
- package/dist/{tailwindcss-DO-VVR5k.mjs → tailwindcss-DFa5Yes8.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-vHlppqaZ.js → v3-engine-CGsbY81C.js} +67 -19
- package/dist/{v3-engine-CXqgQZUc.mjs → v3-engine-CPJ9uGyr.mjs} +56 -20
- package/dist/{vite-BkNDGBZ2.js → vite-BM_ksf1q.js} +140 -21
- package/dist/{vite-BthAm8kt.mjs → vite-CqEF-Wx5.mjs} +140 -21
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +327 -73
- package/dist/weapp-tw-runtime-classset-loader.js +1 -4
- package/dist/{webpack-prCus5xn.js → webpack-CfcuDhQ8.js} +10 -7
- package/dist/{webpack-hPc8wUAi.mjs → webpack-D--XZMBB.mjs} +11 -8
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +14 -14
- package/dist/constants-BG12WAKw.mjs +0 -44
- package/dist/constants-BeeyfJ9k.js +0 -73
- package/dist/precheck-DreRGvYH.mjs +0 -2668
- /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
package/dist/presets/index.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export interface UniAppXOptions {
|
|
|
6
6
|
rem2rpx?: UserDefinedOptions['rem2rpx'];
|
|
7
7
|
generator?: UserDefinedOptions['generator'];
|
|
8
8
|
unitsToPx?: UserDefinedOptions['unitsToPx'];
|
|
9
|
+
unitConversion?: UserDefinedOptions['unitConversion'];
|
|
9
10
|
rawOptions?: UserDefinedOptions;
|
|
10
11
|
resolve?: PackageResolvingOptions;
|
|
11
12
|
customAttributes?: UserDefinedOptions['customAttributes'];
|
package/dist/presets.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
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_utils = require("./utils-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
6
|
-
require("./logger-
|
|
3
|
+
const require_v3_engine = require("./v3-engine-CGsbY81C.js");
|
|
4
|
+
const require_utils = require("./utils-CSA174-I.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-Cm93idme.js");
|
|
6
|
+
require("./logger-Cdzl3p8j.js");
|
|
7
|
+
let node_path = require("node:path");
|
|
8
|
+
node_path = require_chunk.__toESM(node_path);
|
|
7
9
|
let node_process = require("node:process");
|
|
8
10
|
node_process = require_chunk.__toESM(node_process);
|
|
9
11
|
let local_pkg = require("local-pkg");
|
|
@@ -42,6 +44,11 @@ function createBasePreset(options = {}) {
|
|
|
42
44
|
return (0, _weapp_tailwindcss_shared.defuOverrideArray)((0, _weapp_tailwindcss_shared.defuOverrideArray)(userOptions, rawOptions ?? {}), preset);
|
|
43
45
|
}
|
|
44
46
|
//#endregion
|
|
47
|
+
//#region src/presets/hbuilderx.ts
|
|
48
|
+
function hbuilderx(options = {}) {
|
|
49
|
+
return createBasePreset({ ...options });
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
45
52
|
//#region src/presets/uni-app.ts
|
|
46
53
|
function uniApp(options = {}) {
|
|
47
54
|
const uniPlatform = node_process.default.env["UNI_PLATFORM"];
|
|
@@ -61,7 +68,11 @@ function resolveTailwindResolveOptions(base, resolve) {
|
|
|
61
68
|
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
62
69
|
return {
|
|
63
70
|
...resolve ?? {},
|
|
64
|
-
paths: [...new Set([
|
|
71
|
+
paths: [...new Set([
|
|
72
|
+
node_path.default.join(base, "node_modules"),
|
|
73
|
+
base,
|
|
74
|
+
...currentPaths
|
|
75
|
+
])]
|
|
65
76
|
};
|
|
66
77
|
}
|
|
67
78
|
function resolveInstalledTailwindDefaults(resolve) {
|
|
@@ -101,6 +112,8 @@ function uniAppX(options) {
|
|
|
101
112
|
...options.generator !== void 0 ? { generator: options.generator } : {},
|
|
102
113
|
rem2rpx: options.rem2rpx,
|
|
103
114
|
unitsToPx: options.unitsToPx,
|
|
115
|
+
unitConversion: options.unitConversion,
|
|
116
|
+
appType: "uni-app-x",
|
|
104
117
|
tailwindcssBasedir: options.base,
|
|
105
118
|
tailwindcssPatcherOptions: {
|
|
106
119
|
projectRoot: options.base,
|
|
@@ -126,6 +139,7 @@ function uniAppX(options) {
|
|
|
126
139
|
}
|
|
127
140
|
//#endregion
|
|
128
141
|
exports.createBasePreset = createBasePreset;
|
|
142
|
+
exports.hbuilderx = hbuilderx;
|
|
129
143
|
exports.normalizeCssEntries = normalizeCssEntries;
|
|
130
144
|
exports.uniApp = uniApp;
|
|
131
145
|
exports.uniAppX = uniAppX;
|
package/dist/presets.mjs
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
4
|
-
import { t as logger } from "./logger-
|
|
1
|
+
import { q as omitUndefined } from "./v3-engine-CPJ9uGyr.mjs";
|
|
2
|
+
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-B2SJgA1L.mjs";
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-DFa5Yes8.mjs";
|
|
4
|
+
import { t as logger } from "./logger-Dr7IvyH2.mjs";
|
|
5
|
+
import path from "node:path";
|
|
5
6
|
import process from "node:process";
|
|
6
7
|
import { getPackageInfoSync } from "local-pkg";
|
|
7
8
|
//#region src/presets/shared.ts
|
|
@@ -37,6 +38,11 @@ function createBasePreset(options = {}) {
|
|
|
37
38
|
return defuOverrideArray(defuOverrideArray(userOptions, rawOptions ?? {}), preset);
|
|
38
39
|
}
|
|
39
40
|
//#endregion
|
|
41
|
+
//#region src/presets/hbuilderx.ts
|
|
42
|
+
function hbuilderx(options = {}) {
|
|
43
|
+
return createBasePreset({ ...options });
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
40
46
|
//#region src/presets/uni-app.ts
|
|
41
47
|
function uniApp(options = {}) {
|
|
42
48
|
const uniPlatform = process.env["UNI_PLATFORM"];
|
|
@@ -56,7 +62,11 @@ function resolveTailwindResolveOptions(base, resolve) {
|
|
|
56
62
|
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
57
63
|
return {
|
|
58
64
|
...resolve ?? {},
|
|
59
|
-
paths: [...new Set([
|
|
65
|
+
paths: [...new Set([
|
|
66
|
+
path.join(base, "node_modules"),
|
|
67
|
+
base,
|
|
68
|
+
...currentPaths
|
|
69
|
+
])]
|
|
60
70
|
};
|
|
61
71
|
}
|
|
62
72
|
function resolveInstalledTailwindDefaults(resolve) {
|
|
@@ -96,6 +106,8 @@ function uniAppX(options) {
|
|
|
96
106
|
...options.generator !== void 0 ? { generator: options.generator } : {},
|
|
97
107
|
rem2rpx: options.rem2rpx,
|
|
98
108
|
unitsToPx: options.unitsToPx,
|
|
109
|
+
unitConversion: options.unitConversion,
|
|
110
|
+
appType: "uni-app-x",
|
|
99
111
|
tailwindcssBasedir: options.base,
|
|
100
112
|
tailwindcssPatcherOptions: {
|
|
101
113
|
projectRoot: options.base,
|
|
@@ -120,4 +132,4 @@ function uniAppX(options) {
|
|
|
120
132
|
});
|
|
121
133
|
}
|
|
122
134
|
//#endregion
|
|
123
|
-
export { createBasePreset, normalizeCssEntries, uniApp, uniAppX };
|
|
135
|
+
export { createBasePreset, hbuilderx, normalizeCssEntries, uniApp, uniAppX };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-
|
|
1
|
+
import { L as resolveSourceScanPath, N as isFileMatchedByTailwindSourceEntries, k as FULL_SOURCE_SCAN_EXTENSION_RE, z as toPosixPath } from "./v3-engine-CPJ9uGyr.mjs";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { extractSourceCandidates, resolveProjectSourceFiles } 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-CGsbY81C.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,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-8l464Juk.js");
|
|
2
|
-
const require_v3_engine = require("./v3-engine-
|
|
3
|
-
require("./utils-
|
|
2
|
+
const require_v3_engine = require("./v3-engine-CGsbY81C.js");
|
|
3
|
+
require("./utils-CSA174-I.js");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_module = require("node:module");
|
|
6
6
|
let node_path = require("node:path");
|
|
@@ -111,14 +111,7 @@ function ensureDefaultsIncluded(value) {
|
|
|
111
111
|
return value;
|
|
112
112
|
}
|
|
113
113
|
function normalizeCssEntriesConfig(entries) {
|
|
114
|
-
|
|
115
|
-
if (typeof entries === "string") {
|
|
116
|
-
const trimmed = entries.trim();
|
|
117
|
-
return trimmed ? [trimmed] : void 0;
|
|
118
|
-
}
|
|
119
|
-
if (!Array.isArray(entries)) return;
|
|
120
|
-
const normalized = entries.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
|
|
121
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
114
|
+
return require_v3_engine.normalizeStringListOption(entries);
|
|
122
115
|
}
|
|
123
116
|
function hasConfiguredCssEntries(ctx) {
|
|
124
117
|
if (normalizeCssEntriesConfig(ctx.cssEntries)) return true;
|
|
@@ -372,24 +365,22 @@ function tryCreateMultiTailwindcssPatcher(groups, options) {
|
|
|
372
365
|
}
|
|
373
366
|
//#endregion
|
|
374
367
|
//#region src/uni-app-x/options.ts
|
|
368
|
+
const DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS = {
|
|
369
|
+
enabled: true,
|
|
370
|
+
onlyWhenStyleIsolationVersion2: true
|
|
371
|
+
};
|
|
372
|
+
const DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS = {
|
|
373
|
+
enabled: false,
|
|
374
|
+
onlyWhenStyleIsolationVersion2: true
|
|
375
|
+
};
|
|
376
|
+
function isBooleanUniAppXShortcut(option) {
|
|
377
|
+
return option === true || option === false || option === void 0;
|
|
378
|
+
}
|
|
375
379
|
function resolveComponentLocalStyles(option) {
|
|
376
|
-
if (option
|
|
377
|
-
enabled: false,
|
|
378
|
-
onlyWhenStyleIsolationVersion2: true
|
|
379
|
-
};
|
|
380
|
-
if (option === true || option === void 0) return {
|
|
381
|
-
enabled: false,
|
|
382
|
-
onlyWhenStyleIsolationVersion2: true
|
|
383
|
-
};
|
|
380
|
+
if (isBooleanUniAppXShortcut(option)) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
384
381
|
const componentLocalStyles = option.componentLocalStyles;
|
|
385
|
-
if (componentLocalStyles === false) return
|
|
386
|
-
|
|
387
|
-
onlyWhenStyleIsolationVersion2: true
|
|
388
|
-
};
|
|
389
|
-
if (componentLocalStyles === true || componentLocalStyles === void 0) return {
|
|
390
|
-
enabled: true,
|
|
391
|
-
onlyWhenStyleIsolationVersion2: true
|
|
392
|
-
};
|
|
382
|
+
if (componentLocalStyles === false) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
383
|
+
if (componentLocalStyles === true || componentLocalStyles === void 0) return DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
393
384
|
return {
|
|
394
385
|
enabled: componentLocalStyles.enabled !== false,
|
|
395
386
|
onlyWhenStyleIsolationVersion2: componentLocalStyles.onlyWhenStyleIsolationVersion2 !== false
|
|
@@ -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-CPJ9uGyr.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-CqyEtds4.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
|
|
@@ -1652,6 +1669,9 @@ function createIncrementalStyleOptions(styleOptions) {
|
|
|
1652
1669
|
isMainChunk: false
|
|
1653
1670
|
};
|
|
1654
1671
|
}
|
|
1672
|
+
function resolveStyleOptions$1(source, options) {
|
|
1673
|
+
return require_auto.hasCssMacroTailwindV4Directive(source.css) ? require_auto.withCssMacroStyleOptions(options) : options;
|
|
1674
|
+
}
|
|
1655
1675
|
function collectCustomPropertyValues(css) {
|
|
1656
1676
|
const values = /* @__PURE__ */ new Map();
|
|
1657
1677
|
try {
|
|
@@ -1805,6 +1825,7 @@ function removeUnsupportedThemeVendorKeyframes(css) {
|
|
|
1805
1825
|
function createTailwindV4Engine(source) {
|
|
1806
1826
|
async function generateOnce(generateSource, options = {}) {
|
|
1807
1827
|
const { scanSources = true, styleOptions, tailwindcssV3Compatibility, target = "weapp", ...patchOptions } = options;
|
|
1828
|
+
const resolvedStyleOptions = resolveStyleOptions$1(generateSource, styleOptions);
|
|
1808
1829
|
const engine = (0, tailwindcss_patch.createTailwindV4Engine)(createCompatibleSource(generateSource, target, tailwindcssV3Compatibility));
|
|
1809
1830
|
const resolvedScanSources = await resolveScanSources(generateSource, scanSources);
|
|
1810
1831
|
const filesystemCandidates = Array.isArray(resolvedScanSources) ? new Set(await (0, tailwindcss_patch.extractRawCandidates)(resolvedScanSources)) : void 0;
|
|
@@ -1815,7 +1836,7 @@ function createTailwindV4Engine(source) {
|
|
|
1815
1836
|
candidates: normalizedCandidates.candidates
|
|
1816
1837
|
}));
|
|
1817
1838
|
const rawCss = restoreRpxTextCssSelectors(result.css, normalizedCandidates.restoreCandidates);
|
|
1818
|
-
const css = await transformTailwindV4CssByTarget(rawCss, target,
|
|
1839
|
+
const css = await transformTailwindV4CssByTarget(rawCss, target, resolvedStyleOptions);
|
|
1819
1840
|
return {
|
|
1820
1841
|
...result,
|
|
1821
1842
|
classSet: restoreRpxTextCandidates(result.classSet, normalizedCandidates.restoreCandidates),
|
|
@@ -1829,8 +1850,9 @@ function createTailwindV4Engine(source) {
|
|
|
1829
1850
|
const target = options.target ?? "weapp";
|
|
1830
1851
|
const compatibleSource = createCompatibleSource(source, target, options.tailwindcssV3Compatibility);
|
|
1831
1852
|
const requestedCandidates = resolveTargetCandidates(options.candidates, target);
|
|
1853
|
+
const styleOptions = resolveStyleOptions$1(source, options.styleOptions);
|
|
1832
1854
|
if ((options.sources?.length ?? 0) > 0 || options.bareArbitraryValues !== void 0 || Array.isArray(options.scanSources)) return generateOnce(source, options);
|
|
1833
|
-
const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target,
|
|
1855
|
+
const cacheKey = createIncrementalGenerateCacheKey$1(compatibleSource, target, styleOptions, options.tailwindcssV3Compatibility);
|
|
1834
1856
|
if (options.scanSources === true) return runIncrementalGenerateTask(cacheKey, requestedCandidates, options.scanSources, async () => {
|
|
1835
1857
|
const generated = await generateOnce(source, options);
|
|
1836
1858
|
seedIncrementalGenerateCache({
|
|
@@ -1875,7 +1897,7 @@ function createTailwindV4Engine(source) {
|
|
|
1875
1897
|
}
|
|
1876
1898
|
const rawCss = rawCssParts.join("\n");
|
|
1877
1899
|
const incrementalCss = rawCss.length > 0 ? await transformTailwindV4CssByTarget(rawCss, target, {
|
|
1878
|
-
...createIncrementalStyleOptions(
|
|
1900
|
+
...createIncrementalStyleOptions(styleOptions),
|
|
1879
1901
|
customPropertyValues: cached.customPropertyValues
|
|
1880
1902
|
}) : "";
|
|
1881
1903
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
@@ -1903,7 +1925,7 @@ function createTailwindV4Engine(source) {
|
|
|
1903
1925
|
compatibleSource,
|
|
1904
1926
|
generated,
|
|
1905
1927
|
requestedCandidates,
|
|
1906
|
-
styleOptions
|
|
1928
|
+
styleOptions,
|
|
1907
1929
|
tailwindcssV3Compatibility: options.tailwindcssV3Compatibility,
|
|
1908
1930
|
target
|
|
1909
1931
|
});
|
|
@@ -2802,16 +2824,22 @@ function ensureMiniProgramV3PreflightReset(css, cssPreflight) {
|
|
|
2802
2824
|
}
|
|
2803
2825
|
}
|
|
2804
2826
|
async function transformTailwindV3CssToWeapp(css, options) {
|
|
2805
|
-
|
|
2827
|
+
const result = await defaultStyleHandler(css, {
|
|
2806
2828
|
cssChildCombinatorReplaceValue: ["view", "text"],
|
|
2807
2829
|
cssRemoveHoverPseudoClass: true,
|
|
2808
2830
|
isMainChunk: true,
|
|
2809
2831
|
majorVersion: 3,
|
|
2810
2832
|
...options
|
|
2811
|
-
})
|
|
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);
|
|
2812
2839
|
}
|
|
2813
2840
|
async function transformTailwindV3CssByTarget(css, target, options) {
|
|
2814
|
-
|
|
2841
|
+
if (target === "weapp") return transformTailwindV3CssToWeapp(css, options);
|
|
2842
|
+
return require_auto.hasCssMacroStyleOptions(options) ? require_auto.transformCssMacroCss(css) : css;
|
|
2815
2843
|
}
|
|
2816
2844
|
//#endregion
|
|
2817
2845
|
//#region src/tailwindcss/v3-engine/generator.ts
|
|
@@ -2874,7 +2902,7 @@ function extractClassCandidatesFromSelector(selector, candidates) {
|
|
|
2874
2902
|
escaped = true;
|
|
2875
2903
|
continue;
|
|
2876
2904
|
}
|
|
2877
|
-
if (/[\w-]/.test(char)) {
|
|
2905
|
+
if (char && /[\w-]/.test(char)) {
|
|
2878
2906
|
candidate += char;
|
|
2879
2907
|
continue;
|
|
2880
2908
|
}
|
|
@@ -2935,6 +2963,12 @@ function createTailwindConfig(source, options) {
|
|
|
2935
2963
|
config.content = hasExplicitContentInput(options) ? createExplicitContentConfig(rawEntries) : mergeContent(config.content, rawEntries);
|
|
2936
2964
|
return config;
|
|
2937
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
|
+
}
|
|
2938
2972
|
function loadTailwindV3Internals(source) {
|
|
2939
2973
|
const requireFromProject = (0, node_module.createRequire)(`${source.cwd}/package.json`);
|
|
2940
2974
|
const requireFromRuntime = (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href);
|
|
@@ -3069,6 +3103,7 @@ function createTailwindV3Engine(source) {
|
|
|
3069
3103
|
tailwindInternals ?? (tailwindInternals = loadTailwindV3Internals(source));
|
|
3070
3104
|
const internals = tailwindInternals;
|
|
3071
3105
|
const { styleOptions, target = "weapp" } = options;
|
|
3106
|
+
const resolvedStyleOptions = resolveStyleOptions(generateSource, styleOptions);
|
|
3072
3107
|
const tailwindConfig = internals.validateConfig(internals.resolveConfig(createTailwindConfig(generateSource, options)));
|
|
3073
3108
|
const candidates = mergeGenerateCandidates(generateSource, options);
|
|
3074
3109
|
const changedContent = createChangedContentEntries(candidates, options.sources ?? []);
|
|
@@ -3093,7 +3128,7 @@ function createTailwindV3Engine(source) {
|
|
|
3093
3128
|
context = await internals.processTailwindFeatures(setupContext)(root, result);
|
|
3094
3129
|
}
|
|
3095
3130
|
const rawCss = root.toString();
|
|
3096
|
-
const css = await transformTailwindV3CssByTarget(rawCss, target,
|
|
3131
|
+
const css = await transformTailwindV3CssByTarget(rawCss, target, resolvedStyleOptions);
|
|
3097
3132
|
const dependencies = collectDependencyMessages(result);
|
|
3098
3133
|
for (const dependency of generateSource.dependencies) dependencies.add(dependency);
|
|
3099
3134
|
const classSet = collectClassSet(context);
|
|
@@ -3124,7 +3159,7 @@ function createTailwindV3Engine(source) {
|
|
|
3124
3159
|
internals.collapseDuplicateDeclarations(context)(root, result);
|
|
3125
3160
|
const rawCss = root.toString();
|
|
3126
3161
|
return {
|
|
3127
|
-
css: await transformTailwindV3CssByTarget(rawCss, target, styleOptions),
|
|
3162
|
+
css: await transformTailwindV3CssByTarget(rawCss, target, resolveStyleOptions(source, styleOptions)),
|
|
3128
3163
|
rawCss,
|
|
3129
3164
|
classSet: collectClassSet(context),
|
|
3130
3165
|
dependencies: collectDependencyMessages(result)
|
|
@@ -3135,7 +3170,8 @@ function createTailwindV3Engine(source) {
|
|
|
3135
3170
|
const target = options.target ?? "weapp";
|
|
3136
3171
|
const requestedCandidates = mergeGenerateCandidates(source, options);
|
|
3137
3172
|
if (requestedCandidates.size === 0) return generateOnce(source, options);
|
|
3138
|
-
const
|
|
3173
|
+
const styleOptions = resolveStyleOptions(source, options.styleOptions);
|
|
3174
|
+
const cacheKey = createIncrementalGenerateCacheKey(source, target, styleOptions);
|
|
3139
3175
|
const cached = incrementalGenerateCache.get(cacheKey);
|
|
3140
3176
|
if (cached) {
|
|
3141
3177
|
const missingCandidates = [...requestedCandidates].filter((candidate) => !cached.seenCandidates.has(candidate));
|
|
@@ -3152,7 +3188,7 @@ function createTailwindV3Engine(source) {
|
|
|
3152
3188
|
target: cached.target,
|
|
3153
3189
|
version: 3
|
|
3154
3190
|
};
|
|
3155
|
-
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target,
|
|
3191
|
+
const generated = await generateIncrementalMissingUtilities(cached.context, missingCandidates, target, styleOptions);
|
|
3156
3192
|
for (const candidate of missingCandidates) cached.seenCandidates.add(candidate);
|
|
3157
3193
|
for (const className of generated.classSet) cached.classSet.add(className);
|
|
3158
3194
|
cached.css = [cached.css, generated.css].filter(Boolean).join("\n");
|
|
@@ -3420,6 +3456,12 @@ Object.defineProperty(exports, "normalizeLegacyContentEntries", {
|
|
|
3420
3456
|
return normalizeLegacyContentEntries;
|
|
3421
3457
|
}
|
|
3422
3458
|
});
|
|
3459
|
+
Object.defineProperty(exports, "normalizeStringListOption", {
|
|
3460
|
+
enumerable: true,
|
|
3461
|
+
get: function() {
|
|
3462
|
+
return normalizeStringListOption;
|
|
3463
|
+
}
|
|
3464
|
+
});
|
|
3423
3465
|
Object.defineProperty(exports, "omitUndefined", {
|
|
3424
3466
|
enumerable: true,
|
|
3425
3467
|
get: function() {
|
|
@@ -3438,6 +3480,12 @@ Object.defineProperty(exports, "readInstalledPackageMajorVersion", {
|
|
|
3438
3480
|
return readInstalledPackageMajorVersion;
|
|
3439
3481
|
}
|
|
3440
3482
|
});
|
|
3483
|
+
Object.defineProperty(exports, "resolveBooleanObjectOption", {
|
|
3484
|
+
enumerable: true,
|
|
3485
|
+
get: function() {
|
|
3486
|
+
return resolveBooleanObjectOption;
|
|
3487
|
+
}
|
|
3488
|
+
});
|
|
3441
3489
|
Object.defineProperty(exports, "resolveCssSourceEntries", {
|
|
3442
3490
|
enumerable: true,
|
|
3443
3491
|
get: function() {
|