Acorn supports plugins that can redefine parser behavior, add new token types, or extend tokenizer contexts.
A plugin is a function that takes a parser class and returns an extended parser class. To use multiple plugins, use the Parser.extend static method, which accepts any number of plugin functions as arguments.
Best Practice: Create the extended parser class once and reuse it for multiple parse calls to help the JavaScript engine's optimizer.
const {Parser} = require("acorn")
const MyParser = Parser.extend(
require("acorn-jsx")(),
require("acorn-bigint")
)
console.log(MyParser.parse("// Some bigint + JSX code"))