@@ -66,18 +66,18 @@ export default function setup(opts = {}) {
6666}
6767
6868/**
69- * @param {string } _newPath Absolute or relative path. Also can be path to the Node.JS module.
70- * @param {string } _sourcePath Absolute path (relative to root).
69+ * @param {string } _to Absolute or relative path. Also can be path to the Node.JS module.
70+ * @param {string } _from Absolute path (relative to root).
7171 * @param {string } _trace
7272 * @return {object }
7373 */
74- function fetch ( _newPath , _sourcePath , _trace ) {
74+ function fetch ( _to , _from , _trace ) {
7575 const trace = _trace || String . fromCharCode ( importNr ++ ) ;
76- const newPath = removeQuotes ( _newPath ) ;
76+ const newPath = removeQuotes ( _to ) ;
7777 // getting absolute path to the processing file
7878 const filename = / \w / . test ( newPath [ 0 ] )
7979 ? require . resolve ( newPath )
80- : resolve ( rootDir + dirname ( _sourcePath ) , newPath ) ;
80+ : resolve ( dirname ( _from ) , newPath ) ;
8181
8282 // checking cache
8383 let tokens = tokensByFile [ filename ] ;
@@ -88,7 +88,7 @@ function fetch(_newPath, _sourcePath, _trace) {
8888 const rootRelativePath = sep + relative ( rootDir , filename ) ;
8989 const CSSSource = preProcess ( readFileSync ( filename , 'utf8' ) ) ;
9090
91- const result = postcss ( plugins . concat ( new Parser ( { fetch, trace } ) ) )
91+ const result = postcss ( plugins . concat ( new Parser ( { fetch, filename , trace } ) ) )
9292 . process ( CSSSource , assign ( lazyResultOpts , { from : rootRelativePath } ) )
9393 . root ;
9494
@@ -102,4 +102,4 @@ function fetch(_newPath, _sourcePath, _trace) {
102102 return tokens ;
103103}
104104
105- hook ( filename => fetch ( filename , sep + relative ( rootDir , filename ) ) ) ;
105+ hook ( filename => fetch ( filename , filename ) ) ;
0 commit comments