Skip to content
This repository has been archived by the owner on Aug 4, 2021. It is now read-only.

fix(scopes): Support Function and Class Declarations without id #28

Merged
merged 1 commit into from
May 7, 2018
Merged

fix(scopes): Support Function and Class Declarations without id #28

merged 1 commit into from
May 7, 2018

Conversation

danez
Copy link
Contributor

@danez danez commented Mar 19, 2018

Declarations without id are used in combination with default exports

export default function () {};

http://astexplorer.net/#/gist/cf7df7dd64907912d4c0b0c270c4d42c/39593db1b7ae5b05649f7d524e78f7439359602c

Without the fix I receive:

TypeError: Cannot read property 'type' of null
    at extractNames (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js:52:20)
    at Scope.addDeclaration (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js:86:3)
    at Object.enter (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js:108:11)
    at visit (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js:32:9)
    at visit (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js:51:4)
    at visit (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js:46:5)
    at Object.walk (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/node_modules/estree-walker/dist/estree-walker.umd.js:11:2)
    at Object.attachScopes (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-pluginutils/dist/pluginutils.cjs.js:103:15)
    at inject (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-plugin-node-globals/dist/rollup-plugin-node-globals.cjs.js:83:33)
    at Object.transform (/Users/danieltschinder/Documents/Github/babel/node_modules/rollup-plugin-node-globals/dist/rollup-plugin-node-globals.cjs.js:254:17)

//cc @Rich-Harris, @rollup :)

These declarations are used in combination with default exports
```
export default function () {};
```
@danez
Copy link
Contributor Author

danez commented Apr 11, 2018

@Rich-Harris I know pinging people directly is annoying, but I would really like to move forward with migrating babel-standalone to rollup and I'm blocked by this. So If you have a free minute I would really appreciate if you could review and if okay merge and release.

Copy link
Contributor

@guybedford guybedford left a comment

Choose a reason for hiding this comment

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

This looks good to me, will see if we can get this merged soon.

@lukastaegert
Copy link
Member

Note that by npm owner ls rollup-pluginutils, @Rich-Harris is currently the only person able to release new versions on npm. Maybe this should be extended...?

@Rich-Harris
Copy link
Contributor

Just saw this — @lukastaegert, have added you and Guy as npm owners. Perhaps we should eventually consider moving some of these packages into a @rollup scope

@lukastaegert lukastaegert merged commit c0f45be into rollup:master May 7, 2018
@danez danez deleted the fix/declarations branch June 9, 2018 08:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants