extensionManagementUtil.ts 839 字节
Newer Older
S
Sandeep Somavarapu 已提交
1 2 3 4 5
/*---------------------------------------------------------------------------------------------
 *  Copyright (c) Microsoft Corporation. All rights reserved.
 *  Licensed under the MIT License. See License.txt in the project root for license information.
 *--------------------------------------------------------------------------------------------*/

S
Sandeep Somavarapu 已提交
6
import { buffer } from 'vs/base/node/zip';
7
import { localize } from 'vs/nls';
8
import { IExtensionManifest } from 'vs/platform/extensions/common/extensions';
S
Sandeep Somavarapu 已提交
9

10 11 12 13 14 15 16 17 18
export function getManifest(vsix: string): Promise<IExtensionManifest> {
	return buffer(vsix, 'extension/package.json')
		.then(buffer => {
			try {
				return JSON.parse(buffer.toString('utf8'));
			} catch (err) {
				throw new Error(localize('invalidManifest', "VSIX invalid: package.json is not a JSON file."));
			}
		});
S
Sandeep Somavarapu 已提交
19
}