Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add babel-plugin-transform-async-to-module-method to packageData.js #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions __tests__/__snapshots__/packageData.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ Object {
"@babel/template": "7.0.0-beta.39",
"@babel/traverse": "7.0.0-beta.39",
"@babel/types": "7.0.0-beta.39",
"[object Object]": "7.0.0-beta.39",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hzoo hmm... It seems better to expand it as a character string? But maybe it is difficult.🤔

expect(upgradeDeps(depsFixture, VERSION)).toMatchSnapshot();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just came across this while browsing older PRs!

if i'm understanding this correctly, it looks like this is upgradeDeps trying to print { module: 'bluebird', method: 'coroutine' } as a dependency?

think this emerges from the handling of plugins that need to be replaced by two dependencies:

'babel-plugin-syntax-export-extensions': ['@babel/plugin-syntax-export-default-from', '@babel/plugin-syntax-export-namespace-from'],

if (Array.isArray(newPackageName)) {
newPackageName.forEach(name => dependencies[name] = version);

we could check to make sure we only print strings to deps?

some stuff i was playing with in #55 might also relate here -- i was thinking about using some sort of object shape (as seen at https://github.com/babel/babel-upgrade/pull/55/files#diff-cf061c524d265adf7cfa52b35375795cR128) to describe deps that require more complicated transformations

"babel-loader": "^8.0.0-beta.0",
"rollup-plugin-babel": "^4.0.0-beta.2",
}
Expand Down
1 change: 1 addition & 0 deletions fixtures/deps.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"babel": "5.0.0",
"babel-plugin-transform-async-to-generator": "6.0.0",
"babel-plugin-transform-async-to-module-method": "6.0.0",
"babel-plugin-transform-eval": "6.0.0",
"babel-plugin-transform-exponentiation-operator": "6.0.0",
"babel-plugin-transform-flow-comments": "6.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/packageData.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const transformPlugins = {
'babel-plugin-transform-async-to-generator': '@babel/plugin-transform-async-to-generator',
'babel-plugin-transform-async-to-module-method': ['@babel/plugin-transform-async-to-generator', {
"module": 'bluebird',
"method": 'coroutine',
}],
'babel-plugin-transform-eval': '@babel/plugin-transform-eval',
'babel-plugin-transform-exponentiation-operator': '@babel/plugin-transform-exponentiation-operator',
'babel-plugin-transform-flow-comments': '@babel/plugin-transform-flow-comments',
Expand Down