weapp-tailwindcss 5.1.1 → 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.en.md +2 -0
- package/README.md +2 -0
- 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/css-output-helpers.d.ts +1 -1
- 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-DlpKD7aN.mjs → context-B07Vf584.mjs} +34 -34
- package/dist/{context-B6hVF7dr.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/options.d.ts +3 -1
- package/dist/{generator-6oMJtTDO.js → generator-CV_0irKO.js} +4 -2
- package/dist/{generator-CjzBK7h-.mjs → generator-DNs6ekoC.mjs} +3 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-BtGq6LP9.js → gulp-B_u8NjQL.js} +9 -9
- package/dist/{gulp-DNU10Vtc.mjs → gulp-aQMZ0M7c.mjs} +4 -4
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-B0KuWDjV.mjs → hmr-timing-DLYQTCDb.mjs} +40 -31
- package/dist/{hmr-timing-CegXR9O4.js → hmr-timing-DOoHun3i.js} +42 -33
- 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-BKYb9jxa.js → source-candidate-scan-signature-DzwebZrf.js} +6 -6
- package/dist/{source-candidate-scan-signature-B5af2Ahe.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-fRBeuuK-.mjs → transform-Clj7R818.mjs} +19 -19
- package/dist/{transform-vLwZpiTE.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-CWRooooa.mjs → vite-5Wn0PIzJ.mjs} +244 -45
- package/dist/{vite-w-RkgaTY.js → vite-CkVMSDDp.js} +249 -50
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +71 -34
- package/dist/weapp-tw-runtime-classset-loader.js +2 -2
- package/dist/{webpack-8PaV1gG3.mjs → webpack-DEag6ueE.mjs} +66 -18
- package/dist/{webpack-CGgBOx9l.js → webpack-hvSFaicc.js} +71 -23
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +10 -5
- /package/dist/{chunk-emK7D4bc.js → rolldown-runtime-emK7D4bc.js} +0 -0
|
@@ -1,12 +1,12 @@
|
|
|
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";
|
|
8
8
|
import { extractRawCandidatesWithPositions, extractSourceCandidates, extractValidCandidates, resolveProjectSourceFiles, resolveValidTailwindV4Candidates, splitCandidateTokens } from "@tailwindcss-mangle/engine";
|
|
9
|
-
import { filterExistingCssRules, finalizeMiniProgramCss, hasMiniProgramCssSpecificityPlaceholders, postcss, pruneMiniProgramGeneratedCss, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, stripMiniProgramCssSpecificityPlaceholders } from "@weapp-tailwindcss/postcss";
|
|
9
|
+
import { filterExistingCssRules, finalizeMiniProgramCss, hasMiniProgramCssSpecificityPlaceholders, postcss, pruneMiniProgramGeneratedCss, removeUnsupportedCascadeLayers, removeUnsupportedMiniProgramAtRules, stripMiniProgramCssSpecificityPlaceholders, transformWebCssCompat } from "@weapp-tailwindcss/postcss";
|
|
10
10
|
import { LRUCache } from "lru-cache";
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
12
12
|
import { MappingChars2String, unescape } from "@weapp-core/escape";
|
|
@@ -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",
|
|
@@ -2345,6 +2348,9 @@ function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
|
2345
2348
|
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
2346
2349
|
return merged;
|
|
2347
2350
|
}
|
|
2351
|
+
function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
2352
|
+
return target === "web" ? transformWebCssCompat(css, webCompat) : css;
|
|
2353
|
+
}
|
|
2348
2354
|
async function generateCssByGenerator(options) {
|
|
2349
2355
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
2350
2356
|
const generatorOptions = {
|
|
@@ -2367,6 +2373,9 @@ async function generateCssByGenerator(options) {
|
|
|
2367
2373
|
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
2368
2374
|
const localImportParts = splitLocalCssImports(effectiveRawSource);
|
|
2369
2375
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
2376
|
+
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
2377
|
+
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
2378
|
+
};
|
|
2370
2379
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
2371
2380
|
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
2372
2381
|
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
@@ -2455,10 +2464,10 @@ async function generateCssByGenerator(options) {
|
|
|
2455
2464
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2456
2465
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2457
2466
|
const incrementalCss = stripTailwindBanner(generated.incrementalCss);
|
|
2458
|
-
const finalCss = restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2467
|
+
const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2459
2468
|
injectPreflight: false,
|
|
2460
2469
|
styleOptions: generatorStyleOptions
|
|
2461
|
-
})) : options.previousCss, localImports);
|
|
2470
|
+
})) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
|
|
2462
2471
|
return {
|
|
2463
2472
|
css: finalCss,
|
|
2464
2473
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2526,14 +2535,14 @@ async function generateCssByGenerator(options) {
|
|
|
2526
2535
|
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2527
2536
|
}
|
|
2528
2537
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2529
|
-
const finalCss =
|
|
2538
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2530
2539
|
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2531
2540
|
cssHandlerOptions,
|
|
2532
2541
|
isolateCurrentCssCandidates,
|
|
2533
2542
|
localImports
|
|
2534
2543
|
}),
|
|
2535
2544
|
styleOptions: generatorStyleOptions
|
|
2536
|
-
})
|
|
2545
|
+
});
|
|
2537
2546
|
return {
|
|
2538
2547
|
css: finalCss,
|
|
2539
2548
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2634,14 +2643,14 @@ async function generateCssByGenerator(options) {
|
|
|
2634
2643
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : filterExistingCssRules(css, userCss);
|
|
2635
2644
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2636
2645
|
}
|
|
2637
|
-
const finalCss =
|
|
2646
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2638
2647
|
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2639
2648
|
cssHandlerOptions,
|
|
2640
2649
|
isolateCurrentCssCandidates,
|
|
2641
2650
|
localImports
|
|
2642
2651
|
}),
|
|
2643
2652
|
styleOptions: generatorStyleOptions
|
|
2644
|
-
})
|
|
2653
|
+
});
|
|
2645
2654
|
return {
|
|
2646
2655
|
css: finalCss,
|
|
2647
2656
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2671,14 +2680,14 @@ async function generateCssByGenerator(options) {
|
|
|
2671
2680
|
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? filterExistingCssRules(css, userCss) : userCss;
|
|
2672
2681
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2673
2682
|
}
|
|
2674
|
-
const finalCss =
|
|
2683
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2675
2684
|
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2676
2685
|
cssHandlerOptions,
|
|
2677
2686
|
isolateCurrentCssCandidates,
|
|
2678
2687
|
localImports
|
|
2679
2688
|
}),
|
|
2680
2689
|
styleOptions: generatorStyleOptions
|
|
2681
|
-
})
|
|
2690
|
+
});
|
|
2682
2691
|
return {
|
|
2683
2692
|
css: finalCss,
|
|
2684
2693
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2736,7 +2745,7 @@ function createRuntimeEntries(snapshot) {
|
|
|
2736
2745
|
return snapshot.entries.filter(isRuntimeCandidateEntry);
|
|
2737
2746
|
}
|
|
2738
2747
|
function collectChangedRuntimeFiles(snapshot) {
|
|
2739
|
-
return new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2748
|
+
return /* @__PURE__ */ new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2740
2749
|
}
|
|
2741
2750
|
function resolveEntryExtension(entry) {
|
|
2742
2751
|
if (entry.type === "html") return "html";
|
|
@@ -2839,7 +2848,7 @@ function addCandidateSet$1(candidateCountByClass, candidates) {
|
|
|
2839
2848
|
}
|
|
2840
2849
|
}
|
|
2841
2850
|
function createRuntimeClassSet(baseClassSet, candidateCountByClass) {
|
|
2842
|
-
return new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2851
|
+
return /* @__PURE__ */ new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2843
2852
|
}
|
|
2844
2853
|
function createNonSourceBaseClassSet(baseClassSet, candidateCountByClass) {
|
|
2845
2854
|
const nextBaseClassSet = new Set(baseClassSet);
|
|
@@ -2970,7 +2979,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
2970
2979
|
}
|
|
2971
2980
|
//#endregion
|
|
2972
2981
|
//#region src/tailwindcss/candidates.ts
|
|
2973
|
-
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = new Set([
|
|
2982
|
+
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2974
2983
|
"js",
|
|
2975
2984
|
"jsx",
|
|
2976
2985
|
"mjs",
|
|
@@ -3262,7 +3271,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3262
3271
|
}
|
|
3263
3272
|
function recompute(id) {
|
|
3264
3273
|
const normalizedId = cleanUrl(id);
|
|
3265
|
-
replaceFinal(normalizedId, new Set([
|
|
3274
|
+
replaceFinal(normalizedId, /* @__PURE__ */ new Set([
|
|
3266
3275
|
...scanCandidatesById.get(normalizedId) ?? [],
|
|
3267
3276
|
...transformCandidatesById.get(normalizedId) ?? [],
|
|
3268
3277
|
...cssCandidatesById.get(normalizedId) ?? []
|
|
@@ -3293,7 +3302,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3293
3302
|
return mergeSourcesByPriority().entries();
|
|
3294
3303
|
}
|
|
3295
3304
|
function values() {
|
|
3296
|
-
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3305
|
+
const values = /* @__PURE__ */ new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3297
3306
|
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
3298
3307
|
return values;
|
|
3299
3308
|
}
|
|
@@ -3397,7 +3406,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3397
3406
|
for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
|
|
3398
3407
|
for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
|
|
3399
3408
|
for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
|
|
3400
|
-
const ids = new Set([
|
|
3409
|
+
const ids = /* @__PURE__ */ new Set([
|
|
3401
3410
|
...scanCandidatesById.keys(),
|
|
3402
3411
|
...transformCandidatesById.keys(),
|
|
3403
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",
|
|
@@ -2349,6 +2352,9 @@ function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
|
2349
2352
|
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
2350
2353
|
return merged;
|
|
2351
2354
|
}
|
|
2355
|
+
function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
2356
|
+
return target === "web" ? (0, _weapp_tailwindcss_postcss.transformWebCssCompat)(css, webCompat) : css;
|
|
2357
|
+
}
|
|
2352
2358
|
async function generateCssByGenerator(options) {
|
|
2353
2359
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
2354
2360
|
const generatorOptions = {
|
|
@@ -2371,6 +2377,9 @@ async function generateCssByGenerator(options) {
|
|
|
2371
2377
|
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
2372
2378
|
const localImportParts = splitLocalCssImports(effectiveRawSource);
|
|
2373
2379
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
2380
|
+
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
2381
|
+
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
2382
|
+
};
|
|
2374
2383
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
2375
2384
|
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
2376
2385
|
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
@@ -2459,10 +2468,10 @@ async function generateCssByGenerator(options) {
|
|
|
2459
2468
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2460
2469
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2461
2470
|
const incrementalCss = require_v4_engine.stripTailwindBanner(generated.incrementalCss);
|
|
2462
|
-
const finalCss = restoreLocalCssImports(incrementalCss.trim().length > 0 ? require_v4_engine.createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2471
|
+
const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? require_v4_engine.createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2463
2472
|
injectPreflight: false,
|
|
2464
2473
|
styleOptions: generatorStyleOptions
|
|
2465
|
-
})) : options.previousCss, localImports);
|
|
2474
|
+
})) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
|
|
2466
2475
|
return {
|
|
2467
2476
|
css: finalCss,
|
|
2468
2477
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2530,14 +2539,14 @@ async function generateCssByGenerator(options) {
|
|
|
2530
2539
|
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2531
2540
|
}
|
|
2532
2541
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2533
|
-
const finalCss =
|
|
2542
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2534
2543
|
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2535
2544
|
cssHandlerOptions,
|
|
2536
2545
|
isolateCurrentCssCandidates,
|
|
2537
2546
|
localImports
|
|
2538
2547
|
}),
|
|
2539
2548
|
styleOptions: generatorStyleOptions
|
|
2540
|
-
})
|
|
2549
|
+
});
|
|
2541
2550
|
return {
|
|
2542
2551
|
css: finalCss,
|
|
2543
2552
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2638,14 +2647,14 @@ async function generateCssByGenerator(options) {
|
|
|
2638
2647
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
2639
2648
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2640
2649
|
}
|
|
2641
|
-
const finalCss =
|
|
2650
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2642
2651
|
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2643
2652
|
cssHandlerOptions,
|
|
2644
2653
|
isolateCurrentCssCandidates,
|
|
2645
2654
|
localImports
|
|
2646
2655
|
}),
|
|
2647
2656
|
styleOptions: generatorStyleOptions
|
|
2648
|
-
})
|
|
2657
|
+
});
|
|
2649
2658
|
return {
|
|
2650
2659
|
css: finalCss,
|
|
2651
2660
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2675,14 +2684,14 @@ async function generateCssByGenerator(options) {
|
|
|
2675
2684
|
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2676
2685
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2677
2686
|
}
|
|
2678
|
-
const finalCss =
|
|
2687
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2679
2688
|
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2680
2689
|
cssHandlerOptions,
|
|
2681
2690
|
isolateCurrentCssCandidates,
|
|
2682
2691
|
localImports
|
|
2683
2692
|
}),
|
|
2684
2693
|
styleOptions: generatorStyleOptions
|
|
2685
|
-
})
|
|
2694
|
+
});
|
|
2686
2695
|
return {
|
|
2687
2696
|
css: finalCss,
|
|
2688
2697
|
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
@@ -2740,7 +2749,7 @@ function createRuntimeEntries(snapshot) {
|
|
|
2740
2749
|
return snapshot.entries.filter(isRuntimeCandidateEntry);
|
|
2741
2750
|
}
|
|
2742
2751
|
function collectChangedRuntimeFiles(snapshot) {
|
|
2743
|
-
return new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2752
|
+
return /* @__PURE__ */ new Set([...snapshot.runtimeAffectingChangedByType.html, ...snapshot.runtimeAffectingChangedByType.js]);
|
|
2744
2753
|
}
|
|
2745
2754
|
function resolveEntryExtension(entry) {
|
|
2746
2755
|
if (entry.type === "html") return "html";
|
|
@@ -2843,7 +2852,7 @@ function addCandidateSet$1(candidateCountByClass, candidates) {
|
|
|
2843
2852
|
}
|
|
2844
2853
|
}
|
|
2845
2854
|
function createRuntimeClassSet(baseClassSet, candidateCountByClass) {
|
|
2846
|
-
return new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2855
|
+
return /* @__PURE__ */ new Set([...baseClassSet, ...candidateCountByClass.keys()]);
|
|
2847
2856
|
}
|
|
2848
2857
|
function createNonSourceBaseClassSet(baseClassSet, candidateCountByClass) {
|
|
2849
2858
|
const nextBaseClassSet = new Set(baseClassSet);
|
|
@@ -2974,7 +2983,7 @@ function createBundleRuntimeClassSetManager(options = {}) {
|
|
|
2974
2983
|
}
|
|
2975
2984
|
//#endregion
|
|
2976
2985
|
//#region src/tailwindcss/candidates.ts
|
|
2977
|
-
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = new Set([
|
|
2986
|
+
const SCRIPT_SOURCE_CANDIDATE_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
2978
2987
|
"js",
|
|
2979
2988
|
"jsx",
|
|
2980
2989
|
"mjs",
|
|
@@ -3266,7 +3275,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3266
3275
|
}
|
|
3267
3276
|
function recompute(id) {
|
|
3268
3277
|
const normalizedId = cleanUrl(id);
|
|
3269
|
-
replaceFinal(normalizedId, new Set([
|
|
3278
|
+
replaceFinal(normalizedId, /* @__PURE__ */ new Set([
|
|
3270
3279
|
...scanCandidatesById.get(normalizedId) ?? [],
|
|
3271
3280
|
...transformCandidatesById.get(normalizedId) ?? [],
|
|
3272
3281
|
...cssCandidatesById.get(normalizedId) ?? []
|
|
@@ -3297,7 +3306,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3297
3306
|
return mergeSourcesByPriority().entries();
|
|
3298
3307
|
}
|
|
3299
3308
|
function values() {
|
|
3300
|
-
const values = new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3309
|
+
const values = /* @__PURE__ */ new Set([...candidateCount.keys(), ...inlineIncludedCandidates]);
|
|
3301
3310
|
for (const candidate of inlineExcludedCandidates) values.delete(candidate);
|
|
3302
3311
|
return values;
|
|
3303
3312
|
}
|
|
@@ -3401,7 +3410,7 @@ function createSourceCandidateStore(options = {}) {
|
|
|
3401
3410
|
for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
|
|
3402
3411
|
for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
|
|
3403
3412
|
for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
|
|
3404
|
-
const ids = new Set([
|
|
3413
|
+
const ids = /* @__PURE__ */ new Set([
|
|
3405
3414
|
...scanCandidatesById.keys(),
|
|
3406
3415
|
...transformCandidatesById.keys(),
|
|
3407
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>;
|