Compare commits

..

186 Commits

Author SHA1 Message Date
SteveSandersonMS
9c9892ab18 Add example of isomorphic cookies for #581 2017-01-16 12:54:44 +00:00
SteveSandersonMS
f8714e9653 Fix react/redux TypeScript build errors caused by breaking changes in dependencies. Fixes #529, #582, #583 2017-01-16 10:46:28 +00:00
SteveSandersonMS
9d5006107f Bumping NodeServices/SpaServices versions to 1.1.0-rc1-* for RC1 release 2017-01-13 09:02:28 +00:00
SteveSandersonMS
c3316d0caa Hopefully fix BuildQuality setting in build 2017-01-10 19:43:15 +00:00
SteveSandersonMS
38441c6598 Override the build quality determined by KoreBuild 2017-01-10 19:13:15 +00:00
SteveSandersonMS
f8f42a53b2 Increase Mocha timeout. Trying to fix intermittent test failures on AppVeyor. 2017-01-10 10:37:00 +00:00
SteveSandersonMS
a93f59c660 Add Aurelia to generator's README.md. Fixes #561. 2017-01-09 14:43:28 +00:00
SteveSandersonMS
c377e6cd28 For project.json-based projects, fix Kudu deployment by adding a .deployment file at the root 2017-01-07 00:08:06 +00:00
SteveSandersonMS
2a1435d9c1 Bump generator-aspnetcore-spa version to 0.7.3 2017-01-07 00:04:50 +00:00
SteveSandersonMS
6789dbc102 csproj-based projects don't need the _placeholder.txt files, because the publishing code correctly includes dist files even if they were not on disk before 2017-01-07 00:04:20 +00:00
SteveSandersonMS
59526ff16a Update templates' csproj files to fix first-time publishing (previously, it didn't deploy dist files if they were not already on disk) 2017-01-07 00:00:52 +00:00
SteveSandersonMS
8c456aa0fc Make Karma serve .ts files with executable MIME type, otherwise newer versions of Chrome won't run it. Fixes #499 2017-01-03 17:35:30 +00:00
Niclas Emdelius
49bece54c2 Check if response is stream or object without using reference to reflection package. 2017-01-03 13:29:45 +00:00
nicemd
0907379da8 Streamed responses can be be Object or Stream
See issue https://github.com/aspnet/JavaScriptServices/issues/518
2017-01-03 13:29:45 +00:00
SteveSandersonMS
fbb8054c2e Make error message clearer if Node isn't installed (or not found on PATH). Fixes #527 2017-01-03 10:59:26 +00:00
SteveSandersonMS
70f59fc8ec Update core package versions to 1.1.0-beta2-* so that CI will produce non-timestamped packages 2017-01-03 10:29:22 +00:00
SteveSandersonMS
e6cfe93e13 Instruct AppVeyor to regard the generator-aspnetcore-spa.tar.gz file as a build artifact 2017-01-02 12:02:58 +00:00
SteveSandersonMS
dad095b749 Bump generator-aspnetcore-spa version to 0.7.2 2017-01-02 11:59:51 +00:00
SteveSandersonMS
f31b96fe1e Yeoman package builder emits .tar.gz artifact 2017-01-02 11:59:16 +00:00
SteveSandersonMS
312885acde Add AppVeyor status to root README.md 2017-01-02 11:31:40 +00:00
SteveSandersonMS
0763f1062b Add missing trailing slash on publicPath in docs. Fixes #516. 2017-01-02 10:58:03 +00:00
SteveSandersonMS
dcb819f644 Fix port testing logic in tests by being explicit about which interface we're checking 2016-12-15 22:53:12 +00:00
SteveSandersonMS
f722dcf98d Fix PrerenderResult in Webpack sample 2016-12-15 21:45:02 +00:00
SteveSandersonMS
153c9848ca Also build samples/misc 2016-12-15 21:42:40 +00:00
SteveSandersonMS
aefa578e04 Reuse TEST_PROJECT_GLOB to build templates, since the 'test' dir doesn't contain any .NET projects 2016-12-15 21:09:44 +00:00
SteveSandersonMS
953f370336 Wait for port to be freed before continuing 2016-12-15 20:34:55 +00:00
SteveSandersonMS
200d80627c Update Appveyor test environment to Node 6.9.2 to deal with Windows-specific NPM issues 2016-12-15 20:34:46 +00:00
SteveSandersonMS
994653a277 Stop including templates in regular build (they now contain .csproj, which is not supported by that build system, and in any case they are built and end-to-end tested on Appveyor) 2016-12-15 20:32:08 +00:00
SteveSandersonMS
17b107bb42 Fix how 'current' and 'preview' SDKs are merged in Appveyor builds 2016-12-15 19:31:09 +00:00
SteveSandersonMS
67cd5f6093 In csproj projects, reference 1.1.0-preview4-final version of Razor tools 2016-12-15 18:10:43 +00:00
SteveSandersonMS
06ccad4344 Automatically install both the 'current' and 'preview' SDKs when building in Appveyor 2016-12-15 18:07:34 +00:00
SteveSandersonMS
4fd19b4293 Run tests against both csproj and project.json-style projects. Assumes relevant dotnet SDKs are installed locally. 2016-12-15 17:17:04 +00:00
SteveSandersonMS
f34eb582ad Update tests to be compatible with newer Yeoman generator 2016-12-15 16:52:02 +00:00
SteveSandersonMS
4580412f73 Don't leave behind an unused package.json.tmp file 2016-12-15 16:42:25 +00:00
SteveSandersonMS
a76b6e25d4 Add .csproj files for the templates. Some are set up for prerendering; others not. 2016-12-15 16:42:25 +00:00
SteveSandersonMS
2135d77189 generator-aspnetcore-spa support for selecting between project.json and .csproj 2016-12-15 16:42:25 +00:00
SteveSandersonMS
62b676174e generator-aspnetcore-spa now displays its own version number on startup 2016-12-15 16:41:10 +00:00
SteveSandersonMS
67c2cfd84e Add Appveyor builds and webdriver.io tests (tests cover Angular2Spa template only at present) 2016-12-15 16:38:30 +00:00
SteveSandersonMS
6decb30681 Make 'counter' components use <h1> headers to be consistent with other pages 2016-12-15 16:37:29 +00:00
SteveSandersonMS
33ed333f92 Specify SDK at repo root 2016-12-15 16:35:48 +00:00
SteveSandersonMS
6c16ba3da7 Remove template_nodemodules_placeholder.txt files - they are redundant now that we no longer need to publish node_modules to production 2016-12-15 16:35:48 +00:00
SteveSandersonMS
495c95d227 If generator fails because NPM is too old, exit with nonzero status code 2016-12-15 16:35:48 +00:00
SteveSandersonMS
4dd91a9b78 Make template package build script automate running the prepublish steps needed for the Angular2Spa template 2016-12-14 10:21:04 +00:00
SteveSandersonMS
06335eeee1 Fix building generator-aspnetcore-spa (something in a newer TypeScript version broke it) 2016-12-14 09:56:23 +00:00
SteveSandersonMS
eb98067e86 Update docs about using socket transport. Fixes #500 2016-12-13 15:59:43 +00:00
SteveSandersonMS
a25d1f4731 Publish aspnet-webpack 1.0.26 2016-12-13 15:48:44 +00:00
SteveSandersonMS
4c3834361e Stop WebpackDevMiddleware littering the 'dist' directories with blah.host-update.js.map files (they never need to be written to disk) 2016-12-13 15:47:43 +00:00
SteveSandersonMS
4cc61d79e2 Add json-loader to add webpack.config.js files. Helps with #507. 2016-12-13 12:57:06 +00:00
SteveSandersonMS
1c4682e50d Fix all the ConditionalProxyMiddleware errors that happened if you ctrl+c on a "dotnet run" (not "dotnet watch run") since beta-000002. 2016-12-13 11:32:32 +00:00
Sébastien Ros
6545e11bf2 Fix filename in sample
Mismatch between code sample and described js filename.
2016-12-08 10:04:50 +00:00
SteveSandersonMS
8d1cb3a537 Remove angular2-aspnet NPM package source as none of its functionality is still in use (and hasn't been since beta versions of Angular 2) 2016-12-08 10:02:37 +00:00
SteveSandersonMS
8705a4b353 Remove redux-typed from source tree. It's no longer in use and doesn't need to be maintained. Source can be re-added in the future if needed. 2016-12-07 19:02:53 +00:00
SteveSandersonMS
7c685c1354 Add AssemblyInfo.cs to Microsoft.AspNetCore.NodeServices.Sockets package 2016-12-07 18:09:11 +00:00
SteveSandersonMS
633969c7b4 Update Dockerfiles for .NET Core 1.1.0. Fixes #489 2016-12-07 11:15:40 +00:00
SteveSandersonMS
9c1c1b4023 Publish aspnet-prerendering 2.0.2 2016-12-01 17:31:32 +00:00
SteveSandersonMS
0a116ba2a1 Prerendering logic supplies PathBase (formatted as baseUrl) to boot logic 2016-12-01 17:24:24 +00:00
SteveSandersonMS
2b2465ad2e Update prerendering docs to account for aspnet-prerendering 2.0.0 and the new createServerRenderer API. Fixes #479 2016-12-01 14:41:48 +00:00
SteveSandersonMS
dc130adc91 Update aspnet-prerendering to reference baseUrl in domain-task's main module, not domain-task/fetch. Goal is to avoid Webpack having to bundle isomorphic-fetch on server unless you're actually using it. 2016-12-01 14:32:54 +00:00
SteveSandersonMS
b8913d29dd Update domain-task to export baseUrl from 'main' instead of only 'fetch'. Goal is to avoid Webpack detecting dependency on isomorphic-fetch unless you're actually using it. 2016-12-01 14:31:27 +00:00
SteveSandersonMS
5e669d6e7a Publish Yeoman generators 0.7.1 2016-11-30 17:54:46 +00:00
SteveSandersonMS
5d02728159 Publish Yeoman generators version 0.7.0. From here on, the templates produce ASP.NET Core 1.1.0 projects. 2016-11-30 17:09:24 +00:00
SteveSandersonMS
78632617f8 Publish aspnet-webpack 1.0.25 2016-11-30 16:53:39 +00:00
SteveSandersonMS
e2f8031bb8 For HMR, proxy all requests including /__webpack_hmr. Fixes #271. 2016-11-30 16:53:16 +00:00
SteveSandersonMS
2cffab14f6 StringAsTempFile cleans up in a wider range of circumstances (not relying on finalizer running). Helps with #7 but still doesn't cover all cases. 2016-11-30 15:04:08 +00:00
SteveSandersonMS
9001c191c1 Make Angular and React templates reference SpaServices directly. The AngularServices/ReactServices packages might be used in the future, but don't presently contain any extra usable functionality. 2016-11-30 12:19:05 +00:00
SteveSandersonMS
832da2a451 Split out 'socket' hosting model into a separate optional NuGet package, since most developers won't need it 2016-11-30 12:18:57 +00:00
SteveSandersonMS
ebf5a18344 Eliminate the NodeHostingModel enum because it isn't extensible. Instead, use extension methods on NodeServicesOptions to configure a NodeInstanceFactory. 2016-11-30 11:29:57 +00:00
SteveSandersonMS
d865e1f28b Specify latest 'current' SDK in all template global.json files 2016-11-30 11:29:57 +00:00
SteveSandersonMS
62c0680193 Make 'fetchdata' components in templates compatible with latest TypeScript compiler 2016-11-29 19:11:03 +00:00
SteveSandersonMS
a8d3eed32c Detect legacy aspnet-prerendering mode earlier to fix #470 2016-11-29 18:37:43 +00:00
SteveSandersonMS
5d14f11b1b Update all the project templates to .NET Core 1.1.0 2016-11-29 16:36:05 +00:00
SteveSandersonMS
196c0dd32e Update other samples to 1.1.0 dependencies 2016-11-29 16:36:05 +00:00
SteveSandersonMS
31d8eb69a7 Updated all 'misc' samples to 1.1.0 dependencies (and to TypeScript 2 for the Webpack sample) 2016-11-29 16:36:05 +00:00
SteveSandersonMS
4cbbf58600 Update core packages to version 1.1.0-*, upgrading .NET Core dependencies to match 1.1.0 release 2016-11-29 16:35:59 +00:00
SteveSandersonMS
3ff4447924 Add XML docs to core packages 2016-11-29 16:03:15 +00:00
SteveSandersonMS
3b91ad9b39 Make core package project.json files conform to org-wide conventions 2016-11-29 14:02:26 +00:00
SteveSandersonMS
bebf24952e Add AssemblyInfo files to core packages 2016-11-29 13:04:21 +00:00
SteveSandersonMS
834301e50d Publish generator-aspnetcore-spa 0.6.1 2016-11-28 17:48:08 +00:00
SteveSandersonMS
03774253eb Fix AureliaSpa TypeScript compile error introduced by newer version of TypeScript 2016-11-28 17:35:00 +00:00
SteveSandersonMS
a3cba50e88 Make ReactReduxSpa able to do prerendering without node_modules at runtime 2016-11-28 17:30:09 +00:00
SteveSandersonMS
9cfea61f1e Make Angular2Spa able to do prerendering without node_modules at runtime 2016-11-28 17:30:04 +00:00
SteveSandersonMS
157b74a0cd Update Angular2Spa and ReactReduxSpa to use aspnet-prerendering 2.0.0 2016-11-28 16:56:02 +00:00
SteveSandersonMS
17f9ecec29 Support new prerendering mode that doesn't require you to deploy node_modules to production. This is a breaking change in aspnet-prerendering, hence the major version bump. The NuGet package is back-compatible though. 2016-11-28 16:56:02 +00:00
SteveSandersonMS
9f6b0b0573 Build SpaServices 'Node/Content/*.js' files from TypeScript sources 2016-11-28 16:56:02 +00:00
SteveSandersonMS
dd97ae7316 Specify publicPath in all vendor build configs (otherwise, file-loader won't generate correct URLs to any static resources from the vendor bundle) 2016-11-28 16:55:53 +00:00
SteveSandersonMS
ea2cfc277c Fix Angular2Spa "template parse errors" in production builds (was caused by html-loader's HTML minification feature) 2016-11-28 16:09:08 +00:00
SteveSandersonMS
fadb2b3127 Remove README.md files from templates, as much of the content is irrelevant or outdated. Fixes #463. 2016-11-25 10:19:55 +00:00
SteveSandersonMS
69a0a29057 Handle Webpack 2.1.0 beta 23 renaming 'loaders' to 'rules'. Fixes #460. 2016-11-25 10:15:38 +00:00
SteveSandersonMS
8401bbf33a Add global.json to templates specifying SDK preview 2 (otherwise, preview 3 breaks it). Will need to exclude/modify this file when emitting csproj projects. 2016-11-25 09:56:53 +00:00
Andrei Tserakhau
e3a4fad951 fix sln for templates 2016-11-21 15:05:42 +00:00
Scott Addie
3a4936dbf7 Add '-loader' suffix to all Webpack loader references 2016-11-21 10:14:37 +00:00
WrathZA
bbbcb5ef18 Update README.md
Fixed very minor spelling mistake on line 521.

You = Your
2016-11-18 17:03:24 +00:00
SteveSandersonMS
d6c6408457 In AureliaSpa, lock local copy of Webpack to 2.1.0-beta.25 (not any later 2.1.0 beta) due to fix #436 2016-11-18 15:46:05 +00:00
SteveSandersonMS
9b048c54d4 Remove 'redux-typed' from ReactReduxSpa template, making it more standard as a Redux application 2016-11-11 15:32:51 -08:00
SteveSandersonMS
cdd6c16dc6 Preparing to publish new generator-aspnetcore-spa 2016-11-10 13:38:36 -08:00
SteveSandersonMS
4f15bd6c50 Produce correct package.json from generator-aspnetcore-spa 2016-11-10 08:16:30 -08:00
SteveSandersonMS
828ed07cef In generator-aspnetcore-spa, offer user the choice of whether to include tests 2016-11-09 14:05:41 -08:00
SteveSandersonMS
a734a31745 Add Karma/Jasmine/Chai test starting point to Angular2Spa 2016-11-09 13:10:43 -08:00
SteveSandersonMS
ea81671828 Update docs to remove references to deprecated 'asp-prerender-webpack-config'. Fixes #359 2016-11-07 14:52:33 -08:00
SteveSandersonMS
b3dbb6e0f1 Yeoman generator, when running on Windows, ensures you have NPM 3+. Fixes #82. 2016-11-07 14:10:03 -08:00
SteveSandersonMS
11c45321aa In Angular2Spa, use angular2-template loader as a step towards AoT compilation. Implements #356 2016-11-07 13:45:29 -08:00
SteveSandersonMS
fadcb586c6 Support specifying environment variables for the Webpack dev middleware Node instance. Resolves #311. 2016-11-07 12:29:01 -08:00
SteveSandersonMS
2c97326721 In domain-task, avoid use of "new Function" because of CSP. Fixes #345 2016-11-07 12:21:02 -08:00
SteveSandersonMS
1b4dd93fa6 Update React MusicStore sample to use current technologies (TypeScript 2, .NET Core 1.0.1, etc.). Fixes #417 2016-11-07 10:16:41 -08:00
SteveSandersonMS
7ee8a7b15e Update aspnet-webpack peerDependency to allow Webpack 2.1.0beta+ as well as Webpack 1.x 2016-10-31 17:14:29 +00:00
SteveSandersonMS
64903fe0c6 Fix aspnet-webpack build on machines that don't already have tsd in the node_modules dir here 2016-10-31 16:49:37 +00:00
SteveSandersonMS
077f91847a Fix AngularServices NPM package dependency restoration following third-party package changes 2016-10-31 16:35:06 +00:00
SteveSandersonMS
7ee3346a72 Fix Angular 2 MusicStore sample so packages can be restored on NPM 2.x (started failing because peerDependencies ceased to be valid following third-party package updates) 2016-10-31 16:19:36 +00:00
SteveSandersonMS
f9145a43f6 In Angular2Spa server-side rendering, only render the <app> element, not an entire <html> doc 2016-10-31 11:46:00 +00:00
SteveSandersonMS
da51cd588b In WebpackDevMiddleware, when copying files, create any needed subdirectories. Fixes #408. 2016-10-31 10:49:31 +00:00
SteveSandersonMS
54f222e88f Update templates for Yarn compatibility 2016-10-28 17:36:55 +01:00
SteveSandersonMS
6259b7b938 In generator-aspnetcore-spa, use 'yarn' (if available) instead of 'npm' to restore dependencies because it's > 10x faster 2016-10-28 16:55:39 +01:00
SteveSandersonMS
dfcaae6fda Include AureliaSpa in generator-aspnetcore-spa 2016-10-28 15:52:15 +01:00
SteveSandersonMS
4b507004b1 In AureliaSpa, use Webpack build mode to decide whether or not to enable debug logging 2016-10-28 15:52:15 +01:00
SteveSandersonMS
bd86026bb9 Change AureliaSpa to use external source maps for compatibility with VS/VSCode debugging 2016-10-28 15:52:15 +01:00
SteveSandersonMS
996216c751 Tell aurelia-webpack-plugin to filter the set of dependencies it auto-imports. Note that this will have no effect until the next version of aurelia-webpack-plugin is published to NPM. 2016-10-28 15:52:14 +01:00
SteveSandersonMS
6bceb234d8 In AureliaSpa, use whatwg-fetch to provide type info 2016-10-28 15:52:14 +01:00
SteveSandersonMS
acfb253a40 Change AureliaSpa to use vendor bundle like the other templates 2016-10-28 15:52:04 +01:00
SteveSandersonMS
3087352ea1 Simplify AureliaSpa's webpack.config.js 2016-10-28 11:40:32 +01:00
kmkatsma
e60ea04f86 Add AureliaSpa template (#398) 2016-10-28 11:16:21 +01:00
SteveSandersonMS
867e60d7fd Take dependency on newer webpack-dev-middleware because it fixes ambiguities in path handling 2016-10-28 10:56:19 +01:00
SteveSandersonMS
8cf116bca8 Switch back to regular KoreBuild now it's updated 2016-10-24 16:29:28 +01:00
SteveSandersonMS
3dc9ac979c Add docs note about TypeScriptCompileBlocked as requested in #399 2016-10-24 10:26:00 +01:00
SteveSandersonMS
bf71e3e71c Publish updated generator-aspnetcore-spa 2016-10-24 10:09:58 +01:00
SteveSandersonMS
c140b5014a Fix WebApplicationBasic config 2016-10-24 10:08:14 +01:00
SteveSandersonMS
de9460fba5 Update KO template type dependencies. Fixes #397. 2016-10-24 10:06:26 +01:00
SteveSandersonMS
d858c09b7b Minor doc tweaks 2016-10-21 15:17:28 +01:00
SteveSandersonMS
ca6acc807d Attempt to fix headings in docs 2016-10-21 15:12:50 +01:00
SteveSandersonMS
8285bb0c74 Some extra links in docs 2016-10-21 15:10:30 +01:00
SteveSandersonMS
75abf1a2ab Add docs about debugging 2016-10-21 15:09:04 +01:00
SteveSandersonMS
a427d5f0f0 Fix source map generation in projects that also use ExtractTextPlugin 2016-10-21 13:53:34 +01:00
SteveSandersonMS
e0c18ab269 Publish updated Yeoman generators 2016-10-21 10:52:10 +01:00
SteveSandersonMS
f20ad391b6 Change ReactReduxSpa template to require redux-typed 2.0.0 (because the template uses TS 2.0 compiler) 2016-10-21 10:39:22 +01:00
SteveSandersonMS
496338ccca Publish redux-typed 2.0.0 which depends on TypeScript 2.0 for usage (its .d.ts files use the "/// <reference types="..." />" syntax) 2016-10-21 10:37:05 +01:00
SteveSandersonMS
0615578d9a Switch from inline to external source maps. This avoids several problems with inline source maps in VS 2015 (at least as of Update 3). 2016-10-21 10:10:20 +01:00
SteveSandersonMS
8c766c0382 Remove deprecated SourceMapDevToolPlugin (can use Webpack's built-in one with external source maps) 2016-10-21 09:22:35 +01:00
SteveSandersonMS
85b8f033da Temporarily use modified build system to see if it fixes CI issues. Also remove earlier attempted workaround. 2016-10-17 21:58:31 +01:00
SteveSandersonMS
6f44227917 Attempt to fix CI build issues 2016-10-17 19:35:28 +01:00
Mike Mazmanyan
3760d3724d removing usage of deprecated httpPlatformHandler
httpPlatformHandler is changed with aspNetCore handler in IIS
2016-10-17 11:51:01 +01:00
SteveSandersonMS
99bf212cce Make aspnet-webpack resilient against Webpack configs with nonstring entrypoints. Fixes #376. 2016-10-17 11:51:01 +01:00
SteveSandersonMS
418255e148 Exclude node_modules from .NET compilation. Fixes #378. 2016-10-17 11:51:01 +01:00
Mark Pieszak
f6d7321243 Update remaining templates to TypeScript 2 / @types / etc. 2016-10-17 11:50:31 +01:00
SteveSandersonMS
a7ed0112db Publish redux-typed 1.0.1 2016-10-17 10:49:42 +01:00
SteveSandersonMS
f26068b62b Temporarily disable use of SourceMapDevToolPlugin wrapper as it might be possible to remove it shortly 2016-10-11 19:04:17 +01:00
SteveSandersonMS
1543595c01 Correct Windows path handling in new aspnet-webpack feature 2016-10-11 18:11:47 +01:00
SteveSandersonMS
3d77a21bc6 Publishing updated generator-aspnetcore-spa 2016-10-11 17:17:08 +01:00
SteveSandersonMS
ae0ffd4d11 Update package-builder to TS 2.0 and @types 2016-10-11 17:15:13 +01:00
SteveSandersonMS
0289f73a96 Fix the deployment issue caused by incorrectly referencing 'webpack-externals-plugin' when it should be 'webpack-node-externals' 2016-10-11 16:58:38 +01:00
SteveSandersonMS
6a9b7accce Update Dockerfiles to use Node 4.x (was using 0.x). Fixes #373 2016-10-11 16:50:03 +01:00
SteveSandersonMS
a6d959b783 Publish updated aspnet-webpack 2016-10-11 16:12:27 +01:00
SteveSandersonMS
30a694450c Make source maps compatible with VS/VSCode debugging (fix file paths, and strip out the "charset=utf-8;" segments from inline sourceMappingURLs) 2016-10-11 16:11:12 +01:00
SteveSandersonMS
d20a72b812 In webpack dev middleware, after compilation, also write updated files to disk. This is needed for VS/VSCode debugger compatibility. 2016-10-11 15:56:06 +01:00
SteveSandersonMS
24773c8aa4 In aspnet-webpack, provide a SourceMapDevToolPlugin wrapper that strips out "charset=utf-8;" from inline source map URLs to enable VS debugger compatibility 2016-10-11 15:56:05 +01:00
SteveSandersonMS
6c645879a8 Publish updated aspnet-webpack 2016-10-10 13:20:54 +01:00
SteveSandersonMS
d5055dbaf3 Make the fix for #365 not be a breaking change (at least, for the considerable majority of aspnet-webpack users) 2016-10-10 12:36:52 +01:00
SteveSandersonMS
3568476cca aspnet-webpack auto-loads 'event-source-polyfill' on client when HMR is enabled. This requires 'event-source-polyfill' to be included in the client-side bundle, so it's also now added to all the templates' vendor bundles. Fixes #365. 2016-10-10 12:24:07 +01:00
SteveSandersonMS
93779a5e46 aspnet-webpack configures HMR to point directly to http://localhost:<port>/__webpack_hmr instead of proxying via /__webpack_hmr. This is because IE/Edge doesn't honour CORS headers properly following redirects (returns "Network Error 0x80004004"). This could be avoided if we could reverse-proxy to __webpack_hmr (waiting for https://github.com/aspnet/KestrelHttpServer/issues/1139) 2016-10-10 12:00:56 +01:00
Brad Christensen
4fc1d60d67 Remove cancellationToken parameter as the method is no longer async 2016-10-05 17:14:15 +01:00
Brad Christensen
1d76284e25 Serialize node invocationInfo JSON directly to stream to avoid running out of memory
Fixed only for SocketNodeInstance, as it deals nicely with streams. Previously ~30MB of JSON text and 32-bit IIS Express would result in an OutOfMemoryException at the GetBytes method, which is now fixed by writing the JSON string directly to the stream and not handling it as a string in between.
2016-10-05 17:14:15 +01:00
SteveSandersonMS
c33b227331 Update redux-typed to use TS 2.0 and @types 2016-10-05 14:37:13 +01:00
SteveSandersonMS
02315b41c0 Update angular2-aspnet to use TS 2.0 and @types 2016-10-05 14:34:29 +01:00
SteveSandersonMS
4e291130a0 Update domain-task to use TS 2.0 and @types 2016-10-05 14:30:22 +01:00
SteveSandersonMS
7f257e86e3 Update aspnet-webpack-react to use TS 2.0 and @types 2016-10-05 14:12:01 +01:00
SteveSandersonMS
5c0505440d Update aspnet-webpack to use TS 2.0 and @types 2016-10-05 14:07:25 +01:00
SteveSandersonMS
f13c2595b8 Update aspnet-prerendering to use TS 2.0 and @types 2016-10-05 13:58:55 +01:00
SteveSandersonMS
bc42e598f9 Update NodeServices TypeScript compilation to use @types 2016-10-05 13:58:55 +01:00
Korneel
a0ebab1f28 Update Dockerfile
The app doesn't run in Docker on base image `microsoft/dotnet:latest` because Microsoft.NETCore.App 1.0.1 isn't installed. Only 1.0.0 is installed. The app runs fine on base image `microsoft/dotnet:1.0.0-preview2-onbuild`.
2016-10-05 12:18:58 +01:00
SteveSandersonMS
ff396377b9 Fix some issues when building with Korebuild. Also make it build the project templates. 2016-10-05 10:59:24 +01:00
SteveSandersonMS
81d96766ee domain-task also needs TypeScript 2+ because of whatwg-streams 2016-10-05 10:22:20 +01:00
SteveSandersonMS
17801a3c16 aspnet-prerendering now needs newer TypeScript to build, because on of its dependencies (whatwg-streams) does 2016-10-05 10:20:08 +01:00
SteveSandersonMS
0234b44355 In build scripts, use local rimraf package 2016-10-05 10:15:19 +01:00
SteveSandersonMS
18e8b7101c In aspnet-webpack, allow webpack-hot-middleware/client to be added manually with options. Fixes #353 2016-10-04 11:36:10 +01:00
SteveSandersonMS
6126c4d480 In Angular2Spa, move tsconfig.json back to root. Fixes #346. 2016-10-04 11:11:58 +01:00
SteveSandersonMS
53889c0fc1 Template updates as per Eilon's comments 2016-09-29 12:05:29 +01:00
SteveSandersonMS
5f070daac8 In KnockoutSpa template, fix handling clicks on descendants of A elements. Fixes #273. 2016-09-29 11:04:22 +01:00
SteveSandersonMS
3270e28b3d Slight clean-up in KnockoutSpa's boot code 2016-09-29 10:58:41 +01:00
SteveSandersonMS
42e88f7fc4 Keep a copy of the NuGet binary in the repo, as it's needed for building the dotnetnew templates 2016-09-29 10:20:13 +01:00
SteveSandersonMS
8968a24041 Publishing updated generator-aspnetcore-spa package 2016-09-29 10:17:22 +01:00
SteveSandersonMS
0a961a7bd0 Updated ReactReduxSpa template to match current patterns 2016-09-28 17:43:22 +01:00
SteveSandersonMS
a9ce762827 Update project.json in KnockoutSpa and ReactSpa 2016-09-28 16:28:22 +01:00
SteveSandersonMS
0d34dba4fd In ReactSpa, fix HMR warning and correctly minify React for production 2016-09-28 15:25:15 +01:00
SteveSandersonMS
808592d3a0 Update ReactSpa template to match current patterns 2016-09-28 15:07:17 +01:00
SteveSandersonMS
d1228dc26a Update KnockoutSpa template to match current patterns 2016-09-28 15:04:54 +01:00
SteveSandersonMS
09b4135217 Further workarounds for https://github.com/dotnet/cli/issues/1396 2016-09-28 13:12:59 +01:00
SteveSandersonMS
9bd9444485 In Angular2Spa, put all NPM dependencies under "dependencies", not "devDependencies" (otherwise, if someone tries to publish while NODE_ENV=production, the build will fail) 2016-09-28 12:46:30 +01:00
SteveSandersonMS
4937fef28f Publish updated version of generator-aspnetcore-spa 2016-09-28 12:19:50 +01:00
367 changed files with 5494 additions and 41297 deletions

1
.gitignore vendored
View File

@@ -37,4 +37,5 @@ npm-debug.log
/templates/*/node_modules/
/templates/*/wwwroot/dist/
/templates/*/ClientApp/dist/
/templates/*/yarn.lock
.vscode/

View File

@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Samples", "Samples", "{E6E88944-4800-40BA-8AF5-069EA3ADFEB8}"
EndProject
@@ -46,6 +46,10 @@ Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "MusicStore", "samples\react
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Angular", "Angular", "{4867A616-83D6-48DC-964D-6AE743596631}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "Aurelia", "templates\AureliaSpa\Aurelia.xproj", "{33D8DAD9-74F9-471D-8BAD-55F828FAA736}"
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "KnockoutSpa", "templates\KnockoutSpa\KnockoutSpa.xproj", "{85231B41-6998-49AE-ABD2-5124C83DBEF2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -108,6 +112,14 @@ Global
{C870A92C-9E3F-4BF2-82B8-5758545A8B7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C870A92C-9E3F-4BF2-82B8-5758545A8B7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C870A92C-9E3F-4BF2-82B8-5758545A8B7C}.Release|Any CPU.Build.0 = Release|Any CPU
{33D8DAD9-74F9-471D-8BAD-55F828FAA736}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{33D8DAD9-74F9-471D-8BAD-55F828FAA736}.Debug|Any CPU.Build.0 = Debug|Any CPU
{33D8DAD9-74F9-471D-8BAD-55F828FAA736}.Release|Any CPU.ActiveCfg = Release|Any CPU
{33D8DAD9-74F9-471D-8BAD-55F828FAA736}.Release|Any CPU.Build.0 = Release|Any CPU
{85231B41-6998-49AE-ABD2-5124C83DBEF2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{85231B41-6998-49AE-ABD2-5124C83DBEF2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{85231B41-6998-49AE-ABD2-5124C83DBEF2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{85231B41-6998-49AE-ABD2-5124C83DBEF2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -126,5 +138,7 @@ Global
{E0EBA813-4478-4C02-B11D-FB3793113FE4} = {E6E88944-4800-40BA-8AF5-069EA3ADFEB8}
{C870A92C-9E3F-4BF2-82B8-5758545A8B7C} = {E0EBA813-4478-4C02-B11D-FB3793113FE4}
{4867A616-83D6-48DC-964D-6AE743596631} = {E6E88944-4800-40BA-8AF5-069EA3ADFEB8}
{33D8DAD9-74F9-471D-8BAD-55F828FAA736} = {727E6D58-6830-4792-96C6-E138A33959FB}
{85231B41-6998-49AE-ABD2-5124C83DBEF2} = {727E6D58-6830-4792-96C6-E138A33959FB}
EndGlobalSection
EndGlobal

View File

@@ -1,5 +1,7 @@
# JavaScriptServices
AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/gprilrckx116vc9m/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/javascriptservices/branch/dev)
This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo.
## What is this?

View File

@@ -1,7 +1,44 @@
init:
- git config --global core.autocrlf true
install:
- ps: Install-Product node 6.9.2 x64
# .NET Core SDK binaries
# Download .NET Core SDK and add to PATH
- ps: $urlCurrent = "https://go.microsoft.com/fwlink/?LinkID=834991"
- ps: $urlPreview = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/rel-1.0.0/dotnet-dev-win-x64.latest.zip"
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
- ps: $tempFileCurrent = [System.IO.Path]::GetTempFileName()
- ps: $tempFilePreview = [System.IO.Path]::GetTempFileName()
- ps: (New-Object System.Net.WebClient).DownloadFile($urlCurrent, $tempFileCurrent)
- ps: (New-Object System.Net.WebClient).DownloadFile($urlPreview, $tempFilePreview)
- ps: Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFileCurrent, $env:DOTNET_INSTALL_DIR)
- ps: Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory($tempFilePreview, $env:DOTNET_INSTALL_DIR + "preview")
- ps: Copy-Item "${env:DOTNET_INSTALL_DIR}preview\*" "${env:DOTNET_INSTALL_DIR}" -Force -Recurse
- ps: $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
build_script:
- build.cmd verify
- ps: Push-Location
- cd templates/package-builder
- npm install
- npm run build
- ps: Pop-Location
artifacts:
- path: templates\package-builder\dist\artifacts\generator-aspnetcore-spa.tar.gz
name: generator-aspnetcore-spa
# - build.cmd verify
clone_depth: 1
test: off
test_script:
- dotnet restore ./src
- npm install -g selenium-standalone
- selenium-standalone install
# The nosys flag is needed for selenium to work on Appveyor
- ps: Start-Process selenium-standalone 'start','--','-Djna.nosys=true'
- ps: Push-Location
- cd test
- npm install
- npm test
on_finish :
- ps: Pop-Location
# After running tests, upload results to Appveyor
- ps: (new-object net.webclient).UploadFile("https://ci.appveyor.com/api/testresults/junit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path .\test\tmp\junit\*.xml))
deploy: off

View File

@@ -1,3 +1,4 @@
{
"projects": ["src"]
"projects": ["src"],
"sdk": { "version": "1.0.0-preview2-1-003177" }
}

View File

@@ -2,6 +2,13 @@
var VERSION='0.1'
var FULL_VERSION='0.1'
var AUTHORS='Microsoft Open Technologies, Inc.'
var TEST_PROJECT_GLOB='templates/*/project.json'
var SAMPLES_PROJECT_GLOB='samples/misc/*/project.json'
@{
// The build quality values are set in each of the project.json files
BuildQuality = "";
}
use-standard-lifecycle
k-standard-goals

View File

@@ -2,6 +2,7 @@ versionSuffix=$1
dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
projects=(
./src/Microsoft.AspNetCore.NodeServices
./src/Microsoft.AspNetCore.NodeServices.Sockets
./src/Microsoft.AspNetCore.SpaServices
./src/Microsoft.AspNetCore.AngularServices
./src/Microsoft.AspNetCore.ReactServices

View File

@@ -5,6 +5,8 @@
"angular2": "2.0.0-beta.15",
"angular2-aspnet": "^0.0.6",
"angular2-universal": "0.98.1",
"angular2-express-engine": "0.11.1",
"angular2-hapi-engine": "0.11.1",
"aspnet-prerendering": "^1.0.1",
"bootstrap": "^3.3.5",
"css": "^2.2.1",

View File

@@ -15,28 +15,28 @@
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.AngularServices": "1.0.0-*",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.AngularServices": "1.1.0-*",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SQLite": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.EntityFrameworkCore.SQLite": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"AutoMapper": "5.0.2"
},
@@ -47,7 +47,7 @@
},
"frameworks": {
"netcoreapp1.0": {
"netcoreapp1.1": {
"imports": [
"dotnet5.6",
"portable-net45+win8"

View File

@@ -3,6 +3,7 @@ using System.Diagnostics;
using System.IO;
using System.Threading.Tasks;
using Microsoft.AspNetCore.NodeServices;
using Microsoft.AspNetCore.NodeServices.Sockets;
using Microsoft.Extensions.DependencyInjection;
namespace ConsoleApplication
@@ -16,7 +17,10 @@ namespace ConsoleApplication
// Set up the DI system
var services = new ServiceCollection();
services.AddNodeServices(options => {
options.HostingModel = NodeServicesOptions.DefaultNodeHostingModel;
// To compare with Socket hosting, uncomment the following line
// Since .NET Core 1.1, the HTTP hosting model has become basically as fast as the Socket hosting model
//options.UseSocketHosting();
options.ProjectPath = Directory.GetCurrentDirectory();
options.WatchFileExtensions = new string[] {}; // Don't watch anything
});

View File

@@ -5,11 +5,12 @@
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.NodeServices": "1.0.0-*",
"Microsoft.Extensions.DependencyInjection": "1.0.0"
"Microsoft.AspNetCore.NodeServices": "1.1.0-*",
"Microsoft.AspNetCore.NodeServices.Sockets": "1.1.0-*",
"Microsoft.Extensions.DependencyInjection": "1.1.0"
},
"frameworks": {
"netcoreapp1.0": {

View File

@@ -12,29 +12,22 @@
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.AspNetCore.NodeServices": "1.0.0-*"
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.AspNetCore.NodeServices": "1.1.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
"netcoreapp1.0": {}
},
"publishExclude": [
"node_modules",

View File

@@ -1,6 +1,9 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
yarn.lock
wwwroot/dist
# User-specific files
*.suo
*.user

View File

@@ -37,7 +37,9 @@ namespace Webpack.ActionResults
_moduleExport,
request.GetEncodedUrl(),
request.Path + request.QueryString.Value,
_dataToSupply
_dataToSupply,
/* timeoutMilliseconds */ 30000,
/* requestPathBase */ "/"
);
response.ContentType = "text/html";

View File

@@ -11,9 +11,10 @@
"webpack-hot-middleware": "^2.7.1"
},
"dependencies": {
"aspnet-webpack": "^1.0.3",
"aspnet-prerendering": "^1.0.4",
"aspnet-webpack": "^1.0.3",
"ts-loader": "^0.8.1",
"typescript": "^1.7.5"
"typescript": "^2.0.0",
"webpack": "^1.13.3"
}
}

View File

@@ -12,29 +12,22 @@
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.AspNetCore.SpaServices": "1.0.0-*"
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.AspNetCore.SpaServices": "1.1.0-*"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
"netcoreapp1.0": {}
},
"publishOptions": {
"exclude": [

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,4 @@
music-db.sqlite
/wwwroot/dist/
/node_modules/
yarn.lock

View File

@@ -5,19 +5,29 @@ import { match, RouterContext } from 'react-router';
import createMemoryHistory from 'history/lib/createMemoryHistory';
import { routes } from './routes';
import configureStore from './configureStore';
React;
type BootResult = { html?: string, globals?: { [key: string]: any }, redirectUrl?: string};
export default function (params: any): Promise<{ html: string }> {
return new Promise<{ html: string, globals: { [key: string]: any } }>((resolve, reject) => {
return new Promise<BootResult>((resolve, reject) => {
// Match the incoming request against the list of client-side routes
match({ routes, location: params.location }, (error, redirectLocation, renderProps: any) => {
if (error) {
throw error;
}
// If there's a redirection, just send this information back to the host application
if (redirectLocation) {
resolve({ redirectUrl: redirectLocation.pathname });
return;
}
// If it didn't match any route, renderProps will be undefined
if (!renderProps) {
throw new Error(`The location '${ params.url }' doesn't match any route configured in react-router.`);
}
// Build an instance of the application
const history = createMemoryHistory(params.url);
const store = configureStore(history);
const store = configureStore();
const app = (
<Provider store={ store }>
<RouterContext {...renderProps} />

View File

@@ -1,21 +1,25 @@
import './styles/styles.css';
import 'bootstrap/dist/css/bootstrap.css';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { browserHistory, Router } from 'react-router';
import { Provider } from 'react-redux';
React; // Need this reference otherwise TypeScript doesn't think we're using it and ignores the import
import './styles/styles.css';
import 'bootstrap/dist/css/bootstrap.css';
import configureStore from './configureStore';
import { syncHistoryWithStore } from 'react-router-redux';
import { routes } from './routes';
import configureStore from './configureStore';
import { ApplicationState } from './store';
// Get the application-wide store instance, prepopulating with state from the server where available.
const initialState = (window as any).initialReduxState as ApplicationState;
const store = configureStore(browserHistory, initialState);
const store = configureStore(initialState);
const history = syncHistoryWithStore(browserHistory, store);
// This code starts up the React app when it runs in a browser. It sets up the routing configuration
// and injects the app into a DOM element.
ReactDOM.render(
<Provider store={ store }>
<Router history={ browserHistory } children={ routes } />
<Router history={ history } children={ routes } />
</Provider>,
document.getElementById('react-app')
);

View File

@@ -1,28 +1,22 @@
import { createStore, applyMiddleware, compose, combineReducers } from 'redux';
import * as thunkModule from 'redux-thunk';
import { syncHistory, routeReducer } from 'react-router-redux';
import { createStore, applyMiddleware, compose, combineReducers, GenericStoreEnhancer, Store as ReduxStore } from 'redux';
import thunk from 'redux-thunk';
import { routerReducer } from 'react-router-redux';
import * as Store from './store';
import { typedToPlain } from 'redux-typed';
export default function configureStore(history: HistoryModule.History, initialState?: Store.ApplicationState) {
// Build middleware
const thunk = (thunkModule as any).default; // Workaround for TypeScript not importing thunk module as expected
const reduxRouterMiddleware = syncHistory(history);
const middlewares = [thunk, reduxRouterMiddleware, typedToPlain];
const devToolsExtension = null;//(window as any).devToolsExtension; // If devTools is installed, connect to it
const finalCreateStore = compose(
applyMiddleware(...middlewares),
export default function configureStore(initialState?: Store.ApplicationState) {
// Build middleware. These are functions that can process the actions before they reach the store.
const windowIfDefined = typeof window === 'undefined' ? null : window as any;
// If devTools is installed, connect to it
const devToolsExtension = windowIfDefined && windowIfDefined.devToolsExtension as () => GenericStoreEnhancer;
const createStoreWithMiddleware = compose(
applyMiddleware(thunk, typedToPlain),
devToolsExtension ? devToolsExtension() : f => f
)(createStore)
)(createStore);
// Combine all reducers
// Combine all reducers and instantiate the app-wide store instance
const allReducers = buildRootReducer(Store.reducers);
const store = finalCreateStore(allReducers, initialState) as Redux.Store;
// Required for replaying actions from devtools to work
reduxRouterMiddleware.listenForReplays(store);
const store = createStoreWithMiddleware(allReducers, initialState) as ReduxStore<Store.ApplicationState>;
// Enable Webpack hot module replacement for reducers
if (module.hot) {
@@ -36,5 +30,5 @@ export default function configureStore(history: HistoryModule.History, initialSt
}
function buildRootReducer(allReducers) {
return combineReducers(Object.assign({}, allReducers, { routing: routeReducer })) as Redux.Reducer;
return combineReducers<Store.ApplicationState>(Object.assign({}, allReducers, { routing: routerReducer }));
}

View File

@@ -1,45 +1,52 @@
{
"name": "MusicStore",
"name": "music-store",
"version": "0.0.0",
"devDependencies": {
"babel-loader": "^6.2.1",
"babel-plugin-react-transform": "^2.0.0",
"babel-preset-es2015": "^6.3.13",
"babel-preset-react": "^6.3.13",
"dependencies": {
"@types/history": "^2.0.0",
"@types/react": "^0.14.29",
"@types/react-bootstrap": "^0.0.35",
"@types/react-dom": "^0.14.14",
"@types/react-redux": "^4.4.29",
"@types/react-router": "^2.0.30",
"@types/react-router-bootstrap": "^0.0.27",
"@types/react-router-redux": "^4.0.30",
"@types/redux-thunk": "^2.1.28",
"@types/source-map": "^0.1.28",
"@types/uglify-js": "^2.0.27",
"@types/webpack": "^1.12.35",
"@types/webpack-env": "^1.12.1",
"@types/whatwg-fetch": "0.0.28",
"aspnet-prerendering": "^1.0.7",
"aspnet-webpack": "^1.0.17",
"aspnet-webpack-react": "^1.0.2",
"babel-core": "^6.5.2",
"babel-loader": "^6.2.3",
"babel-preset-es2015": "^6.5.0",
"babel-preset-react": "^6.5.0",
"bootstrap": "^3.3.6",
"css-loader": "^0.23.1",
"express": "^4.13.4",
"domain-task": "^2.0.1",
"event-source-polyfill": "^0.0.7",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.8.5",
"react-transform-hmr": "^1.0.2",
"jquery": "^2.2.1",
"react": "^15.3.2",
"react-bootstrap": "^0.30.6",
"react-dom": "^15.3.2",
"react-redux": "^4.4.5",
"react-router": "^2.8.1",
"react-router-bootstrap": "^0.23.1",
"react-router-redux": "^4.0.6",
"redux": "^3.6.0",
"redux-thunk": "^2.1.0",
"redux-typed": "^2.0.0",
"style-loader": "^0.13.0",
"ts-loader": "^0.8.0",
"typescript": "^1.7.5",
"ts-loader": "^0.8.1",
"typescript": "^2.0.3",
"url-loader": "^0.5.7",
"webpack": "^1.12.12",
"webpack-dev-middleware": "^1.5.1",
"webpack-hot-middleware": "^2.6.4"
},
"dependencies": {
"aspnet-prerendering": "^1.0.0",
"aspnet-webpack": "^1.0.3",
"aspnet-webpack-react": "^1.0.1",
"bootstrap": "^3.3.6",
"domain-context": "^0.5.1",
"domain-task": "^2.0.0",
"history": "^2.0.0",
"isomorphic-fetch": "^2.2.1",
"memory-fs": "^0.3.0",
"react": "^0.14.7",
"react-bootstrap": "^0.28.2",
"react-dom": "^0.14.7",
"react-redux": "^4.2.1",
"react-router": "^2.0.0-rc5",
"react-router-bootstrap": "^0.20.1",
"react-router-redux": "^2.1.0",
"redux": "^3.2.1",
"redux-thunk": "^1.0.3",
"redux-typed": "^1.0.0",
"require-from-string": "^1.1.0",
"webpack-externals-plugin": "^1.0.0"
"webpack": "^1.13.2",
"webpack-hot-middleware": "^2.12.2",
"webpack-merge": "^0.14.1",
"webpack-node-externals": "^1.4.3"
}
}

View File

@@ -1,56 +1,80 @@
{
"version": "1.0.0-*",
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"gcServer": true
},
"tooling": {
"defaultNamespace": "MusicStore"
},
"dependencies": {
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.EntityFrameworkCore.SQLite": "1.0.0",
"Microsoft.AspNetCore.ReactServices": "1.0.0-*",
"Microsoft.AspNetCore.ReactServices": "1.1.0-*",
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
"Microsoft.AspNetCore.Mvc": "1.1.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.EntityFrameworkCore.SQLite": "1.1.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
"AutoMapper": "5.0.2"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.DotNet.Watcher.Tools": "1.0.0-preview2-final"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
"imports": []
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"exclude": ["node_modules"]
}
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"exclude": [
"include": [
"appsettings.json",
"ClientApp/dist",
"node_modules",
"bower_components",
"**.xproj",
"**.user",
"**.vspscc"
"Views",
"web.config",
"wwwroot"
],
"exclude": [
"wwwroot/dist/*.map"
]
},
"scripts": {
"prepublish": [ "npm install" ],
"prepublish": [
"npm install",
"node node_modules/webpack/bin/webpack.js"
],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"tooling": {
"defaultNamespace": "MusicStore"
}
}

View File

@@ -1,10 +1,19 @@
{
"compilerOptions": {
"baseUrl": ".",
"moduleResolution": "node",
"target": "es6",
"jsx": "preserve",
"sourceMap": true,
"experimentalDecorators": true
"experimentalDecorators": true,
"types": [ "webpack-env", "whatwg-fetch" ],
"paths": {
// Fix "Duplicate identifier" errors caused by multiple dependencies fetching their own copies of type definitions.
// We tell TypeScript which type definitions module to treat as the canonical one (instead of combining all of them).
"history": ["./node_modules/@types/history/index"],
"redux": ["./node_modules/@types/redux/index"],
"react": ["./node_modules/@types/react/index"]
}
},
"exclude": [
"node_modules"

View File

@@ -1,45 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"react/react.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"react/react-dom.d.ts": {
"commit": "86dbea8fc37d9473fee465da4f0a21bea4f8cbd9"
},
"redux/redux.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"webpack/webpack-env.d.ts": {
"commit": "717a5fdb079f8dd7c19f1b22f7f656dd990f0ccf"
},
"react-redux/react-redux.d.ts": {
"commit": "717a5fdb079f8dd7c19f1b22f7f656dd990f0ccf"
},
"react-bootstrap/react-bootstrap.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"react-router/react-router.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"react-router/history.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"react-router-bootstrap/react-router-bootstrap.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"react-router-redux/react-router-redux.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"redux-thunk/redux-thunk.d.ts": {
"commit": "e69fe60f2d6377ea4fae539493997b098f52cad1"
},
"whatwg-fetch/whatwg-fetch.d.ts": {
"commit": "f4b1797c1201b6c575668f5d7ea12d9b1ab21846"
}
}
}

View File

@@ -1,976 +0,0 @@
// Type definitions for react-bootstrap
// Project: https://github.com/react-bootstrap/react-bootstrap
// Definitions by: Walker Burgin <https://github.com/walkerburgin>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../react/react.d.ts"/>
declare module "react-bootstrap" {
// Import React
import React = require("react");
// <Button />
// ----------------------------------------
interface ButtonProps extends React.Props<ButtonClass>{
// Optional
active?: boolean;
disabled?: boolean;
block?: boolean;
bsStyle?: string;
bsSize?: string;
className?: string;
navItem?: boolean;
navDropdown?: boolean;
componentClass?: string;
href?: string;
onClick?: Function; // Add more specific type
target?: string;
type?: string;
}
interface Button extends React.ReactElement<ButtonProps> { }
interface ButtonClass extends React.ComponentClass<ButtonProps> { }
var Button: ButtonClass;
// <ButtonToolbar />
// ----------------------------------------
interface ButtonToolbarProps extends React.Props<ButtonToolbarClass> {
// Optional
block?: boolean;
bsSize?: string;
bsStyle?: string;
className?: string;
justified?: boolean;
vertical?: boolean;
}
interface ButtonToolbar extends React.ReactElement<ButtonToolbarProps> { }
interface ButtonToolbarClass extends React.ComponentClass<ButtonToolbarProps> { }
var ButtonToolbar: ButtonToolbarClass;
// <ButtonGroup />
// ----------------------------------------
interface ButtonGroupProps extends React.Props<ButtonGroupClass> {
// Optional
block?: boolean;
bsSize?: string;
bsStyle?: string;
className?: string;
justified?: boolean;
vertical?: boolean;
}
interface ButtonGroup extends React.ReactElement<ButtonGroupProps> { }
interface ButtonGroupClass extends React.ComponentClass<ButtonGroupProps> { }
var ButtonGroup: ButtonGroupClass;
// <DropdownButton />
// ----------------------------------------
interface DropdownButtonProps extends React.Props<DropdownButtonClass> {
bsStyle?: string;
bsSize?: string;
buttonClassName?: string;
className?: string;
dropup?: boolean;
href?: string;
id?: string | number;
navItem?: boolean;
noCaret?: boolean;
onClick?: Function; // TODO: Add more specifc type
onSelect?: Function; // TODO: Add more specific type
pullRight?: boolean;
title?: any; // TODO: Add more specific type
}
interface DropdownButton extends React.ReactElement<DropdownButtonProps> { }
interface DropdownButtonClass extends React.ComponentClass<DropdownButtonProps> { }
var DropdownButton: DropdownButtonClass;
// <SplitButton />
// ----------------------------------------
interface SplitButtonProps extends React.Props<SplitButtonClass>{
bsStyle?: string;
bsSize?: string;
className?: string;
disabled?: boolean;
dropdownTitle?: any; // TODO: Add more specific type
dropup?: boolean;
href?: string;
id?: string;
onClick?: Function; // TODO: Add more specific type
onSelect?: Function; // TODO: Add more specific type
pullRight?: boolean;
target?: string;
title?: any; // TODO: Add more specific type
}
interface SplitButton extends React.ReactElement<SplitButtonProps> { }
interface SplitButtonClass extends React.ComponentClass<SplitButtonProps> { }
var SplitButton: SplitButtonClass;
// <MenuItem />
// ----------------------------------------
interface MenuItemProps extends React.Props<MenuItemClass> {
active?: boolean;
className?: string;
disabled?: boolean;
divider?: boolean;
eventKey?: any;
header?: boolean;
href?: string;
onClick?: Function;
onKeyDown?: Function;
onSelect?: Function;
target?: string;
title?: string;
}
interface MenuItem extends React.ReactElement<MenuItemProps> { }
interface MenuItemClass extends React.ComponentClass<MenuItemProps> { }
var MenuItem: MenuItemClass;
// <Panel />
// ----------------------------------------
interface PanelProps extends React.Props<PanelClass> {
className?: string;
bsSize?: string;
bsStyle?: string;
collapsible?: boolean;
defaultExpanded?: boolean;
eventKey?: any;
expanded?: boolean;
footer?: any; // TODO: Add more specific type
header?: any; // TODO: Add more specific type
id?: string;
onSelect?: Function; // TODO: Add more specific type
onClick?: Function; // TODO: Add more specific type
}
interface Panel extends React.ReactElement<PanelProps> { }
interface PanelClass extends React.ComponentClass<PanelProps> { }
var Panel: PanelClass;
// <Accordion />
// ----------------------------------------
interface AccordionProps extends React.Props<AccordionClass> {
bsSize?: string;
bsStyle?: string;
collapsible?: boolean;
defaultExpanded?: boolean;
eventKey?: any;
expanded?: boolean;
footer?: any; // TODO: Add more specific type
header?: any; // TODO: Add more specific type
id?: string;
onSelect?: Function; // TODO: Add more specific type
}
interface Accordion extends React.ReactElement<AccordionProps> { }
interface AccordionClass extends React.ComponentClass<AccordionProps> { }
var Accordion: AccordionClass;
// <PanelGroup />
// ----------------------------------------
interface PanelGroupProps extends React.Props<PanelGroupClass> {
accordion?: boolean;
activeKey?: any;
bsSize?: string;
bsStyle?: string;
className?: string;
defaultActiveKey?: any;
onSelect?: Function;
}
interface PanelGroup extends React.ReactElement<PanelGroupProps> { }
interface PanelGroupClass extends React.ComponentClass<PanelGroupProps> { }
var PanelGroup: PanelGroupClass;
// <Modal.Dialog />
// ----------------------------------------
interface ModalDialogProps extends React.Props<ModalDialogClass> {
// TODO: Add more specific type
}
interface ModalDialog extends React.ReactElement<ModalDialogProps> { }
interface ModalDialogClass extends React.ComponentClass<ModalHeaderProps> { }
// <Modal.Header />
// ----------------------------------------
interface ModalHeaderProps extends React.Props<ModalHeaderClass> {
className?: string;
closeButton?: boolean;
modalClassName?: string;
onHide?: Function;
// undefined?: string;
}
interface ModalHeader extends React.ReactElement<ModalHeaderProps> { }
interface ModalHeaderClass extends React.ComponentClass<ModalHeaderProps> { }
// <Modal.Title/>
// ----------------------------------------
interface ModalTitleProps extends React.Props<ModalTitleClass> {
className?: string;
modalClassName?: string;
}
interface ModalTitle extends React.ReactElement<ModalTitleProps> { }
interface ModalTitleClass extends React.ComponentClass<ModalTitleProps> { }
// <Modal.Body />
// ----------------------------------------
interface ModalBodyProps extends React.Props<ModalBodyClass> {
className?: string;
modalClassName?: string;
}
interface ModalBody extends React.ReactElement<ModalBodyProps> { }
interface ModalBodyClass extends React.ComponentClass<ModalBodyProps> { }
// <Modal.Footer />
// ----------------------------------------
interface ModalFooterProps extends React.Props<ModalFooterClass> {
className?: string;
modalClassName?: string;
}
interface ModalFooter extends React.ReactElement<ModalFooterProps> { }
interface ModalFooterClass extends React.ComponentClass<ModalFooterProps> { }
// <Modal />
// ----------------------------------------
interface ModalProps extends React.Props<ModalClass> {
// Required
onHide: Function;
// Optional
animation?: boolean;
autoFocus?: boolean;
backdrop?: boolean|string;
bsSize?: string;
container?: any; // TODO: Add more specific type
dialogClassName?: string;
dialogComponent?: any; // TODO: Add more specific type
enforceFocus?: boolean;
keyboard?: boolean;
show?: boolean;
}
interface Modal extends React.ReactElement<ModalProps> { }
interface ModalClass extends React.ComponentClass<ModalProps> {
Header: ModalHeaderClass;
Title: ModalTitleClass;
Body: ModalBodyClass;
Footer: ModalFooterClass;
Dialog: ModalDialogClass;
}
var Modal: ModalClass;
// <OverlayTrigger />
// ----------------------------------------
interface OverlayTriggerProps extends React.Props<OverlayTriggerClass> {
// Required
overlay: any; // TODO: Add more specific type
// Optional
animation?: any; // TODO: Add more specific type
container?: any; // TODO: Add more specific type
containerPadding?: number;
defaultOverlayShown?: boolean;
delay?: number;
delayHide?: number;
delayShow?: number;
onEnter?: Function;
onEntered?: Function;
onEntering?: Function;
onExit?: Function;
onExited?: Function;
onExiting?: Function;
placement?: string;
rootClose?: boolean;
trigger?: string;
}
interface OverlayTrigger extends React.ReactElement<OverlayTriggerProps> { }
interface OverlayTriggerClass extends React.ComponentClass<OverlayTriggerProps> { }
var OverlayTrigger: OverlayTriggerClass;
// <Tooltip />
// ----------------------------------------
interface TooltipProps extends React.Props<TooltipClass> {
// Optional
arrowOffsetLeft?: number | string;
arrowOffsetTop?: number | string;
bsSize?: string;
bsStyle?: string;
className?: string;
id?: string;
placement?: string;
positionLeft?: number;
positionTop?: number;
title?: any; // TODO: Add more specific type
}
interface Tooltip extends React.ReactElement<TooltipProps> { }
interface TooltipClass extends React.ComponentClass<TooltipProps> { }
var Tooltip: TooltipClass;
// <Popover/>
// ----------------------------------------
interface PopoverProps extends React.Props<PopoverClass> {
// Optional
arrowOffsetLeft?: number | string;
arrowOffsetTop?: number | string;
bsSize?: string;
bsStyle?: string;
className?: string;
id?: string;
placement?: string;
positionLeft?: number;
positionTop?: number;
title?: any; // TODO: Add more specific type
}
interface Popover extends React.ReactElement<PopoverProps> { }
interface PopoverClass extends React.ComponentClass<PopoverProps> { }
var Popover: PopoverClass;
// <Overlay />
// ----------------------------------------
interface OverlayProps extends React.Props<OverlayClass> {
// Optional
animation?: any; // TODO: Add more specific type
container?: any; // TODO: Add more specific type
containerPadding?: number; // TODO: Add more specific type
onEnter?: Function;
onEntered?: Function;
onEntering?: Function;
onExit?: Function;
onExited?: Function;
onExiting?: Function;
onHide?: Function;
placement?: string;
rootClose?: boolean;
show?: boolean;
target?: Function;
}
interface Overlay extends React.ReactElement<OverlayProps> { }
interface OverlayClass extends React.ComponentClass<OverlayProps> { }
var Overlay: OverlayClass;
// <ProgressBar />
// ----------------------------------------
interface ProgressBarProps extends React.Props<ProgressBarClass> {
// Optional
active?: boolean;
bsSize?: string;
bsStyle?: string;
className?: string;
interpolatedClass?: any; // TODO: Add more specific type
label?: any; // TODO: Add more specific type
max?: number;
min?: number;
now?: number;
srOnly?: boolean;
striped?: boolean;
}
interface ProgressBar extends React.ReactElement<ProgressBarProps> { }
interface ProgressBarClass extends React.ComponentClass<ProgressBarProps> { }
var ProgressBar: ProgressBarClass;
// <Nav />
// ----------------------------------------
// TODO: This one turned into a union of two different types
interface NavProps extends React.Props<NavClass> {
// Optional
activeHref?: string;
activeKey?: any;
bsSize?: string;
bsStyle?: string;
className?: string;
collapsible?: boolean;
eventKey?: any;
expanded?: boolean;
id?: string;
justified?: boolean;
navbar?: boolean;
onSelect?: Function;
pullRight?: boolean;
right?: boolean;
stacked?: boolean;
ulClassName?: string;
ulId?: string;
}
interface Nav extends React.ReactElement<NavProps> { }
interface NavClass extends React.ComponentClass<NavProps> { }
var Nav: NavClass;
// <NavItem />
// ----------------------------------------
interface NavItemProps extends React.Props<NavItemClass> {
active?: boolean;
brand?: any; // TODO: Add more specific type
bsSize?: string;
bsStyle?: string;
className?: string;
componentClass?: any; // TODO: Add more specific type
defaultNavExpanded?: boolean;
disabled?: boolean;
eventKey?: any;
fixedBottom?: boolean;
fixedTop?: boolean;
fluid?: boolean;
href?: string;
inverse?: boolean;
linkId?: string;
navExpanded?: boolean;
onClick?: Function;
onSelect?: Function;
onToggle?: Function;
role?: string;
staticTop?: boolean;
target?: string;
title?: string;
toggleButton?: any; // TODO: Add more specific type
toggleNavKey?: string | number;
}
interface NavItem extends React.ReactElement<NavItemProps> { }
interface NavItemClass extends React.ComponentClass<NavItemProps> { }
var NavItem: NavItemClass;
// <Navbar.Brand />
// ----------------------------------------
interface NavbarBrandProps extends React.Props<NavbarBrandClass> {
}
interface NavbarBrand extends React.ReactElement<NavbarBrandProps> { }
interface NavbarBrandClass extends React.ComponentClass<NavbarBrandProps> { }
// <Navbar.Collapse />
// ----------------------------------------
interface NavbarCollapseProps extends React.Props<NavbarCollapseClass> {
}
interface NavbarCollapse extends React.ReactElement<NavbarCollapseProps> { }
interface NavbarCollapseClass extends React.ComponentClass<NavbarCollapseProps> { }
// <Navbar.Header />
// ----------------------------------------
interface NavbarHeaderProps extends React.Props<NavbarHeaderClass> {
}
interface NavbarHeader extends React.ReactElement<NavbarHeaderProps> { }
interface NavbarHeaderClass extends React.ComponentClass<NavbarHeaderProps> { }
// <Navbar.Toggle />
// ----------------------------------------
interface NavbarToggleProps extends React.Props<NavbarToggleClass> {
}
interface NavbarToggle extends React.ReactElement<NavbarToggleProps> { }
interface NavbarToggleClass extends React.ComponentClass<NavbarToggleProps> { }
// <Navbar />
// ----------------------------------------
interface NavbarProps extends React.Props<NavbarClass> {
brand?: any; // TODO: Add more specific type
bsSize?: string;
bsStyle?: string;
className?: string;
componentClass?: any; // TODO: Add more specific type
defaultNavExpanded?: boolean;
fixedBottom?: boolean;
fixedTop?: boolean;
fluid?: boolean;
inverse?: boolean;
navExpanded?: boolean;
onToggle?: Function;
role?: string;
staticTop?: boolean;
toggleButton?: any; // TODO: Add more specific type
toggleNavKey?: string | number;
}
interface Navbar extends React.ReactElement<NavbarProps> { }
interface NavbarClass extends React.ComponentClass<NavbarProps> {
Brand: NavbarBrandClass;
Collapse: NavbarCollapseClass;
Header: NavbarHeaderClass;
Toggle: NavbarToggleClass;
}
var Navbar: NavbarClass;
// <NavBrand />
// ----------------------------------------
interface NavBrandProps {
}
interface NavBrand extends React.ReactElement<NavbarProps> { }
interface NavBrandClass extends React.ComponentClass<NavbarProps> { }
var NavBrand: NavBrandClass;
// <NavDropdown />
// ----------------------------------------
interface NavDropdownProps extends React.Props<NavDropdownClass> {
className?: string;
eventKey?: any;
title?: string;
id?: string;
}
interface NavDropdown extends React.ReactElement<NavDropdownProps> { }
interface NavDropdownClass extends React.ComponentClass<NavDropdownProps> { }
var NavDropdown: NavDropdownClass;
// <Tabs />
// ----------------------------------------
interface TabsProps extends React.Props<TabsClass> {
activeKey?: any;
animation?: boolean;
bsStyle?: string;
defaultActiveKey?: any;
id?: string | number;
onSelect?: Function;
paneWidth?: any; // TODO: Add more specific type
position?: string;
tabWidth?: any; // TODO: Add more specific type
}
interface Tabs extends React.ReactElement<TabsProps> { }
interface TabsClass extends React.ComponentClass<TabsProps> { }
var Tabs: TabsClass;
// <Tab />
// ----------------------------------------
interface TabProps extends React.Props<TabClass> {
animation?: boolean;
className?: string;
disabled?: boolean;
eventKey?: any; // TODO: Add more specific type
title?: any; // TODO: Add more specific type
}
interface Tab extends React.ReactElement<TabProps> { }
interface TabClass extends React.ComponentClass<TabProps> { }
var Tab: TabClass;
// <Pager />
// ----------------------------------------
interface PagerProps extends React.Props<PagerClass> {
className?: string;
onSelect?: Function;
}
interface Pager extends React.ReactElement<PagerProps> { }
interface PagerClass extends React.ComponentClass<PagerProps> { }
var Pager: PagerClass;
// <PageItem />
// ----------------------------------------
interface PageItemProps extends React.Props<PageItemClass> {
className?: string;
disabled?: boolean;
eventKey?: any;
href?: string;
next?: boolean;
onSelect?: Function;
previous?: boolean;
target?: string;
title?: string;
}
interface PageItem extends React.ReactElement<PageItemProps> { }
interface PageItemClass extends React.ComponentClass<PageItemProps> { }
var PageItem: PageItemClass;
// <Pagination />
// ----------------------------------------
interface PaginationProps extends React.Props<PaginationClass> {
activePage?: number;
bsSize?: string;
bsStyle?: string;
buttonComponentClass?: any; // TODO: Add more specific type
className?: string;
ellipsis?: boolean;
first?: boolean;
items?: number;
last?: boolean;
maxButtons?: number;
next?: boolean;
onSelect?: Function;
prev?: boolean;
}
interface Pagination extends React.ReactElement<PaginationProps> { }
interface PaginationClass extends React.ComponentClass<PaginationProps> { }
var Pagination: PaginationClass;
// <Alert />
// ----------------------------------------
interface AlertProps extends React.Props<AlertClass> {
bsSize?: string;
bsStyle?: string;
className?: string;
closeLabel?: string;
dismissAfter?: number;
onDismiss?: Function;
}
interface Alert extends React.ReactElement<AlertProps> { }
interface AlertClass extends React.ComponentClass<AlertProps> { }
var Alert: AlertClass;
// <Carousel />
// ----------------------------------------
interface CarouselProps extends React.Props<CarouselClass> {
activeIndex?: number;
bsSize?: string;
bsStyle?: string;
className?: string;
controls?: boolean;
defaultActiveIndex?: number;
direction?: string;
indicators?: boolean;
interval?: number;
nextIcon?: any; // TODO: Add more specific type
onSelect?: Function;
onSlideEnd?: Function;
pauseOnHover?: boolean;
prevIcon?: any; // TODO: Add more specific type
slide?: boolean;
wrap?: boolean;
}
interface Carousel extends React.ReactElement<CarouselProps> { }
interface CarouselClass extends React.ComponentClass<CarouselProps> { }
var Carousel: CarouselClass;
// <CarouselItem />
// ----------------------------------------
interface CarouselItemProps extends React.Props<CarouselItemClass> {
active?: boolean;
animtateIn?: boolean;
animateOut?: boolean;
caption?: any; // TODO: Add more specific type
className?: string;
direction?: string;
index?: number;
onAnimateOutEnd?: Function;
}
interface CarouselItem extends React.ReactElement<CarouselItemProps> { }
interface CarouselItemClass extends React.ComponentClass<CarouselItemProps> { }
var CarouselItem: CarouselItemClass;
// <Grid />
// ----------------------------------------
interface GridProps extends React.Props<GridClass> {
className?: string;
componentClass?: any; // TODO: Add more specific type
fluid?: boolean;
}
interface Grid extends React.ReactElement<GridProps> { }
interface GridClass extends React.ComponentClass<GridProps> { }
var Grid: GridClass;
// <Row />
// ----------------------------------------
interface RowProps extends React.Props<RowClass> {
className?: string;
componentClass?: any; // TODO: Add more specific type
}
interface Row extends React.ReactElement<RowProps> { }
interface RowClass extends React.ComponentClass<RowProps> { }
var Row: RowClass;
// <Col />
// ----------------------------------------
interface ColProps extends React.Props<ColClass> {
className?: string;
componentClass?: any; // TODO: Add more specific type
lg?: number;
lgOffset?: number;
lgPull?: number;
lgPush?: number;
md?: number;
mdOffset?: number;
mdPull?: number;
mdPush?: number;
sm?: number;
smOffset?: number;
smPull?: number;
smPush?: number;
xs?: number;
xsOffset?: number;
xsPull?: number;
xsPush?: number;
}
interface Col extends React.ReactElement<ColProps> { }
interface ColClass extends React.ComponentClass<ColProps> { }
var Col: ColClass;
// <Thumbnail />
// ----------------------------------------
interface ThumbnailProps extends React.Props<ThumbnailClass> {
alt?: string;
bsSize?: string;
bsStyle?: string;
className?: string;
href?: string;
src?: string;
}
interface Thumbnail extends React.ReactElement<ThumbnailProps> { }
interface ThumbnailClass extends React.ComponentClass<ThumbnailProps> { }
var Thumbnail: ThumbnailClass;
// <ListGroup />
// ----------------------------------------
interface ListGroupProps extends React.Props<ListGroupClass> {
className?: string;
id?: string | number;
fill?: boolean; // TODO: Add more specific type
}
interface ListGroup extends React.ReactElement<ListGroupProps> { }
interface ListGroupClass extends React.ComponentClass<ListGroupProps> { }
var ListGroup: ListGroupClass;
// <ListGroupItem />
// ----------------------------------------
interface ListGroupItemProps extends React.Props<ListGroupItemClass> {
active?: any;
bsSize?: string;
bsStyle?: string;
className?: string;
disabled?: any;
eventKey?: any;
header?: any; // TODO: Add more specific type
href?: string;
key?: any; // TODO: Add more specific type
listItem?: boolean;
onClick?: Function; // TODO: Add more specific type
target?: string;
}
interface ListGroupItem extends React.ReactElement<ListGroupItemProps> { }
interface ListGroupItemClass extends React.ComponentClass<ListGroupItemProps> { }
var ListGroupItem: ListGroupItemClass;
// <Label />
// ----------------------------------------
interface LabelProps extends React.Props<LabelClass> {
bsSize?: string;
bsStyle?: string;
className?: string;
}
interface Label extends React.ReactElement<LabelProps> { }
interface LabelClass extends React.ComponentClass<LabelProps> { }
var Label: LabelClass;
// <Badge />
// ----------------------------------------
interface BadgeProps extends React.Props<BadgeClass> {
className?: string;
pullRight?: boolean;
}
interface Badge extends React.ReactElement<BadgeProps> { }
interface BadgeClass extends React.ComponentClass<BadgeProps> { }
var Badge: BadgeClass;
// <Jumbotron />
// ----------------------------------------
interface JumbotronProps extends React.Props<JumbotronClass> {
className?: string;
componentClass?: any; // TODO: Add more specific type
}
interface Jumbotron extends React.ReactElement<JumbotronProps> { }
interface JumbotronClass extends React.ComponentClass<JumbotronProps> { }
var Jumbotron: JumbotronClass;
// <PageHeader />
// ----------------------------------------
interface PageHeaderProps extends React.Props<PageHeaderClass> {
className?: string;
}
interface PageHeader extends React.ReactElement<PageHeaderProps> { }
interface PageHeaderClass extends React.ComponentClass<PageHeaderProps> { }
var PageHeader: PageHeaderClass;
// <Well />
// ----------------------------------------
interface WellProps extends React.Props<WellClass> {
bsSize?: string;
bsStyle?: string;
className?: string;
}
interface Well extends React.ReactElement<WellProps> { }
interface WellClass extends React.ComponentClass<WellProps> { }
var Well: WellClass;
// <Glyphicon />
// ----------------------------------------
interface GlyphiconProps extends React.Props<GlyphiconClass> {
className?: string;
// Required
glyph: string;
}
interface Glyphicon extends React.ReactElement<GlyphiconProps> { }
interface GlyphiconClass extends React.ComponentClass<GlyphiconProps> { }
var Glyphicon: GlyphiconClass;
// <Table />
// ----------------------------------------
interface TableProps extends React.Props<TableClass> {
bordered?: boolean;
className?: string;
condensed?: boolean;
hover?: boolean;
responsive?: boolean;
striped?: boolean;
}
interface Table extends React.ReactElement<TableProps> { }
interface TableClass extends React.ComponentClass<TableProps> { }
var Table: TableClass;
// <Input />
// ----------------------------------------
interface InputProps extends React.Props<InputClass> {
defaultValue?:string;
addonAfter?: any; // TODO: Add more specific type
addonBefore?: any; // TODO: Add more specific type
bsSize?: string;
bsStyle?: string;
buttonAfter?: any; // TODO: Add more specific type
buttonBefore?: any; // TODO: Add more specific type
className?: string;
checked?: boolean;
disabled?: boolean;
feedbackIcon?: any; // TODO: Add more specific type
groupClassName?: string;
hasFeedback?: boolean;
help?: any; // TODO: Add more specific type
id?: string | number;
label?: any; // TODO: Add more specific type
labelClassName?: string;
multiple?: boolean;
placeholder?: string;
readOnly?: boolean;
type?: string;
onChange?: Function; // TODO: Add more specific type
onKeyDown?: Function; // TODO: Add more specific type
onKeyUp?: Function; // TODO: Add more specific type
onKeyPress?: Function; // TODO: Add more specific type
value?: any; // TODO: Add more specific type
wrapperClassName?: string;
}
interface Input extends React.ReactElement<InputProps> { }
interface InputClass extends React.ComponentClass<InputProps> { }
var Input: InputClass;
// <ButtonInput />
// ----------------------------------------
interface ButtonInputProps extends React.Props<ButtonInputClass> {
addonAfter?: any; // TODO: Add more specific type
addonBefore?: any; // TODO: Add more specific type
bsSize?: string;
bsStyle?: string;
buttonAfter?: any; // TODO: Add more specific type
buttonBefore?: any; // TODO: Add more specific type
className?: string;
disabled?: boolean;
feedbackIcon?: any; // TODO: Add more specific type
groupClassName?: string;
hasFeedback?: boolean;
help?: any; // TODO: Add more specific type
id?: string | number;
label?: any; // TODO: Add more specific type
labelClassName?: string;
multiple?: boolean;
onClick?: Function; // TODO: Add more specific type
type?: string;
value?: any; // TODO: Add more specific type
wrapperClassName?: string;
}
interface ButtonInput extends React.ReactElement<ButtonInputProps> { }
interface ButtonInputClass extends React.ComponentClass<ButtonInputProps> { }
var ButtonInput: ButtonInputClass;
// TODO: FormControls.Static
// <Portal />
// ----------------------------------------
interface PortalProps extends React.Props<PortalClass> {
dimension?: string | Function;
getDimensionValue?: Function;
in?: boolean;
onEnter?: Function;
onEntered?: Function;
onEntering?: Function;
onExit?: Function;
onExited?: Function;
onExiting?: Function;
role?: string;
timeout?: number;
transitionAppear?: boolean;
unmountOnExit?: boolean;
}
interface Portal extends React.ReactElement<PortalProps> { }
interface PortalClass extends React.ComponentClass<PortalProps> { }
var Portal: PortalClass;
// <Position />
// ----------------------------------------
interface PositionProps extends React.Props<PositionClass> {
dimension?: string | Function;
getDimensionValue?: Function;
in?: boolean;
onEnter?: Function;
onEntered?: Function;
onEntering?: Function;
onExit?: Function;
onExited?: Function;
onExiting?: Function;
role?: string;
timeout?: number;
transitionAppear?: boolean;
unmountOnExit?: boolean;
}
interface Position extends React.ReactElement<PositionProps> { }
interface PositionClass extends React.ComponentClass<PositionProps> { }
var Position: PositionClass;
// <Fade />
// ----------------------------------------
interface FadeProps extends React.Props<FadeClass> {
in?: boolean;
onEnter?: Function;
onEntered?: Function;
onEntering?: Function;
onExit?: Function;
onExited?: Function;
onExiting?: Function;
timeout?: number;
transitionAppear?: boolean;
unmountOnExit?: boolean;
}
interface Fade extends React.ReactElement<FadeProps> { }
interface FadeClass extends React.ComponentClass<FadeProps> { }
var Fade: FadeClass;
}

View File

@@ -1,69 +0,0 @@
// Type definitions for react-redux 2.1.2
// Project: https://github.com/rackt/react-redux
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../react/react.d.ts" />
/// <reference path="../redux/redux.d.ts" />
declare module "react-redux" {
import { Component } from 'react';
import { Store, Dispatch, ActionCreator } from 'redux';
export class ElementClass extends Component<any, any> { }
export interface ClassDecorator {
<T extends (typeof ElementClass)>(component: T): T
}
/**
* Connects a React component to a Redux store.
* @param mapStateToProps
* @param mapDispatchToProps
* @param mergeProps
* @param options
*/
export function connect(mapStateToProps?: MapStateToProps,
mapDispatchToProps?: MapDispatchToPropsFunction|MapDispatchToPropsObject,
mergeProps?: MergeProps,
options?: Options): ClassDecorator;
interface MapStateToProps {
(state: any, ownProps?: any): any;
}
interface MapDispatchToPropsFunction {
(dispatch: Dispatch, ownProps?: any): any;
}
interface MapDispatchToPropsObject {
[name: string]: ActionCreator;
}
interface MergeProps {
(stateProps: any, dispatchProps: any, ownProps: any): any;
}
interface Options {
/**
* If true, implements shouldComponentUpdate and shallowly compares the result of mergeProps,
* preventing unnecessary updates, assuming that the component is a “pure” component
* and does not rely on any input or state other than its props and the selected Redux stores state.
* Defaults to true.
* @default true
*/
pure: boolean;
}
export interface Property {
/**
* The single Redux store in your application.
*/
store?: Store;
children?: Function;
}
/**
* Makes the Redux store available to the connect() calls in the component hierarchy below.
*/
export class Provider extends Component<Property, {}> { }
}

View File

@@ -1,46 +0,0 @@
// Type definitions for react-router-bootstrap
// Project: https://github.com/react-bootstrap/react-router-bootstrap
// Definitions by: Vincent Lesierse <https://github.com/vlesierse>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
///<reference path="../react/react.d.ts"/>
///<reference path="../react-router/react-router.d.ts"/>
declare namespace ReactRouterBootstrap {
// Import React
import React = __React;
interface LinkContainerProps extends ReactRouter.LinkProps {
disabled?: boolean
}
interface LinkContainer extends React.ComponentClass<LinkContainerProps> {}
interface LinkContainerElement extends React.ReactElement<LinkContainerProps> {}
const LinkContainer: LinkContainer
const IndexLinkContainer: LinkContainer
}
declare module "react-router-bootstrap/lib/LinkContainer" {
export default ReactRouterBootstrap.LinkContainer
}
declare module "react-router-bootstrap/lib/IndexLinkContainer" {
export default ReactRouterBootstrap.IndexLinkContainer
}
declare module "react-router-bootstrap" {
import LinkContainer from "react-router-bootstrap/lib/LinkContainer"
import IndexLinkContainer from "react-router-bootstrap/lib/IndexLinkContainer"
export {
LinkContainer,
IndexLinkContainer
}
}

View File

@@ -1,48 +0,0 @@
// Type definitions for react-router-redux v2.1.0
// Project: https://github.com/rackt/react-router-redux
// Definitions by: Isman Usoh <http://github.com/isman-usoh>, Noah Shipley <https://github.com/noah79>, Dimitri Rosenberg <https://github.com/rosendi>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../redux/redux.d.ts" />
/// <reference path="../react-router/react-router.d.ts"/>
declare namespace ReactRouterRedux {
import R = Redux;
import H = HistoryModule;
const TRANSITION: string;
const UPDATE_LOCATION: string;
const push: PushAction;
const replace: ReplaceAction;
const go: GoAction;
const goBack: GoForwardAction;
const goForward: GoBackAction;
const routeActions: RouteActions;
type LocationDescriptor = H.Location | H.Path;
type PushAction = (nextLocation: LocationDescriptor) => void;
type ReplaceAction = (nextLocation: LocationDescriptor) => void;
type GoAction = (n: number) => void;
type GoForwardAction = () => void;
type GoBackAction = () => void;
interface RouteActions {
push: PushAction;
replace: ReplaceAction;
go: GoAction;
goForward: GoForwardAction;
goBack: GoBackAction;
}
interface HistoryMiddleware extends R.Middleware {
listenForReplays(store: R.Store, selectLocationState?: Function): void;
unsubscribe(): void;
}
function routeReducer(state?: any, options?: any): R.Reducer;
function syncHistory(history: H.History): HistoryMiddleware;
}
declare module "react-router-redux" {
export = ReactRouterRedux;
}

View File

@@ -1,192 +0,0 @@
// Type definitions for history v1.13.1
// Project: https://github.com/rackt/history
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare namespace HistoryModule {
// types based on https://github.com/rackt/history/blob/master/docs/Terms.md
type Action = string
type BeforeUnloadHook = () => string | boolean
type CreateHistory<T> = (options?: HistoryOptions) => T
type CreateHistoryEnhancer<T, E> = (createHistory: CreateHistory<T>) => CreateHistory<T & E>
interface History {
listenBefore(hook: TransitionHook): Function
listen(listener: LocationListener): Function
transitionTo(location: Location): void
pushState(state: LocationState, path: Path): void
replaceState(state: LocationState, path: Path): void
push(path: Path): void
replace(path: Path): void
go(n: number): void
goBack(): void
goForward(): void
createKey(): LocationKey
createPath(path: Path): Path
createHref(path: Path): Href
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
/** @deprecated use location.key to save state instead */
setState(state: LocationState): void
/** @deprecated use listenBefore instead */
registerTransitionHook(hook: TransitionHook): void
/** @deprecated use the callback returned from listenBefore instead */
unregisterTransitionHook(hook: TransitionHook): void
}
type HistoryOptions = Object
type Href = string
type Location = {
pathname: Pathname
search: QueryString
query: Query
state: LocationState
action: Action
key: LocationKey
}
type LocationKey = string
type LocationListener = (location: Location) => void
type LocationState = Object
type Path = string // Pathname + QueryString
type Pathname = string
type Query = Object
type QueryString = string
type TransitionHook = (location: Location, callback: Function) => any
interface HistoryBeforeUnload {
listenBeforeUnload(hook: BeforeUnloadHook): Function
}
interface HistoryQueries {
pushState(state: LocationState, pathname: Pathname | Path, query?: Query): void
replaceState(state: LocationState, pathname: Pathname | Path, query?: Query): void
createPath(path: Path, query?: Query): Path
createHref(path: Path, query?: Query): Href
}
// Global usage, without modules, needs the small trick, because lib.d.ts
// already has `history` and `History` global definitions:
// var createHistory = ((window as any).History as HistoryModule.Module).createHistory;
interface Module {
createHistory: CreateHistory<History>
createHashHistory: CreateHistory<History>
createMemoryHistory: CreateHistory<History>
createLocation(path?: Path, state?: LocationState, action?: Action, key?: LocationKey): Location
useBasename<T>(createHistory: CreateHistory<T>): CreateHistory<T>
useBeforeUnload<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryBeforeUnload>
useQueries<T>(createHistory: CreateHistory<T>): CreateHistory<T & HistoryQueries>
actions: {
PUSH: string
REPLACE: string
POP: string
}
}
}
declare module "history/lib/createBrowserHistory" {
export default function createBrowserHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
}
declare module "history/lib/createHashHistory" {
export default function createHashHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
}
declare module "history/lib/createMemoryHistory" {
export default function createMemoryHistory(options?: HistoryModule.HistoryOptions): HistoryModule.History
}
declare module "history/lib/createLocation" {
export default function createLocation(path?: HistoryModule.Path, state?: HistoryModule.LocationState, action?: HistoryModule.Action, key?: HistoryModule.LocationKey): HistoryModule.Location
}
declare module "history/lib/useBasename" {
export default function useBasename<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T>
}
declare module "history/lib/useBeforeUnload" {
export default function useBeforeUnload<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryBeforeUnload>
}
declare module "history/lib/useQueries" {
export default function useQueries<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryModule.HistoryQueries>
}
declare module "history/lib/actions" {
export const PUSH: string
export const REPLACE: string
export const POP: string
export default {
PUSH,
REPLACE,
POP
}
}
declare module "history" {
export { default as createHistory } from "history/lib/createBrowserHistory"
export { default as createHashHistory } from "history/lib/createHashHistory"
export { default as createMemoryHistory } from "history/lib/createMemoryHistory"
export { default as createLocation } from "history/lib/createLocation"
export { default as useBasename } from "history/lib/useBasename"
export { default as useBeforeUnload } from "history/lib/useBeforeUnload"
export { default as useQueries } from "history/lib/useQueries"
import * as Actions from "history/lib/actions"
export { Actions }
}

View File

@@ -1,474 +0,0 @@
// Type definitions for react-router v2.0.0-rc5
// Project: https://github.com/rackt/react-router
// Definitions by: Sergey Buturlakin <http://github.com/sergey-buturlakin>, Yuichi Murata <https://github.com/mrk21>, Václav Ostrožlík <https://github.com/vasek17>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../react/react.d.ts" />
/// <reference path="./history.d.ts"/>
declare namespace ReactRouter {
import React = __React
import H = HistoryModule
// types based on https://github.com/rackt/react-router/blob/master/docs/Glossary.md
type Component = React.ReactType
type EnterHook = (nextState: RouterState, replaceState: RedirectFunction, callback?: Function) => any
type LeaveHook = () => any
type Params = Object
type ParseQueryString = (queryString: H.QueryString) => H.Query
type RedirectFunction = (state: H.LocationState, pathname: H.Pathname | H.Path, query?: H.Query) => void
type RouteComponent = Component
// use the following interface in an app code to get access to route param values, history, location...
// interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> {}
// somewhere in MyComponent
// ...
// let id = this.props.routeParams.id
// ...
// this.props.history. ...
// ...
interface RouteComponentProps<P, R> {
history?: History
location?: H.Location
params?: P
route?: PlainRoute
routeParams?: R
routes?: PlainRoute[]
children?: React.ReactElement<any>
}
type RouteComponents = { [key: string]: RouteComponent }
type RouteConfig = React.ReactNode | PlainRoute | PlainRoute[]
type RouteHook = (nextLocation?: H.Location) => any
type RoutePattern = string
type StringifyQuery = (queryObject: H.Query) => H.QueryString
type RouterListener = (error: Error, nextState: RouterState) => void
interface RouterState {
location: H.Location
routes: PlainRoute[]
params: Params
components: RouteComponent[]
}
interface HistoryBase extends H.History {
routes: PlainRoute[]
parseQueryString?: ParseQueryString
stringifyQuery?: StringifyQuery
}
type History = HistoryBase & H.HistoryQueries & HistoryRoutes
const browserHistory: History;
const hashHistory: History;
/* components */
interface RouterProps extends React.Props<Router> {
history?: H.History
routes?: RouteConfig // alias for children
createElement?: (component: RouteComponent, props: Object) => any
onError?: (error: any) => any
onUpdate?: () => any
parseQueryString?: ParseQueryString
stringifyQuery?: StringifyQuery
}
interface Router extends React.ComponentClass<RouterProps> {}
interface RouterElement extends React.ReactElement<RouterProps> {}
const Router: Router
interface LinkProps extends React.HTMLAttributes, React.Props<Link> {
activeStyle?: React.CSSProperties
activeClassName?: string
onlyActiveOnIndex?: boolean
to: RoutePattern
query?: H.Query
state?: H.LocationState
}
interface Link extends React.ComponentClass<LinkProps> {}
interface LinkElement extends React.ReactElement<LinkProps> {}
const Link: Link
const IndexLink: Link
interface RouterContextProps extends React.Props<RouterContext> {
history?: H.History
router: Router
createElement: (component: RouteComponent, props: Object) => any
location: H.Location
routes: RouteConfig
params: Params
components?: RouteComponent[]
}
interface RouterContext extends React.ComponentClass<RouterContextProps> {}
interface RouterContextElement extends React.ReactElement<RouterContextProps> {
history?: H.History
location: H.Location
router?: Router
}
const RouterContext: RouterContext
/* components (configuration) */
interface RouteProps extends React.Props<Route> {
path?: RoutePattern
component?: RouteComponent
components?: RouteComponents
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
onEnter?: EnterHook
onLeave?: LeaveHook
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
}
interface Route extends React.ComponentClass<RouteProps> {}
interface RouteElement extends React.ReactElement<RouteProps> {}
const Route: Route
interface PlainRoute {
path?: RoutePattern
component?: RouteComponent
components?: RouteComponents
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
onEnter?: EnterHook
onLeave?: LeaveHook
indexRoute?: PlainRoute
getIndexRoute?: (location: H.Location, cb: (error: any, indexRoute: RouteConfig) => void) => void
childRoutes?: PlainRoute[]
getChildRoutes?: (location: H.Location, cb: (error: any, childRoutes: RouteConfig) => void) => void
}
interface RedirectProps extends React.Props<Redirect> {
path?: RoutePattern
from?: RoutePattern // alias for path
to: RoutePattern
query?: H.Query
state?: H.LocationState
}
interface Redirect extends React.ComponentClass<RedirectProps> {}
interface RedirectElement extends React.ReactElement<RedirectProps> {}
const Redirect: Redirect
interface IndexRouteProps extends React.Props<IndexRoute> {
component?: RouteComponent
components?: RouteComponents
getComponent?: (location: H.Location, cb: (error: any, component?: RouteComponent) => void) => void
getComponents?: (location: H.Location, cb: (error: any, components?: RouteComponents) => void) => void
onEnter?: EnterHook
onLeave?: LeaveHook
}
interface IndexRoute extends React.ComponentClass<IndexRouteProps> {}
interface IndexRouteElement extends React.ReactElement<IndexRouteProps> {}
const IndexRoute: IndexRoute
interface IndexRedirectProps extends React.Props<IndexRedirect> {
to: RoutePattern
query?: H.Query
state?: H.LocationState
}
interface IndexRedirect extends React.ComponentClass<IndexRedirectProps> {}
interface IndexRedirectElement extends React.ReactElement<IndexRedirectProps> {}
const IndexRedirect: IndexRedirect
/* mixins */
interface HistoryMixin {
history: History
}
const History: React.Mixin<any, any>
interface LifecycleMixin {
routerWillLeave(nextLocation: H.Location): string | boolean
}
const Lifecycle: React.Mixin<any, any>
const RouteContext: React.Mixin<any, any>
/* utils */
interface HistoryRoutes {
listen(listener: RouterListener): Function
listenBeforeLeavingRoute(route: PlainRoute, hook: RouteHook): void
match(location: H.Location, callback: (error: any, nextState: RouterState, nextLocation: H.Location) => void): void
isActive(pathname: H.Pathname, query?: H.Query, indexOnly?: boolean): boolean
}
function useRoutes<T>(createHistory: HistoryModule.CreateHistory<T>): HistoryModule.CreateHistory<T & HistoryRoutes>
function createRoutes(routes: RouteConfig): PlainRoute[]
interface MatchArgs {
routes?: RouteConfig
history?: H.History
location?: H.Location
parseQueryString?: ParseQueryString
stringifyQuery?: StringifyQuery
}
interface MatchState extends RouterState {
history: History
}
function match(args: MatchArgs, cb: (error: any, nextLocation: H.Location, nextState: MatchState) => void): void
}
declare module "react-router/lib/Router" {
export default ReactRouter.Router
}
declare module "react-router/lib/Link" {
export default ReactRouter.Link
}
declare module "react-router/lib/IndexLink" {
export default ReactRouter.IndexLink
}
declare module "react-router/lib/IndexRedirect" {
export default ReactRouter.IndexRedirect
}
declare module "react-router/lib/IndexRoute" {
export default ReactRouter.IndexRoute
}
declare module "react-router/lib/Redirect" {
export default ReactRouter.Redirect
}
declare module "react-router/lib/Route" {
export default ReactRouter.Route
}
declare module "react-router/lib/History" {
export default ReactRouter.History
}
declare module "react-router/lib/Lifecycle" {
export default ReactRouter.Lifecycle
}
declare module "react-router/lib/RouteContext" {
export default ReactRouter.RouteContext
}
declare module "react-router/lib/useRoutes" {
export default ReactRouter.useRoutes
}
declare module "react-router/lib/PatternUtils" {
export function formatPattern(pattern: string, params: {}): string;
}
declare module "react-router/lib/RouteUtils" {
type E = __React.ReactElement<any>
export function isReactChildren(object: E | E[]): boolean
export function createRouteFromReactElement(element: E): ReactRouter.PlainRoute
export function createRoutesFromReactChildren(children: E | E[], parentRoute: ReactRouter.PlainRoute): ReactRouter.PlainRoute[]
export import createRoutes = ReactRouter.createRoutes
}
declare module "react-router/lib/RouterContext" {
export default ReactRouter.RouterContext
}
declare module "react-router/lib/PropTypes" {
import React = __React
export function falsy(props: any, propName: string, componentName: string): Error;
export const history: React.Requireable<any>
export const location: React.Requireable<any>
export const component: React.Requireable<any>
export const components: React.Requireable<any>
export const route: React.Requireable<any>
export const routes: React.Requireable<any>
export default {
falsy,
history,
location,
component,
components,
route
}
}
declare module "react-router/lib/browserHistory" {
export default ReactRouter.browserHistory;
}
declare module "react-router/lib/hashHistory" {
export default ReactRouter.hashHistory;
}
declare module "react-router/lib/match" {
export default ReactRouter.match
}
declare module "react-router" {
import Router from "react-router/lib/Router"
import Link from "react-router/lib/Link"
import IndexLink from "react-router/lib/IndexLink"
import IndexRedirect from "react-router/lib/IndexRedirect"
import IndexRoute from "react-router/lib/IndexRoute"
import Redirect from "react-router/lib/Redirect"
import Route from "react-router/lib/Route"
import History from "react-router/lib/History"
import Lifecycle from "react-router/lib/Lifecycle"
import RouteContext from "react-router/lib/RouteContext"
import browserHistory from "react-router/lib/browserHistory"
import hashHistory from "react-router/lib/hashHistory"
import useRoutes from "react-router/lib/useRoutes"
import { createRoutes } from "react-router/lib/RouteUtils"
import { formatPattern } from "react-router/lib/PatternUtils"
import RouterContext from "react-router/lib/RouterContext"
import PropTypes from "react-router/lib/PropTypes"
import match from "react-router/lib/match"
// PlainRoute is defined in the API documented at:
// https://github.com/rackt/react-router/blob/master/docs/API.md
// but not included in any of the .../lib modules above.
export type PlainRoute = ReactRouter.PlainRoute
// The following definitions are also very useful to export
// because by using these types lots of potential type errors
// can be exposed:
export type EnterHook = ReactRouter.EnterHook
export type LeaveHook = ReactRouter.LeaveHook
export type ParseQueryString = ReactRouter.ParseQueryString
export type RedirectFunction = ReactRouter.RedirectFunction
export type RouteComponentProps<P,R> = ReactRouter.RouteComponentProps<P,R>;
export type RouteHook = ReactRouter.RouteHook
export type StringifyQuery = ReactRouter.StringifyQuery
export type RouterListener = ReactRouter.RouterListener
export type RouterState = ReactRouter.RouterState
export type HistoryBase = ReactRouter.HistoryBase
export {
Router,
Link,
IndexLink,
IndexRedirect,
IndexRoute,
Redirect,
Route,
History,
browserHistory,
hashHistory,
Lifecycle,
RouteContext,
useRoutes,
createRoutes,
formatPattern,
RouterContext,
PropTypes,
match
}
export default Router
}

View File

@@ -1,66 +0,0 @@
// Type definitions for React v0.14 (react-dom)
// Project: http://facebook.github.io/react/
// Definitions by: Asana <https://asana.com>, AssureSign <http://www.assuresign.com>, Microsoft <https://microsoft.com>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="react.d.ts" />
declare namespace __React {
namespace __DOM {
function findDOMNode<E extends Element>(instance: ReactInstance): E;
function findDOMNode(instance: ReactInstance): Element;
function render<P>(
element: DOMElement<P>,
container: Element,
callback?: (element: Element) => any): Element;
function render<P, S>(
element: ClassicElement<P>,
container: Element,
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
function render<P, S>(
element: ReactElement<P>,
container: Element,
callback?: (component: Component<P, S>) => any): Component<P, S>;
function unmountComponentAtNode(container: Element): boolean;
var version: string;
function unstable_batchedUpdates<A, B>(callback: (a: A, b: B) => any, a: A, b: B): void;
function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
function unstable_batchedUpdates(callback: () => any): void;
function unstable_renderSubtreeIntoContainer<P>(
parentComponent: Component<any, any>,
nextElement: DOMElement<P>,
container: Element,
callback?: (element: Element) => any): Element;
function unstable_renderSubtreeIntoContainer<P, S>(
parentComponent: Component<any, any>,
nextElement: ClassicElement<P>,
container: Element,
callback?: (component: ClassicComponent<P, S>) => any): ClassicComponent<P, S>;
function unstable_renderSubtreeIntoContainer<P, S>(
parentComponent: Component<any, any>,
nextElement: ReactElement<P>,
container: Element,
callback?: (component: Component<P, S>) => any): Component<P, S>;
}
namespace __DOMServer {
function renderToString(element: ReactElement<any>): string;
function renderToStaticMarkup(element: ReactElement<any>): string;
var version: string;
}
}
declare module "react-dom" {
import DOM = __React.__DOM;
export = DOM;
}
declare module "react-dom/server" {
import DOMServer = __React.__DOMServer;
export = DOMServer;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,18 +0,0 @@
// Type definitions for redux-thunk
// Project: https://github.com/gaearon/redux-thunk
// Definitions by: Qubo <https://github.com/tkqubo>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../redux/redux.d.ts" />
declare module ReduxThunk {
export interface Thunk extends Redux.Middleware {}
export interface ThunkInterface {
<T>(dispatch: Redux.Dispatch, getState?: () => T): any;
}
}
declare module "redux-thunk" {
var thunk: ReduxThunk.Thunk;
export = thunk;
}

View File

@@ -1,52 +0,0 @@
// Type definitions for Redux v1.0.0
// Project: https://github.com/rackt/redux
// Definitions by: William Buchwalter <https://github.com/wbuchwalter/>, Vincent Prouillet <https://github.com/Keats/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Redux {
interface ActionCreator extends Function {
(...args: any[]): any;
}
interface Reducer extends Function {
(state: any, action: any): any;
}
interface Dispatch extends Function {
(action: any): any;
}
interface StoreMethods {
dispatch: Dispatch;
getState(): any;
}
interface MiddlewareArg {
dispatch: Dispatch;
getState: Function;
}
interface Middleware extends Function {
(obj: MiddlewareArg): Function;
}
class Store {
getReducer(): Reducer;
replaceReducer(nextReducer: Reducer): void;
dispatch(action: any): any;
getState(): any;
subscribe(listener: Function): Function;
}
function createStore(reducer: Reducer, initialState?: any): Store;
function bindActionCreators<T>(actionCreators: T, dispatch: Dispatch): T;
function combineReducers(reducers: any): Reducer;
function applyMiddleware(...middlewares: Middleware[]): Function;
function compose<T extends Function>(...functions: Function[]): T;
}
declare module "redux" {
export = Redux;
}

View File

@@ -1,12 +0,0 @@
/// <reference path="react-redux/react-redux.d.ts" />
/// <reference path="react/react-dom.d.ts" />
/// <reference path="react/react.d.ts" />
/// <reference path="redux/redux.d.ts" />
/// <reference path="webpack/webpack-env.d.ts" />
/// <reference path="react-bootstrap/react-bootstrap.d.ts" />
/// <reference path="react-router/history.d.ts" />
/// <reference path="react-router/react-router.d.ts" />
/// <reference path="react-router-bootstrap/react-router-bootstrap.d.ts" />
/// <reference path="react-router-redux/react-router-redux.d.ts" />
/// <reference path="redux-thunk/redux-thunk.d.ts" />
/// <reference path="whatwg-fetch/whatwg-fetch.d.ts" />

View File

@@ -1,232 +0,0 @@
// Type definitions for webpack 1.12.2 (module API)
// Project: https://github.com/webpack/webpack
// Definitions by: use-strict <https://github.com/use-strict>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* Webpack module API - variables and global functions available inside modules
*/
declare namespace __WebpackModuleApi {
interface RequireContext {
keys(): string[];
<T>(id: string): T;
resolve(id: string): string;
}
interface RequireFunction {
/**
* Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
*/
<T>(path: string): T;
/**
* Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name.
*/
(paths: string[], callback: (...modules: any[]) => void): void;
/**
* Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available.
*
* This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used.
*/
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void, chunkName?: string) => void;
context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext;
/**
* Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
*
* The module id is a number in webpack (in contrast to node.js where it is a string, the filename).
*/
resolve(path: string): number;
/**
* Like require.resolve, but doesnt include the module into the bundle. Its a weak dependency.
*/
resolveWeak(path: string): number;
/**
* Ensures that the dependency is available, but dont execute it. This can be use for optimizing the position of a module in the chunks.
*/
include(path: string): void;
/**
* Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!).
*/
cache: {
[id: string]: any;
}
}
interface Module {
exports: any;
require(id: string): any;
id: string;
filename: string;
loaded: boolean;
parent: any;
children: any[];
hot: Hot;
}
type ModuleId = string|number;
interface Hot {
/**
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
* @param dependencies
* @param callback
*/
accept(dependencies: string[], callback: (updatedDependencies: ModuleId[]) => void): void;
/**
* Accept code updates for the specified dependencies. The callback is called when dependencies were replaced.
* @param dependency
* @param callback
*/
accept(dependency: string, callback: () => void): void;
/**
* Accept code updates for this module without notification of parents.
* This should only be used if the module doesnt export anything.
* The errHandler can be used to handle errors that occur while loading the updated module.
* @param errHandler
*/
accept(errHandler?: (err: Error) => void): void;
/**
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
*/
decline(dependencies: string[]): void;
/**
* Do not accept updates for the specified dependencies. If any dependencies is updated, the code update fails with code "decline".
*/
decline(dependency: string): void;
/**
* Flag the current module as not update-able. If updated the update code would fail with code "decline".
*/
decline(): void;
/**
* Add a one time handler, which is executed when the current module code is replaced.
* Here you should destroy/remove any persistent resource you have claimed/created.
* If you want to transfer state to the new module, add it to data object.
* The data will be available at module.hot.data on the new module.
* @param callback
*/
dispose<T>(callback: (data: T) => void): void;
/**
* Add a one time handler, which is executed when the current module code is replaced.
* Here you should destroy/remove any persistent resource you have claimed/created.
* If you want to transfer state to the new module, add it to data object.
* The data will be available at module.hot.data on the new module.
* @param callback
*/
addDisposeHandler<T>(callback: (data: T) => void): void;
/**
* Remove a handler.
* This can useful to add a temporary dispose handler. You could i. e. replace code while in the middle of a multi-step async function.
* @param callback
*/
removeDisposeHandler<T>(callback: (data: T) => void): void;
/**
* Throws an exceptions if status() is not idle.
* Check all currently loaded modules for updates and apply updates if found.
* If no update was found, the callback is called with null.
* If autoApply is truthy the callback will be called with all modules that were disposed.
* apply() is automatically called with autoApply as options parameter.
* If autoApply is not set the callback will be called with all modules that will be disposed on apply().
* @param autoApply
* @param callback
*/
check(autoApply: boolean, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
/**
* Throws an exceptions if status() is not idle.
* Check all currently loaded modules for updates and apply updates if found.
* If no update was found, the callback is called with null.
* The callback will be called with all modules that will be disposed on apply().
* @param callback
*/
check(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
/**
* If status() != "ready" it throws an error.
* Continue the update process.
* @param options
* @param callback
*/
apply(options: AcceptOptions, callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
/**
* If status() != "ready" it throws an error.
* Continue the update process.
* @param callback
*/
apply(callback: (err: Error, outdatedModules: ModuleId[]) => void): void;
/**
* Return one of idle, check, watch, watch-delay, prepare, ready, dispose, apply, abort or fail.
*/
status(): string;
/** Register a callback on status change. */
status(callback: (status: string) => void): void;
/** Register a callback on status change. */
addStatusHandler(callback: (status: string) => void): void;
/**
* Remove a registered status change handler.
* @param callback
*/
removeStatusHandler(callback: (status: string) => void): void;
active: boolean;
data: {};
}
interface AcceptOptions {
/**
* If true the update process continues even if some modules are not accepted (and would bubble to the entry point).
*/
ignoreUnaccepted?: boolean;
/**
* Indicates that apply() is automatically called by check function
*/
autoApply?: boolean;
}
}
declare var require: __WebpackModuleApi.RequireFunction;
/**
* The resource query of the current module.
*
* e.g. __resourceQuery === "?test" // Inside "file.js?test"
*/
declare var __resourceQuery: string;
/**
* Equals the config options output.publicPath.
*/
declare var __webpack_public_path__: string;
/**
* The raw require function. This expression isnt parsed by the Parser for dependencies.
*/
declare var __webpack_require__: any;
/**
* The internal chunk loading function
*
* @param chunkId The id for the chunk to load.
* @param callback A callback function called once the chunk is loaded.
*/
declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void;
/**
* Access to the internal object of all modules.
*/
declare var __webpack_modules__: any[];
/**
* Access to the hash of the compilation.
*
* Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin
*/
declare var __webpack_hash__: any;
/**
* Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available.
*/
declare var __non_webpack_require__: any;
/**
* Equals the config option debug
*/
declare var DEBUG: boolean;
declare var module: __WebpackModuleApi.Module;

View File

@@ -1,85 +0,0 @@
// Type definitions for fetch API
// Project: https://github.com/github/fetch
// Definitions by: Ryan Graham <https://github.com/ryan-codingintrigue>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare class Request extends Body {
constructor(input: string|Request, init?:RequestInit);
method: string;
url: string;
headers: Headers;
context: string|RequestContext;
referrer: string;
mode: string|RequestMode;
credentials: string|RequestCredentials;
cache: string|RequestCache;
}
interface RequestInit {
method?: string;
headers?: HeaderInit|{ [index: string]: string };
body?: BodyInit;
mode?: string|RequestMode;
credentials?: string|RequestCredentials;
cache?: string|RequestCache;
}
declare enum RequestContext {
"audio", "beacon", "cspreport", "download", "embed", "eventsource", "favicon", "fetch",
"font", "form", "frame", "hyperlink", "iframe", "image", "imageset", "import",
"internal", "location", "manifest", "object", "ping", "plugin", "prefetch", "script",
"serviceworker", "sharedworker", "subresource", "style", "track", "video", "worker",
"xmlhttprequest", "xslt"
}
declare enum RequestMode { "same-origin", "no-cors", "cors" }
declare enum RequestCredentials { "omit", "same-origin", "include" }
declare enum RequestCache { "default", "no-store", "reload", "no-cache", "force-cache", "only-if-cached" }
declare class Headers {
append(name: string, value: string): void;
delete(name: string):void;
get(name: string): string;
getAll(name: string): Array<string>;
has(name: string): boolean;
set(name: string, value: string): void;
}
declare class Body {
bodyUsed: boolean;
arrayBuffer(): Promise<ArrayBuffer>;
blob(): Promise<Blob>;
formData(): Promise<FormData>;
json(): Promise<any>;
json<T>(): Promise<T>;
text(): Promise<string>;
}
declare class Response extends Body {
constructor(body?: BodyInit, init?: ResponseInit);
error(): Response;
redirect(url: string, status: number): Response;
type: string|ResponseType;
url: string;
status: number;
ok: boolean;
statusText: string;
headers: Headers;
clone(): Response;
}
declare enum ResponseType { "basic", "cors", "default", "error", "opaque" }
interface ResponseInit {
status: number;
statusText?: string;
headers?: HeaderInit;
}
declare type HeaderInit = Headers|Array<string>;
declare type BodyInit = Blob|FormData|string;
declare type RequestInfo = Request|string;
interface Window {
fetch(url: string|Request, init?: RequestInit): Promise<Response>;
}
declare var fetch: typeof window.fetch;

View File

@@ -10,7 +10,7 @@ module.exports = {
module: {
loaders: [
{ test: /\.ts(x?)$/, include: /ReactApp/, exclude: /node_modules/, loader: 'babel-loader' },
{ test: /\.ts(x?)$/, include: /ReactApp/, exclude: /node_modules/, loader: 'ts-loader' },
{ test: /\.ts(x?)$/, include: /ReactApp/, exclude: /node_modules/, loader: 'ts-loader?silent' },
{ test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') },
{ test: /\.(png|woff|woff2|eot|ttf|svg)$/, loader: 'url-loader?limit=100000' }
]

View File

@@ -9,29 +9,17 @@
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.NETCore.Platforms": "1.0.1",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.AspNetCore.ReactServices": "1.0.0-*"
"Microsoft.AspNetCore.Diagnostics": "1.1.0",
"Microsoft.AspNetCore.ReactServices": "1.1.0-*",
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0"
},
"frameworks": {
"netcoreapp1.0": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
"netcoreapp1.0": {}
},
"publishOptions": {
"exclude": [

View File

@@ -9,14 +9,31 @@ using Newtonsoft.Json;
namespace Microsoft.AspNetCore.AngularServices
{
/// <summary>
/// Helpers for prepopulating Angular 2's 'http' service with data.
/// </summary>
public static class PrimeCacheHelper
{
/// <summary>
/// Performs an HTTP GET request to the specified URL and adds the resulting JSON data
/// to the Angular 'http' service cache.
/// </summary>
/// <param name="html">The <see cref="IHtmlHelper"/>.</param>
/// <param name="url">The URL to be requested.</param>
/// <returns>A task representing the HTML content to be rendered into the document.</returns>
[Obsolete("Use PrimeCacheAsync instead")]
public static Task<IHtmlContent> PrimeCache(this IHtmlHelper html, string url)
{
return PrimeCacheAsync(html, url);
}
/// <summary>
/// Performs an HTTP GET request to the specified URL and adds the resulting JSON data
/// to the Angular 'http' service cache.
/// </summary>
/// <param name="html">The <see cref="IHtmlHelper"/>.</param>
/// <param name="url">The URL to be requested.</param>
/// <returns>A task representing the HTML content to be rendered into the document.</returns>
public static async Task<IHtmlContent> PrimeCacheAsync(this IHtmlHelper html, string url)
{
// TODO: Consider deduplicating the PrimeCacheAsync calls (that is, if there are multiple requests to precache

View File

@@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-us")]
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyProduct("Microsoft ASP.NET Core")]

View File

@@ -1,3 +0,0 @@
/node_modules/
/dist/
/bundles/

View File

@@ -1,4 +0,0 @@
/src/
/tsconfig.json
/build.js
/typings/

View File

@@ -1,33 +0,0 @@
// -------------
// No need to invoke this directly. To run a build, execute:
// npm run prepublish
// -------------
var Builder = require('systemjs-builder');
var builder = new Builder('./');
builder.config({
defaultJSExtensions: true,
paths: {
'angular2-aspnet': 'dist/Exports',
'angular2-aspnet/*': 'dist/*'
},
meta: {
'angular2/*': { build: false },
'rxjs/*': { build: false }
}
});
var entryPoint = 'dist/Exports';
var tasks = [
builder.bundle(entryPoint, './bundles/angular2-aspnet.js'),
builder.bundle(entryPoint, './bundles/angular2-aspnet.min.js', { minify: true })
];
Promise.all(tasks)
.then(function() {
console.log('Build complete');
})
.catch(function(err) {
console.error('Build error');
console.error(err);
});

View File

@@ -1,32 +0,0 @@
{
"name": "angular2-aspnet",
"version": "0.0.6",
"description": "Helpers for Angular 2 apps built on ASP.NET",
"main": "./dist/Exports",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "rimraf *.d.ts dist/*.d.ts && tsd install && tsc && node build.js"
},
"typings": "dist/Exports",
"author": "Microsoft",
"license": "Apache-2.0",
"bugs": {
"url": "https://github.com/aspnet/JavaScriptServices/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/aspnet/JavaScriptServices.git"
},
"dependencies": {
"angular2": "^2.0.0-beta.13",
"rxjs": "5.0.0-beta.2"
},
"devDependencies": {
"es6-shim": "^0.35.0",
"reflect-metadata": "^0.1.2",
"rimraf": "^2.5.4",
"systemjs-builder": "^0.14.11",
"typescript": "^1.8.10",
"zone.js": "^0.6.10"
}
}

View File

@@ -1,59 +0,0 @@
If you just want to use this package, then you *don't have to build it*. Instead, just grab the prebuilt package from NPM:
npm install angular2-aspnet
The rest of this file is notes for anyone contributing to this package itself.
## How to build
Run the following:
npm install
npm run prepublish
Requirements:
* Node, NPM
* `tsc` installed globally (via `npm install -g typescript`)
## Project structure
This package is intended to be consumable both on the server in Node.js, and on the client. Also, it's written in TypeScript,
which neither of those environments knows natively, but the TypeScript type definitions need to get delivered with the package
so that developers get a good IDE experience when consuming it.
The build process is therefore:
1. Compile the TypeScript to produce the development-time (.d.ts) and server-side (.js) artifacts
`tsc` reads `tsconfig.json` and is instructed to compile all the `.ts` files in `src/`. It produces a corresponding
structure of `.js` and `.d.ts` files in `dist/`.
When a developer consumes the resulting package (via `npm install angular2-aspnet`),
- No additional copy of `angular2` will be installed, because this package's dependency on it is declared as a
`peerDependency`. This means it will work with whatever (compatible) version of `angular2` is already installed.
- At runtime inside Node.js, the `main` configuration in `package.json` means the developer can use a standard
`import` statement to consume this package (i.e., `import * from 'angular2-aspnet';` in either JS or TS files).
- At development time inside an IDE such as Visual Studio Code, the `typings` configuration in `package.json` means
the IDE will use the corresponding `.d.ts` file as type metadata for the variable imported that way.
2. Use the SystemJS builder to produce the client-side artifacts
`build.js` uses the SystemJS Builder API to combine files in `dist/` into `.js` files ready for use in client-side
SystemJS environments, and puts them in `bundles/`. The bundle files contain `System.register` calls so that any
other part of your client-side code that tries to import `angular2-aspnet` via SystemJS will get that module at runtime.
To make it work in an application:
- Set up some build step that copies your chosen bundle file from `bundles/` to some location where it will
be served to the client
- Below your `<script>` tag that loads SystemJS itself, and above the `<script>` tag that makes the first call to
`System.import`, have a `<script>` tag that loads the desired `angular2-aspnet.js` bundle file
For an example, see https://github.com/aspnet/NodeServices/tree/master/samples/angular/MusicStore
Of course, you can also bundle the `angular2-aspnet.js` file into a larger SystemJS bundle if you want to combine
it with the rest of the code in your application.
Currently, this build system does *not* attempt to send sourcemaps of the original TypeScript to the client. This
could be added if a strong need emerges.

View File

@@ -1,59 +0,0 @@
import { provide, Injectable, Provider } from 'angular2/core';
import { Connection, ConnectionBackend, Http, XHRBackend, RequestOptions, Request, RequestMethod, Response, ResponseOptions, ReadyState } from 'angular2/http';
@Injectable()
export class CachePrimedConnectionBackend extends ConnectionBackend {
private _preCachedResponses: PreCachedResponses;
constructor(private _underlyingBackend: ConnectionBackend, private _baseResponseOptions: ResponseOptions) {
super();
this._preCachedResponses = (<any>window).__preCachedResponses || {};
}
public createConnection(request: Request): Connection {
let cacheKey = request.url;
if (request.method === RequestMethod.Get && this._preCachedResponses.hasOwnProperty(cacheKey)) {
return new CacheHitConnection(request, this._preCachedResponses[cacheKey], this._baseResponseOptions);
} else {
return this._underlyingBackend.createConnection(request);
}
}
}
class CacheHitConnection implements Connection {
readyState: ReadyState;
request: Request;
response: any;
constructor (req: Request, cachedResponse: PreCachedResponse, baseResponseOptions: ResponseOptions) {
this.request = req;
this.readyState = ReadyState.Done;
// Workaround for difficulty consuming CommonJS default exports in TypeScript. Note that it has to be a dynamic
// 'require', and not an 'import' statement, because the module isn't available on the server.
let obsCtor: any = require('rxjs/Observable').Observable;
this.response = new obsCtor(responseObserver => {
let response = new Response(new ResponseOptions({ body: cachedResponse.body, status: cachedResponse.statusCode }));
responseObserver.next(response);
responseObserver.complete();
});
}
}
declare var require: any; // Part of the workaround mentioned below. Can remove this after updating Angular.
interface PreCachedResponses {
[url: string]: PreCachedResponse;
}
interface PreCachedResponse {
statusCode: number;
body: string;
}
export const CACHE_PRIMED_HTTP_PROVIDERS = [
provide(Http, {
useFactory: (xhrBackend, requestOptions, responseOptions) => new Http(new CachePrimedConnectionBackend(xhrBackend, responseOptions), requestOptions),
deps: [XHRBackend, RequestOptions, ResponseOptions]
}),
];

View File

@@ -1,2 +0,0 @@
export * from './CachePrimedHttp';
export * from './Validation';

View File

@@ -1,34 +0,0 @@
import { ControlGroup } from 'angular2/common';
import { Response } from 'angular2/http';
export class Validation {
public static showValidationErrors(response: ValidationErrorResult | Response, controlGroup: ControlGroup): void {
if (response instanceof Response) {
var httpResponse = <Response>response;
response = <ValidationErrorResult>(httpResponse.json());
}
// It's not yet clear whether this is a legitimate and supported use of the ng.ControlGroup API.
// Need feedback from the Angular 2 team on whether there's a better way.
var errors = <ValidationErrorResult>response;
Object.keys(errors || {}).forEach(key => {
errors[key].forEach(errorMessage => {
// If there's a specific control for this key, then use it. Otherwise associate the error
// with the whole control group.
var control = controlGroup.controls[key] || controlGroup;
// This is rough. Need to find out if there's a better way, or if this is even supported.
if (!control.errors) {
(<any>control)._errors = {};
}
control.errors[errorMessage] = true;
});
});
}
}
export interface ValidationErrorResult {
[propertyName: string]: string[];
}

View File

@@ -1,14 +0,0 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"sourceMap": false,
"declaration": true,
"experimentalDecorators": true,
"noLib": false,
"outDir": "./dist"
},
"exclude": [
"node_modules"
]
}

View File

@@ -1,12 +0,0 @@
{
"version": "v4",
"repo": "borisyankov/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"es6-shim/es6-shim.d.ts": {
"commit": "ec9eb4b28c74665a602c22db3457f0a76fa0fa23"
}
}
}

View File

@@ -1,668 +0,0 @@
// Type definitions for es6-shim v0.31.2
// Project: https://github.com/paulmillr/es6-shim
// Definitions by: Ron Buckton <http://github.com/rbuckton>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare type PropertyKey = string | number | symbol;
interface IteratorResult<T> {
done: boolean;
value?: T;
}
interface IterableShim<T> {
/**
* Shim for an ES6 iterable. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): Iterator<T>;
}
interface Iterator<T> {
next(value?: any): IteratorResult<T>;
return?(value?: any): IteratorResult<T>;
throw?(e?: any): IteratorResult<T>;
}
interface IterableIteratorShim<T> extends IterableShim<T>, Iterator<T> {
/**
* Shim for an ES6 iterable iterator. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): IterableIteratorShim<T>;
}
interface StringConstructor {
/**
* Return the String value whose elements are, in order, the elements in the List elements.
* If length is 0, the empty string is returned.
*/
fromCodePoint(...codePoints: number[]): string;
/**
* String.raw is intended for use as a tag function of a Tagged Template String. When called
* as such the first argument will be a well formed template call site object and the rest
* parameter will contain the substitution values.
* @param template A well-formed template string call site representation.
* @param substitutions A set of substitution values.
*/
raw(template: TemplateStringsArray, ...substitutions: any[]): string;
}
interface String {
/**
* Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
* value of the UTF-16 encoded code point starting at the string element at position pos in
* the String resulting from converting this object to a String.
* If there is no element at that position, the result is undefined.
* If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
*/
codePointAt(pos: number): number;
/**
* Returns true if searchString appears as a substring of the result of converting this
* object to a String, at one or more positions that are
* greater than or equal to position; otherwise, returns false.
* @param searchString search string
* @param position If position is undefined, 0 is assumed, so as to search all of the String.
*/
includes(searchString: string, position?: number): boolean;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* endPosition length(this). Otherwise returns false.
*/
endsWith(searchString: string, endPosition?: number): boolean;
/**
* Returns a String value that is made from count copies appended together. If count is 0,
* T is the empty String is returned.
* @param count number of copies to append
*/
repeat(count: number): string;
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* position. Otherwise returns false.
*/
startsWith(searchString: string, position?: number): boolean;
/**
* Returns an <a> HTML anchor element and sets the name attribute to the text value
* @param name
*/
anchor(name: string): string;
/** Returns a <big> HTML element */
big(): string;
/** Returns a <blink> HTML element */
blink(): string;
/** Returns a <b> HTML element */
bold(): string;
/** Returns a <tt> HTML element */
fixed(): string
/** Returns a <font> HTML element and sets the color attribute value */
fontcolor(color: string): string
/** Returns a <font> HTML element and sets the size attribute value */
fontsize(size: number): string;
/** Returns a <font> HTML element and sets the size attribute value */
fontsize(size: string): string;
/** Returns an <i> HTML element */
italics(): string;
/** Returns an <a> HTML element and sets the href attribute value */
link(url: string): string;
/** Returns a <small> HTML element */
small(): string;
/** Returns a <strike> HTML element */
strike(): string;
/** Returns a <sub> HTML element */
sub(): string;
/** Returns a <sup> HTML element */
sup(): string;
/**
* Shim for an ES6 iterable. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): IterableIteratorShim<string>;
}
interface ArrayConstructor {
/**
* Creates an array from an array-like object.
* @param arrayLike An array-like object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T, U>(arrayLike: ArrayLike<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
* @param mapfn A mapping function to call on every element of the array.
* @param thisArg Value of 'this' used to invoke the mapfn.
*/
from<T, U>(iterable: IterableShim<T>, mapfn: (v: T, k: number) => U, thisArg?: any): Array<U>;
/**
* Creates an array from an array-like object.
* @param arrayLike An array-like object to convert to an array.
*/
from<T>(arrayLike: ArrayLike<T>): Array<T>;
/**
* Creates an array from an iterable object.
* @param iterable An iterable object to convert to an array.
*/
from<T>(iterable: IterableShim<T>): Array<T>;
/**
* Returns a new array from a set of elements.
* @param items A set of elements to include in the new array object.
*/
of<T>(...items: T[]): Array<T>;
}
interface Array<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
/**
* Returns the index of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex(predicate: (value: T) => boolean, thisArg?: any): number;
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: T, start?: number, end?: number): T[];
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin(target: number, start: number, end?: number): T[];
/**
* Returns an array of key, value pairs for every entry in the array
*/
entries(): IterableIteratorShim<[number, T]>;
/**
* Returns an list of keys in the array
*/
keys(): IterableIteratorShim<number>;
/**
* Returns an list of values in the array
*/
values(): IterableIteratorShim<T>;
/**
* Shim for an ES6 iterable. Not intended for direct use by user code.
*/
"_es6-shim iterator_"(): IterableIteratorShim<T>;
}
interface NumberConstructor {
/**
* The value of Number.EPSILON is the difference between 1 and the smallest value greater than 1
* that is representable as a Number value, which is approximately:
* 2.2204460492503130808472633361816 x 1016.
*/
EPSILON: number;
/**
* Returns true if passed value is finite.
* Unlike the global isFininte, Number.isFinite doesn't forcibly convert the parameter to a
* number. Only finite values of the type number, result in true.
* @param number A numeric value.
*/
isFinite(number: number): boolean;
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: number): boolean;
/**
* Returns a Boolean value that indicates whether a value is the reserved value NaN (not a
* number). Unlike the global isNaN(), Number.isNaN() doesn't forcefully convert the parameter
* to a number. Only values of the type number, that are also NaN, result in true.
* @param number A numeric value.
*/
isNaN(number: number): boolean;
/**
* Returns true if the value passed is a safe integer.
* @param number A numeric value.
*/
isSafeInteger(number: number): boolean;
/**
* The value of the largest integer n such that n and n + 1 are both exactly representable as
* a Number value.
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 2^53 1.
*/
MAX_SAFE_INTEGER: number;
/**
* The value of the smallest integer n such that n and n 1 are both exactly representable as
* a Number value.
* The value of Number.MIN_SAFE_INTEGER is 9007199254740991 ((2^53 1)).
*/
MIN_SAFE_INTEGER: number;
/**
* Converts a string to a floating-point number.
* @param string A string that contains a floating-point number.
*/
parseFloat(string: string): number;
/**
* Converts A string to an integer.
* @param s A string to convert into a number.
* @param radix A value between 2 and 36 that specifies the base of the number in numString.
* If this argument is not supplied, strings with a prefix of '0x' are considered hexadecimal.
* All other strings are considered decimal.
*/
parseInt(string: string, radix?: number): number;
}
interface ObjectConstructor {
/**
* Copy the values of all of the enumerable own properties from one or more source objects to a
* target object. Returns the target object.
* @param target The target object to copy to.
* @param sources One or more source objects to copy properties from.
*/
assign(target: any, ...sources: any[]): any;
/**
* Returns true if the values are the same value, false otherwise.
* @param value1 The first value.
* @param value2 The second value.
*/
is(value1: any, value2: any): boolean;
/**
* Sets the prototype of a specified object o to object proto or null. Returns the object o.
* @param o The object to change its prototype.
* @param proto The value of the new prototype or null.
* @remarks Requires `__proto__` support.
*/
setPrototypeOf(o: any, proto: any): any;
}
interface RegExp {
/**
* Returns a string indicating the flags of the regular expression in question. This field is read-only.
* The characters in this string are sequenced and concatenated in the following order:
*
* - "g" for global
* - "i" for ignoreCase
* - "m" for multiline
* - "u" for unicode
* - "y" for sticky
*
* If no flags are set, the value is the empty string.
*/
flags: string;
}
interface Math {
/**
* Returns the number of leading zero bits in the 32-bit binary representation of a number.
* @param x A numeric expression.
*/
clz32(x: number): number;
/**
* Returns the result of 32-bit multiplication of two numbers.
* @param x First number
* @param y Second number
*/
imul(x: number, y: number): number;
/**
* Returns the sign of the x, indicating whether x is positive, negative or zero.
* @param x The numeric expression to test
*/
sign(x: number): number;
/**
* Returns the base 10 logarithm of a number.
* @param x A numeric expression.
*/
log10(x: number): number;
/**
* Returns the base 2 logarithm of a number.
* @param x A numeric expression.
*/
log2(x: number): number;
/**
* Returns the natural logarithm of 1 + x.
* @param x A numeric expression.
*/
log1p(x: number): number;
/**
* Returns the result of (e^x - 1) of x (e raised to the power of x, where e is the base of
* the natural logarithms).
* @param x A numeric expression.
*/
expm1(x: number): number;
/**
* Returns the hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
cosh(x: number): number;
/**
* Returns the hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
sinh(x: number): number;
/**
* Returns the hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
tanh(x: number): number;
/**
* Returns the inverse hyperbolic cosine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
acosh(x: number): number;
/**
* Returns the inverse hyperbolic sine of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
asinh(x: number): number;
/**
* Returns the inverse hyperbolic tangent of a number.
* @param x A numeric expression that contains an angle measured in radians.
*/
atanh(x: number): number;
/**
* Returns the square root of the sum of squares of its arguments.
* @param values Values to compute the square root for.
* If no arguments are passed, the result is +0.
* If there is only one argument, the result is the absolute value.
* If any argument is +Infinity or -Infinity, the result is +Infinity.
* If any argument is NaN, the result is NaN.
* If all arguments are either +0 or 0, the result is +0.
*/
hypot(...values: number[]): number;
/**
* Returns the integral part of the a numeric expression, x, removing any fractional digits.
* If x is already an integer, the result is x.
* @param x A numeric expression.
*/
trunc(x: number): number;
/**
* Returns the nearest single precision float representation of a number.
* @param x A numeric expression.
*/
fround(x: number): number;
/**
* Returns an implementation-dependent approximation to the cube root of number.
* @param x A numeric expression.
*/
cbrt(x: number): number;
}
interface PromiseLike<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): PromiseLike<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): PromiseLike<TResult>;
}
/**
* Represents the completion of an asynchronous operation
*/
interface Promise<T> {
/**
* Attaches callbacks for the resolution and/or rejection of the Promise.
* @param onfulfilled The callback to execute when the Promise is resolved.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of which ever callback is executed.
*/
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => TResult | PromiseLike<TResult>): Promise<TResult>;
then<TResult>(onfulfilled?: (value: T) => TResult | PromiseLike<TResult>, onrejected?: (reason: any) => void): Promise<TResult>;
/**
* Attaches a callback for only the rejection of the Promise.
* @param onrejected The callback to execute when the Promise is rejected.
* @returns A Promise for the completion of the callback.
*/
catch(onrejected?: (reason: any) => T | PromiseLike<T>): Promise<T>;
catch(onrejected?: (reason: any) => void): Promise<T>;
}
interface PromiseConstructor {
/**
* A reference to the prototype.
*/
prototype: Promise<any>;
/**
* Creates a new Promise.
* @param executor A callback used to initialize the promise. This callback is passed two arguments:
* a resolve callback used resolve the promise with a value or the result of another promise,
* and a reject callback used to reject the promise with a provided reason or error.
*/
new <T>(executor: (resolve: (value?: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void): Promise<T>;
/**
* Creates a Promise that is resolved with an array of results when all of the provided Promises
* resolve, or rejected when any Promise is rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
all<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T[]>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
* @param values An array of Promises.
* @returns A new Promise.
*/
race<T>(values: IterableShim<T | PromiseLike<T>>): Promise<T>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject(reason: any): Promise<void>;
/**
* Creates a new rejected promise for the provided reason.
* @param reason The reason the promise was rejected.
* @returns A new rejected Promise.
*/
reject<T>(reason: any): Promise<T>;
/**
* Creates a new resolved promise for the provided value.
* @param value A promise.
* @returns A promise whose internal state matches the provided promise.
*/
resolve<T>(value: T | PromiseLike<T>): Promise<T>;
/**
* Creates a new resolved promise .
* @returns A resolved promise.
*/
resolve(): Promise<void>;
}
declare var Promise: PromiseConstructor;
interface Map<K, V> {
clear(): void;
delete(key: K): boolean;
forEach(callbackfn: (value: V, index: K, map: Map<K, V>) => void, thisArg?: any): void;
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): Map<K, V>;
size: number;
entries(): IterableIteratorShim<[K, V]>;
keys(): IterableIteratorShim<K>;
values(): IterableIteratorShim<V>;
}
interface MapConstructor {
new <K, V>(): Map<K, V>;
new <K, V>(iterable: IterableShim<[K, V]>): Map<K, V>;
prototype: Map<any, any>;
}
declare var Map: MapConstructor;
interface Set<T> {
add(value: T): Set<T>;
clear(): void;
delete(value: T): boolean;
forEach(callbackfn: (value: T, index: T, set: Set<T>) => void, thisArg?: any): void;
has(value: T): boolean;
size: number;
entries(): IterableIteratorShim<[T, T]>;
keys(): IterableIteratorShim<T>;
values(): IterableIteratorShim<T>;
}
interface SetConstructor {
new <T>(): Set<T>;
new <T>(iterable: IterableShim<T>): Set<T>;
prototype: Set<any>;
}
declare var Set: SetConstructor;
interface WeakMap<K, V> {
delete(key: K): boolean;
get(key: K): V;
has(key: K): boolean;
set(key: K, value?: V): WeakMap<K, V>;
}
interface WeakMapConstructor {
new <K, V>(): WeakMap<K, V>;
new <K, V>(iterable: IterableShim<[K, V]>): WeakMap<K, V>;
prototype: WeakMap<any, any>;
}
declare var WeakMap: WeakMapConstructor;
interface WeakSet<T> {
add(value: T): WeakSet<T>;
delete(value: T): boolean;
has(value: T): boolean;
}
interface WeakSetConstructor {
new <T>(): WeakSet<T>;
new <T>(iterable: IterableShim<T>): WeakSet<T>;
prototype: WeakSet<any>;
}
declare var WeakSet: WeakSetConstructor;
declare namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
function enumerate(target: any): IterableIteratorShim<any>;
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
function getPrototypeOf(target: any): any;
function has(target: any, propertyKey: PropertyKey): boolean;
function isExtensible(target: any): boolean;
function ownKeys(target: any): Array<PropertyKey>;
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
}
declare module "es6-shim" {
var String: StringConstructor;
var Array: ArrayConstructor;
var Number: NumberConstructor;
var Math: Math;
var Object: ObjectConstructor;
var Map: MapConstructor;
var Set: SetConstructor;
var WeakMap: WeakMapConstructor;
var WeakSet: WeakSetConstructor;
var Promise: PromiseConstructor;
namespace Reflect {
function apply(target: Function, thisArgument: any, argumentsList: ArrayLike<any>): any;
function construct(target: Function, argumentsList: ArrayLike<any>): any;
function defineProperty(target: any, propertyKey: PropertyKey, attributes: PropertyDescriptor): boolean;
function deleteProperty(target: any, propertyKey: PropertyKey): boolean;
function enumerate(target: any): Iterator<any>;
function get(target: any, propertyKey: PropertyKey, receiver?: any): any;
function getOwnPropertyDescriptor(target: any, propertyKey: PropertyKey): PropertyDescriptor;
function getPrototypeOf(target: any): any;
function has(target: any, propertyKey: PropertyKey): boolean;
function isExtensible(target: any): boolean;
function ownKeys(target: any): Array<PropertyKey>;
function preventExtensions(target: any): boolean;
function set(target: any, propertyKey: PropertyKey, value: any, receiver?: any): boolean;
function setPrototypeOf(target: any, proto: any): boolean;
}
}

View File

@@ -1,2 +0,0 @@
/// <reference path="es6-shim/es6-shim.d.ts" />

View File

@@ -1,26 +1,28 @@
{
"version": "1.0.0-*",
"description": "Helpers for building Angular 2 applications on ASP.NET Core.",
"compilationOptions": {
"keyFile": "../../tools/Key.snk"
"version": "1.1.0-beta2-*",
"packOptions": {
"repository": {
"type": "git",
"url": "git://github.com/aspnet/javascriptservices"
},
"authors": [ "Microsoft" ],
"tooling": {
"defaultNamespace": "Microsoft.AspNetCore.AngularServices"
"tags": [
"aspnetcore",
"aspnetcoremvc",
"nodeservices"
]
},
"buildOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk",
"xmlDoc": true
},
"dependencies": {
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.0.1",
"Microsoft.AspNetCore.SpaServices": "1.0.0-*"
"Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.0",
"Microsoft.AspNetCore.SpaServices": "1.1.0-*"
},
"frameworks": {
"net451": {
},
"netstandard1.6": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
]
}
"net451": {},
"netstandard1.6": {}
}
}

View File

@@ -0,0 +1,3 @@
/bin/
/node_modules/
yarn.lock

View File

@@ -44,11 +44,81 @@
/* 0 */
/***/ function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(7);
module.exports = __webpack_require__(1);
/***/ },
/* 1 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// 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.
__webpack_require__(2);
var net = __webpack_require__(3);
var path = __webpack_require__(4);
var readline = __webpack_require__(5);
var ArgsUtil_1 = __webpack_require__(6);
var ExitWhenParentExits_1 = __webpack_require__(7);
var virtualConnectionServer = __webpack_require__(8);
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
// reference to Node's runtime 'require' function.
var dynamicRequire = eval('require');
// Signal to the .NET side when we're ready to accept invocations
var server = net.createServer().on('listening', function () {
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
});
// Each virtual connection represents a separate invocation
virtualConnectionServer.createInterface(server).on('connection', function (connection) {
readline.createInterface(connection, null).on('line', function (line) {
try {
// Get a reference to the function to invoke
var invocation = JSON.parse(line);
var invokedModule = dynamicRequire(path.resolve(process.cwd(), invocation.moduleName));
var invokedFunction = invocation.exportedFunctionName ? invokedModule[invocation.exportedFunctionName] : invokedModule;
// Prepare a callback for accepting non-streamed JSON responses
var hasInvokedCallback_1 = false;
var invocationCallback = function (errorValue, successValue) {
if (hasInvokedCallback_1) {
throw new Error('Cannot supply more than one result. The callback has already been invoked,'
+ ' or the result stream has already been accessed');
}
hasInvokedCallback_1 = true;
connection.end(JSON.stringify({
result: successValue,
errorMessage: errorValue && (errorValue.message || errorValue),
errorDetails: errorValue && (errorValue.stack || null)
}));
};
// Also support streamed binary responses
Object.defineProperty(invocationCallback, 'stream', {
enumerable: true,
get: function () {
hasInvokedCallback_1 = true;
return connection;
}
});
// Actually invoke it, passing through any supplied args
invokedFunction.apply(null, [invocationCallback].concat(invocation.args));
}
catch (ex) {
connection.end(JSON.stringify({
errorMessage: ex.message,
errorDetails: ex.stack
}));
}
});
});
// Begin listening now. The underlying transport varies according to the runtime platform.
// On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets.
var useWindowsNamedPipes = /^win/.test(process.platform);
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
var listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress;
server.listen(listenAddress);
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid));
/***/ },
/* 1 */,
/* 2 */
/***/ function(module, exports) {
@@ -90,7 +160,12 @@
/***/ },
/* 3 */,
/* 3 */
/***/ function(module, exports) {
module.exports = require("net");
/***/ },
/* 4 */
/***/ function(module, exports) {
@@ -98,6 +173,12 @@
/***/ },
/* 5 */
/***/ function(module, exports) {
module.exports = require("readline");
/***/ },
/* 6 */
/***/ function(module, exports) {
"use strict";
@@ -123,7 +204,7 @@
/***/ },
/* 6 */
/* 7 */
/***/ function(module, exports) {
/*
@@ -189,96 +270,13 @@
}
/***/ },
/* 7 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
// 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.
__webpack_require__(2);
var net = __webpack_require__(8);
var path = __webpack_require__(4);
var readline = __webpack_require__(9);
var ArgsUtil_1 = __webpack_require__(5);
var ExitWhenParentExits_1 = __webpack_require__(6);
var virtualConnectionServer = __webpack_require__(10);
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct
// reference to Node's runtime 'require' function.
var dynamicRequire = eval('require');
// Signal to the .NET side when we're ready to accept invocations
var server = net.createServer().on('listening', function () {
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
});
// Each virtual connection represents a separate invocation
virtualConnectionServer.createInterface(server).on('connection', function (connection) {
readline.createInterface(connection, null).on('line', function (line) {
try {
// Get a reference to the function to invoke
var invocation = JSON.parse(line);
var invokedModule = dynamicRequire(path.resolve(process.cwd(), invocation.moduleName));
var invokedFunction = invocation.exportedFunctionName ? invokedModule[invocation.exportedFunctionName] : invokedModule;
// Prepare a callback for accepting non-streamed JSON responses
var hasInvokedCallback_1 = false;
var invocationCallback = function (errorValue, successValue) {
if (hasInvokedCallback_1) {
throw new Error('Cannot supply more than one result. The callback has already been invoked,'
+ ' or the result stream has already been accessed');
}
hasInvokedCallback_1 = true;
connection.end(JSON.stringify({
result: successValue,
errorMessage: errorValue && (errorValue.message || errorValue),
errorDetails: errorValue && (errorValue.stack || null)
}));
};
// Also support streamed binary responses
Object.defineProperty(invocationCallback, 'stream', {
enumerable: true,
get: function () {
hasInvokedCallback_1 = true;
return connection;
}
});
// Actually invoke it, passing through any supplied args
invokedFunction.apply(null, [invocationCallback].concat(invocation.args));
}
catch (ex) {
connection.end(JSON.stringify({
errorMessage: ex.message,
errorDetails: ex.stack
}));
}
});
});
// Begin listening now. The underlying transport varies according to the runtime platform.
// On Windows it's Named Pipes; on Linux/OSX it's Domain Sockets.
var useWindowsNamedPipes = /^win/.test(process.platform);
var parsedArgs = ArgsUtil_1.parseArgs(process.argv);
var listenAddress = (useWindowsNamedPipes ? '\\\\.\\pipe\\' : '/tmp/') + parsedArgs.listenAddress;
server.listen(listenAddress);
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid));
/***/ },
/* 8 */
/***/ function(module, exports) {
module.exports = require("net");
/***/ },
/* 9 */
/***/ function(module, exports) {
module.exports = require("readline");
/***/ },
/* 10 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
var events_1 = __webpack_require__(11);
var VirtualConnection_1 = __webpack_require__(12);
var events_1 = __webpack_require__(9);
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,
// and both will reject longer frames.
var MaxFrameBodyLength = 16 * 1024;
@@ -460,13 +458,13 @@
/***/ },
/* 11 */
/* 9 */
/***/ function(module, exports) {
module.exports = require("events");
/***/ },
/* 12 */
/* 10 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
@@ -475,17 +473,18 @@
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var stream_1 = __webpack_require__(13);
var stream_1 = __webpack_require__(11);
/**
* Represents a virtual connection. Multiple virtual connections may be multiplexed over a single physical socket connection.
*/
var VirtualConnection = (function (_super) {
__extends(VirtualConnection, _super);
function VirtualConnection(_beginWriteCallback) {
_super.call(this);
this._beginWriteCallback = _beginWriteCallback;
this._flowing = false;
this._receivedDataQueue = [];
var _this = _super.call(this) || this;
_this._beginWriteCallback = _beginWriteCallback;
_this._flowing = false;
_this._receivedDataQueue = [];
return _this;
}
VirtualConnection.prototype._read = function () {
this._flowing = true;
@@ -516,7 +515,7 @@
/***/ },
/* 13 */
/* 11 */
/***/ function(module, exports) {
module.exports = require("stream");

View File

@@ -2,7 +2,7 @@ using System.IO;
using System.IO.Pipes;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices.HostingModels.PhysicalConnections
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
{
internal class NamedPipeConnection : StreamConnection
{

View File

@@ -2,7 +2,7 @@ using System;
using System.IO;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices.HostingModels.PhysicalConnections
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
{
internal abstract class StreamConnection : IDisposable
{

View File

@@ -2,7 +2,7 @@ using System.IO;
using System.Net.Sockets;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices.HostingModels.PhysicalConnections
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
{
internal class UnixDomainSocketConnection : StreamConnection
{

View File

@@ -3,7 +3,7 @@ using System.Net;
using System.Net.Sockets;
using System.Text;
namespace Microsoft.AspNetCore.NodeServices.HostingModels.PhysicalConnections
namespace Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections
{
// From System.IO.Pipes/src/System/Net/Sockets/UnixDomainSocketEndPoint.cs (an internal class in System.IO.Pipes)
internal sealed class UnixDomainSocketEndPoint : EndPoint

View File

@@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-us")]
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyProduct("Microsoft ASP.NET Core")]

View File

@@ -1,16 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.NodeServices.HostingModels.PhysicalConnections;
using Microsoft.AspNetCore.NodeServices.HostingModels.VirtualConnections;
using Microsoft.AspNetCore.NodeServices.HostingModels;
using Microsoft.AspNetCore.NodeServices.Sockets.PhysicalConnections;
using Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
namespace Microsoft.AspNetCore.NodeServices.HostingModels
namespace Microsoft.AspNetCore.NodeServices.Sockets
{
/// <summary>
/// A specialisation of the OutOfProcessNodeInstance base class that uses a lightweight binary streaming protocol
@@ -33,27 +32,28 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
TypeNameHandling = TypeNameHandling.None
};
private readonly static int streamBufferSize = 16 * 1024;
private readonly static UTF8Encoding utf8EncodingWithoutBom = new UTF8Encoding(false);
private readonly SemaphoreSlim _connectionCreationSemaphore = new SemaphoreSlim(1);
private bool _connectionHasFailed;
private StreamConnection _physicalConnection;
private string _socketAddress;
private VirtualConnectionClient _virtualConnectionClient;
public SocketNodeInstance(string projectPath, string[] watchFileExtensions, string socketAddress,
ILogger nodeInstanceOutputLogger, IDictionary<string, string> environmentVars,
int invocationTimeoutMilliseconds, bool launchWithDebugging, int debuggingPort)
public SocketNodeInstance(NodeServicesOptions options, string socketAddress)
: base(
EmbeddedResourceReader.Read(
typeof(SocketNodeInstance),
"/Content/Node/entrypoint-socket.js"),
projectPath,
watchFileExtensions,
options.ProjectPath,
options.WatchFileExtensions,
MakeNewCommandLineOptions(socketAddress),
nodeInstanceOutputLogger,
environmentVars,
invocationTimeoutMilliseconds,
launchWithDebugging,
debuggingPort)
options.NodeInstanceOutputLogger,
options.EnvironmentVariables,
options.InvocationTimeoutMilliseconds,
options.LaunchWithDebugging,
options.DebuggingPort)
{
_socketAddress = socketAddress;
}
@@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
// wait for the same connection task. There's no reason why the first caller should have the
// special ability to cancel the connection process in a way that would affect subsequent
// callers. So, each caller just independently stops awaiting connection if that call is cancelled.
await EnsureVirtualConnectionClientCreated().OrThrowOnCancellation(cancellationToken);
await ThrowOnCancellation(EnsureVirtualConnectionClientCreated(), cancellationToken);
}
// For each invocation, we open a new virtual connection. This gives an API equivalent to opening a new
@@ -89,7 +89,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
virtualConnection = _virtualConnectionClient.OpenVirtualConnection();
// Send request
await WriteJsonLineAsync(virtualConnection, invocationInfo, cancellationToken);
WriteJsonLine(virtualConnection, invocationInfo);
// Determine what kind of response format is expected
if (typeof(T) == typeof(Stream))
@@ -169,11 +169,20 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
base.Dispose(disposing);
}
private static async Task WriteJsonLineAsync(Stream stream, object serializableObject, CancellationToken cancellationToken)
private static void WriteJsonLine(Stream stream, object serializableObject)
{
var json = JsonConvert.SerializeObject(serializableObject, jsonSerializerSettings);
var bytes = Encoding.UTF8.GetBytes(json + '\n');
await stream.WriteAsync(bytes, 0, bytes.Length, cancellationToken);
using (var streamWriter = new StreamWriter(stream, utf8EncodingWithoutBom, streamBufferSize, true))
using (var jsonWriter = new JsonTextWriter(streamWriter))
{
jsonWriter.CloseOutput = false;
var serializer = JsonSerializer.Create(jsonSerializerSettings);
serializer.Serialize(jsonWriter, serializableObject);
jsonWriter.Flush();
streamWriter.WriteLine();
streamWriter.Flush();
}
}
private static async Task<T> ReadJsonAsync<T>(Stream stream, CancellationToken cancellationToken)
@@ -184,7 +193,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
private static async Task<byte[]> ReadAllBytesAsync(Stream input, CancellationToken cancellationToken)
{
byte[] buffer = new byte[16 * 1024];
byte[] buffer = new byte[streamBufferSize];
using (var ms = new MemoryStream())
{
@@ -203,6 +212,17 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
return $"--listenAddress {listenAddress}";
}
private static Task ThrowOnCancellation(Task task, CancellationToken cancellationToken)
{
return task.IsCompleted
? task // If the task is already completed, no need to wrap it in a further layer of task
: task.ContinueWith(
_ => {}, // If the task completes, allow execution to continue
cancellationToken,
TaskContinuationOptions.ExecuteSynchronously,
TaskScheduler.Default);
}
#pragma warning disable 649 // These properties are populated via JSON deserialization
private class RpcJsonResponse<TResult>
{

View File

@@ -0,0 +1,21 @@
using System;
namespace Microsoft.AspNetCore.NodeServices.Sockets
{
/// <summary>
/// Extension methods that help with populating a <see cref="NodeServicesOptions"/> object.
/// </summary>
public static class NodeServicesOptionsExtensions
{
/// <summary>
/// Configures the <see cref="INodeServices"/> service so that it will use out-of-process
/// Node.js instances and perform RPC calls over binary sockets (on Windows, this is
/// implemented as named pipes; on other platforms it uses domain sockets).
/// </summary>
public static void UseSocketHosting(this NodeServicesOptions options)
{
var pipeName = "pni-" + Guid.NewGuid().ToString("D"); // Arbitrary non-clashing string
options.NodeInstanceFactory = () => new SocketNodeInstance(options, pipeName);
}
}
}

View File

@@ -1,12 +1,12 @@
// 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.
import './Util/OverrideStdOutputs';
import '../../Microsoft.AspNetCore.NodeServices/TypeScript/Util/OverrideStdOutputs';
import * as net from 'net';
import * as path from 'path';
import * as readline from 'readline';
import { Duplex } from 'stream';
import { parseArgs } from './Util/ArgsUtil';
import { exitWhenParentExits } from './Util/ExitWhenParentExits';
import { parseArgs } from '../../Microsoft.AspNetCore.NodeServices/TypeScript/Util/ArgsUtil';
import { exitWhenParentExits } from '../../Microsoft.AspNetCore.NodeServices/TypeScript/Util/ExitWhenParentExits';
import * as virtualConnectionServer from './VirtualConnections/VirtualConnectionServer';
// Webpack doesn't support dynamic requires for files not present at compile time, so grab a direct

View File

@@ -0,0 +1,11 @@
{
"compilerOptions": {
"target": "es3",
"module": "commonjs",
"moduleResolution": "node",
"types": ["node"]
},
"exclude": [
"node_modules"
]
}

View File

@@ -4,7 +4,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Threading.Tasks.Dataflow;
namespace Microsoft.AspNetCore.NodeServices.HostingModels.VirtualConnections
namespace Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections
{
/// <summary>
/// A virtual read/write connection, typically to a remote process. Multiple virtual connections can be

View File

@@ -5,8 +5,12 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices.HostingModels.VirtualConnections
namespace Microsoft.AspNetCore.NodeServices.Sockets.VirtualConnections
{
/// <summary>
/// A callback that will be invoked if the <see cref="VirtualConnectionClient"/> encounters a read error.
/// </summary>
/// <param name="ex"></param>
public delegate void VirtualConnectionReadErrorHandler(Exception ex);
/// <summary>

View File

@@ -0,0 +1,18 @@
{
"name": "nodeservices.sockets",
"version": "1.0.0",
"description": "This is not really an NPM package and will not be published. This file exists only to reference compilation tools.",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "./node_modules/.bin/webpack"
},
"author": "Microsoft",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^6.0.42",
"ts-loader": "^0.8.2",
"typescript": "^2.0.0",
"webpack": "^1.13.1"
}
}

View File

@@ -0,0 +1,39 @@
{
"description": "Socket-based RPC for Microsoft.AspNetCore.NodeServices",
"version": "1.1.0-beta2-*",
"packOptions": {
"repository": {
"type": "git",
"url": "git://github.com/aspnet/javascriptservices"
},
"tags": [
"aspnetcore",
"aspnetcoremvc",
"nodeservices"
]
},
"buildOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk",
"embed": [
"Content/**/*"
],
"xmlDoc": true
},
"dependencies": {
"Microsoft.AspNetCore.NodeServices": "1.1.0-*"
},
"frameworks": {
"net451": {
"dependencies": {
"Microsoft.Tpl.Dataflow": "4.5.24"
}
},
"netstandard1.6": {
"dependencies": {
"System.IO.Pipes": "4.3.0",
"System.Threading.Tasks.Dataflow": "4.7.0"
}
}
}
}

View File

@@ -0,0 +1,20 @@
module.exports = {
target: 'node',
externals: ['fs', 'net', 'events', 'readline', 'stream'],
resolve: {
extensions: [ '.ts' ]
},
module: {
loaders: [
{ test: /\.ts$/, loader: 'ts-loader' },
]
},
entry: {
'entrypoint-socket': ['./TypeScript/SocketNodeInstanceEntryPoint'],
},
output: {
libraryTarget: 'commonjs',
path: './Content/Node',
filename: '[name].js'
}
};

View File

@@ -1,2 +1,3 @@
/bin/
/node_modules/
yarn.lock

View File

@@ -1,8 +0,0 @@
namespace Microsoft.AspNetCore.NodeServices
{
public enum NodeHostingModel
{
Http,
Socket,
}
}

View File

@@ -1,10 +1,17 @@
using System;
using Microsoft.AspNetCore.NodeServices.HostingModels;
namespace Microsoft.AspNetCore.NodeServices
{
/// <summary>
/// Supplies INodeServices instances.
/// </summary>
public static class NodeServicesFactory
{
/// <summary>
/// Create an <see cref="INodeServices"/> instance according to the supplied options.
/// </summary>
/// <param name="options">Options for creating the <see cref="INodeServices"/> instance.</param>
/// <returns>An <see cref="INodeServices"/> instance.</returns>
public static INodeServices CreateNodeServices(NodeServicesOptions options)
{
if (options == null)
@@ -12,32 +19,7 @@ namespace Microsoft.AspNetCore.NodeServices
throw new ArgumentNullException(nameof (options));
}
return new NodeServicesImpl(() => CreateNodeInstance(options));
}
private static INodeInstance CreateNodeInstance(NodeServicesOptions options)
{
if (options.NodeInstanceFactory != null)
{
// If you've explicitly supplied an INodeInstance factory, we'll use that. This is useful for
// custom INodeInstance implementations.
return options.NodeInstanceFactory();
}
else
{
switch (options.HostingModel)
{
case NodeHostingModel.Http:
return new HttpNodeInstance(options.ProjectPath, options.WatchFileExtensions, options.NodeInstanceOutputLogger,
options.EnvironmentVariables, options.InvocationTimeoutMilliseconds, options.LaunchWithDebugging, options.DebuggingPort, /* port */ 0);
case NodeHostingModel.Socket:
var pipeName = "pni-" + Guid.NewGuid().ToString("D"); // Arbitrary non-clashing string
return new SocketNodeInstance(options.ProjectPath, options.WatchFileExtensions, pipeName, options.NodeInstanceOutputLogger,
options.EnvironmentVariables, options.InvocationTimeoutMilliseconds, options.LaunchWithDebugging, options.DebuggingPort);
default:
throw new ArgumentException("Unknown hosting model: " + options.HostingModel);
}
}
return new NodeServicesImpl(options.NodeInstanceFactory);
}
}
}

View File

@@ -8,14 +8,20 @@ using Microsoft.Extensions.Logging.Console;
namespace Microsoft.AspNetCore.NodeServices
{
/// <summary>
/// Describes options used to configure an <see cref="INodeServices"/> instance.
/// </summary>
public class NodeServicesOptions
{
public const NodeHostingModel DefaultNodeHostingModel = NodeHostingModel.Http;
internal const string TimeoutConfigPropertyName = nameof(InvocationTimeoutMilliseconds);
private const int DefaultInvocationTimeoutMilliseconds = 60 * 1000;
private const string LogCategoryName = "Microsoft.AspNetCore.NodeServices";
private static readonly string[] DefaultWatchFileExtensions = { ".js", ".jsx", ".ts", ".tsx", ".json", ".html" };
/// <summary>
/// Creates a new instance of <see cref="NodeServicesOptions"/>.
/// </summary>
/// <param name="serviceProvider">The <see cref="IServiceProvider"/>.</param>
public NodeServicesOptions(IServiceProvider serviceProvider)
{
if (serviceProvider == null)
@@ -25,7 +31,6 @@ namespace Microsoft.AspNetCore.NodeServices
EnvironmentVariables = new Dictionary<string, string>();
InvocationTimeoutMilliseconds = DefaultInvocationTimeoutMilliseconds;
HostingModel = DefaultNodeHostingModel;
WatchFileExtensions = (string[])DefaultWatchFileExtensions.Clone();
// In an ASP.NET environment, we can use the IHostingEnvironment data to auto-populate a few
@@ -42,16 +47,51 @@ namespace Microsoft.AspNetCore.NodeServices
NodeInstanceOutputLogger = loggerFactory != null
? loggerFactory.CreateLogger(LogCategoryName)
: new ConsoleLogger(LogCategoryName, null, false);
// By default, we use this package's built-in out-of-process-via-HTTP hosting/transport
this.UseHttpHosting();
}
public NodeHostingModel HostingModel { get; set; }
/// <summary>
/// Specifies how to construct Node.js instances. An <see cref="INodeInstance"/> encapsulates all details about
/// how Node.js instances are launched and communicated with. A new <see cref="INodeInstance"/> will be created
/// automatically if the previous instance has terminated (e.g., because a source file changed).
/// </summary>
public Func<INodeInstance> NodeInstanceFactory { get; set; }
/// <summary>
/// If set, overrides the path to the root of your application. This path is used when locating Node.js modules relative to your project.
/// </summary>
public string ProjectPath { get; set; }
/// <summary>
/// If set, the Node.js instance should restart when any matching file on disk within your project changes.
/// </summary>
public string[] WatchFileExtensions { get; set; }
/// <summary>
/// The Node.js instance's stdout/stderr will be redirected to this <see cref="ILogger"/>.
/// </summary>
public ILogger NodeInstanceOutputLogger { get; set; }
/// <summary>
/// If true, the Node.js instance will accept incoming V8 debugger connections (e.g., from node-inspector).
/// </summary>
public bool LaunchWithDebugging { get; set; }
public IDictionary<string, string> EnvironmentVariables { get; set; }
/// <summary>
/// If <see cref="LaunchWithDebugging"/> is true, the Node.js instance will listen for V8 debugger connections on this port.
/// </summary>
public int DebuggingPort { get; set; }
/// <summary>
/// If set, starts the Node.js instance with the specified environment variables.
/// </summary>
public IDictionary<string, string> EnvironmentVariables { get; set; }
/// <summary>
/// Specifies the maximum duration, in milliseconds, that your .NET code should wait for Node.js RPC calls to return.
/// </summary>
public int InvocationTimeoutMilliseconds { get; set; }
}
}

View File

@@ -8,9 +8,18 @@ namespace Microsoft.Extensions.DependencyInjection
/// </summary>
public static class NodeServicesServiceCollectionExtensions
{
/// <summary>
/// Adds NodeServices support to the <paramref name="serviceCollection"/>.
/// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
public static void AddNodeServices(this IServiceCollection serviceCollection)
=> AddNodeServices(serviceCollection, _ => {});
/// <summary>
/// Adds NodeServices support to the <paramref name="serviceCollection"/>.
/// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
/// <param name="options">Options for configuring the <see cref="INodeServices"/> instances.</param>
[Obsolete("Use the AddNodeServices(Action<NodeServicesOptions> setupAction) overload instead.")]
public static void AddNodeServices(this IServiceCollection serviceCollection, NodeServicesOptions options)
{
@@ -20,6 +29,11 @@ namespace Microsoft.Extensions.DependencyInjection
});
}
/// <summary>
/// Adds NodeServices support to the <paramref name="serviceCollection"/>.
/// </summary>
/// <param name="serviceCollection">The <see cref="IServiceCollection"/>.</param>
/// <param name="setupAction">A callback that will be invoked to populate the <see cref="NodeServicesOptions"/>.</param>
public static void AddNodeServices(this IServiceCollection serviceCollection, Action<NodeServicesOptions> setupAction)
{
if (setupAction == null)

View File

@@ -125,7 +125,7 @@
// Signal to the NodeServices base class that we're ready to accept invocations
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
});
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid));
ExitWhenParentExits_1.exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
function readRequestBodyAsJson(request, callback) {
var requestBodyAsString = '';
request.on('data', function (chunk) { requestBodyAsString += chunk; });
@@ -255,7 +255,7 @@
*/
"use strict";
var pollIntervalMs = 1000;
function exitWhenParentExits(parentPid) {
function exitWhenParentExits(parentPid, ignoreSigint) {
setInterval(function () {
if (!processExists(parentPid)) {
// Can't log anything at this point, because out stdout was connected to the parent,
@@ -263,6 +263,24 @@
process.exit();
}
}, 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;
function processExists(pid) {

View File

@@ -1,12 +1,10 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Net.Http;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
@@ -36,21 +34,19 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
private bool _disposed;
private int _portNumber;
public HttpNodeInstance(string projectPath, string[] watchFileExtensions, ILogger nodeInstanceOutputLogger,
IDictionary<string, string> environmentVars, int invocationTimeoutMilliseconds, bool launchWithDebugging,
int debuggingPort, int port = 0)
public HttpNodeInstance(NodeServicesOptions options, int port = 0)
: base(
EmbeddedResourceReader.Read(
typeof(HttpNodeInstance),
"/Content/Node/entrypoint-http.js"),
projectPath,
watchFileExtensions,
options.ProjectPath,
options.WatchFileExtensions,
MakeCommandLineOptions(port),
nodeInstanceOutputLogger,
environmentVars,
invocationTimeoutMilliseconds,
launchWithDebugging,
debuggingPort)
options.NodeInstanceOutputLogger,
options.EnvironmentVariables,
options.InvocationTimeoutMilliseconds,
options.LaunchWithDebugging,
options.DebuggingPort)
{
_client = new HttpClient();
}
@@ -95,7 +91,7 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
case "application/octet-stream":
// Streamed responses have to be received as System.IO.Stream instances
if (typeof(T) != typeof(Stream))
if (typeof(T) != typeof(Stream) && typeof(T) != typeof(object))
{
throw new ArgumentException(
"Node module responded with binary stream. This cannot be converted to the requested generic type: " +

View File

@@ -4,8 +4,20 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices.HostingModels
{
/// <summary>
/// Represents an instance of Node.js to which Remote Procedure Calls (RPC) may be sent.
/// </summary>
public interface INodeInstance : IDisposable
{
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the invocation.</param>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.</param>
/// <param name="exportNameOrNull">If set, specifies the CommonJS export to be invoked. If not set, the module's default CommonJS export itself must be a function to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
Task<T> InvokeExportAsync<T>(CancellationToken cancellationToken, string moduleName, string exportNameOrNull, params object[] args);
}
}

View File

@@ -2,15 +2,33 @@ using System;
namespace Microsoft.AspNetCore.NodeServices.HostingModels
{
/// <summary>
/// Represents an exception caused by invoking Node.js code.
/// </summary>
public class NodeInvocationException : Exception
{
/// <summary>
/// If true, indicates that the invocation failed because the Node.js instance could not be reached. For example,
/// it might have already shut down or previously crashed.
/// </summary>
public bool NodeInstanceUnavailable { get; private set; }
/// <summary>
/// Creates a new instance of <see cref="NodeInvocationException"/>.
/// </summary>
/// <param name="message">A description of the exception.</param>
/// <param name="details">Additional information, such as a Node.js stack trace, representing the exception.</param>
public NodeInvocationException(string message, string details)
: base(message + Environment.NewLine + details)
{
}
/// <summary>
/// Creates a new instance of <see cref="NodeInvocationException"/>.
/// </summary>
/// <param name="message">A description of the exception.</param>
/// <param name="details">Additional information, such as a Node.js stack trace, representing the exception.</param>
/// <param name="nodeInstanceUnavailable">Specifies a value for the <see cref="NodeInstanceUnavailable"/> flag.</param>
public NodeInvocationException(string message, string details, bool nodeInstanceUnavailable)
: this(message, details)
{

View File

@@ -1,9 +1,24 @@
namespace Microsoft.AspNetCore.NodeServices.HostingModels
{
/// <summary>
/// Describes an RPC call sent from .NET code to Node.js code.
/// </summary>
public class NodeInvocationInfo
{
/// <summary>
/// Specifies the path to the Node.js module (i.e., .js file) relative to the project root.
/// </summary>
public string ModuleName { get; set; }
/// <summary>
/// If set, specifies the name of CommonJS function export to be invoked.
/// If not set, the Node.js module's default export must itself be a function to be invoked.
/// </summary>
public string ExportedFunctionName { get; set; }
/// <summary>
/// A sequence of JSON-serializable arguments to be passed to the Node.js function being invoked.
/// </summary>
public object[] Args { get; set; }
}
}

View File

@@ -0,0 +1,17 @@
namespace Microsoft.AspNetCore.NodeServices.HostingModels
{
/// <summary>
/// Extension methods that help with populating a <see cref="NodeServicesOptions"/> object.
/// </summary>
public static class NodeServicesOptionsExtensions
{
/// <summary>
/// Configures the <see cref="INodeServices"/> service so that it will use out-of-process
/// Node.js instances and perform RPC calls over HTTP.
/// </summary>
public static void UseHttpHosting(this NodeServicesOptions options)
{
options.NodeInstanceFactory = () => new HttpNodeInstance(options);
}
}
}

View File

@@ -21,7 +21,11 @@ namespace Microsoft.AspNetCore.NodeServices.HostingModels
/// <seealso cref="Microsoft.AspNetCore.NodeServices.HostingModels.INodeInstance" />
public abstract class OutOfProcessNodeInstance : INodeInstance
{
/// <summary>
/// The <see cref="ILogger"/> to which the Node.js instance's stdout/stderr is being redirected.
/// </summary>
protected readonly ILogger OutputLogger;
private const string ConnectionEstablishedMessage = "[Microsoft.AspNetCore.NodeServices:Listening]";
private const string DebuggingStartedMessageFormat = @"-----
*** Node.js debugging is enabled ***
@@ -43,6 +47,18 @@ If you haven't yet installed node-inspector, you can do so as follows:
private bool _nodeProcessNeedsRestart;
private readonly string[] _watchFileExtensions;
/// <summary>
/// Creates a new instance of <see cref="OutOfProcessNodeInstance"/>.
/// </summary>
/// <param name="entryPointScript">The path to the entry point script that the Node instance should load and execute.</param>
/// <param name="projectPath">The root path of the current project. This is used when resolving Node.js module paths relative to the project root.</param>
/// <param name="watchFileExtensions">The filename extensions that should be watched within the project root. The Node instance will automatically shut itself down if any matching file changes.</param>
/// <param name="commandLineArguments">Additional command-line arguments to be passed to the Node.js instance.</param>
/// <param name="nodeOutputLogger">The <see cref="ILogger"/> to which the Node.js instance's stdout/stderr (and other log information) should be written.</param>
/// <param name="environmentVars">Environment variables to be set on the Node.js process.</param>
/// <param name="invocationTimeoutMilliseconds">The maximum duration, in milliseconds, to wait for RPC calls to complete.</param>
/// <param name="launchWithDebugging">If true, passes a flag to the Node.js process telling it to accept V8 debugger connections.</param>
/// <param name="debuggingPort">If debugging is enabled, the Node.js process should listen for V8 debugger connections on this port.</param>
public OutOfProcessNodeInstance(
string entryPointScript,
string projectPath,
@@ -71,6 +87,15 @@ If you haven't yet installed node-inspector, you can do so as follows:
ConnectToInputOutputStreams();
}
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the invocation.</param>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.</param>
/// <param name="exportNameOrNull">If set, specifies the CommonJS export to be invoked. If not set, the module's default CommonJS export itself must be a function to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
public async Task<T> InvokeExportAsync<T>(
CancellationToken cancellationToken, string moduleName, string exportNameOrNull, params object[] args)
{
@@ -154,21 +179,41 @@ If you haven't yet installed node-inspector, you can do so as follows:
}
}
/// <summary>
/// Disposes this instance.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="invocationInfo">Specifies the Node.js function to be invoked and arguments to be passed to it.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the invocation.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
protected abstract Task<T> InvokeExportAsync<T>(
NodeInvocationInfo invocationInfo,
CancellationToken cancellationToken);
// This method is virtual, as it provides a way to override the NODE_PATH or the path to node.exe
/// <summary>
/// Configures a <see cref="ProcessStartInfo"/> instance describing how to launch the Node.js process.
/// </summary>
/// <param name="entryPointFilename">The entrypoint JavaScript file that the Node.js process should execute.</param>
/// <param name="projectPath">The root path of the project. This is used when locating Node.js modules relative to the project root.</param>
/// <param name="commandLineArguments">Command-line arguments to be passed to the Node.js process.</param>
/// <param name="environmentVars">Environment variables to be set on the Node.js process.</param>
/// <param name="launchWithDebugging">If true, passes a flag to the Node.js process telling it to accept V8 debugger connections.</param>
/// <param name="debuggingPort">If debugging is enabled, the Node.js process should listen for V8 debugger connections on this port.</param>
/// <returns></returns>
protected virtual ProcessStartInfo PrepareNodeProcessStartInfo(
string entryPointFilename, string projectPath, string commandLineArguments,
IDictionary<string, string> environmentVars, bool launchWithDebugging, int debuggingPort)
{
// This method is virtual, as it provides a way to override the NODE_PATH or the path to node.exe
string debuggingArgs;
if (launchWithDebugging)
{
@@ -217,16 +262,28 @@ If you haven't yet installed node-inspector, you can do so as follows:
return startInfo;
}
/// <summary>
/// Virtual method invoked whenever the Node.js process emits a line to its stdout.
/// </summary>
/// <param name="outputData">The line emitted to the Node.js process's stdout.</param>
protected virtual void OnOutputDataReceived(string outputData)
{
OutputLogger.LogInformation(outputData);
}
/// <summary>
/// Virtual method invoked whenever the Node.js process emits a line to its stderr.
/// </summary>
/// <param name="errorData">The line emitted to the Node.js process's stderr.</param>
protected virtual void OnErrorDataReceived(string errorData)
{
OutputLogger.LogError(errorData);
}
/// <summary>
/// Disposes the instance.
/// </summary>
/// <param name="disposing">True if the object is disposing or false if it is finalizing.</param>
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
@@ -268,6 +325,7 @@ If you haven't yet installed node-inspector, you can do so as follows:
private static Process LaunchNodeProcess(ProcessStartInfo startInfo)
{
try {
var process = Process.Start(startInfo);
// On Mac at least, a killed child process is left open as a zombie until the parent
@@ -279,6 +337,14 @@ If you haven't yet installed node-inspector, you can do so as follows:
process.EnableRaisingEvents = true;
return process;
} catch (Exception ex) {
var message = "Failed to start Node process. To resolve this:.\n\n"
+ "[1] Ensure that Node.js is installed and can be found in one of the PATH directories.\n"
+ $" Current PATH enviroment variable is: { Environment.GetEnvironmentVariable("PATH") }\n"
+ " Make sure the Node executable is in one of those directories, or update your PATH.\n\n"
+ "[2] See the InnerException for further details of the cause.";
throw new InvalidOperationException(message, ex);
}
}
private static string UnencodeNewlines(string str)
@@ -403,6 +469,9 @@ If you haven't yet installed node-inspector, you can do so as follows:
EnsureFileSystemWatcherIsDisposed();
}
/// <summary>
/// Implements the finalization part of the IDisposable pattern by calling Dispose(false).
/// </summary>
~OutOfProcessNodeInstance()
{
Dispose(false);

View File

@@ -4,18 +4,71 @@ using System.Threading.Tasks;
namespace Microsoft.AspNetCore.NodeServices
{
/// <summary>
/// Represents the ability to invoke code in a Node.js environment. Although the underlying Node.js instance
/// might change over time (e.g., the process might be restarted), the <see cref="INodeServices"/> instance
/// will remain constant.
/// </summary>
public interface INodeServices : IDisposable
{
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root whose default CommonJS export is the function to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
Task<T> InvokeAsync<T>(string moduleName, params object[] args);
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the invocation.</param>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root whose default CommonJS export is the function to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
Task<T> InvokeAsync<T>(CancellationToken cancellationToken, string moduleName, params object[] args);
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.</param>
/// <param name="exportedFunctionName">Specifies the CommonJS export to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
Task<T> InvokeExportAsync<T>(string moduleName, string exportedFunctionName, params object[] args);
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> that can be used to cancel the invocation.</param>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.</param>
/// <param name="exportedFunctionName">Specifies the CommonJS export to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
Task<T> InvokeExportAsync<T>(CancellationToken cancellationToken, string moduleName, string exportedFunctionName, params object[] args);
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root whose default CommonJS export is the function to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
[Obsolete("Use InvokeAsync instead")]
Task<T> Invoke<T>(string moduleName, params object[] args);
/// <summary>
/// Asynchronously invokes code in the Node.js instance.
/// </summary>
/// <typeparam name="T">The JSON-serializable data type that the Node.js code will asynchronously return.</typeparam>
/// <param name="moduleName">The path to the Node.js module (i.e., JavaScript file) relative to your project root that contains the code to be invoked.</param>
/// <param name="exportedFunctionName">Specifies the CommonJS export to be invoked.</param>
/// <param name="args">Any sequence of JSON-serializable arguments to be passed to the Node.js function.</param>
/// <returns>A <see cref="Task{TResult}"/> representing the completion of the RPC call.</returns>
[Obsolete("Use InvokeExportAsync instead")]
Task<T> InvokeExport<T>(string moduleName, string exportedFunctionName, params object[] args);
}

View File

@@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.NodeServices
return InvokeExportWithPossibleRetryAsync<T>(moduleName, exportedFunctionName, args, /* allowRetry */ true, cancellationToken);
}
public async Task<T> InvokeExportWithPossibleRetryAsync<T>(string moduleName, string exportedFunctionName, object[] args, bool allowRetry, CancellationToken cancellationToken)
private async Task<T> InvokeExportWithPossibleRetryAsync<T>(string moduleName, string exportedFunctionName, object[] args, bool allowRetry, CancellationToken cancellationToken)
{
ThrowAnyOutstandingDelayedDisposalException();
var nodeInstance = GetOrCreateCurrentNodeInstance();

View File

@@ -0,0 +1,12 @@
// Copyright (c) .NET Foundation. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
[assembly: AssemblyMetadata("Serviceable", "True")]
[assembly: NeutralResourcesLanguage("en-us")]
[assembly: AssemblyCompany("Microsoft Corporation.")]
[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")]
[assembly: AssemblyProduct("Microsoft ASP.NET Core")]

View File

@@ -67,7 +67,7 @@ public async Task<IActionResult> MyAction([FromServices] INodeServices nodeServi
}
```
Of course, you also need to supply the Node.js code you want to invoke. Create a file called `addNumber.js` at the root of your ASP.NET Core application, and add the following code:
Of course, you also need to supply the Node.js code you want to invoke. Create a file called `addNumbers.js` at the root of your ASP.NET Core application, and add the following code:
```javascript
module.exports = function (callback, first, second) {
@@ -333,25 +333,23 @@ People have asked about using [VroomJS](https://github.com/fogzot/vroomjs) as a
### Built-in hosting models
Normally, you can just use the default hosting model, and not worry about it. But if you have some special requirements, select a hosting model by setting the `HostingModel` property on the `options` object in `AddNodeServices`. Example:
Normally, you can just use the default hosting model, and not worry about it. But if you have some special requirements, you can write your own hosting model, or reference a package that supplies one.
For example, you could use the 'socket' hosting model. It performs RPC between .NET and Node.js using a fast, low-level binary channel rather than the default HTTP transport. To do this, first install the NuGet package `Microsoft.AspNetCore.NodeServices.Sockets`. Then, at the top of your `Startup.cs` file, add:
```csharp
services.AddNodeServices(options =>
{
options.HostingModel = NodeHostingModel.Socket;
using Microsoft.AspNetCore.NodeServices.Sockets;
```
...then in your `Startup.cs` file's `ConfigureServices` method, you can configure:
```csharp
services.AddNodeServices(options => {
options.UseSocketHosting();
});
```
**Available hosting models**
* `Socket`
* Launches Node as a separate process, and communicates with it using named pipes (on Windows) or domain sockets (on Linux / OS X).
* This is faster than `Http` because it uses a low-level binary protocol with very low overhead. It retains one continuous connection for the whole lifetime of the Node instance, so it doesn't have to keep waiting for new connections to open.
* `Http` (default)
* Launches Node as a separate process, and communicates with it by making HTTP requests.
* This primarily exists because it was implemented before `Socket`, but there's no particular reason to use it now that `Socket` is available. It could theoretically be useful if you wanted to run Node instances on separate servers (though there isn't currently any built-in API for configuring that).
The default transport may change from `Http` to `Socket` in the near future, because it's faster.
Now when you run your application, it will use the socket-based hosting and transport mechanism. In the past, the socket transport was faster than HTTP, but since .NET Core 1.1 improved the performance of `HttpClient` there isn't really any speed difference any more, so there's no longer any significant advantage to using `Microsoft.AspNetCore.NodeServices.Sockets`.
### Custom hosting models

View File

@@ -76,7 +76,7 @@ server.listen(requestedPortOrZero, 'localhost', function () {
console.log('[Microsoft.AspNetCore.NodeServices:Listening]');
});
exitWhenParentExits(parseInt(parsedArgs.parentPid));
exitWhenParentExits(parseInt(parsedArgs.parentPid), /* ignoreSigint */ true);
function readRequestBodyAsJson(request, callback) {
let requestBodyAsString = '';

View File

@@ -34,7 +34,7 @@ to check whether the parent PID is still running. So that's what we do here.
const pollIntervalMs = 1000;
export function exitWhenParentExits(parentPid: number) {
export function exitWhenParentExits(parentPid: number, ignoreSigint: boolean) {
setInterval(() => {
if (!processExists(parentPid)) {
// Can't log anything at this point, because out stdout was connected to the parent,
@@ -42,6 +42,25 @@ export function exitWhenParentExits(parentPid: number) {
process.exit();
}
}, 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', () => {
console.log('Received SIGINT. Waiting for .NET process to exit...');
});
}
}
function processExists(pid: number) {

View File

@@ -1,8 +1,9 @@
{
"compilerOptions": {
"target": "es5",
"target": "es3",
"module": "commonjs",
"moduleResolution": "node"
"moduleResolution": "node",
"types": ["node"]
},
"exclude": [
"node_modules"

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
/// <reference path="node/node.d.ts" />

View File

@@ -4,8 +4,17 @@ using System.Reflection;
namespace Microsoft.AspNetCore.NodeServices
{
/// <summary>
/// Contains methods for reading embedded resources.
/// </summary>
public static class EmbeddedResourceReader
{
/// <summary>
/// Reads the specified embedded resource from a given assembly.
/// </summary>
/// <param name="assemblyContainingType">Any <see cref="Type"/> in the assembly whose resource is to be read.</param>
/// <param name="path">The path of the resource to be read.</param>
/// <returns>The contents of the resource.</returns>
public static string Read(Type assemblyContainingType, string path)
{
var asm = assemblyContainingType.GetTypeInfo().Assembly;

View File

@@ -3,19 +3,45 @@ using System.IO;
namespace Microsoft.AspNetCore.NodeServices
{
// Makes it easier to pass script files to Node in a way that's sure to clean up after the process exits
/// <summary>
/// Makes it easier to pass script files to Node in a way that's sure to clean up after the process exits.
/// </summary>
public sealed class StringAsTempFile : IDisposable
{
private bool _disposedValue;
private bool _hasDeletedTempFile;
private object _fileDeletionLock = new object();
/// <summary>
/// Create a new instance of <see cref="StringAsTempFile"/>.
/// </summary>
/// <param name="content">The contents of the temporary file to be created.</param>
public StringAsTempFile(string content)
{
FileName = Path.GetTempFileName();
File.WriteAllText(FileName, content);
// Because .NET finalizers don't reliably run when the process is terminating, also
// add event handlers for other shutdown scenarios.
#if NET451
AppDomain.CurrentDomain.ProcessExit += HandleProcessExit;
AppDomain.CurrentDomain.DomainUnload += HandleProcessExit;
#else
// Note that this still doesn't capture SIGKILL (at least on macOS) - there doesn't
// appear to be a way of doing that. So in that case, the temporary file will be
// left behind.
System.Runtime.Loader.AssemblyLoadContext.Default.Unloading += HandleAssemblyUnloading;
#endif
}
/// <summary>
/// Specifies the filename of the temporary file.
/// </summary>
public string FileName { get; }
/// <summary>
/// Disposes the instance and deletes the associated temporary file.
/// </summary>
public void Dispose()
{
DisposeImpl(true);
@@ -28,15 +54,48 @@ namespace Microsoft.AspNetCore.NodeServices
{
if (disposing)
{
// Would dispose managed state here, if there was any
// Dispose managed state
#if NET451
AppDomain.CurrentDomain.ProcessExit -= HandleProcessExit;
AppDomain.CurrentDomain.DomainUnload -= HandleProcessExit;
#else
System.Runtime.Loader.AssemblyLoadContext.Default.Unloading -= HandleAssemblyUnloading;
#endif
}
File.Delete(FileName);
EnsureTempFileDeleted();
_disposedValue = true;
}
}
private void EnsureTempFileDeleted()
{
lock (_fileDeletionLock)
{
if (!_hasDeletedTempFile)
{
File.Delete(FileName);
_hasDeletedTempFile = true;
}
}
}
#if NET451
private void HandleProcessExit(object sender, EventArgs args)
{
EnsureTempFileDeleted();
}
#else
private void HandleAssemblyUnloading(System.Runtime.Loader.AssemblyLoadContext context)
{
EnsureTempFileDeleted();
}
#endif
/// <summary>
/// Implements the finalization part of the IDisposable pattern by calling Dispose(false).
/// </summary>
~StringAsTempFile()
{
DisposeImpl(false);

View File

@@ -10,8 +10,9 @@
"author": "Microsoft",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^6.0.42",
"ts-loader": "^0.8.2",
"typescript": "^1.8.10",
"typescript": "^2.0.0",
"webpack": "^1.13.1"
}
}

View File

@@ -1,48 +1,45 @@
{
"version": "1.0.0-*",
"description": "Invoke Node.js modules at runtime in ASP.NET Core applications.",
"compilationOptions": {
"keyFile": "../../tools/Key.snk"
"version": "1.1.0-rc1-*",
"packOptions": {
"repository": {
"type": "git",
"url": "git://github.com/aspnet/javascriptservices"
},
"authors": [ "Microsoft" ],
"dependencies": {
"Microsoft.AspNetCore.Hosting.Abstractions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.PlatformAbstractions": "1.0.0",
"Newtonsoft.Json": "9.0.1"
},
"frameworks": {
"net451": {
"frameworkAssemblies": {
"System.Net.Http": "4.0.0"
},
"dependencies": {
"Microsoft.Tpl.Dataflow": "4.5.24"
}
},
"netstandard1.3": {
"imports": [
"dotnet5.6",
"dnxcore50",
"portable-net45+win8"
],
"dependencies": {
"System.Console": "4.0.0",
"System.Diagnostics.Process": "4.1.0",
"System.IO.Pipes": "4.0.0",
"System.Net.Http": "4.1.0",
"System.Net.Sockets": "4.1.0",
"System.Runtime.InteropServices.RuntimeInformation": "4.0.0",
"System.Text.RegularExpressions": "4.1.0",
"System.Threading.Tasks.Dataflow": "4.5.25"
}
}
"tags": [
"aspnetcore",
"aspnetcoremvc",
"nodeservices"
]
},
"buildOptions": {
"warningsAsErrors": true,
"keyFile": "../../tools/Key.snk",
"embed": [
"Content/**/*"
],
"xmlDoc": true
},
"dependencies": {
"Microsoft.AspNetCore.Hosting.Abstractions": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Newtonsoft.Json": "9.0.1",
"NETStandard.Library": "1.6.1-*"
},
"frameworks": {
"net451": {},
"netstandard1.6": {
"dependencies": {
"System.Diagnostics.Process": "4.3.0",
"System.IO.FileSystem.Watcher": "4.3.0",
"System.Runtime.Loader": "4.3.0"
}
}
},
"scripts": {
"prepublish": [
"npm install",
"node node_modules/webpack/bin/webpack.js"
]
}
}

Some files were not shown because too many files have changed in this diff Show More