Skip to content

Commit

Permalink
Add support for 'Indirect default export with a wrapping call at the …
Browse files Browse the repository at this point in the history
…definition'
  • Loading branch information
James M. Greene authored and James M. Greene committed Nov 21, 2022
1 parent 0c3c149 commit 24270f0
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/config-parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,23 +146,26 @@ class ConfigParser {
node.declarations[0].type === 'VariableDeclarator' &&
node.declarations[0].id.type === 'Identifier' &&
node.declarations[0].id.name === identifierName &&
node.declarations[0].init.type === 'ObjectExpression'
node.declarations[0].init
)
if (identifierDefinition) {
const identifierInitialization = identifierDefinition && identifierDefinition.declarations[0].init
if (identifierInitialization && identifierInitialization.type === 'ObjectExpression') {
core.info('Found configuration object in indirect default export declaration')
return identifierDefinition.declarations[0].init
return identifierInitialization
}
// Indirect default export with a wrapping call at the definition
else if (
identifierInitialization &&
identifierInitialization.type === 'CallExpression' &&
identifierInitialization.arguments.length > 0 &&
identifierInitialization.arguments[0] &&
identifierInitialization.arguments[0].type === 'ObjectExpression'
) {
core.info(
'Found configuration object in indirect default export declaration with a wrapping call at the definition'
)
return identifierInitialization.arguments[0]
}
}

// Indirect default export with a wrapping call at the definition
else if (
false
// ...
) {
core.info(
'Found configuration object in indirect default export declaration with a wrapping call at the definition'
)
return defaultExport.declaration.arguments[0]
}

// Indirect default export with a wrapping call at the export
Expand Down

0 comments on commit 24270f0

Please sign in to comment.