bin/lessc: Make sure path.dirname gets passed strings

Since nodejs/node@08085c49b6, which will be part of Node.js v6.0,
functions from the `path` core module (like `dirname`) will require
the input to be a string.

Because `.sourceMapFullFilename` and `.sourceMapInputFilename` in
bin/lessc may be `undefined`, default to passing `'.'` to
`path.dirname` instead.
This commit is contained in:
Anna Henningsen
2016-03-27 12:20:18 +02:00
parent 2c974b2c02
commit ec04a03f1c

View File

@@ -316,8 +316,8 @@ function printUsage() {
}
if (sourceMapOptions.sourceMapRootpath === undefined) {
var pathToMap = path.dirname(sourceMapFileInline ? output : sourceMapOptions.sourceMapFullFilename),
pathToInput = path.dirname(sourceMapOptions.sourceMapInputFilename);
var pathToMap = path.dirname(sourceMapFileInline ? output : sourceMapOptions.sourceMapFullFilename || '.'),
pathToInput = path.dirname(sourceMapOptions.sourceMapInputFilename || '.');
sourceMapOptions.sourceMapRootpath = path.relative(pathToMap, pathToInput);
}