Skip to content

feat(lynx-bundle-rslib-config): use LAYERS exposed by DSL plugins#2113

Closed
upupming wants to merge 1 commit intomainfrom
feat/external-bundle-entry-layers
Closed

feat(lynx-bundle-rslib-config): use LAYERS exposed by DSL plugins#2113
upupming wants to merge 1 commit intomainfrom
feat/external-bundle-entry-layers

Conversation

@upupming
Copy link
Copy Markdown
Collaborator

@upupming upupming commented Jan 15, 2026

Summary by CodeRabbit

  • Refactor
    • Layer configuration removed from the package public API; runtime now reads layer names from exposed plugins.
  • New Features
    • Switched example configs to use the simplified React Lynx plugin and added corresponding output options.
  • Tests
    • Updated and expanded tests to exercise the React Lynx plugin and related build behavior.
  • Chores
    • Added changesets, test setup, dev dependencies, lint ignores, and updated maintainers entries.

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

@upupming upupming requested a review from colinaaa as a code owner January 15, 2026 13:06
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Jan 15, 2026

🦋 Changeset detected

Latest commit: 506536f

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

This PR includes changesets to release 1 package
Name Type
@lynx-js/lynx-bundle-rslib-config 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
Copy Markdown
Contributor

coderabbitai bot commented Jan 15, 2026

📝 Walkthrough

Walkthrough

Refactors how LAYERS are provided: removed the module-exported LAYERS and now consumes layer names via the DSL exposure (api.useExposed(Symbol.for('LAYERS'))); plus related updates to React rsbuild plugins, tests, configs, and package/dev dependencies across examples and rspeedy packages.

Changes

Cohort / File(s) Summary
Changesets
\.changeset/bitter-waves-sleep.md, \.changeset/calm-spies-judge.md
Added two patch changesets: one for @lynx-js/lynx-bundle-rslib-config (use exposed LAYERS) and one for @lynx-js/react-rsbuild-plugin.
API surface / Package manifest
packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md, packages/rspeedy/lynx-bundle-rslib-config/package.json
Removed exported LAYERS from API doc; added devDependencies (@lynx-js/react, @lynx-js/react-rsbuild-plugin, @lynx-js/vitest-setup).
Core implementation (layers exposure)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts, packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
Deleted local LAYERS export; refactored plugin to useExposed(Symbol.for('LAYERS')) with guard and to assign layers from the exposed value.
Plugin changes (entry & Lynx behavior)
packages/rspeedy/plugin-react/src/entry.ts, packages/rspeedy/plugin-react/src/pluginReactLynx.ts, packages/rspeedy/plugin-react/src/nodeEnv.ts, packages/rspeedy/plugin-react/src/swc.ts
Reworked entry control flow to run heavy per-entry logic only when caller is rspeedy; added applyNodeEnv and conditional rslib behavior; adjusted logging and SWC config merge strategy; conditional CSS/NodeEnv activation in pluginReactLynx.
Tests & fixtures
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts, packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts, packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
Tests updated to import LAYERS and pluginReactLynx from @lynx-js/react-rsbuild-plugin; new fixture changes (imports, logging, explicit types); added Vitest setupFiles.
Examples / configs
examples/react-externals/rslib-comp-lib.config.ts, examples/react-externals/rslib-reactlynx.config.ts
Removed rspack tooling blocks, define blocks and previous LAYERS-based alias plugin usage; replaced with pluginReactLynx() and adjusted output settings (e.g., minify: false).
Repo tooling & ownership
biome.jsonc, CODEOWNERS
Added lint ignore for test fixtures; added luhc228 to CODEOWNERS for packages/webpack/** and packages/rspeedy/**.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • colinaaa
  • luhc228

Poem

🐇 A rabbit hops from code to tree,
Layers now hop in DSL glee,
Exposed, not bound, they dance and play,
Plugins fetch them on their way,
Hooray for leaps that speed the day! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately captures the main feature: enabling lynx-bundle-rslib-config to use LAYERS exposed by DSL plugins instead of a local constant.

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

@upupming upupming requested a review from luhc228 January 15, 2026 13:07
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

106-121: Update JSDoc examples: LAYERS is no longer exported from the package.

The examples at lines 108 and 131 show importing LAYERS from @lynx-js/lynx-bundle-rslib-config, but it is not part of the public API. Users following these examples will encounter import errors. LAYERS is exposed by the Rsbuild DSL plugin (e.g., @lynx-js/react-rsbuild-plugin), not by this package.

Remove incorrect import from JSDoc examples
 * ```js
 * // rslib.config.js
-* import { defineExternalBundleRslibConfig, LAYERS } from '@lynx-js/lynx-bundle-rslib-config'
+* import { defineExternalBundleRslibConfig } from '@lynx-js/lynx-bundle-rslib-config'
+* import { LAYERS } from '@lynx-js/react-rsbuild-plugin' // or the relevant DSL plugin

Apply the same correction to both examples (lines 108 and 131).

🤖 Fix all issues with AI agents
In @.changeset/bitter-waves-sleep.md:
- Around line 1-5: The docs incorrectly show importing LAYERS from the package
even though LAYERS is not exported; update the example usage of
defineExternalBundleRslibConfig to remove the LAYERS import (or alternatively
export LAYERS from the package if intended), and clarify that LAYERS is obtained
at runtime via api.useExposed() so references to LAYERS in examples should be
removed or replaced with code that calls api.useExposed() where
defineExternalBundleRslibConfig is demonstrated.
🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)

197-211: Good defensive design with external dependency handling.

The implementation correctly:

  • Uses enforce: 'post' to ensure DSL plugins have executed and exposed LAYERS
  • Retrieves the exposed value via api.useExposed with the well-known symbol
  • Throws a clear error if LAYERS is not available

One consideration: the error message could be more helpful by suggesting which DSL plugin should be used.

💡 Optional: More descriptive error message
     if (!LAYERS) {
       throw new Error(
-        'external-bundle-rsbuild-plugin requires exposed `LAYERS`.',
+        'external-bundle-rsbuild-plugin requires exposed `LAYERS`. Ensure a DSL plugin (e.g., `@lynx-js/react-rsbuild-plugin`) is configured before this plugin.',
       )
     }
📜 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 a7a2ad7 and 506536f.

📒 Files selected for processing (4)
  • .changeset/bitter-waves-sleep.md
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
💤 Files with no reviewable changes (2)
  • packages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.md
  • packages/rspeedy/lynx-bundle-rslib-config/src/index.ts
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,jsx,tsx}: Use async/await patterns with proper error handling in JavaScript/TypeScript code
Follow linting rules defined in eslint.config.js including React-specific and TypeScript-specific rules
Additional code quality checks must pass according to biome.jsonc configuration

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strictest mode configuration as defined in tsconfig.json

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
**/*.{js,ts,jsx,tsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Code must conform to formatting rules defined in .dprint.jsonc configuration

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts
🧠 Learnings (9)
📚 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/bitter-waves-sleep.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/bitter-waves-sleep.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:

  • .changeset/bitter-waves-sleep.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/bitter-waves-sleep.md
  • 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/bitter-waves-sleep.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/bitter-waves-sleep.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:

  • .changeset/bitter-waves-sleep.md
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/all.ts : Export new components in `src/elements/all.ts` and add export configuration to `package.json` under `exports` for both types and default

Applied to files:

  • 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/externalBundleRslibConfig.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
packages/rspeedy/core/src/index.ts (1)
  • RsbuildPlugin (67-67)
🔇 Additional comments (3)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (3)

192-195: LGTM! Clear interface definition.

The ExposedLayers interface properly defines the expected shape of the exposed LAYERS object with readonly string properties.


232-278: Entry processing logic correctly uses externally sourced LAYERS.

The layer assignment logic for both string/array entries and object entries properly references the LAYERS constants from the exposed source. The conditional checks at lines 252 and 258 correctly handle all cases:

  • Explicit MAIN_THREAD layer
  • Explicit BACKGROUND layer
  • No layer specified (creates both variants)

310-314: Minor formatting adjustment.

This is a whitespace-only change that improves readability by placing the object argument on its own line.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 15, 2026

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
4672 1 4671 156
View the top 1 failed test(s) by shortest run time
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts > test/external-bundle.test.ts
Stack Traces | 0s run time
Error: Cannot find module '@lynx-js/react/jsx-runtime'
 ❯ ...../plugin-react-alias/src/index.ts:245:15
 ❯ Object.handler ...../plugin-react-alias/src/index.ts:75:11
 ❯ Object.callChain ../../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@.../core/dist/131.js:2346:45
 ❯ modifyBundlerChain ../../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@.../core/dist/131.js:3723:66
 ❯ generateRspackConfig ../../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@.../core/dist/131.js:3896:251
 ❯ initConfigs ../../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@.../core/dist/131.js:4046:108
 ❯ createCompiler_createCompiler ../../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@.../core/dist/131.js:4107:84
 ❯ build_build ../../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@.../core/dist/131.js:4180:22
 ❯ Object.build ../../../node_modules/.pnpm/@rsbuild+core@1.7.1/node_modules/@.../core/dist/131.js:8947:33
 ❯ Object.build ../../../node_modules/.pnpm/@rslib+core@0.19.1_@microso_24293333673ae5668efd8b73710e9c52/node_modules/@.../core/dist/index.js:2958:29

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Jan 15, 2026

Merging this PR will degrade performance by 8.93%

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

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

Performance Changes

Benchmark BASE HEAD Efficiency
basic-performance-nest-level-100 7.1 ms 7.8 ms -8.93%
basic-performance-div-10000 488.5 ms 458 ms +6.66%
transform 1000 view elements 46.9 ms 44.3 ms +5.9%

Comparing feat/external-bundle-entry-layers (ff1e3e4) with main (a7a2ad7)

Open in CodSpeed

Footnotes

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

@relativeci
Copy link
Copy Markdown

relativeci bot commented Jan 15, 2026

Web Explorer

#7191 Bundle Size — 383.59KiB (0%).

ff1e3e4(current) vs a7a2ad7 main#7179(baseline)

Bundle metrics  Change 1 change
                 Current
#7191
     Baseline
#7179
No change  Initial JS 154.03KiB 154.03KiB
No change  Initial CSS 35.05KiB 35.05KiB
No change  Cache Invalidation 0% 0%
No change  Chunks 8 8
No change  Assets 8 8
Change  Modules 237(-0.84%) 239
No change  Duplicate Modules 16 16
No change  Duplicate Code 3% 3%
No change  Packages 4 4
No change  Duplicate Packages 0 0
Bundle size by type  no changes
                 Current
#7191
     Baseline
#7179
No change  JS 251.56KiB 251.56KiB
No change  Other 96.98KiB 96.98KiB
No change  CSS 35.05KiB 35.05KiB

Bundle analysis reportBranch feat/external-bundle-entry-layer...Project dashboard


Generated by RelativeCIDocumentationReport issue

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/rspeedy/plugin-react/src/entry.ts (1)

322-325: Bug: Array self-push creates infinite loop potential.

The imports.push(...imports) on line 324 pushes imports into itself, which doesn't add the array items from item. This should push ...item instead.

🐛 Proposed fix
     if (Array.isArray(item)) {
-      imports.push(...imports)
+      imports.push(...item)
       continue
     }
🤖 Fix all issues with AI agents
In `@packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts`:
- Line 288: Update the test description string in the test case currently named
"it('should handle marcos')" to correct the typo to "it('should handle
macros')"; locate the test block using the exact string or the surrounding test
function name and update only the human-readable description to "macros" (also
scan for any other occurrences of the misspelled "marcos" in the same test file
and replace them with "macros").
🧹 Nitpick comments (2)
packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (1)

6-7: Consider removing the orphaned @ts-expect-error directive.

With abc now typed as any, the @ts-expect-error directive on line 6 may no longer be suppressing an actual error and could become a linting issue itself. If globalThis?.abc no longer triggers a type error, the directive should be removed.

♻️ Suggested fix
-// `@ts-expect-error`
 export const abc: any = globalThis?.abc || 0
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)

220-248: Move test setup into beforeAll for proper test isolation.

The vi.stubEnv, createRslib, and rslib.build() calls are executed at the describe block's top level (lines 226, 242-245). This runs during test file parsing rather than during test execution, which can cause issues with test isolation, cleanup, and parallel execution.

♻️ Suggested refactor using beforeAll hook
 describe('pluginReactLynx', async () => {
   const fixtureDir = path.join(__dirname, './fixtures/utils-lib')
   const distRoot = path.join(fixtureDir, 'dist')
-
   const bundleId = 'utils-reactlynx'
 
-  vi.stubEnv('DEBUG', 'rspeedy')
-
-  const rslibConfig = defineExternalBundleRslibConfig({
+  let rslib: Awaited<ReturnType<typeof createRslib>>
+  let decodedResult: Awaited<ReturnType<typeof decodeTemplate>>
+
+  beforeAll(async () => {
+    vi.stubEnv('DEBUG', 'rspeedy')
+
+    const rslibConfig = defineExternalBundleRslibConfig({
       source: {
         entry: {
           utils: path.join(__dirname, './fixtures/utils-lib/index.ts'),
         },
       },
       id: bundleId,
       output: {
         distPath: {
           root: distRoot,
         },
       },
       plugins: [pluginReactLynx()],
     })
-  const rslib = await createRslib({
-    config: rslibConfig,
-  })
-  await rslib.build()
-  const decodedResult = await decodeTemplate(
-    path.join(fixtureDir, 'dist/utils-reactlynx.lynx.bundle'),
-  )
+    rslib = await createRslib({
+      config: rslibConfig,
+    })
+    await rslib.build()
+    decodedResult = await decodeTemplate(
+      path.join(fixtureDir, 'dist/utils-reactlynx.lynx.bundle'),
+    )
+  })
+
+  afterAll(() => {
+    vi.unstubAllEnvs()
+  })
📜 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 506536f and ff1e3e4.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (13)
  • .changeset/calm-spies-judge.md
  • CODEOWNERS
  • biome.jsonc
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.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/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/plugin-react/src/entry.ts
  • packages/rspeedy/plugin-react/src/nodeEnv.ts
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/plugin-react/src/swc.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{js,ts,jsx,tsx}: Use async/await patterns with proper error handling in JavaScript/TypeScript code
Follow linting rules defined in eslint.config.js including React-specific and TypeScript-specific rules
Additional code quality checks must pass according to biome.jsonc configuration

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/plugin-react/src/nodeEnv.ts
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/plugin-react/src/entry.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • packages/rspeedy/plugin-react/src/swc.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strictest mode configuration as defined in tsconfig.json

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/plugin-react/src/nodeEnv.ts
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/plugin-react/src/entry.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • packages/rspeedy/plugin-react/src/swc.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
**/*.{js,ts,jsx,tsx,json,md}

📄 CodeRabbit inference engine (AGENTS.md)

Code must conform to formatting rules defined in .dprint.jsonc configuration

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/plugin-react/src/nodeEnv.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/plugin-react/src/entry.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • packages/rspeedy/plugin-react/src/swc.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
**/*.{test,spec}.{ts,tsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

Write tests using vitest framework with proper setup as defined in vitest.config.ts

Files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧠 Learnings (39)
📓 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: 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: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to **/*.{test,spec}.{ts,tsx,js} : Write tests using vitest framework with proper setup as defined in `vitest.config.ts`

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • biome.jsonc
  • .changeset/calm-spies-judge.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • biome.jsonc
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/tests/**/*.spec.ts : Create a separate spec file for new components (e.g., `tests/x-webview.spec.ts`) instead of adding to the monolithic `web-elements.spec.ts`

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.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:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • biome.jsonc
  • .changeset/calm-spies-judge.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/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • biome.jsonc
  • .changeset/calm-spies-judge.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/vitest.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • biome.jsonc
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to packages/web-platform/**/*.{test,spec}.{ts,tsx} : Web platform E2E tests must use Playwright as configured in test suite

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • CODEOWNERS
  • biome.jsonc
📚 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/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • .changeset/calm-spies-judge.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/plugin-react/src/entry.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to packages/react/**/*.{test,spec}.{ts,tsx,js} : For ReactLynx component testing, use testing-library utilities from `packages/react/testing-library/`

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • CODEOWNERS
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • biome.jsonc
  • .changeset/calm-spies-judge.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/vitest.config.ts
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • .changeset/calm-spies-judge.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to **/*.{ts,tsx} : Use TypeScript with strictest mode configuration as defined in `tsconfig.json`

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts
  • packages/rspeedy/plugin-react/src/swc.ts
📚 Learning: 2026-01-12T11:23:23.257Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/rspeedy/create-rspeedy/template-common/AGENTS.md:0-0
Timestamp: 2026-01-12T11:23:23.257Z
Learning: Applies to packages/rspeedy/create-rspeedy/template-common/**/*.{js,jsx,ts,tsx} : Write maintainable, performant, and accessible JavaScript code

Applied to files:

  • CODEOWNERS
  • biome.jsonc
  • packages/rspeedy/plugin-react/src/entry.ts
  • packages/rspeedy/plugin-react/src/swc.ts
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to packages/react/**/*.{tsx,jsx} : JSX in ReactLynx uses custom Rust-based compiler for transforms rather than standard JSX handling

Applied to files:

  • CODEOWNERS
  • packages/rspeedy/lynx-bundle-rslib-config/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • biome.jsonc
  • .changeset/calm-spies-judge.md
  • examples/react-externals/rslib-comp-lib.config.ts
  • packages/rspeedy/plugin-react/src/swc.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/**/*.ts : When creating new elements, inherit from `Element` via `Component` decorator and use reactive utilities provided by `element-reactive`

Applied to files:

  • CODEOWNERS
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/elements/all.ts : Export new components in `src/elements/all.ts` and add export configuration to `package.json` under `exports` for both types and default

Applied to files:

  • CODEOWNERS
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to packages/web-platform/web-core-wasm/**/* : When working with web-core-wasm package, follow specific instructions in `packages/web-platform/web-core-wasm/AGENTS.md`

Applied to files:

  • CODEOWNERS
📚 Learning: 2025-12-29T11:26:09.502Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: packages/web-platform/web-elements/AGENTS.md:0-0
Timestamp: 2025-12-29T11:26:09.502Z
Learning: Applies to packages/web-platform/web-elements/src/**/*.css : Respect existing polyfills in `src/compat` and check browser support before using bleeding-edge CSS features

Applied to files:

  • CODEOWNERS
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to **/*.{js,ts,jsx,tsx} : Follow linting rules defined in `eslint.config.js` including React-specific and TypeScript-specific rules

Applied to files:

  • CODEOWNERS
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • biome.jsonc
📚 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/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • .changeset/calm-spies-judge.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • .changeset/calm-spies-judge.md
  • examples/react-externals/rslib-reactlynx.config.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/package.json
  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/package.json
  • .changeset/calm-spies-judge.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:

  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • .changeset/calm-spies-judge.md
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/plugin-react/src/pluginReactLynx.ts
  • .changeset/calm-spies-judge.md
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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 packages/react/transform/src/swc_plugin_compat/mod.rs, the `add_pure_comment` function at 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. These are two distinct code paths that should be treated differently.

Applied to files:

  • packages/rspeedy/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/plugin-react/src/swc.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/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/plugin-react/src/entry.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/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • packages/rspeedy/plugin-react/src/entry.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • 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/plugin-react/src/pluginReactLynx.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
  • examples/react-externals/rslib-comp-lib.config.ts
  • examples/react-externals/rslib-reactlynx.config.ts
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/plugin-react/src/pluginReactLynx.ts
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to **/*.{js,ts,jsx,tsx} : Additional code quality checks must pass according to `biome.jsonc` configuration

Applied to files:

  • biome.jsonc
  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.586Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.586Z
Learning: Applies to **/*.{js,ts,jsx,tsx,json,md} : Code must conform to formatting rules defined in `.dprint.jsonc` configuration

Applied to files:

  • biome.jsonc
📚 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/calm-spies-judge.md
📚 Learning: 2025-08-14T06:51:39.827Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1370
File: packages/webpack/template-webpack-plugin/src/LynxEncodePlugin.ts:160-171
Timestamp: 2025-08-14T06:51:39.827Z
Learning: In the LynxEncodePlugin for events-cache.js functionality, when iterating through entrypoints to find background scripts, any entry .js file that exists in the manifest is guaranteed to be the background.js needed by design. The manifest generation logic ensures only background scripts from entrypoints are included, making the simple "first .js file in manifest" selection approach correct and reliable.

Applied to files:

  • packages/rspeedy/plugin-react/src/entry.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/plugin-react/src/entry.ts
📚 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/plugin-react/src/entry.ts
📚 Learning: 2025-10-29T10:28:27.519Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1899
File: packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/lib.rs/should_static_extract_dynamic_inline_style.js:20-24
Timestamp: 2025-10-29T10:28:27.519Z
Learning: Files inside packages/react/transform/crates/swc_plugin_snapshot/tests/__swc_snapshots__/ are auto-generated test snapshot files and should not be manually updated. Any issues with the generated code should be addressed in the code generator/transform logic, not in the snapshots themselves.

Applied to files:

  • packages/rspeedy/plugin-react/src/swc.ts
📚 Learning: 2025-08-11T06:00:04.376Z
Learnt from: upupming
Repo: lynx-family/lynx-stack PR: 1305
File: packages/react/testing-library/src/plugins/vitest.ts:59-61
Timestamp: 2025-08-11T06:00:04.376Z
Learning: In the lynx-family/lynx-stack repository, the `testingLibraryPlugin` in `packages/react/testing-library/src/plugins/vitest.ts` intentionally uses `process.exit` when jsdom installation fails, maintaining consistency with the previous implementation from `packages/react/testing-library/src/vitest.config.js`. This behavior should not be changed to use `this.error` despite being a Vite plugin best practice.

Applied to files:

  • packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧬 Code graph analysis (2)
packages/rspeedy/plugin-react/src/entry.ts (10)
packages/rspeedy/core/src/index.ts (1)
  • ExposedAPI (23-23)
packages/rspeedy/core/src/utils/is-lynx.ts (1)
  • isLynx (7-12)
packages/rspeedy/core/src/utils/is-web.ts (1)
  • isWeb (7-12)
packages/rspeedy/core/src/config/output/dist-path.ts (1)
  • DEFAULT_DIST_PATH_INTERMEDIATE (29-29)
packages/webpack/react-webpack-plugin/src/index.ts (1)
  • LAYERS (15-15)
packages/webpack/template-webpack-plugin/src/LynxTemplatePlugin.ts (1)
  • LynxTemplatePlugin (339-445)
packages/webpack/template-webpack-plugin/src/index.ts (3)
  • LynxTemplatePlugin (11-11)
  • LynxEncodePlugin (17-17)
  • WebEncodePlugin (19-19)
packages/webpack/runtime-wrapper-webpack-plugin/src/RuntimeWrapperWebpackPlugin.ts (1)
  • RuntimeWrapperWebpackPlugin (131-131)
packages/webpack/template-webpack-plugin/src/LynxEncodePlugin.ts (3)
  • name (293-298)
  • name (300-320)
  • LynxEncodePlugin (35-85)
packages/webpack/template-webpack-plugin/src/WebEncodePlugin.ts (1)
  • WebEncodePlugin (17-156)
examples/react-externals/rslib-comp-lib.config.ts (2)
packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
  • defineExternalBundleRslibConfig (167-190)
packages/rspeedy/plugin-react/src/pluginReactLynx.ts (1)
  • pluginReactLynx (284-416)
🔇 Additional comments (23)
biome.jsonc (1)

57-58: LGTM!

Adding the test fixtures directory to the linter ignore list is appropriate. Test fixtures often contain intentionally unconventional code (like console.log statements and any types) for testing edge cases, and this follows the established pattern of ignoring similar directories like __swc_snapshots__/** and __snapshots__/**.

CODEOWNERS (1)

2-3: LGTM!

Adding @luhc228 as a code owner for packages/webpack/** and packages/rspeedy/** improves review coverage and aligns with the PR reviewers list.

packages/rspeedy/plugin-react/src/nodeEnv.ts (1)

6-18: LGTM!

The implementation correctly uses mergeEnvironmentConfig for safe config merging. Using bracket notation process.env['NODE_ENV'] prevents bundler string replacement during build, and defaulting to false when undefined is appropriate to avoid unintended code transformations.

packages/rspeedy/plugin-react/src/swc.ts (2)

19-23: Verify tsx: false is intentional for the React plugin.

The parser syntax is set to TypeScript without TSX support. Since this is plugin-react, please verify this is intentional. If this plugin is only used for non-JSX files (e.g., utility libraries), this is correct. Otherwise, TSX files may not parse correctly.


29-38: LGTM!

The config callback pattern to delete env from the SWC config is a correct approach to avoid the "env and jsc.target cannot be used together" error when rslib sets env by default. The comment clearly explains the reasoning.

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

9-22: Test fixture logging is appropriate for validating build-time defines.

The console.log statements test that DCE flags (__MAIN_THREAD__, __LEPUS__, __BACKGROUND__), define flags (__DEV__, __PROFILE__), and process.env.NODE_ENV are correctly injected during the build process. This aligns with the PR's goal of testing the external bundle configuration.

packages/rspeedy/plugin-react/src/pluginReactLynx.ts (3)

331-332: LGTM! Clean conditional branching for rslib support.

The isRslib flag provides a clear mechanism to differentiate behavior when the plugin is invoked by rslib versus other callers. This enables the plugin to adapt its configuration appropriately for each context.


346-359: LGTM! Well-structured conditional application of CSS and NodeEnv.

The logic correctly:

  • Skips CSS application for rslib (line 346-348), as rslib likely handles CSS differently
  • Applies NodeEnv setup only for rslib (line 357-359), enabling rslib-specific environment configuration

This bifurcation keeps the plugin flexible for different build tool contexts.


407-412: LGTM! Simplified logging using built-in logger API.

The change from custom rspeedyAPIs.debug to api.logger?.debug is cleaner and uses the standard rsbuild plugin API for logging. The optional chaining safely handles cases where the logger might not be available.

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

43-45: LGTM! Appropriate devDependencies for test infrastructure.

The additions align with the PR's changes:

  • @lynx-js/react and @lynx-js/react-rsbuild-plugin support tests using pluginReactLynx
  • @lynx-js/vitest-setup corresponds to the setupFiles addition in vitest.config.ts

Using workspace:* correctly references the local monorepo packages.

packages/rspeedy/plugin-react/src/entry.ts (3)

66-71: LGTM! Proper guard for rspeedy-specific entry processing.

The isRspeedy check correctly confines the entry transformation logic to rspeedy invocations, allowing rslib to handle entries through its own path (likely via the applyNodeEnv in pluginReactLynx.ts).

The biome-ignore comment is appropriate since api.useExposed is an rsbuild plugin API method, not a React hook.


248-253: LGTM! Web environment handling retained outside main rspeedy flow.

The WebEncodePlugin application is correctly placed inside the isRspeedy block alongside the isWeb check, ensuring web-specific encoding only applies in the appropriate context.


258-258: LGTM! Safe logger fallback.

Using (api.logger ?? console).warn provides a sensible fallback when the API logger is unavailable, ensuring warnings are still visible during development.

.changeset/calm-spies-judge.md (1)

1-5: LGTM! Changeset follows repository conventions.

The changeset correctly:

  • Uses the exact scoped package name @lynx-js/react-rsbuild-plugin
  • Specifies patch level for new functionality without breaking changes
  • Provides a clear, concise description of the feature
packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)

7-7: LGTM! Setup files configuration aligns with devDependency.

The setupFiles entry correctly references @lynx-js/vitest-setup/setup.ts, which corresponds to the newly added devDependency. This ensures consistent test setup across the package's test suite.

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

13-16: LGTM!

The imports are correctly updated to use LAYERS and pluginReactLynx from @lynx-js/react-rsbuild-plugin, aligning with the PR's objective to consume layer names via DSL exposure.


55-80: LGTM!

The test correctly incorporates pluginReactLynx() in the config and validates that both main-thread and background code are built into the external bundle.


82-111: LGTM!

Good test coverage for the main-thread-only build scenario using LAYERS.MAIN_THREAD.


113-142: LGTM!

Good test coverage for the background-only build scenario using LAYERS.BACKGROUND.


250-286: LGTM!

The alias resolution test provides good coverage for verifying that the plugin correctly configures module aliases.


289-314: LGTM!

Good test coverage for macro handling across both background (utils) and main-thread (utils__main-thread) bundles.

examples/react-externals/rslib-comp-lib.config.ts (1)

1-38: LGTM!

The configuration is well-simplified by replacing the previous pluginReactAlias and manual rspack tooling with pluginReactLynx(). The externals mapping is comprehensive and correctly covers all the @lynx-js/react subpaths.

examples/react-externals/rslib-reactlynx.config.ts (1)

1-18: LGTM!

Clean and minimal configuration for building the ReactLynx external bundle. The removal of manual rspack tooling and define blocks in favor of pluginReactLynx() significantly simplifies this config while maintaining the same functionality.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

@upupming upupming force-pushed the feat/external-bundle-entry-layers branch from ff1e3e4 to 506536f Compare January 15, 2026 13:26
@upupming upupming closed this Jan 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant