fix: auto-zoom-on-click broken by uiohook-napi packaging bug - #23
Merged
Conversation
… load in the packaged app
The click-to-zoom feature relies on uiohook-napi's global input hook to
capture real mouse clicks during a recording. Its compiled dist/index.js
does `require('node-gyp-build')` to load its native addon, but
electron-builder's dependency pruning silently dropped that (correctly
declared) transitive dependency from the packaged app.asar, so the hook
never loaded - `[CursorTelemetry] Global interaction capture unavailable:
Cannot find module 'node-gyp-build'`. Screen/audio/webcam recording were
unaffected since they don't depend on this module, so the failure was easy
to miss.
Fixed by declaring node-gyp-build as a direct dependency and explicitly
forcing it into electron-builder's files list, which reliably gets it
included. Verified against a packaged build: cursor telemetry now records
real "click"/"mouseup" samples instead of only "move" samples.
Also normalizes electron-builder.json5 to consistent LF line endings - it
had a mix of CRLF/LF that made the diff for the one-line fix unreadable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
uiohook-napi's global input hook capturing real clicks during recording. Its compileddist/index.jsdoesrequire('node-gyp-build'), but electron-builder's dependency pruning silently dropped that transitive dependency from the packagedapp.asareven though it's correctly declared inuiohook-napi's ownpackage.json. The hook failed to load withCannot find module 'node-gyp-build', so every cursor sample during a recording was type"move"— zero"click"samples — and the zoom-suggestion pipeline (which only looks at real click samples) had nothing to build zoom regions from.node-gyp-buildas a direct dependency and explicitly force it into electron-builder'sfileslist, which reliably includes it.electron-builder.json5to consistent LF line endings (it had a CRLF/LF mix that made the one-line diff unreadable).Test plan
npx tsc -p tsconfig.json --noEmit— cleannpx vitest --run— 819/819 passing[CursorTelemetry] hook loaded: true(previously:Global interaction capture unavailable: Cannot find module 'node-gyp-build').cursor.jsonsidecar recorded"click"/"mouseup"samples (previously 100%"move")