typescript-svelte-plugin 0.3.28 → 0.3.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,7 @@ export declare class ConfigManager {
|
|
|
5
5
|
private emitter;
|
|
6
6
|
private config;
|
|
7
7
|
onConfigurationChanged(listener: (config: Configuration) => void): void;
|
|
8
|
+
isConfigChanged(config: Configuration): boolean;
|
|
8
9
|
updateConfigFromPluginConfig(config: Configuration): void;
|
|
9
10
|
getConfig(): Configuration;
|
|
10
11
|
}
|
|
@@ -13,6 +13,10 @@ class ConfigManager {
|
|
|
13
13
|
onConfigurationChanged(listener) {
|
|
14
14
|
this.emitter.on(configurationEventName, listener);
|
|
15
15
|
}
|
|
16
|
+
isConfigChanged(config) {
|
|
17
|
+
// right now we only care about enable
|
|
18
|
+
return config.enable !== this.config.enable;
|
|
19
|
+
}
|
|
16
20
|
updateConfigFromPluginConfig(config) {
|
|
17
21
|
this.config = {
|
|
18
22
|
...this.config,
|
package/dist/src/index.js
CHANGED
|
@@ -93,7 +93,9 @@ function init(modules) {
|
|
|
93
93
|
(0, module_loader_1.patchModuleLoader)(logger, snapshotManager, modules.typescript, info.languageServiceHost, info.project, configManager);
|
|
94
94
|
configManager.onConfigurationChanged(() => {
|
|
95
95
|
// enabling/disabling the plugin means TS has to recompute stuff
|
|
96
|
-
|
|
96
|
+
// don't clear semantic cache here
|
|
97
|
+
// typescript now expected the program updates to be completely in their control
|
|
98
|
+
// doing so will result in a crash
|
|
97
99
|
info.project.markAsDirty();
|
|
98
100
|
// updateGraph checks for new root files
|
|
99
101
|
// if there's no tsconfig there isn't root files to check
|
|
@@ -136,7 +138,9 @@ function init(modules) {
|
|
|
136
138
|
return (0, utils_1.hasNodeModule)(compilerOptions, 'svelte');
|
|
137
139
|
}
|
|
138
140
|
function onConfigurationChanged(config) {
|
|
139
|
-
configManager.
|
|
141
|
+
if (configManager.isConfigChanged(config)) {
|
|
142
|
+
configManager.updateConfigFromPluginConfig(config);
|
|
143
|
+
}
|
|
140
144
|
}
|
|
141
145
|
/**
|
|
142
146
|
* TypeScript doesn't load the external files in projects without a config file. So we load it by ourselves.
|