v0.28.2 - JunkPocket Refactoring (2026-03-21)¶
What Changed?¶
This release refactors JunkPocket in the gears module to improve correctness and consistency.
The clearIf method now uses a safe two-phase deletion pattern, and redundant code such as the size accessor override and duplicate globalThis registration have been removed.
Documentation has also been updated to reflect these changes.
What's New¶
Main Feature: JunkPocket Refactoring¶
What it does:
Cleans up the JunkPocket class to remove unnecessary overrides, fix a potentially unsafe iteration pattern, and align globalThis registration with the rest of the gears module.
How to use it:
No API changes. Existing code using JunkPocket continues to work as before.
Code example:
TypeScript
const cache = new JunkPocket<string>("MyCache");
// clearIf now uses two-phase deletion internally (safe against live-iterator mutation)
cache.clearIf((key, value) => key.startsWith("temp"));
// size is inherited from Map — no behavior change
Logger.log(cache.size);
Added¶
- None
Changed¶
clearIf: replaced live-iterator deletion with two-phase collection-then-delete pattern@grouptag in all member docstrings corrected fromTorchtoGearsdocs/modules/junkpocket.md: rewritten in English, updated to reflect current implementationdocs/modules/gears/caching-junkpocket.md: correctedcache.size()→cache.sizein all code examples
Fixed¶
fix(taskfile): addignore_errortodeps:check:npmtaskfix(pre-commit): exclude generated bundle map andbundle-analysis.htmlfromend-of-file-fixerfix(taskfile): correctprecommittask name topre-commitfix(jest): excludespecs/directory from coverage collection
Removed¶
JunkPocket.sizeaccessor override (redundant —Map.sizeis alreadypublic readonly)- Duplicate
globalThis.JunkPocketregistration injunkpocket.ts(already handled byindex.ts)
Is It Safe to Upgrade?¶
- Breaking Changes: No
- Backward Compatible: Yes
All public APIs remain unchanged. The refactoring is internal only.
Release Details¶
- Date: 2026-03-21
- Version: v0.28.2
- gaslamp: (unchanged)
- pilotlamp: (unchanged)
- Files Changed: 109
- Commits:
1ee7157bump: version 0.28.1 → 0.28.2ec26920docs(gears): fix remaining cache.size() calls to cache.sizef860c2edocs(gears): rewrite junkpocket.md in English9aa86dfdocs(gears): fix cache.size() to cache.size in caching-junkpocket.md61a834arefactor(gears): remove redundant size accessor override in JunkPocket21e5579refactor(gears): use two-phase deletion in clearIfadaba9cdocs(gears): fix @group tag from Torch to Gears in junkpocket.ts1e07e4erefactor(gears): remove duplicate globalThis registration from junkpocket.ts156c8f5docs(taskfile): add inline comments to all tasks for clarityf89c7f5refactor(taskfile): remove pre-commit side effect from docs:api4ec1564fix(taskfile): add ignore_error to deps:check:npm taskfa68934fix(pre-commit): exclude generated bundle map and bundle-analysis.htmlb38d5d4fix(taskfile): correct precommit task name to pre-commit17bb0fafix(jest): exclude specs/ directory from coverage collection
Known Issues¶
- None
Next Steps¶
- Add dedicated unit tests for
JunkPocket(__tests__/gears/junkpocket.test.ts)