Skip to content

feat: integrate with tsgo (with Rslib)#1685

Merged
colinaaa merged 5 commits intolynx-family:mainfrom
colinaaa:colin/0909/tsgo
Sep 11, 2025
Merged

feat: integrate with tsgo (with Rslib)#1685
colinaaa merged 5 commits intolynx-family:mainfrom
colinaaa:colin/0909/tsgo

Conversation

@colinaaa
Copy link
Copy Markdown
Collaborator

@colinaaa colinaaa commented Sep 9, 2025

Summary by CodeRabbit

  • Documentation

    • Refined TypeScript API typings in testing-environment (stricter parameter types; internal fields annotated in public interfaces).
  • Chores

    • Adopted tsgo-based declaration generation across multiple packages; explicitly disabled in one where depth issues occur.
    • Removed baseUrl from several build tsconfigs to simplify module resolution.
    • Updated devDependencies: bumped @rslib/core and added @typescript/native-preview.
    • Added VS Code setting to enable experimental TypeScript behavior.
    • Added a placeholder changeset entry.
  • Tests

    • No changes.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).
  • Changeset added, and when a BREAKING CHANGE occurs, it needs to be clearly marked (or not required).

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Sep 9, 2025

🦋 Changeset detected

Latest commit: 573639e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When 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

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 9, 2025

📝 Walkthrough

Walkthrough

This 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

Cohort / File(s) Summary of Changes
Repo tooling & dependencies
package.json, .vscode/settings.json, .changeset/*
Added @typescript/native-preview devDependency; bumped @rslib/core to ^0.13.1. Enabled VS Code typescript.experimental.useTsgo. Added placeholder changeset file.
RSlib DTS config (tsgo adoption)
packages/react/testing-library/rslib.config.ts, packages/rspeedy/plugin-qrcode/rslib.config.ts, packages/rspeedy/plugin-react-alias/rslib.config.ts, packages/rspeedy/plugin-react/rslib.config.ts, packages/testing-library/testing-environment/rslib.config.ts, packages/third-party/tailwind-preset/rslib.config.ts, packages/web-platform/web-core-server/rslib.config.ts, packages/web-platform/web-rsbuild-plugin/rslib.config.ts, packages/rspeedy/core/rslib.config.ts
Switched dts options to object form with tsgo flag in multiple libraries (true in most; false in rspeedy/core first entry). Some entries retain bundle: true while adding tsgo.
TS project configs
packages/rspeedy/plugin-qrcode/tsconfig.build.json, packages/rspeedy/plugin-react/tsconfig.build.json, packages/third-party/tailwind-preset/tsconfig.build.json
Removed baseUrl from compilerOptions; other options unchanged.
API report updates
packages/testing-library/testing-environment/etc/testing-environment.api.md
Adjusted method parameter typings/order; widened optional types; added internal fields to LynxElement and LynxGlobalThis; appended package-level doc marker.
Type annotation refinement
packages/rspeedy/plugin-react/src/splitChunks.ts
Added explicit function type annotation to applySplitChunksRule; no body changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • refactor: bundle web-core-server #819 — Touches packages/web-platform/web-core-server/rslib.config.ts; earlier addition of this config is directly related to the current change of its dts shape to include tsgo.

Suggested labels

platform:Web, framework:React

Suggested reviewers

  • gaoachao
  • luhc228
  • Yradex

Poem

Hop hop! I tweak the types at dawn,
Little flags of tsgo on the lawn.
BaseUrls burrowed, configs aligned,
Decls now bundled, neatly signed.
With whisker-quill I stamp and cheer—
Another tidy carrot of the year! 🥕

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.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

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)
Check name Status Explanation
Title Check ✅ Passed The title succinctly and accurately summarizes the primary change — integrating tsgo support via the project's Rslib configuration — and directly reflects the bulk of edits (rslib.config.ts dts options, package.json additions/updates, and related build config changes), so it is clear and on-topic for a quick scan of PR history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Sep 11, 2025

Web Explorer

#5085 Bundle Size — 362.79KiB (0%).

573639e(current) vs 69b3ae0 main#5083(baseline)

Bundle metrics  Change 1 change
                 Current
#5085
     Baseline
#5083
No change  Initial JS 145.21KiB 145.21KiB
No change  Initial CSS 31.89KiB 31.89KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 219(+0.46%) 218
No change  Duplicate Modules 16 16
No change  Duplicate Code 3.34% 3.34%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5085
     Baseline
#5083
No change  JS 236.88KiB 236.88KiB
No change  Other 94.02KiB 94.02KiB
No change  CSS 31.89KiB 31.89KiB

Bundle analysis reportBranch colinaaa:colin/0909/tsgoProject dashboard


Generated by RelativeCIDocumentationReport issue

@relativeci
Copy link
Copy Markdown

relativeci Bot commented Sep 11, 2025

React Example

#5092 Bundle Size — 238.2KiB (0%).

573639e(current) vs 69b3ae0 main#5090(baseline)

Bundle metrics  no changes
                 Current
#5092
     Baseline
#5090
No change  Initial JS 0B 0B
No change  Initial CSS 0B 0B
No change  Cache Invalidation 0% 0%
No change  Chunks 0 0
No change  Assets 4 4
No change  Modules 163 163
No change  Duplicate Modules 67 67
No change  Duplicate Code 46.88% 46.88%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#5092
     Baseline
#5090
No change  IMG 145.76KiB 145.76KiB
No change  Other 92.45KiB 92.45KiB

Bundle analysis reportBranch colinaaa:colin/0909/tsgoProject dashboard


Generated by RelativeCIDocumentationReport issue

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Sep 11, 2025

CodSpeed Performance Report

Merging #1685 will not alter performance

Comparing colinaaa:colin/0909/tsgo (573639e) with main (69b3ae0)

Summary

✅ 53 untouched benchmarks

@colinaaa colinaaa marked this pull request as ready for review September 11, 2025 08:52
@colinaaa colinaaa requested a review from PupilTong as a code owner September 11, 2025 08:52
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.cacheGroups will throw if cacheGroups is undefined. 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: true if 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 guard

The 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 note

Add 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6581737 and 573639e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is 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 tsgo

If previous dts: true produced a bundled .d.ts, explicitly add bundle: true to 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: true but lack bundle: 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 verified

Root 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 config

packages/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 — LGTM

This 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

__SetCSSId accepting LynxElement[] | LynxElement is a safe enhancement for callers.


53-53: Minor signature normalization — OK

ref?: LynxElement | undefined is equivalent to ref?: 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.

@colinaaa colinaaa merged commit 2800dce into lynx-family:main Sep 11, 2025
51 checks passed
@colinaaa colinaaa deleted the colin/0909/tsgo branch September 11, 2025 09:18
@coderabbitai coderabbitai Bot mentioned this pull request Dec 2, 2025
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants