Skip to content

Commit

Permalink
add types
Browse files Browse the repository at this point in the history
  • Loading branch information
Alorel committed Jan 18, 2018
1 parent d594268 commit fd1c3ed
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 29 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
/.nycrc
/.travis.yml
/*.tgz
/.idea
4 changes: 0 additions & 4 deletions .snyk

This file was deleted.

8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,13 @@ before_cache: rm -rf node_modules/.cache

stdJob: &stdJob
stage: Test
before_script: greenkeeper-lockfile-update
script:
- if [ $SNYK_TOKEN ]; then snyk test --dev; fi;
- npm test
script: npm test
after_success: cat ./coverage/lcov.info | coveralls

jobs:
include:
- node_js: &node_latest 9
<<: *stdJob
after_script:
- if [ $GH_TOKEN ]; then greenkeeper-lockfile-upload; fi;
- if [ $SNYK_TOKEN ]; then snyk monitor --dev; fi;
- node_js: 8
<<: *stdJob
- node_js: 7
Expand Down
26 changes: 26 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import {Request, RequestHandler, Response} from 'express';
import {ZlibOptions} from 'zlib';
import {BrotliEncodeParams} from 'iltorb';

type FilterFunction = (req: Request, res: Response) => boolean;

interface ShrinkRayOptions {
brotli?: Partial<BrotliEncodeParams>;
cacheSize?: number | string | false;
filter?: FilterFunction;
threshold?: number | string | false;
zlib?: Partial<ZlibOptions>;

cache?(req: Request, res: Response): boolean;
}


interface CreateMiddleware {
(options?: ShrinkRayOptions): RequestHandler;

filter: FilterFunction;
}

declare const createMiddleware: CreateMiddleware;

export = createMiddleware;
34 changes: 16 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "shrink-ray-current",
"description": "Node.js compression middleware with brotli and zopfli support",
"version": "2.0.0",
"version": "2.1.0",
"contributors": [
"Arturas Molcanovas <[email protected]> (https://alorel.github.io)",
"Douglas Christopher Wilson <[email protected]>",
Expand Down Expand Up @@ -30,25 +30,26 @@
"content-encoding"
],
"dependencies": {
"accepts": "^1.3.4",
"@types/express": "*",
"@types/iltorb": "*",
"@types/node": "*",
"accepts": "^1.3.0",
"bytes": "^3.0.0",
"compressible": "^2.0.12",
"compressible": "^2.0.0",
"debug": "^3.1.0",
"iltorb": "^2.0.2",
"lru-cache": "^4.1.1",
"multipipe": "^2.0.1",
"node-zopfli": "^2.0.2",
"on-headers": "^1.0.1",
"stream-buffers": "^3.0.1",
"vary": "^1.1.2"
"iltorb": "^2.0.0",
"lru-cache": "^4.0.0",
"multipipe": "^2.0.0",
"node-zopfli": "^2.0.0",
"on-headers": "^1.0.0",
"stream-buffers": "^3.0.0",
"vary": "^1.1.0"
},
"devDependencies": {
"coveralls": "^3.0.0",
"expect": "^21.2.1",
"greenkeeper-lockfile": "^1.12.0",
"mocha": "^4.0.1",
"expect": "^22.0.0",
"mocha": "^5.0.0",
"nyc": "^11.3.0",
"snyk": "^1.49.3",
"supertest": "^3.0.0"
},
"engines": {
Expand All @@ -57,9 +58,6 @@
"scripts": {
"reinstall": "rm -rf node_modules package-lock.json && npm install",
"test": "nyc mocha --check-leaks --bail",
"prepare": "snyk protect",
"snyk:wizard": "snyk wizard --dev",
"version-readme": "node ./prepublish.js"
},
"snyk": true
}
}

0 comments on commit fd1c3ed

Please sign in to comment.