Skip to content

Commit

Permalink
Add generator support
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Aug 2, 2023
1 parent cf0ad76 commit 83b601c
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/babel-generator/src/generators/modules.ts
Expand Up @@ -248,6 +248,10 @@ export function ImportDeclaration(this: Printer, node: t.ImportDeclaration) {
this.noIndentInnerCommentsHere();
this.word("module");
this.space();
} else if (node.phase) {
this.noIndentInnerCommentsHere();
this.word(node.phase);
this.space();
}

const specifiers = node.specifiers.slice(0);
Expand Down Expand Up @@ -315,6 +319,10 @@ export function ImportNamespaceSpecifier(

export function ImportExpression(this: Printer, node: t.ImportExpression) {
this.word("import");
if (node.phase) {
this.token(".");
this.word(node.phase);
}
this.token("(");
this.print(node.source, node);
if (node.options != null) {
Expand Down
@@ -0,0 +1,4 @@
{
"plugins": ["sourcePhaseImports"],
"parserOpts": { "createImportExpression": true }
}
@@ -0,0 +1 @@
import source x from "y";
@@ -0,0 +1 @@
import source x from "y";
@@ -0,0 +1 @@
import.source("x");
@@ -0,0 +1 @@
import.source("x");

0 comments on commit 83b601c

Please sign in to comment.