Skip to content

Conversation

@luhc228
Copy link
Collaborator

@luhc228 luhc228 commented Nov 18, 2025

Summary by CodeRabbit

  • New Features

    • Added a package that provides bundling configurations and Webpack plugins to produce layered external bundles (main-thread & background) with runtime wrappers and encoding support.
  • Documentation

    • Added package README, API report, and integrated docs into the website (multi-language).
  • Tests

    • Added tests and fixtures validating layering, bundle output, encoding, engine/version behavior, and debug-mode artifacts.
  • Chores

    • Added package manifest, build/test configs, TypeScript/Vitest setup, workspace registration, changesets, and bumped a related dependency.

✏️ Tip: You can customize this high-level summary in your review settings.

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).

@luhc228 luhc228 requested a review from colinaaa as a code owner November 18, 2025 11:18
@changeset-bot
Copy link

changeset-bot bot commented Nov 18, 2025

🦋 Changeset detected

Latest commit: 215c7ea

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

This PR includes changesets to release 4 packages
Name Type
@lynx-js/template-webpack-plugin Patch
@lynx-js/lynx-bundle-rslib-config Patch
@lynx-js/react-rsbuild-plugin Patch
@lynx-js/react-alias-rsbuild-plugin 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 Nov 18, 2025

📝 Walkthrough

Walkthrough

Adds a new package @lynx-js/lynx-bundle-rslib-config with TypeScript sources, two Webpack plugins, tests, build/test configs, API report and README; updates workspace tsconfigs, website docs/devDependency, and bumps @lynx-js/tasm.

Changes

Cohort / File(s) Summary
Package metadata & docs
packages/rspeedy/lynx-bundle-rslib-config/README.md, packages/rspeedy/lynx-bundle-rslib-config/package.json, packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json, packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
Add package README, package.json (exports, deps, scripts, engines), API Extractor config, and generated API markdown documenting public API.
TypeScript & test config
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json, packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json, packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts, packages/rspeedy/tsconfig.json
Add package build and tsconfig, Vitest project config, and add package build reference to workspace tsconfig.
Public entry & API surface
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts, packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
Add package entry and exports (LAYERS, defaultExternalBundleLibConfig, EncodeOptions, defineExternalBundleRslibConfig) and implement layered-entry transformation plus rsbuild/Webpack plugin wiring.
Webpack plugins
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts, packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
Implement ExternalBundleWebpackPlugin (collects assets, builds encodeOptions, calls encode, emits bundle and optional tasm.json; debug-mode behavior) and MainThreadRuntimeWrapperWebpackPlugin (BannerPlugin-based wrappers).
Tests & fixtures
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts, packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts, packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
Add integration/unit tests for defineExternalBundleRslibConfig, a decodeTemplate helper using @lynx-js/tasm, and a simple fixture exporting add and abc.
Build entry & API report
packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json, packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
Add package build config and generated API report for the package.
Website & changesets
website/package.json, website/rspress.config.ts, .changeset/stale-rings-tan.md, .changeset/sour-ghosts-tease.md
Register package in website docs, add as website devDependency, and include changesets (new package and @lynx-js/tasm bump).
Dependency bump
packages/webpack/template-webpack-plugin/package.json
Bump @lynx-js/tasm dependency to 0.0.20.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

  • Areas needing focused review:
    • ExternalBundleWebpackPlugin.ts — webpack hooks, asset collection, encode contract, emission/deletion, debug output.
    • externalBundleRslibConfig.ts — layered entry transformation, entry-name regex generation, rsbuild/webpack plugin wiring.
    • MainThreadRuntimeWrapperWebpackPlugin.ts — BannerPlugin banner correctness and wrapper output.
    • Tests & test/utils.ts — platform decoder selection and integration assertions.

Suggested reviewers

  • upupming
  • colinaaa
  • gaoachao

Poem

🐇 I hopped through modules, split layers with care,
I wrapped main and background with banners to spare,
I bundled the bits, encoded every part,
Left tests and docs snug in a neat, carrot cart,
A joyful little hop — code finished with heart.

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ 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 'feat: init @lynx-js/lynx-bundle-rslib-config' directly and clearly describes the main change: initializing a new npm package with that specific name.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • 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

codecov bot commented Nov 18, 2025

Codecov Report

❌ Patch coverage is 94.65021% with 13 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ndle-rslib-config/src/externalBundleRslibConfig.ts 91.21% 13 Missing ⚠️

📢 Thoughts on this report? Let us know!

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 (6)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)

17-123: Good integration coverage of config and bundle behavior

The tests exercise both the configuration helper (entry preservation/overrides) and actual bundle outputs for dual/main-thread/background cases, including verifying custom section names and .define( presence. Using distinct bundle IDs avoids cross-test interference even though they share the same dist directory; if you ever see flakes in watch mode, consider cleaning or isolating that directory per test, but current setup is fine.

packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)

5-53: Docs are clear; tiny improvement for React example

The usage and step‑by‑step instructions are very helpful. For the React snippet, you might consider adding a dependency array, e.g. useEffect(() => { /* ... */ }, []), so the example doesn’t imply refetching the bundle on every render. Optional, but more idiomatic.

packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

6-15: Decouple test option typing from BannerPlugin internals

Using BannerPlugin['options']['test'] ties this option to both the existence of a named BannerPlugin export and its instance shape. A simpler and more robust option is to mirror webpack’s documented union directly, e.g.:

interface MainThreadRuntimeWrapperWebpackPluginOptions {
  test?: string | RegExp | (string | RegExp)[]
}

You can still accept a Partial<MainThreadRuntimeWrapperWebpackPluginOptions> in the constructor and default to /\.js$/ as you already do. This avoids potential breakage if webpack’s internal typings change while keeping call‑sites just as ergonomic.

Please double‑check the current webpack typings in your installed version to confirm whether import type { BannerPlugin } from 'webpack' is actually valid, and adjust the type as above if you prefer to avoid that dependency.

Also applies to: 22-37

packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)

7-27: API report looks consistent; unresolved-link warnings can be cleaned up

The report correctly captures the public surface (defaultExternalBundleLibConfig, defaultExternalBundleRsbuildConfig, defineExternalBundleRslibConfig, LAYERS). The ae-unresolved-link warnings around LibConfig suggest a TSDoc @link in the TS sources pointing at LibConfig as if it were exported from this package. If you want a clean report, update that JSDoc to reference the type from @rslib/core using a fully qualified TSDoc reference, then re‑run pnpm turbo api-extractor -- --local to regenerate this file. Do not hand‑edit the report.

packages/rspeedy/lynx-bundle-rslib-config/package.json (1)

1-50: Align dependencies and changesets with repo conventions

Two small packaging points to consider:

  1. @rslib/core as a peer dependency
    Your public API (per the API report) exposes LibConfig / RslibConfig from @rslib/core. Right now @rslib/core is only a devDependency. To make consumer ergonomics clearer and versioning safer, it’s worth adding a matching entry under peerDependencies (and keeping the devDependency for local tests/build). This way, projects using this package get an explicit requirement to install a compatible @rslib/core.

  2. Changeset for the new src package
    Since this adds a new src package, CI in this repo generally expects a changeset, even for internal/private changes; when release notes aren’t needed, an “empty” changeset file is used to satisfy the requirement, and it must reference the exact package name from package.json#name. Please confirm that a changeset for @lynx-js/lynx-bundle-rslib-config is included in the PR.

    Based on learnings

packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)

54-76: Slightly simplify customSections construction to avoid repeated object spreads

The current filter(...).reduce({...prev, ...}) pattern recreates a new object on every iteration. For many assets this is a bit wasteful and less straightforward to read. You can build the same map in a single pass without repeated spreads:

-  async #encode(assets: Readonly<Asset>[]) {
-    const customSections = assets
-      .filter(({ name }) => name.endsWith('.js'))
-      .reduce<Record<string, { content: string }>>((prev, cur) => ({
-        ...prev,
-        [cur.name.replace('.js', '')]: {
-          content: cur.source.source().toString(),
-        },
-      }), {})
+  async #encode(assets: Readonly<Asset>[]) {
+    const customSections: Record<string, { content: string }> = {}
+
+    for (const { name, source } of assets) {
+      if (!name.endsWith('.js')) continue
+      customSections[name.replace('.js', '')] = {
+        content: source.source().toString(),
+      }
+    }

The rest of the method can stay as-is. This keeps behavior identical while reducing allocations and improving readability.

📜 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 6acb37b and 8e56d8f.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (23)
📓 Common learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • website/rspress.config.ts
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • website/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • website/package.json
  • website/rspress.config.ts
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.

Applied to files:

  • packages/rspeedy/tsconfig.json
🧬 Code graph analysis (4)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
  • createAPI (155-192)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (17-39)
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
  • LazyBundleWebpackPlugin (11-80)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
  • defineExternalBundleRslibConfig (233-248)
  • LAYERS (17-20)
packages/rspeedy/core/src/cli/build.ts (1)
  • build (23-80)
packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
  • decodeTemplate (11-22)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
  • compiler (40-52)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts

[warning] 150-150: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 155-155: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (20)
packages/webpack/template-webpack-plugin/package.json (1)

40-40: No changeset is required for this change.

The PR only modified packages/webpack/template-webpack-plugin/package.json (bumping the @lynx-js/tasm dependency from 0.0.18 to 0.0.19). No source files (src/**) in the package were changed. According to the repository's changeset configuration, changesets are only required when files matching the pattern src/** are modified. Since this is purely a dependency version update in package.json, no changeset entry is needed.

Likely an incorrect or invalid review comment.

packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)

1-6: LGTM!

The API Extractor configuration follows the standard pattern used across the repository and correctly extends the base configuration.

packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1)

1-10: LGTM!

The TypeScript build configuration correctly sets up composite project references and follows the established pattern used across the repository.

packages/rspeedy/lynx-bundle-rslib-config/README.md (1)

1-3: LGTM!

The README provides a clear, concise description of the package's purpose. Consider adding usage examples or API documentation links in future iterations for better developer experience.

packages/rspeedy/tsconfig.json (1)

12-12: LGTM!

The project reference correctly integrates the new lynx-bundle-rslib-config package into the TypeScript composite project setup and maintains alphabetical ordering.

website/rspress.config.ts (2)

67-69: LGTM!

The API documentation entry for lynx-bundle-rslib-config correctly follows the established pattern and appropriately places the new package in the Rspeedy section.


207-210: LGTM!

The Chinese API documentation entry correctly mirrors the English configuration with the appropriate base path for localization.

packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1)

1-8: LGTM!

The TypeScript configuration correctly extends the build config and sets up type checking for source and test files without emitting output.

packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)

1-10: LGTM!

The Vitest configuration correctly sets up the test workspace project with an appropriate name that follows the repository's naming convention.

website/package.json (1)

24-24: LGTM!

The workspace dependency is correctly added in alphabetical order, enabling the website to reference the new package for API documentation generation.

packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1)

1-3: Fixture helper is correct and minimal

The add helper does exactly what's needed for the fixture, with clear typing and no edge cases to worry about.

packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)

1-22: Test decode helper looks appropriate

Lazy-loading @lynx-js/tasm, reading the bundle, and narrowing to the minimal DecodeTemplateResult shape is a good fit for this test-only helper; the eslint suppression is localized and acceptable here.

packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)

54-59: Public exports align with the intended API surface

Re‑exporting defineExternalBundleRslibConfig, defaultExternalBundleLibConfig, defaultExternalBundleRsbuildConfig, and LAYERS matches the generated API report and keeps the entrypoint focused. Just ensure that whenever you adjust these exports you re‑run pnpm turbo api-extractor -- --local so etc/lynx-bundle-rslib-config.api.md stays in sync, as per the repo’s guidelines.

packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (7)

1-20: LGTM! Clean imports and constant definition.

The LAYERS constant with as const assertion provides proper type safety, and the imports are well-organized.


27-40: LGTM! Well-configured lib defaults.

The configuration appropriately bundles dependencies and disables unsupported Lynx features like import.meta.url shim.


49-63: LGTM! Minification options preserve module wrapper semantics.

The negate_iife: false and side_effects: false settings correctly preserve the IIFE structure and return value required by Lynx's module loader.


69-146: LGTM! Entry duplication logic correctly handles layer-based bundling.

The logic appropriately:

  • Duplicates string/array entries into dual main-thread and background variants
  • Preserves explicit layer assignments from object-valued entries
  • Falls back to dual entries when layer is unspecified

The naming convention (background keeps original name, main-thread adds __main-thread suffix) aligns with the documented examples.


150-150: Entry names are developer-controlled, ReDoS risk is minimal.

While static analysis flags RegExp construction from variables, the name values originate from user-configured entry names (e.g., "utils", "index"), which are developer-controlled identifiers. The pattern ${name}\\.js$ is simple and poses minimal ReDoS risk in practice. However, if entry names ever come from external or untrusted sources, consider validating them against a safe pattern.

Also applies to: 155-155


250-268: LGTM! Lazy loading and plugin registration are properly implemented.

The dynamic import of @lynx-js/tasm avoids loading the dependency until needed, and the template filename generation from libName is appropriate for the bundle output.


148-158: Code review verified: no issues found.

Webpack BannerPlugin officially supports test: string | RegExp | [string, RegExp], confirming the implementation at lines 148-158 is correct. Both MainThreadRuntimeWrapperWebpackPlugin and BackgroundRuntimeWrapperWebpackPlugin properly pass arrays of RegExp patterns generated via .map(), which aligns with webpack's specification.

@codspeed-hq
Copy link

codspeed-hq bot commented Nov 18, 2025

CodSpeed Performance Report

Merging #1943 will degrade performances by 11.83%

Comparing luhc228:lynx-bundle-rslib-config (215c7ea) with main (2cd5c0c)

Summary

❌ 1 regression
✅ 62 untouched
⏩ 3 skipped1

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

Benchmarks breakdown

Benchmark BASE HEAD Change
basic-performance-div-100 6 ms 6.8 ms -11.83%

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 Nov 18, 2025

Web Explorer

#6421 Bundle Size — 377.48KiB (0%).

215c7ea(current) vs 2cd5c0c main#6405(baseline)

Bundle metrics  Change 2 changes
                 Current
#6421
     Baseline
#6405
No change  Initial JS 146.31KiB 146.31KiB
No change  Initial CSS 32.38KiB 32.38KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 231(+0.43%) 230
No change  Duplicate Modules 16 16
Change  Duplicate Code 2.95%(-0.34%) 2.96%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6421
     Baseline
#6405
No change  JS 243.15KiB 243.15KiB
No change  Other 101.94KiB 101.94KiB
No change  CSS 32.38KiB 32.38KiB

Bundle analysis reportBranch luhc228:lynx-bundle-rslib-configProject dashboard


Generated by RelativeCIDocumentationReport issue

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 8e56d8f to 647b2fa Compare November 18, 2025 12:50
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

♻️ Duplicate comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1)

233-268: Spread defaultExternalBundleRsbuildConfig into the lib item, not at the RslibConfig root

defaultExternalBundleRsbuildConfig is explicitly typed as RslibConfig['lib'][0], i.e., it has lib‑level fields such as output, source, and tools. In defineExternalBundleRslibConfig, it is currently spread at the top level:

return {
  lib: [
    {
      ...defaultExternalBundleLibConfig,
      ...userLibConfig,
    },
  ],
  ...defaultExternalBundleRsbuildConfig,
  plugins: [lazyBundleRsbuildPlugin],
}

This mixes lib‑level properties into the root RslibConfig object rather than into the single lib entry, which is exactly the type mismatch that was already called out in the earlier review. A safer and more accurate shape is to merge the default rsbuild config into the lib item itself and keep root‑level fields limited to lib and plugins:

 export function defineExternalBundleRslibConfig(
   userLibConfig: LibConfig,
 ): RslibConfig {
   return {
     lib: [
       {
         ...defaultExternalBundleLibConfig,
-        ...userLibConfig,
+        ...defaultExternalBundleRsbuildConfig,
+        ...userLibConfig,
       },
     ],
-    ...defaultExternalBundleRsbuildConfig,
     plugins: [
       lazyBundleRsbuildPlugin,
     ],
   }
 }

This way:

  • All output/source/tools settings from defaultExternalBundleRsbuildConfig live where their type (RslibConfig['lib'][0]) says they should.
  • The returned RslibConfig aligns structurally with how lib configs are normally expressed, reducing the risk of subtle misbehavior in @rslib/core.

Please double‑check this against the current @rslib/core RslibConfig/LibConfig documentation to confirm that output, source, and tools are indeed intended to be lib‑level here.

🧹 Nitpick comments (3)
packages/rspeedy/lynx-bundle-rslib-config/package.json (1)

1-50: Package manifest looks coherent with the new rslib config package

  • exports, files, and dependency wiring line up with the src/lib/test usage, and @lynx-js/tasm is correctly listed as a runtime dependency.
  • engines.node: ">=18" is fine, but if the intention is to strictly match the workspace’s Node requirement (>=22), you may want to align this in a follow‑up for consistency.
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

4-38: IIFE wrapper plugin is minimal and consistent with existing runtime patterns

The plugin cleanly injects a raw IIFE that creates module/exports and returns module.exports, with a configurable test predicate defaulting to /\.js$/. This aligns with the existing runtime-wrapper approach and keeps the main-thread wrapper logic small and focused.

If you ever need to extend the wrapper (e.g., adding 'use strict'; or additional locals), consider factoring the banner strings into small helper functions for readability, but it’s not necessary right now.

packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1)

47-161: Entry duplication and wrapper plugin wiring are correct; consider escaping entry names in regex tests

The bundlerChain:

  • Copies existing entries, then expands them into main-thread/background variants based on LAYERS and whether layer is explicitly set, which matches the intended semantics and the test expectations.
  • Tracks entry names in mainThreadEntryName and backgroundEntryName and wires MainThreadRuntimeWrapperWebpackPlugin and BackgroundRuntimeWrapperWebpackPlugin with test predicates tailored per entry, which is a nice, targeted use of the wrappers.

One thing to optionally tighten up:

  • test is built as new RegExp(\${name}\.js$`)from the raw entry names. While the patterns here are simple and only used at build time, this means any regex metacharacters inname(e.g.,+, (, ), |`) will be interpreted as regex, not literal text (and static analysis flagged this).
  • You could make this more robust by escaping name first, e.g.:
-          test: mainThreadEntryName.map((name) => new RegExp(`${name}\\.js$`)),
+          test: mainThreadEntryName.map((name) => {
+            const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+            return new RegExp(`${escaped}\\.js$`)
+          }),

(and similarly for backgroundEntryName).

This keeps behavior identical for today’s simple entry names but avoids surprises if someone ever uses an entry name with regex metacharacters.

📜 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 8e56d8f and 647b2fa.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (18)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
✅ Files skipped from review due to trivial changes (2)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧰 Additional context used
🧠 Learnings (15)
📓 Common learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧬 Code graph analysis (3)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/webpack/runtime-wrapper-webpack-plugin/src/RuntimeWrapperWebpackPlugin.ts (1)
  • RuntimeWrapperWebpackPluginImpl (136-208)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
  • defineExternalBundleRslibConfig (233-248)
  • LAYERS (17-20)
packages/rspeedy/core/src/cli/build.ts (1)
  • build (23-80)
packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
  • decodeTemplate (11-22)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (17-39)
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
  • LazyBundleWebpackPlugin (11-80)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts

[warning] 150-150: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 155-155: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (2)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)

5-123: Strong, focused integration tests for external bundle config

The suite exercises both config shaping (entry + syntax override) and the main/background splitting semantics via decoded bundle sections, which gives good confidence in defineExternalBundleRslibConfig and LAYERS without over-mocking. The distinct ids (utils-dual, utils-m, utils-b) keep artifacts separated enough for repeated runs.

packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1)

17-40: LAYERS constant and default lib config look well-chosen for Lynx external bundles

  • LAYERS exposes exactly the two public layer identifiers used by the tests and bundlerChain logic ('background' and 'main-thread').
  • defaultExternalBundleLibConfig’s format: 'cjs', syntax: 'es2015', disabled autoExtension, and import.meta.url shim suppression are all reasonable defaults for Lynx bundles and keep the generated JS predictable.

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch 2 times, most recently from 3ae65f9 to 35cfb96 Compare November 19, 2025 01:52
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

📜 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 647b2fa and 35cfb96.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/stale-rings-tan.md
🚧 Files skipped from review as they are similar to previous changes (10)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • website/rspress.config.ts
  • packages/rspeedy/tsconfig.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (22)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
🧬 Code graph analysis (3)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
  • defineExternalBundleRslibConfig (233-248)
  • LAYERS (17-20)
packages/rspeedy/core/src/cli/build.ts (1)
  • build (23-80)
packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
  • decodeTemplate (11-25)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (17-39)
packages/rspeedy/lynx-bundle-rslib-config/src/LazyBundleWebpackPlugin.ts (1)
  • LazyBundleWebpackPlugin (11-80)
packages/rspeedy/lynx-bundle-rslib-config/src/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/webpack/runtime-wrapper-webpack-plugin/src/RuntimeWrapperWebpackPlugin.ts (2)
  • RuntimeWrapperWebpackPluginImpl (136-208)
  • RuntimeWrapperWebpackPluginImpl (136-208)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts

[warning] 150-150: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 155-155: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 35cfb96 to a104f5c Compare November 19, 2025 02:26
@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from a104f5c to 44e8f15 Compare November 21, 2025 08:11
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: 0

♻️ Duplicate comments (3)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (3)

156-220: Fix invalid import paths in JSDoc examples.

The JSDoc examples on lines 169, 192, and 213 use the invalid relative path '.src/utils.ts'. This should be './src/utils.ts' to match typical rsbuild configs and ensure users can copy-paste working examples.


138-143: Escape entry names before constructing RegExp.

Lines 138 and 143 construct regular expressions directly from entry names without escaping. If an entry name contains regex metacharacters (e.g., [, ., (), this could cause RegExp construction to fail or match unintended files, and potentially enable ReDoS attacks.

Apply escaping before building the patterns:

+const escapeRegex = (str: string) => str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+
 // dprint-ignore
 chain
   .plugin(MainThreadRuntimeWrapperWebpackPlugin.name)
   .use(MainThreadRuntimeWrapperWebpackPlugin, [{
-    test: mainThreadEntryName.map((name) => new RegExp(`${name}\\.js$`)),
+    test: mainThreadEntryName.map((name) => new RegExp(`${escapeRegex(name)}\\.js$`)),
   }])
   .end()
   .plugin(BackgroundRuntimeWrapperWebpackPlugin.name)
   .use(BackgroundRuntimeWrapperWebpackPlugin, [{
-    test: backgroundEntryName.map((name) => new RegExp(`${name}\\.js$`)),
+    test: backgroundEntryName.map((name) => new RegExp(`${escapeRegex(name)}\\.js$`)),
   }])
   .end()

221-236: Fix type mismatch: move lib-level config spread into lib array.

Line 231 spreads defaultExternalBundleRsbuildConfig at the root level of the returned RslibConfig, but defaultExternalBundleRsbuildConfig is typed as RslibConfig['lib'][0] (a LibConfig). This incorrectly mixes lib-level properties (output, source, tools) with root-level properties (lib, plugins).

Move the spread inside the lib array item:

 export function defineExternalBundleRslibConfig(
   userLibConfig: LibConfig,
 ): RslibConfig {
   return {
     lib: [
       {
         ...defaultExternalBundleLibConfig,
+        ...defaultExternalBundleRsbuildConfig,
         ...userLibConfig,
       },
     ],
-    ...defaultExternalBundleRsbuildConfig,
     plugins: [
-      lazyBundleRsbuildPlugin(),
+      lazyBundleRsbuildPlugin(),
     ],
   }
 }
🧹 Nitpick comments (2)
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)

7-27: Confirm API report is regenerated and matches the new public surface

This file looks like a fresh API Extractor output, but it only contains the config helpers and LAYERS while src/index.ts also re-exports the webpack plugins. If those plugins are intended to be public, please re-run pnpm turbo api-extractor -- --local and confirm this report is up to date; if they’re intentionally internal, consider keeping them out of src/index.ts exports or documenting that choice. The unresolved-link warnings for LibConfig should likewise be fixed in the source JSDoc (not in this file) if you want clean API docs.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)

75-83: Simplify and optimize customSections construction

The current reduce with object spread recreates the object on every iteration. A simple loop keeps the same behavior with less allocation and slightly clearer intent:

-    const customSections = assets
-      .filter(({ name }) => name.endsWith('.js'))
-      .reduce<Record<string, { content: string }>>((prev, cur) => ({
-        ...prev,
-        [cur.name.replace('.js', '')]: {
-          content: cur.source.source().toString(),
-        },
-      }), {})
+    const customSections: Record<string, { content: string }> = {}
+    for (const asset of assets) {
+      if (!asset.name.endsWith('.js')) continue
+      customSections[asset.name.replace('.js', '')] = {
+        content: asset.source.source().toString(),
+      }
+    }

Behavior stays the same while avoiding repeated spreads on every asset.

📜 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 a104f5c and 44e8f15.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/rspeedy/tsconfig.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/stale-rings-tan.md
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (32)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • website/package.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-07-16T05:57:29.837Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T05:57:29.837Z
Learning: In the lynx-stack codebase, PupilTong prefers avoiding regex for parsing in performance-critical code paths like SSR hydration, preferring simple string manipulation operations even if they're less robust, when the input format is predictable and controlled.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
🧬 Code graph analysis (3)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (56-56)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
  • compiler (49-73)
packages/webpack/runtime-wrapper-webpack-plugin/src/RuntimeWrapperWebpackPlugin.ts (2)
  • RuntimeWrapperWebpackPluginImpl (136-208)
  • RuntimeWrapperWebpackPluginImpl (136-208)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
  • LazyBundleWebpackPlugin (55-55)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (17-39)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
  • LazyBundleWebpackPlugin (20-105)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (5)
website/package.json (1)

24-24: LGTM!

Dependency correctly added to devDependencies with workspace:* protocol, maintaining alphabetical order among scoped packages. Appropriate placement for a build configuration tool.

.changeset/stale-rings-tan.md (1)

1-22: Changeset content and package naming look good

Front‑matter uses the exact scoped package name and a patch bump, and the body includes a clear usage example, which is helpful for consumers and aligns with the repo’s changeset conventions.

packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)

5-25: Test decode helper is straightforward and appropriate

The decodeTemplate helper cleanly abstracts the @lynx-js/tasm decode logic for tests, including the Windows/N-API switch and fs read, with a minimal result type focused on custom-sections. Looks good as a focused test utility.

packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)

5-56: Documentation and public exports are cohesive

The package-level JSDoc gives a clear end‑to‑end flow (install → rslib config → fetching/loading the bundle), and the index re-exports both the config helpers and the webpack plugins from a single entrypoint, which is nice for consumers. No issues from my side.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

1-39: LGTM! Plugin correctly wraps modules for Lynx runtime.

The MainThreadRuntimeWrapperWebpackPlugin implementation is clean and correct. The IIFE wrapper pattern with module.exports is confirmed necessary for lynx-core integration (per past review discussion). The two-BannerPlugin approach effectively creates the wrapper opening and closing, and the default test regex /\.js$/ appropriately targets JavaScript files.

@luhc228 luhc228 requested a review from upupming November 21, 2025 08:24
@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 44e8f15 to 95ffcf4 Compare November 21, 2025 09:07
@relativeci
Copy link

relativeci bot commented Nov 21, 2025

React Example

#6261 Bundle Size — 236.09KiB (0%).

215c7ea(current) vs 2cd5c0c main#6245(baseline)

Bundle metrics  no changes
                 Current
#6261
     Baseline
#6245
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 162 162
No change  Duplicate Modules 65 65
No change  Duplicate Code 46.71% 46.71%
No change  Packages 2 2
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#6261
     Baseline
#6245
No change  IMG 145.76KiB 145.76KiB
No change  Other 90.33KiB 90.33KiB

Bundle analysis reportBranch luhc228:lynx-bundle-rslib-configProject dashboard


Generated by RelativeCIDocumentationReport issue

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 95ffcf4 to d4c37b6 Compare November 24, 2025 02:59
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: 0

🧹 Nitpick comments (2)
.changeset/stale-rings-tan.md (1)

1-3: Consider bumping to minor for new package initialization.

For a new package being added to the monorepo, a minor version bump is typically more appropriate than patch. The patch level is generally reserved for bug fixes in existing packages, while minor indicates new functionality or new packages being introduced.

Apply this diff to adjust the version level:

-"@lynx-js/lynx-bundle-rslib-config": patch
+"@lynx-js/lynx-bundle-rslib-config": minor
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)

31-49: Address API Extractor warnings for better API documentation.

The API report shows warnings that should be addressed:

  1. Missing @public release tags on LazyBundleWebpackPlugin and MainThreadRuntimeWrapperWebpackPlugin classes
  2. Option interfaces (LazyBundleWebpackPluginOptions and MainThreadRuntimeWrapperWebpackPluginOptions) need to be exported

Fix 1: Add @public tags to plugin classes

In packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts:

+/**
+ * @public
+ */
 export class LazyBundleWebpackPlugin {

In packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts:

+/**
+ * @public
+ */
 export class MainThreadRuntimeWrapperWebpackPlugin {

Fix 2: Export option interfaces

In packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts:

-interface LazyBundleWebpackPluginOptions {
+export interface LazyBundleWebpackPluginOptions {

In packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts:

-interface MainThreadRuntimeWrapperWebpackPluginOptions {
+export interface MainThreadRuntimeWrapperWebpackPluginOptions {

Then re-export them from packages/rspeedy/lynx-bundle-rslib-config/src/index.ts:

 export { LazyBundleWebpackPlugin } from './webpack/LazyBundleWebpackPlugin.js'
+export type { LazyBundleWebpackPluginOptions } from './webpack/LazyBundleWebpackPlugin.js'
 export { MainThreadRuntimeWrapperWebpackPlugin } from './webpack/MainThreadRuntimeWrapperWebpackPlugin.js'
+export type { MainThreadRuntimeWrapperWebpackPluginOptions } from './webpack/MainThreadRuntimeWrapperWebpackPlugin.js'

After making these changes, run pnpm turbo api-extractor -- --local to update the API report.

📜 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 95ffcf4 and d4c37b6.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/tsconfig.json
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/stale-rings-tan.md
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (27)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-09-23T08:53:56.927Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/src/loader.ts:244-251
Timestamp: 2025-09-23T08:53:56.927Z
Learning: In webpack CSS extraction plugins, when storing per-module dependencies in a compiler-scoped map like cssModuleId2Deps, the map should not be reset at compilation start because in incremental compilation (watch mode/HMR), only changed files pass through the loader. Unchanged modules need their dependency information to persist between compilations so the plugin can access all modules' dependencies when generating CSS output.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
  • defineExternalBundleRslibConfig (49-49)
  • LAYERS (52-52)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
  • defineExternalBundleRslibConfig (221-236)
  • LAYERS (17-20)
packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
  • decodeTemplate (11-25)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (17-39)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)
  • LazyBundleWebpackPlugin (20-105)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/lynxBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (3)
.changeset/stale-rings-tan.md (2)

1-3: Verify the exact package name matches package.json#name.

Ensure @lynx-js/lynx-bundle-rslib-config matches the scoped name in the package.json for this new package. As per learnings, changesets should use the exact package name from package.json to ensure proper release tracking.


5-22: Changelog entry provides clear context with relevant example.

The description effectively communicates the purpose of the new package with a concrete code example showing the primary API (defineExternalBundleRslibConfig and LAYERS). This aligns well with the exports introduced in the new package.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/LazyBundleWebpackPlugin.ts (1)

16-16: Use toLowerCase() instead of non-standard toLocaleLowerCase().

Line 16 uses toLocaleLowerCase(), which is a non-standard method. Use the standard toLowerCase() instead.

Apply this diff:

-  const values = process.env['DEBUG'].toLocaleLowerCase().split(',')
+  const values = process.env['DEBUG'].toLowerCase().split(',')
⛔ Skipped due to learnings
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from d4c37b6 to 85653cd Compare November 24, 2025 03:41
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/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

136-145: Escape entry names before building RegExp patterns

mainThreadEntryName / backgroundEntryName values ultimately come from user‑defined entry names, but they are interpolated directly into new RegExp(\${name}\.js$`). If an entry name contains regex metacharacters (e.g. [, (, ., +), this can mis‑match or even throw at runtime when constructing the RegExp`. Static analysis also flags this as a “regexp-from-variable” issue.

Recommend escaping the names once and reusing that helper when creating the tests:

@@
-export const defaultExternalBundleRsbuildConfig: RslibConfig['lib'][0] = {
+export const defaultExternalBundleRsbuildConfig: RslibConfig['lib'][0] = {
@@
   tools: {
     bundlerChain: (chain) => {
@@
       Object.entries(entries).forEach(([entryName, entryPoint]) => {
@@
       })
-      // dprint-ignore
-      chain
-        .plugin(MainThreadRuntimeWrapperWebpackPlugin.name)
-        .use(MainThreadRuntimeWrapperWebpackPlugin, [{
-          test: mainThreadEntryName.map((name) => new RegExp(`${name}\\.js$`)),
-        }])
-        .end()
-        .plugin(BackgroundRuntimeWrapperWebpackPlugin.name)
-        .use(BackgroundRuntimeWrapperWebpackPlugin, [{
-          test: backgroundEntryName.map((name) => new RegExp(`${name}\\.js$`)),
-        }])
-        .end()
+      const escapeRegex = (value: string): string =>
+        value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
+
+      // dprint-ignore
+      chain
+        .plugin(MainThreadRuntimeWrapperWebpackPlugin.name)
+        .use(MainThreadRuntimeWrapperWebpackPlugin, [{
+          test: mainThreadEntryName.map(
+            (name) => new RegExp(`${escapeRegex(name)}\\.js$`),
+          ),
+        }])
+        .end()
+        .plugin(BackgroundRuntimeWrapperWebpackPlugin.name)
+        .use(BackgroundRuntimeWrapperWebpackPlugin, [{
+          test: backgroundEntryName.map(
+            (name) => new RegExp(`${escapeRegex(name)}\\.js$`),
+          ),
+        }])
+        .end()

This keeps the semantics (literal filename match) while avoiding unexpected regex behavior or construction errors when entry names contain special characters.

🧹 Nitpick comments (3)
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (2)

1-2: Optionally combine imports from the same module.

The imports are correct and functional. For brevity, you could combine them into a single import statement.

Apply this diff to combine the imports:

-import { defineProject } from 'vitest/config'
-import type { UserWorkspaceConfig } from 'vitest/config'
+import { defineProject, type UserWorkspaceConfig } from 'vitest/config'

4-10: Optionally simplify with direct export.

The configuration is correct and the test name properly reflects the package structure. The explicit type annotation is redundant since defineProject already returns the correct type, and the intermediate variable could be eliminated.

Apply this diff to simplify:

-const config: UserWorkspaceConfig = defineProject({
+export default defineProject({
   test: {
     name: 'rspeedy/lynx-bundle-rslib-config',
   },
 })
-
-export default config
packages/rspeedy/lynx-bundle-rslib-config/README.md (1)

1-3: Minimal README is fine; consider adding usage later

The short description is accurate for init. Over time, consider adding a tiny config example using defineExternalBundleRslibConfig to make the package more self‑discoverable.

📜 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 d4c37b6 and 85653cd.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (9)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/tsconfig.json
🧰 Additional context used
📓 Path-based instructions (1)
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (25)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • website/package.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • website/package.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • website/package.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • website/package.json
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.

Applied to files:

  • website/package.json
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧬 Code graph analysis (1)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
  • createAPI (155-192)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (6)
packages/webpack/template-webpack-plugin/package.json (1)

40-40: @lynx-js/template-webpack-plugin is missing a changeset for the @lynx-js/tasm dependency update.

Despite modifying the packages/webpack/template-webpack-plugin/package.json file (changing the @lynx-js/tasm dependency to 0.0.19), no corresponding changeset entry exists. The repository's CI checks require changesets when workspace packages are modified. Additionally, @lynx-js/tasm is an external dependency (not part of the workspace), so it does not need coordination within this PR—only a changeset entry documenting the template-webpack-plugin version update is required.

website/package.json (1)

21-25: Dev dependency wiring for docs looks consistent

Adding @lynx-js/lynx-bundle-rslib-config as a workspace:* devDependency matches the existing pattern for other Rspeedy / Lynx packages and should be sufficient for the docs build pipeline.

website/rspress.config.ts (1)

67-69: API docs sidebar wiring for the new package looks correct

The new createAPI({ name: 'lynx-bundle-rslib-config' }) entries are consistent with existing Rspeedy plugin entries and correctly add both EN (base default) and ZH (base: 'zh/api') sidebars.

Also applies to: 207-210

packages/rspeedy/lynx-bundle-rslib-config/package.json (1)

1-50: Manifest looks solid; just confirm intended Node support range

The manifest (exports, deps, files, scripts) looks consistent with other Lynx packages. engines.node: ">=18" is fine, just make sure this aligns with the runtime support you want for consumers, since the monorepo itself targets Node >=22. Based on learnings, the root doesn’t require Node 18 compatibility, so this broader range is a conscious choice.

packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)

1-6: API Extractor config correctly extends the root settings

The config simply delegates to the workspace‑level api-extractor.json, which is the expected pattern here. As long as you’ve run the usual pnpm turbo api-extractor -- --local and committed the generated etc/lynx-bundle-rslib-config.api.md, this setup is good to go.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)

11-136: External bundle emission pipeline looks correct

The plugin’s flow (collect assets → build customSections → call encode → emit bundle/tasm.json and prune originals) is coherent and uses webpack’s compilation hooks appropriately. Snapshotting assets before emitAsset also avoids deleting the newly emitted bundle.

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 85653cd to d38caf3 Compare November 24, 2025 03:55
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 (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

221-236: Verify the type structure: lib-level config is spread at root level.

Line 231 spreads defaultExternalBundleRsbuildConfig (typed as RslibConfig['lib'][0], containing output, source, tools) at the root RslibConfig level. This mixes lib-level properties with root-level properties (lib, plugins).

According to past review comments, this should be spread inside the lib array item instead:

 export function defineExternalBundleRslibConfig(
   userLibConfig: LibConfig,
 ): RslibConfig {
   return {
     lib: [
       {
         ...defaultExternalBundleLibConfig,
+        ...defaultExternalBundleRsbuildConfig,
         ...userLibConfig,
       },
     ],
-    ...defaultExternalBundleRsbuildConfig,
     plugins: [
       externalBundleRsbuildPlugin(),
     ],
   }
 }

Please verify whether the current structure is intentional or if the fix from previous reviews needs to be applied.

packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)

1-58: The API Extractor warnings still need to be resolved in the source code.

The three categories of warnings in this auto-generated report indicate unresolved issues:

  1. Lines 12-13, 17-18: LibConfig is referenced but not re-exported from the package entry point.
  2. Lines 48-49: MainThreadRuntimeWrapperWebpackPlugin is missing a JSDoc release tag (@public).
  3. Line 52: MainThreadRuntimeWrapperWebpackPluginOptions is used in the public API but not exported.

As per coding guidelines, after fixing these in the source code, regenerate the API report by running pnpm turbo api-extractor -- --local and commit the updated file.

📜 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 85653cd and d38caf3.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
🧰 Additional context used
📓 Path-based instructions (2)
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/stale-rings-tan.md
🧠 Learnings (29)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • website/rspress.config.ts
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • website/rspress.config.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (1)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
  • createAPI (155-192)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${name}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (10)
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)

1-10: LGTM!

The Vitest workspace configuration is correctly set up with an appropriate test project name matching the package structure.

website/package.json (1)

24-24: LGTM!

The new workspace dependency is correctly added and follows the existing pattern for internal package references.

.changeset/stale-rings-tan.md (1)

1-22: LGTM!

The changeset correctly uses the exact package name from package.json and provides a clear usage example. The patch version bump is appropriate for this new package introduction.

website/rspress.config.ts (2)

67-69: LGTM!

The API documentation entry for the new package is correctly added to the Rspeedy plugins section, following the existing pattern.


207-210: LGTM!

The Chinese API documentation entry mirrors the English version correctly with the appropriate base path.

packages/rspeedy/lynx-bundle-rslib-config/package.json (1)

1-50: LGTM!

The package.json is well-structured with appropriate dependencies, exports configuration, and Node.js version constraint. The workspace dependencies and versioning follow monorepo conventions correctly.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)

151-220: LGTM!

The JSDoc documentation is comprehensive with three clear examples demonstrating different usage patterns (background-only, main-thread-only, and dual-layer bundles). The import paths are correct.


238-259: LGTM!

The plugin implementation correctly uses dynamic import for @lynx-js/tasm and properly integrates the ExternalBundleWebpackPlugin with the bundler chain.


68-134: LGTM!

The bundler chain logic correctly handles different entry types (string, array, object) and appropriately creates layered entries for background and main-thread execution contexts. The entry naming convention is clear and consistent.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

1-48: LGTM!

The plugin correctly uses webpack's BannerPlugin to wrap modules in an IIFE with proper module/exports scaffolding. The implementation is clean and the IIFE pattern is confirmed as necessary for lynx-core integration (per past review discussion).

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch 2 times, most recently from 1047cf8 to ac65c1a Compare November 24, 2025 06:16
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: 0

♻️ Duplicate comments (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

221-235: Verify root-level spread of defaultExternalBundleRsbuildConfig matches intended RslibConfig shape

Here defaultExternalBundleRsbuildConfig is typed as RslibConfig['lib'][0] but is spread at the root level of the returned RslibConfig. If output, source, and tools.bundlerChain are meant as root-level rsbuild options (not per-lib options), the naming/type alias is slightly misleading; if they are per-lib, they probably belong inside the lib item instead.

Given the earlier discussion on this point, please double-check against @rslib/core’s config shape to be sure the properties end up at the intended level and won’t surprise users composing configs.

packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)

12-23: Resolve LibConfig unresolved-link warnings in API report

API Extractor still reports ae-unresolved-link for {@link LibConfig} on defaultExternalBundleLibConfig and defaultExternalBundleRsbuildConfig, meaning the link target isn’t part of this package’s public API.

Consider either:

  • Re-exporting LibConfig from your entry point, or
  • Adjusting/removing the {@link LibConfig} tags (e.g., fully qualifying the external type or turning the text into a plain description),

then rerun pnpm turbo api-extractor -- --local and commit the updated .api.md so the warnings disappear.

🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)

107-136: Consider building customSections without repeated object spreads

#encode currently uses reduce with { ...prev, [cur.name.replace('.js', '')]: { content: ... } }, which recreates the entire customSections object on each iteration. For larger bundles this can add unnecessary overhead.

You could build the map incrementally instead:

-  const customSections = assets
-    .filter(({ name }) => name.endsWith('.js'))
-    .reduce<Record<string, { content: string }>>((prev, cur) => ({
-      ...prev,
-      [cur.name.replace('.js', '')]: {
-        content: cur.source.source().toString(),
-      },
-    }), {})
+  const customSections: Record<string, { content: string }> = {}
+  for (const { name, source } of assets) {
+    if (!name.endsWith('.js')) continue
+    customSections[name.replace('.js', '')] = {
+      content: source.source().toString(),
+    }
+  }

Functionality stays the same with slightly better performance characteristics.

📜 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 1047cf8 and ac65c1a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/stale-rings-tan.md
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (27)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/stale-rings-tan.md
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/tsconfig.json
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.

Applied to files:

  • packages/rspeedy/tsconfig.json
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
  • ExternalBundleWebpackPluginOptions (56-56)
  • ExternalBundleWebpackPlugin (55-55)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
  • MainThreadRuntimeWrapperWebpackPluginOptions (58-58)
  • MainThreadRuntimeWrapperWebpackPlugin (57-57)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (7)
.changeset/stale-rings-tan.md (1)

2-2: Verify version bump type for new package introduction.

The changeset uses patch for a new package initialization. Since this PR is categorized as feat: (introducing a brand new package), consider using minor instead, which aligns with the monorepo's pre-1.0 semantic versioning convention where new features/packages are tracked with minor version bumps.

packages/rspeedy/tsconfig.json (1)

12-12: LGTM!

The new reference follows the existing pattern perfectly—consistent syntax, formatting, and appropriate placement within the packages section. The entry integrates the new lynx-bundle-rslib-config package into the composite TypeScript build correctly.

packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)

7-24: decodeTemplate helper looks good for test usage

The platform switch, dynamic import of @lynx-js/tasm, and binary read/forward into the decoder are all reasonable here; given this is test-only, the direct cast to DecodeTemplateResult is acceptable and keeps the helper simple.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)

47-149: Layered entry transformation and runtime wrapper wiring look coherent

The bundlerChain correctly:

  • Clones & clears existing entries.
  • Generates background/main-thread variants for string/array entries and object entries (with or without explicit layer).
  • Tracks entry names and uses escapeRegex when building RegExp tests for the runtime wrapper plugins, avoiding invalid patterns from entry names with metacharacters.

This should give predictable __main-thread and background entries while safely targeting only the generated .js assets for wrapping.


238-261: Good encapsulation of rsbuild plugin and regex escaping helper

externalBundleRsbuildPlugin neatly hides the ExternalBundleWebpackPlugin wiring (including getEncodeMode() usage and ${libName}.lynx.bundle naming), and the standalone escapeRegex helper is a clean way to centralize safe regex construction for entry names.

This keeps the public API focused on defineExternalBundleRslibConfig/LAYERS while keeping bundler details internal.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

11-47: Main-thread runtime wrapper plugin implementation looks solid

The two BannerPlugin instances correctly wrap matching JS assets in an IIFE, initialize module/exports, and return module.exports, with an overridable test and proper @public annotations for API extraction. This aligns well with the described Lynx main-thread runtime requirements.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)

55-105: Compilation hook and bundle emission behavior are appropriate

Hooking at thisCompilationprocessAssets with PROCESS_ASSETS_STAGE_OPTIMIZE_HASH is a good spot to aggregate JS assets, run the encoder, and then emit a single ${bundleFileName} asset. Capturing assets before emitAsset and then deleting those entries ensures only the new external bundle (and optional tasm.json in DEBUG) remain, which matches the intended “single encoded bundle” output model.

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from ac65c1a to 077e3c9 Compare November 24, 2025 06:45
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/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1)

5-6: Remove invalid trailing comma in JSON.

The trailing comma after "noEmit": true, is invalid JSON syntax and will cause parsing to fail.

Apply this diff to fix the syntax error:

  "compilerOptions": {
    "rootDir": ".",
-   "noEmit": true,
+   "noEmit": true
  },
📜 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 ac65c1a and 077e3c9.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (19)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .changeset/stale-rings-tan.md
🚧 Files skipped from review as they are similar to previous changes (13)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/webpack/template-webpack-plugin/package.json
🧰 Additional context used
🧠 Learnings (25)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (6)
  • LAYERS (52-52)
  • defaultExternalBundleLibConfig (50-50)
  • defaultExternalBundleRsbuildConfig (51-51)
  • MainThreadRuntimeWrapperWebpackPlugin (57-57)
  • defineExternalBundleRslibConfig (49-49)
  • ExternalBundleWebpackPlugin (55-55)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (26-48)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
  • ExternalBundleWebpackPlugin (52-137)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
  • MainThreadRuntimeWrapperWebpackPluginOptions (58-58)
  • MainThreadRuntimeWrapperWebpackPlugin (57-57)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
  • compiler (81-105)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (6)
packages/rspeedy/lynx-bundle-rslib-config/package.json (2)

47-49: Verify the Node.js engine requirement.

The package specifies "node": ">=18", which differs from the root project's requirement of ^22 || ^24. Based on learnings, the lynx-js/devtool-mcp-server package has a similar divergence for Node.js v18 compatibility. Please confirm whether this package intentionally supports Node.js >=18 for broader external consumer compatibility, or if it should align with the root project's Node.js version requirements.


38-41: Update @lynx-js/tasm to an existing version.

The dependency @lynx-js/tasm is pinned to version 0.0.19, but this version does not exist on npm; the latest published version is 0.0.17. Update to 0.0.17 or another valid published version.

⛔ Skipped due to learnings
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

26-48: LGTM!

The plugin correctly wraps JavaScript modules with an IIFE pattern that provides module.exports functionality. The wrapper structure is necessary for lynx-core compatibility as confirmed in past review discussions.

packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)

5-58: LGTM!

The public API surface is well-documented with clear usage examples. The exports are properly structured, and the documentation explains the different usage patterns for main-thread and background contexts.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)

47-149: LGTM!

The bundlerChain logic correctly handles entry transformation for dual-layer (main-thread and background) bundles. The implementation properly:

  • Preserves explicit layer specifications
  • Creates layered variants for unspecified entries
  • Escapes entry names via escapeRegex before regex construction (line 261)
  • Registers wrapper plugins with appropriate test patterns

The minify configuration correctly preserves the IIFE wrapper needed for lynx-core module loading.

Note: The static analysis warnings on lines 138 and 143 about ReDoS are false positives. The escapeRegex function (line 261) properly escapes all regex metacharacters before interpolation, making the regex construction safe.


238-259: LGTM!

The externalBundleRsbuildPlugin correctly:

  • Dynamically imports @lynx-js/tasm for code splitting
  • Extracts the library name from the environment context
  • Configures ExternalBundleWebpackPlugin with appropriate bundle filename and encode function

Copy link
Collaborator

@upupming upupming left a comment

Choose a reason for hiding this comment

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

Generally LGTM!

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 077e3c9 to 1254f06 Compare November 26, 2025 08:57
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: 0

♻️ Duplicate comments (2)
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)

12-20: API Extractor warnings indicate incomplete public API surface.

The ae-unresolved-link warnings on lines 12-13 and 17-18 indicate that LibConfig is referenced in JSDoc but not exported from this package. This was already flagged in a previous review.

As per coding guidelines, after fixing the source code to re-export LibConfig from @rslib/core (or adjust type signatures), regenerate and commit the API report by running pnpm turbo api-extractor -- --local.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

221-236: Type mismatch: defaultExternalBundleRsbuildConfig spread at incorrect level.

Line 47 declares defaultExternalBundleRsbuildConfig as RslibConfig['lib'][0] (a lib-level config), but line 231 spreads it at the root level of the returned RslibConfig. While Rslib does support output, source, and tools at both levels, this creates a type inconsistency.

Consider either:

  1. Changing the type annotation to Partial<RslibConfig>, or
  2. Moving the spread inside the lib[0] object and adjusting the merge logic accordingly
🧹 Nitpick comments (3)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)

42-130: Consider adding cleanup between integration tests to ensure isolation.

The integration tests all write to subdirectories under fixtures/utils-lib/dist with different bundle IDs. While the distinct IDs prevent direct conflicts, leftover artifacts from previous test runs could affect assertions. Consider adding a beforeEach or afterEach hook to clean up the dist directory.

 describe('should build external bundle', () => {
   const fixtureDir = path.join(__dirname, './fixtures/utils-lib')
+
+  afterEach(() => {
+    const distPath = path.join(fixtureDir, 'dist')
+    if (fs.existsSync(distPath)) {
+      fs.rmSync(distPath, { recursive: true })
+    }
+  })
 
   it('should build both main-thread and background code into external bundle', async () => {
packages/rspeedy/lynx-bundle-rslib-config/package.json (1)

42-46: Consider declaring @rslib/core as a peer dependency.

The package's public API (e.g., defineExternalBundleRslibConfig) returns RslibConfig and accepts LibConfig from @rslib/core. Consumers will need @rslib/core installed to use this package effectively. Adding it as a peerDependency makes this requirement explicit:

   "devDependencies": {
     "@rslib/core": "^0.15.0",
     "vitest": "^3.2.4",
     "webpack": "^5.102.0"
+  },
+  "peerDependencies": {
+    "@rslib/core": "^0.15.0"
   }
 }
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)

117-123: Consider making compiler options configurable for future flexibility.

The compilerOptions are currently hardcoded. While this works for the initial release, you may want to allow overriding some options (e.g., targetSdkVersion) via the plugin options for forward compatibility.

 export interface ExternalBundleWebpackPluginOptions {
   bundleFileName: string
   encode: (opts: unknown) => Promise<{ buffer: Buffer }>
+  /**
+   * Override default compiler options for encoding.
+   */
+  compilerOptions?: Partial<{
+    enableFiberArch: boolean
+    useLepusNG: boolean
+    enableReuseContext: boolean
+    bundleModuleMode: string
+    targetSdkVersion: string
+  }>
 }
📜 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 077e3c9 and 1254f06.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • .changeset/sour-ghosts-tease.md (1 hunks)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (11)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/tsconfig.json
  • website/rspress.config.ts
  • .changeset/stale-rings-tan.md
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/sour-ghosts-tease.md
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (28)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • .changeset/sour-ghosts-tease.md
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (2)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
  • MainThreadRuntimeWrapperWebpackPluginOptions (58-58)
  • MainThreadRuntimeWrapperWebpackPlugin (57-57)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)
packages/rspeedy/core/src/index.ts (2)
  • Rspack (71-71)
  • RsbuildPlugin (67-67)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (26-48)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
  • ExternalBundleWebpackPlugin (52-137)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: build / Build (Ubuntu)
  • GitHub Check: build / Build (Windows)
  • GitHub Check: test-rust / Test (Ubuntu)
🔇 Additional comments (8)
.changeset/sour-ghosts-tease.md (1)

1-5: Unfortunately, I'm unable to clone the repository to verify the changeset directly. However, based on the learnings from this repository, I can provide important context for your review:

The learnings indicate that private packages (marked with "private": true in package.json) do not require changeset entries, even when their public APIs change or they are newly initialized, since they are not published externally.

To complete the verification, I need you to confirm one key detail:

Is @lynx-js/lynx-bundle-rslib-config marked as "private": true in its package.json?

  • If YES (private package): The changeset is likely correct—private packages don't require entries per repository conventions shown in learnings.
  • If NO (public package): The changeset should include an entry for the new package (e.g., "@lynx-js/lynx-bundle-rslib-config": "minor" for a new public package).

Additionally, if you can provide the content of packages/[path-to-new-package]/package.json or confirm its private status, I can rewrite the review comment accurately.

packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)

1-6: LGTM!

Standard API Extractor configuration extending the base config. This follows the repository's established pattern.

packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)

159-177: LGTM on debug mode tests.

The environment variable stubbing pattern with vi.stubEnv and vi.unstubAllEnvs is correct and ensures proper test isolation.

packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)

1-58: LGTM!

The package entry point is well-documented with clear usage examples and properly re-exports all public API entities. The @packageDocumentation JSDoc provides helpful quick-start instructions.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

26-48: LGTM!

The plugin correctly wraps main-thread bundles with an IIFE that provides CommonJS module scaffolding. The @public JSDoc tags are properly applied for API Extractor.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

136-146: Regex escaping is correctly implemented.

The escapeRegex helper on line 261 properly escapes all regex metacharacters before constructing the RegExp. The static analysis warning about ReDoS is a false positive because the escaped input cannot form a malicious pattern.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (2)

38-45: LGTM on debug detection logic.

The isDebug() function correctly parses the DEBUG environment variable and checks for relevant values case-insensitively.


55-79: LGTM on webpack hook integration.

The plugin correctly taps into thisCompilation and uses PROCESS_ASSETS_STAGE_OPTIMIZE_HASH to run after minification, ensuring the final bundle content is captured.

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 1254f06 to a93fee8 Compare November 26, 2025 09:18
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/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1)

5-5: Remove invalid trailing comma in JSON.

Line 5 contains a trailing comma after "noEmit": true, which is invalid JSON syntax. JSON does not support trailing commas, and this will cause the configuration file to fail parsing.

Apply this diff to fix the syntax error:

  "compilerOptions": {
    "rootDir": ".",
-   "noEmit": true,
+   "noEmit": true
  },
📜 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 1254f06 and a93fee8.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • .changeset/sour-ghosts-tease.md (1 hunks)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (12)
  • packages/webpack/template-webpack-plugin/package.json
  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧰 Additional context used
📓 Path-based instructions (1)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/stale-rings-tan.md
🧠 Learnings (31)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • website/rspress.config.ts
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • website/rspress.config.ts
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • website/rspress.config.ts
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • website/package.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • .changeset/stale-rings-tan.md
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • .changeset/stale-rings-tan.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (1)
website/rspress.config.ts (1)
website/sidebars/api.ts (1)
  • createAPI (155-192)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 138-138: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 143-143: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (8)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)

26-48: LGTM!

The IIFE wrapper implementation correctly provides the module.exports scaffold required by lynx-core. The two BannerPlugin instances appropriately wrap the bundle with initialization code (header) and the return statement (footer).

website/package.json (1)

24-24: LGTM!

The workspace dependency addition is consistent with the monorepo pattern and enables the website to document the new package's API.

.changeset/stale-rings-tan.md (1)

1-22: LGTM!

The changeset properly describes the new package with a clear example. The usage snippet accurately reflects the public API defined in the package.

Based on learnings, this changeset follows the repository's conventions for documenting new package introductions.

website/rspress.config.ts (1)

67-69: LGTM!

The API documentation entries are properly configured for both English and Chinese locales, following the established pattern used by other Rspeedy plugins in the sidebar configuration.

Also applies to: 207-210

packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)

1-58: LGTM!

The package documentation is comprehensive and the public API surface is well-organized. The re-exports clearly expose the configuration utilities and webpack plugins for external consumption.

Based on past review comments, the __BACKGROUND__ conditional usage in the documentation (lines 39-43) reflects the current Lynx engine limitation and will be addressed in future Lynx RFC updates.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

17-149: LGTM!

The implementation correctly handles entry layering for both MAIN_THREAD and BACKGROUND contexts:

  • The bundlerChain logic properly transforms string, array, and object entries into layered variants
  • The escapeRegex utility safely handles entry names containing regex metacharacters before constructing test patterns (lines 138-139, 143-144)
  • The externalBundleRsbuildPlugin correctly integrates with the build system and imports the tasm encode function

Note: The static analysis warnings about ReDoS on lines 138 and 143 are false positives—entry names are escaped via escapeRegex before being used in RegExp construction.

Also applies to: 221-259, 261-261

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (2)

11-36: LGTM!

The plugin interface is well-documented with clear examples, and the debug mode detection correctly checks for common debug environment variable patterns used in the ecosystem.

Also applies to: 38-45


52-134: LGTM!

The plugin implementation is well-structured:

  • Hooks into the appropriate compilation stage (PROCESS_ASSETS_STAGE_OPTIMIZE_HASH)
  • Properly collects and encodes JS assets into custom sections
  • Conditionally emits debug artifacts (tasm.json) when DEBUG env is set
  • Cleans up intermediate assets in production mode

Based on past review comments, the targetSdkVersion: '3.4' requirement (line 120) and appType: 'DynamicComponent' (line 126) are intentional design choices for the external bundle format. CSS handling in custom sections is not currently supported by the Lynx engine and is acknowledged as a future enhancement.

upupming
upupming previously approved these changes Nov 26, 2025
@luhc228 luhc228 enabled auto-merge (squash) November 26, 2025 13:25
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: 0

🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)

113-121: Consider using replaceAll or a regex for robust .js removal.

Line 118 uses replace('.js', '') which only removes the first occurrence. While unlikely, a filename like foo.js.bundle.js would become foo.bundle.js instead of the intended foo.js.bundle.

Apply this diff for safer replacement:

     const customSections = assets
       .filter(({ name }) => name.endsWith('.js'))
       .reduce<Record<string, { content: string }>>((prev, cur) => ({
         ...prev,
-        [cur.name.replace('.js', '')]: {
+        [cur.name.replace(/\.js$/, '')]: {
           content: cur.source.source().toString(),
         },
       }), {})
📜 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 a93fee8 and eaec76a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • .changeset/sour-ghosts-tease.md (1 hunks)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (13)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • .changeset/stale-rings-tan.md
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • website/rspress.config.ts
🧰 Additional context used
📓 Path-based instructions (2)
.changeset/*.md

📄 CodeRabbit inference engine (AGENTS.md)

For contributions, generate and commit a Changeset describing your changes

Files:

  • .changeset/sour-ghosts-tease.md
packages/**/etc/*.api.md

📄 CodeRabbit inference engine (AGENTS.md)

Always commit API extractor output after running pnpm turbo api-extractor -- --local (commit updated API report files)

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
🧠 Learnings (25)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to packages/**/etc/*.api.md : Always commit API extractor output after running `pnpm turbo api-extractor -- --local` (commit updated API report files)

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • .changeset/sour-ghosts-tease.md
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)
  • ExternalBundleWebpackPluginOptions (55-55)
  • ExternalBundleWebpackPlugin (54-54)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 240-240: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 245-245: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (13)
.changeset/sour-ghosts-tease.md (1)

1-5: Unable to verify changeset completeness—repository access unavailable.

I attempted to verify the changeset against the repository structure, but the sandbox environment cannot clone the repository to access package.json files and related configurations.

The verification points that cannot be confirmed:

  1. Whether the package name @lynx-js/template-webpack-plugin matches the exact scoped name in its package.json#name
  2. Whether a new @lynx-js/lynx-bundle-rslib-config package exists and requires its own changeset entry (if public)
  3. Whether the @lynx-js/tasm dependency actually exists in template-webpack-plugin and was upgraded from the claimed version
  4. Whether all modified src/** files have corresponding changeset entries

Based on learnings from the repository, changesets must use exact scoped package names and all public package changes require entries. Without repository access, these cannot be verified.

packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1)

1-6: LGTM!

The API Extractor configuration correctly extends the shared base configuration, following the repository's established pattern for public API surface management.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (3)

6-42: LGTM!

The ExternalBundleWebpackPluginOptions interface is well-documented with clear JSDoc examples. The optional targetSdkVersion with a sensible default of '3.4' aligns with the lynx.fetchBundle SDK requirement noted in the past review comments.


44-51: LGTM!

The isDebug() helper provides a reasonable mechanism for debug mode detection, supporting multiple debug identifiers (rsbuild, rspeedy, *) via the standard DEBUG environment variable.


87-111: LGTM!

The #generateExternalBundle method correctly:

  • Emits the encoded bundle with the configured filename
  • Outputs debug information (tasm.json) only when DEBUG is set
  • Cleans up intermediate .js assets in production mode
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)

1-57: LGTM!

The package entry point is well-structured with:

  • Comprehensive @packageDocumentation with step-by-step usage examples
  • Proper separation of value exports and type-only exports
  • Clear re-exports from internal modules establishing the public API surface

The documentation correctly reflects the current __BACKGROUND__ conditional requirement for loading scripts in different threads, as discussed in past review comments.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (5)

13-35: LGTM!

The EncodeOptions interface and LAYERS constant are well-documented and provide clear, type-safe configuration options for external bundle layers.


37-76: LGTM!

The defaultExternalBundleLibConfig provides sensible defaults:

  • CJS format with ES2015 syntax for Lynx compatibility
  • Disabled auto-extension and auto-external for explicit control
  • Proper minify options preserving IIFE wrappers required by Lynx module loader
  • Includes node_modules in source transformation

The negate_iife: false and side_effects: false compression options are correctly documented as required for the Lynx module wrapper.


148-165: LGTM!

The defineExternalBundleRslibConfig function correctly:

  • Merges user config with defaults using rsbuild.mergeRsbuildConfig
  • Attaches the entry and bundle generation plugins
  • Passes through encodeOptions.targetSdkVersion to the bundle plugin

236-249: Static analysis false positive - regex is safely escaped.

The static analysis warnings on lines 240 and 245 flag RegExp construction from variable input. However, the escapeRegex() helper (line 279) properly escapes all regex metacharacters before interpolation, making these patterns safe literal matches. The resulting pattern ${escapeRegex(name)}\.js$ will only match the exact filename.

This was already addressed in a past review where unescaped regex construction was flagged and fixed.


253-279: LGTM!

The externalBundleRsbuildPlugin correctly:

  • Dynamically imports @lynx-js/tasm for the encode function
  • Configures ExternalBundleWebpackPlugin with the library name as bundle filename
  • Passes through the optional targetSdkVersion

The escapeRegex helper at line 279 is a standard, correct implementation for escaping regex metacharacters.

packages/rspeedy/lynx-bundle-rslib-config/package.json (1)

42-46: Vitest version 3.2.4 is valid and stable.

The review comment's concern about vitest ^3.2.4 being unverified is unfounded. Vitest version 3.2.4 was published on June 17, 2025, and is a stable release. As of November 2025, this version has been available for approximately five months and is suitable for use.

packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1)

12-13: The task has been completed. My final rewritten review comment was provided in the previous response with the `` tag. Due to persistent repository access failures, manual verification is required to confirm whether the LibConfig export issue exists in the source code.

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch 2 times, most recently from 1f4ee2b to c17dc62 Compare November 28, 2025 11:37
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

📜 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 1f4ee2b and c17dc62.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • .changeset/sour-ghosts-tease.md (1 hunks)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • .changeset/stale-rings-tan.md
🧰 Additional context used
🧠 Learnings (32)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-13T11:36:12.075Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:52-72
Timestamp: 2025-08-13T11:36:12.075Z
Learning: The lynx-stack project requires Node.js >=22 as specified in package.json engines, so Node.js compatibility fallbacks for features introduced before v22 are unnecessary.

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-07-22T09:26:16.722Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-20T04:56:36.011Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1566
File: package.json:53-53
Timestamp: 2025-08-20T04:56:36.011Z
Learning: In lynx-stack, Node.js v24 is the preferred/default version for development (established in PR #1557), but Node.js v22 compatibility is maintained specifically for external CI systems like rspack-ecosystem-ci. The engines.node specification uses "^22 || ^24" to support both versions while keeping v24 as the primary target.

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-14T12:54:51.143Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • website/package.json
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself, not as part of the workspace's dependency tree. This is different from the internal configDependencies field that can appear within pnpm-lock.yaml for tracking configuration file dependencies.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies in pnpm-workspace.yaml (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in or modify pnpm-lock.yaml. These plugins are managed separately by pnpm itself as configuration-level dependencies, not as part of the workspace's dependency tree. Running pnpm install after adding configDependencies will not change the lockfile.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-06T08:25:15.392Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1447
File: pnpm-workspace.yaml:20-22
Timestamp: 2025-08-06T08:25:15.392Z
Learning: In pnpm, configDependencies (used for plugins like pnpm/plugin-better-defaults and pnpm/plugin-trusted-deps) do not appear in pnpm-lock.yaml and do not require lockfile updates. They are installed separately in pnpm's own cache/store as configuration artifacts, not as part of the workspace's dependency tree.

Applied to files:

  • website/package.json
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-07-22T09:23:07.797Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-09-29T06:43:40.182Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-09-29T06:43:40.182Z
Learning: Applies to .changeset/*.md : For contributions, generate and commit a Changeset describing your changes

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-07-16T06:28:26.463Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-core/src/uiThread/createRenderAllOnUI.ts:95-99
Timestamp: 2025-07-16T06:28:26.463Z
Learning: In the lynx-stack codebase, CSS selectors in SSR hydration are generated by their own packages, ensuring a predictable format that makes simple string manipulation safe and preferable over regex for performance reasons.

Applied to files:

  • packages/webpack/template-webpack-plugin/package.json
📚 Learning: 2025-10-10T08:22:12.051Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1837
File: packages/web-platform/web-mainthread-apis/src/prepareMainThreadAPIs.ts:266-266
Timestamp: 2025-10-10T08:22:12.051Z
Learning: In packages/web-platform/web-mainthread-apis, the handleUpdatedData function returned from prepareMainThreadAPIs is internal-only, used to serve web-core. It does not require public documentation, type exports, or SSR support.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-12T16:09:32.413Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-11-05T03:26:52.546Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1916
File: packages/react/transform/crates/swc_plugin_snapshot/lib.rs:9-9
Timestamp: 2025-11-05T03:26:52.546Z
Learning: In the lynx-stack repository's swc_core v47 upgrade (PR #1916), the import `use swc_core::atoms as swc_atoms;` is required in files that use the `quote!` macro (e.g., packages/react/transform/crates/swc_plugin_snapshot/lib.rs, swc_plugin_list/lib.rs, swc_plugin_worklet/gen_stmt.rs) even though swc_atoms may not appear explicitly in the source code. This is because the quote! macro generates code that internally references swc_atoms. Removing this import causes compiler error: "failed to resolve: use of unresolved module or unlinked crate `swc_atoms`".

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-09-18T04:43:54.426Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1771
File: packages/react/transform/tests/__swc_snapshots__/src/swc_plugin_snapshot/mod.rs/basic_component_with_static_sibling.js:2-2
Timestamp: 2025-09-18T04:43:54.426Z
Learning: In the lynx-family/lynx-stack repository, the `add_pure_comment` function in packages/react/transform/src/swc_plugin_compat/mod.rs (around lines 478-482) is specifically for `wrapWithLynxComponent` calls, not `createSnapshot` calls. The PURE comment injection for `createSnapshot` is handled separately in swc_plugin_snapshot/mod.rs.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
📚 Learning: 2025-08-21T07:21:51.621Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1562
File: packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs:261-283
Timestamp: 2025-08-21T07:21:51.621Z
Learning: In packages/react/transform/src/swc_plugin_snapshot/jsx_helpers.rs, the team prefers to keep the original unreachable! logic for JSXSpreadChild in jsx_is_children_full_dynamic function rather than implementing defensive error handling.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (4)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (6)
  • EncodeOptions (53-53)
  • LAYERS (51-51)
  • defaultExternalBundleLibConfig (50-50)
  • defineExternalBundleRslibConfig (49-49)
  • MainThreadRuntimeWrapperWebpackPlugin (56-56)
  • ExternalBundleWebpackPlugin (54-54)
packages/rspeedy/core/src/index.ts (2)
  • RsbuildPlugin (67-67)
  • Rspack (71-71)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (26-48)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
  • ExternalBundleWebpackPlugin (58-141)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 240-240: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 245-245: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (17)
packages/webpack/template-webpack-plugin/package.json (1)

40-40: I attempted to verify the changeset entry, but encountered a repository access issue. However, I can still address the review comment based on the context available.

The original review comment contains a valid concern that was already flagged by a past reviewer: a changeset entry should accompany the dependency upgrade of @lynx-js/tasm from 0.0.18 to 0.0.20 in this public package.

Based on the repository learnings provided:

  • Public packages in lynx-stack require changeset entries for meaningful changes
  • The past reviewer already identified this as needing a changeset
  • Dependency updates in public packages should be documented in changesets

Add a changeset entry for the @lynx-js/tasm dependency upgrade.

The dependency update from @lynx-js/tasm 0.0.18 to 0.0.20 in this public package requires a corresponding changeset entry. Per the repository's convention and the past review feedback, please verify or create a changeset file documenting this change using the exact package name @lynx-js/template-webpack-plugin.

website/package.json (1)

24-24: LGTM!

The addition of the new workspace dependency follows the established monorepo pattern and correctly references the new package being introduced in this PR.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (2)

11-20: LGTM!

The options interface is well-typed and documented, correctly referencing the BannerPlugin's test option type.


26-48: LGTM!

The plugin implementation correctly wraps the bundle with an IIFE that returns module.exports. The two-stage BannerPlugin approach (header + footer) properly constructs the wrapper, and the pattern is confirmed necessary for lynx-core compatibility per past review discussions.

packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (2)

5-47: LGTM!

The package documentation is comprehensive and includes clear examples for installation and usage. The __BACKGROUND__ conditional loading pattern is a Lynx Engine requirement for differentiating main-thread and background-thread bundles, as confirmed in past review discussions.


48-57: LGTM!

The re-export structure is clean and follows TypeScript best practices by separating type exports from value exports. All exports align with the public API surface documented in the package.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (6)

18-25: LGTM!

The EncodeOptions interface is well-documented with a clear default value that aligns with the minimum Lynx SDK version required for fetchBundle support.


32-35: LGTM!

The LAYERS constant provides type-safe layer names with proper as const assertion for literal type inference.


42-76: LGTM!

The default configuration is well-suited for Lynx external bundles with appropriate settings:

  • Preserves IIFE wrappers needed for module loading (negate_iife: false)
  • Disables unsupported shims for Lynx compatibility
  • Includes node_modules transformation to ES2015 target
  • Correctly handles both dependencies and peerDependencies (per past review feedback)

148-165: LGTM!

The main configuration function correctly merges user config with defaults and registers the necessary plugins for entry layering and bundle generation. The comprehensive JSDoc examples above provide clear usage guidance for all three scenarios (background-only, main-thread-only, and dual-thread bundles).


167-251: LGTM!

The entry rewriting logic correctly handles all three entry scenarios:

  1. String/array entries → dual-layered (main-thread + background)
  2. Object entries with explicit layer → single layer
  3. Object entries without layer → dual-layered

The escapeRegex helper (line 279) properly sanitizes entry names before regex construction, so the static analysis warnings about RegExp from variable input are false positives.

Also applies to: 279-279


253-277: LGTM!

The bundle generation plugin correctly integrates with the tasm encoder via dynamic import and properly configures the ExternalBundleWebpackPlugin with the bundle filename and encoding options.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (5)

11-42: LGTM!

The options interface is well-documented with clear examples for each field. The encode signature correctly matches the tasm API contract.


44-51: LGTM!

The debug detection helper correctly checks for relevant keywords in the DEBUG environment variable with case-insensitive matching.


61-85: LGTM!

The plugin correctly hooks into the PROCESS_ASSETS_STAGE_OPTIMIZE_HASH stage, which ensures the bundle is generated after all optimizations (minification, source maps) are complete.


87-111: LGTM!

The bundle generation logic appropriately handles debug vs. production modes:

  • Debug: preserves original assets and emits tasm.json for inspection
  • Production: cleans up original assets, leaving only the encoded bundle

123-140: LGTM!

The encoding configuration correctly sets up:

  • enableFiberArch: true for modern Lynx architecture
  • targetSdkVersion with appropriate default ('3.4' is minimum for fetchBundle support)
  • appType: 'DynamicComponent' for external bundle context

@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from c17dc62 to 5b4bf78 Compare November 29, 2025 03:36
@luhc228 luhc228 requested review from colinaaa and upupming December 1, 2025 02:04
@luhc228 luhc228 force-pushed the lynx-bundle-rslib-config branch from 5b4bf78 to 215c7ea Compare December 1, 2025 02:07
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: 0

🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

167-235: Clarify behavior for non‑Lynx layer values.

In externalBundleEntryRsbuildPlugin, any entry with value.layer other than LAYERS.MAIN_THREAD or LAYERS.BACKGROUND (including arbitrary strings) falls into the “not specify layer” branch and is duplicated into both layers with renamed entries.

If users ever rely on other webpack/rsbuild layer names (e.g. for SSR or other pipelines), this will silently change semantics. If the intent is “only our two LAYERS values are supported”, consider either:

  • Treating only undefined as “no layer specified”, or
  • Narrowing the layer type around LAYERS for configs using this helper, and documenting that other layer values aren’t supported.

Otherwise, a brief doc note about this behavior would help avoid surprises.

📜 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 5b4bf78 and 215c7ea.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (20)
  • .changeset/sour-ghosts-tease.md (1 hunks)
  • .changeset/stale-rings-tan.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/README.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/package.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json (1 hunks)
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1 hunks)
  • packages/rspeedy/tsconfig.json (1 hunks)
  • packages/webpack/template-webpack-plugin/package.json (1 hunks)
  • website/package.json (1 hunks)
  • website/rspress.config.ts (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (14)
  • packages/webpack/template-webpack-plugin/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.json
  • website/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/lynx-bundle-rslib-config/README.md
  • .changeset/sour-ghosts-tease.md
  • packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json
  • website/rspress.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/api-extractor.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • .changeset/stale-rings-tan.md
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, empty changeset files (containing only `---\n\n---`) are used for internal changes that modify src/** files but don't require meaningful release notes, such as private package changes or testing-only modifications. This satisfies CI requirements without generating user-facing release notes.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 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.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1330
File: .changeset/olive-animals-attend.md:1-3
Timestamp: 2025-07-22T09:23:07.797Z
Learning: In the lynx-family/lynx-stack repository, changesets are only required for meaningful changes to end-users such as bugfixes and features. Internal/development changes like chores, refactoring, or removing debug info do not need changeset entries.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: .changeset/brave-melons-add.md:1-7
Timestamp: 2025-08-14T12:54:51.143Z
Learning: In the lynx-family/lynx-stack repository, packages use 0.x.x versioning where minor version bumps indicate breaking changes (not major bumps), following pre-1.0 semantic versioning conventions.
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/rspeedy/create-rspeedy/template-react-vitest-rltl-js/vitest.config.js` is a template file for scaffolding new Rspeedy projects, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-06T13:28:57.182Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1453
File: vitest.config.ts:49-61
Timestamp: 2025-08-06T13:28:57.182Z
Learning: In the lynx-family/lynx-stack repository, the file `packages/react/testing-library/src/vitest.config.js` is source code for the testing library that gets exported for users, not a test configuration that should be included in the main vitest projects array.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/tsconfig.json
📚 Learning: 2025-08-27T08:10:09.932Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1612
File: packages/rspeedy/create-rspeedy/template-react-vitest-rltl-ts/src/tsconfig.json:3-13
Timestamp: 2025-08-27T08:10:09.932Z
Learning: In the lynx-family/lynx-stack repository, Rspeedy templates use `lynx-js/rspeedy/client` types via `rspeedy-env.d.ts` instead of `vite/client` types. Rspeedy provides its own client-side environment type definitions and doesn't require direct Vite type references.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-11T05:59:28.530Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:4-6
Timestamp: 2025-08-11T05:59:28.530Z
Learning: In the lynx-family/lynx-stack repository, the `packages/react/testing-library` package does not have `vite` as a direct dependency. It relies on `vitest` being available from the monorepo root and accesses Vite types through re-exports from `vitest/node`. Direct imports from `vite` should not be suggested for this package.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
📚 Learning: 2025-08-11T05:57:18.212Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/testing-library/testing-environment/src/index.ts:255-258
Timestamp: 2025-08-11T05:57:18.212Z
Learning: In the ReactLynx testing environment (`packages/testing-library/testing-environment/src/index.ts`), the dual assignment pattern `target.console.method = console.method = () => {}` is required for rstest compatibility. This is because rstest provides `console` in an IIFE (Immediately Invoked Function Expression), and both the target and global console need to have these methods defined for proper test execution.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
📚 Learning: 2025-09-18T08:12:56.802Z
Learnt from: Sherry-hue
Repo: lynx-family/lynx-stack PR: 1770
File: packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts:316-318
Timestamp: 2025-09-18T08:12:56.802Z
Learning: In packages/web-platform/web-mainthread-apis/src/utils/processStyleInfo.ts, the current implementation uses cardStyleElement.textContent += for lazy component styles. While this could theoretically invalidate rule indices by reparsing the stylesheet, Sherry-hue indicated that UIDs don't repeat for the same element, making this approach acceptable for now. A future optimization to use separate style elements per entry was discussed but deferred to a separate PR to keep the current lazy bundle PR focused.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-07-16T06:25:41.055Z
Learnt from: PupilTong
Repo: lynx-family/lynx-stack PR: 1029
File: packages/web-platform/web-mainthread-apis/src/createMainThreadGlobalThis.ts:214-217
Timestamp: 2025-07-16T06:25:41.055Z
Learning: In the lynx-stack codebase, CSS strings produced by `genCssContent` are considered trusted developer input, so additional sanitization/escaping is not required.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-07T04:00:59.645Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1454
File: pnpm-workspace.yaml:46-46
Timestamp: 2025-08-07T04:00:59.645Z
Learning: In the lynx-family/lynx-stack repository, the webpack patch (patches/webpack5.101.0.patch) was created to fix issues with webpack5.99.9 but only takes effect on webpack5.100.0 and later versions. The patchedDependencies entry should use "webpack@^5.100.0" to ensure the patch applies to the correct version range.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-27T12:42:01.095Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1616
File: packages/webpack/cache-events-webpack-plugin/test/cases/not-cache-events/lazy-bundle/index.js:3-3
Timestamp: 2025-08-27T12:42:01.095Z
Learning: In webpack, properties like __webpack_require__.lynx_ce are injected during compilation/build time when webpack processes modules and generates bundles, not at runtime when dynamic imports execute. Tests for such properties don't need to wait for dynamic imports to complete.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts
  • packages/rspeedy/tsconfig.json
📚 Learning: 2025-08-21T08:46:54.494Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/cache-events-webpack-plugin/src/LynxCacheEventsRuntimeModule.ts:23-27
Timestamp: 2025-08-21T08:46:54.494Z
Learning: In Lynx webpack runtime modules, the team prioritizes performance and simplicity over defensive runtime error handling. They prefer relying on compile-time type safety (TypeScript) rather than adding runtime checks like try-catch blocks or type validation, especially for performance-critical code like cache event setup/cleanup functions.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts
📚 Learning: 2025-09-12T09:43:04.847Z
Learnt from: gaoachao
Repo: lynx-family/lynx-stack PR: 1736
File: .changeset/spotty-experts-smoke.md:1-3
Timestamp: 2025-09-12T09:43:04.847Z
Learning: In the lynx-family/lynx-stack repository, private packages (marked with "private": true in package.json) like lynx-js/react-transform don't require meaningful changeset entries even when their public APIs change, since they are not published externally and only affect internal development.

Applied to files:

  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-11-06T01:19:23.670Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1917
File: packages/mcp-servers/devtool-mcp-server/tsconfig.json:8-8
Timestamp: 2025-11-06T01:19:23.670Z
Learning: The lynx-js/devtool-mcp-server package in lynx-family/lynx-stack targets Node.js >=18.19 (specified in its package.json engines), which is different from the root project's requirement of Node.js ^22 || ^24. The package uses "lib": ["ES2024.Promise"] in its tsconfig.json because it manually includes polyfills for Promise.withResolvers while maintaining compatibility with Node.js v18.

Applied to files:

  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-19T11:25:36.127Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1558
File: .changeset/solid-squids-fall.md:2-2
Timestamp: 2025-08-19T11:25:36.127Z
Learning: In the lynx-family/lynx-stack repository, changesets should use the exact package name from package.json#name, not generic or unscoped names. Each package has its own specific scoped name (e.g., "lynx-js/react-transform" for packages/react/transform).

Applied to files:

  • packages/rspeedy/tsconfig.json
📚 Learning: 2025-08-13T11:46:43.737Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1523
File: vitest.config.ts:5-6
Timestamp: 2025-08-13T11:46:43.737Z
Learning: In the lynx-stack codebase, default imports are consistently used for Node.js built-in modules (e.g., `import os from 'node:os'`, `import fs from 'node:fs'`). The TypeScript configuration supports esModuleInterop and allowSyntheticDefaultImports, making default imports the preferred pattern over namespace imports for Node.js built-ins.

Applied to files:

  • packages/rspeedy/tsconfig.json
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
📚 Learning: 2025-08-18T08:46:20.001Z
Learnt from: colinaaa
Repo: lynx-family/lynx-stack PR: 1547
File: packages/rspeedy/core/src/config/loadConfig.ts:11-11
Timestamp: 2025-08-18T08:46:20.001Z
Learning: `#register` and similar imports starting with "#" are Node.js subpath imports defined in the "imports" field of package.json, not TypeScript path mapping aliases. These are natively supported by both Node.js and TypeScript without requiring additional tsconfig.json configuration like "moduleResolution" or "resolvePackageJsonImports" settings.

Applied to files:

  • packages/rspeedy/tsconfig.json
📚 Learning: 2025-09-23T08:54:39.966Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1670
File: packages/webpack/css-extract-webpack-plugin/test/hotCases/hot/hot-update-json/dual-thread/__snapshot__/index.css:6-8
Timestamp: 2025-09-23T08:54:39.966Z
Learning: In the lynx-stack CSS extract webpack plugin tests, many test fixture CSS files intentionally use invalid CSS syntax like `color: 'red';` with quoted values. The snapshots correctly reflect this invalid CSS from the source fixtures. To fix CSS validation issues, the source fixture files should be updated first, then snapshots regenerated, rather than manually editing snapshots.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (4)
packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (6)
  • EncodeOptions (53-53)
  • LAYERS (51-51)
  • defaultExternalBundleLibConfig (50-50)
  • defineExternalBundleRslibConfig (49-49)
  • MainThreadRuntimeWrapperWebpackPlugin (56-56)
  • ExternalBundleWebpackPlugin (54-54)
packages/rspeedy/core/src/index.ts (2)
  • RsbuildPlugin (67-67)
  • Rspack (71-71)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/MainThreadRuntimeWrapperWebpackPlugin.ts (1)
  • MainThreadRuntimeWrapperWebpackPlugin (26-48)
packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (1)
  • ExternalBundleWebpackPlugin (58-141)
🪛 ast-grep (0.40.0)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts

[warning] 240-240: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)


[warning] 245-245: Regular expression constructed from variable input detected. This can lead to Regular Expression Denial of Service (ReDoS) attacks if the variable contains malicious patterns. Use libraries like 'recheck' to validate regex safety or use static patterns.
Context: new RegExp(${escapeRegex(name)}\\.js$)
Note: [CWE-1333] Inefficient Regular Expression Complexity [REFERENCES]
- https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
- https://cwe.mitre.org/data/definitions/1333.html

(regexp-from-variable)

🔇 Additional comments (12)
packages/rspeedy/tsconfig.json (1)

12-12: Reference added correctly to TypeScript composite configuration.

The new package reference follows the established pattern in the workspace references array, with proper path syntax and placement within the packages-start/packages-end boundaries.

Please verify that the referenced file packages/rspeedy/lynx-bundle-rslib-config/tsconfig.build.json exists in the repository.

packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)

5-25: decodeTemplate helper is clear and appropriate for test usage

The OS-based decoder selection plus a simple file read and narrow DecodeTemplateResult cast makes this helper straightforward and focused on the fields tests actually assert on. No issues from my side.

packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1)

1-5: Fixture exports look good and intentional

add is a straightforward helper, and using // @ts-expect-error around globalThis?.abc is reasonable in a fixture when you explicitly want to exercise an undeclared global without tightening typings.

packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)

1-10: Vitest project config is minimal and consistent

Using defineProject with a scoped, descriptive test.name and exporting it as the default config is consistent with typical per-package setups; nothing problematic here.

packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (4)

42-76: Default lib config is coherent for Lynx external bundles.

The defaultExternalBundleLibConfig choices (CJS + ES2015, disabled autoExternal, import.meta.url shim off, and the targeted Terser compress flags to keep the wrapper IIFE and returns) look consistent with the described Lynx loader/runtime requirements, and source.include: [/node_modules/] matches the intent to transpile dependencies. No issues from my side here.


78-165: Public API and factory shape are clear and consistent.

The JSDoc for defineExternalBundleRslibConfig, EncodeOptions, and LAYERS matches the implementation: examples use ./src/utils.ts, the generated entry names (utils / utils__main-thread) align with the later regex tests, and the encodeOptions default/forwarding into externalBundleRsbuildPlugin matches the targetSdkVersion default used in the webpack plugin. Looks good.


238-247: Regex tests around entry names look safe after escaping.

Using escapeRegex(name) and then constructing new RegExp(\${escapedName}\.js$`)` keeps the patterns literal and anchored, so even odd entry names can’t inject regex metacharacters. Given the simple structure and escaping, the static “regex-from-variable” warning here can be treated as a false positive.

Also applies to: 279-279


253-277: Encode plugin wiring is straightforward and matches the options contract.

externalBundleRsbuildPlugin lazily imports @lynx-js/tasm, derives bundleFileName from environment.name, and forwards the (possibly undefined) targetSdkVersion to ExternalBundleWebpackPlugin, which then applies its own '3.4' default. This keeps the package loosely coupled to tasm and avoids loading it unless the plugin is actually used. Implementation looks solid.

packages/rspeedy/lynx-bundle-rslib-config/src/webpack/ExternalBundleWebpackPlugin.ts (4)

11-42: Options interface and docs are aligned with usage.

ExternalBundleWebpackPluginOptions matches how the class uses it (string bundleFileName, async encode returning { buffer }, optional targetSdkVersion defaulted later), and the JSDoc examples using getEncodeMode() from @lynx-js/tasm are consistent with the surrounding code and tests.


44-51: Debug flag helper is simple and targeted.

isDebug()’s DEBUG parsing (comma‑split, case‑insensitive, matching rsbuild, rspeedy, or *) is straightforward and avoids extra work when the env var is unset. This is a reasonable scope for enabling the extra tasm.json output.


61-111: Asset hook and bundle emission logic look correct.

Hooking at PROCESS_ASSETS_STAGE_OPTIMIZE_HASH ensures all JS assets are ready before encoding. Capturing assets = compilation.getAssets() before emitAsset and then deleting from that list guarantees the newly emitted external bundle isn’t removed. The debug branch emitting tasm.json vs. pruning original assets in non‑debug builds is a clear, predictable behavior.


113-140: Encoding pipeline and JS asset handling are sound.

#encode correctly:

  • Filters to .js assets,
  • Strips only the trailing .js via /\.js$/, avoiding earlier multi‑.js edge cases,
  • Reads content with cur.source.source().toString(), and
  • Builds encodeOptions with enableFiberArch and a defaulted targetSdkVersion of '3.4'.

This matches the documented expectations for the external bundle encoder and keeps the options object JSON‑serializable for the debug artifact.

Copy link
Collaborator

@colinaaa colinaaa left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@luhc228 luhc228 merged commit 3692a16 into lynx-family:main Dec 1, 2025
177 of 187 checks passed
colinaaa pushed a commit that referenced this pull request Dec 7, 2025
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @lynx-js/[email protected]

### Minor Changes

- **BREAKING CHANGE**: Delay the `createSnapshot` operation to
`Snapshot` constructor to speed up IFR.
([#1899](#1899))

    This change refactors how snapshots are created and registered:

    -   Removed the `entryUniqID` function
- Snapshots are now lazily created via `snapshotCreatorMap` instead of
eagerly at bundle load time
- Snapshot IDs are generated at compile time and only prefixed with
`${globDynamicComponentEntry}:` for standalone lazy bundles

    **⚠️ Lazy Bundle Compatibility:**

- **Backward compatibility (new runtime → old lazy bundles)**: ✅
**Supported**. Old lazy bundles will work with the new runtime.

- **Forward compatibility (old runtime → new lazy bundles)**: ❌ **NOT
Supported**. Lower version consumers **will not be able to load lazy
bundles produced by this version** due to the changed snapshot creation
mechanism.

    **Migration guidance**:
If you are using lazy bundles, ensure all consumers are upgraded to this
version or later **before** deploying lazy bundles built with this
version. For monorepo setups, coordinate the upgrade across all
consuming applications.

### Patch Changes

- Preserve assignments to webpack runtime variables like
`__webpack_public_path__`, `__webpack_require__.p`, etc.
([#1958](#1958))

- Fixed blank screen issues with nested lists. Lazily created nested
lists were being flushed but not properly recorded, causing rendering
failures. ([#1963](#1963))

- fix: export `createRef` and `useRef` from
`@lynx-js/react/legacy-react-runtime`
([#1953](#1953))

## @lynx-js/[email protected]

### Minor Changes

- **BREAKING CHANGE**: Require `@lynx-js/rspeedy` 0.12.0.
([#1951](#1951))

### Patch Changes

- Support Yarn Plug'n'Play.
([#1964](#1964))

- Updated dependencies
\[[`738d44d`](738d44d),
[`5bbb439`](5bbb439),
[`3692a16`](3692a16),
[`d2e290b`](d2e290b),
[`738d44d`](738d44d)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Minor Changes

- **BREAKING CHANGE**: Use resolver from Rspack.
([#1964](#1964))

    The `createLazyResolver` now requires an `rspack` parameter:

    ```diff
- function createLazyResolver(directory: string, conditionNames:
string[]): (request: string) => Promise<string>;
+ function createLazyResolver(rspack: rspack, directory: string,
conditionNames: string[]): (request: string) => Promise<string>;
    ```

### Patch Changes

- Support Yarn Plug'n'Play.
([#1964](#1964))

## @lynx-js/[email protected]

### Minor Changes

- feat: new flex:val impl
([#1979](#1979))

### Patch Changes

- Updated dependencies
\[[`40c3a1a`](40c3a1a),
[`46bd5ee`](46bd5ee)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Minor Changes

- feat: new flex:val impl
([#1979](#1979))

### Patch Changes

- fix: x-input display should add !important to avoid override
([#1960](#1960))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Bump Rsbuild v1.6.9 with Rspack v1.6.5.
([#1967](#1967))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## [email protected]

### Patch Changes

- Bump `@rsbuild/plugin-type-check` v1.3.1.
([#1964](#1964))

## @lynx-js/[email protected]

### Patch Changes

- Add `@lynx-js/lynx-bundle-rslib-config` for bundling Lynx bundle with
[Rslib](https://rslib.rs/):
([#1943](#1943))

    ```js
    // rslib.config.js
import { defineExternalBundleRslibConfig } from
"@lynx-js/lynx-bundle-rslib-config";

    export default defineExternalBundleRslibConfig({
      id: "utils-lib",
      source: {
        entry: {
          utils: "./src/utils.ts",
        },
      },
    });
    ```

## @lynx-js/[email protected]

### Patch Changes

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- chore: update web-elements version of web-explorer
([#1962](#1962))

## @lynx-js/[email protected]

### Patch Changes

- fix: capture and bind event listener should be trigger correctly
([#1972](#1972))

- fix: the l-p-comp-uid of page should be '1'
([#1970](#1970))

-   Updated dependencies \[]:
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Updated dependencies
\[[`40c3a1a`](40c3a1a),
[`46bd5ee`](46bd5ee)]:
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]
    -   @lynx-js/[email protected]

## @lynx-js/[email protected]

### Patch Changes

- Set main thread JS basename to `lepusCode.filename` in tasm encode
data. It will ensure a filename is reported on MTS error without
devtools enabled.
([#1949](#1949))

## @lynx-js/[email protected]

### Patch Changes

- Set main thread JS basename to `lepusCode.filename` in tasm encode
data. It will ensure a filename is reported on MTS error without
devtools enabled.
([#1949](#1949))

- Upgrade `@lynx-js/tasm` to `0.0.20`.
([#1943](#1943))

- refactor: move web style info generation to the encode phase
([#1975](#1975))

## [email protected]



## @lynx-js/[email protected]



## @lynx-js/[email protected]



## @lynx-js/[email protected]



## @lynx-js/[email protected]

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

3 participants