Merge VS Code 1.21 source code (#1067)

* Initial VS Code 1.21 file copy with patches

* A few more merges

* Post npm install

* Fix batch of build breaks

* Fix more build breaks

* Fix more build errors

* Fix more build breaks

* Runtime fixes 1

* Get connection dialog working with some todos

* Fix a few packaging issues

* Copy several node_modules to package build to fix loader issues

* Fix breaks from master

* A few more fixes

* Make tests pass

* First pass of license header updates

* Second pass of license header updates

* Fix restore dialog issues

* Remove add additional themes menu items

* fix select box issues where the list doesn't show up

* formatting

* Fix editor dispose issue

* Copy over node modules to correct location on all platforms
This commit is contained in:
Karl Burtram
2018-04-04 15:27:51 -07:00
committed by GitHub
parent 5fba3e31b4
commit dafb780987
9412 changed files with 141255 additions and 98813 deletions

View File

@@ -5,9 +5,6 @@
'use strict';
import * as nls from 'vs/nls';
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
import { valid } from 'semver';
import { join } from 'path';
export interface IParsedVersion {
hasCaret: boolean;
@@ -250,7 +247,6 @@ export function isVersionValid(currentVersion: string, requestedVersion: string,
}
}
if (!isValidVersion(currentVersion, desiredVersion)) {
notices.push(nls.localize('versionMismatch', "Extension is not compatible with Code {0}. Extension requires: {1}.", currentVersion, requestedVersion));
return false;
@@ -258,90 +254,3 @@ export function isVersionValid(currentVersion: string, requestedVersion: string,
return true;
}
function _isStringArray(arr: string[]): boolean {
if (!Array.isArray(arr)) {
return false;
}
for (let i = 0, len = arr.length; i < len; i++) {
if (typeof arr[i] !== 'string') {
return false;
}
}
return true;
}
function baseIsValidExtensionDescription(extensionFolderPath: string, extensionDescription: IExtensionDescription, notices: string[]): boolean {
if (!extensionDescription) {
notices.push(nls.localize('extensionDescription.empty', "Got empty extension description"));
return false;
}
if (typeof extensionDescription.publisher !== 'string') {
notices.push(nls.localize('extensionDescription.publisher', "property `{0}` is mandatory and must be of type `string`", 'publisher'));
return false;
}
if (typeof extensionDescription.name !== 'string') {
notices.push(nls.localize('extensionDescription.name', "property `{0}` is mandatory and must be of type `string`", 'name'));
return false;
}
if (typeof extensionDescription.version !== 'string') {
notices.push(nls.localize('extensionDescription.version', "property `{0}` is mandatory and must be of type `string`", 'version'));
return false;
}
if (!extensionDescription.engines) {
notices.push(nls.localize('extensionDescription.engines', "property `{0}` is mandatory and must be of type `object`", 'engines'));
return false;
}
if (typeof extensionDescription.engines.sqlops !== 'string') {
notices.push(nls.localize('extensionDescription.engines.sqlops', "property `{0}` is mandatory and must be of type `string`", 'engines.sqlops'));
return false;
}
if (typeof extensionDescription.extensionDependencies !== 'undefined') {
if (!_isStringArray(extensionDescription.extensionDependencies)) {
notices.push(nls.localize('extensionDescription.extensionDependencies', "property `{0}` can be omitted or must be of type `string[]`", 'extensionDependencies'));
return false;
}
}
if (typeof extensionDescription.activationEvents !== 'undefined') {
if (!_isStringArray(extensionDescription.activationEvents)) {
notices.push(nls.localize('extensionDescription.activationEvents1', "property `{0}` can be omitted or must be of type `string[]`", 'activationEvents'));
return false;
}
if (typeof extensionDescription.main === 'undefined') {
notices.push(nls.localize('extensionDescription.activationEvents2', "properties `{0}` and `{1}` must both be specified or must both be omitted", 'activationEvents', 'main'));
return false;
}
}
if (typeof extensionDescription.main !== 'undefined') {
if (typeof extensionDescription.main !== 'string') {
notices.push(nls.localize('extensionDescription.main1', "property `{0}` can be omitted or must be of type `string`", 'main'));
return false;
} else {
let normalizedAbsolutePath = join(extensionFolderPath, extensionDescription.main);
if (normalizedAbsolutePath.indexOf(extensionFolderPath)) {
notices.push(nls.localize('extensionDescription.main2', "Expected `main` ({0}) to be included inside extension's folder ({1}). This might make the extension non-portable.", normalizedAbsolutePath, extensionFolderPath));
// not a failure case
}
}
if (typeof extensionDescription.activationEvents === 'undefined') {
notices.push(nls.localize('extensionDescription.main3', "properties `{0}` and `{1}` must both be specified or must both be omitted", 'activationEvents', 'main'));
return false;
}
}
return true;
}
export function isValidExtensionDescription(version: string, extensionFolderPath: string, extensionDescription: IExtensionDescription, notices: string[]): boolean {
if (!baseIsValidExtensionDescription(extensionFolderPath, extensionDescription, notices)) {
return false;
}
if (!valid(extensionDescription.version)) {
notices.push(nls.localize('notSemver', "Extension version is not semver compatible."));
return false;
}
return isValidExtensionVersion(version, extensionDescription, notices);
}