Repository navigation
feat(packs): rank the pack queue by direct use in applications - #43
Conversation
packs/queue.json ranked by npm downloads times breaking majors, which put what everything pulls in transitively on top (undici, google-auth-library) and listed packages that move together as separate entries (react and react-dom). `pnpm packs:queue` now counts how many repositories declare a package directly: fixtures/corpus.json plus 50 public TypeScript applications pinned in scripts/packs-queue-sample.ts. It reads only their manifests, fetched shallow and blobless and cached, and installs or runs nothing. Downloads only break ties, read from registry search for tied entries. Packages that upgrade together are one entry named after the hub, using list's links (exact pins, peers), @types with their runtime package, facades with what they re-export (react-router-dom with react-router), and lockstep releases (react and react-dom, next and eslint-config-next). Families link only when released in lockstep, and peer links attach only plugins to their hosts. An entry needs at least 3 sample repositories using it and 3 behind its latest major. It also needs a breaking change in the type surface between the two majors, from the same diff check runs. Partial official codemods are linked and count half. zod, stripe and ai are excluded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B2T8GmEVnZwfNrugajEMqi Signed-off-by: Claude <[email protected]>
score = direct-use repositories × log2(1 + breaking type changes), so a major that rewrites an API outranks one that renames an option, and a widely used package still outranks a rarely used one. - A partial official codemod counts 0.9, not 0.5: it leaves the manual work a pack does, and a pack can run it as one of its rules. - At least 10 measured breaking changes to enter (counted up to 16,383, which bounds the score and lets the ranking stop diffing early). - A package the diff cannot measure (no types at `from`, or a diff failure) enters only when its changelog, recorded in CHANGELOGS, lists API changes. It is marked "not measured" and scored as 10, the least a measured entry can have. Recorded: prettier 3, eslint 10 and @babel/core 8 list API changes. nodemailer 10, jsdom 30, cross-env 10 and turbo 2 list none. - date-fns counts only its main entry's exports until the diff matches v4's subpath modules, and the entry says so. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B2T8GmEVnZwfNrugajEMqi Signed-off-by: Claude <[email protected]>
|
Re-ranked at c85f305 with the new scoring:
New top 15
Just below: @faker-js/faker (16), @opentelemetry/core (17), undici (18), googleapis (19: only 8 repos, but 13,792 changes), prettier (20, not measured), marked (21), pino (22), eslint (23, not measured, partial codemod), bullmq (24), posthog-node (25). The ones you expected
tailwindcss and express show the limit of the measure: their breaks are in config, CSS and runtime behavior, not types. If you want them in, the same changelog route could apply to packages whose type surface understates the break: a recorded changelog entry scored as 10. I haven't done that, since your rule limits it to packages without types. Measurement notes
Generated by Claude Code |
…ypes understate - A change repeated across many exports counts once. A change's shape is its kind and its before and after text with the symbol's own name taken out, and each removed or renamed export counts once. So lucide-react 1 is 102 distinct changes (92 removed or renamed icons, 10 shapes), not 7,587. Entries show both numbers (`breaking.total`, `breaking.distinct`). - Where the official migration guide lists breaking changes the type diff cannot see (CSS, configuration, runtime behavior), the entry is scored on max(distinct type changes, items the guide lists) and marked "type diff understates". GUIDES records the guide link, the sections counted and every item for 22 top-40 entries. tailwindcss 4 (31 items against 8 type changes) enters at #11. express 5 (32 against 1) is #27. Packages no diff measures are scored on their guide's items too (eslint 10: 21, prettier 3: 18). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01B2T8GmEVnZwfNrugajEMqi Signed-off-by: Claude <[email protected]>
|
Re-ranked at d169074:
New top 15
Next: prettier #16 (not measured, 18 guide items), jose #17, eslint #18 (not measured, 21 guide items, codemod ×0.9), @opentelemetry/core #19, @faker-js/faker #20, then undici, googleapis, marked, bullmq, posthog-node. express is #27: 21 repos, 32 guide items against 1 type change ("type diff understates"), 95.3 against 96.7 for #25. What moved and why
Generated by Claude Code |
…t a default's ` = ` (#44) ## What and why **Fixes:** `check` (and `diffPackage`) died with `Manipulation error: A syntax error was inserted.` on `i18next` 23 → 26 and `type-fest` 4 → 5, so those upgrades could not be analyzed at all. It was found while ranking `packs/queue.json` (#43). No issue was filed. **Root cause.** Both packages contain the same construct: a type alias that changed between versions and whose type parameters have defaults. The compat program in `packages/core/src/adapters/typescript/compat.ts` declares each changed alias's old and new body as `type __a_N<params> = body` and adds it with `addStatements`. `bodyFor` (case `'type'`) took the body from the first `' = '` in the signature. With a default, that `' = '` sits inside the type-parameter list, so the generated alias repeated the tail of its own parameter list: - type-fest: `type __a_1<Array_ extends readonly unknown[], Start extends number = never, End extends number = never> = never, End extends number = never> = ...` - i18next: `type __a_0<TOptions = object> = object> = i18nextMod.BackendModule<TOptions>;` ts-morph throws only when the broken alias's body contains a template literal type: type-fest's `CamelCase<Type, Options extends CamelCaseOptions = {}>`, i18next's `TFunctionReturn<…, ActualNS extends Namespace = NsByTOptions<Ns, TOpt>, ActualKey = KeyWithContext<Key, TOpt>>`. Without one, the broken alias didn't crash. It compiled to an error type and its comparison was silently lost. That second effect is fixed too. The recursion cut from #31 and the shared-state reset from #32 are not involved; the mis-split predates both. **Fix** (`compat.ts` only, no try/catch around it): a new `aliasBody()` finds the `>` that closes the type-parameter list and takes the alias's own `' = '` after it. The bracket-depth scan is shared with `headerTypeParams` and `countParams`, and it now ignores the `>` of `=>` and text inside string and template literals. The old scanners miscounted a `=>` inside a parameter's constraint or default. ## How it was verified - Reproduced with `diffPackage` before the fix: `type-fest ERROR Manipulation error: A syntax error was inserted.` (at `index.d.ts:233`) and `i18next ERROR …` (at `index.d.mts:64`). After: type-fest 4.41.0 → 5.10.0 gives 194 changes, and i18next 23.16.8 → 26.4.2 gives 115. - Two regression fixtures, no network, following the `recursion.test.ts` / `fixtures/deps/*-vN` convention. Both fail on main's `compat.ts` with the manipulation error and pass now: - `fixtures/deps/slice-v1`/`-v2` model type-fest: a re-exporting entry, `CamelCase<Type, Options extends CamelCaseOptions = {}>` over a template literal, and `Slice<Array_, Start extends number = never, End extends number = never>`. Result: `type breaking CamelCase` and `widened additive Slice`. - `fixtures/deps/backend-v1`/`-v2` model i18next: aliases over a namespace import, `BackendModule<TOptions = object>` → `<Options = object>`, and a `Lookup<…>` with defaulted parameters over a template literal. Result: `type breaking Lookup`. The checker finds `BackendModule`'s parameter rename equivalent. - `pnpm lint` (601 files, no fixes), `pnpm typecheck` (3/3), `pnpm test` (uptide 345/345; core 876 passed, 15 skipped, the existing env-gated ones). - Pack tests are unchanged. Each line is predicted/expected/false positives/false negatives, identical to main: | Pack | Repository | Result | | --- | --- | --- | | zod (`PASS zod: verified`) | storefront | 38/38/0/0 | | | AwesomeIntune | 12/15/0/3 | | | PATH | 39/51/0/12 | | | band-sdk | 29/37/0/8 | | stripe (`PASS stripe: verified`) | storefront | 4/4/0/0 | | | unkey | 13/15/0/2 | | | saas-starter | 1/1/0/0 | | ai (`PASS ai: verified`) | chatbot | 27/27/0/0 | | | morphic | 20/34/0/14 | ## Checklist - [x] Tests for the change (a bug fix starts with a failing test): `alias-defaults.test.ts`, both cases failing before the fix - [x] `pnpm lint && pnpm typecheck && pnpm test` pass - [x] README and docs updated if behavior changed: no doc describes this internal step - [x] Changeset added (`.changeset/alias-default-params.md`, patch) - [x] No new dependency - [x] No private code, names or paths in fixtures, tests or docs: the fixtures are minimal models, not copies of the packages - [x] The rules in CONTRIBUTING.md ("Rules that do not bend") still hold 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01B2T8GmEVnZwfNrugajEMqi --- _Generated by [Claude Code](https://claude.ai/code/session_01B2T8GmEVnZwfNrugajEMqi)_ Signed-off-by: Claude <[email protected]> Co-authored-by: Claude <[email protected]>
What and why
packs/queue.jsonranked by npm downloads × breaking majors. That put libraries everything pulls in transitively on top (undici, google-auth-library), and listed packages that upgrade together as separate entries (react, react-dom).pnpm packs:queuenow ranks by what app developers declare and how much a major breaks:score = direct-use repositories × log2(1 + breaking changes), × 0.9 with a partial official codemod. Weekly downloads only break ties.
Direct use. The number of sample repositories that declare one of the entry's packages in a
package.json(dependencies,devDependencies,optionalDependencies). The sample is the 2 repositories infixtures/corpus.jsonplus 50 public TypeScript applications pinned to commits inscripts/packs-queue-sample.ts(cal.com, twenty, dub, plane, outline, immich, n8n, posthog, grafana, sentry, …). Only manifests are read: each repository is fetched shallow and blobless at its commit, and onlypackage.json/pnpm-workspace.yamlare checked out. Nothing is installed or run. Results are cached in~/.cache/uptide/queue-sample.npm:aliases count as the aliased package,catalog:entries are resolved from pnpm catalogs, and example/template/fixture/test manifests are skipped.One entry per upgrade, named after its hub. Two packages join one entry when:
list's group logic (dependencyGroups) finds an exact pin they move together;@typespackage of the other;@next/*).Two of
list's rules are narrower here: a scope family links only members released in lockstep, and a peer link attaches only a plugin to its host. react-router keeps its own entry and says it needs react moved.Breaking changes.
fromis the major most of the repositories still behind declare;tois the latest. ≥3 sample repositories must be behind.checkruns (diffPackage). Distinct changes count: a change repeated across many exports counts once (same kind and before/after text, with the symbol's own name taken out), and each removed or renamed export counts once. lucide-react 1 is 102 distinct changes, not 7,587. Entries carrybreaking: { total, distinct, guide }.GUIDESrecords the official migration guide for 22 top-40 entries: its link, which sections were counted, and every item. An item is every heading in those sections with no heading under it, with instruction subheadings like "How to update" left out. When the guide lists more items than distinct type changes (CSS, configuration, runtime behavior), the entry is scored on the guide's count and says "type diff understates". tailwindcss 4 has 31 items against 8 type changes; express 5 has 32 against 1.@typesmember when the group has one. A package no diff measures (no types atfrom, or a diff failure) enters only when its guide or changelog lists API changes. It is marked "not measured" and scored on max(10, items listed). eslint 10 lists 21, prettier 3 lists 18 and @babel/core 8 lists 15. nodemailer 10, jsdom 30, cross-env 10 and turbo 2 list none.MAIN_ENTRY_ONLY), because the diff does not match v4's subpath modules yet. Its entry says so.Codemods. An official codemod that covers the upgrade end to end drops the entry; none qualified. A partial one is linked in
codemodand counts 0.9: it leaves the manual work a pack does, and a pack can run it as one of its rules. The five partial ones (next, react, tailwindcss, eslint, express) come from each project's own upgrade guide.Out: zod, stripe and ai (and anything grouped with them), packages declared in fewer than 3 sample repositories, and
typescriptand@types/node(NOT_A_PACK: a compiler and the runtime).Entries gain
members,repos,reposBehind,breakingandcodemod.weeklyDownloadsstays, andbreakingMajors2yis gone.docs/packs.mddescribes the ranking.Network:
api.npmjs.orgis not reachable from the environment this ran in, so downloads come fromregistry.npmjs.org's search results, which carry the same weekly count. The script needs only github.com and registry.npmjs.org.The new top 15
With a "why it's worth a pack" for each entry: this comment.
prettier is #16 (not measured, 18 guide items) and eslint #18 (not measured, 21 guide items, codemod ×0.9). express is #27 (32 guide items against 1 type change, type diff understates), just outside the 25 entries
queue.jsonkeeps.How it was verified
pnpm packs:queueruns end to end against the pinned sample: 52 repositories and 1,340 packages declared in ≥3 of them. The diffs are cached in~/.cache/uptide/queue-diff, and a rerun from cache takes under 30 s.GUIDES.pnpm lintis clean, andqueue.jsonis written through the repository's Biome. The two scripts typecheck under--strictwith the source condition. Repository typecheck and tests don't coverscripts/, and no package code changed.x.0.0versions linked rehype-slug with ioredis;globals16.4.0, which looked like a facade.=#44. Until it merges, the script reports both as diff failures and leaves them out.Checklist
scripts/, so the generated file and the run output above are the checkpnpm lintpasses (typecheck and tests are unaffected: onlyscripts/,packs/anddocs/change)docs/packs.md)no-changesetlabel)🤖 Generated with Claude Code
https://claude.ai/code/session_01B2T8GmEVnZwfNrugajEMqi