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

convoy

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

convoy - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

bin/convoy

7

CHANGELOG.md

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

# v0.3.1
* Add convoy binary - mostly for testing purposes.
* Now ignores requires for built-in node modules.
* Add exception to ignore some requires for jquery so that it will work as
expected. This is a temporary solution; it would be better to get that
package author to change his code.
# v0.3.0

@@ -2,0 +9,0 @@

2

lib/asset_packager.js

@@ -224,3 +224,3 @@ /**

}
return RESOLVE.sync(moduleId, UTILS.merge({

@@ -227,0 +227,0 @@ extensions: Object.keys(this.compilers),

@@ -97,3 +97,3 @@ /**

var len = getSize(asset);
res.setHeader('Content-Length', len);
if (asset.bodyType) res.setHeader('Content-Length', len);

@@ -100,0 +100,0 @@ prepareEtag(connect, asset, function(err) {

@@ -255,3 +255,3 @@ /**

* Builds a single asset. The callback will be invoked with an asset object.
* The asset contains either a `body` property or a `bodyStream` that can
* The asset contains either a `body` property or a `bodyPath` that can
* be used to return the asset contents.

@@ -258,0 +258,0 @@ *

@@ -9,102 +9,108 @@ // Borrowed from resolve package

var core = exports.core = [
'assert', 'buffer_ieee754', 'buffer', 'child_process', 'cluster', 'console',
'constants', 'crypto', '_debugger', 'dgram', 'dns', 'events', 'freelist',
'fs', 'http', 'https', '_linklist', 'module', 'net', 'os', 'path',
'punycode', 'querystring', 'readline', 'repl', 'stream', 'string_decoder',
'sys', 'timers', 'tls', 'tty', 'url', 'util', 'vm', 'zlib'
].reduce(function (acc, x) { acc[x] = true; return acc }, {});
'assert', 'buffer_ieee754', 'buffer', 'child_process', 'cluster', 'console',
'constants', 'crypto', '_debugger', 'dgram', 'dns', 'events', 'freelist',
'fs', 'http', 'https', '_linklist', 'module', 'net', 'os', 'path',
'punycode', 'querystring', 'readline', 'repl', 'stream', 'string_decoder',
'sys', 'timers', 'tls', 'tty', 'url', 'util', 'vm', 'zlib'
].reduce(function (acc, x) { acc[x] = true; return acc; }, {});
exports.isCore = function (x) { return core[x] };
exports.isCore = function (x) { return core[x]; };
exports.sync = function (x, opts) {
if (core[x]) return x;
if (!opts) opts = {};
var isFile = opts.isFile || function (file) {
return path.existsSync(file) && fs.statSync(file).isFile()
};
var readFileSync = opts.readFileSync || fs.readFileSync;
var mainKey = opts.mainKey;
var extensions = opts.extensions || [ '.js' ];
var y = opts.basedir
|| path.dirname(require.cache[__filename].parent.filename)
;
var isFile, readFileSync, mainKey, extensions, y, m, n;
opts.paths = opts.paths || [];
if (x.match(/^(?:\.\.?\/|\/|([A-Za-z]:)?\\)/)) {
var m = loadAsFileSync(path.resolve(y, x))
|| loadAsDirectorySync(path.resolve(y, x));
if (m) return m;
function loadAsFileSync (x) {
if (isFile(x)) {
return x;
}
var n = loadNodeModulesSync(x, y);
if (n) return n;
throw new Error("Cannot find module '" + x + "'");
function loadAsFileSync (x) {
if (isFile(x)) {
return x;
for (var i = 0; i < extensions.length; i++) {
var file = x + extensions[i];
if (isFile(file)) {
return file;
}
}
}
function loadAsDirectorySync (x) {
var pkgfile = path.join(x, '/package.json'), body, pkg, pkgMain, m;
if (isFile(pkgfile)) {
body = readFileSync(pkgfile, 'utf8');
try {
pkg = JSON.parse(body);
if (opts.packageFilter) {
pkg = opts.packageFilter(pkg);
}
for (var i = 0; i < extensions.length; i++) {
var file = x + extensions[i];
if (isFile(file)) {
return file;
}
pkgMain = (pkg.convoy && pkg.convoy[mainKey]) || pkg[mainKey];
if (pkgMain) {
m = loadAsFileSync(path.resolve(x, pkgMain));
if (m) return m;
}
}
catch (err) {}
}
function loadAsDirectorySync (x) {
var pkgfile = path.join(x, '/package.json');
if (isFile(pkgfile)) {
var body = readFileSync(pkgfile, 'utf8');
try {
var pkg = JSON.parse(body);
if (opts.packageFilter) {
pkg = opts.packageFilter(pkg);
}
if (pkg[mainKey]) {
var m = loadAsFileSync(path.resolve(x, pkg[mainKey]));
if (m) return m;
}
}
catch (err) {}
}
return loadAsFileSync(path.join( x, '/index'));
return loadAsFileSync(path.join( x, '/index'));
}
function loadNodeModulesSync (x, start) {
var dirs = nodeModulesPathsSync(start);
for (var i = 0; i < dirs.length; i++) {
var dir = dirs[i];
var m = loadAsFileSync(path.join( dir, '/', x));
if (m) return m;
var n = loadAsDirectorySync(path.join( dir, '/', x ));
if (n) return n;
}
}
function nodeModulesPathsSync (start) {
var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/;
var parts = start.split(splitRe);
function loadNodeModulesSync (x, start) {
var dirs = nodeModulesPathsSync(start);
for (var i = 0; i < dirs.length; i++) {
var dir = dirs[i];
var m = loadAsFileSync(path.join( dir, '/', x));
if (m) return m;
var n = loadAsDirectorySync(path.join( dir, '/', x ));
if (n) return n;
}
var dirs = [];
for (var i = parts.length - 1; i >= 0; i--) {
if (parts[i] === 'node_modules') continue;
var dir = path.join(
path.join.apply(path, parts.slice(0, i + 1)),
'node_modules'
);
if (!parts[0].match(/([A-Za-z]:)/)) {
dir = '/' + dir;
}
dirs.push(dir);
}
function nodeModulesPathsSync (start) {
var splitRe = process.platform === 'win32' ? /[\/\\]/ : /\/+/;
var parts = start.split(splitRe);
var dirs = [];
for (var i = parts.length - 1; i >= 0; i--) {
if (parts[i] === 'node_modules') continue;
var dir = path.join(
path.join.apply(path, parts.slice(0, i + 1)),
'node_modules'
);
if (!parts[0].match(/([A-Za-z]:)/)) {
dir = '/' + dir;
}
dirs.push(dir);
}
return opts.paths.concat(dirs);
}
return opts.paths.concat(dirs);
}
if (core[x]) return x;
if (!opts) opts = {};
isFile = opts.isFile || function (file) {
return path.existsSync(file) && fs.statSync(file).isFile();
};
readFileSync = opts.readFileSync || fs.readFileSync;
mainKey = opts.mainKey;
extensions = opts.extensions || [ '.js' ];
y = opts.basedir ||
path.dirname(require.cache[__filename].parent.filename);
opts.paths = opts.paths || [];
if (x.match(/^(?:\.\.?\/|\/|([A-Za-z]:)?\\)/)) {
m = loadAsFileSync(path.resolve(y, x)) ||
loadAsDirectorySync(path.resolve(y, x));
if (m) return m;
}
n = loadNodeModulesSync(x, y);
if (n) return n;
throw new Error("Cannot find module '" + x + "'" +
(opts.errorContext ? ' ('+opts.errorContext+')' : ''));
};
{
"name": "convoy",
"version": "v0.3.0",
"version": "v0.3.1",
"author": "Charles Jolley <charles@sproutcore.com>",

@@ -25,3 +25,5 @@ "description": "Pluggable, package-aware asset pipeline for node",

"mime": "~1.2",
"coffee-script": "~1.3"
"coffee-script": "~1.3",
"connect": "~2.2",
"commander": "~0.5"
},

@@ -33,4 +35,3 @@

"dox": "latest",
"temp": "latest",
"connect": "latest"
"temp": "latest"
},

@@ -40,3 +41,7 @@

"test": "./node_modules/.bin/mocha --reporter list"
},
"bin": {
"convoy": "./bin/convoy"
}
}

@@ -9,2 +9,12 @@ /**

// modules found here are skipped as requirements. Mostly this includes the
// builtin modules for node as well as some specific exceptions for jquery
var EXCEPTIONS = {
'__node': ['util', 'events', 'stream', 'buffer', 'crypto', 'tls', 'fs', 'path',
'net', 'dgram', 'dns', 'http', 'url', 'querystring', 'https',
'readline', 'vm', 'child_process', 'asset', 'tty', 'zlib', 'os',
'cluster'],
'jquery': ['jsdom', 'xmlhttprequest', 'location', 'navigator']
};
function _extractRequiredModules(asset) {

@@ -27,3 +37,7 @@ var ast, results = [],

if (expr[0] === 'name' && expr[1] === 'require') {
results.push(args[0][1]);
var moduleId = args[0][1];
var exceptions = asset.pkg && EXCEPTIONS[asset.pkg.name];
var isException = (EXCEPTIONS.__node.indexOf(moduleId)>=0 ||
(exceptions && exceptions.indexOf(moduleId)>=0));
if (!isException) results.push(moduleId);
}

@@ -30,0 +44,0 @@ }

@@ -74,3 +74,8 @@ /**

} else if (asset.pkg && asset.pkg.main) {
var mainPath = context.resolve(asset.pkg.path, asset.pkg.main);
var mainPath;
try {
mainPath = context.resolve(asset.pkg.path, asset.pkg.main);
} catch (e) {
mainPath = null; // ignore main path if none
}
if (asset.path === mainPath) id = [id, PATH.basename(asset.pkg.path)];

@@ -77,0 +82,0 @@ }

- Select compiler/preprocessor for each source file based on config in local
package.
- Add middleware for connect
- Add plugins/type for HTML5 manifest
- Add watch support. cases to test:
- adding files to the copied area
- modified a deeply required file
- modify a package.json for affected package
- Figure out how to add assets from packages.
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