mermaid/.vite/jisonPlugin.ts

18 lines
370 B
TypeScript
Raw Normal View History

2022-09-22 15:35:22 +05:30
import { transformJison } from './jisonTransformer.js';
const fileRegex = /\.(jison)$/;
export default function jison() {
return {
name: 'jison',
2022-09-23 10:56:39 +05:30
transform(src: string, id: string) {
2022-09-22 15:35:22 +05:30
if (fileRegex.test(id)) {
return {
code: transformJison(src),
map: null, // provide source map if available
};
}
},
};
}