loader-runner
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -5,3 +5,2 @@ /* | ||
*/ | ||
var path = require("path"); | ||
var fs = require("fs"); | ||
@@ -26,2 +25,15 @@ var readFile = fs.readFile.bind(fs); | ||
function dirname(path) { | ||
if(path === "/") return "/"; | ||
var i = path.lastIndexOf("/"); | ||
var j = path.lastIndexOf("\\"); | ||
var i2 = path.indexOf("/"); | ||
var j2 = path.indexOf("\\"); | ||
var idx = i > j ? i : j; | ||
var idx2 = i > j ? i2 : j2; | ||
if(idx < 0) return path; | ||
if(idx === idx2) return path.substr(0, idx + 1); | ||
return path.substr(0, idx); | ||
} | ||
function createLoaderObject(loader) { | ||
@@ -200,3 +212,3 @@ var splittedRequest = splitQuery(loader); | ||
var splitted = splitQuery(resource); | ||
return path.dirname(splitted[0]); | ||
return dirname(splitted[0]); | ||
} | ||
@@ -215,3 +227,3 @@ | ||
var resourceQuery = splittedResource ? splittedResource[1] : undefined; | ||
var contextDirectory = resourcePath ? path.dirname(resourcePath) : null; | ||
var contextDirectory = resourcePath ? dirname(resourcePath) : null; | ||
@@ -218,0 +230,0 @@ // execution state |
{ | ||
"name": "loader-runner", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Runs (webpack) loaders", | ||
@@ -13,3 +13,3 @@ "main": "lib/LoaderRunner.js", | ||
"precover": "npm run lint && npm run beautify-lint", | ||
"cover": "istanbul cover node_modules/mocha/bin/_mocha -- -R spec", | ||
"cover": "istanbul cover node_modules/mocha/bin/_mocha", | ||
"travis": "npm run cover -- --report lcovonly" | ||
@@ -16,0 +16,0 @@ }, |
@@ -290,5 +290,7 @@ var should = require("should"); | ||
var TESTS = [ | ||
["/", "/"], | ||
["/path/file.js", "/path"], | ||
["/some/longer/path/file.js", "/some/longer/path"], | ||
["/file.js", "/"], | ||
["C:\\", "C:\\"], | ||
["C:\\file.js", "C:\\"], | ||
@@ -295,0 +297,0 @@ ["C:\\some\\path\\file.js", "C:\\some\\path"], |
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
25441
692