node-iframe
Advanced tools
Comparing version 1.3.1 to 1.3.2
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
exports.__esModule = true; | ||
exports.configureCacheControl = exports.appCache = void 0; | ||
var node_cache_1 = __importDefault(require("node-cache")); | ||
var config_1 = require("@app/config"); | ||
@@ -17,11 +13,25 @@ function _extractValidNodeCacheOptions(options) { | ||
} | ||
var appCache = new node_cache_1["default"](_extractValidNodeCacheOptions(config_1.cacheConfig)); | ||
var appCache; | ||
exports.appCache = appCache; | ||
function createCache() { | ||
if (!config_1.cacheConfig.disabled) { | ||
var NodeCache = require("node-cache"); | ||
appCache: NodeCache; | ||
exports.appCache = appCache = new NodeCache(_extractValidNodeCacheOptions((appCache === null || appCache === void 0 ? void 0 : appCache.options) || config_1.cacheConfig)); | ||
} | ||
} | ||
function configureCacheControl(options) { | ||
if ("disabled" in options) { | ||
config_1.cacheConfig.disabled = options.disabled; | ||
config_1.cacheConfig.disabled = !!options.disabled; | ||
options.disabled ? (exports.appCache = appCache = {}) : createCache(); | ||
} | ||
appCache.options = Object.assign({}, appCache.options, _extractValidNodeCacheOptions(options)); | ||
if (!config_1.cacheConfig.disabled) { | ||
if (typeof appCache === "undefined") { | ||
exports.appCache = appCache = {}; | ||
} | ||
appCache.options = Object.assign({}, appCache === null || appCache === void 0 ? void 0 : appCache.options, _extractValidNodeCacheOptions(options)); | ||
} | ||
} | ||
exports.configureCacheControl = configureCacheControl; | ||
createCache(); | ||
//# sourceMappingURL=cache.js.map |
@@ -104,7 +104,7 @@ "use strict"; | ||
} | ||
if (!!config_1.cacheConfig.disabled) return [3, 4]; | ||
if (!(!config_1.cacheConfig.disabled && (cache_1.appCache === null || cache_1.appCache === void 0 ? void 0 : cache_1.appCache.get))) return [3, 4]; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4, cache_1.appCache.get(url)]; | ||
return [4, (cache_1.appCache === null || cache_1.appCache === void 0 ? void 0 : cache_1.appCache.get(url))]; | ||
case 2: | ||
@@ -139,3 +139,3 @@ cachedHtml = _b.sent(); | ||
} | ||
!config_1.cacheConfig.disabled && cache_1.appCache.set(url, $html_1.html()); | ||
!config_1.cacheConfig.disabled && (cache_1.appCache === null || cache_1.appCache === void 0 ? void 0 : cache_1.appCache.set(url, $html_1.html())); | ||
} | ||
@@ -142,0 +142,0 @@ if (server) { |
{ | ||
"name": "node-iframe", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "create a iframe on your server to bypass CORS issues. ( reverse engineer security issues )", | ||
@@ -5,0 +5,0 @@ "main": "dist/iframe.js", |
@@ -1,7 +0,7 @@ | ||
import NodeCache, { Options as CacheOptions } from "node-cache"; | ||
import { Options as CacheOptions } from "node-cache"; | ||
interface AppCache extends CacheOptions { | ||
disabled: boolean; | ||
disabled?: boolean; | ||
} | ||
declare const appCache: NodeCache; | ||
declare let appCache: any; | ||
declare function configureCacheControl(options: AppCache): void; | ||
export { appCache, configureCacheControl }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36487
516