New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@alita/chalk

Package Overview
Dependencies
Maintainers
5
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alita/chalk - npm Package Compare versions

Comparing version 1.0.1-rc.0 to 1.0.2

54

dist/index.js

@@ -13,2 +13,11 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });

@@ -22,3 +31,3 @@ // 随便写写,没经过什么思考,欢迎指正和重写

var color_1 = {
black: '#00000',
black: '#000000',
red: '#FF0000',

@@ -85,3 +94,19 @@ green: '#008000',

};
var createChalk_1 = function (name) { return function (str) {
var createChalk_1 = function (name) { return function () {
// @ts-ignore
var str = [];
for (
// @ts-ignore
var _i = 0;
// @ts-ignore
_i < arguments.length;
// @ts-ignore
_i++) {
// @ts-ignore
str[_i] = arguments[_i];
}
if (typeof str[0] === 'object') {
createlog_1(name).apply(void 0, add_1.apply(void 0, __spreadArray([colorUtils_1.bold(colorUtils_1[colorHash_1[name]]("[".concat(firstToUpperCase_1(name), "] ")))], str, false)));
return;
}
var strArr = str;

@@ -101,8 +126,19 @@ if (typeof str === 'string' || typeof str === 'number') {

Object.keys(color_1).forEach(function (key) {
colorUtils_1[key] = function (str) { return ["%c".concat(str), "color:".concat(color_1[key])]; };
colorUtils_1[key] = function (str) {
if (typeof str === 'string' || typeof str === 'number') {
return ["%c".concat(str), "color:".concat(color_1[key])];
}
for (var i = 1; i < str.length; i++) {
str[i] += ";color:".concat(color_1[key]);
}
return str;
};
colorUtils_1["bg".concat(firstToUpperCase_1(key))] = function (str) {
return [
"%c".concat(str),
"padding: 2px 4px; border-radius: 3px; color: ".concat(key === 'white' ? '#000' : '#fff', "; font-weight: bold; background:").concat(color_1[key], ";"),
];
if (typeof str === 'string' || typeof str === 'number') {
return ["%c".concat(str), "padding: 2px 4px; border-radius: 3px; color: ".concat(key === 'white' ? '#000' : '#fff', "; font-weight: bold; background:").concat(color_1[key], ";")];
}
for (var i = 1; i < str.length; i++) {
str[i] += ";padding: 2px 4px; border-radius: 3px; font-weight: bold; background:".concat(color_1[key], ";");
}
return str;
};

@@ -112,2 +148,6 @@ });

return createlog_1('log')("%c ".concat(title, " %c V").concat(version, " "), 'padding: 2px 1px; border-radius: 3px 0 0 3px; color: #fff; background: #606060; font-weight: bold;', 'padding: 2px 1px; border-radius: 0 3px 3px 0; color: #fff; background: #42c02e; font-weight: bold;');
}, image: function (img) {
if (!img)
return;
createlog_1('log')("%c ", "font-size: 1px;\npadding: 100px 100px;\nbackground-image: url(".concat(img, ");\nbackground-size: contain;\nbackground-repeat: no-repeat;\ncolor: transparent;"));
} });

@@ -114,0 +154,0 @@ }

55

package.json
{
"name": "@alita/chalk",
"version": "1.0.1-rc.0",
"description": "@alita/browser-chalk",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"compiled"
],
"repository": {
"type": "git",
"url": "https://github.com/alitajs/alita"
},
"authors": [
"xiaohuoni <xiaohuoni@gmail.com> (https://github.com/xiaohuoni)"
],
"license": "MIT",
"bugs": "https://github.com/alitajs/alita/issues",
"homepage": "https://github.com/alitajs/alita/tree/master/packages/chalk#readme",
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "pnpm tsc",
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
"dev": "pnpm build -- --watch"
},
"readme": "# @alita/chalk\n\nSee our website [alitajs](https://alitajs.com) for more information.\n\n## 开关\n\n通过全局的 alitadebug 开启,目的是为了已经部署上去的代码,也可以通过在控制台中设置变量开启。\n\n## 颜色值\n\n```ts\n const color: ColorProps = {\n black: '#00000',\n red: '#FF0000',\n green: '#008000',\n yellow: '#FFFF00',\n blue: '#0000FF',\n magenta: '#FF00FF',\n cyan: '#00FFFF',\n white: '#FFFFFF',\n };\n```\n\n使用如 `chalk.black()` 的 API 给控制台的文字上色,如 `chalk.black('黑色文字')`。\n返回值为一个数组\n\n```tsx\nconst black = [`%c黑色文字`,'color: #00000'];\n```\n\n## 打印方法\n\n```ts\n const colorHash: ColorHashProps = {\n log: 'black',\n wait: 'cyan',\n error: 'red',\n warn: 'yellow',\n ready: 'green',\n info: 'blue',\n event: 'magenta',\n debug: 'gray',\n };\n```\n\n使用封装好的打印方法,可以添加一个带颜色的前缀用来醒目的区分日志类型。\n\n`chalk.warn('警告')` 将会打印 `[Warn] 警告`\n\n## hello\n\n单独的 hello 方法用于打印版本号的场景\n\n如:`chalk.hello('Alita','3.0.0')`\n\n## add \n\n将两个有颜色的字拼接到一起,上述说过,有颜色的文字返回的是一个数组,所以不能简单的使用 `+` 进行拼接。\n\n如 `add(chalk.black('黑色文字'),chalk.red('红色文字'))`\n\n实际上是两个数组的拼接操作\n\n```ts\nconst black = [`%c黑色文字`,'color: #00000'];\nconst red = [`%c红色文字`,'color: #FF0000'];\n\n// black + add\n\nconst res = [`%c黑色文字%c红色文字`,'color: #00000','color: #FF0000'];\n```\n"
"name": "@alita/chalk",
"version": "1.0.2",
"description": "@alita/browser-chalk",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"dist",
"compiled"
],
"scripts": {
"build": "pnpm tsc",
"build:deps": "pnpm esno ../../scripts/bundleDeps.ts",
"dev": "pnpm build -- --watch"
},
"repository": {
"type": "git",
"url": "https://github.com/alitajs/alita"
},
"authors": [
"xiaohuoni <xiaohuoni@gmail.com> (https://github.com/xiaohuoni)"
],
"license": "MIT",
"bugs": "https://github.com/alitajs/alita/issues",
"homepage": "https://github.com/alitajs/alita/tree/master/packages/chalk#readme",
"publishConfig": {
"access": "public"
}
}

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc