@angular/core 21.0.0-next.5 → 21.0.0-next.7
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/{attribute.mjs → _attribute-chunk.mjs} +3 -3
- package/fesm2022/_attribute-chunk.mjs.map +1 -0
- package/fesm2022/{debug_node.mjs → _debug_node-chunk.mjs} +606 -92
- package/fesm2022/_debug_node-chunk.mjs.map +1 -0
- package/fesm2022/{effect.mjs → _effect-chunk.mjs} +4 -4
- package/fesm2022/_effect-chunk.mjs.map +1 -0
- package/fesm2022/{not_found.mjs → _not_found-chunk.mjs} +3 -3
- package/fesm2022/_not_found-chunk.mjs.map +1 -0
- package/fesm2022/{resource.mjs → _resource-chunk.mjs} +6 -6
- package/fesm2022/_resource-chunk.mjs.map +1 -0
- package/fesm2022/{root_effect_scheduler.mjs → _root_effect_scheduler-chunk.mjs} +6 -6
- package/fesm2022/_root_effect_scheduler-chunk.mjs.map +1 -0
- package/fesm2022/{signal.mjs → _signal-chunk.mjs} +10 -10
- package/fesm2022/_signal-chunk.mjs.map +1 -0
- package/fesm2022/{weak_ref.mjs → _weak_ref-chunk.mjs} +3 -3
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
- package/fesm2022/core.mjs +14 -14
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/{primitives/di.mjs → primitives-di.mjs} +4 -4
- package/fesm2022/primitives-di.mjs.map +1 -0
- package/fesm2022/{primitives/event-dispatch.mjs → primitives-event-dispatch.mjs} +4 -4
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
- package/fesm2022/primitives-signals.mjs +221 -0
- package/fesm2022/primitives-signals.mjs.map +1 -0
- package/fesm2022/rxjs-interop.mjs +7 -7
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +7 -7
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +12 -12
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +5 -5
- package/schematics/bundles/application-config-core.cjs +5 -5
- package/schematics/bundles/{apply_import_manager-Bx60Uquz.cjs → apply_import_manager-D_4NSuRa.cjs} +3 -3
- package/schematics/bundles/bootstrap-options-migration.cjs +5 -5
- package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
- package/schematics/bundles/{compiler_host-Aouk-n4F.cjs → compiler_host-C1KRWoxv.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +22 -21
- package/schematics/bundles/imports-DwPXlGFl.cjs +1 -1
- package/schematics/bundles/{index-Bb6iejCd.cjs → index-BFENxhdR.cjs} +32 -36
- package/schematics/bundles/{index-BZQb51Qf.cjs → index-DYqR8Lpq.cjs} +4 -6
- package/schematics/bundles/inject-migration.cjs +3 -3
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-By2ZtKls.cjs → migrate_ts_type_references-CemH7A8e.cjs} +5 -5
- package/schematics/bundles/{ng_component_template-B4M8mTyv.cjs → ng_component_template-AYs8YXuT.cjs} +2 -2
- package/schematics/bundles/ng_decorators-BI0uV7KI.cjs +1 -1
- package/schematics/bundles/ngclass-to-class-migration.cjs +7 -7
- package/schematics/bundles/ngstyle-to-style-migration.cjs +7 -7
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/{parse_html-7Wl_HDnw.cjs → parse_html-6-AB4O-A.cjs} +2 -2
- package/schematics/bundles/{project_paths-Dr2s3Pq3.cjs → project_paths-EiOrjlNS.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-DX9KHLn9.cjs → project_tsconfig_paths-BbVhi4fG.cjs} +156 -133
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/router-current-navigation.cjs +4 -4
- package/schematics/bundles/router-last-successful-navigation.cjs +4 -4
- package/schematics/bundles/self-closing-tags-migration.cjs +6 -6
- package/schematics/bundles/signal-input-migration.cjs +67 -8
- package/schematics/bundles/signal-queries-migration.cjs +7 -7
- package/schematics/bundles/signals.cjs +7 -7
- package/schematics/bundles/standalone-migration.cjs +106 -46
- package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
- package/schematics/migrations.json +1 -2
- package/{api.d.d.ts → types/_api-chunk.d.ts} +3 -3
- package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +4 -4
- package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +15 -8
- package/{effect.d.d.ts → types/_effect-chunk.d.ts} +3 -3
- package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +2 -2
- package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +15 -3
- package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +2 -2
- package/{index.d.ts → types/core.d.ts} +134 -16
- package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +2 -2
- package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +4 -4
- package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +7 -7
- package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +6 -6
- package/{testing/index.d.ts → types/testing.d.ts} +7 -7
- package/fesm2022/attribute.mjs.map +0 -1
- package/fesm2022/debug_node.mjs.map +0 -1
- package/fesm2022/effect.mjs.map +0 -1
- package/fesm2022/not_found.mjs.map +0 -1
- package/fesm2022/primitives/di.mjs.map +0 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
- package/fesm2022/primitives/signals.mjs +0 -88
- package/fesm2022/primitives/signals.mjs.map +0 -1
- package/fesm2022/resource.mjs.map +0 -1
- package/fesm2022/root_effect_scheduler.mjs.map +0 -1
- package/fesm2022/signal.mjs.map +0 -1
- package/fesm2022/weak_ref.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-next.
|
|
3
|
+
* @license Angular v21.0.0-next.7
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -2725,6 +2725,8 @@ class Identifiers {
|
|
|
2725
2725
|
static domProperty = { name: 'ɵɵdomProperty', moduleName: CORE };
|
|
2726
2726
|
static ariaProperty = { name: 'ɵɵariaProperty', moduleName: CORE };
|
|
2727
2727
|
static property = { name: 'ɵɵproperty', moduleName: CORE };
|
|
2728
|
+
static control = { name: 'ɵɵcontrol', moduleName: CORE };
|
|
2729
|
+
static controlCreate = { name: 'ɵɵcontrolCreate', moduleName: CORE };
|
|
2728
2730
|
static animationEnterListener = {
|
|
2729
2731
|
name: 'ɵɵanimateEnterListener',
|
|
2730
2732
|
moduleName: CORE,
|
|
@@ -6304,48 +6306,6 @@ function createFactoryFunction(type) {
|
|
|
6304
6306
|
return arrowFn([t], type.prop('ɵfac').callFn([variable(t.name)]));
|
|
6305
6307
|
}
|
|
6306
6308
|
|
|
6307
|
-
const UNUSABLE_INTERPOLATION_REGEXPS = [
|
|
6308
|
-
/@/, // control flow reserved symbol
|
|
6309
|
-
/^\s*$/, // empty
|
|
6310
|
-
/[<>]/, // html tag
|
|
6311
|
-
/^[{}]$/, // i18n expansion
|
|
6312
|
-
/&(#|[a-z])/i, // character reference,
|
|
6313
|
-
/^\/\//, // comment
|
|
6314
|
-
];
|
|
6315
|
-
function assertInterpolationSymbols(identifier, value) {
|
|
6316
|
-
if (value != null && !(Array.isArray(value) && value.length == 2)) {
|
|
6317
|
-
throw new Error(`Expected '${identifier}' to be an array, [start, end].`);
|
|
6318
|
-
}
|
|
6319
|
-
else if (value != null) {
|
|
6320
|
-
const start = value[0];
|
|
6321
|
-
const end = value[1];
|
|
6322
|
-
// Check for unusable interpolation symbols
|
|
6323
|
-
UNUSABLE_INTERPOLATION_REGEXPS.forEach((regexp) => {
|
|
6324
|
-
if (regexp.test(start) || regexp.test(end)) {
|
|
6325
|
-
throw new Error(`['${start}', '${end}'] contains unusable interpolation symbol.`);
|
|
6326
|
-
}
|
|
6327
|
-
});
|
|
6328
|
-
}
|
|
6329
|
-
}
|
|
6330
|
-
|
|
6331
|
-
class InterpolationConfig {
|
|
6332
|
-
start;
|
|
6333
|
-
end;
|
|
6334
|
-
static fromArray(markers) {
|
|
6335
|
-
if (!markers) {
|
|
6336
|
-
return DEFAULT_INTERPOLATION_CONFIG;
|
|
6337
|
-
}
|
|
6338
|
-
assertInterpolationSymbols('interpolation', markers);
|
|
6339
|
-
return new InterpolationConfig(markers[0], markers[1]);
|
|
6340
|
-
}
|
|
6341
|
-
constructor(start, end) {
|
|
6342
|
-
this.start = start;
|
|
6343
|
-
this.end = end;
|
|
6344
|
-
}
|
|
6345
|
-
}
|
|
6346
|
-
const DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}');
|
|
6347
|
-
const DEFAULT_CONTAINER_BLOCKS = new Set(['switch']);
|
|
6348
|
-
|
|
6349
6309
|
const $EOF = 0;
|
|
6350
6310
|
const $BSPACE = 8;
|
|
6351
6311
|
const $TAB = 9;
|
|
@@ -8699,6 +8659,17 @@ var OpKind;
|
|
|
8699
8659
|
* An operation to bind animation events to an element.
|
|
8700
8660
|
*/
|
|
8701
8661
|
OpKind[OpKind["AnimationListener"] = 56] = "AnimationListener";
|
|
8662
|
+
/**
|
|
8663
|
+
* An operation to bind an expression to a `control` property of an element.
|
|
8664
|
+
*/
|
|
8665
|
+
OpKind[OpKind["Control"] = 57] = "Control";
|
|
8666
|
+
/**
|
|
8667
|
+
* An operation to set up a corresponding {@link Control} operation.
|
|
8668
|
+
*
|
|
8669
|
+
* This is responsible for setting up event listeners on a native or custom form control when
|
|
8670
|
+
* bound to a specialized control directive.
|
|
8671
|
+
*/
|
|
8672
|
+
OpKind[OpKind["ControlCreate"] = 58] = "ControlCreate";
|
|
8702
8673
|
})(OpKind || (OpKind = {}));
|
|
8703
8674
|
/**
|
|
8704
8675
|
* Distinguishes different kinds of IR expressions.
|
|
@@ -9369,6 +9340,25 @@ function createStoreLetOp(target, declaredName, value, sourceSpan) {
|
|
|
9369
9340
|
...NEW_OP,
|
|
9370
9341
|
};
|
|
9371
9342
|
}
|
|
9343
|
+
/** Creates a {@link ControlOp}. */
|
|
9344
|
+
function createControlOp(op) {
|
|
9345
|
+
return {
|
|
9346
|
+
kind: OpKind.Control,
|
|
9347
|
+
target: op.target,
|
|
9348
|
+
expression: op.expression,
|
|
9349
|
+
bindingKind: op.bindingKind,
|
|
9350
|
+
securityContext: op.securityContext,
|
|
9351
|
+
sanitizer: null,
|
|
9352
|
+
isStructuralTemplateAttribute: op.isStructuralTemplateAttribute,
|
|
9353
|
+
templateKind: op.templateKind,
|
|
9354
|
+
i18nContext: op.i18nContext,
|
|
9355
|
+
i18nMessage: op.i18nMessage,
|
|
9356
|
+
sourceSpan: op.sourceSpan,
|
|
9357
|
+
...TRAIT_DEPENDS_ON_SLOT_CONTEXT,
|
|
9358
|
+
...TRAIT_CONSUMES_VARS,
|
|
9359
|
+
...NEW_OP,
|
|
9360
|
+
};
|
|
9361
|
+
}
|
|
9372
9362
|
|
|
9373
9363
|
/**
|
|
9374
9364
|
* Check whether a given `o.Expression` is a logical IR expression type.
|
|
@@ -10151,6 +10141,7 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10151
10141
|
case OpKind.Property:
|
|
10152
10142
|
case OpKind.DomProperty:
|
|
10153
10143
|
case OpKind.Attribute:
|
|
10144
|
+
case OpKind.Control:
|
|
10154
10145
|
if (op.expression instanceof Interpolation) {
|
|
10155
10146
|
transformExpressionsInInterpolation(op.expression, transform, flags);
|
|
10156
10147
|
}
|
|
@@ -10276,6 +10267,7 @@ function transformExpressionsInOp(op, transform, flags) {
|
|
|
10276
10267
|
case OpKind.SourceLocation:
|
|
10277
10268
|
case OpKind.ConditionalCreate:
|
|
10278
10269
|
case OpKind.ConditionalBranchCreate:
|
|
10270
|
+
case OpKind.ControlCreate:
|
|
10279
10271
|
// These operations contain no expressions.
|
|
10280
10272
|
break;
|
|
10281
10273
|
default:
|
|
@@ -11176,6 +11168,10 @@ function createSourceLocationOp(templatePath, locations) {
|
|
|
11176
11168
|
...NEW_OP,
|
|
11177
11169
|
};
|
|
11178
11170
|
}
|
|
11171
|
+
/** Creates a {@link ControlCreateOp}. */
|
|
11172
|
+
function createControlCreateOp(sourceSpan) {
|
|
11173
|
+
return { kind: OpKind.ControlCreate, sourceSpan, ...NEW_OP };
|
|
11174
|
+
}
|
|
11179
11175
|
|
|
11180
11176
|
function createDomPropertyOp(name, expression, bindingKind, i18nContext, securityContext, sourceSpan) {
|
|
11181
11177
|
return {
|
|
@@ -11654,6 +11650,14 @@ function extractAttributes(job) {
|
|
|
11654
11650
|
/* i18nMessage */ null, op.securityContext), lookupElement$3(elements, op.target));
|
|
11655
11651
|
}
|
|
11656
11652
|
break;
|
|
11653
|
+
case OpKind.Control:
|
|
11654
|
+
OpList.insertBefore(
|
|
11655
|
+
// Deliberately null i18nMessage value
|
|
11656
|
+
createExtractedAttributeOp(op.target, BindingKind.Property, null, 'control',
|
|
11657
|
+
/* expression */ null,
|
|
11658
|
+
/* i18nContext */ null,
|
|
11659
|
+
/* i18nMessage */ null, op.securityContext), lookupElement$3(elements, op.target));
|
|
11660
|
+
break;
|
|
11657
11661
|
case OpKind.TwoWayProperty:
|
|
11658
11662
|
OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.TwoWayProperty, null, op.name,
|
|
11659
11663
|
/* expression */ null,
|
|
@@ -11813,6 +11817,9 @@ function specializeBindings(job) {
|
|
|
11813
11817
|
else if (job.kind === CompilationJobKind.Host) {
|
|
11814
11818
|
OpList.replace(op, createDomPropertyOp(op.name, op.expression, op.bindingKind, op.i18nContext, op.securityContext, op.sourceSpan));
|
|
11815
11819
|
}
|
|
11820
|
+
else if (op.name === 'control') {
|
|
11821
|
+
OpList.replace(op, createControlOp(op));
|
|
11822
|
+
}
|
|
11816
11823
|
else {
|
|
11817
11824
|
OpList.replace(op, createPropertyOp(op.target, op.name, op.expression, op.bindingKind, op.securityContext, op.isStructuralTemplateAttribute, op.templateKind, op.i18nContext, op.i18nMessage, op.sourceSpan));
|
|
11818
11825
|
}
|
|
@@ -15936,12 +15943,15 @@ const SUPPORTED_BLOCKS = [
|
|
|
15936
15943
|
'@loading',
|
|
15937
15944
|
'@error',
|
|
15938
15945
|
];
|
|
15946
|
+
const INTERPOLATION = {
|
|
15947
|
+
start: '{{',
|
|
15948
|
+
end: '}}',
|
|
15949
|
+
};
|
|
15939
15950
|
// See https://www.w3.org/TR/html51/syntax.html#writing-html-documents
|
|
15940
15951
|
class _Tokenizer {
|
|
15941
15952
|
_getTagDefinition;
|
|
15942
15953
|
_cursor;
|
|
15943
15954
|
_tokenizeIcu;
|
|
15944
|
-
_interpolationConfig;
|
|
15945
15955
|
_leadingTriviaCodePoints;
|
|
15946
15956
|
_currentTokenStart = null;
|
|
15947
15957
|
_currentTokenType = null;
|
|
@@ -15964,7 +15974,6 @@ class _Tokenizer {
|
|
|
15964
15974
|
constructor(_file, _getTagDefinition, options) {
|
|
15965
15975
|
this._getTagDefinition = _getTagDefinition;
|
|
15966
15976
|
this._tokenizeIcu = options.tokenizeExpansionForms || false;
|
|
15967
|
-
this._interpolationConfig = options.interpolationConfig || DEFAULT_INTERPOLATION_CONFIG;
|
|
15968
15977
|
this._leadingTriviaCodePoints =
|
|
15969
15978
|
options.leadingTriviaChars && options.leadingTriviaChars.map((c) => c.codePointAt(0) || 0);
|
|
15970
15979
|
const range = options.range || {
|
|
@@ -16795,7 +16804,7 @@ class _Tokenizer {
|
|
|
16795
16804
|
const parts = [];
|
|
16796
16805
|
while (!endPredicate()) {
|
|
16797
16806
|
const current = this._cursor.clone();
|
|
16798
|
-
if (this.
|
|
16807
|
+
if (this._attemptStr(INTERPOLATION.start)) {
|
|
16799
16808
|
this._endToken([this._processCarriageReturns(parts.join(''))], current);
|
|
16800
16809
|
parts.length = 0;
|
|
16801
16810
|
this._consumeInterpolation(interpolationTokenType, current, endInterpolation);
|
|
@@ -16827,7 +16836,7 @@ class _Tokenizer {
|
|
|
16827
16836
|
_consumeInterpolation(interpolationTokenType, interpolationStart, prematureEndPredicate) {
|
|
16828
16837
|
const parts = [];
|
|
16829
16838
|
this._beginToken(interpolationTokenType, interpolationStart);
|
|
16830
|
-
parts.push(
|
|
16839
|
+
parts.push(INTERPOLATION.start);
|
|
16831
16840
|
// Find the end of the interpolation, ignoring content inside quotes.
|
|
16832
16841
|
const expressionStart = this._cursor.clone();
|
|
16833
16842
|
let inQuote = null;
|
|
@@ -16845,10 +16854,10 @@ class _Tokenizer {
|
|
|
16845
16854
|
return;
|
|
16846
16855
|
}
|
|
16847
16856
|
if (inQuote === null) {
|
|
16848
|
-
if (this._attemptStr(
|
|
16857
|
+
if (this._attemptStr(INTERPOLATION.end)) {
|
|
16849
16858
|
// We are not in a string, and we hit the end interpolation marker
|
|
16850
16859
|
parts.push(this._getProcessedChars(expressionStart, current));
|
|
16851
|
-
parts.push(
|
|
16860
|
+
parts.push(INTERPOLATION.end);
|
|
16852
16861
|
this._endToken(parts);
|
|
16853
16862
|
return;
|
|
16854
16863
|
}
|
|
@@ -16987,13 +16996,10 @@ class _Tokenizer {
|
|
|
16987
16996
|
if (this._cursor.peek() !== $LBRACE) {
|
|
16988
16997
|
return false;
|
|
16989
16998
|
}
|
|
16990
|
-
|
|
16991
|
-
|
|
16992
|
-
|
|
16993
|
-
|
|
16994
|
-
return !isInterpolation;
|
|
16995
|
-
}
|
|
16996
|
-
return true;
|
|
16999
|
+
const start = this._cursor.clone();
|
|
17000
|
+
const isInterpolation = this._attemptStr(INTERPOLATION.start);
|
|
17001
|
+
this._cursor = start;
|
|
17002
|
+
return !isInterpolation;
|
|
16997
17003
|
}
|
|
16998
17004
|
}
|
|
16999
17005
|
function isNotWhitespace(code) {
|
|
@@ -18313,9 +18319,6 @@ class Token {
|
|
|
18313
18319
|
isTemplateLiteralInterpolationStart() {
|
|
18314
18320
|
return this.isOperator('${');
|
|
18315
18321
|
}
|
|
18316
|
-
isTemplateLiteralInterpolationEnd() {
|
|
18317
|
-
return this.isOperator('}');
|
|
18318
|
-
}
|
|
18319
18322
|
toString() {
|
|
18320
18323
|
switch (this.type) {
|
|
18321
18324
|
case TokenType.Character:
|
|
@@ -18498,7 +18501,7 @@ class _Scanner {
|
|
|
18498
18501
|
this.advance();
|
|
18499
18502
|
const currentBrace = this.braceStack.pop();
|
|
18500
18503
|
if (currentBrace === 'interpolation') {
|
|
18501
|
-
this.tokens.push(
|
|
18504
|
+
this.tokens.push(newCharacterToken(start, this.index, $RBRACE));
|
|
18502
18505
|
return this.scanTemplateLiteralPart(this.index);
|
|
18503
18506
|
}
|
|
18504
18507
|
return newCharacterToken(start, this.index, code);
|
|
@@ -18862,17 +18865,17 @@ class Parser {
|
|
|
18862
18865
|
this._lexer = _lexer;
|
|
18863
18866
|
this._supportsDirectPipeReferences = _supportsDirectPipeReferences;
|
|
18864
18867
|
}
|
|
18865
|
-
parseAction(input, parseSourceSpan, absoluteOffset
|
|
18868
|
+
parseAction(input, parseSourceSpan, absoluteOffset) {
|
|
18866
18869
|
const errors = [];
|
|
18867
|
-
this._checkNoInterpolation(errors, input, parseSourceSpan
|
|
18870
|
+
this._checkNoInterpolation(errors, input, parseSourceSpan);
|
|
18868
18871
|
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18869
18872
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18870
18873
|
const ast = new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 1 /* ParseFlags.Action */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
18871
18874
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
18872
18875
|
}
|
|
18873
|
-
parseBinding(input, parseSourceSpan, absoluteOffset
|
|
18876
|
+
parseBinding(input, parseSourceSpan, absoluteOffset) {
|
|
18874
18877
|
const errors = [];
|
|
18875
|
-
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset,
|
|
18878
|
+
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset, errors);
|
|
18876
18879
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
18877
18880
|
}
|
|
18878
18881
|
checkSimpleExpression(ast) {
|
|
@@ -18881,17 +18884,17 @@ class Parser {
|
|
|
18881
18884
|
return checker.errors;
|
|
18882
18885
|
}
|
|
18883
18886
|
// Host bindings parsed here
|
|
18884
|
-
parseSimpleBinding(input, parseSourceSpan, absoluteOffset
|
|
18887
|
+
parseSimpleBinding(input, parseSourceSpan, absoluteOffset) {
|
|
18885
18888
|
const errors = [];
|
|
18886
|
-
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset,
|
|
18889
|
+
const ast = this._parseBindingAst(input, parseSourceSpan, absoluteOffset, errors);
|
|
18887
18890
|
const simplExpressionErrors = this.checkSimpleExpression(ast);
|
|
18888
18891
|
if (simplExpressionErrors.length > 0) {
|
|
18889
18892
|
errors.push(getParseError(`Host binding expression cannot contain ${simplExpressionErrors.join(' ')}`, input, '', parseSourceSpan));
|
|
18890
18893
|
}
|
|
18891
18894
|
return new ASTWithSource(ast, input, getLocation(parseSourceSpan), absoluteOffset, errors);
|
|
18892
18895
|
}
|
|
18893
|
-
_parseBindingAst(input, parseSourceSpan, absoluteOffset,
|
|
18894
|
-
this._checkNoInterpolation(errors, input, parseSourceSpan
|
|
18896
|
+
_parseBindingAst(input, parseSourceSpan, absoluteOffset, errors) {
|
|
18897
|
+
this._checkNoInterpolation(errors, input, parseSourceSpan);
|
|
18895
18898
|
const { stripped: sourceToLex } = this._stripComments(input);
|
|
18896
18899
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
18897
18900
|
return new _ParseAST(input, parseSourceSpan, absoluteOffset, tokens, 0 /* ParseFlags.None */, errors, 0, this._supportsDirectPipeReferences).parseChain();
|
|
@@ -18931,9 +18934,9 @@ class Parser {
|
|
|
18931
18934
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
18932
18935
|
});
|
|
18933
18936
|
}
|
|
18934
|
-
parseInterpolation(input, parseSourceSpan, absoluteOffset, interpolatedTokens
|
|
18937
|
+
parseInterpolation(input, parseSourceSpan, absoluteOffset, interpolatedTokens) {
|
|
18935
18938
|
const errors = [];
|
|
18936
|
-
const { strings, expressions, offsets } = this.splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens
|
|
18939
|
+
const { strings, expressions, offsets } = this.splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens);
|
|
18937
18940
|
if (expressions.length === 0)
|
|
18938
18941
|
return null;
|
|
18939
18942
|
const expressionNodes = [];
|
|
@@ -18980,7 +18983,7 @@ class Parser {
|
|
|
18980
18983
|
* `SplitInterpolation` with splits that look like
|
|
18981
18984
|
* <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
|
|
18982
18985
|
*/
|
|
18983
|
-
splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens
|
|
18986
|
+
splitInterpolation(input, parseSourceSpan, errors, interpolatedTokens) {
|
|
18984
18987
|
const strings = [];
|
|
18985
18988
|
const expressions = [];
|
|
18986
18989
|
const offsets = [];
|
|
@@ -18990,7 +18993,8 @@ class Parser {
|
|
|
18990
18993
|
let i = 0;
|
|
18991
18994
|
let atInterpolation = false;
|
|
18992
18995
|
let extendLastString = false;
|
|
18993
|
-
|
|
18996
|
+
const interpStart = '{{';
|
|
18997
|
+
const interpEnd = '}}';
|
|
18994
18998
|
while (i < input.length) {
|
|
18995
18999
|
if (!atInterpolation) {
|
|
18996
19000
|
// parse until starting {{
|
|
@@ -19069,24 +19073,24 @@ class Parser {
|
|
|
19069
19073
|
}
|
|
19070
19074
|
return null;
|
|
19071
19075
|
}
|
|
19072
|
-
_checkNoInterpolation(errors, input, parseSourceSpan
|
|
19076
|
+
_checkNoInterpolation(errors, input, parseSourceSpan) {
|
|
19073
19077
|
let startIndex = -1;
|
|
19074
19078
|
let endIndex = -1;
|
|
19075
19079
|
for (const charIndex of this._forEachUnquotedChar(input, 0)) {
|
|
19076
19080
|
if (startIndex === -1) {
|
|
19077
|
-
if (input.startsWith(
|
|
19081
|
+
if (input.startsWith('{{')) {
|
|
19078
19082
|
startIndex = charIndex;
|
|
19079
19083
|
}
|
|
19080
19084
|
}
|
|
19081
19085
|
else {
|
|
19082
|
-
endIndex = this._getInterpolationEndIndex(input,
|
|
19086
|
+
endIndex = this._getInterpolationEndIndex(input, '}}', charIndex);
|
|
19083
19087
|
if (endIndex > -1) {
|
|
19084
19088
|
break;
|
|
19085
19089
|
}
|
|
19086
19090
|
}
|
|
19087
19091
|
}
|
|
19088
19092
|
if (startIndex > -1 && endIndex > -1) {
|
|
19089
|
-
errors.push(getParseError(`Got interpolation (
|
|
19093
|
+
errors.push(getParseError(`Got interpolation ({{}}) where expression was expected`, input, `at column ${startIndex} in`, parseSourceSpan));
|
|
19090
19094
|
}
|
|
19091
19095
|
}
|
|
19092
19096
|
/**
|
|
@@ -20072,6 +20076,7 @@ class _ParseAST {
|
|
|
20072
20076
|
}
|
|
20073
20077
|
else if (token.isTemplateLiteralInterpolationStart()) {
|
|
20074
20078
|
this.advance();
|
|
20079
|
+
this.rbracesExpected++;
|
|
20075
20080
|
const expression = this.parsePipe();
|
|
20076
20081
|
if (expression instanceof EmptyExpr$1) {
|
|
20077
20082
|
this.error('Template literal interpolation cannot be empty');
|
|
@@ -20079,6 +20084,7 @@ class _ParseAST {
|
|
|
20079
20084
|
else {
|
|
20080
20085
|
expressions.push(expression);
|
|
20081
20086
|
}
|
|
20087
|
+
this.rbracesExpected--;
|
|
20082
20088
|
}
|
|
20083
20089
|
else {
|
|
20084
20090
|
this.advance();
|
|
@@ -21252,10 +21258,10 @@ class PlaceholderRegistry {
|
|
|
21252
21258
|
|
|
21253
21259
|
const _expParser = new Parser(new Lexer());
|
|
21254
21260
|
/**
|
|
21255
|
-
* Returns a function converting html nodes to an i18n Message
|
|
21261
|
+
* Returns a function converting html nodes to an i18n Message
|
|
21256
21262
|
*/
|
|
21257
|
-
function createI18nMessageFactory(
|
|
21258
|
-
const visitor = new _I18nVisitor(_expParser,
|
|
21263
|
+
function createI18nMessageFactory(containerBlocks, retainEmptyTokens, preserveExpressionWhitespace) {
|
|
21264
|
+
const visitor = new _I18nVisitor(_expParser, containerBlocks, retainEmptyTokens, preserveExpressionWhitespace);
|
|
21259
21265
|
return (nodes, meaning, description, customId, visitNodeFn) => visitor.toI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
21260
21266
|
}
|
|
21261
21267
|
function noopVisitNodeFn(_html, i18n) {
|
|
@@ -21263,13 +21269,11 @@ function noopVisitNodeFn(_html, i18n) {
|
|
|
21263
21269
|
}
|
|
21264
21270
|
class _I18nVisitor {
|
|
21265
21271
|
_expressionParser;
|
|
21266
|
-
_interpolationConfig;
|
|
21267
21272
|
_containerBlocks;
|
|
21268
21273
|
_retainEmptyTokens;
|
|
21269
21274
|
_preserveExpressionWhitespace;
|
|
21270
|
-
constructor(_expressionParser,
|
|
21275
|
+
constructor(_expressionParser, _containerBlocks, _retainEmptyTokens, _preserveExpressionWhitespace) {
|
|
21271
21276
|
this._expressionParser = _expressionParser;
|
|
21272
|
-
this._interpolationConfig = _interpolationConfig;
|
|
21273
21277
|
this._containerBlocks = _containerBlocks;
|
|
21274
21278
|
this._retainEmptyTokens = _retainEmptyTokens;
|
|
21275
21279
|
this._preserveExpressionWhitespace = _preserveExpressionWhitespace;
|
|
@@ -21491,7 +21495,7 @@ class _I18nVisitor {
|
|
|
21491
21495
|
const expression = token.parts[1];
|
|
21492
21496
|
const expr = this._expressionParser.parseBinding(expression,
|
|
21493
21497
|
/* location */ token.sourceSpan,
|
|
21494
|
-
/* absoluteOffset */ token.sourceSpan.start.offset
|
|
21498
|
+
/* absoluteOffset */ token.sourceSpan.start.offset);
|
|
21495
21499
|
return serialize(expr);
|
|
21496
21500
|
}
|
|
21497
21501
|
}
|
|
@@ -21556,6 +21560,8 @@ function extractPlaceholderName(input) {
|
|
|
21556
21560
|
return input.split(_CUSTOM_PH_EXP)[2];
|
|
21557
21561
|
}
|
|
21558
21562
|
|
|
21563
|
+
const DEFAULT_CONTAINER_BLOCKS = new Set(['switch']);
|
|
21564
|
+
|
|
21559
21565
|
/**
|
|
21560
21566
|
* Set of tagName|propertyName corresponding to Trusted Types sinks. Properties applying to all
|
|
21561
21567
|
* tags use '*'.
|
|
@@ -21617,7 +21623,6 @@ const setI18nRefs = (originalNodeMap) => {
|
|
|
21617
21623
|
* stored with other element's and attribute's information.
|
|
21618
21624
|
*/
|
|
21619
21625
|
class I18nMetaVisitor {
|
|
21620
|
-
interpolationConfig;
|
|
21621
21626
|
keepI18nAttrs;
|
|
21622
21627
|
enableI18nLegacyMessageIdFormat;
|
|
21623
21628
|
containerBlocks;
|
|
@@ -21626,7 +21631,7 @@ class I18nMetaVisitor {
|
|
|
21626
21631
|
// whether visited nodes contain i18n information
|
|
21627
21632
|
hasI18nMeta = false;
|
|
21628
21633
|
_errors = [];
|
|
21629
|
-
constructor(
|
|
21634
|
+
constructor(keepI18nAttrs = false, enableI18nLegacyMessageIdFormat = false, containerBlocks = DEFAULT_CONTAINER_BLOCKS, preserveSignificantWhitespace = true,
|
|
21630
21635
|
// When dropping significant whitespace we need to retain empty tokens or
|
|
21631
21636
|
// else we won't be able to reuse source spans because empty tokens would be
|
|
21632
21637
|
// removed and cause a mismatch. Unfortunately this still needs to be
|
|
@@ -21634,7 +21639,6 @@ class I18nMetaVisitor {
|
|
|
21634
21639
|
// sure the number of nodes don't change between parses, even when
|
|
21635
21640
|
// `preserveSignificantWhitespace` changes.
|
|
21636
21641
|
retainEmptyTokens = !preserveSignificantWhitespace) {
|
|
21637
|
-
this.interpolationConfig = interpolationConfig;
|
|
21638
21642
|
this.keepI18nAttrs = keepI18nAttrs;
|
|
21639
21643
|
this.enableI18nLegacyMessageIdFormat = enableI18nLegacyMessageIdFormat;
|
|
21640
21644
|
this.containerBlocks = containerBlocks;
|
|
@@ -21643,7 +21647,7 @@ class I18nMetaVisitor {
|
|
|
21643
21647
|
}
|
|
21644
21648
|
_generateI18nMessage(nodes, meta = '', visitNodeFn) {
|
|
21645
21649
|
const { meaning, description, customId } = this._parseMetadata(meta);
|
|
21646
|
-
const createI18nMessage = createI18nMessageFactory(this.
|
|
21650
|
+
const createI18nMessage = createI18nMessageFactory(this.containerBlocks, this.retainEmptyTokens,
|
|
21647
21651
|
/* preserveExpressionWhitespace */ this.preserveSignificantWhitespace);
|
|
21648
21652
|
const message = createI18nMessage(nodes, meaning, description, customId, visitNodeFn);
|
|
21649
21653
|
this._setMessageId(message, meta);
|
|
@@ -23794,6 +23798,22 @@ function ariaProperty(name, expression, sourceSpan) {
|
|
|
23794
23798
|
function property(name, expression, sanitizer, sourceSpan) {
|
|
23795
23799
|
return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
|
|
23796
23800
|
}
|
|
23801
|
+
function control(expression, sanitizer, sourceSpan) {
|
|
23802
|
+
const args = [];
|
|
23803
|
+
if (expression instanceof Interpolation) {
|
|
23804
|
+
args.push(interpolationToExpression(expression, sourceSpan));
|
|
23805
|
+
}
|
|
23806
|
+
else {
|
|
23807
|
+
args.push(expression);
|
|
23808
|
+
}
|
|
23809
|
+
if (sanitizer !== null) {
|
|
23810
|
+
args.push(sanitizer);
|
|
23811
|
+
}
|
|
23812
|
+
return call(Identifiers.control, args, sourceSpan);
|
|
23813
|
+
}
|
|
23814
|
+
function controlCreate(sourceSpan) {
|
|
23815
|
+
return call(Identifiers.controlCreate, [], sourceSpan);
|
|
23816
|
+
}
|
|
23797
23817
|
function twoWayProperty(name, expression, sanitizer, sourceSpan) {
|
|
23798
23818
|
const args = [literal(name), expression];
|
|
23799
23819
|
if (sanitizer !== null) {
|
|
@@ -24354,6 +24374,9 @@ function reifyCreateOperations(unit, ops) {
|
|
|
24354
24374
|
}));
|
|
24355
24375
|
OpList.replace(op, attachSourceLocation(op.templatePath, locationsLiteral));
|
|
24356
24376
|
break;
|
|
24377
|
+
case OpKind.ControlCreate:
|
|
24378
|
+
OpList.replace(op, controlCreate(op.sourceSpan));
|
|
24379
|
+
break;
|
|
24357
24380
|
case OpKind.Statement:
|
|
24358
24381
|
// Pass statement operations directly through.
|
|
24359
24382
|
break;
|
|
@@ -24376,6 +24399,9 @@ function reifyUpdateOperations(unit, ops) {
|
|
|
24376
24399
|
? reifyDomProperty(op)
|
|
24377
24400
|
: reifyProperty(op));
|
|
24378
24401
|
break;
|
|
24402
|
+
case OpKind.Control:
|
|
24403
|
+
OpList.replace(op, reifyControl(op));
|
|
24404
|
+
break;
|
|
24379
24405
|
case OpKind.TwoWayProperty:
|
|
24380
24406
|
OpList.replace(op, twoWayProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
|
|
24381
24407
|
break;
|
|
@@ -24471,6 +24497,9 @@ function reifyProperty(op) {
|
|
|
24471
24497
|
? ariaProperty(op.name, op.expression, op.sourceSpan)
|
|
24472
24498
|
: property(op.name, op.expression, op.sanitizer, op.sourceSpan);
|
|
24473
24499
|
}
|
|
24500
|
+
function reifyControl(op) {
|
|
24501
|
+
return control(op.expression, op.sanitizer, op.sourceSpan);
|
|
24502
|
+
}
|
|
24474
24503
|
function reifyIrExpression(expr) {
|
|
24475
24504
|
if (!isIrExpression(expr)) {
|
|
24476
24505
|
return expr;
|
|
@@ -25983,6 +26012,7 @@ function varsUsedByOp(op) {
|
|
|
25983
26012
|
return slots;
|
|
25984
26013
|
case OpKind.Property:
|
|
25985
26014
|
case OpKind.DomProperty:
|
|
26015
|
+
case OpKind.Control:
|
|
25986
26016
|
slots = 1;
|
|
25987
26017
|
// We need to assign a slot even for singleton interpolations, because the
|
|
25988
26018
|
// runtime needs to store both the raw value and the stringified one.
|
|
@@ -27450,6 +27480,11 @@ function ingestElementBindings(unit, op, element) {
|
|
|
27450
27480
|
}
|
|
27451
27481
|
// All dynamic bindings (both attribute and property bindings).
|
|
27452
27482
|
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));
|
|
27483
|
+
// If the input name is 'control', this could be a form control binding which requires a
|
|
27484
|
+
// `ControlCreateOp` to properly initialize.
|
|
27485
|
+
if (input.type === exports.BindingType.Property && input.name === 'control') {
|
|
27486
|
+
unit.create.push(createControlCreateOp(input.sourceSpan));
|
|
27487
|
+
}
|
|
27453
27488
|
}
|
|
27454
27489
|
unit.create.push(bindings.filter((b) => b?.kind === OpKind.ExtractedAttribute));
|
|
27455
27490
|
unit.update.push(bindings.filter((b) => b?.kind === OpKind.Binding));
|
|
@@ -27964,18 +27999,13 @@ const LEGACY_ANIMATE_PROP_PREFIX = 'animate-';
|
|
|
27964
27999
|
*/
|
|
27965
28000
|
class BindingParser {
|
|
27966
28001
|
_exprParser;
|
|
27967
|
-
_interpolationConfig;
|
|
27968
28002
|
_schemaRegistry;
|
|
27969
28003
|
errors;
|
|
27970
|
-
constructor(_exprParser,
|
|
28004
|
+
constructor(_exprParser, _schemaRegistry, errors) {
|
|
27971
28005
|
this._exprParser = _exprParser;
|
|
27972
|
-
this._interpolationConfig = _interpolationConfig;
|
|
27973
28006
|
this._schemaRegistry = _schemaRegistry;
|
|
27974
28007
|
this.errors = errors;
|
|
27975
28008
|
}
|
|
27976
|
-
get interpolationConfig() {
|
|
27977
|
-
return this._interpolationConfig;
|
|
27978
|
-
}
|
|
27979
28009
|
createBoundHostProperties(properties, sourceSpan) {
|
|
27980
28010
|
const boundProps = [];
|
|
27981
28011
|
for (const propName of Object.keys(properties)) {
|
|
@@ -28019,7 +28049,7 @@ class BindingParser {
|
|
|
28019
28049
|
parseInterpolation(value, sourceSpan, interpolatedTokens) {
|
|
28020
28050
|
const absoluteOffset = sourceSpan.fullStart.offset;
|
|
28021
28051
|
try {
|
|
28022
|
-
const ast = this._exprParser.parseInterpolation(value, sourceSpan, absoluteOffset, interpolatedTokens
|
|
28052
|
+
const ast = this._exprParser.parseInterpolation(value, sourceSpan, absoluteOffset, interpolatedTokens);
|
|
28023
28053
|
if (ast) {
|
|
28024
28054
|
this.errors.push(...ast.errors);
|
|
28025
28055
|
}
|
|
@@ -28191,8 +28221,8 @@ class BindingParser {
|
|
|
28191
28221
|
parseBinding(value, isHostBinding, sourceSpan, absoluteOffset) {
|
|
28192
28222
|
try {
|
|
28193
28223
|
const ast = isHostBinding
|
|
28194
|
-
? this._exprParser.parseSimpleBinding(value, sourceSpan, absoluteOffset
|
|
28195
|
-
: this._exprParser.parseBinding(value, sourceSpan, absoluteOffset
|
|
28224
|
+
? this._exprParser.parseSimpleBinding(value, sourceSpan, absoluteOffset)
|
|
28225
|
+
: this._exprParser.parseBinding(value, sourceSpan, absoluteOffset);
|
|
28196
28226
|
if (ast) {
|
|
28197
28227
|
this.errors.push(...ast.errors);
|
|
28198
28228
|
}
|
|
@@ -28327,7 +28357,7 @@ class BindingParser {
|
|
|
28327
28357
|
_parseAction(value, sourceSpan) {
|
|
28328
28358
|
const absoluteOffset = sourceSpan && sourceSpan.start ? sourceSpan.start.offset : 0;
|
|
28329
28359
|
try {
|
|
28330
|
-
const ast = this._exprParser.parseAction(value, sourceSpan, absoluteOffset
|
|
28360
|
+
const ast = this._exprParser.parseAction(value, sourceSpan, absoluteOffset);
|
|
28331
28361
|
if (ast) {
|
|
28332
28362
|
this.errors.push(...ast.errors);
|
|
28333
28363
|
}
|
|
@@ -29593,6 +29623,13 @@ class HtmlAstToIvyAst {
|
|
|
29593
29623
|
}
|
|
29594
29624
|
else {
|
|
29595
29625
|
const attrs = this.categorizePropertyAttributes(element.name, parsedProperties, i18nAttrsMeta);
|
|
29626
|
+
if (element.name === 'ng-container') {
|
|
29627
|
+
for (const bound of attrs.bound) {
|
|
29628
|
+
if (bound.type === exports.BindingType.Attribute) {
|
|
29629
|
+
this.reportError(`Attribute bindings are not supported on ng-container. Use property bindings instead.`, bound.sourceSpan);
|
|
29630
|
+
}
|
|
29631
|
+
}
|
|
29632
|
+
}
|
|
29596
29633
|
parsedElement = new Element$1(element.name, attributes, attrs.bound, boundEvents, directives, children, references, element.isSelfClosing, element.sourceSpan, element.startSourceSpan, element.endSourceSpan, element.isVoid, element.i18n);
|
|
29597
29634
|
}
|
|
29598
29635
|
if (elementHasInlineTemplate) {
|
|
@@ -30177,9 +30214,9 @@ const LEADING_TRIVIA_CHARS = [' ', '\n', '\r', '\t'];
|
|
|
30177
30214
|
* @param options options to modify how the template is parsed
|
|
30178
30215
|
*/
|
|
30179
30216
|
function parseTemplate(template, templateUrl, options = {}) {
|
|
30180
|
-
const {
|
|
30217
|
+
const { preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
|
30181
30218
|
const selectorlessEnabled = options.enableSelectorless ?? false;
|
|
30182
|
-
const bindingParser = makeBindingParser(
|
|
30219
|
+
const bindingParser = makeBindingParser(selectorlessEnabled);
|
|
30183
30220
|
const htmlParser = new HtmlParser();
|
|
30184
30221
|
const parseResult = htmlParser.parse(template, templateUrl, {
|
|
30185
30222
|
leadingTriviaChars: LEADING_TRIVIA_CHARS,
|
|
@@ -30193,7 +30230,6 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30193
30230
|
parseResult.errors &&
|
|
30194
30231
|
parseResult.errors.length > 0) {
|
|
30195
30232
|
const parsedTemplate = {
|
|
30196
|
-
interpolationConfig,
|
|
30197
30233
|
preserveWhitespaces,
|
|
30198
30234
|
errors: parseResult.errors,
|
|
30199
30235
|
nodes: [],
|
|
@@ -30216,7 +30252,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30216
30252
|
// before we run whitespace removal process, because existing i18n
|
|
30217
30253
|
// extraction process (ng extract-i18n) relies on a raw content to generate
|
|
30218
30254
|
// message ids
|
|
30219
|
-
const i18nMetaVisitor = new I18nMetaVisitor(
|
|
30255
|
+
const i18nMetaVisitor = new I18nMetaVisitor(
|
|
30220
30256
|
/* keepI18nAttrs */ !preserveWhitespaces, enableI18nLegacyMessageIdFormat,
|
|
30221
30257
|
/* containerBlocks */ undefined, options.preserveSignificantWhitespace, retainEmptyTokens);
|
|
30222
30258
|
const i18nMetaResult = i18nMetaVisitor.visitAllWithErrors(rootNodes);
|
|
@@ -30224,7 +30260,6 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30224
30260
|
i18nMetaResult.errors &&
|
|
30225
30261
|
i18nMetaResult.errors.length > 0) {
|
|
30226
30262
|
const parsedTemplate = {
|
|
30227
|
-
interpolationConfig,
|
|
30228
30263
|
preserveWhitespaces,
|
|
30229
30264
|
errors: i18nMetaResult.errors,
|
|
30230
30265
|
nodes: [],
|
|
@@ -30259,7 +30294,7 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30259
30294
|
// template. During this pass i18n IDs generated at the first pass will be preserved, so we can
|
|
30260
30295
|
// mimic existing extraction process (ng extract-i18n)
|
|
30261
30296
|
if (i18nMetaVisitor.hasI18nMeta) {
|
|
30262
|
-
rootNodes = visitAll(new I18nMetaVisitor(
|
|
30297
|
+
rootNodes = visitAll(new I18nMetaVisitor(
|
|
30263
30298
|
/* keepI18nAttrs */ false,
|
|
30264
30299
|
/* enableI18nLegacyMessageIdFormat */ undefined,
|
|
30265
30300
|
/* containerBlocks */ undefined,
|
|
@@ -30269,7 +30304,6 @@ function parseTemplate(template, templateUrl, options = {}) {
|
|
|
30269
30304
|
const { nodes, errors, styleUrls, styles, ngContentSelectors, commentNodes } = htmlAstToRender3Ast(rootNodes, bindingParser, { collectCommentNodes: !!options.collectCommentNodes });
|
|
30270
30305
|
errors.push(...parseResult.errors, ...i18nMetaResult.errors);
|
|
30271
30306
|
const parsedTemplate = {
|
|
30272
|
-
interpolationConfig,
|
|
30273
30307
|
preserveWhitespaces,
|
|
30274
30308
|
errors: errors.length > 0 ? errors : null,
|
|
30275
30309
|
nodes,
|
|
@@ -30286,8 +30320,8 @@ const elementRegistry = new DomElementSchemaRegistry();
|
|
|
30286
30320
|
/**
|
|
30287
30321
|
* Construct a `BindingParser` with a default configuration.
|
|
30288
30322
|
*/
|
|
30289
|
-
function makeBindingParser(
|
|
30290
|
-
return new BindingParser(new Parser(new Lexer(), selectorlessEnabled),
|
|
30323
|
+
function makeBindingParser(selectorlessEnabled = false) {
|
|
30324
|
+
return new BindingParser(new Parser(new Lexer(), selectorlessEnabled), elementRegistry, []);
|
|
30291
30325
|
}
|
|
30292
30326
|
|
|
30293
30327
|
const COMPONENT_VARIABLE = '%COMP%';
|
|
@@ -30406,7 +30440,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
30406
30440
|
: TemplateCompilationMode.Full;
|
|
30407
30441
|
// First the template is ingested into IR:
|
|
30408
30442
|
const tpl = ingestComponent(meta.name, meta.template.nodes, constantPool, compilationMode, meta.relativeContextFilePath, meta.i18nUseExternalIds, meta.defer, allDeferrableDepsFn, meta.relativeTemplatePath, getTemplateSourceLocationsEnabled());
|
|
30409
|
-
// Then the IR is transformed to prepare it for
|
|
30443
|
+
// Then the IR is transformed to prepare it for code generation.
|
|
30410
30444
|
transform(tpl, CompilationJobKind.Tmpl);
|
|
30411
30445
|
// Finally we emit the template function:
|
|
30412
30446
|
const templateFn = emitTemplateFn(tpl, constantPool);
|
|
@@ -31927,7 +31961,7 @@ class CompilerFacadeImpl {
|
|
|
31927
31961
|
}
|
|
31928
31962
|
compileComponent(angularCoreEnv, sourceMapUrl, facade) {
|
|
31929
31963
|
// Parse the template and check for errors.
|
|
31930
|
-
const { template,
|
|
31964
|
+
const { template, defer } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, undefined);
|
|
31931
31965
|
// Compile the component metadata, including template, into an expression.
|
|
31932
31966
|
const meta = {
|
|
31933
31967
|
...facade,
|
|
@@ -31939,7 +31973,6 @@ class CompilerFacadeImpl {
|
|
|
31939
31973
|
defer,
|
|
31940
31974
|
styles: [...facade.styles, ...template.styles],
|
|
31941
31975
|
encapsulation: facade.encapsulation,
|
|
31942
|
-
interpolation,
|
|
31943
31976
|
changeDetection: facade.changeDetection ?? null,
|
|
31944
31977
|
animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null,
|
|
31945
31978
|
viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) : null,
|
|
@@ -31957,7 +31990,7 @@ class CompilerFacadeImpl {
|
|
|
31957
31990
|
}
|
|
31958
31991
|
compileComponentFromMeta(angularCoreEnv, sourceMapUrl, meta) {
|
|
31959
31992
|
const constantPool = new ConstantPool();
|
|
31960
|
-
const bindingParser = makeBindingParser(
|
|
31993
|
+
const bindingParser = makeBindingParser();
|
|
31961
31994
|
const res = compileComponentFromMetadata(meta, constantPool, bindingParser);
|
|
31962
31995
|
return this.jitExpression(res.expression, angularCoreEnv, sourceMapUrl, constantPool.statements);
|
|
31963
31996
|
}
|
|
@@ -32163,7 +32196,7 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
32163
32196
|
return result;
|
|
32164
32197
|
}
|
|
32165
32198
|
function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
|
|
32166
|
-
const { template,
|
|
32199
|
+
const { template, defer } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, decl.preserveWhitespaces ?? false, decl.deferBlockDependencies);
|
|
32167
32200
|
const declarations = [];
|
|
32168
32201
|
if (decl.dependencies) {
|
|
32169
32202
|
for (const innerDep of decl.dependencies) {
|
|
@@ -32198,7 +32231,6 @@ function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMap
|
|
|
32198
32231
|
defer,
|
|
32199
32232
|
changeDetection: decl.changeDetection ?? exports.ChangeDetectionStrategy.Default,
|
|
32200
32233
|
encapsulation: decl.encapsulation ?? exports.ViewEncapsulation.Emulated,
|
|
32201
|
-
interpolation,
|
|
32202
32234
|
declarationListEmitMode: 2 /* DeclarationListEmitMode.ClosureResolved */,
|
|
32203
32235
|
relativeContextFilePath: '',
|
|
32204
32236
|
i18nUseExternalIds: true,
|
|
@@ -32242,15 +32274,9 @@ function convertPipeDeclarationToMetadata(pipe) {
|
|
|
32242
32274
|
type: new WrappedNodeExpr(pipe.type),
|
|
32243
32275
|
};
|
|
32244
32276
|
}
|
|
32245
|
-
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
32246
|
-
const interpolationConfig = interpolation
|
|
32247
|
-
? InterpolationConfig.fromArray(interpolation)
|
|
32248
|
-
: DEFAULT_INTERPOLATION_CONFIG;
|
|
32277
|
+
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, deferBlockDependencies) {
|
|
32249
32278
|
// Parse the template and check for errors.
|
|
32250
|
-
const parsed = parseTemplate(template, sourceMapUrl, {
|
|
32251
|
-
preserveWhitespaces,
|
|
32252
|
-
interpolationConfig,
|
|
32253
|
-
});
|
|
32279
|
+
const parsed = parseTemplate(template, sourceMapUrl, { preserveWhitespaces });
|
|
32254
32280
|
if (parsed.errors !== null) {
|
|
32255
32281
|
const errors = parsed.errors.map((err) => err.toString()).join(', ');
|
|
32256
32282
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
@@ -32259,7 +32285,6 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
32259
32285
|
const boundTarget = binder.bind({ template: parsed.nodes });
|
|
32260
32286
|
return {
|
|
32261
32287
|
template: parsed,
|
|
32262
|
-
interpolation: interpolationConfig,
|
|
32263
32288
|
defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies),
|
|
32264
32289
|
};
|
|
32265
32290
|
}
|
|
@@ -32483,9 +32508,9 @@ let i18nCommentsWarned = false;
|
|
|
32483
32508
|
/**
|
|
32484
32509
|
* Extract translatable messages from an html AST
|
|
32485
32510
|
*/
|
|
32486
|
-
function extractMessages(nodes,
|
|
32511
|
+
function extractMessages(nodes, implicitTags, implicitAttrs, preserveSignificantWhitespace) {
|
|
32487
32512
|
const visitor = new _Visitor(implicitTags, implicitAttrs, preserveSignificantWhitespace);
|
|
32488
|
-
return visitor.extract(nodes
|
|
32513
|
+
return visitor.extract(nodes);
|
|
32489
32514
|
}
|
|
32490
32515
|
class ExtractionResult {
|
|
32491
32516
|
messages;
|
|
@@ -32540,8 +32565,8 @@ class _Visitor {
|
|
|
32540
32565
|
/**
|
|
32541
32566
|
* Extracts the messages from the tree
|
|
32542
32567
|
*/
|
|
32543
|
-
extract(nodes
|
|
32544
|
-
this._init(_VisitorMode.Extract
|
|
32568
|
+
extract(nodes) {
|
|
32569
|
+
this._init(_VisitorMode.Extract);
|
|
32545
32570
|
nodes.forEach((node) => node.visit(this, null));
|
|
32546
32571
|
if (this._inI18nBlock) {
|
|
32547
32572
|
this._reportError(nodes[nodes.length - 1], 'Unclosed block');
|
|
@@ -32551,8 +32576,8 @@ class _Visitor {
|
|
|
32551
32576
|
/**
|
|
32552
32577
|
* Returns a tree where all translatable nodes are translated
|
|
32553
32578
|
*/
|
|
32554
|
-
merge(nodes, translations
|
|
32555
|
-
this._init(_VisitorMode.Merge
|
|
32579
|
+
merge(nodes, translations) {
|
|
32580
|
+
this._init(_VisitorMode.Merge);
|
|
32556
32581
|
this._translations = translations;
|
|
32557
32582
|
// Construct a single fake root element
|
|
32558
32583
|
const wrapper = new Element('wrapper', [], [], nodes, false, undefined, undefined, undefined, false);
|
|
@@ -32657,7 +32682,7 @@ class _Visitor {
|
|
|
32657
32682
|
visitDirective(directive, context) {
|
|
32658
32683
|
throw new Error('unreachable code');
|
|
32659
32684
|
}
|
|
32660
|
-
_init(mode
|
|
32685
|
+
_init(mode) {
|
|
32661
32686
|
this._mode = mode;
|
|
32662
32687
|
this._inI18nBlock = false;
|
|
32663
32688
|
this._inI18nNode = false;
|
|
@@ -32667,7 +32692,7 @@ class _Visitor {
|
|
|
32667
32692
|
this._errors = [];
|
|
32668
32693
|
this._messages = [];
|
|
32669
32694
|
this._inImplicitNode = false;
|
|
32670
|
-
this._createI18nMessage = createI18nMessageFactory(
|
|
32695
|
+
this._createI18nMessage = createI18nMessageFactory(DEFAULT_CONTAINER_BLOCKS,
|
|
32671
32696
|
// When dropping significant whitespace we need to retain whitespace tokens or
|
|
32672
32697
|
// else we won't be able to reuse source spans because empty tokens would be
|
|
32673
32698
|
// removed and cause a mismatch.
|
|
@@ -32964,7 +32989,7 @@ function isAttrNode(ast) {
|
|
|
32964
32989
|
* @description
|
|
32965
32990
|
* Entry point for all public APIs of the compiler package.
|
|
32966
32991
|
*/
|
|
32967
|
-
const VERSION = new Version('21.0.0-next.
|
|
32992
|
+
const VERSION = new Version('21.0.0-next.7');
|
|
32968
32993
|
|
|
32969
32994
|
//////////////////////////////////////
|
|
32970
32995
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|
|
@@ -34027,7 +34052,7 @@ class NodeJSPathManipulation {
|
|
|
34027
34052
|
// G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
|
|
34028
34053
|
// CommonJS/ESM interop for determining the current file name and containing dir.
|
|
34029
34054
|
const isCommonJS = typeof __filename !== 'undefined';
|
|
34030
|
-
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('project_tsconfig_paths-
|
|
34055
|
+
const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('project_tsconfig_paths-BbVhi4fG.cjs', document.baseURI).href));
|
|
34031
34056
|
// Note, when this code loads in the browser, `url` may be an empty `{}` due to the Closure shims.
|
|
34032
34057
|
const currentFileName = isCommonJS
|
|
34033
34058
|
? __filename
|
|
@@ -51042,7 +51067,6 @@ exports.Conditional = Conditional;
|
|
|
51042
51067
|
exports.ConstantPool = ConstantPool;
|
|
51043
51068
|
exports.Container = Container;
|
|
51044
51069
|
exports.CssSelector = CssSelector;
|
|
51045
|
-
exports.DEFAULT_INTERPOLATION_CONFIG = DEFAULT_INTERPOLATION_CONFIG;
|
|
51046
51070
|
exports.DYNAMIC_TYPE = DYNAMIC_TYPE;
|
|
51047
51071
|
exports.Declaration = Declaration;
|
|
51048
51072
|
exports.DeclareFunctionStmt = DeclareFunctionStmt;
|
|
@@ -51071,7 +51095,6 @@ exports.IfBlock = IfBlock;
|
|
|
51071
51095
|
exports.ImplicitReceiver = ImplicitReceiver;
|
|
51072
51096
|
exports.ImportManager = ImportManager;
|
|
51073
51097
|
exports.Interpolation = Interpolation$1;
|
|
51074
|
-
exports.InterpolationConfig = InterpolationConfig;
|
|
51075
51098
|
exports.InvokeFunctionExpr = InvokeFunctionExpr;
|
|
51076
51099
|
exports.KeyedRead = KeyedRead;
|
|
51077
51100
|
exports.KnownFn = KnownFn;
|