@opensumi/ide-core-node 2.21.13 → 2.22.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/lib/bootstrap/app.d.ts +2 -0
- package/lib/bootstrap/app.d.ts.map +1 -1
- package/lib/bootstrap/app.js +3 -3
- package/lib/bootstrap/app.js.map +1 -1
- package/lib/bootstrap/shell-path.js +1 -1
- package/lib/bootstrap/shell-path.js.map +1 -1
- package/lib/common-module/common.server.js.map +1 -1
- package/lib/common-module/credential.server.d.ts.map +1 -1
- package/lib/common-module/credential.server.js +3 -1
- package/lib/common-module/credential.server.js.map +1 -1
- package/lib/common-module/crypto.server.js.map +1 -1
- package/lib/common-module/index.js.map +1 -1
- package/lib/connection.d.ts +1 -0
- package/lib/connection.d.ts.map +1 -1
- package/lib/connection.js +3 -7
- package/lib/connection.js.map +1 -1
- package/lib/hash-calculate/hash-calculate.contribution.js.map +1 -1
- package/lib/logger/node-logger.d.ts +1 -1
- package/lib/logger/node-logger.d.ts.map +1 -1
- package/lib/logger/node-logger.js.map +1 -1
- package/lib/types.d.ts +4 -2
- package/lib/types.d.ts.map +1 -1
- package/package.json +8 -7
- package/src/bootstrap/app.ts +252 -0
- package/src/bootstrap/index.ts +2 -0
- package/src/bootstrap/inner-providers.ts +42 -0
- package/src/bootstrap/shell-path.ts +116 -0
- package/src/common-module/common.server.ts +9 -0
- package/src/common-module/credential.server.ts +92 -0
- package/src/common-module/crypto.server.ts +50 -0
- package/src/common-module/index.ts +49 -0
- package/src/connection.ts +142 -0
- package/src/hash-calculate/hash-calculate.contribution.ts +19 -0
- package/src/index.ts +12 -0
- package/src/logger/node-logger.ts +68 -0
- package/src/node-module.ts +3 -0
- package/src/types.ts +143 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import type cp from 'child_process';
|
|
2
|
+
import type http from 'http';
|
|
3
|
+
import type https from 'https';
|
|
4
|
+
|
|
5
|
+
import type Koa from 'koa';
|
|
6
|
+
import type ws from 'ws';
|
|
7
|
+
|
|
8
|
+
import type { Injector } from '@opensumi/di';
|
|
9
|
+
import type { WebSocketHandler } from '@opensumi/ide-connection/lib/node';
|
|
10
|
+
import type { ConstructorOf, ILogService, LogLevel, MaybePromise } from '@opensumi/ide-core-common';
|
|
11
|
+
import { BasicModule } from '@opensumi/ide-core-common';
|
|
12
|
+
|
|
13
|
+
export abstract class NodeModule extends BasicModule {}
|
|
14
|
+
|
|
15
|
+
export type ModuleConstructor = ConstructorOf<NodeModule>;
|
|
16
|
+
export type ContributionConstructor = ConstructorOf<ServerAppContribution>;
|
|
17
|
+
|
|
18
|
+
export const AppConfig = Symbol('AppConfig');
|
|
19
|
+
|
|
20
|
+
export interface MarketplaceRequest {
|
|
21
|
+
path?: string;
|
|
22
|
+
headers?: {
|
|
23
|
+
[header: string]: string | string[] | undefined;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface MarketplaceConfig {
|
|
28
|
+
endpoint: string;
|
|
29
|
+
// 插件市场下载到本地的位置,默认 ~/.sumi/extensions
|
|
30
|
+
extensionDir: string;
|
|
31
|
+
// 是否显示内置插件,默认隐藏
|
|
32
|
+
showBuiltinExtensions: boolean;
|
|
33
|
+
// 插件市场中申请到的客户端的 accountId
|
|
34
|
+
accountId: string;
|
|
35
|
+
// 插件市场中申请到的客户端的 masterKey
|
|
36
|
+
masterKey: string;
|
|
37
|
+
// 插件市场参数转换函数
|
|
38
|
+
transformRequest?: (request: MarketplaceRequest) => MarketplaceRequest;
|
|
39
|
+
// 在热门插件、搜索插件时忽略的插件 id
|
|
40
|
+
ignoreId: string[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
interface Config {
|
|
44
|
+
/**
|
|
45
|
+
* 初始化的 DI 实例,一般可在外部进行 DI 初始化之后传入,便于提前进行一些依赖的初始化
|
|
46
|
+
*/
|
|
47
|
+
injector: Injector;
|
|
48
|
+
/**
|
|
49
|
+
* 设置落盘日志级别,默认为 Info 级别的log落盘
|
|
50
|
+
*/
|
|
51
|
+
logLevel?: LogLevel;
|
|
52
|
+
/**
|
|
53
|
+
* 设置日志的目录,默认:~/.sumi/logs
|
|
54
|
+
*/
|
|
55
|
+
logDir?: string;
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated 可通过在传入的 `injector` 初始化 `ILogService` 进行实现替换
|
|
58
|
+
* 外部设置的 ILogService,替换默认的 logService
|
|
59
|
+
*/
|
|
60
|
+
LogServiceClass?: ConstructorOf<ILogService>;
|
|
61
|
+
/**
|
|
62
|
+
* 启用插件进程的最大个数
|
|
63
|
+
*/
|
|
64
|
+
maxExtProcessCount?: number;
|
|
65
|
+
/**
|
|
66
|
+
* 插件日志自定义实现路径
|
|
67
|
+
*/
|
|
68
|
+
extLogServiceClassPath?: string;
|
|
69
|
+
/**
|
|
70
|
+
* 插件进程关闭时间
|
|
71
|
+
*/
|
|
72
|
+
processCloseExitThreshold?: number;
|
|
73
|
+
/**
|
|
74
|
+
* 终端 pty 进程退出时间
|
|
75
|
+
*/
|
|
76
|
+
terminalPtyCloseThreshold?: number;
|
|
77
|
+
/**
|
|
78
|
+
* 访问静态资源允许的 origin
|
|
79
|
+
*/
|
|
80
|
+
staticAllowOrigin?: string;
|
|
81
|
+
/**
|
|
82
|
+
* 访问静态资源允许的路径,用于配置静态资源的白名单规则
|
|
83
|
+
*/
|
|
84
|
+
staticAllowPath?: string[];
|
|
85
|
+
/**
|
|
86
|
+
* 文件服务禁止访问的路径,使用 glob 匹配
|
|
87
|
+
*/
|
|
88
|
+
blockPatterns?: string[];
|
|
89
|
+
/**
|
|
90
|
+
* 获取插件进程句柄方法
|
|
91
|
+
* @deprecated 自测 1.30.0 后,不在提供给 IDE 后端发送插件进程的方法
|
|
92
|
+
*/
|
|
93
|
+
onDidCreateExtensionHostProcess?: (cp: cp.ChildProcess) => void;
|
|
94
|
+
/**
|
|
95
|
+
* 插件 Node 进程入口文件
|
|
96
|
+
*/
|
|
97
|
+
extHost?: string;
|
|
98
|
+
/**
|
|
99
|
+
* 插件进程存放用于通信的 sock 地址
|
|
100
|
+
* 默认为 /tmp
|
|
101
|
+
*/
|
|
102
|
+
extHostIPCSockPath?: string;
|
|
103
|
+
/**
|
|
104
|
+
* 插件进程 fork 配置
|
|
105
|
+
*/
|
|
106
|
+
extHostForkOptions?: Partial<cp.ForkOptions>;
|
|
107
|
+
/**
|
|
108
|
+
* 配置关闭 keytar 校验能力,默认开启
|
|
109
|
+
*/
|
|
110
|
+
disableKeytar?: boolean;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface AppConfig extends Partial<Config> {
|
|
114
|
+
marketplace: MarketplaceConfig;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface IServerAppOpts extends Partial<Config> {
|
|
118
|
+
modules?: ModuleConstructor[];
|
|
119
|
+
contributions?: ContributionConstructor[];
|
|
120
|
+
modulesInstances?: NodeModule[];
|
|
121
|
+
webSocketHandler?: WebSocketHandler[];
|
|
122
|
+
wsServerOptions?: ws.ServerOptions;
|
|
123
|
+
pathMatchOptions?: {
|
|
124
|
+
// When true the regexp will match to the end of the string.
|
|
125
|
+
end?: boolean;
|
|
126
|
+
};
|
|
127
|
+
marketplace?: Partial<MarketplaceConfig>;
|
|
128
|
+
use?(middleware: Koa.Middleware<Koa.ParameterizedContext<any, any>>): void;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export const ServerAppContribution = Symbol('ServerAppContribution');
|
|
132
|
+
|
|
133
|
+
export interface ServerAppContribution {
|
|
134
|
+
initialize?(app: IServerApp): MaybePromise<void>;
|
|
135
|
+
onStart?(app: IServerApp): MaybePromise<void>;
|
|
136
|
+
onStop?(app: IServerApp): MaybePromise<void>;
|
|
137
|
+
onWillUseElectronMain?(): void;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface IServerApp {
|
|
141
|
+
use(middleware: Koa.Middleware<Koa.ParameterizedContext<any, any>>): void;
|
|
142
|
+
start(server: http.Server | https.Server): Promise<void>;
|
|
143
|
+
}
|