weapp-tailwindcss 4.9.9-beta.0 → 4.10.0-beta.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-FT3YGOHE.mjs → chunk-2KAM7AAG.mjs} +35 -7
- package/dist/{chunk-PO3CCFU7.js → chunk-3RGU475C.js} +4 -4
- package/dist/{chunk-YPIQUBC4.mjs → chunk-7ATL22KK.mjs} +44 -17
- package/dist/{chunk-NBS6RMNM.mjs → chunk-AGF55OIE.mjs} +1 -1
- package/dist/{chunk-YYE3U4L3.mjs → chunk-D3I6GQUV.mjs} +134 -20
- package/dist/{chunk-HAM3JEU2.js → chunk-DBAAU4LK.js} +1 -1
- package/dist/{chunk-U4T2HGRZ.js → chunk-F7FBGRWS.js} +16 -13
- package/dist/{chunk-YVYWSXU7.mjs → chunk-FIJF6OL7.mjs} +13 -10
- package/dist/{chunk-A2ST4H4Y.js → chunk-FLJBD5TW.js} +5 -5
- package/dist/{chunk-CAFL5XBF.js → chunk-GFJYJ6WV.js} +65 -38
- package/dist/{chunk-47TVJCQM.mjs → chunk-HT76VHOV.mjs} +1 -1
- package/dist/{chunk-DOX3RXJ2.js → chunk-IIDSY4XZ.js} +2 -2
- package/dist/{chunk-IY5ZVBL2.mjs → chunk-Q7TIBSU2.mjs} +37 -1
- package/dist/{chunk-42HSNAKM.js → chunk-QOWSZHYT.js} +42 -6
- package/dist/{chunk-YY55J7K3.js → chunk-UCDOKKRH.js} +141 -27
- package/dist/{chunk-HQ2G6NBK.js → chunk-YS2V3XY2.js} +57 -29
- package/dist/cli.js +39 -39
- package/dist/cli.mjs +2 -2
- package/dist/core.js +29 -22
- package/dist/core.mjs +28 -21
- package/dist/css-macro/postcss.js +1 -1
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +1 -1
- package/dist/css-macro.mjs +1 -1
- package/dist/defaults.js +1 -1
- package/dist/defaults.mjs +1 -1
- package/dist/gulp.js +6 -6
- package/dist/gulp.mjs +4 -4
- package/dist/index.js +10 -10
- package/dist/index.mjs +7 -7
- package/dist/postcss-html-transform.js +1 -1
- package/dist/postcss-html-transform.mjs +1 -1
- package/dist/presets.js +5 -5
- package/dist/presets.mjs +1 -1
- package/dist/reset.js +1 -1
- package/dist/reset.mjs +1 -1
- package/dist/types.d.mts +5 -0
- package/dist/types.d.ts +5 -0
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.js +7 -7
- package/dist/vite.mjs +4 -4
- package/dist/webpack.js +8 -8
- package/dist/webpack.mjs +5 -5
- package/dist/webpack4.js +63 -41
- package/dist/webpack4.mjs +40 -18
- package/package.json +7 -6
package/dist/reset.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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; }require('./chunk-
|
|
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; }require('./chunk-DBAAU4LK.js');
|
|
2
2
|
|
|
3
3
|
// src/reset/index.ts
|
|
4
4
|
var _plugin = require('tailwindcss/plugin'); var _plugin2 = _interopRequireDefault(_plugin);
|
package/dist/reset.mjs
CHANGED
package/dist/types.d.mts
CHANGED
|
@@ -40,6 +40,11 @@ interface RefreshTailwindcssPatcherOptions {
|
|
|
40
40
|
interface IJsHandlerOptions {
|
|
41
41
|
escapeMap?: Record<string, string>;
|
|
42
42
|
classNameSet?: Set<string>;
|
|
43
|
+
/**
|
|
44
|
+
* 当 classNameSet 可能滞后(如热更新)时,允许对未命中集合的候选类名执行保守兜底转义。
|
|
45
|
+
* 默认关闭,避免在常规 JS 文本中出现误替换。
|
|
46
|
+
*/
|
|
47
|
+
staleClassNameFallback?: boolean;
|
|
43
48
|
arbitraryValues?: IArbitraryValues;
|
|
44
49
|
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
45
50
|
needEscaped?: boolean;
|
package/dist/types.d.ts
CHANGED
|
@@ -40,6 +40,11 @@ interface RefreshTailwindcssPatcherOptions {
|
|
|
40
40
|
interface IJsHandlerOptions {
|
|
41
41
|
escapeMap?: Record<string, string>;
|
|
42
42
|
classNameSet?: Set<string>;
|
|
43
|
+
/**
|
|
44
|
+
* 当 classNameSet 可能滞后(如热更新)时,允许对未命中集合的候选类名执行保守兜底转义。
|
|
45
|
+
* 默认关闭,避免在常规 JS 文本中出现误替换。
|
|
46
|
+
*/
|
|
47
|
+
staleClassNameFallback?: boolean;
|
|
43
48
|
arbitraryValues?: IArbitraryValues;
|
|
44
49
|
jsPreserveClass?: (keyword: string) => boolean | undefined;
|
|
45
50
|
needEscaped?: boolean;
|
package/dist/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";require('./chunk-
|
|
1
|
+
"use strict";require('./chunk-DBAAU4LK.js');
|
package/dist/types.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-HT76VHOV.mjs";
|
package/dist/vite.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkYS2V3XY2js = require('./chunk-YS2V3XY2.js');
|
|
4
|
+
require('./chunk-IIDSY4XZ.js');
|
|
5
5
|
require('./chunk-LTJQUORK.js');
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-FLJBD5TW.js');
|
|
7
|
+
require('./chunk-UCDOKKRH.js');
|
|
8
|
+
require('./chunk-3RGU475C.js');
|
|
9
9
|
require('./chunk-LBZCKOMT.js');
|
|
10
10
|
require('./chunk-DYLQ6UOI.js');
|
|
11
|
-
require('./chunk-
|
|
11
|
+
require('./chunk-DBAAU4LK.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
exports.UnifiedViteWeappTailwindcssPlugin =
|
|
14
|
+
exports.UnifiedViteWeappTailwindcssPlugin = _chunkYS2V3XY2js.UnifiedViteWeappTailwindcssPlugin;
|
package/dist/vite.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedViteWeappTailwindcssPlugin
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2KAM7AAG.mjs";
|
|
4
4
|
import "./chunk-F2CKKG6Q.mjs";
|
|
5
5
|
import "./chunk-RRHPTTCP.mjs";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-AGF55OIE.mjs";
|
|
7
|
+
import "./chunk-D3I6GQUV.mjs";
|
|
8
8
|
import "./chunk-7D27E7TU.mjs";
|
|
9
9
|
import "./chunk-EGOFMIDI.mjs";
|
|
10
10
|
import "./chunk-OOHJLO5M.mjs";
|
|
11
|
-
import "./chunk-
|
|
11
|
+
import "./chunk-HT76VHOV.mjs";
|
|
12
12
|
export {
|
|
13
13
|
UnifiedViteWeappTailwindcssPlugin
|
|
14
14
|
};
|
package/dist/webpack.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
4
|
+
var _chunkGFJYJ6WVjs = require('./chunk-GFJYJ6WV.js');
|
|
5
|
+
require('./chunk-QOWSZHYT.js');
|
|
6
|
+
require('./chunk-IIDSY4XZ.js');
|
|
7
7
|
require('./chunk-LTJQUORK.js');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-FLJBD5TW.js');
|
|
9
|
+
require('./chunk-UCDOKKRH.js');
|
|
10
|
+
require('./chunk-3RGU475C.js');
|
|
11
11
|
require('./chunk-LBZCKOMT.js');
|
|
12
12
|
require('./chunk-DYLQ6UOI.js');
|
|
13
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-DBAAU4LK.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.UnifiedWebpackPluginV5 =
|
|
17
|
+
exports.UnifiedWebpackPluginV5 = _chunkGFJYJ6WVjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunkGFJYJ6WVjs.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5,
|
|
3
3
|
weappTailwindcssPackageDir
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-7ATL22KK.mjs";
|
|
5
|
+
import "./chunk-Q7TIBSU2.mjs";
|
|
6
6
|
import "./chunk-F2CKKG6Q.mjs";
|
|
7
7
|
import "./chunk-RRHPTTCP.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-AGF55OIE.mjs";
|
|
9
|
+
import "./chunk-D3I6GQUV.mjs";
|
|
10
10
|
import "./chunk-7D27E7TU.mjs";
|
|
11
11
|
import "./chunk-EGOFMIDI.mjs";
|
|
12
12
|
import "./chunk-OOHJLO5M.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-HT76VHOV.mjs";
|
|
14
14
|
export {
|
|
15
15
|
UnifiedWebpackPluginV5,
|
|
16
16
|
weappTailwindcssPackageDir
|
package/dist/webpack4.js
CHANGED
|
@@ -9,33 +9,34 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var _chunk42HSNAKMjs = require('./chunk-42HSNAKM.js');
|
|
13
12
|
|
|
13
|
+
var _chunkQOWSZHYTjs = require('./chunk-QOWSZHYT.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
|
|
20
|
+
var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
|
|
20
21
|
|
|
21
22
|
|
|
22
23
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
23
24
|
|
|
24
25
|
|
|
25
|
-
var
|
|
26
|
+
var _chunkFLJBD5TWjs = require('./chunk-FLJBD5TW.js');
|
|
26
27
|
|
|
27
28
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
|
|
31
32
|
|
|
32
|
-
var
|
|
33
|
-
require('./chunk-
|
|
33
|
+
var _chunkUCDOKKRHjs = require('./chunk-UCDOKKRH.js');
|
|
34
|
+
require('./chunk-3RGU475C.js');
|
|
34
35
|
require('./chunk-LBZCKOMT.js');
|
|
35
36
|
|
|
36
37
|
|
|
37
38
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
38
|
-
require('./chunk-
|
|
39
|
+
require('./chunk-DBAAU4LK.js');
|
|
39
40
|
|
|
40
41
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
41
42
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -50,10 +51,9 @@ function setupWebpackV4EmitHook(options) {
|
|
|
50
51
|
options: compilerOptions,
|
|
51
52
|
appType,
|
|
52
53
|
runtimeState,
|
|
53
|
-
refreshRuntimeState,
|
|
54
54
|
debug: debug2
|
|
55
55
|
} = options;
|
|
56
|
-
compiler.hooks.emit.tapPromise(
|
|
56
|
+
compiler.hooks.emit.tapPromise(_chunkUCDOKKRHjs.pluginName, async (compilation) => {
|
|
57
57
|
await runtimeState.patchPromise;
|
|
58
58
|
compilerOptions.onStart();
|
|
59
59
|
debug2("start");
|
|
@@ -62,19 +62,20 @@ function setupWebpackV4EmitHook(options) {
|
|
|
62
62
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
+
const assetHashByChunk = _chunkQOWSZHYTjs.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
65
66
|
const assets = compilation.assets;
|
|
66
67
|
const entries = Object.entries(assets);
|
|
67
68
|
const outputDir = _optionalChain([compiler, 'access', _ => _.options, 'optionalAccess', _2 => _2.output, 'optionalAccess', _3 => _3.path]) ? _path2.default.resolve(compiler.options.output.path) : _process2.default.cwd();
|
|
68
69
|
const jsAssets = /* @__PURE__ */ new Map();
|
|
69
70
|
for (const [file] of entries) {
|
|
70
71
|
if (compilerOptions.jsMatcher(file) || compilerOptions.wxsMatcher(file)) {
|
|
71
|
-
const absolute =
|
|
72
|
+
const absolute = _chunkIIDSY4XZjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
72
73
|
jsAssets.set(absolute, file);
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
const moduleGraphOptions = {
|
|
76
77
|
resolve(specifier, importer) {
|
|
77
|
-
return
|
|
78
|
+
return _chunkIIDSY4XZjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
|
|
78
79
|
},
|
|
79
80
|
load: (id) => {
|
|
80
81
|
const assetName = jsAssets.get(id);
|
|
@@ -117,9 +118,10 @@ function setupWebpackV4EmitHook(options) {
|
|
|
117
118
|
}
|
|
118
119
|
};
|
|
119
120
|
const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
|
|
120
|
-
await
|
|
121
|
-
|
|
122
|
-
|
|
121
|
+
const runtimeSet = await _chunkUCDOKKRHjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
122
|
+
forceCollect: false,
|
|
123
|
+
allowEmpty: false
|
|
124
|
+
});
|
|
123
125
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
124
126
|
const tasks = [];
|
|
125
127
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -127,11 +129,14 @@ function setupWebpackV4EmitHook(options) {
|
|
|
127
129
|
const [file, originalSource] = element;
|
|
128
130
|
const rawSource = originalSource.source().toString();
|
|
129
131
|
const cacheKey = file;
|
|
132
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
130
133
|
tasks.push(
|
|
131
134
|
_chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
132
135
|
cache: compilerOptions.cache,
|
|
133
136
|
cacheKey,
|
|
137
|
+
hashKey: `${file}:asset`,
|
|
134
138
|
rawSource,
|
|
139
|
+
hash: chunkHash,
|
|
135
140
|
applyResult(source) {
|
|
136
141
|
compilation.updateAsset(file, source);
|
|
137
142
|
},
|
|
@@ -156,19 +161,22 @@ function setupWebpackV4EmitHook(options) {
|
|
|
156
161
|
const jsTaskFactories = [];
|
|
157
162
|
if (Array.isArray(groupedEntries.js)) {
|
|
158
163
|
for (const [file] of groupedEntries.js) {
|
|
159
|
-
const cacheKey =
|
|
164
|
+
const cacheKey = _chunkQOWSZHYTjs.getCacheKey.call(void 0, file);
|
|
160
165
|
const assetSource = compilation.assets[file];
|
|
161
166
|
if (!assetSource) {
|
|
162
167
|
continue;
|
|
163
168
|
}
|
|
164
169
|
const initialValue = assetSource.source();
|
|
165
170
|
const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
|
|
166
|
-
const absoluteFile =
|
|
171
|
+
const absoluteFile = _chunkIIDSY4XZjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
172
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
167
173
|
jsTaskFactories.push(async () => {
|
|
168
174
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
169
175
|
cache: compilerOptions.cache,
|
|
170
176
|
cacheKey,
|
|
177
|
+
hashKey: `${file}:asset`,
|
|
171
178
|
rawSource: initialRawSource,
|
|
179
|
+
hash: chunkHash,
|
|
172
180
|
applyResult(source) {
|
|
173
181
|
compilation.updateAsset(file, source);
|
|
174
182
|
},
|
|
@@ -203,11 +211,14 @@ function setupWebpackV4EmitHook(options) {
|
|
|
203
211
|
const [file, originalSource] = element;
|
|
204
212
|
const rawSource = originalSource.source().toString();
|
|
205
213
|
const cacheKey = file;
|
|
214
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
206
215
|
tasks.push(
|
|
207
216
|
_chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
208
217
|
cache: compilerOptions.cache,
|
|
209
218
|
cacheKey,
|
|
219
|
+
hashKey: `${file}:asset`,
|
|
210
220
|
rawSource,
|
|
221
|
+
hash: chunkHash,
|
|
211
222
|
applyResult(source) {
|
|
212
223
|
compilation.updateAsset(file, source);
|
|
213
224
|
},
|
|
@@ -236,7 +247,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
236
247
|
);
|
|
237
248
|
}
|
|
238
249
|
}
|
|
239
|
-
|
|
250
|
+
_chunkIIDSY4XZjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
240
251
|
await Promise.all(tasks);
|
|
241
252
|
debug2("end");
|
|
242
253
|
compilerOptions.onEnd();
|
|
@@ -259,9 +270,9 @@ function setupWebpackV4Loaders(options) {
|
|
|
259
270
|
getClassSetInLoader,
|
|
260
271
|
debug: debug2
|
|
261
272
|
} = options;
|
|
262
|
-
const isMpxApp =
|
|
273
|
+
const isMpxApp = _chunkQOWSZHYTjs.isMpx.call(void 0, appType);
|
|
263
274
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
264
|
-
|
|
275
|
+
_chunkQOWSZHYTjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
265
276
|
}
|
|
266
277
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
267
278
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -274,12 +285,12 @@ function setupWebpackV4Loaders(options) {
|
|
|
274
285
|
const classSetLoaderOptions = {
|
|
275
286
|
getClassSet: getClassSetInLoader
|
|
276
287
|
};
|
|
277
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
288
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkQOWSZHYTjs.createLoaderAnchorFinders.call(void 0, appType);
|
|
278
289
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
279
290
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
280
291
|
} : void 0;
|
|
281
292
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
282
|
-
|
|
293
|
+
_chunkQOWSZHYTjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
283
294
|
}
|
|
284
295
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
285
296
|
loader: runtimeClassSetLoader,
|
|
@@ -298,19 +309,19 @@ function setupWebpackV4Loaders(options) {
|
|
|
298
309
|
type: null
|
|
299
310
|
};
|
|
300
311
|
};
|
|
301
|
-
compiler.hooks.compilation.tap(
|
|
302
|
-
compilation.hooks.normalModuleLoader.tap(
|
|
312
|
+
compiler.hooks.compilation.tap(_chunkUCDOKKRHjs.pluginName, (compilation) => {
|
|
313
|
+
compilation.hooks.normalModuleLoader.tap(_chunkUCDOKKRHjs.pluginName, (_loaderContext, module) => {
|
|
303
314
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
304
315
|
if (!hasRuntimeLoader) {
|
|
305
316
|
return;
|
|
306
317
|
}
|
|
307
|
-
if (shouldRewriteCssImports &&
|
|
308
|
-
|
|
318
|
+
if (shouldRewriteCssImports && _chunkQOWSZHYTjs.isMpx.call(void 0, appType) && typeof _loaderContext.resolve === "function") {
|
|
319
|
+
_chunkQOWSZHYTjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, true);
|
|
309
320
|
}
|
|
310
321
|
const loaderEntries = module.loaders || [];
|
|
311
322
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
312
323
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
313
|
-
const isCssModule =
|
|
324
|
+
const isCssModule = _chunkQOWSZHYTjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
314
325
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
315
326
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
316
327
|
}
|
|
@@ -344,7 +355,7 @@ function setupWebpackV4Loaders(options) {
|
|
|
344
355
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
345
356
|
}
|
|
346
357
|
}
|
|
347
|
-
if (runtimeClassSetLoaderExists && !
|
|
358
|
+
if (runtimeClassSetLoaderExists && !_chunkQOWSZHYTjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
348
359
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
349
360
|
if (anchorIndex === -1) {
|
|
350
361
|
anchorlessInsert(createRuntimeClassSetLoaderEntry(), "before");
|
|
@@ -358,11 +369,11 @@ function setupWebpackV4Loaders(options) {
|
|
|
358
369
|
}
|
|
359
370
|
|
|
360
371
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
361
|
-
var debug =
|
|
362
|
-
var weappTailwindcssPackageDir =
|
|
372
|
+
var debug = _chunkUCDOKKRHjs.createDebug.call(void 0, );
|
|
373
|
+
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
363
374
|
var UnifiedWebpackPluginV4 = class {
|
|
364
375
|
constructor(options = {}) {
|
|
365
|
-
this.options =
|
|
376
|
+
this.options = _chunkUCDOKKRHjs.getCompilerContext.call(void 0, options);
|
|
366
377
|
this.appType = this.options.appType;
|
|
367
378
|
}
|
|
368
379
|
apply(compiler) {
|
|
@@ -375,22 +386,22 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
375
386
|
twPatcher: initialTwPatcher,
|
|
376
387
|
refreshTailwindcssPatcher
|
|
377
388
|
} = this.options;
|
|
378
|
-
const disabledOptions =
|
|
389
|
+
const disabledOptions = _chunkIIDSY4XZjs.resolveDisabledOptions.call(void 0, disabled);
|
|
379
390
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
380
391
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
381
|
-
const isMpxApp =
|
|
392
|
+
const isMpxApp = _chunkQOWSZHYTjs.isMpx.call(void 0, this.appType);
|
|
382
393
|
if (shouldRewriteCssImports) {
|
|
383
|
-
|
|
394
|
+
_chunkQOWSZHYTjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
384
395
|
pkgDir: weappTailwindcssPackageDir,
|
|
385
396
|
enabled: true,
|
|
386
397
|
appType: this.appType
|
|
387
398
|
});
|
|
388
|
-
|
|
399
|
+
_chunkQOWSZHYTjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
389
400
|
}
|
|
390
401
|
if (disabledOptions.plugin) {
|
|
391
402
|
return;
|
|
392
403
|
}
|
|
393
|
-
const patchRecorderState =
|
|
404
|
+
const patchRecorderState = _chunkFLJBD5TWjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
394
405
|
source: "runtime",
|
|
395
406
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
396
407
|
});
|
|
@@ -400,13 +411,25 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
400
411
|
refreshTailwindcssPatcher,
|
|
401
412
|
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
402
413
|
};
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
414
|
+
let runtimeSetPrepared = false;
|
|
415
|
+
let runtimeSetSignature;
|
|
416
|
+
compiler.hooks.compilation.tap(_chunkUCDOKKRHjs.pluginName, () => {
|
|
417
|
+
runtimeSetPrepared = false;
|
|
418
|
+
});
|
|
406
419
|
async function getClassSetInLoader() {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
420
|
+
if (runtimeSetPrepared) {
|
|
421
|
+
return;
|
|
422
|
+
}
|
|
423
|
+
const signature = _chunkUCDOKKRHjs.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
424
|
+
const forceRefresh = signature !== runtimeSetSignature;
|
|
425
|
+
runtimeSetPrepared = true;
|
|
426
|
+
await _chunkUCDOKKRHjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
427
|
+
forceRefresh,
|
|
428
|
+
forceCollect: true,
|
|
429
|
+
clearCache: forceRefresh,
|
|
430
|
+
allowEmpty: true
|
|
431
|
+
});
|
|
432
|
+
runtimeSetSignature = signature;
|
|
410
433
|
}
|
|
411
434
|
onLoad();
|
|
412
435
|
setupWebpackV4Loaders({
|
|
@@ -425,7 +448,6 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
425
448
|
options: this.options,
|
|
426
449
|
appType: this.appType,
|
|
427
450
|
runtimeState,
|
|
428
|
-
refreshRuntimeState,
|
|
429
451
|
debug
|
|
430
452
|
});
|
|
431
453
|
}
|
package/dist/webpack4.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyTailwindcssCssImportRewrite,
|
|
3
|
+
createAssetHashByChunkMap,
|
|
3
4
|
createLoaderAnchorFinders,
|
|
4
5
|
ensureMpxTailwindcssAliases,
|
|
5
6
|
getCacheKey,
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
isMpx,
|
|
10
11
|
patchMpxLoaderResolve,
|
|
11
12
|
setupMpxTailwindcssRedirect
|
|
12
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-Q7TIBSU2.mjs";
|
|
13
14
|
import {
|
|
14
15
|
pushConcurrentTaskFactories,
|
|
15
16
|
resolveDisabledOptions,
|
|
@@ -22,14 +23,14 @@ import {
|
|
|
22
23
|
} from "./chunk-RRHPTTCP.mjs";
|
|
23
24
|
import {
|
|
24
25
|
setupPatchRecorder
|
|
25
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-AGF55OIE.mjs";
|
|
26
27
|
import {
|
|
27
|
-
collectRuntimeClassSet,
|
|
28
28
|
createDebug,
|
|
29
|
+
ensureRuntimeClassSet,
|
|
29
30
|
getCompilerContext,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} from "./chunk-
|
|
31
|
+
getRuntimeClassSetSignature,
|
|
32
|
+
pluginName
|
|
33
|
+
} from "./chunk-D3I6GQUV.mjs";
|
|
33
34
|
import "./chunk-7D27E7TU.mjs";
|
|
34
35
|
import "./chunk-EGOFMIDI.mjs";
|
|
35
36
|
import {
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
} from "./chunk-OOHJLO5M.mjs";
|
|
38
39
|
import {
|
|
39
40
|
__dirname
|
|
40
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-HT76VHOV.mjs";
|
|
41
42
|
|
|
42
43
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
43
44
|
import process3 from "process";
|
|
@@ -52,7 +53,6 @@ function setupWebpackV4EmitHook(options) {
|
|
|
52
53
|
options: compilerOptions,
|
|
53
54
|
appType,
|
|
54
55
|
runtimeState,
|
|
55
|
-
refreshRuntimeState,
|
|
56
56
|
debug: debug2
|
|
57
57
|
} = options;
|
|
58
58
|
compiler.hooks.emit.tapPromise(pluginName, async (compilation) => {
|
|
@@ -64,6 +64,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
64
64
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
+
const assetHashByChunk = createAssetHashByChunkMap(compilation.chunks);
|
|
67
68
|
const assets = compilation.assets;
|
|
68
69
|
const entries = Object.entries(assets);
|
|
69
70
|
const outputDir = compiler.options?.output?.path ? path.resolve(compiler.options.output.path) : process.cwd();
|
|
@@ -119,9 +120,10 @@ function setupWebpackV4EmitHook(options) {
|
|
|
119
120
|
}
|
|
120
121
|
};
|
|
121
122
|
const groupedEntries = getGroupedEntries(entries, compilerOptions);
|
|
122
|
-
await
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
const runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
124
|
+
forceCollect: false,
|
|
125
|
+
allowEmpty: false
|
|
126
|
+
});
|
|
125
127
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
126
128
|
const tasks = [];
|
|
127
129
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -129,11 +131,14 @@ function setupWebpackV4EmitHook(options) {
|
|
|
129
131
|
const [file, originalSource] = element;
|
|
130
132
|
const rawSource = originalSource.source().toString();
|
|
131
133
|
const cacheKey = file;
|
|
134
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
132
135
|
tasks.push(
|
|
133
136
|
processCachedTask({
|
|
134
137
|
cache: compilerOptions.cache,
|
|
135
138
|
cacheKey,
|
|
139
|
+
hashKey: `${file}:asset`,
|
|
136
140
|
rawSource,
|
|
141
|
+
hash: chunkHash,
|
|
137
142
|
applyResult(source) {
|
|
138
143
|
compilation.updateAsset(file, source);
|
|
139
144
|
},
|
|
@@ -166,11 +171,14 @@ function setupWebpackV4EmitHook(options) {
|
|
|
166
171
|
const initialValue = assetSource.source();
|
|
167
172
|
const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
|
|
168
173
|
const absoluteFile = toAbsoluteOutputPath(file, outputDir);
|
|
174
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
169
175
|
jsTaskFactories.push(async () => {
|
|
170
176
|
await processCachedTask({
|
|
171
177
|
cache: compilerOptions.cache,
|
|
172
178
|
cacheKey,
|
|
179
|
+
hashKey: `${file}:asset`,
|
|
173
180
|
rawSource: initialRawSource,
|
|
181
|
+
hash: chunkHash,
|
|
174
182
|
applyResult(source) {
|
|
175
183
|
compilation.updateAsset(file, source);
|
|
176
184
|
},
|
|
@@ -205,11 +213,14 @@ function setupWebpackV4EmitHook(options) {
|
|
|
205
213
|
const [file, originalSource] = element;
|
|
206
214
|
const rawSource = originalSource.source().toString();
|
|
207
215
|
const cacheKey = file;
|
|
216
|
+
const chunkHash = assetHashByChunk.get(file);
|
|
208
217
|
tasks.push(
|
|
209
218
|
processCachedTask({
|
|
210
219
|
cache: compilerOptions.cache,
|
|
211
220
|
cacheKey,
|
|
221
|
+
hashKey: `${file}:asset`,
|
|
212
222
|
rawSource,
|
|
223
|
+
hash: chunkHash,
|
|
213
224
|
applyResult(source) {
|
|
214
225
|
compilation.updateAsset(file, source);
|
|
215
226
|
},
|
|
@@ -402,13 +413,25 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
402
413
|
refreshTailwindcssPatcher,
|
|
403
414
|
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
404
415
|
};
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
416
|
+
let runtimeSetPrepared = false;
|
|
417
|
+
let runtimeSetSignature;
|
|
418
|
+
compiler.hooks.compilation.tap(pluginName, () => {
|
|
419
|
+
runtimeSetPrepared = false;
|
|
420
|
+
});
|
|
408
421
|
async function getClassSetInLoader() {
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
422
|
+
if (runtimeSetPrepared) {
|
|
423
|
+
return;
|
|
424
|
+
}
|
|
425
|
+
const signature = getRuntimeClassSetSignature(runtimeState.twPatcher);
|
|
426
|
+
const forceRefresh = signature !== runtimeSetSignature;
|
|
427
|
+
runtimeSetPrepared = true;
|
|
428
|
+
await ensureRuntimeClassSet(runtimeState, {
|
|
429
|
+
forceRefresh,
|
|
430
|
+
forceCollect: true,
|
|
431
|
+
clearCache: forceRefresh,
|
|
432
|
+
allowEmpty: true
|
|
433
|
+
});
|
|
434
|
+
runtimeSetSignature = signature;
|
|
412
435
|
}
|
|
413
436
|
onLoad();
|
|
414
437
|
setupWebpackV4Loaders({
|
|
@@ -427,7 +450,6 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
427
450
|
options: this.options,
|
|
428
451
|
appType: this.appType,
|
|
429
452
|
runtimeState,
|
|
430
|
-
refreshRuntimeState,
|
|
431
453
|
debug
|
|
432
454
|
});
|
|
433
455
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.10.0-beta.2",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -168,8 +168,8 @@
|
|
|
168
168
|
"@babel/traverse": "~7.29.0",
|
|
169
169
|
"@babel/types": "~7.29.0",
|
|
170
170
|
"@tailwindcss-mangle/config": "^6.1.0",
|
|
171
|
-
"@vue/compiler-dom": "^3.5.
|
|
172
|
-
"@vue/compiler-sfc": "^3.5.
|
|
171
|
+
"@vue/compiler-dom": "^3.5.28",
|
|
172
|
+
"@vue/compiler-sfc": "^3.5.28",
|
|
173
173
|
"@weapp-core/escape": "~7.0.0",
|
|
174
174
|
"@weapp-core/regex": "~1.0.1",
|
|
175
175
|
"cac": "^6.7.14",
|
|
@@ -180,13 +180,13 @@
|
|
|
180
180
|
"local-pkg": "^1.1.2",
|
|
181
181
|
"lru-cache": "10.4.3",
|
|
182
182
|
"magic-string": "0.30.21",
|
|
183
|
-
"semver": "~7.7.
|
|
183
|
+
"semver": "~7.7.4",
|
|
184
184
|
"tailwindcss-patch": "^8.6.1",
|
|
185
185
|
"webpack-sources": "3.3.3",
|
|
186
186
|
"yaml": "^2.8.2",
|
|
187
187
|
"@weapp-tailwindcss/shared": "1.1.2",
|
|
188
188
|
"@weapp-tailwindcss/logger": "1.1.0",
|
|
189
|
-
"@weapp-tailwindcss/postcss": "2.1.
|
|
189
|
+
"@weapp-tailwindcss/postcss": "2.1.5-beta.0"
|
|
190
190
|
},
|
|
191
191
|
"scripts": {
|
|
192
192
|
"dev": "tsup --watch --sourcemap",
|
|
@@ -213,6 +213,7 @@
|
|
|
213
213
|
"lint": "eslint .",
|
|
214
214
|
"lint:fix": "eslint ./src --fix",
|
|
215
215
|
"postinstall": "node bin/weapp-tailwindcss.js patch",
|
|
216
|
-
"bench:vite-dev-hmr": "tsx scripts/vite-dev-hmr-bench.ts"
|
|
216
|
+
"bench:vite-dev-hmr": "tsx scripts/vite-dev-hmr-bench.ts",
|
|
217
|
+
"test:watch-hmr": "tsx scripts/watch-hmr-regression.ts"
|
|
217
218
|
}
|
|
218
219
|
}
|