( input, exportsInfo, runtime, runtimeTemplate )
| 520 | * @returns {string | undefined} the module remapping |
| 521 | */ |
| 522 | const generateModuleRemapping = ( |
| 523 | input, |
| 524 | exportsInfo, |
| 525 | runtime, |
| 526 | runtimeTemplate |
| 527 | ) => { |
| 528 | if (exportsInfo.otherExportsInfo.getUsed(runtime) === UsageState.Unused) { |
| 529 | /** @type {string[]} */ |
| 530 | const properties = []; |
| 531 | for (const exportInfo of exportsInfo.orderedExports) { |
| 532 | const used = exportInfo.getUsedName(exportInfo.name, runtime); |
| 533 | if (!used) continue; |
| 534 | const nestedInfo = exportInfo.getNestedExportsInfo(); |
| 535 | if (nestedInfo) { |
| 536 | const nestedExpr = generateModuleRemapping( |
| 537 | `${input}${propertyAccess([exportInfo.name])}`, |
| 538 | nestedInfo |
| 539 | ); |
| 540 | if (nestedExpr) { |
| 541 | properties.push(`[${JSON.stringify(used)}]: y(${nestedExpr})`); |
| 542 | continue; |
| 543 | } |
| 544 | } |
| 545 | properties.push( |
| 546 | `[${JSON.stringify(used)}]: ${ |
| 547 | /** @type {RuntimeTemplate} */ (runtimeTemplate).returningFunction( |
| 548 | `${input}${propertyAccess([exportInfo.name])}` |
| 549 | ) |
| 550 | }` |
| 551 | ); |
| 552 | } |
| 553 | return `x({ ${properties.join(", ")} })`; |
| 554 | } |
| 555 | }; |
| 556 | |
| 557 | /** |
| 558 | * Gets source for module external. |
no test coverage detected