mirror of
https://github.com/actions/configure-pages.git
synced 2025-12-08 08:06:09 +00:00
Add support for 'Indirect default export with a wrapping call at the export'
This commit is contained in:
@@ -170,11 +170,28 @@ class ConfigParser {
|
|||||||
|
|
||||||
// Indirect default export with a wrapping call at the export
|
// Indirect default export with a wrapping call at the export
|
||||||
else if (
|
else if (
|
||||||
false
|
allowWrappingCall &&
|
||||||
// ...
|
defaultExport &&
|
||||||
|
defaultExport.declaration.type === 'CallExpression' &&
|
||||||
|
defaultExport.declaration.arguments.length > 0 &&
|
||||||
|
defaultExport.declaration.arguments[0] &&
|
||||||
|
defaultExport.declaration.arguments[0].type === 'Identifier'
|
||||||
) {
|
) {
|
||||||
core.info('Found configuration object in indirect default export declaration with a wrapping call at the export')
|
const identifierName = defaultExport.declaration.arguments[0].name
|
||||||
return defaultExport.declaration.arguments[0]
|
const identifierDefinition = ast.body.find(
|
||||||
|
node =>
|
||||||
|
node.type === 'VariableDeclaration' &&
|
||||||
|
node.declarations.length == 1 &&
|
||||||
|
node.declarations[0].type === 'VariableDeclarator' &&
|
||||||
|
node.declarations[0].id.type === 'Identifier' &&
|
||||||
|
node.declarations[0].id.name === identifierName &&
|
||||||
|
node.declarations[0].init
|
||||||
|
)
|
||||||
|
const identifierInitialization = identifierDefinition && identifierDefinition.declarations[0].init
|
||||||
|
if (identifierInitialization && identifierInitialization.type === 'ObjectExpression') {
|
||||||
|
core.info('Found configuration object in indirect default export declaration with a wrapping call at the export')
|
||||||
|
return identifierInitialization
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to find a module export
|
// Try to find a module export
|
||||||
|
|||||||
Reference in New Issue
Block a user