weapp-tailwindcss 4.9.8 → 4.9.9-beta.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-OW5UKXZU.js → chunk-42HSNAKM.js} +3 -3
- package/dist/{chunk-BJWGT5OD.js → chunk-A2ST4H4Y.js} +3 -3
- package/dist/{chunk-Z545JGD6.js → chunk-CAFL5XBF.js} +24 -24
- package/dist/{chunk-N75TUIFJ.mjs → chunk-FT3YGOHE.mjs} +422 -66
- package/dist/{chunk-YJDEI6WM.js → chunk-HQ2G6NBK.js} +434 -78
- package/dist/{chunk-M27GDCY2.mjs → chunk-IY5ZVBL2.mjs} +1 -1
- package/dist/{chunk-W3JRVMJD.mjs → chunk-NBS6RMNM.mjs} +1 -1
- package/dist/{chunk-WJVKUHYW.js → chunk-U4T2HGRZ.js} +7 -7
- package/dist/{chunk-RGMNU44M.mjs → chunk-YPIQUBC4.mjs} +3 -3
- package/dist/{chunk-CKEQFURT.mjs → chunk-YVYWSXU7.mjs} +2 -2
- package/dist/{chunk-EAD4D7DF.js → chunk-YY55J7K3.js} +74 -61
- package/dist/{chunk-77PO4QLM.mjs → chunk-YYE3U4L3.mjs} +19 -6
- package/dist/cli.js +9 -9
- package/dist/cli.mjs +1 -1
- package/dist/core.js +8 -8
- 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 +24 -24
- package/dist/webpack4.mjs +3 -3
- package/package.json +7 -4
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var _chunkDOX3RXJ2js = require('./chunk-DOX3RXJ2.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkYY55J7K3js = require('./chunk-YY55J7K3.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(_chunkYY55J7K3js.pluginName, (factory) => {
|
|
158
|
+
factory.hooks.beforeResolve.tap(_chunkYY55J7K3js.pluginName, (data) => {
|
|
159
159
|
rewriteTailwindcssRequestForCss(data, options.pkgDir, options.appType);
|
|
160
160
|
});
|
|
161
161
|
});
|
|
@@ -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 _chunkYY55J7K3js = require('./chunk-YY55J7K3.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
var _chunkPO3CCFU7js = require('./chunk-PO3CCFU7.js');
|
|
8
8
|
|
|
9
9
|
// src/tailwindcss/recorder.ts
|
|
10
10
|
function setupPatchRecorder(patcher, baseDir, options) {
|
|
11
|
-
const recorder =
|
|
11
|
+
const recorder = _chunkYY55J7K3js.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
|
_chunkPO3CCFU7js.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 ? _chunkYY55J7K3js.createTailwindPatchPromise.call(void 0, patcher, onPatchCompleted) : Promise.resolve();
|
|
20
20
|
return {
|
|
21
21
|
recorder,
|
|
22
22
|
patchPromise,
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunk42HSNAKMjs = require('./chunk-42HSNAKM.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -22,14 +22,14 @@ var _chunkDOX3RXJ2js = require('./chunk-DOX3RXJ2.js');
|
|
|
22
22
|
var _chunkLTJQUORKjs = require('./chunk-LTJQUORK.js');
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
var
|
|
25
|
+
var _chunkA2ST4H4Yjs = require('./chunk-A2ST4H4Y.js');
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkYY55J7K3js = require('./chunk-YY55J7K3.js');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
var _chunkDYLQ6UOIjs = require('./chunk-DYLQ6UOI.js');
|
|
@@ -51,10 +51,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
51
51
|
} = options;
|
|
52
52
|
const { Compilation, sources } = compiler.webpack;
|
|
53
53
|
const { ConcatSource } = sources;
|
|
54
|
-
compiler.hooks.compilation.tap(
|
|
54
|
+
compiler.hooks.compilation.tap(_chunkYY55J7K3js.pluginName, (compilation) => {
|
|
55
55
|
compilation.hooks.processAssets.tapPromise(
|
|
56
56
|
{
|
|
57
|
-
name:
|
|
57
|
+
name: _chunkYY55J7K3js.pluginName,
|
|
58
58
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
59
59
|
},
|
|
60
60
|
async (assets) => {
|
|
@@ -123,7 +123,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
123
123
|
const groupedEntries = _chunkDYLQ6UOIjs.getGroupedEntries.call(void 0, entries, compilerOptions);
|
|
124
124
|
await refreshRuntimeState(true);
|
|
125
125
|
await runtimeState.patchPromise;
|
|
126
|
-
const runtimeSet = await
|
|
126
|
+
const runtimeSet = await _chunkYY55J7K3js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
127
127
|
debug2("get runtimeSet, class count: %d", runtimeSet.size);
|
|
128
128
|
const tasks = [];
|
|
129
129
|
if (Array.isArray(groupedEntries.html)) {
|
|
@@ -160,7 +160,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
160
160
|
const jsTaskFactories = [];
|
|
161
161
|
if (Array.isArray(groupedEntries.js)) {
|
|
162
162
|
for (const [file] of groupedEntries.js) {
|
|
163
|
-
const cacheKey =
|
|
163
|
+
const cacheKey = _chunk42HSNAKMjs.getCacheKey.call(void 0, file);
|
|
164
164
|
const asset = compilation.getAsset(file);
|
|
165
165
|
if (!asset) {
|
|
166
166
|
continue;
|
|
@@ -265,9 +265,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
265
265
|
getClassSetInLoader,
|
|
266
266
|
debug: debug2
|
|
267
267
|
} = options;
|
|
268
|
-
const isMpxApp =
|
|
268
|
+
const isMpxApp = _chunk42HSNAKMjs.isMpx.call(void 0, appType);
|
|
269
269
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
270
|
-
|
|
270
|
+
_chunk42HSNAKMjs.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
271
271
|
}
|
|
272
272
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
273
273
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -280,12 +280,12 @@ function setupWebpackV5Loaders(options) {
|
|
|
280
280
|
const classSetLoaderOptions = {
|
|
281
281
|
getClassSet: getClassSetInLoader
|
|
282
282
|
};
|
|
283
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
283
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunk42HSNAKMjs.createLoaderAnchorFinders.call(void 0, appType);
|
|
284
284
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
285
285
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
286
286
|
} : void 0;
|
|
287
287
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
288
|
-
|
|
288
|
+
_chunk42HSNAKMjs.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
289
289
|
}
|
|
290
290
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
291
291
|
loader: runtimeClassSetLoader,
|
|
@@ -305,17 +305,17 @@ function setupWebpackV5Loaders(options) {
|
|
|
305
305
|
};
|
|
306
306
|
};
|
|
307
307
|
const { NormalModule } = compiler.webpack;
|
|
308
|
-
compiler.hooks.compilation.tap(
|
|
309
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
308
|
+
compiler.hooks.compilation.tap(_chunkYY55J7K3js.pluginName, (compilation) => {
|
|
309
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkYY55J7K3js.pluginName, (_loaderContext, module) => {
|
|
310
310
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
311
311
|
if (!hasRuntimeLoader) {
|
|
312
312
|
return;
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
_chunk42HSNAKMjs.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
|
|
315
315
|
const loaderEntries = module.loaders || [];
|
|
316
316
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
317
317
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
318
|
-
const isCssModule =
|
|
318
|
+
const isCssModule = _chunk42HSNAKMjs.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
319
319
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
320
320
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
321
321
|
}
|
|
@@ -347,7 +347,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
347
347
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
|
-
if (runtimeClassSetLoaderExists && !
|
|
350
|
+
if (runtimeClassSetLoaderExists && !_chunk42HSNAKMjs.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
351
351
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
352
352
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
353
353
|
if (anchorIndex === -1) {
|
|
@@ -362,11 +362,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
362
362
|
}
|
|
363
363
|
|
|
364
364
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
365
|
-
var debug =
|
|
365
|
+
var debug = _chunkYY55J7K3js.createDebug.call(void 0, );
|
|
366
366
|
var weappTailwindcssPackageDir = _chunkDOX3RXJ2js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
367
367
|
var UnifiedWebpackPluginV5 = class {
|
|
368
368
|
constructor(options = {}) {
|
|
369
|
-
this.options =
|
|
369
|
+
this.options = _chunkYY55J7K3js.getCompilerContext.call(void 0, options);
|
|
370
370
|
this.appType = this.options.appType;
|
|
371
371
|
}
|
|
372
372
|
apply(compiler) {
|
|
@@ -382,19 +382,19 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
382
382
|
const disabledOptions = _chunkDOX3RXJ2js.resolveDisabledOptions.call(void 0, disabled);
|
|
383
383
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
384
384
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
385
|
-
const isMpxApp =
|
|
385
|
+
const isMpxApp = _chunk42HSNAKMjs.isMpx.call(void 0, this.appType);
|
|
386
386
|
if (shouldRewriteCssImports) {
|
|
387
|
-
|
|
387
|
+
_chunk42HSNAKMjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
388
388
|
pkgDir: weappTailwindcssPackageDir,
|
|
389
389
|
enabled: true,
|
|
390
390
|
appType: this.appType
|
|
391
391
|
});
|
|
392
|
-
|
|
392
|
+
_chunk42HSNAKMjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
393
393
|
}
|
|
394
394
|
if (disabledOptions.plugin) {
|
|
395
395
|
return;
|
|
396
396
|
}
|
|
397
|
-
const patchRecorderState =
|
|
397
|
+
const patchRecorderState = _chunkA2ST4H4Yjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
398
398
|
source: "runtime",
|
|
399
399
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
400
400
|
});
|
|
@@ -405,12 +405,12 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
405
405
|
onPatchCompleted: patchRecorderState.onPatchCompleted
|
|
406
406
|
};
|
|
407
407
|
const refreshRuntimeState = async (force) => {
|
|
408
|
-
await
|
|
408
|
+
await _chunkYY55J7K3js.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
409
409
|
};
|
|
410
410
|
async function getClassSetInLoader() {
|
|
411
411
|
await refreshRuntimeState(true);
|
|
412
412
|
await runtimeState.patchPromise;
|
|
413
|
-
await
|
|
413
|
+
await _chunkYY55J7K3js.collectRuntimeClassSet.call(void 0, runtimeState.twPatcher, { force: true, skipRefresh: true });
|
|
414
414
|
}
|
|
415
415
|
onLoad();
|
|
416
416
|
setupWebpackV5Loaders({
|