Skip to content

Commit c6dc369

Browse files
committed
added debugging opportunity
1 parent 73453b2 commit c6dc369

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"node": ">=0.12"
88
},
99
"dependencies": {
10+
"debug": "^2.2.0",
1011
"lodash.assign": "^3.2.0",
1112
"lodash.identity": "^3.0.0",
1213
"lodash.isarray": "^3.0.4",

src/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import debug from 'debug';
12
import hook from './hook';
23
import { readFileSync } from 'fs';
34
import { dirname, sep, relative, resolve } from 'path';
@@ -12,6 +13,9 @@ import LocalByDefault from 'postcss-modules-local-by-default';
1213
import Scope from 'postcss-modules-scope';
1314
import Parser from './parser';
1415

16+
const debugFetch = debug('css-modules:fetch');
17+
const debugSetup = debug('css-modules:setup');
18+
1519
// cache
1620
let importNr = 0;
1721
let tokensByFile = {};
@@ -35,6 +39,7 @@ let rootDir = process.cwd();
3539
* @param {array} opts.extensions
3640
*/
3741
export default function setup(opts = {}) {
42+
debugSetup(opts);
3843
// clearing cache
3944
importNr = 0;
4045
tokensByFile = {};
@@ -96,6 +101,7 @@ function fetch(_to, _from, _trace) {
96101
return tokens;
97102
}
98103

104+
debugFetch(filename);
99105
const rootRelativePath = sep + relative(rootDir, filename);
100106
const CSSSource = preProcess(readFileSync(filename, 'utf8'), filename);
101107

0 commit comments

Comments
 (0)