fix: support shared package manager commands - #12
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe package-manager tabs transformation now accepts shared, unprefixed package commands. It stores shared commands under the empty framework key and merges them into named framework groups. Tests and documentation cover ordering, whitespace, install modes, protocol URLs, and special characters. Tab slug and heading utility handling also changed. ChangesPackage-manager tab transformation
Priority: ⬇️ Low Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant TabsBlock
participant transformPackageManagerTabs
participant PackageManagerMeta
participant DocsTests
TabsBlock->>transformPackageManagerTabs: provide shared and framework-specific package lines
transformPackageManagerTabs->>PackageManagerMeta: emit shared and framework command groups
DocsTests->>transformPackageManagerTabs: verify ordering, modes, URLs, and special characters
Merge Risk: ⚪ Minimal · up to No actionable merge-blocking risk remains in the shared package-manager command changes. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 3 files. (4 skipped: 4 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
tannerlinsley
left a comment
There was a problem hiding this comment.
Shared package-manager commands are useful, so I am keeping this open. A few things need to be resolved before merging:
- Shared package specs can still be parsed as framework names. I reproduced
https://example.com/package.tgzbecoming thehttpsframework with//example.com/package.tgzas its package, andfile:../local-packagebecoming thefileframework. Please define and test the distinction between a framework prefix and a package protocol while preserving existingreact:packagesyntax. - Update against current main and retain its
Object.create(null)map. The current PR snapshot throws onconstructor: example; main already fixed that case, so it must survive the update. - The extension size increase needs review. Using the current esbuild measurement settings and preserving the null-prototype map, this change takes the docs preset from 2,292 to 2,383 gzip bytes (+91), tabs transforms from 1,221 to 1,326 (+105), and the full tabs export from 1,338 to 1,447 (+109). The parser stays unchanged. These exceed the current extension ceilings, so please look for offsetting simplifications rather than raising the budgets automatically.
After that, run the current pnpm run verify and external corpus audit. This is not part of the 0.0.15 release already in progress.
Package-manager tabs accept lines without a framework prefix as shared commands. Shared groups use the empty key in packagesByFramework, come first, and are also appended to each named framework group in source order. Existing `framework: package` lines keep their behavior. A framework prefix is a `[\w-]+` name followed by a colon that is not directly followed by `/` or `.`, so `https://host/pkg.tgz`, `file:../pkg`, and `git+ssh://` specifiers stay shared while `react:pkg` and `react: pkg` remain framework lines. The null-prototype map from main is retained, so `constructor` and `__proto__` prefixes still work. Bundle ceilings are unchanged; the extension growth is offset by simplifications in the tabs and shared helpers (single-pass line matching, one-literal heading sections, a merged slugify pass, and inlined bundler names). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
8697aef to
2f4b2a9
Compare
Done! |
Description
Package-manager tabs currently ignore lines without a framework prefix. Accept those lines as shared commands so framework-independent tools do not need the same commands repeated for each framework. Each source line remains a separate command group:
Shared groups use the empty key in the existing
packagesByFrameworkmetadata and precede named groups. Named groups include shared lines in source order. This works with tanstack.com's existing native package-manager component and fallback selection; no new public attribute or framework name is required.The change preserves existing prefixed commands, prefix whitespace handling, and install modes. Regression coverage includes mixed shared/framework lines and literal arguments inside fenced text. The docs describe the authoring syntax and renderer contract.
Companion website PR: TanStack/tanstack.com#1225. It remains draft until this fix is released and the website dependency is updated.
Verification
constructor/__proto__regression test still passes.[\w-]+name followed by a colon that is not directly followed by/or., sohttps://host/pkg.tgz,file:../pkg, andgit+ssh://specifiers stay shared whilereact:pkgandreact: pkgremain framework lines. This is documented and covered by a regression test../extensions/tabs-138 / -14 / -2,./extensions/docs-138 / -19 / -24.pnpm run verifypassed: 252 tests, typecheck, build, docs and skill checks, conformance, size measurements, benchmarks, and package dry run.node --import tsx scripts/audit-external-corpus.tspassed: 10,517 Markdown files audited and 813 MDX files inventoried across 20 pinned repositories.