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

isolated-externals-plugin

Package Overview
Dependencies
Maintainers
4
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isolated-externals-plugin - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

dist/util/externalsCache.d.ts

4

dist/util/externalsClasses.d.ts

@@ -1,2 +0,1 @@

export type CachedExternals = Record<string, CachedExternal>;
export interface ExternalInfo {

@@ -17,2 +16,3 @@ globalName?: string;

loaded: boolean;
private response;
private cachePromise?;

@@ -26,3 +26,3 @@ private retries;

setContent(content: string): Promise<void>;
waitForLoad(): Promise<void>;
waitForLoad(): Promise<Response | undefined>;
waitForReady(): Promise<void>;

@@ -29,0 +29,0 @@ loadResponse(): Promise<Response | undefined>;

@@ -299,3 +299,3 @@ "use strict";

if (!_this.loading)
return res();
return res(_this.response);
window.requestAnimationFrame(checkLoad);

@@ -323,3 +323,3 @@ };

return __awaiter(this, void 0, void 0, function () {
var cache;
var cache, cacheMatch, response;
return __generator(this, function (_a) {

@@ -330,6 +330,21 @@ switch (_a.label) {

cache = _a.sent();
return [4 /*yield*/, cache.match(this.url)];
case 2:
cacheMatch = _a.sent();
if (cacheMatch)
return [2 /*return*/, cacheMatch];
return [4 /*yield*/, cache.add(this.url)];
case 2:
case 3:
_a.sent();
return [2 /*return*/, cache.match(this.url)];
return [4 /*yield*/, cache.match(this.url)];
case 4:
response = _a.sent();
if (!response)
return [2 /*return*/];
if (!response.redirected) return [3 /*break*/, 6];
return [4 /*yield*/, cache.put(response.url, response.clone())];
case 5:
_a.sent();
_a.label = 6;
case 6: return [2 /*return*/, response];
}

@@ -341,5 +356,5 @@ });

return __awaiter(this, void 0, void 0, function () {
var cache, response, _a, err_1;
return __generator(this, function (_b) {
switch (_b.label) {
var response, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:

@@ -351,24 +366,15 @@ if (this.loaded)

case 1:
_b.sent();
_b.label = 2;
_a.sent();
_a.label = 2;
case 2:
_b.trys.push([2, 7, , 8]);
return [4 /*yield*/, this.getCache()];
_a.trys.push([2, 4, , 5]);
return [4 /*yield*/, this.loadResponse()];
case 3:
cache = _b.sent();
return [4 /*yield*/, cache.match(this.url)];
case 4:
_a = (_b.sent());
if (_a) return [3 /*break*/, 6];
return [4 /*yield*/, this.loadResponse()];
case 5:
_a = (_b.sent());
_b.label = 6;
case 6:
response = _a;
response = _a.sent();
this.failed = !(response === null || response === void 0 ? void 0 : response.ok) || (response === null || response === void 0 ? void 0 : response.status) >= 400;
this.loaded = true;
return [3 /*break*/, 8];
case 7:
err_1 = _b.sent();
this.response = response;
return [3 /*break*/, 5];
case 4:
err_1 = _a.sent();
/*

@@ -384,7 +390,8 @@ * Chrome occasionally fails with a network error when attempting to cache

else {
console.error(err_1);
this.failed = true;
this.error = err_1; // eslint-disable-line @typescript-eslint/no-unsafe-assignment
}
return [3 /*break*/, 8];
case 8:
return [3 /*break*/, 5];
case 5:
this.loading = false;

@@ -391,0 +398,0 @@ return [2 /*return*/];

@@ -1,9 +0,6 @@

import { Externals, CachedExternals } from './externalsClasses';
import { Externals } from './externalsClasses';
declare global {
const ISOLATED_EXTERNALS_OBJECT: Externals;
const __webpack_modules__: Record<string, unknown>;
interface Window {
__isolatedExternalsCacheV3: CachedExternals;
}
}
export declare const externals: Record<string, unknown>;

@@ -72,11 +72,3 @@ "use strict";

var getGlobal_1 = __importDefault(require("./getGlobal"));
function getExternal(url) {
window.__isolatedExternalsCacheV3 = window.__isolatedExternalsCacheV3 || {};
return (window.__isolatedExternalsCacheV3[url] ||
(function () {
var theExternal = new externalsClasses_1.CachedExternal(url);
window.__isolatedExternalsCacheV3[url] = theExternal;
return theExternal;
})());
}
var externalsCache_1 = require("./externalsCache");
function loadExternal(context, url, previousDeps) {

@@ -90,3 +82,3 @@ return __awaiter(this, void 0, void 0, function () {

_a.sent();
cachedExternal = getExternal(url);
cachedExternal = (0, externalsCache_1.getExternal)(url);
processingPromise = (0, processExternals_1.processExternal)(context, cachedExternal);

@@ -93,0 +85,0 @@ return [2 /*return*/, processingPromise];

{
"name": "isolated-externals-plugin",
"version": "2.1.0",
"version": "2.2.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

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