@@ -66,18 +66,18 @@ export default function setup(opts = {}) {
66
66
}
67
67
68
68
/**
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).
71
71
* @param {string } _trace
72
72
* @return {object }
73
73
*/
74
- function fetch ( _newPath , _sourcePath , _trace ) {
74
+ function fetch ( _to , _from , _trace ) {
75
75
const trace = _trace || String . fromCharCode ( importNr ++ ) ;
76
- const newPath = removeQuotes ( _newPath ) ;
76
+ const newPath = removeQuotes ( _to ) ;
77
77
// getting absolute path to the processing file
78
78
const filename = / \w / . test ( newPath [ 0 ] )
79
79
? require . resolve ( newPath )
80
- : resolve ( rootDir + dirname ( _sourcePath ) , newPath ) ;
80
+ : resolve ( dirname ( _from ) , newPath ) ;
81
81
82
82
// checking cache
83
83
let tokens = tokensByFile [ filename ] ;
@@ -88,7 +88,7 @@ function fetch(_newPath, _sourcePath, _trace) {
88
88
const rootRelativePath = sep + relative ( rootDir , filename ) ;
89
89
const CSSSource = preProcess ( readFileSync ( filename , 'utf8' ) ) ;
90
90
91
- const result = postcss ( plugins . concat ( new Parser ( { fetch, trace } ) ) )
91
+ const result = postcss ( plugins . concat ( new Parser ( { fetch, filename , trace } ) ) )
92
92
. process ( CSSSource , assign ( lazyResultOpts , { from : rootRelativePath } ) )
93
93
. root ;
94
94
@@ -102,4 +102,4 @@ function fetch(_newPath, _sourcePath, _trace) {
102
102
return tokens ;
103
103
}
104
104
105
- hook ( filename => fetch ( filename , sep + relative ( rootDir , filename ) ) ) ;
105
+ hook ( filename => fetch ( filename , filename ) ) ;
0 commit comments