1 | const Asset = require('../Asset');
|
2 | const toml = require('@iarna/toml');
|
3 | const serializeObject = require('../utils/serializeObject');
|
4 |
|
5 | class TOMLAsset extends Asset {
|
6 | constructor(name, options) {
|
7 | super(name, options);
|
8 | this.type = 'js';
|
9 | }
|
10 |
|
11 | parse(code) {
|
12 | return toml.parse(code);
|
13 | }
|
14 |
|
15 | generate() {
|
16 | return serializeObject(
|
17 | this.ast,
|
18 | this.options.minify && !this.options.scopeHoist
|
19 | );
|
20 | }
|
21 | }
|
22 |
|
23 | module.exports = TOMLAsset;
|