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

viralify

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

viralify - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

27

index.js

@@ -8,2 +8,12 @@ 'use strict';

function arraysEqual(a, b) {
if (!a && !b) return true;
if (!a || !b) return false;
if (a.length !== b.length) return false;
for (var i = 0; i < a.length; i++) {
if (a[i] !== b[i]) return false;
}
return true;
}
function addTransform(front, transform, packfile) {

@@ -14,2 +24,4 @@ var pack = require(packfile);

var before = [].concat(pack.browserify.transform);
transform.forEach(function (tx) {

@@ -25,9 +37,12 @@ // remove previously injected transform (i.e. may have been added at the end, but now needs to be in front)

return { file: packfile, pack: pack };
var changed = !arraysEqual(before, pack.browserify.transform);
return { file: packfile, pack: pack, changed: changed };
}
function packsWithTransforms(root, transform, front, relPaths) {
return relPaths
return relPaths
.map(function (x) { return path.resolve(root, x) })
.map(addTransform.bind(null, front, transform));
.map(addTransform.bind(null, front, transform))
.filter(function (p) { return p.changed });
}

@@ -41,2 +56,5 @@

* at and below the given `root`.
*
* If the transform(s) were contained in the `package.json` already, no changes are made and no writes performed.
* This means that all viralify runs succeeding the first one will be much faster.
*

@@ -66,2 +84,5 @@ * @name viralify

// none of the packages changed due to adding the transform, which means they already contained it at the same position
if (!packs.length) return cb();
var tasks = packs

@@ -68,0 +89,0 @@ .map(function (p) {

2

package.json
{
"name": "viralify",
"version": "0.3.0",
"version": "0.3.1",
"description": "Injects one or more browserify transforms into all dependencies of a package recursively.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -66,2 +66,4 @@ # viralify [![build status](https://secure.travis-ci.org/thlorenz/viralify.png)](http://travis-ci.org/thlorenz/viralify)

at and below the given <code>root</code>.</p>
<p>If the transform(s) were contained in the <code>package.json</code> already, no changes are made and no writes performed.
This means that all viralify runs succeeding the first one will be much faster than the first.</p>
</div>

@@ -124,3 +126,3 @@ <h5>Parameters:</h5>

<span>, </span>
<a href="https://github.com/thlorenz/viralify/blob/master/index.js#L35">lineno 35</a>
<a href="https://github.com/thlorenz/viralify/blob/master/index.js#L50">lineno 50</a>
</li>

@@ -127,0 +129,0 @@ </ul></dd>

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