Upgrade to Babel 6

This commit is contained in:
Robin Ward
2017-07-05 14:14:30 -04:00
parent 2f480e21a0
commit 754c1e5438
35 changed files with 62713 additions and 67299 deletions

View File

@ -14,7 +14,7 @@ class Barber::Precompiler
transpiled = template.babel_transpile(source)
# very hacky but lets us use ES6. I'm ashamed of this code -RW
transpiled.gsub!(/^export .*$/, '')
transpiled = transpiled[0...transpiled.index('export ')]
@precompiler = StringIO.new <<END
var __RawHandlebars;
@ -40,11 +40,11 @@ module Discourse
module Handlebars
module Helper
def precompile_handlebars(string)
"require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
"requirejs('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
end
def compile_handlebars(string)
"require('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
"requirejs('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
end
end
end
@ -55,11 +55,11 @@ class Ember::Handlebars::Template
include Discourse::Ember::Handlebars::Helper
def precompile_handlebars(string, input=nil)
"require('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
"requirejs('discourse-common/lib/raw-handlebars').template(#{Barber::Precompiler.compile(string)});"
end
def compile_handlebars(string, input=nil)
"require('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
"requirejs('discourse-common/lib/raw-handlebars').compile(#{indent(string).inspect});"
end
def global_template_target(namespace, module_name, config)