From a55bd766b64694fcbe67d008e58d001b5a76639d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Uhrbach?= Date: Fri, 12 Jan 2024 06:21:16 +0100 Subject: [PATCH] use @vue/reactivity insteadof vue --- package.json | 2 +- src/state.ts | 24 ++++----- src/status-bar.ts | 4 +- yarn.lock | 128 +--------------------------------------------- 4 files changed, 17 insertions(+), 141 deletions(-) diff --git a/package.json b/package.json index 5e05a5d..4f4e210 100644 --- a/package.json +++ b/package.json @@ -278,10 +278,10 @@ "webpack-cli": "^5.1.4" }, "dependencies": { + "@vue/reactivity": "^3.4.10", "axios": "^1.6.0", "deepl-node": "^1.11.0", "lint-staged": "^15.2.0", - "vue": "^3.1.5", "xstate": "4.23.0" }, "lint-staged": { diff --git a/src/state.ts b/src/state.ts index 83b80cc..06e4038 100644 --- a/src/state.ts +++ b/src/state.ts @@ -2,7 +2,7 @@ import * as vscode from 'vscode'; import * as debug from './debug'; import * as deepl from './deepl'; import { ExtensionState } from './types'; -import { reactive, watch, ref } from 'vue'; +import { reactive, effect, ref } from '@vue/reactivity'; import { getDefaultSourceLanguage, getDefaultTargetLanguage } from './helper'; const initialized = ref(false); @@ -69,17 +69,17 @@ export async function setup(context: vscode.ExtensionContext) { debug.write(`Initialized extension using state:`); debug.write(JSON.stringify(state, null, 2)); - watch(() => state.apiKey, () => config.update('apiKey', state.apiKey, vscode.ConfigurationTarget.Global)); - watch(() => state.formality, () => config.update('formality', state.formality, vscode.ConfigurationTarget.Global)); - watch(() => state.ignoreTags, () => config.update('ignoreTags', state.ignoreTags, vscode.ConfigurationTarget.Global)); - watch(() => state.tagHandling, () => config.update('tagHandling', state.tagHandling, vscode.ConfigurationTarget.Global)); - watch(() => state.splittingTags, () => config.update('splittingTags', state.splittingTags, vscode.ConfigurationTarget.Global)); - watch(() => state.nonSplittingTags, () => config.update('nonSplittingTags', state.nonSplittingTags, vscode.ConfigurationTarget.Global)); - watch(() => state.splitSentences, () => config.update('splitSentences', state.splitSentences, vscode.ConfigurationTarget.Global)); - watch(() => state.preserveFormatting, () => config.update('preserveFormatting', state.preserveFormatting, vscode.ConfigurationTarget.Global)); - watch(() => state.glossaryId, () => config.update('glossaryId', state.glossaryId, vscode.ConfigurationTarget.Global)); - watch(() => state.targetLanguage, () => context.workspaceState.update('deepl:targetLanguage', state.targetLanguage)); - watch(() => state.sourceLanguage, () => context.workspaceState.update('deepl:sourceLanguage', state.sourceLanguage)); + effect(() => config.update('apiKey', state.apiKey, vscode.ConfigurationTarget.Global)); + effect(() => config.update('formality', state.formality, vscode.ConfigurationTarget.Global)); + effect(() => config.update('ignoreTags', state.ignoreTags, vscode.ConfigurationTarget.Global)); + effect(() => config.update('tagHandling', state.tagHandling, vscode.ConfigurationTarget.Global)); + effect(() => config.update('splittingTags', state.splittingTags, vscode.ConfigurationTarget.Global)); + effect(() => config.update('nonSplittingTags', state.nonSplittingTags, vscode.ConfigurationTarget.Global)); + effect(() => config.update('splitSentences', state.splitSentences, vscode.ConfigurationTarget.Global)); + effect(() => config.update('preserveFormatting', state.preserveFormatting, vscode.ConfigurationTarget.Global)); + effect(() => config.update('glossaryId', state.glossaryId, vscode.ConfigurationTarget.Global)); + effect(() => context.workspaceState.update('deepl:targetLanguage', state.targetLanguage)); + effect(() => context.workspaceState.update('deepl:sourceLanguage', state.sourceLanguage)); const configurationChangeListener = vscode.workspace.onDidChangeConfiguration(e => { if (!e.affectsConfiguration('deepl')) { diff --git a/src/status-bar.ts b/src/status-bar.ts index d00e2df..96307ff 100644 --- a/src/status-bar.ts +++ b/src/status-bar.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; import * as deepl from './deepl'; import { state } from './state'; -import { watchEffect } from 'vue'; +import { effect } from '@vue/reactivity'; import { createMachine, assign, interpret } from 'xstate'; type StatusBarEvent = @@ -101,7 +101,7 @@ export function createStatusBarItem() { }) .start(); - watchEffect(() => { + effect(() => { service.send({ type: 'SET_API_KEY', value: state.apiKey }); service.send({ type: 'SET_TARGET_LANGUAGE', value: state.targetLanguage }); }); diff --git a/yarn.lock b/yarn.lock index 89113d6..148e8f8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7,11 +7,6 @@ resolved "https://registry.yarnpkg.com/@aashutoshrathi/word-wrap/-/word-wrap-1.2.6.tgz#bd9154aec9983f77b3a034ecaa015c2e4201f6cf" integrity sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA== -"@babel/parser@^7.23.6": - version "7.23.6" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.23.6.tgz#ba1c9e512bda72a47e285ae42aff9d2a635a9e3b" - integrity sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ== - "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -114,7 +109,7 @@ "@jridgewell/gen-mapping" "^0.3.0" "@jridgewell/trace-mapping" "^0.3.9" -"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14", "@jridgewell/sourcemap-codec@^1.4.15": +"@jridgewell/sourcemap-codec@^1.4.10", "@jridgewell/sourcemap-codec@^1.4.14": version "1.4.15" resolved "https://registry.yarnpkg.com/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz#d7c6e6755c78567a951e04ab52ef0fd26de59f32" integrity sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg== @@ -328,80 +323,13 @@ resolved "https://registry.yarnpkg.com/@ungap/structured-clone/-/structured-clone-1.2.0.tgz#756641adb587851b5ccb3e095daf27ae581c8406" integrity sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ== -"@vue/compiler-core@3.4.10": - version "3.4.10" - resolved "https://registry.yarnpkg.com/@vue/compiler-core/-/compiler-core-3.4.10.tgz#1da03a0b8df05f2054add983f7ad9171e5fbb7aa" - integrity sha512-53vxh7K9qbx+JILnGEhrFRyr7H7e4NdT8RuTNU3m6HhJKFvcAqFTNXpYMHnyuAzzRGdsbsYHBgQC3H6xEXTG6w== - dependencies: - "@babel/parser" "^7.23.6" - "@vue/shared" "3.4.10" - entities "^4.5.0" - estree-walker "^2.0.2" - source-map-js "^1.0.2" - -"@vue/compiler-dom@3.4.10": - version "3.4.10" - resolved "https://registry.yarnpkg.com/@vue/compiler-dom/-/compiler-dom-3.4.10.tgz#aaed699125ea6da2daf540bf8f68ade08e95086b" - integrity sha512-QAALBJksIFpXGYuo74rtMgnwpVZDvd3kYbUa4gYX9s/5QiqEvZSgbKtOdUGydXcxKPt3ifC+0/bhPVHXN2694A== - dependencies: - "@vue/compiler-core" "3.4.10" - "@vue/shared" "3.4.10" - -"@vue/compiler-sfc@3.4.10": - version "3.4.10" - resolved "https://registry.yarnpkg.com/@vue/compiler-sfc/-/compiler-sfc-3.4.10.tgz#3ff0abf204d7a24317ad2111e087b7b775970f6b" - integrity sha512-sTOssaQySgrMjrhZxmAqdp6n+E51VteIVIDaOR537H2P63DyzMmig21U0XXFxiXmMIfrK91lAInnc+bIAYemGw== - dependencies: - "@babel/parser" "^7.23.6" - "@vue/compiler-core" "3.4.10" - "@vue/compiler-dom" "3.4.10" - "@vue/compiler-ssr" "3.4.10" - "@vue/shared" "3.4.10" - estree-walker "^2.0.2" - magic-string "^0.30.5" - postcss "^8.4.32" - source-map-js "^1.0.2" - -"@vue/compiler-ssr@3.4.10": - version "3.4.10" - resolved "https://registry.yarnpkg.com/@vue/compiler-ssr/-/compiler-ssr-3.4.10.tgz#526a55c718249de43e13914b0df03ddadfcc3cb1" - integrity sha512-Y90TL1abretWbUiK5rv+9smS1thCHE5sSuhZgiLh6cxgZ2Pcy3BEvDd3reID0iwNcTdMbTeE6NI3Aq4Mux6hqQ== - dependencies: - "@vue/compiler-dom" "3.4.10" - "@vue/shared" "3.4.10" - -"@vue/reactivity@3.4.10": +"@vue/reactivity@^3.4.10": version "3.4.10" resolved "https://registry.yarnpkg.com/@vue/reactivity/-/reactivity-3.4.10.tgz#566ef7c19629b95d273d4224ac7f51150e358d4c" integrity sha512-SmGGpo37LzPcAFTopHNIJRNVOQfma9YgyPkAzx9/TJ01lbCCYigS28hEcY1hjiJ1PRK8iVX62Ov5yzmUgYH/pQ== dependencies: "@vue/shared" "3.4.10" -"@vue/runtime-core@3.4.10": - version "3.4.10" - resolved "https://registry.yarnpkg.com/@vue/runtime-core/-/runtime-core-3.4.10.tgz#b2eb152d26760dd7e3c362a1db2d7105826c1cc2" - integrity sha512-Ri2Cz9sFr66AEUewGUK8IXhIUAhshTHVUGuJR8pqMbtjIds+zPa8QPO5UZImGMQ8HTY7eEpKwztCct9V3+Iqug== - dependencies: - "@vue/reactivity" "3.4.10" - "@vue/shared" "3.4.10" - -"@vue/runtime-dom@3.4.10": - version "3.4.10" - resolved "https://registry.yarnpkg.com/@vue/runtime-dom/-/runtime-dom-3.4.10.tgz#89974d8aa7e9555f952a92c3f03ed1713df04b6f" - integrity sha512-ROsdi5M2niRDmjXJNZ8KKiGwXyG1FO8l9n6sCN0kaJEHbjWkuigu96YAI3fK/AWUZPSXXEcMEBVPC6rL3mmUuA== - dependencies: - "@vue/runtime-core" "3.4.10" - "@vue/shared" "3.4.10" - csstype "^3.1.3" - -"@vue/server-renderer@3.4.10": - version "3.4.10" - resolved "https://registry.yarnpkg.com/@vue/server-renderer/-/server-renderer-3.4.10.tgz#722cc408d926344c695456f62e918d961b41cd4f" - integrity sha512-WpCBAhesLq44JKWfdFqb+Bi4ACUW0d8x1z90GnE0spccsAlEDMXV5nm+pwXLyW0OdP2iPrO/n/QMJh4B1v9Ciw== - dependencies: - "@vue/compiler-ssr" "3.4.10" - "@vue/shared" "3.4.10" - "@vue/shared@3.4.10": version "3.4.10" resolved "https://registry.yarnpkg.com/@vue/shared/-/shared-3.4.10.tgz#d2399901586bdb1bc727c8d61f0e543b25b2461c" @@ -798,11 +726,6 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3: shebang-command "^2.0.0" which "^2.0.1" -csstype@^3.1.3: - version "3.1.3" - resolved "https://registry.yarnpkg.com/csstype/-/csstype-3.1.3.tgz#d80ff294d114fb0e6ac500fbf85b60137d7eff81" - integrity sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw== - debug@4.3.4, debug@^4.3.1, debug@^4.3.2, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" @@ -882,11 +805,6 @@ enhanced-resolve@^5.0.0, enhanced-resolve@^5.15.0: graceful-fs "^4.2.4" tapable "^2.2.0" -entities@^4.5.0: - version "4.5.0" - resolved "https://registry.yarnpkg.com/entities/-/entities-4.5.0.tgz#5d268ea5e7113ec74c4d033b79ea5a35a488fb48" - integrity sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw== - envinfo@^7.7.3: version "7.11.0" resolved "https://registry.yarnpkg.com/envinfo/-/envinfo-7.11.0.tgz#c3793f44284a55ff8c82faf1ffd91bc6478ea01f" @@ -1005,11 +923,6 @@ estraverse@^5.1.0, estraverse@^5.2.0: resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-5.3.0.tgz#2eea5290702f26ab8fe5370370ff86c965d21123" integrity sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA== -estree-walker@^2.0.2: - version "2.0.2" - resolved "https://registry.yarnpkg.com/estree-walker/-/estree-walker-2.0.2.tgz#52f010178c2a4c117a7757cfe942adb7d2da4cac" - integrity sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w== - esutils@^2.0.2: version "2.0.3" resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" @@ -1533,13 +1446,6 @@ lru-cache@^6.0.0: resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.1.0.tgz#2098d41c2dc56500e6c88584aa656c84de7d0484" integrity sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag== -magic-string@^0.30.5: - version "0.30.5" - resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.30.5.tgz#1994d980bd1c8835dc6e78db7cbd4ae4f24746f9" - integrity sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA== - dependencies: - "@jridgewell/sourcemap-codec" "^1.4.15" - make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" @@ -1609,11 +1515,6 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -nanoid@^3.3.7: - version "3.3.7" - resolved "https://registry.yarnpkg.com/nanoid/-/nanoid-3.3.7.tgz#d0c301a691bc8d54efa0a2226ccf3fe2fd656bd8" - integrity sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g== - natural-compare@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" @@ -1769,15 +1670,6 @@ pkg-dir@^4.2.0: dependencies: find-up "^4.0.0" -postcss@^8.4.32: - version "8.4.33" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.33.tgz#1378e859c9f69bf6f638b990a0212f43e2aaa742" - integrity sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg== - dependencies: - nanoid "^3.3.7" - picocolors "^1.0.0" - source-map-js "^1.0.2" - prelude-ls@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396" @@ -1948,11 +1840,6 @@ slice-ansi@^7.0.0: ansi-styles "^6.2.1" is-fullwidth-code-point "^5.0.0" -source-map-js@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" - integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw== - source-map-support@~0.5.20: version "0.5.21" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.21.tgz#04fe7c7f9e1ed2d662233c28cb2b35b9f63f6e4f" @@ -2167,17 +2054,6 @@ v8-compile-cache-lib@^3.0.1: resolved "https://registry.yarnpkg.com/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz#6336e8d71965cb3d35a1bbb7868445a7c05264bf" integrity sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg== -vue@^3.1.5: - version "3.4.10" - resolved "https://registry.yarnpkg.com/vue/-/vue-3.4.10.tgz#d51754fecaee8b0c30482b51c823eba5627191fc" - integrity sha512-c+O8qGqdWPF9joTCzMGeDDedViooh6c8RY3+eW5+6GCAIY8YjChmU06LsUu0PnMZbIk1oKUoJTqKzmghYtFypw== - dependencies: - "@vue/compiler-dom" "3.4.10" - "@vue/compiler-sfc" "3.4.10" - "@vue/runtime-dom" "3.4.10" - "@vue/server-renderer" "3.4.10" - "@vue/shared" "3.4.10" - watchpack@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-2.4.0.tgz#fa33032374962c78113f93c7f2fb4c54c9862a5d"