Move the widget-hbs compiler to js from es6
This commit is contained in:
parent
f68c3d51fc
commit
5d66a2c16e
|
@ -55,8 +55,8 @@ class DiscourseJsProcessor
|
|||
embed-application
|
||||
).any? { |f| relative_path == "#{js_root}/#{f}.js" }
|
||||
|
||||
relative_path =~ /^#{js_root}\/[^\/]+\// ||
|
||||
relative_path =~ /^#{test_root}\/[^\/]+\//
|
||||
!!(relative_path =~ /^#{js_root}\/[^\/]+\// ||
|
||||
relative_path =~ /^#{test_root}\/[^\/]+\//)
|
||||
end
|
||||
|
||||
def self.skip_module?(data)
|
||||
|
@ -87,7 +87,7 @@ class DiscourseJsProcessor
|
|||
}
|
||||
|
||||
JS
|
||||
source = File.read("#{Rails.root}/lib/javascripts/widget-hbs-compiler.js.es6")
|
||||
source = File.read("#{Rails.root}/lib/javascripts/widget-hbs-compiler.js")
|
||||
js_source = ::JSON.generate(source, quirks_mode: true)
|
||||
js = ctx.eval("Babel.transform(#{js_source}, { ast: false, plugins: ['check-es2015-constants', 'transform-es2015-arrow-functions', 'transform-es2015-block-scoped-functions', 'transform-es2015-block-scoping', 'transform-es2015-classes', 'transform-es2015-computed-properties', 'transform-es2015-destructuring', 'transform-es2015-duplicate-keys', 'transform-es2015-for-of', 'transform-es2015-function-name', 'transform-es2015-literals', 'transform-es2015-object-super', 'transform-es2015-parameters', 'transform-es2015-shorthand-properties', 'transform-es2015-spread', 'transform-es2015-sticky-regex', 'transform-es2015-template-literals', 'transform-es2015-typeof-symbol', 'transform-es2015-unicode-regex'] }).code")
|
||||
ctx.eval(js)
|
||||
|
|
|
@ -14,7 +14,7 @@ console = {
|
|||
}
|
||||
|
||||
JS
|
||||
source = File.read("#{Rails.root}/lib/javascripts/widget-hbs-compiler.js.es6")
|
||||
source = File.read("#{Rails.root}/lib/javascripts/widget-hbs-compiler.js")
|
||||
js_source = ::JSON.generate(source, quirks_mode: true)
|
||||
js = ctx.eval("Babel.transform(#{js_source}, { ast: false, plugins: ['check-es2015-constants', 'transform-es2015-arrow-functions', 'transform-es2015-block-scoped-functions', 'transform-es2015-block-scoping', 'transform-es2015-classes', 'transform-es2015-computed-properties', 'transform-es2015-destructuring', 'transform-es2015-duplicate-keys', 'transform-es2015-for-of', 'transform-es2015-function-name', 'transform-es2015-literals', 'transform-es2015-object-super', 'transform-es2015-parameters', 'transform-es2015-shorthand-properties', 'transform-es2015-spread', 'transform-es2015-sticky-regex', 'transform-es2015-template-literals', 'transform-es2015-typeof-symbol', 'transform-es2015-unicode-regex'] }).code")
|
||||
ctx.eval(js)
|
||||
|
|
|
@ -22,7 +22,7 @@ console = {
|
|||
}
|
||||
|
||||
JS
|
||||
source = File.read("#{Rails.root}/lib/javascripts/widget-hbs-compiler.js.es6")
|
||||
source = File.read("#{Rails.root}/lib/javascripts/widget-hbs-compiler.js")
|
||||
ctx.eval(source)
|
||||
|
||||
js_source = ::JSON.generate(template, quirks_mode: true)
|
||||
|
|
Loading…
Reference in New Issue