typescript-svelte-plugin 0.3.52 → 0.3.53

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.53
4
+
5
+ ### Patch Changes
6
+
7
+ - fix: don't load the project's Svelte compiler while the TypeScript plugin is disabled ([#3230](https://github.com/sveltejs/language-tools/pull/3230))
8
+
3
9
  ## 0.3.52
4
10
 
5
11
  ### Patch Changes
package/dist/src/index.js CHANGED
@@ -27,11 +27,42 @@ function init(modules) {
27
27
  configManager.updateConfigFromPluginConfig(info.config);
28
28
  if (configManager.getConfig().enable) {
29
29
  logger.log('Starting Svelte plugin');
30
+ return patchProject(info, logger);
30
31
  }
31
- else {
32
- logger.log('Svelte plugin disabled');
33
- logger.log(info.config);
34
- }
32
+ logger.log('Svelte plugin disabled');
33
+ logger.log(info.config);
34
+ // Don't load anything from the project while disabled. That includes untrusted
35
+ // workspaces, for which the VS Code extension disables the plugin.
36
+ // Patch the project once the plugin gets enabled.
37
+ let service = info.languageService;
38
+ const onConfigChanged = () => {
39
+ if (!configManager.getConfig().enable) {
40
+ return;
41
+ }
42
+ configManager.removeConfigurationChangeListener(onConfigChanged);
43
+ if ((0, language_service_1.isPatched)(info.project)) {
44
+ return;
45
+ }
46
+ service = patchProject(info, logger);
47
+ // The project was already loaded without Svelte support, TS has to recompute it
48
+ // @ts-expect-error internal API since TS 5.5
49
+ info.project.markAsDirty?.();
50
+ info.project.updateGraph();
51
+ };
52
+ configManager.onConfigurationChanged(onConfigChanged);
53
+ return new Proxy(info.languageService, {
54
+ get(_target, key) {
55
+ if (key === 'dispose') {
56
+ return () => {
57
+ configManager.removeConfigurationChangeListener(onConfigChanged);
58
+ service.dispose();
59
+ };
60
+ }
61
+ return service[key];
62
+ }
63
+ });
64
+ }
65
+ function patchProject(info, logger) {
35
66
  const parsedCommandLine = (0, utils_1.getProjectParsedCommandLine)(info.project);
36
67
  // For some reason it's no longer enough to patch this at the projectService level, so we do it here, too
37
68
  // TODO investigate if we can use the script snapshot for all Svelte files, too, enabling Svelte file
@@ -81,7 +81,7 @@ function createApiExport(name) {
81
81
  ],
82
82
  documentation: [
83
83
  {
84
- text: `Handles ${name} requests. More info: https://kit.svelte.dev/docs/routing#server`,
84
+ text: `Handles ${name} requests. More info: https://svelte.dev/docs/kit/routing#server`,
85
85
  kind: 'text'
86
86
  }
87
87
  ]
@@ -122,7 +122,7 @@ exports.kitExports = {
122
122
  ],
123
123
  documentation: [
124
124
  {
125
- text: 'Control whether or not this page is prerendered. More info: https://kit.svelte.dev/docs/page-options#prerender',
125
+ text: 'Control whether or not this page is prerendered. More info: https://svelte.dev/docs/kit/page-options#prerender',
126
126
  kind: 'text'
127
127
  }
128
128
  ]
@@ -153,7 +153,7 @@ exports.kitExports = {
153
153
  ],
154
154
  documentation: [
155
155
  {
156
- text: 'Control whether or not this page is server-side rendered. More info: https://kit.svelte.dev/docs/page-options#ssr',
156
+ text: 'Control whether or not this page is server-side rendered. More info: https://svelte.dev/docs/kit/page-options#ssr',
157
157
  kind: 'text'
158
158
  }
159
159
  ]
@@ -184,7 +184,7 @@ exports.kitExports = {
184
184
  ],
185
185
  documentation: [
186
186
  {
187
- text: 'Control whether or not this page is hydrated (i.e. if JS is delivered to the client). More info: https://kit.svelte.dev/docs/page-options#csr',
187
+ text: 'Control whether or not this page is hydrated (i.e. if JS is delivered to the client). More info: https://svelte.dev/docs/kit/page-options#csr',
188
188
  kind: 'text'
189
189
  }
190
190
  ]
@@ -215,7 +215,7 @@ exports.kitExports = {
215
215
  ],
216
216
  documentation: [
217
217
  {
218
- text: 'Control how SvelteKit should handle 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://svelte.dev/docs/kit/page-options#trailingslash',
219
219
  kind: 'text'
220
220
  }
221
221
  ]
@@ -248,7 +248,7 @@ exports.kitExports = {
248
248
  {
249
249
  text: `With the concept of adapters, SvelteKit is able to run on a variety of platforms. ` +
250
250
  `Each of these might have specific configuration to further tweak the deployment, which you can configure here. ` +
251
- `More info: https://kit.svelte.dev/docs/page-options#config`,
251
+ `More info: https://svelte.dev/docs/kit/page-options#config`,
252
252
  kind: 'text'
253
253
  }
254
254
  ]
@@ -280,7 +280,7 @@ exports.kitExports = {
280
280
  documentation: [
281
281
  {
282
282
  text: `An object of methods which handle form POST requests. ` +
283
- `More info: https://kit.svelte.dev/docs/form-actions`,
283
+ `More info: https://svelte.dev/docs/kit/form-actions`,
284
284
  kind: 'text'
285
285
  }
286
286
  ]
@@ -351,7 +351,7 @@ exports.kitExports = {
351
351
  ],
352
352
  documentation: [
353
353
  {
354
- text: 'Loads data for the given page or layout. More info: https://kit.svelte.dev/docs/load',
354
+ text: 'Loads data for the given page or layout. More info: https://svelte.dev/docs/kit/load',
355
355
  kind: 'text'
356
356
  }
357
357
  ]
@@ -387,7 +387,7 @@ exports.kitExports = {
387
387
  documentation: [
388
388
  {
389
389
  text: 'Generate values for dynamic parameters in prerendered pages.\n' +
390
- 'More info: https://kit.svelte.dev/docs/page-options#entries',
390
+ 'More info: https://svelte.dev/docs/kit/page-options#entries',
391
391
  kind: 'text'
392
392
  }
393
393
  ]
@@ -407,7 +407,7 @@ exports.kitExports = {
407
407
  documentation: [
408
408
  {
409
409
  text: `A parameter matcher. ` +
410
- `More info: https://kit.svelte.dev/docs/advanced-routing#matching`,
410
+ `More info: https://svelte.dev/docs/kit/advanced-routing#matching`,
411
411
  kind: 'text'
412
412
  }
413
413
  ]
@@ -421,7 +421,7 @@ exports.kitExports = {
421
421
  text: `The handle hook runs every time the SvelteKit server receives a request and determines the response. ` +
422
422
  `It receives an 'event' object representing the request and a function called 'resolve', which renders the route and generates a Response. ` +
423
423
  `This allows you to modify response headers or bodies, or bypass SvelteKit entirely (for implementing routes programmatically, for example). ` +
424
- `More info: https://kit.svelte.dev/docs/hooks#server-hooks-handle`,
424
+ `More info: https://svelte.dev/docs/kit/hooks#server-hooks-handle`,
425
425
  kind: 'text'
426
426
  }
427
427
  ]
@@ -432,7 +432,7 @@ exports.kitExports = {
432
432
  documentation: [
433
433
  {
434
434
  text: `The handleFetch hook allows you to modify (or replace) a 'fetch' request that happens inside a 'load' function that runs on the server (or during pre-rendering). ` +
435
- `More info: https://kit.svelte.dev/docs/hooks#server-hooks-handlefetch`,
435
+ `More info: https://svelte.dev/docs/kit/hooks#server-hooks-handlefetch`,
436
436
  kind: 'text'
437
437
  }
438
438
  ]
@@ -445,7 +445,7 @@ exports.kitExports = {
445
445
  text: `The handleError hook runs when an unexpected error is thrown while responding to a request. ` +
446
446
  `If an unexpected error is thrown during loading or rendering, this function will be called with the error and the event. ` +
447
447
  `Make sure that this function _never_ throws an error. ` +
448
- `More info: https://kit.svelte.dev/docs/hooks#shared-hooks-handleerror`,
448
+ `More info: https://svelte.dev/docs/kit/hooks#shared-hooks-handleerror`,
449
449
  kind: 'text'
450
450
  }
451
451
  ]
@@ -457,7 +457,7 @@ exports.kitExports = {
457
457
  {
458
458
  text: `This function allows you to change how URLs are translated into routes. ` +
459
459
  `The returned pathname (which defaults to url.pathname) is used to select the route and its parameters. ` +
460
- `More info: https://kit.svelte.dev/docs/hooks#universal-hooks-reroute`,
460
+ `More info: https://svelte.dev/docs/kit/hooks#universal-hooks-reroute`,
461
461
  kind: 'text'
462
462
  }
463
463
  ]
package/dist/src/utils.js CHANGED
@@ -253,10 +253,6 @@ function importSvelteCompiler(fromPath) {
253
253
  try {
254
254
  const sveltePath = require.resolve('svelte/compiler', { paths: [fromPath] });
255
255
  const compiler = require(sveltePath);
256
- if (compiler.VERSION.split('.')[0] === '3') {
257
- // use built-in version for Svelte 3
258
- return undefined;
259
- }
260
256
  return compiler;
261
257
  }
262
258
  catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-svelte-plugin",
3
- "version": "0.3.52",
3
+ "version": "0.3.53",
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
- "svelte": "^4.2.19",
22
- "typescript": "^5.9.2"
21
+ "svelte": "^5.57.0",
22
+ "typescript": "^6.0.3"
23
23
  },
24
24
  "dependencies": {
25
25
  "@jridgewell/sourcemap-codec": "^1.5.0",
26
- "svelte2tsx": "~0.7.54"
26
+ "svelte2tsx": "~0.7.64"
27
27
  },
28
28
  "scripts": {
29
29
  "build": "tsc -p ./",