aboutsummaryrefslogtreecommitdiff
path: root/node_modules/babel-code-frame
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-20 03:09:25 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-24 16:14:29 +0200
commit82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8 (patch)
tree965f6eb89b84d65a62b49008fd972c004832ccd1 /node_modules/babel-code-frame
parente6e0cbc387c2a77b48e4065c229daa65bf1aa0fa (diff)
downloadwallet-core-82f2b76e25a4a67e01ec67e5ebe39d14ad771ea8.tar.xz
Reorganize module loading.
We now use webpack instead of SystemJS, effectively bundling modules into one file (plus commons chunks) for every entry point. This results in a much smaller extension size (almost half). Furthermore we use yarn/npm even for extension run-time dependencies. This relieves us from manually vendoring and building dependencies. It's also easier to understand for new developers familiar with node.
Diffstat (limited to 'node_modules/babel-code-frame')
-rw-r--r--node_modules/babel-code-frame/README.md3
-rw-r--r--node_modules/babel-code-frame/lib/index.js54
-rw-r--r--node_modules/babel-code-frame/package.json4
3 files changed, 34 insertions, 27 deletions
diff --git a/node_modules/babel-code-frame/README.md b/node_modules/babel-code-frame/README.md
index 7e61e3ea5..0257a2da1 100644
--- a/node_modules/babel-code-frame/README.md
+++ b/node_modules/babel-code-frame/README.md
@@ -5,7 +5,7 @@
## Install
```sh
-$ npm install babel-code-frame
+npm install --save-dev babel-code-frame
```
## Usage
@@ -40,3 +40,4 @@ name | type | default | description
highlightCode | boolean | `false` | Syntax highlight the code as JavaScript for terminals
linesAbove | number | 2 | The number of lines to show above the error
linesBelow | number | 3 | The number of lines to show below the error
+forceColor | boolean | `false` | Forcibly syntax highlight the code as JavaScript (for non-terminals); overrides highlightCode
diff --git a/node_modules/babel-code-frame/lib/index.js b/node_modules/babel-code-frame/lib/index.js
index 54c838c3b..ff49b9082 100644
--- a/node_modules/babel-code-frame/lib/index.js
+++ b/node_modules/babel-code-frame/lib/index.js
@@ -3,15 +3,20 @@
exports.__esModule = true;
exports.default = function (rawLines, lineNumber, colNumber) {
- var opts = arguments.length <= 3 || arguments[3] === undefined ? {} : arguments[3];
+ var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
colNumber = Math.max(colNumber, 0);
- var highlighted = opts.highlightCode && _chalk2.default.supportsColor;
+ var highlighted = opts.highlightCode && _chalk2.default.supportsColor || opts.forceColor;
+ var chalk = _chalk2.default;
+ if (opts.forceColor) {
+ chalk = new _chalk2.default.constructor({ enabled: true });
+ }
var maybeHighlight = function maybeHighlight(chalkFn, string) {
return highlighted ? chalkFn(string) : string;
};
- if (highlighted) rawLines = highlight(rawLines);
+ var defs = getDefs(chalk);
+ if (highlighted) rawLines = highlight(defs, rawLines);
var linesAbove = opts.linesAbove || 2;
var linesBelow = opts.linesBelow || 3;
@@ -44,7 +49,7 @@ exports.default = function (rawLines, lineNumber, colNumber) {
}).join("\n");
if (highlighted) {
- return _chalk2.default.reset(frame);
+ return chalk.reset(frame);
} else {
return frame;
}
@@ -64,20 +69,22 @@ var _chalk2 = _interopRequireDefault(_chalk);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-var defs = {
- keyword: _chalk2.default.cyan,
- capitalized: _chalk2.default.yellow,
- jsx_tag: _chalk2.default.yellow,
- punctuator: _chalk2.default.yellow,
-
- number: _chalk2.default.magenta,
- string: _chalk2.default.green,
- regex: _chalk2.default.magenta,
- comment: _chalk2.default.grey,
- invalid: _chalk2.default.white.bgRed.bold,
- gutter: _chalk2.default.grey,
- marker: _chalk2.default.red.bold
-};
+function getDefs(chalk) {
+ return {
+ keyword: chalk.cyan,
+ capitalized: chalk.yellow,
+ jsx_tag: chalk.yellow,
+ punctuator: chalk.yellow,
+
+ number: chalk.magenta,
+ string: chalk.green,
+ regex: chalk.magenta,
+ comment: chalk.grey,
+ invalid: chalk.white.bgRed.bold,
+ gutter: chalk.grey,
+ marker: chalk.red.bold
+ };
+}
var NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
@@ -86,12 +93,11 @@ var JSX_TAG = /^[a-z][\w-]*$/i;
var BRACKET = /^[()\[\]{}]$/;
function getTokenType(match) {
- var _match$slice = match.slice(-2);
-
- var offset = _match$slice[0];
- var text = _match$slice[1];
+ var _match$slice = match.slice(-2),
+ offset = _match$slice[0],
+ text = _match$slice[1];
- var token = _jsTokens2.default.matchToToken(match);
+ var token = (0, _jsTokens.matchToToken)(match);
if (token.type === "name") {
if (_esutils2.default.keyword.isReservedWordES6(token.value)) {
@@ -114,7 +120,7 @@ function getTokenType(match) {
return token.type;
}
-function highlight(text) {
+function highlight(defs, text) {
return text.replace(_jsTokens2.default, function () {
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
diff --git a/node_modules/babel-code-frame/package.json b/node_modules/babel-code-frame/package.json
index 113ac80fb..692187128 100644
--- a/node_modules/babel-code-frame/package.json
+++ b/node_modules/babel-code-frame/package.json
@@ -1,6 +1,6 @@
{
"name": "babel-code-frame",
- "version": "6.16.0",
+ "version": "6.22.0",
"description": "Generate errors that contain a code frame that point to source locations.",
"author": "Sebastian McKenzie <sebmck@gmail.com>",
"homepage": "https://babeljs.io/",
@@ -10,6 +10,6 @@
"dependencies": {
"chalk": "^1.1.0",
"esutils": "^2.0.2",
- "js-tokens": "^2.0.0"
+ "js-tokens": "^3.0.0"
}
}