@@ -7,6 +7,7 @@ const glob = require('glob');
77const lib = require ( './index' ) ;
88const _ = require ( 'lodash' ) ;
99const Configuration = require ( './Configuration' ) ;
10+ const { getAllNodeFunctions } = require ( './utils' ) ;
1011
1112/**
1213 * For automatic entry detection we sort the found files to solve ambiguities.
@@ -109,7 +110,7 @@ module.exports = {
109110 // Expose entries - must be done before requiring the webpack configuration
110111 const entries = { } ;
111112
112- const functions = this . serverless . service . getAllFunctions ( ) ;
113+ const functions = getAllNodeFunctions . call ( this ) ;
113114 if ( this . options . function ) {
114115 const serverlessFunction = this . serverless . service . getFunction ( this . options . function ) ;
115116 const entry = getEntryForFunction . call ( this , this . options . function , serverlessFunction ) ;
@@ -222,23 +223,16 @@ module.exports = {
222223 }
223224
224225 // Lookup associated Serverless functions
225- const allEntryFunctions = _ . map (
226- _ . filter ( this . serverless . service . getAllFunctions ( ) , funcName => {
227- const func = this . serverless . service . getFunction ( funcName ) ;
228- const runtime = func . runtime || this . serverless . service . provider . runtime || 'nodejs' ;
229- return runtime . match ( / n o d e / ) ;
230- } ) ,
231- funcName => {
232- const func = this . serverless . service . getFunction ( funcName ) ;
233- const handler = getHandlerFileAndFunctionName ( func ) ;
234- const handlerFile = path . relative ( '.' , getHandlerFile ( handler ) ) ;
235- return {
236- handlerFile,
237- funcName,
238- func
239- } ;
240- }
241- ) ;
226+ const allEntryFunctions = _ . map ( getAllNodeFunctions . call ( this ) , funcName => {
227+ const func = this . serverless . service . getFunction ( funcName ) ;
228+ const handler = getHandlerFileAndFunctionName ( func ) ;
229+ const handlerFile = path . relative ( '.' , getHandlerFile ( handler ) ) ;
230+ return {
231+ handlerFile,
232+ funcName,
233+ func
234+ } ;
235+ } ) ;
242236
243237 this . entryFunctions = _ . flatMap ( entries , ( value , key ) => {
244238 const entry = path . relative ( '.' , value ) ;
0 commit comments