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 3
3
"version" : " 0.0.0-semantically-released" ,
4
4
"description" : " Validator of HTTP transactions (JavaScript implementation)" ,
5
5
"main" : " build/index.js" ,
6
+ "unpkg" : " build/index.umd.js" ,
7
+ "jsdelivr" : " build/index.umd.js" ,
6
8
"typings" : " typings.d.ts" ,
7
9
"engines" : {
8
10
"node" : " >= 8"
Original file line number Diff line number Diff line change @@ -5,10 +5,12 @@ const { terser } = require('rollup-plugin-terser');
5
5
6
6
const packageJson = require ( './package.json' ) ;
7
7
8
+ const dependencies = Object . keys ( packageJson . dependencies ) ;
9
+
8
10
const buildUmd = {
9
11
input : 'lib/index.js' ,
10
12
output : {
11
- file : packageJson . main ,
13
+ file : packageJson . unpkg ,
12
14
format : 'umd' ,
13
15
name : 'gavel' ,
14
16
exports : 'named' ,
@@ -28,4 +30,31 @@ const buildUmd = {
28
30
]
29
31
} ;
30
32
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