-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #204 from codemod-js/handle-more-es-syntax
fix: allow loading plugins with additional JavaScript syntax
- Loading branch information
Showing
6 changed files
with
178 additions
and
2,122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { PluginObj } from '@babel/core'; | ||
|
||
class Count { | ||
// This file exists to verify that class properties like ↓ can be loaded. | ||
count: number = 0; | ||
|
||
incr(): void { | ||
this.count++; | ||
} | ||
} | ||
|
||
export default function(): PluginObj { | ||
const debuggerCount = new Count(); | ||
|
||
return { | ||
visitor: { | ||
DebuggerStatement(): void { | ||
debuggerCount.incr(); | ||
} | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { PluginObj } from '@babel/core'; | ||
|
||
// This file exists to verify that generator functions like ↓ can be loaded. | ||
function* counter(): IterableIterator<number> { | ||
let i = 0; | ||
|
||
while (true) { | ||
yield i++; | ||
} | ||
} | ||
|
||
export default function(): PluginObj { | ||
const identifiers = counter(); | ||
|
||
return { | ||
visitor: { | ||
Identifier(): void { | ||
console.log(identifiers.next()); | ||
} | ||
} | ||
}; | ||
} |
Oops, something went wrong.