From d9233819fb8f590c34c0ef4caacc13428162acde Mon Sep 17 00:00:00 2001 From: Simon Holthausen Date: Mon, 24 Jun 2024 15:14:01 +0200 Subject: [PATCH] chore: upgrade to TS 5.5 --- package.json | 2 +- packages/language-server/package.json | 4 +- .../src/plugins/typescript/serviceCache.ts | 3 +- .../features/CodeActionsProvider.test.ts | 4 +- .../component-handler/expectedv2.json | 4 +- .../fixtures/element-handler/expectedv2.json | 12 ++-- packages/svelte-vscode/package.json | 2 +- packages/svelte2tsx/package.json | 2 +- .../expected/TestRunes.svelte.d.ts | 1 - .../javascript/expected/Test2.svelte.d.ts | 4 +- .../expected/TestRunes.svelte.d.ts | 1 - .../expected/TestRunes.svelte.d.ts | 1 - packages/typescript-plugin/package.json | 2 +- pnpm-lock.yaml | 69 +++++++++++++------ 14 files changed, 68 insertions(+), 43 deletions(-) diff --git a/package.json b/package.json index 00795c673..793a32730 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "lint": "prettier --check ." }, "dependencies": { - "typescript": "^5.4.5" + "typescript": "^5.5.2" }, "devDependencies": { "cross-env": "^7.0.2", diff --git a/packages/language-server/package.json b/packages/language-server/package.json index 45de36a36..e9d578adb 100644 --- a/packages/language-server/package.json +++ b/packages/language-server/package.json @@ -57,8 +57,8 @@ "svelte": "^3.57.0", "svelte-preprocess": "^5.1.3", "svelte2tsx": "workspace:~", - "typescript": "^5.3.2", - "typescript-auto-import-cache": "^0.3.2", + "typescript": "^5.5.2", + "typescript-auto-import-cache": "^0.3.3", "vscode-css-languageservice": "~6.2.10", "vscode-html-languageservice": "~5.1.1", "vscode-languageserver": "8.0.2", diff --git a/packages/language-server/src/plugins/typescript/serviceCache.ts b/packages/language-server/src/plugins/typescript/serviceCache.ts index 0dbb3bfe2..379a0306f 100644 --- a/packages/language-server/src/plugins/typescript/serviceCache.ts +++ b/packages/language-server/src/plugins/typescript/serviceCache.ts @@ -6,6 +6,7 @@ import { } from 'typescript-auto-import-cache/out/5_0/projectService'; import { createProject as createProject50 } from 'typescript-auto-import-cache/out/5_0/project'; import { createProject as createProject53 } from 'typescript-auto-import-cache/out/5_3/project'; +import { createProject as createProject55 } from 'typescript-auto-import-cache/out/5_5/project'; import ts from 'typescript'; import { ExportInfoMap } from 'typescript-auto-import-cache/out/5_0/exportInfoMap'; import { ModuleSpecifierCache } from 'typescript-auto-import-cache/out/5_0/moduleSpecifierCache'; @@ -70,7 +71,7 @@ export function createProject( return undefined; } - const factory = minor < 3 ? createProject50 : createProject53; + const factory = minor < 3 ? createProject50 : minor < 5 ? createProject53 : createProject55; const project = factory(ts, host, createLanguageService, options); const proxyMethods: (keyof typeof project)[] = [ diff --git a/packages/language-server/test/plugins/typescript/features/CodeActionsProvider.test.ts b/packages/language-server/test/plugins/typescript/features/CodeActionsProvider.test.ts index 9c4f9494d..1ad7ac620 100644 --- a/packages/language-server/test/plugins/typescript/features/CodeActionsProvider.test.ts +++ b/packages/language-server/test/plugins/typescript/features/CodeActionsProvider.test.ts @@ -1153,8 +1153,8 @@ describe('CodeActionsProvider', function () { edits: [ { newText: - `\n${indent}import FixAllImported2 from \"./importing/FixAllImported2.svelte\";\n` + - `${indent}import { FixAllImported3 } from \"./importing/c\";\n`, + `\n${indent}import { FixAllImported3 } from \"./importing/c\";` + + `\n${indent}import FixAllImported2 from \"./importing/FixAllImported2.svelte\";\n`, range: { start: { character: 18, diff --git a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json index 56478c66d..750e37c29 100644 --- a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json +++ b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/component-handler/expectedv2.json @@ -12,8 +12,8 @@ "value": "MouseEvent", "location": { "range": { - "start": { "line": 15692, "character": 10 }, - "end": { "line": 15692, "character": 20 } + "start": { "line": 15860, "character": 10 }, + "end": { "line": 15860, "character": 20 } }, "uri": "/typescript/lib/lib.dom.d.ts" } diff --git a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json index 86a02a272..07b3bf5b9 100644 --- a/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json +++ b/packages/language-server/test/plugins/typescript/features/inlayHints/fixtures/element-handler/expectedv2.json @@ -6,8 +6,8 @@ "value": "MouseEvent", "location": { "range": { - "start": { "line": 15692, "character": 10 }, - "end": { "line": 15692, "character": 20 } + "start": { "line": 15860, "character": 10 }, + "end": { "line": 15860, "character": 20 } }, "uri": "/typescript/lib/lib.dom.d.ts" } @@ -21,8 +21,8 @@ "value": "EventTarget", "location": { "range": { - "start": { "line": 8237, "character": 10 }, - "end": { "line": 8237, "character": 21 } + "start": { "line": 8318, "character": 10 }, + "end": { "line": 8318, "character": 21 } }, "uri": "/typescript/lib/lib.dom.d.ts" } @@ -32,8 +32,8 @@ "value": "HTMLButtonElement", "location": { "range": { - "start": { "line": 9732, "character": 10 }, - "end": { "line": 9732, "character": 27 } + "start": { "line": 9810, "character": 10 }, + "end": { "line": 9810, "character": 27 } }, "uri": "/typescript/lib/lib.dom.d.ts" } diff --git a/packages/svelte-vscode/package.json b/packages/svelte-vscode/package.json index 29fb94977..27ed07e9e 100644 --- a/packages/svelte-vscode/package.json +++ b/packages/svelte-vscode/package.json @@ -722,7 +722,7 @@ "@types/vscode": "^1.67", "js-yaml": "^3.14.0", "tslib": "^2.4.0", - "typescript": "^5.4.5", + "typescript": "^5.5.2", "vscode-tmgrammar-test": "^0.0.11" }, "dependencies": { diff --git a/packages/svelte2tsx/package.json b/packages/svelte2tsx/package.json index daef29560..34d5ef7be 100644 --- a/packages/svelte2tsx/package.json +++ b/packages/svelte2tsx/package.json @@ -40,7 +40,7 @@ "svelte": "~3.57.0", "tiny-glob": "^0.2.6", "tslib": "^2.4.0", - "typescript": "^5.4.5" + "typescript": "^5.5.2" }, "peerDependencies": { "svelte": "^3.55 || ^4.0.0-next.0 || ^4.0 || ^5.0.0-next.0", diff --git a/packages/svelte2tsx/test/emitDts/samples/javascript-runes.v5/expected/TestRunes.svelte.d.ts b/packages/svelte2tsx/test/emitDts/samples/javascript-runes.v5/expected/TestRunes.svelte.d.ts index 220b4fdad..a5ead56ce 100644 --- a/packages/svelte2tsx/test/emitDts/samples/javascript-runes.v5/expected/TestRunes.svelte.d.ts +++ b/packages/svelte2tsx/test/emitDts/samples/javascript-runes.v5/expected/TestRunes.svelte.d.ts @@ -1,4 +1,3 @@ -/// interface $$__sveltets_2_IsomorphicComponent = any, Events extends Record = any, Slots extends Record = any, Exports = {}, Bindings = string> { new (options: import('svelte').ComponentConstructorOptions): import('svelte').SvelteComponent & { $$bindings?: Bindings; diff --git a/packages/svelte2tsx/test/emitDts/samples/javascript/expected/Test2.svelte.d.ts b/packages/svelte2tsx/test/emitDts/samples/javascript/expected/Test2.svelte.d.ts index d025bccbd..e9bae35b9 100644 --- a/packages/svelte2tsx/test/emitDts/samples/javascript/expected/Test2.svelte.d.ts +++ b/packages/svelte2tsx/test/emitDts/samples/javascript/expected/Test2.svelte.d.ts @@ -2,7 +2,7 @@ /** @typedef {typeof __propDef.events} Test2Events */ /** @typedef {typeof __propDef.slots} Test2Slots */ export default class Test2 extends SvelteComponentTyped<{ - foo: boolean; + foo: import("./foo").Foo; }, { [evt: string]: CustomEvent; }, {}> { @@ -13,7 +13,7 @@ export type Test2Slots = typeof __propDef.slots; import { SvelteComponentTyped } from "svelte"; declare const __propDef: { props: { - foo: import('./foo').Foo; + foo: import("./foo").Foo; }; events: { [evt: string]: CustomEvent; diff --git a/packages/svelte2tsx/test/emitDts/samples/typescript-runes-generics.v5/expected/TestRunes.svelte.d.ts b/packages/svelte2tsx/test/emitDts/samples/typescript-runes-generics.v5/expected/TestRunes.svelte.d.ts index ffa7cdda2..6f01eae42 100644 --- a/packages/svelte2tsx/test/emitDts/samples/typescript-runes-generics.v5/expected/TestRunes.svelte.d.ts +++ b/packages/svelte2tsx/test/emitDts/samples/typescript-runes-generics.v5/expected/TestRunes.svelte.d.ts @@ -1,4 +1,3 @@ -/// declare class __sveltets_Render, K extends keyof T> { props(): { foo: T; diff --git a/packages/svelte2tsx/test/emitDts/samples/typescript-runes.v5/expected/TestRunes.svelte.d.ts b/packages/svelte2tsx/test/emitDts/samples/typescript-runes.v5/expected/TestRunes.svelte.d.ts index 220b4fdad..a5ead56ce 100644 --- a/packages/svelte2tsx/test/emitDts/samples/typescript-runes.v5/expected/TestRunes.svelte.d.ts +++ b/packages/svelte2tsx/test/emitDts/samples/typescript-runes.v5/expected/TestRunes.svelte.d.ts @@ -1,4 +1,3 @@ -/// interface $$__sveltets_2_IsomorphicComponent = any, Events extends Record = any, Slots extends Record = any, Exports = {}, Bindings = string> { new (options: import('svelte').ComponentConstructorOptions): import('svelte').SvelteComponent & { $$bindings?: Bindings; diff --git a/packages/typescript-plugin/package.json b/packages/typescript-plugin/package.json index 3ce2bd1da..9b17e9196 100644 --- a/packages/typescript-plugin/package.json +++ b/packages/typescript-plugin/package.json @@ -19,7 +19,7 @@ "license": "MIT", "devDependencies": { "@types/node": "^16.0.0", - "typescript": "^5.4.5", + "typescript": "^5.5.2", "svelte": "^3.57.0" }, "dependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index d610ebc40..7aad93cbe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,8 +9,8 @@ importers: .: dependencies: typescript: - specifier: ^5.4.5 - version: 5.4.5 + specifier: ^5.5.2 + version: 5.5.2 devDependencies: cross-env: specifier: ^7.0.2 @@ -20,7 +20,7 @@ importers: version: 3.2.5 ts-node: specifier: ^10.0.0 - version: 10.9.1(@types/node@16.18.32)(typescript@5.4.5) + version: 10.9.1(@types/node@16.18.32)(typescript@5.5.2) packages/language-server: dependencies: @@ -53,16 +53,16 @@ importers: version: 3.57.0 svelte-preprocess: specifier: ^5.1.3 - version: 5.1.3(svelte@3.57.0)(typescript@5.4.5) + version: 5.1.3(svelte@3.57.0)(typescript@5.5.2) svelte2tsx: specifier: workspace:~ version: link:../svelte2tsx typescript: - specifier: ^5.3.2 - version: 5.4.5 + specifier: ^5.5.2 + version: 5.5.2 typescript-auto-import-cache: - specifier: ^0.3.2 - version: 0.3.2 + specifier: ^0.3.3 + version: 0.3.3 vscode-css-languageservice: specifier: ~6.2.10 version: 6.2.10 @@ -111,7 +111,7 @@ importers: version: 11.1.2 ts-node: specifier: ^10.0.0 - version: 10.9.1(@types/node@16.18.32)(typescript@5.4.5) + version: 10.9.1(@types/node@16.18.32)(typescript@5.5.2) packages/svelte-check: dependencies: @@ -220,8 +220,8 @@ importers: specifier: ^2.4.0 version: 2.5.2 typescript: - specifier: ^5.4.5 - version: 5.4.5 + specifier: ^5.5.2 + version: 5.5.2 vscode-tmgrammar-test: specifier: ^0.0.11 version: 0.0.11 @@ -252,7 +252,7 @@ importers: version: 15.0.2(rollup@3.7.5) '@rollup/plugin-typescript': specifier: ^10.0.0 - version: 10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.4.5) + version: 10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.5.2) '@types/estree': specifier: ^0.0.42 version: 0.0.42 @@ -302,8 +302,8 @@ importers: specifier: ^2.4.0 version: 2.5.2 typescript: - specifier: ^5.4.5 - version: 5.4.5 + specifier: ^5.5.2 + version: 5.5.2 packages/typescript-plugin: dependencies: @@ -321,8 +321,8 @@ importers: specifier: ^3.57.0 version: 3.57.0 typescript: - specifier: ^5.4.5 - version: 5.4.5 + specifier: ^5.5.2 + version: 5.5.2 packages: @@ -1292,14 +1292,19 @@ packages: resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} engines: {node: '>=4'} - typescript-auto-import-cache@0.3.2: - resolution: {integrity: sha512-+laqe5SFL1vN62FPOOJSUDTZxtgsoOXjneYOXIpx5rQ4UMiN89NAtJLpqLqyebv9fgQ/IMeeTX+mQyRnwvJzvg==} + typescript-auto-import-cache@0.3.3: + resolution: {integrity: sha512-ojEC7+Ci1ij9eE6hp8Jl9VUNnsEKzztktP5gtYNRMrTmfXVwA1PITYYAkpxCvvupdSYa/Re51B6KMcv1CTZEUA==} typescript@5.4.5: resolution: {integrity: sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==} engines: {node: '>=14.17'} hasBin: true + typescript@5.5.2: + resolution: {integrity: sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==} + engines: {node: '>=14.17'} + hasBin: true + unist-util-stringify-position@3.0.3: resolution: {integrity: sha512-k5GzIBZ/QatR8N5X2y+drfpWG8IDBzdnVj6OInRNWm1oXrzydiaAT2OQiA8DPRRZyAKb9b6I2a6PxYklZD0gKg==} @@ -1504,6 +1509,15 @@ snapshots: rollup: 3.7.5 tslib: 2.5.2 + '@rollup/plugin-typescript@10.0.1(rollup@3.7.5)(tslib@2.5.2)(typescript@5.5.2)': + dependencies: + '@rollup/pluginutils': 5.0.2(rollup@3.7.5) + resolve: 1.22.2 + typescript: 5.5.2 + optionalDependencies: + rollup: 3.7.5 + tslib: 2.5.2 + '@rollup/pluginutils@5.0.2(rollup@3.7.5)': dependencies: '@types/estree': 1.0.1 @@ -2298,6 +2312,17 @@ snapshots: optionalDependencies: typescript: 5.4.5 + svelte-preprocess@5.1.3(svelte@3.57.0)(typescript@5.5.2): + dependencies: + '@types/pug': 2.0.6 + detect-indent: 6.1.0 + magic-string: 0.30.7 + sorcery: 0.11.0 + strip-indent: 3.0.0 + svelte: 3.57.0 + optionalDependencies: + typescript: 5.5.2 + svelte@3.57.0: {} tiny-glob@0.2.9: @@ -2309,7 +2334,7 @@ snapshots: dependencies: is-number: 7.0.0 - ts-node@10.9.1(@types/node@16.18.32)(typescript@5.4.5): + ts-node@10.9.1(@types/node@16.18.32)(typescript@5.5.2): dependencies: '@cspotcode/source-map-support': 0.8.1 '@tsconfig/node10': 1.0.9 @@ -2323,7 +2348,7 @@ snapshots: create-require: 1.1.1 diff: 4.0.2 make-error: 1.3.6 - typescript: 5.4.5 + typescript: 5.5.2 v8-compile-cache-lib: 3.0.1 yn: 3.1.1 @@ -2331,12 +2356,14 @@ snapshots: type-detect@4.0.8: {} - typescript-auto-import-cache@0.3.2: + typescript-auto-import-cache@0.3.3: dependencies: semver: 7.5.1 typescript@5.4.5: {} + typescript@5.5.2: {} + unist-util-stringify-position@3.0.3: dependencies: '@types/unist': 2.0.6