@vscode/vsce 2.23.1-0 → 2.24.1-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/dist/vsce.d.ts +1 -0
- package/dummy.js +0 -0
- package/out/main.js +3 -1
- package/out/publish.js +46 -17
- package/out/store.js +1 -1
- package/out/util.js +5 -1
- package/package.json +3 -2
package/dist/vsce.d.ts
CHANGED
package/dummy.js
ADDED
|
File without changes
|
package/out/main.js
CHANGED
|
@@ -151,6 +151,7 @@ module.exports = function (argv) {
|
|
|
151
151
|
.option('--no-git-tag-version', 'Do not create a version commit and tag when calling `npm version`. Valid only when [version] is provided.')
|
|
152
152
|
.option('--no-update-package-json', 'Do not update `package.json`. Valid only when [version] is provided.')
|
|
153
153
|
.option('-i, --packagePath <paths...>', 'Publish the provided VSIX packages.')
|
|
154
|
+
.option('--sigzipPath <paths...>', 'Signature archives to publish alongside the VSIX packages.')
|
|
154
155
|
.option('--githubBranch <branch>', 'The GitHub branch used to infer relative links in README.md. Can be overridden by --baseContentUrl and --baseImagesUrl.')
|
|
155
156
|
.option('--gitlabBranch <branch>', 'The GitLab branch used to infer relative links in README.md. Can be overridden by --baseContentUrl and --baseImagesUrl.')
|
|
156
157
|
.option('--baseContentUrl <url>', 'Prepend all relative links in README.md with the specified URL.')
|
|
@@ -169,7 +170,7 @@ module.exports = function (argv) {
|
|
|
169
170
|
.option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
|
|
170
171
|
.option('--skip-duplicate', 'Fail silently if version already exists on the marketplace')
|
|
171
172
|
.option('--skip-license', 'Allow publishing without license file')
|
|
172
|
-
.action((version, { pat, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, packagePath, githubBranch, gitlabBranch, baseContentUrl, baseImagesUrl, yarn, noVerify, allowProposedApis, allowAllProposedApis, ignoreFile, dependencies, preRelease, allowStarActivation, allowMissingRepository, skipDuplicate, skipLicense, }) => main((0, publish_1.publish)({
|
|
173
|
+
.action((version, { pat, target, ignoreOtherTargetFolders, readmePath, changelogPath, message, gitTagVersion, updatePackageJson, packagePath, sigzipPath, githubBranch, gitlabBranch, baseContentUrl, baseImagesUrl, yarn, noVerify, allowProposedApis, allowAllProposedApis, ignoreFile, dependencies, preRelease, allowStarActivation, allowMissingRepository, skipDuplicate, skipLicense, }) => main((0, publish_1.publish)({
|
|
173
174
|
pat,
|
|
174
175
|
version,
|
|
175
176
|
targets: target,
|
|
@@ -180,6 +181,7 @@ module.exports = function (argv) {
|
|
|
180
181
|
gitTagVersion,
|
|
181
182
|
updatePackageJson,
|
|
182
183
|
packagePath,
|
|
184
|
+
sigzipPath,
|
|
183
185
|
githubBranch,
|
|
184
186
|
gitlabBranch,
|
|
185
187
|
baseContentUrl,
|
package/out/publish.js
CHANGED
|
@@ -22,6 +22,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.unpublish = exports.publish = void 0;
|
|
27
30
|
const fs = __importStar(require("fs"));
|
|
@@ -34,6 +37,8 @@ const store_1 = require("./store");
|
|
|
34
37
|
const util_2 = require("./util");
|
|
35
38
|
const zip_1 = require("./zip");
|
|
36
39
|
const validation_1 = require("./validation");
|
|
40
|
+
const form_data_1 = __importDefault(require("form-data"));
|
|
41
|
+
const path_1 = require("path");
|
|
37
42
|
const tmpName = (0, util_1.promisify)(tmp.tmpName);
|
|
38
43
|
async function publish(options = {}) {
|
|
39
44
|
if (options.packagePath) {
|
|
@@ -43,7 +48,8 @@ async function publish(options = {}) {
|
|
|
43
48
|
else if (options.targets) {
|
|
44
49
|
throw new Error(`Both options not supported simultaneously: 'packagePath' and 'target'. Use 'vsce package --target <target>' to first create a platform specific package, then use 'vsce publish --packagePath <path>' to publish it.`);
|
|
45
50
|
}
|
|
46
|
-
for (
|
|
51
|
+
for (let index = 0; index < options.packagePath.length; index++) {
|
|
52
|
+
const packagePath = options.packagePath[index];
|
|
47
53
|
const vsix = await (0, zip_1.readVSIXPackage)(packagePath);
|
|
48
54
|
let target;
|
|
49
55
|
try {
|
|
@@ -64,7 +70,7 @@ async function publish(options = {}) {
|
|
|
64
70
|
throw new Error(`Cannot use '--pre-release' flag with a package that was not packaged as pre-release. Please package it using the '--pre-release' flag and publish again.`);
|
|
65
71
|
}
|
|
66
72
|
}
|
|
67
|
-
await _publish(packagePath, vsix.manifest, { ...options, target });
|
|
73
|
+
await _publish(packagePath, options.sigzipPath?.[index], vsix.manifest, { ...options, target });
|
|
68
74
|
}
|
|
69
75
|
}
|
|
70
76
|
else {
|
|
@@ -77,18 +83,18 @@ async function publish(options = {}) {
|
|
|
77
83
|
for (const target of options.targets) {
|
|
78
84
|
const packagePath = await tmpName();
|
|
79
85
|
const packageResult = await (0, package_1.pack)({ ...options, target, packagePath });
|
|
80
|
-
await _publish(packagePath, packageResult.manifest, { ...options, target });
|
|
86
|
+
await _publish(packagePath, undefined, packageResult.manifest, { ...options, target });
|
|
81
87
|
}
|
|
82
88
|
}
|
|
83
89
|
else {
|
|
84
90
|
const packagePath = await tmpName();
|
|
85
91
|
const packageResult = await (0, package_1.pack)({ ...options, packagePath });
|
|
86
|
-
await _publish(packagePath, packageResult.manifest, options);
|
|
92
|
+
await _publish(packagePath, undefined, packageResult.manifest, options);
|
|
87
93
|
}
|
|
88
94
|
}
|
|
89
95
|
}
|
|
90
96
|
exports.publish = publish;
|
|
91
|
-
async function _publish(packagePath, manifest, options) {
|
|
97
|
+
async function _publish(packagePath, sigzipPath, manifest, options) {
|
|
92
98
|
(0, validation_1.validatePublisher)(manifest.publisher);
|
|
93
99
|
if (manifest.enableProposedApi && !options.allowAllProposedApis && !options.noVerify) {
|
|
94
100
|
throw new Error("Extensions using proposed API (enableProposedApi: true) can't be published to the Marketplace. Use --allow-all-proposed-apis to bypass.");
|
|
@@ -129,26 +135,36 @@ async function _publish(packagePath, manifest, options) {
|
|
|
129
135
|
throw new Error(`${description} already exists.`);
|
|
130
136
|
}
|
|
131
137
|
}
|
|
132
|
-
|
|
133
|
-
await api.
|
|
138
|
+
if (sigzipPath) {
|
|
139
|
+
await _publishSignedPackage(api, (0, path_1.basename)(packagePath), packageStream, (0, path_1.basename)(sigzipPath), fs.createReadStream(sigzipPath), manifest);
|
|
134
140
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
else {
|
|
142
|
+
try {
|
|
143
|
+
await api.updateExtension(undefined, packageStream, manifest.publisher, manifest.name);
|
|
144
|
+
}
|
|
145
|
+
catch (err) {
|
|
146
|
+
if (err.statusCode === 409) {
|
|
147
|
+
if (options.skipDuplicate) {
|
|
148
|
+
util_2.log.done(`Version ${manifest.version} is already published. Skipping publish.`);
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
throw new Error(`${description} already exists.`);
|
|
153
|
+
}
|
|
140
154
|
}
|
|
141
155
|
else {
|
|
142
|
-
throw
|
|
156
|
+
throw err;
|
|
143
157
|
}
|
|
144
158
|
}
|
|
145
|
-
else {
|
|
146
|
-
throw err;
|
|
147
|
-
}
|
|
148
159
|
}
|
|
149
160
|
}
|
|
150
161
|
else {
|
|
151
|
-
|
|
162
|
+
if (sigzipPath) {
|
|
163
|
+
await _publishSignedPackage(api, (0, path_1.basename)(packagePath), packageStream, (0, path_1.basename)(sigzipPath), fs.createReadStream(sigzipPath), manifest);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
await api.createExtension(undefined, packageStream);
|
|
167
|
+
}
|
|
152
168
|
}
|
|
153
169
|
}
|
|
154
170
|
catch (err) {
|
|
@@ -165,6 +181,19 @@ async function _publish(packagePath, manifest, options) {
|
|
|
165
181
|
util_2.log.info(`Hub URL: ${(0, util_2.getHubUrl)(manifest.publisher, manifest.name)}`);
|
|
166
182
|
util_2.log.done(`Published ${description}.`);
|
|
167
183
|
}
|
|
184
|
+
async function _publishSignedPackage(api, packageName, packageStream, sigzipName, sigzipStream, manifest) {
|
|
185
|
+
const extensionType = 'Visual Studio Code';
|
|
186
|
+
const form = new form_data_1.default();
|
|
187
|
+
const lineBreak = '\r\n';
|
|
188
|
+
form.setBoundary('0f411892-ef48-488f-89d3-4f0546e84723');
|
|
189
|
+
form.append('vsix', packageStream, {
|
|
190
|
+
header: `--${form.getBoundary()}${lineBreak}Content-Disposition: attachment; name=vsix; filename=${packageName}${lineBreak}Content-Type: application/octet-stream${lineBreak}${lineBreak}`
|
|
191
|
+
});
|
|
192
|
+
form.append('sigzip', sigzipStream, {
|
|
193
|
+
header: `--${form.getBoundary()}${lineBreak}Content-Disposition: attachment; name=sigzip; filename=${sigzipName}${lineBreak}Content-Type: application/octet-stream${lineBreak}${lineBreak}`
|
|
194
|
+
});
|
|
195
|
+
return await api.publishExtensionWithPublisherSignature(undefined, form, manifest.publisher, manifest.name, extensionType);
|
|
196
|
+
}
|
|
168
197
|
async function unpublish(options = {}) {
|
|
169
198
|
let publisher, name;
|
|
170
199
|
if (options.id) {
|
package/out/store.js
CHANGED
|
@@ -137,7 +137,7 @@ async function verifyPat(pat, publisherName) {
|
|
|
137
137
|
}
|
|
138
138
|
exports.verifyPat = verifyPat;
|
|
139
139
|
async function requestPAT(publisherName) {
|
|
140
|
-
console.log(
|
|
140
|
+
console.log(`${(0, util_1.getMarketplaceUrl)()}/manage/publishers/`);
|
|
141
141
|
const pat = await (0, util_1.read)(`Personal Access Token for publisher '${publisherName}':`, { silent: true, replace: '*' });
|
|
142
142
|
await verifyPat(pat, publisherName);
|
|
143
143
|
return pat;
|
package/out/util.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
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;
|
|
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.getMarketplaceUrl = exports.getPublishedUrl = exports.read = void 0;
|
|
7
7
|
const util_1 = require("util");
|
|
8
8
|
const read_1 = __importDefault(require("read"));
|
|
9
9
|
const WebApi_1 = require("azure-devops-node-api/WebApi");
|
|
@@ -24,6 +24,10 @@ function getPublishedUrl(extension) {
|
|
|
24
24
|
return `${marketplaceUrl}/items?itemName=${extension}`;
|
|
25
25
|
}
|
|
26
26
|
exports.getPublishedUrl = getPublishedUrl;
|
|
27
|
+
function getMarketplaceUrl() {
|
|
28
|
+
return marketplaceUrl;
|
|
29
|
+
}
|
|
30
|
+
exports.getMarketplaceUrl = getMarketplaceUrl;
|
|
27
31
|
function getHubUrl(publisher, name) {
|
|
28
32
|
return `${marketplaceUrl}/manage/publishers/${publisher}/extensions/${name}/hub`;
|
|
29
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/vsce",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.24.1-0",
|
|
4
4
|
"description": "VS Code Extensions Manager",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,10 +38,11 @@
|
|
|
38
38
|
"node": ">= 14"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"azure-devops-node-api": "^
|
|
41
|
+
"azure-devops-node-api": "^12.5.0",
|
|
42
42
|
"chalk": "^2.4.2",
|
|
43
43
|
"cheerio": "^1.0.0-rc.9",
|
|
44
44
|
"commander": "^6.2.1",
|
|
45
|
+
"form-data": "^4.0.0",
|
|
45
46
|
"glob": "^7.0.6",
|
|
46
47
|
"hosted-git-info": "^4.0.2",
|
|
47
48
|
"jsonc-parser": "^3.2.0",
|