@angular/core 11.2.5 → 11.2.9

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 v11.2.5
2
+ * @license Angular v11.2.9
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1089,6 +1089,28 @@
1089
1089
  Object.freeze(EMPTY_ARRAY);
1090
1090
  }
1091
1091
 
1092
+ /**
1093
+ * @license
1094
+ * Copyright Google LLC All Rights Reserved.
1095
+ *
1096
+ * Use of this source code is governed by an MIT-style license that can be
1097
+ * found in the LICENSE file at https://angular.io/license
1098
+ */
1099
+ /**
1100
+ * This file contains reuseable "empty" symbols that can be used as default return values
1101
+ * in different parts of the rendering code. Because the same symbols are returned, this
1102
+ * allows for identity checks against these values to be consistently used by the framework
1103
+ * code.
1104
+ */
1105
+ var EMPTY_ARRAY$1 = [];
1106
+ // freezing the values prevents any code from accidentally inserting new values in
1107
+ if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
1108
+ // These property accesses can be ignored because ngDevMode will be set to false
1109
+ // when optimizing code and the whole if statement will be dropped.
1110
+ // tslint:disable-next-line:no-toplevel-property-access
1111
+ Object.freeze(EMPTY_ARRAY$1);
1112
+ }
1113
+
1092
1114
  /**
1093
1115
  * @license
1094
1116
  * Copyright Google LLC All Rights Reserved.
@@ -1161,7 +1183,7 @@
1161
1183
  onPush: componentDefinition.changeDetection === exports.ChangeDetectionStrategy.OnPush,
1162
1184
  directiveDefs: null,
1163
1185
  pipeDefs: null,
1164
- selectors: componentDefinition.selectors || EMPTY_ARRAY,
1186
+ selectors: componentDefinition.selectors || EMPTY_ARRAY$1,
1165
1187
  viewQuery: componentDefinition.viewQuery || null,
1166
1188
  features: componentDefinition.features || null,
1167
1189
  data: componentDefinition.data || {},
@@ -1169,7 +1191,7 @@
1169
1191
  // directly in the next line. Also `None` should be 0 not 2.
1170
1192
  encapsulation: componentDefinition.encapsulation || exports.ViewEncapsulation.Emulated,
1171
1193
  id: 'c',
1172
- styles: componentDefinition.styles || EMPTY_ARRAY,
1194
+ styles: componentDefinition.styles || EMPTY_ARRAY$1,
1173
1195
  _: null,
1174
1196
  setInput: null,
1175
1197
  schemas: componentDefinition.schemas || null,
@@ -1227,10 +1249,10 @@
1227
1249
  function ɵɵdefineNgModule(def) {
1228
1250
  var res = {
1229
1251
  type: def.type,
1230
- bootstrap: def.bootstrap || EMPTY_ARRAY,
1231
- declarations: def.declarations || EMPTY_ARRAY,
1232
- imports: def.imports || EMPTY_ARRAY,
1233
- exports: def.exports || EMPTY_ARRAY,
1252
+ bootstrap: def.bootstrap || EMPTY_ARRAY$1,
1253
+ declarations: def.declarations || EMPTY_ARRAY$1,
1254
+ imports: def.imports || EMPTY_ARRAY$1,
1255
+ exports: def.exports || EMPTY_ARRAY$1,
1234
1256
  transitiveCompileScopes: null,
1235
1257
  schemas: def.schemas || null,
1236
1258
  id: def.id || null,
@@ -1255,9 +1277,9 @@
1255
1277
  function ɵɵsetNgModuleScope(type, scope) {
1256
1278
  return noSideEffects(function () {
1257
1279
  var ngModuleDef = getNgModuleDef(type, true);
1258
- ngModuleDef.declarations = scope.declarations || EMPTY_ARRAY;
1259
- ngModuleDef.imports = scope.imports || EMPTY_ARRAY;
1260
- ngModuleDef.exports = scope.exports || EMPTY_ARRAY;
1280
+ ngModuleDef.declarations = scope.declarations || EMPTY_ARRAY$1;
1281
+ ngModuleDef.imports = scope.imports || EMPTY_ARRAY$1;
1282
+ ngModuleDef.exports = scope.exports || EMPTY_ARRAY$1;
1261
1283
  });
1262
1284
  }
1263
1285
  /**
@@ -1790,6 +1812,42 @@
1790
1812
  return instance[SIMPLE_CHANGES_STORE] = store;
1791
1813
  }
1792
1814
 
1815
+ /**
1816
+ * @license
1817
+ * Copyright Google LLC All Rights Reserved.
1818
+ *
1819
+ * Use of this source code is governed by an MIT-style license that can be
1820
+ * found in the LICENSE file at https://angular.io/license
1821
+ */
1822
+ var profilerCallback = null;
1823
+ /**
1824
+ * Sets the callback function which will be invoked before and after performing certain actions at
1825
+ * runtime (for example, before and after running change detection).
1826
+ *
1827
+ * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
1828
+ * The contract of the function might be changed in any release and/or the function can be removed
1829
+ * completely.
1830
+ *
1831
+ * @param profiler function provided by the caller or null value to disable profiling.
1832
+ */
1833
+ var setProfiler = function (profiler) {
1834
+ profilerCallback = profiler;
1835
+ };
1836
+ /**
1837
+ * Profiler function which wraps user code executed by the runtime.
1838
+ *
1839
+ * @param event ProfilerEvent corresponding to the execution context
1840
+ * @param instance component instance
1841
+ * @param hookOrListener lifecycle hook function or output listener. The value depends on the
1842
+ * execution context
1843
+ * @returns
1844
+ */
1845
+ var profiler = function (event, instance, hookOrListener) {
1846
+ if (profilerCallback != null /* both `null` and `undefined` */) {
1847
+ profilerCallback(event, instance, hookOrListener);
1848
+ }
1849
+ };
1850
+
1793
1851
  /**
1794
1852
  * @license
1795
1853
  * Copyright Google LLC All Rights Reserved.
@@ -2784,11 +2842,23 @@
2784
2842
  (currentView[PREORDER_HOOK_FLAGS] >> 16 /* NumberOfInitHooksCalledShift */) &&
2785
2843
  (currentView[FLAGS] & 3 /* InitPhaseStateMask */) === initPhase) {
2786
2844
  currentView[FLAGS] += 2048 /* IndexWithinInitPhaseIncrementer */;
2787
- hook.call(directive);
2845
+ profiler(4 /* LifecycleHookStart */, directive, hook);
2846
+ try {
2847
+ hook.call(directive);
2848
+ }
2849
+ finally {
2850
+ profiler(5 /* LifecycleHookEnd */, directive, hook);
2851
+ }
2788
2852
  }
2789
2853
  }
2790
2854
  else {
2791
- hook.call(directive);
2855
+ profiler(4 /* LifecycleHookStart */, directive, hook);
2856
+ try {
2857
+ hook.call(directive);
2858
+ }
2859
+ finally {
2860
+ profiler(5 /* LifecycleHookEnd */, directive, hook);
2861
+ }
2792
2862
  }
2793
2863
  }
2794
2864
 
@@ -6943,7 +7013,7 @@
6943
7013
  var tNode = lView[TVIEW].data[nodeIndex];
6944
7014
  var directiveStartIndex = tNode.directiveStart;
6945
7015
  if (directiveStartIndex == 0)
6946
- return EMPTY_ARRAY;
7016
+ return EMPTY_ARRAY$1;
6947
7017
  var directiveEndIndex = tNode.directiveEnd;
6948
7018
  if (!includeComponents && tNode.flags & 2 /* isComponentHost */)
6949
7019
  directiveStartIndex++;
@@ -10003,17 +10073,22 @@
10003
10073
  }
10004
10074
  function executeTemplate(tView, lView, templateFn, rf, context) {
10005
10075
  var prevSelectedIndex = getSelectedIndex();
10076
+ var isUpdatePhase = rf & 2 /* Update */;
10006
10077
  try {
10007
10078
  setSelectedIndex(-1);
10008
- if (rf & 2 /* Update */ && lView.length > HEADER_OFFSET) {
10079
+ if (isUpdatePhase && lView.length > HEADER_OFFSET) {
10009
10080
  // When we're updating, inherently select 0 so we don't
10010
10081
  // have to generate that instruction for most update blocks.
10011
10082
  selectIndexInternal(tView, lView, HEADER_OFFSET, isInCheckNoChangesMode());
10012
10083
  }
10084
+ var preHookType = isUpdatePhase ? 2 /* TemplateUpdateStart */ : 0 /* TemplateCreateStart */;
10085
+ profiler(preHookType, context);
10013
10086
  templateFn(rf, context);
10014
10087
  }
10015
10088
  finally {
10016
10089
  setSelectedIndex(prevSelectedIndex);
10090
+ var postHookType = isUpdatePhase ? 3 /* TemplateUpdateEnd */ : 1 /* TemplateCreateEnd */;
10091
+ profiler(postHookType, context);
10017
10092
  }
10018
10093
  }
10019
10094
  //////////////////////////
@@ -11554,7 +11629,7 @@
11554
11629
  * a circular dependency among the providers.
11555
11630
  */
11556
11631
  var CIRCULAR = {};
11557
- var EMPTY_ARRAY$1 = [];
11632
+ var EMPTY_ARRAY$2 = [];
11558
11633
  /**
11559
11634
  * A lazily initialized NullInjector.
11560
11635
  */
@@ -11803,7 +11878,7 @@
11803
11878
  if (importTypesWithProviders_1 !== undefined) {
11804
11879
  var _loop_1 = function (i) {
11805
11880
  var _a = importTypesWithProviders_1[i], ngModule_1 = _a.ngModule, providers = _a.providers;
11806
- deepForEach(providers, function (provider) { return _this.processProvider(provider, ngModule_1, providers || EMPTY_ARRAY$1); });
11881
+ deepForEach(providers, function (provider) { return _this.processProvider(provider, ngModule_1, providers || EMPTY_ARRAY$2); });
11807
11882
  };
11808
11883
  for (var i = 0; i < importTypesWithProviders_1.length; i++) {
11809
11884
  _loop_1(i);
@@ -12723,6 +12798,12 @@
12723
12798
  function publishDefaultGlobalUtils() {
12724
12799
  if (!_published) {
12725
12800
  _published = true;
12801
+ /**
12802
+ * Warning: this function is *INTERNAL* and should not be relied upon in application's code.
12803
+ * The contract of the function might be changed in any release and/or the function can be
12804
+ * removed completely.
12805
+ */
12806
+ publishGlobalUtil('ɵsetProfiler', setProfiler);
12726
12807
  publishGlobalUtil('getComponent', getComponent);
12727
12808
  publishGlobalUtil('getContext', getContext);
12728
12809
  publishGlobalUtil('getListeners', getListeners);
@@ -13057,7 +13138,7 @@
13057
13138
  if (value === EMPTY_OBJ) {
13058
13139
  return {};
13059
13140
  }
13060
- else if (value === EMPTY_ARRAY) {
13141
+ else if (value === EMPTY_ARRAY$1) {
13061
13142
  return [];
13062
13143
  }
13063
13144
  else {
@@ -14159,7 +14240,7 @@
14159
14240
 
14160
14241
  var ɵ0$9 = getClosureSafeProperty;
14161
14242
  var USE_VALUE$2 = getClosureSafeProperty({ provide: String, useValue: ɵ0$9 });
14162
- var EMPTY_ARRAY$2 = [];
14243
+ var EMPTY_ARRAY$3 = [];
14163
14244
  function convertInjectableProviderToFactory(type, provider) {
14164
14245
  if (!provider) {
14165
14246
  var reflectionCapabilities = new ReflectionCapabilities();
@@ -14177,7 +14258,7 @@
14177
14258
  }
14178
14259
  else if (provider.useFactory) {
14179
14260
  var factoryProvider_1 = provider;
14180
- return function () { return factoryProvider_1.useFactory.apply(factoryProvider_1, __spread(injectArgs(factoryProvider_1.deps || EMPTY_ARRAY$2))); };
14261
+ return function () { return factoryProvider_1.useFactory.apply(factoryProvider_1, __spread(injectArgs(factoryProvider_1.deps || EMPTY_ARRAY$3))); };
14181
14262
  }
14182
14263
  else if (provider.useClass) {
14183
14264
  var classProvider_1 = provider;
@@ -15616,6 +15697,7 @@
15616
15697
  var isTNodeDirectiveHost = isDirectiveHost(tNode);
15617
15698
  var firstCreatePass = tView.firstCreatePass;
15618
15699
  var tCleanup = firstCreatePass && getOrCreateTViewCleanup(tView);
15700
+ var context = lView[CONTEXT];
15619
15701
  // When the ɵɵlistener instruction was generated and is executed we know that there is either a
15620
15702
  // native listener or a directive output on this element. As such we we know that we will have to
15621
15703
  // register a listener and store its cleanup function on LView.
@@ -15668,7 +15750,7 @@
15668
15750
  // The first argument of `listen` function in Procedural Renderer is:
15669
15751
  // - either a target name (as a string) in case of global target (window, document, body)
15670
15752
  // - or element reference (in all other cases)
15671
- listenerFn = wrapListener(tNode, lView, listenerFn, false /** preventDefault */);
15753
+ listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
15672
15754
  var cleanupFn = renderer.listen(resolved.name || target, eventName, listenerFn);
15673
15755
  ngDevMode && ngDevMode.rendererAddEventListener++;
15674
15756
  lCleanup.push(listenerFn, cleanupFn);
@@ -15676,7 +15758,7 @@
15676
15758
  }
15677
15759
  }
15678
15760
  else {
15679
- listenerFn = wrapListener(tNode, lView, listenerFn, true /** preventDefault */);
15761
+ listenerFn = wrapListener(tNode, lView, context, listenerFn, true /** preventDefault */);
15680
15762
  target.addEventListener(eventName, listenerFn, useCapture);
15681
15763
  ngDevMode && ngDevMode.rendererAddEventListener++;
15682
15764
  lCleanup.push(listenerFn);
@@ -15686,7 +15768,7 @@
15686
15768
  else {
15687
15769
  // Even if there is no native listener to add, we still need to wrap the listener so that OnPush
15688
15770
  // ancestors are marked dirty when an event occurs.
15689
- listenerFn = wrapListener(tNode, lView, listenerFn, false /** preventDefault */);
15771
+ listenerFn = wrapListener(tNode, lView, context, listenerFn, false /** preventDefault */);
15690
15772
  }
15691
15773
  // subscribe to directive outputs
15692
15774
  var outputs = tNode.outputs;
@@ -15711,8 +15793,9 @@
15711
15793
  }
15712
15794
  }
15713
15795
  }
15714
- function executeListenerWithErrorHandling(lView, listenerFn, e) {
15796
+ function executeListenerWithErrorHandling(lView, context, listenerFn, e) {
15715
15797
  try {
15798
+ profiler(6 /* OutputStart */, context, listenerFn);
15716
15799
  // Only explicitly returning false from a listener should preventDefault
15717
15800
  return listenerFn(e) !== false;
15718
15801
  }
@@ -15720,6 +15803,9 @@
15720
15803
  handleError(lView, error);
15721
15804
  return false;
15722
15805
  }
15806
+ finally {
15807
+ profiler(7 /* OutputEnd */, context, listenerFn);
15808
+ }
15723
15809
  }
15724
15810
  /**
15725
15811
  * Wraps an event listener with a function that marks ancestors dirty and prevents default behavior,
@@ -15731,7 +15817,7 @@
15731
15817
  * @param wrapWithPreventDefault Whether or not to prevent default behavior
15732
15818
  * (the procedural renderer does this already, so in those cases, we should skip)
15733
15819
  */
15734
- function wrapListener(tNode, lView, listenerFn, wrapWithPreventDefault) {
15820
+ function wrapListener(tNode, lView, context, listenerFn, wrapWithPreventDefault) {
15735
15821
  // Note: we are performing most of the work in the listener function itself
15736
15822
  // to optimize listener registration.
15737
15823
  return function wrapListenerIn_markDirtyAndPreventDefault(e) {
@@ -15749,13 +15835,13 @@
15749
15835
  if ((lView[FLAGS] & 32 /* ManualOnPush */) === 0) {
15750
15836
  markViewDirty(startView);
15751
15837
  }
15752
- var result = executeListenerWithErrorHandling(lView, listenerFn, e);
15838
+ var result = executeListenerWithErrorHandling(lView, context, listenerFn, e);
15753
15839
  // A just-invoked listener function might have coalesced listeners so we need to check for
15754
15840
  // their presence and invoke as needed.
15755
15841
  var nextListenerFn = wrapListenerIn_markDirtyAndPreventDefault.__ngNextListenerFn__;
15756
15842
  while (nextListenerFn) {
15757
15843
  // We should prevent default if any of the listeners explicitly return false
15758
- result = executeListenerWithErrorHandling(lView, nextListenerFn, e) && result;
15844
+ result = executeListenerWithErrorHandling(lView, context, nextListenerFn, e) && result;
15759
15845
  nextListenerFn = nextListenerFn.__ngNextListenerFn__;
15760
15846
  }
15761
15847
  if (wrapWithPreventDefault && result === false) {
@@ -16375,31 +16461,6 @@
16375
16461
  return ɵɵpropertyInterpolateV;
16376
16462
  }
16377
16463
 
16378
- /**
16379
- * @license
16380
- * Copyright Google LLC All Rights Reserved.
16381
- *
16382
- * Use of this source code is governed by an MIT-style license that can be
16383
- * found in the LICENSE file at https://angular.io/license
16384
- */
16385
- /**
16386
- * This file contains reuseable "empty" symbols that can be used as default return values
16387
- * in different parts of the rendering code. Because the same symbols are returned, this
16388
- * allows for identity checks against these values to be consistently used by the framework
16389
- * code.
16390
- */
16391
- var EMPTY_OBJ$1 = {};
16392
- var EMPTY_ARRAY$3 = [];
16393
- // freezing the values prevents any code from accidentally inserting new values in
16394
- if ((typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode()) {
16395
- // These property accesses can be ignored because ngDevMode will be set to false
16396
- // when optimizing code and the whole if statement will be dropped.
16397
- // tslint:disable-next-line:no-toplevel-property-access
16398
- Object.freeze(EMPTY_OBJ$1);
16399
- // tslint:disable-next-line:no-toplevel-property-access
16400
- Object.freeze(EMPTY_ARRAY$3);
16401
- }
16402
-
16403
16464
  /**
16404
16465
  * @license
16405
16466
  * Copyright Google LLC All Rights Reserved.
@@ -17582,7 +17643,7 @@
17582
17643
  */
17583
17644
  function toStylingKeyValueArray(keyValueArraySet, stringParser, value) {
17584
17645
  if (value == null /*|| value === undefined */ || value === '')
17585
- return EMPTY_ARRAY$3;
17646
+ return EMPTY_ARRAY;
17586
17647
  var styleKeyValueArray = [];
17587
17648
  var unwrappedValue = unwrapSafeValue(value);
17588
17649
  if (Array.isArray(unwrappedValue)) {
@@ -17639,7 +17700,7 @@
17639
17700
  function updateStylingMap(tView, tNode, lView, renderer, oldKeyValueArray, newKeyValueArray, isClassBased, bindingIndex) {
17640
17701
  if (oldKeyValueArray === NO_CHANGE) {
17641
17702
  // On first execution the oldKeyValueArray is NO_CHANGE => treat it as empty KeyValueArray.
17642
- oldKeyValueArray = EMPTY_ARRAY$3;
17703
+ oldKeyValueArray = EMPTY_ARRAY;
17643
17704
  }
17644
17705
  var oldIndex = 0;
17645
17706
  var newIndex = 0;
@@ -17777,7 +17838,7 @@
17777
17838
  // we have `undefined` (or empty array in case of styling-map instruction) instead. This
17778
17839
  // allows the resolution to apply the value (which may later be overwritten when the
17779
17840
  // binding actually executes.)
17780
- valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY$3 : undefined;
17841
+ valueAtLViewIndex = isStylingMap ? EMPTY_ARRAY : undefined;
17781
17842
  }
17782
17843
  var currentValue = isStylingMap ? keyValueArrayGet(valueAtLViewIndex, prop) :
17783
17844
  key === prop ? valueAtLViewIndex : undefined;
@@ -20213,7 +20274,7 @@
20213
20274
  _removes = tIcu.remove[currentCase];
20214
20275
  }
20215
20276
  else {
20216
- _removes = EMPTY_ARRAY;
20277
+ _removes = EMPTY_ARRAY$1;
20217
20278
  }
20218
20279
  }
20219
20280
  function icuContainerIteratorNext() {
@@ -21922,7 +21983,7 @@
21922
21983
  /**
21923
21984
  * @publicApi
21924
21985
  */
21925
- var VERSION = new Version('11.2.5');
21986
+ var VERSION = new Version('11.2.9');
21926
21987
 
21927
21988
  /**
21928
21989
  * @license
@@ -28023,7 +28084,7 @@
28023
28084
  }
28024
28085
  }
28025
28086
  var templateUrl = metadata.templateUrl || "ng:///" + type.name + "/template.html";
28026
- var meta = Object.assign(Object.assign({}, directiveMetadata(type, metadata)), { typeSourceSpan: compiler.createParseSourceSpan('Component', type.name, templateUrl), template: metadata.template || '', preserveWhitespaces: preserveWhitespaces, styles: metadata.styles || EMPTY_ARRAY, animations: metadata.animations, directives: [], changeDetection: metadata.changeDetection, pipes: new Map(), encapsulation: encapsulation, interpolation: metadata.interpolation, viewProviders: metadata.viewProviders || null });
28087
+ var meta = Object.assign(Object.assign({}, directiveMetadata(type, metadata)), { typeSourceSpan: compiler.createParseSourceSpan('Component', type.name, templateUrl), template: metadata.template || '', preserveWhitespaces: preserveWhitespaces, styles: metadata.styles || EMPTY_ARRAY$1, animations: metadata.animations, directives: [], changeDetection: metadata.changeDetection, pipes: new Map(), encapsulation: encapsulation, interpolation: metadata.interpolation, viewProviders: metadata.viewProviders || null });
28027
28088
  compilationDepth++;
28028
28089
  try {
28029
28090
  if (meta.usesInheritance) {
@@ -28132,8 +28193,8 @@
28132
28193
  deps: reflectDependencies(type),
28133
28194
  host: metadata.host || EMPTY_OBJ,
28134
28195
  propMetadata: propMetadata,
28135
- inputs: metadata.inputs || EMPTY_ARRAY,
28136
- outputs: metadata.outputs || EMPTY_ARRAY,
28196
+ inputs: metadata.inputs || EMPTY_ARRAY$1,
28197
+ outputs: metadata.outputs || EMPTY_ARRAY$1,
28137
28198
  queries: extractQueriesMetadata(type, propMetadata, isContentQuery),
28138
28199
  lifecycle: { usesOnChanges: reflect.hasLifecycleHook(type, 'ngOnChanges') },
28139
28200
  typeSourceSpan: null,