Comparing version 6.4.0 to 6.4.1-next.1627439719.af8b3c239ca616d819f6a08bd4167b237a6bba12
@@ -129,3 +129,3 @@ export declare type Range = string | boolean; | ||
/** | ||
* Checks thaat the {@link Edition} is compatible against the provided versions. | ||
* Checks that the {@link Edition} is compatible against the provided versions. | ||
* @returns if compatible | ||
@@ -132,0 +132,0 @@ * @throws if incompatible |
@@ -89,8 +89,17 @@ var __assign = (this && this.__assign) || function () { | ||
return true; | ||
// semver compare | ||
if (matchRange(version, range)) { | ||
return true; | ||
// original range | ||
try { | ||
if (matchRange(version, range)) | ||
return true; | ||
} | ||
else if (broadenRange === true) { | ||
// broaden range | ||
catch (error) { | ||
throw errtion({ | ||
message: "The range [" + range + "] was invalid, something is wrong with the Editions definition.", | ||
code: 'editions-autoloader-invalid-range', | ||
level: 'fatal', | ||
}, error); | ||
} | ||
// broadened range | ||
if (broadenRange === true) { | ||
// broaden the range | ||
var index = range.indexOf('||'); | ||
@@ -100,4 +109,13 @@ if (index !== -1) { | ||
// broadened range attempt | ||
if (matchRange(version, broadenedRange)) | ||
return true; | ||
try { | ||
if (matchRange(version, broadenedRange)) | ||
return true; | ||
} | ||
catch (error) { | ||
throw errtion({ | ||
message: "The broadened range [" + broadenedRange + "] was invalid, something is wrong within Editions.", | ||
code: 'editions-autoloader-invalid-broadened-range', | ||
level: 'fatal', | ||
}, error); | ||
} | ||
// fail broadened range | ||
@@ -115,10 +133,7 @@ throw errtion({ | ||
} | ||
else { | ||
// give up | ||
throw errtion({ | ||
message: "The edition range [" + range + "] does not support this engine version [" + version + "]", | ||
code: 'editions-autoloader-engine-incompatible-original', | ||
}); | ||
} | ||
// return never | ||
// give up | ||
throw errtion({ | ||
message: "The edition range [" + range + "] does not support this engine version [" + version + "]", | ||
code: 'editions-autoloader-engine-incompatible-original', | ||
}); | ||
} | ||
@@ -187,3 +202,3 @@ /** | ||
/** | ||
* Checks thaat the {@link Edition} is compatible against the provided versions. | ||
* Checks that the {@link Edition} is compatible against the provided versions. | ||
* @returns if compatible | ||
@@ -190,0 +205,0 @@ * @throws if incompatible |
@@ -97,8 +97,17 @@ "use strict"; | ||
return true; | ||
// semver compare | ||
if (version_range_1.default(version, range)) { | ||
return true; | ||
// original range | ||
try { | ||
if (version_range_1.default(version, range)) | ||
return true; | ||
} | ||
else if (broadenRange === true) { | ||
// broaden range | ||
catch (error) { | ||
throw util_js_1.errtion({ | ||
message: "The range [" + range + "] was invalid, something is wrong with the Editions definition.", | ||
code: 'editions-autoloader-invalid-range', | ||
level: 'fatal', | ||
}, error); | ||
} | ||
// broadened range | ||
if (broadenRange === true) { | ||
// broaden the range | ||
var index = range.indexOf('||'); | ||
@@ -108,4 +117,13 @@ if (index !== -1) { | ||
// broadened range attempt | ||
if (version_range_1.default(version, broadenedRange)) | ||
return true; | ||
try { | ||
if (version_range_1.default(version, broadenedRange)) | ||
return true; | ||
} | ||
catch (error) { | ||
throw util_js_1.errtion({ | ||
message: "The broadened range [" + broadenedRange + "] was invalid, something is wrong within Editions.", | ||
code: 'editions-autoloader-invalid-broadened-range', | ||
level: 'fatal', | ||
}, error); | ||
} | ||
// fail broadened range | ||
@@ -123,10 +141,7 @@ throw util_js_1.errtion({ | ||
} | ||
else { | ||
// give up | ||
throw util_js_1.errtion({ | ||
message: "The edition range [" + range + "] does not support this engine version [" + version + "]", | ||
code: 'editions-autoloader-engine-incompatible-original', | ||
}); | ||
} | ||
// return never | ||
// give up | ||
throw util_js_1.errtion({ | ||
message: "The edition range [" + range + "] does not support this engine version [" + version + "]", | ||
code: 'editions-autoloader-engine-incompatible-original', | ||
}); | ||
} | ||
@@ -197,3 +212,3 @@ exports.isCompatibleVersion = isCompatibleVersion; | ||
/** | ||
* Checks thaat the {@link Edition} is compatible against the provided versions. | ||
* Checks that the {@link Edition} is compatible against the provided versions. | ||
* @returns if compatible | ||
@@ -200,0 +215,0 @@ * @throws if incompatible |
# History | ||
## v6.4.1 2021 July 28 | ||
- Progress on [#235](https://github.com/bevry/editions/issues/235) | ||
- Correctly identify and report invalid ranges and invalid broadened ranges | ||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
## v6.4.0 2021 July 28 | ||
- Progress on [#235](https://github.com/bevry/editions/issues/235) | ||
- Swapped `Errlop` for an in-house solution, that provides a concise and readable solution for this specific use case | ||
@@ -10,2 +17,3 @@ - Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
- Progress on [#235](https://github.com/bevry/editions/issues/235) | ||
- Updated dependencies, [base files](https://github.com/bevry/base), and [editions](https://editions.bevry.me) using [boundation](https://github.com/bevry/boundation) | ||
@@ -15,2 +23,3 @@ | ||
- Progress on [#235](https://github.com/bevry/editions/issues/235) | ||
- Have package require failures output what package and entry the failure was on. | ||
@@ -17,0 +26,0 @@ |
{ | ||
"name": "editions", | ||
"version": "6.4.0", | ||
"version": "6.4.1-next.1627439719.af8b3c239ca616d819f6a08bd4167b237a6bba12", | ||
"description": "Publish multiple editions for your JavaScript packages consistently and easily (e.g. source edition, esnext edition, es2015 edition)", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/bevry/editions", |
@@ -130,2 +130,3 @@ // Imports | ||
) | ||
if (opts.loader == null) { | ||
@@ -138,2 +139,3 @@ throw errtion({ | ||
} | ||
try { | ||
@@ -213,12 +215,37 @@ return opts.loader.call(edition, entry) as T | ||
// semver compare | ||
if (matchRange(version, range)) { | ||
return true | ||
} else if (broadenRange === true) { | ||
// broaden range | ||
// original range | ||
try { | ||
if (matchRange(version, range)) return true | ||
} catch (error) { | ||
throw errtion( | ||
{ | ||
message: `The range [${range}] was invalid, something is wrong with the Editions definition.`, | ||
code: 'editions-autoloader-invalid-range', | ||
level: 'fatal', | ||
}, | ||
error | ||
) | ||
} | ||
// broadened range | ||
if (broadenRange === true) { | ||
// broaden the range | ||
const index = range.indexOf('||') | ||
if (index !== -1) { | ||
const broadenedRange = range.substr(index) | ||
// broadened range attempt | ||
if (matchRange(version, broadenedRange)) return true | ||
try { | ||
if (matchRange(version, broadenedRange)) return true | ||
} catch (error) { | ||
throw errtion( | ||
{ | ||
message: `The broadened range [${broadenedRange}] was invalid, something is wrong within Editions.`, | ||
code: 'editions-autoloader-invalid-broadened-range', | ||
level: 'fatal', | ||
}, | ||
error | ||
) | ||
} | ||
// fail broadened range | ||
@@ -230,2 +257,3 @@ throw errtion({ | ||
} | ||
// give up | ||
@@ -236,11 +264,9 @@ throw errtion({ | ||
}) | ||
} else { | ||
// give up | ||
throw errtion({ | ||
message: `The edition range [${range}] does not support this engine version [${version}]`, | ||
code: 'editions-autoloader-engine-incompatible-original', | ||
}) | ||
} | ||
// return never | ||
// give up | ||
throw errtion({ | ||
message: `The edition range [${range}] does not support this engine version [${version}]`, | ||
code: 'editions-autoloader-engine-incompatible-original', | ||
}) | ||
} | ||
@@ -284,7 +310,10 @@ | ||
if (key === 'node' && versions.deno) continue | ||
// prepare | ||
const engine = engines[key] | ||
const version = versions[key] | ||
// skip for engines this edition does not care about | ||
if (version == null) continue | ||
// check compatibility against all the provided engines it does care about | ||
@@ -294,2 +323,3 @@ try { | ||
compatible = true | ||
// if any incompatibility, it is thrown, so no need to set to false | ||
@@ -321,3 +351,3 @@ } catch (rangeError) { | ||
/** | ||
* Checks thaat the {@link Edition} is compatible against the provided versions. | ||
* Checks that the {@link Edition} is compatible against the provided versions. | ||
* @returns if compatible | ||
@@ -371,2 +401,3 @@ * @throws if incompatible | ||
isCompatibleEdition(edition, opts) | ||
// return the edition if it is successful | ||
@@ -449,2 +480,3 @@ return edition | ||
const { editions } = JSON.parse(readFileSync(packagePath, 'utf8')) | ||
// load edition | ||
@@ -451,0 +483,0 @@ return solicitEdition<T>(editions, { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
79360
1362
1