mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from master
This commit is contained in:
@@ -3,12 +3,13 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import * as semver from 'semver';
|
||||
import { adoptToGalleryExtensionId, LOCAL_EXTENSION_ID_REGEX } from 'vs/platform/extensionManagement/common/extensionManagementUtil';
|
||||
import { IExtensionManifest } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { buffer } from 'vs/platform/node/zip';
|
||||
import { localize } from 'vs/nls';
|
||||
|
||||
export function getIdAndVersionFromLocalExtensionId(localExtensionId: string): { id: string, version: string } {
|
||||
export function getIdAndVersionFromLocalExtensionId(localExtensionId: string): { id: string, version: string | null } {
|
||||
const matches = LOCAL_EXTENSION_ID_REGEX.exec(localExtensionId);
|
||||
if (matches && matches[1] && matches[2]) {
|
||||
const version = semver.valid(matches[2]);
|
||||
@@ -20,4 +21,15 @@ export function getIdAndVersionFromLocalExtensionId(localExtensionId: string): {
|
||||
id: adoptToGalleryExtensionId(localExtensionId),
|
||||
version: null
|
||||
};
|
||||
}
|
||||
|
||||
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."));
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user