From 33daacd8595c663db531252bb2ba624111426012 Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 19 Jun 2024 14:47:06 +0200 Subject: [PATCH] fix #1006 (#1007) --- src/package.ts | 3 +++ src/test/package.test.ts | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/src/package.ts b/src/package.ts index 867e9697..756e6d7d 100644 --- a/src/package.ts +++ b/src/package.ts @@ -193,6 +193,7 @@ export interface VSIX { extensionPack: string; extensionKind: string; localizedLanguages: string; + enabledApiProposals: string; preRelease: boolean; sponsorLink: string; pricing: string; @@ -541,6 +542,7 @@ export class ManifestProcessor extends BaseProcessor { .map(loc => loc.localizedLanguageName ?? loc.languageName ?? loc.languageId) .join(',') : '', + enabledApiProposals: manifest.enabledApiProposals ? manifest.enabledApiProposals.join(',') : '', preRelease: !!this.options.preRelease, sponsorLink: manifest.sponsor?.url || '', }; @@ -1461,6 +1463,7 @@ export async function toVsixManifest(vsix: VSIX): Promise { + ${vsix.preRelease ? `` : ''} ${vsix.sponsorLink ? `` diff --git a/src/test/package.test.ts b/src/test/package.test.ts index ae3e62a7..f842fb27 100644 --- a/src/test/package.test.ts +++ b/src/test/package.test.ts @@ -1912,6 +1912,32 @@ describe('toVsixManifest', () => { const xmlManifest = await parseXmlManifest(raw); assertProperty(xmlManifest, 'Microsoft.VisualStudio.Services.Content.Pricing', 'Trial'); }); + + it('should expose enabledApiProposals as properties', () => { + const manifest = { + name: 'test', + publisher: 'mocha', + version: '0.0.1', + engines: Object.create(null), + enabledApiProposals: [ + 'foo', + 'bar@2' + ], + }; + + return _toVsixManifest(manifest, []) + .then(parseXmlManifest) + .then(result => { + const properties = result.PackageManifest.Metadata[0].Properties[0].Property; + const enabledApiProposalsProp = properties.filter(p => p.$.Id === 'Microsoft.VisualStudio.Code.EnabledApiProposals'); + assert.strictEqual(enabledApiProposalsProp.length, 1); + + const enabledApiProposals = enabledApiProposalsProp[0].$.Value.split(','); + assert.strictEqual(enabledApiProposals.length, 2); + assert.strictEqual(enabledApiProposals[0], 'foo'); + assert.strictEqual(enabledApiProposals[1], 'bar@2'); + }); + }); }); describe('qna', () => {