Updated Using the Compiler API (markdown)

Vladimir Matveev 2015-09-25 22:51:18 -07:00
Родитель 0f7674a0c5
Коммит 36fe82ec6d
1 изменённых файлов: 1 добавлений и 1 удалений

@ -357,7 +357,7 @@ console.log(res2.outputText);
## Customizing module resolution
Standard ways to resolve modules may be overridden by implementing optional method `CompilerHost.resolveModuleNames(moduleNames: string[], containingFile: string): string[]`. This method returns an array of size `moduleNames.length`, each element of the array stores either an instance of `ResolvedModule` with non-empty property `resolvedFileName` - resolution for corresponding name from `moduleNames` array or `undefined` if module name cannot be resolved
Standard ways to resolve modules may be overridden by implementing optional method `CompilerHost.resolveModuleNames(moduleNames: string[], containingFile: string): string[]`. This method returns an array of size `moduleNames.length`, each element of the array stores either an instance of `ResolvedModule` with non-empty property `resolvedFileName` - resolution for corresponding name from `moduleNames` array or `undefined` if module name cannot be resolved. Host can run standard module resolution process via `resolveModuleName(moduleName: string, containingFile: string, options: CompilerOptions, moduleResolutionHost: ModuleResolutionHost): ResolvedModuleNameWithFallbackLocations`. This function returns an object that stores result of module resolution (value of `resolvedModule` property) as well as list of file names that were considered candidates before making current decision. Host can optionally monitor state of these disk locations and invalidate result of current resolution if something changes
```ts
/// <reference path="typings/node/node.d.ts" />