From 63529c8710d5325fb5e123ab0bfb7a9eefa96a27 Mon Sep 17 00:00:00 2001 From: Stephen Peters Date: Thu, 10 Oct 2019 11:05:52 -0700 Subject: [PATCH 1/7] merge in basic slider --- .ado/publish.yml | 2 +- .ado/templates/e2e-test-job.yml | 51 +- .ado/templates/react-native-init.yml | 83 ++ .ado/windows-vs-pr.yml | 952 +++++++------- .../ReactNative.Net46.csproj | 4 +- .../ReactNative.Net46/packages.config | 2 +- current/docs/GettingStarted.md | 4 + current/local-cli/rnpm/windows/CHANGELOG.json | 42 + current/local-cli/rnpm/windows/CHANGELOG.md | 14 +- current/local-cli/rnpm/windows/index.js | 4 + current/local-cli/rnpm/windows/package.json | 2 +- current/local-cli/rnpm/wpf/CHANGELOG.json | 33 + current/local-cli/rnpm/wpf/CHANGELOG.md | 10 + current/local-cli/rnpm/wpf/package.json | 4 +- packages/E2ETest/package.json | 8 +- packages/E2ETest/windows/ReactUWPTestApp.sln | 27 + .../package.json | 8 +- packages/playground/Samples/animation.tsx | 75 ++ packages/playground/Samples/textinput.tsx | 5 + packages/playground/package.json | 8 +- packages/playground/windows/playground.sln | 15 + .../CHANGELOG.json | 84 ++ .../CHANGELOG.md | 26 +- .../package.json | 8 +- vnext/.gitignore | 1 + vnext/.npmignore | 2 +- vnext/CHANGELOG.json | 242 ++++ vnext/CHANGELOG.md | 84 +- vnext/Chakra/Chakra.vcxitems | 7 - vnext/Chakra/Chakra.vcxitems.filters | 18 - vnext/Chakra/ChakraJsiRuntime.h | 410 ------ vnext/Chakra/ChakraJsiRuntimeFactory.h | 19 - vnext/Chakra/ChakraTracing.cpp | 12 +- vnext/CopyHeaders.inc | 911 ------------- .../React.Windows.Desktop.DLL.vcxproj | 6 +- vnext/Desktop.DLL/packages.config | 2 +- vnext/Desktop.DLL/react-native-win32.x64.def | 2 + vnext/Desktop.DLL/react-native-win32.x86.def | 2 + ...timeHolder.cpp => ChakraRuntimeHolder.cpp} | 23 +- ...IRuntimeHolder.h => ChakraRuntimeHolder.h} | 12 +- .../DesktopTestRunner.cpp | 4 +- ...t.Windows.Desktop.IntegrationTests.vcxproj | 8 +- ...s.Desktop.IntegrationTests.vcxproj.filters | 4 +- .../Desktop.IntegrationTests/packages.config | 2 +- .../LayoutAnimationTests.cpp | 4 +- .../React.Windows.Desktop.UnitTests.vcxproj | 4 +- vnext/Desktop.UnitTests/packages.config | 2 +- vnext/Desktop/React.Windows.Desktop.vcxproj | 9 +- vnext/Desktop/msoFolly.h | 42 - vnext/Desktop/packages.config | 2 +- vnext/Folly/Folly.vcxproj | 16 +- .../React.Windows.IntegrationTests.vcxproj | 1 - .../ChakraCoreRuntimeUnitTests.cpp | 12 +- .../JSI.Desktop.UnitTests.vcxproj | 4 +- .../JsiRuntimeUnitTests.cpp | 4 +- vnext/JSI.Desktop.UnitTests/packages.config | 2 +- .../Desktop}/ChakraJsiRuntime_core.cpp | 441 ++++--- vnext/JSI/Desktop/JSI.Desktop.vcxproj | 88 ++ vnext/JSI/Desktop/JSI.Desktop.vcxproj.filters | 19 + vnext/JSI/Desktop/packages.config | 5 + vnext/JSI/Shared/ByteArrayBuffer.h | 39 + .../Shared/ChakraRuntime.cpp} | 1140 +++++++++-------- vnext/JSI/Shared/ChakraRuntime.h | 428 +++++++ .../Shared/ChakraRuntimeArgs.h} | 20 +- vnext/JSI/Shared/ChakraRuntimeFactory.h | 15 + vnext/JSI/Shared/JSI.Shared.vcxitems | 25 + vnext/JSI/Shared/JSI.Shared.vcxitems.filters | 30 + .../Universal}/ChakraJsiRuntime_edgemode.cpp | 136 +- vnext/JSI/Universal/JSI.Universal.vcxproj | 93 ++ .../Universal/JSI.Universal.vcxproj.filters | 16 + vnext/PropertySheets/React.Cpp.props | 4 +- .../ReactPackageDirectories.props | 4 +- vnext/README.md | 2 +- vnext/ReactUWP/Base/UwpReactInstance.cpp | 20 +- vnext/ReactUWP/Base/UwpReactInstance.h | 2 + .../dll/react-native-uwp.oss.x64.def | 1 + .../dll/react-native-uwp.oss.x86.def | 1 + .../EndPoints/dll/react-native-uwp.x64.def | 1 + .../EndPoints/dll/react-native-uwp.x86.def | 1 + .../EndPoints/dll/react-native-uwp.x86sdx.def | 1 + .../Modules/Animated/AnimationDriver.cpp | 9 +- .../Modules/Animated/DecayAnimationDriver.cpp | 9 +- .../Modules/Animated/FrameAnimationDriver.cpp | 10 +- .../Animated/NativeAnimatedNodeManager.cpp | 4 + .../Animated/NativeAnimatedNodeManager.h | 1 + .../Modules/Animated/PropsAnimatedNode.cpp | 26 +- .../Modules/Animated/PropsAnimatedNode.h | 2 + .../Animated/SpringAnimationDriver.cpp | 9 +- .../Modules/Animated/ValueAnimatedNode.cpp | 8 + vnext/ReactUWP/Modules/DeviceInfoModule.cpp | 39 +- vnext/ReactUWP/Modules/DeviceInfoModule.h | 14 +- vnext/ReactUWP/ReactUWP.vcxproj | 16 +- vnext/ReactUWP/ReactUWP.vcxproj.filters | 12 + vnext/ReactUWP/Utils/PropertyUtils.h | 77 +- vnext/ReactUWP/Views/SliderViewManager.cpp | 100 ++ vnext/ReactUWP/Views/SliderViewManager.h | 34 + vnext/ReactUWP/Views/TextInputViewManager.cpp | 35 +- vnext/ReactUWP/Views/WebViewManager.cpp | 4 + vnext/ReactUWP/packages.config | 4 +- vnext/ReactWindows-Desktop.sln | 14 + vnext/ReactWindows-Universal.sln | 18 + ...timeHolder.cpp => ChakraRuntimeHolder.cpp} | 29 +- ...IRuntimeHolder.h => ChakraRuntimeHolder.h} | 18 +- .../ReactWindowsCore/ReactWindowsCore.vcxproj | 20 +- .../ReactWindowsCore.vcxproj.filters | 12 +- vnext/ReactWindowsCore/packages.config | 4 +- vnext/ReactWindowsCore/tracing/fbsystrace.h | 2 +- vnext/Scripts/IntegrationTests.ps1 | 4 +- vnext/Scripts/ReactUwp.nuspec | 1 - vnext/Scripts/ReactWin32.nuspec | 1 - vnext/Scripts/Tfs/Layout-Headers.ps1 | 9 +- vnext/Scripts/UnitTest.ps1 | 8 +- vnext/Scripts/copyRNLibraries.js | 6 + vnext/Shared/OInstance.cpp | 8 +- .../Tests/CreateModulesTests.cpp | 6 +- vnext/docs/GettingStarted.md | 3 +- vnext/docs/ParityStatus.md | 24 +- vnext/just-task.js | 4 +- vnext/layoutFilesForNuget.bat | 2 +- vnext/local-cli/generate-windows.js | 2 +- vnext/local-cli/generator-windows/index.js | 31 +- .../assets/LockScreenLogo.scale-200.png | Bin .../assets/SplashScreen.scale-200.png | Bin .../assets/Square150x150Logo.scale-200.png | Bin .../assets/Square44x44Logo.scale-200.png | Bin ...x44Logo.targetsize-24_altform-unplated.png | Bin .../templates/{ => cpp}/assets/StoreLogo.png | Bin .../assets/Wide310x150Logo.scale-200.png | Bin .../templates/cpp/proj/MyApp.sln | 136 ++ .../templates/cpp/proj/MyApp.vcxproj | 171 +++ .../templates/cpp/proj/MyApp.vcxproj.filters | 62 + .../templates/cpp/src/App.cpp | 123 ++ .../generator-windows/templates/cpp/src/App.h | 18 + .../templates/cpp/src/App.idl | 3 + .../templates/{ => cpp}/src/App.xaml | 0 .../templates/cpp/src/MainPage.cpp | 46 + .../templates/cpp/src/MainPage.h | 25 + .../templates/cpp/src/MainPage.idl | 8 + .../templates/cpp/src/MainPage.xaml | 15 + .../templates/cpp/src/Package.appxmanifest | 32 + .../templates/cpp/src/PropertySheet.props | 16 + .../templates/cpp/src/packages.config | 4 + .../templates/cpp/src/pch.cpp | 1 + .../generator-windows/templates/cpp/src/pch.h | 16 + .../cs/assets/LockScreenLogo.scale-200.png | Bin 0 -> 1430 bytes .../cs/assets/SplashScreen.scale-200.png | Bin 0 -> 7700 bytes .../cs/assets/Square150x150Logo.scale-200.png | Bin 0 -> 2937 bytes .../cs/assets/Square44x44Logo.scale-200.png | Bin 0 -> 1647 bytes ...x44Logo.targetsize-24_altform-unplated.png | Bin 0 -> 1255 bytes .../templates/cs/assets/StoreLogo.png | Bin 0 -> 1451 bytes .../cs/assets/Wide310x150Logo.scale-200.png | Bin 0 -> 3204 bytes .../templates/{ => cs}/proj/MyApp.csproj | 0 .../templates/{ => cs}/proj/MyApp.sln | 0 .../templates/cs/src/App.xaml | 7 + .../templates/{ => cs}/src/App.xaml.cs | 0 .../templates/{ => cs}/src/MainPage.xaml | 0 .../templates/{ => cs}/src/MainPage.xaml.cs | 0 .../{ => cs}/src/Package.appxmanifest | 0 .../{ => cs}/src/Properties/AssemblyInfo.cs | 0 .../{ => cs}/src/Properties/Default.rd.xml | 0 vnext/local-cli/runWindows/utils/build.js | 4 +- vnext/package.json | 6 +- .../Libraries/Utilities/Dimensions.windows.js | 142 ++ vnext/{ => src}/jest/hasteImpl.js | 16 +- yarn.lock | 519 ++++---- 165 files changed, 4537 insertions(+), 3348 deletions(-) create mode 100644 .ado/templates/react-native-init.yml create mode 100644 current/local-cli/rnpm/wpf/CHANGELOG.json create mode 100644 current/local-cli/rnpm/wpf/CHANGELOG.md create mode 100644 packages/playground/Samples/animation.tsx delete mode 100644 vnext/Chakra/ChakraJsiRuntime.h delete mode 100644 vnext/Chakra/ChakraJsiRuntimeFactory.h delete mode 100644 vnext/CopyHeaders.inc rename vnext/Desktop.IntegrationTests/{ChakraJSIRuntimeHolder.cpp => ChakraRuntimeHolder.cpp} (69%) rename vnext/Desktop.IntegrationTests/{ChakraJSIRuntimeHolder.h => ChakraRuntimeHolder.h} (75%) delete mode 100644 vnext/Desktop/msoFolly.h rename vnext/{Chakra => JSI/Desktop}/ChakraJsiRuntime_core.cpp (82%) create mode 100644 vnext/JSI/Desktop/JSI.Desktop.vcxproj create mode 100644 vnext/JSI/Desktop/JSI.Desktop.vcxproj.filters create mode 100644 vnext/JSI/Desktop/packages.config create mode 100644 vnext/JSI/Shared/ByteArrayBuffer.h rename vnext/{Chakra/ChakraJsiRuntime.cpp => JSI/Shared/ChakraRuntime.cpp} (63%) create mode 100644 vnext/JSI/Shared/ChakraRuntime.h rename vnext/{Chakra/ChakraJsiRuntimeArgs.h => JSI/Shared/ChakraRuntimeArgs.h} (72%) create mode 100644 vnext/JSI/Shared/ChakraRuntimeFactory.h create mode 100644 vnext/JSI/Shared/JSI.Shared.vcxitems create mode 100644 vnext/JSI/Shared/JSI.Shared.vcxitems.filters rename vnext/{Chakra => JSI/Universal}/ChakraJsiRuntime_edgemode.cpp (68%) create mode 100644 vnext/JSI/Universal/JSI.Universal.vcxproj create mode 100644 vnext/JSI/Universal/JSI.Universal.vcxproj.filters create mode 100644 vnext/ReactUWP/Views/SliderViewManager.cpp create mode 100644 vnext/ReactUWP/Views/SliderViewManager.h rename vnext/ReactWindowsCore/{ChakraJSIRuntimeHolder.cpp => ChakraRuntimeHolder.cpp} (65%) rename vnext/ReactWindowsCore/{ChakraJSIRuntimeHolder.h => ChakraRuntimeHolder.h} (69%) rename vnext/local-cli/generator-windows/templates/{ => cpp}/assets/LockScreenLogo.scale-200.png (100%) rename vnext/local-cli/generator-windows/templates/{ => cpp}/assets/SplashScreen.scale-200.png (100%) rename vnext/local-cli/generator-windows/templates/{ => cpp}/assets/Square150x150Logo.scale-200.png (100%) rename vnext/local-cli/generator-windows/templates/{ => cpp}/assets/Square44x44Logo.scale-200.png (100%) rename vnext/local-cli/generator-windows/templates/{ => cpp}/assets/Square44x44Logo.targetsize-24_altform-unplated.png (100%) rename vnext/local-cli/generator-windows/templates/{ => cpp}/assets/StoreLogo.png (100%) rename vnext/local-cli/generator-windows/templates/{ => cpp}/assets/Wide310x150Logo.scale-200.png (100%) create mode 100644 vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.sln create mode 100644 vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj create mode 100644 vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj.filters create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/App.cpp create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/App.h create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/App.idl rename vnext/local-cli/generator-windows/templates/{ => cpp}/src/App.xaml (100%) create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/MainPage.cpp create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/MainPage.h create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/MainPage.idl create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/MainPage.xaml create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/Package.appxmanifest create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/PropertySheet.props create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/packages.config create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/pch.cpp create mode 100644 vnext/local-cli/generator-windows/templates/cpp/src/pch.h create mode 100644 vnext/local-cli/generator-windows/templates/cs/assets/LockScreenLogo.scale-200.png create mode 100644 vnext/local-cli/generator-windows/templates/cs/assets/SplashScreen.scale-200.png create mode 100644 vnext/local-cli/generator-windows/templates/cs/assets/Square150x150Logo.scale-200.png create mode 100644 vnext/local-cli/generator-windows/templates/cs/assets/Square44x44Logo.scale-200.png create mode 100644 vnext/local-cli/generator-windows/templates/cs/assets/Square44x44Logo.targetsize-24_altform-unplated.png create mode 100644 vnext/local-cli/generator-windows/templates/cs/assets/StoreLogo.png create mode 100644 vnext/local-cli/generator-windows/templates/cs/assets/Wide310x150Logo.scale-200.png rename vnext/local-cli/generator-windows/templates/{ => cs}/proj/MyApp.csproj (100%) rename vnext/local-cli/generator-windows/templates/{ => cs}/proj/MyApp.sln (100%) create mode 100644 vnext/local-cli/generator-windows/templates/cs/src/App.xaml rename vnext/local-cli/generator-windows/templates/{ => cs}/src/App.xaml.cs (100%) rename vnext/local-cli/generator-windows/templates/{ => cs}/src/MainPage.xaml (100%) rename vnext/local-cli/generator-windows/templates/{ => cs}/src/MainPage.xaml.cs (100%) rename vnext/local-cli/generator-windows/templates/{ => cs}/src/Package.appxmanifest (100%) rename vnext/local-cli/generator-windows/templates/{ => cs}/src/Properties/AssemblyInfo.cs (100%) rename vnext/local-cli/generator-windows/templates/{ => cs}/src/Properties/Default.rd.xml (100%) create mode 100644 vnext/src/Libraries/Utilities/Dimensions.windows.js rename vnext/{ => src}/jest/hasteImpl.js (79%) diff --git a/.ado/publish.yml b/.ado/publish.yml index 5fc718a0476..2afa3dccc74 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -48,7 +48,7 @@ jobs: - task: CmdLine@2 displayName: Beachball Publish (for other branches) inputs: - script: node ./node_modules/beachball/bin/beachball.js publish --tag $(Build.SourceBranchName) -n $(npmAuthToken) -yes -m "applying package updates ***NO_CI***" + script: node ./node_modules/beachball/bin/beachball.js publish --tag v$(Build.SourceBranchName) --branch origin/$(Build.SourceBranchName) -n $(npmAuthToken) -yes -m "applying package updates ***NO_CI***" condition: and(succeeded(), ne(variables['Build.SourceBranchName'], 'master')) - task: CmdLine@2 diff --git a/.ado/templates/e2e-test-job.yml b/.ado/templates/e2e-test-job.yml index e5b499be96f..f678d4f739f 100644 --- a/.ado/templates/e2e-test-job.yml +++ b/.ado/templates/e2e-test-job.yml @@ -1,13 +1,15 @@ # parameters: - name: '' + name: "" pool: - BuildPlatform: 'x86' # ARM, x86, x64 + BuildPlatform: "x86" # ARM, x86, x64 UseRNFork: true jobs: - job: ${{ parameters.name }} displayName: E2E Test + dependsOn: Setup + condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) pool: ${{ parameters.pool }} timeoutInMinutes: 60 # how long to run the job before automatically cancelling cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them @@ -19,6 +21,12 @@ jobs: submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch + - task: PowerShell@2 + displayName: "Remove WebDriverIO Workaround" + inputs: + targetType: "inline" + script: '((Get-Content -path packages/E2ETest/package.json -Raw) -replace ".*webdriver.git.*","") | Set-Content -Path packages/E2ETest/package.json' + - task: CmdLine@2 displayName: Install react-native-cli inputs: @@ -46,6 +54,12 @@ jobs: script: yarn install condition: and(succeeded(), eq('${{ parameters.UseRNFork }}', 'false')) + - task: PowerShell@2 + displayName: "Patch WebDriverIO" + inputs: + targetType: "inline" + script: '((Get-Content -path node_modules/webdriver/build/utils.js -Raw) -replace "if \(!body .*","if (!body) {") | Set-Content -Path node_modules/webdriver/build/utils.js' + - template: stop-packagers.yml - task: CmdLine@2 @@ -71,7 +85,7 @@ jobs: - task: CmdLine@2 displayName: run-windows inputs: - script: react-native run-windows --no-packager --arch ${{ parameters.BuildPlatform }} --release --bundle --logging --force + script: react-native run-windows --no-packager --arch ${{ parameters.BuildPlatform }} --release --bundle --logging --force workingDirectory: packages/E2ETest # Wait for app to launch. A workaround to avoid WinAppDriver error: Failed to locate opened application window with appId @@ -82,6 +96,12 @@ jobs: script: | Start-Sleep -Seconds 30 + - task: PowerShell@2 + displayName: 'Check TestApp' + inputs: + targetType: 'inline' + script: 'if ((Get-Process React*) -eq $Null) { echo "TestApp is not running"; exit 1}' + - task: CmdLine@2 displayName: run test inputs: @@ -90,6 +110,27 @@ jobs: - task: PublishTestResults@2 inputs: - testResultsFormat: 'JUnit' - testResultsFiles: 'packages/E2ETest/reports/*.log' + testResultsFormat: "JUnit" + testResultsFiles: "packages/E2ETest/reports/*.log" condition: succeededOrFailed() + + - task: PowerShell@2 + displayName: "Show package.json" + inputs: + targetType: "inline" + script: "Get-Content packages/E2ETest/package.json | foreach {Write-Output $_}" + condition: failed() + + - task: PowerShell@2 + displayName: "Show node_modules/webdriver/build/utils.js" + inputs: + targetType: "inline" + script: "Get-Content node_modules/webdriver/build/utils.js | foreach {Write-Output $_}" + condition: failed() + + - task: PowerShell@2 + displayName: "Show appium log" + inputs: + targetType: "inline" + script: "Get-Content packages/E2ETest/reports/appium.txt | foreach {Write-Output $_}" + condition: failed() diff --git a/.ado/templates/react-native-init.yml b/.ado/templates/react-native-init.yml new file mode 100644 index 00000000000..4e8609fa00c --- /dev/null +++ b/.ado/templates/react-native-init.yml @@ -0,0 +1,83 @@ +# +parameters: + language: + version: + platform: + configuration: + +steps: + - checkout: self # self represents the repo where the initial Pipelines YAML file was found + clean: true # whether to fetch clean each time + # fetchDepth: 2 # the depth of commits to ask Git to fetch + lfs: false # whether to download Git-LFS files + submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules + persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch + + # First do a build of the local package, since we point the cli at the local files, it needs to be pre-built + - task: CmdLine@2 + displayName: yarn install (local react-native-windows) + inputs: + script: yarn install --frozen-lockfile + + - task: CmdLine@2 + displayName: yarn build (local react-native-windows) + inputs: + script: yarn build + workingDirectory: vnext + + # yarn ends up copying the whole node_modules folder when doing an install of a file package + # Delete node_modules, so that resolution is more like when installing from a published npm package + - task: CmdLine@2 + displayName: Remove node_modules + inputs: + script: rd /S /Q node_modules + workingDirectory: vnext + + - task: CmdLine@2 + displayName: Install react-native cli + inputs: + script: npm install -g react-native-cli + + - task: CmdLine@2 + displayName: Init new project + inputs: + script: react-native init testcli --version ${{ parameters.version }} + workingDirectory: $(Agent.BuildDirectory) + + - task: CmdLine@2 + displayName: Install rnpm-plugin-windows + inputs: + script: yarn add rnpm-plugin-windows@file:$(Build.SourcesDirectory)\current\local-cli\rnpm\windows + workingDirectory: $(Agent.BuildDirectory)\testcli + + - task: CmdLine@2 + displayName: Apply windows template + inputs: + script: react-native windows --template vnext --windowsVersion file:$(Build.SourcesDirectory)\vnext --overwrite --language ${{ parameters.language }} + workingDirectory: $(Agent.BuildDirectory)\testcli + + - task: NuGetCommand@2 + displayName: NuGet restore testcli + inputs: + command: restore + restoreSolution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln + + - task: MSBuild@1 + displayName: MSBuild - testcli + inputs: + solution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln + msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 + msbuildArchitecture: x86 # Optional. Options: x86, x64 + platform: ${{ parameters.platform }} # Optional + configuration: ${{ parameters.configuration }} # Optional + restoreNugetPackages: true + msbuildArguments: + /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) + /p:PlatformToolset=$(MSBuildPlatformToolset) + clean: true # Optional + + - task: CmdLine@2 + displayName: Create bundle testcli + inputs: + script: react-native bundle --entry-file index.js platform windows --bundle-output test.bundle + workingDirectory: $(Agent.BuildDirectory)\testcli diff --git a/.ado/windows-vs-pr.yml b/.ado/windows-vs-pr.yml index 9ab466fdce0..826415bb3a2 100644 --- a/.ado/windows-vs-pr.yml +++ b/.ado/windows-vs-pr.yml @@ -15,512 +15,456 @@ variables: MSBuildPlatformToolset: v142 TargetPlatformVersion: 10.0.18362.0 -stages: - - stage: SetupStage - displayName: Setup - - jobs: - - job: Setup - steps: - - task: powershell@2 - name: checkPayload - displayName: "Check if build is required for this PR" - inputs: - targetType: filePath - filePath: .ado/shouldSkipPRBuild.ps1 - - - stage: BuildStage - displayName: Verify - dependsOn: SetupStage +jobs: + - job: Setup + steps: + - task: powershell@2 + name: checkPayload + displayName: "Check if build is required for this PR" + inputs: + targetType: filePath + filePath: .ado/shouldSkipPRBuild.ps1 + - job: RNWUniversalPR + displayName: Universal PR + dependsOn: Setup condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) - - jobs: - - job: RNWUniversalPR - displayName: Universal PR - strategy: - matrix: - X64Debug: - BuildConfiguration: Debug - BuildPlatform: x64 - UseRNFork: true - LayoutHeaders: true - X86Debug: - BuildConfiguration: Debug - BuildPlatform: x86 - UseRNFork: true - ArmDebug: - BuildConfiguration: Debug - BuildPlatform: arm - UseRNFork: true - X64Release: - BuildConfiguration: Release - BuildPlatform: x64 - UseRNFork: true - X86Release: - BuildConfiguration: Release - BuildPlatform: x86 - UseRNFork: true - ArmRelease: - BuildConfiguration: Release - BuildPlatform: arm - UseRNFork: true - PublicRNX86Debug: - BuildConfiguration: Debug - BuildPlatform: x86 - UseRNFork: false - pool: - vmImage: $(VmImage) - timeoutInMinutes: 60 - cancelTimeoutInMinutes: 5 - steps: - - checkout: self - clean: false - submodules: false - - - template: templates/build-rnw.yml - parameters: - useRnFork: $(UseRNFork) - yarnBuildCmd: buildci - project: vnext/ReactWindows-Universal.sln - - - template: templates/publish-build-artifacts-for-nuget.yml - parameters: - artifactName: ReactWindows - layoutHeaders: eq('true', variables['LayoutHeaders']) - contents: | - ReactUWP\** - - - task: NuGetCommand@2 - displayName: NuGet restore - Playground - inputs: - command: restore - restoreSolution: packages/playground/windows/Playground.sln - verbosityRestore: Detailed # Options: quiet, normal, detailed - - - task: MSBuild@1 - displayName: MSBuild - Playground - inputs: - solution: packages/playground/windows/Playground.sln - msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 - msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 - platform: $(BuildPlatform) # Optional - configuration: $(BuildConfiguration) # Optional - msbuildArguments: - /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) - /p:PlatformToolset=$(MSBuildPlatformToolset) - clean: true # Optional - condition: and(succeeded(), eq(variables['UseRNFork'], 'true')) - - - task: CmdLine@2 - displayName: Create Playground bundle - inputs: - script: node node_modules/react-native/local-cli/cli.js bundle --entry-file Samples\index.tsx --bundle-output Playground.bundle - workingDirectory: packages\playground - - - task: NuGetCommand@2 - displayName: NuGet restore - SampleApps - inputs: - command: restore - restoreSolution: packages/microsoft-reactnative-sampleapps/windows/SampleApps.sln - verbosityRestore: Detailed # Options: quiet, normal, detailed - - - task: MSBuild@1 - displayName: MSBuild - SampleApps - inputs: - solution: packages/microsoft-reactnative-sampleapps/windows/SampleApps.sln - msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 - msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 - platform: $(BuildPlatform) # Optional - configuration: $(BuildConfiguration) # Optional - msbuildArguments: - /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) - /p:PlatformToolset=$(MSBuildPlatformToolset) - clean: true # Optional - condition: and(succeeded(), eq(variables['UseRNFork'], 'true'), False) # Disabled until we switch to VS 2019 - - - task: CmdLine@2 - displayName: Create SampleApp bundle - inputs: - script: node node_modules/react-native/local-cli/cli.js bundle --entry-file index.windows.js --bundle-output SampleApp.bundle - workingDirectory: packages\microsoft-reactnative-sampleapps - - - task: CmdLine@2 - displayName: Create RNTester bundle - inputs: - script: node ../node_modules/react-native/local-cli/cli.js bundle --entry-file .\RNTester.js --bundle-output RNTester.windows.bundle --platform windows - workingDirectory: vnext - condition: and(succeeded(), eq(variables['UseRNFork'], 'true')) - - - job: RNWDesktopPR - displayName: Desktop PR - strategy: - matrix: - X64Debug: - BuildConfiguration: Debug - BuildPlatform: x64 - X86Debug: - BuildConfiguration: Debug - BuildPlatform: x86 - X64Release: - BuildConfiguration: Release - BuildPlatform: x64 - X86Release: - BuildConfiguration: Release - BuildPlatform: x86 - - pool: - vmImage: $(VmImage) - timeoutInMinutes: 50 # how long to run the job before automatically cancelling - cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them - - variables: - Desktop.IntegrationTests.Filter: (FullyQualifiedName!~WebSocketJSExecutorIntegrationTest)&(FullyQualifiedName!=RNTesterIntegrationTests::WebSocket)&(FullyQualifiedName!~WebSocket) - GoogleTestAdapterPath: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\pemwd5jw.szc' - VsComponents: Microsoft.VisualStudio.Component.VC.v141.x86.x64 - VCTargetsPath: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v150' - - steps: - - checkout: self - clean: false - submodules: false - - - template: templates/build-rnw.yml - parameters: - yarnBuildCmd: buildci - project: vnext/ReactWindows-Desktop.sln - platformToolset: v141 - vsComponents: $(VsComponents) - msbuildArguments: - /p:RNW_PKG_VERSION_STR="Private Build" - /p:RNW_PKG_VERSION="1000,0,0,0" - /p:VCTargetsPath="$(VCTargetsPath)" - - - task: VSTest@2 - displayName: Run Desktop Unit Tests - timeoutInMinutes: 5 # Set smaller timeout , due to hangs - inputs: - testSelector: testAssemblies - testAssemblyVer2: | - React.Windows.Desktop.UnitTests/React.Windows.Desktop.UnitTests.dll - JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.exe - pathtoCustomTestAdapters: $(GoogleTestAdapterPath) - searchFolder: $(Build.SourcesDirectory)/vnext/target/$(BuildPlatform)/$(BuildConfiguration) - runTestsInIsolation: true - platform: $(BuildPlatform) - configuration: $(BuildConfiguration) - publishRunAttachments: true - collectDumpOn: onAbortOnly - - - template: templates/stop-packagers.yml - - - task: PowerShell@2 - displayName: Set up test servers - inputs: - targetType: filePath # filePath | inline - filePath: $(Build.SourcesDirectory)\vnext\Scripts\Tfs\Start-TestServers.ps1 - arguments: -SourcesDirectory $(Build.SourcesDirectory)\vnext -Preload -SleepSeconds 30 - - - task: VSTest@2 - displayName: Run Desktop Integration Tests - inputs: - testSelector: testAssemblies - testAssemblyVer2: React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll - searchFolder: $(Build.SourcesDirectory)\vnext\target\$(BuildPlatform)\$(BuildConfiguration) - testFiltercriteria: $(Desktop.IntegrationTests.Filter) - runTestsInIsolation: true - platform: $(BuildPlatform) - configuration: $(BuildConfiguration) - publishRunAttachments: true - collectDumpOn: onAbortOnly - - - template: templates/stop-packagers.yml - - - template: templates/publish-build-artifacts-for-nuget.yml - parameters: - artifactName: ReactWindows - contents: | - React.Windows.Desktop.DLL\** - React.Windows.Desktop.Test.DLL\** - - - job: CliInit - displayName: Verify react-native init - pool: - vmImage: $(VmImage) - timeoutInMinutes: 30 # how long to run the job before automatically cancelling - cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them - steps: - - checkout: self # self represents the repo where the initial Pipelines YAML file was found - clean: true # whether to fetch clean each time - # fetchDepth: 2 # the depth of commits to ask Git to fetch - lfs: false # whether to download Git-LFS files - submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules - persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch - - # First do a build of the local package, since we point the cli at the local files, it needs to be pre-built - - task: CmdLine@2 - displayName: yarn install (local react-native-windows) - inputs: - script: yarn install --frozen-lockfile - - - task: CmdLine@2 - displayName: yarn build (local react-native-windows) - inputs: - script: yarn build - workingDirectory: vnext - - # yarn ends up copying the whole node_modules folder when doing an install of a file package - # Delete node_modules, so that resolution is more like when installing from a published npm package - - task: CmdLine@2 - displayName: Remove node_modules - inputs: - script: rd /S /Q node_modules - workingDirectory: vnext - - - task: CmdLine@2 - displayName: Install react-native cli - inputs: - script: npm install -g react-native-cli - - - task: CmdLine@2 - displayName: Init new project - inputs: - script: react-native init testcli --version 0.60.6 - workingDirectory: $(Agent.BuildDirectory) - - - task: CmdLine@2 - displayName: Install rnpm-plugin-windows - inputs: - script: yarn add rnpm-plugin-windows@file:$(Build.SourcesDirectory)\current\local-cli\rnpm\windows - workingDirectory: $(Agent.BuildDirectory)\testcli - - - task: CmdLine@2 - displayName: Apply windows template - inputs: - script: react-native windows --template vnext --windowsVersion file:$(Build.SourcesDirectory)\vnext --overwrite - workingDirectory: $(Agent.BuildDirectory)\testcli - - - task: NuGetCommand@2 - displayName: NuGet restore testcli - inputs: - command: restore - restoreSolution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln - - - task: MSBuild@1 - displayName: MSBuild - testcli - inputs: - solution: $(Agent.BuildDirectory)\testcli\windows\testcli.sln - msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 - msbuildArchitecture: x86 # Optional. Options: x86, x64 - platform: x64 # Optional - configuration: Debug # Optional - restoreNugetPackages: true - msbuildArguments: - /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) - /p:PlatformToolset=$(MSBuildPlatformToolset) - clean: true # Optional - - - task: CmdLine@2 - displayName: Create bundle testcli - inputs: - script: react-native bundle --entry-file index.js platform windows --bundle-output test.bundle - workingDirectory: $(Agent.BuildDirectory)\testcli - - - job: RNWFormatting - displayName: Verify change files + formatting - pool: - vmImage: $(VmImage) - timeoutInMinutes: 10 # how long to run the job before automatically cancelling - cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them - steps: - - checkout: self # self represents the repo where the initial Pipelines YAML file was found - clean: true # whether to fetch clean each time - fetchDepth: 2 # the depth of commits to ask Git to fetch - lfs: false # whether to download Git-LFS files - submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules - persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch - - - task: CmdLine@2 - displayName: yarn install - inputs: - script: yarn install --frozen-lockfile - - - task: CmdLine@2 - displayName: Check for change files - inputs: - script: node ./node_modules/beachball/bin/beachball.js check --changehint "Run `yarn change` from root of repo to generate a change file." - - - task: CmdLine@2 - displayName: yarn format:verify - inputs: - script: yarn format:verify - - - job: CurrentPR - displayName: Current (C#) PR - strategy: - matrix: - #X64Debug: - # BuildConfiguration: Debug - # BuildPlatform: x64 - # UTTestOutputConfigDir: Debug - #X64Release: - # BuildConfiguration: Release - # BuildPlatform: x64 - # UTTestOutputConfigDir: Release - X64DebugBundle: - BuildConfiguration: DebugBundle - BuildPlatform: x64 - UTTestOutputConfigDir: Debug - ArmDebug: - BuildConfiguration: Debug - BuildPlatform: ARM - UTTestOutputConfigDir: Debug - X86Debug: - BuildConfiguration: Debug - BuildPlatform: x86 - UTTestOutputConfigDir: Debug - #X86Release: - # BuildConfiguration: Release - # BuildPlatform: x86 - # UTTestOutputConfigDir: Release - #X86ReleaseBundle: - # BuildConfiguration: ReleaseBundle - # BuildPlatform: x86 - # UTTestOutputConfigDir: Release - pool: - vmImage: $(VmImage) - timeoutInMinutes: 15 # how long to run the job before automatically cancelling - cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them - - steps: - - checkout: self # self represents the repo where the initial Pipelines YAML file was found - clean: true # whether to fetch clean each time - # fetchDepth: 2 # the depth of commits to ask Git to fetch - lfs: false # whether to download Git-LFS files - submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules - persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch - - - task: PowerShell@2 - displayName: Download Winium - inputs: - targetType: inline # filePath | inline - script: | - curl -o $(System.DefaultWorkingDirectory)\winium.zip https://github.com/2gis/Winium.Desktop/releases/download/v1.6.0/Winium.Desktop.Driver.zip - - - task: ExtractFiles@1 - displayName: Extract Winium - inputs: - archiveFilePatterns: $(System.DefaultWorkingDirectory)\winium.zip - destinationFolder: $(System.DefaultWorkingDirectory)\winium - - - task: NuGetCommand@2 - displayName: NuGet restore - inputs: - command: restore - restoreSolution: current/ReactWindows/ReactNative.sln - verbosityRestore: Detailed # Options: quiet, normal, detailed - - - task: CmdLine@2 - displayName: Install react-native-cli - inputs: - script: npm install -g react-native-cli - - - task: CmdLine@2 - displayName: npm install - inputs: - script: npm install - workingDirectory: current - - - task: CmdLine@2 - displayName: Make Bundle Dir - inputs: - script: mkdir current\ReactWindows\Playground.Net46\ReactAssets - - - task: CmdLine@2 - displayName: Make Bundle - inputs: - script: react-native bundle --platform windows --entry-file ./ReactWindows/Playground.Net46/index.windows.js --bundle-output ./ReactWindows/Playground.Net46/ReactAssets/index.windows.bundle --assets-dest ./ReactWindows/Playground.Net46/ReactAssets --dev false - workingDirectory: current - - - task: MSBuild@1 - displayName: MSBuild - inputs: - solution: current/ReactWindows/ReactNative.sln - #msbuildLocationMethod: 'version' # Optional. Options: version, location - msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 - #msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 - #msbuildLocation: # Optional - platform: $(BuildPlatform) # Optional - configuration: $(BuildConfiguration) # Optional - msbuildArguments: - /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) - /p:PlatformToolset=$(MSBuildPlatformToolset) - /p:TargetPlatformVersion=$(TargetPlatformVersion) - /p:WindowsTargetPlatformVersion=$(TargetPlatformVersion) - #clean: true # Optional - #maximumCpuCount: false # Optional - #restoreNugetPackages: false # Optional - #logProjectEvents: false # Optional - #createLogFile: false # Optional - #logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed, diagnostic - - - task: PowerShell@2 - displayName: Start Winium - inputs: - targetType: inline # filePath | inline - script: | - $winium = Start-Process -PassThru $(System.DefaultWorkingDirectory)\winium\Winium.Desktop.Driver.exe - Start-Sleep -s 5 - - - task: VSTest@2 - displayName: Run Unit Tests - timeoutInMinutes: 5 # Set smaller timeout for UTs, since there have been some hangs, and this allows the job to timeout quicker - inputs: - testSelector: testAssemblies - testAssemblyVer2: ReactNative.Net46.Tests.dll # Required when testSelector == TestAssemblies - searchFolder: '$(Build.SourcesDirectory)\current\ReactWindows\ReactNative.Net46.Tests\bin\$(BuildPlatform)\$(UTTestOutputConfigDir)' - # vsTestVersion: $(VsTestVersion) - runTestsInIsolation: true - platform: $(BuildPlatform) - configuration: $(BuildConfiguration) - publishRunAttachments: true - collectDumpOn: onAbortOnly - condition: and(succeeded(), ne(variables['BuildPlatform'], 'ARM')) - # Previous AppVeyor definition had code to trigger this, but due to a bug in the AppVeyor build def it was never triggering - # It currently fails, so commenting this out for now - #- task: CmdLine@2 - # displayName: npm test - # inputs: - # script: npm test - # workingDirectory: current - # condition: and(succeeded(), or(eq(variables['BuildConfiguration'], 'DebugBundle'), eq(variables['BuildConfiguration'], 'ReleaseBundle'))) - - - template: templates/e2e-test-job.yml # Template reference - parameters: - name: E2ETest - pool: - vmImage: $(VmImage) + strategy: + matrix: + X64Debug: + BuildConfiguration: Debug + BuildPlatform: x64 + UseRNFork: true + LayoutHeaders: true + X86Debug: + BuildConfiguration: Debug + BuildPlatform: x86 + UseRNFork: true + ArmDebug: + BuildConfiguration: Debug + BuildPlatform: arm + UseRNFork: true + X64Release: + BuildConfiguration: Release BuildPlatform: x64 UseRNFork: true + X86Release: + BuildConfiguration: Release + BuildPlatform: x86 + UseRNFork: true + ArmRelease: + BuildConfiguration: Release + BuildPlatform: arm + UseRNFork: true + PublicRNX86Debug: + BuildConfiguration: Debug + BuildPlatform: x86 + UseRNFork: false + pool: + vmImage: $(VmImage) + timeoutInMinutes: 60 + cancelTimeoutInMinutes: 5 + steps: + - checkout: self + clean: false + submodules: false + + - template: templates/build-rnw.yml + parameters: + useRnFork: $(UseRNFork) + yarnBuildCmd: buildci + project: vnext/ReactWindows-Universal.sln - - stage: - displayName: Pack - dependsOn: BuildStage + - template: templates/publish-build-artifacts-for-nuget.yml + parameters: + artifactName: ReactWindows + layoutHeaders: eq('true', variables['LayoutHeaders']) + contents: | + ReactUWP\** + + - task: NuGetCommand@2 + displayName: NuGet restore - Playground + inputs: + command: restore + restoreSolution: packages/playground/windows/Playground.sln + verbosityRestore: Detailed # Options: quiet, normal, detailed + + - task: MSBuild@1 + displayName: MSBuild - Playground + inputs: + solution: packages/playground/windows/Playground.sln + msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 + msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 + platform: $(BuildPlatform) # Optional + configuration: $(BuildConfiguration) # Optional + msbuildArguments: + /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) + /p:PlatformToolset=$(MSBuildPlatformToolset) + clean: true # Optional + condition: and(succeeded(), eq(variables['UseRNFork'], 'true')) + + - task: CmdLine@2 + displayName: Create Playground bundle + inputs: + script: node node_modules/react-native/local-cli/cli.js bundle --entry-file Samples\index.tsx --bundle-output Playground.bundle + workingDirectory: packages\playground + + - task: NuGetCommand@2 + displayName: NuGet restore - SampleApps + inputs: + command: restore + restoreSolution: packages/microsoft-reactnative-sampleapps/windows/SampleApps.sln + verbosityRestore: Detailed # Options: quiet, normal, detailed + + - task: MSBuild@1 + displayName: MSBuild - SampleApps + inputs: + solution: packages/microsoft-reactnative-sampleapps/windows/SampleApps.sln + msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 + msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 + platform: $(BuildPlatform) # Optional + configuration: $(BuildConfiguration) # Optional + msbuildArguments: + /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) + /p:PlatformToolset=$(MSBuildPlatformToolset) + clean: true # Optional + condition: and(succeeded(), eq(variables['UseRNFork'], 'true'), False) # Disabled until we switch to VS 2019 + + - task: CmdLine@2 + displayName: Create SampleApp bundle + inputs: + script: node node_modules/react-native/local-cli/cli.js bundle --entry-file index.windows.js --bundle-output SampleApp.bundle + workingDirectory: packages\microsoft-reactnative-sampleapps + + - task: CmdLine@2 + displayName: Create RNTester bundle + inputs: + script: node ../node_modules/react-native/local-cli/cli.js bundle --entry-file .\RNTester.js --bundle-output RNTester.windows.bundle --platform windows + workingDirectory: vnext + condition: and(succeeded(), eq(variables['UseRNFork'], 'true')) + + - job: RNWDesktopPR + displayName: Desktop PR + dependsOn: Setup condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) - - jobs: - - job: RNWNugetPR - displayName: Build and Pack Nuget - pool: - vmImage: $(VmImage) - timeoutInMinutes: 30 - cancelTimeoutInMinutes: 5 - steps: - - checkout: self - fetchDepth: 1 - - # The commit tag in the nuspec requires that we use at least nuget 4.6 - - task: NuGetToolInstaller@0 - inputs: - versionSpec: ">=4.6.0" - - - template: templates/prep-and-pack-nuget.yml + strategy: + matrix: + X64Debug: + BuildConfiguration: Debug + BuildPlatform: x64 + X86Debug: + BuildConfiguration: Debug + BuildPlatform: x86 + X64Release: + BuildConfiguration: Release + BuildPlatform: x64 + X86Release: + BuildConfiguration: Release + BuildPlatform: x86 + + pool: + vmImage: $(VmImage) + timeoutInMinutes: 50 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them + + variables: + Desktop.IntegrationTests.Filter: (FullyQualifiedName!~WebSocketJSExecutorIntegrationTest)&(FullyQualifiedName!=RNTesterIntegrationTests::WebSocket)&(FullyQualifiedName!~WebSocket) + GoogleTestAdapterPath: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\Extensions\pemwd5jw.szc' + VsComponents: Microsoft.VisualStudio.Component.VC.v141.x86.x64 + VCTargetsPath: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v150' + + steps: + - checkout: self + clean: false + submodules: false + + - template: templates/build-rnw.yml + parameters: + yarnBuildCmd: buildci + project: vnext/ReactWindows-Desktop.sln + platformToolset: v141 + vsComponents: $(VsComponents) + msbuildArguments: /p:RNW_PKG_VERSION_STR="Private Build" + /p:RNW_PKG_VERSION="1000,0,0,0" + /p:VCTargetsPath="$(VCTargetsPath)" + + - task: VSTest@2 + displayName: Run Desktop Unit Tests + timeoutInMinutes: 5 # Set smaller timeout , due to hangs + inputs: + testSelector: testAssemblies + testAssemblyVer2: | + React.Windows.Desktop.UnitTests/React.Windows.Desktop.UnitTests.dll + JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.exe + pathtoCustomTestAdapters: $(GoogleTestAdapterPath) + searchFolder: $(Build.SourcesDirectory)/vnext/target/$(BuildPlatform)/$(BuildConfiguration) + runTestsInIsolation: true + platform: $(BuildPlatform) + configuration: $(BuildConfiguration) + publishRunAttachments: true + collectDumpOn: onAbortOnly + + - template: templates/stop-packagers.yml + + - task: PowerShell@2 + displayName: Set up test servers + inputs: + targetType: filePath # filePath | inline + filePath: $(Build.SourcesDirectory)\vnext\Scripts\Tfs\Start-TestServers.ps1 + arguments: -SourcesDirectory $(Build.SourcesDirectory)\vnext -Preload -SleepSeconds 30 + + - task: VSTest@2 + displayName: Run Desktop Integration Tests + inputs: + testSelector: testAssemblies + testAssemblyVer2: React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll + searchFolder: $(Build.SourcesDirectory)\vnext\target\$(BuildPlatform)\$(BuildConfiguration) + testFiltercriteria: $(Desktop.IntegrationTests.Filter) + runTestsInIsolation: true + platform: $(BuildPlatform) + configuration: $(BuildConfiguration) + publishRunAttachments: true + collectDumpOn: onAbortOnly + + - template: templates/stop-packagers.yml + + - template: templates/publish-build-artifacts-for-nuget.yml + parameters: + artifactName: ReactWindows + contents: | + React.Windows.Desktop.DLL\** + React.Windows.Desktop.Test.DLL\** + + - job: CliInitCpp + displayName: Verify react-native init (cpp) + dependsOn: Setup + condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) + timeoutInMinutes: 30 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them + pool: + vmImage: $(VmImage) + steps: + - template: templates/react-native-init.yml + parameters: + language: cpp + version: 0.60.6 + platform: x64 + configuration: Debug + + - job: CliInitCs + displayName: Verify react-native init (cs) + dependsOn: Setup + condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) + timeoutInMinutes: 30 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them + pool: + vmImage: $(VmImage) + steps: + - template: templates/react-native-init.yml + parameters: + language: cs + version: 0.60.6 + platform: x64 + configuration: Debug + + - job: RNWFormatting + displayName: Verify change files + formatting + dependsOn: Setup + condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) + pool: + vmImage: $(VmImage) + timeoutInMinutes: 10 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them + steps: + - checkout: self # self represents the repo where the initial Pipelines YAML file was found + clean: true # whether to fetch clean each time + fetchDepth: 2 # the depth of commits to ask Git to fetch + lfs: false # whether to download Git-LFS files + submodules: false # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules + persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch + + - task: CmdLine@2 + displayName: yarn install + inputs: + script: yarn install --frozen-lockfile + + - task: CmdLine@2 + displayName: Check for change files + inputs: + script: node ./node_modules/beachball/bin/beachball.js check --changehint "Run `yarn change` from root of repo to generate a change file." + + - task: CmdLine@2 + displayName: yarn format:verify + inputs: + script: yarn format:verify + + - job: CurrentPR + dependsOn: Setup + condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) + displayName: Current (C#) PR + strategy: + matrix: + #X64Debug: + # BuildConfiguration: Debug + # BuildPlatform: x64 + # UTTestOutputConfigDir: Debug + #X64Release: + # BuildConfiguration: Release + # BuildPlatform: x64 + # UTTestOutputConfigDir: Release + X64DebugBundle: + BuildConfiguration: DebugBundle + BuildPlatform: x64 + UTTestOutputConfigDir: Debug + ArmDebug: + BuildConfiguration: Debug + BuildPlatform: ARM + UTTestOutputConfigDir: Debug + X86Debug: + BuildConfiguration: Debug + BuildPlatform: x86 + UTTestOutputConfigDir: Debug + #X86Release: + # BuildConfiguration: Release + # BuildPlatform: x86 + # UTTestOutputConfigDir: Release + #X86ReleaseBundle: + # BuildConfiguration: ReleaseBundle + # BuildPlatform: x86 + # UTTestOutputConfigDir: Release + pool: + vmImage: $(VmImage) + timeoutInMinutes: 15 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them + + steps: + - checkout: self # self represents the repo where the initial Pipelines YAML file was found + clean: true # whether to fetch clean each time + # fetchDepth: 2 # the depth of commits to ask Git to fetch + lfs: false # whether to download Git-LFS files + submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules + persistCredentials: false # set to 'true' to leave the OAuth token in the Git config after the initial fetch + + - task: PowerShell@2 + displayName: Download Winium + inputs: + targetType: inline # filePath | inline + script: | + curl -o $(System.DefaultWorkingDirectory)\winium.zip https://github.com/2gis/Winium.Desktop/releases/download/v1.6.0/Winium.Desktop.Driver.zip + + - task: ExtractFiles@1 + displayName: Extract Winium + inputs: + archiveFilePatterns: $(System.DefaultWorkingDirectory)\winium.zip + destinationFolder: $(System.DefaultWorkingDirectory)\winium + + - task: NuGetCommand@2 + displayName: NuGet restore + inputs: + command: restore + restoreSolution: current/ReactWindows/ReactNative.sln + verbosityRestore: Detailed # Options: quiet, normal, detailed + + - task: CmdLine@2 + displayName: Install react-native-cli + inputs: + script: npm install -g react-native-cli + + - task: CmdLine@2 + displayName: npm install + inputs: + script: npm install + workingDirectory: current + + - task: CmdLine@2 + displayName: Make Bundle Dir + inputs: + script: mkdir current\ReactWindows\Playground.Net46\ReactAssets + + - task: CmdLine@2 + displayName: Make Bundle + inputs: + script: react-native bundle --platform windows --entry-file ./ReactWindows/Playground.Net46/index.windows.js --bundle-output ./ReactWindows/Playground.Net46/ReactAssets/index.windows.bundle --assets-dest ./ReactWindows/Playground.Net46/ReactAssets --dev false + workingDirectory: current + + - task: MSBuild@1 + displayName: MSBuild + inputs: + solution: current/ReactWindows/ReactNative.sln + #msbuildLocationMethod: 'version' # Optional. Options: version, location + msbuildVersion: $(MSBuildVersion) # Optional. Options: latest, 16.0, 15.0, 14.0, 12.0, 4.0 + #msbuildArchitecture: $(MSBuildArchitecture) # Optional. Options: x86, x64 + #msbuildLocation: # Optional + platform: $(BuildPlatform) # Optional + configuration: $(BuildConfiguration) # Optional + msbuildArguments: + /p:PreferredToolArchitecture=$(MSBuildPreferredToolArchitecture) + /p:PlatformToolset=$(MSBuildPlatformToolset) + /p:TargetPlatformVersion=$(TargetPlatformVersion) + /p:WindowsTargetPlatformVersion=$(TargetPlatformVersion) + #clean: true # Optional + #maximumCpuCount: false # Optional + #restoreNugetPackages: false # Optional + #logProjectEvents: false # Optional + #createLogFile: false # Optional + #logFileVerbosity: 'normal' # Optional. Options: quiet, minimal, normal, detailed, diagnostic + + - task: PowerShell@2 + displayName: Start Winium + inputs: + targetType: inline # filePath | inline + script: | + $winium = Start-Process -PassThru $(System.DefaultWorkingDirectory)\winium\Winium.Desktop.Driver.exe + Start-Sleep -s 5 + + - task: VSTest@2 + displayName: Run Unit Tests + timeoutInMinutes: 5 # Set smaller timeout for UTs, since there have been some hangs, and this allows the job to timeout quicker + inputs: + testSelector: testAssemblies + testAssemblyVer2: ReactNative.Net46.Tests.dll # Required when testSelector == TestAssemblies + searchFolder: '$(Build.SourcesDirectory)\current\ReactWindows\ReactNative.Net46.Tests\bin\$(BuildPlatform)\$(UTTestOutputConfigDir)' + # vsTestVersion: $(VsTestVersion) + runTestsInIsolation: true + platform: $(BuildPlatform) + configuration: $(BuildConfiguration) + publishRunAttachments: true + collectDumpOn: onAbortOnly + condition: and(succeeded(), ne(variables['BuildPlatform'], 'ARM')) + # Previous AppVeyor definition had code to trigger this, but due to a bug in the AppVeyor build def it was never triggering + # It currently fails, so commenting this out for now + #- task: CmdLine@2 + # displayName: npm test + # inputs: + # script: npm test + # workingDirectory: current + # condition: and(succeeded(), or(eq(variables['BuildConfiguration'], 'DebugBundle'), eq(variables['BuildConfiguration'], 'ReleaseBundle'))) + + - template: templates/e2e-test-job.yml # Template reference + parameters: + name: E2ETest + pool: + vmImage: $(VmImage) + BuildPlatform: x64 + UseRNFork: true + + - job: RNWNugetPR + displayName: Build and Pack Nuget + dependsOn: + - Setup + - RNWUniversalPR + - RNWDesktopPR + condition: ne( dependencies.Setup.outputs['checkPayload.shouldSkipPRBuild'], 'True' ) + pool: + vmImage: $(VmImage) + timeoutInMinutes: 30 + cancelTimeoutInMinutes: 5 + steps: + - checkout: self + fetchDepth: 1 + + # The commit tag in the nuspec requires that we use at least nuget 4.6 + - task: NuGetToolInstaller@0 + inputs: + versionSpec: ">=4.6.0" + + - template: templates/prep-and-pack-nuget.yml diff --git a/current/ReactWindows/ReactNative.Net46/ReactNative.Net46.csproj b/current/ReactWindows/ReactNative.Net46/ReactNative.Net46.csproj index 165ef45b6bc..ba4096c6d79 100644 --- a/current/ReactWindows/ReactNative.Net46/ReactNative.Net46.csproj +++ b/current/ReactWindows/ReactNative.Net46/ReactNative.Net46.csproj @@ -1,6 +1,6 @@  - + Debug @@ -239,7 +239,7 @@ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - + WindowsApp_downlevel.lib;%(AdditionalDependencies) - api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll;api-ms-win-core-winrt-string-l1-1-0.dll + api-ms-win-core-winrt-error-l1-1-0.dll;api-ms-win-core-winrt-error-l1-1-1.dll;api-ms-win-core-winrt-string-l1-1-0.dll;ChakraCore.Debugger.DLL @@ -133,7 +133,7 @@ - + @@ -143,7 +143,7 @@ - + diff --git a/vnext/Desktop.DLL/packages.config b/vnext/Desktop.DLL/packages.config index 9ebf63dc3e7..823fa857b37 100644 --- a/vnext/Desktop.DLL/packages.config +++ b/vnext/Desktop.DLL/packages.config @@ -3,6 +3,6 @@ - + diff --git a/vnext/Desktop.DLL/react-native-win32.x64.def b/vnext/Desktop.DLL/react-native-win32.x64.def index 11ce5e52309..599e1b60821 100644 --- a/vnext/Desktop.DLL/react-native-win32.x64.def +++ b/vnext/Desktop.DLL/react-native-win32.x64.def @@ -29,6 +29,7 @@ EXPORTS ?MakeMemoryMappedBuffer@JSI@Microsoft@@YA?AV?$shared_ptr@VBuffer@jsi@facebook@@@std@@QEB_WI@Z ?at@dynamic@folly@@QEGBAAEBU12@V?$Range@PEBD@2@@Z ?atImpl@dynamic@folly@@AEGBAAEBU12@AEBU12@@Z +?callJSFunction@Instance@react@facebook@@QEAAX$$QEAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0$$QEAUdynamic@folly@@@Z ?createI18nModule@windows@react@@YA?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@V?$unique_ptr@UII18nModule@windows@react@@U?$default_delete@UII18nModule@windows@react@@@std@@@4@@Z ?createIUIManager@react@facebook@@YA?AV?$shared_ptr@VIUIManager@react@facebook@@@std@@$$QEAV?$vector@V?$unique_ptr@VIViewManager@react@facebook@@U?$default_delete@VIViewManager@react@facebook@@@std@@@std@@V?$allocator@V?$unique_ptr@VIViewManager@react@facebook@@U?$default_delete@VIViewManager@react@facebook@@@std@@@std@@@2@@4@PEAUINativeUIManager@12@@Z ?createUIManagerModule@react@facebook@@YA?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@V?$shared_ptr@VIUIManager@react@facebook@@@4@@Z @@ -40,6 +41,7 @@ EXPORTS ?hash@dynamic@folly@@QEBA_KXZ ?makeConversionError@folly@@YA?AVConversionError@1@W4ConversionCode@1@V?$Range@PEBD@1@@Z ?parseJson@folly@@YA?AUdynamic@1@V?$Range@PEBD@1@@Z +?setGlobalVariable@Instance@react@facebook@@QEAAXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$unique_ptr@$$CBVJSBigString@react@facebook@@U?$default_delete@$$CBVJSBigString@react@facebook@@@std@@@5@@Z ?size@dynamic@folly@@QEBA_KXZ ?str_to_bool@detail@folly@@YA?AV?$Expected@_NW4ConversionCode@folly@@@2@PEAV?$Range@PEBD@2@@Z ?toJson@folly@@YA?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBUdynamic@1@@Z diff --git a/vnext/Desktop.DLL/react-native-win32.x86.def b/vnext/Desktop.DLL/react-native-win32.x86.def index f9afc216d3d..abf297b76db 100644 --- a/vnext/Desktop.DLL/react-native-win32.x86.def +++ b/vnext/Desktop.DLL/react-native-win32.x86.def @@ -29,6 +29,7 @@ EXPORTS ?MakeMemoryMappedBuffer@JSI@Microsoft@@YG?AV?$shared_ptr@VBuffer@jsi@facebook@@@std@@QB_WI@Z ?at@dynamic@folly@@QGBEABU12@V?$Range@PBD@2@@Z ?atImpl@dynamic@folly@@AGBEABU12@ABU12@@Z +?callJSFunction@Instance@react@facebook@@QAEX$$QAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0$$QAUdynamic@folly@@@Z ?createI18nModule@windows@react@@YG?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@V?$unique_ptr@UII18nModule@windows@react@@U?$default_delete@UII18nModule@windows@react@@@std@@@4@@Z ?createIUIManager@react@facebook@@YG?AV?$shared_ptr@VIUIManager@react@facebook@@@std@@$$QAV?$vector@V?$unique_ptr@VIViewManager@react@facebook@@U?$default_delete@VIViewManager@react@facebook@@@std@@@std@@V?$allocator@V?$unique_ptr@VIViewManager@react@facebook@@U?$default_delete@VIViewManager@react@facebook@@@std@@@std@@@2@@4@PAUINativeUIManager@12@@Z ?createUIManagerModule@react@facebook@@YG?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@V?$shared_ptr@VIUIManager@react@facebook@@@4@@Z @@ -40,6 +41,7 @@ EXPORTS ?hash@dynamic@folly@@QBEIXZ ?makeConversionError@folly@@YG?AVConversionError@1@W4ConversionCode@1@V?$Range@PBD@1@@Z ?parseJson@folly@@YG?AUdynamic@1@V?$Range@PBD@1@@Z +?setGlobalVariable@Instance@react@facebook@@QAEXV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$unique_ptr@$$CBVJSBigString@react@facebook@@U?$default_delete@$$CBVJSBigString@react@facebook@@@std@@@5@@Z ?size@dynamic@folly@@QBEIXZ ?str_to_bool@detail@folly@@YG?AV?$Expected@_NW4ConversionCode@folly@@@2@PAV?$Range@PBD@2@@Z ?toJson@folly@@YG?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABUdynamic@1@@Z diff --git a/vnext/Desktop.IntegrationTests/ChakraJSIRuntimeHolder.cpp b/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.cpp similarity index 69% rename from vnext/Desktop.IntegrationTests/ChakraJSIRuntimeHolder.cpp rename to vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.cpp index 12b17a93425..21989c2c22f 100644 --- a/vnext/Desktop.IntegrationTests/ChakraJSIRuntimeHolder.cpp +++ b/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.cpp @@ -1,47 +1,46 @@ #include "pch.h" -#include "ChakraJSIRuntimeHolder.h" +#include "ChakraRuntimeHolder.h" -#include +#include using namespace facebook; using namespace facebook::react; -using namespace facebook::jsi::chakraruntime; namespace Microsoft::React::Test { std::shared_ptr -ChakraJSIRuntimeHolder::getRuntime() noexcept { +ChakraRuntimeHolder::getRuntime() noexcept { std::call_once(once_flag_, [this]() { initRuntime(); }); if (!runtime_) std::terminate(); - // ChakraJsiRuntime is not thread safe as of now. + // ChakraRuntime is not thread safe as of now. if (own_thread_id_ != std::this_thread::get_id()) std::terminate(); return runtime_; } -void ChakraJSIRuntimeHolder::initRuntime() noexcept { - runtime_ = - facebook::jsi::chakraruntime::makeChakraJsiRuntime(std::move(args_)); +void ChakraRuntimeHolder::initRuntime() noexcept { + runtime_ = Microsoft::JSI::makeChakraRuntime(std::move(args_)); own_thread_id_ = std::this_thread::get_id(); } -Logger ChakraJSIRuntimeHolder::ChakraRuntimeLoggerFromReactLogger( +Microsoft::JSI::Logger ChakraRuntimeHolder::ChakraRuntimeLoggerFromReactLogger( facebook::react::NativeLoggingHook loggingCallback) noexcept { return [loggingCallback = std::move(loggingCallback)]( - const char *message, LogLevel logLevel) -> void { + const char *message, Microsoft::JSI::LogLevel logLevel) -> void { loggingCallback( static_cast(logLevel), message); }; } -ChakraJsiRuntimeArgs ChakraJSIRuntimeHolder::RuntimeArgsFromDevSettings( +Microsoft::JSI::ChakraRuntimeArgs +ChakraRuntimeHolder::RuntimeArgsFromDevSettings( std::shared_ptr devSettings) noexcept { - ChakraJsiRuntimeArgs runtimeArgs; + Microsoft::JSI::ChakraRuntimeArgs runtimeArgs; runtimeArgs.debuggerBreakOnNextLine = devSettings->debuggerBreakOnNextLine; runtimeArgs.debuggerPort = devSettings->debuggerPort; diff --git a/vnext/Desktop.IntegrationTests/ChakraJSIRuntimeHolder.h b/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.h similarity index 75% rename from vnext/Desktop.IntegrationTests/ChakraJSIRuntimeHolder.h rename to vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.h index 82e2e0dbb88..dfd72bb184f 100644 --- a/vnext/Desktop.IntegrationTests/ChakraJSIRuntimeHolder.h +++ b/vnext/Desktop.IntegrationTests/ChakraRuntimeHolder.h @@ -5,17 +5,17 @@ #include #include -#include +#include #include namespace Microsoft::React::Test { -class ChakraJSIRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit { +class ChakraRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit { public: std::shared_ptr getRuntime() noexcept override; - ChakraJSIRuntimeHolder( + ChakraRuntimeHolder( std::shared_ptr devSettings, std::shared_ptr jsQueue, std::unique_ptr &&scriptStore, @@ -28,14 +28,14 @@ class ChakraJSIRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit { } private: - facebook::jsi::chakraruntime::ChakraJsiRuntimeArgs RuntimeArgsFromDevSettings( + Microsoft::JSI::ChakraRuntimeArgs RuntimeArgsFromDevSettings( std::shared_ptr devSettings) noexcept; - facebook::jsi::chakraruntime::Logger ChakraRuntimeLoggerFromReactLogger( + Microsoft::JSI::Logger ChakraRuntimeLoggerFromReactLogger( facebook::react::NativeLoggingHook loggingCallback) noexcept; void initRuntime() noexcept; - facebook::jsi::chakraruntime::ChakraJsiRuntimeArgs args_; + Microsoft::JSI::ChakraRuntimeArgs args_; std::shared_ptr runtime_; std::once_flag once_flag_; diff --git a/vnext/Desktop.IntegrationTests/DesktopTestRunner.cpp b/vnext/Desktop.IntegrationTests/DesktopTestRunner.cpp index 0a1d1087345..a9eabc9055f 100644 --- a/vnext/Desktop.IntegrationTests/DesktopTestRunner.cpp +++ b/vnext/Desktop.IntegrationTests/DesktopTestRunner.cpp @@ -9,7 +9,7 @@ #include #include #include -#include "ChakraJSIRuntimeHolder.h" +#include "ChakraRuntimeHolder.h" #include "DesktopTestInstance.h" #include "TestMessageQueueThread.h" #include "TestModule.h" @@ -49,7 +49,7 @@ shared_ptr TestRunner::GetInstance( auto nativeQueue = make_shared(); auto jsQueue = make_shared(); - devSettings->jsiRuntimeHolder = std::make_shared( + devSettings->jsiRuntimeHolder = std::make_shared( devSettings, jsQueue, nullptr, nullptr); vector>> diff --git a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj index 912e3056fbe..39e8029ffef 100644 --- a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj +++ b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj @@ -60,7 +60,7 @@ - + @@ -97,7 +97,7 @@ - + @@ -105,7 +105,7 @@ - + @@ -115,7 +115,7 @@ - + diff --git a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj.filters b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj.filters index a005cdc73f1..4575a71d2ed 100644 --- a/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj.filters +++ b/vnext/Desktop.IntegrationTests/React.Windows.Desktop.IntegrationTests.vcxproj.filters @@ -39,7 +39,7 @@ Integration Tests - + Source Files @@ -47,7 +47,7 @@ Header Files - + Header Files diff --git a/vnext/Desktop.IntegrationTests/packages.config b/vnext/Desktop.IntegrationTests/packages.config index 9ebf63dc3e7..823fa857b37 100644 --- a/vnext/Desktop.IntegrationTests/packages.config +++ b/vnext/Desktop.IntegrationTests/packages.config @@ -3,6 +3,6 @@ - + diff --git a/vnext/Desktop.UnitTests/LayoutAnimationTests.cpp b/vnext/Desktop.UnitTests/LayoutAnimationTests.cpp index 3a006370cc7..5c70336de3d 100644 --- a/vnext/Desktop.UnitTests/LayoutAnimationTests.cpp +++ b/vnext/Desktop.UnitTests/LayoutAnimationTests.cpp @@ -40,7 +40,7 @@ namespace Microsoft::VisualStudio::CppUnitTestFramework { template <> std::wstring ToString( - const enum facebook::react::LayoutAnimation::AnimationType &t) { + const enum class facebook::react::LayoutAnimation::AnimationType &t) { switch (t) { case facebook::react::LayoutAnimation::AnimationType::Linear: return L"Linear"; @@ -62,7 +62,7 @@ std::wstring ToString( template <> std::wstring ToString( - const enum facebook::react::LayoutAnimation::AnimatableProperty &t) { + const enum class facebook::react::LayoutAnimation::AnimatableProperty &t) { switch (t) { case facebook::react::LayoutAnimation::AnimatableProperty::Opacity: return L"Opacity"; diff --git a/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj b/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj index 9a6159e8827..98fb0ddfc76 100644 --- a/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj +++ b/vnext/Desktop.UnitTests/React.Windows.Desktop.UnitTests.vcxproj @@ -91,7 +91,7 @@ - + @@ -100,7 +100,7 @@ - + diff --git a/vnext/Desktop.UnitTests/packages.config b/vnext/Desktop.UnitTests/packages.config index 843ab801239..771627d76cf 100644 --- a/vnext/Desktop.UnitTests/packages.config +++ b/vnext/Desktop.UnitTests/packages.config @@ -2,6 +2,6 @@ - + diff --git a/vnext/Desktop/React.Windows.Desktop.vcxproj b/vnext/Desktop/React.Windows.Desktop.vcxproj index 161c7b9b985..ecae8e3afbc 100644 --- a/vnext/Desktop/React.Windows.Desktop.vcxproj +++ b/vnext/Desktop/React.Windows.Desktop.vcxproj @@ -56,12 +56,10 @@ BOOST_ASIO_HAS_IOCP - Force unique layout/size for boost::asio::basic_stream_socket<> subtypes. --> BOOST_ASIO_HAS_IOCP;_WINSOCK_DEPRECATED_NO_WARNINGS;_WIN32_WINNT=_WIN32_WINNT_WIN7;WIN32;_WINDOWS;REACTNATIVEWIN32_EXPORTS;FOLLY_NO_CONFIG;NOMINMAX;GLOG_NO_ABBREVIATED_SEVERITIES;_HAS_AUTO_PTR_ETC;CHAKRACORE;RN_PLATFORM=win32;RN_EXPORT=;JSI_EXPORT=;%(PreprocessorDefinitions) - ENABLE_TRACING;%(PreprocessorDefinitions) ENABLE_NATIVE_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) ENABLE_JS_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) ENABLE_TRACE_POSTPROCESSING;%(PreprocessorDefinitions) - %(AdditionalOptions) /Zc:strictStrings /bigobj Use pch.h @@ -154,6 +152,9 @@ {74085F13-2DDE-45E5-A0CA-927AC9D0B953} + + {17dd1b17-3094-40dd-9373-ac2497932eca} + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD} @@ -166,7 +167,7 @@ - + @@ -177,7 +178,7 @@ - + diff --git a/vnext/Desktop/msoFolly.h b/vnext/Desktop/msoFolly.h deleted file mode 100644 index 2a0a2cd341a..00000000000 --- a/vnext/Desktop/msoFolly.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// This file is a helper to allow devmain code to include folly -// TODO: This file should eventually move to devmain -//#ifndef FBXPLATMODULE -//#define FBXPLATMODULE - -#include -#pragma warning(push) -#pragma warning(disable : 4995) -#pragma warning(disable : 4068) -#pragma warning(disable : 4146) -#pragma warning(disable : 4100) -#pragma warning(disable : 4127) -#pragma warning( \ - disable : 4324) // structure was padded due to alignment specifier -#pragma warning(disable : 4643) // Forward declaring 'T' in namespace std is not - // permitted by the C++ Standard. -#pragma push_macro("CHECK") -#pragma push_macro("Check") -#pragma push_macro("max") -#pragma push_macro("min") -#pragma push_macro("OUT") -#pragma push_macro("IN") -#undef Check -#undef CHECK -#undef max -#undef min -#undef OUT -#undef IN -#define FOLLY_MOBILE 1 -#include -#pragma pop_macro("IN") -#pragma pop_macro("OUT") -#pragma pop_macro("min") -#pragma pop_macro("max") -#pragma pop_macro("Check") -#pragma pop_macro("CHECK") -#pragma warning(pop) - -//#endif diff --git a/vnext/Desktop/packages.config b/vnext/Desktop/packages.config index b695d2e3120..3e294415006 100644 --- a/vnext/Desktop/packages.config +++ b/vnext/Desktop/packages.config @@ -3,7 +3,7 @@ - + diff --git a/vnext/Folly/Folly.vcxproj b/vnext/Folly/Folly.vcxproj index 94bbe6aec5f..dde84c8ccf3 100644 --- a/vnext/Folly/Folly.vcxproj +++ b/vnext/Folly/Folly.vcxproj @@ -265,14 +265,24 @@ - - + + - + + + + + + diff --git a/vnext/IntegrationTests/React.Windows.IntegrationTests.vcxproj b/vnext/IntegrationTests/React.Windows.IntegrationTests.vcxproj index 60e01fb3e4b..a40a91a143f 100644 --- a/vnext/IntegrationTests/React.Windows.IntegrationTests.vcxproj +++ b/vnext/IntegrationTests/React.Windows.IntegrationTests.vcxproj @@ -29,7 +29,6 @@ {700A84FD-F92A-43F1-8D06-B0E0745DF9B5} StaticLibrary - true StaticLibrary diff --git a/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp b/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp index 6af7596e688..f16c5782dc7 100644 --- a/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp +++ b/vnext/JSI.Desktop.UnitTests/ChakraCoreRuntimeUnitTests.cpp @@ -1,7 +1,7 @@ #include "JsiRuntimeUnitTests.h" -#include "Chakra/ChakraJsiRuntimeArgs.h" -#include "Chakra/ChakraJsiRuntimeFactory.h" +#include "JSI/Shared/ChakraRuntimeArgs.h" +#include "JSI/Shared/ChakraRuntimeFactory.h" #include "MemoryTracker.h" // TODO (yicyao): #2730 Introduces a vcxitem for shared test code and move this @@ -15,10 +15,10 @@ using facebook::jsi::JsiRuntimeUnitTests; using facebook::jsi::Runtime; using facebook::jsi::RuntimeFactory; -using facebook::jsi::chakraruntime::ChakraJsiRuntimeArgs; -using facebook::jsi::chakraruntime::makeChakraJsiRuntime; using facebook::react::CreateMemoryTracker; using facebook::react::MessageQueueThread; +using Microsoft::JSI::ChakraRuntimeArgs; +using Microsoft::JSI::makeChakraRuntime; using Microsoft::React::Test::TestMessageQueueThread; // TODO (yicyao): #2729 We need to add tests for ChakraCoreRuntime specific @@ -26,7 +26,7 @@ using Microsoft::React::Test::TestMessageQueueThread; std::vector runtimeGenerators() { return {[]() -> std::unique_ptr { - ChakraJsiRuntimeArgs args{}; + ChakraRuntimeArgs args{}; args.jsQueue = std::make_shared(); @@ -36,7 +36,7 @@ std::vector runtimeGenerators() { args.memoryTracker = CreateMemoryTracker(std::move(memoryTrackerCallbackQueue)); - return makeChakraJsiRuntime(std::move(args)); + return makeChakraRuntime(std::move(args)); }}; } diff --git a/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj b/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj index 388175c4efd..03e79e94b9d 100644 --- a/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj +++ b/vnext/JSI.Desktop.UnitTests/JSI.Desktop.UnitTests.vcxproj @@ -121,7 +121,7 @@ - + @@ -132,6 +132,6 @@ - + \ No newline at end of file diff --git a/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp b/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp index 0117dde5a01..cedc0aa6a5e 100644 --- a/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp +++ b/vnext/JSI.Desktop.UnitTests/JsiRuntimeUnitTests.cpp @@ -29,7 +29,7 @@ TEST_P(JsiRuntimeUnitTests, RuntimeTest) { } // TODO (yicyao) #2703: Currently, comparison of property IDs is broken for -// ChakraJsiRuntime. Enable this test once we fix it. +// ChakraRuntime. Enable this test once we fix it. TEST_P(JsiRuntimeUnitTests, DISABLED_PropNameIDTest) { // This is a little weird to test, because it doesn't really exist // in JS yet. All I can do is create them, compare them, and @@ -184,7 +184,7 @@ TEST_P(JsiRuntimeUnitTests, ObjectTest) { } // TODO (yicyao): Enable this once host object is implemented for -// ChakraJsiRuntime. +// ChakraRuntime. TEST_P(JsiRuntimeUnitTests, DISABLED_HostObjectTest) { class ConstantHostObject : public HostObject { Value get(Runtime &, const PropNameID &sym) override { diff --git a/vnext/JSI.Desktop.UnitTests/packages.config b/vnext/JSI.Desktop.UnitTests/packages.config index 3b21a6b3a69..7a9052816a8 100644 --- a/vnext/JSI.Desktop.UnitTests/packages.config +++ b/vnext/JSI.Desktop.UnitTests/packages.config @@ -3,7 +3,7 @@ - + \ No newline at end of file diff --git a/vnext/Chakra/ChakraJsiRuntime_core.cpp b/vnext/JSI/Desktop/ChakraJsiRuntime_core.cpp similarity index 82% rename from vnext/Chakra/ChakraJsiRuntime_core.cpp rename to vnext/JSI/Desktop/ChakraJsiRuntime_core.cpp index 3abb96eed9e..b2d85fced47 100644 --- a/vnext/Chakra/ChakraJsiRuntime_core.cpp +++ b/vnext/JSI/Desktop/ChakraJsiRuntime_core.cpp @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "pch.h" - -#include "ChakraJsiRuntime.h" -#include "ChakraJsiRuntimeFactory.h" +#include "ChakraRuntime.h" +#include "ChakraRuntimeFactory.h" #include "unicode.h" #include @@ -14,125 +12,45 @@ #include #include "ChakraCoreDebugger.h" -namespace facebook { -namespace jsi { -namespace chakraruntime { +namespace Microsoft::JSI { + +namespace { -JsWeakRef ChakraJsiRuntime::newWeakObjectRef(const jsi::Object &obj) { +#if !defined(CHAKRACORE_UWP) +// This is very wierd. This should match with the definition of VS_VERSIONINFO +// as defined in +// https://docs.microsoft.com/en-us/windows/desktop/menurc/vs-versioninfo I +// can't find a way to include the actual definition of VS_VERSIONINFO +// TODO :: Re-evaluate this strategy. +struct FileVersionInfoResource { + uint16_t len; + uint16_t valLen; + uint16_t type; + wchar_t key[_countof(L"VS_VERSION_INFO")]; + uint16_t padding1; + VS_FIXEDFILEINFO fixedFileInfo; + uint32_t padding2; +}; +#endif + +} // namespace + +JsWeakRef ChakraRuntime::newWeakObjectRef(const facebook::jsi::Object &obj) { JsWeakRef weakRef; JsCreateWeakReference(objectRef(obj), &weakRef); return weakRef; } -JsValueRef ChakraJsiRuntime::strongObjectRef(const jsi::WeakObject &obj) { +JsValueRef ChakraRuntime::strongObjectRef( + const facebook::jsi::WeakObject &obj) { JsValueRef strongRef; JsGetWeakReferenceValue(objectRef(obj), &strongRef); return strongRef; } -Value ChakraJsiRuntime::evaluateJavaScriptSimple( - const jsi::Buffer &buffer, - const std::string &sourceURL) { - JsValueRef sourceRef; - JsCreateString( - reinterpret_cast(buffer.data()), buffer.size(), &sourceRef); - - JsValueRef sourceURLRef = nullptr; - JsCreateString( - reinterpret_cast(sourceURL.c_str()), - sourceURL.size(), - &sourceURLRef); - - JsValueRef result; - checkException( - JsRun( - sourceRef, - 0, - sourceURLRef, - JsParseScriptAttributes::JsParseScriptAttributeNone, - &result), - sourceURL.c_str()); - - return createValue(result); -} - -// TODO :: Return result -bool ChakraJsiRuntime::evaluateSerializedScript( - const jsi::Buffer &scriptBuffer, - const jsi::Buffer &serializedScriptBuffer, - const std::string &sourceURL) { - JsValueRef bytecodeArrayBuffer = nullptr; - if (JsCreateExternalArrayBuffer( - const_cast(serializedScriptBuffer.data()), - static_cast(serializedScriptBuffer.size()), - nullptr, - nullptr, - &bytecodeArrayBuffer) == JsNoError) { - JsValueRef sourceURLRef = nullptr; - if (!sourceURL.empty()) { - sourceURLRef = createJSString( - reinterpret_cast(sourceURL.c_str()), sourceURL.size()); - } - - JsValueRef value = nullptr; - JsErrorCode result = JsRunSerialized( - bytecodeArrayBuffer, - [](JsSourceContext sourceContext, - JsValueRef *value, - JsParseScriptAttributes *parseAttributes) { - const jsi::Buffer *scriptSource = - reinterpret_cast(sourceContext); - if (JsCreateExternalArrayBuffer( - const_cast(scriptSource->data()), - static_cast(scriptSource->size()), - nullptr, - nullptr, - value) != JsNoError) - std::terminate(); - - *parseAttributes = JsParseScriptAttributeNone; - return true; - }, - reinterpret_cast(m_pinnedScripts.back().get()), - sourceURLRef, - &value); - - if (result == JsNoError) { - return true; - } else if (result == JsErrorBadSerializedScript) { - return false; - } else { - checkException(result); - } - } - - return false; -} - -std::unique_ptr ChakraJsiRuntime::generatePreparedScript( - const std::string &sourceURL, - const jsi::Buffer &sourceBuffer) noexcept { - const std::wstring scriptUTF16 = facebook::react::unicode::utf8ToUtf16( - reinterpret_cast(sourceBuffer.data()), sourceBuffer.size()); - - unsigned int bytecodeSize = 0; - if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) == - JsNoError) { - std::unique_ptr bytecodeBuffer( - std::make_unique(bytecodeSize)); - if (JsSerializeScript( - scriptUTF16.c_str(), bytecodeBuffer->data(), &bytecodeSize) == - JsNoError) { - return bytecodeBuffer; - } - } - - return nullptr; -} - // Note :: ChakraCore header provides an API which takes 8-bit string .. which // is not available in edge mode. -JsValueRef ChakraJsiRuntime::createJSString(const char *data, size_t length) { +JsValueRef ChakraRuntime::createJSString(const char *data, size_t length) { JsValueRef value; JsCreateString(reinterpret_cast(data), length, &value); return value; @@ -140,9 +58,7 @@ JsValueRef ChakraJsiRuntime::createJSString(const char *data, size_t length) { // Note :: ChakraCore header provides an API which takes 8-bit string .. which // is not available in edge mode. -JsValueRef ChakraJsiRuntime::createJSPropertyId( - const char *data, - size_t length) { +JsValueRef ChakraRuntime::createJSPropertyId(const char *data, size_t length) { JsValueRef propIdRef; if (JsNoError != JsCreatePropertyId(data, length, &propIdRef)) std::terminate(); @@ -150,23 +66,23 @@ JsValueRef ChakraJsiRuntime::createJSPropertyId( } // ES6 Promise callback -void CALLBACK ChakraJsiRuntime::PromiseContinuationCallback( +void CALLBACK ChakraRuntime::PromiseContinuationCallback( JsValueRef funcRef, void *callbackState) noexcept { - ChakraJsiRuntime *runtime = static_cast(callbackState); + ChakraRuntime *runtime = static_cast(callbackState); runtime->PromiseContinuation(funcRef); } -void CALLBACK ChakraJsiRuntime::PromiseRejectionTrackerCallback( +void CALLBACK ChakraRuntime::PromiseRejectionTrackerCallback( JsValueRef promise, JsValueRef reason, bool handled, void *callbackState) { - ChakraJsiRuntime *runtime = static_cast(callbackState); + ChakraRuntime *runtime = static_cast(callbackState); runtime->PromiseRejectionTracker(promise, reason, handled); } -void ChakraJsiRuntime::PromiseContinuation(JsValueRef funcRef) noexcept { +void ChakraRuntime::PromiseContinuation(JsValueRef funcRef) noexcept { if (runtimeArgs().jsQueue) { JsAddRef(funcRef, nullptr); runtimeArgs().jsQueue->runOnQueue([this, funcRef]() { @@ -178,7 +94,7 @@ void ChakraJsiRuntime::PromiseContinuation(JsValueRef funcRef) noexcept { } } -void ChakraJsiRuntime::PromiseRejectionTracker( +void ChakraRuntime::PromiseRejectionTracker( JsValueRef /*promise*/, JsValueRef reason, bool handled) { @@ -210,81 +126,67 @@ void ChakraJsiRuntime::PromiseRejectionTracker( } std::string errorString = errorStream.str(); - throw jsi::JSError( + throw facebook::jsi::JSError( *this, createStringFromAscii(errorString.c_str(), errorString.length())); } } -void ChakraJsiRuntime::setupNativePromiseContinuation() noexcept { +void ChakraRuntime::setupNativePromiseContinuation() noexcept { if (runtimeArgs().enableNativePromiseSupport) { JsSetPromiseContinuationCallback(PromiseContinuationCallback, this); JsSetHostPromiseRejectionTracker(PromiseRejectionTrackerCallback, this); } } -#if !defined(CHAKRACORE_UWP) -// This is very wierd. This should match with the definition of VS_VERSIONINFO -// as defined in -// https://docs.microsoft.com/en-us/windows/desktop/menurc/vs-versioninfo I -// can't find a way to include the actual definition of VS_VERSIONINFO -// TODO :: Re-evaluate this strategy. -struct FileVersionInfoResource { - uint16_t len; - uint16_t valLen; - uint16_t type; - wchar_t key[_countof(L"VS_VERSION_INFO")]; - uint16_t padding1; - VS_FIXEDFILEINFO fixedFileInfo; - uint32_t padding2; -}; -#endif - -// TODO :: This code is mostly copied from the old ChakraExecutor flow, and not -// verified for reliability yet. -// TODO :: Re-evaluate this strategy of finding the dll version for versioning -// the runtime. -/*static*/ void ChakraJsiRuntime::initRuntimeVersion() noexcept { - // This code is win32 only at the moment. We will need to change this - // line if we want to support UWP. -#if !defined(CHAKRACORE_UWP) - constexpr wchar_t chakraDllName[] = L"ChakraCore.dll"; +void ChakraRuntime::startDebuggingIfNeeded() { + auto &args = runtimeArgs(); + if (args.enableDebugging) { + auto port = + args.debuggerPort == 0 ? DebuggerDefaultPort : args.debuggerPort; + auto runtimeName = args.debuggerRuntimeName.empty() + ? DebuggerDefaultRuntimeName + : args.debuggerRuntimeName; - auto freeLibraryWrapper = [](void *p) { FreeLibrary((HMODULE)p); }; - HMODULE moduleHandle; - if (!GetModuleHandleExW(0, chakraDllName, &moduleHandle)) - return; + JsErrorCode result = enableDebugging( + m_runtime, + runtimeName, + args.debuggerBreakOnNextLine, + static_cast(port), + m_debugProtocolHandler, + m_debugService); - std::unique_ptr moduleHandleWrapper{ - moduleHandle, std::move(freeLibraryWrapper)}; + if (result == JsNoError) { + m_debugPort = port; + m_debugRuntimeName = runtimeName; + } + } - HRSRC versionResourceHandle = - FindResourceW(moduleHandle, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION); + if (args.debuggerBreakOnNextLine && m_debugProtocolHandler) { + if (args.loggingCallback) + args.loggingCallback( + "Waiting for debugger to connect...", LogLevel::Info); - if (!versionResourceHandle || - SizeofResource( - static_cast(moduleHandleWrapper.get()), - versionResourceHandle) < sizeof(FileVersionInfoResource)) - return; + m_debugProtocolHandler->WaitForDebugger(); - HGLOBAL versionResourcePtrHandle = - LoadResource(moduleHandle, versionResourceHandle); - if (!versionResourcePtrHandle) - return; + if (args.loggingCallback) + args.loggingCallback("Debugger connected", LogLevel::Info); + } +} - FileVersionInfoResource *chakraVersionInfo = - static_cast( - LockResource(versionResourcePtrHandle)); - if (!chakraVersionInfo) - return; +void ChakraRuntime::stopDebuggingIfNeeded() { + if (m_debugService) { + JsErrorCode result = m_debugService->Close(); - s_runtimeVersion = chakraVersionInfo->fixedFileInfo.dwFileVersionMS; - s_runtimeVersion <<= 32; - s_runtimeVersion |= chakraVersionInfo->fixedFileInfo.dwFileVersionLS; -#endif + if (result == JsNoError) { + result = m_debugService->UnregisterHandler(m_debugRuntimeName); + } + } + m_debugService = nullptr; + m_debugProtocolHandler = nullptr; } -JsErrorCode ChakraJsiRuntime::enableDebugging( +JsErrorCode ChakraRuntime::enableDebugging( JsRuntimeHandle runtime, std::string const &runtimeName, bool breakOnNextLine, @@ -313,7 +215,7 @@ JsErrorCode ChakraJsiRuntime::enableDebugging( (std::string("Listening on ws://127.0.0.1:") + std::to_string(port) + "/" + runtimeName) .c_str(), - facebook::jsi::chakraruntime::LogLevel::Info); + LogLevel::Info); } if (result == JsNoError) { @@ -324,17 +226,7 @@ JsErrorCode ChakraJsiRuntime::enableDebugging( return result; } -/* static */ void ChakraJsiRuntime::ProcessDebuggerCommandQueueCallback( - void *callbackState) { - ChakraJsiRuntime *runtime = - reinterpret_cast(callbackState); - - if (runtime) { - runtime->ProcessDebuggerCommandQueue(); - } -} - -void ChakraJsiRuntime::ProcessDebuggerCommandQueue() { +void ChakraRuntime::ProcessDebuggerCommandQueue() { if (runtimeArgs().jsQueue) { runtimeArgs().jsQueue->runOnQueue([this]() { if (m_debugProtocolHandler) { @@ -344,57 +236,160 @@ void ChakraJsiRuntime::ProcessDebuggerCommandQueue() { } } -void ChakraJsiRuntime::startDebuggingIfNeeded() { - auto &args = runtimeArgs(); - if (args.enableDebugging) { - auto port = - args.debuggerPort == 0 ? DebuggerDefaultPort : args.debuggerPort; - auto runtimeName = args.debuggerRuntimeName.empty() - ? DebuggerDefaultRuntimeName - : args.debuggerRuntimeName; +/* static */ void ChakraRuntime::ProcessDebuggerCommandQueueCallback( + void *callbackState) { + ChakraRuntime *runtime = reinterpret_cast(callbackState); - JsErrorCode result = enableDebugging( - m_runtime, - runtimeName, - args.debuggerBreakOnNextLine, - static_cast(port), - m_debugProtocolHandler, - m_debugService); + if (runtime) { + runtime->ProcessDebuggerCommandQueue(); + } +} - if (result == JsNoError) { - m_debugPort = port; - m_debugRuntimeName = runtimeName; +// TODO :: This code is mostly copied from the old ChakraExecutor flow, and not +// verified for reliability yet. +// TODO :: Re-evaluate this strategy of finding the dll version for versioning +// the runtime. +/*static*/ void ChakraRuntime::initRuntimeVersion() noexcept { + // This code is win32 only at the moment. We will need to change this + // line if we want to support UWP. +#if !defined(CHAKRACORE_UWP) + constexpr wchar_t chakraDllName[] = L"ChakraCore.dll"; + + auto freeLibraryWrapper = [](void *p) { FreeLibrary((HMODULE)p); }; + HMODULE moduleHandle; + if (!GetModuleHandleExW(0, chakraDllName, &moduleHandle)) + return; + + std::unique_ptr moduleHandleWrapper{ + moduleHandle, std::move(freeLibraryWrapper)}; + + HRSRC versionResourceHandle = + FindResourceW(moduleHandle, MAKEINTRESOURCE(VS_VERSION_INFO), RT_VERSION); + + if (!versionResourceHandle || + SizeofResource( + static_cast(moduleHandleWrapper.get()), + versionResourceHandle) < sizeof(FileVersionInfoResource)) + return; + + HGLOBAL versionResourcePtrHandle = + LoadResource(moduleHandle, versionResourceHandle); + if (!versionResourcePtrHandle) + return; + + FileVersionInfoResource *chakraVersionInfo = + static_cast( + LockResource(versionResourcePtrHandle)); + if (!chakraVersionInfo) + return; + + s_runtimeVersion = chakraVersionInfo->fixedFileInfo.dwFileVersionMS; + s_runtimeVersion <<= 32; + s_runtimeVersion |= chakraVersionInfo->fixedFileInfo.dwFileVersionLS; +#endif +} + +std::unique_ptr +ChakraRuntime::generatePreparedScript( + const std::string &sourceURL, + const facebook::jsi::Buffer &sourceBuffer) noexcept { + const std::wstring scriptUTF16 = facebook::react::unicode::utf8ToUtf16( + reinterpret_cast(sourceBuffer.data()), sourceBuffer.size()); + + unsigned int bytecodeSize = 0; + if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) == + JsNoError) { + std::unique_ptr bytecodeBuffer( + std::make_unique(bytecodeSize)); + if (JsSerializeScript( + scriptUTF16.c_str(), bytecodeBuffer->data(), &bytecodeSize) == + JsNoError) { + return bytecodeBuffer; } } - if (args.debuggerBreakOnNextLine && m_debugProtocolHandler) { - if (args.loggingCallback) - args.loggingCallback( - "Waiting for debugger to connect...", - facebook::jsi::chakraruntime::LogLevel::Info); + return nullptr; +} - m_debugProtocolHandler->WaitForDebugger(); +facebook::jsi::Value ChakraRuntime::evaluateJavaScriptSimple( + const facebook::jsi::Buffer &buffer, + const std::string &sourceURL) { + JsValueRef sourceRef; + JsCreateString( + reinterpret_cast(buffer.data()), buffer.size(), &sourceRef); - if (args.loggingCallback) - args.loggingCallback( - "Debugger connected", facebook::jsi::chakraruntime::LogLevel::Info); - } + JsValueRef sourceURLRef = nullptr; + JsCreateString( + reinterpret_cast(sourceURL.c_str()), + sourceURL.size(), + &sourceURLRef); + + JsValueRef result; + checkException( + JsRun( + sourceRef, + 0, + sourceURLRef, + JsParseScriptAttributes::JsParseScriptAttributeNone, + &result), + sourceURL.c_str()); + + return createValue(result); } -void ChakraJsiRuntime::stopDebuggingIfNeeded() { - if (m_debugService) { - JsErrorCode result = m_debugService->Close(); +// TODO :: Return result +bool ChakraRuntime::evaluateSerializedScript( + const facebook::jsi::Buffer &scriptBuffer, + const facebook::jsi::Buffer &serializedScriptBuffer, + const std::string &sourceURL) { + JsValueRef bytecodeArrayBuffer = nullptr; + if (JsCreateExternalArrayBuffer( + const_cast(serializedScriptBuffer.data()), + static_cast(serializedScriptBuffer.size()), + nullptr, + nullptr, + &bytecodeArrayBuffer) == JsNoError) { + JsValueRef sourceURLRef = nullptr; + if (!sourceURL.empty()) { + sourceURLRef = createJSString( + reinterpret_cast(sourceURL.c_str()), sourceURL.size()); + } + + JsValueRef value = nullptr; + JsErrorCode result = JsRunSerialized( + bytecodeArrayBuffer, + [](JsSourceContext sourceContext, + JsValueRef *value, + JsParseScriptAttributes *parseAttributes) { + const facebook::jsi::Buffer *scriptSource = + reinterpret_cast(sourceContext); + if (JsCreateExternalArrayBuffer( + const_cast(scriptSource->data()), + static_cast(scriptSource->size()), + nullptr, + nullptr, + value) != JsNoError) + std::terminate(); + + *parseAttributes = JsParseScriptAttributeNone; + return true; + }, + reinterpret_cast(m_pinnedScripts.back().get()), + sourceURLRef, + &value); if (result == JsNoError) { - result = m_debugService->UnregisterHandler(m_debugRuntimeName); + return true; + } else if (result == JsErrorBadSerializedScript) { + return false; + } else { + checkException(result); } } - m_debugService = nullptr; - m_debugProtocolHandler = nullptr; + + return false; } -} // namespace chakraruntime -} // namespace jsi -} // namespace facebook +} // namespace Microsoft::JSI #endif diff --git a/vnext/JSI/Desktop/JSI.Desktop.vcxproj b/vnext/JSI/Desktop/JSI.Desktop.vcxproj new file mode 100644 index 00000000000..c0343c1244e --- /dev/null +++ b/vnext/JSI/Desktop/JSI.Desktop.vcxproj @@ -0,0 +1,88 @@ + + + + + Debug + x64 + + + Release + x64 + + + Debug + Win32 + + + Release + Win32 + + + + {17DD1B17-3094-40DD-9373-AC2497932ECA} + JSI.Desktop + + + + + StaticLibrary + + + + + + + + + + + + + + + + $(ReactNativeDir)\ReactCommon;$(ReactNativeDir)\ReactCommon\jsi;$(ReactNativeWindowsDir)Chakra;$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(IncludePath) + true + + + + NotUsing + CHAKRACORE_UWP;%(PreprocessorDefinitions) + CHAKRACORE;%(PreprocessorDefinitions) + + %(AdditionalOptions) /Zc:strictStrings + $(ChakraCoreInclude);$(ChakraCoreDebugInclude);%(AdditionalIncludeDirectories) + + + ChakraCore.Debugger.Protocol.lib;ChakraCore.Debugger.ProtocolHandler.lib;ChakraCore.Debugger.Service.lib;ChakraCore.lib;%(AdditionalDependencies) + $(ChakraCoreLibDir);$(ChakraCoreDebugLibDir) + + + + + Disabled + + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/vnext/JSI/Desktop/JSI.Desktop.vcxproj.filters b/vnext/JSI/Desktop/JSI.Desktop.vcxproj.filters new file mode 100644 index 00000000000..9c283021b8e --- /dev/null +++ b/vnext/JSI/Desktop/JSI.Desktop.vcxproj.filters @@ -0,0 +1,19 @@ + + + + + + + + {72a602dc-c83d-4280-ae55-d9a36a865a1d} + + + {ade98a5d-cda0-4794-a7e9-9b60b83966f8} + + + + + Source Files + + + \ No newline at end of file diff --git a/vnext/JSI/Desktop/packages.config b/vnext/JSI/Desktop/packages.config new file mode 100644 index 00000000000..6f5a13cf96e --- /dev/null +++ b/vnext/JSI/Desktop/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/vnext/JSI/Shared/ByteArrayBuffer.h b/vnext/JSI/Shared/ByteArrayBuffer.h new file mode 100644 index 00000000000..50a22f8d9bf --- /dev/null +++ b/vnext/JSI/Shared/ByteArrayBuffer.h @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#pragma once + +#include +#include "jsi/jsi.h" + +namespace Microsoft::JSI { + +class ByteArrayBuffer final : public facebook::jsi::Buffer { + public: + ByteArrayBuffer(size_t bufferSize) + : m_size(bufferSize), m_data(std::make_unique(bufferSize)) {} + + ByteArrayBuffer(const ByteArrayBuffer &) = delete; + ByteArrayBuffer &operator=(const ByteArrayBuffer &) = delete; + + ByteArrayBuffer(ByteArrayBuffer &&) = default; + ByteArrayBuffer &operator=(ByteArrayBuffer &&) = default; + + size_t size() const override { + return m_size; + } + + const uint8_t *data() const { + return m_data.get(); + } + + uint8_t *data() { + return m_data.get(); + } + + private: + size_t m_size; + std::unique_ptr m_data; +}; + +} // namespace Microsoft::JSI diff --git a/vnext/Chakra/ChakraJsiRuntime.cpp b/vnext/JSI/Shared/ChakraRuntime.cpp similarity index 63% rename from vnext/Chakra/ChakraJsiRuntime.cpp rename to vnext/JSI/Shared/ChakraRuntime.cpp index 8a65ee361f8..1c349953aa5 100644 --- a/vnext/Chakra/ChakraJsiRuntime.cpp +++ b/vnext/JSI/Shared/ChakraRuntime.cpp @@ -1,10 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "pch.h" - -#include "ChakraJsiRuntime.h" -#include "ChakraJsiRuntimeArgs.h" +#include "ChakraRuntime.h" +#include "ChakraRuntimeArgs.h" #include #include @@ -17,14 +15,69 @@ using namespace facebook::react; -namespace facebook { -namespace jsi { -namespace chakraruntime { +namespace Microsoft::JSI { + +namespace { + +class HostFunctionProxy { + public: + HostFunctionProxy( + facebook::jsi::HostFunctionType hostFunction, + ChakraRuntime &runtime) + : m_hostFunction(hostFunction), m_runtime(runtime) {} + + inline const facebook::jsi::HostFunctionType &getHostFunction() const { + return m_hostFunction; + } + + inline ChakraRuntime &getRuntime() const { + return m_runtime; + } + + private: + const facebook::jsi::HostFunctionType m_hostFunction; + ChakraRuntime &m_runtime; +}; + +class ArgsConverterForCall { + public: + ArgsConverterForCall( + ChakraRuntime &rt, + JsValueRef thisObj, + const facebook::jsi::Value *args, + size_t count) { + JsValueRef *destination = inline_; + if (count + 1 > maxStackArgs) { + outOfLine_ = std::make_unique(count + 1); + destination = outOfLine_.get(); + } + + if (thisObj == nullptr) { + JsValueRef undefinedValue; + JsGetUndefinedValue(&undefinedValue); + destination[0] = undefinedValue; + } else { + destination[0] = thisObj; + } + + for (size_t i = 0; i < count; ++i) { + destination[i + 1] = rt.valueRef(args[i]); + } + } + + operator JsValueRef *() { + return outOfLine_ ? outOfLine_.get() : inline_; + } + + private: + constexpr static unsigned maxStackArgs = 8; + JsValueRef inline_[maxStackArgs]; + std::unique_ptr outOfLine_; +}; -/*static*/ std::once_flag ChakraJsiRuntime::s_runtimeVersionInitFlag; -/*static*/ uint64_t ChakraJsiRuntime::s_runtimeVersion = 0; +} // namespace -ChakraJsiRuntime::ChakraJsiRuntime(ChakraJsiRuntimeArgs &&args) noexcept +ChakraRuntime::ChakraRuntime(ChakraRuntimeArgs &&args) noexcept : m_args{std::move(args)} { JsRuntimeAttributes runtimeAttributes = JsRuntimeAttributeNone; @@ -55,7 +108,7 @@ ChakraJsiRuntime::ChakraJsiRuntime(ChakraJsiRuntimeArgs &&args) noexcept std::call_once(s_runtimeVersionInitFlag, initRuntimeVersion); } -ChakraJsiRuntime::~ChakraJsiRuntime() noexcept { +ChakraRuntime::~ChakraRuntime() noexcept { stopDebuggingIfNeeded(); JsSetCurrentContext(JS_INVALID_REFERENCE); @@ -66,55 +119,22 @@ ChakraJsiRuntime::~ChakraJsiRuntime() noexcept { JsDisposeRuntime(m_runtime); } -void ChakraJsiRuntime::setupMemoryTracker() noexcept { - if (runtimeArgs().memoryTracker) { - size_t initialMemoryUsage = 0; - JsGetRuntimeMemoryUsage(m_runtime, &initialMemoryUsage); - runtimeArgs().memoryTracker->Initialize(initialMemoryUsage); - - if (runtimeArgs().runtimeMemoryLimit > 0) - JsSetRuntimeMemoryLimit(m_runtime, runtimeArgs().runtimeMemoryLimit); - - JsSetRuntimeMemoryAllocationCallback( - m_runtime, - runtimeArgs().memoryTracker.get(), - [](void *callbackState, - JsMemoryEventType allocationEvent, - size_t allocationSize) -> bool { - auto memoryTrackerPtr = static_cast(callbackState); - switch (allocationEvent) { - case JsMemoryAllocate: - memoryTrackerPtr->OnAllocation(allocationSize); - break; - - case JsMemoryFree: - memoryTrackerPtr->OnDeallocation(allocationSize); - break; - - case JsMemoryFailure: - default: - break; - } - - return true; - }); - } -} +#pragma region Functions_inherited_from_Runtime -jsi::Value ChakraJsiRuntime::evaluateJavaScript( - const std::shared_ptr &buffer, +facebook::jsi::Value ChakraRuntime::evaluateJavaScript( + const std::shared_ptr &buffer, const std::string &sourceURL) { // Simple evaluate if scriptStore not available as it's risky to utilize the // byte codes without checking the script version. if (!runtimeArgs().scriptStore) { if (!buffer) - throw JSINativeException("Script buffer is empty!"); + throw facebook::jsi::JSINativeException("Script buffer is empty!"); evaluateJavaScriptSimple(*buffer, sourceURL); - return jsi::Value::undefined(); + return facebook::jsi::Value::undefined(); } uint64_t scriptVersion = 0; - std::shared_ptr scriptBuffer; + std::shared_ptr scriptBuffer; if (buffer) { scriptBuffer = std::move(buffer); @@ -127,29 +147,29 @@ jsi::Value ChakraJsiRuntime::evaluateJavaScript( } if (!scriptBuffer) { - throw JSINativeException("Script buffer is empty!"); + throw facebook::jsi::JSINativeException("Script buffer is empty!"); } // Simple evaluate if script version can't be computed. if (scriptVersion == 0) { evaluateJavaScriptSimple(*scriptBuffer, sourceURL); - return jsi::Value::undefined(); + return facebook::jsi::Value::undefined(); } auto sharedScriptBuffer = - std::shared_ptr(std::move(scriptBuffer)); + std::shared_ptr(std::move(scriptBuffer)); - jsi::ScriptSignature scriptSignature = {sourceURL, scriptVersion}; - jsi::JSRuntimeSignature runtimeSignature = {s_runtimeType, - getRuntimeVersion()}; + facebook::jsi::ScriptSignature scriptSignature = {sourceURL, scriptVersion}; + facebook::jsi::JSRuntimeSignature runtimeSignature = {description().c_str(), + getRuntimeVersion()}; auto preparedScript = runtimeArgs().preparedScriptStore->tryGetPreparedScript( scriptSignature, runtimeSignature, nullptr); - std::shared_ptr sharedPreparedScript; + std::shared_ptr sharedPreparedScript; if (preparedScript) { sharedPreparedScript = - std::shared_ptr(std::move(preparedScript)); + std::shared_ptr(std::move(preparedScript)); } else { auto genPreparedScript = generatePreparedScript(sourceURL, *sharedScriptBuffer); @@ -158,8 +178,8 @@ jsi::Value ChakraJsiRuntime::evaluateJavaScript( // wrong. but we should get rid of this abort before // shipping. - sharedPreparedScript = - std::shared_ptr(std::move(genPreparedScript)); + sharedPreparedScript = std::shared_ptr( + std::move(genPreparedScript)); runtimeArgs().preparedScriptStore->persistPreparedScript( sharedPreparedScript, scriptSignature, runtimeSignature, nullptr); } @@ -174,7 +194,7 @@ jsi::Value ChakraJsiRuntime::evaluateJavaScript( if (evaluateSerializedScript( *sharedScriptBuffer, *sharedPreparedScript, sourceURL)) { - return jsi::Value::undefined(); + return facebook::jsi::Value::undefined(); } // If we reach here, fall back to simple evaluation. @@ -182,89 +202,38 @@ jsi::Value ChakraJsiRuntime::evaluateJavaScript( } std::shared_ptr -ChakraJsiRuntime::prepareJavaScript( +ChakraRuntime::prepareJavaScript( const std::shared_ptr &, std::string) { - throw JSINativeException("Not implemented!"); + throw facebook::jsi::JSINativeException("Not implemented!"); } -facebook::jsi::Value ChakraJsiRuntime::evaluatePreparedJavaScript( +facebook::jsi::Value ChakraRuntime::evaluatePreparedJavaScript( const std::shared_ptr &) { - throw JSINativeException("Not implemented!"); + throw facebook::jsi::JSINativeException("Not implemented!"); } -jsi::Object ChakraJsiRuntime::global() { +facebook::jsi::Object ChakraRuntime::global() { JsValueRef value; JsGetGlobalObject(&value); return createObject(value); } -std::string ChakraJsiRuntime::description() { - if (m_desc.empty()) { - m_desc = std::string(""); - } - return m_desc; +std::string ChakraRuntime::description() { + return "ChakraRuntime"; } -bool ChakraJsiRuntime::isInspectable() { +bool ChakraRuntime::isInspectable() { return false; } -ChakraJsiRuntime::ChakraPropertyIdValue::~ChakraPropertyIdValue() { - JsRelease(m_propId, nullptr); -} - -void ChakraJsiRuntime::ChakraPropertyIdValue::invalidate() { - delete this; -} - -ChakraJsiRuntime::ChakraPropertyIdValue::ChakraPropertyIdValue( - JsPropertyIdRef propIdRef) - : m_propId(propIdRef) { - JsAddRef(propIdRef, nullptr); -} - -ChakraJsiRuntime::ChakraStringValue::ChakraStringValue(JsValueRef str) - : m_str(str) { - JsAddRef(str, nullptr); -} - -void ChakraJsiRuntime::ChakraStringValue::invalidate() { - delete this; -} - -ChakraJsiRuntime::ChakraStringValue::~ChakraStringValue() { - JsRelease(m_str, nullptr); -} - -ChakraJsiRuntime::ChakraObjectValue::ChakraObjectValue(JsValueRef obj) - : m_obj(obj) { - JsAddRef(m_obj, nullptr); -} - -void ChakraJsiRuntime::ChakraObjectValue::invalidate() { - delete this; -} - -ChakraJsiRuntime::ChakraObjectValue::~ChakraObjectValue() { - JsRelease(m_obj, nullptr); -} - -ChakraJsiRuntime::ChakraWeakRefValue::ChakraWeakRefValue(JsWeakRef obj) - : m_obj(obj) { - JsAddRef(m_obj, nullptr); -} - -void ChakraJsiRuntime::ChakraWeakRefValue::invalidate() { - delete this; -} - -ChakraJsiRuntime::ChakraWeakRefValue::~ChakraWeakRefValue() { - JsRelease(m_obj, nullptr); +facebook::jsi::Runtime::PointerValue *ChakraRuntime::cloneSymbol( + const facebook::jsi::Runtime::PointerValue *) { + throw facebook::jsi::JSINativeException("Not implemented!"); } -jsi::Runtime::PointerValue *ChakraJsiRuntime::cloneString( - const jsi::Runtime::PointerValue *pv) { +facebook::jsi::Runtime::PointerValue *ChakraRuntime::cloneString( + const facebook::jsi::Runtime::PointerValue *pv) { if (!pv) { return nullptr; } @@ -272,8 +241,8 @@ jsi::Runtime::PointerValue *ChakraJsiRuntime::cloneString( return makeStringValue(string->m_str); } -jsi::Runtime::PointerValue *ChakraJsiRuntime::cloneObject( - const jsi::Runtime::PointerValue *pv) { +facebook::jsi::Runtime::PointerValue *ChakraRuntime::cloneObject( + const facebook::jsi::Runtime::PointerValue *pv) { if (!pv) { return nullptr; } @@ -282,8 +251,8 @@ jsi::Runtime::PointerValue *ChakraJsiRuntime::cloneObject( return makeObjectValue(object->m_obj); } -jsi::Runtime::PointerValue *ChakraJsiRuntime::clonePropNameID( - const jsi::Runtime::PointerValue *pv) { +facebook::jsi::Runtime::PointerValue *ChakraRuntime::clonePropNameID( + const facebook::jsi::Runtime::PointerValue *pv) { if (!pv) { return nullptr; } @@ -293,16 +262,7 @@ jsi::Runtime::PointerValue *ChakraJsiRuntime::clonePropNameID( return makePropertyIdValue(propId->m_propId); } -facebook::jsi::Runtime::PointerValue *ChakraJsiRuntime::cloneSymbol( - const facebook::jsi::Runtime::PointerValue *) { - throw JSINativeException("Not implemented!"); -} - -std::string ChakraJsiRuntime::symbolToString(const facebook::jsi::Symbol &) { - throw JSINativeException("Not implemented!"); -} - -jsi::PropNameID ChakraJsiRuntime::createPropNameIDFromAscii( +facebook::jsi::PropNameID ChakraRuntime::createPropNameIDFromAscii( const char *str, size_t length) { JsValueRef propIdRef = createJSPropertyId(str, length); @@ -311,7 +271,7 @@ jsi::PropNameID ChakraJsiRuntime::createPropNameIDFromAscii( return res; } -jsi::PropNameID ChakraJsiRuntime::createPropNameIDFromUtf8( +facebook::jsi::PropNameID ChakraRuntime::createPropNameIDFromUtf8( const uint8_t *utf8, size_t length) { JsValueRef prpoIdRef = @@ -321,29 +281,33 @@ jsi::PropNameID ChakraJsiRuntime::createPropNameIDFromUtf8( return res; } -jsi::PropNameID ChakraJsiRuntime::createPropNameIDFromString( - const jsi::String &str) { +facebook::jsi::PropNameID ChakraRuntime::createPropNameIDFromString( + const facebook::jsi::String &str) { std::string propNameString = JSStringToSTLString(stringRef(str)); return createPropNameIDFromUtf8( reinterpret_cast(propNameString.c_str()), propNameString.length()); } -std::string ChakraJsiRuntime::utf8(const jsi::PropNameID &sym) { +std::string ChakraRuntime::utf8(const facebook::jsi::PropNameID &sym) { const wchar_t *name; checkException(JsGetPropertyNameFromId(propIdRef(sym), &name)); return facebook::react::unicode::utf16ToUtf8(name, wcslen(name)); } -bool ChakraJsiRuntime::compare( - const jsi::PropNameID &a, - const jsi::PropNameID &b) { +bool ChakraRuntime::compare( + const facebook::jsi::PropNameID &a, + const facebook::jsi::PropNameID &b) { bool result; JsEquals(propIdRef(a), propIdRef(b), &result); return result; } -jsi::String ChakraJsiRuntime::createStringFromAscii( +std::string ChakraRuntime::symbolToString(const facebook::jsi::Symbol &) { + throw facebook::jsi::JSINativeException("Not implemented!"); +} + +facebook::jsi::String ChakraRuntime::createStringFromAscii( const char *str, size_t length) { // Yes we end up double casting for semantic reasons (UTF8 contains ASCII, @@ -352,7 +316,7 @@ jsi::String ChakraJsiRuntime::createStringFromAscii( reinterpret_cast(str), length); } -jsi::String ChakraJsiRuntime::createStringFromUtf8( +facebook::jsi::String ChakraRuntime::createStringFromUtf8( const uint8_t *str, size_t length) { JsValueRef stringRef = @@ -360,24 +324,53 @@ jsi::String ChakraJsiRuntime::createStringFromUtf8( return createString(stringRef); } -std::string ChakraJsiRuntime::utf8(const jsi::String &str) { +std::string ChakraRuntime::utf8(const facebook::jsi::String &str) { return JSStringToSTLString(stringRef(str)); } -jsi::Object ChakraJsiRuntime::createObject() { +facebook::jsi::Object ChakraRuntime::createObject() { return createObject(static_cast(nullptr)); } -jsi::Object ChakraJsiRuntime::createObject( - std::shared_ptr hostObject) { - jsi::Object proxyTarget = ObjectWithExternalData::create( - *this, new HostObjectProxy(*this, hostObject)); +facebook::jsi::Object ChakraRuntime::createObject( + std::shared_ptr hostObject) { + facebook::jsi::Object proxyTarget = + ObjectWithExternalData::create( + *this, new HostObjectProxy(*this, hostObject)); return createProxy(std::move(proxyTarget), createHostObjectProxyHandler()); } -jsi::Value ChakraJsiRuntime::getProperty( - const jsi::Object &obj, - const jsi::String &name) { +std::shared_ptr ChakraRuntime::getHostObject( + const facebook::jsi::Object &obj) { + if (!isHostObject(obj)) + return nullptr; + + facebook::jsi::Value value = obj.getProperty( + const_cast(*this), s_proxyGetHostObjectTargetPropName); + if (!value.isObject()) + std::terminate(); + facebook::jsi::Object valueObj = + value.getObject(const_cast(*this)); + + ObjectWithExternalData extObject = + ObjectWithExternalData::fromExisting( + *this, std::move(valueObj)); + HostObjectProxy *externalData = extObject.getExternalData(); + + if (!externalData) + std::terminate(); + return externalData->getHostObject(); +} + +facebook::jsi::HostFunctionType &ChakraRuntime::getHostFunction( + const facebook::jsi::Function &obj) { + throw std::runtime_error( + "ChakraRuntime::getHostFunction is not implemented."); +} + +facebook::jsi::Value ChakraRuntime::getProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::String &name) { JsValueRef objRef = objectRef(obj); std::wstring propName = JSStringToSTLWString(stringRef(name)); @@ -389,9 +382,9 @@ jsi::Value ChakraJsiRuntime::getProperty( return createValue(value); } -jsi::Value ChakraJsiRuntime::getProperty( - const jsi::Object &obj, - const jsi::PropNameID &name) { +facebook::jsi::Value ChakraRuntime::getProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::PropNameID &name) { JsValueRef objRef = objectRef(obj); JsValueRef exc = nullptr; JsValueRef res; @@ -399,9 +392,9 @@ jsi::Value ChakraJsiRuntime::getProperty( return createValue(res); } -bool ChakraJsiRuntime::hasProperty( - const jsi::Object &obj, - const jsi::String &name) { +bool ChakraRuntime::hasProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::String &name) { std::wstring propName = JSStringToSTLWString(stringRef(name)); JsPropertyIdRef propId = JS_INVALID_REFERENCE; @@ -412,26 +405,26 @@ bool ChakraJsiRuntime::hasProperty( return hasProperty; } -bool ChakraJsiRuntime::hasProperty( - const jsi::Object &obj, - const jsi::PropNameID &name) { +bool ChakraRuntime::hasProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::PropNameID &name) { bool hasProperty; checkException(JsHasProperty(objectRef(obj), propIdRef(name), &hasProperty)); return hasProperty; } -void ChakraJsiRuntime::setPropertyValue( - jsi::Object &object, - const jsi::PropNameID &name, - const jsi::Value &value) { +void ChakraRuntime::setPropertyValue( + facebook::jsi::Object &object, + const facebook::jsi::PropNameID &name, + const facebook::jsi::Value &value) { checkException( JsSetProperty(objectRef(object), propIdRef(name), valueRef(value), true)); } -void ChakraJsiRuntime::setPropertyValue( - jsi::Object &object, - const jsi::String &name, - const jsi::Value &value) { +void ChakraRuntime::setPropertyValue( + facebook::jsi::Object &object, + const facebook::jsi::String &name, + const facebook::jsi::Value &value) { std::wstring propName = JSStringToSTLWString(stringRef(name)); JsPropertyIdRef propId = JS_INVALID_REFERENCE; @@ -441,31 +434,37 @@ void ChakraJsiRuntime::setPropertyValue( JsSetProperty(objectRef(object), propId, valueRef(value), true)); } -bool ChakraJsiRuntime::isArray(const jsi::Object &obj) const { +bool ChakraRuntime::isArray(const facebook::jsi::Object &obj) const { JsValueType type; JsGetValueType(objectRef(obj), &type); return type == JsValueType::JsArray; } -bool ChakraJsiRuntime::isArrayBuffer(const jsi::Object & /*obj*/) const { +bool ChakraRuntime::isArrayBuffer(const facebook::jsi::Object & /*obj*/) const { throw std::runtime_error("Unsupported"); } -uint8_t *ChakraJsiRuntime::data(const jsi::ArrayBuffer & /*obj*/) { - throw std::runtime_error("Unsupported"); +bool ChakraRuntime::isFunction(const facebook::jsi::Object &obj) const { + JsValueType type; + JsGetValueType(objectRef(obj), &type); + return type == JsValueType::JsFunction; } -size_t ChakraJsiRuntime::size(const jsi::ArrayBuffer & /*obj*/) { - throw std::runtime_error("Unsupported"); +bool ChakraRuntime::isHostObject(const facebook::jsi::Object &obj) const { + facebook::jsi::Value val = obj.getProperty( + const_cast(*this), s_proxyIsHostObjectPropName); + if (val.isBool()) + return val.getBool(); + else + return false; } -bool ChakraJsiRuntime::isFunction(const jsi::Object &obj) const { - JsValueType type; - JsGetValueType(objectRef(obj), &type); - return type == JsValueType::JsFunction; +bool ChakraRuntime::isHostFunction(const facebook::jsi::Function &obj) const { + throw std::runtime_error("ChakraRuntime::isHostFunction is not implemented."); } -jsi::Array ChakraJsiRuntime::getPropertyNames(const jsi::Object &obj) { +facebook::jsi::Array ChakraRuntime::getPropertyNames( + const facebook::jsi::Object &obj) { JsValueRef propertyNamesArrayRef; checkException(JsGetOwnPropertyNames(objectRef(obj), &propertyNamesArrayRef)); @@ -489,21 +488,24 @@ jsi::Array ChakraJsiRuntime::getPropertyNames(const jsi::Object &obj) { return result; } -jsi::WeakObject ChakraJsiRuntime::createWeakObject(const jsi::Object &obj) { - return make(makeWeakRefValue(newWeakObjectRef(obj))); +facebook::jsi::WeakObject ChakraRuntime::createWeakObject( + const facebook::jsi::Object &obj) { + return make( + makeWeakRefValue(newWeakObjectRef(obj))); } -jsi::Value ChakraJsiRuntime::lockWeakObject(const jsi::WeakObject &weakObj) { +facebook::jsi::Value ChakraRuntime::lockWeakObject( + const facebook::jsi::WeakObject &weakObj) { return createValue(strongObjectRef(weakObj)); } -jsi::Array ChakraJsiRuntime::createArray(size_t length) { +facebook::jsi::Array ChakraRuntime::createArray(size_t length) { JsValueRef result; checkException(JsCreateArray(static_cast(length), &result)); return createObject(result).getArray(*this); } -size_t ChakraJsiRuntime::size(const jsi::Array &arr) { +size_t ChakraRuntime::size(const facebook::jsi::Array &arr) { std::string lengthStr = "length"; JsPropertyIdRef propId = @@ -521,7 +523,17 @@ size_t ChakraJsiRuntime::size(const jsi::Array &arr) { return intValue; } -jsi::Value ChakraJsiRuntime::getValueAtIndex(const jsi::Array &arr, size_t i) { +uint8_t *ChakraRuntime::data(const facebook::jsi::ArrayBuffer & /*obj*/) { + throw std::runtime_error("Unsupported"); +} + +size_t ChakraRuntime::size(const facebook::jsi::ArrayBuffer & /*obj*/) { + throw std::runtime_error("Unsupported"); +} + +facebook::jsi::Value ChakraRuntime::getValueAtIndex( + const facebook::jsi::Array &arr, + size_t i) { JsValueRef index; JsIntToNumber(static_cast(i), &index); JsValueRef property; @@ -529,102 +541,27 @@ jsi::Value ChakraJsiRuntime::getValueAtIndex(const jsi::Array &arr, size_t i) { return createValue(property); } -void ChakraJsiRuntime::setValueAtIndexImpl( - jsi::Array &arr, +void ChakraRuntime::setValueAtIndexImpl( + facebook::jsi::Array &arr, size_t i, - const jsi::Value &value) { + const facebook::jsi::Value &value) { JsValueRef index; JsIntToNumber(static_cast(i), &index); checkException(JsSetIndexedProperty(objectRef(arr), index, valueRef(value))); } -class HostFunctionProxy { - public: - HostFunctionProxy( - jsi::HostFunctionType hostFunction, - ChakraJsiRuntime &runtime) - : m_hostFunction(hostFunction), m_runtime(runtime) {} - - inline const jsi::HostFunctionType &getHostFunction() const { - return m_hostFunction; - } - - inline ChakraJsiRuntime &getRuntime() const { - return m_runtime; - } - - private: - const jsi::HostFunctionType m_hostFunction; - ChakraJsiRuntime &m_runtime; -}; - -JsValueRef CALLBACK ChakraJsiRuntime::HostFunctionCall( - JsValueRef callee, - bool isConstructCall, - JsValueRef *argumentsIncThis, - unsigned short argumentCountIncThis, - void *callbackState) { - const HostFunctionProxy &hostFuncProxy = - *reinterpret_cast(callbackState); - - const unsigned maxStackArgCount = 8; - jsi::Value stackArgs[maxStackArgCount]; - std::unique_ptr heapArgs; - jsi::Value *args; - - // Accounting for 'this' object at 0 - unsigned short argumentCount = argumentCountIncThis - 1; - - if (argumentCount > maxStackArgCount) { - heapArgs = std::make_unique(argumentCount); - for (size_t i = 1; i < argumentCountIncThis; i++) { - heapArgs[i - 1] = - hostFuncProxy.getRuntime().createValue(argumentsIncThis[i]); - } - args = heapArgs.get(); - } else { - for (size_t i = 1; i < argumentCountIncThis; i++) { - stackArgs[i - 1] = - hostFuncProxy.getRuntime().createValue(argumentsIncThis[i]); - } - args = stackArgs; - } - JsValueRef res{JS_INVALID_REFERENCE}; - jsi::Value thisVal( - hostFuncProxy.getRuntime().createObject(argumentsIncThis[0])); - try { - jsi::Value retVal = hostFuncProxy.getHostFunction()( - hostFuncProxy.getRuntime(), thisVal, args, argumentCount); - res = hostFuncProxy.getRuntime().valueRef(retVal); - } catch (const jsi::JSError &error) { - JsSetException(hostFuncProxy.getRuntime().valueRef(error.value())); - } catch (const std::exception &ex) { - std::string exwhat(ex.what()); - JsValueRef exn; - exn = createJSString(exwhat.c_str(), exwhat.size()); - JsSetException(exn); - } catch (...) { - std::string exceptionString("Exception in HostFunction: "); - JsValueRef exn; - exn = createJSString(exceptionString.c_str(), exceptionString.size()); - JsSetException(exn); - } - - return res; -} - -jsi::Function ChakraJsiRuntime::createFunctionFromHostFunction( - const jsi::PropNameID &name, +facebook::jsi::Function ChakraRuntime::createFunctionFromHostFunction( + const facebook::jsi::PropNameID &name, unsigned int paramCount, - jsi::HostFunctionType func) { + facebook::jsi::HostFunctionType func) { // Currently, we are allocating this proxy object in heap .. and deleting it // whenever the JS object is garbage collected. HostFunctionProxy *hostFuncProxy = new HostFunctionProxy(func, *this); JsValueRef funcRef; checkException(JsCreateFunction( - ChakraJsiRuntime::HostFunctionCall, hostFuncProxy, &funcRef)); + ChakraRuntime::HostFunctionCall, hostFuncProxy, &funcRef)); checkException(JsSetObjectBeforeCollectCallback( funcRef, hostFuncProxy, [](JsRef ref, void *hostFuncProxy) { delete hostFuncProxy; @@ -633,240 +570,101 @@ jsi::Function ChakraJsiRuntime::createFunctionFromHostFunction( return createObject(funcRef).getFunction(*this); } -namespace detail { - -class ArgsConverterForCall { - public: - ArgsConverterForCall( - ChakraJsiRuntime &rt, - JsValueRef thisObj, - const jsi::Value *args, - size_t count) { - JsValueRef *destination = inline_; - if (count + 1 > maxStackArgs) { - outOfLine_ = std::make_unique(count + 1); - destination = outOfLine_.get(); - } +facebook::jsi::Value ChakraRuntime::call( + const facebook::jsi::Function &f, + const facebook::jsi::Value &jsThis, + const facebook::jsi::Value *args, + size_t count) { + JsValueRef result = nullptr; + checkException(JsCallFunction( + objectRef(f), + ArgsConverterForCall( + *this, + jsThis.isUndefined() ? nullptr : objectRef(jsThis.getObject(*this)), + args, + count), + static_cast(count + 1), + &result)); + return createValue(result); +} - if (thisObj == nullptr) { - JsValueRef undefinedValue; - JsGetUndefinedValue(&undefinedValue); - destination[0] = undefinedValue; - } else { - destination[0] = thisObj; - } - - for (size_t i = 0; i < count; ++i) { - destination[i + 1] = rt.valueRef(args[i]); - } - } - - operator JsValueRef *() { - return outOfLine_ ? outOfLine_.get() : inline_; - } - - private: - constexpr static unsigned maxStackArgs = 8; - JsValueRef inline_[maxStackArgs]; - std::unique_ptr outOfLine_; -}; - -} // namespace detail - -bool ChakraJsiRuntime::isHostFunction(const jsi::Function &obj) const { - throw std::runtime_error( - "ChakraJsiRuntime::isHostFunction is not implemented."); -} - -jsi::HostFunctionType &ChakraJsiRuntime::getHostFunction( - const jsi::Function &obj) { - throw std::runtime_error( - "ChakraJsiRuntime::getHostFunction is not implemented."); -} - -jsi::Value ChakraJsiRuntime::call( - const jsi::Function &f, - const jsi::Value &jsThis, - const jsi::Value *args, - size_t count) { - JsValueRef result = nullptr; - checkException(JsCallFunction( - objectRef(f), - detail::ArgsConverterForCall( - *this, - jsThis.isUndefined() ? nullptr : objectRef(jsThis.getObject(*this)), - args, - count), - static_cast(count + 1), - &result)); - return createValue(result); -} - -jsi::Value ChakraJsiRuntime::callAsConstructor( - const jsi::Function &f, - const jsi::Value *args, +facebook::jsi::Value ChakraRuntime::callAsConstructor( + const facebook::jsi::Function &f, + const facebook::jsi::Value *args, size_t count) { JsValueRef result = nullptr; checkException(JsConstructObject( objectRef(f), - detail::ArgsConverterForCall(*this, nullptr, args, count), + ArgsConverterForCall(*this, nullptr, args, count), static_cast(count), &result)); return createValue(result); } -bool ChakraJsiRuntime::strictEquals(const jsi::String &a, const jsi::String &b) - const { +facebook::jsi::Runtime::ScopeState *ChakraRuntime::pushScope() { + return nullptr; +} + +void ChakraRuntime::popScope(Runtime::ScopeState *state) { + assert(state == nullptr); + checkException(JsCollectGarbage(m_runtime), "JsCollectGarbage"); +} + +bool ChakraRuntime::strictEquals( + const facebook::jsi::String &a, + const facebook::jsi::String &b) const { bool result; JsStrictEquals(stringRef(a), stringRef(b), &result); return result; } -bool ChakraJsiRuntime::strictEquals(const jsi::Object &a, const jsi::Object &b) - const { +bool ChakraRuntime::strictEquals( + const facebook::jsi::Object &a, + const facebook::jsi::Object &b) const { bool result; JsStrictEquals(objectRef(a), objectRef(b), &result); return result; } -bool ChakraJsiRuntime::strictEquals( +bool ChakraRuntime::strictEquals( const facebook::jsi::Symbol &, const facebook::jsi::Symbol &) const { - throw JSINativeException("Not implemented!"); + throw facebook::jsi::JSINativeException("Not implemented!"); } -bool ChakraJsiRuntime::instanceOf( - const jsi::Object &o, - const jsi::Function &f) { +bool ChakraRuntime::instanceOf( + const facebook::jsi::Object &o, + const facebook::jsi::Function &f) { bool res; checkException(JsInstanceOf(objectRef(o), objectRef(f), &res)); return res; } -jsi::Runtime::PointerValue *ChakraJsiRuntime::makeStringValue( - JsValueRef stringRef) const { - if (!stringRef) { - JsValueRef emptyJsValue = createJSString("", 0); - stringRef = emptyJsValue; - } - return new ChakraStringValue(stringRef); -} - -jsi::String ChakraJsiRuntime::createString(JsValueRef str) const { - return make(makeStringValue(str)); -} - -jsi::PropNameID ChakraJsiRuntime::createPropNameID(JsValueRef str) { - return make(makePropertyIdValue(str)); -} - -jsi::Runtime::PointerValue *ChakraJsiRuntime::makePropertyIdValue( - JsPropertyIdRef propIdRef) const { - if (!propIdRef) { - std::terminate(); - } - return new ChakraPropertyIdValue(propIdRef); -} - -jsi::Runtime::PointerValue *ChakraJsiRuntime::makeWeakRefValue( - JsWeakRef objWeakRef) const { - if (!objWeakRef) - std::terminate(); - return new ChakraWeakRefValue(objWeakRef); -} - -jsi::Runtime::PointerValue *ChakraJsiRuntime::makeObjectValue( - JsValueRef objectRef) const { - if (!objectRef) { - JsCreateObject(&objectRef); - } - - ChakraObjectValue *chakraObjValue = new ChakraObjectValue(objectRef); - return chakraObjValue; -} - -template -jsi::Runtime::PointerValue *ChakraJsiRuntime::makeObjectValue( - JsValueRef objectRef, - T *externaldata) const { - if (!externaldata) { - return makeObjectValue(objectRef); - } - - // Note :: We explicitly delete the external data proxy when the JS value is - // finalized. The proxy is expected to do the right thing in destructor, for - // e.g. decrease the ref count of a shared resource. - if (!objectRef) { - JsCreateExternalObject( - externaldata, [](void *data) { delete data; }, &objectRef); - } else { - JsSetExternalData( - objectRef, externaldata); // TODO : Is there an API to listen to - // finalization of arbitrary objects ? - } - - ChakraObjectValue *chakraObjValue = new ChakraObjectValue(objectRef); - return chakraObjValue; -} - -template -/*static */ jsi::Object ChakraJsiRuntime::ObjectWithExternalData::create( - ChakraJsiRuntime &rt, - T *externalData) { - return rt.createObject(static_cast(nullptr), externalData); -} +#pragma endregion Functions_inherited_from_Runtime -template -/*static */ ChakraJsiRuntime::ObjectWithExternalData -ChakraJsiRuntime::ObjectWithExternalData::fromExisting( - ChakraJsiRuntime &rt, - jsi::Object &&obj) { - return ObjectWithExternalData(rt.cloneObject(getPointerValue(obj))); -} - -template -T *ChakraJsiRuntime::ObjectWithExternalData::getExternalData() { - T *externalData; - JsGetExternalData( - static_cast(getPointerValue(*this))->m_obj, - reinterpret_cast(&externalData)); - return externalData; -} - -template -jsi::Object ChakraJsiRuntime::createObject( - JsValueRef objectRef, - T *externalData) const { - return make(makeObjectValue(objectRef, externalData)); -} - -jsi::Object ChakraJsiRuntime::createObject(JsValueRef obj) const { - return make(makeObjectValue(obj)); -} - -jsi::Value ChakraJsiRuntime::createValue(JsValueRef value) const { +facebook::jsi::Value ChakraRuntime::createValue(JsValueRef value) const { JsValueType type; JsGetValueType(value, &type); switch (type) { case JsUndefined: - return jsi::Value(); + return facebook::jsi::Value(); case JsNull: - return jsi::Value(nullptr); + return facebook::jsi::Value(nullptr); case JsNumber: { double doubleValue; JsNumberToDouble(value, &doubleValue); - jsi::Value val(doubleValue); + facebook::jsi::Value val(doubleValue); return val; } case JsString: { std::string utf8str = JSStringToSTLString(value); - return jsi::String::createFromUtf8( - *const_cast( - reinterpret_cast(this)), + return facebook::jsi::String::createFromUtf8( + *const_cast( + reinterpret_cast(this)), reinterpret_cast(utf8str.c_str()), utf8str.size()); break; @@ -875,14 +673,14 @@ jsi::Value ChakraJsiRuntime::createValue(JsValueRef value) const { case JsBoolean: { bool boolValue; JsBooleanToBool(value, &boolValue); - jsi::Value val(boolValue); + facebook::jsi::Value val(boolValue); return val; } case JsObject: case JsFunction: case JsArray: { - return jsi::Value(createObject(value)); + return facebook::jsi::Value(createObject(value)); break; } @@ -897,7 +695,7 @@ jsi::Value ChakraJsiRuntime::createValue(JsValueRef value) const { } } -JsValueRef ChakraJsiRuntime::valueRef(const jsi::Value &valueIn) { +JsValueRef ChakraRuntime::valueRef(const facebook::jsi::Value &valueIn) { if (valueIn.isUndefined()) { JsValueRef value; JsGetUndefinedValue(&value); @@ -924,24 +722,83 @@ JsValueRef ChakraJsiRuntime::valueRef(const jsi::Value &valueIn) { } } -JsValueRef ChakraJsiRuntime::stringRef(const jsi::String &str) { - return static_cast(getPointerValue(str))->m_str; +ChakraRuntime::ChakraPropertyIdValue::~ChakraPropertyIdValue() { + JsRelease(m_propId, nullptr); } -JsPropertyIdRef ChakraJsiRuntime::propIdRef(const jsi::PropNameID &sym) { - return static_cast(getPointerValue(sym)) - ->m_propId; +void ChakraRuntime::ChakraPropertyIdValue::invalidate() { + delete this; } -JsValueRef ChakraJsiRuntime::objectRef(const jsi::Object &obj) { - return static_cast(getPointerValue(obj))->m_obj; +ChakraRuntime::ChakraPropertyIdValue::ChakraPropertyIdValue( + JsPropertyIdRef propIdRef) + : m_propId(propIdRef) { + JsAddRef(propIdRef, nullptr); } -JsWeakRef ChakraJsiRuntime::objectRef(const jsi::WeakObject &obj) { - return static_cast(getPointerValue(obj))->m_obj; +ChakraRuntime::ChakraStringValue::ChakraStringValue(JsValueRef str) + : m_str(str) { + JsAddRef(str, nullptr); } -void ChakraJsiRuntime::checkException(JsErrorCode result) { +void ChakraRuntime::ChakraStringValue::invalidate() { + delete this; +} + +ChakraRuntime::ChakraStringValue::~ChakraStringValue() { + JsRelease(m_str, nullptr); +} + +ChakraRuntime::ChakraObjectValue::ChakraObjectValue(JsValueRef obj) + : m_obj(obj) { + JsAddRef(m_obj, nullptr); +} + +void ChakraRuntime::ChakraObjectValue::invalidate() { + delete this; +} + +ChakraRuntime::ChakraObjectValue::~ChakraObjectValue() { + JsRelease(m_obj, nullptr); +} + +ChakraRuntime::ChakraWeakRefValue::ChakraWeakRefValue(JsWeakRef obj) + : m_obj(obj) { + JsAddRef(m_obj, nullptr); +} + +void ChakraRuntime::ChakraWeakRefValue::invalidate() { + delete this; +} + +ChakraRuntime::ChakraWeakRefValue::~ChakraWeakRefValue() { + JsRelease(m_obj, nullptr); +} + +template +/*static */ facebook::jsi::Object ChakraRuntime::ObjectWithExternalData< + T>::create(ChakraRuntime &rt, T *externalData) { + return rt.createObject(static_cast(nullptr), externalData); +} + +template +/*static */ ChakraRuntime::ObjectWithExternalData +ChakraRuntime::ObjectWithExternalData::fromExisting( + ChakraRuntime &rt, + facebook::jsi::Object &&obj) { + return ObjectWithExternalData(rt.cloneObject(getPointerValue(obj))); +} + +template +T *ChakraRuntime::ObjectWithExternalData::getExternalData() { + T *externalData; + JsGetExternalData( + static_cast(getPointerValue(*this))->m_obj, + reinterpret_cast(&externalData)); + return externalData; +} + +void ChakraRuntime::checkException(JsErrorCode result) { bool hasException = false; if (result == JsNoError && (JsHasException(&hasException), !hasException)) return; @@ -949,7 +806,7 @@ void ChakraJsiRuntime::checkException(JsErrorCode result) { checkException(result, nullptr); } -void ChakraJsiRuntime::checkException(JsErrorCode result, const char *message) { +void ChakraRuntime::checkException(JsErrorCode result, const char *message) { bool hasException = false; if (result == JsNoError && (JsHasException(&hasException), !hasException)) return; @@ -990,96 +847,77 @@ void ChakraJsiRuntime::checkException(JsErrorCode result, const char *message) { } std::string errorString = errorStream.str(); - throw jsi::JSError( + throw facebook::jsi::JSError( *this, createStringFromAscii(errorString.c_str(), errorString.length())); } -std::wstring ChakraJsiRuntime::JSStringToSTLWString(JsValueRef str) { - const wchar_t *value; - size_t length; - - if (JsNoError != JsStringToPointer(str, &value, &length)) { - std::terminate(); - } - - // Note: Copying the string out of JsString, as required. - return std::wstring(value, length); +JsValueRef ChakraRuntime::stringRef(const facebook::jsi::String &str) { + return static_cast(getPointerValue(str))->m_str; } -std::string ChakraJsiRuntime::JSStringToSTLString(JsValueRef str) { - const wchar_t *value; - size_t length; +JsPropertyIdRef ChakraRuntime::propIdRef(const facebook::jsi::PropNameID &sym) { + return static_cast(getPointerValue(sym)) + ->m_propId; +} - if (JsNoError != JsStringToPointer(str, &value, &length)) { - std::terminate(); - } +JsValueRef ChakraRuntime::objectRef(const facebook::jsi::Object &obj) { + return static_cast(getPointerValue(obj))->m_obj; +} - // Note: This results in multiple buffer copyings. We should look for - // optimization. - return facebook::react::unicode::utf16ToUtf8(std::wstring(value, length)); +JsWeakRef ChakraRuntime::objectRef(const facebook::jsi::WeakObject &obj) { + return static_cast(getPointerValue(obj))->m_obj; } -jsi::Function ChakraJsiRuntime::createProxyConstructor() noexcept { - auto buffer = std::make_unique( - "var ctr=function(target, handler) { return new Proxy(target, handler);};ctr;"); - jsi::Value hostObjectProxyConstructor = - evaluateJavaScriptSimple(*buffer, "proxy_constructor.js"); +facebook::jsi::String ChakraRuntime::createString(JsValueRef str) const { + return make(makeStringValue(str)); +} - if (!hostObjectProxyConstructor.isObject() || - !hostObjectProxyConstructor.getObject(*this).isFunction(*this)) - std::terminate(); +facebook::jsi::PropNameID ChakraRuntime::createPropNameID(JsValueRef str) { + return make(makePropertyIdValue(str)); +} - return hostObjectProxyConstructor.getObject(*this).getFunction(*this); +template +facebook::jsi::Object ChakraRuntime::createObject( + JsValueRef objectRef, + T *externalData) const { + return make(makeObjectValue(objectRef, externalData)); } -bool ChakraJsiRuntime::isHostObject(const jsi::Object &obj) const { - jsi::Value val = obj.getProperty( - const_cast(*this), s_proxyIsHostObjectPropName); - if (val.isBool()) - return val.getBool(); - else - return false; +facebook::jsi::Object ChakraRuntime::createObject(JsValueRef obj) const { + return make(makeObjectValue(obj)); } -std::shared_ptr ChakraJsiRuntime::getHostObject( - const jsi::Object &obj) { - if (!isHostObject(obj)) - return nullptr; +facebook::jsi::Object ChakraRuntime::createProxy( + facebook::jsi::Object &&target, + facebook::jsi::Object &&handler) noexcept { + // TODO :: Avoid creating the constuctor on each call. + facebook::jsi::Function proxyConstructor = createProxyConstructor(); + facebook::jsi::Value hostObjectProxy = + proxyConstructor.call(*this, target, handler); - jsi::Value value = obj.getProperty( - const_cast(*this), - s_proxyGetHostObjectTargetPropName); - if (!value.isObject()) + if (!hostObjectProxy.isObject()) std::terminate(); - jsi::Object valueObj = value.getObject(const_cast(*this)); - - ObjectWithExternalData extObject = - ObjectWithExternalData::fromExisting( - *this, std::move(valueObj)); - HostObjectProxy *externalData = extObject.getExternalData(); - if (!externalData) - std::terminate(); - return externalData->getHostObject(); + return hostObjectProxy.getObject(*this); } -jsi::Object ChakraJsiRuntime::createProxy( - jsi::Object &&target, - jsi::Object &&handler) noexcept { - // TODO :: Avoid creating the constuctor on each call. - jsi::Function proxyConstructor = createProxyConstructor(); - jsi::Value hostObjectProxy = proxyConstructor.call(*this, target, handler); +facebook::jsi::Function ChakraRuntime::createProxyConstructor() noexcept { + auto buffer = std::make_unique( + "var ctr=function(target, handler) { return new Proxy(target, handler);};ctr;"); + facebook::jsi::Value hostObjectProxyConstructor = + evaluateJavaScriptSimple(*buffer, "proxy_constructor.js"); - if (!hostObjectProxy.isObject()) + if (!hostObjectProxyConstructor.isObject() || + !hostObjectProxyConstructor.getObject(*this).isFunction(*this)) std::terminate(); - return hostObjectProxy.getObject(*this); + return hostObjectProxyConstructor.getObject(*this).getFunction(*this); } -jsi::Object ChakraJsiRuntime::createHostObjectProxyHandler() noexcept { +facebook::jsi::Object ChakraRuntime::createHostObjectProxyHandler() noexcept { // TODO :: This object can be cached and reused for multiple host objects. - jsi::Object handlerObj = createObject(); + facebook::jsi::Object handlerObj = createObject(); std::string getPropName("get"), setPropName("set"), enumeratePropName("enumerate"); @@ -1091,11 +929,11 @@ jsi::Object ChakraJsiRuntime::createHostObjectProxyHandler() noexcept { 2, [this]( Runtime &rt, - const Value &thisVal, - const Value *args, - size_t count) -> Value { - jsi::Object targetObj = args[0].getObject(*this); - jsi::String propStr = args[1].getString(*this); + const facebook::jsi::Value &thisVal, + const facebook::jsi::Value *args, + size_t count) -> facebook::jsi::Value { + facebook::jsi::Object targetObj = args[0].getObject(*this); + facebook::jsi::String propStr = args[1].getString(*this); if (propStr.utf8(rt) == s_proxyGetHostObjectTargetPropName) { return targetObj; @@ -1110,7 +948,7 @@ jsi::Object ChakraJsiRuntime::createHostObjectProxyHandler() noexcept { *this, std::move(targetObj)); HostObjectProxy *externalData = extObject.getExternalData(); return externalData->Get( - jsi::PropNameID::forString(*this, propStr)); + facebook::jsi::PropNameID::forString(*this, propStr)); })); handlerObj.setProperty( @@ -1121,20 +959,20 @@ jsi::Object ChakraJsiRuntime::createHostObjectProxyHandler() noexcept { 3, [this]( Runtime &rt, - const Value &thisVal, - const Value *args, - size_t count) -> Value { - jsi::Object targetObj = args[0].getObject(*this); - jsi::String propStr = args[1].getString(*this); - const jsi::Value &propVal = args[2]; + const facebook::jsi::Value &thisVal, + const facebook::jsi::Value *args, + size_t count) -> facebook::jsi::Value { + facebook::jsi::Object targetObj = args[0].getObject(*this); + facebook::jsi::String propStr = args[1].getString(*this); + const facebook::jsi::Value &propVal = args[2]; ObjectWithExternalData extObject = ObjectWithExternalData::fromExisting( *this, std::move(targetObj)); HostObjectProxy *externalData = extObject.getExternalData(); externalData->Set( - jsi::PropNameID::forString(*this, propStr), propVal); - return jsi::Value::undefined(); + facebook::jsi::PropNameID::forString(*this, propStr), propVal); + return facebook::jsi::Value::undefined(); })); handlerObj.setProperty( @@ -1146,10 +984,10 @@ jsi::Object ChakraJsiRuntime::createHostObjectProxyHandler() noexcept { 1, [this]( Runtime &rt, - const Value &thisVal, - const Value *args, - size_t count) -> Value { - jsi::Object targetObj = args[0].getObject(*this); + const facebook::jsi::Value &thisVal, + const facebook::jsi::Value *args, + size_t count) -> facebook::jsi::Value { + facebook::jsi::Object targetObj = args[0].getObject(*this); ObjectWithExternalData extObject = ObjectWithExternalData::fromExisting( @@ -1162,7 +1000,9 @@ jsi::Object ChakraJsiRuntime::createHostObjectProxyHandler() noexcept { for (size_t i = 0; i < count; i++) { std::string keyStr = keys[i].utf8(*this); result.setValueAtIndex( - *this, i, jsi::String::createFromUtf8(*this, keyStr)); + *this, + i, + facebook::jsi::String::createFromUtf8(*this, keyStr)); } return result; @@ -1171,11 +1011,185 @@ jsi::Object ChakraJsiRuntime::createHostObjectProxyHandler() noexcept { return handlerObj; } -std::unique_ptr makeChakraJsiRuntime( - ChakraJsiRuntimeArgs &&args) noexcept { - return std::make_unique(std::move(args)); +facebook::jsi::Runtime::PointerValue *ChakraRuntime::makeStringValue( + JsValueRef stringRef) const { + if (!stringRef) { + JsValueRef emptyJsValue = createJSString("", 0); + stringRef = emptyJsValue; + } + return new ChakraStringValue(stringRef); +} + +facebook::jsi::Runtime::PointerValue *ChakraRuntime::makeObjectValue( + JsValueRef objectRef) const { + if (!objectRef) { + JsCreateObject(&objectRef); + } + + ChakraObjectValue *chakraObjValue = new ChakraObjectValue(objectRef); + return chakraObjValue; +} + +template +facebook::jsi::Runtime::PointerValue *ChakraRuntime::makeObjectValue( + JsValueRef objectRef, + T *externaldata) const { + if (!externaldata) { + return makeObjectValue(objectRef); + } + + // Note :: We explicitly delete the external data proxy when the JS value is + // finalized. The proxy is expected to do the right thing in destructor, for + // e.g. decrease the ref count of a shared resource. + if (!objectRef) { + JsCreateExternalObject( + externaldata, [](void *data) { delete data; }, &objectRef); + } else { + JsSetExternalData( + objectRef, externaldata); // TODO : Is there an API to listen to + // finalization of arbitrary objects ? + } + + ChakraObjectValue *chakraObjValue = new ChakraObjectValue(objectRef); + return chakraObjValue; +} + +facebook::jsi::Runtime::PointerValue *ChakraRuntime::makePropertyIdValue( + JsPropertyIdRef propIdRef) const { + if (!propIdRef) { + std::terminate(); + } + return new ChakraPropertyIdValue(propIdRef); +} + +facebook::jsi::Runtime::PointerValue *ChakraRuntime::makeWeakRefValue( + JsWeakRef objWeakRef) const { + if (!objWeakRef) + std::terminate(); + return new ChakraWeakRefValue(objWeakRef); +} + +std::wstring ChakraRuntime::JSStringToSTLWString(JsValueRef str) { + const wchar_t *value; + size_t length; + + if (JsNoError != JsStringToPointer(str, &value, &length)) { + std::terminate(); + } + + // Note: Copying the string out of JsString, as required. + return std::wstring(value, length); +} + +std::string ChakraRuntime::JSStringToSTLString(JsValueRef str) { + const wchar_t *value; + size_t length; + + if (JsNoError != JsStringToPointer(str, &value, &length)) { + std::terminate(); + } + + // Note: This results in multiple buffer copyings. We should look for + // optimization. + return facebook::react::unicode::utf16ToUtf8(std::wstring(value, length)); +} + +void ChakraRuntime::setupMemoryTracker() noexcept { + if (runtimeArgs().memoryTracker) { + size_t initialMemoryUsage = 0; + JsGetRuntimeMemoryUsage(m_runtime, &initialMemoryUsage); + runtimeArgs().memoryTracker->Initialize(initialMemoryUsage); + + if (runtimeArgs().runtimeMemoryLimit > 0) + JsSetRuntimeMemoryLimit(m_runtime, runtimeArgs().runtimeMemoryLimit); + + JsSetRuntimeMemoryAllocationCallback( + m_runtime, + runtimeArgs().memoryTracker.get(), + [](void *callbackState, + JsMemoryEventType allocationEvent, + size_t allocationSize) -> bool { + auto memoryTrackerPtr = static_cast(callbackState); + switch (allocationEvent) { + case JsMemoryAllocate: + memoryTrackerPtr->OnAllocation(allocationSize); + break; + + case JsMemoryFree: + memoryTrackerPtr->OnDeallocation(allocationSize); + break; + + case JsMemoryFailure: + default: + break; + } + + return true; + }); + } +} + +JsValueRef CALLBACK ChakraRuntime::HostFunctionCall( + JsValueRef callee, + bool isConstructCall, + JsValueRef *argumentsIncThis, + unsigned short argumentCountIncThis, + void *callbackState) { + const HostFunctionProxy &hostFuncProxy = + *reinterpret_cast(callbackState); + + const unsigned maxStackArgCount = 8; + facebook::jsi::Value stackArgs[maxStackArgCount]; + std::unique_ptr heapArgs; + facebook::jsi::Value *args; + + // Accounting for 'this' object at 0 + unsigned short argumentCount = argumentCountIncThis - 1; + + if (argumentCount > maxStackArgCount) { + heapArgs = std::make_unique(argumentCount); + for (size_t i = 1; i < argumentCountIncThis; i++) { + heapArgs[i - 1] = + hostFuncProxy.getRuntime().createValue(argumentsIncThis[i]); + } + args = heapArgs.get(); + } else { + for (size_t i = 1; i < argumentCountIncThis; i++) { + stackArgs[i - 1] = + hostFuncProxy.getRuntime().createValue(argumentsIncThis[i]); + } + args = stackArgs; + } + JsValueRef res{JS_INVALID_REFERENCE}; + facebook::jsi::Value thisVal( + hostFuncProxy.getRuntime().createObject(argumentsIncThis[0])); + try { + facebook::jsi::Value retVal = hostFuncProxy.getHostFunction()( + hostFuncProxy.getRuntime(), thisVal, args, argumentCount); + res = hostFuncProxy.getRuntime().valueRef(retVal); + } catch (const facebook::jsi::JSError &error) { + JsSetException(hostFuncProxy.getRuntime().valueRef(error.value())); + } catch (const std::exception &ex) { + std::string exwhat(ex.what()); + JsValueRef exn; + exn = createJSString(exwhat.c_str(), exwhat.size()); + JsSetException(exn); + } catch (...) { + std::string exceptionString("Exception in HostFunction: "); + JsValueRef exn; + exn = createJSString(exceptionString.c_str(), exceptionString.size()); + JsSetException(exn); + } + + return res; +} + +/*static*/ std::once_flag ChakraRuntime::s_runtimeVersionInitFlag; +/*static*/ uint64_t ChakraRuntime::s_runtimeVersion = 0; + +std::unique_ptr makeChakraRuntime( + ChakraRuntimeArgs &&args) noexcept { + return std::make_unique(std::move(args)); } -} // namespace chakraruntime -} // namespace jsi -} // namespace facebook +} // namespace Microsoft::JSI diff --git a/vnext/JSI/Shared/ChakraRuntime.h b/vnext/JSI/Shared/ChakraRuntime.h new file mode 100644 index 00000000000..1219b0f0422 --- /dev/null +++ b/vnext/JSI/Shared/ChakraRuntime.h @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#pragma once + +#include "ByteArrayBuffer.h" +#include "ChakraRuntimeArgs.h" + +#include "jsi/jsi.h" + +#ifdef CHAKRACORE +#include "ChakraCore.h" +#include "ChakraCoreDebugger.h" +#else +#ifndef USE_EDGEMODE_JSRT +#define USE_EDGEMODE_JSRT +#endif +#include "jsrt.h" +#endif + +#include +#include +#include + +#if !defined(CHAKRACORE) +class DebugProtocolHandler {}; +class DebugService {}; +using JsWeakRef = JsValueRef; +#endif + +namespace Microsoft::JSI { + +class ChakraRuntime : public facebook::jsi::Runtime { + public: + ChakraRuntime(ChakraRuntimeArgs &&args) noexcept; + ~ChakraRuntime() noexcept; + +#pragma region Functions_inherited_from_Runtime + + facebook::jsi::Value evaluateJavaScript( + const std::shared_ptr &buffer, + const std::string &sourceURL) override; + + std::shared_ptr prepareJavaScript( + const std::shared_ptr &buffer, + std::string sourceURL) override; + + facebook::jsi::Value evaluatePreparedJavaScript( + const std::shared_ptr &js) + override; + + facebook::jsi::Object global() override; + + std::string description() override; + + bool isInspectable() override; + + // We use the default instrumentation() implementation that returns an + // Instrumentation instance which returns no metrics. + + private: + PointerValue *cloneSymbol(const PointerValue *pv) override; + PointerValue *cloneString(const PointerValue *pv) override; + PointerValue *cloneObject(const PointerValue *pv) override; + PointerValue *clonePropNameID(const PointerValue *pv) override; + + facebook::jsi::PropNameID createPropNameIDFromAscii( + const char *str, + size_t length) override; + facebook::jsi::PropNameID createPropNameIDFromUtf8( + const uint8_t *utf8, + size_t length) override; + facebook::jsi::PropNameID createPropNameIDFromString( + const facebook::jsi::String &str) override; + std::string utf8(const facebook::jsi::PropNameID &str) override; + bool compare( + const facebook::jsi::PropNameID &lhs, + const facebook::jsi::PropNameID &rhs) override; + + std::string symbolToString(const facebook::jsi::Symbol &s) override; + + facebook::jsi::String createStringFromAscii(const char *str, size_t length) + override; + facebook::jsi::String createStringFromUtf8(const uint8_t *utf8, size_t length) + override; + std::string utf8(const facebook::jsi::String &str) override; + + facebook::jsi::Object createObject() override; + facebook::jsi::Object createObject( + std::shared_ptr ho) override; + std::shared_ptr getHostObject( + const facebook::jsi::Object &) override; + facebook::jsi::HostFunctionType &getHostFunction( + const facebook::jsi::Function &) override; + + facebook::jsi::Value getProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::PropNameID &name) override; + facebook::jsi::Value getProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::String &name) override; + bool hasProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::PropNameID &name) override; + bool hasProperty( + const facebook::jsi::Object &obj, + const facebook::jsi::String &name) override; + void setPropertyValue( + facebook::jsi::Object &obj, + const facebook::jsi::PropNameID &name, + const facebook::jsi::Value &value) override; + void setPropertyValue( + facebook::jsi::Object &obj, + const facebook::jsi::String &name, + const facebook::jsi::Value &value) override; + + bool isArray(const facebook::jsi::Object &obj) const override; + bool isArrayBuffer(const facebook::jsi::Object &obj) const override; + bool isFunction(const facebook::jsi::Object &obj) const override; + bool isHostObject(const facebook::jsi::Object &obj) const override; + bool isHostFunction(const facebook::jsi::Function &func) const override; + facebook::jsi::Array getPropertyNames( + const facebook::jsi::Object &obj) override; + + facebook::jsi::WeakObject createWeakObject( + const facebook::jsi::Object &obj) override; + facebook::jsi::Value lockWeakObject( + const facebook::jsi::WeakObject &weakObj) override; + + facebook::jsi::Array createArray(size_t length) override; + size_t size(const facebook::jsi::Array &arr) override; + size_t size(const facebook::jsi::ArrayBuffer &arrBuf) override; + uint8_t *data(const facebook::jsi::ArrayBuffer &arrBuf) override; + facebook::jsi::Value getValueAtIndex( + const facebook::jsi::Array &arr, + size_t index) override; + void setValueAtIndexImpl( + facebook::jsi::Array &arr, + size_t index, + const facebook::jsi::Value &value) override; + + facebook::jsi::Function createFunctionFromHostFunction( + const facebook::jsi::PropNameID &name, + unsigned int paramCount, + facebook::jsi::HostFunctionType func) override; + facebook::jsi::Value call( + const facebook::jsi::Function &func, + const facebook::jsi::Value &jsThis, + const facebook::jsi::Value *args, + size_t count) override; + facebook::jsi::Value callAsConstructor( + const facebook::jsi::Function &func, + const facebook::jsi::Value *args, + size_t count) override; + + // For now, pushing a scope does nothing, and popping a scope forces the + // JavaScript garbage collector to run. + ScopeState *pushScope() override; + void popScope(ScopeState *) override; + + bool strictEquals( + const facebook::jsi::Symbol &a, + const facebook::jsi::Symbol &b) const override; + bool strictEquals( + const facebook::jsi::String &a, + const facebook::jsi::String &b) const override; + bool strictEquals( + const facebook::jsi::Object &a, + const facebook::jsi::Object &b) const override; + + bool instanceOf( + const facebook::jsi::Object &o, + const facebook::jsi::Function &f) override; + +#pragma endregion Functions_inherited_from_Runtime + + public: + // JsValueRef->JSValue (needs make.*Value so it must be member function) + facebook::jsi::Value createValue(JsValueRef value) const; + + // Value->JsValueRef (similar to above) + JsValueRef valueRef(const facebook::jsi::Value &value); + + protected: + ChakraRuntimeArgs &runtimeArgs() { + return m_args; + } + + private: + class ChakraPropertyIdValue final : public PointerValue { + ChakraPropertyIdValue(JsPropertyIdRef str); + ~ChakraPropertyIdValue(); + + void invalidate() override; + + JsPropertyIdRef m_propId; + + protected: + friend class ChakraRuntime; + }; + + class ChakraStringValue final : public PointerValue { + ChakraStringValue(JsValueRef str); + ~ChakraStringValue(); + + void invalidate() override; + + protected: + friend class ChakraRuntime; + JsValueRef m_str; + }; + + class ChakraObjectValue final : public PointerValue { + ChakraObjectValue(JsValueRef obj); + ~ChakraObjectValue(); + + void invalidate() override; + + protected: + friend class ChakraRuntime; + JsValueRef m_obj; + }; + + class ChakraWeakRefValue final : public PointerValue { + ChakraWeakRefValue(JsWeakRef obj); + ~ChakraWeakRefValue(); + + void invalidate() override; + + protected: + friend class ChakraRuntime; + JsWeakRef m_obj; + }; + + class HostObjectProxy { + public: + facebook::jsi::Value Get(const facebook::jsi::PropNameID &propNameId) { + return hostObject_->get(runtime_, propNameId); + } + + void Set( + const facebook::jsi::PropNameID &propNameId, + const facebook::jsi::Value &value) { + hostObject_->set(runtime_, propNameId, value); + } + + std::vector Enumerator() { + return hostObject_->getPropertyNames(runtime_); + } + + HostObjectProxy( + ChakraRuntime &rt, + const std::shared_ptr &hostObject) + : runtime_(rt), hostObject_(hostObject) {} + std::shared_ptr getHostObject() { + return hostObject_; + } + + private: + ChakraRuntime &runtime_; + std::shared_ptr hostObject_; + }; + + template + class ObjectWithExternalData : public facebook::jsi::Object { + public: + static facebook::jsi::Object create(ChakraRuntime &rt, T *externalData); + static ObjectWithExternalData fromExisting( + ChakraRuntime &rt, + facebook::jsi::Object &&obj); + + public: + T *getExternalData(); + ObjectWithExternalData(const Runtime::PointerValue *value) + : Object(const_cast(value)) { + } // TODO :: const_cast + + ObjectWithExternalData(ObjectWithExternalData &&) = default; + ObjectWithExternalData &operator=(ObjectWithExternalData &&) = default; + }; + + template + friend class ObjectWithExternalData; + + inline void checkException(JsErrorCode res); + inline void checkException(JsErrorCode res, const char *msg); + + // Basically convenience casts + static JsValueRef stringRef(const facebook::jsi::String &str); + static JsPropertyIdRef propIdRef(const facebook::jsi::PropNameID &sym); + static JsValueRef objectRef(const facebook::jsi::Object &obj); + static JsWeakRef objectRef(const facebook::jsi::WeakObject &obj); + + static JsWeakRef newWeakObjectRef(const facebook::jsi::Object &obj); + static JsValueRef strongObjectRef(const facebook::jsi::WeakObject &obj); + + // Factory methods for creating String/Object + facebook::jsi::String createString(JsValueRef stringRef) const; + facebook::jsi::PropNameID createPropNameID(JsValueRef stringRef); + + template + facebook::jsi::Object createObject(JsValueRef objectRef, T *externalData) + const; + facebook::jsi::Object createObject(JsValueRef objectRef) const; + + facebook::jsi::Object createProxy( + facebook::jsi::Object &&target, + facebook::jsi::Object &&handler) noexcept; + facebook::jsi::Function createProxyConstructor() noexcept; + facebook::jsi::Object createHostObjectProxyHandler() noexcept; + + // Used by factory methods and clone methods + facebook::jsi::Runtime::PointerValue *makeStringValue(JsValueRef str) const; + + template + facebook::jsi::Runtime::PointerValue *makeObjectValue( + JsValueRef obj, + T *externaldata) const; + facebook::jsi::Runtime::PointerValue *makeObjectValue(JsValueRef obj) const; + + facebook::jsi::Runtime::PointerValue *makePropertyIdValue( + JsPropertyIdRef propId) const; + + facebook::jsi::Runtime::PointerValue *makeWeakRefValue(JsWeakRef obj) const; + + // String helpers + static std::wstring JSStringToSTLWString(JsValueRef str); + static std::string JSStringToSTLString(JsValueRef str); + + static JsValueRef createJSString(const char *data, size_t length); + static JsValueRef createJSPropertyId(const char *data, size_t length); + + // Promise Helpers + static void CALLBACK + PromiseContinuationCallback(JsValueRef funcRef, void *callbackState) noexcept; + static void CALLBACK PromiseRejectionTrackerCallback( + JsValueRef promise, + JsValueRef reason, + bool handled, + void *callbackState); + + void PromiseContinuation(JsValueRef value) noexcept; + void + PromiseRejectionTracker(JsValueRef promise, JsValueRef reason, bool handled); + + void setupNativePromiseContinuation() noexcept; + + // Memory tracker helpers + void setupMemoryTracker() noexcept; + + // In-proc debugging helpers + void startDebuggingIfNeeded(); + void stopDebuggingIfNeeded(); + + JsErrorCode enableDebugging( + JsRuntimeHandle runtime, + std::string const &runtimeName, + bool breakOnNextLine, + uint16_t port, + std::unique_ptr &debugProtocolHandler, + std::unique_ptr &debugService); + void ProcessDebuggerCommandQueue(); + + static void CALLBACK ProcessDebuggerCommandQueueCallback(void *callbackState); + + // Version related helpers + static void initRuntimeVersion() noexcept; + static uint64_t getRuntimeVersion() { + return s_runtimeVersion; + } + + // Miscellaneous + std::unique_ptr generatePreparedScript( + const std::string &sourceURL, + const facebook::jsi::Buffer &sourceBuffer) noexcept; + facebook::jsi::Value evaluateJavaScriptSimple( + const facebook::jsi::Buffer &buffer, + const std::string &sourceURL); + bool evaluateSerializedScript( + const facebook::jsi::Buffer &scriptBuffer, + const facebook::jsi::Buffer &serializedScriptBuffer, + const std::string &sourceURL); + static JsValueRef CALLBACK HostFunctionCall( + JsValueRef callee, + bool isConstructCall, + JsValueRef *argumentsIncThis, + unsigned short argumentCountIncThis, + void *callbackState); + + static std::once_flag s_runtimeVersionInitFlag; + static uint64_t s_runtimeVersion; + + // Arguments shared by the specializations + ChakraRuntimeArgs m_args; + + JsRuntimeHandle m_runtime; + JsContextRef m_ctx; + + // Note: For simplicity, We are pinning the script and serialized script + // buffers in the facebook::jsi::Runtime instance assuming as these buffers + // are needed to stay alive for the lifetime of the facebook::jsi::Runtime + // implementation. This approach doesn't make sense for other external buffers + // which may get created during the execution as that will stop the backing + // buffer from getting released when the JSValue gets collected. + + // These buffers are kept to serve the source callbacks when evaluating + // serialized scripts. + std::vector> m_pinnedScripts; + + // These buffers back the external array buffers that we handover to + // ChakraCore. + std::vector> + m_pinnedPreparedScripts; + + static constexpr const char *const s_proxyGetHostObjectTargetPropName = + "$$ProxyGetHostObjectTarget$$"; + static constexpr const char *const s_proxyIsHostObjectPropName = + "$$ProxyIsHostObject$$"; + + std::string m_debugRuntimeName; + int m_debugPort{0}; + std::unique_ptr m_debugProtocolHandler; + std::unique_ptr m_debugService; + constexpr static char DebuggerDefaultRuntimeName[] = "runtime1"; + constexpr static int DebuggerDefaultPort = 9229; +}; + +} // namespace Microsoft::JSI diff --git a/vnext/Chakra/ChakraJsiRuntimeArgs.h b/vnext/JSI/Shared/ChakraRuntimeArgs.h similarity index 72% rename from vnext/Chakra/ChakraJsiRuntimeArgs.h rename to vnext/JSI/Shared/ChakraRuntimeArgs.h index f75f2d7d2e5..84a5b0a3e96 100644 --- a/vnext/Chakra/ChakraJsiRuntimeArgs.h +++ b/vnext/JSI/Shared/ChakraRuntimeArgs.h @@ -5,16 +5,12 @@ #include #include -namespace facebook { -namespace react { +namespace facebook::react { class MemoryTracker; class MessageQueueThread; -} // namespace react -} // namespace facebook +} // namespace facebook::react -namespace facebook { -namespace jsi { -namespace chakraruntime { +namespace Microsoft::JSI { enum class LogLevel { Trace = 0, @@ -26,7 +22,7 @@ enum class LogLevel { using Logger = std::function; -struct ChakraJsiRuntimeArgs { +struct ChakraRuntimeArgs { bool enableJITCompilation{true}; Logger loggingCallback{}; @@ -47,10 +43,8 @@ struct ChakraJsiRuntimeArgs { // Script store which manages script and prepared script storage and // versioning. - std::unique_ptr scriptStore; - std::unique_ptr preparedScriptStore; + std::unique_ptr scriptStore; + std::unique_ptr preparedScriptStore; }; -} // namespace chakraruntime -} // namespace jsi -} // namespace facebook +} // namespace Microsoft::JSI diff --git a/vnext/JSI/Shared/ChakraRuntimeFactory.h b/vnext/JSI/Shared/ChakraRuntimeFactory.h new file mode 100644 index 00000000000..690a4a4e7d2 --- /dev/null +++ b/vnext/JSI/Shared/ChakraRuntimeFactory.h @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#pragma once + +#include + +namespace Microsoft::JSI { + +struct ChakraRuntimeArgs; + +std::unique_ptr makeChakraRuntime( + ChakraRuntimeArgs &&args) noexcept; + +} // namespace Microsoft::JSI diff --git a/vnext/JSI/Shared/JSI.Shared.vcxitems b/vnext/JSI/Shared/JSI.Shared.vcxitems new file mode 100644 index 00000000000..8b4e9d778f4 --- /dev/null +++ b/vnext/JSI/Shared/JSI.Shared.vcxitems @@ -0,0 +1,25 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {0cc28589-39e4-4288-b162-97b959f8b843} + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vnext/JSI/Shared/JSI.Shared.vcxitems.filters b/vnext/JSI/Shared/JSI.Shared.vcxitems.filters new file mode 100644 index 00000000000..9023c2bc4cb --- /dev/null +++ b/vnext/JSI/Shared/JSI.Shared.vcxitems.filters @@ -0,0 +1,30 @@ + + + + + {046a2a6a-2adb-4003-9fa0-f1d9f32dfa74} + + + {878da0c7-597a-4fa6-8af5-0cdf96521a1e} + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + \ No newline at end of file diff --git a/vnext/Chakra/ChakraJsiRuntime_edgemode.cpp b/vnext/JSI/Universal/ChakraJsiRuntime_edgemode.cpp similarity index 68% rename from vnext/Chakra/ChakraJsiRuntime_edgemode.cpp rename to vnext/JSI/Universal/ChakraJsiRuntime_edgemode.cpp index b0af4effc31..4e8f364abb8 100644 --- a/vnext/Chakra/ChakraJsiRuntime_edgemode.cpp +++ b/vnext/JSI/Universal/ChakraJsiRuntime_edgemode.cpp @@ -1,46 +1,90 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -#include "pch.h" - -#include "ChakraJsiRuntime.h" +#include "ChakraRuntime.h" #include "unicode.h" -#if defined(USE_EDGEMODE_JSRT) +#if !defined(CHAKRACORE) #include -namespace facebook { -namespace jsi { -namespace chakraruntime { +namespace Microsoft::JSI { + +JsWeakRef ChakraRuntime::newWeakObjectRef(const facebook::jsi::Object &obj) { + return objectRef(obj); +} + +JsValueRef ChakraRuntime::strongObjectRef( + const facebook::jsi::WeakObject &obj) { + return objectRef(obj); // Return the original strong ref. +} + +JsValueRef ChakraRuntime::createJSString(const char *data, size_t length) { + const std::wstring script16 = facebook::react::unicode::utf8ToUtf16( + reinterpret_cast(data), length); + JsValueRef value; + JsPointerToString(script16.c_str(), script16.size(), &value); + return value; +} + +JsValueRef ChakraRuntime::createJSPropertyId(const char *data, size_t length) { + JsValueRef propIdRef; + const std::wstring name16 = facebook::react::unicode::utf8ToUtf16( + reinterpret_cast(data), length); + if (JsNoError != JsGetPropertyIdFromName(name16.c_str(), &propIdRef)) + std::terminate(); + return propIdRef; +} -void ChakraJsiRuntime::startDebuggingIfNeeded() { +void ChakraRuntime::setupNativePromiseContinuation() noexcept { + // NOP +} + +void ChakraRuntime::startDebuggingIfNeeded() { if (runtimeArgs().enableDebugging) JsStartDebugging(); } -void ChakraJsiRuntime::stopDebuggingIfNeeded() { +void ChakraRuntime::stopDebuggingIfNeeded() { // NOP AFAIK } -JsWeakRef ChakraJsiRuntime::newWeakObjectRef(const jsi::Object &obj) { - return objectRef(obj); +void ChakraRuntime::initRuntimeVersion() noexcept { + // NOP } -JsValueRef ChakraJsiRuntime::strongObjectRef(const jsi::WeakObject &obj) { - return objectRef(obj); // Return the original strong ref. +std::unique_ptr +ChakraRuntime::generatePreparedScript( + const std::string &sourceURL, + const facebook::jsi::Buffer &sourceBuffer) noexcept { + const std::wstring scriptUTF16 = facebook::react::unicode::utf8ToUtf16( + reinterpret_cast(sourceBuffer.data()), sourceBuffer.size()); + + unsigned long bytecodeSize = 0; + if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) == + JsNoError) { + std::unique_ptr bytecodeBuffer( + std::make_unique(bytecodeSize)); + if (JsSerializeScript( + scriptUTF16.c_str(), bytecodeBuffer->data(), &bytecodeSize) == + JsNoError) { + return bytecodeBuffer; + } + } + + return nullptr; } -Value ChakraJsiRuntime::evaluateJavaScriptSimple( - const jsi::Buffer &buffer, +facebook::jsi::Value ChakraRuntime::evaluateJavaScriptSimple( + const facebook::jsi::Buffer &buffer, const std::string &sourceURL) { const std::wstring script16 = facebook::react::unicode::utf8ToUtf16( reinterpret_cast(buffer.data()), buffer.size()); if (script16.empty()) - throw jsi::JSINativeException("Script can't be empty."); + throw facebook::jsi::JSINativeException("Script can't be empty."); const std::wstring url16 = facebook::react::unicode::utf8ToUtf16(sourceURL); if (url16.empty()) - throw jsi::JSINativeException("Script URL can't be empty."); + throw facebook::jsi::JSINativeException("Script URL can't be empty."); JsValueRef result; checkException(JsRunScript( @@ -53,9 +97,9 @@ Value ChakraJsiRuntime::evaluateJavaScriptSimple( } // TODO :: Return result -bool ChakraJsiRuntime::evaluateSerializedScript( - const jsi::Buffer &scriptBuffer, - const jsi::Buffer &serializedScriptBuffer, +bool ChakraRuntime::evaluateSerializedScript( + const facebook::jsi::Buffer &scriptBuffer, + const facebook::jsi::Buffer &serializedScriptBuffer, const std::string &sourceURL) { std::wstring script16 = facebook::react::unicode::utf8ToUtf16( reinterpret_cast(scriptBuffer.data()), scriptBuffer.size()); @@ -80,56 +124,6 @@ bool ChakraJsiRuntime::evaluateSerializedScript( } } -std::unique_ptr ChakraJsiRuntime::generatePreparedScript( - const std::string &sourceURL, - const jsi::Buffer &sourceBuffer) noexcept { - const std::wstring scriptUTF16 = facebook::react::unicode::utf8ToUtf16( - reinterpret_cast(sourceBuffer.data()), sourceBuffer.size()); - - unsigned long bytecodeSize = 0; - if (JsSerializeScript(scriptUTF16.c_str(), nullptr, &bytecodeSize) == - JsNoError) { - std::unique_ptr bytecodeBuffer( - std::make_unique(bytecodeSize)); - if (JsSerializeScript( - scriptUTF16.c_str(), bytecodeBuffer->data(), &bytecodeSize) == - JsNoError) { - return bytecodeBuffer; - } - } - - return nullptr; -} - -JsValueRef ChakraJsiRuntime::createJSString(const char *data, size_t length) { - const std::wstring script16 = facebook::react::unicode::utf8ToUtf16( - reinterpret_cast(data), length); - JsValueRef value; - JsPointerToString(script16.c_str(), script16.size(), &value); - return value; -} - -JsValueRef ChakraJsiRuntime::createJSPropertyId( - const char *data, - size_t length) { - JsValueRef propIdRef; - const std::wstring name16 = facebook::react::unicode::utf8ToUtf16( - reinterpret_cast(data), length); - if (JsNoError != JsGetPropertyIdFromName(name16.c_str(), &propIdRef)) - std::terminate(); - return propIdRef; -} - -void ChakraJsiRuntime::setupNativePromiseContinuation() noexcept { - // NOP -} - -void ChakraJsiRuntime::initRuntimeVersion() noexcept { - // NOP -} - -} // namespace chakraruntime -} // namespace jsi -} // namespace facebook +} // namespace Microsoft::JSI #endif diff --git a/vnext/JSI/Universal/JSI.Universal.vcxproj b/vnext/JSI/Universal/JSI.Universal.vcxproj new file mode 100644 index 00000000000..9a2884e86b1 --- /dev/null +++ b/vnext/JSI/Universal/JSI.Universal.vcxproj @@ -0,0 +1,93 @@ + + + + + Debug + x64 + + + Release + x64 + + + Debug + Win32 + + + Release + Win32 + + + Debug + ARM + + + Release + ARM + + + + {A62D504A-16B8-41D2-9F19-E2E86019E5E4} + JSI.Universal + StaticLibrary + true + Windows Store + 10.0 + + + StaticLibrary + + + + + + + + + + + + + + + + + false + + + $(ReactNativeDir)\ReactCommon;$(ReactNativeDir)\ReactCommon\jsi\;$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(IncludePath) + true + + + + NotUsing + false + true + USE_EDGEMODE_JSRT;%(PreprocessorDefinitions) + + %(AdditionalOptions) /Zc:strictStrings /Zc:twoPhase- + + + false + false + + + + + Disabled + + + + + + + + + + + + \ No newline at end of file diff --git a/vnext/JSI/Universal/JSI.Universal.vcxproj.filters b/vnext/JSI/Universal/JSI.Universal.vcxproj.filters new file mode 100644 index 00000000000..36fbde63864 --- /dev/null +++ b/vnext/JSI/Universal/JSI.Universal.vcxproj.filters @@ -0,0 +1,16 @@ + + + + + {59ab7f90-bfa8-437f-a735-bc96e3241a8f} + + + {cda8c16b-e579-4c8f-9f3d-e4800c32b3d2} + + + + + Source Files + + + \ No newline at end of file diff --git a/vnext/PropertySheets/React.Cpp.props b/vnext/PropertySheets/React.Cpp.props index 06838b085d8..e1908f291f4 100644 --- a/vnext/PropertySheets/React.Cpp.props +++ b/vnext/PropertySheets/React.Cpp.props @@ -10,7 +10,8 @@ - v141 + $(ReactNativeWindows_PlatformToolset) + v141 false Unicode @@ -44,6 +45,7 @@ WIN32_LEAN_AND_MEAN;_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;BOOST_SYSTEM_SOURCE;BOOST_ERROR_CODE_HEADER_ONLY;%(PreprocessorDefinitions) stdcpp17 ProgramDatabase + Guard diff --git a/vnext/PropertySheets/ReactPackageDirectories.props b/vnext/PropertySheets/ReactPackageDirectories.props index 36d424886ad..578bb9a99a2 100644 --- a/vnext/PropertySheets/ReactPackageDirectories.props +++ b/vnext/PropertySheets/ReactPackageDirectories.props @@ -19,11 +19,11 @@ true - $(ReactNativeDir)..\..\node_modules\.folly\folly-2019.08.12.00 + $(ReactNativeDir)..\..\node_modules\.folly\folly-2019.09.30.00 - $(ReactNativeDir)..\..\node_modules\.folly\folly-2019.08.12.00 + $(ReactNativeDir)..\..\node_modules\.folly\folly-2019.09.30.00 diff --git a/vnext/README.md b/vnext/README.md index e50359c6fb6..ad7384381ce 100644 --- a/vnext/README.md +++ b/vnext/README.md @@ -10,7 +10,7 @@ In this `vnext` sub-folder, we are working on a rewrite of `react-native-windows ## Status and roadmap The development of the React Native Windows `vnext` implementation is ongoing. You can take a look at [Milestones](https://github.com/microsoft/react-native-windows/milestones) and [Projects](https://github.com/microsoft/react-native-windows/projects) for a view on the work streams and tasks. -The `vnext` package currently supports `v0.59` of corresponding `react-native` major version. See [releases](./docs/releases.md) for more information on `vnext` release strategy. +The `vnext` package currently supports `v0.60` of corresponding `react-native` major version. See [releases](./docs/releases.md) for more information on `vnext` release strategy. ## Documentation [React Native already has great documentation](https://facebook.github.io/react-native/docs/getting-started.html), and we're working to ensure the React Native Windows is part of that documentation story. Check out the [React documentation](http://facebook.github.io/react/) for further details about the React API in general. diff --git a/vnext/ReactUWP/Base/UwpReactInstance.cpp b/vnext/ReactUWP/Base/UwpReactInstance.cpp index 12194193f77..cf335fbcdba 100644 --- a/vnext/ReactUWP/Base/UwpReactInstance.cpp +++ b/vnext/ReactUWP/Base/UwpReactInstance.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include @@ -52,7 +53,6 @@ #include #include #include -#include #include #include #include @@ -88,7 +88,7 @@ #include #include #else -#include "ChakraJSIRuntimeHolder.h" +#include "ChakraRuntimeHolder.h" #endif #endif @@ -125,6 +125,7 @@ CreateUIManager( viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); + viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); viewManagers.push_back(std::make_unique(instance)); @@ -294,7 +295,7 @@ void UwpReactInstance::Start( m_uiDispatcher); // Objects that must be created on the UI thread - std::shared_ptr deviceInfo = std::make_shared(); + m_deviceInfo = std::make_shared(spThis); std::shared_ptr appstate = std::make_shared(spThis); std::shared_ptr appTheme = @@ -307,7 +308,6 @@ void UwpReactInstance::Start( m_initThread); m_initThread->runOnQueueSync([this, spThis, - deviceInfo, settings, i18nInfo = std::move(i18nInfo), appstate = std::move(appstate), @@ -368,7 +368,7 @@ void UwpReactInstance::Start( GetModules( m_uiManager, m_batchingNativeThread, - deviceInfo, + m_deviceInfo, devSettings, std::move(i18nInfo), std::move(appstate), @@ -415,7 +415,7 @@ void UwpReactInstance::Start( winrt::to_hstring(settings.ByteCodeFileUri)); } devSettings->jsiRuntimeHolder = - std::make_shared( + std::make_shared( devSettings, jsQueue, std::move(scriptStore), @@ -449,11 +449,17 @@ void UwpReactInstance::Start( void UwpReactInstance::AttachMeasuredRootView( IXamlRootView *pRootView, folly::dynamic &&initProps) { - if (!IsInError()) + if (!IsInError()) { m_instanceWrapper->AttachMeasuredRootView(pRootView, std::move(initProps)); + auto rootView = pRootView->GetXamlView().try_as(); + if (rootView) { + m_deviceInfo->attachRoot(rootView); + } + } } void UwpReactInstance::DetachRootView(IXamlRootView *pRootView) { + m_deviceInfo->detachRoot(); m_instanceWrapper->DetachRootView(pRootView); } diff --git a/vnext/ReactUWP/Base/UwpReactInstance.h b/vnext/ReactUWP/Base/UwpReactInstance.h index 67aac3b8fe0..317e3c2d472 100644 --- a/vnext/ReactUWP/Base/UwpReactInstance.h +++ b/vnext/ReactUWP/Base/UwpReactInstance.h @@ -5,6 +5,7 @@ #include +#include #include #include @@ -135,6 +136,7 @@ class UwpReactInstance std::string m_bundleRootPath; ReactInstanceSettings m_reactInstanceSettings; + std::shared_ptr m_deviceInfo; }; } // namespace uwp diff --git a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x64.def b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x64.def index b2ceb1137b8..271bb47b36a 100644 --- a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x64.def +++ b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x64.def @@ -9,6 +9,7 @@ EXPORTS ??0AppStateModule@react@facebook@@QEAA@$$QEAV?$shared_ptr@VAppState@react@facebook@@@std@@@Z ??0ColdClass@cold_detail@folly@@QEAA@XZ ??0DeviceInfoModule@uwp@react@@QEAA@V?$shared_ptr@VDeviceInfo@uwp@react@@@std@@@Z +??0DeviceInfo@uwp@react@@QEAA@AEBV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0ImageViewManager@uwp@react@@QEAA@AEBV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0LocationObserverModule@uwp@react@@QEAA@AEBV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@@Z ??0NativeUIManager@uwp@react@@QEAA@XZ diff --git a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x86.def b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x86.def index 01fb06474e3..c3531b8b2bc 100644 --- a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x86.def +++ b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.oss.x86.def @@ -9,6 +9,7 @@ EXPORTS ??0AppStateModule@react@facebook@@QAE@$$QAV?$shared_ptr@VAppState@react@facebook@@@std@@@Z ??0ColdClass@cold_detail@folly@@QAE@XZ ??0DeviceInfoModule@uwp@react@@QAE@V?$shared_ptr@VDeviceInfo@uwp@react@@@std@@@Z +??0DeviceInfo@uwp@react@@QAE@ABV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0ImageViewManager@uwp@react@@QAE@ABV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0LocationObserverModule@uwp@react@@QAE@ABV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@@Z ??0NativeUIManager@uwp@react@@QAE@XZ diff --git a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x64.def b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x64.def index a1109990277..c2afcb4d394 100644 --- a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x64.def +++ b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x64.def @@ -9,6 +9,7 @@ EXPORTS ??0AppStateModule@react@facebook@@QEAA@$$QEAV?$shared_ptr@VAppState@react@facebook@@@std@@@Z ??0ColdClass@cold_detail@folly@@QEAA@XZ ??0DeviceInfoModule@uwp@react@@QEAA@V?$shared_ptr@VDeviceInfo@uwp@react@@@std@@@Z +??0DeviceInfo@uwp@react@@QEAA@AEBV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0ImageViewManager@uwp@react@@QEAA@AEBV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0LocationObserverModule@uwp@react@@QEAA@AEBV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@@Z ??0NativeUIManager@uwp@react@@QEAA@XZ diff --git a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86.def b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86.def index 97abd596ba8..d472d841888 100644 --- a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86.def +++ b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86.def @@ -9,6 +9,7 @@ EXPORTS ??0AppStateModule@react@facebook@@QAE@$$QAV?$shared_ptr@VAppState@react@facebook@@@std@@@Z ??0ColdClass@cold_detail@folly@@QAE@XZ ??0DeviceInfoModule@uwp@react@@QAE@V?$shared_ptr@VDeviceInfo@uwp@react@@@std@@@Z +??0DeviceInfo@uwp@react@@QAE@ABV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0ImageViewManager@uwp@react@@QAE@ABV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0LocationObserverModule@uwp@react@@QAE@ABV?$shared_ptr@VMessageQueueThread@react@facebook@@@std@@@Z ??0NativeUIManager@uwp@react@@QAE@XZ diff --git a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86sdx.def b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86sdx.def index 8cb749bc086..e9d9f322ba5 100644 --- a/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86sdx.def +++ b/vnext/ReactUWP/EndPoints/dll/react-native-uwp.x86sdx.def @@ -7,6 +7,7 @@ EXPORTS ??$str_to_integral@_J@detail@folly@@YG?AV?$Expected@_JW4ConversionCode@folly@@@1@PAV?$Range@PBD@1@@Z ??0AppState@react@facebook@@QAE@XZ ??0DeviceInfoModule@uwp@react@@QAE@V?$shared_ptr@VDeviceInfo@uwp@react@@@std@@@Z +??0DeviceInfo@uwp@react@@QAE@ABV?$shared_ptr@UIReactInstance@uwp@react@@@std@@@Z ??0LocationObserverModule@uwp@react@@QAE@ABV?$shared_ptr@UIReactContext@oReactNative@@@std@@@Z ??0ModuleProvider@windows@react@@QAE@$$QAU012@@Z ??0ModuleProvider@windows@react@@QAE@PBD$$QAV?$function@$$A6A?AV?$unique_ptr@VCxxModule@module@xplat@facebook@@U?$default_delete@VCxxModule@module@xplat@facebook@@@std@@@std@@XZ@std@@ABV?$shared_ptr@VMessageQueueThread@react@facebook@@@4@@Z diff --git a/vnext/ReactUWP/Modules/Animated/AnimationDriver.cpp b/vnext/ReactUWP/Modules/Animated/AnimationDriver.cpp index a7b9eff3fa7..0cb0cfe4d9b 100644 --- a/vnext/ReactUWP/Modules/Animated/AnimationDriver.cpp +++ b/vnext/ReactUWP/Modules/Animated/AnimationDriver.cpp @@ -49,17 +49,20 @@ void AnimationDriver::StartAnimation() { m_scopedBatchCompletedToken = scopedBatch.Completed([EndCallback = m_endCallback, - Manager = m_manager, + weakManager = m_manager, valueTag = m_animatedValueTag, id = m_id](auto sender, auto) { if (EndCallback) { EndCallback(std::vector{ folly::dynamic::object("finished", true)}); } - if (auto man = Manager.lock()) { - if (auto const animatedValue = man->GetValueAnimatedNode(valueTag)) { + if (auto manager = weakManager.lock()) { + if (auto const animatedValue = + manager->GetValueAnimatedNode(valueTag)) { animatedValue->RemoveActiveAnimation(id); + animatedValue->FlattenOffset(); } + manager->RevmoveActiveAnimation(id); } }); diff --git a/vnext/ReactUWP/Modules/Animated/DecayAnimationDriver.cpp b/vnext/ReactUWP/Modules/Animated/DecayAnimationDriver.cpp index 0953b5d654b..700c43c0bc5 100644 --- a/vnext/ReactUWP/Modules/Animated/DecayAnimationDriver.cpp +++ b/vnext/ReactUWP/Modules/Animated/DecayAnimationDriver.cpp @@ -50,8 +50,13 @@ DecayAnimationDriver::MakeAnimation(const folly::dynamic &config) { s_decelerationParameterName + L" * " + s_durationName + L" * " + s_durationName + L")", compositor.CreateCubicBezierEasingFunction({0, 1}, {0, 1})); - animation.IterationCount(static_cast(m_iterations)); - animation.IterationBehavior(winrt::AnimationIterationBehavior::Count); + + if (m_iterations == -1) { + animation.IterationBehavior(winrt::AnimationIterationBehavior::Forever); + } else { + animation.IterationCount(static_cast(m_iterations)); + animation.IterationBehavior(winrt::AnimationIterationBehavior::Count); + } return std::make_tuple(animation, scopedBatch); } diff --git a/vnext/ReactUWP/Modules/Animated/FrameAnimationDriver.cpp b/vnext/ReactUWP/Modules/Animated/FrameAnimationDriver.cpp index 56a9e7a9f08..844c20ad8da 100644 --- a/vnext/ReactUWP/Modules/Animated/FrameAnimationDriver.cpp +++ b/vnext/ReactUWP/Modules/Animated/FrameAnimationDriver.cpp @@ -43,11 +43,15 @@ FrameAnimationDriver::MakeAnimation(const folly::dynamic &config) { normalizedProgress = std::min(normalizedProgress += step, 1.0f); animation.InsertKeyFrame( normalizedProgress, - static_cast(fromValue + (frame * (m_toValue - fromValue)))); + static_cast(frame * (m_toValue - fromValue))); } - animation.IterationCount(static_cast(m_iterations)); - animation.IterationBehavior(winrt::AnimationIterationBehavior::Count); + if (m_iterations == -1) { + animation.IterationBehavior(winrt::AnimationIterationBehavior::Forever); + } else { + animation.IterationCount(static_cast(m_iterations)); + animation.IterationBehavior(winrt::AnimationIterationBehavior::Count); + } return std::make_tuple(animation, scopedBatch); } diff --git a/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.cpp b/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.cpp index 0576b89cd4f..d8f66bbc794 100644 --- a/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.cpp +++ b/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.cpp @@ -464,5 +464,9 @@ TrackingAnimatedNode *NativeAnimatedNodeManager::GetTrackingAnimatedNode( } return nullptr; } + +void NativeAnimatedNodeManager::RevmoveActiveAnimation(int64_t tag) { + m_activeAnimations.erase(tag); +} } // namespace uwp } // namespace react diff --git a/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.h b/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.h index 1433e2f52d1..77cf7908a51 100644 --- a/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.h +++ b/vnext/ReactUWP/Modules/Animated/NativeAnimatedNodeManager.h @@ -93,6 +93,7 @@ class NativeAnimatedNodeManager { StyleAnimatedNode *GetStyleAnimatedNode(int64_t tag); TransformAnimatedNode *GetTransformAnimatedNode(int64_t tag); TrackingAnimatedNode *GetTrackingAnimatedNode(int64_t tag); + void RevmoveActiveAnimation(int64_t tag); private: std::unordered_map> diff --git a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp index 4680baf7774..702d1e7be71 100644 --- a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp @@ -117,9 +117,31 @@ void PropsAnimatedNode::StartAnimations() { void PropsAnimatedNode::DisposeCompletedAnimation(int64_t valueTag) { if (m_expressionAnimations.count(valueTag)) { if (const auto target = GetUIElement()) { - target.StopAnimation(m_expressionAnimations.at(valueTag)); + // We should start and stop the expression animtaions if there are + // no active animations. Suspending the active expression animations + // while they are not in use causes subsequent key frame animations + // which target the providing property set to never fire their completed + // events. I can't explain this and for now and commenting out the code. + // Fixing this will prevent memory bloat as the current solutions never + // stops the expression animations that are built as a part of this + // animation solution. Tracked by issue #3280. + // target.StopAnimation(m_expressionAnimations.at(valueTag)); + m_suspendedExpressionAnimationTags.push_back(valueTag); + } + } +} + +void PropsAnimatedNode::ResumeSuspendedAnimations(int64_t valueTag) { + const auto iterator = std::find( + m_suspendedExpressionAnimationTags.begin(), + m_suspendedExpressionAnimationTags.end(), + valueTag); + if (iterator != m_suspendedExpressionAnimationTags.end()) { + if (const auto target = GetUIElement()) { + // See comment above, tracked by issue #3280 + // target.StartAnimation(m_expressionAnimations.at(valueTag)); + m_suspendedExpressionAnimationTags.erase(iterator); } - m_expressionAnimations.erase(valueTag); } } diff --git a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h index 98d3c2cb1f3..ed5afcbf869 100644 --- a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h +++ b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h @@ -24,6 +24,7 @@ class PropsAnimatedNode : public AnimatedNode { void UpdateView(); void StartAnimations(); void DisposeCompletedAnimation(int64_t valueTag); + void ResumeSuspendedAnimations(int64_t valueTag); private: void MakeAnimation(int64_t valueNodeTag, FacadeType facadeType); @@ -39,6 +40,7 @@ class PropsAnimatedNode : public AnimatedNode { int64_t, winrt::Windows::UI::Composition::CompositionAnimation> m_expressionAnimations{}; + std::vector m_suspendedExpressionAnimationTags{}; winrt::Windows::UI::Composition::ExpressionAnimation m_centerPointAnimation{ nullptr}; winrt::Numerics::float3 m_rotationAxis{0, 0, 1}; diff --git a/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp b/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp index 16e3a46ed3e..0faa168a4fc 100644 --- a/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp +++ b/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp @@ -87,8 +87,13 @@ SpringAnimationDriver::MakeAnimation(const folly::dynamic &config) { std::min(normalizedProgress + 1.0f / keyFrames.size(), 1.0f); animation.InsertKeyFrame(normalizedProgress, keyFrame, easingFunction); } - animation.IterationCount(static_cast(m_iterations)); - animation.IterationBehavior(winrt::AnimationIterationBehavior::Count); + + if (m_iterations == -1) { + animation.IterationBehavior(winrt::AnimationIterationBehavior::Forever); + } else { + animation.IterationCount(static_cast(m_iterations)); + animation.IterationBehavior(winrt::AnimationIterationBehavior::Count); + } return std::make_tuple(animation, scopedBatch); } diff --git a/vnext/ReactUWP/Modules/Animated/ValueAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/ValueAnimatedNode.cpp index 3177891d402..9d8a004830f 100644 --- a/vnext/ReactUWP/Modules/Animated/ValueAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/ValueAnimatedNode.cpp @@ -87,6 +87,14 @@ void ValueAnimatedNode::RemoveDependentPropsNode(int64_t propsNodeTag) { void ValueAnimatedNode::AddActiveAnimation(int64_t animationTag) { m_activeAnimations.insert(animationTag); + if (m_activeAnimations.size() == 1) { + if (const auto manager = m_manager.lock()) { + for (const auto &props : m_dependentPropsNodes) { + if (const auto propsNode = manager->GetPropsAnimatedNode(props)) + propsNode->ResumeSuspendedAnimations(Tag()); + } + } + } } void ValueAnimatedNode::RemoveActiveAnimation(int64_t animationTag) { diff --git a/vnext/ReactUWP/Modules/DeviceInfoModule.cpp b/vnext/ReactUWP/Modules/DeviceInfoModule.cpp index 2c985c44333..90c8d639490 100644 --- a/vnext/ReactUWP/Modules/DeviceInfoModule.cpp +++ b/vnext/ReactUWP/Modules/DeviceInfoModule.cpp @@ -13,6 +13,10 @@ namespace uwp { // // DeviceInfo // +DeviceInfo::DeviceInfo(const std::shared_ptr &reactInstance) + : m_wkReactInstance(reactInstance) { + update(); +} void DeviceInfo::update() { auto displayInfo = winrt::Windows::Graphics::Display::DisplayInformation:: @@ -21,7 +25,6 @@ void DeviceInfo::update() { auto const &window = winrt::Windows::UI::Xaml::Window::Current().CoreWindow(); - // TODO: get parent element (not window) size m_dimensions = folly::dynamic::object( "windowPhysicalPixels", folly::dynamic::object("width", window.Bounds().Width)( @@ -37,6 +40,40 @@ void DeviceInfo::update() { "densityDpi", displayInfo.LogicalDpi())); } +void DeviceInfo::updateRootElementSize(float width, float height) { + m_dimensions["windowPhysicalPixels"]["width"] = width; + m_dimensions["windowPhysicalPixels"]["height"] = height; + fireEvent(); +} + +void DeviceInfo::fireEvent() { + auto instance = m_wkReactInstance.lock(); + if (instance) { + instance->CallJsFunction( + "RCTDeviceEventEmitter", + "emit", + folly::dynamic::array( + "didUpdateDimensions", std::move(GetDimensionsConstants()))); + } +} + +void DeviceInfo::attachRoot(winrt::FrameworkElement rootElement) { + m_rootElement = winrt::make_weak(rootElement); + m_sizeChangedRevoker = + rootElement.SizeChanged(winrt::auto_revoke, [this](auto &&, auto &&) { + if (const auto root = m_rootElement.get()) { + updateRootElementSize( + static_cast(root.ActualWidth()), + static_cast(root.ActualHeight())); + } + }); +} + +void DeviceInfo::detachRoot() { + m_sizeChangedRevoker = {}; + m_rootElement = {}; +} + // // DeviceInfoModule // diff --git a/vnext/ReactUWP/Modules/DeviceInfoModule.h b/vnext/ReactUWP/Modules/DeviceInfoModule.h index 42040e64393..64c4450649b 100644 --- a/vnext/ReactUWP/Modules/DeviceInfoModule.h +++ b/vnext/ReactUWP/Modules/DeviceInfoModule.h @@ -3,8 +3,10 @@ #pragma once +#include #include #include +#include #include #include @@ -14,17 +16,23 @@ namespace uwp { // TODO: Emit event to react when dimensions change. class DeviceInfo { public: - DeviceInfo() { - update(); - } + DeviceInfo(const std::shared_ptr &reactInstance); folly::dynamic GetDimensionsConstants() { return m_dimensions; } void update(); + void updateRootElementSize(float width, float height); + void attachRoot(const winrt::Windows::UI::Xaml::FrameworkElement rootElement); + void detachRoot(); private: + void fireEvent(); folly::dynamic m_dimensions; + winrt::weak_ref m_rootElement{}; + winrt::Windows::UI::Xaml::FrameworkElement::SizeChanged_revoker + m_sizeChangedRevoker; + std::weak_ptr m_wkReactInstance; }; class DeviceInfoModule : public facebook::xplat::module::CxxModule { diff --git a/vnext/ReactUWP/ReactUWP.vcxproj b/vnext/ReactUWP/ReactUWP.vcxproj index 341ba10babd..f6249c6fcc1 100644 --- a/vnext/ReactUWP/ReactUWP.vcxproj +++ b/vnext/ReactUWP/ReactUWP.vcxproj @@ -261,6 +261,7 @@ + @@ -359,6 +360,7 @@ + @@ -406,6 +408,12 @@ {a990658c-ce31-4bcc-976f-0fc6b1af693d} + + {a62d504a-16b8-41d2-9f19-e2e86019e5e4} + + + {17DD1B17-3094-40DD-9373-AC2497932ECA} + {a9d95a91-4db7-4f72-beb6-fe8a5c89bfbd} @@ -427,8 +435,8 @@ - - + + @@ -436,8 +444,8 @@ - - + + diff --git a/vnext/ReactUWP/ReactUWP.vcxproj.filters b/vnext/ReactUWP/ReactUWP.vcxproj.filters index 546f322ab56..b5b6029b5f5 100644 --- a/vnext/ReactUWP/ReactUWP.vcxproj.filters +++ b/vnext/ReactUWP/ReactUWP.vcxproj.filters @@ -295,6 +295,12 @@ Threading + + Modules + + + Views + @@ -630,6 +636,12 @@ Utils + + Views + + + Modules + diff --git a/vnext/ReactUWP/Utils/PropertyUtils.h b/vnext/ReactUWP/Utils/PropertyUtils.h index 24f2abd5121..7a80d78ba60 100644 --- a/vnext/ReactUWP/Utils/PropertyUtils.h +++ b/vnext/ReactUWP/Utils/PropertyUtils.h @@ -145,17 +145,14 @@ bool TryUpdateBackgroundBrush( return false; } -inline void SetCornerRadiusValueOnNode( +inline void UpdateCornerRadiusValueOnNode( ShadowNodeBase *node, ShadowCorners corner, - double newValue) { - node->m_cornerRadius[corner] = newValue; -} - -inline void ClearCornerRadiusValueOnNode( - ShadowNodeBase *node, - ShadowCorners corner) { - node->m_cornerRadius[corner] = c_UndefinedEdge; + const folly::dynamic &propertyValue) { + if (propertyValue.isNumber()) + node->m_cornerRadius[corner] = propertyValue.asDouble(); + else + node->m_cornerRadius[corner] = c_UndefinedEdge; } template @@ -286,60 +283,28 @@ bool TryUpdateCornerRadiusOnNode( const std::string &propertyName, const folly::dynamic &propertyValue) { if (propertyName == "borderTopLeftRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::TopLeft, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::TopLeft); + UpdateCornerRadiusValueOnNode(node, ShadowCorners::TopLeft, propertyValue); } else if (propertyName == "borderTopRightRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::TopRight, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::TopRight); - } - if (propertyName == "borderTopStartRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::TopStart, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::TopStart); + UpdateCornerRadiusValueOnNode(node, ShadowCorners::TopRight, propertyValue); + } else if (propertyName == "borderTopStartRadius") { + UpdateCornerRadiusValueOnNode(node, ShadowCorners::TopStart, propertyValue); } else if (propertyName == "borderTopEndRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::TopEnd, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::TopEnd); + UpdateCornerRadiusValueOnNode(node, ShadowCorners::TopEnd, propertyValue); } else if (propertyName == "borderBottomRightRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::BottomRight, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::BottomRight); + UpdateCornerRadiusValueOnNode( + node, ShadowCorners::BottomRight, propertyValue); } else if (propertyName == "borderBottomLeftRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::BottomLeft, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::BottomLeft); + UpdateCornerRadiusValueOnNode( + node, ShadowCorners::BottomLeft, propertyValue); } else if (propertyName == "borderBottomStartRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::BottomStart, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::BottomStart); + UpdateCornerRadiusValueOnNode( + node, ShadowCorners::BottomStart, propertyValue); } else if (propertyName == "borderBottomEndRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::BottomEnd, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::BottomEnd); + UpdateCornerRadiusValueOnNode( + node, ShadowCorners::BottomEnd, propertyValue); } else if (propertyName == "borderRadius") { - if (propertyValue.isNumber()) - SetCornerRadiusValueOnNode( - node, ShadowCorners::AllCorners, propertyValue.asDouble()); - else - ClearCornerRadiusValueOnNode(node, ShadowCorners::AllCorners); + UpdateCornerRadiusValueOnNode( + node, ShadowCorners::AllCorners, propertyValue); } else { return false; } diff --git a/vnext/ReactUWP/Views/SliderViewManager.cpp b/vnext/ReactUWP/Views/SliderViewManager.cpp new file mode 100644 index 00000000000..da009a15af7 --- /dev/null +++ b/vnext/ReactUWP/Views/SliderViewManager.cpp @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#include "pch.h" + +#include +#include "SliderViewManager.h" + +#include + +#include + +#include + +namespace winrt { +using ToggleButton = Windows::UI::Xaml::Controls::Primitives::ToggleButton; +} + +namespace react { +namespace uwp { + +class SliderShadowNode : public ShadowNodeBase { + using Super = ShadowNodeBase; + + public: + SliderShadowNode() = default; + void createView() override; + void updateProperties(const folly::dynamic &&props) override; +}; + +void SliderShadowNode::createView() { + Super::createView(); + + auto slider = GetView().as(); + auto wkinstance = GetViewManager()->GetReactInstance(); +} + +void SliderShadowNode::updateProperties(const folly::dynamic &&props) { + m_updating = true; + Super::updateProperties(std::move(props)); + m_updating = false; +} + +SliderViewManager::SliderViewManager( + const std::shared_ptr &reactInstance) + : Super(reactInstance) {} + +const char *SliderViewManager::GetName() const { + return "RCTSlider"; +} + +folly::dynamic SliderViewManager::GetNativeProps() const { + auto props = Super::GetNativeProps(); + + props.update( + folly::dynamic::object("value", "integer")("disabled", "boolean")); + + return props; +} + +facebook::react::ShadowNode *SliderViewManager::createShadow() const { + return new SliderShadowNode(); +} + +XamlView SliderViewManager::CreateViewCore(int64_t tag) { + auto slider = winrt::Slider(); + slider.MinHeight(100); + return slider; +} + +void SliderViewManager::UpdateProperties( + ShadowNodeBase *nodeToUpdate, + const folly::dynamic &reactDiffMap) { + auto slider = nodeToUpdate->GetView().as(); + if (slider == nullptr) + return; + + for (const auto &pair : reactDiffMap.items()) { + const std::string &propertyName = pair.first.getString(); + const folly::dynamic &propertyValue = pair.second; + + if (propertyName == "disabled") { + if (propertyValue.isBool()) + slider.IsEnabled(!propertyValue.asBool()); + else if (pair.second.isNull()) + slider.ClearValue(winrt::Control::IsEnabledProperty()); + } + else if (propertyName == "value") { + if (propertyValue.isNumber()) + slider.Value(static_cast(propertyValue.asDouble())); + else if (pair.second.isNull()) + slider.Value(0); + } + } + + Super::UpdateProperties(nodeToUpdate, reactDiffMap); +} + +} // namespace uwp +} // namespace react diff --git a/vnext/ReactUWP/Views/SliderViewManager.h b/vnext/ReactUWP/Views/SliderViewManager.h new file mode 100644 index 00000000000..830a50db344 --- /dev/null +++ b/vnext/ReactUWP/Views/SliderViewManager.h @@ -0,0 +1,34 @@ +#pragma once +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#pragma once + +#include + +namespace react { +namespace uwp { + +class SliderViewManager : public ControlViewManager { + using Super = ControlViewManager; + + public: + SliderViewManager(const std::shared_ptr &reactInstance); + + const char *GetName() const override; + folly::dynamic GetNativeProps() const override; + + facebook::react::ShadowNode *createShadow() const override; + + void UpdateProperties( + ShadowNodeBase *nodeToUpdate, + const folly::dynamic &reactDiffMap) override; + + protected: + XamlView CreateViewCore(int64_t tag) override; + + friend class SliderShadowNode; +}; + +} // namespace uwp +} // namespace react diff --git a/vnext/ReactUWP/Views/TextInputViewManager.cpp b/vnext/ReactUWP/Views/TextInputViewManager.cpp index 57179cd740e..8916e2168c4 100644 --- a/vnext/ReactUWP/Views/TextInputViewManager.cpp +++ b/vnext/ReactUWP/Views/TextInputViewManager.cpp @@ -105,6 +105,7 @@ class TextInputShadowNode : public ShadowNodeBase { void registerEvents(); bool m_shouldClearTextOnFocus = false; bool m_shouldSelectTextOnFocus = false; + bool m_contextMenuHidden = false; bool m_isTextBox = true; // Javascripts is running in a different thread. If the typing is very fast, @@ -118,14 +119,18 @@ class TextInputShadowNode : public ShadowNodeBase { winrt::TextBox::TextChanging_revoker m_textBoxTextChangingRevoker{}; winrt::TextBox::TextChanged_revoker m_textBoxTextChangedRevoker{}; winrt::TextBox::SelectionChanged_revoker m_textBoxSelectionChangedRevoker{}; + winrt::TextBox::ContextMenuOpening_revoker + m_textBoxContextMenuOpeningRevoker{}; winrt::PasswordBox::PasswordChanging_revoker m_passwordBoxPasswordChangingRevoker{}; winrt::PasswordBox::PasswordChanged_revoker m_passwordBoxPasswordChangedRevoker{}; + winrt::PasswordBox::ContextMenuOpening_revoker + m_passwordBoxContextMenuOpeningRevoker{}; - winrt::TextBox::GotFocus_revoker m_controlGotFocusRevoker{}; - winrt::TextBox::LostFocus_revoker m_controlLostFocusRevoker{}; + winrt::Control::GotFocus_revoker m_controlGotFocusRevoker{}; + winrt::Control::LostFocus_revoker m_controlLostFocusRevoker{}; winrt::Control::SizeChanged_revoker m_controlSizeChangedRevoker{}; winrt::Control::CharacterReceived_revoker m_controlCharacterReceivedRevoker{}; winrt::ScrollViewer::ViewChanging_revoker m_scrollViewerViewChangingRevoker{}; @@ -195,6 +200,26 @@ void TextInputShadowNode::registerEvents() { }); } + if (m_isTextBox) { + m_passwordBoxContextMenuOpeningRevoker = {}; + auto textBox = control.as(); + m_textBoxContextMenuOpeningRevoker = textBox.ContextMenuOpening( + winrt::auto_revoke, [=](auto &&, winrt::ContextMenuEventArgs const &e) { + if (m_contextMenuHidden) { + e.Handled(true); + } + }); + } else { + m_textBoxContextMenuOpeningRevoker = {}; + auto passwordBox = control.as(); + m_passwordBoxContextMenuOpeningRevoker = passwordBox.ContextMenuOpening( + winrt::auto_revoke, [=](auto &&, winrt::ContextMenuEventArgs const &e) { + if (m_contextMenuHidden) { + e.Handled(true); + } + }); + } + m_controlGotFocusRevoker = control.GotFocus(winrt::auto_revoke, [=](auto &&, auto &&) { if (m_shouldClearTextOnFocus) { @@ -357,6 +382,9 @@ void TextInputShadowNode::updateProperties(const folly::dynamic &&props) { if (propertyValue.isNumber()) { m_mostRecentEventCount = static_cast(propertyValue.asInt()); } + } else if (propertyName == "contextMenuHidden") { + if (propertyValue.isBool()) + m_contextMenuHidden = propertyValue.asBool(); } else if (propertyName == "secureTextEntry") { if (propertyValue.isBool()) { if (propertyValue.asBool()) { @@ -527,7 +555,8 @@ folly::dynamic TextInputViewManager::GetNativeProps() const { "selection", "Map")("selectionColor", "Color")( "selectTextOnFocus", "boolean")("spellCheck", "boolean")( "text", "string")("mostRecentEventCount", "int")( - "secureTextEntry", "boolean")("keyboardType", "string")); + "secureTextEntry", "boolean")("keyboardType", "string")( + "contextMenuHidden", "boolean")); return props; } diff --git a/vnext/ReactUWP/Views/WebViewManager.cpp b/vnext/ReactUWP/Views/WebViewManager.cpp index 26fe61a16de..751f4505fbf 100644 --- a/vnext/ReactUWP/Views/WebViewManager.cpp +++ b/vnext/ReactUWP/Views/WebViewManager.cpp @@ -37,7 +37,11 @@ const char *WebViewManager::GetName() const { } XamlView WebViewManager::CreateViewCore(int64_t tag) { +#ifdef CHAKRACORE_UWP + return winrt::WebView(winrt::WebViewExecutionMode::SeparateProcess); +#else return winrt::WebView(); +#endif } void WebViewManager::UpdateProperties( diff --git a/vnext/ReactUWP/packages.config b/vnext/ReactUWP/packages.config index 84fd7ff9dfb..1d568dbd195 100644 --- a/vnext/ReactUWP/packages.config +++ b/vnext/ReactUWP/packages.config @@ -2,6 +2,6 @@ - - + + \ No newline at end of file diff --git a/vnext/ReactWindows-Desktop.sln b/vnext/ReactWindows-Desktop.sln index 9ae883f5c35..6db46953fde 100644 --- a/vnext/ReactWindows-Desktop.sln +++ b/vnext/ReactWindows-Desktop.sln @@ -107,8 +107,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "React.Windows.Desktop.Test. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Include", "include\Include.vcxitems", "{EF074BA1-2D54-4D49-A28E-5E040B47CD2E}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Shared", "JSI\Shared\JSI.Shared.vcxitems", "{0CC28589-39E4-4288-B162-97B959F8B843}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Desktop", "JSI\Desktop\JSI.Desktop.vcxproj", "{17DD1B17-3094-40DD-9373-AC2497932ECA}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution + JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9 + JSI\Shared\JSI.Shared.vcxitems*{17dd1b17-3094-40dd-9373-ac2497932eca}*SharedItemsImports = 4 Shared\Shared.vcxitems*{2049dbe9-8d13-42c9-ae4b-413ae38fffd0}*SharedItemsImports = 9 Chakra\Chakra.vcxitems*{6f354505-fe3a-4bd2-a9a6-d12bbf37a85c}*SharedItemsImports = 4 Shared\Shared.vcxitems*{6f354505-fe3a-4bd2-a9a6-d12bbf37a85c}*SharedItemsImports = 4 @@ -230,6 +236,14 @@ Global {473FE8E8-26DA-4B46-A7B3-7B4A758075D0}.Release|x64.Build.0 = Release|x64 {473FE8E8-26DA-4B46-A7B3-7B4A758075D0}.Release|x86.ActiveCfg = Release|Win32 {473FE8E8-26DA-4B46-A7B3-7B4A758075D0}.Release|x86.Build.0 = Release|Win32 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Debug|x64.ActiveCfg = Debug|x64 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Debug|x64.Build.0 = Debug|x64 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Debug|x86.ActiveCfg = Debug|Win32 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Debug|x86.Build.0 = Debug|Win32 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Release|x64.ActiveCfg = Release|x64 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Release|x64.Build.0 = Release|x64 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Release|x86.ActiveCfg = Release|Win32 + {17DD1B17-3094-40DD-9373-AC2497932ECA}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/vnext/ReactWindows-Universal.sln b/vnext/ReactWindows-Universal.sln index e1e3fc3e12e..59dd4780ca2 100644 --- a/vnext/ReactWindows-Universal.sln +++ b/vnext/ReactWindows-Universal.sln @@ -81,10 +81,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ReactNative", "ReactNative" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Folly", "Folly", "{41F31595-2F20-4D6B-A6CF-60444415012A}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Universal", "JSI\Universal\JSI.Universal.vcxproj", "{A62D504A-16B8-41D2-9F19-E2E86019E5E4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "JSI.Shared", "JSI\Shared\JSI.Shared.vcxitems", "{0CC28589-39E4-4288-B162-97B959F8B843}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution + JSI\Shared\JSI.Shared.vcxitems*{0cc28589-39e4-4288-b162-97b959f8b843}*SharedItemsImports = 9 Chakra\Chakra.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4 Shared\Shared.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4 + JSI\Shared\JSI.Shared.vcxitems*{a62d504a-16b8-41d2-9f19-e2e86019e5e4}*SharedItemsImports = 4 Chakra\Chakra.vcxitems*{c38970c0-5fbf-4d69-90d8-cbac225ae895}*SharedItemsImports = 9 EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -188,6 +194,18 @@ Global {700A84FD-F92A-43F1-8D06-B0E0745DF9B5}.Release|x64.Build.0 = Release|x64 {700A84FD-F92A-43F1-8D06-B0E0745DF9B5}.Release|x86.ActiveCfg = Release|Win32 {700A84FD-F92A-43F1-8D06-B0E0745DF9B5}.Release|x86.Build.0 = Release|Win32 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.ActiveCfg = Debug|ARM + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|ARM.Build.0 = Debug|ARM + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.ActiveCfg = Debug|x64 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x64.Build.0 = Debug|x64 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.ActiveCfg = Debug|Win32 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Debug|x86.Build.0 = Debug|Win32 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.ActiveCfg = Release|ARM + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|ARM.Build.0 = Release|ARM + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.ActiveCfg = Release|x64 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x64.Build.0 = Release|x64 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.ActiveCfg = Release|Win32 + {A62D504A-16B8-41D2-9F19-E2E86019E5E4}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/vnext/ReactWindowsCore/ChakraJSIRuntimeHolder.cpp b/vnext/ReactWindowsCore/ChakraRuntimeHolder.cpp similarity index 65% rename from vnext/ReactWindowsCore/ChakraJSIRuntimeHolder.cpp rename to vnext/ReactWindowsCore/ChakraRuntimeHolder.cpp index 2529ed907c2..2f354aeb1c9 100644 --- a/vnext/ReactWindowsCore/ChakraJSIRuntimeHolder.cpp +++ b/vnext/ReactWindowsCore/ChakraRuntimeHolder.cpp @@ -1,37 +1,31 @@ #include "pch.h" -#include "ChakraJSIRuntimeHolder.h" +#include "ChakraRuntimeHolder.h" -#include +#include -using namespace facebook; -using namespace facebook::react; -using namespace facebook::jsi::chakraruntime; - -namespace facebook { -namespace react { +namespace Microsoft::JSI { std::shared_ptr -ChakraJSIRuntimeHolder::getRuntime() noexcept { +ChakraRuntimeHolder::getRuntime() noexcept { std::call_once(once_flag_, [this]() { initRuntime(); }); if (!runtime_) std::terminate(); - // ChakraJsiRuntime is not thread safe as of now. + // ChakraRuntime is not thread safe as of now. if (own_thread_id_ != std::this_thread::get_id()) std::terminate(); return runtime_; } -void ChakraJSIRuntimeHolder::initRuntime() noexcept { - runtime_ = - facebook::jsi::chakraruntime::makeChakraJsiRuntime(std::move(args_)); +void ChakraRuntimeHolder::initRuntime() noexcept { + runtime_ = Microsoft::JSI::makeChakraRuntime(std::move(args_)); own_thread_id_ = std::this_thread::get_id(); } -Logger ChakraJSIRuntimeHolder::ChakraRuntimeLoggerFromReactLogger( +Logger ChakraRuntimeHolder::ChakraRuntimeLoggerFromReactLogger( facebook::react::NativeLoggingHook loggingCallback) noexcept { return [loggingCallback = std::move(loggingCallback)]( const char *message, LogLevel logLevel) -> void { @@ -40,9 +34,9 @@ Logger ChakraJSIRuntimeHolder::ChakraRuntimeLoggerFromReactLogger( }; } -ChakraJsiRuntimeArgs ChakraJSIRuntimeHolder::RuntimeArgsFromDevSettings( +ChakraRuntimeArgs ChakraRuntimeHolder::RuntimeArgsFromDevSettings( std::shared_ptr devSettings) noexcept { - ChakraJsiRuntimeArgs runtimeArgs; + ChakraRuntimeArgs runtimeArgs; runtimeArgs.debuggerBreakOnNextLine = devSettings->debuggerBreakOnNextLine; runtimeArgs.debuggerPort = devSettings->debuggerPort; @@ -65,5 +59,4 @@ ChakraJsiRuntimeArgs ChakraJSIRuntimeHolder::RuntimeArgsFromDevSettings( return runtimeArgs; } -} // namespace react -} // namespace facebook +} // namespace Microsoft::JSI diff --git a/vnext/ReactWindowsCore/ChakraJSIRuntimeHolder.h b/vnext/ReactWindowsCore/ChakraRuntimeHolder.h similarity index 69% rename from vnext/ReactWindowsCore/ChakraJSIRuntimeHolder.h rename to vnext/ReactWindowsCore/ChakraRuntimeHolder.h index 2a31aa7166c..5e3aaccdfcd 100644 --- a/vnext/ReactWindowsCore/ChakraJSIRuntimeHolder.h +++ b/vnext/ReactWindowsCore/ChakraRuntimeHolder.h @@ -5,18 +5,17 @@ #include #include -#include +#include #include -namespace facebook { -namespace react { +namespace Microsoft::JSI { -class ChakraJSIRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit { +class ChakraRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit { public: std::shared_ptr getRuntime() noexcept override; - ChakraJSIRuntimeHolder( + ChakraRuntimeHolder( std::shared_ptr devSettings, std::shared_ptr jsQueue, std::unique_ptr &&scriptStore, @@ -29,19 +28,18 @@ class ChakraJSIRuntimeHolder : public facebook::jsi::RuntimeHolderLazyInit { } private: - facebook::jsi::chakraruntime::ChakraJsiRuntimeArgs RuntimeArgsFromDevSettings( + Microsoft::JSI::ChakraRuntimeArgs RuntimeArgsFromDevSettings( std::shared_ptr devSettings) noexcept; - facebook::jsi::chakraruntime::Logger ChakraRuntimeLoggerFromReactLogger( + Microsoft::JSI::Logger ChakraRuntimeLoggerFromReactLogger( facebook::react::NativeLoggingHook loggingCallback) noexcept; void initRuntime() noexcept; - facebook::jsi::chakraruntime::ChakraJsiRuntimeArgs args_; + Microsoft::JSI::ChakraRuntimeArgs args_; std::shared_ptr runtime_; std::once_flag once_flag_; std::thread::id own_thread_id_; }; -} // namespace react -} // namespace facebook +} // namespace Microsoft::JSI diff --git a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj index d1e94c47137..534212da01e 100644 --- a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj +++ b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj @@ -75,8 +75,8 @@ ENABLE_JS_SYSTRACE;WITH_FBSYSTRACE;%(PreprocessorDefinitions) ENABLE_TRACE_POSTPROCESSING;%(PreprocessorDefinitions) $(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir);$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeDir)\ReactCommon;$(ReactNativeDir)\ReactCommon\jsi;$(ReactNativeWindowsDir)stubs;$(FollyDir);$(ReactNativeWindowsDir)\ReactWindowsCore\tracing;$(ProjectDir);$(GeneratedFilesDir);$(IntDir);%(AdditionalIncludeDirectories) - $(SolutionDir)packages\ReactNative.Hermes.Windows.0.1.1\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories) - $(SolutionDir)packages\ReactNative.V8JSI.Windows.0.1.3\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories) + $(SolutionDir)packages\ReactNative.Hermes.Windows.0.1.3\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories) + $(SolutionDir)packages\ReactNative.V8JSI.Windows.0.1.4\installed\$(VcpkgTriplet)\include\;%(AdditionalIncludeDirectories) false false false @@ -90,8 +90,8 @@ false - $(SolutionDir)packages\ReactNative.Hermes.Windows.0.1.1\installed\$(VcpkgTriplet)\lib;%(AdditionalLibraryDirectories) - $(SolutionDir)packages\ReactNative.V8JSI.Windows.0.1.3\installed\$(VcpkgTriplet)\lib;%(AdditionalLibraryDirectories) + $(SolutionDir)packages\ReactNative.Hermes.Windows.0.1.3\installed\$(VcpkgTriplet)\lib;%(AdditionalLibraryDirectories) + $(SolutionDir)packages\ReactNative.V8JSI.Windows.0.1.4\installed\$(VcpkgTriplet)\lib;%(AdditionalLibraryDirectories) hermes.lib;%(AdditionalDependencies) v8jsi.lib;%(AdditionalDependencies) @@ -141,7 +141,7 @@ - + @@ -167,7 +167,7 @@ - + @@ -186,16 +186,16 @@ - - + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - + + diff --git a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj.filters b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj.filters index e8e3ca34718..51411749d61 100644 --- a/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj.filters +++ b/vnext/ReactWindowsCore/ReactWindowsCore.vcxproj.filters @@ -60,9 +60,6 @@ Source Files - - Source Files - Source Files\Modules @@ -96,6 +93,9 @@ tracing + + Source Files + @@ -215,9 +215,6 @@ Header Files - - Header Files - Header Files @@ -230,6 +227,9 @@ Header Files + + Header Files + diff --git a/vnext/ReactWindowsCore/packages.config b/vnext/ReactWindowsCore/packages.config index 432358ddef2..d7b046cd7f6 100644 --- a/vnext/ReactWindowsCore/packages.config +++ b/vnext/ReactWindowsCore/packages.config @@ -1,6 +1,6 @@  - - + + \ No newline at end of file diff --git a/vnext/ReactWindowsCore/tracing/fbsystrace.h b/vnext/ReactWindowsCore/tracing/fbsystrace.h index bf9e128fb42..25fb9e68c80 100644 --- a/vnext/ReactWindowsCore/tracing/fbsystrace.h +++ b/vnext/ReactWindowsCore/tracing/fbsystrace.h @@ -9,7 +9,7 @@ #include #define TRACE_TAG_REACT_CXX_BRIDGE 1 << 10 -#define TRACE_TAG_REACT_APPS 1 << 11 +#define TRACE_TAG_REACT_APPS 1 << 17 // Assuming maximum 8 arguments. // TODO :: We assume this magic number "8" at a couple of other places without diff --git a/vnext/Scripts/IntegrationTests.ps1 b/vnext/Scripts/IntegrationTests.ps1 index bc38967b619..b706f12b4c9 100644 --- a/vnext/Scripts/IntegrationTests.ps1 +++ b/vnext/Scripts/IntegrationTests.ps1 @@ -24,8 +24,8 @@ param ( [System.IO.FileInfo[]] $Assemblies = ( - "$PSScriptRoot\..\target\$Platform\$Configuration\" + - "React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll" + ("$(Split-Path $PSScriptRoot)\target\$Platform\$Configuration\" + + "React.Windows.Desktop.IntegrationTests\React.Windows.Desktop.IntegrationTests.dll") ), [switch] $NoRun, diff --git a/vnext/Scripts/ReactUwp.nuspec b/vnext/Scripts/ReactUwp.nuspec index f1a763213c9..28235d35cee 100644 --- a/vnext/Scripts/ReactUwp.nuspec +++ b/vnext/Scripts/ReactUwp.nuspec @@ -18,7 +18,6 @@ - diff --git a/vnext/Scripts/ReactWin32.nuspec b/vnext/Scripts/ReactWin32.nuspec index fdac01af1cc..415408960ce 100644 --- a/vnext/Scripts/ReactWin32.nuspec +++ b/vnext/Scripts/ReactWin32.nuspec @@ -29,7 +29,6 @@ - diff --git a/vnext/Scripts/Tfs/Layout-Headers.ps1 b/vnext/Scripts/Tfs/Layout-Headers.ps1 index 6a2d264d978..13a0f8fe853 100644 --- a/vnext/Scripts/Tfs/Layout-Headers.ps1 +++ b/vnext/Scripts/Tfs/Layout-Headers.ps1 @@ -6,7 +6,7 @@ param( [string] $SourceRoot = ($PSScriptRoot | Split-Path | Split-Path | Split-Path), [System.IO.DirectoryInfo] $ReactWindowsRoot = "$SourceRoot\vnext", [System.IO.DirectoryInfo] $ReactNativeRoot = "$SourceRoot\node_modules\react-native", - [string] $FollyVersion = '2019.08.12.00', + [string] $FollyVersion = '2019.09.30.00', [System.IO.DirectoryInfo] $FollyRoot = "$SourceRoot\node_modules\.folly\folly-${FollyVersion}", [string[]] $Extensions = ('h', 'hpp', 'def') ) @@ -23,6 +23,13 @@ Get-ChildItem -Path $ReactNativeRoot\ReactCommon -Name -Recurse -Include $patter -Force } +# Yoga headers +Get-ChildItem -Path $ReactNativeRoot\ReactCommon\yoga\yoga -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item ` + -Path $ReactNativeRoot\ReactCommon\yoga\yoga\$_ ` + -Destination (New-Item -ItemType Directory $TargetRoot\inc\Yoga\$(Split-Path $_) -Force) ` + -Force +} + # Folly headers Get-ChildItem -Path $FollyRoot -Name -Recurse -Include $patterns | ForEach-Object { Copy-Item ` -Path $FollyRoot\$_ ` diff --git a/vnext/Scripts/UnitTest.ps1 b/vnext/Scripts/UnitTest.ps1 index 3af94d8a1ce..029fdfe0c40 100644 --- a/vnext/Scripts/UnitTest.ps1 +++ b/vnext/Scripts/UnitTest.ps1 @@ -16,11 +16,11 @@ param ( [System.IO.FileInfo[]] $Assemblies = ( - "$PSScriptRoot\..\target\$Platform\$Configuration\" + - "React.Windows.Desktop.UnitTests\React.Windows.Desktop.UnitTests.dll", + ("$(Split-Path $PSScriptRoot)\target\$Platform\$Configuration\" + + "React.Windows.Desktop.UnitTests\React.Windows.Desktop.UnitTests.dll"), - "$PSScriptRoot\..\target\$Platform\$Configuration\" + - "JSI.Desktop.UnitTests\JSI.Desktop.UnitTests.exe" + ("$(Split-Path $PSScriptRoot)\target\$Platform\$Configuration\" + + "JSI.Desktop.UnitTests\JSI.Desktop.UnitTests.exe") ), [System.IO.FileInfo] $VsTest = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe" diff --git a/vnext/Scripts/copyRNLibraries.js b/vnext/Scripts/copyRNLibraries.js index 517a97a368f..c0ece716381 100644 --- a/vnext/Scripts/copyRNLibraries.js +++ b/vnext/Scripts/copyRNLibraries.js @@ -59,6 +59,10 @@ exports.copyRNLibraries = () => { if (fs.existsSync(librariesDest)) { rimraf.sync(librariesDest); } + const jestDest = path.resolve(__dirname, '../jest'); + if (fs.existsSync(jestDest)) { + rimraf.sync(jestDest); + } const rnTesterDest = path.resolve(__dirname, '../RNTester'); if (fs.existsSync(rnTesterDest)) { rimraf.sync(rnTesterDest); @@ -71,6 +75,8 @@ exports.copyRNLibraries = () => { ); } copyJSFolderRecursiveSync(path.resolve(rnPath, 'Libraries'), baseDir); + copyJSFolderRecursiveSync(path.resolve(rnPath, 'jest'), baseDir); + copyJSFolderRecursiveSync(path.resolve(baseDir, 'src/jest'), baseDir); // Copy js files from src/jest to jest fs.writeFileSync( path.resolve(__dirname, '../rn-get-polyfills.js'), diff --git a/vnext/Shared/OInstance.cpp b/vnext/Shared/OInstance.cpp index adf4a659eaa..a591cfc952e 100644 --- a/vnext/Shared/OInstance.cpp +++ b/vnext/Shared/OInstance.cpp @@ -56,7 +56,7 @@ #include "BaseScriptStoreImpl.h" #include "V8JSIRuntimeHolder.h" #endif -#include "ChakraJSIRuntimeHolder.h" +#include "ChakraRuntimeHolder.h" // foreward declaration. namespace facebook { @@ -502,7 +502,7 @@ InstanceImpl::InstanceImpl( m_devSettings->jsiRuntimeHolder = std::make_shared( m_devSettings, - jsQueue, + m_jsThread, std::move(scriptStore), std::move(preparedScriptStore)); break; @@ -514,8 +514,8 @@ InstanceImpl::InstanceImpl( case JSIEngineOverride::ChakraCore: default: // TODO: Add other engines once supported m_devSettings->jsiRuntimeHolder = - std::make_shared( - m_devSettings, jsQueue, nullptr, nullptr); + std::make_shared( + m_devSettings, m_jsThread, nullptr, nullptr); break; } jsef = std::make_shared( diff --git a/vnext/Universal.UnitTests/Tests/CreateModulesTests.cpp b/vnext/Universal.UnitTests/Tests/CreateModulesTests.cpp index a4285b55c5b..3f86541d09f 100644 --- a/vnext/Universal.UnitTests/Tests/CreateModulesTests.cpp +++ b/vnext/Universal.UnitTests/Tests/CreateModulesTests.cpp @@ -37,8 +37,10 @@ TEST_METHOD(CreateModules_DevSupportManager) { } TEST_METHOD(CreateModules_DeviceInfoModule) { - auto deviceInfoModule = - std::make_unique(std::make_unique()); + auto reactInstance = react::uwp::CreateReactInstance(nullptr); + Assert::IsFalse(reactInstance == nullptr); + auto deviceInfoModule = std::make_unique( + std::make_unique(reactInstance)); Assert::IsFalse(deviceInfoModule == nullptr); } diff --git a/vnext/docs/GettingStarted.md b/vnext/docs/GettingStarted.md index 1680a1c0323..707a108bc62 100644 --- a/vnext/docs/GettingStarted.md +++ b/vnext/docs/GettingStarted.md @@ -33,6 +33,5 @@ There are two ways to install and work with React Native for Windows (vnext): Please refer to [Author and Run E2E Test for React Native Windows](E2ETest.md) # Troubleshooting -* If after running the app the packager does not update (or) app does not show React Native content - close the packager command prompt window and the app, run `yarn start` and run the app again. Issue [#2311](https://github.com/microsoft/react-native-windows/issues/2311) is tracking a known issue on this. +* If after running the app, the packager does not update (or) app does not show React Native content - close the packager command prompt window and the app, make sure browser is open, run `yarn start` and run the app from Visual Studio again. * If you get a red error box in your UWP app window with the error message : `ERROR: Instance failed to start. A connection with the server cannot be established`, make sure you have the packager running using `yarn start` and run the app again. -* If you are trying to run your `react-native` app on iOS/Android while using this `vnext` implementation for developing/running on Windows, you will encounter errors while running the app for other platforms. This will be fixed once we address Issues [#2264](https://github.com/microsoft/react-native-windows/issues/2264) and [#2535](https://github.com/microsoft/react-native-windows/issues/2535). Until this is fixed, please refer to [this comment](https://github.com/microsoft/react-native-windows/issues/2515#issuecomment-497375198) which describes the workaround for running on other platforms while developing for windows using `vnext`. diff --git a/vnext/docs/ParityStatus.md b/vnext/docs/ParityStatus.md index 5e0334606dc..c1c316c07de 100644 --- a/vnext/docs/ParityStatus.md +++ b/vnext/docs/ParityStatus.md @@ -12,13 +12,13 @@ Below are a list of components and their status towards parity between the lean |:-|:-|:-|:-| |ActivityIndicator|**Complete**|-|**Complete**| |Button|**Complete**|-|**Complete**| -|FlatList|Partial|[2795](https://github.com/microsoft/react-native-windows/issues/2795)|**Complete**| -|Image|Partial|[2111](https://github.com/microsoft/react-native-windows/issues/2111)|Partial| -|ScrollView|Partial|[2113](https://github.com/microsoft/react-native-windows/issues/2113)|Partial| -|Switch|Partial|[2140](https://github.com/microsoft/react-native-windows/issues/2140)|**Complete**| -|Text|Partial|[2162](https://github.com/microsoft/react-native-windows/issues/2162), [2121](https://github.com/microsoft/react-native-windows/issues/2121)|Partial| -|TextInput|Partial|[2136](https://github.com/microsoft/react-native-windows/issues/2136)|Partial| -|View|Partial|[2796](https://github.com/microsoft/react-native-windows/issues/2796)|**Complete**| +|FlatList|**Complete**|-|**Complete**| +|Image|Partial|[Image project board](https://github.com/microsoft/react-native-windows/projects/18)|Partial| +|ScrollView|Partial|[ScrollView project board](https://github.com/microsoft/react-native-windows/projects/17)|Partial| +|Switch|**Complete**|-|**Complete**| +|Text|**Complete** *(Some properties not supported due to device platform differences, docs coming soon)*|-|**Complete**| +|TextInput|Partial|[TextInput project board](https://github.com/microsoft/react-native-windows/projects/20)|Partial| +|View|Partial (some Style props left)|[View Style props project board](https://github.com/microsoft/react-native-windows/projects/19)|**Complete**| |VirtualizedList|Partial|No Issues Logged|**Complete**| ### Modules @@ -28,13 +28,14 @@ Also tracked are NativeModules, as they are essential, even if not part of the c |Module| `vnext` version Status | `vnext` Issues remaining | `current` version Status| |:-|:-|:-|:-| -|Accessibility|**Completed**|-|Partial| +|Accessibility|Partial|[Accessibility project board](https://github.com/microsoft/react-native-windows/projects/21)|Partial| |LayoutProps|**Completed**|-|Partial| |Alert|**Completed**|-|**Complete**| -|AppState|Not Started|[2144](https://github.com/microsoft/react-native-windows/issues/2144)|**Complete**| -|Keyboard|Not Started|No Issues Logged|Not Implemented| +|AppState|Partial|[2144](https://github.com/microsoft/react-native-windows/issues/2144)|**Complete**| +|Keyboard|Partial|[2852](https://github.com/microsoft/react-native-windows/issues/2852)|Not Implemented| +|Linking|Partial|[2853](https://github.com/microsoft/react-native-windows/issues/2853)|Partial| |LayoutAnimation|Not Started|[2494](https://github.com/microsoft/react-native-windows/issues/2494)|Partial| -|Networking|Not Started|[2460](https://github.com/microsoft/react-native-windows/issues/2460)|**Complete**| +|Networking|Partial|[2460](https://github.com/microsoft/react-native-windows/issues/2460), [3178](https://github.com/microsoft/react-native-windows/issues/3178)|**Complete**| ## Packages to be Refactored Separately @@ -65,7 +66,6 @@ These set of components and modules are not part of [React Native Lean Core](htt |NativeMethodsMixin|Not Started|*nothing logged*|**Complete**| |PixelRatio|Not Started|*nothing logged*|**Complete**| |Settings|Not Started|*nothing logged*|Not Started| -|ShadowProps|Not Started|*nothing logged*|Not Started| |Timers|Not Started|*nothing logged*|**Complete**| |Vibration|Not Started|*nothing logged*|**Complete**| |Dimensions|Not Started|[2470](https://github.com/microsoft/react-native-windows/issues/2470)|**Complete**| diff --git a/vnext/just-task.js b/vnext/just-task.js index a091b8529b2..0779788671b 100644 --- a/vnext/just-task.js +++ b/vnext/just-task.js @@ -59,7 +59,9 @@ task('ts', () => { }); task('clean', () => { return cleanTask( - ['Libraries', 'RNTester', 'lib'].map(p => path.join(process.cwd(), p)), + ['jest', 'Libraries', 'RNTester', 'lib'].map(p => + path.join(process.cwd(), p), + ), ); }); diff --git a/vnext/layoutFilesForNuget.bat b/vnext/layoutFilesForNuget.bat index 59454025dfb..31792b5de33 100644 --- a/vnext/layoutFilesForNuget.bat +++ b/vnext/layoutFilesForNuget.bat @@ -15,7 +15,7 @@ set SRCROOT=%~dp0 :: Remove trailing \ from srcroot IF %SRCROOT:~-1%==\ SET SRCROOT=%SRCROOT:~0,-1% set RNROOT=%~dp0..\node_modules\react-native -set FOLLYROOT=%~dp0..\node_modules\.folly\folly-2019.08.12.00 +set FOLLYROOT=%~dp0..\node_modules\.folly\folly-2019.09.30.00 echo Source root: %SRCROOT% echo Dest root: %DESTROOT% diff --git a/vnext/local-cli/generate-windows.js b/vnext/local-cli/generate-windows.js index 80eca10f100..aa90bd3fcf1 100644 --- a/vnext/local-cli/generate-windows.js +++ b/vnext/local-cli/generate-windows.js @@ -26,7 +26,7 @@ function generateWindows (projectDir, name, ns, options) { path.join(__dirname, 'generator-windows', 'templates'), projectDir, name, - { ns, overwrite: options.overwrite } + { ns, overwrite: options.overwrite, language: options.language } ); } diff --git a/vnext/local-cli/generator-windows/index.js b/vnext/local-cli/generator-windows/index.js index 2e73877a636..6264d416371 100644 --- a/vnext/local-cli/generator-windows/index.js +++ b/vnext/local-cli/generator-windows/index.js @@ -50,12 +50,12 @@ function generateCertificate(srcPath, destPath, newProjectName, currentUser) { } function copyProjectTemplateAndReplace( - srcPath, + srcRootPath, destPath, newProjectName, options = {} ) { - if (!srcPath) { + if (!srcRootPath) { throw new Error('Need a path to copy from'); } @@ -71,13 +71,17 @@ function copyProjectTemplateAndReplace( createDir(path.join(destPath, windowsDir, newProjectName)); createDir(path.join(destPath, windowsDir, newProjectName, reactAssetsDir)); + const language = options.language; const ns = options.ns || newProjectName; + const srcPath = path.join(srcRootPath, language); const projectGuid = uuid.v4(); const packageGuid = uuid.v4(); const currentUser = username.sync(); // Gets the current username depending on the platform. const certificateThumbprint = generateCertificate(srcPath, destPath, newProjectName, currentUser); const templateVars = { + '// clang-format off': '', + '// clang-format on': '', '<%=ns%>': ns, '<%=name%>': newProjectName, '<%=projectGuid%>': projectGuid, @@ -87,15 +91,26 @@ function copyProjectTemplateAndReplace( }; [ - { from: path.join(srcPath, 'react-native.config.js'), to: 'react-native.config.js' }, - { from: path.join(srcPath, 'metro.config.js'), to: 'metro.config.js' }, + { from: path.join(srcRootPath, 'react-native.config.js'), to: 'react-native.config.js' }, + { from: path.join(srcRootPath, 'metro.config.js'), to: 'metro.config.js' }, + { from: path.join(srcRootPath, '_gitignore'), to: path.join(windowsDir, '.gitignore') }, + { from: path.join(srcRootPath, 'ra_gitignore'), to: path.join(windowsDir, newProjectName, reactAssetsDir, '.gitignore') }, + { from: path.join(srcRootPath, 'index.windows.bundle'), to: path.join(windowsDir, newProjectName, reactAssetsDir, 'index.windows.bundle') }, { from: path.join(srcPath, projDir, 'MyApp.sln'), to: path.join(windowsDir, newProjectName + '.sln') }, - { from: path.join(srcPath, projDir, 'MyApp.csproj'), to: path.join(windowsDir, newProjectName, newProjectName + '.csproj') }, - { from: path.join(srcPath, '_gitignore'), to: path.join(windowsDir, '.gitignore') }, - { from: path.join(srcPath, 'ra_gitignore'), to: path.join(windowsDir, newProjectName, reactAssetsDir, '.gitignore') }, - { from: path.join(srcPath, 'index.windows.bundle'), to: path.join(windowsDir, newProjectName, reactAssetsDir, 'index.windows.bundle') }, ].forEach((mapping) => copyAndReplaceWithChangedCallback(mapping.from, destPath, mapping.to, templateVars, options.overwrite)); + if (language === 'cs') { + [ + { from: path.join(srcPath, projDir, 'MyApp.csproj'), to: path.join(windowsDir, newProjectName, newProjectName + '.csproj') }, + ].forEach((mapping) => copyAndReplaceWithChangedCallback(mapping.from, destPath, mapping.to, templateVars, options.overwrite)); + } + else { + [ + { from: path.join(srcPath, projDir, 'MyApp.vcxproj'), to: path.join(windowsDir, newProjectName, newProjectName + '.vcxproj') }, + { from: path.join(srcPath, projDir, 'MyApp.vcxproj.filters'), to: path.join(windowsDir, newProjectName, newProjectName + '.vcxproj.filters') }, + ].forEach((mapping) => copyAndReplaceWithChangedCallback(mapping.from, destPath, mapping.to, templateVars, options.overwrite)); + } + copyAndReplaceAll(path.join(srcPath, 'assets'), destPath, path.join(windowsDir, newProjectName, 'Assets'), templateVars, options.overwrite); copyAndReplaceAll(path.join(srcPath, 'src'), destPath, path.join(windowsDir, newProjectName), templateVars, options.overwrite); diff --git a/vnext/local-cli/generator-windows/templates/assets/LockScreenLogo.scale-200.png b/vnext/local-cli/generator-windows/templates/cpp/assets/LockScreenLogo.scale-200.png similarity index 100% rename from vnext/local-cli/generator-windows/templates/assets/LockScreenLogo.scale-200.png rename to vnext/local-cli/generator-windows/templates/cpp/assets/LockScreenLogo.scale-200.png diff --git a/vnext/local-cli/generator-windows/templates/assets/SplashScreen.scale-200.png b/vnext/local-cli/generator-windows/templates/cpp/assets/SplashScreen.scale-200.png similarity index 100% rename from vnext/local-cli/generator-windows/templates/assets/SplashScreen.scale-200.png rename to vnext/local-cli/generator-windows/templates/cpp/assets/SplashScreen.scale-200.png diff --git a/vnext/local-cli/generator-windows/templates/assets/Square150x150Logo.scale-200.png b/vnext/local-cli/generator-windows/templates/cpp/assets/Square150x150Logo.scale-200.png similarity index 100% rename from vnext/local-cli/generator-windows/templates/assets/Square150x150Logo.scale-200.png rename to vnext/local-cli/generator-windows/templates/cpp/assets/Square150x150Logo.scale-200.png diff --git a/vnext/local-cli/generator-windows/templates/assets/Square44x44Logo.scale-200.png b/vnext/local-cli/generator-windows/templates/cpp/assets/Square44x44Logo.scale-200.png similarity index 100% rename from vnext/local-cli/generator-windows/templates/assets/Square44x44Logo.scale-200.png rename to vnext/local-cli/generator-windows/templates/cpp/assets/Square44x44Logo.scale-200.png diff --git a/vnext/local-cli/generator-windows/templates/assets/Square44x44Logo.targetsize-24_altform-unplated.png b/vnext/local-cli/generator-windows/templates/cpp/assets/Square44x44Logo.targetsize-24_altform-unplated.png similarity index 100% rename from vnext/local-cli/generator-windows/templates/assets/Square44x44Logo.targetsize-24_altform-unplated.png rename to vnext/local-cli/generator-windows/templates/cpp/assets/Square44x44Logo.targetsize-24_altform-unplated.png diff --git a/vnext/local-cli/generator-windows/templates/assets/StoreLogo.png b/vnext/local-cli/generator-windows/templates/cpp/assets/StoreLogo.png similarity index 100% rename from vnext/local-cli/generator-windows/templates/assets/StoreLogo.png rename to vnext/local-cli/generator-windows/templates/cpp/assets/StoreLogo.png diff --git a/vnext/local-cli/generator-windows/templates/assets/Wide310x150Logo.scale-200.png b/vnext/local-cli/generator-windows/templates/cpp/assets/Wide310x150Logo.scale-200.png similarity index 100% rename from vnext/local-cli/generator-windows/templates/assets/Wide310x150Logo.scale-200.png rename to vnext/local-cli/generator-windows/templates/cpp/assets/Wide310x150Logo.scale-200.png diff --git a/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.sln b/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.sln new file mode 100644 index 00000000000..cfffdb1f70a --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.sln @@ -0,0 +1,136 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.489 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Folly", "..\node_modules\react-native-windows\Folly\Folly.vcxproj", "{A990658C-CE31-4BCC-976F-0FC6B1AF693D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactUWP", "..\node_modules\react-native-windows\ReactUWP\ReactUWP.vcxproj", "{2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}" + ProjectSection(ProjectDependencies) = postProject + {A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactCommon", "..\node_modules\react-native-windows\ReactCommon\ReactCommon.vcxproj", "{A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}" + ProjectSection(ProjectDependencies) = postProject + {A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D} + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ReactWindowsCore", "..\node_modules\react-native-windows\ReactWindowsCore\ReactWindowsCore.vcxproj", "{11C084A3-A57C-4296-A679-CAC17B603144}" + ProjectSection(ProjectDependencies) = postProject + {A990658C-CE31-4BCC-976F-0FC6B1AF693D} = {A990658C-CE31-4BCC-976F-0FC6B1AF693D} + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PropertySheets", "PropertySheets", "{6F24927E-EE45-4DB2-91DA-DCC6E98B0C42}" + ProjectSection(SolutionItems) = preProject + PropertySheets\ARM.props = PropertySheets\ARM.props + PropertySheets\Debug.props = PropertySheets\Debug.props + PropertySheets\React.Cpp.props = PropertySheets\React.Cpp.props + PropertySheets\Release.props = PropertySheets\Release.props + PropertySheets\Warnings.props = PropertySheets\Warnings.props + PropertySheets\Win32.props = PropertySheets\Win32.props + PropertySheets\x64.props = PropertySheets\x64.props + PropertySheets\x86.props = PropertySheets\x86.props + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "<%=name%>", "<%=name%>\<%=name%>.vcxproj", "{<%=projectGuid%>}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + ..\node_modules\react-native-windows\Chakra\Chakra.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4 + ..\node_modules\react-native-windows\Shared\Shared.vcxitems*{2d5d43d9-cffc-4c40-b4cd-02efb4e2742b}*SharedItemsImports = 4 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.ActiveCfg = Debug|ARM + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM.Build.0 = Debug|ARM + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|ARM64.ActiveCfg = Debug|Win32 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.ActiveCfg = Debug|x64 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x64.Build.0 = Debug|x64 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.ActiveCfg = Debug|Win32 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Debug|x86.Build.0 = Debug|Win32 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.ActiveCfg = Release|ARM + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM.Build.0 = Release|ARM + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|ARM64.ActiveCfg = Release|Win32 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.ActiveCfg = Release|x64 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x64.Build.0 = Release|x64 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.ActiveCfg = Release|Win32 + {A990658C-CE31-4BCC-976F-0FC6B1AF693D}.Release|x86.Build.0 = Release|Win32 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM.ActiveCfg = Debug|ARM + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM.Build.0 = Debug|ARM + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|ARM64.ActiveCfg = Debug|Win32 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x64.ActiveCfg = Debug|x64 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x64.Build.0 = Debug|x64 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x86.ActiveCfg = Debug|Win32 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Debug|x86.Build.0 = Debug|Win32 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM.ActiveCfg = Release|ARM + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM.Build.0 = Release|ARM + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|ARM64.ActiveCfg = Release|Win32 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x64.ActiveCfg = Release|x64 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x64.Build.0 = Release|x64 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x86.ActiveCfg = Release|Win32 + {2D5D43D9-CFFC-4C40-B4CD-02EFB4E2742B}.Release|x86.Build.0 = Release|Win32 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.ActiveCfg = Debug|ARM + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM.Build.0 = Debug|ARM + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|ARM64.ActiveCfg = Debug|Win32 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.ActiveCfg = Debug|x64 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x64.Build.0 = Debug|x64 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.ActiveCfg = Debug|Win32 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Debug|x86.Build.0 = Debug|Win32 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.ActiveCfg = Release|ARM + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM.Build.0 = Release|ARM + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|ARM64.ActiveCfg = Release|Win32 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.ActiveCfg = Release|x64 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x64.Build.0 = Release|x64 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.ActiveCfg = Release|Win32 + {A9D95A91-4DB7-4F72-BEB6-FE8A5C89BFBD}.Release|x86.Build.0 = Release|Win32 + {11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.ActiveCfg = Debug|ARM + {11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM.Build.0 = Debug|ARM + {11C084A3-A57C-4296-A679-CAC17B603144}.Debug|ARM64.ActiveCfg = Debug|Win32 + {11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.ActiveCfg = Debug|x64 + {11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x64.Build.0 = Debug|x64 + {11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.ActiveCfg = Debug|Win32 + {11C084A3-A57C-4296-A679-CAC17B603144}.Debug|x86.Build.0 = Debug|Win32 + {11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.ActiveCfg = Release|ARM + {11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM.Build.0 = Release|ARM + {11C084A3-A57C-4296-A679-CAC17B603144}.Release|ARM64.ActiveCfg = Release|Win32 + {11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.ActiveCfg = Release|x64 + {11C084A3-A57C-4296-A679-CAC17B603144}.Release|x64.Build.0 = Release|x64 + {11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.ActiveCfg = Release|Win32 + {11C084A3-A57C-4296-A679-CAC17B603144}.Release|x86.Build.0 = Release|Win32 + {<%=projectGuid%>}.Debug|ARM.ActiveCfg = Debug|ARM + {<%=projectGuid%>}.Debug|ARM.Build.0 = Debug|ARM + {<%=projectGuid%>}.Debug|ARM.Deploy.0 = Debug|ARM + {<%=projectGuid%>}.Debug|ARM64.ActiveCfg = Debug|Win32 + {<%=projectGuid%>}.Debug|x64.ActiveCfg = Debug|x64 + {<%=projectGuid%>}.Debug|x64.Build.0 = Debug|x64 + {<%=projectGuid%>}.Debug|x64.Deploy.0 = Debug|x64 + {<%=projectGuid%>}.Debug|x86.ActiveCfg = Debug|Win32 + {<%=projectGuid%>}.Debug|x86.Build.0 = Debug|Win32 + {<%=projectGuid%>}.Debug|x86.Deploy.0 = Debug|Win32 + {<%=projectGuid%>}.Release|ARM.ActiveCfg = Release|ARM + {<%=projectGuid%>}.Release|ARM.Build.0 = Release|ARM + {<%=projectGuid%>}.Release|ARM.Deploy.0 = Release|ARM + {<%=projectGuid%>}.Release|ARM64.ActiveCfg = Release|Win32 + {<%=projectGuid%>}.Release|x64.ActiveCfg = Release|x64 + {<%=projectGuid%>}.Release|x64.Build.0 = Release|x64 + {<%=projectGuid%>}.Release|x64.Deploy.0 = Release|x64 + {<%=projectGuid%>}.Release|x86.ActiveCfg = Release|Win32 + {<%=projectGuid%>}.Release|x86.Build.0 = Release|Win32 + {<%=projectGuid%>}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {D43FAD39-F619-437D-BB40-04A3982ACB6A} + EndGlobalSection +EndGlobal diff --git a/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj b/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj new file mode 100644 index 00000000000..5b86ecbfab4 --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj @@ -0,0 +1,171 @@ + + + + + true + true + true + {<%=projectGuid%>} + <%=ns%> + <%=ns%> + en-US + 14.0 + true + Windows Store + 10.0 + 10.0.18362.0 + 10.0.15063.0 + <%=name%>_TemporaryKey.pfx + <%=certificateThumbprint%> + password + + + + + Debug + ARM + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + Win32 + + + Release + x64 + + + + Application + v140 + v141 + v142 + Unicode + + + true + true + + + false + true + false + + + + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + %(AdditionalOptions) /bigobj + + /DWINRT_NO_MAKE_DETECTION %(AdditionalOptions) + 4453;28204 + + + + + _DEBUG;%(PreprocessorDefinitions) + + + + + NDEBUG;%(PreprocessorDefinitions) + + + + + + App.xaml + + + MainPage.xaml + + + + + Designer + + + Designer + + + + + Designer + + + + + + + + + + + + + + Create + + + App.xaml + + + MainPage.xaml + + + + + + App.xaml + + + MainPage.xaml + + + + + + + false + + + + + {2d5d43d9-cffc-4c40-b4cd-02efb4e2742b} + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj.filters b/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj.filters new file mode 100644 index 00000000000..432e8c50ee0 --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/proj/MyApp.vcxproj.filters @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + {e48dc53e-40b1-40cb-970a-f89935452892} + + + + + + + + + + \ No newline at end of file diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/App.cpp b/vnext/local-cli/generator-windows/templates/cpp/src/App.cpp new file mode 100644 index 00000000000..95c85d1a4da --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/App.cpp @@ -0,0 +1,123 @@ +#include "pch.h" + +#include "App.h" +#include "MainPage.h" + +using namespace winrt; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Navigation; + +// clang-format off +using namespace <%=ns%>; +using namespace <%=ns%>::implementation; + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending({ this, &App::OnSuspending }); + +#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION + UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e) + { + if (IsDebuggerPresent()) + { + auto errorMessage = e.Message(); + __debugbreak(); + } + }); +#endif +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// +/// Details about the launch request and process. +void App::OnLaunched(LaunchActivatedEventArgs const& e) +{ + Frame rootFrame{ nullptr }; + auto content = Window::Current().Content(); + if (content) + { + rootFrame = content.try_as(); + } + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (rootFrame == nullptr) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = Frame(); + + rootFrame.NavigationFailed({ this, &App::OnNavigationFailed }); + + if (e.PreviousExecutionState() == ApplicationExecutionState::Terminated) + { + // Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + } + + if (e.PrelaunchActivated() == false) + { + if (rootFrame.Content() == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(xaml_typename<<%=ns%>::MainPage>(), box_value(e.Arguments())); + } + // Place the frame in the current Window + Window::Current().Content(rootFrame); + // Ensure the current window is active + Window::Current().Activate(); + } + } + else + { + if (e.PrelaunchActivated() == false) + { + if (rootFrame.Content() == nullptr) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(xaml_typename<<%=ns%>::MainPage>(), box_value(e.Arguments())); + } + // Ensure the current window is active + Window::Current().Activate(); + } + } +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +/// The source of the suspend request. +/// Details about the suspend request. +void App::OnSuspending([[maybe_unused]] IInspectable const& sender, [[maybe_unused]] SuspendingEventArgs const& e) +{ + // Save application state and stop any background activity +} + +/// +/// Invoked when Navigation to a certain page fails +/// +/// The Frame which failed navigation +/// Details about the navigation failure +void App::OnNavigationFailed(IInspectable const&, NavigationFailedEventArgs const& e) +{ + throw hresult_error(E_FAIL, hstring(L"Failed to load Page ") + e.SourcePageType().Name); +} + +// clang-format on diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/App.h b/vnext/local-cli/generator-windows/templates/cpp/src/App.h new file mode 100644 index 00000000000..05c4836499a --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/App.h @@ -0,0 +1,18 @@ +#pragma once +#include "App.xaml.g.h" + +// clang-format off + +namespace winrt::<%=ns%>::implementation +{ + struct App : AppT + { + App(); + + void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&); + void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&); + void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&); + }; +} + +// clang-format on diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/App.idl b/vnext/local-cli/generator-windows/templates/cpp/src/App.idl new file mode 100644 index 00000000000..178208096fa --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/App.idl @@ -0,0 +1,3 @@ +namespace <%=ns%> +{ +} diff --git a/vnext/local-cli/generator-windows/templates/src/App.xaml b/vnext/local-cli/generator-windows/templates/cpp/src/App.xaml similarity index 100% rename from vnext/local-cli/generator-windows/templates/src/App.xaml rename to vnext/local-cli/generator-windows/templates/cpp/src/App.xaml diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.cpp b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.cpp new file mode 100644 index 00000000000..9c3ee6afbf7 --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.cpp @@ -0,0 +1,46 @@ +#include "pch.h" +#include "MainPage.h" +#include "MainPage.g.cpp" + +using namespace winrt; +using namespace Windows::UI::Xaml; +using namespace react::uwp; + +// clang-format off + +namespace winrt::<%=ns%>::implementation +{ + const wchar_t* JSFILENAME = L"index"; + const wchar_t* JSCOMPONENTNAME = L"<%=name%>"; + + MainPage::MainPage() + { + InitializeComponent(); + LoadReact(); + } + + void MainPage::LoadReact() + { + InstanceSettings settings; + + settings.UseLiveReload = true; + settings.UseWebDebugger = true; + + auto instance = Instance::Create(winrt::hstring(JSFILENAME)); + instance.Start(settings); + + RootElement().Instance(instance); + + const wchar_t* initialProps = L"{ " + L"\"one\":\"1\"" + L", \"two\":\"2\"" + L"}"; + + RootElement().InitialProps(winrt::hstring(initialProps)); + + RootElement().JsComponentName(JSCOMPONENTNAME); + RootElement().StartRender(); + } +} + +// clang-format on diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.h b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.h new file mode 100644 index 00000000000..2d4f308fb20 --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.h @@ -0,0 +1,25 @@ +#pragma once + +#include "MainPage.g.h" + +// clang-format off + +namespace winrt::<%=ns%>::implementation +{ + struct MainPage : MainPageT + { + MainPage(); + + private: + void LoadReact(); + }; +} + +namespace winrt::<%=ns%>::factory_implementation +{ + struct MainPage : MainPageT + { + }; +} + +// clang-format on diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.idl b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.idl new file mode 100644 index 00000000000..2c0d68940ee --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.idl @@ -0,0 +1,8 @@ +namespace <%=ns%> +{ + [default_interface] + runtimeclass MainPage : Windows.UI.Xaml.Controls.Page + { + MainPage(); + } +} diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.xaml b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.xaml new file mode 100644 index 00000000000..31ad95a391f --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/MainPage.xaml @@ -0,0 +1,15 @@ + + + + + + diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/Package.appxmanifest b/vnext/local-cli/generator-windows/templates/cpp/src/Package.appxmanifest new file mode 100644 index 00000000000..36e31f8aaab --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/Package.appxmanifest @@ -0,0 +1,32 @@ + + + + + + <%=name%> + React Native for UWP + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/PropertySheet.props b/vnext/local-cli/generator-windows/templates/cpp/src/PropertySheet.props new file mode 100644 index 00000000000..5942ba395bb --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/PropertySheet.props @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/packages.config b/vnext/local-cli/generator-windows/templates/cpp/src/packages.config new file mode 100644 index 00000000000..790637cec08 --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/pch.cpp b/vnext/local-cli/generator-windows/templates/cpp/src/pch.cpp new file mode 100644 index 00000000000..bcb5590be1b --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/vnext/local-cli/generator-windows/templates/cpp/src/pch.h b/vnext/local-cli/generator-windows/templates/cpp/src/pch.h new file mode 100644 index 00000000000..f02bf4b0dd8 --- /dev/null +++ b/vnext/local-cli/generator-windows/templates/cpp/src/pch.h @@ -0,0 +1,16 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include diff --git a/vnext/local-cli/generator-windows/templates/cs/assets/LockScreenLogo.scale-200.png b/vnext/local-cli/generator-windows/templates/cs/assets/LockScreenLogo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..735f57adb5dfc01886d137b4e493d7e97cf13af3 GIT binary patch literal 1430 zcmaJ>TTC2P7~aKltDttVHYH6u8Io4i*}3fO&d$gd*bA_<3j~&e7%8(eXJLfhS!M@! zKrliY>>6yT4+Kr95$!DoD(Qn-5TP|{V_KS`k~E6(LGS@#`v$hQo&^^BKsw3HIsZBT z_y6C2n`lK@apunKojRQ^(_P}Mgewt$(^BBKCTZ;*xa?J3wQ7~@S0lUvbcLeq1Bg4o zH-bvQi|wt~L7q$~a-gDFP!{&TQfc3fX*6=uHv* zT&1&U(-)L%Xp^djI2?~eBF2cxC@YOP$+9d?P&h?lPy-9M2UT9fg5jKm1t$m#iWE{M zIf%q9@;fyT?0UP>tcw-bLkz;s2LlKl2qeP0w zECS7Ate+Awk|KQ+DOk;fl}Xsy4o^CY=pwq%QAAKKl628_yNPsK>?A>%D8fQG6IgdJ ztnxttBz#NI_a@fk7SU`WtrpsfZsNs9^0(2a z@C3#YO3>k~w7?2hipBf{#b6`}Xw1hlG$yi?;1dDs7k~xDAw@jiI*+tc;t2Lflg&bM)0!Y;0_@=w%`LW^8DsYpS#-bLOklX9r?Ei}TScw|4DbpW%+7 zFgAI)f51s}{y-eWb|vrU-Ya!GuYKP)J7z#*V_k^Xo>4!1Yqj*m)x&0L^tg3GJbVAJ zJ-Pl$R=NAabouV=^z_t;^K*0AvFs!vYU>_<|I^#c?>>CR<(T?=%{;U=aI*SbZADLH z&(f2wz_Y0??Tf|g;?|1Znw6}6U43Q#qNRwv1vp9uFn1)V#*4p&%$mP9x&15^OaBiDS(XppT|z^>;B{PLVEbS3IFYV yGvCsSX*m literal 0 HcmV?d00001 diff --git a/vnext/local-cli/generator-windows/templates/cs/assets/SplashScreen.scale-200.png b/vnext/local-cli/generator-windows/templates/cs/assets/SplashScreen.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..023e7f1feda78d5100569825acedfd213a0d84e9 GIT binary patch literal 7700 zcmeHLYj~4Yw%(;oxoEH#Kxq-eR|+VkP17b#Vk;?4QwkI+A{L04G+#<<(x#Un1#+h5>eArRq zTw$)ZvTWW_Y?bDho0nPVTh08+s`sp!j74rJTTtXIDww0SILedFv?sZ?yb@@}GN;#8 znk_b~Q(A0YR#uV4ef!osoV1M3;vQ8N$O|fStfgf$S5;ddUNv`tWtGjM;koG#N;7M< zP*84lnx(bn_KF&9Z5Ai$)#Cs3a|$OFw>WKCT$of*L7_CqQEinflT|W{JT+aKp-E0v zsxmYg)1(T>DROm+LN1eQw8}KCTp=C!$H7`PU!t9_Hw@TsTI2`udRZv*!a5`#A9hK6Y95L(CDUX&_@QxKV z_feX{UhA#ZWlvgpL$#w^D#lq`_A4AzDqd|Zv6y9PX&DNcN|l}_D^{q@GG&H^Pg583 z8FI6N8^H7b5WjGp;urW)d7F+_lcp%KsLX0viCmE(OHH+=%ZfD_=`voUuoUxFO^L;- z;!;2{g-YiiO6m4bs89OuF9!p{FGtH-f%8<2gY!h9s)4ciN%{Kh1+`}{^}M~+TDH9N z^Z5PlgVXMC&2&k*Hw^Lb9gny#ro$MOIxIt{+r)EA10$VR3 zanN8D{TUkl+v0CQ_>ZoHP<M-x#8@8ZiT#$Kh`(uRaX1g$Bg|qy$<#7 zSSAi{Nb8Y=lvNVeio+UGLCAtoLBfL`iOv`)yoJMDJBN>4IH@(l7YRF;61@>qq1iM9 zr@b#OC~SAxSle?5Pp8Z78{VO0YFr1x7kZU64Z23eLf2T2#6J_t;-E}DkB?NufZ0Ug zi?J&byXeaB-uTNVhuiM!UVQw}bZrJ3GtAETYp->!{q#zfN7D3AS9@Q7*V^85jGx#R z(QxYV(wW#F0XF9^^s>>H8pPlVJ>)3Oz z&_X8Sf@~?cH_O*cgi$U#`v`RRfv#y3m(ZpKk^5uLup+lVs$~}FZU$r_+}#hl%?g5m z-u-}-666ssp-xWQak~>PPy$mRc|~?pVSs1_@mBEXpPVfLF6(Ktf1S* zPPh@QZ=tFMs?LM2(5P3L2;l_6XX6s&cYsP1ip#eg0`ZEP0HGYh{UmS@o`MihLLvkU zgyAG0G`b1|qjxxh1(ODKFE%AP}Dq=3vK$P7TXP4GrM1kQ72!GUVMDl`rDC&2;TA}*nF z8$nQD&6ys_nc1*E7$*1S@R8$ymy(sQV}imGSedB@{!QR5P&N_H=-^o!?LsWs+2|mH z-e=)T^SvI)=_JIm7}j4;@*Z17=(#}m=~YF~z~CLI+vdAGlJDcdF$TM?CVI1%LhUrN zaa6DJ=Yh$)$k&Oz{-~8yw^GM^8prYxSxo zvI4k#ibryMa%%*8oI-5m61Koa_A_xg=(fwp0aBX{;X4Q;NXUhtaoJDo1>TqhWtn=_ zd5~chq#&6~c%8JZK#t_&J(9EVUU&upYeIovLt1>vaHe}UUq>#RGQj!EN#5+0@T`(@ z^g~>*c`VGRiSt;!$_4+0hk^I!@O3``5=sZ8IwlxWW7km1B&_t&E*u0_9UBa#VqwY* zz>nxv?FAsVnRaD(Bui=6i==BFUw0k4n$>`umU`F2l?7CYTD^)c2X+d9X&ddS9|gj? zM?knGkGCX&W8offw8aLC2$D{PjC3nVZwd4k?eZH8*mZ)U@3Qk8RDFOz_#WUA#vnzy zyP>KrCfKwSXea7}jgJjBc}PGY+4#6%lbZyjhy`5sZd_Vy6Wz;ixa?czkN}J9It1K6 zY!eu>|AwF^fwZlLAYyQI*lM@^>O>Iu6Vf6i>Q$?v!SeUS<{>UYMwz$*%Aq?w^`j{h z!$GZbhu=^D{&ET8;))LL%ZBDZkQqRd2;u~!d9bHGmLRhLDctNgYyjsuvoSZ#iVdoB z2!f--UUA#U;<{je#?cYt^{PIyKa%hW>}uepWMyAI{{Zo7?2>?$c9;whJae%oN|I-kpTQSx_C$Z&;f zi2i)qmEn=y4U0uvk)$m;zKfjPK@oc?I`}1Jzl$Q~aoKBd3kt7L#7gyt|A_qgz6ai< z=X%D1i!d2h?rHR^R8SUj&G||dkC?DT>{o#Yau<@uqVT{Xef&XG}5*E4aPk{}~ zplx&XhaV)&1EfI3Em;Bw#O5SV^c;{twb-1Rw)+=0!e_BLbd7tYmXCH0wrlOSS+~`7He8Iqx0{CN+DVit9;*6L~JAN zD&cyT)2?h}xnYmL?^)<7YyzZ3$FHU^Eg;DLqAV{#wv#Wj7S`Jdl1pX&{3(uZ?!uh} zDc$ZTNV*7le_W6}Hju~GMTxZQ1aWCeUc%!jv3MHAzt>Y-nQK%zfT*3ebDQA5b?iGn; zBjv3B+GhLTexd_(CzZDP4|#n5^~scvB6#Pk%Ho!kQ>yYw((Dv{6=$g3jT1!u6gORW zx5#`7Wy-ZHRa~IxGHdrp(bm%lf>2%J660nj$fCqN(epv@y!l9s7@k6EvxS{AMP>WY zX4$@F8^kayphIx-RGO$+LYl9YdoI5d|4#q9##`_F5Xnx`&GPzp2fB{-{P@ATw=X@~ z_|&^UMWAKD;jjBKTK(~o?cUFRK8EX=6>cXpfzg4ZpMB>*w_^8GSiT-Jp|xBOnzM+j z*09-@-~qJ(eqWq5@R4i^u4^{McCP(!3}C|v_WsTR*bIUxN(Nx`u##3B4{sE`Z`v8w zAwIG`?1~PkID~W{uDzmqH98Pew_1(;x2%8r^vY{)_&J2K)cN{W+h5+g)ZcjP&Ci#O zgy|8K@4kyMfwilHd&6TDlhb%++Pk!>9HRld6HT7gwyZGrxS$}CsD6`>6!!2K1@Mjf z(P0WYB7V_OFZyeWrbOFb>O54BNXf~K&?}3=^v;v_wT{DKr?jN^DtN&DXwX%u?s*c6`%8>WFz z7}YW^tp0bp^NriE)AB6M2l<7rn7fzePtR*omOevpfm9n?}2V*+0iW;S)C zhg`NAjL?D=W#k*$aR{>pGf~lD-rVtD;5jW1_*Jn1j1=es@Kcx4ySM_bwcQCT=d+DV z>Sz~L=Hj@(X%31nK$mWI@7d>}ORB`K(p=+`UD)+99YUGQc7y^bHZ1F(8|tL0 zdK*DT0kSXG_{BKTpP2*2PecdKV9;dq$^ZZDP;Nyq1kp-&GI5eAyZsK!e3V zK@rPy*{(`KIfo+lc878mDKk^V#`VT05}64kBtk%DgwLrOvLMj5-;*GNKv6c6pzMuL z6EP%ob|_0IW}lLRXCP2!9wWhEw3LA7iF#1O1mIZ@Z=6&bz41F;@S_GvYAG-#CW3z{ zP3+6vHhvP&A3$##Vo9$dT^#MoGg^|MDm=Bt1d2RRwSZ<;ZHICpLBv5Xs!D?BH^(9_ z7`H=N&^v|Z-%mP}wNzG{aiFCsRgwzwq!N6obW9+7(R; z(SZ=23`|`>qil!LMGG{_Heq!BD>(Y-zV9wD)}hz25JA37YR%39;kI4y9pgtcUass6 zP24}ZY$vvYeI`zy&)A_X#nY3017ap*0&jx|mVwyGhg3;!keU53a}Uhm3BZI$N$6Se zLWlAmy1S0xKJm4G_U@sN_Tm=`$xWJSEwKU98rZ&)1R^*$$1vA3oG#&*%SMxY_~oGP zP&PFJatFLM-Ps%84IV-+Ow)T{C7cqUAvauy4C z(FRz&?6$Rypj{xO!`y=*J5o4@U8Q-(y5(*=YoKeZ+-1YdljXxkA#B)zo=FeQH#?Le zycNUmEEHWO9a=X^pb#&cOq7-`7UA87#|S22)<7RUtZo|(zibX=w;K3qur9vy#`MNV z6UUcf9ZwEnKCCp+OoBnF@OdbvH)ANXO0o~Pi9l8=x3))}L<#vO0-~O4!~--Ket?d} zJaqsj<@CD1%S2cTW%rOP{Vto%0sGW~1RMa_j^)5nil0Yw- z0EE#bP+l4#P^%PQ+N*oxu1Zq05xZ!bXfYTg>9c{(Iw*lnjR^>kz%lAN^zFce7rppy zY8zA~3GD=A6d*hze&l4D_wA~+O!56)BZTe_rEu}Ezi<4!kG|W#amBZ5{&XS2@6R~H z{9o^y*BkH4$~yX9U&@CgbOzX1bn9xqF|zh$Dh0Y5y*E0e90*$!ObrHY3Ok0`2=O~r zCuke6KrP9KOf?V(YDsM<6pX2nVoN%M$LT^q#FmtaF?1^27F*IcNX~XRB(|hCFvdcc zc)$=S-)acdk$g4?_>jRqxpI6M3vHZk?0c^3=byamYDNf;uB{3NlKW5IhnOS3DNkMV z?tK8?kJ}pmvp%&&eTVOVjHP`q34hN1@!aK}H(K!vI`~gf|Gv+FNEQD5Yd<~yX7k_l h&G-K)@HZb3BABY{)U1?^%I#E6`MGoTtustd{~yM6srvu` literal 0 HcmV?d00001 diff --git a/vnext/local-cli/generator-windows/templates/cs/assets/Square150x150Logo.scale-200.png b/vnext/local-cli/generator-windows/templates/cs/assets/Square150x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..af49fec1a5484db1d52a7f9b5ec90a27c7030186 GIT binary patch literal 2937 zcma)84OCO-8BSud5)jwMLRVKgX(S?$n?Ld|vrsm<$CF7)&zTbyy1FE5bU`Q17MRv`9ue$;R(@8kR;#vJ*IM0>cJIAOte!d7oRgdH zd%ySjdB6L9=gX^A6)VzH7p2l@v~3zJAMw|DFy#^)F@@F*`mqUn=Il>l)8_+ab;nOW{%+iPx z+s{Eu|&pIs)Z7{La9~?xKfyl z#43?gjEL15d4WbOZo#SiP%>DB^+BcnJ=7dHEe;r#G=tuw|ka z%q@}##Uh7;tc%L_64m(kHtw74ty%BJMb)_1)#S0j`)F8_1jF7vScpsnH=0V19bO8y zR`0SjIdCUo&=>JwMQF8KHA<{ODHTiQh}0^@5QRmCA?gOH6_H3K^-_sNB^RrdNuK-R zOO*vOrKCVvDwgUck`kF(E7j{I#iiN;b*ZdCt4m@HPA`EuEqGGf4%!K<;(=I=&Vyrw z%TwcWtxa}8mCZ%Cyf&ActJ6_$ox5z6-D!0-dvnRx6t7y3d+h6QYpKWO;8OdnvERo7 zuEf>ih5`wqY)~o@OeVt-wM?Q!>QzdGRj!bz6fzYrfw$hZfAKzr2-M+D+R>}~oT574c;_3zquHcElqKIsryILt3g8n3jcMb+j?i?-L3FpZJ z2WRVBRdDPc+G5aaYg#5hpE+6nQ|(VSoxT3|biF;BUq#==-27Xi=gihDPYP$7?=9cP zYKE$jeQ|3~_L0VG-(F~2ZPyD0=k{J4Q~h(t__{-mz_w8{JDY9{`1ouzz!Vr5!ECdE z6U~O1k8c}24V7~zzXWTV-Pe4)y}wQJS&q%H5`Fo_f_JvIU489aCX$;P`u#!I-=^4ijC2{&9!O&h>mi?9oYD=GC#%)6{GzN6nQYw+Fal50!#x^asjBBR50i`+mho*ttoqV)ubM2KD9S~k7+FR4>{29?6 z{!l6kDdyTN0YJ9LgkPWeXm|gyi@zM3?0@{&pXT12w|78&W-q!RRF)&iLCEZVH<|fR zN0fr2^t8H(>L?>K#>^+jWROLral(Qy-xoBq1U7A&DV||wClb)Otd9?(gZ|8znMF}D zf<1haWz^s0qgecz;RFGt0C-B4g`jNGHsFU+;{<%t65v^sjk^h$lmWn#B0#_)9ij&d z-~lc`A)YYExi^7sBuPM^Y|wA2g*5?`K?#7tzELQYNxGo$UB$4J8RJp1k(8Jj+~hMT zlN~>M@KTTh^--8y3PK_NZ@AC!{PT=CziBzGd+wTJ^@icH!Bd}%)g8V)%K?|c&WTUk zy}qv1C%(fjRoZ4ozC3{O%@5?)XzH35zHns$pgU*Q?fj4v?fp1Qbm+j;3l;9jam9Da zXVcKjPlQ73x78QPu|Ffm6x?`~e3oD=gl=4kYK?={kD5j~QCXU)`HSdduNNENzA*2$ zOm3PzF!lN5e*06-f1Uot67wY#{o-S1!KZ7E=!~7ynnk9_iJR#kFoNbAOT#^2Gd17F zMmvU6>lndZQGd|ax9kUoXXO+$N?|j@6qpsF&_j7YXvwo_C{JpmLw5&#e6k>atv%es z5)7r*Wvv_JkUpT}M!_o!nVlEk1Zbl=a*2hQ*<|%*K1Glj^FcF`6kTzGQ3lz~2tCc@ z&x|tj;aH&1&9HwcJBcT`;{?a+pnej;M1HO(6Z{#J!cZA04hnFl;NXA+&`=7bjW_^o zfC40u3LMG?NdPtwGl>Tq6u}*QG)}-y;)lu-_>ee3kibW(69n0$0Zy!}9rQz%*v1iO zT9_H>99yIrSPYVy6^);rR}7Yo=J_T@hi+qhTZXnVWyf;JDYm5#eYLTxr*?kiNn!+Y zQ+LUkBafNJ#rH#C(?d5^;gw9o#%daEI{mA*LHPIHPU`#|H$hD zwm>0&+kahQ)E#%~k>&5@&#Vg82H?s%71=)(soi@174pi9--2{w{1$}Sz4zGn3Du&x bht0Iza^2ykEt4(epJ78uh5nDlX8(TxzDYwP literal 0 HcmV?d00001 diff --git a/vnext/local-cli/generator-windows/templates/cs/assets/Square44x44Logo.scale-200.png b/vnext/local-cli/generator-windows/templates/cs/assets/Square44x44Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..ce342a2ec8a61291ba76c54604aea7e9d20af11b GIT binary patch literal 1647 zcmaJ?eM}Q)7(e+G1Q(|`V9JhTI2>MkceK4;p;PR&$Pi?ejk3YQ_3o`S&|W_dsOZ8# zWPTt69g`t$ab`0cj-Y0yiBSOqmd)tG7G(}M5aP0_%&9TijB#&)I{zSE^4@#z^FF`l z`8{8`o%wlL(UI|y2!cdsuVamHH~H86F!*-15em4)NqUpCQM5?aoC_eCf@lV4wvF2a zjDQn1JBL69f&@2M3rvzJcfE!eZ8FZUBlFlC5RD)it33{mF9#B82AiyQE%w)`vlwa> zv{<1sm&kSKK$&%2jSFn7$t&P%%6Ue>R=EAnG8N7fqynWG8L3p!4801a;8{+nliO(qd(jNJ_?+9W3#hLIDLoT6~3fx9=`CC-D}-AMrpEO7HK zt3$GicGPc?GmDjy7K2P@La;eu4!$zWCZ`ym{Z$b zu-O6RM&K4JT|BIZB`E-gxqG%FzanI#+2FFmqHqXG7yxWB=w55RGOM)$xMb(>kSNR z2w=1AZi%z=AmG~yea~XaXJR!v7vLn(RUnELfiB1|6D84ICOS}^Zo2AdN}<&*h}G_u z{xZ!(%>tLT3J3<5XhWy-tg+6)0nmUUENLW8TWA{R6bgVd3X;anYFZ^IRis*_P-C-r z;i>%1^eL3UI2-{w8nuFFcs0e~7J{O2k^~Ce%+Ly4U?|=!0LH=t6()xi<^I-rs+9sF z*q{E-CxZbGPeu#a;XJwE;9S1?#R&uns>^0G3p`hEUF*v`M?@h%T%J%RChmD|EVydq zmHWh*_=S%emRC*mhxaVLzT@>Z2SX0u9v*DIJ@WC^kLVdlGV6LpK$KIrlJqc zpJ921)+3JJdTx|<`G&kXpKkjGJv=76R`yYIQ{#c-`%+`#V(7}Q;&@6U8!Td1`d;?N z_9mnI#?AA}4J!r)LN4!E-@H5eXauuB7TOawS>Y|{-P?NNx-lq+z1W-+y(;39P&&LP zL{N80?&=C*qKmdA^moMZRuPcD!B<*mq$ch=0Cnlitw#txRWhb3%TQvPqjkC`F69G4b! ze7z9MZ#+;_#l?H37UqUhDFb^l&s2{oM$3I0o^Q!yx;;V)QmCMo)Tb_ui|mit8MS?U zm##6$sZZ1$@|s%?l@>4Z<*Q}sRBSKMhb4I{e5LdEhsHIHTe8Bod5c>6QtT>$XgUBz z6MK`kO$=jmt@FqggOhJ5j~e@ygRbG;<{Vu)*+nn9aQeo0;$#j;|MS=S$&L?BeV25z xs3B`@=#`5TF{^6(A1rvdY@|-RtQ|iS5{tyX+wH?;n8E)G$kykv-D^wh{{!TZT%7;_ literal 0 HcmV?d00001 diff --git a/vnext/local-cli/generator-windows/templates/cs/assets/Square44x44Logo.targetsize-24_altform-unplated.png b/vnext/local-cli/generator-windows/templates/cs/assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c02ce97e0a802b85f6021e822c89f8bf57d5cd GIT binary patch literal 1255 zcmaJ>TWs4@7*5+{G#S+&C!qC#> zf>5N3P6jO*Cz>ug*(_DmW=)kea&m$gZ^+nyiF`;j%w@}y8)>p*SH}C`m?DXeieF2U zyQHecc_L%Gh!7GMt+hG06y;+|p4>m~}PjA}rKViGiEnn7G0ZO<>G|7q;2?NwGCM3s?eued6%hd$B+ z*kQJ{#~$S=DFE(%=E+UkmlEI*%3llUf~8Ja9YU1Vui0IbGBkW_gHB%Rd&!!ioX zs40O?i9I{};kle7GMvE7(rk`la=gTI)47=>%?q@^iL-nUo3}h4S}N-KHn8t5mVP8w z&bSErwp+37 zNJJ8?a|{r5Q3R0Z5s-LB1WHOwYC@7pCHWND#cL1cZ?{kJ368_*(UDWUDyb<}0y@o# zfMF016iMWPCb6obAxT$JlB6(2DrlXDTB&!0`!m??4F(qWMhjVZo?JXQmz`1*58Z=& zcDmB|S-E@j?BoFGix0flckqdS4jsPNzhfWyWIM98GxcLs89C(~dw%$_t;JjX-SD}E zfiGV;{8Q%8r}w9x>EEigW81>`kvnU@pK)4+xk9@+bNj9L!AAZ@SZ@q|)&BmY3+HZx zul~BeG4|}-;L%cHViQGQX?^zFfO0&#cHwel=d`lH9sJ-@Sl@n*(8J2>%Ac`IxyY?Q z{=GhWvC#gu-~Ia7*n{=+;qM?Ul_wy1+u7ho;=`>EwP^g~R@{unBds`!#@}tluZQpS zm)M~nYEifJWJGx?_6DcTy>#uh%>!H9=hb^(v`=m3F1{L>db=<5_tm+_&knAQ2EU$s Mu9UqpbNZeC0BbUo^Z)<= literal 0 HcmV?d00001 diff --git a/vnext/local-cli/generator-windows/templates/cs/assets/StoreLogo.png b/vnext/local-cli/generator-windows/templates/cs/assets/StoreLogo.png new file mode 100644 index 0000000000000000000000000000000000000000..7385b56c0e4d3c6b0efe3324aa1194157d837826 GIT binary patch literal 1451 zcmaJ>eN5D57_Z|bH;{0+1#mbl)eTU3{h)Wf7EZV?;HD@XL@{B`Ui%(2aMxQ~xdXSv z5nzWi(LW)U2=Vc-cY@s7nPt{i0hc6!7xN4NNHI#EQl>YNBy8l4%x9gr_W-j zEZMQmmTIy(>;lblRfh`dIyTgc9W5d!VP$L4(kKrN1c5G~(O_#xG zAJCNTstD^5SeXFB+&$h=ToJP2H>xr$iqPs-#O*;4(!Fjw25-!gEb*)mU}=)J;Iu>w zxK(5XoD0wrPSKQ~rbL^Cw6O_03*l*}i=ydbu7adJ6y;%@tjFeXIXT+ms30pmbOP%Q zX}S;+LBh8Tea~TSkHzvX6$rYb)+n&{kSbIqh|c7hmlxmwSiq5iVhU#iEQ<>a18|O^Sln-8t&+t`*{qBWo5M?wFM(JuimAOb5!K#D}XbslM@#1ZVz_;!9U zpfEpLAOz=0g@bd6Xj_ILi-x^!M}73h^o@}hM$1jflTs|Yuj9AL@A3<-?MV4!^4q`e z)fO@A;{9K^?W?DbnesnPr6kK>$zaKo&;FhFd(GYFCIU^T+OIMb%Tqo+P%oq(IdX7S zf6+HLO?7o0m+p>~Tp5UrXWh!UH!wZ5kv!E`_w)PTpI(#Iw{AS`gH4^b(bm^ZCq^FZ zY9DD7bH}rq9mg88+KgA$Zp!iWncuU2n1AuIa@=sWvUR-s`Qb{R*kk(SPU^`$6BXz8 zn#7yaFOIK%qGxyi`dYtm#&qqox0$h=pNi#u=M8zUG@bpiZ=3sT=1}Trr}39cC)H|v zbL?W)=&s4zrh)7>L(|cc%$1#!zfL?HjpeP%T+x_a+jZ16b^iKOHxFEX$7d|8${H-* zIrOJ5w&i$>*D>AKaIoYg`;{L@jM((Kt?$N$5OnuPqVvq**Nm}(f0wwOF%iX_Pba;V z;m@wxX&NcV3?<1+u?A{y_DIj7#m3Af1rCE)o`D&Y3}0%7E;iX1yMDiS)sh0wKi!36 zL!Wmq?P^Ku&rK~HJd97KkLTRl>ScGFYZNlYytWnhmuu|)L&ND8_PmkayQb{HOY640 bno1(wj@u8DCVuFR|31B*4ek@pZJqxCDDe1x literal 0 HcmV?d00001 diff --git a/vnext/local-cli/generator-windows/templates/cs/assets/Wide310x150Logo.scale-200.png b/vnext/local-cli/generator-windows/templates/cs/assets/Wide310x150Logo.scale-200.png new file mode 100644 index 0000000000000000000000000000000000000000..288995b397fdbef1fb7e85afd71445d5de1952c5 GIT binary patch literal 3204 zcmbVPeQXow8NYmBd90>}0NP?GhXW~VaeThm=a0tV#EwJMI!)6M3}|c4_Bl3=Kd>G0 z(GHx1wl<7(tP?FsOQkTilSo*iIvF%uArExJ73~P zSv1xEy!U(Wd4A9D`FQV@W3@F^qJ@PEF$@z`Z!*BbFsS(^?B zyiAzJ+q})bkgiQHWqEb*jJD-coHYr1^iocg)l!Qa{Xqs-l~6J}p-|##ZHYofskQ3$ zI0;xzXyhazBeXhIsg5A=%ufo@f)1yy&ScKS0;HF^!r_2UE^lpZEom(+@duma3awTv zCrCL-%D_SvYWIcdHkmI}#50(fkUi)Qgx!80ju>g1za^}ff>JI8Z@^-iCiaCgg@TgF z+vtE?Q9{VQUX&MW9SYYmGcxA14%N2@7FwBTD4N<(2{nWgV8$e3?-F=L^&FrtWn~(U_Q~~^uYiyeY6-KoTnfh9AWz@ zIKje0)u!_Lw)E}G!#kEfwKVdNt(UAf9*f>tEL_(=xco-T%jTi@7YlC3hs2ik%Le0H ztj}RTeCF(5mwvi3_56>-yB?l;J>-1%!9~=fs|QcNG3J~a@JCu`4SB460s0ZO+##4fFUSGLcj_ja^fL4&BKALfb#$6$O?>P@qx2Agl^x0i&ugt zsy5Pyu=()`7HRMG3IB7F1@`_ z+-!J%#i6e^U$e#+C%Q>_qVRzWRsG^W_n+@OcX@vzI&z;mzHNb!GQ?LWA(wtpqHqTM z1OFw_{Zn?fD)p)`c`kOgv{de=v@suGRqY{N^U7gI1VF3*F=obwaXI6ob5__Yn zVTguS!%(NI09J8x#AO_aW!9W7k*UvB;IWDFC3srwftr{kHj%g)fvnAm;&h_dnl~

MY- zf+K}sCe8qU6Ujs`3ua{U0Of$R_gVQBuUA za0v=mu#vIOqiiAZOr&h*$WyOw&k-xr$;G4Ixa!#TJNr>95(h>l%)PUy4p+^SgR(uR zta%k*?ny-+nAr8spEk1fo{J4i!b^Fia`N{_F6@zidA2ZTTrjl#^5Z-2KfB@Cu}l9s z(*|Z2jc?p~vn2f)3y9i*7zJV1L{$?|&q)4oaT;uXi6>1GkRXVTOzAz(RHEmr=eFIi z`}<>-Q?K0GN8!IYxeP1XKXO+jsJbp~o^);Bc;%b7Flpe7;1`Ny@3r7ZR;?R)aJt8C ziNlEC<@3f_lIV4TwV}&e;D!Ee5_|e#g0LUh=5vmYWYm7&2h*M>QPKvGh9-)wfMMW3 z8J9b%1k7dzPzO0_NGQy92BZ^FR6R~6;^6?lqO;-QUP4BY%cG%3vEhbm#>4vIhPBh3 z-+pZGjh$x%Hp{?=FHsMp0&wNPlj00us{&`1ZOZTqs8%4X&xH=UDr*xyBW(Zp&Em94 zf)ZSfn#yg0N)>!1kWdkqJ^S*z0FF5|fj&qcE#Na|%OY0$uO>!&hP+1ywfD_WXk@4J(?MBftK7>$Nvqh@tDuarN%PrTLQ2Uzysx>UV=V zk^RrDSvdQ?0;=hY67EgII-f4`t=+i*yS=Y~!XlqIy_4x&%+OdfbKOFPXS2X5%4R{N z$SQMX^AK6(fA + + diff --git a/vnext/local-cli/generator-windows/templates/src/App.xaml.cs b/vnext/local-cli/generator-windows/templates/cs/src/App.xaml.cs similarity index 100% rename from vnext/local-cli/generator-windows/templates/src/App.xaml.cs rename to vnext/local-cli/generator-windows/templates/cs/src/App.xaml.cs diff --git a/vnext/local-cli/generator-windows/templates/src/MainPage.xaml b/vnext/local-cli/generator-windows/templates/cs/src/MainPage.xaml similarity index 100% rename from vnext/local-cli/generator-windows/templates/src/MainPage.xaml rename to vnext/local-cli/generator-windows/templates/cs/src/MainPage.xaml diff --git a/vnext/local-cli/generator-windows/templates/src/MainPage.xaml.cs b/vnext/local-cli/generator-windows/templates/cs/src/MainPage.xaml.cs similarity index 100% rename from vnext/local-cli/generator-windows/templates/src/MainPage.xaml.cs rename to vnext/local-cli/generator-windows/templates/cs/src/MainPage.xaml.cs diff --git a/vnext/local-cli/generator-windows/templates/src/Package.appxmanifest b/vnext/local-cli/generator-windows/templates/cs/src/Package.appxmanifest similarity index 100% rename from vnext/local-cli/generator-windows/templates/src/Package.appxmanifest rename to vnext/local-cli/generator-windows/templates/cs/src/Package.appxmanifest diff --git a/vnext/local-cli/generator-windows/templates/src/Properties/AssemblyInfo.cs b/vnext/local-cli/generator-windows/templates/cs/src/Properties/AssemblyInfo.cs similarity index 100% rename from vnext/local-cli/generator-windows/templates/src/Properties/AssemblyInfo.cs rename to vnext/local-cli/generator-windows/templates/cs/src/Properties/AssemblyInfo.cs diff --git a/vnext/local-cli/generator-windows/templates/src/Properties/Default.rd.xml b/vnext/local-cli/generator-windows/templates/cs/src/Properties/Default.rd.xml similarity index 100% rename from vnext/local-cli/generator-windows/templates/src/Properties/Default.rd.xml rename to vnext/local-cli/generator-windows/templates/cs/src/Properties/Default.rd.xml diff --git a/vnext/local-cli/runWindows/utils/build.js b/vnext/local-cli/runWindows/utils/build.js index 1c6e6bd77e0..102abe2b70f 100644 --- a/vnext/local-cli/runWindows/utils/build.js +++ b/vnext/local-cli/runWindows/utils/build.js @@ -17,11 +17,11 @@ const util = require('util'); const existsAsync = util.promisify(fs.exists); async function buildSolution(slnFile, buildType, buildArch, verbose) { - const minVersion = new Version(10, 0, 10586, 0); + const minVersion = new Version(10, 0, 18362, 0); const allVersions = MSBuildTools.getAllAvailableUAPVersions(); if (!allVersions.some(v => v.gte(minVersion))) { throw new Error( - 'Must have a minimum Windows SDK version 10.0.10586.0 installed', + 'Must have a minimum Windows SDK version 10.0.18362.0 installed', ); } diff --git a/vnext/package.json b/vnext/package.json index aaba3a30d2b..039d9d481b3 100644 --- a/vnext/package.json +++ b/vnext/package.json @@ -1,6 +1,6 @@ { "name": "react-native-windows", - "version": "0.60.0-vnext.6", + "version": "0.60.0-vnext.23", "license": "MIT", "repository": { "type": "git", @@ -46,13 +46,13 @@ "eslint": "5.1.0", "just-scripts": "^0.24.2", "prettier": "1.17.0", - "react-native": "https://github.com/microsoft/react-native/archive/v0.60.0-microsoft-fb60merge.13.tar.gz", + "react-native": "https://github.com/microsoft/react-native/archive/v0.60.0-microsoft.5.tar.gz", "react": "16.8.6", "typescript": "3.5.3" }, "peerDependencies": { "react": "16.8.6", - "react-native": "^0.60.0 || 0.60.0-microsoft-fb60merge.13 || https://github.com/microsoft/react-native/archive/v0.60.0-microsoft-fb60merge.13.tar.gz" + "react-native": "^0.60.0 || 0.60.0-microsoft.5 || https://github.com/microsoft/react-native/archive/v0.60.0-microsoft.5.tar.gz" }, "beachball": { "defaultNpmTag": "vnext", diff --git a/vnext/src/Libraries/Utilities/Dimensions.windows.js b/vnext/src/Libraries/Utilities/Dimensions.windows.js new file mode 100644 index 00000000000..a8c36d174f6 --- /dev/null +++ b/vnext/src/Libraries/Utilities/Dimensions.windows.js @@ -0,0 +1,142 @@ +/** + * Copyright (c) Facebook, Inc. and its affiliates. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @format + * @flow + */ + +'use strict'; + +const EventEmitter = require('EventEmitter'); +const RCTDeviceEventEmitter = require('RCTDeviceEventEmitter'); + +const invariant = require('invariant'); + +const eventEmitter = new EventEmitter(); +let dimensionsInitialized = false; +const dimensions = {}; +class Dimensions { + /** + * This should only be called from native code by sending the + * didUpdateDimensions event. + * + * @param {object} dims Simple string-keyed object of dimensions to set + */ + static set(dims: {[key: string]: any}): void { + // We calculate the window dimensions in JS so that we don't encounter loss of + // precision in transferring the dimensions (which could be non-integers) over + // the bridge. + if (dims && dims.windowPhysicalPixels) { + // parse/stringify => Clone hack + dims = JSON.parse(JSON.stringify(dims)); + + const windowPhysicalPixels = dims.windowPhysicalPixels; + dims.window = { + width: windowPhysicalPixels.width / windowPhysicalPixels.scale, + height: windowPhysicalPixels.height / windowPhysicalPixels.scale, + scale: windowPhysicalPixels.scale, + fontScale: windowPhysicalPixels.fontScale, + }; + // Screen and window dimensions are different on windows + const screenPhysicalPixels = dims.screenPhysicalPixels; + dims.screen = { + width: screenPhysicalPixels.width / screenPhysicalPixels.scale, + height: screenPhysicalPixels.height / screenPhysicalPixels.scale, + scale: screenPhysicalPixels.scale, + fontScale: screenPhysicalPixels.fontScale, + }; + + // delete so no callers rely on this existing + delete dims.screenPhysicalPixels; + // delete so no callers rely on this existing + delete dims.windowPhysicalPixels; + } + + Object.assign(dimensions, dims); + if (dimensionsInitialized) { + // Don't fire 'change' the first time the dimensions are set. + eventEmitter.emit('change', { + window: dimensions.window, + screen: dimensions.screen, + }); + } else { + dimensionsInitialized = true; + } + } + + /** + * Initial dimensions are set before `runApplication` is called so they should + * be available before any other require's are run, but may be updated later. + * + * Note: Although dimensions are available immediately, they may change (e.g + * due to device rotation) so any rendering logic or styles that depend on + * these constants should try to call this function on every render, rather + * than caching the value (for example, using inline styles rather than + * setting a value in a `StyleSheet`). + * + * Example: `var {height, width} = Dimensions.get('window');` + * + * @param {string} dim Name of dimension as defined when calling `set`. + * @returns {Object?} Value for the dimension. + */ + static get(dim: string): Object { + invariant(dimensions[dim], 'No dimension set for key ' + dim); + return dimensions[dim]; + } + + /** + * Add an event handler. Supported events: + * + * - `change`: Fires when a property within the `Dimensions` object changes. The argument + * to the event handler is an object with `window` and `screen` properties whose values + * are the same as the return values of `Dimensions.get('window')` and + * `Dimensions.get('screen')`, respectively. + */ + static addEventListener(type: string, handler: Function) { + invariant( + type === 'change', + 'Trying to subscribe to unknown event: "%s"', + type, + ); + eventEmitter.addListener(type, handler); + } + + /** + * Remove an event handler. + */ + static removeEventListener(type: string, handler: Function) { + invariant( + type === 'change', + 'Trying to remove listener for unknown event: "%s"', + type, + ); + eventEmitter.removeListener(type, handler); + } +} + +let dims: ?{[key: string]: any} = + global.nativeExtensions && + global.nativeExtensions.DeviceInfo && + global.nativeExtensions.DeviceInfo.Dimensions; +let nativeExtensionsEnabled = true; +if (!dims) { + const DeviceInfo = require('DeviceInfo'); + dims = DeviceInfo.Dimensions; + nativeExtensionsEnabled = false; +} + +invariant( + dims, + 'Either DeviceInfo native extension or DeviceInfo Native Module must be registered', +); +Dimensions.set(dims); +if (!nativeExtensionsEnabled) { + RCTDeviceEventEmitter.addListener('didUpdateDimensions', function(update) { + Dimensions.set(update); + }); +} + +module.exports = Dimensions; diff --git a/vnext/jest/hasteImpl.js b/vnext/src/jest/hasteImpl.js similarity index 79% rename from vnext/jest/hasteImpl.js rename to vnext/src/jest/hasteImpl.js index 8db2f5572a7..ac8a85b4add 100644 --- a/vnext/jest/hasteImpl.js +++ b/vnext/src/jest/hasteImpl.js @@ -5,15 +5,10 @@ */ 'use strict'; -const {realpathSync} = require('fs'); const path = require('path'); -const rnRoot = realpathSync( - path.resolve(require.resolve('react-native/package.json'), '..'), -); - -function createHaste(pluginRoots, pluginNameReducers) { - const ROOTS = [rnRoot + path.sep, ...pluginRoots]; +function createHaste(roots) { + const ROOTS = roots; const IGNORE_PATTERNS /*: Array */ = [ /.*[\\\/]__(mocks|tests)__[\\\/].*/, @@ -36,8 +31,6 @@ function createHaste(pluginRoots, pluginNameReducers) { [/^(.*)\.js(\.flow)?$/, '$1'], // strip platform suffix [/^(.*)\.(android|ios|native|windesktop|windows|macos)$/, '$1'], - // strip plugin platform suffixes - ...pluginNameReducers, ]; const haste = { @@ -78,7 +71,4 @@ function createHaste(pluginRoots, pluginNameReducers) { return haste; } -module.exports = createHaste( - [path.resolve(__dirname, '..') + path.sep], - [[/^(.*)\.(windows)$/, '$1'], [/^(.*)\.(windesktop)$/, '$1']], -); +module.exports = createHaste([path.resolve(__dirname, '..') + path.sep]); diff --git a/yarn.lock b/yarn.lock index 69f935df15a..278e47718eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1325,15 +1325,15 @@ dependencies: core-js "^2.5.7" -"@lerna/add@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.16.2.tgz#90ecc1be7051cfcec75496ce122f656295bd6e94" - integrity sha512-RAAaF8aODPogj2Ge9Wj3uxPFIBGpog9M+HwSuq03ZnkkO831AmasCTJDqV+GEpl1U2DvnhZQEwHpWmTT0uUeEw== +"@lerna/add@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/add/-/add-3.16.5.tgz#55f0aa4096d7c91c883ada073b4fa09e985fa9f8" + integrity sha512-vBG0G/w3yfbyaXSiOqRl86mRphBPPBinlPBqcFjxkuwvj58g/7gBBmBrji7WFO05eYvXVR0QZZik7NJ6qZSWWw== dependencies: "@evocateur/pacote" "^9.6.3" - "@lerna/bootstrap" "3.16.2" - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" + "@lerna/bootstrap" "3.16.5" + "@lerna/command" "3.16.5" + "@lerna/filter-options" "3.16.5" "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" dedent "^0.7.0" @@ -1341,29 +1341,20 @@ p-map "^2.1.0" semver "^6.2.0" -"@lerna/batch-packages@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/batch-packages/-/batch-packages-3.16.0.tgz#1c16cb697e7d718177db744cbcbdac4e30253c8c" - integrity sha512-7AdMkANpubY/FKFI01im01tlx6ygOBJ/0JcixMUWoWP/7Ds3SWQF22ID6fbBr38jUWptYLDs2fagtTDL7YUPuA== +"@lerna/bootstrap@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.16.5.tgz#936a42aca313a9e7d9381bd951072b0678927a89" + integrity sha512-GCQ93vjxiyt8YN8IvRO12sSNE9r57hLF9AoDaGc8JI3a4N9oVPIcth91/vs4y2j4E53d/ZQlSmfX0cM6rVqPAg== dependencies: - "@lerna/package-graph" "3.16.0" - npmlog "^4.1.2" - -"@lerna/bootstrap@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/bootstrap/-/bootstrap-3.16.2.tgz#be268d940221d3c3270656b9b791b492559ad9d8" - integrity sha512-I+gs7eh6rv9Vyd+CwqL7sftRfOOsSzCle8cv/CGlMN7/p7EAVhxEdAw8SYoHIKHzipXszuqqy1Y3opyleD0qdA== - dependencies: - "@lerna/batch-packages" "3.16.0" - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" - "@lerna/has-npm-version" "3.16.0" - "@lerna/npm-install" "3.16.0" + "@lerna/command" "3.16.5" + "@lerna/filter-options" "3.16.5" + "@lerna/has-npm-version" "3.16.5" + "@lerna/npm-install" "3.16.5" "@lerna/package-graph" "3.16.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" + "@lerna/rimraf-dir" "3.16.5" "@lerna/run-lifecycle" "3.16.2" - "@lerna/run-parallel-batches" "3.16.0" + "@lerna/run-topologically" "3.16.0" "@lerna/symlink-binary" "3.16.2" "@lerna/symlink-dependencies" "3.16.2" "@lerna/validation-error" "3.13.0" @@ -1379,45 +1370,45 @@ read-package-tree "^5.1.6" semver "^6.2.0" -"@lerna/changed@3.16.4": - version "3.16.4" - resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.16.4.tgz#c3e727d01453513140eee32c94b695de577dc955" - integrity sha512-NCD7XkK744T23iW0wqKEgF4R9MYmReUbyHCZKopFnsNpQdqumc3SOIvQUAkKCP6hQJmYvxvOieoVgy/CVDpZ5g== +"@lerna/changed@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/changed/-/changed-3.16.5.tgz#62426ffc9427daa201e8fd4a13685a0dbfe3f3c7" + integrity sha512-Sj66BK/QyYv7YxAQrFg6H+7X68OnSKsVVyTMKtfIFkj1t8ey67DNav0Y14AGNQq+CX0CtaiA0ZybC0KJcjtMDQ== dependencies: - "@lerna/collect-updates" "3.16.0" - "@lerna/command" "3.16.0" + "@lerna/collect-updates" "3.16.5" + "@lerna/command" "3.16.5" "@lerna/listable" "3.16.0" "@lerna/output" "3.13.0" - "@lerna/version" "3.16.4" + "@lerna/version" "3.16.5" -"@lerna/check-working-tree@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.14.2.tgz#5ce007722180a69643a8456766ed8a91fc7e9ae1" - integrity sha512-7safqxM/MYoAoxZxulUDtIJIbnBIgo0PB/FHytueG+9VaX7GMnDte2Bt1EKa0dz2sAyQdmQ3Q8ZXpf/6JDjaeg== +"@lerna/check-working-tree@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/check-working-tree/-/check-working-tree-3.16.5.tgz#b4f8ae61bb4523561dfb9f8f8d874dd46bb44baa" + integrity sha512-xWjVBcuhvB8+UmCSb5tKVLB5OuzSpw96WEhS2uz6hkWVa/Euh1A0/HJwn2cemyK47wUrCQXtczBUiqnq9yX5VQ== dependencies: - "@lerna/collect-uncommitted" "3.14.2" - "@lerna/describe-ref" "3.14.2" + "@lerna/collect-uncommitted" "3.16.5" + "@lerna/describe-ref" "3.16.5" "@lerna/validation-error" "3.13.0" -"@lerna/child-process@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.14.2.tgz#950240cba83f7dfe25247cfa6c9cebf30b7d94f6" - integrity sha512-xnq+W5yQb6RkwI0p16ZQnrn6HkloH/MWTw4lGE1nKsBLAUbmSU5oTE93W1nrG0X3IMF/xWc9UYvNdUGMWvZZ4w== +"@lerna/child-process@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/child-process/-/child-process-3.16.5.tgz#38fa3c18064aa4ac0754ad80114776a7b36a69b2" + integrity sha512-vdcI7mzei9ERRV4oO8Y1LHBZ3A5+ampRKg1wq5nutLsUA4mEBN6H7JqjWOMY9xZemv6+kATm2ofjJ3lW5TszQg== dependencies: chalk "^2.3.1" execa "^1.0.0" strong-log-transformer "^2.0.0" -"@lerna/clean@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.16.0.tgz#1c134334cacea1b1dbeacdc580e8b9240db8efa1" - integrity sha512-5P9U5Y19WmYZr7UAMGXBpY7xCRdlR7zhHy8MAPDKVx70rFIBS6nWXn5n7Kntv74g7Lm1gJ2rsiH5tj1OPcRJgg== +"@lerna/clean@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/clean/-/clean-3.16.5.tgz#1177bb404245c8a9db2b722ec53849d619fec0de" + integrity sha512-PT//BXS11bf+lHF3LYVw+24/Rxk+vXBqZIsx8p1+ICia/lYXlxUgF90IQFGAT0OTu82j014VgozggoI+C3eLWw== dependencies: - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" + "@lerna/command" "3.16.5" + "@lerna/filter-options" "3.16.5" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" - "@lerna/rimraf-dir" "3.14.2" + "@lerna/rimraf-dir" "3.16.5" p-map "^2.1.0" p-map-series "^1.0.0" p-waterfall "^1.0.0" @@ -1432,33 +1423,33 @@ npmlog "^4.1.2" yargs "^12.0.1" -"@lerna/collect-uncommitted@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.14.2.tgz#b5ed00d800bea26bb0d18404432b051eee8d030e" - integrity sha512-4EkQu4jIOdNL2BMzy/N0ydHB8+Z6syu6xiiKXOoFl0WoWU9H1jEJCX4TH7CmVxXL1+jcs8FIS2pfQz4oew99Eg== +"@lerna/collect-uncommitted@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/collect-uncommitted/-/collect-uncommitted-3.16.5.tgz#a494d61aac31cdc7aec4bbe52c96550274132e63" + integrity sha512-ZgqnGwpDZiWyzIQVZtQaj9tRizsL4dUOhuOStWgTAw1EMe47cvAY2kL709DzxFhjr6JpJSjXV5rZEAeU3VE0Hg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" chalk "^2.3.1" figgy-pudding "^3.5.1" npmlog "^4.1.2" -"@lerna/collect-updates@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.16.0.tgz#6db3ce8a740a4e2b972c033a63bdfb77f2553d8c" - integrity sha512-HwAIl815X2TNlmcp28zCrSdXfoZWNP7GJPEqNWYk7xDJTYLqQ+SrmKUePjb3AMGBwYAraZSEJLbHdBpJ5+cHmQ== +"@lerna/collect-updates@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/collect-updates/-/collect-updates-3.16.5.tgz#26496d6036ae4b421d211fc332c37a996b181dc0" + integrity sha512-JWeN/ghfQ0llfPtUWtNSHRCqAncHGF0hznsTVqxCoQ3j8GacgYaBLfC3FsUfTnUm8BQ1pi7prAclMoBvfmMwyQ== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/describe-ref" "3.14.2" + "@lerna/child-process" "3.16.5" + "@lerna/describe-ref" "3.16.5" minimatch "^3.0.4" npmlog "^4.1.2" slash "^2.0.0" -"@lerna/command@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.16.0.tgz#ba3dba49cb5ce4d11b48269cf95becd86e30773f" - integrity sha512-u7tE4GC4/gfbPA9eQg+0ulnoJ+PMoMqomx033r/IxqZrHtmJR9+pF/37S0fsxJ2hX/RMFPC7c9Q/i8NEufSpdQ== +"@lerna/command@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/command/-/command-3.16.5.tgz#3a889acbd0d39362b37445ba4ced01878bcb4fba" + integrity sha512-sXv+a+ljEfW6aEKxmnv3rLbbWpDQi3IVdDoezCATkbqMYUssZGz43UwUVuaYikViB86SLBbtprFrVcZBaqAfCQ== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/package-graph" "3.16.0" "@lerna/project" "3.16.0" "@lerna/validation-error" "3.13.0" @@ -1495,14 +1486,14 @@ fs-extra "^8.1.0" npmlog "^4.1.2" -"@lerna/create@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.16.0.tgz#4de841ec7d98b29bb19fb7d6ad982e65f7a150e8" - integrity sha512-OZApR1Iz7awutbmj4sAArwhqCyKgcrnw9rH0aWAUrkYWrD1w4TwkvAcYAsfx5GpQGbLQwoXhoyyPwPfZRRWz3Q== +"@lerna/create@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/create/-/create-3.16.5.tgz#e733c767ba11f6ef89cecafb1f0ed094c90bcdae" + integrity sha512-eScA3iNhjeVAaaNDaVVmsupM4Sulmr4AQVPEfNUN+f6aU7KuvBwbe0Nh46xtQhgNTcSSWj9pmO2IisTrzq4ezA== dependencies: "@evocateur/pacote" "^9.6.3" - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.16.5" "@lerna/npm-conf" "3.16.0" "@lerna/validation-error" "3.13.0" camelcase "^5.0.0" @@ -1519,42 +1510,42 @@ validate-npm-package-name "^3.0.0" whatwg-url "^7.0.0" -"@lerna/describe-ref@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.14.2.tgz#edc3c973f5ca9728d23358c4f4d3b55a21f65be5" - integrity sha512-qa5pzDRK2oBQXNjyRmRnN7E8a78NMYfQjjlRFB0KNHMsT6mCiL9+8kIS39sSE2NqT8p7xVNo2r2KAS8R/m3CoQ== +"@lerna/describe-ref@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/describe-ref/-/describe-ref-3.16.5.tgz#a338c25aaed837d3dc70b8a72c447c5c66346ac0" + integrity sha512-c01+4gUF0saOOtDBzbLMFOTJDHTKbDFNErEY6q6i9QaXuzy9LNN62z+Hw4acAAZuJQhrVWncVathcmkkjvSVGw== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" -"@lerna/diff@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.16.0.tgz#6d09a786f9f5b343a2fdc460eb0be08a05b420aa" - integrity sha512-QUpVs5TPl8vBIne10/vyjUxanQBQQp7Lk3iaB8MnCysKr0O+oy7trWeFVDPEkBTCD177By7yPGyW5Yey1nCBbA== +"@lerna/diff@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/diff/-/diff-3.16.5.tgz#5b5ceb596f562e7329cbb50d27ed5ec4231e754f" + integrity sha512-19Nchn4Yem/FyNqXSMzv3RP3/jRBTpu1i/Z/nCrt5lA0D2fFv9uCh9aE2XnzqZ0r7qiGJZNOMax/TIOqq3KtFA== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.16.5" "@lerna/validation-error" "3.13.0" npmlog "^4.1.2" -"@lerna/exec@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.16.0.tgz#2b6c033cee46181b6eede0eb12aad5c2c0181e89" - integrity sha512-mH3O5NXf/O88jBaBBTUf+d56CUkxpg782s3Jxy7HWbVuSUULt3iMRPTh+zEXO5/555etsIVVDDyUR76meklrJA== +"@lerna/exec@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/exec/-/exec-3.16.5.tgz#2a3055263d89dc59d593f0eaab4f22286d47e142" + integrity sha512-z7ceaYr3B9Zzmf5TlPulMNOKhsq6emzWSuiTX57eMWCnVfqDt34dM89HredJwFAmxLSlhqHuGQOhwyOaEY7+2g== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.16.5" + "@lerna/filter-options" "3.16.5" "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" p-map "^2.1.0" -"@lerna/filter-options@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.16.0.tgz#b1660b4480c02a5c6efa4d0cd98b9afde4ed0bba" - integrity sha512-InIi1fF8+PxpCwir9bIy+pGxrdE6hvN0enIs1eNGCVS1TTE8osNgiZXa838bMQ1yaEccdcnVX6Z03BNKd56kNg== +"@lerna/filter-options@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/filter-options/-/filter-options-3.16.5.tgz#2137a75c0e5aa28c9bdfb75f53755aa28abfa202" + integrity sha512-PnkrDPJHvQ3k19JFG8jJVasVbZhg+Ckg5u9aVA254T3BSA2CT7MtXjB+snS76npe83170zII0iYufDUY4rhm0A== dependencies: - "@lerna/collect-updates" "3.16.0" + "@lerna/collect-updates" "3.16.5" "@lerna/filter-packages" "3.16.0" dedent "^0.7.0" @@ -1583,12 +1574,12 @@ ssri "^6.0.1" tar "^4.4.8" -"@lerna/github-client@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.0.tgz#619874e461641d4f59ab1b3f1a7ba22dba88125d" - integrity sha512-IVJjcKjkYaUEPJsDyAblHGEFFNKCRyMagbIDm14L7Ab94ccN6i4TKOqAFEJn2SJHYvKKBdp3Zj2zNlASOMe3DA== +"@lerna/github-client@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/github-client/-/github-client-3.16.5.tgz#2eb0235c3bf7a7e5d92d73e09b3761ab21f35c2e" + integrity sha512-rHQdn8Dv/CJrO3VouOP66zAcJzrHsm+wFuZ4uGAai2At2NkgKH+tpNhQy2H1PSC0Ezj9LxvdaHYrUzULqVK5Hw== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@octokit/plugin-enterprise-rest" "^3.6.1" "@octokit/rest" "^16.28.4" git-url-parse "^11.1.2" @@ -1608,21 +1599,21 @@ resolved "https://registry.yarnpkg.com/@lerna/global-options/-/global-options-3.13.0.tgz#217662290db06ad9cf2c49d8e3100ee28eaebae1" integrity sha512-SlZvh1gVRRzYLVluz9fryY1nJpZ0FHDGB66U9tFfvnnxmueckRQxLopn3tXj3NU1kc3QANT2I5BsQkOqZ4TEFQ== -"@lerna/has-npm-version@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.0.tgz#55764a4ce792f0c8553cf996a17f554b9e843288" - integrity sha512-TIY036dA9J8OyTrZq9J+it2DVKifL65k7hK8HhkUPpitJkw6jwbMObA/8D40LOGgWNPweJWqmlrTbRSwsR7DrQ== +"@lerna/has-npm-version@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/has-npm-version/-/has-npm-version-3.16.5.tgz#ab83956f211d8923ea6afe9b979b38cc73b15326" + integrity sha512-WL7LycR9bkftyqbYop5rEGJ9sRFIV55tSGmbN1HLrF9idwOCD7CLrT64t235t3t4O5gehDnwKI5h2U3oxTrF8Q== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" semver "^6.2.0" -"@lerna/import@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.16.0.tgz#b57cb453f4acfc60f6541fcbba10674055cb179d" - integrity sha512-trsOmGHzw0rL/f8BLNvd+9PjoTkXq2Dt4/V2UCha254hMQaYutbxcYu8iKPxz9x86jSPlH7FpbTkkHXDsoY7Yg== +"@lerna/import@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/import/-/import-3.16.5.tgz#3fe1f11ad25ff929963b8d7e331ac391c4920947" + integrity sha512-n5zy9zeNziS/jex/rHiw7YSpnsfGYXBLv4RSm0gnKouV+dvKocUd139S0oHJG3oQgL+B6anZpR/3ajxz4QcZ4w== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.16.5" "@lerna/prompt" "3.13.0" "@lerna/pulse-till-done" "3.13.0" "@lerna/validation-error" "3.13.0" @@ -1630,35 +1621,35 @@ fs-extra "^8.1.0" p-map-series "^1.0.0" -"@lerna/init@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.16.0.tgz#31e0d66bbededee603338b487a42674a072b7a7d" - integrity sha512-Ybol/x5xMtBgokx4j7/Y3u0ZmNh0NiSWzBFVaOs2NOJKvuqrWimF67DKVz7yYtTYEjtaMdug64ohFF4jcT/iag== +"@lerna/init@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/init/-/init-3.16.5.tgz#ca45889d6d15c46e26d1b45b59ef455006df7f68" + integrity sha512-K8JtSHbPxR5pZHJ0GUXGhMdx+E/pDnbp8JbTUkEkLCyRHp3C0VFAtINJ+ysSpObleTFivA1xrgwqG8JbgI213Q== dependencies: - "@lerna/child-process" "3.14.2" - "@lerna/command" "3.16.0" + "@lerna/child-process" "3.16.5" + "@lerna/command" "3.16.5" fs-extra "^8.1.0" p-map "^2.1.0" write-json-file "^3.2.0" -"@lerna/link@3.16.2": - version "3.16.2" - resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.16.2.tgz#6c3a5658f6448a64dddca93d9348ac756776f6f6" - integrity sha512-eCPg5Lo8HT525fIivNoYF3vWghO3UgEVFdbsiPmhzwI7IQyZro5HWYzLtywSAdEog5XZpd2Bbn0CsoHWBB3gww== +"@lerna/link@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/link/-/link-3.16.5.tgz#6cde475f4fb1c60cf0ed32386b241cb34220f0e6" + integrity sha512-5Ik4c7wdYdCUZaeG6+aNmvUPcuxCvlESdxs1Fx2yL1avi1GdAGEH/l1zdhPDMzE8HiUZRhwShemXAJkhGmSTIQ== dependencies: - "@lerna/command" "3.16.0" + "@lerna/command" "3.16.5" "@lerna/package-graph" "3.16.0" "@lerna/symlink-dependencies" "3.16.2" p-map "^2.1.0" slash "^2.0.0" -"@lerna/list@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.16.0.tgz#883c00b2baf1e03c93e54391372f67a01b773c2f" - integrity sha512-TkvstoPsgKqqQ0KfRumpsdMXfRSEhdXqOLq519XyI5IRWYxhoqXqfi8gG37UoBPhBNoe64japn5OjphF3rOmQA== +"@lerna/list@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/list/-/list-3.16.5.tgz#eb27d826a1614d447377b446a552570bc1744830" + integrity sha512-HJgJigTyIvLOWvdW5++Ewam+owk2aNPg/niqqIaV90OtzsEd55Cqb2ziIWdFLRFLYPu66HHhJOXBnGfP1uNl9A== dependencies: - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" + "@lerna/command" "3.16.5" + "@lerna/filter-options" "3.16.5" "@lerna/listable" "3.16.0" "@lerna/output" "3.13.0" @@ -1700,12 +1691,12 @@ npm-package-arg "^6.1.0" npmlog "^4.1.2" -"@lerna/npm-install@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.0.tgz#8ec76a7a13b183bde438fd46296bf7a0d6f86017" - integrity sha512-APUOIilZCzDzce92uLEwzt1r7AEMKT/hWA1ThGJL+PO9Rn8A95Km3o2XZAYG4W0hR+P4O2nSVuKbsjQtz8CjFQ== +"@lerna/npm-install@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-install/-/npm-install-3.16.5.tgz#d6bfdc16f81285da66515ae47924d6e278d637d3" + integrity sha512-hfiKk8Eku6rB9uApqsalHHTHY+mOrrHeWEs+gtg7+meQZMTS3kzv4oVp5cBZigndQr3knTLjwthT/FX4KvseFg== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" fs-extra "^8.1.0" npm-package-arg "^6.1.0" @@ -1728,12 +1719,12 @@ pify "^4.0.1" read-package-json "^2.0.13" -"@lerna/npm-run-script@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.14.2.tgz#8c518ea9d241a641273e77aad6f6fddc16779c3f" - integrity sha512-LbVFv+nvAoRTYLMrJlJ8RiakHXrLslL7Jp/m1R18vYrB8LYWA3ey+nz5Tel2OELzmjUiemAKZsD9h6i+Re5egg== +"@lerna/npm-run-script@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/npm-run-script/-/npm-run-script-3.16.5.tgz#9c2ec82453a26c0b46edc0bb7c15816c821f5c15" + integrity sha512-1asRi+LjmVn3pMjEdpqKJZFT/3ZNpb+VVeJMwrJaV/3DivdNg7XlPK9LTrORuKU4PSvhdEZvJmSlxCKyDpiXsQ== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" "@lerna/get-npm-exec-opts" "3.13.0" npmlog "^4.1.2" @@ -1819,19 +1810,19 @@ inquirer "^6.2.0" npmlog "^4.1.2" -"@lerna/publish@3.16.4": - version "3.16.4" - resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.16.4.tgz#4cd55d8be9943d9a68e316e930a90cda8590500e" - integrity sha512-XZY+gRuF7/v6PDQwl7lvZaGWs8CnX6WIPIu+OCcyFPSL/rdWegdN7HieKBHskgX798qRQc2GrveaY7bNoTKXAw== +"@lerna/publish@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/publish/-/publish-3.16.5.tgz#d101f3a18ea117269c997ef5ba65117d65cafd08" + integrity sha512-gJzvzeOWj0d4+RWCAcCyvFXN246Dwl2WpOLtWKwdFUC3fz+tvCI7FO8moPbaJt6EqYRMDaoeqVQnIrSeisbZDw== dependencies: "@evocateur/libnpmaccess" "^3.1.2" "@evocateur/npm-registry-fetch" "^4.0.0" "@evocateur/pacote" "^9.6.3" - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.16.0" - "@lerna/command" "3.16.0" - "@lerna/describe-ref" "3.14.2" + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.16.5" + "@lerna/command" "3.16.5" + "@lerna/describe-ref" "3.16.5" "@lerna/log-packed" "3.16.0" "@lerna/npm-conf" "3.16.0" "@lerna/npm-dist-tag" "3.16.0" @@ -1845,7 +1836,7 @@ "@lerna/run-lifecycle" "3.16.2" "@lerna/run-topologically" "3.16.0" "@lerna/validation-error" "3.13.0" - "@lerna/version" "3.16.4" + "@lerna/version" "3.16.5" figgy-pudding "^3.5.1" fs-extra "^8.1.0" npm-package-arg "^6.1.0" @@ -1879,12 +1870,12 @@ npmlog "^4.1.2" read-cmd-shim "^1.0.1" -"@lerna/rimraf-dir@3.14.2": - version "3.14.2" - resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.14.2.tgz#103a49882abd85d42285d05cc76869b89f21ffd2" - integrity sha512-eFNkZsy44Bu9v1Hrj5Zk6omzg8O9h/7W6QYK1TTUHeyrjTEwytaNQlqF0lrTLmEvq55sviV42NC/8P3M2cvq8Q== +"@lerna/rimraf-dir@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/rimraf-dir/-/rimraf-dir-3.16.5.tgz#04316ab5ffd2909657aaf388ea502cb8c2f20a09" + integrity sha512-bQlKmO0pXUsXoF8lOLknhyQjOZsCc0bosQDoX4lujBXSWxHVTg1VxURtWf2lUjz/ACsJVDfvHZbDm8kyBk5okA== dependencies: - "@lerna/child-process" "3.14.2" + "@lerna/child-process" "3.16.5" npmlog "^4.1.2" path-exists "^3.0.0" rimraf "^2.6.2" @@ -1899,14 +1890,6 @@ npm-lifecycle "^3.1.2" npmlog "^4.1.2" -"@lerna/run-parallel-batches@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/run-parallel-batches/-/run-parallel-batches-3.16.0.tgz#5ace7911a2dd31dfd1e53c61356034e27df0e1fb" - integrity sha512-2J/Nyv+MvogmQEfC7VcS21ifk7w0HVvzo2yOZRPvkCzGRu/rducxtB4RTcr58XCZ8h/Bt1aqQYKExu3c/3GXwg== - dependencies: - p-map "^2.1.0" - p-map-series "^1.0.0" - "@lerna/run-topologically@3.16.0": version "3.16.0" resolved "https://registry.yarnpkg.com/@lerna/run-topologically/-/run-topologically-3.16.0.tgz#39e29cfc628bbc8e736d8e0d0e984997ac01bbf5" @@ -1916,14 +1899,14 @@ figgy-pudding "^3.5.1" p-queue "^4.0.0" -"@lerna/run@3.16.0": - version "3.16.0" - resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.16.0.tgz#1ea568c6f303e47fa00b3403a457836d40738fd2" - integrity sha512-woTeLlB1OAAz4zzjdI6RyIxSGuxiUPHJZm89E1pDEPoWwtQV6HMdMgrsQd9ATsJ5Ez280HH4bF/LStAlqW8Ufg== +"@lerna/run@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/run/-/run-3.16.5.tgz#66466fbe3edfe94b29f53341c05e7a509b1e8388" + integrity sha512-sORjqiGJvbLhax/QE9IfTKsvUGfNDu8bUkxxhnbxYu0tGhgWhiPzRVZ564QG9zQ6D23CGd/wQ0AHyrsRPulbzQ== dependencies: - "@lerna/command" "3.16.0" - "@lerna/filter-options" "3.16.0" - "@lerna/npm-run-script" "3.14.2" + "@lerna/command" "3.16.5" + "@lerna/filter-options" "3.16.5" + "@lerna/npm-run-script" "3.16.5" "@lerna/output" "3.13.0" "@lerna/run-topologically" "3.16.0" "@lerna/timer" "3.13.0" @@ -1965,17 +1948,17 @@ dependencies: npmlog "^4.1.2" -"@lerna/version@3.16.4": - version "3.16.4" - resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.16.4.tgz#b5cc37f3ad98358d599c6196c30b6efc396d42bf" - integrity sha512-ikhbMeIn5ljCtWTlHDzO4YvTmpGTX1lWFFIZ79Vd1TNyOr+OUuKLo/+p06mCl2WEdZu0W2s5E9oxfAAQbyDxEg== +"@lerna/version@3.16.5": + version "3.16.5" + resolved "https://registry.yarnpkg.com/@lerna/version/-/version-3.16.5.tgz#5e4726e623d67f2ae3af9833a14fb71b2d04f09e" + integrity sha512-GHwIqC6rLldpn7e4P/Ms+ygu9nC/1UJidpaBa6qhvuXlIaqJuFKdQGHTXfuvCBUS+/LTA3Cb9cQZgob9aocOkA== dependencies: - "@lerna/check-working-tree" "3.14.2" - "@lerna/child-process" "3.14.2" - "@lerna/collect-updates" "3.16.0" - "@lerna/command" "3.16.0" + "@lerna/check-working-tree" "3.16.5" + "@lerna/child-process" "3.16.5" + "@lerna/collect-updates" "3.16.5" + "@lerna/command" "3.16.5" "@lerna/conventional-commits" "3.16.4" - "@lerna/github-client" "3.16.0" + "@lerna/github-client" "3.16.5" "@lerna/gitlab-client" "3.15.0" "@lerna/output" "3.13.0" "@lerna/prerelease-id-from-version" "3.16.0" @@ -2004,34 +1987,34 @@ write-file-atomic "^2.3.0" "@microsoft/api-documenter@^7.3.8": - version "7.4.6" - resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.4.6.tgz#fbe535429a03966ff1d0a6b73f01562bd19dcfc0" - integrity sha512-X3HaPvPqjoBIgtICayaJSt2MlacuNsv4epx4bbw1ltMqg+wkW98NwDNaAWSCNlltkrFyTF8MdDJM3+n3GbDSVg== + version "7.5.0" + resolved "https://registry.yarnpkg.com/@microsoft/api-documenter/-/api-documenter-7.5.0.tgz#444265cf9080ca4574ea57e72216a0921b3ae377" + integrity sha512-jeLFI++McNAu9deF47AnPvlMnZIeSGRQwjo5GVIZ378nN7tOziZhUFnmKfwPW8gQqjVVylB5tudxI4LvzC6BUA== dependencies: - "@microsoft/api-extractor-model" "7.4.2" - "@microsoft/node-core-library" "3.15.0" - "@microsoft/ts-command-line" "4.3.1" + "@microsoft/api-extractor-model" "7.5.1" + "@microsoft/node-core-library" "3.15.1" + "@microsoft/ts-command-line" "4.3.2" "@microsoft/tsdoc" "0.12.14" colors "~1.2.1" js-yaml "~3.13.1" resolve "1.8.1" -"@microsoft/api-extractor-model@7.4.2": - version "7.4.2" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.4.2.tgz#e7dea5aa6717fdbeb2745df57f3b118163a2e510" - integrity sha512-VlboZFGViNCqwUKCxHwaJX1hq7X+1zpfpqSecY/lZowrUJZx8IQ+bT8vZGpy6Qmm9+ay3O3hwUqW47Z/Mr0yMA== +"@microsoft/api-extractor-model@7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor-model/-/api-extractor-model-7.5.1.tgz#54732ab60cc0761784a54fc00eaaf96145724160" + integrity sha512-qzgmJeoqpJqYDS1yj9YTPdd/+9OWGFwfzGFyr6kVarexomdPSltcoQYIS5JnrB/RFNeUgTNUlwn5mYdyp2Xv6A== dependencies: - "@microsoft/node-core-library" "3.15.0" + "@microsoft/node-core-library" "3.15.1" "@microsoft/tsdoc" "0.12.14" "@microsoft/api-extractor@^7.3.8": - version "7.4.4" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.4.4.tgz#f7810c2b1bf171fcdc5c821172be7779f33e75b4" - integrity sha512-qemjsGUzVHfIuRyergBEQpogj73Jnrc12F8XsjuXak+oRHIl3n1nrcy7MyjxDNSoNQ5ARay2eP1zzeIKVxN7Rw== + version "7.5.0" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.5.0.tgz#5dd0f50bb7a30f8512b65ed9aba94a2b76c68a21" + integrity sha512-CxKNZFD9TRo/y8MQzlk4z/Z5jPCaQsDq7ON9baE544CKnmF4sNlmoS9ydkt0As3v6OYKjp50d2N4NAmZoOVXzg== dependencies: - "@microsoft/api-extractor-model" "7.4.2" - "@microsoft/node-core-library" "3.15.0" - "@microsoft/ts-command-line" "4.3.1" + "@microsoft/api-extractor-model" "7.5.1" + "@microsoft/node-core-library" "3.15.1" + "@microsoft/ts-command-line" "4.3.2" "@microsoft/tsdoc" "0.12.14" colors "~1.2.1" lodash "~4.17.15" @@ -2039,10 +2022,10 @@ source-map "~0.6.1" typescript "~3.5.3" -"@microsoft/node-core-library@3.15.0": - version "3.15.0" - resolved "https://registry.yarnpkg.com/@microsoft/node-core-library/-/node-core-library-3.15.0.tgz#e6e84848346eacdafa4e497e2368a5a83a950d6f" - integrity sha512-MoK3STynla/oH7m0llHkRR9mUCIsZ5t/ENKYLS5upkii91/MHZeZJZsjuRlO8biaNy6W9XpBp23f3fEk72yFiw== +"@microsoft/node-core-library@3.15.1": + version "3.15.1" + resolved "https://registry.yarnpkg.com/@microsoft/node-core-library/-/node-core-library-3.15.1.tgz#78f6249493b09e9a5c39df9e55c5401d69f23f19" + integrity sha512-fUrcgu+w40k2GW8fiOUFby7jaKAAuDKaTrQuFQ3j+0Pg3ANnJ2uKtVf3bgFiNu+uVKpwVtLo4CPS8TwFduJRow== dependencies: "@types/node" "8.10.54" colors "~1.2.1" @@ -2055,10 +2038,10 @@ resolved "https://registry.yarnpkg.com/@microsoft/package-deps-hash/-/package-deps-hash-2.2.170.tgz#32c6e9268c2e129e98b4452b530c6fc152044f4a" integrity sha512-dUkeTu0t4L4i9An96E5iPgvYhhqdtdx3dQP9qlpqb+suCFfvdoftDD4lC0euk3yCwoAQB6LVGdPkE4Y6vSQgkg== -"@microsoft/ts-command-line@4.3.1": - version "4.3.1" - resolved "https://registry.yarnpkg.com/@microsoft/ts-command-line/-/ts-command-line-4.3.1.tgz#9a73337a85d0789a1d31528f6a241e9e59dd5c8c" - integrity sha512-xkr13d0Ef55U/r1BKmiIVGE0StFE2tOv9430VUxIb3mpWEIfKMaTrXQhCftty7uClbHV/syllUQkerCCv/bj2A== +"@microsoft/ts-command-line@4.3.2": + version "4.3.2" + resolved "https://registry.yarnpkg.com/@microsoft/ts-command-line/-/ts-command-line-4.3.2.tgz#87341de2e24f279259297ebd38530300a9f97bc3" + integrity sha512-2QeyilabCe6IpBylPXuY6dCA1S9ym3Ii0zakXVPpyfjSj1NesnyuUeuh6e8kyIqzqJ+3LYjfPG63XzUBtwGqqw== dependencies: "@types/argparse" "1.0.33" argparse "~1.0.9" @@ -2310,9 +2293,9 @@ integrity sha512-kaYyLYf6ICn6/isAyD4K1MyWWd5Q3JgH6bnMN089LUx88+s4W8GvK9Q6JMBVu5vsFFp7pMdSxdKmlBXwH/VFRg== "@types/node@^10.12.18", "@types/node@^10.14.8": - version "10.14.18" - resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.18.tgz#b7d45fc950e6ffd7edc685e890d13aa7b8535dce" - integrity sha512-ryO3Q3++yZC/+b8j8BdKd/dn9JlzlHBPdm80656xwYUdmPkpTGTjkAdt6BByiNupGPE8w0FhBgvYy/fX9hRNGQ== + version "10.14.21" + resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.21.tgz#4a9db7ef1d1671c0015e632c5fa3d46c86c58c1e" + integrity sha512-nuFlRdBiqbF+PJIEVxm2jLFcQWN7q7iWEJGsBV4n7v1dbI9qXB8im2pMMKMCUZe092sQb5SQft2DHfuQGK5hqQ== "@types/ora@^3.2.0": version "3.2.0" @@ -2467,13 +2450,13 @@ validator "^11.0.0" "@wdio/local-runner@^5.10.1": - version "5.13.1" - resolved "https://registry.yarnpkg.com/@wdio/local-runner/-/local-runner-5.13.1.tgz#d8e53605fd76a9ec9a863723c4b34d2ee2f2caf8" - integrity sha512-MAfvxQMyxwDVpgTRwIvD/uhdR/vT5O9tq7T/I+iz5ye0HbJw1xhZ8LDoZzP4T9TCaEQGehvaYBEPLzFL5lixsA== + version "5.13.2" + resolved "https://registry.yarnpkg.com/@wdio/local-runner/-/local-runner-5.13.2.tgz#e8aed67bf318d7dfd1605941f0a42ed9bcf1bf36" + integrity sha512-1w+hR1ZsaBWEDQqUeTHbKpYX3HxYPKkCnCBmcLjUPq9Na/TeCXkRuoRoIn0MV7RhcLbbrZdeaRZTW7Ttn4SUEw== dependencies: - "@wdio/logger" "^5.12.1" - "@wdio/repl" "^5.13.0-alpha.0" - "@wdio/runner" "^5.13.1" + "@wdio/logger" "5.13.2" + "@wdio/repl" "5.13.2" + "@wdio/runner" "5.13.2" async-exit-hook "^2.0.1" stream-buffers "^3.0.2" @@ -2499,31 +2482,24 @@ dependencies: "@wdio/config" "5.13.2" -"@wdio/repl@^5.13.0-alpha.0": - version "5.13.0-alpha.0" - resolved "https://registry.yarnpkg.com/@wdio/repl/-/repl-5.13.0-alpha.0.tgz#2e8e3b1498bfae793ed0acab714f54c8f98d68bd" - integrity sha512-yjMMhfqX58Drha6OsQuFUGdRwx58F4E42zp8M4DLJU1sD9Mg0uqRjmF8TPSUoYn3QqUNCclhL+UHU5lEuAWlSg== - dependencies: - "@wdio/config" "^5.13.0-alpha.0" - -"@wdio/reporter@5.13.2", "@wdio/reporter@^5.12.1": +"@wdio/reporter@5.13.2": version "5.13.2" resolved "https://registry.yarnpkg.com/@wdio/reporter/-/reporter-5.13.2.tgz#df755d25ff49f86e0d7a6ddccc4b4dfa40483a73" integrity sha512-oHKlsNw1vcw6k7HZvww3hhmyuDpBrlSK7mneHkqv/hg/oOnsDDxbY3RZzyquni+ZVMUHnnlQ/8YxforVMCt1aA== dependencies: fs-extra "^8.0.1" -"@wdio/runner@^5.13.1": - version "5.13.1" - resolved "https://registry.yarnpkg.com/@wdio/runner/-/runner-5.13.1.tgz#0d612612156a4cb7adff148c18c1487100dcaffd" - integrity sha512-zQciyJQMig68iHrg0A9uc+Ur4AQt2HfId6kJeA+R5kjuZy1FQvik94pQ0PoeiS3FVUtUKm4W8FOPNunAQ+q0FQ== +"@wdio/runner@5.13.2": + version "5.13.2" + resolved "https://registry.yarnpkg.com/@wdio/runner/-/runner-5.13.2.tgz#93aa0ecf86fe6d30833905a7963a21786be43491" + integrity sha512-9X7krISsMJI3nk7zJQ+3OVSJAl4DL3Z2bwQNNhAK8O+HsI361gPk1UGBRFlWoFZ0plQt5okVF8KJYblV90BMyg== dependencies: - "@wdio/config" "^5.13.0-alpha.0" - "@wdio/logger" "^5.12.1" - "@wdio/utils" "^5.13.0" + "@wdio/config" "5.13.2" + "@wdio/logger" "5.13.2" + "@wdio/utils" "5.13.2" deepmerge "^4.0.0" gaze "^1.1.2" - webdriverio "^5.13.1" + webdriverio "5.13.2" "@wdio/sync@^5.10.1": version "5.13.0" @@ -3769,9 +3745,9 @@ bcrypt-pbkdf@^1.0.0: tweetnacl "^0.14.3" beachball@^1.13.4: - version "1.13.4" - resolved "https://registry.yarnpkg.com/beachball/-/beachball-1.13.4.tgz#1649a2d5f0d6e366388b71e3a6992911303345a7" - integrity sha512-f5RIRmOubRxCjl03w+tOHnBVAsy+pVAfzTEQjv7nnesxfYPbUWqdF/zDcst2B1Xq3OHWjfTMdwcP03neYZOQaQ== + version "1.14.1" + resolved "https://registry.yarnpkg.com/beachball/-/beachball-1.14.1.tgz#91683f5c98d87778548b66458480e99fcdff1226" + integrity sha512-MKPaTaBeycAyDXailj1On0Lxsi6AKnVnNdrcBIj++Lpfy2xRnjACuP1CX+Yvw4qf6+FRPmbgVbj/xyU+GZbXXA== dependencies: fs-extra "^8.0.1" git-url-parse "^11.1.2" @@ -5241,9 +5217,9 @@ es-abstract@^1.10.0, es-abstract@^1.11.0, es-abstract@^1.13.0, es-abstract@^1.5. object-keys "^1.0.12" es-abstract@^1.12.0: - version "1.14.2" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.14.2.tgz#7ce108fad83068c8783c3cdf62e504e084d8c497" - integrity sha512-DgoQmbpFNOofkjJtKwr87Ma5EW4Dc8fWhD0R+ndq7Oc456ivUfGOOP6oAZTTKl5/CcNMP+EN+e3/iUzgE0veZg== + version "1.15.0" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.15.0.tgz#8884928ec7e40a79e3c9bc812d37d10c8b24cc57" + integrity sha512-bhkEqWJ2t2lMeaJDuk7okMkJWI/yqgH/EoGwpcvv0XW9RWQsRspI4wt6xuyuvMvvQE3gg/D9HXppgk21w78GyQ== dependencies: es-to-primitive "^1.2.0" function-bind "^1.1.1" @@ -5253,8 +5229,8 @@ es-abstract@^1.12.0: is-regex "^1.0.4" object-inspect "^1.6.0" object-keys "^1.1.1" - string.prototype.trimleft "^2.0.0" - string.prototype.trimright "^2.0.0" + string.prototype.trimleft "^2.1.0" + string.prototype.trimright "^2.1.0" es-to-primitive@^1.2.0: version "1.2.0" @@ -5386,19 +5362,19 @@ eslint-plugin-react-native@3.6.0: eslint-plugin-react-native-globals "^0.1.1" eslint-plugin-react@7.12.4, eslint-plugin-react@^7.14.1: - version "7.14.3" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.14.3.tgz#911030dd7e98ba49e1b2208599571846a66bdf13" - integrity sha512-EzdyyBWC4Uz2hPYBiEJrKCUi2Fn+BJ9B/pJQcjw5X+x/H2Nm59S4MJIvL4O5NEE0+WbnQwEBxWY03oUk+Bc3FA== + version "7.16.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.16.0.tgz#9928e4f3e2122ed3ba6a5b56d0303ba3e41d8c09" + integrity sha512-GacBAATewhhptbK3/vTP09CbFrgUJmBSaaRcWdbQLFvUZy9yVcQxigBNHGPU/KE2AyHpzj3AWXpxoMTsIDiHug== dependencies: array-includes "^3.0.3" doctrine "^2.1.0" has "^1.0.3" - jsx-ast-utils "^2.1.0" + jsx-ast-utils "^2.2.1" object.entries "^1.1.0" object.fromentries "^2.0.0" object.values "^1.1.0" prop-types "^15.7.2" - resolve "^1.10.1" + resolve "^1.12.0" eslint-scope@3.7.1: version "3.7.1" @@ -7399,7 +7375,7 @@ jsprim@^1.2.2: json-schema "0.2.3" verror "1.10.0" -jsx-ast-utils@^2.1.0: +jsx-ast-utils@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/jsx-ast-utils/-/jsx-ast-utils-2.2.1.tgz#4d4973ebf8b9d2837ee91a8208cc66f3a2776cfb" integrity sha512-v3FxCcAf20DayI+uxnCuw795+oOIkVu6EnJ1+kSzhqqTZHNkTZ7B66ZgLp4oLJ/gbA64cI0B7WRoHZMSRdyVRQ== @@ -7567,25 +7543,25 @@ lcid@^2.0.0: invert-kv "^2.0.0" lerna@^3.16.1: - version "3.16.4" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.16.4.tgz#158cb4f478b680f46f871d5891f531f3a2cb31ec" - integrity sha512-0HfwXIkqe72lBLZcNO9NMRfylh5Ng1l8tETgYQ260ZdHRbPuaLKE3Wqnd2YYRRkWfwPyEyZO8mZweBR+slVe1A== - dependencies: - "@lerna/add" "3.16.2" - "@lerna/bootstrap" "3.16.2" - "@lerna/changed" "3.16.4" - "@lerna/clean" "3.16.0" + version "3.16.5" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-3.16.5.tgz#6bfdae5d156bbd27fc9710de4d8a9d4c6a59c660" + integrity sha512-82QY1+IVxmzdgbl9FvRZuHxG7B9f0IeYtxZ6xkp4fk6heCEsZx4uTiwlb0jSxOzmundenRKJ0WYAisehfS8hqw== + dependencies: + "@lerna/add" "3.16.5" + "@lerna/bootstrap" "3.16.5" + "@lerna/changed" "3.16.5" + "@lerna/clean" "3.16.5" "@lerna/cli" "3.13.0" - "@lerna/create" "3.16.0" - "@lerna/diff" "3.16.0" - "@lerna/exec" "3.16.0" - "@lerna/import" "3.16.0" - "@lerna/init" "3.16.0" - "@lerna/link" "3.16.2" - "@lerna/list" "3.16.0" - "@lerna/publish" "3.16.4" - "@lerna/run" "3.16.0" - "@lerna/version" "3.16.4" + "@lerna/create" "3.16.5" + "@lerna/diff" "3.16.5" + "@lerna/exec" "3.16.5" + "@lerna/import" "3.16.5" + "@lerna/init" "3.16.5" + "@lerna/link" "3.16.5" + "@lerna/list" "3.16.5" + "@lerna/publish" "3.16.5" + "@lerna/run" "3.16.5" + "@lerna/version" "3.16.5" import-local "^2.0.0" npmlog "^4.1.2" @@ -9892,10 +9868,10 @@ react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.9.0.tgz#21ca9561399aad0ff1a7701c01683e8ca981edcb" integrity sha512-tJBzzzIgnnRfEm046qRcURvwQnZVXmuCbscxUO5RWrGTXpon2d4c8mI0D8WE6ydVIm29JiLB6+RslkIvym9Rjw== -"react-native@https://github.com/microsoft/react-native/archive/v0.60.0-microsoft-fb60merge.13.tar.gz": - version "0.60.0-microsoft-fb60merge.13" - uid "2846ab59aa8bafc7d2f6d73d5223ad5e5f4589f0" - resolved "https://github.com/microsoft/react-native/archive/v0.60.0-microsoft-fb60merge.13.tar.gz#2846ab59aa8bafc7d2f6d73d5223ad5e5f4589f0" +"react-native@https://github.com/microsoft/react-native/archive/v0.60.0-microsoft.3.tar.gz": + version "0.60.0-microsoft.3" + uid a547be3bac4b2e499203c2536b706c6addeb2e9e + resolved "https://github.com/microsoft/react-native/archive/v0.60.0-microsoft.3.tar.gz#a547be3bac4b2e499203c2536b706c6addeb2e9e" dependencies: "@babel/core" "^7.4.0" "@babel/generator" "^7.4.0" @@ -9938,6 +9914,7 @@ react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: fbjs-scripts "^1.1.0" invariant "^2.2.4" jsc-android "245459.0.0" + metro "0.54.1" metro-babel-register "0.54.1" metro-react-native-babel-transformer "0.54.1" nullthrows "^1.1.0" @@ -10351,7 +10328,7 @@ resolve@1.8.1: dependencies: path-parse "^1.0.5" -resolve@^1.1.6, resolve@^1.10.0, resolve@^1.10.1, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: +resolve@^1.1.6, resolve@^1.10.0, resolve@^1.12.0, resolve@^1.3.2, resolve@^1.5.0, resolve@^1.8.1: version "1.12.0" resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.12.0.tgz#3fc644a35c84a48554609ff26ec52b66fa577df6" integrity sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w== @@ -10429,10 +10406,10 @@ rimraf@~2.6.2: dependencies: glob "^7.1.3" -rnpm-plugin-windows@^0.2.13: - version "0.2.13" - resolved "https://registry.yarnpkg.com/rnpm-plugin-windows/-/rnpm-plugin-windows-0.2.13.tgz#c4e31607ea7fe7ce4279050a65319f33d42f33db" - integrity sha512-j0yQVIxhp3hlfaEhh+FhvDpA86iNI1C+1rr4Vuj7B3ijKnfbYQo5uImI0NB9JN+Hi9iPdXRihFJ4m7n4A1Pqaw== +rnpm-plugin-windows@^0.3.5: + version "0.3.5" + resolved "https://registry.yarnpkg.com/rnpm-plugin-windows/-/rnpm-plugin-windows-0.3.5.tgz#6c84bedda93445017ce7d6d4035b25a1e86cdaf2" + integrity sha512-dCqiEr6QS7/yODKdoBY0b0VzocFilZ8RZDsnIPHIXtQhpo8y1VhJYqxoQAxnE3kFLGDKYuLwgfD8bTo0P2zZcg== dependencies: chalk "^1.1.3" extract-zip "^1.6.7" @@ -11113,7 +11090,7 @@ string.prototype.trim@^1.1.2: es-abstract "^1.13.0" function-bind "^1.1.1" -string.prototype.trimleft@^2.0.0: +string.prototype.trimleft@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/string.prototype.trimleft/-/string.prototype.trimleft-2.1.0.tgz#6cc47f0d7eb8d62b0f3701611715a3954591d634" integrity sha512-FJ6b7EgdKxxbDxc79cOlok6Afd++TTs5szo+zJTUyow3ycrRfJVE2pq3vcN53XexvKZu/DJMDfeI/qMiZTrjTw== @@ -11121,7 +11098,7 @@ string.prototype.trimleft@^2.0.0: define-properties "^1.1.3" function-bind "^1.1.1" -string.prototype.trimright@^2.0.0: +string.prototype.trimright@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/string.prototype.trimright/-/string.prototype.trimright-2.1.0.tgz#669d164be9df9b6f7559fa8e89945b168a5a6c58" integrity sha512-fXZTSV55dNBwv16uw+hh5jkghxSnc5oHq+5K/gXgizHwAvMetdAJlHqqoFC1FSDVPYWLkAKl2cxpUT41sV7nSg== @@ -11948,7 +11925,7 @@ webdriver@5.13.2: lodash.merge "^4.6.1" request "^2.83.0" -webdriverio@5.13.2, webdriverio@^5.10.1, webdriverio@^5.10.9, webdriverio@^5.13.1: +webdriverio@5.13.2, webdriverio@^5.10.1, webdriverio@^5.10.9: version "5.13.2" resolved "https://registry.yarnpkg.com/webdriverio/-/webdriverio-5.13.2.tgz#a64f8cccafdb6fdc9d6f2dbfec981f3378f7d3c4" integrity sha512-SaAMnDqfrxdwQfNFh5Aegn8DqzL6nF07efpDpgHNLJxT7muXSRQg/DWh8GYYNBiCT/GFNtCvj3leoaFAQaHoiA== From 62049fdbd667fc71ae09b09f074446d8593d826d Mon Sep 17 00:00:00 2001 From: Stephen Peters Date: Fri, 11 Oct 2019 13:10:18 -0700 Subject: [PATCH 2/7] Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag. --- .../Modules/Animated/AdditionAnimatedNode.cpp | 4 +- .../Modules/Animated/DivisionAnimatedNode.cpp | 2 +- .../Modules/Animated/ModulusAnimatedNode.cpp | 2 +- .../Animated/MultiplicationAnimatedNode.cpp | 4 +- .../Modules/Animated/PropsAnimatedNode.cpp | 41 ++++++++++++++++++- .../Modules/Animated/PropsAnimatedNode.h | 3 ++ .../Animated/SubtractionAnimatedNode.cpp | 4 +- 7 files changed, 51 insertions(+), 9 deletions(-) diff --git a/vnext/ReactUWP/Modules/Animated/AdditionAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/AdditionAnimatedNode.cpp index 82be88426ff..1dadfa3cdc8 100644 --- a/vnext/ReactUWP/Modules/Animated/AdditionAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/AdditionAnimatedNode.cpp @@ -12,7 +12,7 @@ AdditionAnimatedNode::AdditionAnimatedNode( int64_t tag, const folly::dynamic &config, const std::shared_ptr &manager) - : ValueAnimatedNode(tag, config, manager) { + : ValueAnimatedNode(tag, manager) { for (const auto &inputNode : config.find(s_inputName).dereference().second) { m_inputNodes.insert(static_cast(inputNode.asDouble())); } @@ -24,7 +24,7 @@ AdditionAnimatedNode::AdditionAnimatedNode( anim.Expression([nodes, manager, anim]() { winrt::hstring expr = L"0"; for (const auto tag : nodes) { - const auto identifier = std::to_wstring(tag); + const auto identifier = L"n" + std::to_wstring(tag); anim.SetReferenceParameter( identifier, manager->GetValueAnimatedNode(tag)->PropertySet()); expr = expr + L" + " + identifier + L"." + s_valueName + L" + " + diff --git a/vnext/ReactUWP/Modules/Animated/DivisionAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/DivisionAnimatedNode.cpp index 634fc3d4a25..441de5ce1f5 100644 --- a/vnext/ReactUWP/Modules/Animated/DivisionAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/DivisionAnimatedNode.cpp @@ -34,7 +34,7 @@ DivisionAnimatedNode::DivisionAnimatedNode( L"." + s_valueName + L" + " + s_baseName + L"." + s_offsetName + L")"; for (const auto tag : nodes) { - const auto identifier = std::to_wstring(tag); + const auto identifier = L"n" + std::to_wstring(tag); anim.SetReferenceParameter( identifier, manager->GetValueAnimatedNode(tag)->PropertySet()); expr = expr + L" / (" + identifier + L"." + s_valueName + L" " + diff --git a/vnext/ReactUWP/Modules/Animated/ModulusAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/ModulusAnimatedNode.cpp index 87118b88c2d..645f4579b37 100644 --- a/vnext/ReactUWP/Modules/Animated/ModulusAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/ModulusAnimatedNode.cpp @@ -12,7 +12,7 @@ ModulusAnimatedNode::ModulusAnimatedNode( int64_t tag, const folly::dynamic &config, const std::shared_ptr &manager) - : ValueAnimatedNode(tag, config, manager) { + : ValueAnimatedNode(tag, manager) { m_inputNodeTag = static_cast( config.find(s_inputName).dereference().second.asDouble()); m_modulus = static_cast( diff --git a/vnext/ReactUWP/Modules/Animated/MultiplicationAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/MultiplicationAnimatedNode.cpp index 5ea1eaeac3a..f28cf22e551 100644 --- a/vnext/ReactUWP/Modules/Animated/MultiplicationAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/MultiplicationAnimatedNode.cpp @@ -12,7 +12,7 @@ MultiplicationAnimatedNode::MultiplicationAnimatedNode( int64_t tag, const folly::dynamic &config, const std::shared_ptr &manager) - : ValueAnimatedNode(tag, config, manager) { + : ValueAnimatedNode(tag, manager) { for (const auto &inputNode : config.find(s_inputName).dereference().second) { m_inputNodes.insert(static_cast(inputNode.asDouble())); } @@ -24,7 +24,7 @@ MultiplicationAnimatedNode::MultiplicationAnimatedNode( anim.Expression([nodes, manager, anim]() { winrt::hstring expr = L"1"; for (const auto tag : nodes) { - auto identifier = std::to_wstring(tag); + auto identifier = L"n" + std::to_wstring(tag); anim.SetReferenceParameter( identifier, manager->GetValueAnimatedNode(tag)->PropertySet()); expr = expr + L" * (" + identifier + L"." + s_valueName + L" + " + diff --git a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp index 702d1e7be71..ff0e7762369 100644 --- a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp @@ -21,6 +21,27 @@ PropsAnimatedNode::PropsAnimatedNode( m_propMapping.insert({entry.first.getString(), static_cast(entry.second.asDouble())}); } + + m_subchannelPropertySet = + winrt::Window::Current().Compositor().CreatePropertySet(); + m_subchannelPropertySet.InsertScalar(L"TranslationX", 0.0f); + m_subchannelPropertySet.InsertScalar(L"TranslationY", 0.0f); + m_subchannelPropertySet.InsertScalar(L"ScaleX", 1.0f); + m_subchannelPropertySet.InsertScalar(L"ScaleY", 1.0f); + + m_translationCombined = + winrt::Window::Current().Compositor().CreateExpressionAnimation( + L"Vector3(subchannels.TranslationX, subchannels.TranslationY, 0.0)"); + m_translationCombined.SetReferenceParameter( + L"subchannels", m_subchannelPropertySet); + m_translationCombined.Target(L"Translation"); + + m_scaleCombined = + winrt::Window::Current().Compositor().CreateExpressionAnimation( + L"Vector3(subchannels.ScaleX, subchannels.ScaleY, 1.0)"); + m_scaleCombined.SetReferenceParameter( + L"subchannels", m_subchannelPropertySet); + m_scaleCombined.Target(L"Scale"); } void PropsAnimatedNode::ConnectToView(int64_t viewTag) { @@ -89,7 +110,25 @@ void PropsAnimatedNode::StartAnimations() { if (const auto uiElement = GetUIElement()) { uiElement.RotationAxis(m_rotationAxis); for (const auto anim : m_expressionAnimations) { - uiElement.StartAnimation(anim.second); + if (anim.second.Target() == L"Translation.X") { + m_subchannelPropertySet.StartAnimation(L"TranslationX", anim.second); + uiElement.StartAnimation(m_translationCombined); + } + else if (anim.second.Target() == L"Translation.Y") { + m_subchannelPropertySet.StartAnimation(L"TranslationY", anim.second); + uiElement.StartAnimation(m_translationCombined); + } + else if (anim.second.Target() == L"Scale.X") { + m_subchannelPropertySet.StartAnimation(L"ScaleX", anim.second); + uiElement.StartAnimation(m_translationCombined); + } + else if (anim.second.Target() == L"Scale.Y") { + m_subchannelPropertySet.StartAnimation(L"ScaleY", anim.second); + uiElement.StartAnimation(m_translationCombined); + } + else { + uiElement.StartAnimation(anim.second); + } } if (m_needsCenterPointAnimation) { if (!m_centerPointAnimation) { diff --git a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h index ed5afcbf869..38f1f5056be 100644 --- a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h +++ b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.h @@ -45,6 +45,9 @@ class PropsAnimatedNode : public AnimatedNode { nullptr}; winrt::Numerics::float3 m_rotationAxis{0, 0, 1}; bool m_needsCenterPointAnimation{false}; + winrt::CompositionPropertySet m_subchannelPropertySet{nullptr}; + winrt::CompositionAnimation m_translationCombined{nullptr}; + winrt::CompositionAnimation m_scaleCombined{nullptr}; static constexpr int64_t s_connectedViewTagUnset{-1}; }; diff --git a/vnext/ReactUWP/Modules/Animated/SubtractionAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/SubtractionAnimatedNode.cpp index 10b40e0b524..156b8bed355 100644 --- a/vnext/ReactUWP/Modules/Animated/SubtractionAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/SubtractionAnimatedNode.cpp @@ -12,7 +12,7 @@ SubtractionAnimatedNode::SubtractionAnimatedNode( int64_t tag, const folly::dynamic &config, const std::shared_ptr &manager) - : ValueAnimatedNode(tag, config, manager) { + : ValueAnimatedNode(tag, manager) { for (const auto &inputNode : config.find(s_inputName).dereference().second) { if (m_firstInput == s_firstInputUnset) { m_firstInput = static_cast(inputNode.asDouble()); @@ -34,7 +34,7 @@ SubtractionAnimatedNode::SubtractionAnimatedNode( L"." + s_valueName + L" + " + s_baseName + L"." + s_offsetName + L")"; for (const auto tag : nodes) { - const auto identifier = std::to_wstring(tag); + const auto identifier = L"n" + std::to_wstring(tag); anim.SetReferenceParameter( identifier, manager->GetValueAnimatedNode(tag)->PropertySet()); expr = expr + L" - (" + identifier + L"." + s_valueName + L" + " + From 1d2404cc3d8ca54664e0711d9fd1445b34e6aade Mon Sep 17 00:00:00 2001 From: Stephen Peters Date: Fri, 11 Oct 2019 13:21:33 -0700 Subject: [PATCH 3/7] Change files --- ...indows-2019-10-11-13-21-33-ChainedAnimationsCrash.json | 8 ++++++++ ...tended-2019-10-11-13-21-33-ChainedAnimationsCrash.json | 8 ++++++++ ...indows-2019-10-11-13-21-33-ChainedAnimationsCrash.json | 8 ++++++++ ...in-wpf-2019-10-11-13-21-33-ChainedAnimationsCrash.json | 8 ++++++++ 4 files changed, 32 insertions(+) create mode 100644 change/react-native-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json create mode 100644 change/react-native-windows-extended-2019-10-11-13-21-33-ChainedAnimationsCrash.json create mode 100644 change/rnpm-plugin-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json create mode 100644 change/rnpm-plugin-wpf-2019-10-11-13-21-33-ChainedAnimationsCrash.json diff --git a/change/react-native-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json b/change/react-native-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json new file mode 100644 index 00000000000..28052467eea --- /dev/null +++ b/change/react-native-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json @@ -0,0 +1,8 @@ +{ + "type": "prerelease", + "comment": "Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag.", + "packageName": "react-native-windows", + "email": "stpete@microsoft.com", + "commit": "62049fdbd667fc71ae09b09f074446d8593d826d", + "date": "2019-10-11T20:21:32.900Z" +} \ No newline at end of file diff --git a/change/react-native-windows-extended-2019-10-11-13-21-33-ChainedAnimationsCrash.json b/change/react-native-windows-extended-2019-10-11-13-21-33-ChainedAnimationsCrash.json new file mode 100644 index 00000000000..bd621378ec7 --- /dev/null +++ b/change/react-native-windows-extended-2019-10-11-13-21-33-ChainedAnimationsCrash.json @@ -0,0 +1,8 @@ +{ + "type": "patch", + "comment": "Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag.", + "packageName": "react-native-windows-extended", + "email": "stpete@microsoft.com", + "commit": "62049fdbd667fc71ae09b09f074446d8593d826d", + "date": "2019-10-11T20:21:24.946Z" +} \ No newline at end of file diff --git a/change/rnpm-plugin-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json b/change/rnpm-plugin-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json new file mode 100644 index 00000000000..b52d3cb99fd --- /dev/null +++ b/change/rnpm-plugin-windows-2019-10-11-13-21-33-ChainedAnimationsCrash.json @@ -0,0 +1,8 @@ +{ + "type": "patch", + "comment": "Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag.", + "packageName": "rnpm-plugin-windows", + "email": "stpete@microsoft.com", + "commit": "62049fdbd667fc71ae09b09f074446d8593d826d", + "date": "2019-10-11T20:20:58.182Z" +} \ No newline at end of file diff --git a/change/rnpm-plugin-wpf-2019-10-11-13-21-33-ChainedAnimationsCrash.json b/change/rnpm-plugin-wpf-2019-10-11-13-21-33-ChainedAnimationsCrash.json new file mode 100644 index 00000000000..34fc30f8dbe --- /dev/null +++ b/change/rnpm-plugin-wpf-2019-10-11-13-21-33-ChainedAnimationsCrash.json @@ -0,0 +1,8 @@ +{ + "type": "none", + "comment": "Fix two issues: 1) you cannot animated 2 subchannels of the same property with different animations. to fix this we animated yet another property set for translation and scale owned by the props nodes and use one animation to animate all of the subchannels for the uiElement. 2) Reference parameter names which started with a multi digit number are unsupported so i added an n to the start of each name, which was previously just the node's tag.", + "packageName": "rnpm-plugin-wpf", + "email": "stpete@microsoft.com", + "commit": "62049fdbd667fc71ae09b09f074446d8593d826d", + "date": "2019-10-11T20:21:05.364Z" +} \ No newline at end of file From e1d1e32ca1f56bfbad74a73ed2ec19274a7d61e0 Mon Sep 17 00:00:00 2001 From: Stephen Peters Date: Fri, 11 Oct 2019 13:21:44 -0700 Subject: [PATCH 4/7] yarn format --- .../ReactUWP/Modules/Animated/PropsAnimatedNode.cpp | 12 ++++-------- vnext/ReactUWP/Views/SliderViewManager.cpp | 3 +-- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp index ff0e7762369..96d0e10e16b 100644 --- a/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp +++ b/vnext/ReactUWP/Modules/Animated/PropsAnimatedNode.cpp @@ -113,20 +113,16 @@ void PropsAnimatedNode::StartAnimations() { if (anim.second.Target() == L"Translation.X") { m_subchannelPropertySet.StartAnimation(L"TranslationX", anim.second); uiElement.StartAnimation(m_translationCombined); - } - else if (anim.second.Target() == L"Translation.Y") { + } else if (anim.second.Target() == L"Translation.Y") { m_subchannelPropertySet.StartAnimation(L"TranslationY", anim.second); uiElement.StartAnimation(m_translationCombined); - } - else if (anim.second.Target() == L"Scale.X") { + } else if (anim.second.Target() == L"Scale.X") { m_subchannelPropertySet.StartAnimation(L"ScaleX", anim.second); uiElement.StartAnimation(m_translationCombined); - } - else if (anim.second.Target() == L"Scale.Y") { + } else if (anim.second.Target() == L"Scale.Y") { m_subchannelPropertySet.StartAnimation(L"ScaleY", anim.second); uiElement.StartAnimation(m_translationCombined); - } - else { + } else { uiElement.StartAnimation(anim.second); } } diff --git a/vnext/ReactUWP/Views/SliderViewManager.cpp b/vnext/ReactUWP/Views/SliderViewManager.cpp index da009a15af7..aff3b758e6d 100644 --- a/vnext/ReactUWP/Views/SliderViewManager.cpp +++ b/vnext/ReactUWP/Views/SliderViewManager.cpp @@ -84,8 +84,7 @@ void SliderViewManager::UpdateProperties( slider.IsEnabled(!propertyValue.asBool()); else if (pair.second.isNull()) slider.ClearValue(winrt::Control::IsEnabledProperty()); - } - else if (propertyName == "value") { + } else if (propertyName == "value") { if (propertyValue.isNumber()) slider.Value(static_cast(propertyValue.asDouble())); else if (pair.second.isNull()) From 50abb31ff5af4a23e754aca62f3f338aeb27f4a5 Mon Sep 17 00:00:00 2001 From: Stephen Peters Date: Fri, 11 Oct 2019 14:00:06 -0700 Subject: [PATCH 5/7] Fix an issue with spring animations that did not start from 0, causing them to double count the start value. --- vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp b/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp index 0faa168a4fc..f8277c43ca6 100644 --- a/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp +++ b/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp @@ -56,7 +56,7 @@ SpringAnimationDriver::MakeAnimation(const folly::dynamic &config) { compositor.CreateLinearEasingFunction()); }(); - const auto startValue = GetAnimatedValue()->RawValue(); + const auto startValue = GetAnimatedValue()->Value(); std::vector keyFrames = [this, startValue]() { std::vector keyFrames; bool done = false; @@ -80,12 +80,13 @@ SpringAnimationDriver::MakeAnimation(const folly::dynamic &config) { animation.Duration(duration); auto normalizedProgress = 0.0f; + // We are animating the values offset property which should start at 0. animation.InsertKeyFrame( - normalizedProgress, static_cast(startValue), easingFunction); + normalizedProgress, 0.0f, easingFunction); for (const auto keyFrame : keyFrames) { normalizedProgress = std::min(normalizedProgress + 1.0f / keyFrames.size(), 1.0f); - animation.InsertKeyFrame(normalizedProgress, keyFrame, easingFunction); + animation.InsertKeyFrame(normalizedProgress, keyFrame - static_cast(startValue), easingFunction); } if (m_iterations == -1) { From 08a650a3d5f68f5ea27839973e8ecaf850667ac9 Mon Sep 17 00:00:00 2001 From: Stephen Peters Date: Tue, 15 Oct 2019 14:43:17 -0700 Subject: [PATCH 6/7] respond to feedback. --- vnext/ReactUWP/Views/SliderViewManager.cpp | 8 ++------ vnext/ReactUWP/Views/SliderViewManager.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/vnext/ReactUWP/Views/SliderViewManager.cpp b/vnext/ReactUWP/Views/SliderViewManager.cpp index aff3b758e6d..6a05f0ccd19 100644 --- a/vnext/ReactUWP/Views/SliderViewManager.cpp +++ b/vnext/ReactUWP/Views/SliderViewManager.cpp @@ -30,9 +30,6 @@ class SliderShadowNode : public ShadowNodeBase { void SliderShadowNode::createView() { Super::createView(); - - auto slider = GetView().as(); - auto wkinstance = GetViewManager()->GetReactInstance(); } void SliderShadowNode::updateProperties(const folly::dynamic &&props) { @@ -64,14 +61,13 @@ facebook::react::ShadowNode *SliderViewManager::createShadow() const { XamlView SliderViewManager::CreateViewCore(int64_t tag) { auto slider = winrt::Slider(); - slider.MinHeight(100); return slider; } void SliderViewManager::UpdateProperties( ShadowNodeBase *nodeToUpdate, const folly::dynamic &reactDiffMap) { - auto slider = nodeToUpdate->GetView().as(); + auto slider = nodeToUpdate->GetView().try_as(); if (slider == nullptr) return; @@ -86,7 +82,7 @@ void SliderViewManager::UpdateProperties( slider.ClearValue(winrt::Control::IsEnabledProperty()); } else if (propertyName == "value") { if (propertyValue.isNumber()) - slider.Value(static_cast(propertyValue.asDouble())); + slider.Value(propertyValue.asDouble()); else if (pair.second.isNull()) slider.Value(0); } diff --git a/vnext/ReactUWP/Views/SliderViewManager.h b/vnext/ReactUWP/Views/SliderViewManager.h index 830a50db344..6f96e3c33d0 100644 --- a/vnext/ReactUWP/Views/SliderViewManager.h +++ b/vnext/ReactUWP/Views/SliderViewManager.h @@ -1,4 +1,3 @@ -#pragma once // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. From 4660f7d6b8318f686759dc536de309ddb3037a98 Mon Sep 17 00:00:00 2001 From: Stephen Peters Date: Tue, 15 Oct 2019 17:18:29 -0700 Subject: [PATCH 7/7] yarn format --- vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp | 8 +++++--- vnext/ReactUWP/Views/SliderViewManager.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp b/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp index f8277c43ca6..d446d401c16 100644 --- a/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp +++ b/vnext/ReactUWP/Modules/Animated/SpringAnimationDriver.cpp @@ -81,12 +81,14 @@ SpringAnimationDriver::MakeAnimation(const folly::dynamic &config) { auto normalizedProgress = 0.0f; // We are animating the values offset property which should start at 0. - animation.InsertKeyFrame( - normalizedProgress, 0.0f, easingFunction); + animation.InsertKeyFrame(normalizedProgress, 0.0f, easingFunction); for (const auto keyFrame : keyFrames) { normalizedProgress = std::min(normalizedProgress + 1.0f / keyFrames.size(), 1.0f); - animation.InsertKeyFrame(normalizedProgress, keyFrame - static_cast(startValue), easingFunction); + animation.InsertKeyFrame( + normalizedProgress, + keyFrame - static_cast(startValue), + easingFunction); } if (m_iterations == -1) { diff --git a/vnext/ReactUWP/Views/SliderViewManager.cpp b/vnext/ReactUWP/Views/SliderViewManager.cpp index 6a05f0ccd19..519bdfeae80 100644 --- a/vnext/ReactUWP/Views/SliderViewManager.cpp +++ b/vnext/ReactUWP/Views/SliderViewManager.cpp @@ -67,7 +67,7 @@ XamlView SliderViewManager::CreateViewCore(int64_t tag) { void SliderViewManager::UpdateProperties( ShadowNodeBase *nodeToUpdate, const folly::dynamic &reactDiffMap) { - auto slider = nodeToUpdate->GetView().try_as(); + auto slider = nodeToUpdate->GetView().as(); if (slider == nullptr) return;