@angular/compiler 18.0.0-next.0 → 18.0.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.
- package/esm2022/src/compiler.mjs +3 -3
- package/esm2022/src/compiler_facade_interface.mjs +1 -1
- package/esm2022/src/constant_pool.mjs +6 -3
- package/esm2022/src/jit_compiler_facade.mjs +9 -10
- package/esm2022/src/render3/partial/api.mjs +1 -1
- package/esm2022/src/render3/partial/class_metadata.mjs +24 -2
- package/esm2022/src/render3/partial/component.mjs +24 -1
- package/esm2022/src/render3/partial/directive.mjs +1 -1
- package/esm2022/src/render3/partial/factory.mjs +1 -1
- package/esm2022/src/render3/partial/injectable.mjs +1 -1
- package/esm2022/src/render3/partial/injector.mjs +1 -1
- package/esm2022/src/render3/partial/ng_module.mjs +1 -1
- package/esm2022/src/render3/partial/pipe.mjs +1 -1
- package/esm2022/src/render3/r3_ast.mjs +7 -4
- package/esm2022/src/render3/r3_class_metadata_compiler.mjs +46 -33
- package/esm2022/src/render3/r3_control_flow.mjs +18 -16
- package/esm2022/src/render3/r3_identifiers.mjs +2 -1
- package/esm2022/src/render3/r3_template_transform.mjs +2 -13
- package/esm2022/src/render3/view/api.mjs +1 -1
- package/esm2022/src/render3/view/compiler.mjs +2 -2
- package/esm2022/src/render3/view/t2_api.mjs +1 -1
- package/esm2022/src/render3/view/t2_binder.mjs +30 -20
- package/esm2022/src/shadow_css.mjs +2 -2
- package/esm2022/src/template/pipeline/ir/src/ops/create.mjs +4 -2
- package/esm2022/src/template/pipeline/ir/src/ops/update.mjs +1 -1
- package/esm2022/src/template/pipeline/src/ingest.mjs +77 -54
- package/esm2022/src/template/pipeline/src/instruction.mjs +9 -3
- package/esm2022/src/template/pipeline/src/phases/generate_variables.mjs +6 -1
- package/esm2022/src/template/pipeline/src/phases/naming.mjs +14 -2
- package/esm2022/src/template/pipeline/src/phases/propagate_i18n_blocks.mjs +2 -2
- package/esm2022/src/template/pipeline/src/phases/reify.mjs +21 -2
- package/esm2022/src/template/pipeline/src/phases/track_fn_optimization.mjs +4 -1
- package/esm2022/src/template/pipeline/src/phases/track_variables.mjs +2 -2
- package/esm2022/src/template/pipeline/src/phases/wrap_icus.mjs +2 -2
- package/esm2022/src/version.mjs +1 -1
- package/fesm2022/compiler.mjs +298 -164
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +50 -16
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v18.0.0-next.
|
|
2
|
+
* @license Angular v18.0.0-next.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2339,13 +2339,16 @@ class ConstantPool {
|
|
|
2339
2339
|
}
|
|
2340
2340
|
// Function declarations are saved as function statements
|
|
2341
2341
|
// so we compare them directly to the passed-in function.
|
|
2342
|
-
if (!isArrow && current instanceof DeclareFunctionStmt && fn
|
|
2342
|
+
if (!isArrow && current instanceof DeclareFunctionStmt && fn instanceof FunctionExpr &&
|
|
2343
|
+
fn.isEquivalent(current)) {
|
|
2343
2344
|
return variable(current.name);
|
|
2344
2345
|
}
|
|
2345
2346
|
}
|
|
2346
2347
|
// Otherwise declare the function.
|
|
2347
2348
|
const name = useUniqueName ? this.uniqueName(prefix) : prefix;
|
|
2348
|
-
this.statements.push(fn
|
|
2349
|
+
this.statements.push(fn instanceof FunctionExpr ?
|
|
2350
|
+
fn.toDeclStmt(name, StmtModifier.Final) :
|
|
2351
|
+
new DeclareVarStmt(name, fn, INFERRED_TYPE, StmtModifier.Final, fn.sourceSpan));
|
|
2349
2352
|
return variable(name);
|
|
2350
2353
|
}
|
|
2351
2354
|
_getLiteralFactory(key, values, resultMap) {
|
|
@@ -2631,6 +2634,7 @@ class Identifiers {
|
|
|
2631
2634
|
static { this.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE }; }
|
|
2632
2635
|
static { this.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE }; }
|
|
2633
2636
|
static { this.declareClassMetadata = { name: 'ɵɵngDeclareClassMetadata', moduleName: CORE }; }
|
|
2637
|
+
static { this.declareClassMetadataAsync = { name: 'ɵɵngDeclareClassMetadataAsync', moduleName: CORE }; }
|
|
2634
2638
|
static { this.setClassMetadata = { name: 'ɵsetClassMetadata', moduleName: CORE }; }
|
|
2635
2639
|
static { this.setClassMetadataAsync = { name: 'ɵsetClassMetadataAsync', moduleName: CORE }; }
|
|
2636
2640
|
static { this.setClassDebugInfo = { name: 'ɵsetClassDebugInfo', moduleName: CORE }; }
|
|
@@ -4853,9 +4857,10 @@ class Template {
|
|
|
4853
4857
|
}
|
|
4854
4858
|
}
|
|
4855
4859
|
class Content {
|
|
4856
|
-
constructor(selector, attributes, sourceSpan, i18n) {
|
|
4860
|
+
constructor(selector, attributes, children, sourceSpan, i18n) {
|
|
4857
4861
|
this.selector = selector;
|
|
4858
4862
|
this.attributes = attributes;
|
|
4863
|
+
this.children = children;
|
|
4859
4864
|
this.sourceSpan = sourceSpan;
|
|
4860
4865
|
this.i18n = i18n;
|
|
4861
4866
|
this.name = 'ng-content';
|
|
@@ -4934,7 +4939,7 @@ class RecursiveVisitor$1 {
|
|
|
4934
4939
|
visitAll$1(this, block.children);
|
|
4935
4940
|
}
|
|
4936
4941
|
visitForLoopBlock(block) {
|
|
4937
|
-
const blockItems = [block.item, ...
|
|
4942
|
+
const blockItems = [block.item, ...block.contextVariables, ...block.children];
|
|
4938
4943
|
block.empty && blockItems.push(block.empty);
|
|
4939
4944
|
visitAll$1(this, blockItems);
|
|
4940
4945
|
}
|
|
@@ -4949,7 +4954,9 @@ class RecursiveVisitor$1 {
|
|
|
4949
4954
|
block.expressionAlias && blockItems.push(block.expressionAlias);
|
|
4950
4955
|
visitAll$1(this, blockItems);
|
|
4951
4956
|
}
|
|
4952
|
-
visitContent(content) {
|
|
4957
|
+
visitContent(content) {
|
|
4958
|
+
visitAll$1(this, content.children);
|
|
4959
|
+
}
|
|
4953
4960
|
visitVariable(variable) { }
|
|
4954
4961
|
visitReference(reference) { }
|
|
4955
4962
|
visitTextAttribute(attribute) { }
|
|
@@ -6963,7 +6970,7 @@ class ShadowCss {
|
|
|
6963
6970
|
}
|
|
6964
6971
|
else {
|
|
6965
6972
|
// Replace non hash comments with empty lines.
|
|
6966
|
-
// This is done so that we do not leak any
|
|
6973
|
+
// This is done so that we do not leak any sensitive data in comments.
|
|
6967
6974
|
const newLinesMatches = m.match(_newLinesRe);
|
|
6968
6975
|
comments.push((newLinesMatches?.join('') ?? '') + '\n');
|
|
6969
6976
|
}
|
|
@@ -10025,19 +10032,21 @@ function createProjectionDefOp(def) {
|
|
|
10025
10032
|
...NEW_OP,
|
|
10026
10033
|
};
|
|
10027
10034
|
}
|
|
10028
|
-
function createProjectionOp(xref, selector, i18nPlaceholder, sourceSpan) {
|
|
10035
|
+
function createProjectionOp(xref, selector, i18nPlaceholder, fallbackView, sourceSpan) {
|
|
10029
10036
|
return {
|
|
10030
10037
|
kind: OpKind.Projection,
|
|
10031
10038
|
xref,
|
|
10032
10039
|
handle: new SlotHandle(),
|
|
10033
10040
|
selector,
|
|
10034
10041
|
i18nPlaceholder,
|
|
10042
|
+
fallbackView,
|
|
10035
10043
|
projectionSlotIndex: 0,
|
|
10036
10044
|
attributes: null,
|
|
10037
10045
|
localRefs: [],
|
|
10038
10046
|
sourceSpan,
|
|
10039
10047
|
...NEW_OP,
|
|
10040
10048
|
...TRAIT_CONSUMES_SLOT,
|
|
10049
|
+
numSlotsUsed: fallbackView === null ? 1 : 2,
|
|
10041
10050
|
};
|
|
10042
10051
|
}
|
|
10043
10052
|
/**
|
|
@@ -12030,6 +12039,11 @@ function recursivelyProcessView(view, parentScope) {
|
|
|
12030
12039
|
// Descend into child embedded views.
|
|
12031
12040
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
12032
12041
|
break;
|
|
12042
|
+
case OpKind.Projection:
|
|
12043
|
+
if (op.fallbackView !== null) {
|
|
12044
|
+
recursivelyProcessView(view.job.views.get(op.fallbackView), scope);
|
|
12045
|
+
}
|
|
12046
|
+
break;
|
|
12033
12047
|
case OpKind.RepeaterCreate:
|
|
12034
12048
|
// Descend into child embedded views.
|
|
12035
12049
|
recursivelyProcessView(view.job.views.get(op.xref), scope);
|
|
@@ -19850,6 +19864,18 @@ function addNamesToView(unit, baseName, state, compatibility) {
|
|
|
19850
19864
|
// Repeater primary view function is at slot +1 (metadata is in the first slot).
|
|
19851
19865
|
addNamesToView(unit.job.views.get(op.xref), `${baseName}_${op.functionNameSuffix}_${op.handle.slot + 1}`, state, compatibility);
|
|
19852
19866
|
break;
|
|
19867
|
+
case OpKind.Projection:
|
|
19868
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
19869
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
19870
|
+
}
|
|
19871
|
+
if (op.handle.slot === null) {
|
|
19872
|
+
throw new Error(`Expected slot to be assigned`);
|
|
19873
|
+
}
|
|
19874
|
+
if (op.fallbackView !== null) {
|
|
19875
|
+
const fallbackView = unit.job.views.get(op.fallbackView);
|
|
19876
|
+
addNamesToView(fallbackView, `${baseName}_ProjectionFallback_${op.handle.slot}`, state, compatibility);
|
|
19877
|
+
}
|
|
19878
|
+
break;
|
|
19853
19879
|
case OpKind.Template:
|
|
19854
19880
|
if (!(unit instanceof ViewCompilationUnit)) {
|
|
19855
19881
|
throw new Error(`AssertionError: must be compiling a component`);
|
|
@@ -19896,7 +19922,7 @@ function getVariableName(unit, variable, state) {
|
|
|
19896
19922
|
break;
|
|
19897
19923
|
case SemanticVariableKind.Identifier:
|
|
19898
19924
|
if (unit.job.compatibility === CompatibilityMode.TemplateDefinitionBuilder) {
|
|
19899
|
-
// TODO: Prefix increment and `_r` are for
|
|
19925
|
+
// TODO: Prefix increment and `_r` are for compatibility with the old naming scheme.
|
|
19900
19926
|
// This has the potential to cause collisions when `ctx` is the identifier, so we need a
|
|
19901
19927
|
// special check for that as well.
|
|
19902
19928
|
const compatPrefix = variable.identifier === 'ctx' ? 'i' : '';
|
|
@@ -20390,7 +20416,7 @@ function wrapTemplateWithI18n(unit, parentI18n) {
|
|
|
20390
20416
|
if (unit.create.head.next?.kind !== OpKind.I18nStart) {
|
|
20391
20417
|
const id = unit.job.allocateXrefId();
|
|
20392
20418
|
OpList.insertAfter(
|
|
20393
|
-
// Nested ng-template i18n start/end ops should not
|
|
20419
|
+
// Nested ng-template i18n start/end ops should not receive source spans.
|
|
20394
20420
|
createI18nStartOp(id, parentI18n.message, parentI18n.root, null), unit.create.head);
|
|
20395
20421
|
OpList.insertBefore(createI18nEndOp(id, null), unit.create.tail);
|
|
20396
20422
|
}
|
|
@@ -20655,13 +20681,19 @@ function deferOn(trigger, args, prefetch, sourceSpan) {
|
|
|
20655
20681
|
function projectionDef(def) {
|
|
20656
20682
|
return call(Identifiers.projectionDef, def ? [def] : [], null);
|
|
20657
20683
|
}
|
|
20658
|
-
function projection(slot, projectionSlotIndex, attributes, sourceSpan) {
|
|
20684
|
+
function projection(slot, projectionSlotIndex, attributes, fallbackFnName, fallbackDecls, fallbackVars, sourceSpan) {
|
|
20659
20685
|
const args = [literal(slot)];
|
|
20660
|
-
if (projectionSlotIndex !== 0 || attributes !== null) {
|
|
20686
|
+
if (projectionSlotIndex !== 0 || attributes !== null || fallbackFnName !== null) {
|
|
20661
20687
|
args.push(literal(projectionSlotIndex));
|
|
20662
20688
|
if (attributes !== null) {
|
|
20663
20689
|
args.push(attributes);
|
|
20664
20690
|
}
|
|
20691
|
+
if (fallbackFnName !== null) {
|
|
20692
|
+
if (attributes === null) {
|
|
20693
|
+
args.push(literal(null));
|
|
20694
|
+
}
|
|
20695
|
+
args.push(variable(fallbackFnName), literal(fallbackDecls), literal(fallbackVars));
|
|
20696
|
+
}
|
|
20665
20697
|
}
|
|
20666
20698
|
return call(Identifiers.projection, args, sourceSpan);
|
|
20667
20699
|
}
|
|
@@ -21230,7 +21262,26 @@ function reifyCreateOperations(unit, ops) {
|
|
|
21230
21262
|
if (op.handle.slot === null) {
|
|
21231
21263
|
throw new Error('No slot was assigned for project instruction');
|
|
21232
21264
|
}
|
|
21233
|
-
|
|
21265
|
+
let fallbackViewFnName = null;
|
|
21266
|
+
let fallbackDecls = null;
|
|
21267
|
+
let fallbackVars = null;
|
|
21268
|
+
if (op.fallbackView !== null) {
|
|
21269
|
+
if (!(unit instanceof ViewCompilationUnit)) {
|
|
21270
|
+
throw new Error(`AssertionError: must be compiling a component`);
|
|
21271
|
+
}
|
|
21272
|
+
const fallbackView = unit.job.views.get(op.fallbackView);
|
|
21273
|
+
if (fallbackView === undefined) {
|
|
21274
|
+
throw new Error('AssertionError: projection had fallback view xref, but fallback view was not found');
|
|
21275
|
+
}
|
|
21276
|
+
if (fallbackView.fnName === null || fallbackView.decls === null ||
|
|
21277
|
+
fallbackView.vars === null) {
|
|
21278
|
+
throw new Error(`AssertionError: expected projection fallback view to have been named and counted`);
|
|
21279
|
+
}
|
|
21280
|
+
fallbackViewFnName = fallbackView.fnName;
|
|
21281
|
+
fallbackDecls = fallbackView.decls;
|
|
21282
|
+
fallbackVars = fallbackView.vars;
|
|
21283
|
+
}
|
|
21284
|
+
OpList.replace(op, projection(op.handle.slot, op.projectionSlotIndex, op.attributes, fallbackViewFnName, fallbackDecls, fallbackVars, op.sourceSpan));
|
|
21234
21285
|
break;
|
|
21235
21286
|
case OpKind.RepeaterCreate:
|
|
21236
21287
|
if (op.handle.slot === null) {
|
|
@@ -22486,6 +22537,9 @@ function optimizeTrackFns(job) {
|
|
|
22486
22537
|
op.trackByFn = importExpr(Identifiers.repeaterTrackByIdentity);
|
|
22487
22538
|
}
|
|
22488
22539
|
else if (isTrackByFunctionCall(job.root.xref, op.track)) {
|
|
22540
|
+
// Mark the function as using the component instance to play it safe
|
|
22541
|
+
// since the method might be using `this` internally (see #53628).
|
|
22542
|
+
op.usesComponentInstance = true;
|
|
22489
22543
|
// Top-level method calls in the form of `fn($index, item)` can be passed in directly.
|
|
22490
22544
|
if (op.track.receiver.receiver.view === unit.xref) {
|
|
22491
22545
|
// TODO: this may be wrong
|
|
@@ -22549,7 +22603,7 @@ function generateTrackVariables(job) {
|
|
|
22549
22603
|
}
|
|
22550
22604
|
op.track = transformExpressionsInExpression(op.track, expr => {
|
|
22551
22605
|
if (expr instanceof LexicalReadExpr) {
|
|
22552
|
-
if (
|
|
22606
|
+
if (op.varNames.$index.has(expr.name)) {
|
|
22553
22607
|
return variable('$index');
|
|
22554
22608
|
}
|
|
22555
22609
|
else if (expr.name === op.varNames.$implicit) {
|
|
@@ -23134,7 +23188,7 @@ function wrapI18nIcus(job) {
|
|
|
23134
23188
|
case OpKind.IcuStart:
|
|
23135
23189
|
if (currentI18nOp === null) {
|
|
23136
23190
|
addedI18nId = job.allocateXrefId();
|
|
23137
|
-
// ICU i18n start/end ops should not
|
|
23191
|
+
// ICU i18n start/end ops should not receive source spans.
|
|
23138
23192
|
OpList.insertBefore(createI18nStartOp(addedI18nId, op.message, undefined, null), op);
|
|
23139
23193
|
}
|
|
23140
23194
|
break;
|
|
@@ -23524,7 +23578,15 @@ function ingestContent(unit, content) {
|
|
|
23524
23578
|
if (content.i18n !== undefined && !(content.i18n instanceof TagPlaceholder)) {
|
|
23525
23579
|
throw Error(`Unhandled i18n metadata type for element: ${content.i18n.constructor.name}`);
|
|
23526
23580
|
}
|
|
23527
|
-
const
|
|
23581
|
+
const id = unit.job.allocateXrefId();
|
|
23582
|
+
let fallbackView = null;
|
|
23583
|
+
// Don't capture default content that's only made up of empty text nodes and comments.
|
|
23584
|
+
if (content.children.some(child => !(child instanceof Comment$1) &&
|
|
23585
|
+
(!(child instanceof Text$3) || child.value.trim().length > 0))) {
|
|
23586
|
+
fallbackView = unit.job.allocateView(unit.xref);
|
|
23587
|
+
ingestNodes(fallbackView, content.children);
|
|
23588
|
+
}
|
|
23589
|
+
const op = createProjectionOp(id, content.selector, content.i18n, fallbackView?.xref ?? null, content.sourceSpan);
|
|
23528
23590
|
for (const attr of content.attributes) {
|
|
23529
23591
|
const securityContext = domSchema.securityContext(content.name, attr.name, true);
|
|
23530
23592
|
unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
@@ -23577,12 +23639,7 @@ function ingestIfBlock(unit, ifBlock) {
|
|
|
23577
23639
|
for (let i = 0; i < ifBlock.branches.length; i++) {
|
|
23578
23640
|
const ifCase = ifBlock.branches[i];
|
|
23579
23641
|
const cView = unit.job.allocateView(unit.xref);
|
|
23580
|
-
|
|
23581
|
-
// Only the first branch can be used for projection, because the conditional
|
|
23582
|
-
// uses the container of the first branch as the insertion point for all branches.
|
|
23583
|
-
if (i === 0) {
|
|
23584
|
-
tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
|
|
23585
|
-
}
|
|
23642
|
+
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, ifCase);
|
|
23586
23643
|
if (ifCase.expressionAlias !== null) {
|
|
23587
23644
|
cView.contextVariables.set(ifCase.expressionAlias.name, CTX_REF);
|
|
23588
23645
|
}
|
|
@@ -23620,6 +23677,7 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
23620
23677
|
let conditions = [];
|
|
23621
23678
|
for (const switchCase of switchBlock.cases) {
|
|
23622
23679
|
const cView = unit.job.allocateView(unit.xref);
|
|
23680
|
+
const tagName = ingestControlFlowInsertionPoint(unit, cView.xref, switchCase);
|
|
23623
23681
|
let switchCaseI18nMeta = undefined;
|
|
23624
23682
|
if (switchCase.i18n !== undefined) {
|
|
23625
23683
|
if (!(switchCase.i18n instanceof BlockPlaceholder)) {
|
|
@@ -23627,7 +23685,7 @@ function ingestSwitchBlock(unit, switchBlock) {
|
|
|
23627
23685
|
}
|
|
23628
23686
|
switchCaseI18nMeta = switchCase.i18n;
|
|
23629
23687
|
}
|
|
23630
|
-
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block,
|
|
23688
|
+
const templateOp = createTemplateOp(cView.xref, TemplateKind.Block, tagName, 'Case', Namespace.HTML, switchCaseI18nMeta, switchCase.startSourceSpan, switchCase.sourceSpan);
|
|
23631
23689
|
unit.create.push(templateOp);
|
|
23632
23690
|
if (firstXref === null) {
|
|
23633
23691
|
firstXref = cView.xref;
|
|
@@ -23773,43 +23831,35 @@ function ingestIcu(unit, icu) {
|
|
|
23773
23831
|
*/
|
|
23774
23832
|
function ingestForBlock(unit, forBlock) {
|
|
23775
23833
|
const repeaterView = unit.job.allocateView(unit.xref);
|
|
23834
|
+
// We copy TemplateDefinitionBuilder's scheme of creating names for `$count` and `$index`
|
|
23835
|
+
// that are suffixed with special information, to disambiguate which level of nested loop
|
|
23836
|
+
// the below aliases refer to.
|
|
23837
|
+
// TODO: We should refactor Template Pipeline's variable phases to gracefully handle
|
|
23838
|
+
// shadowing, and arbitrarily many levels of variables depending on each other.
|
|
23839
|
+
const indexName = `ɵ$index_${repeaterView.xref}`;
|
|
23840
|
+
const countName = `ɵ$count_${repeaterView.xref}`;
|
|
23841
|
+
const indexVarNames = new Set();
|
|
23776
23842
|
// Set all the context variables and aliases available in the repeater.
|
|
23777
23843
|
repeaterView.contextVariables.set(forBlock.item.name, forBlock.item.value);
|
|
23778
|
-
|
|
23779
|
-
|
|
23780
|
-
|
|
23781
|
-
|
|
23782
|
-
|
|
23783
|
-
|
|
23784
|
-
|
|
23785
|
-
|
|
23786
|
-
|
|
23787
|
-
|
|
23788
|
-
|
|
23789
|
-
|
|
23790
|
-
|
|
23791
|
-
|
|
23792
|
-
|
|
23793
|
-
|
|
23794
|
-
|
|
23795
|
-
|
|
23796
|
-
|
|
23797
|
-
name: null,
|
|
23798
|
-
identifier: forBlock.contextVariables.$last.name,
|
|
23799
|
-
expression: new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)))
|
|
23800
|
-
});
|
|
23801
|
-
repeaterView.aliases.add({
|
|
23802
|
-
kind: SemanticVariableKind.Alias,
|
|
23803
|
-
name: null,
|
|
23804
|
-
identifier: forBlock.contextVariables.$even.name,
|
|
23805
|
-
expression: new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0))
|
|
23806
|
-
});
|
|
23807
|
-
repeaterView.aliases.add({
|
|
23808
|
-
kind: SemanticVariableKind.Alias,
|
|
23809
|
-
name: null,
|
|
23810
|
-
identifier: forBlock.contextVariables.$odd.name,
|
|
23811
|
-
expression: new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0))
|
|
23812
|
-
});
|
|
23844
|
+
for (const variable of forBlock.contextVariables) {
|
|
23845
|
+
if (variable.value === '$index') {
|
|
23846
|
+
indexVarNames.add(variable.name);
|
|
23847
|
+
}
|
|
23848
|
+
if (variable.name === '$index') {
|
|
23849
|
+
repeaterView.contextVariables.set('$index', variable.value).set(indexName, variable.value);
|
|
23850
|
+
}
|
|
23851
|
+
else if (variable.name === '$count') {
|
|
23852
|
+
repeaterView.contextVariables.set('$count', variable.value).set(countName, variable.value);
|
|
23853
|
+
}
|
|
23854
|
+
else {
|
|
23855
|
+
repeaterView.aliases.add({
|
|
23856
|
+
kind: SemanticVariableKind.Alias,
|
|
23857
|
+
name: null,
|
|
23858
|
+
identifier: variable.name,
|
|
23859
|
+
expression: getComputedForLoopVariableExpression(variable, indexName, countName)
|
|
23860
|
+
});
|
|
23861
|
+
}
|
|
23862
|
+
}
|
|
23813
23863
|
const sourceSpan = convertSourceSpan(forBlock.trackBy.span, forBlock.sourceSpan);
|
|
23814
23864
|
const track = convertAst(forBlock.trackBy, unit.job, sourceSpan);
|
|
23815
23865
|
ingestNodes(repeaterView, forBlock.children);
|
|
@@ -23821,12 +23871,7 @@ function ingestForBlock(unit, forBlock) {
|
|
|
23821
23871
|
emptyTagName = ingestControlFlowInsertionPoint(unit, emptyView.xref, forBlock.empty);
|
|
23822
23872
|
}
|
|
23823
23873
|
const varNames = {
|
|
23824
|
-
$index:
|
|
23825
|
-
$count: forBlock.contextVariables.$count.name,
|
|
23826
|
-
$first: forBlock.contextVariables.$first.name,
|
|
23827
|
-
$last: forBlock.contextVariables.$last.name,
|
|
23828
|
-
$even: forBlock.contextVariables.$even.name,
|
|
23829
|
-
$odd: forBlock.contextVariables.$odd.name,
|
|
23874
|
+
$index: indexVarNames,
|
|
23830
23875
|
$implicit: forBlock.item.name,
|
|
23831
23876
|
};
|
|
23832
23877
|
if (forBlock.i18n !== undefined && !(forBlock.i18n instanceof BlockPlaceholder)) {
|
|
@@ -23845,6 +23890,30 @@ function ingestForBlock(unit, forBlock) {
|
|
|
23845
23890
|
const repeater = createRepeaterOp(repeaterCreate.xref, repeaterCreate.handle, expression, forBlock.sourceSpan);
|
|
23846
23891
|
unit.update.push(repeater);
|
|
23847
23892
|
}
|
|
23893
|
+
/**
|
|
23894
|
+
* Gets an expression that represents a variable in an `@for` loop.
|
|
23895
|
+
* @param variable AST representing the variable.
|
|
23896
|
+
* @param indexName Loop-specific name for `$index`.
|
|
23897
|
+
* @param countName Loop-specific name for `$count`.
|
|
23898
|
+
*/
|
|
23899
|
+
function getComputedForLoopVariableExpression(variable, indexName, countName) {
|
|
23900
|
+
switch (variable.value) {
|
|
23901
|
+
case '$index':
|
|
23902
|
+
return new LexicalReadExpr(indexName);
|
|
23903
|
+
case '$count':
|
|
23904
|
+
return new LexicalReadExpr(countName);
|
|
23905
|
+
case '$first':
|
|
23906
|
+
return new LexicalReadExpr(indexName).identical(literal(0));
|
|
23907
|
+
case '$last':
|
|
23908
|
+
return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)));
|
|
23909
|
+
case '$even':
|
|
23910
|
+
return new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0));
|
|
23911
|
+
case '$odd':
|
|
23912
|
+
return new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0));
|
|
23913
|
+
default:
|
|
23914
|
+
throw new Error(`AssertionError: unknown @for loop variable ${variable.value}`);
|
|
23915
|
+
}
|
|
23916
|
+
}
|
|
23848
23917
|
/**
|
|
23849
23918
|
* Convert a template AST expression into an output AST expression.
|
|
23850
23919
|
*/
|
|
@@ -24320,15 +24389,23 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
|
|
|
24320
24389
|
root = child;
|
|
24321
24390
|
}
|
|
24322
24391
|
}
|
|
24323
|
-
// If we've found a single root node, its tag name and
|
|
24324
|
-
// to the surrounding template to be used for content projection.
|
|
24325
|
-
// that we don't copy any bound attributes since they don't participate in content projection
|
|
24326
|
-
// and they can be used in directive matching (in the case of `Template.templateAttrs`).
|
|
24392
|
+
// If we've found a single root node, its tag name and attributes can be
|
|
24393
|
+
// copied to the surrounding template to be used for content projection.
|
|
24327
24394
|
if (root !== null) {
|
|
24395
|
+
// Collect the static attributes for content projection purposes.
|
|
24328
24396
|
for (const attr of root.attributes) {
|
|
24329
24397
|
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
24330
24398
|
unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
|
|
24331
24399
|
}
|
|
24400
|
+
// Also collect the inputs since they participate in content projection as well.
|
|
24401
|
+
// Note that TDB used to collect the outputs as well, but it wasn't passing them into
|
|
24402
|
+
// the template instruction. Here we just don't collect them.
|
|
24403
|
+
for (const attr of root.inputs) {
|
|
24404
|
+
if (attr.type !== BindingType.Animation && attr.type !== BindingType.Attribute) {
|
|
24405
|
+
const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
|
|
24406
|
+
unit.create.push(createExtractedAttributeOp(xref, BindingKind.Property, null, attr.name, null, null, null, securityContext));
|
|
24407
|
+
}
|
|
24408
|
+
}
|
|
24332
24409
|
const tagName = root instanceof Element$1 ? root.name : root.tagName;
|
|
24333
24410
|
// Don't pass along `ng-template` tag name since it enables directive matching.
|
|
24334
24411
|
return tagName === NG_TEMPLATE_TAG_NAME ? null : tagName;
|
|
@@ -25290,6 +25367,9 @@ function parseForLoopParameters(block, errors, bindingParser) {
|
|
|
25290
25367
|
return null;
|
|
25291
25368
|
}
|
|
25292
25369
|
const [, itemName, rawExpression] = match;
|
|
25370
|
+
if (ALLOWED_FOR_LOOP_LET_VARIABLES.has(itemName)) {
|
|
25371
|
+
errors.push(new ParseError(expressionParam.sourceSpan, `@for loop item name cannot be one of ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(', ')}.`));
|
|
25372
|
+
}
|
|
25293
25373
|
// `expressionParam.expression` contains the variable declaration and the expression of the
|
|
25294
25374
|
// for...of statement, i.e. 'user of users' The variable of a ForOfStatement is _only_ the "const
|
|
25295
25375
|
// user" part and does not include "of x".
|
|
@@ -25299,13 +25379,18 @@ function parseForLoopParameters(block, errors, bindingParser) {
|
|
|
25299
25379
|
itemName: new Variable(itemName, '$implicit', variableSpan, variableSpan),
|
|
25300
25380
|
trackBy: null,
|
|
25301
25381
|
expression: parseBlockParameterToBinding(expressionParam, bindingParser, rawExpression),
|
|
25302
|
-
context: {
|
|
25382
|
+
context: Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES, variableName => {
|
|
25383
|
+
// Give ambiently-available context variables empty spans at the end of
|
|
25384
|
+
// the start of the `for` block, since they are not explicitly defined.
|
|
25385
|
+
const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
|
|
25386
|
+
return new Variable(variableName, variableName, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
|
|
25387
|
+
}),
|
|
25303
25388
|
};
|
|
25304
25389
|
for (const param of secondaryParams) {
|
|
25305
25390
|
const letMatch = param.expression.match(FOR_LOOP_LET_PATTERN);
|
|
25306
25391
|
if (letMatch !== null) {
|
|
25307
25392
|
const variablesSpan = new ParseSourceSpan(param.sourceSpan.start.moveBy(letMatch[0].length - letMatch[1].length), param.sourceSpan.end);
|
|
25308
|
-
parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, result.context, errors);
|
|
25393
|
+
parseLetParameter(param.sourceSpan, letMatch[1], variablesSpan, itemName, result.context, errors);
|
|
25309
25394
|
continue;
|
|
25310
25395
|
}
|
|
25311
25396
|
const trackMatch = param.expression.match(FOR_LOOP_TRACK_PATTERN);
|
|
@@ -25325,32 +25410,26 @@ function parseForLoopParameters(block, errors, bindingParser) {
|
|
|
25325
25410
|
}
|
|
25326
25411
|
errors.push(new ParseError(param.sourceSpan, `Unrecognized @for loop paramater "${param.expression}"`));
|
|
25327
25412
|
}
|
|
25328
|
-
// Fill out any variables that haven't been defined explicitly.
|
|
25329
|
-
for (const variableName of ALLOWED_FOR_LOOP_LET_VARIABLES) {
|
|
25330
|
-
if (!result.context.hasOwnProperty(variableName)) {
|
|
25331
|
-
// Give ambiently-available context variables empty spans at the end of the start of the `for`
|
|
25332
|
-
// block, since they are not explicitly defined.
|
|
25333
|
-
const emptySpanAfterForBlockStart = new ParseSourceSpan(block.startSourceSpan.end, block.startSourceSpan.end);
|
|
25334
|
-
result.context[variableName] = new Variable(variableName, variableName, emptySpanAfterForBlockStart, emptySpanAfterForBlockStart);
|
|
25335
|
-
}
|
|
25336
|
-
}
|
|
25337
25413
|
return result;
|
|
25338
25414
|
}
|
|
25339
25415
|
/** Parses the `let` parameter of a `for` loop block. */
|
|
25340
|
-
function parseLetParameter(sourceSpan, expression, span, context, errors) {
|
|
25416
|
+
function parseLetParameter(sourceSpan, expression, span, loopItemName, context, errors) {
|
|
25341
25417
|
const parts = expression.split(',');
|
|
25342
25418
|
let startSpan = span.start;
|
|
25343
25419
|
for (const part of parts) {
|
|
25344
25420
|
const expressionParts = part.split('=');
|
|
25345
25421
|
const name = expressionParts.length === 2 ? expressionParts[0].trim() : '';
|
|
25346
|
-
const variableName =
|
|
25422
|
+
const variableName = expressionParts.length === 2 ? expressionParts[1].trim() : '';
|
|
25347
25423
|
if (name.length === 0 || variableName.length === 0) {
|
|
25348
25424
|
errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Parameter should match the pattern "<name> = <variable name>"`));
|
|
25349
25425
|
}
|
|
25350
25426
|
else if (!ALLOWED_FOR_LOOP_LET_VARIABLES.has(variableName)) {
|
|
25351
25427
|
errors.push(new ParseError(sourceSpan, `Unknown "let" parameter variable "${variableName}". The allowed variables are: ${Array.from(ALLOWED_FOR_LOOP_LET_VARIABLES).join(', ')}`));
|
|
25352
25428
|
}
|
|
25353
|
-
else if (
|
|
25429
|
+
else if (name === loopItemName) {
|
|
25430
|
+
errors.push(new ParseError(sourceSpan, `Invalid @for loop "let" parameter. Variable cannot be called "${loopItemName}"`));
|
|
25431
|
+
}
|
|
25432
|
+
else if (context.some(v => v.name === name)) {
|
|
25354
25433
|
errors.push(new ParseError(sourceSpan, `Duplicate "let" parameter variable "${variableName}"`));
|
|
25355
25434
|
}
|
|
25356
25435
|
else {
|
|
@@ -25371,7 +25450,7 @@ function parseLetParameter(sourceSpan, expression, span, context, errors) {
|
|
|
25371
25450
|
undefined;
|
|
25372
25451
|
}
|
|
25373
25452
|
const sourceSpan = new ParseSourceSpan(keySpan.start, valueSpan?.end ?? keySpan.end);
|
|
25374
|
-
context
|
|
25453
|
+
context.push(new Variable(name, variableName, sourceSpan, keySpan, valueSpan));
|
|
25375
25454
|
}
|
|
25376
25455
|
startSpan = startSpan.moveBy(part.length + 1 /* add 1 to move past the comma */);
|
|
25377
25456
|
}
|
|
@@ -26143,14 +26222,9 @@ class HtmlAstToIvyAst {
|
|
|
26143
26222
|
}
|
|
26144
26223
|
let parsedElement;
|
|
26145
26224
|
if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
|
|
26146
|
-
// `<ng-content>`
|
|
26147
|
-
if (element.children &&
|
|
26148
|
-
!element.children.every((node) => isEmptyTextNode(node) || isCommentNode(node))) {
|
|
26149
|
-
this.reportError(`<ng-content> element cannot have content.`, element.sourceSpan);
|
|
26150
|
-
}
|
|
26151
26225
|
const selector = preparsedElement.selectAttr;
|
|
26152
26226
|
const attrs = element.attrs.map(attr => this.visitAttribute(attr));
|
|
26153
|
-
parsedElement = new Content(selector, attrs, element.sourceSpan, element.i18n);
|
|
26227
|
+
parsedElement = new Content(selector, attrs, children, element.sourceSpan, element.i18n);
|
|
26154
26228
|
this.ngContentSelectors.push(selector);
|
|
26155
26229
|
}
|
|
26156
26230
|
else if (isTemplateElement) {
|
|
@@ -26512,12 +26586,6 @@ function normalizeAttributeName(attrName) {
|
|
|
26512
26586
|
function addEvents(events, boundEvents) {
|
|
26513
26587
|
boundEvents.push(...events.map(e => BoundEvent.fromParsedEvent(e)));
|
|
26514
26588
|
}
|
|
26515
|
-
function isEmptyTextNode(node) {
|
|
26516
|
-
return node instanceof Text && node.value.trim().length == 0;
|
|
26517
|
-
}
|
|
26518
|
-
function isCommentNode(node) {
|
|
26519
|
-
return node instanceof Comment;
|
|
26520
|
-
}
|
|
26521
26589
|
function textContents(node) {
|
|
26522
26590
|
if (node.children.length !== 1 || !(node.children[0] instanceof Text)) {
|
|
26523
26591
|
return null;
|
|
@@ -26732,7 +26800,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
26732
26800
|
if (meta.defer.mode === 1 /* DeferBlockDepsEmitMode.PerComponent */ &&
|
|
26733
26801
|
meta.defer.dependenciesFn !== null) {
|
|
26734
26802
|
const fnName = `${templateTypeName}_DeferFn`;
|
|
26735
|
-
constantPool.statements.push(meta.defer.dependenciesFn
|
|
26803
|
+
constantPool.statements.push(new DeclareVarStmt(fnName, meta.defer.dependenciesFn, undefined, StmtModifier.Final));
|
|
26736
26804
|
allDeferrableDepsFn = variable(fnName);
|
|
26737
26805
|
}
|
|
26738
26806
|
// First the template is ingested into IR:
|
|
@@ -27226,13 +27294,13 @@ class Scope {
|
|
|
27226
27294
|
}
|
|
27227
27295
|
else if (nodeOrNodes instanceof ForLoopBlock) {
|
|
27228
27296
|
this.visitVariable(nodeOrNodes.item);
|
|
27229
|
-
|
|
27297
|
+
nodeOrNodes.contextVariables.forEach(v => this.visitVariable(v));
|
|
27230
27298
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
27231
27299
|
}
|
|
27232
27300
|
else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty ||
|
|
27233
27301
|
nodeOrNodes instanceof DeferredBlock || nodeOrNodes instanceof DeferredBlockError ||
|
|
27234
27302
|
nodeOrNodes instanceof DeferredBlockPlaceholder ||
|
|
27235
|
-
nodeOrNodes instanceof DeferredBlockLoading) {
|
|
27303
|
+
nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
27236
27304
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
27237
27305
|
}
|
|
27238
27306
|
else {
|
|
@@ -27296,8 +27364,10 @@ class Scope {
|
|
|
27296
27364
|
visitIfBlockBranch(block) {
|
|
27297
27365
|
this.ingestScopedNode(block);
|
|
27298
27366
|
}
|
|
27367
|
+
visitContent(content) {
|
|
27368
|
+
this.ingestScopedNode(content);
|
|
27369
|
+
}
|
|
27299
27370
|
// Unused visitors.
|
|
27300
|
-
visitContent(content) { }
|
|
27301
27371
|
visitBoundAttribute(attr) { }
|
|
27302
27372
|
visitBoundEvent(event) { }
|
|
27303
27373
|
visitBoundText(text) { }
|
|
@@ -27481,7 +27551,7 @@ class DirectiveBinder {
|
|
|
27481
27551
|
}
|
|
27482
27552
|
visitForLoopBlock(block) {
|
|
27483
27553
|
block.item.visit(this);
|
|
27484
|
-
|
|
27554
|
+
block.contextVariables.forEach(v => v.visit(this));
|
|
27485
27555
|
block.children.forEach(node => node.visit(this));
|
|
27486
27556
|
block.empty?.visit(this);
|
|
27487
27557
|
}
|
|
@@ -27495,8 +27565,10 @@ class DirectiveBinder {
|
|
|
27495
27565
|
block.expressionAlias?.visit(this);
|
|
27496
27566
|
block.children.forEach(node => node.visit(this));
|
|
27497
27567
|
}
|
|
27568
|
+
visitContent(content) {
|
|
27569
|
+
content.children.forEach(child => child.visit(this));
|
|
27570
|
+
}
|
|
27498
27571
|
// Unused visitors.
|
|
27499
|
-
visitContent(content) { }
|
|
27500
27572
|
visitVariable(variable) { }
|
|
27501
27573
|
visitReference(reference) { }
|
|
27502
27574
|
visitTextAttribute(attribute) { }
|
|
@@ -27563,7 +27635,7 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
27563
27635
|
const usedPipes = new Set();
|
|
27564
27636
|
const eagerPipes = new Set();
|
|
27565
27637
|
const template = nodes instanceof Template ? nodes : null;
|
|
27566
|
-
const deferBlocks =
|
|
27638
|
+
const deferBlocks = [];
|
|
27567
27639
|
// The top-level template has nesting level 0.
|
|
27568
27640
|
const binder = new TemplateBinder(expressions, symbols, usedPipes, eagerPipes, deferBlocks, nestingLevel, scope, template, 0);
|
|
27569
27641
|
binder.ingest(nodes);
|
|
@@ -27587,7 +27659,7 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
27587
27659
|
}
|
|
27588
27660
|
else if (nodeOrNodes instanceof ForLoopBlock) {
|
|
27589
27661
|
this.visitNode(nodeOrNodes.item);
|
|
27590
|
-
|
|
27662
|
+
nodeOrNodes.contextVariables.forEach(v => this.visitNode(v));
|
|
27591
27663
|
nodeOrNodes.trackBy.visit(this);
|
|
27592
27664
|
nodeOrNodes.children.forEach(this.visitNode);
|
|
27593
27665
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
@@ -27596,14 +27668,14 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
27596
27668
|
if (this.scope.rootNode !== nodeOrNodes) {
|
|
27597
27669
|
throw new Error(`Assertion error: resolved incorrect scope for deferred block ${nodeOrNodes}`);
|
|
27598
27670
|
}
|
|
27599
|
-
this.deferBlocks.
|
|
27671
|
+
this.deferBlocks.push([nodeOrNodes, this.scope]);
|
|
27600
27672
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
27601
27673
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
27602
27674
|
}
|
|
27603
27675
|
else if (nodeOrNodes instanceof SwitchBlockCase || nodeOrNodes instanceof ForLoopBlockEmpty ||
|
|
27604
27676
|
nodeOrNodes instanceof DeferredBlockError ||
|
|
27605
27677
|
nodeOrNodes instanceof DeferredBlockPlaceholder ||
|
|
27606
|
-
nodeOrNodes instanceof DeferredBlockLoading) {
|
|
27678
|
+
nodeOrNodes instanceof DeferredBlockLoading || nodeOrNodes instanceof Content) {
|
|
27607
27679
|
nodeOrNodes.children.forEach(node => node.visit(this));
|
|
27608
27680
|
this.nestingLevel.set(nodeOrNodes, this.level);
|
|
27609
27681
|
}
|
|
@@ -27642,7 +27714,6 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
27642
27714
|
}
|
|
27643
27715
|
// Unused template visitors
|
|
27644
27716
|
visitText(text) { }
|
|
27645
|
-
visitContent(content) { }
|
|
27646
27717
|
visitTextAttribute(attribute) { }
|
|
27647
27718
|
visitUnknownBlock(block) { }
|
|
27648
27719
|
visitDeferredTrigger() { }
|
|
@@ -27697,6 +27768,9 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
27697
27768
|
block.expression?.visit(this);
|
|
27698
27769
|
this.ingestScopedNode(block);
|
|
27699
27770
|
}
|
|
27771
|
+
visitContent(content) {
|
|
27772
|
+
this.ingestScopedNode(content);
|
|
27773
|
+
}
|
|
27700
27774
|
visitBoundText(text) {
|
|
27701
27775
|
text.value.visit(this);
|
|
27702
27776
|
}
|
|
@@ -27746,7 +27820,7 @@ class TemplateBinder extends RecursiveAstVisitor {
|
|
|
27746
27820
|
* See `BoundTarget` for documentation on the individual methods.
|
|
27747
27821
|
*/
|
|
27748
27822
|
class R3BoundTarget {
|
|
27749
|
-
constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes,
|
|
27823
|
+
constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
|
|
27750
27824
|
this.target = target;
|
|
27751
27825
|
this.directives = directives;
|
|
27752
27826
|
this.eagerDirectives = eagerDirectives;
|
|
@@ -27758,7 +27832,8 @@ class R3BoundTarget {
|
|
|
27758
27832
|
this.scopedNodeEntities = scopedNodeEntities;
|
|
27759
27833
|
this.usedPipes = usedPipes;
|
|
27760
27834
|
this.eagerPipes = eagerPipes;
|
|
27761
|
-
this.
|
|
27835
|
+
this.deferredBlocks = rawDeferred.map(current => current[0]);
|
|
27836
|
+
this.deferredScopes = new Map(rawDeferred);
|
|
27762
27837
|
}
|
|
27763
27838
|
getEntitiesInScope(node) {
|
|
27764
27839
|
return this.scopedNodeEntities.get(node) ?? new Set();
|
|
@@ -27797,7 +27872,7 @@ class R3BoundTarget {
|
|
|
27797
27872
|
return Array.from(this.eagerPipes);
|
|
27798
27873
|
}
|
|
27799
27874
|
getDeferBlocks() {
|
|
27800
|
-
return
|
|
27875
|
+
return this.deferredBlocks;
|
|
27801
27876
|
}
|
|
27802
27877
|
getDeferredTriggerTarget(block, trigger) {
|
|
27803
27878
|
// Only triggers that refer to DOM nodes can be resolved.
|
|
@@ -27849,8 +27924,11 @@ class R3BoundTarget {
|
|
|
27849
27924
|
return null;
|
|
27850
27925
|
}
|
|
27851
27926
|
isDeferred(element) {
|
|
27852
|
-
for (const
|
|
27853
|
-
|
|
27927
|
+
for (const block of this.deferredBlocks) {
|
|
27928
|
+
if (!this.deferredScopes.has(block)) {
|
|
27929
|
+
continue;
|
|
27930
|
+
}
|
|
27931
|
+
const stack = [this.deferredScopes.get(block)];
|
|
27854
27932
|
while (stack.length > 0) {
|
|
27855
27933
|
const current = stack.pop();
|
|
27856
27934
|
if (current.elementsInScope.has(element)) {
|
|
@@ -27868,9 +27946,9 @@ class R3BoundTarget {
|
|
|
27868
27946
|
*/
|
|
27869
27947
|
findEntityInScope(rootNode, name) {
|
|
27870
27948
|
const entities = this.getEntitiesInScope(rootNode);
|
|
27871
|
-
for (const
|
|
27872
|
-
if (
|
|
27873
|
-
return
|
|
27949
|
+
for (const entity of entities) {
|
|
27950
|
+
if (entity.name === name) {
|
|
27951
|
+
return entity;
|
|
27874
27952
|
}
|
|
27875
27953
|
}
|
|
27876
27954
|
return null;
|
|
@@ -28039,7 +28117,7 @@ class CompilerFacadeImpl {
|
|
|
28039
28117
|
}
|
|
28040
28118
|
compileComponent(angularCoreEnv, sourceMapUrl, facade) {
|
|
28041
28119
|
// Parse the template and check for errors.
|
|
28042
|
-
const { template, interpolation, defer } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
|
|
28120
|
+
const { template, interpolation, defer } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation, undefined);
|
|
28043
28121
|
// Compile the component metadata, including template, into an expression.
|
|
28044
28122
|
const meta = {
|
|
28045
28123
|
...facade,
|
|
@@ -28255,7 +28333,7 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
28255
28333
|
return result;
|
|
28256
28334
|
}
|
|
28257
28335
|
function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
|
|
28258
|
-
const { template, interpolation, defer } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, decl.preserveWhitespaces ?? false, decl.interpolation);
|
|
28336
|
+
const { template, interpolation, defer } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, decl.preserveWhitespaces ?? false, decl.interpolation, decl.deferBlockDependencies);
|
|
28259
28337
|
const declarations = [];
|
|
28260
28338
|
if (decl.dependencies) {
|
|
28261
28339
|
for (const innerDep of decl.dependencies) {
|
|
@@ -28332,7 +28410,7 @@ function convertPipeDeclarationToMetadata(pipe) {
|
|
|
28332
28410
|
type: new WrappedNodeExpr(pipe.type),
|
|
28333
28411
|
};
|
|
28334
28412
|
}
|
|
28335
|
-
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
|
28413
|
+
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation, deferBlockDependencies) {
|
|
28336
28414
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
|
28337
28415
|
// Parse the template and check for errors.
|
|
28338
28416
|
const parsed = parseTemplate(template, sourceMapUrl, { preserveWhitespaces, interpolationConfig });
|
|
@@ -28345,7 +28423,7 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
28345
28423
|
return {
|
|
28346
28424
|
template: parsed,
|
|
28347
28425
|
interpolation: interpolationConfig,
|
|
28348
|
-
defer: createR3ComponentDeferMetadata(boundTarget)
|
|
28426
|
+
defer: createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies)
|
|
28349
28427
|
};
|
|
28350
28428
|
}
|
|
28351
28429
|
/**
|
|
@@ -28401,13 +28479,12 @@ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self,
|
|
|
28401
28479
|
const attributeNameType = isAttributeDep ? literal('unknown') : null;
|
|
28402
28480
|
return { token, attributeNameType, host, optional, self, skipSelf };
|
|
28403
28481
|
}
|
|
28404
|
-
function createR3ComponentDeferMetadata(boundTarget) {
|
|
28482
|
+
function createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies) {
|
|
28405
28483
|
const deferredBlocks = boundTarget.getDeferBlocks();
|
|
28406
28484
|
const blocks = new Map();
|
|
28407
|
-
for (
|
|
28408
|
-
|
|
28409
|
-
|
|
28410
|
-
blocks.set(block, null);
|
|
28485
|
+
for (let i = 0; i < deferredBlocks.length; i++) {
|
|
28486
|
+
const dependencyFn = deferBlockDependencies?.[i];
|
|
28487
|
+
blocks.set(deferredBlocks[i], dependencyFn ? new WrappedNodeExpr(dependencyFn) : null);
|
|
28411
28488
|
}
|
|
28412
28489
|
return { mode: 0 /* DeferBlockDepsEmitMode.PerBlock */, blocks };
|
|
28413
28490
|
}
|
|
@@ -28567,7 +28644,7 @@ function publishFacade(global) {
|
|
|
28567
28644
|
* @description
|
|
28568
28645
|
* Entry point for all public APIs of the compiler package.
|
|
28569
28646
|
*/
|
|
28570
|
-
const VERSION = new Version('18.0.0-next.
|
|
28647
|
+
const VERSION = new Version('18.0.0-next.2');
|
|
28571
28648
|
|
|
28572
28649
|
class CompilerConfig {
|
|
28573
28650
|
constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters } = {}) {
|
|
@@ -30033,16 +30110,17 @@ var FactoryTarget;
|
|
|
30033
30110
|
})(FactoryTarget || (FactoryTarget = {}));
|
|
30034
30111
|
|
|
30035
30112
|
function compileClassMetadata(metadata) {
|
|
30036
|
-
|
|
30037
|
-
|
|
30038
|
-
|
|
30113
|
+
const fnCall = internalCompileClassMetadata(metadata);
|
|
30114
|
+
return arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]).callFn([]);
|
|
30115
|
+
}
|
|
30116
|
+
/** Compiles only the `setClassMetadata` call without any additional wrappers. */
|
|
30117
|
+
function internalCompileClassMetadata(metadata) {
|
|
30118
|
+
return importExpr(Identifiers.setClassMetadata).callFn([
|
|
30039
30119
|
metadata.type,
|
|
30040
30120
|
metadata.decorators,
|
|
30041
30121
|
metadata.ctorParameters ?? literal(null),
|
|
30042
30122
|
metadata.propDecorators ?? literal(null),
|
|
30043
30123
|
]);
|
|
30044
|
-
const iife = arrowFn([], [devOnlyGuardedExpression(fnCall).toStmt()]);
|
|
30045
|
-
return iife.callFn([]);
|
|
30046
30124
|
}
|
|
30047
30125
|
/**
|
|
30048
30126
|
* Wraps the `setClassMetadata` function with extra logic that dynamically
|
|
@@ -30061,42 +30139,54 @@ function compileClassMetadata(metadata) {
|
|
|
30061
30139
|
* Similar to the `setClassMetadata` call, it's wrapped into the `ngDevMode`
|
|
30062
30140
|
* check to tree-shake away this code in production mode.
|
|
30063
30141
|
*/
|
|
30064
|
-
function compileComponentClassMetadata(metadata,
|
|
30065
|
-
if (
|
|
30142
|
+
function compileComponentClassMetadata(metadata, dependencies) {
|
|
30143
|
+
if (dependencies === null || dependencies.length === 0) {
|
|
30066
30144
|
// If there are no deferrable symbols - just generate a regular `setClassMetadata` call.
|
|
30067
30145
|
return compileClassMetadata(metadata);
|
|
30068
30146
|
}
|
|
30069
|
-
|
|
30070
|
-
|
|
30071
|
-
|
|
30147
|
+
return internalCompileSetClassMetadataAsync(metadata, dependencies.map(dep => new FnParam(dep.symbolName, DYNAMIC_TYPE)), compileComponentMetadataAsyncResolver(dependencies));
|
|
30148
|
+
}
|
|
30149
|
+
/**
|
|
30150
|
+
* Identical to `compileComponentClassMetadata`. Used for the cases where we're unable to
|
|
30151
|
+
* analyze the deferred block dependencies, but we have a reference to the compiled
|
|
30152
|
+
* dependency resolver function that we can use as is.
|
|
30153
|
+
* @param metadata Class metadata for the internal `setClassMetadata` call.
|
|
30154
|
+
* @param deferResolver Expression representing the deferred dependency loading function.
|
|
30155
|
+
* @param deferredDependencyNames Names of the dependencies that are being loaded asynchronously.
|
|
30156
|
+
*/
|
|
30157
|
+
function compileOpaqueAsyncClassMetadata(metadata, deferResolver, deferredDependencyNames) {
|
|
30158
|
+
return internalCompileSetClassMetadataAsync(metadata, deferredDependencyNames.map(name => new FnParam(name, DYNAMIC_TYPE)), deferResolver);
|
|
30159
|
+
}
|
|
30160
|
+
/**
|
|
30161
|
+
* Internal logic used to compile a `setClassMetadataAsync` call.
|
|
30162
|
+
* @param metadata Class metadata for the internal `setClassMetadata` call.
|
|
30163
|
+
* @param wrapperParams Parameters to be set on the callback that wraps `setClassMetata`.
|
|
30164
|
+
* @param dependencyResolverFn Function to resolve the deferred dependencies.
|
|
30165
|
+
*/
|
|
30166
|
+
function internalCompileSetClassMetadataAsync(metadata, wrapperParams, dependencyResolverFn) {
|
|
30167
|
+
// Omit the wrapper since it'll be added around `setClassMetadataAsync` instead.
|
|
30168
|
+
const setClassMetadataCall = internalCompileClassMetadata(metadata);
|
|
30169
|
+
const setClassMetaWrapper = arrowFn(wrapperParams, [setClassMetadataCall.toStmt()]);
|
|
30170
|
+
const setClassMetaAsync = importExpr(Identifiers.setClassMetadataAsync).callFn([
|
|
30171
|
+
metadata.type, dependencyResolverFn, setClassMetaWrapper
|
|
30172
|
+
]);
|
|
30173
|
+
return arrowFn([], [devOnlyGuardedExpression(setClassMetaAsync).toStmt()]).callFn([]);
|
|
30174
|
+
}
|
|
30175
|
+
/**
|
|
30176
|
+
* Compiles the function that loads the dependencies for the
|
|
30177
|
+
* entire component in `setClassMetadataAsync`.
|
|
30178
|
+
*/
|
|
30179
|
+
function compileComponentMetadataAsyncResolver(dependencies) {
|
|
30180
|
+
const dynamicImports = dependencies.map(({ symbolName, importPath, isDefaultImport }) => {
|
|
30072
30181
|
// e.g. `(m) => m.CmpA`
|
|
30073
30182
|
const innerFn =
|
|
30074
30183
|
// Default imports are always accessed through the `default` property.
|
|
30075
30184
|
arrowFn([new FnParam('m', DYNAMIC_TYPE)], variable('m').prop(isDefaultImport ? 'default' : symbolName));
|
|
30076
30185
|
// e.g. `import('./cmp-a').then(...)`
|
|
30077
|
-
|
|
30078
|
-
|
|
30079
|
-
importedSymbols.push(new FnParam(symbolName, DYNAMIC_TYPE));
|
|
30080
|
-
}
|
|
30186
|
+
return new DynamicImportExpr(importPath).prop('then').callFn([innerFn]);
|
|
30187
|
+
});
|
|
30081
30188
|
// e.g. `() => [ ... ];`
|
|
30082
|
-
|
|
30083
|
-
// e.g. `setClassMetadata(...)`
|
|
30084
|
-
const setClassMetadataCall = importExpr(Identifiers.setClassMetadata).callFn([
|
|
30085
|
-
metadata.type,
|
|
30086
|
-
metadata.decorators,
|
|
30087
|
-
metadata.ctorParameters ?? literal(null),
|
|
30088
|
-
metadata.propDecorators ?? literal(null),
|
|
30089
|
-
]);
|
|
30090
|
-
// e.g. `(CmpA) => setClassMetadata(...)`
|
|
30091
|
-
const setClassMetaWrapper = arrowFn(importedSymbols, [setClassMetadataCall.toStmt()]);
|
|
30092
|
-
// Final `setClassMetadataAsync()` call with all arguments
|
|
30093
|
-
const setClassMetaAsync = importExpr(Identifiers.setClassMetadataAsync).callFn([
|
|
30094
|
-
metadata.type, dependencyLoadingFn, setClassMetaWrapper
|
|
30095
|
-
]);
|
|
30096
|
-
// Generate an ngDevMode guarded call to `setClassMetadataAsync` with
|
|
30097
|
-
// the class identifier and its metadata, so that this call can be tree-shaken.
|
|
30098
|
-
const iife = arrowFn([], [devOnlyGuardedExpression(setClassMetaAsync).toStmt()]);
|
|
30099
|
-
return iife.callFn([]);
|
|
30189
|
+
return arrowFn([], literalArr(dynamicImports));
|
|
30100
30190
|
}
|
|
30101
30191
|
|
|
30102
30192
|
/**
|
|
@@ -30132,10 +30222,14 @@ function compileClassDebugInfo(debugInfo) {
|
|
|
30132
30222
|
* Do not include any prerelease in these versions as they are ignored.
|
|
30133
30223
|
*/
|
|
30134
30224
|
const MINIMUM_PARTIAL_LINKER_VERSION$5 = '12.0.0';
|
|
30225
|
+
/**
|
|
30226
|
+
* Minimum version at which deferred blocks are supported in the linker.
|
|
30227
|
+
*/
|
|
30228
|
+
const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
30135
30229
|
function compileDeclareClassMetadata(metadata) {
|
|
30136
30230
|
const definitionMap = new DefinitionMap();
|
|
30137
30231
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
30138
|
-
definitionMap.set('version', literal('18.0.0-next.
|
|
30232
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30139
30233
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30140
30234
|
definitionMap.set('type', metadata.type);
|
|
30141
30235
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -30143,6 +30237,23 @@ function compileDeclareClassMetadata(metadata) {
|
|
|
30143
30237
|
definitionMap.set('propDecorators', metadata.propDecorators);
|
|
30144
30238
|
return importExpr(Identifiers.declareClassMetadata).callFn([definitionMap.toLiteralMap()]);
|
|
30145
30239
|
}
|
|
30240
|
+
function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
30241
|
+
if (dependencies === null || dependencies.length === 0) {
|
|
30242
|
+
return compileDeclareClassMetadata(metadata);
|
|
30243
|
+
}
|
|
30244
|
+
const definitionMap = new DefinitionMap();
|
|
30245
|
+
const callbackReturnDefinitionMap = new DefinitionMap();
|
|
30246
|
+
callbackReturnDefinitionMap.set('decorators', metadata.decorators);
|
|
30247
|
+
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
30248
|
+
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
30249
|
+
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
30250
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30251
|
+
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30252
|
+
definitionMap.set('type', metadata.type);
|
|
30253
|
+
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
30254
|
+
definitionMap.set('resolveMetadata', arrowFn(dependencies.map(dep => new FnParam(dep.symbolName, DYNAMIC_TYPE)), callbackReturnDefinitionMap.toLiteralMap()));
|
|
30255
|
+
return importExpr(Identifiers.declareClassMetadataAsync).callFn([definitionMap.toLiteralMap()]);
|
|
30256
|
+
}
|
|
30146
30257
|
|
|
30147
30258
|
/**
|
|
30148
30259
|
* Creates an array literal expression from the given array, mapping all values to an expression
|
|
@@ -30231,7 +30342,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
30231
30342
|
const definitionMap = new DefinitionMap();
|
|
30232
30343
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
30233
30344
|
definitionMap.set('minVersion', literal(minVersion));
|
|
30234
|
-
definitionMap.set('version', literal('18.0.0-next.
|
|
30345
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30235
30346
|
// e.g. `type: MyDirective`
|
|
30236
30347
|
definitionMap.set('type', meta.type.value);
|
|
30237
30348
|
if (meta.isStandalone) {
|
|
@@ -30503,6 +30614,29 @@ function createComponentDefinitionMap(meta, template, templateInfo) {
|
|
|
30503
30614
|
if (template.preserveWhitespaces === true) {
|
|
30504
30615
|
definitionMap.set('preserveWhitespaces', literal(true));
|
|
30505
30616
|
}
|
|
30617
|
+
if (meta.defer.mode === 0 /* DeferBlockDepsEmitMode.PerBlock */) {
|
|
30618
|
+
const resolvers = [];
|
|
30619
|
+
let hasResolvers = false;
|
|
30620
|
+
for (const deps of meta.defer.blocks.values()) {
|
|
30621
|
+
// Note: we need to push a `null` even if there are no dependencies, because matching of
|
|
30622
|
+
// defer resolver functions to defer blocks happens by index and not adding an array
|
|
30623
|
+
// entry for a block can throw off the blocks coming after it.
|
|
30624
|
+
if (deps === null) {
|
|
30625
|
+
resolvers.push(literal(null));
|
|
30626
|
+
}
|
|
30627
|
+
else {
|
|
30628
|
+
resolvers.push(deps);
|
|
30629
|
+
hasResolvers = true;
|
|
30630
|
+
}
|
|
30631
|
+
}
|
|
30632
|
+
// If *all* the resolvers are null, we can skip the field.
|
|
30633
|
+
if (hasResolvers) {
|
|
30634
|
+
definitionMap.set('deferBlockDependencies', literalArr(resolvers));
|
|
30635
|
+
}
|
|
30636
|
+
}
|
|
30637
|
+
else {
|
|
30638
|
+
throw new Error('Unsupported defer function emit mode in partial compilation');
|
|
30639
|
+
}
|
|
30506
30640
|
return definitionMap;
|
|
30507
30641
|
}
|
|
30508
30642
|
function getTemplateExpression(template, templateInfo) {
|
|
@@ -30623,7 +30757,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
30623
30757
|
function compileDeclareFactoryFunction(meta) {
|
|
30624
30758
|
const definitionMap = new DefinitionMap();
|
|
30625
30759
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
30626
|
-
definitionMap.set('version', literal('18.0.0-next.
|
|
30760
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30627
30761
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30628
30762
|
definitionMap.set('type', meta.type.value);
|
|
30629
30763
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -30658,7 +30792,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
30658
30792
|
function createInjectableDefinitionMap(meta) {
|
|
30659
30793
|
const definitionMap = new DefinitionMap();
|
|
30660
30794
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
30661
|
-
definitionMap.set('version', literal('18.0.0-next.
|
|
30795
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30662
30796
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30663
30797
|
definitionMap.set('type', meta.type.value);
|
|
30664
30798
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -30709,7 +30843,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
30709
30843
|
function createInjectorDefinitionMap(meta) {
|
|
30710
30844
|
const definitionMap = new DefinitionMap();
|
|
30711
30845
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
30712
|
-
definitionMap.set('version', literal('18.0.0-next.
|
|
30846
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30713
30847
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30714
30848
|
definitionMap.set('type', meta.type.value);
|
|
30715
30849
|
definitionMap.set('providers', meta.providers);
|
|
@@ -30742,7 +30876,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
30742
30876
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
30743
30877
|
}
|
|
30744
30878
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
30745
|
-
definitionMap.set('version', literal('18.0.0-next.
|
|
30879
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30746
30880
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30747
30881
|
definitionMap.set('type', meta.type.value);
|
|
30748
30882
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -30793,7 +30927,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
30793
30927
|
function createPipeDefinitionMap(meta) {
|
|
30794
30928
|
const definitionMap = new DefinitionMap();
|
|
30795
30929
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
30796
|
-
definitionMap.set('version', literal('18.0.0-next.
|
|
30930
|
+
definitionMap.set('version', literal('18.0.0-next.2'));
|
|
30797
30931
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
30798
30932
|
// e.g. `type: MyPipe`
|
|
30799
30933
|
definitionMap.set('type', meta.type.value);
|
|
@@ -30826,5 +30960,5 @@ publishFacade(_global);
|
|
|
30826
30960
|
|
|
30827
30961
|
// This file is not used to build this module. It is only used during editing
|
|
30828
30962
|
|
|
30829
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
30963
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, ArrowFunctionExpr, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BindingType, Block, BlockParameter, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, DynamicImportExpr, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr$1 as EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation$1 as Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedEventType, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3NgModuleMetadataKind, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BlockNode as TmplAstBlockNode, BoundAttribute as TmplAstBoundAttribute, BoundDeferredTrigger as TmplAstBoundDeferredTrigger, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, DeferredBlock as TmplAstDeferredBlock, DeferredBlockError as TmplAstDeferredBlockError, DeferredBlockLoading as TmplAstDeferredBlockLoading, DeferredBlockPlaceholder as TmplAstDeferredBlockPlaceholder, DeferredTrigger as TmplAstDeferredTrigger, Element$1 as TmplAstElement, ForLoopBlock as TmplAstForLoopBlock, ForLoopBlockEmpty as TmplAstForLoopBlockEmpty, HoverDeferredTrigger as TmplAstHoverDeferredTrigger, Icu$1 as TmplAstIcu, IdleDeferredTrigger as TmplAstIdleDeferredTrigger, IfBlock as TmplAstIfBlock, IfBlockBranch as TmplAstIfBlockBranch, ImmediateDeferredTrigger as TmplAstImmediateDeferredTrigger, InteractionDeferredTrigger as TmplAstInteractionDeferredTrigger, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, SwitchBlock as TmplAstSwitchBlock, SwitchBlockCase as TmplAstSwitchBlockCase, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, TimerDeferredTrigger as TmplAstTimerDeferredTrigger, UnknownBlock as TmplAstUnknownBlock, Variable as TmplAstVariable, ViewportDeferredTrigger as TmplAstViewportDeferredTrigger, Token, TokenType, TransplantedType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, compileClassDebugInfo, compileClassMetadata, compileComponentClassMetadata, compileComponentDeclareClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDeferResolverFunction, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compileOpaqueAsyncClassMetadata, compilePipeFromMetadata, computeMsgId, core, createCssSelectorFromNode, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, encapsulateStyle, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literal, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, visitAll$1 as tmplAstVisitAll, verifyHostBindings, visitAll };
|
|
30830
30964
|
//# sourceMappingURL=compiler.mjs.map
|