Skip to content

Commit

Permalink
a first try
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagoarrais committed Sep 16, 2019
1 parent 02f9826 commit 72e2ab6
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/babel-polyfill-provider-corejs3/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,15 @@ export default ((
},

usagePure(meta, utils, path) {
const isNamespaced = path => {
if (!path.node) return false;
const binding = path.scope.getBinding(path.node.name);
if (!binding) return false;
return binding.path.isImportNamespaceSpecifier();
};

if (isNamespaced(path.get("object"))) return false;

if (meta.kind === "in") {
if (meta.key === "Symbol.iterator") {
path.replaceWith(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as bar from "bar";
bar.map();
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"plugins": [
[
"@babel/plugin-inject-polyfills",
{
"method": "usage-pure",
"providers": ["@@/corejs3"]
}
]
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import * as bar from "bar";
bar.map();

0 comments on commit 72e2ab6

Please sign in to comment.