Skip to content

Commit 51ad39e

Browse files
authored
feat: Angular 15 support (#97)
1 parent 6c8b641 commit 51ad39e

File tree

12 files changed

+1602
-1660
lines changed

12 files changed

+1602
-1660
lines changed

apps/nativescript-demo-ng/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
"@nativescript-community/ui-material-bottom-navigation": "^7.0.0"
1212
},
1313
"devDependencies": {
14-
"@nativescript/android": "~8.3.0",
15-
"@nativescript/ios": "~8.3.0",
14+
"@nativescript/android": "~8.4.0",
15+
"@nativescript/ios": "~8.4.0",
1616
"@nativescript/unit-test-runner": "^3.0.1"
1717
}
1818
}

apps/nativescript-demo-ng/project.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "nativescript-demo-ng",
23
"$schema": "../../node_modules/nx/schemas/project-schema.json",
34
"sourceRoot": "apps/nativescript-demo-ng/src",
45
"projectType": "application",
@@ -71,7 +72,7 @@
7172
},
7273
"test": {
7374
"executor": "@nativescript/nx:test",
74-
"outputs": ["coverage/apps/nativescript-demo-ng"],
75+
"outputs": ["{workspaceRoot}/coverage/apps/nativescript-demo-ng"],
7576
"options": {
7677
"coverage": false
7778
},

apps/nativescript-demo-ng/src/app/item/items.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ModalDialogService, NativeDialogService } from '@nativescript/angular';
1212
templateUrl: './items.component.html',
1313
})
1414
export class ItemsComponent implements OnInit {
15-
message = 'Hello Angular 13!';
15+
message = 'Hello Angular 15!';
1616
items: Array<Item>;
1717

1818
constructor(private itemService: ItemService, private nativeDialog: NativeDialogService, private modalDialog: ModalDialogService, private http: HttpClient) {}

apps/nativescript-demo-ng/src/app/item3/items.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { ModalDialogService, NativeDialogService } from '@nativescript/angular';
1212
templateUrl: './items.component.html',
1313
})
1414
export class ItemsComponent implements OnInit {
15-
message = 'Hello Angular 13!';
15+
message = 'Hello Angular 15!';
1616
items: Array<Item>;
1717

1818
constructor(private itemService: ItemService, private nativeDialog: NativeDialogService, private modalDialog: ModalDialogService, private http: HttpClient) {}

nx.json

+10-12
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,6 @@
33
"affected": {
44
"defaultBase": "main"
55
},
6-
"implicitDependencies": {
7-
"workspace.json": "*",
8-
"package.json": {
9-
"dependencies": "*",
10-
"devDependencies": "*"
11-
},
12-
"tsconfig.base.json": "*",
13-
"tslint.json": "*",
14-
".eslintrc.json": "*",
15-
"nx.json": "*"
16-
},
176
"tasksRunnerOptions": {
187
"default": {
198
"runner": "@nrwl/nx-cloud",
@@ -34,7 +23,16 @@
3423
"$schema": "./node_modules/nx/schemas/nx-schema.json",
3524
"targetDefaults": {
3625
"build": {
37-
"dependsOn": ["^build"]
26+
"dependsOn": ["^build"],
27+
"inputs": ["production", "^production"]
28+
},
29+
"test": {
30+
"inputs": ["default", "^production", "{workspaceRoot}/jest.preset.js"]
3831
}
32+
},
33+
"namedInputs": {
34+
"default": ["{projectRoot}/**/*", "sharedGlobals"],
35+
"sharedGlobals": ["{workspaceRoot}/workspace.json", "{workspaceRoot}/tsconfig.base.json", "{workspaceRoot}/tslint.json", "{workspaceRoot}/nx.json"],
36+
"production": ["default", "!{projectRoot}/**/?(*.)+(spec|test).[jt]s?(x)?(.snap)", "!{projectRoot}/tsconfig.spec.json", "!{projectRoot}/jest.config.[jt]s"]
3937
}
4038
}

package.json

+33-33
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"license": "MIT",
55
"private": true,
66
"scripts": {
7-
"clean": "npx rimraf hooks node_modules package-lock.json yarn.lock && npm i --legacy-peer-deps",
7+
"clean": "npx rimraf hooks node_modules package-lock.json && yarn",
88
"clean.all": "npm run clean && nx run-many --target=clean --all",
99
"postinstall": "husky install",
1010
"nx": "nx",
@@ -35,44 +35,44 @@
3535
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s"
3636
},
3737
"dependencies": {
38-
"@angular/animations": "14.2.3",
39-
"@angular/common": "14.2.3",
40-
"@angular/compiler": "14.2.3",
41-
"@angular/core": "14.2.3",
42-
"@angular/forms": "14.2.3",
43-
"@angular/platform-browser": "14.2.3",
44-
"@angular/platform-browser-dynamic": "14.2.3",
45-
"@angular/router": "14.2.3",
46-
"@nativescript/core": "~8.3.4",
38+
"@angular/animations": "15.0.1",
39+
"@angular/common": "15.0.1",
40+
"@angular/compiler": "15.0.1",
41+
"@angular/core": "15.0.1",
42+
"@angular/forms": "15.0.1",
43+
"@angular/platform-browser": "15.0.1",
44+
"@angular/platform-browser-dynamic": "15.0.1",
45+
"@angular/router": "15.0.1",
46+
"@nativescript/core": "~8.4.0",
4747
"@nativescript/theme": "~3.0.2",
4848
"@ngx-translate/core": "~14.0.0",
4949
"@nrwl/nx-cloud": "^15.0.2",
5050
"nativescript-ngx-fonticon": "~7.0.0",
5151
"rxjs": "^7.5.6",
52-
"zone.js": "~0.11.8"
52+
"zone.js": "~0.12.0"
5353
},
5454
"devDependencies": {
55-
"@angular-devkit/build-angular": "14.2.3",
56-
"@angular-eslint/eslint-plugin": "14.0.3",
57-
"@angular-eslint/eslint-plugin-template": "14.0.3",
58-
"@angular-eslint/template-parser": "14.0.3",
59-
"@angular/compiler-cli": "14.2.3",
55+
"@angular-devkit/build-angular": "15.0.1",
56+
"@angular-eslint/eslint-plugin": "14.0.4",
57+
"@angular-eslint/eslint-plugin-template": "14.0.4",
58+
"@angular-eslint/template-parser": "14.0.4",
59+
"@angular/compiler-cli": "15.0.1",
6060
"@jsdevtools/coverage-istanbul-loader": "3.0.5",
61-
"@nativescript/types": "~8.3.1",
61+
"@nativescript/types": "~8.4.0",
6262
"@nativescript/unit-test-runner": "^3.0.4",
63-
"@nativescript/webpack": "~5.0.8",
64-
"@ngtools/webpack": "14.2.3",
65-
"@nrwl/angular": "14.7.11",
66-
"@nrwl/cli": "14.7.11",
67-
"@nrwl/eslint-plugin-nx": "14.7.11",
68-
"@nrwl/jest": "14.7.11",
69-
"@nrwl/js": "14.7.11",
70-
"@nrwl/node": "14.7.11",
71-
"@nrwl/workspace": "14.7.11",
72-
"@nstudio/angular": "14.3.0",
73-
"@nstudio/nativescript": "14.3.0",
74-
"@nstudio/nativescript-angular": "14.3.0",
75-
"@nstudio/xplat": "14.3.0",
63+
"@nativescript/webpack": "~5.0.12",
64+
"@ngtools/webpack": "15.0.1",
65+
"@nrwl/angular": "15.2.1",
66+
"@nrwl/cli": "15.2.1",
67+
"@nrwl/eslint-plugin-nx": "15.2.1",
68+
"@nrwl/jest": "15.2.1",
69+
"@nrwl/js": "15.2.1",
70+
"@nrwl/node": "15.2.1",
71+
"@nrwl/workspace": "15.2.1",
72+
"@nstudio/angular": "15.0.2",
73+
"@nstudio/nativescript": "15.0.2",
74+
"@nstudio/nativescript-angular": "15.0.2",
75+
"@nstudio/xplat": "15.0.2",
7676
"@types/jasmine": "4.3.0",
7777
"@types/jest": "28.1.8",
7878
"@types/node": "^18.7.13",
@@ -93,8 +93,8 @@
9393
"karma-nativescript-launcher": "0.4.0",
9494
"karma-sinon": "^1.0.5",
9595
"lint-staged": "^13.0.3",
96-
"ng-packagr": "14.2.1",
97-
"nx": "14.7.11",
96+
"ng-packagr": "15.0.1",
97+
"nx": "15.2.1",
9898
"nyc": "15.1.0",
9999
"postcss": "^8.4.16",
100100
"postcss-import": "14.1.0",
@@ -106,7 +106,7 @@
106106
"ts-jest": "28.0.8",
107107
"ts-node": "10.9.1",
108108
"tslib": "^2.4.0",
109-
"typescript": "~4.7.2"
109+
"typescript": "~4.8.0"
110110
},
111111
"xplat": {
112112
"prefix": "nativescript",

packages/angular/project.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "angular",
23
"$schema": "../../node_modules/nx/schemas/project-schema.json",
34
"sourceRoot": "packages/angular/src",
45
"projectType": "library",
@@ -23,7 +24,7 @@
2324
"jestConfig": "packages/angular/jest.config.ts",
2425
"passWithNoTests": true
2526
},
26-
"outputs": ["coverage/packages/angular"]
27+
"outputs": ["{workspaceRoot}/coverage/packages/angular"]
2728
}
2829
},
2930
"tags": []

packages/angular/src/lib/legacy/router/page-router-outlet.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Attribute, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, Directive, Inject, InjectionToken, Injector, OnDestroy, EventEmitter, Output, Type, ViewContainerRef, ElementRef, InjectFlags, NgZone, EnvironmentInjector, inject } from '@angular/core';
1+
import { Attribute, ChangeDetectorRef, ComponentFactory, ComponentFactoryResolver, ComponentRef, Directive, Inject, InjectionToken, Injector, OnDestroy, EventEmitter, Output, Type, ViewContainerRef, ElementRef, InjectFlags, NgZone, EnvironmentInjector, inject, InjectOptions } from '@angular/core';
22
import { ActivatedRoute, ActivatedRouteSnapshot, ChildrenOutletContexts, Data, PRIMARY_OUTLET, Router, RouterOutletContract } from '@angular/router';
33

44
import { Frame, Page, NavigatedData, profile, NavigationEntry } from '@nativescript/core';
@@ -43,12 +43,20 @@ function callableOnce<T>(fn: (...args: T[]) => void) {
4343
export class DestructibleInjector implements Injector {
4444
private refs = new Set<any>();
4545
constructor(private destructibleProviders: ProviderSet, private parent: Injector) {}
46-
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectFlags): T {
46+
get<T>(token: Type<T> | InjectionToken<T>, notFoundValue?: T, flags?: InjectOptions | InjectFlags): T {
4747
const ref = this.parent.get(token, notFoundValue, flags);
48+
4849
// if we're skipping ourselves then it's not our responsibility to destroy
49-
if (!(flags & InjectFlags.SkipSelf) && this.destructibleProviders.has(token)) {
50-
this.refs.add(ref);
50+
if (typeof flags === 'number') {
51+
if (!(flags & InjectFlags.SkipSelf) && this.destructibleProviders.has(token)) {
52+
this.refs.add(ref);
53+
}
54+
} else {
55+
if (!flags?.skipSelf && this.destructibleProviders.has(token)) {
56+
this.refs.add(ref);
57+
}
5158
}
59+
5260
return ref;
5361
}
5462
destroy() {

packages/angular/tsconfig.lib.prod.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
22
"extends": "./tsconfig.lib.json",
33
"compilerOptions": {
4-
"declarationMap": false
4+
"declarationMap": false,
5+
"target": "ES2022",
6+
"useDefineForClassFields": false
57
},
68
"angularCompilerOptions": {
79
"compilationMode": "partial"

packages/zone-js/project.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"name": "zone-js",
23
"$schema": "../../node_modules/nx/schemas/project-schema.json",
34
"sourceRoot": "packages/zone-js/src",
45
"projectType": "library",
@@ -21,7 +22,7 @@
2122
},
2223
"test": {
2324
"executor": "@nrwl/jest:jest",
24-
"outputs": ["coverage/packages/zone-js"],
25+
"outputs": ["{workspaceRoot}/coverage/packages/zone-js"],
2526
"options": {
2627
"jestConfig": "packages/zone-js/jest.config.ts",
2728
"passWithNoTests": true

tsconfig.base.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
"emitDecoratorMetadata": true,
99
"experimentalDecorators": true,
1010
"importHelpers": true,
11-
"target": "es2015",
11+
"target": "ES2020",
1212
"module": "esnext",
1313
"typeRoots": ["node_modules/@types"],
14-
"lib": ["es2017", "dom"],
14+
"lib": ["ESNext", "dom"],
1515
"skipLibCheck": true,
1616
"skipDefaultLibCheck": true,
1717
"baseUrl": ".",

0 commit comments

Comments
 (0)