loader-runner
Advanced tools
Comparing version 2.3.1 to 2.4.0
@@ -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); | ||
} | ||
@@ -171,3 +171,6 @@ return callback(null, result); | ||
loadLoader(currentLoaderObject, function(err) { | ||
if(err) return callback(err); | ||
if(err) { | ||
loaderContext.cacheable(false); | ||
return callback(err); | ||
} | ||
var fn = currentLoaderObject.pitch; | ||
@@ -174,0 +177,0 @@ currentLoaderObject.pitchExecuted = true; |
@@ -0,1 +1,3 @@ | ||
var LoaderLoadingError = require("./LoaderLoadingError"); | ||
module.exports = function loadLoader(loader, callback) { | ||
@@ -7,4 +9,7 @@ if(typeof System === "object" && typeof System.import === "function") { | ||
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)"); | ||
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(); | ||
@@ -30,11 +35,17 @@ }); | ||
} | ||
if(typeof loader !== "function" && typeof loader !== "object") | ||
throw new Error("Module '" + loader.path + "' is not a loader (export function or es6 module))"); | ||
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") | ||
throw new Error("Module '" + loader.path + "' is not a loader (must have normal or pitch function)"); | ||
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": "2.4.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", | ||
@@ -41,3 +39,2 @@ "travis": "npm run cover -- --report lcovonly" | ||
"devDependencies": { | ||
"beautify-lint": "^1.0.4", | ||
"codecov.io": "^0.1.6", | ||
@@ -44,0 +41,0 @@ "coveralls": "^2.11.6", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16285
8
6
409