Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Fix for 3296: add deprecation warning for global Mustache
Browse files Browse the repository at this point in the history
  • Loading branch information
ficristo committed Oct 15, 2015
1 parent 40ad8e9 commit 498be1e
Show file tree
Hide file tree
Showing 33 changed files with 88 additions and 51 deletions.
3 changes: 1 addition & 2 deletions .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
"$": false,
"PathUtils": false,
"window": false,
"navigator": false,
"Mustache": false
"navigator": false
}
}
16 changes: 14 additions & 2 deletions src/brackets.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, brackets: true, $, window, navigator, Mustache, jQuery */
/*global define, brackets: true, $, window, navigator, jQuery */

// TODO: (issue #264) break out the definition of brackets into a separate module from the application controller logic

Expand Down Expand Up @@ -114,7 +114,19 @@ define(function (require, exports, module) {
return CodeMirror;
}
});


// DEPRECATED: In future we want to remove the global Mustache, but for now we
// expose our required Mustache globally so as to avoid breaking extensions in the
// interim.
var Mustache = require("thirdparty/mustache/mustache");

Object.defineProperty(window, "Mustache", {
get: function () {
DeprecationWarning.deprecationWarning('Use brackets.getModule("thirdparty/mustache/mustache") instead of global Mustache.', true);
return Mustache;
}
});

// Load modules that self-register and just need to get included in the main project
require("command/DefaultMenus");
require("document/ChangedDocumentTracker");
Expand Down
2 changes: 1 addition & 1 deletion src/dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ window.setTimeout(function () {
"use strict";

var key, missingDeps = "";
var deps = { "Mustache": window.Mustache, "jQuery": window.$, "RequireJS": window.require };
var deps = { "jQuery": window.$, "RequireJS": window.require };

for (key in deps) {
if (deps.hasOwnProperty(key) && !deps[key]) {
Expand Down
5 changes: 3 additions & 2 deletions src/editor/CodeHintList.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, window, Mustache */
/*global define, $, window */

define(function (require, exports, module) {
"use strict";
Expand All @@ -34,7 +34,8 @@ define(function (require, exports, module) {
StringUtils = require("utils/StringUtils"),
ValidationUtils = require("utils/ValidationUtils"),
ViewUtils = require("utils/ViewUtils"),
PopUpManager = require("widgets/PopUpManager");
PopUpManager = require("widgets/PopUpManager"),
Mustache = require("thirdparty/mustache/mustache");

var CodeHintListHTML = require("text!htmlContent/code-hint-list.html");

Expand Down
5 changes: 3 additions & 2 deletions src/editor/ImageViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, window, Mustache */
/*global define, $, window */

define(function (require, exports, module) {
"use strict";
Expand All @@ -36,7 +36,8 @@ define(function (require, exports, module) {
StringUtils = require("utils/StringUtils"),
FileSystem = require("filesystem/FileSystem"),
FileUtils = require("file/FileUtils"),
_ = require("thirdparty/lodash");
_ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache");


var _viewers = {};
Expand Down
3 changes: 2 additions & 1 deletion src/extensibility/ExtensionManagerDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global brackets, define, $, Mustache */
/*global brackets, define, $ */

define(function (require, exports, module) {
"use strict";

var _ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache"),
Dialogs = require("widgets/Dialogs"),
DefaultDialogs = require("widgets/DefaultDialogs"),
FileSystem = require("filesystem/FileSystem"),
Expand Down
5 changes: 3 additions & 2 deletions src/extensibility/ExtensionManagerView.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
/*global define, $, brackets, Mustache */
/*global define, $, brackets */
/*unittests: ExtensionManager*/

define(function (require, exports, module) {
Expand All @@ -35,7 +35,8 @@ define(function (require, exports, module) {
registry_utils = require("extensibility/registry_utils"),
InstallExtensionDialog = require("extensibility/InstallExtensionDialog"),
LocalizationUtils = require("utils/LocalizationUtils"),
itemTemplate = require("text!htmlContent/extension-manager-view-item.html");
itemTemplate = require("text!htmlContent/extension-manager-view-item.html"),
Mustache = require("thirdparty/mustache/mustache");

/**
* Creates a view enabling the user to install and manage extensions. Must be initialized
Expand Down
5 changes: 3 additions & 2 deletions src/extensibility/InstallExtensionDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, window, $, brackets, Mustache, document */
/*global define, window, $, brackets, document */
/*unittests: Install Extension Dialog*/

define(function (require, exports, module) {
Expand All @@ -36,7 +36,8 @@ define(function (require, exports, module) {
KeyEvent = require("utils/KeyEvent"),
Package = require("extensibility/Package"),
NativeApp = require("utils/NativeApp"),
InstallDialogTemplate = require("text!htmlContent/install-extension-dialog.html");
InstallDialogTemplate = require("text!htmlContent/install-extension-dialog.html"),
Mustache = require("thirdparty/mustache/mustache");

var STATE_CLOSED = 0,
STATE_START = 1,
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/default/DebugCommands/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50, regexp: true */
/*global define, $, brackets, window, Mustache*/
/*global define, $, brackets, window*/

define(function (require, exports, module) {
"use strict";
Expand All @@ -44,6 +44,7 @@ define(function (require, exports, module) {
MainViewManager = brackets.getModule("view/MainViewManager"),
WorkingSetView = brackets.getModule("project/WorkingSetView"),
ExtensionManager = brackets.getModule("extensibility/ExtensionManager"),
Mustache = brackets.getModule("thirdparty/mustache/mustache"),
ErrorNotification = require("ErrorNotification"),
NodeDebugUtils = require("NodeDebugUtils"),
PerfDialogTemplate = require("text!htmlContent/perf-dialog.html"),
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/default/HealthData/HealthDataPopup.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global brackets, define, Mustache, $*/
/*global brackets, define, $*/


define(function (require, exports, module) {
Expand All @@ -33,6 +33,7 @@ define(function (require, exports, module) {
var MainViewManager = brackets.getModule("view/MainViewManager"),
Dialogs = brackets.getModule("widgets/Dialogs"),
Strings = brackets.getModule("strings"),
Mustache = brackets.getModule("thirdparty/mustache/mustache"),
HealthDataNotificationHtml = require("text!htmlContent/healthdata-popup.html");

function closeCallout() {
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/default/HealthData/HealthDataPreview.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,13 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, Mustache, brackets, $ */
/*global define, brackets, $ */

define(function (require, exports, module) {
"use strict";

var _ = brackets.getModule("thirdparty/lodash"),
Mustache = brackets.getModule("thirdparty/mustache/mustache"),
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
Strings = brackets.getModule("strings"),
Dialogs = brackets.getModule("widgets/Dialogs"),
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/default/InlineColorEditor/ColorEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*jslint vars: true, plusplus: true, nomen: true, regexp: true, maxerr: 50 */
/*global define, brackets, $, window, Mustache */
/*global define, brackets, $, window */

define(function (require, exports, module) {
"use strict";
Expand All @@ -31,6 +31,7 @@ define(function (require, exports, module) {
PreferencesManager = brackets.getModule("preferences/PreferencesManager"),
StringUtils = brackets.getModule("utils/StringUtils"),
Strings = brackets.getModule("strings"),
Mustache = brackets.getModule("thirdparty/mustache/mustache"),
tinycolor = require("thirdparty/tinycolor-min");

/** Mustache template that forms the bare DOM structure of the UI */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
*/

/*jslint vars: true, plusplus: true, nomen: true, regexp: true, maxerr: 50 */
/*global define, brackets, $, window, Mustache */
/*global define, brackets, $, window */

define(function (require, exports, module) {
"use strict";

var KeyEvent = brackets.getModule("utils/KeyEvent"),
Strings = brackets.getModule("strings");
Strings = brackets.getModule("strings"),
Mustache = brackets.getModule("thirdparty/mustache/mustache");

var TimingFunctionUtils = require("TimingFunctionUtils");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
*/

/*jslint vars: true, plusplus: true, nomen: true, regexp: true, maxerr: 50 */
/*global define, brackets, $, window, Mustache */
/*global define, brackets, $, window */

define(function (require, exports, module) {
"use strict";

var KeyEvent = brackets.getModule("utils/KeyEvent"),
Strings = brackets.getModule("strings");
Strings = brackets.getModule("strings"),
Mustache = brackets.getModule("thirdparty/mustache/mustache");

var TimingFunctionUtils = require("TimingFunctionUtils");

Expand Down
3 changes: 2 additions & 1 deletion src/extensions/default/InlineTimingFunctionEditor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, brackets, $, Mustache */
/*global define, brackets, $ */

define(function (require, exports, module) {
"use strict";
Expand All @@ -50,6 +50,7 @@ define(function (require, exports, module) {
var EditorManager = brackets.getModule("editor/EditorManager"),
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
Strings = brackets.getModule("strings"),
Mustache = brackets.getModule("thirdparty/mustache/mustache"),

InlineTimingFunctionEditor = require("InlineTimingFunctionEditor").InlineTimingFunctionEditor,
TimingFunctionUtils = require("TimingFunctionUtils"),
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/default/RecentProjects/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, brackets, window, $, Mustache */
/*global define, brackets, window, $ */

define(function (require, exports, module) {
"use strict";
Expand All @@ -43,6 +43,7 @@ define(function (require, exports, module) {
FileUtils = brackets.getModule("file/FileUtils"),
PopUpManager = brackets.getModule("widgets/PopUpManager"),
Strings = brackets.getModule("strings"),
Mustache = brackets.getModule("thirdparty/mustache/mustache"),
ProjectsMenuTemplate = require("text!htmlContent/projects-menu.html");

var KeyboardPrefs = JSON.parse(require("text!keyboard.json"));
Expand Down
5 changes: 3 additions & 2 deletions src/extensions/default/WebPlatformDocs/InlineDocsViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, brackets, $, window, Mustache */
/*global define, brackets, $, window */

/**
* Inline widget to display WebPlatformDocs JSON data nicely formatted
Expand All @@ -36,7 +36,8 @@ define(function (require, exports, module) {
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
InlineWidget = brackets.getModule("editor/InlineWidget").InlineWidget,
KeyEvent = brackets.getModule("utils/KeyEvent"),
Strings = brackets.getModule("strings");
Strings = brackets.getModule("strings"),
Mustache = brackets.getModule("thirdparty/mustache/mustache");

// Load template
var inlineEditorTemplate = require("text!InlineDocsViewer.html");
Expand Down
3 changes: 2 additions & 1 deletion src/extensions/samples/BracketsConfigCentral/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, brackets, $, Mustache */
/*global define, brackets, $ */

define(function (require, exports, module) {
"use strict";
Expand All @@ -32,6 +32,7 @@ define(function (require, exports, module) {
ExtensionUtils = brackets.getModule("utils/ExtensionUtils"),
DocumentManager = brackets.getModule("document/DocumentManager"),
MainViewFactory = brackets.getModule("view/MainViewFactory"),
Mustache = brackets.getModule("thirdparty/mustache/mustache"),
ConfigViewContent = require("text!htmlContent/Config.html");

/* our module object */
Expand Down
5 changes: 3 additions & 2 deletions src/extensions/samples/LocalizationExample/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, brackets, require, Mustache */
/*global define, brackets, require */


require.config({
Expand All @@ -40,7 +40,8 @@ define(function (require, exports, module) {
// Brackets modules
var CommandManager = brackets.getModule("command/CommandManager"),
Menus = brackets.getModule("command/Menus"),
Dialogs = brackets.getModule("widgets/Dialogs");
Dialogs = brackets.getModule("widgets/Dialogs"),
Mustache = brackets.getModule("thirdparty/mustache/mustache");

// Load an html fragment using the require text plugin. Mustache will later
// be used to localize some of the text
Expand Down
5 changes: 3 additions & 2 deletions src/help/HelpCommandHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, brackets, window, Mustache */
/*global define, $, brackets, window */

define(function (require, exports, module) {
"use strict";
Expand All @@ -39,7 +39,8 @@ define(function (require, exports, module) {
StringUtils = require("utils/StringUtils"),
UpdateNotification = require("utils/UpdateNotification"),
AboutDialogTemplate = require("text!htmlContent/about-dialog.html"),
ContributorsTemplate = require("text!htmlContent/contributors-list.html");
ContributorsTemplate = require("text!htmlContent/contributors-list.html"),
Mustache = require("thirdparty/mustache/mustache");
// make sure the global brackets variable is loaded
require("utils/Global");

Expand Down
1 change: 0 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<!-- Pre-load third party scripts that cannot be async loaded. -->
<!-- build:js thirdparty/thirdparty.min.js -->
<script src="thirdparty/less-2.5.1.min.js"></script>
<script src="thirdparty/mustache/mustache.js"></script>
<script src="thirdparty/jquery-2.1.3.min.js"></script>
<!-- endbuild -->
</head>
Expand Down
7 changes: 4 additions & 3 deletions src/language/CodeInspection.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4 */
/*global define, $, Mustache, brackets */
/*global define, $, brackets */

/**
* Manages linters and other code inspections on a per-language basis. Provides a UI and status indicator for
Expand Down Expand Up @@ -58,8 +58,9 @@ define(function (require, exports, module) {
StatusBar = require("widgets/StatusBar"),
Async = require("utils/Async"),
PanelTemplate = require("text!htmlContent/problems-panel.html"),
ResultsTemplate = require("text!htmlContent/problems-panel-table.html");

ResultsTemplate = require("text!htmlContent/problems-panel-table.html"),
Mustache = require("thirdparty/mustache/mustache");

var INDICATOR_ID = "status-inspection";

/** Values for problem's 'type' property */
Expand Down
5 changes: 3 additions & 2 deletions src/preferences/PreferencesDialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, PathUtils, Mustache */
/*global define, PathUtils */

/**
* PreferencesDialogs
Expand All @@ -38,7 +38,8 @@ define(function (require, exports, module) {
ProjectManager = require("project/ProjectManager"),
StringUtils = require("utils/StringUtils"),
Strings = require("strings"),
SettingsDialogTemplate = require("text!htmlContent/project-settings-dialog.html");
SettingsDialogTemplate = require("text!htmlContent/project-settings-dialog.html"),
Mustache = require("thirdparty/mustache/mustache");

/**
* Validate that text string is a valid base url which should map to a server folder
Expand Down
Loading

0 comments on commit 498be1e

Please sign in to comment.