I've noticed an issue in 1.7.1 with ExportSpecfier caused by b99a200
var esprima = require('esprima');
var escodegen = require('escodegen'); // 1.7.1
escodegen.generate(esprima.parse('export { foo };', sourceType: 'module'));
TypeError: Cannot read property 'name' of undefined
at CodeGenerator.Expression.ExportSpecifier (escodegen/escodegen.js:2266:54)
at CodeGenerator.generateExpression (escodegen/escodegen.js:2428:28)
...
On this line:
https://github.com/estools/escodegen/blob/master/escodegen.js#L2265
var exported = (expr.id || expr.imported).name;
This should either include the ExportSpecifier:
https://github.com/estree/estree/blob/master/es6.md#exportspecifier
var exported = (expr.id || expr.imported || expr.exported).name;
Or remove the ImportSpecifier and just include the ModuleSpecifier
https://github.com/estree/estree/blob/master/es6.md#modulespecifier
var exported = (expr.id || expr.local).name;
I'll raise a PR with a fix and some test cases to prevent this regression
I've noticed an issue in 1.7.1 with
ExportSpecfiercaused by b99a200On this line:
https://github.com/estools/escodegen/blob/master/escodegen.js#L2265
var exported = (expr.id || expr.imported).name;This should either include the ExportSpecifier:
https://github.com/estree/estree/blob/master/es6.md#exportspecifier
var exported = (expr.id || expr.imported || expr.exported).name;Or remove the ImportSpecifier and just include the ModuleSpecifier
https://github.com/estree/estree/blob/master/es6.md#modulespecifier
var exported = (expr.id || expr.local).name;I'll raise a PR with a fix and some test cases to prevent this regression