UNPKG

babel-plugin-transform-barrels

Version:

A Babel plugin that transforms indirect imports through a barrel file (index.js) into direct imports.

35 lines (30 loc) 822 B
let instance; class PluginOptions { static defaultOptions = { executorName: "other", alias: {}, extensions: [".js", ".jsx", ".mjs", ".cjs", ".ts", ".tsx"], modulesDirs: ["node_modules"], moduleIgnorePatterns: [], isCacheEnabled: false, logging: { type: "disabled", filePath: "log.txt" } }; constructor() { this.options = PluginOptions.defaultOptions; if (instance) { throw new Error("You can only create one instance!"); } instance = this; } setOptions(options) { this.options= { ...PluginOptions.defaultOptions, ...options }; } } const singletonPluginOptions = new PluginOptions(); module.exports = singletonPluginOptions;