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

builder-amd-css

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

builder-amd-css - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

33

index.js

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

var mutex, requireCssFiles,
var mutex, queue, requireCssFiles,
fs = require( "fs" ),

@@ -8,3 +8,5 @@ glob = require( "glob" ),

queue = [];
requireCssFiles = {};
glob.sync( __dirname + "/bower_components/require-css/**", { nodir: true } ).forEach(function( filepath ) {

@@ -14,2 +16,23 @@ requireCssFiles[ filepath.replace( __dirname, "" ).replace( /^\//, "" ) ] = fs.readFileSync( filepath );

function enqueueBuildCss() {
queue.push( arguments );
if ( queue.length === 1 ) {
dequeueBuildCss();
}
}
function dequeueBuildCss() {
var callback;
var args = queue[ 0 ];
if ( args !== undefined ) {
callback = args[ 2 ];
args[ 2 ] = function() {
queue.shift();
callback.apply( {}, arguments );
dequeueBuildCss();
};
buildCss.apply( {}, args );
}
}
function buildCss( files, config, callback ) {

@@ -19,9 +42,9 @@ var localCallback, include;

if ( mutex ) {
throw new Error( "Concurrent calls not supported" );
return callback( new Error( "Concurrent calls not supported" ) );
}
if ( typeof config !== "object" ) {
throw new Error( "missing or invalid config (object expected)" );
return callback( new Error( "missing or invalid config (object expected)" ) );
}
if ( !Array.isArray( config.include ) ) {
throw new Error( "missing or invalid config.include (array expected)" );
return callback( new Error( "missing or invalid config.include (array expected)" ) );
}

@@ -96,3 +119,3 @@ mutex = true;

buildCss( clonedFiles, config, callback );
enqueueBuildCss( clonedFiles, config, callback );
};

3

package.json
{
"name": "builder-amd-css",
"version": "0.0.2",
"version": "0.0.3",
"main": "index.js",

@@ -32,2 +32,3 @@ "repository": {

"devDependencies": {
"async": "0.9.0",
"chai": "1.10.x",

@@ -34,0 +35,0 @@ "jshint": "2.6.x",

var files,
async = require( "async" ),
expect = require( "chai" ).expect,

@@ -90,1 +91,30 @@ fs = require( "fs" ),

});
describe( "Concurrent runs", function() {
var barCss, fooCss;
before(function( done ) {
async.parallel([
function( callback ) {
AmdCssBuilder( files, { include: [ "bar" ] }, callback );
},
function( callback ) {
AmdCssBuilder( files, { include: [ "foo" ] }, callback );
}
], function( error, result ) {
if ( error ) {
return done( error );
}
barCss = result[ 0 ][ 0 ];
fooCss = result[ 1 ][ 0 ];
done();
});
});
it( "must be enqueued", function() {
expect( barCss ).to.equal( ".bar {}\n" );
expect( fooCss ).to.equal( ".foo {}\n.bar {}\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