isolated-externals-plugin
Advanced tools
Comparing version 2.4.2 to 2.4.3-fix-safari-private-cache-d09b245.1
@@ -29,3 +29,3 @@ export interface ExternalInfo { | ||
constructor(url: string); | ||
getCache(): Promise<CacheLike>; | ||
getCache(forceStatic?: boolean): Promise<CacheLike>; | ||
getContent(): Promise<string | undefined>; | ||
@@ -35,3 +35,3 @@ setContent(content: string): Promise<void>; | ||
waitForReady(): Promise<void>; | ||
loadResponse(): Promise<Response | undefined>; | ||
loadResponse(forceStatic?: boolean): Promise<Response | undefined>; | ||
load(): Promise<void>; | ||
@@ -38,0 +38,0 @@ } |
@@ -227,3 +227,4 @@ "use strict"; | ||
} | ||
CachedExternal.prototype.getCache = function () { | ||
CachedExternal.prototype.getCache = function (forceStatic) { | ||
if (forceStatic === void 0) { forceStatic = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
@@ -234,3 +235,3 @@ var staticCachePromise, openCachePromise, _a, staticCache; | ||
case 0: | ||
if (!this.cachePromise) return [3 /*break*/, 2]; | ||
if (!(this.cachePromise && !forceStatic)) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, this.cachePromise]; | ||
@@ -240,2 +241,4 @@ case 1: return [2 /*return*/, _b.sent()]; | ||
_b.trys.push([2, 4, , 6]); | ||
if (forceStatic) | ||
throw new Error('Forcing static cache...'); | ||
staticCachePromise = new Promise(function (res) { | ||
@@ -327,8 +330,9 @@ setTimeout(function () { return res(new StaticCache()); }, 100); | ||
}; | ||
CachedExternal.prototype.loadResponse = function () { | ||
CachedExternal.prototype.loadResponse = function (forceStatic) { | ||
if (forceStatic === void 0) { forceStatic = false; } | ||
return __awaiter(this, void 0, void 0, function () { | ||
var cache, cacheMatch, response; | ||
var cache, cacheMatch, er_1, response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, this.getCache()]; | ||
case 0: return [4 /*yield*/, this.getCache(forceStatic)]; | ||
case 1: | ||
@@ -341,16 +345,37 @@ cache = _a.sent(); | ||
return [2 /*return*/, cacheMatch]; | ||
_a.label = 3; | ||
case 3: | ||
_a.trys.push([3, 5, , 6]); | ||
return [4 /*yield*/, cache.add(this.url)]; | ||
case 3: | ||
case 4: | ||
_a.sent(); | ||
return [4 /*yield*/, cache.match(this.url)]; | ||
case 4: | ||
return [3 /*break*/, 6]; | ||
case 5: | ||
er_1 = _a.sent(); | ||
if (!forceStatic) { | ||
console.warn('Failed to cache external:', this.url); | ||
console.error(er_1); | ||
} | ||
return [3 /*break*/, 6]; | ||
case 6: return [4 /*yield*/, cache.match(this.url)]; | ||
case 7: | ||
response = _a.sent(); | ||
if (!response) | ||
if (!!response) return [3 /*break*/, 9]; | ||
if (forceStatic) { | ||
return [2 /*return*/]; | ||
if (!response.redirected) return [3 /*break*/, 6]; | ||
} | ||
return [4 /*yield*/, this.loadResponse(true)]; | ||
case 8: | ||
response = _a.sent(); | ||
if (!response) { | ||
return [2 /*return*/]; | ||
} | ||
_a.label = 9; | ||
case 9: | ||
if (!response.redirected) return [3 /*break*/, 11]; | ||
return [4 /*yield*/, cache.put(response.url, response.clone())]; | ||
case 5: | ||
case 10: | ||
_a.sent(); | ||
_a.label = 6; | ||
case 6: return [2 /*return*/, response]; | ||
_a.label = 11; | ||
case 11: return [2 /*return*/, response]; | ||
} | ||
@@ -357,0 +382,0 @@ }); |
{ | ||
"name": "isolated-externals-plugin", | ||
"version": "2.4.2", | ||
"version": "2.4.3-fix-safari-private-cache-d09b245.1", | ||
"description": "", | ||
@@ -21,3 +21,3 @@ "main": "dist/index.js", | ||
"type": "git", | ||
"url": "git+https://github.com/WTW-IM/isolated-externals-plugin.git" | ||
"url": "git+https://github.com/im-open/isolated-externals-plugin.git" | ||
}, | ||
@@ -36,5 +36,5 @@ "keywords": [ | ||
"bugs": { | ||
"url": "https://github.com/WTW-IM/isolated-externals-plugin/issues" | ||
"url": "https://github.com/im-open/isolated-externals-plugin/issues" | ||
}, | ||
"homepage": "https://github.com/WTW-IM/isolated-externals-plugin#readme", | ||
"homepage": "https://github.com/im-open/isolated-externals-plugin#readme", | ||
"lint-staged": { | ||
@@ -53,20 +53,24 @@ "src/**/*.(j|t)s?(x)": [ | ||
"devDependencies": { | ||
"@babel/cli": "^7.19.3", | ||
"@babel/cli": "^7.24.7", | ||
"@babel/eslint-parser": "^7.19.1", | ||
"@babel/preset-env": "^7.12.13", | ||
"@babel/preset-env": "^7.24.7", | ||
"@babel/preset-react": "^7.18.6", | ||
"@babel/preset-typescript": "^7.12.13", | ||
"@commitlint/cli": "^17.6.7", | ||
"@commitlint/config-conventional": "^11.0.0", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@commitlint/cli": "^19.3.0", | ||
"@commitlint/config-conventional": "^19.2.2", | ||
"@semantic-release/changelog": "^6.0.3", | ||
"@semantic-release/commit-analyzer": "^13.0.0", | ||
"@semantic-release/git": "^10.0.1", | ||
"@semantic-release/github": "^10.0.6", | ||
"@semantic-release/npm": "^12.0.1", | ||
"@semantic-release/release-notes-generator": "^14.0.0", | ||
"@types/jest": "^29.2.3", | ||
"@types/randomstring": "^1.1.8", | ||
"@types/react-modal": "^3.16.0", | ||
"@types/webpack": "^5.28.1", | ||
"@types/webpack": "^5.28.5", | ||
"@typescript-eslint/eslint-plugin": "^6.1.0", | ||
"@typescript-eslint/parser": "^6.1.0", | ||
"ajv": "^8.11.2", | ||
"babel-loader": "^9.1.0", | ||
"conventional-changelog-eslint": "^3.0.9", | ||
"babel-loader": "^9.1.3", | ||
"conventional-changelog-eslint": "^6.0.0", | ||
"eslint": "^8.45.0", | ||
@@ -77,3 +81,3 @@ "eslint-config-prettier": "^7.2.0", | ||
"husky": "^6.0.0", | ||
"jest": "^29.3.1", | ||
"jest": "^29.7.0", | ||
"lint-staged": "^10.5.4", | ||
@@ -84,5 +88,5 @@ "prettier": "2.2.1", | ||
"react-modal": "^3.16.1", | ||
"semantic-release": "^21.0.7", | ||
"semantic-release": "^24.0.0", | ||
"typescript": "^5.1.6", | ||
"webpack": "^5.86.0", | ||
"webpack": "^5.92.1", | ||
"webpack-cli": "^5.0.0", | ||
@@ -89,0 +93,0 @@ "webpack-dev-server": "^4.11.1" |
# isolated-externals-plugin | ||
[![Build Status](https://travis-ci.com/WTW-IM/isolated-externals-plugin.svg?branch=master)](https://travis-ci.com/github/WTW-IM/isolated-externals-plugin) | ||
![Build Status](https://github.com/im-open/isolated-externals-plugin/actions/workflows/main.yml/badge.svg) | ||
[![npm version](https://badge.fury.io/js/isolated-externals-plugin.svg)](https://badge.fury.io/js/isolated-externals-plugin) | ||
@@ -5,0 +5,0 @@ |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
122803
1635
38
1