'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var promises = require('fs/promises'); function equals(options = {}) { const { file: filename, replace = 'export = $1' } = options; const captureIdPattern = '([a-zA-Z$_][\\w$_]*)'; const strings = [`export default ${captureIdPattern}`, `export { ${captureIdPattern} as default }`]; const patterns = strings.map(str => new RegExp(str)); const replaceExport = code => { for (const pattern of patterns) { if (pattern.test(code)) { return code.replace(pattern, replace); } } return code; }; return { name: 'export-equals', renderChunk(code) { if (filename) { return; } return replaceExport(code); }, async writeBundle() { if (!filename) { return; } const content = await promises.readFile(filename, 'utf-8'); await promises.writeFile(filename, replaceExport(content)); } }; } exports.equals = equals; //# sourceMappingURL=export-equals.cjs.map