typescript-svelte-plugin
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -232,3 +232,23 @@ "use strict"; | ||
this.projectService.host.readFile = (path) => { | ||
if ((0, utils_1.isSvelteFilePath)(path) && this.configManager.getConfig().enable) { | ||
// The following (very hacky) first two checks make sure that the ambient module definitions | ||
// that tell TS "every import ending with .svelte is a valid module" are removed. | ||
// They exist in svelte2tsx and svelte to make sure that people don't | ||
// get errors in their TS files when importing Svelte files and not using our TS plugin. | ||
// If someone wants to get back the behavior they can add an ambient module definition | ||
// on their own. | ||
const normalizedPath = path.replace(/\\/g, '/'); | ||
if (normalizedPath.endsWith('node_modules/svelte/types/runtime/ambient.d.ts')) { | ||
return ''; | ||
} | ||
else if (normalizedPath.endsWith('svelte2tsx/svelte-shims.d.ts')) { | ||
let originalText = readFile(path) || ''; | ||
if (!originalText.includes('// -- start svelte-ls-remove --')) { | ||
return originalText; // uses an older version of svelte2tsx | ||
} | ||
originalText = | ||
originalText.substring(0, originalText.indexOf('// -- start svelte-ls-remove --')) + | ||
originalText.substring(originalText.indexOf('// -- end svelte-ls-remove --')); | ||
return originalText; | ||
} | ||
else if ((0, utils_1.isSvelteFilePath)(path) && this.configManager.getConfig().enable) { | ||
this.logger.debug('Read Svelte file:', path); | ||
@@ -235,0 +255,0 @@ const svelteCode = readFile(path) || ''; |
{ | ||
"name": "typescript-svelte-plugin", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"description": "A TypeScript Plugin providing Svelte intellisense", | ||
@@ -5,0 +5,0 @@ "main": "dist/src/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
62220
1420