Skip to content

Commit

Permalink
update isWebExtension check in built script (fixes microsoft/vscode-i…
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Aug 16, 2021
1 parent 30d73ea commit 51c39d0
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions build/lib/extensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,19 +263,38 @@ const webBuiltInExtensions: IBuiltInExtension[] = productJson.webBuiltInExtensio

type ExtensionKind = 'ui' | 'workspace' | 'web';
interface IExtensionManifest {
main: string;
browser: string;
main?: string;
browser?: string;
extensionKind?: ExtensionKind | ExtensionKind[];
extensionPack?: string[];
extensionDependencies?: string[];
contributes?: { [id: string]: any };
}
/**
* Loosely based on `getExtensionKind` from `src/vs/workbench/services/extensions/common/extensionManifestPropertiesService.ts`
*/
function isWebExtension(manifest: IExtensionManifest): boolean {
if (Boolean(manifest.browser)) {
return true;
}
if (Boolean(manifest.main)) {
return false;
}
// neither browser nor main
if (typeof manifest.extensionKind !== 'undefined') {
const extensionKind = Array.isArray(manifest.extensionKind) ? manifest.extensionKind : [manifest.extensionKind];
return (extensionKind.indexOf('web') >= 0);
if (extensionKind.indexOf('web') >= 0) {
return true;
}
}
if (typeof manifest.contributes !== 'undefined') {
for (const id of ['debuggers', 'terminal', 'typescriptServerPlugins']) {
if (manifest.contributes.hasOwnProperty(id)) {
return false;
}
}
}
return (!Boolean(manifest.main) || Boolean(manifest.browser));
return true;
}

export function packageLocalExtensionsStream(forWeb: boolean): Stream {
Expand Down

0 comments on commit 51c39d0

Please sign in to comment.