@angular/core 10.2.1 → 10.2.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.2.1
2
+ * @license Angular v10.2.5
3
3
  * (c) 2010-2020 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -5014,6 +5014,11 @@
5014
5014
  if (_runModeLocked) {
5015
5015
  throw new Error('Cannot enable prod mode after platform setup.');
5016
5016
  }
5017
+ // The below check is there so when ngDevMode is set via terser
5018
+ // `global['ngDevMode'] = false;` is also dropped.
5019
+ if (typeof ngDevMode === undefined || !!ngDevMode) {
5020
+ _global['ngDevMode'] = false;
5021
+ }
5017
5022
  _devMode = false;
5018
5023
  }
5019
5024
 
@@ -5658,6 +5663,55 @@
5658
5663
  return lView && lView[SANITIZER];
5659
5664
  }
5660
5665
 
5666
+ /**
5667
+ * @license
5668
+ * Copyright Google LLC All Rights Reserved.
5669
+ *
5670
+ * Use of this source code is governed by an MIT-style license that can be
5671
+ * found in the LICENSE file at https://angular.io/license
5672
+ */
5673
+ /**
5674
+ * Disallowed strings in the comment.
5675
+ *
5676
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
5677
+ */
5678
+ var COMMENT_DISALLOWED = /^>|^->|<!--|-->|--!>|<!-$/g;
5679
+ /**
5680
+ * Delimiter in the disallowed strings which needs to be wrapped with zero with character.
5681
+ */
5682
+ var COMMENT_DELIMITER = /(<|>)/;
5683
+ var COMMENT_DELIMITER_ESCAPED = '\u200B$1\u200B';
5684
+ /**
5685
+ * Escape the content of comment strings so that it can be safely inserted into a comment node.
5686
+ *
5687
+ * The issue is that HTML does not specify any way to escape comment end text inside the comment.
5688
+ * Consider: `<!-- The way you close a comment is with ">", and "->" at the beginning or by "-->" or
5689
+ * "--!>" at the end. -->`. Above the `"-->"` is meant to be text not an end to the comment. This
5690
+ * can be created programmatically through DOM APIs. (`<!--` are also disallowed.)
5691
+ *
5692
+ * see: https://html.spec.whatwg.org/multipage/syntax.html#comments
5693
+ *
5694
+ * ```
5695
+ * div.innerHTML = div.innerHTML
5696
+ * ```
5697
+ *
5698
+ * One would expect that the above code would be safe to do, but it turns out that because comment
5699
+ * text is not escaped, the comment may contain text which will prematurely close the comment
5700
+ * opening up the application for XSS attack. (In SSR we programmatically create comment nodes which
5701
+ * may contain such text and expect them to be safe.)
5702
+ *
5703
+ * This function escapes the comment text by looking for comment delimiters (`<` and `>`) and
5704
+ * surrounding them with `_>_` where the `_` is a zero width space `\u200B`. The result is that if a
5705
+ * comment contains any of the comment start/end delimiters (such as `<!--`, `-->` or `--!>`) the
5706
+ * text it will render normally but it will not cause the HTML parser to close/open the comment.
5707
+ *
5708
+ * @param value text to make safe for comment node by escaping the comment open/close character
5709
+ * sequence.
5710
+ */
5711
+ function escapeCommentText(value) {
5712
+ return value.replace(COMMENT_DISALLOWED, function (text) { return text.replace(COMMENT_DELIMITER, COMMENT_DELIMITER_ESCAPED); });
5713
+ }
5714
+
5661
5715
  /**
5662
5716
  * @license
5663
5717
  * Copyright Google LLC All Rights Reserved.
@@ -8400,7 +8454,7 @@
8400
8454
  }
8401
8455
  }
8402
8456
  else {
8403
- var textContent = "bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2);
8457
+ var textContent = escapeCommentText("bindings=" + JSON.stringify((_a = {}, _a[attrName] = debugValue, _a), null, 2));
8404
8458
  if (isProceduralRenderer(renderer)) {
8405
8459
  renderer.setValue(element, textContent);
8406
8460
  }
@@ -9119,8 +9173,10 @@
9119
9173
  */
9120
9174
  function scheduleTick(rootContext, flags) {
9121
9175
  var nothingScheduled = rootContext.flags === 0 /* Empty */;
9122
- rootContext.flags |= flags;
9123
9176
  if (nothingScheduled && rootContext.clean == _CLEAN_PROMISE) {
9177
+ // https://github.com/angular/angular/issues/39296
9178
+ // should only attach the flags when really scheduling a tick
9179
+ rootContext.flags |= flags;
9124
9180
  var res_1;
9125
9181
  rootContext.clean = new Promise(function (r) { return res_1 = r; });
9126
9182
  rootContext.scheduler(function () {
@@ -21684,7 +21740,7 @@
21684
21740
  /**
21685
21741
  * @publicApi
21686
21742
  */
21687
- var VERSION = new Version('10.2.1');
21743
+ var VERSION = new Version('10.2.5');
21688
21744
 
21689
21745
  /**
21690
21746
  * @license
@@ -24873,13 +24929,6 @@
24873
24929
  });
24874
24930
  }
24875
24931
 
24876
- /**
24877
- * @license
24878
- * Copyright Google LLC All Rights Reserved.
24879
- *
24880
- * Use of this source code is governed by an MIT-style license that can be
24881
- * found in the LICENSE file at https://angular.io/license
24882
- */
24883
24932
  /**
24884
24933
  * Map of module-id to the corresponding NgModule.
24885
24934
  * - In pre Ivy we track NgModuleFactory,
@@ -24901,18 +24950,36 @@
24901
24950
  }
24902
24951
  }
24903
24952
  function registerNgModuleType(ngModuleType) {
24904
- if (ngModuleType.ɵmod.id !== null) {
24905
- var id = ngModuleType.ɵmod.id;
24906
- var existing = modules.get(id);
24907
- assertSameOrNotExisting(id, existing, ngModuleType);
24908
- modules.set(id, ngModuleType);
24909
- }
24910
- var imports = ngModuleType.ɵmod.imports;
24911
- if (imports instanceof Function) {
24912
- imports = imports();
24913
- }
24914
- if (imports) {
24915
- imports.forEach(function (i) { return registerNgModuleType(i); });
24953
+ var visited = new Set();
24954
+ recurse(ngModuleType);
24955
+ function recurse(ngModuleType) {
24956
+ var e_1, _a;
24957
+ // The imports array of an NgModule must refer to other NgModules,
24958
+ // so an error is thrown if no module definition is available.
24959
+ var def = getNgModuleDef(ngModuleType, /* throwNotFound */ true);
24960
+ var id = def.id;
24961
+ if (id !== null) {
24962
+ var existing = modules.get(id);
24963
+ assertSameOrNotExisting(id, existing, ngModuleType);
24964
+ modules.set(id, ngModuleType);
24965
+ }
24966
+ var imports = maybeUnwrapFn(def.imports);
24967
+ try {
24968
+ for (var imports_1 = __values(imports), imports_1_1 = imports_1.next(); !imports_1_1.done; imports_1_1 = imports_1.next()) {
24969
+ var i = imports_1_1.value;
24970
+ if (!visited.has(i)) {
24971
+ visited.add(i);
24972
+ recurse(i);
24973
+ }
24974
+ }
24975
+ }
24976
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
24977
+ finally {
24978
+ try {
24979
+ if (imports_1_1 && !imports_1_1.done && (_a = imports_1.return)) _a.call(imports_1);
24980
+ }
24981
+ finally { if (e_1) throw e_1.error; }
24982
+ }
24916
24983
  }
24917
24984
  }
24918
24985
  function clearModulesForTest() {
@@ -32150,7 +32217,7 @@
32150
32217
  var el = asElementData(view, elDef.nodeIndex).renderElement;
32151
32218
  if (!elDef.element.name) {
32152
32219
  // a comment.
32153
- view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
32220
+ view.renderer.setValue(el, escapeCommentText("bindings=" + JSON.stringify(bindingValues, null, 2)));
32154
32221
  }
32155
32222
  else {
32156
32223
  // a regular element.
@@ -32439,7 +32506,7 @@
32439
32506
  return el;
32440
32507
  };
32441
32508
  DebugRenderer2.prototype.createComment = function (value) {
32442
- var comment = this.delegate.createComment(value);
32509
+ var comment = this.delegate.createComment(escapeCommentText(value));
32443
32510
  var debugCtx = this.createDebugContext(comment);
32444
32511
  if (debugCtx) {
32445
32512
  indexDebugNode(new DebugNode__PRE_R3__(comment, null, debugCtx));