weapp-tailwindcss 4.12.0-alpha.1 → 4.12.0-alpha.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/bin/weapp-tailwindcss.js +21 -1
- package/dist/{chunk-CTGWJGKJ.js → chunk-2A4NRLSY.js} +3 -3
- package/dist/{chunk-4LBAL3RE.js → chunk-6JBFHYFM.js} +44 -36
- package/dist/{chunk-V34LWQTS.mjs → chunk-CMNCGACY.mjs} +18 -10
- package/dist/{chunk-JRLWGMVZ.mjs → chunk-CQMHHQRN.mjs} +1 -1
- package/dist/{chunk-OYSABARD.js → chunk-E7I5TW5K.js} +3 -2
- package/dist/{chunk-ZABCOAAS.mjs → chunk-LWEVOVRD.mjs} +14 -5
- package/dist/{chunk-CAZQZPMY.js → chunk-PAAX4FDD.js} +29 -29
- package/dist/{chunk-5CF3HTTN.mjs → chunk-SHDJA4GG.mjs} +1 -1
- package/dist/{chunk-IUYO6NQO.js → chunk-SRAG3FST.js} +7 -7
- package/dist/{chunk-RQWWSU4U.js → chunk-YVRX3F6S.js} +14 -5
- package/dist/{chunk-2LH6PZH3.mjs → chunk-ZCH4YINE.mjs} +3 -2
- package/dist/{chunk-C2E5ZLNI.mjs → chunk-ZGIN2OAY.mjs} +2 -2
- package/dist/cli.js +2229 -161
- package/dist/cli.mjs +2234 -166
- 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 +6 -6
- package/dist/index.mjs +5 -5
- package/dist/vite.js +3 -3
- package/dist/vite.mjs +2 -2
- 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 +4 -4
- package/dist/webpack.mjs +3 -3
- package/dist/webpack4.js +49 -45
- package/dist/webpack4.mjs +25 -21
- package/package.json +6 -5
- package/scripts/postinstall.mjs +59 -0
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunk2A4NRLSYjs = require('./chunk-2A4NRLSY.js');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
@@ -29,7 +29,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
var
|
|
32
|
+
var _chunkYVRX3F6Sjs = require('./chunk-YVRX3F6S.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(_chunkYVRX3F6Sjs.pluginName, (compilation) => {
|
|
68
68
|
compilation.hooks.processAssets.tapPromise(
|
|
69
69
|
{
|
|
70
|
-
name:
|
|
70
|
+
name: _chunkYVRX3F6Sjs.pluginName,
|
|
71
71
|
stage: Compilation.PROCESS_ASSETS_STAGE_SUMMARIZE
|
|
72
72
|
},
|
|
73
73
|
async (assets) => {
|
|
@@ -79,7 +79,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
79
79
|
compilerOptions.cache.calcHashValueChanged(chunk.id, chunk.hash);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
|
-
const assetHashByChunk =
|
|
82
|
+
const assetHashByChunk = _chunk2A4NRLSYjs.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()));
|
|
@@ -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 _chunkYVRX3F6Sjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
162
162
|
forceRefresh: forceRuntimeRefresh,
|
|
163
163
|
// webpack 的 script-only 热更新可能不会触发 runtime classset loader,
|
|
164
164
|
// 这里强制收集可避免沿用上轮 class set,保证 JS 仅按最新集合精确命中。
|
|
@@ -208,7 +208,7 @@ 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 = _chunk2A4NRLSYjs.getCacheKey.call(void 0, file);
|
|
212
212
|
const asset = compilation.getAsset(file);
|
|
213
213
|
if (!asset) {
|
|
214
214
|
continue;
|
|
@@ -243,7 +243,7 @@ function setupWebpackV5ProcessAssetsHook(options) {
|
|
|
243
243
|
sourceFilename: absoluteFile
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
if (
|
|
246
|
+
if (_chunkYVRX3F6Sjs.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);
|
|
@@ -318,9 +318,9 @@ function setupWebpackV5Loaders(options) {
|
|
|
318
318
|
getRuntimeWatchDependencies,
|
|
319
319
|
debug: debug2
|
|
320
320
|
} = options;
|
|
321
|
-
const isMpxApp =
|
|
321
|
+
const isMpxApp = _chunk2A4NRLSYjs.isMpx.call(void 0, appType);
|
|
322
322
|
if (shouldRewriteCssImports && isMpxApp) {
|
|
323
|
-
|
|
323
|
+
_chunk2A4NRLSYjs.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 } = _chunk2A4NRLSYjs.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
|
+
_chunk2A4NRLSYjs.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(_chunkYVRX3F6Sjs.pluginName, (compilation) => {
|
|
363
|
+
NormalModule.getCompilationHooks(compilation).loader.tap(_chunkYVRX3F6Sjs.pluginName, (_loaderContext, module) => {
|
|
364
364
|
const hasRuntimeLoader = runtimeClassSetLoaderExists || runtimeCssImportRewriteLoaderExists;
|
|
365
365
|
if (!hasRuntimeLoader) {
|
|
366
366
|
return;
|
|
367
367
|
}
|
|
368
|
-
|
|
368
|
+
_chunk2A4NRLSYjs.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 = _chunk2A4NRLSYjs.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 && !_chunk2A4NRLSYjs.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 =
|
|
419
|
+
var debug = _chunkYVRX3F6Sjs.createDebug.call(void 0, );
|
|
420
420
|
var weappTailwindcssPackageDir = _chunkGMKSBLNYjs.resolvePackageDir.call(void 0, "weapp-tailwindcss");
|
|
421
421
|
var UnifiedWebpackPluginV5 = class {
|
|
422
422
|
constructor(options = {}) {
|
|
423
|
-
this.options =
|
|
423
|
+
this.options = _chunkYVRX3F6Sjs.getCompilerContext.call(void 0, options);
|
|
424
424
|
this.appType = this.options.appType;
|
|
425
425
|
}
|
|
426
426
|
apply(compiler) {
|
|
@@ -436,19 +436,19 @@ var UnifiedWebpackPluginV5 = class {
|
|
|
436
436
|
const disabledOptions = _chunkGMKSBLNYjs.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 = _chunk2A4NRLSYjs.isMpx.call(void 0, this.appType);
|
|
440
440
|
if (shouldRewriteCssImports) {
|
|
441
|
-
|
|
441
|
+
_chunk2A4NRLSYjs.applyTailwindcssCssImportRewrite.call(void 0, compiler, {
|
|
442
442
|
pkgDir: weappTailwindcssPackageDir,
|
|
443
443
|
enabled: true,
|
|
444
444
|
appType: this.appType
|
|
445
445
|
});
|
|
446
|
-
|
|
446
|
+
_chunk2A4NRLSYjs.setupMpxTailwindcssRedirect.call(void 0, weappTailwindcssPackageDir, isMpxApp);
|
|
447
447
|
}
|
|
448
448
|
if (disabledOptions.plugin) {
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
-
const patchRecorderState =
|
|
451
|
+
const patchRecorderState = _chunkYVRX3F6Sjs.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 || _chunk2A4NRLSYjs.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(_chunkYVRX3F6Sjs.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(_chunkYVRX3F6Sjs.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(_chunkYVRX3F6Sjs.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(_chunkYVRX3F6Sjs.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 _chunkYVRX3F6Sjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
534
534
|
forceRefresh,
|
|
535
535
|
forceCollect: true,
|
|
536
536
|
clearCache: forceRefresh,
|
|
@@ -8,7 +8,7 @@ var _chunkOF6MFURRjs = require('./chunk-OF6MFURR.js');
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkYVRX3F6Sjs = require('./chunk-YVRX3F6S.js');
|
|
12
12
|
|
|
13
13
|
// src/bundlers/gulp/index.ts
|
|
14
14
|
var _buffer = require('buffer');
|
|
@@ -16,12 +16,12 @@ var _fs = require('fs'); var _fs2 = _interopRequireDefault(_fs);
|
|
|
16
16
|
var _path = require('path'); var _path2 = _interopRequireDefault(_path);
|
|
17
17
|
var _process = require('process'); var _process2 = _interopRequireDefault(_process);
|
|
18
18
|
var _stream = require('stream'); var _stream2 = _interopRequireDefault(_stream);
|
|
19
|
-
var debug =
|
|
19
|
+
var debug = _chunkYVRX3F6Sjs.createDebug.call(void 0, );
|
|
20
20
|
var Transform = _stream2.default.Transform;
|
|
21
21
|
function createPlugins(options = {}) {
|
|
22
|
-
const opts =
|
|
22
|
+
const opts = _chunkYVRX3F6Sjs.getCompilerContext.call(void 0, options);
|
|
23
23
|
const { templateHandler, styleHandler, jsHandler, cache, twPatcher: initialTwPatcher, refreshTailwindcssPatcher } = opts;
|
|
24
|
-
const patchRecorderState =
|
|
24
|
+
const patchRecorderState = _chunkYVRX3F6Sjs.setupPatchRecorder.call(void 0, initialTwPatcher, opts.tailwindcssBasedir, {
|
|
25
25
|
source: "runtime",
|
|
26
26
|
cwd: _nullishCoalesce(opts.tailwindcssBasedir, () => ( _process2.default.cwd()))
|
|
27
27
|
});
|
|
@@ -39,13 +39,13 @@ function createPlugins(options = {}) {
|
|
|
39
39
|
const MODULE_EXTENSIONS = [".js", ".mjs", ".cjs", ".ts", ".tsx", ".jsx"];
|
|
40
40
|
let runtimeSetInitialized = false;
|
|
41
41
|
async function refreshRuntimeState(force) {
|
|
42
|
-
await
|
|
42
|
+
await _chunkYVRX3F6Sjs.refreshTailwindRuntimeState.call(void 0, runtimeState, force);
|
|
43
43
|
}
|
|
44
44
|
async function refreshRuntimeSet(force = false) {
|
|
45
45
|
if (!force && runtimeSetInitialized) {
|
|
46
46
|
return runtimeSet;
|
|
47
47
|
}
|
|
48
|
-
runtimeSet = await
|
|
48
|
+
runtimeSet = await _chunkYVRX3F6Sjs.ensureRuntimeClassSet.call(void 0, runtimeState, {
|
|
49
49
|
forceRefresh: force,
|
|
50
50
|
forceCollect: force,
|
|
51
51
|
clearCache: force,
|
|
@@ -226,7 +226,7 @@ function createPlugins(options = {}) {
|
|
|
226
226
|
async transform() {
|
|
227
227
|
await runtimeState.patchPromise;
|
|
228
228
|
const currentSource = _nullishCoalesce(_optionalChain([file, 'access', _2 => _2.contents, 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]), () => ( rawSource));
|
|
229
|
-
if (
|
|
229
|
+
if (_chunkYVRX3F6Sjs.shouldSkipJsTransform.call(void 0, currentSource, handlerOptions)) {
|
|
230
230
|
return { result: currentSource };
|
|
231
231
|
}
|
|
232
232
|
const { code } = await jsHandler(currentSource, runtimeSet, handlerOptions);
|
|
@@ -466,7 +466,7 @@ function getRecordFileCandidates(baseDir) {
|
|
|
466
466
|
// package.json
|
|
467
467
|
var package_default = {
|
|
468
468
|
name: "weapp-tailwindcss",
|
|
469
|
-
version: "4.12.0-alpha.
|
|
469
|
+
version: "4.12.0-alpha.2",
|
|
470
470
|
description: "\u628A tailwindcss \u539F\u5B50\u5316\u6837\u5F0F\u601D\u60F3\uFF0C\u5E26\u7ED9\u5C0F\u7A0B\u5E8F\u5F00\u53D1\u8005\u4EEC! bring tailwindcss to miniprogram developers!",
|
|
471
471
|
author: "ice breaker <1324318532@qq.com>",
|
|
472
472
|
license: "MIT",
|
|
@@ -616,13 +616,14 @@ var package_default = {
|
|
|
616
616
|
"dist",
|
|
617
617
|
"index.css",
|
|
618
618
|
"preflight.css",
|
|
619
|
+
"scripts/postinstall.mjs",
|
|
619
620
|
"theme.css",
|
|
620
621
|
"uni-app-x.css",
|
|
621
622
|
"utilities.css",
|
|
622
623
|
"with-layer.css"
|
|
623
624
|
],
|
|
624
625
|
engines: {
|
|
625
|
-
node: "^
|
|
626
|
+
node: "^20.19.0 || >=22.12.0"
|
|
626
627
|
},
|
|
627
628
|
scripts: {
|
|
628
629
|
dev: "tsup --watch --sourcemap",
|
|
@@ -631,7 +632,7 @@ var package_default = {
|
|
|
631
632
|
"build:cli": "cd plugins/cli && pnpm run build",
|
|
632
633
|
"build:css": "tsx scripts/build-css.ts",
|
|
633
634
|
"build:weapp-theme": "tsx scripts/build-weapp-theme.ts",
|
|
634
|
-
test: "
|
|
635
|
+
test: "pnpm run cli:patch && vitest run",
|
|
635
636
|
"test:dev": "vitest",
|
|
636
637
|
"test:ui": "vitest --ui",
|
|
637
638
|
bench: "vitest bench --config ./vitest.config.ts",
|
|
@@ -648,7 +649,7 @@ var package_default = {
|
|
|
648
649
|
release: "tsx scripts/release.ts",
|
|
649
650
|
lint: "eslint .",
|
|
650
651
|
"lint:fix": "eslint ./src --fix",
|
|
651
|
-
postinstall: "node
|
|
652
|
+
postinstall: "node scripts/postinstall.mjs",
|
|
652
653
|
"bench:vite-dev-hmr": "tsx scripts/vite-dev-hmr-bench.ts",
|
|
653
654
|
"test:watch-hmr": "node --import tsx scripts/watch-hmr-regression/index.ts"
|
|
654
655
|
},
|
|
@@ -2810,6 +2811,7 @@ var EMPTY_IMPORT_DECLARATIONS = /* @__PURE__ */ new Set();
|
|
|
2810
2811
|
var EMPTY_EXPORT_DECLARATIONS = /* @__PURE__ */ new Set();
|
|
2811
2812
|
var EMPTY_REQUIRE_CALL_PATHS = [];
|
|
2812
2813
|
var ignoredTaggedTemplateMatcherCache = /* @__PURE__ */ new WeakMap();
|
|
2814
|
+
var defaultEvalHandler;
|
|
2813
2815
|
function getIgnoredTaggedTemplateMatcher(options) {
|
|
2814
2816
|
const cached = ignoredTaggedTemplateMatcherCache.get(options);
|
|
2815
2817
|
if (cached) {
|
|
@@ -2819,6 +2821,12 @@ function getIgnoredTaggedTemplateMatcher(options) {
|
|
|
2819
2821
|
ignoredTaggedTemplateMatcherCache.set(options, created);
|
|
2820
2822
|
return created;
|
|
2821
2823
|
}
|
|
2824
|
+
function getDefaultEvalHandler() {
|
|
2825
|
+
if (!defaultEvalHandler) {
|
|
2826
|
+
throw new Error("Default JS eval handler is not initialized.");
|
|
2827
|
+
}
|
|
2828
|
+
return defaultEvalHandler;
|
|
2829
|
+
}
|
|
2822
2830
|
function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
2823
2831
|
const jsTokenUpdater = new JsTokenUpdater();
|
|
2824
2832
|
const needScope = Boolean(options.ignoreCallExpressionIdentifiers && options.ignoreCallExpressionIdentifiers.length > 0);
|
|
@@ -2846,7 +2854,7 @@ function analyzeSource(ast, options, handler, collectModuleMetadata = true) {
|
|
|
2846
2854
|
const importDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_IMPORT_DECLARATIONS;
|
|
2847
2855
|
const exportDeclarations = collectModuleMetadata ? /* @__PURE__ */ new Set() : EMPTY_EXPORT_DECLARATIONS;
|
|
2848
2856
|
const requireCallPaths = collectModuleMetadata ? [] : EMPTY_REQUIRE_CALL_PATHS;
|
|
2849
|
-
const evalHandler = _nullishCoalesce(handler, () => (
|
|
2857
|
+
const evalHandler = _nullishCoalesce(handler, () => ( getDefaultEvalHandler()));
|
|
2850
2858
|
const templateElementEnter = hasTaggedTemplateIgnoreIdentifiers ? (p) => {
|
|
2851
2859
|
const pp = p.parentPath;
|
|
2852
2860
|
if (pp.isTemplateLiteral()) {
|
|
@@ -2987,6 +2995,7 @@ function jsHandler(rawSource, options) {
|
|
|
2987
2995
|
}
|
|
2988
2996
|
return result;
|
|
2989
2997
|
}
|
|
2998
|
+
defaultEvalHandler = jsHandler;
|
|
2990
2999
|
|
|
2991
3000
|
// src/js/index.ts
|
|
2992
3001
|
var RESULT_CACHE_MAX = 512;
|
|
@@ -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
|
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
isMpx,
|
|
12
12
|
patchMpxLoaderResolve,
|
|
13
13
|
setupMpxTailwindcssRedirect
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SHDJA4GG.mjs";
|
|
15
15
|
import {
|
|
16
16
|
pushConcurrentTaskFactories,
|
|
17
17
|
resolveDisabledOptions,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
pluginName,
|
|
30
30
|
setupPatchRecorder,
|
|
31
31
|
shouldSkipJsTransform
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-LWEVOVRD.mjs";
|
|
33
33
|
import {
|
|
34
34
|
getRuntimeClassSetSignature,
|
|
35
35
|
resolveTailwindcssOptions
|