ast-types
Advanced tools
Comparing version 0.4.13 to 0.5.0
@@ -63,12 +63,7 @@ require("./core"); | ||
// This would be the ideal definition for ModuleSpecifier, but alas we | ||
// can't expect ASTs parsed by Esprima to use this custom subtype: | ||
def("ModuleSpecifier") | ||
.bases("Specifier", "Literal") | ||
// .build("value") // Make it abstract/non-buildable for now. | ||
.bases("Literal") | ||
.build("value") | ||
.field("value", isString); | ||
// Instead we must settle for a cheap type alias: | ||
var ModuleSpecifier = def("Literal"); | ||
def("ModuleDeclaration") | ||
@@ -78,3 +73,3 @@ .bases("Declaration") | ||
.field("id", or(def("Literal"), def("Identifier"))) | ||
.field("source", or(ModuleSpecifier, null)) | ||
.field("source", or(def("ModuleSpecifier"), null)) | ||
.field("body", or(def("BlockStatement"), null)); | ||
@@ -151,10 +146,13 @@ | ||
// Specifier and NamedSpecifier are non-standard types that I introduced | ||
// for definitional convenience. | ||
// Specifier and NamedSpecifier are abstract non-standard types that I | ||
// introduced for definitional convenience. | ||
def("Specifier").bases("Node"); | ||
def("NamedSpecifier") | ||
.bases("Specifier") | ||
// Note: this abstract type is intentionally not buildable. | ||
.field("id", def("Identifier")) | ||
.field("name", or(def("Identifier"), null), defaults["null"]); | ||
// Like NamedSpecifier, except type:"ExportSpecifier" and buildable. | ||
// export {<id [as name]>} [from ...]; | ||
def("ExportSpecifier") | ||
@@ -164,2 +162,3 @@ .bases("NamedSpecifier") | ||
// export <*> from ...; | ||
def("ExportBatchSpecifier") | ||
@@ -169,2 +168,4 @@ .bases("Specifier") | ||
// Like NamedSpecifier, except type:"ImportSpecifier" and buildable. | ||
// import {<id [as name]>} from ...; | ||
def("ImportSpecifier") | ||
@@ -174,2 +175,14 @@ .bases("NamedSpecifier") | ||
// import <* as id> from ...; | ||
def("ImportNamespaceSpecifier") | ||
.bases("Specifier") | ||
.build("id") | ||
.field("id", def("Identifier")); | ||
// import <id> from ...; | ||
def("ImportDefaultSpecifier") | ||
.bases("Specifier") | ||
.build("id") | ||
.field("id", def("Identifier")); | ||
def("ExportDeclaration") | ||
@@ -181,3 +194,4 @@ .bases("Declaration") | ||
def("Declaration"), | ||
def("Expression") // Implies default. | ||
def("Expression"), // Implies default. | ||
null | ||
)) | ||
@@ -188,10 +202,13 @@ .field("specifiers", [or( | ||
)], defaults.emptyArray) | ||
.field("source", or(ModuleSpecifier, null), defaults["null"]); | ||
.field("source", or(def("ModuleSpecifier"), null), defaults["null"]); | ||
def("ImportDeclaration") | ||
.bases("Declaration") | ||
.build("specifiers", "kind", "source") | ||
.field("specifiers", [def("ImportSpecifier")]) | ||
.field("kind", or("named", "default", null)) | ||
.field("source", ModuleSpecifier); | ||
.build("specifiers", "source") | ||
.field("specifiers", [or( | ||
def("ImportSpecifier"), | ||
def("ImportNamespaceSpecifier"), | ||
def("ImportDefaultSpecifier") | ||
)], defaults.emptyArray) | ||
.field("source", def("ModuleSpecifier")); | ||
@@ -198,0 +215,0 @@ def("TaggedTemplateExpression") |
@@ -21,3 +21,3 @@ { | ||
], | ||
"version": "0.4.13", | ||
"version": "0.5.0", | ||
"homepage": "http://github.com/benjamn/ast-types", | ||
@@ -24,0 +24,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
107349
2514