@gringow/gringow 0.1.2 → 0.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/README.md +313 -35
- package/dist/browser.d.mts +2 -1
- package/dist/browser.mjs +61 -4
- package/dist/config.d.mts +1 -0
- package/dist/config.mjs +5 -3
- package/dist/config.test.mjs +52 -67
- package/dist/constants/default-config.mjs +1 -0
- package/dist/{data/create-cache-id.d.mts → create-cache-id.d.mts} +2 -2
- package/dist/create-cache-id.mjs +54 -0
- package/dist/create-cache-id.test.d.mts +2 -0
- package/dist/create-cache-id.test.mjs +18464 -0
- package/dist/data/check-cache.d.mts +1 -1
- package/dist/data/check-cache.mjs +14 -7
- package/dist/data/clear-cache.mjs +14 -7
- package/dist/data/create-cache-dir.mjs +5 -3
- package/dist/data/delete-cache-item.d.mts +1 -1
- package/dist/data/delete-cache-item.mjs +14 -7
- package/dist/data/get-cache.mjs +5 -3
- package/dist/data/get-or-create-cache.d.mts +1 -1
- package/dist/data/get-or-create-cache.mjs +14 -7
- package/dist/data/md5.d.mts +13 -0
- package/dist/data/md5.mjs +47 -0
- package/dist/data/md5.test.d.mts +2 -0
- package/dist/data/md5.test.mjs +18457 -0
- package/dist/data/save-cache.d.mts +2 -2
- package/dist/data/save-cache.mjs +14 -7
- package/dist/data/write-cache-to-disk.d.mts +1 -1
- package/dist/data/write-cache-to-disk.mjs +14 -7
- package/dist/flat-template-string.test.mjs +10 -10
- package/dist/gringow.d.mts +1 -1
- package/dist/gringow.mjs +100 -35
- package/dist/index.d.mts +1 -1
- package/dist/index.mjs +100 -35
- package/dist/interpolate-template.d.mts +3 -0
- package/dist/interpolate-template.mjs +14 -0
- package/dist/io/anthropic/ask.mjs +5 -3
- package/dist/io/anthropic/commit-response.d.mts +1 -1
- package/dist/io/anthropic/index.d.mts +1 -1
- package/dist/io/anthropic/index.mjs +5 -3
- package/dist/io/anthropic/parse.d.mts +1 -1
- package/dist/io/ask-llm.d.mts +1 -1
- package/dist/io/ask-llm.mjs +38 -25
- package/dist/io/gemini/ask.mjs +38 -25
- package/dist/io/gemini/index.d.mts +1 -1
- package/dist/io/gemini/index.mjs +38 -25
- package/dist/io/gemini/parse.d.mts +1 -1
- package/dist/io/huggingface/ask.d.mts +1 -1
- package/dist/io/huggingface/ask.mjs +5 -3
- package/dist/io/huggingface/commit-response.d.mts +1 -1
- package/dist/io/huggingface/index.d.mts +1 -1
- package/dist/io/huggingface/index.mjs +5 -3
- package/dist/io/huggingface/parse.d.mts +1 -1
- package/dist/logger.test.mjs +10 -10
- package/dist/schemas/config.shcema.d.mts +5 -0
- package/dist/schemas/config.shcema.mjs +1 -0
- package/dist/types/index.d.mts +1 -1
- package/package.json +10 -10
- package/dist/data/create-cache-id.mjs +0 -10
package/dist/logger.test.mjs
CHANGED
|
@@ -1389,7 +1389,7 @@ var require_utils = __commonJS({
|
|
|
1389
1389
|
// ../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/index.js
|
|
1390
1390
|
var require_dist = __commonJS({
|
|
1391
1391
|
"../node_modules/.pnpm/expect-type@1.2.2/node_modules/expect-type/dist/index.js"(exports) {
|
|
1392
|
-
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m3, k2, k22) {
|
|
1392
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m3, k2, k22) {
|
|
1393
1393
|
if (k22 === void 0) k22 = k2;
|
|
1394
1394
|
var desc = Object.getOwnPropertyDescriptor(m3, k2);
|
|
1395
1395
|
if (!desc || ("get" in desc ? !m3.__esModule : desc.writable || desc.configurable)) {
|
|
@@ -1398,10 +1398,10 @@ var require_dist = __commonJS({
|
|
|
1398
1398
|
} };
|
|
1399
1399
|
}
|
|
1400
1400
|
Object.defineProperty(o, k22, desc);
|
|
1401
|
-
} : function(o, m3, k2, k22) {
|
|
1401
|
+
}) : (function(o, m3, k2, k22) {
|
|
1402
1402
|
if (k22 === void 0) k22 = k2;
|
|
1403
1403
|
o[k22] = m3[k2];
|
|
1404
|
-
});
|
|
1404
|
+
}));
|
|
1405
1405
|
var __exportStar = exports && exports.__exportStar || function(m3, exports2) {
|
|
1406
1406
|
for (var p4 in m3) if (p4 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p4)) __createBinding(exports2, m3, p4);
|
|
1407
1407
|
};
|
|
@@ -13257,7 +13257,7 @@ function afterEach(fn2, timeout) {
|
|
|
13257
13257
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
13258
13258
|
globalThis.performance ? globalThis.performance.now.bind(globalThis.performance) : Date.now;
|
|
13259
13259
|
|
|
13260
|
-
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.
|
|
13260
|
+
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.4_lightningcss@1.30.2_terser@5.44.1/node_modules/vitest/dist/chunks/utils.C8RiOc4B.js
|
|
13261
13261
|
var NAME_WORKER_STATE = "__vitest_worker__";
|
|
13262
13262
|
function getWorkerState() {
|
|
13263
13263
|
const workerState = globalThis[NAME_WORKER_STATE];
|
|
@@ -13317,7 +13317,7 @@ async function waitForImportsToResolve() {
|
|
|
13317
13317
|
await waitForImportsToResolve();
|
|
13318
13318
|
}
|
|
13319
13319
|
|
|
13320
|
-
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.
|
|
13320
|
+
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.4_lightningcss@1.30.2_terser@5.44.1/node_modules/vitest/dist/chunks/_commonjsHelpers.BFTU3MAI.js
|
|
13321
13321
|
var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
|
|
13322
13322
|
function getDefaultExportFromCjs2(x2) {
|
|
13323
13323
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
@@ -15351,7 +15351,7 @@ var SnapshotClient = class {
|
|
|
15351
15351
|
}
|
|
15352
15352
|
};
|
|
15353
15353
|
|
|
15354
|
-
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.
|
|
15354
|
+
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.4_lightningcss@1.30.2_terser@5.44.1/node_modules/vitest/dist/chunks/date.W2xKR2qe.js
|
|
15355
15355
|
var RealDate = Date;
|
|
15356
15356
|
var now2 = null;
|
|
15357
15357
|
var MockDate = class _MockDate extends RealDate {
|
|
@@ -15404,7 +15404,7 @@ function resetDate() {
|
|
|
15404
15404
|
globalThis.Date = RealDate;
|
|
15405
15405
|
}
|
|
15406
15406
|
|
|
15407
|
-
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.
|
|
15407
|
+
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.4_lightningcss@1.30.2_terser@5.44.1/node_modules/vitest/dist/chunks/vi.DgezovHB.js
|
|
15408
15408
|
var unsupported = [
|
|
15409
15409
|
// .poll is meant to retry matchers until they succeed, and
|
|
15410
15410
|
// snapshots will always succeed as long as the poll method doesn't thow an error
|
|
@@ -16233,7 +16233,7 @@ function requireTypeDetect() {
|
|
|
16233
16233
|
(function(module, exports) {
|
|
16234
16234
|
(function(global3, factory) {
|
|
16235
16235
|
module.exports = factory();
|
|
16236
|
-
})(typeDetect, function() {
|
|
16236
|
+
})(typeDetect, (function() {
|
|
16237
16237
|
var promiseExists = typeof Promise === "function";
|
|
16238
16238
|
var globalObject = typeof self === "object" ? self : commonjsGlobal;
|
|
16239
16239
|
var symbolExists = typeof Symbol !== "undefined";
|
|
@@ -16342,7 +16342,7 @@ function requireTypeDetect() {
|
|
|
16342
16342
|
return Object.prototype.toString.call(obj).slice(toStringLeftSliceLength, toStringRightSliceLength);
|
|
16343
16343
|
}
|
|
16344
16344
|
return typeDetect2;
|
|
16345
|
-
});
|
|
16345
|
+
}));
|
|
16346
16346
|
})(typeDetect$1);
|
|
16347
16347
|
return typeDetect$1.exports;
|
|
16348
16348
|
}
|
|
@@ -18136,7 +18136,7 @@ function getImporter(name) {
|
|
|
18136
18136
|
return stack?.file || "";
|
|
18137
18137
|
}
|
|
18138
18138
|
|
|
18139
|
-
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.
|
|
18139
|
+
// ../node_modules/.pnpm/vitest@2.1.9_@types+node@22.16.4_lightningcss@1.30.2_terser@5.44.1/node_modules/vitest/dist/index.js
|
|
18140
18140
|
__toESM(require_dist(), 1);
|
|
18141
18141
|
|
|
18142
18142
|
// src/logger.ts
|
|
@@ -38,6 +38,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
38
38
|
geminiApiKey?: string | undefined;
|
|
39
39
|
}>;
|
|
40
40
|
sourceLanguage: z.ZodString;
|
|
41
|
+
defaultLanguage: z.ZodString;
|
|
41
42
|
languages: z.ZodArray<z.ZodString, "many">;
|
|
42
43
|
llm: z.ZodObject<{
|
|
43
44
|
choice: z.ZodEnum<["gemini", "anthropic", "huggingface"]>;
|
|
@@ -89,6 +90,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
89
90
|
write?: boolean | undefined;
|
|
90
91
|
};
|
|
91
92
|
sourceLanguage: string;
|
|
93
|
+
defaultLanguage: string;
|
|
92
94
|
languages: string[];
|
|
93
95
|
llm: {
|
|
94
96
|
choice: "gemini" | "anthropic" | "huggingface";
|
|
@@ -119,6 +121,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
119
121
|
write?: boolean | undefined;
|
|
120
122
|
};
|
|
121
123
|
sourceLanguage: string;
|
|
124
|
+
defaultLanguage: string;
|
|
122
125
|
languages: string[];
|
|
123
126
|
llm: {
|
|
124
127
|
choice: "gemini" | "anthropic" | "huggingface";
|
|
@@ -149,6 +152,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
149
152
|
write?: boolean | undefined;
|
|
150
153
|
};
|
|
151
154
|
sourceLanguage: string;
|
|
155
|
+
defaultLanguage: string;
|
|
152
156
|
languages: string[];
|
|
153
157
|
llm: {
|
|
154
158
|
choice: "gemini" | "anthropic" | "huggingface";
|
|
@@ -179,6 +183,7 @@ declare const configSchema: z.ZodEffects<z.ZodObject<{
|
|
|
179
183
|
write?: boolean | undefined;
|
|
180
184
|
};
|
|
181
185
|
sourceLanguage: string;
|
|
186
|
+
defaultLanguage: string;
|
|
182
187
|
languages: string[];
|
|
183
188
|
llm: {
|
|
184
189
|
choice: "gemini" | "anthropic" | "huggingface";
|
package/dist/types/index.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import { GringowTranslation, GringowCacheItem } from '../index.mjs';
|
|
|
3
3
|
import { llmOptionsSchema } from '../schemas/config.shcema.mjs';
|
|
4
4
|
import '../config.mjs';
|
|
5
5
|
import '../constants/default-config.mjs';
|
|
6
|
+
import '../create-cache-id.mjs';
|
|
6
7
|
import '../data/clear-cache.mjs';
|
|
7
|
-
import '../data/create-cache-id.mjs';
|
|
8
8
|
import '../data/get-cache.mjs';
|
|
9
9
|
import '../flat-template-string.mjs';
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gringow/gringow",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"main": "./dist/index.
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"main": "./dist/index.mjs",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
|
-
"types": "./dist/index.d.
|
|
6
|
+
"types": "./dist/index.d.mts",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
-
"types": "./dist/index.d.
|
|
10
|
-
"require": "./dist/index.
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"require": "./dist/index.mjs",
|
|
11
11
|
"import": "./dist/index.mjs"
|
|
12
12
|
},
|
|
13
13
|
"./flat-template-string": {
|
|
14
|
-
"types": "./dist/flat-template-string.d.
|
|
15
|
-
"require": "./dist/flat-template-string.
|
|
14
|
+
"types": "./dist/flat-template-string.d.mts",
|
|
15
|
+
"require": "./dist/flat-template-string.mjs",
|
|
16
16
|
"import": "./dist/flat-template-string.mjs"
|
|
17
17
|
},
|
|
18
18
|
"./browser": {
|
|
19
|
-
"types": "./dist/browser.d.
|
|
20
|
-
"require": "./dist/browser.
|
|
19
|
+
"types": "./dist/browser.d.mts",
|
|
20
|
+
"require": "./dist/browser.mjs",
|
|
21
21
|
"import": "./dist/browser.mjs"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
@@ -70,8 +70,8 @@
|
|
|
70
70
|
"@google/generative-ai": "^0.24.1",
|
|
71
71
|
"@huggingface/transformers": "^3.6.3",
|
|
72
72
|
"@types/lodash.merge": "^4.6.9",
|
|
73
|
+
"@types/md5": "^2.3.6",
|
|
73
74
|
"cosmiconfig": "^9.0.0",
|
|
74
|
-
"crypto-js": "^4.2.0",
|
|
75
75
|
"lodash.merge": "^4.6.2",
|
|
76
76
|
"onnxruntime-node": "1.22.0-rev",
|
|
77
77
|
"zod": "^3.25.76"
|