weapp-tailwindcss 4.10.0-beta.6 → 4.10.0-beta.8
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-FRDRNRLG.mjs → chunk-2MJBDIG6.mjs} +1 -1
- package/dist/{chunk-WHD3MV6P.mjs → chunk-5KSAXITH.mjs} +14 -4
- package/dist/{chunk-WG7YTTLQ.mjs → chunk-DE25VCQH.mjs} +1 -1
- package/dist/{chunk-O5BWCIUZ.mjs → chunk-ETIS5VGC.mjs} +1 -1
- package/dist/{chunk-YRHB75V2.mjs → chunk-J4MC6GTY.mjs} +2 -2
- package/dist/{chunk-AWQ4VAKY.js → chunk-LWU4K4A6.js} +7 -7
- package/dist/{chunk-VICP6HYY.js → chunk-N3U357CS.js} +3 -3
- package/dist/{chunk-Y7X4FXYN.js → chunk-Q6Y6ZAZJ.js} +1 -1
- package/dist/{chunk-EWYWJSJ5.js → chunk-QC2DDH25.js} +19 -17
- package/dist/{chunk-JYUUOF4L.mjs → chunk-QNEHZQ5K.mjs} +6 -4
- package/dist/{chunk-B3OAYNZY.js → chunk-QWT27QZ6.js} +3 -3
- package/dist/{chunk-S4QHZGAC.js → chunk-YI4IXATF.js} +38 -28
- package/dist/cli.js +9 -9
- package/dist/cli.mjs +1 -1
- package/dist/core.js +7 -7
- package/dist/core.mjs +2 -2
- package/dist/gulp.js +4 -4
- package/dist/gulp.mjs +3 -3
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- package/dist/webpack.js +5 -5
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.js +37 -27
- package/dist/webpack4.mjs +14 -4
- package/package.json +3 -3
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isMpx,
|
|
11
11
|
patchMpxLoaderResolve,
|
|
12
12
|
setupMpxTailwindcssRedirect
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ETIS5VGC.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-
|
|
26
|
+
} from "./chunk-2MJBDIG6.mjs";
|
|
27
27
|
import {
|
|
28
28
|
createDebug,
|
|
29
29
|
ensureRuntimeClassSet,
|
|
30
30
|
getCompilerContext,
|
|
31
31
|
getRuntimeClassSetSignature,
|
|
32
32
|
pluginName
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-DE25VCQH.mjs";
|
|
34
34
|
import {
|
|
35
35
|
getGroupedEntries
|
|
36
36
|
} from "./chunk-OOHJLO5M.mjs";
|
|
@@ -44,6 +44,12 @@ import process3 from "process";
|
|
|
44
44
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5-assets.ts
|
|
45
45
|
import path from "path";
|
|
46
46
|
import process from "process";
|
|
47
|
+
function resolveWebpackStaleClassNameFallback(option, _compiler) {
|
|
48
|
+
if (typeof option === "boolean") {
|
|
49
|
+
return option;
|
|
50
|
+
}
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
47
53
|
function setupWebpackV5ProcessAssetsHook(options) {
|
|
48
54
|
const {
|
|
49
55
|
compiler,
|
|
@@ -125,8 +131,11 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
125
131
|
}
|
|
126
132
|
};
|
|
127
133
|
const groupedEntries = getGroupedEntries(entries, compilerOptions);
|
|
134
|
+
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
128
135
|
const runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
129
|
-
|
|
136
|
+
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
137
|
+
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
138
|
+
forceCollect: true,
|
|
130
139
|
allowEmpty: false
|
|
131
140
|
});
|
|
132
141
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
@@ -195,6 +204,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
195
204
|
const currentSourceValue = currentAsset?.source.source();
|
|
196
205
|
const currentSource = typeof currentSourceValue === "string" ? currentSourceValue : currentSourceValue?.toString() ?? "";
|
|
197
206
|
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, {
|
|
207
|
+
staleClassNameFallback,
|
|
198
208
|
filename: absoluteFile,
|
|
199
209
|
moduleGraph: moduleGraphOptions,
|
|
200
210
|
babelParserOptions: {
|
|
@@ -285,7 +285,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
|
285
285
|
// package.json
|
|
286
286
|
var package_default = {
|
|
287
287
|
name: "weapp-tailwindcss",
|
|
288
|
-
version: "4.10.0-beta.
|
|
288
|
+
version: "4.10.0-beta.8",
|
|
289
289
|
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!",
|
|
290
290
|
author: "ice breaker <1324318532@qq.com>",
|
|
291
291
|
license: "MIT",
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-RRHPTTCP.mjs";
|
|
4
4
|
import {
|
|
5
5
|
setupPatchRecorder
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-2MJBDIG6.mjs";
|
|
7
7
|
import {
|
|
8
8
|
createDebug,
|
|
9
9
|
ensureRuntimeClassSet,
|
|
10
10
|
getCompilerContext,
|
|
11
11
|
refreshTailwindRuntimeState
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DE25VCQH.mjs";
|
|
13
13
|
|
|
14
14
|
// src/bundlers/gulp/index.ts
|
|
15
15
|
import { Buffer } from "buffer";
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkQWT27QZ6js = require('./chunk-QWT27QZ6.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.js');
|
|
13
13
|
|
|
14
14
|
// src/bundlers/gulp/index.ts
|
|
15
15
|
var _buffer = require('buffer');
|
|
@@ -17,12 +17,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
|
17
17
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
18
18
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
19
19
|
var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
20
|
-
var debug =
|
|
20
|
+
var debug = _chunkQ6Y6ZAZJjs.createDebug.call(void 0, );
|
|
21
21
|
var Transform = _stream2.default.Transform;
|
|
22
22
|
function createPlugins(options = {}) {
|
|
23
|
-
const opts =
|
|
23
|
+
const opts = _chunkQ6Y6ZAZJjs.getCompilerContext.call(void 0, options);
|
|
24
24
|
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
25
|
-
const patchRecorderState =
|
|
25
|
+
const patchRecorderState = _chunkQWT27QZ6js.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
26
26
|
source: "runtime",
|
|
27
27
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
28
28
|
});
|
|
@@ -36,13 +36,13 @@ function createPlugins(options = {}) {
|
|
|
36
36
|
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
37
37
|
let runtimeSetInitialized = false;
|
|
38
38
|
async function refreshRuntimeState(force) {
|
|
39
|
-
await
|
|
39
|
+
await _chunkQ6Y6ZAZJjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
40
40
|
}
|
|
41
41
|
async function refreshRuntimeSet(force = false) {
|
|
42
42
|
if (!force && runtimeSetInitialized) {
|
|
43
43
|
return runtimeSet;
|
|
44
44
|
}
|
|
45
|
-
runtimeSet = await
|
|
45
|
+
runtimeSet = await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
46
46
|
forceRefresh: force,
|
|
47
47
|
forceCollect: force,
|
|
48
48
|
clearCache: force,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.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(
|
|
158
|
-
factory.hooks.beforeResolve.tap(
|
|
157
|
+
compiler.hooks.normalModuleFactory.tap(_chunkQ6Y6ZAZJjs.pluginName, (factory) => {
|
|
158
|
+
factory.hooks.beforeResolve.tap(_chunkQ6Y6ZAZJjs.pluginName, (data) => {
|
|
159
159
|
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
160
160
|
});
|
|
161
161
|
});
|
|
@@ -285,7 +285,7 @@ async function collectRuntimeClassSet(twPatcher, options = {}) {
|
|
|
285
285
|
// package.json
|
|
286
286
|
var package_default = {
|
|
287
287
|
name: "weapp-tailwindcss",
|
|
288
|
-
version: "4.10.0-beta.
|
|
288
|
+
version: "4.10.0-beta.8",
|
|
289
289
|
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!",
|
|
290
290
|
author: "ice breaker <1324318532@qq.com>",
|
|
291
291
|
license: "MIT",
|
|
@@ -12,7 +12,7 @@ var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
|
|
|
12
12
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkQWT27QZ6js = require('./chunk-QWT27QZ6.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -24,7 +24,7 @@ var _chunkB3OAYNZYjs = require('./chunk-B3OAYNZY.js');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.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,
|
|
57
|
+
ms.update(start, end, _chunkQ6Y6ZAZJjs.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 =
|
|
69
|
+
const generated = _chunkQ6Y6ZAZJjs.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 =
|
|
98
|
+
const matchCustomAttribute = _chunkQ6Y6ZAZJjs.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) {
|
|
@@ -584,8 +584,10 @@ function buildProcessSets(entries, opts, changedByType, previousLinkedByEntry, f
|
|
|
584
584
|
linkedImpactsByEntry
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
|
-
for (const file of
|
|
588
|
-
|
|
587
|
+
for (const [file] of entries) {
|
|
588
|
+
if (classifyEntry(file, opts) === "html") {
|
|
589
|
+
processFiles.html.add(file);
|
|
590
|
+
}
|
|
589
591
|
}
|
|
590
592
|
for (const file of changedByType.css) {
|
|
591
593
|
processFiles.css.add(file);
|
|
@@ -749,7 +751,7 @@ function createGenerateBundleHook(context) {
|
|
|
749
751
|
);
|
|
750
752
|
}
|
|
751
753
|
debug2("get runtimeSet, class count: %d", runtime.size);
|
|
752
|
-
const runtimeSignature = _nullishCoalesce(
|
|
754
|
+
const runtimeSignature = _nullishCoalesce(_chunkQ6Y6ZAZJjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
|
|
753
755
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
754
756
|
onUpdate(fileName, previous, next);
|
|
755
757
|
debug2("js linked handle: %s", fileName);
|
|
@@ -1050,7 +1052,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1050
1052
|
const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
|
|
1051
1053
|
return [
|
|
1052
1054
|
{
|
|
1053
|
-
name: `${
|
|
1055
|
+
name: `${_chunkQ6Y6ZAZJjs.vitePluginName}:rewrite-css-imports`,
|
|
1054
1056
|
enforce: "pre",
|
|
1055
1057
|
resolveId: {
|
|
1056
1058
|
order: "pre",
|
|
@@ -1092,12 +1094,12 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1092
1094
|
}
|
|
1093
1095
|
|
|
1094
1096
|
// src/bundlers/vite/index.ts
|
|
1095
|
-
var debug =
|
|
1097
|
+
var debug = _chunkQ6Y6ZAZJjs.createDebug.call(void 0, );
|
|
1096
1098
|
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
1097
1099
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
1098
1100
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
1099
1101
|
const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
|
|
1100
|
-
const opts =
|
|
1102
|
+
const opts = _chunkQ6Y6ZAZJjs.getCompilerContext.call(void 0, options);
|
|
1101
1103
|
const {
|
|
1102
1104
|
disabled,
|
|
1103
1105
|
customAttributes,
|
|
@@ -1122,8 +1124,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1122
1124
|
if (disabledOptions.plugin) {
|
|
1123
1125
|
return rewritePlugins.length ? rewritePlugins : void 0;
|
|
1124
1126
|
}
|
|
1125
|
-
const customAttributesEntities =
|
|
1126
|
-
const patchRecorderState =
|
|
1127
|
+
const customAttributesEntities = _chunkQ6Y6ZAZJjs.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
1128
|
+
const patchRecorderState = _chunkQWT27QZ6js.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
1127
1129
|
source: "runtime",
|
|
1128
1130
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
1129
1131
|
});
|
|
@@ -1140,7 +1142,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1140
1142
|
let runtimeRefreshOptionsKey;
|
|
1141
1143
|
function resolveRuntimeRefreshOptions() {
|
|
1142
1144
|
const configPath = _optionalChain([runtimeState, 'access', _32 => _32.twPatcher, 'access', _33 => _33.options, 'optionalAccess', _34 => _34.tailwind, 'optionalAccess', _35 => _35.config]);
|
|
1143
|
-
const signature =
|
|
1145
|
+
const signature = _chunkQ6Y6ZAZJjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
1144
1146
|
const optionsKey = JSON.stringify({
|
|
1145
1147
|
appType,
|
|
1146
1148
|
uniAppX: Boolean(uniAppX),
|
|
@@ -1161,7 +1163,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1161
1163
|
async function refreshRuntimeState(force) {
|
|
1162
1164
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
1163
1165
|
const shouldRefresh = force || invalidation.changed;
|
|
1164
|
-
const refreshed = await
|
|
1166
|
+
const refreshed = await _chunkQ6Y6ZAZJjs.refreshTailwindRuntimeState.call(void 0, runtimeState, {
|
|
1165
1167
|
force: shouldRefresh,
|
|
1166
1168
|
clearCache: force || invalidation.changed
|
|
1167
1169
|
});
|
|
@@ -1182,7 +1184,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1182
1184
|
}
|
|
1183
1185
|
if (forceRuntimeRefresh || !runtimeSetPromise) {
|
|
1184
1186
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
1185
|
-
const task2 =
|
|
1187
|
+
const task2 = _chunkQ6Y6ZAZJjs.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
1186
1188
|
force: forceRuntimeRefresh || invalidation.changed,
|
|
1187
1189
|
skipRefresh: forceRuntimeRefresh,
|
|
1188
1190
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -1218,7 +1220,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1218
1220
|
const plugins = [
|
|
1219
1221
|
...rewritePlugins,
|
|
1220
1222
|
{
|
|
1221
|
-
name: `${
|
|
1223
|
+
name: `${_chunkQ6Y6ZAZJjs.vitePluginName}:post`,
|
|
1222
1224
|
enforce: "post",
|
|
1223
1225
|
configResolved(config) {
|
|
1224
1226
|
resolvedConfig = config;
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-RRHPTTCP.mjs";
|
|
13
13
|
import {
|
|
14
14
|
setupPatchRecorder
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-2MJBDIG6.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-
|
|
27
|
+
} from "./chunk-DE25VCQH.mjs";
|
|
28
28
|
import {
|
|
29
29
|
resolveUniUtsPlatform
|
|
30
30
|
} from "./chunk-OOHJLO5M.mjs";
|
|
@@ -584,8 +584,10 @@ function buildProcessSets(entries, opts, changedByType, previousLinkedByEntry, f
|
|
|
584
584
|
linkedImpactsByEntry
|
|
585
585
|
};
|
|
586
586
|
}
|
|
587
|
-
for (const file of
|
|
588
|
-
|
|
587
|
+
for (const [file] of entries) {
|
|
588
|
+
if (classifyEntry(file, opts) === "html") {
|
|
589
|
+
processFiles.html.add(file);
|
|
590
|
+
}
|
|
589
591
|
}
|
|
590
592
|
for (const file of changedByType.css) {
|
|
591
593
|
processFiles.css.add(file);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunk5APD2MNVjs = require('./chunk-5APD2MNV.js');
|
|
8
8
|
|
|
9
9
|
// src/tailwindcss/recorder.ts
|
|
10
10
|
function setupPatchRecorder(patcher, baseDir, options) {
|
|
11
|
-
const recorder =
|
|
11
|
+
const recorder = _chunkQ6Y6ZAZJjs.createPatchTargetRecorder.call(void 0, baseDir, patcher, options);
|
|
12
12
|
if (_optionalChain([recorder, 'optionalAccess', _ => _.message]) && _optionalChain([options, 'optionalAccess', _2 => _2.logMessage]) !== false) {
|
|
13
13
|
const prefix = _optionalChain([options, 'optionalAccess', _3 => _3.messagePrefix]) ? `${options.messagePrefix} ` : "";
|
|
14
14
|
_chunk5APD2MNVjs.logger.info("%s%s", prefix, recorder.message);
|
|
@@ -16,7 +16,7 @@ function setupPatchRecorder(patcher, baseDir, options) {
|
|
|
16
16
|
const onPatchCompleted = _optionalChain([recorder, 'optionalAccess', _4 => _4.onPatched]) ? async () => {
|
|
17
17
|
await recorder.onPatched();
|
|
18
18
|
} : void 0;
|
|
19
|
-
const patchPromise = patcher ?
|
|
19
|
+
const patchPromise = patcher ? _chunkQ6Y6ZAZJjs.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
|
|
20
20
|
return {
|
|
21
21
|
recorder,
|
|
22
22
|
patchPromise,
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkN3U357CSjs = require('./chunk-N3U357CS.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
|
|
26
|
+
var _chunkQWT27QZ6js = require('./chunk-QWT27QZ6.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
@@ -41,6 +41,12 @@ var _process = require('process'); var _process2 = _interopRequireDefault(_proce
|
|
|
41
41
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5-assets.ts
|
|
42
42
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
43
43
|
|
|
44
|
+
function resolveWebpackStaleClassNameFallback(option, _compiler) {
|
|
45
|
+
if (typeof option === "boolean") {
|
|
46
|
+
return option;
|
|
47
|
+
}
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
44
50
|
function setupWebpackV5ProcessAssetsHook(options) {
|
|
45
51
|
const {
|
|
46
52
|
compiler,
|
|
@@ -51,10 +57,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
51
57
|
} = options;
|
|
52
58
|
const { Compilation, sources } = compiler.webpack;
|
|
53
59
|
const { ConcatSource } = sources;
|
|
54
|
-
compiler.hooks.compilation.tap(
|
|
60
|
+
compiler.hooks.compilation.tap(_chunkQ6Y6ZAZJjs.pluginName, (compilation) => {
|
|
55
61
|
compilation.hooks.processAssets.tapPromise(
|
|
56
62
|
{
|
|
57
|
-
name:
|
|
63
|
+
name: _chunkQ6Y6ZAZJjs.pluginName,
|
|
58
64
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
59
65
|
},
|
|
60
66
|
async (assets) => {
|
|
@@ -66,7 +72,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
66
72
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
67
73
|
}
|
|
68
74
|
}
|
|
69
|
-
const assetHashByChunk =
|
|
75
|
+
const assetHashByChunk = _chunkN3U357CSjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
70
76
|
const entries = Object.entries(assets);
|
|
71
77
|
const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
|
|
72
78
|
const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
|
|
@@ -122,8 +128,11 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
122
128
|
}
|
|
123
129
|
};
|
|
124
130
|
const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
|
|
125
|
-
const
|
|
126
|
-
|
|
131
|
+
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
132
|
+
const runtimeSet = await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
133
|
+
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
134
|
+
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
135
|
+
forceCollect: true,
|
|
127
136
|
allowEmpty: false
|
|
128
137
|
});
|
|
129
138
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
@@ -165,7 +174,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
165
174
|
const jsTaskFactories = [];
|
|
166
175
|
if (Array.isArray(groupedEntries.js)) {
|
|
167
176
|
for (const [file] of groupedEntries.js) {
|
|
168
|
-
const cacheKey =
|
|
177
|
+
const cacheKey = _chunkN3U357CSjs.getCacheKey.call(void 0, file);
|
|
169
178
|
const asset = compilation.getAsset(file);
|
|
170
179
|
if (!asset) {
|
|
171
180
|
continue;
|
|
@@ -192,6 +201,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
192
201
|
const currentSourceValue = _optionalChain([currentAsset, 'optionalAccess', _5 => _5.source, 'access', _6 => _6.source, 'call', _7 => _7()]);
|
|
193
202
|
const currentSource = typeof currentSourceValue === "string" ? currentSourceValue : _nullishCoalesce(_optionalChain([currentSourceValue, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ( ""));
|
|
194
203
|
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, {
|
|
204
|
+
staleClassNameFallback,
|
|
195
205
|
filename: absoluteFile,
|
|
196
206
|
moduleGraph: moduleGraphOptions,
|
|
197
207
|
babelParserOptions: {
|
|
@@ -276,9 +286,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
276
286
|
getClassSetInLoader,
|
|
277
287
|
debug: debug2
|
|
278
288
|
} = options;
|
|
279
|
-
const isMpxApp =
|
|
289
|
+
const isMpxApp = _chunkN3U357CSjs.isMpx.call(void 0, appType);
|
|
280
290
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
281
|
-
|
|
291
|
+
_chunkN3U357CSjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
282
292
|
}
|
|
283
293
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
284
294
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -291,12 +301,12 @@ function setupWebpackV5Loaders(options) {
|
|
|
291
301
|
const classSetLoaderOptions = {
|
|
292
302
|
getClassSet: getClassSetInLoader
|
|
293
303
|
};
|
|
294
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
304
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkN3U357CSjs.createLoaderAnchorFinders.call(void 0, appType);
|
|
295
305
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
296
306
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
297
307
|
} : void 0;
|
|
298
308
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
299
|
-
|
|
309
|
+
_chunkN3U357CSjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
300
310
|
}
|
|
301
311
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
302
312
|
loader: runtimeClassSetLoader,
|
|
@@ -316,17 +326,17 @@ function setupWebpackV5Loaders(options) {
|
|
|
316
326
|
};
|
|
317
327
|
};
|
|
318
328
|
const { NormalModule } = compiler.webpack;
|
|
319
|
-
compiler.hooks.compilation.tap(
|
|
320
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
329
|
+
compiler.hooks.compilation.tap(_chunkQ6Y6ZAZJjs.pluginName, (compilation) => {
|
|
330
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkQ6Y6ZAZJjs.pluginName, (_loaderContext, module) => {
|
|
321
331
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
322
332
|
if (!hasRuntimeLoader) {
|
|
323
333
|
return;
|
|
324
334
|
}
|
|
325
|
-
|
|
335
|
+
_chunkN3U357CSjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
|
|
326
336
|
const loaderEntries = module.loaders || [];
|
|
327
337
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
328
338
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
329
|
-
const isCssModule =
|
|
339
|
+
const isCssModule = _chunkN3U357CSjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
330
340
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
331
341
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
332
342
|
}
|
|
@@ -358,7 +368,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
358
368
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
359
369
|
}
|
|
360
370
|
}
|
|
361
|
-
if (runtimeClassSetLoaderExists && !
|
|
371
|
+
if (runtimeClassSetLoaderExists && !_chunkN3U357CSjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
362
372
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
363
373
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
364
374
|
if (anchorIndex === -1) {
|
|
@@ -373,11 +383,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
373
383
|
}
|
|
374
384
|
|
|
375
385
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
376
|
-
var debug =
|
|
386
|
+
var debug = _chunkQ6Y6ZAZJjs.createDebug.call(void 0, );
|
|
377
387
|
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
378
388
|
var UnifiedWebpackPluginV5 = class {
|
|
379
389
|
constructor(options = {}) {
|
|
380
|
-
this.options =
|
|
390
|
+
this.options = _chunkQ6Y6ZAZJjs.getCompilerContext.call(void 0, options);
|
|
381
391
|
this.appType = this.options.appType;
|
|
382
392
|
}
|
|
383
393
|
apply(compiler) {
|
|
@@ -393,19 +403,19 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
393
403
|
const disabledOptions = _chunkIIDSY4XZjs.resolveDisabledOptions.call(void 0, disabled);
|
|
394
404
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
395
405
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
396
|
-
const isMpxApp =
|
|
406
|
+
const isMpxApp = _chunkN3U357CSjs.isMpx.call(void 0, this.appType);
|
|
397
407
|
if (shouldRewriteCssImports) {
|
|
398
|
-
|
|
408
|
+
_chunkN3U357CSjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
399
409
|
pkgDir: weappTailwindcssPackageDir,
|
|
400
410
|
enabled: true,
|
|
401
411
|
appType: this.appType
|
|
402
412
|
});
|
|
403
|
-
|
|
413
|
+
_chunkN3U357CSjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
404
414
|
}
|
|
405
415
|
if (disabledOptions.plugin) {
|
|
406
416
|
return;
|
|
407
417
|
}
|
|
408
|
-
const patchRecorderState =
|
|
418
|
+
const patchRecorderState = _chunkQWT27QZ6js.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
409
419
|
source: "runtime",
|
|
410
420
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
411
421
|
});
|
|
@@ -421,18 +431,18 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
421
431
|
runtimeSetPrepared = false;
|
|
422
432
|
};
|
|
423
433
|
if (_optionalChain([compiler, 'access', _13 => _13.hooks, 'access', _14 => _14.thisCompilation, 'optionalAccess', _15 => _15.tap])) {
|
|
424
|
-
compiler.hooks.thisCompilation.tap(
|
|
434
|
+
compiler.hooks.thisCompilation.tap(_chunkQ6Y6ZAZJjs.pluginName, resetRuntimePreparation);
|
|
425
435
|
} else if (_optionalChain([compiler, 'access', _16 => _16.hooks, 'access', _17 => _17.compilation, 'optionalAccess', _18 => _18.tap])) {
|
|
426
|
-
compiler.hooks.compilation.tap(
|
|
436
|
+
compiler.hooks.compilation.tap(_chunkQ6Y6ZAZJjs.pluginName, resetRuntimePreparation);
|
|
427
437
|
}
|
|
428
438
|
async function getClassSetInLoader() {
|
|
429
439
|
if (runtimeSetPrepared) {
|
|
430
440
|
return;
|
|
431
441
|
}
|
|
432
|
-
const signature =
|
|
442
|
+
const signature = _chunkQ6Y6ZAZJjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
433
443
|
const forceRefresh = signature !== runtimeSetSignature;
|
|
434
444
|
runtimeSetPrepared = true;
|
|
435
|
-
await
|
|
445
|
+
await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
436
446
|
forceRefresh,
|
|
437
447
|
forceCollect: true,
|
|
438
448
|
clearCache: forceRefresh,
|
package/dist/cli.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
@@ -404,9 +404,9 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
404
404
|
try {
|
|
405
405
|
const patcher = createWorkspacePatcher(dir);
|
|
406
406
|
if (options.clearCache) {
|
|
407
|
-
await
|
|
407
|
+
await _chunkQ6Y6ZAZJjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
|
|
408
408
|
}
|
|
409
|
-
const recorder =
|
|
409
|
+
const recorder = _chunkQ6Y6ZAZJjs.createPatchTargetRecorder.call(void 0, dir, patcher, {
|
|
410
410
|
source: "cli",
|
|
411
411
|
cwd: dir,
|
|
412
412
|
recordTarget: options.recordTarget !== false,
|
|
@@ -415,7 +415,7 @@ async function patchWorkspacePackage(workspaceRoot, dir, pkgName, options) {
|
|
|
415
415
|
if (_optionalChain([recorder, 'optionalAccess', _12 => _12.message])) {
|
|
416
416
|
_chunk5APD2MNVjs.logger.info("[workspace] %s %s", displayName, recorder.message);
|
|
417
417
|
}
|
|
418
|
-
|
|
418
|
+
_chunkQ6Y6ZAZJjs.logTailwindcssTarget.call(void 0, "cli", patcher, dir);
|
|
419
419
|
await patcher.patch();
|
|
420
420
|
if (_optionalChain([recorder, 'optionalAccess', _13 => _13.onPatched])) {
|
|
421
421
|
await recorder.onPatched();
|
|
@@ -546,9 +546,9 @@ var mountOptions = {
|
|
|
546
546
|
}
|
|
547
547
|
const patcher = await createPatcherWithDefaultExtendLengthUnits(ctx);
|
|
548
548
|
if (shouldClearCache) {
|
|
549
|
-
await
|
|
549
|
+
await _chunkQ6Y6ZAZJjs.clearTailwindcssPatcherCache.call(void 0, patcher, { removeDirectory: true });
|
|
550
550
|
}
|
|
551
|
-
const recorder =
|
|
551
|
+
const recorder = _chunkQ6Y6ZAZJjs.createPatchTargetRecorder.call(void 0, ctx.cwd, patcher, {
|
|
552
552
|
source: "cli",
|
|
553
553
|
cwd: ctx.cwd,
|
|
554
554
|
recordTarget: shouldRecordTarget,
|
|
@@ -557,7 +557,7 @@ var mountOptions = {
|
|
|
557
557
|
if (_optionalChain([recorder, 'optionalAccess', _15 => _15.message])) {
|
|
558
558
|
_chunk5APD2MNVjs.logger.info(recorder.message);
|
|
559
559
|
}
|
|
560
|
-
|
|
560
|
+
_chunkQ6Y6ZAZJjs.logTailwindcssTarget.call(void 0, "cli", patcher, ctx.cwd);
|
|
561
561
|
await patcher.patch();
|
|
562
562
|
if (_optionalChain([recorder, 'optionalAccess', _16 => _16.onPatched])) {
|
|
563
563
|
const recordPath = await recorder.onPatched();
|
|
@@ -705,9 +705,9 @@ async function generateVscodeIntellisenseEntry(options) {
|
|
|
705
705
|
|
|
706
706
|
// src/cli.ts
|
|
707
707
|
_process2.default.title = "node (weapp-tailwindcss)";
|
|
708
|
-
if (_semver2.default.lt(_process2.default.versions.node,
|
|
708
|
+
if (_semver2.default.lt(_process2.default.versions.node, _chunkQ6Y6ZAZJjs.WEAPP_TW_REQUIRED_NODE_VERSION)) {
|
|
709
709
|
_chunk5APD2MNVjs.logger.warn(
|
|
710
|
-
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${
|
|
710
|
+
`You are using Node.js ${_process2.default.versions.node}. For weapp-tailwindcss, Node.js version >= v${_chunkQ6Y6ZAZJjs.WEAPP_TW_REQUIRED_NODE_VERSION} is required.`
|
|
711
711
|
);
|
|
712
712
|
}
|
|
713
713
|
var cli = _tailwindcsspatch.createTailwindcssPatchCli.call(void 0, {
|
package/dist/cli.mjs
CHANGED
package/dist/core.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQWT27QZ6js = require('./chunk-QWT27QZ6.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.js');
|
|
8
8
|
require('./chunk-5APD2MNV.js');
|
|
9
9
|
require('./chunk-5U24PLVV.js');
|
|
10
10
|
require('./chunk-DYLQ6UOI.js');
|
|
@@ -14,9 +14,9 @@ require('./chunk-DBAAU4LK.js');
|
|
|
14
14
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
15
15
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
16
16
|
function createContext(options = {}) {
|
|
17
|
-
const opts =
|
|
17
|
+
const opts = _chunkQ6Y6ZAZJjs.getCompilerContext.call(void 0, options);
|
|
18
18
|
const { templateHandler, styleHandler, jsHandler, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
19
|
-
const patchRecorderState =
|
|
19
|
+
const patchRecorderState = _chunkQWT27QZ6js.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
20
20
|
source: "runtime",
|
|
21
21
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
22
22
|
});
|
|
@@ -32,7 +32,7 @@ function createContext(options = {}) {
|
|
|
32
32
|
const result = await styleHandler(rawCss, _shared.defuOverrideArray.call(void 0, options2, {
|
|
33
33
|
isMainChunk: true
|
|
34
34
|
}));
|
|
35
|
-
runtimeSet = await
|
|
35
|
+
runtimeSet = await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
36
36
|
forceRefresh: true,
|
|
37
37
|
forceCollect: true
|
|
38
38
|
});
|
|
@@ -44,7 +44,7 @@ function createContext(options = {}) {
|
|
|
44
44
|
if (_optionalChain([options2, 'optionalAccess', _ => _.runtimeSet])) {
|
|
45
45
|
runtimeSet = options2.runtimeSet;
|
|
46
46
|
} else if (runtimeSet.size === 0) {
|
|
47
|
-
runtimeSet = await
|
|
47
|
+
runtimeSet = await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
48
48
|
forceCollect: true
|
|
49
49
|
});
|
|
50
50
|
}
|
|
@@ -57,7 +57,7 @@ function createContext(options = {}) {
|
|
|
57
57
|
async function transformWxml(rawWxml, options2) {
|
|
58
58
|
await runtimeState.patchPromise;
|
|
59
59
|
if (!_optionalChain([options2, 'optionalAccess', _2 => _2.runtimeSet]) && runtimeSet.size === 0) {
|
|
60
|
-
runtimeSet = await
|
|
60
|
+
runtimeSet = await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
61
61
|
forceCollect: true
|
|
62
62
|
});
|
|
63
63
|
}
|
package/dist/core.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
setupPatchRecorder
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2MJBDIG6.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ensureRuntimeClassSet,
|
|
6
6
|
getCompilerContext
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-DE25VCQH.mjs";
|
|
8
8
|
import "./chunk-QOTLDKI4.mjs";
|
|
9
9
|
import "./chunk-3WUHHFLF.mjs";
|
|
10
10
|
import "./chunk-OOHJLO5M.mjs";
|
package/dist/gulp.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkLWU4K4A6js = require('./chunk-LWU4K4A6.js');
|
|
4
4
|
require('./chunk-LTJQUORK.js');
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
5
|
+
require('./chunk-QWT27QZ6.js');
|
|
6
|
+
require('./chunk-Q6Y6ZAZJ.js');
|
|
7
7
|
require('./chunk-5APD2MNV.js');
|
|
8
8
|
require('./chunk-5U24PLVV.js');
|
|
9
9
|
require('./chunk-DYLQ6UOI.js');
|
|
10
10
|
require('./chunk-DBAAU4LK.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.createPlugins =
|
|
13
|
+
exports.createPlugins = _chunkLWU4K4A6js.createPlugins;
|
package/dist/gulp.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createPlugins
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-J4MC6GTY.mjs";
|
|
4
4
|
import "./chunk-RRHPTTCP.mjs";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-2MJBDIG6.mjs";
|
|
6
|
+
import "./chunk-DE25VCQH.mjs";
|
|
7
7
|
import "./chunk-QOTLDKI4.mjs";
|
|
8
8
|
import "./chunk-3WUHHFLF.mjs";
|
|
9
9
|
import "./chunk-OOHJLO5M.mjs";
|
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
4
|
+
var _chunkYI4IXATFjs = require('./chunk-YI4IXATF.js');
|
|
5
|
+
require('./chunk-N3U357CS.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkLWU4K4A6js = require('./chunk-LWU4K4A6.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkQC2DDH25js = require('./chunk-QC2DDH25.js');
|
|
12
12
|
require('./chunk-IIDSY4XZ.js');
|
|
13
13
|
require('./chunk-LTJQUORK.js');
|
|
14
|
-
require('./chunk-
|
|
15
|
-
require('./chunk-
|
|
14
|
+
require('./chunk-QWT27QZ6.js');
|
|
15
|
+
require('./chunk-Q6Y6ZAZJ.js');
|
|
16
16
|
require('./chunk-5APD2MNV.js');
|
|
17
17
|
require('./chunk-5U24PLVV.js');
|
|
18
18
|
require('./chunk-DYLQ6UOI.js');
|
|
@@ -22,4 +22,4 @@ require('./chunk-DBAAU4LK.js');
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
25
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkQC2DDH25js.UnifiedViteWeappTailwindcssPlugin; exports.UnifiedWebpackPluginV5 = _chunkYI4IXATFjs.UnifiedWebpackPluginV5; exports.createPlugins = _chunkLWU4K4A6js.createPlugins; exports.weappTailwindcssPackageDir = _chunkYI4IXATFjs.weappTailwindcssPackageDir;
|
package/dist/index.mjs
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5,
|
|
3
3
|
weappTailwindcssPackageDir
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-5KSAXITH.mjs";
|
|
5
|
+
import "./chunk-ETIS5VGC.mjs";
|
|
6
6
|
import {
|
|
7
7
|
createPlugins
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-J4MC6GTY.mjs";
|
|
9
9
|
import {
|
|
10
10
|
UnifiedViteWeappTailwindcssPlugin
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-QNEHZQ5K.mjs";
|
|
12
12
|
import "./chunk-F2CKKG6Q.mjs";
|
|
13
13
|
import "./chunk-RRHPTTCP.mjs";
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
14
|
+
import "./chunk-2MJBDIG6.mjs";
|
|
15
|
+
import "./chunk-DE25VCQH.mjs";
|
|
16
16
|
import "./chunk-QOTLDKI4.mjs";
|
|
17
17
|
import "./chunk-3WUHHFLF.mjs";
|
|
18
18
|
import "./chunk-OOHJLO5M.mjs";
|
package/dist/vite.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQC2DDH25js = require('./chunk-QC2DDH25.js');
|
|
4
4
|
require('./chunk-IIDSY4XZ.js');
|
|
5
5
|
require('./chunk-LTJQUORK.js');
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-QWT27QZ6.js');
|
|
7
|
+
require('./chunk-Q6Y6ZAZJ.js');
|
|
8
8
|
require('./chunk-5APD2MNV.js');
|
|
9
9
|
require('./chunk-5U24PLVV.js');
|
|
10
10
|
require('./chunk-DYLQ6UOI.js');
|
|
11
11
|
require('./chunk-DBAAU4LK.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
14
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkQC2DDH25js.UnifiedViteWeappTailwindcssPlugin;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedViteWeappTailwindcssPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QNEHZQ5K.mjs";
|
|
4
4
|
import "./chunk-F2CKKG6Q.mjs";
|
|
5
5
|
import "./chunk-RRHPTTCP.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-2MJBDIG6.mjs";
|
|
7
|
+
import "./chunk-DE25VCQH.mjs";
|
|
8
8
|
import "./chunk-QOTLDKI4.mjs";
|
|
9
9
|
import "./chunk-3WUHHFLF.mjs";
|
|
10
10
|
import "./chunk-OOHJLO5M.mjs";
|
package/dist/webpack.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
4
|
+
var _chunkYI4IXATFjs = require('./chunk-YI4IXATF.js');
|
|
5
|
+
require('./chunk-N3U357CS.js');
|
|
6
6
|
require('./chunk-IIDSY4XZ.js');
|
|
7
7
|
require('./chunk-LTJQUORK.js');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-QWT27QZ6.js');
|
|
9
|
+
require('./chunk-Q6Y6ZAZJ.js');
|
|
10
10
|
require('./chunk-5APD2MNV.js');
|
|
11
11
|
require('./chunk-5U24PLVV.js');
|
|
12
12
|
require('./chunk-DYLQ6UOI.js');
|
|
@@ -14,4 +14,4 @@ require('./chunk-DBAAU4LK.js');
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.UnifiedWebpackPluginV5 =
|
|
17
|
+
exports.UnifiedWebpackPluginV5 = _chunkYI4IXATFjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunkYI4IXATFjs.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5,
|
|
3
3
|
weappTailwindcssPackageDir
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-5KSAXITH.mjs";
|
|
5
|
+
import "./chunk-ETIS5VGC.mjs";
|
|
6
6
|
import "./chunk-F2CKKG6Q.mjs";
|
|
7
7
|
import "./chunk-RRHPTTCP.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-2MJBDIG6.mjs";
|
|
9
|
+
import "./chunk-DE25VCQH.mjs";
|
|
10
10
|
import "./chunk-QOTLDKI4.mjs";
|
|
11
11
|
import "./chunk-3WUHHFLF.mjs";
|
|
12
12
|
import "./chunk-OOHJLO5M.mjs";
|
package/dist/webpack4.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkN3U357CSjs = require('./chunk-N3U357CS.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
|
|
26
|
+
var _chunkQWT27QZ6js = require('./chunk-QWT27QZ6.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkQ6Y6ZAZJjs = require('./chunk-Q6Y6ZAZJ.js');
|
|
34
34
|
require('./chunk-5APD2MNV.js');
|
|
35
35
|
require('./chunk-5U24PLVV.js');
|
|
36
36
|
|
|
@@ -45,6 +45,12 @@ var _process = require('process'); var _process2 = _interopRequireDefault(_proce
|
|
|
45
45
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
46
46
|
|
|
47
47
|
var _webpacksources = require('webpack-sources');
|
|
48
|
+
function resolveWebpackStaleClassNameFallback(option, _compiler) {
|
|
49
|
+
if (typeof option === "boolean") {
|
|
50
|
+
return option;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
48
54
|
function setupWebpackV4EmitHook(options) {
|
|
49
55
|
const {
|
|
50
56
|
compiler,
|
|
@@ -53,7 +59,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
53
59
|
runtimeState,
|
|
54
60
|
debug: debug2
|
|
55
61
|
} = options;
|
|
56
|
-
compiler.hooks.emit.tapPromise(
|
|
62
|
+
compiler.hooks.emit.tapPromise(_chunkQ6Y6ZAZJjs.pluginName, async (compilation) => {
|
|
57
63
|
await runtimeState.patchPromise;
|
|
58
64
|
compilerOptions.onStart();
|
|
59
65
|
debug2("start");
|
|
@@ -62,7 +68,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
62
68
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
63
69
|
}
|
|
64
70
|
}
|
|
65
|
-
const assetHashByChunk =
|
|
71
|
+
const assetHashByChunk = _chunkN3U357CSjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
66
72
|
const assets = compilation.assets;
|
|
67
73
|
const entries = Object.entries(assets);
|
|
68
74
|
const outputDir = _optionalChain([compiler, 'access', _ => _.options, 'optionalAccess', _2 => _2.output, 'optionalAccess', _3 => _3.path]) ? _path2.default.resolve(compiler.options.output.path) : _process2.default.cwd();
|
|
@@ -118,8 +124,11 @@ function setupWebpackV4EmitHook(options) {
|
|
|
118
124
|
}
|
|
119
125
|
};
|
|
120
126
|
const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
|
|
121
|
-
const
|
|
122
|
-
|
|
127
|
+
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
128
|
+
const runtimeSet = await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
129
|
+
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
130
|
+
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
131
|
+
forceCollect: true,
|
|
123
132
|
allowEmpty: false
|
|
124
133
|
});
|
|
125
134
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
@@ -161,7 +170,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
161
170
|
const jsTaskFactories = [];
|
|
162
171
|
if (Array.isArray(groupedEntries.js)) {
|
|
163
172
|
for (const [file] of groupedEntries.js) {
|
|
164
|
-
const cacheKey =
|
|
173
|
+
const cacheKey = _chunkN3U357CSjs.getCacheKey.call(void 0, file);
|
|
165
174
|
const assetSource = compilation.assets[file];
|
|
166
175
|
if (!assetSource) {
|
|
167
176
|
continue;
|
|
@@ -188,6 +197,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
188
197
|
const currentValue = _optionalChain([currentAsset, 'optionalAccess', _4 => _4.source, 'call', _5 => _5()]);
|
|
189
198
|
const currentSource = typeof currentValue === "string" ? currentValue : _nullishCoalesce(_optionalChain([currentValue, 'optionalAccess', _6 => _6.toString, 'call', _7 => _7()]), () => ( ""));
|
|
190
199
|
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, {
|
|
200
|
+
staleClassNameFallback,
|
|
191
201
|
filename: absoluteFile,
|
|
192
202
|
moduleGraph: moduleGraphOptions,
|
|
193
203
|
babelParserOptions: {
|
|
@@ -270,9 +280,9 @@ function setupWebpackV4Loaders(options) {
|
|
|
270
280
|
getClassSetInLoader,
|
|
271
281
|
debug: debug2
|
|
272
282
|
} = options;
|
|
273
|
-
const isMpxApp =
|
|
283
|
+
const isMpxApp = _chunkN3U357CSjs.isMpx.call(void 0, appType);
|
|
274
284
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
275
|
-
|
|
285
|
+
_chunkN3U357CSjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
276
286
|
}
|
|
277
287
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
278
288
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -285,12 +295,12 @@ function setupWebpackV4Loaders(options) {
|
|
|
285
295
|
const classSetLoaderOptions = {
|
|
286
296
|
getClassSet: getClassSetInLoader
|
|
287
297
|
};
|
|
288
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
298
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkN3U357CSjs.createLoaderAnchorFinders.call(void 0, appType);
|
|
289
299
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
290
300
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
291
301
|
} : void 0;
|
|
292
302
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
293
|
-
|
|
303
|
+
_chunkN3U357CSjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
294
304
|
}
|
|
295
305
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
296
306
|
loader: runtimeClassSetLoader,
|
|
@@ -309,19 +319,19 @@ function setupWebpackV4Loaders(options) {
|
|
|
309
319
|
type: null
|
|
310
320
|
};
|
|
311
321
|
};
|
|
312
|
-
compiler.hooks.compilation.tap(
|
|
313
|
-
compilation.hooks.normalModuleLoader.tap(
|
|
322
|
+
compiler.hooks.compilation.tap(_chunkQ6Y6ZAZJjs.pluginName, (compilation) => {
|
|
323
|
+
compilation.hooks.normalModuleLoader.tap(_chunkQ6Y6ZAZJjs.pluginName, (_loaderContext, module) => {
|
|
314
324
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
315
325
|
if (!hasRuntimeLoader) {
|
|
316
326
|
return;
|
|
317
327
|
}
|
|
318
|
-
if (shouldRewriteCssImports &&
|
|
319
|
-
|
|
328
|
+
if (shouldRewriteCssImports && _chunkN3U357CSjs.isMpx.call(void 0, appType) && typeof _loaderContext.resolve === "function") {
|
|
329
|
+
_chunkN3U357CSjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, true);
|
|
320
330
|
}
|
|
321
331
|
const loaderEntries = module.loaders || [];
|
|
322
332
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
323
333
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
324
|
-
const isCssModule =
|
|
334
|
+
const isCssModule = _chunkN3U357CSjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
325
335
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
326
336
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
327
337
|
}
|
|
@@ -355,7 +365,7 @@ function setupWebpackV4Loaders(options) {
|
|
|
355
365
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
356
366
|
}
|
|
357
367
|
}
|
|
358
|
-
if (runtimeClassSetLoaderExists && !
|
|
368
|
+
if (runtimeClassSetLoaderExists && !_chunkN3U357CSjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
359
369
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
360
370
|
if (anchorIndex === -1) {
|
|
361
371
|
anchorlessInsert(createRuntimeClassSetLoaderEntry(), "before");
|
|
@@ -369,11 +379,11 @@ function setupWebpackV4Loaders(options) {
|
|
|
369
379
|
}
|
|
370
380
|
|
|
371
381
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
372
|
-
var debug =
|
|
382
|
+
var debug = _chunkQ6Y6ZAZJjs.createDebug.call(void 0, );
|
|
373
383
|
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
374
384
|
var UnifiedWebpackPluginV4 = class {
|
|
375
385
|
constructor(options = {}) {
|
|
376
|
-
this.options =
|
|
386
|
+
this.options = _chunkQ6Y6ZAZJjs.getCompilerContext.call(void 0, options);
|
|
377
387
|
this.appType = this.options.appType;
|
|
378
388
|
}
|
|
379
389
|
apply(compiler) {
|
|
@@ -389,19 +399,19 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
389
399
|
const disabledOptions = _chunkIIDSY4XZjs.resolveDisabledOptions.call(void 0, disabled);
|
|
390
400
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
391
401
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
392
|
-
const isMpxApp =
|
|
402
|
+
const isMpxApp = _chunkN3U357CSjs.isMpx.call(void 0, this.appType);
|
|
393
403
|
if (shouldRewriteCssImports) {
|
|
394
|
-
|
|
404
|
+
_chunkN3U357CSjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
395
405
|
pkgDir: weappTailwindcssPackageDir,
|
|
396
406
|
enabled: true,
|
|
397
407
|
appType: this.appType
|
|
398
408
|
});
|
|
399
|
-
|
|
409
|
+
_chunkN3U357CSjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
400
410
|
}
|
|
401
411
|
if (disabledOptions.plugin) {
|
|
402
412
|
return;
|
|
403
413
|
}
|
|
404
|
-
const patchRecorderState =
|
|
414
|
+
const patchRecorderState = _chunkQWT27QZ6js.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
405
415
|
source: "runtime",
|
|
406
416
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
407
417
|
});
|
|
@@ -413,17 +423,17 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
413
423
|
};
|
|
414
424
|
let runtimeSetPrepared = false;
|
|
415
425
|
let runtimeSetSignature;
|
|
416
|
-
compiler.hooks.compilation.tap(
|
|
426
|
+
compiler.hooks.compilation.tap(_chunkQ6Y6ZAZJjs.pluginName, () => {
|
|
417
427
|
runtimeSetPrepared = false;
|
|
418
428
|
});
|
|
419
429
|
async function getClassSetInLoader() {
|
|
420
430
|
if (runtimeSetPrepared) {
|
|
421
431
|
return;
|
|
422
432
|
}
|
|
423
|
-
const signature =
|
|
433
|
+
const signature = _chunkQ6Y6ZAZJjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
424
434
|
const forceRefresh = signature !== runtimeSetSignature;
|
|
425
435
|
runtimeSetPrepared = true;
|
|
426
|
-
await
|
|
436
|
+
await _chunkQ6Y6ZAZJjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
427
437
|
forceRefresh,
|
|
428
438
|
forceCollect: true,
|
|
429
439
|
clearCache: forceRefresh,
|
package/dist/webpack4.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
isMpx,
|
|
11
11
|
patchMpxLoaderResolve,
|
|
12
12
|
setupMpxTailwindcssRedirect
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-ETIS5VGC.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-
|
|
26
|
+
} from "./chunk-2MJBDIG6.mjs";
|
|
27
27
|
import {
|
|
28
28
|
createDebug,
|
|
29
29
|
ensureRuntimeClassSet,
|
|
30
30
|
getCompilerContext,
|
|
31
31
|
getRuntimeClassSetSignature,
|
|
32
32
|
pluginName
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-DE25VCQH.mjs";
|
|
34
34
|
import "./chunk-QOTLDKI4.mjs";
|
|
35
35
|
import "./chunk-3WUHHFLF.mjs";
|
|
36
36
|
import {
|
|
@@ -47,6 +47,12 @@ import process3 from "process";
|
|
|
47
47
|
import path from "path";
|
|
48
48
|
import process from "process";
|
|
49
49
|
import { ConcatSource } from "webpack-sources";
|
|
50
|
+
function resolveWebpackStaleClassNameFallback(option, _compiler) {
|
|
51
|
+
if (typeof option === "boolean") {
|
|
52
|
+
return option;
|
|
53
|
+
}
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
50
56
|
function setupWebpackV4EmitHook(options) {
|
|
51
57
|
const {
|
|
52
58
|
compiler,
|
|
@@ -120,8 +126,11 @@ function setupWebpackV4EmitHook(options) {
|
|
|
120
126
|
}
|
|
121
127
|
};
|
|
122
128
|
const groupedEntries = getGroupedEntries(entries, compilerOptions);
|
|
129
|
+
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
123
130
|
const runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
124
|
-
|
|
131
|
+
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
132
|
+
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
133
|
+
forceCollect: true,
|
|
125
134
|
allowEmpty: false
|
|
126
135
|
});
|
|
127
136
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
@@ -190,6 +199,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
190
199
|
const currentValue = currentAsset?.source();
|
|
191
200
|
const currentSource = typeof currentValue === "string" ? currentValue : currentValue?.toString() ?? "";
|
|
192
201
|
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, {
|
|
202
|
+
staleClassNameFallback,
|
|
193
203
|
filename: absoluteFile,
|
|
194
204
|
moduleGraph: moduleGraphOptions,
|
|
195
205
|
babelParserOptions: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "4.10.0-beta.
|
|
3
|
+
"version": "4.10.0-beta.8",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -184,9 +184,9 @@
|
|
|
184
184
|
"tailwindcss-patch": "^8.7.0",
|
|
185
185
|
"webpack-sources": "3.3.4",
|
|
186
186
|
"yaml": "^2.8.2",
|
|
187
|
+
"@weapp-tailwindcss/postcss": "2.1.5-beta.0",
|
|
187
188
|
"@weapp-tailwindcss/logger": "1.1.0",
|
|
188
|
-
"@weapp-tailwindcss/shared": "1.1.2"
|
|
189
|
-
"@weapp-tailwindcss/postcss": "2.1.5-beta.0"
|
|
189
|
+
"@weapp-tailwindcss/shared": "1.1.2"
|
|
190
190
|
},
|
|
191
191
|
"scripts": {
|
|
192
192
|
"dev": "tsup --watch --sourcemap",
|