Skip to content

Commit

Permalink
chore: introduce @bob-translate/types package to improve type defin…
Browse files Browse the repository at this point in the history
…itions
  • Loading branch information
liby committed Aug 10, 2024
1 parent 1015fb3 commit 6279e6c
Show file tree
Hide file tree
Showing 23 changed files with 28 additions and 492 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
"build": "rollup --config rollup.config.ts --configPlugin typescript"
},
"devDependencies": {
"typescript": "5.5.4",
"@bob-translate/types": "1.0.1",
"@rollup/plugin-terser": "0.4.4",
"@rollup/plugin-typescript": "11.1.6",
"rollup": "4.20.0",
"rollup-plugin-copy": "3.5.0",
"tslib": "2.6.3"
"tslib": "2.6.3",
"typescript": "5.5.4"
},
"engines": {
"node": ">=20"
Expand Down
8 changes: 8 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions src/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,4 @@ export const HTTP_ERROR_CODES = {
511: "Network Authentication Required"
} as const;

export type HttpErrorCode = keyof typeof HTTP_ERROR_CODES;

export const SYSTEM_PROMPT = "You are a translation engine that can only translate text and cannot interpret it." as const;
51 changes: 0 additions & 51 deletions src/global.d.ts

This file was deleted.

2 changes: 0 additions & 2 deletions src/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,4 @@ export const supportLanguageList = [
["zu", "zu"],
] as const;

export type Language = typeof supportLanguageList[number][0];

export const langMap = new Map(supportLanguageList.map(([key, value]) => [key, value]));
13 changes: 8 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { SYSTEM_PROMPT } from "./const";
import { langMap, supportLanguageList } from "./lang";
import { ChatCompletion, ModelList } from "./types";
import { HttpResponse } from "./types/http.type";
import type { PluginValidate } from "./types/plugin-validate.type";
import type { ServiceError } from "./types/service-error.type";
import type { TextTranslate, TextTranslateQuery } from "./types/text-translate.type";
import type { ChatCompletion, ModelList } from "./types";
import type {
HttpResponse,
PluginValidate,
ServiceError,
TextTranslate,
TextTranslateQuery
} from "@bob-translate/types";
import {
buildHeader,
ensureHttpsAndNoTrailingSlash,
Expand Down
29 changes: 0 additions & 29 deletions src/types/data.type.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/types/env.type.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/types/file.type.ts

This file was deleted.

87 changes: 0 additions & 87 deletions src/types/http.type.ts

This file was deleted.

46 changes: 0 additions & 46 deletions src/types/info.type.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/types/log.type.ts

This file was deleted.

23 changes: 0 additions & 23 deletions src/types/ocr.type.ts

This file was deleted.

4 changes: 0 additions & 4 deletions src/types/options.type.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/types/plugin-validate.type.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/types/service-error.type.ts

This file was deleted.

Loading

0 comments on commit 6279e6c

Please sign in to comment.