typescript-svelte-plugin 0.3.29 → 0.3.30

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.
Files changed (2) hide show
  1. package/dist/src/index.js +13 -2
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -127,9 +127,20 @@ function init(modules) {
127
127
  const svelteTsPath = (0, path_1.dirname)(require.resolve('svelte2tsx'));
128
128
  const sveltePath = require.resolve('svelte/compiler', configFilePath ? { paths: [configFilePath] } : undefined);
129
129
  const VERSION = require(sveltePath).VERSION;
130
- const svelteTsxFiles = (VERSION.split('.')[0] === '3'
130
+ const isSvelte3 = VERSION.split('.')[0] === '3';
131
+ const svelteHtmlDeclaration = isSvelte3
132
+ ? undefined
133
+ : (0, path_1.join)((0, path_1.dirname)(sveltePath), 'svelte-html.d.ts');
134
+ const svelteHtmlFallbackIfNotExist = svelteHtmlDeclaration && modules.typescript.sys.fileExists(svelteHtmlDeclaration)
135
+ ? svelteHtmlDeclaration
136
+ : './svelte-jsx-v4.d.ts';
137
+ const svelteTsxFiles = (isSvelte3
131
138
  ? ['./svelte-shims.d.ts', './svelte-jsx.d.ts', './svelte-native-jsx.d.ts']
132
- : ['./svelte-shims-v4.d.ts', './svelte-jsx-v4.d.ts', './svelte-native-jsx.d.ts']).map((f) => modules.typescript.sys.resolvePath((0, path_1.resolve)(svelteTsPath, f)));
139
+ : [
140
+ './svelte-shims-v4.d.ts',
141
+ svelteHtmlFallbackIfNotExist,
142
+ './svelte-native-jsx.d.ts'
143
+ ]).map((f) => modules.typescript.sys.resolvePath((0, path_1.resolve)(svelteTsPath, f)));
133
144
  resolvedSvelteTsxFiles = svelteTsxFiles;
134
145
  return svelteTsxFiles;
135
146
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-svelte-plugin",
3
- "version": "0.3.29",
3
+ "version": "0.3.30",
4
4
  "description": "A TypeScript Plugin providing Svelte intellisense",
5
5
  "main": "dist/src/index.js",
6
6
  "keywords": [