( esbuildTarget: string | string[] | false, )
| 3543 | LightningCSSOptions['targets'] |
| 3544 | >() |
| 3545 | export const convertTargets = ( |
| 3546 | esbuildTarget: string | string[] | false, |
| 3547 | ): LightningCSSOptions['targets'] => { |
| 3548 | if (!esbuildTarget) return {} |
| 3549 | const cached = convertTargetsCache.get(esbuildTarget) |
| 3550 | if (cached) return cached |
| 3551 | const targets: LightningCSSOptions['targets'] = {} |
| 3552 | |
| 3553 | const entriesWithoutES = arraify(esbuildTarget).flatMap((e) => { |
| 3554 | const match = esRE.exec(e) |
| 3555 | if (!match) return e |
| 3556 | const year = match[1] === '6' ? 2015 : Number(match[1]) |
| 3557 | if (!esMap[year]) throw new Error(`Unsupported target "${e}"`) |
| 3558 | return esMap[year] |
| 3559 | }) |
| 3560 | |
| 3561 | for (const entry of entriesWithoutES) { |
| 3562 | if (entry === 'esnext') continue |
| 3563 | const index = entry.search(versionRE) |
| 3564 | if (index >= 0) { |
| 3565 | const browser = map[entry.slice(0, index)] |
| 3566 | if (browser === false) continue // No mapping available |
| 3567 | if (browser) { |
| 3568 | const [major, minor = 0] = entry |
| 3569 | .slice(index) |
| 3570 | .split('.') |
| 3571 | .map((v) => parseInt(v, 10)) |
| 3572 | if (!isNaN(major) && !isNaN(minor)) { |
| 3573 | const version = (major << 16) | (minor << 8) |
| 3574 | if (!targets[browser] || version < targets[browser]!) { |
| 3575 | targets[browser] = version |
| 3576 | } |
| 3577 | continue |
| 3578 | } |
| 3579 | } |
| 3580 | } |
| 3581 | throw new Error(`Unsupported target "${entry}"`) |
| 3582 | } |
| 3583 | |
| 3584 | convertTargetsCache.set(esbuildTarget, targets) |
| 3585 | return targets |
| 3586 | } |
| 3587 | |
| 3588 | export function resolveLibCssFilename( |
| 3589 | libOptions: LibraryOptions, |
no test coverage detected