From 30483259659983d91d6c8208451e8146cfeff61d Mon Sep 17 00:00:00 2001 From: Erasmus Cedernaes Date: Tue, 27 Oct 2026 21:15:47 +0100 Subject: [PATCH 01/24] [WIP] Web view --- .vscode/launch.json | 6 +- .vscode/settings.json | 6 + .vscode/tasks.json | 22 +- README.md | 12 +- package-lock.json | 1454 ++++++++++++++++++++- package.json | 129 +- src/repo-reader.ts | 55 +- src/stgit-webview.ts | 43 + src/stgit.ts | 695 ++++------ src/test/suite/extension.test.ts | 11 +- src/test/suite/repo-display-loads.test.ts | 76 +- src/test/unit/comment-discard.test.ts | 17 +- src/test/unit/debug-tasks.test.ts | 41 + src/test/unit/stgit-webview.test.ts | 194 +++ src/webview/App.tsx | 300 +++++ src/webview/index.tsx | 5 + src/webview/style.css | 274 ++++ tsconfig.json | 4 +- tsconfig.webview.json | 12 + 19 files changed, 2792 insertions(+), 564 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 src/stgit-webview.ts create mode 100644 src/test/unit/debug-tasks.test.ts create mode 100644 src/test/unit/stgit-webview.test.ts create mode 100644 src/webview/App.tsx create mode 100644 src/webview/index.tsx create mode 100644 src/webview/style.css create mode 100644 tsconfig.webview.json diff --git a/.vscode/launch.json b/.vscode/launch.json index 1f5b77a..70be883 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -11,7 +11,7 @@ "request": "launch", "args": ["--extensionDevelopmentPath=${workspaceFolder}"], "outFiles": ["${workspaceFolder}/out/**/*.js"], - "preLaunchTask": "${defaultBuildTask}" + "preLaunchTask": "stgit: debug" }, { "name": "Run Extension (Clean)", @@ -19,7 +19,7 @@ "request": "launch", "args": ["--extensionDevelopmentPath=${workspaceFolder}", "--disable-extensions"], "outFiles": ["${workspaceFolder}/out/**/*.js"], - "preLaunchTask": "${defaultBuildTask}" + "preLaunchTask": "stgit: debug" }, { "name": "Extension Tests", @@ -27,7 +27,7 @@ "request": "launch", "args": ["--extensionDevelopmentPath=${workspaceFolder}", "--extensionTestsPath=${workspaceFolder}/out/test/suite/index"], "outFiles": ["${workspaceFolder}/out/test/**/*.js"], - "preLaunchTask": "${defaultBuildTask}" + "preLaunchTask": "stgit: debug" } ] } diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..f0ef899 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "chat.tools.terminal.autoApprove": { + "./node_modules/.bin/eslint": true, + "git check-ignore": true + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 5deb2bc..1f49469 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -4,9 +4,23 @@ "version": "2.0.0", "tasks": [ { + "label": "stgit: compile", + "type": "npm", + "script": "compile", + "problemMatcher": "$tsc" + }, + { + "label": "stgit: watch", "type": "npm", "script": "watch", - "problemMatcher": "$tsc-watch", + "problemMatcher": { + "base": "$tsc-watch", + "background": { + "activeOnStart": true, + "beginsPattern": "^\\[0\\].*(Starting compilation in watch mode|File change detected\\. Starting incremental compilation)", + "endsPattern": "^\\[0\\].*Found [0-9]+ errors?\\. Watching for file changes\\." + } + }, "isBackground": true, "presentation": { "reveal": "never" @@ -15,6 +29,12 @@ "kind": "build", "isDefault": true } + }, + { + "label": "stgit: debug", + "dependsOrder": "sequence", + "dependsOn": ["stgit: compile", "stgit: watch"], + "problemMatcher": [] } ] } diff --git a/README.md b/README.md index c6b64ac..71463ad 100644 --- a/README.md +++ b/README.md @@ -12,14 +12,14 @@ Install [StGit Revived](https://marketplace.visualstudio.com/items?itemName=cede ## Features -The StGit patch series is displayed in a window. StGit and Git operations, bound to various keyboard shortcuts, allow the series to be reworked as desired. +The StGit patch series is displayed as a table in a webview. Status symbols distinguish applied and popped patches as well as modified, added, deleted, and conflicted files. A loading indicator appears while StGit commands or status reads are running. StGit and Git operations are available through the existing keyboard shortcuts when the webview is focused. + +Use the arrow keys to select patches and files, Enter to expand a patch or open a file, and `m`/`u` to mark or unmark patches. Commit messages open in the webview; use `Ctrl-C Ctrl-C` or the Commit button to submit. Press Escape to cancel; you are asked to confirm only if the message has unsaved changes. The extension also provides an Emacs-like diff mode, which among other things allows individual hunks to be applied, staged or split into smaller hunks. While the StGit window is open, it follows the repository of the active file, including files in submodules. -![Example](images/example.png) - > [!TIP] > > To enter StGit, press `Ctrl-C Ctrl-I` or run the "`StGit: Open...`" @@ -40,9 +40,13 @@ This extension requires StGit to be installed (the executable is called `stg`). Git history entries use the effective `format.pretty` Git configuration. Custom `format:` and `tformat:` values and named `pretty.` aliases are supported. Multiline output is flattened to one line, and terminal colors are omitted. If no reusable one-line format is configured, the extension uses `%h %s`. +## Development + +Starting any Extension Development Host debug configuration builds both the extension and the React webview before starting the background watch task. Subsequent webview JS/CSS rebuilds automatically reload the open StGit panel in the development host, preserving its selection, draft, and scroll position. For extension-host code changes, reload the Extension Development Host window to load the newly compiled code. Run `npm run compile` for a one-off build or `npm run watch` outside debugging; restart an older watch process after changing the build scripts. `npm run test:unit` includes a DOM test of the compiled webview; `npm test` runs the VS Code extension-host suite when its test executable is available. + ## Known Issues -The StGit extension can be used together with the popular Vim mode for VsCode, but there are currently a few key mapping conflicts for the StGit editor. +Vim extensions may intercept some StGit keyboard shortcuts in the webview. Closing the StGit tab while editing a commit message discards the draft; cancel the editor before closing to get a confirmation. ## Release Notes diff --git a/package-lock.json b/package-lock.json index ba45f62..242aa42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,19 +10,28 @@ "license": "BSD-2-Clause", "devDependencies": { "@types/glob": "^8.0.3", + "@types/jsdom": "^30.0.0", "@types/mocha": "^9.1.1", "@types/node": "16.x", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", "@types/vscode": "^1.91.0", "@typescript-eslint/eslint-plugin": "^5.59.0", "@typescript-eslint/parser": "^5.59.0", "@vscode/test-electron": "^2.1.5", "@vscode/vsce": "^3.6.0", + "concurrently": "^10.0.6", + "esbuild": "^0.28.2", "eslint": "^8.41.0", "eslint-config-prettier": "^9.1.2", "glob": "^8.0.3", "js-yaml": "^4.1.0", + "jsdom": "^30.1.3", + "lucide-react": "^1.61.0", "mocha": "^10.0.0", "prettier": "^3.9.9", + "react": "^19.3.1", + "react-dom": "^19.3.1", "typescript": "^5.0.4", "vscode-tmgrammar-test": "^0.1.3" }, @@ -30,6 +39,59 @@ "vscode": "^1.91.0" } }, + "node_modules/@asamuzakjp/css-color": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-7.1.7.tgz", + "integrity": "sha512-Q7ioeear07HwixdIitIn9KS1LZi97CEDFCSjPNm9v+y8KNbsu9q4Lrd4zUQW4faED+E7qxvfeVnbNRW46wFKuw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@csstools/css-calc": "^3.4.3", + "@csstools/css-color-parser": "^4.2.6", + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/@asamuzakjp/dom-selector": { + "version": "10.0.4", + "resolved": "https://registry.npmjs.org/@asamuzakjp/dom-selector/-/dom-selector-10.0.4.tgz", + "integrity": "sha512-A6f1nKy99I6tyoK82U6kBHvQQZmdHmTmPzJYPY/0eaOW0r8/qPmEOwjGHs+hL/vCgOwQTupu4LT1XtXNUuDruA==", + "dev": true, + "license": "MIT", + "dependencies": { + "bidi-js": "^1.1.0", + "css-tree": "^3.2.1", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/@asamuzakjp/dom-selector/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, "node_modules/@azu/format-text": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/@azu/format-text/-/format-text-1.0.2.tgz", @@ -161,83 +223,678 @@ "tslib": "^2.2.0" }, "engines": { - "node": ">=20.0.0" + "node": ">=20.0.0" + } + }, + "node_modules/@azure/logger": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.3.0.tgz", + "integrity": "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typespec/ts-http-runtime": "^0.3.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@azure/msal-browser": { + "version": "5.10.1", + "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-5.10.1.tgz", + "integrity": "sha512-hTbvOi9Ko2Jvn+G/fSmjzHf9WbNcf/o3epMtbeGx/pMwMrVAbi6OgCJVeCfsAb8IybSRpaCSc4EDRlYAhgngUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/msal-common": "16.6.1" + }, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-common": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.6.1.tgz", + "integrity": "sha512-VxKdEtUwDuLD0F1hOQP7kye0YadZxFJfv37Em440geEf/w9uggKnHpRrqwZJOdxmPUOdhZ9kyRtKuAJW8wUcRg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@azure/msal-node": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-5.2.1.tgz", + "integrity": "sha512-tmQiQ2HvtzaeLqYGy3BemiPOSGPY4wCy1IW5zDWITKSs/s35WEd7Zij/hCxvUdAOzj6U3qnyaGbYXY91ortFEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@azure/msal-common": "16.6.1", + "jsonwebtoken": "^9.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", + "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.28.5", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.28.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", + "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bramus/specificity": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/@bramus/specificity/-/specificity-2.4.3.tgz", + "integrity": "sha512-0GEz8qJWokkUVYQYRukmkSHIFNoBH8QTreeHrAFbvz1XFYc3Y+puhMs8PQ5x8GNugiC2l5jvDBXKLbBIByeSBw==", + "dev": true, + "license": "MIT", + "dependencies": { + "css-tree": "^3.2.1" + }, + "bin": { + "specificity": "bin/cli.js" + } + }, + "node_modules/@csstools/color-helpers": { + "version": "6.1.2", + "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-6.1.2.tgz", + "integrity": "sha512-grhRy3OKmniaAEKXMjua5z/EODX0MSqBGjunw8+j/3HQjOnahs2AGhvEOIYVUWcU6ScApbhLhVrQTX8XqrMrow==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@csstools/css-calc": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-3.4.3.tgz", + "integrity": "sha512-iex20d8CHVkyvg6B7UKV7uHnI2Bqo9g+EFfT9E0y+GvTvhZ/DwONJ+9aKb1dlqm0ZiGsL5RXjp0fCoJYnkeDjA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-color-parser": { + "version": "4.2.6", + "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-4.2.6.tgz", + "integrity": "sha512-iiPQ3iRWwnJkeEn6RIu6SJPr7hYrLz6XZ9s/QZl+2/LI5KQVjpl2fdmDSZKuD4xP6GMmMPgHFFXg6k1Wkz0Trg==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "dependencies": { + "@csstools/color-helpers": "^6.1.2", + "@csstools/css-calc": "^3.4.3" + }, + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-parser-algorithms": "^4.0.2", + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-parser-algorithms": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-4.0.2.tgz", + "integrity": "sha512-40cSKyMvK+tq4qz6Awrlye2WGuOKt3FwPgtGg6KTfbHOWNw+Rk1rzbAtZnZ6IBhsY491HLRnDXwoyBAijmmILA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + }, + "peerDependencies": { + "@csstools/css-tokenizer": "^4.0.2" + } + }, + "node_modules/@csstools/css-syntax-patches-for-csstree": { + "version": "1.1.15", + "resolved": "https://registry.npmjs.org/@csstools/css-syntax-patches-for-csstree/-/css-syntax-patches-for-csstree-1.1.15.tgz", + "integrity": "sha512-J0u7HkVl2nzSlhsiTOp4AmwcUQ3D+mGEEKfBy/7To5/y7F2OHwyLrXfrhR0SMgr4p5Lo+eaMVSeai24zUcBIxA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT-0", + "peerDependencies": { + "css-tree": "^3.2.1" + }, + "peerDependenciesMeta": { + "css-tree": { + "optional": true + } + } + }, + "node_modules/@csstools/css-tokenizer": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-4.0.2.tgz", + "integrity": "sha512-OoKoR0f76dCY666JlcbhmVTs2drYj1GUXZTYTcbUgJjh9Nv41aFfZ21bPQTERm5+L5cBDo466NltB2lplS5GBw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/csstools" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/csstools" + } + ], + "license": "MIT", + "engines": { + "node": ">=20.19.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.28.2.tgz", + "integrity": "sha512-XExcO+dvLKvVtNTibSTBej1NCAbaGhWn9Ww1ZPx80qsahhPFe/8jgWP0IchNe0F3HwkU7n8ejhH8bjonqht8mQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.28.2.tgz", + "integrity": "sha512-kXXoiPVVGQcnIYGOeaovwOURpniDBpSq4A03qkQ+BMQqtGG6HYap3xne9C1O1yo4TR3qxlCX5IqqmX6fFo2Lqg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.28.2.tgz", + "integrity": "sha512-5YfKeeI8qWfBZIX+u2xZC3Zlb3Os/gLS2sbEKM+I4ZOcsWmHS2WLysCcQZDAFRslDUU5Oiq44gf6PYN1vGwG5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.28.2.tgz", + "integrity": "sha512-O387ite7SzUyCcy3JQX4P4bLtEA7bLLkx+esve5JHnyYfNTxcVpXZo9jhdB0lTKN44gztELTdU7nS8Nr16Fs1Q==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.28.2.tgz", + "integrity": "sha512-n4KqkOQrraxHJcgjM1RvwbigfQKIKJVpM7xp+KsxiyUSrRdIXnt73VhrPAx0fV44hgfmIVKjxMN9J1t5jySVkw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.28.2.tgz", + "integrity": "sha512-uq6suIWYP37qzGddBKPw5QEQPi6HiLGsO7UmkpfyaYNQ3D+rN6w6WfwH+nuqcGXWvawGwxOEroO4YGnFh95azw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.28.2.tgz", + "integrity": "sha512-n+I0BTSRIoy+d6RPKnEVwql5UwBJolytvY4mAOIEJorKlqgPII8ix6slVVrfZ5Tnj7glIZvloylbB/EJPMWEXw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.28.2.tgz", + "integrity": "sha512-78XJTJkvPs0kz2w61301PJjXl4g7q3JqiYMZ/M/yVI73EHBrCRTgkhu9oqG7vPqq+a/yadEW8aD+agKlk5xrmg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.28.2.tgz", + "integrity": "sha512-XlDnu2q5yoqems+xay6wSAcg9DDD7K9RLKZEBOMZm3ckNpJBvOX20tSfby8KfrrhINDyv9V2YVZKY/SpoGJI8w==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.28.2.tgz", + "integrity": "sha512-pW4AC0P3it8c7do9MVM4p51FzHzdM/TZrerurgRcHJ2WTa1VQ1CIq18xncfpBJw4ojkiZZrKW2yIBWBP92j6Ug==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.28.2.tgz", + "integrity": "sha512-CYbnj78HsIeA+DhgUKgFCfvNsTHFhMMrinUrMZpDXJXKN8T3XViTZ/+wtHeVxEWY8ewSzTFN+nRmSwO2tZaLUQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.28.2.tgz", + "integrity": "sha512-buwkd8nsph4R+ajRvw0qM5Hja/TXQow3ptzWO2EbG/cqcIkHloRrdlBtQlshyYGTNFvfkfJ5tpPLVkY4DtsPfQ==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.28.2.tgz", + "integrity": "sha512-ZVykbDyk7519VwiNb9Lcj9m8XM6v5V9uKPvrEMkkEedVewf+0itkhahp4HDpgERXhwLRpWFypsGbG/J8s0QjJA==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.28.2.tgz", + "integrity": "sha512-CAXl+Dtd9UUuJd8pKKdwh6MLm3MUMiqMPmhZ3tTSXPqfyQ3vDl6R5hZdZ/kYojK4ofXtdfSv1tFq8XzWx3heNQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.28.2.tgz", + "integrity": "sha512-GeXCej4IQtU1B+QlDV8W/RRvbzI3O/Stss+/bCXv4lZls5WGRtu2a+3JkA3i4qIUlMXpcHebWpF8AkJhATowuA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.28.2.tgz", + "integrity": "sha512-3H1weTYZPxt/WOhByszQZybS9w5lKzUn1FDMsgEChbHWQwHYQQRfBxgCcZvPhjHfKyJjIievvMmEUawJrdY9Dg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.28.2.tgz", + "integrity": "sha512-4xTZr1FUmSoQW4XIWmit3tzQrUTZM+N3P0XV8xROKYF50XfI7xeO90+1bZvNwxIufQ9hDQVRJH5YhgPVF8A/HQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.28.2.tgz", + "integrity": "sha512-sSATRjPeDBg3pdgHoQfoYBob11Kk1FGa9lui5RIHZCoCkJa9QKlvl3/vKz2usCmYYjs7ymJR/2Nnsqe+Hjt5nw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.28.2.tgz", + "integrity": "sha512-lqnzCV+mM0gIADaKihiCg6ifgfU2L3h5E33rNQBN1Y4MaVGnzryzmvvf7UHxprpQdE8hpqLolJ9Rl+SkIRDpyw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.28.2.tgz", + "integrity": "sha512-AL2qJILH7lNjrDmCQDvdxMfAUIv8KMNZOvrwAQ8i8//ntL9FflhOyMJ8OZSMBb8/AWXe3/5v5S20y3zCoZWKoQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" } }, - "node_modules/@azure/logger": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/@azure/logger/-/logger-1.3.0.tgz", - "integrity": "sha512-fCqPIfOcLE+CGqGPd66c8bZpwAji98tZ4JI9i/mlTNTlsIWslCfpg48s/ypyLxZTump5sypjrKn2/kY7q8oAbA==", + "node_modules/@esbuild/openbsd-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.28.2.tgz", + "integrity": "sha512-QtiuPytchRyC4rwUKhexJdQKvDuZ6hWloi3igqPQNUJCS1/v9EiO3UTOXR6A3FoMo4fnAKbWJdqaIwhOzh8qEw==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", - "dependencies": { - "@typespec/ts-http-runtime": "^0.3.0", - "tslib": "^2.6.2" - }, + "optional": true, + "os": [ + "openbsd" + ], "engines": { - "node": ">=20.0.0" + "node": ">=18" } }, - "node_modules/@azure/msal-browser": { - "version": "5.10.1", - "resolved": "https://registry.npmjs.org/@azure/msal-browser/-/msal-browser-5.10.1.tgz", - "integrity": "sha512-hTbvOi9Ko2Jvn+G/fSmjzHf9WbNcf/o3epMtbeGx/pMwMrVAbi6OgCJVeCfsAb8IybSRpaCSc4EDRlYAhgngUQ==", + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.28.2.tgz", + "integrity": "sha512-WkhYDmpTjLvGlScA1rwjRUmhl4k8oXR3cIbtqWmELgU/dFeHHlEllxDvdWcNJV9rbzCexB5vz8gtNewWLgCT7Q==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", - "dependencies": { - "@azure/msal-common": "16.6.1" - }, + "optional": true, + "os": [ + "openharmony" + ], "engines": { - "node": ">=0.8.0" + "node": ">=18" } }, - "node_modules/@azure/msal-common": { - "version": "16.6.1", - "resolved": "https://registry.npmjs.org/@azure/msal-common/-/msal-common-16.6.1.tgz", - "integrity": "sha512-VxKdEtUwDuLD0F1hOQP7kye0YadZxFJfv37Em440geEf/w9uggKnHpRrqwZJOdxmPUOdhZ9kyRtKuAJW8wUcRg==", + "node_modules/@esbuild/sunos-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.28.2.tgz", + "integrity": "sha512-GPMSkTOtMnv2U2F8gxe4Io6qmVs+YKyp832Etqqxr0hFngmXQ3rzwytelm3GIn7T4VviRUlf3sOgBOiTdvaf7g==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], "engines": { - "node": ">=0.8.0" + "node": ">=18" } }, - "node_modules/@azure/msal-node": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/@azure/msal-node/-/msal-node-5.2.1.tgz", - "integrity": "sha512-tmQiQ2HvtzaeLqYGy3BemiPOSGPY4wCy1IW5zDWITKSs/s35WEd7Zij/hCxvUdAOzj6U3qnyaGbYXY91ortFEQ==", + "node_modules/@esbuild/win32-arm64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.28.2.tgz", + "integrity": "sha512-PIhhEkE9uPBleRBrQEJpUn7MBnibZzbGzYWPmY3x+YoVg/95zbjB4CxPPOQ8l5tYYM4mMaCthF8/1DIfBQQyWQ==", + "cpu": [ + "arm64" + ], "dev": true, "license": "MIT", - "dependencies": { - "@azure/msal-common": "16.6.1", - "jsonwebtoken": "^9.0.0" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=20" + "node": ">=18" } }, - "node_modules/@babel/code-frame": { - "version": "7.29.0", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.0.tgz", - "integrity": "sha512-9NhCeYjq9+3uxgdtp20LSiJXJvN0FeCtNGpJxuMFZ1Kv3cWUNb6DOhJwUvcVCzKGR66cw4njwM6hrJLqgOwbcw==", + "node_modules/@esbuild/win32-ia32": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.28.2.tgz", + "integrity": "sha512-YmJbfTlvU7Sdn9BB+4PRES4oB6pxgS37MAONj+hBr/cpXS1aBPKXxNnDbu+QCWPj0o9dgyxeq79g6c5P8KeuYA==", + "cpu": [ + "ia32" + ], "dev": true, "license": "MIT", - "dependencies": { - "@babel/helper-validator-identifier": "^7.28.5", - "js-tokens": "^4.0.0", - "picocolors": "^1.1.1" - }, + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.9.0" + "node": ">=18" } }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.28.5", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.28.5.tgz", - "integrity": "sha512-qSs4ifwzKJSV39ucNjsvc6WVHs6b7S03sOh2OcHF9UHfVPqWWALUsNUVzhSBiItjRZoLHx7nIarVjqKVusUZ1Q==", + "node_modules/@esbuild/win32-x64": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.28.2.tgz", + "integrity": "sha512-5ebpxr3nWMzrL/rnUI755Jkuee0bHL/Gq0WTF9lvcpv73wAp5eu8MfBUgWK9bhWvZjj7yX8etf/8tI8Ney695g==", + "cpu": [ + "x64" + ], "dev": true, "license": "MIT", + "optional": true, + "os": [ + "win32" + ], "engines": { - "node": ">=6.9.0" + "node": ">=18" } }, "node_modules/@eslint-community/eslint-utils": { @@ -327,6 +984,24 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@exodus/bytes": { + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/@exodus/bytes/-/bytes-1.16.0.tgz", + "integrity": "sha512-IcpW84uEn3N7ETtNZMlxKhfl6Pec8rUNGOTBtWbK1FKhJxIFAptZyVrvVRVBimAJxJCgc3PxepxkdWWG4DVzfA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=24.0.0" + }, + "peerDependencies": { + "@noble/hashes": "^1.8.0 || ^2.0.0" + }, + "peerDependenciesMeta": { + "@noble/hashes": { + "optional": true + } + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -695,6 +1370,45 @@ "@types/node": "*" } }, + "node_modules/@types/jsdom": { + "version": "30.0.0", + "resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-30.0.0.tgz", + "integrity": "sha512-uAHGxujGE0cDaKGdK28zgDotFtNA7MKq5DXl8LrfdxdCI8VHcg15oJz+amHTChPNI5JpgEPQWc2xFdrw3em/nQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/node": "*", + "@types/tough-cookie": "*", + "parse5": "^8.0.0", + "undici-types": "^8.9.0" + } + }, + "node_modules/@types/jsdom/node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/@types/jsdom/node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, "node_modules/@types/json-schema": { "version": "7.0.15", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", @@ -730,6 +1444,26 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/react": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.3.0.tgz", + "integrity": "sha512-N0rFCuH9YoxG9/m61l9MfpJKfmLOVU0em7ipIz6TRgSSkvReLB9vL85GB+yr8Bs5leqpvg96JSwF4ZS1s4viQg==", + "dev": true, + "license": "MIT", + "dependencies": { + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "19.3.0", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-19.3.0.tgz", + "integrity": "sha512-ZI7bU42mZXXKHn/qNLEw2IrbiINU7X5+vfgdixBHkCNpYWXjKgfQ/P+uyGb5CjOLB9UcnTeg3rylQtV2hym44Q==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^19.3.0" + } + }, "node_modules/@types/sarif": { "version": "2.1.7", "resolved": "https://registry.npmjs.org/@types/sarif/-/sarif-2.1.7.tgz", @@ -744,6 +1478,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/vscode": { "version": "1.120.0", "resolved": "https://registry.npmjs.org/@types/vscode/-/vscode-1.120.0.tgz", @@ -1435,6 +2176,16 @@ "license": "MIT", "optional": true }, + "node_modules/bidi-js": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/bidi-js/-/bidi-js-1.1.0.tgz", + "integrity": "sha512-fX1Onk0tdVPC7obPWB5EbJ1z7NVhLq4m2xZLq2YXBkxzMXIGRpNMU88n0EPgWseKl12J7zXs7qrDxPK4sRs2fg==", + "dev": true, + "license": "MIT", + "dependencies": { + "require-from-string": "^2.0.2" + } + }, "node_modules/binary-extensions": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", @@ -1859,35 +2610,185 @@ "dev": true, "license": "MIT" }, - "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==", + "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==", + "dev": true, + "license": "MIT", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, + "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": ">=18" + } + }, + "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, + "license": "MIT" + }, + "node_modules/concurrently": { + "version": "10.0.6", + "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-10.0.6.tgz", + "integrity": "sha512-qgICXXFp2/3nAebRLmxcINKEXM1mLK3ij/y31P02VTs/KIkddIeC05n73DxOXsXMB9LFSqNU1/na3lDlOhcbIw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "5.6.2", + "rxjs": "7.8.2", + "shell-quote": "1.12.0", + "supports-color": "10.2.2", + "tree-kill": "1.2.2", + "yargs": "18.0.0" + }, + "bin": { + "conc": "dist/bin/index.js", + "concurrently": "dist/bin/index.js" + }, + "engines": { + "node": ">=22" + }, + "funding": { + "url": "https://github.com/open-cli-tools/concurrently?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/ansi-styles": { + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", + "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/chalk": { + "version": "5.6.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz", + "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.17.0 || ^14.13 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/cliui": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-9.0.1.tgz", + "integrity": "sha512-k7ndgKhwoQveBL+/1tqGJYNz097I7WOvwbmmU2AR5+magtbjPWQTS1C5vzGkBC8Ym8UWRzfKUzUUqFLypY4Q+w==", + "dev": true, + "license": "ISC", + "dependencies": { + "string-width": "^7.2.0", + "strip-ansi": "^7.1.0", + "wrap-ansi": "^9.0.0" + }, + "engines": { + "node": ">=20" + } + }, + "node_modules/concurrently/node_modules/emoji-regex": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz", + "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==", + "dev": true, + "license": "MIT" + }, + "node_modules/concurrently/node_modules/string-width": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", + "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "emoji-regex": "^10.3.0", + "get-east-asian-width": "^1.0.0", + "strip-ansi": "^7.1.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/concurrently/node_modules/supports-color": { + "version": "10.2.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-10.2.2.tgz", + "integrity": "sha512-SS+jx45GF1QjgEXQx4NJZV9ImqmO2NPz5FNsIHrsDjh2YsHnawpan7SNQ1o8NuhrbHZy9AZhIoCUiCeaW/C80g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/concurrently/node_modules/wrap-ansi": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz", + "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==", "dev": true, "license": "MIT", "dependencies": { - "delayed-stream": "~1.0.0" + "ansi-styles": "^6.2.1", + "string-width": "^7.0.0", + "strip-ansi": "^7.1.0" }, "engines": { - "node": ">= 0.8" + "node": ">=18" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, - "node_modules/commander": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", - "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", + "node_modules/concurrently/node_modules/yargs": { + "version": "18.0.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-18.0.0.tgz", + "integrity": "sha512-4UEqdc2RYGHZc7Doyqkrqiln3p9X2DZVxaGbwhn2pi7MrRagKaOcIKe8L3OxYcbhXLgLFUS3zAYuQjKBQgmuNg==", "dev": true, "license": "MIT", + "dependencies": { + "cliui": "^9.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "string-width": "^7.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^22.0.0" + }, "engines": { - "node": ">=18" + "node": "^20.19.0 || ^22.12.0 || >=23" } }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "node_modules/concurrently/node_modules/yargs-parser": { + "version": "22.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-22.0.0.tgz", + "integrity": "sha512-rwu/ClNdSMpkSrUb+d6BRsSkLUq1fmfsY6TOpYzTwvwkg1/NRG85KBy3kq++A8LKQwX6lsu+aWad+2khvuXrqw==", "dev": true, - "license": "MIT" + "license": "ISC", + "engines": { + "node": "^20.19.0 || ^22.12.0 || >=23" + } }, "node_modules/core-util-is": { "version": "1.0.3", @@ -1928,6 +2829,20 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/css-tree": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/css-tree/-/css-tree-3.2.1.tgz", + "integrity": "sha512-X7sjQzceUhu1u7Y/ylrRZFU2FS6LRiFVp6rKLPg23y3x3c3DOKAwuXGDp+PAGjh6CSnCjYeAul8pcT8bAl+lSA==", + "dev": true, + "license": "MIT", + "dependencies": { + "mdn-data": "2.27.1", + "source-map-js": "^1.2.1" + }, + "engines": { + "node": "^10 || ^12.20.0 || ^14.13.0 || >=15.0.0" + } + }, "node_modules/css-what": { "version": "6.2.2", "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz", @@ -1941,6 +2856,37 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/data-urls": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-8.0.0.tgz", + "integrity": "sha512-JQUCCK+/CAGbGGx618PlFZMXH81Jtj7t73CHv9dd/zVWvxgGT2zLFRjnKb+Ng46GIwcy+f7f88qd4duqllK+WQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.1.2" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/data-urls/node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -1972,6 +2918,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, "node_modules/decompress-response": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-6.0.0.tgz", @@ -2315,6 +3268,48 @@ "node": ">= 0.4" } }, + "node_modules/esbuild": { + "version": "0.28.2", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.28.2.tgz", + "integrity": "sha512-HKVLS8dvII+xoKW9kmqxbRKrnWEXfJJr/FZhhJmiqIB0e053QNYFqOBouTMO/k5sID4MvCiUCvv8b9M4h32wIA==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.28.2", + "@esbuild/android-arm": "0.28.2", + "@esbuild/android-arm64": "0.28.2", + "@esbuild/android-x64": "0.28.2", + "@esbuild/darwin-arm64": "0.28.2", + "@esbuild/darwin-x64": "0.28.2", + "@esbuild/freebsd-arm64": "0.28.2", + "@esbuild/freebsd-x64": "0.28.2", + "@esbuild/linux-arm": "0.28.2", + "@esbuild/linux-arm64": "0.28.2", + "@esbuild/linux-ia32": "0.28.2", + "@esbuild/linux-loong64": "0.28.2", + "@esbuild/linux-mips64el": "0.28.2", + "@esbuild/linux-ppc64": "0.28.2", + "@esbuild/linux-riscv64": "0.28.2", + "@esbuild/linux-s390x": "0.28.2", + "@esbuild/linux-x64": "0.28.2", + "@esbuild/netbsd-arm64": "0.28.2", + "@esbuild/netbsd-x64": "0.28.2", + "@esbuild/openbsd-arm64": "0.28.2", + "@esbuild/openbsd-x64": "0.28.2", + "@esbuild/openharmony-arm64": "0.28.2", + "@esbuild/sunos-x64": "0.28.2", + "@esbuild/win32-arm64": "0.28.2", + "@esbuild/win32-ia32": "0.28.2", + "@esbuild/win32-x64": "0.28.2" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -3112,6 +4107,19 @@ "node": ">=10" } }, + "node_modules/html-encoding-sniffer": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-7.0.0.tgz", + "integrity": "sha512-UikN5yr7xsCDAq87Or5or0PAlD3HJJOKVzM05az588WnpDJ4Ux7a2A53Qi6gofGg2/EtvF/H4hCi/TXfCW4Y6w==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.15.1" + }, + "engines": { + "node": "^22.13.0 || >=24.0.0" + } + }, "node_modules/htmlparser2": { "version": "10.1.0", "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz", @@ -3416,6 +4424,13 @@ "node": ">=8" } }, + "node_modules/is-potential-custom-element-name": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", + "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==", + "dev": true, + "license": "MIT" + }, "node_modules/is-unicode-supported": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", @@ -3513,6 +4528,102 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsdom": { + "version": "30.1.3", + "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-30.1.3.tgz", + "integrity": "sha512-hQMUPvRgN7KxsfIytDQji7bimuJeRQa6Qo5+iuiZQk5CafeRxLIA10/cG5YCBFNpD9RO3oqIiN4CO1Y44kxqXg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@asamuzakjp/css-color": "^7.1.3", + "@asamuzakjp/dom-selector": "^10.0.3", + "@bramus/specificity": "^2.4.2", + "@csstools/css-syntax-patches-for-csstree": "^1.1.15", + "@exodus/bytes": "^1.16.0", + "css-tree": "^3.2.1", + "data-urls": "^8.0.0", + "decimal.js": "^10.6.0", + "html-encoding-sniffer": "^7.0.0", + "is-potential-custom-element-name": "^1.0.1", + "lru-cache": "^11.5.3", + "parse5": "^8.0.1", + "saxes": "^6.0.0", + "tough-cookie": "^6.0.2", + "undici": "^8.12.1", + "w3c-xmlserializer": "^6.0.0", + "webidl-conversions": "^8.0.1", + "whatwg-mimetype": "^5.0.0", + "whatwg-url": "^17.2.0", + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + }, + "peerDependencies": { + "canvas": "^3.2.3" + }, + "peerDependenciesMeta": { + "canvas": { + "optional": true + } + } + }, + "node_modules/jsdom/node_modules/entities": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/entities/-/entities-8.1.0.tgz", + "integrity": "sha512-kxL7msIffSuh9aaFAMD7rxAIuTRMAHMeBtgHW2yUdWw732ZNh4MehkF2gdjvtdmikkaIP9bFDDJOPlsvm7avrA==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20.19.0" + }, + "funding": { + "url": "https://github.com/fb55/entities?sponsor=1" + } + }, + "node_modules/jsdom/node_modules/lru-cache": { + "version": "11.5.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.5.3.tgz", + "integrity": "sha512-U4N8FgzmWxc8k1VH8Kr6lQg18U7Fjvby6wXHVRX/ZZ7IwWbRMgrRbP0Wrb5q5NVinryp4SQampHKdvtecItxUg==", + "dev": true, + "license": "BlueOak-1.0.0", + "engines": { + "node": "20 || >=22" + } + }, + "node_modules/jsdom/node_modules/parse5": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-8.0.1.tgz", + "integrity": "sha512-z1e/HMG90obSGeidlli3hj7cbocou0/wa5HacvI3ASx34PecNjNQeaHNo5WIZpWofN9kgkqV1q5YvXe3F0FoPw==", + "dev": true, + "license": "MIT", + "dependencies": { + "entities": "^8.0.0" + }, + "funding": { + "url": "https://github.com/inikulin/parse5?sponsor=1" + } + }, + "node_modules/jsdom/node_modules/undici": { + "version": "8.12.3", + "resolved": "https://registry.npmjs.org/undici/-/undici-8.12.3.tgz", + "integrity": "sha512-+fdndUTwBP86cVjihTp21hZHo7d6oj1c/47XPA3lL8mM0XHs+C4EkcjmgRsFnFk2f/UONGDy9ItBItmXsLOQHw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=22.19.0" + } + }, + "node_modules/jsdom/node_modules/whatwg-mimetype": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-5.0.0.tgz", + "integrity": "sha512-sXcNcHOC51uPGF0P/D4NVtrkjSU2fNsm9iog4ZvZJsL3rjoDAzXZhkm2MWt1y+PUdggKAYVoMAIYcs78wJ51Cw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=20" + } + }, "node_modules/json-buffer": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz", @@ -3809,6 +4920,22 @@ "node": ">=10" } }, + "node_modules/lucide-react": { + "version": "1.61.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-1.61.0.tgz", + "integrity": "sha512-v2SQPPPNjnr+BlhL9Spuzmo5yR+hLkftfuE4E3jaxdNPgSH0hJKPcLJBP7yAta87jQNPsSERS59PJjCJ/CorBA==", + "dev": true, + "license": "ISC", + "peerDependencies": { + "@types/react": "*", + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + }, + "peerDependenciesMeta": { + "@types/react": { + "optional": true + } + } + }, "node_modules/markdown-it": { "version": "14.1.1", "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.1.tgz", @@ -3837,6 +4964,13 @@ "node": ">= 0.4" } }, + "node_modules/mdn-data": { + "version": "2.27.1", + "resolved": "https://registry.npmjs.org/mdn-data/-/mdn-data-2.27.1.tgz", + "integrity": "sha512-9Yubnt3e8A0OKwxYSXyhLymGW4sCufcLG6VdiDdUGVkPhpqLxlvP5vl1983gQjJl3tqbrM731mjaZaP68AgosQ==", + "dev": true, + "license": "CC0-1.0" + }, "node_modules/mdurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", @@ -4821,6 +5955,29 @@ "node": ">=0.10.0" } }, + "node_modules/react": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-19.3.1.tgz", + "integrity": "sha512-QNhWdt7nrgVWWQG58QuGsAR3jv3Hbe4mb4vz7w2csnHavciZJgda1CPNaldF6eVxv90ud3jUXpKlHL69gO38yw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.3.1.tgz", + "integrity": "sha512-Y0bARz53lhEC1NMCASs0/j+faB/zqt3R8hpvg1e8+61ZVJ4UL0UdC4cBbXfZMcIuhrfgeILTLe+ZeBCavQPtKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "scheduler": "^0.28.0" + }, + "peerDependencies": { + "react": "^19.3.1" + } + }, "node_modules/read": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", @@ -5037,6 +6194,16 @@ "queue-microtask": "^1.2.2" } }, + "node_modules/rxjs": { + "version": "7.8.2", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.2.tgz", + "integrity": "sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "tslib": "^2.1.0" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -5075,6 +6242,26 @@ "node": ">=11.0.0" } }, + "node_modules/saxes": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz", + "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==", + "dev": true, + "license": "ISC", + "dependencies": { + "xmlchars": "^2.2.0" + }, + "engines": { + "node": ">=v12.22.7" + } + }, + "node_modules/scheduler": { + "version": "0.28.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.28.0.tgz", + "integrity": "sha512-juorfCmIkIw8tT+p5BXSm6PJjQF/ycEYmKyzURCIt/RaZIhL+PulbQ9Yu2z1HdOJDdqDTlxA1+xKBmHXJsczAw==", + "dev": true, + "license": "MIT" + }, "node_modules/secretlint": { "version": "10.2.2", "resolved": "https://registry.npmjs.org/secretlint/-/secretlint-10.2.2.tgz", @@ -5220,6 +6407,19 @@ "node": ">=8" } }, + "node_modules/shell-quote": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.12.0.tgz", + "integrity": "sha512-PcByqNyT/38F2kDNi006HAMRJaULuBzq/FOsw3qdZvX/GA9W/jamDaRskgHjubHiftXK5sIFxLNkvrXUwcof6Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/side-channel": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", @@ -5386,6 +6586,16 @@ "url": "https://github.com/chalk/slice-ansi?sponsor=1" } }, + "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", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/spdx-correct": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.2.0.tgz", @@ -5687,6 +6897,26 @@ "url": "https://bevry.me/fund" } }, + "node_modules/tldts": { + "version": "7.4.19", + "resolved": "https://registry.npmjs.org/tldts/-/tldts-7.4.19.tgz", + "integrity": "sha512-48dH6aSpQnpbzDUc4vIQZ1VjB8tkK+e8c1yx05/SZK+rkssgjEOlxDd/yU8/a4vGYQ9vRgJr9dwMq9TJ0b3X2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "tldts-core": "^7.4.19" + }, + "bin": { + "tldts": "bin/cli.js" + } + }, + "node_modules/tldts-core": { + "version": "7.4.19", + "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-7.4.19.tgz", + "integrity": "sha512-goNXV6Ho9TIOfpJZanTd6CKG5DyYgYAL+k+22T0SLh8l6+KHIfBUPFuePuSZv05UttIaaLmI9tb7TmGIdK5AkQ==", + "dev": true, + "license": "MIT" + }, "node_modules/tmp": { "version": "0.2.5", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz", @@ -5710,6 +6940,42 @@ "node": ">=8.0" } }, + "node_modules/tough-cookie": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-6.0.2.tgz", + "integrity": "sha512-exgYmnmL/sJpR3upZfXG5PoatXQii55xAiXGXzY+sROLZ/Y+SLcp9PgJNI9Vz37HpQ74WvDcLT8eqm+kV3FzrA==", + "dev": true, + "license": "BSD-3-Clause", + "dependencies": { + "tldts": "^7.0.5" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/tr46": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-7.0.0.tgz", + "integrity": "sha512-BcDSDW+SIGWVOns1Zm6Yg91q9AEj7eaID0QDY9oIqJD1A8dscNwMcl9Sms2DeuWCNov1X0/oXanHGYQBSLwZsg==", + "dev": true, + "license": "MIT", + "dependencies": { + "punycode": "^2.3.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, + "node_modules/tree-kill": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz", + "integrity": "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==", + "dev": true, + "license": "MIT", + "bin": { + "tree-kill": "cli.js" + } + }, "node_modules/tslib": { "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", @@ -5840,6 +7106,13 @@ "node": ">=20.18.1" } }, + "node_modules/undici-types": { + "version": "8.12.3", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.12.3.tgz", + "integrity": "sha512-EXE4ydL3S76dFb27UFjNVZHTyv/TLdATj/KUe29ptdcg6qXL48J2tZ3126E5kICj5jn781OR+XlVH1N6Mz8jbA==", + "dev": true, + "license": "MIT" + }, "node_modules/unicorn-magic": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", @@ -6065,6 +7338,29 @@ "dev": true, "license": "MIT" }, + "node_modules/w3c-xmlserializer": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-6.0.0.tgz", + "integrity": "sha512-4Nsy8K5Tr6SPDH9jhKJOHf7ChDrc1zufZTVSF7x72hwuEXBqxqk9G6cK+K2NRUtB3iELRJqjXb4JPDMBjMTl2Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "xml-name-validator": "^5.0.0" + }, + "engines": { + "node": "^22.22.2 || ^24.15.0 || >=26.0.0" + } + }, + "node_modules/webidl-conversions": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-8.0.1.tgz", + "integrity": "sha512-BMhLD/Sw+GbJC21C/UgyaZX41nPt8bUTg+jWyDeg7e7YN4xOM05YPSIXceACnXVtqyEw/LMClUQMtMZ+PGGpqQ==", + "dev": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=20" + } + }, "node_modules/whatwg-encoding": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz", @@ -6089,6 +7385,21 @@ "node": ">=18" } }, + "node_modules/whatwg-url": { + "version": "17.3.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-17.3.0.tgz", + "integrity": "sha512-KwOAJrpf+GTgBvcBQJcP38sMF0DsQKdwtG+TxM2pW44P6E5k0hDbWrDmyuJDIF0Uef0aQq0ZoJs+5oI+k8ddhg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@exodus/bytes": "^1.16.0", + "tr46": "^7.0.0", + "webidl-conversions": "^8.0.1" + }, + "engines": { + "node": "^22.14.0 || >=24.0.0" + } + }, "node_modules/which": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", @@ -6186,6 +7497,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/xml-name-validator": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz", + "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=18" + } + }, "node_modules/xml2js": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.5.0.tgz", @@ -6210,6 +7531,13 @@ "node": ">=4.0" } }, + "node_modules/xmlchars": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz", + "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==", + "dev": true, + "license": "MIT" + }, "node_modules/y18n": { "version": "5.0.8", "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", diff --git a/package.json b/package.json index 304fdb3..e7df470 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,6 @@ "publisher": "cedernaes", "icon": "images/icon.png", "contributes": { - "configurationDefaults": { - "[stgit-buffer]": { - "editor.folding": false, - "editor.guides.indentation": false - } - }, "configuration": { "title": "StGit", "properties": { @@ -103,6 +97,16 @@ "category": "StGit", "title": "Update" }, + { + "command": "stgit.submitComment", + "category": "StGit", + "title": "Submit Commit Message" + }, + { + "command": "stgit.initializeBranch", + "category": "StGit", + "title": "Initialize Branch" + }, { "command": "stgit.open", "category": "StGit", @@ -379,207 +383,202 @@ { "key": "r", "command": "stgit.refresh", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl-u r", "command": "stgit.refreshSpecific", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "g", "command": "stgit.reload", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl-u g", "command": "stgit.repair", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+g", "command": "stgit.gotoPatch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+p", "command": "stgit.pushOrPopPatches", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+.", "command": "stgit.pushNextPatch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+,", "command": "stgit.popCurrentPatch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+h", "command": "stgit.setHistorySize", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+m", "command": "stgit.movePatchesTo", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c shift+b", "command": "stgit.createBranch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+b", "command": "stgit.switchBranch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "f", "command": "stgit.highlightFile", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+f", "command": "stgit.cancelHighlighting", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "u", "command": "stgit.unmarkPatch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "m", "command": "stgit.markPatch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "i", "command": "stgit.toggleChanges", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+u", "command": "stgit.revertChanges", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c ctrl+b", "command": "stgit.rebase", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c f", "command": "stgit.gitFetch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c p", "command": "stgit.gitPush", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c r", "command": "stgit.selectRemote", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c u", "command": "stgit.selectUpstreamBranch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+u p", "command": "stgit.gitForcePush", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+shift+-", "command": "stgit.undo", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+u ctrl+shift+-", "command": "stgit.hardUndo", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c ctrl+shift+-", "command": "stgit.redo", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+n", "command": "stgit.newPatch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "c", "command": "stgit.createPatch", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl-c ctrl-c", "command": "stgit.commitOrUncommitPatches", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "h", "command": "stgit.help", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" - }, - { - "key": "enter", - "command": "stgit.toggleExpand", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "-", "command": "stgit.navigateToParent", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "t", "command": "stgit.toggleShowingUnknown", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+R", "command": "stgit.resolveConflict", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "e", "command": "stgit.editCommitMessage", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+s", "command": "stgit.squashPatches", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+d", "command": "stgit.deletePatches", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "shift+=", "command": "stgit.openDiffEditor", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "=", "command": "stgit.showDiff", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "alt-=", "command": "stgit.openDiff", - "when": "resourceScheme == stgit && editorTextFocus && !commentEditorFocused" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "ctrl+c ctrl+i", @@ -588,18 +587,13 @@ }, { "key": "ctrl+c ctrl+c", - "command": "editor.action.submitComment", - "when": "resourceScheme == stgit && commentEditorFocused" + "command": "stgit.submitComment", + "when": "activeWebviewPanelId == stgit && stgitEditing && !inQuickOpen && !terminalFocus" }, { "key": "escape", "command": "stgit.cancel", - "when": "resourceScheme == stgit" - }, - { - "key": "escape", - "command": "stgit.cancelEmptyComment", - "when": "resourceScheme == stgit && commentEditorFocused && commentIsEmpty" + "when": "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus" }, { "key": "h", @@ -655,12 +649,14 @@ }, "scripts": { "vscode:prepublish": "npm run compile", - "compile": "tsc -p ./", + "compile": "tsc -p ./ && npm run compile:webview", + "compile:webview": "tsc --noEmit -p tsconfig.webview.json && esbuild src/webview/index.tsx --bundle --platform=browser --format=iife --jsx=automatic --minify --target=es2020 --outdir=out/webview", "format": "prettier --write .", "format:check": "prettier --check .", - "watch": "tsc -watch -p ./", + "watch": "concurrently -k \"tsc --watch -p ./\" \"tsc --noEmit --watch -p tsconfig.webview.json\" \"npm run watch:webview\"", + "watch:webview": "esbuild src/webview/index.tsx --bundle --platform=browser --format=iife --jsx=automatic --target=es2020 --outdir=out/webview --watch", "pretest": "npm run compile && npm run lint && npm run test:grammar", - "lint": "eslint src --ext ts", + "lint": "eslint src --ext ts,tsx", "test": "node ./out/test/runTest.js", "test:unit": "npm run compile && mocha --ui tdd \"out/test/unit/**/*.test.js\" && npm run test:grammar", "test:grammar": "vscode-tmgrammar-test 'src/test/syntax/*.test.stgit'", @@ -670,19 +666,28 @@ }, "devDependencies": { "@types/glob": "^8.0.3", + "@types/jsdom": "^30.0.0", "@types/mocha": "^9.1.1", "@types/node": "16.x", + "@types/react": "^19.3.0", + "@types/react-dom": "^19.3.0", "@types/vscode": "^1.91.0", "@typescript-eslint/eslint-plugin": "^5.59.0", "@typescript-eslint/parser": "^5.59.0", "@vscode/test-electron": "^2.1.5", "@vscode/vsce": "^3.6.0", + "concurrently": "^10.0.6", + "esbuild": "^0.28.2", "eslint": "^8.41.0", "eslint-config-prettier": "^9.1.2", "glob": "^8.0.3", "js-yaml": "^4.1.0", + "jsdom": "^30.1.3", + "lucide-react": "^1.61.0", "mocha": "^10.0.0", "prettier": "^3.9.9", + "react": "^19.3.1", + "react-dom": "^19.3.1", "typescript": "^5.0.4", "vscode-tmgrammar-test": "^0.1.3" } diff --git a/src/repo-reader.ts b/src/repo-reader.ts index 5da2cd4..bcfb9d8 100644 --- a/src/repo-reader.ts +++ b/src/repo-reader.ts @@ -24,33 +24,50 @@ export class RepoReader { export class LatestLoad { private version = 0; + private loading = false; + + constructor(private readonly onLoadingChange: (loading: boolean) => void = () => undefined) {} + + private setLoading(loading: boolean) { + if (this.loading !== loading) { + this.loading = loading; + this.onLoadingChange(loading); + } + } invalidate() { this.version++; + this.setLoading(false); } async run(read: () => Promise, publish: (value: T) => void, onError: (error: unknown) => void) { const version = ++this.version; - let value: T; + this.setLoading(true); try { - value = await read(); + const value = await read(); + if (version === this.version) { + publish(value); + } } catch (error) { if (version === this.version) { onError(error); } - return; - } - if (version === this.version) { - publish(value); + } finally { + if (version === this.version) { + this.setLoading(false); + } } } } export class RepoDisplayLoads { private reader: RepoReader; - private readonly series = new LatestLoad(); - private readonly changes = new LatestLoad(); + private readonly series = new LatestLoad((loading) => this.updateLoading("series", loading)); + private readonly changes = new LatestLoad((loading) => this.updateLoading("changes", loading)); private paused = false; + private disposed = false; + private seriesLoading = false; + private changesLoading = false; constructor( repo: { topLevelDir: string }, @@ -59,10 +76,24 @@ export class RepoDisplayLoads { runCommand: typeof runCommand; }, private readonly onError: (kind: "series" | "changes", error: unknown) => void, + private readonly onLoadingChange: (loading: boolean) => void = () => undefined, ) { this.reader = new RepoReader(repo, commands); } + private updateLoading(kind: "series" | "changes", loading: boolean) { + const wasLoading = this.seriesLoading || this.changesLoading; + if (kind === "series") { + this.seriesLoading = loading; + } else { + this.changesLoading = loading; + } + const isLoading = this.seriesLoading || this.changesLoading; + if (wasLoading !== isLoading) { + this.onLoadingChange(isLoading); + } + } + get currentReader() { return this.reader; } @@ -74,6 +105,9 @@ export class RepoDisplayLoads { } resume() { + if (this.disposed) { + return; + } this.paused = false; } @@ -84,7 +118,7 @@ export class RepoDisplayLoads { } loadSeries(read: (reader: RepoReader) => Promise, publish: (value: T) => void) { - if (this.paused) { + if (this.paused || this.disposed) { return Promise.resolve(); } const reader = this.reader; @@ -96,7 +130,7 @@ export class RepoDisplayLoads { } loadChanges(read: (reader: RepoReader) => Promise, publish: (value: T) => void) { - if (this.paused) { + if (this.paused || this.disposed) { return Promise.resolve(); } const reader = this.reader; @@ -108,6 +142,7 @@ export class RepoDisplayLoads { } dispose() { + this.disposed = true; this.series.invalidate(); this.changes.invalidate(); } diff --git a/src/stgit-webview.ts b/src/stgit-webview.ts new file mode 100644 index 0000000..0604298 --- /dev/null +++ b/src/stgit-webview.ts @@ -0,0 +1,43 @@ +import type * as vscode from "vscode"; + +export interface StGitViewRow { + id: string; + kind: string; + symbol: string; + description: string; + expanded: boolean; + marked: boolean; + empty: boolean; + highlighted: boolean; + files: { path: string; name: string; status: string; kind: string; highlighted: boolean }[]; +} + +export interface StGitViewState { + branch: string; + submodule: string; + notice: string; + noticeCommand: string; + rows: StGitViewRow[]; + selected: { patchId: string; path?: string }; + loading: boolean; + editing: { kind: "create" | "edit"; body: string } | null; +} + +export function stgitWebviewHtml(webview: vscode.Webview, assets: { script: vscode.Uri; style: vscode.Uri }): string { + const style = webview.asWebviewUri(assets.style); + const script = webview.asWebviewUri(assets.script); + return ` + + + + + + StGit + + + + +
+ +`; +} diff --git a/src/stgit.ts b/src/stgit.ts index a1187d6..8e353e5 100644 --- a/src/stgit.ts +++ b/src/stgit.ts @@ -3,7 +3,7 @@ import * as vscode from "vscode"; import { commands, window, workspace } from "vscode"; -import { CommentDraft, confirmCommentDiscard } from "./comment-discard"; +import { confirmCommentDiscard } from "./comment-discard"; import { getStGitConfig } from "./config"; import { openAndShowDiffDocument, refreshDiff } from "./diff-provider"; import { getUserConfirmation, info, log, showStatusMessage } from "./extension"; @@ -12,9 +12,9 @@ import { MutationGate } from "./mutation-gate"; import { RepositoryInfo } from "./repo"; import { RepoDisplayLoads, RepoReader } from "./repo-reader"; import { RepositoryFollower } from "./repository-follower"; -import { correspondingLine, nextStagedFileLine, remainingIndexFileLine } from "./stage-selection"; import { StGitStateMonitor, readRepositoryState } from "./state-monitor"; -import { run, runAndReportErrors, runCommand, sleep } from "./util"; +import { StGitViewState, stgitWebviewHtml } from "./stgit-webview"; +import { run, runAndReportErrors, runCommand } from "./util"; const RENAMEOPTS: readonly string[] = ["--find-renames"]; @@ -105,6 +105,13 @@ export class Delta { } return `${s2.padEnd(50)} ${sinfo}`; } + get statusLabel() { + const similarity = this.status === "R" ? ` ${Number(this.score)}%` : ""; + return `${Delta.STATUS_MESSAGE[this.status]}${similarity}${this.permissionDelta}${this.stageInfoString ? ` ${this.stageInfoString}` : ""}`; + } + get kind() { + return this.status; + } static fromDiff(diffOutput: string): Delta[] { const entries: Delta[] = []; for (let s = diffOutput; ;) { @@ -156,6 +163,18 @@ abstract class Patch { private readonly symbol: "+" | "-" | ">" | " " = " ", ) {} + get rowId(): string { + return `${this.kind}:${this.kind === "H" ? this.sha : this.label}`; + } + + get isExpanded(): boolean { + return this.expanded; + } + + get statusSymbol(): string { + return this.symbol; + } + async updateFromOld(old: Patch) { this.marked = old.marked; if (this.expanded !== old.expanded) { @@ -373,13 +392,23 @@ class StGitDoc { () => { this.monitor.pause(); this.displayLoads.pause(); + this.running = true; + this.notifyDirty(); }, () => { + if (this.disposed) { + return; + } this.monitor.resume(); this.displayLoads.resume(); this.reload(); + this.running = false; + this.notifyDirty(); }, ); + private running = false; + private loading = false; + private disposed = false; private unknownFilesVisible = false; private monitor: StGitStateMonitor; private displayLoads: RepoDisplayLoads; @@ -389,6 +418,7 @@ class StGitDoc { private popped: Patch[] = []; private index: Patch; private workTree: Patch; + private selectedRow: { patchId: string; path?: string } = { patchId: "I:" }; private needRepair = false; private stgMissing = false; private branchInitialized = true; @@ -412,62 +442,34 @@ class StGitDoc { // start of history private baseSha: string | null = null; - private commentThread: vscode.CommentThread | null = null; - private commentDraft: CommentDraft | null = null; - - // Patch being edited in editor + private editing: { kind: "create" | "edit"; body: string } | null = null; + private editingInitialBody = ""; private editPatch: Patch | null = null; - private mainViewColumn = window.tabGroups.all.length; - - private subscriptions: vscode.Disposable[] = []; - - private highlightRanges: vscode.Range[] = []; - private historyRanges: vscode.Range[] = []; + private get mainViewColumn(): vscode.ViewColumn { + return this.panel.viewColumn ?? vscode.ViewColumn.One; + } constructor( - public doc: vscode.TextDocument, + public panel: vscode.WebviewPanel, public repo: RepositoryInfo, public notifyDirty: () => void, - private commentController: vscode.CommentController, ) { - this.displayLoads = new RepoDisplayLoads(repo, { run, runCommand }, (kind, error) => log(`StGit ${kind} reload failed:`, String(error))); + this.displayLoads = new RepoDisplayLoads( + repo, + { run, runCommand }, + (kind, error) => log(`StGit ${kind} reload failed:`, String(error)), + (loading) => { + this.loading = loading; + this.notifyDirty(); + }, + ); this.index = new Index(this.reader); this.workTree = new WorkTree(this.reader, this.unknownFilesVisible); - this.subscriptions.push( - window.onDidChangeVisibleTextEditors((editors) => { - this.updateEditorDecorations(); - for (const e of editors) { - if (e.document === this.doc && e.viewColumn) { - this.mainViewColumn = e.viewColumn; - break; - } - } - }), - workspace.onDidChangeTextDocument((ev) => { - if (ev.document === this.doc) { - this.updateEditorDecorations(); - } - }), - workspace.onDidOpenTextDocument((document) => { - if (window.activeTextEditor?.document === this.doc) { - this.commentDraft?.trackDocument(document); - } - }), - // this event fires when an entire tab group is added or removed - window.onDidChangeTextEditorViewColumn((ev) => { - if (ev.textEditor.document === this.doc) { - this.mainViewColumn = ev.viewColumn; - } - }), - getStGitConfig().onDidChangeConfiguration(() => { - this.updateConfiguration({ reload: true }); - }), - ); + this.configListener = getStGitConfig().onDidChangeConfiguration(() => this.updateConfiguration({ reload: true })); this.updateConfiguration({ reload: false }); this.setupSubmoduleContext(repo); this.reload(); - this.openInitialEditor(); this.monitor = new StGitStateMonitor(repo, { readState: (currentRepo) => readRepositoryState(currentRepo, runCommand), watchFiles: (currentRepo, changed) => { @@ -483,10 +485,13 @@ class StGitDoc { }); this.monitor.start(); } + private configListener: vscode.Disposable; dispose() { + this.disposed = true; this.displayLoads.dispose(); this.monitor.dispose(); - this.subscriptions.forEach((s) => s.dispose()); + this.configListener.dispose(); + void commands.executeCommand("setContext", "stgitEditing", false); } private get reader() { @@ -500,6 +505,62 @@ class StGitDoc { private get patches() { return [...this.history, ...this.applied, this.index, this.workTree, ...this.popped]; } + + selectRow(patchId: string, path?: string) { + if (!this.patches.some((patch) => patch.rowId === patchId && (path === undefined || patch.deltas.some((delta) => delta.path === path)))) { + return; + } + this.selectedRow = { patchId, path }; + } + + get viewState(): StGitViewState { + if (this.pendingPath) { + const patch = this.patches.find((candidate) => candidate.isExpanded && candidate.deltas.some((delta) => delta.path === this.pendingPath)); + if (patch) { + this.selectedRow = { patchId: patch.rowId, path: this.pendingPath }; + this.pendingPath = null; + } + } + const selectedPatch = this.patches.find((patch) => patch.rowId === this.selectedRow.patchId); + const selected = selectedPatch + ? selectedPatch.isExpanded && selectedPatch.deltas.some((delta) => delta.path === this.selectedRow.path) + ? this.selectedRow + : { patchId: selectedPatch.rowId } + : { patchId: this.index.rowId }; + this.selectedRow = selected; + return { + branch: `${this.branchName ?? this.baseSha?.slice(0, 16) ?? ""}${this.upstreamString}`, + submodule: this.relativePathFromRoot, + notice: this.stgMissing + ? "StGit is not installed (stg binary missing)" + : !this.branchInitialized + ? "Initialize this branch for StGit" + : this.needRepair + ? "StGit repair needed (Ctrl+U G)" + : "", + noticeCommand: this.stgMissing ? "" : !this.branchInitialized ? "stgit.initializeBranch" : this.needRepair ? "stgit.repair" : "", + selected, + loading: this.running || this.loading, + editing: this.editing, + rows: this.patches.map((patch) => ({ + id: patch.rowId, + kind: patch.kind, + symbol: patch.statusSymbol || (patch.kind === "I" ? "◫" : patch.kind === "W" ? "◇" : "○"), + description: patch.description, + expanded: patch.isExpanded, + marked: patch.marked, + empty: patch.empty, + highlighted: this.applied.includes(patch) && patch.deltas.some((delta) => this.highlightPaths?.has(delta.path)), + files: patch.deltas.map((delta) => ({ + path: delta.path, + name: `${delta.path}${delta.destPath ? ` → ${delta.destPath}` : ""}${delta.isSubmodule ? " [submodule]" : ""}`, + status: delta.statusLabel, + kind: delta.kind, + highlighted: this.highlightPaths?.has(delta.path) ?? false, + })), + })), + }; + } private updateConfiguration(opt: { reload: boolean }) { const config = getStGitConfig(); this.unknownFilesVisible = config.showUnknownFiles; @@ -515,12 +576,17 @@ class StGitDoc { } this.parentRepoStack = stack; this.relativePathFromRoot = relativePath; + this.notifyDirty(); } switchRepository(repo: RepositoryInfo, context: Awaited>) { if (this.repo.gitDir === repo.gitDir) { return; } + if (this.editing) { + info("Finish or cancel the commit message before switching repositories."); + return; + } this.displayLoads.switchRepository(repo); this.repo = repo; RepositoryInfo.setSelectedRepo(repo); @@ -532,6 +598,8 @@ class StGitDoc { this.popped = []; this.index = new Index(this.reader); this.workTree = new WorkTree(this.reader, this.unknownFilesVisible); + this.selectedRow = { patchId: this.index.rowId }; + this.pendingPath = null; this.baseSha = null; this.branchName = null; this.remoteName = null; @@ -546,6 +614,9 @@ class StGitDoc { } reload() { + if (this.disposed) { + return; + } void this.displayLoads.loadSeries( (reader) => this.readSeries(reader), (state) => { @@ -625,6 +696,9 @@ class StGitDoc { } reloadIndexAndWorkTree() { + if (this.disposed) { + return; + } void this.displayLoads.loadChanges( async (reader) => { const index = new Index(reader); @@ -744,50 +818,19 @@ class StGitDoc { } this.reload(); } - private async openCommentEditor(line: number, body: string, context: string, editPatch: Patch | null = null) { - if (this.commentThread && !(await this.confirmDiscardComment())) { + private async openCommentEditor(body: string, kind: "create" | "edit", editPatch: Patch | null = null) { + if (this.editing && !(await this.confirmDiscardComment())) { return; } - const comment: vscode.Comment = { - contextValue: context, - body: body, - mode: vscode.CommentMode.Editing, - label: "(use 50/72 format)", - author: { - name: "Commit Message", - }, - }; - this.commentThread?.dispose(); - this.commentDraft = new CommentDraft(body); - const comments: vscode.Comment[] = [comment]; - const pos = new vscode.Position(line, 0); - const range = new vscode.Range(pos, pos); - const thread = this.commentController.createCommentThread(this.doc.uri, range, comments); - thread.label = "Enter commit message:"; - thread.contextValue = context; - thread.canReply = false; - thread.collapsibleState = vscode.CommentThreadCollapsibleState.Collapsed; - thread.state = vscode.CommentThreadState.Unresolved; - this.commentThread = thread; + this.editing = { kind, body }; + this.editingInitialBody = body; this.editPatch = editPatch; - - const delay = vscode.env.remoteName ? 400 : 200; - await sleep(delay); - await commands.executeCommand("workbench.action.expandAllComments"); - - // It is difficult to determine when comment editor is really visible. - // This is a workaround which works well in practice. - const next = pos.translate(1); - for (let i = 0; i < 8; i++) { - await sleep(100); - this.editor?.revealRange(new vscode.Range(pos, next)); - } + void commands.executeCommand("setContext", "stgitEditing", true); + this.notifyDirty(); } async createPatch() { - const patch = this.index.deltas.length ? this.index : this.workTree; - const line = patch.lineNum + patch.deltas.length; - await this.openCommentEditor(line, "", "stgit"); + await this.openCommentEditor("", "create"); } async editCommitMessage() { const p = this.curPatch; @@ -796,7 +839,7 @@ class StGitDoc { } const sha = (await p.getSha()) ?? "error retrieving commit message>"; const msg = await run("git", ["show", "-s", sha, "--format=%B"]); - await this.openCommentEditor(p.lineNum, msg, "stgit-edit", p); + await this.openCommentEditor(msg, "edit", p); } async copyCommitSha() { const sha = await this.curPatch?.getSha(); @@ -806,32 +849,56 @@ class StGitDoc { await vscode.env.clipboard.writeText(sha); showStatusMessage(`Copied commit SHA ${sha}`); } + setDraft(body: string) { + if (this.editing) { + this.editing.body = body; + } + } + get draft(): string { + return this.editing?.body ?? ""; + } + async submitComment(body: string) { + if (!this.editing) { + return; + } + this.setDraft(body); + if (this.editing.kind === "create") { + await this.commentCreatePatch(); + } else { + await this.completePatchEdit(); + } + } async commentCreatePatch() { - if (this.commentThread) { - const msg = this.commentThread.comments[0].body; - await this.closeCommentEditor(); + if (this.editing?.kind === "create") { + const msg = this.editing.body; if (msg) { - await run("stg", ["new", "-m", msg as string]); + const result = await runAndReportErrors("stg", ["new", "-m", msg]); + if (result.ecode !== 0) { + return; + } + await this.closeCommentEditor(); await this.refresh(); } } } async completePatchEdit() { - if (this.commentThread) { - const msg = this.commentThread.comments[0].body; + if (this.editing?.kind === "edit") { + const msg = this.editing.body; const editPatch = this.editPatch; - await this.closeCommentEditor(); if (msg && editPatch) { - await run("stg", ["edit", "-m", msg as string, "--", editPatch.label]); + const result = await runAndReportErrors("stg", ["edit", "-m", msg, "--", editPatch.label]); + if (result.ecode !== 0) { + return; + } + await this.closeCommentEditor(); this.reload(); } } } focusWindow() { - return window.showTextDocument(this.doc, { - preview: false, - viewColumn: this.mainViewColumn, - }); + if (!this.disposed) { + this.panel.reveal(); + } } async closeAllDiffEditors() { const editors = window.visibleTextEditors.filter((e) => e.document.uri.scheme === "stgit-diff"); @@ -847,27 +914,34 @@ class StGitDoc { } } private async closeCommentEditor() { - this.commentThread?.dispose(); - this.commentThread = null; - this.commentDraft = null; + this.editing = null; + this.editingInitialBody = ""; this.editPatch = null; + void commands.executeCommand("setContext", "stgitEditing", false); + this.notifyDirty(); await this.closeAllDiffEditors(); - await this.focusWindow(); + this.focusWindow(); } private confirmDiscardComment(): Promise { - return confirmCommentDiscard(this.commentDraft?.hasChanges ?? false, async () => { + const normalize = (text: string) => text.replace(/\r\n/g, "\n"); + const hasChanges = !!this.editing && normalize(this.editing.body) !== normalize(this.editingInitialBody); + return confirmCommentDiscard(hasChanges, async () => { const choice = await window.showWarningMessage("Close the commit message editor? Unsaved changes may be lost.", { modal: true }, "Discard and Close"); return choice === "Discard and Close"; }); } async cancel() { + if (this.editing?.kind === "create" && !this.editing.body) { + await this.closeCommentEditor(); + return; + } if (!(await this.confirmDiscardComment())) { return; } await this.closeCommentEditor(); } async cancelEmptyComment() { - if (this.commentThread?.contextValue === "stgit") { + if (this.editing?.kind === "create" && !this.editing.body) { await this.closeCommentEditor(); } else { await this.cancel(); @@ -1201,18 +1275,9 @@ class StGitDoc { viewColumn: this.alternateViewColumn, }); } - } else if (patch && patch.lineNum === this.curLine) { + } else if (patch) { await patch.toggleExpanded(); this.notifyDirty(); - } else { - const line = this.editor?.document.lineAt(this.curLine); - if (line?.text.startsWith("!")) { - if (this.needRepair) { - await this.repair(); - } else if (!this.branchInitialized) { - await this.initializeBranch(); - } - } } } async navigateToSubmodule(submodulePath: string) { @@ -1239,7 +1304,7 @@ class StGitDoc { const parent = this.parentRepoStack.at(-1)!; const context = await RepositoryInfo.buildParentStack(parent.repo); this.switchRepository(parent.repo, context); - void this.moveCursorToDelta(parent.submodulePath); + this.moveCursorToDelta(parent.submodulePath); } async resolveConflict() { const change = this.curChange; @@ -1267,12 +1332,7 @@ class StGitDoc { } else { await run("git", ["add", "--", change.path, ...(change.destPath ? [change.destPath] : [])]); } - const editor = this.editor; - const nextLine = nextStagedFileLine(patch.lineNum, patch.deltas.indexOf(change), patch.deltas.length); - if (editor && nextLine !== undefined) { - const pos = new vscode.Position(nextLine, editor.selection.active.character); - editor.selection = new vscode.Selection(pos, pos); - } + this.selectedRow = { patchId: patch.rowId, path: patch.deltas[patch.deltas.indexOf(change) + 1]?.path }; } else { await run("git", ["add", "-u"]); } @@ -1280,12 +1340,8 @@ class StGitDoc { } else if (patch?.kind == "I") { if (change) { await run("git", ["restore", "-S", "--", change.path, ...(change.destPath ? [change.destPath] : [])]); - const editor = this.editor; - if (editor) { - const line = remainingIndexFileLine(patch.lineNum, patch.deltas.indexOf(change), patch.deltas.length); - const pos = new vscode.Position(line, editor.selection.active.character); - editor.selection = new vscode.Selection(pos, pos); - } + const index = patch.deltas.indexOf(change); + this.selectedRow = { patchId: patch.rowId, path: patch.deltas[index > 0 ? index - 1 : 1]?.path }; } else { await run("git", ["reset", "HEAD"]); } @@ -1382,140 +1438,24 @@ class StGitDoc { const curPatch = this.curPatch; const ind = list.findIndex((p) => p === curPatch); const nextPatch = list[ind + 1]; - if (this.editor) { - const line = nextPatch ? nextPatch.lineNum : this.curLine + 1; - const pos = new vscode.Position(line, 2); - this.editor.selection = new vscode.Selection(pos, pos); - } - } - - private async openInitialEditor() { - const editor = await window.showTextDocument(this.doc, { - viewColumn: this.mainViewColumn, - preview: false, - }); - const opts = editor.options; - opts.lineNumbers = vscode.TextEditorLineNumbersStyle.Off; - opts.cursorStyle = vscode.TextEditorCursorStyle.Block; - - // move cursor to Index - this.moveCursorToIndexAtOpen(editor); - } - - private async moveCursorToIndex() { - const editor = this.editor; - if (!editor) { - return; - } - this.moveCursorToIndexAtOpen(editor); - } - - private async moveCursorToDelta(path: string) { - const editor = this.editor; - if (!editor) { - return; - } - // The work tree deltas may load after several document - // updates, so keep trying on each update until found. - let resolve: () => void; - const found = new Promise((r) => { - resolve = r; - }); - const watcher = workspace.onDidChangeTextDocument((e) => { - if (e.document !== this.doc) { - return; - } - for (const p of this.patches) { - const idx = p.deltas.findIndex((d) => d.path === path); - if (idx < 0) { - continue; - } - const line = p.lineNum + idx + 1; - const pos = new vscode.Position(line, 0); - editor.selection = new vscode.Selection(pos, pos); - editor.revealRange(new vscode.Range(pos, pos)); - resolve(); - return; - } - }); - const winner = await Promise.race([found.then(() => "found" as const), sleep(4000).then(() => "timeout" as const)]); - watcher.dispose(); - if (winner === "timeout") { - this.moveCursorToIndex(); - } - } - - private async moveCursorToIndexAtOpen(editor: vscode.TextEditor) { - let resolve: () => void; - const found = new Promise((r) => { - resolve = r; - }); - const watcher = workspace.onDidChangeTextDocument((e) => { - if (e.document !== this.doc) { - return; - } - const line = this.index.lineNum; - if (line === 0) { - return; - } - const p = new vscode.Position(line, 0); - editor.selection = new vscode.Selection(p, p); - editor.revealRange(new vscode.Range(p, p)); - resolve(); - }); - const winner = await Promise.race([found.then(() => "found" as const), sleep(4000).then(() => "timeout" as const)]); - watcher.dispose(); - if (winner === "timeout") { - this.moveCursorToIndex(); - } - } - - private updateDecorations() { - this.highlightRanges = this.applied.filter((p) => p.deltas.some((d) => this.highlightPaths?.has(d.path))).map((p) => new vscode.Range(p.lineNum, 2, p.lineNum, 2)); - this.historyRanges = this.history.map((p) => new vscode.Range(p.lineNum, 0, p.lineNum, 999)); - this.updateEditorDecorations(); + this.selectedRow = { patchId: nextPatch?.rowId ?? curPatch?.rowId ?? this.index.rowId }; + this.notifyDirty(); } - - private updateEditorDecorations() { - for (const editor of window.visibleTextEditors) { - if (editor.document !== this.doc) { - continue; - } - - const cls = StGitMode.instance!; - editor.setDecorations(cls.fileHighlightDecoration, this.highlightRanges); - editor.setDecorations(cls.historyDecoration, this.historyRanges); - } + private moveCursorToIndex() { + this.selectedRow = { patchId: this.index.rowId }; + this.notifyDirty(); } - get editor(): vscode.TextEditor | null { - const active = window.activeTextEditor; - if (active?.document === this.doc) { - return active; - } else { - return window.visibleTextEditors.find((e) => e.document === this.doc) ?? null; - } - } - private get curLine(): number { - return this.editor?.selection.active.line ?? -1; + private pendingPath: string | null = null; + private moveCursorToDelta(path: string) { + this.pendingPath = path; + this.notifyDirty(); } private get curPatch(): Patch | null { - const line = this.curLine; - for (const p of this.patches) { - if (p.lineNum <= line && line < p.lineNum + p.lineCount) { - return p; - } - } - return null; + return this.patches.find((patch) => patch.rowId === this.selectedRow.patchId) ?? null; } private get curChange(): Delta | null { - const line = this.curLine; - for (const p of this.patches) { - if (p.lineNum < line && line < p.lineNum + p.lineCount) { - return p.deltas[line - p.lineNum - 1] ?? null; - } - } - return null; + return this.curPatch?.deltas.find((delta) => delta.path === this.selectedRow.path) ?? null; } get alternateViewColumn() { const col = this.mainViewColumn; @@ -1531,58 +1471,14 @@ class StGitDoc { } return ""; } - - get documentContents(): string { - const b = this.branchName ?? this.baseSha?.slice(0, 16) ?? ""; - const branchLine = `Branch: ${b}${this.upstreamString}`; - const lines: string[] = []; - if (this.relativePathFromRoot) { - lines.push(`Submodule: ${this.relativePathFromRoot}`); - } - lines.push(branchLine, ""); - function pushVec(patches: Patch[]) { - for (const p of patches) { - const patchLines = p.getLines(); - p.updateLineSpan(lines.length, patchLines.length); - lines.push(...patchLines); - } - } - pushVec(this.history); - pushVec(this.applied); - if (!this.applied.length) { - lines.push("> "); - } - if (this.stgMissing) { - lines.push("! *** StGit not installed ('stg' binary missing) ***"); - } else if (!this.branchInitialized) { - lines.push("! *** Setup branch for StGit ('stg init') ***"); - } else if (this.needRepair) { - lines.push("! *** Repair needed [C-u g] ***"); - } - pushVec([this.index]); - pushVec([this.workTree]); - pushVec(this.popped); - - this.updateDecorations(); - return lines.join("\n") + "\n--\n"; - } } class StGitMode { static instance: StGitMode | null; - private changeEmitter = new vscode.EventEmitter(); - private pendingSelections = new Map< - vscode.TextEditor, - { - previous: string; - next: string; - selections: readonly vscode.Selection[]; - } - >(); - private commentController = vscode.comments.createCommentController("stgit.comments", "StGit"); - stgit: StGitDoc | null = null; + private assetRevision = 0; + private assetReloadTimer: ReturnType | undefined; private repositoryFollower = new RepositoryFollower({ lookup: (directory: string) => RepositoryInfo.createForPath(directory), current: () => this.stgit?.repo ?? null, @@ -1592,80 +1488,36 @@ class StGitMode { }, }); - readonly fileHighlightDecoration = window.createTextEditorDecorationType({ - before: { contentText: "⏹ " }, - }); - readonly historyDecoration = window.createTextEditorDecorationType({ - dark: { color: "#777" }, - light: { color: "#999" }, - }); - constructor(context: vscode.ExtensionContext) { - const provider: vscode.TextDocumentContentProvider = { - onDidChange: this.changeEmitter.event, - provideTextDocumentContent: (uri: vscode.Uri, token) => { - const next = this.stgit?.documentContents ?? "\nIndex\n"; - const doc = this.stgit?.doc; - if (doc && next !== doc.getText()) { - this.pendingSelections.clear(); - for (const editor of window.visibleTextEditors) { - if (editor.document === doc) { - this.pendingSelections.set(editor, { - previous: doc.getText(), - next, - selections: editor.selections, - }); - } - } - } - return next; - }, - }; + constructor(private readonly context: vscode.ExtensionContext) { const cmd = (cmd: string, func: () => void | Promise) => { - return commands.registerTextEditorCommand(`stgit.${cmd}`, () => { + return commands.registerCommand(`stgit.${cmd}`, () => { const doc = this.stgit; return doc ? doc.runMutation(func) : func(); }); }; - const globalCmd = (cmd: string, func: () => void | Promise) => - commands.registerCommand(`stgit.${cmd}`, () => { - const doc = this.stgit; - return doc ? doc.runMutation(func) : func(); - }); - context.subscriptions.push( - this /* self dispose */, - - window.onDidChangeTextEditorSelection((event) => { - if (event.kind !== undefined) { - const pending = this.pendingSelections.get(event.textEditor); - if (pending) { - pending.selections = event.selections; - } + if (context.extensionMode === vscode.ExtensionMode.Development) { + const assetRoot = vscode.Uri.joinPath(context.extensionUri, "out", "webview"); + const assetWatcher = workspace.createFileSystemWatcher(new vscode.RelativePattern(assetRoot, "index.{js,css}")); + const scheduleReload = () => { + if (this.assetReloadTimer) { + clearTimeout(this.assetReloadTimer); } - }), - workspace.onDidChangeTextDocument((event) => { - if (event.document !== this.stgit?.doc) { - return; - } - for (const [editor, pending] of this.pendingSelections) { - if (event.document.getText() !== pending.next) { - continue; + this.assetReloadTimer = setTimeout(() => { + this.assetReloadTimer = undefined; + if (this.stgit) { + this.assetRevision++; + this.setWebviewHtml(this.stgit.panel); } - editor.selections = pending.selections.map((selection) => { - const position = (point: vscode.Position) => { - const line = correspondingLine(pending.previous, pending.next, point.line); - const column = Math.min(point.character, event.document.lineAt(line).text.length); - return new vscode.Position(line, column); - }; - return new vscode.Selection(position(selection.anchor), position(selection.active)); - }); - editor.revealRange(editor.selection, vscode.TextEditorRevealType.InCenterIfOutsideViewport); - this.pendingSelections.delete(editor); - } - }), - - globalCmd("open", () => this.openStgit()), + }, 150); + }; + context.subscriptions.push(assetWatcher, assetWatcher.onDidChange(scheduleReload), assetWatcher.onDidCreate(scheduleReload)); + } + context.subscriptions.push( + this /* self dispose */, + commands.registerCommand("stgit.open", () => this.openStgit()), cmd("refresh", () => this.stgit?.refresh()), cmd("repair", () => this.stgit?.repair()), + cmd("initializeBranch", () => this.stgit?.initializeBranch()), cmd("refreshSpecific", () => this.stgit?.refreshSpecific()), cmd("createBranch", () => this.stgit?.createBranch()), cmd("switchBranch", () => this.stgit?.switchBranch()), @@ -1691,6 +1543,7 @@ class StGitMode { cmd("movePatchesTo", () => this.stgit?.movePatchesTo()), cmd("commentCreatePatch", () => this.stgit?.commentCreatePatch()), cmd("completePatchEdit", () => this.stgit?.completePatchEdit()), + cmd("submitComment", () => this.stgit?.submitComment(this.stgit.draft)), cmd("cancel", () => this.stgit?.cancel()), cmd("cancelEmptyComment", () => this.stgit?.cancelEmptyComment()), cmd("editCommitMessage", () => this.stgit?.editCommitMessage()), @@ -1710,24 +1563,7 @@ class StGitMode { cmd("redo", () => this.stgit?.redo()), cmd("help", () => this.stgit?.help()), cmd("navigateToParent", () => this.stgit?.navigateToParent()), - - workspace.registerTextDocumentContentProvider("stgit", provider), - vscode.languages.registerFoldingRangeProvider( - { scheme: "stgit", language: "stgit-buffer" }, - { - provideFoldingRanges: () => [], - }, - ), - - workspace.onDidCloseTextDocument((doc) => { - if (doc === this.stgit?.doc) { - this.pendingSelections.clear(); - this.repositoryFollower.cancel(); - this.stgit.dispose(); - this.stgit = null; - } - }), - workspace.onDidSaveTextDocument((doc) => { + workspace.onDidSaveTextDocument(() => { this.stgit?.reloadWorkTree(); }), window.onDidChangeActiveTextEditor((editor) => { @@ -1738,21 +1574,18 @@ class StGitMode { ); } dispose() { - this.pendingSelections.clear(); + if (this.assetReloadTimer) { + clearTimeout(this.assetReloadTimer); + } this.repositoryFollower.cancel(); this.stgit?.dispose(); this.stgit = null; - this.commentController.dispose(); - this.changeEmitter.dispose(); StGitMode.instance = null; - - this.fileHighlightDecoration.dispose(); - this.historyDecoration.dispose(); } private async openStgit() { if (this.stgit) { const scheme = window.activeTextEditor?.document.uri.scheme || ""; - const isInStgitBuffer = ["stgit", "stgit-diff"].includes(scheme); + const isInStgitBuffer = this.stgit.panel.active || scheme === "stgit-diff"; if (!isInStgitBuffer) { const repo = await RepositoryInfo.lookup(); if (!repo) { @@ -1762,7 +1595,7 @@ class StGitMode { const context = await RepositoryInfo.buildParentStack(repo); this.stgit.switchRepository(repo, context); } - await this.stgit.focusWindow(); + this.stgit.focusWindow(); this.stgit.reload(); } else { const repo = await RepositoryInfo.lookup(); @@ -1771,21 +1604,73 @@ class StGitMode { return; } RepositoryInfo.setSelectedRepo(repo); - const doc = await vscode.languages.setTextDocumentLanguage(await workspace.openTextDocument(this.uri), "stgit-buffer"); - this.stgit = new StGitDoc( - doc, - repo, - () => { - if (this.stgit?.documentContents !== doc.getText()) { - this.changeEmitter.fire(doc.uri); - } - }, - this.commentController, - ); + const assetRoot = vscode.Uri.joinPath(this.context.extensionUri, "out", "webview"); + const panel = window.createWebviewPanel("stgit", "StGit", vscode.ViewColumn.Active, { + enableScripts: true, + localResourceRoots: [assetRoot], + }); + this.stgit = new StGitDoc(panel, repo, () => { + if (this.stgit?.panel === panel && panel.visible) { + void panel.webview.postMessage({ type: "render", state: this.stgit.viewState }); + } + }); + panel.webview.onDidReceiveMessage((message: unknown) => void this.handleMessage(panel, message)); + panel.onDidChangeViewState(() => { + if (panel.visible && this.stgit?.panel === panel) { + void panel.webview.postMessage({ type: "render", state: this.stgit.viewState }); + } + }); + panel.onDidDispose(() => { + if (this.stgit?.panel === panel) { + this.repositoryFollower.cancel(); + this.stgit.dispose(); + this.stgit = null; + } + }); + this.setWebviewHtml(panel); } } - private get uri() { - return vscode.Uri.from({ scheme: "stgit", path: "/StGit" }); + private setWebviewHtml(panel: vscode.WebviewPanel) { + const assetRoot = vscode.Uri.joinPath(this.context.extensionUri, "out", "webview"); + const query = `v=${this.assetRevision}`; + panel.webview.html = stgitWebviewHtml(panel.webview, { + script: vscode.Uri.joinPath(assetRoot, "index.js").with({ query }), + style: vscode.Uri.joinPath(assetRoot, "index.css").with({ query }), + }); + } + private async handleMessage(panel: vscode.WebviewPanel, raw: unknown) { + const doc = this.stgit; + if (!doc || doc.panel !== panel || !raw || typeof raw !== "object") { + return; + } + const message = raw as Record; + if (message.type === "ready") { + void panel.webview.postMessage({ type: "render", state: doc.viewState }); + } else if (message.type === "select" && typeof message.patchId === "string" && (message.path === undefined || typeof message.path === "string")) { + doc.selectRow(message.patchId, message.path as string | undefined); + } else if (message.type === "draft" && typeof message.body === "string") { + doc.setDraft(message.body); + } else if (message.type === "submit" && typeof message.body === "string") { + await doc.runMutation(() => doc.submitComment(message.body as string)); + } else if (message.type === "cancel") { + await doc.runMutation(() => doc.cancel()); + } else if ( + message.type === "command" && + typeof message.command === "string" && + [ + "stgit.reload", + "stgit.refresh", + "stgit.newPatch", + "stgit.help", + "stgit.toggleExpand", + "stgit.markPatch", + "stgit.unmarkPatch", + "stgit.initializeBranch", + "stgit.repair", + ].includes(message.command) + ) { + await commands.executeCommand(message.command); + } } } diff --git a/src/test/suite/extension.test.ts b/src/test/suite/extension.test.ts index ced20ad..fd2c5d4 100644 --- a/src/test/suite/extension.test.ts +++ b/src/test/suite/extension.test.ts @@ -132,15 +132,14 @@ suite("Extension Test Suite", () => { assert.deepStrictEqual(commit.getLines(), ["▸ abc12 Committed change"]); }); - test("Disables native folding in the StGit document", async () => { + test("Registers StGit webview actions without a virtual document", async () => { const extension = vscode.extensions.getExtension("cedernaes.stgit-revived"); assert.ok(extension); await extension.activate(); - const uri = vscode.Uri.from({ scheme: "stgit", path: "/StGit" }); - const doc = await vscode.workspace.openTextDocument(uri); - assert.strictEqual(doc.languageId, "stgit-buffer"); - const ranges = await vscode.commands.executeCommand("vscode.executeFoldingRangeProvider", uri); - assert.deepStrictEqual(ranges, []); + const registered = await vscode.commands.getCommands(true); + assert.ok(registered.includes("stgit.open")); + assert.ok(registered.includes("stgit.refresh")); + assert.ok(registered.includes("stgit.submitComment")); }); test("Keeps the cursor on its file when a redraw changes line counts", () => { diff --git a/src/test/suite/repo-display-loads.test.ts b/src/test/suite/repo-display-loads.test.ts index d08ef0d..89860a6 100644 --- a/src/test/suite/repo-display-loads.test.ts +++ b/src/test/suite/repo-display-loads.test.ts @@ -12,6 +12,62 @@ function deferred() { } suite("Repository display loads", () => { + test("reports only current series and change reads as loading", async () => { + const oldSeries = deferred(); + const currentSeries = deferred(); + const changes = deferred(); + const loading: boolean[] = []; + const failures: string[] = []; + const loads = new RepoDisplayLoads( + { topLevelDir: "/repo" }, + { run: async () => "", runCommand: async () => ({ stdout: "", stderr: "", ecode: 0 }) }, + (_kind, error) => failures.push(String(error)), + (busy) => loading.push(busy), + ); + const stale = loads.loadSeries( + () => oldSeries.promise, + () => undefined, + ); + const files = loads.loadChanges( + () => changes.promise, + () => undefined, + ); + const current = loads.loadSeries( + () => currentSeries.promise, + () => undefined, + ); + assert.deepStrictEqual(loading, [true]); + oldSeries.resolve("stale"); + await stale; + assert.deepStrictEqual(loading, [true]); + changes.resolve("files"); + await files; + assert.deepStrictEqual(loading, [true]); + currentSeries.resolve("series"); + await current; + assert.deepStrictEqual(loading, [true, false]); + + const abandoned = deferred(); + const pending = loads.loadChanges( + () => abandoned.promise, + () => undefined, + ); + loads.pause(); + abandoned.resolve("ignored"); + await pending; + assert.deepStrictEqual(loading, [true, false, true, false]); + loads.resume(); + await loads.loadSeries( + async () => { + throw new Error("read failed"); + }, + () => undefined, + ); + assert.deepStrictEqual(loading, [true, false, true, false, true, false]); + assert.deepStrictEqual(failures, ["Error: read failed"]); + loads.dispose(); + }); + test("invalidates in-flight results and skips loads during a mutation", async () => { const oldSeries = deferred(); const oldChanges = deferred(); @@ -219,7 +275,25 @@ suite("Repository display loads", () => { series.resolve("late series"); changes.reject(new Error("late failure")); await Promise.all([pendingSeries, pendingChanges]); - assert.deepStrictEqual(shown, []); + assert.strictEqual(shown.length, 0); assert.deepStrictEqual(failures, []); + let readsAfterDispose = 0; + loads.resume(); + await loads.loadSeries( + async () => { + readsAfterDispose++; + return "late series"; + }, + (result) => shown.push(result), + ); + await loads.loadChanges( + async () => { + readsAfterDispose++; + return "late changes"; + }, + (result) => shown.push(result), + ); + assert.strictEqual(readsAfterDispose, 0); + assert.strictEqual(shown.length, 0); }); }); diff --git a/src/test/unit/comment-discard.test.ts b/src/test/unit/comment-discard.test.ts index 9bdd2b6..25327bf 100644 --- a/src/test/unit/comment-discard.test.ts +++ b/src/test/unit/comment-discard.test.ts @@ -4,17 +4,18 @@ import * as path from "path"; import { CommentDraft, confirmCommentDiscard } from "../../comment-discard"; suite("Comment discard", () => { - test("Escape closes an empty focused comment without prompting", () => { + test("Escape cancels the webview composer without invoking patch actions", () => { const manifest = JSON.parse(readFileSync(path.resolve(__dirname, "../../../package.json"), "utf8")); const bindings = manifest.contributes.keybindings.filter((binding: { key: string; command: string; when?: string }) => { - return binding.key === "escape" && binding.when?.includes("resourceScheme == stgit"); - }); - assert.strictEqual(bindings.at(-2).command, "stgit.cancel"); - assert.deepStrictEqual(bindings.at(-1), { - key: "escape", - command: "stgit.cancelEmptyComment", - when: "resourceScheme == stgit && commentEditorFocused && commentIsEmpty", + return binding.key === "escape" && binding.when?.includes("activeWebviewPanelId == stgit"); }); + assert.deepStrictEqual(bindings, [ + { + key: "escape", + command: "stgit.cancel", + when: "activeWebviewPanelId == stgit && !stgitEditing && !inQuickOpen && !terminalFocus && !inputFocus", + }, + ]); }); test("closes without asking when there are no unsaved changes", async () => { diff --git a/src/test/unit/debug-tasks.test.ts b/src/test/unit/debug-tasks.test.ts new file mode 100644 index 0000000..055f3a7 --- /dev/null +++ b/src/test/unit/debug-tasks.test.ts @@ -0,0 +1,41 @@ +import * as assert from "assert"; +import { readFileSync } from "fs"; +import * as path from "path"; +import * as ts from "typescript"; + +function readConfig(file: string): Record { + const location = path.resolve(__dirname, "../../../.vscode", file); + const parsed = ts.parseConfigFileTextToJson(location, readFileSync(location, "utf8")); + assert.strictEqual(parsed.error, undefined); + return parsed.config as Record; +} + +suite("Extension debug tasks", () => { + test("compiles host and webview assets before starting watch for every launch", () => { + const tasks = readConfig("tasks.json").tasks as { + label: string; + script?: string; + isBackground?: boolean; + dependsOn?: string[]; + dependsOrder?: string; + problemMatcher?: { base: string; background: { activeOnStart: boolean; beginsPattern: string; endsPattern: string } }; + }[]; + const compile = tasks.find((task) => task.label === "stgit: compile"); + const watch = tasks.find((task) => task.label === "stgit: watch"); + const debug = tasks.find((task) => task.label === "stgit: debug"); + assert.strictEqual(compile?.script, "compile"); + assert.strictEqual(watch?.script, "watch"); + assert.strictEqual(watch?.isBackground, true); + assert.strictEqual(watch?.problemMatcher?.base, "$tsc-watch"); + assert.strictEqual(watch?.problemMatcher?.background.activeOnStart, true); + const readiness = watch!.problemMatcher!.background; + assert.match("[0] 2:26:27 PM - Starting compilation in watch mode...", new RegExp(readiness.beginsPattern)); + assert.match("[0] 2:26:28 PM - Found 0 errors. Watching for file changes.", new RegExp(readiness.endsPattern)); + assert.doesNotMatch("[1] 2:26:28 PM - Found 0 errors. Watching for file changes.", new RegExp(readiness.endsPattern)); + assert.strictEqual(debug?.dependsOrder, "sequence"); + assert.deepStrictEqual(debug?.dependsOn, [compile.label, watch.label]); + const launches = readConfig("launch.json").configurations as { preLaunchTask: string }[]; + assert.ok(launches.length > 0); + assert.ok(launches.every((launch) => launch.preLaunchTask === debug.label)); + }); +}); diff --git a/src/test/unit/stgit-webview.test.ts b/src/test/unit/stgit-webview.test.ts new file mode 100644 index 0000000..87a2e6c --- /dev/null +++ b/src/test/unit/stgit-webview.test.ts @@ -0,0 +1,194 @@ +import * as assert from "assert"; +import { readFileSync } from "fs"; +import * as path from "path"; +import * as vm from "vm"; +import { JSDOM } from "jsdom"; +import { stgitWebviewHtml } from "../../stgit-webview"; +import type { StGitViewState } from "../../stgit-webview"; + +async function until(condition: () => boolean) { + for (let attempt = 0; attempt < 30; attempt++) { + if (condition()) { + return; + } + await new Promise((resolve) => setTimeout(resolve, 10)); + } + assert.ok(condition(), "webview did not update in time"); +} + +suite("StGit webview", () => { + test("loads the compiled React bundle and stylesheet under a restrictive CSP", () => { + const assetRoot = path.resolve(__dirname, "../../../out/webview"); + const script = readFileSync(path.join(assetRoot, "index.js"), "utf8"); + assert.doesNotThrow(() => new vm.Script(script)); + assert.ok(readFileSync(path.join(assetRoot, "index.css"), "utf8").includes(".loading")); + const webview = { + cspSource: "vscode-resource:", + asWebviewUri: (uri: { toString(): string }) => uri, + } as unknown as Parameters[0]; + const assets = { + script: { toString: () => "vscode-resource:/out/webview/index.js?v=1" }, + style: { toString: () => "vscode-resource:/out/webview/index.css?v=1" }, + } as Parameters[1]; + const html = stgitWebviewHtml(webview, assets); + assert.match(html, /default-src 'none'/); + assert.match(html, /script-src vscode-resource:/); + assert.match(html, /src="vscode-resource:.*index\.js\?v=1"/); + assert.match(html, /href="vscode-resource:.*index\.css\?v=1"/); + assert.doesNotMatch(html, /