Skip to content

Conversation

@nicolo-ribaudo
Copy link
Contributor

In Babel 7.12, we changed the output for export * from "mod" to better simulate esm semantics:

 var _mod = require("mod");

 Object.keys(_mod).forEach(function (key) {
   if (key === "default" || key === "__esModule") return;
+  if (key in exports && exports[key] === _mod[key]) return;
   Object.defineProperty(exports, key, {
     enumerable: true,
     get: function () {
       return _mod[key];
     }
   });
 });

This PR updates cjs-module-lexer to also recognize the new output.

else break;

// `if (` IDENTIFIER$2 `in` EXPORTS_IDENTIFIER `&&` EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] ===` IDENTIFIER$1 `[` IDENTIFIER$2 `]) return` `;`?
if (ch === 105/*i*/ && source.startsWith('f ', pos + 1)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I copied 'f ' from other parts of the code, but I think it could also be f(?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice catch, yes we should probably allow the missing space.

Copy link
Collaborator

@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.

Thanks so much for looking into this @nicolo-ribaudo! I'm going to go ahead and merge and release to upstream asap. And I thought you were working on scope problems there too :)

else break;

// `if (` IDENTIFIER$2 `in` EXPORTS_IDENTIFIER `&&` EXPORTS_IDENTIFIER `[` IDENTIFIER$2 `] ===` IDENTIFIER$1 `[` IDENTIFIER$2 `]) return` `;`?
if (ch === 105/*i*/ && source.startsWith('f ', pos + 1)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice catch, yes we should probably allow the missing space.

@guybedford guybedford merged commit 31b1d38 into nodejs:master Oct 21, 2020
@nicolo-ribaudo nicolo-ribaudo deleted the babel-7.12 branch March 1, 2021 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants