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

loader-runner

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loader-runner - npm Package Compare versions

Comparing version 2.3.1 to 3.0.0

lib/LoaderLoadingError.js

19

lib/LoaderRunner.js

@@ -126,5 +126,5 @@ /*

if(result && typeof result === "object" && typeof result.then === "function") {
return result.catch(callback).then(function(r) {
return result.then(function(r) {
callback(null, r);
});
}, callback);
}

@@ -153,3 +153,3 @@ return callback(null, result);

else if(raw && typeof args[0] === "string")
args[0] = new Buffer(args[0], "utf-8"); // eslint-disable-line
args[0] = Buffer.from(args[0], "utf-8");
}

@@ -172,3 +172,6 @@

loadLoader(currentLoaderObject, function(err) {
if(err) return callback(err);
if(err) {
loaderContext.cacheable(false);
return callback(err);
}
var fn = currentLoaderObject.pitch;

@@ -184,3 +187,9 @@ currentLoaderObject.pitchExecuted = true;

var args = Array.prototype.slice.call(arguments, 1);
if(args.length > 0) {
// Determine whether to continue the pitching process based on
// argument values (as opposed to argument presence) in order
// to support synchronous and asynchronous usages.
var hasArg = args.some(function(value) {
return value !== undefined;
});
if(hasArg) {
loaderContext.loaderIndex--;

@@ -187,0 +196,0 @@ iterateNormalLoaders(options, loaderContext, args, callback);

@@ -0,38 +1,35 @@

var LoaderLoadingError = require("./LoaderLoadingError");
module.exports = function loadLoader(loader, callback) {
if(typeof System === "object" && typeof System.import === "function") {
System.import(loader.path).catch(callback).then(function(module) {
loader.normal = typeof module === "function" ? module : module.default;
loader.pitch = module.pitch;
loader.raw = module.raw;
if(typeof loader.normal !== "function" && typeof loader.pitch !== "function")
throw new Error("Module '" + loader.path + "' is not a loader (must have normal or pitch function)");
callback();
});
} else {
try {
var module = require(loader.path);
} catch(e) {
// it is possible for node to choke on a require if the FD descriptor
// limit has been reached. give it a chance to recover.
if(e instanceof Error && e.code === "EMFILE") {
var retry = loadLoader.bind(null, loader, callback);
if(typeof setImmediate === "function") {
// node >= 0.9.0
return setImmediate(retry);
} else {
// node < 0.9.0
return process.nextTick(retry);
}
try {
var module = require(loader.path);
} catch(e) {
// it is possible for node to choke on a require if the FD descriptor
// limit has been reached. give it a chance to recover.
if(e instanceof Error && e.code === "EMFILE") {
var retry = loadLoader.bind(null, loader, callback);
if(typeof setImmediate === "function") {
// node >= 0.9.0
return setImmediate(retry);
} else {
// node < 0.9.0
return process.nextTick(retry);
}
return callback(e);
}
if(typeof loader !== "function" && typeof loader !== "object")
throw new Error("Module '" + loader.path + "' is not a loader (export function or es6 module))");
loader.normal = typeof module === "function" ? module : module.default;
loader.pitch = module.pitch;
loader.raw = module.raw;
if(typeof loader.normal !== "function" && typeof loader.pitch !== "function")
throw new Error("Module '" + loader.path + "' is not a loader (must have normal or pitch function)");
callback();
return callback(e);
}
if(typeof module !== "function" && typeof module !== "object") {
return callback(new LoaderLoadingError(
"Module '" + loader.path + "' is not a loader (export function or es6 module)"
));
}
loader.normal = typeof module === "function" ? module : module.default;
loader.pitch = module.pitch;
loader.raw = module.raw;
if(typeof loader.normal !== "function" && typeof loader.pitch !== "function") {
return callback(new LoaderLoadingError(
"Module '" + loader.path + "' is not a loader (must have normal or pitch function)"
));
}
callback();
};
{
"name": "loader-runner",
"version": "2.3.1",
"version": "3.0.0",
"description": "Runs (webpack) loaders",
"main": "lib/LoaderRunner.js",
"scripts": {
"beautify-lint": "beautify-lint lib/**.js test/*.js",
"beautify": "beautify-rewrite lib/**.js test/*.js",
"lint": "eslint lib test",
"pretest": "npm run lint && npm run beautify-lint",
"pretest": "npm run lint",
"test": "mocha --reporter spec",
"precover": "npm run lint && npm run beautify-lint",
"precover": "npm run lint",
"cover": "istanbul cover node_modules/mocha/bin/_mocha",

@@ -31,3 +29,3 @@ "travis": "npm run cover -- --report lcovonly"

"engines": {
"node": ">=4.3.0 <5.0.0 || >=5.10"
"node": ">=6.11.5"
},

@@ -42,3 +40,2 @@ "files": [

"devDependencies": {
"beautify-lint": "^1.0.4",
"codecov.io": "^0.1.6",

@@ -45,0 +42,0 @@ "coveralls": "^2.11.6",

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