typescript-svelte-plugin 0.3.41 → 0.3.43

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 CHANGED
@@ -7,6 +7,7 @@ const svelte_snapshots_1 = require("./svelte-snapshots");
7
7
  const config_manager_1 = require("./config-manager");
8
8
  const project_svelte_files_1 = require("./project-svelte-files");
9
9
  const utils_1 = require("./utils");
10
+ const svelte2tsx_1 = require("svelte2tsx");
10
11
  function init(modules) {
11
12
  const configManager = new config_manager_1.ConfigManager();
12
13
  let resolvedSvelteTsxFiles;
@@ -133,24 +134,11 @@ function init(modules) {
133
134
  return resolvedSvelteTsxFiles;
134
135
  }
135
136
  const svelteTsPath = (0, path_1.dirname)(require.resolve('svelte2tsx'));
136
- const sveltePath = require.resolve('svelte/compiler', configFilePath ? { paths: [configFilePath] } : undefined);
137
- const VERSION = require(sveltePath).VERSION;
138
- const isSvelte3 = VERSION.split('.')[0] === '3';
139
- const svelteHtmlDeclaration = isSvelte3
140
- ? undefined
141
- : (0, path_1.join)((0, path_1.dirname)(sveltePath), 'svelte-html.d.ts');
142
- const svelteHtmlFallbackIfNotExist = svelteHtmlDeclaration && modules.typescript.sys.fileExists(svelteHtmlDeclaration)
143
- ? svelteHtmlDeclaration
144
- : './svelte-jsx-v4.d.ts';
145
- const svelteTsxFiles = (isSvelte3
146
- ? ['./svelte-shims.d.ts', './svelte-jsx.d.ts', './svelte-native-jsx.d.ts']
147
- : [
148
- './svelte-shims-v4.d.ts',
149
- svelteHtmlFallbackIfNotExist,
150
- './svelte-native-jsx.d.ts'
151
- ]).map((f) => modules.typescript.sys.resolvePath((0, path_1.resolve)(svelteTsPath, f)));
152
- resolvedSvelteTsxFiles = svelteTsxFiles;
153
- return svelteTsxFiles;
137
+ const svelteCompilerPath = require.resolve('svelte/compiler', configFilePath ? { paths: [configFilePath] } : undefined);
138
+ const sveltePath = (0, path_1.dirname)(require.resolve('svelte/package.json', configFilePath ? { paths: [configFilePath] } : undefined));
139
+ const VERSION = require(svelteCompilerPath).VERSION;
140
+ resolvedSvelteTsxFiles = svelte2tsx_1.internalHelpers.get_global_types(modules.typescript.sys, VERSION.split('.')[0] === '3', sveltePath, svelteTsPath, configFilePath);
141
+ return resolvedSvelteTsxFiles;
154
142
  }
155
143
  function isSvelteProjectWithCache(project) {
156
144
  const cached = isSvelteProjectCache.get(project.getProjectName());
@@ -2,6 +2,17 @@ import type ts from 'typescript/lib/tsserverlibrary';
2
2
  import { Logger } from '../logger';
3
3
  import { InternalHelpers } from 'svelte2tsx';
4
4
  type _ts = typeof ts;
5
+ declare module 'typescript/lib/tsserverlibrary' {
6
+ interface LanguageServiceHost {
7
+ /** @internal */ getCachedExportInfoMap?(): unknown;
8
+ /** @internal */ getModuleSpecifierCache?(): unknown;
9
+ /** @internal */ getGlobalTypingsCacheLocation?(): string | undefined;
10
+ /** @internal */ getSymlinkCache?(files: readonly ts.SourceFile[]): unknown;
11
+ /** @internal */ getPackageJsonsVisibleToFile?(fileName: string, rootDir?: string): readonly unknown[];
12
+ /** @internal */ getPackageJsonAutoImportProvider?(): ts.Program | undefined;
13
+ /** @internal*/ getModuleResolutionCache?(): ts.ModuleResolutionCache;
14
+ }
15
+ }
5
16
  export declare const kitExports: Record<string, {
6
17
  displayParts: ts.SymbolDisplayPart[];
7
18
  documentation: ts.SymbolDisplayPart[];
@@ -209,13 +209,13 @@ exports.kitExports = {
209
209
  kind: 'punctuation'
210
210
  },
211
211
  {
212
- text: "'auto' | 'always' | 'never'",
212
+ text: "'never' | 'always' | 'ignore'",
213
213
  kind: 'stringLiteral'
214
214
  }
215
215
  ],
216
216
  documentation: [
217
217
  {
218
- text: 'Control how SvelteKit should handle (missing) trailing slashes in the URL. More info: https://kit.svelte.dev/docs/page-options#trailingslash',
218
+ text: 'Control how SvelteKit should handle trailing slashes in the URL. More info: https://kit.svelte.dev/docs/page-options#trailingslash',
219
219
  kind: 'text'
220
220
  }
221
221
  ]
@@ -536,6 +536,37 @@ function getProxiedLanguageService(info, ts, logger) {
536
536
  this.realpath = originalLanguageServiceHost.realpath
537
537
  ? (...args) => originalLanguageServiceHost.realpath(...args)
538
538
  : undefined;
539
+ this.getProjectReferences = originalLanguageServiceHost.getProjectReferences
540
+ ? () => originalLanguageServiceHost.getProjectReferences()
541
+ : undefined;
542
+ this.getParsedCommandLine = originalLanguageServiceHost.getParsedCommandLine
543
+ ? (fileName) => originalLanguageServiceHost.getParsedCommandLine(fileName)
544
+ : undefined;
545
+ this.getCachedExportInfoMap = originalLanguageServiceHost.getCachedExportInfoMap
546
+ ? () => originalLanguageServiceHost.getCachedExportInfoMap()
547
+ : undefined;
548
+ this.getModuleSpecifierCache = originalLanguageServiceHost.getModuleSpecifierCache
549
+ ? () => originalLanguageServiceHost.getModuleSpecifierCache()
550
+ : undefined;
551
+ this.getGlobalTypingsCacheLocation = originalLanguageServiceHost.getGlobalTypingsCacheLocation
552
+ ? () => originalLanguageServiceHost.getGlobalTypingsCacheLocation()
553
+ : undefined;
554
+ this.getSymlinkCache = originalLanguageServiceHost.getSymlinkCache
555
+ ? (...args) => originalLanguageServiceHost.getSymlinkCache(
556
+ // @ts-ignore
557
+ ...args)
558
+ : undefined;
559
+ this.getPackageJsonsVisibleToFile = originalLanguageServiceHost.getPackageJsonsVisibleToFile
560
+ ? (...args) => originalLanguageServiceHost.getPackageJsonsVisibleToFile(
561
+ // @ts-ignore
562
+ ...args)
563
+ : undefined;
564
+ this.getPackageJsonAutoImportProvider = originalLanguageServiceHost.getPackageJsonAutoImportProvider
565
+ ? () => originalLanguageServiceHost.getPackageJsonAutoImportProvider()
566
+ : undefined;
567
+ this.getModuleResolutionCache = originalLanguageServiceHost.getModuleResolutionCache
568
+ ? () => originalLanguageServiceHost.getModuleResolutionCache()
569
+ : undefined;
539
570
  // This never worked due to configPath being the wrong format and due to https://github.com/microsoft/TypeScript/issues/43329 .
540
571
  // Noone has complained about this not working, so this is commented out for now, revisit if it ever comes up.
541
572
  // const configPath = info.project.getCurrentDirectory() + '/svelte.config.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-svelte-plugin",
3
- "version": "0.3.41",
3
+ "version": "0.3.43",
4
4
  "description": "A TypeScript Plugin providing Svelte intellisense",
5
5
  "main": "dist/src/index.js",
6
6
  "keywords": [
@@ -18,12 +18,12 @@
18
18
  "license": "MIT",
19
19
  "devDependencies": {
20
20
  "@types/node": "^18.0.0",
21
- "typescript": "^5.5.2",
21
+ "typescript": "^5.6.3",
22
22
  "svelte": "^4.2.19"
23
23
  },
24
24
  "dependencies": {
25
25
  "@jridgewell/sourcemap-codec": "^1.5.0",
26
- "svelte2tsx": "~0.7.0"
26
+ "svelte2tsx": "~0.7.23"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsc -p ./",