mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-25 02:57:31 +00:00
@@ -0,0 +1,25 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<Description>Helpers for building single-page applications on ASP.NET MVC Core.</Description>
|
||||
<TargetFrameworks>net451;netstandard1.6</TargetFrameworks>
|
||||
<VersionPrefix>1.1.1</VersionPrefix>
|
||||
<VersionSuffix>alpha</VersionSuffix>
|
||||
<PackageTags>aspnetcore;aspnetcoremvc;nodeservices</PackageTags>
|
||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Content\**\*" />
|
||||
<ProjectReference Include="..\Microsoft.AspNetCore.NodeServices\Microsoft.AspNetCore.NodeServices.csproj" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="1.1.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish" Condition=" '$(IsCrossTargetingBuild)' != 'true' ">
|
||||
<Exec Command="npm install" />
|
||||
<Exec Command="node node_modules/webpack/bin/webpack.js" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0.23107" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0.23107</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>4624f728-6dff-44b6-93b5-3c7d9c94bf3f</ProjectGuid>
|
||||
<RootNamespace>Microsoft.AspNetCore.SpaServices</RootNamespace>
|
||||
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
|
||||
<OutputPath Condition="'$(OutputPath)'=='' ">.\bin\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
|
||||
</Project>
|
||||
@@ -1,12 +0,0 @@
|
||||
// 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.Reflection;
|
||||
using System.Resources;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyMetadata("Serviceable", "True")]
|
||||
[assembly: NeutralResourcesLanguage("en-us")]
|
||||
[assembly: AssemblyCompany("Microsoft Corporation.")]
|
||||
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
|
||||
[assembly: AssemblyProduct("Microsoft ASP.NET Core")]
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "aspnet-webpack",
|
||||
"version": "1.0.27",
|
||||
"version": "1.0.28",
|
||||
"description": "Helpers for using Webpack in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
||||
@@ -126,12 +126,51 @@ function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configurati
|
||||
} catch (ex) {
|
||||
throw new Error('HotModuleReplacement failed because of an error while loading \'webpack-hot-middleware\'. Error was: ' + ex.stack);
|
||||
}
|
||||
app.use(workaroundIISExpressEventStreamFlushingIssue(hmrServerEndpoint));
|
||||
app.use(webpackHotMiddlewareModule(compiler, {
|
||||
path: hmrServerEndpoint
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
function workaroundIISExpressEventStreamFlushingIssue(path: string): connect.NextHandleFunction {
|
||||
// IIS Express makes HMR seem very slow, because when it's reverse-proxying an EventStream response
|
||||
// from Kestrel, it doesn't pass through the lines to the browser immediately, even if you're calling
|
||||
// response.Flush (or equivalent) in your ASP.NET Core code. For some reason, it waits until the following
|
||||
// line is sent. By default, that wouldn't be until the next HMR heartbeat, which can be up to 5 seconds later.
|
||||
// In effect, it looks as if your code is taking 5 seconds longer to compile than it really does.
|
||||
//
|
||||
// As a workaround, this connect middleware intercepts requests to the HMR endpoint, and modifies the response
|
||||
// stream so that all EventStream 'data' lines are immediately followed with a further blank line. This is
|
||||
// harmless in non-IIS-Express cases, because it's OK to have extra blank lines in an EventStream response.
|
||||
// The implementation is simplistic - rather than using a true stream reader, we just patch the 'write'
|
||||
// method. This relies on webpack's HMR code always writing complete EventStream messages with a single
|
||||
// 'write' call. That works fine today, but if webpack's HMR code was changed, this workaround might have
|
||||
// to be updated.
|
||||
const eventStreamLineStart = /^data\:/;
|
||||
return (req, res, next) => {
|
||||
// We only want to interfere with requests to the HMR endpoint, so check this request matches
|
||||
const urlMatchesPath = (req.url === path) || (req.url.split('?', 1)[0] === path);
|
||||
if (urlMatchesPath) {
|
||||
const origWrite = res.write;
|
||||
res.write = function (chunk) {
|
||||
const result = origWrite.apply(this, arguments);
|
||||
|
||||
// We only want to interfere with actual EventStream data lines, so check it is one
|
||||
if (typeof (chunk) === 'string') {
|
||||
if (eventStreamLineStart.test(chunk) && chunk.charAt(chunk.length - 1) === '\n') {
|
||||
origWrite.call(this, '\n\n');
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
return next();
|
||||
};
|
||||
}
|
||||
|
||||
function copyRecursiveToRealFsSync(from: typeof fs, rootDir: string, exclude: RegExp[]) {
|
||||
from.readdirSync(rootDir).forEach(filename => {
|
||||
const fullPath = pathJoinSafe(rootDir, filename);
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
{
|
||||
"description": "Helpers for building single-page applications on ASP.NET MVC Core",
|
||||
"version": "1.1.0-rtm-*",
|
||||
"packOptions": {
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/aspnet/javascriptservices"
|
||||
},
|
||||
"tags": [
|
||||
"aspnetcore",
|
||||
"aspnetcoremvc",
|
||||
"nodeservices"
|
||||
]
|
||||
},
|
||||
"buildOptions": {
|
||||
"warningsAsErrors": true,
|
||||
"keyFile": "../../tools/Key.snk",
|
||||
"embed": [
|
||||
"Content/**/*"
|
||||
],
|
||||
"xmlDoc": true
|
||||
},
|
||||
"dependencies": {
|
||||
"Microsoft.AspNetCore.Mvc": "1.1.0",
|
||||
"Microsoft.AspNetCore.NodeServices": "1.1.0-*"
|
||||
},
|
||||
"frameworks": {
|
||||
"net451": {},
|
||||
"netstandard1.6": {}
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": [
|
||||
"npm install",
|
||||
"node node_modules/webpack/bin/webpack.js"
|
||||
]
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user