fix problem with version dependencies when loading npm packages directly in validator

This commit is contained in:
Grahame Grieve 2023-12-12 15:56:23 +13:00
parent de7dc3023d
commit f9e11e22c1
1 changed files with 8 additions and 0 deletions

View File

@ -105,6 +105,14 @@ public class IgLoader implements IValidationEngineLoader {
}
NpmPackage npm = srcPackage.matches(FilesystemPackageCacheManager.PACKAGE_VERSION_REGEX_OPT) && !new File(srcPackage).exists() ? getPackageCacheManager().loadPackage(srcPackage, null) : null;
if (npm == null && new File(srcPackage).exists()) {
// try treating the file as an npm
try {
npm = NpmPackage.fromPackage(new FileInputStream(srcPackage));
} catch (Exception e) {
// nothing - any errors will be properly handled later in the process
}
}
if (npm != null) {
for (String s : npm.dependencies()) {
if (!getContext().getLoadedPackages().contains(s)) {