@localheroai/cli 0.0.69 → 0.0.71-rc.1
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/dist/cli.js +8 -8
- package/dist/commands/ci.js +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/utils/github.js +13 -6
- package/dist/utils/github.js.map +1 -1
- package/dist/utils/translation-utils.js +11 -11
- package/dist/utils/translation-utils.js.map +1 -1
- package/package.json +1 -1
- package/dist/api/auth.d.ts +0 -2
- package/dist/api/client.d.ts +0 -3
- package/dist/api/imports.d.ts +0 -5
- package/dist/api/projects.d.ts +0 -2
- package/dist/api/translation-jobs.js +0 -28
- package/dist/api/translation-jobs.js.map +0 -1
- package/dist/api/translations.d.ts +0 -15
- package/dist/cli.d.ts +0 -2
- package/dist/commands/_sync.js +0 -22
- package/dist/commands/_sync.js.map +0 -1
- package/dist/commands/_translate.js +0 -3
- package/dist/commands/_translate.js.map +0 -1
- package/dist/commands/github-action.js +0 -111
- package/dist/commands/github-action.js.map +0 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/login.d.ts +0 -16
- package/dist/commands/sync.d.ts +0 -20
- package/dist/commands/sync.js +0 -22
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/translate.d.ts +0 -14
- package/dist/index.d.ts +0 -5
- package/dist/types/index.d.ts +0 -75
- package/dist/types/translate/index.js +0 -2
- package/dist/types/translate/index.js.map +0 -1
- package/dist/utils/auth.d.ts +0 -2
- package/dist/utils/chunked-json-processor.js +0 -52
- package/dist/utils/chunked-json-processor.js.map +0 -1
- package/dist/utils/common.js +0 -9
- package/dist/utils/common.js.map +0 -1
- package/dist/utils/config.d.ts +0 -23
- package/dist/utils/errors.js +0 -37
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/files.d.ts +0 -32
- package/dist/utils/git-diff.js +0 -251
- package/dist/utils/git-diff.js.map +0 -1
- package/dist/utils/git.d.ts +0 -21
- package/dist/utils/github.d.ts +0 -241
- package/dist/utils/import-service.d.ts +0 -4
- package/dist/utils/po-utils-fallback.js +0 -254
- package/dist/utils/po-utils-fallback.js.map +0 -1
- package/dist/utils/prompt-service.d.ts +0 -44
- package/dist/utils/streaming-json-processor.js +0 -125
- package/dist/utils/streaming-json-processor.js.map +0 -1
- package/dist/utils/sync-service.d.ts +0 -58
- package/dist/utils/translation-updater/common.d.ts +0 -6
- package/dist/utils/translation-updater/index.d.ts +0 -5
- package/dist/utils/translation-updater/json-handler.d.ts +0 -5
- package/dist/utils/translation-updater/yaml-handler.d.ts +0 -5
- package/dist/utils/translation-utils.d.ts +0 -30
- package/dist/utils/updater.js +0 -38
- package/dist/utils/updater.js.map +0 -1
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import { createReadStream } from 'fs';
|
|
2
|
-
import { JSONParser } from '@streamparser/json';
|
|
3
|
-
import { flattenTranslations } from './files.js';
|
|
4
|
-
import { FILE_SIZE_LIMITS } from './file-size.js';
|
|
5
|
-
const DEFAULT_CHUNK_SIZE = 1000;
|
|
6
|
-
export async function processLargeJsonFileStreaming(filePath, options = {}) {
|
|
7
|
-
const { chunkSize = DEFAULT_CHUNK_SIZE, onProgress, onChunk, maxMemoryAccumulation = 50 * 1024 * 1024 // 50MB default limit
|
|
8
|
-
} = options;
|
|
9
|
-
let accumulator = {};
|
|
10
|
-
let currentChunk = {};
|
|
11
|
-
let totalKeys = 0;
|
|
12
|
-
let chunksProcessed = 0;
|
|
13
|
-
let estimatedMemoryUsage = 0;
|
|
14
|
-
return new Promise((resolve, reject) => {
|
|
15
|
-
const parser = new JSONParser();
|
|
16
|
-
const stream = createReadStream(filePath);
|
|
17
|
-
parser.onValue = async (data) => {
|
|
18
|
-
try {
|
|
19
|
-
const { value, key, stack } = data;
|
|
20
|
-
// Only process top-level key-value pairs (stack length 1 means direct child of root)
|
|
21
|
-
if (stack && stack.length === 1 && typeof key === 'string') {
|
|
22
|
-
currentChunk[key] = value;
|
|
23
|
-
totalKeys++;
|
|
24
|
-
if (Object.keys(currentChunk).length >= chunkSize) {
|
|
25
|
-
if (onChunk) {
|
|
26
|
-
// Use callback mode - don't accumulate in memory
|
|
27
|
-
const flattened = flattenTranslations(currentChunk);
|
|
28
|
-
await onChunk(flattened);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// Check memory usage before accumulating
|
|
32
|
-
const chunkMemorySize = estimateObjectSize(currentChunk);
|
|
33
|
-
if (estimatedMemoryUsage + chunkMemorySize > maxMemoryAccumulation) {
|
|
34
|
-
const error = new Error(`Memory limit exceeded: Estimated usage ${Math.round((estimatedMemoryUsage + chunkMemorySize) / 1024 / 1024)}MB > limit ${Math.round(maxMemoryAccumulation / 1024 / 1024)}MB. Consider using onChunk callback for large files.`);
|
|
35
|
-
reject(error);
|
|
36
|
-
return;
|
|
37
|
-
}
|
|
38
|
-
await processChunk(currentChunk, accumulator);
|
|
39
|
-
estimatedMemoryUsage += chunkMemorySize;
|
|
40
|
-
}
|
|
41
|
-
chunksProcessed++;
|
|
42
|
-
if (onProgress) {
|
|
43
|
-
onProgress(totalKeys);
|
|
44
|
-
}
|
|
45
|
-
currentChunk = {};
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
catch (error) {
|
|
50
|
-
const wrappedError = new Error(`Error processing chunk: ${error.message}`);
|
|
51
|
-
wrappedError.cause = error;
|
|
52
|
-
reject(wrappedError);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
parser.onEnd = async () => {
|
|
56
|
-
try {
|
|
57
|
-
if (Object.keys(currentChunk).length > 0) {
|
|
58
|
-
if (onChunk) {
|
|
59
|
-
const flattened = flattenTranslations(currentChunk);
|
|
60
|
-
await onChunk(flattened);
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
await processChunk(currentChunk, accumulator);
|
|
64
|
-
}
|
|
65
|
-
chunksProcessed++;
|
|
66
|
-
}
|
|
67
|
-
if (onProgress) {
|
|
68
|
-
onProgress(totalKeys, totalKeys);
|
|
69
|
-
}
|
|
70
|
-
resolve({
|
|
71
|
-
translations: accumulator,
|
|
72
|
-
isStreamed: true,
|
|
73
|
-
totalKeys,
|
|
74
|
-
chunksProcessed
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
catch (error) {
|
|
78
|
-
const wrappedError = new Error(`Error processing final chunk: ${error.message}`);
|
|
79
|
-
wrappedError.cause = error;
|
|
80
|
-
reject(wrappedError);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
parser.onError = (error) => {
|
|
84
|
-
const wrappedError = new Error(`Streaming parser error: ${error.message}`);
|
|
85
|
-
wrappedError.cause = error;
|
|
86
|
-
reject(wrappedError);
|
|
87
|
-
};
|
|
88
|
-
stream.on('error', (error) => {
|
|
89
|
-
const wrappedError = new Error(`File read error: ${error.message}`);
|
|
90
|
-
wrappedError.cause = error;
|
|
91
|
-
reject(wrappedError);
|
|
92
|
-
});
|
|
93
|
-
stream.on('data', (chunk) => {
|
|
94
|
-
parser.write(chunk);
|
|
95
|
-
});
|
|
96
|
-
stream.on('end', () => {
|
|
97
|
-
parser.end();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
async function processChunk(chunk, accumulator) {
|
|
102
|
-
const flattened = flattenTranslations(chunk);
|
|
103
|
-
Object.assign(accumulator, flattened);
|
|
104
|
-
}
|
|
105
|
-
function estimateObjectSize(obj) {
|
|
106
|
-
// Rough estimation of object memory usage in bytes
|
|
107
|
-
let size = 0;
|
|
108
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
109
|
-
size += key.length * 2; // String keys (UTF-16)
|
|
110
|
-
if (typeof value === 'string') {
|
|
111
|
-
size += value.length * 2; // String values (UTF-16)
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
size += JSON.stringify(value).length * 2; // Approximate for other types
|
|
115
|
-
}
|
|
116
|
-
size += 32; // Object overhead per property
|
|
117
|
-
}
|
|
118
|
-
return size;
|
|
119
|
-
}
|
|
120
|
-
export function shouldUseStreamingProcessing(fileSize, format) {
|
|
121
|
-
return format === 'json' &&
|
|
122
|
-
fileSize > FILE_SIZE_LIMITS.CHUNKING_THRESHOLD &&
|
|
123
|
-
fileSize <= FILE_SIZE_LIMITS.MAX_SIZE;
|
|
124
|
-
}
|
|
125
|
-
//# sourceMappingURL=streaming-json-processor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"streaming-json-processor.js","sourceRoot":"","sources":["../../src/utils/streaming-json-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,IAAI,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAgBlD,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,QAAgB,EAChB,UAAsC,EAAE;IAExC,MAAM,EACJ,SAAS,GAAG,kBAAkB,EAC9B,UAAU,EACV,OAAO,EACP,qBAAqB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC,qBAAqB;MAC/D,GAAG,OAAO,CAAC;IAEZ,IAAI,WAAW,GAAwB,EAAE,CAAC;IAC1C,IAAI,YAAY,GAAwB,EAAE,CAAC;IAC3C,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,eAAe,GAAG,CAAC,CAAC;IACxB,IAAI,oBAAoB,GAAG,CAAC,CAAC;IAE7B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAE1C,MAAM,CAAC,OAAO,GAAG,KAAK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D,CAAC;aAAM,CAAC;YACN,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,8BAA8B;QAC1E,CAAC;QACD,IAAI,IAAI,EAAE,CAAC,CAAC,+BAA+B;IAC7C,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,4BAA4B,CAAC,QAAgB,EAAE,MAAc;IAC3E,OAAO,MAAM,KAAK,MAAM;QACjB,QAAQ,GAAG,gBAAgB,CAAC,kBAAkB;QAC9C,QAAQ,IAAI,gBAAgB,CAAC,QAAQ,CAAC;AAC/C,CAAC"}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export interface SyncOptions {
|
|
2
|
-
verbose?: boolean;
|
|
3
|
-
}
|
|
4
|
-
export interface Translation {
|
|
5
|
-
key: string;
|
|
6
|
-
value: string;
|
|
7
|
-
}
|
|
8
|
-
export interface Language {
|
|
9
|
-
code: string;
|
|
10
|
-
translations: Translation[];
|
|
11
|
-
}
|
|
12
|
-
export interface FileUpdate {
|
|
13
|
-
path: string;
|
|
14
|
-
languages: Language[];
|
|
15
|
-
}
|
|
16
|
-
export interface DeletedKey {
|
|
17
|
-
name: string;
|
|
18
|
-
}
|
|
19
|
-
export interface PaginationInfo {
|
|
20
|
-
current_page: number;
|
|
21
|
-
total_pages: number;
|
|
22
|
-
}
|
|
23
|
-
export interface UpdateResponse {
|
|
24
|
-
updates?: {
|
|
25
|
-
updated_keys?: FileUpdate[];
|
|
26
|
-
deleted_keys?: DeletedKey[];
|
|
27
|
-
};
|
|
28
|
-
pagination?: PaginationInfo;
|
|
29
|
-
}
|
|
30
|
-
export interface UpdatesContainer {
|
|
31
|
-
updates: {
|
|
32
|
-
files: FileUpdate[];
|
|
33
|
-
deleted_keys: DeletedKey[];
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface CheckUpdatesResult {
|
|
37
|
-
hasUpdates: boolean;
|
|
38
|
-
updates?: UpdatesContainer;
|
|
39
|
-
}
|
|
40
|
-
export interface TranslationFile {
|
|
41
|
-
path: string;
|
|
42
|
-
locale: string;
|
|
43
|
-
}
|
|
44
|
-
export interface SourceFile {
|
|
45
|
-
path: string;
|
|
46
|
-
}
|
|
47
|
-
export interface FindTranslationFilesResult {
|
|
48
|
-
sourceFiles: SourceFile[];
|
|
49
|
-
[key: string]: any;
|
|
50
|
-
}
|
|
51
|
-
export interface SyncResult {
|
|
52
|
-
totalUpdates: number;
|
|
53
|
-
totalDeleted: number;
|
|
54
|
-
}
|
|
55
|
-
export declare const syncService: {
|
|
56
|
-
checkForUpdates({ verbose }?: SyncOptions): Promise<CheckUpdatesResult>;
|
|
57
|
-
applyUpdates(updates: UpdatesContainer, { verbose }?: SyncOptions): Promise<SyncResult>;
|
|
58
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export function fileExists(filePath: any): Promise<boolean>;
|
|
2
|
-
export function ensureDirectoryExists(filePath: any): Promise<void>;
|
|
3
|
-
export function tryParseJsonArray(value: any): any[] | null;
|
|
4
|
-
export const SPECIAL_CHARS_REGEX: RegExp;
|
|
5
|
-
export const INTERPOLATION: "%{";
|
|
6
|
-
export const MAX_ARRAY_LENGTH: 1000;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export function updateTranslationFile(filePath: any, translations: any, languageCode?: string, sourceFilePath?: null): Promise<{
|
|
2
|
-
updatedKeys: string[];
|
|
3
|
-
created: boolean;
|
|
4
|
-
}>;
|
|
5
|
-
export function deleteKeysFromTranslationFile(filePath: any, keysToDelete: any, languageCode?: string): Promise<any[]>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export function updateJsonFile(filePath: any, translations: any, languageCode: any, sourceFilePath?: null): Promise<{
|
|
2
|
-
updatedKeys: string[];
|
|
3
|
-
created: boolean;
|
|
4
|
-
}>;
|
|
5
|
-
export function deleteKeysFromJsonFile(filePath: any, keysToDelete: any, languageCode: any): Promise<any[]>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export function findMissingTranslations(sourceKeys: any, targetKeys: any): {
|
|
2
|
-
missingKeys: {};
|
|
3
|
-
skippedKeys: {};
|
|
4
|
-
};
|
|
5
|
-
export function batchKeysWithMissing(sourceFiles: any, missingByLocale: any, batchSize?: number): {
|
|
6
|
-
batches: {
|
|
7
|
-
sourceFilePath: string;
|
|
8
|
-
sourceFile: {
|
|
9
|
-
path: any;
|
|
10
|
-
format: any;
|
|
11
|
-
content: string;
|
|
12
|
-
};
|
|
13
|
-
localeEntries: any;
|
|
14
|
-
locales: any[];
|
|
15
|
-
}[];
|
|
16
|
-
errors: {
|
|
17
|
-
type: string;
|
|
18
|
-
message: string;
|
|
19
|
-
path: string;
|
|
20
|
-
}[];
|
|
21
|
-
};
|
|
22
|
-
export function findTargetFile(targetFiles: any, targetLocale: any, sourceFile: any, sourceLocale: any): any;
|
|
23
|
-
export function generateTargetPath(sourceFile: any, targetLocale: any, sourceLocale: any): string;
|
|
24
|
-
export function processTargetContent(targetContent: any, targetLocale: any): {};
|
|
25
|
-
export function processLocaleTranslations(sourceKeys: any, targetLocale: any, targetFiles: any, sourceFile: any, sourceLocale: any): {
|
|
26
|
-
targetPath: string;
|
|
27
|
-
missingKeys: {};
|
|
28
|
-
skippedKeys: {};
|
|
29
|
-
targetFile: any;
|
|
30
|
-
};
|
package/dist/utils/updater.js
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { readTranslationFile } from './files.js';
|
|
2
|
-
import { updateTranslationFile } from './translation-updater/index.js';
|
|
3
|
-
/**
|
|
4
|
-
* Apply translation updates to files
|
|
5
|
-
* @param files Array of translation files to update
|
|
6
|
-
* @returns Result of the update operation
|
|
7
|
-
*/
|
|
8
|
-
export async function applyTranslationUpdates(files) {
|
|
9
|
-
const errors = [];
|
|
10
|
-
try {
|
|
11
|
-
for (const file of files) {
|
|
12
|
-
try {
|
|
13
|
-
const currentFile = await readTranslationFile(file.path);
|
|
14
|
-
await updateTranslationFile(file.path, file.translations || {}, file.locale, currentFile.path);
|
|
15
|
-
}
|
|
16
|
-
catch (error) {
|
|
17
|
-
errors.push({
|
|
18
|
-
path: file.path,
|
|
19
|
-
message: error instanceof Error ? error.message : String(error)
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return {
|
|
24
|
-
success: errors.length === 0,
|
|
25
|
-
errors: errors.length > 0 ? errors : undefined
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
catch (error) {
|
|
29
|
-
return {
|
|
30
|
-
success: false,
|
|
31
|
-
errors: [{
|
|
32
|
-
path: 'unknown',
|
|
33
|
-
message: error instanceof Error ? error.message : String(error)
|
|
34
|
-
}]
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=updater.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"updater.js","sourceRoot":"","sources":["../../src/utils/updater.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gCAAgC,CAAC;AAOvE;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,KAAwB;IACpE,MAAM,MAAM,GAA6C,EAAE,CAAC;IAE5D,IAAI,CAAC;QACH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,IAAI,CAAC;gBACH,MAAM,WAAW,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACzD,MAAM,qBAAqB,CACzB,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,YAAY,IAAI,EAAE,EACvB,IAAI,CAAC,MAAM,EACX,WAAW,CAAC,IAAI,CACjB,CAAC;YACJ,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,CAAC,IAAI,CAAC;oBACV,IAAI,EAAE,IAA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