@angular/core 15.0.0-rc.4 → 15.1.0-next.0

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,10 +1,10 @@
1
1
  /**
2
- * @license Angular v15.0.0-rc.4
2
+ * @license Angular v15.1.0-next.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { getDebugNode as getDebugNode$1, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ɵisEnvironmentProviders, ModuleWithComponentFactories, ɵconvertToBitFlags, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
7
+ import { getDebugNode as getDebugNode$1, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ɵisEnvironmentProviders, ModuleWithComponentFactories, ɵconvertToBitFlags, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, EnvironmentInjector as EnvironmentInjector$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
8
8
  import { __awaiter } from 'tslib';
9
9
  import { ResourceLoader } from '@angular/compiler';
10
10
  import { Subject, Subscription } from 'rxjs';
@@ -907,11 +907,15 @@ const NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafePr
907
907
  /**
908
908
  * Base URL for the error details page.
909
909
  *
910
- * Keep the files below in full sync:
910
+ * Keep this constant in sync across:
911
911
  * - packages/compiler-cli/src/ngtsc/diagnostics/src/error_details_base_url.ts
912
912
  * - packages/core/src/error_details_base_url.ts
913
913
  */
914
914
  const ERROR_DETAILS_PAGE_BASE_URL = 'https://angular.io/errors';
915
+ /**
916
+ * URL for the XSS security documentation.
917
+ */
918
+ const XSS_SECURITY_URL = 'https://g.co/ng/security#xss';
915
919
 
916
920
  /**
917
921
  * @license
@@ -6812,26 +6816,17 @@ function processCleanups(tView, lView) {
6812
6816
  if (tCleanup !== null) {
6813
6817
  for (let i = 0; i < tCleanup.length - 1; i += 2) {
6814
6818
  if (typeof tCleanup[i] === 'string') {
6815
- // This is a native DOM listener
6816
- const idxOrTargetGetter = tCleanup[i + 1];
6817
- const target = typeof idxOrTargetGetter === 'function' ?
6818
- idxOrTargetGetter(lView) :
6819
- unwrapRNode(lView[idxOrTargetGetter]);
6820
- const listener = lCleanup[lastLCleanupIndex = tCleanup[i + 2]];
6821
- const useCaptureOrSubIdx = tCleanup[i + 3];
6822
- if (typeof useCaptureOrSubIdx === 'boolean') {
6823
- // native DOM listener registered with Renderer3
6824
- target.removeEventListener(tCleanup[i], listener, useCaptureOrSubIdx);
6819
+ // This is a native DOM listener. It will occupy 4 entries in the TCleanup array (hence i +=
6820
+ // 2 at the end of this block).
6821
+ const targetIdx = tCleanup[i + 3];
6822
+ ngDevMode && assertNumber(targetIdx, 'cleanup target must be a number');
6823
+ if (targetIdx >= 0) {
6824
+ // unregister
6825
+ lCleanup[lastLCleanupIndex = targetIdx]();
6825
6826
  }
6826
6827
  else {
6827
- if (useCaptureOrSubIdx >= 0) {
6828
- // unregister
6829
- lCleanup[lastLCleanupIndex = useCaptureOrSubIdx]();
6830
- }
6831
- else {
6832
- // Subscription
6833
- lCleanup[lastLCleanupIndex = -useCaptureOrSubIdx].unsubscribe();
6834
- }
6828
+ // Subscription
6829
+ lCleanup[lastLCleanupIndex = -targetIdx].unsubscribe();
6835
6830
  }
6836
6831
  i += 2;
6837
6832
  }
@@ -7693,7 +7688,7 @@ class SafeValueImpl {
7693
7688
  }
7694
7689
  toString() {
7695
7690
  return `SafeValue must use [property]=binding: ${this.changingThisBreaksApplicationSecurity}` +
7696
- ` (see https://g.co/ng/security#xss)`;
7691
+ ` (see ${XSS_SECURITY_URL})`;
7697
7692
  }
7698
7693
  }
7699
7694
  class SafeHtmlImpl extends SafeValueImpl {
@@ -7731,7 +7726,7 @@ function allowSanitizationBypassAndThrow(value, type) {
7731
7726
  // Allow ResourceURLs in URL contexts, they are strictly more trusted.
7732
7727
  if (actualType === "ResourceURL" /* BypassType.ResourceUrl */ && type === "URL" /* BypassType.Url */)
7733
7728
  return true;
7734
- throw new Error(`Required a safe ${type}, got a ${actualType} (see https://g.co/ng/security#xss)`);
7729
+ throw new Error(`Required a safe ${type}, got a ${actualType} (see ${XSS_SECURITY_URL})`);
7735
7730
  }
7736
7731
  return actualType === type;
7737
7732
  }
@@ -7971,7 +7966,7 @@ function _sanitizeUrl(url) {
7971
7966
  if (url.match(SAFE_URL_PATTERN))
7972
7967
  return url;
7973
7968
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
7974
- console.warn(`WARNING: sanitizing unsafe URL value ${url} (see https://g.co/ng/security#xss)`);
7969
+ console.warn(`WARNING: sanitizing unsafe URL value ${url} (see ${XSS_SECURITY_URL})`);
7975
7970
  }
7976
7971
  return 'unsafe:' + url;
7977
7972
  }
@@ -8199,7 +8194,7 @@ function _sanitizeHtml(defaultDoc, unsafeHtmlInput) {
8199
8194
  const sanitizer = new SanitizingHtmlSerializer();
8200
8195
  const safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement);
8201
8196
  if ((typeof ngDevMode === 'undefined' || ngDevMode) && sanitizer.sanitizedSomething) {
8202
- console.warn('WARNING: sanitizing HTML stripped some content, see https://g.co/ng/security#xss');
8197
+ console.warn(`WARNING: sanitizing HTML stripped some content, see ${XSS_SECURITY_URL}`);
8203
8198
  }
8204
8199
  return trustedHTMLFromString(safeHtml);
8205
8200
  }
@@ -8346,8 +8341,7 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
8346
8341
  if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
8347
8342
  return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
8348
8343
  }
8349
- throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
8350
- 'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
8344
+ throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode && `unsafe value used in a resource URL context (see ${XSS_SECURITY_URL})`);
8351
8345
  }
8352
8346
  /**
8353
8347
  * A `script` sanitizer which only lets trusted javascript through.
@@ -9532,7 +9526,7 @@ class Version {
9532
9526
  /**
9533
9527
  * @publicApi
9534
9528
  */
9535
- const VERSION = new Version('15.0.0-rc.4');
9529
+ const VERSION = new Version('15.1.0-next.0');
9536
9530
 
9537
9531
  /**
9538
9532
  * @license
@@ -16139,7 +16133,8 @@ const isObservable = isSubscribable;
16139
16133
  *
16140
16134
  * @param eventName Name of the event
16141
16135
  * @param listenerFn The function to be called when event emits
16142
- * @param useCapture Whether or not to use capture in event listener
16136
+ * @param useCapture Whether or not to use capture in event listener - this argument is a reminder
16137
+ * from the Renderer3 infrastructure and should be removed from the instruction arguments
16143
16138
  * @param eventTargetResolver Function that returns global target information in case this listener
16144
16139
  * should be attached to a global object like window, document or body
16145
16140
  *
@@ -16149,7 +16144,7 @@ function ɵɵlistener(eventName, listenerFn, useCapture, eventTargetResolver) {
16149
16144
  const lView = getLView();
16150
16145
  const tView = getTView();
16151
16146
  const tNode = getCurrentTNode();
16152
- listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, !!useCapture, eventTargetResolver);
16147
+ listenerInternal(tView, lView, lView[RENDERER], tNode, eventName, listenerFn, eventTargetResolver);
16153
16148
  return ɵɵlistener;
16154
16149
  }
16155
16150
  /**
@@ -16179,7 +16174,7 @@ function ɵɵsyntheticHostListener(eventName, listenerFn) {
16179
16174
  const tView = getTView();
16180
16175
  const currentDef = getCurrentDirectiveDef(tView.data);
16181
16176
  const renderer = loadComponentRenderer(currentDef, tNode, lView);
16182
- listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, false);
16177
+ listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn);
16183
16178
  return ɵɵsyntheticHostListener;
16184
16179
  }
16185
16180
  /**
@@ -16212,7 +16207,7 @@ function findExistingListener(tView, lView, eventName, tNodeIdx) {
16212
16207
  }
16213
16208
  return null;
16214
16209
  }
16215
- function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, useCapture, eventTargetResolver) {
16210
+ function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn, eventTargetResolver) {
16216
16211
  const isTNodeDirectiveHost = isDirectiveHost(tNode);
16217
16212
  const firstCreatePass = tView.firstCreatePass;
16218
16213
  const tCleanup = firstCreatePass && getOrCreateTViewCleanup(tView);
@@ -21539,7 +21534,7 @@ function walkIcuTree(tView, tIcu, lView, sharedUpdateOpCodes, create, remove, up
21539
21534
  ngDevMode &&
21540
21535
  console.warn(`WARNING: ignoring unsafe attribute value ` +
21541
21536
  `${lowerAttrName} on element ${tagName} ` +
21542
- `(see https://g.co/ng/security#xss)`);
21537
+ `(see ${XSS_SECURITY_URL})`);
21543
21538
  }
21544
21539
  }
21545
21540
  else {
@@ -26395,6 +26390,14 @@ class TestBedImpl {
26395
26390
  static get(token, notFoundValue = Injector$1.THROW_IF_NOT_FOUND, flags = InjectFlags$1.Default) {
26396
26391
  return TestBedImpl.INSTANCE.inject(token, notFoundValue, flags);
26397
26392
  }
26393
+ /**
26394
+ * Runs the given function in the `EnvironmentInjector` context of `TestBed`.
26395
+ *
26396
+ * @see EnvironmentInjector#runInContext
26397
+ */
26398
+ static runInInjectionContext(fn) {
26399
+ return TestBedImpl.INSTANCE.runInInjectionContext(fn);
26400
+ }
26398
26401
  static createComponent(component) {
26399
26402
  return TestBedImpl.INSTANCE.createComponent(component);
26400
26403
  }
@@ -26531,6 +26534,9 @@ class TestBedImpl {
26531
26534
  get(token, notFoundValue = Injector$1.THROW_IF_NOT_FOUND, flags = InjectFlags$1.Default) {
26532
26535
  return this.inject(token, notFoundValue, flags);
26533
26536
  }
26537
+ runInInjectionContext(fn) {
26538
+ return this.inject(EnvironmentInjector$1).runInContext(fn);
26539
+ }
26534
26540
  execute(tokens, fn, context) {
26535
26541
  const params = tokens.map(t => this.inject(t));
26536
26542
  return fn.apply(context, params);