weapp-tailwindcss 4.12.0-alpha.1 → 4.12.0-alpha.3
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/bin/weapp-tailwindcss.js +21 -1
- package/dist/{chunk-CAZQZPMY.js → chunk-2PFYPSPO.js} +36 -36
- package/dist/{chunk-F2CKKG6Q.mjs → chunk-3VQKDHGP.mjs} +12 -4
- package/dist/{chunk-5CF3HTTN.mjs → chunk-6MIA3KYY.mjs} +2 -2
- package/dist/{chunk-C2E5ZLNI.mjs → chunk-6VMGUTN6.mjs} +3 -3
- package/dist/{chunk-OYSABARD.js → chunk-E7I5TW5K.js} +3 -2
- package/dist/{chunk-V34LWQTS.mjs → chunk-I5H5RDWS.mjs} +40 -17
- package/dist/{chunk-ZABCOAAS.mjs → chunk-J6FIO3RO.mjs} +48 -34
- package/dist/{chunk-GMKSBLNY.js → chunk-L3O54VR6.js} +13 -5
- package/dist/{chunk-RQWWSU4U.js → chunk-OSWTWMAK.js} +23 -9
- package/dist/{chunk-IUYO6NQO.js → chunk-P2X2S444.js} +7 -7
- package/dist/{chunk-4LBAL3RE.js → chunk-SON7XE3T.js} +73 -50
- package/dist/{chunk-CTGWJGKJ.js → chunk-UVMAPQU7.js} +5 -5
- package/dist/{chunk-JRLWGMVZ.mjs → chunk-XHTCHZVE.mjs} +1 -1
- package/dist/{chunk-2LH6PZH3.mjs → chunk-ZCH4YINE.mjs} +3 -2
- package/dist/cli.js +2236 -164
- package/dist/cli.mjs +2241 -169
- package/dist/core.js +7 -7
- package/dist/core.mjs +1 -1
- package/dist/css-macro/postcss.js +3 -3
- package/dist/css-macro/postcss.mjs +1 -1
- package/dist/css-macro.js +4 -4
- package/dist/css-macro.mjs +1 -1
- package/dist/gulp.js +3 -3
- package/dist/gulp.mjs +2 -2
- 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/weapp-tw-css-import-rewrite-loader.js +10 -5
- package/dist/weapp-tw-runtime-classset-loader.js +9 -4
- package/dist/webpack.js +5 -5
- package/dist/webpack.mjs +4 -4
- package/dist/webpack4.js +56 -52
- package/dist/webpack4.mjs +26 -22
- package/package.json +7 -6
- package/scripts/postinstall.mjs +59 -0
package/bin/weapp-tailwindcss.js
CHANGED
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const fs = require('node:fs')
|
|
3
3
|
const path = require('node:path')
|
|
4
|
+
const process = require('node:process')
|
|
5
|
+
|
|
6
|
+
function isInstallLifecycle() {
|
|
7
|
+
return process.env.npm_lifecycle_event === 'postinstall' || process.env.npm_lifecycle_event === 'prepare'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function isMissingRuntimeModuleError(error) {
|
|
11
|
+
return error && error.code === 'MODULE_NOT_FOUND'
|
|
12
|
+
}
|
|
4
13
|
|
|
5
14
|
const cliPath = path.resolve(__dirname, '../dist/cli.js')
|
|
6
15
|
if (fs.existsSync(cliPath)) {
|
|
7
|
-
|
|
16
|
+
try {
|
|
17
|
+
require(cliPath)
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (isInstallLifecycle() && isMissingRuntimeModuleError(error)) {
|
|
21
|
+
console.error('[weapp-tailwindcss] install lifecycle patch skipped because a runtime module is missing.')
|
|
22
|
+
console.error('Run `pnpm --filter weapp-tailwindcss build` before strict CLI validation.')
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
throw error
|
|
26
|
+
}
|
|
27
|
+
}
|
|
8
28
|
}
|
|
@@ -11,14 +11,14 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkUVMAPQU7js = require('./chunk-UVMAPQU7.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
var
|
|
21
|
+
var _chunkL3O54VR6js = require('./chunk-L3O54VR6.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
@@ -29,7 +29,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkOSWTWMAKjs = require('./chunk-OSWTWMAK.js');
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
@@ -64,10 +64,10 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
64
64
|
const { Compilation, sources } = compiler.webpack;
|
|
65
65
|
const { ConcatSource } = sources;
|
|
66
66
|
const cssHandlerOptionsCache = /* @__PURE__ */ new Map();
|
|
67
|
-
compiler.hooks.compilation.tap(
|
|
67
|
+
compiler.hooks.compilation.tap(_chunkOSWTWMAKjs.pluginName, (compilation) => {
|
|
68
68
|
compilation.hooks.processAssets.tapPromise(
|
|
69
69
|
{
|
|
70
|
-
name:
|
|
70
|
+
name: _chunkOSWTWMAKjs.pluginName,
|
|
71
71
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
72
72
|
},
|
|
73
73
|
async (assets) => {
|
|
@@ -79,20 +79,20 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
79
79
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
const assetHashByChunk =
|
|
82
|
+
const assetHashByChunk = _chunkUVMAPQU7js.createAssetHashByChunkMap.call(void 0, compilation.chunks);
|
|
83
83
|
const entries = Object.entries(assets);
|
|
84
84
|
const compilerOutputPath = _nullishCoalesce(_optionalChain([compilation, 'access', _ => _.compiler, 'optionalAccess', _2 => _2.outputPath]), () => ( compiler.outputPath));
|
|
85
85
|
const outputDir = compilerOutputPath ? _path2.default.resolve(compilerOutputPath) : _nullishCoalesce(_optionalChain([compilation, 'access', _3 => _3.outputOptions, 'optionalAccess', _4 => _4.path]), () => ( _process2.default.cwd()));
|
|
86
86
|
const jsAssets = /* @__PURE__ */ new Map();
|
|
87
87
|
for (const [file] of entries) {
|
|
88
88
|
if (compilerOptions.jsMatcher(file) || compilerOptions.wxsMatcher(file)) {
|
|
89
|
-
const absolute =
|
|
89
|
+
const absolute = _chunkL3O54VR6js.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
90
90
|
jsAssets.set(absolute, file);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
const moduleGraphOptions = {
|
|
94
94
|
resolve(specifier, importer) {
|
|
95
|
-
return
|
|
95
|
+
return _chunkL3O54VR6js.resolveOutputSpecifier.call(void 0, specifier, importer, outputDir, (candidate) => jsAssets.has(candidate));
|
|
96
96
|
},
|
|
97
97
|
load: (id) => {
|
|
98
98
|
const assetName = jsAssets.get(id);
|
|
@@ -158,7 +158,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
158
158
|
const staleClassNameFallback = resolveWebpackStaleClassNameFallback(compilerOptions.staleClassNameFallback, compiler);
|
|
159
159
|
const forceRuntimeRefresh = getRuntimeRefreshRequirement();
|
|
160
160
|
debug2("processAssets ensure runtime set forceRefresh=%s major=%s", forceRuntimeRefresh, _nullishCoalesce(runtimeState.twPatcher.majorVersion, () => ( "unknown")));
|
|
161
|
-
const runtimeSet = await
|
|
161
|
+
const runtimeSet = await _chunkOSWTWMAKjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
162
162
|
forceRefresh: forceRuntimeRefresh,
|
|
163
163
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
164
164
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
@@ -208,12 +208,12 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
208
208
|
const jsTaskFactories = [];
|
|
209
209
|
if (Array.isArray(groupedEntries.js)) {
|
|
210
210
|
for (const [file] of groupedEntries.js) {
|
|
211
|
-
const cacheKey =
|
|
211
|
+
const cacheKey = _chunkUVMAPQU7js.getCacheKey.call(void 0, file);
|
|
212
212
|
const asset = compilation.getAsset(file);
|
|
213
213
|
if (!asset) {
|
|
214
214
|
continue;
|
|
215
215
|
}
|
|
216
|
-
const absoluteFile =
|
|
216
|
+
const absoluteFile = _chunkL3O54VR6js.toAbsoluteOutputPath.call(void 0, file, outputDir);
|
|
217
217
|
const initialSource = asset.source.source();
|
|
218
218
|
const initialRawSource = typeof initialSource === "string" ? initialSource : initialSource.toString();
|
|
219
219
|
const chunkHash = assetHashByChunk.get(file);
|
|
@@ -243,7 +243,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
243
243
|
sourceFilename: absoluteFile
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
if (
|
|
246
|
+
if (_chunkOSWTWMAKjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
|
|
247
247
|
return { result: new ConcatSource(currentSource) };
|
|
248
248
|
}
|
|
249
249
|
const { code, linked } = await compilerOptions.jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
@@ -292,7 +292,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
292
292
|
);
|
|
293
293
|
}
|
|
294
294
|
}
|
|
295
|
-
|
|
295
|
+
_chunkL3O54VR6js.pushConcurrentTaskFactories.call(void 0, tasks, jsTaskFactories);
|
|
296
296
|
await Promise.all(tasks);
|
|
297
297
|
debug2("end");
|
|
298
298
|
compilerOptions.onEnd();
|
|
@@ -318,9 +318,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
318
318
|
getRuntimeWatchDependencies,
|
|
319
319
|
debug: debug2
|
|
320
320
|
} = options;
|
|
321
|
-
const isMpxApp =
|
|
321
|
+
const isMpxApp = _chunkUVMAPQU7js.isMpx.call(void 0, appType);
|
|
322
322
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
323
|
-
|
|
323
|
+
_chunkUVMAPQU7js.ensureMpxTailwindcssAliases.call(void 0, compiler, weappTailwindcssPackageDir2);
|
|
324
324
|
}
|
|
325
325
|
const runtimeClassSetLoader = _nullishCoalesce(runtimeLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-runtime-classset-loader.js")));
|
|
326
326
|
const runtimeCssImportRewriteLoader = shouldRewriteCssImports ? _nullishCoalesce(runtimeCssImportRewriteLoaderPath, () => ( _path2.default.resolve(__dirname, "./weapp-tw-css-import-rewrite-loader.js"))) : void 0;
|
|
@@ -334,12 +334,12 @@ function setupWebpackV5Loaders(options) {
|
|
|
334
334
|
getClassSet: getClassSetInLoader,
|
|
335
335
|
getWatchDependencies: getRuntimeWatchDependencies
|
|
336
336
|
};
|
|
337
|
-
const { findRewriteAnchor, findClassSetAnchor } =
|
|
337
|
+
const { findRewriteAnchor, findClassSetAnchor } = _chunkUVMAPQU7js.createLoaderAnchorFinders.call(void 0, appType);
|
|
338
338
|
const cssImportRewriteLoaderOptions = runtimeLoaderRewriteOptions ? {
|
|
339
339
|
rewriteCssImports: runtimeLoaderRewriteOptions
|
|
340
340
|
} : void 0;
|
|
341
341
|
if (runtimeCssImportRewriteLoader && shouldRewriteCssImports && cssImportRewriteLoaderOptions && isMpxApp) {
|
|
342
|
-
|
|
342
|
+
_chunkUVMAPQU7js.injectMpxCssRewritePreRules.call(void 0, compiler, runtimeCssImportRewriteLoader, cssImportRewriteLoaderOptions);
|
|
343
343
|
}
|
|
344
344
|
const createRuntimeClassSetLoaderEntry = () => ({
|
|
345
345
|
loader: runtimeClassSetLoader,
|
|
@@ -359,17 +359,17 @@ function setupWebpackV5Loaders(options) {
|
|
|
359
359
|
};
|
|
360
360
|
};
|
|
361
361
|
const { NormalModule } = compiler.webpack;
|
|
362
|
-
compiler.hooks.compilation.tap(
|
|
363
|
-
NormalModule.getCompilationHooks(compilation).loader.tap(
|
|
362
|
+
compiler.hooks.compilation.tap(_chunkOSWTWMAKjs.pluginName, (compilation) => {
|
|
363
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkOSWTWMAKjs.pluginName, (_loaderContext, module) => {
|
|
364
364
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
365
365
|
if (!hasRuntimeLoader) {
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
_chunkUVMAPQU7js.patchMpxLoaderResolve.call(void 0, _loaderContext, weappTailwindcssPackageDir2, shouldRewriteCssImports && isMpxApp);
|
|
369
369
|
const loaderEntries = module.loaders || [];
|
|
370
370
|
let rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
371
371
|
const classSetAnchorIdx = findClassSetAnchor(loaderEntries);
|
|
372
|
-
const isCssModule =
|
|
372
|
+
const isCssModule = _chunkUVMAPQU7js.isCssLikeModuleResource.call(void 0, module.resource, compilerOptions.cssMatcher, appType);
|
|
373
373
|
if (_process2.default.env.WEAPP_TW_LOADER_DEBUG && isCssModule) {
|
|
374
374
|
debug2("loader hook css module: %s loaders=%o anchors=%o", module.resource, loaderEntries.map((x) => x.loader), { rewriteAnchorIdx, classSetAnchorIdx });
|
|
375
375
|
}
|
|
@@ -401,7 +401,7 @@ function setupWebpackV5Loaders(options) {
|
|
|
401
401
|
rewriteAnchorIdx = findRewriteAnchor(loaderEntries);
|
|
402
402
|
}
|
|
403
403
|
}
|
|
404
|
-
if (runtimeClassSetLoaderExists && !
|
|
404
|
+
if (runtimeClassSetLoaderExists && !_chunkUVMAPQU7js.hasLoaderEntry.call(void 0, loaderEntries, runtimeClassSetLoader)) {
|
|
405
405
|
const classSetLoaderEntry = createRuntimeClassSetLoaderEntry();
|
|
406
406
|
const anchorIndex = findClassSetAnchor(loaderEntries);
|
|
407
407
|
if (anchorIndex === -1) {
|
|
@@ -416,11 +416,11 @@ function setupWebpackV5Loaders(options) {
|
|
|
416
416
|
}
|
|
417
417
|
|
|
418
418
|
// src/bundlers/webpack/BaseUnifiedPlugin/v5.ts
|
|
419
|
-
var debug =
|
|
420
|
-
var weappTailwindcssPackageDir =
|
|
419
|
+
var debug = _chunkOSWTWMAKjs.createDebug.call(void 0, );
|
|
420
|
+
var weappTailwindcssPackageDir = _chunkL3O54VR6js.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
421
421
|
var UnifiedWebpackPluginV5 = class {
|
|
422
422
|
constructor(options = {}) {
|
|
423
|
-
this.options =
|
|
423
|
+
this.options = _chunkOSWTWMAKjs.getCompilerContext.call(void 0, options);
|
|
424
424
|
this.appType = this.options.appType;
|
|
425
425
|
}
|
|
426
426
|
apply(compiler) {
|
|
@@ -433,22 +433,22 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
433
433
|
twPatcher: initialTwPatcher,
|
|
434
434
|
refreshTailwindcssPatcher
|
|
435
435
|
} = this.options;
|
|
436
|
-
const disabledOptions =
|
|
436
|
+
const disabledOptions = _chunkL3O54VR6js.resolveDisabledOptions.call(void 0, disabled);
|
|
437
437
|
const isTailwindcssV4 = (_nullishCoalesce(initialTwPatcher.majorVersion, () => ( 0))) >= 4;
|
|
438
438
|
const shouldRewriteCssImports = isTailwindcssV4 && this.options.rewriteCssImports !== false && !disabledOptions.rewriteCssImports;
|
|
439
|
-
const isMpxApp =
|
|
439
|
+
const isMpxApp = _chunkUVMAPQU7js.isMpx.call(void 0, this.appType);
|
|
440
440
|
if (shouldRewriteCssImports) {
|
|
441
|
-
|
|
441
|
+
_chunkUVMAPQU7js.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
442
442
|
pkgDir: weappTailwindcssPackageDir,
|
|
443
443
|
enabled: true,
|
|
444
444
|
appType: this.appType
|
|
445
445
|
});
|
|
446
|
-
|
|
446
|
+
_chunkUVMAPQU7js.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
447
447
|
}
|
|
448
448
|
if (disabledOptions.plugin) {
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
-
const patchRecorderState =
|
|
451
|
+
const patchRecorderState = _chunkOSWTWMAKjs.setupPatchRecorder.call(void 0, initialTwPatcher, this.options.tailwindcssBasedir, {
|
|
452
452
|
source: "runtime",
|
|
453
453
|
cwd: _nullishCoalesce(this.options.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
454
454
|
});
|
|
@@ -506,21 +506,21 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
506
506
|
runtimeMetadataPrepared = true;
|
|
507
507
|
};
|
|
508
508
|
const syncRuntimeRefreshRequirement = () => {
|
|
509
|
-
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation ||
|
|
509
|
+
runtimeRefreshRequiredForCompilation = runtimeRefreshRequiredForCompilation || _chunkUVMAPQU7js.hasWatchChanges.call(void 0, compiler);
|
|
510
510
|
};
|
|
511
511
|
const resetRuntimePreparation = () => {
|
|
512
512
|
runtimeSetPrepared = false;
|
|
513
513
|
runtimeMetadataPrepared = false;
|
|
514
514
|
syncRuntimeRefreshRequirement();
|
|
515
515
|
};
|
|
516
|
-
_optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(
|
|
516
|
+
_optionalChain([compiler, 'access', _20 => _20.hooks, 'access', _21 => _21.invalid, 'optionalAccess', _22 => _22.tap, 'optionalCall', _23 => _23(_chunkOSWTWMAKjs.pluginName, () => {
|
|
517
517
|
runtimeRefreshRequiredForCompilation = true;
|
|
518
518
|
})]);
|
|
519
|
-
_optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(
|
|
519
|
+
_optionalChain([compiler, 'access', _24 => _24.hooks, 'access', _25 => _25.watchRun, 'optionalAccess', _26 => _26.tap, 'optionalCall', _27 => _27(_chunkOSWTWMAKjs.pluginName, syncRuntimeRefreshRequirement)]);
|
|
520
520
|
if (_optionalChain([compiler, 'access', _28 => _28.hooks, 'access', _29 => _29.thisCompilation, 'optionalAccess', _30 => _30.tap])) {
|
|
521
|
-
compiler.hooks.thisCompilation.tap(
|
|
521
|
+
compiler.hooks.thisCompilation.tap(_chunkOSWTWMAKjs.pluginName, resetRuntimePreparation);
|
|
522
522
|
} else if (_optionalChain([compiler, 'access', _31 => _31.hooks, 'access', _32 => _32.compilation, 'optionalAccess', _33 => _33.tap])) {
|
|
523
|
-
compiler.hooks.compilation.tap(
|
|
523
|
+
compiler.hooks.compilation.tap(_chunkOSWTWMAKjs.pluginName, resetRuntimePreparation);
|
|
524
524
|
}
|
|
525
525
|
async function getClassSetInLoader() {
|
|
526
526
|
if (runtimeSetPrepared) {
|
|
@@ -530,7 +530,7 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
530
530
|
const forceRefresh = runtimeRefreshRequiredForCompilation || signature !== runtimeSetSignature;
|
|
531
531
|
debug("runtime loader ensure class set forceRefresh=%s watchDirty=%s signatureChanged=%s", forceRefresh, runtimeRefreshRequiredForCompilation, signature !== runtimeSetSignature);
|
|
532
532
|
runtimeSetPrepared = true;
|
|
533
|
-
await
|
|
533
|
+
await _chunkOSWTWMAKjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
534
534
|
forceRefresh,
|
|
535
535
|
forceCollect: true,
|
|
536
536
|
clearCache: forceRefresh,
|
|
@@ -25,8 +25,12 @@ function resolvePackageDir(name) {
|
|
|
25
25
|
import path2 from "path";
|
|
26
26
|
var QUERY_HASH_RE = /[?#].*$/u;
|
|
27
27
|
var PROTOCOL_RE = /^[a-z][a-z+.-]*:/iu;
|
|
28
|
+
var WINDOWS_ABSOLUTE_RE = /^[a-z]:[\\/]/iu;
|
|
28
29
|
var VIRTUAL_PREFIX = "\0";
|
|
29
30
|
var JS_EXTENSIONS = [".js", ".mjs", ".cjs"];
|
|
31
|
+
function normalizeOutputPathKey(value) {
|
|
32
|
+
return path2.normalize(value).replace(/\\/g, "/");
|
|
33
|
+
}
|
|
30
34
|
function stripQueryAndHash(specifier) {
|
|
31
35
|
return specifier.replace(QUERY_HASH_RE, "");
|
|
32
36
|
}
|
|
@@ -38,11 +42,14 @@ function isResolvableSpecifier(specifier) {
|
|
|
38
42
|
if (normalized.startsWith(VIRTUAL_PREFIX)) {
|
|
39
43
|
return false;
|
|
40
44
|
}
|
|
45
|
+
if (path2.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) {
|
|
46
|
+
return true;
|
|
47
|
+
}
|
|
41
48
|
return !PROTOCOL_RE.test(normalized);
|
|
42
49
|
}
|
|
43
50
|
function toAbsoluteOutputPath(fileName, outDir) {
|
|
44
|
-
if (path2.isAbsolute(fileName)) {
|
|
45
|
-
return fileName;
|
|
51
|
+
if (path2.isAbsolute(fileName) || WINDOWS_ABSOLUTE_RE.test(fileName)) {
|
|
52
|
+
return path2.normalize(fileName);
|
|
46
53
|
}
|
|
47
54
|
return path2.resolve(outDir, fileName);
|
|
48
55
|
}
|
|
@@ -66,8 +73,8 @@ function resolveOutputSpecifier(specifier, importer, outDir, hasOutput) {
|
|
|
66
73
|
}
|
|
67
74
|
const normalized = stripQueryAndHash(specifier);
|
|
68
75
|
let candidate;
|
|
69
|
-
if (path2.isAbsolute(normalized)) {
|
|
70
|
-
candidate = normalized;
|
|
76
|
+
if (path2.isAbsolute(normalized) || WINDOWS_ABSOLUTE_RE.test(normalized)) {
|
|
77
|
+
candidate = path2.normalize(normalized);
|
|
71
78
|
} else if (normalized.startsWith("/")) {
|
|
72
79
|
candidate = path2.resolve(outDir, normalized.slice(1));
|
|
73
80
|
} else {
|
|
@@ -161,6 +168,7 @@ function rewriteTailwindcssImportsInCode(code, pkgDir, options) {
|
|
|
161
168
|
}
|
|
162
169
|
|
|
163
170
|
export {
|
|
171
|
+
normalizeOutputPathKey,
|
|
164
172
|
toAbsoluteOutputPath,
|
|
165
173
|
resolveOutputSpecifier,
|
|
166
174
|
resolveDisabledOptions,
|
|
@@ -11,14 +11,14 @@ import {
|
|
|
11
11
|
isMpx,
|
|
12
12
|
patchMpxLoaderResolve,
|
|
13
13
|
setupMpxTailwindcssRedirect
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-6MIA3KYY.mjs";
|
|
15
15
|
import {
|
|
16
16
|
pushConcurrentTaskFactories,
|
|
17
17
|
resolveDisabledOptions,
|
|
18
18
|
resolveOutputSpecifier,
|
|
19
19
|
resolvePackageDir,
|
|
20
20
|
toAbsoluteOutputPath
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3VQKDHGP.mjs";
|
|
22
22
|
import {
|
|
23
23
|
processCachedTask
|
|
24
24
|
} from "./chunk-76S2EME4.mjs";
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
pluginName,
|
|
30
30
|
setupPatchRecorder,
|
|
31
31
|
shouldSkipJsTransform
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-J6FIO3RO.mjs";
|
|
33
33
|
import {
|
|
34
34
|
getRuntimeClassSetSignature,
|
|
35
35
|
resolveTailwindcssOptions
|
|
@@ -33,12 +33,13 @@ function ifndef(text) {
|
|
|
33
33
|
}
|
|
34
34
|
var QUERY_KEY_REGEX = new RegExp(`\\(\\s*${queryKey}\\s*:\\s*"([^)]*)"\\)`, "g");
|
|
35
35
|
function matchCustomPropertyFromValue(str, cb) {
|
|
36
|
-
let arr;
|
|
37
36
|
let index = 0;
|
|
38
37
|
QUERY_KEY_REGEX.lastIndex = 0;
|
|
39
|
-
|
|
38
|
+
let arr = QUERY_KEY_REGEX.exec(str);
|
|
39
|
+
while (arr !== null) {
|
|
40
40
|
cb(arr, index);
|
|
41
41
|
index++;
|
|
42
|
+
arr = QUERY_KEY_REGEX.exec(str);
|
|
42
43
|
}
|
|
43
44
|
}
|
|
44
45
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
normalizeOutputPathKey,
|
|
2
3
|
pushConcurrentTaskFactories,
|
|
3
4
|
resolveDisabledOptions,
|
|
4
5
|
resolveOutputSpecifier,
|
|
@@ -6,7 +7,7 @@ import {
|
|
|
6
7
|
resolveTailwindcssImport,
|
|
7
8
|
rewriteTailwindcssImportsInCode,
|
|
8
9
|
toAbsoluteOutputPath
|
|
9
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3VQKDHGP.mjs";
|
|
10
11
|
import {
|
|
11
12
|
processCachedTask
|
|
12
13
|
} from "./chunk-76S2EME4.mjs";
|
|
@@ -27,7 +28,7 @@ import {
|
|
|
27
28
|
toCustomAttributesEntities,
|
|
28
29
|
traverse,
|
|
29
30
|
vitePluginName
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-J6FIO3RO.mjs";
|
|
31
32
|
import {
|
|
32
33
|
findNearestPackageRoot,
|
|
33
34
|
findTailwindConfig,
|
|
@@ -398,13 +399,17 @@ function transformUVue(code, id, jsHandler, runtimeSet, options = {}) {
|
|
|
398
399
|
${localStyleCollector.toStyleBlock()}`);
|
|
399
400
|
}
|
|
400
401
|
}
|
|
401
|
-
|
|
402
|
-
code: ms.toString()
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
const result = {
|
|
403
|
+
code: ms.toString()
|
|
404
|
+
};
|
|
405
|
+
Object.defineProperty(result, "map", {
|
|
406
|
+
configurable: true,
|
|
407
|
+
enumerable: true,
|
|
408
|
+
get() {
|
|
405
409
|
return ms.generateMap();
|
|
406
410
|
}
|
|
407
|
-
};
|
|
411
|
+
});
|
|
412
|
+
return result;
|
|
408
413
|
}
|
|
409
414
|
|
|
410
415
|
// src/bundlers/vite/query.ts
|
|
@@ -757,19 +762,24 @@ function isJavaScriptEntry(entry) {
|
|
|
757
762
|
return entry.fileName.endsWith(".js");
|
|
758
763
|
}
|
|
759
764
|
function createBundleModuleGraphOptions(outputDir, entries) {
|
|
765
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
766
|
+
for (const [id, entry] of entries) {
|
|
767
|
+
normalizedEntries.set(normalizeOutputPathKey(id), entry);
|
|
768
|
+
}
|
|
769
|
+
const getEntry = (id) => entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
760
770
|
return {
|
|
761
771
|
resolve(specifier, importer) {
|
|
762
|
-
return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) =>
|
|
772
|
+
return resolveOutputSpecifier(specifier, importer, outputDir, (candidate) => Boolean(getEntry(candidate)));
|
|
763
773
|
},
|
|
764
774
|
load(id) {
|
|
765
|
-
const entry =
|
|
775
|
+
const entry = getEntry(id);
|
|
766
776
|
if (!entry) {
|
|
767
777
|
return void 0;
|
|
768
778
|
}
|
|
769
779
|
return readOutputEntry(entry);
|
|
770
780
|
},
|
|
771
781
|
filter(id) {
|
|
772
|
-
return
|
|
782
|
+
return Boolean(getEntry(id));
|
|
773
783
|
}
|
|
774
784
|
};
|
|
775
785
|
}
|
|
@@ -777,8 +787,12 @@ function applyLinkedResults(linked, entries, onLinkedUpdate, onApplied) {
|
|
|
777
787
|
if (!linked) {
|
|
778
788
|
return;
|
|
779
789
|
}
|
|
790
|
+
const normalizedEntries = /* @__PURE__ */ new Map();
|
|
791
|
+
for (const [entryId, entry] of entries) {
|
|
792
|
+
normalizedEntries.set(normalizeOutputPathKey(entryId), entry);
|
|
793
|
+
}
|
|
780
794
|
for (const [id, { code }] of Object.entries(linked)) {
|
|
781
|
-
const entry = entries.get(id);
|
|
795
|
+
const entry = entries.get(id) ?? normalizedEntries.get(normalizeOutputPathKey(id));
|
|
782
796
|
if (!entry) {
|
|
783
797
|
continue;
|
|
784
798
|
}
|
|
@@ -1258,6 +1272,11 @@ function createGenerateBundleHook(context) {
|
|
|
1258
1272
|
);
|
|
1259
1273
|
}
|
|
1260
1274
|
const jsEntries = snapshot.jsEntries;
|
|
1275
|
+
const normalizedJsEntries = /* @__PURE__ */ new Map();
|
|
1276
|
+
for (const [id, entry] of jsEntries) {
|
|
1277
|
+
normalizedJsEntries.set(normalizeOutputPathKey(id), entry);
|
|
1278
|
+
}
|
|
1279
|
+
const getJsEntry = (id) => jsEntries.get(id) ?? normalizedJsEntries.get(normalizeOutputPathKey(id));
|
|
1261
1280
|
const moduleGraphOptions = createBundleModuleGraphOptions(outDir, jsEntries);
|
|
1262
1281
|
const runtimeStart = performance.now();
|
|
1263
1282
|
const runtime = useBundleRuntimeClassSet ? await ensureBundleRuntimeClassSet(snapshot, forceRuntimeRefreshByEnv) : await context.ensureRuntimeClassSet(forceRuntimeRefreshByEnv);
|
|
@@ -1475,7 +1494,7 @@ function createGenerateBundleHook(context) {
|
|
|
1475
1494
|
debug3("js handle: %s", file);
|
|
1476
1495
|
if (linked) {
|
|
1477
1496
|
for (const id of Object.keys(linked)) {
|
|
1478
|
-
const linkedEntry =
|
|
1497
|
+
const linkedEntry = getJsEntry(id);
|
|
1479
1498
|
if (linkedEntry && linkedSet) {
|
|
1480
1499
|
linkedSet.add(linkedEntry.fileName);
|
|
1481
1500
|
}
|
|
@@ -1497,7 +1516,7 @@ function createGenerateBundleHook(context) {
|
|
|
1497
1516
|
const wrappedApplyLinkedUpdates = (linked) => {
|
|
1498
1517
|
if (linked) {
|
|
1499
1518
|
for (const id of Object.keys(linked)) {
|
|
1500
|
-
const linkedEntry =
|
|
1519
|
+
const linkedEntry = getJsEntry(id);
|
|
1501
1520
|
if (linkedEntry && linkedSet) {
|
|
1502
1521
|
linkedSet.add(linkedEntry.fileName);
|
|
1503
1522
|
}
|
|
@@ -2114,6 +2133,13 @@ var debug2 = createDebug();
|
|
|
2114
2133
|
var weappTailwindcssPackageDir = resolvePackageDir("weapp-tailwindcss");
|
|
2115
2134
|
var weappTailwindcssDirPosix = slash(weappTailwindcssPackageDir);
|
|
2116
2135
|
var PACKAGE_JSON_FILE2 = "package.json";
|
|
2136
|
+
function getPostcssPluginName(plugin) {
|
|
2137
|
+
if (!plugin || typeof plugin !== "object" || !("postcssPlugin" in plugin)) {
|
|
2138
|
+
return;
|
|
2139
|
+
}
|
|
2140
|
+
const { postcssPlugin } = plugin;
|
|
2141
|
+
return typeof postcssPlugin === "string" ? postcssPlugin : void 0;
|
|
2142
|
+
}
|
|
2117
2143
|
function resolveImplicitTailwindcssBasedirFromViteRoot(root) {
|
|
2118
2144
|
const resolvedRoot = path6.resolve(root);
|
|
2119
2145
|
if (!existsSync2(resolvedRoot)) {
|
|
@@ -2344,10 +2370,7 @@ function UnifiedViteWeappTailwindcssPlugin(options = {}) {
|
|
|
2344
2370
|
}
|
|
2345
2371
|
if (typeof config.css.postcss === "object" && Array.isArray(config.css.postcss.plugins)) {
|
|
2346
2372
|
const postcssPlugins = config.css.postcss.plugins;
|
|
2347
|
-
const idx = postcssPlugins.findIndex((x) => (
|
|
2348
|
-
// @ts-ignore
|
|
2349
|
-
x.postcssPlugin === "postcss-html-transform"
|
|
2350
|
-
));
|
|
2373
|
+
const idx = postcssPlugins.findIndex((x) => getPostcssPluginName(x) === "postcss-html-transform");
|
|
2351
2374
|
if (idx > -1) {
|
|
2352
2375
|
postcssPlugins.splice(idx, 1, postcssHtmlTransform());
|
|
2353
2376
|
debug2("remove postcss-html-transform plugin from vite config");
|