@anjianshi/utils 3.7.0 → 3.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { type ChalkInstance } from 'chalk';
1
2
  import { type LogInfo, LogHandler } from '../../logging/index.js';
2
3
  /**
3
4
  * 向 console 输出日志
@@ -23,10 +24,10 @@ export declare class ConsoleHandler extends LogHandler {
23
24
  };
24
25
  };
25
26
  static readonly levelColors: {
26
- 1: import("chalk").ChalkInstance;
27
- 2: import("chalk").ChalkInstance;
28
- 3: import("chalk").ChalkInstance;
29
- 4: import("chalk").ChalkInstance;
27
+ 1: ChalkInstance;
28
+ 2: ChalkInstance;
29
+ 3: ChalkInstance;
30
+ 4: ChalkInstance;
30
31
  };
31
32
  private static readonly loggerColors;
32
33
  private static readonly loggerColorMap;
@@ -29,10 +29,11 @@ export class ConsoleHandler extends LogHandler {
29
29
  [LogLevel.Error]: console.error.bind(console),
30
30
  };
31
31
  static levelColors = {
32
- [LogLevel.Debug]: chalk.whiteBright,
33
- [LogLevel.Info]: chalk.white,
34
- [LogLevel.Warning]: chalk.yellowBright,
35
- [LogLevel.Error]: chalk.redBright,
32
+ // 不明确把类型标记为 ChalkInstance 的话,生成出的 .d.ts 会有问题。
33
+ [LogLevel.Debug]: chalk.whiteBright, // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
34
+ [LogLevel.Info]: chalk.white, // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
35
+ [LogLevel.Warning]: chalk.yellowBright, // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
36
+ [LogLevel.Error]: chalk.redBright, // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion
36
37
  };
37
38
  // 可供 logger 选择的颜色
38
39
  static loggerColors = [
package/logging/adapt.js CHANGED
@@ -34,9 +34,6 @@ export function adaptDebugLib(debugLib, enable = '', logger) {
34
34
  logger ??= getLogger('3rd-library');
35
35
  debugLib.log = logger.debug.bind(logger);
36
36
  if (enable) {
37
- // 有些库(例如 prisma)重新实现了自己的 debug 库,且模仿 debug 也读取 DEBUG 环境变量。
38
- // 这里除了设置 debug 库,顺便也适配这些遵循 debug 库模式的自定义库。
39
- process.env.DEBUG = enable;
40
37
  debugLib.enable(enable);
41
38
  }
42
39
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anjianshi/utils",
3
- "version": "3.7.0",
3
+ "version": "3.7.1",
4
4
  "description": "Common JavaScript Utils",
5
5
  "homepage": "https://github.com/anjianshi/js-packages/utils",
6
6
  "bugs": {