typescript-svelte-plugin 0.3.45 → 0.3.47

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
@@ -32,9 +32,7 @@ function init(modules) {
32
32
  logger.log('Svelte plugin disabled');
33
33
  logger.log(info.config);
34
34
  }
35
- // This call the ConfiguredProject.getParsedCommandLine
36
- // where it'll try to load the cached version of the parsedCommandLine
37
- const parsedCommandLine = info.languageServiceHost.getParsedCommandLine?.((0, utils_1.getConfigPathForProject)(info.project));
35
+ const parsedCommandLine = (0, utils_1.getProjectParsedCommandLine)(info.project);
38
36
  // For some reason it's no longer enough to patch this at the projectService level, so we do it here, too
39
37
  // TODO investigate if we can use the script snapshot for all Svelte files, too, enabling Svelte file
40
38
  // updates getting picked up without a file save - move this logic into the snapshot manager then?
@@ -4,8 +4,8 @@ exports.decorateNavigateToItems = decorateNavigateToItems;
4
4
  const utils_1 = require("../utils");
5
5
  function decorateNavigateToItems(ls, snapshotManager) {
6
6
  const getNavigateToItems = ls.getNavigateToItems;
7
- ls.getNavigateToItems = (searchValue, maxResultCount, fileName, excludeDtsFiles) => {
8
- const navigationToItems = getNavigateToItems(searchValue, maxResultCount, fileName, excludeDtsFiles);
7
+ ls.getNavigateToItems = (...args) => {
8
+ const navigationToItems = getNavigateToItems(...args);
9
9
  return navigationToItems
10
10
  .map((item) => {
11
11
  if (!(0, utils_1.isSvelteFilePath)(item.fileName)) {
@@ -48,4 +48,9 @@ export declare function getProjectDirectory(project: ts.server.Project): string
48
48
  export declare function hasNodeModule(startPath: string, module: string): string | boolean;
49
49
  export declare function isSvelteProject(project: ts.server.Project): string | boolean;
50
50
  export declare function importSvelteCompiler(fromPath: string | undefined): typeof import('svelte/compiler') | undefined;
51
+ /**
52
+ * This call the ConfiguredProject.getParsedCommandLine
53
+ * where it'll try to load the cached version of the parsedCommandLine
54
+ */
55
+ export declare function getProjectParsedCommandLine(project: ts.server.Project): ts.ParsedCommandLine | undefined;
51
56
  export {};
package/dist/src/utils.js CHANGED
@@ -23,6 +23,7 @@ exports.getProjectDirectory = getProjectDirectory;
23
23
  exports.hasNodeModule = hasNodeModule;
24
24
  exports.isSvelteProject = isSvelteProject;
25
25
  exports.importSvelteCompiler = importSvelteCompiler;
26
+ exports.getProjectParsedCommandLine = getProjectParsedCommandLine;
26
27
  const path_1 = require("path");
27
28
  function isSvelteFilePath(filePath) {
28
29
  return filePath.endsWith('.svelte');
@@ -222,7 +223,12 @@ function isSvelteProject(project) {
222
223
  // The solution project is mostly just a container we don't need to patch it
223
224
  // and having any files in this project cause TSServer to send config error while it originally won't
224
225
  if (project.isSolution?.()) {
225
- return false;
226
+ // In TypeScript before 5.7, the project files were added later than plugin loading
227
+ // so we need to also check if the parsedCommandLine includes any files
228
+ const parsedCommandLine = getProjectParsedCommandLine(project);
229
+ if (parsedCommandLine?.fileNames.length === 0) {
230
+ return false;
231
+ }
226
232
  }
227
233
  const projectDirectory = getProjectDirectory(project);
228
234
  if (projectDirectory) {
@@ -257,4 +263,13 @@ function importSvelteCompiler(fromPath) {
257
263
  // ignore
258
264
  }
259
265
  }
266
+ /**
267
+ * This call the ConfiguredProject.getParsedCommandLine
268
+ * where it'll try to load the cached version of the parsedCommandLine
269
+ */
270
+ function getProjectParsedCommandLine(project) {
271
+ const configPath = getConfigPathForProject(project);
272
+ const parsedCommandLine = project.getParsedCommandLine?.(configPath);
273
+ return parsedCommandLine;
274
+ }
260
275
  //# sourceMappingURL=utils.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-svelte-plugin",
3
- "version": "0.3.45",
3
+ "version": "0.3.47",
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.6.3",
22
- "svelte": "^4.2.19"
21
+ "svelte": "^4.2.19",
22
+ "typescript": "^5.8.2"
23
23
  },
24
24
  "dependencies": {
25
25
  "@jridgewell/sourcemap-codec": "^1.5.0",
26
- "svelte2tsx": "~0.7.25"
26
+ "svelte2tsx": "~0.7.35"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsc -p ./",