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/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
|
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
weapp-vite 的 JavaScript 产物包含以下 MIT 许可的软件,完整许可证保留如下。
|
|
4
4
|
|
|
5
|
-
## Chokidar
|
|
5
|
+
## Chokidar 6.0.0
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
此副本保留 Chokidar 6 的监听后端与生命周期模型,并包含本地修补:缺失目录的
|
|
8
|
+
Windows 注册恢复,以及目录扫描和文件读取的异步归属隔离。
|
|
9
9
|
|
|
10
10
|
```text
|
|
11
11
|
The MIT License (MIT)
|
package/bin/bootstrap.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs'
|
|
2
|
+
// 安装生命周期早于 workspace 构建,启动阶段直接使用日志包同源的轻量染色实现。
|
|
3
|
+
import colors from 'picocolors'
|
|
2
4
|
// eslint-disable-next-line e18e/ban-dependencies -- 启动检查使用与发布 engines 完全相同的 npm semver 语义。
|
|
3
5
|
import satisfies from 'semver/functions/satisfies.js'
|
|
6
|
+
import { formatNodeVersionWarning } from './nodeVersionWarning.js'
|
|
4
7
|
|
|
5
8
|
const { engines } = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'))
|
|
6
9
|
|
|
@@ -115,11 +118,13 @@ export async function runWeappViteCLI(options = {}) {
|
|
|
115
118
|
importer = () => ['accept', 'mcp'].includes(argv[0])
|
|
116
119
|
? import('../dist/cli-acceptance.mjs')
|
|
117
120
|
: import('../dist/cli.mjs'),
|
|
118
|
-
write = message => getGlobalProcess().stderr.write(`\n
|
|
121
|
+
write = message => getGlobalProcess().stderr.write(`\n ${colors.bold(colors.yellow('警告'))} ${message}\n\n`),
|
|
119
122
|
} = options
|
|
120
|
-
//
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
// Bun 的 versions.node 只是兼容标识;真实 Node 在加载依赖前提示升级,不因版本号阻断命令。
|
|
124
|
+
const bunVersion = getGlobalProcess().versions.bun
|
|
125
|
+
const isBun = typeof bunVersion === 'string' && bunVersion.length > 0
|
|
126
|
+
if (!isBun && !satisfies(nodeVersion, engines.node)) {
|
|
127
|
+
write(formatNodeVersionWarning('weapp-vite', nodeVersion, engines.node))
|
|
123
128
|
}
|
|
124
129
|
const restorePrepareGuard = guardPrepareProcessExit(argv)
|
|
125
130
|
const restoreKnownNoiseGuard = guardKnownLocalPkgResolveNoise()
|
package/bin/bootstrap.test.ts
CHANGED
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import
|
|
1
|
+
import realProcess from 'node:process'
|
|
2
|
+
import { stripVTControlCharacters } from 'node:util'
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
import { runBootstrapFixture } from '../test/helpers/bootstrapFixture'
|
|
2
5
|
import { formatPrepareSkipMessage, guardKnownLocalPkgResolveNoise, guardPrepareProcessExit, runWeappViteCLI } from './bootstrap.js'
|
|
3
6
|
|
|
4
7
|
describe('bin bootstrap', () => {
|
|
8
|
+
beforeEach(() => {
|
|
9
|
+
vi.stubGlobal('process', {
|
|
10
|
+
...realProcess,
|
|
11
|
+
exitCode: undefined,
|
|
12
|
+
exit: vi.fn(),
|
|
13
|
+
on: vi.fn(),
|
|
14
|
+
off: vi.fn(),
|
|
15
|
+
})
|
|
16
|
+
})
|
|
17
|
+
|
|
5
18
|
afterEach(() => {
|
|
6
19
|
vi.restoreAllMocks()
|
|
20
|
+
vi.unstubAllGlobals()
|
|
7
21
|
})
|
|
8
22
|
|
|
9
23
|
it('guards process exit state for prepare at bin level', () => {
|
|
@@ -90,3 +104,70 @@ describe('bin bootstrap', () => {
|
|
|
90
104
|
expect(consoleErrorSpy.mock.calls[0]?.[0]?.message).toBe('boom')
|
|
91
105
|
})
|
|
92
106
|
})
|
|
107
|
+
|
|
108
|
+
describe('cold CLI bootstrap without workspace dist', () => {
|
|
109
|
+
it('never reports a child terminated by a signal as successful', async () => {
|
|
110
|
+
const outcome = await runBootstrapFixture(['--eval', 'process.kill(process.pid, "SIGTERM")']).then(
|
|
111
|
+
result => ({ kind: 'exit' as const, result }),
|
|
112
|
+
(error: unknown) => ({ kind: 'signal' as const, error }),
|
|
113
|
+
)
|
|
114
|
+
if (outcome.kind === 'exit') {
|
|
115
|
+
// Windows 可能将强制终止表示为非零退出码,Unix 则通过 signal 报告。
|
|
116
|
+
expect(outcome.result.exitCode).not.toBe(0)
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
expect(outcome.error).toMatchObject({ signal: 'SIGTERM' })
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it('keeps prepare successful and reports the missing CLI artifact in Chinese on stderr', async () => {
|
|
124
|
+
const result = await runBootstrapFixture(['bin/weapp-vite.js', 'prepare'])
|
|
125
|
+
|
|
126
|
+
expect(result.exitCode).toBe(0)
|
|
127
|
+
expect(result.stdout).toBe('')
|
|
128
|
+
expect(result.stderr).toContain('警告')
|
|
129
|
+
expect(result.stderr).toContain('[prepare] 跳过 .weapp-vite 支持文件预生成:')
|
|
130
|
+
expect(result.stderr.replaceAll('\\', '/')).toContain('dist/cli.mjs')
|
|
131
|
+
expect(result.stderr).not.toContain('@weapp-core/logger')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it.each([
|
|
135
|
+
['build', 'cli.mjs'],
|
|
136
|
+
['dev', 'cli.mjs'],
|
|
137
|
+
['accept', 'cli-acceptance.mjs'],
|
|
138
|
+
['mcp', 'cli-acceptance.mjs'],
|
|
139
|
+
])('preserves the missing artifact failure for %s', async (command, artifact) => {
|
|
140
|
+
const result = await runBootstrapFixture(['bin/weapp-vite.js', command])
|
|
141
|
+
|
|
142
|
+
expect(result.exitCode).not.toBe(0)
|
|
143
|
+
expect(result.stdout).toBe('')
|
|
144
|
+
expect(result.stderr).toContain('ERR_MODULE_NOT_FOUND')
|
|
145
|
+
expect(result.stderr.replaceAll('\\', '/')).toContain(`dist/${artifact}`)
|
|
146
|
+
expect(result.stderr).not.toContain('@weapp-core/logger')
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it.each([
|
|
150
|
+
{ name: 'forced colors', env: { FORCE_COLOR: '1' }, colored: true },
|
|
151
|
+
{ name: 'disabled colors', env: { NO_COLOR: '1' }, colored: false },
|
|
152
|
+
{ name: 'NO_COLOR precedence', env: { FORCE_COLOR: '1', NO_COLOR: '1' }, colored: false },
|
|
153
|
+
])('keeps the Chinese Node warning on stderr with $name', async ({ env, colored }) => {
|
|
154
|
+
const result = await runBootstrapFixture([
|
|
155
|
+
'--input-type=module',
|
|
156
|
+
'--eval',
|
|
157
|
+
`
|
|
158
|
+
const { runWeappViteCLI } = await import('./bin/bootstrap.js')
|
|
159
|
+
await runWeappViteCLI({ argv: ['build'], nodeVersion: '20.19.0', importer: async () => {} })
|
|
160
|
+
`,
|
|
161
|
+
], env)
|
|
162
|
+
|
|
163
|
+
expect(result.exitCode).toBe(0)
|
|
164
|
+
expect(result.stdout).toBe('')
|
|
165
|
+
expect(result.stderr).toContain('警告')
|
|
166
|
+
expect(result.stderr).toContain('当前 Node.js 版本')
|
|
167
|
+
expect(result.stderr).toContain('20.19.0')
|
|
168
|
+
expect(result.stderr).toContain('推荐版本:')
|
|
169
|
+
expect(result.stderr).toContain('为获得安全修复,建议升级至受支持 LTS 分支的最新补丁版本。')
|
|
170
|
+
expect(result.stderr).toContain('本次将继续运行;若遇到依赖兼容问题,请先升级 Node.js。')
|
|
171
|
+
expect(stripVTControlCharacters(result.stderr) !== result.stderr).toBe(colored)
|
|
172
|
+
})
|
|
173
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// 此格式器也用于尚无 workspace 构建产物的安装阶段,不能依赖日志包的 dist。
|
|
2
|
+
import colors from 'picocolors'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 格式化 Node.js 版本升级提示,供 CLI 与构建插件共用。
|
|
6
|
+
* @param {string} name 发出提示的工具名称
|
|
7
|
+
* @param {string} nodeVersion 当前 Node.js 版本
|
|
8
|
+
* @param {string} nodeRange 官方支持的版本范围
|
|
9
|
+
*/
|
|
10
|
+
export function formatNodeVersionWarning(name, nodeVersion, nodeRange) {
|
|
11
|
+
return [
|
|
12
|
+
`${name} 检测到当前 Node.js 版本 ${colors.bold(colors.yellow(nodeVersion))} 不在官方支持范围内。`,
|
|
13
|
+
` 推荐版本:${colors.bold(colors.cyan(nodeRange))}`,
|
|
14
|
+
' 为获得安全修复,建议升级至受支持 LTS 分支的最新补丁版本。',
|
|
15
|
+
` ${colors.dim('本次将继续运行;若遇到依赖兼容问题,请先升级 Node.js。')}`,
|
|
16
|
+
].join('\n')
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { stripVTControlCharacters } from 'node:util'
|
|
2
|
+
import { describe, expect, it } from 'vitest'
|
|
3
|
+
import { runBootstrapFixture } from '../test/helpers/bootstrapFixture'
|
|
4
|
+
|
|
5
|
+
describe('cold Node version warning formatter without workspace dist', () => {
|
|
6
|
+
it.each([
|
|
7
|
+
{ name: 'forced colors', env: { FORCE_COLOR: '1' }, colored: true },
|
|
8
|
+
{ name: 'disabled colors', env: { NO_COLOR: '1' }, colored: false },
|
|
9
|
+
{ name: 'NO_COLOR precedence', env: { FORCE_COLOR: '1', NO_COLOR: '1' }, colored: false },
|
|
10
|
+
])('formats the Chinese warning with $name using only registry dependencies', async ({ env, colored }) => {
|
|
11
|
+
const result = await runBootstrapFixture([
|
|
12
|
+
'--input-type=module',
|
|
13
|
+
'--eval',
|
|
14
|
+
`
|
|
15
|
+
const { formatNodeVersionWarning } = await import('./bin/nodeVersionWarning.js')
|
|
16
|
+
process.stdout.write(formatNodeVersionWarning('weapp.tailwindcss', '20.19.0', '^22.23.4 || ^24.22.1 || >=26.12.1'))
|
|
17
|
+
`,
|
|
18
|
+
], env)
|
|
19
|
+
|
|
20
|
+
expect(result.exitCode).toBe(0)
|
|
21
|
+
expect(result.stdout).toContain('weapp.tailwindcss 检测到当前 Node.js 版本')
|
|
22
|
+
expect(result.stdout).toContain('20.19.0')
|
|
23
|
+
expect(result.stdout).toContain('推荐版本:')
|
|
24
|
+
expect(result.stdout).toContain('^22.23.4 || ^24.22.1 || >=26.12.1')
|
|
25
|
+
expect(result.stdout).toContain('为获得安全修复,建议升级至受支持 LTS 分支的最新补丁版本。')
|
|
26
|
+
expect(result.stdout).toContain('本次将继续运行;若遇到依赖兼容问题,请先升级 Node.js。')
|
|
27
|
+
expect(result.stderr).toBe('')
|
|
28
|
+
expect(stripVTControlCharacters(result.stdout) !== result.stdout).toBe(colored)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { c as getBackendForCapability } from "./createCompilerContextInstance-
|
|
2
|
-
import { t as VERSION } from "./constants-
|
|
1
|
+
import { c as getBackendForCapability } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
|
+
import { t as VERSION } from "./constants-BOe8mgqL.mjs";
|
|
3
3
|
import { r as logger_default } from "./logger-DGn5iEVN.mjs";
|
|
4
|
-
import { i as resolveRuntimeTargets } from "./runtime-
|
|
5
|
-
import { n as openIde, r as resolveIdeCommandContext } from "./openIde-
|
|
6
|
-
import { o as resolveConfigFile, r as filterDuplicateOptions } from "./options-
|
|
7
|
-
import { a as startForwardConsoleBridge, i as resolveForwardConsoleOptions, o as readLatestHmrProfileSummary } from "./forwardConsole-
|
|
4
|
+
import { i as resolveRuntimeTargets } from "./runtime-CKtMVERT.mjs";
|
|
5
|
+
import { n as openIde, r as resolveIdeCommandContext } from "./openIde-QoYKhuuM.mjs";
|
|
6
|
+
import { o as resolveConfigFile, r as filterDuplicateOptions } from "./options-Cz8vZ-0w.mjs";
|
|
7
|
+
import { a as startForwardConsoleBridge, i as resolveForwardConsoleOptions, o as readLatestHmrProfileSummary } from "./forwardConsole-D2Q0RIqc.mjs";
|
|
8
8
|
import process from "node:process";
|
|
9
9
|
import { bootstrapWechatDevtoolsSettings, connectOpenedAutomator, defaultCustomConfigFilePath, detectWechatDevtoolsServicePort, getWechatIdeTestAccounts, getWechatIdeTicket, getWechatIdeToolInfo, queryWechatIdeLogin, refreshWechatIdeTicket, resolveCliPath, resolveProjectAutomatorPort, setWechatIdeTicket } from "weapp-ide-cli";
|
|
10
|
-
|
|
10
|
+
// src/cli/commands/ide/action.ts
|
|
11
11
|
async function runIdeDoctor(projectPath, options) {
|
|
12
12
|
const resolvedCli = await resolveCliPath();
|
|
13
13
|
const servicePort = await detectWechatDevtoolsServicePort().then((result) => ({
|
|
@@ -251,5 +251,4 @@ async function runIdeCommand(action, root, options) {
|
|
|
251
251
|
await session.close();
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
|
-
//#endregion
|
|
255
254
|
export { runIdeCommand };
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { r as logger_default } from "./logger-DGn5iEVN.mjs";
|
|
2
|
-
import { t as createCompilerContext } from "./createContext-
|
|
3
|
-
import { i as resolveRuntimeTargets, t as createInlineConfig } from "./runtime-
|
|
4
|
-
import { o as resolveConfigFile, r as filterDuplicateOptions } from "./options-
|
|
5
|
-
import { t as setCommandNodeEnv } from "./nodeEnv-
|
|
6
|
-
import { o as resolveUploadTimeout, t as UploadCommandError } from "./report-
|
|
7
|
-
import { n as resolveUploadPlatforms } from "./upload-
|
|
8
|
-
import { t as terminateStaleSassEmbeddedProcess } from "./processCleanup-
|
|
9
|
-
import { i as prepareAutoUploadMetadata, n as executeUploadTarget, r as UploadExecutionError, t as createUploadTarget } from "./builtProject-
|
|
2
|
+
import { t as createCompilerContext } from "./createContext-W0TeXxbo.mjs";
|
|
3
|
+
import { i as resolveRuntimeTargets, t as createInlineConfig } from "./runtime-CKtMVERT.mjs";
|
|
4
|
+
import { o as resolveConfigFile, r as filterDuplicateOptions } from "./options-Cz8vZ-0w.mjs";
|
|
5
|
+
import { t as setCommandNodeEnv } from "./nodeEnv-zq1EymWj.mjs";
|
|
6
|
+
import { o as resolveUploadTimeout, t as UploadCommandError } from "./report-PJVyo-UZ.mjs";
|
|
7
|
+
import { n as resolveUploadPlatforms } from "./upload-Chal5b3w.mjs";
|
|
8
|
+
import { t as terminateStaleSassEmbeddedProcess } from "./processCleanup-DzB64WI8.mjs";
|
|
9
|
+
import { i as prepareAutoUploadMetadata, n as executeUploadTarget, r as UploadExecutionError, t as createUploadTarget } from "./builtProject-B145uOt5.mjs";
|
|
10
10
|
import process from "node:process";
|
|
11
11
|
import path from "node:path";
|
|
12
|
-
|
|
12
|
+
// src/cli/commands/upload/action.ts
|
|
13
13
|
async function buildUploadTarget(cwd, platform, options, action, item) {
|
|
14
14
|
const targets = resolveRuntimeTargets({ platform });
|
|
15
15
|
const ctx = await createCompilerContext({
|
|
@@ -91,5 +91,4 @@ async function runUploadCommand(root, options, action = "upload") {
|
|
|
91
91
|
throw new UploadCommandError(report);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
//#endregion
|
|
95
94
|
export { runUploadCommand };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { c as getBackendForCapability } from "./createCompilerContextInstance-
|
|
2
|
-
import { l as resolveHmrProfileJsonPath } from "./devProvider-
|
|
3
|
-
import { c as findJsEntry, d as findVueEntry, u as findTemplateEntry } from "./file-
|
|
4
|
-
import { b as resolvePreloadPackageIdentifier, v as collectPreloadPages, x as suggestPreloadRules, y as findPreloadRuleKey } from "./utils-
|
|
1
|
+
import { c as getBackendForCapability } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
|
+
import { l as resolveHmrProfileJsonPath } from "./devProvider-Bcvz5nu4.mjs";
|
|
3
|
+
import { c as findJsEntry, d as findVueEntry, u as findTemplateEntry } from "./file-D8mp5GmB.mjs";
|
|
4
|
+
import { b as resolvePreloadPackageIdentifier, v as collectPreloadPages, x as suggestPreloadRules, y as findPreloadRuleKey } from "./utils-CTGSZp4j.mjs";
|
|
5
5
|
import { r as logger_default, t as colors } from "./logger-DGn5iEVN.mjs";
|
|
6
|
-
import { t as createCompilerContext } from "./createContext-
|
|
7
|
-
import { i as resolveRuntimeTargets, n as logRuntimeTarget, t as createInlineConfig } from "./runtime-
|
|
8
|
-
import { a as parseDashboardUiHost, o as resolveConfigFile, r as filterDuplicateOptions, t as coerceBooleanOption } from "./options-
|
|
9
|
-
import { t as readHmrProfileLines } from "./reader-
|
|
10
|
-
import { n as createDashboardArtifactSnapshot } from "./artifacts-
|
|
11
|
-
import { i as startAnalyzeDashboard, n as writeAnalyzeHistorySnapshot, r as analyzeSubpackages, t as readLatestAnalyzeHistorySnapshot } from "./history-
|
|
12
|
-
import { t as setCommandNodeEnv } from "./nodeEnv-
|
|
13
|
-
import { t as createAnalyzeBudgetCheck } from "./budget-
|
|
14
|
-
import { r as createAnalyzeComparison, t as createDuplicateModuleInsights } from "./analyze-
|
|
15
|
-
import { t as terminateStaleSassEmbeddedProcess } from "./processCleanup-
|
|
6
|
+
import { t as createCompilerContext } from "./createContext-W0TeXxbo.mjs";
|
|
7
|
+
import { i as resolveRuntimeTargets, n as logRuntimeTarget, t as createInlineConfig } from "./runtime-CKtMVERT.mjs";
|
|
8
|
+
import { a as parseDashboardUiHost, o as resolveConfigFile, r as filterDuplicateOptions, t as coerceBooleanOption } from "./options-Cz8vZ-0w.mjs";
|
|
9
|
+
import { t as readHmrProfileLines } from "./reader-wzPH_W8A.mjs";
|
|
10
|
+
import { n as createDashboardArtifactSnapshot } from "./artifacts-TrTX9_jj.mjs";
|
|
11
|
+
import { i as startAnalyzeDashboard, n as writeAnalyzeHistorySnapshot, r as analyzeSubpackages, t as readLatestAnalyzeHistorySnapshot } from "./history-dKxzoHmN.mjs";
|
|
12
|
+
import { t as setCommandNodeEnv } from "./nodeEnv-zq1EymWj.mjs";
|
|
13
|
+
import { t as createAnalyzeBudgetCheck } from "./budget-_Mu-4GKn.mjs";
|
|
14
|
+
import { r as createAnalyzeComparison, t as createDuplicateModuleInsights } from "./analyze-DCZo-sJd.mjs";
|
|
15
|
+
import { t as terminateStaleSassEmbeddedProcess } from "./processCleanup-DzB64WI8.mjs";
|
|
16
16
|
import process from "node:process";
|
|
17
17
|
import path from "pathe";
|
|
18
18
|
import { fs } from "@weapp-core/shared/fs";
|
|
19
19
|
import { parse } from "vue/compiler-sfc";
|
|
20
|
-
|
|
20
|
+
// src/cli/commands/analyze/webResult.ts
|
|
21
21
|
function normalizeDisplayPath(value) {
|
|
22
22
|
return value || ".";
|
|
23
23
|
}
|
|
@@ -60,8 +60,7 @@ function createWebAnalyzeResult(configService, options) {
|
|
|
60
60
|
limitations
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
//#region src/analyze/hmr/attribution.ts
|
|
63
|
+
// src/analyze/hmr/attribution.ts
|
|
65
64
|
const nonnegative = (value) => typeof value === "number" && Number.isFinite(value) && value >= 0;
|
|
66
65
|
function difference(whole, ...parts) {
|
|
67
66
|
return nonnegative(whole) && parts.every(nonnegative) && whole >= parts.reduce((sum, value) => sum + value, 0) ? whole - parts.reduce((sum, value) => sum + value, 0) : null;
|
|
@@ -116,8 +115,7 @@ function attributeHmrProfile(sample, external) {
|
|
|
116
115
|
nestedMetrics: "hook durations overlap; do not add to outer phases"
|
|
117
116
|
};
|
|
118
117
|
}
|
|
119
|
-
|
|
120
|
-
//#region src/analyze/hmr.ts
|
|
118
|
+
// src/analyze/hmr.ts
|
|
121
119
|
function createMetricSummary(values) {
|
|
122
120
|
if (!values.length) return { count: 0 };
|
|
123
121
|
const total = values.reduce((sum, value) => sum + value, 0);
|
|
@@ -368,8 +366,7 @@ async function analyzeHmrProfile(options) {
|
|
|
368
366
|
slowestSamples
|
|
369
367
|
};
|
|
370
368
|
}
|
|
371
|
-
|
|
372
|
-
//#region src/analyze/preload/budget.ts
|
|
369
|
+
// src/analyze/preload/budget.ts
|
|
373
370
|
const PRELOAD_LIMIT_BYTES = 2097152;
|
|
374
371
|
function createPackageSizeMap(result) {
|
|
375
372
|
return new Map((result?.packages ?? []).map((pkg) => [pkg.id, pkg.files.reduce((total, file) => total + (file.size ?? 0), 0)]));
|
|
@@ -444,8 +441,7 @@ function createPreloadBudgets(appJson, result, configuredRules, packageAnalysis)
|
|
|
444
441
|
};
|
|
445
442
|
}).sort((left, right) => left.sourcePackage.localeCompare(right.sourcePackage));
|
|
446
443
|
}
|
|
447
|
-
|
|
448
|
-
//#region src/analyze/preload/index.ts
|
|
444
|
+
// src/analyze/preload/index.ts
|
|
449
445
|
async function readFileIfExists(filePath) {
|
|
450
446
|
if (!filePath) return;
|
|
451
447
|
try {
|
|
@@ -539,8 +535,7 @@ async function analyzePreloadRules(ctx, options = {}) {
|
|
|
539
535
|
]
|
|
540
536
|
};
|
|
541
537
|
}
|
|
542
|
-
|
|
543
|
-
//#region src/analyze/subpackages/report.ts
|
|
538
|
+
// src/analyze/subpackages/report.ts
|
|
544
539
|
function formatAnalyzeBytes(bytes) {
|
|
545
540
|
if (!bytes || Number.isNaN(bytes)) return "0 B";
|
|
546
541
|
const units = [
|
|
@@ -749,8 +744,7 @@ function createAnalyzeMarkdownReport(result, previousResult) {
|
|
|
749
744
|
""
|
|
750
745
|
].join("\n");
|
|
751
746
|
}
|
|
752
|
-
|
|
753
|
-
//#region src/cli/analyze/output.ts
|
|
747
|
+
// src/cli/analyze/output.ts
|
|
754
748
|
/** CLI 单次分析期间保留 JSON 专用写入入口,配置、插件和清理日志走 stderr。 */
|
|
755
749
|
async function withAnalyzeOutput(json, run) {
|
|
756
750
|
const stdoutWrite = process.stdout.write;
|
|
@@ -762,8 +756,7 @@ async function withAnalyzeOutput(json, run) {
|
|
|
762
756
|
process.stdout.write = stdoutWrite;
|
|
763
757
|
}
|
|
764
758
|
}
|
|
765
|
-
|
|
766
|
-
//#region src/cli/commands/analyze/action.ts
|
|
759
|
+
// src/cli/commands/analyze/action.ts
|
|
767
760
|
function printAnalysisSummary(result) {
|
|
768
761
|
const packageLabelMap = /* @__PURE__ */ new Map();
|
|
769
762
|
const packageModuleSet = /* @__PURE__ */ new Map();
|
|
@@ -1106,5 +1099,4 @@ async function runAnalyzeCommand(root, options) {
|
|
|
1106
1099
|
}
|
|
1107
1100
|
});
|
|
1108
1101
|
}
|
|
1109
|
-
//#endregion
|
|
1110
1102
|
export { runAnalyzeCommand };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { r as logger_default } from "./logger-DGn5iEVN.mjs";
|
|
2
|
-
import { o as resolveConfigFile } from "./options-
|
|
3
|
-
import { c as startWeappViteMcpServer, s as resolveWeappMcpConfig } from "./mcp-
|
|
4
|
-
import { a as inspectMcpClientConfig, i as resolveSupportedMcpClient, n as buildMcpClientConfigPlan, r as formatMcpQuickStart, t as writeMcpClientConfig } from "./mcpClient-
|
|
2
|
+
import { o as resolveConfigFile } from "./options-Cz8vZ-0w.mjs";
|
|
3
|
+
import { c as startWeappViteMcpServer, s as resolveWeappMcpConfig } from "./mcp-ovJgl1N9.mjs";
|
|
4
|
+
import { a as inspectMcpClientConfig, i as resolveSupportedMcpClient, n as buildMcpClientConfigPlan, r as formatMcpQuickStart, t as writeMcpClientConfig } from "./mcpClient-C8JzVZ46.mjs";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import path from "pathe";
|
|
7
7
|
import { runWithSuspendedSharedInput } from "weapp-ide-cli";
|
|
8
8
|
import { createInterface } from "node:readline/promises";
|
|
9
|
-
|
|
9
|
+
// src/cli/commands/mcp/action.ts
|
|
10
10
|
function resolvePort(port) {
|
|
11
11
|
if (typeof port === "number" && Number.isInteger(port)) return port;
|
|
12
12
|
if (typeof port === "string" && port.trim()) {
|
|
@@ -21,7 +21,7 @@ async function resolveHttpUrl(options) {
|
|
|
21
21
|
try {
|
|
22
22
|
if (workspaceRoot !== originalCwd) process.chdir(workspaceRoot);
|
|
23
23
|
const configFile = resolveConfigFile(options);
|
|
24
|
-
const { loadConfig } = await import("./loadConfig-
|
|
24
|
+
const { loadConfig } = await import("./loadConfig-D4WGJcYp.mjs");
|
|
25
25
|
const loaded = await loadConfig(configFile);
|
|
26
26
|
const resolved = resolveWeappMcpConfig(loaded?.config?.weapp?.mcp);
|
|
27
27
|
return `http://${resolved.host}:${resolved.port}${resolved.endpoint}`;
|
|
@@ -135,5 +135,4 @@ async function runMcpCommand(args, options) {
|
|
|
135
135
|
if (subcommand) throw new Error(`未知的 mcp 子命令:${subcommand}`);
|
|
136
136
|
await handleServer(options);
|
|
137
137
|
}
|
|
138
|
-
//#endregion
|
|
139
138
|
export { runMcpCommand };
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { c as getBackendForCapability, n as formatBytes, u as CompilerSession } from "./createCompilerContextInstance-
|
|
1
|
+
import { c as getBackendForCapability, n as formatBytes, u as CompilerSession } from "./createCompilerContextInstance-BXSdH2E8.mjs";
|
|
2
2
|
import { r as logger_default, t as colors } from "./logger-DGn5iEVN.mjs";
|
|
3
|
-
import { i as resolveRuntimeTargets, n as logRuntimeTarget, r as resolveConfiguredRuntimeTargets, t as createInlineConfig } from "./runtime-
|
|
4
|
-
import { i as resolveIdeProjectPath, n as openIde } from "./openIde-
|
|
5
|
-
import { a as parseDashboardUiHost, i as isUiEnabled, o as resolveConfigFile, r as filterDuplicateOptions } from "./options-
|
|
6
|
-
import { n as formatDuration, r as scheduleCompletedProductionBuildExit, t as logBuildAppFinish } from "./logBuildAppFinish-
|
|
7
|
-
import { n as createDashboardArtifactSnapshot } from "./artifacts-
|
|
8
|
-
import { i as startAnalyzeDashboard, n as writeAnalyzeHistorySnapshot, r as analyzeSubpackages, t as readLatestAnalyzeHistorySnapshot } from "./history-
|
|
9
|
-
import { t as setCommandNodeEnv } from "./nodeEnv-
|
|
10
|
-
import { a as resolveBuildUploadOptions } from "./report-
|
|
11
|
-
import { a as prepareAutoUploadMetadataWithRollback, n as executeUploadTarget, o as validateAutoUploadMetadata, t as createUploadTarget } from "./builtProject-
|
|
3
|
+
import { i as resolveRuntimeTargets, n as logRuntimeTarget, r as resolveConfiguredRuntimeTargets, t as createInlineConfig } from "./runtime-CKtMVERT.mjs";
|
|
4
|
+
import { i as resolveIdeProjectPath, n as openIde } from "./openIde-QoYKhuuM.mjs";
|
|
5
|
+
import { a as parseDashboardUiHost, i as isUiEnabled, o as resolveConfigFile, r as filterDuplicateOptions } from "./options-Cz8vZ-0w.mjs";
|
|
6
|
+
import { n as formatDuration, r as scheduleCompletedProductionBuildExit, t as logBuildAppFinish } from "./logBuildAppFinish-DOBoof6S.mjs";
|
|
7
|
+
import { n as createDashboardArtifactSnapshot } from "./artifacts-TrTX9_jj.mjs";
|
|
8
|
+
import { i as startAnalyzeDashboard, n as writeAnalyzeHistorySnapshot, r as analyzeSubpackages, t as readLatestAnalyzeHistorySnapshot } from "./history-dKxzoHmN.mjs";
|
|
9
|
+
import { t as setCommandNodeEnv } from "./nodeEnv-zq1EymWj.mjs";
|
|
10
|
+
import { a as resolveBuildUploadOptions } from "./report-PJVyo-UZ.mjs";
|
|
11
|
+
import { a as prepareAutoUploadMetadataWithRollback, n as executeUploadTarget, o as validateAutoUploadMetadata, t as createUploadTarget } from "./builtProject-B145uOt5.mjs";
|
|
12
12
|
import process from "node:process";
|
|
13
13
|
import { Buffer } from "node:buffer";
|
|
14
14
|
const WINDOWS_SEPARATOR_RE = /\\/g;
|
|
@@ -61,8 +61,7 @@ function logBuildPackageSizeReport(options) {
|
|
|
61
61
|
logger_default.warn(`[包体积] ${colors.yellow(report.label)} 体积 ${colors.yellow(formatBytes(report.bytes))},已超过阈值 ${colors.yellow(formatBytes(warningBytes))}。`);
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
-
|
|
65
|
-
//#region src/cli/commands/build/action.ts
|
|
64
|
+
// src/cli/commands/build/action.ts
|
|
66
65
|
function emitDashboardEvents(handle, events) {
|
|
67
66
|
handle?.emitRuntimeEvents(events);
|
|
68
67
|
}
|
|
@@ -243,5 +242,4 @@ async function runBuildCommand(cli, root, options) {
|
|
|
243
242
|
if (buildCompleted) scheduleCompletedProductionBuildExit(options, analyzeHandle);
|
|
244
243
|
}
|
|
245
244
|
}
|
|
246
|
-
//#endregion
|
|
247
245
|
export { runBuildCommand };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/dashboard/analyze/comparison.ts
|
|
2
2
|
function createModuleComparisonKey(source, sourceType) {
|
|
3
3
|
const origin = sourceType === "node_modules" || sourceType === "workspace" ? "dependency" : sourceType;
|
|
4
4
|
const queryIndex = source.indexOf("?");
|
|
@@ -141,16 +141,14 @@ function createAnalyzeComparison(current, previous) {
|
|
|
141
141
|
modules: compareSizeMaps(currentMaps.modules, previousMaps.modules)
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
|
|
145
|
-
//#region src/dashboard/analyze/moduleBytes.ts
|
|
144
|
+
// src/dashboard/analyze/moduleBytes.ts
|
|
146
145
|
/** 取每个原始模块 ID 的最大已知贡献,缺少产物贡献时使用原始体积。 */
|
|
147
146
|
function createModuleByteMap(result) {
|
|
148
147
|
const bytes = /* @__PURE__ */ new Map();
|
|
149
148
|
for (const pkg of result.packages) for (const file of pkg.files) for (const mod of file.modules ?? []) bytes.set(mod.id, Math.max(bytes.get(mod.id) ?? 0, mod.bytes ?? mod.originalBytes ?? 0));
|
|
150
149
|
return bytes;
|
|
151
150
|
}
|
|
152
|
-
|
|
153
|
-
//#region src/dashboard/analyze/duplicates.ts
|
|
151
|
+
// src/dashboard/analyze/duplicates.ts
|
|
154
152
|
function createDuplicateAdvice(sourceType, hasIndependentPackage, estimatedSavingBytes) {
|
|
155
153
|
if (hasIndependentPackage) return estimatedSavingBytes > 0 ? "含独立分包,先确认隔离要求,再评估是否抽公共入口。" : "含独立分包,重复可能来自隔离边界。";
|
|
156
154
|
if (sourceType === "node_modules") return "依赖被多个包带入,检查引用边界或考虑主包公共入口。";
|
|
@@ -180,5 +178,4 @@ function createDuplicateModuleInsights(result) {
|
|
|
180
178
|
};
|
|
181
179
|
}).sort((a, b) => b.estimatedSavingBytes - a.estimatedSavingBytes || b.packageCount - a.packageCount || b.bytes - a.bytes || a.source.localeCompare(b.source) || a.id.localeCompare(b.id));
|
|
182
180
|
}
|
|
183
|
-
//#endregion
|
|
184
181
|
export { createModuleByteMap as n, createAnalyzeComparison as r, createDuplicateModuleInsights as t };
|
|
@@ -3,7 +3,7 @@ import process from "node:process";
|
|
|
3
3
|
import path from "pathe";
|
|
4
4
|
import fs from "node:fs";
|
|
5
5
|
import { Buffer } from "node:buffer";
|
|
6
|
-
|
|
6
|
+
// src/dashboard/assets.ts
|
|
7
7
|
const ANALYZE_DASHBOARD_PACKAGE_NAME = "@weapp-vite/dashboard";
|
|
8
8
|
const require = createRequire(import.meta.url);
|
|
9
9
|
function parseDashboardManifest(source) {
|
|
@@ -65,8 +65,7 @@ function resolveDashboardClientAssets(cwd) {
|
|
|
65
65
|
const resolved = resolveDashboardPackage(cwd);
|
|
66
66
|
return resolved ? resolveDashboardDistRoot(resolved.root, resolved.manifest)?.root : void 0;
|
|
67
67
|
}
|
|
68
|
-
|
|
69
|
-
//#region src/dashboard/artifacts.ts
|
|
68
|
+
// src/dashboard/artifacts.ts
|
|
70
69
|
const MAX_DASHBOARD_FILE_CONTENT_BYTES = 2097152;
|
|
71
70
|
/** 保留同一次分析的产物内容,不读取或改写开发构建目录。 */
|
|
72
71
|
function createDashboardArtifactSnapshot() {
|
|
@@ -102,5 +101,4 @@ function createDashboardArtifactSnapshot() {
|
|
|
102
101
|
}
|
|
103
102
|
};
|
|
104
103
|
}
|
|
105
|
-
//#endregion
|
|
106
104
|
export { resolveDashboardInstallation as a, resolveDashboardClientAssets as i, createDashboardArtifactSnapshot as n, ANALYZE_DASHBOARD_PACKAGE_NAME as r, MAX_DASHBOARD_FILE_CONTENT_BYTES as t };
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { t as resolveRealpath } from "./realpathScope-
|
|
2
|
-
import { n as loadHostRolldownBuild } from "./engine-
|
|
3
|
-
import { a as hasOwn, i as resolveWeappLibEntries, o as waitForBuildTasks } from "./lib-
|
|
1
|
+
import { t as resolveRealpath } from "./realpathScope-DwlLaCk3.mjs";
|
|
2
|
+
import { n as loadHostRolldownBuild } from "./engine-Mnnm_ALP.mjs";
|
|
3
|
+
import { a as hasOwn, i as resolveWeappLibEntries, o as waitForBuildTasks } from "./lib-CJyMBzoe.mjs";
|
|
4
4
|
import { createRequire } from "node:module";
|
|
5
5
|
import process from "node:process";
|
|
6
6
|
import path from "pathe";
|
|
7
7
|
import "@weapp-core/shared";
|
|
8
8
|
import { fs } from "@weapp-core/shared/fs";
|
|
9
9
|
import { mkdtemp, readFile, readdir, rm } from "node:fs/promises";
|
|
10
|
-
import os from "node:os";
|
|
11
10
|
import { resolveModule } from "local-pkg";
|
|
11
|
+
import os from "node:os";
|
|
12
12
|
import { spawn } from "node:child_process";
|
|
13
13
|
import { dts } from "rolldown-plugin-dts";
|
|
14
|
-
|
|
14
|
+
// src/runtime/libDts/compilerOptions.ts
|
|
15
15
|
function serializeCompilerOptions(tsInstance, options) {
|
|
16
16
|
const serialized = { ...options };
|
|
17
17
|
const protocol = tsInstance.server.protocol;
|
|
@@ -40,8 +40,7 @@ function serializeCompilerOptions(tsInstance, options) {
|
|
|
40
40
|
if (options.lib) serialized.lib = options.lib.map((lib) => lib.replace(/^lib\.(.+)\.d\.ts$/i, "$1"));
|
|
41
41
|
return serialized;
|
|
42
42
|
}
|
|
43
|
-
|
|
44
|
-
//#region src/runtime/libDts/rewriteWevuComponent.ts
|
|
43
|
+
// src/runtime/libDts/rewriteWevuComponent.ts
|
|
45
44
|
function getVueCompilerLib(value) {
|
|
46
45
|
if (Array.isArray(value)) {
|
|
47
46
|
const resolved = value.filter((item) => typeof item === "string");
|
|
@@ -160,8 +159,7 @@ function shouldRewriteWevuComponentType(value) {
|
|
|
160
159
|
if (typeof value === "string") return value === "wevu";
|
|
161
160
|
return true;
|
|
162
161
|
}
|
|
163
|
-
|
|
164
|
-
//#region src/runtime/libDts/shared.ts
|
|
162
|
+
// src/runtime/libDts/shared.ts
|
|
165
163
|
const DTS_INPUT_EXTENSIONS = /* @__PURE__ */ new Set([
|
|
166
164
|
".ts",
|
|
167
165
|
".tsx",
|
|
@@ -315,8 +313,7 @@ function resolveVueSourceFile(program, filePath) {
|
|
|
315
313
|
if (sourceFile) return sourceFile;
|
|
316
314
|
}
|
|
317
315
|
}
|
|
318
|
-
|
|
319
|
-
//#region src/runtime/libDts/volar.ts
|
|
316
|
+
// src/runtime/libDts/volar.ts
|
|
320
317
|
const require = createRequire(import.meta.url);
|
|
321
318
|
function resolveAdapter() {
|
|
322
319
|
const modulePath = require.resolve("weapp-vite/volar");
|
|
@@ -367,8 +364,7 @@ function resolveInternalVolarPlugins(plugins, lib) {
|
|
|
367
364
|
if (!registered) resolved.push(factory);
|
|
368
365
|
return resolved;
|
|
369
366
|
}
|
|
370
|
-
|
|
371
|
-
//#region src/runtime/libDts/generateVueDts.ts
|
|
367
|
+
// src/runtime/libDts/generateVueDts.ts
|
|
372
368
|
const FILE_EXTENSION_RE = /\.[^.]+$/;
|
|
373
369
|
async function generateVueDtsWithVueTsc(configService, libConfig, vueEntries, dtsOptions) {
|
|
374
370
|
const ts = await import("typescript");
|
|
@@ -531,8 +527,7 @@ async function generateVueDtsWithInternal(configService, vueEntries, dtsOptions,
|
|
|
531
527
|
await fs.writeFile(outputPath, content);
|
|
532
528
|
}));
|
|
533
529
|
}
|
|
534
|
-
|
|
535
|
-
//#region src/runtime/libDts.ts
|
|
530
|
+
// src/runtime/libDts.ts
|
|
536
531
|
async function generateLibDts(configService, onWatchFile) {
|
|
537
532
|
const libConfig = configService.weappLibConfig;
|
|
538
533
|
if (!libConfig) return;
|
|
@@ -602,8 +597,7 @@ async function generateLibDts(configService, onWatchFile) {
|
|
|
602
597
|
}));
|
|
603
598
|
}
|
|
604
599
|
}
|
|
605
|
-
|
|
606
|
-
//#region src/runtime/libDts/assets.ts
|
|
600
|
+
// src/runtime/libDts/assets.ts
|
|
607
601
|
/** 声明编译器仅写入会话临时目录,最终产物由宿主统一 emit/write。 */
|
|
608
602
|
async function prepareLibDtsAssets(service, onWatchFile) {
|
|
609
603
|
const temporaryRoot = await mkdtemp(path.join(os.tmpdir(), "weapp-vite-lib-assets-"));
|
|
@@ -633,5 +627,4 @@ async function prepareLibDtsAssets(service, onWatchFile) {
|
|
|
633
627
|
});
|
|
634
628
|
}
|
|
635
629
|
}
|
|
636
|
-
//#endregion
|
|
637
630
|
export { prepareLibDtsAssets };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as UviewPlusResolver, c as CreateResolver, d as ResolvedValue, f as Resolver, g as ResolverSupportFilesStrategy, h as ResolverObject, i as VantResolver, l as ExternalMetadataFileCandidates, m as ResolverMeta, n as WotUiResolverOptions, o as UviewPlusResolverOptions, p as ResolverFn, r as WeuiResolver, s as TDesignResolver, t as WotUiResolver, u as Options } from "../index-
|
|
1
|
+
import { a as UviewPlusResolver, c as CreateResolver, d as ResolvedValue, f as Resolver, g as ResolverSupportFilesStrategy, h as ResolverObject, i as VantResolver, l as ExternalMetadataFileCandidates, m as ResolverMeta, n as WotUiResolverOptions, o as UviewPlusResolverOptions, p as ResolverFn, r as WeuiResolver, s as TDesignResolver, t as WotUiResolver, u as Options } from "../index-SnaW3cvA.mjs";
|
|
2
2
|
export { CreateResolver, ExternalMetadataFileCandidates, Options, ResolvedValue, Resolver, ResolverFn, ResolverMeta, ResolverObject, ResolverSupportFilesStrategy, TDesignResolver, UviewPlusResolver, UviewPlusResolverOptions, VantResolver, WeuiResolver, WotUiResolver, WotUiResolverOptions };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as TDesignResolver, i as UviewPlusResolver, r as VantResolver, n as WeuiResolver, t as WotUiResolver } from "../resolvers-
|
|
1
|
+
export { a as TDesignResolver, i as UviewPlusResolver, r as VantResolver, n as WeuiResolver, t as WotUiResolver } from "../resolvers-CKYqmRD_.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as wevuRouter } from "../wevu-router-
|
|
1
|
+
import { t as wevuRouter } from "../wevu-router-CdWurGQ4.mjs";
|
|
2
2
|
export { wevuRouter as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as default } from "../wevu-router-
|
|
1
|
+
export { t as default } from "../wevu-router-BIoxDbnu.mjs";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as wevu } from "../wevu-
|
|
1
|
+
import { t as wevu } from "../wevu-DTtSOyxB.mjs";
|
|
2
2
|
export { wevu as default };
|