weapp-vite 6.7.6 → 6.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-routes.mjs +7 -7
- package/dist/{chunk-W3UG2WZQ.mjs → chunk-3BOPS2AF.mjs} +1 -1
- package/dist/{chunk-XQYQD5CM.mjs → chunk-6N2JYDJN.mjs} +1 -1
- package/dist/{chunk-6AH5XOPG.mjs → chunk-BKU4KQJE.mjs} +18 -14
- package/dist/{chunk-QD76G22N.mjs → chunk-EZOXN44U.mjs} +2 -2
- package/dist/{chunk-O2IN5LBB.mjs → chunk-FXWNWYDN.mjs} +1 -1
- package/dist/{chunk-ZHLTHMZA.mjs → chunk-GJOF3MJY.mjs} +1305 -938
- package/dist/{chunk-XSPLO6IT.mjs → chunk-JFV2DERD.mjs} +3 -6
- package/dist/{chunk-6YAZCQOZ.mjs → chunk-LDBSARE6.mjs} +2 -2
- package/dist/{chunk-XIEFUUA5.mjs → chunk-MIQZQK74.mjs} +1 -1
- package/dist/{chunk-BGBLJUWD.mjs → chunk-OU5WM7WT.mjs} +1 -1
- package/dist/{chunk-KV5GZOAZ.mjs → chunk-X4YQFGKK.mjs} +1 -1
- package/dist/cli.mjs +92 -8
- package/dist/{config-BngmcXkt.d.ts → config-D8v221vL.d.ts} +244 -671
- package/dist/config.d.ts +5 -5
- package/dist/config.mjs +4 -4
- package/dist/{file-OMYHHYLC.mjs → file-W4JJII65.mjs} +2 -2
- package/dist/{getInstance-W5DSUGSZ.mjs → getInstance-W65F2IS7.mjs} +5 -5
- package/dist/index.d.ts +6 -6
- package/dist/index.mjs +10 -10
- package/dist/json.d.ts +5 -5
- package/dist/json.mjs +2 -2
- package/dist/mcp.d.ts +5 -5
- package/dist/mcp.mjs +3 -3
- package/dist/runtime.mjs +2 -2
- package/dist/types.d.ts +4 -4
- package/dist/types.mjs +14 -2
- package/dist/volar.mjs +1 -1
- package/package.json +12 -12
|
@@ -2,10 +2,10 @@ import {
|
|
|
2
2
|
getCompilerContext,
|
|
3
3
|
resetCompilerContext,
|
|
4
4
|
setActiveCompilerContextKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-GJOF3MJY.mjs";
|
|
6
6
|
import {
|
|
7
7
|
init_esm_shims
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-EZOXN44U.mjs";
|
|
9
9
|
|
|
10
10
|
// src/createContext.ts
|
|
11
11
|
init_esm_shims();
|
|
@@ -16,11 +16,8 @@ async function createCompilerContext(options) {
|
|
|
16
16
|
}
|
|
17
17
|
setActiveCompilerContextKey(key);
|
|
18
18
|
const ctx = getCompilerContext(key);
|
|
19
|
-
const { configService, scanService
|
|
19
|
+
const { configService, scanService } = ctx;
|
|
20
20
|
await configService.load(options);
|
|
21
|
-
if (autoRoutesService) {
|
|
22
|
-
await autoRoutesService.ensureFresh();
|
|
23
|
-
}
|
|
24
21
|
try {
|
|
25
22
|
await scanService.loadAppEntry();
|
|
26
23
|
} catch {
|
package/dist/cli.mjs
CHANGED
|
@@ -1,33 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCompilerContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-JFV2DERD.mjs";
|
|
4
4
|
import {
|
|
5
5
|
DEFAULT_MP_PLATFORM,
|
|
6
6
|
SHARED_CHUNK_VIRTUAL_PREFIX,
|
|
7
7
|
checkRuntime,
|
|
8
8
|
createCjsConfigLoadError,
|
|
9
9
|
createSharedBuildConfig,
|
|
10
|
+
formatBytes,
|
|
10
11
|
getProjectConfigFileName,
|
|
11
12
|
isPathInside,
|
|
12
13
|
normalizeMiniPlatform,
|
|
13
14
|
resolveMiniPlatform,
|
|
14
15
|
resolveWeappConfigFile
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-GJOF3MJY.mjs";
|
|
16
17
|
import {
|
|
17
18
|
VERSION
|
|
18
|
-
} from "./chunk-
|
|
19
|
-
import "./chunk-
|
|
19
|
+
} from "./chunk-BKU4KQJE.mjs";
|
|
20
|
+
import "./chunk-OU5WM7WT.mjs";
|
|
20
21
|
import {
|
|
21
22
|
resolveWeappMcpConfig,
|
|
22
23
|
startWeappViteMcpServer
|
|
23
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-LDBSARE6.mjs";
|
|
24
25
|
import {
|
|
25
26
|
colors,
|
|
26
27
|
default as default2
|
|
27
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-MIQZQK74.mjs";
|
|
28
29
|
import {
|
|
29
30
|
init_esm_shims
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-EZOXN44U.mjs";
|
|
31
32
|
|
|
32
33
|
// src/cli.ts
|
|
33
34
|
init_esm_shims();
|
|
@@ -1730,6 +1731,82 @@ function logBuildAppFinish(configService, webServer, options = {}) {
|
|
|
1730
1731
|
logBuildAppFinishOnlyShowOnce = true;
|
|
1731
1732
|
}
|
|
1732
1733
|
|
|
1734
|
+
// src/cli/logBuildPackageSizeReport.ts
|
|
1735
|
+
init_esm_shims();
|
|
1736
|
+
import { Buffer as Buffer2 } from "buffer";
|
|
1737
|
+
var DEFAULT_PACKAGE_SIZE_WARNING_BYTES = 2 * 1024 * 1024;
|
|
1738
|
+
var WINDOWS_SEPARATOR_RE = /\\/g;
|
|
1739
|
+
function normalizeFileName(fileName) {
|
|
1740
|
+
return fileName.replace(WINDOWS_SEPARATOR_RE, "/");
|
|
1741
|
+
}
|
|
1742
|
+
function getOutputItemBytes(item) {
|
|
1743
|
+
if (item.type === "chunk") {
|
|
1744
|
+
return typeof item.code === "string" ? Buffer2.byteLength(item.code, "utf8") : 0;
|
|
1745
|
+
}
|
|
1746
|
+
if (typeof item.source === "string") {
|
|
1747
|
+
return Buffer2.byteLength(item.source, "utf8");
|
|
1748
|
+
}
|
|
1749
|
+
if (item.source instanceof Uint8Array) {
|
|
1750
|
+
return item.source.byteLength;
|
|
1751
|
+
}
|
|
1752
|
+
return 0;
|
|
1753
|
+
}
|
|
1754
|
+
function resolveSubPackageRoot(fileName, roots) {
|
|
1755
|
+
const normalized = normalizeFileName(fileName);
|
|
1756
|
+
return roots.find((root) => normalized === root || normalized.startsWith(`${root}/`));
|
|
1757
|
+
}
|
|
1758
|
+
function collectPackageSizeReports(output, subPackageMap) {
|
|
1759
|
+
const outputs = Array.isArray(output) ? output : [output];
|
|
1760
|
+
const roots = [...subPackageMap?.keys() ?? []].filter(Boolean).sort((a, b) => b.length - a.length || a.localeCompare(b));
|
|
1761
|
+
const packageBytes = /* @__PURE__ */ new Map([["__main__", 0]]);
|
|
1762
|
+
for (const root of roots) {
|
|
1763
|
+
packageBytes.set(root, 0);
|
|
1764
|
+
}
|
|
1765
|
+
for (const current of outputs) {
|
|
1766
|
+
for (const item of current.output ?? []) {
|
|
1767
|
+
const root = resolveSubPackageRoot(item.fileName, roots) ?? "__main__";
|
|
1768
|
+
packageBytes.set(root, (packageBytes.get(root) ?? 0) + getOutputItemBytes(item));
|
|
1769
|
+
}
|
|
1770
|
+
}
|
|
1771
|
+
const reports = [
|
|
1772
|
+
{
|
|
1773
|
+
root: "__main__",
|
|
1774
|
+
label: "\u4E3B\u5305",
|
|
1775
|
+
bytes: packageBytes.get("__main__") ?? 0
|
|
1776
|
+
}
|
|
1777
|
+
];
|
|
1778
|
+
for (const root of roots) {
|
|
1779
|
+
const meta = subPackageMap?.get(root);
|
|
1780
|
+
const isIndependent = Boolean(meta?.subPackage.independent);
|
|
1781
|
+
reports.push({
|
|
1782
|
+
root,
|
|
1783
|
+
label: `${isIndependent ? "\u72EC\u7ACB\u5206\u5305" : "\u5206\u5305"} ${root}`,
|
|
1784
|
+
bytes: packageBytes.get(root) ?? 0
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
return reports;
|
|
1788
|
+
}
|
|
1789
|
+
function logBuildPackageSizeReport(options) {
|
|
1790
|
+
const warningBytes = Number(options.warningBytes ?? DEFAULT_PACKAGE_SIZE_WARNING_BYTES);
|
|
1791
|
+
const reports = collectPackageSizeReports(options.output, options.subPackageMap);
|
|
1792
|
+
default2.success("\u4E3B\u5305/\u5206\u5305\u4F53\u79EF\u62A5\u544A\uFF1A");
|
|
1793
|
+
for (const report of reports) {
|
|
1794
|
+
default2.info(`${report.label}\uFF1A${formatBytes(report.bytes)}`);
|
|
1795
|
+
}
|
|
1796
|
+
const shouldWarn = Number.isFinite(warningBytes) && warningBytes > 0;
|
|
1797
|
+
if (!shouldWarn) {
|
|
1798
|
+
return;
|
|
1799
|
+
}
|
|
1800
|
+
for (const report of reports) {
|
|
1801
|
+
if (report.bytes <= warningBytes) {
|
|
1802
|
+
continue;
|
|
1803
|
+
}
|
|
1804
|
+
default2.warn(
|
|
1805
|
+
`[\u5305\u4F53\u79EF] ${colors.yellow(report.label)} \u4F53\u79EF ${colors.yellow(formatBytes(report.bytes))}\uFF0C\u5DF2\u8D85\u8FC7\u9608\u503C ${colors.yellow(formatBytes(warningBytes))}\u3002`
|
|
1806
|
+
);
|
|
1807
|
+
}
|
|
1808
|
+
}
|
|
1809
|
+
|
|
1733
1810
|
// src/cli/openIde.ts
|
|
1734
1811
|
init_esm_shims();
|
|
1735
1812
|
import path4 from "pathe";
|
|
@@ -1814,7 +1891,14 @@ function registerBuildCommand(cli2) {
|
|
|
1814
1891
|
const enableAnalyze = Boolean(options.analyze && targets.runMini);
|
|
1815
1892
|
let analyzeHandle;
|
|
1816
1893
|
if (targets.runMini) {
|
|
1817
|
-
await buildService.build(options);
|
|
1894
|
+
const output = await buildService.build(options);
|
|
1895
|
+
if (!Array.isArray(output) && "output" in output) {
|
|
1896
|
+
logBuildPackageSizeReport({
|
|
1897
|
+
output,
|
|
1898
|
+
subPackageMap: ctx.scanService?.subPackageMap,
|
|
1899
|
+
warningBytes: configService.weappViteConfig.packageSizeWarningBytes
|
|
1900
|
+
});
|
|
1901
|
+
}
|
|
1818
1902
|
if (enableAnalyze) {
|
|
1819
1903
|
const analyzeResult = await analyzeSubpackages(ctx);
|
|
1820
1904
|
analyzeHandle = await startAnalyzeDashboard(analyzeResult, { watch: true }) ?? void 0;
|