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