Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nocache

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nocache - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

13

CHANGELOG.md
# Changelog
## 3.0.0 - 2021-06-03
### Changed
- Updated documentation
### Removed
- Dropped support for old Node versions. Node 12+ is now required
## 2.1.0 - 2019-05-05
### Added
- Added TypeScript type definitions. See [#17](https://github.com/helmetjs/nocache/issues/17) and [helmetjs/helmet#188](https://github.com/helmetjs/helmet/issues/188)

@@ -9,2 +21,3 @@ - Created a changelog

### Changed
- Excluded some files from npm package

@@ -11,0 +24,0 @@ - Updated some package metadata

3

dist/index.d.ts

@@ -1,4 +0,3 @@

/// <reference types="node" />
import { IncomingMessage, ServerResponse } from 'http';
import { IncomingMessage, ServerResponse } from "http";
declare const _default: () => (_req: IncomingMessage, res: ServerResponse, next: () => void) => void;
export = _default;
"use strict";
module.exports = function nocache() {
return function nocache(_req, res, next) {
res.setHeader('Surrogate-Control', 'no-store');
res.setHeader('Cache-Control', 'no-store, no-cache, must-revalidate, proxy-revalidate');
res.setHeader('Pragma', 'no-cache');
res.setHeader('Expires', '0');
res.setHeader("Surrogate-Control", "no-store");
res.setHeader("Cache-Control", "no-store, no-cache, must-revalidate, proxy-revalidate");
res.setHeader("Pragma", "no-cache");
res.setHeader("Expires", "0");
next();
};
};

@@ -8,3 +8,3 @@ {

"description": "Middleware to destroy caching",
"version": "2.1.0",
"version": "3.0.0",
"license": "MIT",

@@ -30,3 +30,3 @@ "keywords": [

"engines": {
"node": ">=4.0.0"
"node": ">=12.0.0"
},

@@ -45,21 +45,24 @@ "main": "./dist/index.js",

"prepublishOnly": "npm run build",
"lint": "eslint --fix '**/*.ts'",
"test": "jest --config test/jest-config.json",
"lint": "npm run lint:eslint && npm run lint:prettier",
"lint:eslint": "eslint \"**/*.ts\"",
"lint:prettier": "prettier --check \"**/*.{md,js,json,ts}\"",
"format": "prettier --write \"**/*.{md,js,json,ts}\"",
"clean": "rm -rf dist",
"build": "npm run clean && tsc"
"build": "npm run clean && tsc",
"test": "jest --config test/jest-config.json"
},
"devDependencies": {
"@types/connect": "^3.4.32",
"@types/jest": "^24.0.12",
"@types/supertest": "^2.0.7",
"@typescript-eslint/eslint-plugin": "^1.7.0",
"@typescript-eslint/parser": "^1.7.0",
"connect": "^3.6.6",
"eslint": "^5.16.0",
"eslint-config-helmet": "^0.2.0",
"jest": "^24.8.0",
"supertest": "^4.0.2",
"ts-jest": "^24.0.2",
"typescript": "^3.4.5"
"@types/connect": "^3.4.34",
"@types/jest": "^26.0.23",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^4.26.0",
"@typescript-eslint/parser": "^4.26.0",
"connect": "^3.7.0",
"eslint": "^7.27.0",
"jest": "^27.0.4",
"prettier": "^2.3.0",
"supertest": "^6.1.3",
"ts-jest": "^27.0.2",
"typescript": "^4.3.2"
}
}

@@ -1,10 +0,13 @@

Middleware to turn off caching
==============================
[![Build Status](https://travis-ci.org/helmetjs/nocache.svg?branch=master)](https://travis-ci.org/helmetjs/nocache)
# Middleware to turn off caching
It's possible that you've got bugs in an old HTML or JavaScript file, and with a cache, some users will be stuck with those old versions. This will (try to) abolish all client-side caching.
This Express middleware sets some HTTP response headers to try to disable client-side caching.
To use it:
```javascript
const nocache = require('nocache')
app.use(nocache())
const nocache = require("nocache");
// ...
app.use(nocache());
```

@@ -19,2 +22,2 @@

Caching has performance benefits, and you lose them here. It's also possible that you'll introduce *new* bugs and you'll wish people had old resources cached, but that's less likely.
You may wish to do this if you want to ensure that users have up-to-date resources, or if you want to clear out an old version for some reason.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc