| 
									
										
										
										
											2021-02-06 10:59:00 +08:00
										 |  |  | import alias from '@rollup/plugin-alias'; | 
					
						
							|  |  |  | import babel from '@rollup/plugin-babel'; | 
					
						
							|  |  |  | import commonjs from '@rollup/plugin-commonjs'; | 
					
						
							|  |  |  | import json from '@rollup/plugin-json'; | 
					
						
							|  |  |  | import multi from '@rollup/plugin-multi-entry'; | 
					
						
							|  |  |  | import nodeResolve from '@rollup/plugin-node-resolve'; | 
					
						
							|  |  |  | import nodePolyfills from 'rollup-plugin-node-polyfills'; | 
					
						
							|  |  |  | import replace from '@rollup/plugin-replace'; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-15 13:08:10 +08:00
										 |  |  | const extensions = ['.js', '.ts']; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-02-06 10:59:00 +08:00
										 |  |  | export default { | 
					
						
							|  |  |  |   input: { | 
					
						
							| 
									
										
										
										
											2021-03-15 13:08:10 +08:00
										 |  |  |     include: ['test/**/*.test.ts'], | 
					
						
							|  |  |  |     exclude: ['test/agent-manager.test.ts', 'test/bpf-loader.test.ts'], | 
					
						
							| 
									
										
										
										
											2021-02-06 10:59:00 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  |   external: ['node-forge', 'http2', '_stream_wrap'], | 
					
						
							|  |  |  |   output: { | 
					
						
							|  |  |  |     file: 'test/dist/bundle.js', | 
					
						
							|  |  |  |     format: 'es', | 
					
						
							|  |  |  |     sourcemap: true, | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   plugins: [ | 
					
						
							|  |  |  |     multi(), | 
					
						
							|  |  |  |     commonjs(), | 
					
						
							|  |  |  |     nodeResolve({ | 
					
						
							|  |  |  |       browser: true, | 
					
						
							|  |  |  |       preferBuiltins: false, | 
					
						
							| 
									
										
										
										
											2021-03-15 13:08:10 +08:00
										 |  |  |       extensions, | 
					
						
							| 
									
										
										
										
											2021-02-06 10:59:00 +08:00
										 |  |  |       dedupe: ['bn.js', 'buffer'], | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  |     babel({ | 
					
						
							|  |  |  |       exclude: '**/node_modules/**', | 
					
						
							| 
									
										
										
										
											2021-03-15 13:08:10 +08:00
										 |  |  |       extensions, | 
					
						
							| 
									
										
										
										
											2021-02-06 10:59:00 +08:00
										 |  |  |       babelHelpers: 'runtime', | 
					
						
							|  |  |  |       plugins: ['@babel/plugin-transform-runtime'], | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  |     nodePolyfills(), | 
					
						
							|  |  |  |     replace({ | 
					
						
							|  |  |  |       'process.env.BROWSER': 'true', | 
					
						
							|  |  |  |       'process.env.TEST_LIVE': 'true', | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  |     alias({ | 
					
						
							|  |  |  |       entries: [ | 
					
						
							|  |  |  |         { | 
					
						
							|  |  |  |           find: /^\.\.\/src\/.*\.js$/, | 
					
						
							|  |  |  |           replacement: './lib/index.browser.esm.js', | 
					
						
							|  |  |  |         }, | 
					
						
							|  |  |  |       ], | 
					
						
							|  |  |  |     }), | 
					
						
							|  |  |  |     json(), | 
					
						
							|  |  |  |   ], | 
					
						
							|  |  |  |   onwarn: function (warning, rollupWarn) { | 
					
						
							|  |  |  |     if (warning.code !== 'CIRCULAR_DEPENDENCY' && warning.code !== 'EVAL') { | 
					
						
							|  |  |  |       rollupWarn(warning); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |   }, | 
					
						
							|  |  |  |   treeshake: { | 
					
						
							| 
									
										
										
										
											2021-03-15 13:08:10 +08:00
										 |  |  |     moduleSideEffects: path => path.endsWith('test.ts'), | 
					
						
							| 
									
										
										
										
											2021-02-06 10:59:00 +08:00
										 |  |  |   }, | 
					
						
							|  |  |  | }; |