h2-auto-push
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -18,3 +18,3 @@ /// <reference types="node" /> | ||
getAssetsForPath(path: string): Set<string>; | ||
private onWarm(path, session); | ||
private onWarm; | ||
} |
@@ -5,3 +5,3 @@ import { BloomFilter } from 'bloomfilter'; | ||
constructor(maxNumPaths?: number | BloomFilter); | ||
private calculateM(maxNumPaths); | ||
private calculateM; | ||
addPath(path: string): void; | ||
@@ -8,0 +8,0 @@ mayHavePath(path: string): boolean; |
@@ -13,7 +13,7 @@ /// <reference types="node" /> | ||
constructor(rootDir: string, cacheConfig?: AssetCacheConfig); | ||
private addCacheHeaders(headers, stats); | ||
private addCacheHeaders; | ||
recordRequestPath(session: http2.Http2Session, reqPath: string, isStatic: boolean): void; | ||
preprocessRequest(reqPath: string, stream: http2.ServerHttp2Stream, cacheCookie?: string): Promise<PreprocessResult>; | ||
private getAutoPushList(reqPath, stream, cacheChecker); | ||
private push(stream, pushList); | ||
private getAutoPushList; | ||
private push; | ||
} |
@@ -17,5 +17,6 @@ "use strict"; | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const fs_1 = __importDefault(require("fs")); | ||
const mime_types_1 = require("mime-types"); | ||
const path_1 = __importDefault(require("path")); | ||
@@ -38,3 +39,4 @@ const util_1 = require("util"); | ||
} | ||
addCacheHeaders(headers, stats) { | ||
addCacheHeaders(headers, stats, filePath) { | ||
headers['content-type'] = mime_types_1.lookup(filePath); | ||
headers['cache-control'] = 'public, max-age=0'; | ||
@@ -100,2 +102,3 @@ headers['last-modified'] = stats.mtime.toUTCString(); | ||
const pushFile = (pushStream) => { | ||
const filePath = path_1.default.join(this.rootDir, asset); | ||
const onFinish = () => { | ||
@@ -113,5 +116,5 @@ pushStream.removeListener('error', onError); | ||
pushStream.once('finish', onFinish); | ||
pushStream.respondWithFile(path_1.default.join(this.rootDir, asset), undefined, { | ||
pushStream.respondWithFile(filePath, undefined, { | ||
statCheck: (stats, headers) => { | ||
this.addCacheHeaders(headers, stats); | ||
this.addCacheHeaders(headers, stats, filePath); | ||
}, | ||
@@ -124,5 +127,3 @@ onError: (err) => { | ||
}; | ||
stream.pushStream({ ':path': asset }, | ||
// Node 9.4.0 changed the callback function signature, hence casting | ||
((err, pushStream) => { | ||
stream.pushStream({ ':path': asset, 'content-type': mime_types_1.lookup(asset) }, (err, pushStream) => { | ||
if (err) { | ||
@@ -132,3 +133,3 @@ return reject(err); | ||
pushFile(pushStream); | ||
})); | ||
}); | ||
}); | ||
@@ -135,0 +136,0 @@ }); |
{ | ||
"name": "h2-auto-push", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "HTTP/2 auto-push library", | ||
@@ -46,17 +46,22 @@ "main": "build/src/index.js", | ||
}, | ||
"publishConfig": { | ||
"registry": "https://wombat-dressing-room.appspot.com" | ||
}, | ||
"dependencies": { | ||
"bloomfilter": "^0.0.16" | ||
"bloomfilter": "^0.0.18", | ||
"mime-types": "^2.1.22" | ||
}, | ||
"devDependencies": { | ||
"@types/get-port": "^3.2.0", | ||
"@types/node": "^9.4.1", | ||
"@types/get-port": "^4.0.0", | ||
"@types/mime-types": "^2.1.0", | ||
"@types/node": "^10.0.1", | ||
"@types/semver": "^5.5.0", | ||
"ava": "^0.25.0", | ||
"codecov": "^3.0.0", | ||
"get-port": "^3.2.0", | ||
"gts": "^0.5.3", | ||
"ava": "^1.3.1", | ||
"codecov": "^3.0.1", | ||
"get-port": "^4.0.0", | ||
"gts": "^0.9.0", | ||
"js-green-licenses": "^0.5.0", | ||
"nyc": "^11.4.1", | ||
"typescript": "~2.7.1" | ||
"nyc": "^13.3.0", | ||
"typescript": "~3.3.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
312
40188
2
11
1
+ Addedmime-types@^2.1.22
+ Addedbloomfilter@0.0.18(transitive)
+ Addedmime-db@1.52.0(transitive)
+ Addedmime-types@2.1.35(transitive)
- Removedbloomfilter@0.0.16(transitive)
Updatedbloomfilter@^0.0.18