@vscode/vsce 2.24.1-0 → 2.24.1-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/out/package.js +13 -4
- package/out/publish.js +15 -10
- package/package.json +1 -1
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
|
@@ -70,6 +70,7 @@ async function publish(options = {}) {
|
|
|
70
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.`);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
validateMarketplaceRequirements(vsix.manifest, options);
|
|
73
74
|
await _publish(packagePath, options.sigzipPath?.[index], vsix.manifest, { ...options, target });
|
|
74
75
|
}
|
|
75
76
|
}
|
|
@@ -77,6 +78,8 @@ async function publish(options = {}) {
|
|
|
77
78
|
const cwd = options.cwd || process.cwd();
|
|
78
79
|
const manifest = await (0, package_1.readManifest)(cwd);
|
|
79
80
|
(0, util_2.patchOptionsWithManifest)(options, manifest);
|
|
81
|
+
// Validate marketplace requirements before prepublish to avoid unnecessary work
|
|
82
|
+
validateMarketplaceRequirements(manifest, options);
|
|
80
83
|
await (0, package_1.prepublish)(cwd, manifest, options.useYarn);
|
|
81
84
|
await (0, package_1.versionBump)(options);
|
|
82
85
|
if (options.targets) {
|
|
@@ -95,16 +98,6 @@ async function publish(options = {}) {
|
|
|
95
98
|
}
|
|
96
99
|
exports.publish = publish;
|
|
97
100
|
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
101
|
const pat = options.pat ?? (await (0, store_1.getPublisher)(manifest.publisher)).pat;
|
|
109
102
|
const api = await (0, util_2.getGalleryAPI)(pat);
|
|
110
103
|
const packageStream = fs.createReadStream(packagePath);
|
|
@@ -217,4 +210,16 @@ async function unpublish(options = {}) {
|
|
|
217
210
|
util_2.log.done(`Deleted extension: ${fullName}!`);
|
|
218
211
|
}
|
|
219
212
|
exports.unpublish = unpublish;
|
|
213
|
+
function validateMarketplaceRequirements(manifest, options) {
|
|
214
|
+
(0, validation_1.validatePublisher)(manifest.publisher);
|
|
215
|
+
if (manifest.enableProposedApi && !options.allowAllProposedApis && !options.noVerify) {
|
|
216
|
+
throw new Error("Extensions using proposed API (enableProposedApi: true) can't be published to the Marketplace. Use --allow-all-proposed-apis to bypass.");
|
|
217
|
+
}
|
|
218
|
+
if (manifest.enabledApiProposals && !options.allowAllProposedApis && !options.noVerify && manifest.enabledApiProposals?.some(p => !options.allowProposedApis?.includes(p))) {
|
|
219
|
+
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.`);
|
|
220
|
+
}
|
|
221
|
+
if (semver.prerelease(manifest.version)) {
|
|
222
|
+
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`);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
220
225
|
//# sourceMappingURL=publish.js.map
|