typescript-svelte-plugin 0.3.26 → 0.3.27

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
@@ -41,6 +41,17 @@ function init(modules) {
41
41
  if (normalizedPath.endsWith('node_modules/svelte/types/runtime/ambient.d.ts')) {
42
42
  return modules.typescript.ScriptSnapshot.fromString('');
43
43
  }
44
+ else if (normalizedPath.endsWith('node_modules/svelte/types/index.d.ts')) {
45
+ const snapshot = getScriptSnapshot(fileName);
46
+ if (snapshot) {
47
+ const originalText = snapshot.getText(0, snapshot.getLength());
48
+ const startIdx = originalText.indexOf(`declare module '*.svelte' {`);
49
+ const endIdx = originalText.indexOf(`}`, originalText.indexOf(';', startIdx)) + 1;
50
+ return modules.typescript.ScriptSnapshot.fromString(originalText.substring(0, startIdx) +
51
+ ' '.repeat(endIdx - startIdx) +
52
+ originalText.substring(endIdx));
53
+ }
54
+ }
44
55
  else if (normalizedPath.endsWith('svelte2tsx/svelte-jsx.d.ts')) {
45
56
  // Remove the dom lib reference to not load these ambient types in case
46
57
  // the user has a tsconfig.json with different lib settings like in
@@ -5,7 +5,9 @@ const utils_1 = require("../utils");
5
5
  function decorateRename(ls, snapshotManager, logger) {
6
6
  const findRenameLocations = ls.findRenameLocations;
7
7
  ls.findRenameLocations = (fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) => {
8
- const renameLocations = findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename);
8
+ const renameLocations = findRenameLocations(fileName, position, findInStrings, findInComments,
9
+ // @ts-expect-error overload shenanigans
10
+ providePrefixAndSuffixTextForRename);
9
11
  if (!renameLocations) {
10
12
  return undefined;
11
13
  }
@@ -132,6 +132,6 @@ class ProjectSvelteFilesManager {
132
132
  ProjectSvelteFilesManager.instances.delete(this.project.getProjectName());
133
133
  }
134
134
  }
135
- ProjectSvelteFilesManager.instances = new Map();
136
135
  exports.ProjectSvelteFilesManager = ProjectSvelteFilesManager;
136
+ ProjectSvelteFilesManager.instances = new Map();
137
137
  //# sourceMappingURL=project-svelte-files.js.map
@@ -23,7 +23,6 @@ export declare function replaceDeep<T extends Record<string, any>>(obj: T, searc
23
23
  export declare function getConfigPathForProject(project: ts.server.Project): ts.server.NormalizedPath;
24
24
  export declare function isStoreVariableIn$storeDeclaration(text: string, varStart: number): boolean;
25
25
  export declare function get$storeOffsetOf$storeDeclaration(text: string, storePosition: number): number;
26
- type NodePredicate = (node: ts.Node) => boolean;
27
26
  type NodeTypePredicate<T extends ts.Node> = (node: ts.Node) => node is T;
28
27
  /**
29
28
  * Finds node exactly matching span {start, length}.
@@ -42,7 +41,7 @@ export declare function findNodeAtPosition<T extends ts.Node>(node: ts.Node, pos
42
41
  export declare function isTopLevelExport(ts: _ts, node: ts.Node, source: ts.SourceFile): boolean;
43
42
  export declare function isGeneratedSvelteComponentName(className: string): boolean;
44
43
  export declare function offsetOfGeneratedComponentExport(snapshot: SvelteSnapshot): number;
45
- export declare function gatherDescendants<T extends ts.Node>(node: ts.Node, predicate: NodePredicate | NodeTypePredicate<T>, dest?: T[]): T[];
44
+ export declare function gatherDescendants<T extends ts.Node>(node: ts.Node, predicate: NodeTypePredicate<T>, dest?: T[]): T[];
46
45
  export declare function findIdentifier(ts: _ts, node: ts.Node): ts.Identifier | undefined;
47
46
  export declare function hasNodeModule(compilerOptions: ts.CompilerOptions, module: string): string | boolean;
48
47
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-svelte-plugin",
3
- "version": "0.3.26",
3
+ "version": "0.3.27",
4
4
  "description": "A TypeScript Plugin providing Svelte intellisense",
5
5
  "main": "dist/src/index.js",
6
6
  "keywords": [