Mirror: The magical sticky regex-based parser generator 馃
1import commonjs from '@rollup/plugin-commonjs'; 2import resolve from '@rollup/plugin-node-resolve'; 3import buble from '@rollup/plugin-buble'; 4import babel from 'rollup-plugin-babel'; 5import compiler from '@ampproject/rollup-plugin-closure-compiler'; 6 7import simplifyJSTags from './scripts/simplify-jstags-plugin.js'; 8 9const plugins = [ 10 commonjs({ 11 ignoreGlobal: true, 12 include: ['*', '**'], 13 extensions: ['.js', '.ts', '.tsx'], 14 }), 15 resolve({ 16 mainFields: ['module', 'jsnext', 'main'], 17 extensions: ['.js', '.ts', '.tsx'], 18 browser: true, 19 }), 20 buble({ 21 transforms: { 22 unicodeRegExp: false, 23 dangerousForOf: true, 24 templateString: false, 25 spreadRest: false, 26 }, 27 exclude: 'node_modules/**', 28 }), 29 babel({ 30 babelrc: false, 31 extensions: ['ts', 'tsx', 'js'], 32 exclude: 'node_modules/**', 33 presets: [], 34 plugins: ['babel-plugin-closure-elimination'], 35 }), 36]; 37 38const output = (format = 'cjs', ext = '.js') => ({ 39 chunkFileNames: '[hash]' + ext, 40 entryFileNames: 'reghex-[name]' + ext, 41 dir: './dist', 42 exports: 'named', 43 externalLiveBindings: false, 44 sourcemap: true, 45 esModule: false, 46 indent: false, 47 freeze: false, 48 strict: false, 49 format, 50 plugins: [ 51 simplifyJSTags(), 52 compiler({ 53 formatting: 'PRETTY_PRINT', 54 compilation_level: 'SIMPLE_OPTIMIZATIONS', 55 }), 56 ], 57}); 58 59const base = { 60 onwarn: () => {}, 61 external: () => false, 62 treeshake: { 63 propertyReadSideEffects: false, 64 }, 65 plugins, 66 output: [output('cjs', '.js'), output('esm', '.mjs')], 67}; 68 69export default [ 70 { 71 ...base, 72 input: { 73 core: './src/core.js', 74 }, 75 }, 76 { 77 ...base, 78 input: { 79 babel: './src/babel/plugin.js', 80 macro: './src/babel/macro.js', 81 }, 82 }, 83];