@theia/vsx-registry 1.22.0-next.28 → 1.22.0-next.31
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.
|
@@ -13,14 +13,17 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { PluginDeployerResolver, PluginDeployerResolverContext } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
16
|
+
import { PluginDeployerHandler, PluginDeployerResolver, PluginDeployerResolverContext } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
17
17
|
import { OVSXClientProvider } from '../common/ovsx-client-provider';
|
|
18
|
+
import { VSXExtensionRaw } from '@theia/ovsx-client';
|
|
18
19
|
export declare class VSXExtensionResolver implements PluginDeployerResolver {
|
|
19
20
|
protected clientProvider: OVSXClientProvider;
|
|
21
|
+
protected pluginDeployerHandler: PluginDeployerHandler;
|
|
20
22
|
protected readonly downloadPath: string;
|
|
21
23
|
constructor();
|
|
22
24
|
accept(pluginId: string): boolean;
|
|
23
25
|
resolve(context: PluginDeployerResolverContext): Promise<void>;
|
|
26
|
+
protected hasSameOrNewerVersion(id: string, extension: VSXExtensionRaw): string | undefined;
|
|
24
27
|
protected download(downloadUrl: string, downloadPath: string): Promise<boolean>;
|
|
25
28
|
}
|
|
26
29
|
//# sourceMappingURL=vsx-extension-resolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vsx-extension-resolver.d.ts","sourceRoot":"","sources":["../../src/node/vsx-extension-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;
|
|
1
|
+
{"version":3,"file":"vsx-extension-resolver.d.ts","sourceRoot":"","sources":["../../src/node/vsx-extension-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAUlF,OAAO,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,6BAA6B,EAAE,MAAM,8CAA8C,CAAC;AAE5I,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,qBACa,oBAAqB,YAAW,sBAAsB;IAG/D,SAAS,CAAC,cAAc,EAAE,kBAAkB,CAAC;IAG7C,SAAS,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAEvD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;;IAQxC,MAAM,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAI3B,OAAO,CAAC,OAAO,EAAE,6BAA6B,GAAG,OAAO,CAAC,IAAI,CAAC;IAkCpE,SAAS,CAAC,qBAAqB,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,GAAG,MAAM,GAAG,SAAS;cAY3E,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAoBxF"}
|
|
@@ -27,11 +27,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
27
27
|
exports.VSXExtensionResolver = void 0;
|
|
28
28
|
const os = require("os");
|
|
29
29
|
const path = require("path");
|
|
30
|
+
const semver = require("semver");
|
|
30
31
|
const fs = require("@theia/core/shared/fs-extra");
|
|
31
32
|
const uuid_1 = require("uuid");
|
|
32
33
|
const requestretry = require("requestretry");
|
|
33
34
|
const inversify_1 = require("@theia/core/shared/inversify");
|
|
34
35
|
const uri_1 = require("@theia/core/lib/common/uri");
|
|
36
|
+
const plugin_protocol_1 = require("@theia/plugin-ext/lib/common/plugin-protocol");
|
|
35
37
|
const vsx_extension_uri_1 = require("../common/vsx-extension-uri");
|
|
36
38
|
const ovsx_client_provider_1 = require("../common/ovsx-client-provider");
|
|
37
39
|
let VSXExtensionResolver = class VSXExtensionResolver {
|
|
@@ -60,6 +62,11 @@ let VSXExtensionResolver = class VSXExtensionResolver {
|
|
|
60
62
|
const resolvedId = id + '-' + extension.version;
|
|
61
63
|
const downloadUrl = extension.files.download;
|
|
62
64
|
console.log(`[${id}]: resolved to '${resolvedId}'`);
|
|
65
|
+
const existingVersion = this.hasSameOrNewerVersion(id, extension);
|
|
66
|
+
if (existingVersion) {
|
|
67
|
+
console.log(`[${id}]: is already installed with the same or newer version '${existingVersion}'`);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
63
70
|
const extensionPath = path.resolve(this.downloadPath, path.basename(downloadUrl));
|
|
64
71
|
console.log(`[${resolvedId}]: trying to download from "${downloadUrl}"...`);
|
|
65
72
|
if (!await this.download(downloadUrl, extensionPath)) {
|
|
@@ -69,6 +76,17 @@ let VSXExtensionResolver = class VSXExtensionResolver {
|
|
|
69
76
|
console.log(`[${resolvedId}]: downloaded to ${extensionPath}"`);
|
|
70
77
|
context.addPlugin(resolvedId, extensionPath);
|
|
71
78
|
}
|
|
79
|
+
hasSameOrNewerVersion(id, extension) {
|
|
80
|
+
const existingPlugin = this.pluginDeployerHandler.getDeployedPlugin(id);
|
|
81
|
+
if (existingPlugin) {
|
|
82
|
+
const existingVersion = semver.clean(existingPlugin.metadata.model.version);
|
|
83
|
+
const desiredVersion = semver.clean(extension.version);
|
|
84
|
+
if (desiredVersion && existingVersion && semver.gte(existingVersion, desiredVersion)) {
|
|
85
|
+
return existingVersion;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
72
90
|
async download(downloadUrl, downloadPath) {
|
|
73
91
|
return new Promise((resolve, reject) => {
|
|
74
92
|
requestretry(downloadUrl, {
|
|
@@ -96,6 +114,10 @@ __decorate([
|
|
|
96
114
|
inversify_1.inject(ovsx_client_provider_1.OVSXClientProvider),
|
|
97
115
|
__metadata("design:type", Function)
|
|
98
116
|
], VSXExtensionResolver.prototype, "clientProvider", void 0);
|
|
117
|
+
__decorate([
|
|
118
|
+
inversify_1.inject(plugin_protocol_1.PluginDeployerHandler),
|
|
119
|
+
__metadata("design:type", Object)
|
|
120
|
+
], VSXExtensionResolver.prototype, "pluginDeployerHandler", void 0);
|
|
99
121
|
VSXExtensionResolver = __decorate([
|
|
100
122
|
inversify_1.injectable(),
|
|
101
123
|
__metadata("design:paramtypes", [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vsx-extension-resolver.js","sourceRoot":"","sources":["../../src/node/vsx-extension-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,yBAAyB;AACzB,6BAA6B;AAC7B,kDAAkD;AAClD,+BAAoC;AACpC,6CAA6C;AAC7C,4DAAkE;AAClE,oDAA6C;
|
|
1
|
+
{"version":3,"file":"vsx-extension-resolver.js","sourceRoot":"","sources":["../../src/node/vsx-extension-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;;;;AAElF,yBAAyB;AACzB,6BAA6B;AAC7B,iCAAiC;AACjC,kDAAkD;AAClD,+BAAoC;AACpC,6CAA6C;AAC7C,4DAAkE;AAClE,oDAA6C;AAC7C,kFAA4I;AAC5I,mEAA8D;AAC9D,yEAAoE;AAIpE,IAAa,oBAAoB,GAAjC,MAAa,oBAAoB;IAU7B;QACI,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,SAAM,EAAE,CAAC,CAAC;QACxD,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACpC,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;IACvC,CAAC;IAED,MAAM,CAAC,QAAgB;QACnB,OAAO,CAAC,CAAC,mCAAe,CAAC,IAAI,CAAC,IAAI,aAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;IACrD,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,OAAsC;QAChD,MAAM,EAAE,GAAG,mC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K,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;iBAC7C;YACL,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;iBACtC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC;iBACnB,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAA;AAnFG;IADC,kBAAM,CAAC,yCAAkB,CAAC;;4DACkB;AAG7C;IADC,kBAAM,CAAC,uCAAqB,CAAC;;mEACyB;AAN9C,oBAAoB;IADhC,sBAAU,EAAE;;GACA,oBAAoB,CAsFhC;AAtFY,oDAAoB"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/vsx-registry",
|
|
3
|
-
"version": "1.22.0-next.
|
|
3
|
+
"version": "1.22.0-next.31+f81ef73a537",
|
|
4
4
|
"description": "Theia - VSX Registry",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.22.0-next.
|
|
7
|
-
"@theia/filesystem": "1.22.0-next.
|
|
8
|
-
"@theia/ovsx-client": "1.22.0-next.
|
|
9
|
-
"@theia/plugin-ext": "1.22.0-next.
|
|
10
|
-
"@theia/plugin-ext-vscode": "1.22.0-next.
|
|
11
|
-
"@theia/preferences": "1.22.0-next.
|
|
12
|
-
"@theia/workspace": "1.22.0-next.
|
|
6
|
+
"@theia/core": "1.22.0-next.31+f81ef73a537",
|
|
7
|
+
"@theia/filesystem": "1.22.0-next.31+f81ef73a537",
|
|
8
|
+
"@theia/ovsx-client": "1.22.0-next.31+f81ef73a537",
|
|
9
|
+
"@theia/plugin-ext": "1.22.0-next.31+f81ef73a537",
|
|
10
|
+
"@theia/plugin-ext-vscode": "1.22.0-next.31+f81ef73a537",
|
|
11
|
+
"@theia/preferences": "1.22.0-next.31+f81ef73a537",
|
|
12
|
+
"@theia/workspace": "1.22.0-next.31+f81ef73a537",
|
|
13
13
|
"@types/bent": "^7.0.1",
|
|
14
14
|
"@types/showdown": "^1.7.1",
|
|
15
15
|
"bent": "^7.1.0",
|
|
@@ -58,5 +58,5 @@
|
|
|
58
58
|
"nyc": {
|
|
59
59
|
"extends": "../../configs/nyc.json"
|
|
60
60
|
},
|
|
61
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "f81ef73a5379c938f57aad5ba0a109964169b4a4"
|
|
62
62
|
}
|
|
@@ -16,14 +16,16 @@
|
|
|
16
16
|
|
|
17
17
|
import * as os from 'os';
|
|
18
18
|
import * as path from 'path';
|
|
19
|
+
import * as semver from 'semver';
|
|
19
20
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
20
21
|
import { v4 as uuidv4 } from 'uuid';
|
|
21
22
|
import * as requestretry from 'requestretry';
|
|
22
23
|
import { injectable, inject } from '@theia/core/shared/inversify';
|
|
23
24
|
import URI from '@theia/core/lib/common/uri';
|
|
24
|
-
import { PluginDeployerResolver, PluginDeployerResolverContext } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
25
|
+
import { PluginDeployerHandler, PluginDeployerResolver, PluginDeployerResolverContext } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
25
26
|
import { VSXExtensionUri } from '../common/vsx-extension-uri';
|
|
26
27
|
import { OVSXClientProvider } from '../common/ovsx-client-provider';
|
|
28
|
+
import { VSXExtensionRaw } from '@theia/ovsx-client';
|
|
27
29
|
|
|
28
30
|
@injectable()
|
|
29
31
|
export class VSXExtensionResolver implements PluginDeployerResolver {
|
|
@@ -31,6 +33,9 @@ export class VSXExtensionResolver implements PluginDeployerResolver {
|
|
|
31
33
|
@inject(OVSXClientProvider)
|
|
32
34
|
protected clientProvider: OVSXClientProvider;
|
|
33
35
|
|
|
36
|
+
@inject(PluginDeployerHandler)
|
|
37
|
+
protected pluginDeployerHandler: PluginDeployerHandler;
|
|
38
|
+
|
|
34
39
|
protected readonly downloadPath: string;
|
|
35
40
|
|
|
36
41
|
constructor() {
|
|
@@ -61,6 +66,12 @@ export class VSXExtensionResolver implements PluginDeployerResolver {
|
|
|
61
66
|
const downloadUrl = extension.files.download;
|
|
62
67
|
console.log(`[${id}]: resolved to '${resolvedId}'`);
|
|
63
68
|
|
|
69
|
+
const existingVersion = this.hasSameOrNewerVersion(id, extension);
|
|
70
|
+
if (existingVersion) {
|
|
71
|
+
console.log(`[${id}]: is already installed with the same or newer version '${existingVersion}'`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
|
|
64
75
|
const extensionPath = path.resolve(this.downloadPath, path.basename(downloadUrl));
|
|
65
76
|
console.log(`[${resolvedId}]: trying to download from "${downloadUrl}"...`);
|
|
66
77
|
if (!await this.download(downloadUrl, extensionPath)) {
|
|
@@ -71,6 +82,18 @@ export class VSXExtensionResolver implements PluginDeployerResolver {
|
|
|
71
82
|
context.addPlugin(resolvedId, extensionPath);
|
|
72
83
|
}
|
|
73
84
|
|
|
85
|
+
protected hasSameOrNewerVersion(id: string, extension: VSXExtensionRaw): string | undefined {
|
|
86
|
+
const existingPlugin = this.pluginDeployerHandler.getDeployedPlugin(id);
|
|
87
|
+
if (existingPlugin) {
|
|
88
|
+
const existingVersion = semver.clean(existingPlugin.metadata.model.version);
|
|
89
|
+
const desiredVersion = semver.clean(extension.version);
|
|
90
|
+
if (desiredVersion && existingVersion && semver.gte(existingVersion, desiredVersion)) {
|
|
91
|
+
return existingVersion;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return undefined;
|
|
95
|
+
}
|
|
96
|
+
|
|
74
97
|
protected async download(downloadUrl: string, downloadPath: string): Promise<boolean> {
|
|
75
98
|
return new Promise<boolean>((resolve, reject) => {
|
|
76
99
|
requestretry(downloadUrl, {
|