From 3d753edd0f284a59ce82f573bd221cd457baf494 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 4 Jan 2025 21:06:02 -0700 Subject: [PATCH] A gazillion changes --- .env.dev | 2 + .env.watch | 2 + .gitignore | 3 + package-lock.json | 547 +++++++++++++++++++++++++++++++- package.json | 225 ++++++++++++- rsbuild.config.ts | 71 ++++- shared/config-schema.json | 230 ++++++++++++++ shared/config.ts | 75 ++++- shared/messages.ts | 45 +-- src/extension.ts | 543 +++++-------------------------- src/workspace.ts | 494 ++++++++++++++++++++++++++++ update-config.ts | 37 +++ webview/App.css | 182 ++++++++++- webview/App.tsx | 54 +++- webview/FunctionView.module.css | 18 +- webview/FunctionView.tsx | 197 ++++++++++-- webview/Header.module.css | 51 ++- webview/SettingsView.module.css | 18 ++ webview/SettingsView.tsx | 121 +++++++ webview/SymbolsView.module.css | 40 ++- webview/SymbolsView.tsx | 337 ++++++++++++++------ webview/UnitsView.module.css | 43 ++- webview/UnitsView.tsx | 191 +++++++++-- webview/highlight.ts | 179 +++++++++++ webview/mock.ts | 86 +++++ webview/state.ts | 376 ++++++++++++++++------ webview/util.module.css | 9 +- webview/util.ts | 2 +- 28 files changed, 3331 insertions(+), 847 deletions(-) create mode 100644 .env.dev create mode 100644 .env.watch create mode 100644 shared/config-schema.json create mode 100644 src/workspace.ts create mode 100644 update-config.ts create mode 100644 webview/SettingsView.module.css create mode 100644 webview/SettingsView.tsx create mode 100644 webview/highlight.ts create mode 100644 webview/mock.ts diff --git a/.env.dev b/.env.dev new file mode 100644 index 0000000..d4bde30 --- /dev/null +++ b/.env.dev @@ -0,0 +1,2 @@ +NODE_ENV=development +DEV_SERVER=true diff --git a/.env.watch b/.env.watch new file mode 100644 index 0000000..fb88cab --- /dev/null +++ b/.env.watch @@ -0,0 +1,2 @@ +NODE_ENV=development +DEV_SERVER=false diff --git a/.gitignore b/.gitignore index 19a3eef..5777cab 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,6 @@ dist/ # IDE .vscode-test/ *.vsix + +# Ignore auto generated CSS declarations +*.module.css.d.ts diff --git a/package-lock.json b/package-lock.json index 2cf3f12..ccf71ec 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,15 +1,17 @@ { - "name": "objdiff-code", + "name": "objdiff", "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "objdiff-code", + "name": "objdiff", "version": "0.0.1", "dependencies": { "@protobuf-ts/runtime": "^2.9.4", + "@vscode/codicons": "^0.0.36", "clsx": "^2.1.1", + "core-js": "^3.39.0", "memoize-one": "^6.0.0", "picomatch": "^4.0.2", "react": "^18.3.1", @@ -23,6 +25,9 @@ "@rsbuild/core": "^1.1.8", "@rsbuild/plugin-react": "^1.0.7", "@rsbuild/plugin-type-check": "^1.1.0", + "@rsbuild/plugin-typed-css-modules": "^1.0.2", + "@types/core-js": "^2.5.8", + "@types/node": "^22.10.2", "@types/picomatch": "^3.0.1", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", @@ -31,6 +36,7 @@ "@types/vscode-webview": "^1.57.5", "@vscode/test-cli": "^0.0.10", "@vscode/test-electron": "^2.4.1", + "tsx": "^4.19.2", "typescript": "^5.7.2" }, "engines": { @@ -245,6 +251,414 @@ "node": ">=14.21.3" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", + "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", + "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", + "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", + "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", + "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", + "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", + "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", + "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", + "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", + "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", + "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", + "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", + "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", + "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", + "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", + "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", + "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", + "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", + "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", + "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", + "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", + "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", + "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", + "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, "node_modules/@isaacs/cliui": { "version": "8.0.2", "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", @@ -468,6 +882,21 @@ } } }, + "node_modules/@rsbuild/plugin-typed-css-modules": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@rsbuild/plugin-typed-css-modules/-/plugin-typed-css-modules-1.0.2.tgz", + "integrity": "sha512-QX376pBXWeBrZBvYLP2HGGrHiWA5O0SDHwRoBNto5BqYDXhi6y+Eol2Hb/cY+h2ARKZVanMfUiJRABULOJ/FCQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@rsbuild/core": "1.x || ^1.0.1-beta.0" + }, + "peerDependenciesMeta": { + "@rsbuild/core": { + "optional": true + } + } + }, "node_modules/@rspack/binding": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/@rspack/binding/-/binding-1.1.6.tgz", @@ -675,6 +1104,13 @@ "tslib": "^2.8.0" } }, + "node_modules/@types/core-js": { + "version": "2.5.8", + "resolved": "https://registry.npmjs.org/@types/core-js/-/core-js-2.5.8.tgz", + "integrity": "sha512-VgnAj6tIAhJhZdJ8/IpxdatM8G4OD3VWGlp6xIxUGENZlpbob9Ty4VVdC1FIEp0aK6DBscDDjyzy5FB60TuNqg==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", @@ -689,6 +1125,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/node": { + "version": "22.10.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", + "integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.20.0" + } + }, "node_modules/@types/picomatch": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/@types/picomatch/-/picomatch-3.0.1.tgz", @@ -748,6 +1194,12 @@ "dev": true, "license": "MIT" }, + "node_modules/@vscode/codicons": { + "version": "0.0.36", + "resolved": "https://registry.npmjs.org/@vscode/codicons/-/codicons-0.0.36.tgz", + "integrity": "sha512-wsNOvNMMJ2BY8rC2N2MNBG7yOowV3ov8KlvUE/AiVUlHKTfWsw3OgAOQduX7h0Un6GssKD3aoTVH+TF3DSQwKQ==", + "license": "CC-BY-4.0" + }, "node_modules/@vscode/test-cli": { "version": "0.0.10", "resolved": "https://registry.npmjs.org/@vscode/test-cli/-/test-cli-0.0.10.tgz", @@ -1280,7 +1732,6 @@ "version": "3.39.0", "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.39.0.tgz", "integrity": "sha512-raM0ew0/jJUqkJ0E6e8UDtl+y/7ktFivgWvqw8dNSQeNWoSDLvQ1H/RN3aPXB9tBd4/FhyR4RDPGhsNIMsAn7g==", - "dev": true, "hasInstallScript": true, "license": "MIT", "funding": { @@ -1406,6 +1857,46 @@ "stackframe": "^1.3.4" } }, + "node_modules/esbuild": { + "version": "0.23.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.23.1.tgz", + "integrity": "sha512-VVNz/9Sa0bs5SELtn3f7qhJCDPCF5oMEl5cO9/SSinpE9hbPVvxbd572HH5AKiP7WD8INO53GgfDDhRjkylHEg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.23.1", + "@esbuild/android-arm": "0.23.1", + "@esbuild/android-arm64": "0.23.1", + "@esbuild/android-x64": "0.23.1", + "@esbuild/darwin-arm64": "0.23.1", + "@esbuild/darwin-x64": "0.23.1", + "@esbuild/freebsd-arm64": "0.23.1", + "@esbuild/freebsd-x64": "0.23.1", + "@esbuild/linux-arm": "0.23.1", + "@esbuild/linux-arm64": "0.23.1", + "@esbuild/linux-ia32": "0.23.1", + "@esbuild/linux-loong64": "0.23.1", + "@esbuild/linux-mips64el": "0.23.1", + "@esbuild/linux-ppc64": "0.23.1", + "@esbuild/linux-riscv64": "0.23.1", + "@esbuild/linux-s390x": "0.23.1", + "@esbuild/linux-x64": "0.23.1", + "@esbuild/netbsd-x64": "0.23.1", + "@esbuild/openbsd-arm64": "0.23.1", + "@esbuild/openbsd-x64": "0.23.1", + "@esbuild/sunos-x64": "0.23.1", + "@esbuild/win32-arm64": "0.23.1", + "@esbuild/win32-ia32": "0.23.1", + "@esbuild/win32-x64": "0.23.1" + } + }, "node_modules/escalade": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", @@ -1518,6 +2009,19 @@ "node": "6.* || 8.* || >= 10.*" } }, + "node_modules/get-tsconfig": { + "version": "4.8.1", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.8.1.tgz", + "integrity": "sha512-k9PN+cFBmaLWtVz29SkUoqU5O0slLuHJXt/2P+tMVFT+phsSGXGkp9t3rQIqdz0e+06EHNGs3oM6ZX1s2zHxRg==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, "node_modules/glob": { "version": "10.4.5", "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", @@ -2634,6 +3138,16 @@ "node": ">=0.10.0" } }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, "node_modules/restore-cursor": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", @@ -3067,6 +3581,26 @@ "dev": true, "license": "0BSD" }, + "node_modules/tsx": { + "version": "4.19.2", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.19.2.tgz", + "integrity": "sha512-pOUl6Vo2LUq/bSa8S5q7b91cgNSjctn9ugq/+Mvow99qW6x/UZYwzxy/3NmqoT66eHYfCVvFvACC58UBPFf28g==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.23.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, "node_modules/typescript": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.7.2.tgz", @@ -3081,6 +3615,13 @@ "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", + "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==", + "dev": true, + "license": "MIT" + }, "node_modules/util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", diff --git a/package.json b/package.json index f241e79..ed1f6ae 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,21 @@ { - "name": "objdiff-code", - "displayName": "objdiff-code", + "name": "objdiff", + "displayName": "objdiff", "description": "objdiff", + "publisher": "decomp-dev", "version": "0.0.1", "scripts": { "build": "rsbuild build", - "watch": "rsbuild build --watch --mode development", + "watch": "rsbuild build -w --env-mode watch", + "dev": "rsbuild dev --env-mode dev", "check": "biome check --write", "format": "biome format --write" }, "dependencies": { "@protobuf-ts/runtime": "^2.9.4", + "@vscode/codicons": "^0.0.36", "clsx": "^2.1.1", + "core-js": "^3.39.0", "memoize-one": "^6.0.0", "picomatch": "^4.0.2", "react": "^18.3.1", @@ -25,6 +29,9 @@ "@rsbuild/core": "^1.1.8", "@rsbuild/plugin-react": "^1.0.7", "@rsbuild/plugin-type-check": "^1.1.0", + "@rsbuild/plugin-typed-css-modules": "^1.0.2", + "@types/core-js": "^2.5.8", + "@types/node": "^22.10.2", "@types/picomatch": "^3.0.1", "@types/react": "^18.3.1", "@types/react-dom": "^18.3.1", @@ -33,15 +40,22 @@ "@types/vscode-webview": "^1.57.5", "@vscode/test-cli": "^0.0.10", "@vscode/test-electron": "^2.4.1", + "tsx": "^4.19.2", "typescript": "^5.7.2" }, "main": "./dist/extension.js", "engines": { "vscode": "^1.96.0" }, - "browserslist": ["chrome 128"], - "categories": ["Other"], - "activationEvents": ["*"], + "browserslist": [ + "chrome 128" + ], + "categories": [ + "Other" + ], + "activationEvents": [ + "*" + ], "contributes": { "commands": [ { @@ -60,6 +74,10 @@ "command": "objdiff.chooseCurrentFile", "title": "objdiff: Switch To Current File" }, + { + "command": "objdiff.settings", + "title": "objdiff: Settings" + }, { "command": "objdiff.copySymbolName", "title": "Copy name", @@ -71,16 +89,195 @@ "enablement": "webviewId == 'objdiff' && contextType == 'symbol' && symbolDemangledName" } ], - "configuration": { - "title": "objdiff", - "properties": { - "objdiff.binaryPath": { - "type": "string", - "description": "Path to the objdiff-cli binary", - "ignoreSync": true + "configuration": [ + { + "title": "Extension", + "properties": { + "objdiff.binaryPath": { + "type": "string", + "description": "Path to the objdiff-cli binary", + "scope": "machine" + } + } + }, + { + "title": "General", + "properties": { + "objdiff.relaxRelocDiffs": { + "type": "boolean", + "description": "Ignores differences in relocation targets. (Address, name, etc)", + "default": false + }, + "objdiff.spaceBetweenArgs": { + "type": "boolean", + "description": "Adds a space between arguments in the diff output.", + "default": true + }, + "objdiff.combineDataSections": { + "type": "boolean", + "description": "Combines data sections with equal names.", + "default": false + } + } + }, + { + "title": "ARM", + "properties": { + "objdiff.arm.archVersion": { + "type": "string", + "description": "ARM architecture version to use for disassembly.", + "default": "auto", + "enum": [ + "auto", + "v4t", + "v5te", + "v6k" + ], + "enumItemLabels": [ + "Auto", + "ARMv4T (GBA)", + "ARMv5TE (DS)", + "ARMv6K (3DS)" + ], + "enumDescriptions": [ + null, + null, + null, + null + ] + }, + "objdiff.arm.unifiedSyntax": { + "type": "boolean", + "description": "Disassemble as unified assembly language (UAL).", + "default": false + }, + "objdiff.arm.avRegisters": { + "type": "boolean", + "description": "Display R0-R3 as A1-A4 and R4-R11 as V1-V8.", + "default": false + }, + "objdiff.arm.r9Usage": { + "type": "string", + "default": "generalPurpose", + "enum": [ + "generalPurpose", + "sb", + "tr" + ], + "enumItemLabels": [ + "R9 or V6", + "SB (static base)", + "TR (TLS register)" + ], + "enumDescriptions": [ + "Use R9 as a general-purpose register.", + "Used for position-independent data (PID).", + "Used for thread-local storage." + ] + }, + "objdiff.arm.slUsage": { + "type": "boolean", + "description": "Used for explicit stack limits.", + "default": false + }, + "objdiff.arm.fpUsage": { + "type": "boolean", + "description": "Used for frame pointers.", + "default": false + }, + "objdiff.arm.ipUsage": { + "type": "boolean", + "description": "Used for interworking and long branches.", + "default": false + } + } + }, + { + "title": "MIPS", + "properties": { + "objdiff.mips.abi": { + "type": "string", + "description": "MIPS ABI to use for disassembly.", + "default": "auto", + "enum": [ + "auto", + "o32", + "n32", + "n64" + ], + "enumItemLabels": [ + "Auto", + "O32", + "N32", + "N64" + ], + "enumDescriptions": [ + null, + null, + null, + null + ] + }, + "objdiff.mips.instrCategory": { + "type": "string", + "description": "MIPS instruction category to use for disassembly.", + "default": "auto", + "enum": [ + "auto", + "cpu", + "rsp", + "r3000gte", + "r4000allegrex", + "r5900" + ], + "enumItemLabels": [ + "Auto", + "CPU", + "RSP (N64)", + "R3000 GTE (PS1)", + "R4000 ALLEGREX (PSP)", + "R5900 EE (PS2)" + ], + "enumDescriptions": [ + null, + null, + null, + null, + null, + null + ] + } + } + }, + { + "title": "x86", + "properties": { + "objdiff.x86.formatter": { + "type": "string", + "description": "x86 disassembly syntax.", + "default": "intel", + "enum": [ + "intel", + "gas", + "nasm", + "masm" + ], + "enumItemLabels": [ + "Intel", + "AT&T", + "NASM", + "MASM" + ], + "enumDescriptions": [ + null, + null, + null, + null + ] + } } } - }, + ], "menus": { "webview/context": [ { diff --git a/rsbuild.config.ts b/rsbuild.config.ts index c111d92..c4d69d8 100644 --- a/rsbuild.config.ts +++ b/rsbuild.config.ts @@ -1,13 +1,26 @@ -import { defineConfig } from '@rsbuild/core'; +import fs from 'node:fs'; +import type { ServerResponse } from 'node:http'; +import { type RequestHandler, defineConfig } from '@rsbuild/core'; import { pluginReact } from '@rsbuild/plugin-react'; import { pluginTypeCheck } from '@rsbuild/plugin-type-check'; +import { pluginTypedCSSModules } from '@rsbuild/plugin-typed-css-modules'; + +const devServer = process.env.DEV_SERVER === 'true'; export default defineConfig({ // Disable HMR and live reload. Neither the extension nor the // webview can communicate with the rsbuild dev server. dev: { - hmr: false, - liveReload: false, + hmr: devServer, + liveReload: devServer, + setupMiddlewares: [ + (middlewares, _server) => { + if (devServer) { + middlewares.unshift(apiMiddleware); + } + return middlewares; + }, + ], }, environments: { extension: { @@ -38,8 +51,9 @@ export default defineConfig({ // VS Code webviews don't have easy access to resources, // (especially if the extension is running on web) so we // simply inline everything into the HTML. - inlineScripts: true, - inlineStyles: true, + dataUriLimit: devServer ? undefined : 1000000000, + inlineScripts: !devServer, + inlineStyles: !devServer, legalComments: 'none', }, //