weapp-tailwindcss 4.10.2 → 4.11.0-alpha.0
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-3XVUGMTY.mjs → chunk-2LH6PZH3.mjs} +8 -4
- package/dist/{chunk-3WUHHFLF.mjs → chunk-35EI5JMK.mjs} +4 -2
- package/dist/{chunk-HJVZ4TO3.js → chunk-7XQXBJL6.js} +10 -9
- package/dist/{chunk-5U24PLVV.js → chunk-ACTJYB33.js} +4 -2
- package/dist/{chunk-ACNOEKQI.mjs → chunk-CLNUBO3Q.mjs} +6 -5
- package/dist/{chunk-HT76VHOV.mjs → chunk-DOH7FULQ.mjs} +1 -1
- package/dist/{chunk-BZCCVPSU.mjs → chunk-EOK3NZVC.mjs} +2 -2
- package/dist/{chunk-3R7FDZJL.js → chunk-FKUPQQYX.js} +377 -215
- package/dist/{chunk-MPVAZKRB.mjs → chunk-FMWKBZWX.mjs} +835 -317
- package/dist/{chunk-NPZ5QQC7.js → chunk-FV4ZRTAK.js} +57 -17
- package/dist/{chunk-IIDSY4XZ.js → chunk-G3G437UE.js} +2 -2
- package/dist/{chunk-I35XJD75.js → chunk-I4EOMKX2.js} +900 -382
- package/dist/{chunk-N6JOG5K3.mjs → chunk-OIDFSOER.mjs} +52 -12
- package/dist/{chunk-DBAAU4LK.js → chunk-OV7FX6XR.js} +1 -1
- package/dist/{chunk-SR4GC2F4.js → chunk-OYSABARD.js} +8 -4
- package/dist/{chunk-M2ATX5ZS.js → chunk-PXZUQ7RR.js} +5 -5
- package/dist/{chunk-WJU62RPV.mjs → chunk-QX2A7SBB.mjs} +352 -190
- package/dist/{chunk-5APD2MNV.js → chunk-RXNSOSCT.js} +13 -9
- package/dist/{chunk-LHBUALTK.mjs → chunk-W3JO6LBC.mjs} +30 -16
- package/dist/{chunk-6VKE7EWV.js → chunk-WGFNCK5B.js} +60 -46
- package/dist/{chunk-QOTLDKI4.mjs → chunk-XGUD52TA.mjs} +9 -5
- package/dist/cli.js +45 -42
- package/dist/cli.mjs +9 -6
- package/dist/core.d.mts +4 -3
- package/dist/core.d.ts +4 -3
- package/dist/core.js +124 -30
- package/dist/core.mjs +119 -25
- package/dist/css-macro/postcss.js +6 -5
- package/dist/css-macro/postcss.mjs +4 -3
- package/dist/css-macro.js +5 -5
- package/dist/css-macro.mjs +2 -2
- package/dist/defaults.js +3 -3
- package/dist/defaults.mjs +2 -2
- package/dist/escape.js +2 -1
- package/dist/escape.mjs +2 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +8 -7
- package/dist/gulp.mjs +8 -7
- package/dist/index.js +11 -11
- package/dist/index.mjs +9 -9
- 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 +2 -2
- package/dist/reset.js +1 -1
- package/dist/reset.mjs +1 -1
- package/dist/types.js +1 -1
- package/dist/types.mjs +1 -1
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +9 -8
- package/dist/vite.mjs +8 -7
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +10 -9
- package/dist/webpack.mjs +8 -7
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +64 -49
- package/dist/webpack4.mjs +33 -18
- package/package.json +7 -7
package/dist/webpack.d.mts
CHANGED
|
@@ -22,4 +22,4 @@ declare class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
|
|
|
22
22
|
apply(compiler: Compiler): void;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export { UnifiedWebpackPluginV5, UserDefinedOptions, weappTailwindcssPackageDir };
|
|
25
|
+
export { UnifiedWebpackPluginV5, UserDefinedOptions, UnifiedWebpackPluginV5 as weappTailwindcss, weappTailwindcssPackageDir };
|
package/dist/webpack.d.ts
CHANGED
|
@@ -22,4 +22,4 @@ declare class UnifiedWebpackPluginV5 implements IBaseWebpackPlugin {
|
|
|
22
22
|
apply(compiler: Compiler): void;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
export { UnifiedWebpackPluginV5, UserDefinedOptions, weappTailwindcssPackageDir };
|
|
25
|
+
export { UnifiedWebpackPluginV5, UserDefinedOptions, UnifiedWebpackPluginV5 as weappTailwindcss, weappTailwindcssPackageDir };
|
package/dist/webpack.js
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
5
|
-
require('./chunk-
|
|
6
|
-
require('./chunk-
|
|
4
|
+
var _chunkWGFNCK5Bjs = require('./chunk-WGFNCK5B.js');
|
|
5
|
+
require('./chunk-7XQXBJL6.js');
|
|
6
|
+
require('./chunk-G3G437UE.js');
|
|
7
7
|
require('./chunk-LTJQUORK.js');
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
11
|
-
require('./chunk-
|
|
8
|
+
require('./chunk-PXZUQ7RR.js');
|
|
9
|
+
require('./chunk-I4EOMKX2.js');
|
|
10
|
+
require('./chunk-RXNSOSCT.js');
|
|
11
|
+
require('./chunk-ACTJYB33.js');
|
|
12
12
|
require('./chunk-DYLQ6UOI.js');
|
|
13
|
-
require('./chunk-
|
|
13
|
+
require('./chunk-OV7FX6XR.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
exports.UnifiedWebpackPluginV5 = _chunkWGFNCK5Bjs.UnifiedWebpackPluginV5; exports.weappTailwindcss = _chunkWGFNCK5Bjs.UnifiedWebpackPluginV5; exports.weappTailwindcssPackageDir = _chunkWGFNCK5Bjs.weappTailwindcssPackageDir;
|
package/dist/webpack.mjs
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UnifiedWebpackPluginV5,
|
|
3
3
|
weappTailwindcssPackageDir
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-W3JO6LBC.mjs";
|
|
5
|
+
import "./chunk-CLNUBO3Q.mjs";
|
|
6
6
|
import "./chunk-F2CKKG6Q.mjs";
|
|
7
7
|
import "./chunk-RRHPTTCP.mjs";
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
11
|
-
import "./chunk-
|
|
8
|
+
import "./chunk-EOK3NZVC.mjs";
|
|
9
|
+
import "./chunk-FMWKBZWX.mjs";
|
|
10
|
+
import "./chunk-XGUD52TA.mjs";
|
|
11
|
+
import "./chunk-35EI5JMK.mjs";
|
|
12
12
|
import "./chunk-OOHJLO5M.mjs";
|
|
13
|
-
import "./chunk-
|
|
13
|
+
import "./chunk-DOH7FULQ.mjs";
|
|
14
14
|
export {
|
|
15
15
|
UnifiedWebpackPluginV5,
|
|
16
|
+
UnifiedWebpackPluginV5 as weappTailwindcss,
|
|
16
17
|
weappTailwindcssPackageDir
|
|
17
18
|
};
|
package/dist/webpack4.d.mts
CHANGED
|
@@ -23,4 +23,4 @@ declare class UnifiedWebpackPluginV4 implements IBaseWebpackPlugin {
|
|
|
23
23
|
apply(compiler: Compiler): void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export { UnifiedWebpackPluginV4, UserDefinedOptions, weappTailwindcssPackageDir };
|
|
26
|
+
export { UnifiedWebpackPluginV4, UserDefinedOptions, UnifiedWebpackPluginV4 as weappTailwindcss, weappTailwindcssPackageDir };
|
package/dist/webpack4.d.ts
CHANGED
|
@@ -23,4 +23,4 @@ declare class UnifiedWebpackPluginV4 implements IBaseWebpackPlugin {
|
|
|
23
23
|
apply(compiler: Compiler): void;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
export { UnifiedWebpackPluginV4, UserDefinedOptions, weappTailwindcssPackageDir };
|
|
26
|
+
export { UnifiedWebpackPluginV4, UserDefinedOptions, UnifiedWebpackPluginV4 as weappTailwindcss, weappTailwindcssPackageDir };
|
package/dist/webpack4.js
CHANGED
|
@@ -10,33 +10,33 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk7XQXBJL6js = require('./chunk-7XQXBJL6.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunkG3G437UEjs = require('./chunk-G3G437UE.js');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunkPXZUQ7RRjs = require('./chunk-PXZUQ7RR.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
34
|
-
require('./chunk-
|
|
35
|
-
require('./chunk-
|
|
33
|
+
var _chunkI4EOMKX2js = require('./chunk-I4EOMKX2.js');
|
|
34
|
+
require('./chunk-RXNSOSCT.js');
|
|
35
|
+
require('./chunk-ACTJYB33.js');
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
39
|
-
require('./chunk-
|
|
39
|
+
require('./chunk-OV7FX6XR.js');
|
|
40
40
|
|
|
41
41
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
42
42
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
@@ -59,7 +59,8 @@ function setupWebpackV4EmitHook(options) {
|
|
|
59
59
|
runtimeState,
|
|
60
60
|
debug: debug2
|
|
61
61
|
} = options;
|
|
62
|
-
|
|
62
|
+
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
63
|
+
compiler.hooks.emit.tapPromise(_chunkI4EOMKX2js.pluginName, async (compilation) => {
|
|
63
64
|
await runtimeState.patchPromise;
|
|
64
65
|
compilerOptions.onStart();
|
|
65
66
|
debug2("start");
|
|
@@ -68,20 +69,20 @@ function setupWebpackV4EmitHook(options) {
|
|
|
68
69
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
69
70
|
}
|
|
70
71
|
}
|
|
71
|
-
const assetHashByChunk =
|
|
72
|
+
const assetHashByChunk = _chunk7XQXBJL6js.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
72
73
|
const assets = compilation.assets;
|
|
73
74
|
const entries = Object.entries(assets);
|
|
74
75
|
const outputDir = _optionalChain([compiler, 'access', _ => _.options, 'optionalAccess', _2 => _2.output, 'optionalAccess', _3 => _3.path]) ? _path2.default.resolve(compiler.options.output.path) : _process2.default.cwd();
|
|
75
76
|
const jsAssets = /* @__PURE__ */ new Map();
|
|
76
77
|
for (const [file] of entries) {
|
|
77
78
|
if (compilerOptions.jsMatcher(file) || compilerOptions.wxsMatcher(file)) {
|
|
78
|
-
const absolute =
|
|
79
|
+
const absolute = _chunkG3G437UEjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
79
80
|
jsAssets.set(absolute, file);
|
|
80
81
|
}
|
|
81
82
|
}
|
|
82
83
|
const moduleGraphOptions = {
|
|
83
84
|
resolve(specifier, importer) {
|
|
84
|
-
return
|
|
85
|
+
return _chunkG3G437UEjs.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
|
|
85
86
|
},
|
|
86
87
|
load: (id) => {
|
|
87
88
|
const assetName = jsAssets.get(id);
|
|
@@ -124,13 +125,36 @@ function setupWebpackV4EmitHook(options) {
|
|
|
124
125
|
}
|
|
125
126
|
};
|
|
126
127
|
const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
|
|
128
|
+
const getCssHandlerOptions = (file) => {
|
|
129
|
+
const majorVersion = runtimeState.twPatcher.majorVersion;
|
|
130
|
+
const isMainChunk = compilerOptions.mainCssChunkMatcher(file, appType);
|
|
131
|
+
const cacheKey = `${_nullishCoalesce(majorVersion, () => ( "unknown"))}:${isMainChunk ? "1" : "0"}:${file}`;
|
|
132
|
+
const cached = cssHandlerOptionsCache.get(cacheKey);
|
|
133
|
+
if (cached) {
|
|
134
|
+
return cached;
|
|
135
|
+
}
|
|
136
|
+
const created = {
|
|
137
|
+
isMainChunk,
|
|
138
|
+
postcssOptions: {
|
|
139
|
+
options: {
|
|
140
|
+
from: file
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
majorVersion
|
|
144
|
+
};
|
|
145
|
+
cssHandlerOptionsCache.set(cacheKey, created);
|
|
146
|
+
return created;
|
|
147
|
+
};
|
|
127
148
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
128
|
-
const runtimeSet = await
|
|
149
|
+
const runtimeSet = await _chunkI4EOMKX2js.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
129
150
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
130
151
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
131
152
|
forceCollect: true,
|
|
132
153
|
allowEmpty: false
|
|
133
154
|
});
|
|
155
|
+
const defaultTemplateHandlerOptions = {
|
|
156
|
+
runtimeSet
|
|
157
|
+
};
|
|
134
158
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
135
159
|
const tasks = [];
|
|
136
160
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -153,9 +177,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
153
177
|
debug2("html cache hit: %s", file);
|
|
154
178
|
},
|
|
155
179
|
transform: async () => {
|
|
156
|
-
const wxml = await compilerOptions.templateHandler(rawSource,
|
|
157
|
-
runtimeSet
|
|
158
|
-
});
|
|
180
|
+
const wxml = await compilerOptions.templateHandler(rawSource, defaultTemplateHandlerOptions);
|
|
159
181
|
const source = new (0, _webpacksources.ConcatSource)(wxml);
|
|
160
182
|
compilerOptions.onUpdate(file, rawSource, wxml);
|
|
161
183
|
debug2("html handle: %s", file);
|
|
@@ -170,14 +192,14 @@ function setupWebpackV4EmitHook(options) {
|
|
|
170
192
|
const jsTaskFactories = [];
|
|
171
193
|
if (Array.isArray(groupedEntries.js)) {
|
|
172
194
|
for (const [file] of groupedEntries.js) {
|
|
173
|
-
const cacheKey =
|
|
195
|
+
const cacheKey = _chunk7XQXBJL6js.getCacheKey.call(void 0, file);
|
|
174
196
|
const assetSource = compilation.assets[file];
|
|
175
197
|
if (!assetSource) {
|
|
176
198
|
continue;
|
|
177
199
|
}
|
|
178
200
|
const initialValue = assetSource.source();
|
|
179
201
|
const initialRawSource = typeof initialValue === "string" ? initialValue : initialValue.toString();
|
|
180
|
-
const absoluteFile =
|
|
202
|
+
const absoluteFile = _chunkG3G437UEjs.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
181
203
|
const chunkHash = assetHashByChunk.get(file);
|
|
182
204
|
jsTaskFactories.push(async () => {
|
|
183
205
|
await _chunkLTJQUORKjs.processCachedTask.call(void 0, {
|
|
@@ -238,15 +260,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
238
260
|
},
|
|
239
261
|
transform: async () => {
|
|
240
262
|
await runtimeState.patchPromise;
|
|
241
|
-
const { css } = await compilerOptions.styleHandler(rawSource,
|
|
242
|
-
isMainChunk: compilerOptions.mainCssChunkMatcher(file, appType),
|
|
243
|
-
postcssOptions: {
|
|
244
|
-
options: {
|
|
245
|
-
from: file
|
|
246
|
-
}
|
|
247
|
-
},
|
|
248
|
-
majorVersion: runtimeState.twPatcher.majorVersion
|
|
249
|
-
});
|
|
263
|
+
const { css } = await compilerOptions.styleHandler(rawSource, getCssHandlerOptions(file));
|
|
250
264
|
const source = new (0, _webpacksources.ConcatSource)(css);
|
|
251
265
|
compilerOptions.onUpdate(file, rawSource, css);
|
|
252
266
|
debug2("css handle: %s", file);
|
|
@@ -258,7 +272,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
258
272
|
);
|
|
259
273
|
}
|
|
260
274
|
}
|
|
261
|
-
|
|
275
|
+
_chunkG3G437UEjs.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
262
276
|
await Promise.all(tasks);
|
|
263
277
|
debug2("end");
|
|
264
278
|
compilerOptions.onEnd();
|
|
@@ -281,9 +295,9 @@ function setupWebpackV4Loaders(options) {
|
|
|
281
295
|
getClassSetInLoader,
|
|
282
296
|
debug: debug2
|
|
283
297
|
} = options;
|
|
284
|
-
const isMpxApp =
|
|
298
|
+
const isMpxApp = _chunk7XQXBJL6js.isMpx.call(void 0, appType);
|
|
285
299
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
286
|
-
|
|
300
|
+
_chunk7XQXBJL6js.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
287
301
|
}
|
|
288
302
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
289
303
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -296,12 +310,12 @@ function setupWebpackV4Loaders(options) {
|
|
|
296
310
|
const classSetLoaderOptions = {
|
|
297
311
|
getClassSet: getClassSetInLoader
|
|
298
312
|
};
|
|
299
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
313
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunk7XQXBJL6js.createLoaderAnchorFinders.call(void 0, appType);
|
|
300
314
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
301
315
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
302
316
|
} : void 0;
|
|
303
317
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
304
|
-
|
|
318
|
+
_chunk7XQXBJL6js.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
305
319
|
}
|
|
306
320
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
307
321
|
loader: runtimeClassSetLoader,
|
|
@@ -320,19 +334,19 @@ function setupWebpackV4Loaders(options) {
|
|
|
320
334
|
type: null
|
|
321
335
|
};
|
|
322
336
|
};
|
|
323
|
-
compiler.hooks.compilation.tap(
|
|
324
|
-
compilation.hooks.normalModuleLoader.tap(
|
|
337
|
+
compiler.hooks.compilation.tap(_chunkI4EOMKX2js.pluginName, (compilation) => {
|
|
338
|
+
compilation.hooks.normalModuleLoader.tap(_chunkI4EOMKX2js.pluginName, (_loaderContext, module) => {
|
|
325
339
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
326
340
|
if (!hasRuntimeLoader) {
|
|
327
341
|
return;
|
|
328
342
|
}
|
|
329
|
-
if (shouldRewriteCssImports &&
|
|
330
|
-
|
|
343
|
+
if (shouldRewriteCssImports && _chunk7XQXBJL6js.isMpx.call(void 0, appType) && typeof _loaderContext.resolve === "function") {
|
|
344
|
+
_chunk7XQXBJL6js.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, true);
|
|
331
345
|
}
|
|
332
346
|
const loaderEntries = module.loaders || [];
|
|
333
347
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
334
348
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
335
|
-
const isCssModule =
|
|
349
|
+
const isCssModule = _chunk7XQXBJL6js.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
336
350
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
337
351
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
338
352
|
}
|
|
@@ -366,7 +380,7 @@ function setupWebpackV4Loaders(options) {
|
|
|
366
380
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
367
381
|
}
|
|
368
382
|
}
|
|
369
|
-
if (runtimeClassSetLoaderExists && !
|
|
383
|
+
if (runtimeClassSetLoaderExists && !_chunk7XQXBJL6js.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
370
384
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
371
385
|
if (anchorIndex === -1) {
|
|
372
386
|
anchorlessInsert(createRuntimeClassSetLoaderEntry(), "before");
|
|
@@ -380,11 +394,11 @@ function setupWebpackV4Loaders(options) {
|
|
|
380
394
|
}
|
|
381
395
|
|
|
382
396
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
383
|
-
var debug =
|
|
384
|
-
var weappTailwindcssPackageDir =
|
|
397
|
+
var debug = _chunkI4EOMKX2js.createDebug.call(void 0, );
|
|
398
|
+
var weappTailwindcssPackageDir = _chunkG3G437UEjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
385
399
|
var UnifiedWebpackPluginV4 = class {
|
|
386
400
|
constructor(options = {}) {
|
|
387
|
-
this.options =
|
|
401
|
+
this.options = _chunkI4EOMKX2js.getCompilerContext.call(void 0, options);
|
|
388
402
|
this.appType = this.options.appType;
|
|
389
403
|
}
|
|
390
404
|
apply(compiler) {
|
|
@@ -397,22 +411,22 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
397
411
|
twPatcher: initialTwPatcher,
|
|
398
412
|
refreshTailwindcssPatcher
|
|
399
413
|
} = this.options;
|
|
400
|
-
const disabledOptions =
|
|
414
|
+
const disabledOptions = _chunkG3G437UEjs.resolveDisabledOptions.call(void 0, disabled);
|
|
401
415
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
402
416
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
403
|
-
const isMpxApp =
|
|
417
|
+
const isMpxApp = _chunk7XQXBJL6js.isMpx.call(void 0, this.appType);
|
|
404
418
|
if (shouldRewriteCssImports) {
|
|
405
|
-
|
|
419
|
+
_chunk7XQXBJL6js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
406
420
|
pkgDir: weappTailwindcssPackageDir,
|
|
407
421
|
enabled: true,
|
|
408
422
|
appType: this.appType
|
|
409
423
|
});
|
|
410
|
-
|
|
424
|
+
_chunk7XQXBJL6js.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
411
425
|
}
|
|
412
426
|
if (disabledOptions.plugin) {
|
|
413
427
|
return;
|
|
414
428
|
}
|
|
415
|
-
const patchRecorderState =
|
|
429
|
+
const patchRecorderState = _chunkPXZUQ7RRjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
416
430
|
source: "runtime",
|
|
417
431
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
418
432
|
});
|
|
@@ -424,17 +438,17 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
424
438
|
};
|
|
425
439
|
let runtimeSetPrepared = false;
|
|
426
440
|
let runtimeSetSignature;
|
|
427
|
-
compiler.hooks.compilation.tap(
|
|
441
|
+
compiler.hooks.compilation.tap(_chunkI4EOMKX2js.pluginName, () => {
|
|
428
442
|
runtimeSetPrepared = false;
|
|
429
443
|
});
|
|
430
444
|
async function getClassSetInLoader() {
|
|
431
445
|
if (runtimeSetPrepared) {
|
|
432
446
|
return;
|
|
433
447
|
}
|
|
434
|
-
const signature =
|
|
448
|
+
const signature = _chunkI4EOMKX2js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
435
449
|
const forceRefresh = signature !== runtimeSetSignature;
|
|
436
450
|
runtimeSetPrepared = true;
|
|
437
|
-
await
|
|
451
|
+
await _chunkI4EOMKX2js.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
438
452
|
forceRefresh,
|
|
439
453
|
forceCollect: true,
|
|
440
454
|
clearCache: forceRefresh,
|
|
@@ -466,4 +480,5 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
466
480
|
|
|
467
481
|
|
|
468
482
|
|
|
469
|
-
|
|
483
|
+
|
|
484
|
+
exports.UnifiedWebpackPluginV4 = UnifiedWebpackPluginV4; exports.weappTailwindcss = UnifiedWebpackPluginV4; exports.weappTailwindcssPackageDir = weappTailwindcssPackageDir;
|
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-CLNUBO3Q.mjs";
|
|
14
14
|
import {
|
|
15
15
|
pushConcurrentTaskFactories,
|
|
16
16
|
resolveDisabledOptions,
|
|
@@ -23,22 +23,22 @@ import {
|
|
|
23
23
|
} from "./chunk-RRHPTTCP.mjs";
|
|
24
24
|
import {
|
|
25
25
|
setupPatchRecorder
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-EOK3NZVC.mjs";
|
|
27
27
|
import {
|
|
28
28
|
createDebug,
|
|
29
29
|
ensureRuntimeClassSet,
|
|
30
30
|
getCompilerContext,
|
|
31
31
|
getRuntimeClassSetSignature,
|
|
32
32
|
pluginName
|
|
33
|
-
} from "./chunk-
|
|
34
|
-
import "./chunk-
|
|
35
|
-
import "./chunk-
|
|
33
|
+
} from "./chunk-FMWKBZWX.mjs";
|
|
34
|
+
import "./chunk-XGUD52TA.mjs";
|
|
35
|
+
import "./chunk-35EI5JMK.mjs";
|
|
36
36
|
import {
|
|
37
37
|
getGroupedEntries
|
|
38
38
|
} from "./chunk-OOHJLO5M.mjs";
|
|
39
39
|
import {
|
|
40
40
|
__dirname
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-DOH7FULQ.mjs";
|
|
42
42
|
|
|
43
43
|
// src/bundlers/webpack/BaseUnifiedPlugin/v4.ts
|
|
44
44
|
import process3 from "process";
|
|
@@ -61,6 +61,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
61
61
|
runtimeState,
|
|
62
62
|
debug: debug2
|
|
63
63
|
} = options;
|
|
64
|
+
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
64
65
|
compiler.hooks.emit.tapPromise(pluginName, async (compilation) => {
|
|
65
66
|
await runtimeState.patchPromise;
|
|
66
67
|
compilerOptions.onStart();
|
|
@@ -126,6 +127,26 @@ function setupWebpackV4EmitHook(options) {
|
|
|
126
127
|
}
|
|
127
128
|
};
|
|
128
129
|
const groupedEntries = getGroupedEntries(entries, compilerOptions);
|
|
130
|
+
const getCssHandlerOptions = (file) => {
|
|
131
|
+
const majorVersion = runtimeState.twPatcher.majorVersion;
|
|
132
|
+
const isMainChunk = compilerOptions.mainCssChunkMatcher(file, appType);
|
|
133
|
+
const cacheKey = `${majorVersion ?? "unknown"}:${isMainChunk ? "1" : "0"}:${file}`;
|
|
134
|
+
const cached = cssHandlerOptionsCache.get(cacheKey);
|
|
135
|
+
if (cached) {
|
|
136
|
+
return cached;
|
|
137
|
+
}
|
|
138
|
+
const created = {
|
|
139
|
+
isMainChunk,
|
|
140
|
+
postcssOptions: {
|
|
141
|
+
options: {
|
|
142
|
+
from: file
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
majorVersion
|
|
146
|
+
};
|
|
147
|
+
cssHandlerOptionsCache.set(cacheKey, created);
|
|
148
|
+
return created;
|
|
149
|
+
};
|
|
129
150
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
130
151
|
const runtimeSet = await ensureRuntimeClassSet(runtimeState, {
|
|
131
152
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
@@ -133,6 +154,9 @@ function setupWebpackV4EmitHook(options) {
|
|
|
133
154
|
forceCollect: true,
|
|
134
155
|
allowEmpty: false
|
|
135
156
|
});
|
|
157
|
+
const defaultTemplateHandlerOptions = {
|
|
158
|
+
runtimeSet
|
|
159
|
+
};
|
|
136
160
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
137
161
|
const tasks = [];
|
|
138
162
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -155,9 +179,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
155
179
|
debug2("html cache hit: %s", file);
|
|
156
180
|
},
|
|
157
181
|
transform: async () => {
|
|
158
|
-
const wxml = await compilerOptions.templateHandler(rawSource,
|
|
159
|
-
runtimeSet
|
|
160
|
-
});
|
|
182
|
+
const wxml = await compilerOptions.templateHandler(rawSource, defaultTemplateHandlerOptions);
|
|
161
183
|
const source = new ConcatSource(wxml);
|
|
162
184
|
compilerOptions.onUpdate(file, rawSource, wxml);
|
|
163
185
|
debug2("html handle: %s", file);
|
|
@@ -240,15 +262,7 @@ function setupWebpackV4EmitHook(options) {
|
|
|
240
262
|
},
|
|
241
263
|
transform: async () => {
|
|
242
264
|
await runtimeState.patchPromise;
|
|
243
|
-
const { css } = await compilerOptions.styleHandler(rawSource,
|
|
244
|
-
isMainChunk: compilerOptions.mainCssChunkMatcher(file, appType),
|
|
245
|
-
postcssOptions: {
|
|
246
|
-
options: {
|
|
247
|
-
from: file
|
|
248
|
-
}
|
|
249
|
-
},
|
|
250
|
-
majorVersion: runtimeState.twPatcher.majorVersion
|
|
251
|
-
});
|
|
265
|
+
const { css } = await compilerOptions.styleHandler(rawSource, getCssHandlerOptions(file));
|
|
252
266
|
const source = new ConcatSource(css);
|
|
253
267
|
compilerOptions.onUpdate(file, rawSource, css);
|
|
254
268
|
debug2("css handle: %s", file);
|
|
@@ -467,5 +481,6 @@ var UnifiedWebpackPluginV4 = class {
|
|
|
467
481
|
};
|
|
468
482
|
export {
|
|
469
483
|
UnifiedWebpackPluginV4,
|
|
484
|
+
UnifiedWebpackPluginV4 as weappTailwindcss,
|
|
470
485
|
weappTailwindcssPackageDir
|
|
471
486
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-tailwindcss",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.11.0-alpha.0",
|
|
4
4
|
"description": "把 tailwindcss 原子化样式思想,带给小程序开发者们! bring tailwindcss to miniprogram developers!",
|
|
5
5
|
"author": "ice breaker <1324318532@qq.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -167,9 +167,9 @@
|
|
|
167
167
|
"@babel/parser": "~7.29.0",
|
|
168
168
|
"@babel/traverse": "~7.29.0",
|
|
169
169
|
"@babel/types": "~7.29.0",
|
|
170
|
-
"@tailwindcss-mangle/config": "^6.1.
|
|
171
|
-
"@vue/compiler-dom": "^3.5.
|
|
172
|
-
"@vue/compiler-sfc": "^3.5.
|
|
170
|
+
"@tailwindcss-mangle/config": "^6.1.3",
|
|
171
|
+
"@vue/compiler-dom": "^3.5.30",
|
|
172
|
+
"@vue/compiler-sfc": "^3.5.30",
|
|
173
173
|
"@weapp-core/escape": "~7.0.0",
|
|
174
174
|
"@weapp-core/regex": "~1.0.1",
|
|
175
175
|
"cac": "^6.7.14",
|
|
@@ -181,12 +181,12 @@
|
|
|
181
181
|
"lru-cache": "10.4.3",
|
|
182
182
|
"magic-string": "0.30.21",
|
|
183
183
|
"semver": "~7.7.4",
|
|
184
|
-
"tailwindcss-patch": "^8.7.
|
|
184
|
+
"tailwindcss-patch": "^8.7.3",
|
|
185
185
|
"webpack-sources": "3.3.4",
|
|
186
186
|
"yaml": "^2.8.2",
|
|
187
|
-
"@weapp-tailwindcss/postcss": "2.1.5",
|
|
188
187
|
"@weapp-tailwindcss/logger": "1.1.0",
|
|
189
|
-
"@weapp-tailwindcss/
|
|
188
|
+
"@weapp-tailwindcss/postcss": "2.1.6-alpha.0",
|
|
189
|
+
"@weapp-tailwindcss/shared": "1.1.3-alpha.0"
|
|
190
190
|
},
|
|
191
191
|
"scripts": {
|
|
192
192
|
"dev": "tsup --watch --sourcemap",
|