feat(pluginReactLynx): support using in rslib#2114
Conversation
🦋 Changeset detectedLatest commit: 0b2aa0b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📝 WalkthroughWalkthroughThis PR removes the exported LAYERS constant and instead reads LAYERS via DSL exposure (Symbol.for('LAYERS')); integrates pluginReactLynx across examples and tests; refactors rspeedy/react plugins (isRspeedy/isRslib branching, NODE_ENV wiring, SWC parser scoping); updates deps, vitest setup, fixtures, and CODEOWNERS/biome ignores. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
colinaaa
left a comment
There was a problem hiding this comment.
LGTM! I verified the changes locally:
-
Tests Passed:
@lynx-js/lynx-bundle-rslib-configtests passed, confirming the newpluginReactLynxintegration works in Rslib.@lynx-js/react-rsbuild-plugintests passed, confirming no regressions for standard Rspeedy usage.
-
Logic:
- The branching logic using
api.context.callerName === 'rspeedy'effectively separates Rspeedy-specific entry handling from the core plugin logic. - The SWC config adjustment for Rslib compatibility makes sense.
- The branching logic using
Great work on unifying the plugin usage!
846ac1f to
873869d
Compare
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 2
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)
108-140: Update the JSDoc examples to the new LAYERS source.The examples still import
LAYERSfrom this package, but that export has been removed. Please update the snippets to the new recommended pattern (e.g., the DSL/plugin-provided layer constants or their string equivalents).
🤖 Fix all issues with AI agents
In @.changeset/bitter-waves-sleep.md:
- Around line 1-3: The changeset currently uses a patch bump for
"@lynx-js/lynx-bundle-rslib-config" but the removal of the LAYERS export is a
breaking API change; update the changeset header to use a minor bump (replace
"patch" with "minor") so the release follows the repo's pre-1.0
minor-as-breaking rule and ensure the changeset message references the LAYERS
export removal for clarity.
In `@packages/rspeedy/plugin-react/src/entry.ts`:
- Around line 84-86: The bug is in getChunks: the Array.isArray branch
mistakenly does imports.push(...imports) which drops the array's entry files;
fix it so array items are added to imports (e.g., iterate the array or spread
the array into imports) so multi-file entries like entry: { foo: ['./a','./b'] }
are preserved; update the Array.isArray branch inside getChunks to push the
actual array elements into the imports array rather than spreading imports into
itself.
🧹 Nitpick comments (1)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)
221-250: Consider adding cleanup forvi.stubEnv.The
vi.stubEnv('DEBUG', 'rspeedy')on line 227 is invoked at describe-level during test collection without a corresponding cleanup. This could leak the stubbed environment variable to subsequent test files.Consider wrapping the stub and build in a
beforeAll/afterAllpattern or addingvi.unstubAllEnvs()in anafterAllhook:♻️ Suggested approach using beforeAll/afterAll
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') + let rslib: Awaited<ReturnType<typeof createRslib>> + let decodedResult: Awaited<ReturnType<typeof decodeTemplate>> 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, - cwd: __dirname, + + beforeAll(async () => { + vi.stubEnv('DEBUG', 'rspeedy') + rslib = await createRslib({ + config: rslibConfig, + cwd: __dirname, + }) + await rslib.build() + decodedResult = await decodeTemplate( + path.join(fixtureDir, 'dist/utils-reactlynx.lynx.bundle'), + ) }) - await rslib.build() - const 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (17)
.changeset/bitter-waves-sleep.md.changeset/calm-spies-judge.mdCODEOWNERSbiome.jsoncexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/src/index.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/entry.tspackages/rspeedy/plugin-react/src/nodeEnv.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tspackages/rspeedy/plugin-react/src/swc.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 (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 ineslint.config.jsincluding React-specific and TypeScript-specific rules
Additional code quality checks must pass according tobiome.jsoncconfiguration
Files:
packages/rspeedy/plugin-react/src/nodeEnv.tspackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/plugin-react/src/swc.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-reactlynx.config.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript with strictest mode configuration as defined in
tsconfig.json
Files:
packages/rspeedy/plugin-react/src/nodeEnv.tspackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/plugin-react/src/swc.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-reactlynx.config.ts
**/*.{js,ts,jsx,tsx,json,md}
📄 CodeRabbit inference engine (AGENTS.md)
Code must conform to formatting rules defined in
.dprint.jsoncconfiguration
Files:
packages/rspeedy/plugin-react/src/nodeEnv.tspackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/plugin-react/src/swc.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-reactlynx.config.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.
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{test,spec}.{ts,tsx,js} : For ReactLynx component testing, use testing-library utilities from `packages/react/testing-library/`
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{tsx,jsx} : JSX in ReactLynx uses custom Rust-based compiler for transforms rather than standard JSX handling
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: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: 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: 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.
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/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: 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 : Use custom CSS properties to control linear layout behavior: `--lynx-display: linear`, `--lynx-linear-orientation`, `--lynx-linear-weight`, `--lynx-linear-weight-sum`, and `--lynx-linear-weight-basis`
📚 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/calm-spies-judge.mdpackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts.changeset/bitter-waves-sleep.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-reactlynx.config.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:
.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/package.json.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/calm-spies-judge.md.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/calm-spies-judge.mdpackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/bitter-waves-sleep.mdexamples/react-externals/rslib-reactlynx.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:
.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tsbiome.jsonc.changeset/bitter-waves-sleep.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/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/package.json.changeset/bitter-waves-sleep.md
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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:
.changeset/calm-spies-judge.mdpackages/rspeedy/plugin-react/src/pluginReactLynx.tsCODEOWNERSexamples/react-externals/rslib-comp-lib.config.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tsexamples/react-externals/rslib-reactlynx.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:
.changeset/calm-spies-judge.mdpackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tsexamples/react-externals/rslib-reactlynx.config.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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:
.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tsCODEOWNERSexamples/react-externals/rslib-comp-lib.config.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-reactlynx.config.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/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-reactlynx.config.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:
.changeset/calm-spies-judge.mdpackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-reactlynx.config.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/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-reactlynx.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:
.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/vitest.config.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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.tspackages/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.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tsexamples/react-externals/rslib-comp-lib.config.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-reactlynx.config.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.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.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-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/vitest.config.tsCODEOWNERSexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-reactlynx.config.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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.tspackages/rspeedy/plugin-react/src/swc.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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.tsCODEOWNERSbiome.jsonc
📚 Learning: 2026-01-12T11:23:23.265Z
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.265Z
Learning: Applies to packages/rspeedy/create-rspeedy/template-common/**/*.{js,jsx,ts,tsx} : Write maintainable, performant, and accessible JavaScript code
Applied to files:
packages/rspeedy/plugin-react/src/pluginReactLynx.tsCODEOWNERSbiome.jsoncpackages/rspeedy/plugin-react/src/entry.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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:
packages/rspeedy/plugin-react/src/pluginReactLynx.tsCODEOWNERSbiome.jsonc
📚 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.tspackages/rspeedy/plugin-react/src/swc.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-reactlynx.config.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.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.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.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/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/plugin-react/src/pluginReactLynx.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/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: 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: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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: 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: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to **/*.{js,ts,jsx,tsx} : Additional code quality checks must pass according to `biome.jsonc` configuration
Applied to files:
biome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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-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
📚 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-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
🧬 Code graph analysis (3)
packages/rspeedy/plugin-react/src/nodeEnv.ts (1)
packages/rspeedy/core/src/index.ts (1)
RsbuildPluginAPI(67-67)
packages/rspeedy/plugin-react/src/pluginReactLynx.ts (2)
packages/rspeedy/plugin-react/src/css.ts (1)
applyCSS(18-194)packages/rspeedy/plugin-react/src/nodeEnv.ts (1)
applyNodeEnv(6-18)
examples/react-externals/rslib-reactlynx.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)
⏰ 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). (5)
- GitHub Check: build / Build (Ubuntu)
- GitHub Check: build / Build (Windows)
- GitHub Check: test-rust / Test (Ubuntu)
- GitHub Check: test-rust / clippy
- GitHub Check: code-style-check
🔇 Additional comments (27)
biome.jsonc (1)
56-58: Fixture-only ignore looks appropriate.Narrowly scoped to test fixtures; consistent with existing ignore patterns.
CODEOWNERS (1)
2-3: LGTM! Code ownership expansion looks appropriate.Adding
@luhc228as an additional maintainer for webpack and rspeedy packages is a straightforward organizational change with correct CODEOWNERS syntax.packages/rspeedy/lynx-bundle-rslib-config/package.json (1)
43-45: LGTM — devDependencies update looks consistent.packages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.ts (3)
1-1: LGTM — runtime side‑effect import is fine for the fixture.
9-22: LGTM — fixture diagnostics are clear.
6-7: Remove the now-unused@ts-expect-errordirective.With the explicit
: anytype annotation, TypeScript does not produce an error on this line, making the@ts-expect-errordirective unused. Remove it.Remove unused directive
-// `@ts-expect-error` -export const abc: any = globalThis?.abc || 0 +export const abc: any = globalThis?.abc || 0examples/react-externals/rslib-comp-lib.config.ts (1)
1-12: LGTM — pluginReactLynx integration is clean.packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (2)
304-316: LGTM — ExternalBundleWebpackPlugin options remain consistent.
192-211: The Symbol key match is confirmed. BothpluginReactLynx(provider at line 393) andexternalBundleEntryRsbuildPlugin(consumer at line 204) use the identicalSymbol.for('LAYERS')key. The plugin enforcement order is correct withenforce: 'post', ensuring the external bundle plugin runs after the React plugin exposes the LAYERS symbol. The hard error for missing LAYERS is an appropriate safeguard..changeset/calm-spies-judge.md (1)
1-5: LGTM!The changeset correctly documents the patch release for
@lynx-js/react-rsbuild-pluginwith a clear description of the new Rslib support feature.packages/rspeedy/lynx-bundle-rslib-config/vitest.config.ts (1)
7-7: LGTM!The addition of the
@lynx-js/vitest-setup/setup.tssetup file properly configures the test environment for the new pluginReactLynx integration tests.packages/rspeedy/plugin-react/src/nodeEnv.ts (1)
6-18: LGTM!The
applyNodeEnvfunction correctly propagates theNODE_ENVenvironment variable to rspack's optimization settings for rslib builds. The fallback tofalsewhenNODE_ENVis undefined is appropriate as it disables automatic NODE_ENV replacement in that case.packages/rspeedy/plugin-react/src/pluginReactLynx.ts (3)
32-32: LGTM!The import for
applyNodeEnvis correctly placed with other local module imports.
331-332: LGTM!The
isRslibdetection viaapi.context.callerNameand the conditional application of CSS handling (skipped for rslib) and NodeEnv configuration (applied for rslib) are well-structured. This appropriately tailors the plugin behavior based on the build context.Also applies to: 346-348, 357-359
407-412: LGTM!The refactored logging using
api.logger?.debugis more idiomatic and portable across different build contexts (rspeedy and rslib).packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (4)
13-16: LGTM!The imports are properly structured, bringing in
LAYERSandpluginReactLynxfrom@lynx-js/react-rsbuild-pluginto support the new test scenarios.
21-27: LGTM!Adding
cwd: __dirnametocreateRslibensures proper path resolution for the test fixtures.
69-70: LGTM!Adding
pluginReactLynx()to the existing test configurations properly validates that external bundle builds work correctly with the plugin integration.Also applies to: 99-100, 130-131, 158-159, 196-197
252-316: LGTM!The test cases for alias resolution and macro handling are thorough. They validate that:
pluginReactLynxcorrectly configures resolver aliases for React, Preact, and related packages- The defineDCE macros properly differentiate between main-thread (
isMainThread:!0) and background (isBackground:!0) contextsprocess.env.NODE_ENVis correctly replaced in both bundle sectionspackages/rspeedy/plugin-react/src/swc.ts (2)
19-23: Verify TSX parsing is intentionally disabled.If any
.tsx/JSX reaches this SWC config,tsx: falsewill trigger parse errors. If JSX is always handled by the Rust transform then this is fine; otherwise consider enabling TSX (or making it conditional).Based on learnings, ReactLynx JSX is handled by the custom Rust compiler, so this may be safe if no TSX flows through SWC.🔧 Possible adjustment if TSX should be supported
parser: { syntax: 'typescript', - tsx: false, + tsx: true, decorators: true, },
30-36: Ensure the env cleanup hook doesn’t clobber existing SWC config.If
mergeRsbuildConfigtreatstools.swcas a replacement, this hook could override user-supplied SWC options. Please confirm composition behavior; if it overwrites, compose the prior config before deletingenv.♻️ Possible composition pattern
- return mergeRsbuildConfig( + const userSwc = config.tools?.swc + return mergeRsbuildConfig( { tools: { swc: { @@ config, { tools: { - swc(config) { + swc(swcConfig) { // Avoid error: "`env` and `jsc.target` cannot be used together" // since rslib will set env by default, we need to clear it - delete config.env - return config + const next = + typeof userSwc === 'function' + ? userSwc(swcConfig) + : { ...swcConfig, ...(userSwc ?? {}) } + delete next.env + return next }, }, }, )packages/rspeedy/plugin-react/src/entry.ts (5)
66-81: Confirm rspeedy exposure is always present.This branch assumes
api.useExposed(Symbol.for('rspeedy.api'))is non-null. Please verify rspeedy always provides it; otherwise consider a clearer error path to avoid a runtime crash on misconfiguration.
124-131: Verify mainThreadChunks expects entry names, not output filenames.
mainThreadChunksis filled withmainThreadName(output path). IfReactWebpackPluginmatches by chunk/entry name, it likely needsmainThreadEntryinstead; otherwise the chunk list won’t match. Please confirm plugin expectations.🔎 If the plugin expects entry names
- mainThreadChunks.push(mainThreadName) + mainThreadChunks.push(mainThreadEntry)
210-246: Re-check inlineScripts behavior in lazy-bundle mode.When
experimental_isLazyBundleis true,inlineScriptsis forced totruewith a TODO about support. Please confirm this is still intended and doesn’t override user config unexpectedly.
248-253: LGTM: web-only encoding hook.Scoping WebEncodePlugin to web environments keeps non-web builds clean.
258-261: LGTM: logger fallback preserves warning visibility.Using
api.logger ?? consolekeeps the warning surfaced even when a logger isn’t wired.examples/react-externals/rslib-reactlynx.config.ts (1)
1-12: LGTM: example now delegates to pluginReactLynx.Nice simplification by leaning on defineExternalBundleRslibConfig plus pluginReactLynx defaults. Please verify the example build still succeeds with the new plugin wiring.
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Yiming Li <yimingli.cs@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts`:
- Around line 221-248: The describe callback for "pluginReactLynx" contains
asynchronous setup (creating rslibConfig, calling createRslib, awaiting
rslib.build and decodeTemplate) which Vitest does not await; move all async
setup into a beforeAll block and any teardown into afterAll so the describe
callback is synchronous; specifically, create rslibConfig, call createRslib(),
await rslib.build(), and await decodeTemplate() inside beforeAll, store results
on variables declared in the outer scope of the describe, and reference those
variables in tests, and perform cleanup in afterAll if needed (keep describe,
rslibConfig, createRslib, rslib.build, and decodeTemplate names to locate the
code).
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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 ineslint.config.jsincluding React-specific and TypeScript-specific rules
Additional code quality checks must pass according tobiome.jsoncconfiguration
Files:
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/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
**/*.{js,ts,jsx,tsx,json,md}
📄 CodeRabbit inference engine (AGENTS.md)
Code must conform to formatting rules defined in
.dprint.jsoncconfiguration
Files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧠 Learnings (19)
📓 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.
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{test,spec}.{ts,tsx,js} : For ReactLynx component testing, use testing-library utilities from `packages/react/testing-library/`
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{tsx,jsx} : JSX in ReactLynx uses custom Rust-based compiler for transforms rather than standard JSX handling
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: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: 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: 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: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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/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/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
📚 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
📚 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
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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:
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 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/test/external-bundle.test.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/test/external-bundle.test.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/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/test/external-bundle.test.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/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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/test/external-bundle.test.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
📚 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-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/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to **/*.{js,ts,jsx,tsx} : Additional code quality checks must pass according to `biome.jsonc` configuration
Applied to files:
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/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/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (4)
packages/rspeedy/plugin-react/src/pluginReactLynx.ts (1)
pluginReactLynx(284-416)packages/rspeedy/lynx-bundle-rslib-config/src/index.ts (1)
defineExternalBundleRslibConfig(11-11)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
defineExternalBundleRslibConfig(167-190)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
decodeTemplate(12-26)
⏰ 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). (1)
- GitHub Check: build / Build (Windows)
🔇 Additional comments (3)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
13-16: Plugin imports aligned with new test coverage.
21-25: SettingcwdforcreateRslibstabilizes fixture-relative paths.
69-70: ConsistentpluginReactLynx()injection across bundle scenarios.Also applies to: 99-100, 130-131, 158-159, 196-197
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
Outdated
Show resolved
Hide resolved
Web Explorer#7227 Bundle Size — 383.77KiB (0%).0b2aa0b(current) vs 82b4052 main#7220(baseline) Bundle metrics
|
| Current #7227 |
Baseline #7220 |
|
|---|---|---|
154.03KiB |
154.03KiB |
|
35.05KiB |
35.05KiB |
|
0% |
0% |
|
8 |
8 |
|
8 |
8 |
|
238 |
238 |
|
16 |
16 |
|
3% |
3% |
|
4 |
4 |
|
0 |
0 |
Bundle size by type no changes
| Current #7227 |
Baseline #7220 |
|
|---|---|---|
251.74KiB |
251.74KiB |
|
96.98KiB |
96.98KiB |
|
35.05KiB |
35.05KiB |
Bundle analysis report Branch feat/support-rslib Project dashboard
Generated by RelativeCI Documentation Report issue
CodSpeed Performance ReportMerging this PR will improve performance by 8.51%Comparing Summary
Performance Changes
Footnotes
|
9a40769 to
24e5d3a
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts`:
- Line 299: Rename the failing test title string in the unit test call to
correct the typo: change the 'it' spec description "should handle marcos" to
"should handle macros" in the test defined in external-bundle.test.ts (the 'it'
call at the noted location) so the test name reads correctly.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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 ineslint.config.jsincluding React-specific and TypeScript-specific rules
Additional code quality checks must pass according tobiome.jsoncconfiguration
Files:
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/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
**/*.{js,ts,jsx,tsx,json,md}
📄 CodeRabbit inference engine (AGENTS.md)
Code must conform to formatting rules defined in
.dprint.jsoncconfiguration
Files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧠 Learnings (23)
📓 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.
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{test,spec}.{ts,tsx,js} : For ReactLynx component testing, use testing-library utilities from `packages/react/testing-library/`
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to packages/react/**/*.{tsx,jsx} : JSX in ReactLynx uses custom Rust-based compiler for transforms rather than standard JSX handling
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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/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/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/test/external-bundle.test.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/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/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/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
📚 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/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 : Use Playwright for all E2E and functional tests with standard assertions like `expect(locator).toBeVisible()`, `expect(locator).toHaveCSS()`, and `diffScreenShot` for screenshot comparisons
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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/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/test/external-bundle.test.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
📚 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/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 : When a component makes external requests (e.g., via `iframe` or `fetch`), mock them using `page.route` in Playwright tests to ensure tests are hermetic and fast
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to **/*.{js,ts,jsx,tsx} : Use async/await patterns with proper error handling in JavaScript/TypeScript code
Applied to files:
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.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/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
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:
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/test/external-bundle.test.ts
📚 Learning: 2026-01-14T06:57:33.600Z
Learnt from: CR
Repo: lynx-family/lynx-stack PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-14T06:57:33.600Z
Learning: Applies to **/*.{js,ts,jsx,tsx} : Additional code quality checks must pass according to `biome.jsonc` configuration
Applied to files:
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 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/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/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/lynx-bundle-rslib-config/test/external-bundle.test.ts
🧬 Code graph analysis (1)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (3)
packages/rspeedy/plugin-react/src/pluginReactLynx.ts (1)
pluginReactLynx(284-416)packages/rspeedy/lynx-bundle-rslib-config/test/utils.ts (1)
decodeTemplate(12-26)packages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.ts (1)
defineExternalBundleRslibConfig(167-190)
🔇 Additional comments (6)
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (6)
11-27: LGTM!The import additions (
beforeAll,afterAll,LAYERS,pluginReactLynx) properly support the new test structure. Addingcwd: __dirnameto the build helper ensures consistent working directory context across test runs.
56-81: LGTM!Adding
pluginReactLynx()to the test configurations and using.sort()on line 77 ensures deterministic assertions regardless of key ordering. The pattern is consistently applied across all external bundle tests.
183-198: LGTM!The
pluginReactLynx()integration in the debug mode artifact tests follows the same pattern as other tests, and the per-test environment stub/unstub approach correctly isolates test state.
221-259: LGTM!The test suite correctly uses
beforeAll/afterAllfor async setup and cleanup, addressing the previous review feedback. The definite assignment assertions (let rslib!,let decodedResult!) are appropriate here sincebeforeAllguarantees initialization before any test runs.
261-297: LGTM!The alias test properly validates the plugin's resolve alias configuration. The inline snapshot with
<WORKSPACE>and<PNPM_INNER>placeholders ensures portability across different development environments.
300-325: LGTM!The macro assertions comprehensively verify:
- Thread-specific flags (
isMainThread,isLepus,isBackground) are correctly set per bundle- Environment flags (
isDev,isProfile) are consistent across both threadsprocess.env.NODE_ENVis properly replaced with"test"
✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
Outdated
Show resolved
Hide resolved
….test.ts Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Yiming Li <yimingli.cs@gmail.com>
fbbb578 to
1b26ea6
Compare
1b26ea6 to
339a9df
Compare
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/react@0.116.0 ### Minor Changes - **BREAKING CHANGE**: Bump Preact from [10.24.0](preactjs/preact@1807173) to [10.28.0](preactjs/preact@f7693b7), see diffs at [hzy/preact#6](hzy/preact#6). ([#2042](#2042)) ### Patch Changes - Add safety checks for compilation macros to prevent runtime errors when they are undefined. ([#2110](#2110)) Replaces direct usage of `__PROFILE__`, `__MAIN_THREAD__`, `__BACKGROUND__` with `typeof` checks. This improves robustness by checking variable existence before access, preventing runtime errors in environments where compilation macros are not defined. ## @lynx-js/lynx-bundle-rslib-config@0.2.0 ### Minor Changes - Use `LAYERS` exposed by DSL plugins ([#2114](#2114)) ## @lynx-js/gesture-runtime@2.1.2 ### Patch Changes - Fix an issue that `NativeGesture` does not get correct types in callback ([#2130](#2130)) ## @lynx-js/rspeedy@0.13.1 ### Patch Changes - Updated dependencies \[]: - @lynx-js/web-rsbuild-server-middleware@0.19.6 ## @lynx-js/react-rsbuild-plugin@0.12.6 ### Patch Changes - Support using `pluginReactLynx` in Rslib. ([#2114](#2114)) - Updated dependencies \[[`4cd7182`](4cd7182)]: - @lynx-js/template-webpack-plugin@0.10.2 - @lynx-js/react-alias-rsbuild-plugin@0.12.6 - @lynx-js/use-sync-external-store@1.5.0 - @lynx-js/react-refresh-webpack-plugin@0.3.4 - @lynx-js/react-webpack-plugin@0.7.3 - @lynx-js/css-extract-webpack-plugin@0.7.0 ## upgrade-rspeedy@0.13.1 ### Patch Changes - Fix the issue `rslib-runtime.js` was not published in dist folder. ([#2122](#2122)) ## @lynx-js/testing-environment@0.1.10 ### Patch Changes - Fix the error "lynxTestingEnv is not defined" ([#2118](#2118)) ## @lynx-js/web-constants@0.19.6 ### Patch Changes - feat: add main-thread API: \_\_QuerySelector ([#2115](#2115)) - fix: when a list-item is deleted from list, the deleted list-item is still showed incorrectly. ([#1092](#1092)) This is because the `enqueueComponent` method does not delete the node from the Element Tree. It is only to maintain the display node on RL, and lynx web needs to delete the dom additionally. - feat: support main thread invoke ui method ([#2104](#2104)) - feat: support lynx.reload() ([#2127](#2127)) - Updated dependencies \[[`f7133c1`](f7133c1)]: - @lynx-js/web-worker-rpc@0.19.6 ## @lynx-js/web-core@0.19.6 ### Patch Changes - fix: avoid crash on CPUs that do not support SIMD ([#2133](#2133)) - feat: support lynx.reload() ([#2127](#2127)) - Updated dependencies \[[`179f984`](179f984), [`f7133c1`](f7133c1), [`6c2b51a`](6c2b51a), [`556fe9f`](556fe9f), [`5b589ab`](5b589ab)]: - @lynx-js/web-constants@0.19.6 - @lynx-js/web-mainthread-apis@0.19.6 - @lynx-js/web-worker-rpc@0.19.6 - @lynx-js/web-worker-runtime@0.19.6 ## @lynx-js/web-core-wasm@0.0.1 ### Patch Changes - Updated dependencies \[[`f7133c1`](f7133c1)]: - @lynx-js/web-worker-rpc@0.19.6 ## @lynx-js/web-mainthread-apis@0.19.6 ### Patch Changes - feat: add main-thread API: \_\_QuerySelector ([#2115](#2115)) - fix: when a list-item is deleted from list, the deleted list-item is still showed incorrectly. ([#1092](#1092)) This is because the `enqueueComponent` method does not delete the node from the Element Tree. It is only to maintain the display node on RL, and lynx web needs to delete the dom additionally. - feat: support main thread invoke ui method ([#2104](#2104)) - fix: mts && bts events can be binded both ([#2121](#2121)) - Updated dependencies \[[`179f984`](179f984), [`f7133c1`](f7133c1), [`6c2b51a`](6c2b51a), [`5b589ab`](5b589ab)]: - @lynx-js/web-constants@0.19.6 ## @lynx-js/web-worker-rpc@0.19.6 ### Patch Changes - fix: when a list-item is deleted from list, the deleted list-item is still showed incorrectly. ([#1092](#1092)) This is because the `enqueueComponent` method does not delete the node from the Element Tree. It is only to maintain the display node on RL, and lynx web needs to delete the dom additionally. ## @lynx-js/web-worker-runtime@0.19.6 ### Patch Changes - feat: support lynx.reload() ([#2127](#2127)) - Updated dependencies \[[`179f984`](179f984), [`f7133c1`](f7133c1), [`6c2b51a`](6c2b51a), [`556fe9f`](556fe9f), [`5b589ab`](5b589ab)]: - @lynx-js/web-constants@0.19.6 - @lynx-js/web-mainthread-apis@0.19.6 - @lynx-js/web-worker-rpc@0.19.6 ## @lynx-js/template-webpack-plugin@0.10.2 ### Patch Changes - Polyfill `lynx.requireModuleAsync` to allow cache same parallel requests. ([#2108](#2108)) ## create-rspeedy@0.13.1 ## @lynx-js/react-alias-rsbuild-plugin@0.12.6 ## @lynx-js/web-core-server@0.19.6 ## @lynx-js/web-rsbuild-server-middleware@0.19.6 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit
Breaking Changes
New Features
Documentation
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist