MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / PACKAGE_IMPORTS_RESOLVE

Method PACKAGE_IMPORTS_RESOLVE

tools/mcpack.js:828–841  ·  view source on GitHub ↗
(specifier, parentURL, conditions)

Source from the content-addressed store, hash-verified

826 this.throwPackagePathNotExportedError();
827 }
828 PACKAGE_IMPORTS_RESOLVE(specifier, parentURL, conditions) {
829 if ((specifier === '#') || specifier.startsWith("#/"))
830 this.throwInvalidModuleSpecifierError();
831 let packageURL = this.LOOKUP_PACKAGE_SCOPE(parentURL);
832 if (packageURL !== null) {
833 let pjson = this.READ_PACKAGE_JSON(packageURL);
834 if (pjson && pjson.imports && (typeof pjson.imports === "object")) {
835 let resolved = this.PACKAGE_IMPORTS_EXPORTS_RESOLVE(specifier, pjson.imports, packageURL, true, conditions);
836 if ((resolved !== undefined) && (resolved !== null))
837 return resolved;
838 }
839 }
840 this.throwInvalidModuleSpecifierError();
841 }
842 PACKAGE_IMPORTS_EXPORTS_RESOLVE(matchKey, matchObj, packageURL, isImports, conditions) {
843 if ((matchKey in matchObj) && (matchKey.indexOf('*') < 0)) {
844 let target = matchObj[matchKey];

Callers 1

ESM_RESOLVEMethod · 0.80

Tested by

no test coverage detected