16 lines
56 KiB
JavaScript
16 lines
56 KiB
JavaScript
|
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(((e=e||self).prettierPlugins=e.prettierPlugins||{},e.prettierPlugins.angular={}))}(this,(function(e){"use strict";var t=function(e){return e.length>0?e[e.length-1]:null};var n={locStart:function e(t,n){return!(n=n||{}).ignoreDecorators&&t.declaration&&t.declaration.decorators&&t.declaration.decorators.length>0?e(t.declaration.decorators[0]):!n.ignoreDecorators&&t.decorators&&t.decorators.length>0?e(t.decorators[0]):t.__location?t.__location.startOffset:t.range?t.range[0]:"number"==typeof t.start?t.start:t.loc?t.loc.start:null},locEnd:function e(n){var i=n.nodes&&t(n.nodes);if(i&&n.source&&!n.source.end&&(n=i),n.__location)return n.__location.endOffset;var r=n.range?n.range[1]:"number"==typeof n.end?n.end:null;return n.typeAnnotation?Math.max(r,e(n.typeAnnotation)):n.loc&&!r?n.loc.end:r}};function i(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function r(e,t){return e(t={exports:{}},t.exports),t.exports}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function u(e,t,n){return t&&o(e.prototype,t),n&&o(e,n),e}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&h(e,t)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(e,t){return(h=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function p(e,t){return!t||"object"!=typeof t&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function v(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if(!(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e)))return;var n=[],i=!0,r=!1,s=void 0;try{for(var a,o=e[Symbol.iterator]();!(i=(a=o.next()).done)&&(n.push(a.value),!t||n.length!==t);i=!0);}catch(e){r=!0,s=e}finally{try{i||null==o.return||o.return()}finally{if(r)throw s}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var f=r((function(e,t){var n="\n",i="\r",r=function(){function e(e){this.string=e;for(var t=[0],r=0;r<e.length;)switch(e[r]){case n:r+=n.length,t.push(r);break;case i:e[r+=i.length]===n&&(r+=n.length),t.push(r);break;default:r++}this.offsets=t}return e.prototype.locationForIndex=function(e){if(e<0||e>this.string.length)return null;for(var t=0,n=this.offsets;n[t+1]<=e;)t++;return{line:t,column:e-n[t]}},e.prototype.indexForLocation=function(e){var t=e.line,n=e.column;return t<0||t>=this.offsets.length?null:n<0||n>this.lengthOfLine(t)?null:this.offsets[t]+n},e.prototype.lengthOfLine=function(e){var t=this.offsets[e];return(e===this.offsets.length-1?this.string.length:this.offsets[e+1])-t},e}();t.__esModule=!0,t.default=r}));i(f);var d=r((function(e,t){Object.defineProperty(t,"__esModule",{value:!0});t.Context=function e(t){a(this,e),this.text=t,this.locator=new n(this.text)};var n=function(){function e(t){a(this,e),this._lineAndColumn=new f.default(t)}return u(e,[{key:"locationForIndex",value:function(e){var t=this._lineAndColumn.locationForIndex(e);return{line:t.line+1,column:t.column}}}]),e}()}));i(d);d.Context;
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright Google Inc. All Rights Reserved.
|
||
|
*
|
||
|
* Use of this source code is governed by an MIT-style license that can be
|
||
|
* found in the LICENSE file at https://angular.io/license
|
||
|
*/var y=function e(t,n,i,r){a(this,e),this.input=n,this.errLocation=i,this.ctxLocation=r,this.message="Parser Error: ".concat(t," ").concat(i," [").concat(n,"] in ").concat(r)},x=function e(t,n){a(this,e),this.start=t,this.end=n},g=function(){function e(t){a(this,e),this.span=t}return u(e,[{key:"visit",value:function(e){return null}},{key:"toString",value:function(){return"AST"}}]),e}(),k=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).prefix=n,s.uninterpretedExpression=i,s.location=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitQuote(this,t)}},{key:"toString",value:function(){return"Quote"}}]),t}(g),m=function(e){function t(){return a(this,t),p(this,c(t).apply(this,arguments))}return l(t,e),u(t,[{key:"visit",value:function(e){}}]),t}(g),w=function(e){function t(){return a(this,t),p(this,c(t).apply(this,arguments))}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitImplicitReceiver(this,t)}}]),t}(g),C=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).expressions=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitChain(this,t)}}]),t}(g),P=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).condition=n,s.trueExp=i,s.falseExp=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitConditional(this,t)}}]),t}(g),b=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).receiver=n,r.name=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPropertyRead(this,t)}}]),t}(g),A=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).receiver=n,s.name=i,s.value=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPropertyWrite(this,t)}}]),t}(g),E=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).receiver=n,r.name=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitSafePropertyRead(this,t)}}]),t}(g),S=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).obj=n,r.key=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitKeyedRead(this,t)}}]),t}(g),N=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).obj=n,s.key=i,s.value=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitKeyedWrite(this,t)}}]),t}(g),O=function(e){function t(e,n,i,r){var s;return a(this,t),(s=p(this,c(t).call(this,e))).exp=n,s.name=i,s.args=r,s}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitPipe(this,t)}}]),t}(g),I=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).value=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralPrimitive(this,t)}}]),t}(g),_=function(e){function t(e,n){var i;return a(this,t),(i=p(this,c(t).call(this,e))).expressions=n,i}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralArray(this,t)}}]),t}(g),L=function(e){function t(e,n,i){var r;return a(this,t),(r=p(this,c(t).call(this,e))).keys=n,r.values=i,r}return l(t,e),u(t,[{key:"visit",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return e.visitLiteralMap(this,t)}}]),t}(g),M=function(e){function t(e,n,i){var r
|
||
|
/**
|
||
|
* @license
|
||
|
* Copyright Google Inc. All Rights Reserved.
|
||
|
*
|
||
|
* Use of this source code is governed by an MIT-style license that can be
|
||
|
* found in the LICENSE file at https://angular.io/license
|
||
|
*/var Ve=new(function(){function e(t,n){a(this,e),this.start=t,this.end=n}return u(e,null,[{key:"fromArray",value:function(t){return t?(function(e,t){if(!(null==t||Array.isArray(t)&&2==t.length))throw new Error("Expected '".concat(e,"' to be an array, [start, end]."));if(null!=t){var n=t[0],i=t[1];Fe.forEach((function(e){if(e.test(n)||e.test(i))throw new Error("['".concat(n,"', '").concat(i,"'] contains unusable interpolation symbol."))}))}}("interpolation",t),new e(t[0],t[1])):Ve}}]),e}())("{{","}}");function We(e){return e.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}"undefined"!=typeof self&&"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&self;var Ge=function e(t,n,i){a(this,e),this.strings=t,this.expressions=n,this.offsets=i},Ue=function e(t,n,i){a(this,e),this.templateBindings=t,this.warnings=n,this.errors=i};function Qe(e){var t=We(e.start)+"([\\s\\S]*?)"+We(e.end);return new RegExp(t,"g")}var ze=function(){function e(t){a(this,e),this._lexer=t,this.errors=[]}return u(e,[{key:"parseAction",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve;this._checkNoInterpolation(e,t,i);var r=this._stripComments(e),s=this._lexer.tokenize(this._stripComments(e)),a=new $e(e,t,n,s,r.length,!0,this.errors,e.length-r.length).parseChain();return new W(a,e,t,n,this.errors)}},{key:"parseBinding",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve,r=this._parseBindingAst(e,t,n,i);return new W(r,e,t,n,this.errors)}},{key:"parseSimpleBinding",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve,r=this._parseBindingAst(e,t,n,i),s=qe.check(r);return s.length>0&&this._reportError("Host binding expression cannot contain ".concat(s.join(" ")),e,t),new W(r,e,t,n,this.errors)}},{key:"_reportError",value:function(e,t,n,i){this.errors.push(new y(e,t,n,i))}},{key:"_parseBindingAst",value:function(e,t,n,i){var r=this._parseQuote(e,t);if(null!=r)return r;this._checkNoInterpolation(e,t,i);var s=this._stripComments(e),a=this._lexer.tokenize(s);return new $e(e,t,n,a,s.length,!1,this.errors,e.length-s.length).parseChain()}},{key:"_parseQuote",value:function(e,t){if(null==e)return null;var n=e.indexOf(":");if(-1==n)return null;var i=e.substring(0,n).trim();if(!Me(i))return null;var r=e.substring(n+1);return new k(new x(0,e.length),i,r,t)}},{key:"parseTemplateBindings",value:function(e,t,n,i){var r=this._lexer.tokenize(t);return new $e(t,n,i,r,t.length,!1,this.errors,0).parseTemplateBindings(e)}},{key:"parseInterpolation",value:function(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:Ve,r=this.splitInterpolation(e,t,i);if(null==r)return null;for(var s=[],a=0;a<r.expressions.length;++a){var o=r.expressions[a],u=this._stripComments(o),l=this._lexer.tokenize(u),c=new $e(e,t,n,l,u.length,!1,this.errors,r.offsets[a]+(o.length-u.length)).parseChain();s.push(c)}return new W(new M(new x(0,null==e?0:e.length),r.strings,s),e,t,n,this.errors)}},{key:"splitInterpolation",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:Ve,i=Qe(n),r=e.split(i);if(r.length<=1)return null;for(var s=[],a=[],o=[],u=0,l=0;l<r.length;l++){var c=r[l];l%2==0?(s.push(c),u+=c.length):c.trim().length>0?(u+=n.start.length,a.push(c),o.push(u),u+=c.length+n.end.length):(this._reportError("Blank expressions are not allowed in interpolated strings",e,"at column ".concat(this._findInterpolationErrorColumn(r,l,n)," in"),t),a.push("$implict"),o.push(u))}return new Ge(s,a,o)}},{key:"wrapLiteralPrimitive",value:function(e,t,n){return new W(new I(new x(0,null==e?0:e.length),e),e,t,n,this.errors)}},{key:"_stripComments",value:function(e){var t=this._commentStart(e);return null!=t?e.substring(0,t).trim():e}},{key:"_commentStart",value:function(e){for(var t=null,n=0;n<e.length-1;n++){var i=e.charCodeAt(n),r=e.charCodeAt(n+1);if(47===i&&47==r&&null==t)return n;t===i?t=null:null==t&&Te(i)&&(t=i)}return null}},{key:"_checkNoInterpolation",value:function(e,t,n){var i=Qe(n),r=e.split(i);r.length>1&&this._reportError("Got interpolation
|