mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 11:13:38 +08:00
Migrate discourse-common
from es6 -> js
This commit is contained in:
parent
8b7dc35e76
commit
27641f21e4
|
@ -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;
|
|
@ -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,
|
|
@ -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)
|
||||||
|
|
|
@ -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)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user