weapp-tailwindcss 4.7.0 → 4.7.2

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.
Files changed (39) hide show
  1. package/dist/{chunk-Q5TPAJI4.js → chunk-2SI3KT2H.js} +7 -6
  2. package/dist/{chunk-IY2OKZE6.mjs → chunk-3ARXMTWC.mjs} +21 -8
  3. package/dist/{chunk-D7SF52F6.mjs → chunk-5BW6X6AJ.mjs} +42 -36
  4. package/dist/chunk-667CYXAH.mjs +133 -0
  5. package/dist/chunk-BUMQQPAO.js +133 -0
  6. package/dist/{chunk-W3JU6K3T.js → chunk-FPDJ3BCM.js} +260 -108
  7. package/dist/{chunk-BAXZHBSU.js → chunk-GNWJEIZZ.js} +92 -77
  8. package/dist/{chunk-7TKAJ3P6.mjs → chunk-JYCQWWYU.mjs} +257 -105
  9. package/dist/{chunk-NRG7N2Q7.mjs → chunk-KZJLIZIK.mjs} +0 -1
  10. package/dist/{chunk-34T2BFTJ.mjs → chunk-KZUIVLPP.mjs} +42 -1
  11. package/dist/{chunk-C3CG4UUY.js → chunk-OPTIAB5G.js} +21 -8
  12. package/dist/{chunk-BTOCLUJ4.mjs → chunk-Q6PLZCM6.mjs} +6 -5
  13. package/dist/{chunk-CCMDCC3N.js → chunk-QZRXYCOQ.js} +49 -43
  14. package/dist/{chunk-WVKK6TBL.js → chunk-W7BVY5S5.js} +42 -1
  15. package/dist/{chunk-LZ6L3UQO.js → chunk-WXBFAARR.js} +0 -1
  16. package/dist/{chunk-KSXOBEXQ.mjs → chunk-Z2H7M33Z.mjs} +83 -68
  17. package/dist/cli.js +6 -6
  18. package/dist/cli.mjs +3 -3
  19. package/dist/core.js +10 -9
  20. package/dist/core.mjs +10 -9
  21. package/dist/defaults.js +2 -2
  22. package/dist/defaults.mjs +1 -1
  23. package/dist/gulp.js +6 -6
  24. package/dist/gulp.mjs +5 -5
  25. package/dist/index.js +9 -9
  26. package/dist/index.mjs +8 -8
  27. package/dist/presets.js +2 -2
  28. package/dist/presets.mjs +1 -1
  29. package/dist/types.d.mts +2 -21
  30. package/dist/types.d.ts +2 -21
  31. package/dist/vite.js +7 -7
  32. package/dist/vite.mjs +6 -6
  33. package/dist/webpack.js +7 -7
  34. package/dist/webpack.mjs +6 -6
  35. package/dist/webpack4.js +51 -45
  36. package/dist/webpack4.mjs +44 -38
  37. package/package.json +4 -4
  38. package/dist/chunk-FB5P4TRH.js +0 -70
  39. 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
- var _chunkWVKK6TBLjs = require('./chunk-WVKK6TBL.js');
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
- var _chunkFB5P4TRHjs = require('./chunk-FB5P4TRH.js');
12
+
13
+ var _chunkBUMQQPAOjs = require('./chunk-BUMQQPAO.js');
12
14
 
13
15
 
14
16
 
15
17
 
16
- var _chunkW3JU6K3Tjs = require('./chunk-W3JU6K3T.js');
18
+ var _chunkFPDJ3BCMjs = require('./chunk-FPDJ3BCM.js');
17
19
 
18
20
 
19
21
  var _chunkDWAEHRHNjs = require('./chunk-DWAEHRHN.js');
@@ -51,7 +53,7 @@ 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 = _chunkW3JU6K3Tjs.generateCode.call(void 0, prop.exp.content, {
56
+ const generated = _chunkFPDJ3BCMjs.generateCode.call(void 0, prop.exp.content, {
55
57
  jsHandler,
56
58
  runtimeSet
57
59
  });
@@ -171,7 +173,7 @@ async function formatPostcssSourceMap(rawMap, file) {
171
173
  }
172
174
 
173
175
  // src/bundlers/vite/index.ts
174
- var debug = _chunkFB5P4TRHjs.createDebug.call(void 0, );
176
+ var debug = _chunkBUMQQPAOjs.createDebug.call(void 0, );
175
177
  function readOutputEntry(entry) {
176
178
  if (entry.output.type === "chunk") {
177
179
  return entry.output.code;
@@ -201,7 +203,7 @@ function isJavaScriptEntry(entry) {
201
203
  function createBundleModuleGraphOptions(outputDir, entries) {
202
204
  return {
203
205
  resolve(specifier, importer) {
204
- return _chunkWVKK6TBLjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
206
+ return _chunkW7BVY5S5js.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
205
207
  },
206
208
  load(id) {
207
209
  const entry = entries.get(id);
@@ -215,7 +217,7 @@ function createBundleModuleGraphOptions(outputDir, entries) {
215
217
  }
216
218
  };
217
219
  }
218
- function applyLinkedResults(linked, entries, onLinkedUpdate) {
220
+ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
219
221
  if (!linked) {
220
222
  return;
221
223
  }
@@ -233,11 +235,12 @@ function applyLinkedResults(linked, entries, onLinkedUpdate) {
233
235
  } else {
234
236
  entry.output.source = code;
235
237
  }
238
+ _optionalChain([onApplied, 'optionalCall', _7 => _7(entry, code)]);
236
239
  onLinkedUpdate(entry.fileName, previous, code);
237
240
  }
238
241
  }
239
242
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
240
- const opts = _chunkW3JU6K3Tjs.getCompilerContext.call(void 0, options);
243
+ const opts = _chunkFPDJ3BCMjs.getCompilerContext.call(void 0, options);
241
244
  const {
242
245
  disabled,
243
246
  onEnd,
@@ -256,13 +259,13 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
256
259
  if (disabled) {
257
260
  return;
258
261
  }
259
- const patchPromise = Promise.resolve(twPatcher.patch());
262
+ const patchPromise = _chunkBUMQQPAOjs.createTailwindPatchPromise.call(void 0, twPatcher);
260
263
  let runtimeSet;
261
264
  let resolvedConfig;
262
265
  onLoad();
263
266
  const plugins = [
264
267
  {
265
- name: `${_chunkW3JU6K3Tjs.vitePluginName}:post`,
268
+ name: `${_chunkFPDJ3BCMjs.vitePluginName}:post`,
266
269
  enforce: "post",
267
270
  configResolved(config) {
268
271
  resolvedConfig = config;
@@ -282,30 +285,40 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
282
285
  debug("start");
283
286
  onStart();
284
287
  const entries = Object.entries(bundle);
285
- const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _7 => _7.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
286
- const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _8 => _8.build, 'optionalAccess', _9 => _9.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
288
+ const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _8 => _8.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
289
+ const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _9 => _9.build, 'optionalAccess', _10 => _10.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
287
290
  const jsEntries = /* @__PURE__ */ new Map();
288
291
  for (const [fileName, output] of entries) {
289
292
  const entry = { fileName, output };
290
293
  if (isJavaScriptEntry(entry)) {
291
- const absolute = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
294
+ const absolute = _chunkW7BVY5S5js.toAbsoluteOutputPath.call(void 0, fileName, outDir);
292
295
  jsEntries.set(absolute, entry);
293
296
  }
294
297
  }
295
298
  const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
296
299
  const groupedEntries = _chunkUW3WHSZ5js.getGroupedEntries.call(void 0, entries, opts);
297
- runtimeSet = await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
300
+ runtimeSet = await _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: true });
298
301
  debug("get runtimeSet, class count: %d", runtimeSet.size);
299
302
  const handleLinkedUpdate = (fileName, previous, next) => {
300
303
  onUpdate(fileName, previous, next);
301
304
  debug("js linked handle: %s", fileName);
302
305
  };
306
+ const pendingLinkedUpdates = [];
307
+ const scheduleLinkedApply = (entry, code) => {
308
+ pendingLinkedUpdates.push(() => {
309
+ if (entry.output.type === "chunk") {
310
+ entry.output.code = code;
311
+ } else {
312
+ entry.output.source = code;
313
+ }
314
+ });
315
+ };
303
316
  const createHandlerOptions = (absoluteFilename, extra) => ({
304
317
  ...extra,
305
318
  filename: absoluteFilename,
306
319
  moduleGraph: moduleGraphOptions,
307
320
  babelParserOptions: {
308
- ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _10 => _10.babelParserOptions]), () => ( {})),
321
+ ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _11 => _11.babelParserOptions]), () => ( {})),
309
322
  sourceFilename: absoluteFilename
310
323
  }
311
324
  });
@@ -338,70 +351,68 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
338
351
  );
339
352
  }
340
353
  }
354
+ const jsTaskFactories = [];
341
355
  if (Array.isArray(groupedEntries.js)) {
342
356
  for (const [file, originalSource] of groupedEntries.js) {
343
- if (originalSource.type !== "chunk") {
344
- continue;
345
- }
346
- const absoluteFile = _chunkWVKK6TBLjs.toAbsoluteOutputPath.call(void 0, file, outDir);
347
- const initialRawSource = originalSource.code;
348
- await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
349
- cache,
350
- cacheKey: file,
351
- rawSource: initialRawSource,
352
- applyResult(source) {
353
- originalSource.code = source;
354
- },
355
- onCacheHit() {
356
- debug("js cache hit: %s", file);
357
- },
358
- async transform() {
359
- const rawSource = originalSource.code;
360
- const { code, linked } = await jsHandler(rawSource, runtimeSet, createHandlerOptions(absoluteFile));
361
- onUpdate(file, rawSource, code);
362
- debug("js handle: %s", file);
363
- applyLinkedResults(linked, jsEntries, handleLinkedUpdate);
364
- return {
365
- result: code
366
- };
367
- }
368
- });
369
- }
370
- if (uniAppX) {
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);
357
+ if (originalSource.type === "chunk") {
358
+ const absoluteFile = _chunkW7BVY5S5js.toAbsoluteOutputPath.call(void 0, file, outDir);
359
+ const initialRawSource = originalSource.code;
360
+ jsTaskFactories.push(async () => {
361
+ await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
362
+ cache,
363
+ cacheKey: file,
364
+ rawSource: initialRawSource,
365
+ applyResult(source) {
366
+ originalSource.code = source;
367
+ },
368
+ onCacheHit() {
369
+ debug("js cache hit: %s", file);
370
+ },
371
+ async transform() {
372
+ const rawSource = originalSource.code;
373
+ const { code, linked } = await jsHandler(rawSource, runtimeSet, createHandlerOptions(absoluteFile));
374
+ onUpdate(file, rawSource, code);
375
+ debug("js handle: %s", file);
376
+ applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
377
+ return {
378
+ result: code
379
+ };
380
+ }
381
+ });
382
+ });
383
+ } else if (uniAppX && originalSource.type === "asset") {
384
+ const absoluteFile = _chunkW7BVY5S5js.toAbsoluteOutputPath.call(void 0, file, outDir);
376
385
  const rawSource = originalSource.source.toString();
377
- await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
378
- cache,
379
- cacheKey: file,
380
- rawSource,
381
- applyResult(source) {
382
- originalSource.source = source;
383
- },
384
- onCacheHit() {
385
- debug("js cache hit: %s", file);
386
- },
387
- async transform() {
388
- const currentSource = originalSource.source.toString();
389
- const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
390
- uniAppX,
391
- babelParserOptions: {
392
- plugins: [
393
- "typescript"
394
- ],
395
- sourceType: "unambiguous"
396
- }
397
- }));
398
- onUpdate(file, currentSource, code);
399
- debug("js handle: %s", file);
400
- applyLinkedResults(linked, jsEntries, handleLinkedUpdate);
401
- return {
402
- result: code
403
- };
404
- }
386
+ jsTaskFactories.push(async () => {
387
+ await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
388
+ cache,
389
+ cacheKey: file,
390
+ rawSource,
391
+ applyResult(source) {
392
+ originalSource.source = source;
393
+ },
394
+ onCacheHit() {
395
+ debug("js cache hit: %s", file);
396
+ },
397
+ async transform() {
398
+ const currentSource = originalSource.source.toString();
399
+ const { code, linked } = await jsHandler(currentSource, runtimeSet, createHandlerOptions(absoluteFile, {
400
+ uniAppX,
401
+ babelParserOptions: {
402
+ plugins: [
403
+ "typescript"
404
+ ],
405
+ sourceType: "unambiguous"
406
+ }
407
+ }));
408
+ onUpdate(file, currentSource, code);
409
+ debug("js handle: %s", file);
410
+ applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
411
+ return {
412
+ result: code
413
+ };
414
+ }
415
+ });
405
416
  });
406
417
  }
407
418
  }
@@ -441,7 +452,11 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
441
452
  );
442
453
  }
443
454
  }
455
+ _chunkW7BVY5S5js.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
444
456
  await Promise.all(tasks);
457
+ for (const apply of pendingLinkedUpdates) {
458
+ apply();
459
+ }
445
460
  onEnd();
446
461
  debug("end");
447
462
  }
@@ -496,7 +511,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
496
511
  enforce: "pre",
497
512
  async buildStart() {
498
513
  await patchPromise;
499
- runtimeSet = await _chunkFB5P4TRHjs.collectRuntimeClassSet.call(void 0, twPatcher);
514
+ runtimeSet = await _chunkBUMQQPAOjs.collectRuntimeClassSet.call(void 0, twPatcher, { force: true });
500
515
  },
501
516
  transform(code, id) {
502
517
  return transformUVue(code, id, jsHandler, runtimeSet);