This repository was archived by the owner on Nov 8, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 33 "version" : " 0.0.0-semantically-released" ,
44 "description" : " Validator of HTTP transactions (JavaScript implementation)" ,
55 "main" : " build/index.js" ,
6+ "unpkg" : " build/index.umd.js" ,
7+ "jsdelivr" : " build/index.umd.js" ,
68 "typings" : " typings.d.ts" ,
79 "engines" : {
810 "node" : " >= 8"
Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ const { terser } = require('rollup-plugin-terser');
55
66const packageJson = require ( './package.json' ) ;
77
8+ const dependencies = Object . keys ( packageJson . dependencies ) ;
9+
810const buildUmd = {
911 input : 'lib/index.js' ,
1012 output : {
11- file : packageJson . main ,
13+ file : packageJson . unpkg ,
1214 format : 'umd' ,
1315 name : 'gavel' ,
1416 exports : 'named' ,
@@ -28,4 +30,31 @@ const buildUmd = {
2830 ]
2931} ;
3032
31- module . exports = [ buildUmd ] ;
33+ const buildCjs = {
34+ input : 'lib/index.js' ,
35+ output : {
36+ file : packageJson . main ,
37+ format : 'cjs' ,
38+ exports : 'named'
39+ } ,
40+ external : ( id ) => {
41+ if ( dependencies . includes ( id ) ) {
42+ return true ;
43+ }
44+
45+ return false ;
46+ } ,
47+ plugins : [
48+ resolve ( {
49+ browser : false ,
50+
51+ // Forbid bundling of NodeJS built-ins (i.e. "fs", "path").
52+ // Throw when such modules are present in the bundle.
53+ preferBuiltins : false
54+ } ) ,
55+ json ( ) ,
56+ commonjs ( )
57+ ]
58+ } ;
59+
60+ module . exports = [ buildUmd , buildCjs ] ;
You can’t perform that action at this time.
0 commit comments