weapp-tailwindcss 5.1.0 → 5.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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-BHxLe743.js → context-B6hVF7dr.js} +20 -9
- package/dist/{context-Mbzkek1q.mjs → context-DlpKD7aN.mjs} +15 -10
- 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/types.d.ts +1 -1
- package/dist/{generator-9rUz4Hcb.js → generator-6oMJtTDO.js} +1 -1
- package/dist/{generator-Dc4qaPmT.mjs → generator-CjzBK7h-.mjs} +1 -1
- package/dist/generator.js +2 -2
- package/dist/generator.mjs +2 -2
- package/dist/{gulp-B_sdP6dx.js → gulp-BtGq6LP9.js} +11 -9
- package/dist/{gulp-uM36oIJs.mjs → gulp-DNU10Vtc.mjs} +11 -9
- package/dist/gulp.js +1 -1
- package/dist/gulp.mjs +1 -1
- package/dist/{hmr-timing-BXMLsF4b.mjs → hmr-timing-B0KuWDjV.mjs} +121 -85
- package/dist/{hmr-timing-CogqkFaF.js → hmr-timing-CegXR9O4.js} +132 -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-Cvb5z1ha.mjs → source-candidate-scan-signature-B5af2Ahe.mjs} +3 -3
- package/dist/{source-candidate-scan-signature-2ybpptAK.js → source-candidate-scan-signature-BKYb9jxa.js} +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-tExdt40m.mjs → transform-fRBeuuK-.mjs} +1 -1
- package/dist/{transform-CQVOgmzM.js → transform-vLwZpiTE.js} +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-CWRooooa.mjs} +730 -393
- package/dist/{vite-CP0ylSxZ.js → vite-w-RkgaTY.js} +730 -392
- package/dist/vite.js +1 -1
- package/dist/vite.mjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.js +122 -85
- package/dist/{webpack-BzqhJ8yK.mjs → webpack-8PaV1gG3.mjs} +923 -671
- package/dist/{webpack-Bsek8VhR.js → webpack-CGgBOx9l.js} +923 -671
- package/dist/webpack.js +1 -1
- package/dist/webpack.mjs +1 -1
- package/package.json +5 -5
|
@@ -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-6oMJtTDO.js");
|
|
4
|
+
const require_context = require("./context-B6hVF7dr.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,11 @@ 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
|
+
}
|
|
2325
2352
|
async function generateCssByGenerator(options) {
|
|
2326
2353
|
const { opts, runtimeState, runtime, rawSource, file, cssHandlerOptions, cssUserHandlerOptions, getSourceCandidatesForEntries, styleHandler, userRawSource, userRawSourceProcessed, debug } = options;
|
|
2327
2354
|
const generatorOptions = {
|
|
@@ -2348,8 +2375,10 @@ async function generateCssByGenerator(options) {
|
|
|
2348
2375
|
const rawUserSource = userRawSource === void 0 ? generatorRawSource : userRawSourceProcessed ? userRawSource : stripUnmatchedTailwindSourceMediaCloseFragments(stripTailwindSourceMediaFragments(require_v4_engine.normalizeTailwindSourceDirectives(userRawSource, { importFallback: generatorOptions.importFallback })));
|
|
2349
2376
|
const userSource = splitLocalCssImports(rawUserSource)?.source ?? rawUserSource;
|
|
2350
2377
|
const userCssRawSource = removeTailwindV4GeneratorAtRules(userSource);
|
|
2351
|
-
const
|
|
2352
|
-
const
|
|
2378
|
+
const generatedUserCssOrderSource = require_v4_engine.hasTailwindGeneratedCss(userSource) ? require_v4_engine.splitTailwindV4GeneratedCssBySourceOrder(userSource, generatorRawSource) : void 0;
|
|
2379
|
+
const generatedUserCssRawSource = generatedUserCssOrderSource ? require_v4_engine.createCssAppend(generatedUserCssOrderSource.before, generatedUserCssOrderSource.after) : require_v4_engine.hasTailwindGeneratedCss(userSource) ? "" : userCssRawSource;
|
|
2380
|
+
const userCssOrderSource = require_v4_engine.GENERATOR_PLACEHOLDER_MARKER_RE.test(userSource) ? userSource : require_v4_engine.hasTailwindGeneratedCss(userSource) ? userSource : generatedUserCssRawSource;
|
|
2381
|
+
const hasDistinctUserRawSource = typeof userRawSource === "string" && normalizeCssSourceForCompare(generatedUserCssRawSource) !== normalizeCssSourceForCompare(generatorRawSource);
|
|
2353
2382
|
const cleanedLocalImportWrapper = cleanLocalCssImportWrapperTailwindDirectives(effectiveRawSource);
|
|
2354
2383
|
if (cleanedLocalImportWrapper !== void 0) return {
|
|
2355
2384
|
css: require_generator.shouldUseMiniProgramCssBranch(generatorBranch) ? (0, _weapp_tailwindcss_postcss.removeUnsupportedMiniProgramAtRules)(cleanedLocalImportWrapper) : cleanedLocalImportWrapper,
|
|
@@ -2371,7 +2400,10 @@ async function generateCssByGenerator(options) {
|
|
|
2371
2400
|
hasGeneratedCss,
|
|
2372
2401
|
hasGeneratedMarkers,
|
|
2373
2402
|
hasSourceDirectives,
|
|
2374
|
-
rawSource: generatorRawSource
|
|
2403
|
+
rawSource: generatorRawSource,
|
|
2404
|
+
runtimeCandidateCount: runtime.size,
|
|
2405
|
+
target: generatorOptions.target,
|
|
2406
|
+
configuredCssSourceCount: options.cssSources?.length
|
|
2375
2407
|
})) return;
|
|
2376
2408
|
try {
|
|
2377
2409
|
await runtimeState.readyPromise;
|
|
@@ -2427,12 +2459,13 @@ async function generateCssByGenerator(options) {
|
|
|
2427
2459
|
debug("tailwind generator result: %s rawBytes=%d cssBytes=%d candidates=%d", file, generated.rawCss.length, generated.css.length, generated.classSet.size);
|
|
2428
2460
|
if ((generated.target !== "weapp" || !hasUserCssLayerBlocks(generatorRawSource)) && typeof options.previousCss === "string" && typeof generated.incrementalCss === "string") {
|
|
2429
2461
|
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, {
|
|
2463
|
+
injectPreflight: false,
|
|
2464
|
+
styleOptions: generatorStyleOptions
|
|
2465
|
+
})) : options.previousCss, localImports);
|
|
2430
2466
|
return {
|
|
2431
|
-
css:
|
|
2432
|
-
|
|
2433
|
-
styleOptions: generatorStyleOptions
|
|
2434
|
-
})) : options.previousCss, localImports),
|
|
2435
|
-
classSet: generated.classSet,
|
|
2467
|
+
css: finalCss,
|
|
2468
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2436
2469
|
target: generated.target,
|
|
2437
2470
|
source: "generator",
|
|
2438
2471
|
dependencies: generated.dependencies,
|
|
@@ -2485,28 +2518,29 @@ async function generateCssByGenerator(options) {
|
|
|
2485
2518
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
2486
2519
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2487
2520
|
}
|
|
2488
|
-
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(
|
|
2489
|
-
const userCss = await transformGeneratorUserCss(
|
|
2490
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2521
|
+
if (generated.target === "weapp" && isEmptyCssSourceOrderParts(orderedExtraCss) && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
2522
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, userCssOptions);
|
|
2523
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2491
2524
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2492
2525
|
}
|
|
2493
2526
|
if (generated.target === "weapp" && shouldAppendMatchedCssSourceCompat) {
|
|
2494
2527
|
if (shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2495
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
2496
|
-
css = await appendLegacyCompatCss(css,
|
|
2497
|
-
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css,
|
|
2528
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2529
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2530
|
+
if (!isolateCurrentCssCandidates) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2498
2531
|
}
|
|
2499
2532
|
} else if (generated.target === "weapp" && shouldFinalizeMarkedUserLayerComponentsCss(file)) css = reorderMarkedUserLayerComponentsCss(css);
|
|
2533
|
+
const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
|
|
2534
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2535
|
+
cssHandlerOptions,
|
|
2536
|
+
isolateCurrentCssCandidates,
|
|
2537
|
+
localImports
|
|
2538
|
+
}),
|
|
2539
|
+
styleOptions: generatorStyleOptions
|
|
2540
|
+
}), localImports);
|
|
2500
2541
|
return {
|
|
2501
|
-
css:
|
|
2502
|
-
|
|
2503
|
-
cssHandlerOptions,
|
|
2504
|
-
isolateCurrentCssCandidates,
|
|
2505
|
-
localImports
|
|
2506
|
-
}),
|
|
2507
|
-
styleOptions: generatorStyleOptions
|
|
2508
|
-
}), localImports),
|
|
2509
|
-
classSet: generated.classSet,
|
|
2542
|
+
css: finalCss,
|
|
2543
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2510
2544
|
target: generated.target,
|
|
2511
2545
|
source: "generator",
|
|
2512
2546
|
dependencies: generated.dependencies,
|
|
@@ -2519,7 +2553,7 @@ async function generateCssByGenerator(options) {
|
|
|
2519
2553
|
}
|
|
2520
2554
|
debug("tailwind direct css generation prefix mismatch, append transformed bundle css %s", file);
|
|
2521
2555
|
let css = generatedCss;
|
|
2522
|
-
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(
|
|
2556
|
+
if (generated.target === "weapp" && generatorRawSource.includes("weapp-tailwindcss generator-placeholder") && !hasUserCssLayerBlocks(generatorRawSource)) css = createCssSourceOrderAppend$1(await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2523
2557
|
generatorTarget: generated.target,
|
|
2524
2558
|
generatorStyleOptions,
|
|
2525
2559
|
cssUserHandlerOptions,
|
|
@@ -2551,7 +2585,7 @@ async function generateCssByGenerator(options) {
|
|
|
2551
2585
|
}
|
|
2552
2586
|
if (hasMatchedCssSourceFile || generated.target === "web") {
|
|
2553
2587
|
if (generated.target === "weapp" && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2554
|
-
const userCss = await transformGeneratorUserCss(
|
|
2588
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2555
2589
|
generatorTarget: generated.target,
|
|
2556
2590
|
generatorStyleOptions,
|
|
2557
2591
|
cssUserHandlerOptions,
|
|
@@ -2559,9 +2593,9 @@ async function generateCssByGenerator(options) {
|
|
|
2559
2593
|
importFallback: generatorOptions.importFallback,
|
|
2560
2594
|
processed: userRawSourceProcessed
|
|
2561
2595
|
});
|
|
2562
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2596
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2563
2597
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2564
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers) {
|
|
2598
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasGeneratedMarkers && !hasGeneratedCss) {
|
|
2565
2599
|
const userCss = await transformGeneratorUserCss(removeTailwindV4GeneratedUserCssArtifacts(userCssRawSource), {
|
|
2566
2600
|
generatorTarget: generated.target,
|
|
2567
2601
|
generatorStyleOptions,
|
|
@@ -2572,8 +2606,8 @@ async function generateCssByGenerator(options) {
|
|
|
2572
2606
|
});
|
|
2573
2607
|
const missingUserCss = (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
2574
2608
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2575
|
-
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(
|
|
2576
|
-
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(
|
|
2609
|
+
} else if (hasMatchedCssSourceFile && generated.target === "weapp" && hasUserCssLayerBlocks(generatedUserCssRawSource)) {
|
|
2610
|
+
const layerUserCss = await transformGeneratorUserCss(splitUserCssLayerBlocks(generatedUserCssRawSource).layer, {
|
|
2577
2611
|
generatorTarget: generated.target,
|
|
2578
2612
|
generatorStyleOptions,
|
|
2579
2613
|
cssUserHandlerOptions,
|
|
@@ -2587,13 +2621,13 @@ async function generateCssByGenerator(options) {
|
|
|
2587
2621
|
}
|
|
2588
2622
|
}
|
|
2589
2623
|
if (hasMatchedCssSourceFile && generated.target === "weapp") {
|
|
2590
|
-
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed) css = await appendLegacyContainerCompatCss(css,
|
|
2624
|
+
if (!isolateCurrentCssCandidates && !shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2591
2625
|
}
|
|
2592
2626
|
if (shouldAppendWebBundleCssFallback(generated.target, {
|
|
2593
2627
|
hasSourceDirectives,
|
|
2594
2628
|
hasMatchedCssSourceFile
|
|
2595
2629
|
})) {
|
|
2596
|
-
const userCss = await transformGeneratorUserCss(
|
|
2630
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2597
2631
|
generatorTarget: generated.target,
|
|
2598
2632
|
generatorStyleOptions,
|
|
2599
2633
|
cssUserHandlerOptions,
|
|
@@ -2604,16 +2638,17 @@ async function generateCssByGenerator(options) {
|
|
|
2604
2638
|
const missingUserCss = isCommentOnlyCss(userCss) ? "" : (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss);
|
|
2605
2639
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2606
2640
|
}
|
|
2641
|
+
const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
|
|
2642
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2643
|
+
cssHandlerOptions,
|
|
2644
|
+
isolateCurrentCssCandidates,
|
|
2645
|
+
localImports
|
|
2646
|
+
}),
|
|
2647
|
+
styleOptions: generatorStyleOptions
|
|
2648
|
+
}), localImports);
|
|
2607
2649
|
return {
|
|
2608
|
-
css:
|
|
2609
|
-
|
|
2610
|
-
cssHandlerOptions,
|
|
2611
|
-
isolateCurrentCssCandidates,
|
|
2612
|
-
localImports
|
|
2613
|
-
}),
|
|
2614
|
-
styleOptions: generatorStyleOptions
|
|
2615
|
-
}), localImports),
|
|
2616
|
-
classSet: generated.classSet,
|
|
2650
|
+
css: finalCss,
|
|
2651
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2617
2652
|
target: generated.target,
|
|
2618
2653
|
source: "generator",
|
|
2619
2654
|
dependencies: generated.dependencies,
|
|
@@ -2624,12 +2659,12 @@ async function generateCssByGenerator(options) {
|
|
|
2624
2659
|
}
|
|
2625
2660
|
};
|
|
2626
2661
|
}
|
|
2627
|
-
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed) {
|
|
2628
|
-
css = await appendLegacyCompatCss(css,
|
|
2629
|
-
css = await appendLegacyContainerCompatCss(css,
|
|
2662
|
+
if (!shouldFilterApplyOnlyCss && !userRawSourceProcessed && !hasGeneratedCss && !hasGeneratedMarkers) {
|
|
2663
|
+
css = await appendLegacyCompatCss(css, generatedUserCssRawSource, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2664
|
+
css = await appendLegacyContainerCompatCss(css, generatedUserCssRawSource, file, runtime, configuredContainerCompat, generated.target, styleHandler, cssHandlerOptions, generatorStyleOptions);
|
|
2630
2665
|
}
|
|
2631
|
-
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(
|
|
2632
|
-
const userCss = await transformGeneratorUserCss(
|
|
2666
|
+
if (generated.target === "weapp" && hasDistinctUserRawSource && !hasGeneratedCss && !hasGeneratedMarkers && !require_v4_engine.hasTailwindApplyDirective(generatedUserCssRawSource)) {
|
|
2667
|
+
const userCss = await transformGeneratorUserCss(generatedUserCssRawSource, {
|
|
2633
2668
|
generatorTarget: generated.target,
|
|
2634
2669
|
generatorStyleOptions,
|
|
2635
2670
|
cssUserHandlerOptions,
|
|
@@ -2637,19 +2672,20 @@ async function generateCssByGenerator(options) {
|
|
|
2637
2672
|
importFallback: generatorOptions.importFallback,
|
|
2638
2673
|
processed: userRawSourceProcessed
|
|
2639
2674
|
});
|
|
2640
|
-
const missingUserCss = isCssAlreadyRepresentedByMarkers(css,
|
|
2675
|
+
const missingUserCss = isCssAlreadyRepresentedByMarkers(css, generatedUserCssRawSource) ? (0, _weapp_tailwindcss_postcss.filterExistingCssRules)(css, userCss) : userCss;
|
|
2641
2676
|
css = createCssSourceOrderAppend$1(css, missingUserCss);
|
|
2642
2677
|
}
|
|
2678
|
+
const finalCss = restoreLocalCssImports(finalizeMiniProgramGeneratorCss(css, generated.target, majorVersion, opts.cssPreflight, {
|
|
2679
|
+
injectPreflight: shouldInjectMiniProgramPreflightForGeneratorCss(opts, {
|
|
2680
|
+
cssHandlerOptions,
|
|
2681
|
+
isolateCurrentCssCandidates,
|
|
2682
|
+
localImports
|
|
2683
|
+
}),
|
|
2684
|
+
styleOptions: generatorStyleOptions
|
|
2685
|
+
}), localImports);
|
|
2643
2686
|
return {
|
|
2644
|
-
css:
|
|
2645
|
-
|
|
2646
|
-
cssHandlerOptions,
|
|
2647
|
-
isolateCurrentCssCandidates,
|
|
2648
|
-
localImports
|
|
2649
|
-
}),
|
|
2650
|
-
styleOptions: generatorStyleOptions
|
|
2651
|
-
}), localImports),
|
|
2652
|
-
classSet: generated.classSet,
|
|
2687
|
+
css: finalCss,
|
|
2688
|
+
classSet: mergeGeneratedCssClassSet(generated.classSet, runtimeWithCurrentCss, finalCss, opts.escapeMap),
|
|
2653
2689
|
target: generated.target,
|
|
2654
2690
|
source: "generator",
|
|
2655
2691
|
dependencies: generated.dependencies,
|
|
@@ -3603,12 +3639,24 @@ Object.defineProperty(exports, "pushConcurrentTaskFactories", {
|
|
|
3603
3639
|
return pushConcurrentTaskFactories;
|
|
3604
3640
|
}
|
|
3605
3641
|
});
|
|
3642
|
+
Object.defineProperty(exports, "removeGeneratedSelectorCompatCss", {
|
|
3643
|
+
enumerable: true,
|
|
3644
|
+
get: function() {
|
|
3645
|
+
return removeGeneratedSelectorCompatCss;
|
|
3646
|
+
}
|
|
3647
|
+
});
|
|
3606
3648
|
Object.defineProperty(exports, "removeMiniProgramHoverSelectors", {
|
|
3607
3649
|
enumerable: true,
|
|
3608
3650
|
get: function() {
|
|
3609
3651
|
return removeMiniProgramHoverSelectors;
|
|
3610
3652
|
}
|
|
3611
3653
|
});
|
|
3654
|
+
Object.defineProperty(exports, "removeTailwindV4GeneratedUserCssArtifacts", {
|
|
3655
|
+
enumerable: true,
|
|
3656
|
+
get: function() {
|
|
3657
|
+
return removeTailwindV4GeneratedUserCssArtifacts;
|
|
3658
|
+
}
|
|
3659
|
+
});
|
|
3612
3660
|
Object.defineProperty(exports, "removeTailwindV4GeneratorAtRules", {
|
|
3613
3661
|
enumerable: true,
|
|
3614
3662
|
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-6oMJtTDO.js");
|
|
4
|
+
const require_gulp = require("./gulp-BtGq6LP9.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-w-RkgaTY.js");
|
|
7
|
+
const require_webpack = require("./webpack-CGgBOx9l.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-CjzBK7h-.mjs";
|
|
3
|
+
import { t as createPlugins } from "./gulp-DNU10Vtc.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-CWRooooa.mjs";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-8PaV1gG3.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-6oMJtTDO.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-CjzBK7h-.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,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-DlpKD7aN.mjs";
|
|
2
|
+
import { g as resolveTailwindV4EntriesFromCssCached } from "./tailwindcss-B5mRo0-M.mjs";
|
|
3
|
+
import { u as generateCssByGenerator } from "./hmr-timing-B0KuWDjV.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
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-B6hVF7dr.js");
|
|
3
|
+
const require_tailwindcss = require("./tailwindcss-dbrbY4cd.js");
|
|
4
|
+
const require_hmr_timing = require("./hmr-timing-CegXR9O4.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");
|
|
@@ -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
|
}
|