@cc-monitoring/proxy-core 0.4.3 → 0.4.4
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/cli/__tests__/commands.test.js +4 -1
- package/dist/cli/index.js +5 -0
- package/dist/docs/404.html +1 -1
- package/dist/docs/assets/{app.D3ZWFMdh.js → app.CjQvyEo5.js} +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.DdOdtTxI.js +1 -0
- package/dist/docs/assets/chunks/{VPLocalSearchBox.D7u_reyg.js → VPLocalSearchBox.M4dBuYqX.js} +1 -1
- package/dist/docs/assets/chunks/{theme.DjTLYPOt.js → theme.5bK01na6.js} +2 -2
- package/dist/docs/index.html +2 -2
- package/dist/docs/overview.html +2 -2
- package/dist/docs/packages-utils.html +2 -2
- package/dist/docs/proxy-admin/env-and-build.html +2 -2
- package/dist/docs/proxy-admin/index.html +2 -2
- package/dist/docs/proxy-admin/layout-and-menu.html +2 -2
- package/dist/docs/proxy-admin/pages.html +2 -2
- package/dist/docs/proxy-admin/routing-and-auth.html +2 -2
- package/dist/docs/proxy-admin/services-and-mock.html +2 -2
- package/dist/docs/proxy-cli/api-layer.html +2 -2
- package/dist/docs/proxy-cli/app-shell.html +2 -2
- package/dist/docs/proxy-cli/components-common.html +2 -2
- package/dist/docs/proxy-cli/components-config.html +2 -2
- package/dist/docs/proxy-cli/components-requests.html +2 -2
- package/dist/docs/proxy-cli/components-stats.html +2 -2
- package/dist/docs/proxy-cli/components-status.html +2 -2
- package/dist/docs/proxy-cli/data-hooks.html +2 -2
- package/dist/docs/proxy-cli/index.html +2 -2
- package/dist/docs/proxy-cli/utils-and-i18n.html +2 -2
- package/dist/docs/proxy-core/chat-api.html +2 -2
- package/dist/docs/proxy-core/cli.html +2 -2
- package/dist/docs/proxy-core/config.html +2 -2
- package/dist/docs/proxy-core/data-layer.html +2 -2
- package/dist/docs/proxy-core/entry.html +2 -2
- package/dist/docs/proxy-core/index.html +2 -2
- package/dist/docs/proxy-core/pm2.html +2 -2
- package/dist/docs/proxy-core/providers.html +2 -2
- package/dist/docs/proxy-core/proxy.html +2 -2
- package/dist/docs/proxy-core/stats.html +2 -2
- package/dist/docs/proxy-core/tool.html +2 -2
- package/dist/docs/proxy-core/ui-routes.html +2 -2
- package/dist/docs/proxy-core/utilities.html +2 -2
- package/dist/docs/quickstart.html +2 -2
- package/dist/docs/request-flow.html +2 -2
- package/dist/logger/__tests__/logger.test.js +13 -0
- package/dist/logger/index.js +3 -1
- package/dist/server/proxy.js +2 -0
- package/dist/utils/__tests__/pm2.test.js +33 -2
- package/dist/utils/pm2.d.ts +1 -0
- package/dist/utils/pm2.js +34 -23
- package/package.json +1 -1
- package/dist/docs/assets/chunks/@localSearchIndexroot.BOtEa2K_.js +0 -1
|
@@ -67,6 +67,7 @@ jest.mock('fs', () => ({
|
|
|
67
67
|
}));
|
|
68
68
|
// esm-dirname is mocked via moduleNameMapper in jest.config.cjs (uses import.meta.url)
|
|
69
69
|
import { startCommand } from '../commands/start';
|
|
70
|
+
import { disconnectPm2 } from '@utils/pm2';
|
|
70
71
|
import { stopCommand } from '../commands/stop';
|
|
71
72
|
import { statusCommand } from '../commands/status';
|
|
72
73
|
import { logsCommand } from '../commands/logs';
|
|
@@ -79,7 +80,9 @@ import { loadConfig, saveConfig, resetConfig } from '@config/index';
|
|
|
79
80
|
import { readLogs } from '@logger/index';
|
|
80
81
|
jest.spyOn(console, 'log').mockImplementation(() => { });
|
|
81
82
|
jest.spyOn(console, 'error').mockImplementation(() => { });
|
|
82
|
-
beforeEach(() => {
|
|
83
|
+
beforeEach(async () => {
|
|
84
|
+
// 重置 pm2.ts 的模块级连接单例,否则会复用旧 Promise 跳过 connect
|
|
85
|
+
await disconnectPm2();
|
|
83
86
|
resetMockState();
|
|
84
87
|
jest.clearAllMocks();
|
|
85
88
|
});
|
package/dist/cli/index.js
CHANGED
|
@@ -44,6 +44,11 @@ program
|
|
|
44
44
|
if (opts.config) {
|
|
45
45
|
setConfigPathOverride(path.resolve(opts.config));
|
|
46
46
|
}
|
|
47
|
+
})
|
|
48
|
+
// 一次性命令执行完后断开 pm2 共享连接,否则 axon socket 会挂住 event loop 导致进程不退出
|
|
49
|
+
.hook('postAction', async () => {
|
|
50
|
+
const { disconnectPm2 } = await import('../utils/pm2.js');
|
|
51
|
+
await disconnectPm2();
|
|
47
52
|
});
|
|
48
53
|
program.command('prompt')
|
|
49
54
|
.alias('p')
|
package/dist/docs/404.html
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<link rel="preload stylesheet" href="/docs/assets/style.DU_kNMWy.css" as="style">
|
|
10
10
|
<link rel="preload stylesheet" href="/docs/vp-icons.css" as="style">
|
|
11
11
|
|
|
12
|
-
<script type="module" src="/docs/assets/app.
|
|
12
|
+
<script type="module" src="/docs/assets/app.CjQvyEo5.js"></script>
|
|
13
13
|
<link rel="preload" href="/docs/assets/inter-roman-latin.Di8DUHzh.woff2" as="font" type="font/woff2" crossorigin="">
|
|
14
14
|
<script id="check-dark-mode">(()=>{const e=localStorage.getItem("vitepress-theme-appearance")||"auto",a=window.matchMedia("(prefers-color-scheme: dark)").matches;(!e||e==="auto"?a:e==="dark")&&document.documentElement.classList.add("dark")})();</script>
|
|
15
15
|
<script id="check-mac-os">document.documentElement.classList.toggle("mac",/Mac|iPhone|iPod|iPad/i.test(navigator.platform));</script>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as p}from"./chunks/theme.
|
|
1
|
+
import{t as p}from"./chunks/theme.5bK01na6.js";import{R as s,a3 as i,a4 as u,a5 as c,a6 as l,a7 as f,a8 as d,a9 as m,aa as h,ab as g,ac as A,d as v,u as y,v as C,s as P,ad as b,ae as w,af as R,ag as E}from"./chunks/framework.D_Xv2a7c.js";function r(e){if(e.extends){const a=r(e.extends);return{...a,...e,async enhanceApp(t){a.enhanceApp&&await a.enhanceApp(t),e.enhanceApp&&await e.enhanceApp(t)}}}return e}const n=r(p),S=v({name:"VitePressApp",setup(){const{site:e,lang:a,dir:t}=y();return C(()=>{P(()=>{document.documentElement.lang=a.value,document.documentElement.dir=t.value})}),e.value.router.prefetchLinks&&b(),w(),R(),n.setup&&n.setup(),()=>E(n.Layout)}});async function T(){globalThis.__VITEPRESS__=!0;const e=_(),a=D();a.provide(u,e);const t=c(e.route);return a.provide(l,t),a.component("Content",f),a.component("ClientOnly",d),Object.defineProperties(a.config.globalProperties,{$frontmatter:{get(){return t.frontmatter.value}},$params:{get(){return t.page.value.params}}}),n.enhanceApp&&await n.enhanceApp({app:a,router:e,siteData:m}),{app:a,router:e,data:t}}function D(){return A(S)}function _(){let e=s;return h(a=>{let t=g(a),o=null;return t&&(e&&(t=t.replace(/\.js$/,".lean.js")),o=import(t)),s&&(e=!1),o},n.NotFound)}s&&T().then(({app:e,router:a,data:t})=>{a.go().then(()=>{i(a.route,t.site),e.mount("#app")})});export{T as createApp};
|