(source: string)
| 82 | * covers nothing. |
| 83 | */ |
| 84 | export function sfcBlockLineRanges(source: string): Array<[number, number]> { |
| 85 | const ranges: Array<[number, number]> = []; |
| 86 | const elements = new RegExp(SFC_SCRIPT_OR_STYLE_ELEMENT); |
| 87 | let match: RegExpExecArray | null; |
| 88 | while ((match = elements.exec(source)) !== null) { |
| 89 | if (!sfcElementHasBody(match[0])) continue; |
| 90 | const startLine = (source.substring(0, match.index).match(/\n/g) || []).length; |
| 91 | ranges.push([startLine, startLine + (match[0].match(/\n/g) || []).length]); |
| 92 | } |
| 93 | return ranges; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * Whether a `<script>` element's attributes leave it JavaScript or |
no test coverage detected