* The module a value's initializer hands a lazy loader, and the export the * loader resolves to — `default` unless it picks one: `lazy(() => * import('./x'))`, wrapped or not (`Loadable(lazy(…))`, `loadable(…)`, * `dynamic(…, { ssr: false })`, `Loadable({ loader: () => import(…) })`), * `dynamic
(declaration: Node, context: ResolutionContext)
| 745 | * what it returns renders, and what it imports is its own business. |
| 746 | */ |
| 747 | function valueLoader(declaration: Node, context: ResolutionContext): { spec: string; member: string } | null { |
| 748 | const code = stripCommentsForRegex(declarationText(declaration, context), 'typescript'); |
| 749 | const init = initializerAt(code, declaration.name.length); |
| 750 | const loader = init < 0 ? null : loaderOf(code.slice(init)); |
| 751 | if (!loader) return null; |
| 752 | const page = loadedPage(loaderValue(loader, new Map())); |
| 753 | if (page) return page; |
| 754 | const fn = functionParts(loader); |
| 755 | const spec = fn && !fn.block ? FIRST_IMPORT.exec(fn.body)?.[1] : undefined; |
| 756 | return spec ? { spec, member: 'default' } : null; |
| 757 | } |
| 758 | |
| 759 | /** |
| 760 | * The loader function an initializer hands a lazy wrapper: the first function |
no test coverage detected