weapp-tailwindcss 5.3.2 → 5.3.4

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 (52) hide show
  1. package/dist/bundlers/shared/source-candidates/types-and-cache.d.ts +3 -0
  2. package/dist/bundlers/shared/style-requests.d.ts +1 -0
  3. package/dist/bundlers/vite/shared/create-framework-plugins.d.ts +1 -0
  4. package/dist/bundlers/vite/shared/framework-module-candidates.d.ts +15 -0
  5. package/dist/{context-Kvr3lLEC.js → context-4ittVpgt.js} +1 -1
  6. package/dist/{context-CB4Ef9U0.cjs → context-Ulhcd5lF.cjs} +3 -3
  7. package/dist/core.cjs +1 -1
  8. package/dist/core.js +1 -1
  9. package/dist/{gulp-QJ_oz-06.cjs → gulp-CDIXMhIO.cjs} +6 -6
  10. package/dist/{gulp-vz36-uQP.js → gulp-DwtrU4V1.js} +3 -3
  11. package/dist/gulp.cjs +1 -1
  12. package/dist/gulp.js +1 -1
  13. package/dist/{hmr-timing-W3kro20F.cjs → hmr-timing-DcFB_kwB.cjs} +2 -2
  14. package/dist/{hmr-timing-HGlM4hX3.js → hmr-timing-utmOgn6p.js} +57 -14
  15. package/dist/index.cjs +3 -3
  16. package/dist/index.js +3 -3
  17. package/dist/local-style-matcher-DRpFEu1s.cjs +34 -0
  18. package/dist/local-style-matcher-DsiI2wIc.js +17 -0
  19. package/dist/{options-CKZW99r4.cjs → options-BJrtIQbH.cjs} +3 -1
  20. package/dist/{pipeline-helpers-t95KPu4O.cjs → pipeline-helpers-kB7Mn2Jy.cjs} +2 -2
  21. package/dist/presets.cjs +2 -2
  22. package/dist/presets.js +1 -1
  23. package/dist/rspack.cjs +2 -2
  24. package/dist/rspack.js +2 -2
  25. package/dist/{source-candidate-scan-signature-BSad7bMQ.cjs → source-candidate-scan-signature-C1r5mHSi.cjs} +2 -2
  26. package/dist/{source-candidate-scan-signature-BHCPQVoD.js → source-candidate-scan-signature-CDrLxVKu.js} +2 -2
  27. package/dist/{style-options-PCgz2ywM.cjs → style-options-DW30H5PV.cjs} +1 -1
  28. package/dist/{tailwindcss-jKzY37Sk.cjs → tailwindcss-CexDJBhx.cjs} +1 -1
  29. package/dist/{tailwindcss-BSEdWieh.js → tailwindcss-ChnpCv25.js} +3 -1
  30. package/dist/{component-local-style-CNhEhd2B.cjs → transform-BQjg2T2T.cjs} +201 -27
  31. package/dist/{component-local-style-C2wC8o9F.js → transform-Cp4KybBy.js} +207 -16
  32. package/dist/types/user-defined-options/important.d.ts +2 -0
  33. package/dist/uni-app-x/component-local-style.d.ts +6 -4
  34. package/dist/uni-app-x/local-style-matcher.d.ts +4 -0
  35. package/dist/uni-app-x/options.d.ts +2 -0
  36. package/dist/uni-app-x/style-asset/harmony-global.d.ts +2 -0
  37. package/dist/uni-app-x/transform.d.ts +2 -0
  38. package/dist/uni-app-x/vite/plugin-options.d.ts +1 -0
  39. package/dist/uni-app-x/vite/style-request.d.ts +0 -1
  40. package/dist/{v4-generation-core-BfeXEc6R.cjs → v4-generation-core-OVshPBGo.cjs} +62 -13
  41. package/dist/{vite-CVr0vIgh.js → vite-D1a6OfVn.js} +130 -91
  42. package/dist/{vite-Dy6THt54.cjs → vite-cXJPnKXp.cjs} +77 -38
  43. package/dist/vite.cjs +1 -1
  44. package/dist/vite.js +1 -1
  45. package/dist/weapp-tw-css-import-rewrite-loader.cjs +4 -4
  46. package/dist/{webpack-Cf5RnhXt.cjs → webpack-DOhCcN_2.cjs} +8 -8
  47. package/dist/{webpack-DwtdWqwr.js → webpack-DQAbh1Z7.js} +4 -4
  48. package/dist/webpack.cjs +1 -1
  49. package/dist/webpack.js +1 -1
  50. package/package.json +2 -2
  51. package/dist/transform-CgohToUV.cjs +0 -200
  52. package/dist/transform-DSRPiBWz.js +0 -201
@@ -2,9 +2,9 @@ const require_rolldown_runtime = require("./rolldown-runtime-Ctb5zv51.cjs");
2
2
  const require_generator = require("./generator-DKiYbTFR.cjs");
3
3
  require("./auto-DtU6f3X6.cjs");
4
4
  const require_object = require("./object-DbHtAXRk.cjs");
5
- const require_options = require("./options-CKZW99r4.cjs");
5
+ const require_options = require("./options-BJrtIQbH.cjs");
6
6
  const require_wxml = require("./wxml-CQmBCjOR.cjs");
7
- const require_style_options = require("./style-options-PCgz2ywM.cjs");
7
+ const require_style_options = require("./style-options-DW30H5PV.cjs");
8
8
  let node_fs = require("node:fs");
9
9
  let node_path = require("node:path");
10
10
  node_path = require_rolldown_runtime.__toESM(node_path, 1);
@@ -312,9 +312,11 @@ function createSourceCandidateStore(options = {}) {
312
312
  const scanCandidatesById = /* @__PURE__ */ new Map();
313
313
  const transformCandidatesById = /* @__PURE__ */ new Map();
314
314
  const cssCandidatesById = /* @__PURE__ */ new Map();
315
+ const moduleCandidatesById = /* @__PURE__ */ new Map();
315
316
  const scanSourceById = /* @__PURE__ */ new Map();
316
317
  const transformSourceById = /* @__PURE__ */ new Map();
317
318
  const cssSourceById = /* @__PURE__ */ new Map();
319
+ const moduleSourceById = /* @__PURE__ */ new Map();
318
320
  const candidateCount = /* @__PURE__ */ new Map();
319
321
  let inlineIncludedCandidates = /* @__PURE__ */ new Set();
320
322
  let inlineExcludedCandidates = /* @__PURE__ */ new Set();
@@ -345,6 +347,13 @@ function createSourceCandidateStore(options = {}) {
345
347
  cssSourceById.set(normalizedId, source);
346
348
  replaceCssLayer(normalizedId, await resolveCandidates(source, "css"));
347
349
  }
350
+ async function syncModuleSource(id, source) {
351
+ const normalizedId = cleanUrl(id);
352
+ moduleSourceById.set(normalizedId, source);
353
+ const candidates = await resolveCandidates(source, resolveSourceCandidateExtension(normalizedId));
354
+ replaceModuleLayer(normalizedId, candidates);
355
+ return new Set(candidates);
356
+ }
348
357
  async function merge(id, source) {
349
358
  const normalizedId = cleanUrl(id);
350
359
  transformSourceById.set(normalizedId, source);
@@ -372,8 +381,10 @@ function createSourceCandidateStore(options = {}) {
372
381
  if (extension !== "css") {
373
382
  transformCandidatesById.delete(normalizedId);
374
383
  cssCandidatesById.delete(normalizedId);
384
+ moduleCandidatesById.delete(normalizedId);
375
385
  transformSourceById.delete(normalizedId);
376
386
  cssSourceById.delete(normalizedId);
387
+ moduleSourceById.delete(normalizedId);
377
388
  }
378
389
  scanSourceById.set(normalizedId, source);
379
390
  replaceScanLayer(normalizedId, nextCandidates);
@@ -431,12 +442,19 @@ function createSourceCandidateStore(options = {}) {
431
442
  else cssCandidatesById.set(normalizedId, nextCandidates);
432
443
  recompute(normalizedId);
433
444
  }
445
+ function replaceModuleLayer(id, nextCandidates) {
446
+ const normalizedId = cleanUrl(id);
447
+ if (nextCandidates.size === 0) moduleCandidatesById.delete(normalizedId);
448
+ else moduleCandidatesById.set(normalizedId, nextCandidates);
449
+ recompute(normalizedId);
450
+ }
434
451
  function recompute(id) {
435
452
  const normalizedId = cleanUrl(id);
436
453
  replaceFinal(normalizedId, /* @__PURE__ */ new Set([
437
454
  ...scanCandidatesById.get(normalizedId) ?? [],
438
455
  ...transformCandidatesById.get(normalizedId) ?? [],
439
- ...cssCandidatesById.get(normalizedId) ?? []
456
+ ...cssCandidatesById.get(normalizedId) ?? [],
457
+ ...moduleCandidatesById.get(normalizedId) ?? []
440
458
  ]));
441
459
  }
442
460
  function syncInline(inlineCandidates) {
@@ -450,9 +468,11 @@ function createSourceCandidateStore(options = {}) {
450
468
  scanCandidatesById.delete(normalizedId);
451
469
  transformCandidatesById.delete(normalizedId);
452
470
  cssCandidatesById.delete(normalizedId);
471
+ moduleCandidatesById.delete(normalizedId);
453
472
  scanSourceById.delete(normalizedId);
454
473
  transformSourceById.delete(normalizedId);
455
474
  cssSourceById.delete(normalizedId);
475
+ moduleSourceById.delete(normalizedId);
456
476
  const previousCandidates = candidatesById.get(normalizedId);
457
477
  if (!previousCandidates) return diffCandidateSets(previousVisibleCandidates, /* @__PURE__ */ new Set());
458
478
  removeCandidateSet(candidateCount, previousCandidates);
@@ -461,7 +481,7 @@ function createSourceCandidateStore(options = {}) {
461
481
  }
462
482
  function source(id) {
463
483
  const normalizedId = cleanUrl(id);
464
- return scanSourceById.get(normalizedId) ?? cssSourceById.get(normalizedId) ?? transformSourceById.get(normalizedId);
484
+ return scanSourceById.get(normalizedId) ?? cssSourceById.get(normalizedId) ?? transformSourceById.get(normalizedId) ?? moduleSourceById.get(normalizedId);
465
485
  }
466
486
  function sources() {
467
487
  return mergeSourcesByPriority().entries();
@@ -475,10 +495,10 @@ function createSourceCandidateStore(options = {}) {
475
495
  if (entries === void 0) {
476
496
  if (!options.excludeEntries?.length) return values();
477
497
  }
478
- if (entries?.length === 0) return new Set(inlineIncludedCandidates);
479
498
  const filtered = /* @__PURE__ */ new Set();
480
499
  for (const [id, candidates] of candidatesById) {
481
- if (entries !== void 0 && !require_generator.isFileMatchedByTailwindSourceEntries(id, entries)) continue;
500
+ const isActiveModule = moduleCandidatesById.has(id);
501
+ if (entries !== void 0 && (isActiveModule ? require_generator.isFileExcludedByTailwindSourceEntries(id, entries) : entries.length === 0 || !require_generator.isFileMatchedByTailwindSourceEntries(id, entries))) continue;
482
502
  if (options.excludeEntries?.length && require_generator.isFileMatchedByTailwindSourceEntries(id, options.excludeEntries)) continue;
483
503
  for (const candidate of candidates) filtered.add(candidate);
484
504
  }
@@ -496,13 +516,9 @@ function createSourceCandidateStore(options = {}) {
496
516
  }
497
517
  if (id) candidateSources.add(id);
498
518
  };
499
- if (entries?.length === 0) {
500
- for (const candidate of inlineIncludedCandidates) addCandidateSource(candidate, void 0);
501
- for (const candidate of inlineExcludedCandidates) sources.delete(candidate);
502
- return sources;
503
- }
504
519
  for (const [id, candidates] of candidatesById) {
505
- if (entries !== void 0 && !require_generator.isFileMatchedByTailwindSourceEntries(id, entries)) continue;
520
+ const isActiveModule = moduleCandidatesById.has(id);
521
+ if (entries !== void 0 && (isActiveModule ? require_generator.isFileExcludedByTailwindSourceEntries(id, entries) : entries.length === 0 || !require_generator.isFileMatchedByTailwindSourceEntries(id, entries))) continue;
506
522
  if (options.excludeEntries?.length && require_generator.isFileMatchedByTailwindSourceEntries(id, options.excludeEntries)) continue;
507
523
  for (const candidate of candidates) addCandidateSource(candidate, id);
508
524
  }
@@ -515,9 +531,11 @@ function createSourceCandidateStore(options = {}) {
515
531
  scanCandidatesById.clear();
516
532
  transformCandidatesById.clear();
517
533
  cssCandidatesById.clear();
534
+ moduleCandidatesById.clear();
518
535
  scanSourceById.clear();
519
536
  transformSourceById.clear();
520
537
  cssSourceById.clear();
538
+ moduleSourceById.clear();
521
539
  candidateCount.clear();
522
540
  inlineIncludedCandidates.clear();
523
541
  inlineExcludedCandidates.clear();
@@ -539,6 +557,8 @@ function createSourceCandidateStore(options = {}) {
539
557
  candidatesById: [...candidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
540
558
  cssCandidatesById: [...cssCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
541
559
  cssSourceById: [...cssSourceById.entries()],
560
+ moduleCandidatesById: [...moduleCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
561
+ moduleSourceById: [...moduleSourceById.entries()],
542
562
  scanCandidatesById: [...scanCandidatesById.entries()].map(([id, candidates]) => [id, [...candidates]]),
543
563
  scanSourceById: [...scanSourceById.entries()],
544
564
  sourceById: [...mergeSourcesByPriority().entries()],
@@ -568,13 +588,20 @@ function createSourceCandidateStore(options = {}) {
568
588
  if (candidateSet.size === 0) continue;
569
589
  cssCandidatesById.set(id, candidateSet);
570
590
  }
591
+ for (const [id, candidates] of snapshot.moduleCandidatesById ?? []) {
592
+ const candidateSet = new Set(candidates);
593
+ if (candidateSet.size === 0) continue;
594
+ moduleCandidatesById.set(id, candidateSet);
595
+ }
571
596
  for (const [id, source] of snapshot.scanSourceById ?? snapshot.sourceById ?? []) scanSourceById.set(id, source);
572
597
  for (const [id, source] of snapshot.transformSourceById ?? []) transformSourceById.set(id, source);
573
598
  for (const [id, source] of snapshot.cssSourceById ?? []) cssSourceById.set(id, source);
599
+ for (const [id, source] of snapshot.moduleSourceById ?? []) moduleSourceById.set(id, source);
574
600
  const ids = /* @__PURE__ */ new Set([
575
601
  ...scanCandidatesById.keys(),
576
602
  ...transformCandidatesById.keys(),
577
- ...cssCandidatesById.keys()
603
+ ...cssCandidatesById.keys(),
604
+ ...moduleCandidatesById.keys()
578
605
  ]);
579
606
  for (const id of ids) recompute(id);
580
607
  }
@@ -582,6 +609,7 @@ function createSourceCandidateStore(options = {}) {
582
609
  syncSource: sync,
583
610
  sync,
584
611
  syncCss,
612
+ syncModuleSource,
585
613
  merge,
586
614
  syncFile,
587
615
  syncCurrentSource,
@@ -603,6 +631,7 @@ function createSourceCandidateStore(options = {}) {
603
631
  };
604
632
  function mergeSourcesByPriority() {
605
633
  const sources = /* @__PURE__ */ new Map();
634
+ for (const [id, source] of moduleSourceById) sources.set(id, source);
606
635
  for (const [id, source] of transformSourceById) sources.set(id, source);
607
636
  for (const [id, source] of cssSourceById) sources.set(id, source);
608
637
  for (const [id, source] of scanSourceById) sources.set(id, source);
@@ -2204,9 +2233,12 @@ function parseBundlerGeneratedCssMarkerBlocks(source) {
2204
2233
  //#endregion
2205
2234
  //#region src/bundlers/shared/style-requests.ts
2206
2235
  const SOURCE_STYLE_EXT_RE = /\.(?:css|scss|sass|less|styl|stylus|pcss|postcss)$/i;
2236
+ const SOURCE_PREPROCESSOR_EXT_RE = /\.(?:scss|sass|less|styl|stylus)$/i;
2237
+ const INLINE_PREPROCESSOR_LANG_RE = /(?:^|[.?&])lang\.(?:scss|sass|less|styl|stylus)(?:[.&]|$)/i;
2207
2238
  const STYLE_QUERY_RE = /(?:^|&)type=styles?(?:&|$)/;
2208
2239
  const VUE_STYLE_QUERY_RE = /(?:^|&)type=style(?:&|$)/;
2209
2240
  const STYLE_LANG_QUERY_RE = /(?:^|&)lang(?:[.=](?:css|scss|sass|less|styl|stylus|pcss|postcss))?(?:&|$)/;
2241
+ const PREPROCESSOR_LANG_QUERY_RE = /(?:^|&)lang[.=](?:scss|sass|less|styl|stylus)(?:&|$)/i;
2210
2242
  function stripHash(request) {
2211
2243
  const hashIndex = request.indexOf("#");
2212
2244
  return hashIndex === -1 ? request : request.slice(0, hashIndex);
@@ -2219,6 +2251,7 @@ function stripRequestQuery(request) {
2219
2251
  function isSourceStyleRequest(request) {
2220
2252
  if (typeof request !== "string" || request.length === 0) return false;
2221
2253
  const normalized = stripHash(request);
2254
+ if (INLINE_PREPROCESSOR_LANG_RE.test(normalized)) return true;
2222
2255
  const queryIndex = normalized.indexOf("?");
2223
2256
  const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
2224
2257
  if (SOURCE_STYLE_EXT_RE.test(pathname)) return true;
@@ -2226,6 +2259,16 @@ function isSourceStyleRequest(request) {
2226
2259
  const query = normalized.slice(queryIndex + 1);
2227
2260
  return STYLE_QUERY_RE.test(query) || STYLE_LANG_QUERY_RE.test(query);
2228
2261
  }
2262
+ function isSourcePreprocessorRequest(request, lang) {
2263
+ if (typeof lang === "string" && SOURCE_PREPROCESSOR_EXT_RE.test(`.${lang}`)) return true;
2264
+ if (typeof request !== "string" || request.length === 0) return false;
2265
+ const normalized = stripHash(request);
2266
+ if (INLINE_PREPROCESSOR_LANG_RE.test(normalized)) return true;
2267
+ const queryIndex = normalized.indexOf("?");
2268
+ const pathname = queryIndex === -1 ? normalized : normalized.slice(0, queryIndex);
2269
+ if (SOURCE_PREPROCESSOR_EXT_RE.test(pathname)) return true;
2270
+ return queryIndex !== -1 && PREPROCESSOR_LANG_QUERY_RE.test(normalized.slice(queryIndex + 1));
2271
+ }
2229
2272
  function isVueScopedStyleRequest(request) {
2230
2273
  if (typeof request !== "string" || request.length === 0) return false;
2231
2274
  const normalized = stripHash(request);
@@ -5555,6 +5598,12 @@ Object.defineProperty(exports, "isSourceCandidateRequest", {
5555
5598
  return isSourceCandidateRequest;
5556
5599
  }
5557
5600
  });
5601
+ Object.defineProperty(exports, "isSourcePreprocessorRequest", {
5602
+ enumerable: true,
5603
+ get: function() {
5604
+ return isSourcePreprocessorRequest;
5605
+ }
5606
+ });
5558
5607
  Object.defineProperty(exports, "isSourceStyleRequest", {
5559
5608
  enumerable: true,
5560
5609
  get: function() {