Skip to content

Commit 06e9d2d

Browse files
authored
translate configuring-watch page typescript-kr#96 (typescript-kr#165)
* ν™˜κ²½ λ³€μˆ˜ `TSC_WATCHFILE`을 μ‚¬μš©ν•˜μ—¬ 파일 κ°μ‹œ μ„€μ • ν‘œ λ²ˆμ—­ μ™„λ£Œ * configuring-watch νŽ˜μ΄μ§€ μ™„λ£Œ * pull request μ œμ•ˆμ‚¬ν•­ 반영
1 parent 70c7728 commit 06e9d2d

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

β€Žpages/configuring-watch.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
1-
Compiler supports configuring how to watch files and directories using the environment variables.
1+
μ»΄νŒŒμΌλŸ¬λŠ” ν™˜κ²½ λ³€μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ 파일과 디렉터리λ₯Ό κ°μ‹œν•˜λŠ” 방법 ꡬ성을 μ§€μ›ν•©λ‹ˆλ‹€.
22

3-
## Configuring file watching using environment variable `TSC_WATCHFILE`
3+
## ν™˜κ²½ λ³€μˆ˜ `TSC_WATCHFILE`을 μ‚¬μš©ν•˜μ—¬ 파일 κ°μ‹œ μ„€μ • (Configuring file watching using environment variable `TSC_WATCHFILE`)
44

5-
Option | Description
5+
μ˜΅μ…˜ | μ„€λͺ…
66
-----------------------------------------------|----------------------------------------------------------------------
7-
`PriorityPollingInterval` | Use `fs.watchFile` but use different polling intervals for source files, config files and missing files
8-
`DynamicPriorityPolling` | Use a dynamic queue where in the frequently modified files will be polled at shorter interval and the files unchanged will be polled less frequently
9-
`UseFsEvents` | Use `fs.watch` which uses file system events (but might not be accurate on different OS) to get the notifications for the file changes/creation/deletion. Note that few OS eg. linux has limit on number of watches and failing to create watcher using `fs.watch` will result it in creating using `fs.watchFile`
10-
`UseFsEventsWithFallbackDynamicPolling` | This option is similar to `UseFsEvents` except on failing to create watch using `fs.watch`, the fallback watching happens through dynamic polling queues (as explained in `DynamicPriorityPolling`)
11-
`UseFsEventsOnParentDirectory` | This option watches parent directory of the file with `fs.watch` (using file system events) thus being low on CPU but can compromise accuracy.
12-
default (no value specified) | If environment variable `TSC_NONPOLLING_WATCHER` is set to true, watches parent directory of files (just like `UseFsEventsOnParentDirectory`). Otherwise watch files using `fs.watchFile` with `250ms` as the timeout for any file
7+
`PriorityPollingInterval` | `fs.watchFile`을 μ‚¬μš©ν•˜μ§€λ§Œ μ†ŒμŠ€ 파일, μ„€μ • 파일 및 λˆ„λ½λœ νŒŒμΌμ— λŒ€ν•΄ λ‹€λ₯Έ 폴링 μ£ΌκΈ°(polling intervals)λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.
8+
`DynamicPriorityPolling` | 자주 μˆ˜μ •λ˜λŠ” νŒŒμΌμ„ 자주 ν΄λ§ν•˜κ³  λ³€κ²½λ˜μ§€ μ•Šμ€ νŒŒμΌμ„ 덜 자주 폴링 ν•˜λŠ” 동적 큐λ₯Ό μ‚¬μš©ν•©λ‹ˆλ‹€.
9+
`UseFsEvents` | 파일 μ‹œμŠ€ν…œ 이벀트λ₯Ό μ‚¬μš©ν•˜λŠ” `fs.watch`λ₯Ό μ‚¬μš©ν•˜μ—¬ 파일 λ³€κ²½/생성/μ‚­μ œμ— λŒ€ν•œ μ•Œλ¦Όμ„ λ°›μŠ΅λ‹ˆλ‹€. (`fs.watch`λŠ” OSλ§ˆλ‹€ λ‹€λ₯΄κ²Œ μž‘λ™ν•  수 μžˆμŠ΅λ‹ˆλ‹€.) 예λ₯Ό λ“€μ–΄. λ¦¬λˆ…μŠ€λŠ” watcher μˆ˜μ— μ œν•œμ΄ 있으며 `fs.watch`λ₯Ό μ‚¬μš©ν•˜μ—¬ watcherλ₯Ό λ§Œλ“€μ§€ λͺ»ν•˜λ©΄, `fs.watchFile`λ₯Ό λŒ€μ‹  μ‚¬μš©ν•˜μ—¬ watcherλ₯Ό λ§Œλ“€κ²Œ λ©λ‹ˆλ‹€.
10+
`UseFsEventsWithFallbackDynamicPolling` | 이 μ˜΅μ…˜μ€ `fs.watch`λ₯Ό μ‚¬μš©ν•˜μ—¬ κ°μ‹œμžλ₯Ό λ§Œλ“€μ§€ λͺ»ν•œ 경우 폴링이 동적 큐λ₯Ό 톡해 μˆ˜ν–‰λœλ‹€λŠ” 것을 μ œμ™Έν•˜κ³ λŠ” `UseFsEvents` μ˜΅μ…˜κ³Ό λΉ„μŠ·ν•©λ‹ˆλ‹€.(동적 큐에 λŒ€ν•œ 것은 `DynamicPriorityPolling`μ˜΅μ…˜μ—μ„œ μ„€λͺ…ν•˜μ˜€μŠ΅λ‹ˆλ‹€.).
11+
`UseFsEventsOnParentDirectory` | 이 μ˜΅μ…˜μ€ `fs.watch`(파일 μ‹œμŠ€ν…œ 이벀트 μ‚¬μš©ν•˜λŠ”)둜 파일의 μƒμœ„ 디렉터리λ₯Ό κ°μ‹œν•©λ‹ˆλ‹€. λ‹€λ§Œ, CPU μ‚¬μš©λŸ‰μ΄ λŠ˜μ–΄λ‚˜κ³  μ •ν™•λ„λŠ” λ–¨μ–΄μ§ˆ 수 μžˆμŠ΅λ‹ˆλ‹€.
12+
default (no value specified) | ν™˜κ²½ λ³€μˆ˜`TSC_NONPOLLING_WATCHER`κ°€ true둜 μ„€μ •λ˜λ©΄ 파일의 μƒμœ„ 디렉터리λ₯Ό κ°μ‹œν•©λ‹ˆλ‹€. (`UseFsEventsOnParentDirectory`와 동일).false 일 λ•ŒλŠ” `fs.watchFile`을 μ‚¬μš©ν•˜μ—¬ `250ms` μ‹œκ°„ μ œν•œκ³Ό ν•¨κ»˜ λͺ¨λ“  νŒŒμΌλ“€μ„ κ°μ‹œν•©λ‹ˆλ‹€.
1313

14-
## Configuring directory watching using environment variable `TSC_WATCHDIRECTORY`
14+
## ν™˜κ²½ λ³€μˆ˜`TSC_WATCHDIRECTORY`λ₯Ό μ‚¬μš©ν•˜μ—¬ 디렉터리 κ°μ‹œ μ„€μ • (Configuring directory watching using environment variable `TSC_WATCHDIRECTORY`)
1515

16-
The watching of directory on platforms that don't support recursive directory watching natively in node, is supported through recursively creating directory watcher for the child directories using different options selected by `TSC_WATCHDIRECTORY`. Note that on platforms that support native recursive directory watching (e.g windows) the value of this environment variable is ignored.
16+
기본적으둜 nodeμ—μ„œ λ””λ ‰ν„°λ¦¬μ˜ μž¬κ·€μ μΈ κ°μ‹œλ₯Ό μ§€μ›ν•˜μ§€ μ•ŠλŠ” ν”Œλž«νΌμ—μ„œ, 디렉터리 κ°μ‹œ κΈ°λŠ₯은 `TSC_WATCHDIRECTORY`μ—μ„œ μ„ νƒν•œ λ‹€μ–‘ν•œ μ˜΅μ…˜μ„ μ‚¬μš©ν•˜μ—¬ ν•˜μœ„ 디렉터리에 λŒ€ν•œ 디렉터리 watcherλ₯Ό μž¬κ·€μ μœΌλ‘œ μƒμ„±ν•¨μœΌλ‘œμ¨ μ§€μ›λ©λ‹ˆλ‹€. 기본적으둜 μž¬κ·€ 디렉터리 κ°μ‹œ(예: windows)λ₯Ό μ§€μ›ν•˜λŠ” ν”Œλž«νΌμ—μ„œλŠ” 이 ν™˜κ²½ λ³€μˆ˜μ˜ 값이 λ¬΄μ‹œλ©λ‹ˆλ‹€.
1717

18-
Option | Description
18+
μ˜΅μ…˜ | μ„€λͺ…
1919
-----------------------------------------------|----------------------------------------------------------------------
20-
`RecursiveDirectoryUsingFsWatchFile` | Use `fs.watchFile` to watch the directories and child directories which is a polling watch (consuming CPU cycles)
21-
`RecursiveDirectoryUsingDynamicPriorityPolling`| Use dynamic polling queue to poll changes to the directory and child directories.
22-
default (no value specified) | Use `fs.watch` to watch directories and child directories
20+
`RecursiveDirectoryUsingFsWatchFile` | `fs.watchFile`을 μ‚¬μš©ν•˜μ—¬ 폴링 κ°μ‹œ(CPU cycles μ‚¬μš©)인 디렉터리 및 ν•˜μœ„ 디렉터리λ₯Ό κ°μ‹œν•©λ‹ˆλ‹€.
21+
`RecursiveDirectoryUsingDynamicPriorityPolling`| 동적 폴링 큐λ₯Ό μ‚¬μš©ν•˜μ—¬ 디렉터리 및 ν•˜μœ„ 디렉터리에 λŒ€ν•œ 변경사항을 폴링 ν•©λ‹ˆλ‹€.
22+
default (no value specified) | `fs.watch`λ₯Ό μ‚¬μš©ν•˜μ—¬ 디렉터리 및 ν•˜μœ„ 디렉터리λ₯Ό κ°μ‹œν•©λ‹ˆλ‹€.
2323

24-
## Background
24+
## λ°°κ²½ (Background)
2525

26-
`--watch` implementation of the compiler relies on `fs.watch` and `fs.watchFile` provided by node, both of these methods have pros and cons.
26+
컴파일러의 `--watch` κ΅¬ν˜„μ€ nodeμ—μ„œ μ œκ³΅ν•˜λŠ” `fs.watch`와 `fs.watchFile`에 μ˜μ‘΄ν•˜λ©°, 이 두 방법 λͺ¨λ‘ μž₯단점이 μžˆμŠ΅λ‹ˆλ‹€.
2727

28-
`fs.watch` uses file system events to notify the changes in the file/directory. But this is OS dependent and the notification is not completely reliable and does not work as expected on many OS. Also there could be limit on number of watches that can be created, eg. linux and we could exhaust it pretty quickly with programs that include large number of files. But because this uses file system events, there is not much CPU cycle involved. Compiler typically uses `fs.watch` to watch directories (eg. source directories included by config file, directories in which module resolution failed etc) These can handle the missing precision in notifying about the changes. But recursive watching is supported on only Windows and OSX. That means we need something to replace the recursive nature on other OS.
28+
`fs.watch`λŠ” 파일 μ‹œμŠ€ν…œ 이벀트λ₯Ό μ‚¬μš©ν•˜μ—¬ 파일/λ””λ ‰ν„°λ¦¬μ˜ λ³€κ²½ 사항을 μ•Œλ¦½λ‹ˆλ‹€. ν•˜μ§€λ§Œ OS에 따라 λ‹€λ₯΄λ©°, μ•Œλ¦Όμ€ μ™„μ „νžˆ 믿을 μˆ˜κ°€ μ—†κ³ , λ§Žμ€ OSμ—μ„œ μ˜ˆμƒλŒ€λ‘œ λ™μž‘ν•˜μ§€ μ•ŠμŠ΅λ‹ˆλ‹€. λ˜ν•œ, 생성할 수 μžˆλŠ” watcher의 μˆ˜μ— μ œν•œμ΄ μžˆμ„ 수 있으며(예: linux), 파일 μˆ˜κ°€ λ§Žμ€ ν”„λ‘œκ·Έλž¨μ„ μ‚¬μš©ν•˜λ©΄ 맀우 λΉ λ₯΄κ²Œ μ†Œμ§„ν•  수 μžˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ 이 μž‘μ—…μ€ 파일 μ‹œμŠ€ν…œ 이벀트λ₯Ό μ‚¬μš©ν•˜κΈ° λ•Œλ¬Έμ— CPU cycle에 많이 κ΄€μ—¬ν•˜μ§„ μ•ŠμŠ΅λ‹ˆλ‹€. μ»΄νŒŒμΌλŸ¬λŠ” 일반적으둜 `fs.watch`λ₯Ό μ‚¬μš©ν•˜μ—¬ 디렉터리λ₯Ό κ°μ‹œν•©λ‹ˆλ‹€. (예: μ„€μ • νŒŒμΌμ— ν¬ν•¨λœ μ†ŒμŠ€ 디렉터리, λͺ¨λ“ˆ 확인을 μ‹€νŒ¨ν•œ 디렉터리 ... λ“±) λ³€κ²½ 사항에 λŒ€ν•œ μ•Œλ¦Όμ—μ„œ λˆ„λ½λœ 정밀도λ₯Ό μ²˜λ¦¬ν•  수 μžˆμŠ΅λ‹ˆλ‹€. κ·ΈλŸ¬λ‚˜ μž¬κ·€ κ°μ‹œ κΈ°λŠ₯은 Windows와 OSXμ—μ„œλ§Œ μ§€μ›λ©λ‹ˆλ‹€. 즉, λ‹€λ₯Έ OS듀은 μž¬κ·€μ  νŠΉμ„±μ„ λŒ€μ²΄ν•  무언가가 ν•„μš”ν•©λ‹ˆλ‹€.
2929

30-
`fs.watchFile` uses polling and thus involves CPU cycles. But this is the most reliable mechanism to get the update on the status of file/directory. Compiler typically uses `fs.watchFile` to watch source files, config files and missing files (missing file references) that means the CPU usage depends on number of files in the program.
30+
`fs.watchFile`은 폴링을 μ‚¬μš©ν•˜λ―€λ‘œ CPU μ£ΌκΈ°λ₯Ό ν¬ν•¨ν•©λ‹ˆλ‹€. ν•˜μ§€λ§Œ μ΄λŠ” 파일/디렉터리 μƒνƒœμ— λŒ€ν•œ μ—…λ°μ΄νŠΈλ₯Ό 받을 수 μžˆλŠ” κ°€μž₯ μ‹ λ’°ν•  수 μžˆλŠ” λ©”μ»€λ‹ˆμ¦˜μž…λ‹ˆλ‹€. μ»΄νŒŒμΌλŸ¬λŠ” 일반적으둜 `fs.watchFile`을 μ‚¬μš©ν•˜μ—¬ μ†ŒμŠ€ 파일, ꡬ성 파일 및 λˆ„λ½λœ 파일(λˆ„λ½λœ 파일 μ°Έμ‘°)을 κ°μ‹œν•˜λŠ”λ° μ΄λŠ” CPU μ‚¬μš©λŸ‰μ΄ ν”„λ‘œκ·Έλž¨μ˜ 파일 μˆ˜μ— 따라 λ‹¬λΌμ§„λ‹€λŠ” 것을 μ˜λ―Έν•©λ‹ˆλ‹€.

0 commit comments

Comments
Β (0)