@theia/vsx-registry 1.53.0-next.5 → 1.53.0-next.55
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 +45 -45
- package/lib/common/vsx-environment.d.ts +1 -0
- package/lib/common/vsx-environment.d.ts.map +1 -1
- package/lib/common/vsx-registry-common-module.d.ts.map +1 -1
- package/lib/common/vsx-registry-common-module.js +9 -3
- package/lib/common/vsx-registry-common-module.js.map +1 -1
- 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 +4 -0
- package/lib/node/vsx-cli.js.map +1 -1
- package/lib/node/vsx-environment-impl.d.ts +1 -0
- package/lib/node/vsx-environment-impl.d.ts.map +1 -1
- package/lib/node/vsx-environment-impl.js +3 -0
- package/lib/node/vsx-environment-impl.js.map +1 -1
- package/lib/node/vsx-extension-resolver.js +3 -3
- package/lib/node/vsx-extension-resolver.js.map +1 -1
- package/package.json +12 -11
- package/src/browser/recommended-extensions/preference-provider-overrides.ts +99 -99
- package/src/browser/recommended-extensions/recommended-extensions-json-schema.ts +74 -74
- package/src/browser/recommended-extensions/recommended-extensions-preference-contribution.ts +68 -68
- package/src/browser/style/extensions.svg +4 -4
- package/src/browser/style/index.css +436 -436
- package/src/browser/vsx-extension-argument-processor.ts +32 -32
- package/src/browser/vsx-extension-commands.ts +68 -68
- package/src/browser/vsx-extension-editor-manager.ts +42 -42
- package/src/browser/vsx-extension-editor.tsx +96 -96
- package/src/browser/vsx-extension.tsx +710 -710
- package/src/browser/vsx-extensions-contribution.ts +373 -373
- package/src/browser/vsx-extensions-model.ts +456 -456
- package/src/browser/vsx-extensions-preferences.ts +58 -58
- package/src/browser/vsx-extensions-search-bar.tsx +107 -107
- package/src/browser/vsx-extensions-search-model.ts +61 -61
- package/src/browser/vsx-extensions-source.ts +83 -83
- package/src/browser/vsx-extensions-view-container.ts +179 -179
- package/src/browser/vsx-extensions-widget.tsx +165 -165
- package/src/browser/vsx-language-quick-pick-service.ts +112 -112
- package/src/browser/vsx-registry-frontend-module.ts +113 -113
- package/src/common/index.ts +19 -19
- package/src/common/ovsx-client-provider.ts +35 -35
- package/src/common/vsx-environment.ts +28 -27
- package/src/common/vsx-extension-uri.ts +20 -20
- package/src/common/vsx-registry-common-module.ts +85 -78
- package/src/node/vsx-cli-deployer-participant.ts +46 -46
- package/src/node/vsx-cli.ts +55 -51
- package/src/node/vsx-environment-impl.ts +54 -50
- package/src/node/vsx-extension-resolver.ts +134 -134
- package/src/node/vsx-registry-backend-module.ts +38 -38
- package/src/node/vsx-remote-cli.ts +39 -39
- package/src/package.spec.ts +29 -29
|
@@ -1,113 +1,113 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 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 '../../src/browser/style/index.css';
|
|
18
|
-
|
|
19
|
-
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
20
|
-
import {
|
|
21
|
-
WidgetFactory, bindViewContribution, FrontendApplicationContribution, ViewContainerIdentifier, OpenHandler, WidgetManager, WebSocketConnectionProvider
|
|
22
|
-
} from '@theia/core/lib/browser';
|
|
23
|
-
import { VSXExtensionsViewContainer } from './vsx-extensions-view-container';
|
|
24
|
-
import { VSXExtensionsContribution } from './vsx-extensions-contribution';
|
|
25
|
-
import { VSXExtensionsSearchBar } from './vsx-extensions-search-bar';
|
|
26
|
-
import { VSXExtensionsModel } from './vsx-extensions-model';
|
|
27
|
-
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
|
|
28
|
-
import { VSXExtensionsWidget, VSXExtensionsWidgetOptions } from './vsx-extensions-widget';
|
|
29
|
-
import { VSXExtensionFactory, VSXExtension, VSXExtensionOptions } from './vsx-extension';
|
|
30
|
-
import { VSXExtensionEditor } from './vsx-extension-editor';
|
|
31
|
-
import { VSXExtensionEditorManager } from './vsx-extension-editor-manager';
|
|
32
|
-
import { VSXExtensionsSourceOptions } from './vsx-extensions-source';
|
|
33
|
-
import { VSXExtensionsSearchModel } from './vsx-extensions-search-model';
|
|
34
|
-
import { bindExtensionPreferences } from './recommended-extensions/recommended-extensions-preference-contribution';
|
|
35
|
-
import { bindPreferenceProviderOverrides } from './recommended-extensions/preference-provider-overrides';
|
|
36
|
-
import { bindVsxExtensionsPreferences } from './vsx-extensions-preferences';
|
|
37
|
-
import { VSXEnvironment, VSX_ENVIRONMENT_PATH } from '../common/vsx-environment';
|
|
38
|
-
import { LanguageQuickPickService } from '@theia/core/lib/browser/i18n/language-quick-pick-service';
|
|
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';
|
|
42
|
-
|
|
43
|
-
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
44
|
-
bind(VSXEnvironment)
|
|
45
|
-
.toDynamicValue(ctx => WebSocketConnectionProvider.createProxy(ctx.container, VSX_ENVIRONMENT_PATH))
|
|
46
|
-
.inSingletonScope();
|
|
47
|
-
bind(VSXExtension).toSelf();
|
|
48
|
-
bind(VSXExtensionFactory).toFactory(ctx => (option: VSXExtensionOptions) => {
|
|
49
|
-
const child = ctx.container.createChild();
|
|
50
|
-
child.bind(VSXExtensionOptions).toConstantValue(option);
|
|
51
|
-
return child.get(VSXExtension);
|
|
52
|
-
});
|
|
53
|
-
bind(VSXExtensionsModel).toSelf().inSingletonScope();
|
|
54
|
-
|
|
55
|
-
bind(VSXExtensionEditor).toSelf();
|
|
56
|
-
bind(WidgetFactory).toDynamicValue(ctx => ({
|
|
57
|
-
id: VSXExtensionEditor.ID,
|
|
58
|
-
createWidget: async (options: VSXExtensionOptions) => {
|
|
59
|
-
const extension = await ctx.container.get(VSXExtensionsModel).resolve(options.id);
|
|
60
|
-
const child = ctx.container.createChild();
|
|
61
|
-
child.bind(VSXExtension).toConstantValue(extension);
|
|
62
|
-
return child.get(VSXExtensionEditor);
|
|
63
|
-
}
|
|
64
|
-
})).inSingletonScope();
|
|
65
|
-
bind(VSXExtensionEditorManager).toSelf().inSingletonScope();
|
|
66
|
-
bind(OpenHandler).toService(VSXExtensionEditorManager);
|
|
67
|
-
|
|
68
|
-
bind(WidgetFactory).toDynamicValue(({ container }) => ({
|
|
69
|
-
id: VSXExtensionsWidget.ID,
|
|
70
|
-
createWidget: async (options: VSXExtensionsWidgetOptions) => VSXExtensionsWidget.createWidget(container, options)
|
|
71
|
-
})).inSingletonScope();
|
|
72
|
-
bind(WidgetFactory).toDynamicValue(ctx => ({
|
|
73
|
-
id: VSXExtensionsViewContainer.ID,
|
|
74
|
-
createWidget: async () => {
|
|
75
|
-
const child = ctx.container.createChild();
|
|
76
|
-
child.bind(ViewContainerIdentifier).toConstantValue({
|
|
77
|
-
id: VSXExtensionsViewContainer.ID,
|
|
78
|
-
progressLocationId: 'extensions'
|
|
79
|
-
});
|
|
80
|
-
child.bind(VSXExtensionsViewContainer).toSelf();
|
|
81
|
-
child.bind(VSXExtensionsSearchBar).toSelf().inSingletonScope();
|
|
82
|
-
const viewContainer = child.get(VSXExtensionsViewContainer);
|
|
83
|
-
const widgetManager = child.get(WidgetManager);
|
|
84
|
-
for (const id of [
|
|
85
|
-
VSXExtensionsSourceOptions.SEARCH_RESULT,
|
|
86
|
-
VSXExtensionsSourceOptions.RECOMMENDED,
|
|
87
|
-
VSXExtensionsSourceOptions.INSTALLED,
|
|
88
|
-
VSXExtensionsSourceOptions.BUILT_IN,
|
|
89
|
-
]) {
|
|
90
|
-
const widget = await widgetManager.getOrCreateWidget(VSXExtensionsWidget.ID, { id });
|
|
91
|
-
viewContainer.addWidget(widget, {
|
|
92
|
-
initiallyCollapsed: id === VSXExtensionsSourceOptions.BUILT_IN
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
return viewContainer;
|
|
96
|
-
}
|
|
97
|
-
})).inSingletonScope();
|
|
98
|
-
|
|
99
|
-
bind(VSXExtensionsSearchModel).toSelf().inSingletonScope();
|
|
100
|
-
|
|
101
|
-
rebind(LanguageQuickPickService).to(VSXLanguageQuickPickService).inSingletonScope();
|
|
102
|
-
|
|
103
|
-
bindViewContribution(bind, VSXExtensionsContribution);
|
|
104
|
-
bind(FrontendApplicationContribution).toService(VSXExtensionsContribution);
|
|
105
|
-
bind(ColorContribution).toService(VSXExtensionsContribution);
|
|
106
|
-
|
|
107
|
-
bindExtensionPreferences(bind);
|
|
108
|
-
bindPreferenceProviderOverrides(bind, unbind);
|
|
109
|
-
bindVsxExtensionsPreferences(bind);
|
|
110
|
-
|
|
111
|
-
bind(VsxExtensionArgumentProcessor).toSelf().inSingletonScope();
|
|
112
|
-
bind(ArgumentProcessorContribution).toService(VsxExtensionArgumentProcessor);
|
|
113
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 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 '../../src/browser/style/index.css';
|
|
18
|
+
|
|
19
|
+
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
20
|
+
import {
|
|
21
|
+
WidgetFactory, bindViewContribution, FrontendApplicationContribution, ViewContainerIdentifier, OpenHandler, WidgetManager, WebSocketConnectionProvider
|
|
22
|
+
} from '@theia/core/lib/browser';
|
|
23
|
+
import { VSXExtensionsViewContainer } from './vsx-extensions-view-container';
|
|
24
|
+
import { VSXExtensionsContribution } from './vsx-extensions-contribution';
|
|
25
|
+
import { VSXExtensionsSearchBar } from './vsx-extensions-search-bar';
|
|
26
|
+
import { VSXExtensionsModel } from './vsx-extensions-model';
|
|
27
|
+
import { ColorContribution } from '@theia/core/lib/browser/color-application-contribution';
|
|
28
|
+
import { VSXExtensionsWidget, VSXExtensionsWidgetOptions } from './vsx-extensions-widget';
|
|
29
|
+
import { VSXExtensionFactory, VSXExtension, VSXExtensionOptions } from './vsx-extension';
|
|
30
|
+
import { VSXExtensionEditor } from './vsx-extension-editor';
|
|
31
|
+
import { VSXExtensionEditorManager } from './vsx-extension-editor-manager';
|
|
32
|
+
import { VSXExtensionsSourceOptions } from './vsx-extensions-source';
|
|
33
|
+
import { VSXExtensionsSearchModel } from './vsx-extensions-search-model';
|
|
34
|
+
import { bindExtensionPreferences } from './recommended-extensions/recommended-extensions-preference-contribution';
|
|
35
|
+
import { bindPreferenceProviderOverrides } from './recommended-extensions/preference-provider-overrides';
|
|
36
|
+
import { bindVsxExtensionsPreferences } from './vsx-extensions-preferences';
|
|
37
|
+
import { VSXEnvironment, VSX_ENVIRONMENT_PATH } from '../common/vsx-environment';
|
|
38
|
+
import { LanguageQuickPickService } from '@theia/core/lib/browser/i18n/language-quick-pick-service';
|
|
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';
|
|
42
|
+
|
|
43
|
+
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
44
|
+
bind(VSXEnvironment)
|
|
45
|
+
.toDynamicValue(ctx => WebSocketConnectionProvider.createProxy(ctx.container, VSX_ENVIRONMENT_PATH))
|
|
46
|
+
.inSingletonScope();
|
|
47
|
+
bind(VSXExtension).toSelf();
|
|
48
|
+
bind(VSXExtensionFactory).toFactory(ctx => (option: VSXExtensionOptions) => {
|
|
49
|
+
const child = ctx.container.createChild();
|
|
50
|
+
child.bind(VSXExtensionOptions).toConstantValue(option);
|
|
51
|
+
return child.get(VSXExtension);
|
|
52
|
+
});
|
|
53
|
+
bind(VSXExtensionsModel).toSelf().inSingletonScope();
|
|
54
|
+
|
|
55
|
+
bind(VSXExtensionEditor).toSelf();
|
|
56
|
+
bind(WidgetFactory).toDynamicValue(ctx => ({
|
|
57
|
+
id: VSXExtensionEditor.ID,
|
|
58
|
+
createWidget: async (options: VSXExtensionOptions) => {
|
|
59
|
+
const extension = await ctx.container.get(VSXExtensionsModel).resolve(options.id);
|
|
60
|
+
const child = ctx.container.createChild();
|
|
61
|
+
child.bind(VSXExtension).toConstantValue(extension);
|
|
62
|
+
return child.get(VSXExtensionEditor);
|
|
63
|
+
}
|
|
64
|
+
})).inSingletonScope();
|
|
65
|
+
bind(VSXExtensionEditorManager).toSelf().inSingletonScope();
|
|
66
|
+
bind(OpenHandler).toService(VSXExtensionEditorManager);
|
|
67
|
+
|
|
68
|
+
bind(WidgetFactory).toDynamicValue(({ container }) => ({
|
|
69
|
+
id: VSXExtensionsWidget.ID,
|
|
70
|
+
createWidget: async (options: VSXExtensionsWidgetOptions) => VSXExtensionsWidget.createWidget(container, options)
|
|
71
|
+
})).inSingletonScope();
|
|
72
|
+
bind(WidgetFactory).toDynamicValue(ctx => ({
|
|
73
|
+
id: VSXExtensionsViewContainer.ID,
|
|
74
|
+
createWidget: async () => {
|
|
75
|
+
const child = ctx.container.createChild();
|
|
76
|
+
child.bind(ViewContainerIdentifier).toConstantValue({
|
|
77
|
+
id: VSXExtensionsViewContainer.ID,
|
|
78
|
+
progressLocationId: 'extensions'
|
|
79
|
+
});
|
|
80
|
+
child.bind(VSXExtensionsViewContainer).toSelf();
|
|
81
|
+
child.bind(VSXExtensionsSearchBar).toSelf().inSingletonScope();
|
|
82
|
+
const viewContainer = child.get(VSXExtensionsViewContainer);
|
|
83
|
+
const widgetManager = child.get(WidgetManager);
|
|
84
|
+
for (const id of [
|
|
85
|
+
VSXExtensionsSourceOptions.SEARCH_RESULT,
|
|
86
|
+
VSXExtensionsSourceOptions.RECOMMENDED,
|
|
87
|
+
VSXExtensionsSourceOptions.INSTALLED,
|
|
88
|
+
VSXExtensionsSourceOptions.BUILT_IN,
|
|
89
|
+
]) {
|
|
90
|
+
const widget = await widgetManager.getOrCreateWidget(VSXExtensionsWidget.ID, { id });
|
|
91
|
+
viewContainer.addWidget(widget, {
|
|
92
|
+
initiallyCollapsed: id === VSXExtensionsSourceOptions.BUILT_IN
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
return viewContainer;
|
|
96
|
+
}
|
|
97
|
+
})).inSingletonScope();
|
|
98
|
+
|
|
99
|
+
bind(VSXExtensionsSearchModel).toSelf().inSingletonScope();
|
|
100
|
+
|
|
101
|
+
rebind(LanguageQuickPickService).to(VSXLanguageQuickPickService).inSingletonScope();
|
|
102
|
+
|
|
103
|
+
bindViewContribution(bind, VSXExtensionsContribution);
|
|
104
|
+
bind(FrontendApplicationContribution).toService(VSXExtensionsContribution);
|
|
105
|
+
bind(ColorContribution).toService(VSXExtensionsContribution);
|
|
106
|
+
|
|
107
|
+
bindExtensionPreferences(bind);
|
|
108
|
+
bindPreferenceProviderOverrides(bind, unbind);
|
|
109
|
+
bindVsxExtensionsPreferences(bind);
|
|
110
|
+
|
|
111
|
+
bind(VsxExtensionArgumentProcessor).toSelf().inSingletonScope();
|
|
112
|
+
bind(ArgumentProcessorContribution).toService(VsxExtensionArgumentProcessor);
|
|
113
|
+
});
|
package/src/common/index.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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
|
-
export { OVSXClientProvider, OVSXUrlResolver } from './ovsx-client-provider';
|
|
18
|
-
export { VSXEnvironment } from './vsx-environment';
|
|
19
|
-
export { VSXExtensionUri } from './vsx-extension-uri';
|
|
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
|
+
export { OVSXClientProvider, OVSXUrlResolver } from './ovsx-client-provider';
|
|
18
|
+
export { VSXEnvironment } from './vsx-environment';
|
|
19
|
+
export { VSXExtensionUri } from './vsx-extension-uri';
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 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 { MaybePromise } from '@theia/core/lib/common';
|
|
18
|
-
import { RequestService } from '@theia/core/shared/@theia/request';
|
|
19
|
-
import type { interfaces } from '@theia/core/shared/inversify';
|
|
20
|
-
import { OVSXClient, OVSXHttpClient } from '@theia/ovsx-client';
|
|
21
|
-
import { VSXEnvironment } from './vsx-environment';
|
|
22
|
-
|
|
23
|
-
export const OVSXUrlResolver = Symbol('OVSXUrlResolver') as symbol & interfaces.Abstract<OVSXUrlResolver>;
|
|
24
|
-
export type OVSXUrlResolver = (value: string) => MaybePromise<string>;
|
|
25
|
-
|
|
26
|
-
export const OVSXClientProvider = Symbol('OVSXClientProvider') as symbol & interfaces.Abstract<OVSXClientProvider>;
|
|
27
|
-
export type OVSXClientProvider = () => MaybePromise<OVSXClient>;
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated since 1.32.0
|
|
31
|
-
*/
|
|
32
|
-
export async function createOVSXClient(vsxEnvironment: VSXEnvironment, requestService: RequestService): Promise<OVSXClient> {
|
|
33
|
-
const apiUrl = await vsxEnvironment.getRegistryApiUri();
|
|
34
|
-
return new OVSXHttpClient(apiUrl, requestService);
|
|
35
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2021 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 { MaybePromise } from '@theia/core/lib/common';
|
|
18
|
+
import { RequestService } from '@theia/core/shared/@theia/request';
|
|
19
|
+
import type { interfaces } from '@theia/core/shared/inversify';
|
|
20
|
+
import { OVSXClient, OVSXHttpClient } from '@theia/ovsx-client';
|
|
21
|
+
import { VSXEnvironment } from './vsx-environment';
|
|
22
|
+
|
|
23
|
+
export const OVSXUrlResolver = Symbol('OVSXUrlResolver') as symbol & interfaces.Abstract<OVSXUrlResolver>;
|
|
24
|
+
export type OVSXUrlResolver = (value: string) => MaybePromise<string>;
|
|
25
|
+
|
|
26
|
+
export const OVSXClientProvider = Symbol('OVSXClientProvider') as symbol & interfaces.Abstract<OVSXClientProvider>;
|
|
27
|
+
export type OVSXClientProvider = () => MaybePromise<OVSXClient>;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @deprecated since 1.32.0
|
|
31
|
+
*/
|
|
32
|
+
export async function createOVSXClient(vsxEnvironment: VSXEnvironment, requestService: RequestService): Promise<OVSXClient> {
|
|
33
|
+
const apiUrl = await vsxEnvironment.getRegistryApiUri();
|
|
34
|
+
return new OVSXHttpClient(apiUrl, requestService);
|
|
35
|
+
}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 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 type { OVSXRouterConfig } from '@theia/ovsx-client';
|
|
18
|
-
|
|
19
|
-
export const VSX_ENVIRONMENT_PATH = '/services/vsx-environment';
|
|
20
|
-
|
|
21
|
-
export const VSXEnvironment = Symbol('VSXEnvironment');
|
|
22
|
-
export interface VSXEnvironment {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2021 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 type { OVSXRouterConfig } from '@theia/ovsx-client';
|
|
18
|
+
|
|
19
|
+
export const VSX_ENVIRONMENT_PATH = '/services/vsx-environment';
|
|
20
|
+
|
|
21
|
+
export const VSXEnvironment = Symbol('VSXEnvironment');
|
|
22
|
+
export interface VSXEnvironment {
|
|
23
|
+
getRateLimit(): Promise<number>;
|
|
24
|
+
getRegistryUri(): Promise<string>;
|
|
25
|
+
getRegistryApiUri(): Promise<string>;
|
|
26
|
+
getVscodeApiVersion(): Promise<string>;
|
|
27
|
+
getOvsxRouterConfig?(): Promise<OVSXRouterConfig | undefined>;
|
|
28
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2020 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 { VSCodeExtensionUri as VSXExtensionUri } from '@theia/plugin-ext-vscode/lib/common/plugin-vscode-uri';
|
|
18
|
-
/** @deprecated since 1.25.0. Import `VSCodeExtensionUri from `plugin-ext-vscode` package instead. */
|
|
19
|
-
export { VSXExtensionUri };
|
|
20
|
-
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2020 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 { VSCodeExtensionUri as VSXExtensionUri } from '@theia/plugin-ext-vscode/lib/common/plugin-vscode-uri';
|
|
18
|
+
/** @deprecated since 1.25.0. Import `VSCodeExtensionUri from `plugin-ext-vscode` package instead. */
|
|
19
|
+
export { VSXExtensionUri };
|
|
20
|
+
|
|
@@ -1,78 +1,85 @@
|
|
|
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 { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
-
import { OVSXClientProvider, OVSXUrlResolver } from '../common';
|
|
19
|
-
import { RequestService } from '@theia/core/shared/@theia/request';
|
|
20
|
-
import {
|
|
21
|
-
ExtensionIdMatchesFilterFactory, OVSXApiFilter, OVSXApiFilterImpl, OVSXApiFilterProvider, OVSXClient, OVSXHttpClient, OVSXRouterClient, RequestContainsFilterFactory
|
|
22
|
-
} from '@theia/ovsx-client';
|
|
23
|
-
import { VSXEnvironment } from './vsx-environment';
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
vsxEnvironment.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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 { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
|
+
import { OVSXClientProvider, OVSXUrlResolver } from '../common';
|
|
19
|
+
import { RequestService } from '@theia/core/shared/@theia/request';
|
|
20
|
+
import {
|
|
21
|
+
ExtensionIdMatchesFilterFactory, OVSXApiFilter, OVSXApiFilterImpl, OVSXApiFilterProvider, OVSXClient, OVSXHttpClient, OVSXRouterClient, RequestContainsFilterFactory
|
|
22
|
+
} from '@theia/ovsx-client';
|
|
23
|
+
import { VSXEnvironment } from './vsx-environment';
|
|
24
|
+
import { RateLimiter } from 'limiter';
|
|
25
|
+
|
|
26
|
+
export default new ContainerModule(bind => {
|
|
27
|
+
bind(OVSXUrlResolver)
|
|
28
|
+
.toFunction(url => url);
|
|
29
|
+
bind(OVSXClientProvider)
|
|
30
|
+
.toDynamicValue(ctx => {
|
|
31
|
+
const vsxEnvironment = ctx.container.get<VSXEnvironment>(VSXEnvironment);
|
|
32
|
+
const requestService = ctx.container.get<RequestService>(RequestService);
|
|
33
|
+
const urlResolver = ctx.container.get(OVSXUrlResolver);
|
|
34
|
+
const clientPromise = Promise
|
|
35
|
+
.all([
|
|
36
|
+
vsxEnvironment.getRegistryApiUri(),
|
|
37
|
+
vsxEnvironment.getOvsxRouterConfig?.(),
|
|
38
|
+
vsxEnvironment.getRateLimit()
|
|
39
|
+
])
|
|
40
|
+
.then<OVSXClient>(async ([apiUrl, ovsxRouterConfig, rateLimit]) => {
|
|
41
|
+
const rateLimiter = new RateLimiter({
|
|
42
|
+
interval: 'second',
|
|
43
|
+
tokensPerInterval: rateLimit
|
|
44
|
+
});
|
|
45
|
+
if (ovsxRouterConfig) {
|
|
46
|
+
const clientFactory = OVSXHttpClient.createClientFactory(requestService, rateLimiter);
|
|
47
|
+
return OVSXRouterClient.FromConfig(
|
|
48
|
+
ovsxRouterConfig,
|
|
49
|
+
async url => clientFactory(await urlResolver(url)),
|
|
50
|
+
[RequestContainsFilterFactory, ExtensionIdMatchesFilterFactory]
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
return new OVSXHttpClient(
|
|
54
|
+
await urlResolver(apiUrl),
|
|
55
|
+
requestService,
|
|
56
|
+
rateLimiter
|
|
57
|
+
);
|
|
58
|
+
});
|
|
59
|
+
// reuse the promise for subsequent calls to this provider
|
|
60
|
+
return () => clientPromise;
|
|
61
|
+
})
|
|
62
|
+
.inSingletonScope();
|
|
63
|
+
bind(OVSXApiFilter)
|
|
64
|
+
.toDynamicValue(ctx => {
|
|
65
|
+
const vsxEnvironment = ctx.container.get<VSXEnvironment>(VSXEnvironment);
|
|
66
|
+
const apiFilter = new OVSXApiFilterImpl(undefined!, '-- temporary invalid version value --');
|
|
67
|
+
vsxEnvironment.getVscodeApiVersion()
|
|
68
|
+
.then(apiVersion => apiFilter.supportedApiVersion = apiVersion);
|
|
69
|
+
const clientProvider = ctx.container.get<OVSXClientProvider>(OVSXClientProvider);
|
|
70
|
+
Promise.resolve(clientProvider()).then(client => {
|
|
71
|
+
apiFilter.client = client;
|
|
72
|
+
});
|
|
73
|
+
return apiFilter;
|
|
74
|
+
})
|
|
75
|
+
.inSingletonScope();
|
|
76
|
+
bind(OVSXApiFilterProvider)
|
|
77
|
+
.toProvider(ctx => async () => {
|
|
78
|
+
const vsxEnvironment = ctx.container.get<VSXEnvironment>(VSXEnvironment);
|
|
79
|
+
const clientProvider = ctx.container.get<OVSXClientProvider>(OVSXClientProvider);
|
|
80
|
+
const client = await clientProvider();
|
|
81
|
+
const apiVersion = await vsxEnvironment.getVscodeApiVersion();
|
|
82
|
+
const apiFilter = new OVSXApiFilterImpl(client, apiVersion);
|
|
83
|
+
return apiFilter;
|
|
84
|
+
});
|
|
85
|
+
});
|