MCPcopy Create free account
hub / github.com/rolldown/tsdown / esbuildTargetToLightningCSS

Function esbuildTargetToLightningCSS

packages/css/src/lightningcss.ts:173–199  ·  view source on GitHub ↗
(
  target: string[],
)

Source from the content-addressed store, hash-verified

171}
172
173export function esbuildTargetToLightningCSS(
174 target: string[],
175): Targets | undefined {
176 let targets: Targets | undefined
177
178 const targetString = target.join(' ').toLowerCase()
179 const matches = [...targetString.matchAll(TARGET_REGEX)]
180
181 for (const match of matches) {
182 const name = match[1]
183 const browser = ESBUILD_LIGHTNINGCSS_MAPPING[name]
184 if (!browser) {
185 continue
186 }
187
188 const version = match[2]
189 const versionInt = parseVersion(version)
190 if (versionInt == null) {
191 continue
192 }
193
194 targets = targets || {}
195 targets[browser] = versionInt
196 }
197
198 return targets
199}

Callers 3

bundleWithLightningCSSFunction · 0.85

Calls 1

parseVersionFunction · 0.85

Tested by

no test coverage detected