mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 18:19:40 +00:00
Compare commits
45 Commits
2.2.0-prev
...
pakrym/no-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
366d65a614 | ||
|
|
8027397d67 | ||
|
|
f024e779a6 | ||
|
|
7819c2f950 | ||
|
|
f47c5901b6 | ||
|
|
cdfa5d85f6 | ||
|
|
3265b92086 | ||
|
|
9c6a1b577f | ||
|
|
25e9c50585 | ||
|
|
ef999a57fd | ||
|
|
0050b505ec | ||
|
|
e231b29e58 | ||
|
|
ec82df4287 | ||
|
|
e9621c8add | ||
|
|
59ca023f46 | ||
|
|
d8662392a0 | ||
|
|
78a8bbf783 | ||
|
|
587ead92e4 | ||
|
|
28798452a9 | ||
|
|
622be9084a | ||
|
|
cd009006c8 | ||
|
|
817c0e4f24 | ||
|
|
f0e66325c3 | ||
|
|
c2f15f4199 | ||
|
|
cfd3a19279 | ||
|
|
24ebd9ff3e | ||
|
|
a4be7b3898 | ||
|
|
ae7b7c2663 | ||
|
|
e47f15fdc8 | ||
|
|
bc50741043 | ||
|
|
1af86b7ba8 | ||
|
|
97022a1ff2 | ||
|
|
040a58578c | ||
|
|
02383cd614 | ||
|
|
df85010938 | ||
|
|
4763ad5b8c | ||
|
|
dd9957bc39 | ||
|
|
601909865f | ||
|
|
d9d4359a1e | ||
|
|
5f44de86f6 | ||
|
|
0dc570a0c8 | ||
|
|
b1d04c99c9 | ||
|
|
d742bea01e | ||
|
|
7a04134345 | ||
|
|
c177cc001c |
@@ -4,7 +4,7 @@ install:
|
|||||||
- ps: Install-Product node 6.9.2 x64
|
- ps: Install-Product node 6.9.2 x64
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- dev
|
- master
|
||||||
- /^release\/.*$/
|
- /^release\/.*$/
|
||||||
- /^(.*\/)?ci-.*$/
|
- /^(.*\/)?ci-.*$/
|
||||||
build_script:
|
build_script:
|
||||||
|
|||||||
@@ -19,6 +19,6 @@ script:
|
|||||||
- ./build.sh
|
- ./build.sh
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
- dev
|
- master
|
||||||
- /^release\/.*$/
|
- /^release\/.*$/
|
||||||
- /^(.*\/)?ci-.*$/
|
- /^(.*\/)?ci-.*$/
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ resources:
|
|||||||
- repository: buildtools
|
- repository: buildtools
|
||||||
type: git
|
type: git
|
||||||
name: aspnet-BuildTools
|
name: aspnet-BuildTools
|
||||||
ref: refs/heads/release/2.2
|
ref: refs/heads/master
|
||||||
|
|
||||||
phases:
|
phases:
|
||||||
- template: .vsts-pipelines/templates/project-ci.yml@buildtools
|
- template: .vsts-pipelines/templates/project-ci.yml@buildtools
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ resources:
|
|||||||
type: github
|
type: github
|
||||||
endpoint: DotNet-Bot GitHub Connection
|
endpoint: DotNet-Bot GitHub Connection
|
||||||
name: aspnet/BuildTools
|
name: aspnet/BuildTools
|
||||||
ref: refs/heads/release/2.2
|
ref: refs/heads/master
|
||||||
|
|
||||||
phases:
|
phases:
|
||||||
- template: .vsts-pipelines/templates/project-ci.yml@buildtools
|
- template: .vsts-pipelines/templates/project-ci.yml@buildtools
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
Contributing
|
Contributing
|
||||||
======
|
======
|
||||||
|
|
||||||
Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/dev/CONTRIBUTING.md) in the Home repo.
|
Information on contributing to this repo is in the [Contributing Guide](https://github.com/aspnet/Home/blob/master/CONTRIBUTING.md) in the Home repo.
|
||||||
|
|||||||
@@ -10,9 +10,6 @@
|
|||||||
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
|
<RepositoryRoot>$(MSBuildThisFileDirectory)</RepositoryRoot>
|
||||||
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
|
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)build\Key.snk</AssemblyOriginatorKeyFile>
|
||||||
<SignAssembly>true</SignAssembly>
|
<SignAssembly>true</SignAssembly>
|
||||||
<AssemblySigningCertName>Microsoft</AssemblySigningCertName>
|
|
||||||
<PackageSigningCertName>MicrosoftNuGet</PackageSigningCertName>
|
|
||||||
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
|
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,8 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">$(MicrosoftNETCoreApp20PackageVersion)</RuntimeFrameworkVersion>
|
||||||
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">$(MicrosoftNETCoreApp21PackageVersion)</RuntimeFrameworkVersion>
|
<RuntimeFrameworkVersion Condition=" '$(TargetFramework)' == 'netcoreapp3.0' ">$(MicrosoftNETCoreApp30PackageVersion)</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 -->
|
<!-- aspnet/BuildTools#662 Don't police what version of NetCoreApp we use -->
|
||||||
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
|
<NETCoreAppMaximumVersion>99.9</NETCoreAppMaximumVersion>
|
||||||
|
|||||||
205
LICENSE.txt
205
LICENSE.txt
@@ -1,14 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
Copyright (c) .NET Foundation and Contributors
|
Copyright (c) .NET Foundation and Contributors
|
||||||
|
|
||||||
All rights reserved.
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
You may obtain a copy of the License at
|
||||||
this file except in compliance with the License. You may obtain a copy of the
|
|
||||||
License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software distributed
|
Unless required by applicable law or agreed to in writing, software
|
||||||
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
specific language governing permissions and limitations under the License.
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
|
|||||||
16
README.md
16
README.md
@@ -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,27 +3,28 @@
|
|||||||
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Label="Package Versions">
|
<PropertyGroup Label="Package Versions">
|
||||||
<InternalAspNetCoreSdkPackageVersion>2.2.0-preview1-20180821.1</InternalAspNetCoreSdkPackageVersion>
|
<InternalAspNetCoreSdkPackageVersion>3.0.0-alpha1-20181031.6</InternalAspNetCoreSdkPackageVersion>
|
||||||
<MicrosoftAspNetCoreDiagnosticsPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreDiagnosticsPackageVersion>
|
<MicrosoftAspNetCoreDiagnosticsPackageVersion>3.0.0-alpha1-10670</MicrosoftAspNetCoreDiagnosticsPackageVersion>
|
||||||
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
<MicrosoftAspNetCoreHostingAbstractionsPackageVersion>3.0.0-alpha1-10670</MicrosoftAspNetCoreHostingAbstractionsPackageVersion>
|
||||||
<MicrosoftAspNetCoreHostingPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreHostingPackageVersion>
|
<MicrosoftAspNetCoreHostingPackageVersion>3.0.0-alpha1-10670</MicrosoftAspNetCoreHostingPackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreMvcPackageVersion>
|
<MicrosoftAspNetCoreMvcPackageVersion>3.0.0-a-alpha1-react-razor-design-19157</MicrosoftAspNetCoreMvcPackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcTagHelpersPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreMvcTagHelpersPackageVersion>
|
<MicrosoftAspNetCoreMvcTagHelpersPackageVersion>3.0.0-a-alpha1-react-razor-design-19157</MicrosoftAspNetCoreMvcTagHelpersPackageVersion>
|
||||||
<MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>
|
<MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>3.0.0-a-alpha1-react-razor-design-19157</MicrosoftAspNetCoreMvcViewFeaturesPackageVersion>
|
||||||
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
<MicrosoftAspNetCoreServerIISIntegrationPackageVersion>2.2.0-rtm-10670</MicrosoftAspNetCoreServerIISIntegrationPackageVersion>
|
||||||
<MicrosoftAspNetCoreServerKestrelPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
<MicrosoftAspNetCoreServerKestrelPackageVersion>3.0.0-alpha1-10670</MicrosoftAspNetCoreServerKestrelPackageVersion>
|
||||||
<MicrosoftAspNetCoreStaticFilesPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
<MicrosoftAspNetCoreStaticFilesPackageVersion>3.0.0-alpha1-10670</MicrosoftAspNetCoreStaticFilesPackageVersion>
|
||||||
<MicrosoftAspNetCoreWebSocketsPackageVersion>2.2.0-preview2-35143</MicrosoftAspNetCoreWebSocketsPackageVersion>
|
<MicrosoftAspNetCoreWebSocketsPackageVersion>3.0.0-alpha1-10670</MicrosoftAspNetCoreWebSocketsPackageVersion>
|
||||||
<MicrosoftExtensionsDependencyInjectionPackageVersion>2.2.0-preview2-35143</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
<MicrosoftExtensionsDependencyInjectionPackageVersion>3.0.0-alpha1-10670</MicrosoftExtensionsDependencyInjectionPackageVersion>
|
||||||
<MicrosoftExtensionsFileProvidersPhysicalPackageVersion>2.2.0-preview2-35143</MicrosoftExtensionsFileProvidersPhysicalPackageVersion>
|
<MicrosoftExtensionsFileProvidersPhysicalPackageVersion>3.0.0-alpha1-10670</MicrosoftExtensionsFileProvidersPhysicalPackageVersion>
|
||||||
<MicrosoftExtensionsLoggingConsolePackageVersion>2.2.0-preview2-35143</MicrosoftExtensionsLoggingConsolePackageVersion>
|
<MicrosoftExtensionsLoggingAbstractionsPackageVersion>3.0.0-alpha1-10670</MicrosoftExtensionsLoggingAbstractionsPackageVersion>
|
||||||
<MicrosoftExtensionsLoggingDebugPackageVersion>2.2.0-preview2-35143</MicrosoftExtensionsLoggingDebugPackageVersion>
|
<MicrosoftExtensionsLoggingConsolePackageVersion>3.0.0-alpha1-10670</MicrosoftExtensionsLoggingConsolePackageVersion>
|
||||||
|
<MicrosoftExtensionsLoggingDebugPackageVersion>3.0.0-alpha1-10670</MicrosoftExtensionsLoggingDebugPackageVersion>
|
||||||
<MicrosoftNETCoreApp20PackageVersion>2.0.9</MicrosoftNETCoreApp20PackageVersion>
|
<MicrosoftNETCoreApp20PackageVersion>2.0.9</MicrosoftNETCoreApp20PackageVersion>
|
||||||
<MicrosoftNETCoreApp21PackageVersion>2.1.2</MicrosoftNETCoreApp21PackageVersion>
|
<MicrosoftNETCoreApp30PackageVersion>3.0.0-preview1-26907-05</MicrosoftNETCoreApp30PackageVersion>
|
||||||
<MicrosoftNETCoreApp22PackageVersion>2.2.0-preview1-26618-02</MicrosoftNETCoreApp22PackageVersion>
|
<MicrosoftNETSdkRazorPackageVersion>3.0.0-a-alpha1-sdk-31823</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,11 @@
|
|||||||
<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="$(MicrosoftNETCoreApp20PackageVersion)" />
|
||||||
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp21PackageVersion)" />
|
|
||||||
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp22PackageVersion)" />
|
<DotNetCoreRuntime Include="$(MicrosoftNETCoreApp22PackageVersion)" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
version:2.2.0-preview1-20180821.1
|
version:3.0.0-alpha1-20181031.6
|
||||||
commithash:c8d0cc52cd1abb697be24e288ffd54f8fae8bf17
|
commithash:dc9e2ae2d294184c7c7da383e62c7c400099d1d0
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/release/2.2/tools/korebuild.schema.json",
|
"$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json",
|
||||||
"channel": "release/2.2",
|
"channel": "master",
|
||||||
"toolsets": {
|
"toolsets": {
|
||||||
"nodejs": {
|
"nodejs": {
|
||||||
"required": true,
|
"required": true,
|
||||||
|
|||||||
6
run.ps1
6
run.ps1
@@ -52,8 +52,8 @@ in the file are overridden by command line parameters.
|
|||||||
Example config file:
|
Example config file:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/dev/tools/korebuild.schema.json",
|
"$schema": "https://raw.githubusercontent.com/aspnet/BuildTools/master/tools/korebuild.schema.json",
|
||||||
"channel": "dev",
|
"channel": "master",
|
||||||
"toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools"
|
"toolsSource": "https://aspnetcore.blob.core.windows.net/buildtools"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -192,7 +192,7 @@ if (!$DotNetHome) {
|
|||||||
else { Join-Path $PSScriptRoot '.dotnet'}
|
else { Join-Path $PSScriptRoot '.dotnet'}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$Channel) { $Channel = 'dev' }
|
if (!$Channel) { $Channel = 'master' }
|
||||||
if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' }
|
if (!$ToolsSource) { $ToolsSource = 'https://aspnetcore.blob.core.windows.net/buildtools' }
|
||||||
|
|
||||||
# Execute
|
# Execute
|
||||||
|
|||||||
10
run.sh
10
run.sh
@@ -220,7 +220,7 @@ if [ -f "$config_file" ]; then
|
|||||||
config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")"
|
config_channel="$(jq -r 'select(.channel!=null) | .channel' "$config_file")"
|
||||||
config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")"
|
config_tools_source="$(jq -r 'select(.toolsSource!=null) | .toolsSource' "$config_file")"
|
||||||
else
|
else
|
||||||
_error "$config_file contains invalid JSON."
|
__error "$config_file contains invalid JSON."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif __machine_has python ; then
|
elif __machine_has python ; then
|
||||||
@@ -228,7 +228,7 @@ if [ -f "$config_file" ]; then
|
|||||||
config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
|
config_channel="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
|
||||||
config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
|
config_tools_source="$(python -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
|
||||||
else
|
else
|
||||||
_error "$config_file contains invalid JSON."
|
__error "$config_file contains invalid JSON."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif __machine_has python3 ; then
|
elif __machine_has python3 ; then
|
||||||
@@ -236,11 +236,11 @@ if [ -f "$config_file" ]; then
|
|||||||
config_channel="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
|
config_channel="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['channel'] if 'channel' in obj else '')")"
|
||||||
config_tools_source="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
|
config_tools_source="$(python3 -c "import json,codecs;obj=json.load(codecs.open('$config_file', 'r', 'utf-8-sig'));print(obj['toolsSource'] if 'toolsSource' in obj else '')")"
|
||||||
else
|
else
|
||||||
_error "$config_file contains invalid JSON."
|
__error "$config_file contains invalid JSON."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
_error 'Missing required command: jq or python. Could not parse the JSON file.'
|
__error 'Missing required command: jq or python. Could not parse the JSON file.'
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -248,7 +248,7 @@ if [ -f "$config_file" ]; then
|
|||||||
[ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source"
|
[ ! -z "${config_tools_source:-}" ] && tools_source="$config_tools_source"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ -z "$channel" ] && channel='dev'
|
[ -z "$channel" ] && channel='master'
|
||||||
[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
|
[ -z "$tools_source" ] && tools_source='https://aspnetcore.blob.core.windows.net/buildtools'
|
||||||
|
|
||||||
get_korebuild
|
get_korebuild
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
|
||||||
<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>
|
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -18,6 +18,8 @@
|
|||||||
<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" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>netcoreapp2.2;net461</TargetFrameworks>
|
<TargetFrameworks>netcoreapp3.0;net461</TargetFrameworks>
|
||||||
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
<TypeScriptCompileBlocked>true</TypeScriptCompileBlocked>
|
||||||
<IsPackable>false</IsPackable>
|
<IsPackable>false</IsPackable>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -18,6 +18,8 @@
|
|||||||
<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" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
|
||||||
|
|||||||
28
scripts/Regenerate-JSFiles.ps1
Normal file
28
scripts/Regenerate-JSFiles.ps1
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
[cmdletbinding(SupportsShouldProcess = $true)]
|
||||||
|
param(
|
||||||
|
)
|
||||||
|
|
||||||
|
$ErrorActionPreference = 'Stop'
|
||||||
|
Set-StrictMode -Version 2
|
||||||
|
|
||||||
|
Push-Location "src"
|
||||||
|
try {
|
||||||
|
$dirs = Get-ChildItem -Directory
|
||||||
|
foreach($dir in $dirs)
|
||||||
|
{
|
||||||
|
Push-Location $dir
|
||||||
|
try{
|
||||||
|
if(Test-Path -Path "package.json")
|
||||||
|
{
|
||||||
|
npm install
|
||||||
|
npm run build
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally{
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
Pop-Location
|
||||||
|
}
|
||||||
@@ -1,57 +1,114 @@
|
|||||||
(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 = {};
|
||||||
|
/******/
|
||||||
/******/ // The require function
|
/******/ // The require function
|
||||||
/******/ 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] = {
|
||||||
/******/ exports: {},
|
/******/ i: moduleId,
|
||||||
/******/ id: moduleId,
|
/******/ l: false,
|
||||||
/******/ loaded: false
|
/******/ 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__);
|
||||||
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.loaded = true;
|
/******/ module.l = true;
|
||||||
|
/******/
|
||||||
/******/ // 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__)
|
||||||
/******/ __webpack_require__.m = modules;
|
/******/ __webpack_require__.m = modules;
|
||||||
|
/******/
|
||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
|
/******/
|
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function (exports, name, getter) {
|
||||||
|
/******/ if (!__webpack_require__.o(exports, name)) {
|
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
|
/******/
|
||||||
|
}
|
||||||
|
/******/
|
||||||
|
};
|
||||||
|
/******/
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function (exports) {
|
||||||
|
/******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/
|
||||||
|
}
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/
|
||||||
|
};
|
||||||
|
/******/
|
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function (value, mode) {
|
||||||
|
/******/ if (mode & 1) value = __webpack_require__(value);
|
||||||
|
/******/ if (mode & 8) return value;
|
||||||
|
/******/ if ((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
|
/******/ var ns = Object.create(null);
|
||||||
|
/******/ __webpack_require__.r(ns);
|
||||||
|
/******/ 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));
|
||||||
|
/******/ return ns;
|
||||||
|
/******/
|
||||||
|
};
|
||||||
|
/******/
|
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function (module) {
|
||||||
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
/******/ function getDefault() { return module['default']; } :
|
||||||
|
/******/ function getModuleExports() { return module; };
|
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
|
/******/ return getter;
|
||||||
|
/******/
|
||||||
|
};
|
||||||
|
/******/
|
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __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 = "";
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(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;
|
||||||
// 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);
|
||||||
@@ -115,12 +172,13 @@
|
|||||||
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));
|
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
|
||||||
@@ -159,29 +217,35 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/
|
||||||
|
}),
|
||||||
/* 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) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -203,9 +267,12 @@
|
|||||||
exports.parseArgs = parseArgs;
|
exports.parseArgs = parseArgs;
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/
|
||||||
|
}),
|
||||||
/* 7 */
|
/* 7 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"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,
|
||||||
@@ -240,9 +307,9 @@
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
"use strict";
|
exports.__esModule = true;
|
||||||
var pollIntervalMs = 1000;
|
var pollIntervalMs = 1000;
|
||||||
function exitWhenParentExits(parentPid) {
|
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,
|
||||||
@@ -250,6 +317,24 @@
|
|||||||
process.exit();
|
process.exit();
|
||||||
}
|
}
|
||||||
}, pollIntervalMs);
|
}, pollIntervalMs);
|
||||||
|
if (ignoreSigint) {
|
||||||
|
// Pressing ctrl+c in the terminal sends a SIGINT to all processes in the foreground process tree.
|
||||||
|
// By default, the Node process would then exit before the .NET process, because ASP.NET implements
|
||||||
|
// a delayed shutdown to allow ongoing requests to complete.
|
||||||
|
//
|
||||||
|
// This is problematic, because if Node exits first, the CopyToAsync code in ConditionalProxyMiddleware
|
||||||
|
// will experience a read fault, and logs a huge load of errors. Fortunately, since the Node process is
|
||||||
|
// already set up to shut itself down if it detects the .NET process is terminated, all we have to do is
|
||||||
|
// ignore the SIGINT. The Node process will then terminate automatically after the .NET process does.
|
||||||
|
//
|
||||||
|
// A better solution would be to have WebpackDevMiddleware listen for SIGINT and gracefully close any
|
||||||
|
// ongoing EventSource connections before letting the Node process exit, independently of the .NET
|
||||||
|
// process exiting. However, doing this well in general is very nontrivial (see all the discussion at
|
||||||
|
// https://github.com/nodejs/node/issues/2642).
|
||||||
|
process.on('SIGINT', function () {
|
||||||
|
console.log('Received SIGINT. Waiting for .NET process to exit...');
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
exports.exitWhenParentExits = exitWhenParentExits;
|
exports.exitWhenParentExits = exitWhenParentExits;
|
||||||
function processExists(pid) {
|
function processExists(pid) {
|
||||||
@@ -270,11 +355,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/
|
||||||
|
}),
|
||||||
/* 8 */
|
/* 8 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function (module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
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,
|
||||||
@@ -300,7 +388,7 @@
|
|||||||
/**
|
/**
|
||||||
* Tracks the 'virtual connections' associated with a single physical socket connection.
|
* Tracks the 'virtual connections' associated with a single physical socket connection.
|
||||||
*/
|
*/
|
||||||
var VirtualConnectionsCollection = (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;
|
||||||
@@ -382,7 +470,7 @@
|
|||||||
newVirtualConnection.on('finish', function () {
|
newVirtualConnection.on('finish', function () {
|
||||||
// The virtual connection was closed locally. Clean up locally, and notify the remote that we're done.
|
// The virtual connection was closed locally. Clean up locally, and notify the remote that we're done.
|
||||||
_this._onVirtualConnectionWasClosed(header.connectionIdString);
|
_this._onVirtualConnectionWasClosed(header.connectionIdString);
|
||||||
_this._sendFrame(header.connectionIdBinary, new Buffer(0));
|
_this._sendFrame(header.connectionIdBinary, Buffer.alloc(0));
|
||||||
});
|
});
|
||||||
this._virtualConnections[header.connectionIdString] = newVirtualConnection;
|
this._virtualConnections[header.connectionIdString] = newVirtualConnection;
|
||||||
this._onVirtualConnectionCallback(newVirtualConnection);
|
this._onVirtualConnectionCallback(newVirtualConnection);
|
||||||
@@ -444,7 +532,7 @@
|
|||||||
* Sends a number serialized in the correct format for .NET to receive as a System.Int32
|
* Sends a number serialized in the correct format for .NET to receive as a System.Int32
|
||||||
*/
|
*/
|
||||||
VirtualConnectionsCollection.prototype._sendInt32LE = function (value, callback) {
|
VirtualConnectionsCollection.prototype._sendInt32LE = function (value, callback) {
|
||||||
var buf = new Buffer(4);
|
var buf = Buffer.alloc(4);
|
||||||
buf.writeInt32LE(value, 0);
|
buf.writeInt32LE(value, 0);
|
||||||
this._socket.write(buf, callback);
|
this._socket.write(buf, callback);
|
||||||
};
|
};
|
||||||
@@ -457,27 +545,39 @@
|
|||||||
}());
|
}());
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/
|
||||||
|
}),
|
||||||
/* 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 (d, b) {
|
|
||||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
var __extends = (this && this.__extends) || (function () {
|
||||||
|
var extendStatics = function (d, b) {
|
||||||
|
extendStatics = Object.setPrototypeOf ||
|
||||||
|
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||||
|
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||||
|
return extendStatics(d, b);
|
||||||
|
}
|
||||||
|
return function (d, b) {
|
||||||
|
extendStatics(d, b);
|
||||||
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;
|
||||||
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 = (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;
|
||||||
@@ -497,7 +597,7 @@
|
|||||||
};
|
};
|
||||||
VirtualConnection.prototype._write = function (chunk, encodingIfString, callback) {
|
VirtualConnection.prototype._write = function (chunk, encodingIfString, callback) {
|
||||||
if (typeof chunk === 'string') {
|
if (typeof chunk === 'string') {
|
||||||
chunk = new Buffer(chunk, encodingIfString);
|
chunk = Buffer.from(chunk, encodingIfString);
|
||||||
}
|
}
|
||||||
this._beginWriteCallback(chunk, callback);
|
this._beginWriteCallback(chunk, callback);
|
||||||
};
|
};
|
||||||
@@ -514,11 +614,13 @@
|
|||||||
exports.VirtualConnection = VirtualConnection;
|
exports.VirtualConnection = VirtualConnection;
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/
|
||||||
|
}),
|
||||||
/* 11 */
|
/* 11 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function (module, exports) {
|
||||||
|
|
||||||
module.exports = require("stream");
|
module.exports = require("stream");
|
||||||
|
|
||||||
/***/ }
|
/***/
|
||||||
|
})
|
||||||
/******/])));
|
/******/])));
|
||||||
@@ -27,7 +27,7 @@ export class VirtualConnection extends Duplex {
|
|||||||
|
|
||||||
public _write(chunk: Buffer | string, encodingIfString: string, callback: EndWriteCallback) {
|
public _write(chunk: Buffer | string, encodingIfString: string, callback: EndWriteCallback) {
|
||||||
if (typeof chunk === 'string') {
|
if (typeof chunk === 'string') {
|
||||||
chunk = new Buffer(chunk as string, encodingIfString);
|
chunk = Buffer.from(chunk as string, encodingIfString);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._beginWriteCallback(chunk as Buffer, callback);
|
this._beginWriteCallback(chunk as Buffer, callback);
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ class VirtualConnectionsCollection {
|
|||||||
newVirtualConnection.on('finish', () => {
|
newVirtualConnection.on('finish', () => {
|
||||||
// The virtual connection was closed locally. Clean up locally, and notify the remote that we're done.
|
// The virtual connection was closed locally. Clean up locally, and notify the remote that we're done.
|
||||||
this._onVirtualConnectionWasClosed(header.connectionIdString);
|
this._onVirtualConnectionWasClosed(header.connectionIdString);
|
||||||
this._sendFrame(header.connectionIdBinary, new Buffer(0));
|
this._sendFrame(header.connectionIdBinary, Buffer.alloc(0));
|
||||||
});
|
});
|
||||||
|
|
||||||
this._virtualConnections[header.connectionIdString] = newVirtualConnection;
|
this._virtualConnections[header.connectionIdString] = newVirtualConnection;
|
||||||
@@ -180,7 +180,7 @@ class VirtualConnectionsCollection {
|
|||||||
* Sends a number serialized in the correct format for .NET to receive as a System.Int32
|
* Sends a number serialized in the correct format for .NET to receive as a System.Int32
|
||||||
*/
|
*/
|
||||||
private _sendInt32LE(value: number, callback?: EndWriteCallback) {
|
private _sendInt32LE(value: number, callback?: EndWriteCallback) {
|
||||||
const buf = new Buffer(4);
|
const buf = Buffer.alloc(4);
|
||||||
buf.writeInt32LE(value, 0);
|
buf.writeInt32LE(value, 0);
|
||||||
this._socket.write(buf, callback);
|
this._socket.write(buf, callback);
|
||||||
}
|
}
|
||||||
|
|||||||
4230
src/Microsoft.AspNetCore.NodeServices.Sockets/package-lock.json
generated
Normal file
4230
src/Microsoft.AspNetCore.NodeServices.Sockets/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,15 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "./node_modules/.bin/webpack"
|
"build": "webpack --mode production"
|
||||||
},
|
},
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^6.0.42",
|
"@types/node": "^10.9.2",
|
||||||
"ts-loader": "^0.8.2",
|
"ts-loader": "^4.5.0",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^3.0.1",
|
||||||
"webpack": "^1.13.1"
|
"webpack": "^4.17.1",
|
||||||
|
"webpack-cli": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
externals: ['fs', 'net', 'events', 'readline', 'stream'],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [ '.ts' ]
|
extensions: [ '.ts' ]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{ test: /\.ts$/, loader: 'ts-loader' },
|
{ test: /\.ts$/, use: 'ts-loader' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
@@ -14,7 +15,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
libraryTarget: 'commonjs',
|
libraryTarget: 'commonjs',
|
||||||
path: './Content/Node',
|
path: path.join(__dirname, 'Content', 'Node'),
|
||||||
filename: '[name].js'
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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,8 +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)
|
||||||
: new ConsoleLogger(LogCategoryName, null, false);
|
: NullLogger.Instance;
|
||||||
|
|
||||||
// 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();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,63 +1,115 @@
|
|||||||
(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 = {};
|
||||||
|
/******/
|
||||||
/******/ // The require function
|
/******/ // The require function
|
||||||
/******/ 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] = {
|
||||||
/******/ exports: {},
|
/******/ i: moduleId,
|
||||||
/******/ id: moduleId,
|
/******/ l: false,
|
||||||
/******/ loaded: false
|
/******/ 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__);
|
||||||
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.loaded = true;
|
/******/ module.l = true;
|
||||||
|
/******/
|
||||||
/******/ // 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__)
|
||||||
/******/ __webpack_require__.m = modules;
|
/******/ __webpack_require__.m = modules;
|
||||||
|
/******/
|
||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
|
/******/
|
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) {
|
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||||
|
/******/ if(mode & 8) return value;
|
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
|
/******/ var ns = Object.create(null);
|
||||||
|
/******/ __webpack_require__.r(ns);
|
||||||
|
/******/ 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));
|
||||||
|
/******/ return ns;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) {
|
||||||
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
/******/ function getDefault() { return module['default']; } :
|
||||||
|
/******/ function getModuleExports() { return module; };
|
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
|
/******/ return getter;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __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 = "";
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(0);
|
/******/ return __webpack_require__(__webpack_require__.s = 1);
|
||||||
/******/ })
|
/******/ })
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ ([
|
/******/ ([
|
||||||
/* 0 */
|
/* 0 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = __webpack_require__(1);
|
module.exports = require("path");
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
/***/ },
|
|
||||||
/* 1 */
|
/* 1 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
module.exports = __webpack_require__(2);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
/* 2 */
|
||||||
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
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__(3);
|
||||||
__webpack_require__(4);
|
__webpack_require__(4);
|
||||||
var http = __webpack_require__(5);
|
var http = __webpack_require__(5);
|
||||||
var path = __webpack_require__(3);
|
var path = __webpack_require__(0);
|
||||||
var ArgsUtil_1 = __webpack_require__(6);
|
var ArgsUtil_1 = __webpack_require__(6);
|
||||||
var ExitWhenParentExits_1 = __webpack_require__(7);
|
var ExitWhenParentExits_1 = __webpack_require__(7);
|
||||||
// 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
|
||||||
@@ -121,8 +173,9 @@
|
|||||||
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
|
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
|
||||||
var requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
var requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
||||||
server.listen(requestedPortOrZero, 'localhost', function () {
|
server.listen(requestedPortOrZero, 'localhost', function () {
|
||||||
|
var addressInfo = server.address();
|
||||||
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + server.address().address + '} port ' + server.address().port + '\]');
|
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + addressInfo.address + '} port ' + addressInfo.port + '\]');
|
||||||
// Signal to the NodeServices base class that we're ready to accept invocations
|
// Signal to the NodeServices base class that we're ready to accept invocations
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
||||||
});
|
});
|
||||||
@@ -141,12 +194,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 2 */
|
/* 3 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
var path = __webpack_require__(3);
|
|
||||||
|
exports.__esModule = true;
|
||||||
|
var path = __webpack_require__(0);
|
||||||
var startsWith = function (str, prefix) { return str.substring(0, prefix.length) === prefix; };
|
var startsWith = function (str, prefix) { return str.substring(0, prefix.length) === prefix; };
|
||||||
var appRootDir = process.cwd();
|
var appRootDir = process.cwd();
|
||||||
function patchedLStat(pathToStatLong, fsReqWrap) {
|
function patchedLStat(pathToStatLong, fsReqWrap) {
|
||||||
@@ -189,19 +244,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
|
// If some future version of Node throws (e.g., to prevent use of process.binding()),
|
||||||
|
// don't apply the patch, but still let the application run.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 3 */
|
|
||||||
/***/ function(module, exports) {
|
|
||||||
|
|
||||||
module.exports = require("path");
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 4 */
|
/* 4 */
|
||||||
/***/ 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
|
||||||
@@ -240,17 +291,19 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 5 */
|
/* 5 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = require("http");
|
module.exports = require("http");
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 6 */
|
/* 6 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
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.
|
||||||
@@ -272,9 +325,11 @@
|
|||||||
exports.parseArgs = parseArgs;
|
exports.parseArgs = parseArgs;
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 7 */
|
/* 7 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
"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,
|
||||||
@@ -309,7 +364,7 @@
|
|||||||
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.
|
||||||
*/
|
*/
|
||||||
"use strict";
|
exports.__esModule = true;
|
||||||
var pollIntervalMs = 1000;
|
var pollIntervalMs = 1000;
|
||||||
function exitWhenParentExits(parentPid, ignoreSigint) {
|
function exitWhenParentExits(parentPid, ignoreSigint) {
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
@@ -357,5 +412,5 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ }
|
/***/ })
|
||||||
/******/ ])));
|
/******/ ])));
|
||||||
@@ -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**
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import * as http from 'http';
|
|||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import { parseArgs } from './Util/ArgsUtil';
|
import { parseArgs } from './Util/ArgsUtil';
|
||||||
import { exitWhenParentExits } from './Util/ExitWhenParentExits';
|
import { exitWhenParentExits } from './Util/ExitWhenParentExits';
|
||||||
|
import { AddressInfo } from 'net';
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -70,8 +71,10 @@ const server = http.createServer((req, res) => {
|
|||||||
const parsedArgs = parseArgs(process.argv);
|
const parsedArgs = parseArgs(process.argv);
|
||||||
const requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
const requestedPortOrZero = parsedArgs.port || 0; // 0 means 'let the OS decide'
|
||||||
server.listen(requestedPortOrZero, 'localhost', function () {
|
server.listen(requestedPortOrZero, 'localhost', function () {
|
||||||
|
const addressInfo = server.address() as AddressInfo;
|
||||||
|
|
||||||
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
// Signal to HttpNodeHost which loopback IP address (IPv4 or IPv6) and port it should make its HTTP connections on
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + server.address().address + '} port ' + server.address().port + '\]');
|
console.log('[Microsoft.AspNetCore.NodeServices.HttpNodeHost:Listening on {' + addressInfo.address + '} port ' + addressInfo.port + '\]');
|
||||||
|
|
||||||
// Signal to the NodeServices base class that we're ready to accept invocations
|
// Signal to the NodeServices base class that we're ready to accept invocations
|
||||||
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
|
||||||
|
|||||||
4230
src/Microsoft.AspNetCore.NodeServices/package-lock.json
generated
Normal file
4230
src/Microsoft.AspNetCore.NodeServices/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,15 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "./node_modules/.bin/webpack"
|
"build": "webpack --mode production"
|
||||||
},
|
},
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^6.0.42",
|
"@types/node": "^10.9.2",
|
||||||
"ts-loader": "^0.8.2",
|
"ts-loader": "^4.5.0",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^3.0.1",
|
||||||
"webpack": "^1.13.1"
|
"webpack": "^4.17.1",
|
||||||
|
"webpack-cli": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
externals: ['fs', 'net', 'events', 'readline', 'stream'],
|
|
||||||
resolve: {
|
resolve: {
|
||||||
extensions: [ '.ts' ]
|
extensions: [ '.ts' ]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{ test: /\.ts$/, loader: 'ts-loader' },
|
{ test: /\.ts$/, use: 'ts-loader' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
@@ -14,7 +15,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
libraryTarget: 'commonjs',
|
libraryTarget: 'commonjs',
|
||||||
path: './Content/Node',
|
path: path.join(__dirname, 'Content', 'Node'),
|
||||||
filename: '[name].js'
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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,11 +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)
|
||||||
: new ConsoleLogger(logCategoryName, null, false);
|
: NullLogger.Instance;
|
||||||
return logger;
|
return logger;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,57 +1,103 @@
|
|||||||
(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 = {};
|
||||||
|
/******/
|
||||||
/******/ // The require function
|
/******/ // The require function
|
||||||
/******/ 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] = {
|
||||||
/******/ exports: {},
|
/******/ i: moduleId,
|
||||||
/******/ id: moduleId,
|
/******/ l: false,
|
||||||
/******/ loaded: false
|
/******/ 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__);
|
||||||
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.loaded = true;
|
/******/ module.l = true;
|
||||||
|
/******/
|
||||||
/******/ // 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__)
|
||||||
/******/ __webpack_require__.m = modules;
|
/******/ __webpack_require__.m = modules;
|
||||||
|
/******/
|
||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
|
/******/
|
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) {
|
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||||
|
/******/ if(mode & 8) return value;
|
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
|
/******/ var ns = Object.create(null);
|
||||||
|
/******/ __webpack_require__.r(ns);
|
||||||
|
/******/ 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));
|
||||||
|
/******/ return ns;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) {
|
||||||
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
/******/ function getDefault() { return module['default']; } :
|
||||||
|
/******/ function getModuleExports() { return module; };
|
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
|
/******/ return getter;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __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 = "";
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(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;
|
||||||
var path = __webpack_require__(2);
|
var path = __webpack_require__(2);
|
||||||
// Separate declaration and export just to add type checking on function signature
|
// Separate declaration and export just to add type checking on function signature
|
||||||
exports.renderToString = renderToStringImpl;
|
exports.renderToString = renderToStringImpl;
|
||||||
@@ -125,7 +171,7 @@
|
|||||||
}
|
}
|
||||||
else if (typeof foundBootModule !== 'function') {
|
else if (typeof foundBootModule !== 'function') {
|
||||||
// TypeScript-style default export
|
// TypeScript-style default export
|
||||||
renderToStringFunc = foundBootModule.default;
|
renderToStringFunc = foundBootModule["default"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Native default export
|
// Native default export
|
||||||
@@ -162,17 +208,17 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 2 */
|
/* 2 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = require("path");
|
module.exports = require("path");
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 3 */
|
/* 3 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = require("aspnet-prerendering");
|
module.exports = require("aspnet-prerendering");
|
||||||
|
|
||||||
/***/ }
|
/***/ })
|
||||||
/******/ ])));
|
/******/ ])));
|
||||||
@@ -1,65 +1,112 @@
|
|||||||
(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 = {};
|
||||||
|
/******/
|
||||||
/******/ // The require function
|
/******/ // The require function
|
||||||
/******/ 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] = {
|
||||||
/******/ exports: {},
|
/******/ i: moduleId,
|
||||||
/******/ id: moduleId,
|
/******/ l: false,
|
||||||
/******/ loaded: false
|
/******/ 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__);
|
||||||
|
/******/
|
||||||
/******/ // Flag the module as loaded
|
/******/ // Flag the module as loaded
|
||||||
/******/ module.loaded = true;
|
/******/ module.l = true;
|
||||||
|
/******/
|
||||||
/******/ // 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__)
|
||||||
/******/ __webpack_require__.m = modules;
|
/******/ __webpack_require__.m = modules;
|
||||||
|
/******/
|
||||||
/******/ // expose the module cache
|
/******/ // expose the module cache
|
||||||
/******/ __webpack_require__.c = installedModules;
|
/******/ __webpack_require__.c = installedModules;
|
||||||
|
/******/
|
||||||
|
/******/ // define getter function for harmony exports
|
||||||
|
/******/ __webpack_require__.d = function(exports, name, getter) {
|
||||||
|
/******/ if(!__webpack_require__.o(exports, name)) {
|
||||||
|
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
|
||||||
|
/******/ }
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // define __esModule on exports
|
||||||
|
/******/ __webpack_require__.r = function(exports) {
|
||||||
|
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
||||||
|
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
||||||
|
/******/ }
|
||||||
|
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // create a fake namespace object
|
||||||
|
/******/ // mode & 1: value is a module id, require it
|
||||||
|
/******/ // mode & 2: merge all properties of value into the ns
|
||||||
|
/******/ // mode & 4: return value when already ns object
|
||||||
|
/******/ // mode & 8|1: behave like require
|
||||||
|
/******/ __webpack_require__.t = function(value, mode) {
|
||||||
|
/******/ if(mode & 1) value = __webpack_require__(value);
|
||||||
|
/******/ if(mode & 8) return value;
|
||||||
|
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
|
||||||
|
/******/ var ns = Object.create(null);
|
||||||
|
/******/ __webpack_require__.r(ns);
|
||||||
|
/******/ 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));
|
||||||
|
/******/ return ns;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // getDefaultExport function for compatibility with non-harmony modules
|
||||||
|
/******/ __webpack_require__.n = function(module) {
|
||||||
|
/******/ var getter = module && module.__esModule ?
|
||||||
|
/******/ function getDefault() { return module['default']; } :
|
||||||
|
/******/ function getModuleExports() { return module; };
|
||||||
|
/******/ __webpack_require__.d(getter, 'a', getter);
|
||||||
|
/******/ return getter;
|
||||||
|
/******/ };
|
||||||
|
/******/
|
||||||
|
/******/ // Object.prototype.hasOwnProperty.call
|
||||||
|
/******/ __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 = "";
|
||||||
|
/******/
|
||||||
|
/******/
|
||||||
/******/ // Load entry module and return exports
|
/******/ // Load entry module and return exports
|
||||||
/******/ return __webpack_require__(0);
|
/******/ return __webpack_require__(__webpack_require__.s = 4);
|
||||||
/******/ })
|
/******/ })
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/******/ ([
|
/******/ ([
|
||||||
/* 0 */
|
/* 0 */,
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
|
||||||
|
|
||||||
module.exports = __webpack_require__(4);
|
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
|
||||||
/* 1 */,
|
/* 1 */,
|
||||||
/* 2 */,
|
/* 2 */,
|
||||||
/* 3 */,
|
/* 3 */,
|
||||||
/* 4 */
|
/* 4 */
|
||||||
/***/ function(module, exports, __webpack_require__) {
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
|
module.exports = __webpack_require__(5);
|
||||||
|
|
||||||
|
|
||||||
|
/***/ }),
|
||||||
|
/* 5 */
|
||||||
|
/***/ (function(module, exports, __webpack_require__) {
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
|
exports.__esModule = true;
|
||||||
// Pass through the invocation to the 'aspnet-webpack' package, verifying that it can be loaded
|
// Pass through the invocation to the 'aspnet-webpack' package, verifying that it can be loaded
|
||||||
function createWebpackDevServer(callback) {
|
function createWebpackDevServer(callback) {
|
||||||
var aspNetWebpack;
|
var aspNetWebpack;
|
||||||
try {
|
try {
|
||||||
aspNetWebpack = __webpack_require__(5);
|
aspNetWebpack = __webpack_require__(6);
|
||||||
}
|
}
|
||||||
catch (ex) {
|
catch (ex) {
|
||||||
// Developers sometimes have trouble with badly-configured Node installations, where it's unable
|
// Developers sometimes have trouble with badly-configured Node installations, where it's unable
|
||||||
@@ -76,11 +123,11 @@
|
|||||||
exports.createWebpackDevServer = createWebpackDevServer;
|
exports.createWebpackDevServer = createWebpackDevServer;
|
||||||
|
|
||||||
|
|
||||||
/***/ },
|
/***/ }),
|
||||||
/* 5 */
|
/* 6 */
|
||||||
/***/ function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = require("aspnet-webpack");
|
module.exports = require("aspnet-webpack");
|
||||||
|
|
||||||
/***/ }
|
/***/ })
|
||||||
/******/ ])));
|
/******/ ])));
|
||||||
@@ -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.
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
/// <reference path="../npm/aspnet-prerendering/src/PrerenderingInterfaces.d.ts" />
|
import { BootModuleInfo, RenderToStringFunc, RenderToStringCallback } from '../npm/aspnet-prerendering/src/PrerenderingInterfaces';
|
||||||
import * as url from 'url';
|
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
import * as fs from 'fs';
|
|
||||||
declare var __non_webpack_require__;
|
declare var __non_webpack_require__;
|
||||||
|
|
||||||
// Separate declaration and export just to add type checking on function signature
|
// Separate declaration and export just to add type checking on function signature
|
||||||
|
|||||||
@@ -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);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
4230
src/Microsoft.AspNetCore.SpaServices/package-lock.json
generated
Normal file
4230
src/Microsoft.AspNetCore.SpaServices/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
@@ -5,14 +5,15 @@
|
|||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "echo \"Error: no test specified\" && exit 1",
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
"build": "./node_modules/.bin/webpack"
|
"build": "webpack --mode production"
|
||||||
},
|
},
|
||||||
"author": "Microsoft",
|
"author": "Microsoft",
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/node": "^6.0.42",
|
"@types/node": "^10.9.2",
|
||||||
"ts-loader": "^0.8.2",
|
"ts-loader": "^4.5.0",
|
||||||
"typescript": "^2.0.0",
|
"typescript": "^3.0.1",
|
||||||
"webpack": "^1.13.1"
|
"webpack": "^4.17.1",
|
||||||
|
"webpack-cli": "^3.1.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
target: 'node',
|
target: 'node',
|
||||||
externals: [
|
externals: [
|
||||||
@@ -10,8 +12,8 @@ module.exports = {
|
|||||||
extensions: [ '.ts' ]
|
extensions: [ '.ts' ]
|
||||||
},
|
},
|
||||||
module: {
|
module: {
|
||||||
loaders: [
|
rules: [
|
||||||
{ test: /\.ts$/, loader: 'ts-loader' },
|
{ test: /\.ts$/, use: 'ts-loader' },
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
entry: {
|
entry: {
|
||||||
@@ -20,7 +22,10 @@ module.exports = {
|
|||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
libraryTarget: 'commonjs',
|
libraryTarget: 'commonjs',
|
||||||
path: './Content/Node',
|
path: path.join(__dirname, 'Content', 'Node'),
|
||||||
filename: '[name].js'
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
minimize: false
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<Project>
|
<Project>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>2.2.0</VersionPrefix>
|
<VersionPrefix>3.0.0</VersionPrefix>
|
||||||
<VersionSuffix>preview2</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>
|
||||||
|
|||||||
Reference in New Issue
Block a user