weapp-vite 5.2.2 → 5.2.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/dist/{chunk-RHQGM7EB.cjs → chunk-GMCAZZQY.cjs} +242 -154
- package/dist/{chunk-VWY5EX25.mjs → chunk-UTHLNBNC.mjs} +187 -99
- package/dist/cli.cjs +13 -13
- package/dist/cli.mjs +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +5 -5
|
@@ -19444,11 +19444,51 @@ function transformWxsCode(code, options) {
|
|
|
19444
19444
|
}
|
|
19445
19445
|
|
|
19446
19446
|
// src/wxml/handle.ts
|
|
19447
|
+
var handleCache = /* @__PURE__ */ new WeakMap();
|
|
19448
|
+
var inlineWxsTransformCache = /* @__PURE__ */ new Map();
|
|
19449
|
+
var INLINE_WXS_CACHE_LIMIT = 256;
|
|
19450
|
+
function createCacheKey(options) {
|
|
19451
|
+
return `${options.removeComment ? 1 : 0}|${options.transformEvent ? 1 : 0}`;
|
|
19452
|
+
}
|
|
19453
|
+
function getCachedResult(data2, cacheKey) {
|
|
19454
|
+
return _optionalChain([handleCache, 'access', _259 => _259.get, 'call', _260 => _260(data2), 'optionalAccess', _261 => _261.get, 'call', _262 => _262(cacheKey)]);
|
|
19455
|
+
}
|
|
19456
|
+
function setCachedResult(data2, cacheKey, result) {
|
|
19457
|
+
let cacheForToken = handleCache.get(data2);
|
|
19458
|
+
if (!cacheForToken) {
|
|
19459
|
+
cacheForToken = /* @__PURE__ */ new Map();
|
|
19460
|
+
handleCache.set(data2, cacheForToken);
|
|
19461
|
+
}
|
|
19462
|
+
cacheForToken.set(cacheKey, result);
|
|
19463
|
+
return result;
|
|
19464
|
+
}
|
|
19465
|
+
function getCachedInlineWxsTransform(code) {
|
|
19466
|
+
const cached = inlineWxsTransformCache.get(code);
|
|
19467
|
+
if (cached) {
|
|
19468
|
+
inlineWxsTransformCache.delete(code);
|
|
19469
|
+
inlineWxsTransformCache.set(code, cached);
|
|
19470
|
+
return cached;
|
|
19471
|
+
}
|
|
19472
|
+
const transformed = transformWxsCode(code);
|
|
19473
|
+
inlineWxsTransformCache.set(code, transformed);
|
|
19474
|
+
if (inlineWxsTransformCache.size > INLINE_WXS_CACHE_LIMIT) {
|
|
19475
|
+
const firstKey = inlineWxsTransformCache.keys().next().value;
|
|
19476
|
+
if (firstKey) {
|
|
19477
|
+
inlineWxsTransformCache.delete(firstKey);
|
|
19478
|
+
}
|
|
19479
|
+
}
|
|
19480
|
+
return transformed;
|
|
19481
|
+
}
|
|
19447
19482
|
function handleWxml(data2, options) {
|
|
19448
19483
|
const opts = _shared.defu.call(void 0, options, {
|
|
19449
19484
|
removeComment: true,
|
|
19450
19485
|
transformEvent: true
|
|
19451
19486
|
});
|
|
19487
|
+
const cacheKey = createCacheKey(opts);
|
|
19488
|
+
const cached = getCachedResult(data2, cacheKey);
|
|
19489
|
+
if (cached) {
|
|
19490
|
+
return cached;
|
|
19491
|
+
}
|
|
19452
19492
|
const {
|
|
19453
19493
|
code,
|
|
19454
19494
|
removalRanges,
|
|
@@ -19467,11 +19507,11 @@ function handleWxml(data2, options) {
|
|
|
19467
19507
|
const shouldRemoveConditionals = removalRanges.length > 0;
|
|
19468
19508
|
const shouldRemoveComments = opts.removeComment && commentTokens.length > 0;
|
|
19469
19509
|
if (!shouldNormalizeImports && !shouldRemoveLang && !shouldTransformInlineWxs && !shouldTransformEvents && !shouldRemoveConditionals && !shouldRemoveComments) {
|
|
19470
|
-
return {
|
|
19510
|
+
return setCachedResult(data2, cacheKey, {
|
|
19471
19511
|
code,
|
|
19472
19512
|
components: components2,
|
|
19473
19513
|
deps
|
|
19474
|
-
};
|
|
19514
|
+
});
|
|
19475
19515
|
}
|
|
19476
19516
|
const ms = new MagicString(code);
|
|
19477
19517
|
if (shouldNormalizeImports) {
|
|
@@ -19486,8 +19526,8 @@ function handleWxml(data2, options) {
|
|
|
19486
19526
|
}
|
|
19487
19527
|
if (shouldTransformInlineWxs) {
|
|
19488
19528
|
for (const { end, start, value } of inlineWxsTokens) {
|
|
19489
|
-
const { result } =
|
|
19490
|
-
if (_optionalChain([result, 'optionalAccess',
|
|
19529
|
+
const { result } = getCachedInlineWxsTransform(value);
|
|
19530
|
+
if (_optionalChain([result, 'optionalAccess', _263 => _263.code])) {
|
|
19491
19531
|
ms.update(start, end, `
|
|
19492
19532
|
${result.code}`);
|
|
19493
19533
|
}
|
|
@@ -19499,7 +19539,7 @@ ${result.code}`);
|
|
|
19499
19539
|
}
|
|
19500
19540
|
}
|
|
19501
19541
|
if (shouldRemoveConditionals) {
|
|
19502
|
-
for (const { start, end } of
|
|
19542
|
+
for (const { start, end } of removalRanges) {
|
|
19503
19543
|
if (end > start) {
|
|
19504
19544
|
ms.remove(start, end);
|
|
19505
19545
|
}
|
|
@@ -19510,11 +19550,11 @@ ${result.code}`);
|
|
|
19510
19550
|
ms.remove(start, end);
|
|
19511
19551
|
}
|
|
19512
19552
|
}
|
|
19513
|
-
return {
|
|
19553
|
+
return setCachedResult(data2, cacheKey, {
|
|
19514
19554
|
code: ms.toString(),
|
|
19515
19555
|
components: components2,
|
|
19516
19556
|
deps
|
|
19517
|
-
};
|
|
19557
|
+
});
|
|
19518
19558
|
}
|
|
19519
19559
|
|
|
19520
19560
|
// src/plugins/hooks/useLoadEntry/index.ts
|
|
@@ -19567,7 +19607,7 @@ function createChunkEmitter(configService, loadedEntrySet, debug4) {
|
|
|
19567
19607
|
// @ts-ignore
|
|
19568
19608
|
preserveSignature: "exports-only"
|
|
19569
19609
|
});
|
|
19570
|
-
_optionalChain([debug4, 'optionalCall',
|
|
19610
|
+
_optionalChain([debug4, 'optionalCall', _264 => _264(`load ${fileName} \u8017\u65F6 ${(_perf_hooks.performance.now() - start).toFixed(2)}ms`)]);
|
|
19571
19611
|
});
|
|
19572
19612
|
};
|
|
19573
19613
|
}
|
|
@@ -19660,6 +19700,86 @@ function analyzeCommonJson(json) {
|
|
|
19660
19700
|
}
|
|
19661
19701
|
|
|
19662
19702
|
// src/plugins/hooks/useLoadEntry/loadEntry.ts
|
|
19703
|
+
function createStopwatch() {
|
|
19704
|
+
const start = _perf_hooks.performance.now();
|
|
19705
|
+
return () => `${(_perf_hooks.performance.now() - start).toFixed(2)}ms`;
|
|
19706
|
+
}
|
|
19707
|
+
async function addWatchTarget(pluginCtx, target, existsCache) {
|
|
19708
|
+
if (!target || typeof pluginCtx.addWatchFile !== "function") {
|
|
19709
|
+
return false;
|
|
19710
|
+
}
|
|
19711
|
+
if (existsCache.has(target)) {
|
|
19712
|
+
const cached = existsCache.get(target);
|
|
19713
|
+
if (cached) {
|
|
19714
|
+
pluginCtx.addWatchFile(target);
|
|
19715
|
+
}
|
|
19716
|
+
return cached;
|
|
19717
|
+
}
|
|
19718
|
+
const exists = await _fsextra2.default.exists(target);
|
|
19719
|
+
if (exists) {
|
|
19720
|
+
pluginCtx.addWatchFile(target);
|
|
19721
|
+
}
|
|
19722
|
+
existsCache.set(target, exists);
|
|
19723
|
+
return exists;
|
|
19724
|
+
}
|
|
19725
|
+
async function collectStyleImports(pluginCtx, id, existsCache) {
|
|
19726
|
+
const styleImports = [];
|
|
19727
|
+
for (const ext2 of supportedCssLangs) {
|
|
19728
|
+
const mayBeCssPath = changeFileExtension(id, ext2);
|
|
19729
|
+
const exists = await addWatchTarget(pluginCtx, mayBeCssPath, existsCache);
|
|
19730
|
+
if (exists) {
|
|
19731
|
+
styleImports.push(mayBeCssPath);
|
|
19732
|
+
}
|
|
19733
|
+
}
|
|
19734
|
+
return styleImports;
|
|
19735
|
+
}
|
|
19736
|
+
async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJsonAsset, existsCache) {
|
|
19737
|
+
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = json;
|
|
19738
|
+
const processSideJson = async (location) => {
|
|
19739
|
+
if (!location) {
|
|
19740
|
+
return;
|
|
19741
|
+
}
|
|
19742
|
+
const { path: jsonPath, predictions } = await findJsonEntry(
|
|
19743
|
+
_pathe2.default.resolve(_pathe2.default.dirname(id), location)
|
|
19744
|
+
);
|
|
19745
|
+
for (const prediction of predictions) {
|
|
19746
|
+
await addWatchTarget(pluginCtx, prediction, existsCache);
|
|
19747
|
+
}
|
|
19748
|
+
if (!jsonPath) {
|
|
19749
|
+
return;
|
|
19750
|
+
}
|
|
19751
|
+
const content = await jsonService.read(jsonPath);
|
|
19752
|
+
registerJsonAsset({
|
|
19753
|
+
json: content,
|
|
19754
|
+
jsonPath,
|
|
19755
|
+
type: "app"
|
|
19756
|
+
});
|
|
19757
|
+
};
|
|
19758
|
+
await processSideJson(sitemapLocation);
|
|
19759
|
+
await processSideJson(themeLocation);
|
|
19760
|
+
}
|
|
19761
|
+
async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry, existsCache) {
|
|
19762
|
+
const { path: templateEntry, predictions } = await findTemplateEntry(id);
|
|
19763
|
+
for (const prediction of predictions) {
|
|
19764
|
+
await addWatchTarget(pluginCtx, prediction, existsCache);
|
|
19765
|
+
}
|
|
19766
|
+
if (!templateEntry) {
|
|
19767
|
+
return "";
|
|
19768
|
+
}
|
|
19769
|
+
await scanTemplateEntry(templateEntry);
|
|
19770
|
+
return templateEntry;
|
|
19771
|
+
}
|
|
19772
|
+
async function resolveEntries(entries, absoluteSrcRoot) {
|
|
19773
|
+
return Promise.all(
|
|
19774
|
+
entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
|
|
19775
|
+
const absPath = _pathe2.default.resolve(absoluteSrcRoot, entry);
|
|
19776
|
+
return {
|
|
19777
|
+
entry,
|
|
19778
|
+
resolvedId: await this.resolve(absPath)
|
|
19779
|
+
};
|
|
19780
|
+
})
|
|
19781
|
+
);
|
|
19782
|
+
}
|
|
19663
19783
|
function createEntryLoader(options) {
|
|
19664
19784
|
const {
|
|
19665
19785
|
ctx,
|
|
@@ -19673,16 +19793,18 @@ function createEntryLoader(options) {
|
|
|
19673
19793
|
debug: debug4
|
|
19674
19794
|
} = options;
|
|
19675
19795
|
const { jsonService, configService } = ctx;
|
|
19796
|
+
const existsCache = /* @__PURE__ */ new Map();
|
|
19676
19797
|
return async function loadEntry(id, type) {
|
|
19677
|
-
|
|
19678
|
-
const
|
|
19798
|
+
existsCache.clear();
|
|
19799
|
+
const stopwatch = debug4 ? createStopwatch() : void 0;
|
|
19800
|
+
const getTime = () => stopwatch ? stopwatch() : "0.00ms";
|
|
19679
19801
|
const relativeCwdId = configService.relativeCwd(id);
|
|
19680
19802
|
this.addWatchFile(id);
|
|
19681
19803
|
const baseName = _shared.removeExtensionDeep.call(void 0, id);
|
|
19682
19804
|
const jsonEntry = await findJsonEntry(id);
|
|
19683
19805
|
let jsonPath = jsonEntry.path;
|
|
19684
19806
|
for (const prediction of jsonEntry.predictions) {
|
|
19685
|
-
await addWatchTarget(this, prediction);
|
|
19807
|
+
await addWatchTarget(this, prediction, existsCache);
|
|
19686
19808
|
}
|
|
19687
19809
|
let json = {};
|
|
19688
19810
|
if (jsonPath) {
|
|
@@ -19699,10 +19821,11 @@ function createEntryLoader(options) {
|
|
|
19699
19821
|
id,
|
|
19700
19822
|
json,
|
|
19701
19823
|
jsonService,
|
|
19702
|
-
registerJsonAsset
|
|
19824
|
+
registerJsonAsset,
|
|
19825
|
+
existsCache
|
|
19703
19826
|
);
|
|
19704
19827
|
} else {
|
|
19705
|
-
templatePath = await ensureTemplateScanned(this, id, scanTemplateEntry);
|
|
19828
|
+
templatePath = await ensureTemplateScanned(this, id, scanTemplateEntry, existsCache);
|
|
19706
19829
|
applyAutoImports(baseName, json);
|
|
19707
19830
|
entries.push(...analyzeCommonJson(json));
|
|
19708
19831
|
}
|
|
@@ -19721,104 +19844,45 @@ function createEntryLoader(options) {
|
|
|
19721
19844
|
normalizedEntries,
|
|
19722
19845
|
configService.absoluteSrcRoot
|
|
19723
19846
|
);
|
|
19724
|
-
_optionalChain([debug4, 'optionalCall',
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
|
|
19737
|
-
|
|
19738
|
-
|
|
19739
|
-
);
|
|
19740
|
-
_optionalChain([debug4, 'optionalCall', _262 => _262(`emitEntriesChunks ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
19847
|
+
_optionalChain([debug4, 'optionalCall', _265 => _265(`resolvedIds ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
19848
|
+
const pendingResolvedIds = [];
|
|
19849
|
+
for (const { entry, resolvedId } of resolvedIds) {
|
|
19850
|
+
if (!resolvedId) {
|
|
19851
|
+
logger_default.warn(`\u6CA1\u6709\u627E\u5230 \`${entry}\` \u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
|
|
19852
|
+
continue;
|
|
19853
|
+
}
|
|
19854
|
+
if (loadedEntrySet.has(resolvedId.id)) {
|
|
19855
|
+
continue;
|
|
19856
|
+
}
|
|
19857
|
+
pendingResolvedIds.push(resolvedId);
|
|
19858
|
+
}
|
|
19859
|
+
if (pendingResolvedIds.length) {
|
|
19860
|
+
await Promise.all(emitEntriesChunks.call(this, pendingResolvedIds));
|
|
19861
|
+
}
|
|
19862
|
+
_optionalChain([debug4, 'optionalCall', _266 => _266(`emitEntriesChunks ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
19741
19863
|
registerJsonAsset({
|
|
19742
19864
|
jsonPath,
|
|
19743
19865
|
json,
|
|
19744
19866
|
type
|
|
19745
19867
|
});
|
|
19746
19868
|
const code = await _fsextra2.default.readFile(id, "utf8");
|
|
19869
|
+
const styleImports = await collectStyleImports(this, id, existsCache);
|
|
19870
|
+
_optionalChain([debug4, 'optionalCall', _267 => _267(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`)]);
|
|
19871
|
+
if (styleImports.length === 0) {
|
|
19872
|
+
return {
|
|
19873
|
+
code
|
|
19874
|
+
};
|
|
19875
|
+
}
|
|
19747
19876
|
const ms = new MagicString(code);
|
|
19748
|
-
|
|
19749
|
-
|
|
19877
|
+
for (const styleImport of styleImports) {
|
|
19878
|
+
ms.prepend(`import '${styleImport}';
|
|
19879
|
+
`);
|
|
19880
|
+
}
|
|
19750
19881
|
return {
|
|
19751
19882
|
code: ms.toString()
|
|
19752
19883
|
};
|
|
19753
19884
|
};
|
|
19754
19885
|
}
|
|
19755
|
-
async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJsonAsset) {
|
|
19756
|
-
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = json;
|
|
19757
|
-
const processSideJson = async (location) => {
|
|
19758
|
-
if (!location) {
|
|
19759
|
-
return;
|
|
19760
|
-
}
|
|
19761
|
-
const { path: jsonPath, predictions } = await findJsonEntry(
|
|
19762
|
-
_pathe2.default.resolve(_pathe2.default.dirname(id), location)
|
|
19763
|
-
);
|
|
19764
|
-
for (const prediction of predictions) {
|
|
19765
|
-
await addWatchTarget(pluginCtx, prediction);
|
|
19766
|
-
}
|
|
19767
|
-
if (!jsonPath) {
|
|
19768
|
-
return;
|
|
19769
|
-
}
|
|
19770
|
-
const content = await jsonService.read(jsonPath);
|
|
19771
|
-
registerJsonAsset({
|
|
19772
|
-
json: content,
|
|
19773
|
-
jsonPath,
|
|
19774
|
-
type: "app"
|
|
19775
|
-
});
|
|
19776
|
-
};
|
|
19777
|
-
await processSideJson(sitemapLocation);
|
|
19778
|
-
await processSideJson(themeLocation);
|
|
19779
|
-
}
|
|
19780
|
-
async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry) {
|
|
19781
|
-
const { path: templateEntry, predictions } = await findTemplateEntry(id);
|
|
19782
|
-
for (const prediction of predictions) {
|
|
19783
|
-
await addWatchTarget(pluginCtx, prediction);
|
|
19784
|
-
}
|
|
19785
|
-
if (!templateEntry) {
|
|
19786
|
-
return "";
|
|
19787
|
-
}
|
|
19788
|
-
await scanTemplateEntry(templateEntry);
|
|
19789
|
-
return templateEntry;
|
|
19790
|
-
}
|
|
19791
|
-
async function resolveEntries(entries, absoluteSrcRoot) {
|
|
19792
|
-
return Promise.all(
|
|
19793
|
-
entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
|
|
19794
|
-
const absPath = _pathe2.default.resolve(absoluteSrcRoot, entry);
|
|
19795
|
-
return {
|
|
19796
|
-
entry,
|
|
19797
|
-
resolvedId: await this.resolve(absPath)
|
|
19798
|
-
};
|
|
19799
|
-
})
|
|
19800
|
-
);
|
|
19801
|
-
}
|
|
19802
|
-
async function prependStyleImports(id, ms) {
|
|
19803
|
-
for (const ext2 of supportedCssLangs) {
|
|
19804
|
-
const mayBeCssPath = changeFileExtension(id, ext2);
|
|
19805
|
-
const exists = await addWatchTarget(this, mayBeCssPath);
|
|
19806
|
-
if (exists) {
|
|
19807
|
-
ms.prepend(`import '${mayBeCssPath}';
|
|
19808
|
-
`);
|
|
19809
|
-
}
|
|
19810
|
-
}
|
|
19811
|
-
}
|
|
19812
|
-
async function addWatchTarget(pluginCtx, target) {
|
|
19813
|
-
if (!target || typeof pluginCtx.addWatchFile !== "function") {
|
|
19814
|
-
return false;
|
|
19815
|
-
}
|
|
19816
|
-
const exists = await _fsextra2.default.exists(target);
|
|
19817
|
-
if (exists) {
|
|
19818
|
-
pluginCtx.addWatchFile(target);
|
|
19819
|
-
}
|
|
19820
|
-
return exists;
|
|
19821
|
-
}
|
|
19822
19886
|
|
|
19823
19887
|
// src/plugins/hooks/useLoadEntry/normalizer.ts
|
|
19824
19888
|
_chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
@@ -19874,7 +19938,7 @@ function createTemplateScanner(wxmlService, debug4) {
|
|
|
19874
19938
|
const { components: components2 } = wxmlToken;
|
|
19875
19939
|
wxmlService.setWxmlComponentsMap(templateEntry, components2);
|
|
19876
19940
|
}
|
|
19877
|
-
_optionalChain([debug4, 'optionalCall',
|
|
19941
|
+
_optionalChain([debug4, 'optionalCall', _268 => _268(`scanTemplateEntry ${templateEntry} \u8017\u65F6 ${(_perf_hooks.performance.now() - start).toFixed(2)}ms`)]);
|
|
19878
19942
|
};
|
|
19879
19943
|
}
|
|
19880
19944
|
|
|
@@ -20157,7 +20221,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
20157
20221
|
options.input = scannedInput;
|
|
20158
20222
|
},
|
|
20159
20223
|
async load(id) {
|
|
20160
|
-
_optionalChain([configService, 'access',
|
|
20224
|
+
_optionalChain([configService, 'access', _269 => _269.weappViteConfig, 'optionalAccess', _270 => _270.debug, 'optionalAccess', _271 => _271.load, 'optionalCall', _272 => _272(id, subPackageMeta)]);
|
|
20161
20225
|
const relativeBasename = _shared.removeExtensionDeep.call(void 0, configService.relativeAbsoluteSrcRoot(id));
|
|
20162
20226
|
if (isCSSRequest(id)) {
|
|
20163
20227
|
const parsed = parseRequest(id);
|
|
@@ -20171,7 +20235,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
20171
20235
|
}
|
|
20172
20236
|
return null;
|
|
20173
20237
|
}
|
|
20174
|
-
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess',
|
|
20238
|
+
if (loadedEntrySet.has(id) || _optionalChain([subPackageMeta, 'optionalAccess', _273 => _273.entries, 'access', _274 => _274.includes, 'call', _275 => _275(relativeBasename)])) {
|
|
20175
20239
|
return await loadEntry.call(this, id, "component");
|
|
20176
20240
|
}
|
|
20177
20241
|
if (relativeBasename === "app") {
|
|
@@ -20184,10 +20248,10 @@ function createCoreLifecyclePlugin(state) {
|
|
|
20184
20248
|
},
|
|
20185
20249
|
async generateBundle() {
|
|
20186
20250
|
await flushIndependentBuilds.call(this, state, watcherService);
|
|
20187
|
-
if (_optionalChain([configService, 'access',
|
|
20251
|
+
if (_optionalChain([configService, 'access', _276 => _276.weappViteConfig, 'optionalAccess', _277 => _277.debug, 'optionalAccess', _278 => _278.watchFiles])) {
|
|
20188
20252
|
const watcherService2 = ctx.watcherService;
|
|
20189
|
-
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess',
|
|
20190
|
-
const watcher = _optionalChain([watcherService2, 'optionalAccess',
|
|
20253
|
+
const watcherRoot = _nullishCoalesce(_optionalChain([subPackageMeta, 'optionalAccess', _279 => _279.subPackage, 'access', _280 => _280.root]), () => ( "/"));
|
|
20254
|
+
const watcher = _optionalChain([watcherService2, 'optionalAccess', _281 => _281.getRollupWatcher, 'call', _282 => _282(watcherRoot)]);
|
|
20191
20255
|
let watchFiles;
|
|
20192
20256
|
if (watcher && typeof watcher.getWatchFiles === "function") {
|
|
20193
20257
|
watchFiles = await watcher.getWatchFiles();
|
|
@@ -20201,7 +20265,7 @@ function createCoreLifecyclePlugin(state) {
|
|
|
20201
20265
|
}
|
|
20202
20266
|
},
|
|
20203
20267
|
buildEnd() {
|
|
20204
|
-
_optionalChain([debug2, 'optionalCall',
|
|
20268
|
+
_optionalChain([debug2, 'optionalCall', _283 => _283(`${subPackageMeta ? `\u72EC\u7ACB\u5206\u5305 ${subPackageMeta.subPackage.root}` : "\u4E3B\u5305"} ${Array.from(this.getModuleIds()).length} \u4E2A\u6A21\u5757\u88AB\u7F16\u8BD1`)]);
|
|
20205
20269
|
}
|
|
20206
20270
|
};
|
|
20207
20271
|
}
|
|
@@ -20557,14 +20621,14 @@ function createPluginPruner() {
|
|
|
20557
20621
|
name: "weapp-vite:preflight",
|
|
20558
20622
|
enforce: "pre",
|
|
20559
20623
|
configResolved(config) {
|
|
20560
|
-
if (!_optionalChain([config, 'access',
|
|
20624
|
+
if (!_optionalChain([config, 'access', _284 => _284.plugins, 'optionalAccess', _285 => _285.length])) {
|
|
20561
20625
|
return;
|
|
20562
20626
|
}
|
|
20563
20627
|
for (const removePlugin of removePlugins) {
|
|
20564
20628
|
const idx = config.plugins.findIndex((plugin) => plugin.name === removePlugin);
|
|
20565
20629
|
if (idx > -1) {
|
|
20566
20630
|
const [plugin] = config.plugins.splice(idx, 1);
|
|
20567
|
-
plugin && _optionalChain([debug3, 'optionalCall',
|
|
20631
|
+
plugin && _optionalChain([debug3, 'optionalCall', _286 => _286("remove plugin", plugin.name)]);
|
|
20568
20632
|
}
|
|
20569
20633
|
}
|
|
20570
20634
|
}
|
|
@@ -20603,8 +20667,8 @@ function createWorkerBuildPlugin(ctx) {
|
|
|
20603
20667
|
name: "weapp-vite:workers",
|
|
20604
20668
|
enforce: "pre",
|
|
20605
20669
|
async options(options) {
|
|
20606
|
-
const workerConfig = _optionalChain([configService, 'access',
|
|
20607
|
-
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess',
|
|
20670
|
+
const workerConfig = _optionalChain([configService, 'access', _287 => _287.weappViteConfig, 'optionalAccess', _288 => _288.worker]);
|
|
20671
|
+
const entries = Array.isArray(_optionalChain([workerConfig, 'optionalAccess', _289 => _289.entry])) ? workerConfig.entry : [_optionalChain([workerConfig, 'optionalAccess', _290 => _290.entry])];
|
|
20608
20672
|
const normalized = (await Promise.all(entries.filter(Boolean).map((entry) => resolveWorkerEntry(ctx, entry)))).filter((result) => Boolean(result.value)).reduce((acc, cur) => {
|
|
20609
20673
|
acc[cur.key] = cur.value;
|
|
20610
20674
|
return acc;
|
|
@@ -20721,7 +20785,7 @@ async function transformWxsFile(state, wxsPath) {
|
|
|
20721
20785
|
const { result, importees } = transformWxsCode(rawCode, {
|
|
20722
20786
|
filename: wxsPath
|
|
20723
20787
|
});
|
|
20724
|
-
if (typeof _optionalChain([result, 'optionalAccess',
|
|
20788
|
+
if (typeof _optionalChain([result, 'optionalAccess', _291 => _291.code]) === "string") {
|
|
20725
20789
|
code = result.code;
|
|
20726
20790
|
}
|
|
20727
20791
|
const dirname5 = _pathe2.default.dirname(wxsPath);
|
|
@@ -20771,13 +20835,13 @@ function vitePluginWeappWorkers(ctx) {
|
|
|
20771
20835
|
}
|
|
20772
20836
|
function attachRuntimePlugins(ctx, plugins) {
|
|
20773
20837
|
const runtimePlugins = ctx[RUNTIME_PLUGINS_SYMBOL];
|
|
20774
|
-
if (!_optionalChain([runtimePlugins, 'optionalAccess',
|
|
20838
|
+
if (!_optionalChain([runtimePlugins, 'optionalAccess', _292 => _292.length])) {
|
|
20775
20839
|
return plugins;
|
|
20776
20840
|
}
|
|
20777
20841
|
return [...runtimePlugins, ...plugins];
|
|
20778
20842
|
}
|
|
20779
20843
|
function applyInspect(ctx, plugins) {
|
|
20780
|
-
const inspectOptions = _optionalChain([ctx, 'access',
|
|
20844
|
+
const inspectOptions = _optionalChain([ctx, 'access', _293 => _293.configService, 'access', _294 => _294.weappViteConfig, 'optionalAccess', _295 => _295.debug, 'optionalAccess', _296 => _296.inspect]);
|
|
20781
20845
|
if (!inspectOptions) {
|
|
20782
20846
|
return plugins;
|
|
20783
20847
|
}
|
|
@@ -20857,7 +20921,7 @@ export default _objectSpread2;`
|
|
|
20857
20921
|
function getOxcHelperName(id) {
|
|
20858
20922
|
OXC_RUNTIME_HELPER_ALIAS.lastIndex = 0;
|
|
20859
20923
|
const match2 = OXC_RUNTIME_HELPER_ALIAS.exec(id);
|
|
20860
|
-
return _optionalChain([match2, 'optionalAccess',
|
|
20924
|
+
return _optionalChain([match2, 'optionalAccess', _297 => _297[1]]);
|
|
20861
20925
|
}
|
|
20862
20926
|
function createOxcRuntimeSupport() {
|
|
20863
20927
|
const oxcRuntimeInfo = getPackageInfoSync("@oxc-project/runtime");
|
|
@@ -21057,8 +21121,8 @@ function createConfigService(ctx) {
|
|
|
21057
21121
|
command: isDev ? "serve" : "build",
|
|
21058
21122
|
mode
|
|
21059
21123
|
}, resolvedConfigFile, cwd);
|
|
21060
|
-
const loadedConfig = _optionalChain([loaded, 'optionalAccess',
|
|
21061
|
-
const srcRoot = _nullishCoalesce(_optionalChain([loadedConfig, 'optionalAccess',
|
|
21124
|
+
const loadedConfig = _optionalChain([loaded, 'optionalAccess', _298 => _298.config]);
|
|
21125
|
+
const srcRoot = _nullishCoalesce(_optionalChain([loadedConfig, 'optionalAccess', _299 => _299.weapp, 'optionalAccess', _300 => _300.srcRoot]), () => ( ""));
|
|
21062
21126
|
function relativeSrcRoot(p) {
|
|
21063
21127
|
if (srcRoot) {
|
|
21064
21128
|
return _pathe2.default.relative(srcRoot, p);
|
|
@@ -21107,11 +21171,11 @@ function createConfigService(ctx) {
|
|
|
21107
21171
|
config.plugins ??= [];
|
|
21108
21172
|
config.plugins.unshift(oxcRuntimeSupport.vitePlugin);
|
|
21109
21173
|
}
|
|
21110
|
-
const platform = _nullishCoalesce(_optionalChain([config, 'access',
|
|
21174
|
+
const platform = _nullishCoalesce(_optionalChain([config, 'access', _301 => _301.weapp, 'optionalAccess', _302 => _302.platform]), () => ( "weapp"));
|
|
21111
21175
|
const resolvedOutputExtensions = getOutputExtensions(platform);
|
|
21112
21176
|
config.plugins ??= [];
|
|
21113
|
-
_optionalChain([config, 'access',
|
|
21114
|
-
const aliasEntries = getAliasEntries(_optionalChain([config, 'access',
|
|
21177
|
+
_optionalChain([config, 'access', _303 => _303.plugins, 'optionalAccess', _304 => _304.push, 'call', _305 => _305(_vitetsconfigpaths2.default.call(void 0, _optionalChain([config, 'access', _306 => _306.weapp, 'optionalAccess', _307 => _307.tsconfigPaths])))]);
|
|
21178
|
+
const aliasEntries = getAliasEntries(_optionalChain([config, 'access', _308 => _308.weapp, 'optionalAccess', _309 => _309.jsonAlias]));
|
|
21115
21179
|
return {
|
|
21116
21180
|
config,
|
|
21117
21181
|
aliasEntries,
|
|
@@ -21266,7 +21330,7 @@ function createConfigService(ctx) {
|
|
|
21266
21330
|
);
|
|
21267
21331
|
inlineConfig.logLevel = "info";
|
|
21268
21332
|
injectBuiltinAliases(inlineConfig);
|
|
21269
|
-
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess',
|
|
21333
|
+
const currentRoot = _optionalChain([subPackageMeta, 'optionalAccess', _310 => _310.subPackage, 'access', _311 => _311.root]);
|
|
21270
21334
|
options = {
|
|
21271
21335
|
...options,
|
|
21272
21336
|
currentSubPackageRoot: currentRoot
|
|
@@ -21337,10 +21401,10 @@ function createConfigService(ctx) {
|
|
|
21337
21401
|
return options.srcRoot;
|
|
21338
21402
|
},
|
|
21339
21403
|
get pluginRoot() {
|
|
21340
|
-
return _optionalChain([options, 'access',
|
|
21404
|
+
return _optionalChain([options, 'access', _312 => _312.config, 'access', _313 => _313.weapp, 'optionalAccess', _314 => _314.pluginRoot]);
|
|
21341
21405
|
},
|
|
21342
21406
|
get absolutePluginRoot() {
|
|
21343
|
-
if (_optionalChain([options, 'access',
|
|
21407
|
+
if (_optionalChain([options, 'access', _315 => _315.config, 'access', _316 => _316.weapp, 'optionalAccess', _317 => _317.pluginRoot])) {
|
|
21344
21408
|
return _pathe2.default.resolve(options.cwd, options.config.weapp.pluginRoot);
|
|
21345
21409
|
}
|
|
21346
21410
|
},
|
|
@@ -21416,7 +21480,7 @@ function createJsonService(ctx) {
|
|
|
21416
21480
|
return resultJson;
|
|
21417
21481
|
} catch (error) {
|
|
21418
21482
|
logger_default.error(`\u6B8B\u7834\u7684JSON\u6587\u4EF6: ${filepath}`);
|
|
21419
|
-
_optionalChain([debug, 'optionalCall',
|
|
21483
|
+
_optionalChain([debug, 'optionalCall', _318 => _318(error)]);
|
|
21420
21484
|
}
|
|
21421
21485
|
}
|
|
21422
21486
|
function resolve8(entry) {
|
|
@@ -21468,7 +21532,7 @@ function createNpmService(ctx) {
|
|
|
21468
21532
|
if (!ctx.configService) {
|
|
21469
21533
|
throw new Error("configService must be initialized before writing npm cache");
|
|
21470
21534
|
}
|
|
21471
|
-
if (_optionalChain([ctx, 'access',
|
|
21535
|
+
if (_optionalChain([ctx, 'access', _319 => _319.configService, 'access', _320 => _320.weappViteConfig, 'optionalAccess', _321 => _321.npm, 'optionalAccess', _322 => _322.cache])) {
|
|
21472
21536
|
await _fsextra2.default.outputJSON(getDependenciesCacheFilePath(root), {
|
|
21473
21537
|
hash: dependenciesCacheHash()
|
|
21474
21538
|
});
|
|
@@ -21481,7 +21545,7 @@ function createNpmService(ctx) {
|
|
|
21481
21545
|
}
|
|
21482
21546
|
}
|
|
21483
21547
|
async function checkDependenciesCacheOutdate(root) {
|
|
21484
|
-
if (_optionalChain([ctx, 'access',
|
|
21548
|
+
if (_optionalChain([ctx, 'access', _323 => _323.configService, 'optionalAccess', _324 => _324.weappViteConfig, 'optionalAccess', _325 => _325.npm, 'optionalAccess', _326 => _326.cache])) {
|
|
21485
21549
|
const json = await readDependenciesCache(root);
|
|
21486
21550
|
if (_shared.isObject.call(void 0, json)) {
|
|
21487
21551
|
return dependenciesCacheHash() !== json.hash;
|
|
@@ -21515,7 +21579,7 @@ function createNpmService(ctx) {
|
|
|
21515
21579
|
target: "es6",
|
|
21516
21580
|
external: []
|
|
21517
21581
|
});
|
|
21518
|
-
const resolvedOptions = _optionalChain([ctx, 'access',
|
|
21582
|
+
const resolvedOptions = _optionalChain([ctx, 'access', _327 => _327.configService, 'optionalAccess', _328 => _328.weappViteConfig, 'optionalAccess', _329 => _329.npm, 'optionalAccess', _330 => _330.buildOptions, 'optionalCall', _331 => _331(
|
|
21519
21583
|
mergedOptions,
|
|
21520
21584
|
{ name, entry }
|
|
21521
21585
|
)]);
|
|
@@ -21603,7 +21667,7 @@ function createNpmService(ctx) {
|
|
|
21603
21667
|
throw new Error("configService must be initialized before resolving npm relation list");
|
|
21604
21668
|
}
|
|
21605
21669
|
let packNpmRelationList = [];
|
|
21606
|
-
if (_optionalChain([ctx, 'access',
|
|
21670
|
+
if (_optionalChain([ctx, 'access', _332 => _332.configService, 'access', _333 => _333.projectConfig, 'access', _334 => _334.setting, 'optionalAccess', _335 => _335.packNpmManually]) && Array.isArray(ctx.configService.projectConfig.setting.packNpmRelationList)) {
|
|
21607
21671
|
packNpmRelationList = ctx.configService.projectConfig.setting.packNpmRelationList;
|
|
21608
21672
|
} else {
|
|
21609
21673
|
packNpmRelationList = [
|
|
@@ -21616,10 +21680,10 @@ function createNpmService(ctx) {
|
|
|
21616
21680
|
return packNpmRelationList;
|
|
21617
21681
|
}
|
|
21618
21682
|
async function build3(options) {
|
|
21619
|
-
if (!_optionalChain([ctx, 'access',
|
|
21683
|
+
if (!_optionalChain([ctx, 'access', _336 => _336.configService, 'optionalAccess', _337 => _337.weappViteConfig, 'optionalAccess', _338 => _338.npm, 'optionalAccess', _339 => _339.enable])) {
|
|
21620
21684
|
return;
|
|
21621
21685
|
}
|
|
21622
|
-
_optionalChain([debug, 'optionalCall',
|
|
21686
|
+
_optionalChain([debug, 'optionalCall', _340 => _340("buildNpm start")]);
|
|
21623
21687
|
const packNpmRelationList = getPackNpmRelationList();
|
|
21624
21688
|
const [mainRelation, ...subRelations] = packNpmRelationList;
|
|
21625
21689
|
const packageJsonPath = _pathe2.default.resolve(ctx.configService.cwd, mainRelation.packageJsonPath);
|
|
@@ -21694,7 +21758,7 @@ function createNpmService(ctx) {
|
|
|
21694
21758
|
}
|
|
21695
21759
|
}
|
|
21696
21760
|
}
|
|
21697
|
-
_optionalChain([debug, 'optionalCall',
|
|
21761
|
+
_optionalChain([debug, 'optionalCall', _341 => _341("buildNpm end")]);
|
|
21698
21762
|
}
|
|
21699
21763
|
return {
|
|
21700
21764
|
getDependenciesCacheFilePath,
|
|
@@ -21738,7 +21802,7 @@ var TimeoutError = (_class16 = class _TimeoutError extends Error {
|
|
|
21738
21802
|
__init36() {this.name = "TimeoutError"}
|
|
21739
21803
|
constructor(message, options) {
|
|
21740
21804
|
super(message, options);_class16.prototype.__init36.call(this);;
|
|
21741
|
-
_optionalChain([Error, 'access',
|
|
21805
|
+
_optionalChain([Error, 'access', _342 => _342.captureStackTrace, 'optionalCall', _343 => _343(this, _TimeoutError)]);
|
|
21742
21806
|
}
|
|
21743
21807
|
}, _class16);
|
|
21744
21808
|
var getAbortedReason = (signal) => _nullishCoalesce(signal.reason, () => ( new DOMException("This operation was aborted.", "AbortError")));
|
|
@@ -21756,7 +21820,7 @@ function pTimeout(promise, options) {
|
|
|
21756
21820
|
if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
|
|
21757
21821
|
throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
|
|
21758
21822
|
}
|
|
21759
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
21823
|
+
if (_optionalChain([signal, 'optionalAccess', _344 => _344.aborted])) {
|
|
21760
21824
|
reject(getAbortedReason(signal));
|
|
21761
21825
|
return;
|
|
21762
21826
|
}
|
|
@@ -21854,7 +21918,7 @@ var PriorityQueue = class {
|
|
|
21854
21918
|
}
|
|
21855
21919
|
dequeue() {
|
|
21856
21920
|
const item = this.#queue.shift();
|
|
21857
|
-
return _optionalChain([item, 'optionalAccess',
|
|
21921
|
+
return _optionalChain([item, 'optionalAccess', _345 => _345.run]);
|
|
21858
21922
|
}
|
|
21859
21923
|
filter(options) {
|
|
21860
21924
|
return this.#queue.filter((element) => element.priority === options.priority).map((element) => element.run);
|
|
@@ -21915,10 +21979,10 @@ var PQueue = class extends import_index2.default {
|
|
|
21915
21979
|
...options
|
|
21916
21980
|
};
|
|
21917
21981
|
if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
|
|
21918
|
-
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
21982
|
+
throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _346 => _346.intervalCap, 'optionalAccess', _347 => _347.toString, 'call', _348 => _348()]), () => ( ""))}\` (${typeof options.intervalCap})`);
|
|
21919
21983
|
}
|
|
21920
21984
|
if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
|
|
21921
|
-
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access',
|
|
21985
|
+
throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _349 => _349.interval, 'optionalAccess', _350 => _350.toString, 'call', _351 => _351()]), () => ( ""))}\` (${typeof options.interval})`);
|
|
21922
21986
|
}
|
|
21923
21987
|
this.#carryoverIntervalCount = _nullishCoalesce(_nullishCoalesce(options.carryoverIntervalCount, () => ( options.carryoverConcurrencyCount)), () => ( false));
|
|
21924
21988
|
this.#isIntervalIgnored = options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0;
|
|
@@ -22125,7 +22189,7 @@ var PQueue = class extends import_index2.default {
|
|
|
22125
22189
|
});
|
|
22126
22190
|
try {
|
|
22127
22191
|
try {
|
|
22128
|
-
_optionalChain([options, 'access',
|
|
22192
|
+
_optionalChain([options, 'access', _352 => _352.signal, 'optionalAccess', _353 => _353.throwIfAborted, 'call', _354 => _354()]);
|
|
22129
22193
|
} catch (error) {
|
|
22130
22194
|
if (!this.#isIntervalIgnored) {
|
|
22131
22195
|
this.#intervalCount--;
|
|
@@ -22434,9 +22498,30 @@ _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
|
22434
22498
|
// src/cache/file.ts
|
|
22435
22499
|
_chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
22436
22500
|
|
|
22437
|
-
|
|
22501
|
+
var FNV_OFFSET_BASIS = 0xCBF29CE484222325n;
|
|
22502
|
+
var FNV_PRIME = 0x100000001B3n;
|
|
22503
|
+
var FNV_MASK = 0xFFFFFFFFFFFFFFFFn;
|
|
22504
|
+
function fnv1aStep(hash, byte) {
|
|
22505
|
+
hash ^= BigInt(byte & 255);
|
|
22506
|
+
return hash * FNV_PRIME & FNV_MASK;
|
|
22507
|
+
}
|
|
22438
22508
|
function createSignature(content) {
|
|
22439
|
-
|
|
22509
|
+
let hash = FNV_OFFSET_BASIS;
|
|
22510
|
+
if (typeof content === "string") {
|
|
22511
|
+
for (let i = 0; i < content.length; i++) {
|
|
22512
|
+
const code = content.charCodeAt(i);
|
|
22513
|
+
hash = fnv1aStep(hash, code & 255);
|
|
22514
|
+
const high = code >>> 8;
|
|
22515
|
+
if (high > 0) {
|
|
22516
|
+
hash = fnv1aStep(hash, high);
|
|
22517
|
+
}
|
|
22518
|
+
}
|
|
22519
|
+
} else {
|
|
22520
|
+
for (const byte of content) {
|
|
22521
|
+
hash = fnv1aStep(hash, byte);
|
|
22522
|
+
}
|
|
22523
|
+
}
|
|
22524
|
+
return hash.toString(36);
|
|
22440
22525
|
}
|
|
22441
22526
|
var FileCache = class {
|
|
22442
22527
|
|
|
@@ -22477,7 +22562,7 @@ var FileCache = class {
|
|
|
22477
22562
|
return true;
|
|
22478
22563
|
}
|
|
22479
22564
|
const cachedMtime = this.mtimeMap.get(id);
|
|
22480
|
-
const nextSignature = _optionalChain([options, 'optionalAccess',
|
|
22565
|
+
const nextSignature = _optionalChain([options, 'optionalAccess', _355 => _355.content]) !== void 0 ? createSignature(options.content) : void 0;
|
|
22481
22566
|
const updateSignature = () => {
|
|
22482
22567
|
if (nextSignature !== void 0) {
|
|
22483
22568
|
this.signatureMap.set(id, nextSignature);
|
|
@@ -22653,7 +22738,7 @@ function createScanService(ctx) {
|
|
|
22653
22738
|
if (!ctx.configService) {
|
|
22654
22739
|
throw new Error("configService must be initialized before scanning subpackages");
|
|
22655
22740
|
}
|
|
22656
|
-
const json = _optionalChain([scanState, 'access',
|
|
22741
|
+
const json = _optionalChain([scanState, 'access', _356 => _356.appEntry, 'optionalAccess', _357 => _357.json]);
|
|
22657
22742
|
if (scanState.isDirty || subPackageMap.size === 0) {
|
|
22658
22743
|
subPackageMap.clear();
|
|
22659
22744
|
independentSubPackageMap.clear();
|
|
@@ -22671,9 +22756,9 @@ function createScanService(ctx) {
|
|
|
22671
22756
|
subPackage,
|
|
22672
22757
|
entries: resolveSubPackageEntries(subPackage)
|
|
22673
22758
|
};
|
|
22674
|
-
const subPackageConfig = _optionalChain([ctx, 'access',
|
|
22675
|
-
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
22676
|
-
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess',
|
|
22759
|
+
const subPackageConfig = _optionalChain([ctx, 'access', _358 => _358.configService, 'access', _359 => _359.weappViteConfig, 'optionalAccess', _360 => _360.subPackages, 'optionalAccess', _361 => _361[subPackage.root]]);
|
|
22760
|
+
meta.subPackage.dependencies = _optionalChain([subPackageConfig, 'optionalAccess', _362 => _362.dependencies]);
|
|
22761
|
+
meta.subPackage.inlineConfig = _optionalChain([subPackageConfig, 'optionalAccess', _363 => _363.inlineConfig]);
|
|
22677
22762
|
metas.push(meta);
|
|
22678
22763
|
if (subPackage.root) {
|
|
22679
22764
|
subPackageMap.set(subPackage.root, meta);
|
|
@@ -22723,11 +22808,11 @@ function createScanService(ctx) {
|
|
|
22723
22808
|
loadSubPackages,
|
|
22724
22809
|
isMainPackageFileName,
|
|
22725
22810
|
get workersOptions() {
|
|
22726
|
-
return _optionalChain([scanState, 'access',
|
|
22811
|
+
return _optionalChain([scanState, 'access', _364 => _364.appEntry, 'optionalAccess', _365 => _365.json, 'optionalAccess', _366 => _366.workers]);
|
|
22727
22812
|
},
|
|
22728
22813
|
get workersDir() {
|
|
22729
|
-
const workersOptions = _optionalChain([scanState, 'access',
|
|
22730
|
-
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess',
|
|
22814
|
+
const workersOptions = _optionalChain([scanState, 'access', _367 => _367.appEntry, 'optionalAccess', _368 => _368.json, 'optionalAccess', _369 => _369.workers]);
|
|
22815
|
+
return typeof workersOptions === "object" ? _optionalChain([workersOptions, 'optionalAccess', _370 => _370.path]) : workersOptions;
|
|
22731
22816
|
},
|
|
22732
22817
|
markDirty() {
|
|
22733
22818
|
scanState.isDirty = true;
|
|
@@ -22773,7 +22858,7 @@ function createWatcherService(ctx) {
|
|
|
22773
22858
|
},
|
|
22774
22859
|
setRollupWatcher(watcher, root = "/") {
|
|
22775
22860
|
const oldWatcher = rollupWatcherMap.get(root);
|
|
22776
|
-
_optionalChain([oldWatcher, 'optionalAccess',
|
|
22861
|
+
_optionalChain([oldWatcher, 'optionalAccess', _371 => _371.close, 'call', _372 => _372()]);
|
|
22777
22862
|
rollupWatcherMap.set(root, watcher);
|
|
22778
22863
|
},
|
|
22779
22864
|
closeAll() {
|
|
@@ -22809,7 +22894,7 @@ function createWatcherServicePlugin(ctx) {
|
|
|
22809
22894
|
name: "weapp-runtime:watcher-service",
|
|
22810
22895
|
closeBundle() {
|
|
22811
22896
|
const configService = ctx.configService;
|
|
22812
|
-
const isWatchMode = _optionalChain([configService, 'optionalAccess',
|
|
22897
|
+
const isWatchMode = _optionalChain([configService, 'optionalAccess', _373 => _373.isDev]) || Boolean(_optionalChain([configService, 'optionalAccess', _374 => _374.inlineConfig, 'optionalAccess', _375 => _375.build, 'optionalAccess', _376 => _376.watch]));
|
|
22813
22898
|
if (!isWatchMode) {
|
|
22814
22899
|
service.closeAll();
|
|
22815
22900
|
}
|
|
@@ -25203,7 +25288,7 @@ function fnv1aHash(input) {
|
|
|
25203
25288
|
}
|
|
25204
25289
|
return (hash >>> 0).toString(36);
|
|
25205
25290
|
}
|
|
25206
|
-
function
|
|
25291
|
+
function createCacheKey2(source, platform) {
|
|
25207
25292
|
return `${platform}:${source.length.toString(36)}:${fnv1aHash(source)}`;
|
|
25208
25293
|
}
|
|
25209
25294
|
function resolveEventDirective(raw) {
|
|
@@ -25266,7 +25351,7 @@ function scanWxml(wxml, options) {
|
|
|
25266
25351
|
platform: "weapp"
|
|
25267
25352
|
});
|
|
25268
25353
|
const canUseCache = opts.excludeComponent === defaultExcludeComponent;
|
|
25269
|
-
const cacheKey = canUseCache ?
|
|
25354
|
+
const cacheKey = canUseCache ? createCacheKey2(source, opts.platform) : void 0;
|
|
25270
25355
|
if (cacheKey) {
|
|
25271
25356
|
const cached = scanWxmlCache.get(cacheKey);
|
|
25272
25357
|
if (cached) {
|
|
@@ -25408,6 +25493,9 @@ function scanWxml(wxml, options) {
|
|
|
25408
25493
|
source
|
|
25409
25494
|
);
|
|
25410
25495
|
parser.end();
|
|
25496
|
+
if (removalRanges.length > 1) {
|
|
25497
|
+
removalRanges.sort((a, b) => b.start - a.start);
|
|
25498
|
+
}
|
|
25411
25499
|
const token = {
|
|
25412
25500
|
components: components2,
|
|
25413
25501
|
deps,
|
|
@@ -25456,7 +25544,7 @@ function createWxmlService(ctx) {
|
|
|
25456
25544
|
return set3;
|
|
25457
25545
|
}
|
|
25458
25546
|
function clearAll() {
|
|
25459
|
-
const currentRoot = _optionalChain([ctx, 'access',
|
|
25547
|
+
const currentRoot = _optionalChain([ctx, 'access', _377 => _377.configService, 'optionalAccess', _378 => _378.currentSubPackageRoot]);
|
|
25460
25548
|
if (!currentRoot) {
|
|
25461
25549
|
depsMap.clear();
|
|
25462
25550
|
tokenMap.clear();
|
|
@@ -25511,7 +25599,7 @@ function createWxmlService(ctx) {
|
|
|
25511
25599
|
}
|
|
25512
25600
|
return scanWxml(wxml, {
|
|
25513
25601
|
platform: ctx.configService.platform,
|
|
25514
|
-
..._optionalChain([ctx, 'access',
|
|
25602
|
+
..._optionalChain([ctx, 'access', _379 => _379.configService, 'access', _380 => _380.weappViteConfig, 'optionalAccess', _381 => _381.enhance, 'optionalAccess', _382 => _382.wxml]) === true ? {} : _optionalChain([ctx, 'access', _383 => _383.configService, 'access', _384 => _384.weappViteConfig, 'optionalAccess', _385 => _385.enhance, 'optionalAccess', _386 => _386.wxml])
|
|
25515
25603
|
});
|
|
25516
25604
|
}
|
|
25517
25605
|
async function scan(filepath) {
|
|
@@ -25620,8 +25708,8 @@ function resetCompilerContext(key) {
|
|
|
25620
25708
|
|
|
25621
25709
|
// src/createContext.ts
|
|
25622
25710
|
async function createCompilerContext(options) {
|
|
25623
|
-
const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
25624
|
-
if (!_optionalChain([options, 'optionalAccess',
|
|
25711
|
+
const key = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _387 => _387.key]), () => ( "default"));
|
|
25712
|
+
if (!_optionalChain([options, 'optionalAccess', _388 => _388.key])) {
|
|
25625
25713
|
resetCompilerContext(key);
|
|
25626
25714
|
}
|
|
25627
25715
|
const ctx = getCompilerContext(key);
|