mocode-ai 1.0.4 → 1.0.5
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/bin/mocode.js +17 -0
- package/package.json +1 -1
package/bin/mocode.js
CHANGED
|
@@ -1,4 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// mocode 全局入口:shebang + 拉起编译产物。子命令(--resume / config)路由在 dist/index.js 的 main() 内,
|
|
3
3
|
// 用动态 import 按需加载,避免 `mocode config`(零配置时)触发 config/index.ts 的 requireEnv 退出。
|
|
4
|
+
|
|
5
|
+
// 抑制 openai v4 -> node-fetch v2 -> whatwg-url v5 链触发的 Node 内置 punycode 弃用警告,
|
|
6
|
+
// 防止 [DEP0040] 输出污染终端 UI 的输入框区域。
|
|
7
|
+
const originalEmit = process.emit;
|
|
8
|
+
process.emit = function (event, warning, ...args) {
|
|
9
|
+
if (
|
|
10
|
+
event === 'warning' &&
|
|
11
|
+
warning &&
|
|
12
|
+
warning.code === 'DEP0040' &&
|
|
13
|
+
typeof warning.message === 'string' &&
|
|
14
|
+
warning.message.includes('punycode')
|
|
15
|
+
) {
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return originalEmit.apply(this, [event, warning, ...args]);
|
|
19
|
+
};
|
|
20
|
+
|
|
4
21
|
await import('../dist/index.js');
|