typescript-svelte-plugin 0.3.5 → 0.3.6
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.
|
@@ -228,7 +228,10 @@ class SvelteSnapshotManager {
|
|
|
228
228
|
}
|
|
229
229
|
patchProjectServiceReadFile() {
|
|
230
230
|
const readFile = this.projectService.host.readFile;
|
|
231
|
-
this.projectService.host.readFile = (path) => {
|
|
231
|
+
this.projectService.host.readFile = (path, encoding) => {
|
|
232
|
+
if (!this.configManager.getConfig().enable) {
|
|
233
|
+
return readFile(path, encoding);
|
|
234
|
+
}
|
|
232
235
|
// The following (very hacky) first two checks make sure that the ambient module definitions
|
|
233
236
|
// that tell TS "every import ending with .svelte is a valid module" are removed.
|
|
234
237
|
// They exist in svelte2tsx and svelte to make sure that people don't
|
|
@@ -249,7 +252,7 @@ class SvelteSnapshotManager {
|
|
|
249
252
|
originalText.substring(originalText.indexOf('// -- end svelte-ls-remove --'));
|
|
250
253
|
return originalText;
|
|
251
254
|
}
|
|
252
|
-
else if ((0, utils_1.isSvelteFilePath)(path)
|
|
255
|
+
else if ((0, utils_1.isSvelteFilePath)(path)) {
|
|
253
256
|
this.logger.debug('Read Svelte file:', path);
|
|
254
257
|
const svelteCode = readFile(path) || '';
|
|
255
258
|
try {
|
|
@@ -279,7 +282,7 @@ class SvelteSnapshotManager {
|
|
|
279
282
|
}
|
|
280
283
|
}
|
|
281
284
|
else {
|
|
282
|
-
return readFile(path);
|
|
285
|
+
return readFile(path, encoding);
|
|
283
286
|
}
|
|
284
287
|
};
|
|
285
288
|
}
|