weapp-tailwindcss 5.0.0-next.9 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/auto-DEHRmEAx.mjs +200 -0
- package/dist/auto-dPpsm6FB.js +238 -0
- package/dist/bundle-state-CnaJxkFY.mjs +413 -0
- package/dist/bundle-state-DgGEhk_z.js +529 -0
- package/dist/bundlers/shared/cache.d.ts +9 -7
- package/dist/bundlers/shared/css-cleanup/at-rules.d.ts +1 -2
- package/dist/bundlers/shared/css-cleanup.d.ts +1 -3
- package/dist/bundlers/shared/css-imports.d.ts +3 -3
- package/dist/bundlers/shared/generated-css-marker.d.ts +3 -0
- package/dist/bundlers/shared/generator-css/directives.d.ts +11 -3
- package/dist/bundlers/shared/generator-css/markers.d.ts +12 -0
- package/dist/bundlers/shared/generator-css/source-files.d.ts +9 -6
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +16 -2
- package/dist/bundlers/shared/generator-css/user-layer-order.d.ts +10 -0
- package/dist/bundlers/shared/generator-css.d.ts +6 -2
- package/dist/bundlers/shared/hmr-timing.d.ts +22 -0
- package/dist/bundlers/shared/style-requests.d.ts +2 -0
- package/dist/bundlers/vite/bundle-state.d.ts +1 -0
- package/dist/bundlers/vite/css-finalizer.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/candidates.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +5 -1
- package/dist/bundlers/vite/generate-bundle/css-share-scope.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +13 -1
- package/dist/bundlers/vite/incremental-runtime-class-set.d.ts +10 -2
- package/dist/bundlers/vite/index.d.ts +5 -2
- package/dist/bundlers/vite/processed-css-assets.d.ts +32 -0
- package/dist/bundlers/vite/rewrite-css-imports.d.ts +8 -5
- package/dist/bundlers/vite/runtime-class-set.d.ts +5 -1
- package/dist/bundlers/vite/serve-css-generation.d.ts +11 -0
- package/dist/bundlers/vite/source-candidates.d.ts +24 -2
- package/dist/bundlers/vite/source-scan.d.ts +26 -0
- package/dist/bundlers/vite/static-config-content.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +5 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +5 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-loaders.d.ts +8 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5.d.ts +1 -1
- package/dist/bundlers/webpack/loaders/runtime-registry.d.ts +31 -0
- package/dist/bundlers/webpack/loaders/weapp-tw-css-import-rewrite-loader.d.ts +2 -8
- package/dist/bundlers/webpack/loaders/weapp-tw-runtime-classset-loader.d.ts +3 -7
- package/dist/cache/index.d.ts +6 -6
- package/dist/{chunk-8l464Juk.js → chunk-C5U5_Hdc.js} +14 -0
- package/dist/cli/context.d.ts +1 -11
- package/dist/cli/doctor/types.d.ts +11 -11
- package/dist/cli/vscode-entry.d.ts +3 -3
- package/dist/cli.js +684 -41
- package/dist/cli.mjs +682 -40
- package/dist/context/runtime-package-replacements.d.ts +2 -0
- package/dist/context/style-options.d.ts +3 -0
- package/dist/context/tailwindcss.d.ts +1 -1
- package/dist/core.js +1 -2
- package/dist/core.mjs +1 -1
- package/dist/css-macro/auto.d.ts +11 -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 -46
- package/dist/css-macro/postcss.mjs +2 -46
- package/dist/css-macro.js +16 -7
- package/dist/css-macro.mjs +15 -6
- package/dist/defaults-8xrgzxFY.mjs +151 -0
- package/dist/defaults-zKUH2mDe.js +193 -0
- package/dist/defaults.js +6 -150
- package/dist/defaults.mjs +1 -143
- package/dist/escape.js +10 -2
- package/dist/escape.mjs +10 -2
- package/dist/generator/options.d.ts +11 -6
- package/dist/generator/types.d.ts +3 -3
- package/dist/generator--0-ekuVO.js +92 -0
- package/dist/generator-B76ovqsv.mjs +67 -0
- package/dist/generator.js +12 -12
- package/dist/generator.mjs +2 -1
- package/dist/gulp.js +163 -40
- package/dist/gulp.mjs +155 -32
- package/dist/incremental-runtime-class-set-CN6K_97P.js +2366 -0
- package/dist/incremental-runtime-class-set-x10M9bn_.mjs +2291 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +17 -5
- package/dist/index.mjs +6 -5
- package/dist/js/babel/cache-options.d.ts +3 -0
- package/dist/js/babel/parse.d.ts +7 -4
- package/dist/js/precheck.d.ts +2 -2
- package/dist/js/replacement-cache.d.ts +5 -0
- package/dist/postcss-C7BMYpEF.mjs +169 -0
- package/dist/{postcss-w48mGIhe.mjs → postcss-CR9UCaIK.mjs} +54 -114
- package/dist/postcss-CiYLsqZn.js +192 -0
- package/dist/{postcss-QIXwT40c.js → postcss-hYimKoN_.js} +60 -121
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss.js +1 -1
- package/dist/postcss.mjs +1 -1
- package/dist/precheck-BrNwLG2e.mjs +4716 -0
- package/dist/precheck-DPtJjZmV.js +4842 -0
- package/dist/presets/index.d.ts +1 -0
- package/dist/presets/uni-app-x.d.ts +1 -0
- package/dist/presets.js +27 -13
- package/dist/presets.mjs +25 -13
- package/dist/reset.js +1 -1
- package/dist/runtime-registry-DpcR3IHI.js +5496 -0
- package/dist/shared/mpx.d.ts +1 -0
- package/dist/source-candidates-DN1mihlU.mjs +322 -0
- package/dist/source-candidates-DSxme_O2.js +335 -0
- package/dist/tailwindcss/miniprogram.d.ts +1 -5
- package/dist/tailwindcss/remove-unsupported-css.d.ts +1 -2
- package/dist/tailwindcss/runtime/cache.d.ts +4 -3
- package/dist/tailwindcss/runtime.d.ts +9 -9
- package/dist/tailwindcss/source-scan.d.ts +35 -0
- package/dist/tailwindcss/v3-engine/types.d.ts +19 -14
- package/dist/tailwindcss/v4/css-entries.d.ts +2 -2
- package/dist/tailwindcss/v4/patcher.d.ts +1 -1
- package/dist/tailwindcss/v4-engine/source.d.ts +2 -2
- package/dist/tailwindcss/v4-engine/types.d.ts +18 -5
- package/dist/{tailwindcss-C5IgPlQ0.mjs → tailwindcss-DWtPieNE.mjs} +72 -60
- package/dist/{tailwindcss-Bu-RWIHx.js → tailwindcss-glCm_d3H.js} +81 -69
- package/dist/typedoc.export.d.ts +1 -1
- package/dist/types/index.d.ts +51 -41
- package/dist/types/shared.d.ts +3 -0
- package/dist/types/typedoc-tailwindcss-patch.d.ts +67 -0
- package/dist/types/user-defined-options/general.d.ts +25 -22
- package/dist/types/user-defined-options/important.d.ts +32 -27
- package/dist/types/user-defined-options/lifecycle.d.ts +4 -4
- package/dist/types/user-defined-options/matcher.d.ts +6 -6
- package/dist/unocss/index.d.ts +2 -0
- package/dist/utils/object.d.ts +9 -0
- package/dist/utils/options.d.ts +2 -0
- package/dist/utils/regex.d.ts +1 -0
- package/dist/{utils-BiShvil9.js → utils-D7Ygohep.js} +2 -2
- package/dist/{utils-Btw1iOVV.mjs → utils-DsaS975I.mjs} +1 -1
- package/dist/v3-engine-D3BMLVAN.js +3712 -0
- package/dist/v3-engine-DCxNPBVs.mjs +3417 -0
- package/dist/vite-DOprpdH-.mjs +24493 -0
- package/dist/vite-Ec0uX6kF.js +24507 -0
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +5444 -22
- package/dist/weapp-tw-runtime-classset-loader.js +32 -9
- package/dist/{webpack-BzN2ly34.js → webpack-Ccohlg3A.js} +341 -96
- package/dist/{webpack-DJazm5sT.mjs → webpack-DFlZcqAU.mjs} +323 -79
- package/dist/webpack.d.ts +1 -3
- package/dist/webpack.js +3 -4
- package/dist/webpack.mjs +2 -2
- package/dist/wxml/utils/codegen/legacy-visitor.d.ts +2 -4
- package/package.json +22 -20
- package/dist/bundlers/shared/css-cleanup/color-gamut.d.ts +0 -3
- package/dist/bundlers/shared/css-cleanup/root-cleanups.d.ts +0 -4
- package/dist/bundlers/shared/css-cleanup/selectors.d.ts +0 -8
- package/dist/cache-BVAiJV3J.js +0 -502
- package/dist/cache-CHs4DXui.mjs +0 -434
- package/dist/constants-BoB_6lFw.js +0 -73
- package/dist/constants-E_loJC49.mjs +0 -44
- package/dist/generator-DKkhJbOg.js +0 -1531
- package/dist/generator-UBmfduYg.mjs +0 -1432
- package/dist/generator-css-Bwp3nbrl.js +0 -1381
- package/dist/generator-css-DeLLmp2N.mjs +0 -1342
- package/dist/lightningcss/index.d.ts +0 -8
- package/dist/lightningcss/style-handler/options.d.ts +0 -3
- package/dist/lightningcss/style-handler/selector-transform.d.ts +0 -10
- package/dist/lightningcss/style-handler/selector-utils.d.ts +0 -10
- package/dist/lightningcss/style-handler.d.ts +0 -17
- package/dist/precheck-B32p-gLI.js +0 -2736
- package/dist/precheck-B4RH6ZNN.mjs +0 -2622
- package/dist/run-tasks-B50A3pxt.js +0 -128
- package/dist/run-tasks-DdNi-hkk.mjs +0 -91
- package/dist/runtime-patch-CwN5ya72.mjs +0 -71
- package/dist/runtime-patch-D6mBo_KB.js +0 -85
- package/dist/vite-By5KQi9s.js +0 -2419
- package/dist/vite-Cyp42bBf.mjs +0 -2406
- /package/dist/{logger-Bub1jggA.mjs → logger-BNzxZbZj.mjs} +0 -0
- /package/dist/{logger-BRy6XPQ2.js → logger-TlKT3xmR.js} +0 -0
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const require_chunk = require("./chunk-
|
|
2
|
-
const
|
|
3
|
-
require("./utils-
|
|
1
|
+
const require_chunk = require("./chunk-C5U5_Hdc.js");
|
|
2
|
+
const require_v3_engine = require("./v3-engine-D3BMLVAN.js");
|
|
3
|
+
require("./utils-D7Ygohep.js");
|
|
4
|
+
let node_fs = require("node:fs");
|
|
4
5
|
let node_module = require("node:module");
|
|
5
|
-
let node_path = require("node:path");
|
|
6
|
-
node_path = require_chunk.__toESM(node_path);
|
|
7
6
|
let node_process = require("node:process");
|
|
8
7
|
node_process = require_chunk.__toESM(node_process);
|
|
8
|
+
let node_path = require("node:path");
|
|
9
|
+
node_path = require_chunk.__toESM(node_path);
|
|
9
10
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
10
|
-
let node_fs = require("node:fs");
|
|
11
11
|
let node_url = require("node:url");
|
|
12
12
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
13
13
|
//#region src/tailwindcss/v4/css-sources.ts
|
|
@@ -27,18 +27,23 @@ function normalizeCssSourceFile(file) {
|
|
|
27
27
|
if (!file) return;
|
|
28
28
|
return node_path.default.isAbsolute(file) ? node_path.default.normalize(file) : file;
|
|
29
29
|
}
|
|
30
|
+
function normalizeCssSourceBase(base) {
|
|
31
|
+
if (!base) return;
|
|
32
|
+
return node_path.default.resolve(base);
|
|
33
|
+
}
|
|
30
34
|
function normalizeDependencies(dependencies) {
|
|
31
35
|
return dependencies?.map(normalizeCssSourceFile).filter((dependency) => typeof dependency === "string" && dependency.length > 0);
|
|
32
36
|
}
|
|
33
37
|
function isSameCssSource(a, b) {
|
|
34
|
-
return a.css === b.css && a.base === b.base && normalizeCssSourceFile(a.file) === normalizeCssSourceFile(b.file) && JSON.stringify(normalizeDependencies(a.dependencies)) === JSON.stringify(normalizeDependencies(b.dependencies));
|
|
38
|
+
return a.css === b.css && normalizeCssSourceBase(a.base) === normalizeCssSourceBase(b.base) && normalizeCssSourceFile(a.file) === normalizeCssSourceFile(b.file) && JSON.stringify(normalizeDependencies(a.dependencies)) === JSON.stringify(normalizeDependencies(b.dependencies));
|
|
35
39
|
}
|
|
36
40
|
function upsertTailwindV4CssSource(opts, source) {
|
|
37
|
-
const normalizedSource = {
|
|
41
|
+
const normalizedSource = require_v3_engine.omitUndefined({
|
|
38
42
|
...source,
|
|
43
|
+
...source.base === void 0 ? {} : { base: normalizeCssSourceBase(source.base) },
|
|
39
44
|
...source.file === void 0 ? {} : { file: normalizeCssSourceFile(source.file) },
|
|
40
45
|
...source.dependencies === void 0 ? {} : { dependencies: normalizeDependencies(source.dependencies) }
|
|
41
|
-
};
|
|
46
|
+
});
|
|
42
47
|
const tailwindcss = opts.tailwindcss ?? {};
|
|
43
48
|
const v4 = tailwindcss.v4 ?? {};
|
|
44
49
|
const cssSources = [...v4.cssSources ?? []];
|
|
@@ -46,6 +51,10 @@ function upsertTailwindV4CssSource(opts, source) {
|
|
|
46
51
|
const existingIndex = cssSources.findIndex((candidate) => normalizeCssSourceFile(candidate.file) === sourceFile);
|
|
47
52
|
if (existingIndex >= 0) {
|
|
48
53
|
const existing = cssSources[existingIndex];
|
|
54
|
+
if (!existing) {
|
|
55
|
+
cssSources[existingIndex] = normalizedSource;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
49
58
|
const nextSource = {
|
|
50
59
|
...existing,
|
|
51
60
|
...normalizedSource
|
|
@@ -102,14 +111,7 @@ function ensureDefaultsIncluded(value) {
|
|
|
102
111
|
return value;
|
|
103
112
|
}
|
|
104
113
|
function normalizeCssEntriesConfig(entries) {
|
|
105
|
-
|
|
106
|
-
if (typeof entries === "string") {
|
|
107
|
-
const trimmed = entries.trim();
|
|
108
|
-
return trimmed ? [trimmed] : void 0;
|
|
109
|
-
}
|
|
110
|
-
if (!Array.isArray(entries)) return;
|
|
111
|
-
const normalized = entries.map((entry) => typeof entry === "string" ? entry.trim() : "").filter((entry) => entry.length > 0);
|
|
112
|
-
return normalized.length > 0 ? normalized : void 0;
|
|
114
|
+
return require_v3_engine.normalizeStringListOption(entries);
|
|
113
115
|
}
|
|
114
116
|
function hasConfiguredCssEntries(ctx) {
|
|
115
117
|
if (normalizeCssEntriesConfig(ctx.cssEntries)) return true;
|
|
@@ -136,7 +138,11 @@ function applyV4CssCalcDefaults(cssCalc, patcher) {
|
|
|
136
138
|
//#endregion
|
|
137
139
|
//#region src/tailwindcss/v4/multi-patcher.ts
|
|
138
140
|
function createMultiTailwindcssPatcher(patchers) {
|
|
139
|
-
if (patchers.length <= 1)
|
|
141
|
+
if (patchers.length <= 1) {
|
|
142
|
+
const [patcher] = patchers;
|
|
143
|
+
if (!patcher) throw new Error("createMultiTailwindcssPatcher requires at least one patcher.");
|
|
144
|
+
return patcher;
|
|
145
|
+
}
|
|
140
146
|
const first = patchers[0];
|
|
141
147
|
const firstWithoutPatch = { ...first };
|
|
142
148
|
delete firstWithoutPatch.patch;
|
|
@@ -167,11 +173,11 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
167
173
|
}
|
|
168
174
|
if (result.classSet) for (const className of result.classSet) aggregatedSet.add(className);
|
|
169
175
|
}
|
|
170
|
-
return {
|
|
176
|
+
return require_v3_engine.omitUndefined({
|
|
171
177
|
classList: aggregatedList,
|
|
172
178
|
classSet: aggregatedSet,
|
|
173
179
|
filename
|
|
174
|
-
};
|
|
180
|
+
});
|
|
175
181
|
}
|
|
176
182
|
};
|
|
177
183
|
if (patchers.every((patcher) => typeof patcher.getClassSetSync === "function")) multiPatcher.getClassSetSync = () => {
|
|
@@ -183,7 +189,7 @@ function createMultiTailwindcssPatcher(patchers) {
|
|
|
183
189
|
}
|
|
184
190
|
return aggregated;
|
|
185
191
|
};
|
|
186
|
-
Object.defineProperty(multiPatcher,
|
|
192
|
+
Object.defineProperty(multiPatcher, require_v3_engine.runtimeSignaturePatchersSymbol, {
|
|
187
193
|
value: [...patchers],
|
|
188
194
|
configurable: true
|
|
189
195
|
});
|
|
@@ -217,7 +223,7 @@ function guessBasedirFromEntries(entries) {
|
|
|
217
223
|
const trimmed = entry.trim();
|
|
218
224
|
if (!trimmed || !node_path.default.isAbsolute(trimmed)) continue;
|
|
219
225
|
const entryDir = node_path.default.dirname(trimmed);
|
|
220
|
-
const resolved =
|
|
226
|
+
const resolved = require_v3_engine.findNearestPackageRoot(entryDir) ?? entryDir;
|
|
221
227
|
if (resolved) return resolved;
|
|
222
228
|
}
|
|
223
229
|
}
|
|
@@ -243,7 +249,7 @@ function resolveCssEntryBase(entryDir, options) {
|
|
|
243
249
|
const { preferredBaseDir, workspaceRoot } = options;
|
|
244
250
|
if (preferredBaseDir && isSubPath(preferredBaseDir, normalizedDir)) return preferredBaseDir;
|
|
245
251
|
if (workspaceRoot && isSubPath(workspaceRoot, normalizedDir)) return workspaceRoot;
|
|
246
|
-
const packageRoot =
|
|
252
|
+
const packageRoot = require_v3_engine.findNearestPackageRoot(normalizedDir);
|
|
247
253
|
if (packageRoot) return node_path.default.normalize(packageRoot);
|
|
248
254
|
return normalizedDir;
|
|
249
255
|
}
|
|
@@ -282,15 +288,18 @@ function isTailwindVersionMismatchError(error) {
|
|
|
282
288
|
function createPatcherForBase(baseDir, cssEntries, options) {
|
|
283
289
|
const { tailwindcss, tailwindcssPatcherOptions, supportCustomLengthUnitsPatch, bareArbitraryValues } = options;
|
|
284
290
|
const hasCssEntries = Boolean(cssEntries?.length);
|
|
285
|
-
const
|
|
291
|
+
const configuredV4Options = tailwindcss?.v4 ?? tailwindcssPatcherOptions?.tailwindcss?.v4;
|
|
292
|
+
const hasCssSources = Boolean(configuredV4Options?.cssSources?.length);
|
|
293
|
+
const defaultTailwindcssConfig = {
|
|
286
294
|
cwd: baseDir,
|
|
287
295
|
v2: { cwd: baseDir },
|
|
288
296
|
v3: { cwd: baseDir },
|
|
289
|
-
v4: hasCssEntries ? { cssEntries } : {
|
|
297
|
+
v4: hasCssEntries ? require_v3_engine.omitUndefined({ cssEntries }) : require_v3_engine.omitUndefined({
|
|
290
298
|
base: baseDir,
|
|
291
299
|
cssEntries
|
|
292
|
-
}
|
|
293
|
-
}
|
|
300
|
+
})
|
|
301
|
+
};
|
|
302
|
+
const mergedTailwindOptions = (0, _weapp_tailwindcss_shared.defuOverrideArray)(tailwindcss ?? {}, defaultTailwindcssConfig);
|
|
294
303
|
if (!mergedTailwindOptions.v4) mergedTailwindOptions.v4 = hasCssEntries ? { cssEntries: cssEntries ?? [] } : {
|
|
295
304
|
base: baseDir,
|
|
296
305
|
cssEntries: cssEntries ?? []
|
|
@@ -306,11 +315,12 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
306
315
|
const patchedOptions = overrideTailwindcssPatcherOptionsForBase(tailwindcssPatcherOptions, baseDir, cssEntries ?? []);
|
|
307
316
|
const configuredPackageName = tailwindcss?.packageName || tailwindcssPatcherOptions?.tailwindcss?.packageName;
|
|
308
317
|
const explicitTailwindVersion = resolveExplicitTailwindVersion(tailwindcss?.version || tailwindcssPatcherOptions?.tailwindcss?.version || mergedTailwindOptions.version, configuredPackageName);
|
|
309
|
-
const hasExplicitV4Signals = hasCssEntries || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
|
|
318
|
+
const hasExplicitV4Signals = hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss);
|
|
310
319
|
const packageNameForVersionDetection = configuredPackageName ?? mergedTailwindOptions.packageName ?? "tailwindcss";
|
|
311
|
-
const installedTailwindVersion =
|
|
320
|
+
const installedTailwindVersion = require_v3_engine.readInstalledPackageMajorVersion(packageNameForVersionDetection, baseDir);
|
|
312
321
|
const resolvedTailwindVersion = installedTailwindVersion ?? explicitTailwindVersion;
|
|
313
|
-
const
|
|
322
|
+
const supportedResolvedTailwindVersion = resolvedTailwindVersion === 2 || resolvedTailwindVersion === 3 || resolvedTailwindVersion === 4 ? resolvedTailwindVersion : void 0;
|
|
323
|
+
const shouldPatchV4PostcssPackage = (resolvedTailwindVersion === 4 && (installedTailwindVersion === 4 || explicitTailwindVersion === 4 || hasExplicitV4Signals && isTailwindcss4Package(packageNameForVersionDetection)) || resolvedTailwindVersion === void 0 && (hasCssEntries || hasCssSources || hasOwnV4Signal(tailwindcss) || hasOwnV4Signal(tailwindcssPatcherOptions?.tailwindcss))) && !Boolean(configuredPackageName);
|
|
314
324
|
const packageCandidates = /* @__PURE__ */ new Set();
|
|
315
325
|
if (shouldPatchV4PostcssPackage) packageCandidates.add("@tailwindcss/postcss");
|
|
316
326
|
packageCandidates.add(mergedTailwindOptions.packageName ?? configuredPackageName ?? "tailwindcss");
|
|
@@ -322,14 +332,14 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
322
332
|
...mergedTailwindOptions,
|
|
323
333
|
packageName
|
|
324
334
|
};
|
|
325
|
-
if (
|
|
335
|
+
if (supportedResolvedTailwindVersion) tailwindOptionsForPackage.version = supportedResolvedTailwindVersion;
|
|
326
336
|
try {
|
|
327
|
-
patchers.push(
|
|
337
|
+
patchers.push(require_v3_engine.createTailwindcssPatcher(require_v3_engine.omitUndefined({
|
|
328
338
|
basedir: baseDir,
|
|
329
339
|
supportCustomLengthUnitsPatch: supportCustomLengthUnitsPatch ?? true,
|
|
330
340
|
tailwindcss: tailwindOptionsForPackage,
|
|
331
341
|
tailwindcssPatcherOptions: patchedOptions
|
|
332
|
-
}));
|
|
342
|
+
})));
|
|
333
343
|
} catch (error) {
|
|
334
344
|
if (packageCandidateList.length > 1 && isTailwindVersionMismatchError(error)) {
|
|
335
345
|
firstVersionMismatchError ?? (firstVersionMismatchError = error);
|
|
@@ -340,35 +350,37 @@ function createPatcherForBase(baseDir, cssEntries, options) {
|
|
|
340
350
|
}
|
|
341
351
|
}
|
|
342
352
|
if (patchers.length === 0 && firstVersionMismatchError) throw firstVersionMismatchError;
|
|
343
|
-
|
|
353
|
+
const [singlePatcher] = patchers;
|
|
354
|
+
return patchers.length === 1 && singlePatcher ? singlePatcher : createMultiTailwindcssPatcher(patchers);
|
|
344
355
|
}
|
|
345
356
|
function tryCreateMultiTailwindcssPatcher(groups, options) {
|
|
346
357
|
if (groups.size <= 1) return;
|
|
347
358
|
_weapp_tailwindcss_logger.logger.debug("detected multiple Tailwind CSS entry bases: %O", [...groups.keys()]);
|
|
348
359
|
const patchers = [];
|
|
349
|
-
for (const [baseDir, entries] of groups)
|
|
360
|
+
for (const [baseDir, entries] of groups) {
|
|
361
|
+
const patcher = createPatcherForBase(baseDir, entries, options);
|
|
362
|
+
if (patcher) patchers.push(patcher);
|
|
363
|
+
}
|
|
350
364
|
return createMultiTailwindcssPatcher(patchers);
|
|
351
365
|
}
|
|
352
366
|
//#endregion
|
|
353
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
|
+
}
|
|
354
379
|
function resolveComponentLocalStyles(option) {
|
|
355
|
-
if (option
|
|
356
|
-
enabled: false,
|
|
357
|
-
onlyWhenStyleIsolationVersion2: true
|
|
358
|
-
};
|
|
359
|
-
if (option === true || option === void 0) return {
|
|
360
|
-
enabled: false,
|
|
361
|
-
onlyWhenStyleIsolationVersion2: true
|
|
362
|
-
};
|
|
380
|
+
if (isBooleanUniAppXShortcut(option)) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
363
381
|
const componentLocalStyles = option.componentLocalStyles;
|
|
364
|
-
if (componentLocalStyles === false) return
|
|
365
|
-
|
|
366
|
-
onlyWhenStyleIsolationVersion2: true
|
|
367
|
-
};
|
|
368
|
-
if (componentLocalStyles === true || componentLocalStyles === void 0) return {
|
|
369
|
-
enabled: true,
|
|
370
|
-
onlyWhenStyleIsolationVersion2: true
|
|
371
|
-
};
|
|
382
|
+
if (componentLocalStyles === false) return DISABLED_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
383
|
+
if (componentLocalStyles === true || componentLocalStyles === void 0) return DEFAULT_COMPONENT_LOCAL_STYLES_OPTIONS;
|
|
372
384
|
return {
|
|
373
385
|
enabled: componentLocalStyles.enabled !== false,
|
|
374
386
|
onlyWhenStyleIsolationVersion2: componentLocalStyles.onlyWhenStyleIsolationVersion2 !== false
|
|
@@ -414,12 +426,12 @@ function pickEnvBasedir() {
|
|
|
414
426
|
}
|
|
415
427
|
}
|
|
416
428
|
function pickPackageEnvBasedir() {
|
|
417
|
-
const packageJsonPath = node_process.default.env
|
|
429
|
+
const packageJsonPath = node_process.default.env["npm_package_json"];
|
|
418
430
|
if (packageJsonPath) {
|
|
419
431
|
const packageDir = node_path.default.dirname(packageJsonPath);
|
|
420
432
|
if (packageDir && node_path.default.isAbsolute(packageDir)) return packageDir;
|
|
421
433
|
}
|
|
422
|
-
const localPrefix = node_process.default.env
|
|
434
|
+
const localPrefix = node_process.default.env["npm_config_local_prefix"];
|
|
423
435
|
if (localPrefix && node_path.default.isAbsolute(localPrefix)) return localPrefix;
|
|
424
436
|
}
|
|
425
437
|
const STACK_PAREN_RE = /\(([^)]+)\)/u;
|
|
@@ -427,7 +439,7 @@ const STACK_AT_RE = /at\s+(\S.*)$/u;
|
|
|
427
439
|
function detectCallerBasedir() {
|
|
428
440
|
const stack = (/* @__PURE__ */ new Error("resolveTailwindcssBasedir stack probe")).stack;
|
|
429
441
|
if (!stack) return;
|
|
430
|
-
if (node_process.default.env
|
|
442
|
+
if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("caller stack: %s", stack);
|
|
431
443
|
const lines = stack.split("\n");
|
|
432
444
|
for (const line of lines) {
|
|
433
445
|
const location = (line.match(STACK_PAREN_RE) ?? line.match(STACK_AT_RE))?.[1];
|
|
@@ -438,7 +450,7 @@ function detectCallerBasedir() {
|
|
|
438
450
|
} catch {
|
|
439
451
|
continue;
|
|
440
452
|
}
|
|
441
|
-
const [candidate] = filePath.split(":");
|
|
453
|
+
const [candidate = ""] = filePath.split(":");
|
|
442
454
|
const resolvedPath = node_path.default.isAbsolute(filePath) ? filePath : candidate;
|
|
443
455
|
if (!node_path.default.isAbsolute(resolvedPath)) continue;
|
|
444
456
|
if (resolvedPath.includes("node_modules") && resolvedPath.includes("weapp-tailwindcss")) continue;
|
|
@@ -459,7 +471,7 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
459
471
|
const cwd = node_process.default.cwd();
|
|
460
472
|
const anchor = envBasedir ?? packageEnvBasedir ?? fallback ?? callerBasedir ?? cwd;
|
|
461
473
|
const resolveRelative = (value) => node_path.default.isAbsolute(value) ? node_path.default.normalize(value) : node_path.default.normalize(node_path.default.resolve(anchor, value));
|
|
462
|
-
if (node_process.default.env
|
|
474
|
+
if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("resolveTailwindcssBasedir anchor %O", {
|
|
463
475
|
basedir,
|
|
464
476
|
envBasedir,
|
|
465
477
|
envBasedirKey,
|
|
@@ -467,7 +479,7 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
467
479
|
packageEnvBasedir,
|
|
468
480
|
fallback,
|
|
469
481
|
callerBasedir,
|
|
470
|
-
npm_package_json: node_process.default.env
|
|
482
|
+
npm_package_json: node_process.default.env["npm_package_json"],
|
|
471
483
|
cwd,
|
|
472
484
|
anchor
|
|
473
485
|
});
|
|
@@ -480,16 +492,16 @@ function resolveTailwindcssBasedir(basedir, fallback) {
|
|
|
480
492
|
const librarySegment = `${node_path.default.sep}weapp-tailwindcss${node_path.default.sep}`;
|
|
481
493
|
if (!normalizedCaller.includes(librarySegment)) return normalizedCaller;
|
|
482
494
|
}
|
|
483
|
-
const packageName = node_process.default.env
|
|
495
|
+
const packageName = node_process.default.env["PNPM_PACKAGE_NAME"];
|
|
484
496
|
if (packageName) try {
|
|
485
497
|
const packageJsonPath = (0, node_module.createRequire)(node_path.default.join(anchor, "__resolve_tailwindcss_basedir__.cjs")).resolve(`${packageName}/package.json`);
|
|
486
|
-
if (node_process.default.env
|
|
498
|
+
if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("package basedir resolved from PNPM_PACKAGE_NAME: %s", packageJsonPath);
|
|
487
499
|
return node_path.default.normalize(node_path.default.dirname(packageJsonPath));
|
|
488
500
|
} catch {
|
|
489
|
-
if (node_process.default.env
|
|
490
|
-
const workspaceRoot =
|
|
501
|
+
if (node_process.default.env["WEAPP_TW_DEBUG_STACK"] === "1") _weapp_tailwindcss_logger.logger.debug("failed to resolve package json for %s", packageName);
|
|
502
|
+
const workspaceRoot = require_v3_engine.findWorkspaceRoot(anchor);
|
|
491
503
|
if (workspaceRoot) {
|
|
492
|
-
const packageDir =
|
|
504
|
+
const packageDir = require_v3_engine.findWorkspacePackageDir(workspaceRoot, packageName);
|
|
493
505
|
if (packageDir) return packageDir;
|
|
494
506
|
}
|
|
495
507
|
}
|
|
@@ -505,8 +517,8 @@ function isRaxWorkspace(appType, baseDir) {
|
|
|
505
517
|
if (!(0, node_fs.existsSync)(pkgPath)) return false;
|
|
506
518
|
const pkg = JSON.parse((0, node_fs.readFileSync)(pkgPath, "utf8"));
|
|
507
519
|
const deps = {
|
|
508
|
-
...pkg
|
|
509
|
-
...pkg
|
|
520
|
+
...pkg["dependencies"] ?? {},
|
|
521
|
+
...pkg["devDependencies"] ?? {}
|
|
510
522
|
};
|
|
511
523
|
if (deps["rax-app"] || deps.rax) return true;
|
|
512
524
|
} catch {
|
|
@@ -535,8 +547,8 @@ function detectImplicitCssEntries(appType, baseDir) {
|
|
|
535
547
|
baseCandidates.add(node_path.default.normalize(baseDir));
|
|
536
548
|
const envCandidates = [
|
|
537
549
|
node_process.default.cwd(),
|
|
538
|
-
node_process.default.env
|
|
539
|
-
node_process.default.env
|
|
550
|
+
node_process.default.env["INIT_CWD"],
|
|
551
|
+
node_process.default.env["PWD"]
|
|
540
552
|
];
|
|
541
553
|
for (const candidate of envCandidates) if (candidate) baseCandidates.add(node_path.default.normalize(candidate));
|
|
542
554
|
for (const candidateBase of baseCandidates) {
|
|
@@ -563,11 +575,11 @@ function createTailwindcssPatcherFromContext(ctx) {
|
|
|
563
575
|
appType,
|
|
564
576
|
bareArbitraryValues: arbitraryValues?.bareArbitraryValues
|
|
565
577
|
};
|
|
566
|
-
const workspaceRoot =
|
|
567
|
-
const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, {
|
|
578
|
+
const workspaceRoot = require_v3_engine.findWorkspaceRoot(resolvedTailwindcssBasedir) ?? (absoluteCssEntryBasedir ? require_v3_engine.findWorkspaceRoot(absoluteCssEntryBasedir) : void 0);
|
|
579
|
+
const groupedCssEntries = normalizedCssEntries ? groupCssEntriesByBase(normalizedCssEntries, require_v3_engine.omitUndefined({
|
|
568
580
|
preferredBaseDir: resolvedTailwindcssBasedir,
|
|
569
581
|
workspaceRoot
|
|
570
|
-
}) : void 0;
|
|
582
|
+
})) : void 0;
|
|
571
583
|
const multiPatcher = groupedCssEntries ? tryCreateMultiTailwindcssPatcher(groupedCssEntries, patcherOptions) : void 0;
|
|
572
584
|
if (multiPatcher) return multiPatcher;
|
|
573
585
|
if (groupedCssEntries?.size === 1) {
|
package/dist/typedoc.export.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export type { WeappTailwindcssGenerateOptions, WeappTailwindcssGenerateResult, WeappTailwindcssGenerator, WeappTailwindcssGeneratorTarget, WeappTailwindcssPostcssPluginOptions, } from './index';
|
|
2
|
+
export type { ApplyOptions, CacheOptions, ExtractOptions, TailwindCssOptions, TailwindCssPatchOptions, TailwindV2Options, TailwindV3Options, TailwindV4Options, } from './types/typedoc-tailwindcss-patch';
|
|
2
3
|
export type { UserDefinedOptions } from './types/user-defined-options';
|
|
3
|
-
export type { ApplyOptions, CacheOptions, ExtractOptions, TailwindCssOptions, TailwindCssPatchOptions, TailwindV2Options, TailwindV3Options, TailwindV4Options, } from 'tailwindcss-patch';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,7 +10,11 @@ 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
|
+
export type RequiredDefined<T> = {
|
|
15
|
+
[K in keyof T]-?: Exclude<T[K], undefined>;
|
|
16
|
+
};
|
|
17
|
+
type InternalUserDefinedOptionsBase = RequiredDefined<Omit<UserDefinedOptions, 'supportCustomLengthUnitsPatch' | 'customReplaceDictionary' | 'cache' | 'twPatcher' | 'refreshTailwindcssPatcher' | 'templateHandler' | 'styleHandler' | 'jsHandler'>>;
|
|
14
18
|
export interface LinkedJsModuleResult {
|
|
15
19
|
code: string;
|
|
16
20
|
}
|
|
@@ -22,56 +26,62 @@ export interface JsHandlerResult {
|
|
|
22
26
|
}
|
|
23
27
|
export interface TailwindcssPatcherLike {
|
|
24
28
|
packageInfo: TailwindcssPatcher['packageInfo'];
|
|
25
|
-
majorVersion?: TailwindcssPatcher['majorVersion'];
|
|
26
|
-
patch?: TailwindcssPatcher['patch'];
|
|
29
|
+
majorVersion?: TailwindcssPatcher['majorVersion'] | undefined;
|
|
30
|
+
patch?: TailwindcssPatcher['patch'] | undefined;
|
|
27
31
|
getClassSet: AsyncableMethod<TailwindcssPatcher['getClassSet']>;
|
|
28
|
-
getClassSetSync?: TailwindcssPatcher['getClassSetSync'];
|
|
32
|
+
getClassSetSync?: TailwindcssPatcher['getClassSetSync'] | undefined;
|
|
29
33
|
extract: TailwindcssPatcher['extract'];
|
|
30
|
-
collectContentTokens?: TailwindcssPatcher['collectContentTokens'];
|
|
31
|
-
options?: TailwindcssPatcher['options'];
|
|
34
|
+
collectContentTokens?: TailwindcssPatcher['collectContentTokens'] | undefined;
|
|
35
|
+
options?: TailwindcssPatcher['options'] | undefined;
|
|
32
36
|
}
|
|
37
|
+
export type BabelParserOptions = ParserOptions & {
|
|
38
|
+
cache?: boolean | undefined;
|
|
39
|
+
cacheKey?: string | undefined;
|
|
40
|
+
cacheMaxEntries?: number | undefined;
|
|
41
|
+
cacheMaxSourceLength?: number | undefined;
|
|
42
|
+
};
|
|
33
43
|
export interface RefreshTailwindcssPatcherOptions {
|
|
34
|
-
clearCache?: boolean;
|
|
44
|
+
clearCache?: boolean | undefined;
|
|
35
45
|
}
|
|
36
46
|
export interface IJsHandlerOptions {
|
|
37
|
-
escapeMap?: Record<string, string
|
|
38
|
-
classNameSet?: Set<string
|
|
39
|
-
jsArbitraryValueFallback?: boolean | 'auto';
|
|
40
|
-
tailwindcssMajorVersion?: number;
|
|
41
|
-
arbitraryValues?: IArbitraryValues;
|
|
42
|
-
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
43
|
-
needEscaped?: boolean;
|
|
44
|
-
generateMap?: boolean;
|
|
45
|
-
alwaysEscape?: boolean;
|
|
46
|
-
unescapeUnicode?: boolean;
|
|
47
|
-
babelParserOptions?:
|
|
48
|
-
ignoreTaggedTemplateExpressionIdentifiers?: (string | RegExp)[];
|
|
49
|
-
ignoreCallExpressionIdentifiers?: (string | RegExp)[];
|
|
50
|
-
uniAppX?: boolean;
|
|
51
|
-
moduleSpecifierReplacements?: Record<string, string
|
|
52
|
-
wrapExpression?: boolean;
|
|
53
|
-
filename?: string;
|
|
54
|
-
moduleGraph?: JsModuleGraphOptions;
|
|
47
|
+
escapeMap?: Record<string, string> | undefined;
|
|
48
|
+
classNameSet?: Set<string> | undefined;
|
|
49
|
+
jsArbitraryValueFallback?: boolean | 'auto' | undefined;
|
|
50
|
+
tailwindcssMajorVersion?: number | undefined;
|
|
51
|
+
arbitraryValues?: IArbitraryValues | undefined;
|
|
52
|
+
jsPreserveClass?: ((keyword: string) => boolean | undefined) | undefined;
|
|
53
|
+
needEscaped?: boolean | undefined;
|
|
54
|
+
generateMap?: boolean | undefined;
|
|
55
|
+
alwaysEscape?: boolean | undefined;
|
|
56
|
+
unescapeUnicode?: boolean | undefined;
|
|
57
|
+
babelParserOptions?: BabelParserOptions | undefined;
|
|
58
|
+
ignoreTaggedTemplateExpressionIdentifiers?: (string | RegExp)[] | undefined;
|
|
59
|
+
ignoreCallExpressionIdentifiers?: (string | RegExp)[] | undefined;
|
|
60
|
+
uniAppX?: boolean | undefined;
|
|
61
|
+
moduleSpecifierReplacements?: Record<string, string> | undefined;
|
|
62
|
+
wrapExpression?: boolean | undefined;
|
|
63
|
+
filename?: string | undefined;
|
|
64
|
+
moduleGraph?: JsModuleGraphOptions | undefined;
|
|
55
65
|
}
|
|
56
66
|
export interface JsHandler {
|
|
57
67
|
(rawSource: string, set?: Set<string>, options?: CreateJsHandlerOptions): JsHandlerResult;
|
|
58
68
|
}
|
|
59
69
|
export interface ICommonReplaceOptions {
|
|
60
|
-
keepEOL?: boolean;
|
|
61
|
-
escapeMap?: Record<string, string
|
|
70
|
+
keepEOL?: boolean | undefined;
|
|
71
|
+
escapeMap?: Record<string, string> | undefined;
|
|
62
72
|
}
|
|
63
73
|
export interface ITemplateHandlerOptions extends ICommonReplaceOptions {
|
|
64
|
-
customAttributesEntities?: ICustomAttributesEntities;
|
|
65
|
-
escapeMap?: Record<string, string
|
|
66
|
-
inlineWxs?: boolean;
|
|
67
|
-
jsHandler?: JsHandler;
|
|
68
|
-
runtimeSet?: Set<string
|
|
69
|
-
disabledDefaultTemplateHandler?: boolean;
|
|
70
|
-
quote?: string | null;
|
|
71
|
-
ignoreHead?: boolean;
|
|
72
|
-
wrapExpression?: boolean;
|
|
74
|
+
customAttributesEntities?: ICustomAttributesEntities | undefined;
|
|
75
|
+
escapeMap?: Record<string, string> | undefined;
|
|
76
|
+
inlineWxs?: boolean | undefined;
|
|
77
|
+
jsHandler?: JsHandler | undefined;
|
|
78
|
+
runtimeSet?: Set<string> | undefined;
|
|
79
|
+
disabledDefaultTemplateHandler?: boolean | undefined;
|
|
80
|
+
quote?: string | null | undefined;
|
|
81
|
+
ignoreHead?: boolean | undefined;
|
|
82
|
+
wrapExpression?: boolean | undefined;
|
|
73
83
|
}
|
|
74
|
-
export
|
|
84
|
+
export interface InternalUserDefinedOptions extends InternalUserDefinedOptionsBase {
|
|
75
85
|
supportCustomLengthUnitsPatch: ILengthUnitsPatchOptions | boolean;
|
|
76
86
|
templateHandler: (rawSource: string, options?: ITemplateHandlerOptions) => Promise<string>;
|
|
77
87
|
styleHandler: (rawSource: string, options?: IStyleHandlerOptions) => Promise<PostcssResult<Root | Document>>;
|
|
@@ -81,17 +91,17 @@ export type InternalUserDefinedOptions = Required<Omit<UserDefinedOptions, 'supp
|
|
|
81
91
|
cache: ICreateCacheReturnType;
|
|
82
92
|
twPatcher: TailwindcssPatcherLike;
|
|
83
93
|
refreshTailwindcssPatcher: (options?: RefreshTailwindcssPatcherOptions) => Promise<TailwindcssPatcherLike>;
|
|
84
|
-
}
|
|
94
|
+
}
|
|
85
95
|
export type InternalPostcssOptions = Pick<UserDefinedOptions, 'cssMatcher' | 'mainCssChunkMatcher' | 'cssPreflight' | 'cssPreflightRange' | 'disabled'>;
|
|
86
96
|
export interface IBaseWebpackPlugin {
|
|
87
97
|
options: InternalUserDefinedOptions;
|
|
88
|
-
appType?: AppType;
|
|
98
|
+
appType?: AppType | undefined;
|
|
89
99
|
apply: (compiler: any) => void;
|
|
90
100
|
}
|
|
91
101
|
export type CreateJsHandlerOptions = Omit<IJsHandlerOptions, 'classNameSet'>;
|
|
92
102
|
export interface JsModuleGraphOptions {
|
|
93
103
|
resolve: (specifier: string, importer: string) => string | undefined;
|
|
94
104
|
load: (id: string) => string | undefined;
|
|
95
|
-
filter?: (id: string, specifier: string, importer: string) => boolean;
|
|
96
|
-
maxDepth?: number;
|
|
105
|
+
filter?: ((id: string, specifier: string, importer: string) => boolean) | undefined;
|
|
106
|
+
maxDepth?: number | undefined;
|
|
97
107
|
}
|
package/dist/types/shared.d.ts
CHANGED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { SourceEntry } from '@tailwindcss/oxide';
|
|
2
|
+
import type { PackageResolvingOptions } from 'local-pkg';
|
|
3
|
+
import type { ILengthUnitsPatchOptions } from 'tailwindcss-patch';
|
|
4
|
+
import type { TailwindV4CssSource } from '../tailwindcss/v4-engine';
|
|
5
|
+
export type CacheStrategy = 'merge' | 'overwrite';
|
|
6
|
+
export type CacheDriver = 'file' | 'memory' | 'noop';
|
|
7
|
+
export interface CacheOptions {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
cwd?: string;
|
|
10
|
+
dir?: string;
|
|
11
|
+
file?: string;
|
|
12
|
+
strategy?: CacheStrategy;
|
|
13
|
+
driver?: CacheDriver;
|
|
14
|
+
}
|
|
15
|
+
export interface ExtractOptions {
|
|
16
|
+
write?: boolean;
|
|
17
|
+
file?: string;
|
|
18
|
+
format?: 'json' | 'lines';
|
|
19
|
+
pretty?: number | boolean;
|
|
20
|
+
removeUniversalSelector?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface ExposeContextOptions {
|
|
23
|
+
refProperty?: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ExtendLengthUnitsOptions extends Partial<ILengthUnitsPatchOptions> {
|
|
26
|
+
enabled?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export interface ApplyOptions {
|
|
29
|
+
overwrite?: boolean;
|
|
30
|
+
exposeContext?: boolean | ExposeContextOptions;
|
|
31
|
+
extendLengthUnits?: false | ExtendLengthUnitsOptions;
|
|
32
|
+
}
|
|
33
|
+
export interface TailwindRuntimeOptionsBase {
|
|
34
|
+
config?: string;
|
|
35
|
+
cwd?: string;
|
|
36
|
+
postcssPlugin?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface TailwindV2Options extends TailwindRuntimeOptionsBase {
|
|
39
|
+
}
|
|
40
|
+
export interface TailwindV3Options extends TailwindRuntimeOptionsBase {
|
|
41
|
+
}
|
|
42
|
+
export interface TailwindV4Options {
|
|
43
|
+
base?: string;
|
|
44
|
+
css?: string;
|
|
45
|
+
cssSources?: TailwindV4CssSource[];
|
|
46
|
+
cssEntries?: string[];
|
|
47
|
+
sources?: SourceEntry[];
|
|
48
|
+
bareArbitraryValues?: boolean | {
|
|
49
|
+
units?: string[];
|
|
50
|
+
} | undefined;
|
|
51
|
+
}
|
|
52
|
+
export interface TailwindCssOptions extends TailwindRuntimeOptionsBase {
|
|
53
|
+
version?: 2 | 3 | 4;
|
|
54
|
+
packageName?: string;
|
|
55
|
+
resolve?: PackageResolvingOptions;
|
|
56
|
+
v2?: TailwindV2Options;
|
|
57
|
+
v3?: TailwindV3Options;
|
|
58
|
+
v4?: TailwindV4Options;
|
|
59
|
+
}
|
|
60
|
+
export interface TailwindCssPatchOptions {
|
|
61
|
+
projectRoot?: string;
|
|
62
|
+
tailwindcss?: TailwindCssOptions;
|
|
63
|
+
apply?: ApplyOptions;
|
|
64
|
+
extract?: ExtractOptions;
|
|
65
|
+
filter?: (className: string) => boolean;
|
|
66
|
+
cache?: boolean | CacheOptions;
|
|
67
|
+
}
|
|
@@ -3,27 +3,30 @@ 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
|
-
supportCustomLengthUnitsPatch?: ILengthUnitsPatchOptions | boolean;
|
|
9
|
-
appType?: AppType;
|
|
10
|
-
arbitraryValues?: IArbitraryValues;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
8
|
+
supportCustomLengthUnitsPatch?: ILengthUnitsPatchOptions | boolean | undefined;
|
|
9
|
+
appType?: AppType | undefined;
|
|
10
|
+
arbitraryValues?: IArbitraryValues | undefined;
|
|
11
|
+
unocss?: boolean | IUnocssCompatibilityOptions | undefined;
|
|
12
|
+
jsPreserveClass?: ((keyword: string) => boolean | undefined) | undefined;
|
|
13
|
+
jsArbitraryValueFallback?: boolean | 'auto' | undefined;
|
|
14
|
+
replaceRuntimePackages?: boolean | Record<string, string> | undefined;
|
|
15
|
+
generator?: WeappTailwindcssGeneratorUserOptions | undefined;
|
|
16
|
+
disabledDefaultTemplateHandler?: boolean | undefined;
|
|
17
|
+
runtimeLoaderPath?: string | undefined;
|
|
18
|
+
tailwindcssBasedir?: string | undefined;
|
|
19
|
+
cache?: boolean | ICreateCacheReturnType | undefined;
|
|
20
|
+
babelParserOptions?: (ParserOptions & {
|
|
21
|
+
cache?: boolean | undefined;
|
|
22
|
+
cacheKey?: string | undefined;
|
|
23
|
+
cacheMaxEntries?: number | undefined;
|
|
24
|
+
cacheMaxSourceLength?: number | undefined;
|
|
25
|
+
}) | undefined;
|
|
26
|
+
cssChildCombinatorReplaceValue?: string | string[] | undefined;
|
|
27
|
+
postcssOptions?: LoadedPostcssOptions | undefined;
|
|
28
|
+
cssRemoveHoverPseudoClass?: boolean | undefined;
|
|
29
|
+
cssRemoveProperty?: boolean | undefined;
|
|
30
|
+
tailwindcssPatcherOptions?: TailwindCssPatchOptions | undefined;
|
|
31
|
+
logLevel?: 'info' | 'warn' | 'error' | 'silent' | undefined;
|
|
29
32
|
}
|