UNPKG

@eclipse-glsp/theia-integration

Version:

Glue code to integrate GLSP clients into Eclipse Theia

43 lines 2.06 kB
"use strict"; /******************************************************************************** * Copyright (c) 2024 EclipseSource and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ Object.defineProperty(exports, "__esModule", { value: true }); exports.getTheiaVersion = getTheiaVersion; exports.satisfiesTheiaVersion = satisfiesTheiaVersion; const core_1 = require("@theia/core"); const semver = require("semver"); /** * Returns the currently used Theia version i.e. the version of the installed @theia/core package. * */ function getTheiaVersion() { return core_1.THEIA_VERSION; } /** * Validates if the current Theia version satisfies the given semver range. * @param range - The semver range to validate against the current Theia version. * @param optionsOrLoose - Optional configuration options to treat the given range as loose or include prerelease versions. * By default, prerelease versions are included. * @returns `true` if the current Theia version satisfies the given range, `false` otherwise. * @throws An error if the given range is invalid. */ function satisfiesTheiaVersion(range, options = { includePrerelease: true }) { if (!semver.valid(range) && !semver.validRange(range)) { throw new Error(`Invalid version or range: ${range}`); } return semver.satisfies(getTheiaVersion(), range, options); } //# sourceMappingURL=theia-version-util.js.map