Obsolete Microsoft.AspNetCore.SpaServices and Microsoft.AspNetCore.No… (#12892)

Obsolete Microsoft.AspNetCore.SpaServices and Microsoft.AspNetCore.NodeServices
This commit is contained in:
Ryan Brandenburg 2019-08-09 13:47:51 -07:00 committed by GitHub
parent 3ab8ebff42
commit 14f17fa7cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
64 changed files with 324 additions and 618 deletions

View File

@ -255,8 +255,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.NodeSe
EndProject EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SpaServices", "SpaServices", "{D6FA4ABE-E685-4EDD-8B06-D8777E76B472}" Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SpaServices", "SpaServices", "{D6FA4ABE-E685-4EDD-8B06-D8777E76B472}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Webpack", "SpaServices\samples\Webpack\Webpack.csproj", "{121DFA13-E965-4C91-A175-19EF20DFD5AC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SpaServices", "SpaServices\src\Microsoft.AspNetCore.SpaServices.csproj", "{D9D02772-1D53-45C3-B2CC-888F9978958C}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SpaServices", "SpaServices\src\Microsoft.AspNetCore.SpaServices.csproj", "{D9D02772-1D53-45C3-B2CC-888F9978958C}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SpaServices.Extensions", "SpaServices.Extensions\src\Microsoft.AspNetCore.SpaServices.Extensions.csproj", "{5D5B7E54-9323-498A-8983-E9BDFA3B2D07}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SpaServices.Extensions", "SpaServices.Extensions\src\Microsoft.AspNetCore.SpaServices.Extensions.csproj", "{5D5B7E54-9323-498A-8983-E9BDFA3B2D07}"
@ -297,6 +295,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestOrigin", "CORS\test\tes
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore", "..\DefaultBuilder\src\Microsoft.AspNetCore.csproj", "{46B4FE62-06A1-4D54-B3E8-D8B4B3560075}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore", "..\DefaultBuilder\src\Microsoft.AspNetCore.csproj", "{46B4FE62-06A1-4D54-B3E8-D8B4B3560075}"
EndProject EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IntegrationTesting.IIS", "..\Servers\IIS\IntegrationTesting.IIS\src\Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj", "{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.SpaServices.Extensions.Tests", "SpaServices.Extensions\test\Microsoft.AspNetCore.SpaServices.Extensions.Tests.csproj", "{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}"
EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
@ -1423,18 +1425,6 @@ Global
{40951683-DBC4-437A-BBAB-2FA7147E11EA}.Release|x64.Build.0 = Release|Any CPU {40951683-DBC4-437A-BBAB-2FA7147E11EA}.Release|x64.Build.0 = Release|Any CPU
{40951683-DBC4-437A-BBAB-2FA7147E11EA}.Release|x86.ActiveCfg = Release|Any CPU {40951683-DBC4-437A-BBAB-2FA7147E11EA}.Release|x86.ActiveCfg = Release|Any CPU
{40951683-DBC4-437A-BBAB-2FA7147E11EA}.Release|x86.Build.0 = Release|Any CPU {40951683-DBC4-437A-BBAB-2FA7147E11EA}.Release|x86.Build.0 = Release|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Debug|x64.ActiveCfg = Debug|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Debug|x64.Build.0 = Debug|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Debug|x86.ActiveCfg = Debug|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Debug|x86.Build.0 = Debug|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Release|Any CPU.Build.0 = Release|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Release|x64.ActiveCfg = Release|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Release|x64.Build.0 = Release|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Release|x86.ActiveCfg = Release|Any CPU
{121DFA13-E965-4C91-A175-19EF20DFD5AC}.Release|x86.Build.0 = Release|Any CPU
{D9D02772-1D53-45C3-B2CC-888F9978958C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D9D02772-1D53-45C3-B2CC-888F9978958C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D9D02772-1D53-45C3-B2CC-888F9978958C}.Debug|Any CPU.Build.0 = Debug|Any CPU {D9D02772-1D53-45C3-B2CC-888F9978958C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D9D02772-1D53-45C3-B2CC-888F9978958C}.Debug|x64.ActiveCfg = Debug|Any CPU {D9D02772-1D53-45C3-B2CC-888F9978958C}.Debug|x64.ActiveCfg = Debug|Any CPU
@ -1627,6 +1617,30 @@ Global
{46B4FE62-06A1-4D54-B3E8-D8B4B3560075}.Release|x64.Build.0 = Release|Any CPU {46B4FE62-06A1-4D54-B3E8-D8B4B3560075}.Release|x64.Build.0 = Release|Any CPU
{46B4FE62-06A1-4D54-B3E8-D8B4B3560075}.Release|x86.ActiveCfg = Release|Any CPU {46B4FE62-06A1-4D54-B3E8-D8B4B3560075}.Release|x86.ActiveCfg = Release|Any CPU
{46B4FE62-06A1-4D54-B3E8-D8B4B3560075}.Release|x86.Build.0 = Release|Any CPU {46B4FE62-06A1-4D54-B3E8-D8B4B3560075}.Release|x86.Build.0 = Release|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Debug|x64.ActiveCfg = Debug|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Debug|x64.Build.0 = Debug|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Debug|x86.ActiveCfg = Debug|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Debug|x86.Build.0 = Debug|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Release|Any CPU.Build.0 = Release|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Release|x64.ActiveCfg = Release|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Release|x64.Build.0 = Release|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Release|x86.ActiveCfg = Release|Any CPU
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0}.Release|x86.Build.0 = Release|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Debug|x64.ActiveCfg = Debug|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Debug|x64.Build.0 = Debug|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Debug|x86.ActiveCfg = Debug|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Debug|x86.Build.0 = Debug|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Release|Any CPU.Build.0 = Release|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Release|x64.ActiveCfg = Release|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Release|x64.Build.0 = Release|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Release|x86.ActiveCfg = Release|Any CPU
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE
@ -1736,7 +1750,6 @@ Global
{47B6636D-09A3-47AE-9303-9F5D15EEE9D8} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {47B6636D-09A3-47AE-9303-9F5D15EEE9D8} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0}
{C801B6A3-906F-406F-BA25-EAE0B4BCE5C9} = {17B409B3-7EC6-49D8-847E-CFAA319E01B5} {C801B6A3-906F-406F-BA25-EAE0B4BCE5C9} = {17B409B3-7EC6-49D8-847E-CFAA319E01B5}
{40951683-DBC4-437A-BBAB-2FA7147E11EA} = {17B409B3-7EC6-49D8-847E-CFAA319E01B5} {40951683-DBC4-437A-BBAB-2FA7147E11EA} = {17B409B3-7EC6-49D8-847E-CFAA319E01B5}
{121DFA13-E965-4C91-A175-19EF20DFD5AC} = {D6FA4ABE-E685-4EDD-8B06-D8777E76B472}
{D9D02772-1D53-45C3-B2CC-888F9978958C} = {D6FA4ABE-E685-4EDD-8B06-D8777E76B472} {D9D02772-1D53-45C3-B2CC-888F9978958C} = {D6FA4ABE-E685-4EDD-8B06-D8777E76B472}
{5D5B7E54-9323-498A-8983-E9BDFA3B2D07} = {D6FA4ABE-E685-4EDD-8B06-D8777E76B472} {5D5B7E54-9323-498A-8983-E9BDFA3B2D07} = {D6FA4ABE-E685-4EDD-8B06-D8777E76B472}
{B04E9CB6-0D1C-4C21-B626-89B6926A491F} = {17B409B3-7EC6-49D8-847E-CFAA319E01B5} {B04E9CB6-0D1C-4C21-B626-89B6926A491F} = {17B409B3-7EC6-49D8-847E-CFAA319E01B5}
@ -1755,6 +1768,8 @@ Global
{DFEB537A-2D35-4C62-8A13-42798DF66A80} = {BD7B3AD8-0BA6-405F-8CF6-24B9464D4B5B} {DFEB537A-2D35-4C62-8A13-42798DF66A80} = {BD7B3AD8-0BA6-405F-8CF6-24B9464D4B5B}
{E0521105-3A7B-480B-B962-0BFC2838D919} = {BD7B3AD8-0BA6-405F-8CF6-24B9464D4B5B} {E0521105-3A7B-480B-B962-0BFC2838D919} = {BD7B3AD8-0BA6-405F-8CF6-24B9464D4B5B}
{46B4FE62-06A1-4D54-B3E8-D8B4B3560075} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {46B4FE62-06A1-4D54-B3E8-D8B4B3560075} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0}
{92E11EBB-759E-4DA8-AB61-A9977D9F97D0} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0}
{D0CB733B-4CE8-4F6C-BBB9-548EA1A96966} = {D6FA4ABE-E685-4EDD-8B06-D8777E76B472}
EndGlobalSection EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {83786312-A93B-4BB4-AB06-7C6913A59AFA} SolutionGuid = {83786312-A93B-4BB4-AB06-7C6913A59AFA}

View File

@ -3,10 +3,13 @@
namespace Microsoft.AspNetCore.NodeServices namespace Microsoft.AspNetCore.NodeServices
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class EmbeddedResourceReader public static partial class EmbeddedResourceReader
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static string Read(System.Type assemblyContainingType, string path) { throw null; } public static string Read(System.Type assemblyContainingType, string path) { throw null; }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial interface INodeServices : System.IDisposable public partial interface INodeServices : System.IDisposable
{ {
System.Threading.Tasks.Task<T> InvokeAsync<T>(string moduleName, params object[] args); System.Threading.Tasks.Task<T> InvokeAsync<T>(string moduleName, params object[] args);
@ -14,10 +17,13 @@ namespace Microsoft.AspNetCore.NodeServices
System.Threading.Tasks.Task<T> InvokeExportAsync<T>(string moduleName, string exportedFunctionName, params object[] args); System.Threading.Tasks.Task<T> InvokeExportAsync<T>(string moduleName, string exportedFunctionName, params object[] args);
System.Threading.Tasks.Task<T> InvokeExportAsync<T>(System.Threading.CancellationToken cancellationToken, string moduleName, string exportedFunctionName, params object[] args); System.Threading.Tasks.Task<T> InvokeExportAsync<T>(System.Threading.CancellationToken cancellationToken, string moduleName, string exportedFunctionName, params object[] args);
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class NodeServicesFactory public static partial class NodeServicesFactory
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static Microsoft.AspNetCore.NodeServices.INodeServices CreateNodeServices(Microsoft.AspNetCore.NodeServices.NodeServicesOptions options) { throw null; } public static Microsoft.AspNetCore.NodeServices.INodeServices CreateNodeServices(Microsoft.AspNetCore.NodeServices.NodeServicesOptions options) { throw null; }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial class NodeServicesOptions public partial class NodeServicesOptions
{ {
public NodeServicesOptions(System.IServiceProvider serviceProvider) { } public NodeServicesOptions(System.IServiceProvider serviceProvider) { }
@ -31,6 +37,7 @@ namespace Microsoft.AspNetCore.NodeServices
public string ProjectPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string ProjectPath { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string[] WatchFileExtensions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string[] WatchFileExtensions { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public sealed partial class StringAsTempFile : System.IDisposable public sealed partial class StringAsTempFile : System.IDisposable
{ {
public StringAsTempFile(string content, System.Threading.CancellationToken applicationStoppingToken) { } public StringAsTempFile(string content, System.Threading.CancellationToken applicationStoppingToken) { }
@ -41,10 +48,12 @@ namespace Microsoft.AspNetCore.NodeServices
} }
namespace Microsoft.AspNetCore.NodeServices.HostingModels namespace Microsoft.AspNetCore.NodeServices.HostingModels
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial interface INodeInstance : System.IDisposable public partial interface INodeInstance : System.IDisposable
{ {
System.Threading.Tasks.Task<T> InvokeExportAsync<T>(System.Threading.CancellationToken cancellationToken, string moduleName, string exportNameOrNull, params object[] args); System.Threading.Tasks.Task<T> InvokeExportAsync<T>(System.Threading.CancellationToken cancellationToken, string moduleName, string exportNameOrNull, params object[] args);
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial class NodeInvocationException : System.Exception public partial class NodeInvocationException : System.Exception
{ {
public NodeInvocationException(string message, string details) { } public NodeInvocationException(string message, string details) { }
@ -52,6 +61,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
public bool AllowConnectionDraining { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public bool AllowConnectionDraining { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
public bool NodeInstanceUnavailable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public bool NodeInstanceUnavailable { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial class NodeInvocationInfo public partial class NodeInvocationInfo
{ {
public NodeInvocationInfo() { } public NodeInvocationInfo() { }
@ -59,10 +69,13 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
public string ExportedFunctionName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string ExportedFunctionName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string ModuleName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string ModuleName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class NodeServicesOptionsExtensions public static partial class NodeServicesOptionsExtensions
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void UseHttpHosting(this Microsoft.AspNetCore.NodeServices.NodeServicesOptions options) { } public static void UseHttpHosting(this Microsoft.AspNetCore.NodeServices.NodeServicesOptions options) { }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public abstract partial class OutOfProcessNodeInstance : Microsoft.AspNetCore.NodeServices.HostingModels.INodeInstance, System.IDisposable public abstract partial class OutOfProcessNodeInstance : Microsoft.AspNetCore.NodeServices.HostingModels.INodeInstance, System.IDisposable
{ {
protected readonly Microsoft.Extensions.Logging.ILogger OutputLogger; protected readonly Microsoft.Extensions.Logging.ILogger OutputLogger;
@ -80,9 +93,12 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
} }
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class NodeServicesServiceCollectionExtensions public static partial class NodeServicesServiceCollectionExtensions
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void AddNodeServices(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection) { } public static void AddNodeServices(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection) { }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void AddNodeServices(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Action<Microsoft.AspNetCore.NodeServices.NodeServicesOptions> setupAction) { } public static void AddNodeServices(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection, System.Action<Microsoft.AspNetCore.NodeServices.NodeServicesOptions> setupAction) { }
} }
} }

View File

@ -1,7 +1,9 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.NodeServices; using Microsoft.AspNetCore.NodeServices;
using Microsoft.AspNetCore.SpaServices.Prerendering;
namespace NodeServicesExamples.Controllers namespace NodeServicesExamples.Controllers
{ {
@ -17,7 +19,9 @@ namespace NodeServicesExamples.Controllers
return View(); return View();
} }
#pragma warning disable 0618
public async Task<IActionResult> Chart([FromServices] INodeServices nodeServices) public async Task<IActionResult> Chart([FromServices] INodeServices nodeServices)
#pragma warning restore 0618
{ {
var options = new { width = 400, height = 200, showArea = true, showPoint = true, fullWidth = true }; var options = new { width = 400, height = 200, showArea = true, showPoint = true, fullWidth = true };
var data = new var data = new
@ -35,20 +39,6 @@ namespace NodeServicesExamples.Controllers
return View(); return View();
} }
public async Task<IActionResult> Prerendering([FromServices] ISpaPrerenderer prerenderer)
{
var result = await prerenderer.RenderToString("./Node/prerenderPage");
if (!string.IsNullOrEmpty(result.RedirectUrl))
{
return Redirect(result.RedirectUrl);
}
ViewData["PrerenderedHtml"] = result.Html;
ViewData["PrerenderedGlobals"] = result.CreateGlobalsAssignmentScript();
return View();
}
public IActionResult Error() public IActionResult Error()
{ {
return View("~/Views/Shared/Error.cshtml"); return View("~/Views/Shared/Error.cshtml");

View File

@ -7,14 +7,15 @@
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc" /> <Reference Include="Microsoft.AspNetCore.Mvc" />
<Reference Include="Microsoft.AspNetCore.SpaServices" />
<Reference Include="Microsoft.AspNetCore.Diagnostics" /> <Reference Include="Microsoft.AspNetCore.Diagnostics" />
<Reference Include="Microsoft.AspNetCore.Hosting" /> <Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.AspNetCore.NodeServices" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" /> <Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" /> <Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.AspNetCore.StaticFiles" /> <Reference Include="Microsoft.AspNetCore.StaticFiles" />
<Reference Include="Microsoft.Extensions.Logging.Debug" /> <Reference Include="Microsoft.Extensions.Logging.Debug" />
<Reference Include="Microsoft.Extensions.Logging.Console" />
</ItemGroup> </ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish"> <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">

View File

@ -1,15 +1,20 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.IO;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.NodeServices; using Microsoft.AspNetCore.NodeServices;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using System.IO;
namespace NodeServicesExamples namespace NodeServicesExamples
{ {
public class Startup public class Startup
{ {
#pragma warning disable 0618
// This method gets called by the runtime. Use this method to add services to the container. // This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services) public void ConfigureServices(IServiceCollection services)
{ {
@ -17,7 +22,6 @@ namespace NodeServicesExamples
// Enable Node Services // Enable Node Services
services.AddNodeServices(); services.AddNodeServices();
services.AddSpaPrerenderer();
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
@ -26,11 +30,14 @@ namespace NodeServicesExamples
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
// Dynamically transpile any .js files under the '/js/' directory // Dynamically transpile any .js files under the '/js/' directory
app.Use(next => async context => { app.Use(next => async context =>
{
var requestPath = context.Request.Path.Value; var requestPath = context.Request.Path.Value;
if (requestPath.StartsWith("/js/") && requestPath.EndsWith(".js")) { if (requestPath.StartsWith("/js/") && requestPath.EndsWith(".js"))
{
var fileInfo = env.WebRootFileProvider.GetFileInfo(requestPath); var fileInfo = env.WebRootFileProvider.GetFileInfo(requestPath);
if (fileInfo.Exists) { if (fileInfo.Exists)
{
var transpiled = await nodeServices.InvokeAsync<string>("./Node/transpilation.js", fileInfo.PhysicalPath, requestPath); var transpiled = await nodeServices.InvokeAsync<string>("./Node/transpilation.js", fileInfo.PhysicalPath, requestPath);
await context.Response.WriteAsync(transpiled); await context.Response.WriteAsync(transpiled);
return; return;
@ -49,6 +56,7 @@ namespace NodeServicesExamples
endpoints.MapDefaultControllerRoute(); endpoints.MapDefaultControllerRoute();
}); });
} }
#pragma warning restore 0618
public static void Main(string[] args) public static void Main(string[] args)
{ {

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
namespace Microsoft.AspNetCore.NodeServices namespace Microsoft.AspNetCore.NodeServices
@ -5,6 +8,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// <summary> /// <summary>
/// Supplies INodeServices instances. /// Supplies INodeServices instances.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class NodeServicesFactory public static class NodeServicesFactory
{ {
/// <summary> /// <summary>
@ -12,6 +16,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// </summary> /// </summary>
/// <param name="options">Options for creating the <see cref="INodeServices"/> instance.</param> /// <param name="options">Options for creating the <see cref="INodeServices"/> instance.</param>
/// <returns>An <see cref="INodeServices"/> instance.</returns> /// <returns>An <see cref="INodeServices"/> instance.</returns>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static INodeServices CreateNodeServices(NodeServicesOptions options) public static INodeServices CreateNodeServices(NodeServicesOptions options)
{ {
if (options == null) if (options == null)

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
@ -14,6 +17,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// <summary> /// <summary>
/// Describes options used to configure an <see cref="INodeServices"/> instance. /// Describes options used to configure an <see cref="INodeServices"/> instance.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class NodeServicesOptions public class NodeServicesOptions
{ {
internal const string TimeoutConfigPropertyName = nameof(InvocationTimeoutMilliseconds); internal const string TimeoutConfigPropertyName = nameof(InvocationTimeoutMilliseconds);

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNetCore.NodeServices; using Microsoft.AspNetCore.NodeServices;
@ -6,12 +9,14 @@ namespace Microsoft.Extensions.DependencyInjection
/// <summary> /// <summary>
/// Extension methods for setting up NodeServices in an <see cref="IServiceCollection" />. /// Extension methods for setting up NodeServices in an <see cref="IServiceCollection" />.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class NodeServicesServiceCollectionExtensions public static class NodeServicesServiceCollectionExtensions
{ {
/// <summary> /// <summary>
/// Adds NodeServices support to the <paramref name="serviceCollection"/>. /// Adds NodeServices support to the <paramref name="serviceCollection"/>.
/// </summary> /// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param> /// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void AddNodeServices(this IServiceCollection serviceCollection) public static void AddNodeServices(this IServiceCollection serviceCollection)
=> AddNodeServices(serviceCollection, _ => {}); => AddNodeServices(serviceCollection, _ => {});
@ -20,6 +25,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary> /// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param> /// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
/// <param name="setupAction">A callback that will be invoked to populate the <see cref="NodeServicesOptions"/>.</param> /// <param name="setupAction">A callback that will be invoked to populate the <see cref="NodeServicesOptions"/>.</param>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void AddNodeServices(this IServiceCollection serviceCollection, Action<NodeServicesOptions> setupAction) public static void AddNodeServices(this IServiceCollection serviceCollection, Action<NodeServicesOptions> setupAction)
{ {
if (setupAction == null) if (setupAction == null)

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
@ -19,6 +22,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
/// accept RPC invocations. /// accept RPC invocations.
/// </summary> /// </summary>
/// <seealso cref="Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance" /> /// <seealso cref="Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance" />
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal class HttpNodeInstance : OutOfProcessNodeInstance internal class HttpNodeInstance : OutOfProcessNodeInstance
{ {
private static readonly Regex EndpointMessageRegex = private static readonly Regex EndpointMessageRegex =

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -7,6 +10,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
/// <summary> /// <summary>
/// Represents an instance of Node.js to which Remote Procedure Calls (RPC) may be sent. /// Represents an instance of Node.js to which Remote Procedure Calls (RPC) may be sent.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public interface INodeInstance : IDisposable public interface INodeInstance : IDisposable
{ {
/// <summary> /// <summary>

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
namespace Microsoft.AspNetCore.NodeServices.HostingModels namespace Microsoft.AspNetCore.NodeServices.HostingModels
@ -5,6 +8,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
/// <summary> /// <summary>
/// Represents an exception caused by invoking Node.js code. /// Represents an exception caused by invoking Node.js code.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class NodeInvocationException : Exception public class NodeInvocationException : Exception
{ {
/// <summary> /// <summary>

View File

@ -1,8 +1,14 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.NodeServices.HostingModels namespace Microsoft.AspNetCore.NodeServices.HostingModels
{ {
/// <summary> /// <summary>
/// Describes an RPC call sent from .NET code to Node.js code. /// Describes an RPC call sent from .NET code to Node.js code.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class NodeInvocationInfo public class NodeInvocationInfo
{ {
/// <summary> /// <summary>

View File

@ -1,14 +1,21 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
namespace Microsoft.AspNetCore.NodeServices.HostingModels namespace Microsoft.AspNetCore.NodeServices.HostingModels
{ {
/// <summary> /// <summary>
/// Extension methods that help with populating a <see cref="NodeServicesOptions"/> object. /// Extension methods that help with populating a <see cref="NodeServicesOptions"/> object.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class NodeServicesOptionsExtensions public static class NodeServicesOptionsExtensions
{ {
/// <summary> /// <summary>
/// Configures the <see cref="INodeServices"/> service so that it will use out-of-process /// Configures the <see cref="INodeServices"/> service so that it will use out-of-process
/// Node.js instances and perform RPC calls over HTTP. /// Node.js instances and perform RPC calls over HTTP.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void UseHttpHosting(this NodeServicesOptions options) public static void UseHttpHosting(this NodeServicesOptions options)
{ {
options.NodeInstanceFactory = () => new HttpNodeInstance(options); options.NodeInstanceFactory = () => new HttpNodeInstance(options);

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
@ -19,6 +22,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
/// protocol, or any other RPC-type mechanism). /// protocol, or any other RPC-type mechanism).
/// </summary> /// </summary>
/// <seealso cref="Microsoft.AspNetCore.NodeServices.HostingModels.INodeInstance" /> /// <seealso cref="Microsoft.AspNetCore.NodeServices.HostingModels.INodeInstance" />
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public abstract class OutOfProcessNodeInstance : INodeInstance public abstract class OutOfProcessNodeInstance : INodeInstance
{ {
/// <summary> /// <summary>

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -9,6 +12,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// might change over time (e.g., the process might be restarted), the <see cref="INodeServices"/> instance /// might change over time (e.g., the process might be restarted), the <see cref="INodeServices"/> instance
/// will remain constant. /// will remain constant.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public interface INodeServices : IDisposable public interface INodeServices : IDisposable
{ {
/// <summary> /// <summary>

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -17,6 +20,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// analogous to the "connection draining" feature implemented by HTTP load balancers. /// analogous to the "connection draining" feature implemented by HTTP load balancers.
/// </summary> /// </summary>
/// <seealso cref="Microsoft.AspNetCore.NodeServices.INodeServices" /> /// <seealso cref="Microsoft.AspNetCore.NodeServices.INodeServices" />
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal class NodeServicesImpl : INodeServices internal class NodeServicesImpl : INodeServices
{ {
private static TimeSpan ConnectionDrainingTimespan = TimeSpan.FromSeconds(15); private static TimeSpan ConnectionDrainingTimespan = TimeSpan.FromSeconds(15);

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
@ -7,6 +10,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// <summary> /// <summary>
/// Contains methods for reading embedded resources. /// Contains methods for reading embedded resources.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class EmbeddedResourceReader public static class EmbeddedResourceReader
{ {
/// <summary> /// <summary>
@ -15,6 +19,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// <param name="assemblyContainingType">Any <see cref="Type"/> in the assembly whose resource is to be read.</param> /// <param name="assemblyContainingType">Any <see cref="Type"/> in the assembly whose resource is to be read.</param>
/// <param name="path">The path of the resource to be read.</param> /// <param name="path">The path of the resource to be read.</param>
/// <returns>The contents of the resource.</returns> /// <returns>The contents of the resource.</returns>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static string Read(Type assemblyContainingType, string path) public static string Read(Type assemblyContainingType, string path)
{ {
var asm = assemblyContainingType.GetTypeInfo().Assembly; var asm = assemblyContainingType.GetTypeInfo().Assembly;

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
@ -7,6 +10,7 @@ namespace Microsoft.AspNetCore.NodeServices
/// <summary> /// <summary>
/// Makes it easier to pass script files to Node in a way that's sure to clean up after the process exits. /// Makes it easier to pass script files to Node in a way that's sure to clean up after the process exits.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public sealed class StringAsTempFile : IDisposable public sealed class StringAsTempFile : IDisposable
{ {
private bool _disposedValue; private bool _disposedValue;

View File

@ -1,10 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices namespace Microsoft.AspNetCore.NodeServices
{ {
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal static class TaskExtensions internal static class TaskExtensions
{ {
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static Task OrThrowOnCancellation(this Task task, CancellationToken cancellationToken) public static Task OrThrowOnCancellation(this Task task, CancellationToken cancellationToken)
{ {
return task.IsCompleted return task.IsCompleted
@ -16,6 +22,7 @@ namespace Microsoft.AspNetCore.NodeServices
TaskScheduler.Default); TaskScheduler.Default);
} }
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static Task<T> OrThrowOnCancellation<T>(this Task<T> task, CancellationToken cancellationToken) public static Task<T> OrThrowOnCancellation<T>(this Task<T> task, CancellationToken cancellationToken)
{ {
return task.IsCompleted return task.IsCompleted

View File

@ -1,15 +1,16 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.NodeServices.HostingModels;
using Microsoft.Extensions.DependencyInjection;
using System; using System;
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.NodeServices.HostingModels;
using Microsoft.Extensions.DependencyInjection;
using Xunit; using Xunit;
namespace Microsoft.AspNetCore.NodeServices namespace Microsoft.AspNetCore.NodeServices
{ {
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class NodeServicesTest : IDisposable public class NodeServicesTest : IDisposable
{ {
private readonly INodeServices _nodeServices; private readonly INodeServices _nodeServices;

View File

@ -7,10 +7,13 @@ namespace Microsoft.AspNetCore.Builder
{ {
public static void UseSpa(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, System.Action<Microsoft.AspNetCore.SpaServices.ISpaBuilder> configuration) { } public static void UseSpa(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, System.Action<Microsoft.AspNetCore.SpaServices.ISpaBuilder> configuration) { }
} }
[System.ObsoleteAttribute("Prerendering is no longer supported out of box")]
public static partial class SpaPrerenderingExtensions public static partial class SpaPrerenderingExtensions
{ {
[System.ObsoleteAttribute("Prerendering is no longer supported out of box")]
public static void UseSpaPrerendering(this Microsoft.AspNetCore.SpaServices.ISpaBuilder spaBuilder, System.Action<Microsoft.AspNetCore.Builder.SpaPrerenderingOptions> configuration) { } public static void UseSpaPrerendering(this Microsoft.AspNetCore.SpaServices.ISpaBuilder spaBuilder, System.Action<Microsoft.AspNetCore.Builder.SpaPrerenderingOptions> configuration) { }
} }
[System.ObsoleteAttribute("Prerendering is no longer supported out of box")]
public partial class SpaPrerenderingOptions public partial class SpaPrerenderingOptions
{ {
public SpaPrerenderingOptions() { } public SpaPrerenderingOptions() { }
@ -44,6 +47,7 @@ namespace Microsoft.AspNetCore.SpaServices
} }
namespace Microsoft.AspNetCore.SpaServices.AngularCli namespace Microsoft.AspNetCore.SpaServices.AngularCli
{ {
[System.ObsoleteAttribute("Prerendering is no longer supported out of box")]
public partial class AngularCliBuilder : Microsoft.AspNetCore.SpaServices.Prerendering.ISpaPrerendererBuilder public partial class AngularCliBuilder : Microsoft.AspNetCore.SpaServices.Prerendering.ISpaPrerendererBuilder
{ {
public AngularCliBuilder(string npmScript) { } public AngularCliBuilder(string npmScript) { }
@ -57,6 +61,7 @@ namespace Microsoft.AspNetCore.SpaServices.AngularCli
} }
namespace Microsoft.AspNetCore.SpaServices.Prerendering namespace Microsoft.AspNetCore.SpaServices.Prerendering
{ {
[System.ObsoleteAttribute("Prerendering is no longer supported out of box")]
public partial interface ISpaPrerendererBuilder public partial interface ISpaPrerendererBuilder
{ {
System.Threading.Tasks.Task Build(Microsoft.AspNetCore.SpaServices.ISpaBuilder spaBuilder); System.Threading.Tasks.Task Build(Microsoft.AspNetCore.SpaServices.ISpaBuilder spaBuilder);

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
@ -17,6 +17,7 @@ namespace Microsoft.AspNetCore.SpaServices.AngularCli
/// Provides an implementation of <see cref="ISpaPrerendererBuilder"/> that can build /// Provides an implementation of <see cref="ISpaPrerendererBuilder"/> that can build
/// an Angular application by invoking the Angular CLI. /// an Angular application by invoking the Angular CLI.
/// </summary> /// </summary>
[Obsolete("Prerendering is no longer supported out of box")]
public class AngularCliBuilder : ISpaPrerendererBuilder public class AngularCliBuilder : ISpaPrerendererBuilder
{ {
private static TimeSpan RegexMatchTimeout = TimeSpan.FromSeconds(5); // This is a development-time only feature, so a very long timeout is fine private static TimeSpan RegexMatchTimeout = TimeSpan.FromSeconds(5); // This is a development-time only feature, so a very long timeout is fine

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<Description>Helpers for building single-page applications on ASP.NET MVC Core.</Description> <Description>Helpers for building single-page applications on ASP.NET MVC Core.</Description>
@ -13,4 +13,8 @@
<Reference Include="Microsoft.Extensions.FileProviders.Physical" /> <Reference Include="Microsoft.Extensions.FileProviders.Physical" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.AspNetCode.SpaServices.Extensions.Tests" />
</ItemGroup>
</Project> </Project>

View File

@ -1,7 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Builder; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace Microsoft.AspNetCore.SpaServices.Prerendering namespace Microsoft.AspNetCore.SpaServices.Prerendering
@ -11,6 +11,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// so that it can be prerendered. This is only intended to be used at development /// so that it can be prerendered. This is only intended to be used at development
/// time. In production, a SPA should already have been built during publishing. /// time. In production, a SPA should already have been built during publishing.
/// </summary> /// </summary>
[Obsolete("Prerendering is no longer supported out of box")]
public interface ISpaPrerendererBuilder public interface ISpaPrerendererBuilder
{ {
/// <summary> /// <summary>

View File

@ -23,6 +23,7 @@ namespace Microsoft.AspNetCore.Builder
/// <summary> /// <summary>
/// Extension methods for configuring prerendering of a Single Page Application. /// Extension methods for configuring prerendering of a Single Page Application.
/// </summary> /// </summary>
[Obsolete("Prerendering is no longer supported out of box")]
public static class SpaPrerenderingExtensions public static class SpaPrerenderingExtensions
{ {
/// <summary> /// <summary>
@ -30,6 +31,7 @@ namespace Microsoft.AspNetCore.Builder
/// </summary> /// </summary>
/// <param name="spaBuilder">The <see cref="ISpaBuilder"/>.</param> /// <param name="spaBuilder">The <see cref="ISpaBuilder"/>.</param>
/// <param name="configuration">Supplies configuration for the prerendering middleware.</param> /// <param name="configuration">Supplies configuration for the prerendering middleware.</param>
[Obsolete("Prerendering is no longer supported out of box")]
public static void UseSpaPrerendering( public static void UseSpaPrerendering(
this ISpaBuilder spaBuilder, this ISpaBuilder spaBuilder,
Action<SpaPrerenderingOptions> configuration) Action<SpaPrerenderingOptions> configuration)

View File

@ -1,4 +1,4 @@
// Copyright (c) .NET Foundation. All rights reserved. // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -11,6 +11,7 @@ namespace Microsoft.AspNetCore.Builder
/// <summary> /// <summary>
/// Represents options for the SPA prerendering middleware. /// Represents options for the SPA prerendering middleware.
/// </summary> /// </summary>
[Obsolete("Prerendering is no longer supported out of box")]
public class SpaPrerenderingOptions public class SpaPrerenderingOptions
{ {
/// <summary> /// <summary>

View File

@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp3.0</TargetFramework>
<TestDependsOnNode>true</TestDependsOnNode>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.SpaServices.Extensions" />
<Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.AspNetCore.TestHost" />
<Reference Include="Microsoft.Extensions.Hosting" />
<Reference Include="Microsoft.Extensions.Logging.Testing" />
<Content Include="js\**\*" />
</ItemGroup>
</Project>

View File

@ -0,0 +1,51 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Moq;
using Xunit;
namespace Microsoft.AspNetCore.SpaServices.Extensions.Tests
{
public class SpaServicesExtensionsTests
{
[Fact]
public void UseSpa_ThrowsInvalidOperationException_IfRootpathNotSet()
{
// Arrange
var applicationbuilder = GetApplicationBuilder(GetServiceProvider());
// Act & Assert
var exception = Assert.Throws<InvalidOperationException>(
() => applicationbuilder.UseSpa(rb => { }));
Assert.Equal("No RootPath was set on the SpaStaticFilesOptions.", exception.Message);
}
private IApplicationBuilder GetApplicationBuilder(IServiceProvider serviceProvider = null)
{
if(serviceProvider == null)
{
serviceProvider = new Mock<IServiceProvider>(MockBehavior.Strict).Object;
}
var applicationbuilderMock = new Mock<IApplicationBuilder>();
applicationbuilderMock
.Setup(s => s.ApplicationServices)
.Returns(serviceProvider);
return applicationbuilderMock.Object;
}
private IServiceProvider GetServiceProvider()
{
var services = new ServiceCollection();
services.AddLogging();
services.AddSpaStaticFiles();
return services.BuildServiceProvider();
}
}
}

View File

@ -3,33 +3,41 @@
namespace Microsoft.AspNetCore.Builder namespace Microsoft.AspNetCore.Builder
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class SpaRouteExtensions public static partial class SpaRouteExtensions
{ {
public static void MapSpaFallbackRoute(this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, object defaults, object constraints = null, object dataTokens = null) { } public static void MapSpaFallbackRoute(this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, object defaults, object constraints = null, object dataTokens = null) { }
public static void MapSpaFallbackRoute(this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, string templatePrefix, object defaults, object constraints = null, object dataTokens = null) { } public static void MapSpaFallbackRoute(this Microsoft.AspNetCore.Routing.IRouteBuilder routeBuilder, string name, string templatePrefix, object defaults, object constraints = null, object dataTokens = null) { }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class WebpackDevMiddleware public static partial class WebpackDevMiddleware
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void UseWebpackDevMiddleware(this Microsoft.AspNetCore.Builder.IApplicationBuilder appBuilder, Microsoft.AspNetCore.SpaServices.Webpack.WebpackDevMiddlewareOptions options = null) { } public static void UseWebpackDevMiddleware(this Microsoft.AspNetCore.Builder.IApplicationBuilder appBuilder, Microsoft.AspNetCore.SpaServices.Webpack.WebpackDevMiddlewareOptions options = null) { }
} }
} }
namespace Microsoft.AspNetCore.SpaServices.Prerendering namespace Microsoft.AspNetCore.SpaServices.Prerendering
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial interface ISpaPrerenderer public partial interface ISpaPrerenderer
{ {
System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult> RenderToString(string moduleName, string exportName = null, object customDataParameter = null, int timeoutMilliseconds = 0); System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult> RenderToString(string moduleName, string exportName = null, object customDataParameter = null, int timeoutMilliseconds = 0);
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial class JavaScriptModuleExport public partial class JavaScriptModuleExport
{ {
public JavaScriptModuleExport(string moduleName) { } public JavaScriptModuleExport(string moduleName) { }
public string ExportName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } } public string ExportName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } [System.Runtime.CompilerServices.CompilerGeneratedAttribute]set { } }
public string ModuleName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } } public string ModuleName { [System.Runtime.CompilerServices.CompilerGeneratedAttribute]get { throw null; } }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class Prerenderer public static partial class Prerenderer
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult> RenderToString(string applicationBasePath, Microsoft.AspNetCore.NodeServices.INodeServices nodeServices, System.Threading.CancellationToken applicationStoppingToken, Microsoft.AspNetCore.SpaServices.Prerendering.JavaScriptModuleExport bootModule, string requestAbsoluteUrl, string requestPathAndQuery, object customDataParameter, int timeoutMilliseconds, string requestPathBase) { throw null; } public static System.Threading.Tasks.Task<Microsoft.AspNetCore.SpaServices.Prerendering.RenderToStringResult> RenderToString(string applicationBasePath, Microsoft.AspNetCore.NodeServices.INodeServices nodeServices, System.Threading.CancellationToken applicationStoppingToken, Microsoft.AspNetCore.SpaServices.Prerendering.JavaScriptModuleExport bootModule, string requestAbsoluteUrl, string requestPathAndQuery, object customDataParameter, int timeoutMilliseconds, string requestPathBase) { throw null; }
} }
[Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute(Attributes="asp-prerender-module")] [Microsoft.AspNetCore.Razor.TagHelpers.HtmlTargetElementAttribute(Attributes="asp-prerender-module")]
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial class PrerenderTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper public partial class PrerenderTagHelper : Microsoft.AspNetCore.Razor.TagHelpers.TagHelper
{ {
public PrerenderTagHelper(System.IServiceProvider serviceProvider) { } public PrerenderTagHelper(System.IServiceProvider serviceProvider) { }
@ -47,6 +55,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
[System.Diagnostics.DebuggerStepThroughAttribute] [System.Diagnostics.DebuggerStepThroughAttribute]
public override System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output) { throw null; } public override System.Threading.Tasks.Task ProcessAsync(Microsoft.AspNetCore.Razor.TagHelpers.TagHelperContext context, Microsoft.AspNetCore.Razor.TagHelpers.TagHelperOutput output) { throw null; }
} }
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial class RenderToStringResult public partial class RenderToStringResult
{ {
public RenderToStringResult() { } public RenderToStringResult() { }
@ -59,6 +68,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
} }
namespace Microsoft.AspNetCore.SpaServices.Webpack namespace Microsoft.AspNetCore.SpaServices.Webpack
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public partial class WebpackDevMiddlewareOptions public partial class WebpackDevMiddlewareOptions
{ {
public WebpackDevMiddlewareOptions() { } public WebpackDevMiddlewareOptions() { }
@ -75,8 +85,10 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
} }
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static partial class PrerenderingServiceCollectionExtensions public static partial class PrerenderingServiceCollectionExtensions
{ {
[System.ObsoleteAttribute("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void AddSpaPrerenderer(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection) { } public static void AddSpaPrerenderer(this Microsoft.Extensions.DependencyInjection.IServiceCollection serviceCollection) { }
} }
} }

View File

@ -1,233 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
yarn.lock
wwwroot/dist
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
build/
bld/
[Bb]in/
[Oo]bj/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Microsoft Azure ApplicationInsights config file
ApplicationInsights.config
# Windows Store app package directory
AppPackages/
BundleArtifacts/
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
# FAKE - F# Make
.fake/

View File

@ -1,52 +0,0 @@
using System.Threading.Tasks;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.NodeServices;
using Microsoft.AspNetCore.SpaServices.Prerendering;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace Webpack.ActionResults
{
// This is an example of how you could invoke the prerendering API from an ActionResult, so as to
// prerender a SPA component as the entire response page (instead of injecting the SPA component
// into a Razor view's output)
public class PrerenderResult : ActionResult
{
private JavaScriptModuleExport _moduleExport;
private object _dataToSupply;
public PrerenderResult(JavaScriptModuleExport moduleExport, object dataToSupply = null)
{
_moduleExport = moduleExport;
_dataToSupply = dataToSupply;
}
public override async Task ExecuteResultAsync(ActionContext context)
{
var nodeServices = context.HttpContext.RequestServices.GetRequiredService<INodeServices>();
var hostEnv = context.HttpContext.RequestServices.GetRequiredService<IWebHostEnvironment>();
var applicationLifetime = context.HttpContext.RequestServices.GetRequiredService<IHostApplicationLifetime>();
var applicationBasePath = hostEnv.ContentRootPath;
var request = context.HttpContext.Request;
var response = context.HttpContext.Response;
var prerenderedHtml = await Prerenderer.RenderToString(
applicationBasePath,
nodeServices,
applicationLifetime.ApplicationStopping,
_moduleExport,
request.GetEncodedUrl(),
request.Path + request.QueryString.Value,
_dataToSupply,
/* timeoutMilliseconds */ 30000,
/* requestPathBase */ "/"
);
response.ContentType = "text/html";
await response.WriteAsync(prerenderedHtml.Html);
}
}
}

View File

@ -1,13 +0,0 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.SpaServices.Prerendering;
namespace Webpack.ActionResults
{
public static class PrerenderResultExtensions
{
public static PrerenderResult Prerender(this ControllerBase controller, JavaScriptModuleExport exportToPrerender, object dataToSupply = null)
{
return new PrerenderResult(exportToPrerender, dataToSupply);
}
}
}

View File

@ -1,4 +0,0 @@
import { HelloWorld } from './HelloWorld';
import './styles/main.less';
new HelloWorld().doIt();

View File

@ -1,5 +0,0 @@
export class HelloWorld {
public doIt() {
console.log('Hello from MyApp');
}
}

View File

@ -1,5 +0,0 @@
@headerColor: red;
h1 {
color: @headerColor;
}

View File

@ -1,16 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
namespace Webpack.Controllers
{
public class HomeController : Controller
{
public IActionResult Index()
{
return View();
}
}
}

View File

@ -1,59 +0,0 @@
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.SpaServices.Webpack;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using System.IO;
using Microsoft.AspNetCore.NodeServices;
namespace Webpack
{
public class Startup
{
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddNodeServices();
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app)
{
app.UseDeveloperExceptionPage();
// For real apps, you should only use Webpack Dev Middleware at development time. For production,
// you'll get better performance and reliability if you precompile the webpack output and simply
// serve the resulting static files. For examples of setting up this automatic switch between
// development-style and production-style webpack usage, see the 'templates' dir in this repo.
app.UseWebpackDevMiddleware(new WebpackDevMiddlewareOptions {
HotModuleReplacement = true
});
app.UseStaticFiles();
app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapDefaultControllerRoute();
});
}
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.ConfigureLogging(factory =>
{
factory.AddConsole();
factory.AddDebug();
})
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseKestrel()
.UseStartup<Startup>()
.Build();
host.Run();
}
}
}

View File

@ -1,10 +0,0 @@
@{
ViewData["Title"] = "Home Page";
}
<h1>Hello</h1>
Hi there. Enter some text: <input />
@section scripts {
<script src="dist/main.js"></script>
}

View File

@ -1,6 +0,0 @@
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>

View File

@ -1,14 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>@ViewData["Title"]</title>
<environment names="Production">
<link rel="stylesheet" href="dist/my-styles.css" />
</environment>
</head>
<body>
@RenderBody()
@RenderSection("scripts", required: false)
</body>
</html>

View File

@ -1,2 +0,0 @@
@using Webpack
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"

View File

@ -1,3 +0,0 @@
@{
Layout = "_Layout";
}

View File

@ -1,25 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.AspNetCore.Mvc" />
<Reference Include="Microsoft.AspNetCore.SpaServices" />
<Reference Include="Microsoft.AspNetCore.Diagnostics" />
<Reference Include="Microsoft.AspNetCore.Hosting" />
<Reference Include="Microsoft.AspNetCore.Server.IISIntegration" />
<Reference Include="Microsoft.AspNetCore.Server.Kestrel" />
<Reference Include="Microsoft.AspNetCore.StaticFiles" />
<Reference Include="Microsoft.Extensions.Logging.Debug" />
<Reference Include="Microsoft.Extensions.Logging.Console" />
</ItemGroup>
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
<Exec Command="npm install" />
</Target>
</Project>

View File

@ -1,10 +0,0 @@
{
"Logging": {
"IncludeScopes": false,
"LogLevel": {
"Default": "Verbose",
"System": "Information",
"Microsoft": "Information"
}
}
}

View File

@ -1,20 +0,0 @@
{
"name": "Webpack",
"version": "0.0.0",
"devDependencies": {
"css-loader": "^0.23.1",
"extendify": "^1.0.0",
"extract-text-webpack-plugin": "^1.0.1",
"less": "^2.6.0",
"less-loader": "^2.2.2",
"style-loader": "^0.13.0",
"webpack-hot-middleware": "^2.7.1"
},
"dependencies": {
"aspnet-prerendering": "^1.0.4",
"aspnet-webpack": "^1.0.3",
"ts-loader": "^0.8.1",
"typescript": "^2.0.0",
"webpack": "^1.13.3"
}
}

View File

@ -1,13 +0,0 @@
{
"compilerOptions": {
"moduleResolution": "node",
"module": "commonjs",
"target": "es5",
"jsx": "preserve",
"sourceMap": true,
"lib": ["es6", "dom"]
},
"exclude": [
"node_modules"
]
}

View File

@ -1,8 +0,0 @@
module.exports = {
devtool: 'inline-source-map',
module: {
loaders: [
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' }
]
}
};

View File

@ -1,25 +0,0 @@
var path = require('path');
var merge = require('extendify')({ isDeep: true, arrays: 'concat' });
var devConfig = require('./webpack.config.dev');
var prodConfig = require('./webpack.config.prod');
var isDevelopment = process.env.ASPNETCORE_ENVIRONMENT === 'Development';
module.exports = merge({
resolve: {
extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ]
},
module: {
loaders: [
{ test: /\.ts(x?)$/, exclude: /node_modules/, loader: 'ts-loader?silent' }
],
},
entry: {
main: ['./Clientside/App.ts']
},
output: {
path: path.join(__dirname, 'wwwroot', 'dist'),
filename: '[name].js',
publicPath: '/dist/'
},
plugins: []
}, isDevelopment ? devConfig : prodConfig);

View File

@ -1,15 +0,0 @@
var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var extractLESS = new ExtractTextPlugin('my-styles.css');
module.exports = {
module: {
loaders: [
{ test: /\.less$/, loader: extractLESS.extract(['css-loader', 'less-loader']) },
]
},
plugins: [
extractLESS,
new webpack.optimize.UglifyJsPlugin({ minimize: true, compressor: { warnings: false } })
]
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
</handlers>
<httpPlatform processPath="%DNX_PATH%" arguments="%DNX_ARGS%" stdoutLogEnabled="false"/>
</system.webServer>
</configuration>

View File

@ -1,3 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading; using System.Threading;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
@ -12,6 +16,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// server-side prerendering APIs. This is an alternative to prerendering via /// server-side prerendering APIs. This is an alternative to prerendering via
/// the asp-prerender-module tag helper. /// the asp-prerender-module tag helper.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal class DefaultSpaPrerenderer : ISpaPrerenderer internal class DefaultSpaPrerenderer : ISpaPrerenderer
{ {
private readonly string _applicationBasePath; private readonly string _applicationBasePath;

View File

@ -1,4 +1,8 @@
using System.Threading.Tasks; // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.SpaServices.Prerendering namespace Microsoft.AspNetCore.SpaServices.Prerendering
{ {
@ -7,6 +11,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// JavaScript-based Single Page Applications. This is an alternative /// JavaScript-based Single Page Applications. This is an alternative
/// to using the 'asp-prerender-module' tag helper. /// to using the 'asp-prerender-module' tag helper.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public interface ISpaPrerenderer public interface ISpaPrerenderer
{ {
/// <summary> /// <summary>

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
namespace Microsoft.AspNetCore.SpaServices.Prerendering namespace Microsoft.AspNetCore.SpaServices.Prerendering
@ -5,6 +8,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// <summary> /// <summary>
/// Describes how to find the JavaScript code that performs prerendering. /// Describes how to find the JavaScript code that performs prerendering.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class JavaScriptModuleExport public class JavaScriptModuleExport
{ {
/// <summary> /// <summary>

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -14,6 +17,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// A tag helper for prerendering JavaScript applications on the server. /// A tag helper for prerendering JavaScript applications on the server.
/// </summary> /// </summary>
[HtmlTargetElement(Attributes = PrerenderModuleAttributeName)] [HtmlTargetElement(Attributes = PrerenderModuleAttributeName)]
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class PrerenderTagHelper : TagHelper public class PrerenderTagHelper : TagHelper
{ {
private const string PrerenderModuleAttributeName = "asp-prerender-module"; private const string PrerenderModuleAttributeName = "asp-prerender-module";

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
@ -10,12 +13,14 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// <summary> /// <summary>
/// Performs server-side prerendering by invoking code in Node.js. /// Performs server-side prerendering by invoking code in Node.js.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class Prerenderer public static class Prerenderer
{ {
private static readonly object CreateNodeScriptLock = new object(); private static readonly object CreateNodeScriptLock = new object();
private static StringAsTempFile NodeScript; private static StringAsTempFile NodeScript;
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal static Task<RenderToStringResult> RenderToString( internal static Task<RenderToStringResult> RenderToString(
string applicationBasePath, string applicationBasePath,
INodeServices nodeServices, INodeServices nodeServices,
@ -63,6 +68,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// <param name="timeoutMilliseconds">The maximum duration to wait for prerendering to complete.</param> /// <param name="timeoutMilliseconds">The maximum duration to wait for prerendering to complete.</param>
/// <param name="requestPathBase">The PathBase for the currently-executing HTTP request.</param> /// <param name="requestPathBase">The PathBase for the currently-executing HTTP request.</param>
/// <returns></returns> /// <returns></returns>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static Task<RenderToStringResult> RenderToString( public static Task<RenderToStringResult> RenderToString(
string applicationBasePath, string applicationBasePath,
INodeServices nodeServices, INodeServices nodeServices,
@ -88,7 +94,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
private static string GetNodeScriptFilename(CancellationToken applicationStoppingToken) private static string GetNodeScriptFilename(CancellationToken applicationStoppingToken)
{ {
lock(CreateNodeScriptLock) lock (CreateNodeScriptLock)
{ {
if (NodeScript == null) if (NodeScript == null)
{ {

View File

@ -1,10 +1,15 @@
using Microsoft.AspNetCore.SpaServices.Prerendering; // Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Microsoft.AspNetCore.SpaServices.Prerendering;
namespace Microsoft.Extensions.DependencyInjection namespace Microsoft.Extensions.DependencyInjection
{ {
/// <summary> /// <summary>
/// Extension methods for setting up prerendering features in an <see cref="IServiceCollection" />. /// Extension methods for setting up prerendering features in an <see cref="IServiceCollection" />.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class PrerenderingServiceCollectionExtensions public static class PrerenderingServiceCollectionExtensions
{ {
/// <summary> /// <summary>
@ -12,6 +17,7 @@ namespace Microsoft.Extensions.DependencyInjection
/// of <see cref="ISpaPrerenderer"/>. /// of <see cref="ISpaPrerenderer"/>.
/// </summary> /// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param> /// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void AddSpaPrerenderer(this IServiceCollection serviceCollection) public static void AddSpaPrerenderer(this IServiceCollection serviceCollection)
{ {
serviceCollection.AddHttpContextAccessor(); serviceCollection.AddHttpContextAccessor();

View File

@ -1,3 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using System.Text; using System.Text;
@ -7,6 +11,7 @@ namespace Microsoft.AspNetCore.SpaServices.Prerendering
/// <summary> /// <summary>
/// Describes the prerendering result returned by JavaScript code. /// Describes the prerendering result returned by JavaScript code.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class RenderToStringResult public class RenderToStringResult
{ {
/// <summary> /// <summary>

View File

@ -1,9 +1,13 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
namespace Microsoft.AspNetCore.SpaServices namespace Microsoft.AspNetCore.SpaServices
{ {
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal class SpaRouteConstraint : IRouteConstraint internal class SpaRouteConstraint : IRouteConstraint
{ {
private readonly string _clientRouteTokenName; private readonly string _clientRouteTokenName;

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using Microsoft.AspNetCore.Routing; using Microsoft.AspNetCore.Routing;
@ -10,6 +13,7 @@ namespace Microsoft.AspNetCore.Builder
/// <summary> /// <summary>
/// Extension methods useful for configuring routing in a single-page application (SPA). /// Extension methods useful for configuring routing in a single-page application (SPA).
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class SpaRouteExtensions public static class SpaRouteExtensions
{ {
private const string ClientRouteTokenName = "clientRoute"; private const string ClientRouteTokenName = "clientRoute";

View File

@ -1,9 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
namespace Microsoft.AspNetCore.SpaServices.Webpack namespace Microsoft.AspNetCore.SpaServices.Webpack
@ -14,6 +16,7 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
/// This is useful for Webpack middleware, because it lets you fall back on prebuilt files on disk for /// This is useful for Webpack middleware, because it lets you fall back on prebuilt files on disk for
/// chunks not exposed by the current Webpack config (e.g., DLL/vendor chunks). /// chunks not exposed by the current Webpack config (e.g., DLL/vendor chunks).
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal class ConditionalProxyMiddleware internal class ConditionalProxyMiddleware
{ {
private const int DefaultHttpBufferSize = 4096; private const int DefaultHttpBufferSize = 4096;
@ -89,7 +92,7 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
} }
// We can handle this // We can handle this
context.Response.StatusCode = (int) responseMessage.StatusCode; context.Response.StatusCode = (int)responseMessage.StatusCode;
foreach (var header in responseMessage.Headers) foreach (var header in responseMessage.Headers)
{ {
context.Response.Headers[header.Key] = header.Value.ToArray(); context.Response.Headers[header.Key] = header.Value.ToArray();

View File

@ -1,7 +1,11 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
namespace Microsoft.AspNetCore.SpaServices.Webpack namespace Microsoft.AspNetCore.SpaServices.Webpack
{ {
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
internal class ConditionalProxyMiddlewareOptions internal class ConditionalProxyMiddlewareOptions
{ {
public ConditionalProxyMiddlewareOptions(string scheme, string host, string port, TimeSpan requestTimeout) public ConditionalProxyMiddlewareOptions(string scheme, string host, string port, TimeSpan requestTimeout)

View File

@ -1,3 +1,6 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System; using System;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
@ -11,6 +14,7 @@ namespace Microsoft.AspNetCore.Builder
/// <summary> /// <summary>
/// Extension methods that can be used to enable Webpack dev middleware support. /// Extension methods that can be used to enable Webpack dev middleware support.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static class WebpackDevMiddleware public static class WebpackDevMiddleware
{ {
private const string DefaultConfigFile = "webpack.config.js"; private const string DefaultConfigFile = "webpack.config.js";
@ -36,6 +40,7 @@ namespace Microsoft.AspNetCore.Builder
/// </summary> /// </summary>
/// <param name="appBuilder">The <see cref="IApplicationBuilder"/>.</param> /// <param name="appBuilder">The <see cref="IApplicationBuilder"/>.</param>
/// <param name="options">Options for configuring the Webpack compiler instance.</param> /// <param name="options">Options for configuring the Webpack compiler instance.</param>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public static void UseWebpackDevMiddleware( public static void UseWebpackDevMiddleware(
this IApplicationBuilder appBuilder, this IApplicationBuilder appBuilder,
WebpackDevMiddlewareOptions options = null) WebpackDevMiddlewareOptions options = null)

View File

@ -1,3 +1,7 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Collections.Generic; using System.Collections.Generic;
namespace Microsoft.AspNetCore.SpaServices.Webpack namespace Microsoft.AspNetCore.SpaServices.Webpack
@ -5,6 +9,7 @@ namespace Microsoft.AspNetCore.SpaServices.Webpack
/// <summary> /// <summary>
/// Options for configuring a Webpack dev middleware compiler. /// Options for configuring a Webpack dev middleware compiler.
/// </summary> /// </summary>
[Obsolete("Use Microsoft.AspNetCore.SpaServices.Extensions")]
public class WebpackDevMiddlewareOptions public class WebpackDevMiddlewareOptions
{ {
/// <summary> /// <summary>