weapp-tailwindcss 5.1.0 → 5.1.2
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/shared/generator-css/class-selectors.d.ts +2 -0
- package/dist/bundlers/shared/generator-css/generation-helpers.d.ts +6 -14
- package/dist/bundlers/shared/generator-css/source-resolver/metadata.d.ts +1 -1
- package/dist/bundlers/shared/generator-css/source-resolver.d.ts +2 -2
- package/dist/bundlers/shared/generator-css/validate.d.ts +1 -0
- package/dist/bundlers/vite/css-memory.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/css-assets.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-handler-options.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/css-output-helpers.d.ts +39 -0
- package/dist/bundlers/vite/generate-bundle/env-flags.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle/final-css-assets.d.ts +2 -1
- package/dist/bundlers/vite/generate-bundle/finalize.d.ts +2 -0
- package/dist/bundlers/vite/generate-bundle/html-processing.d.ts +26 -0
- package/dist/bundlers/vite/generate-bundle/js-processing.d.ts +4 -0
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/remembered-css.d.ts +1 -1
- package/dist/bundlers/vite/generate-bundle/root-style-output.d.ts +6 -0
- package/dist/bundlers/vite/generate-bundle/runtime-linked-source-memory.d.ts +25 -0
- package/dist/bundlers/vite/generate-bundle/source-candidate-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/tailwind-v4-css-source.d.ts +9 -0
- package/dist/bundlers/vite/generate-bundle/transform-filter.d.ts +15 -0
- package/dist/bundlers/vite/generate-bundle/types.d.ts +1 -0
- package/dist/bundlers/vite/generate-bundle.d.ts +1 -2
- package/dist/bundlers/vite/plugin-cache.d.ts +15 -0
- package/dist/bundlers/vite/runtime-class-set.d.ts +2 -1
- package/dist/bundlers/webpack/BaseUnifiedPlugin/shared.d.ts +3 -3
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/css-source-resolvers.d.ts +34 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/js-module-graph.d.ts +37 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/pipeline-helpers.d.ts +199 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets/source-candidate-refresh.d.ts +11 -0
- package/dist/bundlers/webpack/BaseUnifiedPlugin/v5-assets.d.ts +1 -0
- package/dist/cli.js +15 -8
- package/dist/cli.mjs +15 -8
- package/dist/context/style-options.d.ts +1 -0
- package/dist/{context-Mbzkek1q.mjs → context-C-r8ki7x.mjs} +15 -10
- package/dist/{context-BHxLe743.js → context-CH4HFZP2.js} +20 -9
- package/dist/core.js +1 -1
- package/dist/core.mjs +1 -1
- package/dist/css-macro/index.d.ts +3 -7
- package/dist/{defaults-ZElj1zKc.mjs → defaults-BhE26nSw.mjs} +7 -3
- package/dist/{defaults-CVcKbXBG.js → defaults-CmFBmxsr.js} +7 -3
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/generator/options.d.ts +3 -1
- package/dist/generator/types.d.ts +1 -1
- package/dist/{generator-9rUz4Hcb.js → generator-B6pUjNdD.js} +3 -1
- package/dist/{generator-Dc4qaPmT.mjs → generator-BsPIaLtV.mjs} +3 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-B_sdP6dx.js → gulp-BBCeA7ky.js} +11 -9
- package/dist/{gulp-uM36oIJs.mjs → gulp-CTdcASq8.mjs} +11 -9
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BXMLsF4b.mjs → hmr-timing-BRx-KnBh.mjs} +128 -86
- package/dist/{hmr-timing-CogqkFaF.js → hmr-timing-Da1eI8S0.js} +138 -84
- package/dist/index.js +4 -4
- package/dist/index.mjs +4 -4
- package/dist/postcss.js +2 -2
- package/dist/postcss.mjs +2 -2
- package/dist/presets.js +2 -2
- package/dist/presets.mjs +2 -2
- package/dist/{source-candidate-scan-signature-2ybpptAK.js → source-candidate-scan-signature-BO6JSskQ.js} +3 -3
- package/dist/{source-candidate-scan-signature-Cvb5z1ha.mjs → source-candidate-scan-signature-Dugfplms.mjs} +3 -3
- package/dist/tailwindcss/runtime-types.d.ts +1 -0
- package/dist/tailwindcss/v4-engine/source.d.ts +5 -14
- package/dist/tailwindcss/v4-engine/types.d.ts +10 -2
- package/dist/{tailwindcss-wyUHrfil.mjs → tailwindcss-B5mRo0-M.mjs} +12 -7
- package/dist/{tailwindcss-DHIYcqXT.js → tailwindcss-dbrbY4cd.js} +11 -6
- package/dist/{transform-CQVOgmzM.js → transform-BLleu_bA.js} +1 -1
- package/dist/{transform-tExdt40m.mjs → transform-DeqFRp1D.mjs} +1 -1
- package/dist/types/user-defined-options/matcher.d.ts +7 -0
- package/dist/{v4-engine-CF9zt4Cw.mjs → v4-engine-C3qSwQ-e.mjs} +7 -27
- package/dist/{v4-engine-D4ubP7N5.js → v4-engine-ON_oSLfO.js} +5 -31
- package/dist/{vite-CPO83EhA.mjs → vite-CXmUiI9f.mjs} +734 -393
- package/dist/{vite-CP0ylSxZ.js → vite-Da4uEG_u.js} +734 -392
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +130 -85
- package/dist/{webpack-BzqhJ8yK.mjs → webpack-CrFZmdo7.mjs} +923 -671
- package/dist/{webpack-Bsek8VhR.js → webpack-Cwqnznng.js} +923 -671
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
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-
|
|
2
|
+
const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
|
|
3
|
+
const require_generator = require("./generator-B6pUjNdD.js");
|
|
4
|
+
const require_context = require("./context-CH4HFZP2.js");
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
|
@@ -132,6 +132,30 @@ function annotateCssSourceTrace(css, options) {
|
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
//#endregion
|
|
135
|
+
//#region src/bundlers/shared/generator-css/class-selectors.ts
|
|
136
|
+
function normalizeCssClassSelector(value) {
|
|
137
|
+
return value.replace(/\\([^\da-f\r\n])/gi, "$1").replace(/\\([\da-f]{1,6})\s?/gi, (_, code) => String.fromCodePoint(Number.parseInt(code, 16)));
|
|
138
|
+
}
|
|
139
|
+
function collectRawSourceClassSelectors(rawSource) {
|
|
140
|
+
const selectors = /* @__PURE__ */ new Set();
|
|
141
|
+
try {
|
|
142
|
+
_weapp_tailwindcss_postcss.postcss.parse(rawSource).walkRules((rule) => {
|
|
143
|
+
for (const selector of rule.selectors ?? [rule.selector]) for (const match of selector.matchAll(/\.((?:\\.|[_a-z\u00A0-\uFFFF-])(?:\\.|[\w\u00A0-\uFFFF-])*)/gi)) selectors.add(normalizeCssClassSelector(match[1]));
|
|
144
|
+
});
|
|
145
|
+
} catch {}
|
|
146
|
+
return selectors;
|
|
147
|
+
}
|
|
148
|
+
function collectGeneratedRawSourceCandidates(candidates, rawSource, escapeMap) {
|
|
149
|
+
const selectors = collectRawSourceClassSelectors(rawSource);
|
|
150
|
+
if (selectors.size === 0) return /* @__PURE__ */ new Set();
|
|
151
|
+
const matched = /* @__PURE__ */ new Set();
|
|
152
|
+
for (const candidate of candidates) {
|
|
153
|
+
const escaped = normalizeCssClassSelector(require_context.replaceWxml(candidate, { escapeMap }));
|
|
154
|
+
if (selectors.has(candidate) || selectors.has(escaped)) matched.add(candidate);
|
|
155
|
+
}
|
|
156
|
+
return matched;
|
|
157
|
+
}
|
|
158
|
+
//#endregion
|
|
135
159
|
//#region src/bundlers/shared/generator-css/generation-helpers.ts
|
|
136
160
|
function hasMiniProgramTailwindV4PreflightReset(css) {
|
|
137
161
|
return /(?:^|[},])\s*view\s*,\s*text\s*,\s*::after\s*,\s*::before\s*\{[^}]*\bborder\s*:\s*0\s+solid\b/.test(css);
|
|
@@ -214,7 +238,7 @@ function shouldUseGeneratorForCurrentCss(_majorVersion, cssHandlerOptions, optio
|
|
|
214
238
|
const hasApplyDirectives = require_v4_engine.hasTailwindApplyDirective(options.rawSource);
|
|
215
239
|
const sourceCss = cssHandlerOptions.sourceOptions?.sourceCss;
|
|
216
240
|
const hasSourceCssDirectives = typeof sourceCss === "string" && (require_v4_engine.hasTailwindRootDirectives(sourceCss, { importFallback: true }) || require_v4_engine.hasTailwindSourceDirectives(sourceCss, { importFallback: true }) || require_v4_engine.hasTailwindApplyDirective(sourceCss));
|
|
217
|
-
return options.forceGenerator === true || options.hasGeneratedCss || options.hasGeneratedMarkers || options.hasSourceDirectives || hasApplyDirectives || hasSourceCssDirectives;
|
|
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;
|
|
218
242
|
}
|
|
219
243
|
function createRuntimeWithCurrentCssCandidates(runtime, currentCssCandidates, isolateCurrentCssCandidates) {
|
|
220
244
|
return isolateCurrentCssCandidates ? new Set(currentCssCandidates) : currentCssCandidates.length > 0 ? new Set([...runtime, ...currentCssCandidates]) : runtime;
|
|
@@ -624,7 +648,7 @@ function collectLocalStyleImportFiles(source, base) {
|
|
|
624
648
|
_weapp_tailwindcss_postcss.postcss.parse(styleSource).walkAtRules("import", (rule) => {
|
|
625
649
|
const request = require_v4_engine.parseImportRequest(rule.params);
|
|
626
650
|
if (!isLocalStyleImportRequest(request)) return;
|
|
627
|
-
const file = resolveLocalStyleImportFile(request, base);
|
|
651
|
+
const file = request ? resolveLocalStyleImportFile(request, base) : void 0;
|
|
628
652
|
if (file) files.push(file);
|
|
629
653
|
});
|
|
630
654
|
} catch {}
|
|
@@ -1885,7 +1909,7 @@ function hasConfiguredContainerCompatSource(source) {
|
|
|
1885
1909
|
if (cssEntrySource?.config) try {
|
|
1886
1910
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(cssEntrySource.config, "utf8"))) return true;
|
|
1887
1911
|
} catch {}
|
|
1888
|
-
if ("config" in source && source.config) try {
|
|
1912
|
+
if ("config" in source && typeof source.config === "string") try {
|
|
1889
1913
|
if (/\bcontainer\b/.test((0, node_fs.readFileSync)(source.config, "utf8"))) return true;
|
|
1890
1914
|
} catch {}
|
|
1891
1915
|
return false;
|
|
@@ -2261,30 +2285,28 @@ function pushConcurrentTaskFactories(queue, factories, limit) {
|
|
|
2261
2285
|
//#endregion
|
|
2262
2286
|
//#region src/bundlers/shared/generator-css/validate.ts
|
|
2263
2287
|
async function validateCandidatesByGenerator(options) {
|
|
2264
|
-
const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState
|
|
2288
|
+
const { candidates, cssHandlerOptions, debug, file, opts, rawSource, runtimeState } = options;
|
|
2265
2289
|
const majorVersion = runtimeState.tailwindRuntime.majorVersion;
|
|
2266
2290
|
if (majorVersion !== 4 || candidates.size === 0) return /* @__PURE__ */ new Set();
|
|
2267
|
-
const
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
const
|
|
2277
|
-
|
|
2278
|
-
if (typeof generator.validateCandidates
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
}));
|
|
2287
|
-
const classSet = new Set(classSets.flatMap((item) => [...item]));
|
|
2291
|
+
const classSet = /* @__PURE__ */ new Set();
|
|
2292
|
+
try {
|
|
2293
|
+
const sources = await resolveGeneratorSources(majorVersion, runtimeState, rawSource, file, cssHandlerOptions, {
|
|
2294
|
+
...require_generator.normalizeWeappTailwindcssGeneratorOptions(opts.generator),
|
|
2295
|
+
bareArbitraryValues: opts.arbitraryValues?.bareArbitraryValues
|
|
2296
|
+
}, {
|
|
2297
|
+
cssEntries: opts.cssEntries,
|
|
2298
|
+
runtime: candidates
|
|
2299
|
+
});
|
|
2300
|
+
const classSets = await Promise.all(sources.map(async (source) => {
|
|
2301
|
+
const generator = require_generator.createWeappTailwindcssGenerator(source);
|
|
2302
|
+
if (typeof generator.validateCandidates !== "function") return /* @__PURE__ */ new Set();
|
|
2303
|
+
return generator.validateCandidates(candidates);
|
|
2304
|
+
}));
|
|
2305
|
+
for (const candidate of classSets.flatMap((item) => [...item])) classSet.add(candidate);
|
|
2306
|
+
} catch {}
|
|
2307
|
+
const rawSourceCandidates = collectGeneratedRawSourceCandidates(candidates, rawSource, opts.escapeMap);
|
|
2308
|
+
for (const candidate of rawSourceCandidates) classSet.add(candidate);
|
|
2309
|
+
for (const generatedCss of options.generatedCssSources ?? []) for (const candidate of collectGeneratedRawSourceCandidates(candidates, generatedCss, opts.escapeMap)) classSet.add(candidate);
|
|
2288
2310
|
debug("tailwind generator validated candidates: %s candidates=%d classSet=%d", file, candidates.size, classSet.size);
|
|
2289
2311
|
return classSet;
|
|
2290
2312
|
}
|
|
@@ -2322,6 +2344,14 @@ function isCssAlreadyRepresentedByMarkers(css, source) {
|
|
|
2322
2344
|
for (const marker of sourceMarkers) if (!cssMarkers.has(marker)) return false;
|
|
2323
2345
|
return true;
|
|
2324
2346
|
}
|
|
2347
|
+
function mergeGeneratedCssClassSet(classSet, candidates, css, escapeMap) {
|
|
2348
|
+
const merged = new Set(classSet);
|
|
2349
|
+
for (const candidate of collectGeneratedRawSourceCandidates(candidates, css, escapeMap)) merged.add(candidate);
|
|
2350
|
+
return merged;
|
|
2351
|
+
}
|
|
2352
|
+
function finalizeWebGeneratorCss(css, target, webCompat) {
|
|
2353
|
+
return target === "web" ? (0, _weapp_tailwindcss_postcss.transformWebCssCompat)(css, webCompat) : css;
|
|
2354
|
+
}
|
|
2325
2355
|
async function generateCssByGenerator(options) {
|
|
2326
2356
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
2327
2357
|
const generatorOptions = {
|
|
@@ -2344,12 +2374,17 @@ async function generateCssByGenerator(options) {
|
|
|
2344
2374
|
const effectiveRawSource = stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(rawSource, { importFallback: generatorOptions.importFallback })));
|
|
2345
2375
|
const localImportParts = splitLocalCssImports(effectiveRawSource);
|
|
2346
2376
|
const localImports = options.restoreLocalCssImports === false ? void 0 : localImportParts?.imports;
|
|
2377
|
+
const finalizeGeneratorCss = (css, target, finalizeOptions = {}) => {
|
|
2378
|
+
return finalizeWebGeneratorCss(restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, target, majorVersion, opts.cssPreflight, finalizeOptions), localImports), target, generatorOptions.webCompat);
|
|
2379
|
+
};
|
|
2347
2380
|
const generatorRawSource = localImportParts?.source ?? effectiveRawSource;
|
|
2348
2381
|
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
2349
2382
|
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
2350
2383
|
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
2351
|
-
const
|
|
2352
|
-
const
|
|
2384
|
+
const generatedUserCssOrderSource = require_v4_engine.hasTailwindGeneratedCss(userSource) ? require_v4_engine.splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
2385
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? require_v4_engine.createCssAppend(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : require_v4_engine.hasTailwindGeneratedCss(userSource) ? "" : userCssRawSource;
|
|
2386
|
+
const userCssOrderSource = require_v4_engine.GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : require_v4_engine.hasTailwindGeneratedCss(userSource) ? userSource : generatedUserCssRawSource;
|
|
2387
|
+
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
2353
2388
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
2354
2389
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
2355
2390
|
css: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
@@ -2371,7 +2406,10 @@ async function generateCssByGenerator(options) {
|
|
|
2371
2406
|
hasGeneratedCss,
|
|
2372
2407
|
hasGeneratedMarkers,
|
|
2373
2408
|
hasSourceDirectives,
|
|
2374
|
-
rawSource: generatorRawSource
|
|
2409
|
+
rawSource: generatorRawSource,
|
|
2410
|
+
runtimeCandidateCount: runtime.size,
|
|
2411
|
+
target: generatorOptions.target,
|
|
2412
|
+
configuredCssSourceCount: options.cssSources?.length
|
|
2375
2413
|
})) return;
|
|
2376
2414
|
try {
|
|
2377
2415
|
await runtimeState.readyPromise;
|
|
@@ -2427,12 +2465,13 @@ async function generateCssByGenerator(options) {
|
|
|
2427
2465
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2428
2466
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2429
2467
|
const incrementalCss = require_v4_engine.stripTailwindBanner(generated.incrementalCss);
|
|
2468
|
+
const finalCss = finalizeWebGeneratorCss(restoreLocalCssImports(incrementalCss.trim().length > 0 ? require_v4_engine.createCssAppend(options.previousCss, finalizeMiniProgramGeneratorCss(incrementalCss, generated.target, majorVersion, opts.cssPreflight, {
|
|
2469
|
+
injectPreflight: false,
|
|
2470
|
+
styleOptions: generatorStyleOptions
|
|
2471
|
+
})) : options.previousCss, localImports), generated.target, generatorOptions.webCompat);
|
|
2430
2472
|
return {
|
|
2431
|
-
css:
|
|
2432
|
-
|
|
2433
|
-
styleOptions: generatorStyleOptions
|
|
2434
|
-
})) : options.previousCss, localImports),
|
|
2435
|
-
classSet: generated.classSet,
|
|
2473
|
+
css: finalCss,
|
|
2474
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2436
2475
|
target: generated.target,
|
|
2437
2476
|
source: "generator",
|
|
2438
2477
|
dependencies: generated.dependencies,
|
|
@@ -2485,28 +2524,29 @@ async function generateCssByGenerator(options) {
|
|
|
2485
2524
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
2486
2525
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2487
2526
|
}
|
|
2488
|
-
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(
|
|
2489
|
-
const userCss = await transformGeneratorUserCss(
|
|
2490
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2527
|
+
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
2528
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, userCssOptions);
|
|
2529
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2491
2530
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2492
2531
|
}
|
|
2493
2532
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
2494
2533
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2495
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
2496
|
-
css = await appendLegacyCompatCss(css,
|
|
2497
|
-
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css,
|
|
2534
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2535
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2536
|
+
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2498
2537
|
}
|
|
2499
2538
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2539
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2540
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2541
|
+
cssHandlerOptions,
|
|
2542
|
+
isolateCurrentCssCandidates,
|
|
2543
|
+
localImports
|
|
2544
|
+
}),
|
|
2545
|
+
styleOptions: generatorStyleOptions
|
|
2546
|
+
});
|
|
2500
2547
|
return {
|
|
2501
|
-
css:
|
|
2502
|
-
|
|
2503
|
-
cssHandlerOptions,
|
|
2504
|
-
isolateCurrentCssCandidates,
|
|
2505
|
-
localImports
|
|
2506
|
-
}),
|
|
2507
|
-
styleOptions: generatorStyleOptions
|
|
2508
|
-
}), localImports),
|
|
2509
|
-
classSet: generated.classSet,
|
|
2548
|
+
css: finalCss,
|
|
2549
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2510
2550
|
target: generated.target,
|
|
2511
2551
|
source: "generator",
|
|
2512
2552
|
dependencies: generated.dependencies,
|
|
@@ -2519,7 +2559,7 @@ async function generateCssByGenerator(options) {
|
|
|
2519
2559
|
}
|
|
2520
2560
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
2521
2561
|
let css = generatedCss;
|
|
2522
|
-
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(
|
|
2562
|
+
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2523
2563
|
generatorTarget: generated.target,
|
|
2524
2564
|
generatorStyleOptions,
|
|
2525
2565
|
cssUserHandlerOptions,
|
|
@@ -2551,7 +2591,7 @@ async function generateCssByGenerator(options) {
|
|
|
2551
2591
|
}
|
|
2552
2592
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
2553
2593
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2554
|
-
const userCss = await transformGeneratorUserCss(
|
|
2594
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2555
2595
|
generatorTarget: generated.target,
|
|
2556
2596
|
generatorStyleOptions,
|
|
2557
2597
|
cssUserHandlerOptions,
|
|
@@ -2559,9 +2599,9 @@ async function generateCssByGenerator(options) {
|
|
|
2559
2599
|
importFallback: generatorOptions.importFallback,
|
|
2560
2600
|
processed: userRawSourceProcessed
|
|
2561
2601
|
});
|
|
2562
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2602
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2563
2603
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2564
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers) {
|
|
2604
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
2565
2605
|
const userCss = await transformGeneratorUserCss(removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource), {
|
|
2566
2606
|
generatorTarget: generated.target,
|
|
2567
2607
|
generatorStyleOptions,
|
|
@@ -2572,8 +2612,8 @@ async function generateCssByGenerator(options) {
|
|
|
2572
2612
|
});
|
|
2573
2613
|
const missingUserCss = (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
2574
2614
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2575
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(
|
|
2576
|
-
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(
|
|
2615
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(generatedUserCssRawSource)) {
|
|
2616
|
+
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(generatedUserCssRawSource).layer, {
|
|
2577
2617
|
generatorTarget: generated.target,
|
|
2578
2618
|
generatorStyleOptions,
|
|
2579
2619
|
cssUserHandlerOptions,
|
|
@@ -2587,13 +2627,13 @@ async function generateCssByGenerator(options) {
|
|
|
2587
2627
|
}
|
|
2588
2628
|
}
|
|
2589
2629
|
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
2590
|
-
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed) css = await appendLegacyContainerCompatCss(css,
|
|
2630
|
+
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2591
2631
|
}
|
|
2592
2632
|
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
2593
2633
|
hasSourceDirectives,
|
|
2594
2634
|
hasMatchedCssSourceFile
|
|
2595
2635
|
})) {
|
|
2596
|
-
const userCss = await transformGeneratorUserCss(
|
|
2636
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2597
2637
|
generatorTarget: generated.target,
|
|
2598
2638
|
generatorStyleOptions,
|
|
2599
2639
|
cssUserHandlerOptions,
|
|
@@ -2604,16 +2644,17 @@ async function generateCssByGenerator(options) {
|
|
|
2604
2644
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
2605
2645
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2606
2646
|
}
|
|
2647
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2648
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2649
|
+
cssHandlerOptions,
|
|
2650
|
+
isolateCurrentCssCandidates,
|
|
2651
|
+
localImports
|
|
2652
|
+
}),
|
|
2653
|
+
styleOptions: generatorStyleOptions
|
|
2654
|
+
});
|
|
2607
2655
|
return {
|
|
2608
|
-
css:
|
|
2609
|
-
|
|
2610
|
-
cssHandlerOptions,
|
|
2611
|
-
isolateCurrentCssCandidates,
|
|
2612
|
-
localImports
|
|
2613
|
-
}),
|
|
2614
|
-
styleOptions: generatorStyleOptions
|
|
2615
|
-
}), localImports),
|
|
2616
|
-
classSet: generated.classSet,
|
|
2656
|
+
css: finalCss,
|
|
2657
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2617
2658
|
target: generated.target,
|
|
2618
2659
|
source: "generator",
|
|
2619
2660
|
dependencies: generated.dependencies,
|
|
@@ -2624,12 +2665,12 @@ async function generateCssByGenerator(options) {
|
|
|
2624
2665
|
}
|
|
2625
2666
|
};
|
|
2626
2667
|
}
|
|
2627
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
2628
|
-
css = await appendLegacyCompatCss(css,
|
|
2629
|
-
css = await appendLegacyContainerCompatCss(css,
|
|
2668
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2669
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2670
|
+
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2630
2671
|
}
|
|
2631
|
-
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(
|
|
2632
|
-
const userCss = await transformGeneratorUserCss(
|
|
2672
|
+
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
2673
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2633
2674
|
generatorTarget: generated.target,
|
|
2634
2675
|
generatorStyleOptions,
|
|
2635
2676
|
cssUserHandlerOptions,
|
|
@@ -2637,19 +2678,20 @@ async function generateCssByGenerator(options) {
|
|
|
2637
2678
|
importFallback: generatorOptions.importFallback,
|
|
2638
2679
|
processed: userRawSourceProcessed
|
|
2639
2680
|
});
|
|
2640
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2681
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2641
2682
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2642
2683
|
}
|
|
2684
|
+
const finalCss = finalizeGeneratorCss(css, generated.target, {
|
|
2685
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2686
|
+
cssHandlerOptions,
|
|
2687
|
+
isolateCurrentCssCandidates,
|
|
2688
|
+
localImports
|
|
2689
|
+
}),
|
|
2690
|
+
styleOptions: generatorStyleOptions
|
|
2691
|
+
});
|
|
2643
2692
|
return {
|
|
2644
|
-
css:
|
|
2645
|
-
|
|
2646
|
-
cssHandlerOptions,
|
|
2647
|
-
isolateCurrentCssCandidates,
|
|
2648
|
-
localImports
|
|
2649
|
-
}),
|
|
2650
|
-
styleOptions: generatorStyleOptions
|
|
2651
|
-
}), localImports),
|
|
2652
|
-
classSet: generated.classSet,
|
|
2693
|
+
css: finalCss,
|
|
2694
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2653
2695
|
target: generated.target,
|
|
2654
2696
|
source: "generator",
|
|
2655
2697
|
dependencies: generated.dependencies,
|
|
@@ -3603,12 +3645,24 @@ Object.defineProperty(exports, "pushConcurrentTaskFactories", {
|
|
|
3603
3645
|
return pushConcurrentTaskFactories;
|
|
3604
3646
|
}
|
|
3605
3647
|
});
|
|
3648
|
+
Object.defineProperty(exports, "removeGeneratedSelectorCompatCss", {
|
|
3649
|
+
enumerable: true,
|
|
3650
|
+
get: function() {
|
|
3651
|
+
return removeGeneratedSelectorCompatCss;
|
|
3652
|
+
}
|
|
3653
|
+
});
|
|
3606
3654
|
Object.defineProperty(exports, "removeMiniProgramHoverSelectors", {
|
|
3607
3655
|
enumerable: true,
|
|
3608
3656
|
get: function() {
|
|
3609
3657
|
return removeMiniProgramHoverSelectors;
|
|
3610
3658
|
}
|
|
3611
3659
|
});
|
|
3660
|
+
Object.defineProperty(exports, "removeTailwindV4GeneratedUserCssArtifacts", {
|
|
3661
|
+
enumerable: true,
|
|
3662
|
+
get: function() {
|
|
3663
|
+
return removeTailwindV4GeneratedUserCssArtifacts;
|
|
3664
|
+
}
|
|
3665
|
+
});
|
|
3612
3666
|
Object.defineProperty(exports, "removeTailwindV4GeneratorAtRules", {
|
|
3613
3667
|
enumerable: true,
|
|
3614
3668
|
get: function() {
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
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-B6pUjNdD.js");
|
|
4
|
+
const require_gulp = require("./gulp-BBCeA7ky.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-Da4uEG_u.js");
|
|
7
|
+
const require_webpack = require("./webpack-Cwqnznng.js");
|
|
8
8
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
9
9
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
10
10
|
exports.createPlugins = require_gulp.createPlugins;
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
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-
|
|
2
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-BsPIaLtV.mjs";
|
|
3
|
+
import { t as createPlugins } from "./gulp-CTdcASq8.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-CXmUiI9f.mjs";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-CrFZmdo7.mjs";
|
|
7
7
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
|
|
8
8
|
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
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-ON_oSLfO.js");
|
|
6
|
+
const require_generator = require("./generator-B6pUjNdD.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-C3qSwQ-e.mjs";
|
|
2
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator } from "./generator-BsPIaLtV.mjs";
|
|
3
3
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
4
4
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
5
5
|
createGenerator: (source) => {
|
package/dist/presets.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
3
|
-
const require_v4_engine = require("./v4-engine-
|
|
3
|
+
const require_v4_engine = require("./v4-engine-ON_oSLfO.js");
|
|
4
4
|
const require_utils = require("./utils-BCa37Wqj.js");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
|
|
6
6
|
require("./logger-TlKT3xmR.js");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_chunk.__toESM(node_path);
|
package/dist/presets.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { st as omitUndefined } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
2
|
import { n as defuOverrideArray, o as resolveUniUtsPlatform } from "./utils-DodxWHGz.mjs";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-B5mRo0-M.mjs";
|
|
4
4
|
import { t as logger } from "./logger-BNzxZbZj.mjs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require("./chunk-emK7D4bc.js");
|
|
2
|
-
const require_context = require("./context-
|
|
3
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
4
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
2
|
+
const require_context = require("./context-CH4HFZP2.js");
|
|
3
|
+
const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
|
|
4
|
+
const require_hmr_timing = require("./hmr-timing-Da1eI8S0.js");
|
|
5
5
|
let node_path = require("node:path");
|
|
6
6
|
node_path = require_chunk.__toESM(node_path);
|
|
7
7
|
let node_process = require("node:process");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-
|
|
3
|
-
import { u as generateCssByGenerator } from "./hmr-timing-
|
|
1
|
+
import { g as traverse, h as babelParse, o as Parser } from "./context-C-r8ki7x.mjs";
|
|
2
|
+
import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-B5mRo0-M.mjs";
|
|
3
|
+
import { u as generateCssByGenerator } from "./hmr-timing-BRx-KnBh.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
@@ -76,6 +76,7 @@ export interface TailwindcssExtractOptions extends ExtractOptions {
|
|
|
76
76
|
export interface TailwindcssExtractResult {
|
|
77
77
|
classList: string[];
|
|
78
78
|
classSet: Set<string>;
|
|
79
|
+
filename?: string | undefined;
|
|
79
80
|
}
|
|
80
81
|
export interface TailwindContentTokenReport {
|
|
81
82
|
entries: unknown[];
|
|
@@ -1,17 +1,8 @@
|
|
|
1
|
-
import type { TailwindV4SourceOptions, TailwindV4SourceOptionsWithSources } from './types';
|
|
1
|
+
import type { TailwindV4ResolvedSource, TailwindV4SourceOptions, TailwindV4SourceOptionsWithSources } from './types';
|
|
2
2
|
import type { TailwindcssRuntimeLike } from '../../types';
|
|
3
|
-
export declare function normalizeTailwindV4SourceOptions(options: TailwindV4SourceOptions | undefined): TailwindV4SourceOptions |
|
|
4
|
-
cssSources: import("@tailwindcss-mangle/engine").TailwindV4CssSource[] | undefined;
|
|
5
|
-
cssEntries?: string[];
|
|
6
|
-
css: string | undefined;
|
|
7
|
-
projectRoot?: string;
|
|
8
|
-
cwd?: string;
|
|
9
|
-
base?: string;
|
|
10
|
-
baseFallbacks?: string[];
|
|
11
|
-
packageName?: string;
|
|
12
|
-
} | undefined;
|
|
3
|
+
export declare function normalizeTailwindV4SourceOptions(options: TailwindV4SourceOptions | undefined): import("@tailwindcss-mangle/engine").TailwindV4SourceOptions | undefined;
|
|
13
4
|
export declare function resolveTailwindV4SourceOptionsFromRuntime(runtime: TailwindcssRuntimeLike): TailwindV4SourceOptionsWithSources;
|
|
14
|
-
export declare function resolveTailwindV4Source(options?: TailwindV4SourceOptions): Promise<
|
|
5
|
+
export declare function resolveTailwindV4Source(options?: TailwindV4SourceOptions): Promise<TailwindV4ResolvedSource>;
|
|
15
6
|
export declare function resolveTailwindV4SourceFromRuntimeOptions(options?: {
|
|
16
7
|
projectRoot?: string;
|
|
17
8
|
tailwindcss?: {
|
|
@@ -20,5 +11,5 @@ export declare function resolveTailwindV4SourceFromRuntimeOptions(options?: {
|
|
|
20
11
|
config?: string;
|
|
21
12
|
v4?: TailwindV4SourceOptions;
|
|
22
13
|
};
|
|
23
|
-
}): Promise<
|
|
24
|
-
export declare function resolveTailwindV4SourceFromRuntime(runtime: TailwindcssRuntimeLike): Promise<
|
|
14
|
+
}): Promise<TailwindV4ResolvedSource>;
|
|
15
|
+
export declare function resolveTailwindV4SourceFromRuntime(runtime: TailwindcssRuntimeLike): Promise<TailwindV4ResolvedSource>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { TailwindV4Engine as EngineTailwindV4Engine, TailwindV4GenerateOptions as EngineTailwindV4GenerateOptions, TailwindV4GenerateResult as EngineTailwindV4GenerateResult,
|
|
1
|
+
import type { TailwindV4Engine as EngineTailwindV4Engine, TailwindV4GenerateOptions as EngineTailwindV4GenerateOptions, TailwindV4GenerateResult as EngineTailwindV4GenerateResult, TailwindV4ResolvedSource as EngineTailwindV4ResolvedSource, TailwindV4SourceOptions as EngineTailwindV4SourceOptions, TailwindV4CandidateSource, TailwindV4DesignSystem } from '@tailwindcss-mangle/engine';
|
|
2
2
|
import type { IStyleHandlerOptions } from '@weapp-tailwindcss/postcss/types';
|
|
3
3
|
export type TailwindV4GenerateTarget = 'weapp' | 'web';
|
|
4
4
|
export interface TailwindV4SourcePattern {
|
|
@@ -7,6 +7,14 @@ export interface TailwindV4SourcePattern {
|
|
|
7
7
|
negated: boolean;
|
|
8
8
|
}
|
|
9
9
|
type TailwindV4EngineGenerateOptions = Omit<EngineTailwindV4GenerateOptions, 'target' | 'styleOptions' | 'scanSources' | 'bareArbitraryValues'>;
|
|
10
|
+
export type TailwindV4SourceOptions = EngineTailwindV4SourceOptions;
|
|
11
|
+
export type TailwindV4CssSource = NonNullable<TailwindV4SourceOptions['cssSources']>[number];
|
|
12
|
+
export interface TailwindV4ResolvedSource extends EngineTailwindV4ResolvedSource {
|
|
13
|
+
cwd?: string | undefined;
|
|
14
|
+
projectRoot: string;
|
|
15
|
+
cssSources?: TailwindV4CssSource[] | undefined;
|
|
16
|
+
sources?: TailwindV4SourcePattern[] | undefined;
|
|
17
|
+
}
|
|
10
18
|
export interface TailwindV4GenerateOptions extends TailwindV4EngineGenerateOptions {
|
|
11
19
|
incrementalCache?: boolean | undefined;
|
|
12
20
|
bareArbitraryValues?: EngineTailwindV4GenerateOptions['bareArbitraryValues'] | undefined;
|
|
@@ -28,4 +36,4 @@ export interface TailwindV4Engine extends Omit<EngineTailwindV4Engine, 'generate
|
|
|
28
36
|
source: TailwindV4ResolvedSource;
|
|
29
37
|
generate: (options?: TailwindV4GenerateOptions) => Promise<TailwindV4GenerateResult>;
|
|
30
38
|
}
|
|
31
|
-
export type { TailwindV4CandidateSource, TailwindV4DesignSystem,
|
|
39
|
+
export type { TailwindV4CandidateSource, TailwindV4DesignSystem, };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as normalizeLegacyContentEntries, X as createTailwindSourceEntryMatcher, Y as FULL_SOURCE_SCAN_PATTERN, Z as expandTailwindSourceEntries, _ as resolveTailwindcssOptions, a as filterTailwindV4CssSourceRoots, at as collectCssInlineSourceCandidates, c as groupCssEntriesByBase, d as normalizeCssEntries, et as parseConfigParam, f as findNearestPackageRoot, g as normalizeTailwindcssRuntimeOptions, h as normalizeExtendLengthUnits, i as resolveTailwindV4SourceOptionsFromRuntime, l as guessBasedirFromEntries, lt as loadTailwindV4DesignSystem, m as findWorkspaceRoot, n as resolveTailwindV4SourceFromRuntime, o as hasConfiguredTailwindV4CssRoots, p as findWorkspacePackageDir, rt as resolveTailwindV4CssSourceBase, st as omitUndefined, tt as resolveCssSourceEntries, u as isTailwindV4CssEntry, v as normalizeStringListOption } from "./v4-engine-C3qSwQ-e.mjs";
|
|
2
2
|
import { n as defuOverrideArray$1 } from "./utils-DodxWHGz.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import process from "node:process";
|
|
7
|
-
import { extractProjectCandidatesWithPositions } from "@tailwindcss-mangle/engine";
|
|
7
|
+
import { extractProjectCandidatesWithPositions, resolveValidTailwindV4Candidates } from "@tailwindcss-mangle/engine";
|
|
8
8
|
import { postcss } from "@weapp-tailwindcss/postcss";
|
|
9
9
|
import { stat } from "node:fs/promises";
|
|
10
10
|
import { defuOverrideArray } from "@weapp-tailwindcss/shared";
|
|
@@ -491,12 +491,14 @@ async function resolveViteSourceScanEntries(options, runtime, scanOptions = {})
|
|
|
491
491
|
}
|
|
492
492
|
}
|
|
493
493
|
const cssSourceInlineCandidates = mergeTailwindInlineSourceCandidates(cssInlineCandidates);
|
|
494
|
-
const
|
|
495
|
-
|
|
494
|
+
const cssSourceCount = (sourceOptions.cssSources?.length ?? 0) + configuredCssSources.length;
|
|
495
|
+
const cssSourceScanEntries = createMergedCssEntrySourceScanEntries(entries, { sourceCount: cssSourceCount });
|
|
496
|
+
if (cssSourceScanEntries.length > 0 || cssSourceInlineCandidates || explicit) return createResolvedViteSourceScan({
|
|
496
497
|
entries: explicit ? cssSourceScanEntries : cssSourceScanEntries.length > 0 ? cssSourceScanEntries : void 0,
|
|
497
498
|
explicit,
|
|
498
499
|
inlineCandidates: cssSourceInlineCandidates
|
|
499
500
|
}, dependencies);
|
|
501
|
+
if (cssSourceCount > 0) return;
|
|
500
502
|
const source = await resolveTailwindV4SourceFromRuntime(runtime);
|
|
501
503
|
addSourceScanDependency(dependencies, source.file);
|
|
502
504
|
addSourceScanDependencies(dependencies, source.dependencies);
|
|
@@ -940,9 +942,12 @@ function createEngineTailwindcssRuntime(options) {
|
|
|
940
942
|
}
|
|
941
943
|
async function collectClassSet() {
|
|
942
944
|
const report = await collectContentTokens();
|
|
943
|
-
const
|
|
945
|
+
const rawCandidates = new Set(report.entries.map((entry) => {
|
|
944
946
|
return typeof entry === "string" ? entry : entry.rawCandidate;
|
|
945
947
|
}).filter((entry) => typeof entry === "string" && entry.length > 0));
|
|
948
|
+
const source = await resolveTailwindV4SourceFromRuntime(runtime);
|
|
949
|
+
const designSystem = await loadTailwindV4DesignSystem(source);
|
|
950
|
+
const candidates = new Set(resolveValidTailwindV4Candidates(designSystem, rawCandidates, { ...source.bareArbitraryValues === void 0 ? {} : { bareArbitraryValues: source.bareArbitraryValues } }));
|
|
946
951
|
await collectTailwindV4CssCandidates(candidates);
|
|
947
952
|
return applyClassSetFilter(candidates);
|
|
948
953
|
}
|
|
@@ -968,12 +973,12 @@ function createEngineTailwindcssRuntime(options) {
|
|
|
968
973
|
baseFallbacks: source.baseFallbacks,
|
|
969
974
|
css: source.css,
|
|
970
975
|
cwd: source.projectRoot,
|
|
971
|
-
sources: source.sources
|
|
976
|
+
...source.sources === void 0 ? {} : { sources: source.sources }
|
|
972
977
|
});
|
|
973
978
|
return {
|
|
974
979
|
entries: report.entries,
|
|
975
980
|
filesScanned: report.filesScanned,
|
|
976
|
-
sources: source.sources,
|
|
981
|
+
sources: source.sources ?? [],
|
|
977
982
|
skippedFiles: report.skippedFiles
|
|
978
983
|
};
|
|
979
984
|
}
|