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
|
@@ -19443,11 +19443,51 @@ function transformWxsCode(code, options) {
|
|
|
19443
19443
|
}
|
|
19444
19444
|
|
|
19445
19445
|
// src/wxml/handle.ts
|
|
19446
|
+
var handleCache = /* @__PURE__ */ new WeakMap();
|
|
19447
|
+
var inlineWxsTransformCache = /* @__PURE__ */ new Map();
|
|
19448
|
+
var INLINE_WXS_CACHE_LIMIT = 256;
|
|
19449
|
+
function createCacheKey(options) {
|
|
19450
|
+
return `${options.removeComment ? 1 : 0}|${options.transformEvent ? 1 : 0}`;
|
|
19451
|
+
}
|
|
19452
|
+
function getCachedResult(data2, cacheKey) {
|
|
19453
|
+
return handleCache.get(data2)?.get(cacheKey);
|
|
19454
|
+
}
|
|
19455
|
+
function setCachedResult(data2, cacheKey, result) {
|
|
19456
|
+
let cacheForToken = handleCache.get(data2);
|
|
19457
|
+
if (!cacheForToken) {
|
|
19458
|
+
cacheForToken = /* @__PURE__ */ new Map();
|
|
19459
|
+
handleCache.set(data2, cacheForToken);
|
|
19460
|
+
}
|
|
19461
|
+
cacheForToken.set(cacheKey, result);
|
|
19462
|
+
return result;
|
|
19463
|
+
}
|
|
19464
|
+
function getCachedInlineWxsTransform(code) {
|
|
19465
|
+
const cached = inlineWxsTransformCache.get(code);
|
|
19466
|
+
if (cached) {
|
|
19467
|
+
inlineWxsTransformCache.delete(code);
|
|
19468
|
+
inlineWxsTransformCache.set(code, cached);
|
|
19469
|
+
return cached;
|
|
19470
|
+
}
|
|
19471
|
+
const transformed = transformWxsCode(code);
|
|
19472
|
+
inlineWxsTransformCache.set(code, transformed);
|
|
19473
|
+
if (inlineWxsTransformCache.size > INLINE_WXS_CACHE_LIMIT) {
|
|
19474
|
+
const firstKey = inlineWxsTransformCache.keys().next().value;
|
|
19475
|
+
if (firstKey) {
|
|
19476
|
+
inlineWxsTransformCache.delete(firstKey);
|
|
19477
|
+
}
|
|
19478
|
+
}
|
|
19479
|
+
return transformed;
|
|
19480
|
+
}
|
|
19446
19481
|
function handleWxml(data2, options) {
|
|
19447
19482
|
const opts = defu2(options, {
|
|
19448
19483
|
removeComment: true,
|
|
19449
19484
|
transformEvent: true
|
|
19450
19485
|
});
|
|
19486
|
+
const cacheKey = createCacheKey(opts);
|
|
19487
|
+
const cached = getCachedResult(data2, cacheKey);
|
|
19488
|
+
if (cached) {
|
|
19489
|
+
return cached;
|
|
19490
|
+
}
|
|
19451
19491
|
const {
|
|
19452
19492
|
code,
|
|
19453
19493
|
removalRanges,
|
|
@@ -19466,11 +19506,11 @@ function handleWxml(data2, options) {
|
|
|
19466
19506
|
const shouldRemoveConditionals = removalRanges.length > 0;
|
|
19467
19507
|
const shouldRemoveComments = opts.removeComment && commentTokens.length > 0;
|
|
19468
19508
|
if (!shouldNormalizeImports && !shouldRemoveLang && !shouldTransformInlineWxs && !shouldTransformEvents && !shouldRemoveConditionals && !shouldRemoveComments) {
|
|
19469
|
-
return {
|
|
19509
|
+
return setCachedResult(data2, cacheKey, {
|
|
19470
19510
|
code,
|
|
19471
19511
|
components: components2,
|
|
19472
19512
|
deps
|
|
19473
|
-
};
|
|
19513
|
+
});
|
|
19474
19514
|
}
|
|
19475
19515
|
const ms = new MagicString(code);
|
|
19476
19516
|
if (shouldNormalizeImports) {
|
|
@@ -19485,7 +19525,7 @@ function handleWxml(data2, options) {
|
|
|
19485
19525
|
}
|
|
19486
19526
|
if (shouldTransformInlineWxs) {
|
|
19487
19527
|
for (const { end, start, value } of inlineWxsTokens) {
|
|
19488
|
-
const { result } =
|
|
19528
|
+
const { result } = getCachedInlineWxsTransform(value);
|
|
19489
19529
|
if (result?.code) {
|
|
19490
19530
|
ms.update(start, end, `
|
|
19491
19531
|
${result.code}`);
|
|
@@ -19498,7 +19538,7 @@ ${result.code}`);
|
|
|
19498
19538
|
}
|
|
19499
19539
|
}
|
|
19500
19540
|
if (shouldRemoveConditionals) {
|
|
19501
|
-
for (const { start, end } of
|
|
19541
|
+
for (const { start, end } of removalRanges) {
|
|
19502
19542
|
if (end > start) {
|
|
19503
19543
|
ms.remove(start, end);
|
|
19504
19544
|
}
|
|
@@ -19509,11 +19549,11 @@ ${result.code}`);
|
|
|
19509
19549
|
ms.remove(start, end);
|
|
19510
19550
|
}
|
|
19511
19551
|
}
|
|
19512
|
-
return {
|
|
19552
|
+
return setCachedResult(data2, cacheKey, {
|
|
19513
19553
|
code: ms.toString(),
|
|
19514
19554
|
components: components2,
|
|
19515
19555
|
deps
|
|
19516
|
-
};
|
|
19556
|
+
});
|
|
19517
19557
|
}
|
|
19518
19558
|
|
|
19519
19559
|
// src/plugins/hooks/useLoadEntry/index.ts
|
|
@@ -19659,6 +19699,86 @@ function analyzeCommonJson(json) {
|
|
|
19659
19699
|
}
|
|
19660
19700
|
|
|
19661
19701
|
// src/plugins/hooks/useLoadEntry/loadEntry.ts
|
|
19702
|
+
function createStopwatch() {
|
|
19703
|
+
const start = performance3.now();
|
|
19704
|
+
return () => `${(performance3.now() - start).toFixed(2)}ms`;
|
|
19705
|
+
}
|
|
19706
|
+
async function addWatchTarget(pluginCtx, target, existsCache) {
|
|
19707
|
+
if (!target || typeof pluginCtx.addWatchFile !== "function") {
|
|
19708
|
+
return false;
|
|
19709
|
+
}
|
|
19710
|
+
if (existsCache.has(target)) {
|
|
19711
|
+
const cached = existsCache.get(target);
|
|
19712
|
+
if (cached) {
|
|
19713
|
+
pluginCtx.addWatchFile(target);
|
|
19714
|
+
}
|
|
19715
|
+
return cached;
|
|
19716
|
+
}
|
|
19717
|
+
const exists = await fs8.exists(target);
|
|
19718
|
+
if (exists) {
|
|
19719
|
+
pluginCtx.addWatchFile(target);
|
|
19720
|
+
}
|
|
19721
|
+
existsCache.set(target, exists);
|
|
19722
|
+
return exists;
|
|
19723
|
+
}
|
|
19724
|
+
async function collectStyleImports(pluginCtx, id, existsCache) {
|
|
19725
|
+
const styleImports = [];
|
|
19726
|
+
for (const ext2 of supportedCssLangs) {
|
|
19727
|
+
const mayBeCssPath = changeFileExtension(id, ext2);
|
|
19728
|
+
const exists = await addWatchTarget(pluginCtx, mayBeCssPath, existsCache);
|
|
19729
|
+
if (exists) {
|
|
19730
|
+
styleImports.push(mayBeCssPath);
|
|
19731
|
+
}
|
|
19732
|
+
}
|
|
19733
|
+
return styleImports;
|
|
19734
|
+
}
|
|
19735
|
+
async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJsonAsset, existsCache) {
|
|
19736
|
+
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = json;
|
|
19737
|
+
const processSideJson = async (location) => {
|
|
19738
|
+
if (!location) {
|
|
19739
|
+
return;
|
|
19740
|
+
}
|
|
19741
|
+
const { path: jsonPath, predictions } = await findJsonEntry(
|
|
19742
|
+
path13.resolve(path13.dirname(id), location)
|
|
19743
|
+
);
|
|
19744
|
+
for (const prediction of predictions) {
|
|
19745
|
+
await addWatchTarget(pluginCtx, prediction, existsCache);
|
|
19746
|
+
}
|
|
19747
|
+
if (!jsonPath) {
|
|
19748
|
+
return;
|
|
19749
|
+
}
|
|
19750
|
+
const content = await jsonService.read(jsonPath);
|
|
19751
|
+
registerJsonAsset({
|
|
19752
|
+
json: content,
|
|
19753
|
+
jsonPath,
|
|
19754
|
+
type: "app"
|
|
19755
|
+
});
|
|
19756
|
+
};
|
|
19757
|
+
await processSideJson(sitemapLocation);
|
|
19758
|
+
await processSideJson(themeLocation);
|
|
19759
|
+
}
|
|
19760
|
+
async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry, existsCache) {
|
|
19761
|
+
const { path: templateEntry, predictions } = await findTemplateEntry(id);
|
|
19762
|
+
for (const prediction of predictions) {
|
|
19763
|
+
await addWatchTarget(pluginCtx, prediction, existsCache);
|
|
19764
|
+
}
|
|
19765
|
+
if (!templateEntry) {
|
|
19766
|
+
return "";
|
|
19767
|
+
}
|
|
19768
|
+
await scanTemplateEntry(templateEntry);
|
|
19769
|
+
return templateEntry;
|
|
19770
|
+
}
|
|
19771
|
+
async function resolveEntries(entries, absoluteSrcRoot) {
|
|
19772
|
+
return Promise.all(
|
|
19773
|
+
entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
|
|
19774
|
+
const absPath = path13.resolve(absoluteSrcRoot, entry);
|
|
19775
|
+
return {
|
|
19776
|
+
entry,
|
|
19777
|
+
resolvedId: await this.resolve(absPath)
|
|
19778
|
+
};
|
|
19779
|
+
})
|
|
19780
|
+
);
|
|
19781
|
+
}
|
|
19662
19782
|
function createEntryLoader(options) {
|
|
19663
19783
|
const {
|
|
19664
19784
|
ctx,
|
|
@@ -19672,16 +19792,18 @@ function createEntryLoader(options) {
|
|
|
19672
19792
|
debug: debug4
|
|
19673
19793
|
} = options;
|
|
19674
19794
|
const { jsonService, configService } = ctx;
|
|
19795
|
+
const existsCache = /* @__PURE__ */ new Map();
|
|
19675
19796
|
return async function loadEntry(id, type) {
|
|
19676
|
-
|
|
19677
|
-
const
|
|
19797
|
+
existsCache.clear();
|
|
19798
|
+
const stopwatch = debug4 ? createStopwatch() : void 0;
|
|
19799
|
+
const getTime = () => stopwatch ? stopwatch() : "0.00ms";
|
|
19678
19800
|
const relativeCwdId = configService.relativeCwd(id);
|
|
19679
19801
|
this.addWatchFile(id);
|
|
19680
19802
|
const baseName = removeExtensionDeep3(id);
|
|
19681
19803
|
const jsonEntry = await findJsonEntry(id);
|
|
19682
19804
|
let jsonPath = jsonEntry.path;
|
|
19683
19805
|
for (const prediction of jsonEntry.predictions) {
|
|
19684
|
-
await addWatchTarget(this, prediction);
|
|
19806
|
+
await addWatchTarget(this, prediction, existsCache);
|
|
19685
19807
|
}
|
|
19686
19808
|
let json = {};
|
|
19687
19809
|
if (jsonPath) {
|
|
@@ -19698,10 +19820,11 @@ function createEntryLoader(options) {
|
|
|
19698
19820
|
id,
|
|
19699
19821
|
json,
|
|
19700
19822
|
jsonService,
|
|
19701
|
-
registerJsonAsset
|
|
19823
|
+
registerJsonAsset,
|
|
19824
|
+
existsCache
|
|
19702
19825
|
);
|
|
19703
19826
|
} else {
|
|
19704
|
-
templatePath = await ensureTemplateScanned(this, id, scanTemplateEntry);
|
|
19827
|
+
templatePath = await ensureTemplateScanned(this, id, scanTemplateEntry, existsCache);
|
|
19705
19828
|
applyAutoImports(baseName, json);
|
|
19706
19829
|
entries.push(...analyzeCommonJson(json));
|
|
19707
19830
|
}
|
|
@@ -19721,21 +19844,20 @@ function createEntryLoader(options) {
|
|
|
19721
19844
|
configService.absoluteSrcRoot
|
|
19722
19845
|
);
|
|
19723
19846
|
debug4?.(`resolvedIds ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
|
|
19724
|
-
|
|
19725
|
-
|
|
19726
|
-
|
|
19727
|
-
|
|
19728
|
-
|
|
19729
|
-
|
|
19730
|
-
|
|
19731
|
-
|
|
19732
|
-
|
|
19733
|
-
|
|
19734
|
-
|
|
19735
|
-
|
|
19736
|
-
|
|
19737
|
-
|
|
19738
|
-
);
|
|
19847
|
+
const pendingResolvedIds = [];
|
|
19848
|
+
for (const { entry, resolvedId } of resolvedIds) {
|
|
19849
|
+
if (!resolvedId) {
|
|
19850
|
+
logger_default.warn(`\u6CA1\u6709\u627E\u5230 \`${entry}\` \u7684\u5165\u53E3\u6587\u4EF6\uFF0C\u8BF7\u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u6B63\u786E!`);
|
|
19851
|
+
continue;
|
|
19852
|
+
}
|
|
19853
|
+
if (loadedEntrySet.has(resolvedId.id)) {
|
|
19854
|
+
continue;
|
|
19855
|
+
}
|
|
19856
|
+
pendingResolvedIds.push(resolvedId);
|
|
19857
|
+
}
|
|
19858
|
+
if (pendingResolvedIds.length) {
|
|
19859
|
+
await Promise.all(emitEntriesChunks.call(this, pendingResolvedIds));
|
|
19860
|
+
}
|
|
19739
19861
|
debug4?.(`emitEntriesChunks ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
|
|
19740
19862
|
registerJsonAsset({
|
|
19741
19863
|
jsonPath,
|
|
@@ -19743,80 +19865,22 @@ function createEntryLoader(options) {
|
|
|
19743
19865
|
type
|
|
19744
19866
|
});
|
|
19745
19867
|
const code = await fs8.readFile(id, "utf8");
|
|
19746
|
-
const
|
|
19747
|
-
await prependStyleImports.call(this, id, ms);
|
|
19868
|
+
const styleImports = await collectStyleImports(this, id, existsCache);
|
|
19748
19869
|
debug4?.(`loadEntry ${relativeCwdId} \u8017\u65F6 ${getTime()}`);
|
|
19749
|
-
|
|
19750
|
-
code: ms.toString()
|
|
19751
|
-
};
|
|
19752
|
-
};
|
|
19753
|
-
}
|
|
19754
|
-
async function collectAppSideFiles(pluginCtx, id, json, jsonService, registerJsonAsset) {
|
|
19755
|
-
const { sitemapLocation = "sitemap.json", themeLocation = "theme.json" } = json;
|
|
19756
|
-
const processSideJson = async (location) => {
|
|
19757
|
-
if (!location) {
|
|
19758
|
-
return;
|
|
19759
|
-
}
|
|
19760
|
-
const { path: jsonPath, predictions } = await findJsonEntry(
|
|
19761
|
-
path13.resolve(path13.dirname(id), location)
|
|
19762
|
-
);
|
|
19763
|
-
for (const prediction of predictions) {
|
|
19764
|
-
await addWatchTarget(pluginCtx, prediction);
|
|
19765
|
-
}
|
|
19766
|
-
if (!jsonPath) {
|
|
19767
|
-
return;
|
|
19768
|
-
}
|
|
19769
|
-
const content = await jsonService.read(jsonPath);
|
|
19770
|
-
registerJsonAsset({
|
|
19771
|
-
json: content,
|
|
19772
|
-
jsonPath,
|
|
19773
|
-
type: "app"
|
|
19774
|
-
});
|
|
19775
|
-
};
|
|
19776
|
-
await processSideJson(sitemapLocation);
|
|
19777
|
-
await processSideJson(themeLocation);
|
|
19778
|
-
}
|
|
19779
|
-
async function ensureTemplateScanned(pluginCtx, id, scanTemplateEntry) {
|
|
19780
|
-
const { path: templateEntry, predictions } = await findTemplateEntry(id);
|
|
19781
|
-
for (const prediction of predictions) {
|
|
19782
|
-
await addWatchTarget(pluginCtx, prediction);
|
|
19783
|
-
}
|
|
19784
|
-
if (!templateEntry) {
|
|
19785
|
-
return "";
|
|
19786
|
-
}
|
|
19787
|
-
await scanTemplateEntry(templateEntry);
|
|
19788
|
-
return templateEntry;
|
|
19789
|
-
}
|
|
19790
|
-
async function resolveEntries(entries, absoluteSrcRoot) {
|
|
19791
|
-
return Promise.all(
|
|
19792
|
-
entries.filter((entry) => !entry.includes(":")).map(async (entry) => {
|
|
19793
|
-
const absPath = path13.resolve(absoluteSrcRoot, entry);
|
|
19870
|
+
if (styleImports.length === 0) {
|
|
19794
19871
|
return {
|
|
19795
|
-
|
|
19796
|
-
resolvedId: await this.resolve(absPath)
|
|
19872
|
+
code
|
|
19797
19873
|
};
|
|
19798
|
-
}
|
|
19799
|
-
|
|
19800
|
-
|
|
19801
|
-
|
|
19802
|
-
for (const ext2 of supportedCssLangs) {
|
|
19803
|
-
const mayBeCssPath = changeFileExtension(id, ext2);
|
|
19804
|
-
const exists = await addWatchTarget(this, mayBeCssPath);
|
|
19805
|
-
if (exists) {
|
|
19806
|
-
ms.prepend(`import '${mayBeCssPath}';
|
|
19874
|
+
}
|
|
19875
|
+
const ms = new MagicString(code);
|
|
19876
|
+
for (const styleImport of styleImports) {
|
|
19877
|
+
ms.prepend(`import '${styleImport}';
|
|
19807
19878
|
`);
|
|
19808
19879
|
}
|
|
19809
|
-
|
|
19810
|
-
|
|
19811
|
-
|
|
19812
|
-
|
|
19813
|
-
return false;
|
|
19814
|
-
}
|
|
19815
|
-
const exists = await fs8.exists(target);
|
|
19816
|
-
if (exists) {
|
|
19817
|
-
pluginCtx.addWatchFile(target);
|
|
19818
|
-
}
|
|
19819
|
-
return exists;
|
|
19880
|
+
return {
|
|
19881
|
+
code: ms.toString()
|
|
19882
|
+
};
|
|
19883
|
+
};
|
|
19820
19884
|
}
|
|
19821
19885
|
|
|
19822
19886
|
// src/plugins/hooks/useLoadEntry/normalizer.ts
|
|
@@ -22432,10 +22496,31 @@ init_esm_shims();
|
|
|
22432
22496
|
|
|
22433
22497
|
// src/cache/file.ts
|
|
22434
22498
|
init_esm_shims();
|
|
22435
|
-
import { createHash as createHash2 } from "crypto";
|
|
22436
22499
|
import fs17 from "fs-extra";
|
|
22500
|
+
var FNV_OFFSET_BASIS = 0xCBF29CE484222325n;
|
|
22501
|
+
var FNV_PRIME = 0x100000001B3n;
|
|
22502
|
+
var FNV_MASK = 0xFFFFFFFFFFFFFFFFn;
|
|
22503
|
+
function fnv1aStep(hash, byte) {
|
|
22504
|
+
hash ^= BigInt(byte & 255);
|
|
22505
|
+
return hash * FNV_PRIME & FNV_MASK;
|
|
22506
|
+
}
|
|
22437
22507
|
function createSignature(content) {
|
|
22438
|
-
|
|
22508
|
+
let hash = FNV_OFFSET_BASIS;
|
|
22509
|
+
if (typeof content === "string") {
|
|
22510
|
+
for (let i = 0; i < content.length; i++) {
|
|
22511
|
+
const code = content.charCodeAt(i);
|
|
22512
|
+
hash = fnv1aStep(hash, code & 255);
|
|
22513
|
+
const high = code >>> 8;
|
|
22514
|
+
if (high > 0) {
|
|
22515
|
+
hash = fnv1aStep(hash, high);
|
|
22516
|
+
}
|
|
22517
|
+
}
|
|
22518
|
+
} else {
|
|
22519
|
+
for (const byte of content) {
|
|
22520
|
+
hash = fnv1aStep(hash, byte);
|
|
22521
|
+
}
|
|
22522
|
+
}
|
|
22523
|
+
return hash.toString(36);
|
|
22439
22524
|
}
|
|
22440
22525
|
var FileCache = class {
|
|
22441
22526
|
cache;
|
|
@@ -25202,7 +25287,7 @@ function fnv1aHash(input) {
|
|
|
25202
25287
|
}
|
|
25203
25288
|
return (hash >>> 0).toString(36);
|
|
25204
25289
|
}
|
|
25205
|
-
function
|
|
25290
|
+
function createCacheKey2(source, platform) {
|
|
25206
25291
|
return `${platform}:${source.length.toString(36)}:${fnv1aHash(source)}`;
|
|
25207
25292
|
}
|
|
25208
25293
|
function resolveEventDirective(raw) {
|
|
@@ -25265,7 +25350,7 @@ function scanWxml(wxml, options) {
|
|
|
25265
25350
|
platform: "weapp"
|
|
25266
25351
|
});
|
|
25267
25352
|
const canUseCache = opts.excludeComponent === defaultExcludeComponent;
|
|
25268
|
-
const cacheKey = canUseCache ?
|
|
25353
|
+
const cacheKey = canUseCache ? createCacheKey2(source, opts.platform) : void 0;
|
|
25269
25354
|
if (cacheKey) {
|
|
25270
25355
|
const cached = scanWxmlCache.get(cacheKey);
|
|
25271
25356
|
if (cached) {
|
|
@@ -25407,6 +25492,9 @@ function scanWxml(wxml, options) {
|
|
|
25407
25492
|
source
|
|
25408
25493
|
);
|
|
25409
25494
|
parser.end();
|
|
25495
|
+
if (removalRanges.length > 1) {
|
|
25496
|
+
removalRanges.sort((a, b) => b.start - a.start);
|
|
25497
|
+
}
|
|
25410
25498
|
const token = {
|
|
25411
25499
|
components: components2,
|
|
25412
25500
|
deps,
|
package/dist/cli.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkGMCAZZQYcjs = require('./chunk-GMCAZZQY.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkOS76JPG2cjs = require('./chunk-OS76JPG2.cjs');
|
|
@@ -804,7 +804,7 @@ async function generate(options) {
|
|
|
804
804
|
for (const { code, fileName: fileName2 } of files) {
|
|
805
805
|
if (code !== void 0) {
|
|
806
806
|
await _fsextra2.default.outputFile(_pathe2.default.resolve(basepath, fileName2), code, "utf8");
|
|
807
|
-
|
|
807
|
+
_chunkGMCAZZQYcjs.logger_default.success(`${composePath(outDir, fileName2)} \u521B\u5EFA\u6210\u529F\uFF01`);
|
|
808
808
|
}
|
|
809
809
|
}
|
|
810
810
|
}
|
|
@@ -842,7 +842,7 @@ async function readTemplateFile(templatePath, context) {
|
|
|
842
842
|
// src/cli.ts
|
|
843
843
|
var cli = cac("weapp-vite");
|
|
844
844
|
try {
|
|
845
|
-
|
|
845
|
+
_chunkGMCAZZQYcjs.checkRuntime.call(void 0, {
|
|
846
846
|
bun: "0.0.0",
|
|
847
847
|
deno: "0.0.0",
|
|
848
848
|
node: "20.19.0"
|
|
@@ -867,9 +867,9 @@ function logBuildAppFinish(configService) {
|
|
|
867
867
|
args: ["run", "open"]
|
|
868
868
|
}));
|
|
869
869
|
const devCommand = `${command} ${args.join(" ")}`;
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
870
|
+
_chunkGMCAZZQYcjs.logger_default.success("\u5E94\u7528\u6784\u5EFA\u5B8C\u6210\uFF01\u9884\u89C8\u65B9\u5F0F ( `2` \u79CD\u9009\u5176\u4E00\u5373\u53EF)\uFF1A");
|
|
871
|
+
_chunkGMCAZZQYcjs.logger_default.info(`\u6267\u884C \`${devCommand}\` \u53EF\u4EE5\u76F4\u63A5\u5728 \`\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\` \u91CC\u6253\u5F00\u5F53\u524D\u5E94\u7528`);
|
|
872
|
+
_chunkGMCAZZQYcjs.logger_default.info("\u6216\u624B\u52A8\u6253\u5F00\u5FAE\u4FE1\u5F00\u53D1\u8005\u5DE5\u5177\uFF0C\u5BFC\u5165\u6839\u76EE\u5F55(`project.config.json` \u6587\u4EF6\u6240\u5728\u7684\u76EE\u5F55)\uFF0C\u5373\u53EF\u9884\u89C8\u6548\u679C");
|
|
873
873
|
logBuildAppFinishOnlyShowOnce = true;
|
|
874
874
|
}
|
|
875
875
|
}
|
|
@@ -898,7 +898,7 @@ async function openIde() {
|
|
|
898
898
|
try {
|
|
899
899
|
await _weappidecli.parse.call(void 0, ["open", "-p"]);
|
|
900
900
|
} catch (error) {
|
|
901
|
-
|
|
901
|
+
_chunkGMCAZZQYcjs.logger_default.error(error);
|
|
902
902
|
}
|
|
903
903
|
}
|
|
904
904
|
cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, {
|
|
@@ -907,7 +907,7 @@ cli.option("-c, --config <file>", `[string] use specified config file`).option("
|
|
|
907
907
|
cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
|
|
908
908
|
filterDuplicateOptions(options);
|
|
909
909
|
const configFile = resolveConfigFile(options);
|
|
910
|
-
const { buildService, configService } = await
|
|
910
|
+
const { buildService, configService } = await _chunkGMCAZZQYcjs.createCompilerContext.call(void 0, {
|
|
911
911
|
cwd: root,
|
|
912
912
|
mode: _nullishCoalesce(options.mode, () => ( "development")),
|
|
913
913
|
isDev: true,
|
|
@@ -931,7 +931,7 @@ cli.command("build [root]", "build for production").option("--target <target>",
|
|
|
931
931
|
).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--skipNpm", `[boolean] if skip npm build`).option("-o, --open", `[boolean] open ide`).action(async (root, options) => {
|
|
932
932
|
filterDuplicateOptions(options);
|
|
933
933
|
const configFile = resolveConfigFile(options);
|
|
934
|
-
const { buildService, configService } = await
|
|
934
|
+
const { buildService, configService } = await _chunkGMCAZZQYcjs.createCompilerContext.call(void 0, {
|
|
935
935
|
cwd: root,
|
|
936
936
|
mode: _nullishCoalesce(options.mode, () => ( "production")),
|
|
937
937
|
configFile
|
|
@@ -948,7 +948,7 @@ cli.command("init").action(async () => {
|
|
|
948
948
|
command: "weapp-vite"
|
|
949
949
|
});
|
|
950
950
|
} catch (error) {
|
|
951
|
-
|
|
951
|
+
_chunkGMCAZZQYcjs.logger_default.error(error);
|
|
952
952
|
}
|
|
953
953
|
});
|
|
954
954
|
cli.command("open").action(async () => {
|
|
@@ -958,7 +958,7 @@ cli.command("npm").alias("build:npm").alias("build-npm").action(async () => {
|
|
|
958
958
|
try {
|
|
959
959
|
await _weappidecli.parse.call(void 0, ["build-npm", "-p"]);
|
|
960
960
|
} catch (error) {
|
|
961
|
-
|
|
961
|
+
_chunkGMCAZZQYcjs.logger_default.error(error);
|
|
962
962
|
}
|
|
963
963
|
});
|
|
964
964
|
cli.command("g [filepath]", "generate component").alias("generate").option("-a, --app", "type app").option("-p, --page", "type app").option("-n, --name <name>", "filename").action(async (filepath, options) => {
|
|
@@ -973,7 +973,7 @@ cli.command("g [filepath]", "generate component").alias("generate").option("-a,
|
|
|
973
973
|
fileName = "app";
|
|
974
974
|
}
|
|
975
975
|
if (filepath === void 0) {
|
|
976
|
-
|
|
976
|
+
_chunkGMCAZZQYcjs.logger_default.error("weapp-vite generate <outDir> \u547D\u4EE4\u5FC5\u987B\u4F20\u5165\u8DEF\u5F84\u53C2\u6570 outDir");
|
|
977
977
|
return;
|
|
978
978
|
}
|
|
979
979
|
if (options.page) {
|
|
@@ -993,5 +993,5 @@ cli.command("create [outDir]", "create project").option("-t, --template <type>",
|
|
|
993
993
|
await _init.createProject.call(void 0, outDir, options.template);
|
|
994
994
|
});
|
|
995
995
|
cli.help();
|
|
996
|
-
cli.version(
|
|
996
|
+
cli.version(_chunkGMCAZZQYcjs.VERSION);
|
|
997
997
|
cli.parse();
|
package/dist/cli.mjs
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkGMCAZZQYcjs = require('./chunk-GMCAZZQY.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkDVVMF6NDcjs = require('./chunk-DVVMF6ND.cjs');
|
|
@@ -26,4 +26,4 @@ _chunkOS76JPG2cjs.init_cjs_shims.call(void 0, );
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
exports.createCompilerContext =
|
|
29
|
+
exports.createCompilerContext = _chunkGMCAZZQYcjs.createCompilerContext; exports.defineAppJson = _chunkBT7FLFCCcjs.defineAppJson; exports.defineComponentJson = _chunkBT7FLFCCcjs.defineComponentJson; exports.defineConfig = _chunkDVVMF6NDcjs.defineConfig; exports.definePageJson = _chunkBT7FLFCCcjs.definePageJson; exports.defineSitemapJson = _chunkBT7FLFCCcjs.defineSitemapJson; exports.defineThemeJson = _chunkBT7FLFCCcjs.defineThemeJson;
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "weapp-vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.2.
|
|
4
|
+
"version": "5.2.3",
|
|
5
5
|
"description": "weapp-vite 一个现代化的小程序打包工具",
|
|
6
6
|
"author": "ice breaker <1324318532@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -98,13 +98,13 @@
|
|
|
98
98
|
"vite": "npm:rolldown-vite@^7.1.16",
|
|
99
99
|
"vite-tsconfig-paths": "^5.1.4",
|
|
100
100
|
"@weapp-core/init": "3.0.1",
|
|
101
|
-
"@weapp-core/logger": "2.0.0",
|
|
102
101
|
"@weapp-core/schematics": "4.0.0",
|
|
103
|
-
"@weapp-
|
|
102
|
+
"@weapp-core/logger": "2.0.0",
|
|
104
103
|
"@weapp-core/shared": "2.0.1",
|
|
104
|
+
"@weapp-vite/volar": "0.0.1",
|
|
105
105
|
"rolldown-require": "1.0.3",
|
|
106
|
-
"
|
|
107
|
-
"
|
|
106
|
+
"vite-plugin-performance": "1.0.0",
|
|
107
|
+
"weapp-ide-cli": "4.0.0"
|
|
108
108
|
},
|
|
109
109
|
"publishConfig": {
|
|
110
110
|
"access": "public",
|