github
2144 of 2329 branches covered (92.06%)
Branch coverage included in aggregate %.
128 of 149 new or added lines in 10 files covered. (85.91%)
79 existing lines in 1 file now uncovered.14408 of 15444 relevant lines covered (93.29%)
17580.5 hits per line
1 |
// Babel plugin for compiling .civet files
|
|
2 |
|
× |
3 |
/* Example babel.config.json:
|
× |
4 |
|
× |
5 |
{ |
× |
6 |
"plugins": [ |
× |
7 |
[ |
× |
8 |
"@danielx/civet/babel-plugin" |
× |
9 |
] |
× |
10 |
], |
× |
11 |
"sourceMaps": "inline" |
× |
12 |
} |
× |
13 |
|
× |
14 |
*/ |
× |
15 |
|
× |
16 |
import { compile } from "./main.mjs"
|
× |
17 |
|
× |
18 |
export default function (api, civetOptions) { |
× |
19 |
return {
|
× |
20 |
parserOverride(code, opts, parse) { |
× |
21 |
let src |
× |
22 |
if (opts.sourceFileName.endsWith(".civet")) { |
× |
NEW
|
const config = {
|
× |
NEW
|
...civetOptions, |
× |
25 |
filename: opts.sourceFileName, |
× |
26 |
sourceMap: false,
|
× |
NEW
|
sync: true, // parserOverride API is synchronous |
× |
NEW
|
} |
× |
29 |
|
× |
30 |
config.inlineMap ??= true
|
× |
31 |
config.js = true
|
× |
32 |
src = compile(code, config) |
× |
33 |
} else {
|
× |
34 |
src = code |
× |
35 |
} |
× |
36 |
|
× |
37 |
const ast = parse(src, opts)
|
× |
38 |
return ast
|
× |
39 |
} |
× |
40 |
} |
× |
41 |
} |
× |