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

modulr

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

modulr - npm Package Compare versions

Comparing version 0.1.0 to 0.1.2

.arcconfig

44

lib/builder.js
var fs = require('fs'),
path = require('path');
var RUNTIME_PATH = path.join(__dirname, '..', 'assets', 'modulr.sync.js');
var RUNTIME_PATH = path.join(__dirname, '..', 'assets', 'modulr.sync.js'),
JS_ESCAPE_REGEXP = /\\|\r?\n|"/g,
INLINE_SCRIPT_SAFE_JS_ESCAPE_REGEXP = /\\|\r?\n|"|<\//g,
JS_ESCAPE_MAP = {
'\\': '\\\\',
'\n': '\\n',
'\r\n': '\\n',
'"': '\\"',
'</': '<\/'
};
exports.createBuilder = createBuilder;

@@ -14,2 +24,4 @@ exports.create = createBuilder;

function Builder(config) {
this.lazyEval = config.lazyEval || false;
this.inlineSafe = !!config.inlineSafe;
}

@@ -21,5 +33,16 @@

var deps = result.dependencies,
output = '';
output = '',
lazyEval = this.lazyEval;
output += Object.keys(deps).map(function(id) {
// if lazy-eval is true, all modules are lazy-evaled.
if (lazyEval === true) {
return this.toLazyEvalTransport(deps[id]);
}
// Else lazyEval is an array of modules that are to be lazy-evaled.
if (lazyEval && lazyEval.indexOf(id) > -1) {
return this.toLazyEvalTransport(deps[id]);
}
return this.toTransport(deps[id]);

@@ -47,2 +70,19 @@ }, this).join('');

}
p.toLazyEvalTransport = toLazyEvalTransport;
function toLazyEvalTransport(module) {
var output = '';
output += '\ndefine("' + module.id + '", "';
output += this.escape(module.src, this.inlineSafe);
output += '");\n';
return output;
}
p.escape = escape;
function escape(str, inlineSafe) {
var regexp = inlineSafe ? INLINE_SCRIPT_SAFE_JS_ESCAPE_REGEXP : JS_ESCAPE_REGEXP;
return str.replace(regexp, function(m) {
return JS_ESCAPE_MAP[m];
});
}
})(Builder.prototype);

12

main.js

@@ -23,8 +23,8 @@ var fs = require('fs'),

} else {
var packageFile, root;
var packageFile, config = {};
if (stat.isDirectory()) {
root = p;
packageFile = path.join(root, 'package.json');
config.root = p;
packageFile = path.join(p, 'package.json');
} else {
root = path.rootname(p);
config.root = path.rootname(p);
packageFile = p;

@@ -41,3 +41,5 @@ }

paths.push('.');
build(json.main, { paths: paths, root: root }, callback);
config.paths = paths;
config.lazyEval = json.builder_lazy_eval_modules;
build(json.main, config, callback);
}

@@ -44,0 +46,0 @@ });

@@ -5,6 +5,11 @@ {

"main": "./main",
"version": "0.1.0",
"version": "0.1.2",
"dependencies": {
"module-grapher" : ">=0.4.0"
},
"author": {
"name": "Tobie Langel",
"email": "tobie.langel@gmail.com",
"web": "http://tobielangel.com"
},
"maintainers": [

@@ -11,0 +16,0 @@ {

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