feat: shorter bookmarklet URLs (4.3.0) - #464
Merged
Merged
Conversation
Leave `:=,/;$@+?` unescaped in bookmarklet URLs. They are legal in URL fragments and inert in HTML attributes and Markdown link destinations. Total dist size drops 11,895 -> 10,749 bytes (-9.6%); UtmStrip -534. - Add encodeBookmarklet/validateEncodedBookmarklet to scripts/utils.js (keeps leading "/" encoded, encodes parens if unbalanced or >32 deep, self-validates with a WHATWG URL round trip) - Use a function replacer in update-readme.js so `$` in code can't be treated as a replacement pattern - Add scripts/test-encoding.js and run it from `npm test` - Patch-bump all 21 bookmarklets; bump project to 4.3.0 - Bump @types/node to ~26.6.3 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
npm ci failed in CI because the lockfile still pinned @types/node 26.6.2. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
:=,/;$@+?unescaped injavascript:bookmarklet URLs. They are legal in URL fragments and inert in HTMLhrefvalues and Markdown link destinations.encodeBookmarklet/validateEncodedBookmarkletinscripts/utils.jsself-validate every build (WHATWG URL round trip, allowlist, balanced parens). A leading/stays encoded and unbalanced or deeply nested parens are encoded.update-readme.jsnow uses a function replacer, so$',$&and$1in code can't corrupt README.md.scripts/test-encoding.js(31 checks, including all 21 dist files), wired intonpm test.@types/node~26.6.3 bump.Still encoded:
\ & < > " # % \`` and* _(Markdown emphasis);{}[]|^` left alone for a future iteration.Test plan
npm test(78/78 utmstrip, 31 encoding, verify-build)npx eslint .andnpm run lint:mddist/git diff README.mdshows only links, versions and the new notesth=1in the address bar is Amazon re-adding it on reload; clipboard copy is clean),/;$@+?literal after copy🤖 Generated with Claude Code