(libraryMap: LibraryMap, componentName: string, npm?: IPublicTypeNpmInfo)
| 58 | } |
| 59 | |
| 60 | function findComponent(libraryMap: LibraryMap, componentName: string, npm?: IPublicTypeNpmInfo) { |
| 61 | if (!npm) { |
| 62 | return accessLibrary(componentName); |
| 63 | } |
| 64 | // libraryName the key access to global |
| 65 | // export { exportName } from xxx exportName === global.libraryName.exportName |
| 66 | // export exportName from xxx exportName === global.libraryName.default || global.libraryName |
| 67 | // export { exportName as componentName } from package |
| 68 | // if exportName == null exportName === componentName; |
| 69 | // const componentName = exportName.subName, if exportName empty subName donot use |
| 70 | const exportName = npm.exportName || npm.componentName || componentName; |
| 71 | const libraryName = libraryMap[npm.package] || exportName; |
| 72 | const library = accessLibrary(libraryName); |
| 73 | const paths = npm.exportName && npm.subName ? npm.subName.split('.') : []; |
| 74 | if (npm.destructuring) { |
| 75 | paths.unshift(exportName); |
| 76 | } else if (isESModule(library)) { |
| 77 | paths.unshift('default'); |
| 78 | } |
| 79 | return getSubComponent(library, paths); |
| 80 | } |
| 81 | |
| 82 | /** |
| 83 | * 判断是否是一个混合组件,即 components 是一个对象,对象值是 React 组件 |
no test coverage detected
searching dependent graphs…