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

nodecommons-express

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nodecommons-express - npm Package Compare versions

Comparing version 1.4.1 to 1.4.2

2

dist/helpers/commons-express.d.ts

@@ -6,2 +6,4 @@ import * as express from 'express';

static noCache(res: express.Response): void;
static cache(res: express.Response, seconds: number): void;
static useCacheIfUnchanged(res: express.Response): void;
private static isValidIp;

@@ -8,0 +10,0 @@ static getIpAddress(req: express.Request, real?: boolean): string | undefined;

@@ -12,2 +12,10 @@ "use strict";

}
static cache(res, seconds) {
res.setHeader('Cache-Control', `public, max-age=${seconds}`);
}
static useCacheIfUnchanged(res) {
// see "Requiring revalidation": https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
// Makes browsers check for a new version, but not download if it isn't changed
res.setHeader('Cache-Control', 'no-cache, max-age=0');
}
static isValidIp(value) {

@@ -14,0 +22,0 @@ if (value === undefined || value === null)

3

dist/servers/commons-express.server.d.ts

@@ -10,5 +10,2 @@ /// <reference types="node" />

private readonly port;
static noCache(res: express.Response): void;
static cache(res: express.Response, seconds: number): void;
static useCacheIfUnchanged(res: express.Response): void;
static nginxProxyPath(p?: string): string;

@@ -15,0 +12,0 @@ static cleanupMultiPartFiles(request: express.Request): void;

@@ -20,2 +20,3 @@ "use strict";

const nodecommons_file_1 = require("nodecommons-file");
const commons_express_1 = require("../helpers/commons-express");
const commons_angular_exts_1 = require("../consts/commons-angular-exts");

@@ -36,15 +37,2 @@ function isFile(test) {

}
static noCache(res) {
res.setHeader('Cache-Control', 'no-cache, private, no-store, must-revalidate, max-stale=0, post-check=0, pre-check=0');
res.setHeader('Expires', '-1');
res.setHeader('Pragma', 'no-cache');
}
static cache(res, seconds) {
res.setHeader('Cache-Control', `public, max-age=${seconds}`);
}
static useCacheIfUnchanged(res) {
// see "Requiring revalidation": https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
// Makes browsers check for a new version, but not download if it isn't changed
res.setHeader('Cache-Control', 'no-cache, max-age=0');
}
static nginxProxyPath(p) {

@@ -127,9 +115,9 @@ if (p === undefined)

if (commons_angular_exts_1.COMMONS_ANGULAR_EXTS_NOCACHE.includes(ext[1])) {
CommonsExpressServer.noCache(res);
commons_express_1.CommonsExpress.noCache(res);
}
if (commons_angular_exts_1.COMMONS_ANGULAR_EXTS_CACHE.includes(ext[1])) {
CommonsExpressServer.cache(res, cacheMaxAgeSeconds);
commons_express_1.CommonsExpress.cache(res, cacheMaxAgeSeconds);
}
if (commons_angular_exts_1.COMMONS_ANGULAR_EXTS_USE_CACHE_IF_UNCHANGED.includes(ext[1])) {
CommonsExpressServer.useCacheIfUnchanged(res);
commons_express_1.CommonsExpress.useCacheIfUnchanged(res);
}

@@ -147,3 +135,3 @@ }

this.ex.get(`${url}*`, (_, res) => {
CommonsExpressServer.useCacheIfUnchanged(res);
commons_express_1.CommonsExpress.noCache(res);
res.sendFile(path.join(absolute, '/index.html'));

@@ -150,0 +138,0 @@ });

{
"name": "nodecommons-express",
"version": "1.4.1",
"version": "1.4.2",
"description": "",

@@ -26,3 +26,3 @@ "scripts": {

"devDependencies": {
"@types/node": "^13.9.5"
"@types/node": "^13.9.8"
},

@@ -29,0 +29,0 @@ "files": [

Sorry, the diff of this file is not supported yet

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