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

buildumb

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

buildumb - npm Package Compare versions

Comparing version

to
0.1.0

11

lib/buildumb.js

@@ -28,3 +28,3 @@ var fs = require('fs')

* config.root -- absolute path to build root directory (usually project dir)
* config.modules -- {require() string -> code path} as used in your code
* config.modules -- {code path -> [require() string]} as used in your code
* config.exports -- {global variable name -> require() string} to be exported

@@ -40,7 +40,8 @@ * config.output -- built output file location

var exported = []
for (var name in config.modules) {
var modulePath = normjoin(config.root, config.modules[name])
console.log('compile: %s (from %s)', name, modulePath)
for (var relativePath in config.modules) {
var modulePath = normjoin(config.root, relativePath)
, requireStrings = config.modules[relativePath]
console.log('compile: %j (from %s)', requireStrings, modulePath)
exported.push(
util.format("require.define('%s', function(module, exports, require) {\n", name) +
util.format("require.define(%j, function(module, exports, require) {\n", requireStrings) +
fs.readFileSync(modulePath) +

@@ -47,0 +48,0 @@ '})\n'

{
"name": "buildumb",
"description": "Ultra-dumb exporter of Node.js modules for use in the browser",
"version": "0.0.1",
"version": "0.1.0",
"author": "Jonathan Buchanan <jonathan.buchanan@gmail.com> (https://github.com/insin)",

@@ -6,0 +6,0 @@ "tags": ["build", "export", "browser", "modules"],

@@ -6,3 +6,3 @@ ;(function() {

}
require.define = function(name, fn) {
require.define = function(rs, fn) {
var module = {}

@@ -12,3 +12,10 @@ , exports = {}

fn(module, exports, require)
modules[name] = module.exports
if (Object.prototype.toString.call(rs) == '[object Array]') {
for (var i = 0, l = rs.length; i < l; i++) {
modules[rs[i]] = module.exports
}
}
else {
modules[rs] = module.exports
}
}

@@ -15,0 +22,0 @@

Sorry, the diff of this file is not supported yet