Skip to content

Commit

Permalink
Merge pull request #1 from papandreou/support-dynamic-import
Browse files Browse the repository at this point in the history
  • Loading branch information
Munter committed Aug 5, 2019
2 parents 83c058f + f5157e4 commit 2bf769f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions estraverse.js
Expand Up @@ -108,7 +108,7 @@
GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.
Identifier: 'Identifier',
IfStatement: 'IfStatement',
Import: 'ImportExpression',
ImportExpression: 'ImportExpression',
ImportDeclaration: 'ImportDeclaration',
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
Expand Down Expand Up @@ -183,7 +183,7 @@
GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
Identifier: [],
IfStatement: ['test', 'consequent', 'alternate'],
Import: ['argument'],
ImportExpression: ['source'],
ImportDeclaration: ['specifiers', 'source'],
ImportDefaultSpecifier: ['local'],
ImportNamespaceSpecifier: ['local'],
Expand Down
21 changes: 7 additions & 14 deletions test/es6.js
Expand Up @@ -330,25 +330,18 @@ describe('dynamic import', function() {
// });

const tree = {
type: 'CallExpression',
callee: {
type: 'Import'
},
arguments: [
{
type: 'Literal',
value: 'rabbit-house'
}
]
type: 'ImportExpression',
source: {
type: 'Literal',
value: 'rabbit-house'
}
};

checkDump(Dumper.dump(tree), `
enter - CallExpression
enter - Import
leave - Import
enter - ImportExpression
enter - Literal
leave - Literal
leave - CallExpression
leave - ImportExpression
`);
});
});
Expand Down

0 comments on commit 2bf769f

Please sign in to comment.