'use strict'; var path = require('path'); var pluginutils = require('@rollup/pluginutils'); var archieml$1 = require('archieml'); // @ts-check /** * @typedef {import('@rollup/pluginutils').FilterPattern} FilterPattern * @typedef {import('vite').Plugin} Plugin * @typedef {{ include?: FilterPattern; exclude?: FilterPattern }} RollupArchieMLOptions */ /** * Convert `.aml` files into JavaScript modules. * @param {RollupArchieMLOptions} [options] * @returns {Plugin} */ function archieml(options = {}) { const filter = pluginutils.createFilter(options.include, options.exclude); return { name: "archieml", transform(code, id) { if (!filter(id)) return null; const ext = path.extname(id); if (ext !== `.aml`) return null; const parsed = archieml$1.archieml.load(code); return { code: `export default ${JSON.stringify(parsed, null, 2)};`, map: { mappings: "" }, }; }, }; } module.exports = archieml;