swc/tests/projects/issue-1203/input.js
강동윤 af0b0a9ab1
Fix fixer (#1207)
swc_ecma_transforms:
 - fixer: Don't unwrap paren if there's a comment for inner node.
2020-11-08 10:59:36 +09:00

9 lines
361 B
JavaScript

function isModuleWrapper(node) {
return (
// It's an anonymous function expression that wraps module
(node.type === 'FunctionExpression' && !node.id) ||
node.type === 'ArrowFunctionExpression' ||
isModuleId(node) ||
(node.type === 'ArrayExpression' && node.elements.length > 1 && isModuleId(node.elements[0]))
)
}