Created
December 9, 2015 21:02
-
-
Save jakepusateri/3fc4d26cd4b716c0901c to your computer and use it in GitHub Desktop.
Babel 5.8.34 plugin + spec.functionName example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function _setDollarValue() {} | |
function OptionalNode() {} | |
OptionalNode.prototype = { | |
setDollarValue: function setDollarValue(value) { | |
_setDollarValue(); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var log = require('npmlog'); | |
var transformer = function (babel) { | |
var t = babel.types; | |
return new babel.Transformer('dep-finder', { | |
CallExpression: function (node, parent, scope, file) { | |
if (this.get("callee").matchesPattern("YUI.add")) { | |
var name = node.arguments[0].value; | |
if (name) { | |
/** Return function body **/ | |
this.replaceWithMultiple(node.arguments[1].body.body); | |
} else { | |
log.error('manifest-plugin', 'bad format of YUI.add? for: ' + name); | |
} | |
} | |
} | |
}); | |
}; | |
module.exports = transformer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
function setDollarValue() {} | |
function OptionalNode() {} | |
OptionalNode.prototype = { | |
setDollarValue: function setDollarValue(value) { | |
setDollarValue(); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI.add('zmm-loan-request-form', function (Y) { | |
function setDollarValue() { | |
} | |
function OptionalNode() { | |
} | |
OptionalNode.prototype = { | |
setDollarValue: function (value) { | |
setDollarValue(); | |
} | |
}; | |
}, | |
'3.7.0', | |
{ requires: []}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment