import { type DictEntry, type DictionaryResult, type EntityKeyInfo, type ImportResult, type UsageResult } from "./types"; /** * Sonamu Dictionary 관리 클래스 * i18n 딕셔너리의 CRUD 및 Excel import/export를 담당합니다. */ export declare class SonamuDictionary { /** * TypeScript Compiler API를 사용하여 dict 파일 파싱 * * 지원 패턴: * - export default { ... } as const; * - export default defineLocale({ ... }); * - 문자열 값: "key": "value" 또는 key: `value` * - 함수 값: "key": (param: Type) => `template` */ parseDictFile(filePath: string): DictEntry[]; /** * 파일에서 특정 이름의 const 선언을 찾아 ObjectLiteral 파싱 * 예: const entityLabels = { ... } as const; */ parseConstObjectDeclaration(filePath: string, varName: string): DictEntry[]; /** * 문자열이 화살표 함수 또는 함수 표현식인지 판별 */ isExpressionFunction(code: string): boolean; /** * export default 표현식에서 ObjectLiteralExpression 추출 * - as const 처리 * - defineLocale({ ... }) 호출 처리 */ private unwrapToObjectLiteral; /** * ObjectLiteralExpression에서 DictEntry 추출 */ private extractEntriesFromObject; /** * PropertyName에서 키 문자열 추출 * - 문자열 리터럴: "key" * - 식별자: key (unquoted) */ private getPropertyKey; /** * 프로퍼티에서 DictEntry 추출 * - 문자열: 실제 문자열 값 * - 함수: 원본 소스 (여러 줄은 한 줄로 정규화) */ private extractDictEntry; /** * 프로젝트의 i18n dict 파일 경로를 반환합니다. * @param locale - 로케일 (ko, en 등) * @param target - 타겟 디렉토리 (api, web, app) */ getProjectDictPath(locale: string, target?: "api" | "web" | "app"): string; /** * sonamu 내장 dict 파일 경로를 반환합니다. */ private getSonamuDictPath; /** * 필요한 dict 키가 프로젝트에 존재하는지 확인하고, 없으면 추가합니다. * defaultLocale에만 추가하며, 다른 locale은 사용자가 직접 번역해야 합니다. * * @param requiredKeys - 필요한 키 목록 * @param target - 타겟 디렉토리 (api, web, app) * @returns 추가된 키 목록 */ ensureDictKeys(requiredKeys: string[], target?: "api" | "web" | "app"): Promise; /** * dict 파일에 엔트리를 추가합니다. * 기존 파일을 파싱하고, 새 엔트리를 추가한 뒤, 전체 파일을 재생성합니다. */ private appendEntriesToDictFile; /** * 함수 값들에서 사용되는 헬퍼 함수를 감지합니다. */ private detectUsedHelpers; /** * Project dict 파일 생성 */ generateProjectDict(locale: string, entries: DictEntry[], isDefaultLocale: boolean): string; /** * i18n 설정을 가져옵니다. */ private getI18nConfig; /** * i18n 디렉토리 경로를 반환하고, 없으면 생성합니다. */ private ensureI18nDir; /** * dict 파일을 저장합니다. */ private saveDictFile; /** * i18n key를 파싱하여 entity 관련 정보 추출 */ parseEntityKey(key: string): EntityKeyInfo; /** * entity key에 대해 entity.json 업데이트 수행 * @returns 업데이트 여부 */ updateEntityByKey(key: string, value: string): Promise; /** * sd.generated.ts에서 entity labels 추출 * entity.json에서 관리되는 값만 포함 (.list, .create, .edit 제외) */ extractEntityLabels(): DictEntry[]; /** * sd.generated.ts에서 rc-keys 추출 * react-components에서 관리되는 i18n 키들 * @param locale - 로케일 (ko, en 등) */ extractRCKeys(locale: string): DictEntry[]; /** * Project dict 파일([locale].ts)에서 딕셔너리 로드 */ loadProjectDict(locale: string): { entries: DictEntry[]; }; /** * 딕셔너리 데이터 수집 (sonamu + entity + project) */ collectDictionary(): Promise; /** * 딕셔너리 조회 */ getDictionary(): Promise; /** * Excel로 내보내기 */ exportToExcel(): Promise<{ filename: string; buffer: Buffer; }>; /** * Excel에서 가져오기 * * 형식: * - 1행: 프로젝트명 * - 2행: 빈 행 * - 3행: 헤더 (key, source, locales...) * - 4행 이후: 데이터 */ importFromExcel(buffer: Buffer): Promise; /** * 딕셔너리 항목 수정 */ updateEntry(params: { oldKey: string; newKey: string; source: "entity" | "project" | "sonamu"; values: Record; }): Promise; /** * 딕셔너리 항목 추가 */ createEntry(params: { key: string; values: Record; }): Promise; /** * 딕셔너리 항목 삭제 */ deleteEntry(key: string): Promise; /** * 미사용 키 검사 (ast-grep 사용) */ checkUsage(keys: string[]): Promise; } export declare const sonamuDictionary: SonamuDictionary; //# sourceMappingURL=sonamu-dictionary.d.ts.map