@angular/compiler 19.0.0-rc.0 → 19.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/compiler.mjs +54 -33
- package/fesm2022/compiler.mjs.map +1 -1
- package/index.d.ts +2 -3
- package/package.json +2 -2
package/fesm2022/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v19.0.0-rc.
|
|
2
|
+
* @license Angular v19.0.0-rc.1
|
|
3
3
|
* (c) 2010-2024 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -1446,8 +1446,7 @@ class ExternalExpr extends Expression {
|
|
|
1446
1446
|
isEquivalent(e) {
|
|
1447
1447
|
return (e instanceof ExternalExpr &&
|
|
1448
1448
|
this.value.name === e.value.name &&
|
|
1449
|
-
this.value.moduleName === e.value.moduleName
|
|
1450
|
-
this.value.runtime === e.value.runtime);
|
|
1449
|
+
this.value.moduleName === e.value.moduleName);
|
|
1451
1450
|
}
|
|
1452
1451
|
isConstant() {
|
|
1453
1452
|
return false;
|
|
@@ -1462,11 +1461,9 @@ class ExternalExpr extends Expression {
|
|
|
1462
1461
|
class ExternalReference {
|
|
1463
1462
|
moduleName;
|
|
1464
1463
|
name;
|
|
1465
|
-
|
|
1466
|
-
constructor(moduleName, name, runtime) {
|
|
1464
|
+
constructor(moduleName, name) {
|
|
1467
1465
|
this.moduleName = moduleName;
|
|
1468
1466
|
this.name = name;
|
|
1469
|
-
this.runtime = runtime;
|
|
1470
1467
|
}
|
|
1471
1468
|
}
|
|
1472
1469
|
class ConditionalExpr extends Expression {
|
|
@@ -30839,7 +30836,7 @@ function publishFacade(global) {
|
|
|
30839
30836
|
* @description
|
|
30840
30837
|
* Entry point for all public APIs of the compiler package.
|
|
30841
30838
|
*/
|
|
30842
|
-
const VERSION = new Version('19.0.0-rc.
|
|
30839
|
+
const VERSION = new Version('19.0.0-rc.1');
|
|
30843
30840
|
|
|
30844
30841
|
class CompilerConfig {
|
|
30845
30842
|
defaultEncapsulation;
|
|
@@ -32594,33 +32591,57 @@ function compileHmrInitializer(meta) {
|
|
|
32594
32591
|
const urlPartial = `/@ng/component?c=${id}&t=`;
|
|
32595
32592
|
const moduleName = 'm';
|
|
32596
32593
|
const dataName = 'd';
|
|
32594
|
+
const timestampName = 't';
|
|
32595
|
+
const importCallbackName = `${meta.className}_HmrLoad`;
|
|
32597
32596
|
const locals = meta.locals.map((localName) => variable(localName));
|
|
32597
|
+
// m.default
|
|
32598
|
+
const defaultRead = variable(moduleName).prop('default');
|
|
32598
32599
|
// ɵɵreplaceMetadata(Comp, m.default, [...]);
|
|
32599
|
-
const
|
|
32600
|
-
.callFn([meta.type,
|
|
32601
|
-
// (m) => ɵɵreplaceMetadata(...)
|
|
32602
|
-
const replaceCallback = arrowFn([new FnParam(moduleName)],
|
|
32603
|
-
// '<urlPartial>' + encodeURIComponent(
|
|
32600
|
+
const replaceCall = importExpr(Identifiers.replaceMetadata)
|
|
32601
|
+
.callFn([meta.type, defaultRead, new ExternalExpr(Identifiers.core), literalArr(locals)]);
|
|
32602
|
+
// (m) => m.default && ɵɵreplaceMetadata(...)
|
|
32603
|
+
const replaceCallback = arrowFn([new FnParam(moduleName)], defaultRead.and(replaceCall));
|
|
32604
|
+
// '<urlPartial>' + encodeURIComponent(t)
|
|
32604
32605
|
const urlValue = literal(urlPartial)
|
|
32605
|
-
.plus(variable('encodeURIComponent').callFn([variable(
|
|
32606
|
-
//
|
|
32607
|
-
//
|
|
32608
|
-
//
|
|
32609
|
-
|
|
32610
|
-
|
|
32611
|
-
.
|
|
32612
|
-
.
|
|
32613
|
-
|
|
32614
|
-
|
|
32606
|
+
.plus(variable('encodeURIComponent').callFn([variable(timestampName)]));
|
|
32607
|
+
// function Cmp_HmrLoad(t) {
|
|
32608
|
+
// import(/* @vite-ignore */ url).then((m) => m.default && replaceMetadata(...));
|
|
32609
|
+
// }
|
|
32610
|
+
const importCallback = new DeclareFunctionStmt(importCallbackName, [new FnParam(timestampName)], [
|
|
32611
|
+
// The vite-ignore special comment is required to prevent Vite from generating a superfluous
|
|
32612
|
+
// warning for each usage within the development code. If Vite provides a method to
|
|
32613
|
+
// programmatically avoid this warning in the future, this added comment can be removed here.
|
|
32614
|
+
new DynamicImportExpr(urlValue, null, '@vite-ignore')
|
|
32615
|
+
.prop('then')
|
|
32616
|
+
.callFn([replaceCallback])
|
|
32617
|
+
.toStmt(),
|
|
32618
|
+
], null, StmtModifier.Final);
|
|
32619
|
+
// (d) => d.id === <id> && Cmp_HmrLoad(d.timestamp)
|
|
32620
|
+
const updateCallback = arrowFn([new FnParam(dataName)], variable(dataName)
|
|
32621
|
+
.prop('id')
|
|
32622
|
+
.identical(literal(id))
|
|
32623
|
+
.and(variable(importCallbackName).callFn([variable(dataName).prop('timestamp')])));
|
|
32624
|
+
// Cmp_HmrLoad(Date.now());
|
|
32625
|
+
// Initial call to kick off the loading in order to avoid edge cases with components
|
|
32626
|
+
// coming from lazy chunks that change before the chunk has loaded.
|
|
32627
|
+
const initialCall = variable(importCallbackName)
|
|
32628
|
+
.callFn([variable('Date').prop('now').callFn([])]);
|
|
32615
32629
|
// import.meta.hot
|
|
32616
32630
|
const hotRead = variable('import').prop('meta').prop('hot');
|
|
32617
32631
|
// import.meta.hot.on('angular:component-update', () => ...);
|
|
32618
32632
|
const hotListener = hotRead
|
|
32619
32633
|
.clone()
|
|
32620
32634
|
.prop('on')
|
|
32621
|
-
.callFn([literal('angular:component-update'),
|
|
32622
|
-
|
|
32623
|
-
|
|
32635
|
+
.callFn([literal('angular:component-update'), updateCallback]);
|
|
32636
|
+
return arrowFn([], [
|
|
32637
|
+
// function Cmp_HmrLoad() {...}.
|
|
32638
|
+
importCallback,
|
|
32639
|
+
// ngDevMode && Cmp_HmrLoad(Date.now());
|
|
32640
|
+
devOnlyGuardedExpression(initialCall).toStmt(),
|
|
32641
|
+
// ngDevMode && import.meta.hot && import.meta.hot.on(...)
|
|
32642
|
+
devOnlyGuardedExpression(hotRead.and(hotListener)).toStmt(),
|
|
32643
|
+
])
|
|
32644
|
+
.callFn([]);
|
|
32624
32645
|
}
|
|
32625
32646
|
/**
|
|
32626
32647
|
* Compiles the HMR update callback for a class.
|
|
@@ -32659,7 +32680,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
|
|
|
32659
32680
|
function compileDeclareClassMetadata(metadata) {
|
|
32660
32681
|
const definitionMap = new DefinitionMap();
|
|
32661
32682
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
32662
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
32683
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
32663
32684
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32664
32685
|
definitionMap.set('type', metadata.type);
|
|
32665
32686
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -32677,7 +32698,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
|
|
|
32677
32698
|
callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
|
|
32678
32699
|
callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
|
|
32679
32700
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
|
|
32680
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
32701
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
32681
32702
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
32682
32703
|
definitionMap.set('type', metadata.type);
|
|
32683
32704
|
definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
|
|
@@ -32772,7 +32793,7 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
32772
32793
|
const definitionMap = new DefinitionMap();
|
|
32773
32794
|
const minVersion = getMinimumVersionForPartialOutput(meta);
|
|
32774
32795
|
definitionMap.set('minVersion', literal(minVersion));
|
|
32775
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
32796
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
32776
32797
|
// e.g. `type: MyDirective`
|
|
32777
32798
|
definitionMap.set('type', meta.type.value);
|
|
32778
32799
|
if (meta.isStandalone !== undefined) {
|
|
@@ -33191,7 +33212,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
33191
33212
|
function compileDeclareFactoryFunction(meta) {
|
|
33192
33213
|
const definitionMap = new DefinitionMap();
|
|
33193
33214
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
33194
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
33215
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
33195
33216
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33196
33217
|
definitionMap.set('type', meta.type.value);
|
|
33197
33218
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -33226,7 +33247,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
33226
33247
|
function createInjectableDefinitionMap(meta) {
|
|
33227
33248
|
const definitionMap = new DefinitionMap();
|
|
33228
33249
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
33229
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
33250
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
33230
33251
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33231
33252
|
definitionMap.set('type', meta.type.value);
|
|
33232
33253
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -33277,7 +33298,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
33277
33298
|
function createInjectorDefinitionMap(meta) {
|
|
33278
33299
|
const definitionMap = new DefinitionMap();
|
|
33279
33300
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
33280
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
33301
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
33281
33302
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33282
33303
|
definitionMap.set('type', meta.type.value);
|
|
33283
33304
|
definitionMap.set('providers', meta.providers);
|
|
@@ -33310,7 +33331,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
33310
33331
|
throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
|
|
33311
33332
|
}
|
|
33312
33333
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
33313
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
33334
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
33314
33335
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33315
33336
|
definitionMap.set('type', meta.type.value);
|
|
33316
33337
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -33361,7 +33382,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
33361
33382
|
function createPipeDefinitionMap(meta) {
|
|
33362
33383
|
const definitionMap = new DefinitionMap();
|
|
33363
33384
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
33364
|
-
definitionMap.set('version', literal('19.0.0-rc.
|
|
33385
|
+
definitionMap.set('version', literal('19.0.0-rc.1'));
|
|
33365
33386
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
33366
33387
|
// e.g. `type: MyPipe`
|
|
33367
33388
|
definitionMap.set('type', meta.type.value);
|