@vscode/vsce 2.24.1-0 → 2.24.1-2
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/out/package.js +13 -4
- package/out/publish.js +23 -11
- package/package.json +4 -3
package/out/package.js
CHANGED
|
@@ -1160,12 +1160,21 @@ function getDependenciesOption(options) {
|
|
|
1160
1160
|
return undefined;
|
|
1161
1161
|
}
|
|
1162
1162
|
}
|
|
1163
|
-
function collectFiles(cwd, dependencies, dependencyEntryPoints, ignoreFile) {
|
|
1163
|
+
function collectFiles(cwd, dependencies, dependencyEntryPoints, ignoreFile, manifestFileIncludes) {
|
|
1164
1164
|
return collectAllFiles(cwd, dependencies, dependencyEntryPoints).then(files => {
|
|
1165
1165
|
files = files.filter(f => !/\r$/m.test(f));
|
|
1166
1166
|
return (fs.promises
|
|
1167
1167
|
.readFile(ignoreFile ? ignoreFile : path.join(cwd, '.vscodeignore'), 'utf8')
|
|
1168
|
-
.catch(err => err.code !== 'ENOENT' ?
|
|
1168
|
+
.catch(err => err.code !== 'ENOENT' ?
|
|
1169
|
+
Promise.reject(err) :
|
|
1170
|
+
ignoreFile ?
|
|
1171
|
+
Promise.reject(err) :
|
|
1172
|
+
// No .vscodeignore file exists
|
|
1173
|
+
manifestFileIncludes ?
|
|
1174
|
+
// include all files in manifestFileIncludes and ignore the rest
|
|
1175
|
+
Promise.resolve(manifestFileIncludes.map(file => `!${file}`).concat(['**']).join('\n\r')) :
|
|
1176
|
+
// "files" property not used in package.json
|
|
1177
|
+
Promise.resolve(''))
|
|
1169
1178
|
// Parse raw ignore by splitting output into lines and filtering out empty lines and comments
|
|
1170
1179
|
.then(rawIgnore => rawIgnore
|
|
1171
1180
|
.split(/[\n\r]/)
|
|
@@ -1233,7 +1242,7 @@ function collect(manifest, options = {}) {
|
|
|
1233
1242
|
const packagedDependencies = options.dependencyEntryPoints || undefined;
|
|
1234
1243
|
const ignoreFile = options.ignoreFile || undefined;
|
|
1235
1244
|
const processors = createDefaultProcessors(manifest, options);
|
|
1236
|
-
return collectFiles(cwd, getDependenciesOption(options), packagedDependencies, ignoreFile).then(fileNames => {
|
|
1245
|
+
return collectFiles(cwd, getDependenciesOption(options), packagedDependencies, ignoreFile, manifest.files).then(fileNames => {
|
|
1237
1246
|
const files = fileNames.map(f => ({ path: `extension/${f}`, localPath: path.join(cwd, f) }));
|
|
1238
1247
|
return processFiles(processors, files);
|
|
1239
1248
|
});
|
|
@@ -1347,7 +1356,7 @@ async function listFiles(options = {}) {
|
|
|
1347
1356
|
if (options.prepublish) {
|
|
1348
1357
|
await prepublish(cwd, manifest, options.useYarn);
|
|
1349
1358
|
}
|
|
1350
|
-
return await collectFiles(cwd, getDependenciesOption(options), options.packagedDependencies, options.ignoreFile);
|
|
1359
|
+
return await collectFiles(cwd, getDependenciesOption(options), options.packagedDependencies, options.ignoreFile, manifest.files);
|
|
1351
1360
|
}
|
|
1352
1361
|
exports.listFiles = listFiles;
|
|
1353
1362
|
/**
|
package/out/publish.js
CHANGED
|
@@ -39,6 +39,7 @@ const zip_1 = require("./zip");
|
|
|
39
39
|
const validation_1 = require("./validation");
|
|
40
40
|
const form_data_1 = __importDefault(require("form-data"));
|
|
41
41
|
const path_1 = require("path");
|
|
42
|
+
const cockatiel_1 = require("cockatiel");
|
|
42
43
|
const tmpName = (0, util_1.promisify)(tmp.tmpName);
|
|
43
44
|
async function publish(options = {}) {
|
|
44
45
|
if (options.packagePath) {
|
|
@@ -70,6 +71,7 @@ async function publish(options = {}) {
|
|
|
70
71
|
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.`);
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
validateMarketplaceRequirements(vsix.manifest, options);
|
|
73
75
|
await _publish(packagePath, options.sigzipPath?.[index], vsix.manifest, { ...options, target });
|
|
74
76
|
}
|
|
75
77
|
}
|
|
@@ -77,6 +79,8 @@ async function publish(options = {}) {
|
|
|
77
79
|
const cwd = options.cwd || process.cwd();
|
|
78
80
|
const manifest = await (0, package_1.readManifest)(cwd);
|
|
79
81
|
(0, util_2.patchOptionsWithManifest)(options, manifest);
|
|
82
|
+
// Validate marketplace requirements before prepublish to avoid unnecessary work
|
|
83
|
+
validateMarketplaceRequirements(manifest, options);
|
|
80
84
|
await (0, package_1.prepublish)(cwd, manifest, options.useYarn);
|
|
81
85
|
await (0, package_1.versionBump)(options);
|
|
82
86
|
if (options.targets) {
|
|
@@ -95,16 +99,6 @@ async function publish(options = {}) {
|
|
|
95
99
|
}
|
|
96
100
|
exports.publish = publish;
|
|
97
101
|
async function _publish(packagePath, sigzipPath, manifest, options) {
|
|
98
|
-
(0, validation_1.validatePublisher)(manifest.publisher);
|
|
99
|
-
if (manifest.enableProposedApi && !options.allowAllProposedApis && !options.noVerify) {
|
|
100
|
-
throw new Error("Extensions using proposed API (enableProposedApi: true) can't be published to the Marketplace. Use --allow-all-proposed-apis to bypass.");
|
|
101
|
-
}
|
|
102
|
-
if (manifest.enabledApiProposals && !options.allowAllProposedApis && !options.noVerify && manifest.enabledApiProposals?.some(p => !options.allowProposedApis?.includes(p))) {
|
|
103
|
-
throw new Error(`Extensions using unallowed proposed API (enabledApiProposals: [${manifest.enabledApiProposals}], allowed: [${options.allowProposedApis ?? []}]) can't be published to the Marketplace. Use --allow-proposed-apis <APIS...> or --allow-all-proposed-apis to bypass.`);
|
|
104
|
-
}
|
|
105
|
-
if (semver.prerelease(manifest.version)) {
|
|
106
|
-
throw new Error(`The VS Marketplace doesn't support prerelease versions: '${manifest.version}'`);
|
|
107
|
-
}
|
|
108
102
|
const pat = options.pat ?? (await (0, store_1.getPublisher)(manifest.publisher)).pat;
|
|
109
103
|
const api = await (0, util_2.getGalleryAPI)(pat);
|
|
110
104
|
const packageStream = fs.createReadStream(packagePath);
|
|
@@ -192,7 +186,13 @@ async function _publishSignedPackage(api, packageName, packageStream, sigzipName
|
|
|
192
186
|
form.append('sigzip', sigzipStream, {
|
|
193
187
|
header: `--${form.getBoundary()}${lineBreak}Content-Disposition: attachment; name=sigzip; filename=${sigzipName}${lineBreak}Content-Type: application/octet-stream${lineBreak}${lineBreak}`
|
|
194
188
|
});
|
|
195
|
-
|
|
189
|
+
const publishWithRetry = (0, cockatiel_1.retry)((0, cockatiel_1.handleWhen)(err => err.message.includes('timeout')), {
|
|
190
|
+
maxAttempts: 3,
|
|
191
|
+
backoff: new cockatiel_1.IterableBackoff([5000, 10000, 20000])
|
|
192
|
+
});
|
|
193
|
+
return await publishWithRetry.execute(async () => {
|
|
194
|
+
return await api.publishExtensionWithPublisherSignature(undefined, form, manifest.publisher, manifest.name, extensionType);
|
|
195
|
+
});
|
|
196
196
|
}
|
|
197
197
|
async function unpublish(options = {}) {
|
|
198
198
|
let publisher, name;
|
|
@@ -217,4 +217,16 @@ async function unpublish(options = {}) {
|
|
|
217
217
|
util_2.log.done(`Deleted extension: ${fullName}!`);
|
|
218
218
|
}
|
|
219
219
|
exports.unpublish = unpublish;
|
|
220
|
+
function validateMarketplaceRequirements(manifest, options) {
|
|
221
|
+
(0, validation_1.validatePublisher)(manifest.publisher);
|
|
222
|
+
if (manifest.enableProposedApi && !options.allowAllProposedApis && !options.noVerify) {
|
|
223
|
+
throw new Error("Extensions using proposed API (enableProposedApi: true) can't be published to the Marketplace. Use --allow-all-proposed-apis to bypass.");
|
|
224
|
+
}
|
|
225
|
+
if (manifest.enabledApiProposals && !options.allowAllProposedApis && !options.noVerify && manifest.enabledApiProposals?.some(p => !options.allowProposedApis?.includes(p))) {
|
|
226
|
+
throw new Error(`Extensions using unallowed proposed API (enabledApiProposals: [${manifest.enabledApiProposals}], allowed: [${options.allowProposedApis ?? []}]) can't be published to the Marketplace. Use --allow-proposed-apis <APIS...> or --allow-all-proposed-apis to bypass.`);
|
|
227
|
+
}
|
|
228
|
+
if (semver.prerelease(manifest.version)) {
|
|
229
|
+
throw new Error(`The VS Marketplace doesn't support prerelease versions: '${manifest.version}'. Checkout our pre-release versioning recommendation here: https://code.visualstudio.com/api/working-with-extensions/publishing-extension#prerelease-extensions`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
220
232
|
//# sourceMappingURL=publish.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/vsce",
|
|
3
|
-
"version": "2.24.1-
|
|
3
|
+
"version": "2.24.1-2",
|
|
4
4
|
"description": "VS Code Extensions Manager",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,12 +35,13 @@
|
|
|
35
35
|
"watch:test": "npm run test -- --watch"
|
|
36
36
|
},
|
|
37
37
|
"engines": {
|
|
38
|
-
"node": ">=
|
|
38
|
+
"node": ">= 16"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"azure-devops-node-api": "^12.5.0",
|
|
42
42
|
"chalk": "^2.4.2",
|
|
43
43
|
"cheerio": "^1.0.0-rc.9",
|
|
44
|
+
"cockatiel": "^3.1.2",
|
|
44
45
|
"commander": "^6.2.1",
|
|
45
46
|
"form-data": "^4.0.0",
|
|
46
47
|
"glob": "^7.0.6",
|
|
@@ -69,7 +70,7 @@
|
|
|
69
70
|
"@types/mime": "^1",
|
|
70
71
|
"@types/minimatch": "^3.0.3",
|
|
71
72
|
"@types/mocha": "^7.0.2",
|
|
72
|
-
"@types/node": "^
|
|
73
|
+
"@types/node": "^16.11.7",
|
|
73
74
|
"@types/read": "^0.0.28",
|
|
74
75
|
"@types/semver": "^6.0.0",
|
|
75
76
|
"@types/tmp": "^0.2.2",
|