@angular/compiler 19.0.1 → 19.0.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/fesm2022/compiler.mjs +41 -35
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +21 -13
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.0.
|
|
2
|
+
* @license Angular v19.0.2
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -11127,6 +11127,7 @@ function createDeferOp(xref, main, mainSlot, ownResolverFn, resolverFn, sourceSp
|
|
|
11127
11127
|
errorSlot: null,
|
|
11128
11128
|
ownResolverFn,
|
|
11129
11129
|
resolverFn,
|
|
11130
|
+
flags: null,
|
|
11130
11131
|
sourceSpan,
|
|
11131
11132
|
...NEW_OP,
|
|
11132
11133
|
...TRAIT_CONSUMES_SLOT,
|
|
@@ -22557,7 +22558,7 @@ function text(slot, initialValue, sourceSpan) {
|
|
|
22557
22558
|
}
|
|
22558
22559
|
return call(Identifiers.text, args, sourceSpan);
|
|
22559
22560
|
}
|
|
22560
|
-
function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan) {
|
|
22561
|
+
function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan, flags) {
|
|
22561
22562
|
const args = [
|
|
22562
22563
|
literal(selfSlot),
|
|
22563
22564
|
literal(primarySlot),
|
|
@@ -22568,6 +22569,7 @@ function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeho
|
|
|
22568
22569
|
loadingConfig ?? literal(null),
|
|
22569
22570
|
placeholderConfig ?? literal(null),
|
|
22570
22571
|
enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal(null),
|
|
22572
|
+
literal(flags),
|
|
22571
22573
|
];
|
|
22572
22574
|
let expr;
|
|
22573
22575
|
while ((expr = args[args.length - 1]) !== null &&
|
|
@@ -23186,7 +23188,7 @@ function reifyCreateOperations(unit, ops) {
|
|
|
23186
23188
|
break;
|
|
23187
23189
|
case OpKind.Defer:
|
|
23188
23190
|
const timerScheduling = !!op.loadingMinimumTime || !!op.loadingAfterTime || !!op.placeholderMinimumTime;
|
|
23189
|
-
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, op.resolverFn, op.loadingSlot?.slot ?? null, op.placeholderSlot?.slot ?? null, op.errorSlot?.slot ?? null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan));
|
|
23191
|
+
OpList.replace(op, defer(op.handle.slot, op.mainSlot.slot, op.resolverFn, op.loadingSlot?.slot ?? null, op.placeholderSlot?.slot ?? null, op.errorSlot?.slot ?? null, op.loadingConfig, op.placeholderConfig, timerScheduling, op.sourceSpan, op.flags));
|
|
23190
23192
|
break;
|
|
23191
23193
|
case OpKind.DeferOn:
|
|
23192
23194
|
let args = [];
|
|
@@ -25765,6 +25767,7 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
25765
25767
|
deferOp.placeholderMinimumTime = deferBlock.placeholder?.minimumTime ?? null;
|
|
25766
25768
|
deferOp.loadingMinimumTime = deferBlock.loading?.minimumTime ?? null;
|
|
25767
25769
|
deferOp.loadingAfterTime = deferBlock.loading?.afterTime ?? null;
|
|
25770
|
+
deferOp.flags = calcDeferBlockFlags(deferBlock);
|
|
25768
25771
|
unit.create.push(deferOp);
|
|
25769
25772
|
// Configure all defer `on` conditions.
|
|
25770
25773
|
// TODO: refactor prefetch triggers to use a separate op type, with a shared superclass. This will
|
|
@@ -25784,6 +25787,12 @@ function ingestDeferBlock(unit, deferBlock) {
|
|
|
25784
25787
|
unit.create.push(deferOnOps);
|
|
25785
25788
|
unit.update.push(deferWhenOps);
|
|
25786
25789
|
}
|
|
25790
|
+
function calcDeferBlockFlags(deferBlockDetails) {
|
|
25791
|
+
if (Object.keys(deferBlockDetails.hydrateTriggers).length > 0) {
|
|
25792
|
+
return 1 /* ir.TDeferDetailsFlags.HasHydrateTriggers */;
|
|
25793
|
+
}
|
|
25794
|
+
return null;
|
|
25795
|
+
}
|
|
25787
25796
|
function ingestDeferTriggers(modifier, triggers, onOps, whenOps, unit, deferXref) {
|
|
25788
25797
|
if (triggers.idle !== undefined) {
|
|
25789
25798
|
const deferOnOp = createDeferOnOp(deferXref, { kind: DeferTriggerKind.Idle }, modifier, triggers.idle.sourceSpan);
|
|
@@ -26633,13 +26642,11 @@ class BindingParser {
|
|
|
26633
26642
|
_interpolationConfig;
|
|
26634
26643
|
_schemaRegistry;
|
|
26635
26644
|
errors;
|
|
26636
|
-
|
|
26637
|
-
constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors, _allowInvalidAssignmentEvents = false) {
|
|
26645
|
+
constructor(_exprParser, _interpolationConfig, _schemaRegistry, errors) {
|
|
26638
26646
|
this._exprParser = _exprParser;
|
|
26639
26647
|
this._interpolationConfig = _interpolationConfig;
|
|
26640
26648
|
this._schemaRegistry = _schemaRegistry;
|
|
26641
26649
|
this.errors = errors;
|
|
26642
|
-
this._allowInvalidAssignmentEvents = _allowInvalidAssignmentEvents;
|
|
26643
26650
|
}
|
|
26644
26651
|
get interpolationConfig() {
|
|
26645
26652
|
return this._interpolationConfig;
|
|
@@ -27023,16 +27030,7 @@ class BindingParser {
|
|
|
27023
27030
|
if (ast instanceof PropertyRead || ast instanceof KeyedRead) {
|
|
27024
27031
|
return true;
|
|
27025
27032
|
}
|
|
27026
|
-
|
|
27027
|
-
// from invalid bindings. It should be removed once the migration is deleted.
|
|
27028
|
-
if (!this._allowInvalidAssignmentEvents) {
|
|
27029
|
-
return false;
|
|
27030
|
-
}
|
|
27031
|
-
if (ast instanceof Binary) {
|
|
27032
|
-
return ((ast.operation === '&&' || ast.operation === '||' || ast.operation === '??') &&
|
|
27033
|
-
(ast.right instanceof PropertyRead || ast.right instanceof KeyedRead));
|
|
27034
|
-
}
|
|
27035
|
-
return ast instanceof Conditional || ast instanceof PrefixNot;
|
|
27033
|
+
return false;
|
|
27036
27034
|
}
|
|
27037
27035
|
}
|
|
27038
27036
|
class PipeCollector extends RecursiveAstVisitor {
|
|
@@ -28665,8 +28663,8 @@ const LEADING_TRIVIA_CHARS = [' ', '\n', '\r', '\t'];
|
|
|
28665
28663
|
* @param options options to modify how the template is parsed
|
|
28666
28664
|
*/
|
|
28667
28665
|
function parseTemplate(template, templateUrl, options = {}) {
|
|
28668
|
-
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat
|
|
28669
|
-
const bindingParser = makeBindingParser(interpolationConfig
|
|
28666
|
+
const { interpolationConfig, preserveWhitespaces, enableI18nLegacyMessageIdFormat } = options;
|
|
28667
|
+
const bindingParser = makeBindingParser(interpolationConfig);
|
|
28670
28668
|
const htmlParser = new HtmlParser();
|
|
28671
28669
|
const parseResult = htmlParser.parse(template, templateUrl, {
|
|
28672
28670
|
leadingTriviaChars: LEADING_TRIVIA_CHARS,
|
|
@@ -28772,8 +28770,8 @@ const elementRegistry = new DomElementSchemaRegistry();
|
|
|
28772
28770
|
/**
|
|
28773
28771
|
* Construct a `BindingParser` with a default configuration.
|
|
28774
28772
|
*/
|
|
28775
|
-
function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG
|
|
28776
|
-
return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, []
|
|
28773
|
+
function makeBindingParser(interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
|
|
28774
|
+
return new BindingParser(new Parser(new Lexer()), interpolationConfig, elementRegistry, []);
|
|
28777
28775
|
}
|
|
28778
28776
|
|
|
28779
28777
|
const COMPONENT_VARIABLE = '%COMP%';
|
|
@@ -30885,7 +30883,7 @@ function publishFacade(global) {
|
|
|
30885
30883
|
* @description
|
|
30886
30884
|
* Entry point for all public APIs of the compiler package.
|
|
30887
30885
|
*/
|
|
30888
|
-
const VERSION = new Version('19.0.
|
|
30886
|
+
const VERSION = new Version('19.0.2');
|
|
30889
30887
|
|
|
30890
30888
|
class CompilerConfig {
|
|
30891
30889
|
defaultEncapsulation;
|
|
@@ -32642,12 +32640,15 @@ function compileHmrInitializer(meta) {
|
|
|
32642
32640
|
const dataName = 'd';
|
|
32643
32641
|
const timestampName = 't';
|
|
32644
32642
|
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
32645
|
-
const locals = meta.
|
|
32643
|
+
const locals = meta.localDependencies.map((localName) => variable(localName));
|
|
32644
|
+
const namespaces = meta.namespaceDependencies.map((dep) => {
|
|
32645
|
+
return new ExternalExpr({ moduleName: dep.moduleName, name: null });
|
|
32646
|
+
});
|
|
32646
32647
|
// m.default
|
|
32647
32648
|
const defaultRead = variable(moduleName).prop('default');
|
|
32648
|
-
// ɵɵreplaceMetadata(Comp, m.default, [...]);
|
|
32649
|
+
// ɵɵreplaceMetadata(Comp, m.default, [...namespaces], [...locals]);
|
|
32649
32650
|
const replaceCall = importExpr(Identifiers.replaceMetadata)
|
|
32650
|
-
.callFn([meta.type, defaultRead,
|
|
32651
|
+
.callFn([meta.type, defaultRead, literalArr(namespaces), literalArr(locals)]);
|
|
32651
32652
|
// (m) => m.default && ɵɵreplaceMetadata(...)
|
|
32652
32653
|
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
32653
32654
|
// '<urlPartial>' + encodeURIComponent(t)
|
|
@@ -32700,9 +32701,14 @@ function compileHmrInitializer(meta) {
|
|
|
32700
32701
|
* @param meta HMR metadata extracted from the class.
|
|
32701
32702
|
*/
|
|
32702
32703
|
function compileHmrUpdateCallback(definitions, constantStatements, meta) {
|
|
32703
|
-
|
|
32704
|
-
const params = [meta.className,
|
|
32705
|
-
const body = [
|
|
32704
|
+
const namespaces = 'ɵɵnamespaces';
|
|
32705
|
+
const params = [meta.className, namespaces, ...meta.localDependencies].map((name) => new FnParam(name, DYNAMIC_TYPE));
|
|
32706
|
+
const body = [];
|
|
32707
|
+
// Declare variables that read out the individual namespaces.
|
|
32708
|
+
for (let i = 0; i < meta.namespaceDependencies.length; i++) {
|
|
32709
|
+
body.push(new DeclareVarStmt(meta.namespaceDependencies[i].assignedName, variable(namespaces).key(literal(i)), DYNAMIC_TYPE, StmtModifier.Final));
|
|
32710
|
+
}
|
|
32711
|
+
body.push(...constantStatements);
|
|
32706
32712
|
for (const field of definitions) {
|
|
32707
32713
|
if (field.initializer !== null) {
|
|
32708
32714
|
body.push(variable(meta.className).prop(field.name).set(field.initializer).toStmt());
|
|
@@ -32729,7 +32735,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32729
32735
|
function compileDeclareClassMetadata(metadata) {
|
|
32730
32736
|
const definitionMap = new DefinitionMap();
|
|
32731
32737
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32732
|
-
definitionMap.set('version', literal('19.0.
|
|
32738
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
32733
32739
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32734
32740
|
definitionMap.set('type', metadata.type);
|
|
32735
32741
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32747,7 +32753,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32747
32753
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32748
32754
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32749
32755
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32750
|
-
definitionMap.set('version', literal('19.0.
|
|
32756
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
32751
32757
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32752
32758
|
definitionMap.set('type', metadata.type);
|
|
32753
32759
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -32842,7 +32848,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32842
32848
|
const definitionMap = new DefinitionMap();
|
|
32843
32849
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
32844
32850
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32845
|
-
definitionMap.set('version', literal('19.0.
|
|
32851
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
32846
32852
|
// e.g. `type: MyDirective`
|
|
32847
32853
|
definitionMap.set('type', meta.type.value);
|
|
32848
32854
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33261,7 +33267,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33261
33267
|
function compileDeclareFactoryFunction(meta) {
|
|
33262
33268
|
const definitionMap = new DefinitionMap();
|
|
33263
33269
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33264
|
-
definitionMap.set('version', literal('19.0.
|
|
33270
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
33265
33271
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33266
33272
|
definitionMap.set('type', meta.type.value);
|
|
33267
33273
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33296,7 +33302,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33296
33302
|
function createInjectableDefinitionMap(meta) {
|
|
33297
33303
|
const definitionMap = new DefinitionMap();
|
|
33298
33304
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33299
|
-
definitionMap.set('version', literal('19.0.
|
|
33305
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
33300
33306
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33301
33307
|
definitionMap.set('type', meta.type.value);
|
|
33302
33308
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33347,7 +33353,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33347
33353
|
function createInjectorDefinitionMap(meta) {
|
|
33348
33354
|
const definitionMap = new DefinitionMap();
|
|
33349
33355
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33350
|
-
definitionMap.set('version', literal('19.0.
|
|
33356
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
33351
33357
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33352
33358
|
definitionMap.set('type', meta.type.value);
|
|
33353
33359
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33380,7 +33386,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33380
33386
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33381
33387
|
}
|
|
33382
33388
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33383
|
-
definitionMap.set('version', literal('19.0.
|
|
33389
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
33384
33390
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33385
33391
|
definitionMap.set('type', meta.type.value);
|
|
33386
33392
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33431,7 +33437,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33431
33437
|
function createPipeDefinitionMap(meta) {
|
|
33432
33438
|
const definitionMap = new DefinitionMap();
|
|
33433
33439
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33434
|
-
definitionMap.set('version', literal('19.0.
|
|
33440
|
+
definitionMap.set('version', literal('19.0.2'));
|
|
33435
33441
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33436
33442
|
// e.g. `type: MyPipe`
|
|
33437
33443
|
definitionMap.set('type', meta.type.value);
|