@angular/language-service 12.2.0 → 12.2.4
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/bundles/ivy.js +569 -309
- package/bundles/language-service.js +615 -622
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v12.2.
|
|
2
|
+
* @license Angular v12.2.4
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -47,7 +47,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
47
47
|
return [null, elementName];
|
|
48
48
|
}
|
|
49
49
|
const colonIndex = elementName.indexOf(':', 1);
|
|
50
|
-
if (colonIndex
|
|
50
|
+
if (colonIndex === -1) {
|
|
51
51
|
throw new Error(`Unsupported format "${elementName}" expecting ":namespace:name"`);
|
|
52
52
|
}
|
|
53
53
|
return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
|
|
@@ -98,7 +98,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
98
98
|
}
|
|
99
99
|
getContentType(prefix) {
|
|
100
100
|
if (typeof this.contentType === 'object') {
|
|
101
|
-
const overrideType = prefix
|
|
101
|
+
const overrideType = prefix === undefined ? undefined : this.contentType[prefix];
|
|
102
102
|
return overrideType !== null && overrideType !== void 0 ? overrideType : this.contentType.default;
|
|
103
103
|
}
|
|
104
104
|
return this.contentType;
|
|
@@ -2254,15 +2254,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
2254
2254
|
function error(msg) {
|
|
2255
2255
|
throw new Error(`Internal Error: ${msg}`);
|
|
2256
2256
|
}
|
|
2257
|
-
function syntaxError(msg, parseErrors) {
|
|
2258
|
-
const error = Error(msg);
|
|
2259
|
-
error[ERROR_SYNTAX_ERROR] = true;
|
|
2260
|
-
if (parseErrors)
|
|
2261
|
-
error[ERROR_PARSE_ERRORS] = parseErrors;
|
|
2262
|
-
return error;
|
|
2263
|
-
}
|
|
2264
|
-
const ERROR_SYNTAX_ERROR = 'ngSyntaxError';
|
|
2265
|
-
const ERROR_PARSE_ERRORS = 'ngParseErrors';
|
|
2266
2257
|
const STRING_MAP_PROTO = Object.getPrototypeOf({});
|
|
2267
2258
|
function isStrictStringMap(obj) {
|
|
2268
2259
|
return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
|
|
@@ -4344,13 +4335,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
4344
4335
|
return shouldForwardDeclare ? fn([], [new ReturnStatement(values)]) : values;
|
|
4345
4336
|
}
|
|
4346
4337
|
|
|
4347
|
-
/**
|
|
4348
|
-
* @license
|
|
4349
|
-
* Copyright Google LLC All Rights Reserved.
|
|
4350
|
-
*
|
|
4351
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
4352
|
-
* found in the LICENSE file at https://angular.io/license
|
|
4353
|
-
*/
|
|
4354
4338
|
var R3FactoryDelegateType;
|
|
4355
4339
|
(function (R3FactoryDelegateType) {
|
|
4356
4340
|
R3FactoryDelegateType[R3FactoryDelegateType["Class"] = 0] = "Class";
|
|
@@ -4782,14 +4766,259 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
4782
4766
|
* Use of this source code is governed by an MIT-style license that can be
|
|
4783
4767
|
* found in the LICENSE file at https://angular.io/license
|
|
4784
4768
|
*/
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
const
|
|
4790
|
-
|
|
4791
|
-
|
|
4769
|
+
const $EOF = 0;
|
|
4770
|
+
const $BSPACE = 8;
|
|
4771
|
+
const $TAB = 9;
|
|
4772
|
+
const $LF = 10;
|
|
4773
|
+
const $VTAB = 11;
|
|
4774
|
+
const $FF = 12;
|
|
4775
|
+
const $CR = 13;
|
|
4776
|
+
const $SPACE = 32;
|
|
4777
|
+
const $BANG = 33;
|
|
4778
|
+
const $DQ = 34;
|
|
4779
|
+
const $HASH = 35;
|
|
4780
|
+
const $$ = 36;
|
|
4781
|
+
const $PERCENT = 37;
|
|
4782
|
+
const $AMPERSAND = 38;
|
|
4783
|
+
const $SQ = 39;
|
|
4784
|
+
const $LPAREN = 40;
|
|
4785
|
+
const $RPAREN = 41;
|
|
4786
|
+
const $STAR = 42;
|
|
4787
|
+
const $PLUS = 43;
|
|
4788
|
+
const $COMMA = 44;
|
|
4789
|
+
const $MINUS = 45;
|
|
4790
|
+
const $PERIOD = 46;
|
|
4791
|
+
const $SLASH = 47;
|
|
4792
|
+
const $COLON = 58;
|
|
4793
|
+
const $SEMICOLON = 59;
|
|
4794
|
+
const $LT = 60;
|
|
4795
|
+
const $EQ = 61;
|
|
4796
|
+
const $GT = 62;
|
|
4797
|
+
const $QUESTION = 63;
|
|
4798
|
+
const $0 = 48;
|
|
4799
|
+
const $7 = 55;
|
|
4800
|
+
const $9 = 57;
|
|
4801
|
+
const $A = 65;
|
|
4802
|
+
const $E = 69;
|
|
4803
|
+
const $F = 70;
|
|
4804
|
+
const $X = 88;
|
|
4805
|
+
const $Z = 90;
|
|
4806
|
+
const $LBRACKET = 91;
|
|
4807
|
+
const $BACKSLASH = 92;
|
|
4808
|
+
const $RBRACKET = 93;
|
|
4809
|
+
const $CARET = 94;
|
|
4810
|
+
const $_ = 95;
|
|
4811
|
+
const $a = 97;
|
|
4812
|
+
const $b = 98;
|
|
4813
|
+
const $e = 101;
|
|
4814
|
+
const $f = 102;
|
|
4815
|
+
const $n = 110;
|
|
4816
|
+
const $r = 114;
|
|
4817
|
+
const $t = 116;
|
|
4818
|
+
const $u = 117;
|
|
4819
|
+
const $v = 118;
|
|
4820
|
+
const $x = 120;
|
|
4821
|
+
const $z = 122;
|
|
4822
|
+
const $LBRACE = 123;
|
|
4823
|
+
const $BAR = 124;
|
|
4824
|
+
const $RBRACE = 125;
|
|
4825
|
+
const $NBSP = 160;
|
|
4826
|
+
const $BT = 96;
|
|
4827
|
+
function isWhitespace(code) {
|
|
4828
|
+
return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
|
|
4792
4829
|
}
|
|
4830
|
+
function isDigit(code) {
|
|
4831
|
+
return $0 <= code && code <= $9;
|
|
4832
|
+
}
|
|
4833
|
+
function isAsciiLetter(code) {
|
|
4834
|
+
return code >= $a && code <= $z || code >= $A && code <= $Z;
|
|
4835
|
+
}
|
|
4836
|
+
function isAsciiHexDigit(code) {
|
|
4837
|
+
return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
|
|
4838
|
+
}
|
|
4839
|
+
function isNewLine(code) {
|
|
4840
|
+
return code === $LF || code === $CR;
|
|
4841
|
+
}
|
|
4842
|
+
function isOctalDigit(code) {
|
|
4843
|
+
return $0 <= code && code <= $7;
|
|
4844
|
+
}
|
|
4845
|
+
function isQuote(code) {
|
|
4846
|
+
return code === $SQ || code === $DQ || code === $BT;
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
/**
|
|
4850
|
+
* @license
|
|
4851
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4852
|
+
*
|
|
4853
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
4854
|
+
* found in the LICENSE file at https://angular.io/license
|
|
4855
|
+
*/
|
|
4856
|
+
class ParseLocation {
|
|
4857
|
+
constructor(file, offset, line, col) {
|
|
4858
|
+
this.file = file;
|
|
4859
|
+
this.offset = offset;
|
|
4860
|
+
this.line = line;
|
|
4861
|
+
this.col = col;
|
|
4862
|
+
}
|
|
4863
|
+
toString() {
|
|
4864
|
+
return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
|
|
4865
|
+
}
|
|
4866
|
+
moveBy(delta) {
|
|
4867
|
+
const source = this.file.content;
|
|
4868
|
+
const len = source.length;
|
|
4869
|
+
let offset = this.offset;
|
|
4870
|
+
let line = this.line;
|
|
4871
|
+
let col = this.col;
|
|
4872
|
+
while (offset > 0 && delta < 0) {
|
|
4873
|
+
offset--;
|
|
4874
|
+
delta++;
|
|
4875
|
+
const ch = source.charCodeAt(offset);
|
|
4876
|
+
if (ch == $LF) {
|
|
4877
|
+
line--;
|
|
4878
|
+
const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
|
|
4879
|
+
col = priorLine > 0 ? offset - priorLine : offset;
|
|
4880
|
+
}
|
|
4881
|
+
else {
|
|
4882
|
+
col--;
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
while (offset < len && delta > 0) {
|
|
4886
|
+
const ch = source.charCodeAt(offset);
|
|
4887
|
+
offset++;
|
|
4888
|
+
delta--;
|
|
4889
|
+
if (ch == $LF) {
|
|
4890
|
+
line++;
|
|
4891
|
+
col = 0;
|
|
4892
|
+
}
|
|
4893
|
+
else {
|
|
4894
|
+
col++;
|
|
4895
|
+
}
|
|
4896
|
+
}
|
|
4897
|
+
return new ParseLocation(this.file, offset, line, col);
|
|
4898
|
+
}
|
|
4899
|
+
// Return the source around the location
|
|
4900
|
+
// Up to `maxChars` or `maxLines` on each side of the location
|
|
4901
|
+
getContext(maxChars, maxLines) {
|
|
4902
|
+
const content = this.file.content;
|
|
4903
|
+
let startOffset = this.offset;
|
|
4904
|
+
if (startOffset != null) {
|
|
4905
|
+
if (startOffset > content.length - 1) {
|
|
4906
|
+
startOffset = content.length - 1;
|
|
4907
|
+
}
|
|
4908
|
+
let endOffset = startOffset;
|
|
4909
|
+
let ctxChars = 0;
|
|
4910
|
+
let ctxLines = 0;
|
|
4911
|
+
while (ctxChars < maxChars && startOffset > 0) {
|
|
4912
|
+
startOffset--;
|
|
4913
|
+
ctxChars++;
|
|
4914
|
+
if (content[startOffset] == '\n') {
|
|
4915
|
+
if (++ctxLines == maxLines) {
|
|
4916
|
+
break;
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
}
|
|
4920
|
+
ctxChars = 0;
|
|
4921
|
+
ctxLines = 0;
|
|
4922
|
+
while (ctxChars < maxChars && endOffset < content.length - 1) {
|
|
4923
|
+
endOffset++;
|
|
4924
|
+
ctxChars++;
|
|
4925
|
+
if (content[endOffset] == '\n') {
|
|
4926
|
+
if (++ctxLines == maxLines) {
|
|
4927
|
+
break;
|
|
4928
|
+
}
|
|
4929
|
+
}
|
|
4930
|
+
}
|
|
4931
|
+
return {
|
|
4932
|
+
before: content.substring(startOffset, this.offset),
|
|
4933
|
+
after: content.substring(this.offset, endOffset + 1),
|
|
4934
|
+
};
|
|
4935
|
+
}
|
|
4936
|
+
return null;
|
|
4937
|
+
}
|
|
4938
|
+
}
|
|
4939
|
+
class ParseSourceFile {
|
|
4940
|
+
constructor(content, url) {
|
|
4941
|
+
this.content = content;
|
|
4942
|
+
this.url = url;
|
|
4943
|
+
}
|
|
4944
|
+
}
|
|
4945
|
+
class ParseSourceSpan {
|
|
4946
|
+
/**
|
|
4947
|
+
* Create an object that holds information about spans of tokens/nodes captured during
|
|
4948
|
+
* lexing/parsing of text.
|
|
4949
|
+
*
|
|
4950
|
+
* @param start
|
|
4951
|
+
* The location of the start of the span (having skipped leading trivia).
|
|
4952
|
+
* Skipping leading trivia makes source-spans more "user friendly", since things like HTML
|
|
4953
|
+
* elements will appear to begin at the start of the opening tag, rather than at the start of any
|
|
4954
|
+
* leading trivia, which could include newlines.
|
|
4955
|
+
*
|
|
4956
|
+
* @param end
|
|
4957
|
+
* The location of the end of the span.
|
|
4958
|
+
*
|
|
4959
|
+
* @param fullStart
|
|
4960
|
+
* The start of the token without skipping the leading trivia.
|
|
4961
|
+
* This is used by tooling that splits tokens further, such as extracting Angular interpolations
|
|
4962
|
+
* from text tokens. Such tooling creates new source-spans relative to the original token's
|
|
4963
|
+
* source-span. If leading trivia characters have been skipped then the new source-spans may be
|
|
4964
|
+
* incorrectly offset.
|
|
4965
|
+
*
|
|
4966
|
+
* @param details
|
|
4967
|
+
* Additional information (such as identifier names) that should be associated with the span.
|
|
4968
|
+
*/
|
|
4969
|
+
constructor(start, end, fullStart = start, details = null) {
|
|
4970
|
+
this.start = start;
|
|
4971
|
+
this.end = end;
|
|
4972
|
+
this.fullStart = fullStart;
|
|
4973
|
+
this.details = details;
|
|
4974
|
+
}
|
|
4975
|
+
toString() {
|
|
4976
|
+
return this.start.file.content.substring(this.start.offset, this.end.offset);
|
|
4977
|
+
}
|
|
4978
|
+
}
|
|
4979
|
+
var ParseErrorLevel;
|
|
4980
|
+
(function (ParseErrorLevel) {
|
|
4981
|
+
ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
|
|
4982
|
+
ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
|
|
4983
|
+
})(ParseErrorLevel || (ParseErrorLevel = {}));
|
|
4984
|
+
class ParseError {
|
|
4985
|
+
constructor(span, msg, level = ParseErrorLevel.ERROR) {
|
|
4986
|
+
this.span = span;
|
|
4987
|
+
this.msg = msg;
|
|
4988
|
+
this.level = level;
|
|
4989
|
+
}
|
|
4990
|
+
contextualMessage() {
|
|
4991
|
+
const ctx = this.span.start.getContext(100, 3);
|
|
4992
|
+
return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` :
|
|
4993
|
+
this.msg;
|
|
4994
|
+
}
|
|
4995
|
+
toString() {
|
|
4996
|
+
const details = this.span.details ? `, ${this.span.details}` : '';
|
|
4997
|
+
return `${this.contextualMessage()}: ${this.span.start}${details}`;
|
|
4998
|
+
}
|
|
4999
|
+
}
|
|
5000
|
+
/**
|
|
5001
|
+
* Generates Source Span object for a given R3 Type for JIT mode.
|
|
5002
|
+
*
|
|
5003
|
+
* @param kind Component or Directive.
|
|
5004
|
+
* @param typeName name of the Component or Directive.
|
|
5005
|
+
* @param sourceUrl reference to Component or Directive source.
|
|
5006
|
+
* @returns instance of ParseSourceSpan that represent a given Component or Directive.
|
|
5007
|
+
*/
|
|
5008
|
+
function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
|
|
5009
|
+
const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;
|
|
5010
|
+
const sourceFile = new ParseSourceFile('', sourceFileName);
|
|
5011
|
+
return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
|
|
5012
|
+
}
|
|
5013
|
+
function syntaxError(msg, parseErrors) {
|
|
5014
|
+
const error = Error(msg);
|
|
5015
|
+
error[ERROR_SYNTAX_ERROR] = true;
|
|
5016
|
+
if (parseErrors)
|
|
5017
|
+
error[ERROR_PARSE_ERRORS] = parseErrors;
|
|
5018
|
+
return error;
|
|
5019
|
+
}
|
|
5020
|
+
const ERROR_SYNTAX_ERROR = 'ngSyntaxError';
|
|
5021
|
+
const ERROR_PARSE_ERRORS = 'ngParseErrors';
|
|
4793
5022
|
let _anonymousTypeIndex = 0;
|
|
4794
5023
|
function identifierName(compileIdentifier) {
|
|
4795
5024
|
if (!compileIdentifier || !compileIdentifier.reference) {
|
|
@@ -4818,334 +5047,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
4818
5047
|
}
|
|
4819
5048
|
return identifier;
|
|
4820
5049
|
}
|
|
4821
|
-
function
|
|
4822
|
-
return
|
|
4823
|
-
}
|
|
4824
|
-
function rendererTypeName(compType) {
|
|
4825
|
-
return `RenderType_${identifierName({ reference: compType })}`;
|
|
4826
|
-
}
|
|
4827
|
-
function hostViewClassName(compType) {
|
|
4828
|
-
return `HostView_${identifierName({ reference: compType })}`;
|
|
4829
|
-
}
|
|
4830
|
-
function componentFactoryName(compType) {
|
|
4831
|
-
return `${identifierName({ reference: compType })}NgFactory`;
|
|
4832
|
-
}
|
|
4833
|
-
var CompileSummaryKind;
|
|
4834
|
-
(function (CompileSummaryKind) {
|
|
4835
|
-
CompileSummaryKind[CompileSummaryKind["Pipe"] = 0] = "Pipe";
|
|
4836
|
-
CompileSummaryKind[CompileSummaryKind["Directive"] = 1] = "Directive";
|
|
4837
|
-
CompileSummaryKind[CompileSummaryKind["NgModule"] = 2] = "NgModule";
|
|
4838
|
-
CompileSummaryKind[CompileSummaryKind["Injectable"] = 3] = "Injectable";
|
|
4839
|
-
})(CompileSummaryKind || (CompileSummaryKind = {}));
|
|
4840
|
-
function tokenName(token) {
|
|
4841
|
-
return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
|
|
4842
|
-
}
|
|
4843
|
-
function tokenReference(token) {
|
|
4844
|
-
if (token.identifier != null) {
|
|
4845
|
-
return token.identifier.reference;
|
|
4846
|
-
}
|
|
4847
|
-
else {
|
|
4848
|
-
return token.value;
|
|
4849
|
-
}
|
|
4850
|
-
}
|
|
4851
|
-
/**
|
|
4852
|
-
* Metadata about a stylesheet
|
|
4853
|
-
*/
|
|
4854
|
-
class CompileStylesheetMetadata {
|
|
4855
|
-
constructor({ moduleUrl, styles, styleUrls } = {}) {
|
|
4856
|
-
this.moduleUrl = moduleUrl || null;
|
|
4857
|
-
this.styles = _normalizeArray(styles);
|
|
4858
|
-
this.styleUrls = _normalizeArray(styleUrls);
|
|
4859
|
-
}
|
|
4860
|
-
}
|
|
4861
|
-
/**
|
|
4862
|
-
* Metadata regarding compilation of a template.
|
|
4863
|
-
*/
|
|
4864
|
-
class CompileTemplateMetadata {
|
|
4865
|
-
constructor({ encapsulation, template, templateUrl, htmlAst, styles, styleUrls, externalStylesheets, animations, ngContentSelectors, interpolation, isInline, preserveWhitespaces }) {
|
|
4866
|
-
this.encapsulation = encapsulation;
|
|
4867
|
-
this.template = template;
|
|
4868
|
-
this.templateUrl = templateUrl;
|
|
4869
|
-
this.htmlAst = htmlAst;
|
|
4870
|
-
this.styles = _normalizeArray(styles);
|
|
4871
|
-
this.styleUrls = _normalizeArray(styleUrls);
|
|
4872
|
-
this.externalStylesheets = _normalizeArray(externalStylesheets);
|
|
4873
|
-
this.animations = animations ? flatten(animations) : [];
|
|
4874
|
-
this.ngContentSelectors = ngContentSelectors || [];
|
|
4875
|
-
if (interpolation && interpolation.length != 2) {
|
|
4876
|
-
throw new Error(`'interpolation' should have a start and an end symbol.`);
|
|
4877
|
-
}
|
|
4878
|
-
this.interpolation = interpolation;
|
|
4879
|
-
this.isInline = isInline;
|
|
4880
|
-
this.preserveWhitespaces = preserveWhitespaces;
|
|
4881
|
-
}
|
|
4882
|
-
toSummary() {
|
|
4883
|
-
return {
|
|
4884
|
-
ngContentSelectors: this.ngContentSelectors,
|
|
4885
|
-
encapsulation: this.encapsulation,
|
|
4886
|
-
styles: this.styles,
|
|
4887
|
-
animations: this.animations
|
|
4888
|
-
};
|
|
4889
|
-
}
|
|
4890
|
-
}
|
|
4891
|
-
/**
|
|
4892
|
-
* Metadata regarding compilation of a directive.
|
|
4893
|
-
*/
|
|
4894
|
-
class CompileDirectiveMetadata {
|
|
4895
|
-
constructor({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, hostListeners, hostProperties, hostAttributes, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }) {
|
|
4896
|
-
this.isHost = !!isHost;
|
|
4897
|
-
this.type = type;
|
|
4898
|
-
this.isComponent = isComponent;
|
|
4899
|
-
this.selector = selector;
|
|
4900
|
-
this.exportAs = exportAs;
|
|
4901
|
-
this.changeDetection = changeDetection;
|
|
4902
|
-
this.inputs = inputs;
|
|
4903
|
-
this.outputs = outputs;
|
|
4904
|
-
this.hostListeners = hostListeners;
|
|
4905
|
-
this.hostProperties = hostProperties;
|
|
4906
|
-
this.hostAttributes = hostAttributes;
|
|
4907
|
-
this.providers = _normalizeArray(providers);
|
|
4908
|
-
this.viewProviders = _normalizeArray(viewProviders);
|
|
4909
|
-
this.queries = _normalizeArray(queries);
|
|
4910
|
-
this.guards = guards;
|
|
4911
|
-
this.viewQueries = _normalizeArray(viewQueries);
|
|
4912
|
-
this.entryComponents = _normalizeArray(entryComponents);
|
|
4913
|
-
this.template = template;
|
|
4914
|
-
this.componentViewType = componentViewType;
|
|
4915
|
-
this.rendererType = rendererType;
|
|
4916
|
-
this.componentFactory = componentFactory;
|
|
4917
|
-
}
|
|
4918
|
-
static create({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }) {
|
|
4919
|
-
const hostListeners = {};
|
|
4920
|
-
const hostProperties = {};
|
|
4921
|
-
const hostAttributes = {};
|
|
4922
|
-
if (host != null) {
|
|
4923
|
-
Object.keys(host).forEach(key => {
|
|
4924
|
-
const value = host[key];
|
|
4925
|
-
const matches = key.match(HOST_REG_EXP);
|
|
4926
|
-
if (matches === null) {
|
|
4927
|
-
hostAttributes[key] = value;
|
|
4928
|
-
}
|
|
4929
|
-
else if (matches[1] != null) {
|
|
4930
|
-
hostProperties[matches[1]] = value;
|
|
4931
|
-
}
|
|
4932
|
-
else if (matches[2] != null) {
|
|
4933
|
-
hostListeners[matches[2]] = value;
|
|
4934
|
-
}
|
|
4935
|
-
});
|
|
4936
|
-
}
|
|
4937
|
-
const inputsMap = {};
|
|
4938
|
-
if (inputs != null) {
|
|
4939
|
-
inputs.forEach((bindConfig) => {
|
|
4940
|
-
// canonical syntax: `dirProp: elProp`
|
|
4941
|
-
// if there is no `:`, use dirProp = elProp
|
|
4942
|
-
const parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
|
|
4943
|
-
inputsMap[parts[0]] = parts[1];
|
|
4944
|
-
});
|
|
4945
|
-
}
|
|
4946
|
-
const outputsMap = {};
|
|
4947
|
-
if (outputs != null) {
|
|
4948
|
-
outputs.forEach((bindConfig) => {
|
|
4949
|
-
// canonical syntax: `dirProp: elProp`
|
|
4950
|
-
// if there is no `:`, use dirProp = elProp
|
|
4951
|
-
const parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
|
|
4952
|
-
outputsMap[parts[0]] = parts[1];
|
|
4953
|
-
});
|
|
4954
|
-
}
|
|
4955
|
-
return new CompileDirectiveMetadata({
|
|
4956
|
-
isHost,
|
|
4957
|
-
type,
|
|
4958
|
-
isComponent: !!isComponent,
|
|
4959
|
-
selector,
|
|
4960
|
-
exportAs,
|
|
4961
|
-
changeDetection,
|
|
4962
|
-
inputs: inputsMap,
|
|
4963
|
-
outputs: outputsMap,
|
|
4964
|
-
hostListeners,
|
|
4965
|
-
hostProperties,
|
|
4966
|
-
hostAttributes,
|
|
4967
|
-
providers,
|
|
4968
|
-
viewProviders,
|
|
4969
|
-
queries,
|
|
4970
|
-
guards,
|
|
4971
|
-
viewQueries,
|
|
4972
|
-
entryComponents,
|
|
4973
|
-
template,
|
|
4974
|
-
componentViewType,
|
|
4975
|
-
rendererType,
|
|
4976
|
-
componentFactory,
|
|
4977
|
-
});
|
|
4978
|
-
}
|
|
4979
|
-
toSummary() {
|
|
4980
|
-
return {
|
|
4981
|
-
summaryKind: CompileSummaryKind.Directive,
|
|
4982
|
-
type: this.type,
|
|
4983
|
-
isComponent: this.isComponent,
|
|
4984
|
-
selector: this.selector,
|
|
4985
|
-
exportAs: this.exportAs,
|
|
4986
|
-
inputs: this.inputs,
|
|
4987
|
-
outputs: this.outputs,
|
|
4988
|
-
hostListeners: this.hostListeners,
|
|
4989
|
-
hostProperties: this.hostProperties,
|
|
4990
|
-
hostAttributes: this.hostAttributes,
|
|
4991
|
-
providers: this.providers,
|
|
4992
|
-
viewProviders: this.viewProviders,
|
|
4993
|
-
queries: this.queries,
|
|
4994
|
-
guards: this.guards,
|
|
4995
|
-
viewQueries: this.viewQueries,
|
|
4996
|
-
entryComponents: this.entryComponents,
|
|
4997
|
-
changeDetection: this.changeDetection,
|
|
4998
|
-
template: this.template && this.template.toSummary(),
|
|
4999
|
-
componentViewType: this.componentViewType,
|
|
5000
|
-
rendererType: this.rendererType,
|
|
5001
|
-
componentFactory: this.componentFactory
|
|
5002
|
-
};
|
|
5003
|
-
}
|
|
5004
|
-
}
|
|
5005
|
-
class CompilePipeMetadata {
|
|
5006
|
-
constructor({ type, name, pure }) {
|
|
5007
|
-
this.type = type;
|
|
5008
|
-
this.name = name;
|
|
5009
|
-
this.pure = !!pure;
|
|
5010
|
-
}
|
|
5011
|
-
toSummary() {
|
|
5012
|
-
return {
|
|
5013
|
-
summaryKind: CompileSummaryKind.Pipe,
|
|
5014
|
-
type: this.type,
|
|
5015
|
-
name: this.name,
|
|
5016
|
-
pure: this.pure
|
|
5017
|
-
};
|
|
5018
|
-
}
|
|
5019
|
-
}
|
|
5020
|
-
/**
|
|
5021
|
-
* Metadata regarding compilation of a module.
|
|
5022
|
-
*/
|
|
5023
|
-
class CompileNgModuleMetadata {
|
|
5024
|
-
constructor({ type, providers, declaredDirectives, exportedDirectives, declaredPipes, exportedPipes, entryComponents, bootstrapComponents, importedModules, exportedModules, schemas, transitiveModule, id }) {
|
|
5025
|
-
this.type = type || null;
|
|
5026
|
-
this.declaredDirectives = _normalizeArray(declaredDirectives);
|
|
5027
|
-
this.exportedDirectives = _normalizeArray(exportedDirectives);
|
|
5028
|
-
this.declaredPipes = _normalizeArray(declaredPipes);
|
|
5029
|
-
this.exportedPipes = _normalizeArray(exportedPipes);
|
|
5030
|
-
this.providers = _normalizeArray(providers);
|
|
5031
|
-
this.entryComponents = _normalizeArray(entryComponents);
|
|
5032
|
-
this.bootstrapComponents = _normalizeArray(bootstrapComponents);
|
|
5033
|
-
this.importedModules = _normalizeArray(importedModules);
|
|
5034
|
-
this.exportedModules = _normalizeArray(exportedModules);
|
|
5035
|
-
this.schemas = _normalizeArray(schemas);
|
|
5036
|
-
this.id = id || null;
|
|
5037
|
-
this.transitiveModule = transitiveModule || null;
|
|
5038
|
-
}
|
|
5039
|
-
toSummary() {
|
|
5040
|
-
const module = this.transitiveModule;
|
|
5041
|
-
return {
|
|
5042
|
-
summaryKind: CompileSummaryKind.NgModule,
|
|
5043
|
-
type: this.type,
|
|
5044
|
-
entryComponents: module.entryComponents,
|
|
5045
|
-
providers: module.providers,
|
|
5046
|
-
modules: module.modules,
|
|
5047
|
-
exportedDirectives: module.exportedDirectives,
|
|
5048
|
-
exportedPipes: module.exportedPipes
|
|
5049
|
-
};
|
|
5050
|
-
}
|
|
5051
|
-
}
|
|
5052
|
-
class TransitiveCompileNgModuleMetadata {
|
|
5053
|
-
constructor() {
|
|
5054
|
-
this.directivesSet = new Set();
|
|
5055
|
-
this.directives = [];
|
|
5056
|
-
this.exportedDirectivesSet = new Set();
|
|
5057
|
-
this.exportedDirectives = [];
|
|
5058
|
-
this.pipesSet = new Set();
|
|
5059
|
-
this.pipes = [];
|
|
5060
|
-
this.exportedPipesSet = new Set();
|
|
5061
|
-
this.exportedPipes = [];
|
|
5062
|
-
this.modulesSet = new Set();
|
|
5063
|
-
this.modules = [];
|
|
5064
|
-
this.entryComponentsSet = new Set();
|
|
5065
|
-
this.entryComponents = [];
|
|
5066
|
-
this.providers = [];
|
|
5067
|
-
}
|
|
5068
|
-
addProvider(provider, module) {
|
|
5069
|
-
this.providers.push({ provider: provider, module: module });
|
|
5070
|
-
}
|
|
5071
|
-
addDirective(id) {
|
|
5072
|
-
if (!this.directivesSet.has(id.reference)) {
|
|
5073
|
-
this.directivesSet.add(id.reference);
|
|
5074
|
-
this.directives.push(id);
|
|
5075
|
-
}
|
|
5076
|
-
}
|
|
5077
|
-
addExportedDirective(id) {
|
|
5078
|
-
if (!this.exportedDirectivesSet.has(id.reference)) {
|
|
5079
|
-
this.exportedDirectivesSet.add(id.reference);
|
|
5080
|
-
this.exportedDirectives.push(id);
|
|
5081
|
-
}
|
|
5082
|
-
}
|
|
5083
|
-
addPipe(id) {
|
|
5084
|
-
if (!this.pipesSet.has(id.reference)) {
|
|
5085
|
-
this.pipesSet.add(id.reference);
|
|
5086
|
-
this.pipes.push(id);
|
|
5087
|
-
}
|
|
5088
|
-
}
|
|
5089
|
-
addExportedPipe(id) {
|
|
5090
|
-
if (!this.exportedPipesSet.has(id.reference)) {
|
|
5091
|
-
this.exportedPipesSet.add(id.reference);
|
|
5092
|
-
this.exportedPipes.push(id);
|
|
5093
|
-
}
|
|
5094
|
-
}
|
|
5095
|
-
addModule(id) {
|
|
5096
|
-
if (!this.modulesSet.has(id.reference)) {
|
|
5097
|
-
this.modulesSet.add(id.reference);
|
|
5098
|
-
this.modules.push(id);
|
|
5099
|
-
}
|
|
5100
|
-
}
|
|
5101
|
-
addEntryComponent(ec) {
|
|
5102
|
-
if (!this.entryComponentsSet.has(ec.componentType)) {
|
|
5103
|
-
this.entryComponentsSet.add(ec.componentType);
|
|
5104
|
-
this.entryComponents.push(ec);
|
|
5105
|
-
}
|
|
5106
|
-
}
|
|
5107
|
-
}
|
|
5108
|
-
function _normalizeArray(obj) {
|
|
5109
|
-
return obj || [];
|
|
5110
|
-
}
|
|
5111
|
-
class ProviderMeta {
|
|
5112
|
-
constructor(token, { useClass, useValue, useExisting, useFactory, deps, multi }) {
|
|
5113
|
-
this.token = token;
|
|
5114
|
-
this.useClass = useClass || null;
|
|
5115
|
-
this.useValue = useValue;
|
|
5116
|
-
this.useExisting = useExisting;
|
|
5117
|
-
this.useFactory = useFactory || null;
|
|
5118
|
-
this.dependencies = deps || null;
|
|
5119
|
-
this.multi = !!multi;
|
|
5120
|
-
}
|
|
5121
|
-
}
|
|
5122
|
-
function flatten(list) {
|
|
5123
|
-
return list.reduce((flat, item) => {
|
|
5124
|
-
const flatItem = Array.isArray(item) ? flatten(item) : item;
|
|
5125
|
-
return flat.concat(flatItem);
|
|
5126
|
-
}, []);
|
|
5127
|
-
}
|
|
5128
|
-
function jitSourceUrl(url) {
|
|
5129
|
-
// Note: We need 3 "/" so that ng shows up as a separate domain
|
|
5130
|
-
// in the chrome dev tools.
|
|
5131
|
-
return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///');
|
|
5132
|
-
}
|
|
5133
|
-
function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
|
|
5134
|
-
let url;
|
|
5135
|
-
if (templateMeta.isInline) {
|
|
5136
|
-
if (compMeta.type.reference instanceof StaticSymbol) {
|
|
5137
|
-
// Note: a .ts file might contain multiple components with inline templates,
|
|
5138
|
-
// so we need to give them unique urls, as these will be used for sourcemaps.
|
|
5139
|
-
url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`;
|
|
5140
|
-
}
|
|
5141
|
-
else {
|
|
5142
|
-
url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`;
|
|
5143
|
-
}
|
|
5144
|
-
}
|
|
5145
|
-
else {
|
|
5146
|
-
url = templateMeta.templateUrl;
|
|
5147
|
-
}
|
|
5148
|
-
return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url);
|
|
5050
|
+
function sanitizeIdentifier(name) {
|
|
5051
|
+
return name.replace(/\W/g, '_');
|
|
5149
5052
|
}
|
|
5150
5053
|
|
|
5151
5054
|
/**
|
|
@@ -5601,255 +5504,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
5601
5504
|
return statement.isEquivalent(literal('use strict').toStmt());
|
|
5602
5505
|
}
|
|
5603
5506
|
|
|
5604
|
-
/**
|
|
5605
|
-
* @license
|
|
5606
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5607
|
-
*
|
|
5608
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
5609
|
-
* found in the LICENSE file at https://angular.io/license
|
|
5610
|
-
*/
|
|
5611
|
-
const $EOF = 0;
|
|
5612
|
-
const $BSPACE = 8;
|
|
5613
|
-
const $TAB = 9;
|
|
5614
|
-
const $LF = 10;
|
|
5615
|
-
const $VTAB = 11;
|
|
5616
|
-
const $FF = 12;
|
|
5617
|
-
const $CR = 13;
|
|
5618
|
-
const $SPACE = 32;
|
|
5619
|
-
const $BANG = 33;
|
|
5620
|
-
const $DQ = 34;
|
|
5621
|
-
const $HASH = 35;
|
|
5622
|
-
const $$ = 36;
|
|
5623
|
-
const $PERCENT = 37;
|
|
5624
|
-
const $AMPERSAND = 38;
|
|
5625
|
-
const $SQ = 39;
|
|
5626
|
-
const $LPAREN = 40;
|
|
5627
|
-
const $RPAREN = 41;
|
|
5628
|
-
const $STAR = 42;
|
|
5629
|
-
const $PLUS = 43;
|
|
5630
|
-
const $COMMA = 44;
|
|
5631
|
-
const $MINUS = 45;
|
|
5632
|
-
const $PERIOD = 46;
|
|
5633
|
-
const $SLASH = 47;
|
|
5634
|
-
const $COLON = 58;
|
|
5635
|
-
const $SEMICOLON = 59;
|
|
5636
|
-
const $LT = 60;
|
|
5637
|
-
const $EQ = 61;
|
|
5638
|
-
const $GT = 62;
|
|
5639
|
-
const $QUESTION = 63;
|
|
5640
|
-
const $0 = 48;
|
|
5641
|
-
const $7 = 55;
|
|
5642
|
-
const $9 = 57;
|
|
5643
|
-
const $A = 65;
|
|
5644
|
-
const $E = 69;
|
|
5645
|
-
const $F = 70;
|
|
5646
|
-
const $X = 88;
|
|
5647
|
-
const $Z = 90;
|
|
5648
|
-
const $LBRACKET = 91;
|
|
5649
|
-
const $BACKSLASH = 92;
|
|
5650
|
-
const $RBRACKET = 93;
|
|
5651
|
-
const $CARET = 94;
|
|
5652
|
-
const $_ = 95;
|
|
5653
|
-
const $a = 97;
|
|
5654
|
-
const $b = 98;
|
|
5655
|
-
const $e = 101;
|
|
5656
|
-
const $f = 102;
|
|
5657
|
-
const $n = 110;
|
|
5658
|
-
const $r = 114;
|
|
5659
|
-
const $t = 116;
|
|
5660
|
-
const $u = 117;
|
|
5661
|
-
const $v = 118;
|
|
5662
|
-
const $x = 120;
|
|
5663
|
-
const $z = 122;
|
|
5664
|
-
const $LBRACE = 123;
|
|
5665
|
-
const $BAR = 124;
|
|
5666
|
-
const $RBRACE = 125;
|
|
5667
|
-
const $NBSP = 160;
|
|
5668
|
-
const $BT = 96;
|
|
5669
|
-
function isWhitespace(code) {
|
|
5670
|
-
return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
|
|
5671
|
-
}
|
|
5672
|
-
function isDigit(code) {
|
|
5673
|
-
return $0 <= code && code <= $9;
|
|
5674
|
-
}
|
|
5675
|
-
function isAsciiLetter(code) {
|
|
5676
|
-
return code >= $a && code <= $z || code >= $A && code <= $Z;
|
|
5677
|
-
}
|
|
5678
|
-
function isAsciiHexDigit(code) {
|
|
5679
|
-
return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
|
|
5680
|
-
}
|
|
5681
|
-
function isNewLine(code) {
|
|
5682
|
-
return code === $LF || code === $CR;
|
|
5683
|
-
}
|
|
5684
|
-
function isOctalDigit(code) {
|
|
5685
|
-
return $0 <= code && code <= $7;
|
|
5686
|
-
}
|
|
5687
|
-
|
|
5688
|
-
/**
|
|
5689
|
-
* @license
|
|
5690
|
-
* Copyright Google LLC All Rights Reserved.
|
|
5691
|
-
*
|
|
5692
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
5693
|
-
* found in the LICENSE file at https://angular.io/license
|
|
5694
|
-
*/
|
|
5695
|
-
class ParseLocation {
|
|
5696
|
-
constructor(file, offset, line, col) {
|
|
5697
|
-
this.file = file;
|
|
5698
|
-
this.offset = offset;
|
|
5699
|
-
this.line = line;
|
|
5700
|
-
this.col = col;
|
|
5701
|
-
}
|
|
5702
|
-
toString() {
|
|
5703
|
-
return this.offset != null ? `${this.file.url}@${this.line}:${this.col}` : this.file.url;
|
|
5704
|
-
}
|
|
5705
|
-
moveBy(delta) {
|
|
5706
|
-
const source = this.file.content;
|
|
5707
|
-
const len = source.length;
|
|
5708
|
-
let offset = this.offset;
|
|
5709
|
-
let line = this.line;
|
|
5710
|
-
let col = this.col;
|
|
5711
|
-
while (offset > 0 && delta < 0) {
|
|
5712
|
-
offset--;
|
|
5713
|
-
delta++;
|
|
5714
|
-
const ch = source.charCodeAt(offset);
|
|
5715
|
-
if (ch == $LF) {
|
|
5716
|
-
line--;
|
|
5717
|
-
const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
|
|
5718
|
-
col = priorLine > 0 ? offset - priorLine : offset;
|
|
5719
|
-
}
|
|
5720
|
-
else {
|
|
5721
|
-
col--;
|
|
5722
|
-
}
|
|
5723
|
-
}
|
|
5724
|
-
while (offset < len && delta > 0) {
|
|
5725
|
-
const ch = source.charCodeAt(offset);
|
|
5726
|
-
offset++;
|
|
5727
|
-
delta--;
|
|
5728
|
-
if (ch == $LF) {
|
|
5729
|
-
line++;
|
|
5730
|
-
col = 0;
|
|
5731
|
-
}
|
|
5732
|
-
else {
|
|
5733
|
-
col++;
|
|
5734
|
-
}
|
|
5735
|
-
}
|
|
5736
|
-
return new ParseLocation(this.file, offset, line, col);
|
|
5737
|
-
}
|
|
5738
|
-
// Return the source around the location
|
|
5739
|
-
// Up to `maxChars` or `maxLines` on each side of the location
|
|
5740
|
-
getContext(maxChars, maxLines) {
|
|
5741
|
-
const content = this.file.content;
|
|
5742
|
-
let startOffset = this.offset;
|
|
5743
|
-
if (startOffset != null) {
|
|
5744
|
-
if (startOffset > content.length - 1) {
|
|
5745
|
-
startOffset = content.length - 1;
|
|
5746
|
-
}
|
|
5747
|
-
let endOffset = startOffset;
|
|
5748
|
-
let ctxChars = 0;
|
|
5749
|
-
let ctxLines = 0;
|
|
5750
|
-
while (ctxChars < maxChars && startOffset > 0) {
|
|
5751
|
-
startOffset--;
|
|
5752
|
-
ctxChars++;
|
|
5753
|
-
if (content[startOffset] == '\n') {
|
|
5754
|
-
if (++ctxLines == maxLines) {
|
|
5755
|
-
break;
|
|
5756
|
-
}
|
|
5757
|
-
}
|
|
5758
|
-
}
|
|
5759
|
-
ctxChars = 0;
|
|
5760
|
-
ctxLines = 0;
|
|
5761
|
-
while (ctxChars < maxChars && endOffset < content.length - 1) {
|
|
5762
|
-
endOffset++;
|
|
5763
|
-
ctxChars++;
|
|
5764
|
-
if (content[endOffset] == '\n') {
|
|
5765
|
-
if (++ctxLines == maxLines) {
|
|
5766
|
-
break;
|
|
5767
|
-
}
|
|
5768
|
-
}
|
|
5769
|
-
}
|
|
5770
|
-
return {
|
|
5771
|
-
before: content.substring(startOffset, this.offset),
|
|
5772
|
-
after: content.substring(this.offset, endOffset + 1),
|
|
5773
|
-
};
|
|
5774
|
-
}
|
|
5775
|
-
return null;
|
|
5776
|
-
}
|
|
5777
|
-
}
|
|
5778
|
-
class ParseSourceFile {
|
|
5779
|
-
constructor(content, url) {
|
|
5780
|
-
this.content = content;
|
|
5781
|
-
this.url = url;
|
|
5782
|
-
}
|
|
5783
|
-
}
|
|
5784
|
-
class ParseSourceSpan {
|
|
5785
|
-
/**
|
|
5786
|
-
* Create an object that holds information about spans of tokens/nodes captured during
|
|
5787
|
-
* lexing/parsing of text.
|
|
5788
|
-
*
|
|
5789
|
-
* @param start
|
|
5790
|
-
* The location of the start of the span (having skipped leading trivia).
|
|
5791
|
-
* Skipping leading trivia makes source-spans more "user friendly", since things like HTML
|
|
5792
|
-
* elements will appear to begin at the start of the opening tag, rather than at the start of any
|
|
5793
|
-
* leading trivia, which could include newlines.
|
|
5794
|
-
*
|
|
5795
|
-
* @param end
|
|
5796
|
-
* The location of the end of the span.
|
|
5797
|
-
*
|
|
5798
|
-
* @param fullStart
|
|
5799
|
-
* The start of the token without skipping the leading trivia.
|
|
5800
|
-
* This is used by tooling that splits tokens further, such as extracting Angular interpolations
|
|
5801
|
-
* from text tokens. Such tooling creates new source-spans relative to the original token's
|
|
5802
|
-
* source-span. If leading trivia characters have been skipped then the new source-spans may be
|
|
5803
|
-
* incorrectly offset.
|
|
5804
|
-
*
|
|
5805
|
-
* @param details
|
|
5806
|
-
* Additional information (such as identifier names) that should be associated with the span.
|
|
5807
|
-
*/
|
|
5808
|
-
constructor(start, end, fullStart = start, details = null) {
|
|
5809
|
-
this.start = start;
|
|
5810
|
-
this.end = end;
|
|
5811
|
-
this.fullStart = fullStart;
|
|
5812
|
-
this.details = details;
|
|
5813
|
-
}
|
|
5814
|
-
toString() {
|
|
5815
|
-
return this.start.file.content.substring(this.start.offset, this.end.offset);
|
|
5816
|
-
}
|
|
5817
|
-
}
|
|
5818
|
-
var ParseErrorLevel;
|
|
5819
|
-
(function (ParseErrorLevel) {
|
|
5820
|
-
ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
|
|
5821
|
-
ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
|
|
5822
|
-
})(ParseErrorLevel || (ParseErrorLevel = {}));
|
|
5823
|
-
class ParseError {
|
|
5824
|
-
constructor(span, msg, level = ParseErrorLevel.ERROR) {
|
|
5825
|
-
this.span = span;
|
|
5826
|
-
this.msg = msg;
|
|
5827
|
-
this.level = level;
|
|
5828
|
-
}
|
|
5829
|
-
contextualMessage() {
|
|
5830
|
-
const ctx = this.span.start.getContext(100, 3);
|
|
5831
|
-
return ctx ? `${this.msg} ("${ctx.before}[${ParseErrorLevel[this.level]} ->]${ctx.after}")` :
|
|
5832
|
-
this.msg;
|
|
5833
|
-
}
|
|
5834
|
-
toString() {
|
|
5835
|
-
const details = this.span.details ? `, ${this.span.details}` : '';
|
|
5836
|
-
return `${this.contextualMessage()}: ${this.span.start}${details}`;
|
|
5837
|
-
}
|
|
5838
|
-
}
|
|
5839
|
-
/**
|
|
5840
|
-
* Generates Source Span object for a given R3 Type for JIT mode.
|
|
5841
|
-
*
|
|
5842
|
-
* @param kind Component or Directive.
|
|
5843
|
-
* @param typeName name of the Component or Directive.
|
|
5844
|
-
* @param sourceUrl reference to Component or Directive source.
|
|
5845
|
-
* @returns instance of ParseSourceSpan that represent a given Component or Directive.
|
|
5846
|
-
*/
|
|
5847
|
-
function r3JitTypeSourceSpan(kind, typeName, sourceUrl) {
|
|
5848
|
-
const sourceFileName = `in ${kind} ${typeName} in ${sourceUrl}`;
|
|
5849
|
-
const sourceFile = new ParseSourceFile('', sourceFileName);
|
|
5850
|
-
return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
|
|
5851
|
-
}
|
|
5852
|
-
|
|
5853
5507
|
/**
|
|
5854
5508
|
* @license
|
|
5855
5509
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -8597,6 +8251,348 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
8597
8251
|
}
|
|
8598
8252
|
}
|
|
8599
8253
|
|
|
8254
|
+
/**
|
|
8255
|
+
* @license
|
|
8256
|
+
* Copyright Google LLC All Rights Reserved.
|
|
8257
|
+
*
|
|
8258
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
8259
|
+
* found in the LICENSE file at https://angular.io/license
|
|
8260
|
+
*/
|
|
8261
|
+
// group 0: "[prop] or (event) or @trigger"
|
|
8262
|
+
// group 1: "prop" from "[prop]"
|
|
8263
|
+
// group 2: "event" from "(event)"
|
|
8264
|
+
// group 3: "@trigger" from "@trigger"
|
|
8265
|
+
const HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
|
|
8266
|
+
function viewClassName(compType, embeddedTemplateIndex) {
|
|
8267
|
+
return `View_${identifierName({ reference: compType })}_${embeddedTemplateIndex}`;
|
|
8268
|
+
}
|
|
8269
|
+
function rendererTypeName(compType) {
|
|
8270
|
+
return `RenderType_${identifierName({ reference: compType })}`;
|
|
8271
|
+
}
|
|
8272
|
+
function hostViewClassName(compType) {
|
|
8273
|
+
return `HostView_${identifierName({ reference: compType })}`;
|
|
8274
|
+
}
|
|
8275
|
+
function componentFactoryName(compType) {
|
|
8276
|
+
return `${identifierName({ reference: compType })}NgFactory`;
|
|
8277
|
+
}
|
|
8278
|
+
var CompileSummaryKind;
|
|
8279
|
+
(function (CompileSummaryKind) {
|
|
8280
|
+
CompileSummaryKind[CompileSummaryKind["Pipe"] = 0] = "Pipe";
|
|
8281
|
+
CompileSummaryKind[CompileSummaryKind["Directive"] = 1] = "Directive";
|
|
8282
|
+
CompileSummaryKind[CompileSummaryKind["NgModule"] = 2] = "NgModule";
|
|
8283
|
+
CompileSummaryKind[CompileSummaryKind["Injectable"] = 3] = "Injectable";
|
|
8284
|
+
})(CompileSummaryKind || (CompileSummaryKind = {}));
|
|
8285
|
+
function tokenName(token) {
|
|
8286
|
+
return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
|
|
8287
|
+
}
|
|
8288
|
+
function tokenReference(token) {
|
|
8289
|
+
if (token.identifier != null) {
|
|
8290
|
+
return token.identifier.reference;
|
|
8291
|
+
}
|
|
8292
|
+
else {
|
|
8293
|
+
return token.value;
|
|
8294
|
+
}
|
|
8295
|
+
}
|
|
8296
|
+
/**
|
|
8297
|
+
* Metadata about a stylesheet
|
|
8298
|
+
*/
|
|
8299
|
+
class CompileStylesheetMetadata {
|
|
8300
|
+
constructor({ moduleUrl, styles, styleUrls } = {}) {
|
|
8301
|
+
this.moduleUrl = moduleUrl || null;
|
|
8302
|
+
this.styles = _normalizeArray(styles);
|
|
8303
|
+
this.styleUrls = _normalizeArray(styleUrls);
|
|
8304
|
+
}
|
|
8305
|
+
}
|
|
8306
|
+
/**
|
|
8307
|
+
* Metadata regarding compilation of a template.
|
|
8308
|
+
*/
|
|
8309
|
+
class CompileTemplateMetadata {
|
|
8310
|
+
constructor({ encapsulation, template, templateUrl, htmlAst, styles, styleUrls, externalStylesheets, animations, ngContentSelectors, interpolation, isInline, preserveWhitespaces }) {
|
|
8311
|
+
this.encapsulation = encapsulation;
|
|
8312
|
+
this.template = template;
|
|
8313
|
+
this.templateUrl = templateUrl;
|
|
8314
|
+
this.htmlAst = htmlAst;
|
|
8315
|
+
this.styles = _normalizeArray(styles);
|
|
8316
|
+
this.styleUrls = _normalizeArray(styleUrls);
|
|
8317
|
+
this.externalStylesheets = _normalizeArray(externalStylesheets);
|
|
8318
|
+
this.animations = animations ? flatten(animations) : [];
|
|
8319
|
+
this.ngContentSelectors = ngContentSelectors || [];
|
|
8320
|
+
if (interpolation && interpolation.length != 2) {
|
|
8321
|
+
throw new Error(`'interpolation' should have a start and an end symbol.`);
|
|
8322
|
+
}
|
|
8323
|
+
this.interpolation = interpolation;
|
|
8324
|
+
this.isInline = isInline;
|
|
8325
|
+
this.preserveWhitespaces = preserveWhitespaces;
|
|
8326
|
+
}
|
|
8327
|
+
toSummary() {
|
|
8328
|
+
return {
|
|
8329
|
+
ngContentSelectors: this.ngContentSelectors,
|
|
8330
|
+
encapsulation: this.encapsulation,
|
|
8331
|
+
styles: this.styles,
|
|
8332
|
+
animations: this.animations
|
|
8333
|
+
};
|
|
8334
|
+
}
|
|
8335
|
+
}
|
|
8336
|
+
/**
|
|
8337
|
+
* Metadata regarding compilation of a directive.
|
|
8338
|
+
*/
|
|
8339
|
+
class CompileDirectiveMetadata {
|
|
8340
|
+
constructor({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, hostListeners, hostProperties, hostAttributes, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }) {
|
|
8341
|
+
this.isHost = !!isHost;
|
|
8342
|
+
this.type = type;
|
|
8343
|
+
this.isComponent = isComponent;
|
|
8344
|
+
this.selector = selector;
|
|
8345
|
+
this.exportAs = exportAs;
|
|
8346
|
+
this.changeDetection = changeDetection;
|
|
8347
|
+
this.inputs = inputs;
|
|
8348
|
+
this.outputs = outputs;
|
|
8349
|
+
this.hostListeners = hostListeners;
|
|
8350
|
+
this.hostProperties = hostProperties;
|
|
8351
|
+
this.hostAttributes = hostAttributes;
|
|
8352
|
+
this.providers = _normalizeArray(providers);
|
|
8353
|
+
this.viewProviders = _normalizeArray(viewProviders);
|
|
8354
|
+
this.queries = _normalizeArray(queries);
|
|
8355
|
+
this.guards = guards;
|
|
8356
|
+
this.viewQueries = _normalizeArray(viewQueries);
|
|
8357
|
+
this.entryComponents = _normalizeArray(entryComponents);
|
|
8358
|
+
this.template = template;
|
|
8359
|
+
this.componentViewType = componentViewType;
|
|
8360
|
+
this.rendererType = rendererType;
|
|
8361
|
+
this.componentFactory = componentFactory;
|
|
8362
|
+
}
|
|
8363
|
+
static create({ isHost, type, isComponent, selector, exportAs, changeDetection, inputs, outputs, host, providers, viewProviders, queries, guards, viewQueries, entryComponents, template, componentViewType, rendererType, componentFactory }) {
|
|
8364
|
+
const hostListeners = {};
|
|
8365
|
+
const hostProperties = {};
|
|
8366
|
+
const hostAttributes = {};
|
|
8367
|
+
if (host != null) {
|
|
8368
|
+
Object.keys(host).forEach(key => {
|
|
8369
|
+
const value = host[key];
|
|
8370
|
+
const matches = key.match(HOST_REG_EXP);
|
|
8371
|
+
if (matches === null) {
|
|
8372
|
+
hostAttributes[key] = value;
|
|
8373
|
+
}
|
|
8374
|
+
else if (matches[1] != null) {
|
|
8375
|
+
hostProperties[matches[1]] = value;
|
|
8376
|
+
}
|
|
8377
|
+
else if (matches[2] != null) {
|
|
8378
|
+
hostListeners[matches[2]] = value;
|
|
8379
|
+
}
|
|
8380
|
+
});
|
|
8381
|
+
}
|
|
8382
|
+
const inputsMap = {};
|
|
8383
|
+
if (inputs != null) {
|
|
8384
|
+
inputs.forEach((bindConfig) => {
|
|
8385
|
+
// canonical syntax: `dirProp: elProp`
|
|
8386
|
+
// if there is no `:`, use dirProp = elProp
|
|
8387
|
+
const parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
|
|
8388
|
+
inputsMap[parts[0]] = parts[1];
|
|
8389
|
+
});
|
|
8390
|
+
}
|
|
8391
|
+
const outputsMap = {};
|
|
8392
|
+
if (outputs != null) {
|
|
8393
|
+
outputs.forEach((bindConfig) => {
|
|
8394
|
+
// canonical syntax: `dirProp: elProp`
|
|
8395
|
+
// if there is no `:`, use dirProp = elProp
|
|
8396
|
+
const parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
|
|
8397
|
+
outputsMap[parts[0]] = parts[1];
|
|
8398
|
+
});
|
|
8399
|
+
}
|
|
8400
|
+
return new CompileDirectiveMetadata({
|
|
8401
|
+
isHost,
|
|
8402
|
+
type,
|
|
8403
|
+
isComponent: !!isComponent,
|
|
8404
|
+
selector,
|
|
8405
|
+
exportAs,
|
|
8406
|
+
changeDetection,
|
|
8407
|
+
inputs: inputsMap,
|
|
8408
|
+
outputs: outputsMap,
|
|
8409
|
+
hostListeners,
|
|
8410
|
+
hostProperties,
|
|
8411
|
+
hostAttributes,
|
|
8412
|
+
providers,
|
|
8413
|
+
viewProviders,
|
|
8414
|
+
queries,
|
|
8415
|
+
guards,
|
|
8416
|
+
viewQueries,
|
|
8417
|
+
entryComponents,
|
|
8418
|
+
template,
|
|
8419
|
+
componentViewType,
|
|
8420
|
+
rendererType,
|
|
8421
|
+
componentFactory,
|
|
8422
|
+
});
|
|
8423
|
+
}
|
|
8424
|
+
toSummary() {
|
|
8425
|
+
return {
|
|
8426
|
+
summaryKind: CompileSummaryKind.Directive,
|
|
8427
|
+
type: this.type,
|
|
8428
|
+
isComponent: this.isComponent,
|
|
8429
|
+
selector: this.selector,
|
|
8430
|
+
exportAs: this.exportAs,
|
|
8431
|
+
inputs: this.inputs,
|
|
8432
|
+
outputs: this.outputs,
|
|
8433
|
+
hostListeners: this.hostListeners,
|
|
8434
|
+
hostProperties: this.hostProperties,
|
|
8435
|
+
hostAttributes: this.hostAttributes,
|
|
8436
|
+
providers: this.providers,
|
|
8437
|
+
viewProviders: this.viewProviders,
|
|
8438
|
+
queries: this.queries,
|
|
8439
|
+
guards: this.guards,
|
|
8440
|
+
viewQueries: this.viewQueries,
|
|
8441
|
+
entryComponents: this.entryComponents,
|
|
8442
|
+
changeDetection: this.changeDetection,
|
|
8443
|
+
template: this.template && this.template.toSummary(),
|
|
8444
|
+
componentViewType: this.componentViewType,
|
|
8445
|
+
rendererType: this.rendererType,
|
|
8446
|
+
componentFactory: this.componentFactory
|
|
8447
|
+
};
|
|
8448
|
+
}
|
|
8449
|
+
}
|
|
8450
|
+
class CompilePipeMetadata {
|
|
8451
|
+
constructor({ type, name, pure }) {
|
|
8452
|
+
this.type = type;
|
|
8453
|
+
this.name = name;
|
|
8454
|
+
this.pure = !!pure;
|
|
8455
|
+
}
|
|
8456
|
+
toSummary() {
|
|
8457
|
+
return {
|
|
8458
|
+
summaryKind: CompileSummaryKind.Pipe,
|
|
8459
|
+
type: this.type,
|
|
8460
|
+
name: this.name,
|
|
8461
|
+
pure: this.pure
|
|
8462
|
+
};
|
|
8463
|
+
}
|
|
8464
|
+
}
|
|
8465
|
+
/**
|
|
8466
|
+
* Metadata regarding compilation of a module.
|
|
8467
|
+
*/
|
|
8468
|
+
class CompileNgModuleMetadata {
|
|
8469
|
+
constructor({ type, providers, declaredDirectives, exportedDirectives, declaredPipes, exportedPipes, entryComponents, bootstrapComponents, importedModules, exportedModules, schemas, transitiveModule, id }) {
|
|
8470
|
+
this.type = type || null;
|
|
8471
|
+
this.declaredDirectives = _normalizeArray(declaredDirectives);
|
|
8472
|
+
this.exportedDirectives = _normalizeArray(exportedDirectives);
|
|
8473
|
+
this.declaredPipes = _normalizeArray(declaredPipes);
|
|
8474
|
+
this.exportedPipes = _normalizeArray(exportedPipes);
|
|
8475
|
+
this.providers = _normalizeArray(providers);
|
|
8476
|
+
this.entryComponents = _normalizeArray(entryComponents);
|
|
8477
|
+
this.bootstrapComponents = _normalizeArray(bootstrapComponents);
|
|
8478
|
+
this.importedModules = _normalizeArray(importedModules);
|
|
8479
|
+
this.exportedModules = _normalizeArray(exportedModules);
|
|
8480
|
+
this.schemas = _normalizeArray(schemas);
|
|
8481
|
+
this.id = id || null;
|
|
8482
|
+
this.transitiveModule = transitiveModule || null;
|
|
8483
|
+
}
|
|
8484
|
+
toSummary() {
|
|
8485
|
+
const module = this.transitiveModule;
|
|
8486
|
+
return {
|
|
8487
|
+
summaryKind: CompileSummaryKind.NgModule,
|
|
8488
|
+
type: this.type,
|
|
8489
|
+
entryComponents: module.entryComponents,
|
|
8490
|
+
providers: module.providers,
|
|
8491
|
+
modules: module.modules,
|
|
8492
|
+
exportedDirectives: module.exportedDirectives,
|
|
8493
|
+
exportedPipes: module.exportedPipes
|
|
8494
|
+
};
|
|
8495
|
+
}
|
|
8496
|
+
}
|
|
8497
|
+
class TransitiveCompileNgModuleMetadata {
|
|
8498
|
+
constructor() {
|
|
8499
|
+
this.directivesSet = new Set();
|
|
8500
|
+
this.directives = [];
|
|
8501
|
+
this.exportedDirectivesSet = new Set();
|
|
8502
|
+
this.exportedDirectives = [];
|
|
8503
|
+
this.pipesSet = new Set();
|
|
8504
|
+
this.pipes = [];
|
|
8505
|
+
this.exportedPipesSet = new Set();
|
|
8506
|
+
this.exportedPipes = [];
|
|
8507
|
+
this.modulesSet = new Set();
|
|
8508
|
+
this.modules = [];
|
|
8509
|
+
this.entryComponentsSet = new Set();
|
|
8510
|
+
this.entryComponents = [];
|
|
8511
|
+
this.providers = [];
|
|
8512
|
+
}
|
|
8513
|
+
addProvider(provider, module) {
|
|
8514
|
+
this.providers.push({ provider: provider, module: module });
|
|
8515
|
+
}
|
|
8516
|
+
addDirective(id) {
|
|
8517
|
+
if (!this.directivesSet.has(id.reference)) {
|
|
8518
|
+
this.directivesSet.add(id.reference);
|
|
8519
|
+
this.directives.push(id);
|
|
8520
|
+
}
|
|
8521
|
+
}
|
|
8522
|
+
addExportedDirective(id) {
|
|
8523
|
+
if (!this.exportedDirectivesSet.has(id.reference)) {
|
|
8524
|
+
this.exportedDirectivesSet.add(id.reference);
|
|
8525
|
+
this.exportedDirectives.push(id);
|
|
8526
|
+
}
|
|
8527
|
+
}
|
|
8528
|
+
addPipe(id) {
|
|
8529
|
+
if (!this.pipesSet.has(id.reference)) {
|
|
8530
|
+
this.pipesSet.add(id.reference);
|
|
8531
|
+
this.pipes.push(id);
|
|
8532
|
+
}
|
|
8533
|
+
}
|
|
8534
|
+
addExportedPipe(id) {
|
|
8535
|
+
if (!this.exportedPipesSet.has(id.reference)) {
|
|
8536
|
+
this.exportedPipesSet.add(id.reference);
|
|
8537
|
+
this.exportedPipes.push(id);
|
|
8538
|
+
}
|
|
8539
|
+
}
|
|
8540
|
+
addModule(id) {
|
|
8541
|
+
if (!this.modulesSet.has(id.reference)) {
|
|
8542
|
+
this.modulesSet.add(id.reference);
|
|
8543
|
+
this.modules.push(id);
|
|
8544
|
+
}
|
|
8545
|
+
}
|
|
8546
|
+
addEntryComponent(ec) {
|
|
8547
|
+
if (!this.entryComponentsSet.has(ec.componentType)) {
|
|
8548
|
+
this.entryComponentsSet.add(ec.componentType);
|
|
8549
|
+
this.entryComponents.push(ec);
|
|
8550
|
+
}
|
|
8551
|
+
}
|
|
8552
|
+
}
|
|
8553
|
+
function _normalizeArray(obj) {
|
|
8554
|
+
return obj || [];
|
|
8555
|
+
}
|
|
8556
|
+
class ProviderMeta {
|
|
8557
|
+
constructor(token, { useClass, useValue, useExisting, useFactory, deps, multi }) {
|
|
8558
|
+
this.token = token;
|
|
8559
|
+
this.useClass = useClass || null;
|
|
8560
|
+
this.useValue = useValue;
|
|
8561
|
+
this.useExisting = useExisting;
|
|
8562
|
+
this.useFactory = useFactory || null;
|
|
8563
|
+
this.dependencies = deps || null;
|
|
8564
|
+
this.multi = !!multi;
|
|
8565
|
+
}
|
|
8566
|
+
}
|
|
8567
|
+
function flatten(list) {
|
|
8568
|
+
return list.reduce((flat, item) => {
|
|
8569
|
+
const flatItem = Array.isArray(item) ? flatten(item) : item;
|
|
8570
|
+
return flat.concat(flatItem);
|
|
8571
|
+
}, []);
|
|
8572
|
+
}
|
|
8573
|
+
function jitSourceUrl(url) {
|
|
8574
|
+
// Note: We need 3 "/" so that ng shows up as a separate domain
|
|
8575
|
+
// in the chrome dev tools.
|
|
8576
|
+
return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///');
|
|
8577
|
+
}
|
|
8578
|
+
function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
|
|
8579
|
+
let url;
|
|
8580
|
+
if (templateMeta.isInline) {
|
|
8581
|
+
if (compMeta.type.reference instanceof StaticSymbol) {
|
|
8582
|
+
// Note: a .ts file might contain multiple components with inline templates,
|
|
8583
|
+
// so we need to give them unique urls, as these will be used for sourcemaps.
|
|
8584
|
+
url = `${compMeta.type.reference.filePath}.${compMeta.type.reference.name}.html`;
|
|
8585
|
+
}
|
|
8586
|
+
else {
|
|
8587
|
+
url = `${identifierName(ngModuleType)}/${identifierName(compMeta.type)}.html`;
|
|
8588
|
+
}
|
|
8589
|
+
}
|
|
8590
|
+
else {
|
|
8591
|
+
url = templateMeta.templateUrl;
|
|
8592
|
+
}
|
|
8593
|
+
return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url);
|
|
8594
|
+
}
|
|
8595
|
+
|
|
8600
8596
|
/**
|
|
8601
8597
|
* @license
|
|
8602
8598
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -11595,16 +11591,16 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
11595
11591
|
(code < $0 || code > $9);
|
|
11596
11592
|
}
|
|
11597
11593
|
function isDigitEntityEnd(code) {
|
|
11598
|
-
return code
|
|
11594
|
+
return code === $SEMICOLON || code === $EOF || !isAsciiHexDigit(code);
|
|
11599
11595
|
}
|
|
11600
11596
|
function isNamedEntityEnd(code) {
|
|
11601
|
-
return code
|
|
11597
|
+
return code === $SEMICOLON || code === $EOF || !isAsciiLetter(code);
|
|
11602
11598
|
}
|
|
11603
11599
|
function isExpansionCaseStart(peek) {
|
|
11604
11600
|
return peek !== $RBRACE;
|
|
11605
11601
|
}
|
|
11606
11602
|
function compareCharCodeCaseInsensitive(code1, code2) {
|
|
11607
|
-
return toUpperCaseCharCode(code1)
|
|
11603
|
+
return toUpperCaseCharCode(code1) === toUpperCaseCharCode(code2);
|
|
11608
11604
|
}
|
|
11609
11605
|
function toUpperCaseCharCode(code) {
|
|
11610
11606
|
return code >= $a && code <= $z ? code - $a + $A : code;
|
|
@@ -11614,7 +11610,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
11614
11610
|
let lastDstToken = undefined;
|
|
11615
11611
|
for (let i = 0; i < srcTokens.length; i++) {
|
|
11616
11612
|
const token = srcTokens[i];
|
|
11617
|
-
if (lastDstToken && lastDstToken.type
|
|
11613
|
+
if (lastDstToken && lastDstToken.type === TokenType.TEXT && token.type === TokenType.TEXT) {
|
|
11618
11614
|
lastDstToken.parts[0] += token.parts[0];
|
|
11619
11615
|
lastDstToken.sourceSpan.end = token.sourceSpan.end;
|
|
11620
11616
|
}
|
|
@@ -12018,7 +12014,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
12018
12014
|
if (this._peek.type === TokenType.EXPANSION_CASE_EXP_END) {
|
|
12019
12015
|
if (lastOnStack(expansionFormStack, TokenType.EXPANSION_CASE_EXP_START)) {
|
|
12020
12016
|
expansionFormStack.pop();
|
|
12021
|
-
if (expansionFormStack.length
|
|
12017
|
+
if (expansionFormStack.length === 0)
|
|
12022
12018
|
return exp;
|
|
12023
12019
|
}
|
|
12024
12020
|
else {
|
|
@@ -12044,9 +12040,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
12044
12040
|
}
|
|
12045
12041
|
_consumeText(token) {
|
|
12046
12042
|
let text = token.parts[0];
|
|
12047
|
-
if (text.length > 0 && text[0]
|
|
12043
|
+
if (text.length > 0 && text[0] === '\n') {
|
|
12048
12044
|
const parent = this._getParentElement();
|
|
12049
|
-
if (parent != null && parent.children.length
|
|
12045
|
+
if (parent != null && parent.children.length === 0 &&
|
|
12050
12046
|
this.getTagDefinition(parent.name).ignoreFirstLf) {
|
|
12051
12047
|
text = text.substring(1);
|
|
12052
12048
|
}
|
|
@@ -12129,7 +12125,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
12129
12125
|
let unexpectedCloseTagDetected = false;
|
|
12130
12126
|
for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
|
|
12131
12127
|
const el = this._elementStack[stackIndex];
|
|
12132
|
-
if (el.name
|
|
12128
|
+
if (el.name === fullName) {
|
|
12133
12129
|
// Record the parse span with the element that is being closed. Any elements that are
|
|
12134
12130
|
// removed from the element stack at this point are closed implicitly, so they won't get
|
|
12135
12131
|
// an end source span (as there is no explicit closing element).
|
|
@@ -12373,7 +12369,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
12373
12369
|
}
|
|
12374
12370
|
visitExpansion(icu, context) {
|
|
12375
12371
|
this.isExpanded = true;
|
|
12376
|
-
return icu.type
|
|
12372
|
+
return icu.type === 'plural' ? _expandPluralForm(icu, this.errors) :
|
|
12377
12373
|
_expandDefaultForm(icu, this.errors);
|
|
12378
12374
|
}
|
|
12379
12375
|
visitExpansionCase(icuCase, context) {
|
|
@@ -12383,7 +12379,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
12383
12379
|
// Plural forms are expanded to `NgPlural` and `NgPluralCase`s
|
|
12384
12380
|
function _expandPluralForm(ast, errors) {
|
|
12385
12381
|
const children = ast.cases.map(c => {
|
|
12386
|
-
if (PLURAL_CASES.indexOf(c.value)
|
|
12382
|
+
if (PLURAL_CASES.indexOf(c.value) === -1 && !c.value.match(/^=\d+$/)) {
|
|
12387
12383
|
errors.push(new ExpansionError(c.valueSourceSpan, `Plural cases should be "=<number>" or one of ${PLURAL_CASES.join(', ')}`));
|
|
12388
12384
|
}
|
|
12389
12385
|
const expansionResult = expandNodes(c.expression);
|
|
@@ -15407,9 +15403,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
15407
15403
|
function isExponentSign(code) {
|
|
15408
15404
|
return code == $MINUS || code == $PLUS;
|
|
15409
15405
|
}
|
|
15410
|
-
function isQuote(code) {
|
|
15411
|
-
return code === $SQ || code === $DQ || code === $BT;
|
|
15412
|
-
}
|
|
15413
15406
|
function unescape(code) {
|
|
15414
15407
|
switch (code) {
|
|
15415
15408
|
case $n:
|
|
@@ -21482,7 +21475,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
21482
21475
|
* Use of this source code is governed by an MIT-style license that can be
|
|
21483
21476
|
* found in the LICENSE file at https://angular.io/license
|
|
21484
21477
|
*/
|
|
21485
|
-
const VERSION$1 = new Version('12.2.
|
|
21478
|
+
const VERSION$1 = new Version('12.2.4');
|
|
21486
21479
|
|
|
21487
21480
|
/**
|
|
21488
21481
|
* @license
|
|
@@ -37561,7 +37554,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
37561
37554
|
/**
|
|
37562
37555
|
* @publicApi
|
|
37563
37556
|
*/
|
|
37564
|
-
const VERSION$2 = new Version$1('12.2.
|
|
37557
|
+
const VERSION$2 = new Version$1('12.2.4');
|
|
37565
37558
|
|
|
37566
37559
|
/**
|
|
37567
37560
|
* @license
|
|
@@ -42875,16 +42868,16 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
|
|
|
42875
42868
|
/**
|
|
42876
42869
|
* Work out the locale from the potential global properties.
|
|
42877
42870
|
*
|
|
42878
|
-
* * Closure Compiler: use `goog.
|
|
42871
|
+
* * Closure Compiler: use `goog.getLocale()`.
|
|
42879
42872
|
* * Ivy enabled: use `$localize.locale`
|
|
42880
42873
|
*/
|
|
42881
42874
|
function getGlobalLocale() {
|
|
42882
42875
|
if (typeof ngI18nClosureMode !== 'undefined' && ngI18nClosureMode &&
|
|
42883
|
-
typeof goog !== 'undefined' && goog.
|
|
42884
|
-
// * The default `goog.
|
|
42876
|
+
typeof goog !== 'undefined' && goog.getLocale() !== 'en') {
|
|
42877
|
+
// * The default `goog.getLocale()` value is `en`, while Angular used `en-US`.
|
|
42885
42878
|
// * In order to preserve backwards compatibility, we use Angular default value over
|
|
42886
42879
|
// Closure Compiler's one.
|
|
42887
|
-
return goog.
|
|
42880
|
+
return goog.getLocale();
|
|
42888
42881
|
}
|
|
42889
42882
|
else {
|
|
42890
42883
|
// KEEP `typeof $localize !== 'undefined' && $localize.locale` IN SYNC WITH THE LOCALIZE
|