diff --git a/.gitignore b/.gitignore index ca4ea8626..8acab70b6 100644 --- a/.gitignore +++ b/.gitignore @@ -56,4 +56,7 @@ tsconfig.tns.json !.vscode/tasks.json !.vscode/launch.json !.vscode/extensions.json +.editorconfig +# Ivy configuration files +!nativescript-angular/ngcc.config.js \ No newline at end of file diff --git a/e2e/animation-examples/package.json b/e2e/animation-examples/package.json index 126f35fa3..6485f9e7c 100644 --- a/e2e/animation-examples/package.json +++ b/e2e/animation-examples/package.json @@ -13,24 +13,25 @@ } }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.2", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", @@ -44,7 +45,7 @@ "nativescript-css-loader": "~0.26.0", "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "u": "update-ns-webpack", @@ -52,6 +53,8 @@ "e2e-watch": "tsc -p e2e --watch", "update-app-ng-deps": "update-app-ng-deps", "ns-verify-bundle": "ns-verify-bundle", - "update-ns-webpack": "update-ns-webpack" + "update-ns-webpack": "update-ns-webpack", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/animation-examples/tsconfig.json b/e2e/animation-examples/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/animation-examples/tsconfig.json +++ b/e2e/animation-examples/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/animation-examples/tsconfig.tns.json b/e2e/animation-examples/tsconfig.tns.json index 95f2ecee0..a96f6bbc6 100644 --- a/e2e/animation-examples/tsconfig.tns.json +++ b/e2e/animation-examples/tsconfig.tns.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "moduleResolution": "node" } } diff --git a/e2e/ivy-sample/.gitignore b/e2e/ivy-sample/.gitignore new file mode 100644 index 000000000..c5bbac145 --- /dev/null +++ b/e2e/ivy-sample/.gitignore @@ -0,0 +1,36 @@ +# NativeScript +hooks/ +node_modules/ +platforms/ + +# NativeScript Template +*.js.map +*.js +!webpack.config.js + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# General +.DS_Store +.AppleDouble +.LSOverride +.idea +.cloud +.project +tmp/ +typings/ + +# Visual Studio Code +.vscode/* +!.vscode/settings.json +!.vscode/tasks.json +!.vscode/launch.json +!.vscode/extensions.json + +# Ivy configuration files +!ngcc.config.js \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/Android/app.gradle b/e2e/ivy-sample/App_Resources/Android/app.gradle new file mode 100644 index 000000000..bb4842141 --- /dev/null +++ b/e2e/ivy-sample/App_Resources/Android/app.gradle @@ -0,0 +1,20 @@ +// Add your native dependencies here: + +// Uncomment to add recyclerview-v7 dependency +//dependencies { +// implementation 'com.android.support:recyclerview-v7:+' +//} + +// If you want to add something to be applied before applying plugins' include.gradle files +// e.g. project.ext.googlePlayServicesVersion = "15.0.1" +// create a file named before-plugins.gradle in the current directory and place it there + +android { + defaultConfig { + minSdkVersion 17 + generatedDensities = [] + } + aaptOptions { + additionalParameters "--no-version-vectors" + } +} diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/AndroidManifest.xml b/e2e/ivy-sample/App_Resources/Android/src/main/AndroidManifest.xml new file mode 100644 index 000000000..1bd6826c3 --- /dev/null +++ b/e2e/ivy-sample/App_Resources/Android/src/main/AndroidManifest.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/background.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/background.png new file mode 100644 index 000000000..eb381c258 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/background.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/icon.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/icon.png new file mode 100644 index 000000000..9cde84cd5 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/icon.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/logo.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/logo.png new file mode 100644 index 000000000..5218f4c90 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-hdpi/logo.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/background.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/background.png new file mode 100644 index 000000000..748b2adf5 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/background.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/icon.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/icon.png new file mode 100644 index 000000000..4d6a674b3 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/icon.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/logo.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/logo.png new file mode 100644 index 000000000..b9e102a76 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-ldpi/logo.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/background.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/background.png new file mode 100644 index 000000000..efeaf2907 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/background.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/icon.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/icon.png new file mode 100644 index 000000000..92ccc85a6 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/icon.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/logo.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/logo.png new file mode 100644 index 000000000..626338766 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-mdpi/logo.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml new file mode 100644 index 000000000..ada77f92c --- /dev/null +++ b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-nodpi/splash_screen.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/background.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/background.png new file mode 100644 index 000000000..612bbd072 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/background.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png new file mode 100644 index 000000000..8bcde6277 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/icon.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png new file mode 100644 index 000000000..ad8ee2f4b Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xhdpi/logo.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png new file mode 100644 index 000000000..0fa88e235 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/background.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png new file mode 100644 index 000000000..9d81c85dc Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/icon.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png new file mode 100644 index 000000000..668327832 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxhdpi/logo.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png new file mode 100644 index 000000000..c650f6438 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/background.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png new file mode 100644 index 000000000..9a34d0d43 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/icon.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png new file mode 100644 index 000000000..fa6331c8d Binary files /dev/null and b/e2e/ivy-sample/App_Resources/Android/src/main/res/drawable-xxxhdpi/logo.png differ diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/values-v21/colors.xml b/e2e/ivy-sample/App_Resources/Android/src/main/res/values-v21/colors.xml new file mode 100644 index 000000000..a64641a9d --- /dev/null +++ b/e2e/ivy-sample/App_Resources/Android/src/main/res/values-v21/colors.xml @@ -0,0 +1,4 @@ + + + #3d5afe + \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/values-v21/styles.xml b/e2e/ivy-sample/App_Resources/Android/src/main/res/values-v21/styles.xml new file mode 100644 index 000000000..408f3cc9f --- /dev/null +++ b/e2e/ivy-sample/App_Resources/Android/src/main/res/values-v21/styles.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/values/colors.xml b/e2e/ivy-sample/App_Resources/Android/src/main/res/values/colors.xml new file mode 100644 index 000000000..74ad8829c --- /dev/null +++ b/e2e/ivy-sample/App_Resources/Android/src/main/res/values/colors.xml @@ -0,0 +1,7 @@ + + + #F5F5F5 + #757575 + #33B5E5 + #272734 + \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/Android/src/main/res/values/styles.xml b/e2e/ivy-sample/App_Resources/Android/src/main/res/values/styles.xml new file mode 100644 index 000000000..923bb050e --- /dev/null +++ b/e2e/ivy-sample/App_Resources/Android/src/main/res/values/styles.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..1a8b0e645 --- /dev/null +++ b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,122 @@ +{ + "images" : [ + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "icon-20@2x.png", + "scale" : "2x" + }, + { + "size" : "20x20", + "idiom" : "iphone", + "filename" : "icon-20@3x.png", + "scale" : "3x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "iphone", + "filename" : "icon-29@3x.png", + "scale" : "3x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "iphone", + "filename" : "icon-40@3x.png", + "scale" : "3x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon-60@2x.png", + "scale" : "2x" + }, + { + "size" : "60x60", + "idiom" : "iphone", + "filename" : "icon-60@3x.png", + "scale" : "3x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "icon-20.png", + "scale" : "1x" + }, + { + "size" : "20x20", + "idiom" : "ipad", + "filename" : "icon-20@2x.png", + "scale" : "2x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon-29.png", + "scale" : "1x" + }, + { + "size" : "29x29", + "idiom" : "ipad", + "filename" : "icon-29@2x.png", + "scale" : "2x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon-40.png", + "scale" : "1x" + }, + { + "size" : "40x40", + "idiom" : "ipad", + "filename" : "icon-40@2x.png", + "scale" : "2x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon-76.png", + "scale" : "1x" + }, + { + "size" : "76x76", + "idiom" : "ipad", + "filename" : "icon-76@2x.png", + "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "icon-83.5@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "icon-1024.png", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png new file mode 100644 index 000000000..a1d7eb479 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-1024.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png new file mode 100644 index 000000000..5797bdef4 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png new file mode 100644 index 000000000..a0bc5691b Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png new file mode 100644 index 000000000..851ac65fb Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-20@3x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png new file mode 100644 index 000000000..bb9b9e86d Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png new file mode 100644 index 000000000..ec609dcf3 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png new file mode 100644 index 000000000..a97180800 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-29@3x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png new file mode 100644 index 000000000..214800ee6 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png new file mode 100644 index 000000000..8554b88a8 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png new file mode 100644 index 000000000..a22626bae Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-40@3x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png new file mode 100644 index 000000000..a22626bae Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png new file mode 100644 index 000000000..492c9c8e8 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-60@3x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png new file mode 100644 index 000000000..9208113cf Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png new file mode 100644 index 000000000..24415e5a3 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-76@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png new file mode 100644 index 000000000..b3ef1bf0c Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/AppIcon.appiconset/icon-83.5@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/Contents.json b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json new file mode 100644 index 000000000..ab5edd0ca --- /dev/null +++ b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchScreen-AspectFill.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-AspectFill@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-AspectFill@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png new file mode 100644 index 000000000..c293f9c7a Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png new file mode 100644 index 000000000..233693a6e Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png new file mode 100644 index 000000000..a954cc8f4 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.AspectFill.imageset/LaunchScreen-AspectFill@3x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json new file mode 100644 index 000000000..444d7152d --- /dev/null +++ b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "filename" : "LaunchScreen-Center.png", + "scale" : "1x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-Center@2x.png", + "scale" : "2x" + }, + { + "idiom" : "universal", + "filename" : "LaunchScreen-Center@3x.png", + "scale" : "3x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png new file mode 100644 index 000000000..a5a775a2b Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png new file mode 100644 index 000000000..154c19343 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@2x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png new file mode 100644 index 000000000..b2973b025 Binary files /dev/null and b/e2e/ivy-sample/App_Resources/iOS/Assets.xcassets/LaunchScreen.Center.imageset/LaunchScreen-Center@3x.png differ diff --git a/e2e/ivy-sample/App_Resources/iOS/Info.plist b/e2e/ivy-sample/App_Resources/iOS/Info.plist new file mode 100644 index 000000000..ea3e3ea23 --- /dev/null +++ b/e2e/ivy-sample/App_Resources/iOS/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIRequiresFullScreen + + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/e2e/ivy-sample/App_Resources/iOS/LaunchScreen.storyboard b/e2e/ivy-sample/App_Resources/iOS/LaunchScreen.storyboard new file mode 100644 index 000000000..c4e5a3f39 --- /dev/null +++ b/e2e/ivy-sample/App_Resources/iOS/LaunchScreen.storyboard @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/e2e/ivy-sample/App_Resources/iOS/build.xcconfig b/e2e/ivy-sample/App_Resources/iOS/build.xcconfig new file mode 100644 index 000000000..e77e78db9 --- /dev/null +++ b/e2e/ivy-sample/App_Resources/iOS/build.xcconfig @@ -0,0 +1,6 @@ +// You can add custom settings here +// for example you can uncomment the following line to force distribution code signing +// CODE_SIGN_IDENTITY = iPhone Distribution +// To build for device with Xcode 8 you need to specify your development team. More info: https://developer.apple.com/library/prerelease/content/releasenotes/DeveloperTools/RN-Xcode/Introduction.html +// DEVELOPMENT_TEAM = YOUR_TEAM_ID; +ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; diff --git a/e2e/ivy-sample/LICENSE b/e2e/ivy-sample/LICENSE new file mode 100644 index 000000000..4794b436d --- /dev/null +++ b/e2e/ivy-sample/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright (c) 2015-2019 Progress Software Corporation + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/e2e/ivy-sample/angular.json b/e2e/ivy-sample/angular.json new file mode 100644 index 000000000..1fbd44679 --- /dev/null +++ b/e2e/ivy-sample/angular.json @@ -0,0 +1,17 @@ +{ + "$schema": "./node_modules/@angular/cli/lib/config/schema.json", + "version": 1, + "newProjectRoot": "projects", + "cli": { + "defaultCollection": "@nativescript/schematics" + }, + "projects": { + "hello-world": { + "root": "", + "sourceRoot": "src", + "projectType": "application", + "prefix": "ns" + } + }, + "defaultProject": "hello-world" +} diff --git a/e2e/ivy-sample/nsconfig.json b/e2e/ivy-sample/nsconfig.json new file mode 100644 index 000000000..a64c9faaf --- /dev/null +++ b/e2e/ivy-sample/nsconfig.json @@ -0,0 +1,4 @@ +{ + "appResourcesPath": "App_Resources", + "appPath": "src" +} diff --git a/e2e/ivy-sample/package.json b/e2e/ivy-sample/package.json new file mode 100644 index 000000000..e9a3609a4 --- /dev/null +++ b/e2e/ivy-sample/package.json @@ -0,0 +1,43 @@ +{ + "nativescript": { + "id": "org.nativescript.ivysample", + "tns-android": { + "version": "6.2.0" + }, + "tns-ios": { + "version": "6.3.0-2020-01-07-173547-01" + } + }, + "description": "NativeScript Application", + "license": "SEE LICENSE IN ", + "repository": "", + "scripts": { + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" + }, + "dependencies": { + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/compiler-cli": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", + "@nativescript/theme": "~2.2.0", + "nativescript-angular": "file:../../nativescript-angular-package", + "rxjs": "^6.5.0", + "tns-core-modules": "next", + "tslib": "~1.10.0", + "zone.js": "~0.10.2" + }, + "devDependencies": { + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", + "nativescript-dev-webpack": "~1.5.0", + "typescript": "~3.8.3" + }, + "gitHead": "f0bdb5bcc6c991497ddf34d446ed0cb4ae4da091", + "readme": "NativeScript Application" +} diff --git a/e2e/ivy-sample/src/app.css b/e2e/ivy-sample/src/app.css new file mode 100644 index 000000000..13490394d --- /dev/null +++ b/e2e/ivy-sample/src/app.css @@ -0,0 +1,25 @@ +/* +In NativeScript, the app.css file is where you place CSS rules that +you would like to apply to your entire application. Check out +http://docs.nativescript.org/ui/styling for a full list of the CSS +selectors and properties you can use to style UI components. + +/* +In many cases you may want to use the NativeScript core theme instead +of writing your own CSS rules. You can learn more about the +NativeScript core theme at https://github.com/nativescript/theme +The imported CSS rules must precede all other types of rules. +*/ +@import "~@nativescript/theme/css/core.css"; +@import "~@nativescript/theme/css/default.css"; + +/* Place any CSS rules you want to apply on both iOS and Android here. +This is where the vast majority of your CSS code goes. */ + +/* +The following CSS rule changes the font size of all Buttons that have the +"-primary" class modifier. +*/ +Button.-primary { + font-size: 18; +} diff --git a/e2e/ivy-sample/src/app/app-routing.module.ts b/e2e/ivy-sample/src/app/app-routing.module.ts new file mode 100644 index 000000000..be834e281 --- /dev/null +++ b/e2e/ivy-sample/src/app/app-routing.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from "@angular/core"; +import { NativeScriptRouterModule } from "@nativescript/angular"; +import { Routes } from "@angular/router"; + +import { ItemsComponent } from "./item/items.component"; +import { ItemDetailComponent } from "./item/item-detail.component"; + +const routes: Routes = [ + { path: "", redirectTo: "/items", pathMatch: "full" }, + { path: "items", component: ItemsComponent }, + { path: "item/:id", component: ItemDetailComponent } +]; + +@NgModule({ + imports: [NativeScriptRouterModule.forRoot(routes)], + exports: [NativeScriptRouterModule] +}) +export class AppRoutingModule { } diff --git a/e2e/ivy-sample/src/app/app.component.html b/e2e/ivy-sample/src/app/app.component.html new file mode 100644 index 000000000..8a2c1a75e --- /dev/null +++ b/e2e/ivy-sample/src/app/app.component.html @@ -0,0 +1,2 @@ + + diff --git a/e2e/ivy-sample/src/app/app.component.ts b/e2e/ivy-sample/src/app/app.component.ts new file mode 100644 index 000000000..9ca790cd2 --- /dev/null +++ b/e2e/ivy-sample/src/app/app.component.ts @@ -0,0 +1,7 @@ +import { Component } from "@angular/core"; + +@Component({ + selector: "ns-app", + templateUrl: "./app.component.html" +}) +export class AppComponent { } diff --git a/e2e/ivy-sample/src/app/app.module.ts b/e2e/ivy-sample/src/app/app.module.ts new file mode 100644 index 000000000..aa843c863 --- /dev/null +++ b/e2e/ivy-sample/src/app/app.module.ts @@ -0,0 +1,36 @@ +import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core"; +import { NativeScriptModule } from "@nativescript/angular"; + +import { AppRoutingModule } from "./app-routing.module"; +import { AppComponent } from "./app.component"; +import { ItemsComponent } from "./item/items.component"; +import { ItemDetailComponent } from "./item/item-detail.component"; + +// Uncomment and add to NgModule imports if you need to use two-way binding +// import { NativeScriptFormsModule } from "nativescript-angular/forms"; + +// Uncomment and add to NgModule imports if you need to use the HttpClient wrapper +// import { NativeScriptHttpClientModule } from "nativescript-angular/http-client"; + +@NgModule({ + bootstrap: [ + AppComponent + ], + imports: [ + NativeScriptModule, + AppRoutingModule + ], + declarations: [ + AppComponent, + ItemsComponent, + ItemDetailComponent + ], + providers: [], + schemas: [ + NO_ERRORS_SCHEMA + ] +}) +/* +Pass your application module to the bootstrapModule function located in main.ts to start your app +*/ +export class AppModule { } diff --git a/e2e/ivy-sample/src/app/item/item-detail.component.html b/e2e/ivy-sample/src/app/item/item-detail.component.html new file mode 100644 index 000000000..51acb7e4c --- /dev/null +++ b/e2e/ivy-sample/src/app/item/item-detail.component.html @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/e2e/ivy-sample/src/app/item/item-detail.component.ts b/e2e/ivy-sample/src/app/item/item-detail.component.ts new file mode 100644 index 000000000..6d095d93a --- /dev/null +++ b/e2e/ivy-sample/src/app/item/item-detail.component.ts @@ -0,0 +1,23 @@ +import { Component, OnInit } from "@angular/core"; +import { ActivatedRoute } from "@angular/router"; + +import { Item } from "./item"; +import { ItemService } from "./item.service"; + +@Component({ + selector: "ns-details", + templateUrl: "./item-detail.component.html" +}) +export class ItemDetailComponent implements OnInit { + item: Item; + + constructor( + private itemService: ItemService, + private route: ActivatedRoute + ) { } + + ngOnInit(): void { + const id = +this.route.snapshot.params.id; + this.item = this.itemService.getItem(id); + } +} diff --git a/e2e/ivy-sample/src/app/item/item.service.ts b/e2e/ivy-sample/src/app/item/item.service.ts new file mode 100644 index 000000000..74d914020 --- /dev/null +++ b/e2e/ivy-sample/src/app/item/item.service.ts @@ -0,0 +1,41 @@ +import { Injectable } from "@angular/core"; + +import { Item } from "./item"; + +@Injectable({ + providedIn: "root" +}) +export class ItemService { + private items = new Array( + { id: 1, name: "Ter Stegen", role: "Goalkeeper" }, + { id: 3, name: "Piqué", role: "Defender" }, + { id: 4, name: "I. Rakitic", role: "Midfielder" }, + { id: 5, name: "Sergio", role: "Midfielder" }, + { id: 6, name: "Denis Suárez", role: "Midfielder" }, + { id: 7, name: "Arda", role: "Midfielder" }, + { id: 8, name: "A. Iniesta", role: "Midfielder" }, + { id: 9, name: "Suárez", role: "Forward" }, + { id: 10, name: "Messi", role: "Forward" }, + { id: 11, name: "Neymar", role: "Forward" }, + { id: 12, name: "Rafinha", role: "Midfielder" }, + { id: 13, name: "Cillessen", role: "Goalkeeper" }, + { id: 14, name: "Mascherano", role: "Defender" }, + { id: 17, name: "Paco Alcácer", role: "Forward" }, + { id: 18, name: "Jordi Alba", role: "Defender" }, + { id: 19, name: "Digne", role: "Defender" }, + { id: 20, name: "Sergi Roberto", role: "Midfielder" }, + { id: 21, name: "André Gomes", role: "Midfielder" }, + { id: 22, name: "Aleix Vidal", role: "Midfielder" }, + { id: 23, name: "Umtiti", role: "Defender" }, + { id: 24, name: "Mathieu", role: "Defender" }, + { id: 25, name: "Masip", role: "Goalkeeper" } + ); + + getItems(): Array { + return this.items; + } + + getItem(id: number): Item { + return this.items.filter((item) => item.id === id)[0]; + } +} diff --git a/e2e/ivy-sample/src/app/item/item.ts b/e2e/ivy-sample/src/app/item/item.ts new file mode 100644 index 000000000..950fba446 --- /dev/null +++ b/e2e/ivy-sample/src/app/item/item.ts @@ -0,0 +1,5 @@ +export interface Item { + id: number; + name: string; + role: string; +} diff --git a/e2e/ivy-sample/src/app/item/items.component.html b/e2e/ivy-sample/src/app/item/items.component.html new file mode 100644 index 000000000..270fa3638 --- /dev/null +++ b/e2e/ivy-sample/src/app/item/items.component.html @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + diff --git a/e2e/ivy-sample/src/app/item/items.component.ts b/e2e/ivy-sample/src/app/item/items.component.ts new file mode 100644 index 000000000..699c5d95f --- /dev/null +++ b/e2e/ivy-sample/src/app/item/items.component.ts @@ -0,0 +1,18 @@ +import { Component, OnInit } from "@angular/core"; + +import { Item } from "./item"; +import { ItemService } from "./item.service"; + +@Component({ + selector: "ns-items", + templateUrl: "./items.component.html" +}) +export class ItemsComponent implements OnInit { + items: Array; + + constructor(private itemService: ItemService) { } + + ngOnInit(): void { + this.items = this.itemService.getItems(); + } +} diff --git a/e2e/ivy-sample/src/main.ts b/e2e/ivy-sample/src/main.ts new file mode 100644 index 000000000..dffc19eec --- /dev/null +++ b/e2e/ivy-sample/src/main.ts @@ -0,0 +1,13 @@ +// this import should be first in order to load some required settings (like globals and reflect-metadata) +import { platformNativeScriptDynamic } from '@nativescript/angular/platform'; + +import { AppModule } from "./app/app.module"; + +// A traditional NativeScript application starts by initializing global objects, +// setting up global CSS rules, creating, and navigating to the main page. +// Angular applications need to take care of their own initialization: +// modules, components, directives, routes, DI providers. +// A NativeScript Angular app needs to make both paradigms work together, +// so we provide a wrapper platform object, platformNativeScriptDynamic, +// that sets up a NativeScript application and can bootstrap the Angular framework. +platformNativeScriptDynamic().bootstrapModule(AppModule); diff --git a/e2e/ivy-sample/src/package.json b/e2e/ivy-sample/src/package.json new file mode 100644 index 000000000..baca5e01e --- /dev/null +++ b/e2e/ivy-sample/src/package.json @@ -0,0 +1,7 @@ +{ + "main": "main.js", + "android": { + "v8Flags": "--expose_gc", + "markingMode": "none" + } +} diff --git a/e2e/ivy-sample/tsconfig.json b/e2e/ivy-sample/tsconfig.json new file mode 100644 index 000000000..c50965746 --- /dev/null +++ b/e2e/ivy-sample/tsconfig.json @@ -0,0 +1,32 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es2015", + "experimentalDecorators": true, + "emitDecoratorMetadata": true, + "noEmitHelpers": true, + "noEmitOnError": true, + "skipLibCheck": true, + "lib": [ + "es2017", + "dom", + "es6" + ], + "baseUrl": ".", + "paths": { + "~/*": [ + "src/*" + ], + "*": [ + "./node_modules/*" + ] + } + }, + "exclude": [ + "node_modules", + "platforms" + ], + "angularCompilerOptions": { + "enableIvy": false + } +} \ No newline at end of file diff --git a/e2e/ivy-sample/tsfmt.json b/e2e/ivy-sample/tsfmt.json new file mode 100644 index 000000000..f9e47f797 --- /dev/null +++ b/e2e/ivy-sample/tsfmt.json @@ -0,0 +1,4 @@ +{ + "indentSize": 4, + "tabSize": 4 +} diff --git a/e2e/ivy-sample/webpack.config.js b/e2e/ivy-sample/webpack.config.js new file mode 100644 index 000000000..532fb64c4 --- /dev/null +++ b/e2e/ivy-sample/webpack.config.js @@ -0,0 +1,354 @@ +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 { getNoEmitOnErrorFromTSConfig, getCompilerOptionsFromTSConfig } = require("nativescript-dev-webpack/utils/tsconfig-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 { + // The 'appPath' and 'appResourcesPath' values are fetched from + // the nsconfig.json configuration file. + appPath = "src", + appResourcesPath = "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 + snapshotInDocker, // --env.snapshotInDocker + skipSnapshotTools, // --env.skipSnapshotTools + compileSnapshot // --env.compileSnapshot + } = env; + + const useLibs = compileSnapshot; + const isAnySourceMapEnabled = !!sourceMap || !!hiddenSourceMap; + const externals = nsWebpack.getConvertedExternals(env.externals); + const appFullPath = resolve(projectRoot, appPath); + const tsConfigName = "tsconfig.tns.json"; + const tsConfigPath = join(__dirname, tsConfigName); + const hasRootLevelScopedModules = nsWebpack.hasRootLevelScopedModules({ projectDir: projectRoot }); + const hasRootLevelScopedAngular = nsWebpack.hasRootLevelScopedAngular({ projectDir: projectRoot }); + let coreModulesPackageName = "tns-core-modules"; + const alias = { + '~': appFullPath + }; + + const compilerOptions = getCompilerOptionsFromTSConfig(tsConfigPath); + if (hasRootLevelScopedModules) { + coreModulesPackageName = "@nativescript/core"; + alias["tns-core-modules"] = coreModulesPackageName; + nsWebpack.processTsPathsForScopedModules({ compilerOptions }); + } + + if (hasRootLevelScopedAngular) { + alias["nativescript-angular"] = "@nativescript/angular"; + nsWebpack.processTsPathsForScopedAngular({ compilerOptions }); + } + + const appResourcesFullPath = resolve(projectRoot, appResourcesPath); + const entryModule = `${nsWebpack.getEntryModule(appFullPath, platform)}.ts`; + const entryPath = `.${sep}${entryModule}`; + const entries = { bundle: entryPath }; + const areCoreModulesExternal = Array.isArray(env.externals) && env.externals.some(e => e.indexOf("tns-core-modules") > -1); + if (platform === "ios" && !areCoreModulesExternal) { + entries["tns_modules/tns-core-modules/inspector_modules"] = "inspector_modules"; + }; + + 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, + skipCodeGeneration: !aot, + sourceMap: !!isAnySourceMapEnabled, + additionalLazyModuleResources: additionalLazyModuleResources, + compilerOptions: { paths: compilerOptions.paths } + }); + + 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 noEmitOnErrorFromTSConfig = getNoEmitOnErrorFromTSConfig(join(projectRoot, tsConfigName)); + + nsWebpack.processAppComponents(appComponents, platform); + 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/${coreModulesPackageName}`), + resolve(__dirname, "node_modules"), + `node_modules/${coreModulesPackageName}`, + "node_modules", + ], + alias, + 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", + noEmitOnErrors: noEmitOnErrorFromTSConfig, + 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: [ + { + include: join(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, + ignoredFiles: nsWebpack.getUserDefinedEntries(entries, platform) + } + }, + ].filter(loader => !!loader) + }, + + { test: /\.html$|\.xml$/, use: "raw-loader" }, + + { + test: /[\/|\\]app\.css$/, + use: [ + "nativescript-dev-webpack/style-hot-loader", + { + loader: "nativescript-dev-webpack/css2json-loader", + options: { useForImports: true } + } + ] + }, + { + test: /[\/|\\]app\.scss$/, + use: [ + "nativescript-dev-webpack/style-hot-loader", + { + loader: "nativescript-dev-webpack/css2json-loader", + options: { useForImports: true } + }, + "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": "global.process", + }), + // 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, + snapshotInDocker, + skipSnapshotTools, + useLibs + })); + } + + if (hmr) { + config.plugins.push(new webpack.HotModuleReplacementPlugin()); + } + + return config; +}; diff --git a/e2e/modal-navigation-ng/package.json b/e2e/modal-navigation-ng/package.json index 5bd81ea31..29e663742 100644 --- a/e2e/modal-navigation-ng/package.json +++ b/e2e/modal-navigation-ng/package.json @@ -13,24 +13,25 @@ } }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", @@ -44,10 +45,12 @@ "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", "tns-platform-declarations": "next", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", - "e2e-watch": "tsc -p e2e --watch" + "e2e-watch": "tsc -p e2e --watch", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/modal-navigation-ng/tsconfig.esm.json b/e2e/modal-navigation-ng/tsconfig.esm.json index 95f2ecee0..a96f6bbc6 100644 --- a/e2e/modal-navigation-ng/tsconfig.esm.json +++ b/e2e/modal-navigation-ng/tsconfig.esm.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "moduleResolution": "node" } } diff --git a/e2e/modal-navigation-ng/tsconfig.json b/e2e/modal-navigation-ng/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/modal-navigation-ng/tsconfig.json +++ b/e2e/modal-navigation-ng/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/nested-router-tab-view/package.json b/e2e/nested-router-tab-view/package.json index 6e78669c1..f409c2362 100644 --- a/e2e/nested-router-tab-view/package.json +++ b/e2e/nested-router-tab-view/package.json @@ -7,24 +7,25 @@ "id": "org.nativescript.nestedroutertabview" }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", @@ -37,10 +38,12 @@ "mochawesome": "~3.1.2", "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", - "compile-tests": "tsc -p e2e --watch" + "compile-tests": "tsc -p e2e --watch", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/nested-router-tab-view/tsconfig.json b/e2e/nested-router-tab-view/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/nested-router-tab-view/tsconfig.json +++ b/e2e/nested-router-tab-view/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/nested-router-tab-view/tsconfig.tns.json b/e2e/nested-router-tab-view/tsconfig.tns.json index 95f2ecee0..a96f6bbc6 100644 --- a/e2e/nested-router-tab-view/tsconfig.tns.json +++ b/e2e/nested-router-tab-view/tsconfig.tns.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "moduleResolution": "node" } } diff --git a/e2e/renderer/package.json b/e2e/renderer/package.json index 4b03e0682..1cd648f27 100644 --- a/e2e/renderer/package.json +++ b/e2e/renderer/package.json @@ -7,24 +7,25 @@ "id": "org.nativescript.renderer" }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", @@ -37,11 +38,13 @@ "mochawesome": "~3.1.2", "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", "compile-tests-w": "tsc -p e2e --watch", - "update-app-ng-deps": "update-app-ng-deps" + "update-app-ng-deps": "update-app-ng-deps", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/renderer/tsconfig.json b/e2e/renderer/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/renderer/tsconfig.json +++ b/e2e/renderer/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/routable-animations/package.json b/e2e/routable-animations/package.json index 381f54d74..a66a9f813 100644 --- a/e2e/routable-animations/package.json +++ b/e2e/routable-animations/package.json @@ -7,24 +7,25 @@ "id": "org.nativescript.nsroanimations" }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.2", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@ngtools/webpack": "~8.2.0", - "@angular/compiler-cli": "~8.2.0", + "@ngtools/webpack": "~9.1.0", + "@angular/compiler-cli": "~9.1.0", "@types/chai": "~4.1.3", "@types/mocha": "~5.2.1", "@types/node": "^7.0.5", @@ -39,7 +40,7 @@ "nativescript-css-loader": "~0.26.0", "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "ns-bundle": "ns-bundle", @@ -47,6 +48,8 @@ "e2e-watch": "tsc -p e2e --watch", "update-app-ng-deps": "update-app-ng-deps", "ns-verify-bundle": "ns-verify-bundle", - "update-ns-webpack": "update-ns-webpack" + "update-ns-webpack": "update-ns-webpack", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/routable-animations/tsconfig.esm.json b/e2e/routable-animations/tsconfig.esm.json index 95f2ecee0..a96f6bbc6 100644 --- a/e2e/routable-animations/tsconfig.esm.json +++ b/e2e/routable-animations/tsconfig.esm.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "moduleResolution": "node" } } diff --git a/e2e/routable-animations/tsconfig.json b/e2e/routable-animations/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/routable-animations/tsconfig.json +++ b/e2e/routable-animations/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/router-tab-view/package.json b/e2e/router-tab-view/package.json index fc1120b74..4b71fdeb0 100644 --- a/e2e/router-tab-view/package.json +++ b/e2e/router-tab-view/package.json @@ -7,20 +7,21 @@ "id": "org.nativescript.routertabview" }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "next", + "@angular/common": "next", + "@angular/compiler": "next", + "@angular/core": "next", + "@angular/forms": "next", + "@angular/platform-browser": "next", + "@angular/platform-browser-dynamic": "next", + "@angular/router": "next", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { "@types/chai": "~4.1.7", @@ -34,12 +35,14 @@ "mochawesome": "~3.1.2", "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", - "typescript": "~3.5.3", - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0" + "typescript": "~3.6.4", + "@angular/compiler-cli": "next", + "@ngtools/webpack": "next" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", - "compile-tests": "tsc -p e2e --watch" + "compile-tests": "tsc -p e2e --watch", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/router-tab-view/tsconfig.json b/e2e/router-tab-view/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/router-tab-view/tsconfig.json +++ b/e2e/router-tab-view/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/router/package.json b/e2e/router/package.json index e4e5126aa..206f21d0a 100644 --- a/e2e/router/package.json +++ b/e2e/router/package.json @@ -7,24 +7,25 @@ "id": "org.nativescript.router" }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-intl": "^3.0.0", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "^10.12.12", @@ -39,11 +40,13 @@ "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", "tslib": "^1.7.1", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", "compile-tests-w": "tsc -p e2e --watch", - "update-app-ng-deps": "update-app-ng-deps" + "update-app-ng-deps": "update-app-ng-deps", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/router/tsconfig.esm.json b/e2e/router/tsconfig.esm.json index 95f2ecee0..a96f6bbc6 100644 --- a/e2e/router/tsconfig.esm.json +++ b/e2e/router/tsconfig.esm.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "moduleResolution": "node" } } diff --git a/e2e/router/tsconfig.json b/e2e/router/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/router/tsconfig.json +++ b/e2e/router/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/router/tsconfig.tns.json b/e2e/router/tsconfig.tns.json index 95f2ecee0..a96f6bbc6 100644 --- a/e2e/router/tsconfig.tns.json +++ b/e2e/router/tsconfig.tns.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "moduleResolution": "node" } } diff --git a/e2e/single-page/package.json b/e2e/single-page/package.json index a1de11d9a..4c72782d3 100644 --- a/e2e/single-page/package.json +++ b/e2e/single-page/package.json @@ -7,24 +7,25 @@ "id": "org.nativescript.singlepage" }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-intl": "^3.0.0", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "@types/chai": "~4.1.7", "@types/mocha": "~5.2.5", "@types/node": "~10.12.18", @@ -39,11 +40,13 @@ "nativescript-dev-appium": "^6.0.0", "nativescript-dev-webpack": "next", "tslib": "^1.7.1", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../config/mocha.opts --recursive e2e --appiumCapsLocation ../config/appium.capabilities.json", "compile-tests-w": "tsc -p e2e --watch", - "update-app-ng-deps": "update-app-ng-deps" + "update-app-ng-deps": "update-app-ng-deps", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/single-page/tsconfig.json b/e2e/single-page/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/single-page/tsconfig.json +++ b/e2e/single-page/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/tests-app-ng/package.json b/e2e/tests-app-ng/package.json index 97e4fcf8b..0a8af8b23 100644 --- a/e2e/tests-app-ng/package.json +++ b/e2e/tests-app-ng/package.json @@ -13,25 +13,26 @@ } }, "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-intl": "~3.0.0", "nativescript-theme-core": "^1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "^6.4.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "~8.2.0", - "@ngtools/webpack": "~8.2.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "babel-traverse": "6.24.1", "babel-types": "6.24.1", "babylon": "6.17.0", @@ -40,9 +41,11 @@ "lazy": "1.0.11", "nativescript-dev-webpack": "next", "tslint": "^5.4.3", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { - "tslint": "tslint --config tslint.json 'app/**/*.ts'" + "tslint": "tslint --config tslint.json 'app/**/*.ts'", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/e2e/tests-app-ng/tsconfig.json b/e2e/tests-app-ng/tsconfig.json index eee1eca47..646f454b1 100644 --- a/e2e/tests-app-ng/tsconfig.json +++ b/e2e/tests-app-ng/tsconfig.json @@ -37,5 +37,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file diff --git a/e2e/tests-app-ng/tsconfig.tns.json b/e2e/tests-app-ng/tsconfig.tns.json index 95f2ecee0..a96f6bbc6 100644 --- a/e2e/tests-app-ng/tsconfig.tns.json +++ b/e2e/tests-app-ng/tsconfig.tns.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig", "compilerOptions": { - "module": "es2015", + "module": "ESNext", "moduleResolution": "node" } } diff --git a/nativescript-angular-package/package.json b/nativescript-angular-package/package.json index 9c0ce6a1d..0858b9113 100644 --- a/nativescript-angular-package/package.json +++ b/nativescript-angular-package/package.json @@ -1,6 +1,6 @@ { "name": "nativescript-angular", - "version": "8.21.0", + "version": "9.0.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", @@ -23,21 +23,22 @@ "url": "https://github.com/NativeScript/nativescript-angular.git" }, "dependencies": { - "@nativescript/angular": "file:../nativescript-angular" + "@nativescript/angular": "../dist/nativescript-angular-scoped.tgz" }, "devDependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/compiler-cli": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", - "rxjs": "^6.4.0", - "tns-core-modules": "next", - "typescript": "~3.5.3" + "@angular/animations": "~9.0.1", + "@angular/common": "~9.0.1", + "@angular/compiler": "~9.0.1", + "@angular/compiler-cli": "~9.0.1", + "@angular/core": "~9.0.1", + "@angular/forms": "~9.0.1", + "@angular/platform-browser": "~9.0.1", + "@angular/platform-browser-dynamic": "~9.0.1", + "@angular/router": "~9.0.1", + "rxjs": "^6.5.0", + "tns-core-modules": "~6.3.0", + "typescript": "~3.6.4", + "zone.js": "~0.10.2" }, "scripts": { "ngc": "ngc -p tsconfig.json", diff --git a/nativescript-angular/animations/animations.module.ts b/nativescript-angular/animations/animations.module.ts index 8e000fb04..485cefc5a 100644 --- a/nativescript-angular/animations/animations.module.ts +++ b/nativescript-angular/animations/animations.module.ts @@ -3,7 +3,6 @@ import { Injectable, Inject, NgZone, - Provider, RendererFactory2, Optional, SkipSelf, @@ -48,21 +47,19 @@ export function instantiateDefaultStyleNormalizer() { return new WebAnimationsStyleNormalizer(); } -export const NATIVESCRIPT_ANIMATIONS_PROVIDERS: Provider[] = [ - {provide: AnimationDriver, useFactory: instantiateSupportedAnimationDriver}, - {provide: AnimationBuilder, useClass: BrowserAnimationBuilder}, - {provide: AnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer}, - {provide: AnimationEngine, useClass: InjectableAnimationEngine}, - { - provide: RendererFactory2, - useFactory: instantiateRendererFactory, - deps: [NativeScriptRendererFactory, AnimationEngine, NgZone] - } -]; - @NgModule({ imports: [NativeScriptModule], - providers: NATIVESCRIPT_ANIMATIONS_PROVIDERS, + providers: [ + {provide: AnimationDriver, useFactory: instantiateSupportedAnimationDriver}, + {provide: AnimationBuilder, useClass: BrowserAnimationBuilder}, + {provide: AnimationStyleNormalizer, useFactory: instantiateDefaultStyleNormalizer}, + {provide: AnimationEngine, useClass: InjectableAnimationEngine}, + { + provide: RendererFactory2, + useFactory: instantiateRendererFactory, + deps: [NativeScriptRendererFactory, AnimationEngine, NgZone] + } + ] }) export class NativeScriptAnimationsModule { constructor(@Optional() @SkipSelf() parentModule: NativeScriptAnimationsModule) { diff --git a/nativescript-angular/app-host-view.ts b/nativescript-angular/app-host-view.ts index 60c0fca72..f5cf9d7b8 100644 --- a/nativescript-angular/app-host-view.ts +++ b/nativescript-angular/app-host-view.ts @@ -21,6 +21,11 @@ export class AppHostView extends ContentView { } set content(value: View) { + // TODO: WIP, determine how to handle this + if (this._content) { + return; + } + if (this._content) { this._content.parentNode = undefined; } diff --git a/nativescript-angular/bin/disable-app-ng-ivy b/nativescript-angular/bin/disable-app-ng-ivy new file mode 100755 index 000000000..247b096af --- /dev/null +++ b/nativescript-angular/bin/disable-app-ng-ivy @@ -0,0 +1,36 @@ +#!/usr/bin/env node +// First param (optional, default value 'true'): 'false' (enable Ivy) or 'true' (default value, will disable Ivy) + +const path = require("path"); +const fs = require("fs"); + +const shouldEnable = process.argv[2] === "false"; +const binPath = __dirname; +const pluginPath = path.dirname(binPath); +const enableIvyKey = "enableIvy"; + +function disableIvyInAngularCompilerOptions(angularCompilerOptions) { + if (angularCompilerOptions[enableIvyKey] != null) { + angularCompilerOptions[enableIvyKey] = shouldEnable; + logUpdatedDependency(enableIvyKey, shouldEnable); + } + + function logUpdatedDependency(dependencyName, version) { + console.log(`Updated ${dependencyName} to : ${version}.`); + } +} + +const projectPath = process.env.INIT_CWD || path.dirname(path.dirname(path.dirname(pluginPath))); +const appTsConfigPath = path.join(projectPath, "tsconfig.json"); +const appTsConfigJson = JSON.parse(fs.readFileSync(appTsConfigPath, "utf8")); + +let { angularCompilerOptions } = appTsConfigJson; +if (!angularCompilerOptions) { + appTsConfigJson["angularCompilerOptions"] = { "enableIvy": shouldEnable }; +} else { + disableIvyInAngularCompilerOptions(angularCompilerOptions); +} + +fs.writeFileSync(appTsConfigPath, JSON.stringify(appTsConfigJson, null, 4)); + +console.log("\nIvy has been disable. Don't forget to run `rm -rf node_modules && npm i`."); diff --git a/nativescript-angular/bin/disable-app-ng-ivy.cmd b/nativescript-angular/bin/disable-app-ng-ivy.cmd new file mode 100644 index 000000000..aea7a25c2 --- /dev/null +++ b/nativescript-angular/bin/disable-app-ng-ivy.cmd @@ -0,0 +1 @@ +@node %~dp0\disable-app-ng-ivy %* diff --git a/nativescript-angular/common.ts b/nativescript-angular/common.ts index f148d787e..a94c08641 100644 --- a/nativescript-angular/common.ts +++ b/nativescript-angular/common.ts @@ -5,7 +5,6 @@ import { } from "@angular/core"; import { - ModalDialogHost, ModalDialogService, } from "./directives/dialogs"; import { @@ -13,12 +12,30 @@ import { defaultFrameProvider, defaultPageProvider, } from "./platform-providers"; -import { NS_DIRECTIVES } from "./directives"; +// import { NS_DIRECTIVES } from "./directives"; +import { ListViewComponent } from "./directives/list-view-comp"; +import { TemplateKeyDirective } from "./directives/templated-items-comp"; +import { TabViewDirective, TabViewItemDirective } from "./directives/tab-view"; +import { + ActionBarComponent, + ActionBarScope, + ActionItemDirective, + NavigationButtonDirective +} from "./directives/action-bar"; +import { AndroidFilterComponent, IosFilterComponent } from "./directives/platform-filters"; @NgModule({ declarations: [ - ModalDialogHost, - ...NS_DIRECTIVES, + ListViewComponent, + TemplateKeyDirective, + TabViewDirective, + TabViewItemDirective, + ActionBarComponent, + ActionBarScope, + ActionItemDirective, + NavigationButtonDirective, + AndroidFilterComponent, + IosFilterComponent ], providers: [ ModalDialogService, @@ -30,9 +47,17 @@ import { NS_DIRECTIVES } from "./directives"; CommonModule, ], exports: [ - CommonModule, - ModalDialogHost, - ...NS_DIRECTIVES, + CommonModule, + ListViewComponent, + TemplateKeyDirective, + TabViewDirective, + TabViewItemDirective, + ActionBarComponent, + ActionBarScope, + ActionItemDirective, + NavigationButtonDirective, + AndroidFilterComponent, + IosFilterComponent, ], schemas: [NO_ERRORS_SCHEMA] }) diff --git a/nativescript-angular/directives/dialogs.ts b/nativescript-angular/directives/dialogs.ts index 14463c533..01afeed61 100644 --- a/nativescript-angular/directives/dialogs.ts +++ b/nativescript-angular/directives/dialogs.ts @@ -1,7 +1,6 @@ import { ComponentFactoryResolver, ComponentRef, - Directive, Injectable, Injector, NgModuleRef, @@ -132,7 +131,7 @@ export class ModalDialogService { parent: options.containerRef.injector }); const detachedFactory = options.resolver.resolveComponentFactory(DetachedLoader); - detachedLoaderRef = options.containerRef.createComponent(detachedFactory, -1, childInjector, null); + detachedLoaderRef = options.containerRef.createComponent(detachedFactory, 0, childInjector, null); detachedLoaderRef.instance.loadComponent(options.type).then((compRef) => { const detachedProxy = compRef.location.nativeElement; @@ -150,15 +149,3 @@ export class ModalDialogService { }); } } - -@Directive({ - selector: "[modal-dialog-host]" // tslint:disable-line:directive-selector -}) -export class ModalDialogHost { // tslint:disable-line:directive-class-suffix - constructor() { - throw new Error("ModalDialogHost is deprecated. " + - "Call ModalDialogService.showModal() " + - "by passing ViewContainerRef in the options instead." - ); - } -} diff --git a/nativescript-angular/directives/index.ts b/nativescript-angular/directives/index.ts index 4fd2966f5..4b34a877e 100644 --- a/nativescript-angular/directives/index.ts +++ b/nativescript-angular/directives/index.ts @@ -1,5 +1,5 @@ import { ListViewComponent } from "./list-view-comp"; -import { TemplateKeyDirective, SetupItemViewArgs, TemplatedItemsComponent } from "./templated-items-comp"; +import { TemplateKeyDirective, TemplatedItemsComponent } from "./templated-items-comp"; import { TabViewDirective, TabViewItemDirective } from "./tab-view"; import { ActionBarComponent, @@ -8,7 +8,7 @@ import { NavigationButtonDirective } from "./action-bar"; import { AndroidFilterComponent, IosFilterComponent } from "./platform-filters"; -import { ModalDialogHost, ModalDialogOptions, ModalDialogParams, ModalDialogService } from "./dialogs"; +import { ModalDialogOptions, ModalDialogParams, ModalDialogService } from "./dialogs"; export const NS_DIRECTIVES = [ ListViewComponent, @@ -26,7 +26,6 @@ export const NS_DIRECTIVES = [ export { ListViewComponent, TemplateKeyDirective, - SetupItemViewArgs, TemplatedItemsComponent, TabViewDirective, TabViewItemDirective, @@ -36,7 +35,6 @@ export { NavigationButtonDirective, AndroidFilterComponent, IosFilterComponent, - ModalDialogHost, ModalDialogOptions, ModalDialogParams, ModalDialogService diff --git a/nativescript-angular/dom-adapter.ts b/nativescript-angular/dom-adapter.ts index 9d47b2fe7..582da2ffc 100644 --- a/nativescript-angular/dom-adapter.ts +++ b/nativescript-angular/dom-adapter.ts @@ -1,6 +1,6 @@ /* tslint:disable */ import { Type } from "@angular/core"; -import { ɵDomAdapter, ɵsetRootDomAdapter } from "@angular/platform-browser"; +import { ɵDomAdapter, ɵsetRootDomAdapter } from "@angular/common"; import { rendererLog, isLogEnabled } from "./trace"; export class NativeScriptDomAdapter implements ɵDomAdapter { diff --git a/nativescript-angular/forms/forms.module.ts b/nativescript-angular/forms/forms.module.ts index 50511eafc..0f3e3e6eb 100644 --- a/nativescript-angular/forms/forms.module.ts +++ b/nativescript-angular/forms/forms.module.ts @@ -9,15 +9,6 @@ import { SelectedIndexValueAccessor } from "./value-accessors"; -export const FORMS_DIRECTIVES = [ - TextValueAccessor, - CheckedValueAccessor, - DateValueAccessor, - TimeValueAccessor, - SelectedIndexValueAccessor, - NumberValueAccessor, -]; - export { TextValueAccessor, CheckedValueAccessor, @@ -28,7 +19,14 @@ export { }; @NgModule({ - declarations: FORMS_DIRECTIVES, + declarations: [ + TextValueAccessor, + CheckedValueAccessor, + DateValueAccessor, + TimeValueAccessor, + SelectedIndexValueAccessor, + NumberValueAccessor + ], providers: [ ], imports: [ @@ -36,7 +34,12 @@ export { ], exports: [ FormsModule, - FORMS_DIRECTIVES, + TextValueAccessor, + CheckedValueAccessor, + DateValueAccessor, + TimeValueAccessor, + SelectedIndexValueAccessor, + NumberValueAccessor ] }) export class NativeScriptFormsModule { diff --git a/nativescript-angular/forms/value-accessors/index.ts b/nativescript-angular/forms/value-accessors/index.ts index 351151606..36d656b1b 100644 --- a/nativescript-angular/forms/value-accessors/index.ts +++ b/nativescript-angular/forms/value-accessors/index.ts @@ -1,7 +1,10 @@ -export * from "./base-value-accessor"; -export * from "./text-value-accessor"; -export * from "./checked-value-accessor"; -export * from "./date-value-accessor"; -export * from "./time-value-accessor"; -export * from "./number-value-accessor"; -export * from "./selectedIndex-value-accessor"; +export { BaseValueAccessor } from "./base-value-accessor"; +export { TextValueAccessor, TextView } from "./text-value-accessor"; +export { CheckedValueAccessor } from "./checked-value-accessor"; +export { DateValueAccessor } from "./date-value-accessor"; +export { TimeValueAccessor } from "./time-value-accessor"; +export { NumberValueAccessor } from "./number-value-accessor"; +export { + SelectedIndexValueAccessor, + SelectableView +} from "./selectedIndex-value-accessor"; diff --git a/nativescript-angular/modal-dialog.ts b/nativescript-angular/modal-dialog.ts index 0aa0ee079..0ee522dcb 100644 --- a/nativescript-angular/modal-dialog.ts +++ b/nativescript-angular/modal-dialog.ts @@ -1,5 +1,4 @@ export { - ModalDialogHost, ModalDialogOptions, ModalDialogParams, ModalDialogService diff --git a/nativescript-angular/nativescript.module.ts b/nativescript-angular/nativescript.module.ts index a4a05d68a..d93a3250f 100644 --- a/nativescript-angular/nativescript.module.ts +++ b/nativescript-angular/nativescript.module.ts @@ -1,7 +1,6 @@ import "tns-core-modules/globals"; // Require application early to work around a circular import import "tns-core-modules/application"; -import "./zone-js/dist/zone-nativescript"; import "./polyfills/array"; import "./polyfills/console"; @@ -15,7 +14,7 @@ import { SystemJsNgModuleLoader, Optional, SkipSelf, - ɵAPP_ROOT as APP_ROOT, + ɵINJECTOR_SCOPE, } from "@angular/core"; import { @@ -44,7 +43,7 @@ export { DetachedLoader }; PageService, NativeScriptRendererFactory, SystemJsNgModuleLoader, - { provide: APP_ROOT, useValue: true }, + { provide: ɵINJECTOR_SCOPE, useValue: "root" }, { provide: ErrorHandler, useFactory: errorHandlerFactory }, { provide: RendererFactory2, useExisting: NativeScriptRendererFactory }, { provide: ViewportScroller, useClass: NullViewportScroller }, diff --git a/nativescript-angular/ngcc.config.js b/nativescript-angular/ngcc.config.js new file mode 100644 index 000000000..3aff471a5 --- /dev/null +++ b/nativescript-angular/ngcc.config.js @@ -0,0 +1,11 @@ +module.exports = { + "entryPoints": { + ".": { + "override": { + "main": "./index.js", + "typings": "./index.d.ts", + }, + "ignoreMissingDependencies": true, + }, + } +} \ No newline at end of file diff --git a/nativescript-angular/package.json b/nativescript-angular/package.json index 5d42c9747..53b3b4d5a 100644 --- a/nativescript-angular/package.json +++ b/nativescript-angular/package.json @@ -1,6 +1,6 @@ { "name": "@nativescript/angular", - "version": "8.21.0", + "version": "9.0.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", @@ -27,48 +27,50 @@ "tsc": "tsc -p tsconfig.json", "tsc-w": "tsc -p tsconfig.json -w", "ngc": "ngc -p tsconfig.json", - "prepare": "npm run ngc", + "ngcc": "ngcc", + "prepare": "npm run ngcc && npm run ngc", "pack": "npm i && tsc && cd ../build/pack-scripts && npm i && npx ts-node pack-scoped.ts", "version": "rm -rf package-lock.json && conventional-changelog -p angular -i ../CHANGELOG.md -s && git add ../CHANGELOG.md", "typedoc": "typedoc --tsconfig \"./tsconfig.typedoc.json\" --out ./bin/dist/ng-api-reference --includeDeclarations --name \"NativeScript Angular\" --theme ./node_modules/nativescript-typedoc-theme --excludeExternals --externalPattern \"**/+(tns-core-modules|module|declarations).d.ts\"" }, "bin": { - "update-app-ng-deps": "./bin/update-app-ng-deps" + "update-app-ng-deps": "./bin/update-app-ng-deps", + "disable-app-ng-ivy": "./bin/disable-app-ng-ivy" }, "dependencies": { - "nativescript-intl": "^3.0.0", - "reflect-metadata": "^0.1.8" + "nativescript-intl": "^3.0.0" }, "peerDependencies": { - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/router": "~8.2.0", + "@angular/platform-browser-dynamic": "~9.0.0", + "@angular/common": "~9.0.0", + "@angular/compiler": "~9.0.0", + "@angular/core": "~9.0.0", + "@angular/forms": "~9.0.0", + "@angular/platform-browser": "~9.0.0", + "@angular/router": "~9.0.0", "rxjs": "^6.4.0", "tns-core-modules": "^6.2.0 || >6.3.0-", - "typescript": "~3.5.3", - "zone.js": "^0.9.1" + "typescript": "~3.6.4", + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/compiler-cli": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", - "codelyzer": "^5.1.0", + "@angular/animations": "~9.0.1", + "@angular/common": "~9.0.1", + "@angular/compiler": "~9.0.1", + "@angular/compiler-cli": "~9.0.1", + "@angular/core": "~9.0.1", + "@angular/forms": "~9.0.1", + "@angular/platform-browser": "~9.0.1", + "@angular/platform-browser-dynamic": "~9.0.1", + "@angular/router": "~9.0.1", + "codelyzer": "^5.2.0", "conventional-changelog-cli": "^1.3.22", - "rxjs": "^6.4.0", - "tns-core-modules": "next", + "rxjs": "^6.5.0", + "tns-core-modules": "~6.3.0", "tslint": "^5.5.0", - "typescript": "~3.5.3", - "zone.js": "^0.9.1", + "typescript": "~3.6.4", + "zone.js": "~0.10.2", "nativescript-typedoc-theme": "git://github.com/NativeScript/nativescript-typedoc-theme.git#master", "typedoc": "^0.13.0" } diff --git a/nativescript-angular/platform.ts b/nativescript-angular/platform.ts index 8919d34fd..8dadb4836 100644 --- a/nativescript-angular/platform.ts +++ b/nativescript-angular/platform.ts @@ -1,8 +1,3 @@ -// Always import reflect-metadata before @angular/core. -// It's needed to handle __metadata calls inside @angular/core -import "reflect-metadata"; - -// Import platform-common immediately after reflect-metadata - because rest of the polyfills. import { NativeScriptPlatformRef, AppOptions, diff --git a/nativescript-angular/router/ns-router-link-active.ts b/nativescript-angular/router/ns-router-link-active.ts index de2e55395..86ff6b05d 100644 --- a/nativescript-angular/router/ns-router-link-active.ts +++ b/nativescript-angular/router/ns-router-link-active.ts @@ -1,7 +1,7 @@ import { AfterContentInit, ContentChildren, Directive, ElementRef, Input, OnChanges, OnDestroy, - QueryList, Renderer + QueryList, Renderer2 } from "@angular/core"; import { Subscription } from "rxjs"; @@ -66,7 +66,7 @@ export class NSRouterLinkActive implements OnChanges, OnDestroy, AfterContentIni @Input() nsRouterLinkActiveOptions: { exact: boolean } = { exact: false }; - constructor(private router: Router, private element: ElementRef, private renderer: Renderer) { + constructor(private router: Router, private element: ElementRef, private renderer: Renderer2) { this.subscription = router.events.subscribe(s => { if (s instanceof NavigationEnd) { this.update(); @@ -105,7 +105,7 @@ export class NSRouterLinkActive implements OnChanges, OnDestroy, AfterContentIni const currentUrlTree = this.router.parseUrl(this.router.url); const isActiveLinks = this.reduceList(currentUrlTree, this.links); this.classes.forEach( - c => this.renderer.setElementClass( + c => this.renderer.setStyle( this.element.nativeElement, c, isActiveLinks)); } Promise.resolve(hasActiveLinks).then(active => this.active = active); diff --git a/nativescript-angular/router/page-router-outlet.ts b/nativescript-angular/router/page-router-outlet.ts index 9cdd6634a..49c35b7fe 100644 --- a/nativescript-angular/router/page-router-outlet.ts +++ b/nativescript-angular/router/page-router-outlet.ts @@ -343,8 +343,8 @@ export class PageRouterOutlet implements OnDestroy { // tslint:disable-line:dire const destructables = new Set([PageService]); const injector = Injector.create({ providers: [ - { provide: PageService, useClass: PageService, deps: [Page] }, { provide: Page, useValue: page }, + { provide: PageService, useClass: PageService, deps: [Page] }, { provide: Frame, useValue: this.frame }, { provide: PageRoute, useValue: new PageRoute(activatedRoute) }, { provide: ActivatedRoute, useValue: activatedRoute }, diff --git a/nativescript-angular/router/router.module.ts b/nativescript-angular/router/router.module.ts index 1c8095c09..df719c48b 100644 --- a/nativescript-angular/router/router.module.ts +++ b/nativescript-angular/router/router.module.ts @@ -18,7 +18,7 @@ export { NSModuleFactoryLoader } from "./ns-module-factory-loader"; export { NSRouterLink, NSRouterLinkActive, PageRouterOutlet, NSEmptyOutletComponent, NSLocationStrategy }; -const ROUTER_DIRECTIVES = [NSRouterLink, NSRouterLinkActive, PageRouterOutlet, NSEmptyOutletComponent]; +// const ROUTER_DIRECTIVES = [NSRouterLink, NSRouterLinkActive, PageRouterOutlet, NSEmptyOutletComponent]; const NS_ROUTER_PROVIDERS = [ { @@ -35,10 +35,15 @@ const NS_ROUTER_PROVIDERS = [ ]; @NgModule({ - declarations: ROUTER_DIRECTIVES, + declarations: [ + NSRouterLink, NSRouterLinkActive, PageRouterOutlet, NSEmptyOutletComponent + ], entryComponents: [NSEmptyOutletComponent], imports: [RouterModule, NativeScriptCommonModule], - exports: [RouterModule, ...ROUTER_DIRECTIVES], + exports: [ + RouterModule, + NSRouterLink, NSRouterLinkActive, PageRouterOutlet, NSEmptyOutletComponent + ], schemas: [NO_ERRORS_SCHEMA], }) export class NativeScriptRouterModule { diff --git a/nativescript-angular/testing/src/util.ts b/nativescript-angular/testing/src/util.ts index a4f57b05d..545b066da 100644 --- a/nativescript-angular/testing/src/util.ts +++ b/nativescript-angular/testing/src/util.ts @@ -3,7 +3,7 @@ import { View } from "tns-core-modules/ui/core/view"; import { Frame } from "tns-core-modules/ui/frame"; import { LayoutBase } from "tns-core-modules/ui/layouts/layout-base"; import { ComponentFixture, TestBed } from "@angular/core/testing"; -import { NgModule, Type } from "@angular/core"; +import { Type } from "@angular/core"; import { NativeScriptModule } from "../../nativescript.module"; import { platformBrowserDynamicTesting } from "@angular/platform-browser-dynamic/testing"; import { NS_COMPILER_PROVIDERS } from "../../platform"; @@ -91,23 +91,26 @@ export function nsTestBedBeforeEach( entryComponents: any[] = []) { return (done) => { activeTestFixtures.push([]); + imports.unshift(NativeScriptModule); // If there are no entry components we can take the simple path. if (entryComponents.length === 0) { TestBed.configureTestingModule({ - declarations: [...components], - providers: [...providers], - imports: [NativeScriptModule, ...imports] + declarations: components, + providers: providers, + imports: imports }); } else { // If there are entry components, we have to reset the testing platform. // // There's got to be a better way... (o_O) TestBed.resetTestEnvironment(); - @NgModule({ - declarations: entryComponents, - exports: entryComponents, - entryComponents: entryComponents - }) + // TODO: this currently causes: + // NG1010: Expected array when reading + // @NgModule({ + // declarations: entryComponents, + // exports: entryComponents, + // entryComponents: entryComponents + // }) class EntryComponentsTestModule { } TestBed.initTestEnvironment( diff --git a/nativescript-angular/tsconfig.json b/nativescript-angular/tsconfig.json index 79e3addf9..6a2429de3 100644 --- a/nativescript-angular/tsconfig.json +++ b/nativescript-angular/tsconfig.json @@ -3,11 +3,12 @@ "target": "es5", "module": "commonjs", "moduleResolution": "node", - "sourceMap": true, + "sourceMap": false, "emitDecoratorMetadata": true, "experimentalDecorators": true, "noImplicitUseStrict": true, - "noEmitHelpers": true, + "noEmitHelpers": false, + "importHelpers": true, "declaration": true, "removeComments": false, "noEmitOnError": true, @@ -23,7 +24,8 @@ "genDir": ".", "skipMetadataEmit": false, "skipTemplateCodegen": true, - "strictMetadataEmit": true + "strictMetadataEmit": true, + "enableIvy": false }, "include": [ "**/*.ts" diff --git a/tests/package.json b/tests/package.json index 38882a76f..07cfd4e54 100644 --- a/tests/package.json +++ b/tests/package.json @@ -19,23 +19,24 @@ ], "homepage": "http://nativescript.org", "dependencies": { - "@angular/animations": "~8.2.0", - "@angular/common": "~8.2.0", - "@angular/compiler": "~8.2.0", - "@angular/core": "~8.2.0", - "@angular/forms": "~8.2.0", - "@angular/platform-browser": "~8.2.0", - "@angular/platform-browser-dynamic": "~8.2.0", - "@angular/router": "~8.2.0", - "nativescript-angular": "../nativescript-angular-package", + "@angular/animations": "~9.1.0", + "@angular/common": "~9.1.0", + "@angular/compiler": "~9.1.0", + "@angular/core": "~9.1.0", + "@angular/forms": "~9.1.0", + "@angular/platform-browser": "~9.1.0", + "@angular/platform-browser-dynamic": "~9.1.0", + "@angular/router": "~9.1.0", + "nativescript-angular": "file:../../nativescript-angular-package", "nativescript-unit-test-runner": "0.7.0", - "rxjs": "^6.4.0", + "rxjs": "^6.5.0", "tns-core-modules": "next", - "zone.js": "^0.9.1" + "tslib": "~1.10.0", + "zone.js": "~0.10.2" }, "devDependencies": { - "@angular/compiler-cli": "8.0.0", - "@ngtools/webpack": "8.0.0", + "@angular/compiler-cli": "~9.1.0", + "@ngtools/webpack": "~9.1.0", "@types/chai": "^4.1.4", "@types/karma-chai": "0.1.1", "@types/mocha": "5.2.7", @@ -53,15 +54,17 @@ "karma-webpack": "3.0.5", "lazy": "1.0.11", "mocha": "6.1.4", - "nativescript-dev-webpack": "next", + "nativescript-dev-webpack": "~1.4.0", "remove-strict-webpack-plugin": "~0.1.2", "sinon": "^7.3.2", "tslint": "^4.5.1", - "typescript": "~3.5.3" + "typescript": "~3.8.3" }, "scripts": { "e2e": "tsc -p e2e && mocha --opts ../e2e/config/mocha.opts --recursive e2e --appiumCapsLocation ../e2e/config/appium.capabilities.json", "compile-tests-w": "tsc -p e2e --watch", - "update-app-ng-deps": "update-app-ng-deps" + "update-app-ng-deps": "update-app-ng-deps", + "ngcc": "ngcc --properties es2015 module main --first-only", + "postinstall": "npm run ngcc" } } diff --git a/tests/tsconfig.json b/tests/tsconfig.json index 730d1b343..c9e4314c4 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -36,5 +36,8 @@ "platforms", "**/*.aot", "e2e" - ] + ], + "angularCompilerOptions": { + "enableIvy": false + } } \ No newline at end of file