weapp-tailwindcss 4.10.0-beta.4 → 4.10.0-beta.5

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.
@@ -8,7 +8,11 @@ function createNegativeMediaQuery(value) {
8
8
  }
9
9
  function normalComment(text) {
10
10
  if (typeof text === "string") {
11
- return text.replaceAll(/(?<!\\)_/g, " ");
11
+ const normalized = text.replaceAll(/(?<!\\)_/g, " ").replaceAll(/\s+/g, " ").trim();
12
+ if (normalized.includes("\\")) {
13
+ return normalized;
14
+ }
15
+ return normalized.replaceAll(/\s*(\|\||&&)\s*/g, " $1 ").replaceAll(/\s+/g, " ").trim();
12
16
  }
13
17
  return text;
14
18
  }
@@ -10,7 +10,7 @@ import {
10
10
  isMpx,
11
11
  patchMpxLoaderResolve,
12
12
  setupMpxTailwindcssRedirect
13
- } from "./chunk-JP45MK3F.mjs";
13
+ } from "./chunk-SGPYGQ6Z.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-KAK3XMAW.mjs";
26
+ } from "./chunk-BG6EFR2X.mjs";
27
27
  import {
28
28
  createDebug,
29
29
  ensureRuntimeClassSet,
30
30
  getCompilerContext,
31
31
  getRuntimeClassSetSignature,
32
32
  pluginName
33
- } from "./chunk-OYR4XWM4.mjs";
33
+ } from "./chunk-KTKHUVCE.mjs";
34
34
  import {
35
35
  getGroupedEntries
36
36
  } from "./chunk-OOHJLO5M.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createPatchTargetRecorder,
3
3
  createTailwindPatchPromise
4
- } from "./chunk-OYR4XWM4.mjs";
4
+ } from "./chunk-KTKHUVCE.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 _chunkGQVBN7UTjs = require('./chunk-GQVBN7UT.js');
13
+ var _chunkNESY7YODjs = require('./chunk-NESY7YOD.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 _chunkY6OZDS7Vjs = require('./chunk-Y6OZDS7V.js');
26
+ var _chunkFVUZDDYHjs = require('./chunk-FVUZDDYH.js');
27
27
 
28
28
 
29
29
 
30
30
 
31
31
 
32
32
 
33
- var _chunkBFZDZRA5js = require('./chunk-BFZDZRA5.js');
33
+ var _chunkDFA5DHMZjs = require('./chunk-DFA5DHMZ.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(_chunkBFZDZRA5js.pluginName, (compilation) => {
54
+ compiler.hooks.compilation.tap(_chunkDFA5DHMZjs.pluginName, (compilation) => {
55
55
  compilation.hooks.processAssets.tapPromise(
56
56
  {
57
- name: _chunkBFZDZRA5js.pluginName,
57
+ name: _chunkDFA5DHMZjs.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 = _chunkGQVBN7UTjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
69
+ const assetHashByChunk = _chunkNESY7YODjs.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 _chunkBFZDZRA5js.ensureRuntimeClassSet.call(void 0, runtimeState, {
125
+ const runtimeSet = await _chunkDFA5DHMZjs.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 = _chunkGQVBN7UTjs.getCacheKey.call(void 0, file);
168
+ const cacheKey = _chunkNESY7YODjs.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 = _chunkGQVBN7UTjs.isMpx.call(void 0, appType);
279
+ const isMpxApp = _chunkNESY7YODjs.isMpx.call(void 0, appType);
280
280
  if (shouldRewriteCssImports && isMpxApp) {
281
- _chunkGQVBN7UTjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
281
+ _chunkNESY7YODjs.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 } = _chunkGQVBN7UTjs.createLoaderAnchorFinders.call(void 0, appType);
294
+ const { findRewriteAnchor, findClassSetAnchor } = _chunkNESY7YODjs.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
- _chunkGQVBN7UTjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
299
+ _chunkNESY7YODjs.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(_chunkBFZDZRA5js.pluginName, (compilation) => {
320
- NormalModule.getCompilationHooks(compilation).loader.tap(_chunkBFZDZRA5js.pluginName, (_loaderContext, module) => {
319
+ compiler.hooks.compilation.tap(_chunkDFA5DHMZjs.pluginName, (compilation) => {
320
+ NormalModule.getCompilationHooks(compilation).loader.tap(_chunkDFA5DHMZjs.pluginName, (_loaderContext, module) => {
321
321
  const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
322
322
  if (!hasRuntimeLoader) {
323
323
  return;
324
324
  }
325
- _chunkGQVBN7UTjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
325
+ _chunkNESY7YODjs.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 = _chunkGQVBN7UTjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
329
+ const isCssModule = _chunkNESY7YODjs.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 && !_chunkGQVBN7UTjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
361
+ if (runtimeClassSetLoaderExists && !_chunkNESY7YODjs.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 = _chunkBFZDZRA5js.createDebug.call(void 0, );
376
+ var debug = _chunkDFA5DHMZjs.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 = _chunkBFZDZRA5js.getCompilerContext.call(void 0, options);
380
+ this.options = _chunkDFA5DHMZjs.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 = _chunkGQVBN7UTjs.isMpx.call(void 0, this.appType);
396
+ const isMpxApp = _chunkNESY7YODjs.isMpx.call(void 0, this.appType);
397
397
  if (shouldRewriteCssImports) {
398
- _chunkGQVBN7UTjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
398
+ _chunkNESY7YODjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
399
399
  pkgDir: weappTailwindcssPackageDir,
400
400
  enabled: true,
401
401
  appType: this.appType
402
402
  });
403
- _chunkGQVBN7UTjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
403
+ _chunkNESY7YODjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
404
404
  }
405
405
  if (disabledOptions.plugin) {
406
406
  return;
407
407
  }
408
- const patchRecorderState = _chunkY6OZDS7Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
408
+ const patchRecorderState = _chunkFVUZDDYHjs.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(_chunkBFZDZRA5js.pluginName, resetRuntimePreparation);
424
+ compiler.hooks.thisCompilation.tap(_chunkDFA5DHMZjs.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(_chunkBFZDZRA5js.pluginName, resetRuntimePreparation);
426
+ compiler.hooks.compilation.tap(_chunkDFA5DHMZjs.pluginName, resetRuntimePreparation);
427
427
  }
428
428
  async function getClassSetInLoader() {
429
429
  if (runtimeSetPrepared) {
430
430
  return;
431
431
  }
432
- const signature = _chunkBFZDZRA5js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
432
+ const signature = _chunkDFA5DHMZjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
433
433
  const forceRefresh = signature !== runtimeSetSignature;
434
434
  runtimeSetPrepared = true;
435
- await _chunkBFZDZRA5js.ensureRuntimeClassSet.call(void 0, runtimeState, {
435
+ await _chunkDFA5DHMZjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
436
436
  forceRefresh,
437
437
  forceCollect: true,
438
438
  clearCache: forceRefresh,