Socket
Socket
Sign inDemoInstall

kaven-utils

Package Overview
Dependencies
18
Maintainers
1
Versions
101
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.4.0 to 5.4.1

2

package.json
{
"name": "kaven-utils",
"version": "5.4.0",
"version": "5.4.1",
"description": "Utils for Node.js.",

@@ -5,0 +5,0 @@ "main": "index",

@@ -7,6 +7,6 @@ /********************************************************************

* @create: 2023-12-07 16:37:40.302
* @modify: 2023-12-07 16:37:40.302
* @version: 5.4.0
* @times: 1
* @lines: 6
* @modify: 2023-12-09 08:24:10.819
* @version: 5.4.1
* @times: 2
* @lines: 33
* @copyright: Copyright © 2023 Kaven. All Rights Reserved.

@@ -17,2 +17,11 @@ * @description: [description]

import { KavenLogger } from "./KavenLogger";
/**
* @since 5.4.0
* @version 2023-12-09
*/
export declare function EnableInternalLogger(logger?: KavenLogger): void;
/**
* @since 5.4.1
* @version 2023-12-09
*/
export declare function DisableInternalLogger(): void;

@@ -8,6 +8,6 @@ "use strict";

* @create: 2023-12-07 16:37:40.302
* @modify: 2023-12-07 16:37:40.302
* @version: 5.4.0
* @times: 1
* @lines: 6
* @modify: 2023-12-09 08:24:10.819
* @version: 5.4.1
* @times: 2
* @lines: 33
* @copyright: Copyright © 2023 Kaven. All Rights Reserved.

@@ -18,4 +18,8 @@ * @description: [description]

Object.defineProperty(exports, "__esModule", { value: true });
exports.EnableInternalLogger = void 0;
exports.DisableInternalLogger = exports.EnableInternalLogger = void 0;
const KavenLogger_1 = require("./KavenLogger");
/**
* @since 5.4.0
* @version 2023-12-09
*/
function EnableInternalLogger(logger) {

@@ -25,1 +29,9 @@ KavenLogger_1.KavenLogger.AddLogger("kaven-utils", logger !== null && logger !== void 0 ? logger : KavenLogger_1.KavenLogger.Default);

exports.EnableInternalLogger = EnableInternalLogger;
/**
* @since 5.4.1
* @version 2023-12-09
*/
function DisableInternalLogger() {
KavenLogger_1.KavenLogger.RemoveLogger("kaven-utils");
}
exports.DisableInternalLogger = DisableInternalLogger;

@@ -7,5 +7,5 @@ /********************************************************************

* @create: 2018-08-30 13:24:44.049
* @modify: 2023-12-07 10:59:05.581
* @version: 5.4.0
* @times: 85
* @modify: 2023-12-09 08:22:04.657
* @version: 5.4.1
* @times: 86
* @lines: 480

@@ -12,0 +12,0 @@ * @copyright: Copyright © 2018-2023 Kaven. All Rights Reserved.

@@ -8,5 +8,5 @@ "use strict";

* @create: 2018-08-30 13:24:44.049
* @modify: 2023-12-07 10:59:05.581
* @version: 5.4.0
* @times: 85
* @modify: 2023-12-09 08:22:04.657
* @version: 5.4.1
* @times: 86
* @lines: 480

@@ -34,2 +34,3 @@ * @copyright: Copyright © 2018-2023 Kaven. All Rights Reserved.

const node_url_1 = require("node:url");
const KavenLogger_1 = require("./KavenLogger");
const KavenUtility_FileSystem_1 = require("./KavenUtility.FileSystem");

@@ -60,6 +61,5 @@ const KavenUtility_Internal_1 = require("./KavenUtility.Internal");

const load = (file) => __awaiter(this, void 0, void 0, function* () {
var _a;
if ((0, node_fs_1.existsSync)(file)) {
const r = yield (0, KavenUtility_FileSystem_1.LoadJsonFile)(file);
(_a = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _a === void 0 ? void 0 : _a.Info(`Load config file: ${file}`);
KavenLogger_1.KavenLogger.Default.Info(`Load config file: ${file}`);
return r;

@@ -108,6 +108,5 @@ }

const load = (file) => {
var _a;
if ((0, node_fs_1.existsSync)(file)) {
const r = (0, KavenUtility_FileSystem_1.LoadJsonFileSync)(file);
(_a = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _a === void 0 ? void 0 : _a.Info(`Load config file: ${file}`);
KavenLogger_1.KavenLogger.Default.Info(`Load config file: ${file}`);
return r;

@@ -215,6 +214,6 @@ }

const log = new kaven_basic_1.KavenLog(list.join(", "), level).SetMessageContainsAnsiColor();
(_a = (logger !== null && logger !== void 0 ? logger : (0, KavenUtility_Internal_1.InternalLogger)())) === null || _a === void 0 ? void 0 : _a.Log(log);
(_a = (logger !== null && logger !== void 0 ? logger : KavenLogger_1.KavenLogger.Default)) === null || _a === void 0 ? void 0 : _a.Log(log);
}
catch (ex) {
(_b = (logger !== null && logger !== void 0 ? logger : (0, KavenUtility_Internal_1.InternalLogger)())) === null || _b === void 0 ? void 0 : _b.Error(ex);
(_b = (logger !== null && logger !== void 0 ? logger : KavenLogger_1.KavenLogger.Default)) === null || _b === void 0 ? void 0 : _b.Error(ex);
}

@@ -246,5 +245,4 @@ };

const h = (err, _, res, next) => {
var _a;
if (log) {
(_a = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _a === void 0 ? void 0 : _a.Error(err.stack);
KavenLogger_1.KavenLogger.Default.Error(err.stack);
}

@@ -289,3 +287,2 @@ if (redirectTo) {

const abort = () => {
var _a;
if (redirectTo !== undefined) {

@@ -303,3 +300,3 @@ if (status !== undefined) {

}
(_a = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _a === void 0 ? void 0 : _a.Warn("Invalid referer:", referer);
KavenLogger_1.KavenLogger.Default.Warn("Invalid referer:", referer);
res.sendStatus(status);

@@ -346,11 +343,9 @@ };

const shutdown = (signal, value) => {
var _a;
(_a = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _a === void 0 ? void 0 : _a.Warn("shutdown!");
KavenLogger_1.KavenLogger.Default.Warn("shutdown!");
server.close(() => __awaiter(this, void 0, void 0, function* () {
var _b, _c;
if (disposeBeforeShutdown) {
yield disposeBeforeShutdown();
}
(_b = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _b === void 0 ? void 0 : _b.Warn(`server stopped by ${signal} with value ${value}`);
yield ((_c = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _c === void 0 ? void 0 : _c.Stop());
KavenLogger_1.KavenLogger.Default.Warn(`server stopped by ${signal} with value ${value}`);
yield KavenLogger_1.KavenLogger.Default.Stop();
process.exit(128 + value);

@@ -362,4 +357,3 @@ }));

process.on(signal, () => {
var _a;
(_a = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _a === void 0 ? void 0 : _a.Warn(`process received a ${signal} signal`);
KavenLogger_1.KavenLogger.Default.Warn(`process received a ${signal} signal`);
shutdown(signal, signals[signal]);

@@ -407,6 +401,6 @@ });

server.listen(port, options.hostname, () => {
var _a, _b, _c;
(_a = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _a === void 0 ? void 0 : _a.Info(`App is running at ${(0, kaven_basic_1.AnsiTextBrightBlue)(url)} in ${(0, kaven_basic_1.AnsiTextBrightRed)((_b = options === null || options === void 0 ? void 0 : options.mode) !== null && _b !== void 0 ? _b : "unspecific")} mode`);
var _a;
KavenLogger_1.KavenLogger.Default.Info(`App is running at ${(0, kaven_basic_1.AnsiTextBrightBlue)(url)} in ${(0, kaven_basic_1.AnsiTextBrightRed)((_a = options === null || options === void 0 ? void 0 : options.mode) !== null && _a !== void 0 ? _a : "unspecific")} mode`);
if ((options === null || options === void 0 ? void 0 : options.mode) === kaven_basic_1.Strings_Development) {
(_c = (0, KavenUtility_Internal_1.InternalLogger)()) === null || _c === void 0 ? void 0 : _c.Info("Press CTRL-C to stop\n");
KavenLogger_1.KavenLogger.Default.Info("Press CTRL-C to stop\n");
}

@@ -413,0 +407,0 @@ });

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc