Comparing version 6.2.0 to 6.2.1-next.1627411070.449042f7ef94c18ee66bc170a6809ed08e5e593f
@@ -136,3 +136,3 @@ export declare type Range = string | boolean; | ||
* Determine which edition should be loaded. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behaviour), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behavior), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* @returns any suitable editions | ||
@@ -139,0 +139,0 @@ * @throws if no suitable editions |
@@ -201,3 +201,3 @@ var __assign = (this && this.__assign) || function () { | ||
* Determine which edition should be loaded. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behaviour), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behavior), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* @returns any suitable editions | ||
@@ -263,3 +263,3 @@ * @throws if no suitable editions | ||
throw errtion({ | ||
message: "Unable to determine a suitable edition, as an unexpected pathway occured.", | ||
message: "Unable to determine a suitable edition, as an unexpected pathway occurred.", | ||
code: 'editions-autoloader-never', | ||
@@ -283,12 +283,20 @@ }); | ||
export function requirePackage(cwd, loader, entry) { | ||
// load editions | ||
var packagePath = resolve(cwd || '', 'package.json'); | ||
var editions = JSON.parse(readFileSync(packagePath, 'utf8')).editions; | ||
// load edition | ||
return solicitEdition(editions, { | ||
versions: processVersions, | ||
cwd: cwd, | ||
loader: loader, | ||
entry: entry, | ||
}); | ||
try { | ||
// load editions | ||
var editions = JSON.parse(readFileSync(packagePath, 'utf8')).editions; | ||
// load edition | ||
return solicitEdition(editions, { | ||
versions: processVersions, | ||
cwd: cwd, | ||
loader: loader, | ||
entry: entry, | ||
}); | ||
} | ||
catch (error) { | ||
throw errtion({ | ||
message: "Unable to determine a suitable edition for the package [" + packagePath + "] and entry [" + entry + "]", | ||
code: 'editions-autoloader-package', | ||
}, error); | ||
} | ||
} |
@@ -212,3 +212,3 @@ "use strict"; | ||
* Determine which edition should be loaded. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behaviour), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behavior), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* @returns any suitable editions | ||
@@ -274,3 +274,3 @@ * @throws if no suitable editions | ||
throw util_js_1.errtion({ | ||
message: "Unable to determine a suitable edition, as an unexpected pathway occured.", | ||
message: "Unable to determine a suitable edition, as an unexpected pathway occurred.", | ||
code: 'editions-autoloader-never', | ||
@@ -296,13 +296,21 @@ }); | ||
function requirePackage(cwd, loader, entry) { | ||
// load editions | ||
var packagePath = path_1.resolve(cwd || '', 'package.json'); | ||
var editions = JSON.parse(fs_1.readFileSync(packagePath, 'utf8')).editions; | ||
// load edition | ||
return solicitEdition(editions, { | ||
versions: process_1.versions, | ||
cwd: cwd, | ||
loader: loader, | ||
entry: entry, | ||
}); | ||
try { | ||
// load editions | ||
var editions = JSON.parse(fs_1.readFileSync(packagePath, 'utf8')).editions; | ||
// load edition | ||
return solicitEdition(editions, { | ||
versions: process_1.versions, | ||
cwd: cwd, | ||
loader: loader, | ||
entry: entry, | ||
}); | ||
} | ||
catch (error) { | ||
throw util_js_1.errtion({ | ||
message: "Unable to determine a suitable edition for the package [" + packagePath + "] and entry [" + entry + "]", | ||
code: 'editions-autoloader-package', | ||
}, error); | ||
} | ||
} | ||
exports.requirePackage = requirePackage; |
# History | ||
## v6.2.1 2021 July 28 | ||
- Have package require failures output what package and entry the failure was on. | ||
## v6.2.0 2021 June 14 | ||
@@ -4,0 +8,0 @@ |
{ | ||
"name": "editions", | ||
"version": "6.2.0", | ||
"version": "6.2.1-next.1627411070.449042f7ef94c18ee66bc170a6809ed08e5e593f", | ||
"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", |
@@ -41,2 +41,3 @@ // Imports | ||
description: string | ||
/** | ||
@@ -50,2 +51,3 @@ * The location to where this directory is located. It should be a relative path from the `package.json` file. | ||
directory: string | ||
/** | ||
@@ -59,2 +61,3 @@ * The default entry location for this edition, relative to the edition's directory. | ||
entry: string | ||
/** | ||
@@ -68,2 +71,3 @@ * Any keywords you wish to associate to the edition. Useful for various ecosystem tooling, such as automatic ESNext lint configuration if the `esnext` tag is present in the source edition tags. | ||
tags?: string[] | ||
/** | ||
@@ -337,3 +341,3 @@ * This field is used to specific which environments this edition supports. | ||
* Determine which edition should be loaded. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behaviour), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* If {@link VersionOptions.broadenRange} is unspecified (the default behavior), then we attempt to determine a suitable edition without broadening the range, and if that fails, then we try again with the range broadened. | ||
* @returns any suitable editions | ||
@@ -412,3 +416,3 @@ * @throws if no suitable editions | ||
throw errtion({ | ||
message: `Unable to determine a suitable edition, as an unexpected pathway occured.`, | ||
message: `Unable to determine a suitable edition, as an unexpected pathway occurred.`, | ||
code: 'editions-autoloader-never', | ||
@@ -438,12 +442,22 @@ }) | ||
): T { | ||
// load editions | ||
const packagePath = resolve(cwd || '', 'package.json') | ||
const { editions } = JSON.parse(readFileSync(packagePath, 'utf8')) | ||
// load edition | ||
return solicitEdition<T>(editions, { | ||
versions: processVersions as any as Versions, | ||
cwd, | ||
loader, | ||
entry, | ||
}) | ||
try { | ||
// load editions | ||
const { editions } = JSON.parse(readFileSync(packagePath, 'utf8')) | ||
// load edition | ||
return solicitEdition<T>(editions, { | ||
versions: processVersions as any as Versions, | ||
cwd, | ||
loader, | ||
entry, | ||
}) | ||
} catch (error) { | ||
throw errtion( | ||
{ | ||
message: `Unable to determine a suitable edition for the package [${packagePath}] and entry [${entry}]`, | ||
code: 'editions-autoloader-package', | ||
}, | ||
error | ||
) | ||
} | ||
} |
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
76498
1294
1