@theia/application-package 1.45.0 → 1.46.0-next.72

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.
Files changed (38) hide show
  1. package/README.md +25 -25
  2. package/lib/api.d.ts +5 -5
  3. package/lib/api.js +23 -23
  4. package/lib/application-package.d.ts +88 -82
  5. package/lib/application-package.d.ts.map +1 -1
  6. package/lib/application-package.js +262 -232
  7. package/lib/application-package.js.map +1 -1
  8. package/lib/application-package.spec.d.ts +1 -1
  9. package/lib/application-package.spec.js +57 -57
  10. package/lib/application-props.d.ts +172 -171
  11. package/lib/application-props.d.ts.map +1 -1
  12. package/lib/application-props.js +102 -101
  13. package/lib/application-props.js.map +1 -1
  14. package/lib/environment.d.ts +39 -39
  15. package/lib/environment.js +73 -73
  16. package/lib/extension-package-collector.d.ts +15 -15
  17. package/lib/extension-package-collector.js +76 -76
  18. package/lib/extension-package.d.ts +65 -63
  19. package/lib/extension-package.d.ts.map +1 -1
  20. package/lib/extension-package.js +176 -176
  21. package/lib/extension-package.js.map +1 -1
  22. package/lib/index.d.ts +6 -6
  23. package/lib/index.js +33 -33
  24. package/lib/json-file.d.ts +3 -3
  25. package/lib/json-file.js +26 -26
  26. package/lib/npm-registry.d.ts +73 -73
  27. package/lib/npm-registry.js +101 -101
  28. package/package.json +5 -5
  29. package/src/api.ts +21 -21
  30. package/src/application-package.spec.ts +62 -62
  31. package/src/application-package.ts +334 -297
  32. package/src/application-props.ts +264 -263
  33. package/src/environment.ts +76 -76
  34. package/src/extension-package-collector.ts +83 -83
  35. package/src/extension-package.ts +223 -221
  36. package/src/index.ts +22 -22
  37. package/src/json-file.ts +25 -25
  38. package/src/npm-registry.ts +161 -161
@@ -1,102 +1,103 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 TypeFox 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-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.ApplicationProps = exports.NpmRegistryProps = exports.GeneratorConfig = exports.BackendApplicationConfig = exports.FrontendApplicationConfig = exports.DefaultTheme = exports.ElectronFrontendApplicationConfig = void 0;
19
- exports.deepmerge = require("deepmerge");
20
- var ElectronFrontendApplicationConfig;
21
- (function (ElectronFrontendApplicationConfig) {
22
- ElectronFrontendApplicationConfig.DEFAULT = {
23
- windowOptions: {},
24
- showWindowEarly: true
25
- };
26
- })(ElectronFrontendApplicationConfig = exports.ElectronFrontendApplicationConfig || (exports.ElectronFrontendApplicationConfig = {}));
27
- var DefaultTheme;
28
- (function (DefaultTheme) {
29
- function defaultForOSTheme(theme) {
30
- if (typeof theme === 'string') {
31
- return theme;
32
- }
33
- if (typeof window !== 'undefined' &&
34
- window.matchMedia &&
35
- window.matchMedia('(prefers-color-scheme: dark)').matches) {
36
- return theme.dark;
37
- }
38
- return theme.light;
39
- }
40
- DefaultTheme.defaultForOSTheme = defaultForOSTheme;
41
- function defaultBackgroundColor(dark) {
42
- // The default light background color is based on the `colors#editor.background` value from
43
- // `packages/monaco/data/monaco-themes/vscode/dark_vs.json` and the dark background comes from the `light_vs.json`.
44
- return dark ? '#1E1E1E' : '#FFFFFF';
45
- }
46
- DefaultTheme.defaultBackgroundColor = defaultBackgroundColor;
47
- })(DefaultTheme = exports.DefaultTheme || (exports.DefaultTheme = {}));
48
- var FrontendApplicationConfig;
49
- (function (FrontendApplicationConfig) {
50
- FrontendApplicationConfig.DEFAULT = {
51
- applicationName: 'Eclipse Theia',
52
- defaultTheme: { light: 'light', dark: 'dark' },
53
- defaultIconTheme: 'theia-file-icons',
54
- electron: ElectronFrontendApplicationConfig.DEFAULT,
55
- defaultLocale: '',
56
- validatePreferencesSchema: true,
57
- reloadOnReconnect: false
58
- };
59
- })(FrontendApplicationConfig = exports.FrontendApplicationConfig || (exports.FrontendApplicationConfig = {}));
60
- var BackendApplicationConfig;
61
- (function (BackendApplicationConfig) {
62
- BackendApplicationConfig.DEFAULT = {
63
- singleInstance: false,
64
- frontendConnectionTimeout: 0
65
- };
66
- })(BackendApplicationConfig = exports.BackendApplicationConfig || (exports.BackendApplicationConfig = {}));
67
- var GeneratorConfig;
68
- (function (GeneratorConfig) {
69
- GeneratorConfig.DEFAULT = {
70
- preloadTemplate: ''
71
- };
72
- })(GeneratorConfig = exports.GeneratorConfig || (exports.GeneratorConfig = {}));
73
- var NpmRegistryProps;
74
- (function (NpmRegistryProps) {
75
- NpmRegistryProps.DEFAULT = {
76
- next: false,
77
- registry: 'https://registry.npmjs.org/'
78
- };
79
- })(NpmRegistryProps = exports.NpmRegistryProps || (exports.NpmRegistryProps = {}));
80
- var ApplicationProps;
81
- (function (ApplicationProps) {
82
- let ApplicationTarget;
83
- (function (ApplicationTarget) {
84
- ApplicationTarget["browser"] = "browser";
85
- ApplicationTarget["electron"] = "electron";
86
- })(ApplicationTarget = ApplicationProps.ApplicationTarget || (ApplicationProps.ApplicationTarget = {}));
87
- ;
88
- ApplicationProps.DEFAULT = {
89
- ...NpmRegistryProps.DEFAULT,
90
- target: 'browser',
91
- backend: {
92
- config: BackendApplicationConfig.DEFAULT
93
- },
94
- frontend: {
95
- config: FrontendApplicationConfig.DEFAULT
96
- },
97
- generator: {
98
- config: GeneratorConfig.DEFAULT
99
- }
100
- };
101
- })(ApplicationProps = exports.ApplicationProps || (exports.ApplicationProps = {}));
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ApplicationProps = exports.NpmRegistryProps = exports.GeneratorConfig = exports.BackendApplicationConfig = exports.FrontendApplicationConfig = exports.DefaultTheme = exports.ElectronFrontendApplicationConfig = void 0;
19
+ exports.deepmerge = require("deepmerge");
20
+ var ElectronFrontendApplicationConfig;
21
+ (function (ElectronFrontendApplicationConfig) {
22
+ ElectronFrontendApplicationConfig.DEFAULT = {
23
+ windowOptions: {},
24
+ showWindowEarly: true
25
+ };
26
+ })(ElectronFrontendApplicationConfig = exports.ElectronFrontendApplicationConfig || (exports.ElectronFrontendApplicationConfig = {}));
27
+ var DefaultTheme;
28
+ (function (DefaultTheme) {
29
+ function defaultForOSTheme(theme) {
30
+ if (typeof theme === 'string') {
31
+ return theme;
32
+ }
33
+ if (typeof window !== 'undefined' &&
34
+ window.matchMedia &&
35
+ window.matchMedia('(prefers-color-scheme: dark)').matches) {
36
+ return theme.dark;
37
+ }
38
+ return theme.light;
39
+ }
40
+ DefaultTheme.defaultForOSTheme = defaultForOSTheme;
41
+ function defaultBackgroundColor(dark) {
42
+ // The default light background color is based on the `colors#editor.background` value from
43
+ // `packages/monaco/data/monaco-themes/vscode/dark_vs.json` and the dark background comes from the `light_vs.json`.
44
+ return dark ? '#1E1E1E' : '#FFFFFF';
45
+ }
46
+ DefaultTheme.defaultBackgroundColor = defaultBackgroundColor;
47
+ })(DefaultTheme = exports.DefaultTheme || (exports.DefaultTheme = {}));
48
+ var FrontendApplicationConfig;
49
+ (function (FrontendApplicationConfig) {
50
+ FrontendApplicationConfig.DEFAULT = {
51
+ applicationName: 'Eclipse Theia',
52
+ defaultTheme: { light: 'light', dark: 'dark' },
53
+ defaultIconTheme: 'theia-file-icons',
54
+ electron: ElectronFrontendApplicationConfig.DEFAULT,
55
+ defaultLocale: '',
56
+ validatePreferencesSchema: true,
57
+ reloadOnReconnect: false
58
+ };
59
+ })(FrontendApplicationConfig = exports.FrontendApplicationConfig || (exports.FrontendApplicationConfig = {}));
60
+ var BackendApplicationConfig;
61
+ (function (BackendApplicationConfig) {
62
+ BackendApplicationConfig.DEFAULT = {
63
+ singleInstance: false,
64
+ frontendConnectionTimeout: 0
65
+ };
66
+ })(BackendApplicationConfig = exports.BackendApplicationConfig || (exports.BackendApplicationConfig = {}));
67
+ var GeneratorConfig;
68
+ (function (GeneratorConfig) {
69
+ GeneratorConfig.DEFAULT = {
70
+ preloadTemplate: ''
71
+ };
72
+ })(GeneratorConfig = exports.GeneratorConfig || (exports.GeneratorConfig = {}));
73
+ var NpmRegistryProps;
74
+ (function (NpmRegistryProps) {
75
+ NpmRegistryProps.DEFAULT = {
76
+ next: false,
77
+ registry: 'https://registry.npmjs.org/'
78
+ };
79
+ })(NpmRegistryProps = exports.NpmRegistryProps || (exports.NpmRegistryProps = {}));
80
+ var ApplicationProps;
81
+ (function (ApplicationProps) {
82
+ let ApplicationTarget;
83
+ (function (ApplicationTarget) {
84
+ ApplicationTarget["browser"] = "browser";
85
+ ApplicationTarget["electron"] = "electron";
86
+ ApplicationTarget["browserOnly"] = "browser-only";
87
+ })(ApplicationTarget = ApplicationProps.ApplicationTarget || (ApplicationProps.ApplicationTarget = {}));
88
+ ;
89
+ ApplicationProps.DEFAULT = {
90
+ ...NpmRegistryProps.DEFAULT,
91
+ target: 'browser',
92
+ backend: {
93
+ config: BackendApplicationConfig.DEFAULT
94
+ },
95
+ frontend: {
96
+ config: FrontendApplicationConfig.DEFAULT
97
+ },
98
+ generator: {
99
+ config: GeneratorConfig.DEFAULT
100
+ }
101
+ };
102
+ })(ApplicationProps = exports.ApplicationProps || (exports.ApplicationProps = {}));
102
103
  //# sourceMappingURL=application-props.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-props.js","sourceRoot":"","sources":["../src/application-props.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAGhF,yCAA+C;AAe/C,IAAiB,iCAAiC,CAqBjD;AArBD,WAAiB,iCAAiC;IACjC,yCAAO,GAAsC;QACtD,aAAa,EAAE,EAAE;QACjB,eAAe,EAAE,IAAI;KACxB,CAAC;AAiBN,CAAC,EArBgB,iCAAiC,GAAjC,yCAAiC,KAAjC,yCAAiC,QAqBjD;AAGD,IAAiB,YAAY,CAmB5B;AAnBD,WAAiB,YAAY;IACzB,SAAgB,iBAAiB,CAAC,KAAmB;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC3B,OAAO,KAAK,CAAC;SAChB;QACD,IACI,OAAO,MAAM,KAAK,WAAW;YAC7B,MAAM,CAAC,UAAU;YACjB,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,EAC3D;YACE,OAAO,KAAK,CAAC,IAAI,CAAC;SACrB;QACD,OAAO,KAAK,CAAC,KAAK,CAAC;IACvB,CAAC;IAZe,8BAAiB,oBAYhC,CAAA;IACD,SAAgB,sBAAsB,CAAC,IAAc;QACjD,2FAA2F;QAC3F,mHAAmH;QACnH,OAAO,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC;IACxC,CAAC;IAJe,mCAAsB,yBAIrC,CAAA;AACL,CAAC,EAnBgB,YAAY,GAAZ,oBAAY,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gBAAgB,CAAC,OAAO;QAC3B,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE;YACL,MAAM,EAAE,wBAAwB,CAAC,OAAO;SAC3C;QACD,QAAQ,EAAE;YACN,MAAM,EAAE,yBAAyB,CAAC,OAAO;SAC5C;QACD,SAAS,EAAE;YACP,MAAM,EAAE,eAAe,CAAC,OAAO;SAClC;KACJ,CAAC;AAEN,CAAC,EApBgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAoBhC"}
1
+ {"version":3,"file":"application-props.js","sourceRoot":"","sources":["../src/application-props.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAGhF,yCAA+C;AAe/C,IAAiB,iCAAiC,CAqBjD;AArBD,WAAiB,iCAAiC;IACjC,yCAAO,GAAsC;QACtD,aAAa,EAAE,EAAE;QACjB,eAAe,EAAE,IAAI;KACxB,CAAC;AAiBN,CAAC,EArBgB,iCAAiC,GAAjC,yCAAiC,KAAjC,yCAAiC,QAqBjD;AAGD,IAAiB,YAAY,CAmB5B;AAnBD,WAAiB,YAAY;IACzB,SAAgB,iBAAiB,CAAC,KAAmB;QACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC3B,OAAO,KAAK,CAAC;SAChB;QACD,IACI,OAAO,MAAM,KAAK,WAAW;YAC7B,MAAM,CAAC,UAAU;YACjB,MAAM,CAAC,UAAU,CAAC,8BAA8B,CAAC,CAAC,OAAO,EAC3D;YACE,OAAO,KAAK,CAAC,IAAI,CAAC;SACrB;QACD,OAAO,KAAK,CAAC,KAAK,CAAC;IACvB,CAAC;IAZe,8BAAiB,oBAYhC,CAAA;IACD,SAAgB,sBAAsB,CAAC,I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E7B,IAAY,iBAIX;IAJD,WAAY,iBAAiB;QACzB,wCAAmB,CAAA;QACnB,0CAAqB,CAAA;QACrB,iDAA4B,CAAA;IAChC,CAAC,EAJW,iBAAiB,GAAjB,kCAAiB,KAAjB,kCAAiB,QAI5B;IAAA,CAAC;IACW,wBAAO,GAAqB;QACrC,GAAG,gBAAgB,CAAC,OAAO;QAC3B,MAAM,EAAE,SAAS;QACjB,OAAO,EAAE;YACL,MAAM,EAAE,wBAAwB,CAAC,OAAO;SAC3C;QACD,QAAQ,EAAE;YACN,MAAM,EAAE,yBAAyB,CAAC,OAAO;SAC5C;QACD,SAAS,EAAE;YACP,MAAM,EAAE,eAAe,CAAC,OAAO;SAClC;KACJ,CAAC;AAEN,CAAC,EArBgB,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAqBhC"}
@@ -1,40 +1,40 @@
1
- /**
2
- * The electron specific environment.
3
- */
4
- declare class ElectronEnv {
5
- /**
6
- * Environment variable that can be accessed on the `process` to check if running in electron or not.
7
- */
8
- readonly THEIA_ELECTRON_VERSION = "THEIA_ELECTRON_VERSION";
9
- /**
10
- * `true` if running in electron. Otherwise, `false`.
11
- *
12
- * Can be called from both the `main` and the render process. Also works for forked cluster workers.
13
- */
14
- is(): boolean;
15
- /**
16
- * `true` if running in Electron in development mode. Otherwise, `false`.
17
- *
18
- * Cannot be used from the browser. From the browser, it is always `false`.
19
- */
20
- isDevMode(): boolean;
21
- /**
22
- * Creates and return with a new environment object which always contains the `ELECTRON_RUN_AS_NODE: 1` property pair.
23
- * This should be used to `spawn` and `fork` a new Node.js process from the Node.js shipped with Electron. Otherwise, a new Electron
24
- * process will be spawned which [has side-effects](https://github.com/eclipse-theia/theia/issues/5385).
25
- *
26
- * If called from the backend and the `env` argument is not defined, it falls back to `process.env` such as Node.js behaves
27
- * with the [`SpawnOptions`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
28
- * If `env` is defined, it will be shallow-copied.
29
- *
30
- * Calling this function from the frontend does not make any sense, hence throw an error.
31
- */
32
- runAsNodeEnv(env?: any): any & {
33
- ELECTRON_RUN_AS_NODE: 1;
34
- };
35
- }
36
- declare const environment: Readonly<{
37
- electron: ElectronEnv;
38
- }>;
39
- export { environment };
1
+ /**
2
+ * The electron specific environment.
3
+ */
4
+ declare class ElectronEnv {
5
+ /**
6
+ * Environment variable that can be accessed on the `process` to check if running in electron or not.
7
+ */
8
+ readonly THEIA_ELECTRON_VERSION = "THEIA_ELECTRON_VERSION";
9
+ /**
10
+ * `true` if running in electron. Otherwise, `false`.
11
+ *
12
+ * Can be called from both the `main` and the render process. Also works for forked cluster workers.
13
+ */
14
+ is(): boolean;
15
+ /**
16
+ * `true` if running in Electron in development mode. Otherwise, `false`.
17
+ *
18
+ * Cannot be used from the browser. From the browser, it is always `false`.
19
+ */
20
+ isDevMode(): boolean;
21
+ /**
22
+ * Creates and return with a new environment object which always contains the `ELECTRON_RUN_AS_NODE: 1` property pair.
23
+ * This should be used to `spawn` and `fork` a new Node.js process from the Node.js shipped with Electron. Otherwise, a new Electron
24
+ * process will be spawned which [has side-effects](https://github.com/eclipse-theia/theia/issues/5385).
25
+ *
26
+ * If called from the backend and the `env` argument is not defined, it falls back to `process.env` such as Node.js behaves
27
+ * with the [`SpawnOptions`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
28
+ * If `env` is defined, it will be shallow-copied.
29
+ *
30
+ * Calling this function from the frontend does not make any sense, hence throw an error.
31
+ */
32
+ runAsNodeEnv(env?: any): any & {
33
+ ELECTRON_RUN_AS_NODE: 1;
34
+ };
35
+ }
36
+ declare const environment: Readonly<{
37
+ electron: ElectronEnv;
38
+ }>;
39
+ export { environment };
40
40
  //# sourceMappingURL=environment.d.ts.map
@@ -1,74 +1,74 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 TypeFox 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-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.environment = void 0;
19
- const isElectron = require('is-electron');
20
- /**
21
- * The electron specific environment.
22
- */
23
- class ElectronEnv {
24
- constructor() {
25
- /**
26
- * Environment variable that can be accessed on the `process` to check if running in electron or not.
27
- */
28
- this.THEIA_ELECTRON_VERSION = 'THEIA_ELECTRON_VERSION';
29
- }
30
- /**
31
- * `true` if running in electron. Otherwise, `false`.
32
- *
33
- * Can be called from both the `main` and the render process. Also works for forked cluster workers.
34
- */
35
- is() {
36
- return isElectron();
37
- }
38
- /**
39
- * `true` if running in Electron in development mode. Otherwise, `false`.
40
- *
41
- * Cannot be used from the browser. From the browser, it is always `false`.
42
- */
43
- isDevMode() {
44
- return this.is()
45
- && typeof process !== 'undefined'
46
- // `defaultApp` does not exist on the Node.js API, but on electron (`electron.d.ts`).
47
- && (process.defaultApp || /node_modules[/\\]electron[/\\]/.test(process.execPath)); // eslint-disable-line @typescript-eslint/no-explicit-any
48
- }
49
- /**
50
- * Creates and return with a new environment object which always contains the `ELECTRON_RUN_AS_NODE: 1` property pair.
51
- * This should be used to `spawn` and `fork` a new Node.js process from the Node.js shipped with Electron. Otherwise, a new Electron
52
- * process will be spawned which [has side-effects](https://github.com/eclipse-theia/theia/issues/5385).
53
- *
54
- * If called from the backend and the `env` argument is not defined, it falls back to `process.env` such as Node.js behaves
55
- * with the [`SpawnOptions`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
56
- * If `env` is defined, it will be shallow-copied.
57
- *
58
- * Calling this function from the frontend does not make any sense, hence throw an error.
59
- */
60
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
- runAsNodeEnv(env) {
62
- if (typeof process === 'undefined') {
63
- throw new Error("'process' cannot be undefined.");
64
- }
65
- return {
66
- ...(env === undefined ? process.env : env),
67
- ELECTRON_RUN_AS_NODE: 1
68
- };
69
- }
70
- }
71
- const electron = new ElectronEnv();
72
- const environment = { electron };
73
- exports.environment = environment;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 TypeFox 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.environment = void 0;
19
+ const isElectron = require('is-electron');
20
+ /**
21
+ * The electron specific environment.
22
+ */
23
+ class ElectronEnv {
24
+ constructor() {
25
+ /**
26
+ * Environment variable that can be accessed on the `process` to check if running in electron or not.
27
+ */
28
+ this.THEIA_ELECTRON_VERSION = 'THEIA_ELECTRON_VERSION';
29
+ }
30
+ /**
31
+ * `true` if running in electron. Otherwise, `false`.
32
+ *
33
+ * Can be called from both the `main` and the render process. Also works for forked cluster workers.
34
+ */
35
+ is() {
36
+ return isElectron();
37
+ }
38
+ /**
39
+ * `true` if running in Electron in development mode. Otherwise, `false`.
40
+ *
41
+ * Cannot be used from the browser. From the browser, it is always `false`.
42
+ */
43
+ isDevMode() {
44
+ return this.is()
45
+ && typeof process !== 'undefined'
46
+ // `defaultApp` does not exist on the Node.js API, but on electron (`electron.d.ts`).
47
+ && (process.defaultApp || /node_modules[/\\]electron[/\\]/.test(process.execPath)); // eslint-disable-line @typescript-eslint/no-explicit-any
48
+ }
49
+ /**
50
+ * Creates and return with a new environment object which always contains the `ELECTRON_RUN_AS_NODE: 1` property pair.
51
+ * This should be used to `spawn` and `fork` a new Node.js process from the Node.js shipped with Electron. Otherwise, a new Electron
52
+ * process will be spawned which [has side-effects](https://github.com/eclipse-theia/theia/issues/5385).
53
+ *
54
+ * If called from the backend and the `env` argument is not defined, it falls back to `process.env` such as Node.js behaves
55
+ * with the [`SpawnOptions`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options).
56
+ * If `env` is defined, it will be shallow-copied.
57
+ *
58
+ * Calling this function from the frontend does not make any sense, hence throw an error.
59
+ */
60
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
+ runAsNodeEnv(env) {
62
+ if (typeof process === 'undefined') {
63
+ throw new Error("'process' cannot be undefined.");
64
+ }
65
+ return {
66
+ ...(env === undefined ? process.env : env),
67
+ ELECTRON_RUN_AS_NODE: 1
68
+ };
69
+ }
70
+ }
71
+ const electron = new ElectronEnv();
72
+ const environment = { electron };
73
+ exports.environment = environment;
74
74
  //# sourceMappingURL=environment.js.map
@@ -1,16 +1,16 @@
1
- import { NodePackage, PublishedNodePackage } from './npm-registry';
2
- import { ExtensionPackage, ExtensionPackageOptions } from './extension-package';
3
- export declare class ExtensionPackageCollector {
4
- protected readonly extensionPackageFactory: (raw: PublishedNodePackage, options?: ExtensionPackageOptions) => ExtensionPackage;
5
- protected readonly resolveModule: (modulePath: string) => string;
6
- protected readonly sorted: ExtensionPackage[];
7
- protected readonly visited: Map<string, boolean>;
8
- constructor(extensionPackageFactory: (raw: PublishedNodePackage, options?: ExtensionPackageOptions) => ExtensionPackage, resolveModule: (modulePath: string) => string);
9
- protected root: NodePackage;
10
- collect(pck: NodePackage): ReadonlyArray<ExtensionPackage>;
11
- protected collectPackages(pck: NodePackage): void;
12
- protected parent: ExtensionPackage | undefined;
13
- protected collectPackagesWithParent(pck: NodePackage, parent: ExtensionPackage): void;
14
- protected collectPackage(name: string, versionRange: string): void;
15
- }
1
+ import { NodePackage, PublishedNodePackage } from './npm-registry';
2
+ import { ExtensionPackage, ExtensionPackageOptions } from './extension-package';
3
+ export declare class ExtensionPackageCollector {
4
+ protected readonly extensionPackageFactory: (raw: PublishedNodePackage, options?: ExtensionPackageOptions) => ExtensionPackage;
5
+ protected readonly resolveModule: (modulePath: string) => string;
6
+ protected readonly sorted: ExtensionPackage[];
7
+ protected readonly visited: Map<string, boolean>;
8
+ constructor(extensionPackageFactory: (raw: PublishedNodePackage, options?: ExtensionPackageOptions) => ExtensionPackage, resolveModule: (modulePath: string) => string);
9
+ protected root: NodePackage;
10
+ collect(pck: NodePackage): ReadonlyArray<ExtensionPackage>;
11
+ protected collectPackages(pck: NodePackage): void;
12
+ protected parent: ExtensionPackage | undefined;
13
+ protected collectPackagesWithParent(pck: NodePackage, parent: ExtensionPackage): void;
14
+ protected collectPackage(name: string, versionRange: string): void;
15
+ }
16
16
  //# sourceMappingURL=extension-package-collector.d.ts.map
@@ -1,77 +1,77 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017 TypeFox 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-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.ExtensionPackageCollector = void 0;
19
- const json_file_1 = require("./json-file");
20
- const extension_package_1 = require("./extension-package");
21
- class ExtensionPackageCollector {
22
- constructor(extensionPackageFactory, resolveModule) {
23
- this.extensionPackageFactory = extensionPackageFactory;
24
- this.resolveModule = resolveModule;
25
- this.sorted = [];
26
- this.visited = new Map();
27
- }
28
- collect(pck) {
29
- this.root = pck;
30
- this.collectPackages(pck);
31
- return this.sorted;
32
- }
33
- collectPackages(pck) {
34
- var _a, _b;
35
- for (const [dependency, versionRange] of [
36
- ...Object.entries((_a = pck.dependencies) !== null && _a !== void 0 ? _a : {}),
37
- ...Object.entries((_b = pck.peerDependencies) !== null && _b !== void 0 ? _b : {})
38
- ]) {
39
- this.collectPackage(dependency, versionRange);
40
- }
41
- }
42
- collectPackagesWithParent(pck, parent) {
43
- const current = this.parent;
44
- this.parent = parent;
45
- this.collectPackages(pck);
46
- this.parent = current;
47
- }
48
- collectPackage(name, versionRange) {
49
- if (this.visited.has(name)) {
50
- return;
51
- }
52
- this.visited.set(name, true);
53
- let packagePath;
54
- try {
55
- packagePath = this.resolveModule(name);
56
- }
57
- catch {
58
- console.debug(`Failed to resolve module: ${name}`);
59
- }
60
- if (!packagePath) {
61
- return;
62
- }
63
- const pck = (0, json_file_1.readJsonFile)(packagePath);
64
- if (extension_package_1.RawExtensionPackage.is(pck)) {
65
- const parent = this.parent;
66
- const version = pck.version;
67
- const transitive = !(name in this.root.dependencies);
68
- pck.installed = { packagePath, version, parent, transitive };
69
- pck.version = versionRange;
70
- const extensionPackage = this.extensionPackageFactory(pck, { alias: name });
71
- this.collectPackagesWithParent(pck, extensionPackage);
72
- this.sorted.push(extensionPackage);
73
- }
74
- }
75
- }
76
- exports.ExtensionPackageCollector = ExtensionPackageCollector;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 TypeFox 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ExtensionPackageCollector = void 0;
19
+ const json_file_1 = require("./json-file");
20
+ const extension_package_1 = require("./extension-package");
21
+ class ExtensionPackageCollector {
22
+ constructor(extensionPackageFactory, resolveModule) {
23
+ this.extensionPackageFactory = extensionPackageFactory;
24
+ this.resolveModule = resolveModule;
25
+ this.sorted = [];
26
+ this.visited = new Map();
27
+ }
28
+ collect(pck) {
29
+ this.root = pck;
30
+ this.collectPackages(pck);
31
+ return this.sorted;
32
+ }
33
+ collectPackages(pck) {
34
+ var _a, _b;
35
+ for (const [dependency, versionRange] of [
36
+ ...Object.entries((_a = pck.dependencies) !== null && _a !== void 0 ? _a : {}),
37
+ ...Object.entries((_b = pck.peerDependencies) !== null && _b !== void 0 ? _b : {})
38
+ ]) {
39
+ this.collectPackage(dependency, versionRange);
40
+ }
41
+ }
42
+ collectPackagesWithParent(pck, parent) {
43
+ const current = this.parent;
44
+ this.parent = parent;
45
+ this.collectPackages(pck);
46
+ this.parent = current;
47
+ }
48
+ collectPackage(name, versionRange) {
49
+ if (this.visited.has(name)) {
50
+ return;
51
+ }
52
+ this.visited.set(name, true);
53
+ let packagePath;
54
+ try {
55
+ packagePath = this.resolveModule(name);
56
+ }
57
+ catch {
58
+ console.debug(`Failed to resolve module: ${name}`);
59
+ }
60
+ if (!packagePath) {
61
+ return;
62
+ }
63
+ const pck = (0, json_file_1.readJsonFile)(packagePath);
64
+ if (extension_package_1.RawExtensionPackage.is(pck)) {
65
+ const parent = this.parent;
66
+ const version = pck.version;
67
+ const transitive = !(name in this.root.dependencies);
68
+ pck.installed = { packagePath, version, parent, transitive };
69
+ pck.version = versionRange;
70
+ const extensionPackage = this.extensionPackageFactory(pck, { alias: name });
71
+ this.collectPackagesWithParent(pck, extensionPackage);
72
+ this.sorted.push(extensionPackage);
73
+ }
74
+ }
75
+ }
76
+ exports.ExtensionPackageCollector = ExtensionPackageCollector;
77
77
  //# sourceMappingURL=extension-package-collector.js.map