( buildConfig: T, path: string, )
| 1256 | })() |
| 1257 | |
| 1258 | export function setupRollupOptionCompat< |
| 1259 | T extends Pick<BuildEnvironmentOptions, 'rollupOptions' | 'rolldownOptions'>, |
| 1260 | >( |
| 1261 | buildConfig: T, |
| 1262 | path: string, |
| 1263 | ): asserts buildConfig is T & { |
| 1264 | rolldownOptions: Exclude<T['rolldownOptions'], undefined> |
| 1265 | } { |
| 1266 | // if both rollupOptions and rolldownOptions are present, |
| 1267 | // ignore rollupOptions and use rolldownOptions |
| 1268 | buildConfig.rolldownOptions ??= buildConfig.rollupOptions |
| 1269 | if ( |
| 1270 | runtimeDeprecatedPath.has(path) && |
| 1271 | buildConfig.rollupOptions && |
| 1272 | buildConfig.rolldownOptions !== buildConfig.rollupOptions |
| 1273 | ) { |
| 1274 | rollupOptionsDeprecationCall() |
| 1275 | } |
| 1276 | |
| 1277 | // proxy rolldownOptions to rollupOptions |
| 1278 | Object.defineProperty(buildConfig, 'rollupOptions', { |
| 1279 | get() { |
| 1280 | return buildConfig.rolldownOptions |
| 1281 | }, |
| 1282 | set(newValue) { |
| 1283 | if (runtimeDeprecatedPath.has(path)) { |
| 1284 | rollupOptionsDeprecationCall() |
| 1285 | } |
| 1286 | buildConfig.rolldownOptions = newValue |
| 1287 | }, |
| 1288 | configurable: true, |
| 1289 | enumerable: true, |
| 1290 | }) |
| 1291 | } |
| 1292 | |
| 1293 | const rollupOptionsRootPaths = new Set([ |
| 1294 | 'build', |
no test coverage detected