@angular/language-service 10.2.0 → 10.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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v10.2.0
2
+ * @license Angular v10.2.4
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -6061,9 +6061,33 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
6061
6061
  }
6062
6062
  }
6063
6063
  class ParseSourceSpan {
6064
- constructor(start, end, details = null) {
6064
+ /**
6065
+ * Create an object that holds information about spans of tokens/nodes captured during
6066
+ * lexing/parsing of text.
6067
+ *
6068
+ * @param start
6069
+ * The location of the start of the span (having skipped leading trivia).
6070
+ * Skipping leading trivia makes source-spans more "user friendly", since things like HTML
6071
+ * elements will appear to begin at the start of the opening tag, rather than at the start of any
6072
+ * leading trivia, which could include newlines.
6073
+ *
6074
+ * @param end
6075
+ * The location of the end of the span.
6076
+ *
6077
+ * @param fullStart
6078
+ * The start of the token without skipping the leading trivia.
6079
+ * This is used by tooling that splits tokens further, such as extracting Angular interpolations
6080
+ * from text tokens. Such tooling creates new source-spans relative to the original token's
6081
+ * source-span. If leading trivia characters have been skipped then the new source-spans may be
6082
+ * incorrectly offset.
6083
+ *
6084
+ * @param details
6085
+ * Additional information (such as identifier names) that should be associated with the span.
6086
+ */
6087
+ constructor(start, end, fullStart = start, details = null) {
6065
6088
  this.start = start;
6066
6089
  this.end = end;
6090
+ this.fullStart = fullStart;
6067
6091
  this.details = details;
6068
6092
  }
6069
6093
  toString() {
@@ -10225,7 +10249,8 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
10225
10249
  if (this.baseSourceSpan) {
10226
10250
  const start = this.baseSourceSpan.start.moveBy(span.start);
10227
10251
  const end = this.baseSourceSpan.start.moveBy(span.end);
10228
- return new ParseSourceSpan(start, end);
10252
+ const fullStart = this.baseSourceSpan.fullStart.moveBy(span.start);
10253
+ return new ParseSourceSpan(start, end, fullStart);
10229
10254
  }
10230
10255
  else {
10231
10256
  return null;
@@ -11691,17 +11716,19 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
11691
11716
  }
11692
11717
  getSpan(start, leadingTriviaCodePoints) {
11693
11718
  start = start || this;
11694
- let cloned = false;
11719
+ let fullStart = start;
11695
11720
  if (leadingTriviaCodePoints) {
11696
11721
  while (this.diff(start) > 0 && leadingTriviaCodePoints.indexOf(start.peek()) !== -1) {
11697
- if (!cloned) {
11722
+ if (fullStart === start) {
11698
11723
  start = start.clone();
11699
- cloned = true;
11700
11724
  }
11701
11725
  start.advance();
11702
11726
  }
11703
11727
  }
11704
- return new ParseSourceSpan(new ParseLocation(start.file, start.state.offset, start.state.line, start.state.column), new ParseLocation(this.file, this.state.offset, this.state.line, this.state.column));
11728
+ const startLocation = this.locationFromCursor(start);
11729
+ const endLocation = this.locationFromCursor(this);
11730
+ const fullStartLocation = fullStart !== start ? this.locationFromCursor(fullStart) : startLocation;
11731
+ return new ParseSourceSpan(startLocation, endLocation, fullStartLocation);
11705
11732
  }
11706
11733
  getChars(start) {
11707
11734
  return this.input.substring(start.state.offset, this.state.offset);
@@ -11728,6 +11755,9 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
11728
11755
  updatePeek(state) {
11729
11756
  state.peek = state.offset >= this.end ? $EOF : this.charAt(state.offset);
11730
11757
  }
11758
+ locationFromCursor(cursor) {
11759
+ return new ParseLocation(cursor.file, cursor.state.offset, cursor.state.line, cursor.state.column);
11760
+ }
11731
11761
  }
11732
11762
  class EscapedCharacterCursor extends PlainCharacterCursor {
11733
11763
  constructor(fileOrCursor, range) {
@@ -11985,7 +12015,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
11985
12015
  this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
11986
12016
  return;
11987
12017
  }
11988
- const sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end);
12018
+ const sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end, token.sourceSpan.fullStart);
11989
12019
  this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
11990
12020
  this._advance();
11991
12021
  }
@@ -12010,8 +12040,8 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
12010
12040
  this.errors = this.errors.concat(expansionCaseParser.errors);
12011
12041
  return null;
12012
12042
  }
12013
- const sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end);
12014
- const expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end);
12043
+ const sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end, value.sourceSpan.fullStart);
12044
+ const expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end, start.sourceSpan.fullStart);
12015
12045
  return new ExpansionCase(value.parts[0], expansionCaseParser.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
12016
12046
  }
12017
12047
  _collectExpansionExpTokens(start) {
@@ -12092,8 +12122,10 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
12092
12122
  selfClosing = false;
12093
12123
  }
12094
12124
  const end = this._peek.sourceSpan.start;
12095
- const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end);
12096
- const el = new Element$1(fullName, attrs, [], span, span, undefined);
12125
+ const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
12126
+ // Create a separate `startSpan` because `span` may be modified when there is an `end` span.
12127
+ const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
12128
+ const el = new Element$1(fullName, attrs, [], span, startSpan, undefined);
12097
12129
  this._pushElement(el);
12098
12130
  if (selfClosing) {
12099
12131
  // Elements that are self-closed have their `endSourceSpan` set to the full span, as the
@@ -12154,7 +12186,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
12154
12186
  const quoteToken = this._advance();
12155
12187
  end = quoteToken.sourceSpan.end;
12156
12188
  }
12157
- return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan);
12189
+ return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end, attrName.sourceSpan.fullStart), valueSpan);
12158
12190
  }
12159
12191
  _getParentElement() {
12160
12192
  return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
@@ -12735,7 +12767,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
12735
12767
  // The difference of two absolute offsets provide the relative offset
12736
12768
  const startDiff = absoluteSpan.start - sourceSpan.start.offset;
12737
12769
  const endDiff = absoluteSpan.end - sourceSpan.end.offset;
12738
- return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff));
12770
+ return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
12739
12771
  }
12740
12772
 
12741
12773
  /**
@@ -14229,10 +14261,13 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
14229
14261
  return;
14230
14262
  this.error(`Missing expected operator ${operator}`);
14231
14263
  }
14264
+ prettyPrintToken(tok) {
14265
+ return tok === EOF ? 'end of input' : `token ${tok}`;
14266
+ }
14232
14267
  expectIdentifierOrKeyword() {
14233
14268
  const n = this.next;
14234
14269
  if (!n.isIdentifier() && !n.isKeyword()) {
14235
- this.error(`Unexpected token ${n}, expected identifier or keyword`);
14270
+ this.error(`Unexpected ${this.prettyPrintToken(n)}, expected identifier or keyword`);
14236
14271
  return '';
14237
14272
  }
14238
14273
  this.advance();
@@ -14241,7 +14276,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
14241
14276
  expectIdentifierOrKeywordOrString() {
14242
14277
  const n = this.next;
14243
14278
  if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
14244
- this.error(`Unexpected token ${n}, expected identifier, keyword, or string`);
14279
+ this.error(`Unexpected ${this.prettyPrintToken(n)}, expected identifier, keyword, or string`);
14245
14280
  return '';
14246
14281
  }
14247
14282
  this.advance();
@@ -16241,7 +16276,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
16241
16276
  }
16242
16277
  }
16243
16278
  function getOffsetSourceSpan(sourceSpan, { start, end }) {
16244
- return new ParseSourceSpan(sourceSpan.start.moveBy(start), sourceSpan.start.moveBy(end));
16279
+ return new ParseSourceSpan(sourceSpan.fullStart.moveBy(start), sourceSpan.fullStart.moveBy(end));
16245
16280
  }
16246
16281
  const _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
16247
16282
  function _extractPlaceholderName(input) {
@@ -16577,7 +16612,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
16577
16612
  function getSourceSpan(message) {
16578
16613
  const startNode = message.nodes[0];
16579
16614
  const endNode = message.nodes[message.nodes.length - 1];
16580
- return new ParseSourceSpan(startNode.sourceSpan.start, endNode.sourceSpan.end, startNode.sourceSpan.details);
16615
+ return new ParseSourceSpan(startNode.sourceSpan.start, endNode.sourceSpan.end, startNode.sourceSpan.fullStart, startNode.sourceSpan.details);
16581
16616
  }
16582
16617
  /**
16583
16618
  * Convert the list of serialized MessagePieces into two arrays.
@@ -16604,7 +16639,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
16604
16639
  placeHolders.push(part);
16605
16640
  if (pieces[i - 1] instanceof PlaceholderPiece) {
16606
16641
  // There were two placeholders in a row, so we need to add an empty message part.
16607
- messageParts.push(createEmptyMessagePart(part.sourceSpan.end));
16642
+ messageParts.push(createEmptyMessagePart(pieces[i - 1].sourceSpan.end));
16608
16643
  }
16609
16644
  }
16610
16645
  }
@@ -19163,7 +19198,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
19163
19198
  * Use of this source code is governed by an MIT-style license that can be
19164
19199
  * found in the LICENSE file at https://angular.io/license
19165
19200
  */
19166
- const VERSION$1 = new Version('10.2.0');
19201
+ const VERSION$1 = new Version('10.2.4');
19167
19202
 
19168
19203
  /**
19169
19204
  * @license
@@ -19756,7 +19791,7 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
19756
19791
  * Use of this source code is governed by an MIT-style license that can be
19757
19792
  * found in the LICENSE file at https://angular.io/license
19758
19793
  */
19759
- const VERSION$2 = new Version('10.2.0');
19794
+ const VERSION$2 = new Version('10.2.4');
19760
19795
 
19761
19796
  /**
19762
19797
  * @license
@@ -20175,12 +20210,20 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
20175
20210
  */
20176
20211
  class LocalIdentifierStrategy {
20177
20212
  emit(ref, context, importFlags) {
20213
+ const refSf = getSourceFile(ref.node);
20178
20214
  // If the emitter has specified ForceNewImport, then LocalIdentifierStrategy should not use a
20179
20215
  // local identifier at all, *except* in the source file where the node is actually declared.
20180
- if (importFlags & ImportFlags.ForceNewImport &&
20181
- getSourceFile(ref.node) !== getSourceFile(context)) {
20216
+ if (importFlags & ImportFlags.ForceNewImport && refSf !== context) {
20182
20217
  return null;
20183
20218
  }
20219
+ // If referenced node is not an actual TS declaration (e.g. `class Foo` or `function foo() {}`,
20220
+ // etc) and it is in the current file then just use it directly.
20221
+ // This is important because the reference could be a property access (e.g. `exports.foo`). In
20222
+ // such a case, the reference's `identities` property would be `[foo]`, which would result in an
20223
+ // invalid emission of a free-standing `foo` identifier, rather than `exports.foo`.
20224
+ if (!isDeclaration(ref.node) && refSf === context) {
20225
+ return new WrappedNodeExpr(ref.node);
20226
+ }
20184
20227
  // A Reference can have multiple identities in different files, so it may already have an
20185
20228
  // Identifier in the requested context file.
20186
20229
  const identifier = ref.getIdentityIn(context);
@@ -23061,10 +23104,12 @@ define(['exports', 'os', 'typescript', 'fs', 'constants', 'stream', 'util', 'ass
23061
23104
  });
23062
23105
  }
23063
23106
  visitAmbiguousDeclaration(decl, declContext) {
23064
- return decl.kind === 1 /* Inline */ && decl.implementation !== undefined ?
23065
- // Inline declarations with an `implementation` should be visited as expressions
23107
+ return decl.kind === 1 /* Inline */ && decl.implementation !== undefined &&
23108
+ !isDeclaration(decl.implementation) ?
23109
+ // Inline declarations whose `implementation` is a `ts.Expression` should be visited as
23110
+ // an expression.
23066
23111
  this.visitExpression(decl.implementation, declContext) :
23067
- // Otherwise just visit the declaration `node`
23112
+ // Otherwise just visit the `node` as a declaration.
23068
23113
  this.visitDeclaration(decl.node, declContext);
23069
23114
  }
23070
23115
  accessHelper(node, lhs, rhs, context) {
@@ -32076,6 +32121,11 @@ Either add the @Injectable() decorator to '${provider.node.name
32076
32121
  constructor(resolver) {
32077
32122
  this.resolver = resolver;
32078
32123
  this._diagnostics = [];
32124
+ /**
32125
+ * Tracks which `BindingPipe` nodes have already been recorded as invalid, so only one diagnostic
32126
+ * is ever produced per node.
32127
+ */
32128
+ this.recordedPipes = new Set();
32079
32129
  }
32080
32130
  get diagnostics() {
32081
32131
  return this._diagnostics;
@@ -32087,6 +32137,9 @@ Either add the @Injectable() decorator to '${provider.node.name
32087
32137
  this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, ref.valueSpan || ref.sourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_REFERENCE_TARGET), errorMsg));
32088
32138
  }
32089
32139
  missingPipe(templateId, ast) {
32140
+ if (this.recordedPipes.has(ast)) {
32141
+ return;
32142
+ }
32090
32143
  const mapping = this.resolver.getSourceMapping(templateId);
32091
32144
  const errorMsg = `No pipe found with name '${ast.name}'.`;
32092
32145
  const sourceSpan = this.resolver.toParseSourceSpan(templateId, ast.nameSpan);
@@ -32094,6 +32147,7 @@ Either add the @Injectable() decorator to '${provider.node.name
32094
32147
  throw new Error(`Assertion failure: no SourceLocation found for usage of pipe '${ast.name}'.`);
32095
32148
  }
32096
32149
  this._diagnostics.push(makeTemplateDiagnostic(templateId, mapping, sourceSpan, ts.DiagnosticCategory.Error, ngErrorCode(ErrorCode.MISSING_PIPE), errorMsg));
32150
+ this.recordedPipes.add(ast);
32097
32151
  }
32098
32152
  illegalAssignmentToTemplateVar(templateId, assignment, target) {
32099
32153
  const mapping = this.resolver.getSourceMapping(templateId);
@@ -33505,7 +33559,7 @@ Either add the @Injectable() decorator to '${provider.node.name
33505
33559
  if (!this.pipes.has(name)) {
33506
33560
  return null;
33507
33561
  }
33508
- return this.env.pipeInst(this.pipes.get(name));
33562
+ return this.pipes.get(name);
33509
33563
  }
33510
33564
  }
33511
33565
  /**
@@ -33961,18 +34015,21 @@ Either add the @Injectable() decorator to '${provider.node.name
33961
34015
  }
33962
34016
  else if (ast instanceof BindingPipe) {
33963
34017
  const expr = this.translate(ast.exp);
34018
+ const pipeRef = this.tcb.getPipeByName(ast.name);
33964
34019
  let pipe;
33965
- if (this.tcb.env.config.checkTypeOfPipes) {
33966
- pipe = this.tcb.getPipeByName(ast.name);
33967
- if (pipe === null) {
33968
- // No pipe by that name exists in scope. Record this as an error.
33969
- this.tcb.oobRecorder.missingPipe(this.tcb.id, ast);
33970
- // Return an 'any' value to at least allow the rest of the expression to be checked.
33971
- pipe = NULL_AS_ANY;
33972
- }
34020
+ if (pipeRef === null) {
34021
+ // No pipe by that name exists in scope. Record this as an error.
34022
+ this.tcb.oobRecorder.missingPipe(this.tcb.id, ast);
34023
+ // Use an 'any' value to at least allow the rest of the expression to be checked.
34024
+ pipe = NULL_AS_ANY;
34025
+ }
34026
+ else if (this.tcb.env.config.checkTypeOfPipes) {
34027
+ // Use a variable declared as the pipe's type.
34028
+ pipe = this.tcb.env.pipeInst(pipeRef);
33973
34029
  }
33974
34030
  else {
33975
- pipe = ts.createParen(ts.createAsExpression(ts.createNull(), ts.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword)));
34031
+ // Use an 'any' value when not checking the type of the pipe.
34032
+ pipe = NULL_AS_ANY;
33976
34033
  }
33977
34034
  const args = ast.args.map(arg => this.translate(arg));
33978
34035
  const result = tsCallMethod(pipe, 'transform', [expr, ...args]);
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v10.2.0
2
+ * @license Angular v10.2.4
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -3294,9 +3294,33 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
3294
3294
  }
3295
3295
  }
3296
3296
  class ParseSourceSpan {
3297
- constructor(start, end, details = null) {
3297
+ /**
3298
+ * Create an object that holds information about spans of tokens/nodes captured during
3299
+ * lexing/parsing of text.
3300
+ *
3301
+ * @param start
3302
+ * The location of the start of the span (having skipped leading trivia).
3303
+ * Skipping leading trivia makes source-spans more "user friendly", since things like HTML
3304
+ * elements will appear to begin at the start of the opening tag, rather than at the start of any
3305
+ * leading trivia, which could include newlines.
3306
+ *
3307
+ * @param end
3308
+ * The location of the end of the span.
3309
+ *
3310
+ * @param fullStart
3311
+ * The start of the token without skipping the leading trivia.
3312
+ * This is used by tooling that splits tokens further, such as extracting Angular interpolations
3313
+ * from text tokens. Such tooling creates new source-spans relative to the original token's
3314
+ * source-span. If leading trivia characters have been skipped then the new source-spans may be
3315
+ * incorrectly offset.
3316
+ *
3317
+ * @param details
3318
+ * Additional information (such as identifier names) that should be associated with the span.
3319
+ */
3320
+ constructor(start, end, fullStart = start, details = null) {
3298
3321
  this.start = start;
3299
3322
  this.end = end;
3323
+ this.fullStart = fullStart;
3300
3324
  this.details = details;
3301
3325
  }
3302
3326
  toString() {
@@ -7449,7 +7473,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
7449
7473
  if (this.baseSourceSpan) {
7450
7474
  const start = this.baseSourceSpan.start.moveBy(span.start);
7451
7475
  const end = this.baseSourceSpan.start.moveBy(span.end);
7452
- return new ParseSourceSpan(start, end);
7476
+ const fullStart = this.baseSourceSpan.fullStart.moveBy(span.start);
7477
+ return new ParseSourceSpan(start, end, fullStart);
7453
7478
  }
7454
7479
  else {
7455
7480
  return null;
@@ -9002,17 +9027,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9002
9027
  }
9003
9028
  getSpan(start, leadingTriviaCodePoints) {
9004
9029
  start = start || this;
9005
- let cloned = false;
9030
+ let fullStart = start;
9006
9031
  if (leadingTriviaCodePoints) {
9007
9032
  while (this.diff(start) > 0 && leadingTriviaCodePoints.indexOf(start.peek()) !== -1) {
9008
- if (!cloned) {
9033
+ if (fullStart === start) {
9009
9034
  start = start.clone();
9010
- cloned = true;
9011
9035
  }
9012
9036
  start.advance();
9013
9037
  }
9014
9038
  }
9015
- return new ParseSourceSpan(new ParseLocation(start.file, start.state.offset, start.state.line, start.state.column), new ParseLocation(this.file, this.state.offset, this.state.line, this.state.column));
9039
+ const startLocation = this.locationFromCursor(start);
9040
+ const endLocation = this.locationFromCursor(this);
9041
+ const fullStartLocation = fullStart !== start ? this.locationFromCursor(fullStart) : startLocation;
9042
+ return new ParseSourceSpan(startLocation, endLocation, fullStartLocation);
9016
9043
  }
9017
9044
  getChars(start) {
9018
9045
  return this.input.substring(start.state.offset, this.state.offset);
@@ -9039,6 +9066,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9039
9066
  updatePeek(state) {
9040
9067
  state.peek = state.offset >= this.end ? $EOF : this.charAt(state.offset);
9041
9068
  }
9069
+ locationFromCursor(cursor) {
9070
+ return new ParseLocation(cursor.file, cursor.state.offset, cursor.state.line, cursor.state.column);
9071
+ }
9042
9072
  }
9043
9073
  class EscapedCharacterCursor extends PlainCharacterCursor {
9044
9074
  constructor(fileOrCursor, range) {
@@ -9296,7 +9326,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9296
9326
  this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
9297
9327
  return;
9298
9328
  }
9299
- const sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end);
9329
+ const sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end, token.sourceSpan.fullStart);
9300
9330
  this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
9301
9331
  this._advance();
9302
9332
  }
@@ -9321,8 +9351,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9321
9351
  this.errors = this.errors.concat(expansionCaseParser.errors);
9322
9352
  return null;
9323
9353
  }
9324
- const sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end);
9325
- const expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end);
9354
+ const sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end, value.sourceSpan.fullStart);
9355
+ const expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end, start.sourceSpan.fullStart);
9326
9356
  return new ExpansionCase(value.parts[0], expansionCaseParser.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
9327
9357
  }
9328
9358
  _collectExpansionExpTokens(start) {
@@ -9403,8 +9433,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9403
9433
  selfClosing = false;
9404
9434
  }
9405
9435
  const end = this._peek.sourceSpan.start;
9406
- const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end);
9407
- const el = new Element$1(fullName, attrs, [], span, span, undefined);
9436
+ const span = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
9437
+ // Create a separate `startSpan` because `span` may be modified when there is an `end` span.
9438
+ const startSpan = new ParseSourceSpan(startTagToken.sourceSpan.start, end, startTagToken.sourceSpan.fullStart);
9439
+ const el = new Element$1(fullName, attrs, [], span, startSpan, undefined);
9408
9440
  this._pushElement(el);
9409
9441
  if (selfClosing) {
9410
9442
  // Elements that are self-closed have their `endSourceSpan` set to the full span, as the
@@ -9465,7 +9497,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9465
9497
  const quoteToken = this._advance();
9466
9498
  end = quoteToken.sourceSpan.end;
9467
9499
  }
9468
- return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan);
9500
+ return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end, attrName.sourceSpan.fullStart), valueSpan);
9469
9501
  }
9470
9502
  _getParentElement() {
9471
9503
  return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
@@ -10848,7 +10880,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
10848
10880
  // The difference of two absolute offsets provide the relative offset
10849
10881
  const startDiff = absoluteSpan.start - sourceSpan.start.offset;
10850
10882
  const endDiff = absoluteSpan.end - sourceSpan.end.offset;
10851
- return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff));
10883
+ return new ParseSourceSpan(sourceSpan.start.moveBy(startDiff), sourceSpan.end.moveBy(endDiff), sourceSpan.fullStart.moveBy(startDiff), sourceSpan.details);
10852
10884
  }
10853
10885
 
10854
10886
  /**
@@ -11335,7 +11367,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
11335
11367
  const matchedReferences = new Set();
11336
11368
  let component = null;
11337
11369
  const directiveAsts = directives.map((directive) => {
11338
- const sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, `Directive ${identifierName(directive.type)}`);
11370
+ const sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, elementSourceSpan.fullStart, `Directive ${identifierName(directive.type)}`);
11339
11371
  if (directive.isComponent) {
11340
11372
  component = directive;
11341
11373
  }
@@ -13026,10 +13058,13 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13026
13058
  return;
13027
13059
  this.error(`Missing expected operator ${operator}`);
13028
13060
  }
13061
+ prettyPrintToken(tok) {
13062
+ return tok === EOF ? 'end of input' : `token ${tok}`;
13063
+ }
13029
13064
  expectIdentifierOrKeyword() {
13030
13065
  const n = this.next;
13031
13066
  if (!n.isIdentifier() && !n.isKeyword()) {
13032
- this.error(`Unexpected token ${n}, expected identifier or keyword`);
13067
+ this.error(`Unexpected ${this.prettyPrintToken(n)}, expected identifier or keyword`);
13033
13068
  return '';
13034
13069
  }
13035
13070
  this.advance();
@@ -13038,7 +13073,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
13038
13073
  expectIdentifierOrKeywordOrString() {
13039
13074
  const n = this.next;
13040
13075
  if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
13041
- this.error(`Unexpected token ${n}, expected identifier, keyword, or string`);
13076
+ this.error(`Unexpected ${this.prettyPrintToken(n)}, expected identifier, keyword, or string`);
13042
13077
  return '';
13043
13078
  }
13044
13079
  this.advance();
@@ -15038,7 +15073,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15038
15073
  }
15039
15074
  }
15040
15075
  function getOffsetSourceSpan(sourceSpan, { start, end }) {
15041
- return new ParseSourceSpan(sourceSpan.start.moveBy(start), sourceSpan.start.moveBy(end));
15076
+ return new ParseSourceSpan(sourceSpan.fullStart.moveBy(start), sourceSpan.fullStart.moveBy(end));
15042
15077
  }
15043
15078
  const _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
15044
15079
  function _extractPlaceholderName(input) {
@@ -15374,7 +15409,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15374
15409
  function getSourceSpan(message) {
15375
15410
  const startNode = message.nodes[0];
15376
15411
  const endNode = message.nodes[message.nodes.length - 1];
15377
- return new ParseSourceSpan(startNode.sourceSpan.start, endNode.sourceSpan.end, startNode.sourceSpan.details);
15412
+ return new ParseSourceSpan(startNode.sourceSpan.start, endNode.sourceSpan.end, startNode.sourceSpan.fullStart, startNode.sourceSpan.details);
15378
15413
  }
15379
15414
  /**
15380
15415
  * Convert the list of serialized MessagePieces into two arrays.
@@ -15401,7 +15436,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
15401
15436
  placeHolders.push(part);
15402
15437
  if (pieces[i - 1] instanceof PlaceholderPiece) {
15403
15438
  // There were two placeholders in a row, so we need to add an empty message part.
15404
- messageParts.push(createEmptyMessagePart(part.sourceSpan.end));
15439
+ messageParts.push(createEmptyMessagePart(pieces[i - 1].sourceSpan.end));
15405
15440
  }
15406
15441
  }
15407
15442
  }
@@ -17960,7 +17995,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17960
17995
  * Use of this source code is governed by an MIT-style license that can be
17961
17996
  * found in the LICENSE file at https://angular.io/license
17962
17997
  */
17963
- const VERSION$1 = new Version('10.2.0');
17998
+ const VERSION$1 = new Version('10.2.4');
17964
17999
 
17965
18000
  /**
17966
18001
  * @license
@@ -27242,6 +27277,56 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27242
27277
  assertNumber(lView[injectorIndex + 8 /* PARENT */], 'injectorIndex should point to parent injector');
27243
27278
  }
27244
27279
 
27280
+ /**
27281
+ * @license
27282
+ * Copyright Google LLC All Rights Reserved.
27283
+ *
27284
+ * Use of this source code is governed by an MIT-style license that can be
27285
+ * found in the LICENSE file at https://angular.io/license
27286
+ */
27287
+ /**
27288
+ * Used for stringify render output in Ivy.
27289
+ * Important! This function is very performance-sensitive and we should
27290
+ * be extra careful not to introduce megamorphic reads in it.
27291
+ */
27292
+ function renderStringify(value) {
27293
+ if (typeof value === 'string')
27294
+ return value;
27295
+ if (value == null)
27296
+ return '';
27297
+ return '' + value;
27298
+ }
27299
+ /**
27300
+ * Used to stringify a value so that it can be displayed in an error message.
27301
+ * Important! This function contains a megamorphic read and should only be
27302
+ * used for error messages.
27303
+ */
27304
+ function stringifyForError(value) {
27305
+ if (typeof value === 'function')
27306
+ return value.name || value.toString();
27307
+ if (typeof value === 'object' && value != null && typeof value.type === 'function') {
27308
+ return value.type.name || value.type.toString();
27309
+ }
27310
+ return renderStringify(value);
27311
+ }
27312
+ const ɵ0$2 = () => (typeof requestAnimationFrame !== 'undefined' &&
27313
+ requestAnimationFrame || // browser only
27314
+ setTimeout // everything else
27315
+ )
27316
+ .bind(_global$1);
27317
+ const defaultScheduler = (ɵ0$2)();
27318
+
27319
+ /** Called when directives inject each other (creating a circular dependency) */
27320
+ function throwCyclicDependencyError(token, path) {
27321
+ const depPath = path ? `. Dependency path: ${path.join(' > ')} > ${token}` : '';
27322
+ throw new Error(`Circular dependency in DI detected for ${token}${depPath}`);
27323
+ }
27324
+ /** Throws an error when a token is not found in DI. */
27325
+ function throwProviderNotFoundError(token, injectorName) {
27326
+ const injectorDetails = injectorName ? ` in ${injectorName}` : '';
27327
+ throw new Error(`No provider for ${stringifyForError(token)} found${injectorDetails}`);
27328
+ }
27329
+
27245
27330
  /**
27246
27331
  * @license
27247
27332
  * Copyright Google LLC All Rights Reserved.
@@ -27396,11 +27481,11 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27396
27481
  function isProceduralRenderer(renderer) {
27397
27482
  return !!(renderer.listen);
27398
27483
  }
27399
- const ɵ0$2 = (hostElement, rendererType) => {
27484
+ const ɵ0$3 = (hostElement, rendererType) => {
27400
27485
  return getDocument();
27401
27486
  };
27402
27487
  const domRendererFactory3 = {
27403
- createRenderer: ɵ0$2
27488
+ createRenderer: ɵ0$3
27404
27489
  };
27405
27490
 
27406
27491
  /**
@@ -28227,45 +28312,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28227
28312
  return parentView;
28228
28313
  }
28229
28314
 
28230
- /**
28231
- * @license
28232
- * Copyright Google LLC All Rights Reserved.
28233
- *
28234
- * Use of this source code is governed by an MIT-style license that can be
28235
- * found in the LICENSE file at https://angular.io/license
28236
- */
28237
- /**
28238
- * Used for stringify render output in Ivy.
28239
- * Important! This function is very performance-sensitive and we should
28240
- * be extra careful not to introduce megamorphic reads in it.
28241
- */
28242
- function renderStringify(value) {
28243
- if (typeof value === 'string')
28244
- return value;
28245
- if (value == null)
28246
- return '';
28247
- return '' + value;
28248
- }
28249
- /**
28250
- * Used to stringify a value so that it can be displayed in an error message.
28251
- * Important! This function contains a megamorphic read and should only be
28252
- * used for error messages.
28253
- */
28254
- function stringifyForError(value) {
28255
- if (typeof value === 'function')
28256
- return value.name || value.toString();
28257
- if (typeof value === 'object' && value != null && typeof value.type === 'function') {
28258
- return value.type.name || value.type.toString();
28259
- }
28260
- return renderStringify(value);
28261
- }
28262
- const ɵ0$3 = () => (typeof requestAnimationFrame !== 'undefined' &&
28263
- requestAnimationFrame || // browser only
28264
- setTimeout // everything else
28265
- )
28266
- .bind(_global$1);
28267
- const defaultScheduler = (ɵ0$3)();
28268
-
28269
28315
  /**
28270
28316
  * @license
28271
28317
  * Copyright Google LLC All Rights Reserved.
@@ -28515,7 +28561,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28515
28561
  try {
28516
28562
  const value = bloomHash();
28517
28563
  if (value == null && !(flags & InjectFlags.Optional)) {
28518
- throw new Error(`No provider for ${stringifyForError(token)}!`);
28564
+ throwProviderNotFoundError(token);
28519
28565
  }
28520
28566
  else {
28521
28567
  return value;
@@ -28614,7 +28660,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28614
28660
  return notFoundValue;
28615
28661
  }
28616
28662
  else {
28617
- throw new Error(`NodeInjector: NOT_FOUND [${stringifyForError(token)}]`);
28663
+ throwProviderNotFoundError(token, 'NodeInjector');
28618
28664
  }
28619
28665
  }
28620
28666
  const NOT_FOUND = {};
@@ -28698,7 +28744,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28698
28744
  if (isFactory(value)) {
28699
28745
  const factory = value;
28700
28746
  if (factory.resolving) {
28701
- throw new Error(`Circular dep for ${stringifyForError(tData[index])}`);
28747
+ throwCyclicDependencyError(stringifyForError(tData[index]));
28702
28748
  }
28703
28749
  const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);
28704
28750
  factory.resolving = true;
@@ -34101,7 +34147,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
34101
34147
  /**
34102
34148
  * @publicApi
34103
34149
  */
34104
- const VERSION$2 = new Version$1('10.2.0');
34150
+ const VERSION$2 = new Version$1('10.2.4');
34105
34151
 
34106
34152
  /**
34107
34153
  * @license
@@ -38989,7 +39035,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
38989
39035
  * Use of this source code is governed by an MIT-style license that can be
38990
39036
  * found in the LICENSE file at https://angular.io/license
38991
39037
  */
38992
- if (ngDevMode) {
39038
+ if (typeof ngDevMode !== 'undefined' && ngDevMode) {
38993
39039
  // This helper is to give a reasonable error message to people upgrading to v9 that have not yet
38994
39040
  // installed `@angular/localize` in their app.
38995
39041
  // tslint:disable-next-line: no-toplevel-property-access
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/language-service",
3
- "version": "10.2.0",
3
+ "version": "10.2.4",
4
4
  "description": "Angular - language services",
5
5
  "main": "./bundles/language-service.js",
6
6
  "typings": "./index.d.ts",