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

parcelify

Package Overview
Dependencies
Maintainers
4
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

parcelify - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

test/page7/main.css

25

lib/parcel.js

@@ -29,14 +29,25 @@ var inherits = require( 'inherits' );

Parcel.prototype.calcSortedDependencies = function() {
var visited = [];
var packagesWithDependencies = [];
function getEdgesForPackageDependencyGraph( thisPackage ) {
visited.push( thisPackage );
function getEdgesForPackageDependencyGraph( thisPackage, thisTreeLevel, packageTreeLevels ) {
if( _.isUndefined( thisTreeLevel ) ) thisTreeLevel = 0;
if( _.isUndefined( packageTreeLevels ) ) packageTreeLevels = {};
if( ! packageTreeLevels[ thisPackage.path ] ) packageTreeLevels[ thisPackage.path ] = thisTreeLevel;
return thisPackage.dependencies.reduce( function( memo, thisDependentPackage ) {
if( _.contains( visited, thisDependentPackage ) ) return memo; // avoid cycles
// these conditionals are to avoid cycles and infinite recursion.
// first, we only traverse each node once to avoid infinite recursion.
if( _.isUndefined( packageTreeLevels[ thisDependentPackage.path ] ) ) {
memo = memo.concat( getEdgesForPackageDependencyGraph( thisDependentPackage, thisTreeLevel + 1, packageTreeLevels ) );
}
var edges = memo.concat( [ [ thisPackage, thisDependentPackage ] ] );
edges = edges.concat( getEdgesForPackageDependencyGraph( thisDependentPackage ) );
// second, we keep track of the levels of the nodes in the dependency tree (where
// level 0 is the root node i.e. the parcel itself). nodes can only have dependencies
// on other nodes with a level equal to or greater than their own. done.
if( packageTreeLevels[ thisDependentPackage.path ] >= packageTreeLevels[ thisPackage.path ] ) {
memo = memo.concat( [ [ thisPackage, thisDependentPackage ] ] );
}
return edges;
return memo;
}, [] );

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

{
"name": "parcelify",
"version": "1.1.0",
"version": "1.1.1",
"description": "Create css bundles from npm packages using the browserify dependency graph.",

@@ -19,3 +19,3 @@ "main": "index.js",

"resolve": "~0.6.1",
"shasum": "~1.0.0",
"shasum": "~1.0.1",
"stream-combiner": "0.0.4",

@@ -22,0 +22,0 @@ "through2": "~0.6.3",

@@ -67,2 +67,3 @@ # Parcelify

```
--cssBundle, -o Path of the destination css bundle.

@@ -77,2 +78,3 @@

--loglevel -l Set the verbosity of npmlog, eg. "silent", "error", "warn", "info", "verbose"
```

@@ -79,0 +81,0 @@ ## Transforms

@@ -190,2 +190,34 @@ var test = require('tape');

} );
} );
// ordering
test( 'page7', function( t ) {
t.plan( 2 );
var mainPath = __dirname + '/page7/main.js';
var dstDir = path.resolve( tmpdir, 'parcelify-test-' + Math.random() );
var options = {
bundles : {
style : path.join( dstDir, 'bundle.css' )
}
};
mkdirp.sync( dstDir );
var b = browserify( mainPath );
var p = parcelify( b, options );
b.bundle();
p.on( 'done', function() {
t.deepEqual(
fs.readdirSync( dstDir ).sort(),
[ 'bundle.css' ]
);
t.deepEqual( fs.readFileSync( options.bundles.style, 'utf8' ), 'p {\n\tcolor: red;\n}p.header {\n\tcolor: blue;\n}p.footer {\n\tcolor: green;\n}div.beep {\n\tcolor : green;\n}' );
} );
} );
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