@kirill.konshin/node 0.0.2
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/.ctirc +20 -0
- package/.turbo/turbo-build.log +20 -0
- package/.turbo/turbo-test.log +29 -0
- package/CHANGELOG.md +7 -0
- package/README.md +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/measure.d.ts +35 -0
- package/dist/measure.d.ts.map +1 -0
- package/dist/measure.js +60 -0
- package/dist/measure.js.map +1 -0
- package/dist/measure.test.d.ts +2 -0
- package/dist/measure.test.d.ts.map +1 -0
- package/package.json +44 -0
- package/src/index.ts +1 -0
- package/src/measure.test.ts +3 -0
- package/src/measure.ts +109 -0
- package/tsconfig.json +10 -0
- package/turbo.json +10 -0
- package/vite.config.ts +2 -0
package/.ctirc
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"options": [
|
|
3
|
+
{
|
|
4
|
+
"mode": "create",
|
|
5
|
+
"project": "tsconfig.json",
|
|
6
|
+
"include": "src/**/*.{ts,tsx}",
|
|
7
|
+
"exclude": [
|
|
8
|
+
"**/*.stories.*",
|
|
9
|
+
"**/*.test.*",
|
|
10
|
+
"**/*.fixture.*"
|
|
11
|
+
],
|
|
12
|
+
"startFrom": "src",
|
|
13
|
+
"backup": false,
|
|
14
|
+
"overwrite": true,
|
|
15
|
+
"generationStyle": "default-alias-named-star",
|
|
16
|
+
"output": "src",
|
|
17
|
+
"verbose": true
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
[36mvite v7.0.6 [32mbuilding SSR bundle for production...[36m[39m
|
|
2
|
+
- ctix 'create' mode start, ...
|
|
3
|
+
✔ /home/runner/work/utils/utils/packages/node/tsconfig.json loading complete!
|
|
4
|
+
✔ analysis export statements completed!
|
|
5
|
+
- build "index.ts" file start
|
|
6
|
+
- output file exists check, ...
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
✔ ctix 'create' mode complete!
|
|
10
|
+
transforming...
|
|
11
|
+
[32m✓[39m 2 modules transformed.
|
|
12
|
+
rendering chunks...
|
|
13
|
+
|
|
14
|
+
[vite:dts] Start generate declaration files...
|
|
15
|
+
[2mdist/[22m[36mindex.js [39m[1m[2m0.15 kB[22m[1m[22m[2m │ map: 0.09 kB[22m
|
|
16
|
+
[2mdist/[22m[36mmeasure.js [39m[1m[2m1.44 kB[22m[1m[22m[2m │ map: 4.08 kB[22m
|
|
17
|
+
[vite:dts] Declaration files built in 1514ms.
|
|
18
|
+
|
|
19
|
+
[32m✓ built in 4.72s[39m
|
|
20
|
+
Updated package.json with exports
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
- ctix 'create' mode start, ...
|
|
2
|
+
✔ /home/runner/work/utils/utils/packages/node/tsconfig.json loading complete!
|
|
3
|
+
✔ analysis export statements completed!
|
|
4
|
+
- build "index.ts" file start
|
|
5
|
+
- output file exists check, ...
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
✔ ctix 'create' mode complete!
|
|
9
|
+
|
|
10
|
+
[1m[46m RUN [49m[22m [36mv3.2.4 [39m[90m/home/runner/work/utils/utils/packages/node[39m
|
|
11
|
+
[2mCoverage enabled with [22m[33mv8[39m
|
|
12
|
+
|
|
13
|
+
[2m[90m↓[39m[22m src/measure.test.ts [2m([22m[2m1 test[22m[2m | [22m[33m1 skipped[39m[2m)[22m
|
|
14
|
+
|
|
15
|
+
[2m Test Files [22m [33m1 skipped[39m[90m (1)[39m
|
|
16
|
+
[2m Tests [22m [33m1 skipped[39m[90m (1)[39m
|
|
17
|
+
[2m Start at [22m 03:26:51
|
|
18
|
+
[2m Duration [22m 358ms[2m (transform 32ms, setup 0ms, collect 18ms, tests 0ms, environment 0ms, prepare 81ms)[22m
|
|
19
|
+
|
|
20
|
+
[34m % [39m[2mCoverage report from [22m[33mv8[39m
|
|
21
|
+
------------|---------|----------|---------|---------|-------------------
|
|
22
|
+
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
|
|
23
|
+
------------|---------|----------|---------|---------|-------------------
|
|
24
|
+
All files | 0 | 0 | 0 | 0 |
|
|
25
|
+
index.ts | 0 | 0 | 0 | 0 | 1
|
|
26
|
+
measure.ts | 0 | 0 | 0 | 0 | 1-109
|
|
27
|
+
------------|---------|----------|---------|---------|-------------------
|
|
28
|
+
Updated package.json with exports
|
|
29
|
+
Updated package.json with exports
|
package/CHANGELOG.md
ADDED
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { bold, magenta, cyan, yellow, red, green } from 'colors/safe';
|
|
2
|
+
export declare const colored: {
|
|
3
|
+
important: typeof bold;
|
|
4
|
+
subject: typeof magenta;
|
|
5
|
+
arg: typeof cyan;
|
|
6
|
+
sup: typeof yellow;
|
|
7
|
+
err: typeof red;
|
|
8
|
+
ok: typeof green;
|
|
9
|
+
};
|
|
10
|
+
export declare const uncolored: {
|
|
11
|
+
important: (str: any) => any;
|
|
12
|
+
subject: (str: any) => any;
|
|
13
|
+
arg: (str: any) => any;
|
|
14
|
+
sup: (str: any) => any;
|
|
15
|
+
err: (str: any) => any;
|
|
16
|
+
ok: (str: any) => any;
|
|
17
|
+
};
|
|
18
|
+
export declare function createMeasurer({ colors, prepend, padding, }: {
|
|
19
|
+
colors?: boolean;
|
|
20
|
+
prepend?: string;
|
|
21
|
+
padding?: number;
|
|
22
|
+
}): {
|
|
23
|
+
measure: (what: string, step: string, supplemental?: string, ...args: any[]) => {
|
|
24
|
+
done: (result?: string, ...args2: any[]) => void;
|
|
25
|
+
fail: (result?: string, ...args2: any[]) => void;
|
|
26
|
+
log: (...args2: any[]) => void;
|
|
27
|
+
};
|
|
28
|
+
important: (str: any) => any;
|
|
29
|
+
subject: (str: any) => any;
|
|
30
|
+
arg: (str: any) => any;
|
|
31
|
+
sup: (str: any) => any;
|
|
32
|
+
ok: (str: any) => any;
|
|
33
|
+
err: (str: any) => any;
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=measure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure.d.ts","sourceRoot":"","sources":["../src/measure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEtE,eAAO,MAAM,OAAO,EAAE;IAClB,SAAS,EAAE,OAAO,IAAI,CAAC;IACvB,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,GAAG,EAAE,OAAO,IAAI,CAAC;IACjB,GAAG,EAAE,OAAO,MAAM,CAAC;IACnB,GAAG,EAAE,OAAO,GAAG,CAAC;IAChB,EAAE,EAAE,OAAO,KAAK,CAAC;CAQpB,CAAC;AAIF,eAAO,MAAM,SAAS,EAAE;IACpB,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IAC7B,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IACvB,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IACvB,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IACvB,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;CAQzB,CAAC;AAEF,wBAAgB,cAAc,CAAC,EAC3B,MAAa,EACb,OAAe,EACf,OAAY,GACf,EAAE;IACC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG;IACA,OAAO,EAAE,CACL,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,YAAY,CAAC,EAAE,MAAM,EACrB,GAAG,IAAI,EAAE,GAAG,EAAE,KACb;QACD,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QACjD,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;QACjD,GAAG,EAAE,CAAC,GAAG,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,CAAC;KAClC,CAAC;IACF,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IAC7B,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IAC3B,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IACvB,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IACvB,EAAE,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;IACtB,GAAG,EAAE,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,CAAC;CAC1B,CA+CA"}
|
package/dist/measure.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { green, red, yellow, cyan, magenta, bold } from "colors/safe";
|
|
2
|
+
const colored = {
|
|
3
|
+
important: bold,
|
|
4
|
+
subject: magenta,
|
|
5
|
+
arg: cyan,
|
|
6
|
+
sup: yellow,
|
|
7
|
+
err: red,
|
|
8
|
+
ok: green
|
|
9
|
+
};
|
|
10
|
+
const noColor = (str) => str;
|
|
11
|
+
const uncolored = {
|
|
12
|
+
important: noColor,
|
|
13
|
+
subject: noColor,
|
|
14
|
+
arg: noColor,
|
|
15
|
+
sup: noColor,
|
|
16
|
+
err: noColor,
|
|
17
|
+
ok: noColor
|
|
18
|
+
};
|
|
19
|
+
function createMeasurer({
|
|
20
|
+
colors = true,
|
|
21
|
+
prepend = "LOG",
|
|
22
|
+
padding = 10
|
|
23
|
+
}) {
|
|
24
|
+
const { important, subject, arg, sup, ok, err } = colors ? colored : uncolored;
|
|
25
|
+
function measure(what, step, supplemental = "", ...args) {
|
|
26
|
+
const time = performance.now();
|
|
27
|
+
const prefix = [
|
|
28
|
+
prepend,
|
|
29
|
+
important(subject(what.substring(0, padding).padStart(padding, " "))),
|
|
30
|
+
arg(step),
|
|
31
|
+
sup(supplemental),
|
|
32
|
+
...args
|
|
33
|
+
];
|
|
34
|
+
const done = (result = ok("DONE"), ...args2) => {
|
|
35
|
+
console.log(
|
|
36
|
+
...[
|
|
37
|
+
...prefix,
|
|
38
|
+
important(result),
|
|
39
|
+
...args2,
|
|
40
|
+
"in",
|
|
41
|
+
important((performance.now() - time).toFixed(0)),
|
|
42
|
+
"ms"
|
|
43
|
+
].filter(Boolean)
|
|
44
|
+
);
|
|
45
|
+
console.groupEnd();
|
|
46
|
+
};
|
|
47
|
+
const fail = (result = err("FAIL"), ...args2) => done(result, ...args2);
|
|
48
|
+
const log = (...args2) => {
|
|
49
|
+
console.log(...prefix, ...args2);
|
|
50
|
+
};
|
|
51
|
+
return { done, fail, log };
|
|
52
|
+
}
|
|
53
|
+
return { measure, important, subject, arg, sup, ok, err };
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
colored,
|
|
57
|
+
createMeasurer,
|
|
58
|
+
uncolored
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=measure.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure.js","sources":["../src/measure.ts"],"sourcesContent":["import { bold, magenta, cyan, yellow, red, green } from 'colors/safe';\n\nexport const colored: {\n important: typeof bold;\n subject: typeof magenta;\n arg: typeof cyan;\n sup: typeof yellow;\n err: typeof red;\n ok: typeof green;\n} = {\n important: bold,\n subject: magenta,\n arg: cyan,\n sup: yellow,\n err: red,\n ok: green,\n};\n\nconst noColor = (str) => str;\n\nexport const uncolored: {\n important: (str: any) => any;\n subject: (str: any) => any;\n arg: (str: any) => any;\n sup: (str: any) => any;\n err: (str: any) => any;\n ok: (str: any) => any;\n} = {\n important: noColor,\n subject: noColor,\n arg: noColor,\n sup: noColor,\n err: noColor,\n ok: noColor,\n};\n\nexport function createMeasurer({\n colors = true,\n prepend = 'LOG',\n padding = 10,\n}: {\n colors?: boolean;\n prepend?: string;\n padding?: number;\n}): {\n measure: (\n what: string,\n step: string,\n supplemental?: string,\n ...args: any[]\n ) => {\n done: (result?: string, ...args2: any[]) => void;\n fail: (result?: string, ...args2: any[]) => void;\n log: (...args2: any[]) => void;\n };\n important: (str: any) => any;\n subject: (str: any) => any;\n arg: (str: any) => any;\n sup: (str: any) => any;\n ok: (str: any) => any;\n err: (str: any) => any;\n} {\n const { important, subject, arg, sup, ok, err } = colors ? colored : uncolored;\n\n function measure(\n what: string,\n step: string,\n supplemental: string = '',\n ...args: any[]\n ): {\n done: (result?: string, ...args2: any[]) => void;\n fail: (result?: string, ...args2: any[]) => void;\n log: (...args2: any[]) => void;\n } {\n const time = performance.now();\n\n const prefix = [\n prepend,\n important(subject(what.substring(0, padding).padStart(padding, ' '))),\n arg(step),\n sup(supplemental),\n ...args,\n ];\n\n const done = (result: string = ok('DONE'), ...args2: any[]): void => {\n console.log(\n ...[\n ...prefix,\n important(result),\n ...args2,\n 'in',\n important((performance.now() - time).toFixed(0)),\n 'ms',\n ].filter(Boolean),\n );\n console.groupEnd();\n };\n\n const fail = (result: string = err('FAIL'), ...args2: any[]): void => done(result, ...args2);\n\n const log = (...args2: any[]): void => {\n console.log(...prefix, ...args2);\n };\n\n return { done, fail, log };\n }\n\n return { measure, important, subject, arg, sup, ok, err };\n}\n"],"names":[],"mappings":";AAEO,MAAM,UAOT;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,EACT,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,IAAI;AACR;AAEA,MAAM,UAAU,CAAC,QAAQ;AAElB,MAAM,YAOT;AAAA,EACA,WAAW;AAAA,EACX,SAAS;AAAA,EACT,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,IAAI;AACR;AAEO,SAAS,eAAe;AAAA,EAC3B,SAAS;AAAA,EACT,UAAU;AAAA,EACV,UAAU;AACd,GAqBE;AACE,QAAM,EAAE,WAAW,SAAS,KAAK,KAAK,IAAI,IAAA,IAAQ,SAAS,UAAU;AAErE,WAAS,QACL,MACA,MACA,eAAuB,OACpB,MAKL;AACE,UAAM,OAAO,YAAY,IAAA;AAEzB,UAAM,SAAS;AAAA,MACX;AAAA,MACA,UAAU,QAAQ,KAAK,UAAU,GAAG,OAAO,EAAE,SAAS,SAAS,GAAG,CAAC,CAAC;AAAA,MACpE,IAAI,IAAI;AAAA,MACR,IAAI,YAAY;AAAA,MAChB,GAAG;AAAA,IAAA;AAGP,UAAM,OAAO,CAAC,SAAiB,GAAG,MAAM,MAAM,UAAuB;AACjE,cAAQ;AAAA,QACJ,GAAG;AAAA,UACC,GAAG;AAAA,UACH,UAAU,MAAM;AAAA,UAChB,GAAG;AAAA,UACH;AAAA,UACA,WAAW,YAAY,IAAA,IAAQ,MAAM,QAAQ,CAAC,CAAC;AAAA,UAC/C;AAAA,QAAA,EACF,OAAO,OAAO;AAAA,MAAA;AAEpB,cAAQ,SAAA;AAAA,IACZ;AAEA,UAAM,OAAO,CAAC,SAAiB,IAAI,MAAM,MAAM,UAAuB,KAAK,QAAQ,GAAG,KAAK;AAE3F,UAAM,MAAM,IAAI,UAAuB;AACnC,cAAQ,IAAI,GAAG,QAAQ,GAAG,KAAK;AAAA,IACnC;AAEA,WAAO,EAAE,MAAM,MAAM,IAAA;AAAA,EACzB;AAEA,SAAO,EAAE,SAAS,WAAW,SAAS,KAAK,KAAK,IAAI,IAAA;AACxD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"measure.test.d.ts","sourceRoot":"","sources":["../src/measure.test.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kirill.konshin/node",
|
|
3
|
+
"description": "Node Utilities",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"----- BUILD -----": "",
|
|
8
|
+
"clean": "rm -rf dist .tscache tsconfig.tsbuildinfo",
|
|
9
|
+
"build": "vite build",
|
|
10
|
+
"build:index": "ctix build",
|
|
11
|
+
"build:check-types": "attw --pack .",
|
|
12
|
+
"start": "yarn build --watch",
|
|
13
|
+
"wait": "wait-on ./dist/index.js",
|
|
14
|
+
"----- TEST -----": "",
|
|
15
|
+
"test": "vitest run --coverage",
|
|
16
|
+
"test:watch": "vitest watch --coverage",
|
|
17
|
+
"----- STORYBOOK -----": "",
|
|
18
|
+
"storybook:start": "storybook dev -p 6006",
|
|
19
|
+
"storybook:build": "storybook build"
|
|
20
|
+
},
|
|
21
|
+
"dependencies": {
|
|
22
|
+
"colors": "^1.4.0"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@kirill.konshin/utils-private": "*"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"author": "Kirill Konshin <kirill@konshin.org> (https://konshin.org)",
|
|
31
|
+
"license": "MIT",
|
|
32
|
+
"exports": {
|
|
33
|
+
".": {
|
|
34
|
+
"import": {
|
|
35
|
+
"import": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
"main": "./dist/index.js",
|
|
41
|
+
"module": "./dist/index.js",
|
|
42
|
+
"types": "./dist/index.d.ts",
|
|
43
|
+
"peerDependenciesMeta": {}
|
|
44
|
+
}
|
package/src/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './measure';
|
package/src/measure.ts
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { bold, magenta, cyan, yellow, red, green } from 'colors/safe';
|
|
2
|
+
|
|
3
|
+
export const colored: {
|
|
4
|
+
important: typeof bold;
|
|
5
|
+
subject: typeof magenta;
|
|
6
|
+
arg: typeof cyan;
|
|
7
|
+
sup: typeof yellow;
|
|
8
|
+
err: typeof red;
|
|
9
|
+
ok: typeof green;
|
|
10
|
+
} = {
|
|
11
|
+
important: bold,
|
|
12
|
+
subject: magenta,
|
|
13
|
+
arg: cyan,
|
|
14
|
+
sup: yellow,
|
|
15
|
+
err: red,
|
|
16
|
+
ok: green,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const noColor = (str) => str;
|
|
20
|
+
|
|
21
|
+
export const uncolored: {
|
|
22
|
+
important: (str: any) => any;
|
|
23
|
+
subject: (str: any) => any;
|
|
24
|
+
arg: (str: any) => any;
|
|
25
|
+
sup: (str: any) => any;
|
|
26
|
+
err: (str: any) => any;
|
|
27
|
+
ok: (str: any) => any;
|
|
28
|
+
} = {
|
|
29
|
+
important: noColor,
|
|
30
|
+
subject: noColor,
|
|
31
|
+
arg: noColor,
|
|
32
|
+
sup: noColor,
|
|
33
|
+
err: noColor,
|
|
34
|
+
ok: noColor,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export function createMeasurer({
|
|
38
|
+
colors = true,
|
|
39
|
+
prepend = 'LOG',
|
|
40
|
+
padding = 10,
|
|
41
|
+
}: {
|
|
42
|
+
colors?: boolean;
|
|
43
|
+
prepend?: string;
|
|
44
|
+
padding?: number;
|
|
45
|
+
}): {
|
|
46
|
+
measure: (
|
|
47
|
+
what: string,
|
|
48
|
+
step: string,
|
|
49
|
+
supplemental?: string,
|
|
50
|
+
...args: any[]
|
|
51
|
+
) => {
|
|
52
|
+
done: (result?: string, ...args2: any[]) => void;
|
|
53
|
+
fail: (result?: string, ...args2: any[]) => void;
|
|
54
|
+
log: (...args2: any[]) => void;
|
|
55
|
+
};
|
|
56
|
+
important: (str: any) => any;
|
|
57
|
+
subject: (str: any) => any;
|
|
58
|
+
arg: (str: any) => any;
|
|
59
|
+
sup: (str: any) => any;
|
|
60
|
+
ok: (str: any) => any;
|
|
61
|
+
err: (str: any) => any;
|
|
62
|
+
} {
|
|
63
|
+
const { important, subject, arg, sup, ok, err } = colors ? colored : uncolored;
|
|
64
|
+
|
|
65
|
+
function measure(
|
|
66
|
+
what: string,
|
|
67
|
+
step: string,
|
|
68
|
+
supplemental: string = '',
|
|
69
|
+
...args: any[]
|
|
70
|
+
): {
|
|
71
|
+
done: (result?: string, ...args2: any[]) => void;
|
|
72
|
+
fail: (result?: string, ...args2: any[]) => void;
|
|
73
|
+
log: (...args2: any[]) => void;
|
|
74
|
+
} {
|
|
75
|
+
const time = performance.now();
|
|
76
|
+
|
|
77
|
+
const prefix = [
|
|
78
|
+
prepend,
|
|
79
|
+
important(subject(what.substring(0, padding).padStart(padding, ' '))),
|
|
80
|
+
arg(step),
|
|
81
|
+
sup(supplemental),
|
|
82
|
+
...args,
|
|
83
|
+
];
|
|
84
|
+
|
|
85
|
+
const done = (result: string = ok('DONE'), ...args2: any[]): void => {
|
|
86
|
+
console.log(
|
|
87
|
+
...[
|
|
88
|
+
...prefix,
|
|
89
|
+
important(result),
|
|
90
|
+
...args2,
|
|
91
|
+
'in',
|
|
92
|
+
important((performance.now() - time).toFixed(0)),
|
|
93
|
+
'ms',
|
|
94
|
+
].filter(Boolean),
|
|
95
|
+
);
|
|
96
|
+
console.groupEnd();
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const fail = (result: string = err('FAIL'), ...args2: any[]): void => done(result, ...args2);
|
|
100
|
+
|
|
101
|
+
const log = (...args2: any[]): void => {
|
|
102
|
+
console.log(...prefix, ...args2);
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return { done, fail, log };
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return { measure, important, subject, arg, sup, ok, err };
|
|
109
|
+
}
|
package/tsconfig.json
ADDED
package/turbo.json
ADDED
package/vite.config.ts
ADDED