@skmtc/core 0.0.720 → 0.0.721
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/esm/helpers/generationStats.d.ts +10 -0
- package/esm/helpers/generationStats.d.ts.map +1 -1
- package/esm/helpers/generationStats.js +6 -4
- package/package.json +1 -1
- package/script/helpers/generationStats.d.ts +10 -0
- package/script/helpers/generationStats.d.ts.map +1 -1
- package/script/helpers/generationStats.js +13 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
import type { ManifestContent } from '../types/Manifest.js';
|
|
3
|
+
import type { ResultsItem, ResultType } from '../types/Results.js';
|
|
3
4
|
type GenerationStatsArgs = {
|
|
4
5
|
manifest: ManifestContent;
|
|
5
6
|
artifacts: Record<string, string>;
|
|
@@ -9,8 +10,17 @@ export declare const toGenerationStats: ({ manifest, artifacts }: GenerationStat
|
|
|
9
10
|
lines: number;
|
|
10
11
|
totalTime: number;
|
|
11
12
|
errors: string[][];
|
|
13
|
+
files: number;
|
|
12
14
|
};
|
|
15
|
+
export declare const toManifestTokens: (artifacts: Record<string, string>) => number;
|
|
16
|
+
export declare const toManifestLines: (manifest: ManifestContent) => number;
|
|
13
17
|
export declare const toTotalTime: (manifest: ManifestContent) => number;
|
|
14
18
|
export declare const toManifestErrors: (results: ManifestContent["results"]) => string[][];
|
|
19
|
+
type CheckResultArgs = {
|
|
20
|
+
path: string[];
|
|
21
|
+
result: ResultsItem | (ResultsItem | null)[] | ResultType;
|
|
22
|
+
errors: string[][];
|
|
23
|
+
};
|
|
24
|
+
export declare const checkResult: ({ path, result, errors }: CheckResultArgs) => void;
|
|
15
25
|
export {};
|
|
16
26
|
//# sourceMappingURL=generationStats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generationStats.d.ts","sourceRoot":"","sources":["../../src/helpers/generationStats.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"generationStats.d.ts","sourceRoot":"","sources":["../../src/helpers/generationStats.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAIlE,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,eAAe,CAAA;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC,CAAA;AACD,eAAO,MAAM,iBAAiB,GAAI,yBAAyB,mBAAmB;;;;;;CAc7E,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAOjE,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,UAAU,eAAe,WAOxD,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,UAAU,eAAe,WAIpD,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,eAAe,CAAC,SAAS,CAAC,eAQnE,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,MAAM,EAAE,WAAW,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,GAAG,UAAU,CAAA;IACzD,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,0BAA0B,eAAe,SA0BpE,CAAA"}
|
|
@@ -6,18 +6,20 @@ export const toGenerationStats = ({ manifest, artifacts }) => {
|
|
|
6
6
|
const lines = toManifestLines(manifest);
|
|
7
7
|
const totalTime = toTotalTime(manifest);
|
|
8
8
|
const errors = toManifestErrors(manifest.results);
|
|
9
|
+
const files = Object.keys(artifacts).length;
|
|
9
10
|
return {
|
|
10
11
|
tokens,
|
|
11
12
|
lines,
|
|
12
13
|
totalTime,
|
|
13
|
-
errors
|
|
14
|
+
errors,
|
|
15
|
+
files
|
|
14
16
|
};
|
|
15
17
|
};
|
|
16
|
-
const toManifestTokens = (artifacts) => {
|
|
18
|
+
export const toManifestTokens = (artifacts) => {
|
|
17
19
|
const { tokens } = Object.values(artifacts).reduce((acc, artifact) => ({ tokens: acc.tokens + countTokens(artifact) }), { tokens: 0 });
|
|
18
20
|
return tokens;
|
|
19
21
|
};
|
|
20
|
-
const toManifestLines = (manifest) => {
|
|
22
|
+
export const toManifestLines = (manifest) => {
|
|
21
23
|
const { lines } = Object.values(manifest.files).reduce((acc, file) => ({ lines: acc.lines + file.lines }), { lines: 0 });
|
|
22
24
|
return lines;
|
|
23
25
|
};
|
|
@@ -32,7 +34,7 @@ export const toManifestErrors = (results) => {
|
|
|
32
34
|
});
|
|
33
35
|
return errors;
|
|
34
36
|
};
|
|
35
|
-
const checkResult = ({ path, result, errors }) => {
|
|
37
|
+
export const checkResult = ({ path, result, errors }) => {
|
|
36
38
|
match(result)
|
|
37
39
|
.with(P.array(), matchedResult => {
|
|
38
40
|
return matchedResult.map(item => {
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import "../_dnt.polyfills.js";
|
|
2
2
|
import type { ManifestContent } from '../types/Manifest.js';
|
|
3
|
+
import type { ResultsItem, ResultType } from '../types/Results.js';
|
|
3
4
|
type GenerationStatsArgs = {
|
|
4
5
|
manifest: ManifestContent;
|
|
5
6
|
artifacts: Record<string, string>;
|
|
@@ -9,8 +10,17 @@ export declare const toGenerationStats: ({ manifest, artifacts }: GenerationStat
|
|
|
9
10
|
lines: number;
|
|
10
11
|
totalTime: number;
|
|
11
12
|
errors: string[][];
|
|
13
|
+
files: number;
|
|
12
14
|
};
|
|
15
|
+
export declare const toManifestTokens: (artifacts: Record<string, string>) => number;
|
|
16
|
+
export declare const toManifestLines: (manifest: ManifestContent) => number;
|
|
13
17
|
export declare const toTotalTime: (manifest: ManifestContent) => number;
|
|
14
18
|
export declare const toManifestErrors: (results: ManifestContent["results"]) => string[][];
|
|
19
|
+
type CheckResultArgs = {
|
|
20
|
+
path: string[];
|
|
21
|
+
result: ResultsItem | (ResultsItem | null)[] | ResultType;
|
|
22
|
+
errors: string[][];
|
|
23
|
+
};
|
|
24
|
+
export declare const checkResult: ({ path, result, errors }: CheckResultArgs) => void;
|
|
15
25
|
export {};
|
|
16
26
|
//# sourceMappingURL=generationStats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generationStats.d.ts","sourceRoot":"","sources":["../../src/helpers/generationStats.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"generationStats.d.ts","sourceRoot":"","sources":["../../src/helpers/generationStats.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAIlE,KAAK,mBAAmB,GAAG;IACzB,QAAQ,EAAE,eAAe,CAAA;IACzB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAClC,CAAA;AACD,eAAO,MAAM,iBAAiB,GAAI,yBAAyB,mBAAmB;;;;;;CAc7E,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,WAAW,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAOjE,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,UAAU,eAAe,WAOxD,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,UAAU,eAAe,WAIpD,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,SAAS,eAAe,CAAC,SAAS,CAAC,eAQnE,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,IAAI,EAAE,MAAM,EAAE,CAAA;IACd,MAAM,EAAE,WAAW,GAAG,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,GAAG,UAAU,CAAA;IACzD,MAAM,EAAE,MAAM,EAAE,EAAE,CAAA;CACnB,CAAA;AAED,eAAO,MAAM,WAAW,GAAI,0BAA0B,eAAe,SA0BpE,CAAA"}
|
|
@@ -1,19 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toManifestErrors = exports.toTotalTime = exports.toGenerationStats = void 0;
|
|
3
|
+
exports.checkResult = exports.toManifestErrors = exports.toTotalTime = exports.toManifestLines = exports.toManifestTokens = exports.toGenerationStats = void 0;
|
|
4
4
|
require("../_dnt.polyfills.js");
|
|
5
5
|
const ts_pattern_1 = require("ts-pattern");
|
|
6
6
|
const gpt_tokenizer_1 = require("gpt-tokenizer");
|
|
7
7
|
const toGenerationStats = ({ manifest, artifacts }) => {
|
|
8
|
-
const tokens = toManifestTokens(artifacts);
|
|
9
|
-
const lines = toManifestLines(manifest);
|
|
8
|
+
const tokens = (0, exports.toManifestTokens)(artifacts);
|
|
9
|
+
const lines = (0, exports.toManifestLines)(manifest);
|
|
10
10
|
const totalTime = (0, exports.toTotalTime)(manifest);
|
|
11
11
|
const errors = (0, exports.toManifestErrors)(manifest.results);
|
|
12
|
+
const files = Object.keys(artifacts).length;
|
|
12
13
|
return {
|
|
13
14
|
tokens,
|
|
14
15
|
lines,
|
|
15
16
|
totalTime,
|
|
16
|
-
errors
|
|
17
|
+
errors,
|
|
18
|
+
files
|
|
17
19
|
};
|
|
18
20
|
};
|
|
19
21
|
exports.toGenerationStats = toGenerationStats;
|
|
@@ -21,10 +23,12 @@ const toManifestTokens = (artifacts) => {
|
|
|
21
23
|
const { tokens } = Object.values(artifacts).reduce((acc, artifact) => ({ tokens: acc.tokens + (0, gpt_tokenizer_1.countTokens)(artifact) }), { tokens: 0 });
|
|
22
24
|
return tokens;
|
|
23
25
|
};
|
|
26
|
+
exports.toManifestTokens = toManifestTokens;
|
|
24
27
|
const toManifestLines = (manifest) => {
|
|
25
28
|
const { lines } = Object.values(manifest.files).reduce((acc, file) => ({ lines: acc.lines + file.lines }), { lines: 0 });
|
|
26
29
|
return lines;
|
|
27
30
|
};
|
|
31
|
+
exports.toManifestLines = toManifestLines;
|
|
28
32
|
const toTotalTime = (manifest) => {
|
|
29
33
|
const totalTime = manifest.endAt - manifest.startAt;
|
|
30
34
|
return totalTime;
|
|
@@ -33,7 +37,7 @@ exports.toTotalTime = toTotalTime;
|
|
|
33
37
|
const toManifestErrors = (results) => {
|
|
34
38
|
const errors = [];
|
|
35
39
|
Object.entries(results).map(([path, result]) => {
|
|
36
|
-
return checkResult({ path: [path], result, errors });
|
|
40
|
+
return (0, exports.checkResult)({ path: [path], result, errors });
|
|
37
41
|
});
|
|
38
42
|
return errors;
|
|
39
43
|
};
|
|
@@ -43,7 +47,7 @@ const checkResult = ({ path, result, errors }) => {
|
|
|
43
47
|
.with(ts_pattern_1.P.array(), matchedResult => {
|
|
44
48
|
return matchedResult.map(item => {
|
|
45
49
|
if (item !== null) {
|
|
46
|
-
checkResult({ path, result: item, errors });
|
|
50
|
+
(0, exports.checkResult)({ path, result: item, errors });
|
|
47
51
|
}
|
|
48
52
|
});
|
|
49
53
|
})
|
|
@@ -53,12 +57,12 @@ const checkResult = ({ path, result, errors }) => {
|
|
|
53
57
|
}
|
|
54
58
|
})
|
|
55
59
|
.with(ts_pattern_1.P.nullish, matchedResult => {
|
|
56
|
-
return checkResult({ path, result: matchedResult, errors });
|
|
60
|
+
return (0, exports.checkResult)({ path, result: matchedResult, errors });
|
|
57
61
|
})
|
|
58
62
|
.otherwise(matched => {
|
|
59
63
|
if (typeof matched === 'object') {
|
|
60
64
|
return Object.entries(matched).map(([key, value]) => {
|
|
61
|
-
return checkResult({ path: [...path, key], result: value, errors });
|
|
65
|
+
return (0, exports.checkResult)({ path: [...path, key], result: value, errors });
|
|
62
66
|
});
|
|
63
67
|
}
|
|
64
68
|
else {
|
|
@@ -66,3 +70,4 @@ const checkResult = ({ path, result, errors }) => {
|
|
|
66
70
|
}
|
|
67
71
|
});
|
|
68
72
|
};
|
|
73
|
+
exports.checkResult = checkResult;
|