Skip to content

Commit 36c7386

Browse files
committedOct 6, 2017
Initial experiments
0 parents  commit 36c7386

File tree

5 files changed

+1237
-0
lines changed

5 files changed

+1237
-0
lines changed
 

‎.babelrc

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"plugins": ["./index.js"]
3+
}

‎index.js

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const transformer = function (babel) {
2+
return {
3+
visitor: {
4+
Identifier: function (path, state) {
5+
if (path.node.name === 'log') {
6+
if (path.parent.object.name === 'console') {
7+
const args = path.parentPath.parentPath.node.arguments;
8+
console.log(args);
9+
}
10+
}
11+
}
12+
}
13+
}
14+
15+
}
16+
17+
module.exports = transformer;

‎package.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "y",
3+
"version": "y",
4+
"description": "Babel plugin to log the names of variables when used for debugging",
5+
"main": "y",
6+
"author": "Kashyap Kondamudi",
7+
"license": "MIT",
8+
"dependencies": {
9+
"babel-cli": "^6.26.0",
10+
"babel-core": "^6.26.0"
11+
},
12+
"scripts": {
13+
"debug": "babel-node --inspect test.js",
14+
"test": "babel-node test.js"
15+
}
16+
}

‎test.js

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
const a = 12;
2+
const b = 144;
3+
console.log(a, b);

0 commit comments

Comments
 (0)