@angular/language-service 10.0.4 → 10.0.5

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v10.0.4
2
+ * @license Angular v10.0.5
3
3
  * Copyright Google LLC All Rights Reserved.
4
4
  * License: MIT
5
5
  */
@@ -2778,8 +2778,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
2778
2778
  Identifiers$1.elementEnd = { name: 'ɵɵelementEnd', moduleName: CORE$1 };
2779
2779
  Identifiers$1.select = { name: 'ɵɵselect', moduleName: CORE$1 };
2780
2780
  Identifiers$1.advance = { name: 'ɵɵadvance', moduleName: CORE$1 };
2781
- Identifiers$1.updateSyntheticHostBinding = { name: 'ɵɵupdateSyntheticHostBinding', moduleName: CORE$1 };
2782
- Identifiers$1.componentHostSyntheticListener = { name: 'ɵɵcomponentHostSyntheticListener', moduleName: CORE$1 };
2781
+ Identifiers$1.syntheticHostProperty = { name: 'ɵɵsyntheticHostProperty', moduleName: CORE$1 };
2782
+ Identifiers$1.syntheticHostListener = { name: 'ɵɵsyntheticHostListener', moduleName: CORE$1 };
2783
2783
  Identifiers$1.attribute = { name: 'ɵɵattribute', moduleName: CORE$1 };
2784
2784
  Identifiers$1.attributeInterpolate1 = { name: 'ɵɵattributeInterpolate1', moduleName: CORE$1 };
2785
2785
  Identifiers$1.attributeInterpolate2 = { name: 'ɵɵattributeInterpolate2', moduleName: CORE$1 };
@@ -3348,6 +3348,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
3348
3348
  this.attributes = attributes;
3349
3349
  this.sourceSpan = sourceSpan;
3350
3350
  this.i18n = i18n;
3351
+ this.name = 'ng-content';
3351
3352
  }
3352
3353
  visit(visitor) {
3353
3354
  return visitor.visitContent(this);
@@ -9141,8 +9142,9 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9141
9142
  const el = new Element$1(fullName, attrs, [], span, span, undefined);
9142
9143
  this._pushElement(el);
9143
9144
  if (selfClosing) {
9144
- this._popElement(fullName);
9145
- el.endSourceSpan = span;
9145
+ // Elements that are self-closed have their `endSourceSpan` set to the full span, as the
9146
+ // element start tag also represents the end tag.
9147
+ this._popElement(fullName, span);
9146
9148
  }
9147
9149
  }
9148
9150
  _pushElement(el) {
@@ -9155,21 +9157,22 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9155
9157
  }
9156
9158
  _consumeEndTag(endTagToken) {
9157
9159
  const fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
9158
- if (this._getParentElement()) {
9159
- this._getParentElement().endSourceSpan = endTagToken.sourceSpan;
9160
- }
9161
9160
  if (this.getTagDefinition(fullName).isVoid) {
9162
9161
  this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, `Void elements do not have end tags "${endTagToken.parts[1]}"`));
9163
9162
  }
9164
- else if (!this._popElement(fullName)) {
9163
+ else if (!this._popElement(fullName, endTagToken.sourceSpan)) {
9165
9164
  const errMsg = `Unexpected closing tag "${fullName}". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags`;
9166
9165
  this.errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
9167
9166
  }
9168
9167
  }
9169
- _popElement(fullName) {
9168
+ _popElement(fullName, endSourceSpan) {
9170
9169
  for (let stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
9171
9170
  const el = this._elementStack[stackIndex];
9172
9171
  if (el.name == fullName) {
9172
+ // Record the parse span with the element that is being closed. Any elements that are
9173
+ // removed from the element stack at this point are closed implicitly, so they won't get
9174
+ // an end source span (as there is no explicit closing element).
9175
+ el.endSourceSpan = endSourceSpan;
9173
9176
  this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
9174
9177
  return true;
9175
9178
  }
@@ -9202,21 +9205,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9202
9205
  _getParentElement() {
9203
9206
  return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
9204
9207
  }
9205
- /**
9206
- * Returns the parent in the DOM and the container.
9207
- *
9208
- * `<ng-container>` elements are skipped as they are not rendered as DOM element.
9209
- */
9210
- _getParentElementSkippingContainers() {
9211
- let container = null;
9212
- for (let i = this._elementStack.length - 1; i >= 0; i--) {
9213
- if (!isNgContainer(this._elementStack[i].name)) {
9214
- return { parent: this._elementStack[i], container };
9215
- }
9216
- container = this._elementStack[i];
9217
- }
9218
- return { parent: null, container };
9219
- }
9220
9208
  _addToParent(node) {
9221
9209
  const parent = this._getParentElement();
9222
9210
  if (parent != null) {
@@ -9226,31 +9214,6 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
9226
9214
  this.rootNodes.push(node);
9227
9215
  }
9228
9216
  }
9229
- /**
9230
- * Insert a node between the parent and the container.
9231
- * When no container is given, the node is appended as a child of the parent.
9232
- * Also updates the element stack accordingly.
9233
- *
9234
- * @internal
9235
- */
9236
- _insertBeforeContainer(parent, container, node) {
9237
- if (!container) {
9238
- this._addToParent(node);
9239
- this._elementStack.push(node);
9240
- }
9241
- else {
9242
- if (parent) {
9243
- // replace the container with the new node in the children
9244
- const index = parent.children.indexOf(container);
9245
- parent.children[index] = node;
9246
- }
9247
- else {
9248
- this.rootNodes.push(node);
9249
- }
9250
- node.children.push(container);
9251
- this._elementStack.splice(this._elementStack.indexOf(container), 0, node);
9252
- }
9253
- }
9254
9217
  _getElementFullName(prefix, localName, parentElement) {
9255
9218
  if (prefix === '') {
9256
9219
  prefix = this.getTagDefinition(localName).implicitNamespacePrefix || '';
@@ -17140,7 +17103,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17140
17103
  else if (instruction === Identifiers$1.attribute) {
17141
17104
  attributeBindings.push(instructionParams);
17142
17105
  }
17143
- else if (instruction === Identifiers$1.updateSyntheticHostBinding) {
17106
+ else if (instruction === Identifiers$1.syntheticHostProperty) {
17144
17107
  syntheticHostBindings.push(instructionParams);
17145
17108
  }
17146
17109
  else {
@@ -17154,7 +17117,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17154
17117
  updateStatements.push(chainedInstruction(Identifiers$1.attribute, attributeBindings).toStmt());
17155
17118
  }
17156
17119
  if (syntheticHostBindings.length > 0) {
17157
- updateStatements.push(chainedInstruction(Identifiers$1.updateSyntheticHostBinding, syntheticHostBindings).toStmt());
17120
+ updateStatements.push(chainedInstruction(Identifiers$1.syntheticHostProperty, syntheticHostBindings).toStmt());
17158
17121
  }
17159
17122
  // since we're dealing with directives/components and both have hostBinding
17160
17123
  // functions, we need to generate a special hostAttrs instruction that deals
@@ -17220,7 +17183,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17220
17183
  // host bindings that have a synthetic property (e.g. @foo) should always be rendered
17221
17184
  // in the context of the component and not the parent. Therefore there is a special
17222
17185
  // compatibility instruction available for this purpose.
17223
- instruction = Identifiers$1.updateSyntheticHostBinding;
17186
+ instruction = Identifiers$1.syntheticHostProperty;
17224
17187
  }
17225
17188
  else {
17226
17189
  instruction = Identifiers$1.hostProperty;
@@ -17247,7 +17210,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17247
17210
  }
17248
17211
  });
17249
17212
  if (syntheticListeners.length > 0) {
17250
- instructions.push(chainedInstruction(Identifiers$1.componentHostSyntheticListener, syntheticListeners).toStmt());
17213
+ instructions.push(chainedInstruction(Identifiers$1.syntheticHostListener, syntheticListeners).toStmt());
17251
17214
  }
17252
17215
  if (listeners.length > 0) {
17253
17216
  instructions.push(chainedInstruction(Identifiers$1.listener, listeners).toStmt());
@@ -17623,7 +17586,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
17623
17586
  * Use of this source code is governed by an MIT-style license that can be
17624
17587
  * found in the LICENSE file at https://angular.io/license
17625
17588
  */
17626
- const VERSION$1 = new Version('10.0.4');
17589
+ const VERSION$1 = new Version('10.0.5');
17627
17590
 
17628
17591
  /**
17629
17592
  * @license
@@ -26843,6 +26806,96 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
26843
26806
  }
26844
26807
  }
26845
26808
 
26809
+ /**
26810
+ * @license
26811
+ * Copyright Google LLC All Rights Reserved.
26812
+ *
26813
+ * Use of this source code is governed by an MIT-style license that can be
26814
+ * found in the LICENSE file at https://angular.io/license
26815
+ */
26816
+ /**
26817
+ * Represents a basic change from a previous to a new value for a single
26818
+ * property on a directive instance. Passed as a value in a
26819
+ * {@link SimpleChanges} object to the `ngOnChanges` hook.
26820
+ *
26821
+ * @see `OnChanges`
26822
+ *
26823
+ * @publicApi
26824
+ */
26825
+ class SimpleChange {
26826
+ constructor(previousValue, currentValue, firstChange) {
26827
+ this.previousValue = previousValue;
26828
+ this.currentValue = currentValue;
26829
+ this.firstChange = firstChange;
26830
+ }
26831
+ /**
26832
+ * Check whether the new value is the first value assigned.
26833
+ */
26834
+ isFirstChange() {
26835
+ return this.firstChange;
26836
+ }
26837
+ }
26838
+
26839
+ /**
26840
+ * @license
26841
+ * Copyright Google LLC All Rights Reserved.
26842
+ *
26843
+ * Use of this source code is governed by an MIT-style license that can be
26844
+ * found in the LICENSE file at https://angular.io/license
26845
+ */
26846
+ function NgOnChangesFeatureImpl(definition) {
26847
+ if (definition.type.prototype.ngOnChanges) {
26848
+ definition.setInput = ngOnChangesSetInput;
26849
+ }
26850
+ return rememberChangeHistoryAndInvokeOnChangesHook;
26851
+ }
26852
+ /**
26853
+ * This is a synthetic lifecycle hook which gets inserted into `TView.preOrderHooks` to simulate
26854
+ * `ngOnChanges`.
26855
+ *
26856
+ * The hook reads the `NgSimpleChangesStore` data from the component instance and if changes are
26857
+ * found it invokes `ngOnChanges` on the component instance.
26858
+ *
26859
+ * @param this Component instance. Because this function gets inserted into `TView.preOrderHooks`,
26860
+ * it is guaranteed to be called with component instance.
26861
+ */
26862
+ function rememberChangeHistoryAndInvokeOnChangesHook() {
26863
+ const simpleChangesStore = getSimpleChangesStore(this);
26864
+ const current = simpleChangesStore === null || simpleChangesStore === void 0 ? void 0 : simpleChangesStore.current;
26865
+ if (current) {
26866
+ const previous = simpleChangesStore.previous;
26867
+ if (previous === EMPTY_OBJ) {
26868
+ simpleChangesStore.previous = current;
26869
+ }
26870
+ else {
26871
+ // New changes are copied to the previous store, so that we don't lose history for inputs
26872
+ // which were not changed this time
26873
+ for (let key in current) {
26874
+ previous[key] = current[key];
26875
+ }
26876
+ }
26877
+ simpleChangesStore.current = null;
26878
+ this.ngOnChanges(current);
26879
+ }
26880
+ }
26881
+ function ngOnChangesSetInput(instance, value, publicName, privateName) {
26882
+ const simpleChangesStore = getSimpleChangesStore(instance) ||
26883
+ setSimpleChangesStore(instance, { previous: EMPTY_OBJ, current: null });
26884
+ const current = simpleChangesStore.current || (simpleChangesStore.current = {});
26885
+ const previous = simpleChangesStore.previous;
26886
+ const declaredName = this.declaredInputs[publicName];
26887
+ const previousChange = previous[declaredName];
26888
+ current[declaredName] = new SimpleChange(previousChange && previousChange.currentValue, value, previous === EMPTY_OBJ);
26889
+ instance[privateName] = value;
26890
+ }
26891
+ const SIMPLE_CHANGES_STORE = '__ngSimpleChanges__';
26892
+ function getSimpleChangesStore(instance) {
26893
+ return instance[SIMPLE_CHANGES_STORE] || null;
26894
+ }
26895
+ function setSimpleChangesStore(instance, store) {
26896
+ return instance[SIMPLE_CHANGES_STORE] = store;
26897
+ }
26898
+
26846
26899
  /**
26847
26900
  * @license
26848
26901
  * Copyright Google LLC All Rights Reserved.
@@ -27256,17 +27309,19 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27256
27309
  */
27257
27310
  function registerPreOrderHooks(directiveIndex, directiveDef, tView) {
27258
27311
  ngDevMode && assertFirstCreatePass(tView);
27259
- const { onChanges, onInit, doCheck } = directiveDef;
27260
- if (onChanges) {
27261
- (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, onChanges);
27262
- (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(directiveIndex, onChanges);
27312
+ const { ngOnChanges, ngOnInit, ngDoCheck } = directiveDef.type.prototype;
27313
+ if (ngOnChanges) {
27314
+ const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);
27315
+ (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, wrappedOnChanges);
27316
+ (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = []))
27317
+ .push(directiveIndex, wrappedOnChanges);
27263
27318
  }
27264
- if (onInit) {
27265
- (tView.preOrderHooks || (tView.preOrderHooks = [])).push(-directiveIndex, onInit);
27319
+ if (ngOnInit) {
27320
+ (tView.preOrderHooks || (tView.preOrderHooks = [])).push(0 - directiveIndex, ngOnInit);
27266
27321
  }
27267
- if (doCheck) {
27268
- (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, doCheck);
27269
- (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(directiveIndex, doCheck);
27322
+ if (ngDoCheck) {
27323
+ (tView.preOrderHooks || (tView.preOrderHooks = [])).push(directiveIndex, ngDoCheck);
27324
+ (tView.preOrderCheckHooks || (tView.preOrderCheckHooks = [])).push(directiveIndex, ngDoCheck);
27270
27325
  }
27271
27326
  }
27272
27327
  /**
@@ -27294,23 +27349,24 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
27294
27349
  // hooks for projected components and directives must be called *before* their hosts.
27295
27350
  for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {
27296
27351
  const directiveDef = tView.data[i];
27297
- if (directiveDef.afterContentInit) {
27298
- (tView.contentHooks || (tView.contentHooks = [])).push(-i, directiveDef.afterContentInit);
27352
+ const lifecycleHooks = directiveDef.type.prototype;
27353
+ const { ngAfterContentInit, ngAfterContentChecked, ngAfterViewInit, ngAfterViewChecked, ngOnDestroy } = lifecycleHooks;
27354
+ if (ngAfterContentInit) {
27355
+ (tView.contentHooks || (tView.contentHooks = [])).push(-i, ngAfterContentInit);
27299
27356
  }
27300
- if (directiveDef.afterContentChecked) {
27301
- (tView.contentHooks || (tView.contentHooks = [])).push(i, directiveDef.afterContentChecked);
27302
- (tView.contentCheckHooks || (tView.contentCheckHooks = []))
27303
- .push(i, directiveDef.afterContentChecked);
27357
+ if (ngAfterContentChecked) {
27358
+ (tView.contentHooks || (tView.contentHooks = [])).push(i, ngAfterContentChecked);
27359
+ (tView.contentCheckHooks || (tView.contentCheckHooks = [])).push(i, ngAfterContentChecked);
27304
27360
  }
27305
- if (directiveDef.afterViewInit) {
27306
- (tView.viewHooks || (tView.viewHooks = [])).push(-i, directiveDef.afterViewInit);
27361
+ if (ngAfterViewInit) {
27362
+ (tView.viewHooks || (tView.viewHooks = [])).push(-i, ngAfterViewInit);
27307
27363
  }
27308
- if (directiveDef.afterViewChecked) {
27309
- (tView.viewHooks || (tView.viewHooks = [])).push(i, directiveDef.afterViewChecked);
27310
- (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, directiveDef.afterViewChecked);
27364
+ if (ngAfterViewChecked) {
27365
+ (tView.viewHooks || (tView.viewHooks = [])).push(i, ngAfterViewChecked);
27366
+ (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, ngAfterViewChecked);
27311
27367
  }
27312
- if (directiveDef.onDestroy != null) {
27313
- (tView.destroyHooks || (tView.destroyHooks = [])).push(i, directiveDef.onDestroy);
27368
+ if (ngOnDestroy != null) {
27369
+ (tView.destroyHooks || (tView.destroyHooks = [])).push(i, ngOnDestroy);
27314
27370
  }
27315
27371
  }
27316
27372
  }
@@ -28134,10 +28190,10 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
28134
28190
  function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {
28135
28191
  const nodeProviderIndexes = tNode.providerIndexes;
28136
28192
  const tInjectables = tView.data;
28137
- const injectablesStart = nodeProviderIndexes & 65535 /* ProvidersStartIndexMask */;
28193
+ const injectablesStart = nodeProviderIndexes & 1048575 /* ProvidersStartIndexMask */;
28138
28194
  const directivesStart = tNode.directiveStart;
28139
28195
  const directiveEnd = tNode.directiveEnd;
28140
- const cptViewProvidersCount = nodeProviderIndexes >> 16 /* CptViewProvidersCountShift */;
28196
+ const cptViewProvidersCount = nodeProviderIndexes >> 20 /* CptViewProvidersCountShift */;
28141
28197
  const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;
28142
28198
  // When the host special case applies, only the viewProviders and the component are visible
28143
28199
  const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;
@@ -29364,6 +29420,8 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
29364
29420
  else {
29365
29421
  // If it's not a number, it's a host binding function that needs to be executed.
29366
29422
  if (instruction !== null) {
29423
+ ngDevMode &&
29424
+ assertLessThan(currentDirectiveIndex, 1048576 /* CptViewProvidersCountShifter */, 'Reached the max number of host bindings');
29367
29425
  setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex);
29368
29426
  const hostCtx = lView[currentDirectiveIndex];
29369
29427
  instruction(2 /* Update */, hostCtx);
@@ -30041,7 +30099,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
30041
30099
  // requires non standard math arithmetic and it can prevent VM optimizations.
30042
30100
  // `0-0` will always produce `0` and will not cause a potential deoptimization in VM.
30043
30101
  const elementIndex = HEADER_OFFSET - tNode.index;
30044
- const providerStartIndex = tNode.providerIndexes & 65535 /* ProvidersStartIndexMask */;
30102
+ const providerStartIndex = tNode.providerIndexes & 1048575 /* ProvidersStartIndexMask */;
30045
30103
  const providerCount = tView.data.length - providerStartIndex;
30046
30104
  (tView.expandoInstructions || (tView.expandoInstructions = []))
30047
30105
  .push(elementIndex, providerCount, directiveCount);
@@ -33401,7 +33459,7 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
33401
33459
  /**
33402
33460
  * @publicApi
33403
33461
  */
33404
- const VERSION$2 = new Version$1('10.0.4');
33462
+ const VERSION$2 = new Version$1('10.0.5');
33405
33463
 
33406
33464
  /**
33407
33465
  * @license
@@ -40852,4 +40910,4 @@ define(['exports', 'typescript/lib/tsserverlibrary', 'typescript', 'path'], func
40852
40910
  Object.defineProperty(exports, '__esModule', { value: true });
40853
40911
 
40854
40912
  });
40855
- //# sourceMappingURL=language-service.umd.js.map
40913
+ //# sourceMappingURL=language-service.js.map
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@angular/language-service",
3
- "version": "10.0.4",
3
+ "version": "10.0.5",
4
4
  "description": "Angular - language services",
5
- "main": "./bundles/language-service.umd.js",
5
+ "main": "./bundles/language-service.js",
6
6
  "typings": "./index.d.ts",
7
7
  "author": "angular",
8
8
  "license": "MIT",