Merge remote-tracking branch 'JavaScriptServices/rybrande/masterToSrc' into rybrande/Mondo22ToMaster
This commit is contained in:
commit
4ab02a9ad9
|
|
@ -1,10 +1,6 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
|
||||||
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
|
|
||||||
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.2' ">$(MicrosoftNETCoreApp22PackageVersion)</RuntimeFrameworkVersion>
|
|
||||||
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
|
<NETStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netstandard2.0' ">$(NETStandardLibrary20PackageVersion)</NETStandardImplicitPackageVersion>
|
||||||
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
|
|
||||||
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,11 @@ Read [Building Single Page Applications on ASP.NET Core with JavaScriptServices]
|
||||||
This repo contains:
|
This repo contains:
|
||||||
|
|
||||||
* A set of NuGet/NPM packages that implement functionality for:
|
* A set of NuGet/NPM packages that implement functionality for:
|
||||||
* Invoking arbitrary NPM packages at runtime from .NET code ([docs](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.NodeServices#simple-usage-example))
|
* Invoking arbitrary NPM packages at runtime from .NET code ([docs](/src/Microsoft.AspNetCore.NodeServices#simple-usage-example))
|
||||||
* Server-side prerendering of SPA components ([docs](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#server-side-prerendering))
|
* Server-side prerendering of SPA components ([docs](/src/Microsoft.AspNetCore.SpaServices#server-side-prerendering))
|
||||||
* Webpack dev middleware ([docs](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#webpack-dev-middleware))
|
* Webpack dev middleware ([docs](/src/Microsoft.AspNetCore.SpaServices#webpack-dev-middleware))
|
||||||
* Hot module replacement (HMR) ([docs](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#webpack-hot-module-replacement))
|
* Hot module replacement (HMR) ([docs](/src/Microsoft.AspNetCore.SpaServices#webpack-hot-module-replacement))
|
||||||
* Server-side and client-side routing integration ([docs](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#routing-helper-mapspafallbackroute))
|
* Server-side and client-side routing integration ([docs](/src/Microsoft.AspNetCore.SpaServices#routing-helper-mapspafallbackroute))
|
||||||
* Server-side and client-side validation integration
|
* Server-side and client-side validation integration
|
||||||
* "Lazy loading" for Knockout apps
|
* "Lazy loading" for Knockout apps
|
||||||
* Samples and docs
|
* Samples and docs
|
||||||
|
|
@ -63,10 +63,10 @@ If you have an existing ASP.NET Core application, or if you just want to use the
|
||||||
* `Microsoft.AspNetCore.NodeServices`
|
* `Microsoft.AspNetCore.NodeServices`
|
||||||
* This provides a fast and robust way for .NET code to run JavaScript on the server inside a Node.js environment. You can use this to consume arbitrary functionality from NPM packages at runtime in your ASP.NET Core app.
|
* This provides a fast and robust way for .NET code to run JavaScript on the server inside a Node.js environment. You can use this to consume arbitrary functionality from NPM packages at runtime in your ASP.NET Core app.
|
||||||
* Most applications developers don't need to use this directly, but you can do so if you want to implement your own functionality that involves calling Node.js code from .NET at runtime.
|
* Most applications developers don't need to use this directly, but you can do so if you want to implement your own functionality that involves calling Node.js code from .NET at runtime.
|
||||||
* Find [documentation and usage examples here](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.NodeServices#microsoftaspnetcorenodeservices).
|
* Find [documentation and usage examples here](/src/Microsoft.AspNetCore.NodeServices#microsoftaspnetcorenodeservices).
|
||||||
* `Microsoft.AspNetCore.SpaServices`
|
* `Microsoft.AspNetCore.SpaServices`
|
||||||
* This provides infrastructure that's generally useful when building Single Page Applications (SPAs) with technologies such as Angular or React (for example, server-side prerendering and webpack middleware). Internally, it uses the `NodeServices` package to implement its features.
|
* This provides infrastructure that's generally useful when building Single Page Applications (SPAs) with technologies such as Angular or React (for example, server-side prerendering and webpack middleware). Internally, it uses the `NodeServices` package to implement its features.
|
||||||
* Find [documentation and usage examples here](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices#microsoftaspnetcorespaservices)
|
* Find [documentation and usage examples here](/src/Microsoft.AspNetCore.SpaServices#microsoftaspnetcorespaservices)
|
||||||
|
|
||||||
There were previously other packages called `Microsoft.AspNetCore.AngularServices` and `Microsoft.AspNetCore.ReactServices` but these are not currently needed - all applicable functionality is in `Microsoft.AspNetCore.SpaServices`, because it's sufficiently general.
|
There were previously other packages called `Microsoft.AspNetCore.AngularServices` and `Microsoft.AspNetCore.ReactServices` but these are not currently needed - all applicable functionality is in `Microsoft.AspNetCore.SpaServices`, because it's sufficiently general.
|
||||||
|
|
||||||
|
|
@ -74,7 +74,7 @@ If you want to build a helper library for some other SPA framework, you can do s
|
||||||
|
|
||||||
## Samples
|
## Samples
|
||||||
|
|
||||||
The [`samples` directory](https://github.com/aspnet/JavaScriptServices/tree/dev/samples) contains examples of:
|
The [`samples` directory](/samples) contains examples of:
|
||||||
|
|
||||||
- Using the JavaScript services family of packages with Angular and React.
|
- Using the JavaScript services family of packages with Angular and React.
|
||||||
- A standalone `NodeServices` usage for runtime code transpilation and image processing.
|
- A standalone `NodeServices` usage for runtime code transpilation and image processing.
|
||||||
|
|
|
||||||
|
|
@ -3,28 +3,27 @@
|
||||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Package Versions">
|
<PropertyGroup Label="Package Versions">
|
||||||
<InternalAspNetCoreSdkPackageVersion>2.2.0-preview2-20181004.6</InternalAspNetCoreSdkPackageVersion>
|
<InternalAspNetCoreSdkPackageVersion>3.0.0-build-20181114.5</InternalAspNetCoreSdkPackageVersion>
|
||||||
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreDiagnosticsPackageVersion>
|
<MicrosoftAspNetCoreDiagnosticsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreDiagnosticsPackageVersion>
|
||||||
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||||
<MicrosoftAspNetCoreHostingPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreHostingPackageVersion>
|
<MicrosoftAspNetCoreHostingPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreHostingPackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreMvcPackageVersion>
|
<MicrosoftAspNetCoreMvcPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcPackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcTagHelpersPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreMvcTagHelpersPackageVersion>
|
<MicrosoftAspNetCoreMvcTagHelpersPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcTagHelpersPackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>
|
<MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>
|
||||||
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||||
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
<MicrosoftAspNetCoreServerKestrelPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||||
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
<MicrosoftAspNetCoreStaticFilesPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
||||||
<MicrosoftAspNetCoreWebSocketsPackageVersion>2.2.0-preview3-35425</MicrosoftAspNetCoreWebSocketsPackageVersion>
|
<MicrosoftAspNetCoreWebSocketsPackageVersion>3.0.0-alpha1-10742</MicrosoftAspNetCoreWebSocketsPackageVersion>
|
||||||
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
<MicrosoftExtensionsDependencyInjectionPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
||||||
<MicrosoftExtensionsFileProvidersPhysicalPackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsFileProvidersPhysicalPackageVersion>
|
<MicrosoftExtensionsFileProvidersPhysicalPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsFileProvidersPhysicalPackageVersion>
|
||||||
<MicrosoftExtensionsLoggingConsolePackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsLoggingConsolePackageVersion>
|
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
|
||||||
<MicrosoftExtensionsLoggingDebugPackageVersion>2.2.0-preview3-35425</MicrosoftExtensionsLoggingDebugPackageVersion>
|
<MicrosoftExtensionsLoggingConsolePackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||||
<MicrosoftNETCoreApp20PackageVersion>2.0.9</MicrosoftNETCoreApp20PackageVersion>
|
<MicrosoftExtensionsLoggingDebugPackageVersion>3.0.0-preview-181113-11</MicrosoftExtensionsLoggingDebugPackageVersion>
|
||||||
<MicrosoftNETCoreApp21PackageVersion>2.1.3</MicrosoftNETCoreApp21PackageVersion>
|
<MicrosoftNETCoreAppPackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreAppPackageVersion>
|
||||||
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview3-27001-02</MicrosoftNETCoreApp22PackageVersion>
|
<MicrosoftNETSdkRazorPackageVersion>3.0.0-alpha1-10742</MicrosoftNETSdkRazorPackageVersion>
|
||||||
<MicrosoftNETSdkRazorPackageVersion>2.2.0-preview3-35425</MicrosoftNETSdkRazorPackageVersion>
|
|
||||||
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
<NETStandardLibrary20PackageVersion>2.0.3</NETStandardLibrary20PackageVersion>
|
||||||
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
|
<NewtonsoftJsonPackageVersion>11.0.2</NewtonsoftJsonPackageVersion>
|
||||||
<SystemThreadingTasksDataflowPackageVersion>4.9.0</SystemThreadingTasksDataflowPackageVersion>
|
<SystemThreadingTasksDataflowPackageVersion>4.10.0-preview1-26907-04</SystemThreadingTasksDataflowPackageVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
<Import Project="$(DotNetPackageVersionPropsPath)" Condition=" '$(DotNetPackageVersionPropsPath)' != '' " />
|
||||||
<PropertyGroup Label="Package Versions: Pinned" />
|
<PropertyGroup Label="Package Versions: Pinned" />
|
||||||
|
|
|
||||||
|
|
@ -4,13 +4,10 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- These properties are use by the automation that updates dependencies.props -->
|
<!-- These properties are use by the automation that updates dependencies.props -->
|
||||||
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
|
<LineupPackageId>Internal.AspNetCore.Universe.Lineup</LineupPackageId>
|
||||||
<LineupPackageVersion>2.2.0-*</LineupPackageVersion>
|
|
||||||
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
|
<LineupPackageRestoreSource>https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json</LineupPackageRestoreSource>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp20PackageVersion)" />
|
<DotNetCoreRuntime Include="$(MicrosoftNETCoreAppPackageVersion)" />
|
||||||
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" />
|
|
||||||
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp22PackageVersion)" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
<OutputType>exe</OutputType>
|
<OutputType>exe</OutputType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="$(MicrosoftExtensionsDependencyInjectionPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel" Version="$(MicrosoftAspNetCoreServerKestrelPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="$(MicrosoftAspNetCoreStaticFilesPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="$(MicrosoftExtensionsLoggingDebugPackageVersion)" />
|
||||||
|
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
|
<PackageReference Include="Microsoft.NET.Sdk.Razor" Version="$(MicrosoftNETSdkRazorPackageVersion)" PrivateAssets="All" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
(function(e, a) { for(var i in a) e[i] = a[i]; }(exports, /******/ (function(modules) { // webpackBootstrap
|
(function (e, a) { for (var i in a) e[i] = a[i]; }(exports, /******/(function (modules) { // webpackBootstrap
|
||||||
/******/ // The module cache
|
/******/ // The module cache
|
||||||
/******/ var installedModules = {};
|
/******/ var installedModules = {};
|
||||||
/******/
|
/******/
|
||||||
|
|
@ -6,15 +6,17 @@
|
||||||
/******/ function __webpack_require__(moduleId) {
|
/******/ function __webpack_require__(moduleId) {
|
||||||
/******/
|
/******/
|
||||||
/******/ // Check if module is in cache
|
/******/ // Check if module is in cache
|
||||||
/******/ if(installedModules[moduleId]) {
|
/******/ if (installedModules[moduleId]) {
|
||||||
/******/ return installedModules[moduleId].exports;
|
/******/ return installedModules[moduleId].exports;
|
||||||
/******/ }
|
/******/
|
||||||
|
}
|
||||||
/******/ // Create a new module (and put it into the cache)
|
/******/ // Create a new module (and put it into the cache)
|
||||||
/******/ var module = installedModules[moduleId] = {
|
/******/ var module = installedModules[moduleId] = {
|
||||||
/******/ i: moduleId,
|
/******/ i: moduleId,
|
||||||
/******/ l: false,
|
/******/ l: false,
|
||||||
/******/ exports: {}
|
/******/ exports: {}
|
||||||
/******/ };
|
/******/
|
||||||
|
};
|
||||||
/******/
|
/******/
|
||||||
/******/ // Execute the module function
|
/******/ // Execute the module function
|
||||||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||||
|
|
@ -24,7 +26,8 @@
|
||||||
/******/
|
/******/
|
||||||
/******/ // Return the exports of the module
|
/******/ // Return the exports of the module
|
||||||
/******/ return module.exports;
|
/******/ return module.exports;
|
||||||
/******/ }
|
/******/
|
||||||
|
}
|
||||||
/******/
|
/******/
|
||||||
/******/
|
/******/
|
||||||
/******/ // expose the modules object (__webpack_modules__)
|
/******/ // expose the modules object (__webpack_modules__)
|
||||||
|
|
@ -34,47 +37,53 @@
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
/******/
|
/******/
|
||||||
/******/ // define getter function for harmony exports
|
/******/ // define getter function for harmony exports
|
||||||
/******/ __webpack_require__.d = function(exports, name, getter) {
|
/******/ __webpack_require__.d = function (exports, name, getter) {
|
||||||
/******/ if(!__webpack_require__.o(exports, name)) {
|
/******/ if (!__webpack_require__.o(exports, name)) {
|
||||||
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
/******/ }
|
/******/
|
||||||
/******/ };
|
}
|
||||||
|
/******/
|
||||||
|
};
|
||||||
/******/
|
/******/
|
||||||
/******/ // define __esModule on exports
|
/******/ // define __esModule on exports
|
||||||
/******/ __webpack_require__.r = function(exports) {
|
/******/ __webpack_require__.r = function (exports) {
|
||||||
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
/******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
/******/ }
|
/******/
|
||||||
|
}
|
||||||
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
/******/ };
|
/******/
|
||||||
|
};
|
||||||
/******/
|
/******/
|
||||||
/******/ // create a fake namespace object
|
/******/ // create a fake namespace object
|
||||||
/******/ // mode & 1: value is a module id, require it
|
/******/ // mode & 1: value is a module id, require it
|
||||||
/******/ // mode & 2: merge all properties of value into the ns
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
/******/ // mode & 4: return value when already ns object
|
/******/ // mode & 4: return value when already ns object
|
||||||
/******/ // mode & 8|1: behave like require
|
/******/ // mode & 8|1: behave like require
|
||||||
/******/ __webpack_require__.t = function(value, mode) {
|
/******/ __webpack_require__.t = function (value, mode) {
|
||||||
/******/ if(mode & 1) value = __webpack_require__(value);
|
/******/ if (mode & 1) value = __webpack_require__(value);
|
||||||
/******/ if(mode & 8) return value;
|
/******/ if (mode & 8) return value;
|
||||||
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
/******/ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
/******/ var ns = Object.create(null);
|
/******/ var ns = Object.create(null);
|
||||||
/******/ __webpack_require__.r(ns);
|
/******/ __webpack_require__.r(ns);
|
||||||
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
|
||||||
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
|
/******/ if (mode & 2 && typeof value != 'string') for (var key in value) __webpack_require__.d(ns, key, function (key) { return value[key]; }.bind(null, key));
|
||||||
/******/ return ns;
|
/******/ return ns;
|
||||||
/******/ };
|
/******/
|
||||||
|
};
|
||||||
/******/
|
/******/
|
||||||
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
/******/ __webpack_require__.n = function(module) {
|
/******/ __webpack_require__.n = function (module) {
|
||||||
/******/ var getter = module && module.__esModule ?
|
/******/ var getter = module && module.__esModule ?
|
||||||
/******/ function getDefault() { return module['default']; } :
|
/******/ function getDefault() { return module['default']; } :
|
||||||
/******/ function getModuleExports() { return module; };
|
/******/ function getModuleExports() { return module; };
|
||||||
/******/ __webpack_require__.d(getter, 'a', getter);
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
/******/ return getter;
|
/******/ return getter;
|
||||||
/******/ };
|
/******/
|
||||||
|
};
|
||||||
/******/
|
/******/
|
||||||
/******/ // Object.prototype.hasOwnProperty.call
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
/******/ __webpack_require__.o = function (object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
||||||
/******/
|
/******/
|
||||||
/******/ // __webpack_public_path__
|
/******/ // __webpack_public_path__
|
||||||
/******/ __webpack_require__.p = "";
|
/******/ __webpack_require__.p = "";
|
||||||
|
|
@ -82,40 +91,42 @@
|
||||||
/******/
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
/******/ return __webpack_require__(__webpack_require__.s = 0);
|
||||||
/******/ })
|
/******/
|
||||||
|
})
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ ([
|
/******/([
|
||||||
/* 0 */
|
/* 0 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
module.exports = __webpack_require__(1);
|
module.exports = __webpack_require__(1);
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 1 */
|
/* 1 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.__esModule = true;
|
exports.__esModule = true;
|
||||||
// Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
|
// Limit dependencies to core Node modules. This means the code in this file has to be very low-level and unattractive,
|
||||||
// but simplifies things for the consumer of this module.
|
// but simplifies things for the consumer of this module.
|
||||||
__webpack_require__(2);
|
__webpack_require__(2);
|
||||||
var net = __webpack_require__(3);
|
var net = __webpack_require__(3);
|
||||||
var path = __webpack_require__(4);
|
var path = __webpack_require__(4);
|
||||||
var readline = __webpack_require__(5);
|
var readline = __webpack_require__(5);
|
||||||
var ArgsUtil_1 = __webpack_require__(6);
|
var ArgsUtil_1 = __webpack_require__(6);
|
||||||
var ExitWhenParentExits_1 = __webpack_require__(7);
|
var ExitWhenParentExits_1 = __webpack_require__(7);
|
||||||
var virtualConnectionServer = __webpack_require__(8);
|
var virtualConnectionServer = __webpack_require__(8);
|
||||||
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
|
||||||
// reference to Node's runtime 'require' function.
|
// reference to Node's runtime 'require' function.
|
||||||
var dynamicRequire = eval('require');
|
var dynamicRequire = eval('require');
|
||||||
// Signal to the .NET side when we're ready to accept invocations
|
// Signal to the .NET side when we're ready to accept invocations
|
||||||
var server = net.createServer().on('listening', function () {
|
var server = net.createServer().on('listening', function () {
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
||||||
});
|
});
|
||||||
// Each virtual connection represents a separate invocation
|
// Each virtual connection represents a separate invocation
|
||||||
virtualConnectionServer.createInterface(server).on('connection', function (connection) {
|
virtualConnectionServer.createInterface(server).on('connection', function (connection) {
|
||||||
readline.createInterface(connection, null).on('line', function (line) {
|
readline.createInterface(connection, null).on('line', function (line) {
|
||||||
try {
|
try {
|
||||||
// Get a reference to the function to invoke
|
// Get a reference to the function to invoke
|
||||||
|
|
@ -154,39 +165,40 @@ virtualConnectionServer.createInterface(server).on('connection', function (conne
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
// Begin listening now. The underlying transport varies according to the runtime platform.
|
// Begin listening now. The underlying transport varies according to the runtime platform.
|
||||||
// On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets.
|
// On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets.
|
||||||
var useWindowsNamedPipes = /^win/.test(process.platform);
|
var useWindowsNamedPipes = /^win/.test(process.platform);
|
||||||
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
|
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
|
||||||
var listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress;
|
var listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress;
|
||||||
server.listen(listenAddress);
|
server.listen(listenAddress);
|
||||||
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
|
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 2 */
|
/* 2 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function (module, exports) {
|
||||||
|
|
||||||
// When Node writes to stdout/strerr, we capture that and convert the lines into calls on the
|
// When Node writes to stdout/strerr, we capture that and convert the lines into calls on the
|
||||||
// active .NET ILogger. But by default, stdout/stderr don't have any way of distinguishing
|
// active .NET ILogger. But by default, stdout/stderr don't have any way of distinguishing
|
||||||
// linebreaks inside log messages from the linebreaks that delimit separate log messages,
|
// linebreaks inside log messages from the linebreaks that delimit separate log messages,
|
||||||
// so multiline strings will end up being written to the ILogger as multiple independent
|
// so multiline strings will end up being written to the ILogger as multiple independent
|
||||||
// log messages. This makes them very hard to make sense of, especially when they represent
|
// log messages. This makes them very hard to make sense of, especially when they represent
|
||||||
// something like stack traces.
|
// something like stack traces.
|
||||||
//
|
//
|
||||||
// To fix this, we intercept stdout/stderr writes, and replace internal linebreaks with a
|
// To fix this, we intercept stdout/stderr writes, and replace internal linebreaks with a
|
||||||
// marker token. When .NET receives the lines, it converts the marker tokens back to regular
|
// marker token. When .NET receives the lines, it converts the marker tokens back to regular
|
||||||
// linebreaks within the logged messages.
|
// linebreaks within the logged messages.
|
||||||
//
|
//
|
||||||
// Note that it's better to do the interception at the stdout/stderr level, rather than at
|
// Note that it's better to do the interception at the stdout/stderr level, rather than at
|
||||||
// the console.log/console.error (etc.) level, because this takes place after any native
|
// the console.log/console.error (etc.) level, because this takes place after any native
|
||||||
// message formatting has taken place (e.g., inserting values for % placeholders).
|
// message formatting has taken place (e.g., inserting values for % placeholders).
|
||||||
var findInternalNewlinesRegex = /\n(?!$)/g;
|
var findInternalNewlinesRegex = /\n(?!$)/g;
|
||||||
var encodedNewline = '__ns_newline__';
|
var encodedNewline = '__ns_newline__';
|
||||||
encodeNewlinesWrittenToStream(process.stdout);
|
encodeNewlinesWrittenToStream(process.stdout);
|
||||||
encodeNewlinesWrittenToStream(process.stderr);
|
encodeNewlinesWrittenToStream(process.stderr);
|
||||||
function encodeNewlinesWrittenToStream(outputStream) {
|
function encodeNewlinesWrittenToStream(outputStream) {
|
||||||
var origWriteFunction = outputStream.write;
|
var origWriteFunction = outputStream.write;
|
||||||
outputStream.write = function (value) {
|
outputStream.write = function (value) {
|
||||||
// Only interfere with the write if it's definitely a string
|
// Only interfere with the write if it's definitely a string
|
||||||
|
|
@ -199,38 +211,42 @@ function encodeNewlinesWrittenToStream(outputStream) {
|
||||||
origWriteFunction.apply(this, arguments);
|
origWriteFunction.apply(this, arguments);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function encodeNewlinesInString(str) {
|
function encodeNewlinesInString(str) {
|
||||||
return str.replace(findInternalNewlinesRegex, encodedNewline);
|
return str.replace(findInternalNewlinesRegex, encodedNewline);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 3 */
|
/* 3 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function (module, exports) {
|
||||||
|
|
||||||
module.exports = require("net");
|
module.exports = require("net");
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 4 */
|
/* 4 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function (module, exports) {
|
||||||
|
|
||||||
module.exports = require("path");
|
module.exports = require("path");
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 5 */
|
/* 5 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function (module, exports) {
|
||||||
|
|
||||||
module.exports = require("readline");
|
module.exports = require("readline");
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 6 */
|
/* 6 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.__esModule = true;
|
exports.__esModule = true;
|
||||||
function parseArgs(args) {
|
function parseArgs(args) {
|
||||||
// Very simplistic parsing which is sufficient for the cases needed. We don't want to bring in any external
|
// Very simplistic parsing which is sufficient for the cases needed. We don't want to bring in any external
|
||||||
// dependencies (such as an args-parsing library) to this file.
|
// dependencies (such as an args-parsing library) to this file.
|
||||||
var result = {};
|
var result = {};
|
||||||
|
|
@ -247,27 +263,28 @@ function parseArgs(args) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
exports.parseArgs = parseArgs;
|
exports.parseArgs = parseArgs;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 7 */
|
/* 7 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
In general, we want the Node child processes to be terminated as soon as the parent .NET processes exit,
|
In general, we want the Node child processes to be terminated as soon as the parent .NET processes exit,
|
||||||
because we have no further use for them. If the .NET process shuts down gracefully, it will run its
|
because we have no further use for them. If the .NET process shuts down gracefully, it will run its
|
||||||
finalizers, one of which (in OutOfProcessNodeInstance.cs) will kill its associated Node process immediately.
|
finalizers, one of which (in OutOfProcessNodeInstance.cs) will kill its associated Node process immediately.
|
||||||
|
|
||||||
But if the .NET process is terminated forcefully (e.g., on Linux/OSX with 'kill -9'), then it won't have
|
But if the .NET process is terminated forcefully (e.g., on Linux/OSX with 'kill -9'), then it won't have
|
||||||
any opportunity to shut down its child processes, and by default they will keep running. In this case, it's
|
any opportunity to shut down its child processes, and by default they will keep running. In this case, it's
|
||||||
up to the child process to detect this has happened and terminate itself.
|
up to the child process to detect this has happened and terminate itself.
|
||||||
|
|
||||||
There are many possible approaches to detecting when a parent process has exited, most of which behave
|
There are many possible approaches to detecting when a parent process has exited, most of which behave
|
||||||
differently between Windows and Linux/OS X:
|
differently between Windows and Linux/OS X:
|
||||||
|
|
||||||
- On Windows, the parent process can mark its child as being a 'job' that should auto-terminate when
|
- On Windows, the parent process can mark its child as being a 'job' that should auto-terminate when
|
||||||
the parent does (http://stackoverflow.com/a/4657392). Not cross-platform.
|
the parent does (http://stackoverflow.com/a/4657392). Not cross-platform.
|
||||||
|
|
@ -287,12 +304,12 @@ differently between Windows and Linux/OS X:
|
||||||
process.stdout is still connected (without actually writing to it) but I haven't found any property whose
|
process.stdout is still connected (without actually writing to it) but I haven't found any property whose
|
||||||
value changes until you actually try to write to it.
|
value changes until you actually try to write to it.
|
||||||
|
|
||||||
Of these, the only cross-platform approach that is actually documented as a valid strategy is simply polling
|
Of these, the only cross-platform approach that is actually documented as a valid strategy is simply polling
|
||||||
to check whether the parent PID is still running. So that's what we do here.
|
to check whether the parent PID is still running. So that's what we do here.
|
||||||
*/
|
*/
|
||||||
exports.__esModule = true;
|
exports.__esModule = true;
|
||||||
var pollIntervalMs = 1000;
|
var pollIntervalMs = 1000;
|
||||||
function exitWhenParentExits(parentPid, ignoreSigint) {
|
function exitWhenParentExits(parentPid, ignoreSigint) {
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
if (!processExists(parentPid)) {
|
if (!processExists(parentPid)) {
|
||||||
// Can't log anything at this point, because out stdout was connected to the parent,
|
// Can't log anything at this point, because out stdout was connected to the parent,
|
||||||
|
|
@ -318,9 +335,9 @@ function exitWhenParentExits(parentPid, ignoreSigint) {
|
||||||
console.log('Received SIGINT. Waiting for .NET process to exit...');
|
console.log('Received SIGINT. Waiting for .NET process to exit...');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.exitWhenParentExits = exitWhenParentExits;
|
exports.exitWhenParentExits = exitWhenParentExits;
|
||||||
function processExists(pid) {
|
function processExists(pid) {
|
||||||
try {
|
try {
|
||||||
// Sending signal 0 - on all platforms - tests whether the process exists. As long as it doesn't
|
// Sending signal 0 - on all platforms - tests whether the process exists. As long as it doesn't
|
||||||
// throw, that means it does exist.
|
// throw, that means it does exist.
|
||||||
|
|
@ -335,27 +352,28 @@ function processExists(pid) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 8 */
|
/* 8 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
exports.__esModule = true;
|
exports.__esModule = true;
|
||||||
var events_1 = __webpack_require__(9);
|
var events_1 = __webpack_require__(9);
|
||||||
var VirtualConnection_1 = __webpack_require__(10);
|
var VirtualConnection_1 = __webpack_require__(10);
|
||||||
// Keep this in sync with the equivalent constant in the .NET code. Both sides split up their transmissions into frames with this max length,
|
// Keep this in sync with the equivalent constant in the .NET code. Both sides split up their transmissions into frames with this max length,
|
||||||
// and both will reject longer frames.
|
// and both will reject longer frames.
|
||||||
var MaxFrameBodyLength = 16 * 1024;
|
var MaxFrameBodyLength = 16 * 1024;
|
||||||
/**
|
/**
|
||||||
* Accepts connections to a net.Server and adapts them to behave as multiplexed connections. That is, for each physical socket connection,
|
* Accepts connections to a net.Server and adapts them to behave as multiplexed connections. That is, for each physical socket connection,
|
||||||
* we track a list of 'virtual connections' whose API is a Duplex stream. The remote clients may open and close as many virtual connections
|
* we track a list of 'virtual connections' whose API is a Duplex stream. The remote clients may open and close as many virtual connections
|
||||||
* as they wish, reading and writing to them independently, without the overhead of establishing new physical connections each time.
|
* as they wish, reading and writing to them independently, without the overhead of establishing new physical connections each time.
|
||||||
*/
|
*/
|
||||||
function createInterface(server) {
|
function createInterface(server) {
|
||||||
var emitter = new events_1.EventEmitter();
|
var emitter = new events_1.EventEmitter();
|
||||||
server.on('connection', function (socket) {
|
server.on('connection', function (socket) {
|
||||||
// For each physical socket connection, maintain a set of virtual connections. Issue a notification whenever
|
// For each physical socket connection, maintain a set of virtual connections. Issue a notification whenever
|
||||||
|
|
@ -365,12 +383,12 @@ function createInterface(server) {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
return emitter;
|
return emitter;
|
||||||
}
|
}
|
||||||
exports.createInterface = createInterface;
|
exports.createInterface = createInterface;
|
||||||
/**
|
/**
|
||||||
* Tracks the 'virtual connections' associated with a single physical socket connection.
|
* Tracks the 'virtual connections' associated with a single physical socket connection.
|
||||||
*/
|
*/
|
||||||
var VirtualConnectionsCollection = /** @class */ (function () {
|
var VirtualConnectionsCollection = /** @class */ (function () {
|
||||||
function VirtualConnectionsCollection(_socket, _onVirtualConnectionCallback) {
|
function VirtualConnectionsCollection(_socket, _onVirtualConnectionCallback) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
this._socket = _socket;
|
this._socket = _socket;
|
||||||
|
|
@ -524,22 +542,24 @@ var VirtualConnectionsCollection = /** @class */ (function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return VirtualConnectionsCollection;
|
return VirtualConnectionsCollection;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 9 */
|
/* 9 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function (module, exports) {
|
||||||
|
|
||||||
module.exports = require("events");
|
module.exports = require("events");
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 10 */
|
/* 10 */
|
||||||
/***/ (function(module, exports, __webpack_require__) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var __extends = (this && this.__extends) || (function () {
|
var __extends = (this && this.__extends) || (function () {
|
||||||
var extendStatics = function (d, b) {
|
var extendStatics = function (d, b) {
|
||||||
extendStatics = Object.setPrototypeOf ||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
|
@ -551,13 +571,13 @@ var __extends = (this && this.__extends) || (function () {
|
||||||
function __() { this.constructor = d; }
|
function __() { this.constructor = d; }
|
||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
exports.__esModule = true;
|
exports.__esModule = true;
|
||||||
var stream_1 = __webpack_require__(11);
|
var stream_1 = __webpack_require__(11);
|
||||||
/**
|
/**
|
||||||
* Represents a virtual connection. Multiple virtual connections may be multiplexed over a single physical socket connection.
|
* Represents a virtual connection. Multiple virtual connections may be multiplexed over a single physical socket connection.
|
||||||
*/
|
*/
|
||||||
var VirtualConnection = /** @class */ (function (_super) {
|
var VirtualConnection = /** @class */ (function (_super) {
|
||||||
__extends(VirtualConnection, _super);
|
__extends(VirtualConnection, _super);
|
||||||
function VirtualConnection(_beginWriteCallback) {
|
function VirtualConnection(_beginWriteCallback) {
|
||||||
var _this = _super.call(this) || this;
|
var _this = _super.call(this) || this;
|
||||||
|
|
@ -590,15 +610,17 @@ var VirtualConnection = /** @class */ (function (_super) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return VirtualConnection;
|
return VirtualConnection;
|
||||||
}(stream_1.Duplex));
|
}(stream_1.Duplex));
|
||||||
exports.VirtualConnection = VirtualConnection;
|
exports.VirtualConnection = VirtualConnection;
|
||||||
|
|
||||||
|
|
||||||
/***/ }),
|
/***/
|
||||||
|
}),
|
||||||
/* 11 */
|
/* 11 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function (module, exports) {
|
||||||
|
|
||||||
module.exports = require("stream");
|
module.exports = require("stream");
|
||||||
|
|
||||||
/***/ })
|
/***/
|
||||||
/******/ ])));
|
})
|
||||||
|
/******/])));
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Socket-based RPC for Microsoft.AspNetCore.NodeServices.</Description>
|
<Description>Socket-based RPC for Microsoft.AspNetCore.NodeServices.</Description>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -6,7 +6,7 @@ using Microsoft.AspNetCore.NodeServices.HostingModels;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
using Microsoft.Extensions.Logging.Console;
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.NodeServices
|
namespace Microsoft.AspNetCore.NodeServices
|
||||||
{
|
{
|
||||||
|
|
@ -58,9 +58,7 @@ namespace Microsoft.AspNetCore.NodeServices
|
||||||
var loggerFactory = serviceProvider.GetService<ILoggerFactory>();
|
var loggerFactory = serviceProvider.GetService<ILoggerFactory>();
|
||||||
NodeInstanceOutputLogger = loggerFactory != null
|
NodeInstanceOutputLogger = loggerFactory != null
|
||||||
? loggerFactory.CreateLogger(LogCategoryName)
|
? loggerFactory.CreateLogger(LogCategoryName)
|
||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
: NullLogger.Instance;
|
||||||
: new ConsoleLogger(LogCategoryName, null, false);
|
|
||||||
#pragma warning restore CS0618
|
|
||||||
// By default, we use this package's built-in out-of-process-via-HTTP hosting/transport
|
// By default, we use this package's built-in out-of-process-via-HTTP hosting/transport
|
||||||
this.UseHttpHosting();
|
this.UseHttpHosting();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Description>Invoke Node.js modules at runtime in ASP.NET Core applications.</Description>
|
<Description>Invoke Node.js modules at runtime in ASP.NET Core applications.</Description>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(MicrosoftAspNetCoreHostingAbstractionsPackageVersion)" />
|
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="$(MicrosoftAspNetCoreHostingAbstractionsPackageVersion)" />
|
||||||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="$(MicrosoftExtensionsLoggingConsolePackageVersion)" />
|
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="$(MicrosoftExtensionsLoggingAbstractionsPackageVersion)" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
|
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonPackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,7 @@ This NuGet package provides a fast and robust way to invoke Node.js code from a
|
||||||
|
|
||||||
It is the underlying mechanism supporting the following packages:
|
It is the underlying mechanism supporting the following packages:
|
||||||
|
|
||||||
* [`Microsoft.AspNetCore.SpaServices`](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices) - builds on NodeServices, adding functionality commonly used in Single Page Applications, such as server-side prerendering, webpack middleware, and integration between server-side and client-side routing.
|
* [`Microsoft.AspNetCore.SpaServices`](https://github.com/aspnet/JavaScriptServices/tree/master/src/Microsoft.AspNetCore.SpaServices) - builds on NodeServices, adding functionality commonly used in Single Page Applications, such as server-side prerendering, webpack middleware, and integration between server-side and client-side routing.
|
||||||
* [`Microsoft.AspNetCore.AngularServices`](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.AngularServices) and [`Microsoft.AspNetCore.ReactServices`](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.ReactServices) - these build on `SpaServices`, adding helpers specific to Angular and React, such as cache priming and integrating server-side and client-side validation
|
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
|
|
@ -37,7 +36,7 @@ For .NET Framework apps:
|
||||||
In that case, you don't need to use NodeServices directly (or install it manually). You can either:
|
In that case, you don't need to use NodeServices directly (or install it manually). You can either:
|
||||||
|
|
||||||
* **Recommended:** Use the `aspnetcore-spa` Yeoman generator to get a ready-to-go starting point using your choice of client-side framework. [Instructions here.](http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/)
|
* **Recommended:** Use the `aspnetcore-spa` Yeoman generator to get a ready-to-go starting point using your choice of client-side framework. [Instructions here.](http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/)
|
||||||
* Or set up your ASP.NET Core and client-side Angular/React/KO/etc. app manually, and then use the [`Microsoft.AspNetCore.SpaServices`](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.SpaServices) package to add features like server-side prerendering or Webpack middleware. But really, at least try using the `aspnetcore-spa` generator first.
|
* Or set up your ASP.NET Core and client-side Angular/React/KO/etc. app manually, and then use the [`Microsoft.AspNetCore.SpaServices`](https://github.com/aspnet/JavaScriptServices/tree/master/src/Microsoft.AspNetCore.SpaServices) package to add features like server-side prerendering or Webpack middleware. But really, at least try using the `aspnetcore-spa` generator first.
|
||||||
|
|
||||||
# Simple usage example
|
# Simple usage example
|
||||||
|
|
||||||
|
|
@ -256,7 +255,7 @@ module.exports = function(result, physicalPath, maxWidth, maxHeight) {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
There's a working image resizing example following this approach [here](https://github.com/aspnet/JavaScriptServices/tree/dev/samples/misc/NodeServicesExamples) - see the [C# code](https://github.com/aspnet/JavaScriptServices/blob/dev/samples/misc/NodeServicesExamples/Controllers/ResizeImage.cs) and the [JavaScript code](https://github.com/aspnet/JavaScriptServices/blob/dev/samples/misc/NodeServicesExamples/Node/resizeImage.js).
|
There's a working image resizing example following this approach [here](../../samples/misc/NodeServicesExamples) - see the [C# code](../../samples/misc/NodeServicesExamples/Controllers/ResizeImage.cs) and the [JavaScript code](../../samples/misc/NodeServicesExamples/Node/resizeImage.js).
|
||||||
|
|
||||||
**Parameters**
|
**Parameters**
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<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>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
using Microsoft.AspNetCore.Builder;
|
using Microsoft.AspNetCore.Builder;
|
||||||
using Microsoft.Extensions.DependencyInjection;
|
using Microsoft.Extensions.DependencyInjection;
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using Microsoft.Extensions.Logging.Console;
|
using Microsoft.Extensions.Logging.Abstractions;
|
||||||
|
|
||||||
namespace Microsoft.AspNetCore.SpaServices.Util
|
namespace Microsoft.AspNetCore.SpaServices.Util
|
||||||
{
|
{
|
||||||
|
|
@ -14,13 +14,11 @@ namespace Microsoft.AspNetCore.SpaServices.Util
|
||||||
IApplicationBuilder appBuilder,
|
IApplicationBuilder appBuilder,
|
||||||
string logCategoryName)
|
string logCategoryName)
|
||||||
{
|
{
|
||||||
// If the DI system gives us a logger, use it. Otherwise, set up a default one.
|
// If the DI system gives us a logger, use it. Otherwise, set up a default one
|
||||||
var loggerFactory = appBuilder.ApplicationServices.GetService<ILoggerFactory>();
|
var loggerFactory = appBuilder.ApplicationServices.GetService<ILoggerFactory>();
|
||||||
var logger = loggerFactory != null
|
var logger = loggerFactory != null
|
||||||
? loggerFactory.CreateLogger(logCategoryName)
|
? loggerFactory.CreateLogger(logCategoryName)
|
||||||
#pragma warning disable CS0618 // Type or member is obsolete
|
: NullLogger.Instance;
|
||||||
: new ConsoleLogger(logCategoryName, null, false);
|
|
||||||
#pragma warning restore CS0618
|
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<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>
|
||||||
<TargetFramework>netstandard2.0</TargetFramework>
|
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ This package enables:
|
||||||
* [**Hot module replacement**](#webpack-hot-module-replacement) so that, during development, your code and markup changes will be pushed to your browser and updated in the running application automatically, without even needing to reload the page
|
* [**Hot module replacement**](#webpack-hot-module-replacement) so that, during development, your code and markup changes will be pushed to your browser and updated in the running application automatically, without even needing to reload the page
|
||||||
* [**Routing helpers**](#routing-helper-mapspafallbackroute) for integrating server-side routing with client-side routing
|
* [**Routing helpers**](#routing-helper-mapspafallbackroute) for integrating server-side routing with client-side routing
|
||||||
|
|
||||||
Behind the scenes, it uses the [`Microsoft.AspNetCore.NodeServices`](https://github.com/aspnet/JavaScriptServices/tree/dev/src/Microsoft.AspNetCore.NodeServices) package as a fast and robust way to invoke Node.js-hosted code from ASP.NET Core at runtime.
|
Behind the scenes, it uses the [`Microsoft.AspNetCore.NodeServices`](https://github.com/aspnet/JavaScriptServices/tree/master/src/Microsoft.AspNetCore.NodeServices) package as a fast and robust way to invoke Node.js-hosted code from ASP.NET Core at runtime.
|
||||||
|
|
||||||
### Requirements
|
### Requirements
|
||||||
|
|
||||||
|
|
@ -223,7 +223,7 @@ npm install --save angular2-universal
|
||||||
|
|
||||||
Now you can use the [`angular2-universal` APIs](https://github.com/angular/universal) from your `boot-server.ts` TypeScript module to execute your Angular component on the server. The code needed for this is fairly complex, but that's unavoidable because Angular supports so many different ways of being configured, and you need to provide wiring for whatever combination of DI modules you're using.
|
Now you can use the [`angular2-universal` APIs](https://github.com/angular/universal) from your `boot-server.ts` TypeScript module to execute your Angular component on the server. The code needed for this is fairly complex, but that's unavoidable because Angular supports so many different ways of being configured, and you need to provide wiring for whatever combination of DI modules you're using.
|
||||||
|
|
||||||
You can find an example `boot-server.ts` that renders arbitrary Angular components [here](https://github.com/aspnet/JavaScriptServices/blob/dev/templates/AngularSpa/ClientApp/boot-server.ts). If you use this with your own application, you might need to edit the `serverBindings` array to reference any other DI services that your Angular component depends on.
|
You can find an example `boot-server.ts` that renders arbitrary Angular components [here](../../templates/AngularSpa/ClientApp/boot-server.ts). If you use this with your own application, you might need to edit the `serverBindings` array to reference any other DI services that your Angular component depends on.
|
||||||
|
|
||||||
The easiest way to get started with Angular server-side rendering on ASP.NET Core is to use the [aspnetcore-spa generator](http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/), which creates a ready-made working starting point.
|
The easiest way to get started with Angular server-side rendering on ASP.NET Core is to use the [aspnetcore-spa generator](http://blog.stevensanderson.com/2016/05/02/angular2-react-knockout-apps-on-aspnet-core/), which creates a ready-made working starting point.
|
||||||
|
|
||||||
|
|
@ -299,7 +299,7 @@ If you want to enable server-side prerendering too, follow the same process as d
|
||||||
|
|
||||||
The above example is extremely simple - it doesn't use `react-router`, and it doesn't load any data asynchronously. Real applications are likely to do both of these.
|
The above example is extremely simple - it doesn't use `react-router`, and it doesn't load any data asynchronously. Real applications are likely to do both of these.
|
||||||
|
|
||||||
For an example server-side boot module that knows how to evaluate `react-router` routes and render the correct React component, see [this example](https://github.com/aspnet/JavaScriptServices/blob/dev/templates/ReactReduxSpa/ClientApp/boot-server.tsx).
|
For an example server-side boot module that knows how to evaluate `react-router` routes and render the correct React component, see [this example](../../templates/ReactReduxSpa/ClientApp/boot-server.tsx).
|
||||||
|
|
||||||
Supporting asynchronous data loading involves more considerations. Unlike Angular applications that run asynchronously on the server and freely overwrite server-generated markup with client-generated markup, React strictly wants to run synchronously on the server and always produce the same markup on the server as it does on the client.
|
Supporting asynchronous data loading involves more considerations. Unlike Angular applications that run asynchronously on the server and freely overwrite server-generated markup with client-generated markup, React strictly wants to run synchronously on the server and always produce the same markup on the server as it does on the client.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ using Microsoft.AspNetCore.Http;
|
||||||
namespace Microsoft.AspNetCore.SpaServices.Webpack
|
namespace Microsoft.AspNetCore.SpaServices.Webpack
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Based on https://github.com/aspnet/Proxy/blob/dev/src/Microsoft.AspNetCore.Proxy/ProxyMiddleware.cs
|
/// Based on ProxyMiddleware from https://github.com/aspnet/Proxy/.
|
||||||
/// Differs in that, if the proxied request returns a 404, we pass through to the next middleware in the chain
|
/// Differs in that, if the proxied request returns a 404, we pass through to the next middleware in the chain
|
||||||
/// 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).
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "aspnet-webpack-react",
|
"name": "aspnet-webpack-react",
|
||||||
"version": "3.0.0",
|
"version": "4.0.0",
|
||||||
"description": "Helpers for using Webpack with React in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",
|
"description": "Helpers for using Webpack with React in ASP.NET Core projects. Works in conjunction with the Microsoft.AspNetCore.SpaServices NuGet package.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
@ -17,12 +17,12 @@
|
||||||
"url": "https://github.com/aspnet/JavaScriptServices.git"
|
"url": "https://github.com/aspnet/JavaScriptServices.git"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/webpack": "^2.2.0",
|
"@types/webpack": "^4.4.0",
|
||||||
"rimraf": "^2.5.4",
|
"rimraf": "^2.5.4",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^2.0.0",
|
||||||
"webpack": "^2.2.0"
|
"webpack": "^4.16.0"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"webpack": "^2.2.0"
|
"webpack": "^4.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,9 @@
|
||||||
import * as webpack from 'webpack';
|
import * as webpack from 'webpack';
|
||||||
|
|
||||||
const reactHotLoaderWebpackLoader = 'react-hot-loader/webpack';
|
|
||||||
const reactHotLoaderPatch = 'react-hot-loader/patch';
|
|
||||||
const supportedTypeScriptLoaders = ['ts-loader', 'awesome-typescript-loader'];
|
const supportedTypeScriptLoaders = ['ts-loader', 'awesome-typescript-loader'];
|
||||||
|
|
||||||
export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Configuration) {
|
export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Configuration) {
|
||||||
const moduleConfig = webpackConfig.module as webpack.NewModule;
|
const moduleConfig = webpackConfig.module as webpack.Module;
|
||||||
const moduleRules = moduleConfig.rules;
|
const moduleRules = moduleConfig.rules;
|
||||||
if (!moduleRules) {
|
if (!moduleRules) {
|
||||||
return; // Unknown rules list format. Might be Webpack 1.x, which is not supported.
|
return; // Unknown rules list format. Might be Webpack 1.x, which is not supported.
|
||||||
|
|
@ -15,24 +13,18 @@ export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Config
|
||||||
// to its array of loaders
|
// to its array of loaders
|
||||||
for (let ruleIndex = 0; ruleIndex < moduleRules.length; ruleIndex++) {
|
for (let ruleIndex = 0; ruleIndex < moduleRules.length; ruleIndex++) {
|
||||||
// We only support NewUseRule (i.e., { use: ... }) because OldUseRule doesn't accept array values
|
// We only support NewUseRule (i.e., { use: ... }) because OldUseRule doesn't accept array values
|
||||||
const rule = moduleRules[ruleIndex] as webpack.NewUseRule;
|
const rule = moduleRules[ruleIndex] as webpack.RuleSetRule;
|
||||||
if (!rule.use) {
|
if (!rule.use) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We're looking for the first 'use' value that's a TypeScript loader
|
// We're looking for the first 'use' value that's a TypeScript loader
|
||||||
const loadersArray = rule.use instanceof Array ? rule.use : [rule.use];
|
const loadersArray: webpack.RuleSetUseItem[] = rule.use instanceof Array ? rule.use : [rule.use as webpack.RuleSetUseItem];
|
||||||
const isTypescriptLoader = supportedTypeScriptLoaders.some(typeScriptLoaderName => containsLoader(loadersArray, typeScriptLoaderName));
|
const isTypescriptLoader = supportedTypeScriptLoaders.some(typeScriptLoaderName => containsLoader(loadersArray, typeScriptLoaderName));
|
||||||
if (!isTypescriptLoader) {
|
if (!isTypescriptLoader) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is the one - prefix it with the react-hot-loader loader
|
|
||||||
// (unless it's already in there somewhere)
|
|
||||||
if (!containsLoader(loadersArray, reactHotLoaderWebpackLoader)) {
|
|
||||||
loadersArray.unshift(reactHotLoaderWebpackLoader);
|
|
||||||
rule.use = loadersArray; // In case we normalised it to an array
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -48,19 +40,14 @@ export function addReactHotModuleReplacementConfig(webpackConfig: webpack.Config
|
||||||
// Normalise to array
|
// Normalise to array
|
||||||
entryConfig[entrypointName] = [entryConfig[entrypointName] as string];
|
entryConfig[entrypointName] = [entryConfig[entrypointName] as string];
|
||||||
}
|
}
|
||||||
|
|
||||||
let entryValueArray = entryConfig[entrypointName] as string[];
|
|
||||||
if (entryValueArray.indexOf(reactHotLoaderPatch) < 0) {
|
|
||||||
entryValueArray.unshift(reactHotLoaderPatch);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function containsLoader(loadersArray: webpack.Loader[], loaderName: string) {
|
function containsLoader(loadersArray: webpack.RuleSetUseItem[], loaderName: string) {
|
||||||
return loadersArray.some(loader => {
|
return loadersArray.some(loader => {
|
||||||
// Allow 'use' values to be either { loader: 'name' } or 'name'
|
// Allow 'use' values to be either { loader: 'name' } or 'name'
|
||||||
// No need to support legacy webpack.OldLoader
|
// No need to support legacy webpack.OldLoader
|
||||||
const actualLoaderName = (loader as webpack.NewLoader).loader || (loader as string);
|
const actualLoaderName = (loader as webpack.RuleSetLoader).loader || (loader as string);
|
||||||
return actualLoaderName && new RegExp(`\\b${ loaderName }\\b`).test(actualLoaderName);
|
return actualLoaderName && new RegExp(`\\b${ loaderName }\\b`).test(actualLoaderName);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>2.2.0</VersionPrefix>
|
<VersionPrefix>3.0.0</VersionPrefix>
|
||||||
<VersionSuffix>rtm</VersionSuffix>
|
<VersionSuffix>alpha1</VersionSuffix>
|
||||||
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' == 'rtm' ">$(VersionPrefix)</PackageVersion>
|
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' == 'rtm' ">$(VersionPrefix)</PackageVersion>
|
||||||
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' != 'rtm' ">$(VersionPrefix)-$(VersionSuffix)-final</PackageVersion>
|
<PackageVersion Condition="'$(IsFinalBuild)' == 'true' AND '$(VersionSuffix)' != 'rtm' ">$(VersionPrefix)-$(VersionSuffix)-final</PackageVersion>
|
||||||
<BuildNumber Condition="'$(BuildNumber)' == ''">t000</BuildNumber>
|
<BuildNumber Condition="'$(BuildNumber)' == ''">t000</BuildNumber>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue