babel-types: add validators for es2015 exports
This commit is contained in:
parent
a2efb41748
commit
d4a1127012
@ -112,7 +112,9 @@ defineType("ExportAllDeclaration", {
|
||||
visitor: ["source"],
|
||||
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
|
||||
fields: {
|
||||
// todo
|
||||
source: {
|
||||
validate: assertNodeType("StringLiteral")
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -120,7 +122,9 @@ defineType("ExportDefaultDeclaration", {
|
||||
visitor: ["declaration"],
|
||||
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
|
||||
fields: {
|
||||
// todo
|
||||
declaration: {
|
||||
validate: assertNodeType("Declaration", "Expression")
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -128,7 +132,17 @@ defineType("ExportNamedDeclaration", {
|
||||
visitor: ["declaration", "specifiers", "source"],
|
||||
aliases: ["Statement", "Declaration", "ModuleDeclaration", "ExportDeclaration"],
|
||||
fields: {
|
||||
// todo
|
||||
declaration: {
|
||||
validate: assertNodeType("Declaration"),
|
||||
optional: true
|
||||
},
|
||||
specifiers: {
|
||||
validate: chain(assertValueType("array"), assertEach(assertNodeType("ExportSpecifier")))
|
||||
},
|
||||
source: {
|
||||
validate: assertNodeType("StringLiteral"),
|
||||
optional: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user