weapp-tailwindcss 4.5.2 → 4.6.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-FOUWGCIJ.js → chunk-7CGHD2TI.js} +17 -15
- package/dist/{chunk-L4AXTSIM.mjs → chunk-7PGHZOTU.mjs} +10 -30
- package/dist/chunk-AXLRUW5H.js +776 -0
- package/dist/{chunk-PLMJW644.js → chunk-DWAEHRHN.js} +1 -4
- package/dist/{chunk-NHB7NFQC.js → chunk-E5PXIHDN.js} +1 -1
- package/dist/chunk-FB5P4TRH.js +70 -0
- package/dist/{chunk-ZUH5ZA7D.js → chunk-FVA7Y2YU.js} +21 -19
- package/dist/{chunk-FOSGDQZ7.js → chunk-I7FYDXN6.js} +3 -5
- package/dist/chunk-IY2OKZE6.mjs +773 -0
- package/dist/{chunk-CKTI35D3.mjs → chunk-JG5LBGLH.mjs} +27 -7
- package/dist/{chunk-FWIGQ4RY.mjs → chunk-KHILYAA4.mjs} +1 -1
- package/dist/chunk-LTJQUORK.js +32 -0
- package/dist/{chunk-TGTFIOJU.js → chunk-M6DWZX4H.js} +31 -11
- package/dist/{chunk-GGIH6WLF.mjs → chunk-MXVUK23K.mjs} +14 -12
- package/dist/{chunk-A3TJT6B6.js → chunk-OVDIACVK.js} +19 -39
- package/dist/{chunk-H4JTYYOI.mjs → chunk-RRHPTTCP.mjs} +0 -11
- package/dist/{chunk-WFZ73Q6S.mjs → chunk-TTDQ4TK2.mjs} +14 -12
- package/dist/{chunk-Q67IXIAH.mjs → chunk-VSRDBMDB.mjs} +1 -4
- package/dist/{chunk-IHKVNALD.mjs → chunk-YLNOOPZL.mjs} +3 -5
- package/dist/chunk-YPBRGP6K.mjs +70 -0
- package/dist/cli.js +11 -8
- package/dist/cli.mjs +11 -8
- package/dist/core.d.mts +0 -1
- package/dist/core.d.ts +0 -1
- package/dist/core.js +23 -12
- package/dist/core.mjs +21 -10
- 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 +0 -1
- package/dist/defaults.d.ts +0 -1
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/escape.d.mts +0 -1
- package/dist/escape.d.ts +0 -1
- package/dist/escape.js +3 -3
- package/dist/escape.mjs +2 -2
- package/dist/gulp.d.mts +0 -1
- package/dist/gulp.d.ts +0 -1
- package/dist/gulp.js +9 -8
- package/dist/gulp.mjs +8 -7
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +11 -10
- package/dist/index.mjs +10 -9
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.d.mts +0 -1
- package/dist/presets.d.ts +0 -1
- package/dist/presets.js +17 -23
- package/dist/presets.mjs +16 -22
- package/dist/types.d.mts +10 -30
- package/dist/types.d.ts +10 -30
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +0 -1
- package/dist/vite.d.ts +0 -1
- package/dist/vite.js +9 -8
- package/dist/vite.mjs +8 -7
- package/dist/weapp-tw-runtime-loader.js +4 -1
- package/dist/webpack.d.mts +0 -1
- package/dist/webpack.d.ts +0 -1
- package/dist/webpack.js +9 -8
- package/dist/webpack.mjs +8 -7
- package/dist/webpack4.d.mts +0 -1
- package/dist/webpack4.d.ts +0 -1
- package/dist/webpack4.js +21 -19
- package/dist/webpack4.mjs +17 -15
- package/package.json +8 -9
- package/dist/chunk-2NRTWL47.js +0 -43
- package/dist/chunk-KBR4YB6N.js +0 -178
- package/dist/chunk-S2WEN6NJ.mjs +0 -175
|
@@ -7,14 +7,17 @@ var _chunk6GP37C26js = require('./chunk-6GP37C26.js');
|
|
|
7
7
|
var _chunkWVKK6TBLjs = require('./chunk-WVKK6TBL.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
+
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
var _chunkFB5P4TRHjs = require('./chunk-FB5P4TRH.js');
|
|
12
15
|
|
|
13
16
|
|
|
14
17
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
15
18
|
|
|
16
19
|
|
|
17
|
-
var
|
|
20
|
+
var _chunkOVDIACVKjs = require('./chunk-OVDIACVK.js');
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
@@ -23,10 +26,10 @@ var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
|
23
26
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
24
27
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
25
28
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
26
|
-
var debug =
|
|
29
|
+
var debug = _chunkFB5P4TRHjs.createDebug.call(void 0, );
|
|
27
30
|
var UnifiedWebpackPluginV5 = class {
|
|
28
31
|
constructor(options = {}) {
|
|
29
|
-
this.options =
|
|
32
|
+
this.options = _chunkOVDIACVKjs.getCompilerContext.call(void 0, options);
|
|
30
33
|
this.appType = this.options.appType;
|
|
31
34
|
}
|
|
32
35
|
apply(compiler) {
|
|
@@ -40,7 +43,6 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
40
43
|
styleHandler,
|
|
41
44
|
templateHandler,
|
|
42
45
|
jsHandler,
|
|
43
|
-
setMangleRuntimeSet,
|
|
44
46
|
runtimeLoaderPath,
|
|
45
47
|
cache,
|
|
46
48
|
twPatcher
|
|
@@ -48,13 +50,12 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
48
50
|
if (disabled) {
|
|
49
51
|
return;
|
|
50
52
|
}
|
|
51
|
-
twPatcher.patch();
|
|
53
|
+
const patchPromise = Promise.resolve(twPatcher.patch());
|
|
52
54
|
const { Compilation, sources, NormalModule } = compiler.webpack;
|
|
53
55
|
const { ConcatSource } = sources;
|
|
54
|
-
function getClassSetInLoader() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
56
|
+
async function getClassSetInLoader() {
|
|
57
|
+
await patchPromise;
|
|
58
|
+
await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
|
|
58
59
|
}
|
|
59
60
|
onLoad();
|
|
60
61
|
const loader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-loader.js")));
|
|
@@ -84,6 +85,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
84
85
|
async (assets) => {
|
|
85
86
|
onStart();
|
|
86
87
|
debug("start");
|
|
88
|
+
await patchPromise;
|
|
87
89
|
for (const chunk of compilation.chunks) {
|
|
88
90
|
if (chunk.id && chunk.hash) {
|
|
89
91
|
cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
@@ -144,8 +146,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
144
146
|
}
|
|
145
147
|
};
|
|
146
148
|
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
|
|
147
|
-
const runtimeSet = await
|
|
148
|
-
setMangleRuntimeSet(runtimeSet);
|
|
149
|
+
const runtimeSet = await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
|
|
149
150
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
150
151
|
const tasks = [];
|
|
151
152
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -154,7 +155,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
154
155
|
const rawSource = originalSource.source().toString();
|
|
155
156
|
const cacheKey = file;
|
|
156
157
|
tasks.push(
|
|
157
|
-
|
|
158
|
+
_chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
158
159
|
cache,
|
|
159
160
|
cacheKey,
|
|
160
161
|
rawSource,
|
|
@@ -189,7 +190,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
189
190
|
const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
190
191
|
const initialSource = asset.source.source();
|
|
191
192
|
const initialRawSource = typeof initialSource === "string" ? initialSource : initialSource.toString();
|
|
192
|
-
await
|
|
193
|
+
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
193
194
|
cache,
|
|
194
195
|
cacheKey,
|
|
195
196
|
rawSource: initialRawSource,
|
|
@@ -227,7 +228,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
227
228
|
const rawSource = originalSource.source().toString();
|
|
228
229
|
const cacheKey = file;
|
|
229
230
|
tasks.push(
|
|
230
|
-
|
|
231
|
+
_chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
231
232
|
cache,
|
|
232
233
|
cacheKey,
|
|
233
234
|
rawSource,
|
|
@@ -238,6 +239,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
238
239
|
debug("css cache hit: %s", file);
|
|
239
240
|
},
|
|
240
241
|
transform: async () => {
|
|
242
|
+
await patchPromise;
|
|
241
243
|
const { css } = await styleHandler(rawSource, {
|
|
242
244
|
isMainChunk: mainCssChunkMatcher(file, this.appType),
|
|
243
245
|
postcssOptions: {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
replaceWxml
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VSRDBMDB.mjs";
|
|
4
4
|
import {
|
|
5
5
|
createTailwindcssPatcherFromContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-IY2OKZE6.mjs";
|
|
7
7
|
import {
|
|
8
8
|
getDefaultOptions
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-YLNOOPZL.mjs";
|
|
10
10
|
import {
|
|
11
11
|
defuOverrideArray,
|
|
12
12
|
isMap
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
|
|
15
15
|
// src/context/index.ts
|
|
16
16
|
import { logger as logger2, pc } from "@weapp-tailwindcss/logger";
|
|
17
|
-
import { useMangleStore } from "@weapp-tailwindcss/mangle";
|
|
18
17
|
|
|
19
18
|
// src/cache/index.ts
|
|
20
19
|
import { LRUCache } from "lru-cache";
|
|
@@ -306,7 +305,6 @@ function extractLiteralValue(path, { unescapeUnicode, arbitraryValues }) {
|
|
|
306
305
|
function replaceHandleValue(path, options) {
|
|
307
306
|
const {
|
|
308
307
|
escapeMap,
|
|
309
|
-
mangleContext,
|
|
310
308
|
needEscaped = false
|
|
311
309
|
} = options;
|
|
312
310
|
const { classNameSet, alwaysEscape } = options;
|
|
@@ -323,19 +321,10 @@ function replaceHandleValue(path, options) {
|
|
|
323
321
|
}
|
|
324
322
|
let transformed = literal;
|
|
325
323
|
let mutated = false;
|
|
326
|
-
let normalised = false;
|
|
327
324
|
for (const candidate of candidates) {
|
|
328
325
|
if (!shouldTransformClassName(candidate, options)) {
|
|
329
326
|
continue;
|
|
330
327
|
}
|
|
331
|
-
if (mangleContext && !normalised) {
|
|
332
|
-
const mangled = mangleContext.jsHandler(transformed);
|
|
333
|
-
if (mangled !== transformed) {
|
|
334
|
-
transformed = mangled;
|
|
335
|
-
mutated = true;
|
|
336
|
-
}
|
|
337
|
-
normalised = true;
|
|
338
|
-
}
|
|
339
328
|
if (!transformed.includes(candidate)) {
|
|
340
329
|
continue;
|
|
341
330
|
}
|
|
@@ -1081,11 +1070,13 @@ function jsHandler(rawSource, options) {
|
|
|
1081
1070
|
// src/js/index.ts
|
|
1082
1071
|
function createJsHandler(options) {
|
|
1083
1072
|
const {
|
|
1084
|
-
mangleContext,
|
|
1085
1073
|
arbitraryValues,
|
|
1086
1074
|
escapeMap,
|
|
1087
1075
|
jsPreserveClass,
|
|
1088
1076
|
generateMap,
|
|
1077
|
+
needEscaped,
|
|
1078
|
+
alwaysEscape,
|
|
1079
|
+
unescapeUnicode,
|
|
1089
1080
|
babelParserOptions,
|
|
1090
1081
|
ignoreCallExpressionIdentifiers,
|
|
1091
1082
|
ignoreTaggedTemplateExpressionIdentifiers,
|
|
@@ -1102,9 +1093,11 @@ function createJsHandler(options) {
|
|
|
1102
1093
|
classNameSet,
|
|
1103
1094
|
escapeMap,
|
|
1104
1095
|
arbitraryValues,
|
|
1105
|
-
mangleContext,
|
|
1106
1096
|
jsPreserveClass,
|
|
1107
1097
|
generateMap,
|
|
1098
|
+
needEscaped,
|
|
1099
|
+
alwaysEscape,
|
|
1100
|
+
unescapeUnicode,
|
|
1108
1101
|
babelParserOptions,
|
|
1109
1102
|
ignoreCallExpressionIdentifiers,
|
|
1110
1103
|
ignoreTaggedTemplateExpressionIdentifiers,
|
|
@@ -1295,7 +1288,6 @@ function generateCode(match, options = {}) {
|
|
|
1295
1288
|
replaceHandleValue(
|
|
1296
1289
|
path,
|
|
1297
1290
|
{
|
|
1298
|
-
mangleContext: options.mangleContext,
|
|
1299
1291
|
escapeMap: options.escapeMap,
|
|
1300
1292
|
classNameSet: options.runtimeSet,
|
|
1301
1293
|
needEscaped: true,
|
|
@@ -1322,7 +1314,6 @@ function handleEachClassFragment(ms, tokens, options = {}) {
|
|
|
1322
1314
|
ms.update(previousEnd, token.start, replaceWxml(gap, {
|
|
1323
1315
|
keepEOL: false,
|
|
1324
1316
|
escapeMap: options.escapeMap,
|
|
1325
|
-
mangleContext: options.mangleContext,
|
|
1326
1317
|
ignoreHead: true
|
|
1327
1318
|
}));
|
|
1328
1319
|
}
|
|
@@ -1334,7 +1325,6 @@ function handleEachClassFragment(ms, tokens, options = {}) {
|
|
|
1334
1325
|
ms.update(p, exp.start, replaceWxml(ms.slice(p, exp.start), {
|
|
1335
1326
|
keepEOL: true,
|
|
1336
1327
|
escapeMap: options.escapeMap,
|
|
1337
|
-
mangleContext: options.mangleContext,
|
|
1338
1328
|
// 首的str才会被转译
|
|
1339
1329
|
// example: 2xl:xx 2x{{y}}
|
|
1340
1330
|
ignoreHead: p > 0
|
|
@@ -1348,7 +1338,6 @@ function handleEachClassFragment(ms, tokens, options = {}) {
|
|
|
1348
1338
|
ms.update(p, token.end, replaceWxml(ms.slice(p, token.end), {
|
|
1349
1339
|
keepEOL: false,
|
|
1350
1340
|
escapeMap: options.escapeMap,
|
|
1351
|
-
mangleContext: options.mangleContext,
|
|
1352
1341
|
ignoreHead: true
|
|
1353
1342
|
}));
|
|
1354
1343
|
}
|
|
@@ -1356,7 +1345,6 @@ function handleEachClassFragment(ms, tokens, options = {}) {
|
|
|
1356
1345
|
ms.update(token.start, token.end, replaceWxml(token.value, {
|
|
1357
1346
|
keepEOL: false,
|
|
1358
1347
|
escapeMap: options.escapeMap,
|
|
1359
|
-
mangleContext: options.mangleContext,
|
|
1360
1348
|
ignoreHead: false
|
|
1361
1349
|
}));
|
|
1362
1350
|
}
|
|
@@ -1370,7 +1358,6 @@ function handleEachClassFragment(ms, tokens, options = {}) {
|
|
|
1370
1358
|
ms.update(lastToken.end, ms.original.length, replaceWxml(gap, {
|
|
1371
1359
|
keepEOL: false,
|
|
1372
1360
|
escapeMap: options.escapeMap,
|
|
1373
|
-
mangleContext: options.mangleContext,
|
|
1374
1361
|
ignoreHead: true
|
|
1375
1362
|
}));
|
|
1376
1363
|
}
|
|
@@ -1527,7 +1514,7 @@ function createTemplateHandler(options = {}) {
|
|
|
1527
1514
|
}
|
|
1528
1515
|
|
|
1529
1516
|
// src/context/handlers.ts
|
|
1530
|
-
function createHandlersFromContext(ctx,
|
|
1517
|
+
function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions) {
|
|
1531
1518
|
const {
|
|
1532
1519
|
cssPreflight,
|
|
1533
1520
|
customRuleCallback,
|
|
@@ -1556,7 +1543,6 @@ function createHandlersFromContext(ctx, mangleContext, customAttributesEntities,
|
|
|
1556
1543
|
customRuleCallback,
|
|
1557
1544
|
cssPreflightRange,
|
|
1558
1545
|
escapeMap,
|
|
1559
|
-
mangleContext,
|
|
1560
1546
|
cssChildCombinatorReplaceValue,
|
|
1561
1547
|
injectAdditionalCssVarScope,
|
|
1562
1548
|
cssSelectorReplacement,
|
|
@@ -1571,7 +1557,6 @@ function createHandlersFromContext(ctx, mangleContext, customAttributesEntities,
|
|
|
1571
1557
|
});
|
|
1572
1558
|
const jsHandler2 = createJsHandler({
|
|
1573
1559
|
escapeMap,
|
|
1574
|
-
mangleContext,
|
|
1575
1560
|
arbitraryValues,
|
|
1576
1561
|
jsPreserveClass,
|
|
1577
1562
|
generateMap: true,
|
|
@@ -1583,7 +1568,6 @@ function createHandlersFromContext(ctx, mangleContext, customAttributesEntities,
|
|
|
1583
1568
|
const templateHandler = createTemplateHandler({
|
|
1584
1569
|
customAttributesEntities,
|
|
1585
1570
|
escapeMap,
|
|
1586
|
-
mangleContext,
|
|
1587
1571
|
inlineWxs,
|
|
1588
1572
|
jsHandler: jsHandler2,
|
|
1589
1573
|
disabledDefaultTemplateHandler
|
|
@@ -1663,18 +1647,14 @@ function getCompilerContext(opts) {
|
|
|
1663
1647
|
}
|
|
1664
1648
|
ctx.cssCalc = cssCalcOptions;
|
|
1665
1649
|
const customAttributesEntities = toCustomAttributesEntities(ctx.customAttributes);
|
|
1666
|
-
const { initMangle, mangleContext, setMangleRuntimeSet } = useMangleStore();
|
|
1667
|
-
initMangle(ctx.mangle);
|
|
1668
1650
|
const { styleHandler, jsHandler: jsHandler2, templateHandler } = createHandlersFromContext(
|
|
1669
1651
|
ctx,
|
|
1670
|
-
mangleContext,
|
|
1671
1652
|
customAttributesEntities,
|
|
1672
1653
|
cssCalcOptions
|
|
1673
1654
|
);
|
|
1674
1655
|
ctx.styleHandler = styleHandler;
|
|
1675
1656
|
ctx.jsHandler = jsHandler2;
|
|
1676
1657
|
ctx.templateHandler = templateHandler;
|
|
1677
|
-
ctx.setMangleRuntimeSet = setMangleRuntimeSet;
|
|
1678
1658
|
ctx.cache = initializeCache(ctx.cache);
|
|
1679
1659
|
ctx.twPatcher = twPatcher;
|
|
1680
1660
|
return ctx;
|