From ad5ee7da012f7f1896647994b069fceeeb254cd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90=20Kevin=20Deng?= Date: Fri, 13 Dec 2024 02:28:39 +0800 Subject: [PATCH] feat: support vscode with tsx --- src/detect.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/detect.ts b/src/detect.ts index 0184c9f..03256f3 100644 --- a/src/detect.ts +++ b/src/detect.ts @@ -135,9 +135,14 @@ async function isRuntimeSupportsTsx() { ) { return false } - // Disable in Electron + + // not supported in vscode < 1.96: https://github.com/microsoft/vscode/issues/224426 + // magic number 10629634 is from + // https://github.com/microsoft/vscode/blob/bee3e32d012157a94cbc431080b743775fe713c5/.npmrc + // eslint-disable-next-line node/prefer-global/process - if (typeof process !== 'undefined' && typeof process.versions.electron === 'string') { + const msBuildVersion = typeof process !== 'undefined' && process.versions['microsoft-build'] + if (msBuildVersion && Number(msBuildVersion) < 10629634) { return false } return true