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 4.4.0 to 4.4.1

93

dist/bundle.js

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

(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
var sleep = function(ms){ return new Promise(resolve => setTimeout(resolve, ms)); }
/*
Dynamic_Serial_Promise_All :
- handles situations where we want to wait for a dynamic amount of serially dependent processes
- since we do not know in advance what processes we will want to wait for after a prior process resolves, we will have to "re-check" the promise list
- recheck :
- after original promises resolve
- if on recheck all promises resolve, wait another 100microseconds and recheck
- if second recheck succeeds, then we can be fairly confident we are done
*/
var Dynamic_Serial_Promise_All = function(safety_lap_wait_time){
if(typeof safety_lap_wait_time != "number") safety_lap_wait_time = 100;
this.safety_lap_wait_time = safety_lap_wait_time;
this.promise_list = [];
}
Dynamic_Serial_Promise_All.prototype = {
get promise_all(){
return this.promise_all_promises_have_resolved();
},
wait_for : function(promise){
this.promise_list.push(promise);
},
promise_all_promises_have_resolved : async function(bool_safety_lap){
/*
this function conducts Promise.all() on all current promises
after resolving, it checks if there are any new promises added.
- if added, run self again
- if not added, sleep for 100 milliseconds and run self again
- if safty_lap run resolves and still no new promises, resolve completely.
*/
// run promise all on all current promises
var original_promise_count = this.promise_list.length;
var result = await Promise.all(this.promise_list);
// check if promise count has changed
var now_promises_count = this.promise_list.length;
var promises_added = (original_promise_count != now_promises_count);
// act on change
if(promises_added){ // promises were added, wait untill all resolve again
return this.promise_all_promises_have_resolved();
} else if(bool_safety_lap===true){ // saftey lap was run and no change in promise count
return result;
} else {
await sleep(this.safety_lap_wait_time); // wait for 100 ms
return this.promise_all_promises_have_resolved(true); // run safety lap
}
},
reset : function(){
/*
utility function to cleanly empty the promise_list
*/
this.promise_list = [];
},
}
module.exports = Dynamic_Serial_Promise_All;
},{}],2:[function(require,module,exports){
// shim for using process in browser

@@ -187,3 +246,3 @@ var process = module.exports = {};

},{}],2:[function(require,module,exports){
},{}],3:[function(require,module,exports){
var normalize_path = require("./utilities/request_analysis/normalize_path.js");

@@ -233,3 +292,3 @@

},{"./utilities/request_analysis/normalize_path.js":10}],3:[function(require,module,exports){
},{"./utilities/request_analysis/normalize_path.js":11}],4:[function(require,module,exports){
/*

@@ -267,2 +326,11 @@ Clientside Require Module

/*
define the `promise_all` property, enabling users to determine when all `load`ing has completed
- this is useful for contexts such as server side rendering
*/
promise_manager : new (require('dynamic-serial-promise-all'))(),
get promise_all(){
return this.promise_manager.promise_all;
},
/*
asynchronous_require - the main method used

@@ -282,2 +350,3 @@ - returns a promise which resolves with the requested content

var promise_content = this.retreiver.promise_to_retreive_content(module_or_path, this.modules_root, options);
this.promise_manager.wait_for(promise_content); // ensure promise_manager waits for each `load` promise when determining all is loaded
this.cache.set(cache_path, promise_content)

@@ -320,3 +389,3 @@ }

},{"./cache.js":2,"./retreive.js":4,"./utilities/normalize_request_options":8}],4:[function(require,module,exports){
},{"./cache.js":3,"./retreive.js":5,"./utilities/normalize_request_options":9,"dynamic-serial-promise-all":1}],5:[function(require,module,exports){
/*

@@ -415,3 +484,3 @@ retreival_manager handles placing requests to load content. handles sync and async requires.

},{"./utilities/content_loading/scoped.js":7,"./utilities/request_analysis/decompose_request.js":9}],5:[function(require,module,exports){
},{"./utilities/content_loading/scoped.js":8,"./utilities/request_analysis/decompose_request.js":10}],6:[function(require,module,exports){
/*

@@ -479,2 +548,3 @@ basic resource loading methods that do not nessesarily preserve scope

} catch (err){
console.error(err);
throw (err);

@@ -516,3 +586,3 @@ }

},{}],6:[function(require,module,exports){
},{}],7:[function(require,module,exports){
(function (process){

@@ -599,2 +669,3 @@ var basic_loaders = require("./basic.js");

pathname : anchor.pathname,
pathdir : anchor.pathname.substring(0, anchor.pathname.lastIndexOf("/")) + "/", // path to this file without the filename
};

@@ -659,3 +730,3 @@ },

}).call(this,require('_process'))
},{"./basic.js":5,"_process":1}],7:[function(require,module,exports){
},{"./basic.js":6,"_process":2}],8:[function(require,module,exports){
var basic_loaders = require("./basic.js");

@@ -676,3 +747,3 @@ var commonjs_loader = require("./commonjs.js");

},{"./basic.js":5,"./commonjs.js":6}],8:[function(require,module,exports){
},{"./basic.js":6,"./commonjs.js":7}],9:[function(require,module,exports){
module.exports = function(options){

@@ -691,3 +762,3 @@ if(typeof options == "undefined") options = {}; // ensure options are defined

},{}],9:[function(require,module,exports){
},{}],10:[function(require,module,exports){
var basic_loaders = require("./../content_loading/basic.js");

@@ -784,3 +855,3 @@ var normalize_path = require("./normalize_path.js");

},{"./../content_loading/basic.js":5,"./normalize_path.js":10}],10:[function(require,module,exports){
},{"./../content_loading/basic.js":6,"./normalize_path.js":11}],11:[function(require,module,exports){
/*

@@ -867,2 +938,2 @@ analyze and normalize path

},{}]},{},[3]);
},{}]},{},[4]);

2

package.json
{
"name": "clientside-require",
"version": "4.4.0",
"version": "4.4.1",
"description": "Node.js style require() statements in the browser. Load npm modules, js, html, css, json without any bundling.",

@@ -5,0 +5,0 @@ "main": "src/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