@vscode/vsce 2.25.1-3 → 2.25.1-5
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/out/main.js +8 -4
- package/out/publish.js +13 -3
- package/out/store.js +2 -1
- package/out/util.js +13 -1
- package/package.json +2 -1
package/dist/vsce.d.ts
CHANGED
|
@@ -162,6 +162,7 @@ export declare interface IPublishOptions {
|
|
|
162
162
|
* Defaults to the stored one.
|
|
163
163
|
*/
|
|
164
164
|
readonly pat?: string;
|
|
165
|
+
readonly azureCredential?: boolean;
|
|
165
166
|
readonly allowProposedApi?: boolean;
|
|
166
167
|
readonly noVerify?: boolean;
|
|
167
168
|
readonly allowProposedApis?: string[];
|
package/out/main.js
CHANGED
|
@@ -143,6 +143,7 @@ module.exports = function (argv) {
|
|
|
143
143
|
.command('publish [version]')
|
|
144
144
|
.description('Publishes an extension')
|
|
145
145
|
.option('-p, --pat <token>', 'Personal Access Token (defaults to VSCE_PAT environment variable)', process.env['VSCE_PAT'])
|
|
146
|
+
.option('--azure-credential', 'Use Microsoft Entra ID for authentication')
|
|
146
147
|
.option('-t, --target <targets...>', `Target architectures. Valid targets: ${ValidTargets}`)
|
|
147
148
|
.option('--ignore-other-target-folders', `Ignore other target folders. Valid only when --target <target> is provided.`)
|
|
148
149
|
.option('--readme-path <path>', 'Path to README file (defaults to README.md)')
|
|
@@ -170,8 +171,9 @@ module.exports = function (argv) {
|
|
|
170
171
|
.option('--allow-missing-repository', 'Allow missing a repository URL in package.json')
|
|
171
172
|
.option('--skip-duplicate', 'Fail silently if version already exists on the marketplace')
|
|
172
173
|
.option('--skip-license', 'Allow publishing without license file')
|
|
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)({
|
|
174
|
+
.action((version, { pat, azureCredential, 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)({
|
|
174
175
|
pat,
|
|
176
|
+
azureCredential,
|
|
175
177
|
version,
|
|
176
178
|
targets: target,
|
|
177
179
|
ignoreOtherTargetFolders,
|
|
@@ -202,8 +204,9 @@ module.exports = function (argv) {
|
|
|
202
204
|
.command('unpublish [extensionid]')
|
|
203
205
|
.description('Unpublishes an extension. Example extension id: ms-vscode.live-server.')
|
|
204
206
|
.option('-p, --pat <token>', 'Personal Access Token')
|
|
207
|
+
.option('--azure-credential', 'Use Microsoft Entra ID for authentication')
|
|
205
208
|
.option('-f, --force', 'Skip confirmation prompt when unpublishing an extension')
|
|
206
|
-
.action((id, { pat, force }) => main((0, publish_1.unpublish)({ id, pat, force })));
|
|
209
|
+
.action((id, { pat, azureCredential, force }) => main((0, publish_1.unpublish)({ id, pat, azureCredential, force })));
|
|
207
210
|
commander_1.default
|
|
208
211
|
.command('ls-publishers')
|
|
209
212
|
.description('Lists all known publishers')
|
|
@@ -222,9 +225,10 @@ module.exports = function (argv) {
|
|
|
222
225
|
.action(name => main((0, store_1.logoutPublisher)(name)));
|
|
223
226
|
commander_1.default
|
|
224
227
|
.command('verify-pat [publisher]')
|
|
225
|
-
.description('Verifies if the Personal Access Token has publish rights for the publisher')
|
|
228
|
+
.description('Verifies if the Personal Access Token or Azure identity has publish rights for the publisher')
|
|
226
229
|
.option('-p, --pat <token>', 'Personal Access Token (defaults to VSCE_PAT environment variable)', process.env['VSCE_PAT'])
|
|
227
|
-
.
|
|
230
|
+
.option('--azure-credential', 'Use Microsoft Entra ID for authentication')
|
|
231
|
+
.action((publisherName, { pat, azureCredential }) => main((0, store_1.verifyPat)({ publisherName, pat, azureCredential })));
|
|
228
232
|
commander_1.default
|
|
229
233
|
.command('show <extensionid>')
|
|
230
234
|
.description(`Shows an extension's metadata`)
|
package/out/publish.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.unpublish = exports.publish = void 0;
|
|
29
|
+
exports.getPAT = exports.unpublish = exports.publish = void 0;
|
|
30
30
|
const fs = __importStar(require("fs"));
|
|
31
31
|
const util_1 = require("util");
|
|
32
32
|
const semver = __importStar(require("semver"));
|
|
@@ -99,7 +99,7 @@ async function publish(options = {}) {
|
|
|
99
99
|
}
|
|
100
100
|
exports.publish = publish;
|
|
101
101
|
async function _publish(packagePath, sigzipPath, manifest, options) {
|
|
102
|
-
const pat =
|
|
102
|
+
const pat = await getPAT(manifest.publisher, options);
|
|
103
103
|
const api = await (0, util_2.getGalleryAPI)(pat);
|
|
104
104
|
const packageStream = fs.createReadStream(packagePath);
|
|
105
105
|
const name = `${manifest.publisher}.${manifest.name}`;
|
|
@@ -211,7 +211,7 @@ async function unpublish(options = {}) {
|
|
|
211
211
|
throw new Error('Aborted');
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
|
-
const pat =
|
|
214
|
+
const pat = await getPAT(publisher, options);
|
|
215
215
|
const api = await (0, util_2.getGalleryAPI)(pat);
|
|
216
216
|
await api.deleteExtension(publisher, name);
|
|
217
217
|
util_2.log.done(`Deleted extension: ${fullName}!`);
|
|
@@ -229,4 +229,14 @@ function validateMarketplaceRequirements(manifest, options) {
|
|
|
229
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
230
|
}
|
|
231
231
|
}
|
|
232
|
+
async function getPAT(publisher, options) {
|
|
233
|
+
if (options.pat) {
|
|
234
|
+
return options.pat;
|
|
235
|
+
}
|
|
236
|
+
if (options.azureCredential) {
|
|
237
|
+
return await (0, util_2.getAzureCredentialAccessToken)();
|
|
238
|
+
}
|
|
239
|
+
return (await (0, store_1.getPublisher)(publisher)).pat;
|
|
240
|
+
}
|
|
241
|
+
exports.getPAT = getPAT;
|
|
232
242
|
//# sourceMappingURL=publish.js.map
|
package/out/store.js
CHANGED
|
@@ -30,6 +30,7 @@ const os_1 = require("os");
|
|
|
30
30
|
const util_1 = require("./util");
|
|
31
31
|
const validation_1 = require("./validation");
|
|
32
32
|
const package_1 = require("./package");
|
|
33
|
+
const publish_1 = require("./publish");
|
|
33
34
|
class FileStore {
|
|
34
35
|
constructor(path, publishers) {
|
|
35
36
|
this.path = path;
|
|
@@ -113,7 +114,7 @@ class KeytarStore {
|
|
|
113
114
|
exports.KeytarStore = KeytarStore;
|
|
114
115
|
async function verifyPat(options) {
|
|
115
116
|
const publisherName = options.publisherName ?? (await (0, package_1.readManifest)()).publisher;
|
|
116
|
-
const pat =
|
|
117
|
+
const pat = await (0, publish_1.getPAT)(publisherName, options);
|
|
117
118
|
try {
|
|
118
119
|
// If the caller of the `getRoleAssignments` API has any of the roles
|
|
119
120
|
// (Creator, Owner, Contributor, Reader) on the publisher, we get a 200,
|
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.getMarketplaceUrl = 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.getAzureCredentialAccessToken = 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");
|
|
@@ -11,6 +11,7 @@ const GalleryApi_1 = require("azure-devops-node-api/GalleryApi");
|
|
|
11
11
|
const chalk_1 = __importDefault(require("chalk"));
|
|
12
12
|
const publicgalleryapi_1 = require("./publicgalleryapi");
|
|
13
13
|
const os_1 = require("os");
|
|
14
|
+
const identity_1 = require("@azure/identity");
|
|
14
15
|
const __read = (0, util_1.promisify)(read_1.default);
|
|
15
16
|
function read(prompt, options = {}) {
|
|
16
17
|
if (process.env['VSCE_TESTS'] || !process.stdout.isTTY) {
|
|
@@ -50,6 +51,17 @@ function getPublicGalleryAPI() {
|
|
|
50
51
|
return new publicgalleryapi_1.PublicGalleryAPI(marketplaceUrl, '3.0-preview.1');
|
|
51
52
|
}
|
|
52
53
|
exports.getPublicGalleryAPI = getPublicGalleryAPI;
|
|
54
|
+
async function getAzureCredentialAccessToken() {
|
|
55
|
+
try {
|
|
56
|
+
const credential = new identity_1.DefaultAzureCredential();
|
|
57
|
+
const token = await credential.getToken('499b84ac-1321-427f-aa17-267ca6975798/.default');
|
|
58
|
+
return token.token;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
throw new Error('Can not acquire a Microsoft Entra ID access token. Additional information:\n\n' + error);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.getAzureCredentialAccessToken = getAzureCredentialAccessToken;
|
|
53
65
|
function normalize(path) {
|
|
54
66
|
return path.replace(/\\/g, '/');
|
|
55
67
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vscode/vsce",
|
|
3
|
-
"version": "2.25.1-
|
|
3
|
+
"version": "2.25.1-5",
|
|
4
4
|
"description": "VS Code Extensions Manager",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
"node": ">= 16"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
+
"@azure/identity": "^4.1.0",
|
|
41
42
|
"azure-devops-node-api": "^12.5.0",
|
|
42
43
|
"chalk": "^2.4.2",
|
|
43
44
|
"cheerio": "^1.0.0-rc.9",
|