Skip to content

Commit

Permalink
update: typescript compile
Browse files Browse the repository at this point in the history
  • Loading branch information
currenjin committed Dec 15, 2023
1 parent 50dabc9 commit 59a0ed9
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions _wiki/typescript-compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ const emitResult = emitFiles(
λ§ˆμ§€λ§‰μœΌλ‘œ emitFiles μ†μœΌλ‘œ λΉ¨λ €λ“€μ–΄κ°€ μ–΄λ–€ λ™μž‘μ΄ μˆ˜ν–‰λ˜λŠ”μ§€ ν™•μΈν•΄λ³΄μž.
(to `src/compiler/emitter`)
(to `src/compiler/emitter.ts`)
### emitter
Expand All @@ -203,4 +203,26 @@ return {
};
```
forEachEmittedFile ν•¨μˆ˜λ₯Ό ν˜ΈμΆœν•΄ νƒ€κ²Ÿ νŒŒμΌλ“€μ„ λͺ¨λ‘ μˆœνšŒν•˜λ©° emit을 μ§„ν–‰ν•œλ‹€. 결과적으둜 diagnostics, emittedFiles, sourceMaps 등을 λ°˜ν™˜ν•˜λŠ” 것을 확인할 수 μžˆλ‹€.
forEachEmittedFile ν•¨μˆ˜λ₯Ό ν˜ΈμΆœν•΄ νƒ€κ²Ÿ νŒŒμΌλ“€μ„ λͺ¨λ‘ μˆœνšŒν•˜λ©° emit을 μ§„ν–‰ν•œλ‹€. 결과적으둜 diagnostics, emittedFiles, sourceMaps 등을 λ°˜ν™˜ν•˜λŠ” 것을 확인할 수 μžˆλ‹€.
컴파일된 μ†ŒμŠ€μ½”λ“œλŠ” μ–΄λ””μ„œ μ €μž₯될까?
(to `src/compiler/watch.ts`)
### watch
```jsx
export function listFiles<T extends BuilderProgram>(program: Program | T, write: (s: string) => void) {
const options = program.getCompilerOptions();
if (options.explainFiles) {
explainFiles(isBuilderProgram(program) ? program.getProgram() : program, write);
}
else if (options.listFiles || options.listFilesOnly) {
forEach(program.getSourceFiles(), file => {
write(file.fileName);
});
}
}
```
컴파일된 μ†ŒμŠ€μ½”λ“œλ“€μ€ watchμ—μ„œ λ°›μ•„ write ν•¨μˆ˜λ₯Ό ν˜ΈμΆœν•΄ μ €μž₯ν•œλ‹€.

0 comments on commit 59a0ed9

Please sign in to comment.