@theia/plugin-dev 1.45.1 → 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 (54) hide show
  1. package/README.md +31 -31
  2. package/lib/browser/hosted-plugin-controller.d.ts +74 -74
  3. package/lib/browser/hosted-plugin-controller.js +352 -352
  4. package/lib/browser/hosted-plugin-frontend-contribution.d.ts +6 -6
  5. package/lib/browser/hosted-plugin-frontend-contribution.js +56 -56
  6. package/lib/browser/hosted-plugin-informer.d.ts +25 -25
  7. package/lib/browser/hosted-plugin-informer.js +102 -102
  8. package/lib/browser/hosted-plugin-log-viewer.d.ts +14 -14
  9. package/lib/browser/hosted-plugin-log-viewer.js +69 -69
  10. package/lib/browser/hosted-plugin-manager-client.d.ts +80 -80
  11. package/lib/browser/hosted-plugin-manager-client.js +410 -410
  12. package/lib/browser/hosted-plugin-preferences.d.ts +13 -13
  13. package/lib/browser/hosted-plugin-preferences.js +60 -60
  14. package/lib/browser/plugin-dev-frontend-module.d.ts +3 -3
  15. package/lib/browser/plugin-dev-frontend-module.js +42 -42
  16. package/lib/common/index.d.ts +2 -2
  17. package/lib/common/index.js +31 -31
  18. package/lib/common/plugin-dev-protocol.d.ts +24 -24
  19. package/lib/common/plugin-dev-protocol.js +20 -20
  20. package/lib/node/hosted-instance-manager.d.ts +104 -104
  21. package/lib/node/hosted-instance-manager.js +320 -320
  22. package/lib/node/hosted-instance-manager.js.map +1 -1
  23. package/lib/node/hosted-plugin-reader.d.ts +11 -11
  24. package/lib/node/hosted-plugin-reader.js +68 -68
  25. package/lib/node/hosted-plugin-reader.js.map +1 -1
  26. package/lib/node/hosted-plugin-uri-postprocessor.d.ts +6 -6
  27. package/lib/node/hosted-plugin-uri-postprocessor.js +27 -27
  28. package/lib/node/hosted-plugins-manager.d.ts +41 -41
  29. package/lib/node/hosted-plugins-manager.js +119 -119
  30. package/lib/node/plugin-dev-backend-module.d.ts +4 -4
  31. package/lib/node/plugin-dev-backend-module.js +53 -53
  32. package/lib/node/plugin-dev-service.d.ts +25 -25
  33. package/lib/node/plugin-dev-service.js +108 -108
  34. package/lib/node-electron/plugin-dev-electron-backend-module.d.ts +3 -3
  35. package/lib/node-electron/plugin-dev-electron-backend-module.js +28 -28
  36. package/lib/package.spec.js +25 -25
  37. package/package.json +9 -9
  38. package/src/browser/hosted-plugin-controller.ts +356 -356
  39. package/src/browser/hosted-plugin-frontend-contribution.ts +45 -45
  40. package/src/browser/hosted-plugin-informer.ts +93 -93
  41. package/src/browser/hosted-plugin-log-viewer.ts +52 -52
  42. package/src/browser/hosted-plugin-manager-client.ts +430 -430
  43. package/src/browser/hosted-plugin-preferences.ts +71 -71
  44. package/src/browser/plugin-dev-frontend-module.ts +45 -45
  45. package/src/common/index.ts +21 -21
  46. package/src/common/plugin-dev-protocol.ts +45 -45
  47. package/src/node/hosted-instance-manager.ts +382 -382
  48. package/src/node/hosted-plugin-reader.ts +58 -58
  49. package/src/node/hosted-plugin-uri-postprocessor.ts +32 -32
  50. package/src/node/hosted-plugins-manager.ts +146 -146
  51. package/src/node/plugin-dev-backend-module.ts +54 -54
  52. package/src/node/plugin-dev-service.ts +107 -107
  53. package/src/node-electron/plugin-dev-electron-backend-module.ts +29 -29
  54. package/src/package.spec.ts +28 -28
@@ -1,58 +1,58 @@
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-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
19
- import { HostedPluginReader as PluginReaderHosted } from '@theia/plugin-ext/lib/hosted/node/plugin-reader';
20
- import { Deferred } from '@theia/core/lib/common/promise-util';
21
- import { PluginMetadata } from '@theia/plugin-ext/lib/common/plugin-protocol';
22
- import { PluginDeployerEntryImpl } from '@theia/plugin-ext/lib/main/node/plugin-deployer-entry-impl';
23
- import { HostedPluginDeployerHandler } from '@theia/plugin-ext/lib/hosted/node/hosted-plugin-deployer-handler';
24
-
25
- @injectable()
26
- export class HostedPluginReader implements BackendApplicationContribution {
27
-
28
- @inject(PluginReaderHosted)
29
- protected pluginReader: PluginReaderHosted;
30
-
31
- private readonly hostedPlugin = new Deferred<PluginMetadata | undefined>();
32
-
33
- @inject(HostedPluginDeployerHandler)
34
- protected deployerHandler: HostedPluginDeployerHandler;
35
-
36
- async initialize(): Promise<void> {
37
- this.pluginReader.getPluginMetadata(process.env.HOSTED_PLUGIN)
38
- .then(this.hostedPlugin.resolve.bind(this.hostedPlugin));
39
-
40
- const pluginPath = process.env.HOSTED_PLUGIN;
41
- if (pluginPath) {
42
- const hostedPlugin = new PluginDeployerEntryImpl('Hosted Plugin', pluginPath!, pluginPath);
43
- hostedPlugin.storeValue('isUnderDevelopment', true);
44
- const hostedMetadata = await this.hostedPlugin.promise;
45
- if (hostedMetadata!.model.entryPoint && hostedMetadata!.model.entryPoint.backend) {
46
- this.deployerHandler.deployBackendPlugins([hostedPlugin]);
47
- }
48
-
49
- if (hostedMetadata!.model.entryPoint && hostedMetadata!.model.entryPoint.frontend) {
50
- this.deployerHandler.deployFrontendPlugins([hostedPlugin]);
51
- }
52
- }
53
- }
54
-
55
- async getPlugin(): Promise<PluginMetadata | undefined> {
56
- return this.hostedPlugin.promise;
57
- }
58
- }
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-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
19
+ import { HostedPluginReader as PluginReaderHosted } from '@theia/plugin-ext/lib/hosted/node/plugin-reader';
20
+ import { Deferred } from '@theia/core/lib/common/promise-util';
21
+ import { PluginMetadata } from '@theia/plugin-ext/lib/common/plugin-protocol';
22
+ import { PluginDeployerEntryImpl } from '@theia/plugin-ext/lib/main/node/plugin-deployer-entry-impl';
23
+ import { HostedPluginDeployerHandler } from '@theia/plugin-ext/lib/hosted/node/hosted-plugin-deployer-handler';
24
+
25
+ @injectable()
26
+ export class HostedPluginReader implements BackendApplicationContribution {
27
+
28
+ @inject(PluginReaderHosted)
29
+ protected pluginReader: PluginReaderHosted;
30
+
31
+ private readonly hostedPlugin = new Deferred<PluginMetadata | undefined>();
32
+
33
+ @inject(HostedPluginDeployerHandler)
34
+ protected deployerHandler: HostedPluginDeployerHandler;
35
+
36
+ async initialize(): Promise<void> {
37
+ this.pluginReader.getPluginMetadata(process.env.HOSTED_PLUGIN)
38
+ .then(this.hostedPlugin.resolve.bind(this.hostedPlugin));
39
+
40
+ const pluginPath = process.env.HOSTED_PLUGIN;
41
+ if (pluginPath) {
42
+ const hostedPlugin = new PluginDeployerEntryImpl('Hosted Plugin', pluginPath!, pluginPath);
43
+ hostedPlugin.storeValue('isUnderDevelopment', true);
44
+ const hostedMetadata = await this.hostedPlugin.promise;
45
+ if (hostedMetadata!.model.entryPoint && (hostedMetadata!.model.entryPoint.backend || hostedMetadata!.model.entryPoint.headless)) {
46
+ this.deployerHandler.deployBackendPlugins([hostedPlugin]);
47
+ }
48
+
49
+ if (hostedMetadata!.model.entryPoint && hostedMetadata!.model.entryPoint.frontend) {
50
+ this.deployerHandler.deployFrontendPlugins([hostedPlugin]);
51
+ }
52
+ }
53
+ }
54
+
55
+ async getPlugin(): Promise<PluginMetadata | undefined> {
56
+ return this.hostedPlugin.promise;
57
+ }
58
+ }
@@ -1,32 +1,32 @@
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-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import URI from '@theia/core/lib/common/uri';
18
-
19
- // We export symbol name instead of symbol itself here because we need to provide
20
- // a contribution point to which any extensions could contribute.
21
- // In case of just symbols, symbol inside an extension won't be the same as here
22
- // even if the extension imports this module.
23
- // To solve this problem we should provide global symbol. So right way to use the contribution point is:
24
- // ...
25
- // bind(Symbol.for(HostedPluginUriPostProcessorSymbolName)).to(AContribution);
26
- // ...
27
- export const HostedPluginUriPostProcessorSymbolName = 'HostedPluginUriPostProcessor';
28
-
29
- export interface HostedPluginUriPostProcessor {
30
- processUri(uri: URI): Promise<URI>;
31
- processOptions(options: object): Promise<object>;
32
- }
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-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import URI from '@theia/core/lib/common/uri';
18
+
19
+ // We export symbol name instead of symbol itself here because we need to provide
20
+ // a contribution point to which any extensions could contribute.
21
+ // In case of just symbols, symbol inside an extension won't be the same as here
22
+ // even if the extension imports this module.
23
+ // To solve this problem we should provide global symbol. So right way to use the contribution point is:
24
+ // ...
25
+ // bind(Symbol.for(HostedPluginUriPostProcessorSymbolName)).to(AContribution);
26
+ // ...
27
+ export const HostedPluginUriPostProcessorSymbolName = 'HostedPluginUriPostProcessor';
28
+
29
+ export interface HostedPluginUriPostProcessor {
30
+ processUri(uri: URI): Promise<URI>;
31
+ processOptions(options: object): Promise<object>;
32
+ }
@@ -1,146 +1,146 @@
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-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { inject, injectable } from '@theia/core/shared/inversify';
18
- import * as cp from 'child_process';
19
- import * as processTree from 'ps-tree';
20
- import * as fs from '@theia/core/shared/fs-extra';
21
- import * as path from 'path';
22
- import { FileUri } from '@theia/core/lib/node';
23
- import { HostedPluginSupport } from '@theia/plugin-ext/lib/hosted/node/hosted-plugin';
24
- import { LogType } from '@theia/plugin-ext/lib/common/types';
25
-
26
- export const HostedPluginsManager = Symbol('HostedPluginsManager');
27
-
28
- export interface HostedPluginsManager {
29
-
30
- /**
31
- * Runs watcher script to recompile plugin on any changes along given path.
32
- *
33
- * @param uri uri to plugin root folder.
34
- */
35
- runWatchCompilation(uri: string): Promise<void>;
36
-
37
- /**
38
- * Stops watcher script.
39
- *
40
- * @param uri uri to plugin root folder.
41
- */
42
- stopWatchCompilation(uri: string): Promise<void>;
43
-
44
- /**
45
- * Checks if watcher script to recompile plugin is running.
46
- *
47
- * @param uri uri to plugin root folder.
48
- */
49
- isWatchCompilationRunning(uri: string): Promise<boolean>;
50
- }
51
-
52
- @injectable()
53
- export class HostedPluginsManagerImpl implements HostedPluginsManager {
54
-
55
- @inject(HostedPluginSupport)
56
- protected readonly hostedPluginSupport: HostedPluginSupport;
57
-
58
- protected watchCompilationRegistry: Map<string, cp.ChildProcess>;
59
-
60
- constructor() {
61
- this.watchCompilationRegistry = new Map();
62
- }
63
-
64
- runWatchCompilation(uri: string): Promise<void> {
65
- const pluginRootPath = FileUri.fsPath(uri);
66
-
67
- if (this.watchCompilationRegistry.has(pluginRootPath)) {
68
- throw new Error('Watcher is already running in ' + pluginRootPath);
69
- }
70
-
71
- if (!this.checkWatchScript(pluginRootPath)) {
72
- this.hostedPluginSupport.sendLog({
73
- data: 'Plugin in ' + uri + ' doesn\'t have watch script',
74
- type: LogType.Error
75
- });
76
- throw new Error('Watch script doesn\'t exist in ' + pluginRootPath + 'package.json');
77
- }
78
-
79
- return this.runWatchScript(pluginRootPath);
80
- }
81
-
82
- private killProcessTree(parentPid: number): void {
83
- processTree(parentPid, (err: Error, childProcesses: Array<processTree.PS>) => {
84
- childProcesses.forEach((p: processTree.PS) => {
85
- process.kill(parseInt(p.PID));
86
- });
87
- process.kill(parentPid);
88
- });
89
- }
90
-
91
- stopWatchCompilation(uri: string): Promise<void> {
92
- const pluginPath = FileUri.fsPath(uri);
93
-
94
- const watchProcess = this.watchCompilationRegistry.get(pluginPath);
95
- if (!watchProcess) {
96
- throw new Error('Watcher is not running in ' + pluginPath);
97
- }
98
-
99
- this.killProcessTree(watchProcess.pid!);
100
- return Promise.resolve();
101
- }
102
-
103
- isWatchCompilationRunning(uri: string): Promise<boolean> {
104
- const pluginPath = FileUri.fsPath(uri);
105
-
106
- return new Promise(resolve => resolve(this.watchCompilationRegistry.has(pluginPath)));
107
- }
108
-
109
- protected runWatchScript(pluginRootPath: string): Promise<void> {
110
- const watchProcess = cp.spawn('yarn', ['run', 'watch'], { cwd: pluginRootPath, shell: true });
111
- watchProcess.on('exit', () => this.unregisterWatchScript(pluginRootPath));
112
-
113
- this.watchCompilationRegistry.set(pluginRootPath, watchProcess);
114
- this.hostedPluginSupport.sendLog({
115
- data: 'Compilation watcher has been started in ' + pluginRootPath,
116
- type: LogType.Info
117
- });
118
- return Promise.resolve();
119
- }
120
-
121
- protected unregisterWatchScript(pluginRootPath: string): void {
122
- this.watchCompilationRegistry.delete(pluginRootPath);
123
- this.hostedPluginSupport.sendLog({
124
- data: 'Compilation watcher has been stopped in ' + pluginRootPath,
125
- type: LogType.Info
126
- });
127
- }
128
-
129
- /**
130
- * Checks whether watch script is present into package.json by given parent folder.
131
- *
132
- * @param pluginPath path to plugin's root directory
133
- */
134
- protected async checkWatchScript(pluginPath: string): Promise<boolean> {
135
- const pluginPackageJsonPath = path.join(pluginPath, 'package.json');
136
- try {
137
- const packageJson = await fs.readJSON(pluginPackageJsonPath);
138
- const scripts = packageJson['scripts'];
139
- if (scripts && scripts['watch']) {
140
- return true;
141
- }
142
- } catch { }
143
- return false;
144
- }
145
-
146
- }
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-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { inject, injectable } from '@theia/core/shared/inversify';
18
+ import * as cp from 'child_process';
19
+ import * as processTree from 'ps-tree';
20
+ import * as fs from '@theia/core/shared/fs-extra';
21
+ import * as path from 'path';
22
+ import { FileUri } from '@theia/core/lib/node';
23
+ import { HostedPluginSupport } from '@theia/plugin-ext/lib/hosted/node/hosted-plugin';
24
+ import { LogType } from '@theia/plugin-ext/lib/common/types';
25
+
26
+ export const HostedPluginsManager = Symbol('HostedPluginsManager');
27
+
28
+ export interface HostedPluginsManager {
29
+
30
+ /**
31
+ * Runs watcher script to recompile plugin on any changes along given path.
32
+ *
33
+ * @param uri uri to plugin root folder.
34
+ */
35
+ runWatchCompilation(uri: string): Promise<void>;
36
+
37
+ /**
38
+ * Stops watcher script.
39
+ *
40
+ * @param uri uri to plugin root folder.
41
+ */
42
+ stopWatchCompilation(uri: string): Promise<void>;
43
+
44
+ /**
45
+ * Checks if watcher script to recompile plugin is running.
46
+ *
47
+ * @param uri uri to plugin root folder.
48
+ */
49
+ isWatchCompilationRunning(uri: string): Promise<boolean>;
50
+ }
51
+
52
+ @injectable()
53
+ export class HostedPluginsManagerImpl implements HostedPluginsManager {
54
+
55
+ @inject(HostedPluginSupport)
56
+ protected readonly hostedPluginSupport: HostedPluginSupport;
57
+
58
+ protected watchCompilationRegistry: Map<string, cp.ChildProcess>;
59
+
60
+ constructor() {
61
+ this.watchCompilationRegistry = new Map();
62
+ }
63
+
64
+ runWatchCompilation(uri: string): Promise<void> {
65
+ const pluginRootPath = FileUri.fsPath(uri);
66
+
67
+ if (this.watchCompilationRegistry.has(pluginRootPath)) {
68
+ throw new Error('Watcher is already running in ' + pluginRootPath);
69
+ }
70
+
71
+ if (!this.checkWatchScript(pluginRootPath)) {
72
+ this.hostedPluginSupport.sendLog({
73
+ data: 'Plugin in ' + uri + ' doesn\'t have watch script',
74
+ type: LogType.Error
75
+ });
76
+ throw new Error('Watch script doesn\'t exist in ' + pluginRootPath + 'package.json');
77
+ }
78
+
79
+ return this.runWatchScript(pluginRootPath);
80
+ }
81
+
82
+ private killProcessTree(parentPid: number): void {
83
+ processTree(parentPid, (err: Error, childProcesses: Array<processTree.PS>) => {
84
+ childProcesses.forEach((p: processTree.PS) => {
85
+ process.kill(parseInt(p.PID));
86
+ });
87
+ process.kill(parentPid);
88
+ });
89
+ }
90
+
91
+ stopWatchCompilation(uri: string): Promise<void> {
92
+ const pluginPath = FileUri.fsPath(uri);
93
+
94
+ const watchProcess = this.watchCompilationRegistry.get(pluginPath);
95
+ if (!watchProcess) {
96
+ throw new Error('Watcher is not running in ' + pluginPath);
97
+ }
98
+
99
+ this.killProcessTree(watchProcess.pid!);
100
+ return Promise.resolve();
101
+ }
102
+
103
+ isWatchCompilationRunning(uri: string): Promise<boolean> {
104
+ const pluginPath = FileUri.fsPath(uri);
105
+
106
+ return new Promise(resolve => resolve(this.watchCompilationRegistry.has(pluginPath)));
107
+ }
108
+
109
+ protected runWatchScript(pluginRootPath: string): Promise<void> {
110
+ const watchProcess = cp.spawn('yarn', ['run', 'watch'], { cwd: pluginRootPath, shell: true });
111
+ watchProcess.on('exit', () => this.unregisterWatchScript(pluginRootPath));
112
+
113
+ this.watchCompilationRegistry.set(pluginRootPath, watchProcess);
114
+ this.hostedPluginSupport.sendLog({
115
+ data: 'Compilation watcher has been started in ' + pluginRootPath,
116
+ type: LogType.Info
117
+ });
118
+ return Promise.resolve();
119
+ }
120
+
121
+ protected unregisterWatchScript(pluginRootPath: string): void {
122
+ this.watchCompilationRegistry.delete(pluginRootPath);
123
+ this.hostedPluginSupport.sendLog({
124
+ data: 'Compilation watcher has been stopped in ' + pluginRootPath,
125
+ type: LogType.Info
126
+ });
127
+ }
128
+
129
+ /**
130
+ * Checks whether watch script is present into package.json by given parent folder.
131
+ *
132
+ * @param pluginPath path to plugin's root directory
133
+ */
134
+ protected async checkWatchScript(pluginPath: string): Promise<boolean> {
135
+ const pluginPackageJsonPath = path.join(pluginPath, 'package.json');
136
+ try {
137
+ const packageJson = await fs.readJSON(pluginPackageJsonPath);
138
+ const scripts = packageJson['scripts'];
139
+ if (scripts && scripts['watch']) {
140
+ return true;
141
+ }
142
+ } catch { }
143
+ return false;
144
+ }
145
+
146
+ }
@@ -1,54 +1,54 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2019 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-only WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { HostedInstanceManager, NodeHostedPluginRunner } from './hosted-instance-manager';
18
- import { HostedPluginUriPostProcessorSymbolName } from './hosted-plugin-uri-postprocessor';
19
- import { HostedPluginsManager, HostedPluginsManagerImpl } from './hosted-plugins-manager';
20
- import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
21
- import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module';
22
- import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
23
- import { PluginDevServerImpl } from './plugin-dev-service';
24
- import { PluginDevServer, PluginDevClient, pluginDevServicePath } from '../common/plugin-dev-protocol';
25
- import { HostedPluginReader } from './hosted-plugin-reader';
26
- import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
27
-
28
- const commonHostedConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService }) => {
29
- bind(HostedPluginsManagerImpl).toSelf().inSingletonScope();
30
- bind(HostedPluginsManager).toService(HostedPluginsManagerImpl);
31
- bind(PluginDevServerImpl).toSelf().inSingletonScope();
32
- bind(PluginDevServer).toService(PluginDevServerImpl);
33
- bindBackendService<PluginDevServer, PluginDevClient>(pluginDevServicePath, PluginDevServer, (server, client) => {
34
- server.setClient(client);
35
- client.onDidCloseConnection(() => server.dispose());
36
- return server;
37
- });
38
- });
39
-
40
- export function bindCommonHostedBackend(bind: interfaces.Bind): void {
41
- bind(HostedPluginReader).toSelf().inSingletonScope();
42
- bind(BackendApplicationContribution).toService(HostedPluginReader);
43
- bind(ConnectionContainerModule).toConstantValue(commonHostedConnectionModule);
44
- }
45
-
46
- const hostedBackendConnectionModule = ConnectionContainerModule.create(({ bind }) => {
47
- bindContributionProvider(bind, Symbol.for(HostedPluginUriPostProcessorSymbolName));
48
- bind(HostedInstanceManager).to(NodeHostedPluginRunner).inSingletonScope();
49
- });
50
-
51
- export default new ContainerModule(bind => {
52
- bindCommonHostedBackend(bind);
53
- bind(ConnectionContainerModule).toConstantValue(hostedBackendConnectionModule);
54
- });
1
+ // *****************************************************************************
2
+ // Copyright (C) 2019 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-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { HostedInstanceManager, NodeHostedPluginRunner } from './hosted-instance-manager';
18
+ import { HostedPluginUriPostProcessorSymbolName } from './hosted-plugin-uri-postprocessor';
19
+ import { HostedPluginsManager, HostedPluginsManagerImpl } from './hosted-plugins-manager';
20
+ import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
21
+ import { ConnectionContainerModule } from '@theia/core/lib/node/messaging/connection-container-module';
22
+ import { bindContributionProvider } from '@theia/core/lib/common/contribution-provider';
23
+ import { PluginDevServerImpl } from './plugin-dev-service';
24
+ import { PluginDevServer, PluginDevClient, pluginDevServicePath } from '../common/plugin-dev-protocol';
25
+ import { HostedPluginReader } from './hosted-plugin-reader';
26
+ import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
27
+
28
+ const commonHostedConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService }) => {
29
+ bind(HostedPluginsManagerImpl).toSelf().inSingletonScope();
30
+ bind(HostedPluginsManager).toService(HostedPluginsManagerImpl);
31
+ bind(PluginDevServerImpl).toSelf().inSingletonScope();
32
+ bind(PluginDevServer).toService(PluginDevServerImpl);
33
+ bindBackendService<PluginDevServer, PluginDevClient>(pluginDevServicePath, PluginDevServer, (server, client) => {
34
+ server.setClient(client);
35
+ client.onDidCloseConnection(() => server.dispose());
36
+ return server;
37
+ });
38
+ });
39
+
40
+ export function bindCommonHostedBackend(bind: interfaces.Bind): void {
41
+ bind(HostedPluginReader).toSelf().inSingletonScope();
42
+ bind(BackendApplicationContribution).toService(HostedPluginReader);
43
+ bind(ConnectionContainerModule).toConstantValue(commonHostedConnectionModule);
44
+ }
45
+
46
+ const hostedBackendConnectionModule = ConnectionContainerModule.create(({ bind }) => {
47
+ bindContributionProvider(bind, Symbol.for(HostedPluginUriPostProcessorSymbolName));
48
+ bind(HostedInstanceManager).to(NodeHostedPluginRunner).inSingletonScope();
49
+ });
50
+
51
+ export default new ContainerModule(bind => {
52
+ bindCommonHostedBackend(bind);
53
+ bind(ConnectionContainerModule).toConstantValue(hostedBackendConnectionModule);
54
+ });