angular-estree-parser
Advanced tools
Comparing version 2.0.3 to 2.1.0
@@ -5,2 +5,17 @@ # Change Log | ||
<a name="2.1.0"></a> | ||
# [2.1.0](https://github.com/ikatyang/angular-estree-parser/compare/v2.0.3...v2.1.0) (2020-07-08) | ||
### Bug Fixes | ||
* **transform-microsyntax:** handle implicit `$implicit` correctly ([#200](https://github.com/ikatyang/angular-estree-parser/issues/200)) ([0970bc7](https://github.com/ikatyang/angular-estree-parser/commit/0970bc7)) | ||
### Features | ||
* **peer-deps:** support Angular 10 ([#199](https://github.com/ikatyang/angular-estree-parser/issues/199)) ([950fe68](https://github.com/ikatyang/angular-estree-parser/commit/950fe68)) | ||
<a name="2.0.3"></a> | ||
@@ -7,0 +22,0 @@ ## [2.0.3](https://github.com/ikatyang/angular-estree-parser/compare/v2.0.2...v2.0.3) (2020-05-10) |
@@ -65,5 +65,6 @@ "use strict"; | ||
else { | ||
const { key, value, sourceSpan } = templateBinding; | ||
const { key, sourceSpan } = templateBinding; | ||
const startsWithLet = /^let\s$/.test(context.text.slice(sourceSpan.start, sourceSpan.start + 4)); | ||
if (startsWithLet) { | ||
const { value } = templateBinding; | ||
return _c('NGMicrosyntaxLet', { | ||
@@ -80,2 +81,3 @@ key: _c('NGMicrosyntaxKey', { name: key.source }, key.span), | ||
else { | ||
const value = getAsVariableBindingValue(templateBinding); | ||
return _c('NGMicrosyntaxAs', { | ||
@@ -136,3 +138,17 @@ key: _c('NGMicrosyntaxKey', { name: value.source }, value.span), | ||
} | ||
/** | ||
* - "as b" (value="NgEstreeParser" key="b") -> (value="$implicit" key="b") | ||
*/ | ||
function getAsVariableBindingValue(variableBinding) { | ||
if (!variableBinding.value || | ||
variableBinding.value.source !== utils_1.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX) { | ||
return variableBinding.value; | ||
} | ||
const index = utils_1.findBackChar(/\S/, variableBinding.sourceSpan.start, context.text); | ||
return { | ||
source: '$implicit', | ||
span: { start: index, end: index }, | ||
}; | ||
} | ||
} | ||
exports.transformTemplateBindings = transformTemplateBindings; |
import * as ng from '@angular/compiler/src/expression_parser/ast'; | ||
import { RawNGComment, RawNGSpan } from './types'; | ||
export declare const NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX = "NgEstreeParser"; | ||
export declare function parseNgBinding(input: string): { | ||
@@ -4,0 +5,0 @@ ast: ng.AST; |
@@ -7,3 +7,3 @@ "use strict"; | ||
const NG_PARSE_FAKE_LOCATION = 'angular-estree-parser'; | ||
const NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX = 'NgEstreeParser'; | ||
exports.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX = 'NgEstreeParser'; | ||
const NG_PARSE_FAKE_ABSOLUTE_OFFSET = 0; | ||
@@ -38,3 +38,3 @@ const NG_PARSE_SHARED_PARAMS = [ | ||
const ngParser = createNgParser(); | ||
const { templateBindings: ast, errors } = ngParser.parseTemplateBindings(NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX, input, NG_PARSE_FAKE_LOCATION, NG_PARSE_FAKE_ABSOLUTE_OFFSET, NG_PARSE_FAKE_ABSOLUTE_OFFSET); | ||
const { templateBindings: ast, errors } = ngParser.parseTemplateBindings(exports.NG_PARSE_TEMPLATE_BINDINGS_FAKE_PREFIX, input, NG_PARSE_FAKE_LOCATION, NG_PARSE_FAKE_ABSOLUTE_OFFSET, NG_PARSE_FAKE_ABSOLUTE_OFFSET); | ||
assertAstErrors(errors); | ||
@@ -41,0 +41,0 @@ return ast; |
{ | ||
"name": "angular-estree-parser", | ||
"version": "2.0.3", | ||
"version": "2.1.0", | ||
"description": "A parser that converts Angular source code into an ESTree-compatible form", | ||
@@ -29,3 +29,3 @@ "keywords": [], | ||
"devDependencies": { | ||
"@angular/compiler": "9.1.0", | ||
"@angular/compiler": "10.0.2", | ||
"@babel/code-frame": "7.8.3", | ||
@@ -50,3 +50,3 @@ "@babel/parser": "7.6.4", | ||
"peerDependencies": { | ||
"@angular/compiler": "^9.1.0" | ||
"@angular/compiler": "^9.1.0 || ^10.0.0" | ||
}, | ||
@@ -53,0 +53,0 @@ "engines": { |
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
47915
977