weapp-tailwindcss 4.3.2 → 4.4.0-alpha.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-2F7HOQQY.mjs +8 -0
- package/dist/chunk-2NRTWL47.js +43 -0
- package/dist/{chunk-YNMM5ZP5.mjs → chunk-3MSGCIVH.mjs} +128 -138
- package/dist/chunk-6GP37C26.js +8 -0
- package/dist/{chunk-GRWK73SM.js → chunk-AEJDBNAX.js} +567 -309
- package/dist/{chunk-IDYXPWF6.mjs → chunk-AXYGCCZW.mjs} +51 -63
- package/dist/chunk-E2LRXNZ3.js +122 -0
- package/dist/{chunk-BXPTS6UP.mjs → chunk-FBGUUXQV.mjs} +1 -1
- package/dist/{chunk-72PXDJ7I.js → chunk-FOSGDQZ7.js} +34 -43
- package/dist/chunk-H4JTYYOI.mjs +43 -0
- package/dist/{chunk-3YIQPUK7.mjs → chunk-IHKVNALD.mjs} +29 -38
- package/dist/chunk-KAKRCCPX.mjs +122 -0
- package/dist/{chunk-AMSF25MI.js → chunk-NZ7VALIM.js} +130 -140
- package/dist/{chunk-YSVQIZ4W.js → chunk-PPTSD6TQ.js} +51 -63
- package/dist/{chunk-K6IPKJSY.js → chunk-RBRSMHFS.js} +1 -1
- package/dist/chunk-UW3WHSZ5.js +39 -0
- package/dist/{chunk-DGVVFKNF.mjs → chunk-WCIVXE2D.mjs} +566 -308
- package/dist/chunk-ZNKIYZRQ.mjs +39 -0
- package/dist/cli.js +5 -8
- package/dist/cli.mjs +4 -7
- package/dist/core.js +5 -5
- package/dist/core.mjs +4 -4
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +3 -3
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.js +4 -4
- package/dist/defaults.mjs +3 -3
- package/dist/escape.js +1 -1
- package/dist/escape.mjs +1 -1
- package/dist/gulp.js +7 -7
- package/dist/gulp.mjs +6 -6
- package/dist/index.js +10 -9
- package/dist/index.mjs +9 -8
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +3 -3
- package/dist/presets.mjs +2 -2
- package/dist/types.d.mts +248 -194
- package/dist/types.d.ts +248 -194
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +7 -7
- package/dist/vite.mjs +6 -6
- package/dist/webpack.js +8 -7
- package/dist/webpack.mjs +7 -6
- package/dist/webpack4.js +53 -68
- package/dist/webpack4.mjs +52 -67
- package/package.json +10 -12
- package/dist/chunk-3AUX4FGE.mjs +0 -13
- package/dist/chunk-JXBLHLFR.mjs +0 -27
- package/dist/chunk-K3KFCISK.js +0 -145
- package/dist/chunk-LSSLYD6B.js +0 -13
- package/dist/chunk-O335YLYH.js +0 -27
- package/dist/chunk-RC2KZ2LO.mjs +0 -145
|
@@ -1,19 +1,20 @@
|
|
|
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
|
-
|
|
3
|
+
|
|
4
|
+
var _chunk2NRTWL47js = require('./chunk-2NRTWL47.js');
|
|
4
5
|
|
|
5
6
|
|
|
6
7
|
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
|
|
10
|
-
var
|
|
11
|
+
var _chunkAEJDBNAXjs = require('./chunk-AEJDBNAX.js');
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
var _chunkPLMJW644js = require('./chunk-PLMJW644.js');
|
|
14
15
|
|
|
15
16
|
|
|
16
|
-
var
|
|
17
|
+
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
17
18
|
|
|
18
19
|
// src/bundlers/vite/index.ts
|
|
19
20
|
var _htmltransform = require('@weapp-tailwindcss/postcss/html-transform'); var _htmltransform2 = _interopRequireDefault(_htmltransform);
|
|
@@ -24,10 +25,32 @@ var _magicstring = require('magic-string'); var _magicstring2 = _interopRequireD
|
|
|
24
25
|
var _compilersfc = require('vue/compiler-sfc');
|
|
25
26
|
function traverse(node, visitor) {
|
|
26
27
|
visitor(node);
|
|
27
|
-
if (node.children) {
|
|
28
|
-
node.children
|
|
28
|
+
if (Array.isArray(node.children)) {
|
|
29
|
+
for (const child of node.children) {
|
|
30
|
+
if (child && typeof child === "object" && "type" in child) {
|
|
31
|
+
traverse(child, visitor);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
}
|
|
36
|
+
function createClassAttributeUpdater(ms) {
|
|
37
|
+
return (prop) => {
|
|
38
|
+
if (prop.value) {
|
|
39
|
+
ms.update(prop.value.loc.start.offset + 1, prop.value.loc.end.offset - 1, _chunkPLMJW644js.replaceWxml.call(void 0, prop.value.content));
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
|
|
44
|
+
return (prop) => {
|
|
45
|
+
if (_optionalChain([prop, 'access', _ => _.arg, 'optionalAccess', _2 => _2.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && _optionalChain([prop, 'access', _3 => _3.exp, 'optionalAccess', _4 => _4.type]) === _compilerdom.NodeTypes.SIMPLE_EXPRESSION) {
|
|
46
|
+
const generated = _chunkAEJDBNAXjs.generateCode.call(void 0, prop.exp.content, {
|
|
47
|
+
jsHandler,
|
|
48
|
+
runtimeSet
|
|
49
|
+
});
|
|
50
|
+
ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, generated);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
31
54
|
var defaultCreateJsHandlerOptions = {
|
|
32
55
|
babelParserOptions: {
|
|
33
56
|
plugins: [
|
|
@@ -42,27 +65,21 @@ function transformUVue(code, id, jsHandler, runtimeSet) {
|
|
|
42
65
|
const ms = new (0, _magicstring2.default)(code);
|
|
43
66
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
44
67
|
if (errors.length === 0) {
|
|
45
|
-
if (descriptor.template) {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, code2);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
});
|
|
68
|
+
if (_optionalChain([descriptor, 'access', _5 => _5.template, 'optionalAccess', _6 => _6.ast])) {
|
|
69
|
+
const updateStaticClass = createClassAttributeUpdater(ms);
|
|
70
|
+
const updateDynamicClass = createClassDirectiveUpdater(ms, jsHandler, runtimeSet);
|
|
71
|
+
traverse(descriptor.template.ast, (node) => {
|
|
72
|
+
if (node.type !== _compilerdom.NodeTypes.ELEMENT) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
for (const prop of node.props) {
|
|
76
|
+
if (prop.type === _compilerdom.NodeTypes.ATTRIBUTE && prop.name === "class") {
|
|
77
|
+
updateStaticClass(prop);
|
|
78
|
+
} else if (prop.type === _compilerdom.NodeTypes.DIRECTIVE && prop.name === "bind") {
|
|
79
|
+
updateDynamicClass(prop);
|
|
80
|
+
}
|
|
62
81
|
}
|
|
63
|
-
};
|
|
64
|
-
var extractClassNames = extractClassNames2;
|
|
65
|
-
traverse(descriptor.template.ast, extractClassNames2);
|
|
82
|
+
});
|
|
66
83
|
}
|
|
67
84
|
if (descriptor.script) {
|
|
68
85
|
const { code: code2 } = jsHandler(descriptor.script.content, _nullishCoalesce(runtimeSet, () => ( /* @__PURE__ */ new Set())), defaultCreateJsHandlerOptions);
|
|
@@ -146,9 +163,9 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
146
163
|
}
|
|
147
164
|
|
|
148
165
|
// src/bundlers/vite/index.ts
|
|
149
|
-
var debug =
|
|
166
|
+
var debug = _chunk2NRTWL47js.createDebug.call(void 0, );
|
|
150
167
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
151
|
-
const opts =
|
|
168
|
+
const opts = _chunkAEJDBNAXjs.getCompilerContext.call(void 0, options);
|
|
152
169
|
const {
|
|
153
170
|
disabled,
|
|
154
171
|
onEnd,
|
|
@@ -172,10 +189,6 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
172
189
|
let runtimeSet;
|
|
173
190
|
onLoad();
|
|
174
191
|
const plugins = [
|
|
175
|
-
// {
|
|
176
|
-
// name: `${vitePluginName}:pre`,
|
|
177
|
-
// enforce: 'pre',
|
|
178
|
-
// },
|
|
179
192
|
{
|
|
180
193
|
name: `${_chunkOGROHM4Ljs.vitePluginName}:post`,
|
|
181
194
|
enforce: "post",
|
|
@@ -195,138 +208,118 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
195
208
|
debug("start");
|
|
196
209
|
onStart();
|
|
197
210
|
const entries = Object.entries(bundle);
|
|
198
|
-
const groupedEntries =
|
|
211
|
+
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, opts);
|
|
199
212
|
runtimeSet = await twPatcher.getClassSet();
|
|
200
213
|
setMangleRuntimeSet(runtimeSet);
|
|
201
214
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
202
|
-
const
|
|
215
|
+
const tasks = [];
|
|
203
216
|
if (Array.isArray(groupedEntries.html)) {
|
|
204
|
-
for (const
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
const source = cache.get(file);
|
|
214
|
-
if (source) {
|
|
215
|
-
originalSource.source = source;
|
|
216
|
-
debug("html cache hit: %s", file);
|
|
217
|
-
} else {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
217
|
+
for (const [file, originalSource] of groupedEntries.html) {
|
|
218
|
+
const rawSource = originalSource.source.toString();
|
|
219
|
+
tasks.push(
|
|
220
|
+
_chunk2NRTWL47js.processCachedTask.call(void 0, {
|
|
221
|
+
cache,
|
|
222
|
+
cacheKey: file,
|
|
223
|
+
rawSource,
|
|
224
|
+
applyResult(source) {
|
|
225
|
+
originalSource.source = source;
|
|
220
226
|
},
|
|
221
|
-
|
|
222
|
-
|
|
227
|
+
onCacheHit() {
|
|
228
|
+
debug("html cache hit: %s", file);
|
|
229
|
+
},
|
|
230
|
+
async transform() {
|
|
231
|
+
const transformed = await templateHandler(rawSource, {
|
|
223
232
|
runtimeSet
|
|
224
233
|
});
|
|
225
|
-
onUpdate(file,
|
|
234
|
+
onUpdate(file, rawSource, transformed);
|
|
226
235
|
debug("html handle: %s", file);
|
|
227
236
|
return {
|
|
228
|
-
|
|
229
|
-
source: originalSource.source
|
|
237
|
+
result: transformed
|
|
230
238
|
};
|
|
231
239
|
}
|
|
232
|
-
)
|
|
240
|
+
})
|
|
233
241
|
);
|
|
234
242
|
}
|
|
235
243
|
}
|
|
236
244
|
if (Array.isArray(groupedEntries.js)) {
|
|
237
|
-
for (const
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
const source = cache.get(file);
|
|
247
|
-
if (source) {
|
|
245
|
+
for (const [file, originalSource] of groupedEntries.js) {
|
|
246
|
+
if (originalSource.type === "chunk") {
|
|
247
|
+
const rawSource = originalSource.code;
|
|
248
|
+
tasks.push(
|
|
249
|
+
_chunk2NRTWL47js.processCachedTask.call(void 0, {
|
|
250
|
+
cache,
|
|
251
|
+
cacheKey: file,
|
|
252
|
+
rawSource,
|
|
253
|
+
applyResult(source) {
|
|
248
254
|
originalSource.code = source;
|
|
255
|
+
},
|
|
256
|
+
onCacheHit() {
|
|
249
257
|
debug("js cache hit: %s", file);
|
|
250
|
-
} else {
|
|
251
|
-
return false;
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
async () => {
|
|
255
|
-
const { code } = await jsHandler(rawSource, runtimeSet, {
|
|
256
|
-
// generateMap: hasSourceMap,
|
|
257
|
-
});
|
|
258
|
-
originalSource.code = code;
|
|
259
|
-
onUpdate(file, rawSource, code);
|
|
260
|
-
debug("js handle: %s", file);
|
|
261
|
-
return {
|
|
262
|
-
key: file,
|
|
263
|
-
source: code
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
)
|
|
267
|
-
);
|
|
268
|
-
}
|
|
269
|
-
if (uniAppX) {
|
|
270
|
-
for (const element of groupedEntries.js.filter((x) => x[1].type === "asset")) {
|
|
271
|
-
const [file, originalSource] = element;
|
|
272
|
-
const rawSource = originalSource.source.toString();
|
|
273
|
-
const hash = cache.computeHash(rawSource);
|
|
274
|
-
cache.calcHashValueChanged(file, hash);
|
|
275
|
-
promises.push(
|
|
276
|
-
cache.process(
|
|
277
|
-
file,
|
|
278
|
-
() => {
|
|
279
|
-
const source = cache.get(file);
|
|
280
|
-
if (source) {
|
|
281
|
-
originalSource.source = source;
|
|
282
|
-
debug("js cache hit: %s", file);
|
|
283
|
-
} else {
|
|
284
|
-
return false;
|
|
285
|
-
}
|
|
286
258
|
},
|
|
287
|
-
async ()
|
|
288
|
-
const { code } = await jsHandler(rawSource, runtimeSet
|
|
289
|
-
// generateMap: hasSourceMap,
|
|
290
|
-
uniAppX,
|
|
291
|
-
babelParserOptions: {
|
|
292
|
-
plugins: [
|
|
293
|
-
"typescript"
|
|
294
|
-
],
|
|
295
|
-
sourceType: "unambiguous"
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
originalSource.source = code;
|
|
259
|
+
async transform() {
|
|
260
|
+
const { code } = await jsHandler(rawSource, runtimeSet);
|
|
299
261
|
onUpdate(file, rawSource, code);
|
|
300
262
|
debug("js handle: %s", file);
|
|
301
263
|
return {
|
|
302
|
-
|
|
303
|
-
source: code
|
|
264
|
+
result: code
|
|
304
265
|
};
|
|
305
266
|
}
|
|
306
|
-
)
|
|
267
|
+
})
|
|
307
268
|
);
|
|
308
269
|
}
|
|
309
270
|
}
|
|
271
|
+
if (uniAppX) {
|
|
272
|
+
for (const [file, originalSource] of groupedEntries.js) {
|
|
273
|
+
if (originalSource.type === "asset") {
|
|
274
|
+
const rawSource = originalSource.source.toString();
|
|
275
|
+
tasks.push(
|
|
276
|
+
_chunk2NRTWL47js.processCachedTask.call(void 0, {
|
|
277
|
+
cache,
|
|
278
|
+
cacheKey: file,
|
|
279
|
+
rawSource,
|
|
280
|
+
applyResult(source) {
|
|
281
|
+
originalSource.source = source;
|
|
282
|
+
},
|
|
283
|
+
onCacheHit() {
|
|
284
|
+
debug("js cache hit: %s", file);
|
|
285
|
+
},
|
|
286
|
+
async transform() {
|
|
287
|
+
const { code } = await jsHandler(rawSource, runtimeSet, {
|
|
288
|
+
uniAppX,
|
|
289
|
+
babelParserOptions: {
|
|
290
|
+
plugins: [
|
|
291
|
+
"typescript"
|
|
292
|
+
],
|
|
293
|
+
sourceType: "unambiguous"
|
|
294
|
+
}
|
|
295
|
+
});
|
|
296
|
+
onUpdate(file, rawSource, code);
|
|
297
|
+
debug("js handle: %s", file);
|
|
298
|
+
return {
|
|
299
|
+
result: code
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
})
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
310
307
|
}
|
|
311
308
|
if (Array.isArray(groupedEntries.css)) {
|
|
312
|
-
for (const
|
|
313
|
-
const [file, originalSource] = element;
|
|
309
|
+
for (const [file, originalSource] of groupedEntries.css) {
|
|
314
310
|
const rawSource = originalSource.source.toString();
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
()
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
} else {
|
|
326
|
-
return false;
|
|
327
|
-
}
|
|
311
|
+
tasks.push(
|
|
312
|
+
_chunk2NRTWL47js.processCachedTask.call(void 0, {
|
|
313
|
+
cache,
|
|
314
|
+
cacheKey: file,
|
|
315
|
+
rawSource,
|
|
316
|
+
applyResult(source) {
|
|
317
|
+
originalSource.source = source;
|
|
318
|
+
},
|
|
319
|
+
onCacheHit() {
|
|
320
|
+
debug("css cache hit: %s", file);
|
|
328
321
|
},
|
|
329
|
-
async ()
|
|
322
|
+
async transform() {
|
|
330
323
|
const { css } = await styleHandler(rawSource, {
|
|
331
324
|
isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
|
|
332
325
|
postcssOptions: {
|
|
@@ -336,19 +329,17 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
336
329
|
},
|
|
337
330
|
majorVersion: twPatcher.majorVersion
|
|
338
331
|
});
|
|
339
|
-
originalSource.source = css;
|
|
340
332
|
onUpdate(file, rawSource, css);
|
|
341
333
|
debug("css handle: %s", file);
|
|
342
334
|
return {
|
|
343
|
-
|
|
344
|
-
source: css
|
|
335
|
+
result: css
|
|
345
336
|
};
|
|
346
337
|
}
|
|
347
|
-
)
|
|
338
|
+
})
|
|
348
339
|
);
|
|
349
340
|
}
|
|
350
341
|
}
|
|
351
|
-
await Promise.all(
|
|
342
|
+
await Promise.all(tasks);
|
|
352
343
|
onEnd();
|
|
353
344
|
debug("end");
|
|
354
345
|
}
|
|
@@ -375,8 +366,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
375
366
|
// postcss may return virtual files
|
|
376
367
|
// we cannot obtain content of them, so this needs to be enabled
|
|
377
368
|
sourcesContent: true
|
|
378
|
-
// when
|
|
379
|
-
// prev: preprocessorMap,
|
|
369
|
+
// when a previous preprocessor map is provided, duplicates may appear in `postcssResult.map.sources`
|
|
380
370
|
}
|
|
381
371
|
}
|
|
382
372
|
}
|
|
@@ -1,24 +1,27 @@
|
|
|
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(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk6GP37C26js = require('./chunk-6GP37C26.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
7
6
|
|
|
7
|
+
var _chunk2NRTWL47js = require('./chunk-2NRTWL47.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
var _chunkOGROHM4Ljs = require('./chunk-OGROHM4L.js');
|
|
8
11
|
|
|
9
|
-
var _chunkGRWK73SMjs = require('./chunk-GRWK73SM.js');
|
|
10
12
|
|
|
13
|
+
var _chunkAEJDBNAXjs = require('./chunk-AEJDBNAX.js');
|
|
11
14
|
|
|
12
15
|
|
|
13
|
-
var
|
|
16
|
+
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
14
17
|
|
|
15
18
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
16
19
|
var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
17
20
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
18
|
-
var debug =
|
|
21
|
+
var debug = _chunk2NRTWL47js.createDebug.call(void 0, );
|
|
19
22
|
var UnifiedWebpackPluginV5 = class {
|
|
20
23
|
constructor(options = {}) {
|
|
21
|
-
this.options =
|
|
24
|
+
this.options = _chunkAEJDBNAXjs.getCompilerContext.call(void 0, options);
|
|
22
25
|
this.appType = this.options.appType;
|
|
23
26
|
}
|
|
24
27
|
apply(compiler) {
|
|
@@ -82,78 +85,68 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
82
85
|
}
|
|
83
86
|
}
|
|
84
87
|
const entries = Object.entries(assets);
|
|
85
|
-
const groupedEntries =
|
|
88
|
+
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, this.options);
|
|
86
89
|
const runtimeSet = await twPatcher.getClassSet();
|
|
87
90
|
setMangleRuntimeSet(runtimeSet);
|
|
88
91
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
89
|
-
const
|
|
92
|
+
const tasks = [];
|
|
90
93
|
if (Array.isArray(groupedEntries.html)) {
|
|
91
94
|
for (const element of groupedEntries.html) {
|
|
92
95
|
const [file, originalSource] = element;
|
|
93
96
|
const rawSource = originalSource.source().toString();
|
|
94
|
-
const hash = cache.computeHash(rawSource);
|
|
95
97
|
const cacheKey = file;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
tasks.push(
|
|
99
|
+
_chunk2NRTWL47js.processCachedTask.call(void 0, {
|
|
100
|
+
cache,
|
|
99
101
|
cacheKey,
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
102
|
+
rawSource,
|
|
103
|
+
applyResult(source) {
|
|
104
|
+
compilation.updateAsset(file, source);
|
|
105
|
+
},
|
|
106
|
+
onCacheHit() {
|
|
107
|
+
debug("html cache hit: %s", file);
|
|
108
108
|
},
|
|
109
|
-
async () => {
|
|
109
|
+
transform: async () => {
|
|
110
110
|
const wxml = await templateHandler(rawSource, {
|
|
111
111
|
runtimeSet
|
|
112
112
|
});
|
|
113
113
|
const source = new ConcatSource(wxml);
|
|
114
|
-
compilation.updateAsset(file, source);
|
|
115
114
|
onUpdate(file, rawSource, wxml);
|
|
116
115
|
debug("html handle: %s", file);
|
|
117
116
|
return {
|
|
118
|
-
|
|
119
|
-
source
|
|
117
|
+
result: source
|
|
120
118
|
};
|
|
121
119
|
}
|
|
122
|
-
)
|
|
120
|
+
})
|
|
123
121
|
);
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
if (Array.isArray(groupedEntries.js)) {
|
|
127
125
|
for (const element of groupedEntries.js) {
|
|
128
126
|
const [file, originalSource] = element;
|
|
129
|
-
const cacheKey =
|
|
130
|
-
|
|
131
|
-
|
|
127
|
+
const cacheKey = _chunk6GP37C26js.getCacheKey.call(void 0, file);
|
|
128
|
+
const rawSource = originalSource.source().toString();
|
|
129
|
+
tasks.push(
|
|
130
|
+
_chunk2NRTWL47js.processCachedTask.call(void 0, {
|
|
131
|
+
cache,
|
|
132
132
|
cacheKey,
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
compilation.updateAsset(file, source);
|
|
137
|
-
debug("js cache hit: %s", file);
|
|
138
|
-
} else {
|
|
139
|
-
return false;
|
|
140
|
-
}
|
|
133
|
+
rawSource,
|
|
134
|
+
applyResult(source) {
|
|
135
|
+
compilation.updateAsset(file, source);
|
|
141
136
|
},
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
});
|
|
137
|
+
onCacheHit() {
|
|
138
|
+
debug("js cache hit: %s", file);
|
|
139
|
+
},
|
|
140
|
+
transform: async () => {
|
|
141
|
+
const { code } = await jsHandler(rawSource, runtimeSet);
|
|
147
142
|
const source = new ConcatSource(code);
|
|
148
|
-
compilation.updateAsset(file, source);
|
|
149
143
|
onUpdate(file, rawSource, code);
|
|
150
144
|
debug("js handle: %s", file);
|
|
151
145
|
return {
|
|
152
|
-
|
|
153
|
-
source
|
|
146
|
+
result: source
|
|
154
147
|
};
|
|
155
148
|
}
|
|
156
|
-
)
|
|
149
|
+
})
|
|
157
150
|
);
|
|
158
151
|
}
|
|
159
152
|
}
|
|
@@ -161,22 +154,19 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
161
154
|
for (const element of groupedEntries.css) {
|
|
162
155
|
const [file, originalSource] = element;
|
|
163
156
|
const rawSource = originalSource.source().toString();
|
|
164
|
-
const hash = cache.computeHash(rawSource);
|
|
165
157
|
const cacheKey = file;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
158
|
+
tasks.push(
|
|
159
|
+
_chunk2NRTWL47js.processCachedTask.call(void 0, {
|
|
160
|
+
cache,
|
|
169
161
|
cacheKey,
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
return false;
|
|
177
|
-
}
|
|
162
|
+
rawSource,
|
|
163
|
+
applyResult(source) {
|
|
164
|
+
compilation.updateAsset(file, source);
|
|
165
|
+
},
|
|
166
|
+
onCacheHit() {
|
|
167
|
+
debug("css cache hit: %s", file);
|
|
178
168
|
},
|
|
179
|
-
async () => {
|
|
169
|
+
transform: async () => {
|
|
180
170
|
const { css } = await styleHandler(rawSource, {
|
|
181
171
|
isMainChunk: mainCssChunkMatcher(file, this.appType),
|
|
182
172
|
postcssOptions: {
|
|
@@ -187,19 +177,17 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
187
177
|
majorVersion: twPatcher.majorVersion
|
|
188
178
|
});
|
|
189
179
|
const source = new ConcatSource(css);
|
|
190
|
-
compilation.updateAsset(file, source);
|
|
191
180
|
onUpdate(file, rawSource, css);
|
|
192
181
|
debug("css handle: %s", file);
|
|
193
182
|
return {
|
|
194
|
-
|
|
195
|
-
source
|
|
183
|
+
result: source
|
|
196
184
|
};
|
|
197
185
|
}
|
|
198
|
-
)
|
|
186
|
+
})
|
|
199
187
|
);
|
|
200
188
|
}
|
|
201
189
|
}
|
|
202
|
-
await Promise.all(
|
|
190
|
+
await Promise.all(tasks);
|
|
203
191
|
debug("end");
|
|
204
192
|
onEnd();
|
|
205
193
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_jiti@2.
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// ../../node_modules/.pnpm/tsup@8.5.0_@swc+core@1.13.5_jiti@2.6.1_postcss@8.5.6_tsx@4.20.6_typescript@5.9.3_yaml@2.8.1/node_modules/tsup/assets/cjs_shims.js
|
|
2
2
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
3
3
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
4
4
|
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/utils/index.ts
|
|
2
|
+
var _shared = require('@weapp-tailwindcss/shared');
|
|
3
|
+
function classifyEntry(filename, options) {
|
|
4
|
+
if (options.cssMatcher(filename)) {
|
|
5
|
+
return "css";
|
|
6
|
+
}
|
|
7
|
+
if (options.htmlMatcher(filename)) {
|
|
8
|
+
return "html";
|
|
9
|
+
}
|
|
10
|
+
if (options.jsMatcher(filename) || options.wxsMatcher(filename)) {
|
|
11
|
+
return "js";
|
|
12
|
+
}
|
|
13
|
+
return "other";
|
|
14
|
+
}
|
|
15
|
+
function createEmptyGroups() {
|
|
16
|
+
return {
|
|
17
|
+
css: [],
|
|
18
|
+
html: [],
|
|
19
|
+
js: [],
|
|
20
|
+
other: []
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
function getGroupedEntries(entries, options) {
|
|
24
|
+
const groups = createEmptyGroups();
|
|
25
|
+
for (const entry of entries) {
|
|
26
|
+
const [filename] = entry;
|
|
27
|
+
const group = classifyEntry(filename, options);
|
|
28
|
+
groups[group].push(entry);
|
|
29
|
+
}
|
|
30
|
+
return groups;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
exports.defu = _shared.defu; exports.defuOverrideArray = _shared.defuOverrideArray; exports.isMap = _shared.isMap; exports.noop = _shared.noop; exports.getGroupedEntries = getGroupedEntries;
|