From 481390eafb30d840deb11f1399cb9c8762c21dcc Mon Sep 17 00:00:00 2001 From: Ivan Sanz Carasa Date: Thu, 7 May 2020 18:34:09 +0200 Subject: [PATCH] Demo for using a NuGet package (#48) --- demo/BlazorLazyLoading.Components.props | 11 +++++ demo/BlazorLazyLoading.Module.props | 13 ++++++ demo/BlazorLazyLoading.Server.props | 11 +++++ demo/BlazorLazyLoading.Wasm.props | 11 +++++ demo/Demo.sln | 24 ++++++++++ .../LazyComponentFromNuget.csproj | 19 ++++++++ .../Pages/LazyComponentFromNuget.razor | 18 ++++++++ .../LazyComponentFromNuget/_Imports.razor | 7 +++ .../LazyComponentFromNuget/wwwroot/.gitignore | 2 + demo/Logger/Logger.csproj | 10 +---- demo/ModulesHost/.gitignore | 1 + demo/ModulesHost/ModulesHost.csproj | 20 ++++----- demo/ServerHost/ServerHost.csproj | 10 +---- demo/WasmHost/Layout/NavMenu.razor | 6 +-- demo/WasmHost/WasmHost.csproj | 10 +---- .../build/BlazorLazyLoading.Module.props | 21 ++++----- .../build/BlazorLazyLoading.Module.targets | 32 ++++++------- src/ManifestGenerator/GenerateManifest.cs | 45 +++++++------------ src/ManifestGenerator/Logger.cs | 33 ++++++++++++++ .../ComponentManifestGenerator.cs | 11 ++++- .../ManifestGenerators/IManifestGenerator.cs | 2 +- .../RouteManifestGenerator.cs | 11 ++++- 22 files changed, 223 insertions(+), 105 deletions(-) create mode 100644 demo/BlazorLazyLoading.Components.props create mode 100644 demo/BlazorLazyLoading.Module.props create mode 100644 demo/BlazorLazyLoading.Server.props create mode 100644 demo/BlazorLazyLoading.Wasm.props create mode 100644 demo/LazyAreas/LazyComponentFromNuget/LazyComponentFromNuget.csproj create mode 100644 demo/LazyAreas/LazyComponentFromNuget/Pages/LazyComponentFromNuget.razor create mode 100644 demo/LazyAreas/LazyComponentFromNuget/_Imports.razor create mode 100644 demo/LazyAreas/LazyComponentFromNuget/wwwroot/.gitignore create mode 100644 demo/ModulesHost/.gitignore create mode 100644 src/ManifestGenerator/Logger.cs diff --git a/demo/BlazorLazyLoading.Components.props b/demo/BlazorLazyLoading.Components.props new file mode 100644 index 0000000..22417eb --- /dev/null +++ b/demo/BlazorLazyLoading.Components.props @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/demo/BlazorLazyLoading.Module.props b/demo/BlazorLazyLoading.Module.props new file mode 100644 index 0000000..578e013 --- /dev/null +++ b/demo/BlazorLazyLoading.Module.props @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/demo/BlazorLazyLoading.Server.props b/demo/BlazorLazyLoading.Server.props new file mode 100644 index 0000000..1977d8b --- /dev/null +++ b/demo/BlazorLazyLoading.Server.props @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/demo/BlazorLazyLoading.Wasm.props b/demo/BlazorLazyLoading.Wasm.props new file mode 100644 index 0000000..9937f1a --- /dev/null +++ b/demo/BlazorLazyLoading.Wasm.props @@ -0,0 +1,11 @@ + + + + + + + + + + + diff --git a/demo/Demo.sln b/demo/Demo.sln index 97f9b9e..e947539 100644 --- a/demo/Demo.sln +++ b/demo/Demo.sln @@ -37,6 +37,16 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "LazyAreas", "LazyAreas", "{ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Core", "Core\Core.csproj", "{DB1AE536-72C2-4CCD-A7D9-0A79AAEEDA54}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LazyComponentFromNuget", "LazyAreas\LazyComponentFromNuget\LazyComponentFromNuget.csproj", "{A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Imports", "Imports", "{7B174F1E-2091-4D48-9111-B52531C1B865}" + ProjectSection(SolutionItems) = preProject + BlazorLazyLoading.Components.props = BlazorLazyLoading.Components.props + BlazorLazyLoading.Module.props = BlazorLazyLoading.Module.props + BlazorLazyLoading.Server.props = BlazorLazyLoading.Server.props + BlazorLazyLoading.Wasm.props = BlazorLazyLoading.Wasm.props + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -155,6 +165,18 @@ Global {DB1AE536-72C2-4CCD-A7D9-0A79AAEEDA54}.Release|x64.Build.0 = Release|Any CPU {DB1AE536-72C2-4CCD-A7D9-0A79AAEEDA54}.Release|x86.ActiveCfg = Release|Any CPU {DB1AE536-72C2-4CCD-A7D9-0A79AAEEDA54}.Release|x86.Build.0 = Release|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Debug|x64.ActiveCfg = Debug|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Debug|x64.Build.0 = Debug|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Debug|x86.ActiveCfg = Debug|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Debug|x86.Build.0 = Debug|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Release|Any CPU.Build.0 = Release|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Release|x64.ActiveCfg = Release|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Release|x64.Build.0 = Release|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Release|x86.ActiveCfg = Release|Any CPU + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -171,6 +193,8 @@ Global {E503BF43-DE57-4DB6-AF93-A5F765C94154} = {2587AE99-7624-47E4-B6B8-79EC67346F67} {566D14F1-B2FB-463C-A627-C5EB23B763B7} = {2587AE99-7624-47E4-B6B8-79EC67346F67} {DB1AE536-72C2-4CCD-A7D9-0A79AAEEDA54} = {2587AE99-7624-47E4-B6B8-79EC67346F67} + {A4D17AA8-D918-45FD-9CCA-3FC5ECCDBD97} = {566D14F1-B2FB-463C-A627-C5EB23B763B7} + {7B174F1E-2091-4D48-9111-B52531C1B865} = {2587AE99-7624-47E4-B6B8-79EC67346F67} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {B979A335-AE81-406A-AADA-F236549D23D3} diff --git a/demo/LazyAreas/LazyComponentFromNuget/LazyComponentFromNuget.csproj b/demo/LazyAreas/LazyComponentFromNuget/LazyComponentFromNuget.csproj new file mode 100644 index 0000000..4deafe9 --- /dev/null +++ b/demo/LazyAreas/LazyComponentFromNuget/LazyComponentFromNuget.csproj @@ -0,0 +1,19 @@ + + + + netstandard2.1 + 3.0 + + + + + + + + + + + + + + diff --git a/demo/LazyAreas/LazyComponentFromNuget/Pages/LazyComponentFromNuget.razor b/demo/LazyAreas/LazyComponentFromNuget/Pages/LazyComponentFromNuget.razor new file mode 100644 index 0000000..372a1c7 --- /dev/null +++ b/demo/LazyAreas/LazyComponentFromNuget/Pages/LazyComponentFromNuget.razor @@ -0,0 +1,18 @@ +@page "/lazy-component-from-nuget" + +

Lazy Component from NuGet

+

+ The following component is rendered from a nuget package (Faso.Blazor.SpinKit in this case). + The nuget DLL will only be loaded when opening this page for the first time. Please check the network tab :) +

+ +@* + Works fine out of the box +*@ + + +@* + Requires the Module to have: + + +*@ +@**@ diff --git a/demo/LazyAreas/LazyComponentFromNuget/_Imports.razor b/demo/LazyAreas/LazyComponentFromNuget/_Imports.razor new file mode 100644 index 0000000..c10f507 --- /dev/null +++ b/demo/LazyAreas/LazyComponentFromNuget/_Imports.razor @@ -0,0 +1,7 @@ +@using System.Net.Http +@using Microsoft.AspNetCore.Components.Forms +@using Microsoft.AspNetCore.Components.Routing +@using Microsoft.AspNetCore.Components.Web +@using Microsoft.JSInterop + +@using BlazorLazyLoading diff --git a/demo/LazyAreas/LazyComponentFromNuget/wwwroot/.gitignore b/demo/LazyAreas/LazyComponentFromNuget/wwwroot/.gitignore new file mode 100644 index 0000000..924b93c --- /dev/null +++ b/demo/LazyAreas/LazyComponentFromNuget/wwwroot/.gitignore @@ -0,0 +1,2 @@ +_lazy/ +_lazy.json diff --git a/demo/Logger/Logger.csproj b/demo/Logger/Logger.csproj index 7d8411f..24bde33 100644 --- a/demo/Logger/Logger.csproj +++ b/demo/Logger/Logger.csproj @@ -10,15 +10,7 @@ - - - - - - - - - + diff --git a/demo/ModulesHost/.gitignore b/demo/ModulesHost/.gitignore new file mode 100644 index 0000000..b498fd4 --- /dev/null +++ b/demo/ModulesHost/.gitignore @@ -0,0 +1 @@ +/ diff --git a/demo/ModulesHost/ModulesHost.csproj b/demo/ModulesHost/ModulesHost.csproj index 6c6d5f4..57fb4e8 100644 --- a/demo/ModulesHost/ModulesHost.csproj +++ b/demo/ModulesHost/ModulesHost.csproj @@ -5,21 +5,17 @@ 3.0 - - - - - - - + + - - - + + + + - - + + diff --git a/demo/ServerHost/ServerHost.csproj b/demo/ServerHost/ServerHost.csproj index 120ce2b..457139e 100644 --- a/demo/ServerHost/ServerHost.csproj +++ b/demo/ServerHost/ServerHost.csproj @@ -4,15 +4,7 @@ netcoreapp3.1 - - - - - - - - - + diff --git a/demo/WasmHost/Layout/NavMenu.razor b/demo/WasmHost/Layout/NavMenu.razor index dbdd047..ffab070 100644 --- a/demo/WasmHost/Layout/NavMenu.razor +++ b/demo/WasmHost/Layout/NavMenu.razor @@ -14,12 +14,12 @@