mirror of
https://github.com/ezolenko/rollup-plugin-typescript2.git
synced 2025-12-08 19:06:16 +00:00
optim(watch): don't reset DocumentRegistry b/t watch cycles (#388)
- we can re-use the same one during watch instead of resetting it in the `options` hook - should make the LS a bit faster / more efficient in watch mode as most source files are shared between watch cycles
This commit is contained in:
parent
4d20f5c638
commit
e75d97a758
@ -31,6 +31,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
|
||||
let tsConfigPath: string | undefined;
|
||||
let servicesHost: LanguageServiceHost;
|
||||
let service: tsTypes.LanguageService;
|
||||
let documentRegistry: tsTypes.DocumentRegistry; // keep the same DocumentRegistry between watch cycles
|
||||
let noErrors = true;
|
||||
const declarations: { [name: string]: { type: tsTypes.OutputFile; map?: tsTypes.OutputFile } } = {};
|
||||
const checkedFiles = new Set<string>();
|
||||
@ -98,6 +99,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
|
||||
pluginOptions.typescript = require("typescript");
|
||||
}
|
||||
setTypescriptModule(pluginOptions.typescript);
|
||||
documentRegistry = tsModule.createDocumentRegistry();
|
||||
|
||||
const self: Plugin = {
|
||||
|
||||
@ -135,8 +137,7 @@ const typescript: PluginImpl<RPT2Options> = (options) =>
|
||||
filter = createFilter(context, pluginOptions, parsedConfig);
|
||||
|
||||
servicesHost = new LanguageServiceHost(parsedConfig, pluginOptions.transformers, pluginOptions.cwd);
|
||||
|
||||
service = tsModule.createLanguageService(servicesHost, tsModule.createDocumentRegistry());
|
||||
service = tsModule.createLanguageService(servicesHost, documentRegistry);
|
||||
servicesHost.setLanguageService(service);
|
||||
|
||||
// printing compiler option errors
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user