Socket
Socket
Sign inDemoInstall

ast-types

Package Overview
Dependencies
Maintainers
1
Versions
172
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ast-types - npm Package Compare versions

Comparing version 0.2.19 to 0.2.20

28

def/es6.js

@@ -7,2 +7,3 @@ require("./core");

var isBoolean = builtin.boolean;
var isString = builtin.string;
var defaults = require("../lib/shared").defaults;

@@ -48,2 +49,12 @@

// 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.
.field("value", isString);
// Instead we must settle for a cheap type alias:
var ModuleSpecifier = def("Literal");
def("ModuleDeclaration")

@@ -53,11 +64,5 @@ .bases("Declaration")

.field("id", or(def("Literal"), def("Identifier")))
.field("from", or(def("Path"), null))
.field("source", or(ModuleSpecifier, null))
.field("body", or(def("BlockStatement"), null));
def("Path")
.bases("Node")
.build("body")
// TODO This really ought be a recursive type.
.field("body", [def("Identifier")]);
def("MethodDefinition")

@@ -130,3 +135,6 @@ .bases("Declaration")

.field("default", isBoolean)
.field("declaration", def("Statement"))
.field("declaration", or(
def("Declaration"),
def("AssignmentExpression") // Implies default.
))
.field("specifiers", [or(

@@ -136,3 +144,3 @@ def("ExportSpecifier"),

)])
.field("source", def("Expression"));
.field("source", or(ModuleSpecifier, null));

@@ -144,4 +152,4 @@ def("ImportDeclaration")

.field("kind", or("named", "default"))
.field("source", def("Expression"));
.field("source", ModuleSpecifier);
types.finalize();

@@ -21,3 +21,3 @@ {

],
"version": "0.2.19",
"version": "0.2.20",
"homepage": "http://github.com/benjamn/ast-types",

@@ -24,0 +24,0 @@ "repository": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc