@macroforge/svelte-language-server 0.1.3

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 (256) hide show
  1. package/README.md +331 -0
  2. package/bin/server.js +5 -0
  3. package/dist/src/importPackage.d.ts +16 -0
  4. package/dist/src/importPackage.js +76 -0
  5. package/dist/src/importPackage.js.map +1 -0
  6. package/dist/src/index.d.ts +3 -0
  7. package/dist/src/index.js +23 -0
  8. package/dist/src/index.js.map +1 -0
  9. package/dist/src/lib/DiagnosticsManager.d.ts +20 -0
  10. package/dist/src/lib/DiagnosticsManager.js +71 -0
  11. package/dist/src/lib/DiagnosticsManager.js.map +1 -0
  12. package/dist/src/lib/FallbackWatcher.d.ts +15 -0
  13. package/dist/src/lib/FallbackWatcher.js +66 -0
  14. package/dist/src/lib/FallbackWatcher.js.map +1 -0
  15. package/dist/src/lib/documentHighlight/wordHighlight.d.ts +3 -0
  16. package/dist/src/lib/documentHighlight/wordHighlight.js +62 -0
  17. package/dist/src/lib/documentHighlight/wordHighlight.js.map +1 -0
  18. package/dist/src/lib/documents/Document.d.ts +63 -0
  19. package/dist/src/lib/documents/Document.js +138 -0
  20. package/dist/src/lib/documents/Document.js.map +1 -0
  21. package/dist/src/lib/documents/DocumentBase.d.ts +65 -0
  22. package/dist/src/lib/documents/DocumentBase.js +69 -0
  23. package/dist/src/lib/documents/DocumentBase.js.map +1 -0
  24. package/dist/src/lib/documents/DocumentManager.d.ts +28 -0
  25. package/dist/src/lib/documents/DocumentManager.js +122 -0
  26. package/dist/src/lib/documents/DocumentManager.js.map +1 -0
  27. package/dist/src/lib/documents/DocumentMapper.d.ts +88 -0
  28. package/dist/src/lib/documents/DocumentMapper.js +258 -0
  29. package/dist/src/lib/documents/DocumentMapper.js.map +1 -0
  30. package/dist/src/lib/documents/configLoader.d.ts +80 -0
  31. package/dist/src/lib/documents/configLoader.js +265 -0
  32. package/dist/src/lib/documents/configLoader.js.map +1 -0
  33. package/dist/src/lib/documents/fileCollection.d.ts +41 -0
  34. package/dist/src/lib/documents/fileCollection.js +87 -0
  35. package/dist/src/lib/documents/fileCollection.js.map +1 -0
  36. package/dist/src/lib/documents/index.d.ts +5 -0
  37. package/dist/src/lib/documents/index.js +22 -0
  38. package/dist/src/lib/documents/index.js.map +1 -0
  39. package/dist/src/lib/documents/parseHtml.d.ts +13 -0
  40. package/dist/src/lib/documents/parseHtml.js +160 -0
  41. package/dist/src/lib/documents/parseHtml.js.map +1 -0
  42. package/dist/src/lib/documents/utils.d.ts +105 -0
  43. package/dist/src/lib/documents/utils.js +410 -0
  44. package/dist/src/lib/documents/utils.js.map +1 -0
  45. package/dist/src/lib/foldingRange/indentFolding.d.ts +26 -0
  46. package/dist/src/lib/foldingRange/indentFolding.js +142 -0
  47. package/dist/src/lib/foldingRange/indentFolding.js.map +1 -0
  48. package/dist/src/lib/semanticToken/semanticTokenLegend.d.ts +33 -0
  49. package/dist/src/lib/semanticToken/semanticTokenLegend.js +37 -0
  50. package/dist/src/lib/semanticToken/semanticTokenLegend.js.map +1 -0
  51. package/dist/src/logger.d.ts +9 -0
  52. package/dist/src/logger.js +28 -0
  53. package/dist/src/logger.js.map +1 -0
  54. package/dist/src/ls-config.d.ts +326 -0
  55. package/dist/src/ls-config.js +386 -0
  56. package/dist/src/ls-config.js.map +1 -0
  57. package/dist/src/plugins/PluginHost.d.ts +68 -0
  58. package/dist/src/plugins/PluginHost.js +447 -0
  59. package/dist/src/plugins/PluginHost.js.map +1 -0
  60. package/dist/src/plugins/css/CSSDocument.d.ts +46 -0
  61. package/dist/src/plugins/css/CSSDocument.js +78 -0
  62. package/dist/src/plugins/css/CSSDocument.js.map +1 -0
  63. package/dist/src/plugins/css/CSSPlugin.d.ts +35 -0
  64. package/dist/src/plugins/css/CSSPlugin.js +407 -0
  65. package/dist/src/plugins/css/CSSPlugin.js.map +1 -0
  66. package/dist/src/plugins/css/FileSystemProvider.d.ts +10 -0
  67. package/dist/src/plugins/css/FileSystemProvider.js +75 -0
  68. package/dist/src/plugins/css/FileSystemProvider.js.map +1 -0
  69. package/dist/src/plugins/css/StyleAttributeDocument.d.ts +41 -0
  70. package/dist/src/plugins/css/StyleAttributeDocument.js +65 -0
  71. package/dist/src/plugins/css/StyleAttributeDocument.js.map +1 -0
  72. package/dist/src/plugins/css/features/getIdClassCompletion.d.ts +19 -0
  73. package/dist/src/plugins/css/features/getIdClassCompletion.js +56 -0
  74. package/dist/src/plugins/css/features/getIdClassCompletion.js.map +1 -0
  75. package/dist/src/plugins/css/features/svelte-selectors.d.ts +2 -0
  76. package/dist/src/plugins/css/features/svelte-selectors.js +18 -0
  77. package/dist/src/plugins/css/features/svelte-selectors.js.map +1 -0
  78. package/dist/src/plugins/css/global-vars.d.ts +16 -0
  79. package/dist/src/plugins/css/global-vars.js +82 -0
  80. package/dist/src/plugins/css/global-vars.js.map +1 -0
  81. package/dist/src/plugins/css/service.d.ts +5 -0
  82. package/dist/src/plugins/css/service.js +66 -0
  83. package/dist/src/plugins/css/service.js.map +1 -0
  84. package/dist/src/plugins/documentContext.d.ts +3 -0
  85. package/dist/src/plugins/documentContext.js +36 -0
  86. package/dist/src/plugins/documentContext.js.map +1 -0
  87. package/dist/src/plugins/html/HTMLPlugin.d.ts +36 -0
  88. package/dist/src/plugins/html/HTMLPlugin.js +363 -0
  89. package/dist/src/plugins/html/HTMLPlugin.js.map +1 -0
  90. package/dist/src/plugins/html/dataProvider.d.ts +1 -0
  91. package/dist/src/plugins/html/dataProvider.js +481 -0
  92. package/dist/src/plugins/html/dataProvider.js.map +1 -0
  93. package/dist/src/plugins/index.d.ts +7 -0
  94. package/dist/src/plugins/index.js +24 -0
  95. package/dist/src/plugins/index.js.map +1 -0
  96. package/dist/src/plugins/interfaces.d.ts +132 -0
  97. package/dist/src/plugins/interfaces.js +3 -0
  98. package/dist/src/plugins/interfaces.js.map +1 -0
  99. package/dist/src/plugins/svelte/SvelteDocument.d.ts +98 -0
  100. package/dist/src/plugins/svelte/SvelteDocument.js +318 -0
  101. package/dist/src/plugins/svelte/SvelteDocument.js.map +1 -0
  102. package/dist/src/plugins/svelte/SveltePlugin.d.ts +24 -0
  103. package/dist/src/plugins/svelte/SveltePlugin.js +306 -0
  104. package/dist/src/plugins/svelte/SveltePlugin.js.map +1 -0
  105. package/dist/src/plugins/svelte/features/SvelteTags.d.ts +28 -0
  106. package/dist/src/plugins/svelte/features/SvelteTags.js +136 -0
  107. package/dist/src/plugins/svelte/features/SvelteTags.js.map +1 -0
  108. package/dist/src/plugins/svelte/features/getCodeActions/getQuickfixes.d.ts +11 -0
  109. package/dist/src/plugins/svelte/features/getCodeActions/getQuickfixes.js +140 -0
  110. package/dist/src/plugins/svelte/features/getCodeActions/getQuickfixes.js.map +1 -0
  111. package/dist/src/plugins/svelte/features/getCodeActions/getRefactorings.d.ts +9 -0
  112. package/dist/src/plugins/svelte/features/getCodeActions/getRefactorings.js +140 -0
  113. package/dist/src/plugins/svelte/features/getCodeActions/getRefactorings.js.map +1 -0
  114. package/dist/src/plugins/svelte/features/getCodeActions/index.d.ts +4 -0
  115. package/dist/src/plugins/svelte/features/getCodeActions/index.js +19 -0
  116. package/dist/src/plugins/svelte/features/getCodeActions/index.js.map +1 -0
  117. package/dist/src/plugins/svelte/features/getCompletions.d.ts +4 -0
  118. package/dist/src/plugins/svelte/features/getCompletions.js +184 -0
  119. package/dist/src/plugins/svelte/features/getCompletions.js.map +1 -0
  120. package/dist/src/plugins/svelte/features/getDiagnostics.d.ts +9 -0
  121. package/dist/src/plugins/svelte/features/getDiagnostics.js +284 -0
  122. package/dist/src/plugins/svelte/features/getDiagnostics.js.map +1 -0
  123. package/dist/src/plugins/svelte/features/getHoverInfo.d.ts +7 -0
  124. package/dist/src/plugins/svelte/features/getHoverInfo.js +93 -0
  125. package/dist/src/plugins/svelte/features/getHoverInfo.js.map +1 -0
  126. package/dist/src/plugins/svelte/features/getModifierData.d.ts +7 -0
  127. package/dist/src/plugins/svelte/features/getModifierData.js +56 -0
  128. package/dist/src/plugins/svelte/features/getModifierData.js.map +1 -0
  129. package/dist/src/plugins/svelte/features/getSelectionRanges.d.ts +3 -0
  130. package/dist/src/plugins/svelte/features/getSelectionRanges.js +46 -0
  131. package/dist/src/plugins/svelte/features/getSelectionRanges.js.map +1 -0
  132. package/dist/src/plugins/svelte/features/utils.d.ts +5 -0
  133. package/dist/src/plugins/svelte/features/utils.js +18 -0
  134. package/dist/src/plugins/svelte/features/utils.js.map +1 -0
  135. package/dist/src/plugins/typescript/ComponentInfoProvider.d.ts +27 -0
  136. package/dist/src/plugins/typescript/ComponentInfoProvider.js +116 -0
  137. package/dist/src/plugins/typescript/ComponentInfoProvider.js.map +1 -0
  138. package/dist/src/plugins/typescript/DocumentMapper.d.ts +10 -0
  139. package/dist/src/plugins/typescript/DocumentMapper.js +25 -0
  140. package/dist/src/plugins/typescript/DocumentMapper.js.map +1 -0
  141. package/dist/src/plugins/typescript/DocumentSnapshot.d.ts +173 -0
  142. package/dist/src/plugins/typescript/DocumentSnapshot.js +623 -0
  143. package/dist/src/plugins/typescript/DocumentSnapshot.js.map +1 -0
  144. package/dist/src/plugins/typescript/LSAndTSDocResolver.d.ts +100 -0
  145. package/dist/src/plugins/typescript/LSAndTSDocResolver.js +301 -0
  146. package/dist/src/plugins/typescript/LSAndTSDocResolver.js.map +1 -0
  147. package/dist/src/plugins/typescript/SnapshotManager.d.ts +59 -0
  148. package/dist/src/plugins/typescript/SnapshotManager.js +238 -0
  149. package/dist/src/plugins/typescript/SnapshotManager.js.map +1 -0
  150. package/dist/src/plugins/typescript/TypeScriptPlugin.d.ts +65 -0
  151. package/dist/src/plugins/typescript/TypeScriptPlugin.js +332 -0
  152. package/dist/src/plugins/typescript/TypeScriptPlugin.js.map +1 -0
  153. package/dist/src/plugins/typescript/features/CallHierarchyProvider.d.ts +24 -0
  154. package/dist/src/plugins/typescript/features/CallHierarchyProvider.js +325 -0
  155. package/dist/src/plugins/typescript/features/CallHierarchyProvider.js.map +1 -0
  156. package/dist/src/plugins/typescript/features/CodeActionsProvider.d.ts +72 -0
  157. package/dist/src/plugins/typescript/features/CodeActionsProvider.js +1030 -0
  158. package/dist/src/plugins/typescript/features/CodeActionsProvider.js.map +1 -0
  159. package/dist/src/plugins/typescript/features/CodeLensProvider.d.ts +28 -0
  160. package/dist/src/plugins/typescript/features/CodeLensProvider.js +205 -0
  161. package/dist/src/plugins/typescript/features/CodeLensProvider.js.map +1 -0
  162. package/dist/src/plugins/typescript/features/CompletionProvider.d.ts +57 -0
  163. package/dist/src/plugins/typescript/features/CompletionProvider.js +791 -0
  164. package/dist/src/plugins/typescript/features/CompletionProvider.js.map +1 -0
  165. package/dist/src/plugins/typescript/features/DiagnosticsProvider.d.ts +36 -0
  166. package/dist/src/plugins/typescript/features/DiagnosticsProvider.js +497 -0
  167. package/dist/src/plugins/typescript/features/DiagnosticsProvider.js.map +1 -0
  168. package/dist/src/plugins/typescript/features/DocumentHighlightProvider.d.ts +17 -0
  169. package/dist/src/plugins/typescript/features/DocumentHighlightProvider.js +211 -0
  170. package/dist/src/plugins/typescript/features/DocumentHighlightProvider.js.map +1 -0
  171. package/dist/src/plugins/typescript/features/FindComponentReferencesProvider.d.ts +9 -0
  172. package/dist/src/plugins/typescript/features/FindComponentReferencesProvider.js +66 -0
  173. package/dist/src/plugins/typescript/features/FindComponentReferencesProvider.js.map +1 -0
  174. package/dist/src/plugins/typescript/features/FindFileReferencesProvider.d.ts +9 -0
  175. package/dist/src/plugins/typescript/features/FindFileReferencesProvider.js +38 -0
  176. package/dist/src/plugins/typescript/features/FindFileReferencesProvider.js.map +1 -0
  177. package/dist/src/plugins/typescript/features/FindReferencesProvider.d.ts +20 -0
  178. package/dist/src/plugins/typescript/features/FindReferencesProvider.js +149 -0
  179. package/dist/src/plugins/typescript/features/FindReferencesProvider.js.map +1 -0
  180. package/dist/src/plugins/typescript/features/FoldingRangeProvider.d.ts +28 -0
  181. package/dist/src/plugins/typescript/features/FoldingRangeProvider.js +247 -0
  182. package/dist/src/plugins/typescript/features/FoldingRangeProvider.js.map +1 -0
  183. package/dist/src/plugins/typescript/features/HoverProvider.d.ts +11 -0
  184. package/dist/src/plugins/typescript/features/HoverProvider.js +75 -0
  185. package/dist/src/plugins/typescript/features/HoverProvider.js.map +1 -0
  186. package/dist/src/plugins/typescript/features/ImplementationProvider.d.ts +9 -0
  187. package/dist/src/plugins/typescript/features/ImplementationProvider.js +47 -0
  188. package/dist/src/plugins/typescript/features/ImplementationProvider.js.map +1 -0
  189. package/dist/src/plugins/typescript/features/InlayHintProvider.d.ts +22 -0
  190. package/dist/src/plugins/typescript/features/InlayHintProvider.js +225 -0
  191. package/dist/src/plugins/typescript/features/InlayHintProvider.js.map +1 -0
  192. package/dist/src/plugins/typescript/features/RenameProvider.d.ts +53 -0
  193. package/dist/src/plugins/typescript/features/RenameProvider.js +423 -0
  194. package/dist/src/plugins/typescript/features/RenameProvider.js.map +1 -0
  195. package/dist/src/plugins/typescript/features/SelectionRangeProvider.d.ts +18 -0
  196. package/dist/src/plugins/typescript/features/SelectionRangeProvider.js +62 -0
  197. package/dist/src/plugins/typescript/features/SelectionRangeProvider.js.map +1 -0
  198. package/dist/src/plugins/typescript/features/SemanticTokensProvider.d.ts +15 -0
  199. package/dist/src/plugins/typescript/features/SemanticTokensProvider.js +116 -0
  200. package/dist/src/plugins/typescript/features/SemanticTokensProvider.js.map +1 -0
  201. package/dist/src/plugins/typescript/features/SignatureHelpProvider.d.ts +22 -0
  202. package/dist/src/plugins/typescript/features/SignatureHelpProvider.js +110 -0
  203. package/dist/src/plugins/typescript/features/SignatureHelpProvider.js.map +1 -0
  204. package/dist/src/plugins/typescript/features/TypeDefinitionProvider.d.ts +9 -0
  205. package/dist/src/plugins/typescript/features/TypeDefinitionProvider.js +35 -0
  206. package/dist/src/plugins/typescript/features/TypeDefinitionProvider.js.map +1 -0
  207. package/dist/src/plugins/typescript/features/UpdateImportsProvider.d.ts +11 -0
  208. package/dist/src/plugins/typescript/features/UpdateImportsProvider.js +109 -0
  209. package/dist/src/plugins/typescript/features/UpdateImportsProvider.js.map +1 -0
  210. package/dist/src/plugins/typescript/features/WorkspaceSymbolProvider.d.ts +25 -0
  211. package/dist/src/plugins/typescript/features/WorkspaceSymbolProvider.js +176 -0
  212. package/dist/src/plugins/typescript/features/WorkspaceSymbolProvider.js.map +1 -0
  213. package/dist/src/plugins/typescript/features/getDirectiveCommentCompletions.d.ts +13 -0
  214. package/dist/src/plugins/typescript/features/getDirectiveCommentCompletions.js +58 -0
  215. package/dist/src/plugins/typescript/features/getDirectiveCommentCompletions.js.map +1 -0
  216. package/dist/src/plugins/typescript/features/getJsDocTemplateCompletion.d.ts +4 -0
  217. package/dist/src/plugins/typescript/features/getJsDocTemplateCompletion.js +57 -0
  218. package/dist/src/plugins/typescript/features/getJsDocTemplateCompletion.js.map +1 -0
  219. package/dist/src/plugins/typescript/features/utils.d.ts +81 -0
  220. package/dist/src/plugins/typescript/features/utils.js +331 -0
  221. package/dist/src/plugins/typescript/features/utils.js.map +1 -0
  222. package/dist/src/plugins/typescript/macroforgeAugmenter.d.ts +23 -0
  223. package/dist/src/plugins/typescript/macroforgeAugmenter.js +41 -0
  224. package/dist/src/plugins/typescript/macroforgeAugmenter.js.map +1 -0
  225. package/dist/src/plugins/typescript/module-loader.d.ts +28 -0
  226. package/dist/src/plugins/typescript/module-loader.js +254 -0
  227. package/dist/src/plugins/typescript/module-loader.js.map +1 -0
  228. package/dist/src/plugins/typescript/previewer.d.ts +7 -0
  229. package/dist/src/plugins/typescript/previewer.js +120 -0
  230. package/dist/src/plugins/typescript/previewer.js.map +1 -0
  231. package/dist/src/plugins/typescript/service.d.ts +105 -0
  232. package/dist/src/plugins/typescript/service.js +1073 -0
  233. package/dist/src/plugins/typescript/service.js.map +1 -0
  234. package/dist/src/plugins/typescript/serviceCache.d.ts +90 -0
  235. package/dist/src/plugins/typescript/serviceCache.js +50 -0
  236. package/dist/src/plugins/typescript/serviceCache.js.map +1 -0
  237. package/dist/src/plugins/typescript/svelte-ast-utils.d.ts +77 -0
  238. package/dist/src/plugins/typescript/svelte-ast-utils.js +100 -0
  239. package/dist/src/plugins/typescript/svelte-ast-utils.js.map +1 -0
  240. package/dist/src/plugins/typescript/svelte-sys.d.ts +9 -0
  241. package/dist/src/plugins/typescript/svelte-sys.js +79 -0
  242. package/dist/src/plugins/typescript/svelte-sys.js.map +1 -0
  243. package/dist/src/plugins/typescript/utils.d.ts +48 -0
  244. package/dist/src/plugins/typescript/utils.js +334 -0
  245. package/dist/src/plugins/typescript/utils.js.map +1 -0
  246. package/dist/src/server.d.ts +19 -0
  247. package/dist/src/server.js +434 -0
  248. package/dist/src/server.js.map +1 -0
  249. package/dist/src/svelte-check.d.ts +65 -0
  250. package/dist/src/svelte-check.js +288 -0
  251. package/dist/src/svelte-check.js.map +1 -0
  252. package/dist/src/utils.d.ts +111 -0
  253. package/dist/src/utils.js +337 -0
  254. package/dist/src/utils.js.map +1 -0
  255. package/dist/tsconfig.tsbuildinfo +1 -0
  256. package/package.json +79 -0
@@ -0,0 +1,98 @@
1
+ import type { compile } from 'svelte/compiler';
2
+ import { CompileOptions } from 'svelte/types/compiler/interfaces';
3
+ import { PreprocessorGroup, Processed } from 'svelte/types/compiler/preprocess';
4
+ import { Position } from 'vscode-languageserver';
5
+ import { Document, DocumentMapper, SourceMapDocumentMapper, TagInformation } from '../../lib/documents';
6
+ import { SvelteConfig } from '../../lib/documents/configLoader';
7
+ export type SvelteCompileResult = ReturnType<typeof compile>;
8
+ export declare enum TranspileErrorSource {
9
+ Script = "Script",
10
+ Style = "Style"
11
+ }
12
+ type PositionMapper = Pick<DocumentMapper, 'getGeneratedPosition' | 'getOriginalPosition'>;
13
+ /**
14
+ * Represents a text document that contains a svelte component.
15
+ */
16
+ export declare class SvelteDocument {
17
+ private parent;
18
+ private transpiledDoc;
19
+ private compileResult;
20
+ script: TagInformation | null;
21
+ moduleScript: TagInformation | null;
22
+ style: TagInformation | null;
23
+ languageId: string;
24
+ version: number;
25
+ uri: string;
26
+ get config(): Promise<SvelteConfig | undefined>;
27
+ constructor(parent: Document);
28
+ getText(): string;
29
+ getFilePath(): string;
30
+ offsetAt(position: Position): number;
31
+ getTranspiled(): Promise<ITranspiledSvelteDocument>;
32
+ getCompiled(): Promise<SvelteCompileResult>;
33
+ getCompiledWith(options?: CompileOptions): Promise<SvelteCompileResult>;
34
+ }
35
+ export interface ITranspiledSvelteDocument extends PositionMapper {
36
+ getText(): string;
37
+ }
38
+ export declare class TranspiledSvelteDocument implements ITranspiledSvelteDocument {
39
+ private code;
40
+ private mapper?;
41
+ static create(document: Document, config: SvelteConfig | undefined): Promise<TranspiledSvelteDocument>;
42
+ constructor(code: string, mapper?: SourceMapDocumentMapper | undefined);
43
+ getOriginalPosition(generatedPosition: Position): Position;
44
+ getText(): string;
45
+ getGeneratedPosition(originalPosition: Position): Position;
46
+ }
47
+ /**
48
+ * Only used when the user has an old Svelte version installed where source map support
49
+ * for preprocessors is not built in yet.
50
+ * This fallback version does not map correctly when there's both a module and instance script.
51
+ * It isn't worth fixing these cases though now that Svelte ships a preprocessor with source maps.
52
+ */
53
+ export declare class FallbackTranspiledSvelteDocument implements ITranspiledSvelteDocument {
54
+ private parent;
55
+ private transpiled;
56
+ scriptMapper: SvelteFragmentMapper | null;
57
+ styleMapper: SvelteFragmentMapper | null;
58
+ static create(document: Document, preprocessors?: PreprocessorGroup | PreprocessorGroup[]): Promise<FallbackTranspiledSvelteDocument>;
59
+ private fragmentInfos;
60
+ private constructor();
61
+ getOriginalPosition(generatedPosition: Position): Position;
62
+ getURL(): string;
63
+ getText(): string;
64
+ getGeneratedPosition(originalPosition: Position): Position;
65
+ }
66
+ export declare class SvelteFragmentMapper implements PositionMapper {
67
+ /**
68
+ * End offset + length difference to original
69
+ */
70
+ fragmentInfo: {
71
+ end: number;
72
+ diff: number;
73
+ };
74
+ /**
75
+ * Maps between full original source and fragment within that original.
76
+ */
77
+ private originalFragmentMapper;
78
+ /**
79
+ * Maps between full transpiled source and fragment within that transpiled.
80
+ */
81
+ private transpiledFragmentMapper;
82
+ /**
83
+ * Maps between original and transpiled, within fragment.
84
+ */
85
+ private sourceMapper;
86
+ static createStyle(originalDoc: Document, transpiled: string, processed: Processed[]): SvelteFragmentMapper | null;
87
+ static createScript(originalDoc: Document, transpiled: string, processed: Processed[]): SvelteFragmentMapper | null;
88
+ private static create;
89
+ private static createSourceMapper;
90
+ private constructor();
91
+ isInTranspiledFragment(generatedPosition: Position): boolean;
92
+ getOriginalPosition(generatedPosition: Position): Position;
93
+ /**
94
+ * Reversing `getOriginalPosition`
95
+ */
96
+ getGeneratedPosition(originalPosition: Position): Position;
97
+ }
98
+ export {};
@@ -0,0 +1,318 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SvelteFragmentMapper = exports.FallbackTranspiledSvelteDocument = exports.TranspiledSvelteDocument = exports.SvelteDocument = exports.TranspileErrorSource = void 0;
4
+ const trace_mapping_1 = require("@jridgewell/trace-mapping");
5
+ const documents_1 = require("../../lib/documents");
6
+ const utils_1 = require("../../utils");
7
+ var TranspileErrorSource;
8
+ (function (TranspileErrorSource) {
9
+ TranspileErrorSource["Script"] = "Script";
10
+ TranspileErrorSource["Style"] = "Style";
11
+ })(TranspileErrorSource || (exports.TranspileErrorSource = TranspileErrorSource = {}));
12
+ /**
13
+ * Represents a text document that contains a svelte component.
14
+ */
15
+ class SvelteDocument {
16
+ get config() {
17
+ return this.parent.configPromise;
18
+ }
19
+ constructor(parent) {
20
+ this.parent = parent;
21
+ this.languageId = 'svelte';
22
+ this.version = 0;
23
+ this.uri = this.parent.uri;
24
+ this.script = this.parent.scriptInfo;
25
+ this.moduleScript = this.parent.moduleScriptInfo;
26
+ this.style = this.parent.styleInfo;
27
+ this.version = this.parent.version;
28
+ }
29
+ getText() {
30
+ return this.parent.getText();
31
+ }
32
+ getFilePath() {
33
+ return this.parent.getFilePath() || '';
34
+ }
35
+ offsetAt(position) {
36
+ return this.parent.offsetAt(position);
37
+ }
38
+ async getTranspiled() {
39
+ if (!this.transpiledDoc) {
40
+ const [major, minor] = this.parent.getSvelteVersion();
41
+ if (major > 3 || (major === 3 && minor >= 32)) {
42
+ this.transpiledDoc = TranspiledSvelteDocument.create(this.parent, await this.config);
43
+ }
44
+ else {
45
+ this.transpiledDoc = FallbackTranspiledSvelteDocument.create(this.parent, (await this.config)?.preprocess);
46
+ }
47
+ }
48
+ return this.transpiledDoc;
49
+ }
50
+ async getCompiled() {
51
+ if (!this.compileResult) {
52
+ this.compileResult = this.getCompiledWith((await this.config)?.compilerOptions);
53
+ }
54
+ return this.compileResult;
55
+ }
56
+ async getCompiledWith(options = {}) {
57
+ return this.parent.compiler.compile((await this.getTranspiled()).getText(), options);
58
+ }
59
+ }
60
+ exports.SvelteDocument = SvelteDocument;
61
+ class TranspiledSvelteDocument {
62
+ static async create(document, config) {
63
+ if (!config?.preprocess) {
64
+ return new TranspiledSvelteDocument(document.getText());
65
+ }
66
+ const filename = document.getFilePath() || '';
67
+ const preprocessed = await document.compiler.preprocess(document.getText(), wrapPreprocessors(config?.preprocess), {
68
+ filename
69
+ });
70
+ if (preprocessed.code === document.getText()) {
71
+ return new TranspiledSvelteDocument(document.getText());
72
+ }
73
+ return new TranspiledSvelteDocument(preprocessed.code, preprocessed.map
74
+ ? new documents_1.SourceMapDocumentMapper(createTraceMap(preprocessed.map),
75
+ // The "sources" array only contains the Svelte filename, not its path.
76
+ // For getting generated positions, the sourcemap consumer wants an exact match
77
+ // of the source filepath. Therefore only pass in the filename here.
78
+ (0, utils_1.getLastPartOfPath)(filename))
79
+ : undefined);
80
+ }
81
+ constructor(code, mapper) {
82
+ this.code = code;
83
+ this.mapper = mapper;
84
+ }
85
+ getOriginalPosition(generatedPosition) {
86
+ return this.mapper?.getOriginalPosition(generatedPosition) || generatedPosition;
87
+ }
88
+ getText() {
89
+ return this.code;
90
+ }
91
+ getGeneratedPosition(originalPosition) {
92
+ return this.mapper?.getGeneratedPosition(originalPosition) || originalPosition;
93
+ }
94
+ }
95
+ exports.TranspiledSvelteDocument = TranspiledSvelteDocument;
96
+ /**
97
+ * Only used when the user has an old Svelte version installed where source map support
98
+ * for preprocessors is not built in yet.
99
+ * This fallback version does not map correctly when there's both a module and instance script.
100
+ * It isn't worth fixing these cases though now that Svelte ships a preprocessor with source maps.
101
+ */
102
+ class FallbackTranspiledSvelteDocument {
103
+ static async create(document, preprocessors = []) {
104
+ const { transpiled, processedScripts, processedStyles } = await transpile(document, preprocessors);
105
+ const scriptMapper = SvelteFragmentMapper.createScript(document, transpiled, processedScripts);
106
+ const styleMapper = SvelteFragmentMapper.createStyle(document, transpiled, processedStyles);
107
+ return new FallbackTranspiledSvelteDocument(document, transpiled, scriptMapper, styleMapper);
108
+ }
109
+ constructor(parent, transpiled, scriptMapper, styleMapper) {
110
+ this.parent = parent;
111
+ this.transpiled = transpiled;
112
+ this.scriptMapper = scriptMapper;
113
+ this.styleMapper = styleMapper;
114
+ this.fragmentInfos = [this.scriptMapper?.fragmentInfo, this.styleMapper?.fragmentInfo]
115
+ .filter(utils_1.isNotNullOrUndefined)
116
+ .sort((i1, i2) => i1.end - i2.end);
117
+ }
118
+ getOriginalPosition(generatedPosition) {
119
+ if (this.scriptMapper?.isInTranspiledFragment(generatedPosition)) {
120
+ return this.scriptMapper.getOriginalPosition(generatedPosition);
121
+ }
122
+ if (this.styleMapper?.isInTranspiledFragment(generatedPosition)) {
123
+ return this.styleMapper.getOriginalPosition(generatedPosition);
124
+ }
125
+ // Position is not in fragments, but we still need to account for
126
+ // the length differences of the fragments before the position.
127
+ let offset = (0, documents_1.offsetAt)(generatedPosition, this.transpiled);
128
+ for (const fragmentInfo of this.fragmentInfos) {
129
+ if (offset > fragmentInfo.end) {
130
+ offset += fragmentInfo.diff;
131
+ }
132
+ }
133
+ return this.parent.positionAt(offset);
134
+ }
135
+ getURL() {
136
+ return this.parent.getURL();
137
+ }
138
+ getText() {
139
+ return this.transpiled;
140
+ }
141
+ getGeneratedPosition(originalPosition) {
142
+ const { styleInfo, scriptInfo } = this.parent;
143
+ if ((0, documents_1.isInTag)(originalPosition, scriptInfo) && this.scriptMapper) {
144
+ return this.scriptMapper.getGeneratedPosition(originalPosition);
145
+ }
146
+ if ((0, documents_1.isInTag)(originalPosition, styleInfo) && this.styleMapper) {
147
+ return this.styleMapper.getGeneratedPosition(originalPosition);
148
+ }
149
+ // Add length difference of each fragment
150
+ let offset = (0, documents_1.offsetAt)(originalPosition, this.parent.getText());
151
+ for (const fragmentInfo of this.fragmentInfos) {
152
+ if (offset > fragmentInfo.end) {
153
+ offset -= fragmentInfo.diff;
154
+ }
155
+ }
156
+ return (0, documents_1.positionAt)(offset, this.getText());
157
+ }
158
+ }
159
+ exports.FallbackTranspiledSvelteDocument = FallbackTranspiledSvelteDocument;
160
+ class SvelteFragmentMapper {
161
+ static createStyle(originalDoc, transpiled, processed) {
162
+ return SvelteFragmentMapper.create(originalDoc, transpiled, originalDoc.styleInfo, (0, documents_1.extractStyleTag)(transpiled), processed);
163
+ }
164
+ static createScript(originalDoc, transpiled, processed) {
165
+ const scriptInfo = originalDoc.scriptInfo || originalDoc.moduleScriptInfo;
166
+ const maybeScriptTag = (0, documents_1.extractScriptTags)(transpiled);
167
+ const maybeScriptTagInfo = maybeScriptTag && (maybeScriptTag.script || maybeScriptTag.moduleScript);
168
+ return SvelteFragmentMapper.create(originalDoc, transpiled, scriptInfo, maybeScriptTagInfo || null, processed);
169
+ }
170
+ static create(originalDoc, transpiled, originalTagInfo, transpiledTagInfo, processed) {
171
+ const sourceMapper = processed.length > 0
172
+ ? SvelteFragmentMapper.createSourceMapper(processed, originalDoc)
173
+ : new documents_1.IdentityMapper(originalDoc.uri);
174
+ if (originalTagInfo && transpiledTagInfo) {
175
+ const sourceLength = originalTagInfo.container.end - originalTagInfo.container.start;
176
+ const transpiledLength = transpiledTagInfo.container.end - transpiledTagInfo.container.start;
177
+ const diff = sourceLength - transpiledLength;
178
+ return new SvelteFragmentMapper({ end: transpiledTagInfo.container.end, diff }, new documents_1.FragmentMapper(originalDoc.getText(), originalTagInfo, originalDoc.uri), new documents_1.FragmentMapper(transpiled, transpiledTagInfo, originalDoc.uri), sourceMapper);
179
+ }
180
+ return null;
181
+ }
182
+ static createSourceMapper(processed, originalDoc) {
183
+ return processed.reduce((parent, processedSingle) => processedSingle?.map
184
+ ? new documents_1.SourceMapDocumentMapper(createTraceMap(processedSingle.map), originalDoc.uri, parent)
185
+ : new documents_1.IdentityMapper(originalDoc.uri, parent), undefined);
186
+ }
187
+ constructor(
188
+ /**
189
+ * End offset + length difference to original
190
+ */
191
+ fragmentInfo,
192
+ /**
193
+ * Maps between full original source and fragment within that original.
194
+ */
195
+ originalFragmentMapper,
196
+ /**
197
+ * Maps between full transpiled source and fragment within that transpiled.
198
+ */
199
+ transpiledFragmentMapper,
200
+ /**
201
+ * Maps between original and transpiled, within fragment.
202
+ */
203
+ sourceMapper) {
204
+ this.fragmentInfo = fragmentInfo;
205
+ this.originalFragmentMapper = originalFragmentMapper;
206
+ this.transpiledFragmentMapper = transpiledFragmentMapper;
207
+ this.sourceMapper = sourceMapper;
208
+ }
209
+ isInTranspiledFragment(generatedPosition) {
210
+ return this.transpiledFragmentMapper.isInGenerated(generatedPosition);
211
+ }
212
+ getOriginalPosition(generatedPosition) {
213
+ // Map the position to be relative to the transpiled fragment
214
+ const positionInTranspiledFragment = this.transpiledFragmentMapper.getGeneratedPosition(generatedPosition);
215
+ // Map the position, using the sourcemap, to the original position in the source fragment
216
+ const positionInOriginalFragment = this.sourceMapper.getOriginalPosition(positionInTranspiledFragment);
217
+ // Map the position to be in the original fragment's parent
218
+ return this.originalFragmentMapper.getOriginalPosition(positionInOriginalFragment);
219
+ }
220
+ /**
221
+ * Reversing `getOriginalPosition`
222
+ */
223
+ getGeneratedPosition(originalPosition) {
224
+ const positionInOriginalFragment = this.originalFragmentMapper.getGeneratedPosition(originalPosition);
225
+ const positionInTranspiledFragment = this.sourceMapper.getGeneratedPosition(positionInOriginalFragment);
226
+ return this.transpiledFragmentMapper.getOriginalPosition(positionInTranspiledFragment);
227
+ }
228
+ }
229
+ exports.SvelteFragmentMapper = SvelteFragmentMapper;
230
+ /**
231
+ * Wrap preprocessors and rethrow on errors with more info on where the error came from.
232
+ */
233
+ function wrapPreprocessors(preprocessors = []) {
234
+ preprocessors = Array.isArray(preprocessors) ? preprocessors : [preprocessors];
235
+ return preprocessors.map((preprocessor) => {
236
+ const wrappedPreprocessor = { markup: preprocessor.markup };
237
+ if (preprocessor.script) {
238
+ wrappedPreprocessor.script = async (args) => {
239
+ try {
240
+ return await preprocessor.script(args);
241
+ }
242
+ catch (e) {
243
+ e.__source = TranspileErrorSource.Script;
244
+ throw e;
245
+ }
246
+ };
247
+ }
248
+ if (preprocessor.style) {
249
+ wrappedPreprocessor.style = async (args) => {
250
+ try {
251
+ return await preprocessor.style(args);
252
+ }
253
+ catch (e) {
254
+ e.__source = TranspileErrorSource.Style;
255
+ throw e;
256
+ }
257
+ };
258
+ }
259
+ return wrappedPreprocessor;
260
+ });
261
+ }
262
+ async function transpile(document, preprocessors = []) {
263
+ preprocessors = Array.isArray(preprocessors) ? preprocessors : [preprocessors];
264
+ const processedScripts = [];
265
+ const processedStyles = [];
266
+ const wrappedPreprocessors = preprocessors.map((preprocessor) => {
267
+ const wrappedPreprocessor = { markup: preprocessor.markup };
268
+ if (preprocessor.script) {
269
+ wrappedPreprocessor.script = async (args) => {
270
+ try {
271
+ const res = await preprocessor.script(args);
272
+ if (res && res.map) {
273
+ processedScripts.push(res);
274
+ }
275
+ return res;
276
+ }
277
+ catch (e) {
278
+ e.__source = TranspileErrorSource.Script;
279
+ throw e;
280
+ }
281
+ };
282
+ }
283
+ if (preprocessor.style) {
284
+ wrappedPreprocessor.style = async (args) => {
285
+ try {
286
+ const res = await preprocessor.style(args);
287
+ if (res && res.map) {
288
+ processedStyles.push(res);
289
+ }
290
+ return res;
291
+ }
292
+ catch (e) {
293
+ e.__source = TranspileErrorSource.Style;
294
+ throw e;
295
+ }
296
+ };
297
+ }
298
+ return wrappedPreprocessor;
299
+ });
300
+ const result = await document.compiler.preprocess(document.getText(), wrappedPreprocessors, {
301
+ filename: document.getFilePath() || ''
302
+ });
303
+ const transpiled = result.code || result.toString?.() || '';
304
+ return { transpiled, processedScripts, processedStyles };
305
+ }
306
+ function createTraceMap(map) {
307
+ return new trace_mapping_1.TraceMap(normalizeMap(map));
308
+ function normalizeMap(map) {
309
+ // We don't know what we get, could be a stringified sourcemap,
310
+ // or a class which has the required properties on it, or a class
311
+ // which we need to call toString() on to get the correct format.
312
+ if (typeof map === 'string' || map.version) {
313
+ return map;
314
+ }
315
+ return map.toString();
316
+ }
317
+ }
318
+ //# sourceMappingURL=SvelteDocument.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SvelteDocument.js","sourceRoot":"","sources":["../../../../src/plugins/svelte/SvelteDocument.ts"],"names":[],"mappings":";;;AAAA,6DAAqD;AAOrD,mDAY6B;AAE7B,uCAAsE;AAItE,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC5B,yCAAiB,CAAA;IACjB,uCAAe,CAAA;AACnB,CAAC,EAHW,oBAAoB,oCAApB,oBAAoB,QAG/B;AAID;;GAEG;AACH,MAAa,cAAc;IAUvB,IAAW,MAAM;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;IACrC,CAAC;IAED,YAAoB,MAAgB;QAAhB,WAAM,GAAN,MAAM,CAAU;QAP7B,eAAU,GAAG,QAAQ,CAAC;QACtB,YAAO,GAAG,CAAC,CAAC;QACZ,QAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC;QAMzB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAA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,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,oBAAoB,EAAE;QACxF,QAAQ,EAAE,QAAQ,CAAC,WAAW,EAAE,IAAI,EAAE;KACzC,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC;IAE5D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC;AAC7D,CAAC;AAED,SAAS,cAAc,CAAC,GAAQ;IAC5B,OAAO,IAAI,wBAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAEvC,SAAS,YAAY,CAAC,GAAQ;QAC1B,+DAA+D;QAC/D,iEAAiE;QACjE,iEAAiE;QACjE,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;YACzC,OAAO,GAAG,CAAC;QACf,CAAC;QACD,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;AACL,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { CancellationToken, CodeAction, CodeActionContext, CodeLens, CompletionContext, CompletionList, Diagnostic, FormattingOptions, Hover, Position, Range, SelectionRange, TextEdit, WorkspaceEdit } from 'vscode-languageserver';
2
+ import { Document } from '../../lib/documents';
3
+ import { LSConfigManager } from '../../ls-config';
4
+ import { CodeActionsProvider, CompletionsProvider, DiagnosticsProvider, FormattingProvider, HoverProvider, SelectionRangeProvider } from '../interfaces';
5
+ import { SvelteCompileResult } from './SvelteDocument';
6
+ export declare class SveltePlugin implements DiagnosticsProvider, FormattingProvider, CompletionsProvider, HoverProvider, CodeActionsProvider, SelectionRangeProvider {
7
+ private configManager;
8
+ __name: string;
9
+ private docManager;
10
+ constructor(configManager: LSConfigManager);
11
+ getCodeLens(document: Document): Promise<CodeLens[] | null>;
12
+ getDiagnostics(document: Document, cancellationToken?: CancellationToken): Promise<Diagnostic[]>;
13
+ getCompiledResult(document: Document): Promise<SvelteCompileResult | null>;
14
+ formatDocument(document: Document, options: FormattingOptions): Promise<TextEdit[]>;
15
+ private static isPrettierPluginSvelte;
16
+ getCompletions(document: Document, position: Position, _?: CompletionContext, cancellationToken?: CancellationToken): Promise<CompletionList | null>;
17
+ doHover(document: Document, position: Position): Promise<Hover | null>;
18
+ getCodeActions(document: Document, range: Range, context: CodeActionContext, cancellationToken?: CancellationToken): Promise<CodeAction[]>;
19
+ executeCommand(document: Document, command: string, args?: any[]): Promise<WorkspaceEdit | string | null>;
20
+ private migrate;
21
+ getSelectionRange(document: Document, position: Position): Promise<SelectionRange | null>;
22
+ private featureEnabled;
23
+ private getSvelteDoc;
24
+ }