@theia/application-package 1.48.0 → 1.48.1
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 +25 -25
- package/lib/api.d.ts +5 -5
- package/lib/api.js +23 -23
- package/lib/application-package.d.ts +88 -88
- package/lib/application-package.js +262 -262
- package/lib/application-package.spec.d.ts +1 -1
- package/lib/application-package.spec.js +57 -57
- package/lib/application-props.d.ts +172 -172
- package/lib/application-props.js +102 -102
- package/lib/environment.d.ts +39 -39
- package/lib/environment.js +73 -73
- package/lib/extension-package-collector.d.ts +15 -15
- package/lib/extension-package-collector.js +76 -76
- package/lib/extension-package.d.ts +65 -65
- package/lib/extension-package.js +176 -176
- package/lib/index.d.ts +6 -6
- package/lib/index.js +24 -24
- package/lib/json-file.d.ts +3 -3
- package/lib/json-file.js +26 -26
- package/lib/npm-registry.d.ts +73 -73
- package/lib/npm-registry.js +101 -101
- package/package.json +4 -4
- package/src/api.ts +21 -21
- package/src/application-package.spec.ts +62 -62
- package/src/application-package.ts +334 -334
- package/src/application-props.ts +264 -264
- package/src/environment.ts +76 -76
- package/src/extension-package-collector.ts +83 -83
- package/src/extension-package.ts +223 -223
- package/src/index.ts +22 -22
- package/src/json-file.ts +25 -25
- package/src/npm-registry.ts +161 -161
package/lib/extension-package.js
CHANGED
|
@@ -1,177 +1,177 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.RawExtensionPackage = exports.ExtensionPackage = void 0;
|
|
19
|
-
const fs = require("fs-extra");
|
|
20
|
-
const paths = require("path");
|
|
21
|
-
const semver = require("semver");
|
|
22
|
-
const npm_registry_1 = require("./npm-registry");
|
|
23
|
-
class ExtensionPackage {
|
|
24
|
-
constructor(raw, registry, options = {}) {
|
|
25
|
-
var _a;
|
|
26
|
-
this.raw = raw;
|
|
27
|
-
this.registry = registry;
|
|
28
|
-
this._name = (_a = options.alias) !== null && _a !== void 0 ? _a : raw.name;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* The name of the extension's package as defined in "dependencies" (might be aliased)
|
|
32
|
-
*/
|
|
33
|
-
get name() {
|
|
34
|
-
return this._name;
|
|
35
|
-
}
|
|
36
|
-
get version() {
|
|
37
|
-
if (this.raw.installed) {
|
|
38
|
-
return this.raw.installed.version;
|
|
39
|
-
}
|
|
40
|
-
if (this.raw.view) {
|
|
41
|
-
const latestVersion = this.raw.view.latestVersion;
|
|
42
|
-
if (latestVersion) {
|
|
43
|
-
return latestVersion;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return this.raw.version;
|
|
47
|
-
}
|
|
48
|
-
get description() {
|
|
49
|
-
return this.raw.description || '';
|
|
50
|
-
}
|
|
51
|
-
get theiaExtensions() {
|
|
52
|
-
return this.raw.theiaExtensions || [];
|
|
53
|
-
}
|
|
54
|
-
get installed() {
|
|
55
|
-
return !!this.raw.installed;
|
|
56
|
-
}
|
|
57
|
-
get dependent() {
|
|
58
|
-
if (!this.transitive) {
|
|
59
|
-
return undefined;
|
|
60
|
-
}
|
|
61
|
-
let current = this.parent;
|
|
62
|
-
let parent = current.parent;
|
|
63
|
-
while (parent !== undefined) {
|
|
64
|
-
current = parent;
|
|
65
|
-
parent = current.parent;
|
|
66
|
-
}
|
|
67
|
-
return current.name;
|
|
68
|
-
}
|
|
69
|
-
get transitive() {
|
|
70
|
-
return !!this.raw.installed && this.raw.installed.transitive;
|
|
71
|
-
}
|
|
72
|
-
get parent() {
|
|
73
|
-
if (this.raw.installed) {
|
|
74
|
-
return this.raw.installed.parent;
|
|
75
|
-
}
|
|
76
|
-
return undefined;
|
|
77
|
-
}
|
|
78
|
-
async view() {
|
|
79
|
-
if (this.raw.view === undefined) {
|
|
80
|
-
const raw = await RawExtensionPackage.view(this.registry, this.name, this.version);
|
|
81
|
-
this.raw.view = raw ? raw.view : new RawExtensionPackage.ViewState(this.registry);
|
|
82
|
-
}
|
|
83
|
-
return this.raw.view;
|
|
84
|
-
}
|
|
85
|
-
async getReadme() {
|
|
86
|
-
if (this.readme === undefined) {
|
|
87
|
-
this.readme = await this.resolveReadme();
|
|
88
|
-
}
|
|
89
|
-
return this.readme;
|
|
90
|
-
}
|
|
91
|
-
async resolveReadme() {
|
|
92
|
-
const raw = await this.view();
|
|
93
|
-
if (raw && raw.readme) {
|
|
94
|
-
return raw.readme;
|
|
95
|
-
}
|
|
96
|
-
if (this.raw.installed) {
|
|
97
|
-
const readmePath = paths.resolve(this.raw.installed.packagePath, '..', 'README.md');
|
|
98
|
-
if (await fs.pathExists(readmePath)) {
|
|
99
|
-
return fs.readFile(readmePath, { encoding: 'utf8' });
|
|
100
|
-
}
|
|
101
|
-
return '';
|
|
102
|
-
}
|
|
103
|
-
return '';
|
|
104
|
-
}
|
|
105
|
-
getAuthor() {
|
|
106
|
-
if (this.raw.publisher) {
|
|
107
|
-
return this.raw.publisher.username;
|
|
108
|
-
}
|
|
109
|
-
if (typeof this.raw.author === 'string') {
|
|
110
|
-
return this.raw.author;
|
|
111
|
-
}
|
|
112
|
-
if (this.raw.author && this.raw.author.name) {
|
|
113
|
-
return this.raw.author.name;
|
|
114
|
-
}
|
|
115
|
-
if (!!this.raw.maintainers && this.raw.maintainers.length > 0) {
|
|
116
|
-
return this.raw.maintainers[0].username;
|
|
117
|
-
}
|
|
118
|
-
return '';
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
exports.ExtensionPackage = ExtensionPackage;
|
|
122
|
-
var RawExtensionPackage;
|
|
123
|
-
(function (RawExtensionPackage) {
|
|
124
|
-
class ViewState {
|
|
125
|
-
constructor(registry) {
|
|
126
|
-
this.registry = registry;
|
|
127
|
-
}
|
|
128
|
-
get latestVersion() {
|
|
129
|
-
if (this.tags) {
|
|
130
|
-
if (this.registry.props.next) {
|
|
131
|
-
const next = this.tags['next'];
|
|
132
|
-
if (next !== undefined) {
|
|
133
|
-
return next;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
const latest = this.tags['latest'];
|
|
137
|
-
if (this.registry.props.next || !semver.prerelease(latest)) {
|
|
138
|
-
return latest;
|
|
139
|
-
}
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
return undefined;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
RawExtensionPackage.ViewState = ViewState;
|
|
146
|
-
function is(pck) {
|
|
147
|
-
return npm_registry_1.PublishedNodePackage.is(pck) && !!pck.theiaExtensions;
|
|
148
|
-
}
|
|
149
|
-
RawExtensionPackage.is = is;
|
|
150
|
-
async function view(registry, name, version) {
|
|
151
|
-
const result = await registry.view(name).catch(() => undefined);
|
|
152
|
-
if (!result) {
|
|
153
|
-
return undefined;
|
|
154
|
-
}
|
|
155
|
-
const tags = result['dist-tags'];
|
|
156
|
-
const versions = [tags['latest']];
|
|
157
|
-
if (registry.props.next) {
|
|
158
|
-
versions.push(tags['next']);
|
|
159
|
-
}
|
|
160
|
-
if (version) {
|
|
161
|
-
versions.push(tags[version], version);
|
|
162
|
-
}
|
|
163
|
-
for (const current of versions.reverse()) {
|
|
164
|
-
const raw = result.versions[current];
|
|
165
|
-
if (is(raw)) {
|
|
166
|
-
const viewState = new ViewState(registry);
|
|
167
|
-
viewState.readme = result.readme;
|
|
168
|
-
viewState.tags = tags;
|
|
169
|
-
raw.view = viewState;
|
|
170
|
-
return raw;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return undefined;
|
|
174
|
-
}
|
|
175
|
-
RawExtensionPackage.view = view;
|
|
176
|
-
})(RawExtensionPackage = exports.RawExtensionPackage || (exports.RawExtensionPackage = {}));
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.RawExtensionPackage = exports.ExtensionPackage = void 0;
|
|
19
|
+
const fs = require("fs-extra");
|
|
20
|
+
const paths = require("path");
|
|
21
|
+
const semver = require("semver");
|
|
22
|
+
const npm_registry_1 = require("./npm-registry");
|
|
23
|
+
class ExtensionPackage {
|
|
24
|
+
constructor(raw, registry, options = {}) {
|
|
25
|
+
var _a;
|
|
26
|
+
this.raw = raw;
|
|
27
|
+
this.registry = registry;
|
|
28
|
+
this._name = (_a = options.alias) !== null && _a !== void 0 ? _a : raw.name;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* The name of the extension's package as defined in "dependencies" (might be aliased)
|
|
32
|
+
*/
|
|
33
|
+
get name() {
|
|
34
|
+
return this._name;
|
|
35
|
+
}
|
|
36
|
+
get version() {
|
|
37
|
+
if (this.raw.installed) {
|
|
38
|
+
return this.raw.installed.version;
|
|
39
|
+
}
|
|
40
|
+
if (this.raw.view) {
|
|
41
|
+
const latestVersion = this.raw.view.latestVersion;
|
|
42
|
+
if (latestVersion) {
|
|
43
|
+
return latestVersion;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return this.raw.version;
|
|
47
|
+
}
|
|
48
|
+
get description() {
|
|
49
|
+
return this.raw.description || '';
|
|
50
|
+
}
|
|
51
|
+
get theiaExtensions() {
|
|
52
|
+
return this.raw.theiaExtensions || [];
|
|
53
|
+
}
|
|
54
|
+
get installed() {
|
|
55
|
+
return !!this.raw.installed;
|
|
56
|
+
}
|
|
57
|
+
get dependent() {
|
|
58
|
+
if (!this.transitive) {
|
|
59
|
+
return undefined;
|
|
60
|
+
}
|
|
61
|
+
let current = this.parent;
|
|
62
|
+
let parent = current.parent;
|
|
63
|
+
while (parent !== undefined) {
|
|
64
|
+
current = parent;
|
|
65
|
+
parent = current.parent;
|
|
66
|
+
}
|
|
67
|
+
return current.name;
|
|
68
|
+
}
|
|
69
|
+
get transitive() {
|
|
70
|
+
return !!this.raw.installed && this.raw.installed.transitive;
|
|
71
|
+
}
|
|
72
|
+
get parent() {
|
|
73
|
+
if (this.raw.installed) {
|
|
74
|
+
return this.raw.installed.parent;
|
|
75
|
+
}
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
async view() {
|
|
79
|
+
if (this.raw.view === undefined) {
|
|
80
|
+
const raw = await RawExtensionPackage.view(this.registry, this.name, this.version);
|
|
81
|
+
this.raw.view = raw ? raw.view : new RawExtensionPackage.ViewState(this.registry);
|
|
82
|
+
}
|
|
83
|
+
return this.raw.view;
|
|
84
|
+
}
|
|
85
|
+
async getReadme() {
|
|
86
|
+
if (this.readme === undefined) {
|
|
87
|
+
this.readme = await this.resolveReadme();
|
|
88
|
+
}
|
|
89
|
+
return this.readme;
|
|
90
|
+
}
|
|
91
|
+
async resolveReadme() {
|
|
92
|
+
const raw = await this.view();
|
|
93
|
+
if (raw && raw.readme) {
|
|
94
|
+
return raw.readme;
|
|
95
|
+
}
|
|
96
|
+
if (this.raw.installed) {
|
|
97
|
+
const readmePath = paths.resolve(this.raw.installed.packagePath, '..', 'README.md');
|
|
98
|
+
if (await fs.pathExists(readmePath)) {
|
|
99
|
+
return fs.readFile(readmePath, { encoding: 'utf8' });
|
|
100
|
+
}
|
|
101
|
+
return '';
|
|
102
|
+
}
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
getAuthor() {
|
|
106
|
+
if (this.raw.publisher) {
|
|
107
|
+
return this.raw.publisher.username;
|
|
108
|
+
}
|
|
109
|
+
if (typeof this.raw.author === 'string') {
|
|
110
|
+
return this.raw.author;
|
|
111
|
+
}
|
|
112
|
+
if (this.raw.author && this.raw.author.name) {
|
|
113
|
+
return this.raw.author.name;
|
|
114
|
+
}
|
|
115
|
+
if (!!this.raw.maintainers && this.raw.maintainers.length > 0) {
|
|
116
|
+
return this.raw.maintainers[0].username;
|
|
117
|
+
}
|
|
118
|
+
return '';
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.ExtensionPackage = ExtensionPackage;
|
|
122
|
+
var RawExtensionPackage;
|
|
123
|
+
(function (RawExtensionPackage) {
|
|
124
|
+
class ViewState {
|
|
125
|
+
constructor(registry) {
|
|
126
|
+
this.registry = registry;
|
|
127
|
+
}
|
|
128
|
+
get latestVersion() {
|
|
129
|
+
if (this.tags) {
|
|
130
|
+
if (this.registry.props.next) {
|
|
131
|
+
const next = this.tags['next'];
|
|
132
|
+
if (next !== undefined) {
|
|
133
|
+
return next;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
const latest = this.tags['latest'];
|
|
137
|
+
if (this.registry.props.next || !semver.prerelease(latest)) {
|
|
138
|
+
return latest;
|
|
139
|
+
}
|
|
140
|
+
return undefined;
|
|
141
|
+
}
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
RawExtensionPackage.ViewState = ViewState;
|
|
146
|
+
function is(pck) {
|
|
147
|
+
return npm_registry_1.PublishedNodePackage.is(pck) && !!pck.theiaExtensions;
|
|
148
|
+
}
|
|
149
|
+
RawExtensionPackage.is = is;
|
|
150
|
+
async function view(registry, name, version) {
|
|
151
|
+
const result = await registry.view(name).catch(() => undefined);
|
|
152
|
+
if (!result) {
|
|
153
|
+
return undefined;
|
|
154
|
+
}
|
|
155
|
+
const tags = result['dist-tags'];
|
|
156
|
+
const versions = [tags['latest']];
|
|
157
|
+
if (registry.props.next) {
|
|
158
|
+
versions.push(tags['next']);
|
|
159
|
+
}
|
|
160
|
+
if (version) {
|
|
161
|
+
versions.push(tags[version], version);
|
|
162
|
+
}
|
|
163
|
+
for (const current of versions.reverse()) {
|
|
164
|
+
const raw = result.versions[current];
|
|
165
|
+
if (is(raw)) {
|
|
166
|
+
const viewState = new ViewState(registry);
|
|
167
|
+
viewState.readme = result.readme;
|
|
168
|
+
viewState.tags = tags;
|
|
169
|
+
raw.view = viewState;
|
|
170
|
+
return raw;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return undefined;
|
|
174
|
+
}
|
|
175
|
+
RawExtensionPackage.view = view;
|
|
176
|
+
})(RawExtensionPackage = exports.RawExtensionPackage || (exports.RawExtensionPackage = {}));
|
|
177
177
|
//# sourceMappingURL=extension-package.js.map
|
package/lib/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from './npm-registry';
|
|
2
|
-
export * from './extension-package';
|
|
3
|
-
export * from './application-package';
|
|
4
|
-
export * from './application-props';
|
|
5
|
-
export * from './environment';
|
|
6
|
-
export * from './api';
|
|
1
|
+
export * from './npm-registry';
|
|
2
|
+
export * from './extension-package';
|
|
3
|
+
export * from './application-package';
|
|
4
|
+
export * from './application-props';
|
|
5
|
+
export * from './environment';
|
|
6
|
+
export * from './api';
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
(0, tslib_1.__exportStar)(require("./npm-registry"), exports);
|
|
20
|
-
(0, tslib_1.__exportStar)(require("./extension-package"), exports);
|
|
21
|
-
(0, tslib_1.__exportStar)(require("./application-package"), exports);
|
|
22
|
-
(0, tslib_1.__exportStar)(require("./application-props"), exports);
|
|
23
|
-
(0, tslib_1.__exportStar)(require("./environment"), exports);
|
|
24
|
-
(0, tslib_1.__exportStar)(require("./api"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
const tslib_1 = require("tslib");
|
|
19
|
+
(0, tslib_1.__exportStar)(require("./npm-registry"), exports);
|
|
20
|
+
(0, tslib_1.__exportStar)(require("./extension-package"), exports);
|
|
21
|
+
(0, tslib_1.__exportStar)(require("./application-package"), exports);
|
|
22
|
+
(0, tslib_1.__exportStar)(require("./application-props"), exports);
|
|
23
|
+
(0, tslib_1.__exportStar)(require("./environment"), exports);
|
|
24
|
+
(0, tslib_1.__exportStar)(require("./api"), exports);
|
|
25
25
|
//# sourceMappingURL=index.js.map
|
package/lib/json-file.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import writeJsonFile = require('write-json-file');
|
|
2
|
-
declare function readJsonFile(path: string): any;
|
|
3
|
-
export { writeJsonFile, readJsonFile };
|
|
1
|
+
import writeJsonFile = require('write-json-file');
|
|
2
|
+
declare function readJsonFile(path: string): any;
|
|
3
|
+
export { writeJsonFile, readJsonFile };
|
|
4
4
|
//# sourceMappingURL=json-file.d.ts.map
|
package/lib/json-file.js
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.readJsonFile = exports.writeJsonFile = void 0;
|
|
19
|
-
const fs = require("fs");
|
|
20
|
-
const writeJsonFile = require("write-json-file");
|
|
21
|
-
exports.writeJsonFile = writeJsonFile;
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
-
function readJsonFile(path) {
|
|
24
|
-
return JSON.parse(fs.readFileSync(path, { encoding: 'utf-8' }));
|
|
25
|
-
}
|
|
26
|
-
exports.readJsonFile = readJsonFile;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.readJsonFile = exports.writeJsonFile = void 0;
|
|
19
|
+
const fs = require("fs");
|
|
20
|
+
const writeJsonFile = require("write-json-file");
|
|
21
|
+
exports.writeJsonFile = writeJsonFile;
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
|
+
function readJsonFile(path) {
|
|
24
|
+
return JSON.parse(fs.readFileSync(path, { encoding: 'utf-8' }));
|
|
25
|
+
}
|
|
26
|
+
exports.readJsonFile = readJsonFile;
|
|
27
27
|
//# sourceMappingURL=json-file.js.map
|
package/lib/npm-registry.d.ts
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import * as nano from 'nano';
|
|
2
|
-
import { NodeRequestService } from '@theia/request/lib/node-request-service';
|
|
3
|
-
import { NpmRegistryProps } from './application-props';
|
|
4
|
-
export interface IChangeStream {
|
|
5
|
-
on(event: 'data', cb: (change: {
|
|
6
|
-
id: string;
|
|
7
|
-
}) => void): void;
|
|
8
|
-
destroy(): void;
|
|
9
|
-
}
|
|
10
|
-
export interface Author {
|
|
11
|
-
name: string;
|
|
12
|
-
email: string;
|
|
13
|
-
}
|
|
14
|
-
export interface Maintainer {
|
|
15
|
-
username: string;
|
|
16
|
-
email: string;
|
|
17
|
-
}
|
|
18
|
-
export interface Dependencies {
|
|
19
|
-
[name: string]: string | undefined;
|
|
20
|
-
}
|
|
21
|
-
export interface NodePackage {
|
|
22
|
-
name?: string;
|
|
23
|
-
version?: string;
|
|
24
|
-
description?: string;
|
|
25
|
-
publisher?: Maintainer;
|
|
26
|
-
author?: string | Author;
|
|
27
|
-
maintainers?: Maintainer[];
|
|
28
|
-
keywords?: string[];
|
|
29
|
-
dependencies?: Dependencies;
|
|
30
|
-
peerDependencies?: Dependencies;
|
|
31
|
-
[property: string]: any;
|
|
32
|
-
}
|
|
33
|
-
export interface PublishedNodePackage extends NodePackage {
|
|
34
|
-
name: string;
|
|
35
|
-
version: string;
|
|
36
|
-
}
|
|
37
|
-
export declare namespace PublishedNodePackage {
|
|
38
|
-
function is(pck: NodePackage | undefined): pck is PublishedNodePackage;
|
|
39
|
-
}
|
|
40
|
-
export interface ViewResult {
|
|
41
|
-
'dist-tags': {
|
|
42
|
-
[tag: string]: string;
|
|
43
|
-
};
|
|
44
|
-
'versions': {
|
|
45
|
-
[version: string]: NodePackage;
|
|
46
|
-
};
|
|
47
|
-
'readme': string;
|
|
48
|
-
[key: string]: any;
|
|
49
|
-
}
|
|
50
|
-
export declare function sortByKey(object: {
|
|
51
|
-
[key: string]: any;
|
|
52
|
-
}): {
|
|
53
|
-
[key: string]: any;
|
|
54
|
-
};
|
|
55
|
-
export declare class NpmRegistryOptions {
|
|
56
|
-
/**
|
|
57
|
-
* Default: false.
|
|
58
|
-
*/
|
|
59
|
-
readonly watchChanges: boolean;
|
|
60
|
-
}
|
|
61
|
-
export declare class NpmRegistry {
|
|
62
|
-
readonly props: NpmRegistryProps;
|
|
63
|
-
protected readonly options: NpmRegistryOptions;
|
|
64
|
-
protected changes?: nano.ChangesReaderScope;
|
|
65
|
-
protected readonly index: Map<string, Promise<ViewResult>>;
|
|
66
|
-
protected request: NodeRequestService;
|
|
67
|
-
constructor(options?: Partial<NpmRegistryOptions>);
|
|
68
|
-
updateProps(props?: Partial<NpmRegistryProps>): void;
|
|
69
|
-
protected resetIndex(): void;
|
|
70
|
-
protected invalidate(name: string): void;
|
|
71
|
-
view(name: string): Promise<ViewResult>;
|
|
72
|
-
protected doView(name: string): Promise<ViewResult>;
|
|
73
|
-
}
|
|
1
|
+
import * as nano from 'nano';
|
|
2
|
+
import { NodeRequestService } from '@theia/request/lib/node-request-service';
|
|
3
|
+
import { NpmRegistryProps } from './application-props';
|
|
4
|
+
export interface IChangeStream {
|
|
5
|
+
on(event: 'data', cb: (change: {
|
|
6
|
+
id: string;
|
|
7
|
+
}) => void): void;
|
|
8
|
+
destroy(): void;
|
|
9
|
+
}
|
|
10
|
+
export interface Author {
|
|
11
|
+
name: string;
|
|
12
|
+
email: string;
|
|
13
|
+
}
|
|
14
|
+
export interface Maintainer {
|
|
15
|
+
username: string;
|
|
16
|
+
email: string;
|
|
17
|
+
}
|
|
18
|
+
export interface Dependencies {
|
|
19
|
+
[name: string]: string | undefined;
|
|
20
|
+
}
|
|
21
|
+
export interface NodePackage {
|
|
22
|
+
name?: string;
|
|
23
|
+
version?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
publisher?: Maintainer;
|
|
26
|
+
author?: string | Author;
|
|
27
|
+
maintainers?: Maintainer[];
|
|
28
|
+
keywords?: string[];
|
|
29
|
+
dependencies?: Dependencies;
|
|
30
|
+
peerDependencies?: Dependencies;
|
|
31
|
+
[property: string]: any;
|
|
32
|
+
}
|
|
33
|
+
export interface PublishedNodePackage extends NodePackage {
|
|
34
|
+
name: string;
|
|
35
|
+
version: string;
|
|
36
|
+
}
|
|
37
|
+
export declare namespace PublishedNodePackage {
|
|
38
|
+
function is(pck: NodePackage | undefined): pck is PublishedNodePackage;
|
|
39
|
+
}
|
|
40
|
+
export interface ViewResult {
|
|
41
|
+
'dist-tags': {
|
|
42
|
+
[tag: string]: string;
|
|
43
|
+
};
|
|
44
|
+
'versions': {
|
|
45
|
+
[version: string]: NodePackage;
|
|
46
|
+
};
|
|
47
|
+
'readme': string;
|
|
48
|
+
[key: string]: any;
|
|
49
|
+
}
|
|
50
|
+
export declare function sortByKey(object: {
|
|
51
|
+
[key: string]: any;
|
|
52
|
+
}): {
|
|
53
|
+
[key: string]: any;
|
|
54
|
+
};
|
|
55
|
+
export declare class NpmRegistryOptions {
|
|
56
|
+
/**
|
|
57
|
+
* Default: false.
|
|
58
|
+
*/
|
|
59
|
+
readonly watchChanges: boolean;
|
|
60
|
+
}
|
|
61
|
+
export declare class NpmRegistry {
|
|
62
|
+
readonly props: NpmRegistryProps;
|
|
63
|
+
protected readonly options: NpmRegistryOptions;
|
|
64
|
+
protected changes?: nano.ChangesReaderScope;
|
|
65
|
+
protected readonly index: Map<string, Promise<ViewResult>>;
|
|
66
|
+
protected request: NodeRequestService;
|
|
67
|
+
constructor(options?: Partial<NpmRegistryOptions>);
|
|
68
|
+
updateProps(props?: Partial<NpmRegistryProps>): void;
|
|
69
|
+
protected resetIndex(): void;
|
|
70
|
+
protected invalidate(name: string): void;
|
|
71
|
+
view(name: string): Promise<ViewResult>;
|
|
72
|
+
protected doView(name: string): Promise<ViewResult>;
|
|
73
|
+
}
|
|
74
74
|
//# sourceMappingURL=npm-registry.d.ts.map
|