From ece4cc7e6b42d596a87bbc0920905e240f6a57eb Mon Sep 17 00:00:00 2001 From: Zdravko Branzov Date: Tue, 18 Jun 2019 13:49:16 +0300 Subject: [PATCH 01/10] chore: bump version --- nativescript-angular/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 3e30ba170..1ccef649e 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-angular", - "version": "8.0.1", + "version": "8.1.0", "description": "An Angular renderer that lets you build mobile apps with NativeScript.", "homepage": "https://www.nativescript.org/", "bugs": "https://github.com/NativeScript/nativescript-angular/issues", From 62ab4d640622019571e7afc5658462a4a5a1591e Mon Sep 17 00:00:00 2001 From: tsonevn Date: Wed, 19 Jun 2019 08:48:40 +0300 Subject: [PATCH 02/10] Update zone.js peer dependency --- e2e/router/package.json | 2 +- e2e/single-page/package.json | 2 +- e2e/tests-app-ng/package.json | 2 +- nativescript-angular/package.json | 2 +- ng-sample/package.json | 2 +- tests/package.json | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/e2e/router/package.json b/e2e/router/package.json index ace5d61c3..7467fec70 100644 --- a/e2e/router/package.json +++ b/e2e/router/package.json @@ -24,7 +24,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", "tns-core-modules": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@angular/compiler-cli": "8.0.0", diff --git a/e2e/single-page/package.json b/e2e/single-page/package.json index 06bd8aaf8..7e2886386 100644 --- a/e2e/single-page/package.json +++ b/e2e/single-page/package.json @@ -27,7 +27,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", "tns-core-modules": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@angular/compiler-cli": "8.0.0", diff --git a/e2e/tests-app-ng/package.json b/e2e/tests-app-ng/package.json index 948dd6f00..08f717f23 100644 --- a/e2e/tests-app-ng/package.json +++ b/e2e/tests-app-ng/package.json @@ -26,7 +26,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.0.0 || >=6.1.0 || >=6.0.0", "tns-core-modules": "next", - "zone.js": "^0.8.26" + "zone.js": "^0.9.1" }, "devDependencies": { "babel-traverse": "6.24.1", diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 1ccef649e..e094a4e81 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -75,7 +75,7 @@ "tns-core-modules": "next", "tslint": "^5.5.0", "typescript": "~3.4.5", - "zone.js": "^0.8.4", + "zone.js": "^0.9.1", "nativescript-typedoc-theme": "git://github.com/NativeScript/nativescript-typedoc-theme.git#master", "typedoc": "^0.13.0" } diff --git a/ng-sample/package.json b/ng-sample/package.json index fdb973dff..aba4a594b 100644 --- a/ng-sample/package.json +++ b/ng-sample/package.json @@ -45,7 +45,7 @@ "rxjs": "~6.3.3", "tns-core-modules": "next", "tns-platform-declarations": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "babel-traverse": "6.9.0", diff --git a/tests/package.json b/tests/package.json index 97e308db3..e1e0f4ed6 100644 --- a/tests/package.json +++ b/tests/package.json @@ -39,7 +39,7 @@ "nativescript-unit-test-runner": "^0.3.4", "rxjs": "~6.3.3", "tns-core-modules": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@types/chai": "^4.1.4", From 7a08f87db2fa1583d55c046d3d45562aaef272f3 Mon Sep 17 00:00:00 2001 From: tsonevn Date: Wed, 19 Jun 2019 10:13:20 +0300 Subject: [PATCH 03/10] update zone.js in all apps --- e2e/animation-examples/package.json | 2 +- e2e/modal-navigation-ng/package.json | 2 +- e2e/nested-router-tab-view/package.json | 2 +- e2e/renderer/package.json | 2 +- e2e/routable-animations/package.json | 2 +- e2e/router-tab-view/package.json | 2 +- nativescript-angular/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/e2e/animation-examples/package.json b/e2e/animation-examples/package.json index f995a696e..a9747cd56 100644 --- a/e2e/animation-examples/package.json +++ b/e2e/animation-examples/package.json @@ -27,7 +27,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "^6.3.3", "tns-core-modules": "^5.4.0-next-2019-05-01-141636-02", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@angular/compiler-cli": "8.0.0", diff --git a/e2e/modal-navigation-ng/package.json b/e2e/modal-navigation-ng/package.json index 6e3e6944f..646fcdee2 100644 --- a/e2e/modal-navigation-ng/package.json +++ b/e2e/modal-navigation-ng/package.json @@ -27,7 +27,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", "tns-core-modules": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@angular/compiler-cli": "8.0.0", diff --git a/e2e/nested-router-tab-view/package.json b/e2e/nested-router-tab-view/package.json index 97ee5a7c8..db7a05014 100644 --- a/e2e/nested-router-tab-view/package.json +++ b/e2e/nested-router-tab-view/package.json @@ -27,7 +27,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", "tns-core-modules": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@angular/compiler-cli": "8.0.0", diff --git a/e2e/renderer/package.json b/e2e/renderer/package.json index 4d6fd6337..1b361039c 100644 --- a/e2e/renderer/package.json +++ b/e2e/renderer/package.json @@ -20,7 +20,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", "tns-core-modules": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@angular/compiler-cli": "8.0.0", diff --git a/e2e/routable-animations/package.json b/e2e/routable-animations/package.json index 4e8f38c69..89a5ca351 100644 --- a/e2e/routable-animations/package.json +++ b/e2e/routable-animations/package.json @@ -21,7 +21,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.0.0 || >=6.1.0", "tns-core-modules": "^4.0.0", - "zone.js": "^0.8.26" + "zone.js": "^0.9.1" }, "devDependencies": { "@ngtools/webpack": "8.0.0", diff --git a/e2e/router-tab-view/package.json b/e2e/router-tab-view/package.json index 2a8e7bad8..bbc515127 100644 --- a/e2e/router-tab-view/package.json +++ b/e2e/router-tab-view/package.json @@ -27,7 +27,7 @@ "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", "tns-core-modules": "next", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@types/chai": "~4.1.7", diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index e094a4e81..6439dc7c9 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -56,7 +56,7 @@ "rxjs": "^6.3.3", "tns-core-modules": "^5.1.0 || >5.1.0- || >5.2.0-", "typescript": "~3.4.5", - "zone.js": "^0.8.4" + "zone.js": "^0.9.1" }, "devDependencies": { "@angular/animations": "8.0.0", From 1cb3675e8e950ed63c57ce1c290326d127caa784 Mon Sep 17 00:00:00 2001 From: Vladimir Amiorkov Date: Tue, 25 Jun 2019 16:26:56 +0300 Subject: [PATCH 04/10] Make repo apps compatible with `--bundle` (#1857) * chore: upgrade app to latest versions and webpack * chore: fix incorrect temlateUrl in component chore: update karma config for latest CLI beta 6.0.0 * chore: make `router-tab-view` example webpack compatible * chore: make `nested-router-tab-view` example webpack compatible * chore: fix lazy loaded component not loading * chore: make `modal-navigation-ng` example webpack compatible * chore: add webpack config due to issue in CLI that disregards the `nsconfig.json` * chore: update test app with latest deps and remove not used d.ts * chore: update karma config * chore: resolve issue caused by overrding `global.__extends ` * chore: update Angular deps * chore: update `nativescript-dev-webpack` to next * refactor: unit-test configs * test: update webpack config --- e2e/animation-examples/package.json | 28 +- e2e/modal-navigation-ng/package.json | 21 +- e2e/modal-navigation-ng/tsconfig.json | 10 +- e2e/nested-router-tab-view/app/app.routing.ts | 6 +- e2e/nested-router-tab-view/package.json | 21 +- e2e/nested-router-tab-view/tsconfig.json | 11 +- e2e/renderer/package.json | 18 +- e2e/routable-animations/package.json | 20 +- e2e/router-tab-view/package.json | 21 +- e2e/router-tab-view/tsconfig.json | 13 +- e2e/router/package.json | 20 +- e2e/single-page/package.json | 20 +- e2e/tests-app-ng/package.json | 14 +- nativescript-angular/package.json | 32 +- ng-sample/package.json | 16 +- tests/app/global.d.ts | 1 - tests/app/snippets/gestures.component.ts | 3 +- tests/app/snippets/icon-font.component.ts | 5 +- tests/app/snippets/layouts.component.ts | 3 +- .../snippets/navigation/router-extensions.ts | 3 +- .../nativescript-unit-test-runner.js | 2 +- tests/karma.conf.js | 55 ++- tests/nsconfig.json | 5 + tests/package.json | 33 +- tests/references.d.ts | 3 +- tests/tsconfig.json | 6 + tests/webpack.config.js | 318 ++++++++++++++++++ 27 files changed, 558 insertions(+), 150 deletions(-) delete mode 100644 tests/app/global.d.ts create mode 100644 tests/nsconfig.json create mode 100644 tests/webpack.config.js diff --git a/e2e/animation-examples/package.json b/e2e/animation-examples/package.json index a9747cd56..fbcb1370d 100644 --- a/e2e/animation-examples/package.json +++ b/e2e/animation-examples/package.json @@ -9,29 +9,29 @@ "version": "latest" }, "tns-android": { - "version": "5.4.0-2019-05-02-235338-05" + "version": "latest" } }, "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../../nativescript-angular", "nativescript-theme-core": "~1.0.2", "reflect-metadata": "~0.1.8", "rxjs": "^6.3.3", - "tns-core-modules": "^5.4.0-next-2019-05-01-141636-02", + "tns-core-modules": "next", "zone.js": "^0.9.1" }, "devDependencies": { - "@angular/compiler-cli": "8.0.0", - "@ngtools/webpack": "8.0.0", + "@angular/compiler-cli": "~8.0.0", + "@ngtools/webpack": "~8.0.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", @@ -43,8 +43,8 @@ "mochawesome": "~3.1.2", "nativescript-css-loader": "~0.26.0", "nativescript-dev-appium": "next", - "nativescript-dev-typescript": "^0.9.1-next-2019-03-12-162713-03", - "nativescript-dev-webpack": "^0.22.0-next-2019-04-17-111030-01", + "nativescript-dev-typescript": "next", + "nativescript-dev-webpack": "next", "typescript": "~3.4.5" }, "scripts": { diff --git a/e2e/modal-navigation-ng/package.json b/e2e/modal-navigation-ng/package.json index 646fcdee2..e3d559af2 100644 --- a/e2e/modal-navigation-ng/package.json +++ b/e2e/modal-navigation-ng/package.json @@ -13,16 +13,17 @@ } }, "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../../nativescript-angular", + "nativescript-dev-webpack": "next", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", @@ -30,8 +31,8 @@ "zone.js": "^0.9.1" }, "devDependencies": { - "@angular/compiler-cli": "8.0.0", - "@ngtools/webpack": "8.0.0", + "@angular/compiler-cli": "~8.0.0", + "@ngtools/webpack": "~8.0.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", diff --git a/e2e/modal-navigation-ng/tsconfig.json b/e2e/modal-navigation-ng/tsconfig.json index f251eb444..d93d819b4 100644 --- a/e2e/modal-navigation-ng/tsconfig.json +++ b/e2e/modal-navigation-ng/tsconfig.json @@ -22,8 +22,16 @@ ] } }, + "include": [ + "../../nativescript-angular", + "**/*" + ], "exclude": [ + "../../nativescript-angular/node_modules", + "../../nativescript-angular/**/*.d.ts", "node_modules", - "platforms" + "platforms", + "**/*.aot", + "e2e" ] } \ No newline at end of file diff --git a/e2e/nested-router-tab-view/app/app.routing.ts b/e2e/nested-router-tab-view/app/app.routing.ts index b77942d75..50d824095 100644 --- a/e2e/nested-router-tab-view/app/app.routing.ts +++ b/e2e/nested-router-tab-view/app/app.routing.ts @@ -9,6 +9,8 @@ import { TeamDetailComponent } from "./team/team-detail.component"; import { LoginComponent } from "./login/login.component"; import { TabsComponent } from "./tabs/tabs.component"; import { HomeComponent } from "./home/home.component"; +import { HomeLazyModule } from "./home-lazy/home-lazy.module"; +import { CustomTabsModule } from "./custom-tabs/custom-tabs.module" import { AboutComponent } from "./about/about.component"; import { AboutNestedComponent } from "./about/about-nested.component"; @@ -46,11 +48,11 @@ const routes: Routes = [ }, { path: "home-lazy", - loadChildren: "./home-lazy/home-lazy.module#HomeLazyModule", + loadChildren: () => HomeLazyModule, }, { path: "custom-tabs", - loadChildren: "./custom-tabs/custom-tabs.module#CustomTabsModule", + loadChildren: () => CustomTabsModule, }, { path: "tabs", component: TabsComponent, children: [ diff --git a/e2e/nested-router-tab-view/package.json b/e2e/nested-router-tab-view/package.json index db7a05014..ea1c576b2 100644 --- a/e2e/nested-router-tab-view/package.json +++ b/e2e/nested-router-tab-view/package.json @@ -13,16 +13,17 @@ } }, "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../../nativescript-angular", + "nativescript-dev-webpack": "next", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", @@ -30,8 +31,8 @@ "zone.js": "^0.9.1" }, "devDependencies": { - "@angular/compiler-cli": "8.0.0", - "@ngtools/webpack": "8.0.0", + "@angular/compiler-cli": "~8.0.0", + "@ngtools/webpack": "~8.0.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", diff --git a/e2e/nested-router-tab-view/tsconfig.json b/e2e/nested-router-tab-view/tsconfig.json index 575276e9f..d93d819b4 100644 --- a/e2e/nested-router-tab-view/tsconfig.json +++ b/e2e/nested-router-tab-view/tsconfig.json @@ -6,7 +6,6 @@ "emitDecoratorMetadata": true, "noEmitHelpers": true, "noEmitOnError": true, - "sourceMap": true, "lib": [ "es6", "dom", @@ -23,8 +22,16 @@ ] } }, + "include": [ + "../../nativescript-angular", + "**/*" + ], "exclude": [ + "../../nativescript-angular/node_modules", + "../../nativescript-angular/**/*.d.ts", "node_modules", - "platforms" + "platforms", + "**/*.aot", + "e2e" ] } \ No newline at end of file diff --git a/e2e/renderer/package.json b/e2e/renderer/package.json index 1b361039c..ccb61a320 100644 --- a/e2e/renderer/package.json +++ b/e2e/renderer/package.json @@ -7,14 +7,14 @@ "id": "org.nativescript.renderer" }, "dependencies": { - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../../nativescript-angular", "nativescript-intl": "^3.0.0", "reflect-metadata": "~0.1.8", @@ -23,8 +23,8 @@ "zone.js": "^0.9.1" }, "devDependencies": { - "@angular/compiler-cli": "8.0.0", - "@ngtools/webpack": "8.0.0", + "@angular/compiler-cli": "~8.0.0", + "@ngtools/webpack": "~8.0.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", diff --git a/e2e/routable-animations/package.json b/e2e/routable-animations/package.json index 89a5ca351..e7d9fae01 100644 --- a/e2e/routable-animations/package.json +++ b/e2e/routable-animations/package.json @@ -7,15 +7,15 @@ "id": "org.nativescript.nsroanimations" }, "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "next", "nativescript-theme-core": "~1.0.2", "reflect-metadata": "~0.1.8", @@ -24,8 +24,8 @@ "zone.js": "^0.9.1" }, "devDependencies": { - "@ngtools/webpack": "8.0.0", - "@angular/compiler-cli": "8.0.0", + "@ngtools/webpack": "~8.0.0", + "@angular/compiler-cli": "~8.0.0", "@types/chai": "~4.1.3", "@types/mocha": "~5.2.1", "@types/node": "^7.0.5", diff --git a/e2e/router-tab-view/package.json b/e2e/router-tab-view/package.json index bbc515127..d1758be19 100644 --- a/e2e/router-tab-view/package.json +++ b/e2e/router-tab-view/package.json @@ -13,16 +13,17 @@ } }, "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../../nativescript-angular", + "nativescript-dev-webpack": "next", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "~6.3.3", @@ -41,7 +42,9 @@ "mochawesome": "~3.1.2", "nativescript-dev-appium": "next", "nativescript-dev-typescript": "next", - "typescript": "~3.4.5" + "typescript": "~3.4.5", + "@angular/compiler-cli": "8.0.0", + "@ngtools/webpack": "8.0.0" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", diff --git a/e2e/router-tab-view/tsconfig.json b/e2e/router-tab-view/tsconfig.json index 357c35626..d93d819b4 100644 --- a/e2e/router-tab-view/tsconfig.json +++ b/e2e/router-tab-view/tsconfig.json @@ -16,11 +16,22 @@ "*": [ "./node_modules/tns-core-modules/*", "./node_modules/*" + ], + "~/*": [ + "app/*" ] } }, + "include": [ + "../../nativescript-angular", + "**/*" + ], "exclude": [ + "../../nativescript-angular/node_modules", + "../../nativescript-angular/**/*.d.ts", "node_modules", - "platforms" + "platforms", + "**/*.aot", + "e2e" ] } \ No newline at end of file diff --git a/e2e/router/package.json b/e2e/router/package.json index 7467fec70..06f280221 100644 --- a/e2e/router/package.json +++ b/e2e/router/package.json @@ -10,15 +10,15 @@ } }, "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../../nativescript-angular", "nativescript-intl": "^3.0.0", "reflect-metadata": "~0.1.8", @@ -27,8 +27,8 @@ "zone.js": "^0.9.1" }, "devDependencies": { - "@angular/compiler-cli": "8.0.0", - "@ngtools/webpack": "8.0.0", + "@angular/compiler-cli": "~8.0.0", + "@ngtools/webpack": "~8.0.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "^10.12.12", diff --git a/e2e/single-page/package.json b/e2e/single-page/package.json index 7e2886386..3d208aea7 100644 --- a/e2e/single-page/package.json +++ b/e2e/single-page/package.json @@ -13,15 +13,15 @@ } }, "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../../nativescript-angular", "nativescript-intl": "^3.0.0", "reflect-metadata": "~0.1.8", @@ -30,8 +30,8 @@ "zone.js": "^0.9.1" }, "devDependencies": { - "@angular/compiler-cli": "8.0.0", - "@ngtools/webpack": "8.0.0", + "@angular/compiler-cli": "~8.0.0", + "@ngtools/webpack": "~8.0.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", diff --git a/e2e/tests-app-ng/package.json b/e2e/tests-app-ng/package.json index 08f717f23..cbb98810e 100644 --- a/e2e/tests-app-ng/package.json +++ b/e2e/tests-app-ng/package.json @@ -13,13 +13,13 @@ } }, "dependencies": { - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "next", "nativescript-intl": "~3.0.0", "nativescript-theme-core": "^1.0.4", diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 6439dc7c9..901bc399c 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -45,30 +45,30 @@ "reflect-metadata": "^0.1.8" }, "peerDependencies": { - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/router": "~8.0.0", "rxjs": "^6.3.3", "tns-core-modules": "^5.1.0 || >5.1.0- || >5.2.0-", "typescript": "~3.4.5", "zone.js": "^0.9.1" }, "devDependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/compiler-cli": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/compiler-cli": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "codelyzer": "^4.5.0", "conventional-changelog-cli": "^1.3.22", "rxjs": "~6.3.3", diff --git a/ng-sample/package.json b/ng-sample/package.json index aba4a594b..019f35337 100644 --- a/ng-sample/package.json +++ b/ng-sample/package.json @@ -32,15 +32,15 @@ }, "homepage": "https://github.com/NativeScript/template-hello-world", "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "file:../nativescript-angular", "rxjs": "~6.3.3", "tns-core-modules": "next", diff --git a/tests/app/global.d.ts b/tests/app/global.d.ts deleted file mode 100644 index 81ddef2ce..000000000 --- a/tests/app/global.d.ts +++ /dev/null @@ -1 +0,0 @@ -/// diff --git a/tests/app/snippets/gestures.component.ts b/tests/app/snippets/gestures.component.ts index 50f6cd9ce..a60502b11 100644 --- a/tests/app/snippets/gestures.component.ts +++ b/tests/app/snippets/gestures.component.ts @@ -9,7 +9,8 @@ import { @Component({ selector: "gestures", - templateUrl: "snippets/gestures.component.html", + moduleId: module.id, + templateUrl: "gestures.component.html", styles: ["label { font-size: 32; margin: 2; background-color: lightgreen;}"] }) export class GestureComponent { diff --git a/tests/app/snippets/icon-font.component.ts b/tests/app/snippets/icon-font.component.ts index 64fdc5e7f..8b66ad36a 100644 --- a/tests/app/snippets/icon-font.component.ts +++ b/tests/app/snippets/icon-font.component.ts @@ -4,8 +4,9 @@ import {Component} from "@angular/core"; @Component({ // >> (hide) selector: "icon-font", - templateUrl: "snippets/icon-font.component.html", - styleUrls: ["snippets/icon-font.component.css"] + moduleId: module.id, + templateUrl: "icon-font.component.html", + styleUrls: ["icon-font.component.css"] // << (hide) // ... }) diff --git a/tests/app/snippets/layouts.component.ts b/tests/app/snippets/layouts.component.ts index 5892c0492..0e148b70a 100644 --- a/tests/app/snippets/layouts.component.ts +++ b/tests/app/snippets/layouts.component.ts @@ -2,7 +2,8 @@ import {Component} from "@angular/core"; @Component({ selector: "gestures", - templateUrl: "snippets/layouts.component.html", + moduleId: module.id, + templateUrl: "layouts.component.html", styles: [ "Image { background-color: coral }", ".title { margin: 10; horizontal-align: center; font-size: 32 }", diff --git a/tests/app/snippets/navigation/router-extensions.ts b/tests/app/snippets/navigation/router-extensions.ts index bb72a6d2a..ae8c8c206 100644 --- a/tests/app/snippets/navigation/router-extensions.ts +++ b/tests/app/snippets/navigation/router-extensions.ts @@ -4,8 +4,9 @@ import { RouterExtensions } from "nativescript-angular/router"; @Component({ // ... // >> (hide) + moduleId: module.id, selector: "router-extensions-import", - templateUrl: "snippets/navigation/router-extensions.html" + templateUrl: "router-extensions.html" // << (hide) }) export class MyComponent { diff --git a/tests/hooks/after-prepare/nativescript-unit-test-runner.js b/tests/hooks/after-prepare/nativescript-unit-test-runner.js index 45ca49f8a..67bdf40a7 100644 --- a/tests/hooks/after-prepare/nativescript-unit-test-runner.js +++ b/tests/hooks/after-prepare/nativescript-unit-test-runner.js @@ -1 +1 @@ -module.exports = require("nativescript-unit-test-runner/lib/after-prepare"); +module.exports = require("nativescript-unit-test-runner/./lib/after-prepare.js"); diff --git a/tests/karma.conf.js b/tests/karma.conf.js index a02f0287a..cfac187c6 100644 --- a/tests/karma.conf.js +++ b/tests/karma.conf.js @@ -1,6 +1,8 @@ -module.exports = function(config) { - config.set({ - browserNoActivityTimeout: 40000, + +const RemoveStrictPlugin = require( 'remove-strict-webpack-plugin' ); + +module.exports = function (config) { + const options = { // base path that will be used to resolve all patterns (eg. files, exclude) basePath: '', @@ -12,10 +14,10 @@ module.exports = function(config) { // list of files / patterns to load in the browser + // TODO: changing this to .ts files causes the test to become lest from 126 to 106. ~20 tests are cutoff by something. Needs a future research files: [ 'app/tests/test-main.js', - 'app/**/*.js', - 'src/tests/**/*.js' + 'app/**/*.js' ], // list of files to exclude @@ -32,7 +34,7 @@ module.exports = function(config) { // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['mocha'], + reporters: ['progress'], // web server port @@ -49,7 +51,7 @@ module.exports = function(config) { // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, + autoWatch: true, // start these browsers @@ -74,6 +76,41 @@ module.exports = function(config) { // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits - singleRun: true - }) + singleRun: false + }; + + setWebpackPreprocessor(config, options); + setWebpack(config, options); + + config.set(options); +} + +function setWebpackPreprocessor(config, options) { + if (config && config.bundle) { + if (!options.preprocessors) { + options.preprocessors = {}; + } + + options.files.forEach(file => { + if (!options.preprocessors[file]) { + options.preprocessors[file] = []; + } + options.preprocessors[file].push('webpack'); + }); + } +} + +function setWebpack(config, options) { + if (config && config.bundle) { + const env = {}; + env[config.platform] = true; + env.sourceMap = config.debugBrk; + env.unitTesting = true; + options.webpack = require('./webpack.config')(env); + delete options.webpack.entry; + delete options.webpack.output.libraryTarget; + const invalidPluginsForUnitTesting = ["GenerateBundleStarterPlugin", "GenerateNativeScriptEntryPointsPlugin"]; + options.webpack.plugins = options.webpack.plugins.filter(p => !invalidPluginsForUnitTesting.includes(p.constructor.name)); + options.webpack.plugins.push(new RemoveStrictPlugin()); + } } diff --git a/tests/nsconfig.json b/tests/nsconfig.json new file mode 100644 index 000000000..c1ec5f483 --- /dev/null +++ b/tests/nsconfig.json @@ -0,0 +1,5 @@ +{ + "useLegacyWorkflow": false, + "appPath": "app", + "appResourcesPath": "app/App_Resources" +} \ No newline at end of file diff --git a/tests/package.json b/tests/package.json index e1e0f4ed6..794743063 100644 --- a/tests/package.json +++ b/tests/package.json @@ -9,7 +9,6 @@ } }, "name": "ngtests", - "main": "app.js", "version": "1.0.0", "author": "Telerik ", "description": "Angular tests", @@ -26,38 +25,44 @@ ], "homepage": "http://nativescript.org", "dependencies": { - "@angular/animations": "8.0.0", - "@angular/common": "8.0.0", - "@angular/compiler": "8.0.0", - "@angular/core": "8.0.0", - "@angular/forms": "8.0.0", + "@angular/animations": "~8.0.0", + "@angular/common": "~8.0.0", + "@angular/compiler": "~8.0.0", + "@angular/core": "~8.0.0", + "@angular/forms": "~8.0.0", "@angular/http": "8.0.0-beta.10", - "@angular/platform-browser": "8.0.0", - "@angular/platform-browser-dynamic": "8.0.0", - "@angular/router": "8.0.0", + "@angular/platform-browser": "~8.0.0", + "@angular/platform-browser-dynamic": "~8.0.0", + "@angular/router": "~8.0.0", "nativescript-angular": "../nativescript-angular", - "nativescript-unit-test-runner": "^0.3.4", + "nativescript-unit-test-runner": "~0.6.3", "rxjs": "~6.3.3", "tns-core-modules": "next", "zone.js": "^0.9.1" }, "devDependencies": { + "@angular/compiler-cli": "8.0.0", + "@ngtools/webpack": "8.0.0", "@types/chai": "^4.1.4", - "@types/mocha": "^5.2.4", + "@types/karma-chai": "0.1.1", + "@types/mocha": "5.2.7", "@types/sinon": "^7.0.11", "babel-traverse": "6.8.0", "babel-types": "6.8.1", "babylon": "6.8.0", - "chai": "4.1.2", - "karma": "2.0.4", + "chai": "4.2.0", + "karma": "4.1.0", "karma-chai": "0.1.0", "karma-mocha": "1.3.0", "karma-mocha-reporter": "2.2.5", "karma-nativescript-launcher": "0.4.0", "karma-sinon": "^1.0.5", + "karma-webpack": "3.0.5", "lazy": "1.0.11", - "mocha": "5.2.0", + "mocha": "6.1.4", "nativescript-dev-typescript": "next", + "nativescript-dev-webpack": "next", + "remove-strict-webpack-plugin": "~0.1.2", "sinon": "^7.3.2", "tslint": "^4.5.1", "typescript": "~3.4.5" diff --git a/tests/references.d.ts b/tests/references.d.ts index b14f3837d..23f21bb29 100644 --- a/tests/references.d.ts +++ b/tests/references.d.ts @@ -1 +1,2 @@ -/// Needed for autocompletion and compilation. \ No newline at end of file +/// Needed for autocompletion and compilation. +/// \ No newline at end of file diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 67688d919..d24fffdf3 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -22,7 +22,13 @@ ] } }, + "include": [ + "../nativescript-angular", + "**/*" + ], "exclude": [ + "../nativescript-angular/node_modules", + "../nativescript-angular/**/*.d.ts", "node_modules", "platforms", "**/*.aot", diff --git a/tests/webpack.config.js b/tests/webpack.config.js new file mode 100644 index 000000000..0d150698a --- /dev/null +++ b/tests/webpack.config.js @@ -0,0 +1,318 @@ +const { join, relative, resolve, sep, dirname } = require("path"); + +const webpack = require("webpack"); +const nsWebpack = require("nativescript-dev-webpack"); +const nativescriptTarget = require("nativescript-dev-webpack/nativescript-target"); +const { nsReplaceBootstrap } = require("nativescript-dev-webpack/transformers/ns-replace-bootstrap"); +const { nsReplaceLazyLoader } = require("nativescript-dev-webpack/transformers/ns-replace-lazy-loader"); +const { nsSupportHmrNg } = require("nativescript-dev-webpack/transformers/ns-support-hmr-ng"); +const { getMainModulePath } = require("nativescript-dev-webpack/utils/ast-utils"); +const CleanWebpackPlugin = require("clean-webpack-plugin"); +const CopyWebpackPlugin = require("copy-webpack-plugin"); +const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer"); +const { NativeScriptWorkerPlugin } = require("nativescript-worker-loader/NativeScriptWorkerPlugin"); +const TerserPlugin = require("terser-webpack-plugin"); +const { getAngularCompilerPlugin } = require("nativescript-dev-webpack/plugins/NativeScriptAngularCompilerPlugin"); +const hashSalt = Date.now().toString(); + +module.exports = env => { + // Add your custom Activities, Services and other Android app components here. + const appComponents = [ + "tns-core-modules/ui/frame", + "tns-core-modules/ui/frame/activity", + ]; + + const platform = env && (env.android && "android" || env.ios && "ios"); + if (!platform) { + throw new Error("You need to provide a target platform!"); + } + + const AngularCompilerPlugin = getAngularCompilerPlugin(platform); + const projectRoot = __dirname; + + // Default destination inside platforms//... + const dist = resolve(projectRoot, nsWebpack.getAppPath(platform, projectRoot)); + const appResourcesPlatformDir = platform === "android" ? "Android" : "iOS"; + + const { + // The 'appPath' and 'appResourcesPath' values are fetched from + // the nsconfig.json configuration file + // when bundling with `tns run android|ios --bundle`. + appPath = "app", + appResourcesPath = "app/App_Resources", + + // You can provide the following flags when running 'tns run android|ios' + aot, // --env.aot + snapshot, // --env.snapshot, + production, // --env.production + uglify, // --env.uglify + report, // --env.report + sourceMap, // --env.sourceMap + hiddenSourceMap, // --env.hiddenSourceMap + hmr, // --env.hmr, + unitTesting, // --env.unitTesting + verbose, // --env.verbose + } = env; + + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; + const externals = nsWebpack.getConvertedExternals(env.externals); + const appFullPath = resolve(projectRoot, appPath); + const appResourcesFullPath = resolve(projectRoot, appResourcesPath); + const tsConfigName = "tsconfig.tns.json"; + const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`; + const entryPath = `.${sep}${entryModule}`; + const entries = { bundle: entryPath }; + if (platform === "ios") { + entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules.js"; + }; + + const ngCompilerTransformers = []; + const additionalLazyModuleResources = []; + if (aot) { + ngCompilerTransformers.push(nsReplaceBootstrap); + } + + if (hmr) { + ngCompilerTransformers.push(nsSupportHmrNg); + } + + // when "@angular/core" is external, it's not included in the bundles. In this way, it will be used + // directly from node_modules and the Angular modules loader won't be able to resolve the lazy routes + // fixes https://github.com/NativeScript/nativescript-cli/issues/4024 + if (env.externals && env.externals.indexOf("@angular/core") > -1) { + const appModuleRelativePath = getMainModulePath(resolve(appFullPath, entryModule), tsConfigName); + if (appModuleRelativePath) { + const appModuleFolderPath = dirname(resolve(appFullPath, appModuleRelativePath)); + // include the lazy loader inside app module + ngCompilerTransformers.push(nsReplaceLazyLoader); + // include the new lazy loader path in the allowed ones + additionalLazyModuleResources.push(appModuleFolderPath); + } + } + + const ngCompilerPlugin = new AngularCompilerPlugin({ + hostReplacementPaths: nsWebpack.getResolver([platform, "tns"]), + platformTransformers: ngCompilerTransformers.map(t => t(() => ngCompilerPlugin, resolve(appFullPath, entryModule), projectRoot)), + mainPath: join(appFullPath, entryModule), + tsConfigPath: join(__dirname, tsConfigName), + skipCodeGeneration: !aot, + sourceMap: !!isAnySourceMapEnabled, + additionalLazyModuleResources: additionalLazyModuleResources + }); + + let sourceMapFilename = nsWebpack.getSourceMapFilename(hiddenSourceMap, __dirname, dist); + + const itemsToClean = [`${dist}/**/*`]; + if (platform === "android") { + itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "src", "main", "assets", "snapshots")}`); + itemsToClean.push(`${join(projectRoot, "platforms", "android", "app", "build", "configurations", "nativescript-android-snapshot")}`); + } + + const config = { + mode: production ? "production" : "development", + context: appFullPath, + externals, + watchOptions: { + ignored: [ + appResourcesFullPath, + // Don't watch hidden files + "**/.*", + ] + }, + target: nativescriptTarget, + entry: entries, + output: { + pathinfo: false, + path: dist, + sourceMapFilename, + libraryTarget: "commonjs2", + filename: "[name].js", + globalObject: "global", + hashSalt + }, + resolve: { + extensions: [".ts", ".js", ".scss", ".css"], + // Resolve {N} system modules from tns-core-modules + modules: [ + resolve(__dirname, "node_modules/tns-core-modules"), + resolve(__dirname, "node_modules"), + "node_modules/tns-core-modules", + "node_modules", + ], + alias: { + '~': appFullPath + }, + symlinks: true + }, + resolveLoader: { + symlinks: false + }, + node: { + // Disable node shims that conflict with NativeScript + "http": false, + "timers": false, + "setImmediate": false, + "fs": "empty", + "__dirname": false, + }, + devtool: hiddenSourceMap ? "hidden-source-map" : (sourceMap ? "inline-source-map" : "none"), + optimization: { + runtimeChunk: "single", + splitChunks: { + cacheGroups: { + vendor: { + name: "vendor", + chunks: "all", + test: (module, chunks) => { + const moduleName = module.nameForCondition ? module.nameForCondition() : ''; + return /[\\/]node_modules[\\/]/.test(moduleName) || + appComponents.some(comp => comp === moduleName); + }, + enforce: true, + }, + } + }, + minimize: !!uglify, + minimizer: [ + new TerserPlugin({ + parallel: true, + cache: true, + sourceMap: isAnySourceMapEnabled, + terserOptions: { + output: { + comments: false, + semicolons: !isAnySourceMapEnabled + }, + compress: { + // The Android SBG has problems parsing the output + // when these options are enabled + 'collapse_vars': platform !== "android", + sequences: platform !== "android", + } + } + }) + ], + }, + module: { + rules: [ + { + test: nsWebpack.getEntryPathRegExp(appFullPath, entryPath), + use: [ + // Require all Android app components + platform === "android" && { + loader: "nativescript-dev-webpack/android-app-components-loader", + options: { modules: appComponents } + }, + + { + loader: "nativescript-dev-webpack/bundle-config-loader", + options: { + angular: true, + loadCss: !snapshot, // load the application css if in debug mode + unitTesting, + appFullPath, + projectRoot, + } + }, + ].filter(loader => !!loader) + }, + + { test: /\.html$|\.xml$/, use: "raw-loader" }, + + // tns-core-modules reads the app.css and its imports using css-loader + { + test: /[\/|\\]app\.css$/, + use: [ + "nativescript-dev-webpack/style-hot-loader", + { loader: "css-loader", options: { url: false } } + ] + }, + { + test: /[\/|\\]app\.scss$/, + use: [ + "nativescript-dev-webpack/style-hot-loader", + { loader: "css-loader", options: { url: false } }, + "sass-loader" + ] + }, + + // Angular components reference css files and their imports using raw-loader + { test: /\.css$/, exclude: /[\/|\\]app\.css$/, use: "raw-loader" }, + { test: /\.scss$/, exclude: /[\/|\\]app\.scss$/, use: ["raw-loader", "resolve-url-loader", "sass-loader"] }, + + { + test: /(?:\.ngfactory\.js|\.ngstyle\.js|\.ts)$/, + use: [ + "nativescript-dev-webpack/moduleid-compat-loader", + "nativescript-dev-webpack/lazy-ngmodule-hot-loader", + "@ngtools/webpack", + ] + }, + + // Mark files inside `@angular/core` as using SystemJS style dynamic imports. + // Removing this will cause deprecation warnings to appear. + { + test: /[\/\\]@angular[\/\\]core[\/\\].+\.js$/, + parser: { system: true }, + }, + ], + }, + plugins: [ + // Define useful constants like TNS_WEBPACK + new webpack.DefinePlugin({ + "global.TNS_WEBPACK": "true", + "process": undefined, + }), + // Remove all files from the out dir. + new CleanWebpackPlugin(itemsToClean, { verbose: !!verbose }), + // Copy assets to out dir. Add your own globs as needed. + new CopyWebpackPlugin([ + { from: { glob: "fonts/**" } }, + { from: { glob: "**/*.jpg" } }, + { from: { glob: "**/*.png" } }, + ], { ignore: [`${relative(appPath, appResourcesFullPath)}/**`] }), + new nsWebpack.GenerateNativeScriptEntryPointsPlugin("bundle"), + // For instructions on how to set up workers with webpack + // check out https://github.com/nativescript/worker-loader + new NativeScriptWorkerPlugin(), + ngCompilerPlugin, + // Does IPC communication with the {N} CLI to notify events when running in watch mode. + new nsWebpack.WatchStateLoggerPlugin(), + ], + }; + + if (report) { + // Generate report files for bundles content + config.plugins.push(new BundleAnalyzerPlugin({ + analyzerMode: "static", + openAnalyzer: false, + generateStatsFile: true, + reportFilename: resolve(projectRoot, "report", `report.html`), + statsFilename: resolve(projectRoot, "report", `stats.json`), + })); + } + + if (snapshot) { + config.plugins.push(new nsWebpack.NativeScriptSnapshotPlugin({ + chunk: "vendor", + angular: true, + requireModules: [ + "reflect-metadata", + "@angular/platform-browser", + "@angular/core", + "@angular/common", + "@angular/router", + "nativescript-angular/platform-static", + "nativescript-angular/router", + ], + projectRoot, + webpackConfig: config, + })); + } + + if (hmr) { + config.plugins.push(new webpack.HotModuleReplacementPlugin()); + } + + return config; +}; From ab740cd72b38b0686ceb0480e9b6d4d6ec0158b0 Mon Sep 17 00:00:00 2001 From: Alexander Vakrilov Date: Wed, 26 Jun 2019 13:56:55 +0300 Subject: [PATCH 05/10] refactor: remove deprecated API usage (#1874) --- nativescript-angular/view-util.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativescript-angular/view-util.ts b/nativescript-angular/view-util.ts index faeb62329..97a2f6ba3 100644 --- a/nativescript-angular/view-util.ts +++ b/nativescript-angular/view-util.ts @@ -365,7 +365,7 @@ export class ViewUtil { } if (XML_ATTRIBUTES.indexOf(attributeName) !== -1) { - view._applyXmlAttribute(attributeName, value); + view[attributeName] = value; return; } From 1f568554dc719b6034528da5cd82e5ee54cc00f3 Mon Sep 17 00:00:00 2001 From: Alexander Vakrilov Date: Thu, 27 Jun 2019 17:49:09 +0300 Subject: [PATCH 06/10] tests: mocha reporter and include ts files (#1875) --- tests/karma.conf.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/karma.conf.js b/tests/karma.conf.js index cfac187c6..e6f77fdbc 100644 --- a/tests/karma.conf.js +++ b/tests/karma.conf.js @@ -14,10 +14,9 @@ module.exports = function (config) { // list of files / patterns to load in the browser - // TODO: changing this to .ts files causes the test to become lest from 126 to 106. ~20 tests are cutoff by something. Needs a future research files: [ - 'app/tests/test-main.js', - 'app/**/*.js' + 'app/tests/test-main.ts', + 'app/**/*.ts' ], // list of files to exclude @@ -34,7 +33,7 @@ module.exports = function (config) { // test results reporter to use // possible values: 'dots', 'progress' // available reporters: https://npmjs.org/browse/keyword/karma-reporter - reporters: ['progress'], + reporters: ['mocha'], // web server port From 5042e089c57c9224865f38f73a2e8636b63063ee Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Fri, 28 Jun 2019 09:05:38 -0300 Subject: [PATCH 07/10] Migrate from ReflectiveInjector (deprecated) to StaticInjector (#1868) * chore: migrate to StaticInjector * chore: replace parentInjector in detached-loader --- nativescript-angular/common/detached-loader.ts | 4 ++-- nativescript-angular/directives/dialogs.ts | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/nativescript-angular/common/detached-loader.ts b/nativescript-angular/common/detached-loader.ts index 214b0caf1..cb4038584 100644 --- a/nativescript-angular/common/detached-loader.ts +++ b/nativescript-angular/common/detached-loader.ts @@ -29,7 +29,7 @@ export class DetachedLoader { // tslint:disable-line:component-class-suffix private loadInLocation(componentType: Type): Promise> { const factory = this.resolver.resolveComponentFactory(componentType); const componentRef = this.containerRef.createComponent( - factory, this.containerRef.length, this.containerRef.parentInjector); + factory, this.containerRef.length, this.containerRef.injector); // Component is created, built may not be checked if we are loading // inside component with OnPush CD strategy. Mark us for check to be sure CD will reach us. @@ -52,6 +52,6 @@ export class DetachedLoader { // tslint:disable-line:component-class-suffix public loadWithFactory(factory: ComponentFactory): ComponentRef { return this.containerRef.createComponent(factory, - this.containerRef.length, this.containerRef.parentInjector, null); + this.containerRef.length, this.containerRef.injector, null); } } diff --git a/nativescript-angular/directives/dialogs.ts b/nativescript-angular/directives/dialogs.ts index 51363c032..13dde66d6 100644 --- a/nativescript-angular/directives/dialogs.ts +++ b/nativescript-angular/directives/dialogs.ts @@ -3,8 +3,8 @@ import { ComponentRef, Directive, Injectable, + Injector, NgModuleRef, - ReflectiveInjector, Type, ViewContainerRef } from "@angular/core"; @@ -18,7 +18,7 @@ import { DetachedLoader } from "../common/detached-loader"; import { PageFactory, PAGE_FACTORY } from "../platform-providers"; import { once } from "../common/utils"; import { topmost, Frame } from "tns-core-modules/ui/frame"; -import { ShowModalOptions } from "tns-core-modules/ui/core/view"; +import { ShowModalOptions } from "tns-core-modules/ui/core/view"; export type BaseShowModalOptions = Pick>; @@ -126,11 +126,11 @@ export class ModalDialogService { }); const modalParams = new ModalDialogParams(options.context, closeCallback); - const providers = ReflectiveInjector.resolve([ - { provide: ModalDialogParams, useValue: modalParams }, - ]); - const childInjector = ReflectiveInjector.fromResolvedProviders(providers, options.containerRef.parentInjector); + const childInjector = Injector.create({ + providers: [{ provide: ModalDialogParams, useValue: modalParams }], + parent: options.containerRef.injector + }); const detachedFactory = options.resolver.resolveComponentFactory(DetachedLoader); detachedLoaderRef = options.containerRef.createComponent(detachedFactory, -1, childInjector, null); detachedLoaderRef.instance.loadComponent(options.type).then((compRef) => { From 34db4c2dfc85d43c0c1daf31a71926ae8acc24d5 Mon Sep 17 00:00:00 2001 From: VladimirAmiorkov Date: Fri, 28 Jun 2019 16:21:16 +0300 Subject: [PATCH 08/10] release: cut the 8.0.2 release --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e0db94f5..adfff84cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ + +## [8.0.2](https://github.com/NativeScript/nativescript-angular/compare/8.0.1...8.0.2) (2019-06-28) + +### Bug Fixes + + * remove deprecated API usage ([#1874](https://github.com/NativeScript/nativescript-angular/pull/1874)) ([ab740cd](https://github.com/NativeScript/nativescript-angular/commit/ab740cd)) + * migrate from ReflectiveInjector (deprecated) to StaticInjector ([#1868](https://github.com/NativeScript/nativescript-angular/pull/1868)) ([e432841](https://github.com/NativeScript/nativescript-angular/pull/1868/commits/e432841e9b474ad188f87044b74666b322d68b5d)) + + ## [8.0.1](https://github.com/NativeScript/nativescript-angular/compare/8.0.0...8.0.1) (2019-06-12) From f92670957085fe8c8cce063f1469da9d3cea8099 Mon Sep 17 00:00:00 2001 From: VladimirAmiorkov Date: Fri, 28 Jun 2019 16:34:43 +0300 Subject: [PATCH 09/10] chore: update version --- nativescript-angular/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 901bc399c..977320942 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-angular", - "version": "8.1.0", + "version": "8.0.2", "description": "An Angular renderer that lets you build mobile apps with NativeScript.", "homepage": "https://www.nativescript.org/", "bugs": "https://github.com/NativeScript/nativescript-angular/issues", From 0f0ecf3521aed5ffa75684cfcafff73931b3494c Mon Sep 17 00:00:00 2001 From: VladimirAmiorkov Date: Fri, 28 Jun 2019 16:54:30 +0300 Subject: [PATCH 10/10] chore: update CHANGELOG for 8.0.2 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index adfff84cf..d188f1fca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ * remove deprecated API usage ([#1874](https://github.com/NativeScript/nativescript-angular/pull/1874)) ([ab740cd](https://github.com/NativeScript/nativescript-angular/commit/ab740cd)) * migrate from ReflectiveInjector (deprecated) to StaticInjector ([#1868](https://github.com/NativeScript/nativescript-angular/pull/1868)) ([e432841](https://github.com/NativeScript/nativescript-angular/pull/1868/commits/e432841e9b474ad188f87044b74666b322d68b5d)) + ### Features + +* Update peer dependencies to Angular 8.x.x ([#1857](https://github.com/NativeScript/nativescript-angular/pull/1857)) ([060aabf](https://github.com/NativeScript/nativescript-angular/pull/1857/commits/060aabf146aa0f132f3617dcfaeea0efa7baf228)) + ## [8.0.1](https://github.com/NativeScript/nativescript-angular/compare/8.0.0...8.0.1) (2019-06-12)