File tree Expand file tree Collapse file tree 4 files changed +256
-196
lines changed
Expand file tree Collapse file tree 4 files changed +256
-196
lines changed Original file line number Diff line number Diff line change @@ -12,3 +12,5 @@ coverage/
1212
1313npm-debug.log
1414.vimrc.local
15+
16+ dist
Original file line number Diff line number Diff line change 33 "description" : " ECMAScript JS AST traversal functions" ,
44 "homepage" : " https://github.com/estools/estraverse" ,
55 "bugs" : " https://github.com/estools/estraverse/issues" ,
6- "main" : " estraverse.js" ,
6+ "main" : " dist/estraverse.min.js" ,
7+ "module" : " dist/estraverse.esm.min.js" ,
78 "version" : " 5.3.0" ,
89 "engines" : {
910 "node" : " >=4.0"
3233 "@babel/core" : " ^7.17.5" ,
3334 "@babel/preset-env" : " ^7.16.11" ,
3435 "@babel/register" : " ^7.17.0" ,
36+ "@rollup/plugin-babel" : " ^5.0.0" ,
3537 "chai" : " ^4.3.6" ,
3638 "eslint" : " ^6.8.0" ,
3739 "espree" : " ^9.3.1" ,
3840 "esprima" : " ^4.0.1" ,
3941 "mocha" : " ^9.2.1" ,
40- "nyc" : " ^15.1.0"
42+ "nyc" : " ^15.1.0" ,
43+ "rollup" : " ^2.7.3" ,
44+ "rollup-plugin-terser" : " ^5.3.0"
4145 },
4246 "license" : " BSD-2-Clause" ,
4347 "nyc" : {
5458 ]
5559 },
5660 "scripts" : {
61+ "build" : " rollup -c" ,
5762 "test" : " npm run lint && npm run unit-test" ,
5863 "lint" : " eslint ." ,
5964 "unit-test" : " nyc mocha --require chai/register-expect.js --require @babel/register"
Original file line number Diff line number Diff line change 1+ import { terser } from 'rollup-plugin-terser' ;
2+
3+ import babel from '@rollup/plugin-babel' ;
4+
5+ /**
6+ * @external RollupConfig
7+ * @type {PlainObject }
8+ * @see {@link https://rollupjs.org/guide/en#big-list-of-options }
9+ */
10+
11+ /**
12+ * @param {PlainObject } [config= {}]
13+ * @param {boolean } [config.minifying=false]
14+ * @param {string } [config.format='umd']
15+ * @returns {external:RollupConfig }
16+ */
17+ function getRollupObject ( { minifying, format = 'umd' } = { } ) {
18+ const nonMinified = {
19+ input : 'src/estraverse.js' ,
20+ output : {
21+ format,
22+ sourcemap : minifying ,
23+ file : `dist/estraverse${
24+ format === 'umd' ? '' : `.${ format } `
25+ } ${ minifying ? '.min' : '' } .js`,
26+ name : 'estraverse'
27+ } ,
28+ plugins : [
29+ babel ( {
30+ babelHelpers : 'bundled'
31+ } )
32+ ]
33+ } ;
34+ if ( minifying ) {
35+ nonMinified . plugins . push ( terser ( ) ) ;
36+ }
37+ return nonMinified ;
38+ }
39+
40+ export default [
41+ getRollupObject ( { minifying : true , format : 'umd' } ) ,
42+ getRollupObject ( { minifying : false , format : 'umd' } ) ,
43+ getRollupObject ( { minifying : true , format : 'esm' } ) ,
44+ getRollupObject ( { minifying : false , format : 'esm' } )
45+ ] ;
You can’t perform that action at this time.
0 commit comments