Repository navigation
perf: tree-shake web-haptics out of triggerHaptic imports (−62% gzip) - #42
Merged
Merged
Conversation
This was referenced Oct 21, 2026
Merged
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.
Closes #36
What
trigger.tsnow reads the 11 presets from a localsrc/presets.tsliteral instead of importingdefaultPatternsfromweb-haptics.web-hapticsis only imported for types there.HapticTargetstill usesWebHapticsunchanged. A new drift test (test/presets.test.ts) deep-equals the local table againstweb-haptics'defaultPatterns, so a dependency bump that changes presets fails CI.Implemented with the Codex CLI on the shared box and verified by hand.
Benchmark (
npm run bench, same box, back-to-back)78ec2f2triggerHapticgzip bytestriggerHapticmin bytestriggerHapticweb-haptics bytesHapticTargetgzip bytesByte counts are deterministic. Runtime timings did not change beyond noise.
Verification
npm run lint,typecheck(ESM+CJS+DTS build),coverage(135 tests, 100% statements/branches/functions/lines),size,pack:checkpass locally.web-hapticsmodule, which removes anavigatorread at module load.navigator.vibrateoutput (existing trigger tests unchanged and passing).Device-testing notes
These are simulated-browser and bundler numbers (Node 24, jsdom/esbuild on a Linux box), not physical-device measurements. No physical device was used. Physical iPhone/Android/iPadOS/VoiceOver certification remains tracked in #9.