weapp-tailwindcss 4.10.0-beta.3 → 4.10.0-beta.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 (51) hide show
  1. package/dist/{chunk-TYYAOYEJ.mjs → chunk-3A7VW4BZ.mjs} +3 -3
  2. package/dist/{chunk-EGOFMIDI.mjs → chunk-3WUHHFLF.mjs} +1 -0
  3. package/dist/{chunk-LBZCKOMT.js → chunk-5U24PLVV.js} +1 -0
  4. package/dist/{chunk-AAVDJYEE.js → chunk-BFZDZRA5.js} +5 -3
  5. package/dist/{chunk-RHQJLGBF.js → chunk-GQVBN7UT.js} +3 -3
  6. package/dist/{chunk-TIZBA67F.mjs → chunk-JP45MK3F.mjs} +1 -1
  7. package/dist/{chunk-PBA2SZ3H.mjs → chunk-KAK3XMAW.mjs} +1 -1
  8. package/dist/{chunk-2BHX22WT.js → chunk-OCV5QLZM.js} +27 -27
  9. package/dist/{chunk-2VVKFR3W.mjs → chunk-OYR4XWM4.mjs} +4 -2
  10. package/dist/{chunk-4EMVQ5H2.js → chunk-PLI5CO4U.js} +50 -25
  11. package/dist/{chunk-SLXV5ZYJ.mjs → chunk-UELU5NFH.mjs} +33 -8
  12. package/dist/{chunk-NDRBH7DO.js → chunk-WQPYYMRL.js} +7 -7
  13. package/dist/{chunk-Q6NT6TZQ.mjs → chunk-XCKQ4YQM.mjs} +2 -2
  14. package/dist/{chunk-VEJYEJ4V.js → chunk-Y6OZDS7V.js} +3 -3
  15. package/dist/cli.js +10 -10
  16. package/dist/cli.mjs +2 -2
  17. package/dist/core.d.mts +1 -1
  18. package/dist/core.d.ts +1 -1
  19. package/dist/core.js +8 -8
  20. package/dist/core.mjs +3 -3
  21. package/dist/defaults.d.mts +1 -1
  22. package/dist/defaults.d.ts +1 -1
  23. package/dist/defaults.js +2 -2
  24. package/dist/defaults.mjs +1 -1
  25. package/dist/gulp.d.mts +1 -1
  26. package/dist/gulp.d.ts +1 -1
  27. package/dist/gulp.js +5 -5
  28. package/dist/gulp.mjs +4 -4
  29. package/dist/{index-v0opId0x.d.ts → index-B6U7MoOM.d.mts} +12 -0
  30. package/dist/{index-v0opId0x.d.mts → index-B6U7MoOM.d.ts} +12 -0
  31. package/dist/index.d.mts +1 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +8 -8
  34. package/dist/index.mjs +7 -7
  35. package/dist/presets.d.mts +1 -1
  36. package/dist/presets.d.ts +1 -1
  37. package/dist/types.d.mts +2 -2
  38. package/dist/types.d.ts +2 -2
  39. package/dist/vite.d.mts +1 -1
  40. package/dist/vite.d.ts +1 -1
  41. package/dist/vite.js +5 -5
  42. package/dist/vite.mjs +4 -4
  43. package/dist/webpack.d.mts +1 -1
  44. package/dist/webpack.d.ts +1 -1
  45. package/dist/webpack.js +6 -6
  46. package/dist/webpack.mjs +5 -5
  47. package/dist/webpack4.d.mts +1 -1
  48. package/dist/webpack4.d.ts +1 -1
  49. package/dist/webpack4.js +27 -27
  50. package/dist/webpack4.mjs +4 -4
  51. package/package.json +3 -3
@@ -10,7 +10,7 @@ import {
10
10
  isMpx,
11
11
  patchMpxLoaderResolve,
12
12
  setupMpxTailwindcssRedirect
13
- } from "./chunk-TIZBA67F.mjs";
13
+ } from "./chunk-JP45MK3F.mjs";
14
14
  import {
15
15
  pushConcurrentTaskFactories,
16
16
  resolveDisabledOptions,
@@ -23,14 +23,14 @@ import {
23
23
  } from "./chunk-RRHPTTCP.mjs";
24
24
  import {
25
25
  setupPatchRecorder
26
- } from "./chunk-PBA2SZ3H.mjs";
26
+ } from "./chunk-KAK3XMAW.mjs";
27
27
  import {
28
28
  createDebug,
29
29
  ensureRuntimeClassSet,
30
30
  getCompilerContext,
31
31
  getRuntimeClassSetSignature,
32
32
  pluginName
33
- } from "./chunk-2VVKFR3W.mjs";
33
+ } from "./chunk-OYR4XWM4.mjs";
34
34
  import {
35
35
  getGroupedEntries
36
36
  } from "./chunk-OOHJLO5M.mjs";
@@ -97,6 +97,7 @@ function getDefaultOptions() {
97
97
  }
98
98
  return false;
99
99
  },
100
+ staleClassNameFallback: void 0,
100
101
  disabledDefaultTemplateHandler: false,
101
102
  cssSelectorReplacement: {
102
103
  root: ["page", ".tw-root", "wx-root-portal-content"],
@@ -97,6 +97,7 @@ function getDefaultOptions() {
97
97
  }
98
98
  return false;
99
99
  },
100
+ staleClassNameFallback: void 0,
100
101
  disabledDefaultTemplateHandler: false,
101
102
  cssSelectorReplacement: {
102
103
  root: ["page", ".tw-root", "wx-root-portal-content"],
@@ -6,7 +6,7 @@
6
6
  var _chunk5APD2MNVjs = require('./chunk-5APD2MNV.js');
7
7
 
8
8
 
9
- var _chunkLBZCKOMTjs = require('./chunk-LBZCKOMT.js');
9
+ var _chunk5U24PLVVjs = require('./chunk-5U24PLVV.js');
10
10
 
11
11
 
12
12
 
@@ -266,7 +266,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
266
266
  // package.json
267
267
  var package_default = {
268
268
  name: "weapp-tailwindcss",
269
- version: "4.10.0-beta.3",
269
+ version: "4.10.0-beta.4",
270
270
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
271
271
  author: "ice breaker <1324318532@qq.com>",
272
272
  license: "MIT",
@@ -2874,6 +2874,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
2874
2874
  unitsToPx,
2875
2875
  arbitraryValues,
2876
2876
  jsPreserveClass,
2877
+ staleClassNameFallback,
2877
2878
  babelParserOptions,
2878
2879
  ignoreCallExpressionIdentifiers,
2879
2880
  ignoreTaggedTemplateExpressionIdentifiers,
@@ -2903,6 +2904,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
2903
2904
  escapeMap,
2904
2905
  arbitraryValues,
2905
2906
  jsPreserveClass,
2907
+ staleClassNameFallback,
2906
2908
  generateMap: true,
2907
2909
  babelParserOptions,
2908
2910
  ignoreCallExpressionIdentifiers,
@@ -2985,7 +2987,7 @@ async function clearTailwindcssPatcherCache(patcher, options) {
2985
2987
  function createInternalCompilerContext(opts) {
2986
2988
  const ctx = _chunkDYLQ6UOIjs.defuOverrideArray.call(void 0,
2987
2989
  opts,
2988
- _chunkLBZCKOMTjs.getDefaultOptions.call(void 0, ),
2990
+ _chunk5U24PLVVjs.getDefaultOptions.call(void 0, ),
2989
2991
  {}
2990
2992
  );
2991
2993
  ctx.escapeMap = ctx.customReplaceDictionary;
@@ -3,7 +3,7 @@
3
3
  var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
4
4
 
5
5
 
6
- var _chunkAAVDJYEEjs = require('./chunk-AAVDJYEE.js');
6
+ var _chunkBFZDZRA5js = require('./chunk-BFZDZRA5.js');
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
@@ -154,8 +154,8 @@ function applyTailwindcssCssImportRewrite(compiler, options) {
154
154
  if (!options.enabled) {
155
155
  return;
156
156
  }
157
- compiler.hooks.normalModuleFactory.tap(_chunkAAVDJYEEjs.pluginName, (factory) => {
158
- factory.hooks.beforeResolve.tap(_chunkAAVDJYEEjs.pluginName, (data) => {
157
+ compiler.hooks.normalModuleFactory.tap(_chunkBFZDZRA5js.pluginName, (factory) => {
158
+ factory.hooks.beforeResolve.tap(_chunkBFZDZRA5js.pluginName, (data) => {
159
159
  rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
160
160
  });
161
161
  });
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-F2CKKG6Q.mjs";
4
4
  import {
5
5
  pluginName
6
- } from "./chunk-2VVKFR3W.mjs";
6
+ } from "./chunk-OYR4XWM4.mjs";
7
7
 
8
8
  // src/shared/mpx.ts
9
9
  import path2 from "path";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPatchTargetRecorder,
3
3
  createTailwindPatchPromise
4
- } from "./chunk-2VVKFR3W.mjs";
4
+ } from "./chunk-OYR4XWM4.mjs";
5
5
  import {
6
6
  logger
7
7
  } from "./chunk-QOTLDKI4.mjs";
@@ -10,7 +10,7 @@
10
10
 
11
11
 
12
12
 
13
- var _chunkRHQJLGBFjs = require('./chunk-RHQJLGBF.js');
13
+ var _chunkGQVBN7UTjs = require('./chunk-GQVBN7UT.js');
14
14
 
15
15
 
16
16
 
@@ -23,14 +23,14 @@ var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
23
23
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
24
24
 
25
25
 
26
- var _chunkVEJYEJ4Vjs = require('./chunk-VEJYEJ4V.js');
26
+ var _chunkY6OZDS7Vjs = require('./chunk-Y6OZDS7V.js');
27
27
 
28
28
 
29
29
 
30
30
 
31
31
 
32
32
 
33
- var _chunkAAVDJYEEjs = require('./chunk-AAVDJYEE.js');
33
+ var _chunkBFZDZRA5js = require('./chunk-BFZDZRA5.js');
34
34
 
35
35
 
36
36
  var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
@@ -51,10 +51,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
51
51
  } = options;
52
52
  const { Compilation, sources } = compiler.webpack;
53
53
  const { ConcatSource } = sources;
54
- compiler.hooks.compilation.tap(_chunkAAVDJYEEjs.pluginName, (compilation) => {
54
+ compiler.hooks.compilation.tap(_chunkBFZDZRA5js.pluginName, (compilation) => {
55
55
  compilation.hooks.processAssets.tapPromise(
56
56
  {
57
- name: _chunkAAVDJYEEjs.pluginName,
57
+ name: _chunkBFZDZRA5js.pluginName,
58
58
  stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
59
59
  },
60
60
  async (assets) => {
@@ -66,7 +66,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
66
66
  compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
67
67
  }
68
68
  }
69
- const assetHashByChunk = _chunkRHQJLGBFjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
69
+ const assetHashByChunk = _chunkGQVBN7UTjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
70
70
  const entries = Object.entries(assets);
71
71
  const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
72
72
  const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
@@ -122,7 +122,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
122
122
  }
123
123
  };
124
124
  const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
125
- const runtimeSet = await _chunkAAVDJYEEjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
125
+ const runtimeSet = await _chunkBFZDZRA5js.ensureRuntimeClassSet.call(void 0, runtimeState, {
126
126
  forceCollect: false,
127
127
  allowEmpty: false
128
128
  });
@@ -165,7 +165,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
165
165
  const jsTaskFactories = [];
166
166
  if (Array.isArray(groupedEntries.js)) {
167
167
  for (const [file] of groupedEntries.js) {
168
- const cacheKey = _chunkRHQJLGBFjs.getCacheKey.call(void 0, file);
168
+ const cacheKey = _chunkGQVBN7UTjs.getCacheKey.call(void 0, file);
169
169
  const asset = compilation.getAsset(file);
170
170
  if (!asset) {
171
171
  continue;
@@ -276,9 +276,9 @@ function setupWebpackV5Loaders(options) {
276
276
  getClassSetInLoader,
277
277
  debug: debug2
278
278
  } = options;
279
- const isMpxApp = _chunkRHQJLGBFjs.isMpx.call(void 0, appType);
279
+ const isMpxApp = _chunkGQVBN7UTjs.isMpx.call(void 0, appType);
280
280
  if (shouldRewriteCssImports && isMpxApp) {
281
- _chunkRHQJLGBFjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
281
+ _chunkGQVBN7UTjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
282
282
  }
283
283
  const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
284
284
  const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
@@ -291,12 +291,12 @@ function setupWebpackV5Loaders(options) {
291
291
  const classSetLoaderOptions = {
292
292
  getClassSet: getClassSetInLoader
293
293
  };
294
- const { findRewriteAnchor, findClassSetAnchor } = _chunkRHQJLGBFjs.createLoaderAnchorFinders.call(void 0, appType);
294
+ const { findRewriteAnchor, findClassSetAnchor } = _chunkGQVBN7UTjs.createLoaderAnchorFinders.call(void 0, appType);
295
295
  const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
296
296
  rewriteCssImports: runtimeLoaderRewriteOptions
297
297
  } : void 0;
298
298
  if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
299
- _chunkRHQJLGBFjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
299
+ _chunkGQVBN7UTjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
300
300
  }
301
301
  const createRuntimeClassSetLoaderEntry = () => ({
302
302
  loader: runtimeClassSetLoader,
@@ -316,17 +316,17 @@ function setupWebpackV5Loaders(options) {
316
316
  };
317
317
  };
318
318
  const { NormalModule } = compiler.webpack;
319
- compiler.hooks.compilation.tap(_chunkAAVDJYEEjs.pluginName, (compilation) => {
320
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkAAVDJYEEjs.pluginName, (_loaderContext, module) => {
319
+ compiler.hooks.compilation.tap(_chunkBFZDZRA5js.pluginName, (compilation) => {
320
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkBFZDZRA5js.pluginName, (_loaderContext, module) => {
321
321
  const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
322
322
  if (!hasRuntimeLoader) {
323
323
  return;
324
324
  }
325
- _chunkRHQJLGBFjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
325
+ _chunkGQVBN7UTjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
326
326
  const loaderEntries = module.loaders || [];
327
327
  let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
328
328
  const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
329
- const isCssModule = _chunkRHQJLGBFjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
329
+ const isCssModule = _chunkGQVBN7UTjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
330
330
  if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
331
331
  debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
332
332
  }
@@ -358,7 +358,7 @@ function setupWebpackV5Loaders(options) {
358
358
  rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
359
359
  }
360
360
  }
361
- if (runtimeClassSetLoaderExists && !_chunkRHQJLGBFjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
361
+ if (runtimeClassSetLoaderExists && !_chunkGQVBN7UTjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
362
362
  const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
363
363
  const anchorIndex = findClassSetAnchor(loaderEntries);
364
364
  if (anchorIndex === -1) {
@@ -373,11 +373,11 @@ function setupWebpackV5Loaders(options) {
373
373
  }
374
374
 
375
375
  // src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
376
- var debug = _chunkAAVDJYEEjs.createDebug.call(void 0, );
376
+ var debug = _chunkBFZDZRA5js.createDebug.call(void 0, );
377
377
  var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
378
378
  var UnifiedWebpackPluginV5 = class {
379
379
  constructor(options = {}) {
380
- this.options = _chunkAAVDJYEEjs.getCompilerContext.call(void 0, options);
380
+ this.options = _chunkBFZDZRA5js.getCompilerContext.call(void 0, options);
381
381
  this.appType = this.options.appType;
382
382
  }
383
383
  apply(compiler) {
@@ -393,19 +393,19 @@ var UnifiedWebpackPluginV5 = class {
393
393
  const disabledOptions = _chunkIIDSY4XZjs.resolveDisabledOptions.call(void 0, disabled);
394
394
  const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
395
395
  const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
396
- const isMpxApp = _chunkRHQJLGBFjs.isMpx.call(void 0, this.appType);
396
+ const isMpxApp = _chunkGQVBN7UTjs.isMpx.call(void 0, this.appType);
397
397
  if (shouldRewriteCssImports) {
398
- _chunkRHQJLGBFjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
398
+ _chunkGQVBN7UTjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
399
399
  pkgDir: weappTailwindcssPackageDir,
400
400
  enabled: true,
401
401
  appType: this.appType
402
402
  });
403
- _chunkRHQJLGBFjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
403
+ _chunkGQVBN7UTjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
404
404
  }
405
405
  if (disabledOptions.plugin) {
406
406
  return;
407
407
  }
408
- const patchRecorderState = _chunkVEJYEJ4Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
408
+ const patchRecorderState = _chunkY6OZDS7Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
409
409
  source: "runtime",
410
410
  cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
411
411
  });
@@ -421,18 +421,18 @@ var UnifiedWebpackPluginV5 = class {
421
421
  runtimeSetPrepared = false;
422
422
  };
423
423
  if (_optionalChain([compiler, 'access', _13 => _13.hooks, 'access', _14 => _14.thisCompilation, 'optionalAccess', _15 => _15.tap])) {
424
- compiler.hooks.thisCompilation.tap(_chunkAAVDJYEEjs.pluginName, resetRuntimePreparation);
424
+ compiler.hooks.thisCompilation.tap(_chunkBFZDZRA5js.pluginName, resetRuntimePreparation);
425
425
  } else if (_optionalChain([compiler, 'access', _16 => _16.hooks, 'access', _17 => _17.compilation, 'optionalAccess', _18 => _18.tap])) {
426
- compiler.hooks.compilation.tap(_chunkAAVDJYEEjs.pluginName, resetRuntimePreparation);
426
+ compiler.hooks.compilation.tap(_chunkBFZDZRA5js.pluginName, resetRuntimePreparation);
427
427
  }
428
428
  async function getClassSetInLoader() {
429
429
  if (runtimeSetPrepared) {
430
430
  return;
431
431
  }
432
- const signature = _chunkAAVDJYEEjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
432
+ const signature = _chunkBFZDZRA5js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
433
433
  const forceRefresh = signature !== runtimeSetSignature;
434
434
  runtimeSetPrepared = true;
435
- await _chunkAAVDJYEEjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
435
+ await _chunkBFZDZRA5js.ensureRuntimeClassSet.call(void 0, runtimeState, {
436
436
  forceRefresh,
437
437
  forceCollect: true,
438
438
  clearCache: forceRefresh,
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-QOTLDKI4.mjs";
7
7
  import {
8
8
  getDefaultOptions
9
- } from "./chunk-EGOFMIDI.mjs";
9
+ } from "./chunk-3WUHHFLF.mjs";
10
10
  import {
11
11
  defuOverrideArray,
12
12
  isMap
@@ -266,7 +266,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
266
266
  // package.json
267
267
  var package_default = {
268
268
  name: "weapp-tailwindcss",
269
- version: "4.10.0-beta.3",
269
+ version: "4.10.0-beta.4",
270
270
  description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
271
271
  author: "ice breaker <1324318532@qq.com>",
272
272
  license: "MIT",
@@ -2874,6 +2874,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
2874
2874
  unitsToPx,
2875
2875
  arbitraryValues,
2876
2876
  jsPreserveClass,
2877
+ staleClassNameFallback,
2877
2878
  babelParserOptions,
2878
2879
  ignoreCallExpressionIdentifiers,
2879
2880
  ignoreTaggedTemplateExpressionIdentifiers,
@@ -2903,6 +2904,7 @@ function createHandlersFromContext(ctx, customAttributesEntities, cssCalcOptions
2903
2904
  escapeMap,
2904
2905
  arbitraryValues,
2905
2906
  jsPreserveClass,
2907
+ staleClassNameFallback,
2906
2908
  generateMap: true,
2907
2909
  babelParserOptions,
2908
2910
  ignoreCallExpressionIdentifiers,
@@ -12,7 +12,7 @@ var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
12
12
  var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
13
13
 
14
14
 
15
- var _chunkVEJYEJ4Vjs = require('./chunk-VEJYEJ4V.js');
15
+ var _chunkY6OZDS7Vjs = require('./chunk-Y6OZDS7V.js');
16
16
 
17
17
 
18
18
 
@@ -24,7 +24,7 @@ var _chunkVEJYEJ4Vjs = require('./chunk-VEJYEJ4V.js');
24
24
 
25
25
 
26
26
 
27
- var _chunkAAVDJYEEjs = require('./chunk-AAVDJYEE.js');
27
+ var _chunkBFZDZRA5js = require('./chunk-BFZDZRA5.js');
28
28
 
29
29
 
30
30
  var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
@@ -54,7 +54,7 @@ function updateStaticAttribute(ms, prop) {
54
54
  const start = prop.value.loc.start.offset + 1;
55
55
  const end = prop.value.loc.end.offset - 1;
56
56
  if (start < end) {
57
- ms.update(start, end, _chunkAAVDJYEEjs.replaceWxml.call(void 0, prop.value.content));
57
+ ms.update(start, end, _chunkBFZDZRA5js.replaceWxml.call(void 0, prop.value.content));
58
58
  }
59
59
  }
60
60
  function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
@@ -66,7 +66,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
66
66
  if (start >= end) {
67
67
  return;
68
68
  }
69
- const generated = _chunkAAVDJYEEjs.generateCode.call(void 0, prop.exp.content, {
69
+ const generated = _chunkBFZDZRA5js.generateCode.call(void 0, prop.exp.content, {
70
70
  jsHandler,
71
71
  runtimeSet,
72
72
  wrapExpression: true
@@ -95,7 +95,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
95
95
  return;
96
96
  }
97
97
  const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
98
- const matchCustomAttribute = _chunkAAVDJYEEjs.createAttributeMatcher.call(void 0, customAttributesEntities);
98
+ const matchCustomAttribute = _chunkBFZDZRA5js.createAttributeMatcher.call(void 0, customAttributesEntities);
99
99
  const ms = new (0, _magicstring2.default)(code);
100
100
  const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
101
101
  if (errors.length === 0) {
@@ -661,6 +661,24 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
661
661
  }
662
662
  return `${runtimeSignature}:linked:${linkedImpactSignature}`;
663
663
  }
664
+ function hasRuntimeAffectingSourceChanges(changedByType) {
665
+ return changedByType.html.size > 0 || changedByType.js.size > 0;
666
+ }
667
+ function resolveViteStaleClassNameFallback(option, resolvedConfig) {
668
+ if (typeof option === "boolean") {
669
+ return option;
670
+ }
671
+ if (!resolvedConfig) {
672
+ return false;
673
+ }
674
+ if (resolvedConfig.command === "serve") {
675
+ return true;
676
+ }
677
+ if (resolvedConfig.command === "build" && _optionalChain([resolvedConfig, 'access', _25 => _25.build, 'optionalAccess', _26 => _26.watch])) {
678
+ return true;
679
+ }
680
+ return false;
681
+ }
664
682
  function createGenerateBundleHook(context) {
665
683
  const state = {
666
684
  iteration: 0,
@@ -697,17 +715,20 @@ function createGenerateBundleHook(context) {
697
715
  debug2("start");
698
716
  onStart();
699
717
  const metrics = createEmptyMetrics();
700
- const forceRuntimeRefresh = _process2.default.env.WEAPP_TW_VITE_FORCE_RUNTIME_REFRESH === "1";
718
+ const forceRuntimeRefreshByEnv = _process2.default.env.WEAPP_TW_VITE_FORCE_RUNTIME_REFRESH === "1";
701
719
  const disableDirtyOptimization = _process2.default.env.WEAPP_TW_VITE_DISABLE_DIRTY === "1";
702
720
  const disableJsPrecheck = _process2.default.env.WEAPP_TW_VITE_DISABLE_JS_PRECHECK === "1";
703
721
  const debugCssDiff = _process2.default.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
704
722
  const entries = Object.entries(bundle);
705
723
  const dirtyEntries = computeDirtyEntries(entries, opts, state);
724
+ const forceRuntimeRefreshBySource = hasRuntimeAffectingSourceChanges(dirtyEntries.changedByType);
725
+ const forceRuntimeRefresh = forceRuntimeRefreshByEnv || forceRuntimeRefreshBySource;
706
726
  const processSets = buildProcessSets(entries, opts, dirtyEntries.changedByType, state.previousLinkedByEntry, disableDirtyOptimization);
707
727
  const processFiles = processSets.files;
708
728
  const resolvedConfig = getResolvedConfig();
709
- const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _25 => _25.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
710
- const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _26 => _26.build, 'optionalAccess', _27 => _27.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
729
+ const staleClassNameFallback = resolveViteStaleClassNameFallback(opts.staleClassNameFallback, resolvedConfig);
730
+ const rootDir = _optionalChain([resolvedConfig, 'optionalAccess', _27 => _27.root]) ? _path2.default.resolve(resolvedConfig.root) : _process2.default.cwd();
731
+ const outDir = _optionalChain([resolvedConfig, 'optionalAccess', _28 => _28.build, 'optionalAccess', _29 => _29.outDir]) ? _path2.default.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
711
732
  const jsEntries = /* @__PURE__ */ new Map();
712
733
  for (const [fileName, output] of entries) {
713
734
  const entry = { fileName, output };
@@ -720,8 +741,15 @@ function createGenerateBundleHook(context) {
720
741
  const runtimeStart = performance.now();
721
742
  const runtime = await ensureRuntimeClassSet(forceRuntimeRefresh);
722
743
  metrics.runtimeSet = measureElapsed(runtimeStart);
744
+ if (forceRuntimeRefreshBySource) {
745
+ debug2(
746
+ "runtimeSet forced refresh due to source changes: html=%d js=%d",
747
+ dirtyEntries.changedByType.html.size,
748
+ dirtyEntries.changedByType.js.size
749
+ );
750
+ }
723
751
  debug2("get runtimeSet, class count: %d", runtime.size);
724
- const runtimeSignature = _nullishCoalesce(_chunkAAVDJYEEjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
752
+ const runtimeSignature = _nullishCoalesce(_chunkBFZDZRA5js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
725
753
  const handleLinkedUpdate = (fileName, previous, next) => {
726
754
  onUpdate(fileName, previous, next);
727
755
  debug2("js linked handle: %s", fileName);
@@ -741,10 +769,11 @@ function createGenerateBundleHook(context) {
741
769
  };
742
770
  const createHandlerOptions = (absoluteFilename, extra) => ({
743
771
  ...extra,
772
+ staleClassNameFallback: _nullishCoalesce(_optionalChain([extra, 'optionalAccess', _30 => _30.staleClassNameFallback]), () => ( staleClassNameFallback)),
744
773
  filename: absoluteFilename,
745
774
  moduleGraph: moduleGraphOptions,
746
775
  babelParserOptions: {
747
- ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _28 => _28.babelParserOptions]), () => ( {})),
776
+ ..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _31 => _31.babelParserOptions]), () => ( {})),
748
777
  sourceFilename: absoluteFilename
749
778
  }
750
779
  });
@@ -965,11 +994,7 @@ function createGenerateBundleHook(context) {
965
994
  apply();
966
995
  }
967
996
  state.iteration += 1;
968
- const finalSourceHashByFile = /* @__PURE__ */ new Map();
969
- for (const [fileName, output] of entries) {
970
- finalSourceHashByFile.set(fileName, opts.cache.computeHash(readEntrySource(output)));
971
- }
972
- state.previousSourceHashByFile = finalSourceHashByFile;
997
+ state.previousSourceHashByFile = dirtyEntries.sourceHashByFile;
973
998
  state.changedByType = dirtyEntries.changedByType;
974
999
  const nextLinkedByEntry = new Map(state.previousLinkedByEntry);
975
1000
  for (const [entryFile, linkedFiles] of linkedByEntry.entries()) {
@@ -1028,7 +1053,7 @@ function createRewriteCssImportsPlugins(options) {
1028
1053
  const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
1029
1054
  return [
1030
1055
  {
1031
- name: `${_chunkAAVDJYEEjs.vitePluginName}:rewrite-css-imports`,
1056
+ name: `${_chunkBFZDZRA5js.vitePluginName}:rewrite-css-imports`,
1032
1057
  enforce: "pre",
1033
1058
  resolveId: {
1034
1059
  order: "pre",
@@ -1070,12 +1095,12 @@ function createRewriteCssImportsPlugins(options) {
1070
1095
  }
1071
1096
 
1072
1097
  // src/bundlers/vite/index.ts
1073
- var debug = _chunkAAVDJYEEjs.createDebug.call(void 0, );
1098
+ var debug = _chunkBFZDZRA5js.createDebug.call(void 0, );
1074
1099
  var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
1075
1100
  var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
1076
1101
  function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1077
1102
  const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
1078
- const opts = _chunkAAVDJYEEjs.getCompilerContext.call(void 0, options);
1103
+ const opts = _chunkBFZDZRA5js.getCompilerContext.call(void 0, options);
1079
1104
  const {
1080
1105
  disabled,
1081
1106
  customAttributes,
@@ -1100,8 +1125,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1100
1125
  if (disabledOptions.plugin) {
1101
1126
  return rewritePlugins.length ? rewritePlugins : void 0;
1102
1127
  }
1103
- const customAttributesEntities = _chunkAAVDJYEEjs.toCustomAttributesEntities.call(void 0, customAttributes);
1104
- const patchRecorderState = _chunkVEJYEJ4Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
1128
+ const customAttributesEntities = _chunkBFZDZRA5js.toCustomAttributesEntities.call(void 0, customAttributes);
1129
+ const patchRecorderState = _chunkY6OZDS7Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
1105
1130
  source: "runtime",
1106
1131
  cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
1107
1132
  });
@@ -1117,8 +1142,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1117
1142
  let runtimeRefreshSignature;
1118
1143
  let runtimeRefreshOptionsKey;
1119
1144
  function resolveRuntimeRefreshOptions() {
1120
- const configPath = _optionalChain([runtimeState, 'access', _29 => _29.twPatcher, 'access', _30 => _30.options, 'optionalAccess', _31 => _31.tailwind, 'optionalAccess', _32 => _32.config]);
1121
- const signature = _chunkAAVDJYEEjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
1145
+ const configPath = _optionalChain([runtimeState, 'access', _32 => _32.twPatcher, 'access', _33 => _33.options, 'optionalAccess', _34 => _34.tailwind, 'optionalAccess', _35 => _35.config]);
1146
+ const signature = _chunkBFZDZRA5js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
1122
1147
  const optionsKey = JSON.stringify({
1123
1148
  appType,
1124
1149
  uniAppX: Boolean(uniAppX),
@@ -1139,7 +1164,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1139
1164
  async function refreshRuntimeState(force) {
1140
1165
  const invalidation = resolveRuntimeRefreshOptions();
1141
1166
  const shouldRefresh = force || invalidation.changed;
1142
- const refreshed = await _chunkAAVDJYEEjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
1167
+ const refreshed = await _chunkBFZDZRA5js.refreshTailwindRuntimeState.call(void 0, runtimeState, {
1143
1168
  force: shouldRefresh,
1144
1169
  clearCache: force || invalidation.changed
1145
1170
  });
@@ -1160,7 +1185,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1160
1185
  }
1161
1186
  if (forceRuntimeRefresh || !runtimeSetPromise) {
1162
1187
  const invalidation = resolveRuntimeRefreshOptions();
1163
- const task2 = _chunkAAVDJYEEjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1188
+ const task2 = _chunkBFZDZRA5js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
1164
1189
  force: forceRuntimeRefresh || invalidation.changed,
1165
1190
  skipRefresh: forceRuntimeRefresh,
1166
1191
  clearCache: forceRuntimeRefresh || invalidation.changed
@@ -1196,7 +1221,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
1196
1221
  const plugins = [
1197
1222
  ...rewritePlugins,
1198
1223
  {
1199
- name: `${_chunkAAVDJYEEjs.vitePluginName}:post`,
1224
+ name: `${_chunkBFZDZRA5js.vitePluginName}:post`,
1200
1225
  enforce: "post",
1201
1226
  configResolved(config) {
1202
1227
  resolvedConfig = config;
@@ -12,7 +12,7 @@ import {
12
12
  } from "./chunk-RRHPTTCP.mjs";
13
13
  import {
14
14
  setupPatchRecorder
15
- } from "./chunk-PBA2SZ3H.mjs";
15
+ } from "./chunk-KAK3XMAW.mjs";
16
16
  import {
17
17
  collectRuntimeClassSet,
18
18
  createAttributeMatcher,
@@ -24,7 +24,7 @@ import {
24
24
  replaceWxml,
25
25
  toCustomAttributesEntities,
26
26
  vitePluginName
27
- } from "./chunk-2VVKFR3W.mjs";
27
+ } from "./chunk-OYR4XWM4.mjs";
28
28
  import {
29
29
  resolveUniUtsPlatform
30
30
  } from "./chunk-OOHJLO5M.mjs";
@@ -661,6 +661,24 @@ function createJsHashSalt(runtimeSignature, linkedImpactSignature) {
661
661
  }
662
662
  return `${runtimeSignature}:linked:${linkedImpactSignature}`;
663
663
  }
664
+ function hasRuntimeAffectingSourceChanges(changedByType) {
665
+ return changedByType.html.size > 0 || changedByType.js.size > 0;
666
+ }
667
+ function resolveViteStaleClassNameFallback(option, resolvedConfig) {
668
+ if (typeof option === "boolean") {
669
+ return option;
670
+ }
671
+ if (!resolvedConfig) {
672
+ return false;
673
+ }
674
+ if (resolvedConfig.command === "serve") {
675
+ return true;
676
+ }
677
+ if (resolvedConfig.command === "build" && resolvedConfig.build?.watch) {
678
+ return true;
679
+ }
680
+ return false;
681
+ }
664
682
  function createGenerateBundleHook(context) {
665
683
  const state = {
666
684
  iteration: 0,
@@ -697,15 +715,18 @@ function createGenerateBundleHook(context) {
697
715
  debug2("start");
698
716
  onStart();
699
717
  const metrics = createEmptyMetrics();
700
- const forceRuntimeRefresh = process2.env.WEAPP_TW_VITE_FORCE_RUNTIME_REFRESH === "1";
718
+ const forceRuntimeRefreshByEnv = process2.env.WEAPP_TW_VITE_FORCE_RUNTIME_REFRESH === "1";
701
719
  const disableDirtyOptimization = process2.env.WEAPP_TW_VITE_DISABLE_DIRTY === "1";
702
720
  const disableJsPrecheck = process2.env.WEAPP_TW_VITE_DISABLE_JS_PRECHECK === "1";
703
721
  const debugCssDiff = process2.env.WEAPP_TW_VITE_DEBUG_CSS_DIFF === "1";
704
722
  const entries = Object.entries(bundle);
705
723
  const dirtyEntries = computeDirtyEntries(entries, opts, state);
724
+ const forceRuntimeRefreshBySource = hasRuntimeAffectingSourceChanges(dirtyEntries.changedByType);
725
+ const forceRuntimeRefresh = forceRuntimeRefreshByEnv || forceRuntimeRefreshBySource;
706
726
  const processSets = buildProcessSets(entries, opts, dirtyEntries.changedByType, state.previousLinkedByEntry, disableDirtyOptimization);
707
727
  const processFiles = processSets.files;
708
728
  const resolvedConfig = getResolvedConfig();
729
+ const staleClassNameFallback = resolveViteStaleClassNameFallback(opts.staleClassNameFallback, resolvedConfig);
709
730
  const rootDir = resolvedConfig?.root ? path2.resolve(resolvedConfig.root) : process2.cwd();
710
731
  const outDir = resolvedConfig?.build?.outDir ? path2.resolve(rootDir, resolvedConfig.build.outDir) : rootDir;
711
732
  const jsEntries = /* @__PURE__ */ new Map();
@@ -720,6 +741,13 @@ function createGenerateBundleHook(context) {
720
741
  const runtimeStart = performance.now();
721
742
  const runtime = await ensureRuntimeClassSet(forceRuntimeRefresh);
722
743
  metrics.runtimeSet = measureElapsed(runtimeStart);
744
+ if (forceRuntimeRefreshBySource) {
745
+ debug2(
746
+ "runtimeSet forced refresh due to source changes: html=%d js=%d",
747
+ dirtyEntries.changedByType.html.size,
748
+ dirtyEntries.changedByType.js.size
749
+ );
750
+ }
723
751
  debug2("get runtimeSet, class count: %d", runtime.size);
724
752
  const runtimeSignature = getRuntimeClassSetSignature(runtimeState.twPatcher) ?? "runtime:missing";
725
753
  const handleLinkedUpdate = (fileName, previous, next) => {
@@ -741,6 +769,7 @@ function createGenerateBundleHook(context) {
741
769
  };
742
770
  const createHandlerOptions = (absoluteFilename, extra) => ({
743
771
  ...extra,
772
+ staleClassNameFallback: extra?.staleClassNameFallback ?? staleClassNameFallback,
744
773
  filename: absoluteFilename,
745
774
  moduleGraph: moduleGraphOptions,
746
775
  babelParserOptions: {
@@ -965,11 +994,7 @@ function createGenerateBundleHook(context) {
965
994
  apply();
966
995
  }
967
996
  state.iteration += 1;
968
- const finalSourceHashByFile = /* @__PURE__ */ new Map();
969
- for (const [fileName, output] of entries) {
970
- finalSourceHashByFile.set(fileName, opts.cache.computeHash(readEntrySource(output)));
971
- }
972
- state.previousSourceHashByFile = finalSourceHashByFile;
997
+ state.previousSourceHashByFile = dirtyEntries.sourceHashByFile;
973
998
  state.changedByType = dirtyEntries.changedByType;
974
999
  const nextLinkedByEntry = new Map(state.previousLinkedByEntry);
975
1000
  for (const [entryFile, linkedFiles] of linkedByEntry.entries()) {