( chunkMetadataMap: ChunkMetadataMap, chunk: RenderedChunk | OutputChunk | OutputAsset, resetChunkMetadata = false, )
| 1475 | } |
| 1476 | |
| 1477 | function injectChunkMetadata( |
| 1478 | chunkMetadataMap: ChunkMetadataMap, |
| 1479 | chunk: RenderedChunk | OutputChunk | OutputAsset, |
| 1480 | resetChunkMetadata = false, |
| 1481 | ) { |
| 1482 | if (resetChunkMetadata) { |
| 1483 | chunkMetadataMap.reset(chunk) |
| 1484 | } |
| 1485 | // define instead of assign to avoid detected as a change |
| 1486 | // https://github.com/rolldown/rolldown/blob/f4c5ff27799f2b0152c689c398e61bc7d30429ff/packages/rolldown/src/utils/transform-to-rollup-output.ts#L87 |
| 1487 | Object.defineProperty(chunk, 'viteMetadata', { |
| 1488 | value: chunkMetadataMap.get(chunk), |
| 1489 | enumerable: true, |
| 1490 | }) |
| 1491 | if (chunk.type === 'chunk') { |
| 1492 | Object.defineProperty(chunk, 'modules', { |
| 1493 | get() { |
| 1494 | return chunk.viteMetadata!.__modules |
| 1495 | }, |
| 1496 | enumerable: true, |
| 1497 | }) |
| 1498 | } |
| 1499 | } |
| 1500 | |
| 1501 | function injectEnvironmentInContext<Context extends MinimalPluginContext>( |
| 1502 | context: Context, |
no test coverage detected