( libOptions: LibraryOptions, root: string, packageCache?: PackageCache, )
| 3583 | } |
| 3584 | |
| 3585 | export function resolveLibCssFilename( |
| 3586 | libOptions: LibraryOptions, |
| 3587 | root: string, |
| 3588 | packageCache?: PackageCache, |
| 3589 | ): string { |
| 3590 | if (typeof libOptions.cssFileName === 'string') { |
| 3591 | return `${libOptions.cssFileName}.css` |
| 3592 | } else if (typeof libOptions.fileName === 'string') { |
| 3593 | return `${libOptions.fileName}.css` |
| 3594 | } |
| 3595 | |
| 3596 | const packageJson = findNearestMainPackageData(root, packageCache)?.data |
| 3597 | const name = packageJson ? getPkgName(packageJson.name) : undefined |
| 3598 | |
| 3599 | if (!name) |
| 3600 | throw new Error( |
| 3601 | 'Name in package.json is required if option "build.lib.cssFileName" is not provided.', |
| 3602 | ) |
| 3603 | |
| 3604 | return `${name}.css` |
| 3605 | } |
no test coverage detected