@angular/compiler 21.1.0-next.0 → 21.1.0-next.2

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 v21.1.0-next.0
2
+ * @license Angular v21.1.0-next.2
3
3
  * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -352,6 +352,7 @@ var SecurityContext;
352
352
  SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
353
353
  SecurityContext[SecurityContext["URL"] = 4] = "URL";
354
354
  SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
355
+ SecurityContext[SecurityContext["ATTRIBUTE_NO_BINDING"] = 6] = "ATTRIBUTE_NO_BINDING";
355
356
  })(SecurityContext || (SecurityContext = {}));
356
357
  var MissingTranslationStrategy;
357
358
  (function (MissingTranslationStrategy) {
@@ -3019,6 +3020,10 @@ class Identifiers {
3019
3020
  name: 'ɵɵsanitizeStyle',
3020
3021
  moduleName: CORE
3021
3022
  };
3023
+ static validateAttribute = {
3024
+ name: 'ɵɵvalidateAttribute',
3025
+ moduleName: CORE
3026
+ };
3022
3027
  static sanitizeResourceUrl = {
3023
3028
  name: 'ɵɵsanitizeResourceUrl',
3024
3029
  moduleName: CORE
@@ -3043,10 +3048,6 @@ class Identifiers {
3043
3048
  name: 'ɵɵtrustConstantResourceUrl',
3044
3049
  moduleName: CORE
3045
3050
  };
3046
- static validateIframeAttribute = {
3047
- name: 'ɵɵvalidateIframeAttribute',
3048
- moduleName: CORE
3049
- };
3050
3051
  static inputDecorator = {
3051
3052
  name: 'Input',
3052
3053
  moduleName: CORE
@@ -17042,18 +17043,15 @@ function SECURITY_SCHEMA() {
17042
17043
  _SECURITY_SCHEMA = {};
17043
17044
  registerContext(SecurityContext.HTML, ['iframe|srcdoc', '*|innerHTML', '*|outerHTML']);
17044
17045
  registerContext(SecurityContext.STYLE, ['*|style']);
17045
- registerContext(SecurityContext.URL, ['*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href', 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action', 'img|src', 'input|src', 'ins|cite', 'q|cite', 'source|src', 'track|src', 'video|poster', 'video|src']);
17046
+ registerContext(SecurityContext.URL, ['*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href', 'a|xlink:href', 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action', 'img|src', 'input|src', 'ins|cite', 'q|cite', 'source|src', 'track|src', 'video|poster', 'video|src', 'annotation|href', 'annotation|xlink:href', 'annotation-xml|href', 'annotation-xml|xlink:href', 'maction|href', 'maction|xlink:href', 'malignmark|href', 'malignmark|xlink:href', 'math|href', 'math|xlink:href', 'mroot|href', 'mroot|xlink:href', 'msqrt|href', 'msqrt|xlink:href', 'merror|href', 'merror|xlink:href', 'mfrac|href', 'mfrac|xlink:href', 'mglyph|href', 'mglyph|xlink:href', 'msub|href', 'msub|xlink:href', 'msup|href', 'msup|xlink:href', 'msubsup|href', 'msubsup|xlink:href', 'mmultiscripts|href', 'mmultiscripts|xlink:href', 'mprescripts|href', 'mprescripts|xlink:href', 'mi|href', 'mi|xlink:href', 'mn|href', 'mn|xlink:href', 'mo|href', 'mo|xlink:href', 'mpadded|href', 'mpadded|xlink:href', 'mphantom|href', 'mphantom|xlink:href', 'mrow|href', 'mrow|xlink:href', 'ms|href', 'ms|xlink:href', 'mspace|href', 'mspace|xlink:href', 'mstyle|href', 'mstyle|xlink:href', 'mtable|href', 'mtable|xlink:href', 'mtd|href', 'mtd|xlink:href', 'mtr|href', 'mtr|xlink:href', 'mtext|href', 'mtext|xlink:href', 'mover|href', 'mover|xlink:href', 'munder|href', 'munder|xlink:href', 'munderover|href', 'munderover|xlink:href', 'semantics|href', 'semantics|xlink:href', 'none|href', 'none|xlink:href']);
17046
17047
  registerContext(SecurityContext.RESOURCE_URL, ['applet|code', 'applet|codebase', 'base|href', 'embed|src', 'frame|src', 'head|profile', 'html|manifest', 'iframe|src', 'link|href', 'media|src', 'object|codebase', 'object|data', 'script|src']);
17048
+ registerContext(SecurityContext.ATTRIBUTE_NO_BINDING, ['animate|attributeName', 'set|attributeName', 'animateMotion|attributeName', 'animateTransform|attributeName', 'unknown|attributeName', 'iframe|sandbox', 'iframe|allow', 'iframe|allowFullscreen', 'iframe|referrerPolicy', 'iframe|csp', 'iframe|fetchPriority', 'unknown|sandbox', 'unknown|allow', 'unknown|allowFullscreen', 'unknown|referrerPolicy', 'unknown|csp', 'unknown|fetchPriority']);
17047
17049
  }
17048
17050
  return _SECURITY_SCHEMA;
17049
17051
  }
17050
17052
  function registerContext(ctx, specs) {
17051
17053
  for (const spec of specs) _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
17052
17054
  }
17053
- const IFRAME_SECURITY_SENSITIVE_ATTRS = new Set(['sandbox', 'allow', 'allowfullscreen', 'referrerpolicy', 'csp', 'fetchpriority']);
17054
- function isIframeSecuritySensitiveAttr(attrName) {
17055
- return IFRAME_SECURITY_SENSITIVE_ATTRS.has(attrName.toLowerCase());
17056
- }
17057
17055
 
17058
17056
  class ElementSchemaRegistry {}
17059
17057
 
@@ -20617,11 +20615,10 @@ function processLexicalScope(unit, ops, savedView) {
20617
20615
  }
20618
20616
  }
20619
20617
 
20620
- const sanitizerFns = new Map([[SecurityContext.HTML, Identifiers.sanitizeHtml], [SecurityContext.RESOURCE_URL, Identifiers.sanitizeResourceUrl], [SecurityContext.SCRIPT, Identifiers.sanitizeScript], [SecurityContext.STYLE, Identifiers.sanitizeStyle], [SecurityContext.URL, Identifiers.sanitizeUrl]]);
20618
+ const sanitizerFns = new Map([[SecurityContext.HTML, Identifiers.sanitizeHtml], [SecurityContext.RESOURCE_URL, Identifiers.sanitizeResourceUrl], [SecurityContext.SCRIPT, Identifiers.sanitizeScript], [SecurityContext.STYLE, Identifiers.sanitizeStyle], [SecurityContext.URL, Identifiers.sanitizeUrl], [SecurityContext.ATTRIBUTE_NO_BINDING, Identifiers.validateAttribute]]);
20621
20619
  const trustedValueFns = new Map([[SecurityContext.HTML, Identifiers.trustConstantHtml], [SecurityContext.RESOURCE_URL, Identifiers.trustConstantResourceUrl]]);
20622
20620
  function resolveSanitizers(job) {
20623
20621
  for (const unit of job.units) {
20624
- const elements = createOpXrefMap(unit);
20625
20622
  if (job.kind !== CompilationJobKind.Host) {
20626
20623
  for (const op of unit.create) {
20627
20624
  if (op.kind === OpKind.ExtractedAttribute) {
@@ -20636,35 +20633,17 @@ function resolveSanitizers(job) {
20636
20633
  case OpKind.Attribute:
20637
20634
  case OpKind.DomProperty:
20638
20635
  let sanitizerFn = null;
20639
- if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.indexOf(SecurityContext.URL) > -1 && op.securityContext.indexOf(SecurityContext.RESOURCE_URL) > -1) {
20636
+ if (Array.isArray(op.securityContext) && op.securityContext.length === 2 && op.securityContext.includes(SecurityContext.URL) && op.securityContext.includes(SecurityContext.RESOURCE_URL)) {
20640
20637
  sanitizerFn = Identifiers.sanitizeUrlOrResourceUrl;
20641
20638
  } else {
20642
20639
  sanitizerFn = sanitizerFns.get(getOnlySecurityContext(op.securityContext)) ?? null;
20643
20640
  }
20644
20641
  op.sanitizer = sanitizerFn !== null ? importExpr(sanitizerFn) : null;
20645
- if (op.sanitizer === null) {
20646
- let isIframe = false;
20647
- if (job.kind === CompilationJobKind.Host || op.kind === OpKind.DomProperty) {
20648
- isIframe = true;
20649
- } else {
20650
- const ownerOp = elements.get(op.target);
20651
- if (ownerOp === undefined || !isElementOrContainerOp(ownerOp)) {
20652
- throw Error('Property should have an element-like owner');
20653
- }
20654
- isIframe = isIframeElement(ownerOp);
20655
- }
20656
- if (isIframe && isIframeSecuritySensitiveAttr(op.name)) {
20657
- op.sanitizer = importExpr(Identifiers.validateIframeAttribute);
20658
- }
20659
- }
20660
20642
  break;
20661
20643
  }
20662
20644
  }
20663
20645
  }
20664
20646
  }
20665
- function isIframeElement(op) {
20666
- return op.kind === OpKind.ElementStart && op.tag?.toLowerCase() === 'iframe';
20667
- }
20668
20647
  function getOnlySecurityContext(securityContext) {
20669
20648
  if (Array.isArray(securityContext)) {
20670
20649
  if (securityContext.length > 1) {
@@ -21821,6 +21800,10 @@ function ingestElement(unit, element) {
21821
21800
  ingestNodes(unit, element.children);
21822
21801
  const endOp = createElementEndOp(id, element.endSourceSpan ?? element.startSourceSpan);
21823
21802
  unit.create.push(endOp);
21803
+ const fieldInput = element.inputs.find(input => input.name === 'field' && input.type === BindingType.Property);
21804
+ if (fieldInput) {
21805
+ unit.create.push(createControlCreateOp(fieldInput.sourceSpan));
21806
+ }
21824
21807
  if (i18nBlockId !== null) {
21825
21808
  OpList.insertBefore(createI18nEndOp(i18nBlockId, element.endSourceSpan ?? element.startSourceSpan), endOp);
21826
21809
  }
@@ -22297,9 +22280,6 @@ function ingestElementBindings(unit, op, element) {
22297
22280
  console.error(`On component ${unit.job.componentName}, the binding ${input.name} is both an i18n attribute and a property. You may want to remove the property binding. This will become a compilation error in future versions of Angular.`);
22298
22281
  }
22299
22282
  bindings.push(createBindingOp(op.xref, BINDING_KINDS.get(input.type), input.name, convertAstWithInterpolation(unit.job, astOf(input.value), input.i18n), input.unit, input.securityContext, false, false, null, asMessage(input.i18n) ?? null, input.sourceSpan));
22300
- if (input.type === BindingType.Property && input.name === 'field') {
22301
- unit.create.push(createControlCreateOp(input.sourceSpan));
22302
- }
22303
22283
  }
22304
22284
  unit.create.push(bindings.filter(b => b?.kind === OpKind.ExtractedAttribute));
22305
22285
  unit.update.push(bindings.filter(b => b?.kind === OpKind.Binding));
@@ -22508,7 +22488,7 @@ function getQueryPredicate(query, constantPool) {
22508
22488
  }
22509
22489
  }
22510
22490
  }
22511
- function createQueryCreateCall(query, constantPool, queryTypeFns, prependParams) {
22491
+ function getQueryCreateParameters(query, constantPool, prependParams) {
22512
22492
  const parameters = [];
22513
22493
  if (prependParams !== undefined) {
22514
22494
  parameters.push(...prependParams);
@@ -22520,8 +22500,7 @@ function createQueryCreateCall(query, constantPool, queryTypeFns, prependParams)
22520
22500
  if (query.read) {
22521
22501
  parameters.push(query.read);
22522
22502
  }
22523
- const queryCreateFn = query.isSignal ? queryTypeFns.signalBased : queryTypeFns.nonSignal;
22524
- return importExpr(queryCreateFn).callFn(parameters);
22503
+ return parameters;
22525
22504
  }
22526
22505
  const queryAdvancePlaceholder = Symbol('queryAdvancePlaceholder');
22527
22506
  function collapseAdvanceStatements(statements) {
@@ -22549,12 +22528,17 @@ function createViewQueriesFunction(viewQueries, constantPool, name) {
22549
22528
  const createStatements = [];
22550
22529
  const updateStatements = [];
22551
22530
  const tempAllocator = temporaryAllocator(st => updateStatements.push(st), TEMPORARY_NAME);
22531
+ let viewQuerySignalCall = null;
22532
+ let viewQueryCall = null;
22552
22533
  viewQueries.forEach(query => {
22553
- const queryDefinitionCall = createQueryCreateCall(query, constantPool, {
22554
- signalBased: Identifiers.viewQuerySignal,
22555
- nonSignal: Identifiers.viewQuery
22556
- });
22557
- createStatements.push(queryDefinitionCall.toStmt());
22534
+ const params = getQueryCreateParameters(query, constantPool);
22535
+ if (query.isSignal) {
22536
+ viewQuerySignalCall ??= importExpr(Identifiers.viewQuerySignal);
22537
+ viewQuerySignalCall = viewQuerySignalCall.callFn(params);
22538
+ } else {
22539
+ viewQueryCall ??= importExpr(Identifiers.viewQuery);
22540
+ viewQueryCall = viewQueryCall.callFn(params);
22541
+ }
22558
22542
  if (query.isSignal) {
22559
22543
  updateStatements.push(queryAdvancePlaceholder);
22560
22544
  return;
@@ -22565,6 +22549,12 @@ function createViewQueriesFunction(viewQueries, constantPool, name) {
22565
22549
  const updateDirective = variable(CONTEXT_NAME).prop(query.propertyName).set(query.first ? temporary.prop('first') : temporary);
22566
22550
  updateStatements.push(refresh.and(updateDirective).toStmt());
22567
22551
  });
22552
+ if (viewQuerySignalCall !== null) {
22553
+ createStatements.push(new ExpressionStatement(viewQuerySignalCall));
22554
+ }
22555
+ if (viewQueryCall !== null) {
22556
+ createStatements.push(new ExpressionStatement(viewQueryCall));
22557
+ }
22568
22558
  const viewQueryFnName = name ? `${name}_Query` : null;
22569
22559
  return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], [renderFlagCheckIfStmt(1, createStatements), renderFlagCheckIfStmt(2, collapseAdvanceStatements(updateStatements))], INFERRED_TYPE, null, viewQueryFnName);
22570
22560
  }
@@ -22572,11 +22562,17 @@ function createContentQueriesFunction(queries, constantPool, name) {
22572
22562
  const createStatements = [];
22573
22563
  const updateStatements = [];
22574
22564
  const tempAllocator = temporaryAllocator(st => updateStatements.push(st), TEMPORARY_NAME);
22565
+ let contentQuerySignalCall = null;
22566
+ let contentQueryCall = null;
22575
22567
  for (const query of queries) {
22576
- createStatements.push(createQueryCreateCall(query, constantPool, {
22577
- nonSignal: Identifiers.contentQuery,
22578
- signalBased: Identifiers.contentQuerySignal
22579
- }, [variable('dirIndex')]).toStmt());
22568
+ const params = getQueryCreateParameters(query, constantPool, [variable('dirIndex')]);
22569
+ if (query.isSignal) {
22570
+ contentQuerySignalCall ??= importExpr(Identifiers.contentQuerySignal);
22571
+ contentQuerySignalCall = contentQuerySignalCall.callFn(params);
22572
+ } else {
22573
+ contentQueryCall ??= importExpr(Identifiers.contentQuery);
22574
+ contentQueryCall = contentQueryCall.callFn(params);
22575
+ }
22580
22576
  if (query.isSignal) {
22581
22577
  updateStatements.push(queryAdvancePlaceholder);
22582
22578
  continue;
@@ -22587,6 +22583,12 @@ function createContentQueriesFunction(queries, constantPool, name) {
22587
22583
  const updateDirective = variable(CONTEXT_NAME).prop(query.propertyName).set(query.first ? temporary.prop('first') : temporary);
22588
22584
  updateStatements.push(refresh.and(updateDirective).toStmt());
22589
22585
  }
22586
+ if (contentQuerySignalCall !== null) {
22587
+ createStatements.push(new ExpressionStatement(contentQuerySignalCall));
22588
+ }
22589
+ if (contentQueryCall !== null) {
22590
+ createStatements.push(new ExpressionStatement(contentQueryCall));
22591
+ }
22590
22592
  const contentQueriesFnName = name ? `${name}_ContentQueries` : null;
22591
22593
  return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null), new FnParam('dirIndex', null)], [renderFlagCheckIfStmt(1, createStatements), renderFlagCheckIfStmt(2, collapseAdvanceStatements(updateStatements))], INFERRED_TYPE, null, contentQueriesFnName);
22592
22594
  }
@@ -28044,7 +28046,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
28044
28046
  function compileDeclareClassMetadata(metadata) {
28045
28047
  const definitionMap = new DefinitionMap();
28046
28048
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
28047
- definitionMap.set('version', literal('21.1.0-next.0'));
28049
+ definitionMap.set('version', literal('21.1.0-next.2'));
28048
28050
  definitionMap.set('ngImport', importExpr(Identifiers.core));
28049
28051
  definitionMap.set('type', metadata.type);
28050
28052
  definitionMap.set('decorators', metadata.decorators);
@@ -28062,7 +28064,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
28062
28064
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
28063
28065
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
28064
28066
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
28065
- definitionMap.set('version', literal('21.1.0-next.0'));
28067
+ definitionMap.set('version', literal('21.1.0-next.2'));
28066
28068
  definitionMap.set('ngImport', importExpr(Identifiers.core));
28067
28069
  definitionMap.set('type', metadata.type);
28068
28070
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -28135,7 +28137,7 @@ function createDirectiveDefinitionMap(meta) {
28135
28137
  const definitionMap = new DefinitionMap();
28136
28138
  const minVersion = getMinimumVersionForPartialOutput(meta);
28137
28139
  definitionMap.set('minVersion', literal(minVersion));
28138
- definitionMap.set('version', literal('21.1.0-next.0'));
28140
+ definitionMap.set('version', literal('21.1.0-next.2'));
28139
28141
  definitionMap.set('type', meta.type.value);
28140
28142
  if (meta.isStandalone !== undefined) {
28141
28143
  definitionMap.set('isStandalone', literal(meta.isStandalone));
@@ -28467,7 +28469,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
28467
28469
  function compileDeclareFactoryFunction(meta) {
28468
28470
  const definitionMap = new DefinitionMap();
28469
28471
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
28470
- definitionMap.set('version', literal('21.1.0-next.0'));
28472
+ definitionMap.set('version', literal('21.1.0-next.2'));
28471
28473
  definitionMap.set('ngImport', importExpr(Identifiers.core));
28472
28474
  definitionMap.set('type', meta.type.value);
28473
28475
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -28493,7 +28495,7 @@ function compileDeclareInjectableFromMetadata(meta) {
28493
28495
  function createInjectableDefinitionMap(meta) {
28494
28496
  const definitionMap = new DefinitionMap();
28495
28497
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
28496
- definitionMap.set('version', literal('21.1.0-next.0'));
28498
+ definitionMap.set('version', literal('21.1.0-next.2'));
28497
28499
  definitionMap.set('ngImport', importExpr(Identifiers.core));
28498
28500
  definitionMap.set('type', meta.type.value);
28499
28501
  if (meta.providedIn !== undefined) {
@@ -28534,7 +28536,7 @@ function compileDeclareInjectorFromMetadata(meta) {
28534
28536
  function createInjectorDefinitionMap(meta) {
28535
28537
  const definitionMap = new DefinitionMap();
28536
28538
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
28537
- definitionMap.set('version', literal('21.1.0-next.0'));
28539
+ definitionMap.set('version', literal('21.1.0-next.2'));
28538
28540
  definitionMap.set('ngImport', importExpr(Identifiers.core));
28539
28541
  definitionMap.set('type', meta.type.value);
28540
28542
  definitionMap.set('providers', meta.providers);
@@ -28561,7 +28563,7 @@ function createNgModuleDefinitionMap(meta) {
28561
28563
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
28562
28564
  }
28563
28565
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
28564
- definitionMap.set('version', literal('21.1.0-next.0'));
28566
+ definitionMap.set('version', literal('21.1.0-next.2'));
28565
28567
  definitionMap.set('ngImport', importExpr(Identifiers.core));
28566
28568
  definitionMap.set('type', meta.type.value);
28567
28569
  if (meta.bootstrap.length > 0) {
@@ -28599,7 +28601,7 @@ function compileDeclarePipeFromMetadata(meta) {
28599
28601
  function createPipeDefinitionMap(meta) {
28600
28602
  const definitionMap = new DefinitionMap();
28601
28603
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
28602
- definitionMap.set('version', literal('21.1.0-next.0'));
28604
+ definitionMap.set('version', literal('21.1.0-next.2'));
28603
28605
  definitionMap.set('ngImport', importExpr(Identifiers.core));
28604
28606
  definitionMap.set('type', meta.type.value);
28605
28607
  if (meta.isStandalone !== undefined) {
@@ -28673,7 +28675,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
28673
28675
  return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
28674
28676
  }
28675
28677
 
28676
- const VERSION = new Version('21.1.0-next.0');
28678
+ const VERSION = new Version('21.1.0-next.2');
28677
28679
 
28678
28680
  publishFacade(_global);
28679
28681