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

one

Package Overview
Dependencies
Maintainers
1
Versions
184
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

one - npm Package Compare versions

Comparing version 1.7.1 to 1.7.2

5

lib/manifest.js

@@ -9,2 +9,3 @@ var boxcars = require('boxcars'),

var filename = path.join(workingdir, 'node_modules', packageName, '/package.json');
path.exists(filename, function(exists){

@@ -18,4 +19,4 @@ if(exists){

if( ( /^\.\.\//.test(up) && up.match(/\.\.\//g).length > process.cwd().match(/\//g).length ) ){
logging.error('Infinite tree-walk detected.');
if( path.join(process.cwd(), workingdir) == '/'){
logging.error('Failed to find package "%s"', packageName);
callback(new Error('Failed to find package "'+packageName+'"'));

@@ -22,0 +23,0 @@ return;

2

lib/modules.js

@@ -65,3 +65,3 @@ var functools = require('functools'),

logging.debug('Loading module "'+filename+'"');
logging.trace('Loading module "'+filename+'"');

@@ -68,0 +68,0 @@ readFile(filename, function(error, bf){

var path = require('path'),
assert = require('assert'),
fs = require('fs'),
compose = require('functools').compose,

@@ -39,11 +41,11 @@ logging = require('./logging'),

function loadDependencies(params, callback){
var pkg = params.pkg, options = params.options;
function content(pkg, options, callback){
logging.debug('Loading dependencies of %s', pkg.name);
logging.debug('Loading the package "%s"', pkg.manifest.name);
dependencies(pkg, options, function(error, deps){
if(error){
logging.error('An unexpected error occurred during collecting dependencies of the package "'+pkg.name+'".');
logging.error('An unexpected error occurred during collecting dependencies of the package "%s".', pkg.name);
logging.error(error);

@@ -54,42 +56,89 @@ callback(error);

logging.debug(''+deps.length+' dependencies has been loaded for the package "'+pkg.name+'"');
logging.debug('%d dependencies has been loaded for the package "%s"', deps.length, pkg.name);
pkg.dependencies = deps;
modules(pkg, options, function(error, modules){
callback(undefined, params);
});
}
if(error){
logging.error('An unexpected error occurred during collecting modules of the package "'+pkg.name+'".');
logging.error(error);
callback(error);
return;
}
function loadModules(params, callback){
var pkg = params.pkg, options = params.options;
logging.debug('Collected '+modules.length+' modules for the package "'+pkg.name+'"');
modules(pkg, options, function(error, modules){
pkg.modules = modules;
if(error){
logging.error('An unexpected error occurred during collecting modules of the package "%s".', pkg.name);
logging.error(error);
callback(error);
return;
}
var i = modules.length, m, mainModulePath;
logging.debug('Collected %d modules for the package "%s"', modules.length, pkg.name);
while(i-->0){
m = modules[i];
pkg.modulesDict[m.path] = m;
}
pkg.modules = modules;
if(pkg.manifest.main){
mainModulePath = path.join(pkg.wd, pkg.manifest.main + ( /\.js$/.test(pkg.manifest.main) ? '' : '.js' ));
pkg.main = pkg.modulesDict[mainModulePath];
var i = modules.length, m;
pkg.mainModuleId = pkg.main.name;
}
while(i-->0){
m = modules[i];
pkg.modulesDict[m.path] = m;
}
logging.info('%s loaded.', pkg.name);
callback(undefined, params);
});
}
callback(error, pkg);
});
function setMainModule(params, callback){
var pkg = params.pkg, options = params.options, errormsg;
if( ! pkg.manifest.main ){
callback(undefined, pkg, options);
}
logging.debug('Setting main module of the package "%s" as %s', pkg.name, pkg.manifest.main);
var absolutePath = path.join(pkg.wd, pkg.manifest.main );
fs.stat(absolutePath, function(error, stat){
var isDirectory = stat && stat.isDirectory(),
hasJSExt = /\.js$/.test(pkg.manifest.main),
resolvedPath = isDirectory ? path.join( absolutePath, 'index.js') : hasJSExt ? absolutePath : absolutePath + '.js';
pkg.main = pkg.modulesDict[resolvedPath];
if( pkg.main ){
pkg.mainModuleId = pkg.main.name;
callback(undefined, params);
} else {
errormsg = 'Failed to find main module of "' + pkg.name + '". Resolved Path: "' + resolvedPath + '" Manifest Definition: "' + pkg.manifest.main + '"';
logging.fatal(errormsg);
callback(new Error(errormsg));
}
});
}
function content(pkg, options, callback){
logging.debug('Loading the package "%s"', pkg.manifest.name);
compose.async(loadDependencies, loadModules, setMainModule)({ 'pkg': pkg, 'options': options }, function(error){
if(error){
callback(error);
return;
}
logging.info('%s loaded.', pkg.name);
callback(undefined, pkg);
});
}
function main(options, buildOptions, callback){

@@ -96,0 +145,0 @@

{
"name":"one",
"version":"1.7.1",
"version":"1.7.2",
"description":"Transform NodeJS packages into single stand-alone script files.",

@@ -8,3 +8,3 @@ "author":"Azer Koculu <azer@kodfabrik.com>",

"directories":{ "lib": "./lib" },
"main":"./lib/one.js",
"main":"./lib",
"bin":{

@@ -11,0 +11,0 @@ "onejs":"./bin/onejs"

@@ -17,2 +17,4 @@ OneJS is a command-line utility for converting CommonJS packages to single, stand-alone JavaScript

* MultiplayerChess.com ([Source Code](https://github.com/azer/multiplayerchess.com/tree/master/frontend) - [Output](http://multiplayerchess.com/mpc.js) )
* [ExpressJS built by OneJS](https://gist.github.com/2415048)
* [OneJS built by OneJS](https://gist.github.com/2998719)

@@ -120,3 +122,3 @@ # Install

OneJS doesn't provide an embed, encapsulated console object by default. Pass `--sandbox-console` if needed, output is available by `projectName.stdout()` and `project.stderr()`.
OneJS provides an embed, encapsulated console object (disabled by default). Pass `--sandbox-console` if needed, output is available by `projectName.stdout()` and `project.stderr()`.

@@ -123,0 +125,0 @@ ```bash

@@ -441,5 +441,24 @@ var exampleProject = (function(global, undefined){

});
exampleProject.pkg(3, function(parents){
return {
'id':7,
'name':'vegetables',
'main':undefined,
'mainModuleId':'lib/index',
'modules':[],
'parents':parents
};
});
exampleProject.module(7, function(/* parent */){
return {
'id': 'lib/index',
'pkg': arguments[0],
'wrapper': function(module, exports, global, Buffer, console, process, require, undefined){
module.exports = ['tomato', 'potato'];
}
};
});
exampleProject.pkg(1, function(parents){
return {
'id':7,
'id':8,
'name':'assert',

@@ -452,3 +471,3 @@ 'main':undefined,

});
exampleProject.module(7, function(/* parent */){
exampleProject.module(8, function(/* parent */){
return {

@@ -455,0 +474,0 @@ 'id': 'assert',

@@ -421,5 +421,24 @@ var exampleProject = (function(global, undefined){

});
exampleProject.pkg(3, function(parents){
return {
'id':7,
'name':'vegetables',
'main':undefined,
'mainModuleId':'lib/index',
'modules':[],
'parents':parents
};
});
exampleProject.module(7, function(/* parent */){
return {
'id': 'lib/index',
'pkg': arguments[0],
'wrapper': function(module, exports, global, Buffer,process, require, undefined){
module.exports = ['tomato', 'potato'];
}
};
});
exampleProject.pkg(1, function(parents){
return {
'id':7,
'id':8,
'name':'assert',

@@ -432,3 +451,3 @@ 'main':undefined,

});
exampleProject.module(7, function(/* parent */){
exampleProject.module(8, function(/* parent */){
return {

@@ -435,0 +454,0 @@ 'id': 'assert',

@@ -406,5 +406,24 @@ var exampleProject = (function(global, undefined){

});
exampleProject.pkg(2, function(parents){
return {
'id':6,
'name':'vegetables',
'main':undefined,
'mainModuleId':'lib/index',
'modules':[],
'parents':parents
};
});
exampleProject.module(6, function(/* parent */){
return {
'id': 'lib/index',
'pkg': arguments[0],
'wrapper': function(module, exports, global, Buffer,process, require, undefined){
module.exports = ['tomato', 'potato'];
}
};
});
exampleProject.pkg(1, function(parents){
return {
'id':6,
'id':7,
'name':'assert',

@@ -417,3 +436,3 @@ 'main':undefined,

});
exampleProject.module(6, function(/* parent */){
exampleProject.module(7, function(/* parent */){
return {

@@ -420,0 +439,0 @@ 'id': 'assert',

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