weapp-tailwindcss 5.2.7 → 5.2.8
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/directives.d.ts +1 -0
- package/dist/bundlers/vite/hot-css-modules.d.ts +5 -3
- package/dist/bundlers/vite/module-identity.d.ts +9 -0
- package/dist/bundlers/vite/processed-css-assets/scoped-tailwind-noise.d.ts +4 -0
- package/dist/bundlers/vite/serve-css-generation.d.ts +1 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +2 -1
- package/dist/bundlers/vite/shared/framework-hmr-candidate-state.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +2 -0
- package/dist/bundlers/vite/shared/framework-strategy.d.ts +4 -0
- package/dist/cli.js +1 -0
- package/dist/{context-YAvTyPV2.js → context-BMkbwnH8.js} +10 -23
- package/dist/{context-OqD_eBxQ.cjs → context-CByXWyhQ.cjs} +179 -25
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{generator-BE34PYSC.cjs → generator-B0dCFlP1.cjs} +10 -0
- package/dist/{generator-DYeAa2-5.js → generator-BLpOsd5O.js} +10 -0
- package/dist/generator.cjs +1 -1
- package/dist/generator.js +1 -1
- package/dist/{gulp-BydhuCbr.js → gulp-BWhCahA2.js} +4 -4
- package/dist/{gulp-Bun9iCRE.cjs → gulp-BdoorWb5.cjs} +7 -7
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-Gs9P-QtZ.js → hmr-timing-CJocHeZr.js} +22 -14
- package/dist/{hmr-timing-D607CWrq.cjs → hmr-timing-DiYnyg_W.cjs} +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.js +4 -4
- package/dist/{options-hVsoTfwL.cjs → options-zpZez7qe.cjs} +1 -1
- package/dist/{pipeline-helpers-BLpoT8fX.cjs → pipeline-helpers-CsNLoEX1.cjs} +3 -3
- package/dist/postcss.cjs +1 -1
- package/dist/postcss.js +1 -1
- package/dist/presets.cjs +2 -2
- package/dist/presets.js +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/{source-candidate-scan-signature-BGDNJE2r.cjs → source-candidate-scan-signature-D9FXTD9a.cjs} +3 -3
- package/dist/{source-candidate-scan-signature-CdjPWQqv.js → source-candidate-scan-signature-of-TmeOs.js} +3 -3
- package/dist/{style-options-B_ppaVIg.cjs → style-options-COpQc8fr.cjs} +2 -2
- package/dist/{tailwindcss-CTpCc_nd.js → tailwindcss-2zdmASlM.js} +1 -1
- package/dist/{tailwindcss-DcpiKvmJ.cjs → tailwindcss-LtnGCxF0.cjs} +2 -2
- package/dist/{transform-BbaPIji9.js → transform-DVGsr8cV.js} +24 -7
- package/dist/{transform-BUEyOCT7.cjs → transform-DzVJW6Dp.cjs} +24 -7
- package/dist/uni-app-x/component-local-style.d.ts +1 -0
- package/dist/uni-app-x/vite/author-apply.d.ts +1 -0
- package/dist/uni-app-x/vite/harmony-apply.d.ts +4 -1
- package/dist/uni-app-x/vite/native-hmr.d.ts +2 -0
- package/dist/uni-app-x/vite/plugin-options.d.ts +27 -0
- package/dist/uni-app-x/vite/style-request.d.ts +3 -0
- package/dist/uni-app-x/vite.d.ts +3 -24
- package/dist/{v4-generation-core-BrkM1vCs.cjs → v4-generation-core-BjHT6qGC.cjs} +22 -14
- package/dist/{vite-DM-U-Ins.js → vite-BJJqWc_F.js} +505 -188
- package/dist/{vite-n0mRgEcF.cjs → vite-V86H6PZa.cjs} +508 -191
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-generation-loader.cjs +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +5 -5
- package/dist/{webpack-BlUJf8Ru.js → webpack-CkeFhPY2.js} +6 -6
- package/dist/{webpack-Bf8yJwTO.cjs → webpack-CzQrloDg.cjs} +9 -9
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/package.json +4 -4
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { $ as hasTailwindSourceDirectives, A as transformGeneratorUserCss, At as toPosixPath, F as stripUnmatchedTailwindSourceMediaCloseFragments, Ft as filterUnsupportedMiniProgramTailwindV4Candidates, G as extractGeneratedCssForUserLayerSelectors, H as filterApplyOnlyGeneratedCss, I as finalizeMiniProgramCss, J as preferScopedGeneratedCssRules, K as hasUserCssLayerBlocks, Lt as loadTailwindV4DesignSystem, N as removeTailwindV4GeneratorAtRules, Ot as resolveSourceScanPath, P as stripTailwindSourceMediaFragments, Q as hasTailwindRootDirectives, U as normalizeEmptyTailwindCustomVariants, V as removeTailwindV4GeneratedUserCssArtifacts, W as shouldFilterApplyOnlyGeneratedCss, X as hasTailwindApplyDirective, _t as normalizeConfigDirective, a as resolveGeneratorRuntimeBranch, at as resolveCssEntrySource, bt as FULL_SOURCE_SCAN_EXTENSION_RE, ct as createCssAppend, d as resolveTailwindV4SourceFromRuntime, dt as splitGeneratorPlaceholderCssBySourceOrder, ft as splitTailwindGeneratedCssByBanner, gt as stripTailwindBanners, ht as stripTailwindBanner, i as normalizeWeappTailwindcssGeneratorOptions, it as removeTailwindSourceDirectives, j as isCommentOnlyCss, kt as resolveTailwindV4CssSourceBase, lt as hasTailwindGeneratedCss, mt as stripGeneratorPlaceholderMarkers, ot as GENERATOR_PLACEHOLDER_MARKER_RE, p as resolveTailwindV4SourceOptionsFromRuntime, pt as splitTailwindV4GeneratedCssBySourceOrder, q as splitUserCssLayerBlocks, rt as parseImportRequest, s as shouldUseMiniProgramCssBranch, st as VITE_MARKER_RE, t as createWeappTailwindcssGenerator, tt as normalizeTailwindSourceDirectives, u as resolveTailwindV4Source$1, ut as hasTailwindGeneratedCssMarkers, vt as prependConfigDirective, wt as isFileMatchedByTailwindSourceEntries, z as removeUnsupportedMiniProgramAtRules } from "./generator-
|
|
1
|
+
import { $ as hasTailwindSourceDirectives, A as transformGeneratorUserCss, At as toPosixPath, F as stripUnmatchedTailwindSourceMediaCloseFragments, Ft as filterUnsupportedMiniProgramTailwindV4Candidates, G as extractGeneratedCssForUserLayerSelectors, H as filterApplyOnlyGeneratedCss, I as finalizeMiniProgramCss, J as preferScopedGeneratedCssRules, K as hasUserCssLayerBlocks, Lt as loadTailwindV4DesignSystem, N as removeTailwindV4GeneratorAtRules, Ot as resolveSourceScanPath, P as stripTailwindSourceMediaFragments, Q as hasTailwindRootDirectives, U as normalizeEmptyTailwindCustomVariants, V as removeTailwindV4GeneratedUserCssArtifacts, W as shouldFilterApplyOnlyGeneratedCss, X as hasTailwindApplyDirective, _t as normalizeConfigDirective, a as resolveGeneratorRuntimeBranch, at as resolveCssEntrySource, bt as FULL_SOURCE_SCAN_EXTENSION_RE, ct as createCssAppend, d as resolveTailwindV4SourceFromRuntime, dt as splitGeneratorPlaceholderCssBySourceOrder, ft as splitTailwindGeneratedCssByBanner, gt as stripTailwindBanners, ht as stripTailwindBanner, i as normalizeWeappTailwindcssGeneratorOptions, it as removeTailwindSourceDirectives, j as isCommentOnlyCss, kt as resolveTailwindV4CssSourceBase, lt as hasTailwindGeneratedCss, mt as stripGeneratorPlaceholderMarkers, ot as GENERATOR_PLACEHOLDER_MARKER_RE, p as resolveTailwindV4SourceOptionsFromRuntime, pt as splitTailwindV4GeneratedCssBySourceOrder, q as splitUserCssLayerBlocks, rt as parseImportRequest, s as shouldUseMiniProgramCssBranch, st as VITE_MARKER_RE, t as createWeappTailwindcssGenerator, tt as normalizeTailwindSourceDirectives, u as resolveTailwindV4Source$1, ut as hasTailwindGeneratedCssMarkers, vt as prependConfigDirective, wt as isFileMatchedByTailwindSourceEntries, z as removeUnsupportedMiniProgramAtRules } from "./generator-BLpOsd5O.js";
|
|
2
2
|
import { o as transformCssMacroCss, r as hasCssMacroTailwindV4InternalAtRules, t as hasCssMacroStyleOptions } from "./auto-2dg_uhEJ.js";
|
|
3
3
|
import { n as _defineProperty, t as omitUndefined } from "./object-Bvy6-w9r.js";
|
|
4
|
-
import { g as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as includesTailwindV4PreflightDirective, y as collectCssInlineSourceCandidates } from "./tailwindcss-
|
|
4
|
+
import { g as resolveTailwindV4EntriesFromCss, l as getRuntimeClassSetSignature, r as isUniAppXEnabled, v as includesTailwindV4PreflightDirective, y as collectCssInlineSourceCandidates } from "./tailwindcss-2zdmASlM.js";
|
|
5
5
|
import { _ as traverse, g as babelParse, h as createDebug, m as replaceWxml, r as createAttributeMatcher, v as md5Hash } from "./wxml-IBzZSaQC.js";
|
|
6
|
-
import { r as resolveStyleOptionsFromContext } from "./context-
|
|
6
|
+
import { r as resolveStyleOptionsFromContext } from "./context-BMkbwnH8.js";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
import path from "node:path";
|
|
9
9
|
import process from "node:process";
|
|
@@ -338,15 +338,17 @@ function createSourceCandidateStore(options = {}) {
|
|
|
338
338
|
}
|
|
339
339
|
async function syncCurrentSource(id, source) {
|
|
340
340
|
const normalizedId = cleanUrl(id);
|
|
341
|
-
transformCandidatesById.delete(normalizedId);
|
|
342
|
-
cssCandidatesById.delete(normalizedId);
|
|
343
|
-
transformSourceById.delete(normalizedId);
|
|
344
|
-
cssSourceById.delete(normalizedId);
|
|
345
|
-
recompute(normalizedId);
|
|
346
341
|
const previousFileCandidates = new Set(candidatesById.get(normalizedId) ?? []);
|
|
347
|
-
const
|
|
342
|
+
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
343
|
+
const nextCandidates = await resolveCandidates(source, extension);
|
|
348
344
|
const affectedCandidates = /* @__PURE__ */ new Set([...previousFileCandidates, ...nextCandidates]);
|
|
349
345
|
const previousVisibleCandidates = collectVisibleCandidates(affectedCandidates);
|
|
346
|
+
if (extension !== "css") {
|
|
347
|
+
transformCandidatesById.delete(normalizedId);
|
|
348
|
+
cssCandidatesById.delete(normalizedId);
|
|
349
|
+
transformSourceById.delete(normalizedId);
|
|
350
|
+
cssSourceById.delete(normalizedId);
|
|
351
|
+
}
|
|
350
352
|
scanSourceById.set(normalizedId, source);
|
|
351
353
|
replaceScanLayer(normalizedId, nextCandidates);
|
|
352
354
|
return diffCandidateSets(previousVisibleCandidates, collectVisibleCandidates(affectedCandidates));
|
|
@@ -3598,14 +3600,17 @@ function collectGeneratorCssCandidates(css) {
|
|
|
3598
3600
|
//#region src/bundlers/shared/generator-css/source-resolver/apply-reference.ts
|
|
3599
3601
|
function resolveTailwindV4ApplyReference(options) {
|
|
3600
3602
|
const references = /* @__PURE__ */ new Set();
|
|
3601
|
-
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" && hasTailwindRootDirectives(source.css, { importFallback: true }) &&
|
|
3603
|
+
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" && hasTailwindRootDirectives(source.css, { importFallback: true }) && hasTailwindApplyContextDirective(source.css)) references.add(source.file);
|
|
3602
3604
|
return references.size === 1 ? references.values().next().value : void 0;
|
|
3603
3605
|
}
|
|
3604
|
-
function
|
|
3606
|
+
function hasTailwindApplyContextDirective(css) {
|
|
3605
3607
|
try {
|
|
3606
3608
|
let found = false;
|
|
3607
|
-
postcss.parse(css).walkAtRules(
|
|
3608
|
-
|
|
3609
|
+
postcss.parse(css).walkAtRules((rule) => {
|
|
3610
|
+
if (rule.name === "theme" || rule.name === "config") {
|
|
3611
|
+
found = true;
|
|
3612
|
+
return false;
|
|
3613
|
+
}
|
|
3609
3614
|
});
|
|
3610
3615
|
return found;
|
|
3611
3616
|
} catch {
|
|
@@ -5231,7 +5236,10 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
5231
5236
|
const sourceCss = options.deferCssAdaptation ? removeMatchingLocalCssImports(source.css, localImports) : source.css;
|
|
5232
5237
|
const generatorSource = options.disableSourceScan === true ? {
|
|
5233
5238
|
...source,
|
|
5234
|
-
css: removeTailwindSourceDirectives(sourceCss, {
|
|
5239
|
+
css: removeTailwindSourceDirectives(sourceCss, {
|
|
5240
|
+
importFallback: generatorOptions.importFallback,
|
|
5241
|
+
preserveApplyContext: true
|
|
5242
|
+
})
|
|
5235
5243
|
} : sourceCss === source.css ? source : {
|
|
5236
5244
|
...source,
|
|
5237
5245
|
css: sourceCss
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
2
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
3
|
+
const require_v4_generation_core = require("./v4-generation-core-BjHT6qGC.cjs");
|
|
4
4
|
const require_wxml = require("./wxml-DSMNuUaP.cjs");
|
|
5
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
5
|
+
const require_tailwindcss = require("./tailwindcss-LtnGCxF0.cjs");
|
|
6
6
|
let node_process = require("node:process");
|
|
7
7
|
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
8
8
|
let _tailwindcss_mangle_engine = require("@tailwindcss-mangle/engine");
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
4
|
-
const require_gulp = require("./gulp-
|
|
3
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
4
|
+
const require_gulp = require("./gulp-BdoorWb5.cjs");
|
|
5
5
|
const require_postcss = require("./postcss.cjs");
|
|
6
|
-
const require_vite = require("./vite-
|
|
7
|
-
const require_webpack = require("./webpack-
|
|
6
|
+
const require_vite = require("./vite-V86H6PZa.cjs");
|
|
7
|
+
const require_webpack = require("./webpack-CzQrloDg.cjs");
|
|
8
8
|
require("./webpack.cjs");
|
|
9
9
|
let _weapp_tailwindcss_postcss = require("@weapp-tailwindcss/postcss");
|
|
10
10
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform } from "./framework.js";
|
|
2
|
-
import { t as createWeappTailwindcssGenerator } from "./generator-
|
|
3
|
-
import { t as createPlugins } from "./gulp-
|
|
2
|
+
import { t as createWeappTailwindcssGenerator } from "./generator-BLpOsd5O.js";
|
|
3
|
+
import { t as createPlugins } from "./gulp-BWhCahA2.js";
|
|
4
4
|
import weappTailwindcssPostcssPlugin from "./postcss.js";
|
|
5
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
6
|
-
import { n as weappTailwindcssPackageDir } from "./webpack-
|
|
5
|
+
import { t as WeappTailwindcss } from "./vite-BJJqWc_F.js";
|
|
6
|
+
import { n as weappTailwindcssPackageDir } from "./webpack-CkeFhPY2.js";
|
|
7
7
|
import "./webpack.js";
|
|
8
8
|
import { unitConversionComposeRules, unitConversionPresets } from "@weapp-tailwindcss/postcss";
|
|
9
9
|
export { WeappTailwindcss, createPlugins, createWeappTailwindcssGenerator, detectAppType, detectAppTypeFromEnv, detectAppTypeFromPackageJson, isMpxPackage, isRunningInHBuilderX, isTaroPackage, isUniAppPackage, isUniAppVitePackage, isUniAppXManifest, isUniAppXPackage, isWeappVitePackage, resolveImplicitAppTypeFromViteRoot, resolveMpxPlatform, resolvePlatform, resolveTaroPlatform, resolveUniAppXPlatform, resolveUniPlatform, resolveUniPlatformsFromEnv, resolveUniUtsPlatform, unitConversionComposeRules, unitConversionPresets, weappTailwindcssPackageDir, weappTailwindcssPostcssPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
3
3
|
let node_fs = require("node:fs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
3
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
2
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
3
|
+
const require_v4_generation_core = require("./v4-generation-core-BjHT6qGC.cjs");
|
|
4
4
|
const require_defaults = require("./defaults.cjs");
|
|
5
|
-
const require_style_options = require("./style-options-
|
|
5
|
+
const require_style_options = require("./style-options-COpQc8fr.cjs");
|
|
6
6
|
let node_path = require("node:path");
|
|
7
7
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
8
8
|
let node_process = require("node:process");
|
package/dist/postcss.cjs
CHANGED
|
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
|
|
|
2
2
|
__esModule: { value: true },
|
|
3
3
|
[Symbol.toStringTag]: { value: "Module" }
|
|
4
4
|
});
|
|
5
|
-
const require_generator = require("./generator-
|
|
5
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
6
6
|
const weappTailwindcssPostcssPlugin = (0, require("@weapp-tailwindcss/postcss").createWeappTailwindcssPostcssPlugin)({
|
|
7
7
|
createGenerator: (source) => {
|
|
8
8
|
return require_generator.createWeappTailwindcssGenerator(source);
|
package/dist/postcss.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-
|
|
1
|
+
import { i as normalizeWeappTailwindcssGeneratorOptions, t as createWeappTailwindcssGenerator, u as resolveTailwindV4Source } from "./generator-BLpOsd5O.js";
|
|
2
2
|
import { createWeappTailwindcssPostcssPlugin } from "@weapp-tailwindcss/postcss";
|
|
3
3
|
const weappTailwindcssPostcssPlugin = createWeappTailwindcssPostcssPlugin({
|
|
4
4
|
createGenerator: (source) => {
|
package/dist/presets.cjs
CHANGED
|
@@ -2,9 +2,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
3
3
|
const require_framework = require("./framework.cjs");
|
|
4
4
|
const require_object = require("./object-C_Vr6_S5.cjs");
|
|
5
|
-
const require_options = require("./options-
|
|
5
|
+
const require_options = require("./options-zpZez7qe.cjs");
|
|
6
6
|
require("./utils-CuKLf1Zv.cjs");
|
|
7
|
-
const require_tailwindcss = require("./tailwindcss-
|
|
7
|
+
const require_tailwindcss = require("./tailwindcss-LtnGCxF0.cjs");
|
|
8
8
|
require("./logger-TlKT3xmR.cjs");
|
|
9
9
|
let node_path = require("node:path");
|
|
10
10
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
package/dist/presets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveTaroPlatform, resolveUniPlatformsFromEnv } from "./framework.js";
|
|
2
2
|
import { t as omitUndefined } from "./object-Bvy6-w9r.js";
|
|
3
|
-
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-
|
|
3
|
+
import { i as resolveUniAppXOptions, n as resolveTailwindcssBasedir } from "./tailwindcss-2zdmASlM.js";
|
|
4
4
|
import { n as defuOverrideArray } from "./utils-MVwpU07P.js";
|
|
5
5
|
import { t as logger } from "./logger-BNzxZbZj.js";
|
|
6
6
|
import path from "node:path";
|
package/dist/rspack.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
3
|
-
const require_webpack = require("./webpack-
|
|
3
|
+
const require_webpack = require("./webpack-CzQrloDg.cjs");
|
|
4
4
|
let node_path = require("node:path");
|
|
5
5
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
6
6
|
//#region src/bundlers/rspack/index.ts
|
package/dist/rspack.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, r as __dirname, t as WeappTailwindcss } from "./webpack-CkeFhPY2.js";
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
//#region src/bundlers/rspack/index.ts
|
|
4
4
|
const CSS_IMPORT_REWRITE_LOADER_NAME = "weapp-tw-css-import-rewrite-loader";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
2
2
|
const require_framework = require("./framework.cjs");
|
|
3
|
-
const require_generator = require("./generator-
|
|
3
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
4
4
|
require("./auto-DtU6f3X6.cjs");
|
|
5
|
-
const require_options = require("./options-
|
|
6
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
5
|
+
const require_options = require("./options-zpZez7qe.cjs");
|
|
6
|
+
const require_v4_generation_core = require("./v4-generation-core-BjHT6qGC.cjs");
|
|
7
7
|
let node_path = require("node:path");
|
|
8
8
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
9
9
|
let node_module = require("node:module");
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { detectAppType } from "./framework.js";
|
|
2
|
-
import { At as toPosixPath } from "./generator-
|
|
2
|
+
import { At as toPosixPath } from "./generator-BLpOsd5O.js";
|
|
3
3
|
import { n as hasCssMacroTailwindV4CustomVariantConditionalComments } from "./auto-2dg_uhEJ.js";
|
|
4
|
-
import { _ as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-
|
|
5
|
-
import { x as isSourceStyleRequest } from "./hmr-timing-
|
|
4
|
+
import { _ as resolveTailwindV4EntriesFromCssCached, i as resolveUniAppXOptions } from "./tailwindcss-2zdmASlM.js";
|
|
5
|
+
import { x as isSourceStyleRequest } from "./hmr-timing-CJocHeZr.js";
|
|
6
6
|
import { createRequire } from "node:module";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { weappStyleInjector } from "weapp-style-injector/vite";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_generator = require("./generator-
|
|
2
|
-
const require_options = require("./options-
|
|
1
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
2
|
+
const require_options = require("./options-zpZez7qe.cjs");
|
|
3
3
|
//#region src/context/style-options.ts
|
|
4
4
|
function normalizeStyleHandlerMajorVersion(majorVersion) {
|
|
5
5
|
return majorVersion === 4 ? 4 : void 0;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as findWorkspacePackageDir, Ct as expandTailwindSourceEntries, D as resolveTailwindcssOptions, Dt as resolveCssSourceEntries, E as normalizeTailwindcssRuntimeOptions, Et as parseConfigParam, Lt as loadTailwindV4DesignSystem, Nt as resolveCssMacroTailwindV4Source, O as normalizeStringListOption, S as findNearestPackageRoot, St as createTailwindSourceEntryMatcher, T as normalizeExtendLengthUnits, Tt as normalizeLegacyContentEntries, b as isTailwindV4CssEntry, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, kt as resolveTailwindV4CssSourceBase, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as groupCssEntriesByBase, w as findWorkspaceRoot, x as normalizeCssEntries, xt as FULL_SOURCE_SCAN_PATTERN, y as guessBasedirFromEntries } from "./generator-
|
|
1
|
+
import { C as findWorkspacePackageDir, Ct as expandTailwindSourceEntries, D as resolveTailwindcssOptions, Dt as resolveCssSourceEntries, E as normalizeTailwindcssRuntimeOptions, Et as parseConfigParam, Lt as loadTailwindV4DesignSystem, Nt as resolveCssMacroTailwindV4Source, O as normalizeStringListOption, S as findNearestPackageRoot, St as createTailwindSourceEntryMatcher, T as normalizeExtendLengthUnits, Tt as normalizeLegacyContentEntries, b as isTailwindV4CssEntry, d as resolveTailwindV4SourceFromRuntime, h as hasConfiguredTailwindV4CssRoots, i as normalizeWeappTailwindcssGeneratorOptions, kt as resolveTailwindV4CssSourceBase, m as filterTailwindV4CssSourceRoots, p as resolveTailwindV4SourceOptionsFromRuntime, v as groupCssEntriesByBase, w as findWorkspaceRoot, x as normalizeCssEntries, xt as FULL_SOURCE_SCAN_PATTERN, y as guessBasedirFromEntries } from "./generator-BLpOsd5O.js";
|
|
2
2
|
import { t as omitUndefined } from "./object-Bvy6-w9r.js";
|
|
3
3
|
import { n as defuOverrideArray$1 } from "./utils-MVwpU07P.js";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
3
3
|
const require_object = require("./object-C_Vr6_S5.cjs");
|
|
4
|
-
const require_options = require("./options-
|
|
4
|
+
const require_options = require("./options-zpZez7qe.cjs");
|
|
5
5
|
require("./utils-CuKLf1Zv.cjs");
|
|
6
6
|
let node_fs = require("node:fs");
|
|
7
7
|
let node_path = require("node:path");
|
|
@@ -178,13 +178,16 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
178
178
|
}
|
|
179
179
|
toStyleBlock() {
|
|
180
180
|
if (!this.hasStyles()) return "";
|
|
181
|
-
|
|
181
|
+
return `<style scoped>\n${this.toStyleRules()}</style>\n`;
|
|
182
|
+
}
|
|
183
|
+
toStyleRules() {
|
|
184
|
+
if (!this.hasStyles()) return "";
|
|
185
|
+
const lines = [];
|
|
182
186
|
for (const [utility, alias] of this.aliasByUtility) {
|
|
183
187
|
lines.push(`.${alias} {`);
|
|
184
188
|
lines.push(` @apply ${utility};`);
|
|
185
189
|
lines.push("}");
|
|
186
190
|
}
|
|
187
|
-
lines.push("</style>");
|
|
188
191
|
return `${lines.join("\n")}\n`;
|
|
189
192
|
}
|
|
190
193
|
};
|
|
@@ -252,10 +255,14 @@ function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, ma
|
|
|
252
255
|
}
|
|
253
256
|
const defaultCreateJsHandlerOptions = { babelParserOptions: { plugins: ["typescript"] } };
|
|
254
257
|
const UVUE_NVUE_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
255
|
-
const SFC_BLOCK_RE = /<(template|script)\b([^>]*)>([\s\S]*?)<\/\1>/gi;
|
|
258
|
+
const SFC_BLOCK_RE = /<(template|script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi;
|
|
256
259
|
const SCRIPT_SETUP_RE = /(?:^|\s)setup(?:\s|=|$)/;
|
|
260
|
+
const STYLE_SCOPED_RE = /(?:^|\s)scoped(?:\s|=|$)/i;
|
|
257
261
|
function parseSfc(code) {
|
|
258
|
-
const descriptor = {
|
|
262
|
+
const descriptor = {
|
|
263
|
+
errors: [],
|
|
264
|
+
styles: []
|
|
265
|
+
};
|
|
259
266
|
for (const match of code.matchAll(SFC_BLOCK_RE)) {
|
|
260
267
|
const type = match[1];
|
|
261
268
|
const attrs = match[2] ?? "";
|
|
@@ -280,8 +287,12 @@ function parseSfc(code) {
|
|
|
280
287
|
}
|
|
281
288
|
continue;
|
|
282
289
|
}
|
|
283
|
-
if (type === "script")
|
|
284
|
-
|
|
290
|
+
if (type === "script") {
|
|
291
|
+
if (SCRIPT_SETUP_RE.test(attrs)) descriptor.scriptSetup ?? (descriptor.scriptSetup = block);
|
|
292
|
+
else descriptor.script ?? (descriptor.script = block);
|
|
293
|
+
continue;
|
|
294
|
+
}
|
|
295
|
+
if (type === "style") descriptor.styles.push(block);
|
|
285
296
|
}
|
|
286
297
|
return descriptor;
|
|
287
298
|
}
|
|
@@ -323,7 +334,13 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
323
334
|
const { code } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
324
335
|
ms.update(descriptor.scriptSetup.start, descriptor.scriptSetup.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
325
336
|
}
|
|
326
|
-
if (localStyleCollector?.hasStyles())
|
|
337
|
+
if (localStyleCollector?.hasStyles()) {
|
|
338
|
+
const scopedStyle = descriptor.styles.findLast((style) => STYLE_SCOPED_RE.test(style.attrs));
|
|
339
|
+
if (scopedStyle) {
|
|
340
|
+
const separator = scopedStyle.content.endsWith("\n") ? "" : "\n";
|
|
341
|
+
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules()}`);
|
|
342
|
+
} else ms.append(`\n${localStyleCollector.toStyleBlock()}`);
|
|
343
|
+
}
|
|
327
344
|
}
|
|
328
345
|
const result = {
|
|
329
346
|
code: ms.toString(),
|
|
@@ -177,13 +177,16 @@ var UniAppXComponentLocalStyleCollector = class {
|
|
|
177
177
|
}
|
|
178
178
|
toStyleBlock() {
|
|
179
179
|
if (!this.hasStyles()) return "";
|
|
180
|
-
|
|
180
|
+
return `<style scoped>\n${this.toStyleRules()}</style>\n`;
|
|
181
|
+
}
|
|
182
|
+
toStyleRules() {
|
|
183
|
+
if (!this.hasStyles()) return "";
|
|
184
|
+
const lines = [];
|
|
181
185
|
for (const [utility, alias] of this.aliasByUtility) {
|
|
182
186
|
lines.push(`.${alias} {`);
|
|
183
187
|
lines.push(` @apply ${utility};`);
|
|
184
188
|
lines.push("}");
|
|
185
189
|
}
|
|
186
|
-
lines.push("</style>");
|
|
187
190
|
return `${lines.join("\n")}\n`;
|
|
188
191
|
}
|
|
189
192
|
};
|
|
@@ -251,10 +254,14 @@ function shouldHandleAttribute(tag, attrName, disabledDefaultTemplateHandler, ma
|
|
|
251
254
|
}
|
|
252
255
|
const defaultCreateJsHandlerOptions = { babelParserOptions: { plugins: ["typescript"] } };
|
|
253
256
|
const UVUE_NVUE_RE = /\.(?:uvue|nvue)(?:\?.*)?$/;
|
|
254
|
-
const SFC_BLOCK_RE = /<(template|script)\b([^>]*)>([\s\S]*?)<\/\1>/gi;
|
|
257
|
+
const SFC_BLOCK_RE = /<(template|script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi;
|
|
255
258
|
const SCRIPT_SETUP_RE = /(?:^|\s)setup(?:\s|=|$)/;
|
|
259
|
+
const STYLE_SCOPED_RE = /(?:^|\s)scoped(?:\s|=|$)/i;
|
|
256
260
|
function parseSfc(code) {
|
|
257
|
-
const descriptor = {
|
|
261
|
+
const descriptor = {
|
|
262
|
+
errors: [],
|
|
263
|
+
styles: []
|
|
264
|
+
};
|
|
258
265
|
for (const match of code.matchAll(SFC_BLOCK_RE)) {
|
|
259
266
|
const type = match[1];
|
|
260
267
|
const attrs = match[2] ?? "";
|
|
@@ -279,8 +286,12 @@ function parseSfc(code) {
|
|
|
279
286
|
}
|
|
280
287
|
continue;
|
|
281
288
|
}
|
|
282
|
-
if (type === "script")
|
|
283
|
-
|
|
289
|
+
if (type === "script") {
|
|
290
|
+
if (SCRIPT_SETUP_RE.test(attrs)) descriptor.scriptSetup ?? (descriptor.scriptSetup = block);
|
|
291
|
+
else descriptor.script ?? (descriptor.script = block);
|
|
292
|
+
continue;
|
|
293
|
+
}
|
|
294
|
+
if (type === "style") descriptor.styles.push(block);
|
|
284
295
|
}
|
|
285
296
|
return descriptor;
|
|
286
297
|
}
|
|
@@ -322,7 +333,13 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
322
333
|
const { code } = jsHandler(descriptor.scriptSetup.content, runtimeSet ?? /* @__PURE__ */ new Set(), defaultCreateJsHandlerOptions);
|
|
323
334
|
ms.update(descriptor.scriptSetup.start, descriptor.scriptSetup.end, localStyleCollector ? localStyleCollector.rewriteTransformedCode(code) : code);
|
|
324
335
|
}
|
|
325
|
-
if (localStyleCollector?.hasStyles())
|
|
336
|
+
if (localStyleCollector?.hasStyles()) {
|
|
337
|
+
const scopedStyle = descriptor.styles.findLast((style) => STYLE_SCOPED_RE.test(style.attrs));
|
|
338
|
+
if (scopedStyle) {
|
|
339
|
+
const separator = scopedStyle.content.endsWith("\n") ? "" : "\n";
|
|
340
|
+
ms.appendLeft(scopedStyle.end, `${separator}${localStyleCollector.toStyleRules()}`);
|
|
341
|
+
} else ms.append(`\n${localStyleCollector.toStyleBlock()}`);
|
|
342
|
+
}
|
|
326
343
|
}
|
|
327
344
|
const result = {
|
|
328
345
|
code: ms.toString(),
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function retainUniAppXAuthorApplyCss(generatedCss: string, authorCss: string): string;
|
|
@@ -4,6 +4,8 @@ interface HarmonyApplyHookContext {
|
|
|
4
4
|
}
|
|
5
5
|
interface CreateUniAppXHarmonyApplyExpanderOptions {
|
|
6
6
|
generateCss?: ((id: string, code: string, hookContext?: HarmonyApplyHookContext & {
|
|
7
|
+
disableSourceScan?: boolean;
|
|
8
|
+
sourceCandidates?: Iterable<string>;
|
|
7
9
|
transient?: boolean;
|
|
8
10
|
}) => Promise<string | undefined> | string | undefined) | undefined;
|
|
9
11
|
getResolvedConfig: () => ResolvedConfig | undefined;
|
|
@@ -12,7 +14,8 @@ interface CreateUniAppXHarmonyApplyExpanderOptions {
|
|
|
12
14
|
}
|
|
13
15
|
export declare function createUniAppXHarmonyApplyExpander(options: CreateUniAppXHarmonyApplyExpanderOptions): {
|
|
14
16
|
expandStyles: (code: string, id: string, hookContext: HarmonyApplyHookContext) => Promise<string>;
|
|
15
|
-
|
|
17
|
+
prepareStyles: (code: string, id: string) => string;
|
|
18
|
+
rememberSource: (code: string, id: string, authoritative?: boolean) => void;
|
|
16
19
|
styleSources: Set<string>;
|
|
17
20
|
utilities: Set<string>;
|
|
18
21
|
};
|
|
@@ -2,6 +2,8 @@ import type { HmrContext } from 'vite';
|
|
|
2
2
|
interface CreateUniAppXNativeHmrReloaderOptions {
|
|
3
3
|
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
4
4
|
isNativeAppBuildTarget: (id?: string) => boolean;
|
|
5
|
+
localStyleModuleIds: Iterable<string>;
|
|
6
|
+
syncSourceCandidates?: (ctx: HmrContext) => Promise<void>;
|
|
5
7
|
tailwindRootCssModuleIds: Iterable<string>;
|
|
6
8
|
viteProcessedCssSourceFiles: Iterable<string>;
|
|
7
9
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { HmrContext, ResolvedConfig } from 'vite';
|
|
2
|
+
import type { AppType, ICustomAttributesEntities, InternalUserDefinedOptions, JsHandler } from '../../types/index.js';
|
|
3
|
+
export interface CreateUniAppXPluginsOptions {
|
|
4
|
+
appType: AppType;
|
|
5
|
+
customAttributesEntities: ICustomAttributesEntities;
|
|
6
|
+
disabledDefaultTemplateHandler: boolean | undefined;
|
|
7
|
+
mainCssChunkMatcher: NonNullable<InternalUserDefinedOptions['mainCssChunkMatcher']>;
|
|
8
|
+
runtimeState: {
|
|
9
|
+
readyPromise: Promise<unknown>;
|
|
10
|
+
};
|
|
11
|
+
styleHandler: InternalUserDefinedOptions['styleHandler'];
|
|
12
|
+
syncSourceCandidatesForHotUpdate?: ((ctx: HmrContext) => Promise<void>) | undefined;
|
|
13
|
+
tailwindRootCssModuleIds?: Iterable<string> | undefined;
|
|
14
|
+
generateCss?: ((id: string, code: string, hookContext?: {
|
|
15
|
+
addWatchFile?: (id: string) => void;
|
|
16
|
+
disableSourceScan?: boolean;
|
|
17
|
+
sourceCandidates?: Iterable<string>;
|
|
18
|
+
transient?: boolean;
|
|
19
|
+
}) => Promise<string | undefined> | string | undefined) | undefined;
|
|
20
|
+
jsHandler: JsHandler;
|
|
21
|
+
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
22
|
+
getResolvedConfig: () => ResolvedConfig | undefined;
|
|
23
|
+
isIosPlatform?: boolean;
|
|
24
|
+
isEnabled?: (() => boolean) | undefined;
|
|
25
|
+
uniAppX?: InternalUserDefinedOptions['uniAppX'];
|
|
26
|
+
viteProcessedCssSourceFiles?: Iterable<string> | undefined;
|
|
27
|
+
}
|
package/dist/uni-app-x/vite.d.ts
CHANGED
|
@@ -1,29 +1,8 @@
|
|
|
1
1
|
import type { OutputAsset } from 'rollup';
|
|
2
|
-
import type { Plugin
|
|
2
|
+
import type { Plugin } from 'vite';
|
|
3
|
+
import type { CreateUniAppXPluginsOptions } from './vite/plugin-options.js';
|
|
3
4
|
import type { ICreateCacheReturnType } from '../cache/index.js';
|
|
4
|
-
import type {
|
|
5
|
-
interface CreateUniAppXPluginsOptions {
|
|
6
|
-
appType: AppType;
|
|
7
|
-
customAttributesEntities: ICustomAttributesEntities;
|
|
8
|
-
disabledDefaultTemplateHandler: boolean | undefined;
|
|
9
|
-
mainCssChunkMatcher: NonNullable<InternalUserDefinedOptions['mainCssChunkMatcher']>;
|
|
10
|
-
runtimeState: {
|
|
11
|
-
readyPromise: Promise<unknown>;
|
|
12
|
-
};
|
|
13
|
-
styleHandler: InternalUserDefinedOptions['styleHandler'];
|
|
14
|
-
tailwindRootCssModuleIds?: Iterable<string> | undefined;
|
|
15
|
-
generateCss?: ((id: string, code: string, hookContext?: {
|
|
16
|
-
addWatchFile?: (id: string) => void;
|
|
17
|
-
transient?: boolean;
|
|
18
|
-
}) => Promise<string | undefined> | string | undefined) | undefined;
|
|
19
|
-
jsHandler: JsHandler;
|
|
20
|
-
ensureRuntimeClassSet: (force?: boolean) => Promise<Set<string>>;
|
|
21
|
-
getResolvedConfig: () => ResolvedConfig | undefined;
|
|
22
|
-
isIosPlatform?: boolean;
|
|
23
|
-
isEnabled?: (() => boolean) | undefined;
|
|
24
|
-
uniAppX?: InternalUserDefinedOptions['uniAppX'];
|
|
25
|
-
viteProcessedCssSourceFiles?: Iterable<string> | undefined;
|
|
26
|
-
}
|
|
5
|
+
import type { CreateJsHandlerOptions, InternalUserDefinedOptions, JsHandler, LinkedJsModuleResult } from '../types/index.js';
|
|
27
6
|
export declare function createUniAppXPlugins(options: CreateUniAppXPluginsOptions): Plugin[];
|
|
28
7
|
type ApplyLinkedResults = (linked: Record<string, LinkedJsModuleResult> | undefined) => void;
|
|
29
8
|
interface CreateUniAppXAssetTaskOptions {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
2
|
-
const require_generator = require("./generator-
|
|
2
|
+
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
3
3
|
require("./auto-DtU6f3X6.cjs");
|
|
4
4
|
const require_object = require("./object-C_Vr6_S5.cjs");
|
|
5
|
-
const require_options = require("./options-
|
|
5
|
+
const require_options = require("./options-zpZez7qe.cjs");
|
|
6
6
|
const require_wxml = require("./wxml-DSMNuUaP.cjs");
|
|
7
|
-
const require_style_options = require("./style-options-
|
|
7
|
+
const require_style_options = require("./style-options-COpQc8fr.cjs");
|
|
8
8
|
let node_fs = require("node:fs");
|
|
9
9
|
let node_path = require("node:path");
|
|
10
10
|
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
@@ -341,15 +341,17 @@ function createSourceCandidateStore(options = {}) {
|
|
|
341
341
|
}
|
|
342
342
|
async function syncCurrentSource(id, source) {
|
|
343
343
|
const normalizedId = cleanUrl(id);
|
|
344
|
-
transformCandidatesById.delete(normalizedId);
|
|
345
|
-
cssCandidatesById.delete(normalizedId);
|
|
346
|
-
transformSourceById.delete(normalizedId);
|
|
347
|
-
cssSourceById.delete(normalizedId);
|
|
348
|
-
recompute(normalizedId);
|
|
349
344
|
const previousFileCandidates = new Set(candidatesById.get(normalizedId) ?? []);
|
|
350
|
-
const
|
|
345
|
+
const extension = resolveSourceCandidateExtension(normalizedId);
|
|
346
|
+
const nextCandidates = await resolveCandidates(source, extension);
|
|
351
347
|
const affectedCandidates = /* @__PURE__ */ new Set([...previousFileCandidates, ...nextCandidates]);
|
|
352
348
|
const previousVisibleCandidates = collectVisibleCandidates(affectedCandidates);
|
|
349
|
+
if (extension !== "css") {
|
|
350
|
+
transformCandidatesById.delete(normalizedId);
|
|
351
|
+
cssCandidatesById.delete(normalizedId);
|
|
352
|
+
transformSourceById.delete(normalizedId);
|
|
353
|
+
cssSourceById.delete(normalizedId);
|
|
354
|
+
}
|
|
353
355
|
scanSourceById.set(normalizedId, source);
|
|
354
356
|
replaceScanLayer(normalizedId, nextCandidates);
|
|
355
357
|
return diffCandidateSets(previousVisibleCandidates, collectVisibleCandidates(affectedCandidates));
|
|
@@ -3199,14 +3201,17 @@ function collectGeneratorCssCandidates(css) {
|
|
|
3199
3201
|
//#region src/bundlers/shared/generator-css/source-resolver/apply-reference.ts
|
|
3200
3202
|
function resolveTailwindV4ApplyReference(options) {
|
|
3201
3203
|
const references = /* @__PURE__ */ new Set();
|
|
3202
|
-
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" && require_generator.hasTailwindRootDirectives(source.css, { importFallback: true }) &&
|
|
3204
|
+
for (const source of options.cssSources ?? []) if (typeof source.file === "string" && source.file.length > 0 && typeof source.css === "string" && require_generator.hasTailwindRootDirectives(source.css, { importFallback: true }) && hasTailwindApplyContextDirective(source.css)) references.add(source.file);
|
|
3203
3205
|
return references.size === 1 ? references.values().next().value : void 0;
|
|
3204
3206
|
}
|
|
3205
|
-
function
|
|
3207
|
+
function hasTailwindApplyContextDirective(css) {
|
|
3206
3208
|
try {
|
|
3207
3209
|
let found = false;
|
|
3208
|
-
_weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules(
|
|
3209
|
-
|
|
3210
|
+
_weapp_tailwindcss_postcss.postcss.parse(css).walkAtRules((rule) => {
|
|
3211
|
+
if (rule.name === "theme" || rule.name === "config") {
|
|
3212
|
+
found = true;
|
|
3213
|
+
return false;
|
|
3214
|
+
}
|
|
3210
3215
|
});
|
|
3211
3216
|
return found;
|
|
3212
3217
|
} catch {
|
|
@@ -4832,7 +4837,10 @@ async function executeGeneratorPipelineWithOwner(context) {
|
|
|
4832
4837
|
const sourceCss = options.deferCssAdaptation ? (0, _weapp_tailwindcss_postcss.removeMatchingLocalCssImports)(source.css, localImports) : source.css;
|
|
4833
4838
|
const generatorSource = options.disableSourceScan === true ? {
|
|
4834
4839
|
...source,
|
|
4835
|
-
css: require_generator.removeTailwindSourceDirectives(sourceCss, {
|
|
4840
|
+
css: require_generator.removeTailwindSourceDirectives(sourceCss, {
|
|
4841
|
+
importFallback: generatorOptions.importFallback,
|
|
4842
|
+
preserveApplyContext: true
|
|
4843
|
+
})
|
|
4836
4844
|
} : sourceCss === source.css ? source : {
|
|
4837
4845
|
...source,
|
|
4838
4846
|
css: sourceCss
|