Surface `jison` errors
Co-authored-by: Alois Klink <alois@aloisklink.com>
This commit is contained in:
parent
a0fa8df0f1
commit
3a179170bb
|
@ -1,3 +1,6 @@
|
||||||
|
const { Generator } = require('jison');
|
||||||
|
const fs = require('fs');
|
||||||
|
|
||||||
/** @typedef {import('esbuild').BuildOptions} Options */
|
/** @typedef {import('esbuild').BuildOptions} Options */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,21 +49,14 @@ exports.umdBuild = (override = { minify: true }) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const { Generator } = require('jison');
|
|
||||||
let fs = require('fs');
|
|
||||||
const jisonPlugin = {
|
const jisonPlugin = {
|
||||||
name: 'jison',
|
name: 'jison',
|
||||||
setup(build) {
|
setup(build) {
|
||||||
build.onLoad({ filter: /\.jison$/ }, async (args) => {
|
build.onLoad({ filter: /\.jison$/ }, async (args) => {
|
||||||
// Load the file from the file system
|
// Load the file from the file system
|
||||||
let source = await fs.promises.readFile(args.path, 'utf8');
|
const source = await fs.promises.readFile(args.path, 'utf8');
|
||||||
|
const contents = new Generator(source, { 'token-stack': true }).generate();
|
||||||
try {
|
return { contents, warnings: [] };
|
||||||
let contents = new Generator(source, { 'token-stack': true }).generate();
|
|
||||||
return { contents, warnings: [] };
|
|
||||||
} catch (e) {
|
|
||||||
return { errors: [] };
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue