From 42a0bdde84a222414df33edb592affb38291cdd9 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Sun, 17 May 2026 01:17:02 -0300 Subject: [PATCH 1/7] fix: increase reconnect timeout and handle debug session termination --- src/debug-adapter/nativeScriptDebugAdapter.ts | 8 +++++++- src/main.ts | 6 ++++++ src/services/buildService.ts | 10 +++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/debug-adapter/nativeScriptDebugAdapter.ts b/src/debug-adapter/nativeScriptDebugAdapter.ts index b6c1a0f..9de732f 100644 --- a/src/debug-adapter/nativeScriptDebugAdapter.ts +++ b/src/debug-adapter/nativeScriptDebugAdapter.ts @@ -14,7 +14,7 @@ import { DebugProtocol } from '@vscode/debugprotocol'; import * as extProtocol from '../common/extensionProtocol'; import { NativeScriptSourceMapTransformer } from './nativeScriptSourceMapTransformer'; -const reconnectAfterLiveSyncTimeout = 10 * 1000; +const reconnectAfterLiveSyncTimeout = 60 * 1000; export class NativeScriptDebugAdapter extends ChromeDebugAdapter { private _idCounter = 0; @@ -44,6 +44,12 @@ export class NativeScriptDebugAdapter extends ChromeDebugAdapter { public disconnect(args: any): void { this.isDisconnecting = true; + + if (this.portWaitingResolve) { + this.portWaitingResolve(); + this.portWaitingResolve = null; + } + if (!this.isLiveSyncRestart) { this.callRemoteMethod('buildService', 'disconnect'); } diff --git a/src/main.ts b/src/main.ts index 3c13170..526062b 100644 --- a/src/main.ts +++ b/src/main.ts @@ -101,6 +101,12 @@ export function activate(context: vscode.ExtensionContext) { return runCommand(new AndroidProject(vscode.workspace.rootPath, services.cli())); }); + context.subscriptions.push(vscode.debug.onDidTerminateDebugSession((session) => { + if (session.type === 'nativescript') { + services.buildService.disconnect(); + } + })); + context.subscriptions.push(vscode.debug.onDidReceiveDebugSessionCustomEvent((event) => { if (event.event === extProtocol.BEFORE_DEBUG_START) { channel.show(); diff --git a/src/services/buildService.ts b/src/services/buildService.ts index 4dd43b9..e03e24c 100644 --- a/src/services/buildService.ts +++ b/src/services/buildService.ts @@ -90,7 +90,15 @@ export class BuildService { cliCommand.tnsOutputEventEmitter.on('readyForConnection', (connectionToken: string | number) => { this._logger.log(`[NSDebugAdapter] Ready to attach to application on ${connectionToken}\n`); args.port = connectionToken; - vscode.debug.activeDebugSession && vscode.debug.activeDebugSession.customRequest('onPortReceived', { port: connectionToken }); + const session = vscode.debug.activeDebugSession; + if (session) { + session.customRequest('onPortReceived', { port: connectionToken }).then( + () => this._logger.log(`[NSDebugAdapter] Port ${connectionToken} delivered to debug session\n`), + (err) => this._logger.log(`[NSDebugAdapter] Failed to deliver port to debug session: ${err}\n`), + ); + } else { + this._logger.log(`[NSDebugAdapter] No active debug session to deliver port ${connectionToken}\n`); + } res(connectionToken); }); From e0cbeff7cf1bf2ab30bf6da2fff221322605ee59 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Fri, 6 Nov 2026 14:02:58 -0300 Subject: [PATCH 2/7] refactor: replace chrome-debug-core with js-debug child sessions Inline debug adapter starts ns debug, reads the debug port from CLI output and attaches VS Code's built-in JavaScript debugger (pwa-node) over WebSocket. DebugManager reattaches the child session on LiveSync restarts. Also: engine ^1.109, strict TS targeting es2022, prettier, nsPath setting, modern launch/tasks configs. --- .prettierrc | 6 + .vscode/launch.json | 63 +- .vscode/tasks.json | 46 +- package-lock.json | 232 ++--- package.json | 28 +- src/analytics/analyticsBaseInfo.ts | 16 +- src/analytics/analyticsService.ts | 179 ++-- src/analytics/guaService.ts | 88 +- src/common/extensionProtocol.ts | 14 - src/common/logger.ts | 14 +- src/common/utilities.ts | 36 +- src/common/workspaceConfigService.ts | 20 +- src/debug-adapter/debugManager.ts | 313 +++++++ src/debug-adapter/nativeScriptDebug.ts | 23 - src/debug-adapter/nativeScriptDebugAdapter.ts | 414 +++------ .../nativeScriptPathTransformer.ts | 112 --- .../nativeScriptSourceMapTransformer.ts | 133 --- .../nativeScriptTargetDiscovery.ts | 28 - src/main.ts | 218 +++-- src/project/androidProject.ts | 108 ++- src/project/iosProject.ts | 85 +- src/project/nativeScriptCli.ts | 88 +- src/project/project.ts | 68 +- src/project/streamScanner.ts | 170 ++-- src/services/buildService.ts | 283 +++--- src/services/channelLogger.ts | 20 +- src/services/extensionHostServices.ts | 56 +- src/services/iOSTeamService.ts | 149 ++-- .../language-services/autocomplete.ts | 44 +- .../language-services/hover/layout-hover.ts | 246 +++--- .../language-services/hover/ui-enum-hover.ts | 834 +++++++++--------- .../language-services/hover/widget-hover.ts | 763 ++++++++-------- src/services/language-services/suggestions.ts | 581 ++++++------ src/services/services.ts | 30 +- src/tests/nativeScriptDebugAdapter.tests.ts | 277 ++---- .../nativeScriptPathTransformer.tests.ts | 41 - .../nativeScriptTargetDiscovery.tests.ts | 45 - src/tests/pathTransformData.ts | 152 ---- src/tsconfig.json | 16 +- 39 files changed, 2662 insertions(+), 3377 deletions(-) create mode 100644 .prettierrc delete mode 100644 src/common/extensionProtocol.ts create mode 100644 src/debug-adapter/debugManager.ts delete mode 100644 src/debug-adapter/nativeScriptDebug.ts delete mode 100644 src/debug-adapter/nativeScriptPathTransformer.ts delete mode 100644 src/debug-adapter/nativeScriptSourceMapTransformer.ts delete mode 100644 src/debug-adapter/nativeScriptTargetDiscovery.ts delete mode 100644 src/tests/nativeScriptPathTransformer.tests.ts delete mode 100644 src/tests/nativeScriptTargetDiscovery.tests.ts delete mode 100644 src/tests/pathTransformData.ts diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..8c26293 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "printWidth": 120, + "tabWidth": 2, + "useTabs": false +} diff --git a/.vscode/launch.json b/.vscode/launch.json index 2da8ae4..4cd1855 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -1,45 +1,20 @@ { - "version": "0.1.0", - "configurations": [ - { - "name": "Launch as server", - "type": "node", - "request": "launch", - "program": "${workspaceRoot}/out/debug-adapter/nativeScriptDebug.js", - "runtimeArgs": ["--nolazy"], - "args": [ "--server=4712" ], - "stopOnEntry": false, - "sourceMaps": true, - "outFiles": [ "${workspaceFolder}/out/**/*.js" ], - "cwd": "${workspaceFolder}" - }, - { - "name": "Launch in extension host", - "type": "extensionHost", - "request": "launch", - // Path to VSCode executablensDebugClient - "runtimeExecutable": "${execPath}", - "args": [ - "--extensionDevelopmentPath=${workspaceRoot}" - ], - "stopOnEntry": false, - "sourceMaps": true, - "outFiles": [ "${workspaceFolder}/out/**/*.js" ] - }, - { - "name": "Run tests", - "type": "node", - "request": "launch", - "runtimeExecutable": "npm", - "runtimeArgs": [ - "run", "test", "--" - ] - } - ], - "compounds": [ - { - "name": "Extension + Server", - "configurations": [ "Launch in extension host", "Launch as server" ] - } - ] -} \ No newline at end of file + "version": "0.2.0", + "configurations": [ + { + "name": "Run Extension", + "type": "extensionHost", + "request": "launch", + "args": ["--extensionDevelopmentPath=${workspaceFolder}"], + "outFiles": ["${workspaceFolder}/out/**/*.js"], + "preLaunchTask": "${defaultBuildTask}" + }, + { + "name": "Run Tests", + "type": "node", + "request": "launch", + "runtimeExecutable": "npm", + "runtimeArgs": ["run", "test", "--"] + } + ] +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index d09de27..11d616f 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,27 +1,23 @@ { - "version": "2.0.0", - "windows": { - "command": ".\\node_modules\\.bin\\tsc" + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "type": "npm", + "script": "build", + "problemMatcher": "$tsc", + "group": { + "kind": "build", + "isDefault": true + } }, - "command": "./node_modules/.bin/tsc", - "args": [ - "-p", - "./src" - ], - "problemMatcher": "$tsc", - "tasks": [ - { - "label": "./node_modules/.bin/tsc", - "type": "shell", - "args": [ - "-p", - "./src" - ], - "problemMatcher": "$tsc", - "group": { - "_id": "build", - "isDefault": false - } - } - ] -} \ No newline at end of file + { + "label": "watch", + "type": "npm", + "script": "build:watch", + "problemMatcher": "$tsc-watch", + "isBackground": true, + "group": "build" + } + ] +} diff --git a/package-lock.json b/package-lock.json index b91404f..d4eb287 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,41 +1,42 @@ { "name": "nativescript", - "version": "0.12.0", + "version": "0.12.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "nativescript", - "version": "0.12.0", + "version": "0.12.5", "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { - "@vscode/debugadapter": "^1.64.0", + "@vscode/debugadapter": "^1.68.0", "lodash": "4.17.21", "semver": "7.5.4", "strip-json-comments": "~3.1.1", "universal-analytics": "0.4.23", - "uuid": "9.0.1", - "vscode-chrome-debug-core": "^6.8.11" + "uuid": "9.0.1" }, "devDependencies": { "@types/lodash": "4.14.121", "@types/mocha": "5.2.6", - "@types/node": "18.x", + "@types/node": "^22.19.19", "@types/proxyquire": "1.3.31", "@types/semver": "7.5.6", "@types/sinon": "7.0.13", "@types/universal-analytics": "0.4.1", - "@types/vscode": "^1.85.0", - "@vscode/debugprotocol": "^1.64.0", + "@types/uuid": "^10.0.0", + "@types/vscode": "^1.120.0", + "@vscode/debugprotocol": "^1.68.0", "@vscode/vsce": "^2.22.0", "cpx": "1.5.0", "mocha": "5.2.0", + "prettier": "^3.8.3", "proxyquire": "2.1.3", "sinon": "7.4.2", "typescript": "^5.3.3" }, "engines": { - "vscode": "^1.85.0" + "vscode": "^1.109.0" } }, "node_modules/@sinonjs/commons": { @@ -87,12 +88,13 @@ "dev": true }, "node_modules/@types/node": { - "version": "18.19.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.19.9.tgz", - "integrity": "sha512-oZFKlC8l5YtzGQNT4zC2PiSSKzQVZ8bAwwd+EYdPLtyk0nSEq6O16SkK+rkkT2eflDAbormJgEF3QnH3oDrTSw==", + "version": "22.19.19", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.19.tgz", + "integrity": "sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==", "dev": true, + "license": "MIT", "dependencies": { - "undici-types": "~5.26.4" + "undici-types": "~6.21.0" } }, "node_modules/@types/proxyquire": { @@ -113,38 +115,43 @@ "integrity": "sha512-d7c/C/+H/knZ3L8/cxhicHUiTDxdgap0b/aNJfsmLwFu/iOP17mdgbQsbHA3SJmrzsjD0l3UEE5SN4xxuz5ung==", "dev": true }, - "node_modules/@types/source-map": { - "version": "0.1.29", - "resolved": "https://registry.npmjs.org/@types/source-map/-/source-map-0.1.29.tgz", - "integrity": "sha512-xlBgdqJSoyoGkjheLtsSFIRxDUMJpCGw7BwmmjH+nxUM9VYdOfRnPEU5wkvr6BjhB+JvVABCbi8Xiaso4aD3TQ==" - }, "node_modules/@types/universal-analytics": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/@types/universal-analytics/-/universal-analytics-0.4.1.tgz", "integrity": "sha512-AZSPpDUEZ4mAgO9geHc62dp/xCLmBJ1yIpbgTq5W/cWcVQsxmU/FyKwYKHXk2hnT9TAmYVFFdAijMrCdYjuHsA==", "dev": true }, + "node_modules/@types/uuid": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", + "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/vscode": { - "version": "1.85.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.85.0.tgz", - "integrity": "sha512-CF/RBon/GXwdfmnjZj0WTUMZN5H6YITOfBCP4iEZlOtVQXuzw6t7Le7+cR+7JzdMrnlm7Mfp49Oj2TuSXIWo3g==", - "dev": true + "version": "1.120.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.120.0.tgz", + "integrity": "sha512-feaT4Rst+FkTch5zz/ZbNCxoIvo55YU80Be2kiL7OJcod4+CUYf2lUBPdIJzozNnSEMq1VRTGrWEcCGFB3fBmA==", + "dev": true, + "license": "MIT" }, "node_modules/@vscode/debugadapter": { - "version": "1.64.0", - "resolved": "https://registry.npmjs.org/@vscode/debugadapter/-/debugadapter-1.64.0.tgz", - "integrity": "sha512-XygE985qmNCzJExDnam4bErK6FG9Ck8S5TRPDNESwkt7i3OXqw5a3vYb7Dteyhz9YMEf7hwhFoT46Mjc45nJUg==", + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/@vscode/debugadapter/-/debugadapter-1.68.0.tgz", + "integrity": "sha512-D6gk5Fw2y4FV8oYmltoXpj+VAZexxJFopN/mcZ6YcgzQE9dgq2L45Aj3GLxScJOD6GeLILcxJIaA8l3v11esGg==", + "license": "MIT", "dependencies": { - "@vscode/debugprotocol": "1.64.0" + "@vscode/debugprotocol": "1.68.0" }, "engines": { "node": ">=14" } }, "node_modules/@vscode/debugprotocol": { - "version": "1.64.0", - "resolved": "https://registry.npmjs.org/@vscode/debugprotocol/-/debugprotocol-1.64.0.tgz", - "integrity": "sha512-Zhf3KvB+J04M4HPE2yCvEILGVtPixXUQMLBvx4QcAtjhc5lnwlZbbt80LCsZO2B+2BH8RMgVXk3QQ5DEzEne2Q==" + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/@vscode/debugprotocol/-/debugprotocol-1.68.0.tgz", + "integrity": "sha512-2J27dysaXmvnfuhFGhfeuxfHRXunqNPxtBoR3koiTOA9rdxWNDTa1zIFLCFMSHJ9MPTPKFcBeblsyaCJCIlQxg==", + "license": "MIT" }, "node_modules/@vscode/vsce": { "version": "2.22.0", @@ -308,11 +315,6 @@ } ] }, - "node_modules/async-limiter": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", - "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==" - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -366,7 +368,8 @@ "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true }, "node_modules/base": { "version": "0.11.2", @@ -492,6 +495,7 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -740,19 +744,11 @@ "node": ">=0.10.0" } }, - "node_modules/color": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz", - "integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA==", - "dependencies": { - "color-convert": "^1.9.3", - "color-string": "^1.6.0" - } - }, "node_modules/color-convert": { "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, "dependencies": { "color-name": "1.1.3" } @@ -760,16 +756,8 @@ "node_modules/color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==" - }, - "node_modules/color-string": { - "version": "1.9.1", - "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz", - "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==", - "dependencies": { - "color-name": "^1.0.0", - "simple-swizzle": "^0.2.2" - } + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true }, "node_modules/combined-stream": { "version": "1.0.8", @@ -803,7 +791,8 @@ "node_modules/concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true }, "node_modules/copy-descriptor": { "version": "0.1.1", @@ -987,11 +976,6 @@ "node": ">=8" } }, - "node_modules/devtools-protocol": { - "version": "0.0.588169", - "resolved": "https://registry.npmjs.org/devtools-protocol/-/devtools-protocol-0.0.588169.tgz", - "integrity": "sha512-DDGCT3YFiamX4jRPqg4galOrQS8DsU0j+xM5iaR0YB5TM1fjCZejQ7MSe9ByIMIq4IsnULY/4Qp3TBWAUjMgXw==" - }, "node_modules/diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -1320,7 +1304,8 @@ "node_modules/fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true }, "node_modules/fsevents": { "version": "1.2.13", @@ -1393,6 +1378,7 @@ "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -1698,6 +1684,7 @@ "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, "dependencies": { "once": "^1.3.0", "wrappy": "1" @@ -1706,7 +1693,8 @@ "node_modules/inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, "node_modules/ini": { "version": "1.3.8", @@ -1727,11 +1715,6 @@ "node": ">= 0.10" } }, - "node_modules/is-arrayish": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.2.tgz", - "integrity": "sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==" - }, "node_modules/is-binary-path": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", @@ -2184,6 +2167,7 @@ "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -2459,11 +2443,6 @@ "dev": true, "optional": true }, - "node_modules/noice-json-rpc": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/noice-json-rpc/-/noice-json-rpc-1.2.0.tgz", - "integrity": "sha512-Wm+otW+drKzdqlSPoSwj34tUEq/Xj1gX6Cr2avrykvTW4IY7d3ngLmP+PErALzS0s9nYRokXvYDM54sbFvLlDA==" - }, "node_modules/normalize-path": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", @@ -2603,6 +2582,7 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, "dependencies": { "wrappy": "1" } @@ -2678,6 +2658,7 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, "engines": { "node": ">=0.10.0" } @@ -2759,6 +2740,22 @@ "node": ">=0.10.0" } }, + "node_modules/prettier": { + "version": "3.8.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz", + "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -3488,14 +3485,6 @@ "simple-concat": "^1.0.0" } }, - "node_modules/simple-swizzle": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.2.tgz", - "integrity": "sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==", - "dependencies": { - "is-arrayish": "^0.3.1" - } - }, "node_modules/sinon": { "version": "7.4.2", "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.4.2.tgz", @@ -3633,14 +3622,6 @@ "node": ">=0.10.0" } }, - "node_modules/source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/source-map-resolve": { "version": "0.5.3", "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", @@ -3987,10 +3968,11 @@ "dev": true }, "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==", - "dev": true + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" }, "node_modules/union-value": { "version": "1.0.1", @@ -4170,73 +4152,11 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, - "node_modules/vscode-chrome-debug-core": { - "version": "6.8.11", - "resolved": "https://registry.npmjs.org/vscode-chrome-debug-core/-/vscode-chrome-debug-core-6.8.11.tgz", - "integrity": "sha512-SZZHhKeatXCDqlD+6E/EtEJqcteDJD6y3IVV+6VXX1d1wxPxlJyYcoLhtnX/X5Vvo/5CEm5s8DNGkFoiHgxOUw==", - "dependencies": { - "@types/source-map": "^0.1.27", - "color": "^3.1.3", - "devtools-protocol": "0.0.588169", - "glob": "^7.1.3", - "noice-json-rpc": "^1.2.0", - "source-map": "^0.6.1", - "vscode-debugadapter": "^1.47.0", - "vscode-debugprotocol": "^1.37.0", - "vscode-nls": "^4.0.0", - "vscode-uri": "^2.0.2", - "ws": "^6.0.0" - } - }, - "node_modules/vscode-debugadapter": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/vscode-debugadapter/-/vscode-debugadapter-1.51.0.tgz", - "integrity": "sha512-mObaXD5/FH/z6aL2GDuyCLbnwLsYRCAJWgFid01vKW9Y5Si8OvINK+Tn+Yl/lRUbetjNuZW3j1euMEz6z8Yzqg==", - "deprecated": "This package has been renamed to @vscode/debugadapter, please update to the new name", - "dependencies": { - "mkdirp": "^1.0.4", - "vscode-debugprotocol": "1.51.0" - } - }, - "node_modules/vscode-debugadapter/node_modules/mkdirp": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", - "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "bin": { - "mkdirp": "bin/cmd.js" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/vscode-debugprotocol": { - "version": "1.51.0", - "resolved": "https://registry.npmjs.org/vscode-debugprotocol/-/vscode-debugprotocol-1.51.0.tgz", - "integrity": "sha512-dzKWTMMyebIMPF1VYMuuQj7gGFq7guR8AFya0mKacu+ayptJfaRuM0mdHCqiOth4FnRP8mPhEroFPx6Ift8wHA==", - "deprecated": "This package has been renamed to @vscode/debugprotocol, please update to the new name" - }, - "node_modules/vscode-nls": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/vscode-nls/-/vscode-nls-4.1.2.tgz", - "integrity": "sha512-7bOHxPsfyuCqmP+hZXscLhiHwe7CSuFE4hyhbs22xPIhQ4jv99FcR4eBzfYYVLP356HNFpdvz63FFb/xw6T4Iw==" - }, - "node_modules/vscode-uri": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-2.1.2.tgz", - "integrity": "sha512-8TEXQxlldWAuIODdukIb+TR5s+9Ds40eSJrw+1iDDA9IFORPjMELarNQE3myz5XIkWWpdprmJjm1/SxMlWOC8A==" - }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" - }, - "node_modules/ws": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.2.tgz", - "integrity": "sha512-zmhltoSR8u1cnDsD43TX59mzoMZsLKqUweyYBAIvTngR3shc0W6aOZylZmq/7hqyVxPdi+5Ud2QInblgyE72fw==", - "dependencies": { - "async-limiter": "~1.0.0" - } + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true }, "node_modules/xml2js": { "version": "0.5.0", diff --git a/package.json b/package.json index 0006206..ab7e4f8 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "publisher": "NativeScript", "bugs": "https://github.com/nativescript-community/nativescript-vscode-extension/issues", "engines": { - "vscode": "^1.85.0" + "vscode": "^1.109.0" }, "homepage": "https://www.nativescript.org/", "categories": [ @@ -25,30 +25,31 @@ ], "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { + "@vscode/debugadapter": "^1.68.0", "lodash": "4.17.21", "semver": "7.5.4", "strip-json-comments": "~3.1.1", "universal-analytics": "0.4.23", - "uuid": "9.0.1", - "vscode-chrome-debug-core": "^6.8.11", - "@vscode/debugadapter": "^1.64.0" + "uuid": "9.0.1" }, "devDependencies": { "@types/lodash": "4.14.121", "@types/mocha": "5.2.6", - "@types/node": "18.x", + "@types/node": "^22.19.19", "@types/proxyquire": "1.3.31", "@types/semver": "7.5.6", "@types/sinon": "7.0.13", "@types/universal-analytics": "0.4.1", - "@types/vscode": "^1.85.0", + "@types/uuid": "^10.0.0", + "@types/vscode": "^1.120.0", + "@vscode/debugprotocol": "^1.68.0", + "@vscode/vsce": "^2.22.0", "cpx": "1.5.0", "mocha": "5.2.0", + "prettier": "^3.8.3", "proxyquire": "2.1.3", "sinon": "7.4.2", - "typescript": "^5.3.3", - "@vscode/vsce": "^2.22.0", - "@vscode/debugprotocol": "^1.64.0" + "typescript": "^5.3.3" }, "scripts": { "clean": "git clean -fdx", @@ -56,7 +57,6 @@ "build:watch": "tsc -w -p ./src && cpx src/common/*.sh out/common", "package": "vsce package", "full-build": "npm run clean && npm install && npm run build && npm run package", - "launch-as-server": "node --nolazy ./out/debug-adapter/nativeScriptDebug.js --server=4712", "test": "mocha --opts ./src/tests/config/mocha.opts", "tslint": "tslint -p ./src/tsconfig.json -c tslint.json" }, @@ -77,9 +77,9 @@ "default": false, "description": "Enables the extension tracking." }, - "nativescript.tnsPath": { + "nativescript.nsPath": { "type": "string", - "default": "tns", + "default": "ns", "description": "Path to the NativeScript CLI executable." }, "nativescript.iosTeamId": { @@ -136,8 +136,6 @@ "typescript" ] }, - "program": "./out/debug-adapter/nativeScriptDebug.js", - "runtime": "node", "initialConfigurations": [ { "name": "Launch on iOS", @@ -374,4 +372,4 @@ } ] } -} \ No newline at end of file +} diff --git a/src/analytics/analyticsBaseInfo.ts b/src/analytics/analyticsBaseInfo.ts index 6651382..ec49a66 100644 --- a/src/analytics/analyticsBaseInfo.ts +++ b/src/analytics/analyticsBaseInfo.ts @@ -1,13 +1,13 @@ export enum OperatingSystem { - Windows, - Linux, - OSX, - Other, + Windows, + Linux, + OSX, + Other, } export interface IAnalyticsBaseInfo { - operatingSystem: OperatingSystem; - cliVersion: string; - extensionVersion: string; - clientId: string; + operatingSystem: OperatingSystem; + cliVersion: string; + extensionVersion: string; + clientId: string; } diff --git a/src/analytics/analyticsService.ts b/src/analytics/analyticsService.ts index 7c574c1..9d6c08e 100644 --- a/src/analytics/analyticsService.ts +++ b/src/analytics/analyticsService.ts @@ -7,117 +7,120 @@ import { IAnalyticsBaseInfo, OperatingSystem } from './analyticsBaseInfo'; import { GUAService } from './guaService'; export class AnalyticsService { - private static HAS_ANALYTICS_PROMPT_SHOWN_KEY = 'nativescript.hasAnalyticsPromptShown'; - private static CLIENT_ID_KEY = 'nativescript.analyticsClientId'; - private static DOCS_LINK = 'https://github.com/NativeScript/nativescript-vscode-extension/blob/master/README.md#how-to-disable-the-analytics'; - private static ANALYTICS_PROMPT_MESSAGE = `Help us improve the NativeScript extension by allowing Progress to collect anonymous usage data. + private static HAS_ANALYTICS_PROMPT_SHOWN_KEY = 'nativescript.hasAnalyticsPromptShown'; + private static CLIENT_ID_KEY = 'nativescript.analyticsClientId'; + private static DOCS_LINK = + 'https://github.com/NativeScript/nativescript-vscode-extension/blob/master/README.md#how-to-disable-the-analytics'; + private static ANALYTICS_PROMPT_MESSAGE = `Help us improve the NativeScript extension by allowing Progress to collect anonymous usage data. For more information about the gathered information and how it is used, read our [privacy statement](https://www.progress.com/legal/privacy-policy). You can [disable the analytics and data collection](${AnalyticsService.DOCS_LINK}) at any given time. Do you want to enable analytics?`; - private static ANALYTICS_PROMPT_ACCEPT_ACTION = 'Yes'; - private static ANALYTICS_PROMPT_DENY_ACTION = 'No'; - - private static getOperatingSystem(): OperatingSystem { - switch (process.platform) { - case 'win32': - return OperatingSystem.Windows; - case 'darwin': - return OperatingSystem.OSX; - case 'linux': - case 'freebsd': - return OperatingSystem.Linux; - default: - return OperatingSystem.Other; - } + private static ANALYTICS_PROMPT_ACCEPT_ACTION = 'Yes'; + private static ANALYTICS_PROMPT_DENY_ACTION = 'No'; + + private static getOperatingSystem(): OperatingSystem { + switch (process.platform) { + case 'win32': + return OperatingSystem.Windows; + case 'darwin': + return OperatingSystem.OSX; + case 'linux': + case 'freebsd': + return OperatingSystem.Linux; + default: + return OperatingSystem.Other; } - - private _globalState: vscode.Memento; - private _logger: ILogger; - private _baseInfo: IAnalyticsBaseInfo; - private _gua: GUAService; - private _analyticsEnabled: boolean; - - constructor(globalState: vscode.Memento, cliVersion: string, extensionVersion: string, logger: ILogger) { - this._globalState = globalState; - this._logger = logger; - - vscode.workspace.onDidChangeConfiguration(() => this.updateAnalyticsEnabled()); - - this._baseInfo = { - cliVersion, - clientId: this.getOrGenerateClientId(), - extensionVersion, - operatingSystem: AnalyticsService.getOperatingSystem(), - }; + } + + private _globalState: vscode.Memento; + private _logger: ILogger; + private _baseInfo: IAnalyticsBaseInfo; + private _gua!: GUAService; + private _analyticsEnabled!: boolean; + + constructor(globalState: vscode.Memento, cliVersion: string, extensionVersion: string, logger: ILogger) { + this._globalState = globalState; + this._logger = logger; + + vscode.workspace.onDidChangeConfiguration(() => this.updateAnalyticsEnabled()); + + this._baseInfo = { + cliVersion, + clientId: this.getOrGenerateClientId(), + extensionVersion, + operatingSystem: AnalyticsService.getOperatingSystem(), + }; + } + + public launchDebugger(request: string, platform: string): Promise { + if (this._analyticsEnabled) { + try { + return this._gua.launchDebugger(request, platform); + } catch (e) { + this._logger.log(`Analytics error: ${_.isString(e) ? e : (e as Error).message}`); + } } - public launchDebugger(request: string, platform: string): Promise { - if (this._analyticsEnabled) { - try { - return this._gua.launchDebugger(request, platform); - } catch (e) { - this._logger.log(`Analytics error: ${_.isString(e) ? e : e.message}`); - } - } + return Promise.resolve(); + } - return Promise.resolve(); + public runRunCommand(platform: string): Promise { + if (this._analyticsEnabled) { + try { + return this._gua.runRunCommand(platform); + } catch (e) { + this._logger.log(`Analytics error: ${_.isString(e) ? e : (e as Error).message}`); + } } - public runRunCommand(platform: string): Promise { - if (this._analyticsEnabled) { - try { - return this._gua.runRunCommand(platform); - } catch (e) { - this._logger.log(`Analytics error: ${_.isString(e) ? e : e.message}`); - } - } + return Promise.resolve(); + } - return Promise.resolve(); - } + public initialize(): void { + const hasAnalyticsPromptShown = this._globalState.get(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY); - public initialize(): void { - const hasAnalyticsPromptShown = this._globalState.get(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY); + if (!hasAnalyticsPromptShown) { + vscode.window + .showInformationMessage( + AnalyticsService.ANALYTICS_PROMPT_MESSAGE, + AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION, + AnalyticsService.ANALYTICS_PROMPT_DENY_ACTION, + ) + .then((result) => this.onAnalyticsMessageConfirmation(result)); - if (!hasAnalyticsPromptShown) { - vscode.window.showInformationMessage(AnalyticsService.ANALYTICS_PROMPT_MESSAGE, - AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION, - AnalyticsService.ANALYTICS_PROMPT_DENY_ACTION, - ) - .then((result) => this.onAnalyticsMessageConfirmation(result)); - - return; - } - - this.updateAnalyticsEnabled(); + return; } - private getOrGenerateClientId(): string { - let clientId = this._globalState.get(AnalyticsService.CLIENT_ID_KEY); + this.updateAnalyticsEnabled(); + } - if (!clientId) { - clientId = uuidv4(); - this._globalState.update(AnalyticsService.CLIENT_ID_KEY, clientId); - } + private getOrGenerateClientId(): string { + let clientId = this._globalState.get(AnalyticsService.CLIENT_ID_KEY); - return clientId; + if (!clientId) { + clientId = uuidv4(); + this._globalState.update(AnalyticsService.CLIENT_ID_KEY, clientId); } - private onAnalyticsMessageConfirmation(result: string): void { - const shouldEnableAnalytics = result === AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION ? true : false; + return clientId; + } - this._globalState.update(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY, true); + private onAnalyticsMessageConfirmation(result: string | undefined): void { + const shouldEnableAnalytics = result === AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION ? true : false; - services.workspaceConfigService.isAnalyticsEnabled = shouldEnableAnalytics; - this.updateAnalyticsEnabled(); - } + this._globalState.update(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY, true); + + services.workspaceConfigService.isAnalyticsEnabled = shouldEnableAnalytics; + this.updateAnalyticsEnabled(); + } - private updateAnalyticsEnabled() { - this._analyticsEnabled = services.workspaceConfigService.isAnalyticsEnabled; + private updateAnalyticsEnabled() { + this._analyticsEnabled = services.workspaceConfigService.isAnalyticsEnabled; - if (this._analyticsEnabled && !this._gua) { - this._gua = new GUAService('UA-111455-29', this._baseInfo); - } + if (this._analyticsEnabled && !this._gua) { + this._gua = new GUAService('UA-111455-29', this._baseInfo); } + } } diff --git a/src/analytics/guaService.ts b/src/analytics/guaService.ts index bd9fcfa..55af35d 100644 --- a/src/analytics/guaService.ts +++ b/src/analytics/guaService.ts @@ -5,48 +5,48 @@ import { IAnalyticsBaseInfo, OperatingSystem } from './analyticsBaseInfo'; * Google Universal Analytics Service */ export class GUAService { - private _visitor: ua.Visitor; - private _getBasePayload: () => any; - - constructor(trackingId: string, baseInfo: IAnalyticsBaseInfo) { - const proxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY; - const requestOptions = proxy ? { proxy } : {}; - - this._visitor = ua(trackingId, baseInfo.clientId, { requestOptions, strictCidFormat: false }); - this._getBasePayload = () => { - return { - cd5: baseInfo.cliVersion, - cd6: OperatingSystem[baseInfo.operatingSystem], - cd7: baseInfo.extensionVersion, - cid: baseInfo.clientId, - dh: 'ns-vs-extension.org', - }; - }; - } - - public launchDebugger(request: string, platform: string): Promise { - const payload = this._getBasePayload(); - - payload.ec = 'vscode-extension-debug'; // event category - payload.ea = `debug-${request}-on-${platform}`; // event action - - return this.sendEvent(payload); - } - - public runRunCommand(platform: string): Promise { - const payload = this._getBasePayload(); - - payload.ec = 'vscode-extension-command'; // event category - payload.ea = `command-run-on-${platform}`; // event action - - return this.sendEvent(payload); - } - - private sendEvent(params): Promise { - return new Promise((res, rej) => { - this._visitor.event(params, (err) => { - return err ? rej(err) : res(); - }); - }); - } + private _visitor: ua.Visitor; + private _getBasePayload: () => any; + + constructor(trackingId: string, baseInfo: IAnalyticsBaseInfo) { + const proxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY; + const requestOptions = proxy ? { proxy } : {}; + + this._visitor = ua(trackingId, baseInfo.clientId, { requestOptions, strictCidFormat: false }); + this._getBasePayload = () => { + return { + cd5: baseInfo.cliVersion, + cd6: OperatingSystem[baseInfo.operatingSystem], + cd7: baseInfo.extensionVersion, + cid: baseInfo.clientId, + dh: 'ns-vs-extension.org', + }; + }; + } + + public launchDebugger(request: string, platform: string): Promise { + const payload = this._getBasePayload(); + + payload.ec = 'vscode-extension-debug'; // event category + payload.ea = `debug-${request}-on-${platform}`; // event action + + return this.sendEvent(payload); + } + + public runRunCommand(platform: string): Promise { + const payload = this._getBasePayload(); + + payload.ec = 'vscode-extension-command'; // event category + payload.ea = `command-run-on-${platform}`; // event action + + return this.sendEvent(payload); + } + + private sendEvent(params: any): Promise { + return new Promise((res, rej) => { + this._visitor.event(params, (err) => { + return err ? rej(err) : res(); + }); + }); + } } diff --git a/src/common/extensionProtocol.ts b/src/common/extensionProtocol.ts deleted file mode 100644 index 67bc1b7..0000000 --- a/src/common/extensionProtocol.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface IRequest { - id: string; - service: string; - method: string; - args: any[]; -} - -export interface IResponse { - requestId: string; - result: object; -} - -export const BEFORE_DEBUG_START = 'before-debug-start'; -export const NS_DEBUG_ADAPTER_MESSAGE = 'ns-debug-adapter-message'; diff --git a/src/common/logger.ts b/src/common/logger.ts index 215398e..7218657 100644 --- a/src/common/logger.ts +++ b/src/common/logger.ts @@ -1,13 +1,13 @@ enum LogLevel { - Verbose = 0, - Log = 1, - Warn = 2, - Error = 3, - Stop = 4, + Verbose = 0, + Log = 1, + Warn = 2, + Error = 3, + Stop = 4, } interface ILogger { - log(msg: string, level?: LogLevel): void; + log(msg: string, level?: LogLevel): void; } -export { ILogger, LogLevel }; +export { ILogger, LogLevel }; diff --git a/src/common/utilities.ts b/src/common/utilities.ts index 38d5b52..ca3b4e2 100644 --- a/src/common/utilities.ts +++ b/src/common/utilities.ts @@ -4,32 +4,32 @@ import * as path from 'path'; import { ILogger, LogLevel } from '../common/logger'; export function killProcess(childProcess: ChildProcess, logger?: ILogger): void { - logger && logger.log(`Stopping process: ${childProcess.pid}`); + logger && logger.log(`Stopping process: ${childProcess.pid}`); - try { - switch (process.platform) { - case 'win32': - execSync(`taskkill /pid ${childProcess.pid} /T /F`); - break; + try { + switch (process.platform) { + case 'win32': + execSync(`taskkill /pid ${childProcess.pid!} /T /F`); + break; - default: - // ctrl + c - execSync(`kill -2 ${childProcess.pid.toString()}`); - break; - } - } catch (error) { - logger && logger.log(error, LogLevel.Error); + default: + // ctrl + c + execSync(`kill -2 ${childProcess.pid!.toString()}`); + break; } + } catch (error) { + logger && logger.log(error as string, LogLevel.Error); + } } export const enum Platform { - Windows, OSX, Linux, + Windows, + OSX, + Linux, } export function getPlatform(): Platform { - const platform = os.platform(); + const platform = os.platform(); - return platform === 'darwin' ? Platform.OSX : - platform === 'win32' ? Platform.Windows : - Platform.Linux; + return platform === 'darwin' ? Platform.OSX : platform === 'win32' ? Platform.Windows : Platform.Linux; } diff --git a/src/common/workspaceConfigService.ts b/src/common/workspaceConfigService.ts index 89f82af..0b08ae4 100644 --- a/src/common/workspaceConfigService.ts +++ b/src/common/workspaceConfigService.ts @@ -1,15 +1,17 @@ import * as vscode from 'vscode'; export class WorkspaceConfigService { - public get isAnalyticsEnabled(): boolean { - return vscode.workspace.getConfiguration('nativescript').get('analytics.enabled') as boolean; - } + public get isAnalyticsEnabled(): boolean { + return vscode.workspace.getConfiguration('nativescript').get('analytics.enabled') as boolean; + } - public set isAnalyticsEnabled(isAnalyticsEnabled: boolean) { - vscode.workspace.getConfiguration('nativescript').update('analytics.enabled', isAnalyticsEnabled, vscode.ConfigurationTarget.Global); - } + public set isAnalyticsEnabled(isAnalyticsEnabled: boolean) { + vscode.workspace + .getConfiguration('nativescript') + .update('analytics.enabled', isAnalyticsEnabled, vscode.ConfigurationTarget.Global); + } - public get tnsPath(): string { - return vscode.workspace.getConfiguration('nativescript').get('tnsPath') as string; - } + public get nsPath(): string { + return vscode.workspace.getConfiguration('nativescript').get('nsPath', 'ns'); + } } diff --git a/src/debug-adapter/debugManager.ts b/src/debug-adapter/debugManager.ts new file mode 100644 index 0000000..a0d2af0 --- /dev/null +++ b/src/debug-adapter/debugManager.ts @@ -0,0 +1,313 @@ +import * as fs from 'fs'; +import * as path from 'path'; +import * as vscode from 'vscode'; +import { BuildSession } from '../services/buildService'; +import { services } from '../services/extensionHostServices'; +import { ILogger } from '../common/logger'; + +export type SessionTerminatedCallback = () => void; + +interface ActiveSession { + buildSession: BuildSession; + childSession: vscode.DebugSession | null; + config: vscode.DebugConfiguration; + folder: vscode.WorkspaceFolder | undefined; + onTerminated: SessionTerminatedCallback; + stopping: boolean; + restartPending: boolean; +} + +export class DebugManager { + private activeSessions = new Map(); + private logger: ILogger; + private disposables: vscode.Disposable[] = []; + + constructor(logger: ILogger) { + this.logger = logger; + + this.disposables.push( + vscode.debug.onDidTerminateDebugSession((session) => { + this.logger.log(`[NativeScript] Session terminated: ${session.name} (type=${session.type})\n`); + + if (session.type === 'nativescript') { + this.onParentSessionTerminated(session); + return; + } + + for (const [parentId, active] of this.activeSessions) { + if (active.childSession === session) { + active.childSession = null; + + if (active.stopping) return; + + if (!active.restartPending) { + this.logger.log('[NativeScript] Child session ended, stopping parent\n'); + active.onTerminated(); + this.cleanup(parentId); + } else { + this.logger.log('[NativeScript] Child session ended, restart pending\n'); + } + } + } + }), + ); + } + + public async startDebugging( + parentSession: vscode.DebugSession, + config: vscode.DebugConfiguration, + onTerminated: SessionTerminatedCallback, + ): Promise { + const folder = vscode.workspace.workspaceFolders?.[0]; + const appRoot = config.appRoot || config.webRoot || folder?.uri.fsPath || ''; + + this.logger.log(`[NativeScript] appRoot: ${appRoot}\n`); + + const buildSession = await services.buildService.startBuild({ + appRoot, + platform: config.platform, + request: config.request, + watch: config.watch, + stopOnEntry: config.stopOnEntry, + launchTests: config.launchTests, + tnsArgs: config.tnsArgs, + }); + + const active: ActiveSession = { + buildSession, + childSession: null, + config, + folder, + onTerminated, + stopping: false, + restartPending: false, + }; + + this.activeSessions.set(parentSession.id, active); + + buildSession.portEmitter.on('newPort', (port: number) => { + if (active.stopping) return; + this.logger.log(`[NativeScript] LiveSync restart detected, new port: ${port}\n`); + active.restartPending = true; + this.startChildSession(parentSession, active, port); + }); + + buildSession.portEmitter.on('closed', () => { + this.logger.log('[NativeScript] ns process closed\n'); + if (!active.stopping) { + active.onTerminated(); + this.cleanup(parentSession.id); + } + }); + + const port = await buildSession.initialPort; + + if (!port) { + this.logger.log('[NativeScript] No debug port received, terminating\n'); + this.cleanup(parentSession.id); + return false; + } + + await this.startChildSession(parentSession, active, port); + return true; + } + + public stopDebugging(parentSessionId: string): void { + this.cleanup(parentSessionId); + } + + public dispose(): void { + for (const [id] of this.activeSessions) { + this.cleanup(id); + } + this.disposables.forEach((d) => d.dispose()); + } + + private async startChildSession( + parentSession: vscode.DebugSession, + active: ActiveSession, + port: number, + ): Promise { + if (active.stopping) return; + + if (active.childSession) { + await vscode.debug.stopDebugging(active.childSession); + active.childSession = null; + await new Promise((r) => setTimeout(r, 500)); + } + + if (active.stopping) return; + + const config = active.config; + const address = this.getNormalizedAddress(config.address, config.platform); + const sourceMapPathOverrides = this.computeSourceMapPathOverrides(config); + + const childConfig: vscode.DebugConfiguration = { + type: 'pwa-node', + request: 'attach', + name: config.name, + websocketAddress: `ws://${address}:${port}`, + sourceMapPathOverrides, + skipFiles: config.skipFiles, + smartStep: config.smartStep, + trace: config.diagnosticLogging ? true : config.trace, + stopOnEntry: config.stopOnEntry, + }; + + this.logger.log(`[NativeScript] Starting child debug session on ws://${address}:${port}\n`); + + for (let attempt = 0; attempt < 3; attempt++) { + if (active.stopping) return; + + const started = await vscode.debug.startDebugging(active.folder, childConfig, { + parentSession, + lifecycleManagedByParent: true, + compact: true, + }); + + if (started) { + const childSession = vscode.debug.activeDebugSession; + if (childSession && childSession.parentSession === parentSession) { + active.childSession = childSession; + } + active.restartPending = false; + return; + } + + this.logger.log(`[NativeScript] Child session attempt ${attempt + 1} failed, retrying...\n`); + await new Promise((r) => setTimeout(r, 1000)); + } + + active.restartPending = false; + this.logger.log('[NativeScript] Failed to start child debug session after 3 attempts\n'); + } + + private onParentSessionTerminated(session: vscode.DebugSession): void { + this.cleanup(session.id); + } + + private cleanup(parentSessionId: string): void { + const active = this.activeSessions.get(parentSessionId); + if (!active) return; + + active.stopping = true; + active.buildSession.portEmitter.removeAllListeners(); + active.buildSession.disconnect(); + + if (active.childSession) { + vscode.debug.stopDebugging(active.childSession); + } + + this.activeSessions.delete(parentSessionId); + } + + private getNormalizedAddress(address: string | undefined, platform: string): string { + if (address) return address; + return platform?.toLowerCase() === 'ios' ? 'localhost' : '127.0.0.1'; + } + + private computeSourceMapPathOverrides(config: vscode.DebugConfiguration): Record { + const overrides: Record = config.sourceMapPathOverrides ? { ...config.sourceMapPathOverrides } : {}; + const webRoot = config.appRoot || config.webRoot || ''; + const appDirPath = this.getAppDirPath(webRoot); + const fullAppDirPath = appDirPath + ? path.join(webRoot, appDirPath) + : path.join(webRoot, this.isAngularProject(webRoot) ? 'src' : 'app'); + + if (!overrides['webpack:///*']) { + overrides['webpack:///*'] = `${fullAppDirPath}/*`; + } + + const packageFilePath = path.join(webRoot, 'package.json'); + if (fs.existsSync(packageFilePath)) { + try { + const packageFile = JSON.parse(fs.readFileSync(packageFilePath, 'utf8')) as { name?: string }; + const extensions = ['js', 'ts', 'vue', 'svelte', 'jsx', 'tsx']; + + const webpackConfig = this.getWebpackConfig(webRoot, config.platform?.toLowerCase()); + let sourceMap = packageFile.name ?? ''; + if (webpackConfig?.output?.devtoolNamespace) { + sourceMap = webpackConfig.output.devtoolNamespace; + } + + for (const ext of extensions) { + overrides[`webpack://${sourceMap}/*.${ext}`] = `${webRoot}/*.${ext}`; + } + + if (webpackConfig?.output?.library) { + const key = `webpack://${webpackConfig.output.library}/*`; + overrides[key] = overrides[key] || `${fullAppDirPath}/*`; + } + } catch { + this.logger.log(`[NativeScript] Warning: could not read ${packageFilePath}\n`); + } + } + + return overrides; + } + + private getAppDirPath(webRoot: string): string | undefined { + const pathToNsconfig = path.join(webRoot, 'nsconfig.json'); + const pathToNativeScriptConfig = path.join(webRoot, 'nativescript.config.ts'); + + if (fs.existsSync(pathToNsconfig)) { + try { + const content = fs.readFileSync(pathToNsconfig, 'utf8'); + const jsonContent = JSON.parse(content); + return jsonContent.appPath; + } catch { + // ignore + } + } else if (fs.existsSync(pathToNativeScriptConfig)) { + try { + const configContent = fs.readFileSync(pathToNativeScriptConfig, 'utf8'); + if (configContent.indexOf(`appPath: 'src'`) === -1) { + const appPath = configContent.split(/appPath:\s*["'`](\w+)["'`]/im)[1]; + return appPath; + } + } catch { + // ignore + } + } + + return undefined; + } + + private isAngularProject(webRoot: string): boolean { + if (fs.existsSync(path.join(webRoot, 'angular.json'))) { + return true; + } + + const packageJsonPath = path.join(webRoot, 'package.json'); + if (fs.existsSync(packageJsonPath)) { + try { + const content = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); + return !!content?.dependencies?.['@angular/core']; + } catch { + // ignore + } + } + + return false; + } + + private getWebpackConfig( + webRoot: string, + platform?: string, + ): { output?: { library?: string; devtoolNamespace?: string } } | null { + const webpackConfigFile = path.join(webRoot, 'webpack.config.js'); + if (!fs.existsSync(webpackConfigFile) || !platform) return null; + + const savedCwd = process.cwd(); + try { + process.chdir(webRoot); + const webpackConfig = require(webpackConfigFile); + const result = webpackConfig({ [platform]: platform }); + process.chdir(savedCwd); + return result; + } catch { + process.chdir(savedCwd); + return null; + } + } +} diff --git a/src/debug-adapter/nativeScriptDebug.ts b/src/debug-adapter/nativeScriptDebug.ts deleted file mode 100644 index b7aa793..0000000 --- a/src/debug-adapter/nativeScriptDebug.ts +++ /dev/null @@ -1,23 +0,0 @@ -import * as os from 'os'; -import * as path from 'path'; -import { chromeConnection, ChromeDebugSession } from 'vscode-chrome-debug-core'; -import { NativeScriptDebugAdapter } from './nativeScriptDebugAdapter'; -import { NativeScriptPathTransformer } from './nativeScriptPathTransformer'; -import { NativeScriptSourceMapTransformer } from './nativeScriptSourceMapTransformer'; -import { NativeScriptTargetDiscovery } from './nativeScriptTargetDiscovery'; - -class NSAndroidConnection extends chromeConnection.ChromeConnection { - constructor() { - super(new NativeScriptTargetDiscovery()); - } -} - -ChromeDebugSession.run(ChromeDebugSession.getSession( - { - adapter: NativeScriptDebugAdapter, - chromeConnection: NSAndroidConnection, - extensionName: 'nativescript-extension', - logFilePath: path.join(os.tmpdir(), 'nativescript-extension.txt'), - pathTransformer: NativeScriptPathTransformer, - sourceMapTransformer: NativeScriptSourceMapTransformer, - })); diff --git a/src/debug-adapter/nativeScriptDebugAdapter.ts b/src/debug-adapter/nativeScriptDebugAdapter.ts index 9de732f..642b3c0 100644 --- a/src/debug-adapter/nativeScriptDebugAdapter.ts +++ b/src/debug-adapter/nativeScriptDebugAdapter.ts @@ -1,317 +1,101 @@ -import { existsSync, readFileSync } from 'fs'; -import * as stripJsonComments from 'strip-json-comments'; -import * as _ from 'lodash'; -import { join } from 'path'; -import { - ChromeDebugAdapter, - IRestartRequestArgs, - ISetBreakpointsArgs, - ISetBreakpointsResponseBody, - ITelemetryPropertyCollector, -} from 'vscode-chrome-debug-core'; -import { Event, logger, TerminatedEvent } from '@vscode/debugadapter'; +import { DebugSession, InitializedEvent, TerminatedEvent, OutputEvent } from '@vscode/debugadapter'; import { DebugProtocol } from '@vscode/debugprotocol'; -import * as extProtocol from '../common/extensionProtocol'; -import { NativeScriptSourceMapTransformer } from './nativeScriptSourceMapTransformer'; - -const reconnectAfterLiveSyncTimeout = 60 * 1000; - -export class NativeScriptDebugAdapter extends ChromeDebugAdapter { - private _idCounter = 0; - private _pendingRequests: object = {}; - private isLiveSync: boolean = false; - private portWaitingResolve: any; - private isDisconnecting: boolean = false; - private isLiveSyncRestart: boolean = false; - private breakPointsCache: { [file: string]: { args: ISetBreakpointsArgs, requestSeq: number, ids: number[] } } = {}; - - public attach(args: any): Promise { - return this.processRequestAndAttach(args); - } - - public launch(args: any): Promise { - return this.processRequestAndAttach(args); - } - - public onPortReceived(port) { - this.portWaitingResolve && this.portWaitingResolve(port); - } - - public onExtensionResponse(response) { - this._pendingRequests[response.requestId](response.result); - delete this._pendingRequests[response.requestId]; - } - - public disconnect(args: any): void { - this.isDisconnecting = true; - - if (this.portWaitingResolve) { - this.portWaitingResolve(); - this.portWaitingResolve = null; - } - - if (!this.isLiveSyncRestart) { - this.callRemoteMethod('buildService', 'disconnect'); - } - - super.disconnect(args); - } - - public async setCachedBreakpointsForScript(script: string): Promise { - const breakPointData = this.breakPointsCache[script]; - - if (breakPointData) { - await this.setBreakpoints(breakPointData.args, null, breakPointData.requestSeq, breakPointData.ids); - } - } - - public async setBreakpoints( - args: ISetBreakpointsArgs, - telemetryPropertyCollector: ITelemetryPropertyCollector, - requestSeq: number, - ids?: number[]): Promise { - - if (args && args.source && args.source.path) { - this.breakPointsCache[args.source.path] = { args: _.cloneDeep(args), requestSeq, ids }; - } - - return super.setBreakpoints(args, telemetryPropertyCollector, requestSeq, ids); - } - - protected async terminateSession(reason: string, disconnectArgs?: DebugProtocol.DisconnectArguments, restart?: IRestartRequestArgs): Promise { - let restartRequestArgs = restart; - let timeoutId; - - if (!this.isDisconnecting && this.isLiveSync) { - const portProm = new Promise((res, rej) => { - this.portWaitingResolve = res; - - timeoutId = setTimeout(() => { - res(); - }, reconnectAfterLiveSyncTimeout); - }); - - restartRequestArgs = await portProm as any; - this.isLiveSyncRestart = restartRequestArgs && !!restartRequestArgs.port; - clearTimeout(timeoutId); - } - - await super.terminateSession(reason, disconnectArgs, restartRequestArgs); - } - - protected hookConnectionEvents(): void { - super.hookConnectionEvents(); - - this.chrome.Log.on('entryAdded', (params) => this.onEntryAdded(params)); - } - - protected onEntryAdded(params: any): void { - if (params && params.entry && params.entry.level) { - const message = params.entry; - - message.type = message.level; - - const that = this as any; - const script = that.getScriptByUrl && that.getScriptByUrl(params.entry.url); - - if (script) { - message.stack = { - callFrames: [ - { - columnNumber: 0, - lineNumber: params.entry.lineNumber, - scriptId: script.scriptId, - url: params.entry.url, - }, - ], - }; - } - - this.onMessageAdded({ - message, - }); - } - } - - private async processRequestAndAttach(args: any) { - const transformedArgs = this.translateArgs(args); - - if (args.__restart) { - transformedArgs.port = args.__restart.port; - } else { - this._session.sendEvent(new Event(extProtocol.BEFORE_DEBUG_START)); - transformedArgs.port = await this.callRemoteMethod('buildService', 'processRequest', transformedArgs); - } - - if (!transformedArgs.port) { - this._session.sendEvent(new TerminatedEvent()); - } - - const appDirPath = this.getAppDirPath(transformedArgs.webRoot); - - (this.pathTransformer as any).setTransformOptions(args.platform, appDirPath, transformedArgs.webRoot); - (this.sourceMapTransformer as NativeScriptSourceMapTransformer).setTransformOptions(args.platform.toLowerCase(), this); - (ChromeDebugAdapter as any).SET_BREAKPOINTS_TIMEOUT = 20000; - - this.isLiveSync = args.watch; - - return super.attach(transformedArgs); - } - - private getAppDirPath(webRoot: string): string { - const pathToNsconfig = join(webRoot, 'nsconfig.json'); - const pathToNativeScriptConfig = join(webRoot, 'nativescript.config.ts'); - - if (existsSync(pathToNsconfig)) { - try { - const content = readFileSync(pathToNsconfig).toString(); - const jsonContent = JSON.parse(stripJsonComments(content)); - - return jsonContent.appPath; - } catch (err) { - // Ignore the error for the moment - } - } else if (existsSync(pathToNativeScriptConfig)) { - try { - const nativeScriptConfigTSContent = readFileSync(pathToNativeScriptConfig, { - encoding: 'utf8' - }); - if (nativeScriptConfigTSContent) { - // need a AST parser here - ridumentary check for now - // assuming 3 likely values: www, build or dist - if (nativeScriptConfigTSContent.indexOf(`appPath: 'src'`) === -1) { - // not using default, parse it out - const appPath = nativeScriptConfigTSContent.split(/appPath:\s*["'`](\w+)["'`]/gim)[1]; - return appPath; - } - } - } catch (err) { - // ignore - } - } - } - - /** - * Determines if the NativeScript project being debugged is an Angular based - * project by returning true if an **angular.json** file exists at the base - * of the project or returns false if not found. - * @param webRoot The root of the project. - */ - private isAngularProject(webRoot): boolean { - let isAngularProject = existsSync(join(webRoot, 'angular.json')); - - if (isAngularProject) { - logger.log('Angular project detected, found angular.json file.'); - } else { - let packageJson = existsSync(join(webRoot, 'package.json')); - if (packageJson) { - try { - const packageJsonContent = readFileSync(join(webRoot, 'package.json'), { - encoding: 'utf8', - }); - const jsonContent = JSON.parse(stripJsonComments(packageJsonContent)); - if (jsonContent && jsonContent.dependencies && jsonContent.dependencies['@angular/core']) { - isAngularProject = true; - } - } catch (err) { - - } - } - } - - return isAngularProject; - } - - private translateArgs(args): any { - if (args.diagnosticLogging) { - args.trace = args.diagnosticLogging; - } - - if (args.appRoot) { - args.webRoot = args.appRoot; - } - - if (!args.sourceMapPathOverrides) { - args.sourceMapPathOverrides = {}; - } - - args.address = this.getNormalizedAddress(args.address, args.platform.toLowerCase()); - - const appDirPath = this.getAppDirPath(args.webRoot) || (this.isAngularProject(args.webRoot) ? 'src' : 'app'); - const fullAppDirPath = join(args.webRoot, appDirPath); - - if (!args.sourceMapPathOverrides['webpack:///*']) { - args.sourceMapPathOverrides['webpack:///*'] = `${fullAppDirPath}/*`; - } - - const packageFilePath = join(args.webRoot, 'package.json'); - const webpackConfig = this.getWebpackConfig(args.webRoot, args.platform && args.platform.toLowerCase()); - - // Apply sourceMapPathOverrides for all file extensions: "webpack://packageName|devtoolNamespace/*.extensionFile": "${workspaceRoot}/*.extensionFile" - if (existsSync(packageFilePath)) { - try { - const packageFile = require(packageFilePath) as { name: string }; - const extensions = ["js", "ts", "vue", "svelte", "jsx", "tsx"]; - let sourceMap = packageFile.name; - - // if user declare devtoolNamespace, use this property for sourceMaps - if (webpackConfig?.output?.devtoolNamespace) { - sourceMap = webpackConfig.output.devtoolNamespace; - } - - extensions.forEach(extension => { - args.sourceMapPathOverrides[`webpack://${sourceMap}/*.${extension}`] = `${args.webRoot}/*.${extension}`; - }) - } catch (err) { - logger.warn(`Error when trying to require package.json file from path '${packageFilePath}'. Error is: ${err}`); - } - } - - if (webpackConfig?.output?.library) { - const sourceMapPathOverrideWithLib = `webpack://${webpackConfig.output.library}/*`; - - args.sourceMapPathOverrides[sourceMapPathOverrideWithLib] = args.sourceMapPathOverrides[sourceMapPathOverrideWithLib] || - `${fullAppDirPath}/*`; - } - - return args; - } - - private callRemoteMethod(service: string, method: string, ...args: any[]): Promise { - const request: extProtocol.IRequest = { id: `req${++this._idCounter}`, service, method, args }; - - return new Promise((res, rej) => { - this._pendingRequests[request.id] = res; - - this._session.sendEvent(new Event(extProtocol.NS_DEBUG_ADAPTER_MESSAGE, request)); - }); - } - - private getNormalizedAddress(address: string, platform: string) { - // If it is undefined it will use 127.0.0.1 and will fail on iOS - if (address === undefined && platform === "ios") { - return "localhost"; - } - return address; - } - - private getWebpackConfig(webRoot: string, platform: string) { - const webpackConfigFile = join(webRoot, 'webpack.config.js'); - const pathProcess = process.cwd(); - - if (existsSync(webpackConfigFile)) { - try { - // Apply the project path so that ns/webpack can resolve the path - process.chdir(webRoot); - const webpackConfig = require(webpackConfigFile); - const webpackConfigResult = webpackConfig({ [`${platform}`]: platform }); - process.chdir(pathProcess); - return webpackConfigResult; - } catch (err) { - process.chdir(pathProcess); - logger.warn(`Error when trying to require webpack.config.js file from path '${webpackConfigFile}'. Error is: ${err}`); - } - } - return null; - } +import { DebugManager } from './debugManager'; +import * as vscode from 'vscode'; + +export class NativeScriptDebugAdapter extends DebugSession { + private debugManager: DebugManager; + private parentSession: vscode.DebugSession | null = null; + + constructor(debugManager: DebugManager) { + super(); + this.debugManager = debugManager; + } + + public setParentSession(session: vscode.DebugSession): void { + this.parentSession = session; + } + + protected initializeRequest( + response: DebugProtocol.InitializeResponse, + _args: DebugProtocol.InitializeRequestArguments, + ): void { + response.body = { + supportsTerminateRequest: true, + supportsRestartRequest: true, + }; + + this.sendResponse(response); + this.sendEvent(new InitializedEvent()); + } + + protected async launchRequest( + response: DebugProtocol.LaunchResponse, + args: DebugProtocol.LaunchRequestArguments, + ): Promise { + this.sendResponse(response); + await this.startDebugSession(args); + } + + protected async attachRequest( + response: DebugProtocol.AttachResponse, + args: DebugProtocol.AttachRequestArguments, + ): Promise { + this.sendResponse(response); + await this.startDebugSession(args); + } + + protected configurationDoneRequest( + response: DebugProtocol.ConfigurationDoneResponse, + _args: DebugProtocol.ConfigurationDoneArguments, + ): void { + this.sendResponse(response); + } + + protected disconnectRequest( + response: DebugProtocol.DisconnectResponse, + _args: DebugProtocol.DisconnectArguments, + ): void { + if (this.parentSession) { + this.debugManager.stopDebugging(this.parentSession.id); + } + this.sendResponse(response); + } + + protected terminateRequest(response: DebugProtocol.TerminateResponse, _args: DebugProtocol.TerminateArguments): void { + if (this.parentSession) { + this.debugManager.stopDebugging(this.parentSession.id); + } + this.sendResponse(response); + this.sendEvent(new TerminatedEvent()); + } + + protected threadsRequest(response: DebugProtocol.ThreadsResponse): void { + response.body = { threads: [] }; + this.sendResponse(response); + } + + private async startDebugSession( + args: DebugProtocol.LaunchRequestArguments | DebugProtocol.AttachRequestArguments, + ): Promise { + if (!this.parentSession) { + this.sendEvent(new OutputEvent('[NativeScript] No parent session available\n', 'stderr')); + this.sendEvent(new TerminatedEvent()); + return; + } + + try { + const config = { ...args } as vscode.DebugConfiguration; + const started = await this.debugManager.startDebugging(this.parentSession, config, () => { + this.sendEvent(new TerminatedEvent()); + }); + if (!started) { + this.sendEvent(new TerminatedEvent()); + } + } catch (e) { + const msg = e instanceof Error ? e.message : String(e); + this.sendEvent(new OutputEvent(`[NativeScript] Error: ${msg}\n`, 'stderr')); + this.sendEvent(new TerminatedEvent()); + } + } } diff --git a/src/debug-adapter/nativeScriptPathTransformer.ts b/src/debug-adapter/nativeScriptPathTransformer.ts deleted file mode 100644 index 45ba13d..0000000 --- a/src/debug-adapter/nativeScriptPathTransformer.ts +++ /dev/null @@ -1,112 +0,0 @@ -import * as fs from 'fs'; -import * as _ from 'lodash'; -import * as path from 'path'; -import { UrlPathTransformer } from 'vscode-chrome-debug-core'; - -export class NativeScriptPathTransformer extends UrlPathTransformer { - private filePatterns = { - android: new RegExp('^(file:)?/*data/(data|user/\\d+)/.*?/files/(.*)$', 'i'), - ios: new RegExp('^(file:)?/*(.*)$', 'i'), - }; - - private targetPlatform: string; - private appDirPath: string; - private webRoot: string; - private isAndroid: boolean; - private isIOS: boolean; - - public setTransformOptions(targetPlatform: string, appDirPath: string, webRoot: string) { - this.targetPlatform = targetPlatform.toLowerCase(); - this.appDirPath = appDirPath; - this.webRoot = webRoot; - this.isAndroid = this.targetPlatform === 'android'; - this.isIOS = this.targetPlatform === 'ios'; - } - - protected async targetUrlToClientPath(scriptUrl: string): Promise { - if (!scriptUrl) { - return; - } - - if (_.startsWith(scriptUrl, 'mdha:')) { - scriptUrl = _.trimStart(scriptUrl, 'mdha:'); - } - - if (path.isAbsolute(scriptUrl) && fs.existsSync(scriptUrl)) { - return scriptUrl; - } - - const filePattern = this.filePatterns[this.targetPlatform]; - - const matches = filePattern.exec(scriptUrl); - - let relativePath = scriptUrl; - - if (matches) { - relativePath = this.isAndroid ? matches[3] : matches[2]; - } - - const result = this.getFileFromAppDir(relativePath) || - this.getFileFromNodeModulesDir(relativePath) || - this.getFileFromPlatformsDir(relativePath) || - await super.targetUrlToClientPath(scriptUrl); - - return result; - } - - private getFileFromAppDir(rawDevicePath: string): string { - if (this.appDirPath) { - rawDevicePath = rawDevicePath.replace('app', this.appDirPath); - } - - const absolutePath = path.resolve(path.join(this.webRoot, rawDevicePath)); - - return this.getPlatformSpecificPath(absolutePath); - } - - private getFileFromNodeModulesDir(rawDevicePath: string): string { - const nodePath = path.join('..', 'node_modules'); - - rawDevicePath = rawDevicePath.replace('tns_modules', nodePath); - - const absolutePath = path.resolve(path.join(this.webRoot, rawDevicePath)); - - return this.getPlatformSpecificPath(absolutePath); - } - - private getFileFromPlatformsDir(rawDevicePath: string): string { - let absolutePath: string = null; - - // handle files like file://app/starter.js (produced with bundle and required when using with --debug-brk) - if (this.isAndroid) { - // handle files like /data/data/internal/ts_helpers.ts - absolutePath = path.resolve(path.join(this.webRoot, 'platforms', this.targetPlatform.toLowerCase(), 'app', 'src', 'main', 'assets', rawDevicePath)); - } else if (this.isIOS) { - absolutePath = path.resolve(path.join(this.webRoot, 'platforms', this.targetPlatform.toLowerCase(), this.getAppName(this.webRoot), rawDevicePath)); - } - - return this.getPlatformSpecificPath(absolutePath); - } - - private getPlatformSpecificPath(rawPath: string): string { - if (fs.existsSync(rawPath)) { - return rawPath; - } - - const fileExtension = path.extname(rawPath); - - if (fileExtension) { - const platformSpecificPath = rawPath.replace(fileExtension, `.${this.targetPlatform}${fileExtension}`); - - if (fs.existsSync(platformSpecificPath)) { - return platformSpecificPath; - } - } - - return null; - } - - private getAppName(projectDir: string): string { - return _.filter(path.basename(projectDir).split(''), (c) => /[a-zA-Z0-9]/.test(c)).join(''); - } -} diff --git a/src/debug-adapter/nativeScriptSourceMapTransformer.ts b/src/debug-adapter/nativeScriptSourceMapTransformer.ts deleted file mode 100644 index d9a5ad2..0000000 --- a/src/debug-adapter/nativeScriptSourceMapTransformer.ts +++ /dev/null @@ -1,133 +0,0 @@ -import * as path from 'path'; -import { BaseSourceMapTransformer, logger as vsCodeChromeDebugLogger, utils as vsCodeChromeDebugUtils } from 'vscode-chrome-debug-core'; -import * as sourceMapUtils from 'vscode-chrome-debug-core/out/src/sourceMaps/sourceMapUtils'; // tslint:disable-line -import { NativeScriptDebugAdapter } from './nativeScriptDebugAdapter'; - -export class NativeScriptSourceMapTransformer extends BaseSourceMapTransformer { - private debugAdapter: NativeScriptDebugAdapter; - private targetPlatform: string; - - constructor(sourceHandles: any) { - super(sourceHandles); - this.setupSourceMapPathOverrides(); - } - - public setTransformOptions(targetPlatform: string, debugAdapter: NativeScriptDebugAdapter) { - this.targetPlatform = targetPlatform.toLowerCase(); - this.debugAdapter = debugAdapter; - } - - public async scriptParsed(pathToGenerated: string, originalUrlToGenerated: string, sourceMapURL: string): Promise { - const scriptParsedResult = await super.scriptParsed(pathToGenerated, originalUrlToGenerated, sourceMapURL); - - if (scriptParsedResult && scriptParsedResult.length) { - for (const script of scriptParsedResult) { - await this.debugAdapter.setCachedBreakpointsForScript(script); - } - } - - return scriptParsedResult; - } - - private setupSourceMapPathOverrides() { - // a workaround for https://github.com/NativeScript/nativescript-vscode-extension/issues/252 - // tslint:disable - //--- begin part copied from vscode-chrome-debug-core (https://github.com/microsoft/vscode-chrome-debug-core/blob/d1fe8ca062e277a3480879e1fb63a8ef3b48015a/src/sourceMaps/sourceMapUtils.ts#L78) - // - // VS Code - Debugger for Chrome - // - // Copyright (c) Microsoft Corporation - // - // All rights reserved. - // - // MIT License - // - // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - // - // The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - // - // THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - sourceMapUtils.applySourceMapPathOverrides = (sourcePath, sourceMapPathOverrides, isVSClient = false) => { - const forwardSlashSourcePath = sourcePath.replace(/\\/g, '/'); - // Sort the overrides by length, large to small - const sortedOverrideKeys = Object.keys(sourceMapPathOverrides) - .sort((a, b) => b.length - a.length); - - // Iterate the key/vals, only apply the first one that matches. - for (const leftPattern of sortedOverrideKeys) { - const rightPattern = sourceMapPathOverrides[leftPattern]; - const entryStr = `"${leftPattern}": "${rightPattern}"`; - const asterisks = leftPattern.match(/\*/g) || []; - - if (asterisks.length > 1) { - vsCodeChromeDebugLogger.log(`Warning: only one asterisk allowed in a sourceMapPathOverrides entry - ${entryStr}`); - continue; - } - const replacePatternAsterisks = rightPattern.match(/\*/g) || []; - - if (replacePatternAsterisks.length > asterisks.length) { - vsCodeChromeDebugLogger.log(`Warning: the right side of a sourceMapPathOverrides entry must have 0 or 1 asterisks - ${entryStr}}`); - continue; - } - // Does it match? - const escapedLeftPattern = vsCodeChromeDebugUtils.escapeRegexSpecialChars(leftPattern, '/*'); - const leftRegexSegment = escapedLeftPattern - .replace(/\*/g, '(.*)') - .replace(/\\\\/g, '/'); - const leftRegex = new RegExp(`^${leftRegexSegment}$`, 'i'); - const overridePatternMatches = forwardSlashSourcePath.match(leftRegex); - - if (!overridePatternMatches) { - continue; - } - // Grab the value of the wildcard from the match above, replace the wildcard in the - // replacement pattern, and return the result. - const wildcardValue = overridePatternMatches[1]; - - // ***************** CUSTOM CODE START ***************** - // handle linked files - let mappedPath = path.isAbsolute(wildcardValue) ? wildcardValue : rightPattern.replace(/\*/g, wildcardValue); - // ***************** CUSTOM CODE END ***************** - - mappedPath = path.join(mappedPath); // Fix any .. - - // ***************** CUSTOM CODE START ***************** - // handle platform-specific files - const { dir, name, ext } = path.parse(mappedPath); - - const tnsFileName = `${name}.tns${ext}`; - const tnsPath = path.join(dir, tnsFileName); - - if (vsCodeChromeDebugUtils.existsSync(tnsPath)) { - mappedPath = tnsPath; - } - - const platformFileName = `${name}.${this.targetPlatform}${ext}`; - const platformPath = path.join(dir, platformFileName); - - if (vsCodeChromeDebugUtils.existsSync(platformPath)) { - mappedPath = platformPath; - } - // ***************** CUSTOM CODE END ***************** - - if (isVSClient && leftPattern === 'webpack:///./*' && !vsCodeChromeDebugUtils.existsSync(mappedPath)) { - // This is a workaround for a bug in ASP.NET debugging in VisualStudio because the wwwroot is not properly configured - const pathFixingASPNETBug = path.join(rightPattern.replace(/\*/g, path.join('../ClientApp', wildcardValue))); - - if (vsCodeChromeDebugUtils.existsSync(pathFixingASPNETBug)) { - mappedPath = pathFixingASPNETBug; - } - } - vsCodeChromeDebugLogger.log(`SourceMap: mapping ${sourcePath} => ${mappedPath}, via sourceMapPathOverrides entry - ${entryStr}`); - - return mappedPath; - } - - return sourcePath; - }; - - //--- end part copied from vscode-chrome-debug-core - // tslint:enable - } -} diff --git a/src/debug-adapter/nativeScriptTargetDiscovery.ts b/src/debug-adapter/nativeScriptTargetDiscovery.ts deleted file mode 100644 index 095c4d3..0000000 --- a/src/debug-adapter/nativeScriptTargetDiscovery.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { v4 as uuidv4 } from 'uuid'; -import { chromeConnection, chromeTargetDiscoveryStrategy, logger, telemetry } from 'vscode-chrome-debug-core'; - -export class NativeScriptTargetDiscovery extends chromeTargetDiscoveryStrategy.ChromeTargetDiscovery { - constructor() { - super(logger, new telemetry.TelemetryReporter()); - } - - public getTarget(address: string, port: number, targetFilter?: any, targetUrl?: string): Promise { - return Promise.resolve({ - description: 'NS Debug Target', - devtoolsFrontendUrl: `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=${address}:${port}`, - id: uuidv4(), - title: 'NS Debug Target', - type: 'node', - version: null, - webSocketDebuggerUrl: `ws://${address}:${port}`, - }); - } - - public async getAllTargets(address: string, - port: number, targetFilter?: chromeConnection.ITargetFilter, - targetUrl?: string): Promise { - const target = await this.getTarget(address, port); - - return Promise.resolve([target]); - } -} diff --git a/src/main.ts b/src/main.ts index 526062b..df67a55 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,5 @@ import * as semver from 'semver'; import * as vscode from 'vscode'; -import * as extProtocol from './common/extensionProtocol'; import * as utils from './common/utilities'; import { AndroidProject } from './project/androidProject'; import { IosProject } from './project/iosProject'; @@ -10,141 +9,126 @@ import { services } from './services/extensionHostServices'; import { COMPLETION_PROVIDER } from './services/language-services/autocomplete'; import { HOVER_PROVIDERS } from './services/language-services/hover/hover'; import { SUGGESTION_PROVIDERS } from './services/language-services/suggestions'; +import { DebugManager } from './debug-adapter/debugManager'; +import { NativeScriptDebugAdapter } from './debug-adapter/nativeScriptDebugAdapter'; -// this method is called when the extension is activated export function activate(context: vscode.ExtensionContext) { - services.globalState = context.globalState; - services.cliPath = 'tns'; + services.globalState = context.globalState; + services.cliPath = 'ns'; - const channel = vscode.window.createOutputChannel('NativeScript Extension'); + const channel = vscode.window.createOutputChannel('NativeScript Extension'); - services.logger = new ChannelLogger(channel); + services.logger = new ChannelLogger(channel); - const packageJSON = vscode.extensions.getExtension('nativescript.nativescript').packageJSON; - const cliVersion = services.cli().executeGetVersion(); + const packageJSON = vscode.extensions.getExtension('nativescript.nativescript')!.packageJSON; + const cliVersion = services.cli().executeGetVersion(); - if (!cliVersion) { - // tslint:disable-next-line:max-line-length - vscode.window.showErrorMessage("NativeScript CLI not found. Use 'nativescript.tnsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI."); + if (!cliVersion) { + vscode.window.showErrorMessage( + "NativeScript CLI not found. Use 'nativescript.nsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.", + ); + return; + } - return; - } + if (!semver.gte(cliVersion, packageJSON.minNativescriptCliVersion)) { + vscode.window.showErrorMessage( + `The existing NativeScript extension is compatible with NativeScript CLI v${packageJSON.minNativescriptCliVersion} or greater. The currently installed NativeScript CLI is v${cliVersion}. You can update the NativeScript CLI by executing 'npm install -g nativescript'.`, + ); + return; + } - if (!semver.gte(cliVersion, packageJSON.minNativescriptCliVersion)) { - // tslint:disable-next-line:max-line-length - vscode.window.showErrorMessage(`The existing NativeScript extension is compatible with NativeScript CLI v${packageJSON.minNativescriptCliVersion} or greater. - The currently installed NativeScript CLI is v${cliVersion}.You can update the NativeScript CLI by executing 'npm install -g nativescript'.`); + services.cliVersion = cliVersion; + services.extensionVersion = packageJSON.version; - return; - } + logExtensionInfo(cliVersion, packageJSON); + + services.analyticsService.initialize(); - services.cliVersion = cliVersion; - services.extensionVersion = packageJSON.version; + const debugManager = new DebugManager(services.logger); - logExtensionInfo(cliVersion, packageJSON); + context.subscriptions.push( + vscode.debug.registerDebugAdapterDescriptorFactory('nativescript', { + createDebugAdapterDescriptor(session) { + const adapter = new NativeScriptDebugAdapter(debugManager); + adapter.setParentSession(session); + return new vscode.DebugAdapterInlineImplementation(adapter); + }, + }), + ); - services.analyticsService.initialize(); + context.subscriptions.push({ dispose: () => debugManager.dispose() }); - const showOutputChannelCommand = vscode.commands.registerCommand('nativescript.showOutputChannel', () => { - channel.show(); + const showOutputChannelCommand = vscode.commands.registerCommand('nativescript.showOutputChannel', () => { + channel.show(); + }); + + const runCommand = (project: Project) => { + if (!vscode.workspace.workspaceFolders?.length) { + vscode.window.showErrorMessage('No workspace opened.'); + return; + } + + const runChannel = vscode.window.createOutputChannel(`Run on ${project.platformName()}`); + runChannel.clear(); + runChannel.show(); + + services.analyticsService.runRunCommand(project.platformName()); + + const tnsProcess = project.run(); + tnsProcess.on('error', () => { + vscode.window.showErrorMessage('Unexpected error executing NativeScript Run command.'); + }); + tnsProcess.stderr!.on('data', (data: Buffer) => { + runChannel.append(data.toString()); + }); + tnsProcess.stdout!.on('data', (data: Buffer) => { + runChannel.append(data.toString()); + }); + tnsProcess.on('exit', () => { + tnsProcess.stdout!.removeAllListeners('data'); + tnsProcess.stderr!.removeAllListeners('data'); + }); + tnsProcess.on('close', () => { + runChannel.hide(); }); - const beforeBuildDisposables = new Array(); - const runCommand = (project: Project) => { - if (vscode.workspace.rootPath === undefined) { - vscode.window.showErrorMessage('No workspace opened.'); - - return; - } - - // Show output channel - const runChannel: vscode.OutputChannel = vscode.window.createOutputChannel(`Run on ${project.platformName()}`); - runChannel.clear(); - runChannel.show(vscode.ViewColumn.Two); - - services.analyticsService.runRunCommand(project.platformName()); - - const tnsProcess = project.run(); - tnsProcess.on('error', (err) => { - vscode.window.showErrorMessage('Unexpected error executing NativeScript Run command.'); - }); - tnsProcess.stderr.on('data', (data) => { - runChannel.append(data.toString()); - }); - tnsProcess.stdout.on('data', (data) => { - runChannel.append(data.toString()); - }); - tnsProcess.on('exit', (exitCode) => { - tnsProcess.stdout.removeAllListeners('data'); - tnsProcess.stderr.removeAllListeners('data'); - }); - tnsProcess.on('close', (exitCode) => { - runChannel.hide(); - }); - - const disposable = { - dispose: () => { - services.buildService.disconnect(); - utils.killProcess(tnsProcess); - }, - }; - - context.subscriptions.push(disposable); - beforeBuildDisposables.push(disposable); + const disposable = { + dispose: () => { + services.buildService.disconnect(); + utils.killProcess(tnsProcess); + }, }; - const runIosCommand = vscode.commands.registerCommand('nativescript.runIos', () => { - return runCommand(new IosProject(vscode.workspace.rootPath, services.cli())); - }); + context.subscriptions.push(disposable); + }; - const runAndroidCommand = vscode.commands.registerCommand('nativescript.runAndroid', () => { - return runCommand(new AndroidProject(vscode.workspace.rootPath, services.cli())); - }); + const getWorkspaceRoot = () => vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; + + const runIosCommand = vscode.commands.registerCommand('nativescript.runIos', () => { + const root = getWorkspaceRoot(); + if (root) return runCommand(new IosProject(root, services.cli())); + }); + + const runAndroidCommand = vscode.commands.registerCommand('nativescript.runAndroid', () => { + const root = getWorkspaceRoot(); + if (root) return runCommand(new AndroidProject(root, services.cli())); + }); + + context.subscriptions.push(runIosCommand); + context.subscriptions.push(runAndroidCommand); + context.subscriptions.push(showOutputChannelCommand); - context.subscriptions.push(vscode.debug.onDidTerminateDebugSession((session) => { - if (session.type === 'nativescript') { - services.buildService.disconnect(); - } - })); - - context.subscriptions.push(vscode.debug.onDidReceiveDebugSessionCustomEvent((event) => { - if (event.event === extProtocol.BEFORE_DEBUG_START) { - channel.show(); - beforeBuildDisposables.forEach((disposable) => disposable.dispose()); - } - - if (event.event === extProtocol.NS_DEBUG_ADAPTER_MESSAGE) { - const request = event.body as extProtocol.IRequest; - const service = services[request.service]; - const method = service[request.method]; - const response = typeof method === 'function' ? service[request.method].call(service, ...request.args) : method; - - if (response && response.then) { - response.then((result) => event.session && event.session.customRequest('onExtensionResponse', { requestId: request.id, result }), - (err: Error) => { - vscode.window.showErrorMessage(err.message); - event.session.customRequest('onExtensionResponse', { requestId: request.id, isError: true, message: err.message }); - }); - - return; - } - - event.session.customRequest('onExtensionResponse', { requestId: request.id, result: response }); - } - })); - - context.subscriptions.push(runIosCommand); - context.subscriptions.push(runAndroidCommand); - context.subscriptions.push(showOutputChannelCommand); - - context.subscriptions.push(COMPLETION_PROVIDER); - context.subscriptions.concat(SUGGESTION_PROVIDERS); - context.subscriptions.concat(HOVER_PROVIDERS); + context.subscriptions.push(COMPLETION_PROVIDER); + context.subscriptions.concat(SUGGESTION_PROVIDERS); + context.subscriptions.concat(HOVER_PROVIDERS); } -function logExtensionInfo(cliVersion: string, packageJSON: any): void { - packageJSON.version && services.logger.log(`Version: ${packageJSON.version}`); - packageJSON.buildVersion && services.logger.log(`Build version: ${packageJSON.buildVersion}`); - packageJSON.commitId && services.logger.log(`Commit id: ${packageJSON.commitId}`); - services.logger.log(`NativeScript CLI: ${cliVersion}`); +function logExtensionInfo( + cliVersion: string, + packageJSON: { version?: string; buildVersion?: string; commitId?: string }, +): void { + packageJSON.version && services.logger.log(`Version: ${packageJSON.version}`); + packageJSON.buildVersion && services.logger.log(`Build version: ${packageJSON.buildVersion}`); + packageJSON.commitId && services.logger.log(`Commit id: ${packageJSON.commitId}`); + services.logger.log(`NativeScript CLI: ${cliVersion}`); } diff --git a/src/project/androidProject.ts b/src/project/androidProject.ts index 7245e52..8ffd9ef 100644 --- a/src/project/androidProject.ts +++ b/src/project/androidProject.ts @@ -7,64 +7,84 @@ import { IDebugResult, Project } from './project'; import * as scanner from './streamScanner'; export class AndroidProject extends Project { - private cliVersion: string; + private cliVersion: string; - constructor(appRoot: string, cli: NativeScriptCli) { - super(appRoot, cli); - this.cliVersion = cli.executeGetVersion(); - } + constructor(appRoot: string, cli: NativeScriptCli) { + super(appRoot, cli); + this.cliVersion = cli.executeGetVersion(); + } - public platformName(): string { - return 'android'; - } + public platformName(): string { + return 'android'; + } - public attach(tnsArgs?: string[]): IDebugResult { - let args: string[] = ['--start']; + public attach(tnsArgs?: string[]): IDebugResult { + let args: string[] = ['--start']; - args = args.concat(tnsArgs); + args = args.concat(tnsArgs ?? []); - const debugProcess: ChildProcess = super.executeDebugCommand(args); - const tnsOutputEventEmitter = new EventEmitter(); + const debugProcess: ChildProcess = super.executeDebugCommand(args); + const tnsOutputEventEmitter = new EventEmitter(); - this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter, false); + this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter, false); - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } + return { tnsProcess: debugProcess, tnsOutputEventEmitter }; + } - public debug(options: { stopOnEntry: boolean, watch: boolean, launchTests: boolean }, tnsArgs?: string[]): IDebugResult { - let args: string[] = []; + public debug( + options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, + tnsArgs?: string[], + ): IDebugResult { + let args: string[] = []; - args.push(options.watch ? '--watch' : '--no-watch'); - if (options.stopOnEntry) { args.push('--debug-brk'); } - args = args.concat(tnsArgs); + args.push(options.watch ? '--watch' : '--no-watch'); + if (options.stopOnEntry) { + args.push('--debug-brk'); + } + args = args.concat(tnsArgs ?? []); - const debugProcess: ChildProcess = options.launchTests ? - super.executeTestCommand(args) : super.executeDebugCommand(args); - const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); - const shouldWaitAfterRestartMessage = semver.lt(semver.coerce(this.cliVersion), '5.1.0'); - const waitForRestartMessage = shouldWaitAfterRestartMessage || args.indexOf('--debug-brk') > -1; + const debugProcess: ChildProcess = options.launchTests + ? super.executeTestCommand(args) + : super.executeDebugCommand(args); + const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); + const shouldWaitAfterRestartMessage = semver.lt(semver.coerce(this.cliVersion)!, '5.1.0'); + const waitForRestartMessage = shouldWaitAfterRestartMessage || args.indexOf('--debug-brk') > -1; - this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter, waitForRestartMessage); + this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter, waitForRestartMessage); - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } + return { tnsProcess: debugProcess, tnsOutputEventEmitter }; + } - protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter, waitForRestartMessage?: boolean): void { - super.configureReadyEvent(readableStream, eventEmitter); - let debugPort = null; + protected configureReadyEvent( + readableStream: stream.Readable, + eventEmitter: EventEmitter, + waitForRestartMessage?: boolean, + ): void { + super.configureReadyEvent(readableStream, eventEmitter); + let debugPort: number | null = null; - new scanner.StringMatchingScanner(readableStream).onEveryMatch(new RegExp('device: .* debug port: [0-9]+'), (match: scanner.IMatchFound) => { - // device: {device-name} debug port: {debug-port} - debugPort = parseInt((match.matches[0] as string).match('(?:debug port: )([\\d]{5})')[1], 10); - if (!waitForRestartMessage) { - setTimeout(() => { eventEmitter.emit('readyForConnection', debugPort); }, 1000); - } - }); - if (waitForRestartMessage) { - new scanner.StringMatchingScanner(readableStream).onEveryMatch('# NativeScript Debugger started #', (match: scanner.IMatchFound) => { - // wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket - setTimeout(() => { eventEmitter.emit('readyForConnection', debugPort); }, 1000); - }); + new scanner.StringMatchingScanner(readableStream).onEveryMatch( + new RegExp('device: .* debug port: [0-9]+'), + (match: scanner.IMatchFound) => { + // device: {device-name} debug port: {debug-port} + debugPort = parseInt((match.matches[0] as string).match('(?:debug port: )([\\d]{5})')![1], 10); + if (!waitForRestartMessage) { + setTimeout(() => { + eventEmitter.emit('readyForConnection', debugPort); + }, 1000); } + }, + ); + if (waitForRestartMessage) { + new scanner.StringMatchingScanner(readableStream).onEveryMatch( + '# NativeScript Debugger started #', + (match: scanner.IMatchFound) => { + // wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket + setTimeout(() => { + eventEmitter.emit('readyForConnection', debugPort); + }, 1000); + }, + ); } + } } diff --git a/src/project/iosProject.ts b/src/project/iosProject.ts index 2565d3a..ca21d1b 100644 --- a/src/project/iosProject.ts +++ b/src/project/iosProject.ts @@ -6,61 +6,68 @@ import { IDebugResult, Project } from './project'; import * as scanner from './streamScanner'; export class IosProject extends Project { + constructor(appRoot: string, cli: NativeScriptCli) { + super(appRoot, cli); - constructor(appRoot: string, cli: NativeScriptCli) { - super(appRoot, cli); - - if (!this.isPlatformOSX()) { - throw new Error('iOS platform is supported only on OS X.'); - } + if (!this.isPlatformOSX()) { + throw new Error('iOS platform is supported only on OS X.'); } + } - public platformName(): string { - return 'ios'; - } + public platformName(): string { + return 'ios'; + } - public attach(tnsArgs?: string[]): IDebugResult { - let args: string[] = ['--start']; + public attach(tnsArgs?: string[]): IDebugResult { + let args: string[] = ['--start']; - args = args.concat(tnsArgs); + args = args.concat(tnsArgs ?? []); - const debugProcess: ChildProcess = super.executeDebugCommand(args); - const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); + const debugProcess: ChildProcess = super.executeDebugCommand(args); + const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); - this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter); + this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter); - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } + return { tnsProcess: debugProcess, tnsOutputEventEmitter }; + } - public debug(options: { stopOnEntry: boolean, watch: boolean, launchTests: boolean }, tnsArgs?: string[]): IDebugResult { - let args: string[] = []; + public debug( + options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, + tnsArgs?: string[], + ): IDebugResult { + let args: string[] = []; - args.push(options.watch ? '--watch' : '--no-watch'); - if (options.stopOnEntry) { args.push('--debug-brk'); } - args = args.concat(tnsArgs); - const debugProcess: ChildProcess = options.launchTests ? - super.executeTestCommand(args) : super.executeDebugCommand(args); + args.push(options.watch ? '--watch' : '--no-watch'); + if (options.stopOnEntry) { + args.push('--debug-brk'); + } + args = args.concat(tnsArgs ?? []); + const debugProcess: ChildProcess = options.launchTests + ? super.executeTestCommand(args) + : super.executeDebugCommand(args); - const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); + const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); - this.configureReadyEvent(debugProcess.stdout, tnsOutputEventEmitter); + this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter); - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } + return { tnsProcess: debugProcess, tnsOutputEventEmitter }; + } - protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { - super.configureReadyEvent(readableStream, eventEmitter); + protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { + super.configureReadyEvent(readableStream, eventEmitter); - const streamScanner = new scanner.StringMatchingScanner(readableStream); + const streamScanner = new scanner.StringMatchingScanner(readableStream); - streamScanner.onEveryMatch(new RegExp('Opened localhost (.*)'), (match: scanner.IMatchFound) => { - const port = parseInt(match.matches[1] as string, 10); + streamScanner.onEveryMatch(new RegExp('Opened localhost (.*)'), (match: scanner.IMatchFound) => { + const port = parseInt(match.matches[1] as string, 10); - setTimeout(() => { eventEmitter.emit('readyForConnection', port); }, 1000); - }); - } + setTimeout(() => { + eventEmitter.emit('readyForConnection', port); + }, 1000); + }); + } - private isPlatformOSX(): boolean { - return /^darwin/.test(process.platform); - } + private isPlatformOSX(): boolean { + return /^darwin/.test(process.platform); + } } diff --git a/src/project/nativeScriptCli.ts b/src/project/nativeScriptCli.ts index 7083fa4..8fb4c7d 100644 --- a/src/project/nativeScriptCli.ts +++ b/src/project/nativeScriptCli.ts @@ -3,69 +3,71 @@ import { ILogger } from '../common/logger'; import * as utils from '../common/utilities'; export class NativeScriptCli { - private static CLI_OUTPUT_VERSION_REGEXP = /^(?:\d+\.){2}\d+.*?$/m; + private static CLI_OUTPUT_VERSION_REGEXP = /^(?:\d+\.){2}\d+.*?$/m; - private _path: string; - private _shellPath: string; - private _logger: ILogger; + private _path: string; + private _shellPath: string; + private _logger: ILogger; - constructor(cliPath: string, logger: ILogger) { - this._path = cliPath; - this._logger = logger; + constructor(cliPath: string, logger: ILogger) { + this._path = cliPath; + this._logger = logger; - this._shellPath = process.env.SHELL; + this._shellPath = process.env.SHELL as string; - // always default to cmd on Windows - // workaround for issue #121 https://github.com/NativeScript/nativescript-vscode-extension/issues/121 - if (utils.getPlatform() === utils.Platform.Windows) { - this._shellPath = 'cmd.exe'; - } + // always default to cmd on Windows + // workaround for issue #121 https://github.com/NativeScript/nativescript-vscode-extension/issues/121 + if (utils.getPlatform() === utils.Platform.Windows) { + this._shellPath = 'cmd.exe'; } + } - public get path(): string { return this._path; } + public get path(): string { + return this._path; + } - public executeGetVersion(): string { - try { - const versionOutput = this.executeSync(['--version'], undefined); + public executeGetVersion(): string { + try { + const versionOutput = this.executeSync(['--version']); - return this.getVersionFromCLIOutput(versionOutput); - } catch (e) { - this._logger.log(e); + return this.getVersionFromCLIOutput(versionOutput)!; + } catch (e) { + this._logger.log(e as string); - const errorMessage = `NativeScript CLI not found. Use 'nativescript.tnsPath' workspace setting + const errorMessage = `NativeScript CLI not found. Use 'nativescript.nsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.`; - throw new Error(errorMessage); - } + throw new Error(errorMessage); } + } - public executeSync(args: string[], cwd: string): string { - args.unshift('--analyticsClient', 'VSCode'); - const command: string = `${this._path} ${args.join(' ')}`; + public executeSync(args: string[], cwd?: string): string { + args.unshift('--analyticsClient', 'VSCode'); + const command: string = `${this._path} ${args.join(' ')}`; - this._logger.log(`[NativeScriptCli] execute: ${command}`); + this._logger.log(`[NativeScriptCli] execute: ${command}`); - return execSync(command, { encoding: 'utf8', cwd, shell: this._shellPath}).toString().trim(); - } + return execSync(command, { encoding: 'utf8', cwd, shell: this._shellPath }).toString().trim(); + } - public execute(args: string[], cwd: string): ChildProcess { - args.unshift('--analyticsClient', 'VSCode'); - const command: string = `${this._path} ${args.join(' ')}`; + public execute(args: string[], cwd: string): ChildProcess { + args.unshift('--analyticsClient', 'VSCode'); + const command: string = `${this._path} ${args.join(' ')}`; - this._logger.log(`[NativeScriptCli] execute: ${command}`); + this._logger.log(`[NativeScriptCli] execute: ${command}`); - const options = { cwd, shell: this._shellPath }; - const child: ChildProcess = spawn(this._path, args, options); + const options = { cwd, shell: this._shellPath }; + const child: ChildProcess = spawn(this._path, args, options); - child.stdout.setEncoding('utf8'); - child.stderr.setEncoding('utf8'); + child.stdout!.setEncoding('utf8'); + child.stderr!.setEncoding('utf8'); - return child; - } + return child; + } - private getVersionFromCLIOutput(commandOutput: string): string { - const matches = commandOutput.match(NativeScriptCli.CLI_OUTPUT_VERSION_REGEXP); + private getVersionFromCLIOutput(commandOutput: string): string | null { + const matches = commandOutput.match(NativeScriptCli.CLI_OUTPUT_VERSION_REGEXP); - return matches && matches[0]; - } + return matches && matches[0]; + } } diff --git a/src/project/project.ts b/src/project/project.ts index 1635673..d2aed19 100644 --- a/src/project/project.ts +++ b/src/project/project.ts @@ -4,46 +4,56 @@ import * as stream from 'stream'; import { NativeScriptCli } from './nativeScriptCli'; import * as scanner from './streamScanner'; -export interface IDebugResult { tnsProcess: ChildProcess; tnsOutputEventEmitter: EventEmitter; } +export interface IDebugResult { + tnsProcess: ChildProcess; + tnsOutputEventEmitter: EventEmitter; +} export abstract class Project { - private _appRoot: string; - private _cli: NativeScriptCli; + private _appRoot: string; + private _cli: NativeScriptCli; - constructor(appRoot: string, cli: NativeScriptCli) { - this._appRoot = appRoot; - this._cli = cli; - } + constructor(appRoot: string, cli: NativeScriptCli) { + this._appRoot = appRoot; + this._cli = cli; + } - public get appRoot(): string { return this._appRoot; } + public get appRoot(): string { + return this._appRoot; + } - public get cli(): NativeScriptCli { return this._cli; } + public get cli(): NativeScriptCli { + return this._cli; + } - public abstract platformName(): string; + public abstract platformName(): string; - public run(tnsArgs?: string[]): ChildProcess { - return this.executeRunCommand(tnsArgs); - } + public run(tnsArgs?: string[]): ChildProcess { + return this.executeRunCommand(tnsArgs ?? []); + } - public abstract attach(tnsArgs?: string[]): IDebugResult; + public abstract attach(tnsArgs?: string[]): IDebugResult; - public abstract debug(options: { stopOnEntry: boolean, watch: boolean, launchTests: boolean }, tnsArgs?: string[]): IDebugResult; + public abstract debug( + options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, + tnsArgs?: string[], + ): IDebugResult; - protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { - new scanner.StringMatchingScanner(readableStream).onEveryMatch('TypeScript compiler failed', () => { - eventEmitter.emit('tsCompilationError'); - }); - } + protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { + new scanner.StringMatchingScanner(readableStream).onEveryMatch('TypeScript compiler failed', () => { + eventEmitter.emit('tsCompilationError'); + }); + } - protected executeRunCommand(args: string[]): ChildProcess { - return this._cli.execute(['run', this.platformName()].concat(args), this._appRoot); - } + protected executeRunCommand(args: string[]): ChildProcess { + return this._cli.execute(['run', this.platformName()].concat(args), this._appRoot); + } - protected executeDebugCommand(args: string[]): ChildProcess { - return this._cli.execute(['debug', this.platformName()].concat(args), this._appRoot); - } + protected executeDebugCommand(args: string[]): ChildProcess { + return this._cli.execute(['debug', this.platformName()].concat(args), this._appRoot); + } - protected executeTestCommand(args: string[]): ChildProcess { - return this._cli.execute(['test', this.platformName()].concat(args), this._appRoot); - } + protected executeTestCommand(args: string[]): ChildProcess { + return this._cli.execute(['test', this.platformName()].concat(args), this._appRoot); + } } diff --git a/src/project/streamScanner.ts b/src/project/streamScanner.ts index ae64080..164d851 100644 --- a/src/project/streamScanner.ts +++ b/src/project/streamScanner.ts @@ -1,98 +1,98 @@ import { Readable } from 'stream'; export class StreamScanner { - private _stream: Readable; - private _scanCallback: (data: string, stop: () => void) => void; - - constructor(stream: Readable, scanCallback: (data: string, stop: () => void) => void) { - this._stream = stream; - this._scanCallback = scanCallback; - this._stream.on('data', this.scan.bind(this)); - } - - public stop() { - this._stream.removeListener('data', this.scan); - } - - private scan(data: string | Buffer): void { - this._scanCallback(data.toString(), this.stop); - } + private _stream: Readable; + private _scanCallback: (data: string, stop: () => void) => void; + + constructor(stream: Readable, scanCallback: (data: string, stop: () => void) => void) { + this._stream = stream; + this._scanCallback = scanCallback; + this._stream.on('data', this.scan.bind(this)); + } + + public stop() { + this._stream.removeListener('data', this.scan); + } + + private scan(data: string | Buffer): void { + this._scanCallback(data.toString(), this.stop); + } } export interface IMatchFound { - chunk: string; - matches: RegExpMatchArray | number[]; + chunk: string; + matches: RegExpMatchArray | number[]; } interface IMatchMeta { - promise: Promise; - resolve: (match: IMatchFound) => void; - reject: (err: Error) => void; - test: string | RegExp; + promise: Promise; + resolve: (match: IMatchFound) => void; + reject: (err: Error) => void; + test: string | RegExp; } export class StringMatchingScanner extends StreamScanner { - private metas: IMatchMeta[]; - - constructor(stream: Readable) { - super(stream, (data: string, stop: () => void) => { - this.metas.forEach((meta, metaIndex) => { - if (meta.test instanceof RegExp) { - const result: RegExpMatchArray = data.match(meta.test as RegExp); - - if (result && result.length > 0) { - this.matchFound(metaIndex, { chunk: data, matches: result }); - } - } else if (typeof meta.test === 'string') { - const result: number[] = []; // matches indices - let dataIndex = data.indexOf(meta.test as string, 0); - - while (dataIndex > -1) { - result.push(dataIndex); - dataIndex = data.indexOf(meta.test as string, dataIndex + 1); - } - if (result.length > 0) { - this.matchFound(metaIndex, { chunk: data, matches: result }); - } - } else { - throw new TypeError('Invalid type'); - } - }); - }); - - this.metas = []; - } - - public onEveryMatch(test: string | RegExp, handler: (result: IMatchFound) => void) { - const handlerWrapper = (result: IMatchFound) => { - handler(result); - this.nextMatch(test).then(handlerWrapper); - }; - - this.nextMatch(test).then(handlerWrapper); - } - - public nextMatch(test: string | RegExp): Promise { - const meta: IMatchMeta = { - promise: null, - reject: null, - resolve: null, - test, - }; - - meta.promise = new Promise((resolve, reject) => { - meta.resolve = resolve; - meta.reject = reject; - }); - this.metas.push(meta); - - return meta.promise; - } - - private matchFound(matchMetaIndex: number, matchResult: IMatchFound) { - const meta: IMatchMeta = this.metas[matchMetaIndex]; - - this.metas.splice(matchMetaIndex, 1); // remove the meta - meta.resolve(matchResult); - } + private metas: IMatchMeta[]; + + constructor(stream: Readable) { + super(stream, (data: string, stop: () => void) => { + this.metas.forEach((meta, metaIndex) => { + if (meta.test instanceof RegExp) { + const result: RegExpMatchArray | null = data.match(meta.test as RegExp); + + if (result && result.length > 0) { + this.matchFound(metaIndex, { chunk: data, matches: result }); + } + } else if (typeof meta.test === 'string') { + const result: number[] = []; // matches indices + let dataIndex = data.indexOf(meta.test as string, 0); + + while (dataIndex > -1) { + result.push(dataIndex); + dataIndex = data.indexOf(meta.test as string, dataIndex + 1); + } + if (result.length > 0) { + this.matchFound(metaIndex, { chunk: data, matches: result }); + } + } else { + throw new TypeError('Invalid type'); + } + }); + }); + + this.metas = []; + } + + public onEveryMatch(test: string | RegExp, handler: (result: IMatchFound) => void) { + const handlerWrapper = (result: IMatchFound) => { + handler(result); + this.nextMatch(test).then(handlerWrapper); + }; + + this.nextMatch(test).then(handlerWrapper); + } + + public nextMatch(test: string | RegExp): Promise { + const meta: IMatchMeta = { + promise: null!, + reject: null!, + resolve: null!, + test, + }; + + meta.promise = new Promise((resolve, reject) => { + meta.resolve = resolve; + meta.reject = reject; + }); + this.metas.push(meta); + + return meta.promise; + } + + private matchFound(matchMetaIndex: number, matchResult: IMatchFound) { + const meta: IMatchMeta = this.metas[matchMetaIndex]; + + this.metas.splice(matchMetaIndex, 1); // remove the meta + meta.resolve(matchResult); + } } diff --git a/src/services/buildService.ts b/src/services/buildService.ts index e03e24c..858b573 100644 --- a/src/services/buildService.ts +++ b/src/services/buildService.ts @@ -1,171 +1,186 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as vscode from 'vscode'; -import * as utils from '../common/utilities'; - import { ChildProcess } from 'child_process'; +import { EventEmitter } from 'events'; import { ILogger } from '../common/logger'; import { AndroidProject } from '../project/androidProject'; import { IosProject } from '../project/iosProject'; import { NativeScriptCli } from '../project/nativeScriptCli'; import { IDebugResult } from '../project/project'; +import * as utils from '../common/utilities'; import { services } from './extensionHostServices'; -export class BuildService { - private _tnsProcess: ChildProcess; - private _logger: ILogger; - - constructor(logger: ILogger) { - this._logger = logger; - } +export interface BuildSession { + initialPort: Promise; + portEmitter: EventEmitter; + disconnect(): void; +} - public async processRequest(args: any): Promise { - const tnsPath = services.workspaceConfigService.tnsPath; +export class BuildService { + private _tnsProcess: ChildProcess | null = null; + private _logger: ILogger; - this._logger.log(`[NSDebugAdapter] Using tns CLI on path '${tnsPath}'\n`); - const tnsPathResolved = (tnsPath !== 'tns' && !path.isAbsolute(tnsPath)) ? path.join(args.appRoot, tnsPath) : tnsPath; - const cli = new NativeScriptCli(tnsPathResolved, this._logger); + constructor(logger: ILogger) { + this._logger = logger; + } - const project = args.platform === 'ios' ? - new IosProject(args.appRoot, cli) : - new AndroidProject(args.appRoot, cli); + public async startBuild(args: { + appRoot: string; + platform: string; + request: string; + watch?: boolean; + stopOnEntry?: boolean; + launchTests?: boolean; + tnsArgs?: string[]; + }): Promise { + const nsPath = services.workspaceConfigService.nsPath; - services.analyticsService.launchDebugger(args.request, args.platform); + this._logger.log(`[NativeScript] Using ns CLI on path '${nsPath}'\n`); + const nsPathResolved = nsPath !== 'ns' && !path.isAbsolute(nsPath) ? path.join(args.appRoot, nsPath) : nsPath; + const cli = new NativeScriptCli(nsPathResolved, this._logger); - // Run CLI Command - const version = project.cli.executeGetVersion(); + const project = args.platform === 'ios' ? new IosProject(args.appRoot, cli) : new AndroidProject(args.appRoot, cli); - this._logger.log(`[NSDebugAdapter] Using tns CLI v${version} on path '${project.cli.path}'\n`); - this._logger.log('[NSDebugAdapter] Running tns command...\n'); + services.analyticsService.launchDebugger(args.request, args.platform); - let cliCommand: IDebugResult; + const version = project.cli.executeGetVersion(); + this._logger.log(`[NativeScript] Using ns CLI v${version} on path '${project.cli.path}'\n`); + this._logger.log('[NativeScript] Running ns command...\n'); - if (args.request === 'launch') { - let tnsArgs = args.tnsArgs; + let cliCommand: IDebugResult; - // For iOS the TeamID is required if there's more than one. - // Therefore if not set, show selection to the user. - if (args.platform && args.platform.toLowerCase() === 'ios') { - const teamId = this.getTeamId(path.join(args.appRoot, 'app'), tnsArgs); + if (args.request === 'launch') { + let tnsArgs = args.tnsArgs; - if (!teamId) { - const selectedTeam = await services.iOSTeamService.selectTeam(); + if (args.platform?.toLowerCase() === 'ios') { + const teamId = this.getTeamId(path.join(args.appRoot, 'app'), tnsArgs); - if (selectedTeam) { - // add the selected by the user Team Id - tnsArgs = (tnsArgs || []).concat(['--teamId', selectedTeam.id]); - this._logger.log(`[NSDebugAdapter] Using iOS Team ID '${selectedTeam.id}', you can change this in the workspace settings.\n`); - } - } - } + if (!teamId) { + const selectedTeam = await services.iOSTeamService.selectTeam(); - cliCommand = project.debug({ stopOnEntry: args.stopOnEntry, watch: args.watch, launchTests: args.launchTests }, tnsArgs); - } else if (args.request === 'attach') { - cliCommand = project.attach(args.tnsArgs); + if (selectedTeam) { + tnsArgs = (tnsArgs ?? []).concat(['--teamId', selectedTeam.id]); + this._logger.log(`[NativeScript] Using iOS Team ID '${selectedTeam.id}'\n`); + } } - - return new Promise((res, rej) => { - if (cliCommand.tnsProcess) { - this._tnsProcess = cliCommand.tnsProcess; - cliCommand.tnsProcess.stdout.on('data', (data) => { this._logger.log(data.toString()); }); - cliCommand.tnsProcess.stderr.on('data', (data) => { this._logger.log(data.toString()); }); - - cliCommand.tnsProcess.on('close', (code, signal) => { - this._logger.log(`[NSDebugAdapter] The tns command finished its execution with code ${code}.\n`); - - // Sometimes we execute "tns debug android --start" and the process finishes - // which is totally fine. If there's an error we need to Terminate the session. - if (code !== 0) { - const errorMessage = `The tns command finished its execution with code ${code}`; - - this._logger.log(errorMessage); - } - - res(); - }); - } - - this._logger.log('[NSDebugAdapter] Watching the tns CLI output to receive a connection token\n'); - - cliCommand.tnsOutputEventEmitter.on('readyForConnection', (connectionToken: string | number) => { - this._logger.log(`[NSDebugAdapter] Ready to attach to application on ${connectionToken}\n`); - args.port = connectionToken; - const session = vscode.debug.activeDebugSession; - if (session) { - session.customRequest('onPortReceived', { port: connectionToken }).then( - () => this._logger.log(`[NSDebugAdapter] Port ${connectionToken} delivered to debug session\n`), - (err) => this._logger.log(`[NSDebugAdapter] Failed to deliver port to debug session: ${err}\n`), - ); - } else { - this._logger.log(`[NSDebugAdapter] No active debug session to deliver port ${connectionToken}\n`); - } - - res(connectionToken); - }); - }); + } + + cliCommand = project.debug( + { + stopOnEntry: args.stopOnEntry ?? false, + watch: args.watch ?? false, + launchTests: args.launchTests ?? false, + }, + tnsArgs, + ); + } else { + cliCommand = project.attach(args.tnsArgs); } - public disconnect(): void { - if (this._tnsProcess) { - this._tnsProcess.stdout.removeAllListeners(); - this._tnsProcess.stderr.removeAllListeners(); - this._tnsProcess.removeAllListeners(); - utils.killProcess(this._tnsProcess); + const portEmitter = new EventEmitter(); + let firstPortResolve: ((port: number | undefined) => void) | null = null; + let lastPortTimestamp = 0; + + const initialPort = new Promise((resolve) => { + firstPortResolve = resolve; + }); + + if (cliCommand.tnsProcess) { + this._tnsProcess = cliCommand.tnsProcess; + cliCommand.tnsProcess.stdout!.on('data', (data: Buffer) => { + this._logger.log(data.toString()); + }); + cliCommand.tnsProcess.stderr!.on('data', (data: Buffer) => { + this._logger.log(data.toString()); + }); + + cliCommand.tnsProcess.on('close', (code) => { + this._logger.log(`[NativeScript] The ns command finished with code ${code}.\n`); + if (firstPortResolve) { + firstPortResolve(undefined); + firstPortResolve = null; } + portEmitter.emit('closed', code); + }); } - private getTeamId(appRoot: string, tnsArgs?: string[]): string { - // try to get the TeamId from the TnsArgs - if (tnsArgs) { - const teamIdArgIndex = tnsArgs.indexOf('--teamId'); - - if (teamIdArgIndex > 0 && teamIdArgIndex + 1 < tnsArgs.length) { - return tnsArgs[teamIdArgIndex + 1]; - } - } - - // try to get the TeamId from the buildxcconfig or teamid file - const teamIdFromConfig = this.readTeamId(appRoot); - - if (teamIdFromConfig) { - return teamIdFromConfig; - } - - // we should get the Teams from the machine and ask the user if they are more than 1 - return null; + this._logger.log('[NativeScript] Watching ns CLI output for connection token\n'); + + cliCommand.tnsOutputEventEmitter.on('readyForConnection', (connectionToken: string | number) => { + const port = typeof connectionToken === 'string' ? parseInt(connectionToken, 10) : connectionToken; + const now = Date.now(); + this._logger.log(`[NativeScript] Ready to attach on port ${port}\n`); + + if (firstPortResolve) { + firstPortResolve(port); + firstPortResolve = null; + lastPortTimestamp = now; + } else if (now - lastPortTimestamp > 2000) { + lastPortTimestamp = now; + portEmitter.emit('newPort', port); + } else { + this._logger.log(`[NativeScript] Ignoring duplicate port notification\n`); + } + }); + + return { + initialPort, + portEmitter, + disconnect: () => this.disconnect(), + }; + } + + public disconnect(): void { + if (this._tnsProcess) { + this._tnsProcess.stdout?.removeAllListeners(); + this._tnsProcess.stderr?.removeAllListeners(); + this._tnsProcess.removeAllListeners(); + utils.killProcess(this._tnsProcess); + this._tnsProcess = null; + } + } + + private getTeamId(appRoot: string, tnsArgs?: string[]): string | null { + if (tnsArgs) { + const teamIdArgIndex = tnsArgs.indexOf('--teamId'); + if (teamIdArgIndex > 0 && teamIdArgIndex + 1 < tnsArgs.length) { + return tnsArgs[teamIdArgIndex + 1]; + } } - private readXCConfig(appRoot: string, flag: string): string { - const xcconfigFile = path.join(appRoot, 'App_Resources/iOS/build.xcconfig'); - - if (fs.existsSync(xcconfigFile)) { - const text = fs.readFileSync(xcconfigFile, { encoding: 'utf8' }); - let teamId: string; - - text.split(/\r?\n/).forEach((line) => { - line = line.replace(/\/(\/)[^\n]*$/, ''); - if (line.indexOf(flag) >= 0) { - teamId = line.split('=')[1].trim(); - if (teamId[teamId.length - 1] === ';') { - teamId = teamId.slice(0, -1); - } - } - }); - if (teamId) { - return teamId; - } - } + return this.readTeamId(appRoot); + } - const fileName = path.join(appRoot, 'teamid'); + private readXCConfig(appRoot: string, flag: string): string | null { + const xcconfigFile = path.join(appRoot, 'App_Resources/iOS/build.xcconfig'); - if (fs.existsSync(fileName)) { - return fs.readFileSync(fileName, { encoding: 'utf8' }); - } + if (fs.existsSync(xcconfigFile)) { + const text = fs.readFileSync(xcconfigFile, { encoding: 'utf8' }); + let teamId: string | undefined; - return null; + text.split(/\r?\n/).forEach((line) => { + line = line.replace(/\/(\/)[^\n]*$/, ''); + if (line.indexOf(flag) >= 0) { + teamId = line.split('=')[1]?.trim(); + if (teamId && teamId[teamId.length - 1] === ';') { + teamId = teamId.slice(0, -1); + } + } + }); + if (teamId) { + return teamId; + } } - private readTeamId(appRoot): string { - return this.readXCConfig(appRoot, 'DEVELOPMENT_TEAM'); + const fileName = path.join(appRoot, 'teamid'); + if (fs.existsSync(fileName)) { + return fs.readFileSync(fileName, { encoding: 'utf8' }); } + + return null; + } + + private readTeamId(appRoot: string): string | null { + return this.readXCConfig(appRoot, 'DEVELOPMENT_TEAM'); + } } diff --git a/src/services/channelLogger.ts b/src/services/channelLogger.ts index e72ae65..6108be6 100644 --- a/src/services/channelLogger.ts +++ b/src/services/channelLogger.ts @@ -1,17 +1,17 @@ import { OutputChannel } from 'vscode'; -import { ILogger, LogLevel } from '../common/logger'; +import { ILogger, LogLevel } from '../common/logger'; export class ChannelLogger implements ILogger { - private minLogLevel: LogLevel = LogLevel.Log; - private channel: OutputChannel; + private minLogLevel: LogLevel = LogLevel.Log; + private channel: OutputChannel; - constructor(channel: OutputChannel) { - this.channel = channel; - } + constructor(channel: OutputChannel) { + this.channel = channel; + } - public log(msg: string, level: LogLevel = LogLevel.Log): void { - if (level >= this.minLogLevel) { - this.channel.appendLine(msg); - } + public log(msg: string, level: LogLevel = LogLevel.Log): void { + if (level >= this.minLogLevel) { + this.channel.appendLine(msg); } + } } diff --git a/src/services/extensionHostServices.ts b/src/services/extensionHostServices.ts index f99e923..e62a7e7 100644 --- a/src/services/extensionHostServices.ts +++ b/src/services/extensionHostServices.ts @@ -6,43 +6,49 @@ import { iOSTeamService } from './iOSTeamService'; import { Services as BaseServices } from './services'; export class ExtensionHostServices extends BaseServices { - public cliVersion: string; - public extensionVersion: string; + public cliVersion!: string; + public extensionVersion!: string; - private _globalState: vscode.Memento; + private _globalState!: vscode.Memento; - private _workspaceConfigService: WorkspaceConfigService; - private _iOSTeamService: iOSTeamService; - private _analyticsService: AnalyticsService; - private _buildService: BuildService; + private _workspaceConfigService!: WorkspaceConfigService; + private _iOSTeamService!: iOSTeamService; + private _analyticsService!: AnalyticsService; + private _buildService!: BuildService; - public get globalState(): vscode.Memento { return this._globalState; } + public get globalState(): vscode.Memento { + return this._globalState; + } - public set globalState(globalState: vscode.Memento) { this._globalState = globalState; } + public set globalState(globalState: vscode.Memento) { + this._globalState = globalState; + } - public get workspaceConfigService(): WorkspaceConfigService { - this._workspaceConfigService = this._workspaceConfigService || new WorkspaceConfigService(); + public get workspaceConfigService(): WorkspaceConfigService { + this._workspaceConfigService = this._workspaceConfigService || new WorkspaceConfigService(); - return this._workspaceConfigService; - } + return this._workspaceConfigService; + } - public get iOSTeamService(): iOSTeamService { - this._iOSTeamService = this._iOSTeamService || new iOSTeamService(); + public get iOSTeamService(): iOSTeamService { + this._iOSTeamService = this._iOSTeamService || new iOSTeamService(); - return this._iOSTeamService; - } + return this._iOSTeamService; + } - public get analyticsService(): AnalyticsService { - this._analyticsService = this._analyticsService || new AnalyticsService(this.globalState, this.cliVersion, this.extensionVersion, this._logger); + public get analyticsService(): AnalyticsService { + this._analyticsService = + this._analyticsService || + new AnalyticsService(this.globalState, this.cliVersion, this.extensionVersion, this._logger); - return this._analyticsService; - } + return this._analyticsService; + } - public get buildService(): BuildService { - this._buildService = this._buildService || new BuildService(this._logger); + public get buildService(): BuildService { + this._buildService = this._buildService || new BuildService(this._logger); - return this._buildService; - } + return this._buildService; + } } export let services = new ExtensionHostServices(); diff --git a/src/services/iOSTeamService.ts b/src/services/iOSTeamService.ts index 32ee781..e8ac6c9 100644 --- a/src/services/iOSTeamService.ts +++ b/src/services/iOSTeamService.ts @@ -4,91 +4,94 @@ import * as vscode from 'vscode'; // tslint:disable-next-line:class-name export class iOSTeamService { - public selectTeam(): Promise<{ id: string, name: string } | void> { - return new Promise((resolve, reject) => { - const workspaceTeamId = vscode.workspace.getConfiguration().get('nativescript.iosTeamId'); + public selectTeam(): Promise<{ id: string; name: string } | void> { + return new Promise((resolve, reject) => { + const workspaceTeamId = vscode.workspace.getConfiguration().get('nativescript.iosTeamId'); + + if (workspaceTeamId) { + resolve({ + id: workspaceTeamId, + name: '', // irrelevant + }); - if (workspaceTeamId) { - resolve({ - id: workspaceTeamId, - name: undefined, // irrelevant - }); + return; + } - return; - } + const developmentTeams = this.getDevelopmentTeams(); - const developmentTeams = this.getDevelopmentTeams(); - - if (developmentTeams.length > 1) { - const quickPickItems: vscode.QuickPickItem[] = developmentTeams.map((team) => { - return { - description: team.id, - label: team.name, - }; - }); - - vscode.window.showQuickPick( - quickPickItems, { - placeHolder: 'Select your development team', - }) - .then((val: vscode.QuickPickItem) => { - vscode.workspace.getConfiguration().update('nativescript.iosTeamId', val.description); - resolve({ - id: val.description, - name: val.label, - }); - }); - } else { - resolve(); - } + if (developmentTeams.length > 1) { + const quickPickItems: vscode.QuickPickItem[] = developmentTeams.map((team) => { + return { + description: team.id, + label: team.name, + }; }); - } - private getDevelopmentTeams(): Array<{ id: string, name: string }> { - try { - const dir = path.join(process.env.HOME, 'Library/MobileDevice/Provisioning Profiles/'); - const files = fs.readdirSync(dir); - const teamIds: any = {}; - - for (const file of files) { - const filePath = path.join(dir, file); - const data = fs.readFileSync(filePath, { encoding: 'utf8' }); - const teamId = this.getProvisioningProfileValue('TeamIdentifier', data); - const teamName = this.getProvisioningProfileValue('TeamName', data); - - if (teamId) { - teamIds[teamId] = teamName; - } + vscode.window + .showQuickPick(quickPickItems, { + placeHolder: 'Select your development team', + }) + .then((val: vscode.QuickPickItem | undefined) => { + if (!val) { + return; } + vscode.workspace.getConfiguration().update('nativescript.iosTeamId', val.description); + resolve({ + id: val.description!, + name: val.label, + }); + }); + } else { + resolve(); + } + }); + } + + private getDevelopmentTeams(): Array<{ id: string; name: string }> { + try { + const dir = path.join(process.env.HOME!, 'Library/MobileDevice/Provisioning Profiles/'); + const files = fs.readdirSync(dir); + const teamIds: any = {}; + + for (const file of files) { + const filePath = path.join(dir, file); + const data = fs.readFileSync(filePath, { encoding: 'utf8' }); + const teamId = this.getProvisioningProfileValue('TeamIdentifier', data); + const teamName = this.getProvisioningProfileValue('TeamName', data); + + if (teamId) { + teamIds[teamId] = teamName; + } + } - const teamIdsArray = new Array<{ id: string, name: string }>(); + const teamIdsArray = new Array<{ id: string; name: string }>(); - for (const teamId in teamIds) { - teamIdsArray.push({ id: teamId, name: teamIds[teamId] }); - } + for (const teamId in teamIds) { + teamIdsArray.push({ id: teamId, name: teamIds[teamId] }); + } - return teamIdsArray; - } catch (e) { - // no matter what happens, don't break - return new Array<{ id: string, name: string }>(); - } + return teamIdsArray; + } catch (e) { + // no matter what happens, don't break + return new Array<{ id: string; name: string }>(); } + } - private getProvisioningProfileValue(name: string, text: string): string { - const findStr = '' + name + ''; - let index = text.indexOf(findStr); + private getProvisioningProfileValue(name: string, text: string): string | null { + const findStr = '' + name + ''; + let index = text.indexOf(findStr); - if (index > 0) { - index = text.indexOf('', index + findStr.length); - if (index > 0) { - index += ''.length; - const endIndex = text.indexOf('', index); - const result = text.substring(index, endIndex); + if (index > 0) { + index = text.indexOf('', index + findStr.length); + if (index > 0) { + index += ''.length; + const endIndex = text.indexOf('', index); + const result = text.substring(index, endIndex); - return result; - } - } - - return null; + return result; + } } + + return null; + } } diff --git a/src/services/language-services/autocomplete.ts b/src/services/language-services/autocomplete.ts index 98e1e05..6dd8631 100644 --- a/src/services/language-services/autocomplete.ts +++ b/src/services/language-services/autocomplete.ts @@ -72,25 +72,27 @@ HORIZONTAL_ALIGNMENT.commitCharacters = ['=']; HORIZONTAL_ALIGNMENT.documentation = new vscode.MarkdownString(GENERIC_AUTOCOMPLETE_DESCRIPTION); export const COMPLETION_PROVIDER = vscode.languages.registerCompletionItemProvider('html', { - - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position, token: vscode.CancellationToken, context: vscode.CompletionContext) { - - return [ - AUTOCAPITALIZATION, - KEYBOARD_TYPE, - RETURN_KEY_TYPE, - TAB_BACKGROUND_COLOR, - SELECTED_TAB_TEXT_COLOR, - TAB_TEXT_COLOR, - ORIENTATION, - FONT_STYLE, - TEXT_ALIGNMENT, - TEXT_DECORATION, - TEXT_TRANSFORM, - VISIBILITY, - VERTICAL_ALIGNMENT, - HORIZONTAL_ALIGNMENT, - ]; - - }, + provideCompletionItems( + document: vscode.TextDocument, + position: vscode.Position, + token: vscode.CancellationToken, + context: vscode.CompletionContext, + ) { + return [ + AUTOCAPITALIZATION, + KEYBOARD_TYPE, + RETURN_KEY_TYPE, + TAB_BACKGROUND_COLOR, + SELECTED_TAB_TEXT_COLOR, + TAB_TEXT_COLOR, + ORIENTATION, + FONT_STYLE, + TEXT_ALIGNMENT, + TEXT_DECORATION, + TEXT_TRANSFORM, + VISIBILITY, + VERTICAL_ALIGNMENT, + HORIZONTAL_ALIGNMENT, + ]; + }, }); diff --git a/src/services/language-services/hover/layout-hover.ts b/src/services/language-services/hover/layout-hover.ts index 698b09f..e45cc27 100644 --- a/src/services/language-services/hover/layout-hover.ts +++ b/src/services/language-services/hover/layout-hover.ts @@ -1,142 +1,148 @@ import * as vscode from 'vscode'; export const STACK_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'stacklayout') { - - const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`A Layout that arranges its children horizontally or vertically. The direction can be set by orientation property.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_stack_layout_)`); - - autocapDescription.isTrusted = true; - - return new vscode.Hover(autocapDescription); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'stacklayout') { + const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() + .appendText( + `A Layout that arranges its children horizontally or vertically. The direction can be set by orientation property.\n`, + ) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_stack_layout_)`, + ); + + autocapDescription.isTrusted = true; + + return new vscode.Hover(autocapDescription); + } + }, }); export const GRID_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'gridlayout') { - - const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Defines a rectangular layout area that consists of columns and rows.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_grid_layout_)`); - - autocapDescription.isTrusted = true; - - return new vscode.Hover(autocapDescription); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'gridlayout') { + const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Defines a rectangular layout area that consists of columns and rows.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_grid_layout_)`, + ); + + autocapDescription.isTrusted = true; + + return new vscode.Hover(autocapDescription); + } + }, }); export const ABSOLUTE_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'absolutelayout') { - - const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`A layout that lets you specify exact locations (left/top coordinates) of its children.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_absolute_layout_)`); - - autocapDescription.isTrusted = true; - - return new vscode.Hover(autocapDescription); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'absolutelayout') { + const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`A layout that lets you specify exact locations (left/top coordinates) of its children.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_absolute_layout_)`, + ); + + autocapDescription.isTrusted = true; + + return new vscode.Hover(autocapDescription); + } + }, }); export const DOCK_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'docklayout') { - - const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`A Layout that arranges its children at its outer edges, and allows its last child to take up the remaining space.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_dock_layout_)`); - - autocapDescription.isTrusted = true; - - return new vscode.Hover(autocapDescription); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'docklayout') { + const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() + .appendText( + `A Layout that arranges its children at its outer edges, and allows its last child to take up the remaining space.\n`, + ) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_dock_layout_)`, + ); + + autocapDescription.isTrusted = true; + + return new vscode.Hover(autocapDescription); + } + }, }); export const FLEXBOX_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'flexboxlayout') { - - const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`A layout based on flexbox.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_flexbox_layout_)`); - - autocapDescription.isTrusted = true; - - return new vscode.Hover(autocapDescription); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'flexboxlayout') { + const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`A layout based on flexbox.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_flexbox_layout_)`, + ); + + autocapDescription.isTrusted = true; + + return new vscode.Hover(autocapDescription); + } + }, }); export const WRAP_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'wraplayout') { - - const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`A layout that positions children in rows or columns depending on orientation property until space is filled and then wraps them on new row or column.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_wrap_layout_)`); - - autocapDescription.isTrusted = true; - - return new vscode.Hover(autocapDescription); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'wraplayout') { + const autocapDescription: vscode.MarkdownString = new vscode.MarkdownString() + .appendText( + `A layout that positions children in rows or columns depending on orientation property until space is filled and then wraps them on new row or column.\n`, + ) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/layouts/layout-containers)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_layouts_wrap_layout_)`, + ); + + autocapDescription.isTrusted = true; + + return new vscode.Hover(autocapDescription); + } + }, }); export const LAYOUT_HOVER_PROVIDERS = [ - STACK_LAYOUT, - GRID_LAYOUT, - ABSOLUTE_LAYOUT, - DOCK_LAYOUT, - FLEXBOX_LAYOUT, - WRAP_LAYOUT, + STACK_LAYOUT, + GRID_LAYOUT, + ABSOLUTE_LAYOUT, + DOCK_LAYOUT, + FLEXBOX_LAYOUT, + WRAP_LAYOUT, ]; diff --git a/src/services/language-services/hover/ui-enum-hover.ts b/src/services/language-services/hover/ui-enum-hover.ts index a57f3b3..461c013 100644 --- a/src/services/language-services/hover/ui-enum-hover.ts +++ b/src/services/language-services/hover/ui-enum-hover.ts @@ -1,507 +1,479 @@ import * as vscode from 'vscode'; export const ACCURACY = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'accuracy'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies common accuracy values.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.accuracy)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'accuracy'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies common accuracy values.`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.accuracy)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const ANDROID_ACTION_BAR_VISIBILITY = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'AndroidActionBarIconVisibility'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies the visibility of the Android application bar icon.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.androidactionbariconvisibility)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'AndroidActionBarIconVisibility'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies the visibility of the Android application bar icon.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.androidactionbariconvisibility)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const ANDROID_ACTION_BAR_POSITION = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'AndroidActionItemPosition'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies android MenuItem position.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.androidactionitemposition)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'AndroidActionItemPosition'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies android MenuItem position.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.androidactionitemposition)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const ANIMATION_CURVE = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'AnimationCurve'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents an animation curve type.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.animationcurve)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'AnimationCurve'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents an animation curve type.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.animationcurve)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const AUTOCAPITALIZATION = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'AutocapitalizationType'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents the auto-capitalization style for a text input.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.autocapitalizationtype)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'AutocapitalizationType'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents the auto-capitalization style for a text input.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.autocapitalizationtype)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const BACKGROUND_REPEAT = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'BackgroundRepeat'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies background repeat.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.backgroundrepeat)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'BackgroundRepeat'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies background repeat.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.backgroundrepeat)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const DOCK = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'dock'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies the Dock position of a child element that is inside a DockLayout.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.dock)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'dock'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies the Dock position of a child element that is inside a DockLayout.`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.dock)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const FONT_ATTRIBUTES = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'FontAttributes'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`A flag enum that represents common font attributes.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.fontattributes)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'FontAttributes'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`A flag enum that represents common font attributes.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.fontattributes)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const FONT_STYLE = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'FontStyle'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies different font styles.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.fontstyle)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'FontStyle'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies different font styles.`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.fontstyle)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const FONT_WEIGHT = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'FontWeight'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies different font weights.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.fontweight)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'FontWeight'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies different font weights.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.fontweight)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const HORIZONTAL_ALIGNMENT = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'HorizontalAlignment'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`HorizontalAlignment indicates where an element should be displayed on the horizontal axis relative to the allocated layout slot of the parent element.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.horizontalalignment)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'HorizontalAlignment'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText( + `HorizontalAlignment indicates where an element should be displayed on the horizontal axis relative to the allocated layout slot of the parent element.`, + ) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.horizontalalignment)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const IOS_ACTION_ITEM_POSITION = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'IOSActionItemPosition'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies iOS MenuItem position.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.iosactionitemposition)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'IOSActionItemPosition'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies iOS MenuItem position.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.iosactionitemposition)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const IMAGE_FORMAT = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'ImageFormat'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Defines the recognized image formats.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.imageformat)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'ImageFormat'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Defines the recognized image formats.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.imageformat)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const KEYBOARD_TYPE = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'KeyboardType'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a soft keyboard flavor.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.keyboardtype)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'KeyboardType'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a soft keyboard flavor.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.keyboardtype)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const NAVIGATION_BAR_VISIBILITY = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'NavigationBarVisibility'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies NavigationBar visibility mode.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.navigationbarvisibility)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'NavigationBarVisibility'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies NavigationBar visibility mode.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.navigationbarvisibility)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const ORIENTATION = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Orientation'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Orientation indicates a direction of a layout that can exist in a horizontal or vertical state.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.orientation)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Orientation'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Orientation indicates a direction of a layout that can exist in a horizontal or vertical state.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.orientation)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const RETURN_KEY_TYPE = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'ReturnKeyType'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents the flavor of the return key on the soft keyboard.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.returnkeytype)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'ReturnKeyType'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents the flavor of the return key on the soft keyboard.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.returnkeytype)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const STRETCH = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Stretch'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Describes how content is resized to fill its allocated space.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.stretch)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Stretch'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Describes how content is resized to fill its allocated space.`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.stretch)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TEXT_ALIGNMENT = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'TextAlignment'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a text-align enumeration.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.textalignment)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'TextAlignment'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a text-align enumeration.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.textalignment)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TEXT_DECORATION = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'TextDecoration'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies different text decorations.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.textdecoration)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'TextDecoration'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies different text decorations.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.textdecoration)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TEXT_TRANSFORM = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'TextTransform'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies different text transforms.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.texttransform)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'TextTransform'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies different text transforms.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.texttransform)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const VERTICAL_ALIGNMENT = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'VerticalAlignment'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`VerticalAlignment indicates where an element should be displayed on the horizontal axis relative to the allocated layout slot of the parent element.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.verticalalignment)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'VerticalAlignment'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText( + `VerticalAlignment indicates where an element should be displayed on the horizontal axis relative to the allocated layout slot of the parent element.`, + ) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.verticalalignment)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const VISIBILITY = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Visibility'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents the visibility mode of a view.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.visibility)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Visibility'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents the visibility mode of a view.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.visibility)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const WHITE_SPACE = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'WhiteSpace'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Specifies different white spaces.`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.whitespace)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'WhiteSpace'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Specifies different white spaces.`) + .appendText(`\n\n{N}`) + .appendMarkdown( + ` [API Reference](https://docs.nativescript.org/api-reference/modules/_ui_enums_.whitespace)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const UI_ENUM_PROVIDERS = [ - ACCURACY, - ANDROID_ACTION_BAR_VISIBILITY, - ANIMATION_CURVE, - AUTOCAPITALIZATION, - BACKGROUND_REPEAT, - DOCK, - FONT_ATTRIBUTES, - FONT_STYLE, - FONT_WEIGHT, - HORIZONTAL_ALIGNMENT, - IOS_ACTION_ITEM_POSITION, - IMAGE_FORMAT, - KEYBOARD_TYPE, - NAVIGATION_BAR_VISIBILITY, - ORIENTATION, - RETURN_KEY_TYPE, - STRETCH, - TEXT_ALIGNMENT, - TEXT_DECORATION, - TEXT_TRANSFORM, - VERTICAL_ALIGNMENT, - VISIBILITY, - WHITE_SPACE, + ACCURACY, + ANDROID_ACTION_BAR_VISIBILITY, + ANIMATION_CURVE, + AUTOCAPITALIZATION, + BACKGROUND_REPEAT, + DOCK, + FONT_ATTRIBUTES, + FONT_STYLE, + FONT_WEIGHT, + HORIZONTAL_ALIGNMENT, + IOS_ACTION_ITEM_POSITION, + IMAGE_FORMAT, + KEYBOARD_TYPE, + NAVIGATION_BAR_VISIBILITY, + ORIENTATION, + RETURN_KEY_TYPE, + STRETCH, + TEXT_ALIGNMENT, + TEXT_DECORATION, + TEXT_TRANSFORM, + VERTICAL_ALIGNMENT, + VISIBILITY, + WHITE_SPACE, ]; diff --git a/src/services/language-services/hover/widget-hover.ts b/src/services/language-services/hover/widget-hover.ts index 7481480..c52e8a8 100644 --- a/src/services/language-services/hover/widget-hover.ts +++ b/src/services/language-services/hover/widget-hover.ts @@ -1,464 +1,427 @@ import * as vscode from 'vscode'; export const ACTIVITY_INDICATOR = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'ActivityIndicator'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a UI widget which displays a progress indicator hinting the user for some background operation running.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/activity-indicator)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_activity_indicator_.activityindicator)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'ActivityIndicator'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText( + `Represents a UI widget which displays a progress indicator hinting the user for some background operation running.\n`, + ) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/activity-indicator)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_activity_indicator_.activityindicator)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const BUTTON = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Button'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a Button widget.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/button)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_button_.button)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Button'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a Button widget.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/button)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_button_.button)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const LABEL = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Label'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a text label.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/label)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_label_.label)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Label'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a text label.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/label)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_label_.label)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TEXT_FIELD = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'textfield') { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents an editable single-line box.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/text-field)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_text_field_.textfield)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'textfield') { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents an editable single-line box.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/text-field)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_text_field_.textfield)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TEXT_VIEW = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'textview') { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents an editable multi-line line box.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/text-view)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_text_view_.textview)`); - - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'textview') { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents an editable multi-line line box.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/text-view)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_text_view_.textview)`); + + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const LIST_VIEW = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'ListView'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a list view widget.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/listview)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_list_view_)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'ListView'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a list view widget.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/listview)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_list_view_)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const IMAGE = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Image'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents an image widget.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/image)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_image_.image)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Image'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents an image widget.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/image)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_image_.image)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const PROGRESS = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Progress'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a component capable of showing progress.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/progress)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_progress_.progress)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Progress'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a component capable of showing progress.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/progress)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_progress_.progress)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const SCROLL_VIEW = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'ScrollView'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a scrollable area that can have content that is larger than its bounds.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/scroll-view)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_scroll_view_.scrollview)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'ScrollView'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a scrollable area that can have content that is larger than its bounds.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/scroll-view)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_scroll_view_.scrollview)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const SEARCH_BAR = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'SearchBar'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a search bar component.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/search-bar)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_search_bar_.searchbar)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'SearchBar'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a search bar component.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/search-bar)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_search_bar_.searchbar)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const SLIDER = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Slider'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a slider component.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/slider)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_slider_.slider)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Slider'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a slider component.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/slider)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_slider_.slider)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const SWITCH = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Switch'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a switch component.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/switch)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_switch_.switch)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Switch'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a switch component.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/switch)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_switch_.switch)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TAB_VIEW = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'TabView'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a tab view.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/tab-view)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_tab_view_.tabview)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'TabView'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a tab view.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/tab-view)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_tab_view_.tabview)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TAB_VIEW_ITEM = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'TabViewItem'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a tab view entry.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/tab-view)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_tab_view_.tabviewitem)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'TabViewItem'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a tab view entry.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/tab-view)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_tab_view_.tabviewitem)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const WEB_VIEW = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'WebView'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a WebView widget.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/web-view)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_web_view_)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'WebView'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a WebView widget.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/components/web-view)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/modules/_ui_web_view_)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const HTML_VIEW = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'HtmlView'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a view with html content. Use this component instead WebView when you want to show just static HTML content.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/htmlview)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_html_view_.htmlview)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'HtmlView'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText( + `Represents a view with html content. Use this component instead WebView when you want to show just static HTML content.\n`, + ) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/htmlview)`) + .appendText(` | `) + .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_html_view_.htmlview)`); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const LIST_PICKER = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'ListPicker'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents an list picker.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/listpicker)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_list_picker_.listpicker)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'ListPicker'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents an list picker.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/listpicker)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_list_picker_.listpicker)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const DATE_PICKER = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'DatePicker'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents an date picker.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/date-picker)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_date_picker_.datepicker)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'DatePicker'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents an date picker.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/date-picker)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_date_picker_.datepicker)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const TIME_PICKER = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'TimePicker'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents an time picker.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/time-picker)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_time_picker_.timepicker)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'TimePicker'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents an time picker.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/angular/ui/ng-components/time-picker)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_time_picker_.timepicker)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const PLACEHOLDER = vscode.languages.registerHoverProvider('html', { - - provideHover(document, position, token) { - - const range = document.getWordRangeAtPosition(position); - const word = document.getText(range); - - if (word.toLowerCase() === 'Placeholder'.toLowerCase()) { - - const tooltip: vscode.MarkdownString = new vscode.MarkdownString() - .appendText(`Represents a Placeholder, which is used to add a native view to the visual tree.\n`) - .appendText(`\n\n{N}`) - .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/placeholder)`) - .appendText(` | `) - .appendMarkdown(`[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_placeholder_.placeholder)`); - tooltip.isTrusted = true; - - return new vscode.Hover(tooltip); - } - }, + provideHover(document, position, token) { + const range = document.getWordRangeAtPosition(position); + const word = document.getText(range); + + if (word.toLowerCase() === 'Placeholder'.toLowerCase()) { + const tooltip: vscode.MarkdownString = new vscode.MarkdownString() + .appendText(`Represents a Placeholder, which is used to add a native view to the visual tree.\n`) + .appendText(`\n\n{N}`) + .appendMarkdown(` [Docs](https://docs.nativescript.org/ui/placeholder)`) + .appendText(` | `) + .appendMarkdown( + `[API Reference](https://docs.nativescript.org/api-reference/classes/_ui_placeholder_.placeholder)`, + ); + tooltip.isTrusted = true; + + return new vscode.Hover(tooltip); + } + }, }); export const WIDGET_HOVER_PROVIDERS = [ - ACTIVITY_INDICATOR, - BUTTON, - LABEL, - TEXT_FIELD, - TEXT_VIEW, - LIST_VIEW, - IMAGE, - PROGRESS, - SCROLL_VIEW, - SEARCH_BAR, - SLIDER, - SWITCH, - TAB_VIEW, - TAB_VIEW_ITEM, - WEB_VIEW, - HTML_VIEW, - LIST_PICKER, - DATE_PICKER, - TIME_PICKER, - PLACEHOLDER, + ACTIVITY_INDICATOR, + BUTTON, + LABEL, + TEXT_FIELD, + TEXT_VIEW, + LIST_VIEW, + IMAGE, + PROGRESS, + SCROLL_VIEW, + SEARCH_BAR, + SLIDER, + SWITCH, + TAB_VIEW, + TAB_VIEW_ITEM, + WEB_VIEW, + HTML_VIEW, + LIST_PICKER, + DATE_PICKER, + TIME_PICKER, + PLACEHOLDER, ]; diff --git a/src/services/language-services/suggestions.ts b/src/services/language-services/suggestions.ts index 4b7179a..1a8463d 100644 --- a/src/services/language-services/suggestions.ts +++ b/src/services/language-services/suggestions.ts @@ -1,371 +1,354 @@ import * as vscode from 'vscode'; export const IOS_SUGGESTION = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('ios.')) { - return undefined; - } - - return [ - new vscode.CompletionItem('position', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('systemIcon', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('ios.')) { + return undefined; + } + + return [ + new vscode.CompletionItem('position', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('systemIcon', vscode.CompletionItemKind.Value), + ]; }, - '.', + }, + '.', ); const KEYBOARD_TYPE_SUGGESTION = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('keyboardType=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('email', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('phone', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('number', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('integer', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('datetime', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('url', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('keyboardType=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('email', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('phone', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('number', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('integer', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('datetime', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('url', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const AUTOCAPITALIZATION = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - - if (!linePrefix.endsWith('autocapitalizationType=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('words', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('sentences', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('allCharacters', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + + if (!linePrefix.endsWith('autocapitalizationType=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('words', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('sentences', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('allCharacters', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const RETURN_KEY = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('returnKeyType=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('done', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('next', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('go', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('search', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('send', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('returnKeyType=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('done', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('next', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('go', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('search', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('send', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const TAB_BACKGROUND_COLOR = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('tabBackgroundColor=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('gray', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('#FF0000', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('rgb(200,100,200)', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('tabBackgroundColor=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('gray', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('#FF0000', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('rgb(200,100,200)', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const SELECTED_TAB_TEXT_COLOR = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('selectedTabTextColor=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('gray', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('#FF0000', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('rgb(200,100,200)', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('selectedTabTextColor=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('gray', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('#FF0000', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('rgb(200,100,200)', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const TAB_TEXT_COLOR = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('tabTextColor=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('gray', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('#FF0000', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('rgb(200,100,200)', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('tabTextColor=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('gray', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('#FF0000', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('rgb(200,100,200)', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const ORIENTATION = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('orientation=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('vertical', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('horizontal', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('orientation=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('vertical', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('horizontal', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const FONT_STYLE = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('fontStyle=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('normal', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('italic', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('fontStyle=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('normal', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('italic', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const TEXT_ALIGNMENT = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('textAlignment=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('left', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('center', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('right', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('textAlignment=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('left', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('center', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('right', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const TEXT_DECORATION = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('textDecoration=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('underline', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('line-through', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('textDecoration=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('underline', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('line-through', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const TEXT_TRANSFORM = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('textTransform=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('capitalize', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('uppercase', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('lowercase', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('textTransform=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('capitalize', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('uppercase', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('lowercase', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const DOCK = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('dock=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('top', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('left', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('right', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('bottom', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('dock=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('top', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('left', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('right', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('bottom', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const STRETCH = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('stretch=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('aspectFit', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('fill', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('aspectFill', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('stretch=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('aspectFit', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('none', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('fill', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('aspectFill', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const VISIBILITY = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('visibility=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('visible', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('collapsed', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('hidden', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('visibility=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('visible', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('collapsed', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('hidden', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const VERTICAL_ALIGNMENT = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('verticalAlignment=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('stretch', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('top', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('center', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('middle', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('bottom', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('verticalAlignment=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('stretch', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('top', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('center', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('middle', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('bottom', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); const HORIZONTAL_ALIGNMENT = vscode.languages.registerCompletionItemProvider( - 'html', - { - provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { - - const linePrefix = document.lineAt(position).text.substr(0, position.character); - if (!linePrefix.endsWith('horizontalAlignment=')) { - return undefined; - } - - return [ - new vscode.CompletionItem('stretch', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('center', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('left', vscode.CompletionItemKind.Value), - new vscode.CompletionItem('right', vscode.CompletionItemKind.Value), - ]; - }, + 'html', + { + provideCompletionItems(document: vscode.TextDocument, position: vscode.Position) { + const linePrefix = document.lineAt(position).text.substr(0, position.character); + if (!linePrefix.endsWith('horizontalAlignment=')) { + return undefined; + } + + return [ + new vscode.CompletionItem('stretch', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('center', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('left', vscode.CompletionItemKind.Value), + new vscode.CompletionItem('right', vscode.CompletionItemKind.Value), + ]; }, - '=', // triggered whenever a '.' is being typed + }, + '=', // triggered whenever a '.' is being typed ); export const SUGGESTION_PROVIDERS = [ - IOS_SUGGESTION, - KEYBOARD_TYPE_SUGGESTION, - AUTOCAPITALIZATION, - RETURN_KEY, - TAB_BACKGROUND_COLOR, - TAB_TEXT_COLOR, - SELECTED_TAB_TEXT_COLOR, - ORIENTATION, - FONT_STYLE, - TEXT_ALIGNMENT, - TEXT_DECORATION, - TEXT_TRANSFORM, - DOCK, - STRETCH, - VISIBILITY, - VERTICAL_ALIGNMENT, - HORIZONTAL_ALIGNMENT, + IOS_SUGGESTION, + KEYBOARD_TYPE_SUGGESTION, + AUTOCAPITALIZATION, + RETURN_KEY, + TAB_BACKGROUND_COLOR, + TAB_TEXT_COLOR, + SELECTED_TAB_TEXT_COLOR, + ORIENTATION, + FONT_STYLE, + TEXT_ALIGNMENT, + TEXT_DECORATION, + TEXT_TRANSFORM, + DOCK, + STRETCH, + VISIBILITY, + VERTICAL_ALIGNMENT, + HORIZONTAL_ALIGNMENT, ]; diff --git a/src/services/services.ts b/src/services/services.ts index 417c3bd..de072f0 100644 --- a/src/services/services.ts +++ b/src/services/services.ts @@ -2,22 +2,30 @@ import { ILogger } from '../common/logger'; import { NativeScriptCli } from '../project/nativeScriptCli'; export class Services { - protected _cliPath: string; + protected _cliPath!: string; - protected _logger: ILogger; - protected _cli: NativeScriptCli; + protected _logger!: ILogger; + protected _cli!: NativeScriptCli; - public get cliPath(): string { return this._cliPath; } + public get cliPath(): string { + return this._cliPath; + } - public set cliPath(cliPath: string) { this._cliPath = cliPath; } + public set cliPath(cliPath: string) { + this._cliPath = cliPath; + } - public get logger(): ILogger { return this._logger; } + public get logger(): ILogger { + return this._logger; + } - public set logger(logger: ILogger) { this._logger = logger; } + public set logger(logger: ILogger) { + this._logger = logger; + } - public cli(): NativeScriptCli { - this._cli = this._cli || new NativeScriptCli(this._cliPath, this.logger); + public cli(): NativeScriptCli { + this._cli = this._cli || new NativeScriptCli(this._cliPath, this.logger); - return this._cli; - } + return this._cli; + } } diff --git a/src/tests/nativeScriptDebugAdapter.tests.ts b/src/tests/nativeScriptDebugAdapter.tests.ts index 7c46454..daabde5 100644 --- a/src/tests/nativeScriptDebugAdapter.tests.ts +++ b/src/tests/nativeScriptDebugAdapter.tests.ts @@ -1,216 +1,75 @@ -import * as fs from 'fs'; -import * as _ from 'lodash'; -import { join } from 'path'; -import * as proxyquire from 'proxyquire'; +import * as assert from 'assert'; import * as sinon from 'sinon'; -import { ChromeDebugAdapter } from 'vscode-chrome-debug-core'; -import { Event } from '@vscode/debugadapter'; -import * as extProtocol from '../common/extensionProtocol'; -const appRoot = 'appRootMock'; -const webpackConfigFunctionStub = sinon.stub(); +import { NativeScriptDebugAdapter } from '../debug-adapter/nativeScriptDebugAdapter'; +import { DebugManager } from '../debug-adapter/debugManager'; -proxyquire.noCallThru(); -const nativeScriptDebugAdapterLib = proxyquire('../debug-adapter/nativeScriptDebugAdapter', { - [join(appRoot, 'webpack.config.js')]: webpackConfigFunctionStub, +const createMockDebugManager = () => ({ + startDebugging: sinon.stub().resolves(), + stopDebugging: sinon.stub(), + dispose: sinon.stub(), }); -const examplePort = 456; - -const customMessagesResponses = { - buildService: { - processRequest: examplePort, - }, - workspaceConfigService: { - tnsPath: 'tnsPathMock', - }, -}; - -const defaultArgsMock: any = { - appRoot, - diagnosticLogging: true, - platform: 'android', - request: 'attach', - stopOnEntry: true, - tnsArgs: ['mockArgs'], - watch: true, -}; - -const mockConstructor = (mockObject: any): any => { - return function () { - return mockObject; - }; -}; +const createMockSession = (id = 'test-session-id') => ({ + id, + type: 'nativescript', + name: 'Test', +}); describe('NativeScriptDebugAdapter', () => { - let nativeScriptDebugAdapter: any; - let chromeSessionMock: any; - let chromeConnectionMock: any; - let pathTransformerMock: any; - let sourceMapTransformer: any; - - beforeEach(() => { - chromeSessionMock = { - sendEvent: (e: Event) => { - const request = (e as any).body as extProtocol.IRequest; - - if (e.event === extProtocol.NS_DEBUG_ADAPTER_MESSAGE) { - const result = customMessagesResponses[request.service] && customMessagesResponses[request.service][request.method]; - - (nativeScriptDebugAdapter as any).onExtensionResponse({ requestId: request.id, result }); - } - }, - }; - - chromeConnectionMock = { - attach: () => Promise.resolve({}), - }; - - pathTransformerMock = { - attach: () => ({}), - clearTargetContext: () => ({}), - setTransformOptions: () => ({}), - }; - - sourceMapTransformer = { - clearTargetContext: () => undefined, - setTransformOptions: () => undefined, - }; - - nativeScriptDebugAdapter = new nativeScriptDebugAdapterLib.NativeScriptDebugAdapter({ - chromeConnection: mockConstructor(chromeConnectionMock), - pathTransformer: mockConstructor(pathTransformerMock), - sourceMapTransformer: mockConstructor(sourceMapTransformer), - }, - chromeSessionMock, - ); - - ChromeDebugAdapter.prototype.attach = () => Promise.resolve(); - }); - - const platforms = ['android', 'ios']; - const launchMethods = ['launch', 'attach']; - - platforms.forEach((platform) => { - launchMethods.forEach((method) => { - let argsMock: any; - - beforeEach(() => { - argsMock = _.merge({}, defaultArgsMock, { platform, request: method }); - }); - - it(`${method} for ${platform} should raise debug start event`, async () => { - const spy = sinon.spy(chromeSessionMock, 'sendEvent'); - - await nativeScriptDebugAdapter[method](argsMock); - - sinon.assert.calledWith(spy, sinon.match({ event: extProtocol.BEFORE_DEBUG_START })); - }); - - it(`${method} for ${platform} should call project setTransformOptions`, async () => { - const spy = sinon.spy(pathTransformerMock, 'setTransformOptions'); - - await nativeScriptDebugAdapter[method](argsMock); - - sinon.assert.calledWith(spy, argsMock.platform); - }); - - it(`${method} for ${platform} should set debug port`, async () => { - const debugPort = 1234; - const spy = sinon.spy(ChromeDebugAdapter.prototype, 'attach'); - - customMessagesResponses.buildService.processRequest = debugPort; - - await nativeScriptDebugAdapter[method](argsMock); - - sinon.assert.calledWith(spy, sinon.match({ - port: debugPort, - })); - }); - - it(`${method} for ${platform} should set debug address`, async () => { - const spy = sinon.spy(ChromeDebugAdapter.prototype, 'attach'); - - await nativeScriptDebugAdapter[method](argsMock); - - sinon.assert.calledWith(spy, sinon.match({ - address: platform === "ios" ? "localhost" : undefined, - })); - }); - - it(`${method} for ${platform} should translate args to chrome debug args`, async () => { - const spy = sinon.spy(ChromeDebugAdapter.prototype, 'attach'); - - await nativeScriptDebugAdapter[method](argsMock); - - sinon.assert.calledWith(spy, sinon.match({ - trace: true, - webRoot: appRoot, - })); - }); - - it(`${method} for ${platform} should add sourceMapPathOverrides data`, async () => { - const spy = sinon.spy(ChromeDebugAdapter.prototype, 'attach'); - const existsSyncStub = sinon.stub(fs, 'existsSync'); - // Need to also stub isAngularProject to return false or it will always return true bc it utilizes - // `fs.existsSync` which is also stubbed and made to return true in this test. - const isAngularProjectStub = sinon.stub(nativeScriptDebugAdapter, 'isAngularProject'); - - process.chdir = () => null; - existsSyncStub.returns(true); - isAngularProjectStub.returns(false); - webpackConfigFunctionStub - .withArgs({ [platform]: platform }) - .returns({ output: { library: 'myLib' } }); - - await nativeScriptDebugAdapter[method](argsMock); - - existsSyncStub.restore(); - sinon.assert.calledWith(spy, sinon.match({ - sourceMapPathOverrides: { - 'webpack:///*': `${join(appRoot, 'app')}/*`, - 'webpack://myLib/*': `${join(appRoot, 'app')}/*`, - }, - trace: true, - webRoot: appRoot, - })); - }); - - it(`${method} for ${platform} should not fail when unable to require webpack.config.js`, async () => { - const spy = sinon.spy(ChromeDebugAdapter.prototype, 'attach'); - const existsSyncStub = sinon.stub(fs, 'existsSync'); - // Need to also stub isAngularProject to return false or it will always return true bc it utilizes - // `fs.existsSync` which is also stubbed and made to return true in this test. - const isAngularProjectStub = sinon.stub(nativeScriptDebugAdapter, 'isAngularProject'); - - existsSyncStub.returns(true); - isAngularProjectStub.returns(false); - webpackConfigFunctionStub - .withArgs({ [platform]: platform }) - .throws(new Error('test')); - - await nativeScriptDebugAdapter[method](argsMock); - - existsSyncStub.restore(); - sinon.assert.calledWith(spy, sinon.match({ - sourceMapPathOverrides: { - 'webpack:///*': `${join(appRoot, 'app')}/*`, - }, - trace: true, - webRoot: appRoot, - })); - }); - - it(`${method} for ${platform} - after process exit should send Terminate event`, async () => { - const spy = sinon.spy(chromeSessionMock, 'sendEvent'); - - customMessagesResponses.buildService.processRequest = undefined; - - await nativeScriptDebugAdapter.attach(argsMock); - - sinon.assert.calledWith(spy, sinon.match({ - event: 'terminated', - })); - }); - }); - }); + let adapter: NativeScriptDebugAdapter; + let debugManager: ReturnType; + let mockSession: ReturnType; + + beforeEach(() => { + debugManager = createMockDebugManager(); + adapter = new NativeScriptDebugAdapter(debugManager as unknown as DebugManager); + mockSession = createMockSession(); + adapter.setParentSession(mockSession as any); + }); + + it('should create adapter with debug manager', () => { + assert.ok(adapter); + }); + + it('should set parent session', () => { + const session = createMockSession('custom-id'); + adapter.setParentSession(session as any); + assert.ok(adapter); + }); + + it('should call debugManager.stopDebugging on disconnect with parent session id', () => { + (adapter as any).disconnectRequest( + { body: {}, success: true, command: 'disconnect', type: 'response', request_seq: 1, seq: 0 }, + {}, + ); + assert.ok(debugManager.stopDebugging.calledOnce); + assert.ok(debugManager.stopDebugging.calledWith(mockSession.id)); + }); + + it('should call debugManager.stopDebugging on terminate with parent session id', () => { + (adapter as any).terminateRequest( + { body: {}, success: true, command: 'terminate', type: 'response', request_seq: 1, seq: 0 }, + {}, + ); + assert.ok(debugManager.stopDebugging.calledOnce); + assert.ok(debugManager.stopDebugging.calledWith(mockSession.id)); + }); + + it('should return empty threads', () => { + const response: any = { body: {}, success: true, command: 'threads', type: 'response', request_seq: 1, seq: 0 }; + (adapter as any).threadsRequest(response); + assert.deepStrictEqual(response.body.threads, []); + }); + + it('should call debugManager.startDebugging on launch', async () => { + const response: any = { body: {}, success: true, command: 'launch', type: 'response', request_seq: 1, seq: 0 }; + await (adapter as any).launchRequest(response, { platform: 'ios', appRoot: '/test' }); + assert.ok(debugManager.startDebugging.calledOnce); + }); + + it('should call debugManager.startDebugging on attach', async () => { + const response: any = { body: {}, success: true, command: 'attach', type: 'response', request_seq: 1, seq: 0 }; + await (adapter as any).attachRequest(response, { platform: 'android', appRoot: '/test' }); + assert.ok(debugManager.startDebugging.calledOnce); + }); }); diff --git a/src/tests/nativeScriptPathTransformer.tests.ts b/src/tests/nativeScriptPathTransformer.tests.ts deleted file mode 100644 index 4865c31..0000000 --- a/src/tests/nativeScriptPathTransformer.tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -import * as assert from 'assert'; -import * as fs from 'fs'; -import * as path from 'path'; -import * as sinon from 'sinon'; -import { NativeScriptPathTransformer } from '../debug-adapter/nativeScriptPathTransformer'; -import * as tests from './pathTransformData'; - -describe('NativeScriptPathTransformer', () => { - let nativeScriptPathTransformer: any; - let existsSyncStub; - - beforeEach(() => { - nativeScriptPathTransformer = new NativeScriptPathTransformer(); - }); - - describe('targetUrlToClientPath() method', () => { - for (const test of tests as any) { - const webRoot = test.webRoot || 'C:\\projectpath'; - const nsConfigPartInTestName = test.nsconfig ? " when there's nsconfig" : ''; - - it(`should transform [${test.platform}] device path ${test.scriptUrl} -> ${test.expectedResult}${nsConfigPartInTestName}`, async () => { - (path as any).join = path.win32.join; - (path as any).resolve = path.win32.resolve; - (path as any).basename = path.win32.basename; - nativeScriptPathTransformer.setTransformOptions(test.platform, test.nsconfig ? test.nsconfig.appPath : null, webRoot); - - existsSyncStub = sinon - .stub(fs, 'existsSync') - .callsFake((arg: string) => arg === test.existingPath); - const result = await nativeScriptPathTransformer.targetUrlToClientPath(test.scriptUrl); - - assert.equal(result, test.expectedResult); - }); - } - - afterEach(() => { - existsSyncStub.restore(); - }); - }); - -}); diff --git a/src/tests/nativeScriptTargetDiscovery.tests.ts b/src/tests/nativeScriptTargetDiscovery.tests.ts deleted file mode 100644 index 6e94bf1..0000000 --- a/src/tests/nativeScriptTargetDiscovery.tests.ts +++ /dev/null @@ -1,45 +0,0 @@ -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import { NativeScriptTargetDiscovery } from '../debug-adapter/nativeScriptTargetDiscovery'; - -describe('NativeScriptTargetDiscovery', () => { - let nativeScriptTargetDiscovery: NativeScriptTargetDiscovery; - let stub; - - before(() => { - nativeScriptTargetDiscovery = new NativeScriptTargetDiscovery(); - }); - - it(`getTarget returns correct target`, async () => { - const address = 'localhost'; - const port = 41000; - - const target = await nativeScriptTargetDiscovery.getTarget(address, port); - - assert.equal(target.webSocketDebuggerUrl, `ws://${address}:${port}`); - assert.equal(target.devtoolsFrontendUrl, `chrome-devtools://devtools/bundled/inspector.html?experiments=true&ws=${address}:${port}`); - }); - - it(`getTargets calls getTarget`, async () => { - const testTarget: any = { - devtoolsFrontendUrl: 'url', - webSocketDebuggerUrl: 'socket', - }; - const address = 'localhost'; - const port = 41000; - - stub = sinon.stub(nativeScriptTargetDiscovery, 'getTarget').callsFake(() => Promise.resolve(testTarget)); - const targets = await nativeScriptTargetDiscovery.getAllTargets(address, port); - - sinon.assert.calledOnce(stub); - sinon.assert.calledWith(stub, address, port); - assert.equal(targets.length, 1); - assert.deepEqual(targets[0], testTarget); - }); - - afterEach(() => { - if (stub) { - stub.restore(); - } - }); -}); diff --git a/src/tests/pathTransformData.ts b/src/tests/pathTransformData.ts deleted file mode 100644 index 7452cf0..0000000 --- a/src/tests/pathTransformData.ts +++ /dev/null @@ -1,152 +0,0 @@ -/* tslint:disable:max-line-length */ -const tests = [ - { - existingPath: 'C:\\projectpath\\app\\main.js', - expectedResult: 'C:\\projectpath\\app\\main.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/main.js', - }, - { - expectedResult: '', - platform: 'android', - scriptUrl: 'VM1', - }, - { - expectedResult: '', - platform: 'android', - scriptUrl: 'native prologue.js', - }, - { - expectedResult: '', - platform: 'android', - scriptUrl: 'v8/gc', - }, - { - expectedResult: '', - platform: 'android', - scriptUrl: 'VM25', - }, - { - existingPath: 'C:\\projectpath\\platforms\\android\\app\\src\\main\\assets\\internal\\ts_helpers.js', - expectedResult: `C:\\projectpath\\platforms\\android\\app\\src\\main\\assets\\internal\\ts_helpers.js`, - platform: 'android', - scriptUrl: '/data/data/org.nativescript.TabNavigation/files/internal/ts_helpers.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\nativescript-angular\\platform.js', - expectedResult: 'C:\\projectpath\\node_modules\\nativescript-angular\\platform.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/nativescript-angular/platform.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\nativescript-angular\\platform-common.js', - expectedResult: 'C:\\projectpath\\node_modules\\nativescript-angular\\platform-common.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/nativescript-angular/platform-common.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\@angular\\common\\bundles\\common.umd.js', - expectedResult: 'C:\\projectpath\\node_modules\\@angular\\common\\bundles\\common.umd.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/@angular/common/bundles/common.umd.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\gestures\\gestures.android.js', - expectedResult: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\gestures\\gestures.android.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/tns-core-modules/ui/gestures/gestures.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\frame\\fragment.transitions.android.js', - expectedResult: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\frame\\fragment.transitions.android.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/tns-core-modules/ui/frame/fragment.transitions.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\tns-core-modules\\debugger\\devtools-elements.common.js', - expectedResult: 'C:\\projectpath\\node_modules\\tns-core-modules\\debugger\\devtools-elements.common.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/tns-core-modules/debugger/devtools-elements.common.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\page\\page.android.js', - expectedResult: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\page\\page.android.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/tns-core-modules/ui/page/page.js', - }, - { - existingPath: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\layouts\\layout-base.android.js', - expectedResult: 'C:\\projectpath\\node_modules\\tns-core-modules\\ui\\layouts\\layout-base.android.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/tns_modules/tns-core-modules/ui/layouts/layout-base.js', - }, - { - expectedResult: '', - platform: 'android', - scriptUrl: 'ng:///css/0/data/data/org.nativescript.TabNavigation/files/app/tabs/tabs.component.scss.ngstyle.js', - }, - { - existingPath: 'C:\\projectpath\\src\\main.js', - expectedResult: 'C:\\projectpath\\src\\main.js', - nsconfig: { appPath: 'src' }, - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/main.js', - }, - { - existingPath: 'C:\\projectpath\\src\\app\\main.js', - expectedResult: 'C:\\projectpath\\src\\app\\main.js', - nsconfig: { appPath: 'src' }, - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.TabNavigation/files/app/app/main.js', - }, - { - existingPath: 'C:\\projectpath\\src\\app\\main.js', - expectedResult: 'C:\\projectpath\\src\\app\\main.js', - nsconfig: { appPath: 'src' }, - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.app1/files/app/app/main.js', - }, - { - existingPath: 'C:\\projectpath\\platforms\\android\\app\\src\\main\\assets\\app\\starter.js', - expectedResult: 'C:\\projectpath\\platforms\\android\\app\\src\\main\\assets\\app\\starter.js', - nsconfig: { appPath: 'src' }, - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.app1/files/app/starter.js', - }, - { - existingPath: 'C:\\projectpath\\platforms\\android\\app\\src\\main\\assets\\app\\starter.js', - expectedResult: 'C:\\projectpath\\platforms\\android\\app\\src\\main\\assets\\app\\starter.js', - platform: 'android', - scriptUrl: 'file:///data/data/org.nativescript.app1/files/app/starter.js', - }, - { - existingPath: 'C:\\somepath\\projectpath\\platforms\\ios\\projectpath\\app\\starter.js', - expectedResult: 'C:\\somepath\\projectpath\\platforms\\ios\\projectpath\\app\\starter.js', - platform: 'ios', - scriptUrl: 'file:///app/starter.js', - webRoot: 'C:\\somepath\\projectpath', - }, - { - existingPath: 'C:\\somepath\\projectpath\\platforms\\ios\\projectpath\\app\\starter.js', - expectedResult: 'C:\\somepath\\projectpath\\platforms\\ios\\projectpath\\app\\starter.js', - nsconfig: { appPath: 'src' }, - platform: 'ios', - scriptUrl: 'file:///app/starter.js', - webRoot: 'C:\\somepath\\projectpath', - }, - { - existingPath: 'C:\\projectpath\\app\\main.js', - expectedResult: 'C:\\projectpath\\app\\main.js', - platform: 'ios', - scriptUrl: 'file:///app/main.js', - }, - { - existingPath: 'C:\\projectpath\\src\\main.js', - expectedResult: 'C:\\projectpath\\src\\main.js', - nsconfig: { appPath: 'src' }, - platform: 'ios', - scriptUrl: 'file:///app/main.js', - }, -]; - -export = tests; diff --git a/src/tsconfig.json b/src/tsconfig.json index eb297a1..74393df 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,21 +1,17 @@ { "compilerOptions": { - "target": "es6", + "target": "es2022", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, - "noImplicitAny": false, - "removeComments": false, - "preserveConstEnums": true, + "strict": true, "outDir": "../out", - "allowJs": true + "skipLibCheck": true }, "exclude": [ - "node_modules", + "node_modules" ], "include": [ - "./tests/**/*.ts", - "./debug-adapter/nativeScriptDebug.ts", - "./main.ts" + "./**/*.ts" ] -} \ No newline at end of file +} From b4c4fa82e88a054e1c010bf2424c537b04ccb684 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Fri, 6 Nov 2026 14:23:11 -0300 Subject: [PATCH 3/7] feat: modernize tooling, fix debug session lifecycle, support nsruntime and Vite Debugging - Each debug session owns its ns process; the Run command no longer kills it. - Stopping during the build or iOS team picker no longer leaks the ns process. - Child js-debug sessions are matched via a parent id in their config instead of activeDebugSession; orphaned children started after a stop are stopped. - Wait up to 60s for the app to reconnect after a LiveSync restart drops the socket. - Fail the session with an error when the initial attach fails. - Register the debug adapter before checking the CLI; CLI check is async and honors nativescript.nsPath. - Remove supportsRestartRequest so Restart relaunches the session. - Source maps: allow any map location (inline, device file://, nsruntime://) and add fallbacks mapping device paths to the local platforms/ copy. - Read webpack output settings out of process, only when customized. - Vite: debug with --no-hmr; refuse launchTests for Vitest projects. Manifest - Debugger schema: add address, resolveSourceMapLocations, skipFiles, smartStep, trace; drop tnsOutput/noDebug; use ${workspaceFolder}. - @types/vscode pinned to engines (~1.109); min CLI 8.0.0. Analytics - Replace universal-analytics with the GA4 Measurement Protocol (same approach as the CLI); config injected at package time; respects VS Code telemetry. Tooling - TypeScript 6.0, ESLint flat config with typescript-eslint, Vitest replacing mocha/sinon, prettier checks; drop tslint, lodash, uuid, cpx, proxyquire. - GitHub Actions CI: lint, format, typecheck, test, package and upload the vsix. --- .github/workflows/ci.yml | 40 + .gitignore | 11 +- .prettierignore | 7 + .travis.yml | 9 - .vscodeignore | 8 +- CHANGELOG.md | 20 + README.md | 32 +- eslint.config.mjs | 37 + package-lock.json | 6080 +++++++++-------- package.json | 271 +- scripts/write-ga-config.mjs | 18 + src/analytics/analyticsBaseInfo.ts | 13 - src/analytics/analyticsService.ts | 167 +- src/analytics/ga4Client.ts | 69 + src/analytics/guaService.ts | 52 - src/common/utilities.ts | 5 +- src/common/workspaceConfigService.ts | 10 +- src/debug-adapter/debugManager.ts | 418 +- src/debug-adapter/nativeScriptDebugAdapter.ts | 31 +- src/debug-adapter/sourceMaps.ts | 195 + src/main.ts | 171 +- src/project/androidProject.ts | 31 +- src/project/iosProject.ts | 2 +- src/project/nativeScriptCli.ts | 85 +- src/project/projectInfo.ts | 62 + src/project/streamScanner.ts | 22 +- src/services/buildService.ts | 278 +- src/services/extensionHostServices.ts | 62 +- src/services/iOSTeamService.ts | 9 +- .../language-services/autocomplete.ts | 8 +- .../language-services/hover/layout-hover.ts | 12 +- .../language-services/hover/ui-enum-hover.ts | 48 +- .../language-services/hover/widget-hover.ts | 40 +- src/services/services.ts | 31 - src/tests/androidProject.test.ts | 115 + src/tests/buildService.test.ts | 360 + src/tests/config/mocha.opts | 7 - src/tests/debugManager.test.ts | 543 ++ src/tests/ga4Client.test.ts | 108 + src/tests/iosProject.test.ts | 77 + src/tests/mocks/vscode.ts | 81 + ...ts.ts => nativeScriptDebugAdapter.test.ts} | 27 +- src/tests/projectInfo.test.ts | 116 + src/tests/sourceMaps.test.ts | 254 + src/tsconfig.build.json | 4 + src/tsconfig.json | 29 +- tslint.json | 54 - vitest.config.mts | 15 + 48 files changed, 6100 insertions(+), 4044 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 .prettierignore delete mode 100644 .travis.yml create mode 100644 eslint.config.mjs create mode 100644 scripts/write-ga-config.mjs delete mode 100644 src/analytics/analyticsBaseInfo.ts create mode 100644 src/analytics/ga4Client.ts delete mode 100644 src/analytics/guaService.ts create mode 100644 src/debug-adapter/sourceMaps.ts create mode 100644 src/project/projectInfo.ts delete mode 100644 src/services/services.ts create mode 100644 src/tests/androidProject.test.ts create mode 100644 src/tests/buildService.test.ts delete mode 100644 src/tests/config/mocha.opts create mode 100644 src/tests/debugManager.test.ts create mode 100644 src/tests/ga4Client.test.ts create mode 100644 src/tests/iosProject.test.ts create mode 100644 src/tests/mocks/vscode.ts rename src/tests/{nativeScriptDebugAdapter.tests.ts => nativeScriptDebugAdapter.test.ts} (77%) create mode 100644 src/tests/projectInfo.test.ts create mode 100644 src/tests/sourceMaps.test.ts create mode 100644 src/tsconfig.build.json delete mode 100644 tslint.json create mode 100644 vitest.config.mts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9a76a0e --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,40 @@ +name: CI + +on: + push: + branches: [master] + pull_request: + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + cache: npm + - run: npm ci + - run: npm run lint + - run: npm run format:check + - run: npm run typecheck + - run: npm test + # vscode:prepublish cleans out/, builds, and skips analytics config since no GA secrets are set here. + - name: Package + id: package + run: | + npx vsce package --out nativescript.vsix + echo "version=$(node -p "require('./package.json').version")" >> "$GITHUB_OUTPUT" + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: nativescript-${{ steps.package.outputs.version }}-${{ github.sha }} + path: nativescript.vsix + if-no-files-found: error diff --git a/.gitignore b/.gitignore index e5d8c49..ff94dbd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,12 +1,7 @@ .DS_Store out/ node_modules/ -src/typings/ -src/tests/config/custom.json -src/tests/testdata/JSApp -src/tests/testdata/TSApp -src/tests/testdata/**/node_modules -src/tests/testdata/**/platforms npm-debug.log -nativescript-*.vsix -/.vscode/ +nativescript-*.vsix +/.vscode/ +nativescript.vsix diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000..905b12d --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +out/ +node_modules/ +package-lock.json +CHANGELOG.md +*.vsix +*.md +.travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 2b8102d..0000000 --- a/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js - -node_js: - - "8.0" - -script: - - npm run build - - npm test - - npm run tslint diff --git a/.vscodeignore b/.vscodeignore index 4d0ecc5..78746ca 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -1,11 +1,17 @@ **/*.ts **/*.map .vscode/** +.github/** node_modules/.bin/** src/** +scripts/** out/tests/** images/screenshots/** *.vsix .gitignore +.prettierrc +.prettierignore +eslint.config.mjs +vitest.config.mts CONTRIBUTING.md -npm-debug.log \ No newline at end of file +npm-debug.log diff --git a/CHANGELOG.md b/CHANGELOG.md index c86dc30..938614a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +Unreleased +==== +## What's new + - The debugger now runs on VS Code's built-in JavaScript debugger (js-debug) instead of vscode-chrome-debug-core, and reattaches automatically when the app restarts after a file change. + - Source maps load from inline `data:` URLs, from the device through the runtime's `nsruntime://` scheme, or from the local `platforms/` copy for runtimes that report `file://` device paths. + - Vite projects are supported (debug sessions run with `--no-hmr`). + - New launch attributes: `address`, `resolveSourceMapLocations`, `skipFiles`, `smartStep`, `trace`. + - Analytics use the GA4 Measurement Protocol and respect VS Code's telemetry setting. + +## Breaking changes + - The `nativescript.tnsPath` setting is now `nativescript.nsPath` (default `ns`). + - Requires VS Code 1.109+ and NativeScript CLI 8.0+. + - Removed the unused `tnsOutput` and `noDebug` launch attributes; `diagnosticLogging` is deprecated in favor of `trace`. + +## Bug Fixes + - Missing or outdated CLI no longer breaks activation; the error is shown and the debugger reports it on launch. + - Stopping a session while it builds (or while the iOS team picker is open) no longer leaves the `ns` process running. + - The Run command no longer kills an active debug session's `ns` process. + - Restart from the debug toolbar now relaunches the session. + 0.11.0 ==== ## What's new diff --git a/README.md b/README.md index c056c50..acc8327 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,11 @@ The NativeScript extension for Visual Studio Code aids your [NativeScript](https To install [NativeScript](https://www.nativescript.org/) and all its dependencies, follow the instructions in our [getting started guide](https://docs.nativescript.org/setup/). -> Note: The VS Code extension requires [nativescript node module](https://www.npmjs.com/package/nativescript) to be globally installed. If you are using [nvm](https://github.com/creationix/nvm) to manage your node versions, make sure that `nativescript` is installed in your default nodeJS version. To check which is your default node version execute 'nvm ls' on the command prompt and you should see something like 'default -> 5.5.0 (-> v5.5.0)' in the output. +> Note: The VS Code extension requires [nativescript node module](https://www.npmjs.com/package/nativescript) to be globally installed. If you are using [nvm](https://github.com/nvm-sh/nvm) to manage your node versions, make sure that `nativescript` is installed in your default Node.js version (`nvm ls` shows it as `default`). If the CLI lives somewhere else, set the `nativescript.nsPath` setting to its path. ### Setup the extension -Create NativeScript application by running `tns create MyApp` and open `MyApp` folder in Visual Studio Code. Open the Debug Panel, click the gear icon +Create a NativeScript application by running `ns create MyApp` and open `MyApp` folder in Visual Studio Code. Open the Debug Panel, click the gear icon ![gear icon](https://raw.githubusercontent.com/NativeScript/nativescript-vscode-extension/master/images/screenshots/nativescript-gear-icon.jpg) @@ -27,7 +27,15 @@ To start the application with attached debugger, choose one of the launch config ![Launch settings](https://raw.githubusercontent.com/NativeScript/nativescript-vscode-extension/master/images/screenshots/nativescript-launch-configurations.png) -Your application will be launched and the VSCode debugger will attach. If you want to attach to already running NativeScript application, use one of the attach configurations. More information on what you can do with the Visual Studio Code Debugger you can find [here](https://code.visualstudio.com/docs/editor/debugging). +Your application will be launched and the VS Code JavaScript debugger will attach. With `"watch": true`, the debugger reattaches automatically every time the app restarts after a file change. If you want to attach to already running NativeScript application, use one of the attach configurations. More information on what you can do with the Visual Studio Code Debugger you can find [here](https://code.visualstudio.com/docs/editor/debugging). + +Besides the NativeScript-specific attributes (`platform`, `appRoot`, `watch`, `tnsArgs`, ...), launch configurations accept the common JavaScript debugger options `sourceMapPathOverrides`, `resolveSourceMapLocations`, `skipFiles`, `smartStep` and `trace`. + +Source maps work whether they are inlined in the bundle or written as separate `.map` files: newer NativeScript runtimes serve map files from the device (`nsruntime://` URLs), and for older runtimes the extension falls back to the copy of the build under `platforms/`. + +#### Vite projects + +Projects using the Vite bundler (`bundler: 'vite'` in `nativescript.config.ts`) are debugged with `--no-hmr`, because hot module replacement serves app code without source maps. File changes still rebuild and restart the app, and the debugger reattaches. Pass `--hmr` in `tnsArgs` to keep HMR on (breakpoints in app code won't bind). Debugging unit tests that use the Vitest runner is not supported yet. ### NativeScript commands @@ -37,7 +45,7 @@ Type `NativeScript` in the Command Palette and you will see all available comman There's only a couple of them but the list will grow in the future. -The `Run` command triggers `tns run` on emulator or device. You can run your app both on iOS and Android. +The `Run` command triggers `ns run` on emulator or device. You can run your app both on iOS and Android. If your version of NativeScript is incompatible with the extension you will see a warning the first time you run a command. @@ -60,19 +68,21 @@ If your version of NativeScript is incompatible with the extension you will see 3. To install the extension drag and drop the `nativescript-*.*.*.vsix` package in the VS Code. ### Contribute -To test the extension run the following commands in the root repository folder: ``` npm install -npm run build:watch -launch manually `Extension + Server` in VSCode from the debug section +npm run lint # ESLint +npm run typecheck # TypeScript +npm test # Vitest unit tests ``` -You must choose a project to debug, launch the phases that involve testing the extension in the application, modify any code of the extension, stop the debug and launch it again (F5) +Open the repository in VS Code and press F5 (`Run Extension`) to start an Extension Development Host with the extension loaded. Open a NativeScript app there and start one of its NativeScript launch configurations. After changing the extension's code, restart the Extension Development Host. + +Release builds send analytics only when `GA_MEASUREMENT_ID` and `GA_API_SECRET` are set in the environment while packaging (`vscode:prepublish` writes them to `out/ga-config.json`). Never commit the API secret. ### How to disable the analytics -The anonymous usage data collected by Progress from the NativeScript extension for Visual Studio Code is used strictly to improve the product and its services, and enhance the overall user experience. +The anonymous usage data collected from the NativeScript extension for Visual Studio Code is used strictly to improve the extension. Nothing is sent unless you opted in, and nothing is sent while VS Code's own telemetry is turned off (`telemetry.telemetryLevel`). If you have previously enabled the analytics option, you can disable it by following the steps outlined below: @@ -87,6 +97,6 @@ If you have previously enabled the analytics option, you can disable it by follo > Note: This option will disable only the analytics for the Visual Studio Code extension. To disable the analytics for the NativeScript CLI, open a command prompt or terminal and run the following commands: ``` -tns usage-reporting disable -tns error-reporting disable +ns usage-reporting disable +ns error-reporting disable ``` \ No newline at end of file diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..e4dd6e5 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,37 @@ +import js from '@eslint/js'; +import prettier from 'eslint-config-prettier'; +import globals from 'globals'; +import tseslint from 'typescript-eslint'; + +export default tseslint.config( + { ignores: ['out/**', 'node_modules/**', '*.vsix'] }, + js.configs.recommended, + ...tseslint.configs.recommendedTypeChecked, + { + languageOptions: { + globals: globals.node, + parserOptions: { projectService: true, tsconfigRootDir: import.meta.dirname }, + }, + rules: { + '@typescript-eslint/no-floating-promises': 'error', + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }], + }, + }, + { + files: ['src/tests/**/*.ts'], + rules: { + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-member-access': 'off', + '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-argument': 'off', + '@typescript-eslint/unbound-method': 'off', + '@typescript-eslint/require-await': 'off', + }, + }, + { + files: ['**/*.{js,mjs,mts}'], + extends: [tseslint.configs.disableTypeChecked], + }, + prettier, +); diff --git a/package-lock.json b/package-lock.json index d4eb287..33a909e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,3765 +10,3694 @@ "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@vscode/debugadapter": "^1.68.0", - "lodash": "4.17.21", - "semver": "7.5.4", - "strip-json-comments": "~3.1.1", - "universal-analytics": "0.4.23", - "uuid": "9.0.1" + "semver": "^7.8.6" }, "devDependencies": { - "@types/lodash": "4.14.121", - "@types/mocha": "5.2.6", - "@types/node": "^22.19.19", - "@types/proxyquire": "1.3.31", - "@types/semver": "7.5.6", - "@types/sinon": "7.0.13", - "@types/universal-analytics": "0.4.1", - "@types/uuid": "^10.0.0", - "@types/vscode": "^1.120.0", + "@eslint/js": "^10.0.1", + "@types/node": "^22.20.5", + "@types/semver": "^7.8.0", + "@types/vscode": "~1.109.0", "@vscode/debugprotocol": "^1.68.0", - "@vscode/vsce": "^2.22.0", - "cpx": "1.5.0", - "mocha": "5.2.0", - "prettier": "^3.8.3", - "proxyquire": "2.1.3", - "sinon": "7.4.2", - "typescript": "^5.3.3" + "@vscode/vsce": "^4.1.0", + "eslint": "^10.14.0", + "eslint-config-prettier": "^10.1.8", + "globals": "^17.14.0", + "prettier": "^3.9.10", + "typescript": "~6.0.3", + "typescript-eslint": "^8.72.1", + "vitest": "^5.1.0" }, "engines": { "vscode": "^1.109.0" } }, - "node_modules/@sinonjs/commons": { - "version": "1.8.6", - "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.6.tgz", - "integrity": "sha512-Ky+XkAkqPZSm3NLBeUng77EBQl3cmeJhITaGHdYH8kjVB+aun3S4XBRti2zt17mtt0mIUDiNxYeoJm6drVvBJQ==", + "node_modules/@azure/abort-controller": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-2.2.0.tgz", + "integrity": "sha512-fNAjWnA/nZ2jz31kxR/AqRaUT8ewHBw/WuBIosK0moMy1C9e5ValbDfFdIxJzVOOYaYkV/b2F1S4H/aHiqfVQg==", "dev": true, + "license": "MIT", "dependencies": { - "type-detect": "4.0.8" + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=22.0.0" } }, - "node_modules/@sinonjs/formatio": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/@sinonjs/formatio/-/formatio-3.2.2.tgz", - "integrity": "sha512-B8SEsgd8gArBLMD6zpRw3juQ2FVSsmdd7qlevyDqzS9WTCtvF55/gAL+h6gue8ZvPYcdiPdvueM/qm//9XzyTQ==", + "node_modules/@azure/core-auth": { + "version": "1.11.0", + "resolved": "https://registry.npmjs.org/@azure/core-auth/-/core-auth-1.11.0.tgz", + "integrity": "sha512-IUZydyTUkDnYdstOW9pFOOUQlBjAepK5teihDE3x6yxsPJs/hsAaaYpeGxdxrgtOiJbBKSjKW7MDk7AEhb4LRg==", "dev": true, + "license": "MIT", "dependencies": { - "@sinonjs/commons": "^1", - "@sinonjs/samsam": "^3.1.0" + "@azure/abort-controller": "^2.1.2", + "@azure/core-util": "^1.13.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=22.0.0" } }, - "node_modules/@sinonjs/samsam": { - "version": "3.3.3", - "resolved": "https://registry.npmjs.org/@sinonjs/samsam/-/samsam-3.3.3.tgz", - "integrity": "sha512-bKCMKZvWIjYD0BLGnNrxVuw4dkWCYsLqFOUWw8VgKF/+5Y+mE7LfHWPIYoDXowH+3a9LsWDMo0uAP8YDosPvHQ==", + "node_modules/@azure/core-client": { + "version": "1.11.1", + "resolved": "https://registry.npmjs.org/@azure/core-client/-/core-client-1.11.1.tgz", + "integrity": "sha512-2QygG2F76ZpMP2eMztiJvAiFMu71M9rDeU7vO/QKg5Css7MgM4frUOslFjhVjRhbGaCNPtz/S8M6y46/fFKVuQ==", "dev": true, + "license": "MIT", "dependencies": { - "@sinonjs/commons": "^1.3.0", - "array-from": "^2.1.1", - "lodash": "^4.17.15" + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-rest-pipeline": "^1.22.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=22.0.0" } }, - "node_modules/@sinonjs/text-encoding": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/@sinonjs/text-encoding/-/text-encoding-0.7.2.tgz", - "integrity": "sha512-sXXKG+uL9IrKqViTtao2Ws6dy0znu9sOaP1di/jKGW1M6VssO8vlpXCQcpZ+jisQ1tTFAC5Jo/EOzFbggBagFQ==", - "dev": true - }, - "node_modules/@types/lodash": { - "version": "4.14.121", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.121.tgz", - "integrity": "sha512-ORj7IBWj13iYufXt/VXrCNMbUuCTJfhzme5kx9U/UtcIPdJYuvPDUAlHlbNhz/8lKCLy9XGIZnGrqXOtQbPGoQ==", - "dev": true - }, - "node_modules/@types/mocha": { - "version": "5.2.6", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.6.tgz", - "integrity": "sha512-1axi39YdtBI7z957vdqXI4Ac25e7YihYQtJa+Clnxg1zTJEaIRbndt71O3sP4GAMgiAm0pY26/b9BrY4MR/PMw==", - "dev": true - }, - "node_modules/@types/node": { - "version": "22.19.19", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.19.tgz", - "integrity": "sha512-dyh/xO2Fh5bYrfWaaqGrRQQGkNdmYw6AmaAUvYeUMNTWQtvb796ikLdmTchRmOlOiIJ1TDXfWgVx1QkUlQ6Hew==", + "node_modules/@azure/core-process": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@azure/core-process/-/core-process-1.0.0.tgz", + "integrity": "sha512-/shnJ+ooO8WPxDhPEeI/2oRQuubn16gZ6CvlbpWbEswZfzwI9tI/sMAHmF3x1LuQ9yZYXfLW3TjzGMLEC5blKg==", "dev": true, "license": "MIT", - "dependencies": { - "undici-types": "~6.21.0" + "engines": { + "node": ">=22.0.0" } }, - "node_modules/@types/proxyquire": { - "version": "1.3.31", - "resolved": "https://registry.npmjs.org/@types/proxyquire/-/proxyquire-1.3.31.tgz", - "integrity": "sha512-uALowNG2TSM1HNPMMOR0AJwv4aPYPhqB0xlEhkeRTMuto5hjoSPZkvgu1nbPUkz3gEPAHv4sy4DmKsurZiEfRQ==", - "dev": true - }, - "node_modules/@types/semver": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", - "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", - "dev": true - }, - "node_modules/@types/sinon": { - "version": "7.0.13", - "resolved": "https://registry.npmjs.org/@types/sinon/-/sinon-7.0.13.tgz", - "integrity": "sha512-d7c/C/+H/knZ3L8/cxhicHUiTDxdgap0b/aNJfsmLwFu/iOP17mdgbQsbHA3SJmrzsjD0l3UEE5SN4xxuz5ung==", - "dev": true - }, - "node_modules/@types/universal-analytics": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/@types/universal-analytics/-/universal-analytics-0.4.1.tgz", - "integrity": "sha512-AZSPpDUEZ4mAgO9geHc62dp/xCLmBJ1yIpbgTq5W/cWcVQsxmU/FyKwYKHXk2hnT9TAmYVFFdAijMrCdYjuHsA==", - "dev": true - }, - "node_modules/@types/uuid": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-10.0.0.tgz", - "integrity": "sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/vscode": { - "version": "1.120.0", - "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.120.0.tgz", - "integrity": "sha512-feaT4Rst+FkTch5zz/ZbNCxoIvo55YU80Be2kiL7OJcod4+CUYf2lUBPdIJzozNnSEMq1VRTGrWEcCGFB3fBmA==", + "node_modules/@azure/core-rest-pipeline": { + "version": "1.25.0", + "resolved": "https://registry.npmjs.org/@azure/core-rest-pipeline/-/core-rest-pipeline-1.25.0.tgz", + "integrity": "sha512-bMs8ekJLjX8wPV+9IPBges1SLPyuDtE9g5gLDWOpxzKcoOFQnpLGkbcT1tdw3FaAmDS1gnPmMmJ6y/T5B96kIA==", "dev": true, - "license": "MIT" - }, - "node_modules/@vscode/debugadapter": { - "version": "1.68.0", - "resolved": "https://registry.npmjs.org/@vscode/debugadapter/-/debugadapter-1.68.0.tgz", - "integrity": "sha512-D6gk5Fw2y4FV8oYmltoXpj+VAZexxJFopN/mcZ6YcgzQE9dgq2L45Aj3GLxScJOD6GeLILcxJIaA8l3v11esGg==", "license": "MIT", "dependencies": { - "@vscode/debugprotocol": "1.68.0" + "@azure/abort-controller": "^2.1.2", + "@azure/core-auth": "^1.10.0", + "@azure/core-tracing": "^1.3.0", + "@azure/core-util": "^1.13.0", + "@azure/logger": "^1.3.0", + "@typespec/ts-http-runtime": "^0.3.4", + "tslib": "^2.6.2" }, "engines": { - "node": ">=14" + "node": ">=22.0.0" } }, - "node_modules/@vscode/debugprotocol": { - "version": "1.68.0", - "resolved": "https://registry.npmjs.org/@vscode/debugprotocol/-/debugprotocol-1.68.0.tgz", - "integrity": "sha512-2J27dysaXmvnfuhFGhfeuxfHRXunqNPxtBoR3koiTOA9rdxWNDTa1zIFLCFMSHJ9MPTPKFcBeblsyaCJCIlQxg==", - "license": "MIT" - }, - "node_modules/@vscode/vsce": { - "version": "2.22.0", - "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-2.22.0.tgz", - "integrity": "sha512-8df4uJiM3C6GZ2Sx/KilSKVxsetrTBBIUb3c0W4B1EWHcddioVs5mkyDKtMNP0khP/xBILVSzlXxhV+nm2rC9A==", + "node_modules/@azure/core-tracing": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@azure/core-tracing/-/core-tracing-1.4.0.tgz", + "integrity": "sha512-eGwxD0AtncrxeBM4tG8R55Pc3rdX1hNW2WibJAgYpCVA6E93mvvVH+LcssoVjOBrSKWS55yEIHsk0X8ctHmfOQ==", "dev": true, + "license": "MIT", "dependencies": { - "azure-devops-node-api": "^11.0.1", - "chalk": "^2.4.2", - "cheerio": "^1.0.0-rc.9", - "commander": "^6.2.1", - "glob": "^7.0.6", - "hosted-git-info": "^4.0.2", - "jsonc-parser": "^3.2.0", - "leven": "^3.1.0", - "markdown-it": "^12.3.2", - "mime": "^1.3.4", - "minimatch": "^3.0.3", - "parse-semver": "^1.1.1", - "read": "^1.0.7", - "semver": "^7.5.2", - "tmp": "^0.2.1", - "typed-rest-client": "^1.8.4", - "url-join": "^4.0.1", - "xml2js": "^0.5.0", - "yauzl": "^2.3.1", - "yazl": "^2.2.2" - }, - "bin": { - "vsce": "vsce" + "tslib": "^2.6.2" }, "engines": { - "node": ">= 14" - }, - "optionalDependencies": { - "keytar": "^7.7.0" + "node": ">=22.0.0" } }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "node_modules/@azure/core-util": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@azure/core-util/-/core-util-1.14.0.tgz", + "integrity": "sha512-9n2pWK61veAuN0V20t9lOuoV4CFMdyAZ1ygZzvBGk/pBBJRib/PjL9PLXa/aI2CcPpyHfqVsxxqLCYl6uZlfDw==", + "dev": true, + "license": "MIT", "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" + "@azure/abort-controller": "^2.1.2", + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" + "engines": { + "node": ">=22.0.0" } }, - "node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "node_modules/@azure/identity": { + "version": "4.14.1", + "resolved": "https://registry.npmjs.org/@azure/identity/-/identity-4.14.1.tgz", + "integrity": "sha512-HHuuFrmN1uuF9D5A6aAo5eHzNFNX4Q+P4SksZqDKse5YaJFFy/zDLG3wXHEV2FVGgetZ3QM8jGURNBtnQYf1NQ==", "dev": true, + "license": "MIT", "dependencies": { - "color-convert": "^1.9.0" + "@azure/abort-controller": "^2.0.0", + "@azure/core-auth": "^1.9.0", + "@azure/core-client": "^1.9.2", + "@azure/core-process": "^1.0.0", + "@azure/core-rest-pipeline": "^1.17.0", + "@azure/core-tracing": "^1.0.0", + "@azure/core-util": "^1.11.0", + "@azure/logger": "^1.0.0", + "@azure/msal-browser": "^5.5.0", + "@azure/msal-node": "^7.1.0", + "open": "^11.0.0", + "tslib": "^2.2.0" }, "engines": { - "node": ">=4" + "node": ">=22.0.0" } }, - "node_modules/anymatch": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", - "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "node_modules/@azure/logger": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.4.0.tgz", + "integrity": "sha512-rbAE25KUfjU/s3XHUdJgceoCP5dEOpMx85J04kF+QMdta73XkuG9JGHHinch+XIoKpBdqljin+KqURpJriSzLA==", "dev": true, + "license": "MIT", "dependencies": { - "micromatch": "^2.1.5", - "normalize-path": "^2.0.0" + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=22.0.0" } }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha512-dtXTVMkh6VkEEA7OhXnN1Ecb8aAGFdZ1LFxtOCoqj4qkyOJMt7+qs6Ahdy6p/NQCPYsRSXXivhSB/J5E9jmYKA==", + "node_modules/@azure/msal-browser": { + "version": "5.28.0", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-5.28.0.tgz", + "integrity": "sha512-f3yY518Z++x3ZogCbcLK6vnABgpxc8rAKGKtQibcUJKAVU9gamgh5mNAPJIRwduzXQvO2xtHx/gtmPz8iuZ8+w==", "dev": true, + "license": "MIT", "dependencies": { - "arr-flatten": "^1.0.1" + "@azure/msal-common": "16.16.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=0.8.0" } }, - "node_modules/arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "node_modules/@azure/msal-common": { + "version": "16.16.0", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.16.0.tgz", + "integrity": "sha512-EZgd8h5nczsdRAQAgXA0A0pC5L/zj43n1jePXvUMgdwXMbH2zhb7b7Hp+Oe7ZOODK/sch2x+soD6FOrtgUbx/w==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=0.8.0" } }, - "node_modules/arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha512-sKpyeERZ02v1FeCZT8lrfJq5u6goHCtpTAzPwJYe7c8SPFOboNjNg1vz2L4VTn9T4PQxEx13TbXLmYUcS6Ug7Q==", + "node_modules/@azure/msal-node": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-7.2.0.tgz", + "integrity": "sha512-Y87VJsMWF4jiqLqq8XYLb1o+rGc/HacwS3Zydi3bDtaVm5Sa8FlB7YrKrBFKRIYj27RJXAaDkErImMAqtM10Pg==", "dev": true, + "license": "MIT", + "dependencies": { + "@azure/msal-common": "16.16.0", + "jsonwebtoken": "^9.0.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=20" } }, - "node_modules/array-from": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/array-from/-/array-from-2.1.1.tgz", - "integrity": "sha512-GQTc6Uupx1FCavi5mPzBvVT7nEOeWMmUA9P95wpfpW1XwMSKs+KaymD5C2Up7KAUKg/mYwbsUYzdZWcoajlNZg==", - "dev": true - }, - "node_modules/array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha512-G2n5bG5fSUCpnsXz4+8FUkYsGPkNfLn9YvS66U5qbTIXI2Ynnlo4Bi42bWv+omKUCqz+ejzfClwne0alJWJPhg==", + "node_modules/@cacheable/memory": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@cacheable/memory/-/memory-2.2.0.tgz", + "integrity": "sha512-CTLKqLItRCEixEAewD3/j9DB3/o96gpTPD4eJ1v+DGOlxZRZncRQkGYqqnAGCscYd6RNeXfGeiuCphsPtqyIfQ==", "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/asn1": { - "version": "0.2.6", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", - "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", + "license": "MIT", "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/assert-plus": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "engines": { - "node": ">=0.8" + "@cacheable/utils": "^2.5.0", + "@keyv/bigmap": "^1.3.1", + "hookified": "^1.15.1", + "keyv": "^5.6.0" } }, - "node_modules/assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha512-Q+JC7Whu8HhmTdBph/Tq59IoRtoy6KAm5zzPv00WdujX82lbAL8K7WVjne7vdCsAmbF4AYaDOPyO3k0kl8qIrw==", + "node_modules/@cacheable/utils": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/@cacheable/utils/-/utils-2.5.0.tgz", + "integrity": "sha512-buipgOVDkkPXNR5+xBpDw7Zk2n1EvU7qBJCNUcL7rhQ//kfpOXPAvQ511Os0vpLYJ1pZnvudNytkQt2hst3wqA==", "dev": true, - "engines": { - "node": ">=0.10.0" + "license": "MIT", + "dependencies": { + "hashery": "^1.5.1", + "keyv": "^5.6.0" } }, - "node_modules/async-each": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.6.tgz", - "integrity": "sha512-c646jH1avxr+aVpndVMeAfYw7wAa6idufrlN3LPA4PmKS0QEGp6PIC9nwz0WQkkvBGAMEki3pFdtxaF39J9vvg==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, - "node_modules/atob": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", - "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", + "node_modules/@eslint-community/eslint-utils": { + "version": "4.10.1", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.10.1.tgz", + "integrity": "sha512-cuadcxVFE8sDK6iWJbs8Sn0av2Nrh2QSGQhVlBW9AaAHqHwjWsZHT8LJ4hFGPh7ASBV2deFdM7H/DPjulmh8rg==", "dev": true, - "bin": { - "atob": "bin/atob.js" + "license": "MIT", + "dependencies": { + "eslint-visitor-keys": "^3.4.3" }, "engines": { - "node": ">= 4.5.0" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } }, - "node_modules/aws-sign2": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz", - "integrity": "sha512-08kcGqnYf/YmjoRhfxyu+CLxBjUtHLXLXX/vUfx9l2LYzG3c1m61nrpyFUZI6zeS+Li/wWMMidD9KgrqtGq3mA==", + "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz", + "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==", + "dev": true, + "license": "Apache-2.0", "engines": { - "node": "*" + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/aws4": { - "version": "1.12.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.12.0.tgz", - "integrity": "sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==" - }, - "node_modules/azure-devops-node-api": { - "version": "11.2.0", - "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-11.2.0.tgz", - "integrity": "sha512-XdiGPhrpaT5J8wdERRKs5g8E0Zy1pvOYTli7z9E8nmOn3YGp4FhtjhrOyFmX/8veWCwdI69mCHKJw6l+4J/bHA==", + "node_modules/@eslint-community/regexpp": { + "version": "4.12.2", + "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz", + "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==", "dev": true, - "dependencies": { - "tunnel": "0.0.6", - "typed-rest-client": "^1.8.4" + "license": "MIT", + "engines": { + "node": "^12.0.0 || ^14.0.0 || >=16.0.0" } }, - "node_modules/babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==", + "node_modules/@eslint/config-array": { + "version": "0.23.5", + "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.23.5.tgz", + "integrity": "sha512-Y3kKLvC1dvTOT+oGlqNQ1XLqK6D1HU2YXPc52NmAlJZbMMWDzGYXMiPRJ8TYD39muD/OTjlZmNJ4ib7dvSrMBA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "core-js": "^2.4.0", - "regenerator-runtime": "^0.11.0" + "@eslint/object-schema": "^3.0.5", + "debug": "^4.3.1", + "minimatch": "^10.2.4" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "node_modules/@eslint/config-helpers": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.7.0.tgz", + "integrity": "sha512-DObd/KKUsU+FaFv4PLxSRenpXfQWmPXXP3pPZ6/K1PCrMu2vQpMDMuQe/BqYeoLcz8ro0bVDF1RxOJgfVEdhUw==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" + "@eslint/core": "^1.2.1" }, "engines": { - "node": ">=0.10.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/base/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA==", + "node_modules/@eslint/core": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@eslint/core/-/core-1.2.1.tgz", + "integrity": "sha512-MwcE1P+AZ4C6DWlpin/OmOA54mmIZ/+xZuJiQd4SyB29oAJjN30UW9wkKNptW2ctp4cEsvhlLY/CsQ1uoHDloQ==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "is-descriptor": "^1.0.0" + "@types/json-schema": "^7.0.15" }, "engines": { - "node": ">=0.10.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/base/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/@eslint/js": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-10.0.1.tgz", + "integrity": "sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "eslint": "^10.0.0" + }, + "peerDependenciesMeta": { + "eslint": { + "optional": true } - ], - "optional": true - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha512-qeFIXtP4MSoi6NLqO12WfqARWWuCKi2Rn/9hJLEmtB5yTNr9DqFWkJRCf2qShWzPeAMRnOgCrq0sg/KLv5ES9w==", - "dependencies": { - "tweetnacl": "^0.14.3" } }, - "node_modules/binary-extensions": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.13.1.tgz", - "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", + "node_modules/@eslint/object-schema": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-3.0.5.tgz", + "integrity": "sha512-vqTaUEgxzm+YDSdElad6PiRoX4t8VGDjCtt05zn4nU810UIx/uNEV7/lZJ6KwFThKZOzOxzXy48da+No7HZaMw==", "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/bindings": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", - "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", - "dev": true, - "optional": true, - "dependencies": { - "file-uri-to-path": "1.0.0" - } - }, - "node_modules/bl": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", - "integrity": "sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==", - "dev": true, - "optional": true, - "dependencies": { - "buffer": "^5.5.0", - "inherits": "^2.0.4", - "readable-stream": "^3.4.0" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/@eslint/plugin-kit": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.7.3.tgz", + "integrity": "sha512-IkO+/KEUvwbVpiURZg+P7zF74z5Jxe0UgJxVni+RtoHQ6IZieXaO02kmadomap/q+l6bc/jdPGGqTjhuZnuz1Q==", "dev": true, - "optional": true, + "license": "Apache-2.0", "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" + "@eslint/core": "^1.2.1", + "levn": "^0.4.1" }, "engines": { - "node": ">= 6" + "node": "^20.19.0 || ^22.13.0 || >=24" } }, - "node_modules/boolbase": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz", - "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==", - "dev": true - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha512-xU7bpz2ytJl1bH9cgIurjpg/n8Gohy9GTw81heDYLJQ4RU60dlyJsa+atVF2pI0yMMvKxI9HkKwjePCj5XI1hw==", + "node_modules/@humanfs/core": { + "version": "0.19.2", + "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz", + "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==", "dev": true, + "license": "Apache-2.0", "dependencies": { - "expand-range": "^1.8.1", - "preserve": "^0.2.0", - "repeat-element": "^1.1.2" + "@humanfs/types": "^0.15.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=18.18.0" } }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/buffer": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-5.7.1.tgz", - "integrity": "sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ==", + "node_modules/@humanfs/node": { + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz", + "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "optional": true, + "license": "Apache-2.0", "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.1.13" + "@humanfs/core": "^0.19.2", + "@humanfs/types": "^0.15.0", + "@humanwhocodes/retry": "^0.4.0" + }, + "engines": { + "node": ">=18.18.0" } }, - "node_modules/buffer-crc32": { - "version": "0.2.13", - "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", - "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", + "node_modules/@humanfs/types": { + "version": "0.15.0", + "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz", + "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==", "dev": true, + "license": "Apache-2.0", "engines": { - "node": "*" + "node": ">=18.18.0" } }, - "node_modules/cache-base": { + "node_modules/@humanwhocodes/module-importer": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz", + "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==", "dev": true, - "dependencies": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - }, + "license": "Apache-2.0", "engines": { - "node": ">=0.10.0" + "node": ">=12.22" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/cache-base/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/@humanwhocodes/retry": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz", + "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==", "dev": true, + "license": "Apache-2.0", "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/call-bind": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.5.tgz", - "integrity": "sha512-C3nQxfFZxFRVoJoGKKI8y3MOEo129NQ+FgQ08iye+Mk4zNZZGdjfs06bVTr+DBSlA66Q2VEcMki/cUCP4SercQ==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.1", - "set-function-length": "^1.1.1" + "node": ">=18.18" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "github", + "url": "https://github.com/sponsors/nzakas" } }, - "node_modules/caseless": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha512-4tYFyifaFfGacoiObjJegolkwSU4xQNGbVgUiNYVUxbQ2x2lUsFvY4hVgVzGiIe6WLOPqycWXA40l+PWsxthUw==" - }, - "node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=6.0.0" } }, - "node_modules/cheerio": { - "version": "1.0.0-rc.12", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-1.0.0-rc.12.tgz", - "integrity": "sha512-VqR8m68vM46BNnuZ5NtnGBKIE/DfN0cRIzg9n40EIq9NOv90ayxLBXA8fXC5gquFRGJSTRqBq25Jt2ECLR431Q==", + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", "dev": true, - "dependencies": { - "cheerio-select": "^2.1.0", - "dom-serializer": "^2.0.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "htmlparser2": "^8.0.1", - "parse5": "^7.0.0", - "parse5-htmlparser2-tree-adapter": "^7.0.0" - }, - "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/cheeriojs/cheerio?sponsor=1" - } + "license": "MIT" }, - "node_modules/cheerio-select": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cheerio-select/-/cheerio-select-2.1.0.tgz", - "integrity": "sha512-9v9kG0LvzrlcungtnJtpGNxY+fzECQKhK4EGJX2vByejiMX84MFNQw4UxPJl3bFbTMw+Dfs37XaIkCwTZfLh4g==", + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", "dev": true, + "license": "MIT", "dependencies": { - "boolbase": "^1.0.0", - "css-select": "^5.1.0", - "css-what": "^6.1.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" } }, - "node_modules/chokidar": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", - "integrity": "sha512-mk8fAWcRUOxY7btlLtitj3A45jOwSAxH4tOFOoEGbVsl6cL6pPMWUy7dwZ/canfj3QEdP6FHSnf/l1c6/WkzVg==", - "deprecated": "Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.", + "node_modules/@keyv/bigmap": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/@keyv/bigmap/-/bigmap-1.3.1.tgz", + "integrity": "sha512-WbzE9sdmQtKy8vrNPa9BRnwZh5UF4s1KTmSK0KUVLo3eff5BlQNNWDnFOouNpKfPKDnms9xynJjsMYjMaT/aFQ==", "dev": true, + "license": "MIT", "dependencies": { - "anymatch": "^1.3.0", - "async-each": "^1.0.0", - "glob-parent": "^2.0.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^2.0.0", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0" + "hashery": "^1.4.0", + "hookified": "^1.15.0" }, - "optionalDependencies": { - "fsevents": "^1.0.0" + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "keyv": "^5.6.0" } }, - "node_modules/chownr": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.4.tgz", - "integrity": "sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==", + "node_modules/@keyv/serialize": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/@keyv/serialize/-/serialize-1.1.1.tgz", + "integrity": "sha512-dXn3FZhPv0US+7dtJsIi2R+c7qWYiReoEh5zUntWCf4oSpMNib8FDhSoed6m3QyZdx5hK7iLFkYk3rNxwt8vTA==", "dev": true, - "optional": true + "license": "MIT" }, - "node_modules/class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "node_modules/@napi-rs/keyring": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring/-/keyring-1.3.0.tgz", + "integrity": "sha512-WrOw/bcXm0f9qHkumlT1QlArXSTWqaY9sunsDpOk+yCCorCKMxvWT/a3xko4EYHVdeZoh00yI2TydXn6eyICDA==", "dev": true, - "dependencies": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" + "license": "MIT", + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/Brooooooklyn" }, + "optionalDependencies": { + "@napi-rs/keyring-darwin-arm64": "1.3.0", + "@napi-rs/keyring-darwin-x64": "1.3.0", + "@napi-rs/keyring-freebsd-x64": "1.3.0", + "@napi-rs/keyring-linux-arm-gnueabihf": "1.3.0", + "@napi-rs/keyring-linux-arm64-gnu": "1.3.0", + "@napi-rs/keyring-linux-arm64-musl": "1.3.0", + "@napi-rs/keyring-linux-riscv64-gnu": "1.3.0", + "@napi-rs/keyring-linux-x64-gnu": "1.3.0", + "@napi-rs/keyring-linux-x64-musl": "1.3.0", + "@napi-rs/keyring-win32-arm64-msvc": "1.3.0", + "@napi-rs/keyring-win32-ia32-msvc": "1.3.0", + "@napi-rs/keyring-win32-x64-msvc": "1.3.0" + } + }, + "node_modules/@napi-rs/keyring-darwin-arm64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-darwin-arm64/-/keyring-darwin-arm64-1.3.0.tgz", + "integrity": "sha512-pl76hJvdYUBn6I24bXiOBMA9nbDapo3I5B+f3OorjDU4dUMSypXeKbOVehJe8fhgTiH24flMyTS3aAIy43xegQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/class-utils/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==", + "node_modules/@napi-rs/keyring-darwin-x64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-darwin-x64/-/keyring-darwin-x64-1.3.0.tgz", + "integrity": "sha512-YcJtEV5LA3cvA4z3BurgxH5IhTsW1JfIvcAAcqcecwk06Si9F9NqkxbZVIfDwQ8oRHgaBmT3zZJnLAotCrVahw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "is-descriptor": "^0.1.0" - }, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/class-utils/node_modules/is-descriptor": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz", - "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==", + "node_modules/@napi-rs/keyring-freebsd-x64": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-freebsd-x64/-/keyring-freebsd-x64-1.3.0.tgz", + "integrity": "sha512-vlLf31TGhfRAaxLDBhg8b89ss0HHD/lyNmL5F3UjSaz5CUXElsJmKYq9fqA/B+cZKUEUcLHHGhF0I/CqcFdaVw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "is-accessor-descriptor": "^1.0.1", - "is-data-descriptor": "^1.0.1" - }, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], "engines": { - "node": ">= 0.4" + "node": ">= 10" } }, - "node_modules/class-utils/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/@napi-rs/keyring-linux-arm-gnueabihf": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm-gnueabihf/-/keyring-linux-arm-gnueabihf-1.3.0.tgz", + "integrity": "sha512-KiWdMMu/Inz/bHHIAGrnF7r54FZDYXuHO6UFF/rhIrshUsxbMG1Rl9lEymNtqqsVo927G0VYcb02FzWQ3iBQRQ==", + "cpu": [ + "arm" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha512-lNkKvzEeMBBjUGHZ+q6z9pSJla0KWAQPvtzhEV9+iGyQYG+pBpl7xKDhxoNSOZH2hhv0v5k0y2yAM4o4SjoSkw==", + "node_modules/@napi-rs/keyring-linux-arm64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm64-gnu/-/keyring-linux-arm64-gnu-1.3.0.tgz", + "integrity": "sha512-eyKGpY40lm9Jvs1aD294XRH4y7+TlJM0YVAryZeXA6TX0mb4gMkxVXwSQv7MCwgah7raeUd0dKUb4BPAYIgcMg==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - }, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "node_modules/@napi-rs/keyring-linux-arm64-musl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-arm64-musl/-/keyring-linux-arm64-musl-1.3.0.tgz", + "integrity": "sha512-iIK6JWHXAJqDrEyLY3TmswwloVyt2vj+04TZnew+uSJ9gnDO8EwRbp3/iw3LpWaXiDO7VomGO6y8I0Id8uBZSw==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "color-name": "1.1.3" + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" } }, - "node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true - }, - "node_modules/combined-stream": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", - "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", - "dependencies": { - "delayed-stream": "~1.0.0" - }, + "node_modules/@napi-rs/keyring-linux-riscv64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-riscv64-gnu/-/keyring-linux-riscv64-gnu-1.3.0.tgz", + "integrity": "sha512-/PGqrwn6EwgtK6vccASSXJRfOSP4vN1F4ASsIQ+7MdrK6hNvAJ1FZPrIuD5gGGdxezo3F++To2Wq7DbuGIeuNQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 0.8" + "node": ">= 10" } }, - "node_modules/commander": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-6.2.1.tgz", - "integrity": "sha512-U7VdrJFnJgo4xjrHpTzu0yrHPGImdsmD95ZlgYSEajAn2JKzDhDTPG9kBTefmObL2w/ngeZnilk+OV9CG3d7UA==", + "node_modules/@napi-rs/keyring-linux-x64-gnu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-x64-gnu/-/keyring-linux-x64-gnu-1.3.0.tgz", + "integrity": "sha512-2PDK1WKWTu9lBGq9VvNEkSlQD3O7YwVpmnyN2M3cy4v7NJ/8gDMd9GXv3G+FVXN13uhp4gnnPBS+ScefmEeD2A==", + "cpu": [ + "x64" + ], "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], "engines": { - "node": ">= 6" + "node": ">= 10" } }, - "node_modules/component-emitter": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.1.tgz", - "integrity": "sha512-T0+barUSQRTUQASh8bx02dl+DhF54GtIDY13Y3m9oWTklKbb3Wv974meRpeZ3lp1JpLVECWWNHC4vaG2XHXouQ==", + "node_modules/@napi-rs/keyring-linux-x64-musl": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-linux-x64-musl/-/keyring-linux-x64-musl-1.3.0.tgz", + "integrity": "sha512-oJ2HkX8YUo46QBkn0pG+HuIKQNqr523q6vBobCn+P95s4C4K6/kLBqHY/1bg5J4ap31DzsznhnFKcfBNBsjCnw==", + "cpu": [ + "x64" + ], "dev": true, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", - "dev": true - }, - "node_modules/copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha512-XgZ0pFcakEUlbwQEVNg3+QAis1FyTL3Qel9FYy8pSkQqoG3PNoT0bOCQtOXcOkur21r2Eq2kI+IE+gsmAEVlYw==", + "node_modules/@napi-rs/keyring-win32-arm64-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-arm64-msvc/-/keyring-win32-arm64-msvc-1.3.0.tgz", + "integrity": "sha512-tOd3c/uAaeoE4ycVlmAdSvygz0Zt3zdca6Y7gokBeIbaRDWpjDIUOpU3MvML59XAaqyuKGsVVu0F/DZb1lHPmw==", + "cpu": [ + "arm64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=0.10.0" + "node": ">= 10" } }, - "node_modules/core-js": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", - "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", - "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", + "node_modules/@napi-rs/keyring-win32-ia32-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-ia32-msvc/-/keyring-win32-ia32-msvc-1.3.0.tgz", + "integrity": "sha512-sPSqeAFZMGqP1R++M2JTza7GQJJ/TpCo6JU6Vcd4jnebvOaEDs9b7eipakU1PJdSvhpC2yXMCNRk9gXfrhuwHQ==", + "cpu": [ + "ia32" + ], "dev": true, - "hasInstallScript": true - }, - "node_modules/core-util-is": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", - "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", - "dev": true + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } }, - "node_modules/cpx": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/cpx/-/cpx-1.5.0.tgz", - "integrity": "sha512-jHTjZhsbg9xWgsP2vuNW2jnnzBX+p4T+vNI9Lbjzs1n4KhOfa22bQppiFYLsWQKd8TzmL5aSP/Me3yfsCwXbDA==", + "node_modules/@napi-rs/keyring-win32-x64-msvc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@napi-rs/keyring-win32-x64-msvc/-/keyring-win32-x64-msvc-1.3.0.tgz", + "integrity": "sha512-4DnCWXwDc0HRKwyRlG5y0VhKZW2tNRQfKKfyj6IX/KWfDNyq9hn4n+GL1auyDcOO/v8PwnhmYo2+rOOqCkvvOg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "babel-runtime": "^6.9.2", - "chokidar": "^1.6.0", - "duplexer": "^0.1.1", - "glob": "^7.0.5", - "glob2base": "^0.0.12", - "minimatch": "^3.0.2", - "mkdirp": "^0.5.1", - "resolve": "^1.1.7", - "safe-buffer": "^5.0.1", - "shell-quote": "^1.6.1", - "subarg": "^1.0.0" - }, - "bin": { - "cpx": "bin/index.js" + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" } }, - "node_modules/css-select": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.1.0.tgz", - "integrity": "sha512-nwoRF1rvRRnnCqqY7updORDsuqKzqYJ28+oSMaJMMgOauh3fvwHqMS7EZpIPqK8GL+g9mKxF1vP/ZjSeNjEVHg==", + "node_modules/@oxc-project/types": { + "version": "0.156.0", + "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.156.0.tgz", + "integrity": "sha512-1Duyg48TdJNdyhEB8Xn1L36bT9Pv6GUtlKjHxOys8xkaF/rQq3XJE+bAurSK/AgIz5mGFsb77cn9Pb20+WCScw==", "dev": true, - "dependencies": { - "boolbase": "^1.0.0", - "css-what": "^6.1.0", - "domhandler": "^5.0.2", - "domutils": "^3.0.1", - "nth-check": "^2.0.1" - }, + "license": "MIT", + "peer": true, "funding": { - "url": "https://github.com/sponsors/fb55" + "url": "https://github.com/sponsors/oxc-project" } }, - "node_modules/css-what": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.1.0.tgz", - "integrity": "sha512-HTUrgRJ7r4dsZKU6GjmpfRK1O76h97Z8MfS1G0FozR+oF2kG6Vfe8JE6zwrkbxigziPHinCJ+gCPjA9EaBDtRw==", + "node_modules/@rolldown/binding-android-arm-eabi": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm-eabi/-/binding-android-arm-eabi-1.2.16.tgz", + "integrity": "sha512-ia3DwAs0OsMGS7+IConptSiyk9pEXkOx/AbJ2n/lAGxH3QkWQus1t8d7gnAT38FCU2sQu8lUbeR6AiZFv4JxaA==", + "cpu": [ + "arm" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, "engines": { - "node": ">= 6" - }, - "funding": { - "url": "https://github.com/sponsors/fb55" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/dashdash": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha512-jRFi8UDGo6j+odZiEpjazZaWqEal3w/basFjQHQEwVtZJGDpxbH1MeYluwCS8Xq5wmLJooDlMgvVarmWfGM44g==", - "dependencies": { - "assert-plus": "^1.0.0" - }, + "node_modules/@rolldown/binding-android-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.2.16.tgz", + "integrity": "sha512-kx5wBiMB6E7TEvpl2B9gjLU004BkvEm2Dr941BFjx/SontPwSzNuQUIoVKxHHoSjpFIfHMmcguyLOtyn0hObRg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "peer": true, "engines": { - "node": ">=0.10" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "node_modules/@rolldown/binding-darwin-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-arm64/-/binding-darwin-arm64-1.2.16.tgz", + "integrity": "sha512-qslZrXnKJU4cUpjoAmtAo/KQM9e2IRMlmpig6Zpwj+8KWxW8v+nkAf9216Bsek9lOC1jvg2yCjygCFo2f83msQ==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "ms": "2.0.0" + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/decode-uri-component": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.2.tgz", - "integrity": "sha512-FqUYQ+8o158GyGTrMFJms9qh3CqTKvAqgqsTnkLI8sKu0028orqBhxNMFkFen0zGyg6epACD32pjVk58ngIErQ==", + "node_modules/@rolldown/binding-darwin-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-darwin-x64/-/binding-darwin-x64-1.2.16.tgz", + "integrity": "sha512-FdF+y48ND13eAyM2mQn+85kvAqNlvRWROy2rhgA463X/0Gv4vGtazZtfaF1mRBLscYvtOlh4QnLjOWiFzX69OQ==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, "engines": { - "node": ">=0.10" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/decompress-response": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", - "integrity": "sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==", + "node_modules/@rolldown/binding-freebsd-x64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-freebsd-x64/-/binding-freebsd-x64-1.2.16.tgz", + "integrity": "sha512-ddjqFM5e95AgLbUPtKIS7V1KTVlA0RUgCVr5mn+/IEhsdy3pr+Vuj/HZ7nlMN2FyxIwUktOH1LEPIQXO1v9y1Q==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MIT", "optional": true, - "dependencies": { - "mimic-response": "^3.1.0" - }, + "os": [ + "freebsd" + ], + "peer": true, "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", + "node_modules/@rolldown/binding-linux-arm-gnueabihf": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm-gnueabihf/-/binding-linux-arm-gnueabihf-1.2.16.tgz", + "integrity": "sha512-tHdKWbFkFBI687iim3LIyIvyL7j66VvQYkDPss5Stn/qyE2tWkR1YD0dXmXPFKKqT/o5ZEJVsaRsWS2meQwGOA==", + "cpu": [ + "arm" + ], "dev": true, + "license": "MIT", "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=4.0.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/define-data-property": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/define-data-property/-/define-data-property-1.1.1.tgz", - "integrity": "sha512-E7uGkTzkk1d0ByLeSc6ZsFS79Axg+m1P/VsgYsxHgiuc3tFSj+MjMIwe90FC4lOAZzNBdY7kkO2P2wKdsQ1vgQ==", + "node_modules/@rolldown/binding-linux-arm64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-gnu/-/binding-linux-arm64-gnu-1.2.16.tgz", + "integrity": "sha512-FJiLGAblPBMlBEdbOqw6kW6QcXDWAf/oJu7gYs9ZJZwmg+K+/zjFLxPTIY9izJUzxzc24FHvmseyA0IvJSl17w==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "get-intrinsic": "^1.2.1", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.0" - }, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">= 0.4" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", + "node_modules/@rolldown/binding-linux-arm64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-arm64-musl/-/binding-linux-arm64-musl-1.2.16.tgz", + "integrity": "sha512-hrJpblMsrQ58U9veWpbXzkhV5zStunds6HWLprqq1qauvgBr1E6P+24kLj6lSLI9vjRn/RYpjprhkHQPKGWpNg==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/define-property/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/@rolldown/binding-linux-ppc64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-ppc64-gnu/-/binding-linux-ppc64-gnu-1.2.16.tgz", + "integrity": "sha512-qJd/dC6j6CwLG9/s/RP2nb1RZ0GIgj7Ioj7x/SYa3RzjVrlzrmH0fhIOpfvqQDeIsdP0loi+kHaMhJzY1PBIaA==", + "cpu": [ + "ppc64" + ], "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/delayed-stream": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "node_modules/@rolldown/binding-linux-s390x-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-s390x-gnu/-/binding-linux-s390x-gnu-1.2.16.tgz", + "integrity": "sha512-Vx7Xg5uUJuNcujJjI70OICaH0EYj80BtOLZTSN7uOYg8QOLlyKnaG0IW7Fn/J0IpJsaKzmDKMhOQv1JBM9m9vg==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.4.0" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/detect-libc": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.0.2.tgz", - "integrity": "sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==", + "node_modules/@rolldown/binding-linux-x64-gnu": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-gnu/-/binding-linux-x64-gnu-1.2.16.tgz", + "integrity": "sha512-TNKhgE3uJTsTzatUSSYt0Kgo+Oa2uSlSjz4r1aEIea7HX6ULBym4fAlYUhG1i6pjNf2njfCUAfKwr6C3E9Xg1w==", + "cpu": [ + "x64" + ], "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=8" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", + "node_modules/@rolldown/binding-linux-x64-musl": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-linux-x64-musl/-/binding-linux-x64-musl-1.2.16.tgz", + "integrity": "sha512-7chXdpjXZ8qG0+mIxECN3cT9kvhZ3/oZhMX6Pp876P7CDrIy8nJswva6Mq357JR7eYXfuskwZxMeV1SzoZdHrA==", + "cpu": [ + "x64" + ], "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.3.1" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/dom-serializer": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz", - "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==", + "node_modules/@rolldown/binding-openharmony-arm64": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-openharmony-arm64/-/binding-openharmony-arm64-1.2.16.tgz", + "integrity": "sha512-Kwjt+7uNTJK5/MDkGWGVO2KQPnj8yAV75dMpfwyHZrJSXWHrniOB0aUEWlVYf3H1hOqFLIStLdM5QXq6bnKmOQ==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.2", - "entities": "^4.2.0" - }, - "funding": { - "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/domelementtype": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", - "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==", + "node_modules/@rolldown/binding-win32-arm64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-arm64-msvc/-/binding-win32-arm64-msvc-1.2.16.tgz", + "integrity": "sha512-/LH6WfjDRXXJz/p5xl4TmU+jpcnwcxbKEQBW/GZE0JHfN0lGIyTtsUEGaQ/q/GikkGJ2yLKe6pwm7AnEWO8pdw==", + "cpu": [ + "arm64" + ], "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ] + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, + "engines": { + "node": "^20.19.0 || >=22.12.0" + } }, - "node_modules/domhandler": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz", - "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==", + "node_modules/@rolldown/binding-win32-x64-msvc": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/@rolldown/binding-win32-x64-msvc/-/binding-win32-x64-msvc-1.2.16.tgz", + "integrity": "sha512-1lv1KvX0Z871zfk7vw+dnXMMnHNyDwMzWG8Kv3HxDXMOhzCX4SHc7HK319fInP0i+0p9D8brkfzL7pJOaGl+tw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "domelementtype": "^2.3.0" - }, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "peer": true, "engines": { - "node": ">= 4" - }, - "funding": { - "url": "https://github.com/fb55/domhandler?sponsor=1" + "node": "^20.19.0 || >=22.12.0" } }, - "node_modules/domutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz", - "integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==", + "node_modules/@rolldown/pluginutils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", + "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", "dev": true, - "dependencies": { - "dom-serializer": "^2.0.0", - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3" - }, - "funding": { - "url": "https://github.com/fb55/domutils?sponsor=1" - } - }, - "node_modules/duplexer": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", - "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==", - "dev": true - }, - "node_modules/ecc-jsbn": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", - "integrity": "sha512-eh9O+hwRHNbG4BLTjEl3nw044CkGm5X6LoaCf7LPp7UU8Qrt47JYNi6nPX8xjW97TKGKm1ouctg0QSpZe9qrnw==", - "dependencies": { - "jsbn": "~0.1.0", - "safer-buffer": "^2.1.0" - } + "license": "MIT", + "peer": true }, - "node_modules/end-of-stream": { - "version": "1.4.4", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", - "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", + "node_modules/@secretlint/core": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/core/-/core-10.2.2.tgz", + "integrity": "sha512-6rdwBwLP9+TO3rRjMVW1tX+lQeo5gBbxl1I5F8nh8bgGtKwdlCMhMKsBWzWg1ostxx/tIG7OjZI0/BxsP8bUgw==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "once": "^1.4.0" - } - }, - "node_modules/entities": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", - "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, - "engines": { - "node": ">=0.12" + "@secretlint/profiler": "^10.2.2", + "@secretlint/types": "^10.2.2", + "debug": "^4.4.1", + "structured-source": "^4.0.0" }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, "engines": { - "node": ">=0.8.0" + "node": ">=20.0.0" } }, - "node_modules/expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha512-hxx03P2dJxss6ceIeri9cmYOT4SRs3Zk3afZwWpOsRqLqprhTR8u++SlC+sFGsQr7WGFPdMF7Gjc1njDLDK6UA==", + "node_modules/@secretlint/profiler": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/profiler/-/profiler-10.2.2.tgz", + "integrity": "sha512-qm9rWfkh/o8OvzMIfY8a5bCmgIniSpltbVlUVl983zDG1bUuQNd1/5lUEeWx5o/WJ99bXxS7yNI4/KIXfHexig==", "dev": true, - "dependencies": { - "is-posix-bracket": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha512-AFASGfIlnIbkKPQwX1yHaDjFvh/1gyKJODme52V6IORh69uEYgZp0o9C+qsIGNVEiuuhQU0CSSl++Rlegg1qvA==", + "node_modules/@secretlint/secretlint-rule-no-dotenv": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/secretlint-rule-no-dotenv/-/secretlint-rule-no-dotenv-10.2.2.tgz", + "integrity": "sha512-KJRbIShA9DVc5Va3yArtJ6QDzGjg3PRa1uYp9As4RsyKtKSSZjI64jVca57FZ8gbuk4em0/0Jq+uy6485wxIdg==", "dev": true, + "license": "MIT", "dependencies": { - "fill-range": "^2.1.0" + "@secretlint/types": "^10.2.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=20.0.0" } }, - "node_modules/expand-template": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/expand-template/-/expand-template-2.0.3.tgz", - "integrity": "sha512-XYfuKMvj4O35f/pOXLObndIRvyQ+/+6AhODh+OKWj9S9498pHHn/IMszH+gt0fBCRWMNfk1ZSp5x3AifmnI2vg==", + "node_modules/@secretlint/secretlint-rule-preset-recommend": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/secretlint-rule-preset-recommend/-/secretlint-rule-preset-recommend-10.2.2.tgz", + "integrity": "sha512-K3jPqjva8bQndDKJqctnGfwuAxU2n9XNCPtbXVI5JvC7FnQiNg/yWlQPbMUlBXtBoBGFYp08A94m6fvtc9v+zA==", "dev": true, - "optional": true, + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=20.0.0" } }, - "node_modules/extend": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", - "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" - }, - "node_modules/extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha512-BwY5b5Ql4+qZoefgMj2NUmx+tehVTH/Kf4k1ZEtOHNFcm2wSxMRo992l6X3TIgni2eZVTZ85xMOjF31fwZAj6Q==", + "node_modules/@secretlint/source-creator": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/source-creator/-/source-creator-10.2.2.tgz", + "integrity": "sha512-h6I87xJfwfUTgQ7irWq7UTdq/Bm1RuQ/fYhA3dtTIAop5BwSFmZyrchph4WcoEvbN460BWKmk4RYSvPElIIvxw==", "dev": true, + "license": "MIT", "dependencies": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" + "@secretlint/types": "^10.2.2", + "istextorbinary": "^9.5.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=20.0.0" } }, - "node_modules/extend-shallow/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "node_modules/@secretlint/types": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/@secretlint/types/-/types-10.2.2.tgz", + "integrity": "sha512-Nqc90v4lWCXyakD6xNyNACBJNJ0tNCwj2WNk/7ivyacYHxiITVgmLUFXTBOeCdy79iz6HtN9Y31uw/jbLrdOAg==", "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=20.0.0" } }, - "node_modules/extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha512-1FOj1LOwn42TMrruOHGt18HemVnbwAmAak7krWk+wa93KXxGbK+2jpezm+ytJYDaBX0/SPLZFHKM7m+tKobWGg==", + "node_modules/@types/chai": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.3.tgz", + "integrity": "sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==", "dev": true, + "license": "MIT", "dependencies": { - "is-extglob": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" + "@types/deep-eql": "*", + "assertion-error": "^2.0.1" } }, - "node_modules/extsprintf": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", - "integrity": "sha512-11Ndz7Nv+mvAC1j0ktTa7fAb0vLyGGX+rMHNBYQviQDGU0Hw7lhctJANqbPhu9nV9/izT/IntTgZ7Im/9LJs9g==", - "engines": [ - "node >=0.6.0" - ] - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" - }, - "node_modules/fd-slicer": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", - "integrity": "sha512-cE1qsB/VwyQozZ+q1dGxR8LBYNZeofhEdUNGSMbQD3Gw2lAzX9Zb3uIU6Ebc/Fmyjo9AWWfnn0AUCHqtevs/8g==", + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", "dev": true, - "dependencies": { - "pend": "~1.2.0" - } + "license": "MIT" }, - "node_modules/file-uri-to-path": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", - "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "node_modules/@types/esrecurse": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@types/esrecurse/-/esrecurse-4.3.1.tgz", + "integrity": "sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==", "dev": true, - "optional": true + "license": "MIT" }, - "node_modules/filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha512-BTCqyBaWBTsauvnHiE8i562+EdJj+oUpkqWp2R1iCoR8f6oo8STRu3of7WJJ0TqWtxN50a5YFpzYK4Jj9esYfQ==", + "node_modules/@types/estree": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.10.tgz", + "integrity": "sha512-lTyOMnOcmRBzdCv6/4zUZCrEhV0xrqQiUZBZtVcbmLHBXKLnN8q89v/wKRF/Q0HbwVsqbIG3o5HDoFl9sduM+g==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/fill-keys": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/fill-keys/-/fill-keys-1.0.2.tgz", - "integrity": "sha512-tcgI872xXjwFF4xgQmLxi76GnwJG3g/3isB1l4/G5Z4zrbddGpBjqZCO9oEAcB5wX0Hj/5iQB3toxfO7in1hHA==", + "node_modules/@types/json-schema": { + "version": "7.0.15", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", + "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true, - "dependencies": { - "is-object": "~1.0.1", - "merge-descriptors": "~1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/fill-range": { - "version": "2.2.4", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.4.tgz", - "integrity": "sha512-cnrcCbj01+j2gTG921VZPnHbjmdAf8oQV/iGeV2kZxGSyfYjjTyY79ErsK1WJWMpw6DaApEX72binqJE+/d+5Q==", + "node_modules/@types/node": { + "version": "22.20.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.20.5.tgz", + "integrity": "sha512-U2+DNr+wSjpsTS/wZGYHq7GcwfuSmKiKvoPvK22zwTlRhU91yOniN4qRR5KhIjvif7ysw/dz/hKmfDH0Ris4aA==", "dev": true, + "license": "MIT", "dependencies": { - "is-number": "^2.1.0", - "isobject": "^2.0.0", - "randomatic": "^3.0.0", - "repeat-element": "^1.1.2", - "repeat-string": "^1.5.2" - }, - "engines": { - "node": ">=0.10.0" + "undici-types": "~6.21.0" } }, - "node_modules/find-index": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/find-index/-/find-index-0.1.1.tgz", - "integrity": "sha512-uJ5vWrfBKMcE6y2Z8834dwEZj9mNGxYa3t3I53OwFeuZ8D9oc2E5zcsrkuhX6h4iYrjhiv0T3szQmxlAV9uxDg==", - "dev": true - }, - "node_modules/for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha512-7EwmXrOjyL+ChxMhmG5lnW9MPt1aIeZEwKhQzoBUdTV0N3zuwWDZYVJatDvZ2OyzPUvdIAZDsCetk3coyMfcnQ==", + "node_modules/@types/semver": { + "version": "7.8.0", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.8.0.tgz", + "integrity": "sha512-1mAINjtQCXXeLkJ9ehXkwOcBpqtLxiVtKhpUf83DdRNdQKV0iXZpaHYqRr7nj+wvxuJzoAmAwXI+sCNMv1CzLQ==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha512-SKmowqGTJoPzLO1T0BBJpkfp3EMacCMOuH40hOUbrbzElVktk4DioXVM99QkLCyKoiuOmyjgcWMpVz2xjE7LZw==", + "node_modules/@types/vscode": { + "version": "1.109.0", + "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.109.0.tgz", + "integrity": "sha512-0Pf95rnwEIwDbmXGC08r0B4TQhAbsHQ5UyTIgVgoieDe4cOnf92usuR5dEczb6bTKEp7ziZH4TV1TRGPPCExtw==", "dev": true, - "dependencies": { - "for-in": "^1.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/forever-agent": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha512-j0KLYPhm6zeac4lz3oJ3o65qvgQCcPubiyotZrXqEaG4hNagNYO8qdlUrX5vwqv9ohqeT/Z3j6+yW067yWWdUw==", - "engines": { - "node": "*" - } - }, - "node_modules/form-data": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz", - "integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==", - "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12" - }, - "engines": { - "node": ">= 0.12" - } + "license": "MIT" }, - "node_modules/fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha512-GMBAbW9antB8iZRHLoGw0b3HANt57diZYFO/HL1JGIC1MjKrdmhxvrJbupnVvpys0zsz7yBApXdQyfepKly2kA==", + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.72.1.tgz", + "integrity": "sha512-5CokTWXpmbylfFabsbvHC0CAw3XLaGnoa+nFJX5FR592h/LoZsENUE6p/rg5xvkKrFEXz6pYmgI29AgXc2N3BQ==", "dev": true, + "license": "MIT", "dependencies": { - "map-cache": "^0.2.2" + "@eslint-community/regexpp": "^4.12.2", + "@typescript-eslint/scope-manager": "8.72.1", + "@typescript-eslint/type-utils": "8.72.1", + "@typescript-eslint/utils": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1", + "ignore": "^7.0.5", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.5.0" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/fs-constants": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs-constants/-/fs-constants-1.0.0.tgz", - "integrity": "sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==", - "dev": true, - "optional": true - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, - "node_modules/fsevents": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", - "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", - "deprecated": "The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "dependencies": { - "bindings": "^1.5.0", - "nan": "^2.12.1" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, - "engines": { - "node": ">= 4.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", - "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", - "dev": true, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/get-intrinsic": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.2.tgz", - "integrity": "sha512-0gSo4ml/0j98Y3lngkFEot/zhiCeWsbYIlZ+uZOVgzLyLaUw7wxUL+nCTP0XJvJg1AXulJRI3UJi8GsbDuxdGA==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.2", - "has-proto": "^1.0.1", - "has-symbols": "^1.0.3", - "hasown": "^2.0.0" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "peerDependencies": { + "@typescript-eslint/parser": "^8.72.1", + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha512-Ln0UQDlxH1BapMu3GPtf7CuYNwRZf2gwCuPqbyG6pB8WfmFpzqcy4xtAaAMUhnNqjMKTiCPZG2oMT3YSx8U2NA==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.14", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.14.tgz", + "integrity": "sha512-wCBiZ77u1tuWde6G/nfOtLaCTYcFDU5yCzARzK10y+rLhzYoL7a7yEemcopcc2Mzow7gZOIjnV2ym1NYmdiJOQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/getpass": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha512-0fzj9JxOLfJ+XGLhR8ze3unN0KZCgZwiSSDz168VERjK8Wl8kVSdcu2kspd4s4wtAa1y/qrVRiAA0WclVsu0ng==", - "dependencies": { - "assert-plus": "^1.0.0" + "node": ">= 4" } }, - "node_modules/github-from-package": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/github-from-package/-/github-from-package-0.0.0.tgz", - "integrity": "sha512-SyHy3T1v2NUXn29OsWdxmK6RwHD+vkj3v8en8AOBZ1wBQ/hCAQ5bAQTD02kW4W9tUp/3Qh6J8r9EvntiyCmOOw==", - "dev": true, - "optional": true - }, - "node_modules/glob": { - "version": "7.2.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", - "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "node_modules/@typescript-eslint/parser": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.72.1.tgz", + "integrity": "sha512-ZGwZP4OCfyA0AQTpEAMWz+rtX01DRhQWW5hB0ucKDEIX5U7jdmPSaMx94rQfaPAQzIYz2BimOgKOJtjfpRFQ9g==", "dev": true, + "license": "MIT", "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.1.1", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "@typescript-eslint/scope-manager": "8.72.1", + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1", + "debug": "^4.4.3" }, "engines": { - "node": "*" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha512-ab1S1g1EbO7YzauaJLkgLp7DZVAqj9M/dvKlTt8DkXA2tiOIcSMrlVI2J1RZyB5iJVccEscjGn+kpOG9788MHA==", - "dev": true, - "dependencies": { - "glob-parent": "^2.0.0", - "is-glob": "^2.0.0" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha512-JDYOvfxio/t42HKdxkAYaCiBN7oYiuxykOxKxdaUW5Qn0zaYN3gRQWolrwdnf0shM9/EP0ebuuTmyoXNr1cC5w==", - "dev": true, - "dependencies": { - "is-glob": "^2.0.0" + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/glob2base": { - "version": "0.0.12", - "resolved": "https://registry.npmjs.org/glob2base/-/glob2base-0.0.12.tgz", - "integrity": "sha512-ZyqlgowMbfj2NPjxaZZ/EtsXlOch28FRXgMd64vqZWk1bT9+wvSRLYD1om9M7QfQru51zJPAT17qXm4/zd+9QA==", + "node_modules/@typescript-eslint/project-service": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.72.1.tgz", + "integrity": "sha512-fAuVMkwdO/huI8nyo/WKnNKf6Gag93S56Rh3Ts5mGcavwSdaN8tRg1gCeIGX8PF+nzp1BjGfO4gHhGzW1J6jTg==", "dev": true, + "license": "MIT", "dependencies": { - "find-index": "^0.1.1" + "@typescript-eslint/tsconfig-utils": "^8.72.1", + "@typescript-eslint/types": "^8.72.1", + "debug": "^4.4.3" }, "engines": { - "node": ">= 0.10" - } - }, - "node_modules/gopd": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", - "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, - "dependencies": { - "get-intrinsic": "^1.1.3" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/graceful-fs": { - "version": "4.2.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", - "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true - }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true, - "engines": { - "node": ">=4.x" - } - }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha512-Oqluz6zhGX8cyRaTQlFMPw80bSJVG2x/cFb8ZPhUILGgHka9SsokCCOQgpveePerqidZOrT14ipqfJb7ILcW5Q==", - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, - "engines": { - "node": ">=6" + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/has-property-descriptors": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.1.tgz", - "integrity": "sha512-VsX8eaIewvas0xnvinAe9bw4WfIeODpGYikiWYLH+dma0Jw6KHYqWiWfhQlgOVK8D6PvjubK5Uc4P0iIhIcNVg==", + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.72.1.tgz", + "integrity": "sha512-lC/t6eMCZZQAAKZEYGL6RDVSuFehpdmMT6h+nJIjIa6oylN/PwDgDVtEIbB7O9xFfZYtZAYLoLlDNWKJhtF+uQ==", "dev": true, + "license": "MIT", "dependencies": { - "get-intrinsic": "^1.2.2" + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/has-proto": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", - "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true, "engines": { - "node": ">= 0.4" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/has-symbols": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", - "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.72.1.tgz", + "integrity": "sha512-e4D5R5vpeAEPBxT2BAzsFQL3sbwyeeeo5+aczgNSRK1V734jE7pTqaGFU+fXapWEQwnZbpFaTn32+Z8DwS6OTg==", "dev": true, + "license": "MIT", "engines": { - "node": ">= 0.4" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha512-IBXk4GTsLYdQ7Rvt+GRBrFSVEkmuOUy4re0Xjd9kJSUQpnTrWR4/y9RpfexN9vkAPMFuQoeWKwqzPozRTlasGw==", + "node_modules/@typescript-eslint/type-utils": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.72.1.tgz", + "integrity": "sha512-iY2wlmyrXJmx4yxUGP3aYCFF3cA/6ShddOKmLU2dx7LnEykbAM8WThlxZEfd1NddqceF6eJmZUayxx9oKIYNlg==", "dev": true, + "license": "MIT", "dependencies": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1", + "@typescript-eslint/utils": "8.72.1", + "debug": "^4.4.3", + "ts-api-utils": "^2.5.0" }, "engines": { - "node": ">=0.10.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/has-value/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/@typescript-eslint/types": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.72.1.tgz", + "integrity": "sha512-LmE5IhQet1BWOWEXqBrVtBPsMAOQ6Nzk35d+WLh3mk4EUF33sqlfxjio1MdYeSvKSG5skactKKuixBIKXhL4Rw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha512-ODYZC64uqzmtfGMEAX/FvZiRyWLpAC3vYnNunURUnkGVTS+mI0smVsWaPydRBsE3g+ok7h960jChO8mFcWlHaQ==", + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.72.1.tgz", + "integrity": "sha512-DAlUoUV93hIvrtIQLwCbmZQYVZwOMhiHJrOVUUIWicFZaIYjTRqlY3I/NZevfkLmSqkNHRu2qYDcq9lrn16oOQ==", "dev": true, + "license": "MIT", "dependencies": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" + "@typescript-eslint/project-service": "8.72.1", + "@typescript-eslint/tsconfig-utils": "8.72.1", + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/visitor-keys": "8.72.1", + "debug": "^4.4.3", + "minimatch": "^10.2.2", + "semver": "^7.7.3", + "tinyglobby": "^0.2.15", + "ts-api-utils": "^2.5.0" }, "engines": { - "node": ">=0.10.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/has-values/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==", + "node_modules/@typescript-eslint/utils": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.72.1.tgz", + "integrity": "sha512-5v5liypurJBFHCBNqh/RjsymAD+VWcE0djuGY/BUqp5fC3Qn+luWDEksjuTtWjPn6i5zQlUtkZCRG/CYG0yCkA==", "dev": true, + "license": "MIT", "dependencies": { - "kind-of": "^3.0.2" + "@eslint-community/eslint-utils": "^4.9.1", + "@typescript-eslint/scope-manager": "8.72.1", + "@typescript-eslint/types": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1" }, "engines": { - "node": ">=0.10.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" } }, - "node_modules/has-values/node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.72.1.tgz", + "integrity": "sha512-SB8xqipSzZHUePCCLNeYxqnxq83X61/qzNhjQGbTfjxGZIeOEP7tBgWYX05Tcd6CgE02WdTJnh5b8kMZJ/+bnQ==", "dev": true, + "license": "MIT", "dependencies": { - "is-buffer": "^1.1.5" + "@typescript-eslint/types": "8.72.1", + "eslint-visitor-keys": "^5.0.0" }, "engines": { - "node": ">=0.10.0" + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/has-values/node_modules/kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha512-24XsCxmEbRwEDbz/qz3stgin8TTzZ1ESR56OMCN0ujYg+vRutNSiOj9bHH9u85DKgXguraugV5sFuvbD4FW/hw==", + "node_modules/@typespec/ts-http-runtime": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@typespec/ts-http-runtime/-/ts-http-runtime-0.3.9.tgz", + "integrity": "sha512-edSdeAqkdxBVzA1yL1LrLCml1YjyCVvPMtMqJpbF+6K609tHe8V6sQUzFQSGcYNhcuhOceZtjvN32+mpIth30A==", "dev": true, + "license": "MIT", "dependencies": { - "is-buffer": "^1.1.5" + "http-proxy-agent": "^7.0.0", + "https-proxy-agent": "^7.0.0", + "tslib": "^2.6.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=22.0.0" } }, - "node_modules/hasown": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", - "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "node_modules/@vitest/mocker": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-5.1.0.tgz", + "integrity": "sha512-5umB9/jlWcqVS6fsrFmv5Gdnpu6wAUio/lEOwAmvB7v+lFo/IW2B9FhAD0p19GCULTgMzLCdUmuCDCnAzWgppQ==", "dev": true, + "license": "MIT", "dependencies": { - "function-bind": "^1.1.2" + "@jridgewell/trace-mapping": "0.3.31", + "@vitest/spy": "5.1.0", + "estree-walker": "^3.0.3", + "magic-string": "^1.4.3" }, - "engines": { - "node": ">= 0.4" + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9 || ^3.0.0", + "vite": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } } }, - "node_modules/he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha512-z/GDPjlRMNOa2XJiB4em8wJpuuBfrFOlYKTZxtpkdr1uPdibHI8rYA3MY0KDObpVyaes0e/aunid/t88ZI2EKA==", + "node_modules/@vitest/spy": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-5.1.0.tgz", + "integrity": "sha512-2DPO5OMHWKrBngC+fCmTQqemNF0gidRhp3lxbBmRhW+M1XJrfgPpqNqWVevXtn2f2ufD5ZaR1B6B641aAlcX5A==", "dev": true, - "bin": { - "he": "bin/he" + "license": "MIT", + "funding": { + "url": "https://opencollective.com/vitest" } }, - "node_modules/hosted-git-info": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", - "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", - "dev": true, + "node_modules/@vscode/debugadapter": { + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/@vscode/debugadapter/-/debugadapter-1.68.0.tgz", + "integrity": "sha512-D6gk5Fw2y4FV8oYmltoXpj+VAZexxJFopN/mcZ6YcgzQE9dgq2L45Aj3GLxScJOD6GeLILcxJIaA8l3v11esGg==", + "license": "MIT", "dependencies": { - "lru-cache": "^6.0.0" + "@vscode/debugprotocol": "1.68.0" }, "engines": { - "node": ">=10" + "node": ">=14" } }, - "node_modules/htmlparser2": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.2.tgz", - "integrity": "sha512-GYdjWKDkbRLkZ5geuHs5NY1puJ+PXwP7+fHPRz06Eirsb9ugf6d8kkXav6ADhcODhFFPMIXyxkxSuMf3D6NCFA==", - "dev": true, - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "dependencies": { - "domelementtype": "^2.3.0", - "domhandler": "^5.0.3", - "domutils": "^3.0.1", - "entities": "^4.4.0" - } + "node_modules/@vscode/debugprotocol": { + "version": "1.68.0", + "resolved": "https://registry.npmjs.org/@vscode/debugprotocol/-/debugprotocol-1.68.0.tgz", + "integrity": "sha512-2J27dysaXmvnfuhFGhfeuxfHRXunqNPxtBoR3koiTOA9rdxWNDTa1zIFLCFMSHJ9MPTPKFcBeblsyaCJCIlQxg==", + "license": "MIT" }, - "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==", + "node_modules/@vscode/vsce": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce/-/vsce-4.1.0.tgz", + "integrity": "sha512-iWNykEfLWTAU7FC2iBiE0vJvnJDpGm3GlL89dsBtRs62F+8tkPtq80Imi0QSFHjNBWu4QIdYII+3F9v/ZQRExw==", + "dev": true, + "license": "MIT", "dependencies": { - "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "@azure/identity": "^4.13.2", + "@napi-rs/keyring": "^1.3.0", + "@secretlint/core": "^10.2.2", + "@secretlint/secretlint-rule-no-dotenv": "^10.2.2", + "@secretlint/secretlint-rule-preset-recommend": "^10.2.2", + "@secretlint/source-creator": "^10.2.2", + "@secretlint/types": "^10.2.2", + "@vscode/vsce-sign": "^2.1.0", + "azure-devops-node-api": "^12.5.0", + "cockatiel": "^3.2.1", + "commander": "^12.1.0", + "hosted-git-info": "^4.1.0", + "jsonc-parser": "^3.3.1", + "marked": "^18.0.11", + "mime": "^1.6.0", + "minimatch": "^10.2.6", + "parse5": "^8.0.1", + "proper-lockfile": "^4.1.2", + "read": "^1.0.7", + "semver": "^7.8.5", + "tinyglobby": "^0.2.17", + "typed-rest-client": "^1.8.11", + "url-join": "^4.0.1", + "xml2js": "^0.5.0", + "yauzl": "^3.4.0", + "yazl": "^2.5.1" + }, + "bin": { + "vsce": "vsce" }, "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" + "node": ">= 22" } }, - "node_modules/ieee754": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.2.1.tgz", - "integrity": "sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==", + "node_modules/@vscode/vsce-sign": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign/-/vsce-sign-2.1.0.tgz", + "integrity": "sha512-9AQrqazrBgTgRSuwleLVXUrIUphY02/SFCh2TKYoLV/xifJAdblhdmEmw5gUrYSPQ3sRwNs9iyCMD14sATEE6g==", "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } + "hasInstallScript": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optionalDependencies": { + "@vscode/vsce-sign-alpine-arm64": "2.0.6", + "@vscode/vsce-sign-alpine-x64": "2.0.6", + "@vscode/vsce-sign-darwin-arm64": "2.0.6", + "@vscode/vsce-sign-darwin-x64": "2.0.6", + "@vscode/vsce-sign-linux-arm": "2.0.6", + "@vscode/vsce-sign-linux-arm64": "2.0.6", + "@vscode/vsce-sign-linux-x64": "2.0.6", + "@vscode/vsce-sign-win32-arm64": "2.0.6", + "@vscode/vsce-sign-win32-x64": "2.0.6" + } + }, + "node_modules/@vscode/vsce-sign-alpine-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-arm64/-/vsce-sign-alpine-arm64-2.0.6.tgz", + "integrity": "sha512-wKkJBsvKF+f0GfsUuGT0tSW0kZL87QggEiqNqK6/8hvqsXvpx8OsTEc3mnE1kejkh5r+qUyQ7PtF8jZYN0mo8Q==", + "cpu": [ + "arm64" ], - "optional": true - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "alpine" + ] }, - "node_modules/ini": { - "version": "1.3.8", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", - "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "node_modules/@vscode/vsce-sign-alpine-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-alpine-x64/-/vsce-sign-alpine-x64-2.0.6.tgz", + "integrity": "sha512-YoAGlmdK39vKi9jA18i4ufBbd95OqGJxRvF3n6ZbCyziwy3O+JgOpIUPxv5tjeO6gQfx29qBivQ8ZZTUF2Ba0w==", + "cpu": [ + "x64" + ], "dev": true, - "optional": true + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "alpine" + ] }, - "node_modules/is-accessor-descriptor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.1.tgz", - "integrity": "sha512-YBUanLI8Yoihw923YeFUS5fs0fF2f5TSFTNiYAAzhhDscDa3lEqYuz1pDOEP5KvX94I9ey3vsqjJcLVFVU+3QA==", + "node_modules/@vscode/vsce-sign-darwin-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-arm64/-/vsce-sign-darwin-arm64-2.0.6.tgz", + "integrity": "sha512-5HMHaJRIQuozm/XQIiJiA0W9uhdblwwl2ZNDSSAeXGO9YhB9MH5C4KIHOmvyjUnKy4UCuiP43VKpIxW1VWP4tQ==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "hasown": "^2.0.0" - }, - "engines": { - "node": ">= 0.10" - } + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "darwin" + ] }, - "node_modules/is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha512-9fRVlXc0uCxEDj1nQzaWONSpbTfx0FmJfzHF7pwlI8DkWGoHBBea4Pg5Ky0ojwwxQmnSifgbKkI06Qv0Ljgj+Q==", + "node_modules/@vscode/vsce-sign-darwin-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-darwin-x64/-/vsce-sign-darwin-x64-2.0.6.tgz", + "integrity": "sha512-25GsUbTAiNfHSuRItoQafXOIpxlYj+IXb4/qarrXu7kmbH94jlm5sdWSCKrrREs8+GsXF1b+l3OB7VJy5jsykw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "binary-extensions": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" - } + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "darwin" + ] }, - "node_modules/is-buffer": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz", - "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==", - "dev": true + "node_modules/@vscode/vsce-sign-linux-arm": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm/-/vsce-sign-linux-arm-2.0.6.tgz", + "integrity": "sha512-UndEc2Xlq4HsuMPnwu7420uqceXjs4yb5W8E2/UkaHBB9OWCwMd3/bRe/1eLe3D8kPpxzcaeTyXiK3RdzS/1CA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-core-module": { - "version": "2.13.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", - "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", + "node_modules/@vscode/vsce-sign-linux-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-arm64/-/vsce-sign-linux-arm64-2.0.6.tgz", + "integrity": "sha512-cfb1qK7lygtMa4NUl2582nP7aliLYuDEVpAbXJMkDq1qE+olIw/es+C8j1LJwvcRq1I2yWGtSn3EkDp9Dq5FdA==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "hasown": "^2.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-data-descriptor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.1.tgz", - "integrity": "sha512-bc4NlCDiCr28U4aEsQ3Qs2491gVq4V8G7MQyws968ImqjKuYtTJXrl7Vq7jsN7Ly/C3xj5KWFrY7sHNeDkAzXw==", + "node_modules/@vscode/vsce-sign-linux-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-linux-x64/-/vsce-sign-linux-x64-2.0.6.tgz", + "integrity": "sha512-/olerl1A4sOqdP+hjvJ1sbQjKN07Y3DVnxO4gnbn/ahtQvFrdhUi0G1VsZXDNjfqmXw57DmPi5ASnj/8PGZhAA==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "hasown": "^2.0.0" - }, - "engines": { - "node": ">= 0.4" - } + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "linux" + ] }, - "node_modules/is-descriptor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.3.tgz", - "integrity": "sha512-JCNNGbwWZEVaSPtS45mdtrneRWJFp07LLmykxeFV5F6oBvNF8vHSfJuJgoT472pSfk+Mf8VnlrspaFBHWM8JAw==", + "node_modules/@vscode/vsce-sign-win32-arm64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-arm64/-/vsce-sign-win32-arm64-2.0.6.tgz", + "integrity": "sha512-ivM/MiGIY0PJNZBoGtlRBM/xDpwbdlCWomUWuLmIxbi1Cxe/1nooYrEQoaHD8ojVRgzdQEUzMsRbyF5cJJgYOg==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "is-accessor-descriptor": "^1.0.1", - "is-data-descriptor": "^1.0.1" - }, - "engines": { - "node": ">= 0.4" - } + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha512-9YclgOGtN/f8zx0Pr4FQYMdibBiTaH3sn52vjYip4ZSf6C4/6RfTEZ+MR4GvKhCxdPh21Bg42/WL55f6KSnKpg==", + "node_modules/@vscode/vsce-sign-win32-x64": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@vscode/vsce-sign-win32-x64/-/vsce-sign-win32-x64-2.0.6.tgz", + "integrity": "sha512-mgth9Kvze+u8CruYMmhHw6Zgy3GRX2S+Ed5oSokDEK5vPEwGGKnmuXua9tmFhomeAnhgJnL4DCna3TiNuGrBTQ==", + "cpu": [ + "x64" + ], "dev": true, - "engines": { - "node": ">=0.10.0" - } + "license": "SEE LICENSE IN LICENSE.txt", + "optional": true, + "os": [ + "win32" + ] }, - "node_modules/is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha512-0EygVC5qPvIyb+gSz7zdD5/AAoS6Qrx1e//6N4yv4oNm30kqvdmG66oZFWVlQHUWe5OjP08FuTw2IdT0EOTcYA==", + "node_modules/acorn": { + "version": "8.19.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.19.0.tgz", + "integrity": "sha512-oJlA3XiRm7Cyk6qFD2Jn8ak9B7jSy0qy00ADO3+8dpT0LSjFihQYv4C02LFCSYJV3Q37xYwwRy5m+IpIiUzqWw==", "dev": true, - "dependencies": { - "is-primitive": "^2.0.0" + "license": "MIT", + "bin": { + "acorn": "bin/acorn" }, "engines": { - "node": ">=0.10.0" + "node": ">=0.4.0" } }, - "node_modules/is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha512-5BMULNob1vgFX6EjQw5izWDxrecWK9AM72rugNr0TFldMOi0fj6Jk+zeKIt0xGj4cEfQIJth4w3OKWOJ4f+AFw==", + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", "dev": true, - "engines": { - "node": ">=0.10.0" + "license": "MIT", + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" } }, - "node_modules/is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha512-7Q+VbVafe6x2T+Tu6NcOf6sRklazEPmBoB3IWk3WdGZM2iGUwU/Oe3Wtq5lSEkDTTlpp8yx+5t4pzO/i9Ty1ww==", + "node_modules/agent-base": { + "version": "7.1.4", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", + "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 14" } }, - "node_modules/is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha512-a1dBeB19NXsf/E0+FHqkagizel/LQw2DjSQpvQrj3zT+jYPpaUCryPnrQajXKFLCMuf4I6FhRpaGtw4lPrG6Eg==", + "node_modules/ajv": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz", + "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==", "dev": true, + "license": "MIT", "dependencies": { - "is-extglob": "^1.0.0" + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" } }, - "node_modules/is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha512-QUzH43Gfb9+5yckcrSA0VBDwEtDUchrk4F6tfJZQuNzDJbEDB9cZNzSfXGQ1jqmdDY/kl41lUOWM9syA8z8jlg==", + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=12" } }, - "node_modules/is-object": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-object/-/is-object-1.0.2.tgz", - "integrity": "sha512-2rRIahhZr2UWb45fIOuvZGpFtz0TyOZLf32KxBbSoUCeZR495zCKlWUKKUByk3geS2eAs7ZAABt0Y/Rx0GiQGA==", - "dev": true, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "node_modules/azure-devops-node-api": { + "version": "12.5.0", + "resolved": "https://registry.npmjs.org/azure-devops-node-api/-/azure-devops-node-api-12.5.0.tgz", + "integrity": "sha512-R5eFskGvOm3U/GzeAuxRkUsAl0hrAwGgWn6zAd2KrZmrEhWZVqLew4OOupbQlXUuojUzpGtq62SmdhJ06N88og==", "dev": true, + "license": "MIT", "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" + "tunnel": "0.0.6", + "typed-rest-client": "^1.8.4" } }, - "node_modules/is-plain-object/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/balanced-match": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz", + "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": "18 || 20 || >=22" } }, - "node_modules/is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha512-Yu68oeXJ7LeWNmZ3Zov/xg/oDBnBK2RNxwYY1ilNJX+tKKZqgPK+qOn/Gs9jEu66KDY9Netf5XLKNGzas/vPfQ==", + "node_modules/binaryextensions": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/binaryextensions/-/binaryextensions-6.11.0.tgz", + "integrity": "sha512-sXnYK/Ij80TO3lcqZVV2YgfKN5QjUWIRk/XSm2J/4bd/lPko3lvk0O4ZppH6m+6hB2/GTu+ptNwVFe1xh+QLQw==", "dev": true, + "license": "Artistic-2.0", + "dependencies": { + "editions": "^6.21.0" + }, "engines": { - "node": ">=0.10.0" + "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/is-primitive": { + "node_modules/boundary": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha512-N3w1tFaRfk3UrPfqeRyD+GYDASU3W5VinKhlORy8EWVf/sIdDL9GAcew85XmktCfH+ngG7SRXEVDoO18WMdB/Q==", + "resolved": "https://registry.npmjs.org/boundary/-/boundary-2.0.0.tgz", + "integrity": "sha512-rJKn5ooC9u8q13IMCrW0RSp31pxBCHE3y9V/tp3TdWSLf8Em3p6Di4NBpfzbJge9YjjFEsD0RtFEjtvHL5VyEA==", "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-typedarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha512-cyA56iCMHAh5CdzjJIa4aohJyeO1YbwLi3Jc35MmRU6poroFjIGZzUzupGiRPOjgHg9TLu43xbpwXk523fMxKA==" + "license": "BSD-2-Clause" }, - "node_modules/is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", + "node_modules/brace-expansion": { + "version": "5.0.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.12.tgz", + "integrity": "sha512-YovQ3rzhaLMIrDjNDMkNS01tea93qhEhG5xy8f6+R0l+dw3Ki+5sCoIoI942iuLZTHWogWktgwVDhU09iNEimQ==", "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^4.0.2" + }, "engines": { - "node": ">=0.10.0" + "node": "20 || >=22" } }, - "node_modules/isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==", - "dev": true - }, - "node_modules/isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA==", + "node_modules/buffer-crc32": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz", + "integrity": "sha512-VO9Ht/+p3SN7SKWqcrgEzjGbRSJYTx+Q1pTQC0wrWqHx0vpJraQ6GtHx8tvcg1rlK1byhU5gccxgOgj7B0TDkQ==", "dev": true, - "dependencies": { - "isarray": "1.0.0" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": "*" } }, - "node_modules/isstream": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==" - }, - "node_modules/jsbn": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha512-UVU9dibq2JcFWxQPA6KCqj5O42VOmAY3zQUfEKxU0KpTGXwNoCjkX1e13eHNvw/xPynt6pU0rZ1htjWTNTSXsg==" - }, - "node_modules/json-schema": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", - "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==" - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" - }, - "node_modules/json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "dev": true, + "license": "BSD-3-Clause" }, - "node_modules/jsonc-parser": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", - "integrity": "sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==", - "dev": true - }, - "node_modules/jsprim": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz", - "integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==", + "node_modules/bundle-name": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.1.tgz", + "integrity": "sha512-DdH81/zPLVS11EUgWq3tEu/xn+EzljlMYooDNdzWEnFha3R3NBMpMV1UqYIpjYHV/SgpFKMIX1Oh7o06SjM/oA==", + "dev": true, + "license": "MIT", "dependencies": { - "assert-plus": "1.0.0", - "extsprintf": "1.3.0", - "json-schema": "0.4.0", - "verror": "1.10.0" + "run-applescript": "^7.0.0" }, "engines": { - "node": ">=0.6.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/just-extend": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/just-extend/-/just-extend-4.2.1.tgz", - "integrity": "sha512-g3UB796vUFIY90VIv/WX3L2c8CS2MdWUww3CNrYmqza1Fg0DURc2K/O4YrnklBdQarSJ/y8JnJYDGc+1iumQjg==", - "dev": true - }, - "node_modules/keytar": { - "version": "7.9.0", - "resolved": "https://registry.npmjs.org/keytar/-/keytar-7.9.0.tgz", - "integrity": "sha512-VPD8mtVtm5JNtA2AErl6Chp06JBfy7diFQ7TQQhdpWOl6MrCRB+eRbvAZUsbGQS9kiMq0coJsy0W0vHpDCkWsQ==", + "node_modules/cacheable": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/cacheable/-/cacheable-2.5.0.tgz", + "integrity": "sha512-60cyAOytib/OzBw1JNSoSV/boK1AtHryDIjvVBk7XbN4ugfkM3+Sry7fEjNgPMGgOjuaZPAp8ruZ0Cxafwyq9g==", "dev": true, - "hasInstallScript": true, - "optional": true, + "license": "MIT", "dependencies": { - "node-addon-api": "^4.3.0", - "prebuild-install": "^7.0.1" + "@cacheable/memory": "^2.2.0", + "@cacheable/utils": "^2.5.0", + "hookified": "^1.15.0", + "keyv": "^5.6.0", + "qified": "^0.10.1" } }, - "node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", "dev": true, + "license": "MIT", "dependencies": { - "is-buffer": "^1.1.5" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, - "node_modules/leven": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", - "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", "dev": true, + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, "engines": { - "node": ">=6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/linkify-it": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-3.0.3.tgz", - "integrity": "sha512-ynTsyrFSdE5oZ/O9GEf00kPngmOfVwazR5GKDq6EYfhlpFug3J2zybX56a2PRRpc9P+FuSoGNAwjlbDs9jJBPQ==", + "node_modules/chai": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-6.3.0.tgz", + "integrity": "sha512-XWAtwJ6OHO+tj0EKCs0Y2UamnyOxseZWltU4x2U2wh8g4AigdjwvtUjvLP2tqkA/avxHEtzxNaqGq/YGNwckKg==", "dev": true, - "dependencies": { - "uc.micro": "^1.0.1" + "license": "MIT", + "engines": { + "node": ">=18" } }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==" - }, - "node_modules/lolex": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-4.2.0.tgz", - "integrity": "sha512-gKO5uExCXvSm6zbF562EvM+rd1kQDnB9AZBbiQVzf1ZmdDpxUSvpnAaVOP83N/31mRK8Ml8/VE8DMvsAZQ+7wg==", - "dev": true - }, - "node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", - "dependencies": { - "yallist": "^4.0.0" - }, + "node_modules/cockatiel": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/cockatiel/-/cockatiel-3.2.1.tgz", + "integrity": "sha512-gfrHV6ZPkquExvMh9IOkKsBzNDk6sDuZ6DdBGUBkvFnTCqCxzpuq48RySgP0AnaqQkw2zynOFj9yly6T1Q2G5Q==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=10" + "node": ">=16" } }, - "node_modules/map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha512-8y/eV9QQZCiyn1SprXSrCmqJN0yNRATe+PO8ztwqrvrbdRLA3eYJF0yaR0YayLWkMbsQSKWS9N2gPcGEc4UsZg==", + "node_modules/commander": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", + "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=18" } }, - "node_modules/map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha512-4y7uGv8bd2WdM9vpQsiQNo41Ln1NvhvDRuVt0k2JZQ+ezN2uaQes7lZeZ+QQUHOLQAtDaBJ+7wCbi+ab/KFs+w==", + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, + "license": "MIT", "dependencies": { - "object-visit": "^1.0.0" + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" }, "engines": { - "node": ">=0.10.0" + "node": ">= 8" } }, - "node_modules/markdown-it": { - "version": "12.3.2", - "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-12.3.2.tgz", - "integrity": "sha512-TchMembfxfNVpHkbtriWltGWc+m3xszaRD0CZup7GFFhzIgQqxIfn3eGj1yZpfuflzPvfkt611B2Q/Bsk1YnGg==", + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", "dev": true, + "license": "MIT", "dependencies": { - "argparse": "^2.0.1", - "entities": "~2.1.0", - "linkify-it": "^3.0.1", - "mdurl": "^1.0.1", - "uc.micro": "^1.0.5" + "ms": "^2.1.3" }, - "bin": { - "markdown-it": "bin/markdown-it.js" + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } } }, - "node_modules/markdown-it/node_modules/entities": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-2.1.0.tgz", - "integrity": "sha512-hCx1oky9PFrJ611mf0ifBLBRW8lUUVRlFolb5gWRfIELabBlbp9xZvrqZLZAs+NxFnbfQoeGd8wDkygjg7U85w==", + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", "dev": true, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, - "node_modules/math-random": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/math-random/-/math-random-1.0.4.tgz", - "integrity": "sha512-rUxjysqif/BZQH2yhd5Aaq7vXMSx9NdEsQcyA07uEzIvxgI7zIr33gGsh+RU0/XjmQpCW7RsVof1vlkvQVCK5A==", - "dev": true - }, - "node_modules/mdurl": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", - "integrity": "sha512-/sKlQJCBYVY9Ers9hqzKou4H6V5UWc/M59TH2dvkt+84itfnq7uFOMLpOiOS4ujvHP4etln18fmIxA5R5fll0g==", - "dev": true + "license": "MIT" }, - "node_modules/merge-descriptors": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz", - "integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==", + "node_modules/default-browser": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.1.tgz", + "integrity": "sha512-m1pAzaJgZ/gssEqlOhJkPJp8Xly7QyW6xcrkUa2KKcDeDSEMP7X8xipU3snUcfisTQx0w1AGae+9UtJSfVnXGw==", "dev": true, + "license": "MIT", + "dependencies": { + "bundle-name": "^4.1.0", + "default-browser-id": "^5.0.0" + }, + "engines": { + "node": ">=18" + }, "funding": { "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha512-LnU2XFEk9xxSJ6rfgAry/ty5qwUTyHYOBU0g4R6tIw5ljwgGIBmiKhRWLw5NpMOnrgUNcDJ4WMp8rl3sYVHLNA==", + "node_modules/default-browser-id": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz", + "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==", "dev": true, - "dependencies": { - "arr-diff": "^2.0.0", - "array-unique": "^0.2.1", - "braces": "^1.8.2", - "expand-brackets": "^0.1.4", - "extglob": "^0.3.1", - "filename-regex": "^2.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.1", - "kind-of": "^3.0.2", - "normalize-path": "^2.0.1", - "object.omit": "^2.0.0", - "parse-glob": "^3.0.4", - "regex-cache": "^0.4.2" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mime": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", - "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", + "node_modules/define-lazy-prop": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz", + "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==", "dev": true, - "bin": { - "mime": "cli.js" - }, + "license": "MIT", "engines": { - "node": ">=4" + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/mime-db": { - "version": "1.52.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", - "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "peer": true, "engines": { - "node": ">= 0.6" + "node": ">=8" } }, - "node_modules/mime-types": { - "version": "2.1.35", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", - "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "dev": true, + "license": "MIT", "dependencies": { - "mime-db": "1.52.0" + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" }, "engines": { - "node": ">= 0.6" + "node": ">= 0.4" } }, - "node_modules/mimic-response": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-3.1.0.tgz", - "integrity": "sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==", + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", "dev": true, - "optional": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" } }, - "node_modules/minimatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", - "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "node_modules/editions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/editions/-/editions-6.22.0.tgz", + "integrity": "sha512-UgGlf8IW75je7HZjNDpJdCv4cGJWIi6yumFdZ0R7A8/CIhQiWUjyGLCxdHpd8bmyD1gnkfUNK0oeOXqUS2cpfQ==", "dev": true, + "license": "Artistic-2.0", "dependencies": { - "brace-expansion": "^1.1.7" + "version-range": "^4.15.0" }, "engines": { - "node": "*" + "ecmascript": ">= es5", + "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/minimist": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz", - "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==", + "node_modules/entities": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-9.0.0.tgz", + "integrity": "sha512-oJFNDJg3kTPwAD1cNn2+WmUq4wFoo09npc3Ydf1D7ED4smRiWrsKnaLxykrTWgyGEcusc87P5dxlAleol9kpkg==", "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/mixin-deep": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", - "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", "dev": true, - "dependencies": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, - "node_modules/mixin-deep/node_modules/is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", "dev": true, - "dependencies": { - "is-plain-object": "^2.0.4" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, - "node_modules/mkdirp": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.6.tgz", - "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", + "node_modules/es-module-lexer": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-2.3.2.tgz", + "integrity": "sha512-poHGpORABojJJucnV9KbOavETW8lBVnphkW77ER5/BQ5Fz7oXSoCNek7IH3vR5nRjdsEz926ibFYX8KtLQmdyw==", + "dev": true, + "license": "MIT" + }, + "node_modules/es-object-atoms": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz", + "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==", "dev": true, + "license": "MIT", "dependencies": { - "minimist": "^1.2.6" + "es-errors": "^1.3.0" }, - "bin": { - "mkdirp": "bin/cmd.js" + "engines": { + "node": ">= 0.4" } }, - "node_modules/mkdirp-classic": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz", - "integrity": "sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==", + "node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", "dev": true, - "optional": true + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } }, - "node_modules/mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", + "node_modules/eslint": { + "version": "10.14.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-10.14.0.tgz", + "integrity": "sha512-T0pNsxkb9IKmtQjhpK3d7nWOpFv+YHuMbTJnSVMoQblF0onvXfErrtp4V1jHtsQPan7dKaGVD0q1WCXnzMF31A==", "dev": true, + "license": "MIT", + "workspaces": [ + "packages/*" + ], "dependencies": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" + "@eslint-community/eslint-utils": "^4.8.0", + "@eslint-community/regexpp": "^4.12.2", + "@eslint/config-array": "^0.23.5", + "@eslint/config-helpers": "^0.7.0", + "@eslint/core": "^1.2.1", + "@eslint/plugin-kit": "^0.7.3", + "@humanfs/node": "^0.16.8", + "@humanwhocodes/module-importer": "^1.0.1", + "@humanwhocodes/retry": "^0.4.2", + "@types/estree": "^1.0.6", + "ajv": "^6.14.0", + "cross-spawn": "^7.0.6", + "debug": "^4.3.2", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^9.1.2", + "eslint-visitor-keys": "^5.0.1", + "espree": "^11.2.0", + "esquery": "^1.7.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "11.1.5 || >11.1.6 <12", + "find-up": "^5.0.0", + "glob-parent": "^6.0.2", + "ignore": "^5.2.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "minimatch": "^10.2.6", + "natural-compare": "^1.4.0", + "optionator": "^0.9.3" }, "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" + "eslint": "bin/eslint.js" }, "engines": { - "node": ">= 4.0.0" + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://eslint.org/donate" + }, + "peerDependencies": { + "jiti": "*" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + } } }, - "node_modules/mocha/node_modules/commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, - "node_modules/mocha/node_modules/glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "node_modules/eslint-config-prettier": { + "version": "10.1.8", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-10.1.8.tgz", + "integrity": "sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==", "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" + "license": "MIT", + "bin": { + "eslint-config-prettier": "bin/cli.js" }, - "engines": { - "node": "*" + "funding": { + "url": "https://opencollective.com/eslint-config-prettier" + }, + "peerDependencies": { + "eslint": ">=7.0.0" } }, - "node_modules/mocha/node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "node_modules/eslint-scope": { + "version": "9.1.2", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-9.1.2.tgz", + "integrity": "sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "brace-expansion": "^1.1.7" + "@types/esrecurse": "^4.3.1", + "@types/estree": "^1.0.8", + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" }, "engines": { - "node": "*" + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/mocha/node_modules/minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha512-miQKw5Hv4NS1Psg2517mV4e4dYNaO3++hjAvLOAzKqZ61rH8NS1SK+vbfBWZ5PY/Me/bEWhUwqMghEW5Fb9T7Q==", - "dev": true - }, - "node_modules/mocha/node_modules/mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==", - "deprecated": "Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)", + "node_modules/eslint-visitor-keys": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz", + "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==", "dev": true, - "dependencies": { - "minimist": "0.0.8" + "license": "Apache-2.0", + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24" }, - "bin": { - "mkdirp": "bin/cmd.js" + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/mocha/node_modules/supports-color": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", - "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "node_modules/espree": { + "version": "11.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-11.2.0.tgz", + "integrity": "sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "has-flag": "^3.0.0" + "acorn": "^8.16.0", + "acorn-jsx": "^5.3.2", + "eslint-visitor-keys": "^5.0.1" }, "engines": { - "node": ">=4" + "node": "^20.19.0 || ^22.13.0 || >=24" + }, + "funding": { + "url": "https://opencollective.com/eslint" } }, - "node_modules/module-not-found-error": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/module-not-found-error/-/module-not-found-error-1.0.1.tgz", - "integrity": "sha512-pEk4ECWQXV6z2zjhRZUongnLJNUeGQJ3w6OQ5ctGwD+i5o93qjRQUk2Rt6VdNeu3sEP0AB4LcfvdebpxBRVr4g==", - "dev": true - }, - "node_modules/ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", - "dev": true - }, - "node_modules/mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, - "node_modules/nan": { - "version": "2.18.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.18.0.tgz", - "integrity": "sha512-W7tfG7vMOGtD30sHoZSSc/JVYiyDPEyQVso/Zz+/uQd0B0L46gtC+pHha5FFMRpil6fm/AoEcRWyOVi4+E/f8w==", + "node_modules/esquery": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz", + "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==", "dev": true, - "optional": true + "license": "BSD-3-Clause", + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } }, - "node_modules/nanomatch": { - "version": "1.2.13", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", - "integrity": "sha512-fpoe2T0RbHwBTBUOftAfBPaDEi06ufaUai0mE6Yn1kacc3SnTErfb/h+X94VXzI64rKFHYImXSvdwGGCmwOqCA==", + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" + "estraverse": "^5.2.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=4.0" } }, - "node_modules/nanomatch/node_modules/arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==", + "node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", "dev": true, + "license": "BSD-2-Clause", "engines": { - "node": ">=0.10.0" + "node": ">=4.0" } }, - "node_modules/nanomatch/node_modules/array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==", + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", "dev": true, - "engines": { - "node": ">=0.10.0" + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" } }, - "node_modules/nanomatch/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", "dev": true, + "license": "BSD-2-Clause", "engines": { "node": ">=0.10.0" } }, - "node_modules/napi-build-utils": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/napi-build-utils/-/napi-build-utils-1.0.2.tgz", - "integrity": "sha512-ONmRUqK7zj7DWX0D9ADe03wbwOBZxNAfF20PlGfCWQcD3+/MakShIHrMqx9YwPTfxDdF1zLeL+RGZiR9kGMLdg==", - "dev": true, - "optional": true - }, - "node_modules/nise": { - "version": "1.5.3", - "resolved": "https://registry.npmjs.org/nise/-/nise-1.5.3.tgz", - "integrity": "sha512-Ymbac/94xeIrMf59REBPOv0thr+CJVFMhrlAkW/gjCIE58BGQdCj0x7KRCb3yz+Ga2Rz3E9XXSvUyyxqqhjQAQ==", + "node_modules/expect-type": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.4.0.tgz", + "integrity": "sha512-KfYbmpRm0VbLjEvVa9yGwCi9GI34xvi7A/HXYWQO65CSD2u3MczUJSuwXKFIxlGsgBQizV9q5J9NHj4VG0n+pA==", "dev": true, - "dependencies": { - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/text-encoding": "^0.7.1", - "just-extend": "^4.0.2", - "lolex": "^5.0.1", - "path-to-regexp": "^1.7.0" + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" } }, - "node_modules/nise/node_modules/lolex": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/lolex/-/lolex-5.1.2.tgz", - "integrity": "sha512-h4hmjAvHTmd+25JSwrtTIuwbKdwg5NzZVRMLn9saij4SZaepCrTCxPr35H/3bjwfMJtN+t3CX8672UIkglz28A==", + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", "dev": true, - "dependencies": { - "@sinonjs/commons": "^1.7.0" - } + "license": "MIT" }, - "node_modules/node-abi": { - "version": "3.54.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.54.0.tgz", - "integrity": "sha512-p7eGEiQil0YUV3ItH4/tBb781L5impVmmx2E9FRKF7d18XXzp4PGT2tdYMFY6wQqgxD0IwNZOiSJ0/K0fSi/OA==", + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", "dev": true, - "optional": true, - "dependencies": { - "semver": "^7.3.5" - }, - "engines": { - "node": ">=10" - } + "license": "MIT" }, - "node_modules/node-addon-api": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-4.3.0.tgz", - "integrity": "sha512-73sE9+3UaLYYFmDsFZnqCInzPyh3MqIwZO9cw58yIqAZhONrrabrYyYe3TuIqtIiOuTXVhsGau8hcrhhwSsDIQ==", + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==", "dev": true, - "optional": true + "license": "MIT" }, - "node_modules/normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha512-3pKJwH184Xo/lnH6oyP1q2pMd7HcypqqmRs91/6/i2CGtWwIKGCkOOMTm/zXbgTEWHw1uNpNi/igc3ePOYHb6w==", + "node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "dev": true, - "dependencies": { - "remove-trailing-separator": "^1.0.1" + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" }, - "engines": { - "node": ">=0.10.0" + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } } }, - "node_modules/nth-check": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz", - "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==", + "node_modules/file-entry-cache": { + "version": "11.1.5", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-11.1.5.tgz", + "integrity": "sha512-+PFTHITI08JIGhnNpGNI8T8inUpgZfk3GNEqfT9R2zZV2iFXg3CvqzSl/uEhs7TSGujYRELEANyDvS8Fj7+S7Q==", "dev": true, + "license": "MIT", "dependencies": { - "boolbase": "^1.0.0" - }, - "funding": { - "url": "https://github.com/fb55/nth-check?sponsor=1" - } - }, - "node_modules/oauth-sign": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz", - "integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==", - "engines": { - "node": "*" + "flat-cache": "^6.1.23" } }, - "node_modules/object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha512-79LYn6VAb63zgtmAteVOWo9Vdj71ZVBy3Pbse+VqxDpEP83XuujMrGqHIwAXJ5I/aM0zU7dIyIAhifVTPrNItQ==", + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", "dev": true, + "license": "MIT", "dependencies": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/object-copy/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==", + "node_modules/flat-cache": { + "version": "6.1.23", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-6.1.23.tgz", + "integrity": "sha512-f++BY9pTk+983xK1FLzlLpmM0i0z+jHmx3QESGkURMXujQZz1k5wzwX6hjnQ8goaD0B+sYnDK1yZ6MTyZfUaqA==", "dev": true, + "license": "MIT", "dependencies": { - "is-descriptor": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" + "cacheable": "^2.5.0", + "flatted": "^3.4.2", + "hookified": "^1.15.0" } }, - "node_modules/object-copy/node_modules/is-descriptor": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz", - "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==", + "node_modules/flatted": { + "version": "3.4.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.4.tgz", + "integrity": "sha512-5+ybhBZANEJxaH3X5evAFatUxLfEHSr7n6kYJ+1Qd0mUqr4eu9gIf6GDbWHf8RJijHrjjO8G+la14SlL2SeS1Q==", "dev": true, - "dependencies": { - "is-accessor-descriptor": "^1.0.1", - "is-data-descriptor": "^1.0.1" - }, + "license": "ISC" + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, "engines": { - "node": ">= 0.4" + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/object-inspect": { - "version": "1.13.1", - "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz", - "integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==", + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", "dev": true, + "license": "MIT", "funding": { "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha512-GBaMwwAVK9qbQN3Scdo0OyvgPW7l3lnaVMj84uTOZlswkX0KpF6fyDBJhtTthf7pymztoN36/KEr1DyhF96zEA==", + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", "dev": true, + "license": "MIT", "dependencies": { - "isobject": "^3.0.0" + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/object-visit/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", - "dev": true, - "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha512-UiAM5mhmIuKLsOvrL+B0U2d1hXHF3bFYWIuH1LMpuV2EJEHG1Ntz06PgLEHjm6VFd87NpH8rastvPoyv6UW2fA==", + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", "dev": true, + "license": "MIT", "dependencies": { - "for-own": "^0.1.4", - "is-extendable": "^0.1.1" + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.4" } }, - "node_modules/object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", "dev": true, + "license": "ISC", "dependencies": { - "isobject": "^3.0.1" + "is-glob": "^4.0.3" }, "engines": { - "node": ">=0.10.0" + "node": ">=10.13.0" } }, - "node_modules/object.pick/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/globals": { + "version": "17.14.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-17.14.0.tgz", + "integrity": "sha512-UtdkTVyAJePQv0J2M9Xe4L0ruNSDV314XiIJsADI2Zf40bcdAonE/D/OhAU8AT99oij9mhLByb+NvA3QWZYgCg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha512-FC5TeK0AwXzq3tUBFtH74naWkPQCEWs4K+xMxWZBlKDWu0bVHXGZa+KKqxKidd7xwhdZ19ZNuF2uO1M/r196HA==", - "dev": true, - "dependencies": { - "glob-base": "^0.3.0", - "is-dotfile": "^1.0.0", - "is-extglob": "^1.0.0", - "is-glob": "^2.0.0" + "node": ">=18" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/parse-semver": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/parse-semver/-/parse-semver-1.1.1.tgz", - "integrity": "sha512-Eg1OuNntBMH0ojvEKSrvDSnwLmvVuUOSdylH/pSCPNMIspLlweJyIWXCE+k/5hm3cj/EBUYwmWkjhBALNP4LXQ==", + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", "dev": true, - "dependencies": { - "semver": "^5.1.0" + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/parse-semver/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", + "node_modules/graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true, - "bin": { - "semver": "bin/semver" - } + "license": "ISC" }, - "node_modules/parse5": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", - "integrity": "sha512-Czj1WaSVpaoj0wbhMzLmWD69anp2WH7FXMB9n1Sy8/ZFF9jolSQVMu1Ij5WIyGmcBmhk7EOndpO4mIpihVqAXw==", + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", "dev": true, - "dependencies": { - "entities": "^4.4.0" + "license": "MIT", + "engines": { + "node": ">= 0.4" }, "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/parse5-htmlparser2-tree-adapter": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-7.0.0.tgz", - "integrity": "sha512-B77tOZrqqfUfnVcOrUvfdLbz4pu4RopLD/4vmu3HUPswwTA8OH0EMW9BlWR2B0RCoiZRAHEUu7IxeP1Pd1UU+g==", + "node_modules/hashery": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/hashery/-/hashery-1.5.1.tgz", + "integrity": "sha512-iZyKG96/JwPz1N55vj2Ie2vXbhu440zfUfJvSwEqEbeLluk7NnapfGqa7LH0mOsnDxTF85Mx8/dyR6HfqcbmbQ==", "dev": true, + "license": "MIT", "dependencies": { - "domhandler": "^5.0.2", - "parse5": "^7.0.0" + "hookified": "^1.15.0" }, - "funding": { - "url": "https://github.com/inikulin/parse5?sponsor=1" - } - }, - "node_modules/pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha512-XHXfu/yOQRy9vYOtUDVMN60OEJjW013GoObG1o+xwQTpB9eYJX/BjXMsdW13ZDPruFhYYn0AG22w0xgQMwl3Nw==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", - "dev": true, "engines": { - "node": ">=0.10.0" + "node": ">=20" } }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/path-to-regexp": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-1.8.0.tgz", - "integrity": "sha512-n43JRhlUKUAlibEJhPeir1ncUID16QnEjNpwzNdO3Lm4ywrBpBZ5oLD0I6br9evr1Y9JTqwRtAh7JLoOzAQdVA==", + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", "dev": true, + "license": "MIT", "dependencies": { - "isarray": "0.0.1" + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" } }, - "node_modules/path-to-regexp/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==", - "dev": true - }, - "node_modules/pend": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", - "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", - "dev": true - }, - "node_modules/performance-now": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", - "integrity": "sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==" - }, - "node_modules/posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha512-xTgYBc3fuo7Yt7JbiuFxSYGToMoz8fLoE6TC9Wx1P/u+LfeThMOAqmuyECnlBaaJb+u1m9hHiXUEtwW4OzfUJg==", + "node_modules/hookified": { + "version": "1.15.1", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-1.15.1.tgz", + "integrity": "sha512-MvG/clsADq1GPM2KGo2nyfaWVyn9naPiXrqIe4jYjXNZQt238kWyOGrsyc/DmRAQ+Re6yeo6yX/yoNCG5KAEVg==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/prebuild-install": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/prebuild-install/-/prebuild-install-7.1.1.tgz", - "integrity": "sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==", + "node_modules/hosted-git-info": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", + "integrity": "sha512-kyCuEOWjJqZuDbRHzL8V93NzQhwIB71oFWSyzVo+KPZI+pnQPPxucdkrOZvkLRnrf5URsQM+IJ09Dw29cRALIA==", "dev": true, - "optional": true, + "license": "ISC", "dependencies": { - "detect-libc": "^2.0.0", - "expand-template": "^2.0.3", - "github-from-package": "0.0.0", - "minimist": "^1.2.3", - "mkdirp-classic": "^0.5.3", - "napi-build-utils": "^1.0.1", - "node-abi": "^3.3.0", - "pump": "^3.0.0", - "rc": "^1.2.7", - "simple-get": "^4.0.0", - "tar-fs": "^2.0.0", - "tunnel-agent": "^0.6.0" - }, - "bin": { - "prebuild-install": "bin.js" + "lru-cache": "^6.0.0" }, "engines": { "node": ">=10" } }, - "node_modules/preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha512-s/46sYeylUfHNjI+sA/78FAHlmIuKqI9wNnzEOGehAlUUYeObv5C2mOinXBjyUyWmJ2SfcS2/ydApH4hTF4WXQ==", + "node_modules/http-proxy-agent": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz", + "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==", "dev": true, + "license": "MIT", + "dependencies": { + "agent-base": "^7.1.0", + "debug": "^4.3.4" + }, "engines": { - "node": ">=0.10.0" + "node": ">= 14" } }, - "node_modules/prettier": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz", - "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==", + "node_modules/https-proxy-agent": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", + "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==", "dev": true, "license": "MIT", - "bin": { - "prettier": "bin/prettier.cjs" + "dependencies": { + "agent-base": "^7.1.2", + "debug": "4" }, "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/prettier/prettier?sponsor=1" + "node": ">= 14" } }, - "node_modules/process-nextick-args": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", - "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==", - "dev": true - }, - "node_modules/proxyquire": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/proxyquire/-/proxyquire-2.1.3.tgz", - "integrity": "sha512-BQWfCqYM+QINd+yawJz23tbBM40VIGXOdDw3X344KcclI/gtBbdWF6SlQ4nK/bYhF9d27KYug9WzljHC6B9Ysg==", + "node_modules/ignore": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz", + "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==", "dev": true, - "dependencies": { - "fill-keys": "^1.0.2", - "module-not-found-error": "^1.0.1", - "resolve": "^1.11.1" + "license": "MIT", + "engines": { + "node": ">= 4" } }, - "node_modules/psl": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/psl/-/psl-1.9.0.tgz", - "integrity": "sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==" - }, - "node_modules/pump": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", - "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", "dev": true, - "optional": true, - "dependencies": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "node_modules/punycode": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", - "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "license": "MIT", "engines": { - "node": ">=6" + "node": ">=0.8.19" } }, - "node_modules/qs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", - "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "node_modules/is-docker": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz", + "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==", "dev": true, - "dependencies": { - "side-channel": "^1.0.4" + "license": "MIT", + "bin": { + "is-docker": "cli.js" }, "engines": { - "node": ">=0.6" + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/randomatic": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", - "integrity": "sha512-TuDE5KxZ0J461RVjrJZCJc+J+zCkTb1MbH9AQUq68sMhOMcy9jLcb3BrZKgp9q9Ncltdg4QVqWrH02W2EFFVYw==", + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", "dev": true, - "dependencies": { - "is-number": "^4.0.0", - "kind-of": "^6.0.0", - "math-random": "^1.0.1" - }, + "license": "MIT", "engines": { - "node": ">= 0.10.0" + "node": ">=0.10.0" } }, - "node_modules/randomatic/node_modules/is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, "engines": { "node": ">=0.10.0" } }, - "node_modules/randomatic/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "node_modules/is-in-ssh": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-in-ssh/-/is-in-ssh-1.0.0.tgz", + "integrity": "sha512-jYa6Q9rH90kR1vKB6NM7qqd1mge3Fx4Dhw5TVlK1MUBqhEOuCagrEHMevNuCcbECmXZ0ThXkRm+Ymr51HwEPAw==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", + "node_modules/is-inside-container": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz", + "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" + "is-docker": "^3.0.0" }, "bin": { - "rc": "cli.js" - } - }, - "node_modules/rc/node_modules/strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==", - "dev": true, - "optional": true, + "is-inside-container": "cli.js" + }, "engines": { - "node": ">=0.10.0" + "node": ">=14.16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/read": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", - "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "node_modules/is-wsl": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz", + "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==", "dev": true, + "license": "MIT", "dependencies": { - "mute-stream": "~0.0.4" + "is-inside-container": "^1.0.0" }, "engines": { - "node": ">=0.8" + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/readable-stream": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz", - "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==", + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true, - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "node_modules/readable-stream/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/readdirp": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.2.1.tgz", - "integrity": "sha512-1JU/8q+VgFZyxwrJ+SVIOsh+KywWGpds3NTqikiKpDMZWScmAYyKIgqkO+ARvNWJfXeXR1zxz7aHF4u4CyH6vQ==", + "license": "ISC" + }, + "node_modules/istextorbinary": { + "version": "9.5.0", + "resolved": "https://registry.npmjs.org/istextorbinary/-/istextorbinary-9.5.0.tgz", + "integrity": "sha512-5mbUj3SiZXCuRf9fT3ibzbSSEWiy63gFfksmGfdOzujPjW3k+z8WvIBxcJHBoQNlaZaiyB25deviif2+osLmLw==", "dev": true, + "license": "Artistic-2.0", "dependencies": { - "graceful-fs": "^4.1.11", - "micromatch": "^3.1.10", - "readable-stream": "^2.0.2" + "binaryextensions": "^6.11.0", + "editions": "^6.21.0", + "textextensions": "^6.11.0" }, "engines": { - "node": ">=0.10" + "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/readdirp/node_modules/arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha512-YVIQ82gZPGBebQV/a8dar4AitzCQs0jjXwMPZllpXMaGjXPYVUawSxQrRsjhjupyVxEvbHgUmIhKVlND+j02kA==", + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/readdirp/node_modules/array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha512-SleRWjh9JUud2wH1hPs9rZBZ33H6T9HOiL0uwGnGx9FpE6wKGyfWugmbkEOIs6qWrZhg0LWeLziLrEwQJhs5mQ==", + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" + }, + "node_modules/jsonc-parser": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.3.1.tgz", + "integrity": "sha512-HUgH65KyejrUFPvHFPbqOY0rsFip3Bo5wb4ngvdi1EpCYWUQDC5V+Y7mZws+DLkr4M//zQJoanu1SP+87Dv1oQ==", + "dev": true, + "license": "MIT" }, - "node_modules/readdirp/node_modules/braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", "dev": true, + "license": "MIT", "dependencies": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" }, "engines": { - "node": ">=0.10.0" + "node": ">=12", + "npm": ">=6" } }, - "node_modules/readdirp/node_modules/braces/node_modules/extend-shallow": { + "node_modules/jwa": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", "dev": true, + "license": "MIT", "dependencies": { - "is-extendable": "^0.1.0" - }, - "engines": { - "node": ">=0.10.0" + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" } }, - "node_modules/readdirp/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", "dev": true, + "license": "MIT", "dependencies": { - "ms": "2.0.0" + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" } }, - "node_modules/readdirp/node_modules/expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha512-w/ozOKR9Obk3qoWeY/WDi6MFta9AoMR+zud60mdnbniMcBxRuFJyDt2LdX/14A1UABeqk+Uk+LDfUpvoGKppZA==", + "node_modules/keyv": { + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/keyv/-/keyv-5.6.0.tgz", + "integrity": "sha512-CYDD3SOtsHtyXeEORYRx2qBtpDJFjRTGXUtmNEMGyzYOKj1TE3tycdlho7kA1Ufx9OYWZzg52QFBGALTirzDSw==", "dev": true, + "license": "MIT", "dependencies": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" + "@keyv/serialize": "^1.1.1" } }, - "node_modules/readdirp/node_modules/expand-brackets/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==", + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", "dev": true, + "license": "MIT", "dependencies": { - "is-descriptor": "^0.1.0" + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" }, "engines": { - "node": ">=0.10.0" + "node": ">= 0.8.0" } }, - "node_modules/readdirp/node_modules/expand-brackets/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", + "node_modules/lightningcss": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.33.0.tgz", + "integrity": "sha512-WkUDrojuJs0xkgGf2udWxa3yGBRxPtxUkB79i6aCZLRgc7PM8fZe9TosfPDcvEpQZbuFASnHYmRLBLUbmLOIIA==", "dev": true, + "license": "MPL-2.0", + "peer": true, "dependencies": { - "is-extendable": "^0.1.0" + "detect-libc": "^2.0.3" }, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" + }, + "optionalDependencies": { + "lightningcss-android-arm64": "1.33.0", + "lightningcss-darwin-arm64": "1.33.0", + "lightningcss-darwin-x64": "1.33.0", + "lightningcss-freebsd-x64": "1.33.0", + "lightningcss-linux-arm-gnueabihf": "1.33.0", + "lightningcss-linux-arm64-gnu": "1.33.0", + "lightningcss-linux-arm64-musl": "1.33.0", + "lightningcss-linux-x64-gnu": "1.33.0", + "lightningcss-linux-x64-musl": "1.33.0", + "lightningcss-win32-arm64-msvc": "1.33.0", + "lightningcss-win32-x64-msvc": "1.33.0" + } + }, + "node_modules/lightningcss-android-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-android-arm64/-/lightningcss-android-arm64-1.33.0.tgz", + "integrity": "sha512-gEpRTalKdosp4Bb8qWtc2iOgE5SeIHlpS1up9bFq2wAyYhl1UdTObYiHe98zEM9SQvSoqQZ1IQD0JNpg3Ml5pg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "android" + ], + "peer": true, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/expand-brackets/node_modules/is-descriptor": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz", - "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==", + "node_modules/lightningcss-darwin-arm64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-arm64/-/lightningcss-darwin-arm64-1.33.0.tgz", + "integrity": "sha512-Sciaz8eenNTKn9b3t7+xr0ipTp9YxKQY4npwQ3mrRuL0BAVHBLyZxofhaKBAVtzmtRZ/zTyo0/to4B1uWG/Djg==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "is-accessor-descriptor": "^1.0.1", - "is-data-descriptor": "^1.0.1" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, "engines": { - "node": ">= 0.4" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", + "node_modules/lightningcss-darwin-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-darwin-x64/-/lightningcss-darwin-x64-1.33.0.tgz", + "integrity": "sha512-Z5UPAxzrjlWNNyGy6i65cJzzvgJ5D3T6wMvs+gWpY9d7qRhANrxqAp6LhxIgZhWEw18RfJTGcRxjuLIBr+m8XQ==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "darwin" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/extglob/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA==", + "node_modules/lightningcss-freebsd-x64": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-freebsd-x64/-/lightningcss-freebsd-x64-1.33.0.tgz", + "integrity": "sha512-QQM/Ti/hQajJwCY+RiWuCZ9sdtI/XQk7nDK5vC8kkdwixezOlDgvDx7+RT+QjK6FcFT4MpsuoBnHIo/O3StRRg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "is-descriptor": "^1.0.0" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/extglob/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", + "node_modules/lightningcss-linux-arm-gnueabihf": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm-gnueabihf/-/lightningcss-linux-arm-gnueabihf-1.33.0.tgz", + "integrity": "sha512-N7FVBe6iS24MlM6R/4RBTxGhQheZGs7tiQ9U32UtF75NzP5Q7xWPRqLBCKxlRQRk3rY1jCIPLzx7WzOhuUIRLQ==", + "cpu": [ + "arm" + ], "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha512-VcpLTWqWDiTerugjj8e3+esbg+skS3M9e54UuR3iCeIDMXCLTsAH8hTSzDQU/X6/6t3eYkOKoZSef2PlU6U1XQ==", + "node_modules/lightningcss-linux-arm64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-gnu/-/lightningcss-linux-arm64-gnu-1.33.0.tgz", + "integrity": "sha512-j2v/itmy4HlNxlc6voKXYgBqNi0Ng2LShg4z7GufpEgs05P+2suBVyi9I6YHq5uoVFx9ETin3eCEhLVyXGQnKg==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/fill-range/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", + "node_modules/lightningcss-linux-arm64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-arm64-musl/-/lightningcss-linux-arm64-musl-1.33.0.tgz", + "integrity": "sha512-yiO5ROMuYQgXbC60yjZU5CYSFZGKXL0HFATXt9mHJn1+zW55oCtMI9NfcVhYLMFDL7gV7oBPon/EmMMGg2OvtQ==", + "cpu": [ + "arm64" + ], "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" - }, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==", + "node_modules/lightningcss-linux-x64-gnu": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-gnu/-/lightningcss-linux-x64-gnu-1.33.0.tgz", + "integrity": "sha512-ar+Ju7LmcN0Jo4FpL4hpFybwNG9/3A/Br5KW2n2jyODg3MEZXaDYADdemoNS+BDNfMgKvylJLj4S5tyRActuAg==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "kind-of": "^3.0.2" - }, + "libc": [ + "glibc" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/is-number/node_modules/kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha512-NOW9QQXMoZGg/oqnVNoNTTIFEIid1627WCffUBJEdMxYApq7mNE7CpzucIPc+ZQg25Phej7IJSmX3hO+oblOtQ==", + "node_modules/lightningcss-linux-x64-musl": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-linux-x64-musl/-/lightningcss-linux-x64-musl-1.33.0.tgz", + "integrity": "sha512-RYiYbkokw0trfKqqzfF55lginwEPrD3OJDfTuJzFs1MK6iFnDenaz1fqLLtX4ITG3OktJQXOeTaw1awrBAlZPw==", + "cpu": [ + "x64" + ], "dev": true, - "dependencies": { - "is-buffer": "^1.1.5" - }, + "libc": [ + "musl" + ], + "license": "MPL-2.0", + "optional": true, + "os": [ + "linux" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/lightningcss-win32-arm64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-arm64-msvc/-/lightningcss-win32-arm64-msvc-1.33.0.tgz", + "integrity": "sha512-1K+MPfLSFVpphzpdbfkhlWk6wBrTObBzS2T6db10PNOZgR9GoVsAWzwNyuhUYYbTp23j+4RrncfujZ4uAzXvwA==", + "cpu": [ + "arm64" + ], "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/kind-of": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", - "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "node_modules/lightningcss-win32-x64-msvc": { + "version": "1.33.0", + "resolved": "https://registry.npmjs.org/lightningcss-win32-x64-msvc/-/lightningcss-win32-x64-msvc-1.33.0.tgz", + "integrity": "sha512-OlEICDx/Xl0FqSp4bry8zFnCvGpig3Gl4gCquvYwHuqJKEC1+n9NgDniFvqHGmMv1ZkqDJrDqKKSykTDX+ehuA==", + "cpu": [ + "x64" + ], "dev": true, + "license": "MPL-2.0", + "optional": true, + "os": [ + "win32" + ], + "peer": true, "engines": { - "node": ">=0.10.0" + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/parcel" } }, - "node_modules/readdirp/node_modules/micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", "dev": true, + "license": "MIT", "dependencies": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" + "p-locate": "^5.0.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/regenerator-runtime": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", - "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==", - "dev": true + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "dev": true, + "license": "MIT" }, - "node_modules/regex-cache": { - "version": "0.4.4", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", - "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", "dev": true, - "dependencies": { - "is-equal-shallow": "^0.1.3" - }, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", "dev": true, - "dependencies": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - }, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/remove-trailing-separator": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha512-/hS+Y0u3aOfIETiaiirUFwDBDzmXPvO+jAfKTitUngIPzdKc6Z0LoFjM/CK5PL4C+eKwHohlHAb6H0VFfmmUsw==", - "dev": true + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "dev": true, + "license": "MIT" }, - "node_modules/repeat-element": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.4.tgz", - "integrity": "sha512-LFiNfRcSu7KK3evMyYOuCzv3L10TW7yC1G2/+StMjK8Y6Vqd2MG7r/Qjw4ghtuCOjFvlnms/iMmLqpvW/ES/WQ==", + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", "dev": true, - "engines": { - "node": ">=0.10.0" - } + "license": "MIT" }, - "node_modules/repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha512-PV0dzCYDNfRi1jCDbJzpW7jNNDRuCOG/jI5ctQcGKt/clZD+YcPS3yIlWuTJMmESC8aevCFmWJy5wjAFgNqN6w==", + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", "dev": true, - "engines": { - "node": ">=0.10" - } + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "dev": true, + "license": "MIT" }, - "node_modules/request": { - "version": "2.88.2", - "resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz", - "integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==", - "deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142", + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "license": "ISC", "dependencies": { - "aws-sign2": "~0.7.0", - "aws4": "^1.8.0", - "caseless": "~0.12.0", - "combined-stream": "~1.0.6", - "extend": "~3.0.2", - "forever-agent": "~0.6.1", - "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.19", - "oauth-sign": "~0.9.0", - "performance-now": "^2.1.0", - "qs": "~6.5.2", - "safe-buffer": "^5.1.2", - "tough-cookie": "~2.5.0", - "tunnel-agent": "^0.6.0", - "uuid": "^3.3.2" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/request/node_modules/qs": { - "version": "6.5.3", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz", - "integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==", + "yallist": "^4.0.0" + }, "engines": { - "node": ">=0.6" + "node": ">=10" } }, - "node_modules/request/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "bin": { - "uuid": "bin/uuid" + "node_modules/magic-string": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-1.4.5.tgz", + "integrity": "sha512-oLLC2+YvQUfAa+vxoufE/yc1icb87M9iXIRqAoR/2EhE/8cb3SF/+Gi0c2By1B+5Vz2e2vQtUvHiu1+63Znh+w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.6.0" } }, - "node_modules/resolve": { - "version": "1.22.8", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", - "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", + "node_modules/marked": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/marked/-/marked-18.1.3.tgz", + "integrity": "sha512-9ChMH8EVVgjgID49nsL6IWxWk5c6GtAsq/xw7U1ggkjkU5AGuv68oLTVlFRtvcUYZtpbNyjyvGo3YDu0fGapiw==", "dev": true, - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, + "license": "MIT", "bin": { - "resolve": "bin/resolve" + "marked": "bin/marked.js" }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "engines": { + "node": ">= 20" } }, - "node_modules/resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha512-ZuF55hVUQaaczgOIwqWzkEcEidmlD/xl44x1UZnhOXcYuFN2S6+rcxpG+C1N3So0wvNI3DmJICUFfu2SxhBmvg==", - "deprecated": "https://github.com/lydell/resolve-url#deprecated", - "dev": true + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } }, - "node_modules/ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", + "node_modules/mime": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", + "integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==", "dev": true, + "license": "MIT", + "bin": { + "mime": "cli.js" + }, "engines": { - "node": ">=0.12" + "node": ">=4" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "node_modules/minimatch": { + "version": "10.2.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.6.tgz", + "integrity": "sha512-vpLQEs+VLCr1nU0BXS07maYoFwlDAH0gngQuuttxIwutDFEMHq2blX+8vpgxDdK3J1PwjCJiep77OitTZ4Ll1A==", "dev": true, + "license": "BlueOak-1.0.0", "dependencies": { - "glob": "^7.1.3" + "brace-expansion": "^5.0.8" }, - "bin": { - "rimraf": "bin.js" + "engines": { + "node": "18 || 20 || >=22" }, "funding": { "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true, + "license": "ISC" + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, "funding": [ { "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" + "url": "https://github.com/sponsors/ai" } - ] + ], + "license": "MIT", + "peer": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", + "dev": true, + "license": "MIT" + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } }, - "node_modules/safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha512-aJXcif4xnaNUzvUuC5gcb46oTS7zvg4jpMTnuqtrEPlR3vFr4pxtdTwaF1Qs3Enjn9HK+ZlwQui+a7z0SywIzg==", + "node_modules/obug": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/obug/-/obug-3.0.0.tgz", + "integrity": "sha512-5vvB5+W7ePv+p3uqxi+RcW1XAzLW0/hxt3/4X4Lc4qHudzOhmBiBwOY6DRob4WnanAEGvNcLjF+KNOufrUoEQw==", "dev": true, - "dependencies": { - "ret": "~0.1.10" + "funding": [ + "https://github.com/sponsors/sxzz", + "https://opencollective.com/debug" + ], + "license": "MIT", + "engines": { + "node": ">=12.20.0" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/sax": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.3.0.tgz", - "integrity": "sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==", - "dev": true - }, - "node_modules/semver": { - "version": "7.5.4", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", - "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "node_modules/open": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/open/-/open-11.0.4.tgz", + "integrity": "sha512-++Zlftm0kVLPmzC06t6epuWmcRMDbI4z5P3NNX979WA/k23+NtSOynEGzsVfZwguKw2mi5umVgnBlJQMwRz4Pg==", + "dev": true, + "license": "MIT", "dependencies": { - "lru-cache": "^6.0.0" - }, - "bin": { - "semver": "bin/semver.js" + "default-browser": "^5.5.1", + "define-lazy-prop": "^3.0.0", + "is-in-ssh": "^1.0.0", + "is-inside-container": "^1.0.0", + "powershell-utils": "^0.2.1", + "wsl-utils": "^1.0.0" }, "engines": { - "node": ">=10" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/set-function-length": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.0.tgz", - "integrity": "sha512-4DBHDoyHlM1IRPGYcoxexgh67y4ueR53FKV1yyxwFMY7aCqcN/38M1+SwZ/qJQ8iLv7+ck385ot4CcisOAPT9w==", + "node_modules/optionator": { + "version": "0.9.4", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz", + "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==", "dev": true, + "license": "MIT", "dependencies": { - "define-data-property": "^1.1.1", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.2", - "gopd": "^1.0.1", - "has-property-descriptors": "^1.0.1" + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.5" }, "engines": { - "node": ">= 0.4" + "node": ">= 0.8.0" } }, - "node_modules/set-value": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", - "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", "dev": true, + "license": "MIT", "dependencies": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" + "yocto-queue": "^0.1.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/set-value/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", "dev": true, + "license": "MIT", "dependencies": { - "is-extendable": "^0.1.0" + "p-limit": "^3.0.2" }, "engines": { - "node": ">=0.10.0" + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/shell-quote": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.8.1.tgz", - "integrity": "sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==", + "node_modules/parse5": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.1.0.tgz", + "integrity": "sha512-sq3qBFpee5jeocbFbO48VHlGr8sT7mbXS0vxlKN6sottBtJzrOG3998sr0llSZcQAGgfpdmEYAIZE0P9z0dE8w==", "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^9.0.0" + }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/inikulin/parse5?sponsor=1" } }, - "node_modules/side-channel": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", - "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", "dev": true, - "dependencies": { - "call-bind": "^1.0.0", - "get-intrinsic": "^1.0.2", - "object-inspect": "^1.9.0" + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/pend": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/pend/-/pend-1.2.0.tgz", + "integrity": "sha512-F3asv42UuXchdzt+xXqfW1OGlVBe+mxa2mqI0pg5yAHZPvFmY3Y6drSf/GQ1A86WgWEN9Kzh/WrgKa6iGcHXLg==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC", + "peer": true + }, + "node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" }, "funding": { - "url": "https://github.com/sponsors/ljharb" + "url": "https://github.com/sponsors/jonschlinkert" } }, - "node_modules/simple-concat": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz", - "integrity": "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q==", + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", "dev": true, "funding": [ { - "type": "github", - "url": "https://github.com/sponsors/feross" + "type": "opencollective", + "url": "https://opencollective.com/postcss/" }, { - "type": "patreon", - "url": "https://www.patreon.com/feross" + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "optional": true - }, - "node_modules/simple-get": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/simple-get/-/simple-get-4.0.1.tgz", - "integrity": "sha512-brv7p5WgH0jmQJr1ZDDfKDOSeWWg+OVypG99A/5vYGPqJ6pxiaHLy8nxtFjBA7oMa01ebA9gfh1uMCFqOuXxvA==", - "dev": true, - "funding": [ { "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" + "url": "https://github.com/sponsors/ai" } ], - "optional": true, + "license": "MIT", + "peer": true, "dependencies": { - "decompress-response": "^6.0.0", - "once": "^1.3.1", - "simple-concat": "^1.0.0" + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" } }, - "node_modules/sinon": { - "version": "7.4.2", - "resolved": "https://registry.npmjs.org/sinon/-/sinon-7.4.2.tgz", - "integrity": "sha512-pY5RY99DKelU3pjNxcWo6XqeB1S118GBcVIIdDi6V+h6hevn1izcg2xv1hTHW/sViRXU7sUOxt4wTUJ3gsW2CQ==", - "deprecated": "16.1.1", + "node_modules/powershell-utils": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/powershell-utils/-/powershell-utils-0.2.1.tgz", + "integrity": "sha512-C+y9x90UElAddDZmV4qOx9W53B61PO7cIqWz2dQsWlwswuq4mr8NEwytdGKboYbQlGZ3awrkTeNvcZiZNHnQ8A==", "dev": true, - "dependencies": { - "@sinonjs/commons": "^1.4.0", - "@sinonjs/formatio": "^3.2.1", - "@sinonjs/samsam": "^3.3.3", - "diff": "^3.5.0", - "lolex": "^4.2.0", - "nise": "^1.5.2", - "supports-color": "^5.5.0" + "license": "MIT", + "engines": { + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", "dev": true, - "dependencies": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">= 0.8.0" } }, - "node_modules/snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "node_modules/prettier": { + "version": "3.9.10", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.9.10.tgz", + "integrity": "sha512-skGHTH1Yb9QvaTC4hWnRTzEYtCpApF0UMBPz+t/0ZPzP8ihefo/btKd+QA7pUE0fEwA1SbS/NmhyEcstdXOIdA==", "dev": true, - "dependencies": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=0.10.0" + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" } }, - "node_modules/snapdragon-node/node_modules/define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha512-cZTYKFWspt9jZsMscWo8sc/5lbPC9Q0N5nBLgb+Yd915iL3udB1uFgS3B8YCx66UVHq018DAVFoee7x+gxggeA==", + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", "dev": true, + "license": "MIT", "dependencies": { - "is-descriptor": "^1.0.0" - }, - "engines": { - "node": ">=0.10.0" + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" } }, - "node_modules/snapdragon-node/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/punycode": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", + "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=6" } }, - "node_modules/snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "node_modules/qified": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/qified/-/qified-0.10.1.tgz", + "integrity": "sha512-+Owyggi9IxT1ePKGafcI87ubSmxol6smwJ+RAHDQlx9+9cPwFWDiKFFCPuWhr9ignlGpZ9vDQLw67N4dcTVFEA==", "dev": true, + "license": "MIT", "dependencies": { - "kind-of": "^3.2.0" + "hookified": "^2.1.1" }, "engines": { - "node": ">=0.10.0" + "node": ">=20" } }, - "node_modules/snapdragon/node_modules/debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "node_modules/qified/node_modules/hookified": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/hookified/-/hookified-2.2.0.tgz", + "integrity": "sha512-p/LgFzRN5FeoD3DLS6bkUapeye6E4SI6yJs6KetENd18S+FBthqYq2amJUWpt5z0EQwwHemidjY5OqJGEKm5uA==", "dev": true, - "dependencies": { - "ms": "2.0.0" - } + "license": "MIT" }, - "node_modules/snapdragon/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==", + "node_modules/qs": { + "version": "6.17.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.17.1.tgz", + "integrity": "sha512-jd3COkaKVgGUW+ZHyEHCG9bH7RoaaiWuMgzsIBjUMVjLAaWGWpoUAVwljVvBHxRu/2qEHnadLGZrkutYUBPQJA==", "dev": true, + "license": "BSD-3-Clause", "dependencies": { - "is-descriptor": "^0.1.0" + "es-define-property": "^1.0.1", + "side-channel": "^1.1.1" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/snapdragon/node_modules/extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha512-zCnTtlxNoAiDc3gqY2aYAWFx7XWWiasuF2K8Me5WbN8otHKTUKBwjPtNpRs/rbUZm7KxWAaNj7P1a/p52GbVug==", - "dev": true, - "dependencies": { - "is-extendable": "^0.1.0" + "node": ">=0.6" }, - "engines": { - "node": ">=0.10.0" + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/snapdragon/node_modules/is-descriptor": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz", - "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==", + "node_modules/read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", "dev": true, + "license": "ISC", "dependencies": { - "is-accessor-descriptor": "^1.0.1", - "is-data-descriptor": "^1.0.1" + "mute-stream": "~0.0.4" }, "engines": { - "node": ">= 0.4" + "node": ">=0.8" } }, - "node_modules/snapdragon/node_modules/source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/source-map-resolve": { - "version": "0.5.3", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.3.tgz", - "integrity": "sha512-Htz+RnsXWk5+P2slx5Jh3Q66vhQj1Cllm0zvnaY98+NFx+Dv2CF/f5O/t8x+KaNdrdIAsruNzoh/KpialbqAnw==", - "deprecated": "See https://github.com/lydell/source-map-resolve#deprecated", - "dev": true, - "dependencies": { - "atob": "^2.1.2", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" + "node": ">= 4" } }, - "node_modules/source-map-url": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.1.tgz", - "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", - "deprecated": "See https://github.com/lydell/source-map-url#deprecated", - "dev": true - }, - "node_modules/split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "node_modules/rolldown": { + "version": "1.2.16", + "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.2.16.tgz", + "integrity": "sha512-bWvlMpFKiTfDKfnK7FC2MPgPeWCf/Kpwsq49ApdW+FQaBZb6O6dZ4MAPbPUjp7hYQrw/RobqCzn64BRrQecGHw==", "dev": true, + "license": "MIT", + "peer": true, "dependencies": { - "extend-shallow": "^3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/sshpk": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.18.0.tgz", - "integrity": "sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "bcrypt-pbkdf": "^1.0.0", - "dashdash": "^1.12.0", - "ecc-jsbn": "~0.1.1", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "safer-buffer": "^2.0.2", - "tweetnacl": "~0.14.0" + "@oxc-project/types": "=0.156.0", + "@rolldown/pluginutils": "^1.0.0" }, "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" + "rolldown": "bin/cli.mjs" }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha512-72E9+uLc27Mt718pMHt9VMNiAL4LMsmDbBva8mxWUCkT07fSzEGMYUCk0XWY6lp0j6RBAG4cJ3mWuZv2OE3s0g==", - "dev": true, - "dependencies": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" + "node": "^20.19.0 || >=22.12.0" }, + "optionalDependencies": { + "@rolldown/binding-android-arm-eabi": "1.2.16", + "@rolldown/binding-android-arm64": "1.2.16", + "@rolldown/binding-darwin-arm64": "1.2.16", + "@rolldown/binding-darwin-x64": "1.2.16", + "@rolldown/binding-freebsd-x64": "1.2.16", + "@rolldown/binding-linux-arm-gnueabihf": "1.2.16", + "@rolldown/binding-linux-arm64-gnu": "1.2.16", + "@rolldown/binding-linux-arm64-musl": "1.2.16", + "@rolldown/binding-linux-ppc64-gnu": "1.2.16", + "@rolldown/binding-linux-s390x-gnu": "1.2.16", + "@rolldown/binding-linux-x64-gnu": "1.2.16", + "@rolldown/binding-linux-x64-musl": "1.2.16", + "@rolldown/binding-openharmony-arm64": "1.2.16", + "@rolldown/binding-win32-arm64-msvc": "1.2.16", + "@rolldown/binding-win32-x64-msvc": "1.2.16" + } + }, + "node_modules/run-applescript": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz", + "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/static-extend/node_modules/define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha512-Rr7ADjQZenceVOAKop6ALkkRAmH1A4Gx9hV/7ZujPUN2rkATqFO0JZLZInbAjpZYoJ1gUx8MRMQVkYemcbMSTA==", + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", "dev": true, - "dependencies": { - "is-descriptor": "^0.1.0" - }, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/sax": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.1.tgz", + "integrity": "sha512-42tBVwLWnaQvW5zc4HbZrTuWccECCZfBi92FDuwtqxasH+JbPB3/FOKb1m222K42R4WxuxzzMsTswfzgtSu64Q==", + "dev": true, + "license": "BlueOak-1.0.0", "engines": { - "node": ">=0.10.0" + "node": ">=11.0.0" } }, - "node_modules/static-extend/node_modules/is-descriptor": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.7.tgz", - "integrity": "sha512-C3grZTvObeN1xud4cRWl366OMXZTj0+HGyk4hvfpx4ZHt1Pb60ANSXqCK7pdOTeUQpRzECBSTphqvD7U+l22Eg==", - "dev": true, - "dependencies": { - "is-accessor-descriptor": "^1.0.1", - "is-data-descriptor": "^1.0.1" + "node_modules/semver": { + "version": "7.8.6", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.6.tgz", + "integrity": "sha512-9lpSSU4Mly3mrtruwLs1eLK6+gzbzqeBFwRNjIjE+9LuDpWdYctrQlQ3ej1Ilgi7gknpsTRnPoLP8DpCHqHIJw==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" }, "engines": { - "node": ">= 0.4" + "node": ">=10" } }, - "node_modules/string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", "dev": true, + "license": "MIT", "dependencies": { - "safe-buffer": "~5.1.0" - } - }, - "node_modules/string_decoder/node_modules/safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "shebang-regex": "^3.0.0" + }, "engines": { "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/subarg": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/subarg/-/subarg-1.0.0.tgz", - "integrity": "sha512-RIrIdRY0X1xojthNcVtgT9sjpOGagEUKpZdgBUi054OEPFo282yg+zE+t1Rj3+RqKq2xStL7uUHhY+AjbC4BXg==", + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true, - "dependencies": { - "minimist": "^1.1.0" + "license": "MIT", + "engines": { + "node": ">=8" } }, - "node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "node_modules/side-channel": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz", + "integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==", "dev": true, + "license": "MIT", "dependencies": { - "has-flag": "^3.0.0" + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4", + "side-channel-list": "^1.0.1", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" }, "engines": { - "node": ">=4" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "node_modules/side-channel-list": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz", + "integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==", "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.4" + }, "engines": { "node": ">= 0.4" }, @@ -3776,159 +3705,174 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tar-fs": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/tar-fs/-/tar-fs-2.1.1.tgz", - "integrity": "sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==", + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "chownr": "^1.1.1", - "mkdirp-classic": "^0.5.2", - "pump": "^3.0.0", - "tar-stream": "^2.1.4" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tar-stream": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/tar-stream/-/tar-stream-2.2.0.tgz", - "integrity": "sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==", + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", "dev": true, - "optional": true, + "license": "MIT", "dependencies": { - "bl": "^4.0.3", - "end-of-stream": "^1.4.1", - "fs-constants": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^3.1.1" + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" }, "engines": { - "node": ">=6" + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/tar-stream/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "node_modules/signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", "dev": true, - "optional": true, - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, + "license": "ISC" + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "peer": true, "engines": { - "node": ">= 6" + "node": ">=0.10.0" } }, - "node_modules/tmp": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.1.tgz", - "integrity": "sha512-76SUhtfqR2Ijn+xllcI5P1oyannHNHByD80W1q447gU3mp9G9PSpGdWmjUOHRDPiHYacIk66W7ubDTuPF3BEtQ==", + "node_modules/std-env": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-4.3.0.tgz", + "integrity": "sha512-OtU/EgQ1kIm5KwqQpBC6ZEMXrZRui11w8zgfTWp8cdO9B8OaPsbA8bTHO2P+HNo1VlUTGMVBwPhydu6poeXiag==", + "dev": true, + "license": "MIT" + }, + "node_modules/structured-source": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/structured-source/-/structured-source-4.0.0.tgz", + "integrity": "sha512-qGzRFNJDjFieQkl/sVOI2dUjHKRyL9dAJi2gCPGJLbJHBIkyOHxjuocpIEfbLioX+qSJpvbYdT49/YCdMznKxA==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "rimraf": "^3.0.0" - }, - "engines": { - "node": ">=8.17.0" + "boundary": "^2.0.0" } }, - "node_modules/to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha512-9mWHdnGRuh3onocaHzukyvCZhzvr6tiflAy/JRFXcJX0TjgfWA9pk9t8CMbzmBE4Jfw58pXbkngtBtqYxzNEyg==", + "node_modules/textextensions": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/textextensions/-/textextensions-6.11.0.tgz", + "integrity": "sha512-tXJwSr9355kFJI3lbCkPpUH5cP8/M0GGy2xLO34aZCjMXBaK3SoPnZwr/oWmo1FdCnELcs4npdCIOFtq9W3ruQ==", "dev": true, + "license": "Artistic-2.0", "dependencies": { - "kind-of": "^3.0.2" + "editions": "^6.21.0" }, "engines": { - "node": ">=0.10.0" + "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", + "node_modules/tinybench": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-6.2.3.tgz", + "integrity": "sha512-Al01C2JIBnO2CXCAPbpAl6sUiOZHeThGtHYNTa51JRw9PyWOCdr+9Ong05R4qg/Sk3+H645E8ov1h2c58ityNw==", "dev": true, - "dependencies": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=20.0.0" } }, - "node_modules/to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha512-ZZWNfCjUokXXDGXFpZehJIkZqq91BcULFq/Pi7M5i4JnxXdhMKAK682z8bCW3o8Hj1wuuzoKcW3DfVzaP6VuNg==", + "node_modules/tinyexec": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.3.1.tgz", + "integrity": "sha512-GCvB3aoys96IuDFBMcTB46JOR6mdMtAToqwiW8JlWhsoh1mhHi/xn9ss/Dg7N555GiJyEt2qzoG/NHCwM6h1EA==", "dev": true, - "dependencies": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - }, + "license": "MIT", "engines": { - "node": ">=0.10.0" + "node": ">=18" } }, - "node_modules/to-regex-range/node_modules/is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha512-4cboCqIpliH+mAvFNegjZQ4kgKc3ZUhQVr3HvWbSh5q3WH2v82ct+T2Y1hdU5Gdtorx/cLifQjqCbL7bpznLTg==", + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "dev": true, + "license": "MIT", "dependencies": { - "kind-of": "^3.0.2" + "fdir": "^6.5.0", + "picomatch": "^4.0.4" }, "engines": { - "node": ">=0.10.0" + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" } }, - "node_modules/tough-cookie": { + "node_modules/ts-api-utils": { "version": "2.5.0", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz", - "integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==", - "dependencies": { - "psl": "^1.1.28", - "punycode": "^2.1.1" - }, + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz", + "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=0.8" + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" } }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD" + }, "node_modules/tunnel": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz", "integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.6.11 <=0.7.0 || >=0.7.3" } }, - "node_modules/tunnel-agent": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==", + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "license": "MIT", "dependencies": { - "safe-buffer": "^5.0.1" + "prelude-ls": "^1.2.1" }, "engines": { - "node": "*" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha512-KXXFFdAbFXY4geFIwoyNK+f5Z1b7swfXABfL7HXCmoIWMKU3dmS26672A4EeQtDzLKy7SXmfBu51JolvEKwtGA==" - }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true, - "engines": { - "node": ">=4" + "node": ">= 0.8.0" } }, "node_modules/typed-rest-client": { @@ -3936,6 +3880,7 @@ "resolved": "https://registry.npmjs.org/typed-rest-client/-/typed-rest-client-1.8.11.tgz", "integrity": "sha512-5UvfMpd1oelmUPRbbaVnq+rHP7ng2cE4qoQkQeAqxRL6PklkxsM0g32/HL0yfvruK6ojQ5x8EE+HF4YV6DtuCA==", "dev": true, + "license": "MIT", "dependencies": { "qs": "^6.9.1", "tunnel": "0.0.6", @@ -3943,10 +3888,11 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.3.tgz", + "integrity": "sha512-y2TvuxSZPDyQakkFRPZHKFm+KKVqIisdg9/CZwm9ftvKXLP8NRWj38/ODjNbr43SsoXqNuAisEf1GdCxqWcdBw==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -3955,17 +3901,36 @@ "node": ">=14.17" } }, - "node_modules/uc.micro": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", - "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", - "dev": true + "node_modules/typescript-eslint": { + "version": "8.72.1", + "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.72.1.tgz", + "integrity": "sha512-3Li9FfPmQp45nxEtFD1ZCrYFI3cYK5kpyNtmm1H7lMagm8u9sy6PTjy3ytwQZs7KNukOyKFHAZ6z6GjYFeaeXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/eslint-plugin": "8.72.1", + "@typescript-eslint/parser": "8.72.1", + "@typescript-eslint/typescript-estree": "8.72.1", + "@typescript-eslint/utils": "8.72.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0", + "typescript": ">=4.8.4 <6.1.0" + } }, "node_modules/underscore": { - "version": "1.13.6", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", - "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==", - "dev": true + "version": "1.13.8", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.8.tgz", + "integrity": "sha512-DXtD3ZtEQzc7M8m4cXotyHR+FAS18C64asBYY5vqZexfYryNNnDc02W4hKg3rdQuqOYas1jkseX0+nZXjTXnvQ==", + "dev": true, + "license": "MIT" }, "node_modules/undici-types": { "version": "6.21.0", @@ -3974,195 +3939,260 @@ "dev": true, "license": "MIT" }, - "node_modules/union-value": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", - "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - }, - "engines": { - "node": ">=0.10.0" + "punycode": "^2.1.0" } }, - "node_modules/universal-analytics": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/universal-analytics/-/universal-analytics-0.4.23.tgz", - "integrity": "sha512-lgMIH7XBI6OgYn1woDEmxhGdj8yDefMKg7GkWdeATAlQZFrMrNyxSkpDzY57iY0/6fdlzTbBV03OawvvzG+q7A==", - "dependencies": { - "debug": "^4.1.1", - "request": "^2.88.2", - "uuid": "^3.0.0" + "node_modules/url-join": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", + "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", + "dev": true, + "license": "MIT" + }, + "node_modules/version-range": { + "version": "4.15.0", + "resolved": "https://registry.npmjs.org/version-range/-/version-range-4.15.0.tgz", + "integrity": "sha512-Ck0EJbAGxHwprkzFO966t4/5QkRuzh+/I1RxhLgUKKwEn+Cd8NwM60mE3AqBZg5gYODoXW0EFsQvbZjRlvdqbg==", + "dev": true, + "license": "Artistic-2.0", + "engines": { + "node": ">=4" + }, + "funding": { + "url": "https://bevry.me/fund" } }, - "node_modules/universal-analytics/node_modules/debug": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", - "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", + "node_modules/vite": { + "version": "8.3.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-8.3.6.tgz", + "integrity": "sha512-UI7dK29NnS54Fk+mmo7o+jI6U8Fp7hDl+X5Q1k45WH+d4dSlbLVUETGQ+hfkNgvLQGyoElPj837nZyv4MBc0VA==", + "dev": true, + "license": "MIT", + "peer": true, "dependencies": { - "ms": "2.1.2" + "lightningcss": "^1.33.0", + "picomatch": "^4.0.7", + "postcss": "^8.5.32", + "rolldown": "~1.2.16", + "tinyglobby": "^0.2.17" + }, + "bin": { + "vite": "bin/vite.js" }, "engines": { - "node": ">=6.0" + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "@vitejs/devtools": "^0.7.1 || ^0.8.0", + "esbuild": "^0.27.0 || ^0.28.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" }, "peerDependenciesMeta": { - "supports-color": { + "@types/node": { + "optional": true + }, + "@vitejs/devtools": { + "optional": true + }, + "esbuild": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { "optional": true } } }, - "node_modules/universal-analytics/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" - }, - "node_modules/universal-analytics/node_modules/uuid": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz", - "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==", - "deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.", - "bin": { - "uuid": "bin/uuid" - } - }, - "node_modules/unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ==", + "node_modules/vitest": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-5.1.0.tgz", + "integrity": "sha512-MzmNFnrwa8v8lF1bLxw3UJ4EREwVOVb75VqJZmUDRjJ6EluK/x9th7qTbaeDk41WxE1GxWqmTXcdsfobfH5sOA==", "dev": true, + "license": "MIT", "dependencies": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" + "@types/chai": "^5.2.2", + "@vitest/mocker": "5.1.0", + "chai": "^6.3.0", + "es-module-lexer": "^2.3.2", + "expect-type": "^1.4.0", + "magic-string": "^1.4.3", + "obug": "^3.0.0", + "picomatch": "^4.0.7", + "std-env": "^4.3.0", + "tinybench": "^6.2.2", + "tinyexec": "^1.3.1", + "tinyglobby": "^0.2.17", + "why-is-node-running": "3.2.1" + }, + "bin": { + "vitest": "vitest.mjs" }, "engines": { - "node": ">=0.10.0" + "node": "^22.12.0 || ^24.0.0 || >=26.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@opentelemetry/api": "^1.9.0", + "@types/node": "^22.0.0 || >=24.0.0", + "@vitest/browser-playwright": "5.1.0", + "@vitest/browser-preview": "5.1.0", + "@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0", + "@vitest/coverage-istanbul": "5.1.0", + "@vitest/coverage-v8": "5.1.0", + "@vitest/ui": "5.1.0", + "happy-dom": "*", + "jsdom": "*", + "vite": "^6.4.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@opentelemetry/api": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser-playwright": { + "optional": true + }, + "@vitest/browser-preview": { + "optional": true + }, + "@vitest/browser-webdriverio": { + "optional": true + }, + "@vitest/coverage-istanbul": { + "optional": true + }, + "@vitest/coverage-v8": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + }, + "vite": { + "optional": false + } } }, - "node_modules/unset-value/node_modules/has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha512-gpG936j8/MzaeID5Yif+577c17TxaDmhuyVgSwtnL/q8UUTySg8Mecb+8Cf1otgLoD7DDH75axp86ER7LFsf3Q==", + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", "dev": true, + "license": "ISC", "dependencies": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" }, "engines": { - "node": ">=0.10.0" + "node": ">= 8" } }, - "node_modules/unset-value/node_modules/has-value/node_modules/isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha512-+OUdGJlgjOBZDfxnDjYYG6zp487z0JGNQq3cYQYg5f5hKR+syHMsaztzGeml/4kGG55CSpKSpWTY+jYGgsHLgA==", + "node_modules/why-is-node-running": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-3.2.1.tgz", + "integrity": "sha512-Tb2FUhB4vUsGQlfSquQLYkApkuPAFQXGFzxWKHHumVz2dK+X1RUm/HnID4+TfIGYJ1kTcwOaCk/buYCEJr6YjQ==", "dev": true, - "dependencies": { - "isarray": "1.0.0" + "license": "MIT", + "bin": { + "why-is-node-running": "cli.js" }, "engines": { - "node": ">=0.10.0" + "node": ">=20.11" } }, - "node_modules/unset-value/node_modules/has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha512-J8S0cEdWuQbqD9//tlZxiMuMNmxB8PlEwvYwuxsTmR1G5RXUePEX/SJn7aD0GMLieuZYSwNH0cQuJGwnYunXRQ==", + "node_modules/word-wrap": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz", + "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==", "dev": true, + "license": "MIT", "engines": { "node": ">=0.10.0" } }, - "node_modules/unset-value/node_modules/isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==", + "node_modules/wsl-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-1.0.1.tgz", + "integrity": "sha512-c16PKLIRxBYpR3jSWsdS7SFp0COm5SOQdiFjY818dYFHJbMGuLBszpF07LBWmOS1uzrHa9VGdynsEgoeKy0oOQ==", "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "license": "MIT", "dependencies": { - "punycode": "^2.1.0" - } - }, - "node_modules/urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha512-Am1ousAhSLBeB9cG/7k7r2R0zj50uDRlZHPGbazid5s9rlF1F/QKYObEKSIunSjIOkJZqwRRLpvewjEkM7pSqg==", - "deprecated": "Please see https://github.com/lydell/urix#deprecated", - "dev": true - }, - "node_modules/url-join": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/url-join/-/url-join-4.0.1.tgz", - "integrity": "sha512-jk1+QP6ZJqyOiuEI9AEWQfju/nB2Pw466kbA0LEZljHwKeMgd9WrAEgEGxjPDD2+TNbbb37rTyhEfrCXfuKXnA==", - "dev": true - }, - "node_modules/use": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.1.tgz", - "integrity": "sha512-cwESVXlO3url9YWlFW/TA9cshCEhtu7IKJ/p5soJ/gGpj7vbvFrAY/eIioQ6Dw23KjZhYgiIo8HOs1nQ2vr/oQ==", - "dev": true, + "is-wsl": "^3.1.0", + "powershell-utils": "^0.2.0" + }, "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", - "dev": true - }, - "node_modules/uuid": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", - "integrity": "sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "bin": { - "uuid": "dist/bin/uuid" - } - }, - "node_modules/verror": { - "version": "1.10.0", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz", - "integrity": "sha512-ZZKSmDAEFOijERBLkmYfJ+vmk3w+7hOLYDNkRCuRuMJGEmqYNCNLyBBFwWKVMhfwaEF3WOd0Zlw86U/WC/+nYw==", - "engines": [ - "node >=0.6.0" - ], - "dependencies": { - "assert-plus": "^1.0.0", - "core-util-is": "1.0.2", - "extsprintf": "^1.2.0" + "node": ">=20" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/verror/node_modules/core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, "node_modules/xml2js": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", "integrity": "sha512-drPFnkQJik/O+uPKpqSgr22mpuFHqKdbS835iAQrUC73L2F5WkboIRd63ai/2Yg6I1jzifPFKH2NTK+cfglkIA==", "dev": true, + "license": "MIT", "dependencies": { "sax": ">=0.6.0", "xmlbuilder": "~11.0.0" @@ -4176,6 +4206,7 @@ "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz", "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==", "dev": true, + "license": "MIT", "engines": { "node": ">=4.0" } @@ -4183,16 +4214,21 @@ "node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==" + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true, + "license": "ISC" }, "node_modules/yauzl": { - "version": "2.10.0", - "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-2.10.0.tgz", - "integrity": "sha512-p4a9I6X6nu6IhoGmBqAcbJy1mlC4j27vEPZX9F4L4/vZT3Lyq1VkFHw/V/PUcB9Buo+DG3iHkT0x3Qya58zc3g==", + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/yauzl/-/yauzl-3.4.0.tgz", + "integrity": "sha512-jIH9yLR9wqr0wOS0TpBvo/g/2UgZH5qePVbjgRliiF0BYvOZyaBknKsF+x9Iht0O6sqgnB93rCICdOZFecJuDw==", "dev": true, + "license": "MIT", "dependencies": { - "buffer-crc32": "~0.2.3", - "fd-slicer": "~1.1.0" + "pend": "~1.2.0" + }, + "engines": { + "node": ">=12" } }, "node_modules/yazl": { @@ -4200,9 +4236,23 @@ "resolved": "https://registry.npmjs.org/yazl/-/yazl-2.5.1.tgz", "integrity": "sha512-phENi2PLiHnHb6QBVot+dJnaAZ0xosj7p3fWl+znIjBDlnMI2PsZCJZ306BPTFOaHf5qdDEI8x5qFrSOBN5vrw==", "dev": true, + "license": "MIT", "dependencies": { "buffer-crc32": "~0.2.3" } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } } } } diff --git a/package.json b/package.json index ab7e4f8..e921ab0 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "nativescript", "version": "0.12.5", - "minNativescriptCliVersion": "2.5.0", + "minNativescriptCliVersion": "8.0.0", "icon": "images/icon.png", "displayName": "NativeScript", "description": "NativeScript support for Visual Studio Code", @@ -26,46 +26,42 @@ "license": "SEE LICENSE IN LICENSE.txt", "dependencies": { "@vscode/debugadapter": "^1.68.0", - "lodash": "4.17.21", - "semver": "7.5.4", - "strip-json-comments": "~3.1.1", - "universal-analytics": "0.4.23", - "uuid": "9.0.1" + "semver": "^7.8.6" }, "devDependencies": { - "@types/lodash": "4.14.121", - "@types/mocha": "5.2.6", - "@types/node": "^22.19.19", - "@types/proxyquire": "1.3.31", - "@types/semver": "7.5.6", - "@types/sinon": "7.0.13", - "@types/universal-analytics": "0.4.1", - "@types/uuid": "^10.0.0", - "@types/vscode": "^1.120.0", + "@eslint/js": "^10.0.1", + "@types/node": "^22.20.5", + "@types/semver": "^7.8.0", + "@types/vscode": "~1.109.0", "@vscode/debugprotocol": "^1.68.0", - "@vscode/vsce": "^2.22.0", - "cpx": "1.5.0", - "mocha": "5.2.0", - "prettier": "^3.8.3", - "proxyquire": "2.1.3", - "sinon": "7.4.2", - "typescript": "^5.3.3" + "@vscode/vsce": "^4.1.0", + "eslint": "^10.14.0", + "eslint-config-prettier": "^10.1.8", + "globals": "^17.14.0", + "prettier": "^3.9.10", + "typescript": "~6.0.3", + "typescript-eslint": "^8.72.1", + "vitest": "^5.1.0" }, "scripts": { "clean": "git clean -fdx", - "build": "tsc -p ./src && cpx src/common/*.sh out/common", - "build:watch": "tsc -w -p ./src && cpx src/common/*.sh out/common", + "build": "tsc -p ./src/tsconfig.build.json", + "build:watch": "tsc -w -p ./src/tsconfig.build.json", + "lint": "eslint .", + "lint:fix": "eslint . --fix", + "format": "prettier --write .", + "format:check": "prettier --check .", + "typecheck": "tsc -p ./src --noEmit", + "test": "vitest run", + "test:watch": "vitest", "package": "vsce package", "full-build": "npm run clean && npm install && npm run build && npm run package", - "test": "mocha --opts ./src/tests/config/mocha.opts", - "tslint": "tslint -p ./src/tsconfig.json -c tslint.json" + "vscode:prepublish": "npm run clean:out && npm run build && node scripts/write-ga-config.mjs", + "clean:out": "node -e \"require('fs').rmSync('out', { recursive: true, force: true })\"" }, "main": "./out/main", "activationEvents": [ - "onDebugResolve:nativescript", - "onCommand:nativescript.runIos", - "onCommand:nativescript.runAndroid", - "onCommand:nativescript.showOutputChannel" + "onDebugResolve:nativescript" ], "contributes": { "configuration": { @@ -75,12 +71,12 @@ "nativescript.analytics.enabled": { "type": "boolean", "default": false, - "description": "Enables the extension tracking." + "description": "Send anonymous usage statistics to help improve the NativeScript extension." }, "nativescript.nsPath": { "type": "string", "default": "ns", - "description": "Path to the NativeScript CLI executable." + "description": "Path to the NativeScript CLI executable. Relative paths are resolved against the app root." }, "nativescript.iosTeamId": { "type": "string", @@ -130,19 +126,13 @@ "javascript", "typescript" ], - "enableBreakpointsFor": { - "languageIds": [ - "javascript", - "typescript" - ] - }, "initialConfigurations": [ { "name": "Launch on iOS", "type": "nativescript", "request": "launch", "platform": "ios", - "appRoot": "${workspaceRoot}", + "appRoot": "${workspaceFolder}", "sourceMaps": true, "watch": true }, @@ -151,7 +141,7 @@ "type": "nativescript", "request": "launch", "platform": "ios", - "appRoot": "${workspaceRoot}", + "appRoot": "${workspaceFolder}", "sourceMaps": true, "watch": false, "stopOnEntry": true, @@ -165,7 +155,7 @@ "type": "nativescript", "request": "attach", "platform": "ios", - "appRoot": "${workspaceRoot}", + "appRoot": "${workspaceFolder}", "sourceMaps": true, "watch": false }, @@ -174,7 +164,7 @@ "type": "nativescript", "request": "launch", "platform": "android", - "appRoot": "${workspaceRoot}", + "appRoot": "${workspaceFolder}", "sourceMaps": true, "watch": true }, @@ -183,7 +173,7 @@ "type": "nativescript", "request": "launch", "platform": "android", - "appRoot": "${workspaceRoot}", + "appRoot": "${workspaceFolder}", "sourceMaps": true, "watch": false, "stopOnEntry": true, @@ -197,7 +187,7 @@ "type": "nativescript", "request": "attach", "platform": "android", - "appRoot": "${workspaceRoot}", + "appRoot": "${workspaceFolder}", "sourceMaps": true, "watch": false } @@ -211,7 +201,7 @@ "type": "nativescript", "request": "launch", "platform": "ios", - "appRoot": "^\"\\${workspaceRoot}\"", + "appRoot": "^\"\\${workspaceFolder}\"", "sourceMaps": true, "watch": true } @@ -224,7 +214,7 @@ "type": "nativescript", "request": "launch", "platform": "android", - "appRoot": "^\"\\${workspaceRoot}\"", + "appRoot": "^\"\\${workspaceFolder}\"", "sourceMaps": true, "watch": true } @@ -237,7 +227,7 @@ "type": "nativescript", "request": "attach", "platform": "ios", - "appRoot": "^\"\\${workspaceRoot}\"", + "appRoot": "^\"\\${workspaceFolder}\"", "sourceMaps": true, "watch": false } @@ -250,7 +240,7 @@ "type": "nativescript", "request": "attach", "platform": "android", - "appRoot": "^\"\\${workspaceRoot}\"", + "appRoot": "^\"\\${workspaceFolder}\"", "sourceMaps": true, "watch": false } @@ -258,118 +248,195 @@ ], "configurationAttributes": { "launch": { - "required": [], + "required": [ + "platform" + ], "properties": { + "platform": { + "type": "string", + "enum": [ + "ios", + "android" + ], + "description": "Target platform." + }, + "appRoot": { + "type": "string", + "description": "Absolute path to the root folder of the NativeScript app. Defaults to the first workspace folder.", + "default": "${workspaceFolder}" + }, "tnsArgs": { "type": "array", - "description": "Optional arguments passed to the NativeScript CLI executable.", + "description": "Extra arguments passed to the NativeScript CLI.", "items": { "type": "string" }, "default": [] }, - "tnsOutput": { - "type": "string", - "description": "Path to file where the output of the CLI to redirected.", - "default": null + "watch": { + "type": "boolean", + "description": "Rebuild and reattach the debugger when files change.", + "default": true }, - "appRoot": { + "address": { "type": "string", - "description": "The path to the root folder of the application relative to the current working directory.", - "default": null + "description": "Host the debugger connects to. Defaults to 'localhost' on iOS and '127.0.0.1' on Android." }, "sourceMaps": { "type": "boolean", "description": "Use JavaScript source maps (if they exist).", "default": true }, - "diagnosticLogging": { - "type": "boolean", - "description": "When true, the adapter logs its own diagnostic info to the console", - "default": false + "sourceMapPathOverrides": { + "type": "object", + "description": "Mappings for rewriting source map locations to local paths. Merged over the defaults computed for the project.", + "default": {} }, - "platform": { - "type": "string", - "description": "NativeScript platform", - "default": null + "resolveSourceMapLocations": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + }, + "description": "Glob patterns for locations source maps may be loaded from. Defaults to null (any location), since maps on a device are not under the app root." }, - "stopOnEntry": { - "type": "boolean", - "description": "Automatically stop on the first line after lauch", - "default": false + "skipFiles": { + "type": "array", + "description": "Glob patterns for files to skip when stepping.", + "items": { + "type": "string" + }, + "default": [ + "/**" + ] }, - "noDebug": { + "smartStep": { "type": "boolean", - "description": "If true the launch request will launch the program without enabling debugging", + "description": "Automatically step through code that has no source mapping.", + "default": true + }, + "trace": { + "type": [ + "boolean", + "object" + ], + "description": "Enable js-debug's diagnostic logging.", "default": false }, - "watch": { + "diagnosticLogging": { "type": "boolean", - "description": "Whether the watch and reconnect on file change.", - "default": true + "default": false, + "deprecationMessage": "Use 'trace' instead." }, - "sourceMapPathOverrides": { - "type": "object", - "description": "A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on the disk.", - "default": null + "stopOnEntry": { + "type": "boolean", + "description": "Pause on the first line after launch.", + "default": false }, "launchTests": { "type": "boolean", - "description": "If true, the launch request will run the unit tests instead of the app itself.", + "description": "Run the app's unit tests (ns test) instead of the app itself.", "default": false } } }, "attach": { - "required": [], + "required": [ + "platform" + ], "properties": { + "platform": { + "type": "string", + "enum": [ + "ios", + "android" + ], + "description": "Target platform." + }, + "appRoot": { + "type": "string", + "description": "Absolute path to the root folder of the NativeScript app. Defaults to the first workspace folder.", + "default": "${workspaceFolder}" + }, "tnsArgs": { "type": "array", - "description": "Optional arguments passed to the NativeScript CLI executable.", + "description": "Extra arguments passed to the NativeScript CLI.", "items": { "type": "string" }, "default": [] }, - "tnsOutput": { - "type": "string", - "description": "Path to file where the output of the CLI to redirected.", - "default": null + "watch": { + "type": "boolean", + "description": "Rebuild and reattach the debugger when files change.", + "default": false }, - "appRoot": { + "address": { "type": "string", - "description": "The path to the root folder of the application relative to the current working directory.", - "default": null + "description": "Host the debugger connects to. Defaults to 'localhost' on iOS and '127.0.0.1' on Android." }, "sourceMaps": { "type": "boolean", "description": "Use JavaScript source maps (if they exist).", "default": true }, - "diagnosticLogging": { - "type": "boolean", - "description": "When true, the adapter logs its own diagnostic info to the console", - "default": false + "sourceMapPathOverrides": { + "type": "object", + "description": "Mappings for rewriting source map locations to local paths. Merged over the defaults computed for the project.", + "default": {} }, - "platform": { - "type": "string", - "description": "NativeScript platform", - "default": null + "resolveSourceMapLocations": { + "type": [ + "array", + "null" + ], + "items": { + "type": "string" + }, + "description": "Glob patterns for locations source maps may be loaded from. Defaults to null (any location), since maps on a device are not under the app root." }, - "watch": { + "skipFiles": { + "type": "array", + "description": "Glob patterns for files to skip when stepping.", + "items": { + "type": "string" + }, + "default": [ + "/**" + ] + }, + "smartStep": { "type": "boolean", - "description": "Whether the watch and reconnect on file change.", + "description": "Automatically step through code that has no source mapping.", "default": true }, - "sourceMapPathOverrides": { - "type": "object", - "description": "A set of mappings for rewriting the locations of source files from what the sourcemap says, to their locations on the disk.", - "default": null + "trace": { + "type": [ + "boolean", + "object" + ], + "description": "Enable js-debug's diagnostic logging.", + "default": false + }, + "diagnosticLogging": { + "type": "boolean", + "default": false, + "deprecationMessage": "Use 'trace' instead." } } } } } + ], + "breakpoints": [ + { + "language": "javascript" + }, + { + "language": "typescript" + } ] } } diff --git a/scripts/write-ga-config.mjs b/scripts/write-ga-config.mjs new file mode 100644 index 0000000..8e460a1 --- /dev/null +++ b/scripts/write-ga-config.mjs @@ -0,0 +1,18 @@ +// Writes out/ga-config.json from GA_MEASUREMENT_ID / GA_API_SECRET so release builds can send analytics. +// The API secret must never be committed; set it in the release environment (e.g. a CI secret). +import { mkdirSync, rmSync, writeFileSync } from 'node:fs'; +import { dirname, join } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const outFile = join(dirname(fileURLToPath(import.meta.url)), '..', 'out', 'ga-config.json'); +const measurementId = process.env.GA_MEASUREMENT_ID ?? ''; +const apiSecret = process.env.GA_API_SECRET ?? ''; + +if (!measurementId || !apiSecret) { + rmSync(outFile, { force: true }); + console.warn('GA_MEASUREMENT_ID or GA_API_SECRET not set; packaging without analytics.'); +} else { + mkdirSync(dirname(outFile), { recursive: true }); + writeFileSync(outFile, JSON.stringify({ measurementId, apiSecret }) + '\n'); + console.log(`Wrote analytics config for ${measurementId}.`); +} diff --git a/src/analytics/analyticsBaseInfo.ts b/src/analytics/analyticsBaseInfo.ts deleted file mode 100644 index ec49a66..0000000 --- a/src/analytics/analyticsBaseInfo.ts +++ /dev/null @@ -1,13 +0,0 @@ -export enum OperatingSystem { - Windows, - Linux, - OSX, - Other, -} - -export interface IAnalyticsBaseInfo { - operatingSystem: OperatingSystem; - cliVersion: string; - extensionVersion: string; - clientId: string; -} diff --git a/src/analytics/analyticsService.ts b/src/analytics/analyticsService.ts index 9d6c08e..81b2d44 100644 --- a/src/analytics/analyticsService.ts +++ b/src/analytics/analyticsService.ts @@ -1,126 +1,79 @@ -import * as _ from 'lodash'; -import { v4 as uuidv4 } from 'uuid'; +import { randomUUID } from 'crypto'; import * as vscode from 'vscode'; import { ILogger } from '../common/logger'; -import { services } from '../services/extensionHostServices'; -import { IAnalyticsBaseInfo, OperatingSystem } from './analyticsBaseInfo'; -import { GUAService } from './guaService'; +import { WorkspaceConfigService } from '../common/workspaceConfigService'; +import { Ga4Client, Ga4Config, Ga4Params, loadGa4Config } from './ga4Client'; -export class AnalyticsService { - private static HAS_ANALYTICS_PROMPT_SHOWN_KEY = 'nativescript.hasAnalyticsPromptShown'; - private static CLIENT_ID_KEY = 'nativescript.analyticsClientId'; - private static DOCS_LINK = - 'https://github.com/NativeScript/nativescript-vscode-extension/blob/master/README.md#how-to-disable-the-analytics'; - private static ANALYTICS_PROMPT_MESSAGE = `Help us improve the NativeScript extension by allowing Progress to collect anonymous usage data. - For more information about the gathered information and how it is used, - read our [privacy statement](https://www.progress.com/legal/privacy-policy). - You can [disable the analytics and data collection](${AnalyticsService.DOCS_LINK}) at any given time. - Do you want to enable analytics?`; - - private static ANALYTICS_PROMPT_ACCEPT_ACTION = 'Yes'; - private static ANALYTICS_PROMPT_DENY_ACTION = 'No'; +const PROMPT_SHOWN_KEY = 'nativescript.hasAnalyticsPromptShown'; +const CLIENT_ID_KEY = 'nativescript.analyticsClientId'; +const DOCS_LINK = + 'https://github.com/nativescript-community/nativescript-vscode-extension/blob/master/README.md#how-to-disable-the-analytics'; +const PROMPT_MESSAGE = `Help improve the NativeScript extension by sending anonymous usage statistics? You can [disable it](${DOCS_LINK}) at any time.`; +const ACCEPT = 'Yes'; +const DENY = 'No'; - private static getOperatingSystem(): OperatingSystem { - switch (process.platform) { - case 'win32': - return OperatingSystem.Windows; - case 'darwin': - return OperatingSystem.OSX; - case 'linux': - case 'freebsd': - return OperatingSystem.Linux; - default: - return OperatingSystem.Other; +export class AnalyticsService { + private client: Ga4Client | undefined; + private readonly sessionId = randomUUID(); + private cliVersion: string | undefined; + + constructor( + private readonly globalState: vscode.Memento, + private readonly workspaceConfig: WorkspaceConfigService, + private readonly logger: ILogger, + private readonly extensionVersion: string, + private readonly config: Ga4Config | undefined = loadGa4Config(), + ) {} + + public initialize(cliVersion: string): void { + this.cliVersion = cliVersion; + + // Nothing to ask for when this build can't send anything. + if (!this.config || !vscode.env.isTelemetryEnabled) return; + + if (!this.globalState.get(PROMPT_SHOWN_KEY)) { + void vscode.window.showInformationMessage(PROMPT_MESSAGE, ACCEPT, DENY).then(async (result) => { + await this.globalState.update(PROMPT_SHOWN_KEY, true); + await this.workspaceConfig.setAnalyticsEnabled(result === ACCEPT); + }); } } - private _globalState: vscode.Memento; - private _logger: ILogger; - private _baseInfo: IAnalyticsBaseInfo; - private _gua!: GUAService; - private _analyticsEnabled!: boolean; - - constructor(globalState: vscode.Memento, cliVersion: string, extensionVersion: string, logger: ILogger) { - this._globalState = globalState; - this._logger = logger; - - vscode.workspace.onDidChangeConfiguration(() => this.updateAnalyticsEnabled()); - - this._baseInfo = { - cliVersion, - clientId: this.getOrGenerateClientId(), - extensionVersion, - operatingSystem: AnalyticsService.getOperatingSystem(), - }; + public trackDebug(request: string, platform: string): Promise { + return this.track('debug', { request, platform }); } - public launchDebugger(request: string, platform: string): Promise { - if (this._analyticsEnabled) { - try { - return this._gua.launchDebugger(request, platform); - } catch (e) { - this._logger.log(`Analytics error: ${_.isString(e) ? e : (e as Error).message}`); - } - } - - return Promise.resolve(); + public trackRun(platform: string): Promise { + return this.track('run', { platform }); } - public runRunCommand(platform: string): Promise { - if (this._analyticsEnabled) { - try { - return this._gua.runRunCommand(platform); - } catch (e) { - this._logger.log(`Analytics error: ${_.isString(e) ? e : (e as Error).message}`); - } + private async track(name: string, params: Ga4Params): Promise { + // Respect both our own opt-in and VS Code's global telemetry setting. + if (!this.config || !vscode.env.isTelemetryEnabled || !this.workspaceConfig.isAnalyticsEnabled) return; + + try { + this.client ??= new Ga4Client(this.config, await this.getOrCreateClientId()); + await this.client.sendEvent(name, { + event_category: 'VSCode', + client: 'VSCode', + cli_version: this.cliVersion, + extension_version: this.extensionVersion, + vscode_version: vscode.version, + os: process.platform, + session_id: this.sessionId, + ...params, + }); + } catch (e) { + this.logger.log(`Analytics error: ${e instanceof Error ? e.message : String(e)}`); } - - return Promise.resolve(); } - public initialize(): void { - const hasAnalyticsPromptShown = this._globalState.get(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY); - - if (!hasAnalyticsPromptShown) { - vscode.window - .showInformationMessage( - AnalyticsService.ANALYTICS_PROMPT_MESSAGE, - AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION, - AnalyticsService.ANALYTICS_PROMPT_DENY_ACTION, - ) - .then((result) => this.onAnalyticsMessageConfirmation(result)); - - return; - } - - this.updateAnalyticsEnabled(); - } - - private getOrGenerateClientId(): string { - let clientId = this._globalState.get(AnalyticsService.CLIENT_ID_KEY); - + private async getOrCreateClientId(): Promise { + let clientId = this.globalState.get(CLIENT_ID_KEY); if (!clientId) { - clientId = uuidv4(); - this._globalState.update(AnalyticsService.CLIENT_ID_KEY, clientId); + clientId = randomUUID(); + await this.globalState.update(CLIENT_ID_KEY, clientId); } - return clientId; } - - private onAnalyticsMessageConfirmation(result: string | undefined): void { - const shouldEnableAnalytics = result === AnalyticsService.ANALYTICS_PROMPT_ACCEPT_ACTION ? true : false; - - this._globalState.update(AnalyticsService.HAS_ANALYTICS_PROMPT_SHOWN_KEY, true); - - services.workspaceConfigService.isAnalyticsEnabled = shouldEnableAnalytics; - this.updateAnalyticsEnabled(); - } - - private updateAnalyticsEnabled() { - this._analyticsEnabled = services.workspaceConfigService.isAnalyticsEnabled; - - if (this._analyticsEnabled && !this._gua) { - this._gua = new GUAService('UA-111455-29', this._baseInfo); - } - } } diff --git a/src/analytics/ga4Client.ts b/src/analytics/ga4Client.ts new file mode 100644 index 0000000..320d062 --- /dev/null +++ b/src/analytics/ga4Client.ts @@ -0,0 +1,69 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +export interface Ga4Config { + measurementId: string; + apiSecret: string; +} + +export type Ga4Params = Record; + +/** Written by scripts/write-ga-config.mjs at package time; absent in dev builds, which disables analytics. */ +export const GA_CONFIG_FILE = path.join(__dirname, '..', 'ga-config.json'); + +const ENDPOINT = 'https://www.google-analytics.com/mp/collect'; +// GA4 Measurement Protocol limits. +const MAX_EVENT_NAME_LENGTH = 40; +const MAX_PARAM_VALUE_LENGTH = 100; + +export function loadGa4Config(file = GA_CONFIG_FILE): Ga4Config | undefined { + try { + const config = JSON.parse(fs.readFileSync(file, 'utf8')) as Partial; + return config.measurementId && config.apiSecret + ? { measurementId: config.measurementId, apiSecret: config.apiSecret } + : undefined; + } catch { + return undefined; + } +} + +/** Same normalization as the CLI's google-analytics-provider so event names line up across both. */ +export function toEventName(name: string): string { + const normalized = name + .replace(/[^A-Za-z0-9_]/g, '_') + .replace(/^[^A-Za-z]+/, '') + .slice(0, MAX_EVENT_NAME_LENGTH); + return normalized || 'vscode_event'; +} + +export class Ga4Client { + constructor( + private readonly config: Ga4Config, + private readonly clientId: string, + private readonly fetchImpl: typeof fetch = fetch, + ) {} + + public async sendEvent(name: string, params: Ga4Params): Promise { + const url = `${ENDPOINT}?measurement_id=${encodeURIComponent(this.config.measurementId)}&api_secret=${encodeURIComponent(this.config.apiSecret)}`; + + const eventParams: Record = { engagement_time_msec: 1 }; + for (const [key, value] of Object.entries(params)) { + if (value === undefined) continue; + eventParams[key] = typeof value === 'string' ? value.slice(0, MAX_PARAM_VALUE_LENGTH) : value; + } + + const response = await this.fetchImpl(url, { + method: 'POST', + headers: { 'Content-Type': 'application/json' }, + body: JSON.stringify({ + client_id: this.clientId, + non_personalized_ads: true, + events: [{ name: toEventName(name), params: eventParams }], + }), + }); + + if (!response.ok) { + throw new Error(`GA4 responded with HTTP ${response.status}`); + } + } +} diff --git a/src/analytics/guaService.ts b/src/analytics/guaService.ts deleted file mode 100644 index 55af35d..0000000 --- a/src/analytics/guaService.ts +++ /dev/null @@ -1,52 +0,0 @@ -import * as ua from 'universal-analytics'; -import { IAnalyticsBaseInfo, OperatingSystem } from './analyticsBaseInfo'; - -/** - * Google Universal Analytics Service - */ -export class GUAService { - private _visitor: ua.Visitor; - private _getBasePayload: () => any; - - constructor(trackingId: string, baseInfo: IAnalyticsBaseInfo) { - const proxy = process.env.HTTP_PROXY || process.env.HTTPS_PROXY; - const requestOptions = proxy ? { proxy } : {}; - - this._visitor = ua(trackingId, baseInfo.clientId, { requestOptions, strictCidFormat: false }); - this._getBasePayload = () => { - return { - cd5: baseInfo.cliVersion, - cd6: OperatingSystem[baseInfo.operatingSystem], - cd7: baseInfo.extensionVersion, - cid: baseInfo.clientId, - dh: 'ns-vs-extension.org', - }; - }; - } - - public launchDebugger(request: string, platform: string): Promise { - const payload = this._getBasePayload(); - - payload.ec = 'vscode-extension-debug'; // event category - payload.ea = `debug-${request}-on-${platform}`; // event action - - return this.sendEvent(payload); - } - - public runRunCommand(platform: string): Promise { - const payload = this._getBasePayload(); - - payload.ec = 'vscode-extension-command'; // event category - payload.ea = `command-run-on-${platform}`; // event action - - return this.sendEvent(payload); - } - - private sendEvent(params: any): Promise { - return new Promise((res, rej) => { - this._visitor.event(params, (err) => { - return err ? rej(err) : res(); - }); - }); - } -} diff --git a/src/common/utilities.ts b/src/common/utilities.ts index ca3b4e2..22d101f 100644 --- a/src/common/utilities.ts +++ b/src/common/utilities.ts @@ -1,10 +1,9 @@ import { ChildProcess, execSync } from 'child_process'; import * as os from 'os'; -import * as path from 'path'; import { ILogger, LogLevel } from '../common/logger'; export function killProcess(childProcess: ChildProcess, logger?: ILogger): void { - logger && logger.log(`Stopping process: ${childProcess.pid}`); + logger?.log(`Stopping process: ${childProcess.pid}`); try { switch (process.platform) { @@ -18,7 +17,7 @@ export function killProcess(childProcess: ChildProcess, logger?: ILogger): void break; } } catch (error) { - logger && logger.log(error as string, LogLevel.Error); + logger?.log(String(error), LogLevel.Error); } } diff --git a/src/common/workspaceConfigService.ts b/src/common/workspaceConfigService.ts index 0b08ae4..13776fe 100644 --- a/src/common/workspaceConfigService.ts +++ b/src/common/workspaceConfigService.ts @@ -2,16 +2,16 @@ import * as vscode from 'vscode'; export class WorkspaceConfigService { public get isAnalyticsEnabled(): boolean { - return vscode.workspace.getConfiguration('nativescript').get('analytics.enabled') as boolean; + return vscode.workspace.getConfiguration('nativescript').get('analytics.enabled', false); } - public set isAnalyticsEnabled(isAnalyticsEnabled: boolean) { - vscode.workspace + public async setAnalyticsEnabled(enabled: boolean): Promise { + await vscode.workspace .getConfiguration('nativescript') - .update('analytics.enabled', isAnalyticsEnabled, vscode.ConfigurationTarget.Global); + .update('analytics.enabled', enabled, vscode.ConfigurationTarget.Global); } public get nsPath(): string { - return vscode.workspace.getConfiguration('nativescript').get('nsPath', 'ns'); + return vscode.workspace.getConfiguration('nativescript').get('nsPath', 'ns'); } } diff --git a/src/debug-adapter/debugManager.ts b/src/debug-adapter/debugManager.ts index a0d2af0..1e70b70 100644 --- a/src/debug-adapter/debugManager.ts +++ b/src/debug-adapter/debugManager.ts @@ -1,115 +1,154 @@ -import * as fs from 'fs'; -import * as path from 'path'; import * as vscode from 'vscode'; +import { ILogger } from '../common/logger'; import { BuildSession } from '../services/buildService'; import { services } from '../services/extensionHostServices'; -import { ILogger } from '../common/logger'; +import { computeSourceMapOptions, SourceMapOptions } from './sourceMaps'; export type SessionTerminatedCallback = () => void; +/** The launch.json attributes declared in package.json (contributes.debuggers[0].configurationAttributes). */ +export interface NativeScriptDebugConfiguration extends vscode.DebugConfiguration { + platform: string; + appRoot?: string; + webRoot?: string; + watch?: boolean; + stopOnEntry?: boolean; + launchTests?: boolean; + tnsArgs?: string[]; + address?: string; + sourceMaps?: boolean; + sourceMapPathOverrides?: Record; + resolveSourceMapLocations?: string[] | null; + skipFiles?: string[]; + smartStep?: boolean; + trace?: boolean | Record; + diagnosticLogging?: boolean; +} + +/** Stamped on child configs so onDidStartDebugSession can tell which parent a js-debug session belongs to. */ +export const PARENT_SESSION_KEY = '__nativescriptParentSessionId'; + +/** How long to wait for the app to come back with a new debug port after its socket drops in watch mode. */ +export const RECONNECT_TIMEOUT_MS = 60_000; + +const CHILD_START_ATTEMPTS = 3; +const CHILD_RETRY_DELAY_MS = 1000; +const CHILD_STOP_SETTLE_MS = 500; + interface ActiveSession { - buildSession: BuildSession; - childSession: vscode.DebugSession | null; - config: vscode.DebugConfiguration; + parentSession: vscode.DebugSession; + config: NativeScriptDebugConfiguration; + appRoot: string; folder: vscode.WorkspaceFolder | undefined; onTerminated: SessionTerminatedCallback; + buildSession: BuildSession | null; + sourceMapOptions: Promise | null; + childSession: vscode.DebugSession | null; + /** Child sessions we stopped on purpose; their termination must not end the parent. */ + replacedChildIds: Set; + /** Serializes child (re)starts so two quick port announcements can't race. */ + childQueue: Promise; + reconnectTimer: NodeJS.Timeout | null; stopping: boolean; - restartPending: boolean; } -export class DebugManager { +const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms)); + +export class DebugManager implements vscode.Disposable { private activeSessions = new Map(); - private logger: ILogger; private disposables: vscode.Disposable[] = []; - constructor(logger: ILogger) { - this.logger = logger; - + constructor(private readonly logger: ILogger) { this.disposables.push( - vscode.debug.onDidTerminateDebugSession((session) => { - this.logger.log(`[NativeScript] Session terminated: ${session.name} (type=${session.type})\n`); - - if (session.type === 'nativescript') { - this.onParentSessionTerminated(session); - return; - } - - for (const [parentId, active] of this.activeSessions) { - if (active.childSession === session) { - active.childSession = null; - - if (active.stopping) return; - - if (!active.restartPending) { - this.logger.log('[NativeScript] Child session ended, stopping parent\n'); - active.onTerminated(); - this.cleanup(parentId); - } else { - this.logger.log('[NativeScript] Child session ended, restart pending\n'); - } - } - } - }), + vscode.debug.onDidStartDebugSession((session) => this.onSessionStarted(session)), + vscode.debug.onDidTerminateDebugSession((session) => this.onSessionTerminated(session)), ); } public async startDebugging( parentSession: vscode.DebugSession, - config: vscode.DebugConfiguration, + config: NativeScriptDebugConfiguration, onTerminated: SessionTerminatedCallback, ): Promise { - const folder = vscode.workspace.workspaceFolders?.[0]; - const appRoot = config.appRoot || config.webRoot || folder?.uri.fsPath || ''; + const fallbackFolder = parentSession.workspaceFolder ?? vscode.workspace.workspaceFolders?.[0]; + const appRoot = config.appRoot || config.webRoot || fallbackFolder?.uri.fsPath || ''; + const folder = (appRoot && vscode.workspace.getWorkspaceFolder(vscode.Uri.file(appRoot))) || fallbackFolder; this.logger.log(`[NativeScript] appRoot: ${appRoot}\n`); - const buildSession = await services.buildService.startBuild({ - appRoot, - platform: config.platform, - request: config.request, - watch: config.watch, - stopOnEntry: config.stopOnEntry, - launchTests: config.launchTests, - tnsArgs: config.tnsArgs, - }); - const active: ActiveSession = { - buildSession, - childSession: null, + parentSession, config, + appRoot, folder, onTerminated, + buildSession: null, + sourceMapOptions: null, + childSession: null, + replacedChildIds: new Set(), + childQueue: Promise.resolve(), + reconnectTimer: null, stopping: false, - restartPending: false, }; + // Registered before any await so a stop during the build (or the iOS team picker) is honored. this.activeSessions.set(parentSession.id, active); - buildSession.portEmitter.on('newPort', (port: number) => { + let buildSession: BuildSession | null; + try { + buildSession = await services.buildService.startBuild( + { + appRoot, + platform: config.platform, + request: config.request, + watch: config.watch, + stopOnEntry: config.stopOnEntry, + launchTests: config.launchTests, + tnsArgs: config.tnsArgs, + }, + () => active.stopping, + ); + } catch (e) { + this.cleanup(parentSession.id); + void vscode.window.showErrorMessage(e instanceof Error ? e.message : String(e)); + throw e; + } + + if (!buildSession || active.stopping) { + buildSession?.disconnect(); + this.cleanup(parentSession.id); + return false; + } + + active.buildSession = buildSession; + + buildSession.on('newPort', (port: number) => { if (active.stopping) return; - this.logger.log(`[NativeScript] LiveSync restart detected, new port: ${port}\n`); - active.restartPending = true; - this.startChildSession(parentSession, active, port); + this.logger.log(`[NativeScript] App restarted, new debug port: ${port}\n`); + this.clearReconnectTimer(active); + void this.queueChildStart(active, port); }); - buildSession.portEmitter.on('closed', () => { + buildSession.on('closed', () => { this.logger.log('[NativeScript] ns process closed\n'); - if (!active.stopping) { - active.onTerminated(); - this.cleanup(parentSession.id); - } + this.terminate(active); }); const port = await buildSession.initialPort; - if (!port) { + if (!port || active.stopping) { this.logger.log('[NativeScript] No debug port received, terminating\n'); this.cleanup(parentSession.id); return false; } - await this.startChildSession(parentSession, active, port); - return true; + const attached = await this.queueChildStart(active, port); + if (!attached && !active.stopping) { + this.cleanup(parentSession.id); + void vscode.window.showErrorMessage(`Could not attach the debugger to the app on port ${port}.`); + return false; + } + return !active.stopping; } public stopDebugging(parentSessionId: string): void { @@ -117,197 +156,170 @@ export class DebugManager { } public dispose(): void { - for (const [id] of this.activeSessions) { + for (const id of [...this.activeSessions.keys()]) { this.cleanup(id); } - this.disposables.forEach((d) => d.dispose()); + for (const disposable of this.disposables) { + disposable.dispose(); + } + this.disposables = []; } - private async startChildSession( - parentSession: vscode.DebugSession, - active: ActiveSession, - port: number, - ): Promise { - if (active.stopping) return; + /** Resolves with whether a child session was started. */ + private queueChildStart(active: ActiveSession, port: number): Promise { + const result = active.childQueue + .then(() => this.startChildSession(active, port)) + .catch((e: unknown) => { + this.logger.log(`[NativeScript] Failed to start child debug session: ${String(e)}\n`); + return false; + }); + active.childQueue = result.then(() => undefined); + return result; + } - if (active.childSession) { - await vscode.debug.stopDebugging(active.childSession); + private async startChildSession(active: ActiveSession, port: number): Promise { + if (active.stopping) return false; + + const previous = active.childSession; + if (previous) { + active.replacedChildIds.add(previous.id); active.childSession = null; - await new Promise((r) => setTimeout(r, 500)); + await vscode.debug.stopDebugging(previous); + await delay(CHILD_STOP_SETTLE_MS); } - if (active.stopping) return; + if (active.stopping) return false; const config = active.config; - const address = this.getNormalizedAddress(config.address, config.platform); - const sourceMapPathOverrides = this.computeSourceMapPathOverrides(config); + const address = getNormalizedAddress(config.address, config.platform); + // Computed on first attach: platforms/ (used for device map fallbacks) only exists once the build finished. + active.sourceMapOptions ??= computeSourceMapOptions( + active.appRoot, + { + platform: config.platform, + sourceMapPathOverrides: config.sourceMapPathOverrides, + resolveSourceMapLocations: config.resolveSourceMapLocations, + }, + this.logger, + ); + const sourceMapOptions = await active.sourceMapOptions; const childConfig: vscode.DebugConfiguration = { type: 'pwa-node', request: 'attach', name: config.name, websocketAddress: `ws://${address}:${port}`, - sourceMapPathOverrides, + ...sourceMapOptions, + sourceMaps: config.sourceMaps, skipFiles: config.skipFiles, smartStep: config.smartStep, - trace: config.diagnosticLogging ? true : config.trace, - stopOnEntry: config.stopOnEntry, + trace: config.trace ?? (config.diagnosticLogging || undefined), + [PARENT_SESSION_KEY]: active.parentSession.id, }; this.logger.log(`[NativeScript] Starting child debug session on ws://${address}:${port}\n`); - for (let attempt = 0; attempt < 3; attempt++) { - if (active.stopping) return; + for (let attempt = 1; attempt <= CHILD_START_ATTEMPTS; attempt++) { + if (active.stopping) return false; const started = await vscode.debug.startDebugging(active.folder, childConfig, { - parentSession, + parentSession: active.parentSession, lifecycleManagedByParent: true, compact: true, }); - if (started) { - const childSession = vscode.debug.activeDebugSession; - if (childSession && childSession.parentSession === parentSession) { - active.childSession = childSession; - } - active.restartPending = false; - return; - } - - this.logger.log(`[NativeScript] Child session attempt ${attempt + 1} failed, retrying...\n`); - await new Promise((r) => setTimeout(r, 1000)); - } + if (started) return true; - active.restartPending = false; - this.logger.log('[NativeScript] Failed to start child debug session after 3 attempts\n'); - } + this.logger.log(`[NativeScript] Child session attempt ${attempt} failed\n`); + await delay(CHILD_RETRY_DELAY_MS); + } - private onParentSessionTerminated(session: vscode.DebugSession): void { - this.cleanup(session.id); + this.logger.log(`[NativeScript] Failed to start child debug session after ${CHILD_START_ATTEMPTS} attempts\n`); + return false; } - private cleanup(parentSessionId: string): void { - const active = this.activeSessions.get(parentSessionId); - if (!active) return; - - active.stopping = true; - active.buildSession.portEmitter.removeAllListeners(); - active.buildSession.disconnect(); + private onSessionStarted(session: vscode.DebugSession): void { + const parentId: unknown = session.configuration[PARENT_SESSION_KEY]; + if (typeof parentId !== 'string') return; - if (active.childSession) { - vscode.debug.stopDebugging(active.childSession); + const active = this.activeSessions.get(parentId); + if (!active) { + // The parent was stopped while this child's startDebugging was still in flight. + void vscode.debug.stopDebugging(session); + return; } - this.activeSessions.delete(parentSessionId); + active.childSession = session; + this.clearReconnectTimer(active); } - private getNormalizedAddress(address: string | undefined, platform: string): string { - if (address) return address; - return platform?.toLowerCase() === 'ios' ? 'localhost' : '127.0.0.1'; - } + private onSessionTerminated(session: vscode.DebugSession): void { + this.logger.log(`[NativeScript] Session terminated: ${session.name} (type=${session.type})\n`); - private computeSourceMapPathOverrides(config: vscode.DebugConfiguration): Record { - const overrides: Record = config.sourceMapPathOverrides ? { ...config.sourceMapPathOverrides } : {}; - const webRoot = config.appRoot || config.webRoot || ''; - const appDirPath = this.getAppDirPath(webRoot); - const fullAppDirPath = appDirPath - ? path.join(webRoot, appDirPath) - : path.join(webRoot, this.isAngularProject(webRoot) ? 'src' : 'app'); + if (this.activeSessions.has(session.id)) { + this.cleanup(session.id); + return; + } + + const parentId: unknown = session.configuration[PARENT_SESSION_KEY]; + const active = typeof parentId === 'string' ? this.activeSessions.get(parentId) : undefined; + if (!active) return; - if (!overrides['webpack:///*']) { - overrides['webpack:///*'] = `${fullAppDirPath}/*`; + if (active.childSession?.id === session.id) { + active.childSession = null; } - const packageFilePath = path.join(webRoot, 'package.json'); - if (fs.existsSync(packageFilePath)) { - try { - const packageFile = JSON.parse(fs.readFileSync(packageFilePath, 'utf8')) as { name?: string }; - const extensions = ['js', 'ts', 'vue', 'svelte', 'jsx', 'tsx']; - - const webpackConfig = this.getWebpackConfig(webRoot, config.platform?.toLowerCase()); - let sourceMap = packageFile.name ?? ''; - if (webpackConfig?.output?.devtoolNamespace) { - sourceMap = webpackConfig.output.devtoolNamespace; - } - - for (const ext of extensions) { - overrides[`webpack://${sourceMap}/*.${ext}`] = `${webRoot}/*.${ext}`; - } - - if (webpackConfig?.output?.library) { - const key = `webpack://${webpackConfig.output.library}/*`; - overrides[key] = overrides[key] || `${fullAppDirPath}/*`; - } - } catch { - this.logger.log(`[NativeScript] Warning: could not read ${packageFilePath}\n`); - } + if (active.replacedChildIds.delete(session.id) || active.stopping) return; + + if (active.config.watch && active.buildSession) { + // A LiveSync restart drops the socket before the CLI announces the new port. + this.logger.log('[NativeScript] Debugger disconnected, waiting for the app to restart\n'); + this.clearReconnectTimer(active); + active.reconnectTimer = setTimeout(() => { + this.logger.log('[NativeScript] App did not reconnect in time, stopping\n'); + this.terminate(active); + }, RECONNECT_TIMEOUT_MS); + return; } - return overrides; + this.logger.log('[NativeScript] Child session ended, stopping parent\n'); + this.terminate(active); } - private getAppDirPath(webRoot: string): string | undefined { - const pathToNsconfig = path.join(webRoot, 'nsconfig.json'); - const pathToNativeScriptConfig = path.join(webRoot, 'nativescript.config.ts'); - - if (fs.existsSync(pathToNsconfig)) { - try { - const content = fs.readFileSync(pathToNsconfig, 'utf8'); - const jsonContent = JSON.parse(content); - return jsonContent.appPath; - } catch { - // ignore - } - } else if (fs.existsSync(pathToNativeScriptConfig)) { - try { - const configContent = fs.readFileSync(pathToNativeScriptConfig, 'utf8'); - if (configContent.indexOf(`appPath: 'src'`) === -1) { - const appPath = configContent.split(/appPath:\s*["'`](\w+)["'`]/im)[1]; - return appPath; - } - } catch { - // ignore - } - } - - return undefined; + private terminate(active: ActiveSession): void { + if (active.stopping) return; + this.cleanup(active.parentSession.id); + active.onTerminated(); } - private isAngularProject(webRoot: string): boolean { - if (fs.existsSync(path.join(webRoot, 'angular.json'))) { - return true; + private clearReconnectTimer(active: ActiveSession): void { + if (active.reconnectTimer) { + clearTimeout(active.reconnectTimer); + active.reconnectTimer = null; } + } - const packageJsonPath = path.join(webRoot, 'package.json'); - if (fs.existsSync(packageJsonPath)) { - try { - const content = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')); - return !!content?.dependencies?.['@angular/core']; - } catch { - // ignore - } - } + private cleanup(parentSessionId: string): void { + const active = this.activeSessions.get(parentSessionId); + if (!active) return; - return false; - } + active.stopping = true; + this.activeSessions.delete(parentSessionId); + this.clearReconnectTimer(active); - private getWebpackConfig( - webRoot: string, - platform?: string, - ): { output?: { library?: string; devtoolNamespace?: string } } | null { - const webpackConfigFile = path.join(webRoot, 'webpack.config.js'); - if (!fs.existsSync(webpackConfigFile) || !platform) return null; + if (active.buildSession) { + active.buildSession.removeAllListeners(); + active.buildSession.disconnect(); + } - const savedCwd = process.cwd(); - try { - process.chdir(webRoot); - const webpackConfig = require(webpackConfigFile); - const result = webpackConfig({ [platform]: platform }); - process.chdir(savedCwd); - return result; - } catch { - process.chdir(savedCwd); - return null; + if (active.childSession) { + void vscode.debug.stopDebugging(active.childSession); + active.childSession = null; } } } + +export function getNormalizedAddress(address: string | undefined, platform: string | undefined): string { + if (address) return address; + return platform?.toLowerCase() === 'ios' ? 'localhost' : '127.0.0.1'; +} diff --git a/src/debug-adapter/nativeScriptDebugAdapter.ts b/src/debug-adapter/nativeScriptDebugAdapter.ts index 642b3c0..cd0e92a 100644 --- a/src/debug-adapter/nativeScriptDebugAdapter.ts +++ b/src/debug-adapter/nativeScriptDebugAdapter.ts @@ -1,6 +1,6 @@ import { DebugSession, InitializedEvent, TerminatedEvent, OutputEvent } from '@vscode/debugadapter'; import { DebugProtocol } from '@vscode/debugprotocol'; -import { DebugManager } from './debugManager'; +import { DebugManager, NativeScriptDebugConfiguration } from './debugManager'; import * as vscode from 'vscode'; export class NativeScriptDebugAdapter extends DebugSession { @@ -16,43 +16,43 @@ export class NativeScriptDebugAdapter extends DebugSession { this.parentSession = session; } - protected initializeRequest( + protected override initializeRequest( response: DebugProtocol.InitializeResponse, _args: DebugProtocol.InitializeRequestArguments, ): void { + // No supportsRestartRequest: VS Code then restarts by terminating and relaunching the session. response.body = { supportsTerminateRequest: true, - supportsRestartRequest: true, }; this.sendResponse(response); this.sendEvent(new InitializedEvent()); } - protected async launchRequest( + protected override launchRequest( response: DebugProtocol.LaunchResponse, args: DebugProtocol.LaunchRequestArguments, - ): Promise { + ): void { this.sendResponse(response); - await this.startDebugSession(args); + void this.startDebugSession(args); } - protected async attachRequest( + protected override attachRequest( response: DebugProtocol.AttachResponse, args: DebugProtocol.AttachRequestArguments, - ): Promise { + ): void { this.sendResponse(response); - await this.startDebugSession(args); + void this.startDebugSession(args); } - protected configurationDoneRequest( + protected override configurationDoneRequest( response: DebugProtocol.ConfigurationDoneResponse, _args: DebugProtocol.ConfigurationDoneArguments, ): void { this.sendResponse(response); } - protected disconnectRequest( + protected override disconnectRequest( response: DebugProtocol.DisconnectResponse, _args: DebugProtocol.DisconnectArguments, ): void { @@ -62,7 +62,10 @@ export class NativeScriptDebugAdapter extends DebugSession { this.sendResponse(response); } - protected terminateRequest(response: DebugProtocol.TerminateResponse, _args: DebugProtocol.TerminateArguments): void { + protected override terminateRequest( + response: DebugProtocol.TerminateResponse, + _args: DebugProtocol.TerminateArguments, + ): void { if (this.parentSession) { this.debugManager.stopDebugging(this.parentSession.id); } @@ -70,7 +73,7 @@ export class NativeScriptDebugAdapter extends DebugSession { this.sendEvent(new TerminatedEvent()); } - protected threadsRequest(response: DebugProtocol.ThreadsResponse): void { + protected override threadsRequest(response: DebugProtocol.ThreadsResponse): void { response.body = { threads: [] }; this.sendResponse(response); } @@ -85,7 +88,7 @@ export class NativeScriptDebugAdapter extends DebugSession { } try { - const config = { ...args } as vscode.DebugConfiguration; + const config = { ...args } as NativeScriptDebugConfiguration; const started = await this.debugManager.startDebugging(this.parentSession, config, () => { this.sendEvent(new TerminatedEvent()); }); diff --git a/src/debug-adapter/sourceMaps.ts b/src/debug-adapter/sourceMaps.ts new file mode 100644 index 0000000..fbfe1aa --- /dev/null +++ b/src/debug-adapter/sourceMaps.ts @@ -0,0 +1,195 @@ +import { execFile } from 'child_process'; +import * as fs from 'fs'; +import * as path from 'path'; +import { ILogger } from '../common/logger'; +import { getAppDirectory, readPackageJson } from '../project/projectInfo'; + +const SOURCE_EXTENSIONS = ['js', 'mjs', 'ts', 'mts', 'vue', 'svelte', 'jsx', 'tsx']; +const PROBE_MARKER = '__NS_WEBPACK_OUTPUT__'; +const PROBE_TIMEOUT_MS = 30_000; + +// Runs in a separate node process with cwd = app root, so the user's webpack config can't touch extension host state. +const WEBPACK_OUTPUT_PROBE = ` +const path = require('path'); +const platform = process.env.NS_PLATFORM; +const exported = require(path.resolve('webpack.config.js')); +Promise.resolve(typeof exported === 'function' ? exported({ [platform]: platform }) : exported).then((config) => { + const output = (Array.isArray(config) ? config[0] : config)?.output ?? {}; + const library = typeof output.library === 'string' ? output.library : output.library?.name; + process.stdout.write('\\n${PROBE_MARKER}' + JSON.stringify({ + devtoolNamespace: typeof output.devtoolNamespace === 'string' ? output.devtoolNamespace : undefined, + library: typeof library === 'string' ? library : undefined, + })); +}); +`; + +export interface WebpackOutputInfo { + devtoolNamespace?: string; + library?: string; +} + +export interface SourceMapOptions { + sourceMapPathOverrides: Record; + /** `null` lets js-debug load maps from anywhere; see computeSourceMapOptions. */ + resolveSourceMapLocations: string[] | null; +} + +export interface SourceMapConfig { + platform?: string; + sourceMapPathOverrides?: Record; + resolveSourceMapLocations?: string[] | null; +} + +export async function computeSourceMapOptions( + appRoot: string, + config: SourceMapConfig, + logger: ILogger, +): Promise { + const webpackOutput = await readWebpackOutput(appRoot, config.platform, logger); + + return { + sourceMapPathOverrides: { + ...deviceMapOverrides(appRoot, config.platform), + ...defaultPathOverrides(appRoot, readPackageJson(appRoot)?.name, webpackOutput), + ...config.sourceMapPathOverrides, + }, + // Scripts run on the device, so their maps are inline data: URLs, device file:// paths or nsruntime:// URLs, + // none of which live under the app root. Restricting locations would make js-debug drop them silently. + resolveSourceMapLocations: config.resolveSourceMapLocations === undefined ? null : config.resolveSourceMapLocations, + }; +} + +/** + * js-debug fetches a non-file map URL over HTTP, then through CDP Network.loadNetworkResource (which runtimes that + * rewrite sourceMapURL to nsruntime:// answer from device disk), and only then maps the URL through + * sourceMapPathOverrides to a local file. These entries are that last fallback: they point device locations at the + * copy of the bundle the CLI left under platforms/. Older runtimes send plain file:// device URLs, which only this + * fallback can resolve. + * + * `?:*` is js-debug's non-capturing wildcard; only one capturing `*` is allowed per key. + */ +export function deviceMapOverrides(appRoot: string, platform: string | undefined): Record { + const overrides: Record = { + // webpack's FixSourceMapUrlPlugin points maps at the host build output; the runtime prefixes that with nsruntime://. + 'nsruntime:///*': '/*', + }; + + const localAppDir = getLocalPlatformAppDir(appRoot, platform); + if (!localAppDir) return overrides; + + const devicePatterns = + platform?.toLowerCase() === 'ios' + ? ['/app/*', '/?:*.app/app/*'] + : // Android exposes the same files as /data/data/ and /data/user/0/. + ['/data/?:*/files/app/*']; + + for (const pattern of devicePatterns) { + overrides[`nsruntime://${pattern}`] = `${localAppDir}/*`; + overrides[`file://${pattern}`] = `${localAppDir}/*`; + } + + return overrides; +} + +/** Where the CLI copies the built app for the platform, or undefined if it hasn't been built yet. */ +export function getLocalPlatformAppDir(appRoot: string, platform: string | undefined): string | undefined { + const normalized = platform?.toLowerCase(); + + if (normalized === 'android') { + const dir = path.join(appRoot, 'platforms', 'android', 'app', 'src', 'main', 'assets', 'app'); + return fs.existsSync(dir) ? dir : undefined; + } + + if (normalized === 'ios') { + const iosDir = path.join(appRoot, 'platforms', 'ios'); + let entries: fs.Dirent[]; + try { + entries = fs.readdirSync(iosDir, { withFileTypes: true }); + } catch { + return undefined; + } + // platforms/ios//app; the project name is derived by the CLI, so find it on disk. + for (const entry of entries) { + const dir = path.join(iosDir, entry.name, 'app'); + if (entry.isDirectory() && !entry.name.endsWith('.xcodeproj') && fs.existsSync(dir)) { + return dir; + } + } + } + + return undefined; +} + +export function defaultPathOverrides( + appRoot: string, + packageName: string | undefined, + webpackOutput: WebpackOutputInfo, +): Record { + const appDir = path.join(appRoot, getAppDirectory(appRoot)); + const overrides: Record = { + 'webpack:///*': `${appDir}/*`, + }; + + // webpack 5 names sources webpack:///./, and uniqueName defaults to the package name. + const namespace = webpackOutput.devtoolNamespace ?? packageName; + if (namespace) { + for (const ext of SOURCE_EXTENSIONS) { + overrides[`webpack://${namespace}/*.${ext}`] = `${appRoot}/*.${ext}`; + } + } + + if (webpackOutput.library) { + overrides[`webpack://${webpackOutput.library}/*`] ??= `${appDir}/*`; + } + + return overrides; +} + +/** + * Only evaluates webpack.config.js when it customizes the fields we need; @nativescript/webpack + * leaves both at their defaults, and loading the config costs seconds. + */ +export async function readWebpackOutput( + appRoot: string, + platform: string | undefined, + logger: ILogger, +): Promise { + const configFile = path.join(appRoot, 'webpack.config.js'); + let content: string; + try { + content = fs.readFileSync(configFile, 'utf8'); + } catch { + return {}; + } + + if (!/\b(devtoolNamespace|library)\b/.test(content)) { + return {}; + } + + return new Promise((resolve) => { + execFile( + process.execPath, + ['-e', WEBPACK_OUTPUT_PROBE], + { + cwd: appRoot, + env: { ...process.env, ELECTRON_RUN_AS_NODE: '1', NS_PLATFORM: platform?.toLowerCase() }, + timeout: PROBE_TIMEOUT_MS, + maxBuffer: 10 * 1024 * 1024, + }, + (error, stdout) => { + const markerIndex = stdout?.lastIndexOf(PROBE_MARKER) ?? -1; + if (error || markerIndex < 0) { + logger.log(`[NativeScript] Could not evaluate ${configFile}: ${error?.message ?? 'no output'}\n`); + resolve({}); + return; + } + + try { + resolve(JSON.parse(stdout.slice(markerIndex + PROBE_MARKER.length)) as WebpackOutputInfo); + } catch { + resolve({}); + } + }, + ); + }); +} diff --git a/src/main.ts b/src/main.ts index df67a55..4a0ad7e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,6 +1,7 @@ -import * as semver from 'semver'; import * as vscode from 'vscode'; import * as utils from './common/utilities'; +import { DebugManager } from './debug-adapter/debugManager'; +import { NativeScriptDebugAdapter } from './debug-adapter/nativeScriptDebugAdapter'; import { AndroidProject } from './project/androidProject'; import { IosProject } from './project/iosProject'; import { Project } from './project/project'; @@ -9,44 +10,28 @@ import { services } from './services/extensionHostServices'; import { COMPLETION_PROVIDER } from './services/language-services/autocomplete'; import { HOVER_PROVIDERS } from './services/language-services/hover/hover'; import { SUGGESTION_PROVIDERS } from './services/language-services/suggestions'; -import { DebugManager } from './debug-adapter/debugManager'; -import { NativeScriptDebugAdapter } from './debug-adapter/nativeScriptDebugAdapter'; -export function activate(context: vscode.ExtensionContext) { - services.globalState = context.globalState; - services.cliPath = 'ns'; +interface ExtensionPackageJson { + version: string; + minNativescriptCliVersion: string; + buildVersion?: string; + commitId?: string; +} +export function activate(context: vscode.ExtensionContext): void { + const packageJSON = context.extension.packageJSON as ExtensionPackageJson; const channel = vscode.window.createOutputChannel('NativeScript Extension'); + context.subscriptions.push(channel); + services.globalState = context.globalState; services.logger = new ChannelLogger(channel); - - const packageJSON = vscode.extensions.getExtension('nativescript.nativescript')!.packageJSON; - const cliVersion = services.cli().executeGetVersion(); - - if (!cliVersion) { - vscode.window.showErrorMessage( - "NativeScript CLI not found. Use 'nativescript.nsPath' workspace setting to explicitly set the absolute path to the NativeScript CLI.", - ); - return; - } - - if (!semver.gte(cliVersion, packageJSON.minNativescriptCliVersion)) { - vscode.window.showErrorMessage( - `The existing NativeScript extension is compatible with NativeScript CLI v${packageJSON.minNativescriptCliVersion} or greater. The currently installed NativeScript CLI is v${cliVersion}. You can update the NativeScript CLI by executing 'npm install -g nativescript'.`, - ); - return; - } - - services.cliVersion = cliVersion; services.extensionVersion = packageJSON.version; + services.minCliVersion = packageJSON.minNativescriptCliVersion; - logExtensionInfo(cliVersion, packageJSON); - - services.analyticsService.initialize(); - + // Registered before the CLI check so a missing CLI surfaces as a launch error instead of an unknown debug type. const debugManager = new DebugManager(services.logger); - context.subscriptions.push( + debugManager, vscode.debug.registerDebugAdapterDescriptorFactory('nativescript', { createDebugAdapterDescriptor(session) { const adapter = new NativeScriptDebugAdapter(debugManager); @@ -56,79 +41,81 @@ export function activate(context: vscode.ExtensionContext) { }), ); - context.subscriptions.push({ dispose: () => debugManager.dispose() }); + context.subscriptions.push( + vscode.commands.registerCommand('nativescript.showOutputChannel', () => channel.show()), + vscode.commands.registerCommand('nativescript.runIos', () => + runCommand(context, (root) => new IosProject(root, services.createCli(root))), + ), + vscode.commands.registerCommand('nativescript.runAndroid', () => + runCommand(context, (root) => new AndroidProject(root, services.createCli(root))), + ), + COMPLETION_PROVIDER, + ...SUGGESTION_PROVIDERS, + ...HOVER_PROVIDERS, + ); - const showOutputChannelCommand = vscode.commands.registerCommand('nativescript.showOutputChannel', () => { - channel.show(); - }); + logExtensionInfo(packageJSON); + void checkCli(); +} - const runCommand = (project: Project) => { - if (!vscode.workspace.workspaceFolders?.length) { - vscode.window.showErrorMessage('No workspace opened.'); - return; - } +async function checkCli(): Promise { + try { + const cliVersion = await services.createCli().getSupportedVersion(services.minCliVersion); + services.logger.log(`NativeScript CLI: ${cliVersion}`); + services.analyticsService.initialize(cliVersion); + } catch (e) { + void vscode.window.showErrorMessage(e instanceof Error ? e.message : String(e)); + } +} - const runChannel = vscode.window.createOutputChannel(`Run on ${project.platformName()}`); - runChannel.clear(); - runChannel.show(); +function runCommand(context: vscode.ExtensionContext, createProject: (root: string) => Project): void { + const root = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; + if (!root) { + void vscode.window.showErrorMessage('No workspace opened.'); + return; + } - services.analyticsService.runRunCommand(project.platformName()); + let project: Project; + try { + project = createProject(root); + } catch (e) { + void vscode.window.showErrorMessage(e instanceof Error ? e.message : String(e)); + return; + } - const tnsProcess = project.run(); - tnsProcess.on('error', () => { - vscode.window.showErrorMessage('Unexpected error executing NativeScript Run command.'); - }); - tnsProcess.stderr!.on('data', (data: Buffer) => { - runChannel.append(data.toString()); - }); - tnsProcess.stdout!.on('data', (data: Buffer) => { - runChannel.append(data.toString()); - }); - tnsProcess.on('exit', () => { - tnsProcess.stdout!.removeAllListeners('data'); - tnsProcess.stderr!.removeAllListeners('data'); - }); - tnsProcess.on('close', () => { - runChannel.hide(); - }); + const runChannel = vscode.window.createOutputChannel(`Run on ${project.platformName()}`); + runChannel.clear(); + runChannel.show(); - const disposable = { - dispose: () => { - services.buildService.disconnect(); - utils.killProcess(tnsProcess); - }, - }; + void services.analyticsService.trackRun(project.platformName()); - context.subscriptions.push(disposable); + const tnsProcess = project.run(); + const disposable = { + dispose: () => { + utils.killProcess(tnsProcess); + runChannel.dispose(); + }, }; + context.subscriptions.push(disposable); - const getWorkspaceRoot = () => vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; - - const runIosCommand = vscode.commands.registerCommand('nativescript.runIos', () => { - const root = getWorkspaceRoot(); - if (root) return runCommand(new IosProject(root, services.cli())); + tnsProcess.on('error', () => { + void vscode.window.showErrorMessage('Unexpected error executing NativeScript Run command.'); }); - - const runAndroidCommand = vscode.commands.registerCommand('nativescript.runAndroid', () => { - const root = getWorkspaceRoot(); - if (root) return runCommand(new AndroidProject(root, services.cli())); + tnsProcess.stderr!.on('data', (data: Buffer | string) => runChannel.append(data.toString())); + tnsProcess.stdout!.on('data', (data: Buffer | string) => runChannel.append(data.toString())); + tnsProcess.on('exit', () => { + tnsProcess.stdout!.removeAllListeners('data'); + tnsProcess.stderr!.removeAllListeners('data'); + }); + tnsProcess.on('close', () => { + runChannel.hide(); + const index = context.subscriptions.indexOf(disposable); + if (index >= 0) context.subscriptions.splice(index, 1); }); - - context.subscriptions.push(runIosCommand); - context.subscriptions.push(runAndroidCommand); - context.subscriptions.push(showOutputChannelCommand); - - context.subscriptions.push(COMPLETION_PROVIDER); - context.subscriptions.concat(SUGGESTION_PROVIDERS); - context.subscriptions.concat(HOVER_PROVIDERS); } -function logExtensionInfo( - cliVersion: string, - packageJSON: { version?: string; buildVersion?: string; commitId?: string }, -): void { - packageJSON.version && services.logger.log(`Version: ${packageJSON.version}`); - packageJSON.buildVersion && services.logger.log(`Build version: ${packageJSON.buildVersion}`); - packageJSON.commitId && services.logger.log(`Commit id: ${packageJSON.commitId}`); - services.logger.log(`NativeScript CLI: ${cliVersion}`); +function logExtensionInfo(packageJSON: ExtensionPackageJson): void { + services.logger.log(`Version: ${packageJSON.version}`); + if (packageJSON.buildVersion) services.logger.log(`Build version: ${packageJSON.buildVersion}`); + if (packageJSON.commitId) services.logger.log(`Commit id: ${packageJSON.commitId}`); } diff --git a/src/project/androidProject.ts b/src/project/androidProject.ts index 8ffd9ef..8edc0c6 100644 --- a/src/project/androidProject.ts +++ b/src/project/androidProject.ts @@ -1,19 +1,10 @@ import { ChildProcess } from 'child_process'; import { EventEmitter } from 'events'; -import * as semver from 'semver'; import * as stream from 'stream'; -import { NativeScriptCli } from './nativeScriptCli'; import { IDebugResult, Project } from './project'; import * as scanner from './streamScanner'; export class AndroidProject extends Project { - private cliVersion: string; - - constructor(appRoot: string, cli: NativeScriptCli) { - super(appRoot, cli); - this.cliVersion = cli.executeGetVersion(); - } - public platformName(): string { return 'android'; } @@ -47,15 +38,14 @@ export class AndroidProject extends Project { ? super.executeTestCommand(args) : super.executeDebugCommand(args); const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); - const shouldWaitAfterRestartMessage = semver.lt(semver.coerce(this.cliVersion)!, '5.1.0'); - const waitForRestartMessage = shouldWaitAfterRestartMessage || args.indexOf('--debug-brk') > -1; + const waitForRestartMessage = args.includes('--debug-brk'); this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter, waitForRestartMessage); return { tnsProcess: debugProcess, tnsOutputEventEmitter }; } - protected configureReadyEvent( + protected override configureReadyEvent( readableStream: stream.Readable, eventEmitter: EventEmitter, waitForRestartMessage?: boolean, @@ -67,7 +57,7 @@ export class AndroidProject extends Project { new RegExp('device: .* debug port: [0-9]+'), (match: scanner.IMatchFound) => { // device: {device-name} debug port: {debug-port} - debugPort = parseInt((match.matches[0] as string).match('(?:debug port: )([\\d]{5})')![1], 10); + debugPort = parseInt((match.matches[0] as string).match(/debug port: (\d+)/)![1], 10); if (!waitForRestartMessage) { setTimeout(() => { eventEmitter.emit('readyForConnection', debugPort); @@ -76,15 +66,12 @@ export class AndroidProject extends Project { }, ); if (waitForRestartMessage) { - new scanner.StringMatchingScanner(readableStream).onEveryMatch( - '# NativeScript Debugger started #', - (match: scanner.IMatchFound) => { - // wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket - setTimeout(() => { - eventEmitter.emit('readyForConnection', debugPort); - }, 1000); - }, - ); + new scanner.StringMatchingScanner(readableStream).onEveryMatch('# NativeScript Debugger started #', () => { + // wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket + setTimeout(() => { + eventEmitter.emit('readyForConnection', debugPort); + }, 1000); + }); } } } diff --git a/src/project/iosProject.ts b/src/project/iosProject.ts index ca21d1b..c6553fc 100644 --- a/src/project/iosProject.ts +++ b/src/project/iosProject.ts @@ -53,7 +53,7 @@ export class IosProject extends Project { return { tnsProcess: debugProcess, tnsOutputEventEmitter }; } - protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { + protected override configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { super.configureReadyEvent(readableStream, eventEmitter); const streamScanner = new scanner.StringMatchingScanner(readableStream); diff --git a/src/project/nativeScriptCli.ts b/src/project/nativeScriptCli.ts index 8fb4c7d..1dfa285 100644 --- a/src/project/nativeScriptCli.ts +++ b/src/project/nativeScriptCli.ts @@ -1,73 +1,78 @@ -import { ChildProcess, execSync, spawn } from 'child_process'; +import { ChildProcess, exec, spawn } from 'child_process'; +import * as semver from 'semver'; import { ILogger } from '../common/logger'; import * as utils from '../common/utilities'; +const ANALYTICS_CLIENT_ARGS = ['--analyticsClient', 'VSCode']; + export class NativeScriptCli { private static CLI_OUTPUT_VERSION_REGEXP = /^(?:\d+\.){2}\d+.*?$/m; private _path: string; - private _shellPath: string; + private _shellPath: string | undefined; private _logger: ILogger; constructor(cliPath: string, logger: ILogger) { this._path = cliPath; this._logger = logger; - this._shellPath = process.env.SHELL as string; - - // always default to cmd on Windows - // workaround for issue #121 https://github.com/NativeScript/nativescript-vscode-extension/issues/121 - if (utils.getPlatform() === utils.Platform.Windows) { - this._shellPath = 'cmd.exe'; - } + // cmd.exe avoids https://github.com/NativeScript/nativescript-vscode-extension/issues/121 + this._shellPath = utils.getPlatform() === utils.Platform.Windows ? 'cmd.exe' : process.env.SHELL; } public get path(): string { return this._path; } - public executeGetVersion(): string { - try { - const versionOutput = this.executeSync(['--version']); - - return this.getVersionFromCLIOutput(versionOutput)!; - } catch (e) { - this._logger.log(e as string); - - const errorMessage = `NativeScript CLI not found. Use 'nativescript.nsPath' workspace setting - to explicitly set the absolute path to the NativeScript CLI.`; + public getVersion(): Promise { + const command = [this._path, ...ANALYTICS_CLIENT_ARGS, '--version'].join(' '); + this._logger.log(`[NativeScriptCli] execute: ${command}`); - throw new Error(errorMessage); - } + return new Promise((resolve, reject) => { + exec(command, { encoding: 'utf8', shell: this._shellPath, timeout: 60_000 }, (error, stdout) => { + if (error) { + this._logger.log(String(error)); + reject( + new Error( + `NativeScript CLI not found at '${this._path}'. Use the 'nativescript.nsPath' setting to set the absolute path to the NativeScript CLI.`, + ), + ); + return; + } + + const version = stdout.match(NativeScriptCli.CLI_OUTPUT_VERSION_REGEXP)?.[0]; + if (version) { + resolve(version); + } else { + reject(new Error(`Could not read the NativeScript CLI version from its output: ${stdout.trim()}`)); + } + }); + }); } - public executeSync(args: string[], cwd?: string): string { - args.unshift('--analyticsClient', 'VSCode'); - const command: string = `${this._path} ${args.join(' ')}`; + /** Resolves with the CLI version, or rejects with a user-facing message if it is missing or too old. */ + public async getSupportedVersion(minVersion: string): Promise { + const version = await this.getVersion(); + const parsed = semver.coerce(version); - this._logger.log(`[NativeScriptCli] execute: ${command}`); + if (parsed && semver.lt(parsed, minVersion)) { + throw new Error( + `The NativeScript extension requires NativeScript CLI v${minVersion} or greater, but v${version} is installed. Update it with 'npm install -g nativescript'.`, + ); + } - return execSync(command, { encoding: 'utf8', cwd, shell: this._shellPath }).toString().trim(); + return version; } public execute(args: string[], cwd: string): ChildProcess { - args.unshift('--analyticsClient', 'VSCode'); - const command: string = `${this._path} ${args.join(' ')}`; - - this._logger.log(`[NativeScriptCli] execute: ${command}`); + const fullArgs = [...ANALYTICS_CLIENT_ARGS, ...args]; + this._logger.log(`[NativeScriptCli] execute: ${[this._path, ...fullArgs].join(' ')}`); - const options = { cwd, shell: this._shellPath }; - const child: ChildProcess = spawn(this._path, args, options); + const child = spawn(this._path, fullArgs, { cwd, shell: this._shellPath }); - child.stdout!.setEncoding('utf8'); - child.stderr!.setEncoding('utf8'); + child.stdout.setEncoding('utf8'); + child.stderr.setEncoding('utf8'); return child; } - - private getVersionFromCLIOutput(commandOutput: string): string | null { - const matches = commandOutput.match(NativeScriptCli.CLI_OUTPUT_VERSION_REGEXP); - - return matches && matches[0]; - } } diff --git a/src/project/projectInfo.ts b/src/project/projectInfo.ts new file mode 100644 index 0000000..d235a7e --- /dev/null +++ b/src/project/projectInfo.ts @@ -0,0 +1,62 @@ +import * as fs from 'fs'; +import * as path from 'path'; + +export type Bundler = 'webpack' | 'rspack' | 'vite'; + +const CONFIG_FILES = ['nativescript.config.ts', 'nativescript.config.js', 'nativescript.config.mjs']; + +function readFile(file: string): string | undefined { + try { + return fs.readFileSync(file, 'utf8'); + } catch { + return undefined; + } +} + +function readNativeScriptConfig(appRoot: string): string | undefined { + for (const name of CONFIG_FILES) { + const content = readFile(path.join(appRoot, name)); + if (content !== undefined) return content; + } + return undefined; +} + +/** Reads a top-level string property from nativescript.config.* without evaluating it. */ +function readConfigString(appRoot: string, key: string): string | undefined { + const config = readNativeScriptConfig(appRoot); + return config?.match(new RegExp(`\\b${key}\\s*:\\s*["'\`]([^"'\`]+)["'\`]`))?.[1]; +} + +export function readPackageJson(appRoot: string): { name?: string; [key: string]: unknown } | undefined { + const content = readFile(path.join(appRoot, 'package.json')); + if (content === undefined) return undefined; + try { + return JSON.parse(content) as { name?: string; [key: string]: unknown }; + } catch { + return undefined; + } +} + +/** Mirrors the CLI's ProjectData.getAppDirectoryRelativePath. */ +export function getAppDirectory(appRoot: string): string { + const legacyConfig = readFile(path.join(appRoot, 'nsconfig.json')); + if (legacyConfig !== undefined) { + try { + const appPath = (JSON.parse(legacyConfig) as { appPath?: unknown }).appPath; + if (typeof appPath === 'string' && appPath) return appPath; + } catch { + // fall through to the defaults + } + } + + return readConfigString(appRoot, 'appPath') ?? (fs.existsSync(path.join(appRoot, 'src')) ? 'src' : 'app'); +} + +export function getBundler(appRoot: string): Bundler { + const bundler = readConfigString(appRoot, 'bundler'); + return bundler === 'vite' || bundler === 'rspack' ? bundler : 'webpack'; +} + +export function isVitestProject(appRoot: string): boolean { + return ['ts', 'mts', 'js', 'mjs'].some((ext) => fs.existsSync(path.join(appRoot, `vitest.config.${ext}`))); +} diff --git a/src/project/streamScanner.ts b/src/project/streamScanner.ts index 164d851..b7c2418 100644 --- a/src/project/streamScanner.ts +++ b/src/project/streamScanner.ts @@ -7,16 +7,16 @@ export class StreamScanner { constructor(stream: Readable, scanCallback: (data: string, stop: () => void) => void) { this._stream = stream; this._scanCallback = scanCallback; - this._stream.on('data', this.scan.bind(this)); + this._stream.on('data', this.scan); } - public stop() { + public stop = (): void => { this._stream.removeListener('data', this.scan); - } + }; - private scan(data: string | Buffer): void { + private scan = (data: string | Buffer): void => { this._scanCallback(data.toString(), this.stop); - } + }; } export interface IMatchFound { @@ -35,21 +35,21 @@ export class StringMatchingScanner extends StreamScanner { private metas: IMatchMeta[]; constructor(stream: Readable) { - super(stream, (data: string, stop: () => void) => { + super(stream, (data: string) => { this.metas.forEach((meta, metaIndex) => { if (meta.test instanceof RegExp) { - const result: RegExpMatchArray | null = data.match(meta.test as RegExp); + const result: RegExpMatchArray | null = data.match(meta.test); if (result && result.length > 0) { this.matchFound(metaIndex, { chunk: data, matches: result }); } } else if (typeof meta.test === 'string') { const result: number[] = []; // matches indices - let dataIndex = data.indexOf(meta.test as string, 0); + let dataIndex = data.indexOf(meta.test, 0); while (dataIndex > -1) { result.push(dataIndex); - dataIndex = data.indexOf(meta.test as string, dataIndex + 1); + dataIndex = data.indexOf(meta.test, dataIndex + 1); } if (result.length > 0) { this.matchFound(metaIndex, { chunk: data, matches: result }); @@ -66,10 +66,10 @@ export class StringMatchingScanner extends StreamScanner { public onEveryMatch(test: string | RegExp, handler: (result: IMatchFound) => void) { const handlerWrapper = (result: IMatchFound) => { handler(result); - this.nextMatch(test).then(handlerWrapper); + void this.nextMatch(test).then(handlerWrapper); }; - this.nextMatch(test).then(handlerWrapper); + void this.nextMatch(test).then(handlerWrapper); } public nextMatch(test: string | RegExp): Promise { diff --git a/src/services/buildService.ts b/src/services/buildService.ts index 858b573..f9ea606 100644 --- a/src/services/buildService.ts +++ b/src/services/buildService.ts @@ -3,184 +3,196 @@ import * as path from 'path'; import { ChildProcess } from 'child_process'; import { EventEmitter } from 'events'; import { ILogger } from '../common/logger'; +import * as utils from '../common/utilities'; +import { getBundler, isVitestProject } from '../project/projectInfo'; import { AndroidProject } from '../project/androidProject'; import { IosProject } from '../project/iosProject'; -import { NativeScriptCli } from '../project/nativeScriptCli'; import { IDebugResult } from '../project/project'; -import * as utils from '../common/utilities'; import { services } from './extensionHostServices'; -export interface BuildSession { - initialPort: Promise; - portEmitter: EventEmitter; - disconnect(): void; +export interface BuildArgs { + appRoot: string; + platform: string; + request: string; + watch?: boolean; + stopOnEntry?: boolean; + launchTests?: boolean; + tnsArgs?: string[]; } -export class BuildService { - private _tnsProcess: ChildProcess | null = null; - private _logger: ILogger; +/** Ignore repeated port announcements closer together than this; the CLI can print the same port twice. */ +const DUPLICATE_PORT_WINDOW_MS = 2000; + +/** + * One running `ns debug`/`ns test` process. + * + * Events: `newPort` (port: number) when the app restarted and opened a new debug port, + * `closed` (code: number | null) when the CLI process exited. + */ +export class BuildSession extends EventEmitter { + /** Resolves with the first debug port, or `undefined` if the process exits or is stopped first. */ + public readonly initialPort: Promise; + + private resolveInitialPort?: (port: number | undefined) => void; + private lastPortTimestamp = 0; + private process: ChildProcess | null; + + constructor( + command: IDebugResult, + private readonly logger: ILogger, + ) { + super(); + this.process = command.tnsProcess; + this.initialPort = new Promise((resolve) => (this.resolveInitialPort = resolve)); + + command.tnsProcess.stdout!.on('data', (data: Buffer | string) => this.logger.log(data.toString())); + command.tnsProcess.stderr!.on('data', (data: Buffer | string) => this.logger.log(data.toString())); + + command.tnsProcess.on('error', (error) => { + this.logger.log(`[NativeScript] Failed to start the ns command: ${error.message}\n`); + this.finish(null); + }); + command.tnsProcess.on('close', (code) => { + this.logger.log(`[NativeScript] The ns command finished with code ${code}.\n`); + this.finish(code); + }); - constructor(logger: ILogger) { - this._logger = logger; + command.tnsOutputEventEmitter.on('readyForConnection', (connectionToken: string | number) => + this.onPort(typeof connectionToken === 'string' ? parseInt(connectionToken, 10) : connectionToken), + ); } - public async startBuild(args: { - appRoot: string; - platform: string; - request: string; - watch?: boolean; - stopOnEntry?: boolean; - launchTests?: boolean; - tnsArgs?: string[]; - }): Promise { - const nsPath = services.workspaceConfigService.nsPath; + public disconnect(): void { + const child = this.process; + if (!child) return; + + this.process = null; + child.stdout?.removeAllListeners(); + child.stderr?.removeAllListeners(); + child.removeAllListeners(); + utils.killProcess(child, this.logger); + this.resolveInitialPort?.(undefined); + this.resolveInitialPort = undefined; + } - this._logger.log(`[NativeScript] Using ns CLI on path '${nsPath}'\n`); - const nsPathResolved = nsPath !== 'ns' && !path.isAbsolute(nsPath) ? path.join(args.appRoot, nsPath) : nsPath; - const cli = new NativeScriptCli(nsPathResolved, this._logger); + private onPort(port: number): void { + const now = Date.now(); + this.logger.log(`[NativeScript] Ready to attach on port ${port}\n`); + + if (this.resolveInitialPort) { + this.resolveInitialPort(port); + this.resolveInitialPort = undefined; + this.lastPortTimestamp = now; + } else if (now - this.lastPortTimestamp > DUPLICATE_PORT_WINDOW_MS) { + this.lastPortTimestamp = now; + this.emit('newPort', port); + } else { + this.logger.log('[NativeScript] Ignoring duplicate port notification\n'); + } + } - const project = args.platform === 'ios' ? new IosProject(args.appRoot, cli) : new AndroidProject(args.appRoot, cli); + private finish(code: number | null): void { + if (!this.process) return; - services.analyticsService.launchDebugger(args.request, args.platform); + this.process = null; + this.resolveInitialPort?.(undefined); + this.resolveInitialPort = undefined; + this.emit('closed', code); + } +} - const version = project.cli.executeGetVersion(); - this._logger.log(`[NativeScript] Using ns CLI v${version} on path '${project.cli.path}'\n`); - this._logger.log('[NativeScript] Running ns command...\n'); +export class BuildService { + constructor(private readonly logger: ILogger) {} + + /** + * @param isCancelled checked after each await so a session stopped mid-startup never spawns the CLI. + */ + public async startBuild(args: BuildArgs, isCancelled: () => boolean = () => false): Promise { + const cli = services.createCli(args.appRoot); + const platform = args.platform?.toLowerCase(); + + this.logger.log(`[NativeScript] Using ns CLI on path '${cli.path}'\n`); + const version = await cli.getSupportedVersion(services.minCliVersion); + this.logger.log(`[NativeScript] Using ns CLI v${version}\n`); + + if (args.launchTests && isVitestProject(args.appRoot)) { + throw new Error( + "Debugging unit tests is not supported for projects using the Vitest test runner. Run 'ns test' from a terminal instead.", + ); + } - let cliCommand: IDebugResult; + const project = platform === 'ios' ? new IosProject(args.appRoot, cli) : new AndroidProject(args.appRoot, cli); + void services.analyticsService.trackDebug(args.request, platform); - if (args.request === 'launch') { - let tnsArgs = args.tnsArgs; + let tnsArgs = [...(args.tnsArgs ?? [])]; - if (args.platform?.toLowerCase() === 'ios') { - const teamId = this.getTeamId(path.join(args.appRoot, 'app'), tnsArgs); + if (getBundler(args.appRoot) === 'vite' && !tnsArgs.some((arg) => /^--(no-)?hmr$/.test(arg))) { + // Vite HMR serves app code over HTTP without source maps, so breakpoints can't bind. + tnsArgs.push('--no-hmr'); + } - if (!teamId) { - const selectedTeam = await services.iOSTeamService.selectTeam(); + if (args.request === 'launch' && platform === 'ios' && !this.getTeamId(args.appRoot, tnsArgs)) { + const selectedTeam = await services.iOSTeamService.selectTeam(); - if (selectedTeam) { - tnsArgs = (tnsArgs ?? []).concat(['--teamId', selectedTeam.id]); - this._logger.log(`[NativeScript] Using iOS Team ID '${selectedTeam.id}'\n`); - } - } + if (selectedTeam) { + tnsArgs = tnsArgs.concat(['--teamId', selectedTeam.id]); + this.logger.log(`[NativeScript] Using iOS Team ID '${selectedTeam.id}'\n`); } - - cliCommand = project.debug( - { - stopOnEntry: args.stopOnEntry ?? false, - watch: args.watch ?? false, - launchTests: args.launchTests ?? false, - }, - tnsArgs, - ); - } else { - cliCommand = project.attach(args.tnsArgs); } - const portEmitter = new EventEmitter(); - let firstPortResolve: ((port: number | undefined) => void) | null = null; - let lastPortTimestamp = 0; + if (isCancelled()) return null; - const initialPort = new Promise((resolve) => { - firstPortResolve = resolve; - }); + this.logger.log('[NativeScript] Running ns command...\n'); - if (cliCommand.tnsProcess) { - this._tnsProcess = cliCommand.tnsProcess; - cliCommand.tnsProcess.stdout!.on('data', (data: Buffer) => { - this._logger.log(data.toString()); - }); - cliCommand.tnsProcess.stderr!.on('data', (data: Buffer) => { - this._logger.log(data.toString()); - }); - - cliCommand.tnsProcess.on('close', (code) => { - this._logger.log(`[NativeScript] The ns command finished with code ${code}.\n`); - if (firstPortResolve) { - firstPortResolve(undefined); - firstPortResolve = null; - } - portEmitter.emit('closed', code); - }); - } + const command = + args.request === 'launch' + ? project.debug( + { + stopOnEntry: args.stopOnEntry ?? false, + watch: args.watch ?? false, + launchTests: args.launchTests ?? false, + }, + tnsArgs, + ) + : project.attach(tnsArgs); - this._logger.log('[NativeScript] Watching ns CLI output for connection token\n'); - - cliCommand.tnsOutputEventEmitter.on('readyForConnection', (connectionToken: string | number) => { - const port = typeof connectionToken === 'string' ? parseInt(connectionToken, 10) : connectionToken; - const now = Date.now(); - this._logger.log(`[NativeScript] Ready to attach on port ${port}\n`); - - if (firstPortResolve) { - firstPortResolve(port); - firstPortResolve = null; - lastPortTimestamp = now; - } else if (now - lastPortTimestamp > 2000) { - lastPortTimestamp = now; - portEmitter.emit('newPort', port); - } else { - this._logger.log(`[NativeScript] Ignoring duplicate port notification\n`); - } - }); + this.logger.log('[NativeScript] Watching ns CLI output for connection token\n'); - return { - initialPort, - portEmitter, - disconnect: () => this.disconnect(), - }; + return new BuildSession(command, this.logger); } - public disconnect(): void { - if (this._tnsProcess) { - this._tnsProcess.stdout?.removeAllListeners(); - this._tnsProcess.stderr?.removeAllListeners(); - this._tnsProcess.removeAllListeners(); - utils.killProcess(this._tnsProcess); - this._tnsProcess = null; - } - } - - private getTeamId(appRoot: string, tnsArgs?: string[]): string | null { - if (tnsArgs) { - const teamIdArgIndex = tnsArgs.indexOf('--teamId'); - if (teamIdArgIndex > 0 && teamIdArgIndex + 1 < tnsArgs.length) { - return tnsArgs[teamIdArgIndex + 1]; - } + private getTeamId(appRoot: string, tnsArgs: string[]): string | null { + const teamIdArgIndex = tnsArgs.indexOf('--teamId'); + if (teamIdArgIndex >= 0 && teamIdArgIndex + 1 < tnsArgs.length) { + return tnsArgs[teamIdArgIndex + 1]; } - return this.readTeamId(appRoot); + return this.readTeamId(path.join(appRoot, 'app')) ?? this.readTeamId(appRoot); } - private readXCConfig(appRoot: string, flag: string): string | null { - const xcconfigFile = path.join(appRoot, 'App_Resources/iOS/build.xcconfig'); + private readTeamId(appDir: string): string | null { + const xcconfigFile = path.join(appDir, 'App_Resources/iOS/build.xcconfig'); if (fs.existsSync(xcconfigFile)) { - const text = fs.readFileSync(xcconfigFile, { encoding: 'utf8' }); let teamId: string | undefined; - text.split(/\r?\n/).forEach((line) => { - line = line.replace(/\/(\/)[^\n]*$/, ''); - if (line.indexOf(flag) >= 0) { - teamId = line.split('=')[1]?.trim(); - if (teamId && teamId[teamId.length - 1] === ';') { - teamId = teamId.slice(0, -1); - } + for (let line of fs.readFileSync(xcconfigFile, { encoding: 'utf8' }).split(/\r?\n/)) { + line = line.replace(/\/\/[^\n]*$/, ''); + if (line.includes('DEVELOPMENT_TEAM')) { + teamId = line.split('=')[1]?.trim().replace(/;$/, ''); } - }); + } + if (teamId) { return teamId; } } - const fileName = path.join(appRoot, 'teamid'); + const fileName = path.join(appDir, 'teamid'); if (fs.existsSync(fileName)) { - return fs.readFileSync(fileName, { encoding: 'utf8' }); + return fs.readFileSync(fileName, { encoding: 'utf8' }).trim(); } return null; } - - private readTeamId(appRoot: string): string | null { - return this.readXCConfig(appRoot, 'DEVELOPMENT_TEAM'); - } } diff --git a/src/services/extensionHostServices.ts b/src/services/extensionHostServices.ts index e62a7e7..cfbc017 100644 --- a/src/services/extensionHostServices.ts +++ b/src/services/extensionHostServices.ts @@ -1,20 +1,31 @@ +import * as path from 'path'; import * as vscode from 'vscode'; import { AnalyticsService } from '../analytics/analyticsService'; +import { ILogger } from '../common/logger'; import { WorkspaceConfigService } from '../common/workspaceConfigService'; +import { NativeScriptCli } from '../project/nativeScriptCli'; import { BuildService } from './buildService'; import { iOSTeamService } from './iOSTeamService'; -import { Services as BaseServices } from './services'; -export class ExtensionHostServices extends BaseServices { - public cliVersion!: string; - public extensionVersion!: string; +export class ExtensionHostServices { + public extensionVersion = ''; + public minCliVersion = '0.0.0'; + private _logger!: ILogger; private _globalState!: vscode.Memento; - private _workspaceConfigService!: WorkspaceConfigService; - private _iOSTeamService!: iOSTeamService; - private _analyticsService!: AnalyticsService; - private _buildService!: BuildService; + private _workspaceConfigService?: WorkspaceConfigService; + private _iOSTeamService?: iOSTeamService; + private _analyticsService?: AnalyticsService; + private _buildService?: BuildService; + + public get logger(): ILogger { + return this._logger; + } + + public set logger(logger: ILogger) { + this._logger = logger; + } public get globalState(): vscode.Memento { return this._globalState; @@ -25,30 +36,37 @@ export class ExtensionHostServices extends BaseServices { } public get workspaceConfigService(): WorkspaceConfigService { - this._workspaceConfigService = this._workspaceConfigService || new WorkspaceConfigService(); - - return this._workspaceConfigService; + return (this._workspaceConfigService ??= new WorkspaceConfigService()); } public get iOSTeamService(): iOSTeamService { - this._iOSTeamService = this._iOSTeamService || new iOSTeamService(); - - return this._iOSTeamService; + return (this._iOSTeamService ??= new iOSTeamService()); } public get analyticsService(): AnalyticsService { - this._analyticsService = - this._analyticsService || - new AnalyticsService(this.globalState, this.cliVersion, this.extensionVersion, this._logger); - - return this._analyticsService; + return (this._analyticsService ??= new AnalyticsService( + this.globalState, + this.workspaceConfigService, + this.logger, + this.extensionVersion, + )); } public get buildService(): BuildService { - this._buildService = this._buildService || new BuildService(this._logger); + return (this._buildService ??= new BuildService(this.logger)); + } + + /** + * Bare command names (e.g. `ns`) are looked up on PATH; path-like relative values + * (e.g. `./node_modules/.bin/ns`) are resolved against the app root. + */ + public createCli(appRoot?: string): NativeScriptCli { + const nsPath = this.workspaceConfigService.nsPath; + const isRelativePath = !path.isAbsolute(nsPath) && /[\\/]/.test(nsPath); + const resolved = isRelativePath && appRoot ? path.join(appRoot, nsPath) : nsPath; - return this._buildService; + return new NativeScriptCli(resolved, this.logger); } } -export let services = new ExtensionHostServices(); +export const services = new ExtensionHostServices(); diff --git a/src/services/iOSTeamService.ts b/src/services/iOSTeamService.ts index e8ac6c9..7796d5b 100644 --- a/src/services/iOSTeamService.ts +++ b/src/services/iOSTeamService.ts @@ -2,10 +2,9 @@ import * as fs from 'fs'; import * as path from 'path'; import * as vscode from 'vscode'; -// tslint:disable-next-line:class-name export class iOSTeamService { public selectTeam(): Promise<{ id: string; name: string } | void> { - return new Promise((resolve, reject) => { + return new Promise((resolve) => { const workspaceTeamId = vscode.workspace.getConfiguration().get('nativescript.iosTeamId'); if (workspaceTeamId) { @@ -51,7 +50,7 @@ export class iOSTeamService { try { const dir = path.join(process.env.HOME!, 'Library/MobileDevice/Provisioning Profiles/'); const files = fs.readdirSync(dir); - const teamIds: any = {}; + const teamIds: Record = {}; for (const file of files) { const filePath = path.join(dir, file); @@ -60,7 +59,7 @@ export class iOSTeamService { const teamName = this.getProvisioningProfileValue('TeamName', data); if (teamId) { - teamIds[teamId] = teamName; + teamIds[teamId] = teamName ?? ''; } } @@ -71,7 +70,7 @@ export class iOSTeamService { } return teamIdsArray; - } catch (e) { + } catch { // no matter what happens, don't break return new Array<{ id: string; name: string }>(); } diff --git a/src/services/language-services/autocomplete.ts b/src/services/language-services/autocomplete.ts index 6dd8631..a8a6a4c 100644 --- a/src/services/language-services/autocomplete.ts +++ b/src/services/language-services/autocomplete.ts @@ -73,10 +73,10 @@ HORIZONTAL_ALIGNMENT.documentation = new vscode.MarkdownString(GENERIC_AUTOCOMPL export const COMPLETION_PROVIDER = vscode.languages.registerCompletionItemProvider('html', { provideCompletionItems( - document: vscode.TextDocument, - position: vscode.Position, - token: vscode.CancellationToken, - context: vscode.CompletionContext, + _document: vscode.TextDocument, + _position: vscode.Position, + _token: vscode.CancellationToken, + _context: vscode.CompletionContext, ) { return [ AUTOCAPITALIZATION, diff --git a/src/services/language-services/hover/layout-hover.ts b/src/services/language-services/hover/layout-hover.ts index e45cc27..e2dc9a2 100644 --- a/src/services/language-services/hover/layout-hover.ts +++ b/src/services/language-services/hover/layout-hover.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; export const STACK_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -25,7 +25,7 @@ export const STACK_LAYOUT = vscode.languages.registerHoverProvider('html', { }); export const GRID_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -47,7 +47,7 @@ export const GRID_LAYOUT = vscode.languages.registerHoverProvider('html', { }); export const ABSOLUTE_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -69,7 +69,7 @@ export const ABSOLUTE_LAYOUT = vscode.languages.registerHoverProvider('html', { }); export const DOCK_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -93,7 +93,7 @@ export const DOCK_LAYOUT = vscode.languages.registerHoverProvider('html', { }); export const FLEXBOX_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -115,7 +115,7 @@ export const FLEXBOX_LAYOUT = vscode.languages.registerHoverProvider('html', { }); export const WRAP_LAYOUT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); diff --git a/src/services/language-services/hover/ui-enum-hover.ts b/src/services/language-services/hover/ui-enum-hover.ts index 461c013..9baf772 100644 --- a/src/services/language-services/hover/ui-enum-hover.ts +++ b/src/services/language-services/hover/ui-enum-hover.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; export const ACCURACY = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -18,7 +18,7 @@ export const ACCURACY = vscode.languages.registerHoverProvider('html', { }); export const ANDROID_ACTION_BAR_VISIBILITY = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -37,7 +37,7 @@ export const ANDROID_ACTION_BAR_VISIBILITY = vscode.languages.registerHoverProvi }); export const ANDROID_ACTION_BAR_POSITION = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -56,7 +56,7 @@ export const ANDROID_ACTION_BAR_POSITION = vscode.languages.registerHoverProvide }); export const ANIMATION_CURVE = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -75,7 +75,7 @@ export const ANIMATION_CURVE = vscode.languages.registerHoverProvider('html', { }); export const AUTOCAPITALIZATION = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -94,7 +94,7 @@ export const AUTOCAPITALIZATION = vscode.languages.registerHoverProvider('html', }); export const BACKGROUND_REPEAT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -113,7 +113,7 @@ export const BACKGROUND_REPEAT = vscode.languages.registerHoverProvider('html', }); export const DOCK = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -130,7 +130,7 @@ export const DOCK = vscode.languages.registerHoverProvider('html', { }); export const FONT_ATTRIBUTES = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -149,7 +149,7 @@ export const FONT_ATTRIBUTES = vscode.languages.registerHoverProvider('html', { }); export const FONT_STYLE = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -166,7 +166,7 @@ export const FONT_STYLE = vscode.languages.registerHoverProvider('html', { }); export const FONT_WEIGHT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -185,7 +185,7 @@ export const FONT_WEIGHT = vscode.languages.registerHoverProvider('html', { }); export const HORIZONTAL_ALIGNMENT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -206,7 +206,7 @@ export const HORIZONTAL_ALIGNMENT = vscode.languages.registerHoverProvider('html }); export const IOS_ACTION_ITEM_POSITION = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -225,7 +225,7 @@ export const IOS_ACTION_ITEM_POSITION = vscode.languages.registerHoverProvider(' }); export const IMAGE_FORMAT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -244,7 +244,7 @@ export const IMAGE_FORMAT = vscode.languages.registerHoverProvider('html', { }); export const KEYBOARD_TYPE = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -263,7 +263,7 @@ export const KEYBOARD_TYPE = vscode.languages.registerHoverProvider('html', { }); export const NAVIGATION_BAR_VISIBILITY = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -282,7 +282,7 @@ export const NAVIGATION_BAR_VISIBILITY = vscode.languages.registerHoverProvider( }); export const ORIENTATION = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -301,7 +301,7 @@ export const ORIENTATION = vscode.languages.registerHoverProvider('html', { }); export const RETURN_KEY_TYPE = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -320,7 +320,7 @@ export const RETURN_KEY_TYPE = vscode.languages.registerHoverProvider('html', { }); export const STRETCH = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -337,7 +337,7 @@ export const STRETCH = vscode.languages.registerHoverProvider('html', { }); export const TEXT_ALIGNMENT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -356,7 +356,7 @@ export const TEXT_ALIGNMENT = vscode.languages.registerHoverProvider('html', { }); export const TEXT_DECORATION = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -375,7 +375,7 @@ export const TEXT_DECORATION = vscode.languages.registerHoverProvider('html', { }); export const TEXT_TRANSFORM = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -394,7 +394,7 @@ export const TEXT_TRANSFORM = vscode.languages.registerHoverProvider('html', { }); export const VERTICAL_ALIGNMENT = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -415,7 +415,7 @@ export const VERTICAL_ALIGNMENT = vscode.languages.registerHoverProvider('html', }); export const VISIBILITY = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -434,7 +434,7 @@ export const VISIBILITY = vscode.languages.registerHoverProvider('html', { }); export const WHITE_SPACE = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); diff --git a/src/services/language-services/hover/widget-hover.ts b/src/services/language-services/hover/widget-hover.ts index c52e8a8..65ccbbe 100644 --- a/src/services/language-services/hover/widget-hover.ts +++ b/src/services/language-services/hover/widget-hover.ts @@ -1,7 +1,7 @@ import * as vscode from 'vscode'; export const ACTIVITY_INDICATOR = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -24,7 +24,7 @@ export const ACTIVITY_INDICATOR = vscode.languages.registerHoverProvider('html', }); export const BUTTON = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -43,7 +43,7 @@ export const BUTTON = vscode.languages.registerHoverProvider('html', { }); export const LABEL = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -62,7 +62,7 @@ export const LABEL = vscode.languages.registerHoverProvider('html', { }); export const TEXT_FIELD = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -83,7 +83,7 @@ export const TEXT_FIELD = vscode.languages.registerHoverProvider('html', { }); export const TEXT_VIEW = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -103,7 +103,7 @@ export const TEXT_VIEW = vscode.languages.registerHoverProvider('html', { }); export const LIST_VIEW = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -122,7 +122,7 @@ export const LIST_VIEW = vscode.languages.registerHoverProvider('html', { }); export const IMAGE = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -141,7 +141,7 @@ export const IMAGE = vscode.languages.registerHoverProvider('html', { }); export const PROGRESS = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -160,7 +160,7 @@ export const PROGRESS = vscode.languages.registerHoverProvider('html', { }); export const SCROLL_VIEW = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -181,7 +181,7 @@ export const SCROLL_VIEW = vscode.languages.registerHoverProvider('html', { }); export const SEARCH_BAR = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -202,7 +202,7 @@ export const SEARCH_BAR = vscode.languages.registerHoverProvider('html', { }); export const SLIDER = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -221,7 +221,7 @@ export const SLIDER = vscode.languages.registerHoverProvider('html', { }); export const SWITCH = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -240,7 +240,7 @@ export const SWITCH = vscode.languages.registerHoverProvider('html', { }); export const TAB_VIEW = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -259,7 +259,7 @@ export const TAB_VIEW = vscode.languages.registerHoverProvider('html', { }); export const TAB_VIEW_ITEM = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -280,7 +280,7 @@ export const TAB_VIEW_ITEM = vscode.languages.registerHoverProvider('html', { }); export const WEB_VIEW = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -299,7 +299,7 @@ export const WEB_VIEW = vscode.languages.registerHoverProvider('html', { }); export const HTML_VIEW = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -320,7 +320,7 @@ export const HTML_VIEW = vscode.languages.registerHoverProvider('html', { }); export const LIST_PICKER = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -341,7 +341,7 @@ export const LIST_PICKER = vscode.languages.registerHoverProvider('html', { }); export const DATE_PICKER = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -362,7 +362,7 @@ export const DATE_PICKER = vscode.languages.registerHoverProvider('html', { }); export const TIME_PICKER = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); @@ -383,7 +383,7 @@ export const TIME_PICKER = vscode.languages.registerHoverProvider('html', { }); export const PLACEHOLDER = vscode.languages.registerHoverProvider('html', { - provideHover(document, position, token) { + provideHover(document, position, _token) { const range = document.getWordRangeAtPosition(position); const word = document.getText(range); diff --git a/src/services/services.ts b/src/services/services.ts deleted file mode 100644 index de072f0..0000000 --- a/src/services/services.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { ILogger } from '../common/logger'; -import { NativeScriptCli } from '../project/nativeScriptCli'; - -export class Services { - protected _cliPath!: string; - - protected _logger!: ILogger; - protected _cli!: NativeScriptCli; - - public get cliPath(): string { - return this._cliPath; - } - - public set cliPath(cliPath: string) { - this._cliPath = cliPath; - } - - public get logger(): ILogger { - return this._logger; - } - - public set logger(logger: ILogger) { - this._logger = logger; - } - - public cli(): NativeScriptCli { - this._cli = this._cli || new NativeScriptCli(this._cliPath, this.logger); - - return this._cli; - } -} diff --git a/src/tests/androidProject.test.ts b/src/tests/androidProject.test.ts new file mode 100644 index 0000000..a55d542 --- /dev/null +++ b/src/tests/androidProject.test.ts @@ -0,0 +1,115 @@ +import { ChildProcess } from 'child_process'; +import { EventEmitter } from 'events'; +import { PassThrough } from 'stream'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { AndroidProject } from '../project/androidProject'; +import { NativeScriptCli } from '../project/nativeScriptCli'; + +const READY_DELAY_MS = 1000; +const APP_ROOT = '/projects/demo'; + +function createCli() { + const stdout = new PassThrough(); + const proc = Object.assign(new EventEmitter(), { stdout, stderr: new PassThrough() }); + const execute = vi.fn((_args: string[], _cwd: string) => proc as unknown as ChildProcess); + return { cli: { execute } as unknown as NativeScriptCli, execute, stdout, proc }; +} + +async function writeLine(stream: PassThrough, line: string): Promise { + stream.write(`${line}\n`); + await vi.advanceTimersByTimeAsync(0); +} + +describe('AndroidProject', () => { + let fake: ReturnType; + let ready: ReturnType void>>; + + beforeEach(() => { + vi.useFakeTimers(); + fake = createCli(); + ready = vi.fn<(port: number) => void>(); + }); + + afterEach(() => { + vi.useRealTimers(); + }); + + it('builds the debug command line', () => { + const project = new AndroidProject(APP_ROOT, fake.cli); + + const result = project.debug({ stopOnEntry: false, watch: true, launchTests: false }, ['--device', 'emu']); + + expect(fake.execute).toHaveBeenCalledWith(['debug', 'android', '--watch', '--device', 'emu'], APP_ROOT); + expect(result.tnsProcess).toBe(fake.proc); + }); + + it('uses ns test for launchTests and --debug-brk for stopOnEntry', () => { + new AndroidProject(APP_ROOT, fake.cli).debug({ stopOnEntry: true, watch: false, launchTests: true }); + + expect(fake.execute).toHaveBeenCalledWith(['test', 'android', '--no-watch', '--debug-brk'], APP_ROOT); + }); + + it('builds the attach command line', () => { + new AndroidProject(APP_ROOT, fake.cli).attach(['--env.foo']); + + expect(fake.execute).toHaveBeenCalledWith(['debug', 'android', '--start', '--env.foo'], APP_ROOT); + }); + + it('announces the debug port one second after the CLI prints it', async () => { + const { tnsOutputEventEmitter } = new AndroidProject(APP_ROOT, fake.cli).debug({ + stopOnEntry: false, + watch: true, + launchTests: false, + }); + tnsOutputEventEmitter.on('readyForConnection', ready); + + await writeLine(fake.stdout, 'Successfully installed on device with identifier emulator-5554.'); + await writeLine(fake.stdout, 'device: emulator-5554 debug port: 40000'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS - 1); + expect(ready).not.toHaveBeenCalled(); + + await vi.advanceTimersByTimeAsync(1); + expect(ready).toHaveBeenCalledExactlyOnceWith(40000); + }); + + it('announces every new port after LiveSync restarts', async () => { + const { tnsOutputEventEmitter } = new AndroidProject(APP_ROOT, fake.cli).attach(); + tnsOutputEventEmitter.on('readyForConnection', ready); + + await writeLine(fake.stdout, 'device: emulator-5554 debug port: 40000'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + await writeLine(fake.stdout, 'device: emulator-5554 debug port: 40001'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + + expect(ready.mock.calls).toEqual([[40000], [40001]]); + }); + + it.each([ + ['stopOnEntry', { stopOnEntry: true }, []], + ['--debug-brk in tnsArgs', { stopOnEntry: false }, ['--debug-brk']], + ])('with %s, waits for the debugger-started message', async (_label, options, tnsArgs) => { + const { tnsOutputEventEmitter } = new AndroidProject(APP_ROOT, fake.cli).debug( + { ...options, watch: false, launchTests: false }, + tnsArgs, + ); + tnsOutputEventEmitter.on('readyForConnection', ready); + + await writeLine(fake.stdout, 'device: emulator-5554 debug port: 40000'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS * 5); + expect(ready).not.toHaveBeenCalled(); + + await writeLine(fake.stdout, '# NativeScript Debugger started #'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + expect(ready).toHaveBeenCalledExactlyOnceWith(40000); + }); + + it('emits tsCompilationError on TypeScript failures', async () => { + const { tnsOutputEventEmitter } = new AndroidProject(APP_ROOT, fake.cli).attach(); + const compilationError = vi.fn(); + tnsOutputEventEmitter.on('tsCompilationError', compilationError); + + await writeLine(fake.stdout, 'TypeScript compiler failed with exit code 1'); + + expect(compilationError).toHaveBeenCalledOnce(); + }); +}); diff --git a/src/tests/buildService.test.ts b/src/tests/buildService.test.ts new file mode 100644 index 0000000..216332f --- /dev/null +++ b/src/tests/buildService.test.ts @@ -0,0 +1,360 @@ +import { ChildProcess } from 'child_process'; +import { EventEmitter } from 'events'; +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { PassThrough } from 'stream'; +import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest'; +import { ILogger } from '../common/logger'; +import { AnalyticsService } from '../analytics/analyticsService'; +import * as utils from '../common/utilities'; +import { NativeScriptCli } from '../project/nativeScriptCli'; +import { IDebugResult } from '../project/project'; +import { BuildArgs, BuildService, BuildSession } from '../services/buildService'; +import { services } from '../services/extensionHostServices'; +import { iOSTeamService } from '../services/iOSTeamService'; + +const projects = vi.hoisted(() => ({ + created: [] as Array<{ platform: string; appRoot: string }>, + debug: + vi.fn< + (options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, tnsArgs?: string[]) => IDebugResult + >(), + attach: vi.fn<(tnsArgs?: string[]) => IDebugResult>(), +})); + +vi.mock('../project/iosProject', () => ({ + IosProject: class { + public debug = projects.debug; + public attach = projects.attach; + constructor(appRoot: string) { + projects.created.push({ platform: 'ios', appRoot }); + } + }, +})); + +vi.mock('../project/androidProject', () => ({ + AndroidProject: class { + public debug = projects.debug; + public attach = projects.attach; + constructor(appRoot: string) { + projects.created.push({ platform: 'android', appRoot }); + } + }, +})); + +vi.mock('../common/utilities', async (importOriginal) => ({ + ...(await importOriginal()), + killProcess: vi.fn(), +})); + +function createFakeProcess() { + return Object.assign(new EventEmitter(), { stdout: new PassThrough(), stderr: new PassThrough(), pid: 4242 }); +} + +type FakeProcess = ReturnType; + +function createDebugResult(proc: FakeProcess = createFakeProcess()) { + const tnsOutputEventEmitter = new EventEmitter(); + const result: IDebugResult = { tnsProcess: proc as unknown as ChildProcess, tnsOutputEventEmitter }; + return { proc, tnsOutputEventEmitter, result }; +} + +const nextTick = () => new Promise((resolve) => process.nextTick(resolve)); + +describe('BuildSession', () => { + let logger: { log: Mock }; + + beforeEach(() => { + logger = { log: vi.fn() }; + }); + + afterEach(() => { + vi.useRealTimers(); + }); + + it('forwards stdout and stderr to the logger', async () => { + const { proc, result } = createDebugResult(); + new BuildSession(result, logger); + + proc.stdout.write('building...\n'); + proc.stderr.write('warning\n'); + await nextTick(); + + expect(logger.log).toHaveBeenCalledWith('building...\n'); + expect(logger.log).toHaveBeenCalledWith('warning\n'); + }); + + it('resolves initialPort with the first announced port, parsing string tokens', async () => { + const { tnsOutputEventEmitter, result } = createDebugResult(); + const session = new BuildSession(result, logger); + const newPort = vi.fn(); + session.on('newPort', newPort); + + tnsOutputEventEmitter.emit('readyForConnection', '40000'); + + await expect(session.initialPort).resolves.toBe(40000); + expect(newPort).not.toHaveBeenCalled(); + }); + + it('emits newPort for later ports and drops repeats within the duplicate window', () => { + vi.useFakeTimers(); + const { tnsOutputEventEmitter, result } = createDebugResult(); + const session = new BuildSession(result, logger); + const newPort = vi.fn(); + session.on('newPort', newPort); + + tnsOutputEventEmitter.emit('readyForConnection', 40000); + vi.advanceTimersByTime(1000); + tnsOutputEventEmitter.emit('readyForConnection', 40000); + expect(newPort).not.toHaveBeenCalled(); + + vi.advanceTimersByTime(1500); + tnsOutputEventEmitter.emit('readyForConnection', 41000); + expect(newPort).toHaveBeenCalledExactlyOnceWith(41000); + + vi.advanceTimersByTime(1999); + tnsOutputEventEmitter.emit('readyForConnection', 41000); + expect(newPort).toHaveBeenCalledOnce(); + + vi.advanceTimersByTime(2001); + tnsOutputEventEmitter.emit('readyForConnection', 42000); + expect(newPort).toHaveBeenLastCalledWith(42000); + expect(newPort).toHaveBeenCalledTimes(2); + }); + + it('resolves initialPort with undefined and emits closed once when the process exits first', async () => { + const { proc, result } = createDebugResult(); + const session = new BuildSession(result, logger); + const closed = vi.fn(); + session.on('closed', closed); + + proc.emit('close', 1); + proc.emit('close', 1); + + await expect(session.initialPort).resolves.toBeUndefined(); + expect(closed).toHaveBeenCalledExactlyOnceWith(1); + }); + + it('emits closed with a null code when the process fails to spawn', async () => { + const { proc, result } = createDebugResult(); + const session = new BuildSession(result, logger); + const closed = vi.fn(); + session.on('closed', closed); + + proc.emit('error', new Error('spawn ns ENOENT')); + + await expect(session.initialPort).resolves.toBeUndefined(); + expect(closed).toHaveBeenCalledExactlyOnceWith(null); + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('spawn ns ENOENT')); + }); + + it('disconnect kills the process, resolves initialPort with undefined and is idempotent', async () => { + const { proc, result } = createDebugResult(); + const session = new BuildSession(result, logger); + const closed = vi.fn(); + session.on('closed', closed); + + session.disconnect(); + session.disconnect(); + + await expect(session.initialPort).resolves.toBeUndefined(); + expect(utils.killProcess).toHaveBeenCalledExactlyOnceWith(proc, logger); + expect(proc.listenerCount('close')).toBe(0); + expect(proc.stdout.listenerCount('data')).toBe(0); + + proc.emit('close', 0); + expect(closed).not.toHaveBeenCalled(); + }); + + it('does not kill a process that has already exited', () => { + const { proc, result } = createDebugResult(); + const session = new BuildSession(result, logger); + + proc.emit('close', 0); + session.disconnect(); + + expect(utils.killProcess).not.toHaveBeenCalled(); + }); +}); + +describe('BuildService.startBuild', () => { + let logger: { log: Mock }; + let cli: { path: string; getSupportedVersion: ReturnType Promise>> }; + let selectTeam: ReturnType Promise<{ id: string; name: string } | undefined>>>; + let trackDebug: ReturnType; + let appRoot: string; + let service: BuildService; + + const baseArgs = (overrides: Partial = {}): BuildArgs => ({ + appRoot, + platform: 'android', + request: 'launch', + ...overrides, + }); + + const writeAppFile = (relativePath: string, content: string) => { + const file = path.join(appRoot, relativePath); + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, content); + }; + + const debugTnsArgs = (): string[] | undefined => projects.debug.mock.lastCall![1]; + + beforeEach(() => { + appRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'ns-build-service-')); + logger = { log: vi.fn() }; + projects.created.length = 0; + projects.debug.mockImplementation(() => createDebugResult().result); + projects.attach.mockImplementation(() => createDebugResult().result); + + cli = { path: 'ns', getSupportedVersion: vi.fn(async () => '8.9.2') }; + vi.spyOn(services, 'createCli').mockReturnValue(cli as unknown as NativeScriptCli); + + trackDebug = vi.fn(async () => undefined); + vi.spyOn(services, 'analyticsService', 'get').mockReturnValue({ trackDebug } as unknown as AnalyticsService); + + selectTeam = vi.fn(async () => ({ id: 'TEAM123', name: 'My Team' })); + vi.spyOn(services, 'iOSTeamService', 'get').mockReturnValue({ selectTeam } as unknown as iOSTeamService); + + service = new BuildService(logger); + }); + + afterEach(() => { + fs.rmSync(appRoot, { recursive: true, force: true }); + }); + + it('launches the debug command and returns a BuildSession', async () => { + const session = await service.startBuild( + baseArgs({ watch: true, stopOnEntry: true, tnsArgs: ['--device', 'emulator-5554'] }), + ); + + expect(session).toBeInstanceOf(BuildSession); + expect(services.createCli).toHaveBeenCalledWith(appRoot); + expect(cli.getSupportedVersion).toHaveBeenCalledWith(services.minCliVersion); + expect(projects.created).toEqual([{ platform: 'android', appRoot }]); + expect(projects.debug).toHaveBeenCalledExactlyOnceWith({ stopOnEntry: true, watch: true, launchTests: false }, [ + '--device', + 'emulator-5554', + ]); + expect(trackDebug).toHaveBeenCalledWith('launch', 'android'); + }); + + it('uses attach for attach requests', async () => { + await service.startBuild(baseArgs({ request: 'attach', tnsArgs: ['--env.foo'] })); + + expect(projects.attach).toHaveBeenCalledExactlyOnceWith(['--env.foo']); + expect(projects.debug).not.toHaveBeenCalled(); + }); + + it('picks the iOS project case-insensitively', async () => { + await service.startBuild(baseArgs({ platform: 'iOS', request: 'attach' })); + expect(projects.created).toEqual([{ platform: 'ios', appRoot }]); + }); + + describe('Vite projects', () => { + beforeEach(() => { + writeAppFile('nativescript.config.ts', "export default { id: 'org.demo', bundler: 'vite' };\n"); + }); + + it('appends --no-hmr', async () => { + await service.startBuild(baseArgs({ tnsArgs: ['--env.foo'] })); + expect(debugTnsArgs()).toEqual(['--env.foo', '--no-hmr']); + }); + + it.each([['--hmr'], ['--no-hmr']])('leaves an explicit %s alone', async (flag) => { + await service.startBuild(baseArgs({ tnsArgs: [flag] })); + expect(debugTnsArgs()).toEqual([flag]); + }); + + it('does not mutate the caller tnsArgs', async () => { + const tnsArgs = ['--env.foo']; + await service.startBuild(baseArgs({ tnsArgs })); + expect(tnsArgs).toEqual(['--env.foo']); + }); + }); + + it('does not append --no-hmr for webpack projects', async () => { + writeAppFile('nativescript.config.ts', "export default { id: 'org.demo', appPath: 'src' };\n"); + await service.startBuild(baseArgs()); + expect(debugTnsArgs()).toEqual([]); + }); + + it('rejects debugging tests in Vitest projects', async () => { + writeAppFile('vitest.config.ts', 'export default {};\n'); + + await expect(service.startBuild(baseArgs({ launchTests: true }))).rejects.toThrow(/Vitest/); + expect(projects.created).toEqual([]); + }); + + it('allows a normal debug launch in Vitest projects', async () => { + writeAppFile('vitest.config.mts', 'export default {};\n'); + + await expect(service.startBuild(baseArgs())).resolves.toBeInstanceOf(BuildSession); + }); + + it('rejects when the CLI is too old', async () => { + cli.getSupportedVersion.mockRejectedValue(new Error('requires NativeScript CLI v8.0.0 or greater')); + + await expect(service.startBuild(baseArgs())).rejects.toThrow('requires NativeScript CLI v8.0.0 or greater'); + expect(projects.debug).not.toHaveBeenCalled(); + }); + + it('returns null without running the CLI when cancelled', async () => { + await expect(service.startBuild(baseArgs(), () => true)).resolves.toBeNull(); + expect(projects.debug).not.toHaveBeenCalled(); + expect(projects.attach).not.toHaveBeenCalled(); + }); + + describe('iOS team selection', () => { + it('asks for a team on iOS launch and passes it to the CLI', async () => { + await service.startBuild(baseArgs({ platform: 'ios' })); + + expect(selectTeam).toHaveBeenCalledOnce(); + expect(debugTnsArgs()).toEqual(['--teamId', 'TEAM123']); + }); + + it('returns null without running the CLI when stopped while the team picker is open', async () => { + let stopped = false; + selectTeam.mockImplementation(async () => { + stopped = true; + return undefined; + }); + + await expect(service.startBuild(baseArgs({ platform: 'ios' }), () => stopped)).resolves.toBeNull(); + expect(projects.debug).not.toHaveBeenCalled(); + }); + + it('skips the picker when tnsArgs already has --teamId', async () => { + await service.startBuild(baseArgs({ platform: 'ios', tnsArgs: ['--teamId', 'ABC'] })); + + expect(selectTeam).not.toHaveBeenCalled(); + expect(debugTnsArgs()).toEqual(['--teamId', 'ABC']); + }); + + it('skips the picker when build.xcconfig sets DEVELOPMENT_TEAM', async () => { + writeAppFile( + 'app/App_Resources/iOS/build.xcconfig', + '// DEVELOPMENT_TEAM = COMMENTED;\nDEVELOPMENT_TEAM = XC123;\nCODE_SIGN_STYLE = Automatic;\n', + ); + + await service.startBuild(baseArgs({ platform: 'ios' })); + + expect(selectTeam).not.toHaveBeenCalled(); + expect(debugTnsArgs()).toEqual([]); + }); + + it('skips the picker when a teamid file exists', async () => { + writeAppFile('teamid', 'FILE123\n'); + + await service.startBuild(baseArgs({ platform: 'ios' })); + + expect(selectTeam).not.toHaveBeenCalled(); + }); + + it('does not ask for a team on attach', async () => { + await service.startBuild(baseArgs({ platform: 'ios', request: 'attach' })); + expect(selectTeam).not.toHaveBeenCalled(); + }); + }); +}); diff --git a/src/tests/config/mocha.opts b/src/tests/config/mocha.opts deleted file mode 100644 index 0ae6543..0000000 --- a/src/tests/config/mocha.opts +++ /dev/null @@ -1,7 +0,0 @@ ---colors ---ui tdd ---timeout 60000 ---reporter spec ---exit - -./out/tests/**/*.tests.js \ No newline at end of file diff --git a/src/tests/debugManager.test.ts b/src/tests/debugManager.test.ts new file mode 100644 index 0000000..1721950 --- /dev/null +++ b/src/tests/debugManager.test.ts @@ -0,0 +1,543 @@ +import { EventEmitter } from 'events'; +import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest'; +import { ILogger } from '../common/logger'; +import type * as vscodeTypes from 'vscode'; +import { + DebugManager, + getNormalizedAddress, + NativeScriptDebugConfiguration, + PARENT_SESSION_KEY, + RECONNECT_TIMEOUT_MS, +} from '../debug-adapter/debugManager'; +import { computeSourceMapOptions, SourceMapConfig } from '../debug-adapter/sourceMaps'; +import { BuildArgs, BuildService, BuildSession } from '../services/buildService'; +import { services } from '../services/extensionHostServices'; +import { debug, MockDebugSession, testing, window } from './mocks/vscode'; + +vi.mock('../debug-adapter/sourceMaps', () => ({ + computeSourceMapOptions: vi.fn(async (_appRoot: string, config: SourceMapConfig) => ({ + sourceMapPathOverrides: { 'webpack:///*': '/default/*', ...config.sourceMapPathOverrides }, + resolveSourceMapLocations: config.resolveSourceMapLocations ?? null, + })), +})); + +class FakeBuildSession extends EventEmitter { + public resolvePort!: (port: number | undefined) => void; + public readonly initialPort = new Promise((resolve) => (this.resolvePort = resolve)); + public readonly disconnect = vi.fn(() => this.resolvePort(undefined)); +} + +type StartBuild = (args: BuildArgs, isCancelled: () => boolean) => Promise; + +const CHILD_STOP_SETTLE_MS = 500; +const CHILD_RETRY_DELAY_MS = 1000; + +const workspaceFolder = { uri: { fsPath: '/workspace/app' }, name: 'app', index: 0 }; + +function createParent(id = 'parent-1'): MockDebugSession { + return { id, type: 'nativescript', name: 'Launch on Android', configuration: {}, workspaceFolder }; +} + +function deferred() { + let resolve!: (value: T) => void; + let reject!: (error: unknown) => void; + const promise = new Promise((res, rej) => { + resolve = res; + reject = rej; + }); + return { promise, resolve, reject }; +} + +describe('getNormalizedAddress', () => { + it('keeps an explicit address', () => { + expect(getNormalizedAddress('10.0.0.2', 'ios')).toBe('10.0.0.2'); + }); + + it('defaults to localhost on iOS and 127.0.0.1 elsewhere', () => { + expect(getNormalizedAddress(undefined, 'iOS')).toBe('localhost'); + expect(getNormalizedAddress(undefined, 'android')).toBe('127.0.0.1'); + expect(getNormalizedAddress(undefined, undefined)).toBe('127.0.0.1'); + }); +}); + +describe('DebugManager', () => { + let manager: DebugManager; + let logger: { log: Mock }; + let startBuild: ReturnType>; + let build: FakeBuildSession; + let parent: MockDebugSession; + let onTerminated: ReturnType void>>; + let children: MockDebugSession[]; + + const activeSessionCount = () => (manager as unknown as { activeSessions: Map }).activeSessions.size; + + const start = (config: Partial) => + manager.startDebugging( + parent as unknown as vscodeTypes.DebugSession, + config as NativeScriptDebugConfiguration, + onTerminated, + ); + + const lastChildConfig = () => debug.startDebugging.mock.lastCall![1]; + + async function startWithChild( + config: Partial, + port = 40000, + ): Promise { + const started = start(config); + build.resolvePort(port); + await expect(started).resolves.toBe(true); + expect(children).toHaveLength(1); + return children[0]; + } + + beforeEach(() => { + vi.useFakeTimers(); + + logger = { log: vi.fn() }; + build = new FakeBuildSession(); + startBuild = vi.fn(async () => build as unknown as BuildSession); + vi.spyOn(services, 'buildService', 'get').mockReturnValue({ startBuild } as unknown as BuildService); + + children = []; + debug.startDebugging.mockImplementation(async (_folder, config) => { + const child: MockDebugSession = { + id: `child-${children.length + 1}`, + type: 'pwa-node', + name: String(config.name), + configuration: config, + }; + children.push(child); + testing.fireDidStartDebugSession(child); + return true; + }); + debug.stopDebugging.mockImplementation(async (session) => { + if (session) testing.fireDidTerminateDebugSession(session); + }); + + parent = createParent(); + onTerminated = vi.fn<() => void>(); + manager = new DebugManager(logger); + }); + + afterEach(() => { + manager.dispose(); + vi.useRealTimers(); + }); + + describe('startup', () => { + it('passes the launch config to startBuild and starts a js-debug child on the initial port', async () => { + const child = await startWithChild({ + name: 'Launch on Android', + platform: 'android', + request: 'launch', + appRoot: '/projects/demo', + watch: true, + stopOnEntry: false, + tnsArgs: ['--env.foo'], + sourceMaps: true, + skipFiles: ['/**'], + }); + + expect(startBuild).toHaveBeenCalledWith( + { + appRoot: '/projects/demo', + platform: 'android', + request: 'launch', + watch: true, + stopOnEntry: false, + launchTests: undefined, + tnsArgs: ['--env.foo'], + }, + expect.any(Function), + ); + + expect(debug.startDebugging).toHaveBeenCalledOnce(); + const [folder, childConfig, options] = debug.startDebugging.mock.calls[0]; + expect(folder).toBe(workspaceFolder); + expect(childConfig).toMatchObject({ + type: 'pwa-node', + request: 'attach', + name: 'Launch on Android', + websocketAddress: 'ws://127.0.0.1:40000', + sourceMaps: true, + skipFiles: ['/**'], + [PARENT_SESSION_KEY]: 'parent-1', + }); + expect(options).toEqual({ parentSession: parent, lifecycleManagedByParent: true, compact: true }); + expect(child.configuration[PARENT_SESSION_KEY]).toBe('parent-1'); + }); + + it('uses localhost for iOS and honors an explicit address', async () => { + await startWithChild({ platform: 'ios', request: 'launch' }, 41000); + expect(lastChildConfig().websocketAddress).toBe('ws://localhost:41000'); + + manager.stopDebugging(parent.id); + build = new FakeBuildSession(); + parent = createParent('parent-2'); + children = []; + await startWithChild({ platform: 'ios', request: 'attach', address: '192.168.1.5' }, 42000); + expect(lastChildConfig().websocketAddress).toBe('ws://192.168.1.5:42000'); + }); + + it("falls back to the parent's workspace folder for appRoot", async () => { + await startWithChild({ platform: 'android', request: 'launch' }); + expect(startBuild.mock.calls[0][0].appRoot).toBe('/workspace/app'); + }); + + it('maps diagnosticLogging to trace when trace is unset', async () => { + await startWithChild({ platform: 'android', request: 'launch', diagnosticLogging: true }); + expect(lastChildConfig().trace).toBe(true); + }); + + it('passes user source map settings through to the child config', async () => { + const userOverrides = { 'webpack://custom/*': '/projects/demo/custom/*' }; + await startWithChild({ + platform: 'android', + request: 'launch', + appRoot: '/projects/demo', + sourceMapPathOverrides: userOverrides, + resolveSourceMapLocations: ['/projects/demo/**'], + }); + + expect(computeSourceMapOptions).toHaveBeenCalledWith( + '/projects/demo', + { + platform: 'android', + sourceMapPathOverrides: userOverrides, + resolveSourceMapLocations: ['/projects/demo/**'], + }, + logger, + ); + expect(lastChildConfig()).toMatchObject({ + sourceMapPathOverrides: { 'webpack:///*': '/default/*', ...userOverrides }, + resolveSourceMapLocations: ['/projects/demo/**'], + }); + }); + + it('computes source map options once, on the first attach', async () => { + const started = start({ platform: 'android', request: 'launch', watch: true }); + await vi.advanceTimersByTimeAsync(0); + expect(computeSourceMapOptions).not.toHaveBeenCalled(); + + build.resolvePort(40000); + await started; + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); + + expect(children).toHaveLength(2); + expect(computeSourceMapOptions).toHaveBeenCalledOnce(); + }); + + it('retries the child start when VS Code reports failure', async () => { + const succeed = debug.startDebugging.getMockImplementation()!; + debug.startDebugging.mockImplementationOnce(async () => false); + debug.startDebugging.mockImplementationOnce(succeed); + + const started = start({ platform: 'android', request: 'launch' }); + build.resolvePort(40000); + await vi.advanceTimersByTimeAsync(CHILD_RETRY_DELAY_MS); + + await expect(started).resolves.toBe(true); + expect(debug.startDebugging).toHaveBeenCalledTimes(2); + expect(children).toHaveLength(1); + }); + + it('cleans up and reports an error when every initial attach attempt fails', async () => { + debug.startDebugging.mockImplementation(async () => false); + + const started = start({ platform: 'android', request: 'launch', watch: true }); + build.resolvePort(40000); + await vi.advanceTimersByTimeAsync(CHILD_RETRY_DELAY_MS * 3); + + await expect(started).resolves.toBe(false); + expect(debug.startDebugging).toHaveBeenCalledTimes(3); + expect(window.showErrorMessage).toHaveBeenCalledExactlyOnceWith( + 'Could not attach the debugger to the app on port 40000.', + ); + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(activeSessionCount()).toBe(0); + expect(onTerminated).not.toHaveBeenCalled(); + }); + + it('does not report an attach failure when stopped during the retries', async () => { + debug.startDebugging.mockImplementation(async () => false); + + const started = start({ platform: 'android', request: 'launch' }); + build.resolvePort(40000); + await vi.advanceTimersByTimeAsync(0); + manager.stopDebugging(parent.id); + await vi.advanceTimersByTimeAsync(CHILD_RETRY_DELAY_MS * 3); + + await expect(started).resolves.toBe(false); + expect(debug.startDebugging).toHaveBeenCalledOnce(); + expect(window.showErrorMessage).not.toHaveBeenCalled(); + }); + + it('stops a child that finishes starting after the parent was stopped', async () => { + const childStart = deferred(); + debug.startDebugging.mockImplementation(async (_folder, config) => { + const result = await childStart.promise; + const child: MockDebugSession = { id: 'late-child', type: 'pwa-node', name: 'late', configuration: config }; + children.push(child); + testing.fireDidStartDebugSession(child); + return result; + }); + + const started = start({ platform: 'android', request: 'launch' }); + build.resolvePort(40000); + await vi.advanceTimersByTimeAsync(0); + manager.stopDebugging(parent.id); + childStart.resolve(true); + + await expect(started).resolves.toBe(false); + expect(debug.stopDebugging).toHaveBeenCalledWith(children[0]); + }); + + it('returns false without starting a child when no port is announced', async () => { + const started = start({ platform: 'android', request: 'launch' }); + build.resolvePort(undefined); + + await expect(started).resolves.toBe(false); + expect(debug.startDebugging).not.toHaveBeenCalled(); + expect(computeSourceMapOptions).not.toHaveBeenCalled(); + expect(build.disconnect).toHaveBeenCalled(); + expect(activeSessionCount()).toBe(0); + }); + }); + + describe('cancellation during startBuild', () => { + it('reports cancellation to startBuild and starts nothing when it returns null', async () => { + const pending = deferred(); + startBuild.mockImplementation(() => pending.promise); + + const started = start({ platform: 'ios', request: 'launch' }); + const isCancelled = startBuild.mock.calls[0][1]; + expect(isCancelled()).toBe(false); + + manager.stopDebugging(parent.id); + expect(isCancelled()).toBe(true); + + pending.resolve(null); + await expect(started).resolves.toBe(false); + expect(debug.startDebugging).not.toHaveBeenCalled(); + expect(onTerminated).not.toHaveBeenCalled(); + }); + + it('disconnects a build session that is returned after the stop', async () => { + const pending = deferred(); + startBuild.mockImplementation(() => pending.promise); + + const started = start({ platform: 'android', request: 'launch' }); + manager.stopDebugging(parent.id); + pending.resolve(build as unknown as BuildSession); + + await expect(started).resolves.toBe(false); + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(debug.startDebugging).not.toHaveBeenCalled(); + expect(activeSessionCount()).toBe(0); + }); + + it('does not start a child when stopped while waiting for the initial port', async () => { + const started = start({ platform: 'android', request: 'launch' }); + await vi.advanceTimersByTimeAsync(0); + + manager.stopDebugging(parent.id); + expect(build.disconnect).toHaveBeenCalledOnce(); + + await expect(started).resolves.toBe(false); + expect(debug.startDebugging).not.toHaveBeenCalled(); + }); + }); + + it('shows, rethrows and cleans up when startBuild fails', async () => { + startBuild.mockRejectedValue(new Error('CLI too old')); + + await expect(start({ platform: 'android', request: 'launch' })).rejects.toThrow('CLI too old'); + + expect(window.showErrorMessage).toHaveBeenCalledWith('CLI too old'); + expect(activeSessionCount()).toBe(0); + expect(debug.startDebugging).not.toHaveBeenCalled(); + }); + + describe('LiveSync restarts', () => { + it('replaces the child on newPort without terminating the parent', async () => { + const first = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); + + expect(debug.stopDebugging).toHaveBeenCalledWith(first); + expect(debug.startDebugging).toHaveBeenCalledTimes(2); + expect(lastChildConfig().websocketAddress).toBe('ws://127.0.0.1:41000'); + + await vi.advanceTimersByTimeAsync(RECONNECT_TIMEOUT_MS * 2); + expect(onTerminated).not.toHaveBeenCalled(); + expect(build.disconnect).not.toHaveBeenCalled(); + }); + + it('ignores a late termination event for the replaced child', async () => { + const first = await startWithChild({ platform: 'android', request: 'launch', watch: false }); + debug.stopDebugging.mockImplementation(async () => undefined); + + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); + testing.fireDidTerminateDebugSession(first); + + expect(onTerminated).not.toHaveBeenCalled(); + expect(children).toHaveLength(2); + }); + + it('keeps the session alive when re-attaching after newPort fails, and recovers on the next port', async () => { + await startWithChild({ platform: 'android', request: 'launch', watch: true }); + const succeed = debug.startDebugging.getMockImplementation()!; + debug.startDebugging.mockImplementation(async () => false); + + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS + CHILD_RETRY_DELAY_MS * 3); + + expect(debug.startDebugging).toHaveBeenCalledTimes(4); + expect(onTerminated).not.toHaveBeenCalled(); + expect(build.disconnect).not.toHaveBeenCalled(); + expect(window.showErrorMessage).not.toHaveBeenCalled(); + + debug.startDebugging.mockImplementation(succeed); + build.emit('newPort', 42000); + await vi.advanceTimersByTimeAsync(0); + + expect(children).toHaveLength(2); + expect(lastChildConfig().websocketAddress).toBe('ws://127.0.0.1:42000'); + }); + + it('serializes back-to-back port announcements and ends on the latest port', async () => { + await startWithChild({ platform: 'android', request: 'launch', watch: true }); + + build.emit('newPort', 41000); + build.emit('newPort', 42000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS * 2); + + expect(debug.startDebugging.mock.calls.map(([, config]) => config.websocketAddress)).toEqual([ + 'ws://127.0.0.1:40000', + 'ws://127.0.0.1:41000', + 'ws://127.0.0.1:42000', + ]); + expect(debug.stopDebugging.mock.calls.map(([session]) => session?.id)).toEqual(['child-1', 'child-2']); + expect(onTerminated).not.toHaveBeenCalled(); + }); + }); + + describe('unexpected child termination', () => { + it('waits for a new port in watch mode and reconnects', async () => { + const first = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + + testing.fireDidTerminateDebugSession(first); + await vi.advanceTimersByTimeAsync(RECONNECT_TIMEOUT_MS - 1); + expect(onTerminated).not.toHaveBeenCalled(); + + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(0); + + expect(debug.stopDebugging).not.toHaveBeenCalled(); + expect(children).toHaveLength(2); + expect(lastChildConfig().websocketAddress).toBe('ws://127.0.0.1:41000'); + + await vi.advanceTimersByTimeAsync(RECONNECT_TIMEOUT_MS); + expect(onTerminated).not.toHaveBeenCalled(); + }); + + it('terminates in watch mode when no new port arrives in time', async () => { + const first = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + + testing.fireDidTerminateDebugSession(first); + await vi.advanceTimersByTimeAsync(RECONNECT_TIMEOUT_MS); + + expect(onTerminated).toHaveBeenCalledOnce(); + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(activeSessionCount()).toBe(0); + + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); + expect(children).toHaveLength(1); + }); + + it('terminates immediately without watch', async () => { + const first = await startWithChild({ platform: 'android', request: 'launch', watch: false }); + + testing.fireDidTerminateDebugSession(first); + + expect(onTerminated).toHaveBeenCalledOnce(); + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(activeSessionCount()).toBe(0); + }); + + it('ignores terminations of sessions it does not own', async () => { + await startWithChild({ platform: 'android', request: 'launch', watch: false }); + + testing.fireDidTerminateDebugSession({ id: 'other', type: 'pwa-node', name: 'other', configuration: {} }); + testing.fireDidTerminateDebugSession({ + id: 'foreign-child', + type: 'pwa-node', + name: 'foreign', + configuration: { [PARENT_SESSION_KEY]: 'someone-else' }, + }); + + expect(onTerminated).not.toHaveBeenCalled(); + }); + }); + + it('terminates when the ns process closes', async () => { + const child = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + + build.emit('closed', 0); + + expect(onTerminated).toHaveBeenCalledOnce(); + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(debug.stopDebugging).toHaveBeenCalledWith(child); + }); + + it('terminates when the ns process closes before announcing a port', async () => { + const started = start({ platform: 'android', request: 'launch', watch: true }); + await vi.advanceTimersByTimeAsync(0); + + build.emit('closed', 1); + + expect(onTerminated).toHaveBeenCalledOnce(); + await expect(started).resolves.toBe(false); + expect(debug.startDebugging).not.toHaveBeenCalled(); + }); + + it('disconnects the build and stops the child when the parent session terminates', async () => { + const child = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + + testing.fireDidTerminateDebugSession(parent); + + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(debug.stopDebugging).toHaveBeenCalledWith(child); + expect(onTerminated).not.toHaveBeenCalled(); + expect(activeSessionCount()).toBe(0); + + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); + expect(children).toHaveLength(1); + }); + + it('stopDebugging disconnects the build, stops the child and does not call onTerminated', async () => { + const child = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + + manager.stopDebugging(parent.id); + manager.stopDebugging(parent.id); + + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(debug.stopDebugging).toHaveBeenCalledExactlyOnceWith(child); + expect(onTerminated).not.toHaveBeenCalled(); + }); + + it('dispose cleans up every active session', async () => { + await startWithChild({ platform: 'android', request: 'launch' }); + + manager.dispose(); + + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(activeSessionCount()).toBe(0); + }); +}); diff --git a/src/tests/ga4Client.test.ts b/src/tests/ga4Client.test.ts new file mode 100644 index 0000000..0eea993 --- /dev/null +++ b/src/tests/ga4Client.test.ts @@ -0,0 +1,108 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { Ga4Client, loadGa4Config, toEventName } from '../analytics/ga4Client'; + +describe('toEventName', () => { + it.each([ + ['debug', 'debug'], + ['Debug-Launch ios', 'Debug_Launch_ios'], + ['123_start', 'start'], + ['_-.private', 'private'], + ['', 'vscode_event'], + ['1234', 'vscode_event'], + ['a'.repeat(50), 'a'.repeat(40)], + ])('normalizes %j to %j', (input, expected) => { + expect(toEventName(input)).toBe(expected); + }); +}); + +describe('Ga4Client.sendEvent', () => { + const config = { measurementId: 'G-ABC123', apiSecret: 'se/cret&key' }; + + const createFetch = (response: Partial = { ok: true, status: 204 }) => + vi.fn(async (_url: string | URL | Request, _init?: RequestInit) => response as Response); + + it('posts the event to the Measurement Protocol endpoint', async () => { + const fetchImpl = createFetch(); + const client = new Ga4Client(config, 'client-1', fetchImpl); + + await client.sendEvent('Debug-Launch', { platform: 'ios', count: 2, watch: true, missing: undefined }); + + expect(fetchImpl).toHaveBeenCalledOnce(); + const [url, init] = fetchImpl.mock.calls[0]; + expect(url).toBe('https://www.google-analytics.com/mp/collect?measurement_id=G-ABC123&api_secret=se%2Fcret%26key'); + expect(init).toMatchObject({ method: 'POST', headers: { 'Content-Type': 'application/json' } }); + expect(JSON.parse(init!.body as string)).toEqual({ + client_id: 'client-1', + non_personalized_ads: true, + events: [ + { + name: 'Debug_Launch', + params: { engagement_time_msec: 1, platform: 'ios', count: 2, watch: true }, + }, + ], + }); + }); + + it('truncates long string params to 100 characters', async () => { + const fetchImpl = createFetch(); + const client = new Ga4Client(config, 'client-1', fetchImpl); + + await client.sendEvent('error', { message: 'x'.repeat(250) }); + + const body = JSON.parse(fetchImpl.mock.calls[0][1]!.body as string); + expect(body.events[0].params.message).toBe('x'.repeat(100)); + }); + + it('throws on a non-ok response', async () => { + const client = new Ga4Client(config, 'client-1', createFetch({ ok: false, status: 400 })); + + await expect(client.sendEvent('debug', {})).rejects.toThrow('GA4 responded with HTTP 400'); + }); + + it('propagates network errors', async () => { + const fetchImpl = vi.fn(async () => { + throw new Error('offline'); + }); + const client = new Ga4Client(config, 'client-1', fetchImpl); + + await expect(client.sendEvent('debug', {})).rejects.toThrow('offline'); + }); +}); + +describe('loadGa4Config', () => { + let dir: string; + const configFile = () => path.join(dir, 'ga-config.json'); + + beforeEach(() => { + dir = fs.mkdtempSync(path.join(os.tmpdir(), 'ns-ga4-')); + }); + + afterEach(() => { + fs.rmSync(dir, { recursive: true, force: true }); + }); + + it('returns undefined when the file is missing', () => { + expect(loadGa4Config(configFile())).toBeUndefined(); + }); + + it('returns undefined for invalid JSON', () => { + fs.writeFileSync(configFile(), '{ nope'); + expect(loadGa4Config(configFile())).toBeUndefined(); + }); + + it.each([[{ measurementId: 'G-ABC123' }], [{ apiSecret: 'secret' }], [{ measurementId: '', apiSecret: 'secret' }]])( + 'returns undefined for partial config %j', + (content) => { + fs.writeFileSync(configFile(), JSON.stringify(content)); + expect(loadGa4Config(configFile())).toBeUndefined(); + }, + ); + + it('returns only the known keys of a valid config', () => { + fs.writeFileSync(configFile(), JSON.stringify({ measurementId: 'G-ABC123', apiSecret: 'secret', extra: 1 })); + expect(loadGa4Config(configFile())).toEqual({ measurementId: 'G-ABC123', apiSecret: 'secret' }); + }); +}); diff --git a/src/tests/iosProject.test.ts b/src/tests/iosProject.test.ts new file mode 100644 index 0000000..71da66a --- /dev/null +++ b/src/tests/iosProject.test.ts @@ -0,0 +1,77 @@ +import { ChildProcess } from 'child_process'; +import { EventEmitter } from 'events'; +import { PassThrough } from 'stream'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { IosProject } from '../project/iosProject'; +import { NativeScriptCli } from '../project/nativeScriptCli'; + +const READY_DELAY_MS = 1000; +const APP_ROOT = '/projects/demo'; + +function createCli() { + const stdout = new PassThrough(); + const proc = Object.assign(new EventEmitter(), { stdout, stderr: new PassThrough() }); + const execute = vi.fn((_args: string[], _cwd: string) => proc as unknown as ChildProcess); + return { cli: { execute } as unknown as NativeScriptCli, execute, stdout, proc }; +} + +async function writeLine(stream: PassThrough, line: string): Promise { + stream.write(`${line}\n`); + await vi.advanceTimersByTimeAsync(0); +} + +describe('IosProject', () => { + let fake: ReturnType; + let ready: ReturnType void>>; + const originalPlatform = process.platform; + const setPlatform = (platform: string) => Object.defineProperty(process, 'platform', { value: platform }); + + beforeEach(() => { + vi.useFakeTimers(); + setPlatform('darwin'); + fake = createCli(); + ready = vi.fn<(port: number) => void>(); + }); + + afterEach(() => { + setPlatform(originalPlatform); + vi.useRealTimers(); + }); + + it('refuses to run outside macOS', () => { + setPlatform('linux'); + expect(() => new IosProject(APP_ROOT, fake.cli)).toThrow('iOS platform is supported only on OS X.'); + }); + + it('builds the debug and attach command lines', () => { + const project = new IosProject(APP_ROOT, fake.cli); + + project.debug({ stopOnEntry: true, watch: true, launchTests: false }, ['--teamId', 'ABC']); + project.attach(['--env.foo']); + + expect(fake.execute.mock.calls).toEqual([ + [['debug', 'ios', '--watch', '--debug-brk', '--teamId', 'ABC'], APP_ROOT], + [['debug', 'ios', '--start', '--env.foo'], APP_ROOT], + ]); + }); + + it('announces the port from "Opened localhost" one second later', async () => { + const { tnsOutputEventEmitter } = new IosProject(APP_ROOT, fake.cli).debug({ + stopOnEntry: false, + watch: true, + launchTests: false, + }); + tnsOutputEventEmitter.on('readyForConnection', ready); + + await writeLine(fake.stdout, 'Opened localhost 41000'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS - 1); + expect(ready).not.toHaveBeenCalled(); + + await vi.advanceTimersByTimeAsync(1); + expect(ready).toHaveBeenCalledExactlyOnceWith(41000); + + await writeLine(fake.stdout, 'Opened localhost 41001'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + expect(ready).toHaveBeenLastCalledWith(41001); + }); +}); diff --git a/src/tests/mocks/vscode.ts b/src/tests/mocks/vscode.ts new file mode 100644 index 0000000..78a40a9 --- /dev/null +++ b/src/tests/mocks/vscode.ts @@ -0,0 +1,81 @@ +/** + * Minimal stand-in for the `vscode` module (aliased in vitest.config.mts). Only covers the API surface the + * extension uses; tests drive events through the exported `fire*` helpers and inspect the `vi.fn()` spies. + */ +import { vi } from 'vitest'; + +type Listener = (e: T) => unknown; + +export class EventEmitter { + private listeners = new Set>(); + + public event = (listener: Listener) => { + this.listeners.add(listener); + return { dispose: () => this.listeners.delete(listener) }; + }; + + public fire(e: T): void { + for (const listener of [...this.listeners]) listener(e); + } + + public dispose(): void { + this.listeners.clear(); + } +} + +export interface MockDebugSession { + id: string; + type: string; + name: string; + configuration: Record; + workspaceFolder?: unknown; + parentSession?: MockDebugSession; +} + +const didStart = new EventEmitter(); +const didTerminate = new EventEmitter(); + +export const testing = { + fireDidStartDebugSession: (session: MockDebugSession) => didStart.fire(session), + fireDidTerminateDebugSession: (session: MockDebugSession) => didTerminate.fire(session), + configuration: {} as Record, +}; + +export const debug = { + onDidStartDebugSession: didStart.event, + onDidTerminateDebugSession: didTerminate.event, + startDebugging: vi.fn( + async (_folder: unknown, _config: Record, _options?: Record): Promise => + true, + ), + stopDebugging: vi.fn(async (_session?: MockDebugSession): Promise => undefined), +}; + +export const workspace = { + workspaceFolders: undefined as unknown[] | undefined, + getWorkspaceFolder: vi.fn(() => undefined), + getConfiguration: vi.fn(() => ({ + get: (key: string, defaultValue?: T) => + key in testing.configuration ? testing.configuration[key] : defaultValue, + update: vi.fn(async () => undefined), + })), +}; + +export const window = { + showErrorMessage: vi.fn(async (_message: string, ..._items: unknown[]): Promise => undefined), + showInformationMessage: vi.fn(async () => undefined), + showQuickPick: vi.fn(async () => undefined), +}; + +export const env = { isTelemetryEnabled: true }; +export const version = '1.109.0'; + +export const Uri = { + file: (fsPath: string) => ({ fsPath, scheme: 'file', path: fsPath }), +}; + +export enum ConfigurationTarget { + Global = 1, + Workspace = 2, + WorkspaceFolder = 3, +} diff --git a/src/tests/nativeScriptDebugAdapter.tests.ts b/src/tests/nativeScriptDebugAdapter.test.ts similarity index 77% rename from src/tests/nativeScriptDebugAdapter.tests.ts rename to src/tests/nativeScriptDebugAdapter.test.ts index daabde5..47221d8 100644 --- a/src/tests/nativeScriptDebugAdapter.tests.ts +++ b/src/tests/nativeScriptDebugAdapter.test.ts @@ -1,12 +1,11 @@ -import * as assert from 'assert'; -import * as sinon from 'sinon'; +import { beforeEach, describe, expect, it, vi } from 'vitest'; import { NativeScriptDebugAdapter } from '../debug-adapter/nativeScriptDebugAdapter'; import { DebugManager } from '../debug-adapter/debugManager'; const createMockDebugManager = () => ({ - startDebugging: sinon.stub().resolves(), - stopDebugging: sinon.stub(), - dispose: sinon.stub(), + startDebugging: vi.fn(async () => true), + stopDebugging: vi.fn(), + dispose: vi.fn(), }); const createMockSession = (id = 'test-session-id') => ({ @@ -28,13 +27,13 @@ describe('NativeScriptDebugAdapter', () => { }); it('should create adapter with debug manager', () => { - assert.ok(adapter); + expect(adapter).toBeDefined(); }); it('should set parent session', () => { const session = createMockSession('custom-id'); adapter.setParentSession(session as any); - assert.ok(adapter); + expect(adapter).toBeDefined(); }); it('should call debugManager.stopDebugging on disconnect with parent session id', () => { @@ -42,8 +41,8 @@ describe('NativeScriptDebugAdapter', () => { { body: {}, success: true, command: 'disconnect', type: 'response', request_seq: 1, seq: 0 }, {}, ); - assert.ok(debugManager.stopDebugging.calledOnce); - assert.ok(debugManager.stopDebugging.calledWith(mockSession.id)); + expect(debugManager.stopDebugging).toHaveBeenCalledOnce(); + expect(debugManager.stopDebugging).toHaveBeenCalledWith(mockSession.id); }); it('should call debugManager.stopDebugging on terminate with parent session id', () => { @@ -51,25 +50,25 @@ describe('NativeScriptDebugAdapter', () => { { body: {}, success: true, command: 'terminate', type: 'response', request_seq: 1, seq: 0 }, {}, ); - assert.ok(debugManager.stopDebugging.calledOnce); - assert.ok(debugManager.stopDebugging.calledWith(mockSession.id)); + expect(debugManager.stopDebugging).toHaveBeenCalledOnce(); + expect(debugManager.stopDebugging).toHaveBeenCalledWith(mockSession.id); }); it('should return empty threads', () => { const response: any = { body: {}, success: true, command: 'threads', type: 'response', request_seq: 1, seq: 0 }; (adapter as any).threadsRequest(response); - assert.deepStrictEqual(response.body.threads, []); + expect(response.body.threads).toEqual([]); }); it('should call debugManager.startDebugging on launch', async () => { const response: any = { body: {}, success: true, command: 'launch', type: 'response', request_seq: 1, seq: 0 }; await (adapter as any).launchRequest(response, { platform: 'ios', appRoot: '/test' }); - assert.ok(debugManager.startDebugging.calledOnce); + expect(debugManager.startDebugging).toHaveBeenCalledOnce(); }); it('should call debugManager.startDebugging on attach', async () => { const response: any = { body: {}, success: true, command: 'attach', type: 'response', request_seq: 1, seq: 0 }; await (adapter as any).attachRequest(response, { platform: 'android', appRoot: '/test' }); - assert.ok(debugManager.startDebugging.calledOnce); + expect(debugManager.startDebugging).toHaveBeenCalledOnce(); }); }); diff --git a/src/tests/projectInfo.test.ts b/src/tests/projectInfo.test.ts new file mode 100644 index 0000000..57c6ef8 --- /dev/null +++ b/src/tests/projectInfo.test.ts @@ -0,0 +1,116 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { afterEach, beforeEach, describe, expect, it } from 'vitest'; +import { getAppDirectory, getBundler, isVitestProject, readPackageJson } from '../project/projectInfo'; + +describe('projectInfo', () => { + let appRoot: string; + + const writeAppFile = (relativePath: string, content: string) => { + const file = path.join(appRoot, relativePath); + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, content); + }; + + beforeEach(() => { + appRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'ns-project-info-')); + }); + + afterEach(() => { + fs.rmSync(appRoot, { recursive: true, force: true }); + }); + + describe('getAppDirectory', () => { + it('defaults to app', () => { + expect(getAppDirectory(appRoot)).toBe('app'); + }); + + it('uses src when it exists', () => { + fs.mkdirSync(path.join(appRoot, 'src')); + expect(getAppDirectory(appRoot)).toBe('src'); + }); + + it('reads appPath from nsconfig.json first', () => { + writeAppFile('nsconfig.json', JSON.stringify({ appPath: 'legacy' })); + writeAppFile('nativescript.config.ts', "export default { appPath: 'modern' };\n"); + + expect(getAppDirectory(appRoot)).toBe('legacy'); + }); + + it.each([ + ['invalid JSON', '{ not json'], + ['no appPath', JSON.stringify({ appResourcesPath: 'res' })], + ['empty appPath', JSON.stringify({ appPath: '' })], + ])('falls through when nsconfig.json has %s', (_label, content) => { + writeAppFile('nsconfig.json', content); + fs.mkdirSync(path.join(appRoot, 'src')); + + expect(getAppDirectory(appRoot)).toBe('src'); + }); + + it.each([ + ['nativescript.config.ts', "export default {\n id: 'org.demo',\n appPath: 'src/app',\n};\n"], + ['nativescript.config.js', 'module.exports = { appPath: "client" };\n'], + ['nativescript.config.mjs', 'export default { appPath: `mjs-app` };\n'], + ])('reads appPath from %s', (file, content) => { + writeAppFile(file, content); + fs.mkdirSync(path.join(appRoot, 'src')); + + expect(getAppDirectory(appRoot)).toBe(content.match(/appPath: ["'`]([^"'`]+)/)![1]); + }); + + it('prefers nativescript.config.ts over .js', () => { + writeAppFile('nativescript.config.ts', "export default { appPath: 'from-ts' };\n"); + writeAppFile('nativescript.config.js', "module.exports = { appPath: 'from-js' };\n"); + + expect(getAppDirectory(appRoot)).toBe('from-ts'); + }); + }); + + describe('getBundler', () => { + it('defaults to webpack without a config', () => { + expect(getBundler(appRoot)).toBe('webpack'); + }); + + it.each([ + ['vite', 'vite'], + ['rspack', 'rspack'], + ['webpack', 'webpack'], + ['parcel', 'webpack'], + ] as const)('maps bundler %s to %s', (bundler, expected) => { + writeAppFile('nativescript.config.ts', `export default { id: 'org.demo', bundler: '${bundler}' };\n`); + expect(getBundler(appRoot)).toBe(expected); + }); + + it('defaults to webpack when the config has no bundler', () => { + writeAppFile('nativescript.config.ts', "export default { id: 'org.demo' };\n"); + expect(getBundler(appRoot)).toBe('webpack'); + }); + }); + + describe('isVitestProject', () => { + it('is false without a vitest config', () => { + writeAppFile('vite.config.ts', 'export default {};\n'); + expect(isVitestProject(appRoot)).toBe(false); + }); + + it.each(['ts', 'mts', 'js', 'mjs'])('detects vitest.config.%s', (ext) => { + writeAppFile(`vitest.config.${ext}`, 'export default {};\n'); + expect(isVitestProject(appRoot)).toBe(true); + }); + }); + + describe('readPackageJson', () => { + it('parses package.json', () => { + writeAppFile('package.json', JSON.stringify({ name: 'demo-app', version: '1.0.0' })); + expect(readPackageJson(appRoot)).toEqual({ name: 'demo-app', version: '1.0.0' }); + }); + + it('returns undefined when missing or invalid', () => { + expect(readPackageJson(appRoot)).toBeUndefined(); + writeAppFile('package.json', '{ invalid'); + expect(readPackageJson(appRoot)).toBeUndefined(); + }); + }); +}); diff --git a/src/tests/sourceMaps.test.ts b/src/tests/sourceMaps.test.ts new file mode 100644 index 0000000..afd1d62 --- /dev/null +++ b/src/tests/sourceMaps.test.ts @@ -0,0 +1,254 @@ +import * as childProcess from 'child_process'; +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { afterEach, beforeEach, describe, expect, it, vi, type Mock } from 'vitest'; +import { ILogger } from '../common/logger'; +import { + computeSourceMapOptions, + defaultPathOverrides, + deviceMapOverrides, + getLocalPlatformAppDir, + readWebpackOutput, +} from '../debug-adapter/sourceMaps'; + +vi.mock('child_process', async (importOriginal) => { + const original = await importOriginal(); + return { ...original, execFile: vi.fn(original.execFile) }; +}); + +const EXTENSIONS = ['js', 'mjs', 'ts', 'mts', 'vue', 'svelte', 'jsx', 'tsx']; + +describe('sourceMaps', () => { + let appRoot: string; + let logger: { log: Mock }; + + const writeAppFile = (relativePath: string, content: string) => { + const file = path.join(appRoot, relativePath); + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, content); + }; + + beforeEach(() => { + appRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'ns-source-maps-')); + logger = { log: vi.fn() }; + }); + + afterEach(() => { + fs.rmSync(appRoot, { recursive: true, force: true }); + }); + + describe('defaultPathOverrides', () => { + it('maps webpack:/// to the app directory and the package namespace to the app root', () => { + fs.mkdirSync(path.join(appRoot, 'src')); + + const overrides = defaultPathOverrides(appRoot, 'demo-app', {}); + + const expected: Record = { 'webpack:///*': `${appRoot}/src/*` }; + for (const ext of EXTENSIONS) expected[`webpack://demo-app/*.${ext}`] = `${appRoot}/*.${ext}`; + expect(overrides).toEqual(expected); + }); + + it('falls back to the app/ directory', () => { + expect(defaultPathOverrides(appRoot, undefined, {})['webpack:///*']).toBe(path.join(appRoot, 'app') + '/*'); + }); + + it('honors appPath from nativescript.config.ts', () => { + fs.mkdirSync(path.join(appRoot, 'src')); + writeAppFile('nativescript.config.ts', "export default { id: 'org.demo', appPath: 'src/app' };\n"); + + expect(defaultPathOverrides(appRoot, undefined, {})['webpack:///*']).toBe(`${appRoot}/src/app/*`); + }); + + it('prefers devtoolNamespace over the package name', () => { + const overrides = defaultPathOverrides(appRoot, 'demo-app', { devtoolNamespace: 'custom-ns' }); + + expect(overrides['webpack://custom-ns/*.ts']).toBe(`${appRoot}/*.ts`); + expect(Object.keys(overrides).some((key) => key.includes('demo-app'))).toBe(false); + }); + + it('maps the library name to the app directory', () => { + const overrides = defaultPathOverrides(appRoot, undefined, { library: 'MyLib' }); + + expect(overrides['webpack://MyLib/*']).toBe(path.join(appRoot, 'app') + '/*'); + }); + + it('only maps webpack:/// without a package name or namespace', () => { + expect(defaultPathOverrides(appRoot, undefined, {})).toEqual({ + 'webpack:///*': path.join(appRoot, 'app') + '/*', + }); + }); + }); + + describe('getLocalPlatformAppDir', () => { + it('finds the Android assets app dir', () => { + const dir = path.join(appRoot, 'platforms/android/app/src/main/assets/app'); + fs.mkdirSync(dir, { recursive: true }); + + expect(getLocalPlatformAppDir(appRoot, 'Android')).toBe(dir); + }); + + it('finds the iOS app dir inside the Xcode project folder, skipping .xcodeproj', () => { + fs.mkdirSync(path.join(appRoot, 'platforms/ios/Demo.xcodeproj/app'), { recursive: true }); + fs.mkdirSync(path.join(appRoot, 'platforms/ios/build'), { recursive: true }); + const dir = path.join(appRoot, 'platforms/ios/Demo/app'); + fs.mkdirSync(dir, { recursive: true }); + + expect(getLocalPlatformAppDir(appRoot, 'ios')).toBe(dir); + }); + + it('returns undefined before the platform is built or for unknown platforms', () => { + expect(getLocalPlatformAppDir(appRoot, 'android')).toBeUndefined(); + expect(getLocalPlatformAppDir(appRoot, 'ios')).toBeUndefined(); + fs.mkdirSync(path.join(appRoot, 'platforms/ios/Demo'), { recursive: true }); + expect(getLocalPlatformAppDir(appRoot, 'ios')).toBeUndefined(); + expect(getLocalPlatformAppDir(appRoot, undefined)).toBeUndefined(); + }); + }); + + describe('deviceMapOverrides', () => { + it('only maps nsruntime:/// before the platform is built', () => { + expect(deviceMapOverrides(appRoot, 'android')).toEqual({ 'nsruntime:///*': '/*' }); + expect(deviceMapOverrides(appRoot, 'ios')).toEqual({ 'nsruntime:///*': '/*' }); + }); + + it('maps Android device paths to the local assets app dir', () => { + const dir = path.join(appRoot, 'platforms/android/app/src/main/assets/app'); + fs.mkdirSync(dir, { recursive: true }); + + expect(deviceMapOverrides(appRoot, 'android')).toEqual({ + 'nsruntime:///*': '/*', + 'nsruntime:///data/?:*/files/app/*': `${dir}/*`, + 'file:///data/?:*/files/app/*': `${dir}/*`, + }); + }); + + it('maps iOS bundle paths to the local Xcode project app dir', () => { + const dir = path.join(appRoot, 'platforms/ios/Demo/app'); + fs.mkdirSync(dir, { recursive: true }); + + expect(deviceMapOverrides(appRoot, 'iOS')).toEqual({ + 'nsruntime:///*': '/*', + 'nsruntime:///app/*': `${dir}/*`, + 'file:///app/*': `${dir}/*`, + 'nsruntime:///?:*.app/app/*': `${dir}/*`, + 'file:///?:*.app/app/*': `${dir}/*`, + }); + }); + }); + + describe('computeSourceMapOptions', () => { + it('merges device and webpack defaults and leaves resolveSourceMapLocations unrestricted', async () => { + writeAppFile('package.json', JSON.stringify({ name: 'demo-app' })); + const localAppDir = path.join(appRoot, 'platforms/android/app/src/main/assets/app'); + fs.mkdirSync(localAppDir, { recursive: true }); + + const options = await computeSourceMapOptions(appRoot, { platform: 'android' }, logger); + + expect(options.sourceMapPathOverrides).toMatchObject({ + 'nsruntime:///*': '/*', + 'file:///data/?:*/files/app/*': `${localAppDir}/*`, + 'webpack:///*': path.join(appRoot, 'app') + '/*', + 'webpack://demo-app/*.ts': `${appRoot}/*.ts`, + }); + expect(options.resolveSourceMapLocations).toBeNull(); + }); + + it('lets user overrides win over device and webpack defaults', async () => { + fs.mkdirSync(path.join(appRoot, 'platforms/android/app/src/main/assets/app'), { recursive: true }); + + const options = await computeSourceMapOptions( + appRoot, + { + platform: 'android', + sourceMapPathOverrides: { + 'webpack:///*': '/custom/*', + 'nsruntime:///*': '/runtime/*', + 'file:///data/?:*/files/app/*': '/device/*', + 'extra:///*': '/extra/*', + }, + }, + logger, + ); + + expect(options.sourceMapPathOverrides).toMatchObject({ + 'webpack:///*': '/custom/*', + 'nsruntime:///*': '/runtime/*', + 'file:///data/?:*/files/app/*': '/device/*', + 'extra:///*': '/extra/*', + }); + }); + + it.each([[['/only/**']], [null]])('passes resolveSourceMapLocations %j through', async (locations) => { + const options = await computeSourceMapOptions(appRoot, { resolveSourceMapLocations: locations }, logger); + + expect(options.resolveSourceMapLocations).toEqual(locations); + }); + + it('uses the namespace read from webpack.config.js', async () => { + writeAppFile('package.json', JSON.stringify({ name: 'demo-app' })); + writeAppFile('webpack.config.js', "module.exports = { output: { devtoolNamespace: 'from-config' } };\n"); + + const options = await computeSourceMapOptions(appRoot, { platform: 'android' }, logger); + + expect(options.sourceMapPathOverrides['webpack://from-config/*.js']).toBe(`${appRoot}/*.js`); + expect(options.sourceMapPathOverrides['webpack://demo-app/*.js']).toBeUndefined(); + }); + }); + + describe('readWebpackOutput', () => { + it('returns {} when there is no webpack.config.js', async () => { + await expect(readWebpackOutput(appRoot, 'android', logger)).resolves.toEqual({}); + expect(childProcess.execFile).not.toHaveBeenCalled(); + }); + + it('returns {} without evaluating a config that does not customize the output names', async () => { + writeAppFile('webpack.config.js', "throw new Error('must not be evaluated');\n"); + + await expect(readWebpackOutput(appRoot, 'android', logger)).resolves.toEqual({}); + expect(childProcess.execFile).not.toHaveBeenCalled(); + }); + + it('evaluates a function config with the platform env and reads library.name', async () => { + writeAppFile( + 'webpack.config.js', + [ + 'module.exports = (env) => ({', + " output: { devtoolNamespace: env.ios === 'ios' ? 'ios-ns' : 'other-ns', library: { name: 'MyLib' } },", + '});', + ].join('\n'), + ); + + await expect(readWebpackOutput(appRoot, 'iOS', logger)).resolves.toEqual({ + devtoolNamespace: 'ios-ns', + library: 'MyLib', + }); + expect(childProcess.execFile).toHaveBeenCalledOnce(); + }); + + it('reads a string library from the first entry of an async array config', async () => { + writeAppFile( + 'webpack.config.js', + "module.exports = async () => [{ output: { library: 'StrLib' } }, { output: { library: 'Second' } }];\n", + ); + + await expect(readWebpackOutput(appRoot, 'android', logger)).resolves.toEqual({ library: 'StrLib' }); + }); + + it('ignores console output printed by the config', async () => { + writeAppFile( + 'webpack.config.js', + "console.log('loading config');\nmodule.exports = { output: { devtoolNamespace: 'noisy' } };\n", + ); + + await expect(readWebpackOutput(appRoot, 'android', logger)).resolves.toEqual({ devtoolNamespace: 'noisy' }); + }); + + it('returns {} and logs when the config throws', async () => { + writeAppFile('webpack.config.js', "// output.library\nthrow new Error('boom');\n"); + + await expect(readWebpackOutput(appRoot, 'android', logger)).resolves.toEqual({}); + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('Could not evaluate')); + }); + }); +}); diff --git a/src/tsconfig.build.json b/src/tsconfig.build.json new file mode 100644 index 0000000..37be527 --- /dev/null +++ b/src/tsconfig.build.json @@ -0,0 +1,4 @@ +{ + "extends": "./tsconfig.json", + "exclude": ["./tests/**"] +} diff --git a/src/tsconfig.json b/src/tsconfig.json index 74393df..737fc7e 100644 --- a/src/tsconfig.json +++ b/src/tsconfig.json @@ -1,17 +1,16 @@ { - "compilerOptions": { - "target": "es2022", - "module": "commonjs", - "moduleResolution": "node", - "sourceMap": true, - "strict": true, - "outDir": "../out", - "skipLibCheck": true - }, - "exclude": [ - "node_modules" - ], - "include": [ - "./**/*.ts" - ] + "compilerOptions": { + "target": "es2022", + "lib": ["es2023"], + "module": "node16", + "types": ["node"], + "rootDir": ".", + "outDir": "../out", + "sourceMap": true, + "strict": true, + "noFallthroughCasesInSwitch": true, + "noImplicitOverride": true, + "skipLibCheck": true + }, + "include": ["./**/*.ts"] } diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 79a0d19..0000000 --- a/tslint.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "extends": [ - "tslint-eslint-rules", - "tslint:latest" - ], - "rules": { - "space-before-function-paren": [ - true, - { - "anonymous": "always", - "named": "never", - "asyncArrow": "always" - } - ], - "quotemark": [ - true, - "single", - "avoid-escape" - ], - "whitespace": [ - true, - "check-branch", - "check-decl", - "check-operator", - "check-module", - "check-separator", - "check-type" - ], - "newline-before-return": true, - "no-duplicate-variable": true, - "no-unused-expression": [ - true, - "allow-fast-null-checks" - ], - "ter-newline-after-var": true, - "max-line-length": [ - true, - 160 - ], - "max-classes-per-file": false, - "variable-name": [ - true, - "allow-leading-underscore" - ], - "forin": false, - "no-implicit-dependencies": [ - true, - "dev" - ], - "only-arrow-functions": [ - false - ] - } -} \ No newline at end of file diff --git a/vitest.config.mts b/vitest.config.mts new file mode 100644 index 0000000..23d679e --- /dev/null +++ b/vitest.config.mts @@ -0,0 +1,15 @@ +import { fileURLToPath } from 'node:url'; +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + resolve: { + // The real module only exists inside the VS Code extension host. + alias: { vscode: fileURLToPath(new URL('./src/tests/mocks/vscode.ts', import.meta.url)) }, + }, + test: { + include: ['src/**/*.test.ts'], + environment: 'node', + clearMocks: true, + restoreMocks: true, + }, +}); From 1beff8031057b48725dbabe96757205145cc5be7 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Fri, 6 Nov 2026 14:40:47 -0300 Subject: [PATCH 4/7] fix: detach js-debug children directly, await CLI exit, deprecate tnsPath - Children are started with lifecycleManagedByParent, so vscode.debug.stopDebugging(child) is routed to the NativeScript parent and ended the whole session (e.g. replacing the child on a LiveSync restart) while never stopping the child itself. Detach children with a DAP disconnect sent straight to js-debug instead. - Wait for the ns process to exit (SIGKILL after 5s) before answering terminate/disconnect and before reporting self-termination, so Restart can't overlap the old CLI. - Send TerminatedEvent at most once. - Resolve the iOS team picker when dismissed instead of hanging the session. - Android --debug-brk: don't announce a port that was never printed. - Activation CLI check resolves a relative nsPath against the workspace. - Keep nativescript.tnsPath as a deprecated fallback for nativescript.nsPath. --- CHANGELOG.md | 4 +- package.json | 5 + src/common/workspaceConfigService.ts | 33 ++- src/debug-adapter/debugManager.ts | 48 ++-- src/debug-adapter/nativeScriptDebugAdapter.ts | 36 +-- src/main.ts | 3 +- src/project/androidProject.ts | 1 + src/services/buildService.ts | 29 ++- src/services/extensionHostServices.ts | 2 +- src/services/iOSTeamService.ts | 1 + src/tests/androidProject.test.ts | 18 ++ src/tests/buildService.test.ts | 82 ++++++- src/tests/debugManager.test.ts | 145 +++++++++--- src/tests/iOSTeamService.test.ts | 67 ++++++ src/tests/mocks/vscode.ts | 5 +- src/tests/nativeScriptDebugAdapter.test.ts | 209 ++++++++++++++---- src/tests/workspaceConfigService.test.ts | 35 +++ 17 files changed, 602 insertions(+), 121 deletions(-) create mode 100644 src/tests/iOSTeamService.test.ts create mode 100644 src/tests/workspaceConfigService.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 938614a..31d924a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,10 @@ Unreleased - New launch attributes: `address`, `resolveSourceMapLocations`, `skipFiles`, `smartStep`, `trace`. - Analytics use the GA4 Measurement Protocol and respect VS Code's telemetry setting. +## Deprecations + - `nativescript.tnsPath` is deprecated in favor of `nativescript.nsPath` (default `ns`); it is still honored when `nsPath` is not set. + ## Breaking changes - - The `nativescript.tnsPath` setting is now `nativescript.nsPath` (default `ns`). - Requires VS Code 1.109+ and NativeScript CLI 8.0+. - Removed the unused `tnsOutput` and `noDebug` launch attributes; `diagnosticLogging` is deprecated in favor of `trace`. diff --git a/package.json b/package.json index e921ab0..994060d 100644 --- a/package.json +++ b/package.json @@ -78,6 +78,11 @@ "default": "ns", "description": "Path to the NativeScript CLI executable. Relative paths are resolved against the app root." }, + "nativescript.tnsPath": { + "type": "string", + "description": "Path to the NativeScript CLI executable.", + "markdownDeprecationMessage": "Use `#nativescript.nsPath#` instead. Still honored when `nativescript.nsPath` is not set." + }, "nativescript.iosTeamId": { "type": "string", "description": "The iOS development Team ID." diff --git a/src/common/workspaceConfigService.ts b/src/common/workspaceConfigService.ts index 13776fe..cb8beae 100644 --- a/src/common/workspaceConfigService.ts +++ b/src/common/workspaceConfigService.ts @@ -1,6 +1,20 @@ import * as vscode from 'vscode'; +import { ILogger, LogLevel } from './logger'; + +function isExplicitlySet(config: vscode.WorkspaceConfiguration, key: string): boolean { + const inspected = config.inspect(key); + return ( + inspected?.globalValue !== undefined || + inspected?.workspaceValue !== undefined || + inspected?.workspaceFolderValue !== undefined + ); +} export class WorkspaceConfigService { + private warnedAboutTnsPath = false; + + constructor(private readonly logger?: ILogger) {} + public get isAnalyticsEnabled(): boolean { return vscode.workspace.getConfiguration('nativescript').get('analytics.enabled', false); } @@ -11,7 +25,24 @@ export class WorkspaceConfigService { .update('analytics.enabled', enabled, vscode.ConfigurationTarget.Global); } + /** `nativescript.nsPath`, falling back to the deprecated `nativescript.tnsPath` when only that one is set. */ public get nsPath(): string { - return vscode.workspace.getConfiguration('nativescript').get('nsPath', 'ns'); + const config = vscode.workspace.getConfiguration('nativescript'); + + if (!isExplicitlySet(config, 'nsPath') && isExplicitlySet(config, 'tnsPath')) { + const tnsPath = config.get('tnsPath'); + if (tnsPath) { + if (!this.warnedAboutTnsPath) { + this.warnedAboutTnsPath = true; + this.logger?.log( + "The 'nativescript.tnsPath' setting is deprecated. Use 'nativescript.nsPath' instead.", + LogLevel.Warn, + ); + } + return tnsPath; + } + } + + return config.get('nsPath', 'ns'); } } diff --git a/src/debug-adapter/debugManager.ts b/src/debug-adapter/debugManager.ts index 1e70b70..66161e6 100644 --- a/src/debug-adapter/debugManager.ts +++ b/src/debug-adapter/debugManager.ts @@ -109,14 +109,14 @@ export class DebugManager implements vscode.Disposable { () => active.stopping, ); } catch (e) { - this.cleanup(parentSession.id); + void this.cleanup(parentSession.id); void vscode.window.showErrorMessage(e instanceof Error ? e.message : String(e)); throw e; } if (!buildSession || active.stopping) { - buildSession?.disconnect(); - this.cleanup(parentSession.id); + void buildSession?.disconnect(); + void this.cleanup(parentSession.id); return false; } @@ -138,26 +138,27 @@ export class DebugManager implements vscode.Disposable { if (!port || active.stopping) { this.logger.log('[NativeScript] No debug port received, terminating\n'); - this.cleanup(parentSession.id); + void this.cleanup(parentSession.id); return false; } const attached = await this.queueChildStart(active, port); if (!attached && !active.stopping) { - this.cleanup(parentSession.id); + void this.cleanup(parentSession.id); void vscode.window.showErrorMessage(`Could not attach the debugger to the app on port ${port}.`); return false; } return !active.stopping; } - public stopDebugging(parentSessionId: string): void { - this.cleanup(parentSessionId); + /** Resolves once the ns process has exited, so a restart can't race the old CLI. */ + public stopDebugging(parentSessionId: string): Promise { + return this.cleanup(parentSessionId); } public dispose(): void { for (const id of [...this.activeSessions.keys()]) { - this.cleanup(id); + void this.cleanup(id); } for (const disposable of this.disposables) { disposable.dispose(); @@ -184,7 +185,7 @@ export class DebugManager implements vscode.Disposable { if (previous) { active.replacedChildIds.add(previous.id); active.childSession = null; - await vscode.debug.stopDebugging(previous); + await this.disconnectChild(previous); await delay(CHILD_STOP_SETTLE_MS); } @@ -245,7 +246,7 @@ export class DebugManager implements vscode.Disposable { const active = this.activeSessions.get(parentId); if (!active) { // The parent was stopped while this child's startDebugging was still in flight. - void vscode.debug.stopDebugging(session); + void this.disconnectChild(session); return; } @@ -257,7 +258,7 @@ export class DebugManager implements vscode.Disposable { this.logger.log(`[NativeScript] Session terminated: ${session.name} (type=${session.type})\n`); if (this.activeSessions.has(session.id)) { - this.cleanup(session.id); + void this.cleanup(session.id); return; } @@ -288,8 +289,20 @@ export class DebugManager implements vscode.Disposable { private terminate(active: ActiveSession): void { if (active.stopping) return; - this.cleanup(active.parentSession.id); - active.onTerminated(); + // Notify only after the CLI exited, so an immediate relaunch can't overlap the old ns process. + void this.cleanup(active.parentSession.id).then(() => active.onTerminated()); + } + + /** + * Children are started with lifecycleManagedByParent, so vscode.debug.stopDebugging(child) would be routed to the + * NativeScript parent and end the whole session. Sending DAP disconnect straight to js-debug detaches only the child. + */ + private async disconnectChild(session: vscode.DebugSession): Promise { + try { + await session.customRequest('disconnect', { terminateDebuggee: false }); + } catch (e) { + this.logger.log(`[NativeScript] Failed to disconnect child debug session: ${String(e)}\n`); + } } private clearReconnectTimer(active: ActiveSession): void { @@ -299,7 +312,7 @@ export class DebugManager implements vscode.Disposable { } } - private cleanup(parentSessionId: string): void { + private async cleanup(parentSessionId: string): Promise { const active = this.activeSessions.get(parentSessionId); if (!active) return; @@ -307,15 +320,18 @@ export class DebugManager implements vscode.Disposable { this.activeSessions.delete(parentSessionId); this.clearReconnectTimer(active); + let buildExited: Promise | undefined; if (active.buildSession) { active.buildSession.removeAllListeners(); - active.buildSession.disconnect(); + buildExited = active.buildSession.disconnect(); } if (active.childSession) { - void vscode.debug.stopDebugging(active.childSession); + void this.disconnectChild(active.childSession); active.childSession = null; } + + await buildExited; } } diff --git a/src/debug-adapter/nativeScriptDebugAdapter.ts b/src/debug-adapter/nativeScriptDebugAdapter.ts index cd0e92a..f6f2cb8 100644 --- a/src/debug-adapter/nativeScriptDebugAdapter.ts +++ b/src/debug-adapter/nativeScriptDebugAdapter.ts @@ -6,6 +6,7 @@ import * as vscode from 'vscode'; export class NativeScriptDebugAdapter extends DebugSession { private debugManager: DebugManager; private parentSession: vscode.DebugSession | null = null; + private terminated = false; constructor(debugManager: DebugManager) { super(); @@ -56,21 +57,18 @@ export class NativeScriptDebugAdapter extends DebugSession { response: DebugProtocol.DisconnectResponse, _args: DebugProtocol.DisconnectArguments, ): void { - if (this.parentSession) { - this.debugManager.stopDebugging(this.parentSession.id); - } - this.sendResponse(response); + void this.stopNativeScript().then(() => this.sendResponse(response)); } protected override terminateRequest( response: DebugProtocol.TerminateResponse, _args: DebugProtocol.TerminateArguments, ): void { - if (this.parentSession) { - this.debugManager.stopDebugging(this.parentSession.id); - } - this.sendResponse(response); - this.sendEvent(new TerminatedEvent()); + // Respond only after the CLI exited: Restart relaunches as soon as the session ends. + void this.stopNativeScript().then(() => { + this.sendResponse(response); + this.sendTerminated(); + }); } protected override threadsRequest(response: DebugProtocol.ThreadsResponse): void { @@ -78,27 +76,39 @@ export class NativeScriptDebugAdapter extends DebugSession { this.sendResponse(response); } + private async stopNativeScript(): Promise { + if (this.parentSession) { + await this.debugManager.stopDebugging(this.parentSession.id); + } + } + + private sendTerminated(): void { + if (this.terminated) return; + this.terminated = true; + this.sendEvent(new TerminatedEvent()); + } + private async startDebugSession( args: DebugProtocol.LaunchRequestArguments | DebugProtocol.AttachRequestArguments, ): Promise { if (!this.parentSession) { this.sendEvent(new OutputEvent('[NativeScript] No parent session available\n', 'stderr')); - this.sendEvent(new TerminatedEvent()); + this.sendTerminated(); return; } try { const config = { ...args } as NativeScriptDebugConfiguration; const started = await this.debugManager.startDebugging(this.parentSession, config, () => { - this.sendEvent(new TerminatedEvent()); + this.sendTerminated(); }); if (!started) { - this.sendEvent(new TerminatedEvent()); + this.sendTerminated(); } } catch (e) { const msg = e instanceof Error ? e.message : String(e); this.sendEvent(new OutputEvent(`[NativeScript] Error: ${msg}\n`, 'stderr')); - this.sendEvent(new TerminatedEvent()); + this.sendTerminated(); } } } diff --git a/src/main.ts b/src/main.ts index 4a0ad7e..6cdfaf2 100644 --- a/src/main.ts +++ b/src/main.ts @@ -60,7 +60,8 @@ export function activate(context: vscode.ExtensionContext): void { async function checkCli(): Promise { try { - const cliVersion = await services.createCli().getSupportedVersion(services.minCliVersion); + const workspaceRoot = vscode.workspace.workspaceFolders?.[0]?.uri.fsPath; + const cliVersion = await services.createCli(workspaceRoot).getSupportedVersion(services.minCliVersion); services.logger.log(`NativeScript CLI: ${cliVersion}`); services.analyticsService.initialize(cliVersion); } catch (e) { diff --git a/src/project/androidProject.ts b/src/project/androidProject.ts index 8edc0c6..2a36780 100644 --- a/src/project/androidProject.ts +++ b/src/project/androidProject.ts @@ -67,6 +67,7 @@ export class AndroidProject extends Project { ); if (waitForRestartMessage) { new scanner.StringMatchingScanner(readableStream).onEveryMatch('# NativeScript Debugger started #', () => { + if (debugPort === null) return; // wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket setTimeout(() => { eventEmitter.emit('readyForConnection', debugPort); diff --git a/src/services/buildService.ts b/src/services/buildService.ts index f9ea606..376b63f 100644 --- a/src/services/buildService.ts +++ b/src/services/buildService.ts @@ -23,6 +23,9 @@ export interface BuildArgs { /** Ignore repeated port announcements closer together than this; the CLI can print the same port twice. */ const DUPLICATE_PORT_WINDOW_MS = 2000; +/** How long the CLI gets to clean up after SIGINT before it is killed. */ +export const CLI_EXIT_TIMEOUT_MS = 5000; + /** * One running `ns debug`/`ns test` process. * @@ -36,6 +39,7 @@ export class BuildSession extends EventEmitter { private resolveInitialPort?: (port: number | undefined) => void; private lastPortTimestamp = 0; private process: ChildProcess | null; + private exited: Promise = Promise.resolve(); constructor( command: IDebugResult, @@ -62,17 +66,36 @@ export class BuildSession extends EventEmitter { ); } - public disconnect(): void { + /** Stops the CLI and resolves once it has exited (or was force-killed after CLI_EXIT_TIMEOUT_MS). */ + public disconnect(): Promise { const child = this.process; - if (!child) return; + if (!child) return this.exited; this.process = null; child.stdout?.removeAllListeners(); child.stderr?.removeAllListeners(); child.removeAllListeners(); - utils.killProcess(child, this.logger); this.resolveInitialPort?.(undefined); this.resolveInitialPort = undefined; + + this.exited = new Promise((resolve) => { + if (child.exitCode !== null || child.signalCode !== null) { + resolve(); + return; + } + const timer = setTimeout(() => { + this.logger.log('[NativeScript] The ns command did not exit in time, killing it\n'); + child.kill('SIGKILL'); + resolve(); + }, CLI_EXIT_TIMEOUT_MS); + child.once('close', () => { + clearTimeout(timer); + resolve(); + }); + }); + + utils.killProcess(child, this.logger); + return this.exited; } private onPort(port: number): void { diff --git a/src/services/extensionHostServices.ts b/src/services/extensionHostServices.ts index cfbc017..83719e9 100644 --- a/src/services/extensionHostServices.ts +++ b/src/services/extensionHostServices.ts @@ -36,7 +36,7 @@ export class ExtensionHostServices { } public get workspaceConfigService(): WorkspaceConfigService { - return (this._workspaceConfigService ??= new WorkspaceConfigService()); + return (this._workspaceConfigService ??= new WorkspaceConfigService(this.logger)); } public get iOSTeamService(): iOSTeamService { diff --git a/src/services/iOSTeamService.ts b/src/services/iOSTeamService.ts index 7796d5b..0a507bd 100644 --- a/src/services/iOSTeamService.ts +++ b/src/services/iOSTeamService.ts @@ -32,6 +32,7 @@ export class iOSTeamService { }) .then((val: vscode.QuickPickItem | undefined) => { if (!val) { + resolve(); return; } vscode.workspace.getConfiguration().update('nativescript.iosTeamId', val.description); diff --git a/src/tests/androidProject.test.ts b/src/tests/androidProject.test.ts index a55d542..fefa998 100644 --- a/src/tests/androidProject.test.ts +++ b/src/tests/androidProject.test.ts @@ -103,6 +103,24 @@ describe('AndroidProject', () => { expect(ready).toHaveBeenCalledExactlyOnceWith(40000); }); + it('with --debug-brk, ignores a debugger-started message that precedes the debug port', async () => { + const { tnsOutputEventEmitter } = new AndroidProject(APP_ROOT, fake.cli).debug({ + stopOnEntry: true, + watch: false, + launchTests: false, + }); + tnsOutputEventEmitter.on('readyForConnection', ready); + + await writeLine(fake.stdout, '# NativeScript Debugger started #'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS * 2); + expect(ready).not.toHaveBeenCalled(); + + await writeLine(fake.stdout, 'device: emulator-5554 debug port: 40000'); + await writeLine(fake.stdout, '# NativeScript Debugger started #'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + expect(ready).toHaveBeenCalledExactlyOnceWith(40000); + }); + it('emits tsCompilationError on TypeScript failures', async () => { const { tnsOutputEventEmitter } = new AndroidProject(APP_ROOT, fake.cli).attach(); const compilationError = vi.fn(); diff --git a/src/tests/buildService.test.ts b/src/tests/buildService.test.ts index 216332f..cd5dee5 100644 --- a/src/tests/buildService.test.ts +++ b/src/tests/buildService.test.ts @@ -10,7 +10,7 @@ import { AnalyticsService } from '../analytics/analyticsService'; import * as utils from '../common/utilities'; import { NativeScriptCli } from '../project/nativeScriptCli'; import { IDebugResult } from '../project/project'; -import { BuildArgs, BuildService, BuildSession } from '../services/buildService'; +import { BuildArgs, BuildService, BuildSession, CLI_EXIT_TIMEOUT_MS } from '../services/buildService'; import { services } from '../services/extensionHostServices'; import { iOSTeamService } from '../services/iOSTeamService'; @@ -49,7 +49,14 @@ vi.mock('../common/utilities', async (importOriginal) => ({ })); function createFakeProcess() { - return Object.assign(new EventEmitter(), { stdout: new PassThrough(), stderr: new PassThrough(), pid: 4242 }); + return Object.assign(new EventEmitter(), { + stdout: new PassThrough(), + stderr: new PassThrough(), + pid: 4242, + exitCode: null as number | null, + signalCode: null as NodeJS.Signals | null, + kill: vi.fn((_signal?: NodeJS.Signals) => true), + }); } type FakeProcess = ReturnType; @@ -149,31 +156,90 @@ describe('BuildSession', () => { expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('spawn ns ENOENT')); }); - it('disconnect kills the process, resolves initialPort with undefined and is idempotent', async () => { + it('disconnect interrupts the process, resolves initialPort with undefined and detaches listeners', async () => { const { proc, result } = createDebugResult(); const session = new BuildSession(result, logger); const closed = vi.fn(); session.on('closed', closed); - session.disconnect(); - session.disconnect(); + const exited = session.disconnect(); await expect(session.initialPort).resolves.toBeUndefined(); expect(utils.killProcess).toHaveBeenCalledExactlyOnceWith(proc, logger); - expect(proc.listenerCount('close')).toBe(0); expect(proc.stdout.listenerCount('data')).toBe(0); proc.emit('close', 0); + await exited; expect(closed).not.toHaveBeenCalled(); + expect(proc.kill).not.toHaveBeenCalled(); + }); + + it('disconnect resolves only once the process closes', async () => { + vi.useFakeTimers(); + const { proc, result } = createDebugResult(); + const session = new BuildSession(result, logger); + + let resolved = false; + void session.disconnect().then(() => (resolved = true)); + await vi.advanceTimersByTimeAsync(CLI_EXIT_TIMEOUT_MS - 1); + expect(resolved).toBe(false); + + proc.emit('close', 130); + await vi.advanceTimersByTimeAsync(0); + expect(resolved).toBe(true); + + await vi.advanceTimersByTimeAsync(CLI_EXIT_TIMEOUT_MS); + expect(proc.kill).not.toHaveBeenCalled(); + }); + + it('disconnect force-kills a process that ignores SIGINT', async () => { + vi.useFakeTimers(); + const { proc, result } = createDebugResult(); + const session = new BuildSession(result, logger); + + let resolved = false; + void session.disconnect().then(() => (resolved = true)); + await vi.advanceTimersByTimeAsync(CLI_EXIT_TIMEOUT_MS); + + expect(proc.kill).toHaveBeenCalledExactlyOnceWith('SIGKILL'); + expect(resolved).toBe(true); + }); + + it.each([ + ['exitCode', { exitCode: 0 }], + ['signalCode', { signalCode: 'SIGINT' as const }], + ])('disconnect resolves immediately when %s is already set', async (_label, state) => { + vi.useFakeTimers(); + const { proc, result } = createDebugResult(); + Object.assign(proc, state); + const session = new BuildSession(result, logger); + + await session.disconnect(); + + await vi.advanceTimersByTimeAsync(CLI_EXIT_TIMEOUT_MS); + expect(proc.kill).not.toHaveBeenCalled(); + }); + + it('repeated disconnects share one exit promise', async () => { + const { proc, result } = createDebugResult(); + const session = new BuildSession(result, logger); + + const first = session.disconnect(); + const second = session.disconnect(); + + expect(second).toBe(first); + expect(utils.killProcess).toHaveBeenCalledOnce(); + proc.emit('close', 0); + await expect(first).resolves.toBeUndefined(); }); - it('does not kill a process that has already exited', () => { + it('does not kill a process that has already exited', async () => { const { proc, result } = createDebugResult(); const session = new BuildSession(result, logger); proc.emit('close', 0); - session.disconnect(); + await expect(session.disconnect()).resolves.toBeUndefined(); expect(utils.killProcess).not.toHaveBeenCalled(); }); }); diff --git a/src/tests/debugManager.test.ts b/src/tests/debugManager.test.ts index 1721950..c50f0e0 100644 --- a/src/tests/debugManager.test.ts +++ b/src/tests/debugManager.test.ts @@ -24,7 +24,31 @@ vi.mock('../debug-adapter/sourceMaps', () => ({ class FakeBuildSession extends EventEmitter { public resolvePort!: (port: number | undefined) => void; public readonly initialPort = new Promise((resolve) => (this.resolvePort = resolve)); - public readonly disconnect = vi.fn(() => this.resolvePort(undefined)); + public exited: Promise = Promise.resolve(); + public readonly disconnect = vi.fn(() => { + this.resolvePort(undefined); + return this.exited; + }); +} + +type FakeChild = MockDebugSession & { customRequest: Mock<(command: string, args?: unknown) => Promise> }; + +/** Mirrors js-debug: a DAP disconnect ends the child session. */ +function createChild(id: string, config: Record): FakeChild { + const child: FakeChild = { + id, + type: 'pwa-node', + name: String(config.name), + configuration: config, + customRequest: vi.fn(async (command: string) => { + if (command === 'disconnect') testing.fireDidTerminateDebugSession(child); + }), + }; + return child; +} + +function expectDetached(child: FakeChild): void { + expect(child.customRequest).toHaveBeenCalledExactlyOnceWith('disconnect', { terminateDebuggee: false }); } type StartBuild = (args: BuildArgs, isCancelled: () => boolean) => Promise; @@ -67,7 +91,7 @@ describe('DebugManager', () => { let build: FakeBuildSession; let parent: MockDebugSession; let onTerminated: ReturnType void>>; - let children: MockDebugSession[]; + let children: FakeChild[]; const activeSessionCount = () => (manager as unknown as { activeSessions: Map }).activeSessions.size; @@ -80,10 +104,7 @@ describe('DebugManager', () => { const lastChildConfig = () => debug.startDebugging.mock.lastCall![1]; - async function startWithChild( - config: Partial, - port = 40000, - ): Promise { + async function startWithChild(config: Partial, port = 40000): Promise { const started = start(config); build.resolvePort(port); await expect(started).resolves.toBe(true); @@ -101,19 +122,11 @@ describe('DebugManager', () => { children = []; debug.startDebugging.mockImplementation(async (_folder, config) => { - const child: MockDebugSession = { - id: `child-${children.length + 1}`, - type: 'pwa-node', - name: String(config.name), - configuration: config, - }; + const child = createChild(`child-${children.length + 1}`, config); children.push(child); testing.fireDidStartDebugSession(child); return true; }); - debug.stopDebugging.mockImplementation(async (session) => { - if (session) testing.fireDidTerminateDebugSession(session); - }); parent = createParent(); onTerminated = vi.fn<() => void>(); @@ -123,6 +136,8 @@ describe('DebugManager', () => { afterEach(() => { manager.dispose(); vi.useRealTimers(); + // lifecycleManagedByParent routes stopDebugging(child) to the parent, ending the whole session. + expect(debug.stopDebugging).not.toHaveBeenCalled(); }); describe('startup', () => { @@ -172,7 +187,7 @@ describe('DebugManager', () => { await startWithChild({ platform: 'ios', request: 'launch' }, 41000); expect(lastChildConfig().websocketAddress).toBe('ws://localhost:41000'); - manager.stopDebugging(parent.id); + void manager.stopDebugging(parent.id); build = new FakeBuildSession(); parent = createParent('parent-2'); children = []; @@ -266,7 +281,7 @@ describe('DebugManager', () => { const started = start({ platform: 'android', request: 'launch' }); build.resolvePort(40000); await vi.advanceTimersByTimeAsync(0); - manager.stopDebugging(parent.id); + void manager.stopDebugging(parent.id); await vi.advanceTimersByTimeAsync(CHILD_RETRY_DELAY_MS * 3); await expect(started).resolves.toBe(false); @@ -278,7 +293,7 @@ describe('DebugManager', () => { const childStart = deferred(); debug.startDebugging.mockImplementation(async (_folder, config) => { const result = await childStart.promise; - const child: MockDebugSession = { id: 'late-child', type: 'pwa-node', name: 'late', configuration: config }; + const child = createChild('late-child', config); children.push(child); testing.fireDidStartDebugSession(child); return result; @@ -287,11 +302,11 @@ describe('DebugManager', () => { const started = start({ platform: 'android', request: 'launch' }); build.resolvePort(40000); await vi.advanceTimersByTimeAsync(0); - manager.stopDebugging(parent.id); + void manager.stopDebugging(parent.id); childStart.resolve(true); await expect(started).resolves.toBe(false); - expect(debug.stopDebugging).toHaveBeenCalledWith(children[0]); + expectDetached(children[0]); }); it('returns false without starting a child when no port is announced', async () => { @@ -315,7 +330,7 @@ describe('DebugManager', () => { const isCancelled = startBuild.mock.calls[0][1]; expect(isCancelled()).toBe(false); - manager.stopDebugging(parent.id); + void manager.stopDebugging(parent.id); expect(isCancelled()).toBe(true); pending.resolve(null); @@ -329,7 +344,7 @@ describe('DebugManager', () => { startBuild.mockImplementation(() => pending.promise); const started = start({ platform: 'android', request: 'launch' }); - manager.stopDebugging(parent.id); + void manager.stopDebugging(parent.id); pending.resolve(build as unknown as BuildSession); await expect(started).resolves.toBe(false); @@ -342,7 +357,7 @@ describe('DebugManager', () => { const started = start({ platform: 'android', request: 'launch' }); await vi.advanceTimersByTimeAsync(0); - manager.stopDebugging(parent.id); + void manager.stopDebugging(parent.id); expect(build.disconnect).toHaveBeenCalledOnce(); await expect(started).resolves.toBe(false); @@ -367,7 +382,7 @@ describe('DebugManager', () => { build.emit('newPort', 41000); await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); - expect(debug.stopDebugging).toHaveBeenCalledWith(first); + expectDetached(first); expect(debug.startDebugging).toHaveBeenCalledTimes(2); expect(lastChildConfig().websocketAddress).toBe('ws://127.0.0.1:41000'); @@ -378,7 +393,7 @@ describe('DebugManager', () => { it('ignores a late termination event for the replaced child', async () => { const first = await startWithChild({ platform: 'android', request: 'launch', watch: false }); - debug.stopDebugging.mockImplementation(async () => undefined); + first.customRequest.mockImplementation(async () => undefined); build.emit('newPort', 41000); await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); @@ -421,7 +436,9 @@ describe('DebugManager', () => { 'ws://127.0.0.1:41000', 'ws://127.0.0.1:42000', ]); - expect(debug.stopDebugging.mock.calls.map(([session]) => session?.id)).toEqual(['child-1', 'child-2']); + expectDetached(children[0]); + expectDetached(children[1]); + expect(children[2].customRequest).not.toHaveBeenCalled(); expect(onTerminated).not.toHaveBeenCalled(); }); }); @@ -437,7 +454,7 @@ describe('DebugManager', () => { build.emit('newPort', 41000); await vi.advanceTimersByTimeAsync(0); - expect(debug.stopDebugging).not.toHaveBeenCalled(); + expect(first.customRequest).not.toHaveBeenCalled(); expect(children).toHaveLength(2); expect(lastChildConfig().websocketAddress).toBe('ws://127.0.0.1:41000'); @@ -464,6 +481,7 @@ describe('DebugManager', () => { const first = await startWithChild({ platform: 'android', request: 'launch', watch: false }); testing.fireDidTerminateDebugSession(first); + await vi.advanceTimersByTimeAsync(0); expect(onTerminated).toHaveBeenCalledOnce(); expect(build.disconnect).toHaveBeenCalledOnce(); @@ -485,14 +503,30 @@ describe('DebugManager', () => { }); }); + it('reports termination only after the ns process has exited', async () => { + const exit = deferred(); + build.exited = exit.promise; + const first = await startWithChild({ platform: 'android', request: 'launch', watch: false }); + + testing.fireDidTerminateDebugSession(first); + await vi.advanceTimersByTimeAsync(0); + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(onTerminated).not.toHaveBeenCalled(); + + exit.resolve(); + await vi.advanceTimersByTimeAsync(0); + expect(onTerminated).toHaveBeenCalledOnce(); + }); + it('terminates when the ns process closes', async () => { const child = await startWithChild({ platform: 'android', request: 'launch', watch: true }); build.emit('closed', 0); + await vi.advanceTimersByTimeAsync(0); expect(onTerminated).toHaveBeenCalledOnce(); expect(build.disconnect).toHaveBeenCalledOnce(); - expect(debug.stopDebugging).toHaveBeenCalledWith(child); + expectDetached(child); }); it('terminates when the ns process closes before announcing a port', async () => { @@ -500,6 +534,7 @@ describe('DebugManager', () => { await vi.advanceTimersByTimeAsync(0); build.emit('closed', 1); + await vi.advanceTimersByTimeAsync(0); expect(onTerminated).toHaveBeenCalledOnce(); await expect(started).resolves.toBe(false); @@ -512,7 +547,7 @@ describe('DebugManager', () => { testing.fireDidTerminateDebugSession(parent); expect(build.disconnect).toHaveBeenCalledOnce(); - expect(debug.stopDebugging).toHaveBeenCalledWith(child); + expectDetached(child); expect(onTerminated).not.toHaveBeenCalled(); expect(activeSessionCount()).toBe(0); @@ -524,11 +559,57 @@ describe('DebugManager', () => { it('stopDebugging disconnects the build, stops the child and does not call onTerminated', async () => { const child = await startWithChild({ platform: 'android', request: 'launch', watch: true }); - manager.stopDebugging(parent.id); - manager.stopDebugging(parent.id); + await manager.stopDebugging(parent.id); + await manager.stopDebugging(parent.id); + + expect(build.disconnect).toHaveBeenCalledOnce(); + expectDetached(child); + expect(onTerminated).not.toHaveBeenCalled(); + }); + + it('stopDebugging resolves only after the ns process has exited', async () => { + await startWithChild({ platform: 'android', request: 'launch', watch: true }); + const exit = deferred(); + build.exited = exit.promise; + + let stopped = false; + const stopping = manager.stopDebugging(parent.id).then(() => (stopped = true)); + await vi.advanceTimersByTimeAsync(0); + expect(build.disconnect).toHaveBeenCalledOnce(); + expect(stopped).toBe(false); + + exit.resolve(); + await stopping; + expect(stopped).toBe(true); + }); + + it('stopDebugging resolves for an unknown session', async () => { + await expect(manager.stopDebugging('unknown')).resolves.toBeUndefined(); + }); + + it('logs a failed child disconnect and still finishes cleanup', async () => { + const child = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + child.customRequest.mockRejectedValue(new Error('session already gone')); + + await manager.stopDebugging(parent.id); + await vi.advanceTimersByTimeAsync(0); + expectDetached(child); expect(build.disconnect).toHaveBeenCalledOnce(); - expect(debug.stopDebugging).toHaveBeenCalledExactlyOnceWith(child); + expect(activeSessionCount()).toBe(0); + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('session already gone')); + }); + + it('still starts the replacement child when detaching the old one fails', async () => { + const first = await startWithChild({ platform: 'android', request: 'launch', watch: true }); + first.customRequest.mockRejectedValue(new Error('detach failed')); + + build.emit('newPort', 41000); + await vi.advanceTimersByTimeAsync(CHILD_STOP_SETTLE_MS); + + expect(children).toHaveLength(2); + expect(lastChildConfig().websocketAddress).toBe('ws://127.0.0.1:41000'); + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('detach failed')); expect(onTerminated).not.toHaveBeenCalled(); }); diff --git a/src/tests/iOSTeamService.test.ts b/src/tests/iOSTeamService.test.ts new file mode 100644 index 0000000..207b4c6 --- /dev/null +++ b/src/tests/iOSTeamService.test.ts @@ -0,0 +1,67 @@ +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { iOSTeamService } from '../services/iOSTeamService'; +import { testing, window, workspace } from './mocks/vscode'; + +type Team = { id: string; name: string }; + +const TEAMS: Team[] = [ + { id: 'TEAM1', name: 'First Team' }, + { id: 'TEAM2', name: 'Second Team' }, +]; + +describe('iOSTeamService.selectTeam', () => { + let service: iOSTeamService; + let getDevelopmentTeams: ReturnType Team[]>>; + + const configUpdates = () => + workspace.getConfiguration.mock.results.flatMap((result) => result.value.update.mock.calls as unknown[][]); + + beforeEach(() => { + service = new iOSTeamService(); + getDevelopmentTeams = vi.fn(() => TEAMS); + vi.spyOn( + iOSTeamService.prototype as unknown as { getDevelopmentTeams: () => Team[] }, + 'getDevelopmentTeams', + ).mockImplementation(getDevelopmentTeams); + }); + + afterEach(() => { + delete testing.configuration['nativescript.iosTeamId']; + }); + + it('uses the team id from the workspace settings without prompting', async () => { + testing.configuration['nativescript.iosTeamId'] = 'CONFIGURED'; + + await expect(service.selectTeam()).resolves.toEqual({ id: 'CONFIGURED', name: '' }); + expect(window.showQuickPick).not.toHaveBeenCalled(); + expect(getDevelopmentTeams).not.toHaveBeenCalled(); + }); + + it('resolves undefined when the Quick Pick is dismissed', async () => { + window.showQuickPick.mockResolvedValueOnce(undefined); + + await expect(service.selectTeam()).resolves.toBeUndefined(); + expect(window.showQuickPick).toHaveBeenCalledExactlyOnceWith( + [ + { description: 'TEAM1', label: 'First Team' }, + { description: 'TEAM2', label: 'Second Team' }, + ], + { placeHolder: 'Select your development team' }, + ); + expect(configUpdates()).toEqual([]); + }); + + it('returns the picked team and remembers it in the settings', async () => { + window.showQuickPick.mockResolvedValueOnce({ description: 'TEAM2', label: 'Second Team' }); + + await expect(service.selectTeam()).resolves.toEqual({ id: 'TEAM2', name: 'Second Team' }); + expect(configUpdates()).toEqual([['nativescript.iosTeamId', 'TEAM2']]); + }); + + it.each([[[]], [[TEAMS[0]]]])('resolves undefined without prompting for %j', async (teams) => { + getDevelopmentTeams.mockReturnValue(teams); + + await expect(service.selectTeam()).resolves.toBeUndefined(); + expect(window.showQuickPick).not.toHaveBeenCalled(); + }); +}); diff --git a/src/tests/mocks/vscode.ts b/src/tests/mocks/vscode.ts index 78a40a9..dcde0bd 100644 --- a/src/tests/mocks/vscode.ts +++ b/src/tests/mocks/vscode.ts @@ -30,6 +30,7 @@ export interface MockDebugSession { configuration: Record; workspaceFolder?: unknown; parentSession?: MockDebugSession; + customRequest?: (command: string, args?: unknown) => Promise; } const didStart = new EventEmitter(); @@ -57,6 +58,8 @@ export const workspace = { getConfiguration: vi.fn(() => ({ get: (key: string, defaultValue?: T) => key in testing.configuration ? testing.configuration[key] : defaultValue, + // Values in testing.configuration count as user-set (global) values. + inspect: (key: string) => ({ key, globalValue: testing.configuration[key] }), update: vi.fn(async () => undefined), })), }; @@ -64,7 +67,7 @@ export const workspace = { export const window = { showErrorMessage: vi.fn(async (_message: string, ..._items: unknown[]): Promise => undefined), showInformationMessage: vi.fn(async () => undefined), - showQuickPick: vi.fn(async () => undefined), + showQuickPick: vi.fn(async (_items: unknown, _options?: unknown): Promise => undefined), }; export const env = { isTelemetryEnabled: true }; diff --git a/src/tests/nativeScriptDebugAdapter.test.ts b/src/tests/nativeScriptDebugAdapter.test.ts index 47221d8..c234bb2 100644 --- a/src/tests/nativeScriptDebugAdapter.test.ts +++ b/src/tests/nativeScriptDebugAdapter.test.ts @@ -1,74 +1,195 @@ -import { beforeEach, describe, expect, it, vi } from 'vitest'; +import { DebugProtocol } from '@vscode/debugprotocol'; +import { beforeEach, describe, expect, it, vi, type MockInstance } from 'vitest'; +import type * as vscodeTypes from 'vscode'; +import { DebugManager, SessionTerminatedCallback } from '../debug-adapter/debugManager'; import { NativeScriptDebugAdapter } from '../debug-adapter/nativeScriptDebugAdapter'; -import { DebugManager } from '../debug-adapter/debugManager'; + +interface AdapterRequests { + launchRequest(response: DebugProtocol.LaunchResponse, args: Record): void; + attachRequest(response: DebugProtocol.AttachResponse, args: Record): void; + disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments): void; + terminateRequest(response: DebugProtocol.TerminateResponse, args: DebugProtocol.TerminateArguments): void; + threadsRequest(response: DebugProtocol.ThreadsResponse): void; +} + +type StartDebugging = ( + parent: vscodeTypes.DebugSession, + config: vscodeTypes.DebugConfiguration, + onTerminated: SessionTerminatedCallback, +) => Promise; const createMockDebugManager = () => ({ - startDebugging: vi.fn(async () => true), - stopDebugging: vi.fn(), + startDebugging: vi.fn(async () => true), + stopDebugging: vi.fn(async (_parentSessionId: string) => undefined), dispose: vi.fn(), }); -const createMockSession = (id = 'test-session-id') => ({ - id, - type: 'nativescript', - name: 'Test', -}); +const createMockSession = (id = 'test-session-id') => ({ id, type: 'nativescript', name: 'Test' }); + +const createResponse = (command: string) => + ({ body: {}, success: true, command, type: 'response', request_seq: 1, seq: 0 }) as unknown as T; + +function deferred() { + let resolve!: (value: T) => void; + const promise = new Promise((res) => (resolve = res)); + return { promise, resolve }; +} + +const flush = () => new Promise((resolve) => setImmediate(resolve)); describe('NativeScriptDebugAdapter', () => { let adapter: NativeScriptDebugAdapter; + let requests: AdapterRequests; let debugManager: ReturnType; let mockSession: ReturnType; + let sendEvent: MockInstance; + let sendResponse: MockInstance; + + const sentEventNames = () => sendEvent.mock.calls.map(([event]) => event.event); + const terminatedCount = () => sentEventNames().filter((name) => name === 'terminated').length; beforeEach(() => { debugManager = createMockDebugManager(); adapter = new NativeScriptDebugAdapter(debugManager as unknown as DebugManager); + requests = adapter as unknown as AdapterRequests; + sendEvent = vi.spyOn(adapter, 'sendEvent').mockImplementation(() => undefined); + sendResponse = vi.spyOn(adapter, 'sendResponse').mockImplementation(() => undefined); mockSession = createMockSession(); - adapter.setParentSession(mockSession as any); + adapter.setParentSession(mockSession as unknown as vscodeTypes.DebugSession); }); - it('should create adapter with debug manager', () => { - expect(adapter).toBeDefined(); + it('returns empty threads', () => { + const response = createResponse('threads'); + requests.threadsRequest(response); + expect(response.body.threads).toEqual([]); }); - it('should set parent session', () => { - const session = createMockSession('custom-id'); - adapter.setParentSession(session as any); - expect(adapter).toBeDefined(); - }); + describe('launch and attach', () => { + it.each(['launchRequest', 'attachRequest'] as const)( + '%s responds and starts debugging with the parent session', + async (request) => { + const response = createResponse('launch'); + requests[request](response, { platform: 'ios', appRoot: '/test' }); - it('should call debugManager.stopDebugging on disconnect with parent session id', () => { - (adapter as any).disconnectRequest( - { body: {}, success: true, command: 'disconnect', type: 'response', request_seq: 1, seq: 0 }, - {}, + expect(sendResponse).toHaveBeenCalledWith(response); + expect(debugManager.startDebugging).toHaveBeenCalledExactlyOnceWith( + mockSession, + { platform: 'ios', appRoot: '/test' }, + expect.any(Function), + ); + await flush(); + expect(terminatedCount()).toBe(0); + }, ); - expect(debugManager.stopDebugging).toHaveBeenCalledOnce(); - expect(debugManager.stopDebugging).toHaveBeenCalledWith(mockSession.id); - }); - it('should call debugManager.stopDebugging on terminate with parent session id', () => { - (adapter as any).terminateRequest( - { body: {}, success: true, command: 'terminate', type: 'response', request_seq: 1, seq: 0 }, - {}, - ); - expect(debugManager.stopDebugging).toHaveBeenCalledOnce(); - expect(debugManager.stopDebugging).toHaveBeenCalledWith(mockSession.id); - }); + it('terminates when startDebugging returns false', async () => { + debugManager.startDebugging.mockResolvedValue(false); - it('should return empty threads', () => { - const response: any = { body: {}, success: true, command: 'threads', type: 'response', request_seq: 1, seq: 0 }; - (adapter as any).threadsRequest(response); - expect(response.body.threads).toEqual([]); + requests.launchRequest(createResponse('launch'), {}); + await flush(); + + expect(terminatedCount()).toBe(1); + }); + + it('reports a startDebugging error and terminates', async () => { + debugManager.startDebugging.mockRejectedValue(new Error('CLI too old')); + + requests.launchRequest(createResponse('launch'), {}); + await flush(); + + expect(sentEventNames()).toEqual(['output', 'terminated']); + expect(sendEvent.mock.calls[0][0]).toMatchObject({ + body: { category: 'stderr', output: '[NativeScript] Error: CLI too old\n' }, + }); + }); + + it('terminates without a parent session', async () => { + adapter = new NativeScriptDebugAdapter(debugManager as unknown as DebugManager); + requests = adapter as unknown as AdapterRequests; + sendEvent = vi.spyOn(adapter, 'sendEvent').mockImplementation(() => undefined); + vi.spyOn(adapter, 'sendResponse').mockImplementation(() => undefined); + + requests.launchRequest(createResponse('launch'), {}); + await flush(); + + expect(debugManager.startDebugging).not.toHaveBeenCalled(); + expect(sentEventNames()).toEqual(['output', 'terminated']); + }); + + it('sends a single TerminatedEvent when onTerminated fires and startDebugging then returns false', async () => { + debugManager.startDebugging.mockImplementation(async (_parent, _config, onTerminated) => { + onTerminated(); + return false; + }); + + requests.launchRequest(createResponse('launch'), {}); + await flush(); + + expect(terminatedCount()).toBe(1); + }); + + it('does not send a second TerminatedEvent on terminate after the session already ended', async () => { + debugManager.startDebugging.mockImplementation(async (_parent, _config, onTerminated) => { + onTerminated(); + return true; + }); + requests.launchRequest(createResponse('launch'), {}); + await flush(); + + requests.terminateRequest(createResponse('terminate'), {}); + await flush(); + + expect(terminatedCount()).toBe(1); + }); }); - it('should call debugManager.startDebugging on launch', async () => { - const response: any = { body: {}, success: true, command: 'launch', type: 'response', request_seq: 1, seq: 0 }; - await (adapter as any).launchRequest(response, { platform: 'ios', appRoot: '/test' }); - expect(debugManager.startDebugging).toHaveBeenCalledOnce(); + describe('disconnect', () => { + it('stops the parent session and responds only after the stop completes', async () => { + const stop = deferred(); + debugManager.stopDebugging.mockReturnValue(stop.promise); + const response = createResponse('disconnect'); + + requests.disconnectRequest(response, {}); + await flush(); + + expect(debugManager.stopDebugging).toHaveBeenCalledExactlyOnceWith(mockSession.id); + expect(sendResponse).not.toHaveBeenCalled(); + + stop.resolve(undefined); + await flush(); + + expect(sendResponse).toHaveBeenCalledExactlyOnceWith(response); + expect(terminatedCount()).toBe(0); + }); }); - it('should call debugManager.startDebugging on attach', async () => { - const response: any = { body: {}, success: true, command: 'attach', type: 'response', request_seq: 1, seq: 0 }; - await (adapter as any).attachRequest(response, { platform: 'android', appRoot: '/test' }); - expect(debugManager.startDebugging).toHaveBeenCalledOnce(); + describe('terminate', () => { + it('responds and then sends TerminatedEvent only after the stop completes', async () => { + const stop = deferred(); + debugManager.stopDebugging.mockReturnValue(stop.promise); + const order: string[] = []; + sendResponse.mockImplementation(() => order.push('response')); + sendEvent.mockImplementation((event) => order.push(event.event)); + + requests.terminateRequest(createResponse('terminate'), {}); + await flush(); + + expect(debugManager.stopDebugging).toHaveBeenCalledExactlyOnceWith(mockSession.id); + expect(order).toEqual([]); + + stop.resolve(undefined); + await flush(); + + expect(order).toEqual(['response', 'terminated']); + }); + + it('sends TerminatedEvent once across repeated terminate requests', async () => { + requests.terminateRequest(createResponse('terminate'), {}); + requests.terminateRequest(createResponse('terminate'), {}); + await flush(); + + expect(sendResponse).toHaveBeenCalledTimes(2); + expect(terminatedCount()).toBe(1); + }); }); }); diff --git a/src/tests/workspaceConfigService.test.ts b/src/tests/workspaceConfigService.test.ts new file mode 100644 index 0000000..9462343 --- /dev/null +++ b/src/tests/workspaceConfigService.test.ts @@ -0,0 +1,35 @@ +import { afterEach, describe, expect, it, vi } from 'vitest'; +import { LogLevel } from '../common/logger'; +import { WorkspaceConfigService } from '../common/workspaceConfigService'; +import { testing } from './mocks/vscode'; + +describe('WorkspaceConfigService.nsPath', () => { + afterEach(() => { + testing.configuration = {}; + }); + + it('defaults to ns', () => { + expect(new WorkspaceConfigService().nsPath).toBe('ns'); + }); + + it('uses nsPath when set', () => { + testing.configuration = { nsPath: '/opt/ns', tnsPath: '/opt/tns' }; + expect(new WorkspaceConfigService().nsPath).toBe('/opt/ns'); + }); + + it('falls back to the deprecated tnsPath and warns once', () => { + testing.configuration = { tnsPath: '/opt/tns' }; + const logger = { log: vi.fn() }; + const service = new WorkspaceConfigService(logger); + + expect(service.nsPath).toBe('/opt/tns'); + expect(service.nsPath).toBe('/opt/tns'); + expect(logger.log).toHaveBeenCalledOnce(); + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('nativescript.nsPath'), LogLevel.Warn); + }); + + it('ignores an empty tnsPath', () => { + testing.configuration = { tnsPath: '' }; + expect(new WorkspaceConfigService().nsPath).toBe('ns'); + }); +}); From da605d7417338a6b6bda5623b736a53da9e630a9 Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Fri, 6 Nov 2026 15:45:56 -0300 Subject: [PATCH 5/7] chore: gitignore .env --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index ff94dbd..2a5388e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ npm-debug.log nativescript-*.vsix /.vscode/ nativescript.vsix +.env +.env.* From a7ab330e1acb3b9d34e0d441c32a206e933a93da Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Fri, 6 Nov 2026 15:48:03 -0300 Subject: [PATCH 6/7] ci: automate Marketplace releases and pre-releases with release-please - release-please keeps a release PR with the version bump and a CHANGELOG generated from conventional commits since 0.12.5; merging it tags the release and publishes the stable .vsix. - Other pushes to master (and manual runs) publish a Marketplace pre-release numbered ..<1000 + run>, plus a GitHub pre-release. - Publishing uses Marketplace Trusted Publishing (vsce publish --oidc) from the `release` environment and stays off until ENABLE_RELEASE is true. - Drop the hand-written Unreleased CHANGELOG section; document the process in RELEASING.md. - Keep *.local.* and .env files out of the packaged extension. --- .github/workflows/release.yml | 186 ++++++++++++++++++++++++++++++++++ .release-please-manifest.json | 1 + .vscodeignore | 6 ++ CHANGELOG.md | 22 ---- README.md | 2 +- RELEASING.md | 69 +++++++++++++ release-please-config.json | 26 +++++ 7 files changed, 289 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/release.yml create mode 100644 .release-please-manifest.json create mode 100644 RELEASING.md create mode 100644 release-please-config.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..07bd8f5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,186 @@ +name: Release + +# push to master -> release-please updates the release PR; if that push merged the release PR it +# publishes the stable version, otherwise it publishes a pre-release +# workflow_dispatch -> pre-release from the selected ref +# +# Publishing only runs when the repo variable ENABLE_RELEASE is 'true'; until then the workflow +# builds and tests only. See RELEASING.md for the required variables and secrets. + +on: + push: + branches: [master] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release + cancel-in-progress: false + +jobs: + release-please: + name: Release PR + if: ${{ github.event_name == 'push' }} + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + outputs: + release_created: ${{ steps.release.outputs.release_created }} + tag_name: ${{ steps.release.outputs.tag_name }} + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + # PRs opened with GITHUB_TOKEN don't trigger CI; an App token makes the release PR run ci.yml. + - name: Mint App token + id: app-token + if: ${{ vars.APP_CLIENT_ID != '' }} + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 + with: + client-id: ${{ vars.APP_CLIENT_ID }} + private-key: ${{ secrets.APP_PRIVATE_KEY }} + - uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0 + id: release + with: + token: ${{ steps.app-token.outputs.token || secrets.GITHUB_TOKEN }} + config-file: release-please-config.json + manifest-file: .release-please-manifest.json + + build: + name: Build + needs: release-please + if: ${{ !cancelled() && (github.event_name == 'workflow_dispatch' || needs.release-please.result == 'success') }} + runs-on: ubuntu-latest + outputs: + version: ${{ steps.version.outputs.version }} + channel: ${{ steps.version.outputs.channel }} + vsix: ${{ steps.version.outputs.vsix }} + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + # Dependency caching is a cache-poisoning vector in jobs that feed a publish. + package-manager-cache: false + - run: npm ci + - run: npm run lint + - run: npm run typecheck + - run: npm test + - name: Resolve version + id: version + env: + RELEASE_CREATED: ${{ needs.release-please.outputs.release_created }} + RUN_NUMBER: ${{ github.run_number }} + run: | + if [ "$RELEASE_CREATED" = "true" ]; then + channel=stable + version=$(node -p "require('./package.json').version") + else + # The Marketplace only accepts X.Y.Z and serves the highest version, so pre-releases use + # patch numbers >= 1000 that stable releases (chosen by release-please) never reach. + channel=prerelease + version=$(node -p "const [major, minor] = require('./package.json').version.split('.'); major + '.' + minor + '.' + (1000 + Number(process.env.RUN_NUMBER))") + npm version "$version" --no-git-tag-version --allow-same-version + fi + { + echo "version=$version" + echo "channel=$channel" + echo "vsix=nativescript-$version.vsix" + } >> "$GITHUB_OUTPUT" + - name: Package + env: + GA_MEASUREMENT_ID: ${{ vars.GA_MEASUREMENT_ID }} + GA_API_SECRET: ${{ secrets.GA_API_SECRET }} + CHANNEL: ${{ steps.version.outputs.channel }} + VSIX: ${{ steps.version.outputs.vsix }} + run: | + if [ "$CHANNEL" = "prerelease" ]; then + npx vsce package --pre-release --out "$VSIX" + else + npx vsce package --out "$VSIX" + fi + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: vsix + path: ${{ steps.version.outputs.vsix }} + if-no-files-found: error + + publish-marketplace: + name: Publish to VS Code Marketplace + needs: build + if: ${{ vars.ENABLE_RELEASE == 'true' }} + runs-on: ubuntu-latest + environment: release + permissions: + contents: read + id-token: write + env: + CHANNEL: ${{ needs.build.outputs.channel }} + VSIX: ${{ needs.build.outputs.vsix }} + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + package-manager-cache: false + - run: npm ci + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: vsix + # Marketplace Trusted Publishing: the publisher's policy must name this repo, release.yml and the + # 'release' environment. + - name: Publish + run: | + if [ "$CHANNEL" = "prerelease" ]; then + npx vsce publish --oidc --skip-duplicate --pre-release --packagePath "$VSIX" + else + npx vsce publish --oidc --skip-duplicate --packagePath "$VSIX" + fi + + github-release: + name: GitHub release + needs: [release-please, build, publish-marketplace] + # !cancelled() lets this run when release-please was skipped (manual pre-release runs). + if: ${{ !cancelled() && vars.ENABLE_RELEASE == 'true' && needs.build.result == 'success' && needs.publish-marketplace.result == 'success' }} + runs-on: ubuntu-latest + permissions: + contents: write + env: + GH_TOKEN: ${{ github.token }} + CHANNEL: ${{ needs.build.outputs.channel }} + VERSION: ${{ needs.build.outputs.version }} + VSIX: ${{ needs.build.outputs.vsix }} + STABLE_TAG: ${{ needs.release-please.outputs.tag_name }} + steps: + - name: Harden the runner (Audit all outbound calls) + uses: step-security/harden-runner@1d88384fd173af6ecb012dfd0264a306b711241a # v2.22.4 + with: + egress-policy: audit + - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 + with: + name: vsix + - name: Attach the .vsix + run: | + if [ "$CHANNEL" = "stable" ]; then + # release-please already created the release and its notes. + gh release upload "$STABLE_TAG" "$VSIX" --clobber --repo "$GITHUB_REPOSITORY" + else + gh release create "v$VERSION" "$VSIX" --prerelease --generate-notes \ + --target "$GITHUB_SHA" --title "v$VERSION" --repo "$GITHUB_REPOSITORY" + fi diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..c4878b7 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1 @@ +{ ".": "0.12.5" } diff --git a/.vscodeignore b/.vscodeignore index 78746ca..f0036a8 100644 --- a/.vscodeignore +++ b/.vscodeignore @@ -15,3 +15,9 @@ eslint.config.mjs vitest.config.mts CONTRIBUTING.md npm-debug.log +RELEASING.md +release-please-config.json +.release-please-manifest.json +*.local.* +.env +.env.* diff --git a/CHANGELOG.md b/CHANGELOG.md index 31d924a..c86dc30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,3 @@ -Unreleased -==== -## What's new - - The debugger now runs on VS Code's built-in JavaScript debugger (js-debug) instead of vscode-chrome-debug-core, and reattaches automatically when the app restarts after a file change. - - Source maps load from inline `data:` URLs, from the device through the runtime's `nsruntime://` scheme, or from the local `platforms/` copy for runtimes that report `file://` device paths. - - Vite projects are supported (debug sessions run with `--no-hmr`). - - New launch attributes: `address`, `resolveSourceMapLocations`, `skipFiles`, `smartStep`, `trace`. - - Analytics use the GA4 Measurement Protocol and respect VS Code's telemetry setting. - -## Deprecations - - `nativescript.tnsPath` is deprecated in favor of `nativescript.nsPath` (default `ns`); it is still honored when `nsPath` is not set. - -## Breaking changes - - Requires VS Code 1.109+ and NativeScript CLI 8.0+. - - Removed the unused `tnsOutput` and `noDebug` launch attributes; `diagnosticLogging` is deprecated in favor of `trace`. - -## Bug Fixes - - Missing or outdated CLI no longer breaks activation; the error is shown and the debugger reports it on launch. - - Stopping a session while it builds (or while the iOS team picker is open) no longer leaves the `ns` process running. - - The Run command no longer kills an active debug session's `ns` process. - - Restart from the debug toolbar now relaunches the session. - 0.11.0 ==== ## What's new diff --git a/README.md b/README.md index acc8327..e52c55f 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ npm test # Vitest unit tests Open the repository in VS Code and press F5 (`Run Extension`) to start an Extension Development Host with the extension loaded. Open a NativeScript app there and start one of its NativeScript launch configurations. After changing the extension's code, restart the Extension Development Host. -Release builds send analytics only when `GA_MEASUREMENT_ID` and `GA_API_SECRET` are set in the environment while packaging (`vscode:prepublish` writes them to `out/ga-config.json`). Never commit the API secret. +Releases are automated; see [RELEASING.md](RELEASING.md). Release builds send analytics only when `GA_MEASUREMENT_ID` and `GA_API_SECRET` are set in the environment while packaging (`vscode:prepublish` writes them to `out/ga-config.json`). Never commit the API secret. ### How to disable the analytics diff --git a/RELEASING.md b/RELEASING.md new file mode 100644 index 0000000..62dc724 --- /dev/null +++ b/RELEASING.md @@ -0,0 +1,69 @@ +# Releasing + +Releases are automated by [`.github/workflows/release.yml`](.github/workflows/release.yml). + +## How it works + +- **Stable releases**: [release-please](https://github.com/googleapis/release-please) keeps a release PR open on + `master`. It bumps `package.json` and writes `CHANGELOG.md` from the [conventional commits](https://www.conventionalcommits.org/) + merged since the last release. Merging that PR tags `vX.Y.Z`, creates the GitHub release, and publishes the + extension to the VS Code Marketplace. +- **Pre-releases**: every other push to `master` publishes a pre-release to the Marketplace, plus a GitHub + pre-release with the `.vsix` attached. Running the workflow manually (Actions → Release → Run workflow) publishes a + pre-release from the selected branch. +- **Pre-release versions** are `..<1000 + run number>`, e.g. `0.13.1042`. The + Marketplace only accepts `X.Y.Z` and always serves the highest version, so pre-release patch numbers stay out of + the range release-please uses for stable releases. + +### Controlling the next version + +- `fix:` bumps the patch, `feat:` the minor. While the version is `0.x`, breaking changes (`feat!:` or a + `BREAKING CHANGE:` footer) also bump the minor instead of jumping to `1.0.0`. +- To pick a version explicitly, merge a commit with a `Release-As: 1.0.0` footer. +- For squash-merged PRs, the changelog uses the PR title. To write several entries for one PR, add them to the PR + description before merging: + + ``` + BEGIN_COMMIT_OVERRIDE + feat: first entry + fix: second entry + END_COMMIT_OVERRIDE + ``` + +## Repository configuration + +Nothing is published until `ENABLE_RELEASE` is `true`; before that the workflow only builds and tests. + +| Kind | Name | Purpose | +| ------------------------------- | ------------------ | -------------------------------------------------------------------------------------------------------------- | +| Variable | `ENABLE_RELEASE` | `true` turns publishing on. | +| Variable / secret | `APP_CLIENT_ID` / `APP_PRIVATE_KEY` | Optional GitHub App used for the release PR, so CI runs on it (PRs opened by `GITHUB_TOKEN` don't trigger workflows). | +| Variable / secret | `GA_MEASUREMENT_ID` / `GA_API_SECRET` | Optional; analytics are only compiled into the package when both are set. | +| Environment | `release` | Used by the publish job; restrict it to `master` and add reviewers if publishes should need approval. | + +The VS Code Marketplace uses [Trusted Publishing](https://code.visualstudio.com/api/working-with-extensions/publishing-extension) +(`vsce publish --oidc`), so it needs no secret. The publisher has to trust this workflow (see below). + +## One-time setup + +### VS Code Marketplace (publisher `NativeScript`) + +1. Sign in at with an account that manages the `NativeScript` + publisher. +2. Open the `NativeScript` publisher → **Trusted Publishing** → **Create**, and fill in: + - **Policy name**: `nativescript-vscode-extension release` + - **Repository owner**: `nativescript-community` + - **Repository**: `nativescript-vscode-extension` + - **Workflow**: `release.yml` + - **Environment**: `release` +3. Select **Create**. + +### GitHub + +1. **Settings → Environments → New environment** `release`. Optionally limit deployment branches to `master` and + add required reviewers. +2. If the organization blocks Actions from creating pull requests (**Settings → Actions → General → Workflow + permissions → Allow GitHub Actions to create and approve pull requests**), either allow it or configure the + `APP_CLIENT_ID` / `APP_PRIVATE_KEY` GitHub App (contents and pull requests: read and write on this repository). +3. **Settings → Secrets and variables → Actions → Variables**: add `ENABLE_RELEASE` = `true` once the Marketplace + policy exists. diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..b552664 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,26 @@ +{ + "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", + "bootstrap-sha": "170417c72b303215f6975ca049012db98797eb17", + "include-component-in-tag": false, + "packages": { + ".": { + "release-type": "node", + "package-name": "nativescript", + "changelog-path": "CHANGELOG.md", + "bump-minor-pre-major": true, + "changelog-sections": [ + { "type": "feat", "section": "Features" }, + { "type": "fix", "section": "Bug Fixes" }, + { "type": "perf", "section": "Performance Improvements" }, + { "type": "revert", "section": "Reverts" }, + { "type": "deps", "section": "Dependencies" }, + { "type": "refactor", "section": "Code Refactoring", "hidden": true }, + { "type": "docs", "section": "Documentation", "hidden": true }, + { "type": "test", "section": "Tests", "hidden": true }, + { "type": "build", "section": "Build System", "hidden": true }, + { "type": "ci", "section": "Continuous Integration", "hidden": true }, + { "type": "chore", "section": "Miscellaneous Chores", "hidden": true } + ] + } + } +} From 8f2eac854b74715e1a4bed25e357ee14366a4d3d Mon Sep 17 00:00:00 2001 From: Eduardo Speroni Date: Sun, 8 Nov 2026 20:58:17 -0300 Subject: [PATCH 7/7] feat: custom launch commands and project-local CLI - New launch attributes runtimeExecutable, runtimeArgs, cwd and env (js-debug naming). With runtimeExecutable set the command runs exactly as given, e.g. `npx nx debug my-app --platform=ios`; the extension adds no flags and only watches its output for the debug port. cwd and env also apply to plain ns. - Without nativescript.nsPath, use node_modules/.bin/ns from the app or any parent folder before falling back to the global ns. - Start commands in their own process group and signal the whole group, so Stop/Restart reach wrapped CLIs (npx -> nx -> ns -> bundler). - Quote arguments for the shell, including zsh's leading `=`. - Move the shared debug/attach command building into Project. --- README.md | 22 +- package.json | 77 ++++++- src/common/utilities.ts | 94 +++++++-- src/common/workspaceConfigService.ts | 18 +- src/debug-adapter/debugManager.ts | 9 + src/project/androidProject.ts | 65 ++---- src/project/iosProject.ts | 71 ++----- src/project/nativeScriptCli.ts | 24 +-- src/project/project.ts | 64 ++++-- src/project/projectInfo.ts | 18 ++ src/services/buildService.ts | 58 +++++- src/services/extensionHostServices.ts | 20 +- src/tests/androidProject.test.ts | 48 ++++- src/tests/buildService.test.ts | 124 ++++++++++-- src/tests/debugManager.test.ts | 32 ++- src/tests/extensionHostServices.test.ts | 78 ++++++++ src/tests/iosProject.test.ts | 28 ++- src/tests/mocks/vscode.ts | 2 +- src/tests/projectInfo.test.ts | 43 +++- src/tests/utilities.test.ts | 244 +++++++++++++++++++++++ src/tests/workspaceConfigService.test.ts | 35 ++++ 21 files changed, 989 insertions(+), 185 deletions(-) create mode 100644 src/tests/extensionHostServices.test.ts create mode 100644 src/tests/utilities.test.ts diff --git a/README.md b/README.md index e52c55f..d89282d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ The NativeScript extension for Visual Studio Code aids your [NativeScript](https To install [NativeScript](https://www.nativescript.org/) and all its dependencies, follow the instructions in our [getting started guide](https://docs.nativescript.org/setup/). -> Note: The VS Code extension requires [nativescript node module](https://www.npmjs.com/package/nativescript) to be globally installed. If you are using [nvm](https://github.com/nvm-sh/nvm) to manage your node versions, make sure that `nativescript` is installed in your default Node.js version (`nvm ls` shows it as `default`). If the CLI lives somewhere else, set the `nativescript.nsPath` setting to its path. +> Note: The VS Code extension uses the [NativeScript CLI](https://www.npmjs.com/package/nativescript) installed in your project (`node_modules/.bin/ns`, also looked up in parent folders, e.g. a monorepo root) and falls back to a global installation. If you are using [nvm](https://github.com/nvm-sh/nvm) with a global CLI, make sure that `nativescript` is installed in your default Node.js version (`nvm ls` shows it as `default`). To use a CLI somewhere else, set the `nativescript.nsPath` setting to its path. ### Setup the extension @@ -33,6 +33,26 @@ Besides the NativeScript-specific attributes (`platform`, `appRoot`, `watch`, `t Source maps work whether they are inlined in the bundle or written as separate `.map` files: newer NativeScript runtimes serve map files from the device (`nsruntime://` URLs), and for older runtimes the extension falls back to the copy of the build under `platforms/`. +#### Custom commands (Nx and other wrappers) + +If your project is started through another tool, set `runtimeExecutable` and `runtimeArgs`. The command runs exactly as written, in `cwd` (defaults to `appRoot`) with any extra `env` variables, and the debugger attaches when its output shows the CLI's debug port. The extension adds no flags of its own in this mode (`watch`, `stopOnEntry`, `tnsArgs`, Vite's `--no-hmr`, the iOS team), so put everything the command needs in `runtimeArgs`. For example, with [Nx](https://github.com/NativeScript/nx): + +```json +{ + "name": "Launch on iOS (Nx)", + "type": "nativescript", + "request": "launch", + "platform": "ios", + "appRoot": "${workspaceFolder}/apps/my-app", + "cwd": "${workspaceFolder}", + "runtimeExecutable": "npx", + "runtimeArgs": ["nx", "debug", "my-app", "--platform=ios"], + "watch": true +} +``` + +`watch` still matters here: it tells the extension to wait for the app to come back after a restart instead of ending the session. + #### Vite projects Projects using the Vite bundler (`bundler: 'vite'` in `nativescript.config.ts`) are debugged with `--no-hmr`, because hot module replacement serves app code without source maps. File changes still rebuild and restart the app, and the debugger reattaches. Pass `--hmr` in `tnsArgs` to keep HMR on (breakpoints in app code won't bind). Debugging unit tests that use the Vitest runner is not supported yet. diff --git a/package.json b/package.json index 994060d..53fa58c 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,7 @@ }, "nativescript.nsPath": { "type": "string", - "default": "ns", - "description": "Path to the NativeScript CLI executable. Relative paths are resolved against the app root." + "description": "Path to the NativeScript CLI executable. Relative paths are resolved against the app root. When not set, a CLI installed in the project (node_modules/.bin/ns, also searched in parent folders) is used, falling back to the global 'ns'." }, "nativescript.tnsPath": { "type": "string", @@ -249,6 +248,26 @@ "sourceMaps": true, "watch": false } + }, + { + "label": "NativeScript: Launch with a custom command (e.g. Nx)", + "description": "Runs your own command (for example an Nx debug target) and attaches the debugger to it", + "body": { + "name": "Launch on iOS (Nx)", + "type": "nativescript", + "request": "launch", + "platform": "ios", + "appRoot": "^\"\\${workspaceFolder}/apps/${1:my-app}\"", + "cwd": "^\"\\${workspaceFolder}\"", + "runtimeExecutable": "npx", + "runtimeArgs": [ + "nx", + "debug", + "${1:my-app}", + "--platform=ios" + ], + "watch": true + } } ], "configurationAttributes": { @@ -278,6 +297,33 @@ }, "default": [] }, + "runtimeExecutable": { + "type": "string", + "description": "Command to run instead of the NativeScript CLI, e.g. 'npx'. When set, the command runs exactly as given by runtimeExecutable and runtimeArgs: the extension adds no flags (watch, stopOnEntry, tnsArgs, ...), so pass them in runtimeArgs. The command's output must include the CLI's debug port lines." + }, + "runtimeArgs": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for runtimeExecutable. Each entry is passed as a single argument.", + "default": [] + }, + "cwd": { + "type": "string", + "description": "Working directory for the command. Relative paths resolve against the workspace folder. Defaults to appRoot." + }, + "env": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "null" + ] + }, + "description": "Environment variables for the command. A null value removes the variable.", + "default": {} + }, "watch": { "type": "boolean", "description": "Rebuild and reattach the debugger when files change.", @@ -373,6 +419,33 @@ }, "default": [] }, + "runtimeExecutable": { + "type": "string", + "description": "Command to run instead of the NativeScript CLI, e.g. 'npx'. When set, the command runs exactly as given by runtimeExecutable and runtimeArgs: the extension adds no flags (watch, stopOnEntry, tnsArgs, ...), so pass them in runtimeArgs. The command's output must include the CLI's debug port lines." + }, + "runtimeArgs": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Arguments for runtimeExecutable. Each entry is passed as a single argument.", + "default": [] + }, + "cwd": { + "type": "string", + "description": "Working directory for the command. Relative paths resolve against the workspace folder. Defaults to appRoot." + }, + "env": { + "type": "object", + "additionalProperties": { + "type": [ + "string", + "null" + ] + }, + "description": "Environment variables for the command. A null value removes the variable.", + "default": {} + }, "watch": { "type": "boolean", "description": "Rebuild and reattach the debugger when files change.", diff --git a/src/common/utilities.ts b/src/common/utilities.ts index 22d101f..e145454 100644 --- a/src/common/utilities.ts +++ b/src/common/utilities.ts @@ -1,24 +1,13 @@ -import { ChildProcess, execSync } from 'child_process'; +import { ChildProcess, execSync, spawn } from 'child_process'; import * as os from 'os'; import { ILogger, LogLevel } from '../common/logger'; -export function killProcess(childProcess: ChildProcess, logger?: ILogger): void { - logger?.log(`Stopping process: ${childProcess.pid}`); +/** Launch-config style environment overrides: a `null` value removes the variable. */ +export type EnvOverrides = Record; - try { - switch (process.platform) { - case 'win32': - execSync(`taskkill /pid ${childProcess.pid!} /T /F`); - break; - - default: - // ctrl + c - execSync(`kill -2 ${childProcess.pid!.toString()}`); - break; - } - } catch (error) { - logger?.log(String(error), LogLevel.Error); - } +export interface ShellSpawnOptions { + cwd: string; + env?: EnvOverrides; } export const enum Platform { @@ -32,3 +21,74 @@ export function getPlatform(): Platform { return platform === 'darwin' ? Platform.OSX : platform === 'win32' ? Platform.Windows : Platform.Linux; } + +/** + * Commands run through the user's login shell so PATH managers (nvm, asdf, ...) apply even when VS Code was + * started from the Dock. cmd.exe avoids https://github.com/NativeScript/nativescript-vscode-extension/issues/121 + */ +export function getShell(): string | undefined { + return getPlatform() === Platform.Windows ? 'cmd.exe' : process.env.SHELL; +} + +export function resolveEnv(overrides?: EnvOverrides): NodeJS.ProcessEnv { + const env: NodeJS.ProcessEnv = { ...process.env }; + for (const [key, value] of Object.entries(overrides ?? {})) { + if (value === null) { + delete env[key]; + } else if (value !== undefined) { + env[key] = value; + } + } + return env; +} + +/** Quotes one argument for the shell returned by getShell(), so it reaches the program as a single argument. */ +export function quoteShellArg(arg: string, platform: NodeJS.Platform = process.platform): string { + if (platform === 'win32') { + return /^[\w\-+=:,./\\@]+$/.test(arg) ? arg : `"${arg.replace(/"/g, '""')}"`; + } + // A leading `=` is expanded to a command path by zsh (EQUALS option), so it must be quoted. + return /^[\w\-+:,./@%][\w\-+=:,./@%]*$/.test(arg) ? arg : `'${arg.replace(/'/g, `'\\''`)}'`; +} + +/** + * Runs a command line through the shell. On POSIX the child leads its own process group so killProcess can signal + * the whole tree (e.g. `npx` → `nx` → `ns` → bundler), like Ctrl+C in a terminal. + */ +export function spawnInShell(commandLine: string, options: ShellSpawnOptions): ChildProcess { + const child = spawn(commandLine, { + cwd: options.cwd, + env: resolveEnv(options.env), + shell: getShell() ?? true, + detached: process.platform !== 'win32', + windowsHide: true, + }); + + child.stdout?.setEncoding('utf8'); + child.stderr?.setEncoding('utf8'); + + return child; +} + +export function killProcess(childProcess: ChildProcess, logger?: ILogger, signal: NodeJS.Signals = 'SIGINT'): void { + const pid = childProcess.pid; + if (pid === undefined) return; + + logger?.log(`Stopping process: ${pid}`); + + try { + if (process.platform === 'win32') { + execSync(`taskkill /pid ${pid} /T /F`); + return; + } + + try { + process.kill(-pid, signal); + } catch { + // Not a process group leader (spawned without spawnInShell). + childProcess.kill(signal); + } + } catch (error) { + logger?.log(String(error), LogLevel.Error); + } +} diff --git a/src/common/workspaceConfigService.ts b/src/common/workspaceConfigService.ts index cb8beae..c88d3f0 100644 --- a/src/common/workspaceConfigService.ts +++ b/src/common/workspaceConfigService.ts @@ -25,11 +25,23 @@ export class WorkspaceConfigService { .update('analytics.enabled', enabled, vscode.ConfigurationTarget.Global); } - /** `nativescript.nsPath`, falling back to the deprecated `nativescript.tnsPath` when only that one is set. */ + /** `nativescript.nsPath`, falling back to the deprecated `nativescript.tnsPath`, then to `ns`. */ public get nsPath(): string { + return this.configuredNsPath ?? 'ns'; + } + + /** + * The CLI path the user set (`nativescript.nsPath`, or the deprecated `nativescript.tnsPath` when only that one is + * set), or undefined when neither is set and the CLI should be discovered. + */ + public get configuredNsPath(): string | undefined { const config = vscode.workspace.getConfiguration('nativescript'); - if (!isExplicitlySet(config, 'nsPath') && isExplicitlySet(config, 'tnsPath')) { + if (isExplicitlySet(config, 'nsPath')) { + return config.get('nsPath') || undefined; + } + + if (isExplicitlySet(config, 'tnsPath')) { const tnsPath = config.get('tnsPath'); if (tnsPath) { if (!this.warnedAboutTnsPath) { @@ -43,6 +55,6 @@ export class WorkspaceConfigService { } } - return config.get('nsPath', 'ns'); + return undefined; } } diff --git a/src/debug-adapter/debugManager.ts b/src/debug-adapter/debugManager.ts index 66161e6..4409f02 100644 --- a/src/debug-adapter/debugManager.ts +++ b/src/debug-adapter/debugManager.ts @@ -15,6 +15,10 @@ export interface NativeScriptDebugConfiguration extends vscode.DebugConfiguratio stopOnEntry?: boolean; launchTests?: boolean; tnsArgs?: string[]; + runtimeExecutable?: string; + runtimeArgs?: string[]; + cwd?: string; + env?: Record; address?: string; sourceMaps?: boolean; sourceMapPathOverrides?: Record; @@ -105,6 +109,11 @@ export class DebugManager implements vscode.Disposable { stopOnEntry: config.stopOnEntry, launchTests: config.launchTests, tnsArgs: config.tnsArgs, + runtimeExecutable: config.runtimeExecutable, + runtimeArgs: config.runtimeArgs, + cwd: config.cwd, + env: config.env, + workspaceRoot: folder?.uri.fsPath, }, () => active.stopping, ); diff --git a/src/project/androidProject.ts b/src/project/androidProject.ts index 2a36780..1eab4fc 100644 --- a/src/project/androidProject.ts +++ b/src/project/androidProject.ts @@ -1,77 +1,42 @@ -import { ChildProcess } from 'child_process'; import { EventEmitter } from 'events'; import * as stream from 'stream'; -import { IDebugResult, Project } from './project'; +import { Project } from './project'; import * as scanner from './streamScanner'; +/** Delay before announcing a port, so adb can connect to the debug socket first. */ +const ADB_CONNECT_DELAY_MS = 1000; + export class AndroidProject extends Project { public platformName(): string { return 'android'; } - public attach(tnsArgs?: string[]): IDebugResult { - let args: string[] = ['--start']; - - args = args.concat(tnsArgs ?? []); - - const debugProcess: ChildProcess = super.executeDebugCommand(args); - const tnsOutputEventEmitter = new EventEmitter(); - - this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter, false); - - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } - - public debug( - options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, - tnsArgs?: string[], - ): IDebugResult { - let args: string[] = []; - - args.push(options.watch ? '--watch' : '--no-watch'); - if (options.stopOnEntry) { - args.push('--debug-brk'); - } - args = args.concat(tnsArgs ?? []); - - const debugProcess: ChildProcess = options.launchTests - ? super.executeTestCommand(args) - : super.executeDebugCommand(args); - const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); - const waitForRestartMessage = args.includes('--debug-brk'); - - this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter, waitForRestartMessage); - - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } - protected override configureReadyEvent( readableStream: stream.Readable, eventEmitter: EventEmitter, - waitForRestartMessage?: boolean, + args: readonly string[], ): void { - super.configureReadyEvent(readableStream, eventEmitter); + super.configureReadyEvent(readableStream, eventEmitter, args); + + // With --debug-brk the app only starts once the debugger banner is printed. `includes` also matches the flag + // inside a wrapper option such as Nx's `--flags="--debug-brk"`. + const waitForDebuggerStarted = args.some((arg) => arg.includes('--debug-brk')); let debugPort: number | null = null; new scanner.StringMatchingScanner(readableStream).onEveryMatch( new RegExp('device: .* debug port: [0-9]+'), (match: scanner.IMatchFound) => { - // device: {device-name} debug port: {debug-port} debugPort = parseInt((match.matches[0] as string).match(/debug port: (\d+)/)![1], 10); - if (!waitForRestartMessage) { - setTimeout(() => { - eventEmitter.emit('readyForConnection', debugPort); - }, 1000); + if (!waitForDebuggerStarted) { + setTimeout(() => eventEmitter.emit('readyForConnection', debugPort), ADB_CONNECT_DELAY_MS); } }, ); - if (waitForRestartMessage) { + + if (waitForDebuggerStarted) { new scanner.StringMatchingScanner(readableStream).onEveryMatch('# NativeScript Debugger started #', () => { if (debugPort === null) return; - // wait a little before trying to connect, this gives a chance for adb to be able to connect to the debug socket - setTimeout(() => { - eventEmitter.emit('readyForConnection', debugPort); - }, 1000); + setTimeout(() => eventEmitter.emit('readyForConnection', debugPort), ADB_CONNECT_DELAY_MS); }); } } diff --git a/src/project/iosProject.ts b/src/project/iosProject.ts index c6553fc..cbad24f 100644 --- a/src/project/iosProject.ts +++ b/src/project/iosProject.ts @@ -1,13 +1,15 @@ -import { ChildProcess } from 'child_process'; import { EventEmitter } from 'events'; import * as stream from 'stream'; import { NativeScriptCli } from './nativeScriptCli'; -import { IDebugResult, Project } from './project'; +import { Project, ProjectOptions } from './project'; import * as scanner from './streamScanner'; +/** Delay before announcing a port, so the CLI's socket proxy is accepting connections. */ +const PROXY_READY_DELAY_MS = 1000; + export class IosProject extends Project { - constructor(appRoot: string, cli: NativeScriptCli) { - super(appRoot, cli); + constructor(appRoot: string, cli: NativeScriptCli, options?: ProjectOptions) { + super(appRoot, cli, options); if (!this.isPlatformOSX()) { throw new Error('iOS platform is supported only on OS X.'); @@ -18,53 +20,20 @@ export class IosProject extends Project { return 'ios'; } - public attach(tnsArgs?: string[]): IDebugResult { - let args: string[] = ['--start']; - - args = args.concat(tnsArgs ?? []); - - const debugProcess: ChildProcess = super.executeDebugCommand(args); - const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); - - this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter); - - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } - - public debug( - options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, - tnsArgs?: string[], - ): IDebugResult { - let args: string[] = []; - - args.push(options.watch ? '--watch' : '--no-watch'); - if (options.stopOnEntry) { - args.push('--debug-brk'); - } - args = args.concat(tnsArgs ?? []); - const debugProcess: ChildProcess = options.launchTests - ? super.executeTestCommand(args) - : super.executeDebugCommand(args); - - const tnsOutputEventEmitter: EventEmitter = new EventEmitter(); - - this.configureReadyEvent(debugProcess.stdout!, tnsOutputEventEmitter); - - return { tnsProcess: debugProcess, tnsOutputEventEmitter }; - } - - protected override configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { - super.configureReadyEvent(readableStream, eventEmitter); - - const streamScanner = new scanner.StringMatchingScanner(readableStream); - - streamScanner.onEveryMatch(new RegExp('Opened localhost (.*)'), (match: scanner.IMatchFound) => { - const port = parseInt(match.matches[1] as string, 10); - - setTimeout(() => { - eventEmitter.emit('readyForConnection', port); - }, 1000); - }); + protected override configureReadyEvent( + readableStream: stream.Readable, + eventEmitter: EventEmitter, + args: readonly string[], + ): void { + super.configureReadyEvent(readableStream, eventEmitter, args); + + new scanner.StringMatchingScanner(readableStream).onEveryMatch( + new RegExp('Opened localhost (.*)'), + (match: scanner.IMatchFound) => { + const port = parseInt(match.matches[1] as string, 10); + setTimeout(() => eventEmitter.emit('readyForConnection', port), PROXY_READY_DELAY_MS); + }, + ); } private isPlatformOSX(): boolean { diff --git a/src/project/nativeScriptCli.ts b/src/project/nativeScriptCli.ts index 1dfa285..ce9df8e 100644 --- a/src/project/nativeScriptCli.ts +++ b/src/project/nativeScriptCli.ts @@ -1,4 +1,4 @@ -import { ChildProcess, exec, spawn } from 'child_process'; +import { ChildProcess, exec } from 'child_process'; import * as semver from 'semver'; import { ILogger } from '../common/logger'; import * as utils from '../common/utilities'; @@ -16,8 +16,7 @@ export class NativeScriptCli { this._path = cliPath; this._logger = logger; - // cmd.exe avoids https://github.com/NativeScript/nativescript-vscode-extension/issues/121 - this._shellPath = utils.getPlatform() === utils.Platform.Windows ? 'cmd.exe' : process.env.SHELL; + this._shellPath = utils.getShell(); } public get path(): string { @@ -34,7 +33,7 @@ export class NativeScriptCli { this._logger.log(String(error)); reject( new Error( - `NativeScript CLI not found at '${this._path}'. Use the 'nativescript.nsPath' setting to set the absolute path to the NativeScript CLI.`, + `NativeScript CLI not found at '${this._path}'. Install it in the project ('npm install -D nativescript') or globally ('npm install -g nativescript'), or set 'nativescript.nsPath' to its path.`, ), ); return; @@ -64,15 +63,14 @@ export class NativeScriptCli { return version; } - public execute(args: string[], cwd: string): ChildProcess { - const fullArgs = [...ANALYTICS_CLIENT_ARGS, ...args]; - this._logger.log(`[NativeScriptCli] execute: ${[this._path, ...fullArgs].join(' ')}`); + /** + * Arguments are joined unquoted, so nsPath values like `npx ns` and tnsArgs written with shell quoting keep + * working. + */ + public execute(args: string[], options: utils.ShellSpawnOptions): ChildProcess { + const commandLine = [this._path, ...ANALYTICS_CLIENT_ARGS, ...args].join(' '); + this._logger.log(`[NativeScriptCli] execute: ${commandLine}`); - const child = spawn(this._path, fullArgs, { cwd, shell: this._shellPath }); - - child.stdout.setEncoding('utf8'); - child.stderr.setEncoding('utf8'); - - return child; + return utils.spawnInShell(commandLine, options); } } diff --git a/src/project/project.ts b/src/project/project.ts index d2aed19..8d2b96f 100644 --- a/src/project/project.ts +++ b/src/project/project.ts @@ -1,6 +1,7 @@ import { ChildProcess } from 'child_process'; import { EventEmitter } from 'events'; import * as stream from 'stream'; +import { EnvOverrides } from '../common/utilities'; import { NativeScriptCli } from './nativeScriptCli'; import * as scanner from './streamScanner'; @@ -9,13 +10,27 @@ export interface IDebugResult { tnsOutputEventEmitter: EventEmitter; } +export interface DebugOptions { + stopOnEntry: boolean; + watch: boolean; + launchTests: boolean; +} + +export interface ProjectOptions { + /** Working directory for CLI commands; defaults to the app root. */ + cwd?: string; + env?: EnvOverrides; +} + export abstract class Project { private _appRoot: string; private _cli: NativeScriptCli; + private _options: ProjectOptions; - constructor(appRoot: string, cli: NativeScriptCli) { + constructor(appRoot: string, cli: NativeScriptCli, options: ProjectOptions = {}) { this._appRoot = appRoot; this._cli = cli; + this._options = options; } public get appRoot(): string { @@ -29,31 +44,46 @@ export abstract class Project { public abstract platformName(): string; public run(tnsArgs?: string[]): ChildProcess { - return this.executeRunCommand(tnsArgs ?? []); + return this.executeCli(['run', this.platformName(), ...(tnsArgs ?? [])]); } - public abstract attach(tnsArgs?: string[]): IDebugResult; + public attach(tnsArgs?: string[]): IDebugResult { + const args = ['--start', ...(tnsArgs ?? [])]; + return this.monitor(this.executeCli(['debug', this.platformName(), ...args]), args); + } - public abstract debug( - options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, - tnsArgs?: string[], - ): IDebugResult; + public debug(options: DebugOptions, tnsArgs?: string[]): IDebugResult { + const args = [options.watch ? '--watch' : '--no-watch']; + if (options.stopOnEntry) { + args.push('--debug-brk'); + } + args.push(...(tnsArgs ?? [])); - protected configureReadyEvent(readableStream: stream.Readable, eventEmitter: EventEmitter): void { - new scanner.StringMatchingScanner(readableStream).onEveryMatch('TypeScript compiler failed', () => { - eventEmitter.emit('tsCompilationError'); - }); + const command = options.launchTests ? 'test' : 'debug'; + return this.monitor(this.executeCli([command, this.platformName(), ...args]), args); } - protected executeRunCommand(args: string[]): ChildProcess { - return this._cli.execute(['run', this.platformName()].concat(args), this._appRoot); + /** + * Watches a running CLI process for debug port announcements. `args` are the CLI arguments it was started with + * (used to tell whether it waits for a debugger before starting the app). + */ + public monitor(child: ChildProcess, args: readonly string[]): IDebugResult { + const tnsOutputEventEmitter = new EventEmitter(); + this.configureReadyEvent(child.stdout!, tnsOutputEventEmitter, args); + return { tnsProcess: child, tnsOutputEventEmitter }; } - protected executeDebugCommand(args: string[]): ChildProcess { - return this._cli.execute(['debug', this.platformName()].concat(args), this._appRoot); + protected configureReadyEvent( + readableStream: stream.Readable, + eventEmitter: EventEmitter, + _args: readonly string[], + ): void { + new scanner.StringMatchingScanner(readableStream).onEveryMatch('TypeScript compiler failed', () => { + eventEmitter.emit('tsCompilationError'); + }); } - protected executeTestCommand(args: string[]): ChildProcess { - return this._cli.execute(['test', this.platformName()].concat(args), this._appRoot); + private executeCli(args: string[]): ChildProcess { + return this._cli.execute(args, { cwd: this._options.cwd ?? this._appRoot, env: this._options.env }); } } diff --git a/src/project/projectInfo.ts b/src/project/projectInfo.ts index d235a7e..c757705 100644 --- a/src/project/projectInfo.ts +++ b/src/project/projectInfo.ts @@ -57,6 +57,24 @@ export function getBundler(appRoot: string): Bundler { return bundler === 'vite' || bundler === 'rspack' ? bundler : 'webpack'; } +/** + * Finds a locally installed CLI (`node_modules/.bin/ns`) in appRoot or any parent directory, like npx does, so + * monorepos that install it at the workspace root are covered. + */ +export function findLocalCli(appRoot: string, platform: NodeJS.Platform = process.platform): string | undefined { + const binName = platform === 'win32' ? 'ns.cmd' : 'ns'; + let dir = path.resolve(appRoot); + + while (true) { + const candidate = path.join(dir, 'node_modules', '.bin', binName); + if (fs.existsSync(candidate)) return candidate; + + const parent = path.dirname(dir); + if (parent === dir) return undefined; + dir = parent; + } +} + export function isVitestProject(appRoot: string): boolean { return ['ts', 'mts', 'js', 'mjs'].some((ext) => fs.existsSync(path.join(appRoot, `vitest.config.${ext}`))); } diff --git a/src/services/buildService.ts b/src/services/buildService.ts index 376b63f..f17a8af 100644 --- a/src/services/buildService.ts +++ b/src/services/buildService.ts @@ -7,7 +7,8 @@ import * as utils from '../common/utilities'; import { getBundler, isVitestProject } from '../project/projectInfo'; import { AndroidProject } from '../project/androidProject'; import { IosProject } from '../project/iosProject'; -import { IDebugResult } from '../project/project'; +import { NativeScriptCli } from '../project/nativeScriptCli'; +import { IDebugResult, Project, ProjectOptions } from '../project/project'; import { services } from './extensionHostServices'; export interface BuildArgs { @@ -18,6 +19,13 @@ export interface BuildArgs { stopOnEntry?: boolean; launchTests?: boolean; tnsArgs?: string[]; + /** Replaces the ns CLI; the command then runs exactly as given, with no flags added. */ + runtimeExecutable?: string; + runtimeArgs?: string[]; + /** Working directory for the command; relative paths resolve against workspaceRoot. Defaults to appRoot. */ + cwd?: string; + env?: utils.EnvOverrides; + workspaceRoot?: string; } /** Ignore repeated port announcements closer together than this; the CLI can print the same port twice. */ @@ -85,7 +93,7 @@ export class BuildSession extends EventEmitter { } const timer = setTimeout(() => { this.logger.log('[NativeScript] The ns command did not exit in time, killing it\n'); - child.kill('SIGKILL'); + utils.killProcess(child, this.logger, 'SIGKILL'); resolve(); }, CLI_EXIT_TIMEOUT_MS); child.once('close', () => { @@ -133,6 +141,16 @@ export class BuildService { public async startBuild(args: BuildArgs, isCancelled: () => boolean = () => false): Promise { const cli = services.createCli(args.appRoot); const platform = args.platform?.toLowerCase(); + const projectOptions: ProjectOptions = { cwd: this.resolveCwd(args), env: args.env }; + + if (args.runtimeExecutable) { + return this.startCustomCommand( + args, + platform, + this.createProject(platform, args.appRoot, cli, projectOptions), + isCancelled, + ); + } this.logger.log(`[NativeScript] Using ns CLI on path '${cli.path}'\n`); const version = await cli.getSupportedVersion(services.minCliVersion); @@ -144,7 +162,7 @@ export class BuildService { ); } - const project = platform === 'ios' ? new IosProject(args.appRoot, cli) : new AndroidProject(args.appRoot, cli); + const project = this.createProject(platform, args.appRoot, cli, projectOptions); void services.analyticsService.trackDebug(args.request, platform); let tnsArgs = [...(args.tnsArgs ?? [])]; @@ -184,6 +202,40 @@ export class BuildService { return new BuildSession(command, this.logger); } + private startCustomCommand( + args: BuildArgs, + platform: string, + project: Project, + isCancelled: () => boolean, + ): BuildSession | null { + const runtimeArgs = args.runtimeArgs ?? []; + if (args.tnsArgs?.length) { + this.logger.log("[NativeScript] 'tnsArgs' is ignored when 'runtimeExecutable' is set; use 'runtimeArgs'\n"); + } + + void services.analyticsService.trackDebug(args.request, platform); + + if (isCancelled()) return null; + + // Each runtimeArgs entry is one argument, as in js-debug launch configs. + const commandLine = [args.runtimeExecutable!, ...runtimeArgs].map((arg) => utils.quoteShellArg(arg)).join(' '); + const cwd = this.resolveCwd(args); + this.logger.log(`[NativeScript] Running: ${commandLine} (in ${cwd})\n`); + const child = utils.spawnInShell(commandLine, { cwd, env: args.env }); + + this.logger.log('[NativeScript] Watching command output for the debug port\n'); + return new BuildSession(project.monitor(child, runtimeArgs), this.logger); + } + + private createProject(platform: string, appRoot: string, cli: NativeScriptCli, options: ProjectOptions): Project { + return platform === 'ios' ? new IosProject(appRoot, cli, options) : new AndroidProject(appRoot, cli, options); + } + + private resolveCwd(args: BuildArgs): string { + if (!args.cwd) return args.appRoot; + return path.resolve(args.workspaceRoot ?? args.appRoot, args.cwd); + } + private getTeamId(appRoot: string, tnsArgs: string[]): string | null { const teamIdArgIndex = tnsArgs.indexOf('--teamId'); if (teamIdArgIndex >= 0 && teamIdArgIndex + 1 < tnsArgs.length) { diff --git a/src/services/extensionHostServices.ts b/src/services/extensionHostServices.ts index 83719e9..a6ed6fd 100644 --- a/src/services/extensionHostServices.ts +++ b/src/services/extensionHostServices.ts @@ -3,7 +3,9 @@ import * as vscode from 'vscode'; import { AnalyticsService } from '../analytics/analyticsService'; import { ILogger } from '../common/logger'; import { WorkspaceConfigService } from '../common/workspaceConfigService'; +import { quoteShellArg } from '../common/utilities'; import { NativeScriptCli } from '../project/nativeScriptCli'; +import { findLocalCli } from '../project/projectInfo'; import { BuildService } from './buildService'; import { iOSTeamService } from './iOSTeamService'; @@ -57,13 +59,21 @@ export class ExtensionHostServices { } /** - * Bare command names (e.g. `ns`) are looked up on PATH; path-like relative values - * (e.g. `./node_modules/.bin/ns`) are resolved against the app root. + * With no nsPath configured, prefers a CLI installed in the project (or a parent directory) over the global `ns`. + * A configured bare command (e.g. `ns`) is looked up on PATH; a path-like relative value + * (e.g. `./node_modules/.bin/ns`) is resolved against the app root. */ public createCli(appRoot?: string): NativeScriptCli { - const nsPath = this.workspaceConfigService.nsPath; - const isRelativePath = !path.isAbsolute(nsPath) && /[\\/]/.test(nsPath); - const resolved = isRelativePath && appRoot ? path.join(appRoot, nsPath) : nsPath; + const configured = this.workspaceConfigService.configuredNsPath; + + if (!configured) { + const local = appRoot ? findLocalCli(appRoot) : undefined; + // Configured values are passed to the shell as-is (so `npx ns` keeps working); a discovered path is quoted. + return new NativeScriptCli(local ? quoteShellArg(local) : 'ns', this.logger); + } + + const isRelativePath = !path.isAbsolute(configured) && /[\\/]/.test(configured); + const resolved = isRelativePath && appRoot ? path.join(appRoot, configured) : configured; return new NativeScriptCli(resolved, this.logger); } diff --git a/src/tests/androidProject.test.ts b/src/tests/androidProject.test.ts index fefa998..df2c5c3 100644 --- a/src/tests/androidProject.test.ts +++ b/src/tests/androidProject.test.ts @@ -3,15 +3,17 @@ import { EventEmitter } from 'events'; import { PassThrough } from 'stream'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { AndroidProject } from '../project/androidProject'; +import { ShellSpawnOptions } from '../common/utilities'; import { NativeScriptCli } from '../project/nativeScriptCli'; const READY_DELAY_MS = 1000; const APP_ROOT = '/projects/demo'; +const DEFAULT_OPTIONS: ShellSpawnOptions = { cwd: APP_ROOT, env: undefined }; function createCli() { const stdout = new PassThrough(); const proc = Object.assign(new EventEmitter(), { stdout, stderr: new PassThrough() }); - const execute = vi.fn((_args: string[], _cwd: string) => proc as unknown as ChildProcess); + const execute = vi.fn((_args: string[], _options: ShellSpawnOptions) => proc as unknown as ChildProcess); return { cli: { execute } as unknown as NativeScriptCli, execute, stdout, proc }; } @@ -39,20 +41,20 @@ describe('AndroidProject', () => { const result = project.debug({ stopOnEntry: false, watch: true, launchTests: false }, ['--device', 'emu']); - expect(fake.execute).toHaveBeenCalledWith(['debug', 'android', '--watch', '--device', 'emu'], APP_ROOT); + expect(fake.execute).toHaveBeenCalledWith(['debug', 'android', '--watch', '--device', 'emu'], DEFAULT_OPTIONS); expect(result.tnsProcess).toBe(fake.proc); }); it('uses ns test for launchTests and --debug-brk for stopOnEntry', () => { new AndroidProject(APP_ROOT, fake.cli).debug({ stopOnEntry: true, watch: false, launchTests: true }); - expect(fake.execute).toHaveBeenCalledWith(['test', 'android', '--no-watch', '--debug-brk'], APP_ROOT); + expect(fake.execute).toHaveBeenCalledWith(['test', 'android', '--no-watch', '--debug-brk'], DEFAULT_OPTIONS); }); it('builds the attach command line', () => { new AndroidProject(APP_ROOT, fake.cli).attach(['--env.foo']); - expect(fake.execute).toHaveBeenCalledWith(['debug', 'android', '--start', '--env.foo'], APP_ROOT); + expect(fake.execute).toHaveBeenCalledWith(['debug', 'android', '--start', '--env.foo'], DEFAULT_OPTIONS); }); it('announces the debug port one second after the CLI prints it', async () => { @@ -121,6 +123,44 @@ describe('AndroidProject', () => { expect(ready).toHaveBeenCalledExactlyOnceWith(40000); }); + it('runs commands in the configured cwd with the configured env', () => { + const env = { ANDROID_HOME: '/sdk', NODE_OPTIONS: null }; + const project = new AndroidProject(APP_ROOT, fake.cli, { cwd: '/repo', env }); + + project.debug({ stopOnEntry: false, watch: true, launchTests: false }); + project.attach(); + project.run(['--release']); + + expect(fake.execute.mock.calls.map(([args, options]) => [args[0], options])).toEqual([ + ['debug', { cwd: '/repo', env }], + ['debug', { cwd: '/repo', env }], + ['run', { cwd: '/repo', env }], + ]); + expect(fake.execute.mock.calls[2][0]).toEqual(['run', 'android', '--release']); + }); + + it.each([ + ['announces the port directly', ['nx', 'run', 'mobile:debug'], false], + ['detects --debug-brk embedded in a wrapper flag', ['nx', 'run', 'mobile:debug', '--flags=--debug-brk'], true], + ])('monitor %s', async (_label, args, waits) => { + const { tnsOutputEventEmitter, tnsProcess } = new AndroidProject(APP_ROOT, fake.cli).monitor( + fake.proc as unknown as ChildProcess, + args, + ); + tnsOutputEventEmitter.on('readyForConnection', ready); + + expect(tnsProcess).toBe(fake.proc); + expect(fake.execute).not.toHaveBeenCalled(); + + await writeLine(fake.stdout, 'device: emulator-5554 debug port: 40000'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + expect(ready).toHaveBeenCalledTimes(waits ? 0 : 1); + + await writeLine(fake.stdout, '# NativeScript Debugger started #'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + expect(ready).toHaveBeenCalledExactlyOnceWith(40000); + }); + it('emits tsCompilationError on TypeScript failures', async () => { const { tnsOutputEventEmitter } = new AndroidProject(APP_ROOT, fake.cli).attach(); const compilationError = vi.fn(); diff --git a/src/tests/buildService.test.ts b/src/tests/buildService.test.ts index cd5dee5..114cb3a 100644 --- a/src/tests/buildService.test.ts +++ b/src/tests/buildService.test.ts @@ -9,26 +9,28 @@ import { ILogger } from '../common/logger'; import { AnalyticsService } from '../analytics/analyticsService'; import * as utils from '../common/utilities'; import { NativeScriptCli } from '../project/nativeScriptCli'; -import { IDebugResult } from '../project/project'; +import { IDebugResult, ProjectOptions } from '../project/project'; import { BuildArgs, BuildService, BuildSession, CLI_EXIT_TIMEOUT_MS } from '../services/buildService'; import { services } from '../services/extensionHostServices'; import { iOSTeamService } from '../services/iOSTeamService'; const projects = vi.hoisted(() => ({ - created: [] as Array<{ platform: string; appRoot: string }>, + created: [] as Array<{ platform: string; appRoot: string; options?: ProjectOptions }>, debug: vi.fn< (options: { stopOnEntry: boolean; watch: boolean; launchTests: boolean }, tnsArgs?: string[]) => IDebugResult >(), attach: vi.fn<(tnsArgs?: string[]) => IDebugResult>(), + monitor: vi.fn<(child: ChildProcess, args: readonly string[]) => IDebugResult>(), })); vi.mock('../project/iosProject', () => ({ IosProject: class { public debug = projects.debug; public attach = projects.attach; - constructor(appRoot: string) { - projects.created.push({ platform: 'ios', appRoot }); + public monitor = projects.monitor; + constructor(appRoot: string, _cli: unknown, options?: ProjectOptions) { + projects.created.push({ platform: 'ios', appRoot, options }); } }, })); @@ -37,8 +39,9 @@ vi.mock('../project/androidProject', () => ({ AndroidProject: class { public debug = projects.debug; public attach = projects.attach; - constructor(appRoot: string) { - projects.created.push({ platform: 'android', appRoot }); + public monitor = projects.monitor; + constructor(appRoot: string, _cli: unknown, options?: ProjectOptions) { + projects.created.push({ platform: 'android', appRoot, options }); } }, })); @@ -46,6 +49,7 @@ vi.mock('../project/androidProject', () => ({ vi.mock('../common/utilities', async (importOriginal) => ({ ...(await importOriginal()), killProcess: vi.fn(), + spawnInShell: vi.fn(), })); function createFakeProcess() { @@ -55,7 +59,6 @@ function createFakeProcess() { pid: 4242, exitCode: null as number | null, signalCode: null as NodeJS.Signals | null, - kill: vi.fn((_signal?: NodeJS.Signals) => true), }); } @@ -171,7 +174,7 @@ describe('BuildSession', () => { proc.emit('close', 0); await exited; expect(closed).not.toHaveBeenCalled(); - expect(proc.kill).not.toHaveBeenCalled(); + expect(utils.killProcess).not.toHaveBeenCalledWith(proc, logger, 'SIGKILL'); }); it('disconnect resolves only once the process closes', async () => { @@ -189,7 +192,7 @@ describe('BuildSession', () => { expect(resolved).toBe(true); await vi.advanceTimersByTimeAsync(CLI_EXIT_TIMEOUT_MS); - expect(proc.kill).not.toHaveBeenCalled(); + expect(utils.killProcess).not.toHaveBeenCalledWith(proc, logger, 'SIGKILL'); }); it('disconnect force-kills a process that ignores SIGINT', async () => { @@ -201,7 +204,10 @@ describe('BuildSession', () => { void session.disconnect().then(() => (resolved = true)); await vi.advanceTimersByTimeAsync(CLI_EXIT_TIMEOUT_MS); - expect(proc.kill).toHaveBeenCalledExactlyOnceWith('SIGKILL'); + expect(vi.mocked(utils.killProcess).mock.calls).toEqual([ + [proc, logger], + [proc, logger, 'SIGKILL'], + ]); expect(resolved).toBe(true); }); @@ -217,7 +223,7 @@ describe('BuildSession', () => { await session.disconnect(); await vi.advanceTimersByTimeAsync(CLI_EXIT_TIMEOUT_MS); - expect(proc.kill).not.toHaveBeenCalled(); + expect(utils.killProcess).not.toHaveBeenCalledWith(proc, logger, 'SIGKILL'); }); it('repeated disconnects share one exit promise', async () => { @@ -251,6 +257,7 @@ describe('BuildService.startBuild', () => { let trackDebug: ReturnType; let appRoot: string; let service: BuildService; + let customProcess: FakeProcess; const baseArgs = (overrides: Partial = {}): BuildArgs => ({ appRoot, @@ -273,6 +280,9 @@ describe('BuildService.startBuild', () => { projects.created.length = 0; projects.debug.mockImplementation(() => createDebugResult().result); projects.attach.mockImplementation(() => createDebugResult().result); + projects.monitor.mockImplementation((child) => ({ tnsProcess: child, tnsOutputEventEmitter: new EventEmitter() })); + customProcess = createFakeProcess(); + vi.mocked(utils.spawnInShell).mockReturnValue(customProcess as unknown as ChildProcess); cli = { path: 'ns', getSupportedVersion: vi.fn(async () => '8.9.2') }; vi.spyOn(services, 'createCli').mockReturnValue(cli as unknown as NativeScriptCli); @@ -298,7 +308,7 @@ describe('BuildService.startBuild', () => { expect(session).toBeInstanceOf(BuildSession); expect(services.createCli).toHaveBeenCalledWith(appRoot); expect(cli.getSupportedVersion).toHaveBeenCalledWith(services.minCliVersion); - expect(projects.created).toEqual([{ platform: 'android', appRoot }]); + expect(projects.created).toEqual([{ platform: 'android', appRoot, options: { cwd: appRoot, env: undefined } }]); expect(projects.debug).toHaveBeenCalledExactlyOnceWith({ stopOnEntry: true, watch: true, launchTests: false }, [ '--device', 'emulator-5554', @@ -306,6 +316,24 @@ describe('BuildService.startBuild', () => { expect(trackDebug).toHaveBeenCalledWith('launch', 'android'); }); + it('passes cwd and env to the project, resolving a relative cwd against the workspace root', async () => { + const workspaceRoot = path.join(appRoot, 'workspace'); + + await service.startBuild(baseArgs({ cwd: 'apps/mobile', workspaceRoot, env: { FOO: 'bar', HOME: null } })); + + expect(projects.created[0].options).toEqual({ + cwd: path.join(workspaceRoot, 'apps/mobile'), + env: { FOO: 'bar', HOME: null }, + }); + }); + + it('resolves a relative cwd against the app root without a workspace root, and keeps an absolute one', async () => { + await service.startBuild(baseArgs({ cwd: '..' })); + await service.startBuild(baseArgs({ cwd: '/opt/monorepo', workspaceRoot: '/elsewhere' })); + + expect(projects.created.map(({ options }) => options?.cwd)).toEqual([path.dirname(appRoot), '/opt/monorepo']); + }); + it('uses attach for attach requests', async () => { await service.startBuild(baseArgs({ request: 'attach', tnsArgs: ['--env.foo'] })); @@ -315,7 +343,7 @@ describe('BuildService.startBuild', () => { it('picks the iOS project case-insensitively', async () => { await service.startBuild(baseArgs({ platform: 'iOS', request: 'attach' })); - expect(projects.created).toEqual([{ platform: 'ios', appRoot }]); + expect(projects.created).toEqual([{ platform: 'ios', appRoot, options: { cwd: appRoot, env: undefined } }]); }); describe('Vite projects', () => { @@ -372,6 +400,76 @@ describe('BuildService.startBuild', () => { expect(projects.attach).not.toHaveBeenCalled(); }); + describe('with runtimeExecutable', () => { + const custom = (overrides: Partial = {}) => + baseArgs({ runtimeExecutable: 'npx', runtimeArgs: ['nx', 'run', 'mobile:debug'], ...overrides }); + + it('spawns the command in the shell and monitors its output', async () => { + const session = await service.startBuild(custom({ env: { FOO: 'bar' } })); + + expect(session).toBeInstanceOf(BuildSession); + expect(utils.spawnInShell).toHaveBeenCalledExactlyOnceWith('npx nx run mobile:debug', { + cwd: appRoot, + env: { FOO: 'bar' }, + }); + expect(projects.monitor).toHaveBeenCalledExactlyOnceWith(customProcess, ['nx', 'run', 'mobile:debug']); + expect(projects.debug).not.toHaveBeenCalled(); + expect(projects.attach).not.toHaveBeenCalled(); + expect(trackDebug).toHaveBeenCalledWith('launch', 'android'); + }); + + it.skipIf(process.platform === 'win32')('quotes each argument for the shell', async () => { + await service.startBuild( + custom({ runtimeExecutable: '/opt/my tools/run', runtimeArgs: ['--name', "it's here", '--flags=--debug-brk'] }), + ); + + expect(vi.mocked(utils.spawnInShell).mock.lastCall![0]).toBe( + "'/opt/my tools/run' --name 'it'\\''s here' --flags=--debug-brk", + ); + }); + + it('resolves a relative cwd against the workspace root for both the command and the project', async () => { + const workspaceRoot = path.join(appRoot, 'repo'); + + await service.startBuild(custom({ cwd: 'apps/mobile', workspaceRoot })); + + const cwd = path.join(workspaceRoot, 'apps/mobile'); + expect(utils.spawnInShell).toHaveBeenCalledWith(expect.any(String), { cwd, env: undefined }); + expect(projects.created[0].options).toEqual({ cwd, env: undefined }); + }); + + it('skips the CLI version check, Vitest check, --no-hmr and the team picker', async () => { + writeAppFile('nativescript.config.ts', "export default { bundler: 'vite' };\n"); + writeAppFile('vitest.config.ts', 'export default {};\n'); + + await service.startBuild(custom({ platform: 'ios', launchTests: true })); + + expect(cli.getSupportedVersion).not.toHaveBeenCalled(); + expect(selectTeam).not.toHaveBeenCalled(); + expect(utils.spawnInShell).toHaveBeenCalledWith('npx nx run mobile:debug', expect.anything()); + expect(projects.created.map(({ platform }) => platform)).toEqual(['ios']); + }); + + it('ignores tnsArgs and says so', async () => { + await service.startBuild(custom({ tnsArgs: ['--env.foo'] })); + + expect(utils.spawnInShell).toHaveBeenCalledWith('npx nx run mobile:debug', expect.anything()); + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining("'tnsArgs' is ignored")); + }); + + it('runs the executable alone without runtimeArgs', async () => { + await service.startBuild(custom({ runtimeExecutable: './debug.sh', runtimeArgs: undefined })); + + expect(utils.spawnInShell).toHaveBeenCalledWith('./debug.sh', expect.anything()); + expect(projects.monitor).toHaveBeenCalledWith(customProcess, []); + }); + + it('returns null without spawning when cancelled', async () => { + await expect(service.startBuild(custom(), () => true)).resolves.toBeNull(); + expect(utils.spawnInShell).not.toHaveBeenCalled(); + }); + }); + describe('iOS team selection', () => { it('asks for a team on iOS launch and passes it to the CLI', async () => { await service.startBuild(baseArgs({ platform: 'ios' })); diff --git a/src/tests/debugManager.test.ts b/src/tests/debugManager.test.ts index c50f0e0..7c07068 100644 --- a/src/tests/debugManager.test.ts +++ b/src/tests/debugManager.test.ts @@ -12,7 +12,7 @@ import { import { computeSourceMapOptions, SourceMapConfig } from '../debug-adapter/sourceMaps'; import { BuildArgs, BuildService, BuildSession } from '../services/buildService'; import { services } from '../services/extensionHostServices'; -import { debug, MockDebugSession, testing, window } from './mocks/vscode'; +import { debug, MockDebugSession, testing, window, workspace } from './mocks/vscode'; vi.mock('../debug-adapter/sourceMaps', () => ({ computeSourceMapOptions: vi.fn(async (_appRoot: string, config: SourceMapConfig) => ({ @@ -163,6 +163,11 @@ describe('DebugManager', () => { stopOnEntry: false, launchTests: undefined, tnsArgs: ['--env.foo'], + runtimeExecutable: undefined, + runtimeArgs: undefined, + cwd: undefined, + env: undefined, + workspaceRoot: '/workspace/app', }, expect.any(Function), ); @@ -195,6 +200,31 @@ describe('DebugManager', () => { expect(lastChildConfig().websocketAddress).toBe('ws://192.168.1.5:42000'); }); + it('forwards custom command settings and the workspace root to startBuild', async () => { + const otherFolder = { uri: { fsPath: '/monorepo' }, name: 'monorepo', index: 1 }; + workspace.getWorkspaceFolder.mockReturnValueOnce(otherFolder); + + await startWithChild({ + platform: 'android', + request: 'launch', + appRoot: '/monorepo/apps/mobile', + runtimeExecutable: 'npx', + runtimeArgs: ['nx', 'run', 'mobile:debug'], + cwd: '.', + env: { FOO: 'bar', HOME: null }, + }); + + expect(startBuild.mock.calls[0][0]).toMatchObject({ + appRoot: '/monorepo/apps/mobile', + runtimeExecutable: 'npx', + runtimeArgs: ['nx', 'run', 'mobile:debug'], + cwd: '.', + env: { FOO: 'bar', HOME: null }, + workspaceRoot: '/monorepo', + }); + expect(debug.startDebugging.mock.calls[0][0]).toBe(otherFolder); + }); + it("falls back to the parent's workspace folder for appRoot", async () => { await startWithChild({ platform: 'android', request: 'launch' }); expect(startBuild.mock.calls[0][0].appRoot).toBe('/workspace/app'); diff --git a/src/tests/extensionHostServices.test.ts b/src/tests/extensionHostServices.test.ts new file mode 100644 index 0000000..310e516 --- /dev/null +++ b/src/tests/extensionHostServices.test.ts @@ -0,0 +1,78 @@ +import * as fs from 'fs'; +import * as os from 'os'; +import * as path from 'path'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { quoteShellArg } from '../common/utilities'; +import { ExtensionHostServices } from '../services/extensionHostServices'; +import { testing } from './mocks/vscode'; + +describe('ExtensionHostServices.createCli', () => { + let services: ExtensionHostServices; + let appRoot: string; + + const installLocalCli = () => { + const bin = path.join(appRoot, 'node_modules', '.bin', process.platform === 'win32' ? 'ns.cmd' : 'ns'); + fs.mkdirSync(path.dirname(bin), { recursive: true }); + fs.writeFileSync(bin, ''); + return bin; + }; + + beforeEach(() => { + appRoot = fs.mkdtempSync(path.join(os.tmpdir(), 'ns app ')); + services = new ExtensionHostServices(); + services.logger = { log: vi.fn() }; + }); + + afterEach(() => { + testing.configuration = {}; + fs.rmSync(appRoot, { recursive: true, force: true }); + }); + + describe('with nsPath configured', () => { + it.each(['ns', 'npx ns', '/usr/local/bin/ns'])('uses %j as-is', (nsPath) => { + testing.configuration = { nsPath }; + installLocalCli(); + + expect(services.createCli(appRoot).path).toBe(nsPath); + }); + + it('resolves a path-like relative value against the app root', () => { + testing.configuration = { nsPath: './node_modules/.bin/ns' }; + + expect(services.createCli(appRoot).path).toBe(path.join(appRoot, 'node_modules/.bin/ns')); + }); + + it('keeps a relative value as-is without an app root', () => { + testing.configuration = { nsPath: './node_modules/.bin/ns' }; + + expect(services.createCli().path).toBe('./node_modules/.bin/ns'); + }); + }); + + describe('without nsPath configured', () => { + it('uses the CLI installed in the project, quoted for the shell', () => { + const bin = installLocalCli(); + + const cliPath = services.createCli(appRoot).path; + + expect(cliPath).toBe(quoteShellArg(bin)); + expect(cliPath).not.toBe(bin); + }); + + it('finds the CLI installed in a parent directory', () => { + const bin = installLocalCli(); + const nested = path.join(appRoot, 'apps', 'mobile'); + fs.mkdirSync(nested, { recursive: true }); + + expect(services.createCli(nested).path).toBe(quoteShellArg(bin)); + }); + + it('falls back to ns when no local CLI exists', () => { + expect(services.createCli(appRoot).path).toBe('ns'); + }); + + it('falls back to ns without an app root', () => { + expect(services.createCli().path).toBe('ns'); + }); + }); +}); diff --git a/src/tests/iosProject.test.ts b/src/tests/iosProject.test.ts index 71da66a..de45eea 100644 --- a/src/tests/iosProject.test.ts +++ b/src/tests/iosProject.test.ts @@ -3,15 +3,17 @@ import { EventEmitter } from 'events'; import { PassThrough } from 'stream'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { IosProject } from '../project/iosProject'; +import { ShellSpawnOptions } from '../common/utilities'; import { NativeScriptCli } from '../project/nativeScriptCli'; const READY_DELAY_MS = 1000; const APP_ROOT = '/projects/demo'; +const DEFAULT_OPTIONS: ShellSpawnOptions = { cwd: APP_ROOT, env: undefined }; function createCli() { const stdout = new PassThrough(); const proc = Object.assign(new EventEmitter(), { stdout, stderr: new PassThrough() }); - const execute = vi.fn((_args: string[], _cwd: string) => proc as unknown as ChildProcess); + const execute = vi.fn((_args: string[], _options: ShellSpawnOptions) => proc as unknown as ChildProcess); return { cli: { execute } as unknown as NativeScriptCli, execute, stdout, proc }; } @@ -50,11 +52,31 @@ describe('IosProject', () => { project.attach(['--env.foo']); expect(fake.execute.mock.calls).toEqual([ - [['debug', 'ios', '--watch', '--debug-brk', '--teamId', 'ABC'], APP_ROOT], - [['debug', 'ios', '--start', '--env.foo'], APP_ROOT], + [['debug', 'ios', '--watch', '--debug-brk', '--teamId', 'ABC'], DEFAULT_OPTIONS], + [['debug', 'ios', '--start', '--env.foo'], DEFAULT_OPTIONS], ]); }); + it('runs commands in the configured cwd with the configured env', () => { + new IosProject(APP_ROOT, fake.cli, { cwd: '/repo', env: { FOO: 'bar' } }).attach(); + + expect(fake.execute).toHaveBeenCalledWith(['debug', 'ios', '--start'], { cwd: '/repo', env: { FOO: 'bar' } }); + }); + + it('monitor watches an externally started process', async () => { + const { tnsOutputEventEmitter } = new IosProject(APP_ROOT, fake.cli).monitor( + fake.proc as unknown as ChildProcess, + [], + ); + tnsOutputEventEmitter.on('readyForConnection', ready); + + await writeLine(fake.stdout, 'Opened localhost 41000'); + await vi.advanceTimersByTimeAsync(READY_DELAY_MS); + + expect(ready).toHaveBeenCalledExactlyOnceWith(41000); + expect(fake.execute).not.toHaveBeenCalled(); + }); + it('announces the port from "Opened localhost" one second later', async () => { const { tnsOutputEventEmitter } = new IosProject(APP_ROOT, fake.cli).debug({ stopOnEntry: false, diff --git a/src/tests/mocks/vscode.ts b/src/tests/mocks/vscode.ts index dcde0bd..a8a6b7a 100644 --- a/src/tests/mocks/vscode.ts +++ b/src/tests/mocks/vscode.ts @@ -54,7 +54,7 @@ export const debug = { export const workspace = { workspaceFolders: undefined as unknown[] | undefined, - getWorkspaceFolder: vi.fn(() => undefined), + getWorkspaceFolder: vi.fn((_uri: unknown): unknown => undefined), getConfiguration: vi.fn(() => ({ get: (key: string, defaultValue?: T) => key in testing.configuration ? testing.configuration[key] : defaultValue, diff --git a/src/tests/projectInfo.test.ts b/src/tests/projectInfo.test.ts index 57c6ef8..94607bc 100644 --- a/src/tests/projectInfo.test.ts +++ b/src/tests/projectInfo.test.ts @@ -2,7 +2,7 @@ import * as fs from 'fs'; import * as os from 'os'; import * as path from 'path'; import { afterEach, beforeEach, describe, expect, it } from 'vitest'; -import { getAppDirectory, getBundler, isVitestProject, readPackageJson } from '../project/projectInfo'; +import { findLocalCli, getAppDirectory, getBundler, isVitestProject, readPackageJson } from '../project/projectInfo'; describe('projectInfo', () => { let appRoot: string; @@ -101,6 +101,47 @@ describe('projectInfo', () => { }); }); + describe('findLocalCli', () => { + const installCli = (dir: string, bin = 'ns') => { + const file = path.join(appRoot, dir, 'node_modules', '.bin', bin); + fs.mkdirSync(path.dirname(file), { recursive: true }); + fs.writeFileSync(file, ''); + return file; + }; + + it('finds the CLI installed in the app root', () => { + const cli = installCli('.'); + expect(findLocalCli(appRoot, 'darwin')).toBe(cli); + }); + + it('walks up to a parent directory', () => { + const cli = installCli('.'); + const nested = path.join(appRoot, 'apps', 'mobile'); + fs.mkdirSync(nested, { recursive: true }); + + expect(findLocalCli(nested, 'linux')).toBe(cli); + }); + + it('prefers the nearest install', () => { + installCli('.'); + const nearest = installCli('apps/mobile'); + + expect(findLocalCli(path.join(appRoot, 'apps', 'mobile'), 'linux')).toBe(nearest); + }); + + it('looks for ns.cmd on Windows', () => { + installCli('.'); + expect(findLocalCli(appRoot, 'win32')).toBeUndefined(); + + const cmd = installCli('.', 'ns.cmd'); + expect(findLocalCli(appRoot, 'win32')).toBe(cmd); + }); + + it('returns undefined when no ancestor has the CLI', () => { + expect(findLocalCli(appRoot, 'darwin')).toBeUndefined(); + }); + }); + describe('readPackageJson', () => { it('parses package.json', () => { writeAppFile('package.json', JSON.stringify({ name: 'demo-app', version: '1.0.0' })); diff --git a/src/tests/utilities.test.ts b/src/tests/utilities.test.ts new file mode 100644 index 0000000..1c57c2c --- /dev/null +++ b/src/tests/utilities.test.ts @@ -0,0 +1,244 @@ +import * as fs from 'fs'; +import * as childProcess from 'child_process'; +import { EventEmitter } from 'events'; +import * as os from 'os'; +import { afterEach, beforeEach, describe, expect, it, vi, type Mock, type MockInstance } from 'vitest'; +import { LogLevel } from '../common/logger'; +import { killProcess, quoteShellArg, resolveEnv, spawnInShell } from '../common/utilities'; + +vi.mock('child_process', async (importOriginal) => ({ + ...(await importOriginal()), + spawn: vi.fn(), + execSync: vi.fn(), +})); + +vi.mock('os', async (importOriginal) => { + const original = await importOriginal(); + return { ...original, platform: vi.fn(original.platform) }; +}); + +const originalPlatform = process.platform; +const setPlatform = (platform: NodeJS.Platform) => { + Object.defineProperty(process, 'platform', { value: platform }); + vi.mocked(os.platform).mockReturnValue(platform); +}; + +afterEach(() => { + setPlatform(originalPlatform); + vi.unstubAllEnvs(); +}); + +describe('resolveEnv', () => { + it('layers overrides over process.env, deleting null values and ignoring undefined ones', () => { + vi.stubEnv('NS_TEST_REMOVE', 'remove-me'); + vi.stubEnv('NS_TEST_KEEP', 'keep-me'); + + const env = resolveEnv({ NS_TEST_REMOVE: null, NS_TEST_ADD: 'added', NS_TEST_KEEP: undefined }); + + expect(env).not.toHaveProperty('NS_TEST_REMOVE'); + expect(env.NS_TEST_ADD).toBe('added'); + expect(env.NS_TEST_KEEP).toBe('keep-me'); + expect(process.env.NS_TEST_REMOVE).toBe('remove-me'); + expect(process.env).not.toHaveProperty('NS_TEST_ADD'); + }); + + it('returns a copy of process.env without overrides', () => { + const env = resolveEnv(); + + expect(env).toEqual(process.env); + expect(env).not.toBe(process.env); + }); +}); + +describe('quoteShellArg', () => { + describe('POSIX', () => { + it.each(['ns', '--env.foo=bar', '/usr/local/bin/ns', 'user@host:8080,a+b', '50%'])('leaves %j bare', (arg) => { + expect(quoteShellArg(arg, 'darwin')).toBe(arg); + }); + + it.each([ + ['with space', "'with space'"], + ["it's", "'it'\\''s'"], + ['$HOME', "'$HOME'"], + ['a;b', "'a;b'"], + ['"double"', `'"double"'`], + ['', "''"], + ['=foo', "'=foo'"], + ])('quotes %j as %s', (arg, expected) => { + expect(quoteShellArg(arg, 'linux')).toBe(expected); + }); + + it.skipIf(!fs.existsSync('/bin/zsh'))('round-trips through zsh, which expands a leading =', () => { + const args = ['=foo', '--env.a=b', 'with space', '~']; + const script = `printf '%s\\n' ${args.map((arg) => quoteShellArg(arg)).join(' ')}`; + + const output = childProcess.execFileSync('/bin/zsh', ['-c', script], { encoding: 'utf8' }); + + expect(output.split('\n').slice(0, -1)).toEqual(args); + }); + + it.skipIf(process.platform === 'win32')('round-trips through /bin/sh as single arguments', () => { + const args = ['plain', 'with space', "it's", '$HOME', '`id`', 'a;b|c&d', '*', '"x"', '\\n', '']; + const script = `printf '%s\\n' ${args.map((arg) => quoteShellArg(arg)).join(' ')}`; + + const output = childProcess.execFileSync('/bin/sh', ['-c', script], { encoding: 'utf8' }); + + expect(output.split('\n').slice(0, -1)).toEqual(args); + }); + }); + + describe('win32', () => { + it.each(['ns', 'C:\\Program_Files\\ns.cmd', '--env.foo=bar', 'user@host:8080'])('leaves %j bare', (arg) => { + expect(quoteShellArg(arg, 'win32')).toBe(arg); + }); + + it.each([ + ['C:\\Program Files\\ns.cmd', '"C:\\Program Files\\ns.cmd"'], + ['say "hi"', '"say ""hi"""'], + ['%PATH%', '"%PATH%"'], + ["it's", `"it's"`], + ['', '""'], + ])('quotes %j as %s', (arg, expected) => { + expect(quoteShellArg(arg, 'win32')).toBe(expected); + }); + }); +}); + +describe('spawnInShell', () => { + let child: EventEmitter & { stdout: { setEncoding: Mock }; stderr: { setEncoding: Mock } }; + + beforeEach(() => { + child = Object.assign(new EventEmitter(), { + stdout: { setEncoding: vi.fn() }, + stderr: { setEncoding: vi.fn() }, + }); + vi.mocked(childProcess.spawn).mockReturnValue(child as unknown as childProcess.ChildProcess); + }); + + it('runs the command line through $SHELL in its own process group with utf8 output', () => { + setPlatform('darwin'); + vi.stubEnv('SHELL', '/bin/zsh'); + vi.stubEnv('NS_TEST_DROP', 'x'); + + const result = spawnInShell('ns debug android', { cwd: '/projects/demo', env: { NS_TEST_DROP: null, FOO: 'bar' } }); + + expect(result).toBe(child); + const [commandLine, options] = vi.mocked(childProcess.spawn).mock.lastCall! as unknown as [ + string, + childProcess.SpawnOptions, + ]; + expect(commandLine).toBe('ns debug android'); + expect(options).toMatchObject({ cwd: '/projects/demo', shell: '/bin/zsh', detached: true, windowsHide: true }); + expect(options.env).toMatchObject({ FOO: 'bar' }); + expect(options.env).not.toHaveProperty('NS_TEST_DROP'); + expect(child.stdout.setEncoding).toHaveBeenCalledWith('utf8'); + expect(child.stderr.setEncoding).toHaveBeenCalledWith('utf8'); + }); + + it('falls back to the default shell when $SHELL is unset', () => { + setPlatform('linux'); + vi.stubEnv('SHELL', undefined); + + spawnInShell('ns', { cwd: '/tmp' }); + + expect(vi.mocked(childProcess.spawn).mock.lastCall![1]).toMatchObject({ shell: true }); + }); + + it('uses cmd.exe without a detached process group on Windows', () => { + setPlatform('win32'); + vi.stubEnv('SHELL', '/usr/bin/bash'); + + spawnInShell('ns', { cwd: 'C:\\demo' }); + + expect(vi.mocked(childProcess.spawn).mock.lastCall![1]).toMatchObject({ shell: 'cmd.exe', detached: false }); + }); +}); + +describe('killProcess', () => { + let logger: { log: Mock }; + let processKill: MockInstance; + const createChild = (pid: number | undefined) => ({ pid, kill: vi.fn(() => true) }); + + beforeEach(() => { + logger = { log: vi.fn() }; + processKill = vi.spyOn(process, 'kill').mockImplementation(() => true); + }); + + it('does nothing without a pid', () => { + const child = createChild(undefined); + + killProcess(child as unknown as childProcess.ChildProcess, logger); + + expect(processKill).not.toHaveBeenCalled(); + expect(child.kill).not.toHaveBeenCalled(); + expect(childProcess.execSync).not.toHaveBeenCalled(); + expect(logger.log).not.toHaveBeenCalled(); + }); + + it('signals the whole process group with SIGINT by default', () => { + setPlatform('darwin'); + const child = createChild(1234); + + killProcess(child as unknown as childProcess.ChildProcess, logger); + + expect(processKill).toHaveBeenCalledExactlyOnceWith(-1234, 'SIGINT'); + expect(child.kill).not.toHaveBeenCalled(); + }); + + it('passes a custom signal', () => { + setPlatform('linux'); + + killProcess(createChild(1234) as unknown as childProcess.ChildProcess, logger, 'SIGKILL'); + + expect(processKill).toHaveBeenCalledWith(-1234, 'SIGKILL'); + }); + + it('falls back to signalling the child when it is not a group leader', () => { + setPlatform('linux'); + processKill.mockImplementation(() => { + throw new Error('ESRCH'); + }); + const child = createChild(1234); + + killProcess(child as unknown as childProcess.ChildProcess, logger, 'SIGTERM'); + + expect(child.kill).toHaveBeenCalledExactlyOnceWith('SIGTERM'); + expect(logger.log).not.toHaveBeenCalledWith(expect.anything(), LogLevel.Error); + }); + + it('logs when the fallback also fails', () => { + setPlatform('linux'); + processKill.mockImplementation(() => { + throw new Error('ESRCH'); + }); + const child = createChild(1234); + child.kill.mockImplementation(() => { + throw new Error('EPERM'); + }); + + expect(() => killProcess(child as unknown as childProcess.ChildProcess, logger)).not.toThrow(); + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('EPERM'), LogLevel.Error); + }); + + it('kills the process tree with taskkill on Windows', () => { + setPlatform('win32'); + const child = createChild(1234); + + killProcess(child as unknown as childProcess.ChildProcess, logger); + + expect(childProcess.execSync).toHaveBeenCalledExactlyOnceWith('taskkill /pid 1234 /T /F'); + expect(processKill).not.toHaveBeenCalled(); + expect(child.kill).not.toHaveBeenCalled(); + }); + + it('logs a taskkill failure', () => { + setPlatform('win32'); + vi.mocked(childProcess.execSync).mockImplementation(() => { + throw new Error('taskkill failed'); + }); + + killProcess(createChild(1234) as unknown as childProcess.ChildProcess, logger); + + expect(logger.log).toHaveBeenCalledWith(expect.stringContaining('taskkill failed'), LogLevel.Error); + }); +}); diff --git a/src/tests/workspaceConfigService.test.ts b/src/tests/workspaceConfigService.test.ts index 9462343..301664e 100644 --- a/src/tests/workspaceConfigService.test.ts +++ b/src/tests/workspaceConfigService.test.ts @@ -33,3 +33,38 @@ describe('WorkspaceConfigService.nsPath', () => { expect(new WorkspaceConfigService().nsPath).toBe('ns'); }); }); + +describe('WorkspaceConfigService.configuredNsPath', () => { + afterEach(() => { + testing.configuration = {}; + }); + + it('is undefined when nothing is set', () => { + expect(new WorkspaceConfigService().configuredNsPath).toBeUndefined(); + }); + + it('returns an explicit nsPath', () => { + testing.configuration = { nsPath: 'npx ns', tnsPath: '/opt/tns' }; + expect(new WorkspaceConfigService().configuredNsPath).toBe('npx ns'); + }); + + it('treats an explicitly empty nsPath as unset, without falling back to tnsPath', () => { + testing.configuration = { nsPath: '', tnsPath: '/opt/tns' }; + expect(new WorkspaceConfigService().configuredNsPath).toBeUndefined(); + }); + + it('falls back to a non-empty tnsPath and warns once', () => { + testing.configuration = { tnsPath: '/opt/tns' }; + const logger = { log: vi.fn() }; + const service = new WorkspaceConfigService(logger); + + expect(service.configuredNsPath).toBe('/opt/tns'); + expect(service.configuredNsPath).toBe('/opt/tns'); + expect(logger.log).toHaveBeenCalledExactlyOnceWith(expect.stringContaining('deprecated'), LogLevel.Warn); + }); + + it('ignores an empty tnsPath', () => { + testing.configuration = { tnsPath: '' }; + expect(new WorkspaceConfigService().configuredNsPath).toBeUndefined(); + }); +});