Skip to content

refactor: align Lynx terminology with official specification#2276

Open
Huxpro wants to merge 8 commits intomainfrom
Huxpro/fetch-lynx-docs-v1
Open

refactor: align Lynx terminology with official specification#2276
Huxpro wants to merge 8 commits intomainfrom
Huxpro/fetch-lynx-docs-v1

Conversation

@Huxpro
Copy link
Collaborator

@Huxpro Huxpro commented Feb 28, 2026

Summary

Add official API aliases (LynxBundle, BundleLoader, LynxBundlePlugin, BundleHooks, LynxBundlePluginOptions, DecodedBundle, BundleSectionLabel) for legacy internal names to align with the official lynxjs.org specification. Mark deprecated names with @deprecated JSDoc tags to guide users to official terminology while maintaining full backward compatibility.

Add comprehensive JSDoc clarifications explaining the mapping between internal field names and official spec terms, plus wire format constraints. Remove redundant call-site comments since IDEs will automatically show @deprecated warnings.

Affected npm packages

  • @lynx-js/web-constants: Exports LynxBundle (alias), BundleLoader (alias)
  • @lynx-js/template-webpack-plugin: Exports LynxBundlePlugin (alias), BundleHooks (alias), LynxBundlePluginOptions (alias)
  • @lynx-js/web-core: Re-exports LynxBundle
  • @lynx-js/rspeedy-plugin-react: Re-exports LynxBundlePlugin, BundleHooks
  • @lynx-js/web-core-wasm: Internal aliases (not public API)

Summary by CodeRabbit

  • Refactor

    • Renamed public "Template" terminology to "Bundle" across the public API, adding deprecated aliases to preserve compatibility
    • Adjusted legacy naming to prefer "Main Thread Script (MTS)" and "Background Thread Script (BTS)"
  • New Features

    • Added new public bundle-related types and re-exports (Bundle, BundleHooks, BundleLoader, DecodedBundle, LynxBundlePlugin)
    • Introduced a new RPC endpoint to invoke runtime methods
  • Documentation

    • Expanded and clarified JSDoc for MTS/BTS, deprecated aliases, and plugin options
  • Tests

    • Updated tests to include a stub API during plugin initialization

Checklist

  • Tests not required (JSDoc and type aliases only)
  • Documentation updated (JSDoc comments added)
  • Changeset added (check if required for aliases)

Copilot AI review requested due to automatic review settings February 28, 2026 10:42
@changeset-bot
Copy link

changeset-bot bot commented Feb 28, 2026

🦋 Changeset detected

Latest commit: 97e5db3

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

This PR includes changesets to release 15 packages
Name Type
@lynx-js/web-constants Patch
@lynx-js/web-core Patch
@lynx-js/react-webpack-plugin Patch
@lynx-js/template-webpack-plugin Patch
@lynx-js/react-rsbuild-plugin Patch
@lynx-js/web-core-server Patch
@lynx-js/web-mainthread-apis Patch
@lynx-js/web-worker-runtime Patch
upgrade-rspeedy Patch
@lynx-js/web-rsbuild-server-middleware Patch
@lynx-js/react-alias-rsbuild-plugin Patch
create-rspeedy Patch
@lynx-js/web-worker-rpc Patch
@lynx-js/rspeedy Patch
@lynx-js/web-core-wasm Patch

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
Contributor

coderabbitai bot commented Feb 28, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR renames template-centered public types and interfaces to bundle-centered names across multiple packages (e.g., LynxTemplate → LynxBundle, TemplateHooks → BundleHooks, LynxTemplatePlugin → LynxBundlePlugin), adds deprecated aliases, and updates documentation to use Main Thread Script (MTS) / Background Thread Script (BTS) terminology.

Changes

Cohort / File(s) Summary
rspeedy Plugin React
packages/rspeedy/plugin-react/src/index.ts, packages/rspeedy/plugin-react/src/pluginReactLynx.ts, packages/rspeedy/plugin-react/etc/react-rsbuild-plugin.api.md, packages/rspeedy/plugin-react/test/config.test.ts
Re-exported renamed plugin types: LynxBundlePlugin and BundleHooks (with deprecated aliases to legacy names); updated doc comments to MTS/BTS; tests add pluginStubRspeedyAPI() before pluginReactLynx in two cases.
Web Constants & Types
packages/web-platform/web-constants/src/types/LynxModule.ts, packages/web-platform/web-constants/src/types/TemplateLoader.ts, packages/web-platform/web-constants/src/endpoints.ts, packages/web-platform/web-core/src/index.ts
Renamed LynxTemplateLynxBundle (deprecated alias preserved); TemplateLoaderBundleLoader alias; added callLepusMethodEndpoint; re-exported LynxBundle.
Web Core WASM & Types
packages/web-platform/web-core-wasm/ts/constants.ts, packages/web-platform/web-core-wasm/ts/types/DecodedTemplate.ts, packages/web-platform/web-core-wasm/ts/encode/webEncoder.ts
Introduced BundleSectionLabel (mapping legacy fields with deprecation notes); renamed DecodedTemplateDecodedBundle with deprecated alias; added inline JSDoc clarifications.
Web Mainthread APIs
packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts, packages/web-platform/web-mainthread-apis/ts/crossThreadHandlers/registerCallLepusMethodHandler.ts
Added lynxTemplate to MainThreadRuntimeConfig and added/clarified JSDoc for __LoadLepusChunk / legacy Lepus naming; handler JSDoc added (no signature changes).
Webpack React Plugin
packages/webpack/react-webpack-plugin/src/ReactWebpackPlugin.ts, packages/webpack/react-webpack-plugin/src/loaders/options.ts
Documentation updates replacing “Lepus” with “Main Thread Script (MTS)” and clarifying MAIN_THREAD legacy path segment.
Webpack Template Plugin
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts, packages/webpack/template-webpack-plugin/src/LynxEncodePlugin.ts, packages/webpack/template-webpack-plugin/src/WebEncodePlugin.ts, packages/webpack/template-webpack-plugin/src/index.ts, packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
Wide public API rename: TemplateHooksBundleHooks, LynxTemplatePluginOptionsLynxBundlePluginOptions, introduced LynxBundlePlugin alias and OriginManifest (deprecated); hook types and JSDoc updated; runtime behavior unchanged; deprecated aliases added across API docs.
Repository Changeset / Docs
.changeset/align-lynx-terminology.md
Adds deprecation-guidance and documents new preferred bundle-centered public type names and aliases across packages.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • PupilTong
  • upupming
  • Sherry-hue
  • colinaaa
  • luhc228

Poem

🐇 I hopped through types and changed the name,
Bundles now wear templates’ former fame.
Old aliases linger, polite and slow,
MTS and BTS in doclights glow.
A tiny rabbit stamps — the refactor’s done. 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main change: aligning Lynx terminology with the official specification. The changeset systematically renames types and exports across multiple packages to use new canonical names (e.g., LynxBundle, BundleHooks) while maintaining backward compatibility through deprecated aliases.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch Huxpro/fetch-lynx-docs-v1

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


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

codecov bot commented Feb 28, 2026

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!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds official API aliases (e.g., LynxBundle, BundleLoader, LynxBundlePlugin, BundleHooks) for legacy internal names to align with the official lynxjs.org specification, while preserving full backward compatibility. Legacy names are marked with @deprecated JSDoc tags. Additionally, inline documentation is improved to clarify the mapping between internal field names (e.g., lepusCode, manifest) and their official spec equivalents (MTS/BTS).

Changes:

  • New type/value aliases added for spec-aligned naming across multiple packages (web-constants, template-webpack-plugin, web-core, web-core-wasm)
  • @deprecated JSDoc tags added to legacy types/classes; documentation updated to reference official Lynx terminology
  • Unrelated changes to pnpm-workspace.yaml (adds non-existent packages/repl) and pnpm-lock.yaml (bumps several packages to @rsbuild/core@2.0.0-beta.3)

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pnpm-workspace.yaml Adds packages/repl entry (directory does not exist)
pnpm-lock.yaml Several packages now resolve against @rsbuild/core@2.0.0-beta.3; unrelated to stated PR purpose
packages/webpack/template-webpack-plugin/src/index.ts Exports new LynxBundlePlugin, LynxBundlePluginOptions, BundleHooks aliases
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts Adds @deprecated to legacy types; introduces LynxBundlePlugin, BundleHooks, LynxBundlePluginOptions aliases; improves JSDoc
packages/webpack/template-webpack-plugin/src/LynxEncodePlugin.ts Updates inline comment for app-service.js BTS entry point name
packages/webpack/template-webpack-plugin/src/WebEncodePlugin.ts Updates inline comment for app-service.js BTS entry point name
packages/webpack/react-webpack-plugin/src/loaders/options.ts Adds clarifying comment for lepus path segment
packages/webpack/react-webpack-plugin/src/ReactWebpackPlugin.ts Updates doc to use MTS/BTS terminology instead of Lepus/JS
packages/web-platform/web-mainthread-apis/ts/crossThreadHandlers/registerCallLepusMethodHandler.ts Adds JSDoc explaining legacy "Lepus" term
packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts Adds field and function JSDoc for MTS terminology
packages/web-platform/web-core/src/index.ts Re-exports LynxBundle from web-constants
packages/web-platform/web-core-wasm/ts/types/DecodedTemplate.ts Marks DecodedTemplate deprecated; adds DecodedBundle alias
packages/web-platform/web-core-wasm/ts/encode/webEncoder.ts Adds JSDoc for manifest/lepusCode fields
packages/web-platform/web-core-wasm/ts/constants.ts Adds BundleSectionLabel constant with spec-aligned names
packages/web-platform/web-constants/src/types/TemplateLoader.ts Marks TemplateLoader deprecated; adds BundleLoader alias
packages/web-platform/web-constants/src/types/LynxModule.ts Marks LynxTemplate deprecated; adds LynxBundle alias; improves field JSDoc
packages/web-platform/web-constants/src/endpoints.ts Adds JSDoc to callLepusMethodEndpoint
packages/rspeedy/plugin-react/src/pluginReactLynx.ts Updates option JSDoc to use MTS/BTS terminology
packages/rspeedy/plugin-react/src/index.ts Exports LynxBundlePlugin and BundleHooks aliases alongside deprecated legacy exports
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported
Comments suppressed due to low confidence (1)

packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts:381

  • The @deprecated annotation on the LynxTemplatePlugin class is misleading in this refactoring. Since LynxBundlePlugin is defined as const LynxBundlePlugin = LynxTemplatePlugin, TypeScript will infer its type as typeof LynxTemplatePlugin. Because LynxTemplatePlugin is marked @deprecated, IDEs (e.g. VS Code) will still display a strikethrough or deprecation warning when code hovers over LynxBundlePlugin, because the inferred type references the deprecated symbol. This undermines the purpose of providing a clean non-deprecated alias.

The standard pattern for this kind of rename-with-backward-compat is:

  • Keep the canonical (new) name as the primary declaration (no @deprecated)
  • Create the old name as a deprecated type alias that references the new canonical name

Since renaming the actual class is a larger refactor, an intermediate approach would be to avoid placing the @deprecated tag on LynxTemplatePlugin itself and instead only note in its JSDoc that it's a legacy name, pointing to LynxBundlePlugin as the preferred name — but without the @deprecated tag triggering IDE warnings for the new alias.

 * @deprecated Use {@link LynxBundlePlugin} instead. This alias is retained for
 * backward compatibility.
 *
 * @public
 */
export class LynxTemplatePlugin {

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

/**
* @deprecated The name `OriginManifest` is a legacy artifact. "Manifest" here
* refers to Background Thread Script (BTS) chunks in the official Lynx
* specification.
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The @deprecated annotation on OriginManifest does not provide a {@link} reference to a replacement type. Unlike the other deprecated types in this PR (which all have @deprecated Use {@link NewName} instead), this one leaves users without a clear alternative to migrate to. Either add a {@link} to a replacement type alias (e.g. if one should be introduced), or include explicit guidance in the deprecation text (e.g. Use the inline record type directly or see {@link EncodeOptions.manifest}).

Suggested change
* specification.
* specification. Use the inline record type directly or see
* {@link EncodeOptions.manifest}.

Copilot uses AI. Check for mistakes.
pnpm-lock.yaml Outdated
Comment on lines +926 to +944
@@ -941,7 +941,7 @@ importers:
version: 1.1.1
rsbuild-plugin-tailwindcss:
specifier: 0.2.4
version: 0.2.4(@rsbuild/core@1.7.3)(tailwindcss@3.4.19)
version: 0.2.4(@rsbuild/core@2.0.0-beta.3(core-js@3.48.0))(tailwindcss@3.4.19)
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The pnpm-lock.yaml changes include several packages now resolving with @rsbuild/core@2.0.0-beta.3 (a beta release) instead of the catalog-pinned stable version 1.7.3 for importers like packages/rspeedy/upgrade-rspeedy and website. This is a significant unintended side-effect that is completely unrelated to the API alias/terminology changes described in this PR, and it may introduce instability. These lock file changes should be investigated and separated from this PR.

Copilot uses AI. Check for mistakes.
- packages/background-only
- packages/lynx/*
- packages/mcp-servers/*
- packages/repl
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

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

The pnpm-workspace.yaml diff adds packages/repl to the workspace, but this directory does not exist in the repository. This will cause pnpm install to fail (or at least produce a warning) because there is no package.json to resolve under packages/repl. This change appears completely unrelated to the stated purpose of this PR (adding API aliases for the Lynx specification terminology) and should be removed or addressed in a separate PR.

Suggested change
- packages/repl

Copilot uses AI. Check for mistakes.
Copy link
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: 1

🧹 Nitpick comments (1)
packages/webpack/template-webpack-plugin/src/WebEncodePlugin.ts (1)

71-71: Documentation clarity: consider expanding "BTS" abbreviation.

The comment update aligns well with the PR's terminology standardization goals. The abbreviation "BTS" (Background Thread Script) is concise but might benefit from being expanded on first use for improved clarity, especially for developers unfamiliar with the official specification.

📝 Optional expansion for clarity
-              // `/app-service.js` is the conventional BTS entry point in a Lynx Bundle.
+              // `/app-service.js` is the conventional BTS (Background Thread Script) entry point in a Lynx Bundle.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/webpack/template-webpack-plugin/src/WebEncodePlugin.ts` at line 71,
The inline comment in WebEncodePlugin referencing "`/app-service.js` is the
conventional BTS entry point in a Lynx Bundle." should expand the abbreviation
on first use for clarity; update that comment in WebEncodePlugin.ts to read
something like "BTS (Background Thread Script)" on first mention (e.g.,
"`/app-service.js` is the conventional BTS (Background Thread Script) entry
point in a Lynx Bundle") so unfamiliar readers immediately see the full term
while keeping subsequent mentions as "BTS".
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts`:
- Line 1119: The exported alias LynxBundlePlugin lacks an explicit type
annotation which breaks declaration generation under --isolatedDeclarations;
update the export so LynxBundlePlugin is declared with an explicit type (e.g.,
annotate it as the same type as LynxTemplatePlugin using a typeof or the
plugin's exported type/interface) so the compiler can emit declarations without
analyzing other modules — locate the export "export const LynxBundlePlugin =
LynxTemplatePlugin;" and change it to include the explicit type annotation for
LynxBundlePlugin.

---

Nitpick comments:
In `@packages/webpack/template-webpack-plugin/src/WebEncodePlugin.ts`:
- Line 71: The inline comment in WebEncodePlugin referencing "`/app-service.js`
is the conventional BTS entry point in a Lynx Bundle." should expand the
abbreviation on first use for clarity; update that comment in WebEncodePlugin.ts
to read something like "BTS (Background Thread Script)" on first mention (e.g.,
"`/app-service.js` is the conventional BTS (Background Thread Script) entry
point in a Lynx Bundle") so unfamiliar readers immediately see the full term
while keeping subsequent mentions as "BTS".

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 94e5779 and 3644d42.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • packages/rspeedy/plugin-react/src/index.ts
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • packages/web-platform/web-constants/src/endpoints.ts
  • packages/web-platform/web-constants/src/types/LynxModule.ts
  • packages/web-platform/web-constants/src/types/TemplateLoader.ts
  • packages/web-platform/web-core-wasm/ts/constants.ts
  • packages/web-platform/web-core-wasm/ts/encode/webEncoder.ts
  • packages/web-platform/web-core-wasm/ts/types/DecodedTemplate.ts
  • packages/web-platform/web-core/src/index.ts
  • packages/web-platform/web-mainthread-apis/ts/createMainThreadGlobalThis.ts
  • packages/web-platform/web-mainthread-apis/ts/crossThreadHandlers/registerCallLepusMethodHandler.ts
  • packages/webpack/react-webpack-plugin/src/ReactWebpackPlugin.ts
  • packages/webpack/react-webpack-plugin/src/loaders/options.ts
  • packages/webpack/template-webpack-plugin/src/LynxEncodePlugin.ts
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
  • packages/webpack/template-webpack-plugin/src/WebEncodePlugin.ts
  • packages/webpack/template-webpack-plugin/src/index.ts
  • pnpm-workspace.yaml

Copy link
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: 1

♻️ Duplicate comments (1)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)

1113-1113: ⚠️ Potential issue | 🔴 Critical

Add explicit type annotation for exported alias (build blocker).

Line 1113 currently fails declaration emit with --isolatedDeclarations because the exported const alias has no explicit type.

Suggested fix
-export const LynxBundlePlugin = LynxTemplatePlugin;
+export const LynxBundlePlugin: typeof LynxTemplatePlugin =
+  LynxTemplatePlugin;

As per coding guidelines **/*.{ts,tsx}: Use TypeScript with the strictest mode configuration as defined in tsconfig.json.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts` at line
1113, The exported alias LynxBundlePlugin lacks an explicit type which breaks
declaration emit under --isolatedDeclarations; fix by adding an explicit type
annotation to the exported const (make LynxBundlePlugin have the same type as
LynxTemplatePlugin, e.g. annotate it with typeof LynxTemplatePlugin) so the
declaration file can be emitted correctly.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts`:
- Around line 1109-1113: The export for LynxBundlePlugin currently carries a
contradictory `@deprecated` JSDoc; remove the deprecation annotation/comment from
the declaration of export const LynxBundlePlugin = LynxTemplatePlugin so that
LynxBundlePlugin remains the canonical alias, leaving the deprecation on
LynxTemplatePlugin intact; update or simplify the JSDoc above LynxBundlePlugin
to a short non-deprecated note (or remove it entirely) to avoid inverted
migration warnings in IDEs.

---

Duplicate comments:
In `@packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts`:
- Line 1113: The exported alias LynxBundlePlugin lacks an explicit type which
breaks declaration emit under --isolatedDeclarations; fix by adding an explicit
type annotation to the exported const (make LynxBundlePlugin have the same type
as LynxTemplatePlugin, e.g. annotate it with typeof LynxTemplatePlugin) so the
declaration file can be emitted correctly.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3644d42 and 88b04f2.

📒 Files selected for processing (6)
  • packages/rspeedy/plugin-react/src/index.ts
  • packages/web-platform/web-constants/src/types/LynxModule.ts
  • packages/web-platform/web-constants/src/types/TemplateLoader.ts
  • packages/web-platform/web-core-wasm/ts/constants.ts
  • packages/web-platform/web-core-wasm/ts/types/DecodedTemplate.ts
  • packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/web-platform/web-core-wasm/ts/constants.ts
  • packages/rspeedy/plugin-react/src/index.ts

Comment on lines +1109 to +1113
/**
* @deprecated Use {@link LynxTemplatePlugin} (class) directly, or the
* preferred alias {@link LynxBundlePlugin} for new code.
*/
export const LynxBundlePlugin = LynxTemplatePlugin;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

# Get the file size first
wc -l packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts

Repository: lynx-family/lynx-stack

Length of output: 137


🏁 Script executed:

# Check line 370 and surrounding context
sed -n '360,380p' packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts

Repository: lynx-family/lynx-stack

Length of output: 659


🏁 Script executed:

# Check lines 1109-1113 and surrounding context
sed -n '1100,1120p' packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts

Repository: lynx-family/lynx-stack

Length of output: 673


Remove contradictory deprecation on LynxBundlePlugin export.

Line 370 correctly deprecates LynxTemplatePlugin in favor of LynxBundlePlugin (the official specification name). However, lines 1109–1113 then deprecate LynxBundlePlugin itself, creating an inverted migration path and confusing IDE warnings. Since LynxBundlePlugin is the intended canonical alias per the official Lynx specification, remove the deprecation decorator:

Suggested fix
-/**
- * `@deprecated` Use {`@link` LynxTemplatePlugin} (class) directly, or the
- * preferred alias {`@link` LynxBundlePlugin} for new code.
- */
-export const LynxBundlePlugin = LynxTemplatePlugin;
+/**
+ * Preferred canonical plugin name aligned with the official specification.
+ */
+export const LynxBundlePlugin: typeof LynxTemplatePlugin = LynxTemplatePlugin;
🧰 Tools
🪛 GitHub Check: code-style-check

[failure] 1113-1113:
Variable must have an explicit type annotation with --isolatedDeclarations.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts` around
lines 1109 - 1113, The export for LynxBundlePlugin currently carries a
contradictory `@deprecated` JSDoc; remove the deprecation annotation/comment from
the declaration of export const LynxBundlePlugin = LynxTemplatePlugin so that
LynxBundlePlugin remains the canonical alias, leaving the deprecation on
LynxTemplatePlugin intact; update or simplify the JSDoc above LynxBundlePlugin
to a short non-deprecated note (or remove it entirely) to avoid inverted
migration warnings in IDEs.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 28, 2026

Merging this PR will degrade performance by 5.75%

⚡ 1 improved benchmark
❌ 1 regressed benchmark
✅ 70 untouched benchmarks
⏩ 3 skipped benchmarks1

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
basic-performance-nest-level-100 7.4 ms 6.9 ms +6.99%
basic-performance-text-200 17.9 ms 19 ms -5.75%

Comparing Huxpro/fetch-lynx-docs-v1 (97e5db3) with main (6cbe5d8)

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@relativeci
Copy link

relativeci bot commented Feb 28, 2026

Web Explorer

#7933 Bundle Size — 383.53KiB (0%).

97e5db3(current) vs 6cbe5d8 main#7929(baseline)

Bundle metrics  Change 2 changes
                 Current
#7933
     Baseline
#7929
No change  Initial JS 154.63KiB 154.63KiB
No change  Initial CSS 35.1KiB 35.1KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 238(-0.42%) 239
No change  Duplicate Modules 16 16
Change  Duplicate Code 3.01%(+0.67%) 2.99%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7933
     Baseline
#7929
No change  JS 252.58KiB 252.58KiB
No change  Other 95.85KiB 95.85KiB
No change  CSS 35.1KiB 35.1KiB

Bundle analysis reportBranch Huxpro/fetch-lynx-docs-v1Project dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
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: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@packages/rspeedy/plugin-react/etc/react-rsbuild-plugin.api.md`:
- Around line 54-56: The exported interface LynxBundlePlugin is missing JSDoc
with a release tag; add a JSDoc block immediately above the LynxBundlePlugin
declaration (matching the style used for PluginReactLynxOptions) that includes a
short one-line description and the `@public` release tag so API Extractor no
longer marks it as undocumented.

In `@packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md`:
- Around line 79-82: Edit the JSDoc for the exported constant LynxBundlePlugin
in LynxTemplatePlugin.ts: remove the `@deprecated` tag and ensure it is annotated
`@public` (leave no deprecation text), while keeping the LynxTemplatePlugin class
marked `@deprecated` and pointing to LynxBundlePlugin; after updating the JSDoc,
rebuild/regenerate the API report by running pnpm turbo api-extractor -- --local
so the packages/webpack/template-webpack-plugin API file reflects the change.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c291fd0 and ae4c7af.

📒 Files selected for processing (3)
  • packages/rspeedy/plugin-react/etc/react-rsbuild-plugin.api.md
  • packages/rspeedy/plugin-react/src/index.ts
  • packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/rspeedy/plugin-react/src/index.ts

Comment on lines +54 to 56
// Warning: (ae-missing-release-tag) "LynxBundlePlugin" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Find LynxBundlePlugin definition and its JSDoc in source files
find packages/rspeedy/plugin-react/src -type f \( -name "*.ts" -o -name "*.tsx" \) -exec grep -l "LynxBundlePlugin" {} \;

Repository: lynx-family/lynx-stack

Length of output: 108


🏁 Script executed:

#!/bin/bash
# Read the source file to check JSDoc and LynxBundlePlugin definition
cat -n packages/rspeedy/plugin-react/src/index.ts

Repository: lynx-family/lynx-stack

Length of output: 1637


🏁 Script executed:

#!/bin/bash
# Check if this is a private package and verify package details
cat packages/rspeedy/plugin-react/package.json | head -20

Repository: lynx-family/lynx-stack

Length of output: 532


🏁 Script executed:

#!/bin/bash
# Check if package is private
grep -A 2 '"private"' packages/rspeedy/plugin-react/package.json

Repository: lynx-family/lynx-stack

Length of output: 48


🏁 Script executed:

#!/bin/bash
# Check the api.md file to see the full context around lines 54-62
sed -n '50,65p' packages/rspeedy/plugin-react/etc/react-rsbuild-plugin.api.md

Repository: lynx-family/lynx-stack

Length of output: 592


🏁 Script executed:

#!/bin/bash
# Verify if there are other similar interfaces in the codebase with proper JSDoc examples
rg -B 3 "export type.*interface" packages/rspeedy/plugin-react/src/ -A 2

Repository: lynx-family/lynx-stack

Length of output: 48


🏁 Script executed:

#!/bin/bash
# Check if there are other exported types/interfaces with proper JSDoc in the same file
rg -B 5 "export.*PluginReactLynxOptions" packages/rspeedy/plugin-react/src/ -A 2

Repository: lynx-family/lynx-stack

Length of output: 1257


🏁 Script executed:

#!/bin/bash
# Double-check if api.md file is correctly generated by looking at regeneration scripts
find packages/rspeedy/plugin-react -name "tsconfig*.json" -o -name "api-extractor.json"

Repository: lynx-family/lynx-stack

Length of output: 257


🏁 Script executed:

#!/bin/bash
# Verify the API extractor configuration to understand how it processes exports
cat packages/rspeedy/plugin-react/api-extractor.json | head -30

Repository: lynx-family/lynx-stack

Length of output: 271


Add JSDoc with @public release tag to LynxBundlePlugin interface.

The LynxBundlePlugin interface exported from packages/rspeedy/plugin-react/src/index.ts is missing proper JSDoc documentation with a release tag. API Extractor correctly flagged this and defaulted to @public (undocumented). Other exported types in the same file like PluginReactLynxOptions include proper JSDoc with the @public tag—LynxBundlePlugin should follow the same pattern.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/rspeedy/plugin-react/etc/react-rsbuild-plugin.api.md` around lines
54 - 56, The exported interface LynxBundlePlugin is missing JSDoc with a release
tag; add a JSDoc block immediately above the LynxBundlePlugin declaration
(matching the style used for PluginReactLynxOptions) that includes a short
one-line description and the `@public` release tag so API Extractor no longer
marks it as undocumented.

Comment on lines +79 to +82
// Warning: (ae-missing-release-tag) "LynxBundlePlugin" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export const LynxBundlePlugin: typeof LynxTemplatePlugin;
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

find packages/webpack/template-webpack-plugin/src -type f -name "*.ts" -o -name "*.tsx" | head -20

Repository: lynx-family/lynx-stack

Length of output: 595


🏁 Script executed:

rg -A 3 -B 5 'export.*LynxBundlePlugin|LynxBundlePlugin\s*=' packages/webpack/template-webpack-plugin/src/ -t ts

Repository: lynx-family/lynx-stack

Length of output: 3081


🏁 Script executed:

rg -A 3 -B 5 'export.*LynxTemplatePlugin|LynxTemplatePlugin\s*=' packages/webpack/template-webpack-plugin/src/ -t ts

Repository: lynx-family/lynx-stack

Length of output: 3106


Remove @deprecated tag from LynxBundlePlugin in source JSDoc.

The JSDoc on LynxBundlePlugin const export in packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts is contradictory: it's marked @deprecated while simultaneously recommending it as the "preferred alias for new code." The class LynxTemplatePlugin correctly directs users to LynxBundlePlugin, making it the new canonical export.

Fix the JSDoc on the LynxBundlePlugin const to mark it @public without @deprecated, keeping only the class LynxTemplatePlugin marked as deprecated. Then regenerate the API report with pnpm turbo api-extractor -- --local.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/webpack/template-webpack-plugin/etc/template-webpack-plugin.api.md`
around lines 79 - 82, Edit the JSDoc for the exported constant LynxBundlePlugin
in LynxTemplatePlugin.ts: remove the `@deprecated` tag and ensure it is annotated
`@public` (leave no deprecation text), while keeping the LynxTemplatePlugin class
marked `@deprecated` and pointing to LynxBundlePlugin; after updating the JSDoc,
rebuild/regenerate the API report by running pnpm turbo api-extractor -- --local
so the packages/webpack/template-webpack-plugin API file reflects the change.

Huxpro added 6 commits March 2, 2026 16:40
Add official API aliases (LynxBundle, BundleLoader, LynxBundlePlugin,
BundleHooks, LynxBundlePluginOptions, DecodedBundle, BundleSectionLabel)
for legacy internal names (LynxTemplate, TemplateLoader, LynxTemplatePlugin,
TemplateHooks, LynxTemplatePluginOptions, DecodedTemplate, TemplateSectionLabel).

Mark legacy names with @deprecated to guide users to official terminology
while maintaining full backward compatibility.

Add comprehensive JSDoc clarifications on definition sites explaining the
mapping between internal field names and official spec terms, plus wire
format constraints on hardcoded field names.

Remove redundant call-site comments since IDE will show @deprecated warnings.
The new canonical names (LynxBundle, BundleLoader, DecodedBundle,
BundleSectionLabel, BundleHooks, LynxBundlePluginOptions, LynxBundlePlugin)
are now the actual interface/const definitions, and the old names
(LynxTemplate, TemplateLoader, DecodedTemplate, TemplateSectionLabel,
TemplateHooks, LynxTemplatePluginOptions, LynxTemplatePlugin) are
@deprecated aliases pointing to them.
… lockfile drift

- Add `typeof LynxTemplatePlugin` annotation on LynxBundlePlugin export
  to satisfy --isolatedDeclarations (TS9010).
- Revert accidental pnpm-lock.yaml and pnpm-workspace.yaml changes that
  were not part of the terminology refactoring.
- Fix sort-imports ESLint error in plugin-react/src/index.ts
- Update api-extractor report for @lynx-js/react-rsbuild-plugin
- Update api-extractor report for @lynx-js/template-webpack-plugin
@Huxpro Huxpro force-pushed the Huxpro/fetch-lynx-docs-v1 branch from adada26 to 2f7528a Compare March 3, 2026 00:41
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