weapp-tailwindcss 4.11.1 → 4.12.0-next.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/README.md +38 -0
- package/dist/{chunk-VOCOKTZW.js → chunk-5ONE75V7.js} +117 -119
- package/dist/{chunk-OMARW5NC.mjs → chunk-AYJ4HLWZ.mjs} +4 -2
- package/dist/{chunk-SV55AOBL.mjs → chunk-F5XJWJYO.mjs} +12 -7
- package/dist/{chunk-Y6JUVWRU.js → chunk-FMK6SFQQ.js} +10 -6
- package/dist/{chunk-SSASUP5F.js → chunk-GC7WXUOW.js} +187 -82
- package/dist/{chunk-KX2JVTVM.mjs → chunk-GD4SQMVF.mjs} +49 -51
- package/dist/{chunk-7LKMJZD2.js → chunk-GMKSBLNY.js} +2 -2
- package/dist/{chunk-EFBQ4SQR.mjs → chunk-HL3US2OT.mjs} +1 -1
- package/dist/{chunk-6YV5WADN.js → chunk-LVSUBDJC.js} +45 -40
- package/dist/{chunk-QK6VNNNL.js → chunk-NIS74SI6.js} +8 -6
- package/dist/{chunk-CRDOWYG4.js → chunk-ONLKZIRQ.js} +1 -1
- package/dist/{chunk-4O2J5ZM6.mjs → chunk-QNRJCEZN.mjs} +195 -90
- package/dist/{chunk-WSMWD4MC.mjs → chunk-UUJWDME4.mjs} +6 -2
- package/dist/{chunk-Q2HTQFI4.js → chunk-WSS26HZS.js} +5 -5
- package/dist/{chunk-ZUV5AZRB.mjs → chunk-ZR3KN3FG.mjs} +1 -1
- package/dist/cli.js +121 -81
- package/dist/cli.mjs +121 -81
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +14 -9
- package/dist/core.mjs +10 -5
- 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.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +5 -5
- package/dist/gulp.mjs +4 -4
- package/dist/{index-CoXntW_P.d.mts → index-BXrmQelt.d.mts} +29 -1
- package/dist/{index-CoXntW_P.d.ts → index-BXrmQelt.d.ts} +29 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- 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.d.mts +8 -1
- package/dist/presets.d.ts +8 -1
- package/dist/presets.js +7 -6
- package/dist/presets.mjs +3 -2
- package/dist/reset.d.mts +1 -31
- package/dist/reset.d.ts +3 -32
- package/dist/reset.js +3 -160
- package/dist/reset.mjs +3 -160
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +6 -6
- package/dist/vite.mjs +4 -4
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +7 -7
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +41 -36
- package/dist/webpack4.mjs +12 -7
- package/package.json +8 -4
|
@@ -23,18 +23,20 @@ import {
|
|
|
23
23
|
refreshTailwindRuntimeState,
|
|
24
24
|
replaceWxml,
|
|
25
25
|
setupPatchRecorder,
|
|
26
|
+
shouldSkipJsTransform,
|
|
26
27
|
toCustomAttributesEntities,
|
|
27
28
|
traverse,
|
|
28
29
|
vitePluginName
|
|
29
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QNRJCEZN.mjs";
|
|
30
31
|
import {
|
|
31
32
|
findNearestPackageRoot,
|
|
32
33
|
findTailwindConfig,
|
|
33
34
|
getRuntimeClassSetSignature,
|
|
34
35
|
isUniAppXEnabled,
|
|
36
|
+
logger,
|
|
35
37
|
resolveTailwindcssOptions,
|
|
36
38
|
resolveUniAppXOptions
|
|
37
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-AYJ4HLWZ.mjs";
|
|
38
40
|
import {
|
|
39
41
|
resolveUniUtsPlatform
|
|
40
42
|
} from "./chunk-OOHJLO5M.mjs";
|
|
@@ -43,7 +45,7 @@ import {
|
|
|
43
45
|
import { existsSync as existsSync2 } from "fs";
|
|
44
46
|
import path6 from "path";
|
|
45
47
|
import process4 from "process";
|
|
46
|
-
import { logger as
|
|
48
|
+
import { logger as logger3 } from "@weapp-tailwindcss/logger";
|
|
47
49
|
import postcssHtmlTransform from "@weapp-tailwindcss/postcss/html-transform";
|
|
48
50
|
|
|
49
51
|
// src/uni-app-x/transform.ts
|
|
@@ -239,28 +241,28 @@ function traverse2(node, visitor) {
|
|
|
239
241
|
}
|
|
240
242
|
}
|
|
241
243
|
}
|
|
242
|
-
function updateStaticAttribute(ms, prop) {
|
|
244
|
+
function updateStaticAttribute(ms, prop, content = prop.value?.content) {
|
|
243
245
|
if (!prop.value) {
|
|
244
246
|
return;
|
|
245
247
|
}
|
|
246
248
|
const start = prop.value.loc.start.offset + 1;
|
|
247
249
|
const end = prop.value.loc.end.offset - 1;
|
|
248
250
|
if (start < end) {
|
|
249
|
-
ms.update(start, end, replaceWxml(
|
|
251
|
+
ms.update(start, end, replaceWxml(content ?? ""));
|
|
250
252
|
}
|
|
251
253
|
}
|
|
252
|
-
function updateStaticAttributeWithLocalStyle(ms, prop, collector) {
|
|
254
|
+
function updateStaticAttributeWithLocalStyle(ms, prop, collector, content = prop.value?.content) {
|
|
253
255
|
if (!prop.value) {
|
|
254
256
|
return;
|
|
255
257
|
}
|
|
256
258
|
const start = prop.value.loc.start.offset + 1;
|
|
257
259
|
const end = prop.value.loc.end.offset - 1;
|
|
258
260
|
if (start < end) {
|
|
259
|
-
ms.update(start, end, collector.collectAndRewriteStaticClass(
|
|
261
|
+
ms.update(start, end, collector.collectAndRewriteStaticClass(content ?? ""));
|
|
260
262
|
}
|
|
261
263
|
}
|
|
262
|
-
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
263
|
-
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION) {
|
|
264
|
+
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet, expression = prop.exp?.content) {
|
|
265
|
+
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION || expression === void 0) {
|
|
264
266
|
return;
|
|
265
267
|
}
|
|
266
268
|
const start = prop.exp.loc.start.offset;
|
|
@@ -268,15 +270,15 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
|
268
270
|
if (start >= end) {
|
|
269
271
|
return;
|
|
270
272
|
}
|
|
271
|
-
const generated = generateCode(
|
|
273
|
+
const generated = generateCode(expression, {
|
|
272
274
|
jsHandler,
|
|
273
275
|
runtimeSet,
|
|
274
276
|
wrapExpression: true
|
|
275
277
|
});
|
|
276
278
|
ms.update(start, end, generated);
|
|
277
279
|
}
|
|
278
|
-
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet) {
|
|
279
|
-
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION) {
|
|
280
|
+
function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector, runtimeSet, expression = prop.exp?.content) {
|
|
281
|
+
if (prop.exp?.type !== NodeTypes.SIMPLE_EXPRESSION || expression === void 0) {
|
|
280
282
|
return;
|
|
281
283
|
}
|
|
282
284
|
const start = prop.exp.loc.start.offset;
|
|
@@ -284,10 +286,10 @@ function updateDirectiveExpressionWithLocalStyle(ms, prop, jsHandler, collector,
|
|
|
284
286
|
if (start >= end) {
|
|
285
287
|
return;
|
|
286
288
|
}
|
|
287
|
-
collector.collectRuntimeClasses(
|
|
289
|
+
collector.collectRuntimeClasses(expression, {
|
|
288
290
|
wrapExpression: true
|
|
289
291
|
});
|
|
290
|
-
const generated = generateCode(
|
|
292
|
+
const generated = generateCode(expression, {
|
|
291
293
|
jsHandler,
|
|
292
294
|
runtimeSet,
|
|
293
295
|
wrapExpression: true
|
|
@@ -359,7 +361,13 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
359
361
|
continue;
|
|
360
362
|
}
|
|
361
363
|
if (attrName.toLowerCase() === "class" && localStyleCollector) {
|
|
362
|
-
updateDirectiveExpressionWithLocalStyle(
|
|
364
|
+
updateDirectiveExpressionWithLocalStyle(
|
|
365
|
+
ms,
|
|
366
|
+
prop,
|
|
367
|
+
jsHandler,
|
|
368
|
+
localStyleCollector,
|
|
369
|
+
runtimeSet
|
|
370
|
+
);
|
|
363
371
|
} else {
|
|
364
372
|
updateDirectiveExpression(ms, prop, jsHandler, runtimeSet);
|
|
365
373
|
}
|
|
@@ -509,6 +517,9 @@ function isPreprocessorRequest(id, lang) {
|
|
|
509
517
|
}
|
|
510
518
|
return PREPROCESSOR_EXT_RE.test(id);
|
|
511
519
|
}
|
|
520
|
+
function resolveUniAppXCssTarget(id) {
|
|
521
|
+
return UVUE_NVUE_RE2.test(cleanUrl(id)) ? "uvue" : void 0;
|
|
522
|
+
}
|
|
512
523
|
function createUniAppXPlugins(options) {
|
|
513
524
|
const {
|
|
514
525
|
appType,
|
|
@@ -551,6 +562,8 @@ function createUniAppXPlugins(options) {
|
|
|
551
562
|
if (!styleHandlerOptions) {
|
|
552
563
|
styleHandlerOptions = {
|
|
553
564
|
isMainChunk: mainCssChunkMatcher(id, appType),
|
|
565
|
+
uniAppXCssTarget: resolveUniAppXCssTarget(id),
|
|
566
|
+
uniAppXUnsupported: resolvedUniAppXOptions.uvueUnsupported,
|
|
554
567
|
postcssOptions: {
|
|
555
568
|
options: {
|
|
556
569
|
from: id,
|
|
@@ -567,6 +580,10 @@ function createUniAppXPlugins(options) {
|
|
|
567
580
|
cssHandlerOptionsCache.set(cacheKey, styleHandlerOptions);
|
|
568
581
|
}
|
|
569
582
|
const postcssResult = await styleHandler(code, styleHandlerOptions);
|
|
583
|
+
const warnings = typeof postcssResult.warnings === "function" ? postcssResult.warnings() : [];
|
|
584
|
+
for (const warning of warnings) {
|
|
585
|
+
logger.warn(warning.toString());
|
|
586
|
+
}
|
|
570
587
|
const rawPostcssMap = postcssResult.map.toJSON();
|
|
571
588
|
const postcssMap = await formatPostcssSourceMap(
|
|
572
589
|
rawPostcssMap,
|
|
@@ -708,7 +725,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
|
|
|
708
725
|
// src/bundlers/vite/generate-bundle.ts
|
|
709
726
|
import path3 from "path";
|
|
710
727
|
import process2 from "process";
|
|
711
|
-
import { logger } from "@weapp-tailwindcss/logger";
|
|
728
|
+
import { logger as logger2 } from "@weapp-tailwindcss/logger";
|
|
712
729
|
import { splitCode as splitCode2 } from "@weapp-tailwindcss/shared/extractors";
|
|
713
730
|
|
|
714
731
|
// src/bundlers/vite/bundle-entries.ts
|
|
@@ -1029,28 +1046,6 @@ function updateBundleBuildState(state, snapshot, linkedByEntry, options = {}) {
|
|
|
1029
1046
|
state.dependentsByLinkedFile = invertLinkedByEntry(state.linkedByEntry);
|
|
1030
1047
|
}
|
|
1031
1048
|
|
|
1032
|
-
// src/bundlers/vite/js-precheck.ts
|
|
1033
|
-
var FAST_JS_TRANSFORM_HINT_RE = /className\b|class\s*=|classList\.|\b(?:twMerge|clsx|classnames|cn|cva)\b|\[["'`]class["'`]\]|text-\[|bg-\[|\b(?:[whpm]|px|py|mx|my|rounded|flex|grid|gap)-/;
|
|
1034
|
-
var DEPENDENCY_HINT_RE = /\bimport\s*[("'`{*]|\brequire\s*\(|\bexport\s+\*\s+from\s+["'`]|\bexport\s*\{[^}]*\}\s*from\s+["'`]/;
|
|
1035
|
-
function shouldSkipViteJsTransform(rawSource, options) {
|
|
1036
|
-
if (!rawSource) {
|
|
1037
|
-
return true;
|
|
1038
|
-
}
|
|
1039
|
-
if (options?.alwaysEscape) {
|
|
1040
|
-
return false;
|
|
1041
|
-
}
|
|
1042
|
-
if (options?.moduleSpecifierReplacements && Object.keys(options.moduleSpecifierReplacements).length > 0) {
|
|
1043
|
-
return false;
|
|
1044
|
-
}
|
|
1045
|
-
if (options?.wrapExpression) {
|
|
1046
|
-
return false;
|
|
1047
|
-
}
|
|
1048
|
-
if (DEPENDENCY_HINT_RE.test(rawSource)) {
|
|
1049
|
-
return false;
|
|
1050
|
-
}
|
|
1051
|
-
return !FAST_JS_TRANSFORM_HINT_RE.test(rawSource);
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
1049
|
// src/bundlers/vite/generate-bundle.ts
|
|
1055
1050
|
function formatDebugFileList(files, limit = 8) {
|
|
1056
1051
|
if (files.size === 0) {
|
|
@@ -1336,7 +1331,7 @@ function createGenerateBundleHook(context) {
|
|
|
1336
1331
|
let transformed = await templateHandler(rawSource, defaultTemplateHandlerOptions);
|
|
1337
1332
|
let unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed);
|
|
1338
1333
|
if (unresolvedDynamicCandidates.length > 0) {
|
|
1339
|
-
|
|
1334
|
+
logger2.warn(
|
|
1340
1335
|
"\u68C0\u6D4B\u5230 WXML \u52A8\u6001\u7C7B\u540D\u672A\u5B8C\u6210\u8F6C\u8BD1\uFF0C\u5DF2\u56DE\u9000\u5230\u5B8C\u6574 runtimeSet \u91CD\u8BD5: %s -> %O",
|
|
1341
1336
|
file,
|
|
1342
1337
|
unresolvedDynamicCandidates
|
|
@@ -1347,7 +1342,7 @@ function createGenerateBundleHook(context) {
|
|
|
1347
1342
|
});
|
|
1348
1343
|
unresolvedDynamicCandidates = collectUnescapedDynamicCandidates(transformed);
|
|
1349
1344
|
if (unresolvedDynamicCandidates.length > 0) {
|
|
1350
|
-
|
|
1345
|
+
logger2.warn(
|
|
1351
1346
|
"WXML \u52A8\u6001\u7C7B\u540D\u5728\u5B8C\u6574 runtimeSet \u91CD\u8BD5\u540E\u4ECD\u672A\u5B8C\u6210\u8F6C\u8BD1: %s -> %O",
|
|
1352
1347
|
file,
|
|
1353
1348
|
unresolvedDynamicCandidates
|
|
@@ -1466,7 +1461,7 @@ function createGenerateBundleHook(context) {
|
|
|
1466
1461
|
debug3("js cache replay miss, fallback transform: %s", file);
|
|
1467
1462
|
}
|
|
1468
1463
|
const handlerOptions = createHandlerOptions(absoluteFile);
|
|
1469
|
-
if (!disableJsPrecheck &&
|
|
1464
|
+
if (!disableJsPrecheck && shouldSkipJsTransform(rawSource, handlerOptions)) {
|
|
1470
1465
|
metrics.js.elapsed += measureElapsed(start);
|
|
1471
1466
|
metrics.js.transformed++;
|
|
1472
1467
|
return {
|
|
@@ -1552,7 +1547,7 @@ function createGenerateBundleHook(context) {
|
|
|
1552
1547
|
sourceType: "unambiguous"
|
|
1553
1548
|
}
|
|
1554
1549
|
});
|
|
1555
|
-
if (!disableJsPrecheck &&
|
|
1550
|
+
if (!disableJsPrecheck && shouldSkipJsTransform(currentSource, precheckOptions)) {
|
|
1556
1551
|
metrics.js.elapsed += measureElapsed(start);
|
|
1557
1552
|
metrics.js.transformed++;
|
|
1558
1553
|
return;
|
|
@@ -2335,7 +2330,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2335
2330
|
if (nextAppType && opts.appType !== nextAppType) {
|
|
2336
2331
|
const previousAppType = opts.appType;
|
|
2337
2332
|
opts.appType = nextAppType;
|
|
2338
|
-
|
|
2333
|
+
logger3.info("\u6839\u636E Vite \u9879\u76EE\u6839\u76EE\u5F55\u81EA\u52A8\u63A8\u65AD appType -> %s", nextAppType);
|
|
2339
2334
|
debug2(
|
|
2340
2335
|
"align appType with vite root: %s -> %s",
|
|
2341
2336
|
previousAppType ?? "undefined",
|
|
@@ -2359,14 +2354,17 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2359
2354
|
}
|
|
2360
2355
|
}
|
|
2361
2356
|
},
|
|
2362
|
-
generateBundle:
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2357
|
+
generateBundle: {
|
|
2358
|
+
order: "post",
|
|
2359
|
+
handler: createGenerateBundleHook({
|
|
2360
|
+
opts,
|
|
2361
|
+
runtimeState,
|
|
2362
|
+
ensureRuntimeClassSet,
|
|
2363
|
+
ensureBundleRuntimeClassSet,
|
|
2364
|
+
debug: debug2,
|
|
2365
|
+
getResolvedConfig
|
|
2366
|
+
})
|
|
2367
|
+
}
|
|
2370
2368
|
}
|
|
2371
2369
|
];
|
|
2372
2370
|
if (uniAppXPlugins) {
|
|
@@ -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 _chunkONLKZIRQjs = require('./chunk-ONLKZIRQ.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, _chunkONLKZIRQjs.importMetaUrl);
|
|
23
23
|
function resolvePackageDir(name) {
|
|
24
24
|
const pkgPath = require2.resolve(`${name}/package.json`);
|
|
25
25
|
return _path2.default.dirname(pkgPath);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.12.
|
|
1
|
+
// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.12.2__@swc+core@1.15.32_@swc+_5ed6cbcda668e45f9f2d3d9f21b34c59/node_modules/tsup/assets/esm_shims.js
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
var getFilename = () => fileURLToPath(import.meta.url);
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkWSS26HZSjs = require('./chunk-WSS26HZS.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkGMKSBLNYjs = require('./chunk-GMKSBLNY.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
@@ -28,11 +28,12 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var _chunkSSASUP5Fjs = require('./chunk-SSASUP5F.js');
|
|
32
31
|
|
|
32
|
+
var _chunkGC7WXUOWjs = require('./chunk-GC7WXUOW.js');
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
var _chunkNIS74SI6js = require('./chunk-NIS74SI6.js');
|
|
36
37
|
|
|
37
38
|
|
|
38
39
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
@@ -63,10 +64,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
63
64
|
const { Compilation, sources } = compiler.webpack;
|
|
64
65
|
const { ConcatSource } = sources;
|
|
65
66
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
66
|
-
compiler.hooks.compilation.tap(
|
|
67
|
+
compiler.hooks.compilation.tap(_chunkGC7WXUOWjs.pluginName, (compilation) => {
|
|
67
68
|
compilation.hooks.processAssets.tapPromise(
|
|
68
69
|
{
|
|
69
|
-
name:
|
|
70
|
+
name: _chunkGC7WXUOWjs.pluginName,
|
|
70
71
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
71
72
|
},
|
|
72
73
|
async (assets) => {
|
|
@@ -78,20 +79,20 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
78
79
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
79
80
|
}
|
|
80
81
|
}
|
|
81
|
-
const assetHashByChunk =
|
|
82
|
+
const assetHashByChunk = _chunkWSS26HZSjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
82
83
|
const entries = Object.entries(assets);
|
|
83
84
|
const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
|
|
84
85
|
const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
|
|
85
86
|
const jsAssets = /* @__PURE__ */ new Map();
|
|
86
87
|
for (const [file] of entries) {
|
|
87
88
|
if (compilerOptions.jsMatcher(file) || compilerOptions.wxsMatcher(file)) {
|
|
88
|
-
const absolute =
|
|
89
|
+
const absolute = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
89
90
|
jsAssets.set(absolute, file);
|
|
90
91
|
}
|
|
91
92
|
}
|
|
92
93
|
const moduleGraphOptions = {
|
|
93
94
|
resolve(specifier, importer) {
|
|
94
|
-
return
|
|
95
|
+
return _chunkGMKSBLNYjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
|
|
95
96
|
},
|
|
96
97
|
load: (id) => {
|
|
97
98
|
const assetName = jsAssets.get(id);
|
|
@@ -157,7 +158,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
157
158
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
158
159
|
const forceRuntimeRefresh = getRuntimeRefreshRequirement();
|
|
159
160
|
debug2("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, _nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown")));
|
|
160
|
-
const runtimeSet = await
|
|
161
|
+
const runtimeSet = await _chunkGC7WXUOWjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
161
162
|
forceRefresh: forceRuntimeRefresh,
|
|
162
163
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
163
164
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
@@ -207,12 +208,12 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
207
208
|
const jsTaskFactories = [];
|
|
208
209
|
if (Array.isArray(groupedEntries.js)) {
|
|
209
210
|
for (const [file] of groupedEntries.js) {
|
|
210
|
-
const cacheKey =
|
|
211
|
+
const cacheKey = _chunkWSS26HZSjs.getCacheKey.call(void 0, file);
|
|
211
212
|
const asset = compilation.getAsset(file);
|
|
212
213
|
if (!asset) {
|
|
213
214
|
continue;
|
|
214
215
|
}
|
|
215
|
-
const absoluteFile =
|
|
216
|
+
const absoluteFile = _chunkGMKSBLNYjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
216
217
|
const initialSource = asset.source.source();
|
|
217
218
|
const initialRawSource = typeof initialSource === "string" ? initialSource : initialSource.toString();
|
|
218
219
|
const chunkHash = assetHashByChunk.get(file);
|
|
@@ -233,7 +234,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
233
234
|
const currentAsset = compilation.getAsset(file);
|
|
234
235
|
const currentSourceValue = _optionalChain([currentAsset, 'optionalAccess', _5 => _5.source, 'access', _6 => _6.source, 'call', _7 => _7()]);
|
|
235
236
|
const currentSource = typeof currentSourceValue === "string" ? currentSourceValue : _nullishCoalesce(_optionalChain([currentSourceValue, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ( ""));
|
|
236
|
-
const
|
|
237
|
+
const handlerOptions = {
|
|
237
238
|
staleClassNameFallback,
|
|
238
239
|
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
239
240
|
filename: absoluteFile,
|
|
@@ -241,7 +242,11 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
241
242
|
babelParserOptions: {
|
|
242
243
|
sourceFilename: absoluteFile
|
|
243
244
|
}
|
|
244
|
-
}
|
|
245
|
+
};
|
|
246
|
+
if (_chunkGC7WXUOWjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
|
|
247
|
+
return { result: new ConcatSource(currentSource) };
|
|
248
|
+
}
|
|
249
|
+
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
245
250
|
const source = new ConcatSource(code);
|
|
246
251
|
compilerOptions.onUpdate(file, currentSource, code);
|
|
247
252
|
debug2("js handle: %s", file);
|
|
@@ -287,7 +292,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
287
292
|
);
|
|
288
293
|
}
|
|
289
294
|
}
|
|
290
|
-
|
|
295
|
+
_chunkGMKSBLNYjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
291
296
|
await Promise.all(tasks);
|
|
292
297
|
debug2("end");
|
|
293
298
|
compilerOptions.onEnd();
|
|
@@ -313,9 +318,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
313
318
|
getRuntimeWatchDependencies,
|
|
314
319
|
debug: debug2
|
|
315
320
|
} = options;
|
|
316
|
-
const isMpxApp =
|
|
321
|
+
const isMpxApp = _chunkWSS26HZSjs.isMpx.call(void 0, appType);
|
|
317
322
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
318
|
-
|
|
323
|
+
_chunkWSS26HZSjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
319
324
|
}
|
|
320
325
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
321
326
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -329,12 +334,12 @@ function setupWebpackV5Loaders(options) {
|
|
|
329
334
|
getClassSet: getClassSetInLoader,
|
|
330
335
|
getWatchDependencies: getRuntimeWatchDependencies
|
|
331
336
|
};
|
|
332
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
337
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkWSS26HZSjs.createLoaderAnchorFinders.call(void 0, appType);
|
|
333
338
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
334
339
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
335
340
|
} : void 0;
|
|
336
341
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
337
|
-
|
|
342
|
+
_chunkWSS26HZSjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
338
343
|
}
|
|
339
344
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
340
345
|
loader: runtimeClassSetLoader,
|
|
@@ -354,17 +359,17 @@ function setupWebpackV5Loaders(options) {
|
|
|
354
359
|
};
|
|
355
360
|
};
|
|
356
361
|
const { NormalModule } = compiler.webpack;
|
|
357
|
-
compiler.hooks.compilation.tap(
|
|
358
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
362
|
+
compiler.hooks.compilation.tap(_chunkGC7WXUOWjs.pluginName, (compilation) => {
|
|
363
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkGC7WXUOWjs.pluginName, (_loaderContext, module) => {
|
|
359
364
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
360
365
|
if (!hasRuntimeLoader) {
|
|
361
366
|
return;
|
|
362
367
|
}
|
|
363
|
-
|
|
368
|
+
_chunkWSS26HZSjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
|
|
364
369
|
const loaderEntries = module.loaders || [];
|
|
365
370
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
366
371
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
367
|
-
const isCssModule =
|
|
372
|
+
const isCssModule = _chunkWSS26HZSjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
368
373
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
369
374
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
370
375
|
}
|
|
@@ -396,7 +401,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
396
401
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
397
402
|
}
|
|
398
403
|
}
|
|
399
|
-
if (runtimeClassSetLoaderExists && !
|
|
404
|
+
if (runtimeClassSetLoaderExists && !_chunkWSS26HZSjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
400
405
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
401
406
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
402
407
|
if (anchorIndex === -1) {
|
|
@@ -411,11 +416,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
411
416
|
}
|
|
412
417
|
|
|
413
418
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
414
|
-
var debug =
|
|
415
|
-
var weappTailwindcssPackageDir =
|
|
419
|
+
var debug = _chunkGC7WXUOWjs.createDebug.call(void 0, );
|
|
420
|
+
var weappTailwindcssPackageDir = _chunkGMKSBLNYjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
416
421
|
var UnifiedWebpackPluginV5 = class {
|
|
417
422
|
constructor(options = {}) {
|
|
418
|
-
this.options =
|
|
423
|
+
this.options = _chunkGC7WXUOWjs.getCompilerContext.call(void 0, options);
|
|
419
424
|
this.appType = this.options.appType;
|
|
420
425
|
}
|
|
421
426
|
apply(compiler) {
|
|
@@ -428,22 +433,22 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
428
433
|
twPatcher: initialTwPatcher,
|
|
429
434
|
refreshTailwindcssPatcher
|
|
430
435
|
} = this.options;
|
|
431
|
-
const disabledOptions =
|
|
436
|
+
const disabledOptions = _chunkGMKSBLNYjs.resolveDisabledOptions.call(void 0, disabled);
|
|
432
437
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
433
438
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
434
|
-
const isMpxApp =
|
|
439
|
+
const isMpxApp = _chunkWSS26HZSjs.isMpx.call(void 0, this.appType);
|
|
435
440
|
if (shouldRewriteCssImports) {
|
|
436
|
-
|
|
441
|
+
_chunkWSS26HZSjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
437
442
|
pkgDir: weappTailwindcssPackageDir,
|
|
438
443
|
enabled: true,
|
|
439
444
|
appType: this.appType
|
|
440
445
|
});
|
|
441
|
-
|
|
446
|
+
_chunkWSS26HZSjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
442
447
|
}
|
|
443
448
|
if (disabledOptions.plugin) {
|
|
444
449
|
return;
|
|
445
450
|
}
|
|
446
|
-
const patchRecorderState =
|
|
451
|
+
const patchRecorderState = _chunkGC7WXUOWjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
447
452
|
source: "runtime",
|
|
448
453
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
449
454
|
});
|
|
@@ -462,7 +467,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
462
467
|
const updateRuntimeWatchDependencies = async () => {
|
|
463
468
|
runtimeWatchDependencyFiles.clear();
|
|
464
469
|
runtimeWatchDependencyContexts.clear();
|
|
465
|
-
const tailwindOptions =
|
|
470
|
+
const tailwindOptions = _chunkNIS74SI6js.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options);
|
|
466
471
|
if (_optionalChain([tailwindOptions, 'optionalAccess', _13 => _13.config])) {
|
|
467
472
|
runtimeWatchDependencyFiles.add(tailwindOptions.config);
|
|
468
473
|
}
|
|
@@ -501,31 +506,31 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
501
506
|
runtimeMetadataPrepared = true;
|
|
502
507
|
};
|
|
503
508
|
const syncRuntimeRefreshRequirement = () => {
|
|
504
|
-
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation ||
|
|
509
|
+
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || _chunkWSS26HZSjs.hasWatchChanges.call(void 0, compiler);
|
|
505
510
|
};
|
|
506
511
|
const resetRuntimePreparation = () => {
|
|
507
512
|
runtimeSetPrepared = false;
|
|
508
513
|
runtimeMetadataPrepared = false;
|
|
509
514
|
syncRuntimeRefreshRequirement();
|
|
510
515
|
};
|
|
511
|
-
_optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(
|
|
516
|
+
_optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(_chunkGC7WXUOWjs.pluginName, () => {
|
|
512
517
|
runtimeRefreshRequiredForCompilation = true;
|
|
513
518
|
})]);
|
|
514
|
-
_optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(
|
|
519
|
+
_optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(_chunkGC7WXUOWjs.pluginName, syncRuntimeRefreshRequirement)]);
|
|
515
520
|
if (_optionalChain([compiler, 'access', _28 => _28.hooks, 'access', _29 => _29.thisCompilation, 'optionalAccess', _30 => _30.tap])) {
|
|
516
|
-
compiler.hooks.thisCompilation.tap(
|
|
521
|
+
compiler.hooks.thisCompilation.tap(_chunkGC7WXUOWjs.pluginName, resetRuntimePreparation);
|
|
517
522
|
} else if (_optionalChain([compiler, 'access', _31 => _31.hooks, 'access', _32 => _32.compilation, 'optionalAccess', _33 => _33.tap])) {
|
|
518
|
-
compiler.hooks.compilation.tap(
|
|
523
|
+
compiler.hooks.compilation.tap(_chunkGC7WXUOWjs.pluginName, resetRuntimePreparation);
|
|
519
524
|
}
|
|
520
525
|
async function getClassSetInLoader() {
|
|
521
526
|
if (runtimeSetPrepared) {
|
|
522
527
|
return;
|
|
523
528
|
}
|
|
524
|
-
const signature =
|
|
529
|
+
const signature = _chunkNIS74SI6js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
525
530
|
const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
|
|
526
531
|
debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
|
|
527
532
|
runtimeSetPrepared = true;
|
|
528
|
-
await
|
|
533
|
+
await _chunkGC7WXUOWjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
529
534
|
forceRefresh,
|
|
530
535
|
forceCollect: true,
|
|
531
536
|
clearCache: forceRefresh,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkONLKZIRQjs = require('./chunk-ONLKZIRQ.js');
|
|
7
7
|
|
|
8
8
|
// src/tailwindcss/patcher-options.ts
|
|
9
9
|
function resolveTailwindcssOptions(options) {
|
|
@@ -532,7 +532,7 @@ function resolveModuleFromPaths(specifier, paths) {
|
|
|
532
532
|
return void 0;
|
|
533
533
|
}
|
|
534
534
|
try {
|
|
535
|
-
const req = _module.createRequire.call(void 0,
|
|
535
|
+
const req = _module.createRequire.call(void 0, _chunkONLKZIRQjs.importMetaUrl);
|
|
536
536
|
return req.resolve(specifier, { paths });
|
|
537
537
|
} catch (e4) {
|
|
538
538
|
return void 0;
|
|
@@ -587,11 +587,11 @@ function createDefaultResolvePaths(basedir) {
|
|
|
587
587
|
const cwd = _process2.default.cwd();
|
|
588
588
|
appendNodeModules(paths, cwd);
|
|
589
589
|
try {
|
|
590
|
-
const modulePath = _url.fileURLToPath.call(void 0,
|
|
590
|
+
const modulePath = _url.fileURLToPath.call(void 0, _chunkONLKZIRQjs.importMetaUrl);
|
|
591
591
|
const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
|
|
592
592
|
paths.add(candidate);
|
|
593
593
|
} catch (e5) {
|
|
594
|
-
paths.add(
|
|
594
|
+
paths.add(_chunkONLKZIRQjs.importMetaUrl);
|
|
595
595
|
}
|
|
596
596
|
if (paths.size === 0) {
|
|
597
597
|
fallbackCandidates = fallbackCandidates.filter(Boolean);
|
|
@@ -1195,12 +1195,14 @@ function resolveUniAppXOptions(option) {
|
|
|
1195
1195
|
if (typeof option === "object" && option) {
|
|
1196
1196
|
return {
|
|
1197
1197
|
enabled: option.enabled !== false,
|
|
1198
|
-
componentLocalStyles: resolveComponentLocalStyles(option)
|
|
1198
|
+
componentLocalStyles: resolveComponentLocalStyles(option),
|
|
1199
|
+
uvueUnsupported: _nullishCoalesce(option.uvueUnsupported, () => ( "warn"))
|
|
1199
1200
|
};
|
|
1200
1201
|
}
|
|
1201
1202
|
return {
|
|
1202
1203
|
enabled: Boolean(option),
|
|
1203
|
-
componentLocalStyles: resolveComponentLocalStyles(option)
|
|
1204
|
+
componentLocalStyles: resolveComponentLocalStyles(option),
|
|
1205
|
+
uvueUnsupported: "warn"
|
|
1204
1206
|
};
|
|
1205
1207
|
}
|
|
1206
1208
|
function isUniAppXEnabled(option) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.12.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.1_@microsoft+api-extractor@7.55.2_@types+node@24.12.2__@swc+core@1.15.32_@swc+_5ed6cbcda668e45f9f2d3d9f21b34c59/node_modules/tsup/assets/cjs_shims.js
|
|
2
2
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.tagName.toUpperCase() === "SCRIPT" ? document.currentScript.src : new URL("main.js", document.baseURI).href;
|
|
3
3
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
4
|
|