Skip to content

Commit

Permalink
provide compatibility with legacy ESTree AST
Browse files Browse the repository at this point in the history
  • Loading branch information
JLHwung committed Jun 7, 2023
1 parent 7f3c847 commit b0f9302
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/babel-parser/src/plugins/estree.ts
Expand Up @@ -426,6 +426,9 @@ export default (superClass: typeof Parser) =>
) {
(node as N.Node as N.EstreeImportExpression).options =
node.arguments[1] ?? null;
// compatibility with previous ESTree AST
(node as N.Node as N.EstreeImportExpression).attributes =
node.arguments[1] ?? null;
}
// arguments isn't optional in the type definition
delete node.arguments;
Expand Down
4 changes: 4 additions & 0 deletions packages/babel-parser/src/types.d.ts
Expand Up @@ -1220,6 +1220,10 @@ export interface EstreeImportExpression extends NodeBase {
type: "ImportExpression";
source: Expression;
options?: Expression | null;
/**
* @deprecated Use options instead
*/
attributes?: Expression | null;
}

export interface EstreePrivateIdentifier extends NodeBase {
Expand Down

0 comments on commit b0f9302

Please sign in to comment.