Skip to content

Commit 980ad07

Browse files
committed
Improve addons optimization
Add namespace codebox for require in addons
1 parent d8c9497 commit 980ad07

File tree

22 files changed

+114
-82
lines changed

22 files changed

+114
-82
lines changed

addons/editor/client.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ define([
22
"views/tab",
33
"ace/ace"
44
], function(EditorTab, ace) {
5-
var $ = require("jQuery");
6-
var commands = require("core/commands");
7-
var tabs = require("utils/tabs");
8-
var settings = require("utils/settings");
9-
var config = require("config");
5+
var $ = codebox.require("jQuery");
6+
var commands = codebox.require("core/commands");
7+
var tabs = codebox.require("utils/tabs");
8+
var settings = codebox.require("utils/settings");
9+
var config = codebox.require("config");
1010

1111
// Configure ace
1212
// ace version used is the content of https://github.com/ajaxorg/ace/tree/master/lib/ace

addons/editor/views/base.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
define([], function() {
2-
var _ = require("underscore");
3-
var $ = require("jQuery");
4-
var hr = require("hr/hr");
5-
var Tab = require("views/tabs/base");
6-
var File = require("models/file");
7-
var box = require("core/box");
2+
var _ = codebox.require("underscore");
3+
var $ = codebox.require("jQuery");
4+
var hr = codebox.require("hr/hr");
5+
var Tab = codebox.require("views/tabs/base");
6+
var File = codebox.require("models/file");
7+
var box = codebox.require("core/box");
88

99
var FilesBaseView = hr.View.extend({
1010
defaults: {

addons/editor/views/directory.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ define([
22
"views/base",
33
"less!stylesheets/directory.less"
44
], function(FilesBaseView) {
5-
var _ = require("underscore");
6-
var $ = require("jQuery");
7-
var hr = require("hr/hr");
8-
var Uploader = require("utils/uploader");
9-
var Dialogs = require("utils/dialogs");
5+
var _ = codebox.require("underscore");
6+
var $ = codebox.require("jQuery");
7+
var hr = codebox.require("hr/hr");
8+
var Uploader = codebox.require("utils/uploader");
9+
var Dialogs = codebox.require("utils/dialogs");
1010

1111
var FilesDirectoryView = FilesBaseView.extend({
1212
className: "editor-files-directory",

addons/editor/views/editor.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
define([
22
"ace/ace"
33
], function(ace) {
4-
var _ = require("underscore");
5-
var $ = require("jQuery");
6-
var hr = require("hr/hr");
7-
var Dialogs = require("utils/dialogs");
8-
var FileSync = require("utils/filesync");
9-
var user = require("core/user");
10-
var config = require("config");
4+
var _ = codebox.require("underscore");
5+
var $ = codebox.require("jQuery");
6+
var hr = codebox.require("hr/hr");
7+
var Dialogs = codebox.require("utils/dialogs");
8+
var FileSync = codebox.require("utils/filesync");
9+
var user = codebox.require("core/user");
10+
var config = codebox.require("config");
1111

1212
var logging = hr.Logger.addNamespace("editor");
1313
var settings = user.settings("editor");

addons/editor/views/file.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ define([
33
"views/editor",
44
"less!stylesheets/file.less"
55
], function(FilesBaseView, EditorView) {
6-
var _ = require("underscore");
7-
var $ = require("jQuery");
8-
var hr = require("hr/hr");
9-
var Dialogs = require("utils/dialogs");
6+
var _ = codebox.require("underscore");
7+
var $ = codebox.require("jQuery");
8+
var hr = codebox.require("hr/hr");
9+
var Dialogs = codebox.require("utils/dialogs");
1010

1111
var FileEditorView = FilesBaseView.extend({
1212
className: "editor-files-editor",

addons/editor/views/tab.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ define([
33
"views/file",
44
"less!stylesheets/tab.less"
55
], function(FilesDirectoryView, FileEditorView) {
6-
var _ = require("underscore");
7-
var $ = require("jQuery");
8-
var hr = require("hr/hr");
9-
var Tab = require("views/tabs/base")
10-
var box = require("core/box");
11-
var File = require("models/file");
6+
var _ = codebox.require("underscore");
7+
var $ = codebox.require("jQuery");
8+
var hr = codebox.require("hr/hr");
9+
var Tab = codebox.require("views/tabs/base")
10+
var box = codebox.require("core/box");
11+
var File = codebox.require("models/file");
1212

1313
var EditorTab = Tab.extend({
1414
className: Tab.prototype.className+ " addon-editor-tab",

addons/manager/client.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
define(["views/dialog"], function(InstallerDialog) {
2-
var commands = require("core/commands");
3-
var app = require("core/app");
4-
var dialogs = require("utils/dialogs");
5-
var settings = require("utils/settings");
2+
var commands = codebox.require("core/commands");
3+
var app = codebox.require("core/app");
4+
var dialogs = codebox.require("utils/dialogs");
5+
var settings = codebox.require("utils/settings");
66

77
// Add settings
88
settings.add({

addons/manager/collections/addons.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
define([
22
"models/addon"
33
], function(Addon) {
4-
var Q = require("q");
5-
var hr = require("hr/hr");
6-
var _ = require("underscore");
7-
var user = require("core/user");
8-
var addons = require("core/addons");
4+
var Q = codebox.require("q");
5+
var hr = codebox.require("hr/hr");
6+
var _ = codebox.require("underscore");
7+
var user = codebox.require("core/user");
8+
var addons = codebox.require("core/addons");
99

1010
var Addons = hr.Collection.extend({
1111
model: Addon,
@@ -27,7 +27,6 @@ define([
2727

2828
return hr.Requests.getJSON(user.settings("manager").get("registry")+"/api/addons?limit=1000&callback=?").then(function(index) {
2929
that._index = index;
30-
console.log("addons", index);
3130
hr.Cache.set("addons", user.settings("manager").get("registry"), that._index, 60*60);
3231

3332
return Q(that._index);

addons/manager/models/addon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define([], function() {
2-
var hr = require("hr/hr");
3-
var addons = require("core/addons");
2+
var hr = codebox.require("hr/hr");
3+
var addons = codebox.require("core/addons");
44

55
var Addon = hr.Model.extend({
66
defaults: {

addons/manager/views/addons.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ define([
22
'collections/addons',
33
'less!stylesheets/addons'
44
], function(Addons) {
5-
var hr = require("hr/hr");
6-
var _ = require("underscore");
5+
var hr = codebox.require("hr/hr");
6+
var _ = codebox.require("underscore");
77

88
var AddonItem = hr.List.Item.extend({
99
className: "addon-item",

0 commit comments

Comments
 (0)