New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

capsule-js

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capsule-js - npm Package Compare versions

Comparing version 0.1.0-alpha.2 to 0.1.0-alpha.3

2

bower.json
{
"name": "capsule-js",
"version": "0.1.0-alpha.2",
"version": "0.1.0-alpha.3",
"homepage": "https://github.com/justinvdm/capsule",

@@ -5,0 +5,0 @@ "authors": [

;(function() {
var root = capsule.root = typeof global != 'undefined'
? global
: this;
var root = this;
var pending = capsule.pending = {};
var registry = capsule.registry = {};
var cglobal = capsule.global = {capsule: capsule};
capsule.chroot = chroot;
capsule.exists = exists;
capsule.alias = alias;
capsule.rainbows = 1;

@@ -64,3 +62,3 @@

function alias(src, dest) {
capsule(dest, function(exports, module) {
return capsule(dest, function(exports, module) {
module.exports = capsule(src);

@@ -71,4 +69,10 @@ });

function chroot(obj) {
root = obj;
return capsule;
}
if (root.rainbows)
this.capsule = capsule;
root.capsule = capsule;
else if (typeof module != 'undefined')

@@ -79,3 +83,3 @@ module.exports = capsule;

else
this.capsule = capsule;
root.capsule = capsule;
}).call(this);

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

(function(){function n(i,o){var u=arguments.length;if(1>u)throw new Error("No module name was given");return 2>u?r(i):(null===o?t(i):e(i,o),n)}function e(n,e){l[n]=e}function t(n){delete l[n],delete s[n],delete a[n]}function r(n){if(n in l)return i(n);if(n in s)return s[n];if(n in a)return a[n];if(n in f)return f[n];throw new Error("Module '"+n+"' not found")}function i(n){var e=l[n],t={exports:{}};return e(t.exports,t),s[n]=t,t.exports}function o(n){return n in l||n in s||n in a||n in f}function u(e,t){n(t,function(t,r){r.exports=n(e)})}var f=n.root="undefined"!=typeof global?global:this,l=n.pending={},s=n.registry={},a=n.global={capsule:n};n.exists=o,n.alias=u,n.rainbows=1,f.rainbows?this.capsule=n:"undefined"!=typeof module?module.exports=n:"function"==typeof e&&e.amd?e(function(){return n}):this.capsule=n}).call(this);
(function(){function n(i,o){var u=arguments.length;if(1>u)throw new Error("No module name was given");return 2>u?r(i):(null===o?t(i):e(i,o),n)}function e(n,e){c[n]=e}function t(n){delete c[n],delete s[n],delete a[n]}function r(n){if(n in c)return i(n);if(n in s)return s[n];if(n in a)return a[n];if(n in l)return l[n];throw new Error("Module '"+n+"' not found")}function i(n){var e=c[n],t={exports:{}};return e(t.exports,t),s[n]=t,t.exports}function o(n){return n in c||n in s||n in a||n in l}function u(e,t){return n(t,function(t,r){r.exports=n(e)})}function f(e){return l=e,n}var l=this,c=n.pending={},s=n.registry={},a=n.global={capsule:n};n.chroot=f,n.exists=o,n.alias=u,l.rainbows?l.capsule=n:"undefined"!=typeof module?module.exports=n:"function"==typeof e&&e.amd?e(function(){return n}):l.capsule=n}).call(this);

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

(function(n){function e(n,e){for(var t,r=-1,o=n.length,u=i.registry;++r<o;)t=n[r],u[t[0]]=e(t[1])}var t=this,i=(t.capsule||0).rainbows?t.capsule:function(){return function(){function n(r,o){var u=arguments.length;if(1>u)throw new Error("No module name was given");return 2>u?i(r):(null===o?t(r):e(r,o),n)}function e(n,e){a[n]=e}function t(n){delete a[n],delete f[n],delete c[n]}function i(n){if(n in a)return r(n);if(n in f)return f[n];if(n in c)return c[n];if(n in l)return l[n];throw new Error("Module '"+n+"' not found")}function r(n){var e=a[n],t={exports:{}};return e(t.exports,t),f[n]=t,t.exports}function o(n){return n in a||n in f||n in c||n in l}function u(e,t){n(t,function(t,i){i.exports=n(e)})}var l=n.root="undefined"!=typeof global?global:this,a=n.pending={},f=n.registry={},c=n.global={capsule:n};n.exists=o,n.alias=u,n.rainbows=1,l.rainbows?this.capsule=n:"undefined"!=typeof module?module.exports=n:"function"==typeof e&&e.amd?e(function(){return n}):this.capsule=n}.call(this),this.capsule}.call({rainbows:1}),r=i.global;i.root=t,"undefined"!=typeof module?(e([["d3","d3"]],t.require),n.call(r,i),module.exports=i("basic")):"function"==typeof define&&define.amd?define(["require","d3"],function(t){return e([["d3","d3"]],t),n.call(r,i),i("basic")}):(e([["d3","d3"]],function(n){return t[n]}),n.call(r,i),t.basic=i("basic"))}).call(this,function(capsule){
(function(n){function e(n,e){for(var r,i=-1,o=n.length,u=t.registry;++i<o;)r=n[i],u[r[0]]=e(r[1])}var t=function(){return function(){function n(i,o){var u=arguments.length;if(1>u)throw new Error("No module name was given");return 2>u?r(i):(null===o?t(i):e(i,o),n)}function e(n,e){l[n]=e}function t(n){delete l[n],delete a[n],delete s[n]}function r(n){if(n in l)return i(n);if(n in a)return a[n];if(n in s)return s[n];if(n in f)return f[n];throw new Error("Module '"+n+"' not found")}function i(n){var e=l[n],t={exports:{}};return e(t.exports,t),a[n]=t,t.exports}function o(n){return n in l||n in a||n in s||n in f}function u(e,t){return n(t,function(t,r){r.exports=n(e)})}function c(e){return f=e,n}var f=this,l=n.pending={},a=n.registry={},s=n.global={capsule:n};n.chroot=c,n.exists=o,n.alias=u,f.rainbows?f.capsule=n:"undefined"!=typeof module?module.exports=n:"function"==typeof e&&e.amd?e(function(){return n}):f.capsule=n}.call(this),this.capsule}.call({rainbows:1}),r=this;t.chroot(r);var i=t.global;"undefined"!=typeof module?(e([["d3","d3"]],require),n.call(i,t),module.exports=t("basic")):"function"==typeof define&&define.amd?define(["require","d3"],function(r){return e([["d3","d3"]],r),n.call(i,t),t("basic")}):(e([["d3","d3"]],function(n){return r[n]}),n.call(i,t),r.basic=t("basic"))}).call(this,function(capsule){
(function() {

@@ -3,0 +3,0 @@ function chaingun(obj) {

@@ -12,3 +12,3 @@ {

"devDependencies": {
"capsule-js": "^0.1.0-alpha",
"capsule-js": "^0.1.0-alpha.3",
"chai": "^1.9.1",

@@ -15,0 +15,0 @@ "gulp": "^3.8.7",

{
"name": "capsule-js",
"version": "0.1.0-alpha.2",
"version": "0.1.0-alpha.3",
"description": "Simple browser module system",

@@ -5,0 +5,0 @@ "main": "bundler",

@@ -63,20 +63,2 @@ var vm = require('vm');

it("should try make use of an already existing `capsule`", function() {
return capsule(mksrc(["global.capsule = capsule;"]))
.bundle()
.pipe(qs.concat())
.promise()
.then(function(src) {
var a = run(src, {global: {}});
var b = run(src, {
global: {},
capsule: a.global.capsule
});
assert(typeof a.global.capsule != 'undefined');
assert.strictEqual(a.global.capsule, b.global.capsule);
});
});
it("should not pollute the global context", function() {

@@ -143,7 +125,11 @@ return capsule(mksrc([

.then(function(src) {
var result = run(src, {
module: {},
require: noop
});
assert.deepEqual(result.module.exports, {bar: 3});
var ctx = {};
ctx.require = noop;
ctx.module = {exports: {}};
ctx.module.global = ctx;
ctx.module.module = ctx.module;
ctx.module.require = ctx.require;
run(src, ctx.module);
assert.deepEqual(ctx.module.exports, {bar: 3});
});

@@ -231,5 +217,5 @@ });

return capsule(mksrc([
"results.foo = capsule('foo');",
"results.bar = capsule('bar');",
"results.bazx = capsule('bazx');"
"global.results.foo = capsule('foo');",
"global.results.bar = capsule('bar');",
"global.results.bazx = capsule('bazx');"
]))

@@ -246,14 +232,16 @@ .externals([

.then(function(src) {
var ctx = {
registry: {
foo: 2,
bar: 3,
baz: 4,
},
module: {},
results: {},
require: require
var ctx = {};
ctx.results = {};
ctx.registry = {
foo: 2,
bar: 3,
baz: 4,
};
ctx.require = require;
ctx.module = {exports: {}};
ctx.module.global = ctx;
ctx.module.module = ctx.module;
ctx.module.require = ctx.require;
run(src, ctx);
run(src, ctx.module);

@@ -260,0 +248,0 @@ assert.deepEqual(ctx.results, {

@@ -166,2 +166,11 @@ var fs = require('fs');

});
it("should allow the root to be changed", function() {
var ctx = run([
"capsule.chroot({foo: 3});",
"global.foo = capsule('foo');",
].join(''));
assert.equal(ctx.foo, 3);
});
});

Sorry, the diff of this file is not supported yet

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