typescript-svelte-plugin 0.3.30 → 0.3.31
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.
|
@@ -32,6 +32,7 @@ export declare class ProjectSvelteFilesManager {
|
|
|
32
32
|
private readProjectSvelteFilesFromFs;
|
|
33
33
|
private onConfigChanged;
|
|
34
34
|
private removeFileFromProject;
|
|
35
|
-
private
|
|
35
|
+
private disposeWatchers;
|
|
36
|
+
private clearProjectFile;
|
|
36
37
|
dispose(): void;
|
|
37
38
|
}
|
|
@@ -27,7 +27,8 @@ class ProjectSvelteFilesManager {
|
|
|
27
27
|
if (!parsedCommandLine) {
|
|
28
28
|
return;
|
|
29
29
|
}
|
|
30
|
-
this.
|
|
30
|
+
this.disposeWatchers();
|
|
31
|
+
this.clearProjectFile();
|
|
31
32
|
this.parsedCommandLine = parsedCommandLine;
|
|
32
33
|
this.setupWatchers();
|
|
33
34
|
this.updateProjectSvelteFiles();
|
|
@@ -109,7 +110,8 @@ class ProjectSvelteFilesManager {
|
|
|
109
110
|
.map(this.typescript.server.toNormalizedPath);
|
|
110
111
|
}
|
|
111
112
|
onConfigChanged(config) {
|
|
112
|
-
this.
|
|
113
|
+
this.disposeWatchers();
|
|
114
|
+
this.clearProjectFile();
|
|
113
115
|
if (config.enable) {
|
|
114
116
|
this.setupWatchers();
|
|
115
117
|
this.updateProjectSvelteFiles();
|
|
@@ -121,14 +123,20 @@ class ProjectSvelteFilesManager {
|
|
|
121
123
|
this.project.removeFile(info, exists, true);
|
|
122
124
|
}
|
|
123
125
|
}
|
|
124
|
-
|
|
126
|
+
disposeWatchers() {
|
|
125
127
|
this.directoryWatchers.forEach((watcher) => watcher.close());
|
|
126
128
|
this.directoryWatchers.clear();
|
|
129
|
+
}
|
|
130
|
+
clearProjectFile() {
|
|
127
131
|
this.projectFileToOriginalCasing.forEach((file) => this.removeFileFromProject(file));
|
|
128
132
|
this.projectFileToOriginalCasing.clear();
|
|
129
133
|
}
|
|
130
134
|
dispose() {
|
|
131
|
-
this.
|
|
135
|
+
this.disposeWatchers();
|
|
136
|
+
// Don't remove files from the project here
|
|
137
|
+
// because TypeScript already does that when the project is closed
|
|
138
|
+
// - and because the project is closed, `project.removeFile` will result in an error
|
|
139
|
+
this.projectFileToOriginalCasing.clear();
|
|
132
140
|
ProjectSvelteFilesManager.instances.delete(this.project.getProjectName());
|
|
133
141
|
}
|
|
134
142
|
}
|
package/dist/src/svelte-sys.js
CHANGED
|
@@ -14,6 +14,12 @@ function createSvelteSys(ts, logger) {
|
|
|
14
14
|
readDirectory(path, extensions, exclude, include, depth) {
|
|
15
15
|
const extensionsWithSvelte = (extensions ?? []).concat('.svelte');
|
|
16
16
|
return ts.sys.readDirectory(path, extensionsWithSvelte, exclude, include, depth);
|
|
17
|
+
},
|
|
18
|
+
readFile(path, encoding) {
|
|
19
|
+
// imba typescript plugin patch this with Object.defineProperty
|
|
20
|
+
// and copying the property descriptor from a class that extends the original ts.sys
|
|
21
|
+
// so we explicitly define it here
|
|
22
|
+
return ts.sys.readFile(path, encoding);
|
|
17
23
|
}
|
|
18
24
|
};
|
|
19
25
|
if (ts.sys.realpath) {
|