Migrate discourse-common from es6 -> js

This commit is contained in:
Robin Ward 2020-03-23 15:05:03 -04:00
parent 8b7dc35e76
commit 27641f21e4
23 changed files with 7 additions and 4 deletions

View File

@ -1,8 +1,9 @@
import deprecated from "discourse-common/lib/deprecated"; import deprecated from "discourse-common/lib/deprecated";
import { getOwner as emberGetOwner } from "@ember/application";
export function getOwner(obj) { export function getOwner(obj) {
if (Ember.getOwner) { if (emberGetOwner) {
return Ember.getOwner(obj) || Discourse.__container__; return emberGetOwner(obj) || Discourse.__container__;
} }
return obj.container; return obj.container;

View File

@ -41,6 +41,7 @@ export function readOnly(target, name, desc) {
import decoratorAlias from "ember-addons/decorator-alias"; import decoratorAlias from "ember-addons/decorator-alias";
/* eslint-disable */
export var on = decoratorAlias(Ember.on, "Can not `on` without event names"); export var on = decoratorAlias(Ember.on, "Can not `on` without event names");
export var observes = decoratorAlias( export var observes = decoratorAlias(
Ember.observer, Ember.observer,

View File

@ -40,7 +40,8 @@ class DiscourseJsProcessor
relative_path.start_with?("app/assets/javascripts/admin/") || relative_path.start_with?("app/assets/javascripts/admin/") ||
relative_path.start_with?("app/assets/javascripts/pretty-text/") || relative_path.start_with?("app/assets/javascripts/pretty-text/") ||
relative_path.start_with?("app/assets/javascripts/select-kit/") || relative_path.start_with?("app/assets/javascripts/select-kit/") ||
relative_path.start_with?("app/assets/javascripts/wizard/") relative_path.start_with?("app/assets/javascripts/wizard/") ||
relative_path.start_with?("app/assets/javascripts/discourse-common/")
end end
def self.skip_module?(data) def self.skip_module?(data)

View File

@ -11,7 +11,7 @@ class Barber::Precompiler
def precompiler def precompiler
if !@precompiler if !@precompiler
source = File.read("#{Rails.root}/app/assets/javascripts/discourse-common/lib/raw-handlebars.js.es6") source = File.read("#{Rails.root}/app/assets/javascripts/discourse-common/lib/raw-handlebars.js")
transpiler = DiscourseJsProcessor::Transpiler.new(skip_module: true) transpiler = DiscourseJsProcessor::Transpiler.new(skip_module: true)
transpiled = transpiler.perform(source) transpiled = transpiler.perform(source)