@theia/vsx-registry 1.45.1 → 1.46.0-next.137
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/browser/recommended-extensions/preference-provider-overrides.js +4 -9
- package/lib/browser/recommended-extensions/preference-provider-overrides.js.map +1 -1
- package/lib/browser/recommended-extensions/recommended-extensions-json-schema.js +10 -18
- package/lib/browser/recommended-extensions/recommended-extensions-json-schema.js.map +1 -1
- package/lib/browser/vsx-extension-argument-processor.d.ts +5 -0
- package/lib/browser/vsx-extension-argument-processor.d.ts.map +1 -0
- package/lib/browser/vsx-extension-argument-processor.js +34 -0
- package/lib/browser/vsx-extension-argument-processor.js.map +1 -0
- package/lib/browser/vsx-extension-commands.d.ts +1 -0
- package/lib/browser/vsx-extension-commands.d.ts.map +1 -1
- package/lib/browser/vsx-extension-commands.js +5 -0
- package/lib/browser/vsx-extension-commands.js.map +1 -1
- package/lib/browser/vsx-extension-editor-manager.js +3 -8
- package/lib/browser/vsx-extension-editor-manager.js.map +1 -1
- package/lib/browser/vsx-extension-editor.js +10 -18
- package/lib/browser/vsx-extension-editor.js.map +1 -1
- package/lib/browser/vsx-extension.d.ts +4 -0
- package/lib/browser/vsx-extension.d.ts.map +1 -1
- package/lib/browser/vsx-extension.js +64 -47
- package/lib/browser/vsx-extension.js.map +1 -1
- package/lib/browser/vsx-extensions-contribution.d.ts +18 -8
- package/lib/browser/vsx-extensions-contribution.d.ts.map +1 -1
- package/lib/browser/vsx-extensions-contribution.js +90 -64
- package/lib/browser/vsx-extensions-contribution.js.map +1 -1
- package/lib/browser/vsx-extensions-model.d.ts +4 -1
- package/lib/browser/vsx-extensions-model.d.ts.map +1 -1
- package/lib/browser/vsx-extensions-model.js +83 -45
- package/lib/browser/vsx-extensions-model.js.map +1 -1
- package/lib/browser/vsx-extensions-preferences.d.ts +12 -0
- package/lib/browser/vsx-extensions-preferences.d.ts.map +1 -0
- package/lib/browser/vsx-extensions-preferences.js +47 -0
- package/lib/browser/vsx-extensions-preferences.js.map +1 -0
- package/lib/browser/vsx-extensions-search-bar.d.ts +10 -2
- package/lib/browser/vsx-extensions-search-bar.d.ts.map +1 -1
- package/lib/browser/vsx-extensions-search-bar.js +43 -20
- package/lib/browser/vsx-extensions-search-bar.js.map +1 -1
- package/lib/browser/vsx-extensions-search-model.js +2 -7
- package/lib/browser/vsx-extensions-search-model.js.map +1 -1
- package/lib/browser/vsx-extensions-source.js +11 -19
- package/lib/browser/vsx-extensions-source.js.map +1 -1
- package/lib/browser/vsx-extensions-view-container.js +10 -18
- package/lib/browser/vsx-extensions-view-container.js.map +1 -1
- package/lib/browser/vsx-extensions-widget.d.ts +2 -1
- package/lib/browser/vsx-extensions-widget.d.ts.map +1 -1
- package/lib/browser/vsx-extensions-widget.js +19 -19
- package/lib/browser/vsx-extensions-widget.js.map +1 -1
- package/lib/browser/vsx-language-quick-pick-service.js +11 -19
- package/lib/browser/vsx-language-quick-pick-service.js.map +1 -1
- package/lib/browser/vsx-registry-frontend-module.d.ts.map +1 -1
- package/lib/browser/vsx-registry-frontend-module.js +6 -0
- package/lib/browser/vsx-registry-frontend-module.js.map +1 -1
- package/lib/node/vsx-cli-deployer-participant.d.ts +7 -0
- package/lib/node/vsx-cli-deployer-participant.d.ts.map +1 -0
- package/lib/node/vsx-cli-deployer-participant.js +52 -0
- package/lib/node/vsx-cli-deployer-participant.js.map +1 -0
- package/lib/node/vsx-cli.d.ts +1 -0
- package/lib/node/vsx-cli.d.ts.map +1 -1
- package/lib/node/vsx-cli.js +17 -7
- package/lib/node/vsx-cli.js.map +1 -1
- package/lib/node/vsx-environment-impl.js +6 -14
- package/lib/node/vsx-environment-impl.js.map +1 -1
- package/lib/node/vsx-extension-resolver.d.ts.map +1 -1
- package/lib/node/vsx-extension-resolver.js +22 -29
- package/lib/node/vsx-extension-resolver.js.map +1 -1
- package/lib/node/vsx-registry-backend-module.d.ts.map +1 -1
- package/lib/node/vsx-registry-backend-module.js +3 -0
- package/lib/node/vsx-registry-backend-module.js.map +1 -1
- package/package.json +12 -11
- package/src/browser/style/index.css +65 -2
- package/src/browser/vsx-extension-argument-processor.ts +32 -0
- package/src/browser/vsx-extension-commands.ts +5 -0
- package/src/browser/vsx-extension-editor-manager.ts +1 -1
- package/src/browser/vsx-extension.tsx +46 -11
- package/src/browser/vsx-extensions-contribution.ts +62 -24
- package/src/browser/vsx-extensions-model.ts +61 -14
- package/src/browser/vsx-extensions-preferences.ts +58 -0
- package/src/browser/vsx-extensions-search-bar.tsx +52 -14
- package/src/browser/vsx-extensions-widget.tsx +10 -1
- package/src/browser/vsx-language-quick-pick-service.ts +1 -1
- package/src/browser/vsx-registry-frontend-module.ts +7 -0
- package/src/node/vsx-cli-deployer-participant.ts +46 -0
- package/src/node/vsx-cli.ts +13 -0
- package/src/node/vsx-extension-resolver.ts +8 -7
- package/src/node/vsx-registry-backend-module.ts +4 -1
|
@@ -28,7 +28,7 @@ import { PreferenceInspectionScope, PreferenceService } from '@theia/core/lib/br
|
|
|
28
28
|
import { WorkspaceService } from '@theia/workspace/lib/browser';
|
|
29
29
|
import { RecommendedExtensions } from './recommended-extensions/recommended-extensions-preference-contribution';
|
|
30
30
|
import URI from '@theia/core/lib/common/uri';
|
|
31
|
-
import { VSXExtensionRaw, VSXResponseError, VSXSearchOptions } from '@theia/ovsx-client/lib/ovsx-types';
|
|
31
|
+
import { OVSXClient, VSXAllVersions, VSXExtensionRaw, VSXResponseError, VSXSearchEntry, VSXSearchOptions } from '@theia/ovsx-client/lib/ovsx-types';
|
|
32
32
|
import { OVSXClientProvider } from '../common/ovsx-client-provider';
|
|
33
33
|
import { RequestContext, RequestService } from '@theia/core/shared/@theia/request';
|
|
34
34
|
import { OVSXApiFilter } from '@theia/ovsx-client';
|
|
@@ -113,6 +113,13 @@ export class VSXExtensionsModel {
|
|
|
113
113
|
return this._recommended.values();
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
+
setOnlyShowVerifiedExtensions(bool: boolean): void {
|
|
117
|
+
if (this.preferences.get('extensions.onlyShowVerifiedExtensions') !== bool) {
|
|
118
|
+
this.preferences.updateValue('extensions.onlyShowVerifiedExtensions', bool);
|
|
119
|
+
}
|
|
120
|
+
this.updateSearchResult();
|
|
121
|
+
}
|
|
122
|
+
|
|
116
123
|
isInstalled(id: string): boolean {
|
|
117
124
|
return this._installed.has(id);
|
|
118
125
|
}
|
|
@@ -208,9 +215,8 @@ export class VSXExtensionsModel {
|
|
|
208
215
|
|
|
209
216
|
protected doUpdateSearchResult(param: VSXSearchOptions, token: CancellationToken): Promise<void> {
|
|
210
217
|
return this.doChange(async () => {
|
|
211
|
-
|
|
218
|
+
this._searchResult = new Set<string>();
|
|
212
219
|
if (!param.query) {
|
|
213
|
-
this._searchResult = searchResult;
|
|
214
220
|
return;
|
|
215
221
|
}
|
|
216
222
|
const client = await this.clientProvider();
|
|
@@ -225,20 +231,55 @@ export class VSXExtensionsModel {
|
|
|
225
231
|
if (!allVersions) {
|
|
226
232
|
continue;
|
|
227
233
|
}
|
|
228
|
-
this.
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
|
|
234
|
+
if (this.preferences.get('extensions.onlyShowVerifiedExtensions')) {
|
|
235
|
+
this.fetchVerifiedStatus(id, client, allVersions).then(verified => {
|
|
236
|
+
this.doChange(() => {
|
|
237
|
+
this.addExtensions(data, id, allVersions, !!verified);
|
|
238
|
+
return Promise.resolve();
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
} else {
|
|
242
|
+
this.addExtensions(data, id, allVersions);
|
|
243
|
+
this.fetchVerifiedStatus(id, client, allVersions).then(verified => {
|
|
244
|
+
this.doChange(() => {
|
|
245
|
+
let extension = this.getExtension(id);
|
|
246
|
+
extension = this.setExtension(id);
|
|
247
|
+
extension.update(Object.assign({
|
|
248
|
+
verified: verified
|
|
249
|
+
}));
|
|
250
|
+
return Promise.resolve();
|
|
251
|
+
});
|
|
252
|
+
});
|
|
253
|
+
}
|
|
237
254
|
}
|
|
238
|
-
this._searchResult = searchResult;
|
|
239
255
|
}, token);
|
|
240
256
|
}
|
|
241
257
|
|
|
258
|
+
protected async fetchVerifiedStatus(id: string, client: OVSXClient, allVersions: VSXAllVersions): Promise<boolean | undefined> {
|
|
259
|
+
const res = await client.query({ extensionId: id, extensionVersion: allVersions.version, includeAllVersions: true });
|
|
260
|
+
let verified = res.extensions?.[0].verified;
|
|
261
|
+
if (!verified && res.extensions?.[0].publishedBy.loginName === 'open-vsx') {
|
|
262
|
+
verified = true;
|
|
263
|
+
}
|
|
264
|
+
return verified;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
protected addExtensions(data: VSXSearchEntry, id: string, allVersions: VSXAllVersions, verified?: boolean): void {
|
|
268
|
+
if (!this.preferences.get('extensions.onlyShowVerifiedExtensions') || verified) {
|
|
269
|
+
const extension = this.setExtension(id);
|
|
270
|
+
extension.update(Object.assign(data, {
|
|
271
|
+
publisher: data.namespace,
|
|
272
|
+
downloadUrl: data.files.download,
|
|
273
|
+
iconUrl: data.files.icon,
|
|
274
|
+
readmeUrl: data.files.readme,
|
|
275
|
+
licenseUrl: data.files.license,
|
|
276
|
+
version: allVersions.version,
|
|
277
|
+
verified: verified
|
|
278
|
+
}));
|
|
279
|
+
this._searchResult.add(id);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
|
|
242
283
|
protected async updateInstalled(): Promise<void> {
|
|
243
284
|
const prevInstalled = this._installed;
|
|
244
285
|
return this.doChange(async () => {
|
|
@@ -331,6 +372,11 @@ export class VSXExtensionsModel {
|
|
|
331
372
|
if (data.error) {
|
|
332
373
|
return this.onDidFailRefresh(id, data.error);
|
|
333
374
|
}
|
|
375
|
+
if (!data.verified) {
|
|
376
|
+
if (data.publishedBy.loginName === 'open-vsx') {
|
|
377
|
+
data.verified = true;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
334
380
|
extension = this.setExtension(id);
|
|
335
381
|
extension.update(Object.assign(data, {
|
|
336
382
|
publisher: data.namespace,
|
|
@@ -338,7 +384,8 @@ export class VSXExtensionsModel {
|
|
|
338
384
|
iconUrl: data.files.icon,
|
|
339
385
|
readmeUrl: data.files.readme,
|
|
340
386
|
licenseUrl: data.files.license,
|
|
341
|
-
version: data.version
|
|
387
|
+
version: data.version,
|
|
388
|
+
verified: data.verified
|
|
342
389
|
}));
|
|
343
390
|
return extension;
|
|
344
391
|
} catch (e) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 Ericsson 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 { interfaces } from '@theia/core/shared/inversify';
|
|
18
|
+
import {
|
|
19
|
+
createPreferenceProxy,
|
|
20
|
+
PreferenceProxy,
|
|
21
|
+
PreferenceService,
|
|
22
|
+
PreferenceSchema,
|
|
23
|
+
PreferenceContribution
|
|
24
|
+
} from '@theia/core/lib/browser/preferences';
|
|
25
|
+
import { nls } from '@theia/core';
|
|
26
|
+
|
|
27
|
+
export const VsxExtensionsPreferenceSchema: PreferenceSchema = {
|
|
28
|
+
'type': 'object',
|
|
29
|
+
properties: {
|
|
30
|
+
'extensions.onlyShowVerifiedExtensions': {
|
|
31
|
+
type: 'boolean',
|
|
32
|
+
default: false,
|
|
33
|
+
description: nls.localize('theia/vsx-registry/onlyShowVerifiedExtensionsDescription', 'This allows the {0} to only show verified extensions.', 'Open VSX Registry')
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export interface VsxExtensionsConfiguration {
|
|
39
|
+
'extensions.onlyShowVerifiedExtensions': boolean;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export const VsxExtensionsPreferenceContribution = Symbol('VsxExtensionsPreferenceContribution');
|
|
43
|
+
export const VsxExtensionsPreferences = Symbol('VsxExtensionsPreferences');
|
|
44
|
+
export type VsxExtensionsPreferences = PreferenceProxy<VsxExtensionsConfiguration>;
|
|
45
|
+
|
|
46
|
+
export function createVsxExtensionsPreferences(preferences: PreferenceService, schema: PreferenceSchema = VsxExtensionsPreferenceSchema): VsxExtensionsPreferences {
|
|
47
|
+
return createPreferenceProxy(preferences, schema);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function bindVsxExtensionsPreferences(bind: interfaces.Bind): void {
|
|
51
|
+
bind(VsxExtensionsPreferences).toDynamicValue(ctx => {
|
|
52
|
+
const preferences = ctx.container.get<PreferenceService>(PreferenceService);
|
|
53
|
+
const contribution = ctx.container.get<PreferenceContribution>(VsxExtensionsPreferenceContribution);
|
|
54
|
+
return createVsxExtensionsPreferences(preferences, contribution.schema);
|
|
55
|
+
}).inSingletonScope();
|
|
56
|
+
bind(VsxExtensionsPreferenceContribution).toConstantValue({ schema: VsxExtensionsPreferenceSchema });
|
|
57
|
+
bind(PreferenceContribution).toService(VsxExtensionsPreferenceContribution);
|
|
58
|
+
}
|
|
@@ -16,37 +16,57 @@
|
|
|
16
16
|
|
|
17
17
|
import * as React from '@theia/core/shared/react';
|
|
18
18
|
import { injectable, postConstruct, inject } from '@theia/core/shared/inversify';
|
|
19
|
-
import { ReactWidget, Message } from '@theia/core/lib/browser/widgets';
|
|
19
|
+
import { ReactWidget, Message, codicon } from '@theia/core/lib/browser/widgets';
|
|
20
|
+
import { PreferenceService } from '@theia/core/lib/browser';
|
|
20
21
|
import { VSXExtensionsSearchModel } from './vsx-extensions-search-model';
|
|
22
|
+
import { VSXExtensionsModel } from './vsx-extensions-model';
|
|
21
23
|
import { nls } from '@theia/core/lib/common/nls';
|
|
22
24
|
|
|
23
25
|
@injectable()
|
|
24
26
|
export class VSXExtensionsSearchBar extends ReactWidget {
|
|
25
27
|
|
|
28
|
+
@inject(VSXExtensionsModel)
|
|
29
|
+
protected readonly extensionsModel: VSXExtensionsModel;
|
|
30
|
+
|
|
26
31
|
@inject(VSXExtensionsSearchModel)
|
|
27
|
-
protected readonly
|
|
32
|
+
protected readonly searchModel: VSXExtensionsSearchModel;
|
|
33
|
+
|
|
34
|
+
@inject(PreferenceService)
|
|
35
|
+
protected readonly preferenceService: PreferenceService;
|
|
36
|
+
|
|
37
|
+
protected input: HTMLInputElement | undefined;
|
|
38
|
+
protected onlyShowVerifiedExtensions: boolean | undefined;
|
|
28
39
|
|
|
29
40
|
@postConstruct()
|
|
30
41
|
protected init(): void {
|
|
42
|
+
this.onlyShowVerifiedExtensions = this.preferenceService.get('extensions.onlyShowVerifiedExtensions');
|
|
31
43
|
this.id = 'vsx-extensions-search-bar';
|
|
32
44
|
this.addClass('theia-vsx-extensions-search-bar');
|
|
33
|
-
this.
|
|
45
|
+
this.searchModel.onDidChangeQuery((query: string) => this.updateSearchTerm(query));
|
|
46
|
+
this.preferenceService.onPreferenceChanged(change => {
|
|
47
|
+
if (change.preferenceName === 'extensions.onlyShowVerifiedExtensions') {
|
|
48
|
+
this.extensionsModel.setOnlyShowVerifiedExtensions(!!change.newValue);
|
|
49
|
+
this.onlyShowVerifiedExtensions = change.newValue;
|
|
50
|
+
this.update();
|
|
51
|
+
}
|
|
52
|
+
});
|
|
34
53
|
}
|
|
35
54
|
|
|
36
|
-
protected input: HTMLInputElement | undefined;
|
|
37
|
-
|
|
38
55
|
protected render(): React.ReactNode {
|
|
39
|
-
return <
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
56
|
+
return <div className='vsx-search-container'>
|
|
57
|
+
<input type='text'
|
|
58
|
+
ref={input => this.input = input || undefined}
|
|
59
|
+
defaultValue={this.searchModel.query}
|
|
60
|
+
spellCheck={false}
|
|
61
|
+
className='theia-input'
|
|
62
|
+
placeholder={nls.localize('theia/vsx-registry/searchPlaceholder', 'Search Extensions in {0}', 'Open VSX Registry')}
|
|
63
|
+
onChange={this.updateQuery}>
|
|
64
|
+
</input>
|
|
65
|
+
{this.renderOptionContainer()}
|
|
66
|
+
</div>;
|
|
47
67
|
}
|
|
48
68
|
|
|
49
|
-
protected updateQuery = (e: React.ChangeEvent<HTMLInputElement>) => this.
|
|
69
|
+
protected updateQuery = (e: React.ChangeEvent<HTMLInputElement>) => this.searchModel.query = e.target.value;
|
|
50
70
|
|
|
51
71
|
protected updateSearchTerm(term: string): void {
|
|
52
72
|
if (this.input) {
|
|
@@ -54,6 +74,24 @@ export class VSXExtensionsSearchBar extends ReactWidget {
|
|
|
54
74
|
}
|
|
55
75
|
}
|
|
56
76
|
|
|
77
|
+
protected renderOptionContainer(): React.ReactNode {
|
|
78
|
+
const showVerifiedExtensions = this.renderShowVerifiedExtensions();
|
|
79
|
+
return <div className='option-buttons'>{showVerifiedExtensions}</div>;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected renderShowVerifiedExtensions(): React.ReactNode {
|
|
83
|
+
return <span
|
|
84
|
+
className={`${codicon('verified')} option action-label ${this.onlyShowVerifiedExtensions ? 'enabled' : ''}`}
|
|
85
|
+
title={nls.localize('theia/vsx-registry/onlyShowVerifiedExtensionsTitle', 'Only Show Verified Extensions')}
|
|
86
|
+
onClick={() => this.handleShowVerifiedExtensionsClick()}>
|
|
87
|
+
</span>;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
protected handleShowVerifiedExtensionsClick(): void {
|
|
91
|
+
this.extensionsModel.setOnlyShowVerifiedExtensions(!this.onlyShowVerifiedExtensions);
|
|
92
|
+
this.update();
|
|
93
|
+
}
|
|
94
|
+
|
|
57
95
|
protected override onActivateRequest(msg: Message): void {
|
|
58
96
|
super.onActivateRequest(msg);
|
|
59
97
|
if (this.input) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { injectable, interfaces, postConstruct, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { TreeModel, TreeNode } from '@theia/core/lib/browser';
|
|
18
|
+
import { Message, TreeModel, TreeNode } from '@theia/core/lib/browser';
|
|
19
19
|
import { SourceTreeWidget } from '@theia/core/lib/browser/source-tree';
|
|
20
20
|
import { VSXExtensionsSource, VSXExtensionsSourceOptions } from './vsx-extensions-source';
|
|
21
21
|
import { nls } from '@theia/core/lib/common/nls';
|
|
@@ -153,4 +153,13 @@ export class VSXExtensionsWidget extends SourceTreeWidget implements BadgeWidget
|
|
|
153
153
|
}
|
|
154
154
|
return super.renderTree(model);
|
|
155
155
|
}
|
|
156
|
+
|
|
157
|
+
protected override onAfterShow(msg: Message): void {
|
|
158
|
+
super.onAfterShow(msg);
|
|
159
|
+
if (this.options.id === VSXExtensionsSourceOptions.INSTALLED) {
|
|
160
|
+
// This is needed when an Extension was installed outside of the extension view.
|
|
161
|
+
// E.g. using explorer context menu.
|
|
162
|
+
this.doUpdateRows();
|
|
163
|
+
}
|
|
164
|
+
}
|
|
156
165
|
}
|
|
@@ -72,7 +72,7 @@ export class VSXLanguageQuickPickService extends LanguageQuickPickService {
|
|
|
72
72
|
localizationContribution.localizedLanguageName ?? localizationContribution.languageName ?? localizationContribution.languageId),
|
|
73
73
|
});
|
|
74
74
|
try {
|
|
75
|
-
const extensionUri = VSCodeExtensionUri.
|
|
75
|
+
const extensionUri = VSCodeExtensionUri.fromId(extension.extension.name, extension.extension.namespace).toString();
|
|
76
76
|
await this.pluginServer.deploy(extensionUri);
|
|
77
77
|
} finally {
|
|
78
78
|
progress.cancel();
|
|
@@ -33,9 +33,12 @@ import { VSXExtensionsSourceOptions } from './vsx-extensions-source';
|
|
|
33
33
|
import { VSXExtensionsSearchModel } from './vsx-extensions-search-model';
|
|
34
34
|
import { bindExtensionPreferences } from './recommended-extensions/recommended-extensions-preference-contribution';
|
|
35
35
|
import { bindPreferenceProviderOverrides } from './recommended-extensions/preference-provider-overrides';
|
|
36
|
+
import { bindVsxExtensionsPreferences } from './vsx-extensions-preferences';
|
|
36
37
|
import { VSXEnvironment, VSX_ENVIRONMENT_PATH } from '../common/vsx-environment';
|
|
37
38
|
import { LanguageQuickPickService } from '@theia/core/lib/browser/i18n/language-quick-pick-service';
|
|
38
39
|
import { VSXLanguageQuickPickService } from './vsx-language-quick-pick-service';
|
|
40
|
+
import { VsxExtensionArgumentProcessor } from './vsx-extension-argument-processor';
|
|
41
|
+
import { ArgumentProcessorContribution } from '@theia/plugin-ext/lib/main/browser/command-registry-main';
|
|
39
42
|
|
|
40
43
|
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
41
44
|
bind(VSXEnvironment)
|
|
@@ -103,4 +106,8 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
103
106
|
|
|
104
107
|
bindExtensionPreferences(bind);
|
|
105
108
|
bindPreferenceProviderOverrides(bind, unbind);
|
|
109
|
+
bindVsxExtensionsPreferences(bind);
|
|
110
|
+
|
|
111
|
+
bind(VsxExtensionArgumentProcessor).toSelf().inSingletonScope();
|
|
112
|
+
bind(ArgumentProcessorContribution).toService(VsxExtensionArgumentProcessor);
|
|
106
113
|
});
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2024 TypeFox 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 { PluginDeployerParticipant, PluginDeployerStartContext } from '@theia/plugin-ext';
|
|
19
|
+
import { VsxCli } from './vsx-cli';
|
|
20
|
+
import { VSXExtensionUri } from '../common';
|
|
21
|
+
import * as fs from 'fs';
|
|
22
|
+
import { FileUri } from '@theia/core/lib/node';
|
|
23
|
+
import * as path from 'path';
|
|
24
|
+
|
|
25
|
+
@injectable()
|
|
26
|
+
export class VsxCliDeployerParticipant implements PluginDeployerParticipant {
|
|
27
|
+
|
|
28
|
+
@inject(VsxCli)
|
|
29
|
+
protected readonly vsxCli: VsxCli;
|
|
30
|
+
|
|
31
|
+
async onWillStart(context: PluginDeployerStartContext): Promise<void> {
|
|
32
|
+
const pluginUris = this.vsxCli.pluginsToInstall.map(async id => {
|
|
33
|
+
try {
|
|
34
|
+
const resolvedPath = path.resolve(id);
|
|
35
|
+
const stat = await fs.promises.stat(resolvedPath);
|
|
36
|
+
if (stat.isFile()) {
|
|
37
|
+
return FileUri.create(resolvedPath).withScheme('local-file').toString();
|
|
38
|
+
}
|
|
39
|
+
} catch (e) {
|
|
40
|
+
// expected if file does not exist
|
|
41
|
+
}
|
|
42
|
+
return VSXExtensionUri.fromVersionedId(id).toString();
|
|
43
|
+
});
|
|
44
|
+
context.userEntries.push(...await Promise.all(pluginUris));
|
|
45
|
+
}
|
|
46
|
+
}
|
package/src/node/vsx-cli.ts
CHANGED
|
@@ -24,9 +24,15 @@ import * as fs from 'fs';
|
|
|
24
24
|
export class VsxCli implements CliContribution {
|
|
25
25
|
|
|
26
26
|
ovsxRouterConfig: OVSXRouterConfig | undefined;
|
|
27
|
+
pluginsToInstall: string[] = [];
|
|
27
28
|
|
|
28
29
|
configure(conf: Argv<{}>): void {
|
|
29
30
|
conf.option('ovsx-router-config', { description: 'JSON configuration file for the OVSX router client', type: 'string' });
|
|
31
|
+
conf.option('install-plugin', {
|
|
32
|
+
alias: 'install-extension',
|
|
33
|
+
nargs: 1,
|
|
34
|
+
desc: 'Installs or updates a plugin. Argument is a path to the *.vsix file or a plugin id of the form "publisher.name[@version]"'
|
|
35
|
+
});
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
async setArguments(args: Record<string, unknown>): Promise<void> {
|
|
@@ -34,5 +40,12 @@ export class VsxCli implements CliContribution {
|
|
|
34
40
|
if (typeof ovsxRouterConfig === 'string') {
|
|
35
41
|
this.ovsxRouterConfig = JSON.parse(await fs.promises.readFile(ovsxRouterConfig, 'utf8'));
|
|
36
42
|
}
|
|
43
|
+
let pluginsToInstall = args.installPlugin;
|
|
44
|
+
if (typeof pluginsToInstall === 'string') {
|
|
45
|
+
pluginsToInstall = [pluginsToInstall];
|
|
46
|
+
}
|
|
47
|
+
if (Array.isArray(pluginsToInstall)) {
|
|
48
|
+
this.pluginsToInstall = pluginsToInstall;
|
|
49
|
+
}
|
|
37
50
|
}
|
|
38
51
|
}
|
|
@@ -51,13 +51,14 @@ export class VSXExtensionResolver implements PluginDeployerResolver {
|
|
|
51
51
|
}
|
|
52
52
|
let extension: VSXExtensionRaw | undefined;
|
|
53
53
|
const client = await this.clientProvider();
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
const version = options?.version || id.version;
|
|
55
|
+
if (version) {
|
|
56
|
+
console.log(`[${id}]: trying to resolve version ${version}...`);
|
|
57
|
+
const { extensions } = await client.query({ extensionId: id.id, extensionVersion: version, includeAllVersions: true });
|
|
57
58
|
extension = extensions[0];
|
|
58
59
|
} else {
|
|
59
60
|
console.log(`[${id}]: trying to resolve latest version...`);
|
|
60
|
-
const { extensions } = await client.query({ extensionId: id, includeAllVersions: true });
|
|
61
|
+
const { extensions } = await client.query({ extensionId: id.id, includeAllVersions: true });
|
|
61
62
|
extension = this.vsxApiFilter.getLatestCompatibleExtension(extensions);
|
|
62
63
|
}
|
|
63
64
|
if (!extension) {
|
|
@@ -66,12 +67,12 @@ export class VSXExtensionResolver implements PluginDeployerResolver {
|
|
|
66
67
|
if (extension.error) {
|
|
67
68
|
throw new Error(extension.error);
|
|
68
69
|
}
|
|
69
|
-
const resolvedId = id + '-' + extension.version;
|
|
70
|
+
const resolvedId = id.id + '-' + extension.version;
|
|
70
71
|
const downloadUrl = extension.files.download;
|
|
71
|
-
console.log(`[${id}]: resolved to '${resolvedId}'`);
|
|
72
|
+
console.log(`[${id.id}]: resolved to '${resolvedId}'`);
|
|
72
73
|
|
|
73
74
|
if (!options?.ignoreOtherVersions) {
|
|
74
|
-
const existingVersion = this.hasSameOrNewerVersion(id, extension);
|
|
75
|
+
const existingVersion = this.hasSameOrNewerVersion(id.id, extension);
|
|
75
76
|
if (existingVersion) {
|
|
76
77
|
console.log(`[${id}]: is already installed with the same or newer version '${existingVersion}'`);
|
|
77
78
|
return;
|
|
@@ -17,11 +17,12 @@
|
|
|
17
17
|
import { ConnectionHandler, JsonRpcConnectionHandler } from '@theia/core';
|
|
18
18
|
import { CliContribution } from '@theia/core/lib/node';
|
|
19
19
|
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
20
|
-
import { PluginDeployerResolver } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
20
|
+
import { PluginDeployerParticipant, PluginDeployerResolver } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
21
21
|
import { VSXEnvironment, VSX_ENVIRONMENT_PATH } from '../common/vsx-environment';
|
|
22
22
|
import { VsxCli } from './vsx-cli';
|
|
23
23
|
import { VSXEnvironmentImpl } from './vsx-environment-impl';
|
|
24
24
|
import { VSXExtensionResolver } from './vsx-extension-resolver';
|
|
25
|
+
import { VsxCliDeployerParticipant } from './vsx-cli-deployer-participant';
|
|
25
26
|
|
|
26
27
|
export default new ContainerModule(bind => {
|
|
27
28
|
bind(VSXEnvironment).to(VSXEnvironmentImpl).inSingletonScope();
|
|
@@ -32,4 +33,6 @@ export default new ContainerModule(bind => {
|
|
|
32
33
|
.inSingletonScope();
|
|
33
34
|
bind(VSXExtensionResolver).toSelf().inSingletonScope();
|
|
34
35
|
bind(PluginDeployerResolver).toService(VSXExtensionResolver);
|
|
36
|
+
bind(VsxCliDeployerParticipant).toSelf().inSingletonScope();
|
|
37
|
+
bind(PluginDeployerParticipant).toService(VsxCliDeployerParticipant);
|
|
35
38
|
});
|