@angular/compiler 20.0.0-next.8 → 20.0.0-next.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/compiler.mjs +57 -62
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +16 -9
- package/package.json +1 -1
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v20.0.0-next.
|
|
2
|
+
* @license Angular v20.0.0-next.9
|
|
3
3
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -403,7 +403,7 @@ class SelectorlessMatcher {
|
|
|
403
403
|
this.registry = registry;
|
|
404
404
|
}
|
|
405
405
|
match(name) {
|
|
406
|
-
return this.registry.get(name)
|
|
406
|
+
return this.registry.has(name) ? this.registry.get(name) : [];
|
|
407
407
|
}
|
|
408
408
|
}
|
|
409
409
|
|
|
@@ -26448,6 +26448,7 @@ function ingestNodes(unit, template) {
|
|
|
26448
26448
|
else if (node instanceof LetDeclaration$1) {
|
|
26449
26449
|
ingestLetDeclaration(unit, node);
|
|
26450
26450
|
}
|
|
26451
|
+
else if (node instanceof Component$1) ;
|
|
26451
26452
|
else {
|
|
26452
26453
|
throw new Error(`Unsupported template node: ${node.constructor.name}`);
|
|
26453
26454
|
}
|
|
@@ -30509,6 +30510,7 @@ class R3TargetBinder {
|
|
|
30509
30510
|
}
|
|
30510
30511
|
const directives = new Map();
|
|
30511
30512
|
const eagerDirectives = [];
|
|
30513
|
+
const missingDirectives = new Set();
|
|
30512
30514
|
const bindings = new Map();
|
|
30513
30515
|
const references = new Map();
|
|
30514
30516
|
const scopedNodeEntities = new Map();
|
|
@@ -30529,7 +30531,9 @@ class R3TargetBinder {
|
|
|
30529
30531
|
// - bindings: Map of inputs, outputs, and attributes to the directive/element that claims
|
|
30530
30532
|
// them. TODO(alxhub): handle multiple directives claiming an input/output/etc.
|
|
30531
30533
|
// - references: Map of #references to their targets.
|
|
30532
|
-
|
|
30534
|
+
if (this.directiveMatcher !== null) {
|
|
30535
|
+
DirectiveBinder.apply(target.template, this.directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
30536
|
+
}
|
|
30533
30537
|
// Finally, run the TemplateBinder to bind references, variables, and other entities within the
|
|
30534
30538
|
// template. This extracts all the metadata that doesn't depend on directive matching.
|
|
30535
30539
|
TemplateBinder.applyWithScope(target.template, scope, expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
@@ -30539,7 +30543,7 @@ class R3TargetBinder {
|
|
|
30539
30543
|
if (target.host) {
|
|
30540
30544
|
TemplateBinder.applyWithScope(target.host, Scope.apply(target.host), expressions, symbols, nestingLevel, usedPipes, eagerPipes, deferBlocks);
|
|
30541
30545
|
}
|
|
30542
|
-
return new R3BoundTarget(target, directives, eagerDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
30546
|
+
return new R3BoundTarget(target, directives, eagerDirectives, missingDirectives, bindings, references, expressions, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, deferBlocks);
|
|
30543
30547
|
}
|
|
30544
30548
|
}
|
|
30545
30549
|
/**
|
|
@@ -30751,14 +30755,16 @@ class DirectiveBinder {
|
|
|
30751
30755
|
directiveMatcher;
|
|
30752
30756
|
directives;
|
|
30753
30757
|
eagerDirectives;
|
|
30758
|
+
missingDirectives;
|
|
30754
30759
|
bindings;
|
|
30755
30760
|
references;
|
|
30756
30761
|
// Indicates whether we are visiting elements within a `defer` block
|
|
30757
30762
|
isInDeferBlock = false;
|
|
30758
|
-
constructor(directiveMatcher, directives, eagerDirectives, bindings, references) {
|
|
30763
|
+
constructor(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references) {
|
|
30759
30764
|
this.directiveMatcher = directiveMatcher;
|
|
30760
30765
|
this.directives = directives;
|
|
30761
30766
|
this.eagerDirectives = eagerDirectives;
|
|
30767
|
+
this.missingDirectives = missingDirectives;
|
|
30762
30768
|
this.bindings = bindings;
|
|
30763
30769
|
this.references = references;
|
|
30764
30770
|
}
|
|
@@ -30774,8 +30780,8 @@ class DirectiveBinder {
|
|
|
30774
30780
|
* map which resolves #references (`Reference`s) within the template to the named directive or
|
|
30775
30781
|
* template node.
|
|
30776
30782
|
*/
|
|
30777
|
-
static apply(template, directiveMatcher, directives, eagerDirectives, bindings, references) {
|
|
30778
|
-
const matcher = new DirectiveBinder(directiveMatcher, directives, eagerDirectives, bindings, references);
|
|
30783
|
+
static apply(template, directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references) {
|
|
30784
|
+
const matcher = new DirectiveBinder(directiveMatcher, directives, eagerDirectives, missingDirectives, bindings, references);
|
|
30779
30785
|
matcher.ingest(template);
|
|
30780
30786
|
}
|
|
30781
30787
|
ingest(template) {
|
|
@@ -30831,55 +30837,36 @@ class DirectiveBinder {
|
|
|
30831
30837
|
content.children.forEach((child) => child.visit(this));
|
|
30832
30838
|
}
|
|
30833
30839
|
visitComponent(node) {
|
|
30834
|
-
const directives = [];
|
|
30835
|
-
let componentMetas = null;
|
|
30836
30840
|
if (this.directiveMatcher instanceof SelectorlessMatcher) {
|
|
30837
|
-
|
|
30838
|
-
if (
|
|
30839
|
-
|
|
30841
|
+
const componentMatches = this.directiveMatcher.match(node.componentName);
|
|
30842
|
+
if (componentMatches.length > 0) {
|
|
30843
|
+
this.trackSelectorlessMatchesAndDirectives(node, componentMatches);
|
|
30840
30844
|
}
|
|
30841
|
-
|
|
30842
|
-
|
|
30843
|
-
if (directiveMetas !== null) {
|
|
30844
|
-
directives.push(...directiveMetas);
|
|
30845
|
-
}
|
|
30845
|
+
else {
|
|
30846
|
+
this.missingDirectives.add(node.componentName);
|
|
30846
30847
|
}
|
|
30847
30848
|
}
|
|
30848
|
-
this.trackMatchedDirectives(node, directives);
|
|
30849
|
-
if (componentMetas !== null) {
|
|
30850
|
-
this.trackSelectorlessBindings(node, componentMetas);
|
|
30851
|
-
}
|
|
30852
30849
|
node.directives.forEach((directive) => directive.visit(this));
|
|
30853
30850
|
node.children.forEach((child) => child.visit(this));
|
|
30854
30851
|
}
|
|
30855
30852
|
visitDirective(node) {
|
|
30856
|
-
|
|
30857
|
-
|
|
30858
|
-
|
|
30859
|
-
|
|
30860
|
-
|
|
30853
|
+
if (this.directiveMatcher instanceof SelectorlessMatcher) {
|
|
30854
|
+
const directives = this.directiveMatcher.match(node.name);
|
|
30855
|
+
if (directives.length > 0) {
|
|
30856
|
+
this.trackSelectorlessMatchesAndDirectives(node, directives);
|
|
30857
|
+
}
|
|
30858
|
+
else {
|
|
30859
|
+
this.missingDirectives.add(node.name);
|
|
30860
|
+
}
|
|
30861
30861
|
}
|
|
30862
30862
|
}
|
|
30863
30863
|
visitElementOrTemplate(node) {
|
|
30864
|
-
const directives = [];
|
|
30865
30864
|
if (this.directiveMatcher instanceof SelectorMatcher) {
|
|
30866
|
-
|
|
30867
|
-
// Do this by building up a `CssSelector` for the node.
|
|
30865
|
+
const directives = [];
|
|
30868
30866
|
const cssSelector = createCssSelectorFromNode(node);
|
|
30869
|
-
this.directiveMatcher.match(cssSelector, (
|
|
30870
|
-
|
|
30871
|
-
});
|
|
30872
|
-
this.trackSelectorMatchedBindings(node, directives);
|
|
30873
|
-
}
|
|
30874
|
-
else {
|
|
30875
|
-
for (const directive of node.directives) {
|
|
30876
|
-
const matchedDirectives = this.directiveMatcher.match(directive.name);
|
|
30877
|
-
if (matchedDirectives !== null) {
|
|
30878
|
-
directives.push(...matchedDirectives);
|
|
30879
|
-
}
|
|
30880
|
-
}
|
|
30867
|
+
this.directiveMatcher.match(cssSelector, (_, results) => directives.push(...results));
|
|
30868
|
+
this.trackSelectorBasedBindingsAndDirectives(node, directives);
|
|
30881
30869
|
}
|
|
30882
|
-
this.trackMatchedDirectives(node, directives);
|
|
30883
30870
|
node.directives.forEach((directive) => directive.visit(this));
|
|
30884
30871
|
node.children.forEach((child) => child.visit(this));
|
|
30885
30872
|
}
|
|
@@ -30891,25 +30878,28 @@ class DirectiveBinder {
|
|
|
30891
30878
|
}
|
|
30892
30879
|
}
|
|
30893
30880
|
}
|
|
30894
|
-
|
|
30881
|
+
trackSelectorlessMatchesAndDirectives(node, directives) {
|
|
30882
|
+
if (directives.length === 0) {
|
|
30883
|
+
return;
|
|
30884
|
+
}
|
|
30885
|
+
this.trackMatchedDirectives(node, directives);
|
|
30895
30886
|
const setBinding = (meta, attribute, ioType) => {
|
|
30896
30887
|
if (meta[ioType].hasBindingPropertyName(attribute.name)) {
|
|
30897
30888
|
this.bindings.set(attribute, meta);
|
|
30898
30889
|
}
|
|
30899
30890
|
};
|
|
30900
|
-
for (const
|
|
30901
|
-
node.inputs.forEach((input) => setBinding(
|
|
30902
|
-
node.attributes.forEach((attr) => setBinding(
|
|
30903
|
-
node.outputs.forEach((output) => setBinding(
|
|
30891
|
+
for (const directive of directives) {
|
|
30892
|
+
node.inputs.forEach((input) => setBinding(directive, input, 'inputs'));
|
|
30893
|
+
node.attributes.forEach((attr) => setBinding(directive, attr, 'inputs'));
|
|
30894
|
+
node.outputs.forEach((output) => setBinding(directive, output, 'outputs'));
|
|
30904
30895
|
}
|
|
30905
30896
|
// TODO(crisbeto): currently it's unclear how references should behave under selectorless,
|
|
30906
30897
|
// given that there's one named class which can bring in multiple host directives.
|
|
30907
30898
|
// For the time being only register the first directive as the reference target.
|
|
30908
|
-
|
|
30909
|
-
node.references.forEach((ref) => this.references.set(ref, { directive: metas[0], node: node }));
|
|
30910
|
-
}
|
|
30899
|
+
node.references.forEach((ref) => this.references.set(ref, { directive: directives[0], node: node }));
|
|
30911
30900
|
}
|
|
30912
|
-
|
|
30901
|
+
trackSelectorBasedBindingsAndDirectives(node, directives) {
|
|
30902
|
+
this.trackMatchedDirectives(node, directives);
|
|
30913
30903
|
// Resolve any references that are created on this node.
|
|
30914
30904
|
node.references.forEach((ref) => {
|
|
30915
30905
|
let dirTarget = null;
|
|
@@ -31243,6 +31233,7 @@ class R3BoundTarget {
|
|
|
31243
31233
|
target;
|
|
31244
31234
|
directives;
|
|
31245
31235
|
eagerDirectives;
|
|
31236
|
+
missingDirectives;
|
|
31246
31237
|
bindings;
|
|
31247
31238
|
references;
|
|
31248
31239
|
exprTargets;
|
|
@@ -31255,10 +31246,11 @@ class R3BoundTarget {
|
|
|
31255
31246
|
deferredBlocks;
|
|
31256
31247
|
/** Map of deferred blocks to their scope. */
|
|
31257
31248
|
deferredScopes;
|
|
31258
|
-
constructor(target, directives, eagerDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
|
|
31249
|
+
constructor(target, directives, eagerDirectives, missingDirectives, bindings, references, exprTargets, symbols, nestingLevel, scopedNodeEntities, usedPipes, eagerPipes, rawDeferred) {
|
|
31259
31250
|
this.target = target;
|
|
31260
31251
|
this.directives = directives;
|
|
31261
31252
|
this.eagerDirectives = eagerDirectives;
|
|
31253
|
+
this.missingDirectives = missingDirectives;
|
|
31262
31254
|
this.bindings = bindings;
|
|
31263
31255
|
this.references = references;
|
|
31264
31256
|
this.exprTargets = exprTargets;
|
|
@@ -31374,6 +31366,9 @@ class R3BoundTarget {
|
|
|
31374
31366
|
}
|
|
31375
31367
|
return false;
|
|
31376
31368
|
}
|
|
31369
|
+
referencedDirectiveExists(name) {
|
|
31370
|
+
return !this.missingDirectives.has(name);
|
|
31371
|
+
}
|
|
31377
31372
|
/**
|
|
31378
31373
|
* Finds an entity with a specific name in a scope.
|
|
31379
31374
|
* @param rootNode Root node of the scope.
|
|
@@ -31876,7 +31871,7 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
31876
31871
|
const errors = parsed.errors.map((err) => err.toString()).join(', ');
|
|
31877
31872
|
throw new Error(`Errors during JIT compilation of template for ${typeName}: ${errors}`);
|
|
31878
31873
|
}
|
|
31879
|
-
const binder = new R3TargetBinder(
|
|
31874
|
+
const binder = new R3TargetBinder(null);
|
|
31880
31875
|
const boundTarget = binder.bind({ template: parsed.nodes });
|
|
31881
31876
|
return {
|
|
31882
31877
|
template: parsed,
|
|
@@ -33875,7 +33870,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
33875
33870
|
function compileDeclareClassMetadata(metadata) {
|
|
33876
33871
|
const definitionMap = new DefinitionMap();
|
|
33877
33872
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
33878
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33873
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
33879
33874
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33880
33875
|
definitionMap.set('type', metadata.type);
|
|
33881
33876
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -33893,7 +33888,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
33893
33888
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
33894
33889
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
33895
33890
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
33896
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33891
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
33897
33892
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33898
33893
|
definitionMap.set('type', metadata.type);
|
|
33899
33894
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -33988,7 +33983,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
33988
33983
|
const definitionMap = new DefinitionMap();
|
|
33989
33984
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
33990
33985
|
definitionMap.set('minVersion', literal(minVersion));
|
|
33991
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
33986
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
33992
33987
|
// e.g. `type: MyDirective`
|
|
33993
33988
|
definitionMap.set('type', meta.type.value);
|
|
33994
33989
|
if (meta.isStandalone !== undefined) {
|
|
@@ -34404,7 +34399,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
34404
34399
|
function compileDeclareFactoryFunction(meta) {
|
|
34405
34400
|
const definitionMap = new DefinitionMap();
|
|
34406
34401
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
34407
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
34402
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
34408
34403
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34409
34404
|
definitionMap.set('type', meta.type.value);
|
|
34410
34405
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -34439,7 +34434,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
34439
34434
|
function createInjectableDefinitionMap(meta) {
|
|
34440
34435
|
const definitionMap = new DefinitionMap();
|
|
34441
34436
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
34442
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
34437
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
34443
34438
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34444
34439
|
definitionMap.set('type', meta.type.value);
|
|
34445
34440
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -34490,7 +34485,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
34490
34485
|
function createInjectorDefinitionMap(meta) {
|
|
34491
34486
|
const definitionMap = new DefinitionMap();
|
|
34492
34487
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
34493
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
34488
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
34494
34489
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34495
34490
|
definitionMap.set('type', meta.type.value);
|
|
34496
34491
|
definitionMap.set('providers', meta.providers);
|
|
@@ -34523,7 +34518,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
34523
34518
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
34524
34519
|
}
|
|
34525
34520
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
34526
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
34521
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
34527
34522
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34528
34523
|
definitionMap.set('type', meta.type.value);
|
|
34529
34524
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -34574,7 +34569,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
34574
34569
|
function createPipeDefinitionMap(meta) {
|
|
34575
34570
|
const definitionMap = new DefinitionMap();
|
|
34576
34571
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
34577
|
-
definitionMap.set('version', literal('20.0.0-next.
|
|
34572
|
+
definitionMap.set('version', literal('20.0.0-next.9'));
|
|
34578
34573
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
34579
34574
|
// e.g. `type: MyPipe`
|
|
34580
34575
|
definitionMap.set('type', meta.type.value);
|
|
@@ -34732,7 +34727,7 @@ function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
|
34732
34727
|
* @description
|
|
34733
34728
|
* Entry point for all public APIs of the compiler package.
|
|
34734
34729
|
*/
|
|
34735
|
-
const VERSION = new Version('20.0.0-next.
|
|
34730
|
+
const VERSION = new Version('20.0.0-next.9');
|
|
34736
34731
|
|
|
34737
34732
|
//////////////////////////////////////
|
|
34738
34733
|
// THIS FILE HAS GLOBAL SIDE EFFECT //
|