@@ -180,7 +180,7 @@ export interface VSIX {
180
180
}
181
181
182
182
export class BaseProcessor implements IProcessor {
183
- constructor ( protected manifest : Manifest ) { }
183
+ constructor ( protected manifest : Manifest ) { }
184
184
assets : IAsset [ ] = [ ] ;
185
185
tags : string [ ] = [ ] ;
186
186
vsix : VSIX = Object . create ( null ) ;
@@ -499,8 +499,8 @@ export class ManifestProcessor extends BaseProcessor {
499
499
localizedLanguages :
500
500
manifest . contributes && manifest . contributes . localizations
501
501
? manifest . contributes . localizations
502
- . map ( loc => loc . localizedLanguageName ?? loc . languageName ?? loc . languageId )
503
- . join ( ',' )
502
+ . map ( loc => loc . localizedLanguageName ?? loc . languageName ?? loc . languageId )
503
+ . join ( ',' )
504
504
: '' ,
505
505
preRelease : ! ! this . options . preRelease ,
506
506
sponsorLink : manifest . sponsor ?. url || '' ,
@@ -801,10 +801,9 @@ export class MarkdownProcessor extends BaseProcessor {
801
801
// Issue in own repository
802
802
result =
803
803
prefix +
804
- `[#${ issueNumber } ](${
805
- this . isGitHub
806
- ? urljoin ( this . repositoryUrl , 'issues' , issueNumber )
807
- : urljoin ( this . repositoryUrl , '-' , 'issues' , issueNumber )
804
+ `[#${ issueNumber } ](${ this . isGitHub
805
+ ? urljoin ( this . repositoryUrl , 'issues' , issueNumber )
806
+ : urljoin ( this . repositoryUrl , '-' , 'issues' , issueNumber )
808
807
} )`;
809
808
}
810
809
@@ -1061,8 +1060,8 @@ function getExtensionKind(manifest: Manifest): ExtensionKind[] {
1061
1060
const result : ExtensionKind [ ] = Array . isArray ( manifest . extensionKind )
1062
1061
? manifest . extensionKind
1063
1062
: manifest . extensionKind === 'ui'
1064
- ? [ 'ui' , 'workspace' ]
1065
- : [ manifest . extensionKind ] ;
1063
+ ? [ 'ui' , 'workspace' ]
1064
+ : [ manifest . extensionKind ] ;
1066
1065
1067
1066
// Add web kind if the extension can run as web extension
1068
1067
if ( deduced . includes ( 'web' ) && ! result . includes ( 'web' ) ) {
@@ -1215,12 +1214,14 @@ export function validateManifest(manifest: Manifest): Manifest {
1215
1214
validateEngineCompatibility ( engineVersion ) ;
1216
1215
1217
1216
const hasActivationEvents = ! ! manifest . activationEvents ;
1218
- const hasImplicitActivationEvents =
1217
+ const hasImplicitLanguageActivationEvents = manifest . contributes ?. languages ;
1218
+ const hasOtherImplicitActivationEvents =
1219
1219
manifest . contributes ?. commands ||
1220
1220
manifest . contributes ?. authentication ||
1221
- manifest . contributes ?. languages ||
1222
1221
manifest . contributes ?. customEditors ||
1223
1222
manifest . contributes ?. views ;
1223
+ const hasImplicitActivationEvents = hasImplicitLanguageActivationEvents || hasOtherImplicitActivationEvents ;
1224
+
1224
1225
const hasMain = ! ! manifest . main ;
1225
1226
const hasBrowser = ! ! manifest . browser ;
1226
1227
@@ -1237,7 +1238,7 @@ export function validateManifest(manifest: Manifest): Manifest {
1237
1238
( ( engineVersion === '*' || semver . satisfies ( parsedEngineVersion , '>=1.74' , { includePrerelease : true } ) ) &&
1238
1239
hasImplicitActivationEvents )
1239
1240
) {
1240
- if ( ! hasMain && ! hasBrowser ) {
1241
+ if ( ! hasMain && ! hasBrowser && ( hasActivationEvents || ! hasImplicitLanguageActivationEvents ) ) {
1241
1242
throw new Error (
1242
1243
"Manifest needs either a 'main' or 'browser' property, given it has a 'activationEvents' property."
1243
1244
) ;
@@ -1371,84 +1372,74 @@ export async function toVsixManifest(vsix: VSIX): Promise<string> {
1371
1372
<Tags>${ escape ( vsix . tags ) } </Tags>
1372
1373
<Categories>${ escape ( vsix . categories ) } </Categories>
1373
1374
<GalleryFlags>${ escape ( vsix . flags ) } </GalleryFlags>
1374
- ${
1375
- ! vsix . badges
1376
- ? ''
1377
- : `<Badges>${ vsix . badges
1378
- . map (
1379
- badge =>
1380
- `<Badge Link="${ escape ( badge . href ) } " ImgUri="${ escape ( badge . url ) } " Description="${ escape (
1381
- badge . description
1382
- ) } " />`
1383
- )
1384
- . join ( '\n' ) } </Badges>`
1385
- }
1375
+ ${ ! vsix . badges
1376
+ ? ''
1377
+ : `<Badges>${ vsix . badges
1378
+ . map (
1379
+ badge =>
1380
+ `<Badge Link="${ escape ( badge . href ) } " ImgUri="${ escape ( badge . url ) } " Description="${ escape (
1381
+ badge . description
1382
+ ) } " />`
1383
+ )
1384
+ . join ( '\n' ) } </Badges>`
1385
+ }
1386
1386
<Properties>
1387
1387
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="${ escape ( vsix . engine ) } " />
1388
1388
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="${ escape ( vsix . extensionDependencies ) } " />
1389
1389
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="${ escape ( vsix . extensionPack ) } " />
1390
1390
<Property Id="Microsoft.VisualStudio.Code.ExtensionKind" Value="${ escape ( vsix . extensionKind ) } " />
1391
1391
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="${ escape ( vsix . localizedLanguages ) } " />
1392
1392
${ vsix . preRelease ? `<Property Id="Microsoft.VisualStudio.Code.PreRelease" Value="${ escape ( vsix . preRelease ) } " />` : '' }
1393
- ${
1394
- vsix . sponsorLink
1395
- ? `<Property Id="Microsoft.VisualStudio.Code.SponsorLink" Value="${ escape ( vsix . sponsorLink ) } " />`
1396
- : ''
1397
- }
1398
- ${
1399
- ! vsix . links . repository
1400
- ? ''
1401
- : `<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="${ escape ( vsix . links . repository ) } " />
1393
+ ${ vsix . sponsorLink
1394
+ ? `<Property Id="Microsoft.VisualStudio.Code.SponsorLink" Value="${ escape ( vsix . sponsorLink ) } " />`
1395
+ : ''
1396
+ }
1397
+ ${ ! vsix . links . repository
1398
+ ? ''
1399
+ : `<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="${ escape ( vsix . links . repository ) } " />
1402
1400
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="${ escape ( vsix . links . repository ) } " />
1403
- ${
1404
- vsix . links . github
1405
- ? `<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="${ escape ( vsix . links . github ) } " />`
1406
- : `<Property Id="Microsoft.VisualStudio.Services.Links.Repository" Value="${ escape (
1407
- vsix . links . repository
1408
- ) } " />`
1409
- } `
1410
- }
1411
- ${
1412
- vsix . links . bugs
1413
- ? `<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="${ escape ( vsix . links . bugs ) } " />`
1414
- : ''
1415
- }
1416
- ${
1417
- vsix . links . homepage
1418
- ? `<Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="${ escape ( vsix . links . homepage ) } " />`
1419
- : ''
1420
- }
1421
- ${
1422
- vsix . galleryBanner . color
1423
- ? `<Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="${ escape (
1424
- vsix . galleryBanner . color
1425
- ) } " />`
1426
- : ''
1427
- }
1428
- ${
1429
- vsix . galleryBanner . theme
1430
- ? `<Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="${ escape (
1431
- vsix . galleryBanner . theme
1432
- ) } " />`
1433
- : ''
1434
- }
1401
+ ${ vsix . links . github
1402
+ ? `<Property Id="Microsoft.VisualStudio.Services.Links.GitHub" Value="${ escape ( vsix . links . github ) } " />`
1403
+ : `<Property Id="Microsoft.VisualStudio.Services.Links.Repository" Value="${ escape (
1404
+ vsix . links . repository
1405
+ ) } " />`
1406
+ } `
1407
+ }
1408
+ ${ vsix . links . bugs
1409
+ ? `<Property Id="Microsoft.VisualStudio.Services.Links.Support" Value="${ escape ( vsix . links . bugs ) } " />`
1410
+ : ''
1411
+ }
1412
+ ${ vsix . links . homepage
1413
+ ? `<Property Id="Microsoft.VisualStudio.Services.Links.Learn" Value="${ escape ( vsix . links . homepage ) } " />`
1414
+ : ''
1415
+ }
1416
+ ${ vsix . galleryBanner . color
1417
+ ? `<Property Id="Microsoft.VisualStudio.Services.Branding.Color" Value="${ escape (
1418
+ vsix . galleryBanner . color
1419
+ ) } " />`
1420
+ : ''
1421
+ }
1422
+ ${ vsix . galleryBanner . theme
1423
+ ? `<Property Id="Microsoft.VisualStudio.Services.Branding.Theme" Value="${ escape (
1424
+ vsix . galleryBanner . theme
1425
+ ) } " />`
1426
+ : ''
1427
+ }
1435
1428
<Property Id="Microsoft.VisualStudio.Services.GitHubFlavoredMarkdown" Value="${ escape ( vsix . githubMarkdown ) } " />
1436
1429
<Property Id="Microsoft.VisualStudio.Services.Content.Pricing" Value="${ escape ( vsix . pricing ) } "/>
1437
1430
1438
- ${
1439
- vsix . enableMarketplaceQnA !== undefined
1440
- ? `<Property Id="Microsoft.VisualStudio.Services.EnableMarketplaceQnA" Value="${ escape (
1441
- vsix . enableMarketplaceQnA
1442
- ) } " />`
1443
- : ''
1444
- }
1445
- ${
1446
- vsix . customerQnALink !== undefined
1447
- ? `<Property Id="Microsoft.VisualStudio.Services.CustomerQnALink" Value="${ escape (
1448
- vsix . customerQnALink
1449
- ) } " />`
1450
- : ''
1451
- }
1431
+ ${ vsix . enableMarketplaceQnA !== undefined
1432
+ ? `<Property Id="Microsoft.VisualStudio.Services.EnableMarketplaceQnA" Value="${ escape (
1433
+ vsix . enableMarketplaceQnA
1434
+ ) } " />`
1435
+ : ''
1436
+ }
1437
+ ${ vsix . customerQnALink !== undefined
1438
+ ? `<Property Id="Microsoft.VisualStudio.Services.CustomerQnALink" Value="${ escape (
1439
+ vsix . customerQnALink
1440
+ ) } " />`
1441
+ : ''
1442
+ }
1452
1443
</Properties>
1453
1444
${ vsix . license ? `<License>${ escape ( vsix . license ) } </License>` : '' }
1454
1445
${ vsix . icon ? `<Icon>${ escape ( vsix . icon ) } </Icon>` : '' }
@@ -1460,8 +1451,8 @@ export async function toVsixManifest(vsix: VSIX): Promise<string> {
1460
1451
<Assets>
1461
1452
<Asset Type="Microsoft.VisualStudio.Code.Manifest" Path="extension/package.json" Addressable="true" />
1462
1453
${ vsix . assets
1463
- . map ( asset => `<Asset Type="${ escape ( asset . type ) } " Path="${ escape ( asset . path ) } " Addressable="true" />` )
1464
- . join ( '\n' ) }
1454
+ . map ( asset => `<Asset Type="${ escape ( asset . type ) } " Path="${ escape ( asset . path ) } " Addressable="true" />` )
1455
+ . join ( '\n' ) }
1465
1456
</Assets>
1466
1457
</PackageManifest>` ;
1467
1458
}
@@ -1680,8 +1671,8 @@ function writeVsix(files: IFile[], packagePath: string): Promise<void> {
1680
1671
files . forEach ( f =>
1681
1672
isInMemoryFile ( f )
1682
1673
? zip . addBuffer ( typeof f . contents === 'string' ? Buffer . from ( f . contents , 'utf8' ) : f . contents , f . path , {
1683
- mode : f . mode ,
1684
- } )
1674
+ mode : f . mode ,
1675
+ } )
1685
1676
: zip . addFile ( f . localPath , f . path , { mode : f . mode } )
1686
1677
) ;
1687
1678
zip . end ( ) ;
0 commit comments