@nsshunt/stsutils 1.19.146 → 1.19.149
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.
- package/dist/index.cjs +10 -342
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +1 -335
- package/dist/index.mjs.map +1 -1
- package/dist/node.cjs +24 -0
- package/dist/node.cjs.map +1 -1
- package/dist/node.mjs +22 -1
- package/dist/node.mjs.map +1 -1
- package/dist/rolldown-runtime-VH7oDXx4.cjs +28 -0
- package/package.json +8 -3
- package/types/node.d.ts +1 -0
- package/types/node.d.ts.map +1 -1
- package/types/pidColours.d.ts +9 -0
- package/types/pidColours.d.ts.map +1 -0
package/dist/node.mjs
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { Chalk } from "chalk";
|
|
1
2
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
+
import winston from "winston";
|
|
2
4
|
//#region src/di-node.ts
|
|
3
5
|
var NodeInjectionContextStore = class {
|
|
4
6
|
storage = new AsyncLocalStorage();
|
|
@@ -10,6 +12,25 @@ var NodeInjectionContextStore = class {
|
|
|
10
12
|
}
|
|
11
13
|
};
|
|
12
14
|
//#endregion
|
|
13
|
-
|
|
15
|
+
//#region src/pidColours.ts
|
|
16
|
+
var PidColours = class PidColours {
|
|
17
|
+
static chalk = new Chalk({ level: 3 });
|
|
18
|
+
static pidColours = /* @__PURE__ */ new Map();
|
|
19
|
+
static randomChannel = () => Math.floor(80 + Math.random() * 176);
|
|
20
|
+
static getPidColour = (pid) => {
|
|
21
|
+
let colour = PidColours.pidColours.get(pid);
|
|
22
|
+
if (!colour) {
|
|
23
|
+
colour = PidColours.chalk.rgb(PidColours.randomChannel(), PidColours.randomChannel(), PidColours.randomChannel());
|
|
24
|
+
PidColours.pidColours.set(pid, colour);
|
|
25
|
+
}
|
|
26
|
+
return colour;
|
|
27
|
+
};
|
|
28
|
+
static pidFormat = winston.format((info) => {
|
|
29
|
+
info.message = `${PidColours.getPidColour(process.pid)(String(process.pid))} ${info.message}`;
|
|
30
|
+
return info;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
//#endregion
|
|
34
|
+
export { NodeInjectionContextStore, PidColours };
|
|
14
35
|
|
|
15
36
|
//# sourceMappingURL=node.mjs.map
|
package/dist/node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.mjs","names":[],"sources":["../src/di-node.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\n\nimport { Injector, InjectionContextStore } from \"./di.js\";\n\nexport class NodeInjectionContextStore implements InjectionContextStore {\n private readonly storage = new AsyncLocalStorage<Injector>();\n\n run<T>(injector: Injector, fn: () => T): T {\n return this.storage.run(injector, fn);\n }\n\n get(): Injector | undefined {\n return this.storage.getStore();\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.mjs","names":[],"sources":["../src/di-node.ts","../src/pidColours.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\n\nimport { Injector, InjectionContextStore } from \"./di.js\";\n\nexport class NodeInjectionContextStore implements InjectionContextStore {\n private readonly storage = new AsyncLocalStorage<Injector>();\n\n run<T>(injector: Injector, fn: () => T): T {\n return this.storage.run(injector, fn);\n }\n\n get(): Injector | undefined {\n return this.storage.getStore();\n }\n}\n","import winston from \"winston\";\nimport { Chalk } from \"chalk\";\n\nexport class PidColours {\n private static readonly chalk = new Chalk({ level: 3 });\n\n private static readonly pidColours = new Map<\n number,\n (text: string) => string\n >();\n\n private static readonly randomChannel = () =>\n Math.floor(80 + Math.random() * 176);\n\n private static getPidColour = (pid: number) => {\n let colour = PidColours.pidColours.get(pid);\n\n if (!colour) {\n colour = PidColours.chalk.rgb(\n PidColours.randomChannel(),\n PidColours.randomChannel(),\n PidColours.randomChannel()\n );\n\n PidColours.pidColours.set(pid, colour);\n }\n\n return colour;\n };\n\n static readonly pidFormat = winston.format((info) => {\n const colour = PidColours.getPidColour(process.pid);\n info.message = `${colour(String(process.pid))} ${info.message}`;\n return info;\n });\n}\n"],"mappings":";;;;AAIA,IAAa,4BAAb,MAAwE;CACpE,UAA2B,IAAI,kBAA4B;CAE3D,IAAO,UAAoB,IAAgB;EACvC,OAAO,KAAK,QAAQ,IAAI,UAAU,EAAE;CACxC;CAEA,MAA4B;EACxB,OAAO,KAAK,QAAQ,SAAS;CACjC;AACJ;;;ACXA,IAAa,aAAb,MAAa,WAAW;CACpB,OAAwB,QAAQ,IAAI,MAAM,EAAE,OAAO,EAAE,CAAC;CAEtD,OAAwB,6BAAa,IAAI,IAGvC;CAEF,OAAwB,sBACpB,KAAK,MAAM,KAAK,KAAK,OAAO,IAAI,GAAG;CAEvC,OAAe,gBAAgB,QAAgB;EAC3C,IAAI,SAAS,WAAW,WAAW,IAAI,GAAG;EAE1C,IAAI,CAAC,QAAQ;GACT,SAAS,WAAW,MAAM,IACtB,WAAW,cAAc,GACzB,WAAW,cAAc,GACzB,WAAW,cAAc,CAC7B;GAEA,WAAW,WAAW,IAAI,KAAK,MAAM;EACzC;EAEA,OAAO;CACX;CAEA,OAAgB,YAAY,QAAQ,QAAQ,SAAS;EAEjD,KAAK,UAAU,GADA,WAAW,aAAa,QAAQ,GAC7B,CAAA,CAAO,OAAO,QAAQ,GAAG,CAAC,EAAE,GAAG,KAAK;EACtD,OAAO;CACX,CAAC;AACL"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
//#endregion
|
|
23
|
+
Object.defineProperty(exports, "__toESM", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return __toESM;
|
|
27
|
+
}
|
|
28
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nsshunt/stsutils",
|
|
3
|
-
"version": "1.19.
|
|
3
|
+
"version": "1.19.149",
|
|
4
4
|
"description": "STS Utils",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -51,18 +51,23 @@
|
|
|
51
51
|
"build": "tsc && vite build",
|
|
52
52
|
"build2": "tsc"
|
|
53
53
|
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"chalk": "^5.0.0",
|
|
56
|
+
"winston": "^3.0.0"
|
|
57
|
+
},
|
|
54
58
|
"devDependencies": {
|
|
55
59
|
"@types/node": "^26.6.4",
|
|
56
60
|
"@typescript-eslint/eslint-plugin": "^8.71.0",
|
|
57
61
|
"@typescript-eslint/parser": "^8.71.0",
|
|
62
|
+
"chalk": "^5.6.2",
|
|
58
63
|
"eslint": "^10.11.0",
|
|
59
64
|
"globals": "^17.13.0",
|
|
60
65
|
"typescript": "^6.0.3",
|
|
61
66
|
"vite": "^8.3.2",
|
|
62
|
-
"vitest": "^5.0.3"
|
|
67
|
+
"vitest": "^5.0.3",
|
|
68
|
+
"winston": "^3.19.0"
|
|
63
69
|
},
|
|
64
70
|
"dependencies": {
|
|
65
|
-
"chalk": "^5.6.2",
|
|
66
71
|
"http-status-codes": "^2.3.0"
|
|
67
72
|
},
|
|
68
73
|
"packageManager": "yarn@4.13.0"
|
package/types/node.d.ts
CHANGED
package/types/node.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import winston from "winston";
|
|
2
|
+
export declare class PidColours {
|
|
3
|
+
private static readonly chalk;
|
|
4
|
+
private static readonly pidColours;
|
|
5
|
+
private static readonly randomChannel;
|
|
6
|
+
private static getPidColour;
|
|
7
|
+
static readonly pidFormat: winston.Logform.FormatWrap;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=pidColours.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pidColours.d.ts","sourceRoot":"","sources":["../src/pidColours.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAG9B,qBAAa,UAAU;IACnB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAA2B;IAExD,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAG9B;IAEJ,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CACI;IAEzC,OAAO,CAAC,MAAM,CAAC,YAAY,CAczB;IAEF,MAAM,CAAC,QAAQ,CAAC,SAAS,6BAItB;CACN"}
|