fix import specifier and export specifier keys
This commit is contained in:
parent
92359520cd
commit
2a09c0a5a5
@ -355,16 +355,24 @@ t.getIds = function (node, map, ignoreTypes) {
|
|||||||
if (!id) continue;
|
if (!id) continue;
|
||||||
if (_.contains(ignoreTypes, id.type)) continue;
|
if (_.contains(ignoreTypes, id.type)) continue;
|
||||||
|
|
||||||
var nodeKey = t.getIds.nodes[id.type];
|
var nodeKeys = t.getIds.nodes[id.type];
|
||||||
var arrKeys = t.getIds.arrays[id.type];
|
var arrKeys = t.getIds.arrays[id.type];
|
||||||
|
|
||||||
|
var i, key;
|
||||||
|
|
||||||
if (t.isIdentifier(id)) {
|
if (t.isIdentifier(id)) {
|
||||||
ids[id.name] = id;
|
ids[id.name] = id;
|
||||||
} else if (nodeKey) {
|
} else if (nodeKeys) {
|
||||||
if (id[nodeKey]) search.push(id[nodeKey]);
|
for (i in nodeKeys) {
|
||||||
|
key = nodeKeys[i];
|
||||||
|
if (id[key]) {
|
||||||
|
search.push(id[key]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (arrKeys) {
|
} else if (arrKeys) {
|
||||||
for (var i in arrKeys) {
|
for (i in arrKeys) {
|
||||||
var key = arrKeys[i];
|
key = arrKeys[i];
|
||||||
search = search.concat(id[key] || []);
|
search = search.concat(id[key] || []);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -375,15 +383,15 @@ t.getIds = function (node, map, ignoreTypes) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
t.getIds.nodes = {
|
t.getIds.nodes = {
|
||||||
AssignmentExpression: "left",
|
AssignmentExpression: ["left"],
|
||||||
ImportSpecifier: "name",
|
ImportSpecifier: ["name", "id"],
|
||||||
ExportSpecifier: "name",
|
ExportSpecifier: ["name", "id"],
|
||||||
VariableDeclarator: "id",
|
VariableDeclarator: ["id"],
|
||||||
FunctionDeclaration: "id",
|
FunctionDeclaration: ["id"],
|
||||||
ClassDeclaration: "id",
|
ClassDeclaration: ["id"],
|
||||||
MemeberExpression: "object",
|
MemeberExpression: ["object"],
|
||||||
SpreadElement: "argument",
|
SpreadElement: ["argument"],
|
||||||
Property: "value"
|
Property: ["value"]
|
||||||
};
|
};
|
||||||
|
|
||||||
t.getIds.arrays = {
|
t.getIds.arrays = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user