mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Remove all samples from SpaServices.Extensions OOB release branch, since we only want to build the one package
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 15
|
# Visual Studio 15
|
||||||
VisualStudioVersion = 15.0.26730.16
|
VisualStudioVersion = 15.0.27019.1
|
||||||
MinimumVisualStudioVersion = 15.0.26730.03
|
MinimumVisualStudioVersion = 15.0.26730.03
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{27304DDE-AFB2-4F8B-B765-E3E2F11E886C}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{27304DDE-AFB2-4F8B-B765-E3E2F11E886C}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
@@ -21,16 +21,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{99EAF1FE-2
|
|||||||
README.md = README.md
|
README.md = README.md
|
||||||
EndProjectSection
|
EndProjectSection
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{23836492-E7F4-4376-85BF-A635C304AC46}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{E6A161EA-646C-4033-9090-95BE809AB8D9}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LatencyTest", "samples\misc\LatencyTest\LatencyTest.csproj", "{1931B19A-EC42-4D56-B2D0-FB06D17244DA}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Webpack", "samples\misc\Webpack\Webpack.csproj", "{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}"
|
|
||||||
EndProject
|
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NodeServicesExamples", "samples\misc\NodeServicesExamples\NodeServicesExamples.csproj", "{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}"
|
|
||||||
EndProject
|
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{645F7363-1240-4FB6-9422-B32A327C979F}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{645F7363-1240-4FB6-9422-B32A327C979F}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
ProjectSection(SolutionItems) = preProject
|
||||||
Directory.Build.props = Directory.Build.props
|
Directory.Build.props = Directory.Build.props
|
||||||
@@ -57,18 +47,6 @@ Global
|
|||||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
|
||||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
|
||||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
|
||||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE}.Release|Any CPU.Build.0 = Release|Any CPU
|
|
||||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D40BD1C4-6A6F-4213-8535-1057F3EB3400}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
@@ -81,10 +59,6 @@ Global
|
|||||||
{66B77203-1469-41DF-92F2-2BE6900BD36F} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
{66B77203-1469-41DF-92F2-2BE6900BD36F} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||||
{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
{F46DEF99-6FAA-4406-B5D8-6FF34EF669E3} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||||
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
{66B071A8-EFC8-4A06-BEF6-06B99AE27EEC} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||||
{E6A161EA-646C-4033-9090-95BE809AB8D9} = {23836492-E7F4-4376-85BF-A635C304AC46}
|
|
||||||
{1931B19A-EC42-4D56-B2D0-FB06D17244DA} = {E6A161EA-646C-4033-9090-95BE809AB8D9}
|
|
||||||
{DE479DC3-1461-4EAD-A188-4AF7AA4AE344} = {E6A161EA-646C-4033-9090-95BE809AB8D9}
|
|
||||||
{93EFCC5F-C6EE-4623-894F-A42B22C0B6FE} = {E6A161EA-646C-4033-9090-95BE809AB8D9}
|
|
||||||
{D40BD1C4-6A6F-4213-8535-1057F3EB3400} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
{D40BD1C4-6A6F-4213-8535-1057F3EB3400} = {27304DDE-AFB2-4F8B-B765-E3E2F11E886C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
<OutputType>exe</OutputType>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.NodeServices\Microsoft.AspNetCore.NodeServices.csproj" />
|
|
||||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.NodeServices.Sockets\Microsoft.AspNetCore.NodeServices.Sockets.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionPackageVersion)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.NodeServices;
|
|
||||||
using Microsoft.AspNetCore.NodeServices.Sockets;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
|
|
||||||
namespace ConsoleApplication
|
|
||||||
{
|
|
||||||
// This project is a micro-benchmark for .NET->Node RPC via NodeServices. It doesn't reflect
|
|
||||||
// real-world usage patterns (you're not likely to make hundreds of sequential calls like this),
|
|
||||||
// but is a starting point for comparing the overhead of different hosting models and transports.
|
|
||||||
public class Program
|
|
||||||
{
|
|
||||||
public static void Main(string[] args) {
|
|
||||||
// Set up the DI system
|
|
||||||
var services = new ServiceCollection();
|
|
||||||
services.AddNodeServices(options => {
|
|
||||||
// To compare with Socket hosting, uncomment the following line
|
|
||||||
// Since .NET Core 1.1, the HTTP hosting model has become basically as fast as the Socket hosting model
|
|
||||||
//options.UseSocketHosting();
|
|
||||||
|
|
||||||
options.WatchFileExtensions = new string[] {}; // Don't watch anything
|
|
||||||
});
|
|
||||||
var serviceProvider = services.BuildServiceProvider();
|
|
||||||
|
|
||||||
// Now instantiate an INodeServices and use it
|
|
||||||
using (var nodeServices = serviceProvider.GetRequiredService<INodeServices>()) {
|
|
||||||
MeasureLatency(nodeServices).Wait();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task MeasureLatency(INodeServices nodeServices) {
|
|
||||||
// Ensure the connection is open, so we can measure per-request timings below
|
|
||||||
var response = await nodeServices.InvokeAsync<string>("latencyTest", "C#");
|
|
||||||
Console.WriteLine(response);
|
|
||||||
|
|
||||||
// Now perform a series of requests, capturing the time taken
|
|
||||||
const int requestCount = 100;
|
|
||||||
var watch = Stopwatch.StartNew();
|
|
||||||
for (var i = 0; i < requestCount; i++) {
|
|
||||||
await nodeServices.InvokeAsync<string>("latencyTest", "C#");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display results
|
|
||||||
var elapsedSeconds = (float)watch.ElapsedTicks / Stopwatch.Frequency;
|
|
||||||
Console.WriteLine("\nTotal time: {0:F2} milliseconds", 1000 * elapsedSeconds);
|
|
||||||
Console.WriteLine("\nTime per invocation: {0:F2} milliseconds", 1000 * elapsedSeconds / requestCount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
module.exports = function(callback, incomingParam1) {
|
|
||||||
var result = 'Hello, ' + incomingParam1 + '!';
|
|
||||||
callback(/* error */ null, result);
|
|
||||||
}
|
|
||||||
2
samples/misc/NodeServicesExamples/.gitignore
vendored
2
samples/misc/NodeServicesExamples/.gitignore
vendored
@@ -1,2 +0,0 @@
|
|||||||
/node_modules/
|
|
||||||
/Properties/launchSettings.json
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.AspNetCore.Mvc;
|
|
||||||
using Microsoft.AspNetCore.NodeServices;
|
|
||||||
using Microsoft.AspNetCore.SpaServices.Prerendering;
|
|
||||||
|
|
||||||
namespace NodeServicesExamples.Controllers
|
|
||||||
{
|
|
||||||
public class HomeController : Controller
|
|
||||||
{
|
|
||||||
public IActionResult Index(int pageIndex)
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
public IActionResult ES2015Transpilation()
|
|
||||||
{
|
|
||||||
return View();
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<IActionResult> Chart([FromServices] INodeServices nodeServices)
|
|
||||||
{
|
|
||||||
var options = new { width = 400, height = 200, showArea = true, showPoint = true, fullWidth = true };
|
|
||||||
var data = new
|
|
||||||
{
|
|
||||||
labels = new[] { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" },
|
|
||||||
series = new[] {
|
|
||||||
new[] { 1, 5, 2, 5, 4, 3 },
|
|
||||||
new[] { 2, 3, 4, 8, 1, 2 },
|
|
||||||
new[] { 5, 4, 3, 2, 1, 0 }
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
ViewData["ChartMarkup"] = await nodeServices.InvokeAsync<string>("./Node/renderChart", "line", options, data);
|
|
||||||
|
|
||||||
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()
|
|
||||||
{
|
|
||||||
return View("~/Views/Shared/Error.cshtml");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
var createServerRenderer = require('aspnet-prerendering').createServerRenderer;
|
|
||||||
|
|
||||||
module.exports = createServerRenderer(function(params) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var message = 'The HTML was returned by the prerendering boot function. '
|
|
||||||
+ 'The boot function received the following params:'
|
|
||||||
+ '<pre>' + JSON.stringify(params, null, 4) + '</pre>';
|
|
||||||
|
|
||||||
resolve({
|
|
||||||
html: '<h3>Hello, world!</h3>' + message,
|
|
||||||
globals: { sampleData: { nodeVersion: process.version } }
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
var generate = require('node-chartist');
|
|
||||||
|
|
||||||
module.exports = function (callback, type, options, data) {
|
|
||||||
generate(type, options, data).then(
|
|
||||||
result => callback(null, result), // Success case
|
|
||||||
error => callback(error) // Error case
|
|
||||||
);
|
|
||||||
};
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
var fs = require('fs');
|
|
||||||
var babelCore = require('babel-core');
|
|
||||||
|
|
||||||
module.exports = function(cb, physicalPath, requestPath) {
|
|
||||||
var originalContents = fs.readFileSync(physicalPath);
|
|
||||||
var result = babelCore.transform(originalContents, {
|
|
||||||
presets: ['es2015'],
|
|
||||||
sourceMaps: 'inline',
|
|
||||||
sourceFileName: '/sourcemapped' + requestPath
|
|
||||||
});
|
|
||||||
cb(null, result.code);
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
|
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.SpaServices\Microsoft.AspNetCore.SpaServices.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(MicrosoftAspNetCoreDiagnosticsPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
|
||||||
<Exec Command="npm install" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
using Microsoft.AspNetCore.Builder;
|
|
||||||
using Microsoft.AspNetCore.Hosting;
|
|
||||||
using Microsoft.AspNetCore.Http;
|
|
||||||
using Microsoft.AspNetCore.NodeServices;
|
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
|
||||||
using Microsoft.Extensions.Logging;
|
|
||||||
using System.IO;
|
|
||||||
|
|
||||||
namespace NodeServicesExamples
|
|
||||||
{
|
|
||||||
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();
|
|
||||||
|
|
||||||
// Enable Node Services
|
|
||||||
services.AddNodeServices();
|
|
||||||
services.AddSpaPrerenderer();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
||||||
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IHostingEnvironment env, INodeServices nodeServices)
|
|
||||||
{
|
|
||||||
app.UseDeveloperExceptionPage();
|
|
||||||
|
|
||||||
// Dynamically transpile any .js files under the '/js/' directory
|
|
||||||
app.Use(next => async context => {
|
|
||||||
var requestPath = context.Request.Path.Value;
|
|
||||||
if (requestPath.StartsWith("/js/") && requestPath.EndsWith(".js")) {
|
|
||||||
var fileInfo = env.WebRootFileProvider.GetFileInfo(requestPath);
|
|
||||||
if (fileInfo.Exists) {
|
|
||||||
var transpiled = await nodeServices.InvokeAsync<string>("./Node/transpilation.js", fileInfo.PhysicalPath, requestPath);
|
|
||||||
await context.Response.WriteAsync(transpiled);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Not a JS file, or doesn't exist - let some other middleware handle it
|
|
||||||
await next.Invoke(context);
|
|
||||||
});
|
|
||||||
|
|
||||||
app.UseStaticFiles();
|
|
||||||
app.UseMvc(routes =>
|
|
||||||
{
|
|
||||||
routes.MapRoute(
|
|
||||||
name: "default",
|
|
||||||
template: "{controller=Home}/{action=Index}/{id?}");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<h1>Server-rendered chart</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
This sample demonstrates how arbitrary NPM modules can be invoked from .NET code.
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
In this case, we use <code>node-chartist</code> to render the following chart on the server. The output is
|
|
||||||
identical to what you'd get if you used <a href='https://gionkunz.github.io/chartist-js/'>chartist.js</a>
|
|
||||||
on the client, except that in this example, we're not executing any client-side code at all.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
@Html.Raw(ViewData["ChartMarkup"])
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<h1>ES2015 Transpilation</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
This sample demonstrates a way of intercepting requests for .js files and dynamically transpiling them
|
|
||||||
from ES2015 code to browser-compatible ES5 code using the Babel library.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
To see that it's working, open your browser's 'Debug' console and look for the log message. This is
|
|
||||||
produced by the file <a href='/js/main.js'>/js/main.js</a>, which is transpiled from ES2015 dynamically
|
|
||||||
when requested.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
@section scripts {
|
|
||||||
<script src='/js/main.js'></script>
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
<h1>NodeServices examples</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
These examples demonstrate the direct use of the NodeServices package, independently of the usual SPA scenarios.
|
|
||||||
In general, NodeServices offers an efficient way to use Node-provided functionality (e.g., NPM modules) from inside
|
|
||||||
a .NET application.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li><a asp-action="ES2015Transpilation">ES2015 transpilation</a></li>
|
|
||||||
<li><a asp-action="Chart">Server-side chart rendering</a></li>
|
|
||||||
<li><a asp-action="Prerendering">Server-side SPA prerendering</a></li>
|
|
||||||
</ul>
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
<h1>Server-side prerendering</h1>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
This sample demonstrates how you can invoke a JavaScript module that contains
|
|
||||||
prerendering logic for a Single-Page Application framework.
|
|
||||||
</p>
|
|
||||||
</p>
|
|
||||||
Your prerendering boot function will receive parameters that describe the page
|
|
||||||
being rendered and any data supplied by the .NET code. The return value should be
|
|
||||||
a promise that resolves with data to be injected into the page, such as the
|
|
||||||
rendered HTML and any global data that should be made available to client-side code.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
@Html.Raw(ViewData["PrerenderedHtml"])
|
|
||||||
|
|
||||||
<script>@Html.Raw(ViewData["PrerenderedGlobals"])</script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Demonstrates how client-side code can receive data from the prerendering process
|
|
||||||
console.log('Received Node version from prerendering logic: ' + sampleData.nodeVersion);
|
|
||||||
</script>
|
|
||||||
@@ -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>
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8" />
|
|
||||||
<title>NodeServices Examples</title>
|
|
||||||
<link rel="stylesheet" href="~/css/chartist.min.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
@RenderBody()
|
|
||||||
@RenderSection("scripts", required: false)
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@using NodeServicesExamples
|
|
||||||
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
@{
|
|
||||||
Layout = "_Layout";
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
{}
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES6",
|
|
||||||
"module": "commonjs"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "nodeservicesexamples",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"dependencies": {
|
|
||||||
"aspnet-prerendering": "^2.0.6",
|
|
||||||
"babel-core": "^6.7.4",
|
|
||||||
"babel-preset-es2015": "^6.6.0",
|
|
||||||
"node-chartist": "^1.0.2"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because one or more lines are too long
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB |
@@ -1,7 +0,0 @@
|
|||||||
class Greeting {
|
|
||||||
getMessage() {
|
|
||||||
return 'Hello from the ES2015 class';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(new Greeting().getMessage());
|
|
||||||
@@ -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" forwardWindowsAuthToken="false" startupTimeLimit="3600" />
|
|
||||||
</system.webServer>
|
|
||||||
</configuration>
|
|
||||||
233
samples/misc/Webpack/.gitignore
vendored
233
samples/misc/Webpack/.gitignore
vendored
@@ -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/
|
|
||||||
@@ -1,51 +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;
|
|
||||||
|
|
||||||
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<IHostingEnvironment>();
|
|
||||||
var applicationLifetime = context.HttpContext.RequestServices.GetRequiredService<IApplicationLifetime>();
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
import { HelloWorld } from './HelloWorld';
|
|
||||||
import './styles/main.less';
|
|
||||||
|
|
||||||
new HelloWorld().doIt();
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
export class HelloWorld {
|
|
||||||
public doIt() {
|
|
||||||
console.log('Hello from MyApp');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
@headerColor: red;
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: @headerColor;
|
|
||||||
}
|
|
||||||
@@ -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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
{
|
|
||||||
"iisSettings": {
|
|
||||||
"windowsAuthentication": false,
|
|
||||||
"anonymousAuthentication": true,
|
|
||||||
"iisExpress": {
|
|
||||||
"applicationUrl": "http://localhost:51463/",
|
|
||||||
"sslPort": 0
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"profiles": {
|
|
||||||
"IIS Express": {
|
|
||||||
"commandName": "IISExpress",
|
|
||||||
"launchBrowser": true,
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"dotnet cli": {
|
|
||||||
"commandName": "Project",
|
|
||||||
"environmentVariables": {
|
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,60 +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, ILoggerFactory loggerFactory, IHostingEnvironment env)
|
|
||||||
{
|
|
||||||
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.UseMvc(routes =>
|
|
||||||
{
|
|
||||||
routes.MapRoute(
|
|
||||||
name: "default",
|
|
||||||
template: "{controller=Home}/{action=Index}/{id?}");
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
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();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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>
|
|
||||||
}
|
|
||||||
@@ -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>
|
|
||||||
@@ -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>
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
@using Webpack
|
|
||||||
@addTagHelper "*, Microsoft.AspNetCore.Mvc.TagHelpers"
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
@{
|
|
||||||
Layout = "_Layout";
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
|
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
|
||||||
<IsPackable>false</IsPackable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<ProjectReference Include="..\..\..\src\Microsoft.AspNetCore.SpaServices\Microsoft.AspNetCore.SpaServices.csproj" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Diagnostics" Version="$(MicrosoftAspNetCoreDiagnosticsPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="$(MicrosoftAspNetCoreHostingPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.IISIntegration" Version="$(MicrosoftAspNetCoreServerIISIntegrationPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="$(MicrosoftAspNetCoreMvcPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
|
||||||
<Exec Command="npm install" />
|
|
||||||
</Target>
|
|
||||||
|
|
||||||
</Project>
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"Logging": {
|
|
||||||
"IncludeScopes": false,
|
|
||||||
"LogLevel": {
|
|
||||||
"Default": "Verbose",
|
|
||||||
"System": "Information",
|
|
||||||
"Microsoft": "Information"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"module": "commonjs",
|
|
||||||
"target": "es5",
|
|
||||||
"jsx": "preserve",
|
|
||||||
"sourceMap": true,
|
|
||||||
"lib": ["es6", "dom"]
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
module.exports = {
|
|
||||||
devtool: 'inline-source-map',
|
|
||||||
module: {
|
|
||||||
loaders: [
|
|
||||||
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader' }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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);
|
|
||||||
@@ -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 |
@@ -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>
|
|
||||||
Reference in New Issue
Block a user