ovsx 0.5.0 → 0.5.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/CHANGELOG.md +63 -63
- package/README.md +48 -48
- package/lib/check-license.d.ts +12 -12
- package/lib/check-license.js +110 -110
- package/lib/create-namespace.d.ts +20 -20
- package/lib/create-namespace.js +43 -43
- package/lib/get.d.ts +36 -36
- package/lib/get.js +122 -122
- package/lib/index.d.ts +15 -15
- package/lib/index.js +23 -23
- package/lib/main.d.ts +10 -10
- package/lib/main.js +93 -93
- package/lib/ovsx +10 -10
- package/lib/publish.d.ts +39 -39
- package/lib/publish.js +94 -94
- package/lib/registry.d.ts +130 -130
- package/lib/registry.js +201 -201
- package/lib/util.d.ts +35 -35
- package/lib/util.js +183 -183
- package/package.json +67 -67
- package/src/ovsx +10 -10
package/lib/registry.js
CHANGED
|
@@ -1,202 +1,202 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/********************************************************************************
|
|
3
|
-
* Copyright (c) 2019 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
|
-
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
-
********************************************************************************/
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const fs = require("fs");
|
|
13
|
-
const querystring = require("querystring");
|
|
14
|
-
const followRedirects = require("follow-redirects");
|
|
15
|
-
const util_1 = require("./util");
|
|
16
|
-
exports.DEFAULT_URL = 'https://open-vsx.org';
|
|
17
|
-
exports.DEFAULT_NAMESPACE_SIZE = 1024;
|
|
18
|
-
exports.DEFAULT_PUBLISH_SIZE = 512 * 1024 * 1024;
|
|
19
|
-
class Registry {
|
|
20
|
-
constructor(options = {}) {
|
|
21
|
-
if (options.registryUrl && options.registryUrl.endsWith('/'))
|
|
22
|
-
this.url = options.registryUrl.substring(0, options.registryUrl.length - 1);
|
|
23
|
-
else if (options.registryUrl)
|
|
24
|
-
this.url = options.registryUrl;
|
|
25
|
-
else
|
|
26
|
-
this.url = exports.DEFAULT_URL;
|
|
27
|
-
this.maxNamespaceSize = options.maxNamespaceSize || exports.DEFAULT_NAMESPACE_SIZE;
|
|
28
|
-
this.maxPublishSize = options.maxPublishSize || exports.DEFAULT_PUBLISH_SIZE;
|
|
29
|
-
this.username = options.username;
|
|
30
|
-
this.password = options.password;
|
|
31
|
-
}
|
|
32
|
-
get requiresLicense() {
|
|
33
|
-
const url = new URL(this.url);
|
|
34
|
-
return url.hostname === 'open-vsx.org' || url.hostname.endsWith('.open-vsx.org');
|
|
35
|
-
}
|
|
36
|
-
createNamespace(name, pat) {
|
|
37
|
-
try {
|
|
38
|
-
const query = { token: pat };
|
|
39
|
-
const url = this.getUrl('api/-/namespace/create', query);
|
|
40
|
-
const namespace = { name };
|
|
41
|
-
return this.post(JSON.stringify(namespace), url, {
|
|
42
|
-
'Content-Type': 'application/json'
|
|
43
|
-
}, this.maxNamespaceSize);
|
|
44
|
-
}
|
|
45
|
-
catch (err) {
|
|
46
|
-
return Promise.reject(err);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
publish(file, pat) {
|
|
50
|
-
try {
|
|
51
|
-
const query = { token: pat };
|
|
52
|
-
const url = this.getUrl('api/-/publish', query);
|
|
53
|
-
return this.postFile(file, url, {
|
|
54
|
-
'Content-Type': 'application/octet-stream'
|
|
55
|
-
}, this.maxPublishSize);
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
return Promise.reject(err);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
getMetadata(namespace, extension, target) {
|
|
62
|
-
try {
|
|
63
|
-
let path = `api/${encodeURIComponent(namespace)}/${encodeURIComponent(extension)}`;
|
|
64
|
-
if (target) {
|
|
65
|
-
path += `/${encodeURIComponent(target)}`;
|
|
66
|
-
}
|
|
67
|
-
return this.getJson(this.getUrl(path));
|
|
68
|
-
}
|
|
69
|
-
catch (err) {
|
|
70
|
-
return Promise.reject(err);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
download(file, url) {
|
|
74
|
-
return new Promise((resolve, reject) => {
|
|
75
|
-
const stream = fs.createWriteStream(file);
|
|
76
|
-
const requestOptions = this.getRequestOptions();
|
|
77
|
-
const request = this.getProtocol(url)
|
|
78
|
-
.request(url, requestOptions, response => {
|
|
79
|
-
response.on('end', () => {
|
|
80
|
-
if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode > 299)) {
|
|
81
|
-
reject(util_1.statusError(response));
|
|
82
|
-
}
|
|
83
|
-
else {
|
|
84
|
-
resolve();
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
response.pipe(stream);
|
|
88
|
-
});
|
|
89
|
-
stream.on('error', err => {
|
|
90
|
-
request.abort();
|
|
91
|
-
reject(err);
|
|
92
|
-
});
|
|
93
|
-
request.on('error', err => {
|
|
94
|
-
stream.close();
|
|
95
|
-
reject(err);
|
|
96
|
-
});
|
|
97
|
-
request.end();
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
getJson(url) {
|
|
101
|
-
return new Promise((resolve, reject) => {
|
|
102
|
-
const requestOptions = this.getRequestOptions();
|
|
103
|
-
const request = this.getProtocol(url)
|
|
104
|
-
.request(url, requestOptions, this.getJsonResponse(resolve, reject));
|
|
105
|
-
request.on('error', reject);
|
|
106
|
-
request.end();
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
post(content, url, headers, maxBodyLength) {
|
|
110
|
-
return new Promise((resolve, reject) => {
|
|
111
|
-
const requestOptions = this.getRequestOptions('POST', headers, maxBodyLength);
|
|
112
|
-
const request = this.getProtocol(url)
|
|
113
|
-
.request(url, requestOptions, this.getJsonResponse(resolve, reject));
|
|
114
|
-
request.on('error', reject);
|
|
115
|
-
request.write(content);
|
|
116
|
-
request.end();
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
postFile(file, url, headers, maxBodyLength) {
|
|
120
|
-
return new Promise((resolve, reject) => {
|
|
121
|
-
const stream = fs.createReadStream(file);
|
|
122
|
-
const requestOptions = this.getRequestOptions('POST', headers, maxBodyLength);
|
|
123
|
-
const request = this.getProtocol(url)
|
|
124
|
-
.request(url, requestOptions, this.getJsonResponse(resolve, reject));
|
|
125
|
-
stream.on('error', err => {
|
|
126
|
-
request.abort();
|
|
127
|
-
reject(err);
|
|
128
|
-
});
|
|
129
|
-
request.on('error', err => {
|
|
130
|
-
stream.close();
|
|
131
|
-
reject(err);
|
|
132
|
-
});
|
|
133
|
-
stream.on('open', () => stream.pipe(request));
|
|
134
|
-
});
|
|
135
|
-
}
|
|
136
|
-
getUrl(path, query) {
|
|
137
|
-
const url = new URL(this.url);
|
|
138
|
-
url.pathname += path;
|
|
139
|
-
if (query) {
|
|
140
|
-
url.search = querystring.stringify(query);
|
|
141
|
-
}
|
|
142
|
-
return url;
|
|
143
|
-
}
|
|
144
|
-
getProtocol(url) {
|
|
145
|
-
if (url.protocol === 'https:')
|
|
146
|
-
return followRedirects.https;
|
|
147
|
-
else
|
|
148
|
-
return followRedirects.http;
|
|
149
|
-
}
|
|
150
|
-
getRequestOptions(method, headers, maxBodyLength) {
|
|
151
|
-
if (this.username && this.password) {
|
|
152
|
-
if (!headers) {
|
|
153
|
-
headers = {};
|
|
154
|
-
}
|
|
155
|
-
const credentials = Buffer.from(this.username + ':' + this.password).toString('base64');
|
|
156
|
-
headers['Authorization'] = 'Basic ' + credentials;
|
|
157
|
-
}
|
|
158
|
-
return {
|
|
159
|
-
method,
|
|
160
|
-
headers,
|
|
161
|
-
maxBodyLength
|
|
162
|
-
};
|
|
163
|
-
}
|
|
164
|
-
getJsonResponse(resolve, reject) {
|
|
165
|
-
return response => {
|
|
166
|
-
response.setEncoding('UTF-8');
|
|
167
|
-
let json = '';
|
|
168
|
-
response.on('data', chunk => json += chunk);
|
|
169
|
-
response.on('end', () => {
|
|
170
|
-
if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode > 299)) {
|
|
171
|
-
if (json.startsWith('{')) {
|
|
172
|
-
try {
|
|
173
|
-
const parsed = JSON.parse(json);
|
|
174
|
-
const message = parsed.message || parsed.error;
|
|
175
|
-
if (message) {
|
|
176
|
-
reject(new Error(message));
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch (err) {
|
|
181
|
-
// Ignore the error and reject with response status
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
reject(util_1.statusError(response));
|
|
185
|
-
}
|
|
186
|
-
else if (json.startsWith('<!DOCTYPE html>')) {
|
|
187
|
-
reject(json);
|
|
188
|
-
}
|
|
189
|
-
else {
|
|
190
|
-
try {
|
|
191
|
-
resolve(JSON.parse(json));
|
|
192
|
-
}
|
|
193
|
-
catch (err) {
|
|
194
|
-
reject(err);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
exports.Registry = Registry;
|
|
1
|
+
"use strict";
|
|
2
|
+
/********************************************************************************
|
|
3
|
+
* Copyright (c) 2019 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
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
10
|
+
********************************************************************************/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const fs = require("fs");
|
|
13
|
+
const querystring = require("querystring");
|
|
14
|
+
const followRedirects = require("follow-redirects");
|
|
15
|
+
const util_1 = require("./util");
|
|
16
|
+
exports.DEFAULT_URL = 'https://open-vsx.org';
|
|
17
|
+
exports.DEFAULT_NAMESPACE_SIZE = 1024;
|
|
18
|
+
exports.DEFAULT_PUBLISH_SIZE = 512 * 1024 * 1024;
|
|
19
|
+
class Registry {
|
|
20
|
+
constructor(options = {}) {
|
|
21
|
+
if (options.registryUrl && options.registryUrl.endsWith('/'))
|
|
22
|
+
this.url = options.registryUrl.substring(0, options.registryUrl.length - 1);
|
|
23
|
+
else if (options.registryUrl)
|
|
24
|
+
this.url = options.registryUrl;
|
|
25
|
+
else
|
|
26
|
+
this.url = exports.DEFAULT_URL;
|
|
27
|
+
this.maxNamespaceSize = options.maxNamespaceSize || exports.DEFAULT_NAMESPACE_SIZE;
|
|
28
|
+
this.maxPublishSize = options.maxPublishSize || exports.DEFAULT_PUBLISH_SIZE;
|
|
29
|
+
this.username = options.username;
|
|
30
|
+
this.password = options.password;
|
|
31
|
+
}
|
|
32
|
+
get requiresLicense() {
|
|
33
|
+
const url = new URL(this.url);
|
|
34
|
+
return url.hostname === 'open-vsx.org' || url.hostname.endsWith('.open-vsx.org');
|
|
35
|
+
}
|
|
36
|
+
createNamespace(name, pat) {
|
|
37
|
+
try {
|
|
38
|
+
const query = { token: pat };
|
|
39
|
+
const url = this.getUrl('api/-/namespace/create', query);
|
|
40
|
+
const namespace = { name };
|
|
41
|
+
return this.post(JSON.stringify(namespace), url, {
|
|
42
|
+
'Content-Type': 'application/json'
|
|
43
|
+
}, this.maxNamespaceSize);
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
return Promise.reject(err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
publish(file, pat) {
|
|
50
|
+
try {
|
|
51
|
+
const query = { token: pat };
|
|
52
|
+
const url = this.getUrl('api/-/publish', query);
|
|
53
|
+
return this.postFile(file, url, {
|
|
54
|
+
'Content-Type': 'application/octet-stream'
|
|
55
|
+
}, this.maxPublishSize);
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
return Promise.reject(err);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
getMetadata(namespace, extension, target) {
|
|
62
|
+
try {
|
|
63
|
+
let path = `api/${encodeURIComponent(namespace)}/${encodeURIComponent(extension)}`;
|
|
64
|
+
if (target) {
|
|
65
|
+
path += `/${encodeURIComponent(target)}`;
|
|
66
|
+
}
|
|
67
|
+
return this.getJson(this.getUrl(path));
|
|
68
|
+
}
|
|
69
|
+
catch (err) {
|
|
70
|
+
return Promise.reject(err);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
download(file, url) {
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const stream = fs.createWriteStream(file);
|
|
76
|
+
const requestOptions = this.getRequestOptions();
|
|
77
|
+
const request = this.getProtocol(url)
|
|
78
|
+
.request(url, requestOptions, response => {
|
|
79
|
+
response.on('end', () => {
|
|
80
|
+
if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode > 299)) {
|
|
81
|
+
reject(util_1.statusError(response));
|
|
82
|
+
}
|
|
83
|
+
else {
|
|
84
|
+
resolve();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
response.pipe(stream);
|
|
88
|
+
});
|
|
89
|
+
stream.on('error', err => {
|
|
90
|
+
request.abort();
|
|
91
|
+
reject(err);
|
|
92
|
+
});
|
|
93
|
+
request.on('error', err => {
|
|
94
|
+
stream.close();
|
|
95
|
+
reject(err);
|
|
96
|
+
});
|
|
97
|
+
request.end();
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
getJson(url) {
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
const requestOptions = this.getRequestOptions();
|
|
103
|
+
const request = this.getProtocol(url)
|
|
104
|
+
.request(url, requestOptions, this.getJsonResponse(resolve, reject));
|
|
105
|
+
request.on('error', reject);
|
|
106
|
+
request.end();
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
post(content, url, headers, maxBodyLength) {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
const requestOptions = this.getRequestOptions('POST', headers, maxBodyLength);
|
|
112
|
+
const request = this.getProtocol(url)
|
|
113
|
+
.request(url, requestOptions, this.getJsonResponse(resolve, reject));
|
|
114
|
+
request.on('error', reject);
|
|
115
|
+
request.write(content);
|
|
116
|
+
request.end();
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
postFile(file, url, headers, maxBodyLength) {
|
|
120
|
+
return new Promise((resolve, reject) => {
|
|
121
|
+
const stream = fs.createReadStream(file);
|
|
122
|
+
const requestOptions = this.getRequestOptions('POST', headers, maxBodyLength);
|
|
123
|
+
const request = this.getProtocol(url)
|
|
124
|
+
.request(url, requestOptions, this.getJsonResponse(resolve, reject));
|
|
125
|
+
stream.on('error', err => {
|
|
126
|
+
request.abort();
|
|
127
|
+
reject(err);
|
|
128
|
+
});
|
|
129
|
+
request.on('error', err => {
|
|
130
|
+
stream.close();
|
|
131
|
+
reject(err);
|
|
132
|
+
});
|
|
133
|
+
stream.on('open', () => stream.pipe(request));
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
getUrl(path, query) {
|
|
137
|
+
const url = new URL(this.url);
|
|
138
|
+
url.pathname += path;
|
|
139
|
+
if (query) {
|
|
140
|
+
url.search = querystring.stringify(query);
|
|
141
|
+
}
|
|
142
|
+
return url;
|
|
143
|
+
}
|
|
144
|
+
getProtocol(url) {
|
|
145
|
+
if (url.protocol === 'https:')
|
|
146
|
+
return followRedirects.https;
|
|
147
|
+
else
|
|
148
|
+
return followRedirects.http;
|
|
149
|
+
}
|
|
150
|
+
getRequestOptions(method, headers, maxBodyLength) {
|
|
151
|
+
if (this.username && this.password) {
|
|
152
|
+
if (!headers) {
|
|
153
|
+
headers = {};
|
|
154
|
+
}
|
|
155
|
+
const credentials = Buffer.from(this.username + ':' + this.password).toString('base64');
|
|
156
|
+
headers['Authorization'] = 'Basic ' + credentials;
|
|
157
|
+
}
|
|
158
|
+
return {
|
|
159
|
+
method,
|
|
160
|
+
headers,
|
|
161
|
+
maxBodyLength
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
getJsonResponse(resolve, reject) {
|
|
165
|
+
return response => {
|
|
166
|
+
response.setEncoding('UTF-8');
|
|
167
|
+
let json = '';
|
|
168
|
+
response.on('data', chunk => json += chunk);
|
|
169
|
+
response.on('end', () => {
|
|
170
|
+
if (response.statusCode !== undefined && (response.statusCode < 200 || response.statusCode > 299)) {
|
|
171
|
+
if (json.startsWith('{')) {
|
|
172
|
+
try {
|
|
173
|
+
const parsed = JSON.parse(json);
|
|
174
|
+
const message = parsed.message || parsed.error;
|
|
175
|
+
if (message) {
|
|
176
|
+
reject(new Error(message));
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
catch (err) {
|
|
181
|
+
// Ignore the error and reject with response status
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
reject(util_1.statusError(response));
|
|
185
|
+
}
|
|
186
|
+
else if (json.startsWith('<!DOCTYPE html>')) {
|
|
187
|
+
reject(json);
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
try {
|
|
191
|
+
resolve(JSON.parse(json));
|
|
192
|
+
}
|
|
193
|
+
catch (err) {
|
|
194
|
+
reject(err);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
exports.Registry = Registry;
|
|
202
202
|
//# sourceMappingURL=registry.js.map
|
package/lib/util.d.ts
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019 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
|
-
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
-
********************************************************************************/
|
|
10
|
-
/// <reference types="node" />
|
|
11
|
-
import * as fs from 'fs';
|
|
12
|
-
import * as tmp from 'tmp';
|
|
13
|
-
import * as http from 'http';
|
|
14
|
-
import { RegistryOptions } from './registry';
|
|
15
|
-
export { promisify } from 'util';
|
|
16
|
-
export declare function addEnvOptions(options: RegistryOptions): void;
|
|
17
|
-
export declare function matchExtensionId(id: string): RegExpExecArray | null;
|
|
18
|
-
export declare function optionalStat(path: fs.PathLike): Promise<fs.Stats | undefined>;
|
|
19
|
-
export declare function makeDirs(path: fs.PathLike): Promise<void>;
|
|
20
|
-
export declare function createTempFile(options: tmp.TmpNameOptions): Promise<string>;
|
|
21
|
-
export declare function handleError(debug?: boolean, additionalMessage?: string): (reason: any) => void;
|
|
22
|
-
export declare function statusError(response: http.IncomingMessage): Error;
|
|
23
|
-
export declare function readFile(name: string, packagePath?: string, encoding?: string): Promise<string>;
|
|
24
|
-
export declare function readManifest(packagePath?: string): Promise<Manifest>;
|
|
25
|
-
export declare function validateManifest(manifest: Manifest): void;
|
|
26
|
-
export declare function writeFile(name: string, content: string, packagePath?: string, encoding?: string): Promise<void>;
|
|
27
|
-
export declare function writeManifest(manifest: Manifest, packagePath?: string): Promise<void>;
|
|
28
|
-
export interface Manifest {
|
|
29
|
-
publisher: string;
|
|
30
|
-
name: string;
|
|
31
|
-
version: string;
|
|
32
|
-
license?: string;
|
|
33
|
-
}
|
|
34
|
-
export declare function getUserInput(text: string): Promise<string>;
|
|
35
|
-
export declare function getUserChoice<R extends string>(text: string, values: R[], defaultValue: R, lowerCase?: boolean): Promise<R>;
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2019 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
|
+
* SPDX-License-Identifier: EPL-2.0
|
|
9
|
+
********************************************************************************/
|
|
10
|
+
/// <reference types="node" />
|
|
11
|
+
import * as fs from 'fs';
|
|
12
|
+
import * as tmp from 'tmp';
|
|
13
|
+
import * as http from 'http';
|
|
14
|
+
import { RegistryOptions } from './registry';
|
|
15
|
+
export { promisify } from 'util';
|
|
16
|
+
export declare function addEnvOptions(options: RegistryOptions): void;
|
|
17
|
+
export declare function matchExtensionId(id: string): RegExpExecArray | null;
|
|
18
|
+
export declare function optionalStat(path: fs.PathLike): Promise<fs.Stats | undefined>;
|
|
19
|
+
export declare function makeDirs(path: fs.PathLike): Promise<void>;
|
|
20
|
+
export declare function createTempFile(options: tmp.TmpNameOptions): Promise<string>;
|
|
21
|
+
export declare function handleError(debug?: boolean, additionalMessage?: string): (reason: any) => void;
|
|
22
|
+
export declare function statusError(response: http.IncomingMessage): Error;
|
|
23
|
+
export declare function readFile(name: string, packagePath?: string, encoding?: string): Promise<string>;
|
|
24
|
+
export declare function readManifest(packagePath?: string): Promise<Manifest>;
|
|
25
|
+
export declare function validateManifest(manifest: Manifest): void;
|
|
26
|
+
export declare function writeFile(name: string, content: string, packagePath?: string, encoding?: string): Promise<void>;
|
|
27
|
+
export declare function writeManifest(manifest: Manifest, packagePath?: string): Promise<void>;
|
|
28
|
+
export interface Manifest {
|
|
29
|
+
publisher: string;
|
|
30
|
+
name: string;
|
|
31
|
+
version: string;
|
|
32
|
+
license?: string;
|
|
33
|
+
}
|
|
34
|
+
export declare function getUserInput(text: string): Promise<string>;
|
|
35
|
+
export declare function getUserChoice<R extends string>(text: string, values: R[], defaultValue: R, lowerCase?: boolean): Promise<R>;
|
|
36
36
|
//# sourceMappingURL=util.d.ts.map
|