src/extensibility/ExtensionManager.js
function getCompatibilityInfo(entry, apiVersion) {
        if (!entry.versions) {
            var fallback = getCompatibilityInfoForVersion(entry.metadata, apiVersion);
            if (fallback.isCompatible) {
                fallback.isLatestVersion = true;
            }
            return fallback;
        }

        var i = entry.versions.length - 1,
            latestInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);

        if (latestInfo.isCompatible) {
            latestInfo.isLatestVersion = true;
            return latestInfo;
        } else {
            // Look at earlier versions (skipping very latest version since we already checked it)
            for (i--; i >= 0; i--) {
                var compatInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
                if (compatInfo.isCompatible) {
                    compatInfo.isLatestVersion = false;
                    compatInfo.requiresNewer = latestInfo.requiresNewer;
                    return compatInfo;
                }
            }

            // No version is compatible, so just return info for the latest version
            return latestInfo;
        }
    }
function getCompatibilityInfo(entry, apiVersion) {
        if (!entry.versions) {
            var fallback = getCompatibilityInfoForVersion(entry.metadata, apiVersion);
            if (fallback.isCompatible) {
                fallback.isLatestVersion = true;
            }
            return fallback;
        }

        var i = entry.versions.length - 1,
            latestInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);

        if (latestInfo.isCompatible) {
            latestInfo.isLatestVersion = true;
            return latestInfo;
        } else {
            // Look at earlier versions (skipping very latest version since we already checked it)
            for (i--; i >= 0; i--) {
                var compatInfo = getCompatibilityInfoForVersion(entry.versions[i], apiVersion);
                if (compatInfo.isCompatible) {
                    compatInfo.isLatestVersion = false;
                    compatInfo.requiresNewer = latestInfo.requiresNewer;
                    return compatInfo;
                }
            }

            // No version is compatible, so just return info for the latest version
            return latestInfo;
        }
    }
function getCompatibilityInfo ( entry , apiVersion ) { if ( ! entry . versions ) { var fallback = getCompatibilityInfoForVersion ( entry . metadata , apiVersion ) ; if ( fallback . isCompatible ) { fallback . isLatestVersion = true ; } return fallback ; } var i = entry . versions . length - 1 , latestInfo = getCompatibilityInfoForVersion ( entry . versions [ i ] , apiVersion ) ; if ( latestInfo . isCompatible ) { latestInfo . isLatestVersion = true ; return latestInfo ; } else { // Look at earlier versions (skipping very latest version since we already checked it) for ( i -- ; i >= 0 ; i -- ) { var compatInfo = getCompatibilityInfoForVersion ( entry . versions [ i ] , apiVersion ) ; if ( compatInfo . isCompatible ) { compatInfo . isLatestVersion = false ; compatInfo . requiresNewer = latestInfo . requiresNewer ; return compatInfo ; } } // No version is compatible, so just return info for the latest version return latestInfo ; } }
Finds the newest version of the entry that is compatible with the given Brackets API version, if any.
@param {Object} entry The registry entry to check.
@param {string} apiVersion The Brackets API version to check against.
@return {{isCompatible: boolean, requiresNewer: ?boolean, compatibleVersion: ?string, isLatestVersion: boolean}}
Result contains an "isCompatible" member saying whether it's compatible. If compatible, "compatibleVersion"
specifies the newest version that is compatible and "isLatestVersion" indicates if this is the absolute
latest version of the extension or not. If !isCompatible or !isLatestVersion, "requiresNewer" says whether
the latest version is incompatible due to requiring a newer (vs. older) version of Brackets.
Finds the newest version of the entry that is compatible with the given Brackets API version if any .