traceperf 0.2.0 → 1.3.0
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/README.md +612 -209
- package/dist/__tests__/helpers/console.d.ts +9 -0
- package/dist/__tests__/helpers/console.js +25 -0
- package/dist/__tests__/helpers/console.js.map +1 -0
- package/dist/auto.d.ts +30 -0
- package/dist/auto.js +91 -0
- package/dist/auto.js.map +1 -0
- package/dist/browser.d.ts +52 -144
- package/dist/browser.js +112 -439
- package/dist/browser.js.map +1 -1
- package/dist/cli.d.ts +68 -0
- package/dist/cli.js +528 -0
- package/dist/cli.js.map +1 -0
- package/dist/core/allocations.d.ts +38 -0
- package/dist/core/allocations.js +85 -0
- package/dist/core/allocations.js.map +1 -0
- package/dist/core/cpu-profile.d.ts +84 -0
- package/dist/core/cpu-profile.js +181 -0
- package/dist/core/cpu-profile.js.map +1 -0
- package/dist/core/env.d.ts +10 -0
- package/dist/core/env.js +40 -0
- package/dist/core/env.js.map +1 -0
- package/dist/core/event-loop.d.ts +30 -0
- package/dist/core/event-loop.js +43 -0
- package/dist/core/event-loop.js.map +1 -0
- package/dist/core/explain.d.ts +48 -0
- package/dist/core/explain.js +236 -0
- package/dist/core/explain.js.map +1 -0
- package/dist/core/exporters.d.ts +111 -0
- package/dist/core/exporters.js +236 -0
- package/dist/core/exporters.js.map +1 -0
- package/dist/core/index.d.ts +9 -3
- package/dist/core/index.js +9 -3
- package/dist/core/index.js.map +1 -1
- package/dist/core/optimized-performance-monitor.d.ts +180 -26
- package/dist/core/optimized-performance-monitor.js +687 -175
- package/dist/core/optimized-performance-monitor.js.map +1 -1
- package/dist/core/prometheus.d.ts +36 -0
- package/dist/core/prometheus.js +93 -0
- package/dist/core/prometheus.js.map +1 -0
- package/dist/core/records.d.ts +97 -0
- package/dist/core/records.js +87 -0
- package/dist/core/records.js.map +1 -0
- package/dist/core/stats.d.ts +45 -0
- package/dist/core/stats.js +136 -0
- package/dist/core/stats.js.map +1 -0
- package/dist/core/timeline.d.ts +28 -0
- package/dist/core/timeline.js +65 -0
- package/dist/core/timeline.js.map +1 -0
- package/dist/drivers.d.ts +51 -0
- package/dist/drivers.js +205 -0
- package/dist/drivers.js.map +1 -0
- package/dist/esm/auto.d.ts +30 -0
- package/dist/esm/auto.js +87 -0
- package/dist/esm/auto.js.map +1 -0
- package/dist/esm/browser.d.ts +52 -144
- package/dist/esm/browser.js +101 -445
- package/dist/esm/browser.js.map +1 -1
- package/dist/esm/cli.d.ts +68 -0
- package/dist/esm/cli.js +520 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/core/allocations.d.ts +38 -0
- package/dist/esm/core/allocations.js +82 -0
- package/dist/esm/core/allocations.js.map +1 -0
- package/dist/esm/core/cpu-profile.d.ts +84 -0
- package/dist/esm/core/cpu-profile.js +176 -0
- package/dist/esm/core/cpu-profile.js.map +1 -0
- package/dist/esm/core/env.d.ts +10 -0
- package/dist/esm/core/env.js +35 -0
- package/dist/esm/core/env.js.map +1 -0
- package/dist/esm/core/event-loop.d.ts +30 -0
- package/dist/esm/core/event-loop.js +40 -0
- package/dist/esm/core/event-loop.js.map +1 -0
- package/dist/esm/core/explain.d.ts +48 -0
- package/dist/esm/core/explain.js +232 -0
- package/dist/esm/core/explain.js.map +1 -0
- package/dist/esm/core/exporters.d.ts +111 -0
- package/dist/esm/core/exporters.js +229 -0
- package/dist/esm/core/exporters.js.map +1 -0
- package/dist/esm/core/index.d.ts +10 -4
- package/dist/esm/core/index.js +10 -4
- package/dist/esm/core/index.js.map +1 -1
- package/dist/esm/core/optimized-performance-monitor.d.ts +180 -26
- package/dist/esm/core/optimized-performance-monitor.js +685 -173
- package/dist/esm/core/optimized-performance-monitor.js.map +1 -1
- package/dist/esm/core/prometheus.d.ts +36 -0
- package/dist/esm/core/prometheus.js +89 -0
- package/dist/esm/core/prometheus.js.map +1 -0
- package/dist/esm/core/records.d.ts +97 -0
- package/dist/esm/core/records.js +82 -0
- package/dist/esm/core/records.js.map +1 -0
- package/dist/esm/core/stats.d.ts +45 -0
- package/dist/esm/core/stats.js +131 -0
- package/dist/esm/core/stats.js.map +1 -0
- package/dist/esm/core/timeline.d.ts +28 -0
- package/dist/esm/core/timeline.js +62 -0
- package/dist/esm/core/timeline.js.map +1 -0
- package/dist/esm/drivers.d.ts +51 -0
- package/dist/esm/drivers.js +197 -0
- package/dist/esm/drivers.js.map +1 -0
- package/dist/esm/index.d.ts +13 -5
- package/dist/esm/index.js +21 -17
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/instrument.d.ts +88 -0
- package/dist/esm/instrument.js +274 -0
- package/dist/esm/instrument.js.map +1 -0
- package/dist/esm/integrations.d.ts +70 -0
- package/dist/esm/integrations.js +197 -0
- package/dist/esm/integrations.js.map +1 -0
- package/dist/esm/node-builtins.d.ts +1 -0
- package/dist/esm/node-builtins.js +32 -0
- package/dist/esm/node-builtins.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/register.d.ts +20 -0
- package/dist/esm/register.js +98 -0
- package/dist/esm/register.js.map +1 -0
- package/dist/esm/report-html.d.ts +11 -0
- package/dist/esm/report-html.js +106 -0
- package/dist/esm/report-html.js.map +1 -0
- package/dist/esm/types/index.d.ts +4 -80
- package/dist/esm/types/index.js +1 -2
- package/dist/esm/types/index.js.map +1 -1
- package/dist/esm/types/options.d.ts +72 -0
- package/dist/esm/types/options.js +2 -0
- package/dist/esm/types/options.js.map +1 -0
- package/dist/esm/watch.d.ts +17 -0
- package/dist/esm/watch.js +87 -0
- package/dist/esm/watch.js.map +1 -0
- package/dist/index.d.ts +10 -2
- package/dist/index.js +26 -29
- package/dist/index.js.map +1 -1
- package/dist/instrument.d.ts +88 -0
- package/dist/instrument.js +282 -0
- package/dist/instrument.js.map +1 -0
- package/dist/integrations.d.ts +70 -0
- package/dist/integrations.js +205 -0
- package/dist/integrations.js.map +1 -0
- package/dist/node-builtins.d.ts +1 -0
- package/dist/node-builtins.js +67 -0
- package/dist/node-builtins.js.map +1 -0
- package/dist/register.d.ts +20 -0
- package/dist/register.js +103 -0
- package/dist/register.js.map +1 -0
- package/dist/report-html.d.ts +11 -0
- package/dist/report-html.js +109 -0
- package/dist/report-html.js.map +1 -0
- package/dist/traceperf.browser.js +1910 -0
- package/dist/traceperf.browser.min.js +6 -0
- package/dist/types/index.d.ts +4 -80
- package/dist/types/index.js +1 -2
- package/dist/types/index.js.map +1 -1
- package/dist/types/options.d.ts +72 -0
- package/dist/types/{config.js → options.js} +1 -1
- package/dist/types/options.js.map +1 -0
- package/dist/watch.d.ts +17 -0
- package/dist/watch.js +90 -0
- package/dist/watch.js.map +1 -0
- package/package.json +99 -19
- package/dist/core/config.d.ts +0 -77
- package/dist/core/config.js +0 -116
- package/dist/core/config.js.map +0 -1
- package/dist/core/constants.d.ts +0 -78
- package/dist/core/constants.js +0 -109
- package/dist/core/constants.js.map +0 -1
- package/dist/core/logger.d.ts +0 -97
- package/dist/core/logger.js +0 -186
- package/dist/core/logger.js.map +0 -1
- package/dist/esm/core/config.d.ts +0 -77
- package/dist/esm/core/config.js +0 -112
- package/dist/esm/core/config.js.map +0 -1
- package/dist/esm/core/constants.d.ts +0 -78
- package/dist/esm/core/constants.js +0 -106
- package/dist/esm/core/constants.js.map +0 -1
- package/dist/esm/core/logger.d.ts +0 -97
- package/dist/esm/core/logger.js +0 -182
- package/dist/esm/core/logger.js.map +0 -1
- package/dist/esm/formatters/ascii.d.ts +0 -52
- package/dist/esm/formatters/ascii.js +0 -100
- package/dist/esm/formatters/ascii.js.map +0 -1
- package/dist/esm/formatters/cli.d.ts +0 -50
- package/dist/esm/formatters/cli.js +0 -96
- package/dist/esm/formatters/cli.js.map +0 -1
- package/dist/esm/formatters/index.d.ts +0 -3
- package/dist/esm/formatters/index.js +0 -4
- package/dist/esm/formatters/index.js.map +0 -1
- package/dist/esm/formatters/json.d.ts +0 -45
- package/dist/esm/formatters/json.js +0 -85
- package/dist/esm/formatters/json.js.map +0 -1
- package/dist/esm/trackers/execution.d.ts +0 -101
- package/dist/esm/trackers/execution.js +0 -226
- package/dist/esm/trackers/execution.js.map +0 -1
- package/dist/esm/trackers/index.d.ts +0 -2
- package/dist/esm/trackers/index.js +0 -3
- package/dist/esm/trackers/index.js.map +0 -1
- package/dist/esm/trackers/performance.d.ts +0 -68
- package/dist/esm/trackers/performance.js +0 -112
- package/dist/esm/trackers/performance.js.map +0 -1
- package/dist/esm/types/config.d.ts +0 -142
- package/dist/esm/types/config.js +0 -2
- package/dist/esm/types/config.js.map +0 -1
- package/dist/esm/types/logger.d.ts +0 -147
- package/dist/esm/types/logger.js +0 -2
- package/dist/esm/types/logger.js.map +0 -1
- package/dist/esm/utils/colors.d.ts +0 -87
- package/dist/esm/utils/colors.js +0 -146
- package/dist/esm/utils/colors.js.map +0 -1
- package/dist/esm/utils/index.d.ts +0 -3
- package/dist/esm/utils/index.js +0 -4
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/proxy-tracker.d.ts +0 -68
- package/dist/esm/utils/proxy-tracker.js +0 -127
- package/dist/esm/utils/proxy-tracker.js.map +0 -1
- package/dist/esm/utils/stack.d.ts +0 -63
- package/dist/esm/utils/stack.js +0 -110
- package/dist/esm/utils/stack.js.map +0 -1
- package/dist/esm/utils/string.d.ts +0 -29
- package/dist/esm/utils/string.js +0 -45
- package/dist/esm/utils/string.js.map +0 -1
- package/dist/esm/utils/timing.d.ts +0 -65
- package/dist/esm/utils/timing.js +0 -99
- package/dist/esm/utils/timing.js.map +0 -1
- package/dist/formatters/ascii.d.ts +0 -52
- package/dist/formatters/ascii.js +0 -104
- package/dist/formatters/ascii.js.map +0 -1
- package/dist/formatters/cli.d.ts +0 -50
- package/dist/formatters/cli.js +0 -100
- package/dist/formatters/cli.js.map +0 -1
- package/dist/formatters/index.d.ts +0 -3
- package/dist/formatters/index.js +0 -20
- package/dist/formatters/index.js.map +0 -1
- package/dist/formatters/json.d.ts +0 -45
- package/dist/formatters/json.js +0 -89
- package/dist/formatters/json.js.map +0 -1
- package/dist/trackers/execution.d.ts +0 -101
- package/dist/trackers/execution.js +0 -230
- package/dist/trackers/execution.js.map +0 -1
- package/dist/trackers/index.d.ts +0 -2
- package/dist/trackers/index.js +0 -19
- package/dist/trackers/index.js.map +0 -1
- package/dist/trackers/performance.d.ts +0 -68
- package/dist/trackers/performance.js +0 -116
- package/dist/trackers/performance.js.map +0 -1
- package/dist/types/config.d.ts +0 -142
- package/dist/types/config.js.map +0 -1
- package/dist/types/logger.d.ts +0 -147
- package/dist/types/logger.js +0 -3
- package/dist/types/logger.js.map +0 -1
- package/dist/types.d.ts +0 -65
- package/dist/types.js +0 -6
- package/dist/types.js.map +0 -1
- package/dist/utils/colors.d.ts +0 -87
- package/dist/utils/colors.js +0 -160
- package/dist/utils/colors.js.map +0 -1
- package/dist/utils/index.d.ts +0 -3
- package/dist/utils/index.js +0 -20
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/proxy-tracker.d.ts +0 -68
- package/dist/utils/proxy-tracker.js +0 -131
- package/dist/utils/proxy-tracker.js.map +0 -1
- package/dist/utils/stack.d.ts +0 -63
- package/dist/utils/stack.js +0 -116
- package/dist/utils/stack.js.map +0 -1
- package/dist/utils/string.d.ts +0 -29
- package/dist/utils/string.js +0 -50
- package/dist/utils/string.js.map +0 -1
- package/dist/utils/timing.d.ts +0 -65
- package/dist/utils/timing.js +0 -106
- package/dist/utils/timing.js.map +0 -1
package/dist/utils/colors.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.colorize = colorize;
|
|
4
|
-
exports.bold = bold;
|
|
5
|
-
exports.dim = dim;
|
|
6
|
-
exports.underline = underline;
|
|
7
|
-
exports.red = red;
|
|
8
|
-
exports.green = green;
|
|
9
|
-
exports.yellow = yellow;
|
|
10
|
-
exports.blue = blue;
|
|
11
|
-
exports.magenta = magenta;
|
|
12
|
-
exports.cyan = cyan;
|
|
13
|
-
exports.gray = gray;
|
|
14
|
-
exports.supportsColor = supportsColor;
|
|
15
|
-
const constants_1 = require("../core/constants");
|
|
16
|
-
/**
|
|
17
|
-
* Utilities for working with terminal colors
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* Apply color to a string
|
|
21
|
-
*
|
|
22
|
-
* @param text - The text to colorize
|
|
23
|
-
* @param color - The color to apply
|
|
24
|
-
* @returns The colorized string
|
|
25
|
-
*/
|
|
26
|
-
function colorize(text, color) {
|
|
27
|
-
if (typeof supportsColor === 'function' ? !supportsColor() : false) {
|
|
28
|
-
return text;
|
|
29
|
-
}
|
|
30
|
-
return `${color}${text}${constants_1.COLORS.reset}`;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Apply bold formatting to a string
|
|
34
|
-
*
|
|
35
|
-
* @param text - The text to make bold
|
|
36
|
-
* @returns The bold string
|
|
37
|
-
*/
|
|
38
|
-
function bold(text) {
|
|
39
|
-
if (typeof supportsColor === 'function' ? !supportsColor() : false) {
|
|
40
|
-
return text;
|
|
41
|
-
}
|
|
42
|
-
return `${constants_1.COLORS.bright}${text}${constants_1.COLORS.reset}`;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Apply dim formatting to a string
|
|
46
|
-
*
|
|
47
|
-
* @param text - The text to make dim
|
|
48
|
-
* @returns The dim string
|
|
49
|
-
*/
|
|
50
|
-
function dim(text) {
|
|
51
|
-
if (typeof supportsColor === 'function' ? !supportsColor() : false) {
|
|
52
|
-
return text;
|
|
53
|
-
}
|
|
54
|
-
return `${constants_1.COLORS.dim}${text}${constants_1.COLORS.reset}`;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Apply underline formatting to a string
|
|
58
|
-
*
|
|
59
|
-
* @param text - The text to underline
|
|
60
|
-
* @returns The underlined string
|
|
61
|
-
*/
|
|
62
|
-
function underline(text) {
|
|
63
|
-
if (typeof supportsColor === 'function' ? !supportsColor() : false) {
|
|
64
|
-
return text;
|
|
65
|
-
}
|
|
66
|
-
return `${constants_1.COLORS.underscore}${text}${constants_1.COLORS.reset}`;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Apply red color to a string
|
|
70
|
-
*
|
|
71
|
-
* @param text - The text to colorize
|
|
72
|
-
* @returns The red string
|
|
73
|
-
*/
|
|
74
|
-
function red(text) {
|
|
75
|
-
return colorize(text, constants_1.COLORS.fg.red);
|
|
76
|
-
}
|
|
77
|
-
/**
|
|
78
|
-
* Apply green color to a string
|
|
79
|
-
*
|
|
80
|
-
* @param text - The text to colorize
|
|
81
|
-
* @returns The green string
|
|
82
|
-
*/
|
|
83
|
-
function green(text) {
|
|
84
|
-
return colorize(text, constants_1.COLORS.fg.green);
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* Apply yellow color to a string
|
|
88
|
-
*
|
|
89
|
-
* @param text - The text to colorize
|
|
90
|
-
* @returns The yellow string
|
|
91
|
-
*/
|
|
92
|
-
function yellow(text) {
|
|
93
|
-
return colorize(text, constants_1.COLORS.fg.yellow);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Apply blue color to a string
|
|
97
|
-
*
|
|
98
|
-
* @param text - The text to colorize
|
|
99
|
-
* @returns The blue string
|
|
100
|
-
*/
|
|
101
|
-
function blue(text) {
|
|
102
|
-
return colorize(text, constants_1.COLORS.fg.blue);
|
|
103
|
-
}
|
|
104
|
-
/**
|
|
105
|
-
* Apply magenta color to a string
|
|
106
|
-
*
|
|
107
|
-
* @param text - The text to colorize
|
|
108
|
-
* @returns The magenta string
|
|
109
|
-
*/
|
|
110
|
-
function magenta(text) {
|
|
111
|
-
return colorize(text, constants_1.COLORS.fg.magenta);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Apply cyan color to a string
|
|
115
|
-
*
|
|
116
|
-
* @param text - The text to colorize
|
|
117
|
-
* @returns The cyan string
|
|
118
|
-
*/
|
|
119
|
-
function cyan(text) {
|
|
120
|
-
return colorize(text, constants_1.COLORS.fg.cyan);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Apply gray color to a string
|
|
124
|
-
*
|
|
125
|
-
* @param text - The text to colorize
|
|
126
|
-
* @returns The gray string
|
|
127
|
-
*/
|
|
128
|
-
function gray(text) {
|
|
129
|
-
return colorize(text, constants_1.COLORS.fg.gray);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Check if terminal supports colors
|
|
133
|
-
*
|
|
134
|
-
* @returns Whether the terminal supports colors
|
|
135
|
-
*/
|
|
136
|
-
function supportsColor() {
|
|
137
|
-
if (process.env.FORCE_COLOR === '0') {
|
|
138
|
-
return false;
|
|
139
|
-
}
|
|
140
|
-
if (process.env.FORCE_COLOR) {
|
|
141
|
-
return true;
|
|
142
|
-
}
|
|
143
|
-
if (process.platform === 'win32') {
|
|
144
|
-
return true;
|
|
145
|
-
}
|
|
146
|
-
if ('CI' in process.env) {
|
|
147
|
-
return true;
|
|
148
|
-
}
|
|
149
|
-
if (process.env.COLORTERM) {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
if (process.env.TERM === 'dumb') {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
if (process.stdout.isTTY) {
|
|
156
|
-
return true;
|
|
157
|
-
}
|
|
158
|
-
return false;
|
|
159
|
-
}
|
|
160
|
-
//# sourceMappingURL=colors.js.map
|
package/dist/utils/colors.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/utils/colors.ts"],"names":[],"mappings":";;AAaA,4BAKC;AAQD,oBAKC;AAQD,kBAKC;AAQD,8BAKC;AAQD,kBAEC;AAQD,sBAEC;AAQD,wBAEC;AAQD,oBAEC;AAQD,0BAEC;AAQD,oBAEC;AAQD,oBAEC;AAOD,sCA8BC;AApKD,iDAA2C;AAE3C;;GAEG;AAEH;;;;;;GAMG;AACH,SAAgB,QAAQ,CA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O,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/utils/index.d.ts
DELETED
package/dist/utils/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./timing"), exports);
|
|
18
|
-
__exportStar(require("./stack"), exports);
|
|
19
|
-
__exportStar(require("./colors"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,0CAAwB;AACxB,2CAAyB"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Proxy-based function tracking utility
|
|
3
|
-
*
|
|
4
|
-
* This module provides utilities for automatically tracking nested function calls
|
|
5
|
-
* using JavaScript Proxies without modifying the original code structure.
|
|
6
|
-
*/
|
|
7
|
-
import { ITrackOptions } from '../types';
|
|
8
|
-
/**
|
|
9
|
-
* Interface for a function that can track other functions
|
|
10
|
-
*/
|
|
11
|
-
export interface ITrackFunction {
|
|
12
|
-
<T>(fn: () => T, options?: ITrackOptions): T;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* A tracking context that manages function tracking using proxies
|
|
16
|
-
*/
|
|
17
|
-
export declare class ProxyTracker {
|
|
18
|
-
private _trackFn;
|
|
19
|
-
private _originalFunctions;
|
|
20
|
-
private _trackedFunctions;
|
|
21
|
-
private _isEnabled;
|
|
22
|
-
/**
|
|
23
|
-
* Create a new ProxyTracker
|
|
24
|
-
*
|
|
25
|
-
* @param trackFn - The function to use for tracking
|
|
26
|
-
*/
|
|
27
|
-
constructor(trackFn: ITrackFunction);
|
|
28
|
-
/**
|
|
29
|
-
* Enable or disable tracking
|
|
30
|
-
*
|
|
31
|
-
* @param enabled - Whether tracking is enabled
|
|
32
|
-
*/
|
|
33
|
-
setEnabled(enabled: boolean): void;
|
|
34
|
-
/**
|
|
35
|
-
* Check if tracking is enabled
|
|
36
|
-
*
|
|
37
|
-
* @returns Whether tracking is enabled
|
|
38
|
-
*/
|
|
39
|
-
isEnabled(): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Make a function trackable
|
|
42
|
-
*
|
|
43
|
-
* @param fn - The function to make trackable
|
|
44
|
-
* @param name - The name to use for tracking
|
|
45
|
-
* @returns A tracked version of the function
|
|
46
|
-
*/
|
|
47
|
-
makeTrackable(fn: Function, name?: string): Function;
|
|
48
|
-
/**
|
|
49
|
-
* Create a proxy for an object to track all its methods
|
|
50
|
-
*
|
|
51
|
-
* @param obj - The object to proxy
|
|
52
|
-
* @param namespace - The namespace to use for tracking
|
|
53
|
-
* @returns A proxied version of the object
|
|
54
|
-
*/
|
|
55
|
-
createProxy<T extends object>(obj: T, namespace?: string): T;
|
|
56
|
-
/**
|
|
57
|
-
* Track a module's exports
|
|
58
|
-
*
|
|
59
|
-
* @param moduleExports - The module's exports
|
|
60
|
-
* @param namespace - The namespace to use for tracking
|
|
61
|
-
* @returns A proxied version of the module's exports
|
|
62
|
-
*/
|
|
63
|
-
trackModule<T extends object>(moduleExports: T, namespace: string): T;
|
|
64
|
-
/**
|
|
65
|
-
* Clear all tracked functions
|
|
66
|
-
*/
|
|
67
|
-
clear(): void;
|
|
68
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Proxy-based function tracking utility
|
|
4
|
-
*
|
|
5
|
-
* This module provides utilities for automatically tracking nested function calls
|
|
6
|
-
* using JavaScript Proxies without modifying the original code structure.
|
|
7
|
-
*/
|
|
8
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
-
exports.ProxyTracker = void 0;
|
|
10
|
-
/**
|
|
11
|
-
* A tracking context that manages function tracking using proxies
|
|
12
|
-
*/
|
|
13
|
-
class ProxyTracker {
|
|
14
|
-
/**
|
|
15
|
-
* Create a new ProxyTracker
|
|
16
|
-
*
|
|
17
|
-
* @param trackFn - The function to use for tracking
|
|
18
|
-
*/
|
|
19
|
-
constructor(trackFn) {
|
|
20
|
-
this._originalFunctions = new Map();
|
|
21
|
-
this._trackedFunctions = new Map();
|
|
22
|
-
this._isEnabled = true;
|
|
23
|
-
this._trackFn = trackFn;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Enable or disable tracking
|
|
27
|
-
*
|
|
28
|
-
* @param enabled - Whether tracking is enabled
|
|
29
|
-
*/
|
|
30
|
-
setEnabled(enabled) {
|
|
31
|
-
this._isEnabled = enabled;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Check if tracking is enabled
|
|
35
|
-
*
|
|
36
|
-
* @returns Whether tracking is enabled
|
|
37
|
-
*/
|
|
38
|
-
isEnabled() {
|
|
39
|
-
return this._isEnabled;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Make a function trackable
|
|
43
|
-
*
|
|
44
|
-
* @param fn - The function to make trackable
|
|
45
|
-
* @param name - The name to use for tracking
|
|
46
|
-
* @returns A tracked version of the function
|
|
47
|
-
*/
|
|
48
|
-
makeTrackable(fn, name) {
|
|
49
|
-
// If tracking is disabled, return the original function
|
|
50
|
-
if (!this._isEnabled) {
|
|
51
|
-
return fn;
|
|
52
|
-
}
|
|
53
|
-
// If we've already tracked this function, return the tracked version
|
|
54
|
-
if (this._trackedFunctions.has(fn)) {
|
|
55
|
-
return this._trackedFunctions.get(fn);
|
|
56
|
-
}
|
|
57
|
-
// Create a tracked version of the function
|
|
58
|
-
const self = this;
|
|
59
|
-
const trackedFn = function (...args) {
|
|
60
|
-
return self._trackFn(() => fn.apply(this, args), {
|
|
61
|
-
label: name || fn.name || 'anonymous'
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
// Store the tracked version
|
|
65
|
-
this._trackedFunctions.set(fn, trackedFn);
|
|
66
|
-
return trackedFn;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Create a proxy for an object to track all its methods
|
|
70
|
-
*
|
|
71
|
-
* @param obj - The object to proxy
|
|
72
|
-
* @param namespace - The namespace to use for tracking
|
|
73
|
-
* @returns A proxied version of the object
|
|
74
|
-
*/
|
|
75
|
-
createProxy(obj, namespace = '') {
|
|
76
|
-
// If tracking is disabled, return the original object
|
|
77
|
-
if (!this._isEnabled) {
|
|
78
|
-
return obj;
|
|
79
|
-
}
|
|
80
|
-
const self = this;
|
|
81
|
-
return new Proxy(obj, {
|
|
82
|
-
get(target, prop, receiver) {
|
|
83
|
-
const value = Reflect.get(target, prop, receiver);
|
|
84
|
-
// If the property is a function, make it trackable
|
|
85
|
-
if (typeof value === 'function' && prop !== 'constructor') {
|
|
86
|
-
const name = namespace
|
|
87
|
-
? `${namespace}.${String(prop)}`
|
|
88
|
-
: String(prop);
|
|
89
|
-
return self.makeTrackable(value, name);
|
|
90
|
-
}
|
|
91
|
-
// If the property is an object (but not a built-in), proxy it too
|
|
92
|
-
if (value &&
|
|
93
|
-
typeof value === 'object' &&
|
|
94
|
-
!Array.isArray(value) &&
|
|
95
|
-
Object.getPrototypeOf(value) === Object.prototype) {
|
|
96
|
-
const nestedNamespace = namespace
|
|
97
|
-
? `${namespace}.${String(prop)}`
|
|
98
|
-
: String(prop);
|
|
99
|
-
return self.createProxy(value, nestedNamespace);
|
|
100
|
-
}
|
|
101
|
-
return value;
|
|
102
|
-
},
|
|
103
|
-
apply(target, thisArg, args) {
|
|
104
|
-
// This handles the case when the proxy itself is called as a function
|
|
105
|
-
const name = namespace || target.name || 'anonymous';
|
|
106
|
-
return self._trackFn(() => Reflect.apply(target, thisArg, args), {
|
|
107
|
-
label: name
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Track a module's exports
|
|
114
|
-
*
|
|
115
|
-
* @param moduleExports - The module's exports
|
|
116
|
-
* @param namespace - The namespace to use for tracking
|
|
117
|
-
* @returns A proxied version of the module's exports
|
|
118
|
-
*/
|
|
119
|
-
trackModule(moduleExports, namespace) {
|
|
120
|
-
return this.createProxy(moduleExports, namespace);
|
|
121
|
-
}
|
|
122
|
-
/**
|
|
123
|
-
* Clear all tracked functions
|
|
124
|
-
*/
|
|
125
|
-
clear() {
|
|
126
|
-
this._trackedFunctions.clear();
|
|
127
|
-
this._originalFunctions.clear();
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
exports.ProxyTracker = ProxyTracker;
|
|
131
|
-
//# sourceMappingURL=prox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AK,CAAC,MAAW,EAAE,OAAY,EAAE,IAAW;gBAC1C,sEAAsE;gBACtE,MAAM,IAAI,GAAG,SAAS,IAAI,MAAM,CAAC,IAAI,IAAI,WAAW,CAAC;gBACrD,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE;oBAC/D,KAAK,EAAE,IAAI;iBACZ,CAAC,CAAC;YACL,CAAC;SACF,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACI,WAAW,CAAmB,aAAgB,EAAE,SAAiB;QACtE,OAAO,IAAI,CAAC,WAAW,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,CAAC;QAC/B,IAAI,CAAC,kBAAkB,CAAC,KAAK,EAAE,CAAC;IAClC,CAAC;CACF;AA1ID,oCA0IC"}
|
package/dist/utils/stack.d.ts
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utilities for managing call stacks and function tracking
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Extract the name of a function
|
|
6
|
-
*
|
|
7
|
-
* @param fn - The function to extract the name from
|
|
8
|
-
* @returns The function name or a placeholder if not available
|
|
9
|
-
*/
|
|
10
|
-
export declare function getFunctionName(fn: Function): string;
|
|
11
|
-
/**
|
|
12
|
-
* Get the current call stack
|
|
13
|
-
*
|
|
14
|
-
* @returns An array of function names in the call stack
|
|
15
|
-
*/
|
|
16
|
-
export declare function getCallStack(): string[];
|
|
17
|
-
/**
|
|
18
|
-
* CallStackManager - Manages a call stack for execution tracking
|
|
19
|
-
*/
|
|
20
|
-
export declare class CallStackManager {
|
|
21
|
-
private _stack;
|
|
22
|
-
/**
|
|
23
|
-
* Push a function name onto the call stack
|
|
24
|
-
*
|
|
25
|
-
* @param name - The function name
|
|
26
|
-
* @returns The current stack depth
|
|
27
|
-
*/
|
|
28
|
-
push(name: string): number;
|
|
29
|
-
/**
|
|
30
|
-
* Pop a function name from the call stack
|
|
31
|
-
*
|
|
32
|
-
* @returns The popped function name or undefined if the stack is empty
|
|
33
|
-
*/
|
|
34
|
-
pop(): string | undefined;
|
|
35
|
-
/**
|
|
36
|
-
* Get the current call stack
|
|
37
|
-
*
|
|
38
|
-
* @returns A copy of the current call stack
|
|
39
|
-
*/
|
|
40
|
-
getStack(): string[];
|
|
41
|
-
/**
|
|
42
|
-
* Get the current stack depth
|
|
43
|
-
*
|
|
44
|
-
* @returns The current stack depth
|
|
45
|
-
*/
|
|
46
|
-
getDepth(): number;
|
|
47
|
-
/**
|
|
48
|
-
* Clear the call stack
|
|
49
|
-
*/
|
|
50
|
-
clear(): void;
|
|
51
|
-
/**
|
|
52
|
-
* Get the current function name (top of the stack)
|
|
53
|
-
*
|
|
54
|
-
* @returns The current function name or undefined if the stack is empty
|
|
55
|
-
*/
|
|
56
|
-
getCurrentFunction(): string | undefined;
|
|
57
|
-
/**
|
|
58
|
-
* Get the parent function name
|
|
59
|
-
*
|
|
60
|
-
* @returns The parent function name or undefined if there is no parent
|
|
61
|
-
*/
|
|
62
|
-
getParentFunction(): string | undefined;
|
|
63
|
-
}
|
package/dist/utils/stack.js
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Utilities for managing call stacks and function tracking
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CallStackManager = void 0;
|
|
7
|
-
exports.getFunctionName = getFunctionName;
|
|
8
|
-
exports.getCallStack = getCallStack;
|
|
9
|
-
/**
|
|
10
|
-
* Extract the name of a function
|
|
11
|
-
*
|
|
12
|
-
* @param fn - The function to extract the name from
|
|
13
|
-
* @returns The function name or a placeholder if not available
|
|
14
|
-
*/
|
|
15
|
-
function getFunctionName(fn) {
|
|
16
|
-
if (fn.name) {
|
|
17
|
-
return fn.name;
|
|
18
|
-
}
|
|
19
|
-
// Try to extract name from function toString()
|
|
20
|
-
const fnStr = fn.toString();
|
|
21
|
-
const nameMatch = fnStr.match(/function\s+([^(]+)/);
|
|
22
|
-
if (nameMatch) {
|
|
23
|
-
return nameMatch[1].trim();
|
|
24
|
-
}
|
|
25
|
-
// For arrow functions or anonymous functions
|
|
26
|
-
const arrowMatch = fnStr.match(/^\s*(?:async\s+)?(?:\([^)]*\)|\w+)\s*=>/);
|
|
27
|
-
if (arrowMatch) {
|
|
28
|
-
return '<arrow function>';
|
|
29
|
-
}
|
|
30
|
-
return '<anonymous>';
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Get the current call stack
|
|
34
|
-
*
|
|
35
|
-
* @returns An array of function names in the call stack
|
|
36
|
-
*/
|
|
37
|
-
function getCallStack() {
|
|
38
|
-
const stack = new Error().stack;
|
|
39
|
-
if (!stack) {
|
|
40
|
-
return [];
|
|
41
|
-
}
|
|
42
|
-
// Parse the stack trace
|
|
43
|
-
return stack
|
|
44
|
-
.split('\n')
|
|
45
|
-
.slice(2) // Skip the Error and this function
|
|
46
|
-
.map(line => {
|
|
47
|
-
const match = line.match(/at\s+([^\s]+)/);
|
|
48
|
-
return match ? match[1] : line.trim();
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* CallStackManager - Manages a call stack for execution tracking
|
|
53
|
-
*/
|
|
54
|
-
class CallStackManager {
|
|
55
|
-
constructor() {
|
|
56
|
-
this._stack = [];
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Push a function name onto the call stack
|
|
60
|
-
*
|
|
61
|
-
* @param name - The function name
|
|
62
|
-
* @returns The current stack depth
|
|
63
|
-
*/
|
|
64
|
-
push(name) {
|
|
65
|
-
this._stack.push(name);
|
|
66
|
-
return this._stack.length;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Pop a function name from the call stack
|
|
70
|
-
*
|
|
71
|
-
* @returns The popped function name or undefined if the stack is empty
|
|
72
|
-
*/
|
|
73
|
-
pop() {
|
|
74
|
-
return this._stack.pop();
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* Get the current call stack
|
|
78
|
-
*
|
|
79
|
-
* @returns A copy of the current call stack
|
|
80
|
-
*/
|
|
81
|
-
getStack() {
|
|
82
|
-
return [...this._stack];
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Get the current stack depth
|
|
86
|
-
*
|
|
87
|
-
* @returns The current stack depth
|
|
88
|
-
*/
|
|
89
|
-
getDepth() {
|
|
90
|
-
return this._stack.length;
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Clear the call stack
|
|
94
|
-
*/
|
|
95
|
-
clear() {
|
|
96
|
-
this._stack = [];
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* Get the current function name (top of the stack)
|
|
100
|
-
*
|
|
101
|
-
* @returns The current function name or undefined if the stack is empty
|
|
102
|
-
*/
|
|
103
|
-
getCurrentFunction() {
|
|
104
|
-
return this._stack[this._stack.length - 1];
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Get the parent function name
|
|
108
|
-
*
|
|
109
|
-
* @returns The parent function name or undefined if there is no parent
|
|
110
|
-
*/
|
|
111
|
-
getParentFunction() {
|
|
112
|
-
return this._stack[this._stack.length - 2];
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
exports.CallStackManager = CallStackManager;
|
|
116
|
-
//# sourceMappingURL=stack.js.map
|
package/dist/utils/stack.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../src/utils/stack.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAQH,0CAmBC;AAOD,oCAcC;AA9CD;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,EAAY;IAC1C,IAAI,EAAE,C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C,MAAM,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,GAAG;QACR,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;IAC3B,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACb,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,KAAK;QACV,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACnB,CAAC;IAED;;;;OAIG;IACI,kBAAkB;QACvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC;IAED;;;;OAIG;IACI,iBAAiB;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC7C,CAAC;CACF;AAjED,4CAiEC"}
|
package/dist/utils/string.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* String utility functions
|
|
3
|
-
*/
|
|
4
|
-
/**
|
|
5
|
-
* Center a string with padding
|
|
6
|
-
*
|
|
7
|
-
* @param str - The string to center
|
|
8
|
-
* @param length - The total length of the returned string
|
|
9
|
-
* @param char - The character to use for padding (default: space)
|
|
10
|
-
* @returns The padded string
|
|
11
|
-
*/
|
|
12
|
-
export declare function padCenter(str: string, length: number, char?: string): string;
|
|
13
|
-
/**
|
|
14
|
-
* Truncate a string to a specified length and add ellipsis if needed
|
|
15
|
-
*
|
|
16
|
-
* @param str - The string to truncate
|
|
17
|
-
* @param maxLength - The maximum length allowed
|
|
18
|
-
* @returns The truncated string
|
|
19
|
-
*/
|
|
20
|
-
export declare function truncate(str: string, maxLength: number): string;
|
|
21
|
-
/**
|
|
22
|
-
* Ensure that the string is at least a certain length
|
|
23
|
-
*
|
|
24
|
-
* @param str - The string to pad
|
|
25
|
-
* @param length - The minimum length desired
|
|
26
|
-
* @param char - The character to use for padding (default: space)
|
|
27
|
-
* @returns The padded string
|
|
28
|
-
*/
|
|
29
|
-
export declare function padEnd(str: string, length: number, char?: string): string;
|
package/dist/utils/string.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* String utility functions
|
|
4
|
-
*/
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.padCenter = padCenter;
|
|
7
|
-
exports.truncate = truncate;
|
|
8
|
-
exports.padEnd = padEnd;
|
|
9
|
-
/**
|
|
10
|
-
* Center a string with padding
|
|
11
|
-
*
|
|
12
|
-
* @param str - The string to center
|
|
13
|
-
* @param length - The total length of the returned string
|
|
14
|
-
* @param char - The character to use for padding (default: space)
|
|
15
|
-
* @returns The padded string
|
|
16
|
-
*/
|
|
17
|
-
function padCenter(str, length, char = ' ') {
|
|
18
|
-
if (str.length >= length)
|
|
19
|
-
return str;
|
|
20
|
-
const leftPadding = Math.floor((length - str.length) / 2);
|
|
21
|
-
const rightPadding = length - str.length - leftPadding;
|
|
22
|
-
return char.repeat(leftPadding) + str + char.repeat(rightPadding);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Truncate a string to a specified length and add ellipsis if needed
|
|
26
|
-
*
|
|
27
|
-
* @param str - The string to truncate
|
|
28
|
-
* @param maxLength - The maximum length allowed
|
|
29
|
-
* @returns The truncated string
|
|
30
|
-
*/
|
|
31
|
-
function truncate(str, maxLength) {
|
|
32
|
-
if (str.length <= maxLength)
|
|
33
|
-
return str;
|
|
34
|
-
const ellipsis = '...';
|
|
35
|
-
return str.substring(0, maxLength - ellipsis.length) + ellipsis;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Ensure that the string is at least a certain length
|
|
39
|
-
*
|
|
40
|
-
* @param str - The string to pad
|
|
41
|
-
* @param length - The minimum length desired
|
|
42
|
-
* @param char - The character to use for padding (default: space)
|
|
43
|
-
* @returns The padded string
|
|
44
|
-
*/
|
|
45
|
-
function padEnd(str, length, char = ' ') {
|
|
46
|
-
if (str.length >= length)
|
|
47
|
-
return str;
|
|
48
|
-
return str + char.repeat(length - str.length);
|
|
49
|
-
}
|
|
50
|
-
//# sourceMappingURL=string.js.map
|
package/dist/utils/string.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"string.js","sourceRoot":"","sources":["../../src/utils/string.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAUH,8BAOC;AASD,4BAKC;AAUD,wBAIC;AA3CD;;;;;;;GAOG;AACH,SAAgB,SAAS,CAAC,GAAW,EAAE,MAAc,EAAE,OAAe,GAAG;IACvE,IAAI,GAAG,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,GAAG,CAAC;IAErC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,YAAY,GAAG,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC;IAEvD,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;AACpE,CAAC;AAED;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,GAAW,EAAE,SAAiB;IACrD,IAAI,GAAG,CAAC,MAAM,IAAI,SAAS;QAAE,OAAO,GAAG,CAAC;IAExC,MAAM,QAAQ,GAAG,KAAK,CAAC;IACvB,OAAO,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;AAClE,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,MAAM,CAAC,GAAW,EAAE,MAAc,EAAE,OAAe,GAAG;IACpE,IAAI,GAAG,CAAC,MAAM,IAAI,MAAM;QAAE,OAAO,GAAG,CAAC;IAErC,OAAO,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC;AAChD,CAAC"}
|