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.4.4 to 1.5.0

example-project/node_modules/exclude/lib/index.js

1

example-project/package.json

@@ -6,2 +6,3 @@ {

"dependencies":{
"exclude":"*",
"dependency":"*",

@@ -8,0 +9,0 @@ "sibling":"*",

2

lib/dependencies.js

@@ -40,3 +40,3 @@ var path = require('path'),

declaredDepList = Object.keys(declaredDepObj).filter(function(name){
return BLACK_LIST.indexOf(name) == -1;
return BLACK_LIST.indexOf(name) == -1 && ( !options.exclude || options.exclude.indexOf(name) == -1 );
});

@@ -43,0 +43,0 @@ }

var path = require('path'),
logging = require('./logging'),
fs = require('fs'),

@@ -12,3 +12,3 @@ idGenerator = require('./templating').idGenerator,

function construct(wd, manifest, parentPkg, options){
!options && ( options = {} );

@@ -39,6 +39,6 @@

manifest(manifestPath, function(error, manifest){
if(error){
callback(error);
return;
return;
}

@@ -58,3 +58,3 @@

manifestSource;
readFile(path, function(error, bf){

@@ -71,3 +71,3 @@

if(!error){
manifestSource = bf.toString();
manifestSource = bf.toString();
try {

@@ -114,3 +114,3 @@ manifest = JSON.parse(manifestSource);

}
logging.debug('Collected '+modules.length+' modules for the package "'+pkg.name+'"');

@@ -137,3 +137,3 @@

callback(error, pkg);
callback(error, pkg);
});

@@ -140,0 +140,0 @@

@@ -27,8 +27,11 @@ var readFile = require('fs').readFile,

});
map.async(renderPackage, pkgs, function(error, renderedPkgs){
if(error) return callback(error);
if(error) {
callback(error);
return;
}
options.renderedPkgs = renderedPkgs;
logging.info('All packages has been built successfully.');

@@ -44,3 +47,6 @@

templating.render({ 'template':'path.js' }, function(error, path){
if(error) return callback(error);
if(error) {
callback(error);
return;
}

@@ -56,5 +62,5 @@ var env, key;

var view = {
var view = {
'debug': options.debug,
'version':'1.3.5',
'version':'1.3.5',
'versions': '{}',

@@ -67,4 +73,4 @@ 'env': options.debug ? JSON.stringify(env, null, 4) : undefined

return templating.render({ 'template':'library.js', 'view':{ node:true, include_process:!options.noprocess }, 'partials':{ 'path':path, 'process':processEmu } }, callback);
});
return templating.render({ 'template':'library.js', 'view':{ node:true, include_process:!options.noprocess }, 'partials':{ 'path':path, 'process':processEmu } }, callback);
});
});

@@ -88,5 +94,5 @@

var view = {
var view = {
'treeName':options.treeName,
'parentId':!options.pkg.parent && 'undefined' || options.pkg.parent.id,
'parentId':!options.pkg.parent && 'undefined' || options.pkg.parent.id,
'id':options.pkg.id,

@@ -105,7 +111,11 @@ 'main': options.pkg.main && options.pkg.main.id,

'module':el
}
};
});
map.async(renderModule, modules, function(error, renderedModules){
if(error) return callback(error);
if(error) {
callback(error);
return;
}
templating.render({ 'template':'package.js', 'view':view, 'partials':{ 'modules':renderedModules.join('\n\n') } }, callback);

@@ -119,13 +129,31 @@ });

if(error){
return callback(error);
callback(error);
return;
}
templating.render({
'template':'wrapper.js',
'view':{ 'name':options.treeName, 'debug':options.debug },
'partials':{
var view = {
'name': options.treeName,
'debug': options.debug,
};
options.tie && ( view.ties = (function(){
var ties = {}, key;
var i = options.tie.length;
while( i -- ){
ties[ options.tie[i].pkg ] = options.tie[i].obj;
}
return JSON.stringify(ties);
}()) );
templating.render({
'template':'wrapper.js',
'view':view,
'partials':{
'node':'',
'library':librarySC,
'packages':options.renderedPkgs.join('\n\n\n\n')
}
}, callback);
'library':librarySC,
'packages':options.renderedPkgs.join('\n\n\n\n')
}
}, callback);
});

@@ -132,0 +160,0 @@ }

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

@@ -5,0 +5,0 @@ "author":"Azer Koculu <azer@kodfabrik.com>",

@@ -17,3 +17,2 @@ 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) )
* [boxcars](https://github.com/azer/boxcars)

@@ -37,3 +36,3 @@ # Install

The output OneJS generates can be used by NodeJS, too. It's the easiest way of making sure if the output works or not.
The output OneJS generates can be used by NodeJS, too. It's the easiest way of making sure if the output works or not.

@@ -73,2 +72,49 @@ ```

## Debug Mode
Pass `--debug` parameter disabling cache and passing ENV variables to the built file. If we assume that we have a module that depends on ENV;
```javascript
if( process.env.VERBOSE ){
console.log( "fabula de narratur" );
}
```
Above module becomes available to access ENV on debug-mode;
```bash
$ VERBOSE=1 onejs build package.json --debug
```
## Requiring Global Variables
OneJS doesn't change the way we access global variables. However, we may want to use require statements to access global variables (such as document, jQuery etc..) for purposes like dependency injection or documentation. Following example demonstrates the usage of `--tie` option that lets us require global variables;
```javascript
var $ = require('jquery'),
dom = require('dom'),
pi = require('pi');
$(dom).ready(function(){
console.log( pi == Math.PI ); // true
});
```
```bash
$ onejs build package.json --tie pi=Math.PI,jquery=jQuery,dom=document
```
## Excluding Specific Dependencies
There are some cases we prefer to not have some dependency packages in the build. The `--exclude` option leads OneJS ignore the specified packages;
```bash
$ onejs build package.json --exclude underscore,request
```
If the case is to remove a duplication from the build, it would be a good idea to combine `--tie` and `--exclude` together;
```bash
$ onejs build package.json --exclude underscore --tie underscore=window._
```
# Troubleshooting

@@ -78,2 +124,2 @@

* Enabling verbose mode might be helpful: `onejs build package.json --verbose`
* See the content of `projectName.map` object if it contains the missing dependency
* See the content of `projectName.map` object if it contains the missing dependency

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

lib = (function(exports){

@@ -2,0 +3,0 @@

@@ -7,5 +7,10 @@ var {{ name }} = (function(global, undefined){

lib = undefined,
nativeRequire = typeof require != 'undefined' && require,
locals;
ties, locals;
{{#ties}}
ties = {{{ ties }}};
{{/ties}}
{{>library}}

@@ -27,3 +32,2 @@

return pkg;

@@ -59,2 +63,4 @@ }

module = findModule(callingModule, uri);
} else if ( ties && ties.hasOwnProperty( uri ) ) {
return ties[ uri ];
} else {

@@ -61,0 +67,0 @@ pkg = findPkg(callingModule.pkg, uri);

@@ -192,2 +192,7 @@ var assert = require('assert'),

function test_tie(mod, callback){
assert.equal(mod.require('pi'), Math.PI);
callback();
}
module.exports = {

@@ -208,3 +213,4 @@ 'init': init,

'test_main': test_main,
'test_parent': test_parent
'test_parent': test_parent,
'test_tie': test_tie
};

@@ -29,3 +29,3 @@ var one = require('../lib/one'),

function test_build(callback){
one.build({ 'manifestPath':'example-project/package.json' }, function(error, sourceCode){
one.build({ 'manifestPath':'example-project/package.json', 'tie':[{ 'pkg':'pi', 'obj':Math.PI }], 'exclude':['exclude'] }, function(error, sourceCode){
if(error) {

@@ -98,3 +98,3 @@ callback(error);

one.dependencies(pkg, { id:templating.idGenerator() }, function(error, deps){
if(error){
if(error){
callback(error);

@@ -131,3 +131,3 @@ return;

function test_loadPkg(callback){
one.packages.loadFromManifestPath('example-project/package.json', undefined, { id:templating.idGenerator(), 'azer':1 }, function(error, pkg){
one.packages.loadFromManifestPath('example-project/package.json', undefined, { id:templating.idGenerator(), 'exclude':['exclude'] }, function(error, pkg){
if(error) return callback(error);

@@ -315,2 +315,2 @@

'test_verifyListContent':test_verifyListContent
}
};

@@ -7,3 +7,3 @@ var exampleProject = (function(global, undefined){

nativeRequire = typeof require != 'undefined' && require,
locals;
ties, locals;
lib = (function(exports){

@@ -14,7 +14,5 @@

// Minimized fork of NodeJS' path module, based on its an early version.
exports.join = function () {
return exports.normalize(Array.prototype.join.call(arguments, "/"));
};
exports.normalizeArray = function (parts, keepBlanks) {

@@ -24,9 +22,6 @@ var directories = [], prev;

var directory = parts[i];
// if it's blank, but it's not the first thing, and not the last thing, skip it.
if (directory === "" && i !== 0 && i !== l && !keepBlanks) continue;
// if it's a dot, and there was some previous dir already, then skip it.
if (directory === "." && prev !== undefined) continue;
if (

@@ -50,13 +45,8 @@ directory === ".."

};
exports.normalize = function (path, keepBlanks) {
return exports.normalizeArray(path.split("/"), keepBlanks).join("/");
};
exports.dirname = function (path) {
return path && path.substr(0, path.lastIndexOf("/")) || ".";
};
return exports;

@@ -134,3 +124,3 @@ })({});

"HUSHLOGIN": "FALSE",
"WINDOWID": "33554438",
"WINDOWID": "39845894",
"npm_config_init_author_email": "",

@@ -222,7 +212,7 @@ "npm_config_long": "false",

"npm_package_main": "./lib/one.js",
"PS3": "&gt; ",
"PS3": "> ",
"DIR_chat": "/home/azer/dev/zen/zendesk_chat",
"npm_config_rebuild_bundle": "true",
"npm_config_outfd": "1",
"npm_package_version": "1.4.3",
"npm_package_version": "1.5.0",
"DIR_bin": "/home/azer/.local/bin",

@@ -245,3 +235,3 @@ "DIR_opt": "/home/azer/.opt",

"npm_config_loglevel": "warn",
"npm_config_ca": "'-----BEGIN CERTIFICATE-----\\\\nMIIChzCCAfACCQDauvz/KHp8ejANBgkqhkiG9w0BAQUFADCBhzELMAkGA1UEBhMC\\\\nVVMxCzAJBgNVBAgTAkNBMRAwDgYDVQQHEwdPYWtsYW5kMQwwCgYDVQQKEwNucG0x\\\\nIjAgBgNVBAsTGW5wbSBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxDjAMBgNVBAMTBW5w\\\\nbUNBMRcwFQYJKoZIhvcNAQkBFghpQGl6cy5tZTAeFw0xMTA5MDUwMTQ3MTdaFw0y\\\\nMTA5MDIwMTQ3MTdaMIGHMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExEDAOBgNV\\\\nBAcTB09ha2xhbmQxDDAKBgNVBAoTA25wbTEiMCAGA1UECxMZbnBtIENlcnRpZmlj\\\\nYXRlIEF1dGhvcml0eTEOMAwGA1UEAxMFbnBtQ0ExFzAVBgkqhkiG9w0BCQEWCGlA\\\\naXpzLm1lMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDLI4tIqPpRW+ACw9GE\\\\nOgBlJZwK5f8nnKCLK629Pv5yJpQKs3DENExAyOgDcyaF0HD0zk8zTp+ZsLaNdKOz\\\\nGn2U181KGprGKAXP6DU6ByOJ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b3DQEBBQUAA4GBAC4ySDbC\\nl7W1WpLmtLGEQ/yuMLUf6Jy/vr+CRp4h+UzL+IQpCv8FfxsYE7dhf/bmWTEupBkv\\nyNL18lipt2jSvR3v6oAHAReotvdjqhxddpe5Holns6EQd1/xEZ7sB1YhQKJtvUrl\\nZNufy1Jf1r0ldEGeA+0ISck7s+xSh9rQD2Op\\n-----END CERTIFICATE-----'",
"npm_config_tar": "tar",

@@ -336,3 +326,2 @@ "npm_config_group": "100",

} while(!pkg && parent);
return pkg;

@@ -362,2 +351,4 @@ }

module = findModule(callingModule, uri);
} else if ( ties && ties.hasOwnProperty( uri ) ) {
return ties[ uri ];
} else {

@@ -454,8 +445,5 @@ pkg = findPkg(callingModule.pkg, uri);

exports.b = true;
}
};
});
exampleProject.module(1, function(onejsModParent){

@@ -467,8 +455,5 @@ return {

console.log('this module will be working for only web browsers');
}
};
});
exampleProject.module(1, function(onejsModParent){

@@ -480,3 +465,2 @@ return {

console.log('Elle creuse encore, cette vieville amie au regard fatigué.');
module.exports = {

@@ -490,12 +474,28 @@ 'a':true,

}
}
};
});
exampleProject.pkg(1, function(parent){
return {
'id':2,
'name':'exclude',
'main':undefined,
'mainModuleId':'index',
'dependencies':[],
'modules':[],
'parent':parent
};
});
exampleProject.module(2, function(onejsModParent){
return {
'id':'index',
'pkg':onejsModParent,
'wrapper':function(module, exports, global, Buffer, process, require, undefined){
exports.exclude = true;
}
};
});
exampleProject.pkg(1, function(parent){
return {
'id':3,
'name':'dependency',

@@ -509,3 +509,3 @@ 'main':undefined,

});
exampleProject.module(2, function(onejsModParent){
exampleProject.module(3, function(onejsModParent){
return {

@@ -516,8 +516,6 @@ 'id':'g',

exports.g = true;
}
};
});
exampleProject.module(2, function(onejsModParent){
exampleProject.module(3, function(onejsModParent){
return {

@@ -530,12 +528,8 @@ 'id':'f',

exports.f = true;
}
};
});
exampleProject.pkg(2, function(parent){
exampleProject.pkg(3, function(parent){
return {
'id':3,
'id':4,
'name':'subdependency',

@@ -549,3 +543,3 @@ 'main':undefined,

});
exampleProject.module(3, function(onejsModParent){
exampleProject.module(4, function(onejsModParent){
return {

@@ -557,12 +551,8 @@ 'id':'i',

exports.i = true;
}
};
});
exampleProject.pkg(1, function(parent){
return {
'id':4,
'id':5,
'name':'sibling',

@@ -576,3 +566,3 @@ 'main':undefined,

});
exampleProject.module(4, function(onejsModParent){
exampleProject.module(5, function(onejsModParent){
return {

@@ -586,9 +576,6 @@ 'id':'n',

exports.s = require('./s/t');
}
};
});
exampleProject.module(4, function(onejsModParent){
exampleProject.module(5, function(onejsModParent){
return {

@@ -600,8 +587,6 @@ 'id':'p/index',

exports.index = true;
}
};
});
exampleProject.module(4, function(onejsModParent){
exampleProject.module(5, function(onejsModParent){
return {

@@ -613,8 +598,6 @@ 'id':'p/r',

exports.r = true;
}
};
});
exampleProject.module(4, function(onejsModParent){
exampleProject.module(5, function(onejsModParent){
return {

@@ -625,12 +608,8 @@ 'id':'s/t',

exports.t = true;
}
};
});
exampleProject.pkg(1, function(parent){
return {
'id':5,
'id':6,
'name':'assert',

@@ -644,3 +623,3 @@ 'main':undefined,

});
exampleProject.module(5, function(onejsModParent){
exampleProject.module(6, function(onejsModParent){
return {

@@ -651,3 +630,2 @@ 'id':'assert',

exports.assert = true;
}

@@ -654,0 +632,0 @@ };

@@ -7,3 +7,4 @@ var exampleProject = (function(global, undefined){

nativeRequire = typeof require != 'undefined' && require,
locals;
ties, locals;
ties = {"pi":3.141592653589793};
lib = (function(exports){

@@ -14,7 +15,5 @@

// Minimized fork of NodeJS' path module, based on its an early version.
exports.join = function () {
return exports.normalize(Array.prototype.join.call(arguments, "/"));
};
exports.normalizeArray = function (parts, keepBlanks) {

@@ -24,9 +23,6 @@ var directories = [], prev;

var directory = parts[i];
// if it's blank, but it's not the first thing, and not the last thing, skip it.
if (directory === "" && i !== 0 && i !== l && !keepBlanks) continue;
// if it's a dot, and there was some previous dir already, then skip it.
if (directory === "." && prev !== undefined) continue;
if (

@@ -50,13 +46,8 @@ directory === ".."

};
exports.normalize = function (path, keepBlanks) {
return exports.normalizeArray(path.split("/"), keepBlanks).join("/");
};
exports.dirname = function (path) {
return path && path.substr(0, path.lastIndexOf("/")) || ".";
};
return exports;

@@ -151,3 +142,2 @@ })({});

} while(!pkg && parent);
return pkg;

@@ -177,2 +167,4 @@ }

module = findModule(callingModule, uri);
} else if ( ties && ties.hasOwnProperty( uri ) ) {
return ties[ uri ];
} else {

@@ -272,8 +264,5 @@ pkg = findPkg(callingModule.pkg, uri);

exports.b = true;
}
};
});
exampleProject.module(1, function(onejsModParent){

@@ -285,8 +274,5 @@ return {

console.log('this module will be working for only web browsers');
}
};
});
exampleProject.module(1, function(onejsModParent){

@@ -298,3 +284,2 @@ return {

console.log('Elle creuse encore, cette vieville amie au regard fatigué.');
module.exports = {

@@ -308,9 +293,5 @@ 'a':true,

}
}
};
});
exampleProject.pkg(1, function(parent){

@@ -333,7 +314,5 @@ return {

exports.g = true;
}
};
});
exampleProject.module(2, function(onejsModParent){

@@ -347,9 +326,5 @@ return {

exports.f = true;
}
};
});
exampleProject.pkg(2, function(parent){

@@ -373,9 +348,5 @@ return {

exports.i = true;
}
};
});
exampleProject.pkg(1, function(parent){

@@ -401,8 +372,5 @@ return {

exports.s = require('./s/t');
}
};
});
exampleProject.module(4, function(onejsModParent){

@@ -415,7 +383,5 @@ return {

exports.index = true;
}
};
});
exampleProject.module(4, function(onejsModParent){

@@ -428,7 +394,5 @@ return {

exports.r = true;
}
};
});
exampleProject.module(4, function(onejsModParent){

@@ -440,9 +404,5 @@ return {

exports.t = true;
}
};
});
exampleProject.pkg(1, function(parent){

@@ -465,3 +425,2 @@ return {

exports.assert = true;
}

@@ -468,0 +427,0 @@ };

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