@eclipse-che/che-devworkspace-generator 7.92.0 → 7.93.0-next-be04ded
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/LICENSE +201 -0
- package/README.md +51 -9
- package/lib/api/devfile-context.js +2 -2
- package/lib/api/devfile-context.js.map +1 -1
- package/lib/bitbucket/bitbucket-module.js +6 -6
- package/lib/bitbucket/bitbucket-module.js.map +1 -1
- package/lib/bitbucket/bitbucket-resolver.js +23 -26
- package/lib/bitbucket/bitbucket-resolver.js.map +1 -1
- package/lib/bitbucket/bitbucket-url.js +21 -19
- package/lib/bitbucket/bitbucket-url.js.map +1 -1
- package/lib/bitbucket-server/bitbucket-server-module.js +6 -6
- package/lib/bitbucket-server/bitbucket-server-module.js.map +1 -1
- package/lib/bitbucket-server/bitbucket-server-resolver.js +32 -35
- package/lib/bitbucket-server/bitbucket-server-resolver.js.map +1 -1
- package/lib/bitbucket-server/bitbucket-server-url.js +26 -21
- package/lib/bitbucket-server/bitbucket-server-url.js.map +1 -1
- package/lib/devfile/dev-container-component-finder.js +39 -81
- package/lib/devfile/dev-container-component-finder.js.map +1 -1
- package/lib/devfile/dev-container-component-inserter.js +30 -75
- package/lib/devfile/dev-container-component-inserter.js.map +1 -1
- package/lib/devfile/devfile-module.js +5 -5
- package/lib/devfile/devfile-module.js.map +1 -1
- package/lib/devfile-schema/devfile-schema-module.js +4 -4
- package/lib/devfile-schema/devfile-schema-module.js.map +1 -1
- package/lib/devfile-schema/devfile-schema-validator.js +22 -25
- package/lib/devfile-schema/devfile-schema-validator.js.map +1 -1
- package/lib/{plugin-registry/plugin-registry-module.d.ts → editor/editor-module.d.ts} +2 -2
- package/lib/editor/editor-module.js +19 -0
- package/lib/editor/editor-module.js.map +1 -0
- package/lib/{plugin-registry/plugin-registry-resolver.d.ts → editor/editor-resolver.d.ts} +2 -3
- package/lib/editor/editor-resolver.js +64 -0
- package/lib/editor/editor-resolver.js.map +1 -0
- package/lib/entrypoint.js +9 -54
- package/lib/entrypoint.js.map +1 -1
- package/lib/fetch/fetch-module.js +4 -4
- package/lib/fetch/fetch-module.js.map +1 -1
- package/lib/fetch/url-fetcher.js +33 -87
- package/lib/fetch/url-fetcher.js.map +1 -1
- package/lib/generate.js +89 -144
- package/lib/generate.js.map +1 -1
- package/lib/github/github-module.js +6 -6
- package/lib/github/github-module.js.map +1 -1
- package/lib/github/github-resolver.js +26 -29
- package/lib/github/github-resolver.js.map +1 -1
- package/lib/github/github-url.js +24 -19
- package/lib/github/github-url.js.map +1 -1
- package/lib/inversify/inversify-binding.d.ts +0 -1
- package/lib/inversify/inversify-binding.js +25 -68
- package/lib/inversify/inversify-binding.js.map +1 -1
- package/lib/main.d.ts +1 -2
- package/lib/main.js +156 -225
- package/lib/main.js.map +1 -1
- package/lib/resolve/git-url-resolver.js +16 -18
- package/lib/resolve/git-url-resolver.js.map +1 -1
- package/lib/resolve/resolve-module.js +4 -4
- package/lib/resolve/resolve-module.js.map +1 -1
- package/lib/resolve/resolver.js +1 -1
- package/lib/resolve/url.js +1 -1
- package/lib/types.js +3 -3
- package/lib/types.js.map +1 -1
- package/package.json +2 -2
- package/src/{plugin-registry/plugin-registry-module.ts → editor/editor-module.ts} +4 -4
- package/src/{plugin-registry/plugin-registry-resolver.ts → editor/editor-resolver.ts} +5 -10
- package/src/inversify/inversify-binding.ts +2 -4
- package/src/main.ts +12 -28
- package/lib/plugin-registry/plugin-registry-module.js +0 -19
- package/lib/plugin-registry/plugin-registry-module.js.map +0 -1
- package/lib/plugin-registry/plugin-registry-resolver.js +0 -117
- package/lib/plugin-registry/plugin-registry-resolver.js.map +0 -1
|
@@ -8,10 +8,16 @@
|
|
|
8
8
|
*
|
|
9
9
|
* SPDX-License-Identifier: EPL-2.0
|
|
10
10
|
***********************************************************************/
|
|
11
|
-
exports
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.BitbucketServerUrl = void 0;
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
class BitbucketServerUrl {
|
|
14
|
+
scheme;
|
|
15
|
+
hostName;
|
|
16
|
+
user;
|
|
17
|
+
project;
|
|
18
|
+
repo;
|
|
19
|
+
branch;
|
|
20
|
+
constructor(scheme, hostName, user, project, repo, branch) {
|
|
15
21
|
this.scheme = scheme;
|
|
16
22
|
this.hostName = hostName;
|
|
17
23
|
this.user = user;
|
|
@@ -19,25 +25,24 @@ var BitbucketServerUrl = /** @class */ (function () {
|
|
|
19
25
|
this.repo = repo;
|
|
20
26
|
this.branch = branch;
|
|
21
27
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return
|
|
33
|
-
}
|
|
34
|
-
|
|
28
|
+
getContentUrl(path) {
|
|
29
|
+
const isUser = this.user !== undefined;
|
|
30
|
+
return `${this.scheme}://${this.hostName}/${isUser ? 'users' : 'projects'}/${isUser ? this.user : this.project}/repos/${this.repo}/raw/${path}${this.branch !== undefined ? '?/at=' + this.branch : ''}`;
|
|
31
|
+
}
|
|
32
|
+
getUrl() {
|
|
33
|
+
const isUser = this.user !== undefined;
|
|
34
|
+
return `${this.scheme}://${this.hostName}/${isUser ? 'users' : 'projects'}/${isUser ? this.user : this.project}/repos/${this.repo}${this.branch !== undefined ? '/browse?at=' + this.branch : ''}`;
|
|
35
|
+
}
|
|
36
|
+
getCloneUrl() {
|
|
37
|
+
const isUser = this.user !== undefined;
|
|
38
|
+
return `${this.scheme}://${this.hostName}/scm/${isUser ? '~' + this.user : this.project.toLowerCase()}/${this.repo}.git`;
|
|
39
|
+
}
|
|
40
|
+
getRepoName() {
|
|
35
41
|
return this.repo;
|
|
36
|
-
}
|
|
37
|
-
|
|
42
|
+
}
|
|
43
|
+
getBranchName() {
|
|
38
44
|
return this.branch;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
}());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
42
47
|
exports.BitbucketServerUrl = BitbucketServerUrl;
|
|
43
48
|
//# sourceMappingURL=bitbucket-server-url.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket-server-url.js","sourceRoot":"","sources":["../../src/bitbucket-server/bitbucket-server-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;AAIzE;
|
|
1
|
+
{"version":3,"file":"bitbucket-server-url.js","sourceRoot":"","sources":["../../src/bitbucket-server/bitbucket-server-url.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;AAIzE,MAAa,kBAAkB;IAEV;IACA;IACA;IACA;IACA;IACA;IANnB,YACmB,MAAc,EACd,QAAgB,EAChB,IAAwB,EACxB,OAA2B,EAC3B,IAAY,EACZ,MAA0B;QAL1B,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAQ;QAChB,SAAI,GAAJ,IAAI,CAAoB;QACxB,YAAO,GAAP,OAAO,CAAoB;QAC3B,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAoB;IAC1C,CAAC;IAEJ,aAAa,CAAC,IAAY;QACxB,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;QACvC,OAAO,GAAG,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,IACvE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAC5B,UAAU,IAAI,CAAC,IAAI,QAAQ,IAAI,GAAG,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IAC7F,CAAC;IAED,MAAM;QACJ,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;QACvC,OAAO,GAAG,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,IACvE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAC5B,UAAU,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACvF,CAAC;IAED,WAAW;QACT,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,KAAK,SAAS,CAAC;QACvC,OAAO,GAAG,IAAI,CAAC,MAAM,MAAM,IAAI,CAAC,QAAQ,QAAQ,MAAM,CAAC,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,IACnG,IAAI,CAAC,IACP,MAAM,CAAC;IACT,CAAC;IAED,WAAW;QACT,OAAO,IAAI,CAAC,IAAI,CAAC;IACnB,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAtCD,gDAsCC"}
|
|
@@ -14,91 +14,49 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
14
14
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15
15
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
exports.__esModule = true;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
18
|
exports.DevContainerComponentFinder = void 0;
|
|
55
|
-
|
|
56
|
-
|
|
19
|
+
const inversify_1 = require("inversify");
|
|
20
|
+
const dev_container_component_inserter_1 = require("./dev-container-component-inserter");
|
|
57
21
|
/**
|
|
58
22
|
* Need to find dev container from main dev workspace
|
|
59
23
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
24
|
+
let DevContainerComponentFinder = class DevContainerComponentFinder {
|
|
25
|
+
devContainerComponentInserter;
|
|
26
|
+
async find(devfileContext, injectDefaultComponent, defaultComponentImage) {
|
|
27
|
+
// if a devfile contains a parent, we should not add a default dev container
|
|
28
|
+
if (devfileContext.devfile?.parent) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
// search in main devWorkspace
|
|
32
|
+
const devComponents = devfileContext.devWorkspace.spec?.template?.components
|
|
33
|
+
?.filter(component => component.container)
|
|
34
|
+
.filter(
|
|
35
|
+
// we should ignore component that do not mount the sources
|
|
36
|
+
component => component.container && component.container.mountSources !== false);
|
|
37
|
+
if (!devComponents || devComponents.length === 0) {
|
|
38
|
+
// do not inject a default component if injectDefaultComponent parameter is false
|
|
39
|
+
if (!injectDefaultComponent || injectDefaultComponent !== 'true') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
this.devContainerComponentInserter.insert(devfileContext, defaultComponentImage);
|
|
43
|
+
let devComponents = devfileContext.devWorkspace.spec.template.components.filter(component => component.container);
|
|
44
|
+
return devComponents[0];
|
|
45
|
+
}
|
|
46
|
+
else if (devComponents.length === 1) {
|
|
47
|
+
return devComponents[0];
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.warn(`More than one dev container component has been potentially found, taking the first one of ${devComponents.map(component => component.name)}`);
|
|
51
|
+
return devComponents[0];
|
|
52
|
+
}
|
|
62
53
|
}
|
|
63
|
-
|
|
64
|
-
var _a, _b, _c, _d;
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
var devComponents, devComponents_1;
|
|
67
|
-
return __generator(this, function (_e) {
|
|
68
|
-
// if a devfile contains a parent, we should not add a default dev container
|
|
69
|
-
if ((_a = devfileContext.devfile) === null || _a === void 0 ? void 0 : _a.parent) {
|
|
70
|
-
return [2 /*return*/, undefined];
|
|
71
|
-
}
|
|
72
|
-
devComponents = (_d = (_c = (_b = devfileContext.devWorkspace.spec) === null || _b === void 0 ? void 0 : _b.template) === null || _c === void 0 ? void 0 : _c.components) === null || _d === void 0 ? void 0 : _d.filter(function (component) { return component.container; }).filter(
|
|
73
|
-
// we should ignore component that do not mount the sources
|
|
74
|
-
function (component) { return component.container && component.container.mountSources !== false; });
|
|
75
|
-
if (!devComponents || devComponents.length === 0) {
|
|
76
|
-
// do not inject a default component if injectDefaultComponent parameter is false
|
|
77
|
-
if (!injectDefaultComponent || injectDefaultComponent !== 'true') {
|
|
78
|
-
return [2 /*return*/, undefined];
|
|
79
|
-
}
|
|
80
|
-
this.devContainerComponentInserter.insert(devfileContext, defaultComponentImage);
|
|
81
|
-
devComponents_1 = devfileContext.devWorkspace.spec.template.components.filter(function (component) { return component.container; });
|
|
82
|
-
return [2 /*return*/, devComponents_1[0]];
|
|
83
|
-
}
|
|
84
|
-
else if (devComponents.length === 1) {
|
|
85
|
-
return [2 /*return*/, devComponents[0]];
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
console.warn("More than one dev container component has been potentially found, taking the first one of ".concat(devComponents.map(function (component) { return component.name; })));
|
|
89
|
-
return [2 /*return*/, devComponents[0]];
|
|
90
|
-
}
|
|
91
|
-
return [2 /*return*/];
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
__decorate([
|
|
96
|
-
(0, inversify_1.inject)(dev_container_component_inserter_1.DevContainerComponentInserter)
|
|
97
|
-
], DevContainerComponentFinder.prototype, "devContainerComponentInserter");
|
|
98
|
-
DevContainerComponentFinder = __decorate([
|
|
99
|
-
(0, inversify_1.injectable)()
|
|
100
|
-
], DevContainerComponentFinder);
|
|
101
|
-
return DevContainerComponentFinder;
|
|
102
|
-
}());
|
|
54
|
+
};
|
|
103
55
|
exports.DevContainerComponentFinder = DevContainerComponentFinder;
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, inversify_1.inject)(dev_container_component_inserter_1.DevContainerComponentInserter)
|
|
58
|
+
], DevContainerComponentFinder.prototype, "devContainerComponentInserter", void 0);
|
|
59
|
+
exports.DevContainerComponentFinder = DevContainerComponentFinder = __decorate([
|
|
60
|
+
(0, inversify_1.injectable)()
|
|
61
|
+
], DevContainerComponentFinder);
|
|
104
62
|
//# sourceMappingURL=dev-container-component-finder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-container-component-finder.js","sourceRoot":"","sources":["../../src/devfile/dev-container-component-finder.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE
|
|
1
|
+
{"version":3,"file":"dev-container-component-finder.js","sourceRoot":"","sources":["../../src/devfile/dev-container-component-finder.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;AAIzE,yCAA+C;AAC/C,yFAAmF;AAEnF;;GAEG;AAEI,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IAE9B,6BAA6B,CAAgC;IAErE,KAAK,CAAC,IAAI,CACR,cAA8B,EAC9B,sBAA+B,EAC/B,qBAA8B;QAE9B,4EAA4E;QAC5E,IAAI,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;YACnC,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,8BAA8B;QAC9B,MAAM,aAAa,GAAG,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU;YAC1E,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC;aACzC,MAAM;QACL,2DAA2D;QAC3D,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,IAAI,SAAS,CAAC,SAAS,CAAC,YAAY,KAAK,KAAK,CAC/E,CAAC;QAEJ,IAAI,CAAC,aAAa,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACjD,iFAAiF;YACjF,IAAI,CAAC,sBAAsB,IAAI,sBAAsB,KAAK,MAAM,EAAE,CAAC;gBACjE,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC;YAEjF,IAAI,aAAa,GAAG,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;YAElH,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;aAAM,IAAI,aAAa,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CACV,6FAA6F,aAAa,CAAC,GAAG,CAC5G,SAAS,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAC5B,EAAE,CACJ,CAAC;YACF,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;CACF,CAAA;AA1CY,kEAA2B;AAE9B;IADP,IAAA,kBAAM,EAAC,gEAA6B,CAAC;kFAC+B;sCAF1D,2BAA2B;IADvC,IAAA,sBAAU,GAAE;GACA,2BAA2B,CA0CvC"}
|
|
@@ -14,85 +14,40 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
14
14
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
15
15
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
19
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
20
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
21
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
22
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
23
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
24
|
-
});
|
|
25
|
-
};
|
|
26
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
27
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
28
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
29
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
30
|
-
function step(op) {
|
|
31
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
32
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
33
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
34
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
35
|
-
switch (op[0]) {
|
|
36
|
-
case 0: case 1: t = op; break;
|
|
37
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
38
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
39
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
40
|
-
default:
|
|
41
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
42
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
43
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
44
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
45
|
-
if (t[2]) _.ops.pop();
|
|
46
|
-
_.trys.pop(); continue;
|
|
47
|
-
}
|
|
48
|
-
op = body.call(thisArg, _);
|
|
49
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
50
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
exports.__esModule = true;
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
18
|
exports.DevContainerComponentInserter = void 0;
|
|
55
|
-
|
|
19
|
+
const inversify_1 = require("inversify");
|
|
56
20
|
/**
|
|
57
21
|
* Adds a new component on empty devfile with specific name and image
|
|
58
22
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
23
|
+
let DevContainerComponentInserter = class DevContainerComponentInserter {
|
|
24
|
+
DEFAULT_DEV_CONTAINER_IMAGE = 'quay.io/devfile/universal-developer-image:ubi8-latest';
|
|
25
|
+
DEFAULT_DEV_CONTAINER_NAME = 'dev';
|
|
26
|
+
async insert(devfileContext, defaultComponentImage) {
|
|
27
|
+
if (!devfileContext.devWorkspace.spec) {
|
|
28
|
+
devfileContext.devWorkspace.spec = {
|
|
29
|
+
started: true,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
if (!devfileContext.devWorkspace.spec.template) {
|
|
33
|
+
devfileContext.devWorkspace.spec.template = {};
|
|
34
|
+
}
|
|
35
|
+
if (!devfileContext.devWorkspace.spec.template.components) {
|
|
36
|
+
devfileContext.devWorkspace.spec.template.components = [];
|
|
37
|
+
}
|
|
38
|
+
const devContainerImage = defaultComponentImage ? defaultComponentImage : this.DEFAULT_DEV_CONTAINER_IMAGE;
|
|
39
|
+
console.log(`No container component has been found. A default container component with image ${devContainerImage} will be added.`);
|
|
40
|
+
const devContainerComponent = {
|
|
41
|
+
name: this.DEFAULT_DEV_CONTAINER_NAME,
|
|
42
|
+
container: {
|
|
43
|
+
image: devContainerImage,
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
devfileContext.devWorkspace.spec.template.components.push(devContainerComponent);
|
|
63
47
|
}
|
|
64
|
-
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
var devContainerImage, devContainerComponent;
|
|
67
|
-
return __generator(this, function (_a) {
|
|
68
|
-
if (!devfileContext.devWorkspace.spec) {
|
|
69
|
-
devfileContext.devWorkspace.spec = {
|
|
70
|
-
started: true
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
if (!devfileContext.devWorkspace.spec.template) {
|
|
74
|
-
devfileContext.devWorkspace.spec.template = {};
|
|
75
|
-
}
|
|
76
|
-
if (!devfileContext.devWorkspace.spec.template.components) {
|
|
77
|
-
devfileContext.devWorkspace.spec.template.components = [];
|
|
78
|
-
}
|
|
79
|
-
devContainerImage = defaultComponentImage ? defaultComponentImage : this.DEFAULT_DEV_CONTAINER_IMAGE;
|
|
80
|
-
console.log("No container component has been found. A default container component with image ".concat(devContainerImage, " will be added."));
|
|
81
|
-
devContainerComponent = {
|
|
82
|
-
name: this.DEFAULT_DEV_CONTAINER_NAME,
|
|
83
|
-
container: {
|
|
84
|
-
image: devContainerImage
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
devfileContext.devWorkspace.spec.template.components.push(devContainerComponent);
|
|
88
|
-
return [2 /*return*/];
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
DevContainerComponentInserter = __decorate([
|
|
93
|
-
(0, inversify_1.injectable)()
|
|
94
|
-
], DevContainerComponentInserter);
|
|
95
|
-
return DevContainerComponentInserter;
|
|
96
|
-
}());
|
|
48
|
+
};
|
|
97
49
|
exports.DevContainerComponentInserter = DevContainerComponentInserter;
|
|
50
|
+
exports.DevContainerComponentInserter = DevContainerComponentInserter = __decorate([
|
|
51
|
+
(0, inversify_1.injectable)()
|
|
52
|
+
], DevContainerComponentInserter);
|
|
98
53
|
//# sourceMappingURL=dev-container-component-inserter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dev-container-component-inserter.js","sourceRoot":"","sources":["../../src/devfile/dev-container-component-inserter.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE
|
|
1
|
+
{"version":3,"file":"dev-container-component-inserter.js","sourceRoot":"","sources":["../../src/devfile/dev-container-component-inserter.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;AAIzE,yCAAuC;AAEvC;;GAEG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA6B;IAC/B,2BAA2B,GAAG,uDAAuD,CAAC;IACtF,0BAA0B,GAAG,KAAK,CAAC;IAE5C,KAAK,CAAC,MAAM,CAAC,cAA8B,EAAE,qBAA8B;QACzE,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC;YACtC,cAAc,CAAC,YAAY,CAAC,IAAI,GAAG;gBACjC,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC/C,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,GAAG,EAAE,CAAC;QACjD,CAAC;QACD,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,EAAE,CAAC;YAC1D,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAG,EAAE,CAAC;QAC5D,CAAC;QAED,MAAM,iBAAiB,GAAG,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,2BAA2B,CAAC;QAC3G,OAAO,CAAC,GAAG,CACT,mFAAmF,iBAAiB,iBAAiB,CACtH,CAAC;QACF,MAAM,qBAAqB,GAA+C;YACxE,IAAI,EAAE,IAAI,CAAC,0BAA0B;YACrC,SAAS,EAAE;gBACT,KAAK,EAAE,iBAAiB;aACzB;SACF,CAAC;QAEF,cAAc,CAAC,YAAY,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;IACnF,CAAC;CACF,CAAA;AA9BY,sEAA6B;wCAA7B,6BAA6B;IADzC,IAAA,sBAAU,GAAE;GACA,6BAA6B,CA8BzC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.devfileModule = void 0;
|
|
4
4
|
/**********************************************************************
|
|
5
5
|
* Copyright (c) 2022-2024
|
|
@@ -10,10 +10,10 @@ exports.devfileModule = void 0;
|
|
|
10
10
|
*
|
|
11
11
|
* SPDX-License-Identifier: EPL-2.0
|
|
12
12
|
***********************************************************************/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
const inversify_1 = require("inversify");
|
|
14
|
+
const dev_container_component_finder_1 = require("./dev-container-component-finder");
|
|
15
|
+
const dev_container_component_inserter_1 = require("./dev-container-component-inserter");
|
|
16
|
+
const devfileModule = new inversify_1.ContainerModule((bind) => {
|
|
17
17
|
bind(dev_container_component_finder_1.DevContainerComponentFinder).toSelf().inSingletonScope();
|
|
18
18
|
bind(dev_container_component_inserter_1.DevContainerComponentInserter).toSelf().inSingletonScope();
|
|
19
19
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devfile-module.js","sourceRoot":"","sources":["../../src/devfile/devfile-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,
|
|
1
|
+
{"version":3,"file":"devfile-module.js","sourceRoot":"","sources":["../../src/devfile/devfile-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,yCAAwD;AAExD,qFAA+E;AAC/E,yFAAmF;AAEnF,MAAM,aAAa,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAqB,EAAE,EAAE;IAClE,IAAI,CAAC,4DAA2B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;IAC9D,IAAI,CAAC,gEAA6B,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;AAClE,CAAC,CAAC,CAAC;AAEM,sCAAa"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
exports
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.devfileSchemaModule = void 0;
|
|
4
4
|
/**********************************************************************
|
|
5
5
|
* Copyright (c) 2022-2024
|
|
@@ -10,9 +10,9 @@ exports.devfileSchemaModule = void 0;
|
|
|
10
10
|
*
|
|
11
11
|
* SPDX-License-Identifier: EPL-2.0
|
|
12
12
|
***********************************************************************/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
const inversify_1 = require("inversify");
|
|
14
|
+
const devfile_schema_validator_1 = require("./devfile-schema-validator");
|
|
15
|
+
const devfileSchemaModule = new inversify_1.ContainerModule((bind) => {
|
|
16
16
|
bind(devfile_schema_validator_1.DevfileSchemaValidator).toSelf().inSingletonScope();
|
|
17
17
|
});
|
|
18
18
|
exports.devfileSchemaModule = devfileSchemaModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devfile-schema-module.js","sourceRoot":"","sources":["../../src/devfile-schema/devfile-schema-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,
|
|
1
|
+
{"version":3,"file":"devfile-schema-module.js","sourceRoot":"","sources":["../../src/devfile-schema/devfile-schema-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,yCAAwD;AAExD,yEAAoE;AAEpE,MAAM,mBAAmB,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAqB,EAAE,EAAE;IACxE,IAAI,CAAC,iDAAsB,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;AAC3D,CAAC,CAAC,CAAC;AAEM,kDAAmB"}
|
|
@@ -28,7 +28,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
28
28
|
__setModuleDefault(result, mod);
|
|
29
29
|
return result;
|
|
30
30
|
};
|
|
31
|
-
exports
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
32
|
exports.DevfileSchemaValidator = void 0;
|
|
33
33
|
/**********************************************************************
|
|
34
34
|
* Copyright (c) 2022-2024
|
|
@@ -39,19 +39,17 @@ exports.DevfileSchemaValidator = void 0;
|
|
|
39
39
|
*
|
|
40
40
|
* SPDX-License-Identifier: EPL-2.0
|
|
41
41
|
***********************************************************************/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
DevfileSchemaValidator.prototype.getDevfileSchema = function (version) {
|
|
42
|
+
const inversify_1 = require("inversify");
|
|
43
|
+
const devfileSchemaV200 = __importStar(require("./2.0.0/devfile.json"));
|
|
44
|
+
const devfileSchemaV210 = __importStar(require("./2.1.0/devfile.json"));
|
|
45
|
+
const devfileSchemaV220 = __importStar(require("./2.2.0/devfile.json"));
|
|
46
|
+
const devfileSchemaV221 = __importStar(require("./2.2.1/devfile.json"));
|
|
47
|
+
const devfileSchemaV222 = __importStar(require("./2.2.2/devfile.json"));
|
|
48
|
+
const devfileSchemaV230 = __importStar(require("./2.3.0/devfile.json"));
|
|
49
|
+
const Validator = __importStar(require("jsonschema"));
|
|
50
|
+
const devfile_context_1 = require("../api/devfile-context");
|
|
51
|
+
let DevfileSchemaValidator = class DevfileSchemaValidator {
|
|
52
|
+
getDevfileSchema(version) {
|
|
55
53
|
switch (version) {
|
|
56
54
|
case devfile_context_1.DevfileSchemaVersion.V200:
|
|
57
55
|
return devfileSchemaV200;
|
|
@@ -66,19 +64,18 @@ var DevfileSchemaValidator = /** @class */ (function () {
|
|
|
66
64
|
case devfile_context_1.DevfileSchemaVersion.V230:
|
|
67
65
|
return devfileSchemaV230;
|
|
68
66
|
default:
|
|
69
|
-
throw new Error(
|
|
67
|
+
throw new Error(`Dev Workspace generator tool doesn't support devfile version: ${version}`);
|
|
70
68
|
}
|
|
71
|
-
}
|
|
69
|
+
}
|
|
72
70
|
// Validates devfile against schema
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
71
|
+
validateDevfile(devfile, version) {
|
|
72
|
+
const schema = this.getDevfileSchema(version);
|
|
73
|
+
const validatorResult = Validator.validate(devfile, schema, { nestedErrors: true });
|
|
76
74
|
return validatorResult;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
(0, inversify_1.injectable)()
|
|
80
|
-
], DevfileSchemaValidator);
|
|
81
|
-
return DevfileSchemaValidator;
|
|
82
|
-
}());
|
|
75
|
+
}
|
|
76
|
+
};
|
|
83
77
|
exports.DevfileSchemaValidator = DevfileSchemaValidator;
|
|
78
|
+
exports.DevfileSchemaValidator = DevfileSchemaValidator = __decorate([
|
|
79
|
+
(0, inversify_1.injectable)()
|
|
80
|
+
], DevfileSchemaValidator);
|
|
84
81
|
//# sourceMappingURL=devfile-schema-validator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devfile-schema-validator.js","sourceRoot":"","sources":["../../src/devfile-schema/devfile-schema-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;yEAQyE;AACzE,
|
|
1
|
+
{"version":3,"file":"devfile-schema-validator.js","sourceRoot":"","sources":["../../src/devfile-schema/devfile-schema-validator.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;yEAQyE;AACzE,yCAAuC;AAEvC,wEAA0D;AAC1D,wEAA0D;AAC1D,wEAA0D;AAC1D,wEAA0D;AAC1D,wEAA0D;AAC1D,wEAA0D;AAC1D,sDAAwC;AACxC,4DAA8D;AAGvD,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IACjC,gBAAgB,CAAC,OAAe;QAC9B,QAAQ,OAAO,EAAE,CAAC;YAChB,KAAK,sCAAoB,CAAC,IAAI;gBAC5B,OAAO,iBAAiB,CAAC;YAC3B,KAAK,sCAAoB,CAAC,IAAI;gBAC5B,OAAO,iBAAiB,CAAC;YAC3B,KAAK,sCAAoB,CAAC,IAAI;gBAC5B,OAAO,iBAAiB,CAAC;YAC3B,KAAK,sCAAoB,CAAC,IAAI;gBAC5B,OAAO,iBAAiB,CAAC;YAC3B,KAAK,sCAAoB,CAAC,IAAI;gBAC5B,OAAO,iBAAiB,CAAC;YAC3B,KAAK,sCAAoB,CAAC,IAAI;gBAC5B,OAAO,iBAAiB,CAAC;YAC3B;gBACE,MAAM,IAAI,KAAK,CAAC,iEAAiE,OAAO,EAAE,CAAC,CAAC;QAChG,CAAC;IACH,CAAC;IAED,mCAAmC;IACnC,eAAe,CAAC,OAAY,EAAE,OAAe;QAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC;QAC9C,MAAM,eAAe,GAAG,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAEpF,OAAO,eAAe,CAAC;IACzB,CAAC;CACF,CAAA;AA3BY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CA2BlC"}
|
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
* SPDX-License-Identifier: EPL-2.0
|
|
9
9
|
***********************************************************************/
|
|
10
10
|
import { ContainerModule } from 'inversify';
|
|
11
|
-
declare const
|
|
12
|
-
export {
|
|
11
|
+
declare const editorModule: ContainerModule;
|
|
12
|
+
export { editorModule };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.editorModule = void 0;
|
|
4
|
+
/**********************************************************************
|
|
5
|
+
* Copyright (c) 2022-2024
|
|
6
|
+
*
|
|
7
|
+
* This program and the accompanying materials are made
|
|
8
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
9
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
10
|
+
*
|
|
11
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
12
|
+
***********************************************************************/
|
|
13
|
+
const inversify_1 = require("inversify");
|
|
14
|
+
const editor_resolver_1 = require("./editor-resolver");
|
|
15
|
+
const editorModule = new inversify_1.ContainerModule((bind) => {
|
|
16
|
+
bind(editor_resolver_1.EditorResolver).toSelf().inSingletonScope();
|
|
17
|
+
});
|
|
18
|
+
exports.editorModule = editorModule;
|
|
19
|
+
//# sourceMappingURL=editor-module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-module.js","sourceRoot":"","sources":["../../src/editor/editor-module.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;yEAQyE;AACzE,yCAAwD;AAExD,uDAAmD;AAEnD,MAAM,YAAY,GAAG,IAAI,2BAAe,CAAC,CAAC,IAAqB,EAAE,EAAE;IACjE,IAAI,CAAC,gCAAc,CAAC,CAAC,MAAM,EAAE,CAAC,gBAAgB,EAAE,CAAC;AACnD,CAAC,CAAC,CAAC;AAEM,oCAAY"}
|
|
@@ -10,8 +10,7 @@
|
|
|
10
10
|
/**
|
|
11
11
|
* Resolve plug-ins by grabbing the definition from the plug-in registry.
|
|
12
12
|
*/
|
|
13
|
-
export declare class
|
|
14
|
-
private pluginRegistryUrl;
|
|
13
|
+
export declare class EditorResolver {
|
|
15
14
|
private urlFetcher;
|
|
16
|
-
|
|
15
|
+
loadEditor(editorUrl: string): Promise<any>;
|
|
17
16
|
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**********************************************************************
|
|
3
|
+
* Copyright (c) 2022-2024
|
|
4
|
+
*
|
|
5
|
+
* This program and the accompanying materials are made
|
|
6
|
+
* available under the terms of the Eclipse Public License 2.0
|
|
7
|
+
* which is available at https://www.eclipse.org/legal/epl-2.0/
|
|
8
|
+
*
|
|
9
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
+
***********************************************************************/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
28
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
29
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
30
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
31
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
32
|
+
};
|
|
33
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.EditorResolver = void 0;
|
|
42
|
+
const jsYaml = __importStar(require("js-yaml"));
|
|
43
|
+
const inversify_1 = require("inversify");
|
|
44
|
+
const url_fetcher_1 = require("../fetch/url-fetcher");
|
|
45
|
+
/**
|
|
46
|
+
* Resolve plug-ins by grabbing the definition from the plug-in registry.
|
|
47
|
+
*/
|
|
48
|
+
let EditorResolver = class EditorResolver {
|
|
49
|
+
urlFetcher;
|
|
50
|
+
// Editor URL (like https://raw.githubusercontent.com/eclipse-che/che-operator/refs/heads/main/editors-definitions/che-code-latest.yaml)
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
52
|
+
async loadEditor(editorUrl) {
|
|
53
|
+
const devfileContent = await this.urlFetcher.fetchText(editorUrl);
|
|
54
|
+
return jsYaml.load(devfileContent);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.EditorResolver = EditorResolver;
|
|
58
|
+
__decorate([
|
|
59
|
+
(0, inversify_1.inject)(url_fetcher_1.UrlFetcher)
|
|
60
|
+
], EditorResolver.prototype, "urlFetcher", void 0);
|
|
61
|
+
exports.EditorResolver = EditorResolver = __decorate([
|
|
62
|
+
(0, inversify_1.injectable)()
|
|
63
|
+
], EditorResolver);
|
|
64
|
+
//# sourceMappingURL=editor-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-resolver.js","sourceRoot":"","sources":["../../src/editor/editor-resolver.ts"],"names":[],"mappings":";AAAA;;;;;;;;yEAQyE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEzE,gDAAkC;AAElC,yCAA+C;AAE/C,sDAAkD;AAElD;;GAEG;AAEI,IAAM,cAAc,GAApB,MAAM,cAAc;IAEjB,UAAU,CAAa;IAE/B,wIAAwI;IACxI,8DAA8D;IAC9D,KAAK,CAAC,UAAU,CAAC,SAAiB;QAChC,MAAM,cAAc,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;QAClE,OAAO,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IACrC,CAAC;CACF,CAAA;AAVY,wCAAc;AAEjB;IADP,IAAA,kBAAM,EAAC,wBAAU,CAAC;kDACY;yBAFpB,cAAc;IAD1B,IAAA,sBAAU,GAAE;GACA,cAAc,CAU1B"}
|