Skip to content

Commit 086ab72

Browse files
committed
Initial typing commit
1 parent 8a94b81 commit 086ab72

17 files changed

+225
-5
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
indent_style = space
5+
indent_size = 2
6+
charset = utf-8
7+
trim_trailing_whitespace = true
8+
insert_final_newline = true
9+
10+
[*.md]
11+
trim_trailing_whitespace = false

.gitignore

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
6+
# Runtime data
7+
pids
8+
*.pid
9+
*.seed
10+
11+
# Directory for instrumented libs generated by jscoverage/JSCover
12+
lib-cov
13+
14+
# Coverage directory used by tools like istanbul
15+
coverage
16+
17+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
18+
.grunt
19+
20+
# node-waf configuration
21+
.lock-wscript
22+
23+
# Compiled binary addons (http://nodejs.org/api/addons.html)
24+
build/Release
25+
26+
# Dependency directory
27+
bower_components
28+
jspm_packages
29+
node_modules
30+
31+
# Optional npm cache directory
32+
.npm
33+
34+
# Optional REPL history
35+
.node_repl_history
36+
37+
# webstorm
38+
.idea
39+
40+
# typings
41+
typings
42+
43+
# output folder
44+
out

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "source"]
2+
path = source
3+
url = https://github.com/villadora/express-http-proxy

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: node_js
2+
3+
notifications:
4+
email:
5+
on_success: never
6+
on_failure: change
7+
8+
node_js:
9+
- "stable"
10+
11+
script:
12+
- npm run lint+build+test

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"typescript.tsdk": "node_modules/typescript/lib"
3+
}

LICENSE

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
99
copies of the Software, and to permit persons to whom the Software is
1010
furnished to do so, subject to the following conditions:
1111

12-
The above copyright notice and this permission notice shall be included in all
13-
copies or substantial portions of the Software.
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
1414

1515
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1616
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1717
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,28 @@
1-
# typings-npm-express-http-proxy
1+
# Typed Express Http Proxy
2+
The type definition for [`express-http-proxy`](https://github.com/villadora/express-http-proxy)
3+
4+
## LICENSE
5+
MIT
6+
7+
## Contributing
8+
9+
```sh
10+
# Fork this repo
11+
npm install
12+
13+
npm run watch
14+
15+
# add tests, make changes, pass tests ... then [ctrl+c]
16+
npm run publish
17+
```
18+
19+
## Updating
20+
Update `package.json/version` to match the source version you are typing against.
21+
e.g. if you are creating typings for `[email protected]`, then:
22+
```js
23+
// package.json
24+
{
25+
"version": "3.5.0"
26+
// ...
27+
}
28+
```

index.d.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import * as express from 'express';
2+
import * as http from 'http';
3+
4+
declare function ExpressHttpProxy(host: string, options: ExpressHttpProxy.IOptions): express.RequestHandler;
5+
declare namespace ExpressHttpProxy {
6+
interface IOptions {
7+
port?: number;
8+
intercept?: (
9+
rsp: http.ServerResponse,
10+
rspData: Buffer,
11+
req: express.Request,
12+
res: express.Response,
13+
callback: (err: any, rspd: string | Buffer, send?: boolean) => void
14+
) => void;
15+
decorateRequest?: (reqOpt: IRequestOption) => IRequestOption;
16+
forwardPath?: (req: express.Request, res: express.Response) => string;
17+
filter?: Function;
18+
limit?: string;
19+
preserveHostHdr?: boolean;
20+
headers?: { [key: string]: any};
21+
}
22+
23+
interface IRequestOption {
24+
hostname: string;
25+
port: number;
26+
headers: { [key: string]: any};
27+
method: string;
28+
path: string;
29+
bodyContent: string | Buffer;
30+
params: any;
31+
}
32+
}
33+
34+
export = ExpressHttpProxy;

package.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"version": "",
3+
"private": true,
4+
"scripts": {
5+
"build": "echo building... && typings bundle -o out",
6+
"lint": "echo linting... && tslint \"**/*.ts\" -e \"source/**\" -e \"source-test/**\" -e \"out/**\" -e \"node_modules/**\" -e \"typings/**\"",
7+
"test": "echo testing... && cd test && ts-node ../node_modules/blue-tape/bin/blue-tape \"**/*.ts\" | tap-spec",
8+
"source-test": "echo source-testing... && echo source-test is not specified",
9+
"watch": "onchange \"**/*.ts\" -i -e \"out/**\" -- npm -s run build+test",
10+
"publish": "npm -s run lint+build+test && echo please publish to typings/registry",
11+
"source-test+test": "npm run source-test && npm test",
12+
"build+test": "npm run build && npm run source-test+test",
13+
"lint+build+test": "npm run lint && npm run build+test",
14+
"prepublish": "typings install"
15+
},
16+
"devDependencies": {
17+
"blue-tape": "^0.2.0",
18+
"express-http-proxy": "0.6.0",
19+
"onchange": "^2.2.0",
20+
"tap-spec": "^4.1.1",
21+
"ts-node": "^0.7.1",
22+
"tslint": "git+https://github.com/unional/tslint.git",
23+
"tslint-config-typings": "^0.2.0",
24+
"typescript": "^1.8.9",
25+
"typings": "^0.7.11"
26+
}
27+
}

source

Submodule source added at 02527df

source-test/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Source tests
2+
- Change `package.json/script/source-test` to match the test harness used by the source
3+
- Copy test files form `source` and save them as `*.ts` here
4+
- Make necessary changes to the test files

source-test/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"moduleResolution": "node"
5+
},
6+
"files": [
7+
"../typings/main.d.ts",
8+
"../out/main.d.ts"
9+
]
10+
}

test/test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import test = require('blue-tape');
2+
3+
import expressHttpProxy = require('express-http-proxy');

test/tsconfig.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"moduleResolution": "node"
5+
},
6+
"files": [
7+
"../typings/main.d.ts",
8+
"../out/main.d.ts"
9+
]
10+
}

tsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"module": "commonjs",
4+
"moduleResolution": "node",
5+
"outDir": "out"
6+
},
7+
"exclude": [
8+
"node_modules",
9+
"typings/browser",
10+
"typings/browser.d.ts",
11+
"out/browser.d.ts",
12+
"source"
13+
]
14+
}

tslint.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "tslint-config-typings"
3+
}

typings.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "express-http-proxy",
3+
"main": "index.d.ts",
4+
"homepage": "https://github.com/villadora/express-http-proxy",
5+
"devDependencies": {
6+
"blue-tape": "registry:npm/blue-tape#0.1.0+20160322235613"
7+
},
8+
"ambientDevDependencies": {
9+
"node": "registry:dt/node#4.0.0+20160330064709"
10+
},
11+
"ambientDependencies": {
12+
"express": "registry:dt/express#4.0.0+20160317120654"
13+
}
14+
}

0 commit comments

Comments
 (0)