( environment: Environment, file: string, content: Buffer, )
| 566 | } |
| 567 | |
| 568 | function assetToDataURL( |
| 569 | environment: Environment, |
| 570 | file: string, |
| 571 | content: Buffer, |
| 572 | ) { |
| 573 | if (environment.config.build.lib && isGitLfsPlaceholder(content)) { |
| 574 | environment.logger.warn( |
| 575 | colors.yellow(`Inlined file ${file} was not downloaded via Git LFS`), |
| 576 | ) |
| 577 | } |
| 578 | |
| 579 | if (file.endsWith(class="st">'.svg')) { |
| 580 | return svgToDataURL(content) |
| 581 | } else { |
| 582 | const mimeType = mrmime.lookup(file) ?? class="st">'application/octet-stream' |
| 583 | class="cm">// base64 inlined as a string |
| 584 | return `data:${mimeType};base64,${content.toString(class="st">'base64')}` |
| 585 | } |
| 586 | } |
| 587 | |
| 588 | const nestedQuotesRE = /class="st">"[^"class="st">']*'[^class="st">"]*"|class="st">'[^'class="st">"]*"[^class="st">']*'/ |
| 589 |
no test coverage detected