mermaid/.esbuild/jisonTransformer.cjs
Sidharth Vinod e0aae3e31f
Revert "fix(test): No esm exports"
This reverts commit c21c026749890990482f5f80993a86a3d1c5eef6.
2022-09-20 23:12:51 +05:30

15 lines
360 B
JavaScript

const { Generator } = require('jison');
exports.transformJison = (src) => {
const parser = new Generator(src, {
moduleType: 'js',
'token-stack': true,
});
const source = parser.generate({ moduleMain: '() => {}' });
const exporter = `
parser.parser = parser;
export { parser };
export default parser;
`;
return `${source} ${exporter}`;
};