weapp-vite 7.6.0 → 7.7.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/README.md +6 -4
- package/THIRD_PARTY_NOTICES.md +3 -3
- package/bin/bootstrap.js +9 -4
- package/bin/bootstrap.test.ts +82 -1
- package/bin/nodeVersionWarning.js +17 -0
- package/bin/nodeVersionWarning.test.ts +30 -0
- package/dist/{action-B3YZMA-h.mjs → action-BD56SQh4.mjs} +7 -8
- package/dist/{action-DlC6JYpt.mjs → action-CPtgEl6p.mjs} +9 -10
- package/dist/{action-BOk3vGI7.mjs → action-le0bNff_.mjs} +22 -30
- package/dist/{action-BELcDNNv.mjs → action-ytG5oFAw.mjs} +5 -6
- package/dist/{action-zEDY7oh_.mjs → action-zmJrU8PC.mjs} +11 -13
- package/dist/{analyze-DN79YOAH.mjs → analyze-DCZo-sJd.mjs} +3 -6
- package/dist/{artifacts-BOyC9Fy-.mjs → artifacts-TrTX9_jj.mjs} +2 -4
- package/dist/{assets-C5_YYXNk.mjs → assets-XyhpYtGl.mjs} +11 -18
- package/dist/auto-import-components/resolvers.d.mts +1 -1
- package/dist/auto-import-components/resolvers.mjs +1 -1
- package/dist/auto-import-presets/wevu-router.d.mts +1 -1
- package/dist/auto-import-presets/wevu-router.mjs +1 -1
- package/dist/auto-import-presets/wevu.d.mts +1 -1
- package/dist/auto-import-presets/wevu.mjs +1 -1
- package/dist/auto-import-presets.d.mts +2 -2
- package/dist/auto-import-presets.mjs +2 -2
- package/dist/auto-routes.d.mts +1 -3
- package/dist/auto-routes.mjs +3 -4
- package/dist/{budget-CTLOHwgI.d.mts → budget-DTPngJU0.d.mts} +1 -9
- package/dist/{budget-EOeEycc_.mjs → budget-_Mu-4GKn.mjs} +2 -4
- package/dist/{builtProject-C29udgXY.mjs → builtProject-B145uOt5.mjs} +11 -18
- package/dist/{classifier-DBJY__kg.mjs → classifier-CNTJOYQL.mjs} +4 -5
- package/dist/cli-acceptance.mjs +3 -4
- package/dist/cli.mjs +55 -86
- package/dist/{config-DRGcCi3h.mjs → config-59ZWhCIf.mjs} +1 -2
- package/dist/{config-Bf6DWhyb.d.mts → config-BNx2BODw.d.mts} +13 -105
- package/dist/config.d.mts +2 -2
- package/dist/config.mjs +3 -3
- package/dist/{constants-DEZdcsMn.mjs → constants-BOe8mgqL.mjs} +2 -4
- package/dist/{createCompilerContextInstance-aYwi8wQt.mjs → createCompilerContextInstance-BXSdH2E8.mjs} +1710 -1511
- package/dist/{createContext-tApLtII-.mjs → createContext-W0TeXxbo.mjs} +3 -4
- package/dist/dashboard/analyze.d.mts +1 -7
- package/dist/dashboard/analyze.mjs +2 -2
- package/dist/dashboard/vite.d.mts +2 -4
- package/dist/dashboard/vite.mjs +1 -2
- package/dist/dashboard.d.mts +2 -2
- package/dist/dashboard.mjs +20 -36
- package/dist/{dashboardTransport-C_Y6jMp-.mjs → dashboardTransport-C9290QgS.mjs} +1 -2
- package/dist/{dashboardViteBridge-DCGR43aM.mjs → dashboardViteBridge-B7QgQo94.mjs} +4 -7
- package/dist/{dev-C2fgr_Xd.mjs → dev-D1QSExwk.mjs} +2 -3
- package/dist/devProvider-Bcvz5nu4.mjs +4966 -0
- package/dist/docs/README.md +6 -4
- package/dist/docs/ai-workflows.md +2 -0
- package/dist/docs/mcp.md +1 -1
- package/dist/docs/troubleshooting.md +8 -0
- package/dist/docs/weapp-config.md +29 -0
- package/dist/docs/wevu-authoring.md +2 -0
- package/dist/doctor-worker.mjs +5 -6
- package/dist/doctor.d.mts +2 -8
- package/dist/doctor.mjs +16 -25
- package/dist/{engine-C66J0HLz.mjs → engine-Mnnm_ALP.mjs} +1 -2
- package/dist/file-5eEfbK60.mjs +1 -0
- package/dist/{file-CcIOmqhC.mjs → file-D8mp5GmB.mjs} +6 -10
- package/dist/{files-BqxFIPRp.mjs → files-Cy9jURJu.mjs} +1 -2
- package/dist/{forwardConsole-B0Reo8Lf.mjs → forwardConsole-D2Q0RIqc.mjs} +5 -7
- package/dist/getInstance-BXNVH7sU.mjs +1 -0
- package/dist/{getInstance-Dt9IQDKr.mjs → getInstance-DfNlbr-X.mjs} +2 -3
- package/dist/{history-BIiRCzbq.mjs → history-dKxzoHmN.mjs} +18 -28
- package/dist/i18n.d.mts +1 -3
- package/dist/i18n.mjs +1 -2
- package/dist/{index-D5rgBzYZ.d.mts → index-DIZJRrvK.d.mts} +1 -23
- package/dist/{index-CaXAtb9e.d.mts → index-SnaW3cvA.d.mts} +0 -12
- package/dist/index.d.mts +3 -7
- package/dist/index.mjs +6 -6
- package/dist/{json-BL8Dhhk6.mjs → json-Cvon2mw5.mjs} +1 -2
- package/dist/json.d.mts +1 -1
- package/dist/json.mjs +1 -1
- package/dist/{lib-DjccSI1B.mjs → lib-CJyMBzoe.mjs} +5 -8
- package/dist/{lifecycle-C36WSbQS.mjs → lifecycle-CUo8PMQc.mjs} +3 -6
- package/dist/{loadConfig-BWIsDXR4.mjs → loadConfig-CKIdfW4o.mjs} +2 -3
- package/dist/loadConfig-D4WGJcYp.mjs +1 -0
- package/dist/{logBuildAppFinish-ChjwATMv.mjs → logBuildAppFinish-DOBoof6S.mjs} +4 -7
- package/dist/{mcp-CYgX9HpO.mjs → mcp-D88QvQgG.mjs} +3 -5
- package/dist/{mcp-Cj8Maqo6.mjs → mcp-ovJgl1N9.mjs} +2 -4
- package/dist/mcp.d.mts +1 -3
- package/dist/mcp.mjs +1 -1
- package/dist/{mcpClient-DVLvFLZv.mjs → mcpClient-C8JzVZ46.mjs} +4 -8
- package/dist/{metadata-hwF7QRcS.mjs → metadata-HlDKtlsu.mjs} +1 -2
- package/dist/{nodeEnv-BmH8UZPR.mjs → nodeEnv-zq1EymWj.mjs} +1 -2
- package/dist/{openIde-CroqOgk5.mjs → openIde-QoYKhuuM.mjs} +8 -13
- package/dist/{options-jqFwfD1G.mjs → options-Cz8vZ-0w.mjs} +1 -2
- package/dist/{chunkStrategy-DY_LZIIe.mjs → package-DR62fAzP.mjs} +20 -31
- package/dist/{path-CYYIQGS7.mjs → path-E1OjBJAl.mjs} +1 -2
- package/dist/{platform-CnkySBKz.mjs → platform-BiMpsZIb.mjs} +1 -2
- package/dist/{pluginHost--CaeyWpA.mjs → pluginHost-vn8Vty1J.mjs} +1 -2
- package/dist/{processCleanup-BQn2kTcK.mjs → processCleanup-DzB64WI8.mjs} +1 -2
- package/dist/{protocol-Cg6Jdlvb.mjs → protocol-HiSJRrSO.mjs} +2 -3
- package/dist/{reader-sh_POQ9-.mjs → reader-wzPH_W8A.mjs} +1 -2
- package/dist/{realpathScope-Tf9mz-fh.mjs → realpathScope-DwlLaCk3.mjs} +1 -2
- package/dist/{report-hyonPGbZ.mjs → report-PJVyo-UZ.mjs} +2 -4
- package/dist/{resolvedId-CiDl7SC1.mjs → resolvedId-DaxPh_yV.mjs} +2 -4
- package/dist/{resolvers-Dod-euqX.mjs → resolvers-CKYqmRD_.mjs} +10 -20
- package/dist/resolvers.d.mts +1 -1
- package/dist/resolvers.mjs +1 -1
- package/dist/{routes-C7fCmf92.d.mts → routes-DvAFX29h.d.mts} +0 -2
- package/dist/{runtime-DpVf714f.d.mts → runtime-BL4RjBRa.d.mts} +0 -8
- package/dist/{runtime-CLUhQsdA.mjs → runtime-CKtMVERT.mjs} +2 -3
- package/dist/{runtime-D6VCNhNY.mjs → runtime-DDUCb7pP.mjs} +4 -8
- package/dist/runtime.d.mts +1 -1
- package/dist/runtime.mjs +1 -1
- package/dist/{schematics-kO26eQRT.mjs → schematics-DikfOjMD.mjs} +1 -2
- package/dist/{session-D3zsdzIy.mjs → session-COrQJYif.mjs} +16 -18
- package/dist/test.d.mts +1 -3
- package/dist/test.mjs +50 -28
- package/dist/{types-D0FFexRF.d.mts → types-BK2EQ3Jm.d.mts} +0 -2
- package/dist/{types-D-kfuyVa.d.mts → types-e2BMP9NU.d.mts} +0 -2
- package/dist/types.d.mts +4 -4
- package/dist/{upload-DozK8UdN.mjs → upload-Chal5b3w.mjs} +11 -21
- package/dist/upload-worker.mjs +3 -5
- package/dist/{utils-Dy51PYAC.mjs → utils-CTGSZp4j.mjs} +20 -34
- package/dist/vite.d.mts +2 -4
- package/dist/vite.mjs +9 -14
- package/dist/volar.mjs +1 -2
- package/dist/{wevu-BQWUU7br.mjs → wevu-BaihCXO9.mjs} +1 -2
- package/dist/wevu-DTtSOyxB.d.mts +3 -0
- package/dist/{wevu-router-Dg1LnBlg.mjs → wevu-router-BIoxDbnu.mjs} +1 -2
- package/dist/wevu-router-CdWurGQ4.d.mts +3 -0
- package/dist/wxs-7V7MPzeW.mjs +1 -0
- package/dist/{wxs-BT8btflA.mjs → wxs-BdHHXltv.mjs} +2 -4
- package/package.json +46 -43
- package/dist/devProvider-D-hTfsEO.mjs +0 -3027
- package/dist/file-DtcteQ4G.mjs +0 -1
- package/dist/getInstance-BAIaU2y9.mjs +0 -1
- package/dist/loadConfig-D-BpBgsk.mjs +0 -1
- package/dist/package-Cmakyy3J.mjs +0 -4
- package/dist/wevu-C4KEC5kO.d.mts +0 -5
- package/dist/wevu-router-Cg2sIkIE.d.mts +0 -5
- package/dist/wxs-Z4VQDeJ_.mjs +0 -1
package/dist/docs/README.md
CHANGED
|
@@ -16,13 +16,15 @@
|
|
|
16
16
|
|
|
17
17
|
## Node.js 支持范围
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
框架及编译依赖链的官方支持范围为 `^22.23.4 || ^24.22.1 || >=26.12.1`:Node 22 至少 22.23.4、Node 24 至少 24.22.1,或 Node 26.12.1 及以上版本。Node 20、23、25 及低于上述最低版本的环境不在官方支持范围内。
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
CLI(含 `prepare`)与 Tailwind 集成发现实际 Node 版本超出该范围时,会提示升级并继续尝试执行,不会仅因版本号退出。旧版 Node 若缺少依赖所需的语法或 API,仍可能导致加载或执行失败;直接通过 Vite 或程序 API 消费时也受实际依赖兼容性限制。
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
建议升级至受支持 LTS 分支的最新安全补丁版本,再安装或更新依赖。包的 `engines.node` 声明保持不变;如果项目或团队启用了严格 engines 校验,包管理器仍可能拒绝安装。
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
`create-weapp-vite` 与框架采用相同的 Node 支持范围;Vite+ 模板要求 `^24.22.1 || >=26.12.1`。
|
|
26
|
+
|
|
27
|
+
发布候选在构建环境中打包,再在独立临时消费者中以严格 engines/peer 校验安装;CI 覆盖 Linux、Windows、macOS 的 Node 22.23.4、24.22.1、26.12.1 及 22/24 当前补丁版本,验证原生和 SFC 构建、prepare 与公开类型。
|
|
26
28
|
|
|
27
29
|
## 普通 Vite 与 Vite+
|
|
28
30
|
|
|
@@ -28,6 +28,8 @@
|
|
|
28
28
|
|
|
29
29
|
微信不同运行时版本不能统一假定存在 `queueMicrotask`。业务代码应通过共享 ESLint 配置统一接入 `@weapp-vite/eslint` 的 `miniProgramRuntimeRecommended`,模板不要单独增加 workspace 依赖;框架代码应使用显式兼容层,需要 request globals 时明确配置 `weapp.appPrelude.webRuntime`。
|
|
30
30
|
|
|
31
|
+
SSE 任务先读 [本地 Web Runtime 配置](./weapp-config.md#apppreludewebruntime),区分 Fetch 的项目级 `networkDefaults.request.enableChunked: true` 与 EventSource 自动分块。不要因存在 `onChunkReceived`、类型声明或 headless 通过就承诺微信流式兼容:还需真实宿主在响应结束前提供真实状态码,并验证服务端保持连接时页面已经显示首条消息。缺少能力时必须保留 `NotSupportedError`,不能假定 200 或静默退回缓冲。第三方解析器在模块初始化时读取 Streams 构造器的问题应检查最终 prelude 与 chunk 绑定;Wevu 清理应在同步 setup 中注册 `onUnload`。示例与边界见 [Web SSE 指南](https://vite.weapp.dev/guide/web-runtime-globals.html#复用-web-sse-写法)。
|
|
32
|
+
|
|
31
33
|
## Rust / Native 加速约束
|
|
32
34
|
|
|
33
35
|
当任务涉及 `@weapp-vite/ast-native`、Rust 插件或 native AST 加速时,先把 JS 与 Rust 的通信次数当作主要性能约束之一。
|
package/dist/docs/mcp.md
CHANGED
|
@@ -391,7 +391,7 @@ MCP 服务端做了以下约束:
|
|
|
391
391
|
|
|
392
392
|
1. `wv mcp init <client>` 写入失败:先确认目标配置文件可写。
|
|
393
393
|
2. `wv mcp doctor <client>` 失败:优先看配置文件里是否已经生成 `weapp-vite-*` server 条目。
|
|
394
|
-
3. `weapp-vite mcp`
|
|
394
|
+
3. `weapp-vite mcp` 启动失败:先查看具体的依赖加载或执行错误。Node 版本超出 `^22.23.4 || ^24.22.1 || >=26.12.1` 时,CLI 会提示升级并继续执行;建议升级至受支持 LTS 分支的最新安全补丁版本,避免旧版 Node 缺少依赖所需的语法或 API。
|
|
395
395
|
4. AI 看不到包内容:检查 `--workspace-root` 是否指向正确仓库根目录。
|
|
396
396
|
5. 命令执行失败:确认命令在白名单中,并检查子目录权限与脚本名是否存在。
|
|
397
397
|
|
|
@@ -14,6 +14,14 @@
|
|
|
14
14
|
weapp-vite prepare
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
## classic IDE 配置租约阻塞 `dev`
|
|
18
|
+
|
|
19
|
+
微信小程序的 classic 开发模式会暂时将 `project.private.config.json` 的 `setting.compileHotReLoad` 设为 `false`,并在其同级 `.weapp-vite/ide-classic-project.private.config.json` 保存租约和原始配置。正常退出会恢复该开关;进程被强杀或崩溃后,下次启动会在确认租约持有进程已退出时自动恢复并重新接管,同时保留用户对其他配置的修改。多平台项目以实际生成的 private 配置位置为准。
|
|
20
|
+
|
|
21
|
+
另一个开发命令仍在运行时会报告占用信息。旧版无进程信息、内容损坏或无法确认进程状态的租约会保留并提示恢复,不会直接覆盖配置或删除记录。
|
|
22
|
+
|
|
23
|
+
人工恢复前,先根据错误中的项目、进程和文件信息确认该项目的所有开发命令均已退出,并备份当前 private 配置和对应租约。参考租约中可读取的 `original` 恢复 `setting.compileHotReLoad` 的原值或原先不存在的状态,保留其他用户修改;原文缺失或损坏时,从自己的备份或版本记录确认原值。完成配置恢复后,仅将错误中指出的该项目 classic 租约及互斥记录移到备份位置,再运行 `weapp-vite dev`。无法确认进程状态或原配置时保留现场;不要删除整个 `.weapp-vite` 目录或其他项目、IDE 自动化会话的记录。
|
|
24
|
+
|
|
17
25
|
## AI 截图失败
|
|
18
26
|
|
|
19
27
|
优先检查:
|
|
@@ -534,6 +534,35 @@ export default defineConfig({
|
|
|
534
534
|
|
|
535
535
|
不要在 `srcRoot`、路由来源、分包边界都没确认前就先调 chunk 策略。
|
|
536
536
|
|
|
537
|
+
### `appPrelude.webRuntime`
|
|
538
|
+
|
|
539
|
+
小程序中的 Web API 兼容对象通过 `weapp.appPrelude.webRuntime` 注入;它与浏览器预览使用的 `weapp.web` 分别配置。`targets` 支持 Fetch、三个 Web Streams 构造器、`TextDecoderStream` 和 `EventSource` 等目标,并自动补齐相关依赖。Streams 构造器作为一组选择,保留可用的原生实现,否则使用 `web-streams-polyfill@4.3.0` ponyfill。
|
|
540
|
+
|
|
541
|
+
Fetch 网络增量交付需要项目级启用分块;普通缓冲请求继续可用:
|
|
542
|
+
|
|
543
|
+
```ts
|
|
544
|
+
export default defineConfig({
|
|
545
|
+
weapp: {
|
|
546
|
+
appPrelude: {
|
|
547
|
+
webRuntime: {
|
|
548
|
+
enabled: true,
|
|
549
|
+
networkDefaults: { request: { enableChunked: true } },
|
|
550
|
+
},
|
|
551
|
+
},
|
|
552
|
+
},
|
|
553
|
+
})
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
业务可使用 `response.body.pipeThrough(new TextDecoderStream()).getReader()`,也可单独安装 `eventsource-parser` 接入其 `/stream` 解析器。构建器识别该依赖,并在第三方模块求值前提供构造器及 chunk 内局部绑定;不能等依赖初始化后才安装 `TransformStream`。
|
|
557
|
+
|
|
558
|
+
全局 `EventSource` 自动开启分块,使用标准 GET 接口、事件监听和重连;POST、自定义鉴权头通过 Fetch,Fetch 本身不自动重试。`wevu/fetch` 复用 `@wevu/web-apis` 的同一实现;独立消费可使用 `@wevu/web-apis/streams` 和 `@wevu/web-apis/eventsource` 子入口。
|
|
559
|
+
|
|
560
|
+
微信流式传输要求宿主支持 chunk 监听,并在响应结束前提供真实 HTTP 状态码。缺少能力时以 `NotSupportedError` 明确失败,不推断 HTTP 200、不退回完整响应缓冲;EventSource 在此情况下触发 error 并关闭。Response 返回后仍需处理 body 读取失败,`AbortSignal` 和 reader 取消会传递到底层请求。
|
|
561
|
+
|
|
562
|
+
首版不模拟浏览器 Cookie/CORS,`EventSource` 的 `withCredentials: true` 不受支持;不提供流式上传、`Blob.stream()` 或网络级反压保证。慢消费和不读取的 clone 分支可能增加内存;不通过静默丢块限制队列。开发者工具、真机和其他平台必须分别验证,小程序域名白名单、TLS、后台运行与超时仍由宿主管理。
|
|
563
|
+
|
|
564
|
+
完整目标与配置见 [Web Runtime 全局对象注入配置](https://vite.weapp.dev/config/web-runtime-globals.html),消费和卸载示例见 [复用 Web SSE 写法](https://vite.weapp.dev/guide/web-runtime-globals.html#复用-web-sse-写法)。
|
|
565
|
+
|
|
537
566
|
### `web`
|
|
538
567
|
|
|
539
568
|
Web 重新扫描项目期间,已扫描 Vue SFC 的模板、样式与脚本继续使用上一次成功扫描的完整快照。扫描成功后才切换到新版本;扫描失败会保留旧快照并报告错误,修复后可继续更新。同一文件的正斜杠与反斜杠路径共用缓存,不会混入尚未发布的磁盘内容。
|
|
@@ -37,6 +37,8 @@ else if (import.meta.env.PLATFORM === 'web') {
|
|
|
37
37
|
|
|
38
38
|
这类写法通常会导致时序错误或生命周期不触发。
|
|
39
39
|
|
|
40
|
+
Fetch SSE 与 EventSource 也由页面持有:在同步 `setup()` 中注册 `onUnload`,回调调用 `controller.abort()` 或 `source.close()`,不能等请求 `await` 后才注册。Response 返回后,body 流仍可能失败或被取消;reader 使用结束时释放锁,并在异常路径中止活动请求。不要将 controller、reader 或 EventSource 放进可序列化模板状态,也不要假定 `onHide` 等同于页面卸载。`wevu/fetch` 复用 `@wevu/web-apis`,项目配置和严格宿主边界见 [本地 Web Runtime 配置](./weapp-config.md#apppreludewebruntime),完整示例见 [Wevu Fetch SSE](https://vite.weapp.dev/wevu/fetch.html#sse-与响应流)。
|
|
41
|
+
|
|
40
42
|
## performance 预设与 setData 诊断
|
|
41
43
|
|
|
42
44
|
`weapp.wevu.preset: 'performance'` 为 app/component 注入 `setData.strategy: 'patch'`、`suspendWhenHidden: true`、`diagnostics: 'fallback'` 和开发态 `highFrequencyWarning`,并默认启用 `autoSetDataPick`。`weapp.wevu.defaults` 的同名字段覆盖预设;`autoSetDataPick` 的显式布尔值也优先。
|
package/dist/doctor-worker.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as createCompilerContext } from "./createContext-
|
|
2
|
-
import { n as resolveAnalyzeBudgets } from "./metadata-
|
|
3
|
-
import { r as readDoctorFiles } from "./files-
|
|
4
|
-
import { t as terminateStaleSassEmbeddedProcess } from "./processCleanup-
|
|
1
|
+
import { t as createCompilerContext } from "./createContext-W0TeXxbo.mjs";
|
|
2
|
+
import { n as resolveAnalyzeBudgets } from "./metadata-HlDKtlsu.mjs";
|
|
3
|
+
import { r as readDoctorFiles } from "./files-Cy9jURJu.mjs";
|
|
4
|
+
import { t as terminateStaleSassEmbeddedProcess } from "./processCleanup-DzB64WI8.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { randomUUID } from "node:crypto";
|
|
8
|
-
|
|
8
|
+
// src/doctor/buildWorker.ts
|
|
9
9
|
process.once("message", async (options) => {
|
|
10
10
|
try {
|
|
11
11
|
const outputRoot = path.join(options.cwd, ".weapp-vite", "doctor", options.target, randomUUID());
|
|
@@ -56,5 +56,4 @@ process.once("message", async (options) => {
|
|
|
56
56
|
process.exit(2);
|
|
57
57
|
}
|
|
58
58
|
});
|
|
59
|
-
//#endregion
|
|
60
59
|
export {};
|
package/dist/doctor.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { Yn as MpPlatform } from "./config-
|
|
2
|
-
import { i as AnalyzeBudgetConfig } from "./budget-
|
|
1
|
+
import { Yn as MpPlatform } from "./config-BNx2BODw.mjs";
|
|
2
|
+
import { i as AnalyzeBudgetConfig } from "./budget-DTPngJU0.mjs";
|
|
3
3
|
import { OperationDiagnostics } from "@weapp-vite/miniprogram-automator";
|
|
4
|
-
//#region src/doctor/types.d.ts
|
|
5
4
|
type DoctorLayer = 'project' | 'source' | 'artifact' | 'runtime';
|
|
6
5
|
interface DoctorCoverage {
|
|
7
6
|
target: string;
|
|
@@ -133,12 +132,7 @@ interface DoctorAdapters {
|
|
|
133
132
|
build: (options: DoctorOptions, target: MpPlatform) => Promise<DoctorArtifactSnapshot>;
|
|
134
133
|
runtime: (cwd: string, target: MpPlatform, port?: number, options?: DoctorRuntimeProbeOptions) => Promise<DoctorRuntimeEvidence>;
|
|
135
134
|
}
|
|
136
|
-
//#endregion
|
|
137
|
-
//#region src/doctor/report.d.ts
|
|
138
135
|
export declare function formatDoctorReport(report: DoctorReport, format?: 'terminal' | 'json' | 'sarif'): string;
|
|
139
|
-
//#endregion
|
|
140
|
-
//#region src/doctor/index.d.ts
|
|
141
136
|
/** 分层收集事实;静态路径永不调用配置加载器、构建或宿主连接。 */
|
|
142
137
|
export declare function runDoctor(options?: DoctorOptions, adapters?: Partial<DoctorAdapters>): Promise<DoctorReport>;
|
|
143
|
-
//#endregion
|
|
144
138
|
export type { DoctorAdapters, DoctorArtifactSnapshot, DoctorCoverage, DoctorDiagnostic, DoctorFile, DoctorLayer, DoctorOptions, DoctorReport, DoctorRuntimeBundle, DoctorRuntimeEvidence, DoctorRuntimeFact, DoctorRuntimeProbeOptions, DoctorRuntimeStage };
|
package/dist/doctor.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { l as getProjectPlatformOptions, m as resolveMiniPlatform, o as getPlatformOutputExtensions } from "./platform-
|
|
2
|
-
import {
|
|
3
|
-
import { t as createAnalyzeBudgetCheck } from "./budget-
|
|
4
|
-
import { t as classifyPackage } from "./classifier-
|
|
5
|
-
import { n as parseObject, r as readDoctorFiles, t as objectValue } from "./files-
|
|
1
|
+
import { l as getProjectPlatformOptions, m as resolveMiniPlatform, o as getPlatformOutputExtensions } from "./platform-BiMpsZIb.mjs";
|
|
2
|
+
import { n as version } from "./package-DR62fAzP.mjs";
|
|
3
|
+
import { t as createAnalyzeBudgetCheck } from "./budget-_Mu-4GKn.mjs";
|
|
4
|
+
import { t as classifyPackage } from "./classifier-CNTJOYQL.mjs";
|
|
5
|
+
import { n as parseObject, r as readDoctorFiles, t as objectValue } from "./files-Cy9jURJu.mjs";
|
|
6
6
|
import process from "node:process";
|
|
7
7
|
import { constants } from "node:fs";
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import path, { posix } from "node:path";
|
|
10
10
|
import { parseJsLike, traverse } from "@weapp-vite/ast/babel";
|
|
11
|
-
import { access, readFile, stat
|
|
11
|
+
import { access, readFile, stat } from "node:fs/promises";
|
|
12
12
|
import { createHash } from "node:crypto";
|
|
13
13
|
import { Parser } from "htmlparser2";
|
|
14
14
|
import postcss from "postcss";
|
|
@@ -21,7 +21,7 @@ import tsParser from "@typescript-eslint/parser";
|
|
|
21
21
|
import { Linter } from "eslint";
|
|
22
22
|
import vueParser from "vue-eslint-parser";
|
|
23
23
|
import { OperationLifecycle, classifyOperationError } from "@weapp-vite/miniprogram-automator";
|
|
24
|
-
|
|
24
|
+
// src/doctor/report.ts
|
|
25
25
|
function addDiagnostic(report, diagnostic) {
|
|
26
26
|
const fingerprint = createHash("sha256").update(JSON.stringify([
|
|
27
27
|
diagnostic.ruleId,
|
|
@@ -90,8 +90,7 @@ function formatDoctorReport(report, format = "terminal") {
|
|
|
90
90
|
...report.diagnostics.map((d) => `[${d.severity}] ${d.target} ${d.ruleId} ${d.location?.file ?? ""} ${d.message}\n ${d.suggestion}`)
|
|
91
91
|
].join("\n");
|
|
92
92
|
}
|
|
93
|
-
|
|
94
|
-
//#region src/doctor/source.ts
|
|
93
|
+
// src/doctor/source.ts
|
|
95
94
|
function checkDoctorScripts(report, target, files, layer) {
|
|
96
95
|
const linter = new Linter();
|
|
97
96
|
let incomplete = false;
|
|
@@ -175,8 +174,7 @@ function incompleteCoverage(report, target, layer, check, reason) {
|
|
|
175
174
|
reason
|
|
176
175
|
});
|
|
177
176
|
}
|
|
178
|
-
|
|
179
|
-
//#region src/doctor/references.ts
|
|
177
|
+
// src/doctor/references.ts
|
|
180
178
|
function checkArtifactReferences(report, target, snapshot, classifier) {
|
|
181
179
|
const files = new Set(snapshot.files.map((file) => file.path));
|
|
182
180
|
const ext = getPlatformOutputExtensions(target);
|
|
@@ -262,8 +260,7 @@ function checkArtifactReferences(report, target, snapshot, classifier) {
|
|
|
262
260
|
reason: "覆盖静态脚本、模板和样式引用;动态/外部引用另记 incomplete。"
|
|
263
261
|
});
|
|
264
262
|
}
|
|
265
|
-
|
|
266
|
-
//#region src/doctor/artifact.ts
|
|
263
|
+
// src/doctor/artifact.ts
|
|
267
264
|
function checkDoctorArtifact(report, target, snapshot) {
|
|
268
265
|
const files = new Map(snapshot.files.map((file) => [file.path, file]));
|
|
269
266
|
const ext = getPlatformOutputExtensions(target);
|
|
@@ -412,8 +409,7 @@ function checkDoctorArtifact(report, target, snapshot) {
|
|
|
412
409
|
checkArtifactReferences(report, target, snapshot, classifier);
|
|
413
410
|
checkDoctorScripts(report, target, snapshot.files, "artifact");
|
|
414
411
|
}
|
|
415
|
-
|
|
416
|
-
//#region src/doctor/build.ts
|
|
412
|
+
// src/doctor/build.ts
|
|
417
413
|
/** 将显式构建隔离到子进程,避免全局编译上下文和插件日志污染并发 API/JSON 输出。 */
|
|
418
414
|
async function buildDoctorSnapshot(options, target) {
|
|
419
415
|
const worker = path.join(path.dirname(fileURLToPath(import.meta.resolve("weapp-vite/package.json"))), "dist/doctor-worker.mjs");
|
|
@@ -454,12 +450,11 @@ async function buildDoctorSnapshot(options, target) {
|
|
|
454
450
|
});
|
|
455
451
|
});
|
|
456
452
|
}
|
|
457
|
-
|
|
458
|
-
//#region src/doctor/runtimeProbes.ts
|
|
453
|
+
// src/doctor/runtimeProbes.ts
|
|
459
454
|
/** 仅检查文件及平台执行条件,不执行 CLI 或项目配置。 */
|
|
460
455
|
async function inspectDoctorCli(cliPath) {
|
|
461
456
|
try {
|
|
462
|
-
if (!(await stat
|
|
457
|
+
if (!(await stat(cliPath)).isFile()) return false;
|
|
463
458
|
if (process.platform === "win32" && ![
|
|
464
459
|
".exe",
|
|
465
460
|
".cmd",
|
|
@@ -514,8 +509,7 @@ function readDoctorRoute(value) {
|
|
|
514
509
|
if (!route || route.startsWith("/") || route.length > 256 || route.includes("..") || /[\\:\s]/.test(route)) return;
|
|
515
510
|
return route;
|
|
516
511
|
}
|
|
517
|
-
|
|
518
|
-
//#region src/doctor/runtime.ts
|
|
512
|
+
// src/doctor/runtime.ts
|
|
519
513
|
const stages = [
|
|
520
514
|
"cli-executable",
|
|
521
515
|
"service-listener",
|
|
@@ -691,8 +685,7 @@ async function probeDoctorRuntime(cwd, target, port, options = {}) {
|
|
|
691
685
|
finalized = true;
|
|
692
686
|
}
|
|
693
687
|
}
|
|
694
|
-
|
|
695
|
-
//#region src/doctor/runtimeReport.ts
|
|
688
|
+
// src/doctor/runtimeReport.ts
|
|
696
689
|
const suggestions = {
|
|
697
690
|
"cli-executable": "确认所选 CLI 是可执行文件;不会自动回退到其他安装。",
|
|
698
691
|
"service-listener": "核对所选安装的服务端口与监听状态;TCP 可达不能证明监听者身份。",
|
|
@@ -742,8 +735,7 @@ function appendDoctorRuntimeEvidence(report, target, evidence) {
|
|
|
742
735
|
});
|
|
743
736
|
}
|
|
744
737
|
}
|
|
745
|
-
|
|
746
|
-
//#region src/doctor/index.ts
|
|
738
|
+
// src/doctor/index.ts
|
|
747
739
|
/** 分层收集事实;静态路径永不调用配置加载器、构建或宿主连接。 */
|
|
748
740
|
async function runDoctor(options = {}, adapters = {}) {
|
|
749
741
|
const cwd = path.resolve(options.cwd ?? process.cwd());
|
|
@@ -846,5 +838,4 @@ async function runDoctor(options = {}, adapters = {}) {
|
|
|
846
838
|
});
|
|
847
839
|
return finishReport(report);
|
|
848
840
|
}
|
|
849
|
-
//#endregion
|
|
850
841
|
export { formatDoctorReport, runDoctor };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { readFileSync } from "node:fs";
|
|
3
3
|
import { pathToFileURL } from "node:url";
|
|
4
|
-
|
|
4
|
+
// src/runtime/viteHost/engine.ts
|
|
5
5
|
function readIdentity(file) {
|
|
6
6
|
const value = JSON.parse(readFileSync(file, "utf8"));
|
|
7
7
|
if (!value || typeof value !== "object" || !("name" in value) || typeof value.name !== "string" || !("version" in value) || typeof value.version !== "string") throw new Error("[weapp-vite] Vite 宿主 package.json 缺少 name/version。");
|
|
@@ -50,5 +50,4 @@ async function loadHostRolldownBuild(importer) {
|
|
|
50
50
|
if (typeof runtime.rolldown !== "function") throw new TypeError(`[weapp-vite] ${identity.kind}@${identity.packageVersion} 缺少 Rolldown 原生写出能力。`);
|
|
51
51
|
return runtime;
|
|
52
52
|
}
|
|
53
|
-
//#endregion
|
|
54
53
|
export { loadHostRolldownBuild as n, loadHostRolldown as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as extractConfigFromVue } from "./file-D8mp5GmB.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as supportedCssLangs, i as scriptExtensions, l as getSourceStyleExtensions, n as configExtensions, o as templateExtensions, p as isSourceTemplateExtension, s as vueExtensions, u as getSourceTemplateExtensions } from "./constants-
|
|
1
|
+
import { a as supportedCssLangs, i as scriptExtensions, l as getSourceStyleExtensions, n as configExtensions, o as templateExtensions, p as isSourceTemplateExtension, s as vueExtensions, u as getSourceTemplateExtensions } from "./constants-BOe8mgqL.mjs";
|
|
2
2
|
import { createRequire } from "node:module";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import path from "pathe";
|
|
@@ -6,7 +6,7 @@ import { fs } from "@weapp-core/shared/fs";
|
|
|
6
6
|
import { createBabelBackendLoader } from "@weapp-vite/ast/babelLoader";
|
|
7
7
|
import { recursive } from "merge";
|
|
8
8
|
import { parse } from "vue/compiler-sfc";
|
|
9
|
-
|
|
9
|
+
// src/utils/file/autoRoutes.ts
|
|
10
10
|
const nodeRequire = createRequire(import.meta.url);
|
|
11
11
|
const AUTO_ROUTES_ID = "weapp-vite/auto-routes";
|
|
12
12
|
const AUTO_ROUTES_VIRTUAL_ID = "virtual:weapp-vite-auto-routes";
|
|
@@ -55,7 +55,7 @@ function resolveAutoRoutesMacroImportPath() {
|
|
|
55
55
|
}
|
|
56
56
|
async function resolveAutoRoutesInlineSnapshot(context) {
|
|
57
57
|
try {
|
|
58
|
-
const compilerContext = context ?? (await import("./getInstance-
|
|
58
|
+
const compilerContext = context ?? (await import("./getInstance-BXNVH7sU.mjs")).getCompilerContext();
|
|
59
59
|
const service = compilerContext.autoRoutesService;
|
|
60
60
|
const reference = service?.getReference?.();
|
|
61
61
|
if (!compilerContext.runtimeState.autoRoutes.loadingAppConfig) await service?.ensureFresh?.();
|
|
@@ -85,8 +85,7 @@ function inlineAutoRoutesImports(source, inlineRoutes) {
|
|
|
85
85
|
return line;
|
|
86
86
|
}).join("\n").replace(AUTO_ROUTES_DYNAMIC_IMPORT_RE, `Promise.resolve(${JSON.stringify(inlineRoutes)})`).replace(AUTO_ROUTES_SPECIFIER_RE, JSON.stringify(resolveAutoRoutesMacroImportPath()));
|
|
87
87
|
}
|
|
88
|
-
|
|
89
|
-
//#region src/utils/file/entry.ts
|
|
88
|
+
// src/utils/file/entry.ts
|
|
90
89
|
const pathExistsInFlight = /* @__PURE__ */ new Map();
|
|
91
90
|
const JS_OR_TS_RE = /\.[jt]s$/;
|
|
92
91
|
function pathExistsCached(filePath) {
|
|
@@ -159,8 +158,7 @@ async function touch(filename) {
|
|
|
159
158
|
await fs.close(await fs.open(filename, "w"));
|
|
160
159
|
}
|
|
161
160
|
}
|
|
162
|
-
|
|
163
|
-
//#region src/plugins/utils/sourceSnapshot/registry.ts
|
|
161
|
+
// src/plugins/utils/sourceSnapshot/registry.ts
|
|
164
162
|
const snapshots = /* @__PURE__ */ new WeakMap();
|
|
165
163
|
function getCompilerSourceSnapshotView(owner) {
|
|
166
164
|
return snapshots.get(owner);
|
|
@@ -179,8 +177,7 @@ function getCompilerSourceResolutions(owner) {
|
|
|
179
177
|
function readCompilerSourceSnapshotInput(owner, id) {
|
|
180
178
|
return snapshots.get(owner)?.readSource(id);
|
|
181
179
|
}
|
|
182
|
-
|
|
183
|
-
//#region src/utils/file/vueConfig.ts
|
|
180
|
+
// src/utils/file/vueConfig.ts
|
|
184
181
|
const loadVueCompiler = createBabelBackendLoader(() => import("wevu/compiler"));
|
|
185
182
|
const vueConfigCache = /* @__PURE__ */ new Map();
|
|
186
183
|
const contextConfigCaches = /* @__PURE__ */ new WeakMap();
|
|
@@ -279,5 +276,4 @@ async function extractConfigFromVue(vueFilePath, options) {
|
|
|
279
276
|
return;
|
|
280
277
|
}
|
|
281
278
|
}
|
|
282
|
-
//#endregion
|
|
283
279
|
export { hasAutoRoutesMacroImport as _, replaceCompilerSourceSnapshotView as a, findJsEntry as c, findVueEntry as d, isJsOrTs as f, getAutoRoutesMacroImportCandidates as g, touch as h, getCompilerSourceSnapshotView as i, findJsonEntry as l, normalizeFileExtension as m, getCompilerSourceResolutions as n, changeFileExtension as o, isTemplate as p, getCompilerSourceSnapshot as r, findCssEntry as s, extractConfigFromVue as t, findTemplateEntry as u, inlineAutoRoutesImports as v, resolveAutoRoutesInlineSnapshot as y };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { readFile, readdir } from "node:fs/promises";
|
|
3
3
|
import { createHash } from "node:crypto";
|
|
4
|
-
|
|
4
|
+
// src/doctor/files.ts
|
|
5
5
|
const excluded = /* @__PURE__ */ new Set([
|
|
6
6
|
"node_modules",
|
|
7
7
|
".git",
|
|
@@ -41,5 +41,4 @@ function parseObject(text) {
|
|
|
41
41
|
if (!value) throw new Error("需要 JSON 对象");
|
|
42
42
|
return value;
|
|
43
43
|
}
|
|
44
|
-
//#endregion
|
|
45
44
|
export { parseObject as n, readDoctorFiles as r, objectValue as t };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { l as resolveHmrProfileJsonPath } from "./devProvider-
|
|
1
|
+
import { l as resolveHmrProfileJsonPath } from "./devProvider-Bcvz5nu4.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-DGn5iEVN.mjs";
|
|
3
|
-
import { a as resolveIdeProjectRoot, o as shouldUseAutomatorProjectWrapper } from "./openIde-
|
|
4
|
-
import { t as readHmrProfileLines } from "./reader-
|
|
3
|
+
import { a as resolveIdeProjectRoot, o as shouldUseAutomatorProjectWrapper } from "./openIde-QoYKhuuM.mjs";
|
|
4
|
+
import { t as readHmrProfileLines } from "./reader-wzPH_W8A.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import { fs } from "@weapp-core/shared/fs";
|
|
7
7
|
import { isRetryableAutomatorLaunchError, resolveProjectAutomatorPort, startForwardConsole } from "weapp-ide-cli";
|
|
8
8
|
import { determineAgent } from "@vercel/detect-agent";
|
|
9
|
-
|
|
9
|
+
// src/cli/hmrProfileSummary.ts
|
|
10
10
|
function isFiniteNumber(value) {
|
|
11
11
|
return typeof value === "number" && Number.isFinite(value);
|
|
12
12
|
}
|
|
@@ -216,8 +216,7 @@ async function readLatestHmrProfileSummary(options) {
|
|
|
216
216
|
line: segments.join(",")
|
|
217
217
|
};
|
|
218
218
|
}
|
|
219
|
-
|
|
220
|
-
//#region src/cli/forwardConsole.ts
|
|
219
|
+
// src/cli/forwardConsole.ts
|
|
221
220
|
const DEFAULT_FORWARD_CONSOLE_LEVELS = [
|
|
222
221
|
"log",
|
|
223
222
|
"info",
|
|
@@ -507,5 +506,4 @@ async function maybeStartForwardConsole(options) {
|
|
|
507
506
|
if (activeForwardConsoleStart === startTask) activeForwardConsoleStart = void 0;
|
|
508
507
|
}
|
|
509
508
|
}
|
|
510
|
-
//#endregion
|
|
511
509
|
export { startForwardConsoleBridge as a, resolveForwardConsoleOptions as i, maybeStartForwardConsole as n, readLatestHmrProfileSummary as o, pauseActiveForwardConsole as r, closeActiveForwardConsole as t };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { t as getCompilerContext } from "./getInstance-DfNlbr-X.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as createCompilerContextInstance } from "./createCompilerContextInstance-
|
|
2
|
-
|
|
1
|
+
import { t as createCompilerContextInstance } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
|
+
// src/context/getInstance.ts
|
|
3
3
|
const compilerContextMap = /* @__PURE__ */ new Map();
|
|
4
4
|
const DEFAULT_KEY = "default";
|
|
5
5
|
let activeCompilerContextKey = DEFAULT_KEY;
|
|
@@ -24,5 +24,4 @@ function resetCompilerContext(key) {
|
|
|
24
24
|
compilerContextMap.clear();
|
|
25
25
|
activeCompilerContextKey = DEFAULT_KEY;
|
|
26
26
|
}
|
|
27
|
-
//#endregion
|
|
28
27
|
export { resetCompilerContext as n, setActiveCompilerContextKey as r, getCompilerContext as t };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { c as getDevServerCloseRecord, l as replaceDevServerClose, s as getDevShutdownScope } from "./lifecycle-
|
|
2
|
-
import { C as createDevViteServer, O as createSharedBuildConfig, w as createGlassEaselAnalyzeResult } from "./createCompilerContextInstance-
|
|
1
|
+
import { c as getDevServerCloseRecord, l as replaceDevServerClose, s as getDevShutdownScope } from "./lifecycle-CUo8PMQc.mjs";
|
|
2
|
+
import { C as createDevViteServer, O as createSharedBuildConfig, w as createGlassEaselAnalyzeResult } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
3
3
|
import { r as logger_default, t as colors } from "./logger-DGn5iEVN.mjs";
|
|
4
|
-
import { a as resolveDashboardInstallation, r as ANALYZE_DASHBOARD_PACKAGE_NAME } from "./artifacts-
|
|
5
|
-
import { t as loadDashboardTransportModule } from "./dashboardTransport-
|
|
6
|
-
import { n as isRuntimeCategory, t as createAnalyzeBudgetCheck } from "./budget-
|
|
7
|
-
import { r as resolveAnalyzeHistoryMetadata, t as createAnalyzeMetadata } from "./metadata-
|
|
8
|
-
import { i as resolveModuleSourceType, n as normalizeModuleId, r as resolveAssetSource, t as classifyPackage } from "./classifier-
|
|
4
|
+
import { a as resolveDashboardInstallation, r as ANALYZE_DASHBOARD_PACKAGE_NAME } from "./artifacts-TrTX9_jj.mjs";
|
|
5
|
+
import { t as loadDashboardTransportModule } from "./dashboardTransport-C9290QgS.mjs";
|
|
6
|
+
import { n as isRuntimeCategory, t as createAnalyzeBudgetCheck } from "./budget-_Mu-4GKn.mjs";
|
|
7
|
+
import { r as resolveAnalyzeHistoryMetadata, t as createAnalyzeMetadata } from "./metadata-HlDKtlsu.mjs";
|
|
8
|
+
import { i as resolveModuleSourceType, n as normalizeModuleId, r as resolveAssetSource, t as classifyPackage } from "./classifier-CNTJOYQL.mjs";
|
|
9
9
|
import process from "node:process";
|
|
10
10
|
import path, { posix } from "pathe";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
@@ -15,7 +15,7 @@ import { createHash } from "node:crypto";
|
|
|
15
15
|
import { Buffer } from "node:buffer";
|
|
16
16
|
import { resolveCommand } from "package-manager-detector/commands";
|
|
17
17
|
import { brotliCompressSync, gzipSync } from "node:zlib";
|
|
18
|
-
|
|
18
|
+
// src/cli/analyze/dashboard.ts
|
|
19
19
|
function createInstallCommand(agent) {
|
|
20
20
|
const resolved = resolveCommand(agent ?? "npm", "install", [ANALYZE_DASHBOARD_PACKAGE_NAME]);
|
|
21
21
|
if (!resolved) return `npm install ${ANALYZE_DASHBOARD_PACKAGE_NAME}`;
|
|
@@ -30,7 +30,7 @@ async function startAnalyzeDashboard(result, options) {
|
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
32
|
const { root, configFile, packageJsonPath } = resolved;
|
|
33
|
-
const { ANALYZE_DASHBOARD_DEVFRAME_BASE, ANALYZE_DASHBOARD_HUB_BASE, createAnalyzeDashboardViteBridge } = await import("./dashboardViteBridge-
|
|
33
|
+
const { ANALYZE_DASHBOARD_DEVFRAME_BASE, ANALYZE_DASHBOARD_HUB_BASE, createAnalyzeDashboardViteBridge } = await import("./dashboardViteBridge-B7QgQo94.mjs");
|
|
34
34
|
const [{ createAnalyzeDashboardDevframe }, { buildOtpAuthUrl, refreshTempAuthCode }] = await Promise.all([import("./dashboard.mjs"), loadDashboardTransportModule(packageJsonPath, "devframe/node/auth")]);
|
|
35
35
|
const devframe = createAnalyzeDashboardDevframe({
|
|
36
36
|
clientAssets: options.uiHost === "hub" ? root : void 0,
|
|
@@ -162,8 +162,7 @@ async function startAnalyzeDashboard(result, options) {
|
|
|
162
162
|
}
|
|
163
163
|
await waitPromise;
|
|
164
164
|
}
|
|
165
|
-
|
|
166
|
-
//#region src/analyze/components/suggestions.ts
|
|
165
|
+
// src/analyze/components/suggestions.ts
|
|
167
166
|
function createComponentSuggestion(usage) {
|
|
168
167
|
if (usage.componentPackage !== "__main__" || usage.crossPackageUsageCount === 0) return;
|
|
169
168
|
if (usage.crossPackageUsageCount === usage.placeholderCoveredCrossPackageUsageCount) return;
|
|
@@ -200,8 +199,7 @@ function createComponentSuggestion(usage) {
|
|
|
200
199
|
message: `主包组件 ${usage.component} 同时被主包和分包使用,建议评估组件拆分、归属或异步化策略。`
|
|
201
200
|
};
|
|
202
201
|
}
|
|
203
|
-
|
|
204
|
-
//#region src/analyze/components/index.ts
|
|
202
|
+
// src/analyze/components/index.ts
|
|
205
203
|
function normalizeRoute(value) {
|
|
206
204
|
return posix.normalize(value.replace(/\\/g, "/").replace(/^\/+/, "").replace(/\.json$/, ""));
|
|
207
205
|
}
|
|
@@ -332,8 +330,7 @@ function analyzeComponentUsage(options) {
|
|
|
332
330
|
return usageDelta !== 0 ? usageDelta : left.component.localeCompare(right.component);
|
|
333
331
|
});
|
|
334
332
|
}
|
|
335
|
-
|
|
336
|
-
//#region src/analyze/subpackages/artifacts/owner.ts
|
|
333
|
+
// src/analyze/subpackages/artifacts/owner.ts
|
|
337
334
|
/** 每次分析独立缓存包边界,兼容 pnpm、工作区和普通 node_modules。 */
|
|
338
335
|
function createModuleOwnerResolver() {
|
|
339
336
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -370,8 +367,7 @@ function classifyOwnedModule(owner, application) {
|
|
|
370
367
|
if (owner && ["wevu", "@weapp-vite/react"].includes(owner.name)) return "runtime";
|
|
371
368
|
return owner ? "dependency" : "unknown";
|
|
372
369
|
}
|
|
373
|
-
|
|
374
|
-
//#region src/analyze/subpackages/artifacts/index.ts
|
|
370
|
+
// src/analyze/subpackages/artifacts/index.ts
|
|
375
371
|
function createArtifactAnalysis(packages, resolveOwner = createModuleOwnerResolver()) {
|
|
376
372
|
const files = /* @__PURE__ */ new Map();
|
|
377
373
|
const moduleCopies = /* @__PURE__ */ new Map();
|
|
@@ -429,8 +425,7 @@ function createArtifactAnalysis(packages, resolveOwner = createModuleOwnerResolv
|
|
|
429
425
|
}
|
|
430
426
|
};
|
|
431
427
|
}
|
|
432
|
-
|
|
433
|
-
//#region src/analyze/subpackages/registry.ts
|
|
428
|
+
// src/analyze/subpackages/registry.ts
|
|
434
429
|
function ensurePackage(packages, classification) {
|
|
435
430
|
const existing = packages.get(classification.id);
|
|
436
431
|
if (existing) return existing;
|
|
@@ -459,8 +454,7 @@ function registerModuleInPackage(modules, moduleId, source, sourceType, packageI
|
|
|
459
454
|
files.add(fileName);
|
|
460
455
|
moduleEntry.packages.set(packageId, files);
|
|
461
456
|
}
|
|
462
|
-
|
|
463
|
-
//#region src/analyze/subpackages/output.ts
|
|
457
|
+
// src/analyze/subpackages/output.ts
|
|
464
458
|
function getAssetBuffer(asset) {
|
|
465
459
|
if (typeof asset.source === "string") return Buffer.from(asset.source, "utf8");
|
|
466
460
|
if (asset.source instanceof Uint8Array) return Buffer.from(asset.source);
|
|
@@ -554,8 +548,7 @@ function processOutput(output, origin, ctx, classifierContext, packages, modules
|
|
|
554
548
|
onArtifact?.(item.fileName, item.source);
|
|
555
549
|
}
|
|
556
550
|
}
|
|
557
|
-
|
|
558
|
-
//#region src/analyze/subpackages/summary.ts
|
|
551
|
+
// src/analyze/subpackages/summary.ts
|
|
559
552
|
function toArray(value) {
|
|
560
553
|
return Array.from(value);
|
|
561
554
|
}
|
|
@@ -653,8 +646,7 @@ function summarizeSubPackages(metas) {
|
|
|
653
646
|
descriptors.sort((a, b) => a.root.localeCompare(b.root));
|
|
654
647
|
return descriptors;
|
|
655
648
|
}
|
|
656
|
-
|
|
657
|
-
//#region src/analyze/subpackages/index.ts
|
|
649
|
+
// src/analyze/subpackages/index.ts
|
|
658
650
|
async function analyzeBuild(ctx, options) {
|
|
659
651
|
const { configService, scanService, buildService } = ctx;
|
|
660
652
|
if (!configService || !scanService || !buildService) throw new Error("analyzeSubpackages 需要先初始化 configService、scanService 和 buildService。");
|
|
@@ -729,8 +721,7 @@ async function analyzeSubpackages(ctx, options) {
|
|
|
729
721
|
ctx.runtimeState.build.output.analysisChunks = previous;
|
|
730
722
|
}
|
|
731
723
|
}
|
|
732
|
-
|
|
733
|
-
//#region src/analyze/subpackages/history.ts
|
|
724
|
+
// src/analyze/subpackages/history.ts
|
|
734
725
|
const jsonExtension = ".json";
|
|
735
726
|
function createSnapshotFileName(date = /* @__PURE__ */ new Date()) {
|
|
736
727
|
return `${date.toISOString().replace(/[:.]/g, "-")}${jsonExtension}`;
|
|
@@ -780,5 +771,4 @@ async function writeAnalyzeHistorySnapshot(result, configService, now = /* @__PU
|
|
|
780
771
|
await trimSnapshotFiles(history.dir, history.limit);
|
|
781
772
|
return snapshotPath;
|
|
782
773
|
}
|
|
783
|
-
//#endregion
|
|
784
774
|
export { startAnalyzeDashboard as i, writeAnalyzeHistorySnapshot as n, analyzeSubpackages as r, readLatestAnalyzeHistorySnapshot as t };
|
package/dist/i18n.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
import { t as WeappI18nConfig } from "./types-
|
|
1
|
+
import { t as WeappI18nConfig } from "./types-e2BMP9NU.mjs";
|
|
2
2
|
import { I18nGlobal, I18nGlobal as I18nGlobal$1, I18nInstance, I18nInstance as I18nInstance$1, I18nLocaleChangeSubscription } from "@weapp-vite/i18n";
|
|
3
|
-
//#region src/i18n.d.ts
|
|
4
3
|
export declare const behavior: I18nInstance$1["behavior"];
|
|
5
4
|
export declare const i18n: I18nInstance$1;
|
|
6
5
|
export declare const global: I18nGlobal$1;
|
|
7
6
|
export declare const page: typeof Page;
|
|
8
|
-
//#endregion
|
|
9
7
|
export type { I18nGlobal, I18nInstance, I18nLocaleChangeSubscription, WeappI18nConfig };
|
package/dist/i18n.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { WEAPP_I18N_RUNTIME_MARKER } from "@weapp-core/constants";
|
|
2
|
-
|
|
2
|
+
// src/i18n.ts
|
|
3
3
|
function unavailable() {
|
|
4
4
|
throw new Error("weapp-vite/i18n 只能在启用 weapp.i18n 的小程序构建中使用。");
|
|
5
5
|
}
|
|
@@ -11,5 +11,4 @@ const i18n = {
|
|
|
11
11
|
};
|
|
12
12
|
const global = unavailable;
|
|
13
13
|
const page = unavailable;
|
|
14
|
-
//#endregion
|
|
15
14
|
export { behavior, global, i18n, page };
|