angular-estree-parser
Advanced tools
Comparing version 8.0.3 to 9.0.0
export declare class Context { | ||
#private; | ||
text: string; | ||
constructor(text: string); | ||
locationForIndex(index: number): { | ||
line: number; | ||
column: number; | ||
index: number; | ||
}; | ||
getCharacterIndex(pattern: RegExp | string, index: number): number; | ||
@@ -11,0 +5,0 @@ getCharacterLastIndex(pattern: RegExp | string, index: number): number; |
@@ -1,14 +0,7 @@ | ||
import { LinesAndColumns } from 'lines-and-columns'; | ||
import { getCharacterIndex, getCharacterLastIndex } from './utils.js'; | ||
export class Context { | ||
text; | ||
#linesAndColumns; | ||
constructor(text) { | ||
this.text = text; | ||
} | ||
locationForIndex(index) { | ||
this.#linesAndColumns ??= new LinesAndColumns(this.text); | ||
const { line, column } = this.#linesAndColumns.locationForIndex(index); | ||
return { line: line + 1, column, index }; | ||
} | ||
getCharacterIndex(pattern, index) { | ||
@@ -15,0 +8,0 @@ return getCharacterIndex(this.text, pattern, index); |
@@ -11,3 +11,3 @@ import type * as ng from '@angular/compiler'; | ||
end: NonNullable<b.Node['end']>; | ||
loc: NonNullable<b.Node['loc']>; | ||
range: NonNullable<b.Node['range']>; | ||
}; |
@@ -324,20 +324,10 @@ import { fitSpans, getNgType } from './utils.js'; | ||
end, | ||
loc: { | ||
filename: '', | ||
identifierName: '', | ||
start: context.locationForIndex(start), | ||
end: context.locationForIndex(end), | ||
}, | ||
range: [start, end], | ||
}; | ||
} | ||
const { outerSpan, innerSpan, hasParens } = fitSpans(span, context.text, hasParentParens); | ||
const { outerSpan, innerSpan: { start, end }, hasParens, } = fitSpans(span, context.text, hasParentParens); | ||
return { | ||
start: innerSpan.start, | ||
end: innerSpan.end, | ||
loc: { | ||
filename: '', | ||
identifierName: '', | ||
start: context.locationForIndex(innerSpan.start), | ||
end: context.locationForIndex(innerSpan.end), | ||
}, | ||
start, | ||
end, | ||
range: [start, end], | ||
...(hasParens && { | ||
@@ -344,0 +334,0 @@ extra: { |
@@ -6,3 +6,3 @@ import type * as b from '@babel/types'; | ||
end: number; | ||
loc: b.SourceLocation; | ||
range: [number, number]; | ||
} | ||
@@ -9,0 +9,0 @@ export type NGNode = { |
{ | ||
"name": "angular-estree-parser", | ||
"version": "8.0.3", | ||
"version": "9.0.0", | ||
"description": "A parser that converts Angular source code into an ESTree-compatible form", | ||
@@ -30,3 +30,2 @@ "keywords": [], | ||
"dependencies": { | ||
"lines-and-columns": "^2.0.4", | ||
"tslib": "^2.6.2" | ||
@@ -41,4 +40,4 @@ }, | ||
"@types/jest": "29.5.8", | ||
"@typescript-eslint/eslint-plugin": "6.10.0", | ||
"@typescript-eslint/parser": "6.10.0", | ||
"@typescript-eslint/eslint-plugin": "6.11.0", | ||
"@typescript-eslint/parser": "6.11.0", | ||
"del-cli": "5.1.0", | ||
@@ -52,4 +51,5 @@ "eslint": "8.53.0", | ||
"jest-snapshot-serializer-raw": "1.2.0", | ||
"lines-and-columns": "2.0.4", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "3.0.3", | ||
"prettier": "3.1.0", | ||
"standard-version": "9.5.0", | ||
@@ -60,3 +60,3 @@ "ts-jest": "29.1.1", | ||
"peerDependencies": { | ||
"@angular/compiler": "^17.0.0" | ||
"@angular/compiler": "^17.0.2" | ||
}, | ||
@@ -63,0 +63,0 @@ "engines": { |
2
40181
22
887
- Removedlines-and-columns@^2.0.4
- Removedlines-and-columns@2.0.4(transitive)