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 }, 26 exclude: 'node_modules/**', 27 }), 28 babel({ 29 babelrc: false, 30 extensions: ['ts', 'tsx', 'js'], 31 exclude: 'node_modules/**', 32 presets: [], 33 plugins: ['babel-plugin-closure-elimination'], 34 }), 35]; 36 37const output = (format = 'cjs', ext = '.js') => ({ 38 chunkFileNames: '[hash]' + ext, 39 entryFileNames: 'reghex-[name]' + ext, 40 dir: './dist', 41 exports: 'named', 42 externalLiveBindings: false, 43 sourcemap: true, 44 esModule: false, 45 indent: false, 46 freeze: false, 47 strict: false, 48 format, 49 plugins: [ 50 simplifyJSTags(), 51 compiler({ 52 formatting: 'PRETTY_PRINT', 53 compilation_level: 'SIMPLE_OPTIMIZATIONS', 54 }), 55 ], 56}); 57 58const base = { 59 onwarn: () => {}, 60 external: () => false, 61 treeshake: { 62 propertyReadSideEffects: false, 63 }, 64 plugins, 65 output: [output('cjs', '.js'), output('esm', '.mjs')], 66}; 67 68export default [ 69 { 70 ...base, 71 input: { 72 core: './src/core.js', 73 }, 74 }, 75 { 76 ...base, 77 input: { 78 babel: './src/babel/plugin.js', 79 macro: './src/babel/macro.js', 80 }, 81 }, 82];