@@ -39,15 +39,14 @@ const EventHooksPlugin = require("event-hooks-webpack-plugin")
3939 * @return {Array<string> } Paths of dependent modules
4040 */
4141const resolve = module => {
42- const package = require ( path . resolve ( module , "package.json" ) )
43- return Object . keys ( package . dependencies || { } ) . reduce (
42+ const metadata = require ( path . resolve ( module , "package.json" ) )
43+ return Object . keys ( metadata . dependencies || { } ) . reduce (
4444 ( dependencies , name ) => {
4545 const dependency = path . resolve ( [ module , __dirname ] . find ( base => {
4646 return fs . existsSync ( path . resolve ( base , "node_modules" , name ) )
4747 } ) , "node_modules" , name )
4848 return [ ...dependencies , dependency , ...resolve ( dependency ) ]
49- } ,
50- [ ] )
49+ } , [ ] )
5150}
5251
5352/* ----------------------------------------------------------------------------
@@ -59,7 +58,7 @@ module.exports = {
5958
6059 /* Entrypoints */
6160 entry : {
62- push : path . resolve ( __dirname , "src/push.js" ) ,
61+ push : path . resolve ( __dirname , "src/push.js" ) ,
6362 status : path . resolve ( __dirname , "src/status.js" )
6463 } ,
6564
@@ -90,7 +89,7 @@ module.exports = {
9089
9190 /* Post-compilation hook to bundle sources with dependencies */
9291 new EventHooksPlugin ( {
93- ' done' : stats => {
92+ done : stats => {
9493 Object . keys ( stats . compilation . entrypoints ) . forEach ( name => {
9594 const entrypoint = stats . compilation . entrypoints [ name ]
9695 entrypoint . chunks . forEach ( chunk => {
@@ -106,15 +105,15 @@ module.exports = {
106105
107106 /* Bundle all non-native modules, except aws-sdk */
108107 if ( dependency . request && dependency . request !== "aws-sdk" &&
109- dependency . request . match ( / ^ [ ^ \ .] / ) ) {
108+ dependency . request . match ( / ^ [ ^ . ] / ) ) {
110109 const external = path . resolve (
111110 __dirname , "node_modules" , dependency . request )
112111 if ( fs . existsSync ( external ) ) {
113112 archive . directory ( external ,
114113 path . join ( "node_modules" , dependency . request ) )
115114
116115 /* Bundle nested dependencies */
117- resolve ( external ) . map ( subexternal => {
116+ resolve ( external ) . forEach ( subexternal => {
118117 archive . directory ( subexternal ,
119118 path . relative ( __dirname , subexternal ) )
120119 } )
@@ -124,7 +123,7 @@ module.exports = {
124123 } )
125124
126125 /* Append compiled sources to archive */
127- archive . directory ( path . resolve ( __dirname , "dist" , name ) , false ) ;
126+ archive . directory ( path . resolve ( __dirname , "dist" , name ) , false )
128127
129128 /* Finalize and write archive */
130129 archive . pipe ( zipfile )
0 commit comments