Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ A parser that converts TypeScript into an [ESTree](https://github.com/estree/est

We will always endeavor to support the latest stable version of TypeScript.

The version of TypeScript currently supported by this parser is `~2.3.2`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.
The version of TypeScript currently supported by this parser is `~2.4.0`. This is reflected in the `devDependency` requirement within the package.json file, and it is what the tests will be run against. We have an open `peerDependency` requirement in order to allow for experimentation on newer/beta versions of TypeScript.

If you use a non-supported version of TypeScript, the parser will log a warning to the console.

Expand Down
1 change: 1 addition & 0 deletions lib/ast-node-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = {
GenericTypeAnnotation: "GenericTypeAnnotation",
Identifier: "Identifier",
IfStatement: "IfStatement",
Import: "Import",
ImportDeclaration: "ImportDeclaration",
ImportDefaultSpecifier: "ImportDefaultSpecifier",
ImportNamespaceSpecifier: "ImportNamespaceSpecifier",
Expand Down
6 changes: 6 additions & 0 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -1608,6 +1608,12 @@ module.exports = function convert(config) {
break;
}

case SyntaxKind.ImportKeyword:
Object.assign(result, {
type: AST_NODE_TYPES.Import
});
break;

case SyntaxKind.EmptyStatement:
case SyntaxKind.DebuggerStatement:
simplyCopy();
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"npm-license": "0.3.3",
"shelljs": "0.7.7",
"shelljs-nodecli": "0.1.1",
"typescript": "~2.3.2"
"typescript": "~2.4.0"
},
"keywords": [
"ast",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
import('foo').then(main);
350 changes: 350 additions & 0 deletions tests/lib/__snapshots__/ecma-features.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -56575,6 +56575,356 @@ Object {
}
`;

exports[`ecmaFeatures fixtures/experimentalDynamicImport/dynamic-import.src 1`] = `
Object {
"body": Array [
Object {
"expression": Object {
"arguments": Array [
Object {
"loc": Object {
"end": Object {
"column": 23,
"line": 1,
},
"start": Object {
"column": 19,
"line": 1,
},
},
"name": "main",
"range": Array [
19,
23,
],
"type": "Identifier",
},
],
"callee": Object {
"computed": false,
"loc": Object {
"end": Object {
"column": 18,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"object": Object {
"arguments": Array [
Object {
"loc": Object {
"end": Object {
"column": 12,
"line": 1,
},
"start": Object {
"column": 7,
"line": 1,
},
},
"range": Array [
7,
12,
],
"raw": "'foo'",
"type": "Literal",
"value": "foo",
},
],
"callee": Object {
"loc": Object {
"end": Object {
"column": 6,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
6,
],
"type": "Import",
},
"loc": Object {
"end": Object {
"column": 13,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
13,
],
"type": "CallExpression",
},
"property": Object {
"loc": Object {
"end": Object {
"column": 18,
"line": 1,
},
"start": Object {
"column": 14,
"line": 1,
},
},
"name": "then",
"range": Array [
14,
18,
],
"type": "Identifier",
},
"range": Array [
0,
18,
],
"type": "MemberExpression",
},
"loc": Object {
"end": Object {
"column": 24,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
24,
],
"type": "CallExpression",
},
"loc": Object {
"end": Object {
"column": 25,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
25,
],
"type": "ExpressionStatement",
},
],
"loc": Object {
"end": Object {
"column": 25,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
25,
],
"sourceType": "script",
"tokens": Array [
Object {
"loc": Object {
"end": Object {
"column": 6,
"line": 1,
},
"start": Object {
"column": 0,
"line": 1,
},
},
"range": Array [
0,
6,
],
"type": "Keyword",
"value": "import",
},
Object {
"loc": Object {
"end": Object {
"column": 7,
"line": 1,
},
"start": Object {
"column": 6,
"line": 1,
},
},
"range": Array [
6,
7,
],
"type": "Punctuator",
"value": "(",
},
Object {
"loc": Object {
"end": Object {
"column": 12,
"line": 1,
},
"start": Object {
"column": 7,
"line": 1,
},
},
"range": Array [
7,
12,
],
"type": "String",
"value": "'foo'",
},
Object {
"loc": Object {
"end": Object {
"column": 13,
"line": 1,
},
"start": Object {
"column": 12,
"line": 1,
},
},
"range": Array [
12,
13,
],
"type": "Punctuator",
"value": ")",
},
Object {
"loc": Object {
"end": Object {
"column": 14,
"line": 1,
},
"start": Object {
"column": 13,
"line": 1,
},
},
"range": Array [
13,
14,
],
"type": "Punctuator",
"value": ".",
},
Object {
"loc": Object {
"end": Object {
"column": 18,
"line": 1,
},
"start": Object {
"column": 14,
"line": 1,
},
},
"range": Array [
14,
18,
],
"type": "Identifier",
"value": "then",
},
Object {
"loc": Object {
"end": Object {
"column": 19,
"line": 1,
},
"start": Object {
"column": 18,
"line": 1,
},
},
"range": Array [
18,
19,
],
"type": "Punctuator",
"value": "(",
},
Object {
"loc": Object {
"end": Object {
"column": 23,
"line": 1,
},
"start": Object {
"column": 19,
"line": 1,
},
},
"range": Array [
19,
23,
],
"type": "Identifier",
"value": "main",
},
Object {
"loc": Object {
"end": Object {
"column": 24,
"line": 1,
},
"start": Object {
"column": 23,
"line": 1,
},
},
"range": Array [
23,
24,
],
"type": "Punctuator",
"value": ")",
},
Object {
"loc": Object {
"end": Object {
"column": 25,
"line": 1,
},
"start": Object {
"column": 24,
"line": 1,
},
},
"range": Array [
24,
25,
],
"type": "Punctuator",
"value": ";",
},
],
"type": "Program",
}
`;

exports[`ecmaFeatures fixtures/experimentalObjectRestSpread/arg-spread.src 1`] = `
Object {
"body": Array [
Expand Down
Loading