@univer-cli/daemon 1.0.0-beta.2

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 ADDED
@@ -0,0 +1,86 @@
1
+ # @univer-cli/daemon
2
+
3
+ English | [简体中文](./README.zh-CN.md)
4
+
5
+ Let multiple short-lived local processes reuse the same resident Node.js process and send JSON requests over a Unix socket or Windows named pipe.
6
+
7
+ It is intended for services with high startup costs or in-memory state that must survive across CLI invocations. If the logic can run directly in the current process, or an HTTP or queue-based service boundary already exists, this package is unnecessary.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ pnpm add @univer-cli/daemon
13
+ ```
14
+
15
+ Requires Node.js 22.12 or higher.
16
+
17
+ ## How to work
18
+
19
+ When the client makes a request:
20
+
21
+ 1. It tries to connect to the specified socket.
22
+ 2. It verifies the running daemon's identity and protocol.
23
+ 3. If the socket is unavailable, it starts the entry provided by the application.
24
+ 4. It waits for a compatibility handshake.
25
+ 5. It sends a JSON request and returns the JSON response.
26
+
27
+ The package owns transport and lifecycle behavior. It does not define the application's business methods or resident state.
28
+
29
+ ## Create daemon entry
30
+
31
+ ```ts
32
+ import { createDaemonServer, DAEMON_SOCKET_ENV, type JsonValue } from "@univer-cli/daemon";
33
+
34
+ const socketPath = process.env[DAEMON_SOCKET_ENV];
35
+ if (!socketPath) throw new Error(`${DAEMON_SOCKET_ENV} is required`);
36
+
37
+ let value = 0;
38
+
39
+ const server = createDaemonServer({
40
+ identity: { id: "my-cli", version: "1.2.0" },
41
+ socketPath,
42
+ onShutdown: async () => {
43
+ value = 0;
44
+ },
45
+ });
46
+
47
+ server.handle("counter.add", async (payload) => {
48
+ if (typeof payload !== "number") throw new Error("Expected a number");
49
+ value += payload;
50
+ return value satisfies JsonValue;
51
+ });
52
+
53
+ await server.listen();
54
+ ```
55
+
56
+ Register every handler before `listen()`. `daemon.status` and `daemon.shutdown` are reserved methods and cannot be overridden by the application.
57
+
58
+ ## Send request
59
+
60
+ ```ts
61
+ import { createDaemonClient } from "@univer-cli/daemon";
62
+
63
+ const client = createDaemonClient({
64
+ entry: new URL("./counter-daemon.js", import.meta.url),
65
+ identity: { id: "my-cli", version: "1.2.0" },
66
+ socketPath: "/tmp/my-cli.sock",
67
+ });
68
+
69
+ const result = await client.request("counter.add", 2);
70
+ ```
71
+
72
+ Payloads and results must be JSON values. Request and startup timeouts can be configured independently. A timeout ends only the current client's wait; it does not terminate a daemon that has passed identity verification.
73
+
74
+ ## Explicit lifecycle control
75
+
76
+ `createDaemonControl()` provides `status()`, `start()`, `restart()`, and `stop()`. Use it to expose explicit management commands or clean up resident processes during upgrades or application shutdown.
77
+
78
+ For the preset command, see [`@univer-cli/daemon-command`](../daemon-command/README.md).
79
+
80
+ ## Identity and errors
81
+
82
+ Identity includes at least a stable application `id` and `version`, and may also include a build ID. The client does not reuse a process with an incompatible identity. Connection, handshake, protocol, timeout, and remote handler errors retain stable error codes so adapters can decide whether to suggest retrying, upgrading, or checking daemon logs.
83
+
84
+ ## Responsibility boundaries
85
+
86
+ The package is responsible for socket framing, on-demand startup, compatibility handshakes, request/response handling, timeouts, and socket cleanup. The application is responsible for the entrypoint, socket path, business methods, state, credentials, and shutdown cleanup.
@@ -0,0 +1,94 @@
1
+ # @univer-cli/daemon
2
+
3
+ [English](./README.md) | 简体中文
4
+
5
+ 让多个短生命周期的本地进程复用同一个常驻 Node.js 进程,并通过 Unix socket 或 Windows named pipe 发送
6
+ JSON 请求。
7
+
8
+ 它适合启动成本高、需要在多次 CLI 调用之间保留内存状态的服务。若逻辑可以直接在当前进程执行,或已有 HTTP、
9
+ 队列等服务边界,则不需要这个 package。
10
+
11
+ ## 安装
12
+
13
+ ```bash
14
+ pnpm add @univer-cli/daemon
15
+ ```
16
+
17
+ 要求 Node.js 22.12 或更高版本。
18
+
19
+ ## 工作方式
20
+
21
+ Client 请求时会:
22
+
23
+ 1. 尝试连接指定 socket;
24
+ 2. 校验已运行 daemon 的 identity 与 protocol;
25
+ 3. socket 不可用时启动 application 提供的 entry;
26
+ 4. 等待 compatibility handshake;
27
+ 5. 发送一次 JSON request 并返回 JSON response。
28
+
29
+ Package 负责 transport 和 lifecycle,不定义 application 的业务 method 或常驻状态。
30
+
31
+ ## 创建 daemon entry
32
+
33
+ ```ts
34
+ import { createDaemonServer, DAEMON_SOCKET_ENV, type JsonValue } from "@univer-cli/daemon";
35
+
36
+ const socketPath = process.env[DAEMON_SOCKET_ENV];
37
+ if (!socketPath) throw new Error(`${DAEMON_SOCKET_ENV} is required`);
38
+
39
+ let value = 0;
40
+
41
+ const server = createDaemonServer({
42
+ identity: { id: "my-cli", version: "1.2.0" },
43
+ socketPath,
44
+ onShutdown: async () => {
45
+ value = 0;
46
+ },
47
+ });
48
+
49
+ server.handle("counter.add", async (payload) => {
50
+ if (typeof payload !== "number") throw new Error("Expected a number");
51
+ value += payload;
52
+ return value satisfies JsonValue;
53
+ });
54
+
55
+ await server.listen();
56
+ ```
57
+
58
+ 所有 handler 必须在 `listen()` 前注册。`daemon.status` 和 `daemon.shutdown` 是保留 method,application
59
+ 不得覆盖。
60
+
61
+ ## 发送请求
62
+
63
+ ```ts
64
+ import { createDaemonClient } from "@univer-cli/daemon";
65
+
66
+ const client = createDaemonClient({
67
+ entry: new URL("./counter-daemon.js", import.meta.url),
68
+ identity: { id: "my-cli", version: "1.2.0" },
69
+ socketPath: "/tmp/my-cli.sock",
70
+ });
71
+
72
+ const result = await client.request("counter.add", 2);
73
+ ```
74
+
75
+ Payload 和结果必须是 JSON value。Request timeout 与启动 timeout 可分别配置;timeout 只终止当前 client
76
+ 等待,不会擅自杀死一个已通过 identity 校验的 daemon。
77
+
78
+ ## 显式 lifecycle control
79
+
80
+ `createDaemonControl()` 提供 `status()`、`start()`、`restart()` 和 `stop()`。适合 application 暴露
81
+ 显式管理命令,或在升级、退出时清理常驻进程。
82
+
83
+ 预设 command 见 [`@univer-cli/daemon-command`](../daemon-command/README.zh-CN.md)。
84
+
85
+ ## Identity 与错误
86
+
87
+ Identity 至少包含稳定的 application `id` 和 `version`,也可以加入 build ID。Client 不会复用 identity
88
+ 不兼容的进程。连接、handshake、协议、timeout 和远端 handler 错误会保留稳定 error code,便于 adapter 判断
89
+ 是否提示重试、升级或检查 daemon 日志。
90
+
91
+ ## 职责边界
92
+
93
+ Package 负责 socket framing、按需启动、compatibility handshake、request/response、timeout 和 socket 清理。
94
+ Application 负责 entry、socket 路径、业务 method、状态、凭证和 shutdown cleanup。
package/dist/index.cjs ADDED
@@ -0,0 +1 @@
1
+ 'use strict';module['exports']=require('./index.mjs');
@@ -0,0 +1,105 @@
1
+ //#region src/types.d.ts
2
+ type JsonValue = null | boolean | number | string | JsonValue[] | {
3
+ readonly [key: string]: JsonValue;
4
+ };
5
+ interface DaemonClient {
6
+ request(method: string, payload: JsonValue): Promise<JsonValue>;
7
+ }
8
+ interface DaemonIdentity {
9
+ readonly buildId?: string;
10
+ readonly id: string;
11
+ readonly version: string;
12
+ }
13
+ interface DaemonClientOptions {
14
+ readonly entry: string | URL;
15
+ readonly env?: NodeJS.ProcessEnv;
16
+ readonly identity: DaemonIdentity;
17
+ readonly requestTimeoutMs?: number;
18
+ readonly socketPath: string;
19
+ readonly startTimeoutMs?: number;
20
+ }
21
+ interface DaemonControl {
22
+ restart(): Promise<DaemonRestartResult>;
23
+ status(): Promise<DaemonStatus>;
24
+ start(): Promise<DaemonStartResult>;
25
+ stop(): Promise<DaemonStopResult>;
26
+ }
27
+ interface DaemonControlOptions extends DaemonClientOptions {
28
+ readonly stopTimeoutMs?: number;
29
+ }
30
+ type DaemonStatus = DaemonIncompatibleStatus | DaemonRunningStatus | DaemonStoppedStatus | DaemonUnreachableStatus;
31
+ type DaemonIncompatibilityReason = "build-id-mismatch" | "identity-mismatch" | "invalid-health" | "legacy-protocol" | "protocol-mismatch" | "version-mismatch";
32
+ interface DaemonIncompatibleStatus {
33
+ readonly actual?: DaemonHealth;
34
+ readonly diagnostic?: DaemonStatusDiagnostic;
35
+ readonly expected: {
36
+ readonly identity: DaemonIdentity;
37
+ readonly protocolVersion: number;
38
+ };
39
+ readonly reason: DaemonIncompatibilityReason;
40
+ readonly socketPath: string;
41
+ readonly state: "incompatible";
42
+ }
43
+ interface DaemonStatusDiagnostic {
44
+ readonly code?: string;
45
+ readonly message: string;
46
+ }
47
+ interface DaemonUnreachableStatus {
48
+ readonly diagnostic: DaemonStatusDiagnostic;
49
+ readonly socketPath: string;
50
+ readonly state: "unreachable";
51
+ }
52
+ interface DaemonHealth {
53
+ readonly identity: DaemonIdentity;
54
+ readonly pid: number;
55
+ readonly protocolVersion: number;
56
+ readonly socketPath: string;
57
+ readonly startedAt: string;
58
+ }
59
+ interface DaemonRunningStatus extends DaemonHealth {
60
+ readonly state: "running";
61
+ }
62
+ interface DaemonStoppedStatus {
63
+ readonly socketPath: string;
64
+ readonly state: "stopped";
65
+ }
66
+ interface DaemonStartResult extends DaemonRunningStatus {
67
+ readonly started: boolean;
68
+ }
69
+ interface DaemonRestartResult extends DaemonRunningStatus {
70
+ readonly previousPid?: number;
71
+ readonly restarted: boolean;
72
+ }
73
+ interface DaemonStopResult extends DaemonStoppedStatus {
74
+ readonly stopped: boolean;
75
+ }
76
+ type DaemonRequestHandler = (payload: JsonValue) => Promise<JsonValue>;
77
+ interface DaemonServer {
78
+ close(): Promise<void>;
79
+ handle(method: string, handler: DaemonRequestHandler): void;
80
+ listen(): Promise<void>;
81
+ }
82
+ interface DaemonServerOptions {
83
+ readonly identity: DaemonIdentity;
84
+ readonly onShutdown?: () => void | Promise<void>;
85
+ readonly socketPath: string;
86
+ }
87
+ //#endregion
88
+ //#region src/transport.d.ts
89
+ declare const DAEMON_SOCKET_ENV = "UNIVER_CLI_SDK_DAEMON_SOCKET";
90
+ //#endregion
91
+ //#region src/client.d.ts
92
+ declare function createDaemonClient(options: DaemonClientOptions): DaemonClient;
93
+ //#endregion
94
+ //#region src/control.d.ts
95
+ declare function createDaemonControl(options: DaemonControlOptions): DaemonControl;
96
+ //#endregion
97
+ //#region src/protocol.d.ts
98
+ declare const DAEMON_PROTOCOL_VERSION = 1;
99
+ declare const DAEMON_STATUS_METHOD = "daemon.status";
100
+ declare const DAEMON_SHUTDOWN_METHOD = "daemon.shutdown";
101
+ //#endregion
102
+ //#region src/server.d.ts
103
+ declare function createDaemonServer(options: DaemonServerOptions): DaemonServer;
104
+ //#endregion
105
+ export { DAEMON_PROTOCOL_VERSION, DAEMON_SHUTDOWN_METHOD, DAEMON_SOCKET_ENV, DAEMON_STATUS_METHOD, type DaemonClient, type DaemonClientOptions, type DaemonControl, type DaemonControlOptions, type DaemonHealth, type DaemonIdentity, type DaemonIncompatibilityReason, type DaemonIncompatibleStatus, type DaemonRequestHandler, type DaemonRestartResult, type DaemonRunningStatus, type DaemonServer, type DaemonServerOptions, type DaemonStartResult, type DaemonStatus, type DaemonStatusDiagnostic, type DaemonStopResult, type DaemonStoppedStatus, type DaemonUnreachableStatus, type JsonValue, createDaemonClient, createDaemonControl, createDaemonServer };
package/dist/index.mjs ADDED
@@ -0,0 +1 @@
1
+ const _0x29dbdc=_0x3348;(function(_0x3652e8,_0x58bb46){const _0x4bd4a5=_0x3348,_0x1cf728=_0x3652e8();while(!![]){try{const _0x50c236=parseInt(_0x4bd4a5(0x16a))/0x1*(parseInt(_0x4bd4a5(0x16f))/0x2)+parseInt(_0x4bd4a5(0x169))/0x3*(-parseInt(_0x4bd4a5(0x186))/0x4)+parseInt(_0x4bd4a5(0x16c))/0x5*(-parseInt(_0x4bd4a5(0x182))/0x6)+-parseInt(_0x4bd4a5(0x157))/0x7+parseInt(_0x4bd4a5(0x150))/0x8+-parseInt(_0x4bd4a5(0x12e))/0x9+-parseInt(_0x4bd4a5(0x141))/0xa*(-parseInt(_0x4bd4a5(0x152))/0xb);if(_0x50c236===_0x58bb46)break;else _0x1cf728['push'](_0x1cf728['shift']());}catch(_0x181512){_0x1cf728['push'](_0x1cf728['shift']());}}}(_0x7e6e,0x7faf0));import{randomUUID as _0x448610}from'node:crypto';function _0x3348(_0x3c0145,_0x121fb6){_0x3c0145=_0x3c0145-0x11a;const _0x7e6e50=_0x7e6e();let _0x3348f7=_0x7e6e50[_0x3c0145];return _0x3348f7;}import{spawn as _0x32267f}from'node:child_process';import{connect as _0x529c06,createServer as _0x4ff917}from'node:net';import{fileURLToPath as _0x2ec968}from'node:url';import{lstat as _0x151253,mkdir as _0x134c3c,unlink as _0x27ea54}from'node:fs/promises';import{dirname as _0x4dbd39}from'node:path';function l(_0x6e66c8){const _0x3aa5c2=_0x3348;return JSON[_0x3aa5c2(0x130)](_0x6e66c8)+'\x0a';}function u(_0x560925){let _0x20106c='';return{'end'(){const _0x23c382=_0x3348;_0x20106c[_0x23c382(0x12a)]()['length']>0x0&&_0x560925(_0x20106c),_0x20106c='';},'push'(_0x364373){const _0x537fa7=_0x3348;for(_0x20106c+=_0x364373[_0x537fa7(0x166)](_0x537fa7(0x165));;){let _0x3757db=_0x20106c[_0x537fa7(0x18c)]('\x0a');if(_0x3757db<0x0)return;let _0x1f6185=_0x20106c[_0x537fa7(0x13f)](0x0,_0x3757db);_0x20106c=_0x20106c['slice'](_0x3757db+0x1),_0x1f6185[_0x537fa7(0x12a)]()[_0x537fa7(0x168)]>0x0&&_0x560925(_0x1f6185);}}};}var d='UNIVER_CLI_SDK_DAEMON_SOCKET';async function f(_0x47b4c9){const _0x220506=_0x3348;_0x32267f(process[_0x220506(0x12b)],[_0x2ec968(_0x47b4c9[_0x220506(0x155)])],{'detached':!0x0,'env':{...process.env,..._0x47b4c9['options'][_0x220506(0x175)],[d]:_0x47b4c9[_0x220506(0x14f)][_0x220506(0x181)]},'stdio':'ignore'})[_0x220506(0x15a)]();let _0x25012b=Date[_0x220506(0x161)]();for(;Date[_0x220506(0x161)]()-_0x25012b<_0x47b4c9['timeoutMs'];){try{return await _0x47b4c9[_0x220506(0x16e)]();}catch(_0x1f766b){if(!h(_0x1f766b))throw _0x1f766b;}await new Promise(_0xa40ce0=>setTimeout(_0xa40ce0,0x19));}throw Object[_0x220506(0x171)](Error(_0x220506(0x159)+String(_0x47b4c9[_0x220506(0x176)])+'ms'),{'code':'DAEMON_START_TIMEOUT'});}function p(_0x1133cc,_0x453e49,_0x27fa1e,_0xada527){return new Promise((_0x3c502a,_0x352b11)=>{const _0x26225b=_0x3348;let _0x307a2e=_0x529c06(_0x1133cc),_0x3a6795=_0x448610(),_0x460252=!0x1,_0x3cff9c=setTimeout(()=>{const _0x41147d=_0x3348;_0x307a2e['destroy'](),_0x352b11(Object['assign'](Error(_0x41147d(0x160)+String(_0xada527)+'ms'),{'code':_0x41147d(0x15b)}));},_0xada527),_0x22d015=_0x5b2390=>{_0x460252||(_0x460252=!0x0,clearTimeout(_0x3cff9c),_0x5b2390());},_0x521de7=u(_0x365d7d=>{try{let _0x26e163=_(_0x365d7d,_0x3a6795);_0x22d015(()=>{const _0x23e177=_0x3348;_0x307a2e[_0x23e177(0x135)](),_0x26e163[_0x23e177(0x127)]===_0x23e177(0x143)?_0x352b11(v(_0x26e163[_0x23e177(0x143)])):_0x3c502a(_0x26e163[_0x23e177(0x12d)]);});}catch(_0x1177cf){_0x22d015(()=>{const _0x599edf=_0x3348;_0x307a2e[_0x599edf(0x18d)](),_0x352b11(_0x1177cf);});}});_0x307a2e['once'](_0x26225b(0x143),_0x32044d=>_0x22d015(()=>{const _0x578208=_0x26225b;_0x307a2e[_0x578208(0x18d)](),_0x352b11(_0x32044d);})),_0x307a2e['on'](_0x26225b(0x147),_0x1cf43c=>_0x521de7['push'](_0x1cf43c)),_0x307a2e['on']('end',()=>{const _0x5109c6=_0x26225b;_0x521de7[_0x5109c6(0x135)](),_0x22d015(()=>{const _0x3b4876=_0x5109c6;_0x307a2e[_0x3b4876(0x18d)](),_0x352b11(g());});}),_0x307a2e['on'](_0x26225b(0x137),()=>_0x22d015(()=>{const _0x1ad131=_0x26225b;_0x307a2e[_0x1ad131(0x18d)](),_0x352b11(g());})),_0x307a2e[_0x26225b(0x11d)](_0x26225b(0x133),()=>{const _0x5aa276=_0x26225b;_0x307a2e[_0x5aa276(0x13a)](l({'id':_0x3a6795,'method':_0x453e49,'payload':_0x27fa1e}));});});}function _0x7e6e(){const _0x563d01=['1300ipFuKE','isFinite','assign','buildId','DAEMON_STOP_TIMEOUT','toISOString','env','timeoutMs','daemon.status','Refusing\x20to\x20replace\x20non-socket\x20path\x20','set','reason','href','clear','payload','protocolVersion','Daemon\x20server\x20has\x20not\x20started\x20listening','exitCode','socketPath','760026UsvMqC','string','ECONNREFUSED','state','5108RfbYxf','Daemon\x20is\x20not\x20ready:\x20','pid','Error','daemon.shutdown','DAEMON_METHOD_NOT_FOUND','indexOf','destroy','Daemon\x20entry\x20must\x20be\x20an\x20absolute\x20file\x20URL','number','\x20is\x20already\x20registered','socketPath\x20must\x20not\x20be\x20empty','DAEMON_ALREADY_RUNNING','once','file:','shutdown','Invalid\x20daemon\x20response','parse','status','version','name','stopped','build-id-mismatch','type','ENOTCONN','daemon.','trim','execPath','identity.version','result','413775YYjjem','off','stringify','DAEMON_CONTROL_INVALID_RESPONSE','identity.id','connect','Invalid\x20daemon\x20request','end','protocol-mismatch','close','DAEMON_UNREACHABLE','object','write','catch','EADDRINUSE','DAEMON_INVALID_REQUEST','Daemon\x20method\x20must\x20not\x20be\x20empty','slice','Daemon\x20is\x20not\x20listening\x20on\x20','20JxseBn','message','error','A\x20daemon\x20is\x20already\x20listening\x20on\x20','method','DAEMON_CONNECTION_CLOSED','data','has','push','invalid-health','identity','isSafeInteger','isArray','isSocket','options','393656sdDqmH','isNaN','11994785KxXhaT','incompatible','startTimeoutMs','entry','running','4404169kOmTlR','diagnostic','Daemon\x20did\x20not\x20start\x20within\x20','unref','DAEMON_REQUEST_TIMEOUT','actual','startedAt','requestTimeoutMs','onShutdown','Daemon\x20request\x20timed\x20out\x20after\x20','now','version-mismatch','ENOENT','stopTimeoutMs','utf8','toString','unreachable','length','894teZIir','362YnYdVE','code','35scdkis','identity.buildId','ready'];_0x7e6e=function(){return _0x563d01;};return _0x7e6e();}function m(_0x14c523){const _0x544b0d=_0x3348;let _0x24bf30=_0x14c523 instanceof URL?_0x14c523['href']:_0x14c523;try{let _0x159db6=new URL(_0x24bf30);if(_0x159db6['protocol']!==_0x544b0d(0x11e))throw Error();return _0x159db6[_0x544b0d(0x17b)];}catch{throw Error(_0x544b0d(0x18e));}}function h(_0x5353c5){const _0x19a047=_0x3348;return y(_0x5353c5)?_0x5353c5[_0x19a047(0x16b)]===_0x19a047(0x163)||_0x5353c5[_0x19a047(0x16b)]===_0x19a047(0x184):!0x1;}function g(){const _0x27b0fb=_0x3348;return Object[_0x27b0fb(0x171)](Error('Daemon\x20connection\x20closed\x20before\x20a\x20response\x20was\x20received'),{'code':'DAEMON_CONNECTION_CLOSED'});}function _(_0x180a4d,_0x4f6c15){const _0x58a5ed=_0x3348;let _0x4ce7f2=JSON[_0x58a5ed(0x121)](_0x180a4d);if(!y(_0x4ce7f2)||_0x4ce7f2['id']!==_0x4f6c15)throw Error('Invalid\x20daemon\x20response');if(_0x4ce7f2['type']===_0x58a5ed(0x12d)&&_0x58a5ed(0x12d)in _0x4ce7f2||_0x4ce7f2[_0x58a5ed(0x127)]===_0x58a5ed(0x143)&&y(_0x4ce7f2['error']))return _0x4ce7f2;throw Error(_0x58a5ed(0x120));}function v(_0x454e85){const _0x2cee59=_0x3348;let _0x2a2592=Error(_0x454e85[_0x2cee59(0x142)]);return _0x454e85[_0x2cee59(0x16b)]!==void 0x0&&Object[_0x2cee59(0x171)](_0x2a2592,{'code':_0x454e85[_0x2cee59(0x16b)]}),_0x2a2592[_0x2cee59(0x124)]=_0x454e85[_0x2cee59(0x124)],_0x2a2592;}function y(_0x347f40){const _0x2d274f=_0x3348;return typeof _0x347f40==_0x2d274f(0x139)&&!!_0x347f40&&!Array['isArray'](_0x347f40);}function b(_0x4fb2a0){const _0x4e2be3=_0x3348;S(_0x4fb2a0['id'],_0x4e2be3(0x132)),S(_0x4fb2a0[_0x4e2be3(0x123)],_0x4e2be3(0x12c)),_0x4fb2a0['buildId']!==void 0x0&&S(_0x4fb2a0[_0x4e2be3(0x172)],_0x4e2be3(0x16d));}function x(_0x2b3838){const _0x6dbe80=_0x3348;return ee(_0x2b3838)&&typeof _0x2b3838['id']=='string'&&_0x2b3838['id']['length']>0x0&&typeof _0x2b3838[_0x6dbe80(0x123)]==_0x6dbe80(0x183)&&_0x2b3838['version']['length']>0x0&&(_0x2b3838[_0x6dbe80(0x172)]===void 0x0||typeof _0x2b3838[_0x6dbe80(0x172)]==_0x6dbe80(0x183)&&_0x2b3838['buildId']['length']>0x0);}function S(_0xe5a8f7,_0x19b6fa){if(_0xe5a8f7['length']===0x0)throw Error(_0x19b6fa+'\x20must\x20not\x20be\x20empty');}function ee(_0x22290b){const _0x2a8723=_0x3348;return typeof _0x22290b==_0x2a8723(0x139)&&!!_0x22290b&&!Array[_0x2a8723(0x14d)](_0x22290b);}var C=0x1,w='daemon.status',T=_0x29dbdc(0x18a);function E(_0x191a7c){const _0x3ba9de=_0x29dbdc;return _0x191a7c['startsWith'](_0x3ba9de(0x129));}var D=0x2710,O=0x19;function k(_0xe24abb){const _0x23abc1=_0x29dbdc;b(_0xe24abb['identity']);let _0x57a4a0=m(_0xe24abb[_0x23abc1(0x155)]),_0x192ae5=_0xe24abb[_0x23abc1(0x15e)]??0x7530,_0x2084c2=_0xe24abb[_0x23abc1(0x154)]??0x2710,_0x366541=_0xe24abb[_0x23abc1(0x164)]??D;z(_0x192ae5,_0x23abc1(0x15e)),z(_0x2084c2,_0x23abc1(0x154)),z(_0x366541,_0x23abc1(0x164));let _0x4744f0=()=>({'socketPath':_0xe24abb[_0x23abc1(0x181)],'state':_0x23abc1(0x125)}),_0x5934b1=async()=>{const _0x3f0eb9=_0x23abc1;try{let _0x2457cd=N(await p(_0xe24abb[_0x3f0eb9(0x181)],w,null,_0x192ae5),_0xe24abb[_0x3f0eb9(0x181)]),_0x5c1c7c=te(_0xe24abb['identity'],_0x2457cd);return _0x5c1c7c===void 0x0?_0x2457cd:ne(_0xe24abb[_0x3f0eb9(0x14b)],_0x2457cd,_0x5c1c7c,_0xe24abb[_0x3f0eb9(0x181)]);}catch(_0x3a70cd){if(h(_0x3a70cd))return _0x4744f0();let _0x36c6a7=L(_0x3a70cd);return _0x36c6a7[_0x3f0eb9(0x16b)]===_0x3f0eb9(0x18b)?j(_0xe24abb[_0x3f0eb9(0x14b)],'legacy-protocol',_0xe24abb['socketPath'],_0x36c6a7):_0x36c6a7['code']===_0x3f0eb9(0x131)?j(_0xe24abb[_0x3f0eb9(0x14b)],_0x3f0eb9(0x14a),_0xe24abb[_0x3f0eb9(0x181)],_0x36c6a7):{'diagnostic':_0x36c6a7,'socketPath':_0xe24abb[_0x3f0eb9(0x181)],'state':_0x3f0eb9(0x167)};}},_0x23d366=async()=>{const _0x510201=_0x23abc1;let _0x2042a9=await _0x5934b1();if(_0x2042a9[_0x510201(0x185)]==='running')return{..._0x2042a9,'started':!0x1};if(_0x2042a9[_0x510201(0x185)]!=='stopped')throw M(_0x2042a9);return{...await f({'entry':_0x57a4a0,'options':_0xe24abb,'ready':async()=>{const _0x3403b6=_0x510201;let _0x1c465a=await _0x5934b1();if(_0x1c465a['state']===_0x3403b6(0x125))throw F(_0xe24abb[_0x3403b6(0x181)]);if(_0x1c465a[_0x3403b6(0x185)]!=='running')throw M(_0x1c465a);return _0x1c465a;},'timeoutMs':_0x2084c2}),'started':!0x0};},_0x1dd210=async()=>{const _0x40fd43=_0x23abc1;let _0x390d93=await _0x5934b1();if(_0x390d93[_0x40fd43(0x185)]===_0x40fd43(0x125))return{..._0x390d93,'stopped':!0x1};if(_0x390d93[_0x40fd43(0x185)]!==_0x40fd43(0x156)&&!A(_0x390d93))throw M(_0x390d93);try{await p(_0xe24abb[_0x40fd43(0x181)],T,null,_0x192ae5);}catch(_0x29f520){if(!I(_0x29f520))throw _0x29f520;}return await P(_0x5934b1,_0x366541),{..._0x4744f0(),'stopped':!0x0};};return{async 'restart'(){const _0x314e9c=_0x23abc1;let _0x2b5447=await _0x5934b1();if(_0x2b5447[_0x314e9c(0x185)]!=='running'&&_0x2b5447['state']!==_0x314e9c(0x125)&&!A(_0x2b5447))throw M(_0x2b5447);(_0x2b5447[_0x314e9c(0x185)]===_0x314e9c(0x156)||A(_0x2b5447))&&await _0x1dd210();let _0x193717=await _0x23d366(),_0x36d75a=_0x2b5447[_0x314e9c(0x185)]==='running'?_0x2b5447[_0x314e9c(0x188)]:A(_0x2b5447)?_0x2b5447[_0x314e9c(0x15c)][_0x314e9c(0x188)]:void 0x0;return{'identity':_0x193717[_0x314e9c(0x14b)],'pid':_0x193717[_0x314e9c(0x188)],..._0x36d75a===void 0x0?{}:{'previousPid':_0x36d75a},'restarted':_0x2b5447[_0x314e9c(0x185)]!=='stopped','protocolVersion':_0x193717['protocolVersion'],'socketPath':_0x193717[_0x314e9c(0x181)],'startedAt':_0x193717[_0x314e9c(0x15d)],'state':'running'};},'start':_0x23d366,'status':_0x5934b1,'stop':_0x1dd210};}function A(_0x436801){const _0xab9413=_0x29dbdc;return _0x436801['state']===_0xab9413(0x153)&&_0x436801[_0xab9413(0x15c)]!==void 0x0&&(_0x436801[_0xab9413(0x17a)]===_0xab9413(0x162)||_0x436801[_0xab9413(0x17a)]===_0xab9413(0x126));}function te(_0x503711,_0x2be9a1){const _0x54ec35=_0x29dbdc;if(_0x2be9a1[_0x54ec35(0x17e)]!==0x1)return _0x54ec35(0x136);if(_0x2be9a1['identity']['id']!==_0x503711['id'])return'identity-mismatch';if(_0x2be9a1[_0x54ec35(0x14b)]['version']!==_0x503711[_0x54ec35(0x123)])return'version-mismatch';if(_0x503711[_0x54ec35(0x172)]!==void 0x0&&_0x2be9a1[_0x54ec35(0x14b)][_0x54ec35(0x172)]!==_0x503711[_0x54ec35(0x172)])return'build-id-mismatch';}function ne(_0x47afd8,_0x9f109e,_0x49dff5,_0x57e320){const _0x2c4c29=_0x29dbdc;return{'actual':{'identity':_0x9f109e['identity'],'pid':_0x9f109e[_0x2c4c29(0x188)],'protocolVersion':_0x9f109e[_0x2c4c29(0x17e)],'socketPath':_0x9f109e[_0x2c4c29(0x181)],'startedAt':_0x9f109e['startedAt']},'expected':{'identity':_0x47afd8,'protocolVersion':0x1},'reason':_0x49dff5,'socketPath':_0x57e320,'state':_0x2c4c29(0x153)};}function j(_0x3d20d7,_0x4ce2f7,_0xe360e9,_0x3dd594){const _0x431f2d=_0x29dbdc;return{'diagnostic':_0x3dd594,'expected':{'identity':_0x3d20d7,'protocolVersion':0x1},'reason':_0x4ce2f7,'socketPath':_0xe360e9,'state':_0x431f2d(0x153)};}function M(_0x205d9a){const _0x1cb85f=_0x29dbdc;let _0x4c1a2e=_0x205d9a[_0x1cb85f(0x185)]===_0x1cb85f(0x153)?_0x205d9a['reason']:_0x205d9a[_0x1cb85f(0x158)]['message'];return R(_0x205d9a['state']===_0x1cb85f(0x153)?'DAEMON_INCOMPATIBLE':_0x1cb85f(0x138),_0x1cb85f(0x187)+_0x4c1a2e);}function N(_0x19fd65,_0x91429c){const _0xdcdbec=_0x29dbdc;if(!B(_0x19fd65)||_0x19fd65[_0xdcdbec(0x185)]!==_0xdcdbec(0x156)||_0x19fd65['socketPath']!==_0x91429c||!x(_0x19fd65[_0xdcdbec(0x14b)])||typeof _0x19fd65[_0xdcdbec(0x188)]!=_0xdcdbec(0x18f)||!Number[_0xdcdbec(0x14c)](_0x19fd65['pid'])||_0x19fd65[_0xdcdbec(0x188)]<=0x0||typeof _0x19fd65[_0xdcdbec(0x17e)]!=_0xdcdbec(0x18f)||!Number[_0xdcdbec(0x14c)](_0x19fd65['protocolVersion'])||_0x19fd65[_0xdcdbec(0x17e)]<=0x0||typeof _0x19fd65['startedAt']!=_0xdcdbec(0x183)||Number[_0xdcdbec(0x151)](Date[_0xdcdbec(0x121)](_0x19fd65[_0xdcdbec(0x15d)])))throw R(_0xdcdbec(0x131),'Daemon\x20status\x20response\x20is\x20invalid');return{'identity':_0x19fd65[_0xdcdbec(0x14b)],'pid':_0x19fd65[_0xdcdbec(0x188)],'protocolVersion':_0x19fd65[_0xdcdbec(0x17e)],'socketPath':_0x91429c,'startedAt':_0x19fd65['startedAt'],'state':_0xdcdbec(0x156)};}async function P(_0x3d9b56,_0x448aee){const _0x448ac7=_0x29dbdc;let _0x1e399d=Date[_0x448ac7(0x161)]();for(;Date[_0x448ac7(0x161)]()-_0x1e399d<_0x448aee;){if((await _0x3d9b56())[_0x448ac7(0x185)]===_0x448ac7(0x125))return;await new Promise(_0x451e48=>setTimeout(_0x451e48,O));}throw R(_0x448ac7(0x173),'Daemon\x20did\x20not\x20stop\x20within\x20'+String(_0x448aee)+'ms');}function F(_0x427242){const _0x527a20=_0x29dbdc;return Object[_0x527a20(0x171)](Error(_0x527a20(0x140)+_0x427242),{'code':_0x527a20(0x184)});}function I(_0x43ea42){const _0x12ed00=_0x29dbdc;return h(_0x43ea42)||B(_0x43ea42)&&(_0x43ea42[_0x12ed00(0x16b)]===_0x12ed00(0x146)||_0x43ea42['code']==='ECONNRESET'||_0x43ea42[_0x12ed00(0x16b)]===_0x12ed00(0x128)||_0x43ea42[_0x12ed00(0x16b)]==='EPIPE');}function L(_0x111f99){const _0x75b7f0=_0x29dbdc;let _0x4455e2=_0x111f99 instanceof Error?_0x111f99['message']:String(_0x111f99);return B(_0x111f99)&&typeof _0x111f99[_0x75b7f0(0x16b)]==_0x75b7f0(0x183)?{'code':_0x111f99[_0x75b7f0(0x16b)],'message':_0x4455e2}:{'message':_0x4455e2};}function R(_0x36e398,_0x5503e6){const _0x57aeba=_0x29dbdc;return Object[_0x57aeba(0x171)](Error(_0x5503e6),{'code':_0x36e398});}function z(_0x133c29,_0x169ee7){const _0x2e5098=_0x29dbdc;if(!Number[_0x2e5098(0x170)](_0x133c29)||_0x133c29<=0x0)throw Error(_0x169ee7+'\x20must\x20be\x20a\x20finite\x20positive\x20number');}function B(_0x35114b){const _0x38e333=_0x29dbdc;return typeof _0x35114b==_0x38e333(0x139)&&!!_0x35114b&&!Array[_0x38e333(0x14d)](_0x35114b);}function V(_0x3890a2){const _0x479793=_0x29dbdc;let _0x3c9021=_0x3890a2[_0x479793(0x15e)]??0x7530,_0x5c617b=k(_0x3890a2),_0x36e293,_0x1a2dd5=async()=>{const _0x187c14=_0x479793;let _0x19c50f=await _0x5c617b[_0x187c14(0x122)]();if(_0x19c50f['state']===_0x187c14(0x156))return _0x19c50f;if(_0x19c50f[_0x187c14(0x185)]!=='stopped')throw M(_0x19c50f);let _0x31b254=_0x36e293??=_0x5c617b['start']();try{return await _0x31b254;}finally{_0x36e293===_0x31b254&&(_0x36e293=void 0x0);}};return{async 'request'(_0x26ac5b,_0x404165){const _0x1ecde1=_0x479793;if(_0x26ac5b['length']===0x0)throw Error(_0x1ecde1(0x13e));await _0x1a2dd5();try{return await p(_0x3890a2[_0x1ecde1(0x181)],_0x26ac5b,_0x404165,_0x3c9021);}catch(_0x332365){if(!h(_0x332365))throw _0x332365;}return await _0x1a2dd5(),await p(_0x3890a2[_0x1ecde1(0x181)],_0x26ac5b,_0x404165,_0x3c9021);}};}function H(_0x598ddd){const _0x46dc5e=_0x29dbdc;oe(_0x598ddd[_0x46dc5e(0x181)]),b(_0x598ddd[_0x46dc5e(0x14b)]);let _0x323a0b=new Map(),_0x355a15=new Set(),_0x30405f,_0x2c59bf=!0x1,_0x59b31b,_0x5c5430,_0x1319d8={async 'close'(){_0x59b31b??=_0x511454(),await _0x59b31b;},'handle'(_0x537221,_0x24a7c9){const _0x191332=_0x46dc5e;if(_0x2c59bf)throw Error('Daemon\x20handlers\x20must\x20be\x20registered\x20before\x20listen()');if(_0x537221[_0x191332(0x168)]===0x0)throw Error(_0x191332(0x13e));if(E(_0x537221))throw Error('Daemon\x20method\x20namespace\x20is\x20reserved:\x20'+_0x537221);if(_0x323a0b[_0x191332(0x148)](_0x537221))throw Error('Daemon\x20method\x20'+_0x537221+_0x191332(0x11a));_0x323a0b[_0x191332(0x179)](_0x537221,_0x24a7c9);},async 'listen'(){const _0x3b239b=_0x46dc5e;if(!_0x2c59bf){if(_0x59b31b)throw Error('Daemon\x20server\x20is\x20closed');await _0x134c3c(_0x4dbd39(_0x598ddd['socketPath']),{'recursive':!0x0}),await Y(_0x598ddd[_0x3b239b(0x181)]),_0x30405f=_0x4ff917(_0x2e90e5=>U(_0x2e90e5,_0x323a0b,_0x355a15,{'shutdown':()=>{const _0x453d7a=_0x3b239b;_0x1319d8[_0x453d7a(0x137)]()[_0x453d7a(0x13b)](()=>{const _0x412c19=_0x453d7a;process[_0x412c19(0x180)]=0x1;});},'status':()=>G(_0x598ddd[_0x3b239b(0x14b)],_0x598ddd[_0x3b239b(0x181)],_0x5c5430)})),await new Promise((_0x995e5a,_0x28763a)=>{const _0x545cf2=_0x3b239b;let _0x54c017=_0x30405f,_0x13158c=_0x472281=>_0x28763a(ae(_0x472281)?Z(_0x598ddd[_0x545cf2(0x181)]):_0x472281);_0x54c017['once'](_0x545cf2(0x143),_0x13158c),_0x54c017['listen'](_0x598ddd[_0x545cf2(0x181)],()=>{const _0x3e7bb3=_0x545cf2;_0x54c017[_0x3e7bb3(0x12f)](_0x3e7bb3(0x143),_0x13158c),_0x2c59bf=!0x0,_0x5c5430=new Date()[_0x3e7bb3(0x174)](),_0x995e5a();});});}}};return _0x1319d8;async function _0x511454(){const _0x3269a7=_0x46dc5e;for(let _0x16be47 of _0x355a15)_0x16be47[_0x3269a7(0x18d)]();_0x355a15[_0x3269a7(0x17c)](),_0x30405f&&_0x2c59bf&&await new Promise((_0x3571da,_0x3fd8ae)=>{const _0x2e2307=_0x3269a7;_0x30405f[_0x2e2307(0x137)](_0x55587a=>_0x55587a?_0x3fd8ae(_0x55587a):_0x3571da());}),_0x2c59bf=!0x1;try{await _0x598ddd[_0x3269a7(0x15f)]?.();}finally{await re(_0x598ddd[_0x3269a7(0x181)]);}}}function U(_0x115963,_0x401d91,_0x7ab6bf,_0x36af51){const _0x510448=_0x29dbdc;_0x7ab6bf['add'](_0x115963);let _0x11b5f2=!0x1,_0x356a53=u(_0x5798ff=>{_0x11b5f2||(_0x11b5f2=!0x0,W(_0x115963,_0x5798ff,_0x401d91,_0x36af51));});_0x115963['on']('data',_0x47c987=>_0x356a53[_0x510448(0x149)](_0x47c987)),_0x115963['on']('end',()=>_0x356a53['end']()),_0x115963['on']('close',()=>_0x7ab6bf['delete'](_0x115963)),_0x115963['on'](_0x510448(0x143),()=>_0x115963['destroy']());}async function W(_0x28b633,_0x18e759,_0x3dea15,_0x2eb4de){const _0x7fc169=_0x29dbdc;let _0x50806d='unknown',_0x5c3d3d,_0x474294=!0x1;try{let _0xe39772=K(_0x18e759);_0x50806d=_0xe39772['id'];let _0x44b97e;if(_0xe39772['method']===_0x7fc169(0x177)){let _0x1c9ef6=_0x2eb4de[_0x7fc169(0x122)]();_0x44b97e={'identity':{..._0x1c9ef6[_0x7fc169(0x14b)][_0x7fc169(0x172)]===void 0x0?{}:{'buildId':_0x1c9ef6[_0x7fc169(0x14b)]['buildId']},'id':_0x1c9ef6['identity']['id'],'version':_0x1c9ef6[_0x7fc169(0x14b)][_0x7fc169(0x123)]},'pid':_0x1c9ef6[_0x7fc169(0x188)],'protocolVersion':_0x1c9ef6[_0x7fc169(0x17e)],'socketPath':_0x1c9ef6[_0x7fc169(0x181)],'startedAt':_0x1c9ef6[_0x7fc169(0x15d)],'state':_0x1c9ef6[_0x7fc169(0x185)]};}else{if(_0xe39772[_0x7fc169(0x145)]==='daemon.shutdown')_0x44b97e=null,_0x474294=!0x0;else{let _0x1372ef=_0x3dea15['get'](_0xe39772[_0x7fc169(0x145)]);if(!_0x1372ef)throw J(_0x7fc169(0x18b),'Unknown\x20daemon\x20method\x20'+_0xe39772['method']);_0x44b97e=await _0x1372ef(_0xe39772[_0x7fc169(0x17d)]);}}_0x5c3d3d={'id':_0x50806d,'result':_0x44b97e,'type':_0x7fc169(0x12d)};}catch(_0x3d8cbc){_0x5c3d3d={'error':q(_0x3d8cbc),'id':_0x50806d,'type':'error'};}_0x28b633[_0x7fc169(0x135)](l(_0x5c3d3d),()=>{const _0x193f51=_0x7fc169;_0x474294&&_0x2eb4de[_0x193f51(0x11f)]();});}function G(_0x3b809d,_0x11f47e,_0x3eaaef){const _0x1ada49=_0x29dbdc;if(_0x3eaaef===void 0x0)throw Error(_0x1ada49(0x17f));return{'identity':_0x3b809d,'pid':process[_0x1ada49(0x188)],'protocolVersion':0x1,'socketPath':_0x11f47e,'startedAt':_0x3eaaef,'state':_0x1ada49(0x156)};}function K(_0x2e67dd){const _0xa3069f=_0x29dbdc;let _0x4989fd=JSON[_0xa3069f(0x121)](_0x2e67dd);if(!$(_0x4989fd)||typeof _0x4989fd['id']!=_0xa3069f(0x183)||typeof _0x4989fd[_0xa3069f(0x145)]!=_0xa3069f(0x183)||!(_0xa3069f(0x17d)in _0x4989fd))throw J(_0xa3069f(0x13d),_0xa3069f(0x134));return _0x4989fd;}function q(_0x5d7ad3){const _0x2b2537=_0x29dbdc;if(_0x5d7ad3 instanceof Error){let _0x2c210a=_0x5d7ad3[_0x2b2537(0x16b)];return{...typeof _0x2c210a==_0x2b2537(0x183)?{'code':_0x2c210a}:{},'message':_0x5d7ad3['message'],'name':_0x5d7ad3['name']};}return{'message':String(_0x5d7ad3),'name':_0x2b2537(0x189)};}function J(_0x507ba9,_0x19026f){return Object['assign'](Error(_0x19026f),{'code':_0x507ba9});}async function Y(_0x213cda){const _0x5dd5ef=_0x29dbdc;try{if(!(await _0x151253(_0x213cda))[_0x5dd5ef(0x14e)]())throw Error(_0x5dd5ef(0x178)+_0x213cda);if(await X(_0x213cda))throw Z(_0x213cda);await _0x27ea54(_0x213cda);}catch(_0x39306d){if(Q(_0x39306d))return;throw _0x39306d;}}function X(_0x1c1c46){return new Promise((_0x883ce8,_0x419abb)=>{const _0x4c5f89=_0x3348;let _0x505639=_0x529c06(_0x1c1c46);_0x505639[_0x4c5f89(0x11d)]('connect',()=>{const _0x5522b7=_0x4c5f89;_0x505639[_0x5522b7(0x18d)](),_0x883ce8(!0x0);}),_0x505639[_0x4c5f89(0x11d)](_0x4c5f89(0x143),_0x594cd2=>{_0x505639['destroy'](),ie(_0x594cd2)||Q(_0x594cd2)?_0x883ce8(!0x1):_0x419abb(_0x594cd2);});});}function Z(_0x2bc093){const _0x59928b=_0x29dbdc;return Object[_0x59928b(0x171)](Error(_0x59928b(0x144)+_0x2bc093),{'code':_0x59928b(0x11c)});}async function re(_0x4e307d){try{(await _0x151253(_0x4e307d))['isSocket']()&&await _0x27ea54(_0x4e307d);}catch(_0x51d3c9){if(!Q(_0x51d3c9))throw _0x51d3c9;}}function Q(_0x2e3375){const _0x50f0c5=_0x29dbdc;return $(_0x2e3375)&&_0x2e3375[_0x50f0c5(0x16b)]===_0x50f0c5(0x163);}function ie(_0x20f9e0){const _0x13ab6e=_0x29dbdc;return $(_0x20f9e0)&&_0x20f9e0[_0x13ab6e(0x16b)]==='ECONNREFUSED';}function ae(_0x3214a3){const _0x183fee=_0x29dbdc;return $(_0x3214a3)&&_0x3214a3[_0x183fee(0x16b)]===_0x183fee(0x13c);}function oe(_0x49357f){const _0x15256a=_0x29dbdc;if(_0x49357f[_0x15256a(0x168)]===0x0)throw Error(_0x15256a(0x11b));}function $(_0x44475b){const _0x2c4dea=_0x29dbdc;return typeof _0x44475b==_0x2c4dea(0x139)&&!!_0x44475b&&!Array[_0x2c4dea(0x14d)](_0x44475b);}export{C as DAEMON_PROTOCOL_VERSION,T as DAEMON_SHUTDOWN_METHOD,d as DAEMON_SOCKET_ENV,w as DAEMON_STATUS_METHOD,V as createDaemonClient,k as createDaemonControl,H as createDaemonServer};
package/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@univer-cli/daemon",
3
+ "type": "module",
4
+ "version": "1.0.0-beta.2",
5
+ "main": "./dist/index.cjs",
6
+ "module": "./dist/index.mjs",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.mjs",
12
+ "require": "./dist/index.cjs"
13
+ }
14
+ },
15
+ "files": [
16
+ "dist",
17
+ "README.md",
18
+ "README.zh-CN.md"
19
+ ]
20
+ }