feat: integrate with tsgo (with Rslib)#1685
Conversation
🦋 Changeset detectedLatest commit: 573639e The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughThis PR updates multiple build and editor configurations to adopt tsgo-based DTS generation, adjusts TypeScript project settings, refines a function’s type annotation, and refreshes an API report. No runtime logic changes are introduced. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. Pre-merge checks (3 passed)✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
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 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Web Explorer#5085 Bundle Size — 362.79KiB (0%).573639e(current) vs 69b3ae0 main#5083(baseline) Bundle metrics
Bundle size by type
|
| Current #5085 |
Baseline #5083 |
|
|---|---|---|
236.88KiB |
236.88KiB |
|
94.02KiB |
94.02KiB |
|
31.89KiB |
31.89KiB |
Bundle analysis report Branch colinaaa:colin/0909/tsgo Project dashboard
Generated by RelativeCI Documentation Report issue
React Example#5092 Bundle Size — 238.2KiB (0%).573639e(current) vs 69b3ae0 main#5090(baseline) Bundle metrics
|
| Current #5092 |
Baseline #5090 |
|
|---|---|---|
0B |
0B |
|
0B |
0B |
|
0% |
0% |
|
0 |
0 |
|
4 |
4 |
|
163 |
163 |
|
67 |
67 |
|
46.88% |
46.88% |
|
2 |
2 |
|
0 |
0 |
Bundle size by type no changes
| Current #5092 |
Baseline #5090 |
|
|---|---|---|
145.76KiB |
145.76KiB |
|
92.45KiB |
92.45KiB |
Bundle analysis report Branch colinaaa:colin/0909/tsgo Project dashboard
Generated by RelativeCI Documentation Report issue
CodSpeed Performance ReportMerging #1685 will not alter performanceComparing Summary
|
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
packages/rspeedy/plugin-react/src/splitChunks.ts (1)
71-77: Guard cacheGroups in object spread to avoid runtime TypeError
...currentConfig.cacheGroupswill throw ifcacheGroupsisundefined. Safer to default to{}.Apply:
chain.optimization.splitChunks({ ...currentConfig, cacheGroups: { - ...currentConfig.cacheGroups, + ...(currentConfig.cacheGroups ?? {}), ...extraGroups, }, })
🧹 Nitpick comments (4)
packages/testing-library/testing-environment/rslib.config.ts (1)
18-18: Be explicit about DTS bundling for consistency.If consumers relied on a single .d.ts, consider adding
bundle: true; otherwise, ignore.- dts: { tsgo: true }, + dts: { bundle: true, tsgo: true },packages/third-party/tailwind-preset/rslib.config.ts (1)
12-12: Align DTS config with desired output shape.Same note: add
bundle: trueif you want to keep a single declaration file.- dts: { tsgo: true }, + dts: { bundle: true, tsgo: true },packages/rspeedy/core/rslib.config.ts (1)
11-17: tsgo disabled due to depth issues — sensible guardThe inline rationale is clear. Consider tracking this with an issue ID to revisit enabling tsgo here once upstream resolves the excessive depth error.
packages/testing-library/testing-environment/etc/testing-environment.api.md (1)
120-121: Add @packageDocumentation to silence the report noteAdd a package-level doc comment in the public entry (e.g., src/index.ts) to remove “No @packageDocumentation”:
/** @packageDocumentation * Testing environment utilities for the Lynx stack. */
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (17)
.changeset/tricky-papers-pick.md(1 hunks).vscode/settings.json(1 hunks)package.json(1 hunks)packages/react/testing-library/rslib.config.ts(1 hunks)packages/rspeedy/core/rslib.config.ts(1 hunks)packages/rspeedy/plugin-qrcode/rslib.config.ts(1 hunks)packages/rspeedy/plugin-qrcode/tsconfig.build.json(0 hunks)packages/rspeedy/plugin-react-alias/rslib.config.ts(1 hunks)packages/rspeedy/plugin-react/rslib.config.ts(1 hunks)packages/rspeedy/plugin-react/src/splitChunks.ts(1 hunks)packages/rspeedy/plugin-react/tsconfig.build.json(0 hunks)packages/testing-library/testing-environment/etc/testing-environment.api.md(5 hunks)packages/testing-library/testing-environment/rslib.config.ts(1 hunks)packages/third-party/tailwind-preset/rslib.config.ts(1 hunks)packages/third-party/tailwind-preset/tsconfig.build.json(0 hunks)packages/web-platform/web-core-server/rslib.config.ts(1 hunks)packages/web-platform/web-rsbuild-plugin/rslib.config.ts(1 hunks)
💤 Files with no reviewable changes (3)
- packages/rspeedy/plugin-qrcode/tsconfig.build.json
- packages/third-party/tailwind-preset/tsconfig.build.json
- packages/rspeedy/plugin-react/tsconfig.build.json
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md
📄 CodeRabbit inference engine (AGENTS.md)
For contributions, always generate a changeset and commit the resulting markdown file(s)
Files:
.changeset/tricky-papers-pick.md
packages/**/etc/*.api.md
📄 CodeRabbit inference engine (AGENTS.md)
Always run API extractor and commit all updated API report files
Files:
packages/testing-library/testing-environment/etc/testing-environment.api.md
🧠 Learnings (3)
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:26:16.722Z
Learning: In the lynx-family/lynx-stack repository, CI checks require changesets when files matching the pattern "src/**" are modified (as configured in .changeset/config.json). For internal changes that don't need meaningful changesets, an empty changeset file is used to satisfy the CI requirement while not generating any release notes.
Applied to files:
.changeset/tricky-papers-pick.md
📚 Learning: 2025-09-09T12:38:10.450Z
Learnt from: CR
PR: lynx-family/lynx-stack#0
File: AGENTS.md:0-0
Timestamp: 2025-09-09T12:38:10.450Z
Learning: Applies to .changeset/*.md : For contributions, always generate a changeset and commit the resulting markdown file(s)
Applied to files:
.changeset/tricky-papers-pick.md
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
PR: lynx-family/lynx-stack#1497
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_full_static.js:9-10
Timestamp: 2025-08-12T16:09:32.413Z
Learning: In the Lynx stack, functions prefixed with `__` that are called in transformed code may be injected globally by the Lynx Engine at runtime rather than exported from the React runtime package. For example, `__CreateFrame` is injected globally by the Lynx Engine, not exported from lynx-js/react.
Applied to files:
packages/testing-library/testing-environment/etc/testing-environment.api.md
🧬 Code graph analysis (1)
packages/rspeedy/plugin-react/src/splitChunks.ts (1)
packages/rspeedy/core/src/index.ts (1)
RsbuildPluginAPI(67-67)
🔇 Additional comments (14)
.changeset/tricky-papers-pick.md (1)
1-3: Empty changeset placeholder: confirm intent (no release).Per repo learnings, this satisfies CI. If any of the tsgo-driven DTS changes are intended to ship, replace with a proper changeset enumerating affected packages and bumps.
.vscode/settings.json (1)
35-35: VS Code tsgo flag may be inert with current TS SDK path.You added @typescript/native-preview, but "typescript.tsdk" points to node_modules/typescript/lib. Please confirm VS Code is actually using the preview TS that understands the tsgo flag; otherwise either point tsdk to the preview SDK or drop this setting.
package.json (1)
22-22: Dev preview and rslib bump: sanity-check CI/build matrix.
- @rslib/core ^0.13.1: confirm it’s the minimum needed for dts.tsgo support across all packages.
- @typescript/native-preview 7.0.0-dev…: ensure CI caches/lockfile stability and editor compatibility; consider pinning via a renovate rule if this must stay on a dev cut.
Also applies to: 28-28
packages/rspeedy/plugin-react-alias/rslib.config.ts (1)
5-5: Preserve DTS bundling when enabling tsgoIf previous
dts: trueproduced a bundled .d.ts, explicitly addbundle: trueto avoid output-shape drift.Suggested change (packages/rspeedy/plugin-react-alias/rslib.config.ts):
- { format: 'esm', syntax: 'es2022', dts: { tsgo: true } }, + { format: 'esm', syntax: 'es2022', dts: { bundle: true, tsgo: true } },Also review these configs that set
tsgo: truebut lackbundle: true:
- packages/web-platform/web-core-server/rslib.config.ts
- packages/third-party/tailwind-preset/rslib.config.ts
- packages/testing-library/testing-environment/rslib.config.ts
- packages/rspeedy/plugin-qrcode/rslib.config.ts
packages/web-platform/web-rsbuild-plugin/rslib.config.ts (1)
5-5: LGTM: tsgo enabled with bundled DTS.Matches the repo-wide pattern; output shape should stay consolidated.
packages/react/testing-library/rslib.config.ts (1)
45-49: LGTM: enable tsgo on the bundled types entry.Keep an eye on API report diffs from tsgo’s emitter, but the config looks consistent.
packages/rspeedy/plugin-react/rslib.config.ts (1)
8-8: Enable tsgo for DTS bundle — toolchain verifiedRoot package.json declares @rslib/core: ^0.13.1 and @typescript/native-preview: 7.0.0-dev.20250908.1; rslib configs across the repo (e.g., packages/rspeedy/plugin-react/rslib.config.ts — dts: { bundle: true, tsgo: true }) have tsgo enabled and no unexpected tsgo:false occurrences were found.
packages/web-platform/web-core-server/rslib.config.ts (1)
8-8: Enable tsgo — pin tsconfig or add build configpackages/web-platform/web-core-server/rslib.config.ts enables tsgo, but packages/web-platform/web-core-server/tsconfig.build.json is missing; add that file or set source.tsconfigPath to an existing tsconfig (e.g. './tsconfig.json') so tsgo uses the intended config.
packages/rspeedy/plugin-qrcode/rslib.config.ts (1)
5-5: Confirm DTS bundling strategy (per-file tsgo vs rolled-up bundle)plugin-qrcode and plugin-react-alias use dts: { tsgo: true } (per-file); plugin-react and core use dts: { bundle: true, tsgo: true } (rolled-up). Decide which strategy you want — if a single rolled-up .d.ts is desired, set dts: { bundle: true, tsgo: true }; otherwise make the per-file choice intentional. Affected files: packages/rspeedy/plugin-qrcode/rslib.config.ts, packages/rspeedy/plugin-react-alias/rslib.config.ts, packages/rspeedy/plugin-react/rslib.config.ts, packages/rspeedy/core/rslib.config.ts
packages/rspeedy/plugin-react/src/splitChunks.ts (1)
30-33: Explicit function type to stabilize d.ts — LGTMThis helps tsgo produce stable declarations; no runtime changes.
packages/testing-library/testing-environment/etc/testing-environment.api.md (4)
38-38: Widened parameter type is backward compatible — OK
__SetCSSIdacceptingLynxElement[] | LynxElementis a safe enhancement for callers.
53-53: Minor signature normalization — OK
ref?: LynxElement | undefinedis equivalent toref?: LynxElement; acceptable API report churn.
71-84: Internal fields surfaced in report — confirmed @internal in source@internal annotations are present in packages/testing-library/testing-environment/src/lynx/GlobalThis.ts and packages/testing-library/testing-environment/src/lynx/ElementPAPI.ts; keep these JSDoc tags so consumers don’t rely on those fields.
1-122: Per guidelines: re-run API Extractor and commit all updated reports. Verification script produced no output so I couldn't confirm whether packages//etc/*.api.md were regenerated — re-run API Extractor across all packages and commit any updated packages//etc/*.api.md files.
Summary by CodeRabbit
Documentation
Chores
Tests
Checklist