@xylabs/profile 5.1.2 → 5.1.4
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/neutral/index.mjs
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/profiler.ts"],
|
|
4
|
+
"sourcesContent": ["/** A record of named timing entries, where each key maps to an array of timestamps. */\nexport type Profiler = Record<string, number[]>\n\n/** Creates a new empty profiler instance. */\nexport const createProfiler = (): Profiler => {\n return {}\n}\n\n/**\n * Records a timestamp for the given profile name.\n * @param profiler - The profiler instance to record into.\n * @param name - The name of the timing entry.\n */\nexport const profile = (profiler: Profiler, name: string) => {\n const timeData = profiler[name] ?? []\n timeData.push(Date.now())\n profiler[name] = timeData\n}\n\n/**\n * Generates a report of elapsed times for each profiled entry.\n * @param profiler - The profiler instance to report on.\n * @returns A record mapping each profile name to its elapsed time in milliseconds, plus a '-all-' total.\n */\nexport const profileReport = (profiler: Profiler) => {\n let lowest = Date.now()\n let highest = 0\n // eslint-disable-next-line unicorn/no-array-reduce\n const results = Object.entries(profiler).reduce<Record<string, number>>((prev, [name, readings]) => {\n const start = readings.at(0)\n if (start !== undefined) {\n if (start < lowest) {\n lowest = start\n }\n const end = readings.at(-1) ?? Date.now()\n if (end > highest) {\n highest = end\n }\n prev[name] = end - start\n }\n return prev\n }, {})\n if (highest > 0) {\n results['-all-'] = highest - lowest\n }\n return results\n}\n"],
|
|
5
|
+
"mappings": ";AAIO,IAAM,iBAAiB,MAAgB;AAC5C,SAAO,CAAC;AACV;AAOO,IAAM,UAAU,CAAC,UAAoB,SAAiB;AAC3D,QAAM,WAAW,SAAS,IAAI,KAAK,CAAC;AACpC,WAAS,KAAK,KAAK,IAAI,CAAC;AACxB,WAAS,IAAI,IAAI;AACnB;AAOO,IAAM,gBAAgB,CAAC,aAAuB;AACnD,MAAI,SAAS,KAAK,IAAI;AACtB,MAAI,UAAU;AAEd,QAAM,UAAU,OAAO,QAAQ,QAAQ,EAAE,OAA+B,CAAC,MAAM,CAAC,MAAM,QAAQ,MAAM;AAClG,UAAM,QAAQ,SAAS,GAAG,CAAC;AAC3B,QAAI,UAAU,QAAW;AACvB,UAAI,QAAQ,QAAQ;AAClB,iBAAS;AAAA,MACX;AACA,YAAM,MAAM,SAAS,GAAG,EAAE,KAAK,KAAK,IAAI;AACxC,UAAI,MAAM,SAAS;AACjB,kBAAU;AAAA,MACZ;AACA,WAAK,IAAI,IAAI,MAAM;AAAA,IACrB;AACA,WAAO;AAAA,EACT,GAAG,CAAC,CAAC;AACL,MAAI,UAAU,GAAG;AACf,YAAQ,OAAO,IAAI,UAAU;AAAA,EAC/B;AACA,SAAO;AACT;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xylabs/profile",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.4",
|
|
4
4
|
"description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"profile",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"README.md"
|
|
43
43
|
],
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@xylabs/toolchain": "~
|
|
46
|
-
"@xylabs/tsconfig": "~
|
|
47
|
-
"eslint": "^10.
|
|
48
|
-
"typescript": "^
|
|
49
|
-
"vite": "^8.0.
|
|
50
|
-
"vitest": "^4.1.
|
|
45
|
+
"@xylabs/toolchain": "~8.0.8",
|
|
46
|
+
"@xylabs/tsconfig": "~8.0.8",
|
|
47
|
+
"eslint": "^10.4.0",
|
|
48
|
+
"typescript": "^6.0.3",
|
|
49
|
+
"vite": "^8.0.13",
|
|
50
|
+
"vitest": "^4.1.6"
|
|
51
51
|
},
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=18"
|