weapp-tailwindcss 4.11.0-alpha.4 → 4.11.0-alpha.6
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.
- package/dist/{chunk-GCZ7ZE7V.js → chunk-4BHL5BDO.js} +31 -31
- package/dist/{chunk-N3RT3VZH.js → chunk-DO6MQ3YF.js} +364 -74
- package/dist/{chunk-JKK5KZCN.js → chunk-KWG7VWW5.js} +3 -3
- package/dist/{chunk-TDHY27WS.mjs → chunk-LYANBRNN.mjs} +1 -1
- package/dist/{chunk-3V52XTPJ.mjs → chunk-OMARW5NC.mjs} +50 -0
- package/dist/{chunk-FI75TLOQ.js → chunk-QK6VNNNL.js} +51 -1
- package/dist/{chunk-NYZTRTBM.mjs → chunk-RQLIVYJZ.mjs} +331 -41
- package/dist/{chunk-ZPGT5C7G.mjs → chunk-TSRWDW6S.mjs} +1 -1
- package/dist/{chunk-JOT24YET.mjs → chunk-VMKFA54Q.mjs} +10 -4
- package/dist/{chunk-VHUV7ZDB.js → chunk-VO5STL3U.js} +6 -6
- package/dist/{chunk-VO2ZPNCW.js → chunk-WPH7LL5V.js} +23 -17
- package/dist/{chunk-6R2OVCLW.mjs → chunk-ZMQZ667Q.mjs} +3 -3
- package/dist/cli.js +2 -1
- package/dist/cli.mjs +2 -1
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +7 -7
- package/dist/core.mjs +2 -2
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +4 -4
- package/dist/gulp.mjs +3 -3
- package/dist/{index-BMwzhITq.d.mts → index-D8E0GGqB.d.mts} +28 -2
- package/dist/{index-BMwzhITq.d.ts → index-D8E0GGqB.d.ts} +28 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/dist/presets.d.mts +36 -1
- package/dist/presets.d.ts +36 -1
- package/dist/presets.js +14 -5
- package/dist/presets.mjs +12 -3
- package/dist/types.d.mts +2 -2
- package/dist/types.d.ts +2 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +5 -5
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +26 -26
- package/dist/webpack4.mjs +3 -3
- package/package.json +2 -1
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkKWG7VWW5js = require('./chunk-KWG7VWW5.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -28,11 +28,11 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
|
-
var
|
|
31
|
+
var _chunkWPH7LL5Vjs = require('./chunk-WPH7LL5V.js');
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
var
|
|
35
|
+
var _chunkQK6VNNNLjs = require('./chunk-QK6VNNNL.js');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
@@ -63,10 +63,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
63
63
|
const { Compilation, sources } = compiler.webpack;
|
|
64
64
|
const { ConcatSource } = sources;
|
|
65
65
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
66
|
-
compiler.hooks.compilation.tap(
|
|
66
|
+
compiler.hooks.compilation.tap(_chunkWPH7LL5Vjs.pluginName, (compilation) => {
|
|
67
67
|
compilation.hooks.processAssets.tapPromise(
|
|
68
68
|
{
|
|
69
|
-
name:
|
|
69
|
+
name: _chunkWPH7LL5Vjs.pluginName,
|
|
70
70
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
71
71
|
},
|
|
72
72
|
async (assets) => {
|
|
@@ -78,7 +78,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
78
78
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const assetHashByChunk =
|
|
81
|
+
const assetHashByChunk = _chunkKWG7VWW5js.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
82
82
|
const entries = Object.entries(assets);
|
|
83
83
|
const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
|
|
84
84
|
const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
|
|
@@ -157,7 +157,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
157
157
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
158
158
|
const forceRuntimeRefresh = getRuntimeRefreshRequirement();
|
|
159
159
|
debug2("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, _nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown")));
|
|
160
|
-
const runtimeSet = await
|
|
160
|
+
const runtimeSet = await _chunkWPH7LL5Vjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
161
161
|
forceRefresh: forceRuntimeRefresh,
|
|
162
162
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
163
163
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
@@ -207,7 +207,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
207
207
|
const jsTaskFactories = [];
|
|
208
208
|
if (Array.isArray(groupedEntries.js)) {
|
|
209
209
|
for (const [file] of groupedEntries.js) {
|
|
210
|
-
const cacheKey =
|
|
210
|
+
const cacheKey = _chunkKWG7VWW5js.getCacheKey.call(void 0, file);
|
|
211
211
|
const asset = compilation.getAsset(file);
|
|
212
212
|
if (!asset) {
|
|
213
213
|
continue;
|
|
@@ -313,9 +313,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
313
313
|
getRuntimeWatchDependencies,
|
|
314
314
|
debug: debug2
|
|
315
315
|
} = options;
|
|
316
|
-
const isMpxApp =
|
|
316
|
+
const isMpxApp = _chunkKWG7VWW5js.isMpx.call(void 0, appType);
|
|
317
317
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
318
|
-
|
|
318
|
+
_chunkKWG7VWW5js.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
319
319
|
}
|
|
320
320
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
321
321
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -329,12 +329,12 @@ function setupWebpackV5Loaders(options) {
|
|
|
329
329
|
getClassSet: getClassSetInLoader,
|
|
330
330
|
getWatchDependencies: getRuntimeWatchDependencies
|
|
331
331
|
};
|
|
332
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
332
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkKWG7VWW5js.createLoaderAnchorFinders.call(void 0, appType);
|
|
333
333
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
334
334
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
335
335
|
} : void 0;
|
|
336
336
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
337
|
-
|
|
337
|
+
_chunkKWG7VWW5js.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
338
338
|
}
|
|
339
339
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
340
340
|
loader: runtimeClassSetLoader,
|
|
@@ -354,17 +354,17 @@ function setupWebpackV5Loaders(options) {
|
|
|
354
354
|
};
|
|
355
355
|
};
|
|
356
356
|
const { NormalModule } = compiler.webpack;
|
|
357
|
-
compiler.hooks.compilation.tap(
|
|
358
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
357
|
+
compiler.hooks.compilation.tap(_chunkWPH7LL5Vjs.pluginName, (compilation) => {
|
|
358
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkWPH7LL5Vjs.pluginName, (_loaderContext, module) => {
|
|
359
359
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
360
360
|
if (!hasRuntimeLoader) {
|
|
361
361
|
return;
|
|
362
362
|
}
|
|
363
|
-
|
|
363
|
+
_chunkKWG7VWW5js.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
|
|
364
364
|
const loaderEntries = module.loaders || [];
|
|
365
365
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
366
366
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
367
|
-
const isCssModule =
|
|
367
|
+
const isCssModule = _chunkKWG7VWW5js.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
368
368
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
369
369
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
370
370
|
}
|
|
@@ -396,7 +396,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
396
396
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
if (runtimeClassSetLoaderExists && !
|
|
399
|
+
if (runtimeClassSetLoaderExists && !_chunkKWG7VWW5js.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
400
400
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
401
401
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
402
402
|
if (anchorIndex === -1) {
|
|
@@ -411,11 +411,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
411
411
|
}
|
|
412
412
|
|
|
413
413
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
414
|
-
var debug =
|
|
414
|
+
var debug = _chunkWPH7LL5Vjs.createDebug.call(void 0, );
|
|
415
415
|
var weappTailwindcssPackageDir = _chunk7LKMJZD2js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
416
416
|
var UnifiedWebpackPluginV5 = class {
|
|
417
417
|
constructor(options = {}) {
|
|
418
|
-
this.options =
|
|
418
|
+
this.options = _chunkWPH7LL5Vjs.getCompilerContext.call(void 0, options);
|
|
419
419
|
this.appType = this.options.appType;
|
|
420
420
|
}
|
|
421
421
|
apply(compiler) {
|
|
@@ -431,19 +431,19 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
431
431
|
const disabledOptions = _chunk7LKMJZD2js.resolveDisabledOptions.call(void 0, disabled);
|
|
432
432
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
433
433
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
434
|
-
const isMpxApp =
|
|
434
|
+
const isMpxApp = _chunkKWG7VWW5js.isMpx.call(void 0, this.appType);
|
|
435
435
|
if (shouldRewriteCssImports) {
|
|
436
|
-
|
|
436
|
+
_chunkKWG7VWW5js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
437
437
|
pkgDir: weappTailwindcssPackageDir,
|
|
438
438
|
enabled: true,
|
|
439
439
|
appType: this.appType
|
|
440
440
|
});
|
|
441
|
-
|
|
441
|
+
_chunkKWG7VWW5js.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
442
442
|
}
|
|
443
443
|
if (disabledOptions.plugin) {
|
|
444
444
|
return;
|
|
445
445
|
}
|
|
446
|
-
const patchRecorderState =
|
|
446
|
+
const patchRecorderState = _chunkWPH7LL5Vjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
447
447
|
source: "runtime",
|
|
448
448
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
449
449
|
});
|
|
@@ -462,7 +462,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
462
462
|
const updateRuntimeWatchDependencies = async () => {
|
|
463
463
|
runtimeWatchDependencyFiles.clear();
|
|
464
464
|
runtimeWatchDependencyContexts.clear();
|
|
465
|
-
const tailwindOptions =
|
|
465
|
+
const tailwindOptions = _chunkQK6VNNNLjs.resolveTailwindcssOptions.call(void 0, runtimeState.twPatcher.options);
|
|
466
466
|
if (_optionalChain([tailwindOptions, 'optionalAccess', _13 => _13.config])) {
|
|
467
467
|
runtimeWatchDependencyFiles.add(tailwindOptions.config);
|
|
468
468
|
}
|
|
@@ -501,31 +501,31 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
501
501
|
runtimeMetadataPrepared = true;
|
|
502
502
|
};
|
|
503
503
|
const syncRuntimeRefreshRequirement = () => {
|
|
504
|
-
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation ||
|
|
504
|
+
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || _chunkKWG7VWW5js.hasWatchChanges.call(void 0, compiler);
|
|
505
505
|
};
|
|
506
506
|
const resetRuntimePreparation = () => {
|
|
507
507
|
runtimeSetPrepared = false;
|
|
508
508
|
runtimeMetadataPrepared = false;
|
|
509
509
|
syncRuntimeRefreshRequirement();
|
|
510
510
|
};
|
|
511
|
-
_optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(
|
|
511
|
+
_optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(_chunkWPH7LL5Vjs.pluginName, () => {
|
|
512
512
|
runtimeRefreshRequiredForCompilation = true;
|
|
513
513
|
})]);
|
|
514
|
-
_optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(
|
|
514
|
+
_optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(_chunkWPH7LL5Vjs.pluginName, syncRuntimeRefreshRequirement)]);
|
|
515
515
|
if (_optionalChain([compiler, 'access', _28 => _28.hooks, 'access', _29 => _29.thisCompilation, 'optionalAccess', _30 => _30.tap])) {
|
|
516
|
-
compiler.hooks.thisCompilation.tap(
|
|
516
|
+
compiler.hooks.thisCompilation.tap(_chunkWPH7LL5Vjs.pluginName, resetRuntimePreparation);
|
|
517
517
|
} else if (_optionalChain([compiler, 'access', _31 => _31.hooks, 'access', _32 => _32.compilation, 'optionalAccess', _33 => _33.tap])) {
|
|
518
|
-
compiler.hooks.compilation.tap(
|
|
518
|
+
compiler.hooks.compilation.tap(_chunkWPH7LL5Vjs.pluginName, resetRuntimePreparation);
|
|
519
519
|
}
|
|
520
520
|
async function getClassSetInLoader() {
|
|
521
521
|
if (runtimeSetPrepared) {
|
|
522
522
|
return;
|
|
523
523
|
}
|
|
524
|
-
const signature =
|
|
524
|
+
const signature = _chunkQK6VNNNLjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
525
525
|
const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
|
|
526
526
|
debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
|
|
527
527
|
runtimeSetPrepared = true;
|
|
528
|
-
await
|
|
528
|
+
await _chunkWPH7LL5Vjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
529
529
|
forceRefresh,
|
|
530
530
|
forceCollect: true,
|
|
531
531
|
clearCache: forceRefresh,
|