@xylabs/profile 5.0.79 → 5.0.81

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xylabs/profile",
3
- "version": "5.0.79",
3
+ "version": "5.0.81",
4
4
  "description": "Base functionality used throughout XY Labs TypeScript/JavaScript libraries",
5
5
  "keywords": [
6
6
  "profile",
@@ -30,25 +30,23 @@
30
30
  "exports": {
31
31
  ".": {
32
32
  "types": "./dist/neutral/index.d.ts",
33
- "source": "./src/index.ts",
34
33
  "default": "./dist/neutral/index.mjs"
35
34
  },
36
35
  "./package.json": "./package.json"
37
36
  },
38
37
  "module": "./dist/neutral/index.mjs",
39
- "source": "./src/index.ts",
40
38
  "types": "./dist/neutral/index.d.ts",
41
39
  "files": [
42
40
  "dist",
43
- "src",
44
41
  "!**/*.bench.*",
45
42
  "!**/*.spec.*",
46
43
  "!**/*.test.*"
47
44
  ],
48
45
  "devDependencies": {
49
- "@xylabs/ts-scripts-yarn3": "~7.3.2",
50
- "@xylabs/tsconfig": "~7.3.2",
51
- "typescript": "~5.9.3"
46
+ "@xylabs/ts-scripts-yarn3": "~7.4.11",
47
+ "@xylabs/tsconfig": "~7.4.11",
48
+ "typescript": "~5.9.3",
49
+ "vitest": "^4.0.18"
52
50
  },
53
51
  "engines": {
54
52
  "node": ">=18"
package/src/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './profiler.ts'
package/src/profiler.ts DELETED
@@ -1,35 +0,0 @@
1
- export type Profiler = Record<string, number[]>
2
-
3
- export const createProfiler = (): Profiler => {
4
- return {}
5
- }
6
-
7
- export const profile = (profiler: Profiler, name: string) => {
8
- const timeData = profiler[name] ?? []
9
- timeData.push(Date.now())
10
- profiler[name] = timeData
11
- }
12
-
13
- export const profileReport = (profiler: Profiler) => {
14
- let lowest = Date.now()
15
- let highest = 0
16
- // eslint-disable-next-line unicorn/no-array-reduce
17
- const results = Object.entries(profiler).reduce<Record<string, number>>((prev, [name, readings]) => {
18
- const start = readings.at(0)
19
- if (start !== undefined) {
20
- if (start < lowest) {
21
- lowest = start
22
- }
23
- const end = readings.at(-1) ?? Date.now()
24
- if (end > highest) {
25
- highest = end
26
- }
27
- prev[name] = end - start
28
- }
29
- return prev
30
- }, {})
31
- if (highest > 0) {
32
- results['-all-'] = highest - lowest
33
- }
34
- return results
35
- }