@opensumi/ide-core-common 2.22.9 → 2.22.10-next-1679279762.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/index.d.ts CHANGED
@@ -9,8 +9,6 @@ export * from './command';
9
9
  export * from './menu';
10
10
  export * from './localize';
11
11
  export * from './types';
12
- export * from './application-props';
13
- export * from './application-error';
14
12
  export * from './preferences';
15
13
  export * from './storage';
16
14
  export * from './network';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,yBAAyB,CAAC;AACxC,cAAc,oBAAoB,CAAC"}
package/lib/index.js CHANGED
@@ -12,8 +12,6 @@ tslib_1.__exportStar(require("./command"), exports);
12
12
  tslib_1.__exportStar(require("./menu"), exports);
13
13
  tslib_1.__exportStar(require("./localize"), exports);
14
14
  tslib_1.__exportStar(require("./types"), exports);
15
- tslib_1.__exportStar(require("./application-props"), exports);
16
- tslib_1.__exportStar(require("./application-error"), exports);
17
15
  tslib_1.__exportStar(require("./preferences"), exports);
18
16
  tslib_1.__exportStar(require("./storage"), exports);
19
17
  tslib_1.__exportStar(require("./network"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,sDAA4B;AAC5B,kEAAwC;AACxC,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,mDAAyB;AACzB,oDAA0B;AAC1B,iDAAuB;AACvB,qDAA2B;AAC3B,kDAAwB;AACxB,8DAAoC;AACpC,8DAAoC;AACpC,wDAA8B;AAC9B,oDAA0B;AAC1B,oDAA0B;AAC1B,gDAAsB;AACtB,wDAA8B;AAC9B,qDAA2B;AAC3B,uDAA6B;AAC7B,sDAA4B;AAC5B,kDAAwB;AACxB,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,sDAA4B;AAC5B,qDAA2B;AAC3B,kDAAwB;AACxB,gDAAsB;AACtB,uDAA6B;AAC7B,mDAAyB;AACzB,qDAA2B;AAC3B,qDAA2B;AAC3B,kDAAwB;AACxB,sDAA4B;AAC5B,iDAAuB;AACvB,kEAAwC;AACxC,6DAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,sDAA4B;AAC5B,sDAA4B;AAC5B,kEAAwC;AACxC,oDAA0B;AAC1B,mDAAyB;AACzB,sDAA4B;AAC5B,mDAAyB;AACzB,oDAA0B;AAC1B,iDAAuB;AACvB,qDAA2B;AAC3B,kDAAwB;AACxB,wDAA8B;AAC9B,oDAA0B;AAC1B,oDAA0B;AAC1B,gDAAsB;AACtB,wDAA8B;AAC9B,qDAA2B;AAC3B,uDAA6B;AAC7B,sDAA4B;AAC5B,kDAAwB;AACxB,4DAAkC;AAClC,4DAAkC;AAClC,4DAAkC;AAClC,sDAA4B;AAC5B,sDAA4B;AAC5B,qDAA2B;AAC3B,kDAAwB;AACxB,gDAAsB;AACtB,uDAA6B;AAC7B,mDAAyB;AACzB,qDAA2B;AAC3B,qDAA2B;AAC3B,kDAAwB;AACxB,sDAA4B;AAC5B,iDAAuB;AACvB,kEAAwC;AACxC,6DAAmC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensumi/ide-core-common",
3
- "version": "2.22.9",
3
+ "version": "2.22.10-next-1679279762.0",
4
4
  "description": "@opensumi/ide-core-common",
5
5
  "files": [
6
6
  "lib",
@@ -19,11 +19,11 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@opensumi/di": "^1.4.0",
22
- "@opensumi/ide-utils": "2.22.9",
22
+ "@opensumi/ide-utils": "2.22.10-next-1679279762.0",
23
23
  "jschardet": "3.0.0"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@opensumi/ide-dev-tool": "1.3.1"
27
27
  },
28
- "gitHead": "5f9389bcdc39dc8a17e8f8cf4a94ce324c26efb5"
28
+ "gitHead": "367000b9d70d6b555eeaa7ac0a9ecb39b052161d"
29
29
  }
package/src/index.ts CHANGED
@@ -9,8 +9,6 @@ export * from './command';
9
9
  export * from './menu';
10
10
  export * from './localize';
11
11
  export * from './types';
12
- export * from './application-props';
13
- export * from './application-error';
14
12
  export * from './preferences';
15
13
  export * from './storage';
16
14
  export * from './network';
@@ -1,36 +0,0 @@
1
- /** ******************************************************************************
2
- * Copyright (C) 2018 Red Hat, Inc. and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- export interface ApplicationError<C extends number, D> extends Error {
17
- readonly code: C;
18
- readonly data: D;
19
- toJson(): ApplicationError.Literal<D>;
20
- }
21
- export declare namespace ApplicationError {
22
- interface Literal<D> {
23
- message: string;
24
- data: D;
25
- stack?: string;
26
- }
27
- interface Constructor<C extends number, D> {
28
- (...args: any[]): ApplicationError<C, D>;
29
- code: C;
30
- is(arg: object | undefined): arg is ApplicationError<C, D>;
31
- }
32
- function declare<C extends number, D>(code: C, factory: (...args: any[]) => Literal<D>): Constructor<C, D>;
33
- function is<C extends number, D>(arg: object | undefined): arg is ApplicationError<C, D>;
34
- function fromJson<C extends number, D>(code: C, raw: Literal<D>): ApplicationError<C, D>;
35
- }
36
- //# sourceMappingURL=application-error.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-error.d.ts","sourceRoot":"","sources":["../src/application-error.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAGlF,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,CAAE,SAAQ,KAAK;IAClE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;IACjB,MAAM,IAAI,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CACvC;AACD,yBAAiB,gBAAgB,CAAC;IAChC,UAAiB,OAAO,CAAC,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,CAAC,CAAC;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB;IACD,UAAiB,WAAW,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC;QAC9C,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACzC,IAAI,EAAE,CAAC,CAAC;QACR,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KAC5D;IAGD,SAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAiBhH;IACD,SAAgB,EAAE,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,GAAG,IAAI,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAE9F;IACD,SAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAE9F;CAkBF"}
@@ -1,70 +0,0 @@
1
- "use strict";
2
- /** ******************************************************************************
3
- * Copyright (C) 2018 Red Hat, Inc. and others.
4
- *
5
- * This program and the accompanying materials are made available under the
6
- * terms of the Eclipse Public License v. 2.0 which is available at
7
- * http://www.eclipse.org/legal/epl-2.0.
8
- *
9
- * This Source Code may also be made available under the following Secondary
10
- * Licenses when the conditions for such availability set forth in the Eclipse
11
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
- * with the GNU Classpath Exception which is available at
13
- * https://www.gnu.org/software/classpath/license.html.
14
- *
15
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
16
- ********************************************************************************/
17
- // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/common/application-error.ts
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.ApplicationError = void 0;
20
- var ApplicationError;
21
- (function (ApplicationError) {
22
- const codes = [];
23
- // 用于定义应用错误码
24
- function declare(code, factory) {
25
- if (codes.indexOf(code) !== -1) {
26
- throw new Error(`An application error for '${code}' code is already declared`);
27
- }
28
- const constructorOpt = Object.assign((...args) => new Impl(code, factory(...args), constructorOpt), {
29
- code,
30
- is(arg) {
31
- // JSON RPC通信后,错误的构造信息丢失,通过 Error 类的 cause 属性保存 ApplicationError 实例来修复。
32
- // 需要加上第一个判断,否则过不了语法检查。
33
- if (arg instanceof Error && arg.cause) {
34
- const cause = arg.cause;
35
- return cause instanceof Impl && cause.code === code;
36
- }
37
- return arg instanceof Impl && arg.code === code;
38
- },
39
- });
40
- return constructorOpt;
41
- }
42
- ApplicationError.declare = declare;
43
- function is(arg) {
44
- return arg instanceof Impl;
45
- }
46
- ApplicationError.is = is;
47
- function fromJson(code, raw) {
48
- return new Impl(code, raw);
49
- }
50
- ApplicationError.fromJson = fromJson;
51
- class Impl extends Error {
52
- constructor(code, raw, constructorOpt) {
53
- super(raw.message);
54
- this.code = code;
55
- this.data = raw.data;
56
- Object.setPrototypeOf(this, Impl.prototype);
57
- if (raw.stack) {
58
- this.stack = raw.stack;
59
- }
60
- else if (Error.captureStackTrace && constructorOpt) {
61
- Error.captureStackTrace(this, constructorOpt);
62
- }
63
- }
64
- toJson() {
65
- const { message, data, stack } = this;
66
- return { message, data, stack };
67
- }
68
- }
69
- })(ApplicationError = exports.ApplicationError || (exports.ApplicationError = {}));
70
- //# sourceMappingURL=application-error.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-error.js","sourceRoot":"","sources":["../src/application-error.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;AAClF,uIAAuI;;;AAOvI,IAAiB,gBAAgB,CAsDhC;AAtDD,WAAiB,gBAAgB;IAW/B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,YAAY;IACZ,SAAgB,OAAO,CAAsB,IAAO,EAAE,OAAuC;QAC3F,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;YAC9B,MAAM,IAAI,KAAK,CAAC,6BAA6B,IAAI,4BAA4B,CAAC,CAAC;SAChF;QACD,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAW,EAAE,EAAE,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,EAAE,cAAc,CAAC,EAAE;YACzG,IAAI;YACJ,EAAE,CAAC,GAAuB;gBACxB,uEAAuE;gBACvE,uBAAuB;gBACvB,IAAI,GAAG,YAAY,KAAK,IAAI,GAAG,CAAC,KAAK,EAAE;oBACrC,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;oBACxB,OAAO,KAAK,YAAY,IAAI,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC;iBACrD;gBACD,OAAO,GAAG,YAAY,IAAI,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,CAAC;YAClD,CAAC;SACF,CAAC,CAAC;QACH,OAAO,cAAc,CAAC;IACxB,CAAC;IAjBe,wBAAO,UAiBtB,CAAA;IACD,SAAgB,EAAE,CAAsB,GAAuB;QAC7D,OAAO,GAAG,YAAY,IAAI,CAAC;IAC7B,CAAC;IAFe,mBAAE,KAEjB,CAAA;IACD,SAAgB,QAAQ,CAAsB,IAAO,EAAE,GAAe;QACpE,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC;IAFe,yBAAQ,WAEvB,CAAA;IACD,MAAM,IAA0B,SAAQ,KAAK;QAE3C,YAAqB,IAAO,EAAE,GAAgC,EAAE,cAAyB;YACvF,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YADA,SAAI,GAAJ,IAAI,CAAG;YAE1B,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC;YACrB,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;YAC5C,IAAI,GAAG,CAAC,KAAK,EAAE;gBACb,IAAI,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC;aACxB;iBAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,cAAc,EAAE;gBACpD,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;aAC/C;QACH,CAAC;QACD,MAAM;YACJ,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;YACtC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;QAClC,CAAC;KACF;AACH,CAAC,EAtDgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAsDhC"}
@@ -1,26 +0,0 @@
1
- /**
2
- * 应用基础配置类型.
3
- */
4
- export interface ApplicationConfig {
5
- readonly [key: string]: any;
6
- }
7
- /**
8
- * 前端应用配置
9
- * 下列的属性在页面启动时会注入到`index.html`中的window对象中
10
- */
11
- export interface ClientAppConfig extends ApplicationConfig {
12
- /**
13
- * 默认主题
14
- */
15
- readonly defaultTheme?: string;
16
- /**
17
- * 应用名称
18
- */
19
- readonly applicationName: string;
20
- /**
21
- * 默认内部的 uriScheme,用于桌面版 app 的唤起
22
- * 也默认为 vscode.env.uriScheme 的值
23
- */
24
- readonly uriScheme: string;
25
- }
26
- //# sourceMappingURL=application-props.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-props.d.ts","sourceRoot":"","sources":["../src/application-props.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CAC7B;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,iBAAiB;IACxD;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IAEjC;;;OAGG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B"}
@@ -1,3 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- //# sourceMappingURL=application-props.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"application-props.js","sourceRoot":"","sources":["../src/application-props.ts"],"names":[],"mappings":""}
@@ -1,77 +0,0 @@
1
- /** ******************************************************************************
2
- * Copyright (C) 2018 Red Hat, Inc. and others.
3
- *
4
- * This program and the accompanying materials are made available under the
5
- * terms of the Eclipse Public License v. 2.0 which is available at
6
- * http://www.eclipse.org/legal/epl-2.0.
7
- *
8
- * This Source Code may also be made available under the following Secondary
9
- * Licenses when the conditions for such availability set forth in the Eclipse
10
- * Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- * with the GNU Classpath Exception which is available at
12
- * https://www.gnu.org/software/classpath/license.html.
13
- *
14
- * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- ********************************************************************************/
16
- // Some code copied and modified from https://github.com/eclipse-theia/theia/tree/v1.14.0/packages/core/src/common/application-error.ts
17
-
18
- export interface ApplicationError<C extends number, D> extends Error {
19
- readonly code: C;
20
- readonly data: D;
21
- toJson(): ApplicationError.Literal<D>;
22
- }
23
- export namespace ApplicationError {
24
- export interface Literal<D> {
25
- message: string;
26
- data: D;
27
- stack?: string;
28
- }
29
- export interface Constructor<C extends number, D> {
30
- (...args: any[]): ApplicationError<C, D>;
31
- code: C;
32
- is(arg: object | undefined): arg is ApplicationError<C, D>;
33
- }
34
- const codes: number[] = [];
35
- // 用于定义应用错误码
36
- export function declare<C extends number, D>(code: C, factory: (...args: any[]) => Literal<D>): Constructor<C, D> {
37
- if (codes.indexOf(code) !== -1) {
38
- throw new Error(`An application error for '${code}' code is already declared`);
39
- }
40
- const constructorOpt = Object.assign((...args: any[]) => new Impl(code, factory(...args), constructorOpt), {
41
- code,
42
- is(arg: object | undefined): arg is ApplicationError<C, D> {
43
- // JSON RPC通信后,错误的构造信息丢失,通过 Error 类的 cause 属性保存 ApplicationError 实例来修复。
44
- // 需要加上第一个判断,否则过不了语法检查。
45
- if (arg instanceof Error && arg.cause) {
46
- const cause = arg.cause;
47
- return cause instanceof Impl && cause.code === code;
48
- }
49
- return arg instanceof Impl && arg.code === code;
50
- },
51
- });
52
- return constructorOpt;
53
- }
54
- export function is<C extends number, D>(arg: object | undefined): arg is ApplicationError<C, D> {
55
- return arg instanceof Impl;
56
- }
57
- export function fromJson<C extends number, D>(code: C, raw: Literal<D>): ApplicationError<C, D> {
58
- return new Impl(code, raw);
59
- }
60
- class Impl<C extends number, D> extends Error implements ApplicationError<C, D> {
61
- readonly data: D;
62
- constructor(readonly code: C, raw: ApplicationError.Literal<D>, constructorOpt?: Function) {
63
- super(raw.message);
64
- this.data = raw.data;
65
- Object.setPrototypeOf(this, Impl.prototype);
66
- if (raw.stack) {
67
- this.stack = raw.stack;
68
- } else if (Error.captureStackTrace && constructorOpt) {
69
- Error.captureStackTrace(this, constructorOpt);
70
- }
71
- }
72
- toJson(): ApplicationError.Literal<D> {
73
- const { message, data, stack } = this;
74
- return { message, data, stack };
75
- }
76
- }
77
- }
@@ -1,28 +0,0 @@
1
- /**
2
- * 应用基础配置类型.
3
- */
4
- export interface ApplicationConfig {
5
- readonly [key: string]: any;
6
- }
7
-
8
- /**
9
- * 前端应用配置
10
- * 下列的属性在页面启动时会注入到`index.html`中的window对象中
11
- */
12
- export interface ClientAppConfig extends ApplicationConfig {
13
- /**
14
- * 默认主题
15
- */
16
- readonly defaultTheme?: string;
17
-
18
- /**
19
- * 应用名称
20
- */
21
- readonly applicationName: string;
22
-
23
- /**
24
- * 默认内部的 uriScheme,用于桌面版 app 的唤起
25
- * 也默认为 vscode.env.uriScheme 的值
26
- */
27
- readonly uriScheme: string;
28
- }