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

parcelify

Package Overview
Dependencies
Maintainers
3
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 0.6.6 to 0.6.7

test/page6/main.js

6

lib/asset.js

@@ -17,5 +17,5 @@ var fs = require( 'fs' );

Asset.prototype.addTransform = function( transform, addAtBeginning ) {
if( addAtBeginning ) this.transforms.unshift( transform );
else this.transforms.push( transform );
Asset.prototype.addTransform = function( transform, transformOptions ) {
var t = transformOptions ? function( file ) { return transform( file, transformOptions ); } : transform;
this.transforms.push( t );
};

@@ -22,0 +22,0 @@

@@ -58,4 +58,6 @@ var path = require('path');

Package.prototype.getAssets = function() {
return _.reduce( this.assetsByType, function( memo, assetsOfThisType ) {
Package.prototype.getAssets = function( types ) {
return _.reduce( this.assetsByType, function( memo, assetsOfThisType, thisAssetType ) {
if( types && ! _.contains( types, thisAssetType ) ) return memo;
return memo.concat( assetsOfThisType );

@@ -65,2 +67,19 @@ }, [] );

Package.prototype.addTransform = function( transform, transformOptions, toAssetTypes ) {
var t = transformOptions ? function( file ) { return transform( file, transformOptions ); } : transform;
toAssetTypes = toAssetTypes || Object.keys( this.assetsByType );
if( ! _.isArray( toAssetTypes ) ) toAssetTypes = [ toAssetTypes ];
// add transform to existing assets
this.getAssets( toAssetTypes ).forEach( function( thisAsset ) {
thisAsset.addTransform( t );
} );
// and also add it to the package itself so it is added to assets created from this point forward
_.each( _.pick( this.assetTransformsByType, toAssetTypes ), function( transformsForThisAssetType ) {
transformsForThisAssetType.push( t );
} );
};
Package.prototype.writeAssetsToDisk = function( assetTypesToWriteToDisk, outputDirectoryPath, callback ) {

@@ -67,0 +86,0 @@ var _this = this;

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

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

@@ -144,1 +144,35 @@ var test = require('tape');

} );
// test a parcel with no package.json
test( 'page6', function( t ) {
t.plan( 2 );
var mainPath = __dirname + '/page6/main.js';
var dstDir = path.resolve( tmpdir, 'parcelify-test-' + Math.random() );
var options = {
bundles : {
script : path.join( dstDir, 'bundle.js' ),
style : path.join( dstDir, 'bundle.css' )
}
};
mkdirp.sync( dstDir );
p = parcelify( mainPath, options );
p.on( 'packageCreated', function( thePackage ) {
thePackage.addTransform( require( 'sass-css-stream' ) );
} );
p.on( 'done', function() {
t.deepEqual(
fs.readdirSync( dstDir ).sort(),
[ 'bundle.css', 'bundle.js' ]
);
t.deepEqual( fs.readFileSync( options.bundles.style, 'utf8' ), 'div.beep div.boop {\n color: 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