weapp-tailwindcss 4.10.1 → 4.10.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-EE4DYM4E.js → chunk-3R7FDZJL.js} +27 -17
- package/dist/{chunk-K7CTHHN2.js → chunk-6VKE7EWV.js} +28 -27
- package/dist/{chunk-GKT5AE7D.mjs → chunk-ACNOEKQI.mjs} +1 -1
- package/dist/{chunk-4QCL7FBX.mjs → chunk-BZCCVPSU.mjs} +1 -1
- package/dist/{chunk-P65O2L27.js → chunk-HJVZ4TO3.js} +3 -3
- package/dist/{chunk-7K3R5LV6.js → chunk-I35XJD75.js} +235 -63
- package/dist/{chunk-3BKE5AJQ.mjs → chunk-LHBUALTK.mjs} +4 -3
- package/dist/{chunk-RB7YN5XZ.js → chunk-M2ATX5ZS.js} +3 -3
- package/dist/{chunk-RXM5ERRJ.mjs → chunk-MPVAZKRB.mjs} +201 -29
- package/dist/{chunk-7ZI6WVIU.mjs → chunk-N6JOG5K3.mjs} +3 -2
- package/dist/{chunk-W3EZEDKD.js → chunk-NPZ5QQC7.js} +8 -7
- package/dist/{chunk-ESIT2XWD.mjs → chunk-WJU62RPV.mjs} +13 -3
- package/dist/cli.js +9 -9
- package/dist/cli.mjs +1 -1
- package/dist/core.d.mts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +22 -9
- package/dist/core.mjs +17 -4
- package/dist/defaults.d.mts +1 -1
- package/dist/defaults.d.ts +1 -1
- package/dist/gulp.d.mts +1 -1
- package/dist/gulp.d.ts +1 -1
- package/dist/gulp.js +4 -4
- package/dist/gulp.mjs +3 -3
- package/dist/{index-BESv5MWf.d.ts → index-t_VBjwYm.d.mts} +11 -0
- package/dist/{index-BESv5MWf.d.mts → index-t_VBjwYm.d.ts} +11 -0
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -7
- package/dist/index.mjs +6 -6
- package/dist/presets.d.mts +1 -1
- package/dist/presets.d.ts +1 -1
- package/dist/types.d.mts +14 -2
- package/dist/types.d.ts +14 -2
- package/dist/vite.d.mts +1 -1
- package/dist/vite.d.ts +1 -1
- package/dist/vite.js +4 -4
- package/dist/vite.mjs +3 -3
- package/dist/webpack.d.mts +1 -1
- package/dist/webpack.d.ts +1 -1
- package/dist/webpack.js +5 -5
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.d.mts +1 -1
- package/dist/webpack4.d.ts +1 -1
- package/dist/webpack4.js +27 -26
- package/dist/webpack4.mjs +4 -3
- package/package.json +4 -4
|
@@ -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 _chunkM2ATX5ZSjs = require('./chunk-M2ATX5ZS.js');
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
@@ -24,12 +24,13 @@ var _chunkRB7YN5XZjs = require('./chunk-RB7YN5XZ.js');
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
var
|
|
27
|
+
var _chunkI35XJD75js = require('./chunk-I35XJD75.js');
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
31
31
|
|
|
32
32
|
// src/bundlers/vite/index.ts
|
|
33
|
+
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
33
34
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
34
35
|
var _htmltransform = require('@weapp-tailwindcss/postcss/html-transform'); var _htmltransform2 = _interopRequireDefault(_htmltransform);
|
|
35
36
|
|
|
@@ -54,7 +55,7 @@ function updateStaticAttribute(ms, prop) {
|
|
|
54
55
|
const start = prop.value.loc.start.offset + 1;
|
|
55
56
|
const end = prop.value.loc.end.offset - 1;
|
|
56
57
|
if (start < end) {
|
|
57
|
-
ms.update(start, end,
|
|
58
|
+
ms.update(start, end, _chunkI35XJD75js.replaceWxml.call(void 0, prop.value.content));
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
@@ -66,7 +67,7 @@ function updateDirectiveExpression(ms, prop, jsHandler, runtimeSet) {
|
|
|
66
67
|
if (start >= end) {
|
|
67
68
|
return;
|
|
68
69
|
}
|
|
69
|
-
const generated =
|
|
70
|
+
const generated = _chunkI35XJD75js.generateCode.call(void 0, prop.exp.content, {
|
|
70
71
|
jsHandler,
|
|
71
72
|
runtimeSet,
|
|
72
73
|
wrapExpression: true
|
|
@@ -95,7 +96,7 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
95
96
|
return;
|
|
96
97
|
}
|
|
97
98
|
const { customAttributesEntities, disabledDefaultTemplateHandler = false } = options;
|
|
98
|
-
const matchCustomAttribute =
|
|
99
|
+
const matchCustomAttribute = _chunkI35XJD75js.createAttributeMatcher.call(void 0, customAttributesEntities);
|
|
99
100
|
const ms = new (0, _magicstring2.default)(code);
|
|
100
101
|
const { descriptor, errors } = _compilersfc.parse.call(void 0, code);
|
|
101
102
|
if (errors.length === 0) {
|
|
@@ -186,7 +187,7 @@ function parseVueRequest(id) {
|
|
|
186
187
|
}
|
|
187
188
|
|
|
188
189
|
// src/bundlers/vite/utils.ts
|
|
189
|
-
|
|
190
|
+
|
|
190
191
|
|
|
191
192
|
var _shared = require('@weapp-tailwindcss/shared');
|
|
192
193
|
function slash(p) {
|
|
@@ -735,7 +736,7 @@ function createGenerateBundleHook(context) {
|
|
|
735
736
|
);
|
|
736
737
|
}
|
|
737
738
|
debug2("get runtimeSet, class count: %d", runtime.size);
|
|
738
|
-
const runtimeSignature = _nullishCoalesce(
|
|
739
|
+
const runtimeSignature = _nullishCoalesce(_chunkI35XJD75js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher), () => ( "runtime:missing"));
|
|
739
740
|
const handleLinkedUpdate = (fileName, previous, next) => {
|
|
740
741
|
onUpdate(fileName, previous, next);
|
|
741
742
|
debug2("js linked handle: %s", fileName);
|
|
@@ -756,6 +757,7 @@ function createGenerateBundleHook(context) {
|
|
|
756
757
|
const createHandlerOptions = (absoluteFilename, extra) => ({
|
|
757
758
|
...extra,
|
|
758
759
|
filename: absoluteFilename,
|
|
760
|
+
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
759
761
|
moduleGraph: moduleGraphOptions,
|
|
760
762
|
babelParserOptions: {
|
|
761
763
|
..._nullishCoalesce(_optionalChain([extra, 'optionalAccess', _28 => _28.babelParserOptions]), () => ( {})),
|
|
@@ -1035,7 +1037,7 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1035
1037
|
const { appType, weappTailwindcssDirPosix: weappTailwindcssDirPosix2 } = options;
|
|
1036
1038
|
return [
|
|
1037
1039
|
{
|
|
1038
|
-
name: `${
|
|
1040
|
+
name: `${_chunkI35XJD75js.vitePluginName}:rewrite-css-imports`,
|
|
1039
1041
|
enforce: "pre",
|
|
1040
1042
|
resolveId: {
|
|
1041
1043
|
order: "pre",
|
|
@@ -1077,12 +1079,13 @@ function createRewriteCssImportsPlugins(options) {
|
|
|
1077
1079
|
}
|
|
1078
1080
|
|
|
1079
1081
|
// src/bundlers/vite/index.ts
|
|
1080
|
-
var debug =
|
|
1082
|
+
var debug = _chunkI35XJD75js.createDebug.call(void 0, );
|
|
1081
1083
|
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
1082
1084
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
1083
1085
|
function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
1084
1086
|
const rewriteCssImportsSpecified = Object.prototype.hasOwnProperty.call(options, "rewriteCssImports");
|
|
1085
|
-
const
|
|
1087
|
+
const hasExplicitTailwindcssBasedir = typeof options.tailwindcssBasedir === "string" && options.tailwindcssBasedir.trim().length > 0;
|
|
1088
|
+
const opts = _chunkI35XJD75js.getCompilerContext.call(void 0, options);
|
|
1086
1089
|
const {
|
|
1087
1090
|
disabled,
|
|
1088
1091
|
customAttributes,
|
|
@@ -1107,8 +1110,8 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1107
1110
|
if (disabledOptions.plugin) {
|
|
1108
1111
|
return rewritePlugins.length ? rewritePlugins : void 0;
|
|
1109
1112
|
}
|
|
1110
|
-
const customAttributesEntities =
|
|
1111
|
-
const patchRecorderState =
|
|
1113
|
+
const customAttributesEntities = _chunkI35XJD75js.toCustomAttributesEntities.call(void 0, customAttributes);
|
|
1114
|
+
const patchRecorderState = _chunkM2ATX5ZSjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
1112
1115
|
source: "runtime",
|
|
1113
1116
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
1114
1117
|
});
|
|
@@ -1125,7 +1128,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1125
1128
|
let runtimeRefreshOptionsKey;
|
|
1126
1129
|
function resolveRuntimeRefreshOptions() {
|
|
1127
1130
|
const configPath = _optionalChain([runtimeState, 'access', _29 => _29.twPatcher, 'access', _30 => _30.options, 'optionalAccess', _31 => _31.tailwind, 'optionalAccess', _32 => _32.config]);
|
|
1128
|
-
const signature =
|
|
1131
|
+
const signature = _chunkI35XJD75js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
1129
1132
|
const optionsKey = JSON.stringify({
|
|
1130
1133
|
appType,
|
|
1131
1134
|
uniAppX: Boolean(uniAppX),
|
|
@@ -1146,7 +1149,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1146
1149
|
async function refreshRuntimeState(force) {
|
|
1147
1150
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
1148
1151
|
const shouldRefresh = force || invalidation.changed;
|
|
1149
|
-
const refreshed = await
|
|
1152
|
+
const refreshed = await _chunkI35XJD75js.refreshTailwindRuntimeState.call(void 0, runtimeState, {
|
|
1150
1153
|
force: shouldRefresh,
|
|
1151
1154
|
clearCache: force || invalidation.changed
|
|
1152
1155
|
});
|
|
@@ -1167,7 +1170,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1167
1170
|
}
|
|
1168
1171
|
if (forceRuntimeRefresh || !runtimeSetPromise) {
|
|
1169
1172
|
const invalidation = resolveRuntimeRefreshOptions();
|
|
1170
|
-
const task2 =
|
|
1173
|
+
const task2 = _chunkI35XJD75js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, {
|
|
1171
1174
|
force: forceRuntimeRefresh || invalidation.changed,
|
|
1172
1175
|
skipRefresh: forceRuntimeRefresh,
|
|
1173
1176
|
clearCache: forceRuntimeRefresh || invalidation.changed
|
|
@@ -1203,10 +1206,17 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
1203
1206
|
const plugins = [
|
|
1204
1207
|
...rewritePlugins,
|
|
1205
1208
|
{
|
|
1206
|
-
name: `${
|
|
1209
|
+
name: `${_chunkI35XJD75js.vitePluginName}:post`,
|
|
1207
1210
|
enforce: "post",
|
|
1208
|
-
configResolved(config) {
|
|
1211
|
+
async configResolved(config) {
|
|
1209
1212
|
resolvedConfig = config;
|
|
1213
|
+
const resolvedRoot = config.root ? _path2.default.resolve(config.root) : void 0;
|
|
1214
|
+
if (!hasExplicitTailwindcssBasedir && resolvedRoot && opts.tailwindcssBasedir !== resolvedRoot) {
|
|
1215
|
+
const previousBasedir = opts.tailwindcssBasedir;
|
|
1216
|
+
opts.tailwindcssBasedir = resolvedRoot;
|
|
1217
|
+
debug("align tailwindcss basedir with vite root: %s -> %s", _nullishCoalesce(previousBasedir, () => ( "undefined")), resolvedRoot);
|
|
1218
|
+
await refreshRuntimeState(true);
|
|
1219
|
+
}
|
|
1210
1220
|
if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
|
|
1211
1221
|
const idx = config.css.postcss.plugins.findIndex((x) => (
|
|
1212
1222
|
// @ts-ignore
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkHJVZ4TO3js = require('./chunk-HJVZ4TO3.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 _chunkM2ATX5ZSjs = require('./chunk-M2ATX5ZS.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
32
|
|
|
33
|
-
var
|
|
33
|
+
var _chunkI35XJD75js = require('./chunk-I35XJD75.js');
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
@@ -57,10 +57,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
57
57
|
} = options;
|
|
58
58
|
const { Compilation, sources } = compiler.webpack;
|
|
59
59
|
const { ConcatSource } = sources;
|
|
60
|
-
compiler.hooks.compilation.tap(
|
|
60
|
+
compiler.hooks.compilation.tap(_chunkI35XJD75js.pluginName, (compilation) => {
|
|
61
61
|
compilation.hooks.processAssets.tapPromise(
|
|
62
62
|
{
|
|
63
|
-
name:
|
|
63
|
+
name: _chunkI35XJD75js.pluginName,
|
|
64
64
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
65
65
|
},
|
|
66
66
|
async (assets) => {
|
|
@@ -72,7 +72,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
72
72
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const assetHashByChunk =
|
|
75
|
+
const assetHashByChunk = _chunkHJVZ4TO3js.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
76
76
|
const entries = Object.entries(assets);
|
|
77
77
|
const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
|
|
78
78
|
const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
|
|
@@ -129,7 +129,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
129
129
|
};
|
|
130
130
|
const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
|
|
131
131
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
132
|
-
const runtimeSet = await
|
|
132
|
+
const runtimeSet = await _chunkI35XJD75js.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
133
133
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
134
134
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
135
135
|
forceCollect: true,
|
|
@@ -174,7 +174,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
174
174
|
const jsTaskFactories = [];
|
|
175
175
|
if (Array.isArray(groupedEntries.js)) {
|
|
176
176
|
for (const [file] of groupedEntries.js) {
|
|
177
|
-
const cacheKey =
|
|
177
|
+
const cacheKey = _chunkHJVZ4TO3js.getCacheKey.call(void 0, file);
|
|
178
178
|
const asset = compilation.getAsset(file);
|
|
179
179
|
if (!asset) {
|
|
180
180
|
continue;
|
|
@@ -202,6 +202,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
202
202
|
const currentSource = typeof currentSourceValue === "string" ? currentSourceValue : _nullishCoalesce(_optionalChain([currentSourceValue, 'optionalAccess', _8 => _8.toString, 'call', _9 => _9()]), () => ( ""));
|
|
203
203
|
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, {
|
|
204
204
|
staleClassNameFallback,
|
|
205
|
+
tailwindcssMajorVersion: runtimeState.twPatcher.majorVersion,
|
|
205
206
|
filename: absoluteFile,
|
|
206
207
|
moduleGraph: moduleGraphOptions,
|
|
207
208
|
babelParserOptions: {
|
|
@@ -286,9 +287,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
286
287
|
getClassSetInLoader,
|
|
287
288
|
debug: debug2
|
|
288
289
|
} = options;
|
|
289
|
-
const isMpxApp =
|
|
290
|
+
const isMpxApp = _chunkHJVZ4TO3js.isMpx.call(void 0, appType);
|
|
290
291
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
291
|
-
|
|
292
|
+
_chunkHJVZ4TO3js.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
292
293
|
}
|
|
293
294
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
294
295
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -301,12 +302,12 @@ function setupWebpackV5Loaders(options) {
|
|
|
301
302
|
const classSetLoaderOptions = {
|
|
302
303
|
getClassSet: getClassSetInLoader
|
|
303
304
|
};
|
|
304
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
305
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkHJVZ4TO3js.createLoaderAnchorFinders.call(void 0, appType);
|
|
305
306
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
306
307
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
307
308
|
} : void 0;
|
|
308
309
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
309
|
-
|
|
310
|
+
_chunkHJVZ4TO3js.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
310
311
|
}
|
|
311
312
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
312
313
|
loader: runtimeClassSetLoader,
|
|
@@ -326,17 +327,17 @@ function setupWebpackV5Loaders(options) {
|
|
|
326
327
|
};
|
|
327
328
|
};
|
|
328
329
|
const { NormalModule } = compiler.webpack;
|
|
329
|
-
compiler.hooks.compilation.tap(
|
|
330
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
330
|
+
compiler.hooks.compilation.tap(_chunkI35XJD75js.pluginName, (compilation) => {
|
|
331
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkI35XJD75js.pluginName, (_loaderContext, module) => {
|
|
331
332
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
332
333
|
if (!hasRuntimeLoader) {
|
|
333
334
|
return;
|
|
334
335
|
}
|
|
335
|
-
|
|
336
|
+
_chunkHJVZ4TO3js.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
|
|
336
337
|
const loaderEntries = module.loaders || [];
|
|
337
338
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
338
339
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
339
|
-
const isCssModule =
|
|
340
|
+
const isCssModule = _chunkHJVZ4TO3js.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
340
341
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
341
342
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
342
343
|
}
|
|
@@ -368,7 +369,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
368
369
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
369
370
|
}
|
|
370
371
|
}
|
|
371
|
-
if (runtimeClassSetLoaderExists && !
|
|
372
|
+
if (runtimeClassSetLoaderExists && !_chunkHJVZ4TO3js.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
372
373
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
373
374
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
374
375
|
if (anchorIndex === -1) {
|
|
@@ -383,11 +384,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
383
384
|
}
|
|
384
385
|
|
|
385
386
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
386
|
-
var debug =
|
|
387
|
+
var debug = _chunkI35XJD75js.createDebug.call(void 0, );
|
|
387
388
|
var weappTailwindcssPackageDir = _chunkIIDSY4XZjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
388
389
|
var UnifiedWebpackPluginV5 = class {
|
|
389
390
|
constructor(options = {}) {
|
|
390
|
-
this.options =
|
|
391
|
+
this.options = _chunkI35XJD75js.getCompilerContext.call(void 0, options);
|
|
391
392
|
this.appType = this.options.appType;
|
|
392
393
|
}
|
|
393
394
|
apply(compiler) {
|
|
@@ -403,19 +404,19 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
403
404
|
const disabledOptions = _chunkIIDSY4XZjs.resolveDisabledOptions.call(void 0, disabled);
|
|
404
405
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
405
406
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
406
|
-
const isMpxApp =
|
|
407
|
+
const isMpxApp = _chunkHJVZ4TO3js.isMpx.call(void 0, this.appType);
|
|
407
408
|
if (shouldRewriteCssImports) {
|
|
408
|
-
|
|
409
|
+
_chunkHJVZ4TO3js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
409
410
|
pkgDir: weappTailwindcssPackageDir,
|
|
410
411
|
enabled: true,
|
|
411
412
|
appType: this.appType
|
|
412
413
|
});
|
|
413
|
-
|
|
414
|
+
_chunkHJVZ4TO3js.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
414
415
|
}
|
|
415
416
|
if (disabledOptions.plugin) {
|
|
416
417
|
return;
|
|
417
418
|
}
|
|
418
|
-
const patchRecorderState =
|
|
419
|
+
const patchRecorderState = _chunkM2ATX5ZSjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
419
420
|
source: "runtime",
|
|
420
421
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
421
422
|
});
|
|
@@ -431,18 +432,18 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
431
432
|
runtimeSetPrepared = false;
|
|
432
433
|
};
|
|
433
434
|
if (_optionalChain([compiler, 'access', _13 => _13.hooks, 'access', _14 => _14.thisCompilation, 'optionalAccess', _15 => _15.tap])) {
|
|
434
|
-
compiler.hooks.thisCompilation.tap(
|
|
435
|
+
compiler.hooks.thisCompilation.tap(_chunkI35XJD75js.pluginName, resetRuntimePreparation);
|
|
435
436
|
} else if (_optionalChain([compiler, 'access', _16 => _16.hooks, 'access', _17 => _17.compilation, 'optionalAccess', _18 => _18.tap])) {
|
|
436
|
-
compiler.hooks.compilation.tap(
|
|
437
|
+
compiler.hooks.compilation.tap(_chunkI35XJD75js.pluginName, resetRuntimePreparation);
|
|
437
438
|
}
|
|
438
439
|
async function getClassSetInLoader() {
|
|
439
440
|
if (runtimeSetPrepared) {
|
|
440
441
|
return;
|
|
441
442
|
}
|
|
442
|
-
const signature =
|
|
443
|
+
const signature = _chunkI35XJD75js.getRuntimeClassSetSignature.call(void 0, runtimeState.twPatcher);
|
|
443
444
|
const forceRefresh = signature !== runtimeSetSignature;
|
|
444
445
|
runtimeSetPrepared = true;
|
|
445
|
-
await
|
|
446
|
+
await _chunkI35XJD75js.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
446
447
|
forceRefresh,
|
|
447
448
|
forceCollect: true,
|
|
448
449
|
clearCache: forceRefresh,
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkIIDSY4XZjs = require('./chunk-IIDSY4XZ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkI35XJD75js = require('./chunk-I35XJD75.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(_chunkI35XJD75js.pluginName, (factory) => {
|
|
158
|
+
factory.hooks.beforeResolve.tap(_chunkI35XJD75js.pluginName, (data) => {
|
|
159
159
|
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
160
160
|
});
|
|
161
161
|
});
|