weapp-tailwindcss 4.7.1 → 4.7.3
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-XLUAMJS6.js → chunk-2AAEKHNR.js} +49 -43
- package/dist/{chunk-W4YVU4OO.mjs → chunk-3ARXMTWC.mjs} +10 -1
- package/dist/chunk-667CYXAH.mjs +133 -0
- package/dist/chunk-BUMQQPAO.js +133 -0
- package/dist/{chunk-C7SH2SQK.mjs → chunk-CIBW3DQO.mjs} +43 -37
- package/dist/{chunk-Z6YNBYLM.mjs → chunk-DXFNC4BP.mjs} +278 -109
- package/dist/{chunk-KCL4CARB.js → chunk-JTGVWJ3Z.js} +281 -112
- package/dist/{chunk-NRG7N2Q7.mjs → chunk-KZJLIZIK.mjs} +0 -1
- package/dist/{chunk-34T2BFTJ.mjs → chunk-KZUIVLPP.mjs} +42 -1
- package/dist/{chunk-4NJFDWBZ.js → chunk-L2CHPESJ.js} +94 -78
- package/dist/{chunk-FUMBS2BS.mjs → chunk-O3TOCTXE.mjs} +85 -69
- package/dist/chunk-R7GWRQDJ.js +15 -0
- package/dist/chunk-SCOGAO45.mjs +18 -0
- package/dist/{chunk-KF7YCOEP.js → chunk-SIZNRUIV.js} +14 -5
- package/dist/{chunk-KMGWHIDU.js → chunk-UAU6XVAY.js} +7 -6
- package/dist/{chunk-WVKK6TBL.js → chunk-W7BVY5S5.js} +42 -1
- package/dist/{chunk-LZ6L3UQO.js → chunk-WXBFAARR.js} +0 -1
- package/dist/{chunk-F6IW6L27.mjs → chunk-XFYWHJEU.mjs} +6 -5
- package/dist/cli.js +384 -16
- package/dist/cli.mjs +384 -17
- package/dist/core.js +11 -10
- package/dist/core.mjs +11 -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.js +3 -3
- package/dist/defaults.mjs +2 -2
- 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 -10
- package/dist/index.mjs +9 -9
- 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 +8 -21
- package/dist/types.d.ts +8 -21
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +8 -8
- package/dist/vite.mjs +7 -7
- package/dist/webpack.js +8 -8
- package/dist/webpack.mjs +7 -7
- package/dist/webpack4.js +52 -46
- package/dist/webpack4.mjs +45 -39
- package/package.json +5 -3
- package/dist/chunk-4EUTRMUC.mjs +0 -10
- package/dist/chunk-FB5P4TRH.js +0 -70
- package/dist/chunk-QXSBMK2W.js +0 -7
- package/dist/chunk-YPBRGP6K.mjs +0 -70
|
@@ -1,19 +1,21 @@
|
|
|
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
|
-
|
|
4
|
+
|
|
5
|
+
var _chunkW7BVY5S5js = require('./chunk-W7BVY5S5.js');
|
|
5
6
|
|
|
6
7
|
|
|
7
8
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
|
|
13
|
+
var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
16
|
-
var
|
|
18
|
+
var _chunkJTGVWJ3Zjs = require('./chunk-JTGVWJ3Z.js');
|
|
17
19
|
|
|
18
20
|
|
|
19
21
|
var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
|
|
@@ -51,9 +53,10 @@ function createClassAttributeUpdater(ms) {
|
|
|
51
53
|
function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
|
|
52
54
|
return (prop) => {
|
|
53
55
|
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) {
|
|
54
|
-
const generated =
|
|
56
|
+
const generated = _chunkJTGVWJ3Zjs.generateCode.call(void 0, prop.exp.content, {
|
|
55
57
|
jsHandler,
|
|
56
|
-
runtimeSet
|
|
58
|
+
runtimeSet,
|
|
59
|
+
wrapExpression: true
|
|
57
60
|
});
|
|
58
61
|
ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, generated);
|
|
59
62
|
}
|
|
@@ -171,7 +174,7 @@ async function formatPostcssSourceMap(rawMap, file) {
|
|
|
171
174
|
}
|
|
172
175
|
|
|
173
176
|
// src/bundlers/vite/index.ts
|
|
174
|
-
var debug =
|
|
177
|
+
var debug = _chunkBUMQQPAOjs.createDebug.call(void 0, );
|
|
175
178
|
function readOutputEntry(entry) {
|
|
176
179
|
if (entry.output.type === "chunk") {
|
|
177
180
|
return entry.output.code;
|
|
@@ -201,7 +204,7 @@ function isJavaScriptEntry(entry) {
|
|
|
201
204
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
202
205
|
return {
|
|
203
206
|
resolve(specifier, importer) {
|
|
204
|
-
return
|
|
207
|
+
return _chunkW7BVY5S5js.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
|
|
205
208
|
},
|
|
206
209
|
load(id) {
|
|
207
210
|
const entry = entries.get(id);
|
|
@@ -215,7 +218,7 @@ function createBundleModuleGraphOptions(outputDir, entries) {
|
|
|
215
218
|
}
|
|
216
219
|
};
|
|
217
220
|
}
|
|
218
|
-
function applyLinkedResults(linked, entries, onLinkedUpdate) {
|
|
221
|
+
function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
219
222
|
if (!linked) {
|
|
220
223
|
return;
|
|
221
224
|
}
|
|
@@ -233,11 +236,12 @@ function applyLinkedResults(linked, entries, onLinkedUpdate) {
|
|
|
233
236
|
} else {
|
|
234
237
|
entry.output.source = code;
|
|
235
238
|
}
|
|
239
|
+
_optionalChain([onApplied, 'optionalCall', _7 => _7(entry, code)]);
|
|
236
240
|
onLinkedUpdate(entry.fileName, previous, code);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
239
243
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
240
|
-
const opts =
|
|
244
|
+
const opts = _chunkJTGVWJ3Zjs.getCompilerContext.call(void 0, options);
|
|
241
245
|
const {
|
|
242
246
|
disabled,
|
|
243
247
|
onEnd,
|
|
@@ -256,13 +260,13 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
256
260
|
if (disabled) {
|
|
257
261
|
return;
|
|
258
262
|
}
|
|
259
|
-
const patchPromise =
|
|
263
|
+
const patchPromise = _chunkBUMQQPAOjs.createTailwindPatchPromise.call(void 0, twPatcher);
|
|
260
264
|
let runtimeSet;
|
|
261
265
|
let resolvedConfig;
|
|
262
266
|
onLoad();
|
|
263
267
|
const plugins = [
|
|
264
268
|
{
|
|
265
|
-
name: `${
|
|
269
|
+
name: `${_chunkJTGVWJ3Zjs.vitePluginName}:post`,
|
|
266
270
|
enforce: "post",
|
|
267
271
|
configResolved(config) {
|
|
268
272
|
resolvedConfig = config;
|
|
@@ -282,30 +286,40 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
282
286
|
debug("start");
|
|
283
287
|
onStart();
|
|
284
288
|
const entries = Object.entries(bundle);
|
|
285
|
-
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
286
|
-
const outDir = _optionalChain([resolvedConfig, 'optionalAccess',
|
|
289
|
+
const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _8 => _8.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
|
|
290
|
+
const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _9 => _9.build, 'optionalAccess', _10 => _10.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
|
|
287
291
|
const jsEntries = /* @__PURE__ */ new Map();
|
|
288
292
|
for (const [fileName, output] of entries) {
|
|
289
293
|
const entry = { fileName, output };
|
|
290
294
|
if (isJavaScriptEntry(entry)) {
|
|
291
|
-
const absolute =
|
|
295
|
+
const absolute = _chunkW7BVY5S5js.toAbsoluteOutputPath.call(void 0, fileName, outDir);
|
|
292
296
|
jsEntries.set(absolute, entry);
|
|
293
297
|
}
|
|
294
298
|
}
|
|
295
299
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
296
300
|
const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, opts);
|
|
297
|
-
runtimeSet = await
|
|
301
|
+
runtimeSet = await _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: true });
|
|
298
302
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
299
303
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
300
304
|
onUpdate(fileName, previous, next);
|
|
301
305
|
debug("js linked handle: %s", fileName);
|
|
302
306
|
};
|
|
307
|
+
const pendingLinkedUpdates = [];
|
|
308
|
+
const scheduleLinkedApply = (entry, code) => {
|
|
309
|
+
pendingLinkedUpdates.push(() => {
|
|
310
|
+
if (entry.output.type === "chunk") {
|
|
311
|
+
entry.output.code = code;
|
|
312
|
+
} else {
|
|
313
|
+
entry.output.source = code;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
};
|
|
303
317
|
const createHandlerOptions = (absoluteFilename, extra) => ({
|
|
304
318
|
...extra,
|
|
305
319
|
filename: absoluteFilename,
|
|
306
320
|
moduleGraph: moduleGraphOptions,
|
|
307
321
|
babelParserOptions: {
|
|
308
|
-
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess',
|
|
322
|
+
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _11 => _11.babelParserOptions]), () => ( {})),
|
|
309
323
|
sourceFilename: absoluteFilename
|
|
310
324
|
}
|
|
311
325
|
});
|
|
@@ -338,70 +352,68 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
338
352
|
);
|
|
339
353
|
}
|
|
340
354
|
}
|
|
355
|
+
const jsTaskFactories = [];
|
|
341
356
|
if (Array.isArray(groupedEntries.js)) {
|
|
342
357
|
for (const [file, originalSource] of groupedEntries.js) {
|
|
343
|
-
if (originalSource.type
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
for (const [file, originalSource] of groupedEntries.js) {
|
|
372
|
-
if (originalSource.type !== "asset") {
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
375
|
-
const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
358
|
+
if (originalSource.type === "chunk") {
|
|
359
|
+
const absoluteFile = _chunkW7BVY5S5js.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
360
|
+
const initialRawSource = originalSource.code;
|
|
361
|
+
jsTaskFactories.push(async () => {
|
|
362
|
+
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
363
|
+
cache,
|
|
364
|
+
cacheKey: file,
|
|
365
|
+
rawSource: initialRawSource,
|
|
366
|
+
applyResult(source) {
|
|
367
|
+
originalSource.code = source;
|
|
368
|
+
},
|
|
369
|
+
onCacheHit() {
|
|
370
|
+
debug("js cache hit: %s", file);
|
|
371
|
+
},
|
|
372
|
+
async transform() {
|
|
373
|
+
const rawSource = originalSource.code;
|
|
374
|
+
const { code, linked } = await jsHandler(rawSource, runtimeSet, createHandlerOptions(absoluteFile));
|
|
375
|
+
onUpdate(file, rawSource, code);
|
|
376
|
+
debug("js handle: %s", file);
|
|
377
|
+
applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
|
|
378
|
+
return {
|
|
379
|
+
result: code
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
} else if (uniAppX && originalSource.type === "asset") {
|
|
385
|
+
const absoluteFile = _chunkW7BVY5S5js.toAbsoluteOutputPath.call(void 0, file, outDir);
|
|
376
386
|
const rawSource = originalSource.source.toString();
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
387
|
+
jsTaskFactories.push(async () => {
|
|
388
|
+
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
389
|
+
cache,
|
|
390
|
+
cacheKey: file,
|
|
391
|
+
rawSource,
|
|
392
|
+
applyResult(source) {
|
|
393
|
+
originalSource.source = source;
|
|
394
|
+
},
|
|
395
|
+
onCacheHit() {
|
|
396
|
+
debug("js cache hit: %s", file);
|
|
397
|
+
},
|
|
398
|
+
async transform() {
|
|
399
|
+
const currentSource = originalSource.source.toString();
|
|
400
|
+
const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
|
|
401
|
+
uniAppX,
|
|
402
|
+
babelParserOptions: {
|
|
403
|
+
plugins: [
|
|
404
|
+
"typescript"
|
|
405
|
+
],
|
|
406
|
+
sourceType: "unambiguous"
|
|
407
|
+
}
|
|
408
|
+
}));
|
|
409
|
+
onUpdate(file, currentSource, code);
|
|
410
|
+
debug("js handle: %s", file);
|
|
411
|
+
applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
|
|
412
|
+
return {
|
|
413
|
+
result: code
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
});
|
|
405
417
|
});
|
|
406
418
|
}
|
|
407
419
|
}
|
|
@@ -441,7 +453,11 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
441
453
|
);
|
|
442
454
|
}
|
|
443
455
|
}
|
|
456
|
+
_chunkW7BVY5S5js.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
444
457
|
await Promise.all(tasks);
|
|
458
|
+
for (const apply of pendingLinkedUpdates) {
|
|
459
|
+
apply();
|
|
460
|
+
}
|
|
445
461
|
onEnd();
|
|
446
462
|
debug("end");
|
|
447
463
|
}
|
|
@@ -496,7 +512,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
496
512
|
enforce: "pre",
|
|
497
513
|
async buildStart() {
|
|
498
514
|
await patchPromise;
|
|
499
|
-
runtimeSet = await
|
|
515
|
+
runtimeSet = await _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: true });
|
|
500
516
|
},
|
|
501
517
|
transform(code, id) {
|
|
502
518
|
return transformUVue(code, id, jsHandler, runtimeSet);
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
|
+
pushConcurrentTaskFactories,
|
|
2
3
|
resolveOutputSpecifier,
|
|
3
4
|
toAbsoluteOutputPath
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-KZUIVLPP.mjs";
|
|
5
6
|
import {
|
|
6
7
|
processCachedTask
|
|
7
8
|
} from "./chunk-RRHPTTCP.mjs";
|
|
8
9
|
import {
|
|
9
10
|
collectRuntimeClassSet,
|
|
10
|
-
createDebug
|
|
11
|
-
|
|
11
|
+
createDebug,
|
|
12
|
+
createTailwindPatchPromise
|
|
13
|
+
} from "./chunk-667CYXAH.mjs";
|
|
12
14
|
import {
|
|
13
15
|
generateCode,
|
|
14
16
|
getCompilerContext,
|
|
15
17
|
vitePluginName
|
|
16
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-DXFNC4BP.mjs";
|
|
17
19
|
import {
|
|
18
20
|
replaceWxml
|
|
19
21
|
} from "./chunk-VSRDBMDB.mjs";
|
|
@@ -53,7 +55,8 @@ function createClassDirectiveUpdater(ms, jsHandler, runtimeSet) {
|
|
|
53
55
|
if (prop.arg?.type === NodeTypes.SIMPLE_EXPRESSION && prop.arg.content === "class" && prop.exp?.type === NodeTypes.SIMPLE_EXPRESSION) {
|
|
54
56
|
const generated = generateCode(prop.exp.content, {
|
|
55
57
|
jsHandler,
|
|
56
|
-
runtimeSet
|
|
58
|
+
runtimeSet,
|
|
59
|
+
wrapExpression: true
|
|
57
60
|
});
|
|
58
61
|
ms.update(prop.exp.loc.start.offset, prop.exp.loc.end.offset, generated);
|
|
59
62
|
}
|
|
@@ -215,7 +218,7 @@ function createBundleModuleGraphOptions(outputDir, entries) {
|
|
|
215
218
|
}
|
|
216
219
|
};
|
|
217
220
|
}
|
|
218
|
-
function applyLinkedResults(linked, entries, onLinkedUpdate) {
|
|
221
|
+
function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
219
222
|
if (!linked) {
|
|
220
223
|
return;
|
|
221
224
|
}
|
|
@@ -233,6 +236,7 @@ function applyLinkedResults(linked, entries, onLinkedUpdate) {
|
|
|
233
236
|
} else {
|
|
234
237
|
entry.output.source = code;
|
|
235
238
|
}
|
|
239
|
+
onApplied?.(entry, code);
|
|
236
240
|
onLinkedUpdate(entry.fileName, previous, code);
|
|
237
241
|
}
|
|
238
242
|
}
|
|
@@ -256,7 +260,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
256
260
|
if (disabled) {
|
|
257
261
|
return;
|
|
258
262
|
}
|
|
259
|
-
const patchPromise =
|
|
263
|
+
const patchPromise = createTailwindPatchPromise(twPatcher);
|
|
260
264
|
let runtimeSet;
|
|
261
265
|
let resolvedConfig;
|
|
262
266
|
onLoad();
|
|
@@ -294,12 +298,22 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
294
298
|
}
|
|
295
299
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
296
300
|
const groupedEntries = getGroupedEntries(entries, opts);
|
|
297
|
-
runtimeSet = await collectRuntimeClassSet(twPatcher);
|
|
301
|
+
runtimeSet = await collectRuntimeClassSet(twPatcher, { force: true });
|
|
298
302
|
debug("get runtimeSet, class count: %d", runtimeSet.size);
|
|
299
303
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
300
304
|
onUpdate(fileName, previous, next);
|
|
301
305
|
debug("js linked handle: %s", fileName);
|
|
302
306
|
};
|
|
307
|
+
const pendingLinkedUpdates = [];
|
|
308
|
+
const scheduleLinkedApply = (entry, code) => {
|
|
309
|
+
pendingLinkedUpdates.push(() => {
|
|
310
|
+
if (entry.output.type === "chunk") {
|
|
311
|
+
entry.output.code = code;
|
|
312
|
+
} else {
|
|
313
|
+
entry.output.source = code;
|
|
314
|
+
}
|
|
315
|
+
});
|
|
316
|
+
};
|
|
303
317
|
const createHandlerOptions = (absoluteFilename, extra) => ({
|
|
304
318
|
...extra,
|
|
305
319
|
filename: absoluteFilename,
|
|
@@ -338,70 +352,68 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
338
352
|
);
|
|
339
353
|
}
|
|
340
354
|
}
|
|
355
|
+
const jsTaskFactories = [];
|
|
341
356
|
if (Array.isArray(groupedEntries.js)) {
|
|
342
357
|
for (const [file, originalSource] of groupedEntries.js) {
|
|
343
|
-
if (originalSource.type
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
if (uniAppX) {
|
|
371
|
-
for (const [file, originalSource] of groupedEntries.js) {
|
|
372
|
-
if (originalSource.type !== "asset") {
|
|
373
|
-
continue;
|
|
374
|
-
}
|
|
358
|
+
if (originalSource.type === "chunk") {
|
|
359
|
+
const absoluteFile = toAbsoluteOutputPath(file, outDir);
|
|
360
|
+
const initialRawSource = originalSource.code;
|
|
361
|
+
jsTaskFactories.push(async () => {
|
|
362
|
+
await processCachedTask({
|
|
363
|
+
cache,
|
|
364
|
+
cacheKey: file,
|
|
365
|
+
rawSource: initialRawSource,
|
|
366
|
+
applyResult(source) {
|
|
367
|
+
originalSource.code = source;
|
|
368
|
+
},
|
|
369
|
+
onCacheHit() {
|
|
370
|
+
debug("js cache hit: %s", file);
|
|
371
|
+
},
|
|
372
|
+
async transform() {
|
|
373
|
+
const rawSource = originalSource.code;
|
|
374
|
+
const { code, linked } = await jsHandler(rawSource, runtimeSet, createHandlerOptions(absoluteFile));
|
|
375
|
+
onUpdate(file, rawSource, code);
|
|
376
|
+
debug("js handle: %s", file);
|
|
377
|
+
applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
|
|
378
|
+
return {
|
|
379
|
+
result: code
|
|
380
|
+
};
|
|
381
|
+
}
|
|
382
|
+
});
|
|
383
|
+
});
|
|
384
|
+
} else if (uniAppX && originalSource.type === "asset") {
|
|
375
385
|
const absoluteFile = toAbsoluteOutputPath(file, outDir);
|
|
376
386
|
const rawSource = originalSource.source.toString();
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
387
|
+
jsTaskFactories.push(async () => {
|
|
388
|
+
await processCachedTask({
|
|
389
|
+
cache,
|
|
390
|
+
cacheKey: file,
|
|
391
|
+
rawSource,
|
|
392
|
+
applyResult(source) {
|
|
393
|
+
originalSource.source = source;
|
|
394
|
+
},
|
|
395
|
+
onCacheHit() {
|
|
396
|
+
debug("js cache hit: %s", file);
|
|
397
|
+
},
|
|
398
|
+
async transform() {
|
|
399
|
+
const currentSource = originalSource.source.toString();
|
|
400
|
+
const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
|
|
401
|
+
uniAppX,
|
|
402
|
+
babelParserOptions: {
|
|
403
|
+
plugins: [
|
|
404
|
+
"typescript"
|
|
405
|
+
],
|
|
406
|
+
sourceType: "unambiguous"
|
|
407
|
+
}
|
|
408
|
+
}));
|
|
409
|
+
onUpdate(file, currentSource, code);
|
|
410
|
+
debug("js handle: %s", file);
|
|
411
|
+
applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
|
|
412
|
+
return {
|
|
413
|
+
result: code
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
});
|
|
405
417
|
});
|
|
406
418
|
}
|
|
407
419
|
}
|
|
@@ -441,7 +453,11 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
441
453
|
);
|
|
442
454
|
}
|
|
443
455
|
}
|
|
456
|
+
pushConcurrentTaskFactories(tasks, jsTaskFactories);
|
|
444
457
|
await Promise.all(tasks);
|
|
458
|
+
for (const apply of pendingLinkedUpdates) {
|
|
459
|
+
apply();
|
|
460
|
+
}
|
|
445
461
|
onEnd();
|
|
446
462
|
debug("end");
|
|
447
463
|
}
|
|
@@ -496,7 +512,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
496
512
|
enforce: "pre",
|
|
497
513
|
async buildStart() {
|
|
498
514
|
await patchPromise;
|
|
499
|
-
runtimeSet = await collectRuntimeClassSet(twPatcher);
|
|
515
|
+
runtimeSet = await collectRuntimeClassSet(twPatcher, { force: true });
|
|
500
516
|
},
|
|
501
517
|
transform(code, id) {
|
|
502
518
|
return transformUVue(code, id, jsHandler, runtimeSet);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.10.0__@swc+core@1.13.5_@swc+h_8e91b94b8823fbc789a279e500560541/node_modules/tsup/assets/cjs_shims.js
|
|
9
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
10
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
exports.__require = __require; exports.importMetaUrl = importMetaUrl;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
2
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
3
|
+
}) : x)(function(x) {
|
|
4
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
5
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
// ../../node_modules/.pnpm/tsup@8.5.0_@microsoft+api-extractor@7.53.1_@types+node@24.10.0__@swc+core@1.13.5_@swc+h_8e91b94b8823fbc789a279e500560541/node_modules/tsup/assets/esm_shims.js
|
|
9
|
+
import path from "path";
|
|
10
|
+
import { fileURLToPath } from "url";
|
|
11
|
+
var getFilename = () => fileURLToPath(import.meta.url);
|
|
12
|
+
var getDirname = () => path.dirname(getFilename());
|
|
13
|
+
var __dirname = /* @__PURE__ */ getDirname();
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
__require,
|
|
17
|
+
__dirname
|
|
18
|
+
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkUW3WHSZ5js = require('./chunk-UW3WHSZ5.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkR7GWRQDJjs = require('./chunk-R7GWRQDJ.js');
|
|
7
7
|
|
|
8
8
|
// src/context/tailwindcss.ts
|
|
9
9
|
var _module = require('module');
|
|
@@ -46,7 +46,7 @@ function resolveModuleFromPaths(specifier, paths) {
|
|
|
46
46
|
return void 0;
|
|
47
47
|
}
|
|
48
48
|
try {
|
|
49
|
-
const req = _module.createRequire.call(void 0,
|
|
49
|
+
const req = _module.createRequire.call(void 0, _chunkR7GWRQDJjs.importMetaUrl);
|
|
50
50
|
return req.resolve(specifier, { paths });
|
|
51
51
|
} catch (e) {
|
|
52
52
|
return void 0;
|
|
@@ -155,11 +155,11 @@ function createDefaultResolvePaths(basedir) {
|
|
|
155
155
|
const cwd = _process2.default.cwd();
|
|
156
156
|
appendNodeModules(paths, cwd);
|
|
157
157
|
try {
|
|
158
|
-
const modulePath = _url.fileURLToPath.call(void 0,
|
|
158
|
+
const modulePath = _url.fileURLToPath.call(void 0, _chunkR7GWRQDJjs.importMetaUrl);
|
|
159
159
|
const candidate = _fs.existsSync.call(void 0, modulePath) && !_path2.default.extname(modulePath) ? modulePath : _path2.default.dirname(modulePath);
|
|
160
160
|
paths.add(candidate);
|
|
161
161
|
} catch (e2) {
|
|
162
|
-
paths.add(
|
|
162
|
+
paths.add(_chunkR7GWRQDJjs.importMetaUrl);
|
|
163
163
|
}
|
|
164
164
|
if (paths.size === 0) {
|
|
165
165
|
fallbackCandidates = fallbackCandidates.filter(Boolean);
|
|
@@ -387,6 +387,12 @@ var ENV_BASEDIR_KEYS = [
|
|
|
387
387
|
"PWD"
|
|
388
388
|
];
|
|
389
389
|
var GENERIC_ENV_BASEDIR_KEYS = /* @__PURE__ */ new Set(["INIT_CWD", "PWD"]);
|
|
390
|
+
function isLegacyTailwindcssPatcherOptions(options) {
|
|
391
|
+
return typeof options === "object" && options !== null && "patch" in options;
|
|
392
|
+
}
|
|
393
|
+
function isModernTailwindcssPatchOptions(options) {
|
|
394
|
+
return typeof options === "object" && options !== null && !("patch" in options);
|
|
395
|
+
}
|
|
390
396
|
function pickEnvBasedir() {
|
|
391
397
|
for (const key of ENV_BASEDIR_KEYS) {
|
|
392
398
|
const value = _process2.default.env[key];
|
|
@@ -545,7 +551,7 @@ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries)
|
|
|
545
551
|
if (!options) {
|
|
546
552
|
return options;
|
|
547
553
|
}
|
|
548
|
-
if (
|
|
554
|
+
if (isLegacyTailwindcssPatcherOptions(options)) {
|
|
549
555
|
const patchOptions = options.patch;
|
|
550
556
|
if (!patchOptions) {
|
|
551
557
|
return options;
|
|
@@ -570,6 +576,9 @@ function overrideTailwindcssPatcherOptionsForBase(options, baseDir, cssEntries)
|
|
|
570
576
|
patch: nextPatch
|
|
571
577
|
};
|
|
572
578
|
}
|
|
579
|
+
if (!isModernTailwindcssPatchOptions(options)) {
|
|
580
|
+
return options;
|
|
581
|
+
}
|
|
573
582
|
if (!options.tailwind) {
|
|
574
583
|
return options;
|
|
575
584
|
}
|