weapp-tailwindcss 4.9.2 → 4.9.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.
Files changed (54) hide show
  1. package/dist/{chunk-DNRNFN4I.js → chunk-3UOPODB3.js} +44 -44
  2. package/dist/{chunk-2L6NDZIQ.mjs → chunk-4HESZS5A.mjs} +2 -2
  3. package/dist/{chunk-5O6237HX.js → chunk-4RUFPPI6.js} +400 -377
  4. package/dist/{chunk-ZE7JKKFT.mjs → chunk-7D27E7TU.mjs} +438 -415
  5. package/dist/{chunk-W3MTTQ5M.js → chunk-A2BRI46M.js} +5 -5
  6. package/dist/{chunk-3SKEY32E.mjs → chunk-F2CKKG6Q.mjs} +67 -67
  7. package/dist/{chunk-VU2GIXVH.js → chunk-I3IRT5VH.js} +7 -7
  8. package/dist/chunk-IMOEZLDR.js +441 -0
  9. package/dist/{chunk-WGBJY2H3.mjs → chunk-IW3B6ZJD.mjs} +646 -565
  10. package/dist/{chunk-U7BH6QHE.js → chunk-KXZ4MP4L.js} +277 -236
  11. package/dist/chunk-PU5CC4ZI.mjs +444 -0
  12. package/dist/{chunk-FFGR5V3H.mjs → chunk-SPH6SCTM.mjs} +1 -1
  13. package/dist/{chunk-XXJNXESJ.js → chunk-VOD2WUH6.js} +635 -554
  14. package/dist/{chunk-2WPTDMN3.js → chunk-VPHA77FH.js} +61 -61
  15. package/dist/{chunk-CBOVUIXD.mjs → chunk-WH65CIYG.mjs} +41 -41
  16. package/dist/{chunk-UAEME5HT.js → chunk-Y6F6NBA7.js} +1 -1
  17. package/dist/{chunk-DSD5JRCQ.mjs → chunk-Z2D5NSG5.mjs} +265 -224
  18. package/dist/{chunk-G5OV7IOU.mjs → chunk-ZL22KEHH.mjs} +2 -2
  19. package/dist/cli.js +182 -136
  20. package/dist/cli.mjs +194 -148
  21. package/dist/core.js +10 -10
  22. package/dist/core.mjs +4 -4
  23. package/dist/css-macro/postcss.js +1 -1
  24. package/dist/css-macro/postcss.mjs +1 -1
  25. package/dist/css-macro.js +1 -1
  26. package/dist/css-macro.mjs +1 -1
  27. package/dist/defaults.js +1 -1
  28. package/dist/defaults.mjs +1 -1
  29. package/dist/gulp.js +6 -6
  30. package/dist/gulp.mjs +5 -5
  31. package/dist/index.js +10 -10
  32. package/dist/index.mjs +9 -9
  33. package/dist/postcss-html-transform.js +1 -1
  34. package/dist/postcss-html-transform.mjs +1 -1
  35. package/dist/presets.js +5 -5
  36. package/dist/presets.mjs +2 -2
  37. package/dist/reset.d.mts +2 -1
  38. package/dist/reset.d.ts +2 -1
  39. package/dist/reset.js +25 -21
  40. package/dist/reset.mjs +25 -21
  41. package/dist/types.d.mts +503 -474
  42. package/dist/types.d.ts +503 -474
  43. package/dist/types.js +1 -1
  44. package/dist/types.mjs +1 -1
  45. package/dist/vite.js +7 -7
  46. package/dist/vite.mjs +6 -6
  47. package/dist/weapp-tw-css-import-rewrite-loader.js +2 -4
  48. package/dist/webpack.js +8 -8
  49. package/dist/webpack.mjs +7 -7
  50. package/dist/webpack4.js +351 -307
  51. package/dist/webpack4.mjs +341 -297
  52. package/package.json +10 -10
  53. package/dist/chunk-5AKI6FQP.mjs +0 -397
  54. package/dist/chunk-SNEMGP42.js +0 -394
@@ -6,13 +6,13 @@
6
6
 
7
7
 
8
8
 
9
- var _chunk2WPTDMN3js = require('./chunk-2WPTDMN3.js');
9
+ var _chunkVPHA77FHjs = require('./chunk-VPHA77FH.js');
10
10
 
11
11
 
12
12
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
13
13
 
14
14
 
15
- var _chunkW3MTTQ5Mjs = require('./chunk-W3MTTQ5M.js');
15
+ var _chunkA2BRI46Mjs = require('./chunk-A2BRI46M.js');
16
16
 
17
17
 
18
18
 
@@ -23,15 +23,13 @@ var _chunkW3MTTQ5Mjs = require('./chunk-W3MTTQ5M.js');
23
23
 
24
24
 
25
25
 
26
- var _chunkXXJNXESJjs = require('./chunk-XXJNXESJ.js');
26
+ var _chunkVOD2WUH6js = require('./chunk-VOD2WUH6.js');
27
27
 
28
28
 
29
29
 
30
30
  var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
31
31
 
32
32
  // src/bundlers/vite/index.ts
33
- var _buffer = require('buffer');
34
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
35
33
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
36
34
  var _htmltransform = require('@weapp-tailwindcss/postcss/html-transform'); var _htmltransform2 = _interopRequireDefault(_htmltransform);
37
35
 
@@ -56,7 +54,7 @@ function updateStaticAttribute(ms, prop) {
56
54
  const start = prop.value.loc.start.offset + 1;
57
55
  const end = prop.value.loc.end.offset - 1;
58
56
  if (start < end) {
59
- ms.update(start, end, _chunkXXJNXESJjs.replaceWxml.call(void 0, prop.value.content));
57
+ ms.update(start, end, _chunkVOD2WUH6js.replaceWxml.call(void 0, prop.value.content));
60
58
  }
61
59
  }
62
60
  function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
@@ -68,7 +66,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
68
66
  if (start >= end) {
69
67
  return;
70
68
  }
71
- const generated = _chunkXXJNXESJjs.generateCode.call(void 0, prop.exp.content, {
69
+ const generated = _chunkVOD2WUH6js.generateCode.call(void 0, prop.exp.content, {
72
70
  jsHandler,
73
71
  runtimeSet,
74
72
  wrapExpression: true
@@ -97,7 +95,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
97
95
  return;
98
96
  }
99
97
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
100
- const matchCustomAttribute = _chunkXXJNXESJjs.createAttributeMatcher.call(void 0, customAttributesEntities);
98
+ const matchCustomAttribute = _chunkVOD2WUH6js.createAttributeMatcher.call(void 0, customAttributesEntities);
101
99
  const ms = new (0, _magicstring2.default)(code);
102
100
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
103
101
  if (errors.length === 0) {
@@ -188,10 +186,11 @@ function parseVueRequest(id) {
188
186
  }
189
187
 
190
188
  // src/bundlers/vite/utils.ts
189
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
191
190
 
192
-
191
+ var _shared = require('@weapp-tailwindcss/shared');
193
192
  function slash(p) {
194
- return p.replace(/\\/g, "/");
193
+ return _shared.ensurePosix.call(void 0, p);
195
194
  }
196
195
  var isWindows = _process2.default.platform === "win32";
197
196
  var cssLangs = `\\.(css|less|sass|scss|styl|stylus|pcss|postcss)($|\\?)`;
@@ -200,16 +199,12 @@ function isCSSRequest(request) {
200
199
  return cssLangRE.test(request);
201
200
  }
202
201
  function normalizePath(id) {
203
- return _path2.default.posix.normalize(isWindows ? slash(id) : id);
204
- }
205
- var postfixRE = /[?#].*$/;
206
- function cleanUrl(url) {
207
- return url.replace(postfixRE, "");
202
+ return _path2.default.posix.normalize(isWindows ? _shared.ensurePosix.call(void 0, id) : id);
208
203
  }
209
204
  async function formatPostcssSourceMap(rawMap, file) {
210
205
  const inputFileDir = _path2.default.dirname(file);
211
206
  const sources = rawMap.sources.map((source) => {
212
- const cleanSource = cleanUrl(decodeURIComponent(source));
207
+ const cleanSource = _shared.cleanUrl.call(void 0, decodeURIComponent(source));
213
208
  if (cleanSource[0] === "<" && cleanSource.endsWith(">")) {
214
209
  return `\0${cleanSource}`;
215
210
  }
@@ -273,7 +268,7 @@ function createUniAppXPlugins(options) {
273
268
  const rawPostcssMap = postcssResult.map.toJSON();
274
269
  const postcssMap = await formatPostcssSourceMap(
275
270
  rawPostcssMap,
276
- cleanUrl(id)
271
+ _shared.cleanUrl.call(void 0, id)
277
272
  );
278
273
  return {
279
274
  code: postcssResult.css,
@@ -364,7 +359,7 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
364
359
  runtimeSet,
365
360
  applyLinkedResults: applyLinkedResults2
366
361
  } = options;
367
- const absoluteFile = _chunk2WPTDMN3js.toAbsoluteOutputPath.call(void 0, file, outDir);
362
+ const absoluteFile = _chunkVPHA77FHjs.toAbsoluteOutputPath.call(void 0, file, outDir);
368
363
  const rawSource = originalSource.source.toString();
369
364
  await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
370
365
  cache,
@@ -398,23 +393,12 @@ function createUniAppXAssetTask(file, originalSource, outDir, options) {
398
393
  };
399
394
  }
400
395
 
401
- // src/bundlers/vite/index.ts
402
- var debug = _chunkXXJNXESJjs.createDebug.call(void 0, );
403
- var weappTailwindcssPackageDir = _chunk2WPTDMN3js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
404
- var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
405
- function joinPosixPath(base, subpath) {
406
- if (base.endsWith("/")) {
407
- return `${base}${subpath}`;
408
- }
409
- return `${base}/${subpath}`;
410
- }
411
- function isCssLikeImporter(importer) {
412
- if (!importer) {
413
- return false;
414
- }
415
- const normalized = cleanUrl(importer);
416
- return isCSSRequest(normalized);
417
- }
396
+ // src/bundlers/vite/generate-bundle.ts
397
+
398
+
399
+
400
+ // src/bundlers/vite/bundle-entries.ts
401
+ var _buffer = require('buffer');
418
402
  function readOutputEntry(entry) {
419
403
  if (entry.output.type === "chunk") {
420
404
  return entry.output.code;
@@ -444,7 +428,7 @@ function isJavaScriptEntry(entry) {
444
428
  function createBundleModuleGraphOptions(outputDir, entries) {
445
429
  return {
446
430
  resolve(specifier, importer) {
447
- return _chunk2WPTDMN3js.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
431
+ return _chunkVPHA77FHjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => entries.has(candidate));
448
432
  },
449
433
  load(id) {
450
434
  const entry = entries.get(id);
@@ -480,38 +464,225 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
480
464
  onLinkedUpdate(entry.fileName, previous, code);
481
465
  }
482
466
  }
483
- function UnifiedViteWeappTailwindcssPlugin(options = {}) {
484
- const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
485
- const opts = _chunkXXJNXESJjs.getCompilerContext.call(void 0, options);
486
- const {
487
- disabled,
488
- customAttributes,
489
- onEnd,
490
- onLoad,
491
- onStart,
492
- onUpdate,
493
- templateHandler,
494
- styleHandler,
495
- jsHandler,
496
- mainCssChunkMatcher,
497
- appType,
498
- cache,
499
- twPatcher: initialTwPatcher,
500
- refreshTailwindcssPatcher,
501
- uniAppX,
502
- disabledDefaultTemplateHandler
503
- } = opts;
504
- const disabledOptions = _chunk2WPTDMN3js.resolveDisabledOptions.call(void 0, disabled);
505
- const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
506
- const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
507
- const rewritePlugins = !shouldRewriteCssImports ? [] : [
467
+
468
+ // src/bundlers/vite/generate-bundle.ts
469
+ function createGenerateBundleHook(context) {
470
+ return async function generateBundle(_opt, bundle) {
471
+ const {
472
+ opts,
473
+ runtimeState,
474
+ ensureRuntimeClassSet,
475
+ debug: debug2,
476
+ getResolvedConfig
477
+ } = context;
478
+ const {
479
+ appType,
480
+ cache,
481
+ mainCssChunkMatcher,
482
+ onEnd,
483
+ onStart,
484
+ onUpdate,
485
+ styleHandler,
486
+ templateHandler,
487
+ jsHandler,
488
+ uniAppX
489
+ } = opts;
490
+ await runtimeState.patchPromise;
491
+ debug2("start");
492
+ onStart();
493
+ const entries = Object.entries(bundle);
494
+ const resolvedConfig = getResolvedConfig();
495
+ const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _22 => _22.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
496
+ const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _23 => _23.build, 'optionalAccess', _24 => _24.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
497
+ const jsEntries = /* @__PURE__ */ new Map();
498
+ for (const [fileName, output] of entries) {
499
+ const entry = { fileName, output };
500
+ if (isJavaScriptEntry(entry)) {
501
+ const absolute = _chunkVPHA77FHjs.toAbsoluteOutputPath.call(void 0, fileName, outDir);
502
+ jsEntries.set(absolute, entry);
503
+ }
504
+ }
505
+ const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
506
+ const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, opts);
507
+ const runtime = await ensureRuntimeClassSet(true);
508
+ debug2("get runtimeSet, class count: %d", runtime.size);
509
+ const handleLinkedUpdate = (fileName, previous, next) => {
510
+ onUpdate(fileName, previous, next);
511
+ debug2("js linked handle: %s", fileName);
512
+ };
513
+ const pendingLinkedUpdates = [];
514
+ const scheduleLinkedApply = (entry, code) => {
515
+ pendingLinkedUpdates.push(() => {
516
+ if (entry.output.type === "chunk") {
517
+ entry.output.code = code;
518
+ } else {
519
+ entry.output.source = code;
520
+ }
521
+ });
522
+ };
523
+ const applyLinkedUpdates = (linked) => {
524
+ applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
525
+ };
526
+ const createHandlerOptions = (absoluteFilename, extra) => ({
527
+ ...extra,
528
+ filename: absoluteFilename,
529
+ moduleGraph: moduleGraphOptions,
530
+ babelParserOptions: {
531
+ ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _25 => _25.babelParserOptions]), () => ( {})),
532
+ sourceFilename: absoluteFilename
533
+ }
534
+ });
535
+ const tasks = [];
536
+ if (Array.isArray(groupedEntries.html)) {
537
+ for (const [file, originalSource] of groupedEntries.html) {
538
+ const rawSource = originalSource.source.toString();
539
+ tasks.push(
540
+ _chunkLTJQUORKjs.processCachedTask.call(void 0, {
541
+ cache,
542
+ cacheKey: file,
543
+ rawSource,
544
+ applyResult(source) {
545
+ originalSource.source = source;
546
+ },
547
+ onCacheHit() {
548
+ debug2("html cache hit: %s", file);
549
+ },
550
+ async transform() {
551
+ const transformed = await templateHandler(rawSource, {
552
+ runtimeSet: runtime
553
+ });
554
+ onUpdate(file, rawSource, transformed);
555
+ debug2("html handle: %s", file);
556
+ return {
557
+ result: transformed
558
+ };
559
+ }
560
+ })
561
+ );
562
+ }
563
+ }
564
+ const jsTaskFactories = [];
565
+ if (Array.isArray(groupedEntries.js)) {
566
+ for (const [file, originalSource] of groupedEntries.js) {
567
+ if (originalSource.type === "chunk") {
568
+ const absoluteFile = _chunkVPHA77FHjs.toAbsoluteOutputPath.call(void 0, file, outDir);
569
+ const initialRawSource = originalSource.code;
570
+ jsTaskFactories.push(async () => {
571
+ await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
572
+ cache,
573
+ cacheKey: file,
574
+ rawSource: initialRawSource,
575
+ applyResult(source) {
576
+ originalSource.code = source;
577
+ },
578
+ onCacheHit() {
579
+ debug2("js cache hit: %s", file);
580
+ },
581
+ async transform() {
582
+ const rawSource = originalSource.code;
583
+ const { code, linked } = await jsHandler(rawSource, runtime, createHandlerOptions(absoluteFile));
584
+ onUpdate(file, rawSource, code);
585
+ debug2("js handle: %s", file);
586
+ applyLinkedUpdates(linked);
587
+ return {
588
+ result: code
589
+ };
590
+ }
591
+ });
592
+ });
593
+ } else if (uniAppX && originalSource.type === "asset") {
594
+ jsTaskFactories.push(
595
+ createUniAppXAssetTask(
596
+ file,
597
+ originalSource,
598
+ outDir,
599
+ {
600
+ cache,
601
+ createHandlerOptions,
602
+ debug: debug2,
603
+ jsHandler,
604
+ onUpdate,
605
+ runtimeSet: runtime,
606
+ applyLinkedResults: applyLinkedUpdates,
607
+ uniAppX
608
+ }
609
+ )
610
+ );
611
+ }
612
+ }
613
+ }
614
+ if (Array.isArray(groupedEntries.css)) {
615
+ for (const [file, originalSource] of groupedEntries.css) {
616
+ const rawSource = originalSource.source.toString();
617
+ tasks.push(
618
+ _chunkLTJQUORKjs.processCachedTask.call(void 0, {
619
+ cache,
620
+ cacheKey: file,
621
+ rawSource,
622
+ applyResult(source) {
623
+ originalSource.source = source;
624
+ },
625
+ onCacheHit() {
626
+ debug2("css cache hit: %s", file);
627
+ },
628
+ async transform() {
629
+ await runtimeState.patchPromise;
630
+ const { css } = await styleHandler(rawSource, {
631
+ isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
632
+ postcssOptions: {
633
+ options: {
634
+ from: file
635
+ }
636
+ },
637
+ majorVersion: runtimeState.twPatcher.majorVersion
638
+ });
639
+ onUpdate(file, rawSource, css);
640
+ debug2("css handle: %s", file);
641
+ return {
642
+ result: css
643
+ };
644
+ }
645
+ })
646
+ );
647
+ }
648
+ }
649
+ _chunkVPHA77FHjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
650
+ await Promise.all(tasks);
651
+ for (const apply of pendingLinkedUpdates) {
652
+ apply();
653
+ }
654
+ onEnd();
655
+ debug2("end");
656
+ };
657
+ }
658
+
659
+ // src/bundlers/vite/rewrite-css-imports.ts
660
+ function joinPosixPath(base, subpath) {
661
+ if (base.endsWith("/")) {
662
+ return `${base}${subpath}`;
663
+ }
664
+ return `${base}/${subpath}`;
665
+ }
666
+ function isCssLikeImporter(importer) {
667
+ if (!importer) {
668
+ return false;
669
+ }
670
+ const normalized = _shared.cleanUrl.call(void 0, importer);
671
+ return isCSSRequest(normalized);
672
+ }
673
+ function createRewriteCssImportsPlugins(options) {
674
+ if (!options.shouldRewrite) {
675
+ return [];
676
+ }
677
+ const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
678
+ return [
508
679
  {
509
- name: `${_chunkXXJNXESJjs.vitePluginName}:rewrite-css-imports`,
680
+ name: `${_chunkVOD2WUH6js.vitePluginName}:rewrite-css-imports`,
510
681
  enforce: "pre",
511
682
  resolveId: {
512
683
  order: "pre",
513
684
  handler(id, importer) {
514
- const replacement = _chunk2WPTDMN3js.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix, {
685
+ const replacement = _chunkVPHA77FHjs.resolveTailwindcssImport.call(void 0, id, weappTailwindcssDirPosix2, {
515
686
  join: joinPosixPath,
516
687
  appType
517
688
  });
@@ -530,7 +701,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
530
701
  if (!isCSSRequest(id)) {
531
702
  return null;
532
703
  }
533
- const rewritten = _chunk2WPTDMN3js.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix, {
704
+ const rewritten = _chunkVPHA77FHjs.rewriteTailwindcssImportsInCode.call(void 0, code, weappTailwindcssDirPosix2, {
534
705
  join: joinPosixPath,
535
706
  appType
536
707
  });
@@ -545,11 +716,41 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
545
716
  }
546
717
  }
547
718
  ];
719
+ }
720
+
721
+ // src/bundlers/vite/index.ts
722
+ var debug = _chunkVOD2WUH6js.createDebug.call(void 0, );
723
+ var weappTailwindcssPackageDir = _chunkVPHA77FHjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
724
+ var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
725
+ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
726
+ const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
727
+ const opts = _chunkVOD2WUH6js.getCompilerContext.call(void 0, options);
728
+ const {
729
+ disabled,
730
+ customAttributes,
731
+ onLoad,
732
+ mainCssChunkMatcher,
733
+ appType,
734
+ styleHandler,
735
+ jsHandler,
736
+ twPatcher: initialTwPatcher,
737
+ refreshTailwindcssPatcher,
738
+ uniAppX,
739
+ disabledDefaultTemplateHandler
740
+ } = opts;
741
+ const disabledOptions = _chunkVPHA77FHjs.resolveDisabledOptions.call(void 0, disabled);
742
+ const tailwindcssMajorVersion = _nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0));
743
+ const shouldRewriteCssImports = opts.rewriteCssImports !== false && !disabledOptions.rewriteCssImports && (rewriteCssImportsSpecified || tailwindcssMajorVersion >= 4);
744
+ const rewritePlugins = createRewriteCssImportsPlugins({
745
+ appType,
746
+ shouldRewrite: shouldRewriteCssImports,
747
+ weappTailwindcssDirPosix
748
+ });
548
749
  if (disabledOptions.plugin) {
549
750
  return rewritePlugins.length ? rewritePlugins : void 0;
550
751
  }
551
- const customAttributesEntities = _chunkXXJNXESJjs.toCustomAttributesEntities.call(void 0, customAttributes);
552
- const patchRecorderState = _chunkW3MTTQ5Mjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
752
+ const customAttributesEntities = _chunkVOD2WUH6js.toCustomAttributesEntities.call(void 0, customAttributes);
753
+ const patchRecorderState = _chunkA2BRI46Mjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
553
754
  source: "runtime",
554
755
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
555
756
  });
@@ -563,7 +764,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
563
764
  let runtimeSetPromise;
564
765
  let resolvedConfig;
565
766
  async function refreshRuntimeState(force) {
566
- const refreshed = await _chunkXXJNXESJjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
767
+ const refreshed = await _chunkVOD2WUH6js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
567
768
  if (refreshed) {
568
769
  runtimeSet = void 0;
569
770
  runtimeSetPromise = void 0;
@@ -576,7 +777,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
576
777
  return runtimeSet;
577
778
  }
578
779
  if (force || !runtimeSetPromise) {
579
- const task2 = _chunkXXJNXESJjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
780
+ const task2 = _chunkVOD2WUH6js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
580
781
  force: force || !runtimeSet,
581
782
  skipRefresh: force
582
783
  });
@@ -611,7 +812,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
611
812
  const plugins = [
612
813
  ...rewritePlugins,
613
814
  {
614
- name: `${_chunkXXJNXESJjs.vitePluginName}:post`,
815
+ name: `${_chunkVOD2WUH6js.vitePluginName}:post`,
615
816
  enforce: "post",
616
817
  configResolved(config) {
617
818
  resolvedConfig = config;
@@ -626,173 +827,13 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
626
827
  }
627
828
  }
628
829
  },
629
- async generateBundle(_opt, bundle) {
630
- await runtimeState.patchPromise;
631
- debug("start");
632
- onStart();
633
- const entries = Object.entries(bundle);
634
- const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _22 => _22.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
635
- const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _23 => _23.build, 'optionalAccess', _24 => _24.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
636
- const jsEntries = /* @__PURE__ */ new Map();
637
- for (const [fileName, output] of entries) {
638
- const entry = { fileName, output };
639
- if (isJavaScriptEntry(entry)) {
640
- const absolute = _chunk2WPTDMN3js.toAbsoluteOutputPath.call(void 0, fileName, outDir);
641
- jsEntries.set(absolute, entry);
642
- }
643
- }
644
- const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
645
- const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, opts);
646
- const runtime = await ensureRuntimeClassSet(true);
647
- debug("get runtimeSet, class count: %d", runtime.size);
648
- const handleLinkedUpdate = (fileName, previous, next) => {
649
- onUpdate(fileName, previous, next);
650
- debug("js linked handle: %s", fileName);
651
- };
652
- const pendingLinkedUpdates = [];
653
- const scheduleLinkedApply = (entry, code) => {
654
- pendingLinkedUpdates.push(() => {
655
- if (entry.output.type === "chunk") {
656
- entry.output.code = code;
657
- } else {
658
- entry.output.source = code;
659
- }
660
- });
661
- };
662
- const applyLinkedUpdates = (linked) => {
663
- applyLinkedResults(linked, jsEntries, handleLinkedUpdate, scheduleLinkedApply);
664
- };
665
- const createHandlerOptions = (absoluteFilename, extra) => ({
666
- ...extra,
667
- filename: absoluteFilename,
668
- moduleGraph: moduleGraphOptions,
669
- babelParserOptions: {
670
- ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _25 => _25.babelParserOptions]), () => ( {})),
671
- sourceFilename: absoluteFilename
672
- }
673
- });
674
- const tasks = [];
675
- if (Array.isArray(groupedEntries.html)) {
676
- for (const [file, originalSource] of groupedEntries.html) {
677
- const rawSource = originalSource.source.toString();
678
- tasks.push(
679
- _chunkLTJQUORKjs.processCachedTask.call(void 0, {
680
- cache,
681
- cacheKey: file,
682
- rawSource,
683
- applyResult(source) {
684
- originalSource.source = source;
685
- },
686
- onCacheHit() {
687
- debug("html cache hit: %s", file);
688
- },
689
- async transform() {
690
- const transformed = await templateHandler(rawSource, {
691
- runtimeSet: runtime
692
- });
693
- onUpdate(file, rawSource, transformed);
694
- debug("html handle: %s", file);
695
- return {
696
- result: transformed
697
- };
698
- }
699
- })
700
- );
701
- }
702
- }
703
- const jsTaskFactories = [];
704
- if (Array.isArray(groupedEntries.js)) {
705
- for (const [file, originalSource] of groupedEntries.js) {
706
- if (originalSource.type === "chunk") {
707
- const absoluteFile = _chunk2WPTDMN3js.toAbsoluteOutputPath.call(void 0, file, outDir);
708
- const initialRawSource = originalSource.code;
709
- jsTaskFactories.push(async () => {
710
- await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
711
- cache,
712
- cacheKey: file,
713
- rawSource: initialRawSource,
714
- applyResult(source) {
715
- originalSource.code = source;
716
- },
717
- onCacheHit() {
718
- debug("js cache hit: %s", file);
719
- },
720
- async transform() {
721
- const rawSource = originalSource.code;
722
- const { code, linked } = await jsHandler(rawSource, runtime, createHandlerOptions(absoluteFile));
723
- onUpdate(file, rawSource, code);
724
- debug("js handle: %s", file);
725
- applyLinkedUpdates(linked);
726
- return {
727
- result: code
728
- };
729
- }
730
- });
731
- });
732
- } else if (uniAppX && originalSource.type === "asset") {
733
- jsTaskFactories.push(
734
- createUniAppXAssetTask(
735
- file,
736
- originalSource,
737
- outDir,
738
- {
739
- cache,
740
- createHandlerOptions,
741
- debug,
742
- jsHandler,
743
- onUpdate,
744
- runtimeSet: runtime,
745
- applyLinkedResults: applyLinkedUpdates,
746
- uniAppX
747
- }
748
- )
749
- );
750
- }
751
- }
752
- }
753
- if (Array.isArray(groupedEntries.css)) {
754
- for (const [file, originalSource] of groupedEntries.css) {
755
- const rawSource = originalSource.source.toString();
756
- tasks.push(
757
- _chunkLTJQUORKjs.processCachedTask.call(void 0, {
758
- cache,
759
- cacheKey: file,
760
- rawSource,
761
- applyResult(source) {
762
- originalSource.source = source;
763
- },
764
- onCacheHit() {
765
- debug("css cache hit: %s", file);
766
- },
767
- async transform() {
768
- await runtimeState.patchPromise;
769
- const { css } = await styleHandler(rawSource, {
770
- isMainChunk: mainCssChunkMatcher(originalSource.fileName, appType),
771
- postcssOptions: {
772
- options: {
773
- from: file
774
- }
775
- },
776
- majorVersion: runtimeState.twPatcher.majorVersion
777
- });
778
- onUpdate(file, rawSource, css);
779
- debug("css handle: %s", file);
780
- return {
781
- result: css
782
- };
783
- }
784
- })
785
- );
786
- }
787
- }
788
- _chunk2WPTDMN3js.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
789
- await Promise.all(tasks);
790
- for (const apply of pendingLinkedUpdates) {
791
- apply();
792
- }
793
- onEnd();
794
- debug("end");
795
- }
830
+ generateBundle: createGenerateBundleHook({
831
+ opts,
832
+ runtimeState,
833
+ ensureRuntimeClassSet,
834
+ debug,
835
+ getResolvedConfig
836
+ })
796
837
  }
797
838
  ];
798
839
  if (uniAppXPlugins) {