Last active
August 29, 2015 14:17
-
-
Save eirikb/407497a7c3830e635e0a to your computer and use it in GitHub Desktop.
nodify
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 nodify = require('nodify'); | |
// Prints build time | |
console.log(nodify(function() { | |
return new Date(); | |
})); | |
// Prints current time | |
console.log(new Date()); |
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 built = new Date(nodify(function () { | |
return Date.now(); | |
})); | |
var builtBy = nodify(function (require) { | |
var parts = process.env['USERPROFILE'].split(require('path').sep); | |
return ('' + parts[parts.length - 1]).trim().toLowerCase(); | |
}); |
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
// ... | |
bundler.transform('nodify'); | |
// ... |
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 staticModule = require('static-module'); | |
module.exports = function () { | |
return staticModule({ | |
nodify: function (cb) { | |
return "JSON.parse('" + JSON.stringify(cb(require)) + "')"; | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment