weapp-tailwindcss 4.11.0-alpha.1 → 4.11.0-alpha.2
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-35EI5JMK.mjs → chunk-23K4XDKF.mjs} +3 -1
- package/dist/{chunk-W2EMGF7H.js → chunk-2W24MRCQ.js} +10 -12
- package/dist/chunk-4AFQP74Z.js +24 -0
- package/dist/{chunk-SQG2MOFQ.js → chunk-4TTPYMVM.js} +12 -8
- package/dist/{chunk-4LPOQMFS.js → chunk-5KSBT6GU.js} +396 -219
- package/dist/{chunk-LD7LZ4IK.mjs → chunk-66E76FQE.mjs} +91 -50
- package/dist/{chunk-GWDHNCL2.js → chunk-6O7HJU2F.js} +123 -42
- package/dist/{chunk-RRHPTTCP.mjs → chunk-76S2EME4.mjs} +2 -0
- package/dist/{chunk-G3G437UE.js → chunk-7LKMJZD2.js} +2 -2
- package/dist/{chunk-OV7FX6XR.js → chunk-CRDOWYG4.js} +1 -1
- package/dist/{chunk-DOH7FULQ.mjs → chunk-EFBQ4SQR.mjs} +1 -1
- package/dist/{chunk-IEZ5RBMG.mjs → chunk-EW2K6CO5.mjs} +365 -188
- package/dist/{chunk-FZNYV7VH.mjs → chunk-HADJCWHU.mjs} +212 -258
- package/dist/{chunk-CZLXTEHN.js → chunk-K7CZXT46.js} +132 -91
- package/dist/{chunk-ACTJYB33.js → chunk-LL3QUKJI.js} +3 -1
- package/dist/{chunk-G5NLM3AL.js → chunk-LYGLQCWI.js} +278 -324
- package/dist/{chunk-LTJQUORK.js → chunk-OF6MFURR.js} +2 -0
- package/dist/{chunk-KKT2DKMW.mjs → chunk-RED7Y22U.mjs} +91 -10
- package/dist/{chunk-R6KEYO3F.mjs → chunk-SJ3SG6DU.mjs} +5 -1
- package/dist/{chunk-JBM3HGHP.mjs → chunk-UCUAXK7F.mjs} +4 -6
- package/dist/cli.js +1006 -147
- package/dist/cli.mjs +942 -107
- package/dist/core.d.mts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +9 -11
- package/dist/core.mjs +6 -8
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +3 -3
- package/dist/css-macro.mjs +4 -4
- package/dist/defaults.d.mts +2 -2
- package/dist/defaults.d.ts +2 -2
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/gulp.d.mts +2 -2
- package/dist/gulp.d.ts +2 -2
- package/dist/gulp.js +7 -8
- package/dist/gulp.mjs +6 -7
- package/dist/{index-t_VBjwYm.d.ts → index-BMwzhITq.d.mts} +6 -6
- package/dist/{index-t_VBjwYm.d.mts → index-BMwzhITq.d.ts} +6 -6
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +11 -12
- package/dist/index.mjs +9 -10
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.d.mts +2 -2
- package/dist/presets.d.ts +2 -2
- package/dist/presets.js +5 -5
- package/dist/presets.mjs +2 -2
- package/dist/reset.js +1 -1
- package/dist/reset.mjs +1 -1
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +2 -2
- package/dist/vite.d.ts +2 -2
- package/dist/vite.js +8 -9
- package/dist/vite.mjs +6 -7
- package/dist/weapp-tw-css-import-rewrite-loader.js +3 -1
- package/dist/weapp-tw-runtime-classset-loader.js +29 -2
- package/dist/webpack.d.mts +2 -2
- package/dist/webpack.d.ts +2 -2
- package/dist/webpack.js +9 -10
- package/dist/webpack.mjs +7 -8
- package/dist/webpack4.d.mts +2 -2
- package/dist/webpack4.d.ts +2 -2
- package/dist/webpack4.js +41 -41
- package/dist/webpack4.mjs +12 -12
- package/package.json +8 -8
- package/dist/chunk-NOKJXG3W.js +0 -29
- package/dist/chunk-QYZCRG7F.mjs +0 -29
|
@@ -4,6 +4,7 @@ async function processCachedTask({
|
|
|
4
4
|
cacheKey,
|
|
5
5
|
hashKey = cacheKey,
|
|
6
6
|
rawSource,
|
|
7
|
+
hash,
|
|
7
8
|
readCache,
|
|
8
9
|
applyResult,
|
|
9
10
|
transform,
|
|
@@ -14,6 +15,7 @@ async function processCachedTask({
|
|
|
14
15
|
key: cacheKey,
|
|
15
16
|
hashKey,
|
|
16
17
|
rawSource,
|
|
18
|
+
hash,
|
|
17
19
|
resolveCache: readCache,
|
|
18
20
|
async onCacheHit(value) {
|
|
19
21
|
cacheHit = true;
|
|
@@ -5,12 +5,13 @@ import {
|
|
|
5
5
|
ensureMpxTailwindcssAliases,
|
|
6
6
|
getCacheKey,
|
|
7
7
|
hasLoaderEntry,
|
|
8
|
+
hasWatchChanges,
|
|
8
9
|
injectMpxCssRewritePreRules,
|
|
9
10
|
isCssLikeModuleResource,
|
|
10
11
|
isMpx,
|
|
11
12
|
patchMpxLoaderResolve,
|
|
12
13
|
setupMpxTailwindcssRedirect
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SJ3SG6DU.mjs";
|
|
14
15
|
import {
|
|
15
16
|
pushConcurrentTaskFactories,
|
|
16
17
|
resolveDisabledOptions,
|
|
@@ -20,23 +21,24 @@ import {
|
|
|
20
21
|
} from "./chunk-F2CKKG6Q.mjs";
|
|
21
22
|
import {
|
|
22
23
|
processCachedTask
|
|
23
|
-
} from "./chunk-
|
|
24
|
-
import {
|
|
25
|
-
setupPatchRecorder
|
|
26
|
-
} from "./chunk-QYZCRG7F.mjs";
|
|
24
|
+
} from "./chunk-76S2EME4.mjs";
|
|
27
25
|
import {
|
|
28
26
|
createDebug,
|
|
29
27
|
ensureRuntimeClassSet,
|
|
30
28
|
getCompilerContext,
|
|
29
|
+
pluginName,
|
|
30
|
+
setupPatchRecorder
|
|
31
|
+
} from "./chunk-HADJCWHU.mjs";
|
|
32
|
+
import {
|
|
31
33
|
getRuntimeClassSetSignature,
|
|
32
|
-
|
|
33
|
-
} from "./chunk-
|
|
34
|
+
resolveTailwindcssOptions
|
|
35
|
+
} from "./chunk-EW2K6CO5.mjs";
|
|
34
36
|
import {
|
|
35
37
|
getGroupedEntries
|
|
36
38
|
} from "./chunk-OOHJLO5M.mjs";
|
|
37
39
|
import {
|
|
38
40
|
__dirname
|
|
39
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-EFBQ4SQR.mjs";
|
|
40
42
|
|
|
41
43
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
42
44
|
import process3 from "process";
|
|
@@ -56,6 +58,9 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
56
58
|
options: compilerOptions,
|
|
57
59
|
appType,
|
|
58
60
|
runtimeState,
|
|
61
|
+
getRuntimeRefreshRequirement,
|
|
62
|
+
refreshRuntimeMetadata,
|
|
63
|
+
consumeRuntimeRefreshRequirement,
|
|
59
64
|
debug: debug2
|
|
60
65
|
} = options;
|
|
61
66
|
const { Compilation, sources } = compiler.webpack;
|
|
@@ -153,12 +158,18 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
153
158
|
return created;
|
|
154
159
|
};
|
|
155
160
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
161
|
+
const forceRuntimeRefresh = getRuntimeRefreshRequirement();
|
|
162
|
+
debug2("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, runtimeState.twPatcher.majorVersion ?? "unknown");
|
|
156
163
|
const runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
164
|
+
forceRefresh: forceRuntimeRefresh,
|
|
157
165
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
158
166
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
159
167
|
forceCollect: true,
|
|
168
|
+
clearCache: forceRuntimeRefresh,
|
|
160
169
|
allowEmpty: false
|
|
161
170
|
});
|
|
171
|
+
await refreshRuntimeMetadata(forceRuntimeRefresh);
|
|
172
|
+
consumeRuntimeRefreshRequirement();
|
|
162
173
|
const defaultTemplateHandlerOptions = {
|
|
163
174
|
runtimeSet
|
|
164
175
|
};
|
|
@@ -302,6 +313,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
302
313
|
runtimeLoaderPath,
|
|
303
314
|
runtimeCssImportRewriteLoaderPath,
|
|
304
315
|
getClassSetInLoader,
|
|
316
|
+
getRuntimeWatchDependencies,
|
|
305
317
|
debug: debug2
|
|
306
318
|
} = options;
|
|
307
319
|
const isMpxApp = isMpx(appType);
|
|
@@ -317,7 +329,8 @@ function setupWebpackV5Loaders(options) {
|
|
|
317
329
|
appType
|
|
318
330
|
} : void 0;
|
|
319
331
|
const classSetLoaderOptions = {
|
|
320
|
-
getClassSet: getClassSetInLoader
|
|
332
|
+
getClassSet: getClassSetInLoader,
|
|
333
|
+
getWatchDependencies: getRuntimeWatchDependencies
|
|
321
334
|
};
|
|
322
335
|
const { findRewriteAnchor, findClassSetAnchor } = createLoaderAnchorFinders(appType);
|
|
323
336
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
@@ -445,9 +458,63 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
445
458
|
};
|
|
446
459
|
let runtimeSetPrepared = false;
|
|
447
460
|
let runtimeSetSignature;
|
|
461
|
+
let runtimeRefreshRequiredForCompilation = false;
|
|
462
|
+
const runtimeWatchDependencyFiles = /* @__PURE__ */ new Set();
|
|
463
|
+
const runtimeWatchDependencyContexts = /* @__PURE__ */ new Set();
|
|
464
|
+
let runtimeMetadataPrepared = false;
|
|
465
|
+
const updateRuntimeWatchDependencies = async () => {
|
|
466
|
+
runtimeWatchDependencyFiles.clear();
|
|
467
|
+
runtimeWatchDependencyContexts.clear();
|
|
468
|
+
const tailwindOptions = resolveTailwindcssOptions(runtimeState.twPatcher.options);
|
|
469
|
+
if (tailwindOptions?.config) {
|
|
470
|
+
runtimeWatchDependencyFiles.add(tailwindOptions.config);
|
|
471
|
+
}
|
|
472
|
+
for (const entry of tailwindOptions?.v4?.cssEntries ?? []) {
|
|
473
|
+
runtimeWatchDependencyFiles.add(entry);
|
|
474
|
+
}
|
|
475
|
+
for (const source of tailwindOptions?.v4?.sources ?? []) {
|
|
476
|
+
if (source?.base) {
|
|
477
|
+
runtimeWatchDependencyContexts.add(source.base);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (typeof runtimeState.twPatcher.collectContentTokens !== "function") {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
try {
|
|
484
|
+
const report = await runtimeState.twPatcher.collectContentTokens();
|
|
485
|
+
for (const entry of report.entries ?? []) {
|
|
486
|
+
if (entry.file) {
|
|
487
|
+
runtimeWatchDependencyFiles.add(entry.file);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
for (const source of report.sources ?? []) {
|
|
491
|
+
if (source?.base) {
|
|
492
|
+
runtimeWatchDependencyContexts.add(source.base);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
} catch (error) {
|
|
496
|
+
debug("collect runtime watch dependencies failed: %O", error);
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
const ensureRuntimeMetadata = async (force = false) => {
|
|
500
|
+
if (runtimeMetadataPrepared && !force) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
await updateRuntimeWatchDependencies();
|
|
504
|
+
runtimeMetadataPrepared = true;
|
|
505
|
+
};
|
|
506
|
+
const syncRuntimeRefreshRequirement = () => {
|
|
507
|
+
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || hasWatchChanges(compiler);
|
|
508
|
+
};
|
|
448
509
|
const resetRuntimePreparation = () => {
|
|
449
510
|
runtimeSetPrepared = false;
|
|
511
|
+
runtimeMetadataPrepared = false;
|
|
512
|
+
syncRuntimeRefreshRequirement();
|
|
450
513
|
};
|
|
514
|
+
compiler.hooks.invalid?.tap?.(pluginName, () => {
|
|
515
|
+
runtimeRefreshRequiredForCompilation = true;
|
|
516
|
+
});
|
|
517
|
+
compiler.hooks.watchRun?.tap?.(pluginName, syncRuntimeRefreshRequirement);
|
|
451
518
|
if (compiler.hooks.thisCompilation?.tap) {
|
|
452
519
|
compiler.hooks.thisCompilation.tap(pluginName, resetRuntimePreparation);
|
|
453
520
|
} else if (compiler.hooks.compilation?.tap) {
|
|
@@ -458,7 +525,8 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
458
525
|
return;
|
|
459
526
|
}
|
|
460
527
|
const signature = getRuntimeClassSetSignature(runtimeState.twPatcher);
|
|
461
|
-
const forceRefresh = signature !== runtimeSetSignature;
|
|
528
|
+
const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
|
|
529
|
+
debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
|
|
462
530
|
runtimeSetPrepared = true;
|
|
463
531
|
await ensureRuntimeClassSet(runtimeState, {
|
|
464
532
|
forceRefresh,
|
|
@@ -466,7 +534,9 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
466
534
|
clearCache: forceRefresh,
|
|
467
535
|
allowEmpty: true
|
|
468
536
|
});
|
|
537
|
+
await ensureRuntimeMetadata(forceRefresh);
|
|
469
538
|
runtimeSetSignature = signature;
|
|
539
|
+
runtimeRefreshRequiredForCompilation = false;
|
|
470
540
|
}
|
|
471
541
|
onLoad();
|
|
472
542
|
setupWebpackV5Loaders({
|
|
@@ -478,6 +548,12 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
478
548
|
runtimeLoaderPath,
|
|
479
549
|
runtimeCssImportRewriteLoaderPath,
|
|
480
550
|
getClassSetInLoader,
|
|
551
|
+
getRuntimeWatchDependencies() {
|
|
552
|
+
return {
|
|
553
|
+
files: runtimeWatchDependencyFiles,
|
|
554
|
+
contexts: runtimeWatchDependencyContexts
|
|
555
|
+
};
|
|
556
|
+
},
|
|
481
557
|
debug
|
|
482
558
|
});
|
|
483
559
|
setupWebpackV5ProcessAssetsHook({
|
|
@@ -485,6 +561,11 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
485
561
|
options: this.options,
|
|
486
562
|
appType: this.appType,
|
|
487
563
|
runtimeState,
|
|
564
|
+
getRuntimeRefreshRequirement: () => runtimeRefreshRequiredForCompilation,
|
|
565
|
+
refreshRuntimeMetadata: ensureRuntimeMetadata,
|
|
566
|
+
consumeRuntimeRefreshRequirement() {
|
|
567
|
+
runtimeRefreshRequiredForCompilation = false;
|
|
568
|
+
},
|
|
488
569
|
debug
|
|
489
570
|
});
|
|
490
571
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-F2CKKG6Q.mjs";
|
|
4
4
|
import {
|
|
5
5
|
pluginName
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-HADJCWHU.mjs";
|
|
7
7
|
|
|
8
8
|
// src/shared/mpx.ts
|
|
9
9
|
import path2 from "path";
|
|
@@ -235,6 +235,9 @@ function createAssetHashByChunkMap(chunks) {
|
|
|
235
235
|
}
|
|
236
236
|
return hashByFile;
|
|
237
237
|
}
|
|
238
|
+
function hasWatchChanges(compiler) {
|
|
239
|
+
return (compiler.modifiedFiles?.size ?? 0) > 0 || (compiler.removedFiles?.size ?? 0) > 0;
|
|
240
|
+
}
|
|
238
241
|
|
|
239
242
|
// src/bundlers/webpack/shared/loader-anchors.ts
|
|
240
243
|
var MPX_STRIP_CONDITIONAL_LOADER = "@mpxjs/webpack-plugin/lib/style-compiler/strip-conditional-loader";
|
|
@@ -284,5 +287,6 @@ export {
|
|
|
284
287
|
isCssLikeModuleResource,
|
|
285
288
|
hasLoaderEntry,
|
|
286
289
|
createAssetHashByChunkMap,
|
|
290
|
+
hasWatchChanges,
|
|
287
291
|
createLoaderAnchorFinders
|
|
288
292
|
};
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
processCachedTask
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import {
|
|
5
|
-
setupPatchRecorder
|
|
6
|
-
} from "./chunk-QYZCRG7F.mjs";
|
|
3
|
+
} from "./chunk-76S2EME4.mjs";
|
|
7
4
|
import {
|
|
8
5
|
createDebug,
|
|
9
6
|
ensureRuntimeClassSet,
|
|
10
7
|
getCompilerContext,
|
|
11
|
-
refreshTailwindRuntimeState
|
|
12
|
-
|
|
8
|
+
refreshTailwindRuntimeState,
|
|
9
|
+
setupPatchRecorder
|
|
10
|
+
} from "./chunk-HADJCWHU.mjs";
|
|
13
11
|
|
|
14
12
|
// src/bundlers/gulp/index.ts
|
|
15
13
|
import { Buffer } from "buffer";
|