index.js 534 B

1234567891011121314151617181920
  1. var buble = require('./buble')
  2. // selectively support some handy ES2015 features in templates.
  3. var options = {
  4. transforms: {
  5. stripWith: true // this is a custom feature for stripping with from Vue render functions.
  6. }
  7. }
  8. module.exports = function transpile (code, opts) {
  9. if (opts) {
  10. opts = Object.assign({}, options, opts)
  11. opts.transforms = Object.assign({}, options.transforms, opts.transforms)
  12. } else {
  13. opts = options
  14. }
  15. var code = buble.transform(code, opts).code
  16. // console.log(code)
  17. return code
  18. }