Skip to content

Commit e28215f

Browse files
author
bumkeyy
committed
translate file watcher
1 parent e3cd858 commit e28215f

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

โ€Ždocs/documentation/ko/release-notes/TypeScript 4.9.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -297,38 +297,38 @@ We believe that this change should strictly help catch beginner errors, similar
297297

298298
We'd like to extend our thanks to [Oleksandr Tarasiuk](https://github.com/a-tarasyuk) who [contributed this check](https://github.com/microsoft/TypeScript/pull/50626).
299299

300-
## File-Watching Now Uses File System Events
301-
302-
In earlier versions, TypeScript leaned heavily on *polling* for watching individual files.
303-
Using a polling strategy meant checking the state of a file periodically for updates.
304-
On Node.js, [`fs.watchFile`](https://nodejs.org/docs/latest-v18.x/api/fs.html#fswatchfilefilename-options-listener) is the built-in way to get a polling file-watcher.
305-
While polling tends to be more predictable across platforms and file systems, it means that your CPU has to periodically get interrupted and check for updates to the file, even when nothing's changed.
306-
For a few dozen files, this might not be noticeable;
307-
but on a bigger project with lots of files - or lots of files in `node_modules` - this can become a resource hog.
308-
309-
Generally speaking, a better approach is to use file system events.
310-
Instead of polling, we can announce that we're interested in updates of specific files and provide a callback for when those files *actually do* change.
311-
Most modern platforms in use provide facilities and APIs like `CreateIoCompletionPort`, `kqueue`, `epoll`, and `inotify`.
312-
Node.js mostly abstracts these away by providing [`fs.watch`](https://nodejs.org/docs/latest-v18.x/api/fs.html#fswatchfilename-options-listener).
313-
File system events usually work great, but there are [lots of caveats](https://nodejs.org/docs/latest-v18.x/api/fs.html#caveats) to using them, and in turn, to using the `fs.watch` API.
314-
A watcher needs to be careful to consider [inode watching](https://nodejs.org/docs/latest-v18.x/api/fs.html#inodes), [unavailability on certain file systems](https://nodejs.org/docs/latest-v18.x/api/fs.html#availability) (e.g.networked file systems), whether recursive file watching is available, whether directory renames trigger events, and even file watcher exhaustion!
315-
In other words, it's not quite a free lunch, especially if you're looking for something cross-platform.
316-
317-
As a result, our default was to pick the lowest common denominator: polling.
318-
Not always, but most of the time.
319-
320-
Over time, we've provided the means to [choose other file-watching strategies](https://www.typescriptlang.org/docs/handbook/configuring-watch.html).
321-
This allowed us to get feedback and harden our file-watching implementation against most of these platform-specific gotchas.
322-
As TypeScript has needed to scale to larger codebases, and has improved in this area, we felt swapping to file system events as the default would be a worthwhile investment.
323-
324-
In TypeScript 4.9, file watching is powered by file system events by default, only falling back to polling if we fail to set up event-based watchers.
325-
For most developers, this should provide a much less resource-intensive experience when running in `--watch` mode, or running with a TypeScript-powered editor like Visual Studio or VS Code.
326-
327-
[The way file-watching works can still be configured](https://www.typescriptlang.org/docs/handbook/configuring-watch.html) through environment variables and `watchOptions` - and [some editors like VS Code can support `watchOptions` independently](https://code.visualstudio.com/docs/getstarted/settings#:~:text=typescript%2etsserver%2ewatchOptions).
328-
Developers using more exotic set-ups where source code resides on a networked file systems (like NFS and SMB) may need to opt back into the older behavior; though if a server has reasonable processing power, it might just be better to enable SSH and run TypeScript remotely so that it has direct local file access.
329-
VS Code has plenty of [remote extensions](https://marketplace.visualstudio.com/search?term=remote&target=VSCode&category=All%20categories&sortBy=Relevance) to make this easier.
330-
331-
You can [read up more on this change on GitHub](https://github.com/microsoft/TypeScript/pull/50366).
300+
## ํŒŒ์ผ ์‹œ์Šคํ…œ ์ด๋ฒคํŠธ๋ฅผ ์‚ฌ์šฉํ•œ ํŒŒ์ผ ๊ฐ์‹œ
301+
302+
์ด์ „ ๋ฒ„์ „์—์„œ TypeScript๋Š” ๊ฐœ๋ณ„ ํŒŒ์ผ์„ ๊ฐ์‹œํ•˜๊ธฐ ์œ„ํ•ด *ํด๋ง*์— ํฌ๊ฒŒ ์˜์กดํ–ˆ์Šต๋‹ˆ๋‹ค.
303+
ํด๋ง ์ „๋žต์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์€ ์—…๋ฐ์ดํŠธ๋ฅผ ์œ„ํ•ด ์ฃผ๊ธฐ์ ์œผ๋กœ ํŒŒ์ผ ์ƒํƒœ๋ฅผ ๊ฐ์‹œํ•จ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.
304+
Node.js์—์„œ [`fs.watchFile`](https://nodejs.org/docs/latest-v18.x/api/fs.html#fswatchfilefilename-options-listener)์€ ํด๋ง ํŒŒ์ผ ๊ฐ์‹œ์ž๋ฅผ ๊ฐ€์ ธ์˜ค๋Š” ๊ธฐ๋ณธ ์ œ๊ณต ๋ฐฉ๋ฒ•์ž…๋‹ˆ๋‹ค.
305+
ํด๋ง์€ ํ”Œ๋žซํผ๊ณผ ํŒŒ์ผ ์‹œ์Šคํ…œ์—์„œ ๋ณด๋‹ค ์˜ˆ์ธก ๊ฐ€๋Šฅํ•œ ๊ฒฝํ–ฅ์ด ์žˆ์ง€๋งŒ CPU๊ฐ€ ์ฃผ๊ธฐ์ ์œผ๋กœ ์ค‘๋‹จ๋˜์–ด ๋ณ€๊ฒฝ๋œ ์‚ฌํ•ญ์ด ์—†์„ ๋•Œ์—๋„ ํŒŒ์ผ ์—…๋ฐ์ดํŠธ๋ฅผ ํ™•์ธํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
306+
ํŒŒ์ผ์ด ์ˆ˜์‹ญ ๊ฐœ๋ผ๋ฉด ํฐ ์ฐจ์ด๊ฐ€ ์—†์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
307+
ํ•˜์ง€๋งŒ ํŒŒ์ผ์ด ๋งŽ๊ณ  ๋” ํฐ ํ”„๋กœ์ ํŠธ์—์„œ ๋˜๋Š” `node_modules`์— ๋งŽ์€ ํŒŒ์ผ์ด ์žˆ๋Š” ๊ฒฝ์šฐ, ํด๋ง์€ ์ž์›์„ ๋งŽ์ด ์ฐจ์ง€ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
308+
309+
์ผ๋ฐ˜์ ์œผ๋กœ ๋” ์ข‹์€ ์ ‘๊ทผ ๋ฐฉ์‹์€ ํŒŒ์ผ ์‹œ์Šคํ…œ ์ด๋ฒคํŠธ๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๊ฒƒ์ž…๋‹ˆ๋‹ค.
310+
ํด๋งํ•˜๋Š” ๋Œ€์‹  ํŠน์ • ํŒŒ์ผ์˜ ์—…๋ฐ์ดํŠธ์— ๊ด€์‹ฌ์ด ์žˆ์Œ์„ ์•Œ๋ฆฌ๊ณ  ํ•ด๋‹น ํŒŒ์ผ์ด *์‹ค์ œ๋กœ* ๋ณ€๊ฒฝ๋  ๋•Œ ์ฝœ๋ฐฑ์„ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
311+
๋Œ€๋ถ€๋ถ„์˜ ์ตœ์‹  ํ”Œ๋žซํผ์€ `CreateIoCompletionPort`, `kqueue`, `epoll` ๋ฐ `inotify`์™€ ๊ฐ™์€ ๊ธฐ๋Šฅ๊ณผ API๋ฅผ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.
312+
Node.js๋Š” ๋Œ€๋ถ€๋ถ„ [`fs.watch`](https://nodejs.org/docs/latest-v18.x/api/fs.html#fswatchfilename-options-listener)๋ฅผ ์ œ๊ณตํ•˜์—ฌ ์ด๋ฅผ ์ถ”์ƒํ™”ํ•ฉ๋‹ˆ๋‹ค.
313+
ํŒŒ์ผ ์‹œ์Šคํ…œ ์ด๋ฒคํŠธ๋Š” ์ผ๋ฐ˜์ ์œผ๋กœ ์ž˜ ๋™์ž‘ํ•˜์ง€๋งŒ ์ด๋ฅผ ์‚ฌ์šฉํ•˜๊ณ  `fs.watch` API๋ฅผ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ [๋งŽ์€ ์ฃผ์˜ ์‚ฌํ•ญ](https://nodejs.org/docs/latest-v18.x/api/fs.html#caveats)์ด ์žˆ์Šต๋‹ˆ๋‹ค.
314+
๊ฐ์‹œ์ž๋Š” [inode ๊ฐ์‹œ](https://nodejs.org/docs/latest-v18.x/api/fs.html#inodes),[ํŠน์ • ํŒŒ์ผ ์‹œ์Šคํ…œ์—์„œ ๋น„๊ฐ€์šฉ์„ฑ](https://nodejs.org/docs/latest-v18.x/api/fs.html#availability) (์˜ˆ๋ฅผ ๋“ค๋ฉด ๋„คํŠธ์›Œํฌ ํŒŒ์ผ ์‹œ์Šคํ…œ), ์žฌ๊ท€ ํŒŒ์ผ ๊ฐ์‹œ๊ฐ€ ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ์ง€ ์—ฌ๋ถ€, ๋””๋ ‰ํ„ฐ๋ฆฌ ์ด๋ฆ„ ๋ณ€๊ฒฝ์ด ์ด๋ฒคํŠธ๋ฅผ ํŠธ๋ฆฌ๊ฑฐํ•˜๋Š”์ง€ ์—ฌ๋ถ€, ํŒŒ์ผ ๊ฐ์‹œ์ž ๊ณ ๊ฐˆ๊นŒ์ง€ ๊ณ ๋ คํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค!
315+
ํŠนํžˆ ํฌ๋กœ์Šค ํ”Œ๋žซํผ์„ ์ฐพ๊ณ  ์žˆ๋‹ค๋ฉด ์‰ฝ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
316+
317+
๊ฒฐ๊ณผ์ ์œผ๋กœ ์šฐ๋ฆฌ๋Š” ๊ธฐ๋ณธ ๊ฐ’์œผ๋กœ ํด๋ง์ด๋ผ๋Š” ๊ฐ€์žฅ ๋‚ฎ์€ ๊ณตํ†ต๋ถ„๋ชจ๋ฅผ ์„ ํƒํ•˜๋Š” ๊ฒƒ์ด์—ˆ์Šต๋‹ˆ๋‹ค.
318+
ํ•ญ์ƒ ๊ทธ๋Ÿฐ ๊ฒƒ์€ ์•„๋‹ˆ์ง€๋งŒ ๋Œ€๋ถ€๋ถ„์˜ ๊ฒฝ์šฐ์— ํ•ด๋‹นํ–ˆ์Šต๋‹ˆ๋‹ค.
319+
320+
์‹œ๊ฐ„์ด ์ง€๋‚จ์— ๋”ฐ๋ผ ์šฐ๋ฆฌ๋Š” [๋‹ค๋ฅธ ํŒŒ์ผ ๊ฐ์‹œ ์ „๋žต์„ ์„ ํƒ](https://www.typescriptlang.org/docs/handbook/configuring-watch.html)ํ•  ์ˆ˜ ์žˆ๋Š” ์ˆ˜๋‹จ์„ ์ œ๊ณตํ–ˆ์Šต๋‹ˆ๋‹ค.
321+
์ด๋ฅผ ํ†ตํ•ด ํ”ผ๋“œ๋ฐฑ์„ ๋ฐ›๊ณ  ๋Œ€๋ถ€๋ถ„ ํ”Œ๋žซํผ ๋ฌธ์ œ๋“ค์— ๋Œ€ํ•ด ํŒŒ์ผ ๊ฐ์‹œ ๊ตฌํ˜„์„ ๊ฐ•ํ™”ํ•  ์ˆ˜ ์žˆ์—ˆ์Šต๋‹ˆ๋‹ค.
322+
TypeScript๊ฐ€ ๋” ํฐ ์ฝ”๋“œ๋ฒ ์ด์Šค๋กœ ํ™•์žฅ๋˜์–ด์•ผ ํ•˜๊ณ  ์ด ์˜์—ญ์—์„œ ๊ฐœ์„ ๋˜์—ˆ์œผ๋ฏ€๋กœ ํŒŒ์ผ ์‹œ์Šคํ…œ ์ด๋ฒคํŠธ๋ฅผ ๊ธฐ๋ณธ๊ฐ’์œผ๋กœ ๋ฐ”๊พธ๋Š” ๊ฒƒ์ด ๊ฐ€์น˜ ์žˆ๋Š” ํˆฌ์ž๋ผ๊ณ  ์ƒ๊ฐํ–ˆ์Šต๋‹ˆ๋‹ค.
323+
324+
TypeScript 4.9์—์„œ ํŒŒ์ผ ๊ฐ์‹œ๋Š” ๊ธฐ๋ณธ์ ์œผ๋กœ ํŒŒ์ผ ์‹œ์Šคํ…œ ์ด๋ฒคํŠธ์— ์˜ํ•ด ๊ตฌ๋™๋˜๋ฉฐ ์ด๋ฒคํŠธ ๊ธฐ๋ฐ˜ ๊ฐ์‹œ์ž๋ฅผ ์„ค์ •ํ•˜์ง€ ๋ชปํ•œ ๊ฒฝ์šฐ์—๋งŒ ํด๋ง์œผ๋กœ ๋Œ์•„๊ฐ‘๋‹ˆ๋‹ค.
325+
๋Œ€๋ถ€๋ถ„์˜ ๊ฐœ๋ฐœ์ž์—๊ฒŒ `--watch` ๋ชจ๋“œ์—์„œ ์‹คํ–‰ํ•˜๊ฑฐ๋‚˜ Visual Studio ๋˜๋Š” VS Code์™€ ๊ฐ™์€ TypeScript ๊ธฐ๋ฐ˜ ํŽธ์ง‘๊ธฐ๋กœ ์‹คํ–‰ํ•  ๋•Œ ํ›จ์”ฌ ๋œ ๋ฆฌ์†Œ์Šค ์ง‘์•ฝ์ ์ธ ํ™˜๊ฒฝ์„ ์ œ๊ณตํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.
326+
327+
[ํŒŒ์ผ ๊ฐ์‹œ๊ฐ€ ์ž‘๋™ํ•˜๋Š” ๋ฐฉ์‹์€ ์—ฌ์ „ํžˆ โ€‹โ€‹ํ™˜๊ฒฝ ๋ณ€์ˆ˜ ๋ฐ `watchOptions`๋ฅผ ํ†ตํ•ด ๊ตฌ์„ฑ](https://www.typescriptlang.org/docs/handbook/configuring-watch.html)ํ•  ์ˆ˜ ์žˆ์œผ๋ฉฐ [VS Code์™€ ๊ฐ™์€ ์ผ๋ถ€ ํŽธ์ง‘๊ธฐ๋Š” `watchOptions`๋ฅผ ๋…๋ฆฝ์ ์œผ๋กœ ์ง€์›ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.](https://code.visualstudio.com/docs/getstarted/settings#:~:text=typescript%2etsserver%2ewatchOptions)
328+
NFS ๋ฐ SMB์™€ ๊ฐ™์€ ๋„คํŠธ์›Œํฌ ํŒŒ์ผ ์‹œ์Šคํ…œ์— ์†Œ์Šค ์ฝ”๋“œ๊ฐ€ ์ƒ์ฃผํ•˜๋Š” ์ข€ ๋” ํŠน์ดํ•œ ์„ค์ •์„ ์‚ฌ์šฉํ•˜๋Š” ๊ฐœ๋ฐœ์ž๋Š” ์ด์ „ ๋™์ž‘์„ ๋‹ค์‹œ ์„ ํƒํ•ด์•ผ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์„œ๋ฒ„์— ์ ์ ˆํ•œ ์ฒ˜๋ฆฌ ๋Šฅ๋ ฅ์ด ์žˆ๋Š” ๊ฒฝ์šฐ SSH๋ฅผ ํ™œ์„ฑํ™”ํ•˜๊ณ  TypeScript๋ฅผ ์›๊ฒฉ์œผ๋กœ ์‹คํ–‰ํ•˜์—ฌ ์ง์ ‘ ๋กœ์ปฌ ํŒŒ์ผ์— ์•ก์„ธ์Šคํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•˜๋Š” ๊ฒƒ์ด ๋” ๋‚˜์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
329+
VS Code์—๋Š” ์ด ์ž‘์—…์„ ๋” ์‰ฝ๊ฒŒ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ๋Š” [์›๊ฒฉ ์ต์Šคํ…์…˜](https://marketplace.visualstudio.com/search?term=remote&target=VSCode&category=All%20categories&sortBy=Relevance)์ด ๋งŽ์ด ์žˆ์Šต๋‹ˆ๋‹ค.
330+
331+
GitHub์—์„œ [์ด ๋ณ€๊ฒฝ ์‚ฌํ•ญ์— ๋Œ€ํ•ด ์ž์„ธํžˆ](https://github.com/microsoft/TypeScript/pull/50366) ์•Œ์•„๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
332332

333333
## "Remove Unused Imports" and "Sort Imports" Commands for Editors
334334

0 commit comments

Comments
ย (0)