Skip to content

commonjs: simplify the output for a single default import - #6039

Closed
hzoo wants to merge 4 commits into
masterfrom
temp
Closed

hzoo wants to merge 4 commits into
masterfrom
temp

Conversation

@hzoo

@hzoo hzoo commented Aug 1, 2017

Copy link
Copy Markdown
Member

Rebasing #3585 into 7.0

@mention-bot

Copy link
Copy Markdown

@hzoo, thanks for your PR! By analyzing the history of the files in this pull request, we identified @danez, @loganfsmyth and @kpdecker to be potential reviewers.

@@ -1,6 +0,0 @@
for (var i = 0; i < 5; i++) {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

unused (the test is throwing so this file is uncessary)

_foo.bar();

_foo.baz(); No newline at end of file
foo.bar();

@hzoo hzoo Aug 1, 2017 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is wrong it's ok now if foo is the same

uid = addRequire(source, maxBlockHoist, {
inline: this.addHelper("interopRequireWildcard")
inline: this.addHelper("interopRequireWildcard"),
identifier: specifiers[0].local,

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

added this to reuse for import * as a from './a' to use a as the identifier instead of

const ref = opts.identifier
              ? opts.identifier
              : path.scope.generateUidIdentifier(
                basename(source, extname(source))
              );

var _foo2 = babelHelpers.interopRequireDefault(_foo);

/*after*/
foo = babelHelpers.interopRequireDefault(require("foo2"));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Seems to me this should be before after ?

@xtuc xtuc added PR: Internal 🏠 A type of pull request used for our changelog categories PR: Polish 💅 A type of pull request used for our changelog categories labels Aug 6, 2017

console.log(_props2.default);
var props = babelHelpers.interopRequireDefault(require("props"));
console.log(props);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be props.default.

key: "send",
value: function send(message) {
this.sock.write(_binarySerializer2.default.serializeMessage(message));
this.sock.write(BinarySerializer.serializeMessage(message));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be BinarySerializer.default


function hasSingleDefaultImport(specifiers) {
if (specifiers.length !== 1) {
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

return false.

This was referenced Aug 9, 2017
@danez danez closed this Aug 31, 2017
@danez danez reopened this Aug 31, 2017
@danez
danez changed the base branch from 7.0 to master August 31, 2017 17:01
@hzoo hzoo removed the PR: Internal 🏠 A type of pull request used for our changelog categories label Aug 31, 2017
@hzoo hzoo added this to the Babel 7.next milestone Aug 31, 2017
@jessekoester

Copy link
Copy Markdown

@hzoo I've looked over this comment 18 times before I submitted it.

@xtuc
xtuc deleted the temp branch September 13, 2017 09:05
@lock lock Bot added the outdated A closed issue/PR that is archived due to age. Recommended to make a new issue label Oct 5, 2019
@lock lock Bot locked as resolved and limited conversation to collaborators Oct 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

outdated A closed issue/PR that is archived due to age. Recommended to make a new issue PR: Polish 💅 A type of pull request used for our changelog categories

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants