(content, id)
| 28 | name: 'yaml', |
| 29 | |
| 30 | transform(content, id) { |
| 31 | if (!extensions.some((ext) => id.toLowerCase().endsWith(ext))) return null; |
| 32 | if (!filter(id)) return null; |
| 33 | |
| 34 | let data = loadMethod(content); |
| 35 | |
| 36 | if (typeof options.transform === 'function') { |
| 37 | const result = options.transform(data, id); |
| 38 | // eslint-disable-next-line no-undefined |
| 39 | if (result !== undefined) { |
| 40 | data = result; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | const keys = Object.keys(data).filter((key) => key === makeLegalIdentifier(key)); |
| 45 | const code = `var data = ${toSource(data)};\n\n`; |
| 46 | const exports = ['export default data;'] |
| 47 | .concat(keys.map((key) => `export var ${key} = data.${key};`)) |
| 48 | .join('\n'); |
| 49 | |
| 50 | return { |
| 51 | code: code + exports, |
| 52 | map: { mappings: '' } |
| 53 | }; |
| 54 | } |
| 55 | }; |
| 56 | } |
nothing calls this directly
no test coverage detected