auto-translate-json-library 2.3.0 → 2.4.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/CHANGELOG.md +326 -0
- package/LICENSE +21 -0
- package/README.MD +56 -6
- package/build/src/bin/cli.js +235 -148
- package/build/src/deepl.js +2 -1
- package/build/src/format/json-handler.d.ts +15 -0
- package/build/src/format/json-handler.js +78 -3
- package/build/src/format/yaml-handler.d.ts +7 -0
- package/build/src/format/yaml-handler.js +89 -8
- package/build/src/index.d.ts +1 -1
- package/build/src/index.js +0 -169
- package/package.json +46 -34
- package/build/package.json +0 -167
- package/build/src/debug.d.ts +0 -1
- package/build/src/debug.js +0 -170
|
@@ -15,6 +15,13 @@ export declare class YamlHandler implements IFormatHandler {
|
|
|
15
15
|
private updateNestedValues;
|
|
16
16
|
private updateArrayValues;
|
|
17
17
|
private reconstructFromFlatStructure;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the set of flat keys that cannot be safely expanded into a nested
|
|
20
|
+
* structure because another key is a dot-boundary ancestor of them. Both
|
|
21
|
+
* sides of every such collision are returned so callers can preserve them as
|
|
22
|
+
* literal flat keys instead of splitting on ".".
|
|
23
|
+
*/
|
|
24
|
+
private findConflictingKeys;
|
|
18
25
|
private setNestedValue;
|
|
19
26
|
private parsePath;
|
|
20
27
|
private validateTranslatableContent;
|
|
@@ -20,10 +20,25 @@ export class YamlHandler {
|
|
|
20
20
|
}
|
|
21
21
|
parse(content) {
|
|
22
22
|
try {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
let parsed;
|
|
24
|
+
try {
|
|
25
|
+
parsed = yaml.load(content, {
|
|
26
|
+
// js-yaml 5 renamed DEFAULT_SCHEMA; CORE_SCHEMA is the loader default
|
|
27
|
+
// and rejects the YAML 1.1-only types we do not want to accept.
|
|
28
|
+
schema: yaml.CORE_SCHEMA,
|
|
29
|
+
json: false, // Allow YAML-specific features
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
catch (error) {
|
|
33
|
+
// js-yaml 5 throws for sources without a document node (empty,
|
|
34
|
+
// whitespace-only or comment-only input) where js-yaml 4 returned
|
|
35
|
+
// undefined. Surface the same friendly error as before.
|
|
36
|
+
if (error instanceof yaml.YAMLException &&
|
|
37
|
+
error.reason.startsWith("expected a document")) {
|
|
38
|
+
throw new Error("YAML file is empty or contains only null/undefined");
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
27
42
|
if (parsed === null || parsed === undefined) {
|
|
28
43
|
throw new Error("YAML file is empty or contains only null/undefined");
|
|
29
44
|
}
|
|
@@ -67,7 +82,9 @@ export class YamlHandler {
|
|
|
67
82
|
lineWidth: -1, // Disable line wrapping
|
|
68
83
|
noRefs: true, // Disable references
|
|
69
84
|
sortKeys: false, // Preserve key order
|
|
70
|
-
|
|
85
|
+
// js-yaml 5 renamed DEFAULT_SCHEMA; DUMP_SCHEMA quotes every value that
|
|
86
|
+
// any YAML 1.1/1.2 parser could read as a non-string type.
|
|
87
|
+
schema: yaml.DUMP_SCHEMA,
|
|
71
88
|
};
|
|
72
89
|
// Preserve formatting if requested
|
|
73
90
|
if (options?.preserveFormatting !== false) {
|
|
@@ -319,17 +336,61 @@ export class YamlHandler {
|
|
|
319
336
|
}
|
|
320
337
|
reconstructFromFlatStructure(flatData) {
|
|
321
338
|
const result = {};
|
|
322
|
-
|
|
323
|
-
|
|
339
|
+
const keys = Object.keys(flatData);
|
|
340
|
+
// Some flat keys contain literal dots and are ALSO dot-boundary prefixes of
|
|
341
|
+
// other flat keys (e.g. "a.b.c" and "a.b.c.d"). Such a set cannot be
|
|
342
|
+
// expressed as a nested tree: the shared path would have to be both a
|
|
343
|
+
// scalar leaf and a mapping at the same time. Splitting them blindly either
|
|
344
|
+
// crashes ("Cannot create property 'x' on string") or silently drops data.
|
|
345
|
+
// Keep the colliding keys as literal (flat) keys so the output is lossless.
|
|
346
|
+
const conflicting = this.findConflictingKeys(keys);
|
|
347
|
+
for (const key of keys) {
|
|
348
|
+
const value = flatData[key];
|
|
349
|
+
if (conflicting.has(key)) {
|
|
350
|
+
result[key] = value;
|
|
351
|
+
continue;
|
|
352
|
+
}
|
|
353
|
+
// If nesting still hits an unexpected collision (e.g. a mixed
|
|
354
|
+
// array/object shape), fall back to a literal key rather than throwing
|
|
355
|
+
// or losing the value.
|
|
356
|
+
if (!this.setNestedValue(result, key, value)) {
|
|
357
|
+
result[key] = value;
|
|
358
|
+
}
|
|
324
359
|
}
|
|
325
360
|
return result;
|
|
326
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Returns the set of flat keys that cannot be safely expanded into a nested
|
|
364
|
+
* structure because another key is a dot-boundary ancestor of them. Both
|
|
365
|
+
* sides of every such collision are returned so callers can preserve them as
|
|
366
|
+
* literal flat keys instead of splitting on ".".
|
|
367
|
+
*/
|
|
368
|
+
findConflictingKeys(keys) {
|
|
369
|
+
const conflicting = new Set();
|
|
370
|
+
const keySet = new Set(keys);
|
|
371
|
+
for (const key of keys) {
|
|
372
|
+
const segments = key.split(".");
|
|
373
|
+
let prefix = "";
|
|
374
|
+
for (let i = 0; i < segments.length - 1; i++) {
|
|
375
|
+
prefix = i === 0 ? segments[0] : `${prefix}.${segments[i]}`;
|
|
376
|
+
if (keySet.has(prefix)) {
|
|
377
|
+
conflicting.add(prefix);
|
|
378
|
+
conflicting.add(key);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return conflicting;
|
|
383
|
+
}
|
|
327
384
|
setNestedValue(obj, path, value) {
|
|
328
385
|
const keys = this.parsePath(path);
|
|
329
386
|
let current = obj;
|
|
330
387
|
for (let i = 0; i < keys.length - 1; i++) {
|
|
331
388
|
const key = keys[i];
|
|
332
389
|
if (key.isArray) {
|
|
390
|
+
if (current[key.name] !== undefined &&
|
|
391
|
+
!Array.isArray(current[key.name])) {
|
|
392
|
+
return false; // expected an array here, found something else
|
|
393
|
+
}
|
|
333
394
|
if (!Array.isArray(current[key.name])) {
|
|
334
395
|
current[key.name] = [];
|
|
335
396
|
}
|
|
@@ -341,9 +402,18 @@ export class YamlHandler {
|
|
|
341
402
|
: {};
|
|
342
403
|
current[key.name].push(defaultValue);
|
|
343
404
|
}
|
|
344
|
-
|
|
405
|
+
const next = current[key.name][key.index];
|
|
406
|
+
if (next === null || typeof next !== "object") {
|
|
407
|
+
return false; // slot already holds a scalar, cannot descend
|
|
408
|
+
}
|
|
409
|
+
current = next;
|
|
345
410
|
}
|
|
346
411
|
else {
|
|
412
|
+
const existing = current[key.name];
|
|
413
|
+
if (existing !== undefined &&
|
|
414
|
+
(typeof existing !== "object" || existing === null)) {
|
|
415
|
+
return false; // cannot descend into a scalar leaf
|
|
416
|
+
}
|
|
347
417
|
if (!(key.name in current)) {
|
|
348
418
|
current[key.name] = {};
|
|
349
419
|
}
|
|
@@ -352,6 +422,10 @@ export class YamlHandler {
|
|
|
352
422
|
}
|
|
353
423
|
const lastKey = keys[keys.length - 1];
|
|
354
424
|
if (lastKey.isArray) {
|
|
425
|
+
if (current[lastKey.name] !== undefined &&
|
|
426
|
+
!Array.isArray(current[lastKey.name])) {
|
|
427
|
+
return false;
|
|
428
|
+
}
|
|
355
429
|
if (!Array.isArray(current[lastKey.name])) {
|
|
356
430
|
current[lastKey.name] = [];
|
|
357
431
|
}
|
|
@@ -362,8 +436,15 @@ export class YamlHandler {
|
|
|
362
436
|
current[lastKey.name][lastKey.index] = value;
|
|
363
437
|
}
|
|
364
438
|
else {
|
|
439
|
+
const existing = current[lastKey.name];
|
|
440
|
+
if (existing !== undefined &&
|
|
441
|
+
typeof existing === "object" &&
|
|
442
|
+
existing !== null) {
|
|
443
|
+
return false; // would clobber a mapping/sequence with a scalar leaf
|
|
444
|
+
}
|
|
365
445
|
current[lastKey.name] = value;
|
|
366
446
|
}
|
|
447
|
+
return true;
|
|
367
448
|
}
|
|
368
449
|
parsePath(path) {
|
|
369
450
|
const parts = path.split(".");
|
package/build/src/index.d.ts
CHANGED
package/build/src/index.js
CHANGED
|
@@ -1,171 +1,2 @@
|
|
|
1
1
|
import { translate } from "./lib.js";
|
|
2
2
|
export { translate };
|
|
3
|
-
const config = {};
|
|
4
|
-
setDefaultConfiguration();
|
|
5
|
-
console.log(config);
|
|
6
|
-
try {
|
|
7
|
-
setConfigurationFromEnvironment();
|
|
8
|
-
}
|
|
9
|
-
catch (error) {
|
|
10
|
-
console.log(config);
|
|
11
|
-
console.log(error);
|
|
12
|
-
}
|
|
13
|
-
try {
|
|
14
|
-
setConfigurationFromCLI();
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
console.log(config);
|
|
18
|
-
console.log(error);
|
|
19
|
-
}
|
|
20
|
-
import { config as dotenvConfig } from "dotenv";
|
|
21
|
-
import minimist from "minimist";
|
|
22
|
-
function setConfigurationFromCLI() {
|
|
23
|
-
const argv = minimist(process.argv.slice(2));
|
|
24
|
-
if (argv === undefined) {
|
|
25
|
-
console.log("No arguments provided in CLI");
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
if (argv.mode === "file") {
|
|
29
|
-
config.mode = "file";
|
|
30
|
-
}
|
|
31
|
-
else if (argv.mode === "folder") {
|
|
32
|
-
config.mode = "folder";
|
|
33
|
-
}
|
|
34
|
-
if (argv.startDelimiter !== undefined) {
|
|
35
|
-
config.startDelimiter = argv.startDelimiter;
|
|
36
|
-
}
|
|
37
|
-
if (argv.endDelimiter !== undefined) {
|
|
38
|
-
config.endDelimiter = argv.endDelimiter;
|
|
39
|
-
}
|
|
40
|
-
if (argv.keepExtraTranslations === "keep") {
|
|
41
|
-
config.keepExtraTranslations = "keep";
|
|
42
|
-
}
|
|
43
|
-
else if (argv.keepExtraTranslations === "remove") {
|
|
44
|
-
config.keepExtraTranslations = "remove";
|
|
45
|
-
}
|
|
46
|
-
if (argv.keepTranslations === "keep") {
|
|
47
|
-
config.keepTranslations = "keep";
|
|
48
|
-
}
|
|
49
|
-
else if (argv.keepTranslations === "retranslate") {
|
|
50
|
-
config.keepTranslations = "retranslate";
|
|
51
|
-
}
|
|
52
|
-
if (argv.sourceLocale !== undefined) {
|
|
53
|
-
config.sourceLocale = argv.sourceLocale;
|
|
54
|
-
}
|
|
55
|
-
if (argv.ignorePrefix !== undefined) {
|
|
56
|
-
config.ignorePrefix = argv.ignorePrefix;
|
|
57
|
-
}
|
|
58
|
-
if (argv.pivotTranslation !== undefined) {
|
|
59
|
-
translate(argv.pivotTranslation, config);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
console.log(argv);
|
|
63
|
-
console.log("Please provide a pivot translation");
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
function setDefaultConfiguration() {
|
|
67
|
-
config.mode = "file";
|
|
68
|
-
config.startDelimiter = "{";
|
|
69
|
-
config.endDelimiter = "}";
|
|
70
|
-
config.keepExtraTranslations = "keep";
|
|
71
|
-
config.keepTranslations = "keep";
|
|
72
|
-
config.sourceLocale = "en";
|
|
73
|
-
config.ignorePrefix = "";
|
|
74
|
-
}
|
|
75
|
-
function setConfigurationFromEnvironment() {
|
|
76
|
-
dotenvConfig();
|
|
77
|
-
if (process.env.ATJ_GOOGLE_API_KEY) {
|
|
78
|
-
config.translationKeyInfo = {
|
|
79
|
-
kind: "google",
|
|
80
|
-
apiKey: process.env.ATJ_GOOGLE_API_KEY,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
if (process.env.ATJ_AWS_ACCESS_KEY_ID &&
|
|
84
|
-
process.env.ATJ_AWS_SECRET_ACCESS_KEY &&
|
|
85
|
-
process.env.ATJ_AWS_REGION) {
|
|
86
|
-
config.translationKeyInfo = {
|
|
87
|
-
kind: "aws",
|
|
88
|
-
accessKeyId: process.env.ATJ_AWS_ACCESS_KEY_ID,
|
|
89
|
-
secretAccessKey: process.env.ATJ_AWS_SECRET_ACCESS_KEY,
|
|
90
|
-
region: process.env.ATJ_AWS_REGION,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
if (process.env.ATJ_AZURE_SECRET_KEY && process.env.ATJ_AZURE_REGION) {
|
|
94
|
-
config.translationKeyInfo = {
|
|
95
|
-
kind: "azure",
|
|
96
|
-
secretKey: process.env.ATJ_AZURE_SECRET_KEY,
|
|
97
|
-
region: process.env.ATJ_AZURE_REGION,
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
if (process.env.ATJ_DEEPL_PRO_SECRET_KEY) {
|
|
101
|
-
config.translationKeyInfo = {
|
|
102
|
-
kind: "deepLPro",
|
|
103
|
-
secretKey: process.env.ATJ_DEEPL_PRO_SECRET_KEY,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
if (process.env.ATJ_DEEPL_FREE_SECRET_KEY) {
|
|
107
|
-
config.translationKeyInfo = {
|
|
108
|
-
kind: "deepLFree",
|
|
109
|
-
secretKey: process.env.ATJ_DEEPL_FREE_SECRET_KEY,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
if (process.env.ATJ_OPEN_AI_SECRET_KEY) {
|
|
113
|
-
config.translationKeyInfo = {
|
|
114
|
-
kind: "openai",
|
|
115
|
-
apiKey: process.env.ATJ_OPEN_AI_SECRET_KEY,
|
|
116
|
-
baseUrl: process.env.ATJ_OPEN_AI_BASE_URL ?? "https://api.openai.com/v1",
|
|
117
|
-
model: process.env.ATJ_OPEN_AI_MODEL ?? "gpt-3.5-turbo",
|
|
118
|
-
maxTokens: Number(process.env.ATJ_OPEN_AI_MAX_TOKENS ?? "256"),
|
|
119
|
-
temperature: Number(process.env.ATJ_OPEN_AI_TEMPERATURE ?? "0.7"),
|
|
120
|
-
topP: Number(process.env.ATJ_OPEN_AI_TOP_P ?? "0.9"),
|
|
121
|
-
n: Number(process.env.ATJ_OPEN_AI_N ?? "1"),
|
|
122
|
-
frequencyPenalty: Number(process.env.ATJ_OPEN_AI_FREQUENCY_PENALTY ?? "0"),
|
|
123
|
-
presencePenalty: Number(process.env.ATJ_OPEN_AI_PRESENCE_PENALTY ?? "0"),
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
// Hugging Face cloud mode (requires API key)
|
|
127
|
-
if (process.env.ATJ_HUGGING_FACE_API_KEY) {
|
|
128
|
-
config.translationKeyInfo = {
|
|
129
|
-
kind: "huggingface",
|
|
130
|
-
apiKey: process.env.ATJ_HUGGING_FACE_API_KEY,
|
|
131
|
-
model: process.env.ATJ_HUGGING_FACE_MODEL ?? "Helsinki-NLP/opus-mt-en-fr",
|
|
132
|
-
provider: process.env.ATJ_HUGGING_FACE_PROVIDER,
|
|
133
|
-
};
|
|
134
|
-
}
|
|
135
|
-
// Hugging Face local mode (no API key, ONNX on-device — takes priority)
|
|
136
|
-
if (process.env.ATJ_HUGGING_FACE_LOCAL_MODEL) {
|
|
137
|
-
config.translationKeyInfo = {
|
|
138
|
-
kind: "huggingface-local",
|
|
139
|
-
model: process.env.ATJ_HUGGING_FACE_LOCAL_MODEL,
|
|
140
|
-
};
|
|
141
|
-
}
|
|
142
|
-
if (process.env.ATJ_START_DELIMITER) {
|
|
143
|
-
config.startDelimiter = process.env.ATJ_START_DELIMITER;
|
|
144
|
-
}
|
|
145
|
-
if (process.env.ATJ_END_DELIMITER) {
|
|
146
|
-
config.endDelimiter = process.env.ATJ_END_DELIMITER;
|
|
147
|
-
}
|
|
148
|
-
if (process.env.ATJ_END_DELIMITER) {
|
|
149
|
-
config.endDelimiter = process.env.ATJ_END_DELIMITER;
|
|
150
|
-
}
|
|
151
|
-
if (process.env.ATJ_MODE &&
|
|
152
|
-
(process.env.ATJ_MODE === "file" || process.env.ATJ_MODE === "folder")) {
|
|
153
|
-
config.mode = process.env.ATJ_MODE;
|
|
154
|
-
}
|
|
155
|
-
if (process.env.ATJ_SOURCE_LOCALE) {
|
|
156
|
-
config.sourceLocale = process.env.ATJ_SOURCE_LOCALE;
|
|
157
|
-
}
|
|
158
|
-
if (process.env.ATJ_KEEP_TRANSLATIONS &&
|
|
159
|
-
(process.env.ATJ_KEEP_TRANSLATIONS === "keep" ||
|
|
160
|
-
process.env.ATJ_KEEP_TRANSLATIONS === "retranslate")) {
|
|
161
|
-
config.keepTranslations = process.env.ATJ_KEEP_TRANSLATIONS;
|
|
162
|
-
}
|
|
163
|
-
if (process.env.ATJ_KEEP_EXTRA_TRANSLATIONS &&
|
|
164
|
-
(process.env.ATJ_KEEP_EXTRA_TRANSLATIONS === "keep" ||
|
|
165
|
-
process.env.ATJ_KEEP_EXTRA_TRANSLATIONS === "remove")) {
|
|
166
|
-
config.keepExtraTranslations = process.env.ATJ_KEEP_EXTRA_TRANSLATIONS;
|
|
167
|
-
}
|
|
168
|
-
if (process.env.ATJ_IGNORE_PREFIX && process.env.ATJ_IGNORE_PREFIX !== "") {
|
|
169
|
-
config.ignorePrefix = process.env.ATJ_IGNORE_PREFIX;
|
|
170
|
-
}
|
|
171
|
-
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "auto-translate-json-library",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Automatically translates JSON language files to other languages using Google Translate, AWS, Azure, DeepL, OpenAI, Hugging Face (cloud & local) or local OpenAI compatible server",
|
|
6
6
|
"main": "./build/src/index.js",
|
|
@@ -11,29 +11,39 @@
|
|
|
11
11
|
"types": "./build/src/index.d.ts",
|
|
12
12
|
"files": [
|
|
13
13
|
"build/src",
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"README.MD",
|
|
15
|
+
"CHANGELOG.md",
|
|
16
|
+
"LICENSE"
|
|
16
17
|
],
|
|
18
|
+
"engines": {
|
|
19
|
+
"node": ">=22.0.0"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/topce/auto-translate-json-library#readme",
|
|
22
|
+
"bugs": {
|
|
23
|
+
"url": "https://github.com/topce/auto-translate-json-library/issues"
|
|
24
|
+
},
|
|
17
25
|
"publishConfig": {
|
|
18
26
|
"access": "public"
|
|
19
27
|
},
|
|
20
28
|
"scripts": {
|
|
21
|
-
"prepare": "
|
|
29
|
+
"prepare": "npm run build",
|
|
22
30
|
"prepack": "npm run build",
|
|
23
|
-
"
|
|
24
|
-
"build
|
|
25
|
-
"build:run": "
|
|
26
|
-
"debug": "
|
|
27
|
-
"release:check": "npm test && npm pack --dry-run",
|
|
31
|
+
"clean": "node -e \"require('node:fs').rmSync('build',{recursive:true,force:true})\"",
|
|
32
|
+
"build": "npm run clean && tsc",
|
|
33
|
+
"build:run": "node ./build/src/bin/cli.js --pivotTranslation=./tests/translations/en.json",
|
|
34
|
+
"debug": "npm run build && node ./build/src/bin/cli.js --pivotTranslation=./tests/translations/en.json",
|
|
35
|
+
"release:check": "npm run lint && npm run build && npm test && npm pack --dry-run",
|
|
36
|
+
"prepublishOnly": "npm run build && npm test",
|
|
37
|
+
"pretest": "npm run build",
|
|
28
38
|
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
29
|
-
"test:watch": "jest --watch",
|
|
30
|
-
"test:coverage": "jest --coverage",
|
|
39
|
+
"test:watch": "node --experimental-vm-modules node_modules/jest/bin/jest.js --watch",
|
|
40
|
+
"test:coverage": "node --experimental-vm-modules node_modules/jest/bin/jest.js --coverage",
|
|
31
41
|
"lint": "biome check ./src --max-diagnostics 1000",
|
|
32
42
|
"lint-fix": "biome check ./src --write",
|
|
33
43
|
"lint-fix-all": "biome check --write --unsafe ./src",
|
|
34
44
|
"format": "biome format ./src",
|
|
35
45
|
"format-fix": "biome format ./src --write",
|
|
36
|
-
"start": "
|
|
46
|
+
"start": "node ./build/src/bin/cli.js"
|
|
37
47
|
},
|
|
38
48
|
"keywords": [
|
|
39
49
|
"translate",
|
|
@@ -128,40 +138,42 @@
|
|
|
128
138
|
],
|
|
129
139
|
"license": "MIT",
|
|
130
140
|
"devDependencies": {
|
|
131
|
-
"@biomejs/biome": "2.
|
|
132
|
-
"@
|
|
141
|
+
"@biomejs/biome": "2.6.9",
|
|
142
|
+
"@swc/core": "1.16.22",
|
|
143
|
+
"@swc/jest": "0.2.39",
|
|
133
144
|
"@types/gettext-parser": "9.0.0",
|
|
134
145
|
"@types/jest": "30.0.0",
|
|
135
146
|
"@types/minimist": "1.2.5",
|
|
136
|
-
"@types/node": "26.
|
|
147
|
+
"@types/node": "26.6.11",
|
|
137
148
|
"@types/properties-parser": "0.3.3",
|
|
138
149
|
"@types/yargs": "17.0.35",
|
|
139
|
-
"jest": "30.
|
|
140
|
-
"
|
|
141
|
-
"ts-node": "10.9.2",
|
|
142
|
-
"typescript": "6.0.3"
|
|
150
|
+
"jest": "30.5.2",
|
|
151
|
+
"typescript": "7.0.2"
|
|
143
152
|
},
|
|
144
153
|
"dependencies": {
|
|
145
|
-
"@aws-sdk/client-translate": "3.
|
|
146
|
-
"@google-cloud/translate": "
|
|
147
|
-
"@huggingface/inference": "^4.13.
|
|
148
|
-
"@huggingface/transformers": "^4.2
|
|
149
|
-
"
|
|
150
|
-
"axios": "1.19.0",
|
|
154
|
+
"@aws-sdk/client-translate": "3.1179.0",
|
|
155
|
+
"@google-cloud/translate": "10.3.0",
|
|
156
|
+
"@huggingface/inference": "^4.13.33",
|
|
157
|
+
"@huggingface/transformers": "^4.3.2",
|
|
158
|
+
"axios": "1.21.1",
|
|
151
159
|
"csv-parser": "3.2.1",
|
|
152
160
|
"csv-writer": "1.6.0",
|
|
153
|
-
"deepl-node": "
|
|
154
|
-
"dotenv": "
|
|
155
|
-
"fast-xml-parser": "5.
|
|
161
|
+
"deepl-node": "2.0.0",
|
|
162
|
+
"dotenv": "18.0.10",
|
|
163
|
+
"fast-xml-parser": "5.12.1",
|
|
156
164
|
"form-data": "4.0.6",
|
|
157
|
-
"gettext-parser": "
|
|
158
|
-
"js-yaml": "
|
|
165
|
+
"gettext-parser": "10.0.0",
|
|
166
|
+
"js-yaml": "5.5.0",
|
|
159
167
|
"minimist": "1.2.8",
|
|
160
|
-
"openai": "7.
|
|
168
|
+
"openai": "7.65.0",
|
|
161
169
|
"picocolors": "1.1.1",
|
|
162
170
|
"properties-parser": "0.6.0",
|
|
163
|
-
"sharp": "^0.35.
|
|
164
|
-
"uuid": "14.0.
|
|
165
|
-
"yargs": "18.
|
|
171
|
+
"sharp": "^0.35.6",
|
|
172
|
+
"uuid": "14.0.3",
|
|
173
|
+
"yargs": "18.2.0"
|
|
174
|
+
},
|
|
175
|
+
"overrides": {
|
|
176
|
+
"glob": "^14.0.6",
|
|
177
|
+
"minimatch": "^11.0.9"
|
|
166
178
|
}
|
|
167
179
|
}
|
package/build/package.json
DELETED
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "auto-translate-json-library",
|
|
3
|
-
"version": "2.3.0",
|
|
4
|
-
"type": "module",
|
|
5
|
-
"description": "Automatically translates JSON language files to other languages using Google Translate, AWS, Azure, DeepL, OpenAI, Hugging Face (cloud & local) or local OpenAI compatible server",
|
|
6
|
-
"main": "./build/src/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"auto-translate-json-library": "./build/src/bin/cli.js",
|
|
9
|
-
"atj": "./build/src/bin/cli.js"
|
|
10
|
-
},
|
|
11
|
-
"types": "./build/src/index.d.ts",
|
|
12
|
-
"files": [
|
|
13
|
-
"build/src",
|
|
14
|
-
"build/package.json",
|
|
15
|
-
"README.MD"
|
|
16
|
-
],
|
|
17
|
-
"publishConfig": {
|
|
18
|
-
"access": "public"
|
|
19
|
-
},
|
|
20
|
-
"scripts": {
|
|
21
|
-
"prepare": "tsc",
|
|
22
|
-
"prepack": "npm run build",
|
|
23
|
-
"build": "tsc",
|
|
24
|
-
"build:go": "tsgo --skipLibCheck",
|
|
25
|
-
"build:run": "ts-node ./build/src/index.js --pivotTranslation=./tests/translations/en.json",
|
|
26
|
-
"debug": "ts-node src/index.ts --pivotTranslation=./tests/translations/en.json",
|
|
27
|
-
"release:check": "npm test && npm pack --dry-run",
|
|
28
|
-
"test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
|
|
29
|
-
"test:watch": "jest --watch",
|
|
30
|
-
"test:coverage": "jest --coverage",
|
|
31
|
-
"lint": "biome check ./src --max-diagnostics 1000",
|
|
32
|
-
"lint-fix": "biome check ./src --write",
|
|
33
|
-
"lint-fix-all": "biome check --write --unsafe ./src",
|
|
34
|
-
"format": "biome format ./src",
|
|
35
|
-
"format-fix": "biome format ./src --write",
|
|
36
|
-
"start": "ts-node src/index.ts"
|
|
37
|
-
},
|
|
38
|
-
"keywords": [
|
|
39
|
-
"translate",
|
|
40
|
-
"translation",
|
|
41
|
-
"i18n",
|
|
42
|
-
"internationalization",
|
|
43
|
-
"localization",
|
|
44
|
-
"language",
|
|
45
|
-
"json",
|
|
46
|
-
"xml",
|
|
47
|
-
"yaml",
|
|
48
|
-
"yml",
|
|
49
|
-
"properties",
|
|
50
|
-
"csv",
|
|
51
|
-
"tsv",
|
|
52
|
-
"arb",
|
|
53
|
-
"po",
|
|
54
|
-
"pot",
|
|
55
|
-
"xliff",
|
|
56
|
-
"xlf",
|
|
57
|
-
"xmb",
|
|
58
|
-
"xtb",
|
|
59
|
-
"android-xml",
|
|
60
|
-
"ios-xml",
|
|
61
|
-
"flutter",
|
|
62
|
-
"angular",
|
|
63
|
-
"ngx-translate",
|
|
64
|
-
"transloco",
|
|
65
|
-
"auto-translate-json",
|
|
66
|
-
"google-translate",
|
|
67
|
-
"aws-translate",
|
|
68
|
-
"azure-translator",
|
|
69
|
-
"deepl",
|
|
70
|
-
"deepl-pro",
|
|
71
|
-
"deepl-free",
|
|
72
|
-
"openai",
|
|
73
|
-
"gpt-4",
|
|
74
|
-
"gpt-4.1-mini",
|
|
75
|
-
"deepseek",
|
|
76
|
-
"ollama",
|
|
77
|
-
"qwen2.5",
|
|
78
|
-
"gemma2",
|
|
79
|
-
"llama3.1",
|
|
80
|
-
"local-ai",
|
|
81
|
-
"openai-compatible",
|
|
82
|
-
"jan",
|
|
83
|
-
"jan-ai",
|
|
84
|
-
"lm-studio",
|
|
85
|
-
"lmstudio",
|
|
86
|
-
"text-generation-webui",
|
|
87
|
-
"oobabooga",
|
|
88
|
-
"vllm",
|
|
89
|
-
"llamacpp",
|
|
90
|
-
"llama-cpp",
|
|
91
|
-
"koboldai",
|
|
92
|
-
"kobold",
|
|
93
|
-
"localai",
|
|
94
|
-
"fastchat",
|
|
95
|
-
"xinference",
|
|
96
|
-
"mlx",
|
|
97
|
-
"mlx-lm",
|
|
98
|
-
"candle",
|
|
99
|
-
"ctransformers",
|
|
100
|
-
"exllama",
|
|
101
|
-
"exllamav2",
|
|
102
|
-
"gpt4all",
|
|
103
|
-
"cli",
|
|
104
|
-
"command-line",
|
|
105
|
-
"automation",
|
|
106
|
-
"batch-translation",
|
|
107
|
-
"multi-format",
|
|
108
|
-
"gettext",
|
|
109
|
-
"huggingface",
|
|
110
|
-
"hugging-face",
|
|
111
|
-
"helsinki-nlp",
|
|
112
|
-
"nllb",
|
|
113
|
-
"transformers-js",
|
|
114
|
-
"local-translation"
|
|
115
|
-
],
|
|
116
|
-
"author": "codegrue",
|
|
117
|
-
"repository": {
|
|
118
|
-
"type": "git",
|
|
119
|
-
"url": "git+https://github.com/topce/auto-translate-json-library.git"
|
|
120
|
-
},
|
|
121
|
-
"contributors": [
|
|
122
|
-
"codegrue",
|
|
123
|
-
"gajo357",
|
|
124
|
-
"topce",
|
|
125
|
-
"BenGMiles",
|
|
126
|
-
"stonega",
|
|
127
|
-
"alexei-petru"
|
|
128
|
-
],
|
|
129
|
-
"license": "MIT",
|
|
130
|
-
"devDependencies": {
|
|
131
|
-
"@biomejs/biome": "2.5.6",
|
|
132
|
-
"@topce/native-preview": "7.0.3",
|
|
133
|
-
"@types/gettext-parser": "9.0.0",
|
|
134
|
-
"@types/jest": "30.0.0",
|
|
135
|
-
"@types/minimist": "1.2.5",
|
|
136
|
-
"@types/node": "26.1.2",
|
|
137
|
-
"@types/properties-parser": "0.3.3",
|
|
138
|
-
"@types/yargs": "17.0.35",
|
|
139
|
-
"jest": "30.4.2",
|
|
140
|
-
"ts-jest": "29.4.12",
|
|
141
|
-
"ts-node": "10.9.2",
|
|
142
|
-
"typescript": "6.0.3"
|
|
143
|
-
},
|
|
144
|
-
"dependencies": {
|
|
145
|
-
"@aws-sdk/client-translate": "3.1100.0",
|
|
146
|
-
"@google-cloud/translate": "9.4.2",
|
|
147
|
-
"@huggingface/inference": "^4.13.24",
|
|
148
|
-
"@huggingface/transformers": "^4.2.0",
|
|
149
|
-
"@types/js-yaml": "4.0.9",
|
|
150
|
-
"axios": "1.19.0",
|
|
151
|
-
"csv-parser": "3.2.1",
|
|
152
|
-
"csv-writer": "1.6.0",
|
|
153
|
-
"deepl-node": "1.27.0",
|
|
154
|
-
"dotenv": "17.4.2",
|
|
155
|
-
"fast-xml-parser": "5.10.1",
|
|
156
|
-
"form-data": "4.0.6",
|
|
157
|
-
"gettext-parser": "9.1.1",
|
|
158
|
-
"js-yaml": "4.3.1",
|
|
159
|
-
"minimist": "1.2.8",
|
|
160
|
-
"openai": "7.3.0",
|
|
161
|
-
"picocolors": "1.1.1",
|
|
162
|
-
"properties-parser": "0.6.0",
|
|
163
|
-
"sharp": "^0.35.3",
|
|
164
|
-
"uuid": "14.0.1",
|
|
165
|
-
"yargs": "18.1.0"
|
|
166
|
-
}
|
|
167
|
-
}
|
package/build/src/debug.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|