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.
- package/dist/src/index.js +13 -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
|
|
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
|
-
: [
|
|
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
|
}
|