diff --git a/.npmrc b/.npmrc index ae90f70..7969496 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1,2 @@ ignore-workspace-root-check=true +shell-emulator=true diff --git a/package.json b/package.json index 6ced9a2..b87484d 100644 --- a/package.json +++ b/package.json @@ -49,8 +49,8 @@ } }, "scripts": { - "build": "tsup src/index.ts --external vscode", - "dev": "nr build --watch", + "build": "NODE_ENV=production tsup src/index.ts --external vscode", + "dev": "NODE_ENV=dev nr build --watch", "lint": "eslint .", "vscode:prepublish": "nr build", "publish": "vsce publish --no-dependencies", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 9430c62..3572eac 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1599,6 +1599,7 @@ packages: /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + requiresBuild: true dev: true /emoji-regex@9.2.2: @@ -2593,6 +2594,7 @@ packages: /is-fullwidth-code-point@3.0.0: resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==} engines: {node: '>=8'} + requiresBuild: true dev: true /is-glob@4.0.3: diff --git a/src/index.ts b/src/index.ts index 9813006..756b0d1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -83,10 +83,10 @@ export function activate() { await commands.executeCommand('editor.action.goToDeclaration') } - const tab = window.tabGroups.activeTabGroup.activeTab + const { activeTab } = window.tabGroups.activeTabGroup const isNeedCloseDts = workspace.getConfiguration(`${extName}`).get('closeDts') - if (isNeedCloseDts && tab && tab !== window.tabGroups.activeTabGroup.activeTab) - await window.tabGroups.close(tab) + if (isNeedCloseDts && activeTab?.label.endsWith('.d.ts')) + await window.tabGroups.close(activeTab) } await fn() diff --git a/tsup.config.ts b/tsup.config.ts index 747332d..1d19f33 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -1,3 +1,4 @@ +import process from 'node:process' import { defineConfig } from 'tsup' export default defineConfig({ @@ -7,6 +8,7 @@ export default defineConfig({ format: ['cjs'], shims: false, dts: false, + sourcemap: process.env.NODE_ENV === 'development', external: [ 'vscode', ],