@theia/plugin-ext-vscode 1.53.0-next.55 → 1.53.0-next.64
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 +32 -32
- package/package.json +15 -15
- package/src/browser/plugin-vscode-commands-contribution.ts +987 -987
- package/src/browser/plugin-vscode-contribution.ts +47 -47
- package/src/browser/plugin-vscode-frontend-module.ts +30 -30
- package/src/common/plugin-vscode-environment.ts +59 -59
- package/src/common/plugin-vscode-types.ts +20 -20
- package/src/common/plugin-vscode-uri.ts +45 -45
- package/src/node/context/plugin-vscode-init-fe.ts +43 -43
- package/src/node/local-vsix-file-plugin-deployer-resolver.ts +51 -51
- package/src/node/package.spec.ts +28 -28
- package/src/node/plugin-vscode-backend-module.ts +46 -46
- package/src/node/plugin-vscode-cli-contribution.ts +64 -64
- package/src/node/plugin-vscode-deployer-participant.ts +48 -48
- package/src/node/plugin-vscode-directory-handler.ts +123 -123
- package/src/node/plugin-vscode-file-handler.ts +62 -62
- package/src/node/plugin-vscode-init.ts +80 -80
- package/src/node/plugin-vscode-utils.ts +101 -101
- package/src/node/scanner-vscode.ts +113 -113
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2015-2021 Red Hat, Inc.
|
|
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 * as path from 'path';
|
|
18
|
-
import { injectable } from '@theia/core/shared/inversify';
|
|
19
|
-
import { PluginScanner, PluginEngine, PluginPackage, PluginModel, PluginLifecycle, PluginEntryPoint, buildFrontendModuleName, UIKind, PluginIdentifiers } from '@theia/plugin-ext';
|
|
20
|
-
import { TheiaPluginScanner } from '@theia/plugin-ext/lib/hosted/node/scanners/scanner-theia';
|
|
21
|
-
import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
|
|
22
|
-
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri';
|
|
23
|
-
|
|
24
|
-
const uiKind = environment.electron.is() ? UIKind.Desktop : UIKind.Web;
|
|
25
|
-
|
|
26
|
-
@injectable()
|
|
27
|
-
export class VsCodePluginScanner extends TheiaPluginScanner implements PluginScanner {
|
|
28
|
-
|
|
29
|
-
private readonly VSCODE_TYPE: PluginEngine = 'vscode';
|
|
30
|
-
|
|
31
|
-
override get apiType(): PluginEngine {
|
|
32
|
-
return this.VSCODE_TYPE;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
override getModel(plugin: PluginPackage): PluginModel {
|
|
36
|
-
// publisher can be empty on vscode extension development
|
|
37
|
-
const publisher = plugin.publisher ?? PluginIdentifiers.UNPUBLISHED;
|
|
38
|
-
|
|
39
|
-
// Only one entrypoint is valid in vscode extensions
|
|
40
|
-
// Mimic choosing frontend (web extension) and backend (local/remote extension) as described here:
|
|
41
|
-
// https://code.visualstudio.com/api/advanced-topics/extension-host#preferred-extension-location
|
|
42
|
-
const entryPoint: PluginEntryPoint = {};
|
|
43
|
-
|
|
44
|
-
// Act like codespaces when run in the browser (UIKind === 'web' and extensionKind is ['ui'])
|
|
45
|
-
const preferFrontend = uiKind === UIKind.Web && (plugin.extensionKind?.length === 1 && plugin.extensionKind[0] === 'ui');
|
|
46
|
-
|
|
47
|
-
if (plugin.browser && (!plugin.main || preferFrontend)) {
|
|
48
|
-
// Use frontend if available and there is no backend or frontend is preferred
|
|
49
|
-
entryPoint.frontend = plugin.browser;
|
|
50
|
-
} else {
|
|
51
|
-
// Default to using backend
|
|
52
|
-
entryPoint.backend = plugin.main;
|
|
53
|
-
}
|
|
54
|
-
if (plugin.theiaPlugin?.headless) {
|
|
55
|
-
// Support the Theia-specific extension for headless plugins
|
|
56
|
-
entryPoint.headless = plugin.theiaPlugin?.headless;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const result: PluginModel = {
|
|
60
|
-
packagePath: plugin.packagePath,
|
|
61
|
-
packageUri: this.pluginUriFactory.createUri(plugin).toString(),
|
|
62
|
-
// see id definition: https://github.com/microsoft/vscode/blob/15916055fe0cb9411a5f36119b3b012458fe0a1d/src/vs/platform/extensions/common/extensions.ts#L167-L169
|
|
63
|
-
id: `${publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
|
|
64
|
-
name: plugin.name,
|
|
65
|
-
publisher: publisher,
|
|
66
|
-
version: plugin.version,
|
|
67
|
-
displayName: plugin.displayName,
|
|
68
|
-
description: plugin.description,
|
|
69
|
-
engine: {
|
|
70
|
-
type: this.VSCODE_TYPE,
|
|
71
|
-
version: plugin.engines[this.VSCODE_TYPE]
|
|
72
|
-
},
|
|
73
|
-
entryPoint,
|
|
74
|
-
iconUrl: plugin.icon && PluginPackage.toPluginUrl(plugin, plugin.icon),
|
|
75
|
-
l10n: plugin.l10n,
|
|
76
|
-
readmeUrl: PluginPackage.toPluginUrl(plugin, './README.md'),
|
|
77
|
-
licenseUrl: PluginPackage.toPluginUrl(plugin, './LICENSE')
|
|
78
|
-
};
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
/**
|
|
83
|
-
* Maps extension dependencies to deployable extension dependencies.
|
|
84
|
-
*/
|
|
85
|
-
override getDependencies(plugin: PluginPackage): Map<string, string> | undefined {
|
|
86
|
-
// Store the list of dependencies.
|
|
87
|
-
const dependencies = new Map<string, string>();
|
|
88
|
-
// Iterate through the list of dependencies from `extensionDependencies` and `extensionPack`.
|
|
89
|
-
for (const dependency of [plugin.extensionDependencies, plugin.extensionPack]) {
|
|
90
|
-
if (dependency !== undefined) {
|
|
91
|
-
// Iterate over the list of dependencies present, and add them to the collection.
|
|
92
|
-
dependency.forEach((dep: string) => {
|
|
93
|
-
const dependencyId = dep.toLowerCase();
|
|
94
|
-
dependencies.set(dependencyId, VSCodeExtensionUri.fromId(dependencyId).toString());
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
// Return the map of dependencies if present, else `undefined`.
|
|
99
|
-
return dependencies.size > 0 ? dependencies : undefined;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
override getLifecycle(plugin: PluginPackage): PluginLifecycle {
|
|
103
|
-
return {
|
|
104
|
-
startMethod: 'activate',
|
|
105
|
-
stopMethod: 'deactivate',
|
|
106
|
-
frontendModuleName: buildFrontendModuleName(plugin),
|
|
107
|
-
|
|
108
|
-
frontendInitPath: 'plugin-vscode-init-fe.js',
|
|
109
|
-
backendInitPath: path.join(__dirname, 'plugin-vscode-init'),
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2015-2021 Red Hat, Inc.
|
|
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 * as path from 'path';
|
|
18
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
19
|
+
import { PluginScanner, PluginEngine, PluginPackage, PluginModel, PluginLifecycle, PluginEntryPoint, buildFrontendModuleName, UIKind, PluginIdentifiers } from '@theia/plugin-ext';
|
|
20
|
+
import { TheiaPluginScanner } from '@theia/plugin-ext/lib/hosted/node/scanners/scanner-theia';
|
|
21
|
+
import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
|
|
22
|
+
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri';
|
|
23
|
+
|
|
24
|
+
const uiKind = environment.electron.is() ? UIKind.Desktop : UIKind.Web;
|
|
25
|
+
|
|
26
|
+
@injectable()
|
|
27
|
+
export class VsCodePluginScanner extends TheiaPluginScanner implements PluginScanner {
|
|
28
|
+
|
|
29
|
+
private readonly VSCODE_TYPE: PluginEngine = 'vscode';
|
|
30
|
+
|
|
31
|
+
override get apiType(): PluginEngine {
|
|
32
|
+
return this.VSCODE_TYPE;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
override getModel(plugin: PluginPackage): PluginModel {
|
|
36
|
+
// publisher can be empty on vscode extension development
|
|
37
|
+
const publisher = plugin.publisher ?? PluginIdentifiers.UNPUBLISHED;
|
|
38
|
+
|
|
39
|
+
// Only one entrypoint is valid in vscode extensions
|
|
40
|
+
// Mimic choosing frontend (web extension) and backend (local/remote extension) as described here:
|
|
41
|
+
// https://code.visualstudio.com/api/advanced-topics/extension-host#preferred-extension-location
|
|
42
|
+
const entryPoint: PluginEntryPoint = {};
|
|
43
|
+
|
|
44
|
+
// Act like codespaces when run in the browser (UIKind === 'web' and extensionKind is ['ui'])
|
|
45
|
+
const preferFrontend = uiKind === UIKind.Web && (plugin.extensionKind?.length === 1 && plugin.extensionKind[0] === 'ui');
|
|
46
|
+
|
|
47
|
+
if (plugin.browser && (!plugin.main || preferFrontend)) {
|
|
48
|
+
// Use frontend if available and there is no backend or frontend is preferred
|
|
49
|
+
entryPoint.frontend = plugin.browser;
|
|
50
|
+
} else {
|
|
51
|
+
// Default to using backend
|
|
52
|
+
entryPoint.backend = plugin.main;
|
|
53
|
+
}
|
|
54
|
+
if (plugin.theiaPlugin?.headless) {
|
|
55
|
+
// Support the Theia-specific extension for headless plugins
|
|
56
|
+
entryPoint.headless = plugin.theiaPlugin?.headless;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const result: PluginModel = {
|
|
60
|
+
packagePath: plugin.packagePath,
|
|
61
|
+
packageUri: this.pluginUriFactory.createUri(plugin).toString(),
|
|
62
|
+
// see id definition: https://github.com/microsoft/vscode/blob/15916055fe0cb9411a5f36119b3b012458fe0a1d/src/vs/platform/extensions/common/extensions.ts#L167-L169
|
|
63
|
+
id: `${publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
|
|
64
|
+
name: plugin.name,
|
|
65
|
+
publisher: publisher,
|
|
66
|
+
version: plugin.version,
|
|
67
|
+
displayName: plugin.displayName,
|
|
68
|
+
description: plugin.description,
|
|
69
|
+
engine: {
|
|
70
|
+
type: this.VSCODE_TYPE,
|
|
71
|
+
version: plugin.engines[this.VSCODE_TYPE]
|
|
72
|
+
},
|
|
73
|
+
entryPoint,
|
|
74
|
+
iconUrl: plugin.icon && PluginPackage.toPluginUrl(plugin, plugin.icon),
|
|
75
|
+
l10n: plugin.l10n,
|
|
76
|
+
readmeUrl: PluginPackage.toPluginUrl(plugin, './README.md'),
|
|
77
|
+
licenseUrl: PluginPackage.toPluginUrl(plugin, './LICENSE')
|
|
78
|
+
};
|
|
79
|
+
return result;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Maps extension dependencies to deployable extension dependencies.
|
|
84
|
+
*/
|
|
85
|
+
override getDependencies(plugin: PluginPackage): Map<string, string> | undefined {
|
|
86
|
+
// Store the list of dependencies.
|
|
87
|
+
const dependencies = new Map<string, string>();
|
|
88
|
+
// Iterate through the list of dependencies from `extensionDependencies` and `extensionPack`.
|
|
89
|
+
for (const dependency of [plugin.extensionDependencies, plugin.extensionPack]) {
|
|
90
|
+
if (dependency !== undefined) {
|
|
91
|
+
// Iterate over the list of dependencies present, and add them to the collection.
|
|
92
|
+
dependency.forEach((dep: string) => {
|
|
93
|
+
const dependencyId = dep.toLowerCase();
|
|
94
|
+
dependencies.set(dependencyId, VSCodeExtensionUri.fromId(dependencyId).toString());
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
// Return the map of dependencies if present, else `undefined`.
|
|
99
|
+
return dependencies.size > 0 ? dependencies : undefined;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
override getLifecycle(plugin: PluginPackage): PluginLifecycle {
|
|
103
|
+
return {
|
|
104
|
+
startMethod: 'activate',
|
|
105
|
+
stopMethod: 'deactivate',
|
|
106
|
+
frontendModuleName: buildFrontendModuleName(plugin),
|
|
107
|
+
|
|
108
|
+
frontendInitPath: 'plugin-vscode-init-fe.js',
|
|
109
|
+
backendInitPath: path.join(__dirname, 'plugin-vscode-init'),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
}
|