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

es-module-loader

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-module-loader - npm Package Compare versions

Comparing version 2.2.4 to 2.2.5

110

core/register-loader.js

@@ -101,7 +101,2 @@ import { Loader, ModuleNamespace, REGISTRY } from './loader-polyfill.js';

// indicates if the load and all its dependencies are instantiated and linked
// but not yet executed
// mostly just a performance shortpath to avoid rechecking the promises above
linked: false
// NB optimization and way of ensuring module objects in setters

@@ -137,8 +132,5 @@ // indicates setters which should run pre-execution of that dependency

if (instantiated.linkRecord.linked)
return ensureEvaluate(loader, instantiated, instantiated.linkRecord, registry, state, undefined);
return instantiateDeps(loader, instantiated, instantiated.linkRecord, registry, state, [instantiated])
return deepInstantiateDeps(loader, instantiated, link, registry, state)
.then(function () {
return ensureEvaluate(loader, instantiated, instantiated.linkRecord, registry, state, undefined);
return ensureEvaluate(loader, instantiated, link, registry, state, undefined);
});

@@ -249,9 +241,2 @@ });

// shortpath to instantiateDeps
if (!link.dependencies.length) {
link.linked = true;
if (loader.trace)
traceLoad(loader, load, link);
}
return load;

@@ -378,12 +363,12 @@ })

function instantiateDeps (loader, load, link, registry, state, seen) {
return (link.depsInstantiatePromise || (link.depsInstantiatePromise = Promise.resolve()
.then(function () {
var depsInstantiatePromises = Array(link.dependencies.length);
function instantiateDeps (loader, load, link, registry, state) {
if (link.depsInstantiatePromise)
return link.depsInstantiatePromise;
for (var i = 0; i < link.dependencies.length; i++)
depsInstantiatePromises[i] = resolveInstantiateDep(loader, link.dependencies[i], load.key, registry, state, loader.trace && link.depMap || (link.depMap = {}));
var depsInstantiatePromises = Array(link.dependencies.length);
return Promise.all(depsInstantiatePromises);
})
for (var i = 0; i < link.dependencies.length; i++)
depsInstantiatePromises[i] = resolveInstantiateDep(loader, link.dependencies[i], load.key, registry, state, loader.trace && link.depMap || (link.depMap = {}));
var depsInstantiatePromise = Promise.all(depsInstantiatePromises)
.then(function (dependencyInstantiations) {

@@ -413,41 +398,56 @@ link.dependencyInstantiations = dependencyInstantiations;

}
})))
.then(function () {
// now deeply instantiateDeps on each dependencyInstantiation that is a load record
var deepDepsInstantiatePromises = [];
for (var i = 0; i < link.dependencies.length; i++) {
var depLoad = link.dependencyInstantiations[i];
var depLink = depLoad.linkRecord;
return load;
});
if (!depLink || depLink.linked)
continue;
if (seen.indexOf(depLoad) !== -1) {
deepDepsInstantiatePromises.push(depLink.depsInstantiatePromise);
continue;
}
seen.push(depLoad);
deepDepsInstantiatePromises.push(instantiateDeps(loader, depLoad, depLoad.linkRecord, registry, state, seen));
}
return Promise.all(deepDepsInstantiatePromises);
})
.then(function () {
// as soon as all dependencies instantiated, we are ready for evaluation so can add to the registry
// this can run multiple times, but so what
link.linked = true;
if (loader.trace)
if (loader.trace)
depsInstantiatePromise = depsInstantiatePromise.then(function () {
traceLoad(loader, load, link);
return load;
});
return load;
})
.catch(function (err) {
depsInstantiatePromise = depsInstantiatePromise.catch(function (err) {
// throw up the instantiateDeps stack
link.depsInstantiatePromise = undefined;
throw addToError(err, 'Loading ' + load.key);
});
depsInstantiatePromise.catch(function () {});
return link.depsInstantiatePromise = depsInstantiatePromise;
}
function deepInstantiateDeps (loader, load, link, registry, state) {
return new Promise(function (resolve, reject) {
var seen = [];
var loadCnt = 0;
function queueLoad (load) {
var link = load.linkRecord;
if (!link)
return;
if (seen.indexOf(load) !== -1)
return;
seen.push(load);
loadCnt++;
instantiateDeps(loader, load, link, registry, state)
.then(processLoad, reject);
}
function processLoad (load) {
loadCnt--;
var link = load.linkRecord;
if (link) {
for (var i = 0; i < link.dependencies.length; i++) {
var depLoad = link.dependencyInstantiations[i];
if (!(depLoad instanceof ModuleNamespace))
queueLoad(depLoad);
}
}
if (loadCnt === 0)
resolve();
}
queueLoad(load);
});
}
/*

@@ -454,0 +454,0 @@ * System.register

{
"name": "es-module-loader",
"description": "An ES Module Loader shim",
"version": "2.2.4",
"version": "2.2.5",
"homepage": "https://github.com/ModuleLoader/es-module-loader",

@@ -6,0 +6,0 @@ "author": {

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