@angular/compiler 19.2.16 → 19.2.18

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 v19.2.16
2
+ * @license Angular v19.2.18
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -440,6 +440,7 @@ var SecurityContext;
440
440
  SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
441
441
  SecurityContext[SecurityContext["URL"] = 4] = "URL";
442
442
  SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
443
+ SecurityContext[SecurityContext["ATTRIBUTE_NO_BINDING"] = 6] = "ATTRIBUTE_NO_BINDING";
443
444
  })(SecurityContext || (SecurityContext = {}));
444
445
  var MissingTranslationStrategy;
445
446
  (function (MissingTranslationStrategy) {
@@ -3100,6 +3101,10 @@ class Identifiers {
3100
3101
  // sanitization-related functions
3101
3102
  static sanitizeHtml = { name: 'ɵɵsanitizeHtml', moduleName: CORE };
3102
3103
  static sanitizeStyle = { name: 'ɵɵsanitizeStyle', moduleName: CORE };
3104
+ static validateAttribute = {
3105
+ name: 'ɵɵvalidateAttribute',
3106
+ moduleName: CORE,
3107
+ };
3103
3108
  static sanitizeResourceUrl = {
3104
3109
  name: 'ɵɵsanitizeResourceUrl',
3105
3110
  moduleName: CORE,
@@ -3115,10 +3120,6 @@ class Identifiers {
3115
3120
  name: 'ɵɵtrustConstantResourceUrl',
3116
3121
  moduleName: CORE,
3117
3122
  };
3118
- static validateIframeAttribute = {
3119
- name: 'ɵɵvalidateIframeAttribute',
3120
- moduleName: CORE,
3121
- };
3122
3123
  // type-checking
3123
3124
  static InputSignalBrandWriteType = { name: 'ɵINPUT_SIGNAL_BRAND_WRITE_TYPE', moduleName: CORE };
3124
3125
  static UnwrapDirectiveSignalInputs = { name: 'ɵUnwrapDirectiveSignalInputs', moduleName: CORE };
@@ -19479,7 +19480,6 @@ function interleave(left, right) {
19479
19480
  // =================================================================================================
19480
19481
  //
19481
19482
  // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
19482
- // Reach out to mprobst for details.
19483
19483
  //
19484
19484
  // =================================================================================================
19485
19485
  /** Map from tagName|propertyName to SecurityContext. Properties applying to all tags use '*'. */
@@ -19497,6 +19497,7 @@ function SECURITY_SCHEMA() {
19497
19497
  'area|ping',
19498
19498
  'audio|src',
19499
19499
  'a|href',
19500
+ 'a|xlink:href',
19500
19501
  'a|ping',
19501
19502
  'blockquote|cite',
19502
19503
  'body|background',
@@ -19510,6 +19511,74 @@ function SECURITY_SCHEMA() {
19510
19511
  'track|src',
19511
19512
  'video|poster',
19512
19513
  'video|src',
19514
+ // MathML namespace
19515
+ // https://crsrc.org/c/third_party/blink/renderer/core/sanitizer/sanitizer.cc;l=753-768;drc=b3eb16372dcd3317d65e9e0265015e322494edcd;bpv=1;bpt=1
19516
+ 'annotation|href',
19517
+ 'annotation|xlink:href',
19518
+ 'annotation-xml|href',
19519
+ 'annotation-xml|xlink:href',
19520
+ 'maction|href',
19521
+ 'maction|xlink:href',
19522
+ 'malignmark|href',
19523
+ 'malignmark|xlink:href',
19524
+ 'math|href',
19525
+ 'math|xlink:href',
19526
+ 'mroot|href',
19527
+ 'mroot|xlink:href',
19528
+ 'msqrt|href',
19529
+ 'msqrt|xlink:href',
19530
+ 'merror|href',
19531
+ 'merror|xlink:href',
19532
+ 'mfrac|href',
19533
+ 'mfrac|xlink:href',
19534
+ 'mglyph|href',
19535
+ 'mglyph|xlink:href',
19536
+ 'msub|href',
19537
+ 'msub|xlink:href',
19538
+ 'msup|href',
19539
+ 'msup|xlink:href',
19540
+ 'msubsup|href',
19541
+ 'msubsup|xlink:href',
19542
+ 'mmultiscripts|href',
19543
+ 'mmultiscripts|xlink:href',
19544
+ 'mprescripts|href',
19545
+ 'mprescripts|xlink:href',
19546
+ 'mi|href',
19547
+ 'mi|xlink:href',
19548
+ 'mn|href',
19549
+ 'mn|xlink:href',
19550
+ 'mo|href',
19551
+ 'mo|xlink:href',
19552
+ 'mpadded|href',
19553
+ 'mpadded|xlink:href',
19554
+ 'mphantom|href',
19555
+ 'mphantom|xlink:href',
19556
+ 'mrow|href',
19557
+ 'mrow|xlink:href',
19558
+ 'ms|href',
19559
+ 'ms|xlink:href',
19560
+ 'mspace|href',
19561
+ 'mspace|xlink:href',
19562
+ 'mstyle|href',
19563
+ 'mstyle|xlink:href',
19564
+ 'mtable|href',
19565
+ 'mtable|xlink:href',
19566
+ 'mtd|href',
19567
+ 'mtd|xlink:href',
19568
+ 'mtr|href',
19569
+ 'mtr|xlink:href',
19570
+ 'mtext|href',
19571
+ 'mtext|xlink:href',
19572
+ 'mover|href',
19573
+ 'mover|xlink:href',
19574
+ 'munder|href',
19575
+ 'munder|xlink:href',
19576
+ 'munderover|href',
19577
+ 'munderover|xlink:href',
19578
+ 'semantics|href',
19579
+ 'semantics|xlink:href',
19580
+ 'none|href',
19581
+ 'none|xlink:href',
19513
19582
  ]);
19514
19583
  registerContext(SecurityContext.RESOURCE_URL, [
19515
19584
  'applet|code',
@@ -19525,6 +19594,33 @@ function SECURITY_SCHEMA() {
19525
19594
  'object|codebase',
19526
19595
  'object|data',
19527
19596
  'script|src',
19597
+ // The below two are for Script SVG
19598
+ // See: https://developer.mozilla.org/en-US/docs/Web/API/SVGScriptElement/href
19599
+ 'script|href',
19600
+ 'script|xlink:href',
19601
+ ]);
19602
+ // Keep this in sync with SECURITY_SENSITIVE_ELEMENTS in packages/core/src/sanitization/sanitization.ts
19603
+ // Unknown is the internal tag name for unknown elements example used for host-bindings.
19604
+ // These are unsafe as `attributeName` can be `href` or `xlink:href`
19605
+ // See: http://b/463880509#comment7
19606
+ registerContext(SecurityContext.ATTRIBUTE_NO_BINDING, [
19607
+ 'animate|attributeName',
19608
+ 'set|attributeName',
19609
+ 'animateMotion|attributeName',
19610
+ 'animateTransform|attributeName',
19611
+ 'unknown|attributeName',
19612
+ 'iframe|sandbox',
19613
+ 'iframe|allow',
19614
+ 'iframe|allowFullscreen',
19615
+ 'iframe|referrerPolicy',
19616
+ 'iframe|csp',
19617
+ 'iframe|fetchPriority',
19618
+ 'unknown|sandbox',
19619
+ 'unknown|allow',
19620
+ 'unknown|allowFullscreen',
19621
+ 'unknown|referrerPolicy',
19622
+ 'unknown|csp',
19623
+ 'unknown|fetchPriority',
19528
19624
  ]);
19529
19625
  }
19530
19626
  return _SECURITY_SCHEMA;
@@ -19533,32 +19629,6 @@ function registerContext(ctx, specs) {
19533
19629
  for (const spec of specs)
19534
19630
  _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
19535
19631
  }
19536
- /**
19537
- * The set of security-sensitive attributes of an `<iframe>` that *must* be
19538
- * applied as a static attribute only. This ensures that all security-sensitive
19539
- * attributes are taken into account while creating an instance of an `<iframe>`
19540
- * at runtime.
19541
- *
19542
- * Note: avoid using this set directly, use the `isIframeSecuritySensitiveAttr` function
19543
- * in the code instead.
19544
- */
19545
- const IFRAME_SECURITY_SENSITIVE_ATTRS = new Set([
19546
- 'sandbox',
19547
- 'allow',
19548
- 'allowfullscreen',
19549
- 'referrerpolicy',
19550
- 'csp',
19551
- 'fetchpriority',
19552
- ]);
19553
- /**
19554
- * Checks whether a given attribute name might represent a security-sensitive
19555
- * attribute of an <iframe>.
19556
- */
19557
- function isIframeSecuritySensitiveAttr(attrName) {
19558
- // The `setAttribute` DOM API is case-insensitive, so we lowercase the value
19559
- // before checking it against a known security-sensitive attributes.
19560
- return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
19561
- }
19562
19632
 
19563
19633
  class ElementSchemaRegistry {
19564
19634
  }
@@ -24098,6 +24168,7 @@ const sanitizerFns = new Map([
24098
24168
  [SecurityContext.SCRIPT, Identifiers.sanitizeScript],
24099
24169
  [SecurityContext.STYLE, Identifiers.sanitizeStyle],
24100
24170
  [SecurityContext.URL, Identifiers.sanitizeUrl],
24171
+ [SecurityContext.ATTRIBUTE_NO_BINDING, Identifiers.validateAttribute],
24101
24172
  ]);
24102
24173
  /**
24103
24174
  * Map of security contexts to their trusted value function.
@@ -24111,7 +24182,6 @@ const trustedValueFns = new Map([
24111
24182
  */
24112
24183
  function resolveSanitizers(job) {
24113
24184
  for (const unit of job.units) {
24114
- const elements = createOpXrefMap(unit);
24115
24185
  // For normal element bindings we create trusted values for security sensitive constant
24116
24186
  // attributes. However, for host bindings we skip this step (this matches what
24117
24187
  // TemplateDefinitionBuilder does).
@@ -24132,8 +24202,8 @@ function resolveSanitizers(job) {
24132
24202
  let sanitizerFn = null;
24133
24203
  if (Array.isArray(op.securityContext) &&
24134
24204
  op.securityContext.length === 2 &&
24135
- op.securityContext.indexOf(SecurityContext.URL) > -1 &&
24136
- op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
24205
+ op.securityContext.includes(SecurityContext.URL) &&
24206
+ op.securityContext.includes(SecurityContext.RESOURCE_URL)) {
24137
24207
  // When the host element isn't known, some URL attributes (such as "src" and "href") may
24138
24208
  // be part of multiple different security contexts. In this case we use special
24139
24209
  // sanitization function and select the actual sanitizer at runtime based on a tag name
@@ -24144,43 +24214,11 @@ function resolveSanitizers(job) {
24144
24214
  sanitizerFn = sanitizerFns.get(getOnlySecurityContext(op.securityContext)) ?? null;
24145
24215
  }
24146
24216
  op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
24147
- // If there was no sanitization function found based on the security context of an
24148
- // attribute/property, check whether this attribute/property is one of the
24149
- // security-sensitive <iframe> attributes (and that the current element is actually an
24150
- // <iframe>).
24151
- if (op.sanitizer === null) {
24152
- let isIframe = false;
24153
- if (job.kind === CompilationJobKind.Host || op.kind === OpKind.HostProperty) {
24154
- // Note: for host bindings defined on a directive, we do not try to find all
24155
- // possible places where it can be matched, so we can not determine whether
24156
- // the host element is an <iframe>. In this case, we just assume it is and append a
24157
- // validation function, which is invoked at runtime and would have access to the
24158
- // underlying DOM element to check if it's an <iframe> and if so - run extra checks.
24159
- isIframe = true;
24160
- }
24161
- else {
24162
- // For a normal binding we can just check if the element its on is an iframe.
24163
- const ownerOp = elements.get(op.target);
24164
- if (ownerOp === undefined || !isElementOrContainerOp(ownerOp)) {
24165
- throw Error('Property should have an element-like owner');
24166
- }
24167
- isIframe = isIframeElement(ownerOp);
24168
- }
24169
- if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
24170
- op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
24171
- }
24172
- }
24173
24217
  break;
24174
24218
  }
24175
24219
  }
24176
24220
  }
24177
24221
  }
24178
- /**
24179
- * Checks whether the given op represents an iframe element.
24180
- */
24181
- function isIframeElement(op) {
24182
- return op.kind === OpKind.ElementStart && op.tag?.toLowerCase() === 'iframe';
24183
- }
24184
24222
  /**
24185
24223
  * Asserts that there is only a single security context and returns it.
24186
24224
  */
@@ -30947,7 +30985,7 @@ function publishFacade(global) {
30947
30985
  * @description
30948
30986
  * Entry point for all public APIs of the compiler package.
30949
30987
  */
30950
- const VERSION = new Version('19.2.16');
30988
+ const VERSION = new Version('19.2.18');
30951
30989
 
30952
30990
  class CompilerConfig {
30953
30991
  defaultEncapsulation;
@@ -32804,7 +32842,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
32804
32842
  function compileDeclareClassMetadata(metadata) {
32805
32843
  const definitionMap = new DefinitionMap();
32806
32844
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
32807
- definitionMap.set('version', literal('19.2.16'));
32845
+ definitionMap.set('version', literal('19.2.18'));
32808
32846
  definitionMap.set('ngImport', importExpr(Identifiers.core));
32809
32847
  definitionMap.set('type', metadata.type);
32810
32848
  definitionMap.set('decorators', metadata.decorators);
@@ -32822,7 +32860,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
32822
32860
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
32823
32861
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
32824
32862
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
32825
- definitionMap.set('version', literal('19.2.16'));
32863
+ definitionMap.set('version', literal('19.2.18'));
32826
32864
  definitionMap.set('ngImport', importExpr(Identifiers.core));
32827
32865
  definitionMap.set('type', metadata.type);
32828
32866
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -32917,7 +32955,7 @@ function createDirectiveDefinitionMap(meta) {
32917
32955
  const definitionMap = new DefinitionMap();
32918
32956
  const minVersion = getMinimumVersionForPartialOutput(meta);
32919
32957
  definitionMap.set('minVersion', literal(minVersion));
32920
- definitionMap.set('version', literal('19.2.16'));
32958
+ definitionMap.set('version', literal('19.2.18'));
32921
32959
  // e.g. `type: MyDirective`
32922
32960
  definitionMap.set('type', meta.type.value);
32923
32961
  if (meta.isStandalone !== undefined) {
@@ -33333,7 +33371,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
33333
33371
  function compileDeclareFactoryFunction(meta) {
33334
33372
  const definitionMap = new DefinitionMap();
33335
33373
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
33336
- definitionMap.set('version', literal('19.2.16'));
33374
+ definitionMap.set('version', literal('19.2.18'));
33337
33375
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33338
33376
  definitionMap.set('type', meta.type.value);
33339
33377
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -33368,7 +33406,7 @@ function compileDeclareInjectableFromMetadata(meta) {
33368
33406
  function createInjectableDefinitionMap(meta) {
33369
33407
  const definitionMap = new DefinitionMap();
33370
33408
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
33371
- definitionMap.set('version', literal('19.2.16'));
33409
+ definitionMap.set('version', literal('19.2.18'));
33372
33410
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33373
33411
  definitionMap.set('type', meta.type.value);
33374
33412
  // Only generate providedIn property if it has a non-null value
@@ -33419,7 +33457,7 @@ function compileDeclareInjectorFromMetadata(meta) {
33419
33457
  function createInjectorDefinitionMap(meta) {
33420
33458
  const definitionMap = new DefinitionMap();
33421
33459
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
33422
- definitionMap.set('version', literal('19.2.16'));
33460
+ definitionMap.set('version', literal('19.2.18'));
33423
33461
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33424
33462
  definitionMap.set('type', meta.type.value);
33425
33463
  definitionMap.set('providers', meta.providers);
@@ -33452,7 +33490,7 @@ function createNgModuleDefinitionMap(meta) {
33452
33490
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
33453
33491
  }
33454
33492
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
33455
- definitionMap.set('version', literal('19.2.16'));
33493
+ definitionMap.set('version', literal('19.2.18'));
33456
33494
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33457
33495
  definitionMap.set('type', meta.type.value);
33458
33496
  // We only generate the keys in the metadata if the arrays contain values.
@@ -33503,7 +33541,7 @@ function compileDeclarePipeFromMetadata(meta) {
33503
33541
  function createPipeDefinitionMap(meta) {
33504
33542
  const definitionMap = new DefinitionMap();
33505
33543
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
33506
- definitionMap.set('version', literal('19.2.16'));
33544
+ definitionMap.set('version', literal('19.2.18'));
33507
33545
  definitionMap.set('ngImport', importExpr(Identifiers.core));
33508
33546
  // e.g. `type: MyPipe`
33509
33547
  definitionMap.set('type', meta.type.value);