weapp-tailwindcss 5.1.2 → 5.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/bundlers/gulp/index.d.ts +3 -3
- package/dist/bundlers/rspack/index.d.ts +20 -0
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +1 -1
- package/dist/bundlers/vite/css-memory.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/source-candidate-scope.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/temporary-css-assets.d.ts +12 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
- package/dist/bundlers/vite/serve-js-transform.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +4 -1
- package/dist/cli.js +8 -8
- package/dist/cli.mjs +8 -8
- package/dist/{context-C-r8ki7x.mjs → context-B07Vf584.mjs} +34 -34
- package/dist/{context-CH4HFZP2.js → context-D75pwtBW.js} +43 -43
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +2 -2
- package/dist/css-macro.js +3 -3
- package/dist/{defaults-CmFBmxsr.js → defaults-DQhgnnn-.js} +1 -1
- package/dist/defaults.js +1 -1
- package/dist/framework/index.d.ts +7 -2
- package/dist/framework.js +39 -8
- package/dist/framework.mjs +33 -6
- package/dist/{generator-B6pUjNdD.js → generator-CV_0irKO.js} +2 -2
- package/dist/{generator-BsPIaLtV.mjs → generator-DNs6ekoC.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-BBCeA7ky.js → gulp-B_u8NjQL.js} +9 -9
- package/dist/{gulp-CTdcASq8.mjs → gulp-aQMZ0M7c.mjs} +4 -4
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BRx-KnBh.mjs → hmr-timing-DLYQTCDb.mjs} +25 -22
- package/dist/{hmr-timing-Da1eI8S0.js → hmr-timing-DOoHun3i.js} +28 -25
- package/dist/index.js +9 -4
- package/dist/index.mjs +7 -6
- package/dist/postcss-html-transform.js +2 -2
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets/shared.d.ts +4 -0
- package/dist/presets.js +32 -16
- package/dist/presets.mjs +28 -14
- package/dist/reset.js +2 -2
- package/dist/rspack.d.ts +3 -0
- package/dist/rspack.js +68 -0
- package/dist/rspack.mjs +62 -0
- package/dist/{source-candidate-scan-signature-BO6JSskQ.js → source-candidate-scan-signature-DzwebZrf.js} +6 -6
- package/dist/{source-candidate-scan-signature-Dugfplms.mjs → source-candidate-scan-signature-pS87mdHZ.mjs} +3 -3
- package/dist/{tailwindcss-dbrbY4cd.js → tailwindcss-BSCvrs1p.js} +8 -8
- package/dist/{tailwindcss-B5mRo0-M.mjs → tailwindcss-BwV3_Ryc.mjs} +3 -3
- package/dist/{transform-DeqFRp1D.mjs → transform-Clj7R818.mjs} +19 -19
- package/dist/{transform-BLleu_bA.js → transform-fin-OTVD.js} +47 -47
- package/dist/{utils-BCa37Wqj.js → utils-D3h8j7Mk.js} +2 -2
- package/dist/{v4-engine-C3qSwQ-e.mjs → v4-engine-BklH3CpJ.mjs} +5 -5
- package/dist/{v4-engine-ON_oSLfO.js → v4-engine-CKbS27-o.js} +10 -10
- package/dist/{vite-CXmUiI9f.mjs → vite-5Wn0PIzJ.mjs} +237 -42
- package/dist/{vite-Da4uEG_u.js → vite-CkVMSDDp.js} +242 -47
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +55 -26
- package/dist/weapp-tw-runtime-classset-loader.js +2 -2
- package/dist/{webpack-CrFZmdo7.mjs → webpack-DEag6ueE.mjs} +66 -18
- package/dist/{webpack-Cwqnznng.js → webpack-hvSFaicc.js} +71 -23
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +8 -3
- /package/dist/{chunk-emK7D4bc.js → rolldown-runtime-emK7D4bc.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { A as resolveCssEntrySource, B as stripTailwindBanner, C as hasTailwindRootDirectives, E as normalizeTailwindSourceDirectives, F as hasTailwindGeneratedCssMarkers, H as normalizeConfigDirective, I as splitGeneratorPlaceholderCssBySourceOrder, J as FULL_SOURCE_SCAN_EXTENSION_RE, L as splitTailwindGeneratedCssByBanner, M as VITE_MARKER_RE, N as createCssAppend, O as parseImportRequest, P as hasTailwindGeneratedCss, Q as isFileMatchedByTailwindSourceEntries, R as splitTailwindV4GeneratedCssBySourceOrder, U as prependConfigDirective, V as stripTailwindBanners, i as resolveTailwindV4SourceOptionsFromRuntime, it as toPosixPath$1, j as GENERATOR_PLACEHOLDER_MARKER_RE, k as removeTailwindSourceDirectives, lt as loadTailwindV4DesignSystem, n as resolveTailwindV4SourceFromRuntime, nt as resolveSourceScanPath, ot as filterUnsupportedMiniProgramTailwindV4Candidates, rt as resolveTailwindV4CssSourceBase, st as omitUndefined, t as resolveTailwindV4Source$1, w as hasTailwindSourceDirectives, x as hasTailwindApplyDirective, z as stripGeneratorPlaceholderMarkers } from "./v4-engine-
|
|
2
|
-
import { a as resolveGeneratorRuntimeBranch, i as normalizeWeappTailwindcssGeneratorOptions, s as shouldUseMiniProgramCssBranch, t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { C as md5Hash, S as createDebug, g as traverse, h as babelParse, m as replaceWxml, r as resolveStyleOptionsFromContext } from "./context-
|
|
4
|
-
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled } from "./tailwindcss-
|
|
1
|
+
import { A as resolveCssEntrySource, B as stripTailwindBanner, C as hasTailwindRootDirectives, E as normalizeTailwindSourceDirectives, F as hasTailwindGeneratedCssMarkers, H as normalizeConfigDirective, I as splitGeneratorPlaceholderCssBySourceOrder, J as FULL_SOURCE_SCAN_EXTENSION_RE, L as splitTailwindGeneratedCssByBanner, M as VITE_MARKER_RE, N as createCssAppend, O as parseImportRequest, P as hasTailwindGeneratedCss, Q as isFileMatchedByTailwindSourceEntries, R as splitTailwindV4GeneratedCssBySourceOrder, U as prependConfigDirective, V as stripTailwindBanners, i as resolveTailwindV4SourceOptionsFromRuntime, it as toPosixPath$1, j as GENERATOR_PLACEHOLDER_MARKER_RE, k as removeTailwindSourceDirectives, lt as loadTailwindV4DesignSystem, n as resolveTailwindV4SourceFromRuntime, nt as resolveSourceScanPath, ot as filterUnsupportedMiniProgramTailwindV4Candidates, rt as resolveTailwindV4CssSourceBase, st as omitUndefined, t as resolveTailwindV4Source$1, w as hasTailwindSourceDirectives, x as hasTailwindApplyDirective, z as stripGeneratorPlaceholderMarkers } from "./v4-engine-BklH3CpJ.mjs";
|
|
2
|
+
import { a as resolveGeneratorRuntimeBranch, i as normalizeWeappTailwindcssGeneratorOptions, s as shouldUseMiniProgramCssBranch, t as createWeappTailwindcssGenerator } from "./generator-DNs6ekoC.mjs";
|
|
3
|
+
import { C as md5Hash, S as createDebug, g as traverse, h as babelParse, m as replaceWxml, r as resolveStyleOptionsFromContext } from "./context-B07Vf584.mjs";
|
|
4
|
+
import { h as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled } from "./tailwindcss-BwV3_Ryc.mjs";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import process from "node:process";
|
|
@@ -171,11 +171,11 @@ function shouldInjectMiniProgramPreflightForGeneratorCss(opts, options) {
|
|
|
171
171
|
}
|
|
172
172
|
function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
|
|
173
173
|
if (options.isolateCssSource) {
|
|
174
|
-
if (options.matchedCssSourceFile) return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
175
|
-
return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
174
|
+
if (options.matchedCssSourceFile) return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
175
|
+
return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
176
176
|
}
|
|
177
177
|
if (runtime.size === 0 || !options.cssHandlerOptions.isMainChunk) return scopedRuntime;
|
|
178
|
-
return new Set([...scopedRuntime, ...runtime]);
|
|
178
|
+
return /* @__PURE__ */ new Set([...scopedRuntime, ...runtime]);
|
|
179
179
|
}
|
|
180
180
|
function shouldIsolateScopedCssSource(_majorVersion, source, sourceEntries, options) {
|
|
181
181
|
if (options.target !== "weapp") return false;
|
|
@@ -237,7 +237,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
|
|
|
237
237
|
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives || cssHandlerOptions.isMainChunk && (options.configuredCssSourceCount ?? 0) > 0 || cssHandlerOptions.isMainChunk && options.rawSource.includes("weapp-tailwindcss") || options.target === "web" && cssHandlerOptions.isMainChunk && (options.runtimeCandidateCount ?? 0) > 0;
|
|
238
238
|
}
|
|
239
239
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
240
|
-
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
240
|
+
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? /* @__PURE__ */ new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
241
241
|
}
|
|
242
242
|
function mergeGeneratorResults(generatedResults) {
|
|
243
243
|
const firstGenerated = generatedResults[0];
|
|
@@ -259,7 +259,7 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
259
259
|
//#endregion
|
|
260
260
|
//#region src/bundlers/shared/generator-css/legacy-selectors.ts
|
|
261
261
|
const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
|
|
262
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = new Set([
|
|
262
|
+
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
|
|
263
263
|
":host",
|
|
264
264
|
"page",
|
|
265
265
|
".tw-root",
|
|
@@ -322,7 +322,7 @@ function escapeCompatSelectorClasses(selector) {
|
|
|
322
322
|
function normalizeCompatSelectors(selector) {
|
|
323
323
|
const normalized = normalizeCompatSelector(selector);
|
|
324
324
|
if (!normalized) return [];
|
|
325
|
-
const selectors = new Set([normalized]);
|
|
325
|
+
const selectors = /* @__PURE__ */ new Set([normalized]);
|
|
326
326
|
const escaped = normalizeCompatSelector(escapeCompatSelectorClasses(normalized));
|
|
327
327
|
if (escaped) selectors.add(escaped);
|
|
328
328
|
return [...selectors];
|
|
@@ -673,7 +673,7 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
|
|
|
673
673
|
for (const sourceFile of createSourceStylePathCandidates(file, sourceOptions)) try {
|
|
674
674
|
const source = sourceOptions.sourceFile && path.resolve(sourceOptions.sourceFile) === path.resolve(sourceFile) && typeof sourceOptions.sourceCss === "string" ? sourceOptions.sourceCss : existsSync(sourceFile) ? readFileSync(sourceFile, "utf8") : void 0;
|
|
675
675
|
if (source === void 0) continue;
|
|
676
|
-
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, new Set([path.resolve(sourceFile)]));
|
|
676
|
+
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, /* @__PURE__ */ new Set([path.resolve(sourceFile)]));
|
|
677
677
|
for (const styleSource of directiveSources) {
|
|
678
678
|
const cssEntrySource = resolveCssEntrySource(styleSource.source, path.dirname(styleSource.file), resolveOptions);
|
|
679
679
|
if (cssEntrySource) return {
|
|
@@ -880,7 +880,8 @@ function createSingleTailwindV4SourceOptions(sourceOptions, options) {
|
|
|
880
880
|
baseFallbacks: sourceOptions.baseFallbacks,
|
|
881
881
|
packageName: sourceOptions.packageName,
|
|
882
882
|
base: options.base,
|
|
883
|
-
css: options.css
|
|
883
|
+
css: options.css,
|
|
884
|
+
cssEntries: options.cssEntries
|
|
884
885
|
});
|
|
885
886
|
}
|
|
886
887
|
async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions) {
|
|
@@ -971,7 +972,7 @@ function hydrateTailwindV4CssSource(cssSource) {
|
|
|
971
972
|
file,
|
|
972
973
|
base: cssSource.base ?? path.dirname(file),
|
|
973
974
|
css: readFileSync(file, "utf8"),
|
|
974
|
-
dependencies: [
|
|
975
|
+
dependencies: [.../* @__PURE__ */ new Set([...cssSource.dependencies ?? [], file])]
|
|
975
976
|
};
|
|
976
977
|
}
|
|
977
978
|
function normalizeTailwindV4CssSourceConfigs(sourceOptions) {
|
|
@@ -1087,7 +1088,8 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
|
|
|
1087
1088
|
const css = createTailwindV4SourceReferenceSource(normalizeConfigDirective(prependConfigDirective(resolvedEntrySource.css, generatorOptions?.config), config), resolvedSourceOptions);
|
|
1088
1089
|
return withMatchedSourceSideMetadata(await resolveTailwindV4Source$1(createSingleTailwindV4SourceOptions(resolvedSourceOptions, {
|
|
1089
1090
|
base: resolvedEntrySource.base,
|
|
1090
|
-
css
|
|
1091
|
+
css,
|
|
1092
|
+
cssEntries: [resolvedEntrySource.file]
|
|
1091
1093
|
})), resolvedEntrySource);
|
|
1092
1094
|
}
|
|
1093
1095
|
async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
@@ -1118,6 +1120,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
1118
1120
|
}
|
|
1119
1121
|
const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
|
|
1120
1122
|
const sourceSideEntrySource = normalizedSourceOptions && (shouldPreferSourceSideEntry || normalizedSourceOptions.sourceFile !== void 0) && canResolveSourceSideCssEntry(file, cssHandlerOptions, normalizedSourceOptions) ? resolveSourceSideCssEntrySource(file, normalizedSourceOptions, { removeConfig: false }) : void 0;
|
|
1123
|
+
const sourceSideCssSource = sourceSideEntrySource?.file && normalizedSourceOptions.cssEntries?.some((cssEntry) => path.resolve(cssEntry.replace(/[?#].*$/, "")) === path.resolve(sourceSideEntrySource.file)) ? await resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file) : void 0;
|
|
1124
|
+
if (sourceSideCssSource) return sourceSideCssSource;
|
|
1121
1125
|
const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
|
|
1122
1126
|
const matchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOptions, normalizedSourceOptions) : void 0;
|
|
1123
1127
|
const candidateMatchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveCandidateMatchedTailwindV4CssSource(rawSource, cssHandlerOptions, normalizedSourceOptions, selectionOptions) : void 0;
|
|
@@ -1141,7 +1145,6 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
1141
1145
|
css: prependConfigDirective(source.css, generatorOptions.config)
|
|
1142
1146
|
} : source;
|
|
1143
1147
|
}
|
|
1144
|
-
if (sourceSideEntrySource && normalizedSourceOptions) return resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file);
|
|
1145
1148
|
const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, omitUndefined({
|
|
1146
1149
|
...resolvedSourceOptions ?? {},
|
|
1147
1150
|
sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
|
|
@@ -1241,7 +1244,7 @@ async function resolveGeneratorSourceEntries(source, runtimeState) {
|
|
|
1241
1244
|
}
|
|
1242
1245
|
//#endregion
|
|
1243
1246
|
//#region src/bundlers/shared/generator-css/user-css.ts
|
|
1244
|
-
const TAILWIND_V4_GENERATOR_AT_RULES = new Set([
|
|
1247
|
+
const TAILWIND_V4_GENERATOR_AT_RULES = /* @__PURE__ */ new Set([
|
|
1245
1248
|
"config",
|
|
1246
1249
|
"custom-variant",
|
|
1247
1250
|
"plugin",
|
|
@@ -2742,7 +2745,7 @@ function createRuntimeEntries(snapshot) {
|
|
|
2742
2745
|
return snapshot.entries.filter(isRuntimeCandidateEntry);
|
|
2743
2746
|
}
|
|
2744
2747
|
function collectChangedRuntimeFiles(snapshot) {
|
|
2745
|
-
return new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2748
|
+
return /* @__PURE__ */ new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2746
2749
|
}
|
|
2747
2750
|
function resolveEntryExtension(entry) {
|
|
2748
2751
|
if (entry.type === "html") return "html";
|
|
@@ -2845,7 +2848,7 @@ function addCandidateSet$1(candidateCountByClass, candidates) {
|
|
|
2845
2848
|
}
|
|
2846
2849
|
}
|
|
2847
2850
|
function createRuntimeClassSet(baseClassSet, candidateCountByClass) {
|
|
2848
|
-
return new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2851
|
+
return /* @__PURE__ */ new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2849
2852
|
}
|
|
2850
2853
|
function createNonSourceBaseClassSet(baseClassSet, candidateCountByClass) {
|
|
2851
2854
|
const nextBaseClassSet = new Set(baseClassSet);
|
|
@@ -2976,7 +2979,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
2976
2979
|
}
|
|
2977
2980
|
//#endregion
|
|
2978
2981
|
//#region src/tailwindcss/candidates.ts
|
|
2979
|
-
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = new Set([
|
|
2982
|
+
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2980
2983
|
"js",
|
|
2981
2984
|
"jsx",
|
|
2982
2985
|
"mjs",
|
|
@@ -3268,7 +3271,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3268
3271
|
}
|
|
3269
3272
|
function recompute(id) {
|
|
3270
3273
|
const normalizedId = cleanUrl(id);
|
|
3271
|
-
replaceFinal(normalizedId, new Set([
|
|
3274
|
+
replaceFinal(normalizedId, /* @__PURE__ */ new Set([
|
|
3272
3275
|
...scanCandidatesById.get(normalizedId) ?? [],
|
|
3273
3276
|
...transformCandidatesById.get(normalizedId) ?? [],
|
|
3274
3277
|
...cssCandidatesById.get(normalizedId) ?? []
|
|
@@ -3299,7 +3302,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3299
3302
|
return mergeSourcesByPriority().entries();
|
|
3300
3303
|
}
|
|
3301
3304
|
function values() {
|
|
3302
|
-
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3305
|
+
const values = /* @__PURE__ */ new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3303
3306
|
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
3304
3307
|
return values;
|
|
3305
3308
|
}
|
|
@@ -3403,7 +3406,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3403
3406
|
for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
|
|
3404
3407
|
for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
|
|
3405
3408
|
for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
|
|
3406
|
-
const ids = new Set([
|
|
3409
|
+
const ids = /* @__PURE__ */ new Set([
|
|
3407
3410
|
...scanCandidatesById.keys(),
|
|
3408
3411
|
...transformCandidatesById.keys(),
|
|
3409
3412
|
...cssCandidatesById.keys()
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
2
|
-
const require_v4_engine = require("./v4-engine-
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_context = require("./context-
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
|
+
const require_v4_engine = require("./v4-engine-CKbS27-o.js");
|
|
3
|
+
const require_generator = require("./generator-CV_0irKO.js");
|
|
4
|
+
const require_context = require("./context-D75pwtBW.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-BSCvrs1p.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
|
-
node_path =
|
|
8
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
9
|
let node_process = require("node:process");
|
|
10
|
-
node_process =
|
|
10
|
+
node_process = require_rolldown_runtime.__toESM(node_process);
|
|
11
11
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
|
12
12
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
13
13
|
let lru_cache = require("lru-cache");
|
|
@@ -175,11 +175,11 @@ function shouldInjectMiniProgramPreflightForGeneratorCss(opts, options) {
|
|
|
175
175
|
}
|
|
176
176
|
function mergeScopedRuntimeWithCurrentRuntime(scopedRuntime, runtime, options) {
|
|
177
177
|
if (options.isolateCssSource) {
|
|
178
|
-
if (options.matchedCssSourceFile) return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
179
|
-
return new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
178
|
+
if (options.matchedCssSourceFile) return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
179
|
+
return /* @__PURE__ */ new Set([...scopedRuntime, ...options.currentCssCandidates ?? []]);
|
|
180
180
|
}
|
|
181
181
|
if (runtime.size === 0 || !options.cssHandlerOptions.isMainChunk) return scopedRuntime;
|
|
182
|
-
return new Set([...scopedRuntime, ...runtime]);
|
|
182
|
+
return /* @__PURE__ */ new Set([...scopedRuntime, ...runtime]);
|
|
183
183
|
}
|
|
184
184
|
function shouldIsolateScopedCssSource(_majorVersion, source, sourceEntries, options) {
|
|
185
185
|
if (options.target !== "weapp") return false;
|
|
@@ -241,7 +241,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
|
|
|
241
241
|
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives || cssHandlerOptions.isMainChunk && (options.configuredCssSourceCount ?? 0) > 0 || cssHandlerOptions.isMainChunk && options.rawSource.includes("weapp-tailwindcss") || options.target === "web" && cssHandlerOptions.isMainChunk && (options.runtimeCandidateCount ?? 0) > 0;
|
|
242
242
|
}
|
|
243
243
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
244
|
-
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
244
|
+
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? /* @__PURE__ */ new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
245
245
|
}
|
|
246
246
|
function mergeGeneratorResults(generatedResults) {
|
|
247
247
|
const firstGenerated = generatedResults[0];
|
|
@@ -263,7 +263,7 @@ function mergeGeneratorResults(generatedResults) {
|
|
|
263
263
|
//#endregion
|
|
264
264
|
//#region src/bundlers/shared/generator-css/legacy-selectors.ts
|
|
265
265
|
const CLASS_SELECTOR_RE = /(?:^|[^\w-])\.[_a-z\u00A0-\uFFFF\\-]/i;
|
|
266
|
-
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = new Set([
|
|
266
|
+
const MINI_PROGRAM_THEME_SCOPE_SELECTORS = /* @__PURE__ */ new Set([
|
|
267
267
|
":host",
|
|
268
268
|
"page",
|
|
269
269
|
".tw-root",
|
|
@@ -326,7 +326,7 @@ function escapeCompatSelectorClasses(selector) {
|
|
|
326
326
|
function normalizeCompatSelectors(selector) {
|
|
327
327
|
const normalized = normalizeCompatSelector(selector);
|
|
328
328
|
if (!normalized) return [];
|
|
329
|
-
const selectors = new Set([normalized]);
|
|
329
|
+
const selectors = /* @__PURE__ */ new Set([normalized]);
|
|
330
330
|
const escaped = normalizeCompatSelector(escapeCompatSelectorClasses(normalized));
|
|
331
331
|
if (escaped) selectors.add(escaped);
|
|
332
332
|
return [...selectors];
|
|
@@ -677,7 +677,7 @@ function resolveSourceSideCssEntrySource(file, sourceOptions, resolveOptions = {
|
|
|
677
677
|
for (const sourceFile of createSourceStylePathCandidates(file, sourceOptions)) try {
|
|
678
678
|
const source = sourceOptions.sourceFile && node_path.default.resolve(sourceOptions.sourceFile) === node_path.default.resolve(sourceFile) && typeof sourceOptions.sourceCss === "string" ? sourceOptions.sourceCss : (0, node_fs.existsSync)(sourceFile) ? (0, node_fs.readFileSync)(sourceFile, "utf8") : void 0;
|
|
679
679
|
if (source === void 0) continue;
|
|
680
|
-
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, new Set([node_path.default.resolve(sourceFile)]));
|
|
680
|
+
const directiveSources = extractStyleDirectiveSourcesDeep(source, sourceFile, /* @__PURE__ */ new Set([node_path.default.resolve(sourceFile)]));
|
|
681
681
|
for (const styleSource of directiveSources) {
|
|
682
682
|
const cssEntrySource = require_v4_engine.resolveCssEntrySource(styleSource.source, node_path.default.dirname(styleSource.file), resolveOptions);
|
|
683
683
|
if (cssEntrySource) return {
|
|
@@ -884,7 +884,8 @@ function createSingleTailwindV4SourceOptions(sourceOptions, options) {
|
|
|
884
884
|
baseFallbacks: sourceOptions.baseFallbacks,
|
|
885
885
|
packageName: sourceOptions.packageName,
|
|
886
886
|
base: options.base,
|
|
887
|
-
css: options.css
|
|
887
|
+
css: options.css,
|
|
888
|
+
cssEntries: options.cssEntries
|
|
888
889
|
});
|
|
889
890
|
}
|
|
890
891
|
async function resolveTailwindV4CssEntrySource(cssEntry, sourceOptions) {
|
|
@@ -975,7 +976,7 @@ function hydrateTailwindV4CssSource(cssSource) {
|
|
|
975
976
|
file,
|
|
976
977
|
base: cssSource.base ?? node_path.default.dirname(file),
|
|
977
978
|
css: (0, node_fs.readFileSync)(file, "utf8"),
|
|
978
|
-
dependencies: [
|
|
979
|
+
dependencies: [.../* @__PURE__ */ new Set([...cssSource.dependencies ?? [], file])]
|
|
979
980
|
};
|
|
980
981
|
}
|
|
981
982
|
function normalizeTailwindV4CssSourceConfigs(sourceOptions) {
|
|
@@ -1091,7 +1092,8 @@ async function resolveTailwindV4SourceSideEntrySource(resolvedEntrySource, sourc
|
|
|
1091
1092
|
const css = createTailwindV4SourceReferenceSource(require_v4_engine.normalizeConfigDirective(require_v4_engine.prependConfigDirective(resolvedEntrySource.css, generatorOptions?.config), config), resolvedSourceOptions);
|
|
1092
1093
|
return withMatchedSourceSideMetadata(await require_v4_engine.resolveTailwindV4Source(createSingleTailwindV4SourceOptions(resolvedSourceOptions, {
|
|
1093
1094
|
base: resolvedEntrySource.base,
|
|
1094
|
-
css
|
|
1095
|
+
css,
|
|
1096
|
+
cssEntries: [resolvedEntrySource.file]
|
|
1095
1097
|
})), resolvedEntrySource);
|
|
1096
1098
|
}
|
|
1097
1099
|
async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, file, cssHandlerOptions, generatorOptions, selectionOptions) {
|
|
@@ -1122,6 +1124,8 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
1122
1124
|
}
|
|
1123
1125
|
const shouldPreferSourceSideEntry = shouldResolveSourceSideCssEntry(rawSource) || Boolean(cssEntrySource?.css.includes("weapp-tailwindcss generator-placeholder")) && (sourceOptions?.cssEntries?.length ?? 0) <= 1;
|
|
1124
1126
|
const sourceSideEntrySource = normalizedSourceOptions && (shouldPreferSourceSideEntry || normalizedSourceOptions.sourceFile !== void 0) && canResolveSourceSideCssEntry(file, cssHandlerOptions, normalizedSourceOptions) ? resolveSourceSideCssEntrySource(file, normalizedSourceOptions, { removeConfig: false }) : void 0;
|
|
1127
|
+
const sourceSideCssSource = sourceSideEntrySource?.file && normalizedSourceOptions.cssEntries?.some((cssEntry) => node_path.default.resolve(cssEntry.replace(/[?#].*$/, "")) === node_path.default.resolve(sourceSideEntrySource.file)) ? await resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file) : void 0;
|
|
1128
|
+
if (sourceSideCssSource) return sourceSideCssSource;
|
|
1125
1129
|
const matchedCssEntrySource = normalizedSourceOptions ? await resolveMatchingTailwindV4CssEntry(rawSource, file, normalizedSourceOptions) : void 0;
|
|
1126
1130
|
const matchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveMatchingTailwindV4CssSource(rawSource, file, cssHandlerOptions, normalizedSourceOptions) : void 0;
|
|
1127
1131
|
const candidateMatchedCssSource = normalizedSourceOptions && !matchedCssEntrySource ? await resolveCandidateMatchedTailwindV4CssSource(rawSource, cssHandlerOptions, normalizedSourceOptions, selectionOptions) : void 0;
|
|
@@ -1145,7 +1149,6 @@ async function resolveGeneratorSource(_majorVersion, runtimeState, rawSource, fi
|
|
|
1145
1149
|
css: require_v4_engine.prependConfigDirective(source.css, generatorOptions.config)
|
|
1146
1150
|
} : source;
|
|
1147
1151
|
}
|
|
1148
|
-
if (sourceSideEntrySource && normalizedSourceOptions) return resolveTailwindV4SourceSideEntrySource(sourceSideEntrySource, normalizedSourceOptions, generatorOptions, file);
|
|
1149
1152
|
const config = resolveExistingConfigPath(resolvedEntrySource.config, resolvedEntrySource.configRequest, file, require_v4_engine.omitUndefined({
|
|
1150
1153
|
...resolvedSourceOptions ?? {},
|
|
1151
1154
|
sourceFile: resolvedEntrySource.file ?? resolvedSourceOptions?.sourceFile ?? resolvePostcssSourceFile(cssHandlerOptions)
|
|
@@ -1245,7 +1248,7 @@ async function resolveGeneratorSourceEntries(source, runtimeState) {
|
|
|
1245
1248
|
}
|
|
1246
1249
|
//#endregion
|
|
1247
1250
|
//#region src/bundlers/shared/generator-css/user-css.ts
|
|
1248
|
-
const TAILWIND_V4_GENERATOR_AT_RULES = new Set([
|
|
1251
|
+
const TAILWIND_V4_GENERATOR_AT_RULES = /* @__PURE__ */ new Set([
|
|
1249
1252
|
"config",
|
|
1250
1253
|
"custom-variant",
|
|
1251
1254
|
"plugin",
|
|
@@ -2746,7 +2749,7 @@ function createRuntimeEntries(snapshot) {
|
|
|
2746
2749
|
return snapshot.entries.filter(isRuntimeCandidateEntry);
|
|
2747
2750
|
}
|
|
2748
2751
|
function collectChangedRuntimeFiles(snapshot) {
|
|
2749
|
-
return new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2752
|
+
return /* @__PURE__ */ new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2750
2753
|
}
|
|
2751
2754
|
function resolveEntryExtension(entry) {
|
|
2752
2755
|
if (entry.type === "html") return "html";
|
|
@@ -2849,7 +2852,7 @@ function addCandidateSet$1(candidateCountByClass, candidates) {
|
|
|
2849
2852
|
}
|
|
2850
2853
|
}
|
|
2851
2854
|
function createRuntimeClassSet(baseClassSet, candidateCountByClass) {
|
|
2852
|
-
return new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2855
|
+
return /* @__PURE__ */ new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2853
2856
|
}
|
|
2854
2857
|
function createNonSourceBaseClassSet(baseClassSet, candidateCountByClass) {
|
|
2855
2858
|
const nextBaseClassSet = new Set(baseClassSet);
|
|
@@ -2980,7 +2983,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
2980
2983
|
}
|
|
2981
2984
|
//#endregion
|
|
2982
2985
|
//#region src/tailwindcss/candidates.ts
|
|
2983
|
-
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = new Set([
|
|
2986
|
+
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2984
2987
|
"js",
|
|
2985
2988
|
"jsx",
|
|
2986
2989
|
"mjs",
|
|
@@ -3272,7 +3275,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3272
3275
|
}
|
|
3273
3276
|
function recompute(id) {
|
|
3274
3277
|
const normalizedId = cleanUrl(id);
|
|
3275
|
-
replaceFinal(normalizedId, new Set([
|
|
3278
|
+
replaceFinal(normalizedId, /* @__PURE__ */ new Set([
|
|
3276
3279
|
...scanCandidatesById.get(normalizedId) ?? [],
|
|
3277
3280
|
...transformCandidatesById.get(normalizedId) ?? [],
|
|
3278
3281
|
...cssCandidatesById.get(normalizedId) ?? []
|
|
@@ -3303,7 +3306,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3303
3306
|
return mergeSourcesByPriority().entries();
|
|
3304
3307
|
}
|
|
3305
3308
|
function values() {
|
|
3306
|
-
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3309
|
+
const values = /* @__PURE__ */ new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3307
3310
|
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
3308
3311
|
return values;
|
|
3309
3312
|
}
|
|
@@ -3407,7 +3410,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3407
3410
|
for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
|
|
3408
3411
|
for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
|
|
3409
3412
|
for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
|
|
3410
|
-
const ids = new Set([
|
|
3413
|
+
const ids = /* @__PURE__ */ new Set([
|
|
3411
3414
|
...scanCandidatesById.keys(),
|
|
3412
3415
|
...transformCandidatesById.keys(),
|
|
3413
3416
|
...cssCandidatesById.keys()
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_framework = require("./framework.js");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_gulp = require("./gulp-
|
|
3
|
+
const require_generator = require("./generator-CV_0irKO.js");
|
|
4
|
+
const require_gulp = require("./gulp-B_u8NjQL.js");
|
|
5
5
|
const require_postcss = require("./postcss.js");
|
|
6
|
-
const require_vite = require("./vite-
|
|
7
|
-
const require_webpack = require("./webpack-
|
|
6
|
+
const require_vite = require("./vite-CkVMSDDp.js");
|
|
7
|
+
const require_webpack = require("./webpack-hvSFaicc.js");
|
|
8
|
+
require("./webpack.js");
|
|
8
9
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
9
10
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
10
11
|
exports.createPlugins = require_gulp.createPlugins;
|
|
@@ -21,6 +22,10 @@ exports.isUniAppXManifest = require_framework.isUniAppXManifest;
|
|
|
21
22
|
exports.isUniAppXPackage = require_framework.isUniAppXPackage;
|
|
22
23
|
exports.isWeappVitePackage = require_framework.isWeappVitePackage;
|
|
23
24
|
exports.resolveImplicitAppTypeFromViteRoot = require_framework.resolveImplicitAppTypeFromViteRoot;
|
|
25
|
+
exports.resolveMpxPlatform = require_framework.resolveMpxPlatform;
|
|
26
|
+
exports.resolvePlatform = require_framework.resolvePlatform;
|
|
27
|
+
exports.resolveTaroPlatform = require_framework.resolveTaroPlatform;
|
|
28
|
+
exports.resolveUniAppXPlatform = require_framework.resolveUniAppXPlatform;
|
|
24
29
|
exports.resolveUniPlatform = require_framework.resolveUniPlatform;
|
|
25
30
|
exports.resolveUniPlatformsFromEnv = require_framework.resolveUniPlatformsFromEnv;
|
|
26
31
|
exports.resolveUniUtsPlatform = require_framework.resolveUniUtsPlatform;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.mjs";
|
|
2
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { t as createPlugins } from "./gulp-
|
|
1
|
+
import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.mjs";
|
|
2
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-DNs6ekoC.mjs";
|
|
3
|
+
import { t as createPlugins } from "./gulp-aQMZ0M7c.mjs";
|
|
4
4
|
import weappTailwindcssPostcssPlugin from "./postcss.mjs";
|
|
5
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
6
|
-
import { n as weappTailwindcssPackageDir } from "./webpack-
|
|
5
|
+
import { t as WeappTailwindcss } from "./vite-5Wn0PIzJ.mjs";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-DEag6ueE.mjs";
|
|
7
|
+
import "./webpack.mjs";
|
|
7
8
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
|
|
8
|
-
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
9
|
+
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
2
2
|
let _weapp_tailwindcss_postcss_html_transform = require("@weapp-tailwindcss/postcss/html-transform");
|
|
3
|
-
_weapp_tailwindcss_postcss_html_transform =
|
|
3
|
+
_weapp_tailwindcss_postcss_html_transform = require_rolldown_runtime.__toESM(_weapp_tailwindcss_postcss_html_transform);
|
|
4
4
|
//#region src/postcss-html-transform.ts
|
|
5
5
|
var postcss_html_transform_default = _weapp_tailwindcss_postcss_html_transform.default;
|
|
6
6
|
//#endregion
|
package/dist/postcss.js
CHANGED
|
@@ -2,8 +2,8 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_v4_engine = require("./v4-engine-
|
|
6
|
-
const require_generator = require("./generator-
|
|
5
|
+
const require_v4_engine = require("./v4-engine-CKbS27-o.js");
|
|
6
|
+
const require_generator = require("./generator-CV_0irKO.js");
|
|
7
7
|
const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss").createWeappTailwindcssPostcssPlugin)({
|
|
8
8
|
createGenerator: (source) => {
|
|
9
9
|
return require_generator.createWeappTailwindcssGenerator(source);
|
package/dist/postcss.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as resolveTailwindV4Source } from "./v4-engine-
|
|
2
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-
|
|
1
|
+
import { t as resolveTailwindV4Source } from "./v4-engine-BklH3CpJ.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-DNs6ekoC.mjs";
|
|
3
3
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
4
4
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
5
5
|
createGenerator: (source) => {
|
package/dist/presets/shared.d.ts
CHANGED
|
@@ -7,4 +7,8 @@ export interface BasePresetOptions extends Omit<Partial<UserDefinedOptions>, 'cs
|
|
|
7
7
|
rawOptions?: UserDefinedOptions;
|
|
8
8
|
}
|
|
9
9
|
export declare function normalizeCssEntries(entries?: string | string[]): string[] | undefined;
|
|
10
|
+
export declare function shouldEnableWebCompatFromEnv(): boolean;
|
|
11
|
+
export declare function withWebCompatGeneratorDefaults<T extends {
|
|
12
|
+
generator?: UserDefinedOptions['generator'];
|
|
13
|
+
}>(options: T, enabled?: boolean): T;
|
|
10
14
|
export declare function createBasePreset(options?: BasePresetOptions): Partial<UserDefinedOptions>;
|
package/dist/presets.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
2
|
+
const require_rolldown_runtime = require("./rolldown-runtime-emK7D4bc.js");
|
|
3
|
+
const require_framework = require("./framework.js");
|
|
4
|
+
const require_v4_engine = require("./v4-engine-CKbS27-o.js");
|
|
5
|
+
require("./utils-D3h8j7Mk.js");
|
|
6
|
+
const require_tailwindcss = require("./tailwindcss-BSCvrs1p.js");
|
|
6
7
|
require("./logger-TlKT3xmR.js");
|
|
7
8
|
let node_path = require("node:path");
|
|
8
|
-
node_path =
|
|
9
|
+
node_path = require_rolldown_runtime.__toESM(node_path);
|
|
9
10
|
let node_process = require("node:process");
|
|
10
|
-
node_process =
|
|
11
|
+
node_process = require_rolldown_runtime.__toESM(node_process);
|
|
11
12
|
let local_pkg = require("local-pkg");
|
|
12
13
|
let _weapp_tailwindcss_shared = require("@weapp-tailwindcss/shared");
|
|
13
14
|
let _weapp_tailwindcss_logger = require("@weapp-tailwindcss/logger");
|
|
@@ -17,6 +18,20 @@ function normalizeCssEntries(entries) {
|
|
|
17
18
|
const normalized = Array.isArray(entries) ? entries : [entries];
|
|
18
19
|
return normalized.length > 0 ? normalized : void 0;
|
|
19
20
|
}
|
|
21
|
+
function shouldEnableWebCompatFromEnv() {
|
|
22
|
+
const { uniPlatform, uniUtsPlatform } = require_framework.resolveUniPlatformsFromEnv();
|
|
23
|
+
return uniPlatform.isWeb || uniUtsPlatform.isWeb || require_framework.resolveTaroPlatform().isWeb;
|
|
24
|
+
}
|
|
25
|
+
function withWebCompatGeneratorDefaults(options, enabled = shouldEnableWebCompatFromEnv()) {
|
|
26
|
+
if (!enabled) return options;
|
|
27
|
+
return {
|
|
28
|
+
...options,
|
|
29
|
+
generator: (0, _weapp_tailwindcss_shared.defuOverrideArray)(options.generator ?? {}, {
|
|
30
|
+
target: "web",
|
|
31
|
+
webCompat: true
|
|
32
|
+
})
|
|
33
|
+
};
|
|
34
|
+
}
|
|
20
35
|
function createBasePreset(options = {}) {
|
|
21
36
|
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
22
37
|
const baseDir = require_tailwindcss.resolveTailwindcssBasedir(base);
|
|
@@ -42,16 +57,16 @@ function createBasePreset(options = {}) {
|
|
|
42
57
|
//#endregion
|
|
43
58
|
//#region src/presets/hbuilderx.ts
|
|
44
59
|
function hbuilderx(options = {}) {
|
|
45
|
-
return createBasePreset({ ...options });
|
|
60
|
+
return createBasePreset(withWebCompatGeneratorDefaults({ ...options }));
|
|
46
61
|
}
|
|
47
62
|
//#endregion
|
|
48
63
|
//#region src/presets/uni-app.ts
|
|
49
64
|
function uniApp(options = {}) {
|
|
50
65
|
const uniPlatform = node_process.default.env["UNI_PLATFORM"];
|
|
51
|
-
return createBasePreset({
|
|
52
|
-
disabled: uniPlatform === "
|
|
66
|
+
return createBasePreset(withWebCompatGeneratorDefaults({
|
|
67
|
+
disabled: uniPlatform === "app" || uniPlatform === "app-plus" ? true : void 0,
|
|
53
68
|
...options
|
|
54
|
-
});
|
|
69
|
+
}));
|
|
55
70
|
}
|
|
56
71
|
//#endregion
|
|
57
72
|
//#region src/tailwindcss/index.ts
|
|
@@ -64,7 +79,7 @@ function resolveTailwindResolveOptions(base, resolve) {
|
|
|
64
79
|
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
65
80
|
return {
|
|
66
81
|
...resolve ?? {},
|
|
67
|
-
paths: [
|
|
82
|
+
paths: [.../* @__PURE__ */ new Set([
|
|
68
83
|
node_path.default.join(base, "node_modules"),
|
|
69
84
|
base,
|
|
70
85
|
...currentPaths
|
|
@@ -84,10 +99,9 @@ function resolveInstalledTailwindDefaults(resolve) {
|
|
|
84
99
|
}
|
|
85
100
|
function uniAppX(options) {
|
|
86
101
|
_weapp_tailwindcss_logger.logger.info(`UNI_PLATFORM: ${node_process.default.env["UNI_PLATFORM"]}`);
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const isApp = utsPlatform.isApp || uniPlatform.isApp;
|
|
102
|
+
const { uniPlatform, uniUtsPlatform } = require_framework.resolveUniPlatformsFromEnv();
|
|
103
|
+
_weapp_tailwindcss_logger.logger.info(`UNI_UTS_PLATFORM: ${uniUtsPlatform.raw ?? "undefined"}`);
|
|
104
|
+
const isApp = uniUtsPlatform.isApp || uniPlatform.isApp;
|
|
91
105
|
const cssEntries = normalizeCssEntries(options.cssEntries);
|
|
92
106
|
const resolvedResolve = resolveTailwindResolveOptions(options.base, options.resolve);
|
|
93
107
|
const installedTailwindDefaults = resolveInstalledTailwindDefaults(resolvedResolve);
|
|
@@ -100,7 +114,7 @@ function uniAppX(options) {
|
|
|
100
114
|
if (typeof options.uniAppX === "boolean") resolvedUniAppX.enabled = options.uniAppX;
|
|
101
115
|
return (0, _weapp_tailwindcss_shared.defuOverrideArray)(options.rawOptions ?? {}, {
|
|
102
116
|
uniAppX: resolvedUniAppX,
|
|
103
|
-
...options.generator !== void 0 ? { generator: options.generator } : {},
|
|
117
|
+
...withWebCompatGeneratorDefaults(options.generator !== void 0 ? { generator: options.generator } : {}),
|
|
104
118
|
rem2rpx: options.rem2rpx,
|
|
105
119
|
unitsToPx: options.unitsToPx,
|
|
106
120
|
unitConversion: options.unitConversion,
|
|
@@ -135,5 +149,7 @@ function uniAppX(options) {
|
|
|
135
149
|
exports.createBasePreset = createBasePreset;
|
|
136
150
|
exports.hbuilderx = hbuilderx;
|
|
137
151
|
exports.normalizeCssEntries = normalizeCssEntries;
|
|
152
|
+
exports.shouldEnableWebCompatFromEnv = shouldEnableWebCompatFromEnv;
|
|
138
153
|
exports.uniApp = uniApp;
|
|
139
154
|
exports.uniAppX = uniAppX;
|
|
155
|
+
exports.withWebCompatGeneratorDefaults = withWebCompatGeneratorDefaults;
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { resolveTaroPlatform, resolveUniPlatformsFromEnv } from "./framework.mjs";
|
|
2
|
+
import { st as omitUndefined } from "./v4-engine-BklH3CpJ.mjs";
|
|
3
|
+
import { n as defuOverrideArray } from "./utils-DodxWHGz.mjs";
|
|
4
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-BwV3_Ryc.mjs";
|
|
4
5
|
import { t as logger } from "./logger-BNzxZbZj.mjs";
|
|
5
6
|
import path from "node:path";
|
|
6
7
|
import process from "node:process";
|
|
@@ -11,6 +12,20 @@ function normalizeCssEntries(entries) {
|
|
|
11
12
|
const normalized = Array.isArray(entries) ? entries : [entries];
|
|
12
13
|
return normalized.length > 0 ? normalized : void 0;
|
|
13
14
|
}
|
|
15
|
+
function shouldEnableWebCompatFromEnv() {
|
|
16
|
+
const { uniPlatform, uniUtsPlatform } = resolveUniPlatformsFromEnv();
|
|
17
|
+
return uniPlatform.isWeb || uniUtsPlatform.isWeb || resolveTaroPlatform().isWeb;
|
|
18
|
+
}
|
|
19
|
+
function withWebCompatGeneratorDefaults(options, enabled = shouldEnableWebCompatFromEnv()) {
|
|
20
|
+
if (!enabled) return options;
|
|
21
|
+
return {
|
|
22
|
+
...options,
|
|
23
|
+
generator: defuOverrideArray(options.generator ?? {}, {
|
|
24
|
+
target: "web",
|
|
25
|
+
webCompat: true
|
|
26
|
+
})
|
|
27
|
+
};
|
|
28
|
+
}
|
|
14
29
|
function createBasePreset(options = {}) {
|
|
15
30
|
const { base, cssEntries, resolve, rawOptions, ...userOptions } = options;
|
|
16
31
|
const baseDir = resolveTailwindcssBasedir(base);
|
|
@@ -36,16 +51,16 @@ function createBasePreset(options = {}) {
|
|
|
36
51
|
//#endregion
|
|
37
52
|
//#region src/presets/hbuilderx.ts
|
|
38
53
|
function hbuilderx(options = {}) {
|
|
39
|
-
return createBasePreset({ ...options });
|
|
54
|
+
return createBasePreset(withWebCompatGeneratorDefaults({ ...options }));
|
|
40
55
|
}
|
|
41
56
|
//#endregion
|
|
42
57
|
//#region src/presets/uni-app.ts
|
|
43
58
|
function uniApp(options = {}) {
|
|
44
59
|
const uniPlatform = process.env["UNI_PLATFORM"];
|
|
45
|
-
return createBasePreset({
|
|
46
|
-
disabled: uniPlatform === "
|
|
60
|
+
return createBasePreset(withWebCompatGeneratorDefaults({
|
|
61
|
+
disabled: uniPlatform === "app" || uniPlatform === "app-plus" ? true : void 0,
|
|
47
62
|
...options
|
|
48
|
-
});
|
|
63
|
+
}));
|
|
49
64
|
}
|
|
50
65
|
//#endregion
|
|
51
66
|
//#region src/tailwindcss/index.ts
|
|
@@ -58,7 +73,7 @@ function resolveTailwindResolveOptions(base, resolve) {
|
|
|
58
73
|
const currentPaths = Array.isArray(resolve?.paths) ? resolve.paths : [];
|
|
59
74
|
return {
|
|
60
75
|
...resolve ?? {},
|
|
61
|
-
paths: [
|
|
76
|
+
paths: [.../* @__PURE__ */ new Set([
|
|
62
77
|
path.join(base, "node_modules"),
|
|
63
78
|
base,
|
|
64
79
|
...currentPaths
|
|
@@ -78,10 +93,9 @@ function resolveInstalledTailwindDefaults(resolve) {
|
|
|
78
93
|
}
|
|
79
94
|
function uniAppX(options) {
|
|
80
95
|
logger.info(`UNI_PLATFORM: ${process.env["UNI_PLATFORM"]}`);
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
const isApp = utsPlatform.isApp || uniPlatform.isApp;
|
|
96
|
+
const { uniPlatform, uniUtsPlatform } = resolveUniPlatformsFromEnv();
|
|
97
|
+
logger.info(`UNI_UTS_PLATFORM: ${uniUtsPlatform.raw ?? "undefined"}`);
|
|
98
|
+
const isApp = uniUtsPlatform.isApp || uniPlatform.isApp;
|
|
85
99
|
const cssEntries = normalizeCssEntries(options.cssEntries);
|
|
86
100
|
const resolvedResolve = resolveTailwindResolveOptions(options.base, options.resolve);
|
|
87
101
|
const installedTailwindDefaults = resolveInstalledTailwindDefaults(resolvedResolve);
|
|
@@ -94,7 +108,7 @@ function uniAppX(options) {
|
|
|
94
108
|
if (typeof options.uniAppX === "boolean") resolvedUniAppX.enabled = options.uniAppX;
|
|
95
109
|
return defuOverrideArray(options.rawOptions ?? {}, {
|
|
96
110
|
uniAppX: resolvedUniAppX,
|
|
97
|
-
...options.generator !== void 0 ? { generator: options.generator } : {},
|
|
111
|
+
...withWebCompatGeneratorDefaults(options.generator !== void 0 ? { generator: options.generator } : {}),
|
|
98
112
|
rem2rpx: options.rem2rpx,
|
|
99
113
|
unitsToPx: options.unitsToPx,
|
|
100
114
|
unitConversion: options.unitConversion,
|
|
@@ -126,4 +140,4 @@ function uniAppX(options) {
|
|
|
126
140
|
});
|
|
127
141
|
}
|
|
128
142
|
//#endregion
|
|
129
|
-
export { createBasePreset, hbuilderx, normalizeCssEntries, uniApp, uniAppX };
|
|
143
|
+
export { createBasePreset, hbuilderx, normalizeCssEntries, shouldEnableWebCompatFromEnv, uniApp, uniAppX, withWebCompatGeneratorDefaults };
|