diff --git a/.npmignore b/.npmignore index ed939072..7400c595 100644 --- a/.npmignore +++ b/.npmignore @@ -4,3 +4,4 @@ /.nycrc /.travis.yml /*.tgz +/.idea \ No newline at end of file diff --git a/.snyk b/.snyk deleted file mode 100644 index 1d05d8df..00000000 --- a/.snyk +++ /dev/null @@ -1,4 +0,0 @@ -# Snyk (https://snyk.io) policy file, patches or ignores known vulnerabilities. -version: v1.7.1 -ignore: {} -patch: {} diff --git a/.travis.yml b/.travis.yml index 9410c3c4..3994d3a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 00000000..87b99fc6 --- /dev/null +++ b/index.d.ts @@ -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; + cacheSize?: number | string | false; + filter?: FilterFunction; + threshold?: number | string | false; + zlib?: Partial; + + cache?(req: Request, res: Response): boolean; +} + + +interface CreateMiddleware { + (options?: ShrinkRayOptions): RequestHandler; + + filter: FilterFunction; +} + +declare const createMiddleware: CreateMiddleware; + +export = createMiddleware; diff --git a/package.json b/package.json index a18fbbab..0a83a102 100644 --- a/package.json +++ b/package.json @@ -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 (https://alorel.github.io)", "Douglas Christopher Wilson ", @@ -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": { @@ -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 + } }