weapp-tailwindcss 4.12.0-alpha.3 → 4.12.0
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-L3O54VR6.js → chunk-24AGZQVR.js} +2 -2
- package/dist/{chunk-6VMGUTN6.mjs → chunk-57SOQCAU.mjs} +4 -4
- package/dist/{chunk-I5H5RDWS.mjs → chunk-5ZYHNDEK.mjs} +61 -23
- package/dist/{chunk-P2X2S444.js → chunk-DUHYLR2R.js} +7 -7
- package/dist/{chunk-UVMAPQU7.js → chunk-FS2NOOEB.js} +5 -5
- package/dist/{chunk-OSWTWMAK.js → chunk-HVNGIKLS.js} +33 -23
- package/dist/{chunk-2PFYPSPO.js → chunk-JZQBZHN5.js} +39 -39
- package/dist/{chunk-J6FIO3RO.mjs → chunk-KGTVD4EP.mjs} +19 -9
- package/dist/{chunk-HL3US2OT.mjs → chunk-NNOQDMUP.mjs} +1 -1
- package/dist/{chunk-SON7XE3T.js → chunk-OFB2KBRP.js} +146 -108
- package/dist/{chunk-AYJ4HLWZ.mjs → chunk-PCDYXXSK.mjs} +11 -4
- package/dist/{chunk-ONLKZIRQ.js → chunk-RKISS72P.js} +1 -1
- package/dist/{chunk-6MIA3KYY.mjs → chunk-RRQZL7FQ.mjs} +1 -1
- package/dist/{chunk-XHTCHZVE.mjs → chunk-XZP3MREK.mjs} +1 -1
- package/dist/{chunk-NIS74SI6.js → chunk-ZAA5ZG3D.js} +60 -53
- package/dist/cli.js +7 -7
- package/dist/cli.mjs +7 -7
- package/dist/core.js +9 -9
- package/dist/core.mjs +3 -3
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +4 -4
- package/dist/index.js +9 -9
- package/dist/index.mjs +7 -7
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +6 -6
- package/dist/presets.mjs +2 -2
- package/dist/reset.js +1 -1
- package/dist/reset.mjs +1 -1
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +4 -4
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.js +35 -35
- package/dist/webpack4.mjs +4 -4
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
|
-
var
|
|
3
|
+
var _chunkRKISS72Pjs = require('./chunk-RKISS72P.js');
|
|
4
4
|
|
|
5
5
|
// src/utils/disabled.ts
|
|
6
6
|
function resolveDisabledOptions(disabled) {
|
|
@@ -19,7 +19,7 @@ function resolveDisabledOptions(disabled) {
|
|
|
19
19
|
// src/utils/resolve-package.ts
|
|
20
20
|
var _module = require('module');
|
|
21
21
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
22
|
-
var require2 = _module.createRequire.call(void 0,
|
|
22
|
+
var require2 = _module.createRequire.call(void 0, _chunkRKISS72Pjs.importMetaUrl);
|
|
23
23
|
function resolvePackageDir(name) {
|
|
24
24
|
const pkgPath = require2.resolve(`${name}/package.json`);
|
|
25
25
|
return _path2.default.dirname(pkgPath);
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
isMpx,
|
|
12
12
|
patchMpxLoaderResolve,
|
|
13
13
|
setupMpxTailwindcssRedirect
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-RRQZL7FQ.mjs";
|
|
15
15
|
import {
|
|
16
16
|
pushConcurrentTaskFactories,
|
|
17
17
|
resolveDisabledOptions,
|
|
@@ -29,17 +29,17 @@ import {
|
|
|
29
29
|
pluginName,
|
|
30
30
|
setupPatchRecorder,
|
|
31
31
|
shouldSkipJsTransform
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-KGTVD4EP.mjs";
|
|
33
33
|
import {
|
|
34
34
|
getRuntimeClassSetSignature,
|
|
35
35
|
resolveTailwindcssOptions
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-PCDYXXSK.mjs";
|
|
37
37
|
import {
|
|
38
38
|
getGroupedEntries
|
|
39
39
|
} from "./chunk-OOHJLO5M.mjs";
|
|
40
40
|
import {
|
|
41
41
|
__dirname
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-NNOQDMUP.mjs";
|
|
43
43
|
|
|
44
44
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
45
45
|
import process3 from "process";
|
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
toCustomAttributesEntities,
|
|
29
29
|
traverse,
|
|
30
30
|
vitePluginName
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-KGTVD4EP.mjs";
|
|
32
32
|
import {
|
|
33
33
|
findNearestPackageRoot,
|
|
34
34
|
findTailwindConfig,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
logger,
|
|
38
38
|
resolveTailwindcssOptions,
|
|
39
39
|
resolveUniAppXOptions
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-PCDYXXSK.mjs";
|
|
41
41
|
import {
|
|
42
42
|
resolveUniUtsPlatform
|
|
43
43
|
} from "./chunk-OOHJLO5M.mjs";
|
|
@@ -79,7 +79,7 @@ function extractLiteralValue(path7) {
|
|
|
79
79
|
}
|
|
80
80
|
return {
|
|
81
81
|
allowDoubleQuotes,
|
|
82
|
-
literal: path7.node.value.raw,
|
|
82
|
+
literal: typeof path7.node.value === "string" ? path7.node.value : path7.node.value.raw,
|
|
83
83
|
offset: 0
|
|
84
84
|
};
|
|
85
85
|
}
|
|
@@ -262,10 +262,11 @@ function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = prop
|
|
|
262
262
|
ms.update(start, end, collector.collectAndRewriteStaticClass(content ?? ""));
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet
|
|
266
|
-
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION
|
|
265
|
+
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
266
|
+
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION) {
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
+
const expression = prop.exp.content;
|
|
269
270
|
const start = prop.exp.loc.start.offset;
|
|
270
271
|
const end = prop.exp.loc.end.offset;
|
|
271
272
|
if (start >= end) {
|
|
@@ -278,10 +279,11 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet, expression =
|
|
|
278
279
|
});
|
|
279
280
|
ms.update(start, end, generated);
|
|
280
281
|
}
|
|
281
|
-
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet
|
|
282
|
-
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION
|
|
282
|
+
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet) {
|
|
283
|
+
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION) {
|
|
283
284
|
return;
|
|
284
285
|
}
|
|
286
|
+
const expression = prop.exp.content;
|
|
285
287
|
const start = prop.exp.loc.start.offset;
|
|
286
288
|
const end = prop.exp.loc.end.offset;
|
|
287
289
|
if (start >= end) {
|
|
@@ -400,7 +402,8 @@ ${localStyleCollector.toStyleBlock()}`);
|
|
|
400
402
|
}
|
|
401
403
|
}
|
|
402
404
|
const result = {
|
|
403
|
-
code: ms.toString()
|
|
405
|
+
code: ms.toString(),
|
|
406
|
+
map: null
|
|
404
407
|
};
|
|
405
408
|
Object.defineProperty(result, "map", {
|
|
406
409
|
configurable: true,
|
|
@@ -525,6 +528,9 @@ function isPreprocessorRequest(id, lang) {
|
|
|
525
528
|
function resolveUniAppXCssTarget(id) {
|
|
526
529
|
return UVUE_NVUE_RE2.test(cleanUrl(id)) ? "uvue" : void 0;
|
|
527
530
|
}
|
|
531
|
+
function resolveUniAppXJsTransformEnabled(uniAppX) {
|
|
532
|
+
return uniAppX === void 0 ? true : isUniAppXEnabled(uniAppX);
|
|
533
|
+
}
|
|
528
534
|
function createUniAppXPlugins(options) {
|
|
529
535
|
const {
|
|
530
536
|
appType,
|
|
@@ -708,7 +714,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
708
714
|
async transform() {
|
|
709
715
|
const currentSource = originalSource.source.toString();
|
|
710
716
|
const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
|
|
711
|
-
uniAppX: options.uniAppX
|
|
717
|
+
uniAppX: resolveUniAppXJsTransformEnabled(options.uniAppX),
|
|
712
718
|
babelParserOptions: {
|
|
713
719
|
plugins: [
|
|
714
720
|
"typescript"
|
|
@@ -903,6 +909,7 @@ function createBundleBuildState() {
|
|
|
903
909
|
return {
|
|
904
910
|
iteration: 0,
|
|
905
911
|
sourceHashByFile: /* @__PURE__ */ new Map(),
|
|
912
|
+
runtimeAffectingSignatureByFile: /* @__PURE__ */ new Map(),
|
|
906
913
|
runtimeAffectingHashByFile: /* @__PURE__ */ new Map(),
|
|
907
914
|
linkedByEntry: /* @__PURE__ */ new Map(),
|
|
908
915
|
dependentsByLinkedFile: /* @__PURE__ */ new Map()
|
|
@@ -970,16 +977,18 @@ function buildBundleSnapshot(bundle, opts, outDir, state, forceAll = false) {
|
|
|
970
977
|
const source = readEntrySource(output);
|
|
971
978
|
const hash = opts.cache.computeHash(source);
|
|
972
979
|
sourceHashByFile.set(file, hash);
|
|
973
|
-
const runtimeAffectingSignature = createRuntimeAffectingSourceSignature(source, type);
|
|
974
|
-
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
975
|
-
const runtimeAffectingHash = opts.cache.computeHash(runtimeAffectingSignature);
|
|
976
|
-
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
977
980
|
const previousHash = state.sourceHashByFile.get(file);
|
|
978
981
|
const changed = previousHash == null || previousHash !== hash;
|
|
982
|
+
const previousRuntimeAffectingSignature = state.runtimeAffectingSignatureByFile.get(file);
|
|
983
|
+
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
984
|
+
const canReuseRuntimeAffectingSignature = !changed && previousRuntimeAffectingSignature != null && previousRuntimeAffectingHash != null;
|
|
985
|
+
const runtimeAffectingSignature = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingSignature : createRuntimeAffectingSourceSignature(source, type);
|
|
986
|
+
const runtimeAffectingHash = canReuseRuntimeAffectingSignature ? previousRuntimeAffectingHash : opts.cache.computeHash(runtimeAffectingSignature);
|
|
987
|
+
runtimeAffectingSignatureByFile.set(file, runtimeAffectingSignature);
|
|
988
|
+
runtimeAffectingHashByFile.set(file, runtimeAffectingHash);
|
|
979
989
|
if (changed) {
|
|
980
990
|
changedByType[type].add(file);
|
|
981
991
|
}
|
|
982
|
-
const previousRuntimeAffectingHash = state.runtimeAffectingHashByFile.get(file);
|
|
983
992
|
const runtimeAffectingChanged = previousRuntimeAffectingHash == null || previousRuntimeAffectingHash !== runtimeAffectingHash;
|
|
984
993
|
if (runtimeAffectingChanged) {
|
|
985
994
|
runtimeAffectingChangedByType[type].add(file);
|
|
@@ -1049,6 +1058,7 @@ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
|
1049
1058
|
...state.sourceHashByFile,
|
|
1050
1059
|
...snapshot.sourceHashByFile
|
|
1051
1060
|
]) : snapshot.sourceHashByFile;
|
|
1061
|
+
state.runtimeAffectingSignatureByFile = incremental ? new Map([...state.runtimeAffectingSignatureByFile, ...snapshot.runtimeAffectingSignatureByFile]) : snapshot.runtimeAffectingSignatureByFile;
|
|
1052
1062
|
state.runtimeAffectingHashByFile = incremental ? new Map([
|
|
1053
1063
|
...state.runtimeAffectingHashByFile,
|
|
1054
1064
|
...snapshot.runtimeAffectingHashByFile
|
|
@@ -1090,6 +1100,9 @@ function createEmptyMetrics() {
|
|
|
1090
1100
|
function measureElapsed(start) {
|
|
1091
1101
|
return performance.now() - start;
|
|
1092
1102
|
}
|
|
1103
|
+
function resolveUniAppXJsTransformEnabled2(uniAppX) {
|
|
1104
|
+
return uniAppX === void 0 ? true : isUniAppXEnabled(uniAppX);
|
|
1105
|
+
}
|
|
1093
1106
|
function formatCacheHitRate(metric) {
|
|
1094
1107
|
if (metric.total === 0) {
|
|
1095
1108
|
return "0.00%";
|
|
@@ -1137,11 +1150,36 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
|
|
|
1137
1150
|
}
|
|
1138
1151
|
return `${runtimeSignature}:linked:${linkedImpactSignature}`;
|
|
1139
1152
|
}
|
|
1153
|
+
function getSnapshotHash(snapshotMap, file, fallback) {
|
|
1154
|
+
return snapshotMap.get(file) ?? fallback;
|
|
1155
|
+
}
|
|
1140
1156
|
function hasRuntimeAffectingSourceChanges(changedByType) {
|
|
1141
1157
|
return changedByType.html.size > 0 || changedByType.js.size > 0;
|
|
1142
1158
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1159
|
+
var CSS_URL_FUNCTION_RE = /url\((?:"([^"]*)"|'([^']*)'|([^)]*))\)/gi;
|
|
1160
|
+
var CSS_PATH_INDEPENDENT_URL_RE = /^(?:[a-z][a-z\d+.-]*:|\/\/|\/|#)/i;
|
|
1161
|
+
var CSS_IMPORT_RE = /@import\b/i;
|
|
1162
|
+
function isPathIndependentCssUrl(value) {
|
|
1163
|
+
const normalized = value.trim();
|
|
1164
|
+
return normalized.length > 0 && CSS_PATH_INDEPENDENT_URL_RE.test(normalized);
|
|
1165
|
+
}
|
|
1166
|
+
function hasPathDependentCssUrl(rawSource) {
|
|
1167
|
+
CSS_URL_FUNCTION_RE.lastIndex = 0;
|
|
1168
|
+
let match = CSS_URL_FUNCTION_RE.exec(rawSource);
|
|
1169
|
+
while (match !== null) {
|
|
1170
|
+
const value = match[1] ?? match[2] ?? match[3] ?? "";
|
|
1171
|
+
if (!isPathIndependentCssUrl(value)) {
|
|
1172
|
+
return true;
|
|
1173
|
+
}
|
|
1174
|
+
match = CSS_URL_FUNCTION_RE.exec(rawSource);
|
|
1175
|
+
}
|
|
1176
|
+
return false;
|
|
1177
|
+
}
|
|
1178
|
+
function createCssTransformShareScope(file, rawSource) {
|
|
1179
|
+
if (CSS_IMPORT_RE.test(rawSource) || hasPathDependentCssUrl(rawSource)) {
|
|
1180
|
+
return `dir:${normalizeOutputPathKey(path3.dirname(file))}`;
|
|
1181
|
+
}
|
|
1182
|
+
return "global";
|
|
1145
1183
|
}
|
|
1146
1184
|
function hasOmittedKnownBundleFiles(currentBundleFiles, previousBundleFiles) {
|
|
1147
1185
|
const currentFileSet = new Set(currentBundleFiles);
|
|
@@ -1336,8 +1374,8 @@ function createGenerateBundleHook(context) {
|
|
|
1336
1374
|
processCachedTask({
|
|
1337
1375
|
cache,
|
|
1338
1376
|
cacheKey: file,
|
|
1339
|
-
rawSource,
|
|
1340
1377
|
hashKey: `${file}:html:${runtimeSignature}`,
|
|
1378
|
+
hash: getSnapshotHash(snapshot.sourceHashByFile, file, rawSource),
|
|
1341
1379
|
applyResult(source) {
|
|
1342
1380
|
originalSource.source = source;
|
|
1343
1381
|
},
|
|
@@ -1384,14 +1422,15 @@ function createGenerateBundleHook(context) {
|
|
|
1384
1422
|
metrics.css.total++;
|
|
1385
1423
|
const rawSource = originalEntrySource;
|
|
1386
1424
|
const cssRuntimeAffectingSignature = snapshot.runtimeAffectingSignatureByFile.get(file) ?? rawSource;
|
|
1387
|
-
const
|
|
1388
|
-
const
|
|
1425
|
+
const cssShareScope = createCssTransformShareScope(file, rawSource);
|
|
1426
|
+
const cssHandlerOptions = getCssHandlerOptions(file);
|
|
1427
|
+
const cssSharedCacheKey = `${cssShareScope}:${runtimeSignature}:${runtimeState.twPatcher.majorVersion ?? "unknown"}:${cssHandlerOptions.isMainChunk ? "1" : "0"}:${cssRuntimeAffectingSignature}`;
|
|
1389
1428
|
tasks.push(
|
|
1390
1429
|
processCachedTask({
|
|
1391
1430
|
cache,
|
|
1392
1431
|
cacheKey: file,
|
|
1393
1432
|
hashKey: `${file}:css:${runtimeSignature}:${runtimeState.twPatcher.majorVersion ?? "unknown"}`,
|
|
1394
|
-
|
|
1433
|
+
hash: getSnapshotHash(snapshot.runtimeAffectingHashByFile, file, cssRuntimeAffectingSignature),
|
|
1395
1434
|
applyResult(source) {
|
|
1396
1435
|
originalSource.source = source;
|
|
1397
1436
|
},
|
|
@@ -1464,8 +1503,7 @@ function createGenerateBundleHook(context) {
|
|
|
1464
1503
|
cache,
|
|
1465
1504
|
cacheKey: file,
|
|
1466
1505
|
hashKey: `${file}:js`,
|
|
1467
|
-
|
|
1468
|
-
/*${hashSalt}*/`,
|
|
1506
|
+
hash: `${getSnapshotHash(snapshot.sourceHashByFile, file, initialRawSource)}:${hashSalt}`,
|
|
1469
1507
|
applyResult(source) {
|
|
1470
1508
|
originalSource.code = source;
|
|
1471
1509
|
},
|
|
@@ -1560,7 +1598,7 @@ function createGenerateBundleHook(context) {
|
|
|
1560
1598
|
const currentSource = originalEntrySource;
|
|
1561
1599
|
const absoluteFile = path3.resolve(outDir, file);
|
|
1562
1600
|
const precheckOptions = createHandlerOptions(absoluteFile, {
|
|
1563
|
-
uniAppX: uniAppX
|
|
1601
|
+
uniAppX: resolveUniAppXJsTransformEnabled2(uniAppX),
|
|
1564
1602
|
babelParserOptions: {
|
|
1565
1603
|
plugins: ["typescript"],
|
|
1566
1604
|
sourceType: "unambiguous"
|
|
@@ -8,7 +8,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkHVNGIKLSjs = require('./chunk-HVNGIKLS.js');
|
|
12
12
|
|
|
13
13
|
// src/bundlers/gulp/index.ts
|
|
14
14
|
var _buffer = require('buffer');
|
|
@@ -16,12 +16,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
|
16
16
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
17
17
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
18
18
|
var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
19
|
-
var debug =
|
|
19
|
+
var debug = _chunkHVNGIKLSjs.createDebug.call(void 0, );
|
|
20
20
|
var Transform = _stream2.default.Transform;
|
|
21
21
|
function createPlugins(options = {}) {
|
|
22
|
-
const opts =
|
|
22
|
+
const opts = _chunkHVNGIKLSjs.getCompilerContext.call(void 0, options);
|
|
23
23
|
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
24
|
-
const patchRecorderState =
|
|
24
|
+
const patchRecorderState = _chunkHVNGIKLSjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
25
25
|
source: "runtime",
|
|
26
26
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
27
27
|
});
|
|
@@ -39,13 +39,13 @@ function createPlugins(options = {}) {
|
|
|
39
39
|
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
40
40
|
let runtimeSetInitialized = false;
|
|
41
41
|
async function refreshRuntimeState(force) {
|
|
42
|
-
await
|
|
42
|
+
await _chunkHVNGIKLSjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
43
43
|
}
|
|
44
44
|
async function refreshRuntimeSet(force = false) {
|
|
45
45
|
if (!force && runtimeSetInitialized) {
|
|
46
46
|
return runtimeSet;
|
|
47
47
|
}
|
|
48
|
-
runtimeSet = await
|
|
48
|
+
runtimeSet = await _chunkHVNGIKLSjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
49
49
|
forceRefresh: force,
|
|
50
50
|
forceCollect: force,
|
|
51
51
|
clearCache: force,
|
|
@@ -226,7 +226,7 @@ function createPlugins(options = {}) {
|
|
|
226
226
|
async transform() {
|
|
227
227
|
await runtimeState.patchPromise;
|
|
228
228
|
const currentSource = _nullishCoalesce(_optionalChain([file, 'access', _2 => _2.contents, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]), () => ( rawSource));
|
|
229
|
-
if (
|
|
229
|
+
if (_chunkHVNGIKLSjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
|
|
230
230
|
return { result: currentSource };
|
|
231
231
|
}
|
|
232
232
|
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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
|
-
var
|
|
3
|
+
var _chunk24AGZQVRjs = require('./chunk-24AGZQVR.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkHVNGIKLSjs = require('./chunk-HVNGIKLS.js');
|
|
7
7
|
|
|
8
8
|
// src/shared/mpx.ts
|
|
9
9
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
@@ -145,7 +145,7 @@ function rewriteTailwindcssRequestForCss(data, pkgDir, appType) {
|
|
|
145
145
|
if (!CSS_EXT_RE2.test(normalizedIssuer)) {
|
|
146
146
|
return;
|
|
147
147
|
}
|
|
148
|
-
const resolved =
|
|
148
|
+
const resolved = _chunk24AGZQVRjs.resolveTailwindcssImport.call(void 0, request, pkgDir, { appType });
|
|
149
149
|
if (!resolved) {
|
|
150
150
|
return;
|
|
151
151
|
}
|
|
@@ -155,8 +155,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
|
|
|
155
155
|
if (!options.enabled) {
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
compiler.hooks.normalModuleFactory.tap(
|
|
159
|
-
factory.hooks.beforeResolve.tap(
|
|
158
|
+
compiler.hooks.normalModuleFactory.tap(_chunkHVNGIKLSjs.pluginName, (factory) => {
|
|
159
|
+
factory.hooks.beforeResolve.tap(_chunkHVNGIKLSjs.pluginName, (data) => {
|
|
160
160
|
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
161
161
|
});
|
|
162
162
|
});
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkZAA5ZG3Djs = require('./chunk-ZAA5ZG3D.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunkA5PB4KZTjs = require('./chunk-A5PB4KZT.js');
|
|
@@ -40,7 +40,7 @@ var debug = createDebug("[tailwindcss:runtime] ");
|
|
|
40
40
|
var refreshTailwindcssPatcherSymbol = /* @__PURE__ */ Symbol.for("weapp-tailwindcss.refreshTailwindcssPatcher");
|
|
41
41
|
function createTailwindPatchPromise(twPatcher, onPatched) {
|
|
42
42
|
return Promise.resolve(twPatcher.patch()).then(async () => {
|
|
43
|
-
|
|
43
|
+
_chunkZAA5ZG3Djs.invalidateRuntimeClassSet.call(void 0, twPatcher);
|
|
44
44
|
if (onPatched) {
|
|
45
45
|
try {
|
|
46
46
|
await onPatched();
|
|
@@ -95,7 +95,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
|
|
|
95
95
|
}
|
|
96
96
|
await state.patchPromise;
|
|
97
97
|
const entry = getRuntimeClassSetStateEntry(state);
|
|
98
|
-
const signature =
|
|
98
|
+
const signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
|
|
99
99
|
const signatureChanged = entry.signature !== signature;
|
|
100
100
|
const shouldForceCollect = forceCollect || forceRefresh || signatureChanged;
|
|
101
101
|
if (!shouldForceCollect) {
|
|
@@ -130,7 +130,7 @@ async function ensureRuntimeClassSet(state, options = {}) {
|
|
|
130
130
|
try {
|
|
131
131
|
const runtimeSet = await task;
|
|
132
132
|
entry.value = runtimeSet;
|
|
133
|
-
entry.signature =
|
|
133
|
+
entry.signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, state.twPatcher);
|
|
134
134
|
return runtimeSet;
|
|
135
135
|
} finally {
|
|
136
136
|
if (entry.promise === task) {
|
|
@@ -187,8 +187,8 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
const entry =
|
|
191
|
-
const signature =
|
|
190
|
+
const entry = _chunkZAA5ZG3Djs.getRuntimeClassSetCacheEntry.call(void 0, activePatcher);
|
|
191
|
+
const signature = _chunkZAA5ZG3Djs.getRuntimeClassSetSignature.call(void 0, activePatcher);
|
|
192
192
|
if (!options.force) {
|
|
193
193
|
if (entry.value && entry.signature === signature) {
|
|
194
194
|
return entry.value;
|
|
@@ -432,7 +432,7 @@ function formatRelativeToBase(targetPath, baseDir) {
|
|
|
432
432
|
}
|
|
433
433
|
function resolveRecordLocation(baseDir) {
|
|
434
434
|
const normalizedBase = _path2.default.normalize(baseDir);
|
|
435
|
-
const packageRoot = _nullishCoalesce(
|
|
435
|
+
const packageRoot = _nullishCoalesce(_chunkZAA5ZG3Djs.findNearestPackageRoot.call(void 0, normalizedBase), () => ( normalizedBase));
|
|
436
436
|
const packageJsonPath = _path2.default.join(packageRoot, "package.json");
|
|
437
437
|
const hasPackageJson = _fs.existsSync.call(void 0, packageJsonPath);
|
|
438
438
|
const recordKeySource = hasPackageJson ? packageJsonPath : normalizedBase;
|
|
@@ -469,7 +469,7 @@ function getRecordFileCandidates(baseDir) {
|
|
|
469
469
|
// package.json
|
|
470
470
|
var package_default = {
|
|
471
471
|
name: "weapp-tailwindcss",
|
|
472
|
-
version: "4.12.0
|
|
472
|
+
version: "4.12.0",
|
|
473
473
|
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!",
|
|
474
474
|
author: "ice breaker <1324318532@qq.com>",
|
|
475
475
|
license: "MIT",
|
|
@@ -662,10 +662,10 @@ var package_default = {
|
|
|
662
662
|
},
|
|
663
663
|
dependencies: {
|
|
664
664
|
"@ast-core/escape": "~1.0.1",
|
|
665
|
-
"@babel/parser": "~7.29.
|
|
665
|
+
"@babel/parser": "~7.29.3",
|
|
666
666
|
"@babel/traverse": "~7.29.0",
|
|
667
667
|
"@babel/types": "~7.29.0",
|
|
668
|
-
"@tailwindcss-mangle/config": "^7.0.
|
|
668
|
+
"@tailwindcss-mangle/config": "^7.0.1",
|
|
669
669
|
"@vue/compiler-dom": "catalog:vue3",
|
|
670
670
|
"@vue/compiler-sfc": "catalog:vue3",
|
|
671
671
|
"@weapp-core/escape": "~7.0.0",
|
|
@@ -686,7 +686,7 @@ var package_default = {
|
|
|
686
686
|
semver: "~7.7.4",
|
|
687
687
|
"tailwindcss-patch": "catalog:tailwindcssPatch",
|
|
688
688
|
"webpack-sources": "3.3.4",
|
|
689
|
-
yaml: "^2.8.
|
|
689
|
+
yaml: "^2.8.4"
|
|
690
690
|
},
|
|
691
691
|
devDependencies: {
|
|
692
692
|
"fast-check": "^4.7.0"
|
|
@@ -1568,7 +1568,7 @@ function isClassLikeCallExpression(path5, valuePath) {
|
|
|
1568
1568
|
if (!helperName || !CLASS_HELPER_IDENTIFIERS.has(normalizeKeyword(helperName))) {
|
|
1569
1569
|
return false;
|
|
1570
1570
|
}
|
|
1571
|
-
return path5.get("arguments").
|
|
1571
|
+
return path5.get("arguments").some((argumentPath) => argumentPath.node === valuePath.node);
|
|
1572
1572
|
}
|
|
1573
1573
|
function isClassContextLiteralPath(path5) {
|
|
1574
1574
|
let current = path5;
|
|
@@ -3003,6 +3003,7 @@ defaultEvalHandler = jsHandler;
|
|
|
3003
3003
|
|
|
3004
3004
|
// src/js/index.ts
|
|
3005
3005
|
var RESULT_CACHE_MAX = 512;
|
|
3006
|
+
var CACHEABLE_SOURCE_MAX_LENGTH = 512;
|
|
3006
3007
|
var classNameSetIds = /* @__PURE__ */ new WeakMap();
|
|
3007
3008
|
var nextClassNameSetId = 0;
|
|
3008
3009
|
function getClassNameSetId(set) {
|
|
@@ -3056,6 +3057,15 @@ function hasDefinedOverrides(options) {
|
|
|
3056
3057
|
}
|
|
3057
3058
|
return false;
|
|
3058
3059
|
}
|
|
3060
|
+
function shouldCacheJsResult(rawSource, options) {
|
|
3061
|
+
if (rawSource.length === 0 || rawSource.length > CACHEABLE_SOURCE_MAX_LENGTH) {
|
|
3062
|
+
return false;
|
|
3063
|
+
}
|
|
3064
|
+
if (options.moduleGraph || options.filename) {
|
|
3065
|
+
return false;
|
|
3066
|
+
}
|
|
3067
|
+
return true;
|
|
3068
|
+
}
|
|
3059
3069
|
function createJsHandler(options) {
|
|
3060
3070
|
const defaults = {
|
|
3061
3071
|
escapeMap: options.escapeMap,
|
|
@@ -3100,14 +3110,14 @@ function createJsHandler(options) {
|
|
|
3100
3110
|
return created;
|
|
3101
3111
|
}
|
|
3102
3112
|
function getCachedJsResult(rawSource, resolvedOptions) {
|
|
3103
|
-
if (rawSource
|
|
3113
|
+
if (!shouldCacheJsResult(rawSource, resolvedOptions)) {
|
|
3104
3114
|
return void 0;
|
|
3105
3115
|
}
|
|
3106
3116
|
const key = `${getOptionsFingerprint(resolvedOptions)}:${_node.md5.call(void 0, rawSource)}`;
|
|
3107
3117
|
return resultCache.get(key);
|
|
3108
3118
|
}
|
|
3109
3119
|
function setCachedJsResult(rawSource, resolvedOptions, result) {
|
|
3110
|
-
if (rawSource
|
|
3120
|
+
if (!shouldCacheJsResult(rawSource, resolvedOptions) || result.error || result.linked) {
|
|
3111
3121
|
return result;
|
|
3112
3122
|
}
|
|
3113
3123
|
const key = `${getOptionsFingerprint(resolvedOptions)}:${_node.md5.call(void 0, rawSource)}`;
|
|
@@ -3512,7 +3522,7 @@ function handleEachClassFragment(ms, tokens, options = {}) {
|
|
|
3512
3522
|
previousEnd = token.end;
|
|
3513
3523
|
}
|
|
3514
3524
|
if (tokens.length > 0) {
|
|
3515
|
-
const lastToken = tokens.
|
|
3525
|
+
const lastToken = tokens[tokens.length - 1];
|
|
3516
3526
|
if (lastToken.end < ms.original.length) {
|
|
3517
3527
|
updateWhitespaceGap(ms, lastToken.end, ms.original.length, options);
|
|
3518
3528
|
}
|
|
@@ -3693,8 +3703,8 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
|
|
|
3693
3703
|
disabledDefaultTemplateHandler,
|
|
3694
3704
|
replaceRuntimePackages
|
|
3695
3705
|
} = ctx;
|
|
3696
|
-
const uniAppXEnabled =
|
|
3697
|
-
const resolvedUniAppXOptions =
|
|
3706
|
+
const uniAppXEnabled = _chunkZAA5ZG3Djs.isUniAppXEnabled.call(void 0, uniAppX);
|
|
3707
|
+
const resolvedUniAppXOptions = _chunkZAA5ZG3Djs.resolveUniAppXOptions.call(void 0, uniAppX);
|
|
3698
3708
|
const moduleSpecifierReplacements = resolveRuntimePackageReplacements(replaceRuntimePackages);
|
|
3699
3709
|
const styleHandler = _postcss.createStyleHandler.call(void 0, {
|
|
3700
3710
|
cssPreflight,
|
|
@@ -3810,15 +3820,15 @@ function createInternalCompilerContext(opts) {
|
|
|
3810
3820
|
);
|
|
3811
3821
|
ctx.escapeMap = ctx.customReplaceDictionary;
|
|
3812
3822
|
applyLoggerLevel(ctx.logLevel);
|
|
3813
|
-
const twPatcher =
|
|
3823
|
+
const twPatcher = _chunkZAA5ZG3Djs.createTailwindcssPatcherFromContext.call(void 0, ctx);
|
|
3814
3824
|
logTailwindcssTarget("runtime", twPatcher, ctx.tailwindcssBasedir);
|
|
3815
3825
|
logRuntimeTailwindcssVersion(
|
|
3816
3826
|
ctx.tailwindcssBasedir,
|
|
3817
3827
|
_optionalChain([twPatcher, 'access', _120 => _120.packageInfo, 'optionalAccess', _121 => _121.rootPath]),
|
|
3818
3828
|
_optionalChain([twPatcher, 'access', _122 => _122.packageInfo, 'optionalAccess', _123 => _123.version])
|
|
3819
3829
|
);
|
|
3820
|
-
|
|
3821
|
-
const cssCalcOptions =
|
|
3830
|
+
_chunkZAA5ZG3Djs.warnMissingCssEntries.call(void 0, ctx, twPatcher);
|
|
3831
|
+
const cssCalcOptions = _chunkZAA5ZG3Djs.applyV4CssCalcDefaults.call(void 0, ctx.cssCalc, twPatcher);
|
|
3822
3832
|
ctx.cssCalc = cssCalcOptions;
|
|
3823
3833
|
const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
|
|
3824
3834
|
const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
|
|
@@ -3837,8 +3847,8 @@ function createInternalCompilerContext(opts) {
|
|
|
3837
3847
|
if (_optionalChain([options, 'optionalAccess', _124 => _124.clearCache]) !== false) {
|
|
3838
3848
|
await clearTailwindcssPatcherCache(previousPatcher);
|
|
3839
3849
|
}
|
|
3840
|
-
|
|
3841
|
-
const nextPatcher =
|
|
3850
|
+
_chunkZAA5ZG3Djs.invalidateRuntimeClassSet.call(void 0, previousPatcher);
|
|
3851
|
+
const nextPatcher = _chunkZAA5ZG3Djs.createTailwindcssPatcherFromContext.call(void 0, ctx);
|
|
3842
3852
|
Object.assign(previousPatcher, nextPatcher);
|
|
3843
3853
|
ctx.twPatcher = previousPatcher;
|
|
3844
3854
|
return previousPatcher;
|
|
@@ -3885,7 +3895,7 @@ function setupPatchRecorder(patcher, baseDir, options) {
|
|
|
3885
3895
|
const recorder = createPatchTargetRecorder(baseDir, patcher, options);
|
|
3886
3896
|
if (_optionalChain([recorder, 'optionalAccess', _128 => _128.message]) && _optionalChain([options, 'optionalAccess', _129 => _129.logMessage]) !== false) {
|
|
3887
3897
|
const prefix = _optionalChain([options, 'optionalAccess', _130 => _130.messagePrefix]) ? `${options.messagePrefix} ` : "";
|
|
3888
|
-
|
|
3898
|
+
_chunkZAA5ZG3Djs.logger.info("%s%s", prefix, recorder.message);
|
|
3889
3899
|
}
|
|
3890
3900
|
const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _131 => _131.onPatched]) ? async () => {
|
|
3891
3901
|
await recorder.onPatched();
|