@lmcc-dev/mult-fetch-mcp-server 1.3.1 → 1.3.3
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 +70 -15
- package/README.zh.md +31 -0
- package/dist/src/client.js +118 -91
- package/dist/src/index.js +0 -0
- package/dist/src/lib/fetchers/browser/BrowserFetcher.js +27 -10
- package/dist/src/lib/fetchers/browser/BrowserInstance.js +49 -43
- package/dist/src/lib/fetchers/common/BaseFetcher.js +106 -10
- package/dist/src/lib/fetchers/common/types.js +10 -1
- package/dist/src/lib/fetchers/common/utils.js +1 -1
- package/dist/src/lib/fetchers/node/HttpClient.js +47 -21
- package/dist/src/lib/fetchers/node/NodeFetcher.js +24 -8
- package/dist/src/lib/i18n/index.js +2 -2
- package/dist/src/lib/i18n/keys/client.js +1 -0
- package/dist/src/lib/i18n/keys/extractor.js +26 -0
- package/dist/src/lib/i18n/keys/fetcher.js +12 -1
- package/dist/src/lib/i18n/keys/index.js +1 -0
- package/dist/src/lib/i18n/keys/node.js +2 -0
- package/dist/src/lib/i18n/locales/en/client.js +1 -0
- package/dist/src/lib/i18n/locales/en/extractor.js +24 -0
- package/dist/src/lib/i18n/locales/en/fetcher.js +3 -1
- package/dist/src/lib/i18n/locales/en/index.js +2 -0
- package/dist/src/lib/i18n/locales/en/node.js +2 -0
- package/dist/src/lib/i18n/locales/zh/client.js +1 -0
- package/dist/src/lib/i18n/locales/zh/extractor.js +22 -0
- package/dist/src/lib/i18n/locales/zh/fetcher.js +13 -3
- package/dist/src/lib/i18n/locales/zh/index.js +2 -0
- package/dist/src/lib/i18n/locales/zh/node.js +2 -0
- package/dist/src/lib/i18n/logger.js +2 -2
- package/dist/src/lib/logger.js +38 -17
- package/dist/src/lib/server/browser.js +2 -2
- package/dist/src/lib/server/fetcher.js +0 -3
- package/dist/src/lib/server/index.js +2 -2
- package/dist/src/lib/server/prompts.js +4 -4
- package/dist/src/lib/server/tools.js +127 -354
- package/dist/src/lib/utils/ChunkManager.js +2 -2
- package/dist/src/lib/utils/ContentExtractor.js +141 -0
- package/dist/src/lib/utils/ContentProcessor.js +5 -11
- package/dist/src/lib/utils/ContentSizeManager.js +2 -2
- package/dist/src/lib/utils/ErrorHandler.js +1 -0
- package/dist/src/lib/utils/TemplateUtils.js +6 -2
- package/dist/src/lib/utils/UrlValidator.js +205 -0
- package/dist/src/mcp-server.js +0 -0
- package/dist/tests/client.test.js +1 -1
- package/dist/tests/fetch.test.js +0 -0
- package/dist/tests/fetchers/node/HttpClient.test.js +50 -0
- package/dist/tests/i18n-missing-keys.js +0 -0
- package/dist/tests/i18n-unused-keys.js +0 -0
- package/dist/tests/i18n.test.js +0 -0
- package/dist/tests/logger.test.js +0 -0
- package/dist/tests/mcp-server.test.js +0 -0
- package/dist/tests/setup.js +0 -0
- package/dist/tests/test-direct-client.js +0 -0
- package/dist/tests/test-extract-single.js +389 -0
- package/dist/tests/test-i18n.js +0 -0
- package/dist/tests/test-mcp-methods.js +0 -0
- package/dist/tests/test-mcp.js +0 -0
- package/dist/tests/test-mini4k.js +0 -0
- package/dist/tests/types.test.js +0 -0
- package/dist/tests/utils/ContentExtractor.test.js +173 -0
- package/dist/tests/utils/ContentProcessor.test.js +136 -0
- package/dist/tests/utils/TemplateUtils.test.js +118 -0
- package/dist/tests/utils/UrlValidator.test.js +58 -0
- package/package.json +33 -25
- package/dist/i18n-test-report.json +0 -8
- package/dist/i18n-unused-keys-report.json +0 -8
- package/dist/src/lib/BrowserFetcher.js +0 -787
- package/dist/src/lib/NodeFetcher.js +0 -492
- package/dist/src/lib/i18n/keys.js +0 -529
- package/dist/src/test-i18n.js +0 -139
- package/dist/tests/BrowserFetcher.test.js +0 -951
- package/dist/tests/NodeFetcher.test.js +0 -263
- package/dist/tests/i18n-remove-unused-keys.js +0 -236
- package/dist/tests/i18n-test-report.json +0 -2004
- package/dist/tests/src/lib/i18n/index.js +0 -108
- package/dist/tests/src/lib/i18n/keys/base.js +0 -47
- package/dist/tests/src/lib/i18n/keys/browser.js +0 -93
- package/dist/tests/src/lib/i18n/keys/client.js +0 -70
- package/dist/tests/src/lib/i18n/keys/errors.js +0 -34
- package/dist/tests/src/lib/i18n/keys/fetcher.js +0 -84
- package/dist/tests/src/lib/i18n/keys/index.js +0 -31
- package/dist/tests/src/lib/i18n/keys/node.js +0 -56
- package/dist/tests/src/lib/i18n/keys/prompts.js +0 -82
- package/dist/tests/src/lib/i18n/keys/resources.js +0 -50
- package/dist/tests/src/lib/i18n/keys/server.js +0 -64
- package/dist/tests/src/lib/i18n/keys/tools.js +0 -34
- package/dist/tests/src/lib/i18n/locales/en/browser.js +0 -88
- package/dist/tests/src/lib/i18n/locales/en/client.js +0 -66
- package/dist/tests/src/lib/i18n/locales/en/errors.js +0 -28
- package/dist/tests/src/lib/i18n/locales/en/fetcher.js +0 -71
- package/dist/tests/src/lib/i18n/locales/en/index.js +0 -29
- package/dist/tests/src/lib/i18n/locales/en/node.js +0 -51
- package/dist/tests/src/lib/i18n/locales/en/prompts.js +0 -52
- package/dist/tests/src/lib/i18n/locales/en/resources.js +0 -50
- package/dist/tests/src/lib/i18n/locales/en/server.js +0 -56
- package/dist/tests/src/lib/i18n/locales/en/tools.js +0 -28
- package/dist/tests/src/lib/i18n/locales/zh/browser.js +0 -87
- package/dist/tests/src/lib/i18n/locales/zh/client.js +0 -66
- package/dist/tests/src/lib/i18n/locales/zh/errors.js +0 -28
- package/dist/tests/src/lib/i18n/locales/zh/fetcher.js +0 -71
- package/dist/tests/src/lib/i18n/locales/zh/index.js +0 -29
- package/dist/tests/src/lib/i18n/locales/zh/node.js +0 -51
- package/dist/tests/src/lib/i18n/locales/zh/prompts.js +0 -53
- package/dist/tests/src/lib/i18n/locales/zh/resources.js +0 -50
- package/dist/tests/src/lib/i18n/locales/zh/server.js +0 -57
- package/dist/tests/src/lib/i18n/locales/zh/tools.js +0 -28
- package/dist/tests/src/lib/i18n/logger.js +0 -114
- package/dist/tests/src/lib/logger.js +0 -181
- package/dist/tests/tests/test-i18n.js +0 -588
- package/dist/vitest.config.js +0 -29
|
@@ -1,529 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
-
* Co-Author: AI Assistant (Claude)
|
|
4
|
-
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* 创建键名生成器 - 用于生成特定模块的键名 (Create key name generator - for generating key names for specific modules)
|
|
8
|
-
* @param module 模块名称 (Module name)
|
|
9
|
-
* @returns 键名生成函数 (Key name generator function)
|
|
10
|
-
*/
|
|
11
|
-
const createKeyGenerator = (module) => (key) => `${module}.${key}`;
|
|
12
|
-
/**
|
|
13
|
-
* 创建资源操作键 - 用于生成资源操作相关的键 (Create resource operation keys - for generating resource operation related keys)
|
|
14
|
-
* @param module 模块名称 (Module name)
|
|
15
|
-
* @param operation 操作名称 (Operation name)
|
|
16
|
-
* @returns 资源操作键对象 (Resource operation keys object)
|
|
17
|
-
*/
|
|
18
|
-
const createResourceOperationKeys = (module, operation) => {
|
|
19
|
-
const keyGen = createKeyGenerator(`${module}.${operation}`);
|
|
20
|
-
return {
|
|
21
|
-
request: keyGen('request'),
|
|
22
|
-
success: keyGen('success'),
|
|
23
|
-
error: keyGen('error'),
|
|
24
|
-
notFound: keyGen('notFound'),
|
|
25
|
-
duplicate: keyGen('duplicate')
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* 创建资源键 - 用于生成资源相关的键 (Create resource keys - for generating resource related keys)
|
|
30
|
-
* @param module 模块名称 (Module name)
|
|
31
|
-
* @returns 资源键对象 (Resource keys object)
|
|
32
|
-
*/
|
|
33
|
-
const createResourceKeys = (module) => {
|
|
34
|
-
return {
|
|
35
|
-
list: createResourceOperationKeys(module, 'list'),
|
|
36
|
-
get: createResourceOperationKeys(module, 'get'),
|
|
37
|
-
create: createResourceOperationKeys(module, 'create'),
|
|
38
|
-
update: createResourceOperationKeys(module, 'update'),
|
|
39
|
-
delete: createResourceOperationKeys(module, 'delete')
|
|
40
|
-
};
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* 获取器相关键 (Fetcher related keys)
|
|
44
|
-
*/
|
|
45
|
-
export const FETCHER_KEYS = (() => {
|
|
46
|
-
const keyGen = createKeyGenerator('fetcher');
|
|
47
|
-
return {
|
|
48
|
-
// 延迟相关 (Delay related)
|
|
49
|
-
addingDelay: keyGen('addingDelay'),
|
|
50
|
-
delayCompleted: keyGen('delayCompleted'),
|
|
51
|
-
// 代理相关 (Proxy related)
|
|
52
|
-
usingProxy: keyGen('usingProxy'),
|
|
53
|
-
usingSpecifiedProxy: keyGen('usingSpecifiedProxy'),
|
|
54
|
-
attemptingToUseSystemProxy: keyGen('attemptingToUseSystemProxy'),
|
|
55
|
-
notUsingProxy: keyGen('notUsingProxy'),
|
|
56
|
-
finalProxyUsed: keyGen('finalProxyUsed'),
|
|
57
|
-
noProxy: keyGen('noProxy'),
|
|
58
|
-
usingHttpsProxy: keyGen('usingHttpsProxy'),
|
|
59
|
-
usingHttpProxy: keyGen('usingHttpProxy'),
|
|
60
|
-
// 请求相关 (Request related)
|
|
61
|
-
fetchingUrl: keyGen('fetchingUrl'),
|
|
62
|
-
usingUserAgent: keyGen('usingUserAgent'),
|
|
63
|
-
requestOptions: keyGen('requestOptions'),
|
|
64
|
-
startingFetch: keyGen('startingFetch'),
|
|
65
|
-
fetchCompleted: keyGen('fetchCompleted'),
|
|
66
|
-
// 响应相关 (Response related)
|
|
67
|
-
responseStatus: keyGen('responseStatus'),
|
|
68
|
-
redirectingTo: keyGen('redirectingTo'),
|
|
69
|
-
constructedFullRedirectUrl: keyGen('constructedFullRedirectUrl'),
|
|
70
|
-
requestSuccess: keyGen('requestSuccess'),
|
|
71
|
-
// 错误相关 (Error related)
|
|
72
|
-
errorResponse: keyGen('errorResponse'),
|
|
73
|
-
errorResponseBody: keyGen('errorResponseBody'),
|
|
74
|
-
errorReadingBody: keyGen('errorReadingBody'),
|
|
75
|
-
fetchError: keyGen('fetchError'),
|
|
76
|
-
requestAborted: keyGen('requestAborted'),
|
|
77
|
-
networkError: keyGen('networkError'),
|
|
78
|
-
requestTimeout: keyGen('requestTimeout'),
|
|
79
|
-
fetchFailed: keyGen('fetchFailed'),
|
|
80
|
-
tooManyRedirects: keyGen('tooManyRedirects'),
|
|
81
|
-
// 内容类型相关 (Content type related)
|
|
82
|
-
startingHtmlFetch: keyGen('startingHtmlFetch'),
|
|
83
|
-
readingText: keyGen('readingText'),
|
|
84
|
-
htmlContentLength: keyGen('htmlContentLength'),
|
|
85
|
-
startingJsonFetch: keyGen('startingJsonFetch'),
|
|
86
|
-
parsingJson: keyGen('parsingJson'),
|
|
87
|
-
jsonParsed: keyGen('jsonParsed'),
|
|
88
|
-
jsonParseError: keyGen('jsonParseError'),
|
|
89
|
-
startingTxtFetch: keyGen('startingTxtFetch'),
|
|
90
|
-
textContentLength: keyGen('textContentLength'),
|
|
91
|
-
startingMarkdownFetch: keyGen('startingMarkdownFetch'),
|
|
92
|
-
creatingTurndown: keyGen('creatingTurndown'),
|
|
93
|
-
convertingToMarkdown: keyGen('convertingToMarkdown'),
|
|
94
|
-
markdownContentLength: keyGen('markdownContentLength'),
|
|
95
|
-
// 系统代理相关 (System proxy related)
|
|
96
|
-
checkingProxyEnv: keyGen('checkingProxyEnv'),
|
|
97
|
-
envVarValue: keyGen('envVarValue'),
|
|
98
|
-
foundSystemProxy: keyGen('foundSystemProxy'),
|
|
99
|
-
systemCommandProxySettings: keyGen('systemCommandProxySettings'),
|
|
100
|
-
foundProxyFromCommand: keyGen('foundProxyFromCommand'),
|
|
101
|
-
errorGettingProxyFromCommand: keyGen('errorGettingProxyFromCommand'),
|
|
102
|
-
checkingSystemEnvVars: keyGen('checkingSystemEnvVars'),
|
|
103
|
-
windowsEnvVars: keyGen('windowsEnvVars'),
|
|
104
|
-
foundWindowsEnvProxy: keyGen('foundWindowsEnvProxy'),
|
|
105
|
-
errorGettingWindowsEnvVars: keyGen('errorGettingWindowsEnvVars'),
|
|
106
|
-
unixEnvVars: keyGen('unixEnvVars'),
|
|
107
|
-
foundUnixEnvProxy: keyGen('foundUnixEnvProxy'),
|
|
108
|
-
errorGettingUnixEnvVars: keyGen('errorGettingUnixEnvVars'),
|
|
109
|
-
errorGettingSystemEnvVars: keyGen('errorGettingSystemEnvVars'),
|
|
110
|
-
noSystemProxyFound: keyGen('noSystemProxyFound'),
|
|
111
|
-
// 通用 (General)
|
|
112
|
-
notSet: keyGen('notSet'),
|
|
113
|
-
debug: keyGen('debug'),
|
|
114
|
-
none: keyGen('none')
|
|
115
|
-
};
|
|
116
|
-
})();
|
|
117
|
-
/**
|
|
118
|
-
* 浏览器相关键 (Browser related keys)
|
|
119
|
-
*/
|
|
120
|
-
export const BROWSER_KEYS = (() => {
|
|
121
|
-
const keyGen = createKeyGenerator('browser');
|
|
122
|
-
return {
|
|
123
|
-
// 浏览器生命周期 (Browser lifecycle)
|
|
124
|
-
closing: keyGen('closing'),
|
|
125
|
-
closed: keyGen('closed'),
|
|
126
|
-
starting: keyGen('starting'),
|
|
127
|
-
startingFailed: keyGen('startingFailed'),
|
|
128
|
-
alreadyRunning: keyGen('alreadyRunning'),
|
|
129
|
-
// 页面操作 (Page operations)
|
|
130
|
-
creatingPage: keyGen('creatingPage'),
|
|
131
|
-
navigatingTo: keyGen('navigatingTo'),
|
|
132
|
-
waitingForSelector: keyGen('waitingForSelector'),
|
|
133
|
-
waitingForTimeout: keyGen('waitingForTimeout'),
|
|
134
|
-
scrollingToBottom: keyGen('scrollingToBottom'),
|
|
135
|
-
gettingContent: keyGen('gettingContent'),
|
|
136
|
-
contentLength: keyGen('contentLength'),
|
|
137
|
-
// Cookie 相关 (Cookie related)
|
|
138
|
-
savingCookies: keyGen('savingCookies'),
|
|
139
|
-
cookiesSaved: keyGen('cookiesSaved'),
|
|
140
|
-
loadingCookies: keyGen('loadingCookies'),
|
|
141
|
-
cookiesLoaded: keyGen('cookiesLoaded'),
|
|
142
|
-
noCookiesFound: keyGen('noCookiesFound'),
|
|
143
|
-
// 错误相关 (Error related)
|
|
144
|
-
errorLoadingCookies: keyGen('errorLoadingCookies'),
|
|
145
|
-
errorSavingCookies: keyGen('errorSavingCookies'),
|
|
146
|
-
errorNavigating: keyGen('errorNavigating'),
|
|
147
|
-
errorGettingContent: keyGen('errorGettingContent'),
|
|
148
|
-
errorClosingBrowser: keyGen('errorClosingBrowser'),
|
|
149
|
-
errorCreatingPage: keyGen('errorCreatingPage'),
|
|
150
|
-
closingError: keyGen('closingError'),
|
|
151
|
-
// 额外的浏览器相关键 (Additional browser related keys)
|
|
152
|
-
waiting: keyGen('waiting'),
|
|
153
|
-
startupSuccess: keyGen('startupSuccess'),
|
|
154
|
-
navigating: keyGen('navigating'),
|
|
155
|
-
scrolling: keyGen('scrolling'),
|
|
156
|
-
scrollCompleted: keyGen('scrollCompleted'),
|
|
157
|
-
contentTruncated: keyGen('contentTruncated'),
|
|
158
|
-
pageClosed: keyGen('pageClosed'),
|
|
159
|
-
fetchError: keyGen('fetchError'),
|
|
160
|
-
highMemory: keyGen('highMemory'),
|
|
161
|
-
closingDueToMemory: keyGen('closingDueToMemory'),
|
|
162
|
-
forcingGC: keyGen('forcingGC'),
|
|
163
|
-
memoryCheckError: keyGen('memoryCheckError'),
|
|
164
|
-
usingCookies: keyGen('usingCookies'),
|
|
165
|
-
usingProxy: keyGen('usingProxy'),
|
|
166
|
-
// Cloudflare 相关 (Cloudflare related)
|
|
167
|
-
checkingCloudflare: keyGen('checkingCloudflare'),
|
|
168
|
-
cloudflareDetected: keyGen('cloudflareDetected'),
|
|
169
|
-
simulatingHuman: keyGen('simulatingHuman'),
|
|
170
|
-
simulatingHumanError: keyGen('simulatingHumanError'),
|
|
171
|
-
stillOnCloudflare: keyGen('stillOnCloudflare'),
|
|
172
|
-
bypassFailed: keyGen('bypassFailed'),
|
|
173
|
-
cloudflareError: keyGen('cloudflareError'),
|
|
174
|
-
continuingWithoutBypass: keyGen('continuingWithoutBypass'),
|
|
175
|
-
unableToBypassCloudflare: keyGen('unableToBypassCloudflare'),
|
|
176
|
-
// 获取和重试相关 (Fetch and retry related)
|
|
177
|
-
fetchingWithRetry: keyGen('fetchingWithRetry'),
|
|
178
|
-
memoryUsage: keyGen('memoryUsage'),
|
|
179
|
-
memoryTooHigh: keyGen('memoryTooHigh'),
|
|
180
|
-
contentTooLarge: keyGen('contentTooLarge'),
|
|
181
|
-
failedToParseJSON: keyGen('failedToParseJSON'),
|
|
182
|
-
startingBrowserFetchForMarkdown: keyGen('startingBrowserFetchForMarkdown'),
|
|
183
|
-
errorInBrowserFetchForMarkdown: keyGen('errorInBrowserFetchForMarkdown'),
|
|
184
|
-
fetchRequest: keyGen('fetchRequest'),
|
|
185
|
-
usingStoredCookies: keyGen('usingStoredCookies'),
|
|
186
|
-
closingInstance: keyGen('closingInstance'),
|
|
187
|
-
fetchErrorWithAttempt: keyGen('fetchErrorWithAttempt'),
|
|
188
|
-
retryingAfterDelay: keyGen('retryingAfterDelay'),
|
|
189
|
-
// 浏览器启动相关 (Browser startup related)
|
|
190
|
-
browserStartupSuccess: keyGen('browserStartupSuccess'),
|
|
191
|
-
browserStartupFailed: keyGen('browserStartupFailed'),
|
|
192
|
-
usingCustomChromePath: keyGen('usingCustomChromePath'),
|
|
193
|
-
browserDisconnected: keyGen('browserDisconnected'),
|
|
194
|
-
waitingForBrowserStart: keyGen('waitingForBrowserStart'),
|
|
195
|
-
reusingExistingBrowser: keyGen('reusingExistingBrowser'),
|
|
196
|
-
startingBrowser: keyGen('startingBrowser'),
|
|
197
|
-
browserStarted: keyGen('browserStarted'),
|
|
198
|
-
browserStartError: keyGen('browserStartError')
|
|
199
|
-
};
|
|
200
|
-
})();
|
|
201
|
-
/**
|
|
202
|
-
* 资源相关键 (Resources related keys)
|
|
203
|
-
*/
|
|
204
|
-
export const RESOURCES_KEYS = (() => {
|
|
205
|
-
const keyGen = createKeyGenerator('resources');
|
|
206
|
-
const resourceKeys = createResourceKeys('resources');
|
|
207
|
-
return {
|
|
208
|
-
...resourceKeys,
|
|
209
|
-
// 额外的资源相关键 (Additional resource related keys)
|
|
210
|
-
fileReadError: keyGen('fileReadError'),
|
|
211
|
-
invalidUri: keyGen('invalidUri'),
|
|
212
|
-
notFound: keyGen('notFound'),
|
|
213
|
-
// 资源描述 (Resource descriptions)
|
|
214
|
-
readme: {
|
|
215
|
-
description: keyGen('readme.description')
|
|
216
|
-
},
|
|
217
|
-
package: {
|
|
218
|
-
description: keyGen('package.description')
|
|
219
|
-
},
|
|
220
|
-
index: {
|
|
221
|
-
description: keyGen('index.description')
|
|
222
|
-
},
|
|
223
|
-
client: {
|
|
224
|
-
description: keyGen('client.description')
|
|
225
|
-
},
|
|
226
|
-
// 资源模板描述 (Resource template descriptions)
|
|
227
|
-
sourceFile: {
|
|
228
|
-
name: keyGen('sourceFile.name'),
|
|
229
|
-
description: keyGen('sourceFile.description')
|
|
230
|
-
},
|
|
231
|
-
docFile: {
|
|
232
|
-
name: keyGen('docFile.name'),
|
|
233
|
-
description: keyGen('docFile.description')
|
|
234
|
-
},
|
|
235
|
-
filename: {
|
|
236
|
-
description: keyGen('filename.description')
|
|
237
|
-
}
|
|
238
|
-
};
|
|
239
|
-
})();
|
|
240
|
-
/**
|
|
241
|
-
* 服务器相关键 (Server related keys)
|
|
242
|
-
*/
|
|
243
|
-
export const SERVER_KEYS = (() => {
|
|
244
|
-
const keyGen = createKeyGenerator('server');
|
|
245
|
-
return {
|
|
246
|
-
// 服务器状态相关 (Server status related)
|
|
247
|
-
starting: keyGen('starting'),
|
|
248
|
-
started: keyGen('started'),
|
|
249
|
-
stopping: keyGen('stopping'),
|
|
250
|
-
stopped: keyGen('stopped'),
|
|
251
|
-
error: keyGen('error'),
|
|
252
|
-
// 连接相关 (Connection related)
|
|
253
|
-
connecting: keyGen('connecting'),
|
|
254
|
-
connected: keyGen('connected'),
|
|
255
|
-
connectionError: keyGen('connectionError'),
|
|
256
|
-
disconnected: keyGen('disconnected'),
|
|
257
|
-
// 请求处理相关 (Request handling related)
|
|
258
|
-
requestReceived: keyGen('requestReceived'),
|
|
259
|
-
requestProcessed: keyGen('requestProcessed'),
|
|
260
|
-
requestError: keyGen('requestError'),
|
|
261
|
-
// 浏览器相关 (Browser related)
|
|
262
|
-
browser: {
|
|
263
|
-
initializing: keyGen('browser.initializing'),
|
|
264
|
-
initialized: keyGen('browser.initialized'),
|
|
265
|
-
error: keyGen('browser.error'),
|
|
266
|
-
closing: keyGen('browser.closing'),
|
|
267
|
-
closed: keyGen('browser.closed')
|
|
268
|
-
},
|
|
269
|
-
// 工具相关 (Tool related)
|
|
270
|
-
tool: {
|
|
271
|
-
requestReceived: keyGen('tool.requestReceived'),
|
|
272
|
-
requestProcessed: keyGen('tool.requestProcessed'),
|
|
273
|
-
requestError: keyGen('tool.requestError')
|
|
274
|
-
},
|
|
275
|
-
// 原有键 (Original keys)
|
|
276
|
-
receivedRequest: keyGen('receivedRequest'),
|
|
277
|
-
processingRequest: keyGen('processingRequest'),
|
|
278
|
-
requestCompleted: keyGen('requestCompleted'),
|
|
279
|
-
requestFailed: keyGen('requestFailed'),
|
|
280
|
-
receivedInterruptSignal: keyGen('receivedInterruptSignal'),
|
|
281
|
-
receivedTerminateSignal: keyGen('receivedTerminateSignal'),
|
|
282
|
-
uncaughtException: keyGen('uncaughtException'),
|
|
283
|
-
debug: keyGen('debug'),
|
|
284
|
-
listeningOn: keyGen('listeningOn'),
|
|
285
|
-
// 新增的翻译键 (New translation keys)
|
|
286
|
-
initializingBrowser: keyGen('initializingBrowser'),
|
|
287
|
-
closingBrowser: keyGen('closingBrowser'),
|
|
288
|
-
receivedToolRequest: keyGen('receivedToolRequest'),
|
|
289
|
-
processingToolRequestError: keyGen('processingToolRequestError'),
|
|
290
|
-
usingBrowserMode: keyGen('usingBrowserMode'),
|
|
291
|
-
usingAutoDetectMode: keyGen('usingAutoDetectMode'),
|
|
292
|
-
switchingToBrowserMode: keyGen('switchingToBrowserMode'),
|
|
293
|
-
fetchError: keyGen('fetchError')
|
|
294
|
-
};
|
|
295
|
-
})();
|
|
296
|
-
/**
|
|
297
|
-
* 客户端相关键 (Client related keys)
|
|
298
|
-
*/
|
|
299
|
-
export const CLIENT_KEYS = (() => {
|
|
300
|
-
const keyGen = createKeyGenerator('client');
|
|
301
|
-
return {
|
|
302
|
-
connecting: keyGen('connecting'),
|
|
303
|
-
connected: keyGen('connected'),
|
|
304
|
-
disconnecting: keyGen('disconnecting'),
|
|
305
|
-
disconnected: keyGen('disconnected'),
|
|
306
|
-
error: keyGen('error'),
|
|
307
|
-
callTool: keyGen('callTool'),
|
|
308
|
-
callToolSuccess: keyGen('callToolSuccess'),
|
|
309
|
-
callToolError: keyGen('callToolError'),
|
|
310
|
-
statusCodeDetected: keyGen('statusCodeDetected'),
|
|
311
|
-
usageInfo: keyGen('usageInfo'),
|
|
312
|
-
exampleUsage: keyGen('exampleUsage'),
|
|
313
|
-
invalidJson: keyGen('invalidJson'),
|
|
314
|
-
usingCommandLineProxy: keyGen('usingCommandLineProxy'),
|
|
315
|
-
invalidProxyFormat: keyGen('invalidProxyFormat'),
|
|
316
|
-
usingEnvProxy: keyGen('usingEnvProxy'),
|
|
317
|
-
usingShellProxy: keyGen('usingShellProxy'),
|
|
318
|
-
noShellProxy: keyGen('noShellProxy'),
|
|
319
|
-
systemProxyDisabled: keyGen('systemProxyDisabled'),
|
|
320
|
-
usingSystemProxy: keyGen('usingSystemProxy'),
|
|
321
|
-
noSystemProxy: keyGen('noSystemProxy'),
|
|
322
|
-
requestFailed: keyGen('requestFailed'),
|
|
323
|
-
fatalError: keyGen('fatalError'),
|
|
324
|
-
startingServer: keyGen('startingServer'),
|
|
325
|
-
fetchingUrl: keyGen('fetchingUrl'),
|
|
326
|
-
usingMode: keyGen('usingMode'),
|
|
327
|
-
fetchFailed: keyGen('fetchFailed'),
|
|
328
|
-
fetchSuccess: keyGen('fetchSuccess'),
|
|
329
|
-
browserModeNeeded: keyGen('browserModeNeeded'),
|
|
330
|
-
retryingWithBrowser: keyGen('retryingWithBrowser'),
|
|
331
|
-
browserModeFetchFailed: keyGen('browserModeFetchFailed'),
|
|
332
|
-
browserModeFetchSuccess: keyGen('browserModeFetchSuccess'),
|
|
333
|
-
serverClosed: keyGen('serverClosed'),
|
|
334
|
-
proxySet: keyGen('proxySet')
|
|
335
|
-
};
|
|
336
|
-
})();
|
|
337
|
-
/**
|
|
338
|
-
* 错误相关键 (Error related keys)
|
|
339
|
-
*/
|
|
340
|
-
export const ERROR_KEYS = (() => {
|
|
341
|
-
const keyGen = createKeyGenerator('error');
|
|
342
|
-
return {
|
|
343
|
-
unexpected: keyGen('unexpected'),
|
|
344
|
-
validation: keyGen('validation'),
|
|
345
|
-
notFound: keyGen('notFound'),
|
|
346
|
-
unauthorized: keyGen('unauthorized'),
|
|
347
|
-
forbidden: keyGen('forbidden'),
|
|
348
|
-
timeout: keyGen('timeout'),
|
|
349
|
-
// 通用错误消息 (Common error messages)
|
|
350
|
-
missingUrl: keyGen('missingUrl'),
|
|
351
|
-
invalidUrl: keyGen('invalidUrl'),
|
|
352
|
-
networkError: keyGen('networkError'),
|
|
353
|
-
browserError: keyGen('browserError'),
|
|
354
|
-
unexpectedError: keyGen('unexpectedError'),
|
|
355
|
-
cloudflareProtection: keyGen('cloudflareProtection'),
|
|
356
|
-
captchaRequired: keyGen('captchaRequired'),
|
|
357
|
-
connectionProblem: keyGen('connectionProblem')
|
|
358
|
-
};
|
|
359
|
-
})();
|
|
360
|
-
/**
|
|
361
|
-
* 工具相关键 (Tools related keys)
|
|
362
|
-
*/
|
|
363
|
-
export const TOOLS_KEYS = (() => {
|
|
364
|
-
const keyGen = createKeyGenerator('tools');
|
|
365
|
-
return {
|
|
366
|
-
fetchHtml: {
|
|
367
|
-
description: keyGen('fetchHtml.description'),
|
|
368
|
-
error: keyGen('fetchHtml.error')
|
|
369
|
-
},
|
|
370
|
-
fetchJson: {
|
|
371
|
-
description: keyGen('fetchJson.description'),
|
|
372
|
-
error: keyGen('fetchJson.error'),
|
|
373
|
-
invalidJson: keyGen('fetchJson.invalidJson')
|
|
374
|
-
},
|
|
375
|
-
fetchTxt: {
|
|
376
|
-
description: keyGen('fetchTxt.description'),
|
|
377
|
-
error: keyGen('fetchTxt.error')
|
|
378
|
-
},
|
|
379
|
-
fetchMarkdown: {
|
|
380
|
-
description: keyGen('fetchMarkdown.description'),
|
|
381
|
-
error: keyGen('fetchMarkdown.error')
|
|
382
|
-
}
|
|
383
|
-
};
|
|
384
|
-
})();
|
|
385
|
-
/**
|
|
386
|
-
* 提示相关键 (Prompts related keys)
|
|
387
|
-
*/
|
|
388
|
-
export const PROMPTS_KEYS = (() => {
|
|
389
|
-
const keyGen = createKeyGenerator('prompts');
|
|
390
|
-
return {
|
|
391
|
-
// 提示列表和获取 (Prompt list and get)
|
|
392
|
-
list: {
|
|
393
|
-
request: keyGen('list.request')
|
|
394
|
-
},
|
|
395
|
-
get: {
|
|
396
|
-
request: keyGen('get.request')
|
|
397
|
-
},
|
|
398
|
-
// 错误消息 (Error messages)
|
|
399
|
-
notFound: keyGen('notFound'),
|
|
400
|
-
missingRequiredArg: keyGen('missingRequiredArg'),
|
|
401
|
-
useBrowserValue: keyGen('useBrowserValue'),
|
|
402
|
-
// 通用提示 (Generic prompt)
|
|
403
|
-
generic: {
|
|
404
|
-
result: keyGen('generic.result'),
|
|
405
|
-
message: keyGen('generic.message'),
|
|
406
|
-
args: keyGen('generic.args')
|
|
407
|
-
},
|
|
408
|
-
// 是/否 (Yes/No)
|
|
409
|
-
yes: keyGen('yes'),
|
|
410
|
-
no: keyGen('no'),
|
|
411
|
-
// 提示描述和参数 (Prompt descriptions and parameters)
|
|
412
|
-
url: {
|
|
413
|
-
description: keyGen('url.description')
|
|
414
|
-
},
|
|
415
|
-
format: {
|
|
416
|
-
description: keyGen('format.description')
|
|
417
|
-
},
|
|
418
|
-
useBrowser: {
|
|
419
|
-
description: keyGen('useBrowser.description')
|
|
420
|
-
},
|
|
421
|
-
selector: {
|
|
422
|
-
description: keyGen('selector.description')
|
|
423
|
-
},
|
|
424
|
-
dataType: {
|
|
425
|
-
description: keyGen('dataType.description')
|
|
426
|
-
},
|
|
427
|
-
error: {
|
|
428
|
-
description: keyGen('error.description')
|
|
429
|
-
},
|
|
430
|
-
// 获取网站提示 (Fetch website prompt)
|
|
431
|
-
fetchWebsite: {
|
|
432
|
-
description: keyGen('fetchWebsite.description'),
|
|
433
|
-
result: keyGen('fetchWebsite.result'),
|
|
434
|
-
message: keyGen('fetchWebsite.message'),
|
|
435
|
-
response: keyGen('fetchWebsite.response'),
|
|
436
|
-
instruction: keyGen('fetchWebsite.instruction'),
|
|
437
|
-
formatInstruction: keyGen('fetchWebsite.formatInstruction'),
|
|
438
|
-
browserInstruction: keyGen('fetchWebsite.browserInstruction')
|
|
439
|
-
},
|
|
440
|
-
// 提取内容提示 (Extract content prompt)
|
|
441
|
-
extractContent: {
|
|
442
|
-
description: keyGen('extractContent.description'),
|
|
443
|
-
result: keyGen('extractContent.result'),
|
|
444
|
-
message: keyGen('extractContent.message'),
|
|
445
|
-
selectorInstruction: keyGen('extractContent.selectorInstruction'),
|
|
446
|
-
dataTypeInstruction: keyGen('extractContent.dataTypeInstruction')
|
|
447
|
-
},
|
|
448
|
-
// 调试获取提示 (Debug fetch prompt)
|
|
449
|
-
debugFetch: {
|
|
450
|
-
description: keyGen('debugFetch.description'),
|
|
451
|
-
result: keyGen('debugFetch.result'),
|
|
452
|
-
message: keyGen('debugFetch.message'),
|
|
453
|
-
errorDetails: keyGen('debugFetch.errorDetails'),
|
|
454
|
-
instruction: keyGen('debugFetch.instruction')
|
|
455
|
-
}
|
|
456
|
-
};
|
|
457
|
-
})();
|
|
458
|
-
/**
|
|
459
|
-
* 节点相关键 (Node related keys)
|
|
460
|
-
*/
|
|
461
|
-
export const NODE_KEYS = (() => {
|
|
462
|
-
const keyGen = createKeyGenerator('node');
|
|
463
|
-
return {
|
|
464
|
-
// 延迟和代理相关 (Delay and proxy related)
|
|
465
|
-
addingDelay: keyGen('addingDelay'),
|
|
466
|
-
noProxy: keyGen('noProxy'),
|
|
467
|
-
usingProxy: keyGen('usingProxy'),
|
|
468
|
-
usingHttpsProxy: keyGen('usingHttpsProxy'),
|
|
469
|
-
usingHttpProxy: keyGen('usingHttpProxy'),
|
|
470
|
-
// 请求相关 (Request related)
|
|
471
|
-
usingUserAgent: keyGen('usingUserAgent'),
|
|
472
|
-
requestDetails: keyGen('requestDetails'),
|
|
473
|
-
requestOptions: keyGen('requestOptions'),
|
|
474
|
-
startingFetch: keyGen('startingFetch'),
|
|
475
|
-
fetchingUrl: keyGen('fetchingUrl'),
|
|
476
|
-
// 响应相关 (Response related)
|
|
477
|
-
responseStatus: keyGen('responseStatus'),
|
|
478
|
-
redirectingTo: keyGen('redirectingTo'),
|
|
479
|
-
constructedFullRedirectUrl: keyGen('constructedFullRedirectUrl'),
|
|
480
|
-
requestSuccess: keyGen('requestSuccess'),
|
|
481
|
-
// 错误相关 (Error related)
|
|
482
|
-
errorResponse: keyGen('errorResponse'),
|
|
483
|
-
errorResponseBody: keyGen('errorResponseBody'),
|
|
484
|
-
errorReadingBody: keyGen('errorReadingBody'),
|
|
485
|
-
fetchError: keyGen('fetchError'),
|
|
486
|
-
requestAborted: keyGen('requestAborted'),
|
|
487
|
-
networkError: keyGen('networkError'),
|
|
488
|
-
tooManyRedirects: keyGen('tooManyRedirects'),
|
|
489
|
-
// 内容类型相关 (Content type related)
|
|
490
|
-
startingHtmlFetch: keyGen('startingHtmlFetch'),
|
|
491
|
-
readingText: keyGen('readingText'),
|
|
492
|
-
htmlContentLength: keyGen('htmlContentLength'),
|
|
493
|
-
htmlFetchError: keyGen('htmlFetchError'),
|
|
494
|
-
startingJsonFetch: keyGen('startingJsonFetch'),
|
|
495
|
-
parsingJson: keyGen('parsingJson'),
|
|
496
|
-
jsonParsed: keyGen('jsonParsed'),
|
|
497
|
-
jsonParseError: keyGen('jsonParseError'),
|
|
498
|
-
jsonFetchError: keyGen('jsonFetchError'),
|
|
499
|
-
startingTxtFetch: keyGen('startingTxtFetch'),
|
|
500
|
-
startingMarkdownFetch: keyGen('startingMarkdownFetch'),
|
|
501
|
-
creatingTurndown: keyGen('creatingTurndown'),
|
|
502
|
-
convertingToMarkdown: keyGen('convertingToMarkdown')
|
|
503
|
-
};
|
|
504
|
-
})();
|
|
505
|
-
/**
|
|
506
|
-
* 处理器相关键 (Processor related keys)
|
|
507
|
-
*/
|
|
508
|
-
export const PROCESSOR_KEYS = (() => {
|
|
509
|
-
const keyGen = createKeyGenerator('processor');
|
|
510
|
-
return {
|
|
511
|
-
// HTML转Markdown相关 (HTML to Markdown related)
|
|
512
|
-
creatingTurndown: keyGen('creatingTurndown'),
|
|
513
|
-
convertingToMarkdown: keyGen('convertingToMarkdown'),
|
|
514
|
-
markdownContentLength: keyGen('markdownContentLength'),
|
|
515
|
-
// HTML转纯文本相关 (HTML to plain text related)
|
|
516
|
-
creatingHtmlToText: keyGen('creatingHtmlToText'),
|
|
517
|
-
convertingToText: keyGen('convertingToText'),
|
|
518
|
-
textContentLength: keyGen('textContentLength'),
|
|
519
|
-
// JSON处理相关 (JSON processing related)
|
|
520
|
-
parsingJson: keyGen('parsingJson'),
|
|
521
|
-
jsonParsed: keyGen('jsonParsed'),
|
|
522
|
-
jsonParseError: keyGen('jsonParseError'),
|
|
523
|
-
// 文本处理相关 (Text processing related)
|
|
524
|
-
processingText: keyGen('processingText'),
|
|
525
|
-
// 内容大小验证相关 (Content size validation related)
|
|
526
|
-
contentTooLarge: keyGen('contentTooLarge'),
|
|
527
|
-
contentSizeOk: keyGen('contentSizeOk'),
|
|
528
|
-
};
|
|
529
|
-
})();
|
package/dist/src/test-i18n.js
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Author: Martin <lmccc.dev@gmail.com>
|
|
3
|
-
* Co-Author: AI Assistant (Claude)
|
|
4
|
-
* Description: This code was collaboratively developed by Martin and AI Assistant.
|
|
5
|
-
*/
|
|
6
|
-
// 测试国际化功能 (Test internationalization functionality)
|
|
7
|
-
import { log, COMPONENTS, clearTranslationCache } from './lib/logger.js';
|
|
8
|
-
import { t, changeLanguage, getCurrentLanguage } from './lib/i18n/index.js';
|
|
9
|
-
/**
|
|
10
|
-
* 测试翻译键 (Test translation keys)
|
|
11
|
-
* @param keys 要测试的键数组 (Array of keys to test)
|
|
12
|
-
* @param language 语言 (Language)
|
|
13
|
-
*/
|
|
14
|
-
function testKeys(keys, language) {
|
|
15
|
-
console.log(`\n=== 测试 ${language} 翻译 (Testing ${language} translation) ===`);
|
|
16
|
-
for (const key of keys) {
|
|
17
|
-
try {
|
|
18
|
-
const translated = t(key);
|
|
19
|
-
console.log(`Key: ${key}`);
|
|
20
|
-
console.log(`Translation: ${translated}`);
|
|
21
|
-
console.log('---');
|
|
22
|
-
}
|
|
23
|
-
catch (error) {
|
|
24
|
-
console.error(`Error translating key: ${key}`);
|
|
25
|
-
console.error(error);
|
|
26
|
-
console.log('---');
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 测试日志函数 (Test log function)
|
|
32
|
-
* @param keys 要测试的键数组 (Array of keys to test)
|
|
33
|
-
* @param component 组件名称 (Component name)
|
|
34
|
-
*/
|
|
35
|
-
function testLogFunction(keys, component) {
|
|
36
|
-
console.log(`\n=== 测试日志函数 (Testing log function) ===`);
|
|
37
|
-
for (const key of keys) {
|
|
38
|
-
log(key, true, {}, component);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* 测试带参数的翻译 (Test translation with parameters)
|
|
43
|
-
* @param keys 要测试的键数组 (Array of keys to test)
|
|
44
|
-
* @param params 参数对象 (Parameters object)
|
|
45
|
-
*/
|
|
46
|
-
function testWithParams(keys, params) {
|
|
47
|
-
console.log(`\n=== 测试带参数的翻译 (Testing translation with parameters) ===`);
|
|
48
|
-
for (const key of keys) {
|
|
49
|
-
try {
|
|
50
|
-
const translated = t(key, params);
|
|
51
|
-
console.log(`Key: ${key}`);
|
|
52
|
-
console.log(`Params: ${JSON.stringify(params)}`);
|
|
53
|
-
console.log(`Translation: ${translated}`);
|
|
54
|
-
console.log('---');
|
|
55
|
-
}
|
|
56
|
-
catch (error) {
|
|
57
|
-
console.error(`Error translating key with params: ${key}`);
|
|
58
|
-
console.error(error);
|
|
59
|
-
console.log('---');
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
/**
|
|
64
|
-
* 测试翻译缓存 (Test translation cache)
|
|
65
|
-
* @param key 要测试的键 (Key to test)
|
|
66
|
-
* @param iterations 迭代次数 (Number of iterations)
|
|
67
|
-
*/
|
|
68
|
-
function testTranslationCache(key, iterations) {
|
|
69
|
-
console.log(`\n=== 测试翻译缓存 (Testing translation cache) ===`);
|
|
70
|
-
console.log(`Key: ${key}`);
|
|
71
|
-
console.log(`Iterations: ${iterations}`);
|
|
72
|
-
// 清除翻译缓存 (Clear translation cache)
|
|
73
|
-
clearTranslationCache();
|
|
74
|
-
// 测试不使用缓存的性能 (Test performance without cache)
|
|
75
|
-
console.log('Without cache:');
|
|
76
|
-
const startWithoutCache = Date.now();
|
|
77
|
-
for (let i = 0; i < iterations; i++) {
|
|
78
|
-
t(key);
|
|
79
|
-
}
|
|
80
|
-
const endWithoutCache = Date.now();
|
|
81
|
-
console.log(`Time: ${endWithoutCache - startWithoutCache}ms`);
|
|
82
|
-
// 测试使用缓存的性能 (Test performance with cache)
|
|
83
|
-
console.log('With cache:');
|
|
84
|
-
const startWithCache = Date.now();
|
|
85
|
-
for (let i = 0; i < iterations; i++) {
|
|
86
|
-
log(key, true, {}, COMPONENTS.SERVER);
|
|
87
|
-
}
|
|
88
|
-
const endWithCache = Date.now();
|
|
89
|
-
console.log(`Time: ${endWithCache - startWithCache}ms`);
|
|
90
|
-
console.log('---');
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* 设置环境变量 (Set environment variable)
|
|
94
|
-
* @param name 环境变量名称 (Environment variable name)
|
|
95
|
-
* @param value 环境变量值 (Environment variable value)
|
|
96
|
-
*/
|
|
97
|
-
function setEnv(name, value) {
|
|
98
|
-
process.env[name] = value;
|
|
99
|
-
console.log(`Set environment variable ${name}=${value}`);
|
|
100
|
-
}
|
|
101
|
-
/**
|
|
102
|
-
* 主测试函数 (Main test function)
|
|
103
|
-
*/
|
|
104
|
-
async function testI18n() {
|
|
105
|
-
console.log('=== 测试国际化功能 (Testing internationalization functionality) ===');
|
|
106
|
-
// 测试简单的键 (Test simple keys)
|
|
107
|
-
const simpleKeys = [
|
|
108
|
-
'server.starting',
|
|
109
|
-
'server.started',
|
|
110
|
-
'server.stopping',
|
|
111
|
-
'server.stopped'
|
|
112
|
-
];
|
|
113
|
-
// 确保 MCP_LANG 环境变量设置为英文 (Ensure MCP_LANG environment variable is set to English)
|
|
114
|
-
setEnv('MCP_LANG', 'en');
|
|
115
|
-
// 测试英文翻译 (Test English translation)
|
|
116
|
-
changeLanguage('en');
|
|
117
|
-
console.log(`Current language: ${getCurrentLanguage()}`);
|
|
118
|
-
testKeys(simpleKeys, 'English');
|
|
119
|
-
// 测试日志函数 (Test log function)
|
|
120
|
-
testLogFunction(simpleKeys, COMPONENTS.SERVER);
|
|
121
|
-
// 测试带参数的翻译 (Test translation with parameters)
|
|
122
|
-
testWithParams(['server.listeningOn'], { port: 8080 });
|
|
123
|
-
// 测试翻译缓存 (Test translation cache)
|
|
124
|
-
testTranslationCache('server.starting', 10);
|
|
125
|
-
// 确保 MCP_LANG 环境变量设置为中文 (Ensure MCP_LANG environment variable is set to Chinese)
|
|
126
|
-
setEnv('MCP_LANG', 'zh');
|
|
127
|
-
// 测试中文翻译 (Test Chinese translation)
|
|
128
|
-
changeLanguage('zh');
|
|
129
|
-
console.log(`Current language: ${getCurrentLanguage()}`);
|
|
130
|
-
testKeys(simpleKeys, 'Chinese');
|
|
131
|
-
// 测试日志函数 (Test log function)
|
|
132
|
-
testLogFunction(simpleKeys, COMPONENTS.SERVER);
|
|
133
|
-
// 测试带参数的翻译 (Test translation with parameters)
|
|
134
|
-
testWithParams(['server.listeningOn'], { port: 8080 });
|
|
135
|
-
// 测试翻译缓存 (Test translation cache)
|
|
136
|
-
testTranslationCache('server.starting', 10);
|
|
137
|
-
}
|
|
138
|
-
// 运行测试 (Run test)
|
|
139
|
-
testI18n().catch(console.error);
|