483 B16 lines
Blame
1import { readFile } from 'node:fs/promises';
2import { transformJison } from '../.build/jisonTransformer.js';
3import type { Plugin } from 'esbuild';
4
5export const jisonPlugin: Plugin = {
6 name: 'jison',
7 setup(build) {
8 build.onLoad({ filter: /\.jison$/ }, async (args) => {
9 // Load the file from the file system
10 const source = await readFile(args.path, 'utf8');
11 const contents = transformJison(source);
12 return { contents, warnings: [] };
13 });
14 },
15};
16