1
0
mirror of https://github.com/adobe/brackets.git synced 2024-11-20 09:53:00 +01:00

Fix for 3296: add deprecation warning for global Mustache

This commit is contained in:
ficristo 2015-08-22 14:09:52 +02:00
parent 4143028b2c
commit 96806b1143
34 changed files with 86 additions and 51 deletions

View File

@ -64,7 +64,6 @@
"require": false,
"define": false,
"$": false,
"PathUtils": false,
"Mustache": false
"PathUtils": false
}
}

View File

@ -274,7 +274,6 @@ module.exports = function (grunt) {
'src/thirdparty/CodeMirror/lib/util/searchcursor.js',
'src/thirdparty/CodeMirror/addon/edit/closetag.js',
'src/thirdparty/CodeMirror/addon/selection/active-line.js',
'src/thirdparty/mustache/mustache.js',
'src/thirdparty/path-utils/path-utils.min',
'src/thirdparty/less-2.5.1.min.js'
],

View File

@ -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
@ -115,6 +115,18 @@ define(function (require, exports, module) {
}
});
// 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");

View File

@ -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]) {

View File

@ -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";
@ -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");

View File

@ -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";
@ -36,8 +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 = {};

View File

@ -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"),

View File

@ -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) {
@ -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

View File

@ -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) {
@ -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,

View File

@ -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";
@ -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"),

View File

@ -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) {
@ -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() {

View File

@ -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"),

View File

@ -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";
@ -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 */

View File

@ -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");

View File

@ -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");

View File

@ -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";
@ -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"),

View File

@ -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";
@ -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"));

View File

@ -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
@ -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");

View File

@ -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";
@ -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 */

View File

@ -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({
@ -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

View File

@ -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";
@ -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");

View File

@ -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>

View File

@ -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
@ -58,7 +58,8 @@ 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";

View File

@ -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
@ -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

View File

@ -23,7 +23,7 @@
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, window, brackets, Mustache */
/*global define, $, window, brackets */
/**
* WorkingSetView generates the UI for the list of the files user is editing based on the model provided by EditorManager.
@ -45,7 +45,8 @@ define(function (require, exports, module) {
KeyEvent = require("utils/KeyEvent"),
paneListTemplate = require("text!htmlContent/working-set.html"),
Strings = require("strings"),
_ = require("thirdparty/lodash");
_ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache");
/**
* Open view dictionary

View File

@ -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 */
/**
* Utilities for managing file-set filters, as used in Find in Files.
@ -32,6 +32,7 @@ define(function (require, exports, module) {
"use strict";
var _ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache"),
Dialogs = require("widgets/Dialogs"),
DropdownButton = require("widgets/DropdownButton").DropdownButton,
StringUtils = require("utils/StringUtils"),

View File

@ -22,7 +22,7 @@
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, $, Mustache */
/*global define, $ */
/*
* UI for the Find/Replace and Find in Files modal bar.
@ -31,6 +31,7 @@ define(function (require, exports, module) {
"use strict";
var _ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache"),
EventDispatcher = require("utils/EventDispatcher"),
Commands = require("command/Commands"),
KeyBindingManager = require("command/KeyBindingManager"),

View File

@ -21,7 +21,7 @@
*
*/
/*global define, $, window, Mustache */
/*global define, $, window */
/*
* Panel showing search results for a Find/Replace in Files operation.
@ -43,6 +43,7 @@ define(function (require, exports, module) {
Strings = require("strings"),
HealthLogger = require("utils/HealthLogger"),
_ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache"),
searchPanelTemplate = require("text!htmlContent/search-panel.html"),
searchResultsTemplate = require("text!htmlContent/search-results.html"),

View File

@ -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 */
/**
* Utilities functions for displaying update notifications
@ -38,7 +38,8 @@ define(function (require, exports, module) {
NativeApp = require("utils/NativeApp"),
Strings = require("strings"),
UpdateDialogTemplate = require("text!htmlContent/update-dialog.html"),
UpdateListTemplate = require("text!htmlContent/update-list.html");
UpdateListTemplate = require("text!htmlContent/update-list.html"),
Mustache = require("thirdparty/mustache/mustache");
// make sure the global brackets variable is loaded
require("utils/Global");

View File

@ -23,7 +23,7 @@
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, Mustache */
/*global define, $ */
/**
* Pane objects host views of files, editors, etc... Clients cannot access
@ -156,6 +156,7 @@ define(function (require, exports, module) {
"use strict";
var _ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache"),
EventDispatcher = require("utils/EventDispatcher"),
FileSystem = require("filesystem/FileSystem"),
InMemoryFile = require("document/InMemoryFile"),

View File

@ -22,12 +22,13 @@
*/
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global $, define, Mustache */
/*global $, define */
define(function (require, exports, module) {
"use strict";
var _ = require("thirdparty/lodash"),
Mustache = require("thirdparty/mustache/mustache"),
Dialogs = require("widgets/Dialogs"),
Strings = require("strings"),
ViewCommandHandlers = require("view/ViewCommandHandlers"),

View File

@ -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 */
/**
* Utilities for creating and managing standard modal dialogs.
@ -36,7 +36,8 @@ define(function (require, exports, module) {
var KeyBindingManager = require("command/KeyBindingManager"),
KeyEvent = require("utils/KeyEvent"),
Strings = require("strings"),
DialogTemplate = require("text!htmlContent/dialog-template.html");
DialogTemplate = require("text!htmlContent/dialog-template.html"),
Mustache = require("thirdparty/mustache/mustache");
/**
* Dialog Buttons IDs

View File

@ -23,7 +23,7 @@
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, $, document, Mustache */
/*global define, $, document */
/**
* A status bar with support for file information and busy and status indicators. This is a semi-generic
@ -37,7 +37,8 @@ define(function (require, exports, module) {
var AppInit = require("utils/AppInit"),
StatusBarHTML = require("text!widgets/StatusBar.html"),
Strings = require("strings"),
WorkspaceManager = require("view/WorkspaceManager");
WorkspaceManager = require("view/WorkspaceManager"),
Mustache = require("thirdparty/mustache/mustache");
var _init = false;

View File

@ -36,7 +36,6 @@
<!-- Pre-load third party scripts that cannot be async loaded. -->
<!-- Keep in sync with Gruntfile.js jasmine vendor dependencies -->
<script src="../src/thirdparty/jquery-2.1.3.min.js"></script>
<script src="../src/thirdparty/mustache/mustache.js"></script>
<script src="../src/thirdparty/path-utils/path-utils.js"></script>
<script src="../src/thirdparty/less-2.5.1.min.js"></script>
<script src="thirdparty/bootstrap2/js/bootstrap.min.js"></script>