@angular-eslint/template-parser 12.7.1-alpha.0 → 13.0.1-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [13.0.0](https://github.com/angular-eslint/angular-eslint/compare/v12.7.0...v13.0.0) (2021-11-18)
7
+
8
+ ### Features
9
+
10
+ - angular-eslint v13 ([#780](https://github.com/angular-eslint/angular-eslint/issues/780)) ([f7ce631](https://github.com/angular-eslint/angular-eslint/commit/f7ce631524dd7834a422a5ac93a4c0534f9f23fa))
11
+
6
12
  # [12.7.0](https://github.com/angular-eslint/angular-eslint/compare/v12.6.1...v12.7.0) (2021-11-18)
7
13
 
8
14
  **Note:** Version bump only for package @angular-eslint/template-parser
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- var e=require("@angular-eslint/bundled-angular-compiler"),t=require("eslint-scope");function n(e){return{start:{line:e.start.line+1,column:e.start.col},end:{line:e.end.line+1,column:e.end.col}}}function o(t,o){if("Element"!==o.type)throw new Error("convertElementSourceSpanToLoc is intented to be used only with elements.");return e.getHtmlTagDefinition(o.name).isVoid&&(o=function(t,n){const{rootNodes:o}=(s||(s=new e.HtmlParser)).parse(t.getSourceCode().getText(),t.getFilename());return r(o,n.sourceSpan)}(t,o)||o),n(o.sourceSpan)}function r(t,n){for(const o of t){if(o.sourceSpan.start.line===n.start.line&&o.sourceSpan.start.offset===n.start.offset)return o;if(o instanceof e.Element){const e=r(o.children,n);if(null!==e)return e}}return null}let s=null;const a={ASTWithSource:["ast"],Binary:["left","right"],BoundAttribute:["value"],BoundEvent:["handler"],BoundText:["value"],Conditional:["condition","trueExp","falseExp"],Element:["children","inputs","outputs","attributes"],Interpolation:["expressions"],PrefixNot:["expression"],Program:["templateNodes"],PropertyRead:["receiver"],Template:["templateAttrs","children","inputs"],BindingPipe:["exp"]};function l(e){let t=null;return"comments"!==e&&"leadingComments"!==e&&"loc"!==e&&"parent"!==e&&"range"!==e&&"tokens"!==e&&"trailingComments"!==e&&null!==(t=this[e])&&"object"==typeof t&&("string"==typeof t.type||Array.isArray(t))}function c(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}function i(e){let t=0,n=0;const o=a[e.type]||function(e){return Object.keys(e).filter(l,e)}(e);for(t=0;t<o.length;++t){const r=e[o[t]],s=Array.isArray(r);if(void 0!==r.type&&(r.__originalType=r.type),s||r.type||(r.type=r.constructor.name),s)for(n=0;n<r.length;++n){const e=r[n];void 0!==e.type&&(e.__originalType=e.type),e.type&&"number"!=typeof e.type||(e.type=e.constructor.name),c(e)&&i(e)}else c(r)&&i(r)}}function u(r,s){const l=e.parseTemplate(r,s.filePath,{preserveWhitespaces:!0,preserveLineEndings:!0,collectCommentNodes:!0});let c=[];Array.isArray(l.commentNodes)&&(c=l.commentNodes);const u={type:"Program",comments:(p=c,p.map(e=>({type:"Block",value:e.value,loc:n(e.sourceSpan),range:[e.sourceSpan.start.offset,e.sourceSpan.end.offset]})).sort((e,t)=>e.range[0]-t.range[0])),tokens:[],range:[0,0],loc:{start:{line:0,column:0},end:{line:0,column:0}},templateNodes:l.nodes,value:r};var p;const f=new t.ScopeManager({});new t.Scope(f,"module",null,u,!1),i(u);const d=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.startSourceSpan||e.sourceSpan;t?n&&n.start.offset<t.start.offset&&(t=n):t=n}),t}(u),m=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.endSourceSpan||e.sourceSpan;t?n&&n.end.offset>t.end.offset&&(t=n):t=n}),t}(u);return d&&m&&(u.range=[d.start.offset,m.end.offset],u.loc={start:n(d).start,end:n(m).end}),{ast:u,scopeManager:f,visitorKeys:a,services:{convertNodeSourceSpanToLoc:n,convertElementSourceSpanToLoc:o}}}exports.parse=function(e,t){return u(e,t).ast},exports.parseForESLint=u;
1
+ var e=require("@angular-eslint/bundled-angular-compiler"),t=require("eslint-scope");function n(e){return{start:{line:e.start.line+1,column:e.start.col},end:{line:e.end.line+1,column:e.end.col}}}function o(t,o){if("Element$1"!==o.type)throw new Error("convertElementSourceSpanToLoc is intented to be used only with elements.");return e.getHtmlTagDefinition(o.name).isVoid&&(o=function(t,n){const{rootNodes:o}=(s||(s=new e.HtmlParser)).parse(t.getSourceCode().getText(),t.getFilename());return r(o,n.sourceSpan)}(t,o)||o),n(o.sourceSpan)}function r(t,n){for(const o of t){if(o.sourceSpan.start.line===n.start.line&&o.sourceSpan.start.offset===n.start.offset)return o;if(o instanceof e.Element){const e=r(o.children,n);if(null!==e)return e}}return null}let s=null;const a={ASTWithSource:["ast"],Binary:["left","right"],BoundAttribute:["value"],BoundEvent:["handler"],BoundText:["value"],Conditional:["condition","trueExp","falseExp"],Element$1:["children","inputs","outputs","attributes"],Interpolation:["expressions"],PrefixNot:["expression"],Program:["templateNodes"],PropertyRead:["receiver"],Template:["templateAttrs","children","inputs"],BindingPipe:["exp"]};function l(e){let t=null;return"comments"!==e&&"leadingComments"!==e&&"loc"!==e&&"parent"!==e&&"range"!==e&&"tokens"!==e&&"trailingComments"!==e&&null!==(t=this[e])&&"object"==typeof t&&("string"==typeof t.type||Array.isArray(t))}function c(e){return null!==e&&"object"==typeof e&&"string"==typeof e.type}function i(e){let t=0,o=0;const r=a[e.type]||function(e){return Object.keys(e).filter(l,e)}(e);for(!e.loc&&e.sourceSpan&&(e.loc=n(e.sourceSpan)),t=0;t<r.length;++t){const n=e[r[t]],s=Array.isArray(n);if(void 0!==n.type&&(n.__originalType=n.type),s||n.type||(n.type=n.constructor.name),s)for(o=0;o<n.length;++o){const e=n[o];void 0!==e.type&&(e.__originalType=e.type),e.type&&"number"!=typeof e.type||(e.type=e.constructor.name),c(e)&&i(e)}else c(n)&&i(n)}}function u(r,s){const l=e.parseTemplate(r,s.filePath,{preserveWhitespaces:!0,preserveLineEndings:!0,collectCommentNodes:!0});let c=[];Array.isArray(l.commentNodes)&&(c=l.commentNodes);const u={type:"Program",comments:(p=c,p.map(e=>({type:"Block",value:e.value,loc:n(e.sourceSpan),range:[e.sourceSpan.start.offset,e.sourceSpan.end.offset]})).sort((e,t)=>e.range[0]-t.range[0])),tokens:[],range:[0,0],loc:{start:{line:0,column:0},end:{line:0,column:0}},templateNodes:l.nodes,value:r};var p;const f=new t.ScopeManager({});new t.Scope(f,"module",null,u,!1),i(u);const d=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.startSourceSpan||e.sourceSpan;t?n&&n.start.offset<t.start.offset&&(t=n):t=n}),t}(u),m=function(e){let t=null;return e.templateNodes.forEach(e=>{const n=e.endSourceSpan||e.sourceSpan;t?n&&n.end.offset>t.end.offset&&(t=n):t=n}),t}(u);return d&&m&&(u.range=[d.start.offset,m.end.offset],u.loc={start:n(d).start,end:n(m).end}),{ast:u,scopeManager:f,visitorKeys:a,services:{convertNodeSourceSpanToLoc:n,convertElementSourceSpanToLoc:o}}}exports.parse=function(e,t){return u(e,t).ast},exports.parseForESLint=u;
@@ -1,15 +1,16 @@
1
1
  import type { TSESTree } from '@typescript-eslint/types';
2
2
  import { ScopeManager } from 'eslint-scope';
3
3
  import { convertElementSourceSpanToLoc, convertNodeSourceSpanToLoc } from './convert-source-span-to-loc';
4
+ declare type NodeOrTokenType = any;
4
5
  interface Node {
5
6
  [key: string]: any;
6
- type: string;
7
+ type: NodeOrTokenType;
7
8
  }
8
9
  interface VisitorKeys {
9
10
  [nodeName: string]: string[];
10
11
  }
11
12
  interface Token extends TSESTree.BaseNode {
12
- type: string;
13
+ type: NodeOrTokenType;
13
14
  value: string;
14
15
  }
15
16
  interface AST extends Node, Token {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/template-parser",
3
- "version": "12.7.1-alpha.0+f1e7704",
3
+ "version": "13.0.1-alpha.0+9f0f93e",
4
4
  "description": "Angular Template parser for ESLint",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -17,12 +17,12 @@
17
17
  "LICENSE"
18
18
  ],
19
19
  "dependencies": {
20
- "@angular-eslint/bundled-angular-compiler": "12.7.1-alpha.0+f1e7704",
20
+ "@angular-eslint/bundled-angular-compiler": "13.0.1-alpha.0+9f0f93e",
21
21
  "eslint-scope": "^5.1.0"
22
22
  },
23
23
  "peerDependencies": {
24
- "eslint": "*",
24
+ "eslint": "^7.0.0 || ^8.0.0",
25
25
  "typescript": "*"
26
26
  },
27
- "gitHead": "f1e7704b7c0f57d7743fef8cd7500bc3103b9b5b"
27
+ "gitHead": "9f0f93e5be30c76a578e34b13d7aa452958c6984"
28
28
  }