* The modules a route's answer is read from: a lazily loaded page or layout * (`lazy-import:` references, and `import:…#…` for the export a loader * picks), or the one a same-file lazy value the route renders, or renders * inside, loads (`declaredComponent`) — with the modules a barrel ther
(ref: UnresolvedRef, context: ResolutionContext)
| 242 | * forwards the lookup to. |
| 243 | */ |
| 244 | lazyModules(ref: UnresolvedRef, context: ResolutionContext): readonly string[] { |
| 245 | const name = ref.referenceName; |
| 246 | const picked = isReactRouteRef(ref) ? PICKED_EXPORT.exec(name.startsWith(LAYOUT_PREFIX) ? name.slice(LAYOUT_PREFIX.length) : name) : null; |
| 247 | if (picked) { |
| 248 | const reads = new Set<string>(); |
| 249 | pickedExport(picked[1]!, picked[2]!, ref.filePath, context, reads); |
| 250 | return [...reads]; |
| 251 | } |
| 252 | let spec: string | null | undefined; |
| 253 | if (name.startsWith(LAZY_ROUTE_PREFIX)) spec = name.slice(LAZY_ROUTE_PREFIX.length); |
| 254 | else if (name.startsWith(LAYOUT_PREFIX + LAZY_ROUTE_PREFIX)) spec = name.slice(LAYOUT_PREFIX.length + LAZY_ROUTE_PREFIX.length); |
| 255 | else if (isReactRouteRef(ref)) { |
| 256 | // A page or layout the route file declares as a value it loads lazily. |
| 257 | const own = name.startsWith(LAYOUT_PREFIX) ? name.slice(LAYOUT_PREFIX.length) : name; |
| 258 | const loaded = isPascalCase(own) && !isBuiltInType(own) ? declaredLoader(own, ref.filePath, context) : undefined; |
| 259 | if (loaded && loaded.member !== 'default') { |
| 260 | const reads = new Set<string>(); |
| 261 | pickedExport(loaded.spec, loaded.member, ref.filePath, context, reads); |
| 262 | return [...reads]; |
| 263 | } |
| 264 | spec = loaded?.spec; |
| 265 | } |
| 266 | return spec ? lazyRouteFiles(spec, ref.filePath, context) : []; |
| 267 | }, |
| 268 | }; |
| 269 | |
| 270 | const LAZY_ROUTE_PREFIX = 'lazy-import:'; |
nothing calls this directly
no test coverage detected