Skip to content

Commit 8db3f5f

Browse files
update to Angular 19
1 parent a7274eb commit 8db3f5f

File tree

10 files changed

+5831
-7198
lines changed

10 files changed

+5831
-7198
lines changed

apps/angular/angular.json

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,22 @@
1111
"schematics": {},
1212
"architect": {
1313
"build": {
14-
"builder": "@angular-devkit/build-angular:browser",
14+
"builder": "@angular-devkit/build-angular:application",
1515
"options": {
16-
"outputPath": "dist/sandbox",
16+
"outputPath": {
17+
"base": "dist/sandbox"
18+
},
1719
"index": "src/index.html",
18-
"main": "src/main.ts",
19-
"polyfills": "src/polyfills.ts",
20+
"polyfills": [
21+
"src/polyfills.ts"
22+
],
2023
"tsConfig": "src/tsconfig.app.json",
2124
"styles": [
2225
"node_modules/devextreme/dist/css/dx.common.css",
2326
"node_modules/devextreme/dist/css/dx.light.css"
2427
],
25-
"scripts": []
28+
"scripts": [],
29+
"browser": "src/main.ts"
2630
},
2731
"configurations": {
2832
"production": {
@@ -38,8 +42,6 @@
3842
"namedChunks": false,
3943
"aot": true,
4044
"extractLicenses": true,
41-
"vendorChunk": false,
42-
"buildOptimizer": true,
4345
"budgets": [
4446
{
4547
"type": "initial",
@@ -54,23 +56,21 @@
5456
"sourceMap": true,
5557
"namedChunks": false,
5658
"aot": true,
57-
"extractLicenses": true,
58-
"vendorChunk": false,
59-
"buildOptimizer": false
59+
"extractLicenses": true
6060
}
6161
}
6262
},
6363
"serve": {
6464
"builder": "@angular-devkit/build-angular:dev-server",
6565
"options": {
66-
"browserTarget": "sandbox:build"
66+
"buildTarget": "sandbox:build"
6767
},
6868
"configurations": {
6969
"production": {
70-
"browserTarget": "sandbox:build:production"
70+
"buildTarget": "sandbox:build:production"
7171
},
7272
"dev": {
73-
"browserTarget": "sandbox:build:dev"
73+
"buildTarget": "sandbox:build:dev"
7474
}
7575
}
7676
},

apps/angular/package.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,31 +6,29 @@
66
"author": "Developer Express Inc.",
77
"license": "MIT",
88
"dependencies": {
9-
"@angular/animations": "17.3.12",
10-
"@angular/common": "17.3.12",
11-
"@angular/compiler": "17.3.12",
12-
"@angular/compiler-cli": "17.3.12",
13-
"@angular/core": "17.3.12",
14-
"@angular/forms": "17.3.12",
15-
"@angular/platform-browser": "17.3.12",
16-
"@angular/platform-browser-dynamic": "17.3.12",
17-
"@angular/router": "17.3.12",
9+
"@angular/animations": "19.2.15",
10+
"@angular/common": "19.2.15",
11+
"@angular/compiler": "19.2.15",
12+
"@angular/compiler-cli": "19.2.15",
13+
"@angular/core": "19.2.15",
14+
"@angular/forms": "19.2.15",
15+
"@angular/platform-browser": "19.2.15",
16+
"@angular/platform-browser-dynamic": "19.2.15",
17+
"@angular/router": "19.2.17",
1818
"core-js": "^2.6.12",
1919
"devextreme": "workspace:*",
2020
"devextreme-angular": "workspace:*",
21-
"rxjs": "7.8.1",
2221
"tslib": "^2.6.1",
23-
"zone.js": "0.14.10"
22+
"zone.js": "0.15.1"
2423
},
2524
"devDependencies": {
26-
"@angular-devkit/build-angular": "17.3.11",
27-
"@angular/cli": "17.3.11",
28-
"@angular/language-service": "17.3.12",
25+
"@angular-devkit/build-angular": "19.2.19",
26+
"@angular/cli": "19.2.18",
2927
"@types/jasmine": "5.1.4",
3028
"@types/node": "20.11.17",
3129
"cross-env": "7.0.3",
3230
"ts-node": "10.9.2",
33-
"typescript": "5.4.5"
31+
"typescript": "5.8.3"
3432
},
3533
"scripts": {
3634
"ng": "ng",

apps/angular/src/app/app.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* tslint:disable:component-selector */
2-
32
import {
43
Component,
54
OnInit,
@@ -95,7 +94,8 @@ import ArrayStore from 'devextreme/data/array_store';
9594
CustomerService,
9695
AppointmentService,
9796
OwnerService
98-
]
97+
],
98+
standalone: false
9999
})
100100
export class AppComponent implements OnInit, AfterViewInit {
101101
@ViewChild(DxPopoverComponent) popover: DxPopoverComponent;

apps/angular/src/app/app.module.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { BrowserModule } from '@angular/platform-browser';
33
import { ReactiveFormsModule } from '@angular/forms';
44
import { AppComponent } from './app.component';
55

6-
76
import { DevExtremeModule } from 'devextreme-angular';
87

98
@NgModule({

apps/angular/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
"outDir": "./dist/out-tsc",
66
"sourceMap": true,
77
"declaration": false,
8-
"module": "es2015",
8+
"module": "ES2022",
99
"moduleResolution": "node",
1010
"emitDecoratorMetadata": true,
1111
"experimentalDecorators": true,
1212
"importHelpers": true,
13-
"target": "es5",
1413
"typeRoots": [
1514
"node_modules/@types"
1615
],

packages/devextreme-angular/package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
"author": "Developer Express Inc.",
2020
"license": "MIT",
2121
"peerDependencies": {
22-
"@angular/common": ">=17.0.0",
23-
"@angular/core": ">=17.0.0",
24-
"@angular/forms": ">=17.0.0",
22+
"@angular/common": ">=19.0.0",
23+
"@angular/core": ">=19.0.0",
24+
"@angular/forms": ">=19.0.0",
2525
"devextreme": "workspace:*"
2626
},
2727
"devDependencies": {
@@ -62,8 +62,8 @@
6262
"karma-webpack": "5.0.1",
6363
"ng-packagr": "19.2.2",
6464
"puppeteer": "23.6.1",
65+
"rxjs": "7.8.2",
6566
"reflect-metadata": "0.1.13",
66-
"rxjs": "7.8.1",
6767
"stream-browserify": "3.0.0",
6868
"style-loader": "3.3.4",
6969
"tslib": "2.6.3",
Lines changed: 30 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
11
import { BrowserModule, provideClientHydration } from '@angular/platform-browser';
22
import {
3-
Component, destroyPlatform, NgModule, PLATFORM_ID, VERSION, importProvidersFrom,
3+
Component,
4+
destroyPlatform,
5+
NgModule,
6+
PLATFORM_ID,
7+
importProvidersFrom,
48
} from '@angular/core';
5-
import { provideServerRendering, ServerModule } from '@angular/platform-server';
9+
import { ServerModule, renderModule } from '@angular/platform-server';
610
import { DxServerModule } from 'devextreme-angular/server';
711
import infernoRenderer from 'devextreme/core/inferno_renderer';
812
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
913
import { DevExtremeModule } from 'devextreme-angular';
10-
import { componentNames } from './component-names';
14+
import { componentNames as componentNamesAll } from './component-names';
15+
16+
const componentNames = componentNamesAll.filter((n) => ['toast', 'action-sheet'].includes(n));
1117

1218
const containerClass = 'container';
1319
const containerSelector = `.${containerClass}`;
1420

1521
@Component({
1622
selector: 'app-root',
23+
standalone: false,
1724
template: `<div class="${containerClass}">
18-
${componentNames.map((name) => `<dx-${name}></dx-${name}>`).join('\n')}
19-
</div>`,
25+
${componentNames.map((name) => `<dx-${name}></dx-${name}>`).join('\n')}
26+
</div>`,
2027
})
2128
class AppComponent {}
2229

@@ -34,20 +41,13 @@ class AppBrowserModule {}
3441
bootstrap: [AppComponent],
3542
providers: [
3643
provideClientHydration(),
37-
provideServerRendering(),
3844
{ provide: PLATFORM_ID, useValue: 'server' },
3945
importProvidersFrom(DxServerModule),
4046
],
4147
})
4248
class AppSSRModule {}
4349

4450
class TestHelpers {
45-
static createSSRBodyMarkup(ssrComponentsHTML: string): string {
46-
const nghData = '[{}]';
47-
return `<!--nghm--><app-root ng-version="${VERSION.full}" ngh="0" ng-server-context="ssr">${ssrComponentsHTML}</app-root>
48-
<script id="ng-state" type="application/json">{"DX_isPlatformServer":true,"__nghData__":${nghData}}</script>`;
49-
}
50-
5151
static normalizeClassNames(element: HTMLElement): void {
5252
const classNames = Array.from(element.classList).sort();
5353
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -56,18 +56,6 @@ class TestHelpers {
5656
element.classList.add(...classNames);
5757
}
5858

59-
static compareContainers(ssrContainer: HTMLElement, hydratedContainer: HTMLElement): [string, string] {
60-
const selector = `${containerSelector} > *`;
61-
62-
[ssrContainer, hydratedContainer].forEach((container) => {
63-
container.querySelectorAll(selector).forEach((el) => {
64-
this.normalizeClassNames(el as HTMLElement);
65-
});
66-
});
67-
68-
return [ssrContainer.innerHTML, hydratedContainer.innerHTML];
69-
}
70-
7159
static hasConsoleMessage(spy: jasmine.Spy, messages: string[]): boolean {
7260
return spy.calls.allArgs().some((args) => messages.some((msg) => args[0].toLowerCase().includes(msg.toLowerCase())));
7361
}
@@ -80,11 +68,11 @@ describe('Angular Components Hydration Test', () => {
8068
log: jasmine.Spy;
8169
};
8270
const ssrState: {
83-
body: HTMLElement | null;
8471
containerHtml: string;
72+
ssrHTML: string;
8573
} = {
86-
body: null,
8774
containerHtml: '',
75+
ssrHTML: '',
8876
};
8977

9078
beforeAll(() => {
@@ -105,36 +93,39 @@ describe('Angular Components Hydration Test', () => {
10593
});
10694

10795
it('should generate correct SSR HTML', async () => {
108-
document.body.innerHTML = '<app-root></app-root>';
96+
const html = await renderModule(AppSSRModule, {
97+
document: '<!DOCTYPE html><html><head></head><body><app-root></app-root></body></html>',
98+
url: '/',
99+
});
109100

110-
// Act
111-
await platformBrowserDynamic().bootstrapModule(AppSSRModule);
101+
ssrState.ssrHTML = html
102+
.replace(/ng-server-context="other"/g, 'ng-server-context="ssg"')
103+
.replace(/^.*<body/, '<body')
104+
.replace(/<\/body>.*$/, '</body>');
105+
106+
const tempDiv = document.createElement('div');
107+
tempDiv.innerHTML = ssrState.ssrHTML;
112108

113109
// Assert
114-
ssrState.body = document.body;
115-
ssrState.containerHtml = document.querySelector(`${containerSelector}`)?.outerHTML ?? '';
110+
ssrState.containerHtml = tempDiv.querySelector(`${containerSelector}`)?.innerHTML ?? '';
116111

117112
expect(ssrState.containerHtml).toBeTruthy();
113+
expect(ssrState.ssrHTML).toBeTruthy();
118114
});
119115

120116
it('should correctly hydrate server-rendered HTML', async () => {
121117
infernoRenderer.resetInjection();
122-
document.body.innerHTML = TestHelpers.createSSRBodyMarkup(ssrState.containerHtml);
118+
119+
document.body.outerHTML = ssrState.ssrHTML;
123120

124121
// Act
125122
await platformBrowserDynamic().bootstrapModule(AppBrowserModule);
126123

127-
// Assert
128-
const [ssrResult, hydratedResult] = TestHelpers.compareContainers(
129-
ssrState.body.querySelector(`${containerSelector}`),
130-
document.querySelector(`${containerSelector}`),
131-
);
132-
133124
expect(TestHelpers.hasConsoleMessage(
134125
consoleSpies.log,
135126
['Angular hydrated 1 component(s)'],
136127
)).toBeTruthy();
137128

138-
expect(ssrResult).toEqual(hydratedResult);
129+
expect(ssrState.containerHtml).toEqual(document.querySelector(`${containerSelector}`).innerHTML);
139130
});
140131
});

packages/devextreme-angular/tests/src/server/ssr-ajax.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,9 @@ describe('Universal', () => {
4949
{
5050
declarations: [TestContainerComponent],
5151
imports: [
52-
DxServerModule,
53-
ServerModule,
54-
DxServerTransferStateModule,
52+
DxServerModule,
53+
ServerModule,
54+
DxServerTransferStateModule,
5555
],
5656
},
5757
);

packages/devextreme-angular/tests/src/server/ssr-components.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import {
2020
} from './component-names';
2121

2222
@Component({
23+
standalone: false,
2324
selector: 'test-container-component',
2425
template: '',
2526
})

0 commit comments

Comments
 (0)