(packageURL, subpath, exports, conditions)
| 792 | return this.PACKAGE_EXPORTS_RESOLVE(packageURL, packageSubpath, pjson.exports, defaultConditions); |
| 793 | } |
| 794 | PACKAGE_EXPORTS_RESOLVE(packageURL, subpath, exports, conditions) { |
| 795 | let dotKeys = 0; |
| 796 | let noDotKeys = 0; |
| 797 | if ((typeof exports === "object") && (!Array.isArray(exports))) { |
| 798 | for (let key in exports) { |
| 799 | if (key.startsWith(".")) |
| 800 | dotKeys++; |
| 801 | else |
| 802 | noDotKeys++; |
| 803 | } |
| 804 | if ((dotKeys > 0) && (noDotKeys > 0)) |
| 805 | this.throwInvalidPackageConfigurationError(); |
| 806 | } |
| 807 | if (subpath === '.') { |
| 808 | let mainExport; |
| 809 | if (dotKeys == 0) |
| 810 | mainExport = exports; |
| 811 | else if ('.' in exports) |
| 812 | mainExport = exports['.']; |
| 813 | if (mainExport !== undefined) { |
| 814 | let resolved = this.PACKAGE_TARGET_RESOLVE(packageURL, mainExport, null, false, conditions); |
| 815 | if ((resolved !== undefined) && (resolved !== null)) |
| 816 | return resolved; |
| 817 | } |
| 818 | } |
| 819 | else if (dotKeys > 0) { |
| 820 | //@@ let matchKey = "./" + subpath; |
| 821 | let matchKey = subpath; |
| 822 | let resolved = this.PACKAGE_IMPORTS_EXPORTS_RESOLVE(matchKey, exports, packageURL, false, conditions); |
| 823 | if ((resolved !== undefined) && (resolved !== null)) |
| 824 | return resolved; |
| 825 | } |
| 826 | this.throwPackagePathNotExportedError(); |
| 827 | } |
| 828 | PACKAGE_IMPORTS_RESOLVE(specifier, parentURL, conditions) { |
| 829 | if ((specifier === '#') || specifier.startsWith("#/")) |
| 830 | this.throwInvalidModuleSpecifierError(); |
no test coverage detected