@vscode/vsce 2.15.0
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 +18 -0
- package/README.md +105 -0
- package/ThirdPartyNotices.txt +292 -0
- package/out/api.d.ts +59 -0
- package/out/api.js +48 -0
- package/out/main.js +229 -0
- package/out/manifest.js +3 -0
- package/out/nls.js +22 -0
- package/out/npm.js +190 -0
- package/out/package.js +1326 -0
- package/out/publicgalleryapi.js +39 -0
- package/out/publish.js +186 -0
- package/out/search.js +65 -0
- package/out/show.js +71 -0
- package/out/store.js +225 -0
- package/out/util.js +165 -0
- package/out/validation.js +120 -0
- package/out/viewutils.js +73 -0
- package/out/xml.js +11 -0
- package/out/zip.js +57 -0
- package/package.json +99 -0
- package/vsce +2 -0
package/out/util.js
ADDED
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.patchOptionsWithManifest = exports.log = exports.sequence = exports.CancellationToken = exports.isCancelledError = exports.nonnull = exports.flatten = exports.chain = exports.normalize = exports.getPublicGalleryAPI = exports.getSecurityRolesAPI = exports.getGalleryAPI = exports.getHubUrl = exports.getPublishedUrl = exports.read = void 0;
|
|
7
|
+
const util_1 = require("util");
|
|
8
|
+
const read_1 = __importDefault(require("read"));
|
|
9
|
+
const WebApi_1 = require("azure-devops-node-api/WebApi");
|
|
10
|
+
const GalleryApi_1 = require("azure-devops-node-api/GalleryApi");
|
|
11
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
12
|
+
const publicgalleryapi_1 = require("./publicgalleryapi");
|
|
13
|
+
const os_1 = require("os");
|
|
14
|
+
const __read = (0, util_1.promisify)(read_1.default);
|
|
15
|
+
function read(prompt, options = {}) {
|
|
16
|
+
if (process.env['VSCE_TESTS'] || !process.stdout.isTTY) {
|
|
17
|
+
return Promise.resolve('y');
|
|
18
|
+
}
|
|
19
|
+
return __read({ prompt, ...options });
|
|
20
|
+
}
|
|
21
|
+
exports.read = read;
|
|
22
|
+
const marketplaceUrl = process.env['VSCE_MARKETPLACE_URL'] || 'https://marketplace.visualstudio.com';
|
|
23
|
+
function getPublishedUrl(extension) {
|
|
24
|
+
return `${marketplaceUrl}/items?itemName=${extension}`;
|
|
25
|
+
}
|
|
26
|
+
exports.getPublishedUrl = getPublishedUrl;
|
|
27
|
+
function getHubUrl(publisher, name) {
|
|
28
|
+
return `${marketplaceUrl}/manage/publishers/${publisher}/extensions/${name}/hub`;
|
|
29
|
+
}
|
|
30
|
+
exports.getHubUrl = getHubUrl;
|
|
31
|
+
async function getGalleryAPI(pat) {
|
|
32
|
+
// from https://github.com/Microsoft/tfs-cli/blob/master/app/exec/extension/default.ts#L287-L292
|
|
33
|
+
const authHandler = (0, WebApi_1.getBasicHandler)('OAuth', pat);
|
|
34
|
+
return new GalleryApi_1.GalleryApi(marketplaceUrl, [authHandler]);
|
|
35
|
+
// const vsoapi = new WebApi(marketplaceUrl, authHandler);
|
|
36
|
+
// return await vsoapi.getGalleryApi();
|
|
37
|
+
}
|
|
38
|
+
exports.getGalleryAPI = getGalleryAPI;
|
|
39
|
+
async function getSecurityRolesAPI(pat) {
|
|
40
|
+
const authHandler = (0, WebApi_1.getBasicHandler)('OAuth', pat);
|
|
41
|
+
const vsoapi = new WebApi_1.WebApi(marketplaceUrl, authHandler);
|
|
42
|
+
return await vsoapi.getSecurityRolesApi();
|
|
43
|
+
}
|
|
44
|
+
exports.getSecurityRolesAPI = getSecurityRolesAPI;
|
|
45
|
+
function getPublicGalleryAPI() {
|
|
46
|
+
return new publicgalleryapi_1.PublicGalleryAPI(marketplaceUrl, '3.0-preview.1');
|
|
47
|
+
}
|
|
48
|
+
exports.getPublicGalleryAPI = getPublicGalleryAPI;
|
|
49
|
+
function normalize(path) {
|
|
50
|
+
return path.replace(/\\/g, '/');
|
|
51
|
+
}
|
|
52
|
+
exports.normalize = normalize;
|
|
53
|
+
function chain2(a, b, fn, index = 0) {
|
|
54
|
+
if (index >= b.length) {
|
|
55
|
+
return Promise.resolve(a);
|
|
56
|
+
}
|
|
57
|
+
return fn(a, b[index]).then(a => chain2(a, b, fn, index + 1));
|
|
58
|
+
}
|
|
59
|
+
function chain(initial, processors, process) {
|
|
60
|
+
return chain2(initial, processors, process);
|
|
61
|
+
}
|
|
62
|
+
exports.chain = chain;
|
|
63
|
+
function flatten(arr) {
|
|
64
|
+
return [].concat.apply([], arr);
|
|
65
|
+
}
|
|
66
|
+
exports.flatten = flatten;
|
|
67
|
+
function nonnull(arg) {
|
|
68
|
+
return !!arg;
|
|
69
|
+
}
|
|
70
|
+
exports.nonnull = nonnull;
|
|
71
|
+
const CancelledError = 'Cancelled';
|
|
72
|
+
function isCancelledError(error) {
|
|
73
|
+
return error === CancelledError;
|
|
74
|
+
}
|
|
75
|
+
exports.isCancelledError = isCancelledError;
|
|
76
|
+
class CancellationToken {
|
|
77
|
+
constructor() {
|
|
78
|
+
this.listeners = [];
|
|
79
|
+
this._cancelled = false;
|
|
80
|
+
}
|
|
81
|
+
get isCancelled() {
|
|
82
|
+
return this._cancelled;
|
|
83
|
+
}
|
|
84
|
+
subscribe(fn) {
|
|
85
|
+
this.listeners.push(fn);
|
|
86
|
+
return () => {
|
|
87
|
+
const index = this.listeners.indexOf(fn);
|
|
88
|
+
if (index > -1) {
|
|
89
|
+
this.listeners.splice(index, 1);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
cancel() {
|
|
94
|
+
const emit = !this._cancelled;
|
|
95
|
+
this._cancelled = true;
|
|
96
|
+
if (emit) {
|
|
97
|
+
this.listeners.forEach(l => l(CancelledError));
|
|
98
|
+
this.listeners = [];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.CancellationToken = CancellationToken;
|
|
103
|
+
async function sequence(promiseFactories) {
|
|
104
|
+
for (const factory of promiseFactories) {
|
|
105
|
+
await factory();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.sequence = sequence;
|
|
109
|
+
var LogMessageType;
|
|
110
|
+
(function (LogMessageType) {
|
|
111
|
+
LogMessageType[LogMessageType["DONE"] = 0] = "DONE";
|
|
112
|
+
LogMessageType[LogMessageType["INFO"] = 1] = "INFO";
|
|
113
|
+
LogMessageType[LogMessageType["WARNING"] = 2] = "WARNING";
|
|
114
|
+
LogMessageType[LogMessageType["ERROR"] = 3] = "ERROR";
|
|
115
|
+
})(LogMessageType || (LogMessageType = {}));
|
|
116
|
+
const LogPrefix = {
|
|
117
|
+
[LogMessageType.DONE]: chalk_1.default.bgGreen.black(' DONE '),
|
|
118
|
+
[LogMessageType.INFO]: chalk_1.default.bgBlueBright.black(' INFO '),
|
|
119
|
+
[LogMessageType.WARNING]: chalk_1.default.bgYellow.black(' WARNING '),
|
|
120
|
+
[LogMessageType.ERROR]: chalk_1.default.bgRed.black(' ERROR '),
|
|
121
|
+
};
|
|
122
|
+
function _log(type, msg, ...args) {
|
|
123
|
+
args = [LogPrefix[type], msg, ...args];
|
|
124
|
+
if (type === LogMessageType.WARNING) {
|
|
125
|
+
process.env['GITHUB_ACTIONS'] ? logToGitHubActions('warning', msg) : console.warn(...args);
|
|
126
|
+
}
|
|
127
|
+
else if (type === LogMessageType.ERROR) {
|
|
128
|
+
process.env['GITHUB_ACTIONS'] ? logToGitHubActions('error', msg) : console.error(...args);
|
|
129
|
+
}
|
|
130
|
+
else {
|
|
131
|
+
process.env['GITHUB_ACTIONS'] ? logToGitHubActions('info', msg) : console.log(...args);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const EscapeCharacters = new Map([
|
|
135
|
+
['%', '%25'],
|
|
136
|
+
['\r', '%0D'],
|
|
137
|
+
['\n', '%0A'],
|
|
138
|
+
]);
|
|
139
|
+
const EscapeRegex = new RegExp(`[${[...EscapeCharacters.keys()].join('')}]`, 'g');
|
|
140
|
+
function escapeGitHubActionsMessage(message) {
|
|
141
|
+
return message.replace(EscapeRegex, c => EscapeCharacters.get(c) ?? c);
|
|
142
|
+
}
|
|
143
|
+
function logToGitHubActions(type, message) {
|
|
144
|
+
const command = type === 'info' ? message : `::${type}::${escapeGitHubActionsMessage(message)}`;
|
|
145
|
+
process.stdout.write(command + os_1.EOL);
|
|
146
|
+
}
|
|
147
|
+
exports.log = {
|
|
148
|
+
done: _log.bind(null, LogMessageType.DONE),
|
|
149
|
+
info: _log.bind(null, LogMessageType.INFO),
|
|
150
|
+
warn: _log.bind(null, LogMessageType.WARNING),
|
|
151
|
+
error: _log.bind(null, LogMessageType.ERROR),
|
|
152
|
+
};
|
|
153
|
+
function patchOptionsWithManifest(options, manifest) {
|
|
154
|
+
if (!manifest.vsce) {
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
for (const key of Object.keys(manifest.vsce)) {
|
|
158
|
+
const optionsKey = key === 'yarn' ? 'useYarn' : key;
|
|
159
|
+
if (options[optionsKey] === undefined) {
|
|
160
|
+
options[optionsKey] = manifest.vsce[key];
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
exports.patchOptionsWithManifest = patchOptionsWithManifest;
|
|
165
|
+
//# sourceMappingURL=util.js.map
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
|
+
};
|
|
24
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
+
exports.validateVSCodeTypesCompatibility = exports.validateEngineCompatibility = exports.validateVersion = exports.validateExtensionName = exports.validatePublisher = void 0;
|
|
26
|
+
const semver = __importStar(require("semver"));
|
|
27
|
+
const parse_semver_1 = __importDefault(require("parse-semver"));
|
|
28
|
+
const nameRegex = /^[a-z0-9][a-z0-9\-]*$/i;
|
|
29
|
+
function validatePublisher(publisher) {
|
|
30
|
+
if (!publisher) {
|
|
31
|
+
throw new Error(`Missing publisher name. Learn more: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#publishing-extensions`);
|
|
32
|
+
}
|
|
33
|
+
if (!nameRegex.test(publisher)) {
|
|
34
|
+
throw new Error(`Invalid publisher name '${publisher}'. Expected the identifier of a publisher, not its human-friendly name. Learn more: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#publishing-extensions`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.validatePublisher = validatePublisher;
|
|
38
|
+
function validateExtensionName(name) {
|
|
39
|
+
if (!name) {
|
|
40
|
+
throw new Error(`Missing extension name`);
|
|
41
|
+
}
|
|
42
|
+
if (!nameRegex.test(name)) {
|
|
43
|
+
throw new Error(`Invalid extension name '${name}'`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.validateExtensionName = validateExtensionName;
|
|
47
|
+
function validateVersion(version) {
|
|
48
|
+
if (!version) {
|
|
49
|
+
throw new Error(`Missing extension version`);
|
|
50
|
+
}
|
|
51
|
+
if (!semver.valid(version)) {
|
|
52
|
+
throw new Error(`Invalid extension version '${version}'`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
exports.validateVersion = validateVersion;
|
|
56
|
+
function validateEngineCompatibility(version) {
|
|
57
|
+
if (!version) {
|
|
58
|
+
throw new Error(`Missing vscode engine compatibility version`);
|
|
59
|
+
}
|
|
60
|
+
if (!/^\*$|^(\^|>=)?((\d+)|x)\.((\d+)|x)\.((\d+)|x)(\-.*)?$/.test(version)) {
|
|
61
|
+
throw new Error(`Invalid vscode engine compatibility version '${version}'`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.validateEngineCompatibility = validateEngineCompatibility;
|
|
65
|
+
/**
|
|
66
|
+
* User shouldn't use a newer version of @types/vscode than the one specified in engines.vscode
|
|
67
|
+
*
|
|
68
|
+
* NOTE: This is enforced at the major and minor level. Since we don't have control over the patch
|
|
69
|
+
* version (it's auto-incremented by DefinitelyTyped), we don't look at the patch version at all.
|
|
70
|
+
*/
|
|
71
|
+
function validateVSCodeTypesCompatibility(engineVersion, typeVersion) {
|
|
72
|
+
if (engineVersion === '*') {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (!typeVersion) {
|
|
76
|
+
throw new Error(`Missing @types/vscode version`);
|
|
77
|
+
}
|
|
78
|
+
let plainEngineVersion, plainTypeVersion;
|
|
79
|
+
try {
|
|
80
|
+
const engineSemver = (0, parse_semver_1.default)(`vscode@${engineVersion}`);
|
|
81
|
+
plainEngineVersion = engineSemver.version;
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
throw new Error('Failed to parse semver of engines.vscode');
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const typeSemver = (0, parse_semver_1.default)(`@types/vscode@${typeVersion}`);
|
|
88
|
+
plainTypeVersion = typeSemver.version;
|
|
89
|
+
}
|
|
90
|
+
catch (err) {
|
|
91
|
+
throw new Error('Failed to parse semver of @types/vscode');
|
|
92
|
+
}
|
|
93
|
+
// For all `x`, use smallest version for comparison
|
|
94
|
+
plainEngineVersion = plainEngineVersion.replace(/x/g, '0');
|
|
95
|
+
const [typeMajor, typeMinor] = plainTypeVersion.split('.').map(x => {
|
|
96
|
+
try {
|
|
97
|
+
return parseInt(x);
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
const [engineMajor, engineMinor] = plainEngineVersion.split('.').map(x => {
|
|
104
|
+
try {
|
|
105
|
+
return parseInt(x);
|
|
106
|
+
}
|
|
107
|
+
catch (err) {
|
|
108
|
+
return 0;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
const error = new Error(`@types/vscode ${typeVersion} greater than engines.vscode ${engineVersion}. Consider upgrade engines.vscode or use an older @types/vscode version`);
|
|
112
|
+
if (typeMajor > engineMajor) {
|
|
113
|
+
throw error;
|
|
114
|
+
}
|
|
115
|
+
if (typeMajor === engineMajor && typeMinor > engineMinor) {
|
|
116
|
+
throw error;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
exports.validateVSCodeTypesCompatibility = validateVSCodeTypesCompatibility;
|
|
120
|
+
//# sourceMappingURL=validation.js.map
|
package/out/viewutils.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wordTrim = exports.indentRow = exports.wordWrap = exports.tableView = exports.ratingStars = exports.repeatString = exports.formatDateTime = exports.formatTime = exports.formatDate = exports.icons = void 0;
|
|
4
|
+
const fixedLocale = 'en-us';
|
|
5
|
+
const format = {
|
|
6
|
+
date: { month: 'long', day: 'numeric', year: 'numeric' },
|
|
7
|
+
time: { hour: 'numeric', minute: 'numeric', second: 'numeric' },
|
|
8
|
+
};
|
|
9
|
+
const columns = process.stdout.columns ? process.stdout.columns : 80;
|
|
10
|
+
// xxx: Windows cmd + powershell standard fonts currently don't support the full
|
|
11
|
+
// unicode charset. For now we use fallback icons when on windows.
|
|
12
|
+
const useFallbackIcons = process.platform === 'win32';
|
|
13
|
+
exports.icons = useFallbackIcons
|
|
14
|
+
? { download: '\u{2193}', star: '\u{2665}', emptyStar: '\u{2022}' }
|
|
15
|
+
: { download: '\u{2913}', star: '\u{2605}', emptyStar: '\u{2606}' };
|
|
16
|
+
function formatDate(date) {
|
|
17
|
+
return date.toLocaleString(fixedLocale, format.date);
|
|
18
|
+
}
|
|
19
|
+
exports.formatDate = formatDate;
|
|
20
|
+
function formatTime(date) {
|
|
21
|
+
return date.toLocaleString(fixedLocale, format.time);
|
|
22
|
+
}
|
|
23
|
+
exports.formatTime = formatTime;
|
|
24
|
+
function formatDateTime(date) {
|
|
25
|
+
return date.toLocaleString(fixedLocale, { ...format.date, ...format.time });
|
|
26
|
+
}
|
|
27
|
+
exports.formatDateTime = formatDateTime;
|
|
28
|
+
function repeatString(text, count) {
|
|
29
|
+
let result = '';
|
|
30
|
+
for (let i = 0; i < count; i++) {
|
|
31
|
+
result += text;
|
|
32
|
+
}
|
|
33
|
+
return result;
|
|
34
|
+
}
|
|
35
|
+
exports.repeatString = repeatString;
|
|
36
|
+
function ratingStars(rating, total = 5) {
|
|
37
|
+
const c = Math.min(Math.round(rating), total);
|
|
38
|
+
return `${repeatString(exports.icons.star + ' ', c)}${repeatString(exports.icons.emptyStar + ' ', total - c)}`;
|
|
39
|
+
}
|
|
40
|
+
exports.ratingStars = ratingStars;
|
|
41
|
+
function tableView(table, spacing = 2) {
|
|
42
|
+
const maxLen = {};
|
|
43
|
+
table.forEach(row => row.forEach((cell, i) => (maxLen[i] = Math.max(maxLen[i] || 0, cell.length))));
|
|
44
|
+
return table.map(row => row.map((cell, i) => `${cell}${repeatString(' ', maxLen[i] - cell.length + spacing)}`).join(''));
|
|
45
|
+
}
|
|
46
|
+
exports.tableView = tableView;
|
|
47
|
+
function wordWrap(text, width = columns) {
|
|
48
|
+
const [indent = ''] = text.match(/^\s+/) || [];
|
|
49
|
+
const maxWidth = width - indent.length;
|
|
50
|
+
return text
|
|
51
|
+
.replace(/^\s+/, '')
|
|
52
|
+
.split('')
|
|
53
|
+
.reduce(([out, buffer, pos], ch) => {
|
|
54
|
+
const nl = pos === maxWidth ? `\n${indent}` : '';
|
|
55
|
+
const newPos = nl ? 0 : +pos + 1;
|
|
56
|
+
return / |-|,|\./.test(ch) ? [`${out}${buffer}${ch}${nl}`, '', newPos] : [`${out}${nl}`, buffer + ch, newPos];
|
|
57
|
+
}, [indent, '', 0])
|
|
58
|
+
.slice(0, 2)
|
|
59
|
+
.join('');
|
|
60
|
+
}
|
|
61
|
+
exports.wordWrap = wordWrap;
|
|
62
|
+
function indentRow(row) {
|
|
63
|
+
return ` ${row}`;
|
|
64
|
+
}
|
|
65
|
+
exports.indentRow = indentRow;
|
|
66
|
+
function wordTrim(text, width = columns, indicator = '...') {
|
|
67
|
+
if (text.length > width) {
|
|
68
|
+
return text.substr(0, width - indicator.length) + indicator;
|
|
69
|
+
}
|
|
70
|
+
return text;
|
|
71
|
+
}
|
|
72
|
+
exports.wordTrim = wordTrim;
|
|
73
|
+
//# sourceMappingURL=viewutils.js.map
|
package/out/xml.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseContentTypes = exports.parseXmlManifest = void 0;
|
|
4
|
+
const util_1 = require("util");
|
|
5
|
+
const xml2js_1 = require("xml2js");
|
|
6
|
+
function createXMLParser() {
|
|
7
|
+
return (0, util_1.promisify)(xml2js_1.parseString);
|
|
8
|
+
}
|
|
9
|
+
exports.parseXmlManifest = createXMLParser();
|
|
10
|
+
exports.parseContentTypes = createXMLParser();
|
|
11
|
+
//# sourceMappingURL=xml.js.map
|
package/out/zip.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readVSIXPackage = exports.readZip = void 0;
|
|
4
|
+
const yauzl_1 = require("yauzl");
|
|
5
|
+
const xml_1 = require("./xml");
|
|
6
|
+
async function bufferStream(stream) {
|
|
7
|
+
return await new Promise((c, e) => {
|
|
8
|
+
const buffers = [];
|
|
9
|
+
stream.on('data', buffer => buffers.push(buffer));
|
|
10
|
+
stream.once('error', e);
|
|
11
|
+
stream.once('end', () => c(Buffer.concat(buffers)));
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
async function readZip(packagePath, filter) {
|
|
15
|
+
const zipfile = await new Promise((c, e) => (0, yauzl_1.open)(packagePath, { lazyEntries: true }, (err, zipfile) => (err ? e(err) : c(zipfile))));
|
|
16
|
+
return await new Promise((c, e) => {
|
|
17
|
+
const result = new Map();
|
|
18
|
+
zipfile.once('close', () => c(result));
|
|
19
|
+
zipfile.readEntry();
|
|
20
|
+
zipfile.on('entry', (entry) => {
|
|
21
|
+
const name = entry.fileName.toLowerCase();
|
|
22
|
+
if (filter(name)) {
|
|
23
|
+
zipfile.openReadStream(entry, (err, stream) => {
|
|
24
|
+
if (err) {
|
|
25
|
+
zipfile.close();
|
|
26
|
+
return e(err);
|
|
27
|
+
}
|
|
28
|
+
bufferStream(stream).then(buffer => {
|
|
29
|
+
result.set(name, buffer);
|
|
30
|
+
zipfile.readEntry();
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
zipfile.readEntry();
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.readZip = readZip;
|
|
41
|
+
async function readVSIXPackage(packagePath) {
|
|
42
|
+
const map = await readZip(packagePath, name => /^extension\/package\.json$|^extension\.vsixmanifest$/i.test(name));
|
|
43
|
+
const rawManifest = map.get('extension/package.json');
|
|
44
|
+
if (!rawManifest) {
|
|
45
|
+
throw new Error('Manifest not found');
|
|
46
|
+
}
|
|
47
|
+
const rawXmlManifest = map.get('extension.vsixmanifest');
|
|
48
|
+
if (!rawXmlManifest) {
|
|
49
|
+
throw new Error('VSIX manifest not found');
|
|
50
|
+
}
|
|
51
|
+
return {
|
|
52
|
+
manifest: JSON.parse(rawManifest.toString('utf8')),
|
|
53
|
+
xmlManifest: await (0, xml_1.parseXmlManifest)(rawXmlManifest.toString('utf8')),
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
exports.readVSIXPackage = readVSIXPackage;
|
|
57
|
+
//# sourceMappingURL=zip.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vscode/vsce",
|
|
3
|
+
"version": "2.15.0",
|
|
4
|
+
"description": "VSCode Extension Manager",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Microsoft/vsce"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://code.visualstudio.com",
|
|
10
|
+
"bugs": "https://github.com/Microsoft/vsce/issues",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"vscode",
|
|
13
|
+
"vsce",
|
|
14
|
+
"extension"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"contributors": [
|
|
20
|
+
"Microsoft Corporation"
|
|
21
|
+
],
|
|
22
|
+
"author": "Microsoft Corporation",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"main": "out/api.js",
|
|
25
|
+
"typings": "out/api.d.ts",
|
|
26
|
+
"bin": {
|
|
27
|
+
"vsce": "vsce"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"compile": "tsc",
|
|
31
|
+
"build": "tsc",
|
|
32
|
+
"watch:build": "npm run compile -- --watch",
|
|
33
|
+
"test": "mocha",
|
|
34
|
+
"watch:test": "npm run test -- --watch",
|
|
35
|
+
"prepare": "husky install"
|
|
36
|
+
},
|
|
37
|
+
"engines": {
|
|
38
|
+
"node": ">= 14"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"azure-devops-node-api": "^11.0.1",
|
|
42
|
+
"chalk": "^2.4.2",
|
|
43
|
+
"cheerio": "^1.0.0-rc.9",
|
|
44
|
+
"commander": "^6.1.0",
|
|
45
|
+
"glob": "^7.0.6",
|
|
46
|
+
"hosted-git-info": "^4.0.2",
|
|
47
|
+
"keytar": "^7.7.0",
|
|
48
|
+
"leven": "^3.1.0",
|
|
49
|
+
"markdown-it": "^12.3.2",
|
|
50
|
+
"mime": "^1.3.4",
|
|
51
|
+
"minimatch": "^3.0.3",
|
|
52
|
+
"parse-semver": "^1.1.1",
|
|
53
|
+
"read": "^1.0.7",
|
|
54
|
+
"semver": "^5.1.0",
|
|
55
|
+
"tmp": "^0.2.1",
|
|
56
|
+
"typed-rest-client": "^1.8.4",
|
|
57
|
+
"url-join": "^4.0.1",
|
|
58
|
+
"xml2js": "^0.4.23",
|
|
59
|
+
"yauzl": "^2.3.1",
|
|
60
|
+
"yazl": "^2.2.2"
|
|
61
|
+
},
|
|
62
|
+
"devDependencies": {
|
|
63
|
+
"@types/cheerio": "^0.22.29",
|
|
64
|
+
"@types/glob": "^7.1.1",
|
|
65
|
+
"@types/hosted-git-info": "^3.0.2",
|
|
66
|
+
"@types/markdown-it": "^0.0.2",
|
|
67
|
+
"@types/mime": "^1",
|
|
68
|
+
"@types/minimatch": "^3.0.3",
|
|
69
|
+
"@types/mocha": "^7.0.2",
|
|
70
|
+
"@types/node": "^14.17.32",
|
|
71
|
+
"@types/read": "^0.0.28",
|
|
72
|
+
"@types/semver": "^6.0.0",
|
|
73
|
+
"@types/tmp": "^0.2.2",
|
|
74
|
+
"@types/url-join": "^4.0.1",
|
|
75
|
+
"@types/xml2js": "^0.4.4",
|
|
76
|
+
"@types/yauzl": "^2.9.2",
|
|
77
|
+
"@types/yazl": "^2.4.2",
|
|
78
|
+
"husky": "^7.0.4",
|
|
79
|
+
"mocha": "^9.2.0",
|
|
80
|
+
"prettier": "2.1.2",
|
|
81
|
+
"pretty-quick": "^3.0.2",
|
|
82
|
+
"source-map-support": "^0.4.2",
|
|
83
|
+
"ts-node": "^10.0.0",
|
|
84
|
+
"typescript": "^4.3.2"
|
|
85
|
+
},
|
|
86
|
+
"mocha": {
|
|
87
|
+
"require": [
|
|
88
|
+
"ts-node/register"
|
|
89
|
+
],
|
|
90
|
+
"watch-files": "src/**",
|
|
91
|
+
"spec": "src/test/**/*.ts"
|
|
92
|
+
},
|
|
93
|
+
"prettier": {
|
|
94
|
+
"useTabs": true,
|
|
95
|
+
"printWidth": 120,
|
|
96
|
+
"singleQuote": true,
|
|
97
|
+
"arrowParens": "avoid"
|
|
98
|
+
}
|
|
99
|
+
}
|
package/vsce
ADDED