feat(lynx-bundle-rslib-config): use LAYERS exposed by DSL plugins#2113
feat(lynx-bundle-rslib-config): use LAYERS exposed by DSL plugins#2113
LAYERS exposed by DSL plugins#2113Conversation
🦋 Changeset detectedLatest commit: 506536f The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
📝 WalkthroughWalkthroughRefactors how LAYERS are provided: removed the module-exported 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 |
There was a problem hiding this comment.
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
LAYERSfrom@lynx-js/lynx-bundle-rslib-config, but it is not part of the public API. Users following these examples will encounter import errors.LAYERSis 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 pluginApply 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.useExposedwith 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
📒 Files selected for processing (4)
.changeset/bitter-waves-sleep.mdpackages/rspeedy/lynx-bundle-rslib-config/etc/lynx-bundle-rslib-config.api.mdpackages/rspeedy/lynx-bundle-rslib-config/src/externalBundleRslibConfig.tspackages/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 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/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.jsoncconfiguration
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.mdpackages/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
ExposedLayersinterface 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_THREADlayer- Explicit
BACKGROUNDlayer- 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.
❌ 1 Tests Failed:
View the top 1 failed test(s) by shortest run time
To view more test analytics, go to the Test Analytics Dashboard |
Merging this PR will degrade performance by 8.93%
Performance Changes
Comparing Footnotes
|
Web Explorer#7191 Bundle Size — 383.59KiB (0%).ff1e3e4(current) vs a7a2ad7 main#7179(baseline) Bundle metrics
Bundle size by type
|
| Current #7191 |
Baseline #7179 |
|
|---|---|---|
251.56KiB |
251.56KiB |
|
96.98KiB |
96.98KiB |
|
35.05KiB |
35.05KiB |
Bundle analysis report Branch feat/external-bundle-entry-layer... Project dashboard
Generated by RelativeCI Documentation Report issue
There was a problem hiding this comment.
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 pushesimportsinto itself, which doesn't add the array items fromitem. This should push...iteminstead.🐛 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-errordirective.With
abcnow typed asany, the@ts-expect-errordirective on line 6 may no longer be suppressing an actual error and could become a linting issue itself. IfglobalThis?.abcno longer triggers a type error, the directive should be removed.♻️ Suggested fix
-// `@ts-expect-error` export const abc: any = globalThis?.abc || 0packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts (1)
220-248: Move test setup intobeforeAllfor proper test isolation.The
vi.stubEnv,createRslib, andrslib.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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (13)
.changeset/calm-spies-judge.mdCODEOWNERSbiome.jsoncexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.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/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
🧰 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/vitest.config.tspackages/rspeedy/plugin-react/src/nodeEnv.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/plugin-react/src/swc.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.tspackages/rspeedy/plugin-react/src/nodeEnv.tspackages/rspeedy/plugin-react/src/pluginReactLynx.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/plugin-react/src/swc.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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/vitest.config.tspackages/rspeedy/plugin-react/src/nodeEnv.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/plugin-react/src/swc.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.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/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.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.tsbiome.jsonc.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.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/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.tsbiome.jsoncpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.tsbiome.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.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonbiome.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.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonbiome.jsoncpackages/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.tsCODEOWNERSbiome.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.tspackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.ts.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.tsCODEOWNERSpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.tsbiome.jsonc.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.tspackages/rspeedy/plugin-react/src/pluginReactLynx.ts.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/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.tspackages/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:
CODEOWNERSbiome.jsoncpackages/rspeedy/plugin-react/src/entry.tspackages/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:
CODEOWNERSpackages/rspeedy/lynx-bundle-rslib-config/package.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.tsbiome.jsonc.changeset/calm-spies-judge.mdexamples/react-externals/rslib-comp-lib.config.tspackages/rspeedy/plugin-react/src/swc.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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:
CODEOWNERSpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/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:
CODEOWNERSpackages/rspeedy/plugin-react/src/pluginReactLynx.tsbiome.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.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.ts.changeset/calm-spies-judge.mdpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.ts.changeset/calm-spies-judge.mdexamples/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.jsonpackages/rspeedy/plugin-react/src/pluginReactLynx.tspackages/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.mdexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.mdpackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.tspackages/rspeedy/plugin-react/src/swc.tspackages/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.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/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.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tspackages/rspeedy/plugin-react/src/entry.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.tspackages/rspeedy/lynx-bundle-rslib-config/test/fixtures/utils-lib/index.tsexamples/react-externals/rslib-comp-lib.config.tsexamples/react-externals/rslib-reactlynx.config.tspackages/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.jsoncpackages/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.logstatements andanytypes) 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
@luhc228as a code owner forpackages/webpack/**andpackages/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
mergeEnvironmentConfigfor safe config merging. Using bracket notationprocess.env['NODE_ENV']prevents bundler string replacement during build, and defaulting tofalsewhen undefined is appropriate to avoid unintended code transformations.packages/rspeedy/plugin-react/src/swc.ts (2)
19-23: Verifytsx: falseis 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
envfrom 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.logstatements test that DCE flags (__MAIN_THREAD__,__LEPUS__,__BACKGROUND__), define flags (__DEV__,__PROFILE__), andprocess.env.NODE_ENVare 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
isRslibflag 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.debugtoapi.logger?.debugis 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/reactand@lynx-js/react-rsbuild-pluginsupport tests usingpluginReactLynx@lynx-js/vitest-setupcorresponds to thesetupFilesaddition invitest.config.tsUsing
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
isRspeedycheck correctly confines the entry transformation logic to rspeedy invocations, allowing rslib to handle entries through its own path (likely via theapplyNodeEnvinpluginReactLynx.ts).The
biome-ignorecomment is appropriate sinceapi.useExposedis 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
isRspeedyblock alongside the isWeb check, ensuring web-specific encoding only applies in the appropriate context.
258-258: LGTM! Safe logger fallback.Using
(api.logger ?? console).warnprovides 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
patchlevel 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
setupFilesentry 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
LAYERSandpluginReactLynxfrom@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
pluginReactAliasand manual rspack tooling withpluginReactLynx(). The externals mapping is comprehensive and correctly covers all the@lynx-js/reactsubpaths.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
defineblocks in favor ofpluginReactLynx()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.
packages/rspeedy/lynx-bundle-rslib-config/test/external-bundle.test.ts
Outdated
Show resolved
Hide resolved
ff1e3e4 to
506536f
Compare
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.
Checklist