Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Convert to ES6 that is supported on Node 4, commonjs modules and remove Babel #8

Closed
wants to merge 5 commits into from

Conversation

corbinu
Copy link
Contributor

@corbinu corbinu commented Feb 10, 2017

This removes Babel, converts to commonjs modules and removes other ES6 features not supported on Node 4. I think it was all destructuring.

Copy link
Member

@not-an-aardvark not-an-aardvark left a comment

Choose a reason for hiding this comment

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

Thanks! This generally looks good to me, I just have a suggestion about changing the export pattern to avoid using something like default as a key.

const Referencer = require('./referencer').default;
const Reference = require('./reference').default;
const Variable = require('./variable').default;
const Scope = require('./scope').default;
Copy link
Member

Choose a reason for hiding this comment

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

Can you use imports like require('./foo') here instead of require('./foo').default? Then the modules could use module.exports = Foo instead of module.exports.default = Foo.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was planning to do a style clean up PR at the end that would include this. Wanted to keep changes in each PR to a minimum but can change it now if people would prefer

Copy link
Member

Choose a reason for hiding this comment

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

I don't really have a strong opinion either way, but I think it makes more sense to change this here since it's a direct result of migrating from ES6 modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok will do!

import { Syntax } from 'estraverse';
import Map from 'es6-map';
const Syntax = require('estraverse').Syntax;
const Map = require('es6-map');
Copy link
Member

Choose a reason for hiding this comment

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

I think this import is unnecessary now since Map is included in Node 4. (That can be changed in a separate PR if necessary though.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@not-an-aardvark That is planned as a separate PR

constructor(scopeManager, upperScope, block) {
super(scopeManager, 'class', upperScope, block, false);
}
}

module.exports = {
"default": Scope,
Copy link
Member

Choose a reason for hiding this comment

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

Since this isn't using modules anymore, it might be better to use module.exports.Scope instead of module.exports.default.

@soda0289
Copy link
Member

Looks good. Nothing too drastic which is nice. I would remove the check node.body commit until the other pull request is approved.

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.

3 participants