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

clientside-require

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

clientside-require - npm Package Compare versions

Comparing version 3.0.4 to 3.1.1

2

package.json
{
"name": "clientside-require",
"version": "3.0.4",
"version": "3.1.1",
"description": "require() modules, js, css, html, and json in the browser with as little effort as loading jquery",

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

@@ -314,2 +314,8 @@ var clientside_require = { // a singleton object

},
generate_cache_path : function(request, options){
// TODO - make smarter cachepath derivation. this does not map absolutely to all file
var relative_path_root = this.extract_relative_path_root(options);
var cache_path = relative_path_root + request;
return cache_path;
}
},

@@ -361,3 +367,4 @@

// TODO : handle require() requests inside of the module with caching included
if(typeof this._cache.promise[module_or_path] == "undefined"){ // if not in cache, build into cache
var cache_path = this.options_functionality.generate_cache_path(module_or_path, options);
if(typeof this._cache.promise[cache_path] == "undefined"){ // if not in cache, build into cache
// console.log("(!) " + module_or_path + " is not already in cache. defining promise to cache");

@@ -385,9 +392,9 @@ var relative_path_root = this.options_functionality.extract_relative_path_root(options);

.then((content)=>{
this._cache.content[module_or_path] = content; // assign content to cache to enable synchronous retreival
return this._cache.content[module_or_path]; // pull content from cache to reduce data duplication
this._cache.content[cache_path] = content; // assign content to cache to enable synchronous retreival
return this._cache.content[cache_path]; // pull content from cache to reduce data duplication
})
this._cache.promise[module_or_path] = {promise_content: promise_content, promise_path : promise_path}; // cache the promise (and consequently the result)
this._cache.promise[cache_path] = {promise_content: promise_content, promise_path : promise_path}; // cache the promise (and consequently the result)
}
var cached_promise = this._cache.promise[module_or_path];
var cached_promise = this._cache.promise[cache_path];
var promise_resolution = this.generate_resolution_based_on_options(cached_promise, options);

@@ -397,7 +404,8 @@

},
synchronous_require : function(request, options){ // NOTE - synchronous_require is ONLY usable from required scripts and is automatically injected.
synchronous_require : function(module_or_path, options){ // NOTE - synchronous_require is ONLY usable from required scripts and is automatically injected.
// synchronous require expects all dependencies to already be loaded into cache.
// console.log("requesting a synchronous_require: " + request);
// console.log(this._cache.content);
return this._cache.content[request];
var cache_path = this.options_functionality.generate_cache_path(module_or_path, options);
return this._cache.content[cache_path];
},

@@ -404,0 +412,0 @@ require : function(request, options){

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