[Pkg-javascript-commits] [node-ast-types] 01/03: New upstream version 0.9.3

Julien Puydt julien.puydt at laposte.net
Thu Dec 15 06:13:38 UTC 2016


This is an automated email from the git hooks/post-receive script.

jpuydt-guest pushed a commit to branch master
in repository node-ast-types.

commit 7a74a865d8c39f7a7b11c888c4fbd17290ffff1c
Author: Julien Puydt <julien.puydt at laposte.net>
Date:   Thu Dec 15 07:10:36 2016 +0100

    New upstream version 0.9.3
---
 def/esprima.js | 10 ++++++++--
 package.json   |  2 +-
 test/run.js    | 17 ++++++++++++++++-
 3 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/def/esprima.js b/def/esprima.js
index c0bc3e6..3f21bb8 100644
--- a/def/esprima.js
+++ b/def/esprima.js
@@ -80,13 +80,19 @@ module.exports = function (fork) {
 
     def("ImportDeclaration")
       .bases("Declaration")
-      .build("specifiers", "source")
+      .build("specifiers", "source", "importKind")
       .field("specifiers", [or(
         def("ImportSpecifier"),
         def("ImportNamespaceSpecifier"),
         def("ImportDefaultSpecifier")
       )], defaults.emptyArray)
-      .field("source", def("Literal"));
+      .field("source", def("Literal"))
+      .field("importKind", or(
+        "value",
+        "type"
+      ), function() {
+        return "value";
+      });
 
     def("Block")
       .bases("Comment")
diff --git a/package.json b/package.json
index f4dbe98..adaea00 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
     "transformation",
     "syntax"
   ],
-  "version": "0.9.2",
+  "version": "0.9.3",
   "homepage": "http://github.com/benjamn/ast-types",
   "repository": {
     "type": "git",
diff --git a/test/run.js b/test/run.js
index 8fc3335..f039e19 100644
--- a/test/run.js
+++ b/test/run.js
@@ -35,9 +35,24 @@ describe("basic type checking", function() {
         assert.ok(n.Expression.check(ifFoo.test));
         assert.ok(n.Identifier.check(ifFoo.test));
         assert.ok(!n.Statement.check(ifFoo.test));
+        assert.equal(
+          b.importDeclaration(
+            [b.importDefaultSpecifier(b.identifier("foo"))], b.literal("bar")
+          ).importKind,
+          "value"
+        );
+        assert.throws(function () {
+            b.importDeclaration(
+              [b.importDefaultSpecifier(b.identifier("foo"))],
+              b.literal("bar"),
+              "baz"
+            )
+          }
+        );
         assert.ok(n.ImportDeclaration.check(
           b.importDeclaration(
-            [b.importDefaultSpecifier(b.identifier("foo"))], b.literal("bar"))
+            [b.importDefaultSpecifier(b.identifier("foo"))], b.literal("bar"),
+              "type")
           )
         );
         assert.ok(n.ImportDeclaration.check(

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-ast-types.git



More information about the Pkg-javascript-commits mailing list