Compilation options.
import * as fs from 'node:fs';
import { createParser, htmlTokenizer } from 'mfml/parser';
import { compileFiles } from 'mfml/compiler';
const parser = createParser({ tokenizer: htmlTokenizer });
const compiler = createCompiler({ parser });
const files = await compiler.compile({
'en-US': {
messageCount: 'You have <b>{count, number}</b> unread messages',
messageReceived: '{gender, select, male {He} female {She} other {They}} sent you a message',
},
'ru-RU': {
messageCount: 'У вас <b>{count, number}</b> непрочитанных сообщений',
messageReceived: '{gender, select, male {Он отправил} female {Она отправила} other {Они отправили}} вам сообщение',
}
});
for (const file in files) {
fs.writeFileSync(file, files[file]);
}
Creates a compiler that converts MFML to a source code.