first
This commit is contained in:
22
node_modules/@babel/highlight/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/highlight/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
19
node_modules/@babel/highlight/README.md
generated
vendored
Normal file
19
node_modules/@babel/highlight/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# @babel/highlight
|
||||
|
||||
> Syntax highlight JavaScript strings for output in terminals.
|
||||
|
||||
See our website [@babel/highlight](https://babeljs.io/docs/babel-highlight) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/highlight
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/highlight --dev
|
||||
```
|
106
node_modules/@babel/highlight/lib/index.js
generated
vendored
Normal file
106
node_modules/@babel/highlight/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,106 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = highlight;
|
||||
exports.shouldHighlight = shouldHighlight;
|
||||
var _jsTokens = require("js-tokens");
|
||||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier");
|
||||
var _chalk2 = require("chalk");
|
||||
const chalk = _chalk2;
|
||||
const sometimesKeywords = new Set(["as", "async", "from", "get", "of", "set"]);
|
||||
function getDefs(chalk) {
|
||||
return {
|
||||
keyword: chalk.cyan,
|
||||
capitalized: chalk.yellow,
|
||||
jsxIdentifier: chalk.yellow,
|
||||
punctuator: chalk.yellow,
|
||||
number: chalk.magenta,
|
||||
string: chalk.green,
|
||||
regex: chalk.magenta,
|
||||
comment: chalk.grey,
|
||||
invalid: chalk.white.bgRed.bold
|
||||
};
|
||||
}
|
||||
const NEWLINE = /\r\n|[\n\r\u2028\u2029]/;
|
||||
const BRACKET = /^[()[\]{}]$/;
|
||||
let tokenize;
|
||||
{
|
||||
const JSX_TAG = /^[a-z][\w-]*$/i;
|
||||
const getTokenType = function (token, offset, text) {
|
||||
if (token.type === "name") {
|
||||
if ((0, _helperValidatorIdentifier.isKeyword)(token.value) || (0, _helperValidatorIdentifier.isStrictReservedWord)(token.value, true) || sometimesKeywords.has(token.value)) {
|
||||
return "keyword";
|
||||
}
|
||||
if (JSX_TAG.test(token.value) && (text[offset - 1] === "<" || text.slice(offset - 2, offset) == "</")) {
|
||||
return "jsxIdentifier";
|
||||
}
|
||||
if (token.value[0] !== token.value[0].toLowerCase()) {
|
||||
return "capitalized";
|
||||
}
|
||||
}
|
||||
if (token.type === "punctuator" && BRACKET.test(token.value)) {
|
||||
return "bracket";
|
||||
}
|
||||
if (token.type === "invalid" && (token.value === "@" || token.value === "#")) {
|
||||
return "punctuator";
|
||||
}
|
||||
return token.type;
|
||||
};
|
||||
tokenize = function* (text) {
|
||||
let match;
|
||||
while (match = _jsTokens.default.exec(text)) {
|
||||
const token = _jsTokens.matchToToken(match);
|
||||
yield {
|
||||
type: getTokenType(token, match.index, text),
|
||||
value: token.value
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
function highlightTokens(defs, text) {
|
||||
let highlighted = "";
|
||||
for (const {
|
||||
type,
|
||||
value
|
||||
} of tokenize(text)) {
|
||||
const colorize = defs[type];
|
||||
if (colorize) {
|
||||
highlighted += value.split(NEWLINE).map(str => colorize(str)).join("\n");
|
||||
} else {
|
||||
highlighted += value;
|
||||
}
|
||||
}
|
||||
return highlighted;
|
||||
}
|
||||
function shouldHighlight(options) {
|
||||
return !!chalk.supportsColor || options.forceColor;
|
||||
}
|
||||
let chalkWithForcedColor = undefined;
|
||||
function getChalk(forceColor) {
|
||||
if (forceColor) {
|
||||
var _chalkWithForcedColor;
|
||||
(_chalkWithForcedColor = chalkWithForcedColor) != null ? _chalkWithForcedColor : chalkWithForcedColor = new chalk.constructor({
|
||||
enabled: true,
|
||||
level: 1
|
||||
});
|
||||
return chalkWithForcedColor;
|
||||
}
|
||||
return chalk;
|
||||
}
|
||||
{
|
||||
{
|
||||
exports.getChalk = options => getChalk(options.forceColor);
|
||||
}
|
||||
}
|
||||
function highlight(code, options = {}) {
|
||||
if (code !== "" && shouldHighlight(options)) {
|
||||
const defs = getDefs(getChalk(options.forceColor));
|
||||
return highlightTokens(defs, code);
|
||||
} else {
|
||||
return code;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@babel/highlight/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/highlight/lib/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
62
node_modules/@babel/highlight/package.json
generated
vendored
Normal file
62
node_modules/@babel/highlight/package.json
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "@babel/highlight@^7.22.10",
|
||||
"_id": "@babel/highlight@7.22.10",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-78aUtVcT7MUscr0K5mIEnkwxPE0MaxkR5RxRwuHaQ+JuU5AmTPhY+do2mdzVTnIJJpyBglql2pehuBIWHug+WQ==",
|
||||
"_location": "/@babel/highlight",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/highlight@^7.22.10",
|
||||
"name": "@babel/highlight",
|
||||
"escapedName": "@babel%2fhighlight",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.22.10",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.22.10"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/code-frame",
|
||||
"/eslint/@babel/code-frame"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.10.tgz",
|
||||
"_shasum": "02a3f6d8c1cb4521b2fd0ab0da8f4739936137d7",
|
||||
"_spec": "@babel/highlight@^7.22.10",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\@babel\\code-frame",
|
||||
"author": {
|
||||
"name": "The Babel Team",
|
||||
"url": "https://babel.dev/team"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/helper-validator-identifier": "^7.22.5",
|
||||
"chalk": "^2.4.2",
|
||||
"js-tokens": "^4.0.0"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Syntax highlight JavaScript strings for output in terminals.",
|
||||
"devDependencies": {
|
||||
"strip-ansi": "^4.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-highlight",
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"name": "@babel/highlight",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-highlight"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"version": "7.22.10"
|
||||
}
|
Reference in New Issue
Block a user