weapp-tailwindcss 4.10.0 → 4.10.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/{chunk-TNAPEHNW.mjs → chunk-3BKE5AJQ.mjs} +3 -3
- package/dist/{chunk-F6VHIO5B.mjs → chunk-4QCL7FBX.mjs} +1 -1
- package/dist/{chunk-VTIOEDOK.js → chunk-7K3R5LV6.js} +3 -49
- package/dist/{chunk-ZP6TLVZX.mjs → chunk-7ZI6WVIU.mjs} +2 -2
- package/dist/{chunk-VZX2RV6M.js → chunk-EE4DYM4E.js} +19 -36
- package/dist/{chunk-D67CTJV5.mjs → chunk-ESIT2XWD.mjs} +2 -19
- package/dist/{chunk-6QU7CMAG.mjs → chunk-GKT5AE7D.mjs} +1 -1
- package/dist/{chunk-JA6PNN27.js → chunk-K7CTHHN2.js} +27 -27
- package/dist/{chunk-PDP4OIKN.js → chunk-P65O2L27.js} +3 -3
- package/dist/{chunk-HFXMZGPW.js → chunk-RB7YN5XZ.js} +3 -3
- package/dist/{chunk-Q5IGGG5W.mjs → chunk-RXM5ERRJ.mjs} +3 -49
- package/dist/{chunk-DA2K4ZIE.js → chunk-W3EZEDKD.js} +7 -7
- package/dist/cli.js +9 -9
- package/dist/cli.mjs +1 -1
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +9 -17
- package/dist/core.mjs +4 -12
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +4 -4
- package/dist/gulp.mjs +3 -3
- package/dist/{index-B6U7MoOM.d.ts → index-BESv5MWf.d.mts} +2 -6
- package/dist/{index-B6U7MoOM.d.mts → index-BESv5MWf.d.ts} +2 -6
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/dist/presets.d.mts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/types.d.mts +5 -4
- package/dist/types.d.ts +5 -4
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +5 -5
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +26 -26
- package/dist/webpack4.mjs +3 -3
- package/package.json +1 -1
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isMpx,
|
|
11
11
|
patchMpxLoaderResolve,
|
|
12
12
|
setupMpxTailwindcssRedirect
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-GKT5AE7D.mjs";
|
|
14
14
|
import {
|
|
15
15
|
pushConcurrentTaskFactories,
|
|
16
16
|
resolveDisabledOptions,
|
|
@@ -23,14 +23,14 @@ import {
|
|
|
23
23
|
} from "./chunk-RRHPTTCP.mjs";
|
|
24
24
|
import {
|
|
25
25
|
setupPatchRecorder
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-4QCL7FBX.mjs";
|
|
27
27
|
import {
|
|
28
28
|
createDebug,
|
|
29
29
|
ensureRuntimeClassSet,
|
|
30
30
|
getCompilerContext,
|
|
31
31
|
getRuntimeClassSetSignature,
|
|
32
32
|
pluginName
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-RXM5ERRJ.mjs";
|
|
34
34
|
import {
|
|
35
35
|
getGroupedEntries
|
|
36
36
|
} from "./chunk-OOHJLO5M.mjs";
|
|
@@ -285,7 +285,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
|
285
285
|
// package.json
|
|
286
286
|
var package_default = {
|
|
287
287
|
name: "weapp-tailwindcss",
|
|
288
|
-
version: "4.10.
|
|
288
|
+
version: "4.10.1",
|
|
289
289
|
description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
|
|
290
290
|
author: "ice breaker <1324318532@qq.com>",
|
|
291
291
|
license: "MIT",
|
|
@@ -1190,46 +1190,9 @@ var _escape = require('@ast-core/escape');
|
|
|
1190
1190
|
var _extractors = require('@weapp-tailwindcss/shared/extractors');
|
|
1191
1191
|
|
|
1192
1192
|
// src/shared/classname-transform.ts
|
|
1193
|
-
var arbitraryClassTokenRE = /\[[^\]\r\n]+\]/;
|
|
1194
|
-
var utilityLikeClassRE = /^-?[@\w][\w:/.[\]()%#!,-]*$/;
|
|
1195
|
-
var escapableTokenRE = /[.[\]/:]/;
|
|
1196
|
-
function isArbitraryValueClassName(candidate) {
|
|
1197
|
-
if (!arbitraryClassTokenRE.test(candidate)) {
|
|
1198
|
-
return false;
|
|
1199
|
-
}
|
|
1200
|
-
return candidate.startsWith("[") || candidate.includes("-[") || candidate.includes(":[");
|
|
1201
|
-
}
|
|
1202
|
-
function shouldFallbackEscapeClassName(candidate) {
|
|
1203
|
-
if (!candidate) {
|
|
1204
|
-
return false;
|
|
1205
|
-
}
|
|
1206
|
-
if (candidate.startsWith("@")) {
|
|
1207
|
-
return false;
|
|
1208
|
-
}
|
|
1209
|
-
if (candidate.includes("://")) {
|
|
1210
|
-
return false;
|
|
1211
|
-
}
|
|
1212
|
-
if (candidate.includes("/")) {
|
|
1213
|
-
return false;
|
|
1214
|
-
}
|
|
1215
|
-
if (!utilityLikeClassRE.test(candidate)) {
|
|
1216
|
-
return false;
|
|
1217
|
-
}
|
|
1218
|
-
if (isArbitraryValueClassName(candidate)) {
|
|
1219
|
-
return true;
|
|
1220
|
-
}
|
|
1221
|
-
if (!escapableTokenRE.test(candidate)) {
|
|
1222
|
-
return false;
|
|
1223
|
-
}
|
|
1224
|
-
if (!candidate.includes(".")) {
|
|
1225
|
-
return false;
|
|
1226
|
-
}
|
|
1227
|
-
return candidate.includes("-") || candidate.includes(":");
|
|
1228
|
-
}
|
|
1229
1193
|
function shouldTransformClassNameCandidate(candidate, {
|
|
1230
1194
|
alwaysEscape,
|
|
1231
1195
|
classNameSet,
|
|
1232
|
-
staleClassNameFallback,
|
|
1233
1196
|
jsPreserveClass
|
|
1234
1197
|
}) {
|
|
1235
1198
|
if (alwaysEscape) {
|
|
@@ -1239,18 +1202,9 @@ function shouldTransformClassNameCandidate(candidate, {
|
|
|
1239
1202
|
return false;
|
|
1240
1203
|
}
|
|
1241
1204
|
if (!classNameSet || classNameSet.size === 0) {
|
|
1242
|
-
if (!staleClassNameFallback) {
|
|
1243
|
-
return false;
|
|
1244
|
-
}
|
|
1245
|
-
return shouldFallbackEscapeClassName(candidate);
|
|
1246
|
-
}
|
|
1247
|
-
if (classNameSet.has(candidate)) {
|
|
1248
|
-
return true;
|
|
1249
|
-
}
|
|
1250
|
-
if (!staleClassNameFallback) {
|
|
1251
1205
|
return false;
|
|
1252
1206
|
}
|
|
1253
|
-
return
|
|
1207
|
+
return classNameSet.has(candidate);
|
|
1254
1208
|
}
|
|
1255
1209
|
|
|
1256
1210
|
// src/utils/decode.ts
|
|
@@ -1359,7 +1313,7 @@ function replaceHandleValue(path5, options) {
|
|
|
1359
1313
|
needEscaped = false
|
|
1360
1314
|
} = options;
|
|
1361
1315
|
const { classNameSet, alwaysEscape } = options;
|
|
1362
|
-
if (!alwaysEscape && (!classNameSet || classNameSet.size === 0)
|
|
1316
|
+
if (!alwaysEscape && (!classNameSet || classNameSet.size === 0)) {
|
|
1363
1317
|
return void 0;
|
|
1364
1318
|
}
|
|
1365
1319
|
const { literal, original, allowDoubleQuotes, offset } = extractLiteralValue(path5, options);
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-RRHPTTCP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
setupPatchRecorder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-4QCL7FBX.mjs";
|
|
7
7
|
import {
|
|
8
8
|
createDebug,
|
|
9
9
|
ensureRuntimeClassSet,
|
|
10
10
|
getCompilerContext,
|
|
11
11
|
refreshTailwindRuntimeState
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-RXM5ERRJ.mjs";
|
|
13
13
|
|
|
14
14
|
// src/bundlers/gulp/index.ts
|
|
15
15
|
import { Buffer } from "buffer";
|
|
@@ -12,7 +12,7 @@ var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
|
|
|
12
12
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkRB7YN5XZjs = require('./chunk-RB7YN5XZ.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ var _chunkHFXMZGPWjs = require('./chunk-HFXMZGPW.js');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunk7K3R5LV6js = require('./chunk-7K3R5LV6.js');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
@@ -54,7 +54,7 @@ function updateStaticAttribute(ms, prop) {
|
|
|
54
54
|
const start = prop.value.loc.start.offset + 1;
|
|
55
55
|
const end = prop.value.loc.end.offset - 1;
|
|
56
56
|
if (start < end) {
|
|
57
|
-
ms.update(start, end,
|
|
57
|
+
ms.update(start, end, _chunk7K3R5LV6js.replaceWxml.call(void 0, prop.value.content));
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
@@ -66,7 +66,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
|
66
66
|
if (start >= end) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
const generated =
|
|
69
|
+
const generated = _chunk7K3R5LV6js.generateCode.call(void 0, prop.exp.content, {
|
|
70
70
|
jsHandler,
|
|
71
71
|
runtimeSet,
|
|
72
72
|
wrapExpression: true
|
|
@@ -95,7 +95,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
95
95
|
return;
|
|
96
96
|
}
|
|
97
97
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
98
|
-
const matchCustomAttribute =
|
|
98
|
+
const matchCustomAttribute = _chunk7K3R5LV6js.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
99
99
|
const ms = new (0, _magicstring2.default)(code);
|
|
100
100
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
101
101
|
if (errors.length === 0) {
|
|
@@ -666,21 +666,6 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
|
666
666
|
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
667
667
|
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
668
668
|
}
|
|
669
|
-
function resolveViteStaleClassNameFallback(option, resolvedConfig) {
|
|
670
|
-
if (typeof option === "boolean") {
|
|
671
|
-
return option;
|
|
672
|
-
}
|
|
673
|
-
if (!resolvedConfig) {
|
|
674
|
-
return false;
|
|
675
|
-
}
|
|
676
|
-
if (resolvedConfig.command === "serve") {
|
|
677
|
-
return true;
|
|
678
|
-
}
|
|
679
|
-
if (resolvedConfig.command === "build" && _optionalChain([resolvedConfig, 'access', _25 => _25.build, 'optionalAccess', _26 => _26.watch])) {
|
|
680
|
-
return true;
|
|
681
|
-
}
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
669
|
function createGenerateBundleHook(context) {
|
|
685
670
|
const state = {
|
|
686
671
|
iteration: 0,
|
|
@@ -728,9 +713,8 @@ function createGenerateBundleHook(context) {
|
|
|
728
713
|
const processSets = buildProcessSets(entries, opts, dirtyEntries.changedByType, state.previousLinkedByEntry, disableDirtyOptimization);
|
|
729
714
|
const processFiles = processSets.files;
|
|
730
715
|
const resolvedConfig = getResolvedConfig();
|
|
731
|
-
const
|
|
732
|
-
const
|
|
733
|
-
const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _28 => _28.build, 'optionalAccess', _29 => _29.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
716
|
+
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _25 => _25.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
|
|
717
|
+
const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _26 => _26.build, 'optionalAccess', _27 => _27.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
734
718
|
const jsEntries = /* @__PURE__ */ new Map();
|
|
735
719
|
for (const [fileName, output] of entries) {
|
|
736
720
|
const entry = { fileName, output };
|
|
@@ -751,7 +735,7 @@ function createGenerateBundleHook(context) {
|
|
|
751
735
|
);
|
|
752
736
|
}
|
|
753
737
|
debug2("get runtimeSet, class count: %d", runtime.size);
|
|
754
|
-
const runtimeSignature = _nullishCoalesce(
|
|
738
|
+
const runtimeSignature = _nullishCoalesce(_chunk7K3R5LV6js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
|
|
755
739
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
756
740
|
onUpdate(fileName, previous, next);
|
|
757
741
|
debug2("js linked handle: %s", fileName);
|
|
@@ -771,11 +755,10 @@ function createGenerateBundleHook(context) {
|
|
|
771
755
|
};
|
|
772
756
|
const createHandlerOptions = (absoluteFilename, extra) => ({
|
|
773
757
|
...extra,
|
|
774
|
-
staleClassNameFallback: _nullishCoalesce(_optionalChain([extra, 'optionalAccess', _30 => _30.staleClassNameFallback]), () => ( staleClassNameFallback)),
|
|
775
758
|
filename: absoluteFilename,
|
|
776
759
|
moduleGraph: moduleGraphOptions,
|
|
777
760
|
babelParserOptions: {
|
|
778
|
-
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess',
|
|
761
|
+
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _28 => _28.babelParserOptions]), () => ( {})),
|
|
779
762
|
sourceFilename: absoluteFilename
|
|
780
763
|
}
|
|
781
764
|
});
|
|
@@ -1052,7 +1035,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1052
1035
|
const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
|
|
1053
1036
|
return [
|
|
1054
1037
|
{
|
|
1055
|
-
name: `${
|
|
1038
|
+
name: `${_chunk7K3R5LV6js.vitePluginName}:rewrite-css-imports`,
|
|
1056
1039
|
enforce: "pre",
|
|
1057
1040
|
resolveId: {
|
|
1058
1041
|
order: "pre",
|
|
@@ -1094,12 +1077,12 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1094
1077
|
}
|
|
1095
1078
|
|
|
1096
1079
|
// src/bundlers/vite/index.ts
|
|
1097
|
-
var debug =
|
|
1080
|
+
var debug = _chunk7K3R5LV6js.createDebug.call(void 0, );
|
|
1098
1081
|
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
1099
1082
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
1100
1083
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
1101
1084
|
const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
|
|
1102
|
-
const opts =
|
|
1085
|
+
const opts = _chunk7K3R5LV6js.getCompilerContext.call(void 0, options);
|
|
1103
1086
|
const {
|
|
1104
1087
|
disabled,
|
|
1105
1088
|
customAttributes,
|
|
@@ -1124,8 +1107,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1124
1107
|
if (disabledOptions.plugin) {
|
|
1125
1108
|
return rewritePlugins.length ? rewritePlugins : void 0;
|
|
1126
1109
|
}
|
|
1127
|
-
const customAttributesEntities =
|
|
1128
|
-
const patchRecorderState =
|
|
1110
|
+
const customAttributesEntities = _chunk7K3R5LV6js.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
1111
|
+
const patchRecorderState = _chunkRB7YN5XZjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
1129
1112
|
source: "runtime",
|
|
1130
1113
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
1131
1114
|
});
|
|
@@ -1141,8 +1124,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1141
1124
|
let runtimeRefreshSignature;
|
|
1142
1125
|
let runtimeRefreshOptionsKey;
|
|
1143
1126
|
function resolveRuntimeRefreshOptions() {
|
|
1144
|
-
const configPath = _optionalChain([runtimeState, 'access',
|
|
1145
|
-
const signature =
|
|
1127
|
+
const configPath = _optionalChain([runtimeState, 'access', _29 => _29.twPatcher, 'access', _30 => _30.options, 'optionalAccess', _31 => _31.tailwind, 'optionalAccess', _32 => _32.config]);
|
|
1128
|
+
const signature = _chunk7K3R5LV6js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
1146
1129
|
const optionsKey = JSON.stringify({
|
|
1147
1130
|
appType,
|
|
1148
1131
|
uniAppX: Boolean(uniAppX),
|
|
@@ -1163,7 +1146,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1163
1146
|
async function refreshRuntimeState(force) {
|
|
1164
1147
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
1165
1148
|
const shouldRefresh = force || invalidation.changed;
|
|
1166
|
-
const refreshed = await
|
|
1149
|
+
const refreshed = await _chunk7K3R5LV6js.refreshTailwindRuntimeState.call(void 0, runtimeState, {
|
|
1167
1150
|
force: shouldRefresh,
|
|
1168
1151
|
clearCache: force || invalidation.changed
|
|
1169
1152
|
});
|
|
@@ -1184,7 +1167,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1184
1167
|
}
|
|
1185
1168
|
if (forceRuntimeRefresh || !runtimeSetPromise) {
|
|
1186
1169
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
1187
|
-
const task2 =
|
|
1170
|
+
const task2 = _chunk7K3R5LV6js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
1188
1171
|
force: forceRuntimeRefresh || invalidation.changed,
|
|
1189
1172
|
skipRefresh: forceRuntimeRefresh,
|
|
1190
1173
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -1220,7 +1203,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1220
1203
|
const plugins = [
|
|
1221
1204
|
...rewritePlugins,
|
|
1222
1205
|
{
|
|
1223
|
-
name: `${
|
|
1206
|
+
name: `${_chunk7K3R5LV6js.vitePluginName}:post`,
|
|
1224
1207
|
enforce: "post",
|
|
1225
1208
|
configResolved(config) {
|
|
1226
1209
|
resolvedConfig = config;
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-RRHPTTCP.mjs";
|
|
13
13
|
import {
|
|
14
14
|
setupPatchRecorder
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-4QCL7FBX.mjs";
|
|
16
16
|
import {
|
|
17
17
|
collectRuntimeClassSet,
|
|
18
18
|
createAttributeMatcher,
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
replaceWxml,
|
|
25
25
|
toCustomAttributesEntities,
|
|
26
26
|
vitePluginName
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-RXM5ERRJ.mjs";
|
|
28
28
|
import {
|
|
29
29
|
resolveUniUtsPlatform
|
|
30
30
|
} from "./chunk-OOHJLO5M.mjs";
|
|
@@ -666,21 +666,6 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
|
666
666
|
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
667
667
|
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
668
668
|
}
|
|
669
|
-
function resolveViteStaleClassNameFallback(option, resolvedConfig) {
|
|
670
|
-
if (typeof option === "boolean") {
|
|
671
|
-
return option;
|
|
672
|
-
}
|
|
673
|
-
if (!resolvedConfig) {
|
|
674
|
-
return false;
|
|
675
|
-
}
|
|
676
|
-
if (resolvedConfig.command === "serve") {
|
|
677
|
-
return true;
|
|
678
|
-
}
|
|
679
|
-
if (resolvedConfig.command === "build" && resolvedConfig.build?.watch) {
|
|
680
|
-
return true;
|
|
681
|
-
}
|
|
682
|
-
return false;
|
|
683
|
-
}
|
|
684
669
|
function createGenerateBundleHook(context) {
|
|
685
670
|
const state = {
|
|
686
671
|
iteration: 0,
|
|
@@ -728,7 +713,6 @@ function createGenerateBundleHook(context) {
|
|
|
728
713
|
const processSets = buildProcessSets(entries, opts, dirtyEntries.changedByType, state.previousLinkedByEntry, disableDirtyOptimization);
|
|
729
714
|
const processFiles = processSets.files;
|
|
730
715
|
const resolvedConfig = getResolvedConfig();
|
|
731
|
-
const staleClassNameFallback = resolveViteStaleClassNameFallback(opts.staleClassNameFallback, resolvedConfig);
|
|
732
716
|
const rootDir = resolvedConfig?.root ? path2.resolve(resolvedConfig.root) : process2.cwd();
|
|
733
717
|
const outDir = resolvedConfig?.build?.outDir ? path2.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
734
718
|
const jsEntries = /* @__PURE__ */ new Map();
|
|
@@ -771,7 +755,6 @@ function createGenerateBundleHook(context) {
|
|
|
771
755
|
};
|
|
772
756
|
const createHandlerOptions = (absoluteFilename, extra) => ({
|
|
773
757
|
...extra,
|
|
774
|
-
staleClassNameFallback: extra?.staleClassNameFallback ?? staleClassNameFallback,
|
|
775
758
|
filename: absoluteFilename,
|
|
776
759
|
moduleGraph: moduleGraphOptions,
|
|
777
760
|
babelParserOptions: {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkP65O2L27js = require('./chunk-P65O2L27.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
@@ -23,14 +23,14 @@ var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
|
|
|
23
23
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkRB7YN5XZjs = require('./chunk-RB7YN5XZ.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunk7K3R5LV6js = require('./chunk-7K3R5LV6.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
@@ -57,10 +57,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
57
57
|
} = options;
|
|
58
58
|
const { Compilation, sources } = compiler.webpack;
|
|
59
59
|
const { ConcatSource } = sources;
|
|
60
|
-
compiler.hooks.compilation.tap(
|
|
60
|
+
compiler.hooks.compilation.tap(_chunk7K3R5LV6js.pluginName, (compilation) => {
|
|
61
61
|
compilation.hooks.processAssets.tapPromise(
|
|
62
62
|
{
|
|
63
|
-
name:
|
|
63
|
+
name: _chunk7K3R5LV6js.pluginName,
|
|
64
64
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
65
65
|
},
|
|
66
66
|
async (assets) => {
|
|
@@ -72,7 +72,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
72
72
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const assetHashByChunk =
|
|
75
|
+
const assetHashByChunk = _chunkP65O2L27js.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
76
76
|
const entries = Object.entries(assets);
|
|
77
77
|
const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
|
|
78
78
|
const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
|
|
@@ -129,7 +129,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
129
129
|
};
|
|
130
130
|
const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
|
|
131
131
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
132
|
-
const runtimeSet = await
|
|
132
|
+
const runtimeSet = await _chunk7K3R5LV6js.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
133
133
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
134
134
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
135
135
|
forceCollect: true,
|
|
@@ -174,7 +174,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
174
174
|
const jsTaskFactories = [];
|
|
175
175
|
if (Array.isArray(groupedEntries.js)) {
|
|
176
176
|
for (const [file] of groupedEntries.js) {
|
|
177
|
-
const cacheKey =
|
|
177
|
+
const cacheKey = _chunkP65O2L27js.getCacheKey.call(void 0, file);
|
|
178
178
|
const asset = compilation.getAsset(file);
|
|
179
179
|
if (!asset) {
|
|
180
180
|
continue;
|
|
@@ -286,9 +286,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
286
286
|
getClassSetInLoader,
|
|
287
287
|
debug: debug2
|
|
288
288
|
} = options;
|
|
289
|
-
const isMpxApp =
|
|
289
|
+
const isMpxApp = _chunkP65O2L27js.isMpx.call(void 0, appType);
|
|
290
290
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
291
|
-
|
|
291
|
+
_chunkP65O2L27js.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
292
292
|
}
|
|
293
293
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
294
294
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -301,12 +301,12 @@ function setupWebpackV5Loaders(options) {
|
|
|
301
301
|
const classSetLoaderOptions = {
|
|
302
302
|
getClassSet: getClassSetInLoader
|
|
303
303
|
};
|
|
304
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
304
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkP65O2L27js.createLoaderAnchorFinders.call(void 0, appType);
|
|
305
305
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
306
306
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
307
307
|
} : void 0;
|
|
308
308
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
309
|
-
|
|
309
|
+
_chunkP65O2L27js.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
310
310
|
}
|
|
311
311
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
312
312
|
loader: runtimeClassSetLoader,
|
|
@@ -326,17 +326,17 @@ function setupWebpackV5Loaders(options) {
|
|
|
326
326
|
};
|
|
327
327
|
};
|
|
328
328
|
const { NormalModule } = compiler.webpack;
|
|
329
|
-
compiler.hooks.compilation.tap(
|
|
330
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
329
|
+
compiler.hooks.compilation.tap(_chunk7K3R5LV6js.pluginName, (compilation) => {
|
|
330
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunk7K3R5LV6js.pluginName, (_loaderContext, module) => {
|
|
331
331
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
332
332
|
if (!hasRuntimeLoader) {
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
|
-
|
|
335
|
+
_chunkP65O2L27js.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
|
|
336
336
|
const loaderEntries = module.loaders || [];
|
|
337
337
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
338
338
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
339
|
-
const isCssModule =
|
|
339
|
+
const isCssModule = _chunkP65O2L27js.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
340
340
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
341
341
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
342
342
|
}
|
|
@@ -368,7 +368,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
368
368
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
|
-
if (runtimeClassSetLoaderExists && !
|
|
371
|
+
if (runtimeClassSetLoaderExists && !_chunkP65O2L27js.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
372
372
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
373
373
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
374
374
|
if (anchorIndex === -1) {
|
|
@@ -383,11 +383,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
383
383
|
}
|
|
384
384
|
|
|
385
385
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
386
|
-
var debug =
|
|
386
|
+
var debug = _chunk7K3R5LV6js.createDebug.call(void 0, );
|
|
387
387
|
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
388
388
|
var UnifiedWebpackPluginV5 = class {
|
|
389
389
|
constructor(options = {}) {
|
|
390
|
-
this.options =
|
|
390
|
+
this.options = _chunk7K3R5LV6js.getCompilerContext.call(void 0, options);
|
|
391
391
|
this.appType = this.options.appType;
|
|
392
392
|
}
|
|
393
393
|
apply(compiler) {
|
|
@@ -403,19 +403,19 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
403
403
|
const disabledOptions = _chunkIIDSY4XZjs.resolveDisabledOptions.call(void 0, disabled);
|
|
404
404
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
405
405
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
406
|
-
const isMpxApp =
|
|
406
|
+
const isMpxApp = _chunkP65O2L27js.isMpx.call(void 0, this.appType);
|
|
407
407
|
if (shouldRewriteCssImports) {
|
|
408
|
-
|
|
408
|
+
_chunkP65O2L27js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
409
409
|
pkgDir: weappTailwindcssPackageDir,
|
|
410
410
|
enabled: true,
|
|
411
411
|
appType: this.appType
|
|
412
412
|
});
|
|
413
|
-
|
|
413
|
+
_chunkP65O2L27js.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
414
414
|
}
|
|
415
415
|
if (disabledOptions.plugin) {
|
|
416
416
|
return;
|
|
417
417
|
}
|
|
418
|
-
const patchRecorderState =
|
|
418
|
+
const patchRecorderState = _chunkRB7YN5XZjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
419
419
|
source: "runtime",
|
|
420
420
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
421
421
|
});
|
|
@@ -431,18 +431,18 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
431
431
|
runtimeSetPrepared = false;
|
|
432
432
|
};
|
|
433
433
|
if (_optionalChain([compiler, 'access', _13 => _13.hooks, 'access', _14 => _14.thisCompilation, 'optionalAccess', _15 => _15.tap])) {
|
|
434
|
-
compiler.hooks.thisCompilation.tap(
|
|
434
|
+
compiler.hooks.thisCompilation.tap(_chunk7K3R5LV6js.pluginName, resetRuntimePreparation);
|
|
435
435
|
} else if (_optionalChain([compiler, 'access', _16 => _16.hooks, 'access', _17 => _17.compilation, 'optionalAccess', _18 => _18.tap])) {
|
|
436
|
-
compiler.hooks.compilation.tap(
|
|
436
|
+
compiler.hooks.compilation.tap(_chunk7K3R5LV6js.pluginName, resetRuntimePreparation);
|
|
437
437
|
}
|
|
438
438
|
async function getClassSetInLoader() {
|
|
439
439
|
if (runtimeSetPrepared) {
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
|
-
const signature =
|
|
442
|
+
const signature = _chunk7K3R5LV6js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
443
443
|
const forceRefresh = signature !== runtimeSetSignature;
|
|
444
444
|
runtimeSetPrepared = true;
|
|
445
|
-
await
|
|
445
|
+
await _chunk7K3R5LV6js.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
446
446
|
forceRefresh,
|
|
447
447
|
forceCollect: true,
|
|
448
448
|
clearCache: forceRefresh,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk7K3R5LV6js = require('./chunk-7K3R5LV6.js');
|
|
7
7
|
|
|
8
8
|
// src/shared/mpx.ts
|
|
9
9
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
@@ -154,8 +154,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
|
|
|
154
154
|
if (!options.enabled) {
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
|
-
compiler.hooks.normalModuleFactory.tap(
|
|
158
|
-
factory.hooks.beforeResolve.tap(
|
|
157
|
+
compiler.hooks.normalModuleFactory.tap(_chunk7K3R5LV6js.pluginName, (factory) => {
|
|
158
|
+
factory.hooks.beforeResolve.tap(_chunk7K3R5LV6js.pluginName, (data) => {
|
|
159
159
|
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
160
160
|
});
|
|
161
161
|
});
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunk7K3R5LV6js = require('./chunk-7K3R5LV6.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunk5APD2MNVjs = require('./chunk-5APD2MNV.js');
|
|
8
8
|
|
|
9
9
|
// src/tailwindcss/recorder.ts
|
|
10
10
|
function setupPatchRecorder(patcher, baseDir, options) {
|
|
11
|
-
const recorder =
|
|
11
|
+
const recorder = _chunk7K3R5LV6js.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
|
|
12
12
|
if (_optionalChain([recorder, 'optionalAccess', _ => _.message]) && _optionalChain([options, 'optionalAccess', _2 => _2.logMessage]) !== false) {
|
|
13
13
|
const prefix = _optionalChain([options, 'optionalAccess', _3 => _3.messagePrefix]) ? `${options.messagePrefix} ` : "";
|
|
14
14
|
_chunk5APD2MNVjs.logger.info("%s%s", prefix, recorder.message);
|
|
@@ -16,7 +16,7 @@ function setupPatchRecorder(patcher, baseDir, options) {
|
|
|
16
16
|
const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _4 => _4.onPatched]) ? async () => {
|
|
17
17
|
await recorder.onPatched();
|
|
18
18
|
} : void 0;
|
|
19
|
-
const patchPromise = patcher ?
|
|
19
|
+
const patchPromise = patcher ? _chunk7K3R5LV6js.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
|
|
20
20
|
return {
|
|
21
21
|
recorder,
|
|
22
22
|
patchPromise,
|