Allow NPM package versions to have the form {id}#{url} for direct access to packages
This commit is contained in:
parent
3da96f8c02
commit
576be235d7
|
@ -6,6 +6,7 @@
|
||||||
* Slight improvement in performance
|
* Slight improvement in performance
|
||||||
* Fix FHIRPath split function (parameter is not regex)
|
* Fix FHIRPath split function (parameter is not regex)
|
||||||
* Stop warning that Markdown autolinks need to be escaped
|
* Stop warning that Markdown autolinks need to be escaped
|
||||||
|
* Allow NPM package versions to have the form {id}#{url} for direct access to packages
|
||||||
|
|
||||||
## Other code changes
|
## Other code changes
|
||||||
|
|
||||||
|
|
|
@ -262,7 +262,6 @@ public class MarkDownProcessor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String makeMarkdownForString(String content) {
|
public static String makeMarkdownForString(String content) {
|
||||||
StringBuilder b = new StringBuilder();
|
StringBuilder b = new StringBuilder();
|
||||||
for (int i = 0; i < content.length(); i++) {
|
for (int i = 0; i < content.length(); i++) {
|
||||||
|
|
|
@ -402,11 +402,7 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
||||||
@Override
|
@Override
|
||||||
public NpmPackage addPackageToCache(String id, String version, InputStream packageTgzInputStream, String sourceDesc) throws IOException {
|
public NpmPackage addPackageToCache(String id, String version, InputStream packageTgzInputStream, String sourceDesc) throws IOException {
|
||||||
checkValidVersionString(version, id);
|
checkValidVersionString(version, id);
|
||||||
if (progress) {
|
|
||||||
log("Installing " + id + "#" + (version == null ? "?" : version) + " to the package cache");
|
|
||||||
log(" Fetching:");
|
|
||||||
}
|
|
||||||
|
|
||||||
NpmPackage npm = NpmPackage.fromPackage(packageTgzInputStream, sourceDesc, true);
|
NpmPackage npm = NpmPackage.fromPackage(packageTgzInputStream, sourceDesc, true);
|
||||||
|
|
||||||
if (progress) {
|
if (progress) {
|
||||||
|
@ -414,8 +410,8 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
||||||
logn(" Installing: ");
|
logn(" Installing: ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!suppressErrors && npm.name() == null || id == null || !id.equalsIgnoreCase(npm.name())) {
|
if ((npm.name() != null && id != null && !id.equals(npm.name()))) {
|
||||||
if (!id.equals("hl7.fhir.r5.core") && !id.equals("hl7.fhir.us.immds")) {// temporary work around
|
if (!suppressErrors && (!id.equals("hl7.fhir.r5.core") && !id.equals("hl7.fhir.us.immds"))) {// temporary work around
|
||||||
throw new IOException("Attempt to import a mis-identified package. Expected " + id + ", got " + npm.name());
|
throw new IOException("Attempt to import a mis-identified package. Expected " + id + ", got " + npm.name());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -569,10 +565,17 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
||||||
version = "current";
|
version = "current";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (progress) {
|
||||||
|
log("Installing " + id + "#" + (version == null ? "?" : version) + " to the package cache");
|
||||||
|
log(" Fetching:");
|
||||||
|
}
|
||||||
|
|
||||||
// nup, don't have it locally (or it's expired)
|
// nup, don't have it locally (or it's expired)
|
||||||
FilesystemPackageCacheManager.InputStreamWithSrc source;
|
FilesystemPackageCacheManager.InputStreamWithSrc source;
|
||||||
if (false && packageProvider != null && packageProvider.handlesPackage(id, version)) {
|
if (false && packageProvider != null && packageProvider.handlesPackage(id, version)) {
|
||||||
source = packageProvider.provide(id, version);
|
source = packageProvider.provide(id, version);
|
||||||
|
} else if (Utilities.isAbsoluteUrl(version)) {
|
||||||
|
source = fetchSourceFromUrlSpecific(version);
|
||||||
} else if ("current".equals(version) || (version!= null && version.startsWith("current$"))) {
|
} else if ("current".equals(version) || (version!= null && version.startsWith("current$"))) {
|
||||||
// special case - fetch from ci-build server
|
// special case - fetch from ci-build server
|
||||||
source = loadFromCIBuild(id, version.startsWith("current$") ? version.substring(8) : null);
|
source = loadFromCIBuild(id, version.startsWith("current$") ? version.substring(8) : null);
|
||||||
|
@ -585,6 +588,10 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
||||||
return addPackageToCache(id, source.version, source.stream, source.url);
|
return addPackageToCache(id, source.version, source.stream, source.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InputStreamWithSrc fetchSourceFromUrlSpecific(String url) {
|
||||||
|
return new InputStreamWithSrc(fetchFromUrlSpecific(url, false), url, "current");
|
||||||
|
}
|
||||||
|
|
||||||
private InputStream fetchFromUrlSpecific(String source, boolean optional) throws FHIRException {
|
private InputStream fetchFromUrlSpecific(String source, boolean optional) throws FHIRException {
|
||||||
try {
|
try {
|
||||||
SimpleHTTPClient http = new SimpleHTTPClient();
|
SimpleHTTPClient http = new SimpleHTTPClient();
|
||||||
|
|
Loading…
Reference in New Issue