weapp-tailwindcss 5.2.8 → 5.2.10
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 +1 -0
- package/dist/bundlers/vite/generate-bundle/finalize/root-import-shell.d.ts +3 -1
- package/dist/bundlers/vite/generate-bundle/remembered-css-replay.d.ts +4 -1
- package/dist/bundlers/vite/generate-bundle/types.d.ts +6 -0
- package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +2 -0
- package/dist/bundlers/vite/shared/framework-hmr-candidate-state.d.ts +3 -2
- package/dist/bundlers/vite/shared/framework-hmr-runtime-signature.d.ts +1 -0
- package/dist/bundlers/vite/shared/framework-source-scan-session.d.ts +2 -0
- package/dist/bundlers/vite/utils.d.ts +2 -0
- package/dist/cli.cjs +4 -30
- package/dist/cli.js +4 -30
- package/dist/{context-CByXWyhQ.cjs → context-C3TryIjF.cjs} +8 -13
- package/dist/{context-BMkbwnH8.js → context-DbL0d-zB.js} +8 -13
- package/dist/core.cjs +1 -1
- package/dist/core.js +1 -1
- package/dist/{gulp-BWhCahA2.js → gulp-CB_GZky7.js} +3 -3
- package/dist/{gulp-BdoorWb5.cjs → gulp-G6af_vyo.cjs} +4 -4
- package/dist/gulp.cjs +1 -1
- package/dist/gulp.js +1 -1
- package/dist/{hmr-timing-CJocHeZr.js → hmr-timing-CZu2ITV8.js} +8 -3
- package/dist/{hmr-timing-DiYnyg_W.cjs → hmr-timing-gbPzjYTj.cjs} +2 -2
- package/dist/index.cjs +3 -3
- package/dist/index.js +3 -3
- package/dist/js/literal-transform.d.ts +1 -1
- package/dist/{pipeline-helpers-CsNLoEX1.cjs → pipeline-helpers-CtIXw85G.cjs} +1 -1
- package/dist/rspack.cjs +1 -1
- package/dist/rspack.js +1 -1
- package/dist/shared/classname-transform.d.ts +2 -3
- package/dist/{source-candidate-scan-signature-D9FXTD9a.cjs → source-candidate-scan-signature-CTX7eBJX.cjs} +1 -1
- package/dist/{source-candidate-scan-signature-of-TmeOs.js → source-candidate-scan-signature-DFZlYd3t.js} +1 -1
- package/dist/{transform-DzVJW6Dp.cjs → transform-9wbmvHcC.cjs} +107 -8
- package/dist/{transform-DVGsr8cV.js → transform-BlsDWgjt.js} +107 -8
- package/dist/uni-app-x/component-local-style-binding.d.ts +6 -0
- package/dist/uni-app-x/component-local-style.d.ts +1 -0
- package/dist/uni-app-x/vite/plugin-options.d.ts +2 -0
- package/dist/uni-app-x/vite/style-request.d.ts +12 -0
- package/dist/{v4-generation-core-BjHT6qGC.cjs → v4-generation-core-BVd_4348.cjs} +12 -1
- package/dist/{vite-V86H6PZa.cjs → vite-DjU_5LY6.cjs} +216 -59
- package/dist/{vite-BJJqWc_F.js → vite-cIvaBul_.js} +215 -58
- package/dist/vite.cjs +1 -1
- package/dist/vite.js +1 -1
- package/dist/weapp-tw-css-import-rewrite-loader.cjs +2 -2
- package/dist/{webpack-CzQrloDg.cjs → webpack-B9lRT1no.cjs} +6 -6
- package/dist/{webpack-CkeFhPY2.js → webpack-CvKV7U7L.js} +4 -4
- package/dist/webpack.cjs +1 -1
- package/dist/webpack.js +1 -1
- package/dist/{wxml-IBzZSaQC.js → wxml-CWJc0yY-.js} +5 -31
- package/dist/{wxml-DSMNuUaP.cjs → wxml-DUIdXCVa.cjs} +4 -36
- package/package.json +2 -2
package/dist/vite.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_vite = require("./vite-
|
|
2
|
+
const require_vite = require("./vite-DjU_5LY6.cjs");
|
|
3
3
|
exports.WeappTailwindcss = require_vite.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_vite.WeappTailwindcss;
|
package/dist/vite.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as WeappTailwindcss } from "./vite-
|
|
1
|
+
import { t as WeappTailwindcss } from "./vite-cIvaBul_.js";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss };
|
|
@@ -5,10 +5,10 @@ Object.defineProperties(exports, {
|
|
|
5
5
|
const require_rolldown_runtime = require("./rolldown-runtime-CVvi-lCc.cjs");
|
|
6
6
|
const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
7
7
|
const require_options = require("./options-zpZez7qe.cjs");
|
|
8
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
8
|
+
const require_v4_generation_core = require("./v4-generation-core-BVd_4348.cjs");
|
|
9
9
|
const require_style_options = require("./style-options-COpQc8fr.cjs");
|
|
10
10
|
const require_css_imports = require("./css-imports-DfNC3e6a.cjs");
|
|
11
|
-
const require_pipeline_helpers = require("./pipeline-helpers-
|
|
11
|
+
const require_pipeline_helpers = require("./pipeline-helpers-CtIXw85G.cjs");
|
|
12
12
|
const require_runtime_registry = require("./runtime-registry-Y7NrD2WH.cjs");
|
|
13
13
|
const require_watch_dependencies = require("./watch-dependencies-BZGubvuJ.cjs");
|
|
14
14
|
let node_path = require("node:path");
|
|
@@ -3,14 +3,14 @@ const require_generator = require("./generator-B0dCFlP1.cjs");
|
|
|
3
3
|
const require_object = require("./object-C_Vr6_S5.cjs");
|
|
4
4
|
const require_options = require("./options-zpZez7qe.cjs");
|
|
5
5
|
const require_utils = require("./utils-CuKLf1Zv.cjs");
|
|
6
|
-
const require_v4_generation_core = require("./v4-generation-core-
|
|
7
|
-
const require_wxml = require("./wxml-
|
|
8
|
-
const require_hmr_timing = require("./hmr-timing-
|
|
9
|
-
const require_context = require("./context-
|
|
6
|
+
const require_v4_generation_core = require("./v4-generation-core-BVd_4348.cjs");
|
|
7
|
+
const require_wxml = require("./wxml-DUIdXCVa.cjs");
|
|
8
|
+
const require_hmr_timing = require("./hmr-timing-gbPzjYTj.cjs");
|
|
9
|
+
const require_context = require("./context-C3TryIjF.cjs");
|
|
10
10
|
const require_tailwindcss = require("./tailwindcss-LtnGCxF0.cjs");
|
|
11
11
|
const require_style_options = require("./style-options-COpQc8fr.cjs");
|
|
12
|
-
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-
|
|
13
|
-
const require_pipeline_helpers = require("./pipeline-helpers-
|
|
12
|
+
const require_source_candidate_scan_signature = require("./source-candidate-scan-signature-CTX7eBJX.cjs");
|
|
13
|
+
const require_pipeline_helpers = require("./pipeline-helpers-CtIXw85G.cjs");
|
|
14
14
|
const require_css_loader_runtime = require("./css-loader-runtime-CSv0lKqV.cjs");
|
|
15
15
|
const require_runtime_registry = require("./runtime-registry-Y7NrD2WH.cjs");
|
|
16
16
|
let node_fs = require("node:fs");
|
|
@@ -2,11 +2,11 @@ import { $ as hasTailwindSourceDirectives, B as stripMiniProgramCssSpecificityPl
|
|
|
2
2
|
import { n as _defineProperty } from "./object-Bvy6-w9r.js";
|
|
3
3
|
import { _ as resolveTailwindV4EntriesFromCssCached, l as getRuntimeClassSetSignature, p as resolveSourceScanEntries } from "./tailwindcss-2zdmASlM.js";
|
|
4
4
|
import { r as getGroupedEntries } from "./utils-MVwpU07P.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { d as refreshTailwindRuntimeState, i as pluginName, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, r as resolveStyleOptionsFromContext, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-
|
|
5
|
+
import { $ as getCompilationScopeDependencyRevision, A as annotateCssSourceTrace, C as stripRequestQuery, D as stripBundlerGeneratedCssMarkers, F as createRuntimeClassSetManager, H as buildRuntimeCompilationSnapshot, I as collectStrictEscapedRuntimeCandidates, J as createRuntimeAffectingSourceSignature, K as resetRuntimeCompilationBuildState, L as createEscapeFragments, M as createCssTokenSourceMap, N as isCssSourceTraceEnabled, O as finalizeMiniProgramCssStructure, P as processCachedTask, Q as AssetEmissionPlan, R as isPureLocalCssImportWrapper, S as isSourceStyleRequest, T as hasBundlerGeneratedCssMarker, U as createRuntimeCompilationAffectingSignature, V as finalizeCompilerShadowRun, W as createRuntimeCompilationBuildState, X as beginCompilerShadowRun, Y as disposeCompilerOwner, _ as captureResolvedFrameworkPostcssOptions, at as isSourceCandidateRequest, c as collectRawSourceClassSelectors, h as removeGeneratedSelectorCompatCss, it as createSourceCandidateStore, j as createCssSourceTraceCacheSignature, l as pushConcurrentTaskFactories, m as scoreTailwindV4CssSourceFileMatch, n as emitHmrTiming, nt as createCompilationDependencyChanges, q as updateRuntimeCompilationBuildState, r as generateTailwindV4Css, st as resolveSourceCandidateScanFiles, tt as recordCompilationDependencyChanges, u as resolveTaskConcurrency, v as collectFrameworkPostcssOptionsFromLoaderEntries, x as hasMiniProgramTailwindV4PreflightReset, y as createCssSourceOrderAppend } from "./hmr-timing-CZu2ITV8.js";
|
|
6
|
+
import { _ as md5Hash, m as createDebug } from "./wxml-CWJc0yY-.js";
|
|
7
|
+
import { d as refreshTailwindRuntimeState, i as pluginName, l as createTailwindRuntimeReadyPromise, n as normalizeStyleHandlerMajorVersion, o as shouldSkipJsTransform, r as resolveStyleOptionsFromContext, t as getCompilerContext, u as ensureRuntimeClassSet } from "./context-DbL0d-zB.js";
|
|
8
8
|
import { getDefaultCssPreflight } from "./defaults.js";
|
|
9
|
-
import { S as resolveWebpackFrameworkProfile, a as createCandidateSignature, b as webpackStyleInjectorDelegates, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, t as createSourceCandidateScanSignature, v as createBuiltinWebpackStyleInjectorPlugin } from "./source-candidate-scan-signature-
|
|
9
|
+
import { S as resolveWebpackFrameworkProfile, a as createCandidateSignature, b as webpackStyleInjectorDelegates, d as classifyRuntimeEntry, f as resolvePackageDir, g as toAbsoluteOutputPath, h as resolveOutputSpecifier, p as resolvePluginDisabledState, r as createScopedGeneratorRuntime, t as createSourceCandidateScanSignature, v as createBuiltinWebpackStyleInjectorPlugin } from "./source-candidate-scan-signature-DFZlYd3t.js";
|
|
10
10
|
import Module, { createRequire } from "node:module";
|
|
11
11
|
import fs from "node:fs";
|
|
12
12
|
import path from "node:path";
|
package/dist/webpack.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_webpack = require("./webpack-
|
|
2
|
+
const require_webpack = require("./webpack-B9lRT1no.cjs");
|
|
3
3
|
exports.WeappTailwindcss = require_webpack.WeappTailwindcss;
|
|
4
4
|
exports.weappTailwindcss = require_webpack.WeappTailwindcss;
|
|
5
5
|
exports.weappTailwindcssPackageDir = require_webpack.weappTailwindcssPackageDir;
|
package/dist/webpack.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-
|
|
1
|
+
import { n as weappTailwindcssPackageDir, t as WeappTailwindcss } from "./webpack-CvKV7U7L.js";
|
|
2
2
|
export { WeappTailwindcss, WeappTailwindcss as weappTailwindcss, weappTailwindcssPackageDir };
|
|
@@ -168,30 +168,8 @@ function isPlainSlashPathCandidate(candidate) {
|
|
|
168
168
|
if (candidate.includes("[") || candidate.includes("]") || candidate.includes(":")) return false;
|
|
169
169
|
return !candidate.slice(0, slashIndex).includes("-");
|
|
170
170
|
}
|
|
171
|
-
function isArbitraryValueCandidate(candidate) {
|
|
172
|
-
let hasOpenBracket = false;
|
|
173
|
-
let hasCloseBracket = false;
|
|
174
|
-
for (let i = 0; i < candidate.length; i++) {
|
|
175
|
-
const char = candidate[i];
|
|
176
|
-
if (char === "[") hasOpenBracket = true;
|
|
177
|
-
else if (char === "]") hasCloseBracket = true;
|
|
178
|
-
if (hasOpenBracket && hasCloseBracket) break;
|
|
179
|
-
}
|
|
180
|
-
if (!hasOpenBracket || !hasCloseBracket) return false;
|
|
181
|
-
if (isUrlLikeCandidate(candidate.trim())) return false;
|
|
182
|
-
return true;
|
|
183
|
-
}
|
|
184
|
-
function shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion) {
|
|
185
|
-
if (jsArbitraryValueFallback === true) return true;
|
|
186
|
-
if (jsArbitraryValueFallback === false) return false;
|
|
187
|
-
return tailwindcssMajorVersion === 4 && (!classNameSet || classNameSet.size === 0);
|
|
188
|
-
}
|
|
189
|
-
function shouldEnableArbitraryValueFallback({ classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion }) {
|
|
190
|
-
return shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion);
|
|
191
|
-
}
|
|
192
171
|
const SKIP_RESULT = { decision: "skip" };
|
|
193
172
|
const DIRECT_RESULT = { decision: "direct" };
|
|
194
|
-
const FALLBACK_RESULT = { decision: "fallback" };
|
|
195
173
|
function getEscapedCandidateCacheStore(escapeMap) {
|
|
196
174
|
if (!escapeMap) return defaultEscapedCandidateCache;
|
|
197
175
|
if (escapeMap === lastEscapedCandidateEscapeMap && lastEscapedCandidateCacheStore) return lastEscapedCandidateCacheStore;
|
|
@@ -216,11 +194,11 @@ function getEscapedCandidate(candidate, escapeMap, store = getEscapedCandidateCa
|
|
|
216
194
|
* JS 转译严格遵循 runtime class set:
|
|
217
195
|
* 1. 直接命中 classNameSet 原始值;
|
|
218
196
|
* 2. 兼容命中 classNameSet 中已转义值;
|
|
219
|
-
* 3.
|
|
197
|
+
* 3. 除显式 alwaysEscape 外,不允许绕过 classNameSet。
|
|
220
198
|
*
|
|
221
199
|
* 返回结构化结果,附带已计算的 escapedValue 以避免下游重复 escape。
|
|
222
200
|
*/
|
|
223
|
-
function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNameSet, escapeMap,
|
|
201
|
+
function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNameSet, escapeMap, jsPreserveClass, classContext }) {
|
|
224
202
|
if (jsPreserveClass?.(candidate)) return SKIP_RESULT;
|
|
225
203
|
if (alwaysEscape) return DIRECT_RESULT;
|
|
226
204
|
if (!classContext && isPlainSlashPathCandidate(candidate)) return SKIP_RESULT;
|
|
@@ -232,7 +210,6 @@ function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNam
|
|
|
232
210
|
escapedValue: escapedCandidate
|
|
233
211
|
};
|
|
234
212
|
}
|
|
235
|
-
if (classContext && shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion) && isArbitraryValueCandidate(candidate)) return FALLBACK_RESULT;
|
|
236
213
|
return SKIP_RESULT;
|
|
237
214
|
}
|
|
238
215
|
//#endregion
|
|
@@ -478,8 +455,7 @@ function createCandidatePlanResolver(options, classContext) {
|
|
|
478
455
|
function replaceHandleValue(path, options) {
|
|
479
456
|
const { needEscaped = false } = options;
|
|
480
457
|
const { classNameSet, alwaysEscape } = options;
|
|
481
|
-
|
|
482
|
-
if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
|
|
458
|
+
if (!alwaysEscape && (!classNameSet || classNameSet.size === 0)) return;
|
|
483
459
|
if (hasIgnoreComment(path.node)) return;
|
|
484
460
|
if (isConditionTestLiteral(path)) return;
|
|
485
461
|
const { literal, original, offset } = extractLiteralValue(path, options);
|
|
@@ -491,7 +467,6 @@ function replaceHandleValue(path, options) {
|
|
|
491
467
|
let mutated = false;
|
|
492
468
|
let matchedCandidateCount = 0;
|
|
493
469
|
let escapedDecisionCount = 0;
|
|
494
|
-
let fallbackDecisionCount = 0;
|
|
495
470
|
let escapedSamples;
|
|
496
471
|
let skippedSamples;
|
|
497
472
|
const resolveCandidatePlan = createCandidatePlanResolver(options, classContext);
|
|
@@ -511,7 +486,6 @@ function replaceHandleValue(path, options) {
|
|
|
511
486
|
if (!escapedSamples) escapedSamples = [];
|
|
512
487
|
if (escapedSamples.length < 6) escapedSamples.push(candidate);
|
|
513
488
|
}
|
|
514
|
-
if (plan.result.decision === "fallback") fallbackDecisionCount += 1;
|
|
515
489
|
}
|
|
516
490
|
const replaced = transformed.replace(candidate, plan.replacement);
|
|
517
491
|
if (replaced !== transformed) {
|
|
@@ -521,7 +495,7 @@ function replaceHandleValue(path, options) {
|
|
|
521
495
|
}
|
|
522
496
|
const node = path.node;
|
|
523
497
|
if (!mutated || typeof node.start !== "number" || typeof node.end !== "number") return;
|
|
524
|
-
if (debugEnabled) debug("runtimeSet size=%d
|
|
498
|
+
if (debugEnabled) debug("runtimeSet size=%d candidates=%d matched=%d escapedHits=%d skipped=%d file=%s escapedSamples=%s skippedSamples=%s", classNameSet?.size ?? 0, candidates.length, matchedCandidateCount, escapedDecisionCount, skippedSamples?.length ?? 0, options.filename ?? "unknown", escapedSamples?.join(",") || "-", skippedSamples?.join(",") || "-");
|
|
525
499
|
const start = node.start + offset;
|
|
526
500
|
const end = node.end - offset;
|
|
527
501
|
if (start >= end || transformed === original) return;
|
|
@@ -1833,4 +1807,4 @@ function createTemplateHandler(options = {}) {
|
|
|
1833
1807
|
};
|
|
1834
1808
|
}
|
|
1835
1809
|
//#endregion
|
|
1836
|
-
export {
|
|
1810
|
+
export { md5Hash as _, jsHandler as a, getReplacementCacheStore as c, decodeUnicode2 as d, resolveClassNameTransformWithResult as f, traverse as g, babelParse as h, analyzeSource as i, jsStringEscape as l, createDebug as m, generateCode as n, JsTokenUpdater as o, replaceWxml as p, createAttributeMatcher as r, getReplacement as s, createTemplateHandler as t, isClassContextLiteralPath as u };
|
|
@@ -36828,30 +36828,8 @@ function isPlainSlashPathCandidate(candidate) {
|
|
|
36828
36828
|
if (candidate.includes("[") || candidate.includes("]") || candidate.includes(":")) return false;
|
|
36829
36829
|
return !candidate.slice(0, slashIndex).includes("-");
|
|
36830
36830
|
}
|
|
36831
|
-
function isArbitraryValueCandidate(candidate) {
|
|
36832
|
-
let hasOpenBracket = false;
|
|
36833
|
-
let hasCloseBracket = false;
|
|
36834
|
-
for (let i = 0; i < candidate.length; i++) {
|
|
36835
|
-
const char = candidate[i];
|
|
36836
|
-
if (char === "[") hasOpenBracket = true;
|
|
36837
|
-
else if (char === "]") hasCloseBracket = true;
|
|
36838
|
-
if (hasOpenBracket && hasCloseBracket) break;
|
|
36839
|
-
}
|
|
36840
|
-
if (!hasOpenBracket || !hasCloseBracket) return false;
|
|
36841
|
-
if (isUrlLikeCandidate(candidate.trim())) return false;
|
|
36842
|
-
return true;
|
|
36843
|
-
}
|
|
36844
|
-
function shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion) {
|
|
36845
|
-
if (jsArbitraryValueFallback === true) return true;
|
|
36846
|
-
if (jsArbitraryValueFallback === false) return false;
|
|
36847
|
-
return tailwindcssMajorVersion === 4 && (!classNameSet || classNameSet.size === 0);
|
|
36848
|
-
}
|
|
36849
|
-
function shouldEnableArbitraryValueFallback({ classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion }) {
|
|
36850
|
-
return shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion);
|
|
36851
|
-
}
|
|
36852
36831
|
const SKIP_RESULT = { decision: "skip" };
|
|
36853
36832
|
const DIRECT_RESULT = { decision: "direct" };
|
|
36854
|
-
const FALLBACK_RESULT = { decision: "fallback" };
|
|
36855
36833
|
function getEscapedCandidateCacheStore(escapeMap) {
|
|
36856
36834
|
if (!escapeMap) return defaultEscapedCandidateCache;
|
|
36857
36835
|
if (escapeMap === lastEscapedCandidateEscapeMap && lastEscapedCandidateCacheStore) return lastEscapedCandidateCacheStore;
|
|
@@ -36876,11 +36854,11 @@ function getEscapedCandidate(candidate, escapeMap, store = getEscapedCandidateCa
|
|
|
36876
36854
|
* JS 转译严格遵循 runtime class set:
|
|
36877
36855
|
* 1. 直接命中 classNameSet 原始值;
|
|
36878
36856
|
* 2. 兼容命中 classNameSet 中已转义值;
|
|
36879
|
-
* 3.
|
|
36857
|
+
* 3. 除显式 alwaysEscape 外,不允许绕过 classNameSet。
|
|
36880
36858
|
*
|
|
36881
36859
|
* 返回结构化结果,附带已计算的 escapedValue 以避免下游重复 escape。
|
|
36882
36860
|
*/
|
|
36883
|
-
function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNameSet, escapeMap,
|
|
36861
|
+
function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNameSet, escapeMap, jsPreserveClass, classContext }) {
|
|
36884
36862
|
if (jsPreserveClass?.(candidate)) return SKIP_RESULT;
|
|
36885
36863
|
if (alwaysEscape) return DIRECT_RESULT;
|
|
36886
36864
|
if (!classContext && isPlainSlashPathCandidate(candidate)) return SKIP_RESULT;
|
|
@@ -36892,7 +36870,6 @@ function resolveClassNameTransformWithResult(candidate, { alwaysEscape, classNam
|
|
|
36892
36870
|
escapedValue: escapedCandidate
|
|
36893
36871
|
};
|
|
36894
36872
|
}
|
|
36895
|
-
if (classContext && shouldEnableArbitraryValueFallbackByInputs(classNameSet, jsArbitraryValueFallback, tailwindcssMajorVersion) && isArbitraryValueCandidate(candidate)) return FALLBACK_RESULT;
|
|
36896
36873
|
return SKIP_RESULT;
|
|
36897
36874
|
}
|
|
36898
36875
|
//#endregion
|
|
@@ -37138,8 +37115,7 @@ function createCandidatePlanResolver(options, classContext) {
|
|
|
37138
37115
|
function replaceHandleValue(path, options) {
|
|
37139
37116
|
const { needEscaped = false } = options;
|
|
37140
37117
|
const { classNameSet, alwaysEscape } = options;
|
|
37141
|
-
|
|
37142
|
-
if (!alwaysEscape && !fallbackEnabled && (!classNameSet || classNameSet.size === 0)) return;
|
|
37118
|
+
if (!alwaysEscape && (!classNameSet || classNameSet.size === 0)) return;
|
|
37143
37119
|
if (hasIgnoreComment(path.node)) return;
|
|
37144
37120
|
if (isConditionTestLiteral(path)) return;
|
|
37145
37121
|
const { literal, original, offset } = extractLiteralValue(path, options);
|
|
@@ -37151,7 +37127,6 @@ function replaceHandleValue(path, options) {
|
|
|
37151
37127
|
let mutated = false;
|
|
37152
37128
|
let matchedCandidateCount = 0;
|
|
37153
37129
|
let escapedDecisionCount = 0;
|
|
37154
|
-
let fallbackDecisionCount = 0;
|
|
37155
37130
|
let escapedSamples;
|
|
37156
37131
|
let skippedSamples;
|
|
37157
37132
|
const resolveCandidatePlan = createCandidatePlanResolver(options, classContext);
|
|
@@ -37171,7 +37146,6 @@ function replaceHandleValue(path, options) {
|
|
|
37171
37146
|
if (!escapedSamples) escapedSamples = [];
|
|
37172
37147
|
if (escapedSamples.length < 6) escapedSamples.push(candidate);
|
|
37173
37148
|
}
|
|
37174
|
-
if (plan.result.decision === "fallback") fallbackDecisionCount += 1;
|
|
37175
37149
|
}
|
|
37176
37150
|
const replaced = transformed.replace(candidate, plan.replacement);
|
|
37177
37151
|
if (replaced !== transformed) {
|
|
@@ -37181,7 +37155,7 @@ function replaceHandleValue(path, options) {
|
|
|
37181
37155
|
}
|
|
37182
37156
|
const node = path.node;
|
|
37183
37157
|
if (!mutated || typeof node.start !== "number" || typeof node.end !== "number") return;
|
|
37184
|
-
if (debugEnabled) debug$1("runtimeSet size=%d
|
|
37158
|
+
if (debugEnabled) debug$1("runtimeSet size=%d candidates=%d matched=%d escapedHits=%d skipped=%d file=%s escapedSamples=%s skippedSamples=%s", classNameSet?.size ?? 0, candidates.length, matchedCandidateCount, escapedDecisionCount, skippedSamples?.length ?? 0, options.filename ?? "unknown", escapedSamples?.join(",") || "-", skippedSamples?.join(",") || "-");
|
|
37185
37159
|
const start = node.start + offset;
|
|
37186
37160
|
const end = node.end - offset;
|
|
37187
37161
|
if (start >= end || transformed === original) return;
|
|
@@ -38595,12 +38569,6 @@ Object.defineProperty(exports, "resolveClassNameTransformWithResult", {
|
|
|
38595
38569
|
return resolveClassNameTransformWithResult;
|
|
38596
38570
|
}
|
|
38597
38571
|
});
|
|
38598
|
-
Object.defineProperty(exports, "shouldEnableArbitraryValueFallback", {
|
|
38599
|
-
enumerable: true,
|
|
38600
|
-
get: function() {
|
|
38601
|
-
return shouldEnableArbitraryValueFallback;
|
|
38602
|
-
}
|
|
38603
|
-
});
|
|
38604
38572
|
Object.defineProperty(exports, "traverse", {
|
|
38605
38573
|
enumerable: true,
|
|
38606
38574
|
get: function() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.10",
|
|
5
5
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -215,10 +215,10 @@
|
|
|
215
215
|
"oxc-walker": "^1.1.1",
|
|
216
216
|
"semver": "~7.8.5",
|
|
217
217
|
"yaml": "^2.9.0",
|
|
218
|
-
"@weapp-tailwindcss/postcss": "3.2.6",
|
|
219
218
|
"@weapp-tailwindcss/logger": "2.0.1",
|
|
220
219
|
"@weapp-tailwindcss/reset": "0.1.2",
|
|
221
220
|
"@weapp-tailwindcss/shared": "2.0.1",
|
|
221
|
+
"@weapp-tailwindcss/postcss": "3.2.8",
|
|
222
222
|
"tailwindcss-config": "2.0.2",
|
|
223
223
|
"weapp-style-injector": "1.0.2"
|
|
224
224
|
},
|