| 1 |
const isBabelPluginFactory = require("./is-babel-plugin-factory.cjs"); |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
module.exports = function isFromBabelTypes( |
| 6 |
origin , |
| 7 |
scope , |
| 8 |
) { |
| 9 |
if (origin.kind === "import" && origin.source === "@babel/types") { |
| 10 |
|
| 11 |
return true; |
| 12 |
} |
| 13 |
|
| 14 |
if ( |
| 15 |
origin.kind === "property" && |
| 16 |
origin.base.kind === "import" && |
| 17 |
origin.base.name === "types" && |
| 18 |
origin.base.source === "@babel/core" |
| 19 |
) { |
| 20 |
|
| 21 |
return true; |
| 22 |
} |
| 23 |
|
| 24 |
if ( |
| 25 |
origin.kind === "property" && |
| 26 |
origin.base.kind === "param" && |
| 27 |
origin.base.index === 0 |
| 28 |
) { |
| 29 |
return isBabelPluginFactory(origin.base.functionNode, scope); |
| 30 |
} |
| 31 |
|
| 32 |
return false; |
| 33 |
}; |