@angular/core 12.2.0-next.2 → 12.2.1

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 v12.2.0-next.2
2
+ * @license Angular v12.2.1
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v12.2.0-next.2
2
+ * @license Angular v12.2.1
3
3
  * (c) 2010-2021 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4340,15 +4340,38 @@
4340
4340
  * Use of this source code is governed by an MIT-style license that can be
4341
4341
  * found in the LICENSE file at https://angular.io/license
4342
4342
  */
4343
- function getCompilerFacade() {
4343
+ function getCompilerFacade(request) {
4344
4344
  var globalNg = _global['ng'];
4345
- if (!globalNg || !globalNg.ɵcompilerFacade) {
4346
- throw new Error("Angular JIT compilation failed: '@angular/compiler' not loaded!\n" +
4347
- " - JIT compilation is discouraged for production use-cases! Consider AOT mode instead.\n" +
4348
- " - Did you bootstrap using '@angular/platform-browser-dynamic' or '@angular/platform-server'?\n" +
4349
- " - Alternatively provide the compiler with 'import \"@angular/compiler\";' before bootstrapping.");
4345
+ if (globalNg && globalNg.ɵcompilerFacade) {
4346
+ return globalNg.ɵcompilerFacade;
4347
+ }
4348
+ if (typeof ngDevMode === 'undefined' || ngDevMode) {
4349
+ // Log the type as an error so that a developer can easily navigate to the type from the
4350
+ // console.
4351
+ console.error("JIT compilation failed for " + request.kind, request.type);
4352
+ var message = "The " + request.kind + " '" + request
4353
+ .type.name + "' needs to be compiled using the JIT compiler, but '@angular/compiler' is not available.\n\n";
4354
+ if (request.usage === 1 /* PartialDeclaration */) {
4355
+ message += "The " + request.kind + " is part of a library that has been partially compiled.\n";
4356
+ message +=
4357
+ "However, the Angular Linker has not processed the library such that JIT compilation is used as fallback.\n";
4358
+ message += '\n';
4359
+ message +=
4360
+ "Ideally, the library is processed using the Angular Linker to become fully AOT compiled.\n";
4361
+ }
4362
+ else {
4363
+ message +=
4364
+ "JIT compilation is discouraged for production use-cases! Consider using AOT mode instead.\n";
4365
+ }
4366
+ message +=
4367
+ "Alternatively, the JIT compiler should be loaded by bootstrapping using '@angular/platform-browser-dynamic' or '@angular/platform-server',\n";
4368
+ message +=
4369
+ "or manually provide the compiler with 'import \"@angular/compiler\";' before bootstrapping.";
4370
+ throw new Error(message);
4371
+ }
4372
+ else {
4373
+ throw new Error('JIT compiler unavailable');
4350
4374
  }
4351
- return globalNg.ɵcompilerFacade;
4352
4375
  }
4353
4376
 
4354
4377
  /**
@@ -6791,7 +6814,7 @@
6791
6814
  return error[ERROR_ORIGINAL_ERROR];
6792
6815
  }
6793
6816
  function getErrorLogger(error) {
6794
- return error[ERROR_LOGGER] || defaultErrorLogger;
6817
+ return error && error[ERROR_LOGGER] || defaultErrorLogger;
6795
6818
  }
6796
6819
  function defaultErrorLogger(console) {
6797
6820
  var values = [];
@@ -6860,11 +6883,11 @@
6860
6883
  };
6861
6884
  /** @internal */
6862
6885
  ErrorHandler.prototype._findOriginalError = function (error) {
6863
- var e = getOriginalError(error);
6886
+ var e = error && getOriginalError(error);
6864
6887
  while (e && getOriginalError(e)) {
6865
6888
  e = getOriginalError(e);
6866
6889
  }
6867
- return e;
6890
+ return e || null;
6868
6891
  };
6869
6892
  return ErrorHandler;
6870
6893
  }());
@@ -9911,6 +9934,7 @@
9911
9934
  // an error, mark the view as corrupted so we can try to recover.
9912
9935
  if (tView.firstCreatePass) {
9913
9936
  tView.incompleteFirstPass = true;
9937
+ tView.firstCreatePass = false;
9914
9938
  }
9915
9939
  throw error;
9916
9940
  }
@@ -11725,6 +11749,7 @@
11725
11749
  this.assertNotDestroyed();
11726
11750
  // Set the injection context.
11727
11751
  var previousInjector = setCurrentInjector(this);
11752
+ var previousInjectImplementation = setInjectImplementation(undefined);
11728
11753
  try {
11729
11754
  // Check for the SkipSelf flag.
11730
11755
  if (!(flags & exports.InjectFlags.SkipSelf)) {
@@ -11777,7 +11802,8 @@
11777
11802
  }
11778
11803
  }
11779
11804
  finally {
11780
- // Lastly, clean up the state by restoring the previous injector.
11805
+ // Lastly, restore the previous injection context.
11806
+ setInjectImplementation(previousInjectImplementation);
11781
11807
  setCurrentInjector(previousInjector);
11782
11808
  }
11783
11809
  };
@@ -14202,7 +14228,8 @@
14202
14228
  Object.defineProperty(type, NG_PROV_DEF, {
14203
14229
  get: function () {
14204
14230
  if (ngInjectableDef === null) {
14205
- ngInjectableDef = getCompilerFacade().compileInjectable(angularCoreDiEnv, "ng:///" + type.name + "/\u0275prov.js", getInjectableMetadata(type, meta));
14231
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'injectable', type: type });
14232
+ ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, "ng:///" + type.name + "/\u0275prov.js", getInjectableMetadata(type, meta));
14206
14233
  }
14207
14234
  return ngInjectableDef;
14208
14235
  },
@@ -14213,7 +14240,7 @@
14213
14240
  Object.defineProperty(type, NG_FACTORY_DEF, {
14214
14241
  get: function () {
14215
14242
  if (ngFactoryDef === null) {
14216
- var compiler = getCompilerFacade();
14243
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'injectable', type: type });
14217
14244
  ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, "ng:///" + type.name + "/\u0275fac.js", {
14218
14245
  name: type.name,
14219
14246
  type: type,
@@ -19332,8 +19359,7 @@
19332
19359
  * Use of this source code is governed by an MIT-style license that can be
19333
19360
  * found in the LICENSE file at https://angular.io/license
19334
19361
  */
19335
- // THIS CODE IS GENERATED - DO NOT MODIFY
19336
- // See angular/tools/gulp-tasks/cldr/extract.js
19362
+ // THIS CODE IS GENERATED - DO NOT MODIFY.
19337
19363
  var u = undefined;
19338
19364
  function plural(n) {
19339
19365
  var i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length;
@@ -19341,40 +19367,7 @@
19341
19367
  return 1;
19342
19368
  return 5;
19343
19369
  }
19344
- var localeEn = [
19345
- 'en',
19346
- [['a', 'p'], ['AM', 'PM'], u],
19347
- [['AM', 'PM'], u, u],
19348
- [
19349
- ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
19350
- ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
19351
- ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
19352
- ],
19353
- u,
19354
- [
19355
- ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
19356
- ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
19357
- [
19358
- 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
19359
- 'October', 'November', 'December'
19360
- ]
19361
- ],
19362
- u,
19363
- [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']],
19364
- 0,
19365
- [6, 0],
19366
- ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'],
19367
- ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'],
19368
- ['{1}, {0}', u, '{1} \'at\' {0}', u],
19369
- ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
19370
- ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'],
19371
- 'USD',
19372
- '$',
19373
- 'US Dollar',
19374
- {},
19375
- 'ltr',
19376
- plural
19377
- ];
19370
+ var localeEn = ["en", [["a", "p"], ["AM", "PM"], u], [["AM", "PM"], u, u], [["S", "M", "T", "W", "T", "F", "S"], ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]], u, [["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"], ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]], u, [["B", "A"], ["BC", "AD"], ["Before Christ", "Anno Domini"]], 0, [6, 0], ["M/d/yy", "MMM d, y", "MMMM d, y", "EEEE, MMMM d, y"], ["h:mm a", "h:mm:ss a", "h:mm:ss a z", "h:mm:ss a zzzz"], ["{1}, {0}", u, "{1} 'at' {0}", u], [".", ",", ";", "%", "+", "-", "E", "×", "‰", "∞", "NaN", ":"], ["#,##0.###", "#,##0%", "¤#,##0.00", "#E0"], "USD", "$", "US Dollar", {}, "ltr", plural];
19378
19371
 
19379
19372
  /**
19380
19373
  * @license
@@ -22040,7 +22033,7 @@
22040
22033
  /**
22041
22034
  * @publicApi
22042
22035
  */
22043
- var VERSION = new Version('12.2.0-next.2');
22036
+ var VERSION = new Version('12.2.1');
22044
22037
 
22045
22038
  /**
22046
22039
  * @license
@@ -27639,7 +27632,8 @@
27639
27632
  // go into an infinite loop before we've reached the point where we throw all the errors.
27640
27633
  throw new Error("'" + stringifyForError(moduleType) + "' module can't import itself");
27641
27634
  }
27642
- ngModuleDef = getCompilerFacade().compileNgModule(angularCoreEnv, "ng:///" + moduleType.name + "/\u0275mod.js", {
27635
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'NgModule', type: moduleType });
27636
+ ngModuleDef = compiler.compileNgModule(angularCoreEnv, "ng:///" + moduleType.name + "/\u0275mod.js", {
27643
27637
  type: moduleType,
27644
27638
  bootstrap: flatten(ngModule.bootstrap || EMPTY_ARRAY).map(resolveForwardRef),
27645
27639
  declarations: declarations.map(resolveForwardRef),
@@ -27667,7 +27661,7 @@
27667
27661
  Object.defineProperty(moduleType, NG_FACTORY_DEF, {
27668
27662
  get: function () {
27669
27663
  if (ngFactoryDef === null) {
27670
- var compiler = getCompilerFacade();
27664
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'NgModule', type: moduleType });
27671
27665
  ngFactoryDef = compiler.compileFactory(angularCoreEnv, "ng:///" + moduleType.name + "/\u0275fac.js", {
27672
27666
  name: moduleType.name,
27673
27667
  type: moduleType,
@@ -27696,7 +27690,9 @@
27696
27690
  (ngModule.exports || EMPTY_ARRAY).map(resolveForwardRef),
27697
27691
  ],
27698
27692
  };
27699
- ngInjectorDef = getCompilerFacade().compileInjector(angularCoreEnv, "ng:///" + moduleType.name + "/\u0275inj.js", meta);
27693
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'NgModule', type: moduleType });
27694
+ ngInjectorDef =
27695
+ compiler.compileInjector(angularCoreEnv, "ng:///" + moduleType.name + "/\u0275inj.js", meta);
27700
27696
  }
27701
27697
  return ngInjectorDef;
27702
27698
  },
@@ -28059,7 +28055,7 @@
28059
28055
  Object.defineProperty(type, NG_COMP_DEF, {
28060
28056
  get: function () {
28061
28057
  if (ngComponentDef === null) {
28062
- var compiler = getCompilerFacade();
28058
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'component', type: type });
28063
28059
  if (componentNeedsResolution(metadata)) {
28064
28060
  var error = ["Component '" + type.name + "' is not resolved:"];
28065
28061
  if (metadata.templateUrl) {
@@ -28150,8 +28146,9 @@
28150
28146
  // that use `@Directive()` with no selector. In that case, pass empty object to the
28151
28147
  // `directiveMetadata` function instead of null.
28152
28148
  var meta = getDirectiveMetadata$1(type, directive || {});
28149
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'directive', type: type });
28153
28150
  ngDirectiveDef =
28154
- getCompilerFacade().compileDirective(angularCoreEnv, meta.sourceMapUrl, meta.metadata);
28151
+ compiler.compileDirective(angularCoreEnv, meta.sourceMapUrl, meta.metadata);
28155
28152
  }
28156
28153
  return ngDirectiveDef;
28157
28154
  },
@@ -28162,7 +28159,7 @@
28162
28159
  function getDirectiveMetadata$1(type, metadata) {
28163
28160
  var name = type && type.name;
28164
28161
  var sourceMapUrl = "ng:///" + name + "/\u0275dir.js";
28165
- var compiler = getCompilerFacade();
28162
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'directive', type: type });
28166
28163
  var facade = directiveMetadata(type, metadata);
28167
28164
  facade.typeSourceSpan = compiler.createParseSourceSpan('Directive', name, sourceMapUrl);
28168
28165
  if (facade.usesInheritance) {
@@ -28176,7 +28173,7 @@
28176
28173
  get: function () {
28177
28174
  if (ngFactoryDef === null) {
28178
28175
  var meta = getDirectiveMetadata$1(type, metadata);
28179
- var compiler = getCompilerFacade();
28176
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'directive', type: type });
28180
28177
  ngFactoryDef = compiler.compileFactory(angularCoreEnv, "ng:///" + type.name + "/\u0275fac.js", {
28181
28178
  name: meta.metadata.name,
28182
28179
  type: meta.metadata.type,
@@ -28330,7 +28327,7 @@
28330
28327
  get: function () {
28331
28328
  if (ngFactoryDef === null) {
28332
28329
  var metadata = getPipeMetadata(type, meta);
28333
- var compiler = getCompilerFacade();
28330
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'pipe', type: metadata.type });
28334
28331
  ngFactoryDef = compiler.compileFactory(angularCoreEnv, "ng:///" + metadata.name + "/\u0275fac.js", {
28335
28332
  name: metadata.name,
28336
28333
  type: metadata.type,
@@ -28348,7 +28345,9 @@
28348
28345
  get: function () {
28349
28346
  if (ngPipeDef === null) {
28350
28347
  var metadata = getPipeMetadata(type, meta);
28351
- ngPipeDef = getCompilerFacade().compilePipe(angularCoreEnv, "ng:///" + metadata.name + "/\u0275pipe.js", metadata);
28348
+ var compiler = getCompilerFacade({ usage: 0 /* Decorator */, kind: 'pipe', type: metadata.type });
28349
+ ngPipeDef =
28350
+ compiler.compilePipe(angularCoreEnv, "ng:///" + metadata.name + "/\u0275pipe.js", metadata);
28352
28351
  }
28353
28352
  return ngPipeDef;
28354
28353
  },
@@ -29784,7 +29783,11 @@
29784
29783
  if (compilerProviders.length === 0) {
29785
29784
  return Promise.resolve(moduleFactory);
29786
29785
  }
29787
- var compiler = getCompilerFacade();
29786
+ var compiler = getCompilerFacade({
29787
+ usage: 0 /* Decorator */,
29788
+ kind: 'NgModule',
29789
+ type: moduleType,
29790
+ });
29788
29791
  var compilerInjector = Injector.create({ providers: compilerProviders });
29789
29792
  var resourceLoader = compilerInjector.get(compiler.ResourceLoader);
29790
29793
  // The resource loader can also return a string while the "resolveComponentResources"
@@ -31475,16 +31478,16 @@
31475
31478
  /**
31476
31479
  * Work out the locale from the potential global properties.
31477
31480
  *
31478
- * * Closure Compiler: use `goog.LOCALE`.
31481
+ * * Closure Compiler: use `goog.getLocale()`.
31479
31482
  * * Ivy enabled: use `$localize.locale`
31480
31483
  */
31481
31484
  function getGlobalLocale() {
31482
31485
  if (typeof ngI18nClosureMode !== 'undefined' && ngI18nClosureMode &&
31483
- typeof goog !== 'undefined' && goog.LOCALE !== 'en') {
31484
- // * The default `goog.LOCALE` value is `en`, while Angular used `en-US`.
31486
+ typeof goog !== 'undefined' && goog.getLocale() !== 'en') {
31487
+ // * The default `goog.getLocale()` value is `en`, while Angular used `en-US`.
31485
31488
  // * In order to preserve backwards compatibility, we use Angular default value over
31486
31489
  // Closure Compiler's one.
31487
- return goog.LOCALE;
31490
+ return goog.getLocale();
31488
31491
  }
31489
31492
  else {
31490
31493
  // KEEP `typeof $localize !== 'undefined' && $localize.locale` IN SYNC WITH THE LOCALIZE
@@ -33903,7 +33906,7 @@
33903
33906
  * @codeGenApi
33904
33907
  */
33905
33908
  function ɵɵngDeclareDirective(decl) {
33906
- var compiler = getCompilerFacade();
33909
+ var compiler = getCompilerFacade({ usage: 1 /* PartialDeclaration */, kind: 'directive', type: decl.type });
33907
33910
  return compiler.compileDirectiveDeclaration(angularCoreEnv, "ng:///" + decl.type.name + "/\u0275fac.js", decl);
33908
33911
  }
33909
33912
  /**
@@ -33921,7 +33924,7 @@
33921
33924
  * @codeGenApi
33922
33925
  */
33923
33926
  function ɵɵngDeclareComponent(decl) {
33924
- var compiler = getCompilerFacade();
33927
+ var compiler = getCompilerFacade({ usage: 1 /* PartialDeclaration */, kind: 'component', type: decl.type });
33925
33928
  return compiler.compileComponentDeclaration(angularCoreEnv, "ng:///" + decl.type.name + "/\u0275cmp.js", decl);
33926
33929
  }
33927
33930
  /**
@@ -33930,16 +33933,34 @@
33930
33933
  * @codeGenApi
33931
33934
  */
33932
33935
  function ɵɵngDeclareFactory(decl) {
33933
- var compiler = getCompilerFacade();
33936
+ var compiler = getCompilerFacade({
33937
+ usage: 1 /* PartialDeclaration */,
33938
+ kind: getFactoryKind(decl.target),
33939
+ type: decl.type
33940
+ });
33934
33941
  return compiler.compileFactoryDeclaration(angularCoreEnv, "ng:///" + decl.type.name + "/\u0275fac.js", decl);
33935
33942
  }
33943
+ function getFactoryKind(target) {
33944
+ switch (target) {
33945
+ case exports.ɵɵFactoryTarget.Directive:
33946
+ return 'directive';
33947
+ case exports.ɵɵFactoryTarget.Component:
33948
+ return 'component';
33949
+ case exports.ɵɵFactoryTarget.Injectable:
33950
+ return 'injectable';
33951
+ case exports.ɵɵFactoryTarget.Pipe:
33952
+ return 'pipe';
33953
+ case exports.ɵɵFactoryTarget.NgModule:
33954
+ return 'NgModule';
33955
+ }
33956
+ }
33936
33957
  /**
33937
33958
  * Compiles a partial injectable declaration object into a full injectable definition object.
33938
33959
  *
33939
33960
  * @codeGenApi
33940
33961
  */
33941
33962
  function ɵɵngDeclareInjectable(decl) {
33942
- var compiler = getCompilerFacade();
33963
+ var compiler = getCompilerFacade({ usage: 1 /* PartialDeclaration */, kind: 'injectable', type: decl.type });
33943
33964
  return compiler.compileInjectableDeclaration(angularCoreEnv, "ng:///" + decl.type.name + "/\u0275prov.js", decl);
33944
33965
  }
33945
33966
  /**
@@ -33948,7 +33969,7 @@
33948
33969
  * @codeGenApi
33949
33970
  */
33950
33971
  function ɵɵngDeclareInjector(decl) {
33951
- var compiler = getCompilerFacade();
33972
+ var compiler = getCompilerFacade({ usage: 1 /* PartialDeclaration */, kind: 'NgModule', type: decl.type });
33952
33973
  return compiler.compileInjectorDeclaration(angularCoreEnv, "ng:///" + decl.type.name + "/\u0275inj.js", decl);
33953
33974
  }
33954
33975
  /**
@@ -33957,7 +33978,7 @@
33957
33978
  * @codeGenApi
33958
33979
  */
33959
33980
  function ɵɵngDeclareNgModule(decl) {
33960
- var compiler = getCompilerFacade();
33981
+ var compiler = getCompilerFacade({ usage: 1 /* PartialDeclaration */, kind: 'NgModule', type: decl.type });
33961
33982
  return compiler.compileNgModuleDeclaration(angularCoreEnv, "ng:///" + decl.type.name + "/\u0275mod.js", decl);
33962
33983
  }
33963
33984
  /**
@@ -33966,7 +33987,7 @@
33966
33987
  * @codeGenApi
33967
33988
  */
33968
33989
  function ɵɵngDeclarePipe(decl) {
33969
- var compiler = getCompilerFacade();
33990
+ var compiler = getCompilerFacade({ usage: 1 /* PartialDeclaration */, kind: 'pipe', type: decl.type });
33970
33991
  return compiler.compilePipeDeclaration(angularCoreEnv, "ng:///" + decl.type.name + "/\u0275pipe.js", decl);
33971
33992
  }
33972
33993