INNER CODE UNIT · JavaScript
transform
grafoojs/grafoo · packages/babel-plugin/src/index.js:4
export default function transform({ types: t }) {
return {
visitor: {
Program(programPath, { opts }) {
let tagIdentifiers = [];
let clientFactoryIdentifiers = [];
if (typeof opts.compress !== "boolean") {
opts.compress = process.env.NODE_ENV === "production";
}
if (typeof opts.generateIds !== "boolean") {
opts.generateIds = false;
}
if (!opts.idFields) {
throw new Error("@grafoo/babel-plugin: the `idFields` option is required.");
}