-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCONSTANTS.js
More file actions
90 lines (79 loc) · 3.42 KB
/
CONSTANTS.js
File metadata and controls
90 lines (79 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*jslint vars: true, plusplus: true, devel: true, nomen: true, regexp: true, indent: 4, maxerr: 50 */
/*global define, $, brackets, window */
define(function (require, exports, module) {
"use strict";
const NodeConnector = brackets.getModule("NodeConnector");
const ExtensionUtils = brackets.getModule("utils/ExtensionUtils");
const ProjectManager = brackets.getModule("project/ProjectManager");
const PreferencesManager = brackets.getModule("preferences/PreferencesManager");
exports.DEV = false;
exports.HAS_NODE = NodeConnector.isNodeAvailable();
exports.CMD_PREFIX = "mjerabek.cz.codebycode";
exports.CODE_CMD_PREFIX = "mjerabek.cz.codebycode.code";
exports.PREFS_PREFIX = "mjerabek.cz.codebycode";
exports.NS = "mjerabek-cz__codebycode";
exports.TITLE = "Code By Code";
exports.MODULES_DIR = "mjerabek.cz.codebycode";
exports.CHEERIO_OPTIONS = (data = {}) => ({
withDomLvl1: true,
normalizeWhitespace: false,
xml: {
xmlMode: data.xml || false,
lowerCaseAttributeNames: false,
lowerCaseTags: false,
decodeEntities: false,
recognizeSelfClosing: true
}
});
exports.STORAGE = {
LAST_OPTIONS: exports.NS + ":lastOptions",
CODE_ORDER: exports.NS + ":codeOrder",
LAST_SEARCH: exports.NS + ":lastSearch",
};
exports.COMMAND = {
OPEN_MAIN_UI: exports.CMD_PREFIX + ".openMainUI",
EXEC_LAST: exports.CMD_PREFIX + ".execLast",
OUTPUT_LAST: exports.CMD_PREFIX + ".outputLast",
EXEC_LAST_OPTIONS: exports.CMD_PREFIX + ".execLastOptions",
OUTPUT_LAST_OPTIONS: exports.CMD_PREFIX + ".outputLastOptions",
QUICK_EXEC: exports.CMD_PREFIX + ".quickExec",
QUICK_OUTPUT: exports.CMD_PREFIX + ".quickOutput",
};
exports.COMMAND_NAME = {
[exports.COMMAND.OPEN_MAIN_UI]: cmdsAsSubmenu => cmdsAsSubmenu ? "Open": (exports.TITLE + ": Open"),
[exports.COMMAND.QUICK_EXEC]: "Quick Execute | Rewrite",
[exports.COMMAND.QUICK_OUTPUT]: "Quick Execute | Get Output",
[exports.COMMAND.EXEC_LAST]: "Execute Last | Rewrite",
[exports.COMMAND.OUTPUT_LAST]: "Execute Last | Get Output",
[exports.COMMAND.EXEC_LAST_OPTIONS]: "Execute Last | Rewrite with Options",
[exports.COMMAND.OUTPUT_LAST_OPTIONS]: "Execute Last | Get Output with Options",
};
exports.OPTIONS = {
ENV_NODE: "node",
ENV_PHOENIX: "phoenix",
YES: "Yes",
NO: "No",
NEVER: "Never",
ON_OPEN: "On open",
ON_EDITOR_CHANGE: "On editor change",
ON_SELECTION_CHANGE: "On selection change",
ITEMS: "Items",
SUBMENU: "Submenu"
};
exports.CONFIG = {
CODE_GLOBAL: "codeGlobal",
CODE_LOCAL: "codeLocal",
SHOW_EXAMPLES: "showExamples",
SEARCH_CODE: "searchCode",
GLOBAL_FIRST: "globalFirst",
AUTO_OPTIONS: "autoOptions",
MENU_APPEARANCE: "menuAppearance",
INDENTATION: "indentation",
DEFAULT: {
CODE_LOCAL: ".phoenix/codebycode"
}
};
const prefs = PreferencesManager.getExtensionPrefs(exports.PREFS_PREFIX);
exports.EXAMPLES_SOURCE = `${ExtensionUtils.getModulePath(module)}.examples/`;
exports.LOCAL_SOURCE = () => `${ProjectManager.getProjectRoot().fullPath}${prefs.get(exports.CONFIG.CODE_LOCAL) ?? exports.CONFIG.DEFAULT.CODE_LOCAL}/`;
});