Repository navigation
feat(cache): ./elf consumer entry for npm-static builds - #48
Merged
Merged
Conversation
Add the "./elf": "./dist/esm/index.js" export so scriptc's --npm-static consumers can import @cutils/cache/elf (the postgres pattern). The shipped dist JS already satisfies the consumer compile contract with no JSDoc additions: audited by packing the tarball, installing it into a scratch app, and scriptc build + run of programs covering new Cache()/get/set/has/delete/peek/size/clear, per-set ttl override, fake-clock expiry, and option validation — all compile and run statically with zero errors. Add test/consumer-elf.test.sh (mirrors postgres's): packs the package, installs it into build/consumer-smoke/, compiles the get/set/ttl matrix against @cutils/cache/elf with --npm-static, runs the ELF. Wire it into pnpm test. Document the consumer compile contract in packages/cache/AGENTS.md.
Deploying cutilsjs with
|
| Latest commit: |
c7b035f
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://cfc2bf0d.cutilsjs.pages.dev |
| Branch Preview URL: | https://feat-cache-elf-export.cutilsjs.pages.dev |
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.
What
Adds
"./elf": "./dist/esm/index.js"to@cutils/cache(the pattern @cutils/postgres already ships) soscriptc build --npm-staticconsumers can import@cutils/cache/elf, plus a consumer-side ELF smoke test that guards it.Audit (deliverable 1)
Packed the tarball, installed into a scratch app, compiled and ran two programs under
--npm-static:new Cache()+ get/set/has/delete/size) — compiled and ran clean, zero errorsttloverride, fake-clock expiry via the positionalnowseam,E_BAD_CACHE_OPTIONSvalidation, eviction with recency bump) — compiled and ran cleanNo SC9001/
nullT, no SC2020, no SC1090, no JSDoc gaps: the shippeddist/esmJS is already fully concretely typed (initialized fields, typed params), so no JSDoc annotations were needed. The./elfexport was therefore fixable and shipped rather than documented as unshippable.Consumer smoke (deliverable 3)
test/consumer-elf.test.shmirrors postgres's:pnpm pack-> install tarball intobuild/consumer-smoke/->scriptc build app.ts --npm-static @cutils/cache -o app-elf-> run the ELF (get/set/has/delete/peek/TTL-expiry/clear/validation matrix). Wired intopnpm test. Contract documented inpackages/cache/AGENTS.md.Verification
pnpm buildclean;node --test: 25 pass / 0 failscriptc coverage gate.ts: 100% static (82/82 statements)bash test/elf.test.sh: OKbash test/consumer-elf.test.sh: OKoxfmt --check+oxlint: clean@cutils/cacheminor