@angular/compiler 21.1.0-next.0 → 21.1.0-next.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.
- package/fesm2022/compiler.mjs +23 -43
- package/fesm2022/compiler.mjs.map +1 -1
- package/package.json +1 -1
- package/types/compiler.d.ts +4 -3
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v21.1.0-next.
|
|
2
|
+
* @license Angular v21.1.0-next.1
|
|
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.
|
|
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));
|
|
@@ -28044,7 +28024,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
28044
28024
|
function compileDeclareClassMetadata(metadata) {
|
|
28045
28025
|
const definitionMap = new DefinitionMap();
|
|
28046
28026
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
28047
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28027
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28048
28028
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28049
28029
|
definitionMap.set('type', metadata.type);
|
|
28050
28030
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -28062,7 +28042,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
28062
28042
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
28063
28043
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
28064
28044
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
28065
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28045
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28066
28046
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28067
28047
|
definitionMap.set('type', metadata.type);
|
|
28068
28048
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -28135,7 +28115,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
28135
28115
|
const definitionMap = new DefinitionMap();
|
|
28136
28116
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
28137
28117
|
definitionMap.set('minVersion', literal(minVersion));
|
|
28138
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28118
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28139
28119
|
definitionMap.set('type', meta.type.value);
|
|
28140
28120
|
if (meta.isStandalone !== undefined) {
|
|
28141
28121
|
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
@@ -28467,7 +28447,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
28467
28447
|
function compileDeclareFactoryFunction(meta) {
|
|
28468
28448
|
const definitionMap = new DefinitionMap();
|
|
28469
28449
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
28470
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28450
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28471
28451
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28472
28452
|
definitionMap.set('type', meta.type.value);
|
|
28473
28453
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -28493,7 +28473,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
28493
28473
|
function createInjectableDefinitionMap(meta) {
|
|
28494
28474
|
const definitionMap = new DefinitionMap();
|
|
28495
28475
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
28496
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28476
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28497
28477
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28498
28478
|
definitionMap.set('type', meta.type.value);
|
|
28499
28479
|
if (meta.providedIn !== undefined) {
|
|
@@ -28534,7 +28514,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
28534
28514
|
function createInjectorDefinitionMap(meta) {
|
|
28535
28515
|
const definitionMap = new DefinitionMap();
|
|
28536
28516
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
28537
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28517
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28538
28518
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28539
28519
|
definitionMap.set('type', meta.type.value);
|
|
28540
28520
|
definitionMap.set('providers', meta.providers);
|
|
@@ -28561,7 +28541,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
28561
28541
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
28562
28542
|
}
|
|
28563
28543
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
28564
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28544
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28565
28545
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28566
28546
|
definitionMap.set('type', meta.type.value);
|
|
28567
28547
|
if (meta.bootstrap.length > 0) {
|
|
@@ -28599,7 +28579,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
28599
28579
|
function createPipeDefinitionMap(meta) {
|
|
28600
28580
|
const definitionMap = new DefinitionMap();
|
|
28601
28581
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
28602
|
-
definitionMap.set('version', literal('21.1.0-next.
|
|
28582
|
+
definitionMap.set('version', literal('21.1.0-next.1'));
|
|
28603
28583
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
28604
28584
|
definitionMap.set('type', meta.type.value);
|
|
28605
28585
|
if (meta.isStandalone !== undefined) {
|
|
@@ -28673,7 +28653,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
28673
28653
|
return new DeclareFunctionStmt(`${meta.className}_UpdateMetadata`, params, body, null, StmtModifier.Final);
|
|
28674
28654
|
}
|
|
28675
28655
|
|
|
28676
|
-
const VERSION = new Version('21.1.0-next.
|
|
28656
|
+
const VERSION = new Version('21.1.0-next.1');
|
|
28677
28657
|
|
|
28678
28658
|
publishFacade(_global);
|
|
28679
28659
|
|