├── .gitattributes
├── .github
└── workflows
│ └── ci.yml
├── .gitignore
├── .npmrc
├── .prettierignore
├── .vscode
└── settings.json
├── .yarnrc
├── README.md
├── lib.deno.ns.d.ts
├── package.json
├── typedoc.json
└── yarn.lock
/.gitattributes:
--------------------------------------------------------------------------------
1 | * eol=lf
2 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: ci
2 |
3 | on: [push, pull_request]
4 |
5 | jobs:
6 | deploy:
7 | runs-on: ubuntu-latest
8 | steps:
9 | - uses: actions/checkout@v2
10 | - uses: actions/setup-node@v1
11 | with:
12 | node-version: 12
13 | - run: yarn --frozen-lockfile
14 | - run: yarn format --check
15 | - run: yarn build
16 |
17 | - name: Deploy
18 | if: github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository == 'denodev/typedoc'
19 | uses: peaceiris/actions-gh-pages@v3
20 | with:
21 | github_token: ${{ secrets.GITHUB_TOKEN }}
22 | publish_dir: ./typedoc
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 | npm-debug.log*
5 | yarn-debug.log*
6 | yarn-error.log*
7 |
8 | # Runtime data
9 | pids
10 | *.pid
11 | *.seed
12 | *.pid.lock
13 |
14 | # Dependency directories
15 | node_modules/
16 | jspm_packages/
17 |
18 | # Mac files
19 | .DS_Store
20 |
21 | # Yarn
22 | yarn-error.log
23 | .pnp/
24 | .pnp.js
25 | # Yarn Integrity file
26 | .yarn-integrity
27 |
28 | typedoc
29 |
--------------------------------------------------------------------------------
/.npmrc:
--------------------------------------------------------------------------------
1 | package-lock=false
2 | registry=https://registry.npm.taobao.org
3 |
--------------------------------------------------------------------------------
/.prettierignore:
--------------------------------------------------------------------------------
1 | typedoc
2 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "deno.enable": false
3 | }
4 |
--------------------------------------------------------------------------------
/.yarnrc:
--------------------------------------------------------------------------------
1 | registry "https://registry.npm.taobao.org"
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Deno API 简体中文版
2 |
3 | [](https://github.com/denodev/typedoc/actions)
4 | [](https://github.com/denodev/typedoc/blob/master/LICENSE)
5 | [](https://github.com/denoland/deno)
6 |
7 | Deno 简体中文 API 参考手册。本文档是非官方 Deno 简体中文文档,由中文开发者社区的志愿者们维护。
8 |
9 | 本文档使用了 [typedoc-deno-theme](https://github.com/denodev/typedoc-deno-theme) 主题和 [typedoc-plugin-deno](https://github.com/denodev/typedoc-plugin-deno) 插件,为文档提供了中英文对照功能。
10 |
11 | ## 实用命令
12 |
13 | - `yarn format`: 整理文件格式。所有文件格式均使用 prettier 的默认配置。如果没有特殊必要,你基本上不需要手动运行此命令。当 `git commit` 的时候此命令会自动运行。
14 | - `yarn build`: 生成 typedoc 文件。你可以通过在浏览器中打开 `./typedoc/index.html` 来预览最终的生成效果。
15 |
16 | ## 参与翻译
17 |
18 | 翻译规范请参阅[中文文案排版指北](https://github.com/sparanoid/chinese-copywriting-guidelines)
19 |
20 | - [参与翻译](https://github.com/denodev/typedoc/issues/4)
21 | - [翻译进度](https://github.com/denodev/typedoc/issues/6)
22 |
23 | ## 版权许可
24 |
25 | 本文档采用 [CC BY-NC 4.0](https://creativecommons.org/licenses/by-nc/4.0/deed.zh) 许可协议。
26 |
--------------------------------------------------------------------------------
/lib.deno.ns.d.ts:
--------------------------------------------------------------------------------
1 | // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
2 |
3 | ///
4 | ///
5 |
6 | declare namespace Deno {
7 | /** The current process id of the runtime.
8 | * @i18n 当前正在运行的进程 ID。 */
9 | export let pid: number;
10 |
11 | /** Reflects the `NO_COLOR` environment variable.
12 | * @i18n 显示环境变量 `NO_COLOR` 的值。
13 | *
14 | * See: https://no-color.org/
15 | * @i18n 参见:https://no-color.org/*/
16 | export let noColor: boolean;
17 |
18 | export interface TestDefinition {
19 | fn: () => void | Promise;
20 | name: string;
21 | ignore?: boolean;
22 | disableOpSanitizer?: boolean;
23 | disableResourceSanitizer?: boolean;
24 | }
25 |
26 | /** Register a test which will be run when `deno test` is used on the command
27 | * line and the containing module looks like a test module, or explicitly
28 | * when `Deno.runTests` is used. `fn` can be async if required.
29 | *
30 | * @i18n 注册一个测试,它将在命令行执行 `deno test` 操作并且包含的模块看起来像一个测试模块时运行,
31 | * 或者在使用 `Deno.runTests` 时显式运行。如果需要, `fn` 可以是异步的。
32 | *
33 | * import {assert, fail, assertEquals} from "https://deno.land/std/testing/asserts.ts";
34 | *
35 | * Deno.test({
36 | * name: "example test",
37 | * fn(): void {
38 | * assertEquals("world", "world");
39 | * },
40 | * });
41 | *
42 | * Deno.test({
43 | * name: "example ignored test",
44 | * ignore: Deno.build.os === "win"
45 | * fn(): void {
46 | * // 仅在 Windows 机器上忽略这个测试。
47 | * },
48 | * });
49 | *
50 | * Deno.test({
51 | * name: "example async test",
52 | * async fn() {
53 | * const decoder = new TextDecoder("utf-8");
54 | * const data = await Deno.readFile("hello_world.txt");
55 | * assertEquals(decoder.decode(data), "Hello world")
56 | * }
57 | * });
58 | */
59 | export function test(t: TestDefinition): void;
60 |
61 | /** Register a test which will be run when `deno test` is used on the command
62 | * line and the containing module looks like a test module, or explicitly
63 | * when `Deno.runTests` is used
64 | *
65 | * @i18n 注册一个测试,它将在命令行执行 `deno test` 操作并且包含的模块看起来像一个测试模块时运行,
66 | * 或者在使用 `Deno.runTests` 时显式运行。
67 | *
68 | * import {assert, fail, assertEquals} from "https://deno.land/std/testing/asserts.ts";
69 | *
70 | * Deno.test(function myTestFunction():void {
71 | * assertEquals("hello", "hello");
72 | * });
73 | *
74 | * Deno.test(async function myAsyncTestFunction():Promise {
75 | * const decoder = new TextDecoder("utf-8");
76 | * const data = await Deno.readFile("hello_world.txt");
77 | * assertEquals(decoder.decode(data), "Hello world")
78 | * });
79 | **/
80 | export function test(fn: () => void | Promise): void;
81 |
82 | /** Register a test which will be run when `deno test` is used on the command
83 | * line and the containing module looks like a test module, or explicitly
84 | * when `Deno.runTests` is used
85 | *
86 | * @i18n 注册一个测试,它将在命令行执行 `deno test` 操作并且包含的模块看起来像一个测试模块时运行,
87 | * 或者在使用 `Deno.runTests` 时显式运行。
88 | *
89 | * import {assert, fail, assertEquals} from "https://deno.land/std/testing/asserts.ts";
90 | *
91 | * Deno.test("My test description", ():void => {
92 | * assertEquals("hello", "hello");
93 | * });
94 | *
95 | * Deno.test("My async test description", async ():Promise => {
96 | * const decoder = new TextDecoder("utf-8");
97 | * const data = await Deno.readFile("hello_world.txt");
98 | * assertEquals(decoder.decode(data), "Hello world")
99 | * });
100 | * */
101 | export function test(name: string, fn: () => void | Promise): void;
102 |
103 | export interface TestMessage {
104 | start?: {
105 | tests: TestDefinition[];
106 | };
107 | testStart?: {
108 | [P in keyof TestDefinition]: TestDefinition[P];
109 | };
110 | testEnd?: {
111 | name: string;
112 | status: "passed" | "failed" | "ignored";
113 | duration: number;
114 | error?: Error;
115 | };
116 | end?: {
117 | filtered: number;
118 | ignored: number;
119 | measured: number;
120 | passed: number;
121 | failed: number;
122 | duration: number;
123 | results: Array;
124 | };
125 | }
126 |
127 | export interface RunTestsOptions {
128 | /** If `true`, Deno will exit with status code 1 if there was
129 | * test failure. Defaults to `true`.
130 | * @i18n 如果为 `true`,当测试失败时 Deno 将以状态码 1 退出。默认为 `true`。*/
131 | exitOnFail?: boolean;
132 | /** If `true`, Deno will exit upon first test failure. Defaults to `false`.
133 | * @i18n 如果为 `true`,Deno 将在第一次测试失败后退出。默认值为 `false`。*/
134 | failFast?: boolean;
135 | /** String or RegExp used to filter test to run. Only test with names
136 | * matching provided `String` or `RegExp` will be run.
137 | * @i18n 用于筛选要运行的测试的字符串或正则表达式。只有当测试名称与提供的 `String` 或 `RegExp` 相匹配时才会运行。*/
138 | filter?: string | RegExp;
139 | /** String or RegExp used to skip tests to run. Tests with names
140 | * matching provided `String` or `RegExp` will not be run.
141 | * @i18n 用于跳过要运行的测试的字符串或正则表达式。当测试名称与提供的 `String` 或 `RegExp` 相匹配时将不会运行。*/
142 | skip?: string | RegExp;
143 | /** Disable logging of the results. Defaults to `false`.
144 | * @i18n 禁用记录结果. 默认值为 `false`。*/
145 | disableLog?: boolean;
146 | /** If true, report results to the console as is done for `deno test`. Defaults to `true`.
147 | * @i18n 如果为 `true`,将 `deno test` 完成的结果输出到控制台。默认值为 `true`。*/
148 | reportToConsole?: boolean;
149 | /** Called for each message received from the test run.
150 | * @i18n 回调从测试运行收到的每个消息。*/
151 | onMessage?: (message: TestMessage) => void | Promise;
152 | }
153 |
154 | /** Run any tests which have been registered via `Deno.test()`. Always resolves
155 | * asynchronously.
156 | *
157 | * @i18n 运行所有通过 `Deno.test()` 注册的测试。始终异步 resolve。
158 | *
159 | * // 注册一个测试。
160 | * Deno.test({
161 | * name: "example test",
162 | * fn(): void {
163 | * assertEquals("world", "world");
164 | * assertEquals({ hello: "world" }, { hello: "world" });
165 | * },
166 | * });
167 | *
168 | * // 运行所有已经注册过的测试。
169 | * const runInfo = await Deno.runTests();
170 | * console.log(runInfo.duration); // all tests duration, e.g. "5" (in ms)
171 | * console.log(runInfo.stats.passed); //e.g. 1
172 | * console.log(runInfo.results[0].name); //e.g. "example test"
173 | */
174 | export function runTests(
175 | opts?: RunTestsOptions
176 | ): Promise & {};
177 |
178 | /** Returns an array containing the 1, 5, and 15 minute load averages. The
179 | * load average is a measure of CPU and IO utilization of the last one, five,
180 | * and 15 minute periods expressed as a fractional number. Zero means there
181 | * is no load. On Windows, the three values are always the same and represent
182 | * the current load, not the 1, 5 and 15 minute load averages.
183 | *
184 | * @i18n 返回 1 分钟、5 分钟和 15 分钟平均负载的数组。
185 | * 平均负载是对最后 1 分钟、5 分钟和 15 分钟的 CPU 以及 IO 利用率的度量,以分数表示。
186 | * `0` 表示没有负载。
187 | * 在 Windows 上,这 3 个值始终相同,代表当前负载,而不是 1 分钟、5 分钟和 15 分钟的平均负载。
188 | *
189 | * console.log(Deno.loadavg()); //e.g. [ 0.71, 0.44, 0.44 ]
190 | *
191 | * Requires `allow-env` permission.
192 | * @i18n 需要 `allow-env` 权限。
193 | */
194 | export function loadavg(): number[];
195 |
196 | /** Get the `hostname` of the machine the Deno process is running on.
197 | * @i18n 获取 Deno 进程所在的计算机主机名(`hostname`)。
198 | *
199 | * console.log(Deno.hostname());
200 | *
201 | * Requires `allow-env` permission.
202 | * @i18n 需要 `allow-env` 权限。
203 | */
204 | export function hostname(): string;
205 |
206 | /** Returns the release version of the Operating System.
207 | * @i18n 返回操作系统的发行版本。
208 | *
209 | * console.log(Deno.osRelease());
210 | *
211 | * Requires `allow-env` permission.
212 | * @i18n 需要 `allow-env` 权限。
213 | */
214 | export function osRelease(): string;
215 |
216 | /** Exit the Deno process with optional exit code. If no exit code is supplied
217 | * then Deno will exit with return code of 0.
218 | * @i18n 退出 Deno 进程,可以指定退出码,若无则为 0。
219 | *
220 | * Deno.exit(5);
221 | */
222 | export function exit(code?: number): never;
223 |
224 | /** Returns a snapshot of the environment variables at invocation. Changing a
225 | * property in the object will set that variable in the environment for the
226 | * process. The environment object will only accept `string`s as values.
227 | * @i18n 返回调用时环境变量的快照。如果更改环境变量对象的属性,则会在进程的环境中设置该属性。
228 | * 环境变量对象只接受 `string` 类型的值。
229 | *
230 | * const myEnv = Deno.env();
231 | * console.log(myEnv.SHELL);
232 | * myEnv.TEST_VAR = "HELLO";
233 | * const newEnv = Deno.env();
234 | * console.log(myEnv.TEST_VAR === newEnv.TEST_VAR); //outputs "true"
235 | *
236 | * Requires `allow-env` permission.
237 | * @i18n 需要 `allow-env` 权限。*/
238 | export function env(): {
239 | [index: string]: string;
240 | };
241 |
242 | /** Retrieve the value of an environment variable. Returns undefined if that
243 | * key doesn't exist.
244 | * @i18n 获取环境变量的值。如果 `key` 不存在,则返回 `undefined`。
245 | *
246 | * console.log(Deno.env("HOME")); //e.g. outputs "/home/alice"
247 | * console.log(Deno.env("MADE_UP_VAR")); //outputs "Undefined"
248 | *
249 | * Requires `allow-env` permission.
250 | * @i18n 需要 `allow-env` 权限。*/
251 | export function env(key: string): string | undefined;
252 |
253 | /** **UNSTABLE** */
254 | export type DirKind =
255 | | "home"
256 | | "cache"
257 | | "config"
258 | | "executable"
259 | | "data"
260 | | "data_local"
261 | | "audio"
262 | | "desktop"
263 | | "document"
264 | | "download"
265 | | "font"
266 | | "picture"
267 | | "public"
268 | | "template"
269 | | "tmp"
270 | | "video";
271 |
272 | /**
273 | * **UNSTABLE**: Currently under evaluation to decide if method name `dir` and
274 | * parameter type alias name `DirKind` should be renamed.
275 | * @i18n **不稳定**: 当前正在评估中,以确定是否应重命名方法名 `dir` 和参数类型 `DirKind`。
276 | *
277 | * Returns the user and platform specific directories.
278 | * @i18n 返回特定于用户和平台的目录。
279 | *
280 | * const homeDirectory = Deno.dir("home");
281 | *
282 | * Requires `allow-env` permission.
283 | * @i18n 需要 `allow-env` 权限。
284 | *
285 | * Returns `null` if there is no applicable directory or if any other error
286 | * occurs.
287 | * @i18n 如果没有适用的目录或发生任何其他错误,则返回 `null`。
288 | *
289 | * Argument values: `"home"`, `"cache"`, `"config"`, `"executable"`, `"data"`,
290 | * `"data_local"`, `"audio"`, `"desktop"`, `"document"`, `"download"`,
291 | * `"font"`, `"picture"`, `"public"`, `"template"`, `"tmp"`, `"video"`
292 | * @i18n 参数值包含:`"home"`, `"cache"`, `"config"`, `"executable"`, `"data"`,
293 | * `"data_local"`, `"audio"`, `"desktop"`, `"document"`, `"download"`,
294 | * `"font"`, `"picture"`, `"public"`, `"template"`, `"tmp"`, `"video"`
295 | *
296 | * `"home"`
297 | *
298 | * |平台 | 值 | 示例 |
299 | * | ------- | -----------------------------------------| -----------------------|
300 | * | Linux | `$HOME` | /home/alice |
301 | * | macOS | `$HOME` | /Users/alice |
302 | * | Windows | `{FOLDERID_Profile}` | C:\Users\Alice |
303 | *
304 | * `"cache"`
305 | *
306 | * |平台 | 值 | 示例 |
307 | * | ------- | ----------------------------------- | ---------------------------- |
308 | * | Linux | `$XDG_CACHE_HOME` or `$HOME`/.cache | /home/alice/.cache |
309 | * | macOS | `$HOME`/Library/Caches | /Users/Alice/Library/Caches |
310 | * | Windows | `{FOLDERID_LocalAppData}` | C:\Users\Alice\AppData\Local |
311 | *
312 | * `"config"`
313 | *
314 | * |平台 | 值 | 示例 |
315 | * | ------- | ------------------------------------- | -------------------------------- |
316 | * | Linux | `$XDG_CONFIG_HOME` or `$HOME`/.config | /home/alice/.config |
317 | * | macOS | `$HOME`/Library/Preferences | /Users/Alice/Library/Preferences |
318 | * | Windows | `{FOLDERID_RoamingAppData}` | C:\Users\Alice\AppData\Roaming |
319 | *
320 | * `"executable"`
321 | *
322 | * |平台 | 值 | 示例 |
323 | * | ------- | --------------------------------------------------------------- | -----------------------|
324 | * | Linux | `XDG_BIN_HOME` or `$XDG_DATA_HOME`/../bin or `$HOME`/.local/bin | /home/alice/.local/bin |
325 | * | macOS | - | - |
326 | * | Windows | - | - |
327 | *
328 | * `"data"`
329 | *
330 | * |平台 | 值 | 示例 |
331 | * | ------- | ---------------------------------------- | ---------------------------------------- |
332 | * | Linux | `$XDG_DATA_HOME` or `$HOME`/.local/share | /home/alice/.local/share |
333 | * | macOS | `$HOME`/Library/Application Support | /Users/Alice/Library/Application Support |
334 | * | Windows | `{FOLDERID_RoamingAppData}` | C:\Users\Alice\AppData\Roaming |
335 | *
336 | * `"data_local"`
337 | *
338 | * |平台 | 值 | 示例 |
339 | * | ------- | ---------------------------------------- | ---------------------------------------- |
340 | * | Linux | `$XDG_DATA_HOME` or `$HOME`/.local/share | /home/alice/.local/share |
341 | * | macOS | `$HOME`/Library/Application Support | /Users/Alice/Library/Application Support |
342 | * | Windows | `{FOLDERID_LocalAppData}` | C:\Users\Alice\AppData\Local |
343 | *
344 | * `"audio"`
345 | *
346 | * |平台 | 值 | 示例 |
347 | * | ------- | ------------------ | -------------------- |
348 | * | Linux | `XDG_MUSIC_DIR` | /home/alice/Music |
349 | * | macOS | `$HOME`/Music | /Users/Alice/Music |
350 | * | Windows | `{FOLDERID_Music}` | C:\Users\Alice\Music |
351 | *
352 | * `"desktop"`
353 | *
354 | * |平台 | 值 | 示例 |
355 | * | ------- | -------------------- | ---------------------- |
356 | * | Linux | `XDG_DESKTOP_DIR` | /home/alice/Desktop |
357 | * | macOS | `$HOME`/Desktop | /Users/Alice/Desktop |
358 | * | Windows | `{FOLDERID_Desktop}` | C:\Users\Alice\Desktop |
359 | *
360 | * `"document"`
361 | *
362 | * |平台 | 值 | 示例 |
363 | * | ------- | ---------------------- | ------------------------ |
364 | * | Linux | `XDG_DOCUMENTS_DIR` | /home/alice/Documents |
365 | * | macOS | `$HOME`/Documents | /Users/Alice/Documents |
366 | * | Windows | `{FOLDERID_Documents}` | C:\Users\Alice\Documents |
367 | *
368 | * `"download"`
369 | *
370 | * |平台 | 值 | 示例 |
371 | * | ------- | ---------------------- | ------------------------ |
372 | * | Linux | `XDG_DOWNLOAD_DIR` | /home/alice/Downloads |
373 | * | macOS | `$HOME`/Downloads | /Users/Alice/Downloads |
374 | * | Windows | `{FOLDERID_Downloads}` | C:\Users\Alice\Downloads |
375 | *
376 | * `"font"`
377 | *
378 | * |平台 | 值 | 示例 |
379 | * | ------- | ---------------------------------------------------- | ------------------------------ |
380 | * | Linux | `$XDG_DATA_HOME`/fonts or `$HOME`/.local/share/fonts | /home/alice/.local/share/fonts |
381 | * | macOS | `$HOME/Library/Fonts` | /Users/Alice/Library/Fonts |
382 | * | Windows | – | – |
383 | *
384 | * `"picture"`
385 | *
386 | * |平台 | 值 | 示例 |
387 | * | ------- | --------------------- | ----------------------- |
388 | * | Linux | `XDG_PICTURES_DIR` | /home/alice/Pictures |
389 | * | macOS | `$HOME`/Pictures | /Users/Alice/Pictures |
390 | * | Windows | `{FOLDERID_Pictures}` | C:\Users\Alice\Pictures |
391 | *
392 | * `"public"`
393 | *
394 | * |平台 | 值 | 示例 |
395 | * | ------- | --------------------- | ------------------- |
396 | * | Linux | `XDG_PUBLICSHARE_DIR` | /home/alice/Public |
397 | * | macOS | `$HOME`/Public | /Users/Alice/Public |
398 | * | Windows | `{FOLDERID_Public}` | C:\Users\Public |
399 | *
400 | * `"template"`
401 | *
402 | * |平台 | 值 | 示例 |
403 | * | ------- | ---------------------- | ---------------------------------------------------------- |
404 | * | Linux | `XDG_TEMPLATES_DIR` | /home/alice/Templates |
405 | * | macOS | – | – |
406 | * | Windows | `{FOLDERID_Templates}` | C:\Users\Alice\AppData\Roaming\Microsoft\Windows\Templates |
407 | *
408 | * `"tmp"`
409 | *
410 | * |平台 | 值 | 示例 |
411 | * | ------- | ---------------------- | ---------------------------------------------------------- |
412 | * | Linux | `TMPDIR` | /tmp |
413 | * | macOS | `TMPDIR` | /tmp |
414 | * | Windows | `{TMP}` | C:\Users\Alice\AppData\Local\Temp |
415 | *
416 | * `"video"`
417 | *
418 | * |平台 | 值 | 示例 |
419 | * | ------- | ------------------- | --------------------- |
420 | * | Linux | `XDG_VIDEOS_DIR` | /home/alice/Videos |
421 | * | macOS | `$HOME`/Movies | /Users/Alice/Movies |
422 | * | Windows | `{FOLDERID_Videos}` | C:\Users\Alice\Videos |
423 | *
424 | */
425 | export function dir(kind: DirKind): string | null;
426 |
427 | /**
428 | * Returns the path to the current deno executable.
429 | * @i18n 返回当前 deno 可执行文件的路径。
430 | *
431 | * console.log(Deno.execPath()); //e.g. "/home/alice/.local/bin/deno"
432 | *
433 | * Requires `allow-env` permission.
434 | * @i18n 需要 `allow-env` 权限。
435 | */
436 | export function execPath(): string;
437 |
438 | /**
439 | * **UNSTABLE**: Currently under evaluation to decide if explicit permission is
440 | * required to get the value of the current working directory.
441 | * @i18n **不稳定**: 获取当前工作目录是否需要明确的权限,目前正在评估中。
442 | *
443 | * Return a string representing the current working directory.
444 | * @i18n 返回当前工作目录的字符串。
445 | *
446 | * If the current directory can be reached via multiple paths (due to symbolic
447 | * links), `cwd()` may return any one of them.
448 | * @i18n 如果当前目录可以通过多个路径访问(由于符号链接导致),可能会返回其中任意一个。
449 | *
450 | * const currentWorkingDirectory = Deno.cwd();
451 | *
452 | * Throws `Deno.errors.NotFound` if directory not available.
453 | * @i18n 如果目录不存在,则抛出 `Deno.errors.NotFound`。
454 | */
455 | export function cwd(): string;
456 |
457 | /**
458 | * **UNSTABLE**: Currently under evaluation to decide if explicit permission is
459 | * required to change the current working directory.
460 | * @i18n **不稳定**: 更改当前工作目录是否需要明确的权限,目前正在评估中。
461 | *
462 | * Change the current working directory to the specified path.
463 | * @i18n 将当前工作目录更改为指定路径。
464 | *
465 | * Deno.chdir("/home/userA");
466 | * Deno.chdir("../userB");
467 | * Deno.chdir("C:\\Program Files (x86)\\Java");
468 | *
469 | * Throws `Deno.errors.NotFound` if directory not found.
470 | * Throws `Deno.errors.PermissionDenied` if the user does not have access
471 | * rights
472 | * @i18n 如果目录未被找到,则抛出 `Deno.errors.NotFound` 。
473 | * 如果用户没有访问权限,则抛出 `Deno.errors.PermissionDenied` 。
474 | */
475 | export function chdir(directory: string): void;
476 |
477 | /**
478 | * **UNSTABLE**: New API, yet to be vetted. This API is under consideration to
479 | * determine if permissions are required to call it.
480 | * @i18n **不稳定**: 新 API,没有经过审查。正在考虑调用此 API 时,是否需要申请权限。
481 | *
482 | * Retrieve the process umask. If `mask` is provided, sets the process umask.
483 | * This call always returns what the umask was before the call.
484 | * @i18n 获取进程权限掩码。如果提供 `mask`,则设置进程权限掩码。
485 | * 此函数始终返回调用前的权限掩码。
486 | *
487 | * console.log(Deno.umask()); //e.g. 18 (0o022)
488 | * const prevUmaskValue = Deno.umask(0o077); //e.g. 18 (0o022)
489 | * console.log(Deno.umask()); //e.g. 63 (0o077)
490 | *
491 | * NOTE: This API is not implemented on Windows
492 | * @i18n 注意: 此 API 未在 Windows 平台实现。
493 | */
494 | export function umask(mask?: number): number;
495 |
496 | /** **UNSTABLE**: might move to `Deno.symbols`.
497 | * @i18n **不稳定**: 可能会移动到 `Deno.symbols`。*/
498 | export const EOF: unique symbol;
499 | export type EOF = typeof EOF;
500 |
501 | /** **UNSTABLE**: might remove `"SEEK_"` prefix. Might not use all-caps.
502 | * @i18n **不稳定**: 可能会移除 `"SEEK_"` 前缀。可能不使用全大写。*/
503 | export enum SeekMode {
504 | SEEK_START = 0,
505 | SEEK_CURRENT = 1,
506 | SEEK_END = 2,
507 | }
508 |
509 | /** **UNSTABLE**: might make `Reader` into iterator of some sort. */
510 | export interface Reader {
511 | /** Reads up to `p.byteLength` bytes into `p`. It resolves to the number of
512 | * bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error
513 | * encountered. Even if `read()` resolves to `n` < `p.byteLength`, it may
514 | * use all of `p` as scratch space during the call. If some data is
515 | * available but not `p.byteLength` bytes, `read()` conventionally resolves
516 | * to what is available instead of waiting for more.
517 | * @i18n 最多读取 `p.byteLength` 个字节到p中,然后返回读取的字节数(`0 < n <= p.byteLength`),并在遇到任何错误时返回拒绝状态的回调函数。
518 | * 即使 `read()` 返回值为 `n < p.byteLength`,p也可能在调用期间被用作临时空间。
519 | * 如果有数据可用,但不存在 `p.byteLength`,`read()` 通常会返回可用值,而不是等待更多。
520 | *
521 | * When `read()` encounters end-of-file condition, it resolves to
522 | * `Deno.EOF` symbol.
523 | * @i18n 当 `read()` 遇到文件结束条件时,将返回 `Deno.EOF` 符号。
524 | *
525 | * When `read()` encounters an error, it rejects with an error.
526 | * @i18n 当 `read()` 遇到错误时,它会返回拒绝状态的回调函数,参数值为错误信息。
527 | *
528 | * Callers should always process the `n` > `0` bytes returned before
529 | * considering the `EOF`. Doing so correctly handles I/O errors that happen
530 | * after reading some bytes and also both of the allowed EOF behaviors.
531 | * @i18n 调用者应始终处理返回值为 `n > 0` 的情况,然后再考虑 `EOF`。
532 | * 应正确处理在读取一些字节以及两种被允许的EOF行为之后可能发生的 I/O 错误。
533 | *
534 | * Implementations should not retain a reference to `p`.
535 | * @i18n 实现不应保留对 `p` 的引用。
536 | */
537 | read(p: Uint8Array): Promise;
538 | }
539 |
540 | export interface ReaderSync {
541 | /** Reads up to `p.byteLength` bytes into `p`. It resolves to the number
542 | * of bytes read (`0` < `n` <= `p.byteLength`) and rejects if any error
543 | * encountered. Even if `read()` returns `n` < `p.byteLength`, it may use
544 | * all of `p` as scratch space during the call. If some data is available
545 | * but not `p.byteLength` bytes, `read()` conventionally returns what is
546 | * available instead of waiting for more.
547 | * @i18n 最多读取 `p.byteLength` 个字节到p中,然后返回读取的字节数(`0 < n <= p.byteLength`),并在遇到任何错误时返回拒绝状态的回调函数。
548 | * 即使 `readSync()` 返回值为 `n < p.byteLength`,p也可能在调用期间被用作临时空间。
549 | * 如果有数据可用,但不存在 `p.byteLength`,`readSync()` 通常会返回可用值,而不是等待更多。
550 | *
551 | * When `readSync()` encounters end-of-file condition, it returns `Deno.EOF`
552 | * symbol.
553 | * @i18n 当 `readSync()` 遇到文件结束条件时,将返回 `Deno.EOF` 符号。
554 | *
555 | * When `readSync()` encounters an error, it throws with an error.
556 | * @i18n 当 `readSync()` 遇到错误时,它会返回拒绝状态的回调函数,参数值为错误信息。
557 | *
558 | * Callers should always process the `n` > `0` bytes returned before
559 | * considering the `EOF`. Doing so correctly handles I/O errors that happen
560 | * after reading some bytes and also both of the allowed EOF behaviors.
561 | * @i18n 调用者应始终处理返回值为 `n > 0` 的情况,然后再考虑 `EOF`。
562 | * 应正确处理在读取一些字节以及两种被允许的EOF行为之后可能发生的 I/O 错误。
563 | *
564 | * Implementations should not retain a reference to `p`.
565 | * @i18n 实现不应保留对 `p` 的引用。
566 | */
567 | readSync(p: Uint8Array): number | EOF;
568 | }
569 |
570 | export interface Writer {
571 | /** Writes `p.byteLength` bytes from `p` to the underlying data stream. It
572 | * resolves to the number of bytes written from `p` (`0` <= `n` <=
573 | * `p.byteLength`) or reject with the error encountered that caused the
574 | * write to stop early. `write()` must reject with a non-null error if
575 | * would resolve to `n` < `p.byteLength`. `write()` must not modify the
576 | * slice data, even temporarily.
577 | * @i18n 将 `p` 中的 `p.byteLength` 字节写入底层数据流。 它 resolve 时返回值为从 `p` 写入的
578 | * 字节数(`0` <= `n` <= `p.byteLength`),reject 时返回值为导致写入提前停止的错误。
579 | * 如果将要 resolve 一个 `n` < `p.byteLength` 的值时, `write()` 必须 reject,并且返回
580 | * 一个非空错误。`write()` 禁止修改分片数据,即使是临时修改。
581 | *
582 | * Implementations should not retain a reference to `p`.
583 | * @i18n 实现不应保留对 `p` 的引用。
584 | */
585 | write(p: Uint8Array): Promise;
586 | }
587 |
588 | export interface WriterSync {
589 | /** Writes `p.byteLength` bytes from `p` to the underlying data
590 | * stream. It returns the number of bytes written from `p` (`0` <= `n`
591 | * <= `p.byteLength`) and any error encountered that caused the write to
592 | * stop early. `writeSync()` must throw a non-null error if it returns `n` <
593 | * `p.byteLength`. `writeSync()` must not modify the slice data, even
594 | * temporarily.
595 | * @i18n 将 `p` 中的 `p.byteLength` 字节写入底层数据流。它的返回值为从 `p` 写入的
596 | * 字节数(`0` <= `n` <= `p.byteLength`)或者导致写入提前停止的错误。
597 | * `writeSync()` 会抛出一个非空错误当返回值 `n` < `p.byteLength`。`writeSync()`
598 | * 禁止修改分片数据,即使是临时修改。
599 | *
600 | * Implementations should not retain a reference to `p`.
601 | * @i18n 实现不应保留对 `p` 的引用。
602 | */
603 | writeSync(p: Uint8Array): number;
604 | }
605 |
606 | export interface Closer {
607 | close(): void;
608 | }
609 |
610 | export interface Seeker {
611 | /** Seek sets the offset for the next `read()` or `write()` to offset,
612 | * interpreted according to `whence`: `SEEK_START` means relative to the
613 | * start of the file, `SEEK_CURRENT` means relative to the current offset,
614 | * and `SEEK_END` means relative to the end. Seek resolves to the new offset
615 | * relative to the start of the file.
616 | * @i18n 设置下一个 `read()` 或 `write()` 的偏移量,根据 `whence` 进行决定从哪个位置开始偏移:
617 | * `SEEK_START` 表示相对于文件开头,`SEEK_CURRENT` 表示相对于当前位置,`SEEK_END` 表示相对于文件末尾。
618 | * Seek 解析(resolve)的值为相对于文件开头的新偏移量。
619 | *
620 | * Seeking to an offset before the start of the file is an error. Seeking to
621 | * any positive offset is legal, but the behavior of subsequent I/O
622 | * operations on the underlying object is implementation-dependent.
623 | * It returns the number of cursor position.
624 | * @i18n 把偏移量设置到文件开始之前是错误的。
625 | * 设置任何正偏移都是合法的,但是对于之后的 I/O 操作的行为则取决于实现。
626 | * 它返回设置之后的偏移位置。
627 | */
628 | seek(offset: number, whence: SeekMode): Promise;
629 | }
630 |
631 | export interface ReadCloser extends Reader, Closer {}
632 | export interface WriteCloser extends Writer, Closer {}
633 | export interface ReadSeeker extends Reader, Seeker {}
634 | export interface WriteSeeker extends Writer, Seeker {}
635 | export interface ReadWriteCloser extends Reader, Writer, Closer {}
636 | export interface ReadWriteSeeker extends Reader, Writer, Seeker {}
637 |
638 | /** Copies from `src` to `dst` until either `EOF` is reached on `src` or an
639 | * error occurs. It resolves to the number of bytes copied or rejects with
640 | * the first error encountered while copying.
641 | * @i18n 从 `src` 拷贝文件至 `dst`,拷贝至 `src` 的 `EOF` 或有异常出现时结束。
642 | * `copy()` 函数返回一个 `Promise`, 成功时 resolve 并返回拷贝的字节数,失败时 reject 并返回拷贝过程中的首个异常。
643 | *
644 | * const source = await Deno.open("my_file.txt");
645 | * const buffer = new Deno.Buffer()
646 | * const bytesCopied1 = await Deno.copy(Deno.stdout, source);
647 | * const bytesCopied2 = await Deno.copy(buffer, source);
648 | *
649 | * Because `copy()` is defined to read from `src` until `EOF`, it does not
650 | * treat an `EOF` from `read()` as an error to be reported.
651 | * @i18n 因为 `copy()` 函数在读到 `EOF` 时停止,所以不会将 `EOF` 视为异常(区别于 `read()` 函数)。
652 | *
653 | * @param dst The destination to copy to
654 | * @param_i18n dst 需要拷贝至的目标位置
655 | * @param src The source to copy from
656 | * @param_i18n src 拷贝的源位置
657 | */
658 | export function copy(dst: Writer, src: Reader): Promise;
659 |
660 | /** Turns a Reader, `r`, into an async iterator.
661 | * @i18n 将 Reader 对象 (`r`) 转换为异步迭代器。
662 | *
663 | * for await (const chunk of toAsyncIterator(reader)) {
664 | * console.log(chunk);
665 | * }
666 | */
667 | export function toAsyncIterator(r: Reader): AsyncIterableIterator;
668 |
669 | /** Synchronously open a file and return an instance of `Deno.File`. The
670 | * file does not need to previously exist if using the `create` or `createNew`
671 | * open options. It is the callers responsibility to close the file when finished
672 | * with it.
673 | * @i18n 用同步方式打开一个文件并返回一个 `Deno.File` 实例。如果使用了 `create` 或 `createNew`配置项
674 | * 文件可以不需要预先存在。调用者应该在完成后关闭文件。
675 | *
676 | * const file = Deno.openSync("/foo/bar.txt", { read: true, write: true });
677 | * // Do work with file
678 | * Deno.close(file.rid);
679 | *
680 | * Requires `allow-read` and/or `allow-write` permissions depending on options.
681 | * @i18n 根据不同的配置需要相应的 `allow-read` 及 `allow-write` 权限。
682 | */
683 | export function openSync(path: string, options?: OpenOptions): File;
684 |
685 | /** Synchronously open a file and return an instance of `Deno.File`. The file
686 | * may be created depending on the mode passed in. It is the callers responsibility
687 | * to close the file when finished with it.
688 | * @i18n 用同步方式打开一个文件并返回一个 `Deno.File` 实例。根据传入的模式,可以创建文件。
689 | * 调用者应该在完成后关闭文件。
690 | *
691 | * const file = Deno.openSync("/foo/bar.txt", "r");
692 | * // Do work with file
693 | * Deno.close(file.rid);
694 | *
695 | * Requires `allow-read` and/or `allow-write` permissions depending on openMode.
696 | * @i18n 根据不同的打开模式需要相应的 `allow-read` 及 `allow-write` 权限。
697 | */
698 | export function openSync(path: string, openMode?: OpenMode): File;
699 |
700 | /** Open a file and resolve to an instance of `Deno.File`. The
701 | * file does not need to previously exist if using the `create` or `createNew`
702 | * open options. It is the callers responsibility to close the file when finished
703 | * with it.
704 | * @i18n 打开一个文件并异步返回一个 `Deno.File` 实例。如果使用了 `create` 或 `createNew`配置项
705 | * 文件可以不需要预先存在。调用者应该在完成后关闭文件。
706 | *
707 | * const file = await Deno.open("/foo/bar.txt", { read: true, write: true });
708 | * // Do work with file
709 | * Deno.close(file.rid);
710 | *
711 | * Requires `allow-read` and/or `allow-write` permissions depending on options.
712 | * @i18n 根据不同的选项需要相应的 `allow-read` 及 `allow-write` 权限。
713 | */
714 | export function open(path: string, options?: OpenOptions): Promise;
715 |
716 | /** Open a file and resolve to an instance of `Deno.File`. The file may be
717 | * created depending on the mode passed in. It is the callers responsibility
718 | * to close the file when finished with it.
719 | * @i18n 打开一个文件并异步返回一个 `Deno.File` 实例。根据传入的模式,可以创建文件。
720 | * 调用者应该在完成后关闭文件。
721 | *
722 | * const file = await Deno.open("/foo/bar.txt", "w+");
723 | * // Do work with file
724 | * Deno.close(file.rid);
725 | *
726 | * Requires `allow-read` and/or `allow-write` permissions depending on openMode.
727 | * @i18n 根据不同的打开模式需要相应的 `allow-read` 及 `allow-write` 权限。
728 | */
729 | export function open(path: string, openMode?: OpenMode): Promise;
730 |
731 | /** Creates a file if none exists or truncates an existing file and returns
732 | * an instance of `Deno.File`.
733 | * @i18n 创建文件并返回一个 `Deno.File` 实例,如果文件已存在则进行覆盖。
734 | *
735 | * const file = Deno.createSync("/foo/bar.txt");
736 | *
737 | * Requires `allow-read` and `allow-write` permissions.
738 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。
739 | */
740 | export function createSync(path: string): File;
741 |
742 | /** Creates a file if none exists or truncates an existing file and resolves to
743 | * an instance of `Deno.File`.
744 | * @i18n 创建文件并异步返回一个 `Deno.File` 实例,如果文件已存在则进行覆盖。
745 | *
746 | * const file = await Deno.create("/foo/bar.txt");
747 | *
748 | * Requires `allow-read` and `allow-write` permissions.
749 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。
750 | */
751 | export function create(path: string): Promise;
752 |
753 | /** Synchronously read from a resource ID (`rid`) into an array buffer (`buffer`).
754 | * @i18n 同步地从资源ID (`rid`) 读取内容,并写入到数组缓冲区 (`buffer`)。
755 | *
756 | * Returns either the number of bytes read during the operation or End Of File
757 | * (`Symbol(EOF)`) if there was nothing to read.
758 | * @i18n 如果没有要读取的内容,返回值为操作期间读取的字节数,或者文件结尾(`Symbol(EOF)`)。
759 | *
760 | * // 如果 "/foo/bar.txt" 文件里面有 "hello world":
761 | * const file = Deno.openSync("/foo/bar.txt");
762 | * const buf = new Uint8Array(100);
763 | * const numberOfBytesRead = Deno.readSync(file.rid, buf); // 11 bytes
764 | * const text = new TextDecoder().decode(buf); // "hello world"
765 | * Deno.close(file.rid);
766 | */
767 | export function readSync(rid: number, buffer: Uint8Array): number | EOF;
768 |
769 | /** Read from a resource ID (`rid`) into an array buffer (`buffer`).
770 | * @i18n 从资源ID (`rid`) 读取内容,并写入到数组缓冲区 (`buffer`)。
771 | *
772 | * Resolves to either the number of bytes read during the operation or End Of
773 | * File (`Symbol(EOF)`) if there was nothing to read.
774 | * @i18n 如果没有要读取的内容,返回值为操作期间读取的字节数,或者文件结尾(`Symbol(EOF)`)。
775 | *
776 | * // 如果 "/foo/bar.txt" 文件里面有 "hello world":
777 | * const file = await Deno.open("/foo/bar.txt");
778 | * const buf = new Uint8Array(100);
779 | * const numberOfBytesRead = await Deno.read(file.rid, buf); // 11 bytes
780 | * const text = new TextDecoder().decode(buf); // "hello world"
781 | * Deno.close(file.rid);
782 | */
783 | export function read(rid: number, buffer: Uint8Array): Promise;
784 |
785 | /** Synchronously write to the resource ID (`rid`) the contents of the array
786 | * buffer (`data`).
787 | * @i18n 同步地将数组缓冲区 (`data`) 的内容写入资源ID的所属文件 (`rid`) 。
788 | *
789 | * Returns the number of bytes written.
790 | * @i18n 返回写入的字节数。
791 | *
792 | * const encoder = new TextEncoder();
793 | * const data = encoder.encode("Hello world");
794 | * const file = Deno.openSync("/foo/bar.txt");
795 | * const bytesWritten = Deno.writeSync(file.rid, data); // 11
796 | * Deno.close(file.rid);
797 | */
798 | export function writeSync(rid: number, data: Uint8Array): number;
799 |
800 | /** Write to the resource ID (`rid`) the contents of the array buffer (`data`).
801 | * @i18n 将数组缓冲区 (`data`) 的内容写入资源ID的所属文件 (`rid`) 。
802 | *
803 | * Resolves to the number of bytes written.
804 | * @i18n 解析为写入的字节数。
805 | *
806 | * const encoder = new TextEncoder();
807 | * const data = encoder.encode("Hello world");
808 | * const file = await Deno.open("/foo/bar.txt");
809 | * const bytesWritten = await Deno.write(file.rid, data); // 11
810 | * Deno.close(file.rid);
811 | */
812 | export function write(rid: number, data: Uint8Array): Promise;
813 |
814 | /** Synchronously seek a resource ID (`rid`) to the given `offset` under mode
815 | * given by `whence`. The new position within the resource (bytes from the
816 | * start) is returned.
817 | * @i18n 同步方式,在给定查询模式 `whence` 和偏移量 `offset` 的情况下,查找指定的资源 ID(`rid`)。
818 | * 函数将解析并返回光标在资源中的新位置(从头开始的字节数)。
819 | *
820 | * const file = Deno.openSync('hello.txt', {read: true, write: true, truncate: true, create: true});
821 | * Deno.writeSync(file.rid, new TextEncoder().encode("Hello world"));
822 | * //advance cursor 6 bytes
823 | * const cursorPosition = Deno.seekSync(file.rid, 6, Deno.SeekMode.SEEK_START);
824 | * console.log(cursorPosition); // 6
825 | * const buf = new Uint8Array(100);
826 | * file.readSync(buf);
827 | * console.log(new TextDecoder().decode(buf)); // "world"
828 | *
829 | * The seek modes work as follows:
830 | * @i18n seek modes 的工作方式如下:
831 | *
832 | * // 给定内容为 "Hello world" 的 file.rid 文件,该文件长度为 11 个字节。
833 | * // 从文件开头移动 6 个字节
834 | * console.log(Deno.seekSync(file.rid, 6, Deno.SeekMode.SEEK_START)); //"6"
835 | * // 从当前位置再移动 2 个字节
836 | * console.log(Deno.seekSync(file.rid, 2, Deno.SeekMode.SEEK_CURRENT)); //"8"
837 | * // 从文件末尾向后移动 2 个字节
838 | * console.log(Deno.seekSync(file.rid, -2, Deno.SeekMode.SEEK_END)); //"9" (e.g. 11-2)
839 | */
840 | export function seekSync(
841 | rid: number,
842 | offset: number,
843 | whence: SeekMode
844 | ): number;
845 |
846 | /** Seek a resource ID (`rid`) to the given `offset` under mode given by `whence`.
847 | * The call resolves to the new position within the resource (bytes from the start).
848 | * @i18n 在给定查询模式 `whence` 和偏移量 `offset` 的情况下,查找指定的资源 ID(`rid`)。
849 | * 函数将解析并返回光标在资源中的新位置(从头开始的字节数)。
850 | *
851 | * const file = await Deno.open('hello.txt', {read: true, write: true, truncate: true, create: true});
852 | * await Deno.write(file.rid, new TextEncoder().encode("Hello world"));
853 | * // 光标前进 6 个字节
854 | * const cursorPosition = await Deno.seek(file.rid, 6, Deno.SeekMode.SEEK_START);
855 | * console.log(cursorPosition); // 6
856 | * const buf = new Uint8Array(100);
857 | * await file.read(buf);
858 | * console.log(new TextDecoder().decode(buf)); // "world"
859 | *
860 | * The seek modes work as follows:
861 | * @i18n seek modes 的工作方式如下:
862 | *
863 | * // 给定内容为 "Hello world" 的 file.rid 文件,该文件长度为 11 个字节。
864 | * // 从文件开头移动 6 个字节
865 | * console.log(await Deno.seek(file.rid, 6, Deno.SeekMode.SEEK_START)); //"6"
866 | * // 从当前位置再移动 2 个字节
867 | * console.log(await Deno.seek(file.rid, 2, Deno.SeekMode.SEEK_CURRENT)); //"8"
868 | * // 从文件末尾向后移动 2 个字节
869 | * console.log(await Deno.seek(file.rid, -2, Deno.SeekMode.SEEK_END)); //"9" (e.g. 11-2)
870 | */
871 | export function seek(
872 | rid: number,
873 | offset: number,
874 | whence: SeekMode
875 | ): Promise;
876 |
877 | /** Close the given resource ID (rid) which has been previously opened, such
878 | * as via opening or creating a file. Closing a file when you are finished
879 | * with it is important to avoid leaking resources.
880 | * @i18n 使用给定的资源 ID (rid) 来关闭先前创建或打开的文件。
881 | * 为避免资源泄露,事关重大,文件应当用完即关。
882 | *
883 | * const file = await Deno.open("my_file.txt");
884 | * // 与 "file" 对象一起使用
885 | * Deno.close(file.rid);
886 | */
887 | export function close(rid: number): void;
888 |
889 | /** The Deno abstraction for reading and writing files.
890 | * @i18n 用于读取和写入文件的 Deno 抽象类。*/
891 | export class File
892 | implements
893 | Reader,
894 | ReaderSync,
895 | Writer,
896 | WriterSync,
897 | Seeker,
898 | Closer {
899 | readonly rid: number;
900 | constructor(rid: number);
901 | write(p: Uint8Array): Promise;
902 | writeSync(p: Uint8Array): number;
903 | read(p: Uint8Array): Promise;
904 | readSync(p: Uint8Array): number | EOF;
905 | seek(offset: number, whence: SeekMode): Promise;
906 | seekSync(offset: number, whence: SeekMode): number;
907 | close(): void;
908 | }
909 |
910 | /** An instance of `Deno.File` for `stdin`.
911 | * @i18n 用于 `stdin` 的 `Deno.File` 实例。*/
912 | export const stdin: File;
913 | /** An instance of `Deno.File` for `stdout`.
914 | * @i18n 用于 `stdout` 的 `Deno.File` 实例。*/
915 | export const stdout: File;
916 | /** An instance of `Deno.File` for `stderr`.
917 | * @i18n 用于 `stderr` 的 `Deno.File` 实例。*/
918 | export const stderr: File;
919 |
920 | export interface OpenOptions {
921 | /** Sets the option for read access. This option, when `true`, means that the
922 | * file should be read-able if opened.
923 | * @i18n 设置读取访问权限的选项。
924 | * 当为 `true` 时,表示该文件在打开后即处于可读状态。*/
925 | read?: boolean;
926 | /** Sets the option for write access. This option, when `true`, means that
927 | * the file should be write-able if opened. If the file already exists,
928 | * any write calls on it will overwrite its contents, by default without
929 | * truncating it.
930 | * @i18n 设置写访问权限的选项。
931 | * 当为 `true` 时,表示该文件在打开时即处于可写状态。
932 | * 如果该文件已存在,则默认情况下,对该文件的任何写调用都将覆盖其内容,而不会截断该文件。*/
933 | write?: boolean;
934 | /**Sets the option for the append mode. This option, when `true`, means that
935 | * writes will append to a file instead of overwriting previous contents.
936 | * Note that setting `{ write: true, append: true }` has the same effect as
937 | * setting only `{ append: true }`.
938 | * @i18n 设置追加模式的选项。
939 | * 当为 `true` 时,表示写入将追加到文件中,而不是覆盖先前的内容。
940 | * 请注意,设置 `{ write: true, append: true }` 与仅设置 `{ append: true }` 具有相同的效果。*/
941 | append?: boolean;
942 | /** Sets the option for truncating a previous file. If a file is
943 | * successfully opened with this option set it will truncate the file to `0`
944 | * size if it already exists. The file must be opened with write access
945 | * for truncate to work.
946 | * @i18n 设置截断上一个文件的选项。
947 | * 如果使用此选项后成功打开了文件,则文件的长度将被截断为 `0`(如果已存在)。
948 | * 该文件必须具有写访问权限才能打开,才能进行截断。*/
949 | truncate?: boolean;
950 | /** Sets the option to allow creating a new file, if one doesn't already
951 | * exist at the specified path. Requires write or append access to be
952 | * used.
953 | * @i18n 设置选项以允许创建新文件(如果指定路径尚不存在)。
954 | * 需要使用写权限或追加权限。*/
955 | create?: boolean;
956 | /** Defaults to `false`. If set to `true`, no file, directory, or symlink is
957 | * allowed to exist at the target location. Requires write or append
958 | * access to be used. When createNew is set to `true`, create and truncate
959 | * are ignored.
960 | * @i18n 默认为 `false`。
961 | * 如果设置为 `true`,则在目标位置不允许存在文件、目录或符号链接。
962 | * 需要使用写权限或追加权限。
963 | * 当 createNew 设置为 `true` 时,create 和 truncate 被忽略。*/
964 | createNew?: boolean;
965 | /** Permissions to use if creating the file (defaults to `0o666`, before
966 | * the process's umask).
967 | * Ignored on Windows.
968 | * @i18n 创建文件时使用的权限(在进程调用 `umask` 之前默认为 `0o666`)。
969 | * 在 Windows 上此选项被忽略。*/
970 | mode?: number;
971 | }
972 |
973 | /** A set of string literals which specify how to open a file.
974 | * @i18n 一组字符串文本,用于指定如何打开文件。
975 | *
976 | * |Value |Description |
977 | * |------|--------------------------------------------------------------------------------------------------|
978 | * |`"r"` |Read-only. Default. Starts at beginning of file. |
979 | * |`"r+"`|Read-write. Start at beginning of file. |
980 | * |`"w"` |Write-only. Opens and truncates existing file or creates new one for writing only. |
981 | * |`"w+"`|Read-write. Opens and truncates existing file or creates new one for writing and reading. |
982 | * |`"a"` |Write-only. Opens existing file or creates new one. Each write appends content to the end of file.|
983 | * |`"a+"`|Read-write. Behaves like `"a"` and allows to read from file. |
984 | * |`"x"` |Write-only. Exclusive create - creates new file only if one doesn't exist already. |
985 | * |`"x+"`|Read-write. Behaves like `x` and allows reading from file. |
986 | *
987 | * @i18n
988 | * |值 |描述 |
989 | * |------|--------------------------------------------------------------------------------------------------|
990 | * |`"r"` |只读。默认值。从文件开头开始。 |
991 | * |`"r+"`|可读写。从文件开头开始。 |
992 | * |`"w"` |仅写入。打开并截取现有文件或者创建一个仅写入权限的新文件。 |
993 | * |`"w+"`|可读写。打开并截取现有文件或者创建一个可读写权限的新文件。 |
994 | * |`"a"` |仅写入。打开现有文件或者创建新文件。每次写入都会将内容追加到文件末尾。 |
995 | * |`"a+"`|可读写。行为类似于 `"a"` 并且允许从文件中读取。 |
996 | * |`"x"` |仅写入。专属创建 - 仅在文件不存在时创建新文件。 |
997 | * |`"x+"`|可读写。行为类似于 `"x"` 并且允许从文件中读取。 |
998 | */
999 | export type OpenMode = "r" | "r+" | "w" | "w+" | "a" | "a+" | "x" | "x+";
1000 |
1001 | /** **UNSTABLE**: new API, yet to be vetted
1002 | * @i18n **不稳定**: 新 API,没有经过审查。
1003 | *
1004 | * Check if a given resource id (`rid`) is a TTY.
1005 | * @i18n 检查指定的资源 id (`rid`) 是否为 TTY(终端)。
1006 | *
1007 | * // 这个例子依赖于特定的操作系统和环境
1008 | * const nonTTYRid = Deno.openSync("my_file.txt").rid;
1009 | * const ttyRid = Deno.openSync("/dev/tty6").rid;
1010 | * console.log(Deno.isatty(nonTTYRid)); // false
1011 | * console.log(Deno.isatty(ttyRid)); // true
1012 | * Deno.close(nonTTYRid);
1013 | * Deno.close(ttyRid);
1014 | */
1015 | export function isatty(rid: number): boolean;
1016 |
1017 | /** **UNSTABLE**: new API, yet to be vetted
1018 | * @i18n **不稳定**: 新 API,没有经过审查。
1019 | *
1020 | * Set TTY to be under raw mode or not. In raw mode, characters are read and
1021 | * returned as is, without being processed. All special processing of
1022 | * characters by the terminal is disabled, including echoing input characters.
1023 | * Reading from a TTY device in raw mode is faster than reading from a TTY
1024 | * device in canonical mode.
1025 | * @i18n 设置终端是否为 raw 模式。
1026 | * 在 raw 模式下,无需处理即可直接读取和返回字符。
1027 | * 终端将禁止所有特殊的字符处理,包括回显输入字符。
1028 | * 在 raw 模式下从终端设备读取的速度比在标准模式下更快。
1029 | *
1030 | * Deno.setRaw(myTTY.rid, true);
1031 | */
1032 | export function setRaw(rid: number, mode: boolean): void;
1033 |
1034 | /** A variable-sized buffer of bytes with `read()` and `write()` methods.
1035 | * @i18n 一个具有 `read()` 和 `write()` 方法大小可变的字节缓冲区。
1036 | *
1037 | * Based on [Go Buffer](https://golang.org/pkg/bytes/#Buffer).
1038 | * @i18n 基于 [Go Buffer](https://golang.org/pkg/bytes/#Buffer)。*/
1039 | export class Buffer implements Reader, ReaderSync, Writer, WriterSync {
1040 | constructor(ab?: ArrayBuffer);
1041 | /** Returns a slice holding the unread portion of the buffer.
1042 | * @i18n 返回一个缓冲区未读部分的片段。
1043 | *
1044 | * The slice is valid for use only until the next buffer modification (that
1045 | * is, only until the next call to a method like `read()`, `write()`,
1046 | * `reset()`, or `truncate()`). The slice aliases the buffer content at
1047 | * least until the next buffer modification, so immediate changes to the
1048 | * slice will affect the result of future reads.
1049 | * @i18n 该片段只在下一次缓冲区修改之前有效 (即, 只有在下一次调用像 `read()`, `write()`,
1050 | * `reset()`, 或者 `truncate()` 这样的方法)。
1051 | * 该片段会在下一次修改缓冲区内容之前将缓冲区内容进行别名处理 , 所以立刻改变片段会影响未来读取的结果。*/
1052 | bytes(): Uint8Array;
1053 | /** Returns the contents of the unread portion of the buffer as a `string`.
1054 | * @i18n 将缓冲区中未读部分的内容以 `string` 的形式返回。
1055 | *
1056 | * **Warning**: if multibyte characters are present when data is flowing
1057 | * through the buffer, this method may result in incorrect strings due to a
1058 | * character being split.
1059 | * @i18n **警告**: 当数据流经缓冲区时存在多个字节, 这种方法可能会因为字符被拆分而导致字符串的结果错误。*/
1060 | toString(): string;
1061 | /** Returns whether the unread portion of the buffer is empty.
1062 | * @i18n 返回缓冲区的未读部分是否为空。*/
1063 | empty(): boolean;
1064 | /** A read only number of bytes of the unread portion of the buffer.
1065 | * @i18n 只读缓冲区未读部分的字节数。*/
1066 | readonly length: number;
1067 | /** The read only capacity of the buffer's underlying byte slice, that is,
1068 | * the total space allocated for the buffer's data.
1069 | * @i18n 缓冲区底层字节片段的只读容量,即为缓冲区数据分配的总空间。*/
1070 | readonly capacity: number;
1071 | /** Discards all but the first `n` unread bytes from the buffer but
1072 | * continues to use the same allocated storage. It throws if `n` is
1073 | * negative or greater than the length of the buffer.
1074 | * @i18n 除了缓冲器中开头 `n` 个未读字节之外,其他的所有字节都丢弃,但是继续使用相同分配的存储空间。
1075 | * 当 `n` 为负数或者大于缓冲区的长度, 则会抛出异常。*/
1076 | truncate(n: number): void;
1077 | /** Resets the buffer to be empty, but it retains the underlying storage for
1078 | * use by future writes. `.reset()` is the same as `.truncate(0)`.
1079 | * @i18n 将缓冲区重置为空,但它保留了底层存储供未来写入时使用,`.reset()` 与 `.truncate(0)` 相同。*/
1080 | reset(): void;
1081 | /** Reads the next `p.length` bytes from the buffer or until the buffer is
1082 | * drained. Returns the number of bytes read. If the buffer has no data to
1083 | * return, the return is `Deno.EOF`.
1084 | * @i18n 在缓冲区中读取下一个 `p.length` 字节,或直到缓冲区用完为止。
1085 | * 返回只读的字节数。当缓冲区没有数据返回,则返回值为 `Deno.EOF`。*/
1086 | readSync(p: Uint8Array): number | EOF;
1087 | /** Reads the next `p.length` bytes from the buffer or until the buffer is
1088 | * drained. Resolves to the number of bytes read. If the buffer has no
1089 | * data to return, resolves to `Deno.EOF`.
1090 | * @i18n 在缓冲区中读取下一个 `p.length` 字节,或直到缓冲区用完为止。
1091 | * 解析读取的字节数。当缓冲区没有数据返回,则解析为 `Deno.EOF`。*/
1092 | read(p: Uint8Array): Promise;
1093 | writeSync(p: Uint8Array): number;
1094 | write(p: Uint8Array): Promise;
1095 | /** Grows the buffer's capacity, if necessary, to guarantee space for
1096 | * another `n` bytes. After `.grow(n)`, at least `n` bytes can be written to
1097 | * the buffer without another allocation. If `n` is negative, `.grow()` will
1098 | * throw. If the buffer can't grow it will throw an error.
1099 | * @i18n 增加缓冲区的容量,必要时保证另一个 `n` 字节的空间。
1100 | * 在 `.grow(n)` 之后,至少可以将 `n` 个字节写到缓冲区中而不需要另外分配。
1101 | * 若 `n` 为负数,`.grow()` 将抛出异常。
1102 | * 当缓冲区不能增加的时候会抛出错误。
1103 | *
1104 | * Based on Go Lang's
1105 | * [Buffer.Grow](https://golang.org/pkg/bytes/#Buffer.Grow).
1106 | * @i18n 基于 Go Lang 的
1107 | * [Buffer.Grow](https://golang.org/pkg/bytes/#Buffer.Grow)。*/
1108 | grow(n: number): void;
1109 | /** Reads data from `r` until `Deno.EOF` and appends it to the buffer,
1110 | * growing the buffer as needed. It resolves to the number of bytes read.
1111 | * If the buffer becomes too large, `.readFrom()` will reject with an error.
1112 | * @i18n 从 `r` 读取数据直到 `Deno.EOF`,并将其附加到缓冲区,根据需要扩展缓冲区。
1113 | * 解析读取的字节数。 如果缓冲区过大,`.readFrom()` 将会 reject 一个错误。
1114 | *
1115 | * Based on Go Lang's
1116 | * [Buffer.ReadFrom](https://golang.org/pkg/bytes/#Buffer.ReadFrom).
1117 | * @i18n 基于 Go Lang 的
1118 | * [Buffer.ReadFrom](https://golang.org/pkg/bytes/#Buffer.ReadFrom)。*/
1119 | readFrom(r: Reader): Promise;
1120 | /** Reads data from `r` until `Deno.EOF` and appends it to the buffer,
1121 | * growing the buffer as needed. It returns the number of bytes read. If the
1122 | * buffer becomes too large, `.readFromSync()` will throw an error.
1123 | * @i18n 从 `r` 读取数据直到 `Deno.EOF`,并将其附加到缓冲区,根据需要扩展缓冲区。
1124 | * 返回读取的字节数,如果缓冲区过大,`.readFromSync()` 将会抛出错误。
1125 | *
1126 | * Based on Go Lang's
1127 | * [Buffer.ReadFrom](https://golang.org/pkg/bytes/#Buffer.ReadFrom).
1128 | * @i18n 基于 Go Lang 的
1129 | * [Buffer.ReadFrom](https://golang.org/pkg/bytes/#Buffer.ReadFrom)。*/
1130 | readFromSync(r: ReaderSync): number;
1131 | }
1132 |
1133 | /** Read Reader `r` until end of file (`Deno.EOF`) and resolve to the content
1134 | * as `Uint8Array`.
1135 | * @i18n 读取 Reader `r` 直到文件的末尾 (`Deno.EOF`),返回文件的内容,以 `Uint8Array` 表示。
1136 | *
1137 | * // Example:从 stdin 读取
1138 | * const stdinContent = await Deno.readAll(Deno.stdin);
1139 | *
1140 | * // Example:从文件读取
1141 | * const file = await Deno.open("my_file.txt", {read: true});
1142 | * const myFileContent = await Deno.readAll(file);
1143 | * Deno.close(file.rid);
1144 | *
1145 | * // Example:从 buffer 读取
1146 | * const myData = new Uint8Array(100);
1147 | * // ... 此处省略了填充 myData 数组的代码
1148 | * const reader = new Deno.Buffer(myData.buffer as ArrayBuffer);
1149 | * const bufferContent = await Deno.readAll(reader);
1150 | */
1151 | export function readAll(r: Reader): Promise;
1152 |
1153 | /** Synchronously reads Reader `r` until end of file (`Deno.EOF`) and returns
1154 | * the content as `Uint8Array`.
1155 | * @i18n 同步地读取 Reader `r` 直到文件的末尾 (`Deno.EOF`),返回文件的内容,以 `Uint8Array` 表示。
1156 | *
1157 | * // Example:从 stdin 读取
1158 | * const stdinContent = Deno.readAllSync(Deno.stdin);
1159 | *
1160 | * // Example:从文件读取
1161 | * const file = Deno.openSync("my_file.txt", {read: true});
1162 | * const myFileContent = Deno.readAllSync(file);
1163 | * Deno.close(file.rid);
1164 | *
1165 | * // Example:从 buffer 读取
1166 | * const myData = new Uint8Array(100);
1167 | * //... 此处省略了填充 myData 数组的代码
1168 | * const reader = new Deno.Buffer(myData.buffer as ArrayBuffer);
1169 | * const bufferContent = Deno.readAllSync(reader);
1170 | */
1171 | export function readAllSync(r: ReaderSync): Uint8Array;
1172 |
1173 | /** Write all the content of the array buffer (`arr`) to the writer (`w`).
1174 | * @i18n 将所有 Array Buffer (`arr`)中的的内容写入到对象 (`w`) 中。
1175 | *
1176 | * // 举例:写入到 stdout
1177 | * const contentBytes = new TextEncoder().encode("Hello World");
1178 | * await Deno.writeAll(Deno.stdout, contentBytes);
1179 | *
1180 | * // 举例:写入到文件
1181 | * const contentBytes = new TextEncoder().encode("Hello World");
1182 | * const file = await Deno.open('test.file', {write: true});
1183 | * await Deno.writeAll(file, contentBytes);
1184 | * Deno.close(file.rid);
1185 | *
1186 | * // 举例:写入到 Buffer 对象
1187 | * const contentBytes = new TextEncoder().encode("Hello World");
1188 | * const writer = new Deno.Buffer();
1189 | * await Deno.writeAll(writer, contentBytes);
1190 | * console.log(writer.bytes().length); // 11
1191 | */
1192 | export function writeAll(w: Writer, arr: Uint8Array): Promise;
1193 |
1194 | /** Synchronously write all the content of the array buffer (`arr`) to the
1195 | * writer (`w`).
1196 | * @i18n 将所有 Array Buffer (`arr`)中的的内容同步写入到对象 (`w`) 中。
1197 | *
1198 | * // 举例:写入到 stdout
1199 | * const contentBytes = new TextEncoder().encode("Hello World");
1200 | * Deno.writeAllSync(Deno.stdout, contentBytes);
1201 | *
1202 | * // 举例:写入到文件
1203 | * const contentBytes = new TextEncoder().encode("Hello World");
1204 | * const file = Deno.openSync('test.file', {write: true});
1205 | * Deno.writeAllSync(file, contentBytes);
1206 | * Deno.close(file.rid);
1207 | *
1208 | * // 举例:写入到 Buffer 对象
1209 | * const contentBytes = new TextEncoder().encode("Hello World");
1210 | * const writer = new Deno.Buffer();
1211 | * Deno.writeAllSync(writer, contentBytes);
1212 | * console.log(writer.bytes().length); // 11
1213 | */
1214 | export function writeAllSync(w: WriterSync, arr: Uint8Array): void;
1215 |
1216 | export interface MkdirOptions {
1217 | /** Defaults to `false`. If set to `true`, means that any intermediate
1218 | * directories will also be created (as with the shell command `mkdir -p`).
1219 | * Intermediate directories are created with the same permissions.
1220 | * When recursive is set to `true`, succeeds silently (without changing any
1221 | * permissions) if a directory already exists at the path, or if the path
1222 | * is a symlink to an existing directory.
1223 | * @i18n 默认为 `false`。
1224 | * 如果设置为 `true`,则意味着还将创建所有中间目录(如 shell 命令 `mkdir -p` 那样)。
1225 | * 使用相同的权限创建中间目录。
1226 | * 当设置为 `true` 时,如果路径中已经存在目录,或者该路径是到现有目录的符号链接,则会静默地操作成功(不更改任何权限)。*/
1227 | recursive?: boolean;
1228 | /** Permissions to use when creating the directory (defaults to `0o777`,
1229 | * before the process's umask).
1230 | * Ignored on Windows.
1231 | * @i18n 创建目录时使用的权限(在调用 `umask` 之前,默认值为 `0o777`)。在 Windows 上被忽略。*/
1232 | mode?: number;
1233 | }
1234 |
1235 | /** Synchronously creates a new directory with the specified path.
1236 | * @i18n 同步地在指定路径下创建一个新的目录。
1237 | *
1238 | * Deno.mkdirSync("new_dir");
1239 | * Deno.mkdirSync("nested/directories", { recursive: true });
1240 | * Deno.mkdirSync("restricted_access_dir", { mode: 0o700 });
1241 | *
1242 | * Defaults to throwing error if the directory already exists.
1243 | * @i18n 目录存在的情况下,默认抛出错误。
1244 | *
1245 | * Requires `allow-write` permission.
1246 | * @i18n 需要 `allow-write` 权限。*/
1247 | export function mkdirSync(path: string, options?: MkdirOptions): void;
1248 |
1249 | /** Creates a new directory with the specified path.
1250 | * @i18n 在指定路径下创建一个新的目录。
1251 | *
1252 | * await Deno.mkdir("new_dir");
1253 | * await Deno.mkdir("nested/directories", { recursive: true });
1254 | * await Deno.mkdir("restricted_access_dir", { mode: 0o700 });
1255 | *
1256 | * Defaults to throwing error if the directory already exists.
1257 | * @i18n 目录存在的情况下,默认抛出错误。
1258 | *
1259 | * Requires `allow-write` permission.
1260 | * @i18n 需要 `allow-write` 权限。*/
1261 | export function mkdir(path: string, options?: MkdirOptions): Promise;
1262 |
1263 | export interface MakeTempOptions {
1264 | /** Directory where the temporary directory should be created (defaults to
1265 | * the env variable TMPDIR, or the system's default, usually /tmp).
1266 | * @i18n 指定在哪里创建临时文件夹(默认为环境变量 TMPDIR 或者是系统默认目录,ps:通常是 /tmp)。*/
1267 | dir?: string;
1268 | /** String that should precede the random portion of the temporary
1269 | * directory's name.
1270 | * @i18n 临时文件夹名前缀。*/
1271 | prefix?: string;
1272 | /** String that should follow the random portion of the temporary
1273 | * directory's name.
1274 | * @i18n 临时文件夹名后缀。*/
1275 | suffix?: string;
1276 | }
1277 |
1278 | /** Synchronously creates a new temporary directory in the default directory
1279 | * for temporary files (see also `Deno.dir("temp")`), unless `dir` is specified.
1280 | * Other optional options include prefixing and suffixing the directory name
1281 | * with `prefix` and `suffix` respectively.
1282 | * @i18n 以同步的方式在默认文件夹(另见 `Deno.dir("temp")`)中创建一个临时文件夹,
1283 | * 如果指定了 `dir` , 则在指定的 `dir` 中创建。
1284 | * 其他可选的参数包括分别给文件夹名添加前缀的 `prefix` 和给文件夹名添加后缀的 `sufix`。
1285 | *
1286 | * The full path to the newly created directory is returned.
1287 | * @i18n 返回新建文件夹的完整路径。
1288 | *
1289 | * Multiple programs calling this function simultaneously will create different
1290 | * directories. It is the caller's responsibility to remove the directory when
1291 | * no longer needed.
1292 | * @i18n 多个程序同时调用该函数将会创建不同的文件夹。当不再需要该临时文件夹时,调用者应该主动删除该文件夹。
1293 | *
1294 | * const tempDirName0 = Deno.makeTempDirSync(); // e.g. /tmp/2894ea76
1295 | * const tempDirName1 = Deno.makeTempDirSync({ prefix: 'my_temp' }); // e.g. /tmp/my_temp339c944d
1296 | *
1297 | * Requires `allow-write` permission.
1298 | * @i18n 需要 `allow-write` 权限。*/
1299 | // TODO(ry) Doesn't check permissions.
1300 | export function makeTempDirSync(options?: MakeTempOptions): string;
1301 |
1302 | /** Creates a new temporary directory in the default directory for temporary
1303 | * files (see also `Deno.dir("temp")`), unless `dir` is specified. Other
1304 | * optional options include prefixing and suffixing the directory name with
1305 | * `prefix` and `suffix` respectively.
1306 | * @i18n 在默认文件夹(另见 `Deno.dir("temp")`)中创建一个临时文件夹,
1307 | * 如果指定了 `dir` , 则在指定的 `dir` 中创建。
1308 | * 其他可选的参数包括分别给文件夹名添加前缀的 `prefix` 和给文件夹名添加后缀的 `sufix`。
1309 | *
1310 | * This call resolves to the full path to the newly created directory.
1311 | * @i18n 返回新建文件夹的完整路径。
1312 | *
1313 | * Multiple programs calling this function simultaneously will create different
1314 | * directories. It is the caller's responsibility to remove the directory when
1315 | * no longer needed.
1316 | * @i18n 多个程序同时调用该函数将会创建不同的文件夹。当不再需要该临时文件夹时,调用者应该主动删除该文件夹。
1317 | *
1318 | * const tempDirName0 = await Deno.makeTempDir(); // e.g. /tmp/2894ea76
1319 | * const tempDirName1 = await Deno.makeTempDir({ prefix: 'my_temp' }); // e.g. /tmp/my_temp339c944d
1320 | *
1321 | * Requires `allow-write` permission.
1322 | * @i18n 需要 `allow-write` 权限。*/
1323 | // TODO(ry) Doesn't check permissions.
1324 | export function makeTempDir(options?: MakeTempOptions): Promise;
1325 |
1326 | /** Synchronously creates a new temporary file in the default directory for
1327 | * temporary files (see also `Deno.dir("temp")`), unless `dir` is specified.
1328 | * Other optional options include prefixing and suffixing the directory name
1329 | * with `prefix` and `suffix` respectively.
1330 | * @i18n 以同步的方式在默认文件夹(另见 `Deno.dir("temp")`)中创建一个临时文件,
1331 | * 如果指定了 `dir` , 则在指定的 `dir` 中创建。
1332 | * 其他可选的参数包括分别给文件名添加前缀的 `prefix` 和给文件名添加后缀的 `sufix`。
1333 | *
1334 | * The full path to the newly created file is returned.
1335 | * @i18n 返回新建文件的完整路径。
1336 | *
1337 | * Multiple programs calling this function simultaneously will create different
1338 | * files. It is the caller's responsibility to remove the file when no longer
1339 | * needed.
1340 | * @i18n 多个程序同时调用该函数将会创建不同的文件。当不再需要该临时文件时,调用者应该主动删除该文件。
1341 | *
1342 | * const tempFileName0 = Deno.makeTempFileSync(); // e.g. /tmp/419e0bf2
1343 | * const tempFileName1 = Deno.makeTempFileSync({ prefix: 'my_temp' }); //e.g. /tmp/my_temp754d3098
1344 | *
1345 | * Requires `allow-write` permission.
1346 | * @i18n 需要 `allow-write` 权限。*/
1347 | export function makeTempFileSync(options?: MakeTempOptions): string;
1348 |
1349 | /** Creates a new temporary file in the default directory for temporary
1350 | * files (see also `Deno.dir("temp")`), unless `dir` is specified. Other
1351 | * optional options include prefixing and suffixing the directory name with
1352 | * `prefix` and `suffix` respectively.
1353 | * @i18n 在默认文件夹(另见 `Deno.dir("temp")`)中创建一个临时文件,
1354 | * 如果指定了 `dir` , 则在指定的 `dir` 中创建。
1355 | * 其他可选的参数包括分别给文件名添加前缀的 `prefix` 和给文件名添加后缀的 `sufix`。
1356 | *
1357 | * This call resolves to the full path to the newly created file.
1358 | * @i18n 返回新建文件的完整路径。
1359 | *
1360 | * Multiple programs calling this function simultaneously will create different
1361 | * files. It is the caller's responsibility to remove the file when no longer
1362 | * needed.
1363 | * @i18n 多个程序同时调用该函数将会创建不同的文件。当不再需要该临时文件时,调用者应该主动删除该文件。
1364 | *
1365 | * const tmpFileName0 = await Deno.makeTempFile(); // e.g. /tmp/419e0bf2
1366 | * const tmpFileName1 = await Deno.makeTempFile({ prefix: 'my_temp' }); //e.g. /tmp/my_temp754d3098
1367 | *
1368 | * Requires `allow-write` permission.
1369 | * @i18n 需要 `allow-write` 权限。*/
1370 | export function makeTempFile(options?: MakeTempOptions): Promise;
1371 |
1372 | /** Synchronously changes the permission of a specific file/directory of
1373 | * specified path. Ignores the process's umask.
1374 | * @i18n 同步地更改指定路径下特定的文件/目录的权限。忽略进程的 umask。
1375 | *
1376 | * Deno.chmodSync("/path/to/file", 0o666);
1377 | *
1378 | * For a full description, see [chmod](#chmod)
1379 | * @i18n 相关完整说明,参考 [chmod](#chmod)
1380 | *
1381 | * NOTE: This API currently throws on Windows
1382 | * @i18n 注意:该 API 当前在 Windows 上使用会抛出异常。
1383 | *
1384 | * Requires `allow-write` permission.
1385 | * @i18n 需要 `allow-write` 权限。*/
1386 | export function chmodSync(path: string, mode: number): void;
1387 |
1388 | /** Changes the permission of a specific file/directory of specified path.
1389 | * Ignores the process's umask.
1390 | * @i18n 更改指定路径下特定的文件/目录的权限。忽略进程的 umask。
1391 | *
1392 | * await Deno.chmod("/path/to/file", 0o666);
1393 | *
1394 | * The mode is a sequence of 3 octal numbers. The first/left-most number
1395 | * specifies the permissions for the owner. The second number specifies the
1396 | * permissions for the group. The last/right-most number specifies the
1397 | * permissions for others. For example, with a mode of 0o764, the owner (7) can
1398 | * read/write/execute, the group (6) can read/write and everyone else (4) can
1399 | * read only.
1400 | * @i18n 该模式是3个八进制数字的序列。
1401 | * 第一个/最左边的数字指定所有者(owner)的权限。
1402 | * 第二个数字指定组(group)的权限。
1403 | * 最后/最右边的数字指定其他用户的权限。
1404 | * 例如,在 0o764 模式下,所有者(owner)有读/写/执行权限(7),组(group)有读/写权限(6),
1405 | * 其他用户(4)只有读的权限。
1406 | *
1407 | * | 值 | 说明 |
1408 | * | ------ | ----------- |
1409 | * | 7 | read, write, and execute |
1410 | * | 6 | read and write |
1411 | * | 5 | read and execute |
1412 | * | 4 | read only |
1413 | * | 3 | write and execute |
1414 | * | 2 | write only |
1415 | * | 1 | execute only |
1416 | * | 0 | no permission |
1417 | *
1418 | * NOTE: This API currently throws on Windows
1419 | * @i18n 注意:该 API 当前在 Windows 上使用会抛出异常。
1420 | *
1421 | * Requires `allow-write` permission.
1422 | * @i18n 需要 `allow-write` 权限。*/
1423 | export function chmod(path: string, mode: number): Promise;
1424 |
1425 | /** Synchronously change owner of a regular file or directory. This functionality
1426 | * is not available on Windows.
1427 | * @i18n 同步地更改常规文件或目录的所有者。该功能在 Windows 上不可用。
1428 | *
1429 | * Deno.chownSync("myFile.txt", 1000, 1002);
1430 | *
1431 | * Requires `allow-write` permission.
1432 | * @i18n 需要 `allow-write` 权限。
1433 | *
1434 | * Throws Error (not implemented) if executed on Windows
1435 | * @i18n 如果在 Windows 上执行,将抛出错误(未实现)。
1436 | *
1437 | * @param path path to the file
1438 | * @param_i18n path 文件路径
1439 | * @param uid 文件新的所有者的用户 ID (UID)
1440 | * @param_i18n uid user id (UID) of the new owner
1441 | * @param gid group id (GID) of the new owner
1442 | * @param_i18n gid 文件新的所有者的用户组 ID (GID)
1443 | */
1444 | export function chownSync(path: string, uid: number, gid: number): void;
1445 |
1446 | /** Change owner of a regular file or directory. This functionality
1447 | * is not available on Windows.
1448 | * @i18n 更改常规文件或目录的所有者。该功能在 Windows 上不可用。
1449 | *
1450 | * await Deno.chown("myFile.txt", 1000, 1002);
1451 | *
1452 | * Requires `allow-write` permission.
1453 | * @i18n 需要 `allow-write` 权限。
1454 | *
1455 | * Throws Error (not implemented) if executed on Windows
1456 | * @i18n 如果在 Windows 上执行,将抛出错误(未实现)。
1457 | *
1458 | * @param path path to the file
1459 | * @param_i18n path 文件路径
1460 | * @param uid 文件新的所有者的用户 ID (UID)
1461 | * @param_i18n uid user id (UID) of the new owner
1462 | * @param gid group id (GID) of the new owner
1463 | * @param_i18n gid 文件新的所有者的用户组 ID (GID)
1464 | */
1465 | export function chown(path: string, uid: number, gid: number): Promise;
1466 |
1467 | /** **UNSTABLE**: needs investigation into high precision time.
1468 | * @i18n **不稳定**:需要对高精度时间(hrtime)进行调查。
1469 | *
1470 | * Synchronously changes the access (`atime`) and modification (`mtime`) times
1471 | * of a file system object referenced by `path`. Given times are either in
1472 | * seconds (UNIX epoch time) or as `Date` objects.
1473 | * @i18n 同步地更改路径(`path`)引用的文件系统对象的访问时间(`atime`)和修改时间(`mtime`)。
1474 | * 给定的时间参数可以是秒(UNIX 纪元时间)或者日期对象。
1475 | *
1476 | * Deno.utimeSync("myfile.txt", 1556495550, new Date());
1477 | *
1478 | * Requires `allow-write` permission.
1479 | * @i18n 需要 `allow-write` 权限。*/
1480 | export function utimeSync(
1481 | path: string,
1482 | atime: number | Date,
1483 | mtime: number | Date
1484 | ): void;
1485 |
1486 | /** **UNSTABLE**: needs investigation into high precision time.
1487 | * @i18n **UNSTABLE**: 需要调研高精度的 time。
1488 | *
1489 | * Changes the access (`atime`) and modification (`mtime`) times of a file
1490 | * system object referenced by `path`. Given times are either in seconds
1491 | * (UNIX epoch time) or as `Date` objects.
1492 | * @i18n 基于文件系统的 `path` 改变访问 (`atime`) 和修改 (`mtime`) 的时间。
1493 | * 给定的时间以秒 (UNIX epoch time) 为单位或着是 `Date` 对象。
1494 | *
1495 | * await Deno.utime("myfile.txt", 1556495550, new Date());
1496 | *
1497 | * Requires `allow-write` permission.
1498 | * @i18n 需要 `allow-write` 权限。*/
1499 | export function utime(
1500 | path: string,
1501 | atime: number | Date,
1502 | mtime: number | Date
1503 | ): Promise;
1504 |
1505 | export interface RemoveOptions {
1506 | /** Defaults to `false`. If set to `true`, path will be removed even if
1507 | * it's a non-empty directory.
1508 | * @i18n 默认为 `false`。如果设置为 `true`,则即使路径为非空目录也会被删除。*/
1509 | recursive?: boolean;
1510 | }
1511 |
1512 | /** Synchronously removes the named file or directory.
1513 | * @i18n 同步删除指定的文件或目录。
1514 | *
1515 | * Deno.removeSync("/path/to/empty_dir/or/file");
1516 | * Deno.removeSync("/path/to/populated_dir/or/file", { recursive: true });
1517 | *
1518 | * Throws error if permission denied, path not found, or path is a non-empty
1519 | * directory and the `recursive` option isn't set to `true`.
1520 | * @i18n 当权限被拒绝、路径找不到或者为非空目录且 `recursive` 未设置为 `true`,则抛出异常。
1521 | *
1522 | * Requires `allow-write` permission.
1523 | * @i18n 需要 `allow-write` 权限。*/
1524 | export function removeSync(path: string, options?: RemoveOptions): void;
1525 |
1526 | /** Removes the named file or directory.
1527 | * @i18n 删除指定的文件或目录。
1528 | *
1529 | * await Deno.remove("/path/to/empty_dir/or/file");
1530 | * await Deno.remove("/path/to/populated_dir/or/file", { recursive: true });
1531 | *
1532 | * Throws error if permission denied, path not found, or path is a non-empty
1533 | * directory and the `recursive` option isn't set to `true`.
1534 | * @i18n 当权限被拒绝、路径找不到或者为非空目录且 `recursive` 未设置为 `true`,则抛出异常。
1535 | *
1536 | * Requires `allow-write` permission.
1537 | * @i18n 需要 `allow-write` 权限。*/
1538 | export function remove(path: string, options?: RemoveOptions): Promise;
1539 |
1540 | /** Synchronously renames (moves) `oldpath` to `newpath`. Paths may be files or
1541 | * directories. If `newpath` already exists and is not a directory,
1542 | * `renameSync()` replaces it. OS-specific restrictions may apply when
1543 | * `oldpath` and `newpath` are in different directories.
1544 | * @i18n 同步方式将 `oldpath` 重命名(或移动)为 `newpath`。路径可以是文件或目录。
1545 | * 如果 `newpath` 已经存在且不是目录,那么 `rename()` 将替换它。
1546 | * 当 `oldpath` 和 `newpath` 位于不同的目录中时,可能会受到操作系统的限制。
1547 | *
1548 | * Deno.renameSync("old/path", "new/path");
1549 | *
1550 | * On Unix, this operation does not follow symlinks at either path.
1551 | * @i18n 在 Unix 系统上,此操作不会修改符号链接所指向的内容。
1552 | *
1553 | * It varies between platforms when the operation throws errors, and if so what
1554 | * they are. It's always an error to rename anything to a non-empty directory.
1555 | * @i18n 当操作引发错误时,平台之间会有所不同。
1556 | * 如果 `newpath` 是非空目录则始终会报错。
1557 | *
1558 | * Requires `allow-read` and `allow-write` permissions.
1559 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。*/
1560 | export function renameSync(oldpath: string, newpath: string): void;
1561 |
1562 | /** Renames (moves) `oldpath` to `newpath`. Paths may be files or directories.
1563 | * If `newpath` already exists and is not a directory, `rename()` replaces it.
1564 | * OS-specific restrictions may apply when `oldpath` and `newpath` are in
1565 | * different directories.
1566 | * @i18n 将 `oldpath` 重命名(或移动)为 `newpath`。路径可以是文件或目录。
1567 | * 如果 `newpath` 已经存在且不是目录,那么 `rename()` 将替换它。
1568 | * 当 `oldpath` 和 `newpath` 位于不同的目录中时,可能会受到操作系统的限制。
1569 | *
1570 | * await Deno.rename("old/path", "new/path");
1571 | *
1572 | * On Unix, this operation does not follow symlinks at either path.
1573 | * @i18n 在 Unix 系统上,此操作不会修改符号链接所指向的内容。
1574 | *
1575 | * It varies between platforms when the operation throws errors, and if so what
1576 | * they are. It's always an error to rename anything to a non-empty directory.
1577 | * @i18n 当操作引发错误时,平台之间会有所不同。
1578 | * 如果 `newpath` 是非空目录则始终会报错。
1579 | *
1580 | * Requires `allow-read` and `allow-write` permission.
1581 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。*/
1582 | export function rename(oldpath: string, newpath: string): Promise;
1583 |
1584 | /** Synchronously reads and returns the entire contents of a file as an array
1585 | * of bytes. `TextDecoder` can be used to transform the bytes to string if
1586 | * required. Reading a directory returns an empty data array.
1587 | * @i18n 同步地读取并将文件的全部内容解析为字节数组。
1588 | * `TextDecoder` 可以在需要的情况下可以将字节转换成字符串。
1589 | * 读取目录返回一个空的数据数组。
1590 | *
1591 | * const decoder = new TextDecoder("utf-8");
1592 | * const data = Deno.readFileSync("hello.txt");
1593 | * console.log(decoder.decode(data));
1594 | *
1595 | * Requires `allow-read` permission.
1596 | * @i18n 需要 `allow-read` 权限。*/
1597 | export function readFileSync(path: string): Uint8Array;
1598 |
1599 | /** Reads and resolves to the entire contents of a file as an array of bytes.
1600 | * `TextDecoder` can be used to transform the bytes to string if required.
1601 | * Reading a directory returns an empty data array.
1602 | * @i18n 读取并将文件的全部内容解析为字节数组。
1603 | * `TextDecoder` 可以在需要的情况下可以将字节转换成字符串。
1604 | * 读取目录返回一个空的数据数组。
1605 | *
1606 | * const decoder = new TextDecoder("utf-8");
1607 | * const data = await Deno.readFile("hello.txt");
1608 | * console.log(decoder.decode(data));
1609 | *
1610 | * Requires `allow-read` permission.
1611 | * @i18n 需要 `allow-read` 权限。*/
1612 | export function readFile(path: string): Promise;
1613 |
1614 | /** A FileInfo describes a file and is returned by `stat`, `lstat`,
1615 | * `statSync`, `lstatSync`.
1616 | * @i18n FileInfo 用于描述 `stat`, `lstat`,
1617 | * `statSync`, `lstatSync` 函数返回的文件信息。而 `readdir`,
1618 | * `readdirSync` 返回的信息则用 FileInfo 列表来描述。*/
1619 | export interface FileInfo {
1620 | /** True if this is info for a regular file. Mutually exclusive to
1621 | * `FileInfo.isDirectory` and `FileInfo.isSymlink`.
1622 | * @i18n 判断文件是否为一个常规文件。该结果与 `FileInfo.isDirectory` 和 `FileInfo.isSymlink` 互斥。*/
1623 | isFile: boolean;
1624 | /** True if this is info for a regular directory. Mutually exclusive to
1625 | * `FileInfo.isFile` and `FileInfo.isSymlink`.
1626 | * @i18n 判断文件是否为一个常规目录。该结果与 `FileInfo.isFile` 和 `FileInfo.isSymlink` 互斥。*/
1627 | isDirectory: boolean;
1628 | /** True if this is info for a symlink. Mutually exclusive to
1629 | * `FileInfo.isFile` and `FileInfo.isDirectory`.
1630 | * @i18n 判断文件是否为一个符号链接。该结果与 `FileInfo.isDirectory` 和 `FileInfo.isDirectory` 互斥。*/
1631 | isSymlink: boolean;
1632 | /** The size of the file, in bytes.
1633 | * @i18n 文件的大小,单位 byte。*/
1634 | size: number;
1635 | /** The last modification time of the file. This corresponds to the `mtime`
1636 | * field from `stat` on Linux/Mac OS and `ftLastWriteTime` on Windows. This
1637 | * may not be available on all platforms.
1638 | * @i18n 文件最后修改时间。
1639 | * 在 Linux/Mac 系统这个值是 `mtime`,在 Windows 系统这个值是 `ftLastWriteTime`。
1640 | * 在某些系统中这个属性可能不存在。*/
1641 | modified: number | null;
1642 | /** The last access time of the file. This corresponds to the `atime`
1643 | * field from `stat` on Unix and `ftLastAccessTime` on Windows. This may not
1644 | * be available on all platforms.
1645 | * @i18n 文件最后访问时间。
1646 | * 在 Linux/Mac 系统这个值是 `atime`,在 Windows 系统这个值是 `ftLastAccessTime`。
1647 | * 在某些系统中这个属性可能不存在。*/
1648 | accessed: number | null;
1649 | /** The last access time of the file. This corresponds to the `birthtime`
1650 | * field from `stat` on Mac/BSD and `ftCreationTime` on Windows. This may not
1651 | * be available on all platforms.
1652 | * @i18n 文件的创建时间。
1653 | * 在 Linux/Mac 系统这个值是 `birthtime`,在 Windows 系统这个值是 `ftCreationTime`。
1654 | * 在某些系统中这个属性可能不存在。*/
1655 | created: number | null;
1656 | /** ID of the device containing the file.
1657 | * @i18n 包含此文件的设备的 ID。
1658 | *
1659 | * _Linux/Mac OS only._
1660 | * @i18n _只在 Linux/Mac OS 有效。_*/
1661 | dev: number | null;
1662 | /** Inode number.
1663 | * @i18n Inode 值。
1664 | *
1665 | * _Linux/Mac OS only._
1666 | * @i18n _只在 Linux/Mac OS 有效。_*/
1667 | ino: number | null;
1668 | /** **UNSTABLE**: Match behavior with Go on Windows for `mode`.
1669 | * @i18n **不稳定**: 将此属性的行为与 Windows 上的 Go 相匹配。
1670 | *
1671 | * The underlying raw `st_mode` bits that contain the standard Unix
1672 | * permissions for this file/directory.
1673 | * @i18n 该文件或目录的权限位,返回标准的 Unix 底层 `st_mode` 位。*/
1674 | mode: number | null;
1675 | /** Number of hard links pointing to this file.
1676 | * @i18n 文件的硬链接数。
1677 | *
1678 | * _Linux/Mac OS only._
1679 | * @i18n _只在 Linux/Mac OS 有效。_*/
1680 | nlink: number | null;
1681 | /** User ID of the owner of this file.
1682 | * @i18n 拥有该文件的用户的 uid。
1683 | *
1684 | * _Linux/Mac OS only._
1685 | * @i18n _只在 Linux/Mac OS 有效。_*/
1686 | uid: number | null;
1687 | /** User ID of the owner of this file.
1688 | * @i18n 拥有该文件的用户组的 gid。
1689 | *
1690 | * _Linux/Mac OS only._
1691 | * @i18n _只在 Linux/Mac OS 有效。_*/
1692 | gid: number | null;
1693 | /** Device ID of this file.
1694 | * @i18n 文件设备标识符 ID。
1695 | *
1696 | * _Linux/Mac OS only._
1697 | * @i18n _只在 Linux/Mac OS 有效。_*/
1698 | rdev: number | null;
1699 | /** Blocksize for filesystem I/O.
1700 | * @i18n 用于 I/O 操作的文件系统块的大小。
1701 | *
1702 | * _Linux/Mac OS only._
1703 | * @i18n _只在 Linux/Mac OS 有效。_*/
1704 | blksize: number | null;
1705 | /** Number of blocks allocated to the file, in 512-byte units.
1706 | * @i18n 为此文件分配的块数,此值是一个 512 字节单位。
1707 | *
1708 | * _Linux/Mac OS only._
1709 | * @i18n _只在 Linux/Mac OS 有效。_*/
1710 | blocks: number | null;
1711 | }
1712 |
1713 | /** Returns absolute normalized path, with symbolic links resolved.
1714 | * @i18n 返回被解析后的符号链接绝对路径。
1715 | *
1716 | * // e.g. given /home/alice/file.txt and current directory /home/alice
1717 | * Deno.symlinkSync("file.txt", "symlink_file.txt");
1718 | * const realPath = Deno.realpathSync("./file.txt");
1719 | * const realSymLinkPath = Deno.realpathSync("./symlink_file.txt");
1720 | * console.log(realPath); // outputs "/home/alice/file.txt"
1721 | * console.log(realSymLinkPath); //outputs "/home/alice/file.txt"
1722 | *
1723 | * Requires `allow-read` permission.
1724 | * @i18n 需要 `allow-read` 权限。*/
1725 | export function realpathSync(path: string): string;
1726 |
1727 | /** Resolves to the absolute normalized path, with symbolic links resolved.
1728 | * @i18n 返回被解析后的符号链接绝对路径。
1729 | *
1730 | * // e.g. given /home/alice/file.txt and current directory /home/alice
1731 | * await Deno.symlink("file.txt", "symlink_file.txt");
1732 | * const realPath = await Deno.realpath("./file.txt");
1733 | * const realSymLinkPath = await Deno.realpath("./symlink_file.txt");
1734 | * console.log(realPath); // outputs "/home/alice/file.txt"
1735 | * console.log(realSymLinkPath); //outputs "/home/alice/file.txt"
1736 | *
1737 | * Requires `allow-read` permission.
1738 | * @i18n 需要 `allow-read` 权限*/
1739 | export function realpath(path: string): Promise;
1740 |
1741 | export interface DirEntry extends FileInfo {
1742 | name: string;
1743 | }
1744 |
1745 | /** Synchronously reads the directory given by `path` and returns an iterable
1746 | * of `Deno.DirEntry`.
1747 | * @i18n 同步读取 `path` 文件目录,并返回 `Deno.DirEntry` 迭代器。
1748 | *
1749 | * for (const dirEntry of Deno.readdirSync("/")) {
1750 | * console.log(dirEntry.name);
1751 | * }
1752 | *
1753 | * Throws error if `path` is not a directory.
1754 | * @i18n 如果 `path` 不是目录则抛出错误。
1755 | *
1756 | * Requires `allow-read` permission.
1757 | * @i18n 需要 `allow-read` 权限。*/
1758 | export function readdirSync(path: string): Iterable;
1759 |
1760 | /** Reads the directory given by `path` and returns an async iterable of
1761 | * `Deno.DirEntry`.
1762 | * @i18n 读取 `path` 文件目录,并返回 `Deno.DirEntry` 迭代器。
1763 | *
1764 | * for await (const dirEntry of Deno.readdir("/")) {
1765 | * console.log(dirEntry.name);
1766 | * }
1767 | *
1768 | * Throws error if `path` is not a directory.
1769 | * @i18n 如果 `path` 不是目录则抛出错误。
1770 | *
1771 | * Requires `allow-read` permission. */
1772 | export function readdir(path: string): AsyncIterable;
1773 |
1774 | /** Synchronously copies the contents and permissions of one file to another
1775 | * specified path, by default creating a new file if needed, else overwriting.
1776 | * Fails if target path is a directory or is unwritable.
1777 | * @i18n 采用同步方式将一个文件的内容和权限复制到另一个指定的路径,默认情况下根据需要
1778 | * 创建新文件或者覆盖原文件。 如果目标路径是目录或不可写,则失败。
1779 | *
1780 | * Deno.copyFileSync("from.txt", "to.txt");
1781 | *
1782 | * Requires `allow-read` permission on fromPath.
1783 | * Requires `allow-write` permission on toPath.
1784 | * @i18n `fromPath` 需要 `allow-read` 权限。
1785 | * `toPath` 需要 `allow-write` 权限。*/
1786 | export function copyFileSync(fromPath: string, toPath: string): void;
1787 |
1788 | /** Copies the contents and permissions of one file to another specified path,
1789 | * by default creating a new file if needed, else overwriting. Fails if target
1790 | * path is a directory or is unwritable.
1791 | * @i18n 将一个文件的内容和权限复制到另一个指定的路径,默认情况下根据需要
1792 | * 创建新文件或者覆盖原文件。 如果目标路径是目录或不可写,则失败。
1793 | *
1794 | * await Deno.copyFile("from.txt", "to.txt");
1795 | *
1796 | * Requires `allow-read` permission on fromPath.
1797 | * Requires `allow-write` permission on toPath.
1798 | * @i18n `fromPath` 需要 `allow-read` 权限。
1799 | * `toPath` 需要 `allow-write` 权限。*/
1800 | export function copyFile(fromPath: string, toPath: string): Promise;
1801 |
1802 | /** Returns the full path destination of the named symbolic link.
1803 | * @i18n 同步方式解析并返回符号链接对目标文件的绝对路径。
1804 | *
1805 | * Deno.symlinkSync("./test.txt", "./test_link.txt");
1806 | * const target = Deno.readLinkSync("./test_link.txt"); // ./test.txt 的绝对路径
1807 | *
1808 | * Throws TypeError if called with a hard link
1809 | * @i18n 如果使用硬链接调用,则会抛出 `TypeError`。
1810 | *
1811 | * Requires `allow-read` permission.
1812 | * @i18n 需要 `allow-read` 权限。*/
1813 | export function readLinkSync(path: string): string;
1814 |
1815 | /** Resolves to the full path destination of the named symbolic link.
1816 | * @i18n 解析并返回符号链接对目标文件的绝对路径。
1817 | *
1818 | * await Deno.symlink("./test.txt", "./test_link.txt");
1819 | * const target = await Deno.readLink("./test_link.txt"); // ./test.txt 的绝对路径
1820 | *
1821 | * Throws TypeError if called with a hard link
1822 | * @i18n 如果使用硬链接调用,则会抛出 `TypeError`。
1823 | *
1824 | * Requires `allow-read` permission.
1825 | * @i18n 需要 `allow-read` 权限。*/
1826 | export function readLink(path: string): Promise;
1827 |
1828 | /** Resolves to a `Deno.FileInfo` for the specified `path`. If `path` is a
1829 | * symlink, information for the symlink will be returned instead of what it
1830 | * points to.
1831 | * @i18n 解析给定的 `path`,并返回 `Deno.FileInfo`。如果 `path` 是一个
1832 | * 符号链接,则将返回符号链接的信息,而不是该符号链接引用的文件信息。
1833 | *
1834 | * const fileInfo = await Deno.lstat("hello.txt");
1835 | * assert(fileInfo.isFile);
1836 | *
1837 | * Requires `allow-read` permission.
1838 | * @i18n 需要 `allow-read` 权限。*/
1839 | export function lstat(path: string): Promise;
1840 |
1841 | /** Synchronously returns a `Deno.FileInfo` for the specified `path`. If
1842 | * `path` is a symlink, information for the symlink will be returned instead of
1843 | * what it points to..
1844 | * @i18n 同步方式解析给定的 `path`,并返回 `Deno.FileInfo`。如果 `path` 是一个
1845 | * 符号链接,则将返回符号链接的信息,而不是该符号链接引用的文件信息。
1846 | *
1847 | * const fileInfo = Deno.lstatSync("hello.txt");
1848 | * assert(fileInfo.isFile);
1849 | *
1850 | * Requires `allow-read` permission.
1851 | * @i18n 需要 `allow-read` 权限。*/
1852 | export function lstatSync(path: string): FileInfo;
1853 |
1854 | /** Resolves to a `Deno.FileInfo` for the specified `path`. Will always
1855 | * follow symlinks.
1856 | * @i18n 解析给定 `path`,返回 `Deno.FileInfo`。如果 `path` 为符号链接,则返回符号链接指向的文件。
1857 | *
1858 | * const fileInfo = await Deno.stat("hello.txt");
1859 | * assert(fileInfo.isFile);
1860 | *
1861 | * Requires `allow-read` permission.
1862 | * @i18n 需要 `allow-read` 权限。*/
1863 | export function stat(path: string): Promise;
1864 |
1865 | /** Synchronously returns a `Deno.FileInfo` for the specified `path`. Will
1866 | * always follow symlinks.
1867 | * @i18n 同步方式解析给定 `path`,返回 `Deno.FileInfo`。
1868 | * 如果 `path` 为符号链接,则返回符号链接指向的文件。
1869 | *
1870 | * const fileInfo = Deno.statSync("hello.txt");
1871 | * assert(fileInfo.isFile);
1872 | *
1873 | * Requires `allow-read` permission.
1874 | * @i18n 需要 `allow-read` 权限。*/
1875 | export function statSync(path: string): FileInfo;
1876 |
1877 | /** Synchronously creates `newpath` as a hard link to `oldpath`.
1878 | * @i18n 同步方式创建 `newpath` 作为 `oldpath` 的硬链接。
1879 | *
1880 | * Deno.linkSync("old/name", "new/name");
1881 | *
1882 | * Requires `allow-read` and `allow-write` permissions.
1883 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。*/
1884 | export function linkSync(oldpath: string, newpath: string): void;
1885 |
1886 | /** Creates `newpath` as a hard link to `oldpath`.
1887 | * @i18n 创建 `newpath` 作为 `oldpath` 的硬链接。
1888 | *
1889 | * await Deno.link("old/name", "new/name");
1890 | *
1891 | * Requires `allow-read` and `allow-write` permissions.
1892 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。*/
1893 | export function link(oldpath: string, newpath: string): Promise;
1894 |
1895 | /** **UNSTABLE**: `type` argument type may be changed to `"dir" | "file"`.
1896 | * @i18n **不稳定**:`type` 参数可能更改为 `"dir" | "file"` 的联合类型。
1897 | *
1898 | * Creates `newpath` as a symbolic link to `oldpath`.
1899 | * @i18n 同步方式创建 `newpath` 作为指向 `oldpath` 的符号链接。
1900 | *
1901 | * The type argument can be set to `dir` or `file`. This argument is only
1902 | * available on Windows and ignored on other platforms.
1903 | * @i18n `type` 参数可以设置为 `dir` 或 `file`。此参数仅在 Windows 上可用,其他平台会被忽略。
1904 | *
1905 | * NOTE: This function is not yet implemented on Windows.
1906 | * @i18n 注意:此函数尚未在 Windows 上实现。
1907 | *
1908 | * Deno.symlinkSync("old/name", "new/name");
1909 | *
1910 | * Requires `allow-read` and `allow-write` permissions.
1911 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。*/
1912 | export function symlinkSync(
1913 | oldpath: string,
1914 | newpath: string,
1915 | type?: string
1916 | ): void;
1917 |
1918 | /** **UNSTABLE**: `type` argument may be changed to `"dir" | "file"`
1919 | * @i18n **不稳定**:`type` 参数可能更改为 `"dir" | "file"` 的联合类型。
1920 | *
1921 | * Creates `newpath` as a symbolic link to `oldpath`.
1922 | * @i18n 创建 `newpath` 作为指向 `oldpath` 的符号链接。
1923 | *
1924 | * The type argument can be set to `dir` or `file`. This argument is only
1925 | * available on Windows and ignored on other platforms.
1926 | * @i18n `type` 参数可以设置为 `dir` 或 `file`。此参数仅在 Windows 上可用,其他平台会被忽略。
1927 | *
1928 | * NOTE: This function is not yet implemented on Windows.
1929 | * @i18n 注意:此函数尚未在 Windows 上实现。
1930 | *
1931 | * await Deno.symlink("old/name", "new/name");
1932 | *
1933 | * Requires `allow-read` and `allow-write` permissions.
1934 | * @i18n 需要 `allow-read` 和 `allow-write` 权限。*/
1935 | export function symlink(
1936 | oldpath: string,
1937 | newpath: string,
1938 | type?: string
1939 | ): Promise;
1940 |
1941 | /** Options for writing to a file.
1942 | * @i18n `Deno.writeFileSync` 和 `Deno.writeFile` 的选项。*/
1943 | export interface WriteFileOptions {
1944 | /** Defaults to `false`. If set to `true`, will append to a file instead of
1945 | * overwriting previous contents.
1946 | * @i18n 默认为 `false`。如果设置为 `true`,则将追加到文件中,而不是覆盖之前的内容。*/
1947 | append?: boolean;
1948 | /** Sets the option to allow creating a new file, if one doesn't already
1949 | * exist at the specified path (defaults to `true`).
1950 | * @i18n 默认为 `true`。如果指定路径不存在文件,是否允许创建新文件的选项。*/
1951 | create?: boolean;
1952 | /** Permissions always applied to file.
1953 | * @i18n 文件的权限。*/
1954 | mode?: number;
1955 | }
1956 |
1957 | /** Synchronously write `data` to the given `path`, by default creating a new
1958 | * file if needed, else overwriting.
1959 | * @i18n 同步方式将 `data` 写入给定的 `path`,并且根据需要创建新文件或者覆盖原文件。
1960 | *
1961 | * const encoder = new TextEncoder();
1962 | * const data = encoder.encode("Hello world\n");
1963 | * Deno.writeFileSync("hello1.txt", data); // 覆盖或者创建 "hello1.txt"
1964 | * Deno.writeFileSync("hello2.txt", data, {create: false}); // 仅当 "hello2.txt" 存在的情况下才有效
1965 | * Deno.writeFileSync("hello3.txt", data, {mode: 0o777}); // 设置新文件的权限
1966 | * Deno.writeFileSync("hello4.txt", data, {append: true}); // 在文件末尾添加数据
1967 | *
1968 | * Requires `allow-write` permission, and `allow-read` if `options.create` is
1969 | * `false`.
1970 | * @i18n 需要 `allow-write` 权限。如果 `options.create` 为 `false` 且需要 `allow-read` 权限。
1971 | */
1972 | export function writeFileSync(
1973 | path: string,
1974 | data: Uint8Array,
1975 | options?: WriteFileOptions
1976 | ): void;
1977 |
1978 | /** Write `data` to the given `path`, by default creating a new file if needed,
1979 | * else overwriting.
1980 | * @i18n 将 `data` 写入给定的 `path`,并且根据需要创建新文件或者覆盖原文件。
1981 | *
1982 | * const encoder = new TextEncoder();
1983 | * const data = encoder.encode("Hello world\n");
1984 | * await Deno.writeFile("hello1.txt", data); // 覆盖或者创建 "hello1.txt"
1985 | * await Deno.writeFile("hello2.txt", data, {create: false}); // 仅当 "hello2.txt" 存在的情况下才有效
1986 | * await Deno.writeFile("hello3.txt", data, {mode: 0o777}); // 设置新文件的权限
1987 | * await Deno.writeFile("hello4.txt", data, {append: true}); // 在文件末尾添加数据
1988 | *
1989 | * Requires `allow-write` permission, and `allow-read` if `options.create` is `false`.
1990 | * @i18n 需要 `allow-write` 权限。如果 `options.create` 为 `false` 且需要 `allow-read` 权限。
1991 | */
1992 | export function writeFile(
1993 | path: string,
1994 | data: Uint8Array,
1995 | options?: WriteFileOptions
1996 | ): Promise;
1997 |
1998 | /** **UNSTABLE**: Should not have same name as `window.location` type.
1999 | * @i18n **不稳定**: 不应该和 `window.location` 具有相同的类型名。*/
2000 | interface Location {
2001 | /** The full url for the module, e.g. `file://some/file.ts` or
2002 | * `https://some/file.ts`.
2003 | * @i18n 模块的完整 url,例如:`file://some/file.ts` 抑或是 `https://some/file.ts`。*/
2004 | fileName: string;
2005 | /** The line number in the file. It is assumed to be 1-indexed.
2006 | * @i18n 在文件中的行号,从 1 开始索引。*/
2007 | lineNumber: number;
2008 | /** The column number in the file. It is assumed to be 1-indexed.
2009 | * @i18n 在文件中的列号,从 1 开始索引。*/
2010 | columnNumber: number;
2011 | }
2012 |
2013 | /** UNSTABLE: new API, yet to be vetted.
2014 | * @i18n 不稳定: 新 API,尚待审查。
2015 | *
2016 | * Given a current location in a module, lookup the source location and return
2017 | * it.
2018 | * @i18n 给定模块中的当前位置,返回查找到的源文件中位置。
2019 | *
2020 | * When Deno transpiles code, it keep source maps of the transpiled code. This
2021 | * function can be used to lookup the original location. This is
2022 | * automatically done when accessing the `.stack` of an error, or when an
2023 | * uncaught error is logged. This function can be used to perform the lookup
2024 | * for creating better error handling.
2025 | * @i18n 当 Deno 编译代码时,它将保留已编译代码的 source maps。
2026 | * 此功能可用于查找原始位置。
2027 | * 当访问 error 的 `.stack` 属性或出现未捕获的错误时,会自动执行此操作。
2028 | * 此功能可用于查找源文件以创建更好的错误处理。
2029 | *
2030 | * **Note:** `line` and `column` are 1 indexed, which matches display
2031 | * expectations, but is not typical of most index numbers in Deno.
2032 | * @i18n **注意:** `line` 和 `column` 的下标从 1 开始,与代码的显示值匹配,但这种以 1 开始的索引方式并不代表 Deno 中大多数文件都是如此。
2033 | *
2034 | * An example:
2035 | * @i18n 示例:
2036 | *
2037 | * const orig = Deno.applySourceMap({
2038 | * fileName: "file://my/module.ts",
2039 | * lineNumber: 5,
2040 | * columnNumber: 15
2041 | * });
2042 | * console.log(`${orig.filename}:${orig.line}:${orig.column}`);
2043 | */
2044 | export function applySourceMap(location: Location): Location;
2045 |
2046 | /** A set of error constructors that are raised by Deno APIs.
2047 | * @i18n 一些 Error 构造函数的集合,当 Deno API 抛出错误时会用到这些异常。*/
2048 | export const errors: {
2049 | NotFound: ErrorConstructor;
2050 | PermissionDenied: ErrorConstructor;
2051 | ConnectionRefused: ErrorConstructor;
2052 | ConnectionReset: ErrorConstructor;
2053 | ConnectionAborted: ErrorConstructor;
2054 | NotConnected: ErrorConstructor;
2055 | AddrInUse: ErrorConstructor;
2056 | AddrNotAvailable: ErrorConstructor;
2057 | BrokenPipe: ErrorConstructor;
2058 | AlreadyExists: ErrorConstructor;
2059 | InvalidData: ErrorConstructor;
2060 | TimedOut: ErrorConstructor;
2061 | Interrupted: ErrorConstructor;
2062 | WriteZero: ErrorConstructor;
2063 | UnexpectedEof: ErrorConstructor;
2064 | BadResource: ErrorConstructor;
2065 | Http: ErrorConstructor;
2066 | Busy: ErrorConstructor;
2067 | };
2068 |
2069 | /** **UNSTABLE**: potentially want names to overlap more with browser.
2070 | * @i18n **不稳定**:希望与浏览器在名称上有更多的相同。
2071 | *
2072 | * The permissions as granted by the caller.
2073 | * @i18n 调用方授予的权限。
2074 | *
2075 | * See: https://w3c.github.io/permissions/#permission-registry
2076 | * @i18n 具体查看:https://w3c.github.io/permissions/#permission-registry */
2077 | export type PermissionName =
2078 | | "run"
2079 | | "read"
2080 | | "write"
2081 | | "net"
2082 | | "env"
2083 | | "plugin"
2084 | | "hrtime";
2085 |
2086 | /** The current status of the permission.
2087 | * @i18n 权限的状态。
2088 | *
2089 | * See: https://w3c.github.io/permissions/#status-of-a-permission
2090 | * @i18n 具体查看:https://w3c.github.io/permissions/#status-of-a-permission */
2091 | export type PermissionState = "granted" | "denied" | "prompt";
2092 |
2093 | interface RunPermissionDescriptor {
2094 | name: "run";
2095 | }
2096 |
2097 | interface ReadWritePermissionDescriptor {
2098 | name: "read" | "write";
2099 | path?: string;
2100 | }
2101 |
2102 | interface NetPermissionDescriptor {
2103 | name: "net";
2104 | url?: string;
2105 | }
2106 |
2107 | interface EnvPermissionDescriptor {
2108 | name: "env";
2109 | }
2110 |
2111 | interface PluginPermissionDescriptor {
2112 | name: "plugin";
2113 | }
2114 |
2115 | interface HrtimePermissionDescriptor {
2116 | name: "hrtime";
2117 | }
2118 |
2119 | /** Permission descriptors which define a permission which can be queried,
2120 | * requested, or revoked.
2121 | * @i18n 权限描述符,定义一个可以查询、请求或撤销的权限。
2122 | *
2123 | * See: https://w3c.github.io/permissions/#permission-descriptor
2124 | * @i18n 具体查看:https://w3c.github.io/permissions/#permission-descriptor */
2125 | type PermissionDescriptor =
2126 | | RunPermissionDescriptor
2127 | | ReadWritePermissionDescriptor
2128 | | NetPermissionDescriptor
2129 | | EnvPermissionDescriptor
2130 | | PluginPermissionDescriptor
2131 | | HrtimePermissionDescriptor;
2132 |
2133 | export class Permissions {
2134 | /** Resolves to the current status of a permission.
2135 | * @i18n 查询给定权限的状态。
2136 | *
2137 | * const status = await Deno.permissions.query({ name: "read", path: "/etc" });
2138 | * if (status.state === "granted") {
2139 | * data = await Deno.readFile("/etc/passwd");
2140 | * }
2141 | */
2142 | query(desc: PermissionDescriptor): Promise;
2143 |
2144 | /** Revokes a permission, and resolves to the state of the permission.
2145 | * @i18n 撤销给定的权限,并且返回该权限的状态。
2146 | *
2147 | * const status = await Deno.permissions.revoke({ name: "run" });
2148 | * assert(status.state !== "granted")
2149 | */
2150 | revoke(desc: PermissionDescriptor): Promise;
2151 |
2152 | /** Requests the permission, and resolves to the state of the permission.
2153 | * @i18n 请求权限,并且返回该权限请求结果的状态。
2154 | *
2155 | * const status = await Deno.permissions.request({ name: "env" });
2156 | * if (status.state === "granted") {
2157 | * console.log(Deno.homeDir());
2158 | * } else {
2159 | * console.log("'env' permission is denied.");
2160 | * }
2161 | */
2162 | request(desc: PermissionDescriptor): Promise;
2163 | }
2164 |
2165 | /** **UNSTABLE**: maybe move to `navigator.permissions` to match web API.
2166 | * @i18n **不稳定**:可能移动到 `navigator.permissions` 以匹配 web API。*/
2167 | export const permissions: Permissions;
2168 |
2169 | /** see: https://w3c.github.io/permissions/#permissionstatus
2170 | * @i18n 具体查看:https://w3c.github.io/permissions/#permissionstatus */
2171 | export class PermissionStatus {
2172 | state: PermissionState;
2173 | constructor(state: PermissionState);
2174 | }
2175 |
2176 | /** Synchronously truncates or extends the specified file, to reach the
2177 | * specified `len`. If `len` is not specified then the entire file contents
2178 | * are truncated.
2179 | * @i18n 同步地通过指定的 `len` ,截取或者扩展指定的文件内容。如果未指定 `len` ,则整个文件内容将被截取。
2180 | *
2181 | * //truncate the entire file
2182 | * Deno.truncateSync("my_file.txt");
2183 | *
2184 | * //truncate part of the file
2185 | * const file = Deno.makeTempFileSync();
2186 | * Deno.writeFileSync(file, new TextEncoder().encode("Hello World"));
2187 | * Deno.truncateSync(file, 7);
2188 | * const data = Deno.readFileSync(file);
2189 | * console.log(new TextDecoder().decode(data));
2190 | *
2191 | * Requires `allow-write` permission.
2192 | * @i18n 需要 `allow-write` 权限。*/
2193 | export function truncateSync(name: string, len?: number): void;
2194 |
2195 | /** Truncates or extends the specified file, to reach the specified `len`. If
2196 | * `len` is not specified then the entire file contents are truncated.
2197 | * @i18n 通过指定的 `len` ,截取或者扩展指定的文件内容。如果未指定 `len` ,则整个文件内容将被截取。
2198 | *
2199 | * //truncate the entire file
2200 | * await Deno.truncate("my_file.txt");
2201 | *
2202 | * //truncate part of the file
2203 | * const file = await Deno.makeTempFile();
2204 | * await Deno.writeFile(file, new TextEncoder().encode("Hello World"));
2205 | * await Deno.truncate(file, 7);
2206 | * const data = await Deno.readFile(file);
2207 | * console.log(new TextDecoder().decode(data)); //"Hello W"
2208 | *
2209 | * Requires `allow-write` permission.
2210 | * @i18n 需要 `allow-write` 权限。*/
2211 | export function truncate(name: string, len?: number): Promise;
2212 |
2213 | export interface AsyncHandler {
2214 | (msg: Uint8Array): void;
2215 | }
2216 |
2217 | export interface PluginOp {
2218 | dispatch(
2219 | control: Uint8Array,
2220 | zeroCopy?: ArrayBufferView | null
2221 | ): Uint8Array | null;
2222 | setAsyncHandler(handler: AsyncHandler): void;
2223 | }
2224 |
2225 | export interface Plugin {
2226 | ops: {
2227 | [name: string]: PluginOp;
2228 | };
2229 | }
2230 |
2231 | /** **UNSTABLE**: new API, yet to be vetted.
2232 | * @i18n **不稳定**: 新 API,没有经过审查。
2233 | *
2234 | * Open and initalize a plugin.
2235 | * @i18n 打开并初始化插件。
2236 | *
2237 | * const plugin = Deno.openPlugin("./path/to/some/plugin.so");
2238 | * const some_op = plugin.ops.some_op;
2239 | * const response = some_op.dispatch(new Uint8Array([1,2,3,4]));
2240 | * console.log(`Response from plugin ${response}`);
2241 | *
2242 | * Requires `allow-plugin` permission.
2243 | * @i18n 需要 `allow-plugin` 权限。*/
2244 | export function openPlugin(filename: string): Plugin;
2245 | export interface NetAddr {
2246 | transport: "tcp" | "udp";
2247 | hostname: string;
2248 | port: number;
2249 | }
2250 |
2251 | export interface UnixAddr {
2252 | transport: "unix" | "unixpacket";
2253 | address: string;
2254 | }
2255 |
2256 | export type Addr = NetAddr | UnixAddr;
2257 | /** **UNSTABLE**: Maybe remove `ShutdownMode` entirely.
2258 | * @i18n **不稳定**:可能会完全删除 `ShutdownMode`。
2259 | *
2260 | * Corresponds to `SHUT_RD`, `SHUT_WR`, `SHUT_RDWR` on POSIX-like systems.
2261 | * @i18n 对应类 POSIX 系统上的 `SHUT_RD`,`SHUT_WR`,`SHUT_RDWR`。
2262 | *
2263 | * See: http://man7.org/linux/man-pages/man2/shutdown.2.html
2264 | * @i18n 参阅:http://man7.org/linux/man-pages/man2/shutdown.2.html */
2265 | export enum ShutdownMode {
2266 | Read = 0,
2267 | Write,
2268 | ReadWrite, // TODO(ry) panics on ReadWrite.
2269 | }
2270 |
2271 | /** **UNSTABLE**: Both the `how` parameter and `ShutdownMode` enum are under
2272 | * consideration for removal.
2273 | * @i18n **不稳定**:参数 `how` 和枚举 `ShutdownMode` 都在考虑移除。
2274 | *
2275 | * Shutdown socket send and receive operations.
2276 | * @i18n Shutdown 套接字的发送和接收操作。
2277 | *
2278 | * Matches behavior of POSIX shutdown(3).
2279 | * @i18n 与 POSIX 的 shutdown(3) 行为一致。
2280 | *
2281 | * const listener = Deno.listen({ port: 80 });
2282 | * const conn = await listener.accept();
2283 | * Deno.shutdown(conn.rid, Deno.ShutdownMode.Write);
2284 | */
2285 | export function shutdown(rid: number, how: ShutdownMode): void;
2286 |
2287 | /** **UNSTABLE**: new API, yet to be vetted.
2288 | * @i18n **不稳定**:新的 API,尚待审查。
2289 | *
2290 | * A generic transport listener for message-oriented protocols.
2291 | * @i18n 面向消息协议的通用传输监听器。*/
2292 | export interface DatagramConn extends AsyncIterable<[Uint8Array, Addr]> {
2293 | /** **UNSTABLE**: new API, yet to be vetted.
2294 | * @i18n **不稳定**:新的 API,尚待审查。
2295 | *
2296 | * Waits for and resolves to the next message to the `UDPConn`.
2297 | * @i18n 等待并解析 (resolve) 为下一条消息传递给 `UDPConn`。*/
2298 | receive(p?: Uint8Array): Promise<[Uint8Array, Addr]>;
2299 | /** UNSTABLE: new API, yet to be vetted.
2300 | * @i18n **不稳定**:新的 API,尚待审查。
2301 | *
2302 | * Sends a message to the target.
2303 | * @i18n 向目标发送消息。*/
2304 | send(p: Uint8Array, addr: Addr): Promise;
2305 | /** UNSTABLE: new API, yet to be vetted.
2306 | * @i18n **不稳定**:新的 API,尚待审查。
2307 | *
2308 | * Close closes the socket. Any pending message promises will be rejected
2309 | * with errors.
2310 | * @i18n 关闭套接字。任何待处理的消息应答都将被拒绝 (rejected),并返回错误。*/
2311 | close(): void;
2312 | /** Return the address of the `UDPConn`. */
2313 | readonly addr: Addr;
2314 | [Symbol.asyncIterator](): AsyncIterableIterator<[Uint8Array, Addr]>;
2315 | }
2316 |
2317 | /** A generic network listener for stream-oriented protocols.
2318 | * @i18n 面向流协议的通用网络监听器。*/
2319 | export interface Listener extends AsyncIterable {
2320 | /** Waits for and resolves to the next connection to the `Listener`.
2321 | * @i18n 等待并解析 (resolve) 到与 `Listener` 的下一个连接。*/
2322 | accept(): Promise;
2323 | /** Close closes the listener. Any pending accept promises will be rejected
2324 | * with errors.
2325 | * @i18n 关闭监听器。任何待处理的接收应答都将被拒绝 (rejected),并返回错误。*/
2326 | close(): void;
2327 | /** Return the address of the `Listener`.
2328 | * @i18n 返回 `Listener` 的地址。*/
2329 | readonly addr: Addr;
2330 |
2331 | [Symbol.asyncIterator](): AsyncIterableIterator;
2332 | }
2333 |
2334 | export interface Conn extends Reader, Writer, Closer {
2335 | /** The local address of the connection.
2336 | * @i18n 连接的本地地址。*/
2337 | readonly localAddr: Addr;
2338 | /** The remote address of the connection.
2339 | * @i18n 连接的远程地址。*/
2340 | readonly remoteAddr: Addr;
2341 | /** The resource ID of the connection.
2342 | * @i18n 连接的资源 ID。*/
2343 | readonly rid: number;
2344 | /** Shuts down (`shutdown(2)`) the reading side of the TCP connection. Most
2345 | * callers should just use `close()`.
2346 | * @i18n 关闭 (`shutdown(2)`) TCP 连接的读取端。大多数调用者应该只使用 `close()`。*/
2347 | closeRead(): void;
2348 | /** Shuts down (`shutdown(2)`) the writing side of the TCP connection. Most
2349 | * callers should just use `close()`.
2350 | * @i18n 关闭 (`shutdown(2)`) TCP 连接的写入端。大多数调用者应该只使用 `close()`。*/
2351 | closeWrite(): void;
2352 | }
2353 |
2354 | export interface ListenOptions {
2355 | /** The port to listen on.
2356 | * @i18n 要监听的端口号。*/
2357 | port: number;
2358 | /** A literal IP address or host name that can be resolved to an IP address.
2359 | * If not specified, defaults to `0.0.0.0`.
2360 | * @i18n 一个 IP 地址或者可以被解析为 IP 地址的主机名。
2361 | * 如果没有指定,默认值为 `0.0.0.0`。*/
2362 | hostname?: string;
2363 | }
2364 |
2365 | export interface UnixListenOptions {
2366 | /** A Path to the Unix Socket.
2367 | * @i18n 一个 Unix 套接字路径。*/
2368 | address: string;
2369 | }
2370 | /** **UNSTABLE**: new API, yet to be vetted.
2371 | * @i18n **不稳定**: 新 API,没有经过审查。
2372 | *
2373 | * Listen announces on the local transport address.
2374 | * @i18n 在本地监听网络连接。
2375 | *
2376 | * const listener1 = Deno.listen({ port: 80 })
2377 | * const listener2 = Deno.listen({ hostname: "192.0.2.1", port: 80 })
2378 | * const listener3 = Deno.listen({ hostname: "[2001:db8::1]", port: 80 });
2379 | * const listener4 = Deno.listen({ hostname: "golang.org", port: 80, transport: "tcp" });
2380 | *
2381 | * Requires `allow-net` permission.
2382 | * @i18n 需要 `allow-net` 权限。*/
2383 | export function listen(
2384 | options: ListenOptions & { transport?: "tcp" }
2385 | ): Listener;
2386 | /** **UNSTABLE**: new API, yet to be vetted.
2387 | * @i18n **不稳定**: 新 API,没有经过审查。
2388 | *
2389 | * Listen announces on the local transport address.
2390 | * @i18n 在本地监听网络连接。
2391 | *
2392 | * const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unix" })
2393 | *
2394 | * Requires `allow-read` permission.
2395 | * @i18n 需要 `allow-read` 权限。*/
2396 | export function listen(
2397 | options: UnixListenOptions & { transport: "unix" }
2398 | ): Listener;
2399 | /** **UNSTABLE**: new API, yet to be vetted.
2400 | * @i18n **不稳定**: 新 API,没有经过审查。
2401 | *
2402 | * Listen announces on the local transport address.
2403 | * @i18n 在本地监听网络连接。
2404 | *
2405 | * const listener1 = Deno.listen({ port: 80, transport: "udp" })
2406 | * const listener2 = Deno.listen({ hostname: "golang.org", port: 80, transport: "udp" });
2407 | *
2408 | * Requires `allow-net` permission.
2409 | * @i18n 需要 `allow-net` 权限。*/
2410 | export function listen(
2411 | options: ListenOptions & { transport: "udp" }
2412 | ): DatagramConn;
2413 | /** **UNSTABLE**: new API, yet to be vetted.
2414 | * @i18n **不稳定**: 新 API,没有经过审查。
2415 | *
2416 | * Listen announces on the local transport address.
2417 | * @i18n 在本地监听网络连接。
2418 | *
2419 | * const listener = Deno.listen({ address: "/foo/bar.sock", transport: "unixpacket" })
2420 | *
2421 | * Requires `allow-read` permission.
2422 | * @i18n 需要 `allow-read` 权限。*/
2423 | export function listen(
2424 | options: UnixListenOptions & { transport: "unixpacket" }
2425 | ): DatagramConn;
2426 |
2427 | export interface ListenTLSOptions extends ListenOptions {
2428 | /** Server certificate file.
2429 | * @i18n 服务器证书文件。*/
2430 | certFile: string;
2431 | /** Server public key file.
2432 | * @i18n 服务器公钥文件。*/
2433 | keyFile: string;
2434 |
2435 | transport?: "tcp";
2436 | }
2437 |
2438 | /** Listen announces on the local transport address over TLS (transport layer
2439 | * security).
2440 | * @i18n 在本地监听来自 TLS (传输层安全性协议)的网络连接。
2441 | *
2442 | * const lstnr = Deno.listenTLS({ port: 443, certFile: "./server.crt", keyFile: "./server.key" });
2443 | *
2444 | * Requires `allow-net` permission.
2445 | * @i18n 需要 `allow-net` 权限。*/
2446 | export function listenTLS(options: ListenTLSOptions): Listener;
2447 |
2448 | export interface ConnectOptions {
2449 | /** The port to connect to.
2450 | * @i18n 要连接的端口号。*/
2451 | port: number;
2452 | /** A literal IP address or host name that can be resolved to an IP address.
2453 | * If not specified, defaults to `127.0.0.1`.
2454 | * @i18n 一个 IP 地址或者可以被解析为 IP 地址的主机名。
2455 | * 如果没有指定,默认值为 `127.0.0.1`。*/
2456 | hostname?: string;
2457 | transport?: "tcp";
2458 | }
2459 |
2460 | export interface UnixConnectOptions {
2461 | transport: "unix";
2462 | address: string;
2463 | }
2464 |
2465 | /**
2466 | * Connects to the hostname (default is "127.0.0.1") and port on the named
2467 | * transport (default is "tcp"), and resolves to the connection (`Conn`).
2468 | * @i18n 通过指定传输协议(默认 "tcp")连接主机名(默认 "127.0.0.1")和端口号,并异步返回这个连接(`Conn`)。
2469 | *
2470 | * const conn1 = await Deno.connect({ port: 80 });
2471 | * const conn2 = await Deno.connect({ hostname: "192.0.2.1", port: 80 });
2472 | * const conn3 = await Deno.connect({ hostname: "[2001:db8::1]", port: 80 });
2473 | * const conn4 = await Deno.connect({ hostname: "golang.org", port: 80, transport: "tcp" });
2474 | * const conn5 = await Deno.connect({ address: "/foo/bar.sock", transport: "unix" });
2475 | *
2476 | * Requires `allow-net` permission for "tcp" and `allow-read` for unix.
2477 | * @i18n "tcp" 需要 `allow-net` 权限,unix 需要 `allow-read` 权限。*/
2478 | export function connect(
2479 | options: ConnectOptions | UnixConnectOptions
2480 | ): Promise;
2481 |
2482 | export interface ConnectTLSOptions {
2483 | /** The port to connect to.
2484 | * @i18n 要连接的端口。*/
2485 | port: number;
2486 | /** A literal IP address or host name that can be resolved to an IP address.
2487 | * If not specified, defaults to `127.0.0.1`.
2488 | * @i18n 可以解析为 IP 地址的文本 IP 地址或主机名。如果没有指定,默认值为 `127.0.0.1`。*/
2489 | hostname?: string;
2490 | /** Server certificate file.
2491 | * @i18n 服务器证书文件。*/
2492 | certFile?: string;
2493 | }
2494 |
2495 | /** Establishes a secure connection over TLS (transport layer security) using
2496 | * an optional cert file, hostname (default is "127.0.0.1") and port. The
2497 | * cert file is optional and if not included Mozilla's root certificates will
2498 | * be used (see also https://github.com/ctz/webpki-roots for specifics)
2499 | * @i18n 使用可选的证书文件、主机名(默认值为 "127.0.0.1")
2500 | * 和端口在 TLS(安全传输层协议)建立安全连接。
2501 | * 证书文件是可选的,如果不包含,则使用 Mozilla 的根证书
2502 | *(具体参见 https://github.com/ctz/webpki-roots)。
2503 | *
2504 | * const conn1 = await Deno.connectTLS({ port: 80 });
2505 | * const conn2 = await Deno.connectTLS({ certFile: "./certs/my_custom_root_CA.pem", hostname: "192.0.2.1", port: 80 });
2506 | * const conn3 = await Deno.connectTLS({ hostname: "[2001:db8::1]", port: 80 });
2507 | * const conn4 = await Deno.connectTLS({ certFile: "./certs/my_custom_root_CA.pem", hostname: "golang.org", port: 80});
2508 | *
2509 | * Requires `allow-net` permission.
2510 | * @i18n 需要 `allow-net` 权限。
2511 | */
2512 | export function connectTLS(options: ConnectTLSOptions): Promise;
2513 |
2514 | /** **UNSTABLE**: not sure if broken or not */
2515 | export interface Metrics {
2516 | opsDispatched: number;
2517 | opsDispatchedSync: number;
2518 | opsDispatchedAsync: number;
2519 | opsDispatchedAsyncUnref: number;
2520 | opsCompleted: number;
2521 | opsCompletedSync: number;
2522 | opsCompletedAsync: number;
2523 | opsCompletedAsyncUnref: number;
2524 | bytesSentControl: number;
2525 | bytesSentData: number;
2526 | bytesReceived: number;
2527 | }
2528 |
2529 | /** Receive metrics from the privileged side of Deno. This is primarily used
2530 | * in the development of Deno. 'Ops', also called 'bindings', are the go-between
2531 | * between Deno Javascript and Deno Rust.
2532 | * @i18n 从 Deno 的特权方接收指标。这主要用于 Deno 的开发中。
2533 | * 'Ops'(也称为 'bindings')是 Deno Javascript 和 Deno Rust 之间的沟通桥梁。
2534 | *
2535 | * > console.table(Deno.metrics())
2536 | * ┌─────────────────────────┬────────┐
2537 | * │ (index) │ Values │
2538 | * ├─────────────────────────┼────────┤
2539 | * │ opsDispatched │ 3 │
2540 | * │ opsDispatchedSync │ 2 │
2541 | * │ opsDispatchedAsync │ 1 │
2542 | * │ opsDispatchedAsyncUnref │ 0 │
2543 | * │ opsCompleted │ 3 │
2544 | * │ opsCompletedSync │ 2 │
2545 | * │ opsCompletedAsync │ 1 │
2546 | * │ opsCompletedAsyncUnref │ 0 │
2547 | * │ bytesSentControl │ 73 │
2548 | * │ bytesSentData │ 0 │
2549 | * │ bytesReceived │ 375 │
2550 | * └─────────────────────────┴────────┘
2551 | */
2552 | export function metrics(): Metrics;
2553 |
2554 | /** **UNSTABLE**: reconsider representation.
2555 | * @i18n **不稳定**: 重新考虑表示方法。*/
2556 | interface ResourceMap {
2557 | [rid: number]: string;
2558 | }
2559 |
2560 | /** **UNSTABLE**: The return type is under consideration and may change.
2561 | * @i18n **不稳定**: 返回类型正在考虑中,并且可能会更改。
2562 | *
2563 | * Returns a map of open _file like_ resource ids (rid) along with their string
2564 | * representations.
2565 | * @i18n 返回打开的_文件_资源 ID(rid)及其字符串表示形式的 Map。
2566 | *
2567 | * console.log(Deno.resources()); //e.g. { 0: "stdin", 1: "stdout", 2: "stderr" }
2568 | * Deno.openSync('../test.file');
2569 | * console.log(Deno.resources()); //e.g. { 0: "stdin", 1: "stdout", 2: "stderr", 3: "fsFile" }
2570 | */
2571 | export function resources(): ResourceMap;
2572 |
2573 | /** **UNSTABLE**: new API. Needs docs.
2574 | * @i18n **不稳定**: 新 API。需要补充文档。*/
2575 | export interface FsEvent {
2576 | kind: "any" | "access" | "create" | "modify" | "remove";
2577 | paths: string[];
2578 | }
2579 |
2580 | /** **UNSTABLE**: new API, yet to be vetted.
2581 | * @i18n **不稳定**: 新 API,没有经过审查。
2582 | *
2583 | * Watch for file system events against one or more `paths`, which can be files
2584 | * or directories. These paths must exist already. One user action (e.g.
2585 | * `touch test.file`) can generate multiple file system events. Likewise,
2586 | * one user action can result in multiple file paths in one event (e.g. `mv
2587 | * old_name.txt new_name.txt`). Recursive option is `true` by default and,
2588 | * for directories, will watch the specified directory and all sub directories.
2589 | * Note that the exact ordering of the events can vary between operating systems.
2590 | * @i18n 监听一个或多个路径的文件系统事件,这个路径可以是文件或者目录,但是必须存在。
2591 | * 一个用户操作(例如 `touch test.file`)可以产生多个文件系统事件。同样,一个
2592 | * 用户操作也可能在一次事件中影响多个路径(例如 `mv old_name.txt new_name.txt`)。
2593 | * 递归选项默认为 `true`,对于目录,将监听指定目录及其所有子目录。
2594 | * 值得注意的是,不同操作系统的事件顺序可能会有所不同。
2595 | *
2596 | * const iter = Deno.fsEvents("/");
2597 | * for await (const event of iter) {
2598 | * console.log(">>>> event", event); //e.g. { kind: "create", paths: [ "/foo.txt" ] }
2599 | * }
2600 | *
2601 | * Requires `allow-read` permission.
2602 | * @i18n 需要 `allow-read` 权限。
2603 | */
2604 | export function fsEvents(
2605 | paths: string | string[],
2606 | options?: { recursive: boolean }
2607 | ): AsyncIterableIterator;
2608 |
2609 | /** How to handle subprocess stdio.
2610 | * @i18n 如何处理子进程的 stdio。
2611 | *
2612 | * `"inherit"` The default if unspecified. The child inherits from the
2613 | * corresponding parent descriptor.
2614 | * @i18n `"inherit"` 如果未指定,则为默认值。子进程继承父进程的 stdio。
2615 | *
2616 | * `"piped"` A new pipe should be arranged to connect the parent and child
2617 | * sub-processes.
2618 | * @i18n `"piped"` 使用一个新管道来连接父子进程。
2619 | *
2620 | * `"null"` This stream will be ignored. This is the equivalent of attaching
2621 | * the stream to `/dev/null`.
2622 | * @i18n `"null"` 输入输出流将被忽略。这相当于将流附加到了 `/dev/null`。*/
2623 | type ProcessStdio = "inherit" | "piped" | "null";
2624 |
2625 | /** **UNSTABLE**: The `signo` argument may change to require the Deno.Signal
2626 | * enum.
2627 | * @i18n **UNSTABLE**: `signo` 参数可能需要改成 Deno.Signal 枚举。
2628 | *
2629 | * Send a signal to process under given `pid`. This functionality currently
2630 | * only works on Linux and Mac OS.
2631 | * @i18n 给指定的 `pid` 进程发送信号。这个功能目前只在 Linux 和 Mac OS 上运行。
2632 | *
2633 | * If `pid` is negative, the signal will be sent to the process group
2634 | * identified by `pid`.
2635 | * @i18n 当 `pid` 是负的,信号将会发送到带有 `pid` 标识的进程组。
2636 | *
2637 | * const p = Deno.run({
2638 | * cmd: ["python", "-c", "from time import sleep; sleep(10000)"]
2639 | * });
2640 | *
2641 | * Deno.kill(p.pid, Deno.Signal.SIGINT);
2642 | *
2643 | * Throws Error (not yet implemented) on Windows
2644 | * @i18n 在 Windows 上抛出错误(尚未实现)。
2645 | *
2646 | * Requires `allow-run` permission.
2647 | * @i18n 需要 `allow-run` 权限。*/
2648 | export function kill(pid: number, signo: number): void;
2649 |
2650 | /** **UNSTABLE**: There are some issues to work out with respect to when and
2651 | * how the process should be closed.
2652 | * @i18n **UNSTABLE**: 这里有一些关于如何结束进程的问题需要解决。*/
2653 | export class Process {
2654 | readonly rid: number;
2655 | readonly pid: number;
2656 | readonly stdin?: WriteCloser;
2657 | readonly stdout?: ReadCloser;
2658 | readonly stderr?: ReadCloser;
2659 | /** Resolves to the current status of the process.
2660 | * @i18n 解析进程当前的状态。*/
2661 | status(): Promise;
2662 | /** Buffer the stdout and return it as `Uint8Array` after `Deno.EOF`.
2663 | * @i18n 缓冲区中的 stdout,会在 `Deno.EOF` 之后以 `Uint8Array` 的形式返回。
2664 | *
2665 | * You must set stdout to `"piped"` when creating the process.
2666 | * @i18n 在创建进程时,你必须将 stdout 设置为 `"piped"`。
2667 | *
2668 | * This calls `close()` on stdout after its done.
2669 | * @i18n 会在 stdout 完成后调用 `close()`。*/
2670 | output(): Promise;
2671 | /** Buffer the stderr and return it as `Uint8Array` after `Deno.EOF`.
2672 | * @i18n 缓冲区中的 stderr, 会在 `Deno.EOF` 之后以 `Uint8Array` 的形式返回。
2673 | *
2674 | * You must set stderr to `"piped"` when creating the process.
2675 | * @i18n 在创建进程时,你必须将 stderr 设置为 `"piped"`。
2676 | *
2677 | * This calls `close()` on stderr after its done.
2678 | * @i18n 会在 stderr 完成后调用 `close()`。*/
2679 | stderrOutput(): Promise;
2680 | close(): void;
2681 | kill(signo: number): void;
2682 | }
2683 |
2684 | export type ProcessStatus =
2685 | | {
2686 | success: true;
2687 | code: 0;
2688 | signal?: undefined;
2689 | }
2690 | | {
2691 | success: false;
2692 | code: number;
2693 | signal?: number;
2694 | };
2695 |
2696 | /** **UNSTABLE**: `args` has been recently renamed to `cmd` to differentiate from
2697 | * `Deno.args`.
2698 | * @i18n **不稳定**: `args` 最近被重命名为 `cmd`,以区别于 `Deno.args`。*/
2699 | export interface RunOptions {
2700 | /** Arguments to pass. Note, the first element needs to be a path to the
2701 | * binary
2702 | * @i18n 需要传递的参数。注意,第一个元素必须是二进制文件的路径。*/
2703 | cmd: string[];
2704 | cwd?: string;
2705 | env?: {
2706 | [key: string]: string;
2707 | };
2708 | stdout?: ProcessStdio | number;
2709 | stderr?: ProcessStdio | number;
2710 | stdin?: ProcessStdio | number;
2711 | }
2712 |
2713 | /** Spawns new subprocess. RunOptions must contain at a minimum the `opt.cmd`,
2714 | * an array of program arguments, the first of which is the binary.
2715 | * @i18n 派生新的子进程。 RunOptions 必须包含 `opt.cmd`,即程序参数数组,其中第一个参数是二进制文件路径。
2716 | *
2717 | * Subprocess uses same working directory as parent process unless `opt.cwd`
2718 | * is specified.
2719 | * @i18n 子进程使用与父进程相同的工作目录,除非指定了 `opt.cwd`。
2720 | *
2721 | * Environmental variables for subprocess can be specified using `opt.env`
2722 | * mapping.
2723 | * @i18n 子进程的环境变量可以使用 `opt.env` 来设置。
2724 | *
2725 | * By default subprocess inherits stdio of parent process. To change that
2726 | * `opt.stdout`, `opt.stderr` and `opt.stdin` can be specified independently -
2727 | * they can be set to either `ProcessStdio` or `rid` of open file.
2728 | * @i18n 默认情况下,子进程继承父进程的 stdio。要更改这些值,可以分别指定`opt.stdout`、`opt.stderr`、`opt.stdin`
2729 | * - 可以将其设置为 `ProcessStdio` 或打开文件的 `rid`。
2730 | *
2731 | * Details of the spawned process are returned.
2732 | * @i18n 返回派生子进程的详细信息。
2733 | *
2734 | * const p = Deno.run({
2735 | * cmd: ["echo", "hello"],
2736 | * });
2737 | *
2738 | * Requires `allow-run` permission.
2739 | * @i18n 需要 `allow-run` 权限。*/
2740 | export function run(opt: RunOptions): Process;
2741 |
2742 | enum LinuxSignal {
2743 | SIGHUP = 1,
2744 | SIGINT = 2,
2745 | SIGQUIT = 3,
2746 | SIGILL = 4,
2747 | SIGTRAP = 5,
2748 | SIGABRT = 6,
2749 | SIGBUS = 7,
2750 | SIGFPE = 8,
2751 | SIGKILL = 9,
2752 | SIGUSR1 = 10,
2753 | SIGSEGV = 11,
2754 | SIGUSR2 = 12,
2755 | SIGPIPE = 13,
2756 | SIGALRM = 14,
2757 | SIGTERM = 15,
2758 | SIGSTKFLT = 16,
2759 | SIGCHLD = 17,
2760 | SIGCONT = 18,
2761 | SIGSTOP = 19,
2762 | SIGTSTP = 20,
2763 | SIGTTIN = 21,
2764 | SIGTTOU = 22,
2765 | SIGURG = 23,
2766 | SIGXCPU = 24,
2767 | SIGXFSZ = 25,
2768 | SIGVTALRM = 26,
2769 | SIGPROF = 27,
2770 | SIGWINCH = 28,
2771 | SIGIO = 29,
2772 | SIGPWR = 30,
2773 | SIGSYS = 31,
2774 | }
2775 | enum MacOSSignal {
2776 | SIGHUP = 1,
2777 | SIGINT = 2,
2778 | SIGQUIT = 3,
2779 | SIGILL = 4,
2780 | SIGTRAP = 5,
2781 | SIGABRT = 6,
2782 | SIGEMT = 7,
2783 | SIGFPE = 8,
2784 | SIGKILL = 9,
2785 | SIGBUS = 10,
2786 | SIGSEGV = 11,
2787 | SIGSYS = 12,
2788 | SIGPIPE = 13,
2789 | SIGALRM = 14,
2790 | SIGTERM = 15,
2791 | SIGURG = 16,
2792 | SIGSTOP = 17,
2793 | SIGTSTP = 18,
2794 | SIGCONT = 19,
2795 | SIGCHLD = 20,
2796 | SIGTTIN = 21,
2797 | SIGTTOU = 22,
2798 | SIGIO = 23,
2799 | SIGXCPU = 24,
2800 | SIGXFSZ = 25,
2801 | SIGVTALRM = 26,
2802 | SIGPROF = 27,
2803 | SIGWINCH = 28,
2804 | SIGINFO = 29,
2805 | SIGUSR1 = 30,
2806 | SIGUSR2 = 31,
2807 | }
2808 |
2809 | /** **UNSTABLE**: make platform independent.
2810 | * @i18n **不稳定**: make platform independent.
2811 | *
2812 | * Signals numbers. This is platform dependent.
2813 | * @i18n 信号数字。此值是独立于平台的。*/
2814 | export const Signal: typeof MacOSSignal | typeof LinuxSignal;
2815 |
2816 | interface InspectOptions {
2817 | showHidden?: boolean;
2818 | depth?: number;
2819 | colors?: boolean;
2820 | indentLevel?: number;
2821 | }
2822 |
2823 | /** **UNSTABLE**: The exact form of the string output is under consideration
2824 | * and may change.
2825 | * @i18n **不稳定**:字符串输出的确切形式仍在考虑,可能会更改。
2826 | *
2827 | * Converts the input into a string that has the same format as printed by
2828 | * `console.log()`.
2829 | * @i18n 将输入转换为与 `console.log()` 打印格式相同的字符串。
2830 | *
2831 | * const obj = {};
2832 | * obj.propA = 10;
2833 | * obj.propB = "hello"
2834 | * const objAsString = Deno.inspect(obj); //{ propA: 10, propB: "hello" }
2835 | * console.log(obj); // 输出与 objAsString 相同的值,例如: { propA: 10, propB: "hello" }
2836 | *
2837 | * You can also register custom inspect functions, via the `customInspect` Deno
2838 | * symbol on objects, to control and customize the output.
2839 | * @i18n 你还可以通过对象上的 `Deno.symbols.customInspect` 函数
2840 | * 注册自定义的 inspect function,以控制和自定义输出。
2841 | *
2842 | * class A {
2843 | * x = 10;
2844 | * y = "hello";
2845 | * [Deno.symbols.customInspect](): string {
2846 | * return "x=" + this.x + ", y=" + this.y;
2847 | * }
2848 | * }
2849 | *
2850 | * const inStringFormat = Deno.inspect(new A()); //"x=10, y=hello"
2851 | * console.log(inStringFormat); // 输出 "x=10, y=hello"
2852 | *
2853 | * Finally, a number of output options are also available.
2854 | * @i18n 同时还提供了一些输出选项。
2855 | *
2856 | * const out = Deno.inspect(obj, {showHidden: true, depth: 4, colors: true, indentLevel: 2});
2857 | *
2858 | */
2859 | export function inspect(value: unknown, options?: InspectOptions): string;
2860 |
2861 | export type OperatingSystem = "mac" | "win" | "linux";
2862 |
2863 | export type Arch = "x64" | "arm64";
2864 |
2865 | interface BuildInfo {
2866 | /** The CPU architecture.
2867 | * @i18n CPU 架构。*/
2868 | arch: Arch;
2869 | /** The operating system.
2870 | * @i18n 操作系统。*/
2871 | os: OperatingSystem;
2872 | }
2873 |
2874 | /** Build related information.
2875 | * @i18n 构建的相关信息。*/
2876 | export const build: BuildInfo;
2877 |
2878 | interface Version {
2879 | deno: string;
2880 | v8: string;
2881 | typescript: string;
2882 | }
2883 | /** Version related information.
2884 | * @i18n Deno 的详细版本信息。包括了 deno、v8、typescript。*/
2885 | export const version: Version;
2886 |
2887 | /** The log category for a diagnostic message.
2888 | * @i18n 诊断消息的日志类别。*/
2889 | export enum DiagnosticCategory {
2890 | Log = 0,
2891 | Debug = 1,
2892 | Info = 2,
2893 | Error = 3,
2894 | Warning = 4,
2895 | Suggestion = 5,
2896 | }
2897 |
2898 | export interface DiagnosticMessageChain {
2899 | message: string;
2900 | category: DiagnosticCategory;
2901 | code: number;
2902 | next?: DiagnosticMessageChain[];
2903 | }
2904 |
2905 | export interface DiagnosticItem {
2906 | /** A string message summarizing the diagnostic.
2907 | * @i18n 诊断信息。*/
2908 | message: string;
2909 | /** An ordered array of further diagnostics.
2910 | * @i18n 进一步诊断的有序数组。*/
2911 | messageChain?: DiagnosticMessageChain;
2912 | /** Information related to the diagnostic. This is present when there is a
2913 | * suggestion or other additional diagnostic information
2914 | * @i18n 与诊断相关的信息。当有建议或其他附加诊断信息时会出现。*/
2915 | relatedInformation?: DiagnosticItem[];
2916 | /** The text of the source line related to the diagnostic.
2917 | * @i18n 与诊断相关的所在行的源代码。*/
2918 | sourceLine?: string;
2919 | /** The line number that is related to the diagnostic.
2920 | * @i18n 与诊断相关的行号。*/
2921 | lineNumber?: number;
2922 | /** The name of the script resource related to the diagnostic.
2923 | * @i18n 与诊断相关的文件名称。*/
2924 | scriptResourceName?: string;
2925 | /** The start position related to the diagnostic.
2926 | * @i18n 与诊断相关的位于整个文件的开始位置。*/
2927 | startPosition?: number;
2928 | /** The end position related to the diagnostic.
2929 | * @i18n 与诊断相关的位于整个文件的结束位置。*/
2930 | endPosition?: number;
2931 | /** The category of the diagnostic.
2932 | * @i18n 诊断消息的日志类别。*/
2933 | category: DiagnosticCategory;
2934 | /** A number identifier.
2935 | * @i18n 数字标识符。*/
2936 | code: number;
2937 | /** The the start column of the sourceLine related to the diagnostic.
2938 | * @i18n 与诊断相关的所在行的开始列。*/
2939 | startColumn?: number;
2940 | /** The end column of the sourceLine related to the diagnostic.
2941 | * @i18n 与诊断相关的所在行的结束列。*/
2942 | endColumn?: number;
2943 | }
2944 |
2945 | export interface Diagnostic {
2946 | /** An array of diagnostic items.
2947 | * @i18n 诊断信息数组。*/
2948 | items: DiagnosticItem[];
2949 | }
2950 |
2951 | /** **UNSTABLE**: new API, yet to be vetted.
2952 | * @i18n **不稳定**: 新 API,没有经过审查。
2953 | *
2954 | * Format an array of diagnostic items and return them as a single string in a
2955 | * user friendly format.
2956 | * @i18n 格式化诊断信息数组,并以用户友好的格式将其作为单个字符串返回。
2957 | *
2958 | * const [diagnostics, result] = Deno.compile("file_with_compile_issues.ts");
2959 | * console.table(diagnostics); // 输出原始诊断信息
2960 | * console.log(Deno.formatDiagnostics(diagnostics)); // 用户友好方式的输出诊断信息
2961 | *
2962 | * @param items An array of diagnostic items to format
2963 | * @param_i18n items 要格式化的诊断信息数组
2964 | */
2965 | export function formatDiagnostics(items: DiagnosticItem[]): string;
2966 |
2967 | /** **UNSTABLE**: new API, yet to be vetted.
2968 | * @i18n **不稳定**: 新 API,没有经过审查。
2969 | *
2970 | * A specific subset TypeScript compiler options that can be supported by the
2971 | * Deno TypeScript compiler.
2972 | * @i18n TypeScript 编译选项的特定子集,这些选项能够被 Deno 内置的 TypeScript 编译器支持。*/
2973 | export interface CompilerOptions {
2974 | /** Allow JavaScript files to be compiled. Defaults to `true`.
2975 | * @i18n 允许编译 JavaScript 文件。默认为 `true`。*/
2976 | allowJs?: boolean;
2977 | /** Allow default imports from modules with no default export. This does not
2978 | * affect code emit, just typechecking. Defaults to `false`.
2979 | * @i18n 允许从没有设置默认导出的模块中默认导入。这并不影响代码的输出,仅为了类型检查。默认为 `false`。*/
2980 | allowSyntheticDefaultImports?: boolean;
2981 | /** Allow accessing UMD globals from modules. Defaults to `false`.
2982 | * @i18n 允许从模块中访问 UMD 全局变量。默认为 `false`。*/
2983 | allowUmdGlobalAccess?: boolean;
2984 | /** Do not report errors on unreachable code. Defaults to `false`.
2985 | * @i18n 不报告执行不到的代码错误。默认为 `false`。*/
2986 | allowUnreachableCode?: boolean;
2987 | /** Do not report errors on unused labels. Defaults to `false`
2988 | * @i18n 不报告未使用的标签错误。默认为 `false`。*/
2989 | allowUnusedLabels?: boolean;
2990 | /** Parse in strict mode and emit `"use strict"` for each source file.
2991 | * Defaults to `true`.
2992 | * @i18n 以严格模式解析源文件并为每个源文件生成 `"use strict"` 语句。
2993 | * 默认为 `true`。*/
2994 | alwaysStrict?: boolean;
2995 | /** Base directory to resolve non-relative module names. Defaults to
2996 | * `undefined`.
2997 | * @i18n 解析非相对模块名的基准目录。默认为 `undefined`。*/
2998 | baseUrl?: string;
2999 | /** Report errors in `.js` files. Use in conjunction with `allowJs`. Defaults
3000 | * to `false`.
3001 | * @i18n 报告 `.js` 文件中存在的错误。与 `allowJs` 配合使用。默认为 `false`。*/
3002 | checkJs?: boolean;
3003 | /** Generates corresponding `.d.ts` file. Defaults to `false`.
3004 | * @i18n 生成相应的 `.d.ts` 文件。默认为 `false`。*/
3005 | declaration?: boolean;
3006 | /** Output directory for generated declaration files.
3007 | * @i18n 生成声明文件的输出路径。*/
3008 | declarationDir?: string;
3009 | /** Generates a source map for each corresponding `.d.ts` file. Defaults to
3010 | * `false`.
3011 | * @i18n 为每个 `.d.ts` 文件生成 ource map。默认为 `false`。*/
3012 | declarationMap?: boolean;
3013 | /** Provide full support for iterables in `for..of`, spread and
3014 | * destructuring when targeting ES5 or ES3. Defaults to `false`.
3015 | * @i18n 当编译目标设置为 ES5 或 ES3 时,为 `for..of`、数组解构、数组展开提供完整的迭代支持。默认为 `false`。*/
3016 | downlevelIteration?: boolean;
3017 | /** Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
3018 | * Defaults to `false`.
3019 | * @i18n 在输出文件的开头加入 BOM 头(UTF-8 Byte Order Mark)。默认为 `false`。*/
3020 | emitBOM?: boolean;
3021 | /** Only emit `.d.ts` declaration files. Defaults to `false`.
3022 | * @i18n 只输出 `.d.ts` 文件。默认为 `false`。*/
3023 | emitDeclarationOnly?: boolean;
3024 | /** Emit design-type metadata for decorated declarations in source. See issue
3025 | * [microsoft/TypeScript#2577](https://github.com/Microsoft/TypeScript/issues/2577)
3026 | * for details. Defaults to `false`.
3027 | * @i18n 给源码里的装饰器声明加上设计类型元数据。查看
3028 | * [microsoft/TypeScript#2577](https://github.com/Microsoft/TypeScript/issues/2577)
3029 | * 了解更多信息。默认为 `false`。*/
3030 | emitDecoratorMetadata?: boolean;
3031 | /** Emit `__importStar` and `__importDefault` helpers for runtime babel
3032 | * ecosystem compatibility and enable `allowSyntheticDefaultImports` for type
3033 | * system compatibility. Defaults to `true`.
3034 | * @i18n 为了兼容 babel 运行时生态,输出 `__importStar` 和 `__importDefault` 辅助函数并且开启 `allowSyntheticDefaultImports` 选项。默认为 `true`。*/
3035 | esModuleInterop?: boolean;
3036 | /** Enables experimental support for ES decorators. Defaults to `false`.
3037 | * @i18n 启用实验性的 ES 装饰器。默认为 `false`*/
3038 | experimentalDecorators?: boolean;
3039 | /** Emit a single file with source maps instead of having a separate file.
3040 | * Defaults to `false`.
3041 | * @i18n 生成单个 source maps 文件,而不是将每 source maps 生成不同的文件。
3042 | * 默认为 `false`。*/
3043 | inlineSourceMap?: boolean;
3044 | /** Emit the source alongside the source maps within a single file; requires
3045 | * `inlineSourceMap` or `sourceMap` to be set. Defaults to `false`.
3046 | * @i18n 将代码与 source maps 生成到一个文件中,要求同时设置了 `inlineSourceMap` or `sourceMap` 选项。默认为 `false`。*/
3047 | inlineSources?: boolean;
3048 | /** Perform additional checks to ensure that transpile only would be safe.
3049 | * Defaults to `false`.
3050 | * @i18n 执行额外的检查,确保我的程序代码可以被不进行任何类型检查的编译器正确地编译。
3051 | * 默认为 `false`。*/
3052 | isolatedModules?: boolean;
3053 | /** Support JSX in `.tsx` files: `"react"`, `"preserve"`, `"react-native"`.
3054 | * Defaults to `"react"`.
3055 | * @i18n 为 `.tsx` 文件提供 JSX 支持:`"react"`, `"preserve"`, `"react-native"`。
3056 | * 默认为 `"react"`。*/
3057 | jsx?: "react" | "preserve" | "react-native";
3058 | /** Specify the JSX factory function to use when targeting react JSX emit,
3059 | * e.g. `React.createElement` or `h`. Defaults to `React.createElement`.
3060 | * @i18n 指定生成目标为 JSX 时,使用的 JSX 工厂函数,比如 `React.createElement` 或 `h`。默认为 `React.createElement`。*/
3061 | jsxFactory?: string;
3062 | /** Resolve keyof to string valued property names only (no numbers or
3063 | * symbols). Defaults to `false`.
3064 | * @i18n 只解析字符串属性的 keyof (忽略 numbers 和 symbols)。默认为 `false`。*/
3065 | keyofStringsOnly?: string;
3066 | /** Emit class fields with ECMAScript-standard semantics. Defaults to `false`.
3067 | * Does not apply to `"esnext"` target.
3068 | * @i18n 使用 ECMAScript 标准语义声明类字段。 默认为 `false`。
3069 | * 不适用于生成目标为 `"esnext"`。*/
3070 | useDefineForClassFields?: boolean;
3071 | /** List of library files to be included in the compilation. If omitted,
3072 | * then the Deno main runtime libs are used.
3073 | * @i18n 编译过程中需要引入的库文件的列表。当输出时,Deno 的核心运行库也会使用。*/
3074 | lib?: string[];
3075 | /** The locale to use to show error messages.
3076 | * @i18n 显示错误信息时使用的语言。
3077 | */
3078 | locale?: string;
3079 | /** Specifies the location where debugger should locate map files instead of
3080 | * generated locations. Use this flag if the `.map` files will be located at
3081 | * run-time in a different location than the `.js` files. The location
3082 | * specified will be embedded in the source map to direct the debugger where
3083 | * the map files will be located. Defaults to `undefined`.
3084 | * @i18n 为调试器指定指定 source map 文件的路径,而不是使用生成时的路径。
3085 | * 当 `.map` 文件是在运行时指定的,并不同于 `.js` 文件的地址时使用这个标记。
3086 | * 指定的路径会嵌入到 source map 里告诉调试器到哪里去找它们。默认为 `undefined`。*/
3087 | mapRoot?: string;
3088 | /** Specify the module format for the emitted code. Defaults to
3089 | * `"esnext"`.
3090 | * @i18n 指定生成哪个模块系统代码。默认为 `"esnext"`。*/
3091 | module?:
3092 | | "none"
3093 | | "commonjs"
3094 | | "amd"
3095 | | "system"
3096 | | "umd"
3097 | | "es6"
3098 | | "es2015"
3099 | | "esnext";
3100 | /** Do not generate custom helper functions like `__extends` in compiled
3101 | * output. Defaults to `false`.
3102 | * @i18n 不在输出文件中生成用户自定义的帮助函数代码,如 `__extends`。默认为 `false`。*/
3103 | noEmitHelpers?: boolean;
3104 | /** Report errors for fallthrough cases in switch statement. Defaults to
3105 | * `false`.
3106 | * @i18n 报告 `switch` 语句的 fallthrough 错误。默认为 `false`。*/
3107 | noFallthroughCasesInSwitch?: boolean;
3108 | /** Raise error on expressions and declarations with an implied any type.
3109 | * Defaults to `true`.
3110 | * @i18n 在表达式和声明上有隐含的 `any` 类型时报错。
3111 | * 默认为 `true`*/
3112 | noImplicitAny?: boolean;
3113 | /** Report an error when not all code paths in function return a value.
3114 | * Defaults to `false`.
3115 | * @i18n 当函数的所有返回路径存在没有 `return` 的情况时报错。
3116 | * 默认为 `false`。*/
3117 | noImplicitReturns?: boolean;
3118 | /** Raise error on `this` expressions with an implied `any` type. Defaults to
3119 | * `true`.
3120 | * @i18n 当 `this` 表达式的值为 `any` 类型的时候报错。默认为 `true`。*/
3121 | noImplicitThis?: boolean;
3122 | /** Do not emit `"use strict"` directives in module output. Defaults to
3123 | * `false`.
3124 | * @i18n 不要在模块输出中包含 `"use strict"` 指令。默认为 `false`。*/
3125 | noImplicitUseStrict?: boolean;
3126 | /** Do not add triple-slash references or module import targets to the list of
3127 | * compiled files. Defaults to `false`.
3128 | * @i18n 不把 `/// ` 或模块导入的文件加到编译文件列表。默认为 `false`。*/
3129 | noResolve?: boolean;
3130 | /** Disable strict checking of generic signatures in function types. Defaults
3131 | * to `false`.
3132 | * @i18n 禁用在函数类型里对泛型签名进行严格检查。默认为 `false`。*/
3133 | noStrictGenericChecks?: boolean;
3134 | /** Report errors on unused locals. Defaults to `false`.
3135 | * @i18n 当存在未使用的局部变量时报错。默认为 `false`。*/
3136 | noUnusedLocals?: boolean;
3137 | /** Report errors on unused parameters. Defaults to `false`.
3138 | * @i18n 当存在未使用的参数时报错。默认为 `false`。*/
3139 | noUnusedParameters?: boolean;
3140 | /** Redirect output structure to the directory. This only impacts
3141 | * `Deno.compile` and only changes the emitted file names. Defaults to
3142 | * `undefined`.
3143 | * @i18n 重定向输出目录。这个只影响 `Deno.compile` 并且只改变输出文件的名字。默认为 `undefined`。*/
3144 | outDir?: string;
3145 | /** List of path mapping entries for module names to locations relative to the
3146 | * `baseUrl`. Defaults to `undefined`.
3147 | * @i18n 模块名到基于 `baseUrl` 的路径映射的列表。默认为 `undefined`。*/
3148 | paths?: Record;
3149 | /** Do not erase const enum declarations in generated code. Defaults to
3150 | * `false`.
3151 | * @i18n 保留 const 和 enum 声明。默认为 `false`。*/
3152 | preserveConstEnums?: boolean;
3153 | /** Remove all comments except copy-right header comments beginning with
3154 | * `/*!`. Defaults to `true`.
3155 | * @i18n 删除所有注释,除了以 `/*!` 开头的版权信息。默认为 `true`。*/
3156 | removeComments?: boolean;
3157 | /** Include modules imported with `.json` extension. Defaults to `true`.
3158 | * @i18n 包含以 `.json` 扩展名引入模块。默认为 `true`。*/
3159 | resolveJsonModule?: boolean;
3160 | /** Specifies the root directory of input files. Only use to control the
3161 | * output directory structure with `outDir`. Defaults to `undefined`.
3162 | * @i18n 指定输出文件的根目录。仅用来控制 `outDir` 输出的目录结构。默认为 `undefined`。*/
3163 | rootDir?: string;
3164 | /** List of _root_ folders whose combined content represent the structure of
3165 | * the project at runtime. Defaults to `undefined`.
3166 | * @i18n 根文件夹列表,表示运行时组合工程结构的内容。默认为 `undefined`。*/
3167 | rootDirs?: string[];
3168 | /** Generates corresponding `.map` file. Defaults to `false`.
3169 | * @i18n 生成对应的 `.map` 文件。默认为 `false`。*/
3170 | sourceMap?: boolean;
3171 | /** Specifies the location where debugger should locate TypeScript files
3172 | * instead of source locations. Use this flag if the sources will be located
3173 | * at run-time in a different location than that at design-time. The location
3174 | * specified will be embedded in the sourceMap to direct the debugger where
3175 | * the source files will be located. Defaults to `undefined`.
3176 | * @i18n 指定 TypeScript 源文件的路径,以便调试器定位。
3177 | * 当 TypeScript 文件的位置是在运行时指定时使用此标记。
3178 | * 路径信息会被加到 sourceMap 里。
3179 | * 默认为 `undefined`。*/
3180 | sourceRoot?: string;
3181 | /** Enable all strict type checking options. Enabling `strict` enables
3182 | * `noImplicitAny`, `noImplicitThis`, `alwaysStrict`, `strictBindCallApply`,
3183 | * `strictNullChecks`, `strictFunctionTypes` and
3184 | * `strictPropertyInitialization`. Defaults to `true`.
3185 | * @i18n 启用所有严格类型检查选项。 启用 `strict` 相当于启用
3186 | * `noImplicitAny`, `noImplicitThis`, `alwaysStrict`, `strictBindCallApply`,
3187 | * `strictNullChecks`, `strictFunctionTypes` and
3188 | * `strictPropertyInitialization`。默认为 `true`。*/
3189 | strict?: boolean;
3190 | /** Enable stricter checking of the `bind`, `call`, and `apply` methods on
3191 | * functions. Defaults to `true`.
3192 | * @i18n 对函数中的 `bind`, `call`, `apply` 方法启用更严格的检查。默认为 `true`。*/
3193 | strictBindCallApply?: boolean;
3194 | /** Disable bivariant parameter checking for function types. Defaults to
3195 | * `true`.
3196 | * @i18n 禁用函数参数双向协变检查。默认为 `true`。*/
3197 | strictFunctionTypes?: boolean;
3198 | /** Ensure non-undefined class properties are initialized in the constructor.
3199 | * This option requires `strictNullChecks` be enabled in order to take effect.
3200 | * Defaults to `true`.
3201 | * @i18n 确保类的非 undefined 属性已经在构造函数里初始化。
3202 | * 若要令此选项生效,需要同时启用 `strictNullChecks`。
3203 | * 默认为 `true`。*/
3204 | strictPropertyInitialization?: boolean;
3205 | /** In strict null checking mode, the `null` and `undefined` values are not in
3206 | * the domain of every type and are only assignable to themselves and `any`
3207 | * (the one exception being that `undefined` is also assignable to `void`).
3208 | * @i18n 在严格的 null 检查模式下, `null` 和 `undefined` 值不包含在任何类型里。
3209 | * 只允许用它们自己和 `any` 来赋值。
3210 | * (例外的是 `undefined` 可以赋值到 `void` )。 */
3211 | strictNullChecks?: boolean;
3212 | /** Suppress excess property checks for object literals. Defaults to
3213 | * `false`.
3214 | * @i18n 阻止对对象字面量的额外属性检查。默认为 `false`。*/
3215 | suppressExcessPropertyErrors?: boolean;
3216 | /** Suppress `noImplicitAny` errors for indexing objects lacking index
3217 | * signatures.
3218 | * @i18n 阻止 `noImplicitAny` 对缺少索引签名的索引对象报错。*/
3219 | suppressImplicitAnyIndexErrors?: boolean;
3220 | /** Specify ECMAScript target version. Defaults to `esnext`.
3221 | * @i18n 指定 ECMAScript 目标版本。默认为 `esnext`。*/
3222 | target?:
3223 | | "es3"
3224 | | "es5"
3225 | | "es6"
3226 | | "es2015"
3227 | | "es2016"
3228 | | "es2017"
3229 | | "es2018"
3230 | | "es2019"
3231 | | "es2020"
3232 | | "esnext";
3233 | /** List of names of type definitions to include. Defaults to `undefined`.
3234 | *
3235 | * The type definitions are resolved according to the normal Deno resolution
3236 | * irrespective of if sources are provided on the call. Like other Deno
3237 | * modules, there is no "magical" resolution. For example:
3238 | * @i18n 需要包含的类型声明文件名称列表。默认为 `undefined`。
3239 | * 该类型定义是解决了符合普通的 Deno 类型解析。
3240 | * 无论资源是否提供来源。
3241 | * 就像其他的 Deno 模块, 没有“神奇”的解决方法。例如:
3242 | *
3243 | * Deno.compile(
3244 | * "./foo.js",
3245 | * undefined,
3246 | * {
3247 | * types: [ "./foo.d.ts", "https://deno.land/x/example/types.d.ts" ]
3248 | * }
3249 | * );
3250 | */
3251 | types?: string[];
3252 | }
3253 |
3254 | /** **UNSTABLE**: new API, yet to be vetted.
3255 | * @i18n **不稳定**:新的 API,尚待审核。
3256 | *
3257 | * The results of a transpile only command, where the `source` contains the
3258 | * emitted source, and `map` optionally contains the source map.
3259 | * @i18n transpile only 命令的结果,其中 `source`
3260 | * 为转化后的源码,而 `map` 则为源码的 source map。*/
3261 | export interface TranspileOnlyResult {
3262 | source: string;
3263 | map?: string;
3264 | }
3265 |
3266 | /** **UNSTABLE**: new API, yet to be vetted.
3267 | * @i18n **不稳定**:新的 API,尚待审核。
3268 | *
3269 | * Takes a set of TypeScript sources and resolves to a map where the key was
3270 | * the original file name provided in sources and the result contains the
3271 | * `source` and optionally the `map` from the transpile operation. This does no
3272 | * type checking and validation, it effectively "strips" the types from the
3273 | * file.
3274 | * @i18n 给定一组 TypeScript 类型的源码 (sources),返回解析后的映射,
3275 | * 其中的 key 是 sources 的 key,结果则包含转化过的源码及源码的 source map。
3276 | * 此函数并不进行类型校检,它可以有效地从文件中 “删除” 类型。
3277 | *
3278 | * const results = await Deno.transpileOnly({
3279 | * "foo.ts": `const foo: string = "foo";`
3280 | * });
3281 | *
3282 | * @param sources A map where the key is the filename and the value is the text
3283 | * to transpile. The filename is only used in the transpile and
3284 | * not resolved, for example to fill in the source name in the
3285 | * source map.
3286 | * @param_i18n sources key 是文件名,value 是要转换的源码。
3287 | * 文件扩展名并不会被解析,仅用作解析结果的 key。
3288 | * @param options An option object of options to send to the compiler. This is
3289 | * a subset of ts.CompilerOptions which can be supported by Deno.
3290 | * Many of the options related to type checking and emitting
3291 | * type declaration files will have no impact on the output.
3292 | * @param_i18n options 编译选项。这是可以被 Deno 支持的 ts.CompilerOptions 选项的一个子集。
3293 | */
3294 | export function transpileOnly(
3295 | sources: Record,
3296 | options?: CompilerOptions
3297 | ): Promise>;
3298 |
3299 | /** **UNSTABLE**: new API, yet to be vetted.
3300 | * @i18n **不稳定**:新的 API,尚待审核。
3301 | *
3302 | * Takes a root module name, and optionally a record set of sources. Resolves
3303 | * with a compiled set of modules and possibly diagnostics if the compiler
3304 | * encountered any issues. If just a root name is provided, the modules
3305 | * will be resolved as if the root module had been passed on the command line.
3306 | * @i18n 它接受根模块名 rootName,及 Record 类型的可选参数
3307 | * sources 做为模块源。返回编译后的模块集合及编译过程中遇到的问题的诊断信息。
3308 | * 如果仅传了 rootName,那么模块解析结果同命令行一致。
3309 | *
3310 | * If sources are passed, all modules will be resolved out of this object, where
3311 | * the key is the module name and the value is the content. The extension of
3312 | * the module name will be used to determine the media type of the module.
3313 | * @i18n 如果传递了 sources,则所有模块都将从该 sources 对象中解析出来,
3314 | * 其中键是模块名称,值是内容。模块名称的扩展名将用于确定模块的类型。
3315 | *
3316 | * const [ maybeDiagnostics1, output1 ] = await Deno.compile("foo.ts");
3317 | *
3318 | * const [ maybeDiagnostics2, output2 ] = await Deno.compile("/foo.ts", {
3319 | * "/foo.ts": `export * from "./bar.ts";`,
3320 | * "/bar.ts": `export const bar = "bar";`
3321 | * });
3322 | *
3323 | * @param rootName The root name of the module which will be used as the
3324 | * "starting point". If no `sources` is specified, Deno will
3325 | * resolve the module externally as if the `rootName` had been
3326 | * specified on the command line.
3327 | * @param_i18n rootName 作为 “起点” 的模块名。如果没有传递 `sources` 参数,
3328 | * Deno 将从外部解析模块,就像在命令行中指定了 `rootName` 一样。
3329 | * @param sources An optional key/value map of sources to be used when resolving
3330 | * modules, where the key is the module name, and the value is
3331 | * the source content. The extension of the key will determine
3332 | * the media type of the file when processing. If supplied,
3333 | * Deno will not attempt to resolve any modules externally.
3334 | * @param_i18n sources 可选参数,解析模块时使用的 key/value 对象,其中 key 是模块名,value 是源内容。
3335 | * key 的扩展名决定了解析模块的类型。如果提供此参数,Deno 将不会尝试从外部解析任何模块。
3336 | * @param options An optional object of options to send to the compiler. This is
3337 | * a subset of ts.CompilerOptions which can be supported by Deno.
3338 | * @param_i18n options 编译选项。这是可以被 Deno 支持的 ts.CompilerOptions 选项的一个子集。
3339 | */
3340 | export function compile(
3341 | rootName: string,
3342 | sources?: Record,
3343 | options?: CompilerOptions
3344 | ): Promise<[DiagnosticItem[] | undefined, Record]>;
3345 |
3346 | /** **UNSTABLE**: new API, yet to be vetted.
3347 | * @i18n **不稳定**:新的 API,尚待审核。
3348 | *
3349 | * `bundle()` is part the compiler API. A full description of this functionality
3350 | * can be found in the [manual](https://deno.land/std/manual.md#denobundle).
3351 | * @i18n `bundle()` 是编译器 API 的一部分。有关此功能的完整说明,
3352 | * 请参见 [手册](https://deno.land/std/manual.md#denobundle)。
3353 | *
3354 | * Takes a root module name, and optionally a record set of sources. Resolves
3355 | * with a single JavaScript string (and bundle diagnostics if issues arise with
3356 | * the bundling) that is like the output of a `deno bundle` command. If just
3357 | * a root name is provided, the modules will be resolved as if the root module
3358 | * had been passed on the command line.
3359 | * @i18n 它接受根模块名 rootName,及可选参数 sources 做为模块源。
3360 | * 就像使用 `deno bundle` 命令输出的结果一样,其返回值是一个
3361 | * JavaScript 字符串(如果在打包过程中出现错误, 则会返回错误诊断信息)。
3362 | * 如果仅传了 rootName,那么模块解析结果同命令行一致。
3363 | *
3364 | * If sources are passed, all modules will be resolved out of this object, where
3365 | * the key is the module name and the value is the content. The extension of the
3366 | * module name will be used to determine the media type of the module.
3367 | * @i18n 如果传递了 sources,则所有模块都将从该 sources 对象中解析出来,
3368 | * 其中键是模块名称,值是内容。模块名称的扩展名将用于确定模块的类型。
3369 | *
3370 | * // 相当于执行 "deno bundle foo.ts" 命令
3371 | * const [ maybeDiagnostics1, output1 ] = await Deno.bundle("foo.ts");
3372 | *
3373 | * const [ maybeDiagnostics2, output2 ] = await Deno.bundle("/foo.ts", {
3374 | * "/foo.ts": `export * from "./bar.ts";`,
3375 | * "/bar.ts": `export const bar = "bar";`
3376 | * });
3377 | *
3378 | * @param rootName The root name of the module which will be used as the
3379 | * "starting point". If no `sources` is specified, Deno will
3380 | * resolve the module externally as if the `rootName` had been
3381 | * specified on the command line.
3382 | * @param_i18n rootName 作为 “起点” 的模块名。如果没有传递 `sources` 参数,
3383 | * Deno 将从外部解析模块,就像在命令行中指定了 `rootName` 一样。
3384 | * @param sources An optional key/value map of sources to be used when resolving
3385 | * modules, where the key is the module name, and the value is
3386 | * the source content. The extension of the key will determine
3387 | * the media type of the file when processing. If supplied,
3388 | * Deno will not attempt to resolve any modules externally.
3389 | * @param_i18n sources 可选参数,解析模块时使用的 key/value 对象,其中 key 是模块名,value 是源内容。
3390 | * key 的扩展名决定了解析模块的类型。如果提供此参数,Deno 将不会尝试从外部解析任何模块。
3391 | * @param options An optional object of options to send to the compiler. This is
3392 | * a subset of ts.CompilerOptions which can be supported by Deno.
3393 | * @param_i18n options 编译选项。这是可以被 Deno 支持的 ts.CompilerOptions 选项的一个子集。
3394 | */
3395 | export function bundle(
3396 | rootName: string,
3397 | sources?: Record,
3398 | options?: CompilerOptions
3399 | ): Promise<[DiagnosticItem[] | undefined, string]>;
3400 |
3401 | /** Returns the script arguments to the program. If for example we run a
3402 | * program:
3403 | * @i18n 将脚本参数返回给程序。例如我们运行下方的程序
3404 | *
3405 | * deno --allow-read https://deno.land/std/examples/cat.ts /etc/passwd
3406 | *
3407 | * Then `Deno.args` will contain:
3408 | * @i18n 此时 `Deno.args` 将包含:
3409 | *
3410 | * [ "/etc/passwd" ]
3411 | */
3412 | export const args: string[];
3413 |
3414 | /** **UNSTABLE**: new API, yet to be vetted.
3415 | * @i18n **不稳定**: 新 API,没有经过审查。
3416 | *
3417 | * Represents the stream of signals, implements both `AsyncIterator` and
3418 | * `PromiseLike`.
3419 | * @i18n 信号流,实现了 `AsyncIterator` 和 `PromiseLike` 接口。*/
3420 | export class SignalStream
3421 | implements AsyncIterableIterator, PromiseLike {
3422 | constructor(signal: typeof Deno.Signal);
3423 | then(
3424 | f: (v: void) => T | Promise,
3425 | g?: (v: void) => S | Promise
3426 | ): Promise;
3427 | next(): Promise>;
3428 | [Symbol.asyncIterator](): AsyncIterableIterator;
3429 | dispose(): void;
3430 | }
3431 |
3432 | /** **UNSTABLE**: new API, yet to be vetted.
3433 | * @i18n **不稳定**: 新 API,没有经过审查。
3434 | *
3435 | * Returns the stream of the given signal number. You can use it as an async
3436 | * iterator.
3437 | * @i18n 返回指定信号编码的流。返回值可用于异步迭代。
3438 | *
3439 | * for await (const _ of Deno.signal(Deno.Signal.SIGTERM)) {
3440 | * console.log("got SIGTERM!");
3441 | * }
3442 | *
3443 | * You can also use it as a promise. In this case you can only receive the
3444 | * first one.
3445 | * @i18n 也可以把它作为 Promise 来使用。在这种情况下,只能收到第一个值。
3446 | *
3447 | * await Deno.signal(Deno.Signal.SIGTERM);
3448 | * console.log("SIGTERM received!")
3449 | *
3450 | * If you want to stop receiving the signals, you can use `.dispose()` method
3451 | * of the signal stream object.
3452 | * @i18n 如果要停止接收信号,可以使用信号流对象(`SignalStream`)的 `.dispose()` 方法。
3453 | *
3454 | * const sig = Deno.signal(Deno.Signal.SIGTERM);
3455 | * setTimeout(() => { sig.dispose(); }, 5000);
3456 | * for await (const _ of sig) {
3457 | * console.log("SIGTERM!")
3458 | * }
3459 | *
3460 | * The above for-await loop exits after 5 seconds when `sig.dispose()` is
3461 | * called.
3462 | * @i18n 当调用 `sig.dispose()` 5 秒后,上述 for-await 循环退出。
3463 | *
3464 | * NOTE: This functionality is not yet implemented on Windows.
3465 | * @i18n 注意: 这个功能还没有在 Windows 上实现。
3466 | */
3467 | export function signal(signo: number): SignalStream;
3468 |
3469 | /** **UNSTABLE**: new API, yet to be vetted.
3470 | * @i18n **不稳定**: 新 API,没有经过审查。*/
3471 | export const signals: {
3472 | /** Returns the stream of SIGALRM signals.
3473 | * @i18n 返回 SIGALRM 信号流。
3474 | *
3475 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGALRM)`.
3476 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGALRM)` 的简写形式。*/
3477 | alarm: () => SignalStream;
3478 | /** Returns the stream of SIGCHLD signals.
3479 | * @i18n 返回 SIGCHLD 信号流。
3480 | *
3481 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGCHLD)`.
3482 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGCHLD)` 的简写形式。*/
3483 | child: () => SignalStream;
3484 | /** Returns the stream of SIGHUP signals.
3485 | * @i18n 返回 SIGHUP 信号流。
3486 | *
3487 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGHUP)`.
3488 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGHUP)` 的简写形式。*/
3489 | hungup: () => SignalStream;
3490 | /** Returns the stream of SIGINT signals.
3491 | * @i18n 返回 SIGINT 信号流。
3492 | *
3493 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGINT)`.
3494 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGINT)` 的简写形式。*/
3495 | interrupt: () => SignalStream;
3496 | /** Returns the stream of SIGIO signals.
3497 | * @i18n 返回 SIGIO 信号流。
3498 | *
3499 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGIO)`.
3500 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGIO)` 的简写形式。*/
3501 | io: () => SignalStream;
3502 | /** Returns the stream of SIGPIPE signals.
3503 | * @i18n 返回 SIGPIPE 信号流。
3504 | *
3505 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGPIPE)`.
3506 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGPIPE)` 的简写形式。*/
3507 | pipe: () => SignalStream;
3508 | /** Returns the stream of SIGQUIT signals.
3509 | * @i18n 返回 SIGQUIT 信号流。
3510 | *
3511 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGQUIT)`.
3512 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGQUIT)` 的简写形式。*/
3513 | quit: () => SignalStream;
3514 | /** Returns the stream of SIGTERM signals.
3515 | * @i18n 返回 SIGTERM 信号流。
3516 | *
3517 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGTERM)`.
3518 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGTERM)` 的简写形式。*/
3519 | terminate: () => SignalStream;
3520 | /** Returns the stream of SIGUSR1 signals.
3521 | * @i18n 返回 SIGUSR1 信号流。
3522 | *
3523 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGUSR1)`.
3524 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGUSR1)` 的简写形式。*/
3525 | userDefined1: () => SignalStream;
3526 | /** Returns the stream of SIGUSR2 signals.
3527 | * @i18n 返回 SIGUSR2 信号流。
3528 | *
3529 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGUSR2)`.
3530 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGUSR2)` 的简写形式。*/
3531 | userDefined2: () => SignalStream;
3532 | /** Returns the stream of SIGWINCH signals.
3533 | * @i18n 返回 SIGWINCH 信号流。
3534 | *
3535 | * This method is the shorthand for `Deno.signal(Deno.Signal.SIGWINCH)`.
3536 | * @i18n 此方法是 `Deno.signal(Deno.Signal.SIGWINCH)` 的简写形式。*/
3537 | windowChange: () => SignalStream;
3538 | };
3539 |
3540 | /** **UNSTABLE**: new API. Maybe move `Deno.EOF` here.
3541 | * @i18n **不稳定**: 新 API。可能会把 `Deno.EOF` 移动到这里。
3542 | *
3543 | * Special Deno related symbols.
3544 | * @i18n 与 Deno 相关的 `Symbol`。*/
3545 | export const symbols: {
3546 | /** Symbol to access exposed internal Deno API
3547 | * @i18n 用于将 Deno 内部 API 暴露出来的 Symbol */
3548 | readonly internal: unique symbol;
3549 | /** A symbol which can be used as a key for a custom method which will be
3550 | * called when `Deno.inspect()` is called, or when the object is logged to
3551 | * the console.
3552 | * @i18n 这个 Symbol 可以作为 key 来定义一个方法,当 `Deno.inspect()` 被调用或者调用了
3553 | * console 的日志方法时,这个自定义函数被调用。*/
3554 | readonly customInspect: unique symbol;
3555 | // TODO(ry) move EOF here?
3556 | };
3557 | }
3558 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "private": true,
3 | "version": "0.0.0",
4 | "scripts": {
5 | "format": "pretty-quick",
6 | "build": "typedoc"
7 | },
8 | "devDependencies": {
9 | "husky": "^4.2.5",
10 | "prettier": "^2.0.5",
11 | "pretty-quick": "^2.0.1",
12 | "typedoc": "^0.17.8",
13 | "typedoc-deno-theme": "^1.3.3",
14 | "typedoc-plugin-deno": "^1.3.2",
15 | "typescript": "^3.8.3"
16 | },
17 | "husky": {
18 | "hooks": {
19 | "pre-commit": "pretty-quick --staged"
20 | }
21 | },
22 | "license": "CC BY-NC 4.0"
23 | }
24 |
--------------------------------------------------------------------------------
/typedoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "inputFiles": "./lib.deno.ns.d.ts",
3 | "out": "typedoc",
4 | "entryPoint": "Deno",
5 | "name": "Deno API 简体中文版",
6 | "mode": "file",
7 | "includeDeclarations": true,
8 | "excludeExternals": true,
9 | "ignoreCompilerErrors": true,
10 | "excludePrivate": true,
11 | "excludeProtected": true,
12 | "theme": "node_modules/typedoc-deno-theme/dist",
13 | "gaID": "UA-123999279-2",
14 | "readme": "none"
15 | }
16 |
--------------------------------------------------------------------------------
/yarn.lock:
--------------------------------------------------------------------------------
1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
2 | # yarn lockfile v1
3 |
4 |
5 | "@babel/code-frame@^7.0.0":
6 | version "7.10.4"
7 | resolved "https://registry.npm.taobao.org/@babel/code-frame/download/@babel/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a"
8 | integrity sha1-Fo2ho26Q2miujUnA8bSMfGJJITo=
9 | dependencies:
10 | "@babel/highlight" "^7.10.4"
11 |
12 | "@babel/helper-validator-identifier@^7.10.4":
13 | version "7.10.4"
14 | resolved "https://registry.npm.taobao.org/@babel/helper-validator-identifier/download/@babel/helper-validator-identifier-7.10.4.tgz?cache=0&sync_timestamp=1593522928192&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhelper-validator-identifier%2Fdownload%2F%40babel%2Fhelper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2"
15 | integrity sha1-p4x6clHgH2FlEtMbEK3PUq2l4NI=
16 |
17 | "@babel/highlight@^7.10.4":
18 | version "7.10.4"
19 | resolved "https://registry.npm.taobao.org/@babel/highlight/download/@babel/highlight-7.10.4.tgz?cache=0&sync_timestamp=1593522929801&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2F%40babel%2Fhighlight%2Fdownload%2F%40babel%2Fhighlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143"
20 | integrity sha1-fRvf1ldTU4+r5sOFls23bZrGAUM=
21 | dependencies:
22 | "@babel/helper-validator-identifier" "^7.10.4"
23 | chalk "^2.0.0"
24 | js-tokens "^4.0.0"
25 |
26 | "@types/color-name@^1.1.1":
27 | version "1.1.1"
28 | resolved "https://registry.npm.taobao.org/@types/color-name/download/@types/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0"
29 | integrity sha1-HBJhu+qhCoBVu8XYq4S3sq/IRqA=
30 |
31 | "@types/minimatch@^3.0.3":
32 | version "3.0.3"
33 | resolved "https://registry.npm.taobao.org/@types/minimatch/download/@types/minimatch-3.0.3.tgz#3dca0e3f33b200fc7d1139c0cd96c1268cadfd9d"
34 | integrity sha1-PcoOPzOyAPx9ETnAzZbBJoyt/Z0=
35 |
36 | "@types/parse-json@^4.0.0":
37 | version "4.0.0"
38 | resolved "https://registry.npm.taobao.org/@types/parse-json/download/@types/parse-json-4.0.0.tgz#2f8bb441434d163b35fb8ffdccd7138927ffb8c0"
39 | integrity sha1-L4u0QUNNFjs1+4/9zNcTiSf/uMA=
40 |
41 | ansi-styles@^3.2.1:
42 | version "3.2.1"
43 | resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-3.2.1.tgz#41fbb20243e50b12be0f04b8dedbf07520ce841d"
44 | integrity sha1-QfuyAkPlCxK+DwS43tvwdSDOhB0=
45 | dependencies:
46 | color-convert "^1.9.0"
47 |
48 | ansi-styles@^4.1.0:
49 | version "4.2.1"
50 | resolved "https://registry.npm.taobao.org/ansi-styles/download/ansi-styles-4.2.1.tgz#90ae75c424d008d2624c5bf29ead3177ebfcf359"
51 | integrity sha1-kK51xCTQCNJiTFvynq0xd+v881k=
52 | dependencies:
53 | "@types/color-name" "^1.1.1"
54 | color-convert "^2.0.1"
55 |
56 | array-differ@^3.0.0:
57 | version "3.0.0"
58 | resolved "https://registry.npm.taobao.org/array-differ/download/array-differ-3.0.0.tgz#3cbb3d0f316810eafcc47624734237d6aee4ae6b"
59 | integrity sha1-PLs9DzFoEOr8xHYkc0I31q7krms=
60 |
61 | array-union@^2.1.0:
62 | version "2.1.0"
63 | resolved "https://registry.npm.taobao.org/array-union/download/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d"
64 | integrity sha1-t5hCCtvrHego2ErNii4j0+/oXo0=
65 |
66 | arrify@^2.0.1:
67 | version "2.0.1"
68 | resolved "https://registry.npm.taobao.org/arrify/download/arrify-2.0.1.tgz#c9655e9331e0abcd588d2a7cad7e9956f66701fa"
69 | integrity sha1-yWVekzHgq81YjSp8rX6ZVvZnAfo=
70 |
71 | balanced-match@^1.0.0:
72 | version "1.0.2"
73 | resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee"
74 | integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
75 |
76 | brace-expansion@^1.1.7:
77 | version "1.1.11"
78 | resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd"
79 | integrity sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
80 | dependencies:
81 | balanced-match "^1.0.0"
82 | concat-map "0.0.1"
83 |
84 | callsites@^3.0.0:
85 | version "3.1.0"
86 | resolved "https://registry.npm.taobao.org/callsites/download/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
87 | integrity sha1-s2MKvYlDQy9Us/BRkjjjPNffL3M=
88 |
89 | chalk@^2.0.0, chalk@^2.4.2:
90 | version "2.4.2"
91 | resolved "https://registry.npm.taobao.org/chalk/download/chalk-2.4.2.tgz?cache=0&sync_timestamp=1591687063886&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
92 | integrity sha1-zUJUFnelQzPPVBpJEIwUMrRMlCQ=
93 | dependencies:
94 | ansi-styles "^3.2.1"
95 | escape-string-regexp "^1.0.5"
96 | supports-color "^5.3.0"
97 |
98 | chalk@^4.0.0:
99 | version "4.1.0"
100 | resolved "https://registry.npm.taobao.org/chalk/download/chalk-4.1.0.tgz?cache=0&sync_timestamp=1591687063886&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fchalk%2Fdownload%2Fchalk-4.1.0.tgz#4e14870a618d9e2edd97dd8345fd9d9dc315646a"
101 | integrity sha1-ThSHCmGNni7dl92DRf2dncMVZGo=
102 | dependencies:
103 | ansi-styles "^4.1.0"
104 | supports-color "^7.1.0"
105 |
106 | ci-info@^2.0.0:
107 | version "2.0.0"
108 | resolved "https://registry.npm.taobao.org/ci-info/download/ci-info-2.0.0.tgz#67a9e964be31a51e15e5010d58e6f12834002f46"
109 | integrity sha1-Z6npZL4xpR4V5QENWObxKDQAL0Y=
110 |
111 | color-convert@^1.9.0:
112 | version "1.9.3"
113 | resolved "https://registry.npm.taobao.org/color-convert/download/color-convert-1.9.3.tgz#bb71850690e1f136567de629d2d5471deda4c1e8"
114 | integrity sha1-u3GFBpDh8TZWfeYp0tVHHe2kweg=
115 | dependencies:
116 | color-name "1.1.3"
117 |
118 | color-convert@^2.0.1:
119 | version "2.0.1"
120 | resolved "https://registry.npm.taobao.org/color-convert/download/color-convert-2.0.1.tgz#72d3a68d598c9bdb3af2ad1e84f21d896abd4de3"
121 | integrity sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=
122 | dependencies:
123 | color-name "~1.1.4"
124 |
125 | color-name@1.1.3:
126 | version "1.1.3"
127 | resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.3.tgz#a7d0558bd89c42f795dd42328f740831ca53bc25"
128 | integrity sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=
129 |
130 | color-name@~1.1.4:
131 | version "1.1.4"
132 | resolved "https://registry.npm.taobao.org/color-name/download/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2"
133 | integrity sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=
134 |
135 | compare-versions@^3.6.0:
136 | version "3.6.0"
137 | resolved "https://registry.npm.taobao.org/compare-versions/download/compare-versions-3.6.0.tgz#1a5689913685e5a87637b8d3ffca75514ec41d62"
138 | integrity sha1-GlaJkTaF5ah2N7jT/8p1UU7EHWI=
139 |
140 | concat-map@0.0.1:
141 | version "0.0.1"
142 | resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b"
143 | integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=
144 |
145 | cosmiconfig@^6.0.0:
146 | version "6.0.0"
147 | resolved "https://registry.npm.taobao.org/cosmiconfig/download/cosmiconfig-6.0.0.tgz#da4fee853c52f6b1e6935f41c1a2fc50bd4a9982"
148 | integrity sha1-2k/uhTxS9rHmk19BwaL8UL1KmYI=
149 | dependencies:
150 | "@types/parse-json" "^4.0.0"
151 | import-fresh "^3.1.0"
152 | parse-json "^5.0.0"
153 | path-type "^4.0.0"
154 | yaml "^1.7.2"
155 |
156 | cross-spawn@^7.0.0:
157 | version "7.0.3"
158 | resolved "https://registry.npm.taobao.org/cross-spawn/download/cross-spawn-7.0.3.tgz?cache=0&sync_timestamp=1590421014780&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fcross-spawn%2Fdownload%2Fcross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6"
159 | integrity sha1-9zqFudXUHQRVUcF34ogtSshXKKY=
160 | dependencies:
161 | path-key "^3.1.0"
162 | shebang-command "^2.0.0"
163 | which "^2.0.1"
164 |
165 | end-of-stream@^1.1.0:
166 | version "1.4.4"
167 | resolved "https://registry.npm.taobao.org/end-of-stream/download/end-of-stream-1.4.4.tgz?cache=0&sync_timestamp=1569416267505&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fend-of-stream%2Fdownload%2Fend-of-stream-1.4.4.tgz#5ae64a5f45057baf3626ec14da0ca5e4b2431eb0"
168 | integrity sha1-WuZKX0UFe682JuwU2gyl5LJDHrA=
169 | dependencies:
170 | once "^1.4.0"
171 |
172 | error-ex@^1.3.1:
173 | version "1.3.2"
174 | resolved "https://registry.npm.taobao.org/error-ex/download/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
175 | integrity sha1-tKxAZIEH/c3PriQvQovqihTU8b8=
176 | dependencies:
177 | is-arrayish "^0.2.1"
178 |
179 | escape-string-regexp@^1.0.5:
180 | version "1.0.5"
181 | resolved "https://registry.npm.taobao.org/escape-string-regexp/download/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
182 | integrity sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=
183 |
184 | execa@^2.1.0:
185 | version "2.1.0"
186 | resolved "https://registry.npm.taobao.org/execa/download/execa-2.1.0.tgz?cache=0&sync_timestamp=1594145138347&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fexeca%2Fdownload%2Fexeca-2.1.0.tgz#e5d3ecd837d2a60ec50f3da78fd39767747bbe99"
187 | integrity sha1-5dPs2DfSpg7FDz2nj9OXZ3R7vpk=
188 | dependencies:
189 | cross-spawn "^7.0.0"
190 | get-stream "^5.0.0"
191 | is-stream "^2.0.0"
192 | merge-stream "^2.0.0"
193 | npm-run-path "^3.0.0"
194 | onetime "^5.1.0"
195 | p-finally "^2.0.0"
196 | signal-exit "^3.0.2"
197 | strip-final-newline "^2.0.0"
198 |
199 | find-up@^4.0.0, find-up@^4.1.0:
200 | version "4.1.0"
201 | resolved "https://registry.npm.taobao.org/find-up/download/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19"
202 | integrity sha1-l6/n1s3AvFkoWEt8jXsW6KmqXRk=
203 | dependencies:
204 | locate-path "^5.0.0"
205 | path-exists "^4.0.0"
206 |
207 | find-versions@^3.2.0:
208 | version "3.2.0"
209 | resolved "https://registry.npm.taobao.org/find-versions/download/find-versions-3.2.0.tgz#10297f98030a786829681690545ef659ed1d254e"
210 | integrity sha1-ECl/mAMKeGgpaBaQVF72We0dJU4=
211 | dependencies:
212 | semver-regex "^2.0.0"
213 |
214 | fs-extra@^8.1.0:
215 | version "8.1.0"
216 | resolved "https://registry.npm.taobao.org/fs-extra/download/fs-extra-8.1.0.tgz#49d43c45a88cd9677668cb7be1b46efdb8d2e1c0"
217 | integrity sha1-SdQ8RaiM2Wd2aMt74bRu/bjS4cA=
218 | dependencies:
219 | graceful-fs "^4.2.0"
220 | jsonfile "^4.0.0"
221 | universalify "^0.1.0"
222 |
223 | fs.realpath@^1.0.0:
224 | version "1.0.0"
225 | resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f"
226 | integrity sha1-FQStJSMVjKpA20onh8sBQRmU6k8=
227 |
228 | function-bind@^1.1.1:
229 | version "1.1.1"
230 | resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d"
231 | integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==
232 |
233 | get-stream@^5.0.0:
234 | version "5.1.0"
235 | resolved "https://registry.npm.taobao.org/get-stream/download/get-stream-5.1.0.tgz#01203cdc92597f9b909067c3e656cc1f4d3c4dc9"
236 | integrity sha1-ASA83JJZf5uQkGfD5lbMH008Tck=
237 | dependencies:
238 | pump "^3.0.0"
239 |
240 | glob@^7.0.0:
241 | version "7.2.0"
242 | resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.0.tgz#d15535af7732e02e948f4c41628bd910293f6023"
243 | integrity sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==
244 | dependencies:
245 | fs.realpath "^1.0.0"
246 | inflight "^1.0.4"
247 | inherits "2"
248 | minimatch "^3.0.4"
249 | once "^1.3.0"
250 | path-is-absolute "^1.0.0"
251 |
252 | graceful-fs@^4.1.6, graceful-fs@^4.2.0:
253 | version "4.2.4"
254 | resolved "https://registry.npm.taobao.org/graceful-fs/download/graceful-fs-4.2.4.tgz?cache=0&sync_timestamp=1588086905523&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fgraceful-fs%2Fdownload%2Fgraceful-fs-4.2.4.tgz#2256bde14d3632958c465ebc96dc467ca07a29fb"
255 | integrity sha1-Ila94U02MpWMRl68ltxGfKB6Kfs=
256 |
257 | handlebars@^4.7.6:
258 | version "4.7.7"
259 | resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.7.7.tgz#9ce33416aad02dbd6c8fafa8240d5d98004945a1"
260 | integrity sha512-aAcXm5OAfE/8IXkcZvCepKU3VzW1/39Fb5ZuqMtgI/hT8X2YgoMvBY5dLhq/cpOvw7Lk1nK/UF71aLG/ZnVYRA==
261 | dependencies:
262 | minimist "^1.2.5"
263 | neo-async "^2.6.0"
264 | source-map "^0.6.1"
265 | wordwrap "^1.0.0"
266 | optionalDependencies:
267 | uglify-js "^3.1.4"
268 |
269 | has-flag@^3.0.0:
270 | version "3.0.0"
271 | resolved "https://registry.npm.taobao.org/has-flag/download/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd"
272 | integrity sha1-tdRU3CGZriJWmfNGfloH87lVuv0=
273 |
274 | has-flag@^4.0.0:
275 | version "4.0.0"
276 | resolved "https://registry.npm.taobao.org/has-flag/download/has-flag-4.0.0.tgz#944771fd9c81c81265c4d6941860da06bb59479b"
277 | integrity sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=
278 |
279 | has@^1.0.3:
280 | version "1.0.3"
281 | resolved "https://registry.yarnpkg.com/has/-/has-1.0.3.tgz#722d7cbfc1f6aa8241f16dd814e011e1f41e8796"
282 | integrity sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==
283 | dependencies:
284 | function-bind "^1.1.1"
285 |
286 | highlight.js@^10.0.0:
287 | version "10.4.1"
288 | resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-10.4.1.tgz#d48fbcf4a9971c4361b3f95f302747afe19dbad0"
289 | integrity sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg==
290 |
291 | husky@^4.2.5:
292 | version "4.2.5"
293 | resolved "https://registry.npm.taobao.org/husky/download/husky-4.2.5.tgz#2b4f7622673a71579f901d9885ed448394b5fa36"
294 | integrity sha1-K092Imc6cVefkB2Yhe1Eg5S1+jY=
295 | dependencies:
296 | chalk "^4.0.0"
297 | ci-info "^2.0.0"
298 | compare-versions "^3.6.0"
299 | cosmiconfig "^6.0.0"
300 | find-versions "^3.2.0"
301 | opencollective-postinstall "^2.0.2"
302 | pkg-dir "^4.2.0"
303 | please-upgrade-node "^3.2.0"
304 | slash "^3.0.0"
305 | which-pm-runs "^1.0.0"
306 |
307 | ignore@^5.1.4:
308 | version "5.1.8"
309 | resolved "https://registry.npm.taobao.org/ignore/download/ignore-5.1.8.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fignore%2Fdownload%2Fignore-5.1.8.tgz#f150a8b50a34289b33e22f5889abd4d8016f0e57"
310 | integrity sha1-8VCotQo0KJsz4i9YiavU2AFvDlc=
311 |
312 | import-fresh@^3.1.0:
313 | version "3.2.1"
314 | resolved "https://registry.npm.taobao.org/import-fresh/download/import-fresh-3.2.1.tgz#633ff618506e793af5ac91bf48b72677e15cbe66"
315 | integrity sha1-Yz/2GFBueTr1rJG/SLcmd+FcvmY=
316 | dependencies:
317 | parent-module "^1.0.0"
318 | resolve-from "^4.0.0"
319 |
320 | inflight@^1.0.4:
321 | version "1.0.6"
322 | resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9"
323 | integrity sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=
324 | dependencies:
325 | once "^1.3.0"
326 | wrappy "1"
327 |
328 | inherits@2:
329 | version "2.0.4"
330 | resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
331 | integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==
332 |
333 | interpret@^1.0.0:
334 | version "1.4.0"
335 | resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.4.0.tgz#665ab8bc4da27a774a40584e812e3e0fa45b1a1e"
336 | integrity sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==
337 |
338 | is-arrayish@^0.2.1:
339 | version "0.2.1"
340 | resolved "https://registry.npm.taobao.org/is-arrayish/download/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d"
341 | integrity sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=
342 |
343 | is-core-module@^2.8.0:
344 | version "2.8.1"
345 | resolved "https://registry.yarnpkg.com/is-core-module/-/is-core-module-2.8.1.tgz#f59fdfca701d5879d0a6b100a40aa1560ce27211"
346 | integrity sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==
347 | dependencies:
348 | has "^1.0.3"
349 |
350 | is-stream@^2.0.0:
351 | version "2.0.0"
352 | resolved "https://registry.npm.taobao.org/is-stream/download/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3"
353 | integrity sha1-venDJoDW+uBBKdasnZIc54FfeOM=
354 |
355 | isexe@^2.0.0:
356 | version "2.0.0"
357 | resolved "https://registry.npm.taobao.org/isexe/download/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
358 | integrity sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=
359 |
360 | js-tokens@^4.0.0:
361 | version "4.0.0"
362 | resolved "https://registry.npm.taobao.org/js-tokens/download/js-tokens-4.0.0.tgz?cache=0&sync_timestamp=1586796260005&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjs-tokens%2Fdownload%2Fjs-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499"
363 | integrity sha1-GSA/tZmR35jjoocFDUZHzerzJJk=
364 |
365 | json-parse-better-errors@^1.0.1:
366 | version "1.0.2"
367 | resolved "https://registry.npm.taobao.org/json-parse-better-errors/download/json-parse-better-errors-1.0.2.tgz#bb867cfb3450e69107c131d1c514bab3dc8bcaa9"
368 | integrity sha1-u4Z8+zRQ5pEHwTHRxRS6s9yLyqk=
369 |
370 | jsonfile@^4.0.0:
371 | version "4.0.0"
372 | resolved "https://registry.npm.taobao.org/jsonfile/download/jsonfile-4.0.0.tgz?cache=0&sync_timestamp=1583594052440&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fjsonfile%2Fdownload%2Fjsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb"
373 | integrity sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=
374 | optionalDependencies:
375 | graceful-fs "^4.1.6"
376 |
377 | lines-and-columns@^1.1.6:
378 | version "1.1.6"
379 | resolved "https://registry.npm.taobao.org/lines-and-columns/download/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00"
380 | integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA=
381 |
382 | locate-path@^5.0.0:
383 | version "5.0.0"
384 | resolved "https://registry.npm.taobao.org/locate-path/download/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0"
385 | integrity sha1-Gvujlq/WdqbUJQTQpno6frn2KqA=
386 | dependencies:
387 | p-locate "^4.1.0"
388 |
389 | lodash@^4.17.15:
390 | version "4.17.21"
391 | resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
392 | integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
393 |
394 | lru-cache@^6.0.0:
395 | version "6.0.0"
396 | resolved "https://registry.npmmirror.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
397 | integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
398 | dependencies:
399 | yallist "^4.0.0"
400 |
401 | lunr@^2.3.8:
402 | version "2.3.8"
403 | resolved "https://registry.npm.taobao.org/lunr/download/lunr-2.3.8.tgz#a8b89c31f30b5a044b97d2d28e2da191b6ba2072"
404 | integrity sha1-qLicMfMLWgRLl9LSji2hkba6IHI=
405 |
406 | marked@1.0.0:
407 | version "1.0.0"
408 | resolved "https://registry.npm.taobao.org/marked/download/marked-1.0.0.tgz#d35784245a04871e5988a491e28867362e941693"
409 | integrity sha1-01eEJFoEhx5ZiKSR4ohnNi6UFpM=
410 |
411 | merge-stream@^2.0.0:
412 | version "2.0.0"
413 | resolved "https://registry.npm.taobao.org/merge-stream/download/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
414 | integrity sha1-UoI2KaFN0AyXcPtq1H3GMQ8sH2A=
415 |
416 | mimic-fn@^2.1.0:
417 | version "2.1.0"
418 | resolved "https://registry.npm.taobao.org/mimic-fn/download/mimic-fn-2.1.0.tgz#7ed2c2ccccaf84d3ffcb7a69b57711fc2083401b"
419 | integrity sha1-ftLCzMyvhNP/y3pptXcR/CCDQBs=
420 |
421 | minimatch@^3.0.0, minimatch@^3.0.4:
422 | version "3.1.2"
423 | resolved "https://registry.npmmirror.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
424 | integrity sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==
425 | dependencies:
426 | brace-expansion "^1.1.7"
427 |
428 | minimist@^1.2.5:
429 | version "1.2.6"
430 | resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.6.tgz#8637a5b759ea0d6e98702cfb3a9283323c93af44"
431 | integrity sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==
432 |
433 | mri@^1.1.4:
434 | version "1.1.6"
435 | resolved "https://registry.npm.taobao.org/mri/download/mri-1.1.6.tgz#49952e1044db21dbf90f6cd92bc9c9a777d415a6"
436 | integrity sha1-SZUuEETbIdv5D2zZK8nJp3fUFaY=
437 |
438 | multimatch@^4.0.0:
439 | version "4.0.0"
440 | resolved "https://registry.npm.taobao.org/multimatch/download/multimatch-4.0.0.tgz#8c3c0f6e3e8449ada0af3dd29efb491a375191b3"
441 | integrity sha1-jDwPbj6ESa2grz3SnvtJGjdRkbM=
442 | dependencies:
443 | "@types/minimatch" "^3.0.3"
444 | array-differ "^3.0.0"
445 | array-union "^2.1.0"
446 | arrify "^2.0.1"
447 | minimatch "^3.0.4"
448 |
449 | neo-async@^2.6.0:
450 | version "2.6.2"
451 | resolved "https://registry.yarnpkg.com/neo-async/-/neo-async-2.6.2.tgz#b4aafb93e3aeb2d8174ca53cf163ab7d7308305f"
452 | integrity sha512-Yd3UES5mWCSqR+qNT93S3UoYUkqAZ9lLg8a7g9rimsWmYGK8cVToA4/sF3RrshdyV3sAGMXVUmpMYOw+dLpOuw==
453 |
454 | npm-run-path@^3.0.0:
455 | version "3.1.0"
456 | resolved "https://registry.npm.taobao.org/npm-run-path/download/npm-run-path-3.1.0.tgz#7f91be317f6a466efed3c9f2980ad8a4ee8b0fa5"
457 | integrity sha1-f5G+MX9qRm7+08nymArYpO6LD6U=
458 | dependencies:
459 | path-key "^3.0.0"
460 |
461 | once@^1.3.0, once@^1.3.1, once@^1.4.0:
462 | version "1.4.0"
463 | resolved "https://registry.npm.taobao.org/once/download/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
464 | integrity sha1-WDsap3WWHUsROsF9nFC6753Xa9E=
465 | dependencies:
466 | wrappy "1"
467 |
468 | onetime@^5.1.0:
469 | version "5.1.0"
470 | resolved "https://registry.npm.taobao.org/onetime/download/onetime-5.1.0.tgz#fff0f3c91617fe62bb50189636e99ac8a6df7be5"
471 | integrity sha1-//DzyRYX/mK7UBiWNumayKbfe+U=
472 | dependencies:
473 | mimic-fn "^2.1.0"
474 |
475 | opencollective-postinstall@^2.0.2:
476 | version "2.0.3"
477 | resolved "https://registry.npm.taobao.org/opencollective-postinstall/download/opencollective-postinstall-2.0.3.tgz#7a0fff978f6dbfa4d006238fbac98ed4198c3259"
478 | integrity sha1-eg//l49tv6TQBiOPusmO1BmMMlk=
479 |
480 | p-finally@^2.0.0:
481 | version "2.0.1"
482 | resolved "https://registry.npm.taobao.org/p-finally/download/p-finally-2.0.1.tgz#bd6fcaa9c559a096b680806f4d657b3f0f240561"
483 | integrity sha1-vW/KqcVZoJa2gIBvTWV7Pw8kBWE=
484 |
485 | p-limit@^2.2.0:
486 | version "2.3.0"
487 | resolved "https://registry.npm.taobao.org/p-limit/download/p-limit-2.3.0.tgz?cache=0&sync_timestamp=1594560064408&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fp-limit%2Fdownload%2Fp-limit-2.3.0.tgz#3dd33c647a214fdfffd835933eb086da0dc21db1"
488 | integrity sha1-PdM8ZHohT9//2DWTPrCG2g3CHbE=
489 | dependencies:
490 | p-try "^2.0.0"
491 |
492 | p-locate@^4.1.0:
493 | version "4.1.0"
494 | resolved "https://registry.npm.taobao.org/p-locate/download/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07"
495 | integrity sha1-o0KLtwiLOmApL2aRkni3wpetTwc=
496 | dependencies:
497 | p-limit "^2.2.0"
498 |
499 | p-try@^2.0.0:
500 | version "2.2.0"
501 | resolved "https://registry.npm.taobao.org/p-try/download/p-try-2.2.0.tgz#cb2868540e313d61de58fafbe35ce9004d5540e6"
502 | integrity sha1-yyhoVA4xPWHeWPr741zpAE1VQOY=
503 |
504 | parent-module@^1.0.0:
505 | version "1.0.1"
506 | resolved "https://registry.npm.taobao.org/parent-module/download/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2"
507 | integrity sha1-aR0nCeeMefrjoVZiJFLQB2LKqqI=
508 | dependencies:
509 | callsites "^3.0.0"
510 |
511 | parse-json@^5.0.0:
512 | version "5.0.0"
513 | resolved "https://registry.npm.taobao.org/parse-json/download/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f"
514 | integrity sha1-c+URTJhtFD76NxLU6iTbmkJm9g8=
515 | dependencies:
516 | "@babel/code-frame" "^7.0.0"
517 | error-ex "^1.3.1"
518 | json-parse-better-errors "^1.0.1"
519 | lines-and-columns "^1.1.6"
520 |
521 | path-exists@^4.0.0:
522 | version "4.0.0"
523 | resolved "https://registry.npm.taobao.org/path-exists/download/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3"
524 | integrity sha1-UTvb4tO5XXdi6METfvoZXGxhtbM=
525 |
526 | path-is-absolute@^1.0.0:
527 | version "1.0.1"
528 | resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f"
529 | integrity sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
530 |
531 | path-key@^3.0.0, path-key@^3.1.0:
532 | version "3.1.1"
533 | resolved "https://registry.npm.taobao.org/path-key/download/path-key-3.1.1.tgz#581f6ade658cbba65a0d3380de7753295054f375"
534 | integrity sha1-WB9q3mWMu6ZaDTOA3ndTKVBU83U=
535 |
536 | path-parse@^1.0.7:
537 | version "1.0.7"
538 | resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735"
539 | integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==
540 |
541 | path-type@^4.0.0:
542 | version "4.0.0"
543 | resolved "https://registry.npm.taobao.org/path-type/download/path-type-4.0.0.tgz#84ed01c0a7ba380afe09d90a8c180dcd9d03043b"
544 | integrity sha1-hO0BwKe6OAr+CdkKjBgNzZ0DBDs=
545 |
546 | pkg-dir@^4.2.0:
547 | version "4.2.0"
548 | resolved "https://registry.npm.taobao.org/pkg-dir/download/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3"
549 | integrity sha1-8JkTPfft5CLoHR2ESCcO6z5CYfM=
550 | dependencies:
551 | find-up "^4.0.0"
552 |
553 | please-upgrade-node@^3.2.0:
554 | version "3.2.0"
555 | resolved "https://registry.npm.taobao.org/please-upgrade-node/download/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942"
556 | integrity sha1-rt3T+ZTJM+StmLmdmlVu+g4v6UI=
557 | dependencies:
558 | semver-compare "^1.0.0"
559 |
560 | prettier@^2.0.5:
561 | version "2.0.5"
562 | resolved "https://registry.npm.taobao.org/prettier/download/prettier-2.0.5.tgz#d6d56282455243f2f92cc1716692c08aa31522d4"
563 | integrity sha1-1tVigkVSQ/L5LMFxZpLAiqMVItQ=
564 |
565 | pretty-quick@^2.0.1:
566 | version "2.0.1"
567 | resolved "https://registry.npm.taobao.org/pretty-quick/download/pretty-quick-2.0.1.tgz#417ee605ade98ecc686e72f63b5d28a2c35b43e9"
568 | integrity sha1-QX7mBa3pjsxobnL2O10oosNbQ+k=
569 | dependencies:
570 | chalk "^2.4.2"
571 | execa "^2.1.0"
572 | find-up "^4.1.0"
573 | ignore "^5.1.4"
574 | mri "^1.1.4"
575 | multimatch "^4.0.0"
576 |
577 | progress@^2.0.3:
578 | version "2.0.3"
579 | resolved "https://registry.npm.taobao.org/progress/download/progress-2.0.3.tgz#7e8cf8d8f5b8f239c1bc68beb4eb78567d572ef8"
580 | integrity sha1-foz42PW48jnBvGi+tOt4Vn1XLvg=
581 |
582 | pump@^3.0.0:
583 | version "3.0.0"
584 | resolved "https://registry.npm.taobao.org/pump/download/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
585 | integrity sha1-tKIRaBW94vTh6mAjVOjHVWUQemQ=
586 | dependencies:
587 | end-of-stream "^1.1.0"
588 | once "^1.3.1"
589 |
590 | rechoir@^0.6.2:
591 | version "0.6.2"
592 | resolved "https://registry.yarnpkg.com/rechoir/-/rechoir-0.6.2.tgz#85204b54dba82d5742e28c96756ef43af50e3384"
593 | integrity sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=
594 | dependencies:
595 | resolve "^1.1.6"
596 |
597 | resolve-from@^4.0.0:
598 | version "4.0.0"
599 | resolved "https://registry.npm.taobao.org/resolve-from/download/resolve-from-4.0.0.tgz#4abcd852ad32dd7baabfe9b40e00a36db5f392e6"
600 | integrity sha1-SrzYUq0y3Xuqv+m0DgCjbbXzkuY=
601 |
602 | resolve@^1.1.6:
603 | version "1.21.0"
604 | resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.21.0.tgz#b51adc97f3472e6a5cf4444d34bc9d6b9037591f"
605 | integrity sha512-3wCbTpk5WJlyE4mSOtDLhqQmGFi0/TD9VPwmiolnk8U0wRgMEktqCXd3vy5buTO3tljvalNvKrjHEfrd2WpEKA==
606 | dependencies:
607 | is-core-module "^2.8.0"
608 | path-parse "^1.0.7"
609 | supports-preserve-symlinks-flag "^1.0.0"
610 |
611 | semver-compare@^1.0.0:
612 | version "1.0.0"
613 | resolved "https://registry.npm.taobao.org/semver-compare/download/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc"
614 | integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w=
615 |
616 | semver-regex@^2.0.0:
617 | version "2.0.0"
618 | resolved "https://registry.npm.taobao.org/semver-regex/download/semver-regex-2.0.0.tgz#a93c2c5844539a770233379107b38c7b4ac9d338"
619 | integrity sha1-qTwsWERTmncCMzeRB7OMe0rJ0zg=
620 |
621 | semver@^7.3.2:
622 | version "7.5.3"
623 | resolved "https://registry.npmmirror.com/semver/-/semver-7.5.3.tgz#161ce8c2c6b4b3bdca6caadc9fa3317a4c4fe88e"
624 | integrity sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==
625 | dependencies:
626 | lru-cache "^6.0.0"
627 |
628 | shebang-command@^2.0.0:
629 | version "2.0.0"
630 | resolved "https://registry.npm.taobao.org/shebang-command/download/shebang-command-2.0.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fshebang-command%2Fdownload%2Fshebang-command-2.0.0.tgz#ccd0af4f8835fbdc265b82461aaf0c36663f34ea"
631 | integrity sha1-zNCvT4g1+9wmW4JGGq8MNmY/NOo=
632 | dependencies:
633 | shebang-regex "^3.0.0"
634 |
635 | shebang-regex@^3.0.0:
636 | version "3.0.0"
637 | resolved "https://registry.npm.taobao.org/shebang-regex/download/shebang-regex-3.0.0.tgz#ae16f1644d873ecad843b0307b143362d4c42172"
638 | integrity sha1-rhbxZE2HPsrYQ7AwexQzYtTEIXI=
639 |
640 | shelljs@^0.8.4:
641 | version "0.8.5"
642 | resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.8.5.tgz#de055408d8361bed66c669d2f000538ced8ee20c"
643 | integrity sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==
644 | dependencies:
645 | glob "^7.0.0"
646 | interpret "^1.0.0"
647 | rechoir "^0.6.2"
648 |
649 | signal-exit@^3.0.2:
650 | version "3.0.3"
651 | resolved "https://registry.npm.taobao.org/signal-exit/download/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c"
652 | integrity sha1-oUEMLt2PB3sItOJTyOrPyvBXRhw=
653 |
654 | slash@^3.0.0:
655 | version "3.0.0"
656 | resolved "https://registry.npm.taobao.org/slash/download/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634"
657 | integrity sha1-ZTm+hwwWWtvVJAIg2+Nh8bxNRjQ=
658 |
659 | source-map@^0.6.1:
660 | version "0.6.1"
661 | resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263"
662 | integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==
663 |
664 | strip-final-newline@^2.0.0:
665 | version "2.0.0"
666 | resolved "https://registry.npm.taobao.org/strip-final-newline/download/strip-final-newline-2.0.0.tgz#89b852fb2fcbe936f6f4b3187afb0a12c1ab58ad"
667 | integrity sha1-ibhS+y/L6Tb29LMYevsKEsGrWK0=
668 |
669 | supports-color@^5.3.0:
670 | version "5.5.0"
671 | resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-5.5.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-5.5.0.tgz#e2e69a44ac8772f78a1ec0b35b689df6530efc8f"
672 | integrity sha1-4uaaRKyHcveKHsCzW2id9lMO/I8=
673 | dependencies:
674 | has-flag "^3.0.0"
675 |
676 | supports-color@^7.1.0:
677 | version "7.1.0"
678 | resolved "https://registry.npm.taobao.org/supports-color/download/supports-color-7.1.0.tgz?cache=0&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fsupports-color%2Fdownload%2Fsupports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1"
679 | integrity sha1-aOMlkd9z4lrRxLSRCKLsUHliv9E=
680 | dependencies:
681 | has-flag "^4.0.0"
682 |
683 | supports-preserve-symlinks-flag@^1.0.0:
684 | version "1.0.0"
685 | resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
686 | integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
687 |
688 | typedoc-default-themes@^0.10.2:
689 | version "0.10.2"
690 | resolved "https://registry.npm.taobao.org/typedoc-default-themes/download/typedoc-default-themes-0.10.2.tgz#743380a80afe62c5ef92ca1bd4abe2ac596be4d2"
691 | integrity sha1-dDOAqAr+YsXvksob1KvirFlr5NI=
692 | dependencies:
693 | lunr "^2.3.8"
694 |
695 | typedoc-deno-theme@^1.3.3:
696 | version "1.3.3"
697 | resolved "https://registry.npm.taobao.org/typedoc-deno-theme/download/typedoc-deno-theme-1.3.3.tgz#5dcefd87abe7e518890ed9529c97087558289f2a"
698 | integrity sha1-Xc79h6vn5RiJDtlSnJcIdVgonyo=
699 |
700 | typedoc-plugin-deno@^1.3.2:
701 | version "1.3.2"
702 | resolved "https://registry.npm.taobao.org/typedoc-plugin-deno/download/typedoc-plugin-deno-1.3.2.tgz#a97676b7a61b910b030a29d354dac5e125bcb7a4"
703 | integrity sha1-qXZ2t6YbkQsDCinTVNrF4SW8t6Q=
704 | dependencies:
705 | lodash "^4.17.15"
706 | semver "^7.3.2"
707 |
708 | typedoc@^0.17.8:
709 | version "0.17.8"
710 | resolved "https://registry.npm.taobao.org/typedoc/download/typedoc-0.17.8.tgz#96b67e9454aa7853bfc4dc9a55c8a07adfd5478e"
711 | integrity sha1-lrZ+lFSqeFO/xNyaVciget/VR44=
712 | dependencies:
713 | fs-extra "^8.1.0"
714 | handlebars "^4.7.6"
715 | highlight.js "^10.0.0"
716 | lodash "^4.17.15"
717 | lunr "^2.3.8"
718 | marked "1.0.0"
719 | minimatch "^3.0.0"
720 | progress "^2.0.3"
721 | shelljs "^0.8.4"
722 | typedoc-default-themes "^0.10.2"
723 |
724 | typescript@^3.8.3:
725 | version "3.9.7"
726 | resolved "https://registry.npm.taobao.org/typescript/download/typescript-3.9.7.tgz?cache=0&sync_timestamp=1595056761535&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Ftypescript%2Fdownload%2Ftypescript-3.9.7.tgz#98d600a5ebdc38f40cb277522f12dc800e9e25fa"
727 | integrity sha1-mNYApevcOPQMsndSLxLcgA6eJfo=
728 |
729 | uglify-js@^3.1.4:
730 | version "3.13.5"
731 | resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.13.5.tgz#5d71d6dbba64cf441f32929b1efce7365bb4f113"
732 | integrity sha512-xtB8yEqIkn7zmOyS2zUNBsYCBRhDkvlNxMMY2smuJ/qA8NCHeQvKCF3i9Z4k8FJH4+PJvZRtMrPynfZ75+CSZw==
733 |
734 | universalify@^0.1.0:
735 | version "0.1.2"
736 | resolved "https://registry.npm.taobao.org/universalify/download/universalify-0.1.2.tgz?cache=0&sync_timestamp=1583531068954&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Funiversalify%2Fdownload%2Funiversalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
737 | integrity sha1-tkb2m+OULavOzJ1mOcgNwQXvqmY=
738 |
739 | which-pm-runs@^1.0.0:
740 | version "1.0.0"
741 | resolved "https://registry.npm.taobao.org/which-pm-runs/download/which-pm-runs-1.0.0.tgz#670b3afbc552e0b55df6b7780ca74615f23ad1cb"
742 | integrity sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=
743 |
744 | which@^2.0.1:
745 | version "2.0.2"
746 | resolved "https://registry.npm.taobao.org/which/download/which-2.0.2.tgz?cache=0&sync_timestamp=1574116092455&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Fwhich%2Fdownload%2Fwhich-2.0.2.tgz#7c6a8dd0a636a0327e10b59c9286eee93f3f51b1"
747 | integrity sha1-fGqN0KY2oDJ+ELWckobu6T8/UbE=
748 | dependencies:
749 | isexe "^2.0.0"
750 |
751 | wordwrap@^1.0.0:
752 | version "1.0.0"
753 | resolved "https://registry.yarnpkg.com/wordwrap/-/wordwrap-1.0.0.tgz#27584810891456a4171c8d0226441ade90cbcaeb"
754 | integrity sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=
755 |
756 | wrappy@1:
757 | version "1.0.2"
758 | resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f"
759 | integrity sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=
760 |
761 | yallist@^4.0.0:
762 | version "4.0.0"
763 | resolved "https://registry.npmmirror.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72"
764 | integrity sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
765 |
766 | yaml@^1.7.2:
767 | version "1.10.0"
768 | resolved "https://registry.npm.taobao.org/yaml/download/yaml-1.10.0.tgz#3b593add944876077d4d683fee01081bd9fff31e"
769 | integrity sha1-O1k63ZRIdgd9TWg/7gEIG9n/8x4=
770 |
--------------------------------------------------------------------------------