angular-estree-parser
Advanced tools
Comparing version 2.2.0 to 2.2.1
@@ -5,2 +5,12 @@ # Change Log | ||
<a name="2.2.1"></a> | ||
## [2.2.1](https://github.com/ikatyang/angular-estree-parser/compare/v2.2.0...v2.2.1) (2020-09-09) | ||
### Bug Fixes | ||
* **peer-deps:** support `[@angular](https://github.com/angular)/compiler@10.1` ([#204](https://github.com/ikatyang/angular-estree-parser/issues/204)) ([ebe2679](https://github.com/ikatyang/angular-estree-parser/commit/ebe2679)) | ||
<a name="2.2.0"></a> | ||
@@ -7,0 +17,0 @@ # [2.2.0](https://github.com/ikatyang/angular-estree-parser/compare/v2.1.0...v2.2.0) (2020-08-12) |
@@ -7,2 +7,12 @@ "use strict"; | ||
switch (type) { | ||
case 'Unary': { | ||
// @ts-ignore: there is no `Unary` in `@angular/compiler@<10.1.0` | ||
const { operator, expr } = node; | ||
const tArgument = _t(expr); | ||
return _c('UnaryExpression', { | ||
prefix: true, | ||
argument: tArgument, | ||
operator: operator, | ||
}, node.span, { hasParentParens: isInParentParens }); | ||
} | ||
case 'Binary': { | ||
@@ -12,2 +22,4 @@ const { left, operation, right } = node; | ||
const isPrefixMinus = left.span.start === left.span.end; // -1 === 0 - 1 | ||
// `@angular/compiler` changed this to `Unary` since `v10.1.0` | ||
// istanbul ignore next | ||
if (isPrefixAdd || isPrefixMinus) { | ||
@@ -14,0 +26,0 @@ const tArgument = left.span.start === left.span.end |
@@ -50,5 +50,9 @@ "use strict"; | ||
const ast = rawAst.expressions[0]; | ||
const visited = new Set(); | ||
visitSpan(ast, span => { | ||
span.start -= prefix.length; | ||
span.end -= prefix.length; | ||
if (!visited.has(span)) { | ||
span.start -= prefix.length; | ||
span.end -= prefix.length; | ||
visited.add(span); | ||
} | ||
}); | ||
@@ -99,2 +103,6 @@ return { ast, comments }; | ||
function getNgType(node) { | ||
// @ts-ignore: there is no `Unary` in `@angular/compiler@<10.1.0` | ||
if (ng.Unary && node instanceof ng.Unary) { | ||
return 'Unary'; | ||
} | ||
if (node instanceof ng.Binary) { | ||
@@ -101,0 +109,0 @@ return 'Binary'; |
{ | ||
"name": "angular-estree-parser", | ||
"version": "2.2.0", | ||
"version": "2.2.1", | ||
"description": "A parser that converts Angular source code into an ESTree-compatible form", | ||
@@ -29,3 +29,3 @@ "keywords": [], | ||
"devDependencies": { | ||
"@angular/compiler": "10.0.2", | ||
"@angular/compiler": "10.1.0", | ||
"@babel/code-frame": "7.8.3", | ||
@@ -32,0 +32,0 @@ "@babel/parser": "7.6.4", |
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
49432
998