This commit is contained in:
2022-07-18 02:50:52 +00:00
parent befd344ab0
commit 06181b34d6
8569 changed files with 818704 additions and 352705 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
> Generate errors that contain a code frame that point to source locations.
See our website [@babel/code-frame](https://babeljs.io/docs/en/next/babel-code-frame.html) for more information.
See our website [@babel/code-frame](https://babeljs.io/docs/en/babel-code-frame) for more information.
## Install
+6 -10
View File
@@ -6,11 +6,7 @@ Object.defineProperty(exports, "__esModule", {
exports.codeFrameColumns = codeFrameColumns;
exports.default = _default;
var _highlight = _interopRequireWildcard(require("@babel/highlight"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
var _highlight = require("@babel/highlight");
let deprecationWarningShown = false;
@@ -105,10 +101,10 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
const hasColumns = loc.start && typeof loc.start.column === "number";
const numberMaxWidth = String(end).length;
const highlightedLines = highlighted ? (0, _highlight.default)(rawLines, opts) : rawLines;
let frame = highlightedLines.split(NEWLINE).slice(start, end).map((line, index) => {
let frame = highlightedLines.split(NEWLINE, end).slice(start, end).map((line, index) => {
const number = start + 1 + index;
const paddedNumber = ` ${number}`.slice(-numberMaxWidth);
const gutter = ` ${paddedNumber} | `;
const gutter = ` ${paddedNumber} |`;
const hasMarker = markerLines[number];
const lastMarkerLine = !markerLines[number + 1];
@@ -118,16 +114,16 @@ function codeFrameColumns(rawLines, loc, opts = {}) {
if (Array.isArray(hasMarker)) {
const markerSpacing = line.slice(0, Math.max(hasMarker[0] - 1, 0)).replace(/[^\t]/g, " ");
const numberOfMarkers = hasMarker[1] || 1;
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
markerLine = ["\n ", maybeHighlight(defs.gutter, gutter.replace(/\d/g, " ")), " ", markerSpacing, maybeHighlight(defs.marker, "^").repeat(numberOfMarkers)].join("");
if (lastMarkerLine && opts.message) {
markerLine += " " + maybeHighlight(defs.message, opts.message);
}
}
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line, markerLine].join("");
return [maybeHighlight(defs.marker, ">"), maybeHighlight(defs.gutter, gutter), line.length > 0 ? ` ${line}` : "", markerLine].join("");
} else {
return ` ${maybeHighlight(defs.gutter, gutter)}${line}`;
return ` ${maybeHighlight(defs.gutter, gutter)}${line.length > 0 ? ` ${line}` : ""}`;
}
}).join("\n");
+23 -19
View File
@@ -1,26 +1,26 @@
{
"_args": [
[
"@babel/code-frame@7.10.4",
"/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series"
"@babel/code-frame@7.18.6",
"/home/node/nuxt"
]
],
"_from": "@babel/code-frame@7.10.4",
"_id": "@babel/code-frame@7.10.4",
"_from": "@babel/code-frame@7.18.6",
"_id": "@babel/code-frame@7.18.6",
"_inBundle": false,
"_integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
"_integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==",
"_location": "/@babel/code-frame",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "@babel/code-frame@7.10.4",
"raw": "@babel/code-frame@7.18.6",
"name": "@babel/code-frame",
"escapedName": "@babel%2fcode-frame",
"scope": "@babel",
"rawSpec": "7.10.4",
"rawSpec": "7.18.6",
"saveSpec": null,
"fetchSpec": "7.10.4"
"fetchSpec": "7.18.6"
},
"_requiredBy": [
"/@babel/core",
@@ -31,28 +31,31 @@
"/eslint-plugin-unicorn/parse-json",
"/fork-ts-checker-webpack-plugin"
],
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
"_spec": "7.10.4",
"_where": "/mnt/Foxconn/Digitalent/Deverloper/liff-push_2series",
"_resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz",
"_spec": "7.18.6",
"_where": "/home/node/nuxt",
"author": {
"name": "Sebastian McKenzie",
"email": "sebmck@gmail.com"
"name": "The Babel Team",
"url": "https://babel.dev/team"
},
"bugs": {
"url": "https://github.com/babel/babel/issues"
"url": "https://github.com/babel/babel/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen"
},
"dependencies": {
"@babel/highlight": "^7.10.4"
"@babel/highlight": "^7.18.6"
},
"description": "Generate errors that contain a code frame that point to source locations.",
"devDependencies": {
"@types/chalk": "^2.0.0",
"chalk": "^2.0.0",
"strip-ansi": "^4.0.0"
},
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
"homepage": "https://babeljs.io/",
"engines": {
"node": ">=6.9.0"
},
"homepage": "https://babel.dev/docs/en/next/babel-code-frame",
"license": "MIT",
"main": "lib/index.js",
"main": "./lib/index.js",
"name": "@babel/code-frame",
"publishConfig": {
"access": "public"
@@ -62,5 +65,6 @@
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-code-frame"
},
"version": "7.10.4"
"type": "commonjs",
"version": "7.18.6"
}