Rewrite vendor/constants.js to use require("ast-types").traverse.

Most notably, this new style of transformation gives us access to
this.parent.node, which allows us to avoid replacing identifiers that are
not actually free variables, such as member expression properties.

Closes #496.
Better comments for vendor/constants.js.
Merge pull request #526 from benjamn/rewrite-vendor/constants.js

Rewrite vendor/constants.js to use require("recast").types.traverse.